diff --git a/docs-tfg/req_sol_object_exceeds_printing_area.txt b/docs-tfg/req_sol_object_exceeds_printing_area.txt
new file mode 100644
index 000000000..037ecc8ac
--- /dev/null
+++ b/docs-tfg/req_sol_object_exceeds_printing_area.txt
@@ -0,0 +1,15 @@
+Requirements for warning if object exceedes printing area
+ -Check if file is gcode (stl as well?)
+ -Consult G0 and G1 commands
+ -Consult dimensions in settings (possible to do also in firmware?)
+ -Compare command values with dimensions
+
+Solution:
+ -Changed analysis.py under /src/octoprint
+ -Added warning to result, which can be true or false depending on the analysis.
+
+ -Changed files.js under /src/octoprint/static/js/app/viewmodels
+
+ -Checked data["gcodeAnalysis"]["warning"]. In case it is true, creates a new Pnotify object to warn the user that an object inside the file exceeds the printing area.
+
+ -Checked data["name"] to get the name of the file
diff --git a/docs-tfg/req_sol_slic3r_integration.txt b/docs-tfg/req_sol_slic3r_integration.txt
new file mode 100644
index 000000000..b674252ca
--- /dev/null
+++ b/docs-tfg/req_sol_slic3r_integration.txt
@@ -0,0 +1,9 @@
+Requirements to integrate Slic3r:
+ -Integration of Slic3r as a plugin
+ -Add Slic3r to plugins menu under settings
+ -When Slic3r is selected, add:
+ -A box to introduce the path
+ -A box to introduce each of the related profile files:
+ -Print settings
+ -Filament settings
+ -Printer settings
diff --git a/src/octoprint/filemanager/analysis.py b/src/octoprint/filemanager/analysis.py
index cd4ca7fdf..777744adb 100644
--- a/src/octoprint/filemanager/analysis.py
+++ b/src/octoprint/filemanager/analysis.py
@@ -17,6 +17,8 @@ from octoprint.events import Events, eventManager
import octoprint.util.gcodeInterpreter as gcodeInterpreter
+#Added to check if object exceeds printing area
+from octoprint.printer.profile import PrinterProfileManager
class QueueEntry(collections.namedtuple("QueueEntry", "path, type, location, absolute_path, printer_profile")):
"""
@@ -258,8 +260,9 @@ class GcodeAnalysisQueue(AbstractAnalysisQueue):
self._gcode = gcodeInterpreter.gcode()
self._gcode.load(self._current.absolute_path, self._current.printer_profile, throttle=throttle_callback)
-
+
result = dict()
+ result["warning"]=self._gcode.getWarning()
if self._gcode.totalMoveTimeMinute:
result["estimatedPrintTime"] = self._gcode.totalMoveTimeMinute * 60
if self._gcode.extrusionAmount:
diff --git a/src/octoprint/static/js/app/viewmodels/files.js b/src/octoprint/static/js/app/viewmodels/files.js
index ae510fee4..39cede39c 100644
--- a/src/octoprint/static/js/app/viewmodels/files.js
+++ b/src/octoprint/static/js/app/viewmodels/files.js
@@ -327,6 +327,17 @@ $(function() {
}
}
output += gettext("Estimated Print Time") + ": " + formatDuration(data["gcodeAnalysis"]["estimatedPrintTime"]) + " ";
+ if(data["gcodeAnalysis"]["warning"])
+ {
+ var warning = "
" + gettext("Object exceeds printing area") + "
";
+ warning += pnotifyAdditionalInfo("
Object or objects in file '"+data["name"]+"' exceeds the printing area
");
+ new PNotify({
+ title: "Object dimensions",
+ text: warning,
+ type: "warning",
+ hide: false
+ });
+ }
}
if (data["prints"] && data["prints"]["last"]) {
output += gettext("Last Printed") + ": " + formatTimeAgo(data["prints"]["last"]["date"]) + " ";
@@ -402,11 +413,17 @@ $(function() {
if (_.endsWith(filename.toLowerCase(), ".stl")) {
self.slicing.show(location, filename);
}
-
+
if (data.result.done) {
$("#gcode_upload_progress .bar").css("width", "0%");
$("#gcode_upload_progress").removeClass("progress-striped").removeClass("active");
$("#gcode_upload_progress .bar").text("");
+ /*var cadena="";
+ for(var i in data)
+ {
+ cadena+=" "+i+"\t";
+};*/
+
}
}
diff --git a/src/octoprint/util/gcodeInterpreter.py b/src/octoprint/util/gcodeInterpreter.py
index 853cbfd62..e64436e68 100644
--- a/src/octoprint/util/gcodeInterpreter.py
+++ b/src/octoprint/util/gcodeInterpreter.py
@@ -30,6 +30,8 @@ class gcode(object):
self.progressCallback = None
self._abort = False
self._filamentDiameter = 0
+ #Parameters for object size checking
+ self.warn=False
def load(self, filename, printer_profile, throttle=None):
if os.path.isfile(filename):
@@ -117,6 +119,13 @@ class gcode(object):
z = getCodeFloat(line, 'Z')
e = getCodeFloat(line, 'E')
f = getCodeFloat(line, 'F')
+ #Check if x,y or z exceeds printing area
+ width=float(printer_profile["volume"]["width"])
+ depth=float(printer_profile["volume"]["depth"])
+ height=float(printer_profile["volume"]["height"])
+ if not self.warn and (x>width or y>depth or z>height):
+ self.warn=True
+ self._logger.warn("Object is bigger than the printing area")
oldPos = pos
pos = pos[:]
if posAbs:
@@ -255,6 +264,8 @@ class gcode(object):
def _parseCuraProfileString(self, comment, prefix):
return {key: value for (key, value) in map(lambda x: x.split("=", 1), zlib.decompress(base64.b64decode(comment[len(prefix):])).split("\b"))}
+ def getWarning(self):
+ return self.warn
def getCodeInt(line, code):
n = line.find(code) + 1
diff --git a/venv/bin/activate b/venv/bin/activate
new file mode 100644
index 000000000..ea57db9a0
--- /dev/null
+++ b/venv/bin/activate
@@ -0,0 +1,80 @@
+# This file must be used with "source bin/activate" *from bash*
+# you cannot run it directly
+
+deactivate () {
+ unset pydoc
+
+ # reset old environment variables
+ if [ -n "$_OLD_VIRTUAL_PATH" ] ; then
+ PATH="$_OLD_VIRTUAL_PATH"
+ export PATH
+ unset _OLD_VIRTUAL_PATH
+ fi
+ if [ -n "$_OLD_VIRTUAL_PYTHONHOME" ] ; then
+ PYTHONHOME="$_OLD_VIRTUAL_PYTHONHOME"
+ export PYTHONHOME
+ unset _OLD_VIRTUAL_PYTHONHOME
+ fi
+
+ # This should detect bash and zsh, which have a hash command that must
+ # be called to get it to forget past commands. Without forgetting
+ # past commands the $PATH changes we made may not be respected
+ if [ -n "$BASH" -o -n "$ZSH_VERSION" ] ; then
+ hash -r 2>/dev/null
+ fi
+
+ if [ -n "$_OLD_VIRTUAL_PS1" ] ; then
+ PS1="$_OLD_VIRTUAL_PS1"
+ export PS1
+ unset _OLD_VIRTUAL_PS1
+ fi
+
+ unset VIRTUAL_ENV
+ if [ ! "$1" = "nondestructive" ] ; then
+ # Self destruct!
+ unset -f deactivate
+ fi
+}
+
+# unset irrelevant variables
+deactivate nondestructive
+
+VIRTUAL_ENV="/home/pi/OctoPrint-TFG/venv"
+export VIRTUAL_ENV
+
+_OLD_VIRTUAL_PATH="$PATH"
+PATH="$VIRTUAL_ENV/bin:$PATH"
+export PATH
+
+# unset PYTHONHOME if set
+# this will fail if PYTHONHOME is set to the empty string (which is bad anyway)
+# could use `if (set -u; : $PYTHONHOME) ;` in bash
+if [ -n "$PYTHONHOME" ] ; then
+ _OLD_VIRTUAL_PYTHONHOME="$PYTHONHOME"
+ unset PYTHONHOME
+fi
+
+if [ -z "$VIRTUAL_ENV_DISABLE_PROMPT" ] ; then
+ _OLD_VIRTUAL_PS1="$PS1"
+ if [ "x" != x ] ; then
+ PS1="$PS1"
+ else
+ if [ "`basename \"$VIRTUAL_ENV\"`" = "__" ] ; then
+ # special case for Aspen magic directories
+ # see http://www.zetadev.com/software/aspen/
+ PS1="[`basename \`dirname \"$VIRTUAL_ENV\"\``] $PS1"
+ else
+ PS1="(`basename \"$VIRTUAL_ENV\"`)$PS1"
+ fi
+ fi
+ export PS1
+fi
+
+alias pydoc="python -m pydoc"
+
+# This should detect bash and zsh, which have a hash command that must
+# be called to get it to forget past commands. Without forgetting
+# past commands the $PATH changes we made may not be respected
+if [ -n "$BASH" -o -n "$ZSH_VERSION" ] ; then
+ hash -r 2>/dev/null
+fi
diff --git a/venv/bin/activate.csh b/venv/bin/activate.csh
new file mode 100644
index 000000000..5d597677d
--- /dev/null
+++ b/venv/bin/activate.csh
@@ -0,0 +1,42 @@
+# This file must be used with "source bin/activate.csh" *from csh*.
+# You cannot run it directly.
+# Created by Davide Di Blasi .
+
+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'
+
+# Unset irrelevant variables.
+deactivate nondestructive
+
+setenv VIRTUAL_ENV "/home/pi/OctoPrint-TFG/venv"
+
+set _OLD_VIRTUAL_PATH="$PATH"
+setenv PATH "$VIRTUAL_ENV/bin:$PATH"
+
+
+
+if ("" != "") then
+ set env_name = ""
+else
+ if (`basename "$VIRTUAL_ENV"` == "__") then
+ # special case for Aspen magic directories
+ # see http://www.zetadev.com/software/aspen/
+ set env_name = `basename \`dirname "$VIRTUAL_ENV"\``
+ else
+ set env_name = `basename "$VIRTUAL_ENV"`
+ endif
+endif
+
+# Could be in a non-interactive environment,
+# in which case, $prompt is undefined and we wouldn't
+# care about the prompt anyway.
+if ( $?prompt ) then
+ set _OLD_VIRTUAL_PROMPT="$prompt"
+ set prompt = "[$env_name] $prompt"
+endif
+
+unset env_name
+
+alias pydoc python -m pydoc
+
+rehash
+
diff --git a/venv/bin/activate.fish b/venv/bin/activate.fish
new file mode 100644
index 000000000..d8c49d1f0
--- /dev/null
+++ b/venv/bin/activate.fish
@@ -0,0 +1,74 @@
+# This file must be used with "source bin/activate.fish" *from fish* (http://fishshell.com)
+# you cannot run it directly
+
+function deactivate -d "Exit virtualenv and return to normal shell environment"
+ # reset old environment variables
+ if test -n "$_OLD_VIRTUAL_PATH"
+ set -gx PATH $_OLD_VIRTUAL_PATH
+ set -e _OLD_VIRTUAL_PATH
+ end
+ if test -n "$_OLD_VIRTUAL_PYTHONHOME"
+ set -gx PYTHONHOME $_OLD_VIRTUAL_PYTHONHOME
+ set -e _OLD_VIRTUAL_PYTHONHOME
+ end
+
+ if test -n "$_OLD_FISH_PROMPT_OVERRIDE"
+ # set an empty local fish_function_path, so fish_prompt doesn't automatically reload
+ set -l fish_function_path
+ # erase the virtualenv's fish_prompt function, and restore the original
+ functions -e fish_prompt
+ functions -c _old_fish_prompt fish_prompt
+ functions -e _old_fish_prompt
+ set -e _OLD_FISH_PROMPT_OVERRIDE
+ end
+
+ set -e VIRTUAL_ENV
+ if test "$argv[1]" != "nondestructive"
+ # Self destruct!
+ functions -e deactivate
+ end
+end
+
+# unset irrelevant variables
+deactivate nondestructive
+
+set -gx VIRTUAL_ENV "/home/pi/OctoPrint-TFG/venv"
+
+set -gx _OLD_VIRTUAL_PATH $PATH
+set -gx PATH "$VIRTUAL_ENV/bin" $PATH
+
+# unset PYTHONHOME if set
+if set -q PYTHONHOME
+ set -gx _OLD_VIRTUAL_PYTHONHOME $PYTHONHOME
+ set -e PYTHONHOME
+end
+
+if test -z "$VIRTUAL_ENV_DISABLE_PROMPT"
+ # fish uses a function instead of an env var to generate the prompt.
+
+ # copy the current fish_prompt function as the function _old_fish_prompt
+ functions -c fish_prompt _old_fish_prompt
+
+ # with the original prompt function copied, we can override with our own.
+ function fish_prompt
+ # Prompt override?
+ if test -n ""
+ printf "%s%s" "" (set_color normal)
+ _old_fish_prompt
+ return
+ end
+ # ...Otherwise, prepend env
+ set -l _checkbase (basename "$VIRTUAL_ENV")
+ if test $_checkbase = "__"
+ # special case for Aspen magic directories
+ # see http://www.zetadev.com/software/aspen/
+ printf "%s[%s]%s " (set_color -b blue white) (basename (dirname "$VIRTUAL_ENV")) (set_color normal)
+ _old_fish_prompt
+ else
+ printf "%s(%s)%s" (set_color -b blue white) (basename "$VIRTUAL_ENV") (set_color normal)
+ _old_fish_prompt
+ end
+ end
+
+ set -gx _OLD_FISH_PROMPT_OVERRIDE "$VIRTUAL_ENV"
+end
diff --git a/venv/bin/activate_this.py b/venv/bin/activate_this.py
new file mode 100644
index 000000000..ea12c28ac
--- /dev/null
+++ b/venv/bin/activate_this.py
@@ -0,0 +1,34 @@
+"""By using execfile(this_file, dict(__file__=this_file)) you will
+activate this virtualenv environment.
+
+This can be used when you must use an existing Python interpreter, not
+the virtualenv bin/python
+"""
+
+try:
+ __file__
+except NameError:
+ raise AssertionError(
+ "You must run this like execfile('path/to/activate_this.py', dict(__file__='path/to/activate_this.py'))")
+import sys
+import os
+
+old_os_path = os.environ['PATH']
+os.environ['PATH'] = os.path.dirname(os.path.abspath(__file__)) + os.pathsep + old_os_path
+base = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
+if sys.platform == 'win32':
+ site_packages = os.path.join(base, 'Lib', 'site-packages')
+else:
+ site_packages = os.path.join(base, 'lib', 'python%s' % sys.version[:3], 'site-packages')
+prev_sys_path = list(sys.path)
+import site
+site.addsitedir(site_packages)
+sys.real_prefix = sys.prefix
+sys.prefix = base
+# Move the added items to the front of the path:
+new_sys_path = []
+for item in list(sys.path):
+ if item not in prev_sys_path:
+ new_sys_path.append(item)
+ sys.path.remove(item)
+sys.path[:0] = new_sys_path
diff --git a/venv/bin/easy_install b/venv/bin/easy_install
new file mode 100755
index 000000000..cdc5f1c62
--- /dev/null
+++ b/venv/bin/easy_install
@@ -0,0 +1,11 @@
+#!/home/pi/OctoPrint-TFG/venv/bin/python2
+
+# -*- coding: utf-8 -*-
+import re
+import sys
+
+from setuptools.command.easy_install import main
+
+if __name__ == '__main__':
+ sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
+ sys.exit(main())
diff --git a/venv/bin/easy_install-2.7 b/venv/bin/easy_install-2.7
new file mode 100755
index 000000000..cdc5f1c62
--- /dev/null
+++ b/venv/bin/easy_install-2.7
@@ -0,0 +1,11 @@
+#!/home/pi/OctoPrint-TFG/venv/bin/python2
+
+# -*- coding: utf-8 -*-
+import re
+import sys
+
+from setuptools.command.easy_install import main
+
+if __name__ == '__main__':
+ sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
+ sys.exit(main())
diff --git a/venv/bin/miniterm.py b/venv/bin/miniterm.py
new file mode 100755
index 000000000..ebb7549d6
--- /dev/null
+++ b/venv/bin/miniterm.py
@@ -0,0 +1,4 @@
+#!/home/pi/OctoPrint-TFG/venv/bin/python
+# EASY-INSTALL-SCRIPT: 'pyserial==2.7','miniterm.py'
+__requires__ = 'pyserial==2.7'
+__import__('pkg_resources').run_script('pyserial==2.7', 'miniterm.py')
diff --git a/venv/bin/netaddr b/venv/bin/netaddr
new file mode 100755
index 000000000..67f20ec12
--- /dev/null
+++ b/venv/bin/netaddr
@@ -0,0 +1,4 @@
+#!/home/pi/OctoPrint-TFG/venv/bin/python
+# EASY-INSTALL-SCRIPT: 'netaddr==0.7.17','netaddr'
+__requires__ = 'netaddr==0.7.17'
+__import__('pkg_resources').run_script('netaddr==0.7.17', 'netaddr')
diff --git a/venv/bin/octoprint b/venv/bin/octoprint
new file mode 100755
index 000000000..fc19a0b49
--- /dev/null
+++ b/venv/bin/octoprint
@@ -0,0 +1,10 @@
+#!/home/pi/OctoPrint-TFG/venv/bin/python
+# EASY-INSTALL-ENTRY-SCRIPT: 'OctoPrint==1.2.8','console_scripts','octoprint'
+__requires__ = 'OctoPrint==1.2.8'
+import sys
+from pkg_resources import load_entry_point
+
+if __name__ == '__main__':
+ sys.exit(
+ load_entry_point('OctoPrint==1.2.8', 'console_scripts', 'octoprint')()
+ )
diff --git a/venv/bin/pip b/venv/bin/pip
new file mode 100755
index 000000000..74902c5a5
--- /dev/null
+++ b/venv/bin/pip
@@ -0,0 +1,11 @@
+#!/home/pi/OctoPrint-TFG/venv/bin/python2
+
+# -*- coding: utf-8 -*-
+import re
+import sys
+
+from pip import main
+
+if __name__ == '__main__':
+ sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
+ sys.exit(main())
diff --git a/venv/bin/pip2 b/venv/bin/pip2
new file mode 100755
index 000000000..74902c5a5
--- /dev/null
+++ b/venv/bin/pip2
@@ -0,0 +1,11 @@
+#!/home/pi/OctoPrint-TFG/venv/bin/python2
+
+# -*- coding: utf-8 -*-
+import re
+import sys
+
+from pip import main
+
+if __name__ == '__main__':
+ sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
+ sys.exit(main())
diff --git a/venv/bin/pip2.7 b/venv/bin/pip2.7
new file mode 100755
index 000000000..74902c5a5
--- /dev/null
+++ b/venv/bin/pip2.7
@@ -0,0 +1,11 @@
+#!/home/pi/OctoPrint-TFG/venv/bin/python2
+
+# -*- coding: utf-8 -*-
+import re
+import sys
+
+from pip import main
+
+if __name__ == '__main__':
+ sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
+ sys.exit(main())
diff --git a/venv/bin/pkginfo b/venv/bin/pkginfo
new file mode 100755
index 000000000..f633a4310
--- /dev/null
+++ b/venv/bin/pkginfo
@@ -0,0 +1,10 @@
+#!/home/pi/OctoPrint-TFG/venv/bin/python
+# EASY-INSTALL-ENTRY-SCRIPT: 'pkginfo==1.2.1','console_scripts','pkginfo'
+__requires__ = 'pkginfo==1.2.1'
+import sys
+from pkg_resources import load_entry_point
+
+if __name__ == '__main__':
+ sys.exit(
+ load_entry_point('pkginfo==1.2.1', 'console_scripts', 'pkginfo')()
+ )
diff --git a/venv/bin/pybabel b/venv/bin/pybabel
new file mode 100755
index 000000000..6e35340cb
--- /dev/null
+++ b/venv/bin/pybabel
@@ -0,0 +1,10 @@
+#!/home/pi/OctoPrint-TFG/venv/bin/python
+# EASY-INSTALL-ENTRY-SCRIPT: 'Babel==2.2.0','console_scripts','pybabel'
+__requires__ = 'Babel==2.2.0'
+import sys
+from pkg_resources import load_entry_point
+
+if __name__ == '__main__':
+ sys.exit(
+ load_entry_point('Babel==2.2.0', 'console_scripts', 'pybabel')()
+ )
diff --git a/venv/bin/pyrsa-decrypt b/venv/bin/pyrsa-decrypt
new file mode 100755
index 000000000..56f479e39
--- /dev/null
+++ b/venv/bin/pyrsa-decrypt
@@ -0,0 +1,10 @@
+#!/home/pi/OctoPrint-TFG/venv/bin/python
+# EASY-INSTALL-ENTRY-SCRIPT: 'rsa==3.2','console_scripts','pyrsa-decrypt'
+__requires__ = 'rsa==3.2'
+import sys
+from pkg_resources import load_entry_point
+
+if __name__ == '__main__':
+ sys.exit(
+ load_entry_point('rsa==3.2', 'console_scripts', 'pyrsa-decrypt')()
+ )
diff --git a/venv/bin/pyrsa-decrypt-bigfile b/venv/bin/pyrsa-decrypt-bigfile
new file mode 100755
index 000000000..7221539fa
--- /dev/null
+++ b/venv/bin/pyrsa-decrypt-bigfile
@@ -0,0 +1,10 @@
+#!/home/pi/OctoPrint-TFG/venv/bin/python
+# EASY-INSTALL-ENTRY-SCRIPT: 'rsa==3.2','console_scripts','pyrsa-decrypt-bigfile'
+__requires__ = 'rsa==3.2'
+import sys
+from pkg_resources import load_entry_point
+
+if __name__ == '__main__':
+ sys.exit(
+ load_entry_point('rsa==3.2', 'console_scripts', 'pyrsa-decrypt-bigfile')()
+ )
diff --git a/venv/bin/pyrsa-encrypt b/venv/bin/pyrsa-encrypt
new file mode 100755
index 000000000..23c9a46aa
--- /dev/null
+++ b/venv/bin/pyrsa-encrypt
@@ -0,0 +1,10 @@
+#!/home/pi/OctoPrint-TFG/venv/bin/python
+# EASY-INSTALL-ENTRY-SCRIPT: 'rsa==3.2','console_scripts','pyrsa-encrypt'
+__requires__ = 'rsa==3.2'
+import sys
+from pkg_resources import load_entry_point
+
+if __name__ == '__main__':
+ sys.exit(
+ load_entry_point('rsa==3.2', 'console_scripts', 'pyrsa-encrypt')()
+ )
diff --git a/venv/bin/pyrsa-encrypt-bigfile b/venv/bin/pyrsa-encrypt-bigfile
new file mode 100755
index 000000000..9acec6001
--- /dev/null
+++ b/venv/bin/pyrsa-encrypt-bigfile
@@ -0,0 +1,10 @@
+#!/home/pi/OctoPrint-TFG/venv/bin/python
+# EASY-INSTALL-ENTRY-SCRIPT: 'rsa==3.2','console_scripts','pyrsa-encrypt-bigfile'
+__requires__ = 'rsa==3.2'
+import sys
+from pkg_resources import load_entry_point
+
+if __name__ == '__main__':
+ sys.exit(
+ load_entry_point('rsa==3.2', 'console_scripts', 'pyrsa-encrypt-bigfile')()
+ )
diff --git a/venv/bin/pyrsa-keygen b/venv/bin/pyrsa-keygen
new file mode 100755
index 000000000..bc4eeb0d8
--- /dev/null
+++ b/venv/bin/pyrsa-keygen
@@ -0,0 +1,10 @@
+#!/home/pi/OctoPrint-TFG/venv/bin/python
+# EASY-INSTALL-ENTRY-SCRIPT: 'rsa==3.2','console_scripts','pyrsa-keygen'
+__requires__ = 'rsa==3.2'
+import sys
+from pkg_resources import load_entry_point
+
+if __name__ == '__main__':
+ sys.exit(
+ load_entry_point('rsa==3.2', 'console_scripts', 'pyrsa-keygen')()
+ )
diff --git a/venv/bin/pyrsa-priv2pub b/venv/bin/pyrsa-priv2pub
new file mode 100755
index 000000000..00d0909a4
--- /dev/null
+++ b/venv/bin/pyrsa-priv2pub
@@ -0,0 +1,10 @@
+#!/home/pi/OctoPrint-TFG/venv/bin/python
+# EASY-INSTALL-ENTRY-SCRIPT: 'rsa==3.2','console_scripts','pyrsa-priv2pub'
+__requires__ = 'rsa==3.2'
+import sys
+from pkg_resources import load_entry_point
+
+if __name__ == '__main__':
+ sys.exit(
+ load_entry_point('rsa==3.2', 'console_scripts', 'pyrsa-priv2pub')()
+ )
diff --git a/venv/bin/pyrsa-sign b/venv/bin/pyrsa-sign
new file mode 100755
index 000000000..1c39782a4
--- /dev/null
+++ b/venv/bin/pyrsa-sign
@@ -0,0 +1,10 @@
+#!/home/pi/OctoPrint-TFG/venv/bin/python
+# EASY-INSTALL-ENTRY-SCRIPT: 'rsa==3.2','console_scripts','pyrsa-sign'
+__requires__ = 'rsa==3.2'
+import sys
+from pkg_resources import load_entry_point
+
+if __name__ == '__main__':
+ sys.exit(
+ load_entry_point('rsa==3.2', 'console_scripts', 'pyrsa-sign')()
+ )
diff --git a/venv/bin/pyrsa-verify b/venv/bin/pyrsa-verify
new file mode 100755
index 000000000..b4e1044ab
--- /dev/null
+++ b/venv/bin/pyrsa-verify
@@ -0,0 +1,10 @@
+#!/home/pi/OctoPrint-TFG/venv/bin/python
+# EASY-INSTALL-ENTRY-SCRIPT: 'rsa==3.2','console_scripts','pyrsa-verify'
+__requires__ = 'rsa==3.2'
+import sys
+from pkg_resources import load_entry_point
+
+if __name__ == '__main__':
+ sys.exit(
+ load_entry_point('rsa==3.2', 'console_scripts', 'pyrsa-verify')()
+ )
diff --git a/venv/bin/python b/venv/bin/python
new file mode 120000
index 000000000..551ab2685
--- /dev/null
+++ b/venv/bin/python
@@ -0,0 +1 @@
+python2
\ No newline at end of file
diff --git a/venv/bin/python2 b/venv/bin/python2
new file mode 100755
index 000000000..5e5d6696f
Binary files /dev/null and b/venv/bin/python2 differ
diff --git a/venv/bin/python2.7 b/venv/bin/python2.7
new file mode 120000
index 000000000..551ab2685
--- /dev/null
+++ b/venv/bin/python2.7
@@ -0,0 +1 @@
+python2
\ No newline at end of file
diff --git a/venv/bin/watchmedo b/venv/bin/watchmedo
new file mode 100755
index 000000000..46f930887
--- /dev/null
+++ b/venv/bin/watchmedo
@@ -0,0 +1,10 @@
+#!/home/pi/OctoPrint-TFG/venv/bin/python
+# EASY-INSTALL-ENTRY-SCRIPT: 'watchdog==0.8.3','console_scripts','watchmedo'
+__requires__ = 'watchdog==0.8.3'
+import sys
+from pkg_resources import load_entry_point
+
+if __name__ == '__main__':
+ sys.exit(
+ load_entry_point('watchdog==0.8.3', 'console_scripts', 'watchmedo')()
+ )
diff --git a/venv/bin/webassets b/venv/bin/webassets
new file mode 100755
index 000000000..550750965
--- /dev/null
+++ b/venv/bin/webassets
@@ -0,0 +1,10 @@
+#!/home/pi/OctoPrint-TFG/venv/bin/python
+# EASY-INSTALL-ENTRY-SCRIPT: 'webassets==0.11.1','console_scripts','webassets'
+__requires__ = 'webassets==0.11.1'
+import sys
+from pkg_resources import load_entry_point
+
+if __name__ == '__main__':
+ sys.exit(
+ load_entry_point('webassets==0.11.1', 'console_scripts', 'webassets')()
+ )
diff --git a/venv/include/python2.7 b/venv/include/python2.7
new file mode 120000
index 000000000..ad4ca80ba
--- /dev/null
+++ b/venv/include/python2.7
@@ -0,0 +1 @@
+/usr/include/python2.7
\ No newline at end of file
diff --git a/venv/lib/python-wheels/chardet-2.3.0-py2.py3-none-any.whl b/venv/lib/python-wheels/chardet-2.3.0-py2.py3-none-any.whl
new file mode 100644
index 000000000..d4f3e27b9
Binary files /dev/null and b/venv/lib/python-wheels/chardet-2.3.0-py2.py3-none-any.whl differ
diff --git a/venv/lib/python-wheels/colorama-0.3.2-py2.py3-none-any.whl b/venv/lib/python-wheels/colorama-0.3.2-py2.py3-none-any.whl
new file mode 100644
index 000000000..08d0f4613
Binary files /dev/null and b/venv/lib/python-wheels/colorama-0.3.2-py2.py3-none-any.whl differ
diff --git a/venv/lib/python-wheels/distlib-0.1.9-py2.py3-none-any.whl b/venv/lib/python-wheels/distlib-0.1.9-py2.py3-none-any.whl
new file mode 100644
index 000000000..b6fa9e99d
Binary files /dev/null and b/venv/lib/python-wheels/distlib-0.1.9-py2.py3-none-any.whl differ
diff --git a/venv/lib/python-wheels/html5lib-0.999-py2.py3-none-any.whl b/venv/lib/python-wheels/html5lib-0.999-py2.py3-none-any.whl
new file mode 100644
index 000000000..80f319087
Binary files /dev/null and b/venv/lib/python-wheels/html5lib-0.999-py2.py3-none-any.whl differ
diff --git a/venv/lib/python-wheels/pip-1.5.6-py2.py3-none-any.whl b/venv/lib/python-wheels/pip-1.5.6-py2.py3-none-any.whl
new file mode 100644
index 000000000..287ce9220
Binary files /dev/null and b/venv/lib/python-wheels/pip-1.5.6-py2.py3-none-any.whl differ
diff --git a/venv/lib/python-wheels/requests-2.4.3-py2.py3-none-any.whl b/venv/lib/python-wheels/requests-2.4.3-py2.py3-none-any.whl
new file mode 100644
index 000000000..1ea8de0eb
Binary files /dev/null and b/venv/lib/python-wheels/requests-2.4.3-py2.py3-none-any.whl differ
diff --git a/venv/lib/python-wheels/setuptools-5.5.1-py2.py3-none-any.whl b/venv/lib/python-wheels/setuptools-5.5.1-py2.py3-none-any.whl
new file mode 100644
index 000000000..2c0f0c921
Binary files /dev/null and b/venv/lib/python-wheels/setuptools-5.5.1-py2.py3-none-any.whl differ
diff --git a/venv/lib/python-wheels/six-1.8.0-py2.py3-none-any.whl b/venv/lib/python-wheels/six-1.8.0-py2.py3-none-any.whl
new file mode 100644
index 000000000..f2c58eb31
Binary files /dev/null and b/venv/lib/python-wheels/six-1.8.0-py2.py3-none-any.whl differ
diff --git a/venv/lib/python-wheels/urllib3-1.9.1-py2.py3-none-any.whl b/venv/lib/python-wheels/urllib3-1.9.1-py2.py3-none-any.whl
new file mode 100644
index 000000000..335641da1
Binary files /dev/null and b/venv/lib/python-wheels/urllib3-1.9.1-py2.py3-none-any.whl differ
diff --git a/venv/lib/python2.7/UserDict.py b/venv/lib/python2.7/UserDict.py
new file mode 120000
index 000000000..1dcde33cf
--- /dev/null
+++ b/venv/lib/python2.7/UserDict.py
@@ -0,0 +1 @@
+/usr/lib/python2.7/UserDict.py
\ No newline at end of file
diff --git a/venv/lib/python2.7/_abcoll.py b/venv/lib/python2.7/_abcoll.py
new file mode 120000
index 000000000..e39c38d2a
--- /dev/null
+++ b/venv/lib/python2.7/_abcoll.py
@@ -0,0 +1 @@
+/usr/lib/python2.7/_abcoll.py
\ No newline at end of file
diff --git a/venv/lib/python2.7/_weakrefset.py b/venv/lib/python2.7/_weakrefset.py
new file mode 120000
index 000000000..a3c1cd4f0
--- /dev/null
+++ b/venv/lib/python2.7/_weakrefset.py
@@ -0,0 +1 @@
+/usr/lib/python2.7/_weakrefset.py
\ No newline at end of file
diff --git a/venv/lib/python2.7/abc.py b/venv/lib/python2.7/abc.py
new file mode 120000
index 000000000..cb3e5d16f
--- /dev/null
+++ b/venv/lib/python2.7/abc.py
@@ -0,0 +1 @@
+/usr/lib/python2.7/abc.py
\ No newline at end of file
diff --git a/venv/lib/python2.7/codecs.py b/venv/lib/python2.7/codecs.py
new file mode 120000
index 000000000..50169dc7a
--- /dev/null
+++ b/venv/lib/python2.7/codecs.py
@@ -0,0 +1 @@
+/usr/lib/python2.7/codecs.py
\ No newline at end of file
diff --git a/venv/lib/python2.7/copy_reg.py b/venv/lib/python2.7/copy_reg.py
new file mode 120000
index 000000000..5dc0af342
--- /dev/null
+++ b/venv/lib/python2.7/copy_reg.py
@@ -0,0 +1 @@
+/usr/lib/python2.7/copy_reg.py
\ No newline at end of file
diff --git a/venv/lib/python2.7/distutils/__init__.py b/venv/lib/python2.7/distutils/__init__.py
new file mode 100644
index 000000000..29fc1da45
--- /dev/null
+++ b/venv/lib/python2.7/distutils/__init__.py
@@ -0,0 +1,101 @@
+import os
+import sys
+import warnings
+import imp
+import opcode # opcode is not a virtualenv module, so we can use it to find the stdlib
+ # Important! To work on pypy, this must be a module that resides in the
+ # lib-python/modified-x.y.z directory
+
+dirname = os.path.dirname
+
+distutils_path = os.path.join(os.path.dirname(opcode.__file__), 'distutils')
+if os.path.normpath(distutils_path) == os.path.dirname(os.path.normpath(__file__)):
+ warnings.warn(
+ "The virtualenv distutils package at %s appears to be in the same location as the system distutils?")
+else:
+ __path__.insert(0, distutils_path)
+ real_distutils = imp.load_module("_virtualenv_distutils", None, distutils_path, ('', '', imp.PKG_DIRECTORY))
+ # Copy the relevant attributes
+ try:
+ __revision__ = real_distutils.__revision__
+ except AttributeError:
+ pass
+ __version__ = real_distutils.__version__
+
+from distutils import dist, sysconfig
+
+try:
+ basestring
+except NameError:
+ basestring = str
+
+## patch build_ext (distutils doesn't know how to get the libs directory
+## path on windows - it hardcodes the paths around the patched sys.prefix)
+
+if sys.platform == 'win32':
+ from distutils.command.build_ext import build_ext as old_build_ext
+ class build_ext(old_build_ext):
+ def finalize_options (self):
+ if self.library_dirs is None:
+ self.library_dirs = []
+ elif isinstance(self.library_dirs, basestring):
+ self.library_dirs = self.library_dirs.split(os.pathsep)
+
+ self.library_dirs.insert(0, os.path.join(sys.real_prefix, "Libs"))
+ old_build_ext.finalize_options(self)
+
+ from distutils.command import build_ext as build_ext_module
+ build_ext_module.build_ext = build_ext
+
+## distutils.dist patches:
+
+old_find_config_files = dist.Distribution.find_config_files
+def find_config_files(self):
+ found = old_find_config_files(self)
+ system_distutils = os.path.join(distutils_path, 'distutils.cfg')
+ #if os.path.exists(system_distutils):
+ # found.insert(0, system_distutils)
+ # What to call the per-user config file
+ if os.name == 'posix':
+ user_filename = ".pydistutils.cfg"
+ else:
+ user_filename = "pydistutils.cfg"
+ user_filename = os.path.join(sys.prefix, user_filename)
+ if os.path.isfile(user_filename):
+ for item in list(found):
+ if item.endswith('pydistutils.cfg'):
+ found.remove(item)
+ found.append(user_filename)
+ return found
+dist.Distribution.find_config_files = find_config_files
+
+## distutils.sysconfig patches:
+
+old_get_python_inc = sysconfig.get_python_inc
+def sysconfig_get_python_inc(plat_specific=0, prefix=None):
+ if prefix is None:
+ prefix = sys.real_prefix
+ return old_get_python_inc(plat_specific, prefix)
+sysconfig_get_python_inc.__doc__ = old_get_python_inc.__doc__
+sysconfig.get_python_inc = sysconfig_get_python_inc
+
+old_get_python_lib = sysconfig.get_python_lib
+def sysconfig_get_python_lib(plat_specific=0, standard_lib=0, prefix=None):
+ if standard_lib and prefix is None:
+ prefix = sys.real_prefix
+ return old_get_python_lib(plat_specific, standard_lib, prefix)
+sysconfig_get_python_lib.__doc__ = old_get_python_lib.__doc__
+sysconfig.get_python_lib = sysconfig_get_python_lib
+
+old_get_config_vars = sysconfig.get_config_vars
+def sysconfig_get_config_vars(*args):
+ real_vars = old_get_config_vars(*args)
+ if sys.platform == 'win32':
+ lib_dir = os.path.join(sys.real_prefix, "libs")
+ if isinstance(real_vars, dict) and 'LIBDIR' not in real_vars:
+ real_vars['LIBDIR'] = lib_dir # asked for all
+ elif isinstance(real_vars, list) and 'LIBDIR' in args:
+ real_vars = real_vars + [lib_dir] # asked for list
+ return real_vars
+sysconfig_get_config_vars.__doc__ = old_get_config_vars.__doc__
+sysconfig.get_config_vars = sysconfig_get_config_vars
diff --git a/venv/lib/python2.7/distutils/distutils.cfg b/venv/lib/python2.7/distutils/distutils.cfg
new file mode 100644
index 000000000..1af230ec9
--- /dev/null
+++ b/venv/lib/python2.7/distutils/distutils.cfg
@@ -0,0 +1,6 @@
+# This is a config file local to this virtualenv installation
+# You may include options that will be used by all distutils commands,
+# and by easy_install. For instance:
+#
+# [easy_install]
+# find_links = http://mylocalsite
diff --git a/venv/lib/python2.7/encodings b/venv/lib/python2.7/encodings
new file mode 120000
index 000000000..1250ad869
--- /dev/null
+++ b/venv/lib/python2.7/encodings
@@ -0,0 +1 @@
+/usr/lib/python2.7/encodings
\ No newline at end of file
diff --git a/venv/lib/python2.7/fnmatch.py b/venv/lib/python2.7/fnmatch.py
new file mode 120000
index 000000000..ec3e10cf3
--- /dev/null
+++ b/venv/lib/python2.7/fnmatch.py
@@ -0,0 +1 @@
+/usr/lib/python2.7/fnmatch.py
\ No newline at end of file
diff --git a/venv/lib/python2.7/genericpath.py b/venv/lib/python2.7/genericpath.py
new file mode 120000
index 000000000..cb8897ce5
--- /dev/null
+++ b/venv/lib/python2.7/genericpath.py
@@ -0,0 +1 @@
+/usr/lib/python2.7/genericpath.py
\ No newline at end of file
diff --git a/venv/lib/python2.7/lib-dynload b/venv/lib/python2.7/lib-dynload
new file mode 120000
index 000000000..c706a1eba
--- /dev/null
+++ b/venv/lib/python2.7/lib-dynload
@@ -0,0 +1 @@
+/usr/lib/python2.7/lib-dynload
\ No newline at end of file
diff --git a/venv/lib/python2.7/linecache.py b/venv/lib/python2.7/linecache.py
new file mode 120000
index 000000000..943c42973
--- /dev/null
+++ b/venv/lib/python2.7/linecache.py
@@ -0,0 +1 @@
+/usr/lib/python2.7/linecache.py
\ No newline at end of file
diff --git a/venv/lib/python2.7/locale.py b/venv/lib/python2.7/locale.py
new file mode 120000
index 000000000..92c243c66
--- /dev/null
+++ b/venv/lib/python2.7/locale.py
@@ -0,0 +1 @@
+/usr/lib/python2.7/locale.py
\ No newline at end of file
diff --git a/venv/lib/python2.7/ntpath.py b/venv/lib/python2.7/ntpath.py
new file mode 120000
index 000000000..5659ae14c
--- /dev/null
+++ b/venv/lib/python2.7/ntpath.py
@@ -0,0 +1 @@
+/usr/lib/python2.7/ntpath.py
\ No newline at end of file
diff --git a/venv/lib/python2.7/orig-prefix.txt b/venv/lib/python2.7/orig-prefix.txt
new file mode 100644
index 000000000..e25db584b
--- /dev/null
+++ b/venv/lib/python2.7/orig-prefix.txt
@@ -0,0 +1 @@
+/usr
\ No newline at end of file
diff --git a/venv/lib/python2.7/os.py b/venv/lib/python2.7/os.py
new file mode 120000
index 000000000..950fc8d2a
--- /dev/null
+++ b/venv/lib/python2.7/os.py
@@ -0,0 +1 @@
+/usr/lib/python2.7/os.py
\ No newline at end of file
diff --git a/venv/lib/python2.7/posixpath.py b/venv/lib/python2.7/posixpath.py
new file mode 120000
index 000000000..30cb8ca50
--- /dev/null
+++ b/venv/lib/python2.7/posixpath.py
@@ -0,0 +1 @@
+/usr/lib/python2.7/posixpath.py
\ No newline at end of file
diff --git a/venv/lib/python2.7/re.py b/venv/lib/python2.7/re.py
new file mode 120000
index 000000000..56a073164
--- /dev/null
+++ b/venv/lib/python2.7/re.py
@@ -0,0 +1 @@
+/usr/lib/python2.7/re.py
\ No newline at end of file
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/EGG-INFO/PKG-INFO b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/EGG-INFO/PKG-INFO
new file mode 100644
index 000000000..abbf9e9b4
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/EGG-INFO/PKG-INFO
@@ -0,0 +1,23 @@
+Metadata-Version: 1.1
+Name: Babel
+Version: 2.2.0
+Summary: Internationalization utilities
+Home-page: http://babel.pocoo.org/
+Author: Armin Ronacher
+Author-email: armin.ronacher@active-4.com
+License: BSD
+Description: A collection of tools for internationalizing Python applications.
+Platform: UNKNOWN
+Classifier: Development Status :: 5 - Production/Stable
+Classifier: Environment :: Web Environment
+Classifier: Intended Audience :: Developers
+Classifier: License :: OSI Approved :: BSD License
+Classifier: Operating System :: OS Independent
+Classifier: Programming Language :: Python
+Classifier: Programming Language :: Python :: 2.6
+Classifier: Programming Language :: Python :: 2.7
+Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3.3
+Classifier: Programming Language :: Python :: 3.4
+Classifier: Programming Language :: Python :: 3.5
+Classifier: Topic :: Software Development :: Libraries :: Python Modules
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/EGG-INFO/SOURCES.txt b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/EGG-INFO/SOURCES.txt
new file mode 100644
index 000000000..052912cd9
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/EGG-INFO/SOURCES.txt
@@ -0,0 +1,827 @@
+AUTHORS
+CHANGES
+LICENSE
+MANIFEST.in
+Makefile
+conftest.py
+setup.cfg
+setup.py
+tox.ini
+Babel.egg-info/PKG-INFO
+Babel.egg-info/SOURCES.txt
+Babel.egg-info/dependency_links.txt
+Babel.egg-info/entry_points.txt
+Babel.egg-info/not-zip-safe
+Babel.egg-info/requires.txt
+Babel.egg-info/top_level.txt
+babel/__init__.py
+babel/_compat.py
+babel/core.py
+babel/dates.py
+babel/global.dat
+babel/lists.py
+babel/localedata.py
+babel/numbers.py
+babel/plural.py
+babel/support.py
+babel/util.py
+babel/locale-data/af.dat
+babel/locale-data/af_NA.dat
+babel/locale-data/af_ZA.dat
+babel/locale-data/agq.dat
+babel/locale-data/agq_CM.dat
+babel/locale-data/ak.dat
+babel/locale-data/ak_GH.dat
+babel/locale-data/am.dat
+babel/locale-data/am_ET.dat
+babel/locale-data/ar.dat
+babel/locale-data/ar_001.dat
+babel/locale-data/ar_AE.dat
+babel/locale-data/ar_BH.dat
+babel/locale-data/ar_DJ.dat
+babel/locale-data/ar_DZ.dat
+babel/locale-data/ar_EG.dat
+babel/locale-data/ar_EH.dat
+babel/locale-data/ar_ER.dat
+babel/locale-data/ar_IL.dat
+babel/locale-data/ar_IQ.dat
+babel/locale-data/ar_JO.dat
+babel/locale-data/ar_KM.dat
+babel/locale-data/ar_KW.dat
+babel/locale-data/ar_LB.dat
+babel/locale-data/ar_LY.dat
+babel/locale-data/ar_MA.dat
+babel/locale-data/ar_MR.dat
+babel/locale-data/ar_OM.dat
+babel/locale-data/ar_PS.dat
+babel/locale-data/ar_QA.dat
+babel/locale-data/ar_SA.dat
+babel/locale-data/ar_SD.dat
+babel/locale-data/ar_SO.dat
+babel/locale-data/ar_SS.dat
+babel/locale-data/ar_SY.dat
+babel/locale-data/ar_TD.dat
+babel/locale-data/ar_TN.dat
+babel/locale-data/ar_YE.dat
+babel/locale-data/as.dat
+babel/locale-data/as_IN.dat
+babel/locale-data/asa.dat
+babel/locale-data/asa_TZ.dat
+babel/locale-data/ast.dat
+babel/locale-data/ast_ES.dat
+babel/locale-data/az.dat
+babel/locale-data/az_Cyrl.dat
+babel/locale-data/az_Cyrl_AZ.dat
+babel/locale-data/az_Latn.dat
+babel/locale-data/az_Latn_AZ.dat
+babel/locale-data/bas.dat
+babel/locale-data/bas_CM.dat
+babel/locale-data/be.dat
+babel/locale-data/be_BY.dat
+babel/locale-data/bem.dat
+babel/locale-data/bem_ZM.dat
+babel/locale-data/bez.dat
+babel/locale-data/bez_TZ.dat
+babel/locale-data/bg.dat
+babel/locale-data/bg_BG.dat
+babel/locale-data/bm.dat
+babel/locale-data/bm_ML.dat
+babel/locale-data/bn.dat
+babel/locale-data/bn_BD.dat
+babel/locale-data/bn_IN.dat
+babel/locale-data/bo.dat
+babel/locale-data/bo_CN.dat
+babel/locale-data/bo_IN.dat
+babel/locale-data/br.dat
+babel/locale-data/br_FR.dat
+babel/locale-data/brx.dat
+babel/locale-data/brx_IN.dat
+babel/locale-data/bs.dat
+babel/locale-data/bs_Cyrl.dat
+babel/locale-data/bs_Cyrl_BA.dat
+babel/locale-data/bs_Latn.dat
+babel/locale-data/bs_Latn_BA.dat
+babel/locale-data/ca.dat
+babel/locale-data/ca_AD.dat
+babel/locale-data/ca_ES.dat
+babel/locale-data/ca_ES_VALENCIA.dat
+babel/locale-data/ca_FR.dat
+babel/locale-data/ca_IT.dat
+babel/locale-data/ce.dat
+babel/locale-data/ce_RU.dat
+babel/locale-data/cgg.dat
+babel/locale-data/cgg_UG.dat
+babel/locale-data/chr.dat
+babel/locale-data/chr_US.dat
+babel/locale-data/ckb.dat
+babel/locale-data/ckb_IQ.dat
+babel/locale-data/ckb_IR.dat
+babel/locale-data/cs.dat
+babel/locale-data/cs_CZ.dat
+babel/locale-data/cu.dat
+babel/locale-data/cu_RU.dat
+babel/locale-data/cy.dat
+babel/locale-data/cy_GB.dat
+babel/locale-data/da.dat
+babel/locale-data/da_DK.dat
+babel/locale-data/da_GL.dat
+babel/locale-data/dav.dat
+babel/locale-data/dav_KE.dat
+babel/locale-data/de.dat
+babel/locale-data/de_AT.dat
+babel/locale-data/de_BE.dat
+babel/locale-data/de_CH.dat
+babel/locale-data/de_DE.dat
+babel/locale-data/de_LI.dat
+babel/locale-data/de_LU.dat
+babel/locale-data/dje.dat
+babel/locale-data/dje_NE.dat
+babel/locale-data/dsb.dat
+babel/locale-data/dsb_DE.dat
+babel/locale-data/dua.dat
+babel/locale-data/dua_CM.dat
+babel/locale-data/dyo.dat
+babel/locale-data/dyo_SN.dat
+babel/locale-data/dz.dat
+babel/locale-data/dz_BT.dat
+babel/locale-data/ebu.dat
+babel/locale-data/ebu_KE.dat
+babel/locale-data/ee.dat
+babel/locale-data/ee_GH.dat
+babel/locale-data/ee_TG.dat
+babel/locale-data/el.dat
+babel/locale-data/el_CY.dat
+babel/locale-data/el_GR.dat
+babel/locale-data/en.dat
+babel/locale-data/en_001.dat
+babel/locale-data/en_150.dat
+babel/locale-data/en_AG.dat
+babel/locale-data/en_AI.dat
+babel/locale-data/en_AS.dat
+babel/locale-data/en_AT.dat
+babel/locale-data/en_AU.dat
+babel/locale-data/en_BB.dat
+babel/locale-data/en_BE.dat
+babel/locale-data/en_BI.dat
+babel/locale-data/en_BM.dat
+babel/locale-data/en_BS.dat
+babel/locale-data/en_BW.dat
+babel/locale-data/en_BZ.dat
+babel/locale-data/en_CA.dat
+babel/locale-data/en_CC.dat
+babel/locale-data/en_CH.dat
+babel/locale-data/en_CK.dat
+babel/locale-data/en_CM.dat
+babel/locale-data/en_CX.dat
+babel/locale-data/en_CY.dat
+babel/locale-data/en_DE.dat
+babel/locale-data/en_DG.dat
+babel/locale-data/en_DK.dat
+babel/locale-data/en_DM.dat
+babel/locale-data/en_ER.dat
+babel/locale-data/en_FI.dat
+babel/locale-data/en_FJ.dat
+babel/locale-data/en_FK.dat
+babel/locale-data/en_FM.dat
+babel/locale-data/en_GB.dat
+babel/locale-data/en_GD.dat
+babel/locale-data/en_GG.dat
+babel/locale-data/en_GH.dat
+babel/locale-data/en_GI.dat
+babel/locale-data/en_GM.dat
+babel/locale-data/en_GU.dat
+babel/locale-data/en_GY.dat
+babel/locale-data/en_HK.dat
+babel/locale-data/en_IE.dat
+babel/locale-data/en_IL.dat
+babel/locale-data/en_IM.dat
+babel/locale-data/en_IN.dat
+babel/locale-data/en_IO.dat
+babel/locale-data/en_JE.dat
+babel/locale-data/en_JM.dat
+babel/locale-data/en_KE.dat
+babel/locale-data/en_KI.dat
+babel/locale-data/en_KN.dat
+babel/locale-data/en_KY.dat
+babel/locale-data/en_LC.dat
+babel/locale-data/en_LR.dat
+babel/locale-data/en_LS.dat
+babel/locale-data/en_MG.dat
+babel/locale-data/en_MH.dat
+babel/locale-data/en_MO.dat
+babel/locale-data/en_MP.dat
+babel/locale-data/en_MS.dat
+babel/locale-data/en_MT.dat
+babel/locale-data/en_MU.dat
+babel/locale-data/en_MW.dat
+babel/locale-data/en_MY.dat
+babel/locale-data/en_NA.dat
+babel/locale-data/en_NF.dat
+babel/locale-data/en_NG.dat
+babel/locale-data/en_NL.dat
+babel/locale-data/en_NR.dat
+babel/locale-data/en_NU.dat
+babel/locale-data/en_NZ.dat
+babel/locale-data/en_PG.dat
+babel/locale-data/en_PH.dat
+babel/locale-data/en_PK.dat
+babel/locale-data/en_PN.dat
+babel/locale-data/en_PR.dat
+babel/locale-data/en_PW.dat
+babel/locale-data/en_RW.dat
+babel/locale-data/en_SB.dat
+babel/locale-data/en_SC.dat
+babel/locale-data/en_SD.dat
+babel/locale-data/en_SE.dat
+babel/locale-data/en_SG.dat
+babel/locale-data/en_SH.dat
+babel/locale-data/en_SI.dat
+babel/locale-data/en_SL.dat
+babel/locale-data/en_SS.dat
+babel/locale-data/en_SX.dat
+babel/locale-data/en_SZ.dat
+babel/locale-data/en_TC.dat
+babel/locale-data/en_TK.dat
+babel/locale-data/en_TO.dat
+babel/locale-data/en_TT.dat
+babel/locale-data/en_TV.dat
+babel/locale-data/en_TZ.dat
+babel/locale-data/en_UG.dat
+babel/locale-data/en_UM.dat
+babel/locale-data/en_US.dat
+babel/locale-data/en_US_POSIX.dat
+babel/locale-data/en_VC.dat
+babel/locale-data/en_VG.dat
+babel/locale-data/en_VI.dat
+babel/locale-data/en_VU.dat
+babel/locale-data/en_WS.dat
+babel/locale-data/en_ZA.dat
+babel/locale-data/en_ZM.dat
+babel/locale-data/en_ZW.dat
+babel/locale-data/eo.dat
+babel/locale-data/eo_001.dat
+babel/locale-data/es.dat
+babel/locale-data/es_419.dat
+babel/locale-data/es_AR.dat
+babel/locale-data/es_BO.dat
+babel/locale-data/es_CL.dat
+babel/locale-data/es_CO.dat
+babel/locale-data/es_CR.dat
+babel/locale-data/es_CU.dat
+babel/locale-data/es_DO.dat
+babel/locale-data/es_EA.dat
+babel/locale-data/es_EC.dat
+babel/locale-data/es_ES.dat
+babel/locale-data/es_GQ.dat
+babel/locale-data/es_GT.dat
+babel/locale-data/es_HN.dat
+babel/locale-data/es_IC.dat
+babel/locale-data/es_MX.dat
+babel/locale-data/es_NI.dat
+babel/locale-data/es_PA.dat
+babel/locale-data/es_PE.dat
+babel/locale-data/es_PH.dat
+babel/locale-data/es_PR.dat
+babel/locale-data/es_PY.dat
+babel/locale-data/es_SV.dat
+babel/locale-data/es_US.dat
+babel/locale-data/es_UY.dat
+babel/locale-data/es_VE.dat
+babel/locale-data/et.dat
+babel/locale-data/et_EE.dat
+babel/locale-data/eu.dat
+babel/locale-data/eu_ES.dat
+babel/locale-data/ewo.dat
+babel/locale-data/ewo_CM.dat
+babel/locale-data/fa.dat
+babel/locale-data/fa_AF.dat
+babel/locale-data/fa_IR.dat
+babel/locale-data/ff.dat
+babel/locale-data/ff_CM.dat
+babel/locale-data/ff_GN.dat
+babel/locale-data/ff_MR.dat
+babel/locale-data/ff_SN.dat
+babel/locale-data/fi.dat
+babel/locale-data/fi_FI.dat
+babel/locale-data/fil.dat
+babel/locale-data/fil_PH.dat
+babel/locale-data/fo.dat
+babel/locale-data/fo_DK.dat
+babel/locale-data/fo_FO.dat
+babel/locale-data/fr.dat
+babel/locale-data/fr_BE.dat
+babel/locale-data/fr_BF.dat
+babel/locale-data/fr_BI.dat
+babel/locale-data/fr_BJ.dat
+babel/locale-data/fr_BL.dat
+babel/locale-data/fr_CA.dat
+babel/locale-data/fr_CD.dat
+babel/locale-data/fr_CF.dat
+babel/locale-data/fr_CG.dat
+babel/locale-data/fr_CH.dat
+babel/locale-data/fr_CI.dat
+babel/locale-data/fr_CM.dat
+babel/locale-data/fr_DJ.dat
+babel/locale-data/fr_DZ.dat
+babel/locale-data/fr_FR.dat
+babel/locale-data/fr_GA.dat
+babel/locale-data/fr_GF.dat
+babel/locale-data/fr_GN.dat
+babel/locale-data/fr_GP.dat
+babel/locale-data/fr_GQ.dat
+babel/locale-data/fr_HT.dat
+babel/locale-data/fr_KM.dat
+babel/locale-data/fr_LU.dat
+babel/locale-data/fr_MA.dat
+babel/locale-data/fr_MC.dat
+babel/locale-data/fr_MF.dat
+babel/locale-data/fr_MG.dat
+babel/locale-data/fr_ML.dat
+babel/locale-data/fr_MQ.dat
+babel/locale-data/fr_MR.dat
+babel/locale-data/fr_MU.dat
+babel/locale-data/fr_NC.dat
+babel/locale-data/fr_NE.dat
+babel/locale-data/fr_PF.dat
+babel/locale-data/fr_PM.dat
+babel/locale-data/fr_RE.dat
+babel/locale-data/fr_RW.dat
+babel/locale-data/fr_SC.dat
+babel/locale-data/fr_SN.dat
+babel/locale-data/fr_SY.dat
+babel/locale-data/fr_TD.dat
+babel/locale-data/fr_TG.dat
+babel/locale-data/fr_TN.dat
+babel/locale-data/fr_VU.dat
+babel/locale-data/fr_WF.dat
+babel/locale-data/fr_YT.dat
+babel/locale-data/fur.dat
+babel/locale-data/fur_IT.dat
+babel/locale-data/fy.dat
+babel/locale-data/fy_NL.dat
+babel/locale-data/ga.dat
+babel/locale-data/ga_IE.dat
+babel/locale-data/gd.dat
+babel/locale-data/gd_GB.dat
+babel/locale-data/gl.dat
+babel/locale-data/gl_ES.dat
+babel/locale-data/gsw.dat
+babel/locale-data/gsw_CH.dat
+babel/locale-data/gsw_FR.dat
+babel/locale-data/gsw_LI.dat
+babel/locale-data/gu.dat
+babel/locale-data/gu_IN.dat
+babel/locale-data/guz.dat
+babel/locale-data/guz_KE.dat
+babel/locale-data/gv.dat
+babel/locale-data/gv_IM.dat
+babel/locale-data/ha.dat
+babel/locale-data/ha_GH.dat
+babel/locale-data/ha_NE.dat
+babel/locale-data/ha_NG.dat
+babel/locale-data/haw.dat
+babel/locale-data/haw_US.dat
+babel/locale-data/he.dat
+babel/locale-data/he_IL.dat
+babel/locale-data/hi.dat
+babel/locale-data/hi_IN.dat
+babel/locale-data/hr.dat
+babel/locale-data/hr_BA.dat
+babel/locale-data/hr_HR.dat
+babel/locale-data/hsb.dat
+babel/locale-data/hsb_DE.dat
+babel/locale-data/hu.dat
+babel/locale-data/hu_HU.dat
+babel/locale-data/hy.dat
+babel/locale-data/hy_AM.dat
+babel/locale-data/id.dat
+babel/locale-data/id_ID.dat
+babel/locale-data/ig.dat
+babel/locale-data/ig_NG.dat
+babel/locale-data/ii.dat
+babel/locale-data/ii_CN.dat
+babel/locale-data/is.dat
+babel/locale-data/is_IS.dat
+babel/locale-data/it.dat
+babel/locale-data/it_CH.dat
+babel/locale-data/it_IT.dat
+babel/locale-data/it_SM.dat
+babel/locale-data/ja.dat
+babel/locale-data/ja_JP.dat
+babel/locale-data/jgo.dat
+babel/locale-data/jgo_CM.dat
+babel/locale-data/jmc.dat
+babel/locale-data/jmc_TZ.dat
+babel/locale-data/ka.dat
+babel/locale-data/ka_GE.dat
+babel/locale-data/kab.dat
+babel/locale-data/kab_DZ.dat
+babel/locale-data/kam.dat
+babel/locale-data/kam_KE.dat
+babel/locale-data/kde.dat
+babel/locale-data/kde_TZ.dat
+babel/locale-data/kea.dat
+babel/locale-data/kea_CV.dat
+babel/locale-data/khq.dat
+babel/locale-data/khq_ML.dat
+babel/locale-data/ki.dat
+babel/locale-data/ki_KE.dat
+babel/locale-data/kk.dat
+babel/locale-data/kk_KZ.dat
+babel/locale-data/kkj.dat
+babel/locale-data/kkj_CM.dat
+babel/locale-data/kl.dat
+babel/locale-data/kl_GL.dat
+babel/locale-data/kln.dat
+babel/locale-data/kln_KE.dat
+babel/locale-data/km.dat
+babel/locale-data/km_KH.dat
+babel/locale-data/kn.dat
+babel/locale-data/kn_IN.dat
+babel/locale-data/ko.dat
+babel/locale-data/ko_KP.dat
+babel/locale-data/ko_KR.dat
+babel/locale-data/kok.dat
+babel/locale-data/kok_IN.dat
+babel/locale-data/ks.dat
+babel/locale-data/ks_IN.dat
+babel/locale-data/ksb.dat
+babel/locale-data/ksb_TZ.dat
+babel/locale-data/ksf.dat
+babel/locale-data/ksf_CM.dat
+babel/locale-data/ksh.dat
+babel/locale-data/ksh_DE.dat
+babel/locale-data/kw.dat
+babel/locale-data/kw_GB.dat
+babel/locale-data/ky.dat
+babel/locale-data/ky_KG.dat
+babel/locale-data/lag.dat
+babel/locale-data/lag_TZ.dat
+babel/locale-data/lb.dat
+babel/locale-data/lb_LU.dat
+babel/locale-data/lg.dat
+babel/locale-data/lg_UG.dat
+babel/locale-data/lkt.dat
+babel/locale-data/lkt_US.dat
+babel/locale-data/ln.dat
+babel/locale-data/ln_AO.dat
+babel/locale-data/ln_CD.dat
+babel/locale-data/ln_CF.dat
+babel/locale-data/ln_CG.dat
+babel/locale-data/lo.dat
+babel/locale-data/lo_LA.dat
+babel/locale-data/lrc.dat
+babel/locale-data/lrc_IQ.dat
+babel/locale-data/lrc_IR.dat
+babel/locale-data/lt.dat
+babel/locale-data/lt_LT.dat
+babel/locale-data/lu.dat
+babel/locale-data/lu_CD.dat
+babel/locale-data/luo.dat
+babel/locale-data/luo_KE.dat
+babel/locale-data/luy.dat
+babel/locale-data/luy_KE.dat
+babel/locale-data/lv.dat
+babel/locale-data/lv_LV.dat
+babel/locale-data/mas.dat
+babel/locale-data/mas_KE.dat
+babel/locale-data/mas_TZ.dat
+babel/locale-data/mer.dat
+babel/locale-data/mer_KE.dat
+babel/locale-data/mfe.dat
+babel/locale-data/mfe_MU.dat
+babel/locale-data/mg.dat
+babel/locale-data/mg_MG.dat
+babel/locale-data/mgh.dat
+babel/locale-data/mgh_MZ.dat
+babel/locale-data/mgo.dat
+babel/locale-data/mgo_CM.dat
+babel/locale-data/mk.dat
+babel/locale-data/mk_MK.dat
+babel/locale-data/ml.dat
+babel/locale-data/ml_IN.dat
+babel/locale-data/mn.dat
+babel/locale-data/mn_MN.dat
+babel/locale-data/mr.dat
+babel/locale-data/mr_IN.dat
+babel/locale-data/ms.dat
+babel/locale-data/ms_BN.dat
+babel/locale-data/ms_MY.dat
+babel/locale-data/ms_SG.dat
+babel/locale-data/mt.dat
+babel/locale-data/mt_MT.dat
+babel/locale-data/mua.dat
+babel/locale-data/mua_CM.dat
+babel/locale-data/my.dat
+babel/locale-data/my_MM.dat
+babel/locale-data/mzn.dat
+babel/locale-data/mzn_IR.dat
+babel/locale-data/naq.dat
+babel/locale-data/naq_NA.dat
+babel/locale-data/nb.dat
+babel/locale-data/nb_NO.dat
+babel/locale-data/nb_SJ.dat
+babel/locale-data/nd.dat
+babel/locale-data/nd_ZW.dat
+babel/locale-data/ne.dat
+babel/locale-data/ne_IN.dat
+babel/locale-data/ne_NP.dat
+babel/locale-data/nl.dat
+babel/locale-data/nl_AW.dat
+babel/locale-data/nl_BE.dat
+babel/locale-data/nl_BQ.dat
+babel/locale-data/nl_CW.dat
+babel/locale-data/nl_NL.dat
+babel/locale-data/nl_SR.dat
+babel/locale-data/nl_SX.dat
+babel/locale-data/nmg.dat
+babel/locale-data/nmg_CM.dat
+babel/locale-data/nn.dat
+babel/locale-data/nn_NO.dat
+babel/locale-data/nnh.dat
+babel/locale-data/nnh_CM.dat
+babel/locale-data/nus.dat
+babel/locale-data/nus_SS.dat
+babel/locale-data/nyn.dat
+babel/locale-data/nyn_UG.dat
+babel/locale-data/om.dat
+babel/locale-data/om_ET.dat
+babel/locale-data/om_KE.dat
+babel/locale-data/or.dat
+babel/locale-data/or_IN.dat
+babel/locale-data/os.dat
+babel/locale-data/os_GE.dat
+babel/locale-data/os_RU.dat
+babel/locale-data/pa.dat
+babel/locale-data/pa_Arab.dat
+babel/locale-data/pa_Arab_PK.dat
+babel/locale-data/pa_Guru.dat
+babel/locale-data/pa_Guru_IN.dat
+babel/locale-data/pl.dat
+babel/locale-data/pl_PL.dat
+babel/locale-data/prg.dat
+babel/locale-data/prg_001.dat
+babel/locale-data/ps.dat
+babel/locale-data/ps_AF.dat
+babel/locale-data/pt.dat
+babel/locale-data/pt_AO.dat
+babel/locale-data/pt_BR.dat
+babel/locale-data/pt_CV.dat
+babel/locale-data/pt_GW.dat
+babel/locale-data/pt_MO.dat
+babel/locale-data/pt_MZ.dat
+babel/locale-data/pt_PT.dat
+babel/locale-data/pt_ST.dat
+babel/locale-data/pt_TL.dat
+babel/locale-data/qu.dat
+babel/locale-data/qu_BO.dat
+babel/locale-data/qu_EC.dat
+babel/locale-data/qu_PE.dat
+babel/locale-data/rm.dat
+babel/locale-data/rm_CH.dat
+babel/locale-data/rn.dat
+babel/locale-data/rn_BI.dat
+babel/locale-data/ro.dat
+babel/locale-data/ro_MD.dat
+babel/locale-data/ro_RO.dat
+babel/locale-data/rof.dat
+babel/locale-data/rof_TZ.dat
+babel/locale-data/root.dat
+babel/locale-data/ru.dat
+babel/locale-data/ru_BY.dat
+babel/locale-data/ru_KG.dat
+babel/locale-data/ru_KZ.dat
+babel/locale-data/ru_MD.dat
+babel/locale-data/ru_RU.dat
+babel/locale-data/ru_UA.dat
+babel/locale-data/rw.dat
+babel/locale-data/rw_RW.dat
+babel/locale-data/rwk.dat
+babel/locale-data/rwk_TZ.dat
+babel/locale-data/sah.dat
+babel/locale-data/sah_RU.dat
+babel/locale-data/saq.dat
+babel/locale-data/saq_KE.dat
+babel/locale-data/sbp.dat
+babel/locale-data/sbp_TZ.dat
+babel/locale-data/se.dat
+babel/locale-data/se_FI.dat
+babel/locale-data/se_NO.dat
+babel/locale-data/se_SE.dat
+babel/locale-data/seh.dat
+babel/locale-data/seh_MZ.dat
+babel/locale-data/ses.dat
+babel/locale-data/ses_ML.dat
+babel/locale-data/sg.dat
+babel/locale-data/sg_CF.dat
+babel/locale-data/shi.dat
+babel/locale-data/shi_Latn.dat
+babel/locale-data/shi_Latn_MA.dat
+babel/locale-data/shi_Tfng.dat
+babel/locale-data/shi_Tfng_MA.dat
+babel/locale-data/si.dat
+babel/locale-data/si_LK.dat
+babel/locale-data/sk.dat
+babel/locale-data/sk_SK.dat
+babel/locale-data/sl.dat
+babel/locale-data/sl_SI.dat
+babel/locale-data/smn.dat
+babel/locale-data/smn_FI.dat
+babel/locale-data/sn.dat
+babel/locale-data/sn_ZW.dat
+babel/locale-data/so.dat
+babel/locale-data/so_DJ.dat
+babel/locale-data/so_ET.dat
+babel/locale-data/so_KE.dat
+babel/locale-data/so_SO.dat
+babel/locale-data/sq.dat
+babel/locale-data/sq_AL.dat
+babel/locale-data/sq_MK.dat
+babel/locale-data/sq_XK.dat
+babel/locale-data/sr.dat
+babel/locale-data/sr_Cyrl.dat
+babel/locale-data/sr_Cyrl_BA.dat
+babel/locale-data/sr_Cyrl_ME.dat
+babel/locale-data/sr_Cyrl_RS.dat
+babel/locale-data/sr_Cyrl_XK.dat
+babel/locale-data/sr_Latn.dat
+babel/locale-data/sr_Latn_BA.dat
+babel/locale-data/sr_Latn_ME.dat
+babel/locale-data/sr_Latn_RS.dat
+babel/locale-data/sr_Latn_XK.dat
+babel/locale-data/sv.dat
+babel/locale-data/sv_AX.dat
+babel/locale-data/sv_FI.dat
+babel/locale-data/sv_SE.dat
+babel/locale-data/sw.dat
+babel/locale-data/sw_CD.dat
+babel/locale-data/sw_KE.dat
+babel/locale-data/sw_TZ.dat
+babel/locale-data/sw_UG.dat
+babel/locale-data/ta.dat
+babel/locale-data/ta_IN.dat
+babel/locale-data/ta_LK.dat
+babel/locale-data/ta_MY.dat
+babel/locale-data/ta_SG.dat
+babel/locale-data/te.dat
+babel/locale-data/te_IN.dat
+babel/locale-data/teo.dat
+babel/locale-data/teo_KE.dat
+babel/locale-data/teo_UG.dat
+babel/locale-data/th.dat
+babel/locale-data/th_TH.dat
+babel/locale-data/ti.dat
+babel/locale-data/ti_ER.dat
+babel/locale-data/ti_ET.dat
+babel/locale-data/tk.dat
+babel/locale-data/tk_TM.dat
+babel/locale-data/to.dat
+babel/locale-data/to_TO.dat
+babel/locale-data/tr.dat
+babel/locale-data/tr_CY.dat
+babel/locale-data/tr_TR.dat
+babel/locale-data/twq.dat
+babel/locale-data/twq_NE.dat
+babel/locale-data/tzm.dat
+babel/locale-data/tzm_MA.dat
+babel/locale-data/ug.dat
+babel/locale-data/ug_CN.dat
+babel/locale-data/uk.dat
+babel/locale-data/uk_UA.dat
+babel/locale-data/ur.dat
+babel/locale-data/ur_IN.dat
+babel/locale-data/ur_PK.dat
+babel/locale-data/uz.dat
+babel/locale-data/uz_Arab.dat
+babel/locale-data/uz_Arab_AF.dat
+babel/locale-data/uz_Cyrl.dat
+babel/locale-data/uz_Cyrl_UZ.dat
+babel/locale-data/uz_Latn.dat
+babel/locale-data/uz_Latn_UZ.dat
+babel/locale-data/vai.dat
+babel/locale-data/vai_Latn.dat
+babel/locale-data/vai_Latn_LR.dat
+babel/locale-data/vai_Vaii.dat
+babel/locale-data/vai_Vaii_LR.dat
+babel/locale-data/vi.dat
+babel/locale-data/vi_VN.dat
+babel/locale-data/vo.dat
+babel/locale-data/vo_001.dat
+babel/locale-data/vun.dat
+babel/locale-data/vun_TZ.dat
+babel/locale-data/wae.dat
+babel/locale-data/wae_CH.dat
+babel/locale-data/xog.dat
+babel/locale-data/xog_UG.dat
+babel/locale-data/yav.dat
+babel/locale-data/yav_CM.dat
+babel/locale-data/yi.dat
+babel/locale-data/yi_001.dat
+babel/locale-data/yo.dat
+babel/locale-data/yo_BJ.dat
+babel/locale-data/yo_NG.dat
+babel/locale-data/zgh.dat
+babel/locale-data/zgh_MA.dat
+babel/locale-data/zh.dat
+babel/locale-data/zh_Hans.dat
+babel/locale-data/zh_Hans_CN.dat
+babel/locale-data/zh_Hans_HK.dat
+babel/locale-data/zh_Hans_MO.dat
+babel/locale-data/zh_Hans_SG.dat
+babel/locale-data/zh_Hant.dat
+babel/locale-data/zh_Hant_HK.dat
+babel/locale-data/zh_Hant_MO.dat
+babel/locale-data/zh_Hant_TW.dat
+babel/locale-data/zu.dat
+babel/locale-data/zu_ZA.dat
+babel/localtime/__init__.py
+babel/localtime/_unix.py
+babel/localtime/_win32.py
+babel/messages/__init__.py
+babel/messages/catalog.py
+babel/messages/checkers.py
+babel/messages/extract.py
+babel/messages/frontend.py
+babel/messages/jslexer.py
+babel/messages/mofile.py
+babel/messages/plurals.py
+babel/messages/pofile.py
+docs/Makefile
+docs/changelog.rst
+docs/cmdline.rst
+docs/conf.py
+docs/dates.rst
+docs/dev.rst
+docs/index.rst
+docs/installation.rst
+docs/intro.rst
+docs/license.rst
+docs/locale.rst
+docs/make.bat
+docs/messages.rst
+docs/numbers.rst
+docs/setup.rst
+docs/support.rst
+docs/_static/logo.pdf
+docs/_static/logo.png
+docs/_static/logo_small.png
+docs/_templates/sidebar-about.html
+docs/_templates/sidebar-links.html
+docs/_templates/sidebar-logo.html
+docs/_themes/LICENSE
+docs/_themes/README
+docs/_themes/babel/layout.html
+docs/_themes/babel/relations.html
+docs/_themes/babel/theme.conf
+docs/_themes/babel/static/babel.css_t
+docs/_themes/babel/static/small_babel.css
+docs/api/core.rst
+docs/api/dates.rst
+docs/api/index.rst
+docs/api/numbers.rst
+docs/api/plural.rst
+docs/api/support.rst
+docs/api/messages/catalog.rst
+docs/api/messages/extract.rst
+docs/api/messages/index.rst
+docs/api/messages/mofile.rst
+docs/api/messages/pofile.rst
+scripts/download_import_cldr.py
+scripts/dump_data.py
+scripts/dump_global.py
+scripts/import_cldr.py
+scripts/make-release.py
+tests/__init__.py
+tests/conftest.py
+tests/test_core.py
+tests/test_dates.py
+tests/test_lists.py
+tests/test_localedata.py
+tests/test_numbers.py
+tests/test_plural.py
+tests/test_support.py
+tests/test_util.py
+tests/messages/__init__.py
+tests/messages/test_catalog.py
+tests/messages/test_checkers.py
+tests/messages/test_extract.py
+tests/messages/test_frontend.py
+tests/messages/test_jslexer.py
+tests/messages/test_mofile.py
+tests/messages/test_plurals.py
+tests/messages/test_pofile.py
+tests/messages/data/mapping.cfg
+tests/messages/data/setup.cfg
+tests/messages/data/setup.py
+tests/messages/data/project/__init__.py
+tests/messages/data/project/file1.py
+tests/messages/data/project/file2.py
+tests/messages/data/project/i18n/messages.pot
+tests/messages/data/project/i18n/messages_non_fuzzy.pot
+tests/messages/data/project/i18n/de/LC_MESSAGES/messages.mo
+tests/messages/data/project/i18n/de/LC_MESSAGES/messages.po
+tests/messages/data/project/i18n/de_DE/LC_MESSAGES/messages.po
+tests/messages/data/project/i18n/ru_RU/LC_MESSAGES/messages.po
+tests/messages/data/project/ignored/a_test_file.txt
+tests/messages/data/project/ignored/an_example.txt
+tests/messages/data/project/ignored/this_wont_normally_be_here.py
\ No newline at end of file
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/EGG-INFO/dependency_links.txt b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/EGG-INFO/dependency_links.txt
new file mode 100644
index 000000000..8b1378917
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/EGG-INFO/dependency_links.txt
@@ -0,0 +1 @@
+
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/EGG-INFO/entry_points.txt b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/EGG-INFO/entry_points.txt
new file mode 100644
index 000000000..18c3a58b4
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/EGG-INFO/entry_points.txt
@@ -0,0 +1,22 @@
+
+ [console_scripts]
+ pybabel = babel.messages.frontend:main
+
+ [distutils.commands]
+ compile_catalog = babel.messages.frontend:compile_catalog
+ extract_messages = babel.messages.frontend:extract_messages
+ init_catalog = babel.messages.frontend:init_catalog
+ update_catalog = babel.messages.frontend:update_catalog
+
+ [distutils.setup_keywords]
+ message_extractors = babel.messages.frontend:check_message_extractors
+
+ [babel.checkers]
+ num_plurals = babel.messages.checkers:num_plurals
+ python_format = babel.messages.checkers:python_format
+
+ [babel.extractors]
+ ignore = babel.messages.extract:extract_nothing
+ python = babel.messages.extract:extract_python
+ javascript = babel.messages.extract:extract_javascript
+
\ No newline at end of file
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/EGG-INFO/not-zip-safe b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/EGG-INFO/not-zip-safe
new file mode 100644
index 000000000..8b1378917
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/EGG-INFO/not-zip-safe
@@ -0,0 +1 @@
+
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/EGG-INFO/requires.txt b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/EGG-INFO/requires.txt
new file mode 100644
index 000000000..84e71d2ea
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/EGG-INFO/requires.txt
@@ -0,0 +1 @@
+pytz>=0a
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/EGG-INFO/top_level.txt b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/EGG-INFO/top_level.txt
new file mode 100644
index 000000000..98f65931c
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/EGG-INFO/top_level.txt
@@ -0,0 +1 @@
+babel
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/__init__.py b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/__init__.py
new file mode 100644
index 000000000..c58e972fb
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/__init__.py
@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+"""
+ babel
+ ~~~~~
+
+ Integrated collection of utilities that assist in internationalizing and
+ localizing applications.
+
+ This package is basically composed of two major parts:
+
+ * tools to build and work with ``gettext`` message catalogs
+ * a Python interface to the CLDR (Common Locale Data Repository), providing
+ access to various locale display names, localized number and date
+ formatting, etc.
+
+ :copyright: (c) 2013 by the Babel Team.
+ :license: BSD, see LICENSE for more details.
+"""
+
+from babel.core import UnknownLocaleError, Locale, default_locale, \
+ negotiate_locale, parse_locale, get_locale_identifier
+
+
+__version__ = '2.2.0'
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/_compat.py b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/_compat.py
new file mode 100644
index 000000000..75abf9eb1
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/_compat.py
@@ -0,0 +1,76 @@
+import sys
+import array
+
+PY2 = sys.version_info[0] == 2
+
+_identity = lambda x: x
+
+
+if not PY2:
+ text_type = str
+ string_types = (str,)
+ integer_types = (int, )
+ unichr = chr
+
+ text_to_native = lambda s, enc: s
+
+ iterkeys = lambda d: iter(d.keys())
+ itervalues = lambda d: iter(d.values())
+ iteritems = lambda d: iter(d.items())
+
+ from io import StringIO, BytesIO
+ import pickle
+
+ izip = zip
+ imap = map
+ range_type = range
+
+ cmp = lambda a, b: (a > b) - (a < b)
+
+ array_tobytes = array.array.tobytes
+
+else:
+ text_type = unicode
+ string_types = (str, unicode)
+ integer_types = (int, long)
+
+ text_to_native = lambda s, enc: s.encode(enc)
+ unichr = unichr
+
+ iterkeys = lambda d: d.iterkeys()
+ itervalues = lambda d: d.itervalues()
+ iteritems = lambda d: d.iteritems()
+
+ from cStringIO import StringIO as BytesIO
+ from StringIO import StringIO
+ import cPickle as pickle
+
+ from itertools import imap
+ from itertools import izip
+ range_type = xrange
+
+ cmp = cmp
+
+ array_tobytes = array.array.tostring
+
+
+number_types = integer_types + (float,)
+
+
+#
+# Use cdecimal when available
+#
+from decimal import (Decimal as _dec,
+ InvalidOperation as _invop,
+ ROUND_HALF_EVEN as _RHE)
+try:
+ from cdecimal import (Decimal as _cdec,
+ InvalidOperation as _cinvop,
+ ROUND_HALF_EVEN as _CRHE)
+ Decimal = _cdec
+ InvalidOperation = (_invop, _cinvop)
+ ROUND_HALF_EVEN = _CRHE
+except ImportError:
+ Decimal = _dec
+ InvalidOperation = _invop
+ ROUND_HALF_EVEN = _RHE
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/core.py b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/core.py
new file mode 100644
index 000000000..813a61a96
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/core.py
@@ -0,0 +1,978 @@
+# -*- coding: utf-8 -*-
+"""
+ babel.core
+ ~~~~~~~~~~
+
+ Core locale representation and locale data access.
+
+ :copyright: (c) 2013 by the Babel Team.
+ :license: BSD, see LICENSE for more details.
+"""
+
+import os
+
+from babel import localedata
+from babel._compat import pickle, string_types
+from babel.plural import PluralRule
+
+__all__ = ['UnknownLocaleError', 'Locale', 'default_locale', 'negotiate_locale',
+ 'parse_locale']
+
+
+_global_data = None
+_default_plural_rule = PluralRule({})
+
+
+def _raise_no_data_error():
+ raise RuntimeError('The babel data files are not available. '
+ 'This usually happens because you are using '
+ 'a source checkout from Babel and you did '
+ 'not build the data files. Just make sure '
+ 'to run "python setup.py import_cldr" before '
+ 'installing the library.')
+
+
+def get_global(key):
+ """Return the dictionary for the given key in the global data.
+
+ The global data is stored in the ``babel/global.dat`` file and contains
+ information independent of individual locales.
+
+ >>> get_global('zone_aliases')['UTC']
+ u'Etc/GMT'
+ >>> get_global('zone_territories')['Europe/Berlin']
+ u'DE'
+
+ .. versionadded:: 0.9
+
+ :param key: the data key
+ """
+ global _global_data
+ if _global_data is None:
+ dirname = os.path.join(os.path.dirname(__file__))
+ filename = os.path.join(dirname, 'global.dat')
+ if not os.path.isfile(filename):
+ _raise_no_data_error()
+ fileobj = open(filename, 'rb')
+ try:
+ _global_data = pickle.load(fileobj)
+ finally:
+ fileobj.close()
+ return _global_data.get(key, {})
+
+
+LOCALE_ALIASES = {
+ 'ar': 'ar_SY', 'bg': 'bg_BG', 'bs': 'bs_BA', 'ca': 'ca_ES', 'cs': 'cs_CZ',
+ 'da': 'da_DK', 'de': 'de_DE', 'el': 'el_GR', 'en': 'en_US', 'es': 'es_ES',
+ 'et': 'et_EE', 'fa': 'fa_IR', 'fi': 'fi_FI', 'fr': 'fr_FR', 'gl': 'gl_ES',
+ 'he': 'he_IL', 'hu': 'hu_HU', 'id': 'id_ID', 'is': 'is_IS', 'it': 'it_IT',
+ 'ja': 'ja_JP', 'km': 'km_KH', 'ko': 'ko_KR', 'lt': 'lt_LT', 'lv': 'lv_LV',
+ 'mk': 'mk_MK', 'nl': 'nl_NL', 'nn': 'nn_NO', 'no': 'nb_NO', 'pl': 'pl_PL',
+ 'pt': 'pt_PT', 'ro': 'ro_RO', 'ru': 'ru_RU', 'sk': 'sk_SK', 'sl': 'sl_SI',
+ 'sv': 'sv_SE', 'th': 'th_TH', 'tr': 'tr_TR', 'uk': 'uk_UA'
+}
+
+
+class UnknownLocaleError(Exception):
+ """Exception thrown when a locale is requested for which no locale data
+ is available.
+ """
+
+ def __init__(self, identifier):
+ """Create the exception.
+
+ :param identifier: the identifier string of the unsupported locale
+ """
+ Exception.__init__(self, 'unknown locale %r' % identifier)
+
+ #: The identifier of the locale that could not be found.
+ self.identifier = identifier
+
+
+class Locale(object):
+ """Representation of a specific locale.
+
+ >>> locale = Locale('en', 'US')
+ >>> repr(locale)
+ "Locale('en', territory='US')"
+ >>> locale.display_name
+ u'English (United States)'
+
+ A `Locale` object can also be instantiated from a raw locale string:
+
+ >>> locale = Locale.parse('en-US', sep='-')
+ >>> repr(locale)
+ "Locale('en', territory='US')"
+
+ `Locale` objects provide access to a collection of locale data, such as
+ territory and language names, number and date format patterns, and more:
+
+ >>> locale.number_symbols['decimal']
+ u'.'
+
+ If a locale is requested for which no locale data is available, an
+ `UnknownLocaleError` is raised:
+
+ >>> Locale.parse('en_XX')
+ Traceback (most recent call last):
+ ...
+ UnknownLocaleError: unknown locale 'en_XX'
+
+ For more information see :rfc:`3066`.
+ """
+
+ def __init__(self, language, territory=None, script=None, variant=None):
+ """Initialize the locale object from the given identifier components.
+
+ >>> locale = Locale('en', 'US')
+ >>> locale.language
+ 'en'
+ >>> locale.territory
+ 'US'
+
+ :param language: the language code
+ :param territory: the territory (country or region) code
+ :param script: the script code
+ :param variant: the variant code
+ :raise `UnknownLocaleError`: if no locale data is available for the
+ requested locale
+ """
+ #: the language code
+ self.language = language
+ #: the territory (country or region) code
+ self.territory = territory
+ #: the script code
+ self.script = script
+ #: the variant code
+ self.variant = variant
+ self.__data = None
+
+ identifier = str(self)
+ if not localedata.exists(identifier):
+ raise UnknownLocaleError(identifier)
+
+ @classmethod
+ def default(cls, category=None, aliases=LOCALE_ALIASES):
+ """Return the system default locale for the specified category.
+
+ >>> for name in ['LANGUAGE', 'LC_ALL', 'LC_CTYPE', 'LC_MESSAGES']:
+ ... os.environ[name] = ''
+ >>> os.environ['LANG'] = 'fr_FR.UTF-8'
+ >>> Locale.default('LC_MESSAGES')
+ Locale('fr', territory='FR')
+
+ The following fallbacks to the variable are always considered:
+
+ - ``LANGUAGE``
+ - ``LC_ALL``
+ - ``LC_CTYPE``
+ - ``LANG``
+
+ :param category: one of the ``LC_XXX`` environment variable names
+ :param aliases: a dictionary of aliases for locale identifiers
+ """
+ # XXX: use likely subtag expansion here instead of the
+ # aliases dictionary.
+ locale_string = default_locale(category, aliases=aliases)
+ return cls.parse(locale_string)
+
+ @classmethod
+ def negotiate(cls, preferred, available, sep='_', aliases=LOCALE_ALIASES):
+ """Find the best match between available and requested locale strings.
+
+ >>> Locale.negotiate(['de_DE', 'en_US'], ['de_DE', 'de_AT'])
+ Locale('de', territory='DE')
+ >>> Locale.negotiate(['de_DE', 'en_US'], ['en', 'de'])
+ Locale('de')
+ >>> Locale.negotiate(['de_DE', 'de'], ['en_US'])
+
+ You can specify the character used in the locale identifiers to separate
+ the differnet components. This separator is applied to both lists. Also,
+ case is ignored in the comparison:
+
+ >>> Locale.negotiate(['de-DE', 'de'], ['en-us', 'de-de'], sep='-')
+ Locale('de', territory='DE')
+
+ :param preferred: the list of locale identifers preferred by the user
+ :param available: the list of locale identifiers available
+ :param aliases: a dictionary of aliases for locale identifiers
+ """
+ identifier = negotiate_locale(preferred, available, sep=sep,
+ aliases=aliases)
+ if identifier:
+ return Locale.parse(identifier, sep=sep)
+
+ @classmethod
+ def parse(cls, identifier, sep='_', resolve_likely_subtags=True):
+ """Create a `Locale` instance for the given locale identifier.
+
+ >>> l = Locale.parse('de-DE', sep='-')
+ >>> l.display_name
+ u'Deutsch (Deutschland)'
+
+ If the `identifier` parameter is not a string, but actually a `Locale`
+ object, that object is returned:
+
+ >>> Locale.parse(l)
+ Locale('de', territory='DE')
+
+ This also can perform resolving of likely subtags which it does
+ by default. This is for instance useful to figure out the most
+ likely locale for a territory you can use ``'und'`` as the
+ language tag:
+
+ >>> Locale.parse('und_AT')
+ Locale('de', territory='AT')
+
+ :param identifier: the locale identifier string
+ :param sep: optional component separator
+ :param resolve_likely_subtags: if this is specified then a locale will
+ have its likely subtag resolved if the
+ locale otherwise does not exist. For
+ instance ``zh_TW`` by itself is not a
+ locale that exists but Babel can
+ automatically expand it to the full
+ form of ``zh_hant_TW``. Note that this
+ expansion is only taking place if no
+ locale exists otherwise. For instance
+ there is a locale ``en`` that can exist
+ by itself.
+ :raise `ValueError`: if the string does not appear to be a valid locale
+ identifier
+ :raise `UnknownLocaleError`: if no locale data is available for the
+ requested locale
+ """
+ if identifier is None:
+ return None
+ elif isinstance(identifier, Locale):
+ return identifier
+ elif not isinstance(identifier, string_types):
+ raise TypeError('Unxpected value for identifier: %r' % (identifier,))
+
+ parts = parse_locale(identifier, sep=sep)
+ input_id = get_locale_identifier(parts)
+
+ def _try_load(parts):
+ try:
+ return cls(*parts)
+ except UnknownLocaleError:
+ return None
+
+ def _try_load_reducing(parts):
+ # Success on first hit, return it.
+ locale = _try_load(parts)
+ if locale is not None:
+ return locale
+
+ # Now try without script and variant
+ locale = _try_load(parts[:2])
+ if locale is not None:
+ return locale
+
+ locale = _try_load(parts)
+ if locale is not None:
+ return locale
+ if not resolve_likely_subtags:
+ raise UnknownLocaleError(input_id)
+
+ # From here onwards is some very bad likely subtag resolving. This
+ # whole logic is not entirely correct but good enough (tm) for the
+ # time being. This has been added so that zh_TW does not cause
+ # errors for people when they upgrade. Later we should properly
+ # implement ICU like fuzzy locale objects and provide a way to
+ # maximize and minimize locale tags.
+
+ language, territory, script, variant = parts
+ language = get_global('language_aliases').get(language, language)
+ territory = get_global('territory_aliases').get(territory, (territory,))[0]
+ script = get_global('script_aliases').get(script, script)
+ variant = get_global('variant_aliases').get(variant, variant)
+
+ if territory == 'ZZ':
+ territory = None
+ if script == 'Zzzz':
+ script = None
+
+ parts = language, territory, script, variant
+
+ # First match: try the whole identifier
+ new_id = get_locale_identifier(parts)
+ likely_subtag = get_global('likely_subtags').get(new_id)
+ if likely_subtag is not None:
+ locale = _try_load_reducing(parse_locale(likely_subtag))
+ if locale is not None:
+ return locale
+
+ # If we did not find anything so far, try again with a
+ # simplified identifier that is just the language
+ likely_subtag = get_global('likely_subtags').get(language)
+ if likely_subtag is not None:
+ language2, _, script2, variant2 = parse_locale(likely_subtag)
+ locale = _try_load_reducing((language2, territory, script2, variant2))
+ if locale is not None:
+ return locale
+
+ raise UnknownLocaleError(input_id)
+
+ def __eq__(self, other):
+ for key in ('language', 'territory', 'script', 'variant'):
+ if not hasattr(other, key):
+ return False
+ return (self.language == other.language) and \
+ (self.territory == other.territory) and \
+ (self.script == other.script) and \
+ (self.variant == other.variant)
+
+ def __ne__(self, other):
+ return not self.__eq__(other)
+
+ def __hash__(self):
+ return hash((self.language, self.territory, self.script, self.variant))
+
+ def __repr__(self):
+ parameters = ['']
+ for key in ('territory', 'script', 'variant'):
+ value = getattr(self, key)
+ if value is not None:
+ parameters.append('%s=%r' % (key, value))
+ parameter_string = '%r' % self.language + ', '.join(parameters)
+ return 'Locale(%s)' % parameter_string
+
+ def __str__(self):
+ return get_locale_identifier((self.language, self.territory,
+ self.script, self.variant))
+
+ @property
+ def _data(self):
+ if self.__data is None:
+ self.__data = localedata.LocaleDataDict(localedata.load(str(self)))
+ return self.__data
+
+ def get_display_name(self, locale=None):
+ """Return the display name of the locale using the given locale.
+
+ The display name will include the language, territory, script, and
+ variant, if those are specified.
+
+ >>> Locale('zh', 'CN', script='Hans').get_display_name('en')
+ u'Chinese (Simplified, China)'
+
+ :param locale: the locale to use
+ """
+ if locale is None:
+ locale = self
+ locale = Locale.parse(locale)
+ retval = locale.languages.get(self.language)
+ if self.territory or self.script or self.variant:
+ details = []
+ if self.script:
+ details.append(locale.scripts.get(self.script))
+ if self.territory:
+ details.append(locale.territories.get(self.territory))
+ if self.variant:
+ details.append(locale.variants.get(self.variant))
+ details = filter(None, details)
+ if details:
+ retval += ' (%s)' % u', '.join(details)
+ return retval
+
+ display_name = property(get_display_name, doc="""\
+ The localized display name of the locale.
+
+ >>> Locale('en').display_name
+ u'English'
+ >>> Locale('en', 'US').display_name
+ u'English (United States)'
+ >>> Locale('sv').display_name
+ u'svenska'
+
+ :type: `unicode`
+ """)
+
+ def get_language_name(self, locale=None):
+ """Return the language of this locale in the given locale.
+
+ >>> Locale('zh', 'CN', script='Hans').get_language_name('de')
+ u'Chinesisch'
+
+ .. versionadded:: 1.0
+
+ :param locale: the locale to use
+ """
+ if locale is None:
+ locale = self
+ locale = Locale.parse(locale)
+ return locale.languages.get(self.language)
+
+ language_name = property(get_language_name, doc="""\
+ The localized language name of the locale.
+
+ >>> Locale('en', 'US').language_name
+ u'English'
+ """)
+
+ def get_territory_name(self, locale=None):
+ """Return the territory name in the given locale."""
+ if locale is None:
+ locale = self
+ locale = Locale.parse(locale)
+ return locale.territories.get(self.territory)
+
+ territory_name = property(get_territory_name, doc="""\
+ The localized territory name of the locale if available.
+
+ >>> Locale('de', 'DE').territory_name
+ u'Deutschland'
+ """)
+
+ def get_script_name(self, locale=None):
+ """Return the script name in the given locale."""
+ if locale is None:
+ locale = self
+ locale = Locale.parse(locale)
+ return locale.scripts.get(self.script)
+
+ script_name = property(get_script_name, doc="""\
+ The localized script name of the locale if available.
+
+ >>> Locale('sr', 'ME', script='Latn').script_name
+ u'latinica'
+ """)
+
+ @property
+ def english_name(self):
+ """The english display name of the locale.
+
+ >>> Locale('de').english_name
+ u'German'
+ >>> Locale('de', 'DE').english_name
+ u'German (Germany)'
+
+ :type: `unicode`"""
+ return self.get_display_name(Locale('en'))
+
+ #{ General Locale Display Names
+
+ @property
+ def languages(self):
+ """Mapping of language codes to translated language names.
+
+ >>> Locale('de', 'DE').languages['ja']
+ u'Japanisch'
+
+ See `ISO 639 `_ for
+ more information.
+ """
+ return self._data['languages']
+
+ @property
+ def scripts(self):
+ """Mapping of script codes to translated script names.
+
+ >>> Locale('en', 'US').scripts['Hira']
+ u'Hiragana'
+
+ See `ISO 15924 `_
+ for more information.
+ """
+ return self._data['scripts']
+
+ @property
+ def territories(self):
+ """Mapping of script codes to translated script names.
+
+ >>> Locale('es', 'CO').territories['DE']
+ u'Alemania'
+
+ See `ISO 3166 `_
+ for more information.
+ """
+ return self._data['territories']
+
+ @property
+ def variants(self):
+ """Mapping of script codes to translated script names.
+
+ >>> Locale('de', 'DE').variants['1901']
+ u'Alte deutsche Rechtschreibung'
+ """
+ return self._data['variants']
+
+ #{ Number Formatting
+
+ @property
+ def currencies(self):
+ """Mapping of currency codes to translated currency names. This
+ only returns the generic form of the currency name, not the count
+ specific one. If an actual number is requested use the
+ :func:`babel.numbers.get_currency_name` function.
+
+ >>> Locale('en').currencies['COP']
+ u'Colombian Peso'
+ >>> Locale('de', 'DE').currencies['COP']
+ u'Kolumbianischer Peso'
+ """
+ return self._data['currency_names']
+
+ @property
+ def currency_symbols(self):
+ """Mapping of currency codes to symbols.
+
+ >>> Locale('en', 'US').currency_symbols['USD']
+ u'$'
+ >>> Locale('es', 'CO').currency_symbols['USD']
+ u'US$'
+ """
+ return self._data['currency_symbols']
+
+ @property
+ def number_symbols(self):
+ """Symbols used in number formatting.
+
+ >>> Locale('fr', 'FR').number_symbols['decimal']
+ u','
+ """
+ return self._data['number_symbols']
+
+ @property
+ def decimal_formats(self):
+ """Locale patterns for decimal number formatting.
+
+ >>> Locale('en', 'US').decimal_formats[None]
+
+ """
+ return self._data['decimal_formats']
+
+ @property
+ def currency_formats(self):
+ """Locale patterns for currency number formatting.
+
+ >>> Locale('en', 'US').currency_formats['standard']
+
+ >>> Locale('en', 'US').currency_formats['accounting']
+
+ """
+ return self._data['currency_formats']
+
+ @property
+ def percent_formats(self):
+ """Locale patterns for percent number formatting.
+
+ >>> Locale('en', 'US').percent_formats[None]
+
+ """
+ return self._data['percent_formats']
+
+ @property
+ def scientific_formats(self):
+ """Locale patterns for scientific number formatting.
+
+ >>> Locale('en', 'US').scientific_formats[None]
+
+ """
+ return self._data['scientific_formats']
+
+ #{ Calendar Information and Date Formatting
+
+ @property
+ def periods(self):
+ """Locale display names for day periods (AM/PM).
+
+ >>> Locale('en', 'US').periods['am']
+ u'AM'
+ """
+ return self._data['periods']
+
+ @property
+ def days(self):
+ """Locale display names for weekdays.
+
+ >>> Locale('de', 'DE').days['format']['wide'][3]
+ u'Donnerstag'
+ """
+ return self._data['days']
+
+ @property
+ def months(self):
+ """Locale display names for months.
+
+ >>> Locale('de', 'DE').months['format']['wide'][10]
+ u'Oktober'
+ """
+ return self._data['months']
+
+ @property
+ def quarters(self):
+ """Locale display names for quarters.
+
+ >>> Locale('de', 'DE').quarters['format']['wide'][1]
+ u'1. Quartal'
+ """
+ return self._data['quarters']
+
+ @property
+ def eras(self):
+ """Locale display names for eras.
+
+ >>> Locale('en', 'US').eras['wide'][1]
+ u'Anno Domini'
+ >>> Locale('en', 'US').eras['abbreviated'][0]
+ u'BC'
+ """
+ return self._data['eras']
+
+ @property
+ def time_zones(self):
+ """Locale display names for time zones.
+
+ >>> Locale('en', 'US').time_zones['Europe/London']['long']['daylight']
+ u'British Summer Time'
+ >>> Locale('en', 'US').time_zones['America/St_Johns']['city']
+ u'St. John\u2019s'
+ """
+ return self._data['time_zones']
+
+ @property
+ def meta_zones(self):
+ """Locale display names for meta time zones.
+
+ Meta time zones are basically groups of different Olson time zones that
+ have the same GMT offset and daylight savings time.
+
+ >>> Locale('en', 'US').meta_zones['Europe_Central']['long']['daylight']
+ u'Central European Summer Time'
+
+ .. versionadded:: 0.9
+ """
+ return self._data['meta_zones']
+
+ @property
+ def zone_formats(self):
+ """Patterns related to the formatting of time zones.
+
+ >>> Locale('en', 'US').zone_formats['fallback']
+ u'%(1)s (%(0)s)'
+ >>> Locale('pt', 'BR').zone_formats['region']
+ u'Hor\\xe1rio %s'
+
+ .. versionadded:: 0.9
+ """
+ return self._data['zone_formats']
+
+ @property
+ def first_week_day(self):
+ """The first day of a week, with 0 being Monday.
+
+ >>> Locale('de', 'DE').first_week_day
+ 0
+ >>> Locale('en', 'US').first_week_day
+ 6
+ """
+ return self._data['week_data']['first_day']
+
+ @property
+ def weekend_start(self):
+ """The day the weekend starts, with 0 being Monday.
+
+ >>> Locale('de', 'DE').weekend_start
+ 5
+ """
+ return self._data['week_data']['weekend_start']
+
+ @property
+ def weekend_end(self):
+ """The day the weekend ends, with 0 being Monday.
+
+ >>> Locale('de', 'DE').weekend_end
+ 6
+ """
+ return self._data['week_data']['weekend_end']
+
+ @property
+ def min_week_days(self):
+ """The minimum number of days in a week so that the week is counted as
+ the first week of a year or month.
+
+ >>> Locale('de', 'DE').min_week_days
+ 4
+ """
+ return self._data['week_data']['min_days']
+
+ @property
+ def date_formats(self):
+ """Locale patterns for date formatting.
+
+ >>> Locale('en', 'US').date_formats['short']
+
+ >>> Locale('fr', 'FR').date_formats['long']
+
+ """
+ return self._data['date_formats']
+
+ @property
+ def time_formats(self):
+ """Locale patterns for time formatting.
+
+ >>> Locale('en', 'US').time_formats['short']
+
+ >>> Locale('fr', 'FR').time_formats['long']
+
+ """
+ return self._data['time_formats']
+
+ @property
+ def datetime_formats(self):
+ """Locale patterns for datetime formatting.
+
+ >>> Locale('en').datetime_formats['full']
+ u"{1} 'at' {0}"
+ >>> Locale('th').datetime_formats['medium']
+ u'{1} {0}'
+ """
+ return self._data['datetime_formats']
+
+ @property
+ def plural_form(self):
+ """Plural rules for the locale.
+
+ >>> Locale('en').plural_form(1)
+ 'one'
+ >>> Locale('en').plural_form(0)
+ 'other'
+ >>> Locale('fr').plural_form(0)
+ 'one'
+ >>> Locale('ru').plural_form(100)
+ 'many'
+ """
+ return self._data.get('plural_form', _default_plural_rule)
+
+ @property
+ def list_patterns(self):
+ """Patterns for generating lists
+
+ >>> Locale('en').list_patterns['start']
+ u'{0}, {1}'
+ >>> Locale('en').list_patterns['end']
+ u'{0}, and {1}'
+ >>> Locale('en_GB').list_patterns['end']
+ u'{0} and {1}'
+ """
+ return self._data['list_patterns']
+
+ @property
+ def ordinal_form(self):
+ """Plural rules for the locale.
+
+ >>> Locale('en').ordinal_form(1)
+ 'one'
+ >>> Locale('en').ordinal_form(2)
+ 'two'
+ >>> Locale('en').ordinal_form(3)
+ 'few'
+ >>> Locale('fr').ordinal_form(2)
+ 'other'
+ >>> Locale('ru').ordinal_form(100)
+ 'other'
+ """
+ return self._data.get('ordinal_form', _default_plural_rule)
+
+
+def default_locale(category=None, aliases=LOCALE_ALIASES):
+ """Returns the system default locale for a given category, based on
+ environment variables.
+
+ >>> for name in ['LANGUAGE', 'LC_ALL', 'LC_CTYPE']:
+ ... os.environ[name] = ''
+ >>> os.environ['LANG'] = 'fr_FR.UTF-8'
+ >>> default_locale('LC_MESSAGES')
+ 'fr_FR'
+
+ The "C" or "POSIX" pseudo-locales are treated as aliases for the
+ "en_US_POSIX" locale:
+
+ >>> os.environ['LC_MESSAGES'] = 'POSIX'
+ >>> default_locale('LC_MESSAGES')
+ 'en_US_POSIX'
+
+ The following fallbacks to the variable are always considered:
+
+ - ``LANGUAGE``
+ - ``LC_ALL``
+ - ``LC_CTYPE``
+ - ``LANG``
+
+ :param category: one of the ``LC_XXX`` environment variable names
+ :param aliases: a dictionary of aliases for locale identifiers
+ """
+ varnames = (category, 'LANGUAGE', 'LC_ALL', 'LC_CTYPE', 'LANG')
+ for name in filter(None, varnames):
+ locale = os.getenv(name)
+ if locale:
+ if name == 'LANGUAGE' and ':' in locale:
+ # the LANGUAGE variable may contain a colon-separated list of
+ # language codes; we just pick the language on the list
+ locale = locale.split(':')[0]
+ if locale.split('.')[0] in ('C', 'POSIX'):
+ locale = 'en_US_POSIX'
+ elif aliases and locale in aliases:
+ locale = aliases[locale]
+ try:
+ return get_locale_identifier(parse_locale(locale))
+ except ValueError:
+ pass
+
+
+def negotiate_locale(preferred, available, sep='_', aliases=LOCALE_ALIASES):
+ """Find the best match between available and requested locale strings.
+
+ >>> negotiate_locale(['de_DE', 'en_US'], ['de_DE', 'de_AT'])
+ 'de_DE'
+ >>> negotiate_locale(['de_DE', 'en_US'], ['en', 'de'])
+ 'de'
+
+ Case is ignored by the algorithm, the result uses the case of the preferred
+ locale identifier:
+
+ >>> negotiate_locale(['de_DE', 'en_US'], ['de_de', 'de_at'])
+ 'de_DE'
+
+ >>> negotiate_locale(['de_DE', 'en_US'], ['de_de', 'de_at'])
+ 'de_DE'
+
+ By default, some web browsers unfortunately do not include the territory
+ in the locale identifier for many locales, and some don't even allow the
+ user to easily add the territory. So while you may prefer using qualified
+ locale identifiers in your web-application, they would not normally match
+ the language-only locale sent by such browsers. To workaround that, this
+ function uses a default mapping of commonly used langauge-only locale
+ identifiers to identifiers including the territory:
+
+ >>> negotiate_locale(['ja', 'en_US'], ['ja_JP', 'en_US'])
+ 'ja_JP'
+
+ Some browsers even use an incorrect or outdated language code, such as "no"
+ for Norwegian, where the correct locale identifier would actually be "nb_NO"
+ (Bokmål) or "nn_NO" (Nynorsk). The aliases are intended to take care of
+ such cases, too:
+
+ >>> negotiate_locale(['no', 'sv'], ['nb_NO', 'sv_SE'])
+ 'nb_NO'
+
+ You can override this default mapping by passing a different `aliases`
+ dictionary to this function, or you can bypass the behavior althogher by
+ setting the `aliases` parameter to `None`.
+
+ :param preferred: the list of locale strings preferred by the user
+ :param available: the list of locale strings available
+ :param sep: character that separates the different parts of the locale
+ strings
+ :param aliases: a dictionary of aliases for locale identifiers
+ """
+ available = [a.lower() for a in available if a]
+ for locale in preferred:
+ ll = locale.lower()
+ if ll in available:
+ return locale
+ if aliases:
+ alias = aliases.get(ll)
+ if alias:
+ alias = alias.replace('_', sep)
+ if alias.lower() in available:
+ return alias
+ parts = locale.split(sep)
+ if len(parts) > 1 and parts[0].lower() in available:
+ return parts[0]
+ return None
+
+
+def parse_locale(identifier, sep='_'):
+ """Parse a locale identifier into a tuple of the form ``(language,
+ territory, script, variant)``.
+
+ >>> parse_locale('zh_CN')
+ ('zh', 'CN', None, None)
+ >>> parse_locale('zh_Hans_CN')
+ ('zh', 'CN', 'Hans', None)
+
+ The default component separator is "_", but a different separator can be
+ specified using the `sep` parameter:
+
+ >>> parse_locale('zh-CN', sep='-')
+ ('zh', 'CN', None, None)
+
+ If the identifier cannot be parsed into a locale, a `ValueError` exception
+ is raised:
+
+ >>> parse_locale('not_a_LOCALE_String')
+ Traceback (most recent call last):
+ ...
+ ValueError: 'not_a_LOCALE_String' is not a valid locale identifier
+
+ Encoding information and locale modifiers are removed from the identifier:
+
+ >>> parse_locale('it_IT@euro')
+ ('it', 'IT', None, None)
+ >>> parse_locale('en_US.UTF-8')
+ ('en', 'US', None, None)
+ >>> parse_locale('de_DE.iso885915@euro')
+ ('de', 'DE', None, None)
+
+ See :rfc:`4646` for more information.
+
+ :param identifier: the locale identifier string
+ :param sep: character that separates the different components of the locale
+ identifier
+ :raise `ValueError`: if the string does not appear to be a valid locale
+ identifier
+ """
+ if '.' in identifier:
+ # this is probably the charset/encoding, which we don't care about
+ identifier = identifier.split('.', 1)[0]
+ if '@' in identifier:
+ # this is a locale modifier such as @euro, which we don't care about
+ # either
+ identifier = identifier.split('@', 1)[0]
+
+ parts = identifier.split(sep)
+ lang = parts.pop(0).lower()
+ if not lang.isalpha():
+ raise ValueError('expected only letters, got %r' % lang)
+
+ script = territory = variant = None
+ if parts:
+ if len(parts[0]) == 4 and parts[0].isalpha():
+ script = parts.pop(0).title()
+
+ if parts:
+ if len(parts[0]) == 2 and parts[0].isalpha():
+ territory = parts.pop(0).upper()
+ elif len(parts[0]) == 3 and parts[0].isdigit():
+ territory = parts.pop(0)
+
+ if parts:
+ if len(parts[0]) == 4 and parts[0][0].isdigit() or \
+ len(parts[0]) >= 5 and parts[0][0].isalpha():
+ variant = parts.pop()
+
+ if parts:
+ raise ValueError('%r is not a valid locale identifier' % identifier)
+
+ return lang, territory, script, variant
+
+
+def get_locale_identifier(tup, sep='_'):
+ """The reverse of :func:`parse_locale`. It creates a locale identifier out
+ of a ``(language, territory, script, variant)`` tuple. Items can be set to
+ ``None`` and trailing ``None``\s can also be left out of the tuple.
+
+ >>> get_locale_identifier(('de', 'DE', None, '1999'))
+ 'de_DE_1999'
+
+ .. versionadded:: 1.0
+
+ :param tup: the tuple as returned by :func:`parse_locale`.
+ :param sep: the separator for the identifier.
+ """
+ tup = tuple(tup[:4])
+ lang, territory, script, variant = tup + (None,) * (4 - len(tup))
+ return sep.join(filter(None, (lang, script, territory, variant)))
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/dates.py b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/dates.py
new file mode 100644
index 000000000..ab2d4fb29
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/dates.py
@@ -0,0 +1,1196 @@
+# -*- coding: utf-8 -*-
+"""
+ babel.dates
+ ~~~~~~~~~~~
+
+ Locale dependent formatting and parsing of dates and times.
+
+ The default locale for the functions in this module is determined by the
+ following environment variables, in that order:
+
+ * ``LC_TIME``,
+ * ``LC_ALL``, and
+ * ``LANG``
+
+ :copyright: (c) 2013 by the Babel Team.
+ :license: BSD, see LICENSE for more details.
+"""
+
+from __future__ import division
+
+import re
+import warnings
+import pytz as _pytz
+
+from datetime import date, datetime, time, timedelta
+from bisect import bisect_right
+
+from babel.core import default_locale, get_global, Locale
+from babel.util import UTC, LOCALTZ
+from babel._compat import string_types, integer_types, number_types
+
+
+LC_TIME = default_locale('LC_TIME')
+
+# Aliases for use in scopes where the modules are shadowed by local variables
+date_ = date
+datetime_ = datetime
+time_ = time
+
+
+def get_timezone(zone=None):
+ """Looks up a timezone by name and returns it. The timezone object
+ returned comes from ``pytz`` and corresponds to the `tzinfo` interface and
+ can be used with all of the functions of Babel that operate with dates.
+
+ If a timezone is not known a :exc:`LookupError` is raised. If `zone`
+ is ``None`` a local zone object is returned.
+
+ :param zone: the name of the timezone to look up. If a timezone object
+ itself is passed in, mit's returned unchanged.
+ """
+ if zone is None:
+ return LOCALTZ
+ if not isinstance(zone, string_types):
+ return zone
+ try:
+ return _pytz.timezone(zone)
+ except _pytz.UnknownTimeZoneError:
+ raise LookupError('Unknown timezone %s' % zone)
+
+
+def get_next_timezone_transition(zone=None, dt=None):
+ """Given a timezone it will return a :class:`TimezoneTransition` object
+ that holds the information about the next timezone transition that's going
+ to happen. For instance this can be used to detect when the next DST
+ change is going to happen and how it looks like.
+
+ The transition is calculated relative to the given datetime object. The
+ next transition that follows the date is used. If a transition cannot
+ be found the return value will be `None`.
+
+ Transition information can only be provided for timezones returned by
+ the :func:`get_timezone` function.
+
+ :param zone: the timezone for which the transition should be looked up.
+ If not provided the local timezone is used.
+ :param dt: the date after which the next transition should be found.
+ If not given the current time is assumed.
+ """
+ zone = get_timezone(zone)
+ if dt is None:
+ dt = datetime.utcnow()
+ else:
+ dt = dt.replace(tzinfo=None)
+
+ if not hasattr(zone, '_utc_transition_times'):
+ raise TypeError('Given timezone does not have UTC transition '
+ 'times. This can happen because the operating '
+ 'system fallback local timezone is used or a '
+ 'custom timezone object')
+
+ try:
+ idx = max(0, bisect_right(zone._utc_transition_times, dt))
+ old_trans = zone._transition_info[idx - 1]
+ new_trans = zone._transition_info[idx]
+ old_tz = zone._tzinfos[old_trans]
+ new_tz = zone._tzinfos[new_trans]
+ except (LookupError, ValueError):
+ return None
+
+ return TimezoneTransition(
+ activates=zone._utc_transition_times[idx],
+ from_tzinfo=old_tz,
+ to_tzinfo=new_tz,
+ reference_date=dt
+ )
+
+
+class TimezoneTransition(object):
+ """A helper object that represents the return value from
+ :func:`get_next_timezone_transition`.
+ """
+
+ def __init__(self, activates, from_tzinfo, to_tzinfo, reference_date=None):
+ #: the time of the activation of the timezone transition in UTC.
+ self.activates = activates
+ #: the timezone from where the transition starts.
+ self.from_tzinfo = from_tzinfo
+ #: the timezone for after the transition.
+ self.to_tzinfo = to_tzinfo
+ #: the reference date that was provided. This is the `dt` parameter
+ #: to the :func:`get_next_timezone_transition`.
+ self.reference_date = reference_date
+
+ @property
+ def from_tz(self):
+ """The name of the timezone before the transition."""
+ return self.from_tzinfo._tzname
+
+ @property
+ def to_tz(self):
+ """The name of the timezone after the transition."""
+ return self.to_tzinfo._tzname
+
+ @property
+ def from_offset(self):
+ """The UTC offset in seconds before the transition."""
+ return int(self.from_tzinfo._utcoffset.total_seconds())
+
+ @property
+ def to_offset(self):
+ """The UTC offset in seconds after the transition."""
+ return int(self.to_tzinfo._utcoffset.total_seconds())
+
+ def __repr__(self):
+ return ' %s (%s)>' % (
+ self.from_tz,
+ self.to_tz,
+ self.activates,
+ )
+
+
+def get_period_names(locale=LC_TIME):
+ """Return the names for day periods (AM/PM) used by the locale.
+
+ >>> get_period_names(locale='en_US')['am']
+ u'AM'
+
+ :param locale: the `Locale` object, or a locale string
+ """
+ return Locale.parse(locale).periods
+
+
+def get_day_names(width='wide', context='format', locale=LC_TIME):
+ """Return the day names used by the locale for the specified format.
+
+ >>> get_day_names('wide', locale='en_US')[1]
+ u'Tuesday'
+ >>> get_day_names('abbreviated', locale='es')[1]
+ u'mar.'
+ >>> get_day_names('narrow', context='stand-alone', locale='de_DE')[1]
+ u'D'
+
+ :param width: the width to use, one of "wide", "abbreviated", or "narrow"
+ :param context: the context, either "format" or "stand-alone"
+ :param locale: the `Locale` object, or a locale string
+ """
+ return Locale.parse(locale).days[context][width]
+
+
+def get_month_names(width='wide', context='format', locale=LC_TIME):
+ """Return the month names used by the locale for the specified format.
+
+ >>> get_month_names('wide', locale='en_US')[1]
+ u'January'
+ >>> get_month_names('abbreviated', locale='es')[1]
+ u'ene.'
+ >>> get_month_names('narrow', context='stand-alone', locale='de_DE')[1]
+ u'J'
+
+ :param width: the width to use, one of "wide", "abbreviated", or "narrow"
+ :param context: the context, either "format" or "stand-alone"
+ :param locale: the `Locale` object, or a locale string
+ """
+ return Locale.parse(locale).months[context][width]
+
+
+def get_quarter_names(width='wide', context='format', locale=LC_TIME):
+ """Return the quarter names used by the locale for the specified format.
+
+ >>> get_quarter_names('wide', locale='en_US')[1]
+ u'1st quarter'
+ >>> get_quarter_names('abbreviated', locale='de_DE')[1]
+ u'Q1'
+
+ :param width: the width to use, one of "wide", "abbreviated", or "narrow"
+ :param context: the context, either "format" or "stand-alone"
+ :param locale: the `Locale` object, or a locale string
+ """
+ return Locale.parse(locale).quarters[context][width]
+
+
+def get_era_names(width='wide', locale=LC_TIME):
+ """Return the era names used by the locale for the specified format.
+
+ >>> get_era_names('wide', locale='en_US')[1]
+ u'Anno Domini'
+ >>> get_era_names('abbreviated', locale='de_DE')[1]
+ u'n. Chr.'
+
+ :param width: the width to use, either "wide", "abbreviated", or "narrow"
+ :param locale: the `Locale` object, or a locale string
+ """
+ return Locale.parse(locale).eras[width]
+
+
+def get_date_format(format='medium', locale=LC_TIME):
+ """Return the date formatting patterns used by the locale for the specified
+ format.
+
+ >>> get_date_format(locale='en_US')
+
+ >>> get_date_format('full', locale='de_DE')
+
+
+ :param format: the format to use, one of "full", "long", "medium", or
+ "short"
+ :param locale: the `Locale` object, or a locale string
+ """
+ return Locale.parse(locale).date_formats[format]
+
+
+def get_datetime_format(format='medium', locale=LC_TIME):
+ """Return the datetime formatting patterns used by the locale for the
+ specified format.
+
+ >>> get_datetime_format(locale='en_US')
+ u'{1}, {0}'
+
+ :param format: the format to use, one of "full", "long", "medium", or
+ "short"
+ :param locale: the `Locale` object, or a locale string
+ """
+ patterns = Locale.parse(locale).datetime_formats
+ if format not in patterns:
+ format = None
+ return patterns[format]
+
+
+def get_time_format(format='medium', locale=LC_TIME):
+ """Return the time formatting patterns used by the locale for the specified
+ format.
+
+ >>> get_time_format(locale='en_US')
+
+ >>> get_time_format('full', locale='de_DE')
+
+
+ :param format: the format to use, one of "full", "long", "medium", or
+ "short"
+ :param locale: the `Locale` object, or a locale string
+ """
+ return Locale.parse(locale).time_formats[format]
+
+
+def get_timezone_gmt(datetime=None, width='long', locale=LC_TIME):
+ """Return the timezone associated with the given `datetime` object formatted
+ as string indicating the offset from GMT.
+
+ >>> dt = datetime(2007, 4, 1, 15, 30)
+ >>> get_timezone_gmt(dt, locale='en')
+ u'GMT+00:00'
+
+ >>> tz = get_timezone('America/Los_Angeles')
+ >>> dt = tz.localize(datetime(2007, 4, 1, 15, 30))
+ >>> get_timezone_gmt(dt, locale='en')
+ u'GMT-07:00'
+ >>> get_timezone_gmt(dt, 'short', locale='en')
+ u'-0700'
+
+ The long format depends on the locale, for example in France the acronym
+ UTC string is used instead of GMT:
+
+ >>> get_timezone_gmt(dt, 'long', locale='fr_FR')
+ u'UTC-07:00'
+
+ .. versionadded:: 0.9
+
+ :param datetime: the ``datetime`` object; if `None`, the current date and
+ time in UTC is used
+ :param width: either "long" or "short"
+ :param locale: the `Locale` object, or a locale string
+ """
+ if datetime is None:
+ datetime = datetime_.utcnow()
+ elif isinstance(datetime, integer_types):
+ datetime = datetime_.utcfromtimestamp(datetime).time()
+ if datetime.tzinfo is None:
+ datetime = datetime.replace(tzinfo=UTC)
+ locale = Locale.parse(locale)
+
+ offset = datetime.tzinfo.utcoffset(datetime)
+ seconds = offset.days * 24 * 60 * 60 + offset.seconds
+ hours, seconds = divmod(seconds, 3600)
+ if width == 'short':
+ pattern = u'%+03d%02d'
+ else:
+ pattern = locale.zone_formats['gmt'] % '%+03d:%02d'
+ return pattern % (hours, seconds // 60)
+
+
+def get_timezone_location(dt_or_tzinfo=None, locale=LC_TIME):
+ u"""Return a representation of the given timezone using "location format".
+
+ The result depends on both the local display name of the country and the
+ city associated with the time zone:
+
+ >>> tz = get_timezone('America/St_Johns')
+ >>> print(get_timezone_location(tz, locale='de_DE'))
+ Kanada (St. John’s) Zeit
+ >>> tz = get_timezone('America/Mexico_City')
+ >>> get_timezone_location(tz, locale='de_DE')
+ u'Mexiko (Mexiko-Stadt) Zeit'
+
+ If the timezone is associated with a country that uses only a single
+ timezone, just the localized country name is returned:
+
+ >>> tz = get_timezone('Europe/Berlin')
+ >>> get_timezone_name(tz, locale='de_DE')
+ u'Mitteleurop\\xe4ische Zeit'
+
+ .. versionadded:: 0.9
+
+ :param dt_or_tzinfo: the ``datetime`` or ``tzinfo`` object that determines
+ the timezone; if `None`, the current date and time in
+ UTC is assumed
+ :param locale: the `Locale` object, or a locale string
+ :return: the localized timezone name using location format
+ """
+ if dt_or_tzinfo is None:
+ dt = datetime.now()
+ tzinfo = LOCALTZ
+ elif isinstance(dt_or_tzinfo, string_types):
+ dt = None
+ tzinfo = get_timezone(dt_or_tzinfo)
+ elif isinstance(dt_or_tzinfo, integer_types):
+ dt = None
+ tzinfo = UTC
+ elif isinstance(dt_or_tzinfo, (datetime, time)):
+ dt = dt_or_tzinfo
+ if dt.tzinfo is not None:
+ tzinfo = dt.tzinfo
+ else:
+ tzinfo = UTC
+ else:
+ dt = None
+ tzinfo = dt_or_tzinfo
+ locale = Locale.parse(locale)
+
+ if hasattr(tzinfo, 'zone'):
+ zone = tzinfo.zone
+ else:
+ zone = tzinfo.tzname(dt or datetime.utcnow())
+
+ # Get the canonical time-zone code
+ zone = get_global('zone_aliases').get(zone, zone)
+
+ info = locale.time_zones.get(zone, {})
+
+ # Otherwise, if there is only one timezone for the country, return the
+ # localized country name
+ region_format = locale.zone_formats['region']
+ territory = get_global('zone_territories').get(zone)
+ if territory not in locale.territories:
+ territory = 'ZZ' # invalid/unknown
+ territory_name = locale.territories[territory]
+ if territory and len(get_global('territory_zones').get(territory, [])) == 1:
+ return region_format % (territory_name)
+
+ # Otherwise, include the city in the output
+ fallback_format = locale.zone_formats['fallback']
+ if 'city' in info:
+ city_name = info['city']
+ else:
+ metazone = get_global('meta_zones').get(zone)
+ metazone_info = locale.meta_zones.get(metazone, {})
+ if 'city' in metazone_info:
+ city_name = metazone_info['city']
+ elif '/' in zone:
+ city_name = zone.split('/', 1)[1].replace('_', ' ')
+ else:
+ city_name = zone.replace('_', ' ')
+
+ return region_format % (fallback_format % {
+ '0': city_name,
+ '1': territory_name
+ })
+
+
+def get_timezone_name(dt_or_tzinfo=None, width='long', uncommon=False,
+ locale=LC_TIME, zone_variant=None):
+ r"""Return the localized display name for the given timezone. The timezone
+ may be specified using a ``datetime`` or `tzinfo` object.
+
+ >>> dt = time(15, 30, tzinfo=get_timezone('America/Los_Angeles'))
+ >>> get_timezone_name(dt, locale='en_US')
+ u'Pacific Standard Time'
+ >>> get_timezone_name(dt, width='short', locale='en_US')
+ u'PST'
+
+ If this function gets passed only a `tzinfo` object and no concrete
+ `datetime`, the returned display name is indenpendent of daylight savings
+ time. This can be used for example for selecting timezones, or to set the
+ time of events that recur across DST changes:
+
+ >>> tz = get_timezone('America/Los_Angeles')
+ >>> get_timezone_name(tz, locale='en_US')
+ u'Pacific Time'
+ >>> get_timezone_name(tz, 'short', locale='en_US')
+ u'PT'
+
+ If no localized display name for the timezone is available, and the timezone
+ is associated with a country that uses only a single timezone, the name of
+ that country is returned, formatted according to the locale:
+
+ >>> tz = get_timezone('Europe/Berlin')
+ >>> get_timezone_name(tz, locale='de_DE')
+ u'Mitteleurop\xe4ische Zeit'
+ >>> get_timezone_name(tz, locale='pt_BR')
+ u'Hor\xe1rio da Europa Central'
+
+ On the other hand, if the country uses multiple timezones, the city is also
+ included in the representation:
+
+ >>> tz = get_timezone('America/St_Johns')
+ >>> get_timezone_name(tz, locale='de_DE')
+ u'Neufundland-Zeit'
+
+ Note that short format is currently not supported for all timezones and
+ all locales. This is partially because not every timezone has a short
+ code in every locale. In that case it currently falls back to the long
+ format.
+
+ For more information see `LDML Appendix J: Time Zone Display Names
+ `_
+
+ .. versionadded:: 0.9
+
+ .. versionchanged:: 1.0
+ Added `zone_variant` support.
+
+ :param dt_or_tzinfo: the ``datetime`` or ``tzinfo`` object that determines
+ the timezone; if a ``tzinfo`` object is used, the
+ resulting display name will be generic, i.e.
+ independent of daylight savings time; if `None`, the
+ current date in UTC is assumed
+ :param width: either "long" or "short"
+ :param uncommon: deprecated and ignored
+ :param zone_variant: defines the zone variation to return. By default the
+ variation is defined from the datetime object
+ passed in. If no datetime object is passed in, the
+ ``'generic'`` variation is assumed. The following
+ values are valid: ``'generic'``, ``'daylight'`` and
+ ``'standard'``.
+ :param locale: the `Locale` object, or a locale string
+ """
+ if dt_or_tzinfo is None:
+ dt = datetime.now()
+ tzinfo = LOCALTZ
+ elif isinstance(dt_or_tzinfo, string_types):
+ dt = None
+ tzinfo = get_timezone(dt_or_tzinfo)
+ elif isinstance(dt_or_tzinfo, integer_types):
+ dt = None
+ tzinfo = UTC
+ elif isinstance(dt_or_tzinfo, (datetime, time)):
+ dt = dt_or_tzinfo
+ if dt.tzinfo is not None:
+ tzinfo = dt.tzinfo
+ else:
+ tzinfo = UTC
+ else:
+ dt = None
+ tzinfo = dt_or_tzinfo
+ locale = Locale.parse(locale)
+
+ if hasattr(tzinfo, 'zone'):
+ zone = tzinfo.zone
+ else:
+ zone = tzinfo.tzname(dt)
+
+ if zone_variant is None:
+ if dt is None:
+ zone_variant = 'generic'
+ else:
+ dst = tzinfo.dst(dt)
+ if dst:
+ zone_variant = 'daylight'
+ else:
+ zone_variant = 'standard'
+ else:
+ if zone_variant not in ('generic', 'standard', 'daylight'):
+ raise ValueError('Invalid zone variation')
+
+ # Get the canonical time-zone code
+ zone = get_global('zone_aliases').get(zone, zone)
+
+ info = locale.time_zones.get(zone, {})
+ # Try explicitly translated zone names first
+ if width in info:
+ if zone_variant in info[width]:
+ return info[width][zone_variant]
+
+ metazone = get_global('meta_zones').get(zone)
+ if metazone:
+ metazone_info = locale.meta_zones.get(metazone, {})
+ if width in metazone_info:
+ if zone_variant in metazone_info[width]:
+ return metazone_info[width][zone_variant]
+
+ # If we have a concrete datetime, we assume that the result can't be
+ # independent of daylight savings time, so we return the GMT offset
+ if dt is not None:
+ return get_timezone_gmt(dt, width=width, locale=locale)
+
+ return get_timezone_location(dt_or_tzinfo, locale=locale)
+
+
+def format_date(date=None, format='medium', locale=LC_TIME):
+ """Return a date formatted according to the given pattern.
+
+ >>> d = date(2007, 4, 1)
+ >>> format_date(d, locale='en_US')
+ u'Apr 1, 2007'
+ >>> format_date(d, format='full', locale='de_DE')
+ u'Sonntag, 1. April 2007'
+
+ If you don't want to use the locale default formats, you can specify a
+ custom date pattern:
+
+ >>> format_date(d, "EEE, MMM d, ''yy", locale='en')
+ u"Sun, Apr 1, '07"
+
+ :param date: the ``date`` or ``datetime`` object; if `None`, the current
+ date is used
+ :param format: one of "full", "long", "medium", or "short", or a custom
+ date/time pattern
+ :param locale: a `Locale` object or a locale identifier
+ """
+ if date is None:
+ date = date_.today()
+ elif isinstance(date, datetime):
+ date = date.date()
+
+ locale = Locale.parse(locale)
+ if format in ('full', 'long', 'medium', 'short'):
+ format = get_date_format(format, locale=locale)
+ pattern = parse_pattern(format)
+ return pattern.apply(date, locale)
+
+
+def format_datetime(datetime=None, format='medium', tzinfo=None,
+ locale=LC_TIME):
+ r"""Return a date formatted according to the given pattern.
+
+ >>> dt = datetime(2007, 4, 1, 15, 30)
+ >>> format_datetime(dt, locale='en_US')
+ u'Apr 1, 2007, 3:30:00 PM'
+
+ For any pattern requiring the display of the time-zone, the third-party
+ ``pytz`` package is needed to explicitly specify the time-zone:
+
+ >>> format_datetime(dt, 'full', tzinfo=get_timezone('Europe/Paris'),
+ ... locale='fr_FR')
+ u'dimanche 1 avril 2007 \xe0 17:30:00 heure d\u2019\xe9t\xe9 d\u2019Europe centrale'
+ >>> format_datetime(dt, "yyyy.MM.dd G 'at' HH:mm:ss zzz",
+ ... tzinfo=get_timezone('US/Eastern'), locale='en')
+ u'2007.04.01 AD at 11:30:00 EDT'
+
+ :param datetime: the `datetime` object; if `None`, the current date and
+ time is used
+ :param format: one of "full", "long", "medium", or "short", or a custom
+ date/time pattern
+ :param tzinfo: the timezone to apply to the time for display
+ :param locale: a `Locale` object or a locale identifier
+ """
+ if datetime is None:
+ datetime = datetime_.utcnow()
+ elif isinstance(datetime, number_types):
+ datetime = datetime_.utcfromtimestamp(datetime)
+ elif isinstance(datetime, time):
+ datetime = datetime_.combine(date.today(), datetime)
+ if datetime.tzinfo is None:
+ datetime = datetime.replace(tzinfo=UTC)
+ if tzinfo is not None:
+ datetime = datetime.astimezone(get_timezone(tzinfo))
+ if hasattr(tzinfo, 'normalize'): # pytz
+ datetime = tzinfo.normalize(datetime)
+
+ locale = Locale.parse(locale)
+ if format in ('full', 'long', 'medium', 'short'):
+ return get_datetime_format(format, locale=locale) \
+ .replace("'", "") \
+ .replace('{0}', format_time(datetime, format, tzinfo=None,
+ locale=locale)) \
+ .replace('{1}', format_date(datetime, format, locale=locale))
+ else:
+ return parse_pattern(format).apply(datetime, locale)
+
+
+def format_time(time=None, format='medium', tzinfo=None, locale=LC_TIME):
+ r"""Return a time formatted according to the given pattern.
+
+ >>> t = time(15, 30)
+ >>> format_time(t, locale='en_US')
+ u'3:30:00 PM'
+ >>> format_time(t, format='short', locale='de_DE')
+ u'15:30'
+
+ If you don't want to use the locale default formats, you can specify a
+ custom time pattern:
+
+ >>> format_time(t, "hh 'o''clock' a", locale='en')
+ u"03 o'clock PM"
+
+ For any pattern requiring the display of the time-zone a
+ timezone has to be specified explicitly:
+
+ >>> t = datetime(2007, 4, 1, 15, 30)
+ >>> tzinfo = get_timezone('Europe/Paris')
+ >>> t = tzinfo.localize(t)
+ >>> format_time(t, format='full', tzinfo=tzinfo, locale='fr_FR')
+ u'15:30:00 heure d\u2019\xe9t\xe9 d\u2019Europe centrale'
+ >>> format_time(t, "hh 'o''clock' a, zzzz", tzinfo=get_timezone('US/Eastern'),
+ ... locale='en')
+ u"09 o'clock AM, Eastern Daylight Time"
+
+ As that example shows, when this function gets passed a
+ ``datetime.datetime`` value, the actual time in the formatted string is
+ adjusted to the timezone specified by the `tzinfo` parameter. If the
+ ``datetime`` is "naive" (i.e. it has no associated timezone information),
+ it is assumed to be in UTC.
+
+ These timezone calculations are **not** performed if the value is of type
+ ``datetime.time``, as without date information there's no way to determine
+ what a given time would translate to in a different timezone without
+ information about whether daylight savings time is in effect or not. This
+ means that time values are left as-is, and the value of the `tzinfo`
+ parameter is only used to display the timezone name if needed:
+
+ >>> t = time(15, 30)
+ >>> format_time(t, format='full', tzinfo=get_timezone('Europe/Paris'),
+ ... locale='fr_FR')
+ u'15:30:00 heure normale d\u2019Europe centrale'
+ >>> format_time(t, format='full', tzinfo=get_timezone('US/Eastern'),
+ ... locale='en_US')
+ u'3:30:00 PM Eastern Standard Time'
+
+ :param time: the ``time`` or ``datetime`` object; if `None`, the current
+ time in UTC is used
+ :param format: one of "full", "long", "medium", or "short", or a custom
+ date/time pattern
+ :param tzinfo: the time-zone to apply to the time for display
+ :param locale: a `Locale` object or a locale identifier
+ """
+ if time is None:
+ time = datetime.utcnow()
+ elif isinstance(time, number_types):
+ time = datetime.utcfromtimestamp(time)
+ if time.tzinfo is None:
+ time = time.replace(tzinfo=UTC)
+ if isinstance(time, datetime):
+ if tzinfo is not None:
+ time = time.astimezone(tzinfo)
+ if hasattr(tzinfo, 'normalize'): # pytz
+ time = tzinfo.normalize(time)
+ time = time.timetz()
+ elif tzinfo is not None:
+ time = time.replace(tzinfo=tzinfo)
+
+ locale = Locale.parse(locale)
+ if format in ('full', 'long', 'medium', 'short'):
+ format = get_time_format(format, locale=locale)
+ return parse_pattern(format).apply(time, locale)
+
+
+TIMEDELTA_UNITS = (
+ ('year', 3600 * 24 * 365),
+ ('month', 3600 * 24 * 30),
+ ('week', 3600 * 24 * 7),
+ ('day', 3600 * 24),
+ ('hour', 3600),
+ ('minute', 60),
+ ('second', 1)
+)
+
+
+def format_timedelta(delta, granularity='second', threshold=.85,
+ add_direction=False, format='long',
+ locale=LC_TIME):
+ """Return a time delta according to the rules of the given locale.
+
+ >>> format_timedelta(timedelta(weeks=12), locale='en_US')
+ u'3 months'
+ >>> format_timedelta(timedelta(seconds=1), locale='es')
+ u'1 segundo'
+
+ The granularity parameter can be provided to alter the lowest unit
+ presented, which defaults to a second.
+
+ >>> format_timedelta(timedelta(hours=3), granularity='day',
+ ... locale='en_US')
+ u'1 day'
+
+ The threshold parameter can be used to determine at which value the
+ presentation switches to the next higher unit. A higher threshold factor
+ means the presentation will switch later. For example:
+
+ >>> format_timedelta(timedelta(hours=23), threshold=0.9, locale='en_US')
+ u'1 day'
+ >>> format_timedelta(timedelta(hours=23), threshold=1.1, locale='en_US')
+ u'23 hours'
+
+ In addition directional information can be provided that informs
+ the user if the date is in the past or in the future:
+
+ >>> format_timedelta(timedelta(hours=1), add_direction=True, locale='en')
+ u'in 1 hour'
+ >>> format_timedelta(timedelta(hours=-1), add_direction=True, locale='en')
+ u'1 hour ago'
+
+ The format parameter controls how compact or wide the presentation is:
+
+ >>> format_timedelta(timedelta(hours=3), format='short', locale='en')
+ u'3 hr'
+ >>> format_timedelta(timedelta(hours=3), format='narrow', locale='en')
+ u'3h'
+
+ :param delta: a ``timedelta`` object representing the time difference to
+ format, or the delta in seconds as an `int` value
+ :param granularity: determines the smallest unit that should be displayed,
+ the value can be one of "year", "month", "week", "day",
+ "hour", "minute" or "second"
+ :param threshold: factor that determines at which point the presentation
+ switches to the next higher unit
+ :param add_direction: if this flag is set to `True` the return value will
+ include directional information. For instance a
+ positive timedelta will include the information about
+ it being in the future, a negative will be information
+ about the value being in the past.
+ :param format: the format, can be "narrow", "short" or "long". (
+ "medium" is deprecated, currently converted to "long" to
+ maintain compatibility)
+ :param locale: a `Locale` object or a locale identifier
+ """
+ if format not in ('narrow', 'short', 'medium', 'long'):
+ raise TypeError('Format must be one of "narrow", "short" or "long"')
+ if format == 'medium':
+ warnings.warn('"medium" value for format param of format_timedelta'
+ ' is deprecated. Use "long" instead',
+ category=DeprecationWarning)
+ format = 'long'
+ if isinstance(delta, timedelta):
+ seconds = int((delta.days * 86400) + delta.seconds)
+ else:
+ seconds = delta
+ locale = Locale.parse(locale)
+
+ def _iter_patterns(a_unit):
+ if add_direction:
+ unit_rel_patterns = locale._data['date_fields'][a_unit]
+ if seconds >= 0:
+ yield unit_rel_patterns['future']
+ else:
+ yield unit_rel_patterns['past']
+ a_unit = 'duration-' + a_unit
+ yield locale._data['unit_patterns'].get(a_unit + ':' + format)
+ yield locale._data['unit_patterns'].get(a_unit)
+
+ for unit, secs_per_unit in TIMEDELTA_UNITS:
+ value = abs(seconds) / secs_per_unit
+ if value >= threshold or unit == granularity:
+ if unit == granularity and value > 0:
+ value = max(1, value)
+ value = int(round(value))
+ plural_form = locale.plural_form(value)
+ pattern = None
+ for patterns in _iter_patterns(unit):
+ if patterns is not None:
+ pattern = patterns[plural_form]
+ break
+ # This really should not happen
+ if pattern is None:
+ return u''
+ return pattern.replace('{0}', str(value))
+
+ return u''
+
+
+def parse_date(string, locale=LC_TIME):
+ """Parse a date from a string.
+
+ This function uses the date format for the locale as a hint to determine
+ the order in which the date fields appear in the string.
+
+ >>> parse_date('4/1/04', locale='en_US')
+ datetime.date(2004, 4, 1)
+ >>> parse_date('01.04.2004', locale='de_DE')
+ datetime.date(2004, 4, 1)
+
+ :param string: the string containing the date
+ :param locale: a `Locale` object or a locale identifier
+ """
+ # TODO: try ISO format first?
+ format = get_date_format(locale=locale).pattern.lower()
+ year_idx = format.index('y')
+ month_idx = format.index('m')
+ if month_idx < 0:
+ month_idx = format.index('l')
+ day_idx = format.index('d')
+
+ indexes = [(year_idx, 'Y'), (month_idx, 'M'), (day_idx, 'D')]
+ indexes.sort()
+ indexes = dict([(item[1], idx) for idx, item in enumerate(indexes)])
+
+ # FIXME: this currently only supports numbers, but should also support month
+ # names, both in the requested locale, and english
+
+ numbers = re.findall('(\d+)', string)
+ year = numbers[indexes['Y']]
+ if len(year) == 2:
+ year = 2000 + int(year)
+ else:
+ year = int(year)
+ month = int(numbers[indexes['M']])
+ day = int(numbers[indexes['D']])
+ if month > 12:
+ month, day = day, month
+ return date(year, month, day)
+
+
+def parse_time(string, locale=LC_TIME):
+ """Parse a time from a string.
+
+ This function uses the time format for the locale as a hint to determine
+ the order in which the time fields appear in the string.
+
+ >>> parse_time('15:30:00', locale='en_US')
+ datetime.time(15, 30)
+
+ :param string: the string containing the time
+ :param locale: a `Locale` object or a locale identifier
+ :return: the parsed time
+ :rtype: `time`
+ """
+ # TODO: try ISO format first?
+ format = get_time_format(locale=locale).pattern.lower()
+ hour_idx = format.index('h')
+ if hour_idx < 0:
+ hour_idx = format.index('k')
+ min_idx = format.index('m')
+ sec_idx = format.index('s')
+
+ indexes = [(hour_idx, 'H'), (min_idx, 'M'), (sec_idx, 'S')]
+ indexes.sort()
+ indexes = dict([(item[1], idx) for idx, item in enumerate(indexes)])
+
+ # FIXME: support 12 hour clock, and 0-based hour specification
+ # and seconds should be optional, maybe minutes too
+ # oh, and time-zones, of course
+
+ numbers = re.findall('(\d+)', string)
+ hour = int(numbers[indexes['H']])
+ minute = int(numbers[indexes['M']])
+ second = int(numbers[indexes['S']])
+ return time(hour, minute, second)
+
+
+class DateTimePattern(object):
+
+ def __init__(self, pattern, format):
+ self.pattern = pattern
+ self.format = format
+
+ def __repr__(self):
+ return '<%s %r>' % (type(self).__name__, self.pattern)
+
+ def __unicode__(self):
+ return self.pattern
+
+ def __mod__(self, other):
+ if type(other) is not DateTimeFormat:
+ return NotImplemented
+ return self.format % other
+
+ def apply(self, datetime, locale):
+ return self % DateTimeFormat(datetime, locale)
+
+
+class DateTimeFormat(object):
+
+ def __init__(self, value, locale):
+ assert isinstance(value, (date, datetime, time))
+ if isinstance(value, (datetime, time)) and value.tzinfo is None:
+ value = value.replace(tzinfo=UTC)
+ self.value = value
+ self.locale = Locale.parse(locale)
+
+ def __getitem__(self, name):
+ char = name[0]
+ num = len(name)
+ if char == 'G':
+ return self.format_era(char, num)
+ elif char in ('y', 'Y', 'u'):
+ return self.format_year(char, num)
+ elif char in ('Q', 'q'):
+ return self.format_quarter(char, num)
+ elif char in ('M', 'L'):
+ return self.format_month(char, num)
+ elif char in ('w', 'W'):
+ return self.format_week(char, num)
+ elif char == 'd':
+ return self.format(self.value.day, num)
+ elif char == 'D':
+ return self.format_day_of_year(num)
+ elif char == 'F':
+ return self.format_day_of_week_in_month()
+ elif char in ('E', 'e', 'c'):
+ return self.format_weekday(char, num)
+ elif char == 'a':
+ return self.format_period(char)
+ elif char == 'h':
+ if self.value.hour % 12 == 0:
+ return self.format(12, num)
+ else:
+ return self.format(self.value.hour % 12, num)
+ elif char == 'H':
+ return self.format(self.value.hour, num)
+ elif char == 'K':
+ return self.format(self.value.hour % 12, num)
+ elif char == 'k':
+ if self.value.hour == 0:
+ return self.format(24, num)
+ else:
+ return self.format(self.value.hour, num)
+ elif char == 'm':
+ return self.format(self.value.minute, num)
+ elif char == 's':
+ return self.format(self.value.second, num)
+ elif char == 'S':
+ return self.format_frac_seconds(num)
+ elif char == 'A':
+ return self.format_milliseconds_in_day(num)
+ elif char in ('z', 'Z', 'v', 'V'):
+ return self.format_timezone(char, num)
+ else:
+ raise KeyError('Unsupported date/time field %r' % char)
+
+ def format_era(self, char, num):
+ width = {3: 'abbreviated', 4: 'wide', 5: 'narrow'}[max(3, num)]
+ era = int(self.value.year >= 0)
+ return get_era_names(width, self.locale)[era]
+
+ def format_year(self, char, num):
+ value = self.value.year
+ if char.isupper():
+ week = self.get_week_number(self.get_day_of_year())
+ if week == 0:
+ value -= 1
+ year = self.format(value, num)
+ if num == 2:
+ year = year[-2:]
+ return year
+
+ def format_quarter(self, char, num):
+ quarter = (self.value.month - 1) // 3 + 1
+ if num <= 2:
+ return ('%%0%dd' % num) % quarter
+ width = {3: 'abbreviated', 4: 'wide', 5: 'narrow'}[num]
+ context = {'Q': 'format', 'q': 'stand-alone'}[char]
+ return get_quarter_names(width, context, self.locale)[quarter]
+
+ def format_month(self, char, num):
+ if num <= 2:
+ return ('%%0%dd' % num) % self.value.month
+ width = {3: 'abbreviated', 4: 'wide', 5: 'narrow'}[num]
+ context = {'M': 'format', 'L': 'stand-alone'}[char]
+ return get_month_names(width, context, self.locale)[self.value.month]
+
+ def format_week(self, char, num):
+ if char.islower(): # week of year
+ day_of_year = self.get_day_of_year()
+ week = self.get_week_number(day_of_year)
+ if week == 0:
+ date = self.value - timedelta(days=day_of_year)
+ week = self.get_week_number(self.get_day_of_year(date),
+ date.weekday())
+ return self.format(week, num)
+ else: # week of month
+ week = self.get_week_number(self.value.day)
+ if week == 0:
+ date = self.value - timedelta(days=self.value.day)
+ week = self.get_week_number(date.day, date.weekday())
+ return '%d' % week
+
+ def format_weekday(self, char, num):
+ if num < 3:
+ if char.islower():
+ value = 7 - self.locale.first_week_day + self.value.weekday()
+ return self.format(value % 7 + 1, num)
+ num = 3
+ weekday = self.value.weekday()
+ width = {3: 'abbreviated', 4: 'wide', 5: 'narrow'}[num]
+ context = {3: 'format', 4: 'format', 5: 'stand-alone'}[num]
+ return get_day_names(width, context, self.locale)[weekday]
+
+ def format_day_of_year(self, num):
+ return self.format(self.get_day_of_year(), num)
+
+ def format_day_of_week_in_month(self):
+ return '%d' % ((self.value.day - 1) // 7 + 1)
+
+ def format_period(self, char):
+ period = {0: 'am', 1: 'pm'}[int(self.value.hour >= 12)]
+ return get_period_names(locale=self.locale)[period]
+
+ def format_frac_seconds(self, num):
+ value = str(self.value.microsecond)
+ return self.format(round(float('.%s' % value), num) * 10**num, num)
+
+ def format_milliseconds_in_day(self, num):
+ msecs = self.value.microsecond // 1000 + self.value.second * 1000 + \
+ self.value.minute * 60000 + self.value.hour * 3600000
+ return self.format(msecs, num)
+
+ def format_timezone(self, char, num):
+ width = {3: 'short', 4: 'long'}[max(3, num)]
+ if char == 'z':
+ return get_timezone_name(self.value, width, locale=self.locale)
+ elif char == 'Z':
+ return get_timezone_gmt(self.value, width, locale=self.locale)
+ elif char == 'v':
+ return get_timezone_name(self.value.tzinfo, width,
+ locale=self.locale)
+ elif char == 'V':
+ if num == 1:
+ return get_timezone_name(self.value.tzinfo, width,
+ uncommon=True, locale=self.locale)
+ return get_timezone_location(self.value.tzinfo, locale=self.locale)
+
+ def format(self, value, length):
+ return ('%%0%dd' % length) % value
+
+ def get_day_of_year(self, date=None):
+ if date is None:
+ date = self.value
+ return (date - date.replace(month=1, day=1)).days + 1
+
+ def get_week_number(self, day_of_period, day_of_week=None):
+ """Return the number of the week of a day within a period. This may be
+ the week number in a year or the week number in a month.
+
+ Usually this will return a value equal to or greater than 1, but if the
+ first week of the period is so short that it actually counts as the last
+ week of the previous period, this function will return 0.
+
+ >>> format = DateTimeFormat(date(2006, 1, 8), Locale.parse('de_DE'))
+ >>> format.get_week_number(6)
+ 1
+
+ >>> format = DateTimeFormat(date(2006, 1, 8), Locale.parse('en_US'))
+ >>> format.get_week_number(6)
+ 2
+
+ :param day_of_period: the number of the day in the period (usually
+ either the day of month or the day of year)
+ :param day_of_week: the week day; if ommitted, the week day of the
+ current date is assumed
+ """
+ if day_of_week is None:
+ day_of_week = self.value.weekday()
+ first_day = (day_of_week - self.locale.first_week_day -
+ day_of_period + 1) % 7
+ if first_day < 0:
+ first_day += 7
+ week_number = (day_of_period + first_day - 1) // 7
+ if 7 - first_day >= self.locale.min_week_days:
+ week_number += 1
+ return week_number
+
+
+PATTERN_CHARS = {
+ 'G': [1, 2, 3, 4, 5], # era
+ 'y': None, 'Y': None, 'u': None, # year
+ 'Q': [1, 2, 3, 4], 'q': [1, 2, 3, 4], # quarter
+ 'M': [1, 2, 3, 4, 5], 'L': [1, 2, 3, 4, 5], # month
+ 'w': [1, 2], 'W': [1], # week
+ 'd': [1, 2], 'D': [1, 2, 3], 'F': [1], 'g': None, # day
+ 'E': [1, 2, 3, 4, 5], 'e': [1, 2, 3, 4, 5], 'c': [1, 3, 4, 5], # week day
+ 'a': [1], # period
+ 'h': [1, 2], 'H': [1, 2], 'K': [1, 2], 'k': [1, 2], # hour
+ 'm': [1, 2], # minute
+ 's': [1, 2], 'S': None, 'A': None, # second
+ 'z': [1, 2, 3, 4], 'Z': [1, 2, 3, 4], 'v': [1, 4], 'V': [1, 4] # zone
+}
+
+
+def parse_pattern(pattern):
+ """Parse date, time, and datetime format patterns.
+
+ >>> parse_pattern("MMMMd").format
+ u'%(MMMM)s%(d)s'
+ >>> parse_pattern("MMM d, yyyy").format
+ u'%(MMM)s %(d)s, %(yyyy)s'
+
+ Pattern can contain literal strings in single quotes:
+
+ >>> parse_pattern("H:mm' Uhr 'z").format
+ u'%(H)s:%(mm)s Uhr %(z)s'
+
+ An actual single quote can be used by using two adjacent single quote
+ characters:
+
+ >>> parse_pattern("hh' o''clock'").format
+ u"%(hh)s o'clock"
+
+ :param pattern: the formatting pattern to parse
+ """
+ if type(pattern) is DateTimePattern:
+ return pattern
+
+ result = []
+ quotebuf = None
+ charbuf = []
+ fieldchar = ['']
+ fieldnum = [0]
+
+ def append_chars():
+ result.append(''.join(charbuf).replace('%', '%%'))
+ del charbuf[:]
+
+ def append_field():
+ limit = PATTERN_CHARS[fieldchar[0]]
+ if limit and fieldnum[0] not in limit:
+ raise ValueError('Invalid length for field: %r'
+ % (fieldchar[0] * fieldnum[0]))
+ result.append('%%(%s)s' % (fieldchar[0] * fieldnum[0]))
+ fieldchar[0] = ''
+ fieldnum[0] = 0
+
+ for idx, char in enumerate(pattern.replace("''", '\0')):
+ if quotebuf is None:
+ if char == "'": # quote started
+ if fieldchar[0]:
+ append_field()
+ elif charbuf:
+ append_chars()
+ quotebuf = []
+ elif char in PATTERN_CHARS:
+ if charbuf:
+ append_chars()
+ if char == fieldchar[0]:
+ fieldnum[0] += 1
+ else:
+ if fieldchar[0]:
+ append_field()
+ fieldchar[0] = char
+ fieldnum[0] = 1
+ else:
+ if fieldchar[0]:
+ append_field()
+ charbuf.append(char)
+
+ elif quotebuf is not None:
+ if char == "'": # end of quote
+ charbuf.extend(quotebuf)
+ quotebuf = None
+ else: # inside quote
+ quotebuf.append(char)
+
+ if fieldchar[0]:
+ append_field()
+ elif charbuf:
+ append_chars()
+
+ return DateTimePattern(pattern, u''.join(result).replace('\0', "'"))
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/global.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/global.dat
new file mode 100644
index 000000000..f7d04b188
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/global.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/lists.py b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/lists.py
new file mode 100644
index 000000000..6e6fbd192
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/lists.py
@@ -0,0 +1,48 @@
+# -*- coding: utf-8 -*-
+"""
+ babel.lists
+ ~~~~~~~~~~~
+
+ Locale dependent formatting of lists.
+
+ The default locale for the functions in this module is determined by the
+ following environment variables, in that order:
+
+ * ``LC_ALL``, and
+ * ``LANG``
+
+ :copyright: (c) 2015 by the Babel Team.
+ :license: BSD, see LICENSE for more details.
+"""
+
+from babel.core import Locale, default_locale
+
+DEFAULT_LOCALE = default_locale()
+
+
+def format_list(lst, locale=DEFAULT_LOCALE):
+ """ Formats `lst` as a list
+
+ e.g.
+ >>> format_list(['apples', 'oranges', 'pears'], 'en')
+ u'apples, oranges, and pears'
+ >>> format_list(['apples', 'oranges', 'pears'], 'zh')
+ u'apples\u3001oranges\u548cpears'
+
+ :param lst: a sequence of items to format in to a list
+ :param locale: the locale
+ """
+ locale = Locale.parse(locale)
+ if not lst:
+ return ''
+ if len(lst) == 1:
+ return lst[0]
+ if len(lst) == 2:
+ return locale.list_patterns['2'].format(*lst)
+
+ result = locale.list_patterns['start'].format(lst[0], lst[1])
+ for elem in lst[2:-1]:
+ result = locale.list_patterns['middle'].format(result, elem)
+ result = locale.list_patterns['end'].format(result, lst[-1])
+
+ return result
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/af.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/af.dat
new file mode 100644
index 000000000..8f94c94a8
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/af.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/af_NA.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/af_NA.dat
new file mode 100644
index 000000000..5b494c277
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/af_NA.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/af_ZA.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/af_ZA.dat
new file mode 100644
index 000000000..5ff772aed
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/af_ZA.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/agq.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/agq.dat
new file mode 100644
index 000000000..3883d2246
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/agq.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/agq_CM.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/agq_CM.dat
new file mode 100644
index 000000000..47d9b18eb
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/agq_CM.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ak.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ak.dat
new file mode 100644
index 000000000..1e459986a
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ak.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ak_GH.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ak_GH.dat
new file mode 100644
index 000000000..f8cc40563
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ak_GH.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/am.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/am.dat
new file mode 100644
index 000000000..bf6e81a7b
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/am.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/am_ET.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/am_ET.dat
new file mode 100644
index 000000000..5ff772aed
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/am_ET.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar.dat
new file mode 100644
index 000000000..8538c20ef
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_001.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_001.dat
new file mode 100644
index 000000000..11101f63e
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_001.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_AE.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_AE.dat
new file mode 100644
index 000000000..934681657
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_AE.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_BH.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_BH.dat
new file mode 100644
index 000000000..b4ff65c5f
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_BH.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_DJ.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_DJ.dat
new file mode 100644
index 000000000..22deeb6a3
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_DJ.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_DZ.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_DZ.dat
new file mode 100644
index 000000000..21de004ea
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_DZ.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_EG.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_EG.dat
new file mode 100644
index 000000000..bf4b6f007
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_EG.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_EH.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_EH.dat
new file mode 100644
index 000000000..f8cc40563
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_EH.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_ER.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_ER.dat
new file mode 100644
index 000000000..28f2b2d42
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_ER.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_IL.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_IL.dat
new file mode 100644
index 000000000..a3be1956b
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_IL.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_IQ.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_IQ.dat
new file mode 100644
index 000000000..2c10655b0
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_IQ.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_JO.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_JO.dat
new file mode 100644
index 000000000..5475b97b8
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_JO.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_KM.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_KM.dat
new file mode 100644
index 000000000..bc53dc266
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_KM.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_KW.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_KW.dat
new file mode 100644
index 000000000..b4ff65c5f
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_KW.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_LB.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_LB.dat
new file mode 100644
index 000000000..2a963fd86
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_LB.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_LY.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_LY.dat
new file mode 100644
index 000000000..313ca075d
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_LY.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_MA.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_MA.dat
new file mode 100644
index 000000000..50a6ab4da
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_MA.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_MR.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_MR.dat
new file mode 100644
index 000000000..4e2c102fe
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_MR.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_OM.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_OM.dat
new file mode 100644
index 000000000..b4ff65c5f
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_OM.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_PS.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_PS.dat
new file mode 100644
index 000000000..acef72a99
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_PS.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_QA.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_QA.dat
new file mode 100644
index 000000000..b4ff65c5f
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_QA.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_SA.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_SA.dat
new file mode 100644
index 000000000..aafdc5a47
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_SA.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_SD.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_SD.dat
new file mode 100644
index 000000000..b4ff65c5f
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_SD.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_SO.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_SO.dat
new file mode 100644
index 000000000..062104506
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_SO.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_SS.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_SS.dat
new file mode 100644
index 000000000..1fd20132f
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_SS.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_SY.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_SY.dat
new file mode 100644
index 000000000..5475b97b8
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_SY.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_TD.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_TD.dat
new file mode 100644
index 000000000..f8cc40563
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_TD.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_TN.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_TN.dat
new file mode 100644
index 000000000..493b55247
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_TN.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_YE.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_YE.dat
new file mode 100644
index 000000000..aafdc5a47
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ar_YE.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/as.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/as.dat
new file mode 100644
index 000000000..b7faad6e6
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/as.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/as_IN.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/as_IN.dat
new file mode 100644
index 000000000..0e1b08c1f
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/as_IN.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/asa.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/asa.dat
new file mode 100644
index 000000000..358468f85
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/asa.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/asa_TZ.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/asa_TZ.dat
new file mode 100644
index 000000000..f8cc40563
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/asa_TZ.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ast.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ast.dat
new file mode 100644
index 000000000..f7e86d869
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ast.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ast_ES.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ast_ES.dat
new file mode 100644
index 000000000..ba7bcd28b
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ast_ES.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/az.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/az.dat
new file mode 100644
index 000000000..c3650b0df
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/az.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/az_Cyrl.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/az_Cyrl.dat
new file mode 100644
index 000000000..6881df620
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/az_Cyrl.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/az_Cyrl_AZ.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/az_Cyrl_AZ.dat
new file mode 100644
index 000000000..47d9b18eb
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/az_Cyrl_AZ.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/az_Latn.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/az_Latn.dat
new file mode 100644
index 000000000..4ef8ab9f5
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/az_Latn.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/az_Latn_AZ.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/az_Latn_AZ.dat
new file mode 100644
index 000000000..47d9b18eb
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/az_Latn_AZ.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/bas.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/bas.dat
new file mode 100644
index 000000000..ce32523f3
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/bas.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/bas_CM.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/bas_CM.dat
new file mode 100644
index 000000000..47d9b18eb
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/bas_CM.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/be.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/be.dat
new file mode 100644
index 000000000..f59d9fbe2
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/be.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/be_BY.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/be_BY.dat
new file mode 100644
index 000000000..47d9b18eb
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/be_BY.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/bem.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/bem.dat
new file mode 100644
index 000000000..d8cba7166
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/bem.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/bem_ZM.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/bem_ZM.dat
new file mode 100644
index 000000000..f8cc40563
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/bem_ZM.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/bez.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/bez.dat
new file mode 100644
index 000000000..b14cb9bcb
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/bez.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/bez_TZ.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/bez_TZ.dat
new file mode 100644
index 000000000..f8cc40563
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/bez_TZ.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/bg.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/bg.dat
new file mode 100644
index 000000000..e41175eab
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/bg.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/bg_BG.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/bg_BG.dat
new file mode 100644
index 000000000..ba7bcd28b
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/bg_BG.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/bm.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/bm.dat
new file mode 100644
index 000000000..b81347f8a
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/bm.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/bm_ML.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/bm_ML.dat
new file mode 100644
index 000000000..f8cc40563
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/bm_ML.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/bn.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/bn.dat
new file mode 100644
index 000000000..db08c2cc8
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/bn.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/bn_BD.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/bn_BD.dat
new file mode 100644
index 000000000..629c9562f
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/bn_BD.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/bn_IN.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/bn_IN.dat
new file mode 100644
index 000000000..0e1b08c1f
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/bn_IN.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/bo.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/bo.dat
new file mode 100644
index 000000000..515ad9fb6
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/bo.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/bo_CN.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/bo_CN.dat
new file mode 100644
index 000000000..5ff772aed
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/bo_CN.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/bo_IN.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/bo_IN.dat
new file mode 100644
index 000000000..29f12429d
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/bo_IN.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/br.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/br.dat
new file mode 100644
index 000000000..a40b59091
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/br.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/br_FR.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/br_FR.dat
new file mode 100644
index 000000000..ba7bcd28b
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/br_FR.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/brx.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/brx.dat
new file mode 100644
index 000000000..103792480
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/brx.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/brx_IN.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/brx_IN.dat
new file mode 100644
index 000000000..0e1b08c1f
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/brx_IN.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/bs.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/bs.dat
new file mode 100644
index 000000000..9af971962
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/bs.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/bs_Cyrl.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/bs_Cyrl.dat
new file mode 100644
index 000000000..c0e7b8197
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/bs_Cyrl.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/bs_Cyrl_BA.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/bs_Cyrl_BA.dat
new file mode 100644
index 000000000..47d9b18eb
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/bs_Cyrl_BA.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/bs_Latn.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/bs_Latn.dat
new file mode 100644
index 000000000..9580829fc
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/bs_Latn.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/bs_Latn_BA.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/bs_Latn_BA.dat
new file mode 100644
index 000000000..47d9b18eb
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/bs_Latn_BA.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ca.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ca.dat
new file mode 100644
index 000000000..3f950b8b9
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ca.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ca_AD.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ca_AD.dat
new file mode 100644
index 000000000..ba7bcd28b
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ca_AD.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ca_ES.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ca_ES.dat
new file mode 100644
index 000000000..ba7bcd28b
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ca_ES.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ca_ES_VALENCIA.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ca_ES_VALENCIA.dat
new file mode 100644
index 000000000..ea2c9b8b2
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ca_ES_VALENCIA.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ca_FR.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ca_FR.dat
new file mode 100644
index 000000000..768f75d2d
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ca_FR.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ca_IT.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ca_IT.dat
new file mode 100644
index 000000000..ba7bcd28b
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ca_IT.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ce.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ce.dat
new file mode 100644
index 000000000..ba9b67894
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ce.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ce_RU.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ce_RU.dat
new file mode 100644
index 000000000..47d9b18eb
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ce_RU.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/cgg.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/cgg.dat
new file mode 100644
index 000000000..a0ddf2774
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/cgg.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/cgg_UG.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/cgg_UG.dat
new file mode 100644
index 000000000..f8cc40563
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/cgg_UG.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/chr.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/chr.dat
new file mode 100644
index 000000000..42eea95b4
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/chr.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/chr_US.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/chr_US.dat
new file mode 100644
index 000000000..fad62059a
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/chr_US.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ckb.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ckb.dat
new file mode 100644
index 000000000..ea03942a8
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ckb.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ckb_IQ.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ckb_IQ.dat
new file mode 100644
index 000000000..b4ff65c5f
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ckb_IQ.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ckb_IR.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ckb_IR.dat
new file mode 100644
index 000000000..f3d9012d2
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ckb_IR.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/cs.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/cs.dat
new file mode 100644
index 000000000..652c2bfc0
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/cs.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/cs_CZ.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/cs_CZ.dat
new file mode 100644
index 000000000..ba7bcd28b
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/cs_CZ.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/cu.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/cu.dat
new file mode 100644
index 000000000..a18893ab5
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/cu.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/cu_RU.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/cu_RU.dat
new file mode 100644
index 000000000..47d9b18eb
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/cu_RU.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/cy.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/cy.dat
new file mode 100644
index 000000000..c33e22e22
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/cy.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/cy_GB.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/cy_GB.dat
new file mode 100644
index 000000000..5b92b2d82
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/cy_GB.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/da.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/da.dat
new file mode 100644
index 000000000..5eae7a46e
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/da.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/da_DK.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/da_DK.dat
new file mode 100644
index 000000000..ba7bcd28b
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/da_DK.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/da_GL.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/da_GL.dat
new file mode 100644
index 000000000..d863327fd
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/da_GL.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/dav.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/dav.dat
new file mode 100644
index 000000000..03af9e670
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/dav.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/dav_KE.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/dav_KE.dat
new file mode 100644
index 000000000..5ff772aed
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/dav_KE.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/de.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/de.dat
new file mode 100644
index 000000000..b5cca1968
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/de.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/de_AT.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/de_AT.dat
new file mode 100644
index 000000000..5e909a8c9
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/de_AT.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/de_BE.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/de_BE.dat
new file mode 100644
index 000000000..ba7bcd28b
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/de_BE.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/de_CH.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/de_CH.dat
new file mode 100644
index 000000000..6ee707929
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/de_CH.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/de_DE.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/de_DE.dat
new file mode 100644
index 000000000..ba7bcd28b
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/de_DE.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/de_LI.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/de_LI.dat
new file mode 100644
index 000000000..31bc5886e
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/de_LI.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/de_LU.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/de_LU.dat
new file mode 100644
index 000000000..893df0869
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/de_LU.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/dje.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/dje.dat
new file mode 100644
index 000000000..c016f44b8
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/dje.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/dje_NE.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/dje_NE.dat
new file mode 100644
index 000000000..f8cc40563
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/dje_NE.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/dsb.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/dsb.dat
new file mode 100644
index 000000000..7baf0e5f6
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/dsb.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/dsb_DE.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/dsb_DE.dat
new file mode 100644
index 000000000..ba7bcd28b
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/dsb_DE.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/dua.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/dua.dat
new file mode 100644
index 000000000..1ff26b2b3
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/dua.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/dua_CM.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/dua_CM.dat
new file mode 100644
index 000000000..47d9b18eb
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/dua_CM.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/dyo.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/dyo.dat
new file mode 100644
index 000000000..879844982
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/dyo.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/dyo_SN.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/dyo_SN.dat
new file mode 100644
index 000000000..f8cc40563
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/dyo_SN.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/dz.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/dz.dat
new file mode 100644
index 000000000..c725e5375
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/dz.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/dz_BT.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/dz_BT.dat
new file mode 100644
index 000000000..5ff772aed
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/dz_BT.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ebu.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ebu.dat
new file mode 100644
index 000000000..9fe4a9a70
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ebu.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ebu_KE.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ebu_KE.dat
new file mode 100644
index 000000000..5ff772aed
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ebu_KE.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ee.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ee.dat
new file mode 100644
index 000000000..c34468795
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ee.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ee_GH.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ee_GH.dat
new file mode 100644
index 000000000..f8cc40563
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ee_GH.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ee_TG.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ee_TG.dat
new file mode 100644
index 000000000..bc53dc266
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ee_TG.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/el.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/el.dat
new file mode 100644
index 000000000..fb8d11ddb
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/el.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/el_CY.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/el_CY.dat
new file mode 100644
index 000000000..47d9b18eb
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/el_CY.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/el_GR.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/el_GR.dat
new file mode 100644
index 000000000..ba7bcd28b
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/el_GR.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en.dat
new file mode 100644
index 000000000..a75e4b364
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_001.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_001.dat
new file mode 100644
index 000000000..6746efa7a
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_001.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_150.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_150.dat
new file mode 100644
index 000000000..4653d9767
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_150.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_AG.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_AG.dat
new file mode 100644
index 000000000..e9ed3ff31
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_AG.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_AI.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_AI.dat
new file mode 100644
index 000000000..3cacba8b6
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_AI.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_AS.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_AS.dat
new file mode 100644
index 000000000..5ff772aed
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_AS.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_AT.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_AT.dat
new file mode 100644
index 000000000..c23bc4534
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_AT.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_AU.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_AU.dat
new file mode 100644
index 000000000..7cc936140
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_AU.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_BB.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_BB.dat
new file mode 100644
index 000000000..cb74fbb44
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_BB.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_BE.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_BE.dat
new file mode 100644
index 000000000..b5b003fc7
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_BE.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_BI.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_BI.dat
new file mode 100644
index 000000000..958fbed55
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_BI.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_BM.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_BM.dat
new file mode 100644
index 000000000..4d9509981
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_BM.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_BS.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_BS.dat
new file mode 100644
index 000000000..74c0ecbcf
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_BS.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_BW.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_BW.dat
new file mode 100644
index 000000000..42a0d634d
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_BW.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_BZ.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_BZ.dat
new file mode 100644
index 000000000..538f50f87
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_BZ.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_CA.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_CA.dat
new file mode 100644
index 000000000..800ce9098
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_CA.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_CC.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_CC.dat
new file mode 100644
index 000000000..2f7832286
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_CC.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_CH.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_CH.dat
new file mode 100644
index 000000000..0fd8f9de1
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_CH.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_CK.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_CK.dat
new file mode 100644
index 000000000..e6c088262
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_CK.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_CM.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_CM.dat
new file mode 100644
index 000000000..be2523b38
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_CM.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_CX.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_CX.dat
new file mode 100644
index 000000000..2f7832286
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_CX.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_CY.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_CY.dat
new file mode 100644
index 000000000..d7ce8a2f0
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_CY.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_DE.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_DE.dat
new file mode 100644
index 000000000..b4fd4afc5
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_DE.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_DG.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_DG.dat
new file mode 100644
index 000000000..bc53dc266
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_DG.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_DK.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_DK.dat
new file mode 100644
index 000000000..64652d42b
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_DK.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_DM.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_DM.dat
new file mode 100644
index 000000000..e9ed3ff31
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_DM.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_ER.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_ER.dat
new file mode 100644
index 000000000..212e67dcc
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_ER.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_FI.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_FI.dat
new file mode 100644
index 000000000..393e2969f
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_FI.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_FJ.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_FJ.dat
new file mode 100644
index 000000000..de8fca542
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_FJ.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_FK.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_FK.dat
new file mode 100644
index 000000000..a67ec2ef5
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_FK.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_FM.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_FM.dat
new file mode 100644
index 000000000..f8cc40563
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_FM.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_GB.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_GB.dat
new file mode 100644
index 000000000..0c1a442b6
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_GB.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_GD.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_GD.dat
new file mode 100644
index 000000000..e0d43cadb
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_GD.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_GG.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_GG.dat
new file mode 100644
index 000000000..ec89c489d
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_GG.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_GH.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_GH.dat
new file mode 100644
index 000000000..2a2b20a05
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_GH.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_GI.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_GI.dat
new file mode 100644
index 000000000..96f2cb816
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_GI.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_GM.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_GM.dat
new file mode 100644
index 000000000..9d9303096
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_GM.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_GU.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_GU.dat
new file mode 100644
index 000000000..1c09bea9e
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_GU.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_GY.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_GY.dat
new file mode 100644
index 000000000..432a3877d
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_GY.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_HK.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_HK.dat
new file mode 100644
index 000000000..93b338b6d
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_HK.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_IE.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_IE.dat
new file mode 100644
index 000000000..b070e6a4c
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_IE.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_IL.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_IL.dat
new file mode 100644
index 000000000..dd1ad81c8
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_IL.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_IM.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_IM.dat
new file mode 100644
index 000000000..ec89c489d
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_IM.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_IN.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_IN.dat
new file mode 100644
index 000000000..c020c63c2
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_IN.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_IO.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_IO.dat
new file mode 100644
index 000000000..bc53dc266
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_IO.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_JE.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_JE.dat
new file mode 100644
index 000000000..ec89c489d
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_JE.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_JM.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_JM.dat
new file mode 100644
index 000000000..4025f339b
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_JM.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_KE.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_KE.dat
new file mode 100644
index 000000000..317368974
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_KE.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_KI.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_KI.dat
new file mode 100644
index 000000000..f502d287a
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_KI.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_KN.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_KN.dat
new file mode 100644
index 000000000..e0d43cadb
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_KN.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_KY.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_KY.dat
new file mode 100644
index 000000000..be8829e9c
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_KY.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_LC.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_LC.dat
new file mode 100644
index 000000000..e0d43cadb
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_LC.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_LR.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_LR.dat
new file mode 100644
index 000000000..46d0cc1ff
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_LR.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_LS.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_LS.dat
new file mode 100644
index 000000000..68f95f206
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_LS.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_MG.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_MG.dat
new file mode 100644
index 000000000..494d0357e
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_MG.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_MH.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_MH.dat
new file mode 100644
index 000000000..2f75edf7c
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_MH.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_MO.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_MO.dat
new file mode 100644
index 000000000..c27b9220d
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_MO.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_MP.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_MP.dat
new file mode 100644
index 000000000..6237db2c1
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_MP.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_MS.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_MS.dat
new file mode 100644
index 000000000..e305bbec7
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_MS.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_MT.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_MT.dat
new file mode 100644
index 000000000..1dc091a63
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_MT.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_MU.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_MU.dat
new file mode 100644
index 000000000..58a8988a0
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_MU.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_MW.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_MW.dat
new file mode 100644
index 000000000..58beaeefd
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_MW.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_MY.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_MY.dat
new file mode 100644
index 000000000..a12df861a
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_MY.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_NA.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_NA.dat
new file mode 100644
index 000000000..e01fe1c90
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_NA.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_NF.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_NF.dat
new file mode 100644
index 000000000..2f7832286
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_NF.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_NG.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_NG.dat
new file mode 100644
index 000000000..414242b2d
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_NG.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_NL.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_NL.dat
new file mode 100644
index 000000000..b819fffbd
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_NL.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_NR.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_NR.dat
new file mode 100644
index 000000000..2f7832286
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_NR.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_NU.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_NU.dat
new file mode 100644
index 000000000..e6c088262
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_NU.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_NZ.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_NZ.dat
new file mode 100644
index 000000000..a3af9139e
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_NZ.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_PG.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_PG.dat
new file mode 100644
index 000000000..f9ad3cba5
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_PG.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_PH.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_PH.dat
new file mode 100644
index 000000000..cea1da406
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_PH.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_PK.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_PK.dat
new file mode 100644
index 000000000..902d57319
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_PK.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_PN.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_PN.dat
new file mode 100644
index 000000000..e6c088262
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_PN.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_PR.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_PR.dat
new file mode 100644
index 000000000..5ff772aed
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_PR.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_PW.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_PW.dat
new file mode 100644
index 000000000..9649849af
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_PW.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_RW.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_RW.dat
new file mode 100644
index 000000000..a6d6faf00
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_RW.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_SB.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_SB.dat
new file mode 100644
index 000000000..fdf1188b4
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_SB.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_SC.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_SC.dat
new file mode 100644
index 000000000..f5267f8b6
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_SC.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_SD.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_SD.dat
new file mode 100644
index 000000000..2910ba070
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_SD.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_SE.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_SE.dat
new file mode 100644
index 000000000..3bcb0a80c
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_SE.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_SG.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_SG.dat
new file mode 100644
index 000000000..cc67aeac2
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_SG.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_SH.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_SH.dat
new file mode 100644
index 000000000..205f0dfb5
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_SH.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_SI.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_SI.dat
new file mode 100644
index 000000000..333e060f4
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_SI.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_SL.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_SL.dat
new file mode 100644
index 000000000..a7472c48a
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_SL.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_SS.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_SS.dat
new file mode 100644
index 000000000..145e1bfce
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_SS.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_SX.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_SX.dat
new file mode 100644
index 000000000..75b14d132
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_SX.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_SZ.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_SZ.dat
new file mode 100644
index 000000000..a7a7df668
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_SZ.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_TC.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_TC.dat
new file mode 100644
index 000000000..f8cc40563
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_TC.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_TK.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_TK.dat
new file mode 100644
index 000000000..e6c088262
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_TK.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_TO.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_TO.dat
new file mode 100644
index 000000000..9fa156d23
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_TO.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_TT.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_TT.dat
new file mode 100644
index 000000000..6d2de54ab
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_TT.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_TV.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_TV.dat
new file mode 100644
index 000000000..2f7832286
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_TV.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_TZ.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_TZ.dat
new file mode 100644
index 000000000..d5e9f43b8
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_TZ.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_UG.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_UG.dat
new file mode 100644
index 000000000..49dd28f44
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_UG.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_UM.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_UM.dat
new file mode 100644
index 000000000..fad62059a
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_UM.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_US.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_US.dat
new file mode 100644
index 000000000..fad62059a
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_US.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_US_POSIX.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_US_POSIX.dat
new file mode 100644
index 000000000..4aa4446b8
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_US_POSIX.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_VC.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_VC.dat
new file mode 100644
index 000000000..e0d43cadb
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_VC.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_VG.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_VG.dat
new file mode 100644
index 000000000..f8cc40563
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_VG.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_VI.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_VI.dat
new file mode 100644
index 000000000..fad62059a
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_VI.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_VU.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_VU.dat
new file mode 100644
index 000000000..2c08a4d39
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_VU.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_WS.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_WS.dat
new file mode 100644
index 000000000..dff80d4b2
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_WS.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_ZA.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_ZA.dat
new file mode 100644
index 000000000..be7d80e1e
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_ZA.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_ZM.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_ZM.dat
new file mode 100644
index 000000000..37b4dfc34
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_ZM.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_ZW.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_ZW.dat
new file mode 100644
index 000000000..f979b4c12
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/en_ZW.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/eo.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/eo.dat
new file mode 100644
index 000000000..f8e44d6b9
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/eo.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/eo_001.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/eo_001.dat
new file mode 100644
index 000000000..3259b7a85
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/eo_001.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es.dat
new file mode 100644
index 000000000..bf2406a5e
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es_419.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es_419.dat
new file mode 100644
index 000000000..1ce382446
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es_419.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es_AR.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es_AR.dat
new file mode 100644
index 000000000..83996c278
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es_AR.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es_BO.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es_BO.dat
new file mode 100644
index 000000000..1686f4c59
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es_BO.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es_CL.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es_CL.dat
new file mode 100644
index 000000000..6c3bb322c
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es_CL.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es_CO.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es_CO.dat
new file mode 100644
index 000000000..c6fb2a967
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es_CO.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es_CR.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es_CR.dat
new file mode 100644
index 000000000..3418cc080
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es_CR.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es_CU.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es_CU.dat
new file mode 100644
index 000000000..f814faddb
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es_CU.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es_DO.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es_DO.dat
new file mode 100644
index 000000000..fad201ec9
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es_DO.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es_EA.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es_EA.dat
new file mode 100644
index 000000000..f8cc40563
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es_EA.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es_EC.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es_EC.dat
new file mode 100644
index 000000000..4067ad386
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es_EC.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es_ES.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es_ES.dat
new file mode 100644
index 000000000..ba7bcd28b
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es_ES.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es_GQ.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es_GQ.dat
new file mode 100644
index 000000000..741cea862
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es_GQ.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es_GT.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es_GT.dat
new file mode 100644
index 000000000..a4280856f
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es_GT.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es_HN.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es_HN.dat
new file mode 100644
index 000000000..9b85023dc
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es_HN.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es_IC.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es_IC.dat
new file mode 100644
index 000000000..f8cc40563
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es_IC.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es_MX.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es_MX.dat
new file mode 100644
index 000000000..2f1c5ee74
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es_MX.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es_NI.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es_NI.dat
new file mode 100644
index 000000000..1bd86ef3f
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es_NI.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es_PA.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es_PA.dat
new file mode 100644
index 000000000..de345f16b
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es_PA.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es_PE.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es_PE.dat
new file mode 100644
index 000000000..dfddeec29
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es_PE.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es_PH.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es_PH.dat
new file mode 100644
index 000000000..76de770bb
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es_PH.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es_PR.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es_PR.dat
new file mode 100644
index 000000000..69f930df9
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es_PR.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es_PY.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es_PY.dat
new file mode 100644
index 000000000..778e0c6d6
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es_PY.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es_SV.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es_SV.dat
new file mode 100644
index 000000000..87e96c46f
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es_SV.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es_US.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es_US.dat
new file mode 100644
index 000000000..c211757af
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es_US.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es_UY.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es_UY.dat
new file mode 100644
index 000000000..8a90023fa
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es_UY.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es_VE.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es_VE.dat
new file mode 100644
index 000000000..19a7898f8
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/es_VE.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/et.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/et.dat
new file mode 100644
index 000000000..5f8aa4367
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/et.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/et_EE.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/et_EE.dat
new file mode 100644
index 000000000..ba7bcd28b
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/et_EE.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/eu.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/eu.dat
new file mode 100644
index 000000000..6c605e06f
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/eu.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/eu_ES.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/eu_ES.dat
new file mode 100644
index 000000000..ba7bcd28b
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/eu_ES.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ewo.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ewo.dat
new file mode 100644
index 000000000..81cbfad76
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ewo.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ewo_CM.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ewo_CM.dat
new file mode 100644
index 000000000..47d9b18eb
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ewo_CM.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fa.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fa.dat
new file mode 100644
index 000000000..0d3f8f2df
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fa.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fa_AF.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fa_AF.dat
new file mode 100644
index 000000000..9403a5cc9
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fa_AF.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fa_IR.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fa_IR.dat
new file mode 100644
index 000000000..a15e80761
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fa_IR.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ff.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ff.dat
new file mode 100644
index 000000000..c7c9d2bf6
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ff.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ff_CM.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ff_CM.dat
new file mode 100644
index 000000000..47d9b18eb
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ff_CM.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ff_GN.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ff_GN.dat
new file mode 100644
index 000000000..a8c91d823
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ff_GN.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ff_MR.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ff_MR.dat
new file mode 100644
index 000000000..d233be1a9
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ff_MR.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ff_SN.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ff_SN.dat
new file mode 100644
index 000000000..f8cc40563
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ff_SN.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fi.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fi.dat
new file mode 100644
index 000000000..9974bbfb6
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fi.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fi_FI.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fi_FI.dat
new file mode 100644
index 000000000..ba7bcd28b
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fi_FI.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fil.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fil.dat
new file mode 100644
index 000000000..f32977626
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fil.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fil_PH.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fil_PH.dat
new file mode 100644
index 000000000..5ff772aed
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fil_PH.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fo.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fo.dat
new file mode 100644
index 000000000..cd26ec4c6
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fo.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fo_DK.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fo_DK.dat
new file mode 100644
index 000000000..4ef8cce2e
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fo_DK.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fo_FO.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fo_FO.dat
new file mode 100644
index 000000000..ba7bcd28b
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fo_FO.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr.dat
new file mode 100644
index 000000000..c279d9f47
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_BE.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_BE.dat
new file mode 100644
index 000000000..fd9a8e199
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_BE.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_BF.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_BF.dat
new file mode 100644
index 000000000..f8cc40563
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_BF.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_BI.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_BI.dat
new file mode 100644
index 000000000..958fbed55
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_BI.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_BJ.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_BJ.dat
new file mode 100644
index 000000000..f8cc40563
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_BJ.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_BL.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_BL.dat
new file mode 100644
index 000000000..f8cc40563
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_BL.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_CA.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_CA.dat
new file mode 100644
index 000000000..7e8a58ac1
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_CA.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_CD.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_CD.dat
new file mode 100644
index 000000000..6e7476dcf
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_CD.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_CF.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_CF.dat
new file mode 100644
index 000000000..f8cc40563
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_CF.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_CG.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_CG.dat
new file mode 100644
index 000000000..f8cc40563
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_CG.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_CH.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_CH.dat
new file mode 100644
index 000000000..c9bf4f5d5
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_CH.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_CI.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_CI.dat
new file mode 100644
index 000000000..f8cc40563
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_CI.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_CM.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_CM.dat
new file mode 100644
index 000000000..47d9b18eb
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_CM.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_DJ.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_DJ.dat
new file mode 100644
index 000000000..0041562b6
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_DJ.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_DZ.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_DZ.dat
new file mode 100644
index 000000000..5e1f09b55
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_DZ.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_FR.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_FR.dat
new file mode 100644
index 000000000..ba7bcd28b
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_FR.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_GA.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_GA.dat
new file mode 100644
index 000000000..f8cc40563
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_GA.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_GF.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_GF.dat
new file mode 100644
index 000000000..7d2cc613d
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_GF.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_GN.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_GN.dat
new file mode 100644
index 000000000..a8c91d823
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_GN.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_GP.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_GP.dat
new file mode 100644
index 000000000..ba7bcd28b
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_GP.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_GQ.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_GQ.dat
new file mode 100644
index 000000000..f8cc40563
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_GQ.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_HT.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_HT.dat
new file mode 100644
index 000000000..333cf37dd
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_HT.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_KM.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_KM.dat
new file mode 100644
index 000000000..4a9af2a5c
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_KM.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_LU.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_LU.dat
new file mode 100644
index 000000000..2489fa13e
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_LU.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_MA.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_MA.dat
new file mode 100644
index 000000000..dccfcb6c1
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_MA.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_MC.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_MC.dat
new file mode 100644
index 000000000..ba7bcd28b
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_MC.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_MF.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_MF.dat
new file mode 100644
index 000000000..f8cc40563
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_MF.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_MG.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_MG.dat
new file mode 100644
index 000000000..30e57816d
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_MG.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_ML.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_ML.dat
new file mode 100644
index 000000000..f8cc40563
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_ML.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_MQ.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_MQ.dat
new file mode 100644
index 000000000..ba7bcd28b
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_MQ.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_MR.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_MR.dat
new file mode 100644
index 000000000..d233be1a9
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_MR.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_MU.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_MU.dat
new file mode 100644
index 000000000..6c7380cf0
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_MU.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_NC.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_NC.dat
new file mode 100644
index 000000000..f8cc40563
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_NC.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_NE.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_NE.dat
new file mode 100644
index 000000000..f8cc40563
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_NE.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_PF.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_PF.dat
new file mode 100644
index 000000000..f8cc40563
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_PF.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_PM.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_PM.dat
new file mode 100644
index 000000000..f8cc40563
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_PM.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_RE.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_RE.dat
new file mode 100644
index 000000000..ba7bcd28b
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_RE.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_RW.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_RW.dat
new file mode 100644
index 000000000..48d60eb8e
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_RW.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_SC.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_SC.dat
new file mode 100644
index 000000000..af267e092
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_SC.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_SN.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_SN.dat
new file mode 100644
index 000000000..f8cc40563
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_SN.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_SY.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_SY.dat
new file mode 100644
index 000000000..eda7c7932
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_SY.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_TD.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_TD.dat
new file mode 100644
index 000000000..6434f7f2c
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_TD.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_TG.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_TG.dat
new file mode 100644
index 000000000..f8cc40563
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_TG.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_TN.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_TN.dat
new file mode 100644
index 000000000..d17d2f586
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_TN.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_VU.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_VU.dat
new file mode 100644
index 000000000..d80c08aec
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_VU.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_WF.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_WF.dat
new file mode 100644
index 000000000..f8cc40563
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_WF.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_YT.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_YT.dat
new file mode 100644
index 000000000..f8cc40563
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fr_YT.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fur.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fur.dat
new file mode 100644
index 000000000..ef3ba5d78
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fur.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fur_IT.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fur_IT.dat
new file mode 100644
index 000000000..ba7bcd28b
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fur_IT.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fy.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fy.dat
new file mode 100644
index 000000000..4dc1c0841
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fy.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fy_NL.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fy_NL.dat
new file mode 100644
index 000000000..ba7bcd28b
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/fy_NL.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ga.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ga.dat
new file mode 100644
index 000000000..c4809bfc2
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ga.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ga_IE.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ga_IE.dat
new file mode 100644
index 000000000..5b92b2d82
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ga_IE.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/gd.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/gd.dat
new file mode 100644
index 000000000..626eaa4d7
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/gd.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/gd_GB.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/gd_GB.dat
new file mode 100644
index 000000000..5b92b2d82
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/gd_GB.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/gl.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/gl.dat
new file mode 100644
index 000000000..9510dc7de
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/gl.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/gl_ES.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/gl_ES.dat
new file mode 100644
index 000000000..ba7bcd28b
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/gl_ES.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/gsw.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/gsw.dat
new file mode 100644
index 000000000..1af896556
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/gsw.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/gsw_CH.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/gsw_CH.dat
new file mode 100644
index 000000000..ba7bcd28b
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/gsw_CH.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/gsw_FR.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/gsw_FR.dat
new file mode 100644
index 000000000..ba7bcd28b
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/gsw_FR.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/gsw_LI.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/gsw_LI.dat
new file mode 100644
index 000000000..ba7bcd28b
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/gsw_LI.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/gu.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/gu.dat
new file mode 100644
index 000000000..81854b88d
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/gu.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/gu_IN.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/gu_IN.dat
new file mode 100644
index 000000000..0e1b08c1f
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/gu_IN.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/guz.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/guz.dat
new file mode 100644
index 000000000..208e1a5af
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/guz.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/guz_KE.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/guz_KE.dat
new file mode 100644
index 000000000..5ff772aed
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/guz_KE.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/gv.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/gv.dat
new file mode 100644
index 000000000..ab6f77d9f
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/gv.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/gv_IM.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/gv_IM.dat
new file mode 100644
index 000000000..7ffd21065
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/gv_IM.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ha.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ha.dat
new file mode 100644
index 000000000..91beb797e
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ha.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ha_GH.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ha_GH.dat
new file mode 100644
index 000000000..1b762d0f7
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ha_GH.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ha_NE.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ha_NE.dat
new file mode 100644
index 000000000..bc53dc266
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ha_NE.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ha_NG.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ha_NG.dat
new file mode 100644
index 000000000..f8cc40563
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ha_NG.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/haw.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/haw.dat
new file mode 100644
index 000000000..8ce05740a
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/haw.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/haw_US.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/haw_US.dat
new file mode 100644
index 000000000..fad62059a
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/haw_US.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/he.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/he.dat
new file mode 100644
index 000000000..4c8be7935
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/he.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/he_IL.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/he_IL.dat
new file mode 100644
index 000000000..aafdc5a47
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/he_IL.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/hi.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/hi.dat
new file mode 100644
index 000000000..e41cdb387
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/hi.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/hi_IN.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/hi_IN.dat
new file mode 100644
index 000000000..0e1b08c1f
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/hi_IN.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/hr.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/hr.dat
new file mode 100644
index 000000000..d7c65bb8f
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/hr.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/hr_BA.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/hr_BA.dat
new file mode 100644
index 000000000..d1f5490a8
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/hr_BA.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/hr_HR.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/hr_HR.dat
new file mode 100644
index 000000000..47d9b18eb
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/hr_HR.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/hsb.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/hsb.dat
new file mode 100644
index 000000000..7e86f91d1
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/hsb.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/hsb_DE.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/hsb_DE.dat
new file mode 100644
index 000000000..ba7bcd28b
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/hsb_DE.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/hu.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/hu.dat
new file mode 100644
index 000000000..7d1925812
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/hu.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/hu_HU.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/hu_HU.dat
new file mode 100644
index 000000000..ba7bcd28b
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/hu_HU.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/hy.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/hy.dat
new file mode 100644
index 000000000..9cb325fb3
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/hy.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/hy_AM.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/hy_AM.dat
new file mode 100644
index 000000000..47d9b18eb
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/hy_AM.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/id.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/id.dat
new file mode 100644
index 000000000..329247dc1
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/id.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/id_ID.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/id_ID.dat
new file mode 100644
index 000000000..5ff772aed
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/id_ID.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ig.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ig.dat
new file mode 100644
index 000000000..3fb998505
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ig.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ig_NG.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ig_NG.dat
new file mode 100644
index 000000000..f8cc40563
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ig_NG.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ii.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ii.dat
new file mode 100644
index 000000000..6bdb78fbb
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ii.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ii_CN.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ii_CN.dat
new file mode 100644
index 000000000..5ff772aed
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ii_CN.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/is.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/is.dat
new file mode 100644
index 000000000..b54f8189e
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/is.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/is_IS.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/is_IS.dat
new file mode 100644
index 000000000..ba7bcd28b
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/is_IS.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/it.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/it.dat
new file mode 100644
index 000000000..6baed8ae6
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/it.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/it_CH.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/it_CH.dat
new file mode 100644
index 000000000..f18db81b5
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/it_CH.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/it_IT.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/it_IT.dat
new file mode 100644
index 000000000..ba7bcd28b
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/it_IT.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/it_SM.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/it_SM.dat
new file mode 100644
index 000000000..ba7bcd28b
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/it_SM.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ja.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ja.dat
new file mode 100644
index 000000000..89b7ccfed
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ja.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ja_JP.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ja_JP.dat
new file mode 100644
index 000000000..5ff772aed
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ja_JP.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/jgo.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/jgo.dat
new file mode 100644
index 000000000..bd92d7e69
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/jgo.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/jgo_CM.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/jgo_CM.dat
new file mode 100644
index 000000000..47d9b18eb
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/jgo_CM.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/jmc.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/jmc.dat
new file mode 100644
index 000000000..c07215950
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/jmc.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/jmc_TZ.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/jmc_TZ.dat
new file mode 100644
index 000000000..f8cc40563
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/jmc_TZ.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ka.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ka.dat
new file mode 100644
index 000000000..68c24e78d
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ka.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ka_GE.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ka_GE.dat
new file mode 100644
index 000000000..47d9b18eb
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ka_GE.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/kab.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/kab.dat
new file mode 100644
index 000000000..1176bbd6f
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/kab.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/kab_DZ.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/kab_DZ.dat
new file mode 100644
index 000000000..b4ff65c5f
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/kab_DZ.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/kam.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/kam.dat
new file mode 100644
index 000000000..837cacf19
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/kam.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/kam_KE.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/kam_KE.dat
new file mode 100644
index 000000000..5ff772aed
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/kam_KE.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/kde.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/kde.dat
new file mode 100644
index 000000000..7bd388cd6
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/kde.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/kde_TZ.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/kde_TZ.dat
new file mode 100644
index 000000000..f8cc40563
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/kde_TZ.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/kea.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/kea.dat
new file mode 100644
index 000000000..7e3426727
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/kea.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/kea_CV.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/kea_CV.dat
new file mode 100644
index 000000000..f8cc40563
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/kea_CV.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/khq.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/khq.dat
new file mode 100644
index 000000000..74b6d061a
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/khq.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/khq_ML.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/khq_ML.dat
new file mode 100644
index 000000000..f8cc40563
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/khq_ML.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ki.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ki.dat
new file mode 100644
index 000000000..318324d69
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ki.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ki_KE.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ki_KE.dat
new file mode 100644
index 000000000..5ff772aed
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ki_KE.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/kk.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/kk.dat
new file mode 100644
index 000000000..96e0ea34a
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/kk.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/kk_KZ.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/kk_KZ.dat
new file mode 100644
index 000000000..47d9b18eb
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/kk_KZ.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/kkj.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/kkj.dat
new file mode 100644
index 000000000..069fa7ad0
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/kkj.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/kkj_CM.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/kkj_CM.dat
new file mode 100644
index 000000000..47d9b18eb
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/kkj_CM.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/kl.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/kl.dat
new file mode 100644
index 000000000..00b84e4af
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/kl.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/kl_GL.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/kl_GL.dat
new file mode 100644
index 000000000..f8cc40563
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/kl_GL.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/kln.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/kln.dat
new file mode 100644
index 000000000..377e588ed
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/kln.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/kln_KE.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/kln_KE.dat
new file mode 100644
index 000000000..5ff772aed
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/kln_KE.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/km.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/km.dat
new file mode 100644
index 000000000..96dc25b2b
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/km.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/km_KH.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/km_KH.dat
new file mode 100644
index 000000000..5ff772aed
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/km_KH.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/kn.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/kn.dat
new file mode 100644
index 000000000..fcbb705e6
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/kn.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/kn_IN.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/kn_IN.dat
new file mode 100644
index 000000000..0e1b08c1f
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/kn_IN.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ko.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ko.dat
new file mode 100644
index 000000000..9e7e73712
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ko.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ko_KP.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ko_KP.dat
new file mode 100644
index 000000000..effb93278
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ko_KP.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ko_KR.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ko_KR.dat
new file mode 100644
index 000000000..5ff772aed
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ko_KR.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/kok.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/kok.dat
new file mode 100644
index 000000000..0de42eac7
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/kok.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/kok_IN.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/kok_IN.dat
new file mode 100644
index 000000000..0e1b08c1f
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/kok_IN.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ks.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ks.dat
new file mode 100644
index 000000000..3d8e82ca7
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ks.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ks_IN.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ks_IN.dat
new file mode 100644
index 000000000..0e1b08c1f
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ks_IN.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ksb.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ksb.dat
new file mode 100644
index 000000000..38ea85f98
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ksb.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ksb_TZ.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ksb_TZ.dat
new file mode 100644
index 000000000..f8cc40563
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ksb_TZ.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ksf.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ksf.dat
new file mode 100644
index 000000000..1e0d34dd8
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ksf.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ksf_CM.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ksf_CM.dat
new file mode 100644
index 000000000..47d9b18eb
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ksf_CM.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ksh.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ksh.dat
new file mode 100644
index 000000000..e0aae59f0
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ksh.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ksh_DE.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ksh_DE.dat
new file mode 100644
index 000000000..ba7bcd28b
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ksh_DE.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/kw.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/kw.dat
new file mode 100644
index 000000000..bbdb07b5c
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/kw.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/kw_GB.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/kw_GB.dat
new file mode 100644
index 000000000..5b92b2d82
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/kw_GB.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ky.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ky.dat
new file mode 100644
index 000000000..a9d2a818f
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ky.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ky_KG.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ky_KG.dat
new file mode 100644
index 000000000..47d9b18eb
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ky_KG.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/lag.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/lag.dat
new file mode 100644
index 000000000..fc7102242
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/lag.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/lag_TZ.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/lag_TZ.dat
new file mode 100644
index 000000000..f8cc40563
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/lag_TZ.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/lb.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/lb.dat
new file mode 100644
index 000000000..256023c64
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/lb.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/lb_LU.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/lb_LU.dat
new file mode 100644
index 000000000..ba7bcd28b
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/lb_LU.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/lg.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/lg.dat
new file mode 100644
index 000000000..f6e6bb4da
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/lg.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/lg_UG.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/lg_UG.dat
new file mode 100644
index 000000000..f8cc40563
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/lg_UG.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/lkt.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/lkt.dat
new file mode 100644
index 000000000..3133a265e
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/lkt.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/lkt_US.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/lkt_US.dat
new file mode 100644
index 000000000..fad62059a
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/lkt_US.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ln.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ln.dat
new file mode 100644
index 000000000..4946759fa
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ln.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ln_AO.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ln_AO.dat
new file mode 100644
index 000000000..9381a9366
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ln_AO.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ln_CD.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ln_CD.dat
new file mode 100644
index 000000000..f8cc40563
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ln_CD.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ln_CF.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ln_CF.dat
new file mode 100644
index 000000000..f8cc40563
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ln_CF.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ln_CG.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ln_CG.dat
new file mode 100644
index 000000000..f8cc40563
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ln_CG.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/lo.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/lo.dat
new file mode 100644
index 000000000..55eed19e4
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/lo.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/lo_LA.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/lo_LA.dat
new file mode 100644
index 000000000..5ff772aed
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/lo_LA.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/lrc.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/lrc.dat
new file mode 100644
index 000000000..be65f7fdf
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/lrc.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/lrc_IQ.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/lrc_IQ.dat
new file mode 100644
index 000000000..4273d8db5
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/lrc_IQ.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/lrc_IR.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/lrc_IR.dat
new file mode 100644
index 000000000..a15e80761
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/lrc_IR.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/lt.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/lt.dat
new file mode 100644
index 000000000..781f87592
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/lt.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/lt_LT.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/lt_LT.dat
new file mode 100644
index 000000000..ba7bcd28b
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/lt_LT.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/lu.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/lu.dat
new file mode 100644
index 000000000..fbe87fafd
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/lu.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/lu_CD.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/lu_CD.dat
new file mode 100644
index 000000000..f8cc40563
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/lu_CD.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/luo.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/luo.dat
new file mode 100644
index 000000000..4acf84fea
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/luo.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/luo_KE.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/luo_KE.dat
new file mode 100644
index 000000000..5ff772aed
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/luo_KE.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/luy.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/luy.dat
new file mode 100644
index 000000000..4eb52c542
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/luy.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/luy_KE.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/luy_KE.dat
new file mode 100644
index 000000000..5ff772aed
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/luy_KE.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/lv.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/lv.dat
new file mode 100644
index 000000000..8aae4fa2c
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/lv.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/lv_LV.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/lv_LV.dat
new file mode 100644
index 000000000..47d9b18eb
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/lv_LV.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/mas.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/mas.dat
new file mode 100644
index 000000000..fd3c2267e
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/mas.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/mas_KE.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/mas_KE.dat
new file mode 100644
index 000000000..5ff772aed
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/mas_KE.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/mas_TZ.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/mas_TZ.dat
new file mode 100644
index 000000000..f1de1ee9e
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/mas_TZ.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/mer.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/mer.dat
new file mode 100644
index 000000000..6bbdb5d64
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/mer.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/mer_KE.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/mer_KE.dat
new file mode 100644
index 000000000..5ff772aed
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/mer_KE.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/mfe.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/mfe.dat
new file mode 100644
index 000000000..445f586c9
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/mfe.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/mfe_MU.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/mfe_MU.dat
new file mode 100644
index 000000000..f8cc40563
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/mfe_MU.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/mg.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/mg.dat
new file mode 100644
index 000000000..bdea2c0e4
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/mg.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/mg_MG.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/mg_MG.dat
new file mode 100644
index 000000000..f8cc40563
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/mg_MG.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/mgh.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/mgh.dat
new file mode 100644
index 000000000..c146efaea
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/mgh.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/mgh_MZ.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/mgh_MZ.dat
new file mode 100644
index 000000000..5ff772aed
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/mgh_MZ.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/mgo.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/mgo.dat
new file mode 100644
index 000000000..65fb8562e
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/mgo.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/mgo_CM.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/mgo_CM.dat
new file mode 100644
index 000000000..47d9b18eb
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/mgo_CM.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/mk.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/mk.dat
new file mode 100644
index 000000000..6054c4274
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/mk.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/mk_MK.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/mk_MK.dat
new file mode 100644
index 000000000..47d9b18eb
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/mk_MK.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ml.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ml.dat
new file mode 100644
index 000000000..28e7220b3
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ml.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ml_IN.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ml_IN.dat
new file mode 100644
index 000000000..0e1b08c1f
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ml_IN.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/mn.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/mn.dat
new file mode 100644
index 000000000..5b34290fd
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/mn.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/mn_MN.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/mn_MN.dat
new file mode 100644
index 000000000..47d9b18eb
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/mn_MN.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/mr.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/mr.dat
new file mode 100644
index 000000000..aea1ffa54
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/mr.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/mr_IN.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/mr_IN.dat
new file mode 100644
index 000000000..0e1b08c1f
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/mr_IN.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ms.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ms.dat
new file mode 100644
index 000000000..c1a25b849
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ms.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ms_BN.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ms_BN.dat
new file mode 100644
index 000000000..1c8846ef6
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ms_BN.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ms_MY.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ms_MY.dat
new file mode 100644
index 000000000..47d9b18eb
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ms_MY.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ms_SG.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ms_SG.dat
new file mode 100644
index 000000000..ad78072f4
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ms_SG.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/mt.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/mt.dat
new file mode 100644
index 000000000..3271e167d
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/mt.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/mt_MT.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/mt_MT.dat
new file mode 100644
index 000000000..5ff772aed
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/mt_MT.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/mua.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/mua.dat
new file mode 100644
index 000000000..e42a4e27e
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/mua.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/mua_CM.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/mua_CM.dat
new file mode 100644
index 000000000..47d9b18eb
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/mua_CM.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/my.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/my.dat
new file mode 100644
index 000000000..0a38e498a
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/my.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/my_MM.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/my_MM.dat
new file mode 100644
index 000000000..5ff772aed
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/my_MM.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/mzn.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/mzn.dat
new file mode 100644
index 000000000..1cd441388
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/mzn.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/mzn_IR.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/mzn_IR.dat
new file mode 100644
index 000000000..a15e80761
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/mzn_IR.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/naq.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/naq.dat
new file mode 100644
index 000000000..0002ef9c8
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/naq.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/naq_NA.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/naq_NA.dat
new file mode 100644
index 000000000..f8cc40563
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/naq_NA.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/nb.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/nb.dat
new file mode 100644
index 000000000..3de47a6b9
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/nb.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/nb_NO.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/nb_NO.dat
new file mode 100644
index 000000000..ba7bcd28b
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/nb_NO.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/nb_SJ.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/nb_SJ.dat
new file mode 100644
index 000000000..7ffd21065
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/nb_SJ.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/nd.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/nd.dat
new file mode 100644
index 000000000..871933dbc
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/nd.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/nd_ZW.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/nd_ZW.dat
new file mode 100644
index 000000000..5ff772aed
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/nd_ZW.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ne.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ne.dat
new file mode 100644
index 000000000..8e6c926a4
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ne.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ne_IN.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ne_IN.dat
new file mode 100644
index 000000000..d43dddc12
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ne_IN.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ne_NP.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ne_NP.dat
new file mode 100644
index 000000000..5ff772aed
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ne_NP.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/nl.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/nl.dat
new file mode 100644
index 000000000..c5cadad3d
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/nl.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/nl_AW.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/nl_AW.dat
new file mode 100644
index 000000000..14abc7e82
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/nl_AW.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/nl_BE.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/nl_BE.dat
new file mode 100644
index 000000000..ee7ec2070
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/nl_BE.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/nl_BQ.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/nl_BQ.dat
new file mode 100644
index 000000000..5b05c4b3f
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/nl_BQ.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/nl_CW.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/nl_CW.dat
new file mode 100644
index 000000000..f4e1e2cbb
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/nl_CW.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/nl_NL.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/nl_NL.dat
new file mode 100644
index 000000000..ba7bcd28b
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/nl_NL.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/nl_SR.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/nl_SR.dat
new file mode 100644
index 000000000..7ed6e2db4
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/nl_SR.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/nl_SX.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/nl_SX.dat
new file mode 100644
index 000000000..f4e1e2cbb
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/nl_SX.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/nmg.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/nmg.dat
new file mode 100644
index 000000000..abc8b19d7
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/nmg.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/nmg_CM.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/nmg_CM.dat
new file mode 100644
index 000000000..47d9b18eb
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/nmg_CM.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/nn.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/nn.dat
new file mode 100644
index 000000000..c6377462b
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/nn.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/nn_NO.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/nn_NO.dat
new file mode 100644
index 000000000..ba7bcd28b
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/nn_NO.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/nnh.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/nnh.dat
new file mode 100644
index 000000000..2b0e561b7
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/nnh.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/nnh_CM.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/nnh_CM.dat
new file mode 100644
index 000000000..47d9b18eb
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/nnh_CM.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/nus.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/nus.dat
new file mode 100644
index 000000000..5d5835e8a
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/nus.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/nus_SS.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/nus_SS.dat
new file mode 100644
index 000000000..a4fcf1401
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/nus_SS.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/nyn.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/nyn.dat
new file mode 100644
index 000000000..00ca0ef76
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/nyn.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/nyn_UG.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/nyn_UG.dat
new file mode 100644
index 000000000..f8cc40563
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/nyn_UG.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/om.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/om.dat
new file mode 100644
index 000000000..1a1547ff2
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/om.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/om_ET.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/om_ET.dat
new file mode 100644
index 000000000..5ff772aed
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/om_ET.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/om_KE.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/om_KE.dat
new file mode 100644
index 000000000..adc78c866
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/om_KE.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/or.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/or.dat
new file mode 100644
index 000000000..b7d18d876
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/or.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/or_IN.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/or_IN.dat
new file mode 100644
index 000000000..0e1b08c1f
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/or_IN.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/os.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/os.dat
new file mode 100644
index 000000000..fc3ee02d1
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/os.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/os_GE.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/os_GE.dat
new file mode 100644
index 000000000..47d9b18eb
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/os_GE.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/os_RU.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/os_RU.dat
new file mode 100644
index 000000000..00f7dc1c8
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/os_RU.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/pa.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/pa.dat
new file mode 100644
index 000000000..73a973bbe
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/pa.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/pa_Arab.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/pa_Arab.dat
new file mode 100644
index 000000000..3162e72b0
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/pa_Arab.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/pa_Arab_PK.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/pa_Arab_PK.dat
new file mode 100644
index 000000000..5ff772aed
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/pa_Arab_PK.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/pa_Guru.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/pa_Guru.dat
new file mode 100644
index 000000000..e1421579e
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/pa_Guru.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/pa_Guru_IN.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/pa_Guru_IN.dat
new file mode 100644
index 000000000..0e1b08c1f
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/pa_Guru_IN.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/pl.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/pl.dat
new file mode 100644
index 000000000..df36bc758
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/pl.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/pl_PL.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/pl_PL.dat
new file mode 100644
index 000000000..ba7bcd28b
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/pl_PL.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/prg.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/prg.dat
new file mode 100644
index 000000000..a95f79bf9
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/prg.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/prg_001.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/prg_001.dat
new file mode 100644
index 000000000..962d99a2b
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/prg_001.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ps.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ps.dat
new file mode 100644
index 000000000..823f6817f
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ps.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ps_AF.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ps_AF.dat
new file mode 100644
index 000000000..51959ad0c
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ps_AF.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/pt.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/pt.dat
new file mode 100644
index 000000000..54020f69a
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/pt.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/pt_AO.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/pt_AO.dat
new file mode 100644
index 000000000..f0d1deb4f
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/pt_AO.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/pt_BR.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/pt_BR.dat
new file mode 100644
index 000000000..5ff772aed
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/pt_BR.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/pt_CV.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/pt_CV.dat
new file mode 100644
index 000000000..31c6f889f
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/pt_CV.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/pt_GW.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/pt_GW.dat
new file mode 100644
index 000000000..9f34dfcfa
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/pt_GW.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/pt_MO.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/pt_MO.dat
new file mode 100644
index 000000000..87d4044a7
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/pt_MO.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/pt_MZ.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/pt_MZ.dat
new file mode 100644
index 000000000..c0a5b7333
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/pt_MZ.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/pt_PT.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/pt_PT.dat
new file mode 100644
index 000000000..cc127f68e
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/pt_PT.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/pt_ST.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/pt_ST.dat
new file mode 100644
index 000000000..30c11d999
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/pt_ST.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/pt_TL.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/pt_TL.dat
new file mode 100644
index 000000000..9f34dfcfa
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/pt_TL.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/qu.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/qu.dat
new file mode 100644
index 000000000..d9d5528f3
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/qu.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/qu_BO.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/qu_BO.dat
new file mode 100644
index 000000000..8b07a2ad4
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/qu_BO.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/qu_EC.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/qu_EC.dat
new file mode 100644
index 000000000..41defea7b
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/qu_EC.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/qu_PE.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/qu_PE.dat
new file mode 100644
index 000000000..5ff772aed
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/qu_PE.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/rm.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/rm.dat
new file mode 100644
index 000000000..2b6e9de70
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/rm.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/rm_CH.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/rm_CH.dat
new file mode 100644
index 000000000..ba7bcd28b
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/rm_CH.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/rn.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/rn.dat
new file mode 100644
index 000000000..072c8c7cc
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/rn.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/rn_BI.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/rn_BI.dat
new file mode 100644
index 000000000..f8cc40563
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/rn_BI.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ro.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ro.dat
new file mode 100644
index 000000000..02ebd58f8
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ro.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ro_MD.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ro_MD.dat
new file mode 100644
index 000000000..c35183b66
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ro_MD.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ro_RO.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ro_RO.dat
new file mode 100644
index 000000000..47d9b18eb
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ro_RO.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/rof.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/rof.dat
new file mode 100644
index 000000000..4895ea88a
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/rof.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/rof_TZ.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/rof_TZ.dat
new file mode 100644
index 000000000..f8cc40563
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/rof_TZ.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/root.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/root.dat
new file mode 100644
index 000000000..6be9c239f
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/root.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ru.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ru.dat
new file mode 100644
index 000000000..8dc975ad4
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ru.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ru_BY.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ru_BY.dat
new file mode 100644
index 000000000..a933b79f1
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ru_BY.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ru_KG.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ru_KG.dat
new file mode 100644
index 000000000..0728a7ebe
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ru_KG.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ru_KZ.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ru_KZ.dat
new file mode 100644
index 000000000..7f13b2a6c
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ru_KZ.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ru_MD.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ru_MD.dat
new file mode 100644
index 000000000..02efbf383
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ru_MD.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ru_RU.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ru_RU.dat
new file mode 100644
index 000000000..47d9b18eb
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ru_RU.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ru_UA.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ru_UA.dat
new file mode 100644
index 000000000..bc07e0766
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ru_UA.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/rw.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/rw.dat
new file mode 100644
index 000000000..6b57db879
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/rw.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/rw_RW.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/rw_RW.dat
new file mode 100644
index 000000000..f8cc40563
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/rw_RW.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/rwk.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/rwk.dat
new file mode 100644
index 000000000..2913e4d2e
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/rwk.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/rwk_TZ.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/rwk_TZ.dat
new file mode 100644
index 000000000..f8cc40563
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/rwk_TZ.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sah.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sah.dat
new file mode 100644
index 000000000..d2606a35a
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sah.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sah_RU.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sah_RU.dat
new file mode 100644
index 000000000..47d9b18eb
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sah_RU.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/saq.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/saq.dat
new file mode 100644
index 000000000..6f76a65d8
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/saq.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/saq_KE.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/saq_KE.dat
new file mode 100644
index 000000000..5ff772aed
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/saq_KE.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sbp.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sbp.dat
new file mode 100644
index 000000000..7c419f941
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sbp.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sbp_TZ.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sbp_TZ.dat
new file mode 100644
index 000000000..f8cc40563
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sbp_TZ.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/se.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/se.dat
new file mode 100644
index 000000000..2290723a9
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/se.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/se_FI.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/se_FI.dat
new file mode 100644
index 000000000..b99f206d5
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/se_FI.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/se_NO.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/se_NO.dat
new file mode 100644
index 000000000..ba7bcd28b
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/se_NO.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/se_SE.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/se_SE.dat
new file mode 100644
index 000000000..54b2e9263
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/se_SE.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/seh.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/seh.dat
new file mode 100644
index 000000000..1c586e9b8
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/seh.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/seh_MZ.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/seh_MZ.dat
new file mode 100644
index 000000000..5ff772aed
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/seh_MZ.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ses.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ses.dat
new file mode 100644
index 000000000..ea0cc47ba
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ses.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ses_ML.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ses_ML.dat
new file mode 100644
index 000000000..f8cc40563
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ses_ML.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sg.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sg.dat
new file mode 100644
index 000000000..7cc66b610
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sg.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sg_CF.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sg_CF.dat
new file mode 100644
index 000000000..f8cc40563
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sg_CF.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/shi.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/shi.dat
new file mode 100644
index 000000000..13f2ab6e6
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/shi.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/shi_Latn.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/shi_Latn.dat
new file mode 100644
index 000000000..51116c810
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/shi_Latn.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/shi_Latn_MA.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/shi_Latn_MA.dat
new file mode 100644
index 000000000..b4ff65c5f
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/shi_Latn_MA.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/shi_Tfng.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/shi_Tfng.dat
new file mode 100644
index 000000000..1f4d04f0f
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/shi_Tfng.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/shi_Tfng_MA.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/shi_Tfng_MA.dat
new file mode 100644
index 000000000..b4ff65c5f
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/shi_Tfng_MA.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/si.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/si.dat
new file mode 100644
index 000000000..13e69729b
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/si.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/si_LK.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/si_LK.dat
new file mode 100644
index 000000000..47d9b18eb
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/si_LK.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sk.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sk.dat
new file mode 100644
index 000000000..b7efff1a0
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sk.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sk_SK.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sk_SK.dat
new file mode 100644
index 000000000..ba7bcd28b
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sk_SK.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sl.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sl.dat
new file mode 100644
index 000000000..25ff8d810
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sl.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sl_SI.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sl_SI.dat
new file mode 100644
index 000000000..47d9b18eb
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sl_SI.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/smn.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/smn.dat
new file mode 100644
index 000000000..ba3114d60
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/smn.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/smn_FI.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/smn_FI.dat
new file mode 100644
index 000000000..ba7bcd28b
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/smn_FI.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sn.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sn.dat
new file mode 100644
index 000000000..0752920f8
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sn.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sn_ZW.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sn_ZW.dat
new file mode 100644
index 000000000..5ff772aed
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sn_ZW.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/so.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/so.dat
new file mode 100644
index 000000000..5bd1787cc
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/so.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/so_DJ.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/so_DJ.dat
new file mode 100644
index 000000000..22deeb6a3
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/so_DJ.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/so_ET.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/so_ET.dat
new file mode 100644
index 000000000..781ec349c
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/so_ET.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/so_KE.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/so_KE.dat
new file mode 100644
index 000000000..adc78c866
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/so_KE.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/so_SO.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/so_SO.dat
new file mode 100644
index 000000000..f8cc40563
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/so_SO.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sq.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sq.dat
new file mode 100644
index 000000000..b06c3cd7f
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sq.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sq_AL.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sq_AL.dat
new file mode 100644
index 000000000..47d9b18eb
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sq_AL.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sq_MK.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sq_MK.dat
new file mode 100644
index 000000000..2c4636a8d
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sq_MK.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sq_XK.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sq_XK.dat
new file mode 100644
index 000000000..bc07e0766
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sq_XK.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sr.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sr.dat
new file mode 100644
index 000000000..dea3cff51
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sr.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sr_Cyrl.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sr_Cyrl.dat
new file mode 100644
index 000000000..9580829fc
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sr_Cyrl.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sr_Cyrl_BA.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sr_Cyrl_BA.dat
new file mode 100644
index 000000000..bc07e0766
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sr_Cyrl_BA.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sr_Cyrl_ME.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sr_Cyrl_ME.dat
new file mode 100644
index 000000000..47d9b18eb
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sr_Cyrl_ME.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sr_Cyrl_RS.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sr_Cyrl_RS.dat
new file mode 100644
index 000000000..47d9b18eb
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sr_Cyrl_RS.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sr_Cyrl_XK.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sr_Cyrl_XK.dat
new file mode 100644
index 000000000..47d9b18eb
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sr_Cyrl_XK.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sr_Latn.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sr_Latn.dat
new file mode 100644
index 000000000..5ce5cca35
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sr_Latn.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sr_Latn_BA.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sr_Latn_BA.dat
new file mode 100644
index 000000000..bc07e0766
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sr_Latn_BA.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sr_Latn_ME.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sr_Latn_ME.dat
new file mode 100644
index 000000000..47d9b18eb
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sr_Latn_ME.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sr_Latn_RS.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sr_Latn_RS.dat
new file mode 100644
index 000000000..47d9b18eb
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sr_Latn_RS.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sr_Latn_XK.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sr_Latn_XK.dat
new file mode 100644
index 000000000..47d9b18eb
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sr_Latn_XK.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sv.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sv.dat
new file mode 100644
index 000000000..d82239c40
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sv.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sv_AX.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sv_AX.dat
new file mode 100644
index 000000000..ba7bcd28b
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sv_AX.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sv_FI.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sv_FI.dat
new file mode 100644
index 000000000..ff9dba3f6
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sv_FI.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sv_SE.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sv_SE.dat
new file mode 100644
index 000000000..ba7bcd28b
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sv_SE.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sw.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sw.dat
new file mode 100644
index 000000000..e36a6bf62
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sw.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sw_CD.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sw_CD.dat
new file mode 100644
index 000000000..483bb14a4
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sw_CD.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sw_KE.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sw_KE.dat
new file mode 100644
index 000000000..5ff772aed
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sw_KE.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sw_TZ.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sw_TZ.dat
new file mode 100644
index 000000000..f8cc40563
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sw_TZ.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sw_UG.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sw_UG.dat
new file mode 100644
index 000000000..01c1c6418
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/sw_UG.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ta.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ta.dat
new file mode 100644
index 000000000..d7c36a59c
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ta.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ta_IN.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ta_IN.dat
new file mode 100644
index 000000000..0e1b08c1f
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ta_IN.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ta_LK.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ta_LK.dat
new file mode 100644
index 000000000..946bb7f2c
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ta_LK.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ta_MY.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ta_MY.dat
new file mode 100644
index 000000000..7410e0b7b
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ta_MY.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ta_SG.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ta_SG.dat
new file mode 100644
index 000000000..5d5bc2203
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ta_SG.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/te.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/te.dat
new file mode 100644
index 000000000..2fc9aba5d
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/te.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/te_IN.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/te_IN.dat
new file mode 100644
index 000000000..0e1b08c1f
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/te_IN.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/teo.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/teo.dat
new file mode 100644
index 000000000..51f5082e1
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/teo.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/teo_KE.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/teo_KE.dat
new file mode 100644
index 000000000..7c12fcb1b
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/teo_KE.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/teo_UG.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/teo_UG.dat
new file mode 100644
index 000000000..f8cc40563
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/teo_UG.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/th.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/th.dat
new file mode 100644
index 000000000..751f47731
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/th.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/th_TH.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/th_TH.dat
new file mode 100644
index 000000000..5ff772aed
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/th_TH.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ti.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ti.dat
new file mode 100644
index 000000000..469cee4bf
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ti.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ti_ER.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ti_ER.dat
new file mode 100644
index 000000000..52a4dee49
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ti_ER.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ti_ET.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ti_ET.dat
new file mode 100644
index 000000000..5ff772aed
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ti_ET.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/tk.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/tk.dat
new file mode 100644
index 000000000..0b011d800
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/tk.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/tk_TM.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/tk_TM.dat
new file mode 100644
index 000000000..47d9b18eb
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/tk_TM.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/to.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/to.dat
new file mode 100644
index 000000000..78236d7ca
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/to.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/to_TO.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/to_TO.dat
new file mode 100644
index 000000000..f8cc40563
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/to_TO.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/tr.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/tr.dat
new file mode 100644
index 000000000..991bcc52b
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/tr.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/tr_CY.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/tr_CY.dat
new file mode 100644
index 000000000..2d6c4dbd9
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/tr_CY.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/tr_TR.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/tr_TR.dat
new file mode 100644
index 000000000..47d9b18eb
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/tr_TR.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/twq.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/twq.dat
new file mode 100644
index 000000000..f4402557a
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/twq.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/twq_NE.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/twq_NE.dat
new file mode 100644
index 000000000..f8cc40563
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/twq_NE.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/tzm.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/tzm.dat
new file mode 100644
index 000000000..301302f40
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/tzm.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/tzm_MA.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/tzm_MA.dat
new file mode 100644
index 000000000..b4ff65c5f
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/tzm_MA.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ug.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ug.dat
new file mode 100644
index 000000000..4ad329f92
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ug.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ug_CN.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ug_CN.dat
new file mode 100644
index 000000000..5ff772aed
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ug_CN.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/uk.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/uk.dat
new file mode 100644
index 000000000..7c465f52c
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/uk.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/uk_UA.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/uk_UA.dat
new file mode 100644
index 000000000..47d9b18eb
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/uk_UA.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ur.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ur.dat
new file mode 100644
index 000000000..40db1765d
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ur.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ur_IN.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ur_IN.dat
new file mode 100644
index 000000000..5b72451f3
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ur_IN.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ur_PK.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ur_PK.dat
new file mode 100644
index 000000000..5ff772aed
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/ur_PK.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/uz.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/uz.dat
new file mode 100644
index 000000000..bed341532
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/uz.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/uz_Arab.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/uz_Arab.dat
new file mode 100644
index 000000000..143658011
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/uz_Arab.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/uz_Arab_AF.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/uz_Arab_AF.dat
new file mode 100644
index 000000000..51959ad0c
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/uz_Arab_AF.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/uz_Cyrl.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/uz_Cyrl.dat
new file mode 100644
index 000000000..e91a14046
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/uz_Cyrl.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/uz_Cyrl_UZ.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/uz_Cyrl_UZ.dat
new file mode 100644
index 000000000..47d9b18eb
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/uz_Cyrl_UZ.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/uz_Latn.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/uz_Latn.dat
new file mode 100644
index 000000000..ab03a37ea
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/uz_Latn.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/uz_Latn_UZ.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/uz_Latn_UZ.dat
new file mode 100644
index 000000000..47d9b18eb
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/uz_Latn_UZ.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/vai.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/vai.dat
new file mode 100644
index 000000000..85e578422
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/vai.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/vai_Latn.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/vai_Latn.dat
new file mode 100644
index 000000000..7992162b0
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/vai_Latn.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/vai_Latn_LR.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/vai_Latn_LR.dat
new file mode 100644
index 000000000..f8cc40563
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/vai_Latn_LR.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/vai_Vaii.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/vai_Vaii.dat
new file mode 100644
index 000000000..60d0ba2d8
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/vai_Vaii.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/vai_Vaii_LR.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/vai_Vaii_LR.dat
new file mode 100644
index 000000000..f8cc40563
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/vai_Vaii_LR.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/vi.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/vi.dat
new file mode 100644
index 000000000..ecbd72ed3
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/vi.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/vi_VN.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/vi_VN.dat
new file mode 100644
index 000000000..47d9b18eb
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/vi_VN.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/vo.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/vo.dat
new file mode 100644
index 000000000..b6ff2ca4d
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/vo.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/vo_001.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/vo_001.dat
new file mode 100644
index 000000000..3259b7a85
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/vo_001.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/vun.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/vun.dat
new file mode 100644
index 000000000..b5ac55d3d
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/vun.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/vun_TZ.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/vun_TZ.dat
new file mode 100644
index 000000000..f8cc40563
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/vun_TZ.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/wae.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/wae.dat
new file mode 100644
index 000000000..3b04b6d33
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/wae.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/wae_CH.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/wae_CH.dat
new file mode 100644
index 000000000..ba7bcd28b
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/wae_CH.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/xog.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/xog.dat
new file mode 100644
index 000000000..a7c3206c4
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/xog.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/xog_UG.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/xog_UG.dat
new file mode 100644
index 000000000..f8cc40563
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/xog_UG.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/yav.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/yav.dat
new file mode 100644
index 000000000..b61f4b87a
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/yav.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/yav_CM.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/yav_CM.dat
new file mode 100644
index 000000000..47d9b18eb
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/yav_CM.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/yi.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/yi.dat
new file mode 100644
index 000000000..aa6ccf685
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/yi.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/yi_001.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/yi_001.dat
new file mode 100644
index 000000000..2c9d3c60e
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/yi_001.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/yo.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/yo.dat
new file mode 100644
index 000000000..a4017eabd
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/yo.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/yo_BJ.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/yo_BJ.dat
new file mode 100644
index 000000000..3810a028f
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/yo_BJ.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/yo_NG.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/yo_NG.dat
new file mode 100644
index 000000000..f8cc40563
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/yo_NG.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/zgh.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/zgh.dat
new file mode 100644
index 000000000..da7a9bec5
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/zgh.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/zgh_MA.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/zgh_MA.dat
new file mode 100644
index 000000000..b4ff65c5f
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/zgh_MA.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/zh.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/zh.dat
new file mode 100644
index 000000000..655559048
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/zh.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/zh_Hans.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/zh_Hans.dat
new file mode 100644
index 000000000..34fd77795
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/zh_Hans.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/zh_Hans_CN.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/zh_Hans_CN.dat
new file mode 100644
index 000000000..5ff772aed
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/zh_Hans_CN.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/zh_Hans_HK.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/zh_Hans_HK.dat
new file mode 100644
index 000000000..ab00c8352
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/zh_Hans_HK.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/zh_Hans_MO.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/zh_Hans_MO.dat
new file mode 100644
index 000000000..04092e67f
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/zh_Hans_MO.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/zh_Hans_SG.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/zh_Hans_SG.dat
new file mode 100644
index 000000000..5bdb08fbe
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/zh_Hans_SG.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/zh_Hant.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/zh_Hant.dat
new file mode 100644
index 000000000..cca210694
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/zh_Hant.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/zh_Hant_HK.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/zh_Hant_HK.dat
new file mode 100644
index 000000000..689201ce1
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/zh_Hant_HK.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/zh_Hant_MO.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/zh_Hant_MO.dat
new file mode 100644
index 000000000..950dd2fe2
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/zh_Hant_MO.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/zh_Hant_TW.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/zh_Hant_TW.dat
new file mode 100644
index 000000000..5ff772aed
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/zh_Hant_TW.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/zu.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/zu.dat
new file mode 100644
index 000000000..ad3c71b5c
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/zu.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/zu_ZA.dat b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/zu_ZA.dat
new file mode 100644
index 000000000..5ff772aed
Binary files /dev/null and b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/locale-data/zu_ZA.dat differ
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/localedata.py b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/localedata.py
new file mode 100644
index 000000000..437f49fae
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/localedata.py
@@ -0,0 +1,212 @@
+# -*- coding: utf-8 -*-
+"""
+ babel.localedata
+ ~~~~~~~~~~~~~~~~
+
+ Low-level locale data access.
+
+ :note: The `Locale` class, which uses this module under the hood, provides a
+ more convenient interface for accessing the locale data.
+
+ :copyright: (c) 2013 by the Babel Team.
+ :license: BSD, see LICENSE for more details.
+"""
+
+import os
+import threading
+from collections import MutableMapping
+
+from babel._compat import pickle
+
+
+_cache = {}
+_cache_lock = threading.RLock()
+_dirname = os.path.join(os.path.dirname(__file__), 'locale-data')
+
+
+def exists(name):
+ """Check whether locale data is available for the given locale. Ther
+ return value is `True` if it exists, `False` otherwise.
+
+ :param name: the locale identifier string
+ """
+ if name in _cache:
+ return True
+ return os.path.exists(os.path.join(_dirname, '%s.dat' % name))
+
+
+def locale_identifiers():
+ """Return a list of all locale identifiers for which locale data is
+ available.
+
+ .. versionadded:: 0.8.1
+
+ :return: a list of locale identifiers (strings)
+ """
+ return [stem for stem, extension in [
+ os.path.splitext(filename) for filename in os.listdir(_dirname)
+ ] if extension == '.dat' and stem != 'root']
+
+
+def load(name, merge_inherited=True):
+ """Load the locale data for the given locale.
+
+ The locale data is a dictionary that contains much of the data defined by
+ the Common Locale Data Repository (CLDR). This data is stored as a
+ collection of pickle files inside the ``babel`` package.
+
+ >>> d = load('en_US')
+ >>> d['languages']['sv']
+ u'Swedish'
+
+ Note that the results are cached, and subsequent requests for the same
+ locale return the same dictionary:
+
+ >>> d1 = load('en_US')
+ >>> d2 = load('en_US')
+ >>> d1 is d2
+ True
+
+ :param name: the locale identifier string (or "root")
+ :param merge_inherited: whether the inherited data should be merged into
+ the data of the requested locale
+ :raise `IOError`: if no locale data file is found for the given locale
+ identifer, or one of the locales it inherits from
+ """
+ _cache_lock.acquire()
+ try:
+ data = _cache.get(name)
+ if not data:
+ # Load inherited data
+ if name == 'root' or not merge_inherited:
+ data = {}
+ else:
+ from babel.core import get_global
+ parent = get_global('parent_exceptions').get(name)
+ if not parent:
+ parts = name.split('_')
+ if len(parts) == 1:
+ parent = 'root'
+ else:
+ parent = '_'.join(parts[:-1])
+ data = load(parent).copy()
+ filename = os.path.join(_dirname, '%s.dat' % name)
+ fileobj = open(filename, 'rb')
+ try:
+ if name != 'root' and merge_inherited:
+ merge(data, pickle.load(fileobj))
+ else:
+ data = pickle.load(fileobj)
+ _cache[name] = data
+ finally:
+ fileobj.close()
+ return data
+ finally:
+ _cache_lock.release()
+
+
+def merge(dict1, dict2):
+ """Merge the data from `dict2` into the `dict1` dictionary, making copies
+ of nested dictionaries.
+
+ >>> d = {1: 'foo', 3: 'baz'}
+ >>> merge(d, {1: 'Foo', 2: 'Bar'})
+ >>> sorted(d.items())
+ [(1, 'Foo'), (2, 'Bar'), (3, 'baz')]
+
+ :param dict1: the dictionary to merge into
+ :param dict2: the dictionary containing the data that should be merged
+ """
+ for key, val2 in dict2.items():
+ if val2 is not None:
+ val1 = dict1.get(key)
+ if isinstance(val2, dict):
+ if val1 is None:
+ val1 = {}
+ if isinstance(val1, Alias):
+ val1 = (val1, val2)
+ elif isinstance(val1, tuple):
+ alias, others = val1
+ others = others.copy()
+ merge(others, val2)
+ val1 = (alias, others)
+ else:
+ val1 = val1.copy()
+ merge(val1, val2)
+ else:
+ val1 = val2
+ dict1[key] = val1
+
+
+class Alias(object):
+ """Representation of an alias in the locale data.
+
+ An alias is a value that refers to some other part of the locale data,
+ as specified by the `keys`.
+ """
+
+ def __init__(self, keys):
+ self.keys = tuple(keys)
+
+ def __repr__(self):
+ return '<%s %r>' % (type(self).__name__, self.keys)
+
+ def resolve(self, data):
+ """Resolve the alias based on the given data.
+
+ This is done recursively, so if one alias resolves to a second alias,
+ that second alias will also be resolved.
+
+ :param data: the locale data
+ :type data: `dict`
+ """
+ base = data
+ for key in self.keys:
+ data = data[key]
+ if isinstance(data, Alias):
+ data = data.resolve(base)
+ elif isinstance(data, tuple):
+ alias, others = data
+ data = alias.resolve(base)
+ return data
+
+
+class LocaleDataDict(MutableMapping):
+ """Dictionary wrapper that automatically resolves aliases to the actual
+ values.
+ """
+
+ def __init__(self, data, base=None):
+ self._data = data
+ if base is None:
+ base = data
+ self.base = base
+
+ def __len__(self):
+ return len(self._data)
+
+ def __iter__(self):
+ return iter(self._data)
+
+ def __getitem__(self, key):
+ orig = val = self._data[key]
+ if isinstance(val, Alias): # resolve an alias
+ val = val.resolve(self.base)
+ if isinstance(val, tuple): # Merge a partial dict with an alias
+ alias, others = val
+ val = alias.resolve(self.base).copy()
+ merge(val, others)
+ if type(val) is dict: # Return a nested alias-resolving dict
+ val = LocaleDataDict(val, base=self.base)
+ if val is not orig:
+ self._data[key] = val
+ return val
+
+ def __setitem__(self, key, value):
+ self._data[key] = value
+
+ def __delitem__(self, key):
+ del self._data[key]
+
+ def copy(self):
+ return LocaleDataDict(self._data.copy(), base=self.base)
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/localtime/__init__.py b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/localtime/__init__.py
new file mode 100644
index 000000000..4cab2364e
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/localtime/__init__.py
@@ -0,0 +1,76 @@
+# -*- coding: utf-8 -*-
+"""
+ babel.localtime
+ ~~~~~~~~~~~~~~~
+
+ Babel specific fork of tzlocal to determine the local timezone
+ of the system.
+
+ :copyright: (c) 2013 by the Babel Team.
+ :license: BSD, see LICENSE for more details.
+"""
+
+import sys
+import pytz
+import time
+from datetime import timedelta
+from datetime import tzinfo
+from threading import RLock
+
+if sys.platform == 'win32':
+ from babel.localtime._win32 import _get_localzone
+else:
+ from babel.localtime._unix import _get_localzone
+
+
+_cached_tz = None
+_cache_lock = RLock()
+
+STDOFFSET = timedelta(seconds = -time.timezone)
+if time.daylight:
+ DSTOFFSET = timedelta(seconds = -time.altzone)
+else:
+ DSTOFFSET = STDOFFSET
+
+DSTDIFF = DSTOFFSET - STDOFFSET
+ZERO = timedelta(0)
+
+
+class _FallbackLocalTimezone(tzinfo):
+
+ def utcoffset(self, dt):
+ if self._isdst(dt):
+ return DSTOFFSET
+ else:
+ return STDOFFSET
+
+ def dst(self, dt):
+ if self._isdst(dt):
+ return DSTDIFF
+ else:
+ return ZERO
+
+ def tzname(self, dt):
+ return time.tzname[self._isdst(dt)]
+
+ def _isdst(self, dt):
+ tt = (dt.year, dt.month, dt.day,
+ dt.hour, dt.minute, dt.second,
+ dt.weekday(), 0, -1)
+ stamp = time.mktime(tt)
+ tt = time.localtime(stamp)
+ return tt.tm_isdst > 0
+
+
+def get_localzone():
+ """Returns the current underlying local timezone object.
+ Generally this function does not need to be used, it's a
+ better idea to use the :data:`LOCALTZ` singleton instead.
+ """
+ return _get_localzone()
+
+
+try:
+ LOCALTZ = get_localzone()
+except pytz.UnknownTimeZoneError:
+ LOCALTZ = _FallbackLocalTimezone()
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/localtime/_unix.py b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/localtime/_unix.py
new file mode 100644
index 000000000..b4a3b599f
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/localtime/_unix.py
@@ -0,0 +1,137 @@
+from __future__ import with_statement
+import os
+import re
+import sys
+import pytz
+import subprocess
+
+_systemconfig_tz = re.compile(r'^Time Zone: (.*)$(?m)')
+
+
+def _tz_from_env(tzenv):
+ if tzenv[0] == ':':
+ tzenv = tzenv[1:]
+
+ # TZ specifies a file
+ if os.path.exists(tzenv):
+ with open(tzenv, 'rb') as tzfile:
+ return pytz.tzfile.build_tzinfo('local', tzfile)
+
+ # TZ specifies a zoneinfo zone.
+ try:
+ tz = pytz.timezone(tzenv)
+ # That worked, so we return this:
+ return tz
+ except pytz.UnknownTimeZoneError:
+ raise pytz.UnknownTimeZoneError(
+ "tzlocal() does not support non-zoneinfo timezones like %s. \n"
+ "Please use a timezone in the form of Continent/City")
+
+def _get_localzone(_root='/'):
+ """Tries to find the local timezone configuration.
+ This method prefers finding the timezone name and passing that to pytz,
+ over passing in the localtime file, as in the later case the zoneinfo
+ name is unknown.
+ The parameter _root makes the function look for files like /etc/localtime
+ beneath the _root directory. This is primarily used by the tests.
+ In normal usage you call the function without parameters.
+ """
+
+ tzenv = os.environ.get('TZ')
+ if tzenv:
+ return _tz_from_env(tzenv)
+
+ # This is actually a pretty reliable way to test for the local time
+ # zone on operating systems like OS X. On OS X especially this is the
+ # only one that actually works.
+ try:
+ link_dst = os.readlink('/etc/localtime')
+ except OSError:
+ pass
+ else:
+ pos = link_dst.find('/zoneinfo/')
+ if pos >= 0:
+ zone_name = link_dst[pos + 10:]
+ try:
+ return pytz.timezone(zone_name)
+ except pytz.UnknownTimeZoneError:
+ pass
+
+ # If we are on OS X now we are pretty sure that the rest of the
+ # code will fail and just fall through until it hits the reading
+ # of /etc/localtime and using it without name. At this point we
+ # can invoke systemconfig which internally invokes ICU. ICU itself
+ # does the same thing we do (readlink + compare file contents) but
+ # since it knows where the zone files are that should be a bit
+ # better than reimplementing the logic here.
+ if sys.platform == 'darwin':
+ c = subprocess.Popen(['systemsetup', '-gettimezone'],
+ stdout=subprocess.PIPE)
+ sys_result = c.communicate()[0]
+ c.wait()
+ tz_match = _systemconfig_tz.search(sys_result)
+ if tz_match is not None:
+ zone_name = tz_match.group(1)
+ try:
+ return pytz.timezone(zone_name)
+ except pytz.UnknownTimeZoneError:
+ pass
+
+ # Now look for distribution specific configuration files
+ # that contain the timezone name.
+ tzpath = os.path.join(_root, 'etc/timezone')
+ if os.path.exists(tzpath):
+ with open(tzpath, 'rb') as tzfile:
+ data = tzfile.read()
+
+ # Issue #3 in tzlocal was that /etc/timezone was a zoneinfo file.
+ # That's a misconfiguration, but we need to handle it gracefully:
+ if data[:5] != 'TZif2':
+ etctz = data.strip().decode()
+ # Get rid of host definitions and comments:
+ if ' ' in etctz:
+ etctz, dummy = etctz.split(' ', 1)
+ if '#' in etctz:
+ etctz, dummy = etctz.split('#', 1)
+ return pytz.timezone(etctz.replace(' ', '_'))
+
+ # CentOS has a ZONE setting in /etc/sysconfig/clock,
+ # OpenSUSE has a TIMEZONE setting in /etc/sysconfig/clock and
+ # Gentoo has a TIMEZONE setting in /etc/conf.d/clock
+ # We look through these files for a timezone:
+ zone_re = re.compile('\s*ZONE\s*=\s*\"')
+ timezone_re = re.compile('\s*TIMEZONE\s*=\s*\"')
+ end_re = re.compile('\"')
+
+ for filename in ('etc/sysconfig/clock', 'etc/conf.d/clock'):
+ tzpath = os.path.join(_root, filename)
+ if not os.path.exists(tzpath):
+ continue
+ with open(tzpath, 'rt') as tzfile:
+ data = tzfile.readlines()
+
+ for line in data:
+ # Look for the ZONE= setting.
+ match = zone_re.match(line)
+ if match is None:
+ # No ZONE= setting. Look for the TIMEZONE= setting.
+ match = timezone_re.match(line)
+ if match is not None:
+ # Some setting existed
+ line = line[match.end():]
+ etctz = line[:end_re.search(line).start()]
+
+ # We found a timezone
+ return pytz.timezone(etctz.replace(' ', '_'))
+
+ # No explicit setting existed. Use localtime
+ for filename in ('etc/localtime', 'usr/local/etc/localtime'):
+ tzpath = os.path.join(_root, filename)
+
+ if not os.path.exists(tzpath):
+ continue
+
+ with open(tzpath, 'rb') as tzfile:
+ return pytz.tzfile.build_tzinfo('local', tzfile)
+
+ raise pytz.UnknownTimeZoneError('Can not find any timezone configuration')
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/localtime/_win32.py b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/localtime/_win32.py
new file mode 100644
index 000000000..3752dffac
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/localtime/_win32.py
@@ -0,0 +1,96 @@
+try:
+ import _winreg as winreg
+except ImportError:
+ try:
+ import winreg
+ except ImportError:
+ winreg = None
+
+from babel.core import get_global
+import pytz
+
+
+# When building the cldr data on windows this module gets imported.
+# Because at that point there is no global.dat yet this call will
+# fail. We want to catch it down in that case then and just assume
+# the mapping was empty.
+try:
+ tz_names = get_global('windows_zone_mapping')
+except RuntimeError:
+ tz_names = {}
+
+
+def valuestodict(key):
+ """Convert a registry key's values to a dictionary."""
+ dict = {}
+ size = winreg.QueryInfoKey(key)[1]
+ for i in range(size):
+ data = winreg.EnumValue(key, i)
+ dict[data[0]] = data[1]
+ return dict
+
+
+def get_localzone_name():
+ # Windows is special. It has unique time zone names (in several
+ # meanings of the word) available, but unfortunately, they can be
+ # translated to the language of the operating system, so we need to
+ # do a backwards lookup, by going through all time zones and see which
+ # one matches.
+ handle = winreg.ConnectRegistry(None, winreg.HKEY_LOCAL_MACHINE)
+
+ TZLOCALKEYNAME = r'SYSTEM\CurrentControlSet\Control\TimeZoneInformation'
+ localtz = winreg.OpenKey(handle, TZLOCALKEYNAME)
+ keyvalues = valuestodict(localtz)
+ localtz.Close()
+ if 'TimeZoneKeyName' in keyvalues:
+ # Windows 7 (and Vista?)
+
+ # For some reason this returns a string with loads of NUL bytes at
+ # least on some systems. I don't know if this is a bug somewhere, I
+ # just work around it.
+ tzkeyname = keyvalues['TimeZoneKeyName'].split('\x00', 1)[0]
+ else:
+ # Windows 2000 or XP
+
+ # This is the localized name:
+ tzwin = keyvalues['StandardName']
+
+ # Open the list of timezones to look up the real name:
+ TZKEYNAME = r'SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones'
+ tzkey = winreg.OpenKey(handle, TZKEYNAME)
+
+ # Now, match this value to Time Zone information
+ tzkeyname = None
+ for i in range(winreg.QueryInfoKey(tzkey)[0]):
+ subkey = winreg.EnumKey(tzkey, i)
+ sub = winreg.OpenKey(tzkey, subkey)
+ data = valuestodict(sub)
+ sub.Close()
+ if data['Std'] == tzwin:
+ tzkeyname = subkey
+ break
+
+ tzkey.Close()
+ handle.Close()
+
+ if tzkeyname is None:
+ raise LookupError('Can not find Windows timezone configuration')
+
+ timezone = tz_names.get(tzkeyname)
+ if timezone is None:
+ # Nope, that didn't work. Try adding 'Standard Time',
+ # it seems to work a lot of times:
+ timezone = tz_names.get(tzkeyname + ' Standard Time')
+
+ # Return what we have.
+ if timezone is None:
+ raise pytz.UnknownTimeZoneError('Can not find timezone ' + tzkeyname)
+
+ return timezone
+
+
+def _get_localzone():
+ if winreg is None:
+ raise pytz.UnknownTimeZoneError(
+ 'Runtime support not available')
+ return pytz.timezone(get_localzone_name())
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/messages/__init__.py b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/messages/__init__.py
new file mode 100644
index 000000000..1b63bae2e
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/messages/__init__.py
@@ -0,0 +1,12 @@
+# -*- coding: utf-8 -*-
+"""
+ babel.messages
+ ~~~~~~~~~~~~~~
+
+ Support for ``gettext`` message catalogs.
+
+ :copyright: (c) 2013 by the Babel Team.
+ :license: BSD, see LICENSE for more details.
+"""
+
+from babel.messages.catalog import *
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/messages/catalog.py b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/messages/catalog.py
new file mode 100644
index 000000000..f72a34fca
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/messages/catalog.py
@@ -0,0 +1,819 @@
+# -*- coding: utf-8 -*-
+"""
+ babel.messages.catalog
+ ~~~~~~~~~~~~~~~~~~~~~~
+
+ Data structures for message catalogs.
+
+ :copyright: (c) 2013 by the Babel Team.
+ :license: BSD, see LICENSE for more details.
+"""
+
+import re
+import time
+
+from cgi import parse_header
+from datetime import datetime, time as time_
+from difflib import get_close_matches
+from email import message_from_string
+from copy import copy
+
+from babel import __version__ as VERSION
+from babel.core import Locale
+from babel.dates import format_datetime
+from babel.messages.plurals import get_plural
+from babel.util import odict, distinct, LOCALTZ, FixedOffsetTimezone
+from babel._compat import string_types, number_types, PY2, cmp
+
+__all__ = ['Message', 'Catalog', 'TranslationError']
+
+
+PYTHON_FORMAT = re.compile(r'''(?x)
+ \%
+ (?:\(([\w]*)\))?
+ (
+ [-#0\ +]?(?:\*|[\d]+)?
+ (?:\.(?:\*|[\d]+))?
+ [hlL]?
+ )
+ ([diouxXeEfFgGcrs%])
+''')
+
+
+def _parse_datetime_header(value):
+ match = re.match(r'^(?P.*?)(?P[+-]\d{4})?$', value)
+
+ tt = time.strptime(match.group('datetime'), '%Y-%m-%d %H:%M')
+ ts = time.mktime(tt)
+ dt = datetime.fromtimestamp(ts)
+
+ # Separate the offset into a sign component, hours, and # minutes
+ tzoffset = match.group('tzoffset')
+ if tzoffset is not None:
+ plus_minus_s, rest = tzoffset[0], tzoffset[1:]
+ hours_offset_s, mins_offset_s = rest[:2], rest[2:]
+
+ # Make them all integers
+ plus_minus = int(plus_minus_s + '1')
+ hours_offset = int(hours_offset_s)
+ mins_offset = int(mins_offset_s)
+
+ # Calculate net offset
+ net_mins_offset = hours_offset * 60
+ net_mins_offset += mins_offset
+ net_mins_offset *= plus_minus
+
+ # Create an offset object
+ tzoffset = FixedOffsetTimezone(net_mins_offset)
+
+ # Store the offset in a datetime object
+ dt = dt.replace(tzinfo=tzoffset)
+
+ return dt
+
+
+class Message(object):
+ """Representation of a single message in a catalog."""
+
+ def __init__(self, id, string=u'', locations=(), flags=(), auto_comments=(),
+ user_comments=(), previous_id=(), lineno=None, context=None):
+ """Create the message object.
+
+ :param id: the message ID, or a ``(singular, plural)`` tuple for
+ pluralizable messages
+ :param string: the translated message string, or a
+ ``(singular, plural)`` tuple for pluralizable messages
+ :param locations: a sequence of ``(filenname, lineno)`` tuples
+ :param flags: a set or sequence of flags
+ :param auto_comments: a sequence of automatic comments for the message
+ :param user_comments: a sequence of user comments for the message
+ :param previous_id: the previous message ID, or a ``(singular, plural)``
+ tuple for pluralizable messages
+ :param lineno: the line number on which the msgid line was found in the
+ PO file, if any
+ :param context: the message context
+ """
+ self.id = id
+ if not string and self.pluralizable:
+ string = (u'', u'')
+ self.string = string
+ self.locations = list(distinct(locations))
+ self.flags = set(flags)
+ if id and self.python_format:
+ self.flags.add('python-format')
+ else:
+ self.flags.discard('python-format')
+ self.auto_comments = list(distinct(auto_comments))
+ self.user_comments = list(distinct(user_comments))
+ if isinstance(previous_id, string_types):
+ self.previous_id = [previous_id]
+ else:
+ self.previous_id = list(previous_id)
+ self.lineno = lineno
+ self.context = context
+
+ def __repr__(self):
+ return '<%s %r (flags: %r)>' % (type(self).__name__, self.id,
+ list(self.flags))
+
+ def __cmp__(self, obj):
+ """Compare Messages, taking into account plural ids"""
+ def values_to_compare():
+ if isinstance(obj, Message):
+ plural = self.pluralizable
+ obj_plural = obj.pluralizable
+ if plural and obj_plural:
+ return self.id[0], obj.id[0]
+ elif plural:
+ return self.id[0], obj.id
+ elif obj_plural:
+ return self.id, obj.id[0]
+ return self.id, obj.id
+ this, other = values_to_compare()
+ return cmp(this, other)
+
+ def __gt__(self, other):
+ return self.__cmp__(other) > 0
+
+ def __lt__(self, other):
+ return self.__cmp__(other) < 0
+
+ def __ge__(self, other):
+ return self.__cmp__(other) >= 0
+
+ def __le__(self, other):
+ return self.__cmp__(other) <= 0
+
+ def __eq__(self, other):
+ return self.__cmp__(other) == 0
+
+ def __ne__(self, other):
+ return self.__cmp__(other) != 0
+
+ def clone(self):
+ return Message(*map(copy, (self.id, self.string, self.locations,
+ self.flags, self.auto_comments,
+ self.user_comments, self.previous_id,
+ self.lineno, self.context)))
+
+ def check(self, catalog=None):
+ """Run various validation checks on the message. Some validations
+ are only performed if the catalog is provided. This method returns
+ a sequence of `TranslationError` objects.
+
+ :rtype: ``iterator``
+ :param catalog: A catalog instance that is passed to the checkers
+ :see: `Catalog.check` for a way to perform checks for all messages
+ in a catalog.
+ """
+ from babel.messages.checkers import checkers
+ errors = []
+ for checker in checkers:
+ try:
+ checker(catalog, self)
+ except TranslationError as e:
+ errors.append(e)
+ return errors
+
+ @property
+ def fuzzy(self):
+ """Whether the translation is fuzzy.
+
+ >>> Message('foo').fuzzy
+ False
+ >>> msg = Message('foo', 'foo', flags=['fuzzy'])
+ >>> msg.fuzzy
+ True
+ >>> msg
+
+
+ :type: `bool`"""
+ return 'fuzzy' in self.flags
+
+ @property
+ def pluralizable(self):
+ """Whether the message is plurizable.
+
+ >>> Message('foo').pluralizable
+ False
+ >>> Message(('foo', 'bar')).pluralizable
+ True
+
+ :type: `bool`"""
+ return isinstance(self.id, (list, tuple))
+
+ @property
+ def python_format(self):
+ """Whether the message contains Python-style parameters.
+
+ >>> Message('foo %(name)s bar').python_format
+ True
+ >>> Message(('foo %(name)s', 'foo %(name)s')).python_format
+ True
+
+ :type: `bool`"""
+ ids = self.id
+ if not isinstance(ids, (list, tuple)):
+ ids = [ids]
+ return any(PYTHON_FORMAT.search(id) for id in ids)
+
+
+class TranslationError(Exception):
+ """Exception thrown by translation checkers when invalid message
+ translations are encountered."""
+
+
+DEFAULT_HEADER = u"""\
+# Translations template for PROJECT.
+# Copyright (C) YEAR ORGANIZATION
+# This file is distributed under the same license as the PROJECT project.
+# FIRST AUTHOR , YEAR.
+#"""
+
+
+if PY2:
+ def _parse_header(header_string):
+ # message_from_string only works for str, not for unicode
+ headers = message_from_string(header_string.encode('utf8'))
+ decoded_headers = {}
+ for name, value in headers.items():
+ name = name.decode('utf8')
+ value = value.decode('utf8')
+ decoded_headers[name] = value
+ return decoded_headers
+
+else:
+ _parse_header = message_from_string
+
+
+class Catalog(object):
+ """Representation of a message catalog."""
+
+ def __init__(self, locale=None, domain=None, header_comment=DEFAULT_HEADER,
+ project=None, version=None, copyright_holder=None,
+ msgid_bugs_address=None, creation_date=None,
+ revision_date=None, last_translator=None, language_team=None,
+ charset=None, fuzzy=True):
+ """Initialize the catalog object.
+
+ :param locale: the locale identifier or `Locale` object, or `None`
+ if the catalog is not bound to a locale (which basically
+ means it's a template)
+ :param domain: the message domain
+ :param header_comment: the header comment as string, or `None` for the
+ default header
+ :param project: the project's name
+ :param version: the project's version
+ :param copyright_holder: the copyright holder of the catalog
+ :param msgid_bugs_address: the email address or URL to submit bug
+ reports to
+ :param creation_date: the date the catalog was created
+ :param revision_date: the date the catalog was revised
+ :param last_translator: the name and email of the last translator
+ :param language_team: the name and email of the language team
+ :param charset: the encoding to use in the output (defaults to utf-8)
+ :param fuzzy: the fuzzy bit on the catalog header
+ """
+ self.domain = domain
+ if locale:
+ locale = Locale.parse(locale)
+ self.locale = locale
+ self._header_comment = header_comment
+ self._messages = odict()
+
+ self.project = project or 'PROJECT'
+ self.version = version or 'VERSION'
+ self.copyright_holder = copyright_holder or 'ORGANIZATION'
+ self.msgid_bugs_address = msgid_bugs_address or 'EMAIL@ADDRESS'
+
+ self.last_translator = last_translator or 'FULL NAME '
+ """Name and email address of the last translator."""
+ self.language_team = language_team or 'LANGUAGE '
+ """Name and email address of the language team."""
+
+ self.charset = charset or 'utf-8'
+
+ if creation_date is None:
+ creation_date = datetime.now(LOCALTZ)
+ elif isinstance(creation_date, datetime) and not creation_date.tzinfo:
+ creation_date = creation_date.replace(tzinfo=LOCALTZ)
+ self.creation_date = creation_date
+ if revision_date is None:
+ revision_date = 'YEAR-MO-DA HO:MI+ZONE'
+ elif isinstance(revision_date, datetime) and not revision_date.tzinfo:
+ revision_date = revision_date.replace(tzinfo=LOCALTZ)
+ self.revision_date = revision_date
+ self.fuzzy = fuzzy
+
+ self.obsolete = odict() # Dictionary of obsolete messages
+ self._num_plurals = None
+ self._plural_expr = None
+
+ def _get_header_comment(self):
+ comment = self._header_comment
+ year = datetime.now(LOCALTZ).strftime('%Y')
+ if hasattr(self.revision_date, 'strftime'):
+ year = self.revision_date.strftime('%Y')
+ comment = comment.replace('PROJECT', self.project) \
+ .replace('VERSION', self.version) \
+ .replace('YEAR', year) \
+ .replace('ORGANIZATION', self.copyright_holder)
+ if self.locale:
+ comment = comment.replace('Translations template', '%s translations'
+ % self.locale.english_name)
+ return comment
+
+ def _set_header_comment(self, string):
+ self._header_comment = string
+
+ header_comment = property(_get_header_comment, _set_header_comment, doc="""\
+ The header comment for the catalog.
+
+ >>> catalog = Catalog(project='Foobar', version='1.0',
+ ... copyright_holder='Foo Company')
+ >>> print(catalog.header_comment) #doctest: +ELLIPSIS
+ # Translations template for Foobar.
+ # Copyright (C) ... Foo Company
+ # This file is distributed under the same license as the Foobar project.
+ # FIRST AUTHOR , ....
+ #
+
+ The header can also be set from a string. Any known upper-case variables
+ will be replaced when the header is retrieved again:
+
+ >>> catalog = Catalog(project='Foobar', version='1.0',
+ ... copyright_holder='Foo Company')
+ >>> catalog.header_comment = '''\\
+ ... # The POT for my really cool PROJECT project.
+ ... # Copyright (C) 1990-2003 ORGANIZATION
+ ... # This file is distributed under the same license as the PROJECT
+ ... # project.
+ ... #'''
+ >>> print(catalog.header_comment)
+ # The POT for my really cool Foobar project.
+ # Copyright (C) 1990-2003 Foo Company
+ # This file is distributed under the same license as the Foobar
+ # project.
+ #
+
+ :type: `unicode`
+ """)
+
+ def _get_mime_headers(self):
+ headers = []
+ headers.append(('Project-Id-Version',
+ '%s %s' % (self.project, self.version)))
+ headers.append(('Report-Msgid-Bugs-To', self.msgid_bugs_address))
+ headers.append(('POT-Creation-Date',
+ format_datetime(self.creation_date, 'yyyy-MM-dd HH:mmZ',
+ locale='en')))
+ if isinstance(self.revision_date, (datetime, time_) + number_types):
+ headers.append(('PO-Revision-Date',
+ format_datetime(self.revision_date,
+ 'yyyy-MM-dd HH:mmZ', locale='en')))
+ else:
+ headers.append(('PO-Revision-Date', self.revision_date))
+ headers.append(('Last-Translator', self.last_translator))
+ if self.locale is not None:
+ headers.append(('Language', str(self.locale)))
+ if (self.locale is not None) and ('LANGUAGE' in self.language_team):
+ headers.append(('Language-Team',
+ self.language_team.replace('LANGUAGE',
+ str(self.locale))))
+ else:
+ headers.append(('Language-Team', self.language_team))
+ if self.locale is not None:
+ headers.append(('Plural-Forms', self.plural_forms))
+ headers.append(('MIME-Version', '1.0'))
+ headers.append(('Content-Type',
+ 'text/plain; charset=%s' % self.charset))
+ headers.append(('Content-Transfer-Encoding', '8bit'))
+ headers.append(('Generated-By', 'Babel %s\n' % VERSION))
+ return headers
+
+ def _set_mime_headers(self, headers):
+ for name, value in headers:
+ name = name.lower()
+ if name == 'project-id-version':
+ parts = value.split(' ')
+ self.project = u' '.join(parts[:-1])
+ self.version = parts[-1]
+ elif name == 'report-msgid-bugs-to':
+ self.msgid_bugs_address = value
+ elif name == 'last-translator':
+ self.last_translator = value
+ elif name == 'language-team':
+ self.language_team = value
+ elif name == 'content-type':
+ mimetype, params = parse_header(value)
+ if 'charset' in params:
+ self.charset = params['charset'].lower()
+ elif name == 'plural-forms':
+ _, params = parse_header(' ;' + value)
+ self._num_plurals = int(params.get('nplurals', 2))
+ self._plural_expr = params.get('plural', '(n != 1)')
+ elif name == 'pot-creation-date':
+ self.creation_date = _parse_datetime_header(value)
+ elif name == 'po-revision-date':
+ # Keep the value if it's not the default one
+ if 'YEAR' not in value:
+ self.revision_date = _parse_datetime_header(value)
+
+ mime_headers = property(_get_mime_headers, _set_mime_headers, doc="""\
+ The MIME headers of the catalog, used for the special ``msgid ""`` entry.
+
+ The behavior of this property changes slightly depending on whether a locale
+ is set or not, the latter indicating that the catalog is actually a template
+ for actual translations.
+
+ Here's an example of the output for such a catalog template:
+
+ >>> from babel.dates import UTC
+ >>> created = datetime(1990, 4, 1, 15, 30, tzinfo=UTC)
+ >>> catalog = Catalog(project='Foobar', version='1.0',
+ ... creation_date=created)
+ >>> for name, value in catalog.mime_headers:
+ ... print('%s: %s' % (name, value))
+ Project-Id-Version: Foobar 1.0
+ Report-Msgid-Bugs-To: EMAIL@ADDRESS
+ POT-Creation-Date: 1990-04-01 15:30+0000
+ PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE
+ Last-Translator: FULL NAME
+ Language-Team: LANGUAGE
+ MIME-Version: 1.0
+ Content-Type: text/plain; charset=utf-8
+ Content-Transfer-Encoding: 8bit
+ Generated-By: Babel ...
+
+ And here's an example of the output when the locale is set:
+
+ >>> revised = datetime(1990, 8, 3, 12, 0, tzinfo=UTC)
+ >>> catalog = Catalog(locale='de_DE', project='Foobar', version='1.0',
+ ... creation_date=created, revision_date=revised,
+ ... last_translator='John Doe ',
+ ... language_team='de_DE ')
+ >>> for name, value in catalog.mime_headers:
+ ... print('%s: %s' % (name, value))
+ Project-Id-Version: Foobar 1.0
+ Report-Msgid-Bugs-To: EMAIL@ADDRESS
+ POT-Creation-Date: 1990-04-01 15:30+0000
+ PO-Revision-Date: 1990-08-03 12:00+0000
+ Last-Translator: John Doe
+ Language: de_DE
+ Language-Team: de_DE
+ Plural-Forms: nplurals=2; plural=(n != 1)
+ MIME-Version: 1.0
+ Content-Type: text/plain; charset=utf-8
+ Content-Transfer-Encoding: 8bit
+ Generated-By: Babel ...
+
+ :type: `list`
+ """)
+
+ @property
+ def num_plurals(self):
+ """The number of plurals used by the catalog or locale.
+
+ >>> Catalog(locale='en').num_plurals
+ 2
+ >>> Catalog(locale='ga').num_plurals
+ 3
+
+ :type: `int`"""
+ if self._num_plurals is None:
+ num = 2
+ if self.locale:
+ num = get_plural(self.locale)[0]
+ self._num_plurals = num
+ return self._num_plurals
+
+ @property
+ def plural_expr(self):
+ """The plural expression used by the catalog or locale.
+
+ >>> Catalog(locale='en').plural_expr
+ '(n != 1)'
+ >>> Catalog(locale='ga').plural_expr
+ '(n==1 ? 0 : n==2 ? 1 : 2)'
+
+ :type: `string_types`"""
+ if self._plural_expr is None:
+ expr = '(n != 1)'
+ if self.locale:
+ expr = get_plural(self.locale)[1]
+ self._plural_expr = expr
+ return self._plural_expr
+
+ @property
+ def plural_forms(self):
+ """Return the plural forms declaration for the locale.
+
+ >>> Catalog(locale='en').plural_forms
+ 'nplurals=2; plural=(n != 1)'
+ >>> Catalog(locale='pt_BR').plural_forms
+ 'nplurals=2; plural=(n > 1)'
+
+ :type: `str`"""
+ return 'nplurals=%s; plural=%s' % (self.num_plurals, self.plural_expr)
+
+ def __contains__(self, id):
+ """Return whether the catalog has a message with the specified ID."""
+ return self._key_for(id) in self._messages
+
+ def __len__(self):
+ """The number of messages in the catalog.
+
+ This does not include the special ``msgid ""`` entry."""
+ return len(self._messages)
+
+ def __iter__(self):
+ """Iterates through all the entries in the catalog, in the order they
+ were added, yielding a `Message` object for every entry.
+
+ :rtype: ``iterator``"""
+ buf = []
+ for name, value in self.mime_headers:
+ buf.append('%s: %s' % (name, value))
+ flags = set()
+ if self.fuzzy:
+ flags |= set(['fuzzy'])
+ yield Message(u'', '\n'.join(buf), flags=flags)
+ for key in self._messages:
+ yield self._messages[key]
+
+ def __repr__(self):
+ locale = ''
+ if self.locale:
+ locale = ' %s' % self.locale
+ return '<%s %r%s>' % (type(self).__name__, self.domain, locale)
+
+ def __delitem__(self, id):
+ """Delete the message with the specified ID."""
+ self.delete(id)
+
+ def __getitem__(self, id):
+ """Return the message with the specified ID.
+
+ :param id: the message ID
+ """
+ return self.get(id)
+
+ def __setitem__(self, id, message):
+ """Add or update the message with the specified ID.
+
+ >>> catalog = Catalog()
+ >>> catalog[u'foo'] = Message(u'foo')
+ >>> catalog[u'foo']
+
+
+ If a message with that ID is already in the catalog, it is updated
+ to include the locations and flags of the new message.
+
+ >>> catalog = Catalog()
+ >>> catalog[u'foo'] = Message(u'foo', locations=[('main.py', 1)])
+ >>> catalog[u'foo'].locations
+ [('main.py', 1)]
+ >>> catalog[u'foo'] = Message(u'foo', locations=[('utils.py', 5)])
+ >>> catalog[u'foo'].locations
+ [('main.py', 1), ('utils.py', 5)]
+
+ :param id: the message ID
+ :param message: the `Message` object
+ """
+ assert isinstance(message, Message), 'expected a Message object'
+ key = self._key_for(id, message.context)
+ current = self._messages.get(key)
+ if current:
+ if message.pluralizable and not current.pluralizable:
+ # The new message adds pluralization
+ current.id = message.id
+ current.string = message.string
+ current.locations = list(distinct(current.locations +
+ message.locations))
+ current.auto_comments = list(distinct(current.auto_comments +
+ message.auto_comments))
+ current.user_comments = list(distinct(current.user_comments +
+ message.user_comments))
+ current.flags |= message.flags
+ message = current
+ elif id == '':
+ # special treatment for the header message
+ self.mime_headers = _parse_header(message.string).items()
+ self.header_comment = '\n'.join([('# %s' % c).rstrip() for c
+ in message.user_comments])
+ self.fuzzy = message.fuzzy
+ else:
+ if isinstance(id, (list, tuple)):
+ assert isinstance(message.string, (list, tuple)), \
+ 'Expected sequence but got %s' % type(message.string)
+ self._messages[key] = message
+
+ def add(self, id, string=None, locations=(), flags=(), auto_comments=(),
+ user_comments=(), previous_id=(), lineno=None, context=None):
+ """Add or update the message with the specified ID.
+
+ >>> catalog = Catalog()
+ >>> catalog.add(u'foo')
+
+ >>> catalog[u'foo']
+
+
+ This method simply constructs a `Message` object with the given
+ arguments and invokes `__setitem__` with that object.
+
+ :param id: the message ID, or a ``(singular, plural)`` tuple for
+ pluralizable messages
+ :param string: the translated message string, or a
+ ``(singular, plural)`` tuple for pluralizable messages
+ :param locations: a sequence of ``(filenname, lineno)`` tuples
+ :param flags: a set or sequence of flags
+ :param auto_comments: a sequence of automatic comments
+ :param user_comments: a sequence of user comments
+ :param previous_id: the previous message ID, or a ``(singular, plural)``
+ tuple for pluralizable messages
+ :param lineno: the line number on which the msgid line was found in the
+ PO file, if any
+ :param context: the message context
+ """
+ message = Message(id, string, list(locations), flags, auto_comments,
+ user_comments, previous_id, lineno=lineno,
+ context=context)
+ self[id] = message
+ return message
+
+ def check(self):
+ """Run various validation checks on the translations in the catalog.
+
+ For every message which fails validation, this method yield a
+ ``(message, errors)`` tuple, where ``message`` is the `Message` object
+ and ``errors`` is a sequence of `TranslationError` objects.
+
+ :rtype: ``iterator``
+ """
+ for message in self._messages.values():
+ errors = message.check(catalog=self)
+ if errors:
+ yield message, errors
+
+ def get(self, id, context=None):
+ """Return the message with the specified ID and context.
+
+ :param id: the message ID
+ :param context: the message context, or ``None`` for no context
+ """
+ return self._messages.get(self._key_for(id, context))
+
+ def delete(self, id, context=None):
+ """Delete the message with the specified ID and context.
+
+ :param id: the message ID
+ :param context: the message context, or ``None`` for no context
+ """
+ key = self._key_for(id, context)
+ if key in self._messages:
+ del self._messages[key]
+
+ def update(self, template, no_fuzzy_matching=False):
+ """Update the catalog based on the given template catalog.
+
+ >>> from babel.messages import Catalog
+ >>> template = Catalog()
+ >>> template.add('green', locations=[('main.py', 99)])
+
+ >>> template.add('blue', locations=[('main.py', 100)])
+
+ >>> template.add(('salad', 'salads'), locations=[('util.py', 42)])
+
+ >>> catalog = Catalog(locale='de_DE')
+ >>> catalog.add('blue', u'blau', locations=[('main.py', 98)])
+
+ >>> catalog.add('head', u'Kopf', locations=[('util.py', 33)])
+
+ >>> catalog.add(('salad', 'salads'), (u'Salat', u'Salate'),
+ ... locations=[('util.py', 38)])
+
+
+ >>> catalog.update(template)
+ >>> len(catalog)
+ 3
+
+ >>> msg1 = catalog['green']
+ >>> msg1.string
+ >>> msg1.locations
+ [('main.py', 99)]
+
+ >>> msg2 = catalog['blue']
+ >>> msg2.string
+ u'blau'
+ >>> msg2.locations
+ [('main.py', 100)]
+
+ >>> msg3 = catalog['salad']
+ >>> msg3.string
+ (u'Salat', u'Salate')
+ >>> msg3.locations
+ [('util.py', 42)]
+
+ Messages that are in the catalog but not in the template are removed
+ from the main collection, but can still be accessed via the `obsolete`
+ member:
+
+ >>> 'head' in catalog
+ False
+ >>> list(catalog.obsolete.values())
+ []
+
+ :param template: the reference catalog, usually read from a POT file
+ :param no_fuzzy_matching: whether to use fuzzy matching of message IDs
+ """
+ messages = self._messages
+ remaining = messages.copy()
+ self._messages = odict()
+
+ # Prepare for fuzzy matching
+ fuzzy_candidates = []
+ if not no_fuzzy_matching:
+ fuzzy_candidates = dict([
+ (self._key_for(msgid), messages[msgid].context)
+ for msgid in messages if msgid and messages[msgid].string
+ ])
+ fuzzy_matches = set()
+
+ def _merge(message, oldkey, newkey):
+ message = message.clone()
+ fuzzy = False
+ if oldkey != newkey:
+ fuzzy = True
+ fuzzy_matches.add(oldkey)
+ oldmsg = messages.get(oldkey)
+ if isinstance(oldmsg.id, string_types):
+ message.previous_id = [oldmsg.id]
+ else:
+ message.previous_id = list(oldmsg.id)
+ else:
+ oldmsg = remaining.pop(oldkey, None)
+ message.string = oldmsg.string
+ if isinstance(message.id, (list, tuple)):
+ if not isinstance(message.string, (list, tuple)):
+ fuzzy = True
+ message.string = tuple(
+ [message.string] + ([u''] * (len(message.id) - 1))
+ )
+ elif len(message.string) != self.num_plurals:
+ fuzzy = True
+ message.string = tuple(message.string[:len(oldmsg.string)])
+ elif isinstance(message.string, (list, tuple)):
+ fuzzy = True
+ message.string = message.string[0]
+ message.flags |= oldmsg.flags
+ if fuzzy:
+ message.flags |= set([u'fuzzy'])
+ self[message.id] = message
+
+ for message in template:
+ if message.id:
+ key = self._key_for(message.id, message.context)
+ if key in messages:
+ _merge(message, key, key)
+ else:
+ if no_fuzzy_matching is False:
+ # do some fuzzy matching with difflib
+ if isinstance(key, tuple):
+ matchkey = key[0] # just the msgid, no context
+ else:
+ matchkey = key
+ matches = get_close_matches(matchkey.lower().strip(),
+ fuzzy_candidates.keys(), 1)
+ if matches:
+ newkey = matches[0]
+ newctxt = fuzzy_candidates[newkey]
+ if newctxt is not None:
+ newkey = newkey, newctxt
+ _merge(message, newkey, key)
+ continue
+
+ self[message.id] = message
+
+ for msgid in remaining:
+ if no_fuzzy_matching or msgid not in fuzzy_matches:
+ self.obsolete[msgid] = remaining[msgid]
+
+ # Allow the updated catalog's header to be rewritten based on the
+ # template's header
+ self.header_comment = template.header_comment
+
+ # Make updated catalog's POT-Creation-Date equal to the template
+ # used to update the catalog
+ self.creation_date = template.creation_date
+
+ def _key_for(self, id, context=None):
+ """The key for a message is just the singular ID even for pluralizable
+ messages, but is a ``(msgid, msgctxt)`` tuple for context-specific
+ messages.
+ """
+ key = id
+ if isinstance(key, (list, tuple)):
+ key = id[0]
+ if context is not None:
+ key = (key, context)
+ return key
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/messages/checkers.py b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/messages/checkers.py
new file mode 100644
index 000000000..24ecdcfed
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/messages/checkers.py
@@ -0,0 +1,173 @@
+# -*- coding: utf-8 -*-
+"""
+ babel.messages.checkers
+ ~~~~~~~~~~~~~~~~~~~~~~~
+
+ Various routines that help with validation of translations.
+
+ :since: version 0.9
+
+ :copyright: (c) 2013 by the Babel Team.
+ :license: BSD, see LICENSE for more details.
+"""
+
+from babel.messages.catalog import TranslationError, PYTHON_FORMAT
+from babel._compat import string_types, izip
+
+
+#: list of format chars that are compatible to each other
+_string_format_compatibilities = [
+ set(['i', 'd', 'u']),
+ set(['x', 'X']),
+ set(['f', 'F', 'g', 'G'])
+]
+
+
+def num_plurals(catalog, message):
+ """Verify the number of plurals in the translation."""
+ if not message.pluralizable:
+ if not isinstance(message.string, string_types):
+ raise TranslationError("Found plural forms for non-pluralizable "
+ "message")
+ return
+
+ # skip further tests if no catalog is provided.
+ elif catalog is None:
+ return
+
+ msgstrs = message.string
+ if not isinstance(msgstrs, (list, tuple)):
+ msgstrs = (msgstrs,)
+ if len(msgstrs) != catalog.num_plurals:
+ raise TranslationError("Wrong number of plural forms (expected %d)" %
+ catalog.num_plurals)
+
+
+def python_format(catalog, message):
+ """Verify the format string placeholders in the translation."""
+ if 'python-format' not in message.flags:
+ return
+ msgids = message.id
+ if not isinstance(msgids, (list, tuple)):
+ msgids = (msgids,)
+ msgstrs = message.string
+ if not isinstance(msgstrs, (list, tuple)):
+ msgstrs = (msgstrs,)
+
+ for msgid, msgstr in izip(msgids, msgstrs):
+ if msgstr:
+ _validate_format(msgid, msgstr)
+
+
+def _validate_format(format, alternative):
+ """Test format string `alternative` against `format`. `format` can be the
+ msgid of a message and `alternative` one of the `msgstr`\s. The two
+ arguments are not interchangeable as `alternative` may contain less
+ placeholders if `format` uses named placeholders.
+
+ The behavior of this function is undefined if the string does not use
+ string formattings.
+
+ If the string formatting of `alternative` is compatible to `format` the
+ function returns `None`, otherwise a `TranslationError` is raised.
+
+ Examples for compatible format strings:
+
+ >>> _validate_format('Hello %s!', 'Hallo %s!')
+ >>> _validate_format('Hello %i!', 'Hallo %d!')
+
+ Example for an incompatible format strings:
+
+ >>> _validate_format('Hello %(name)s!', 'Hallo %s!')
+ Traceback (most recent call last):
+ ...
+ TranslationError: the format strings are of different kinds
+
+ This function is used by the `python_format` checker.
+
+ :param format: The original format string
+ :param alternative: The alternative format string that should be checked
+ against format
+ :raises TranslationError: on formatting errors
+ """
+
+ def _parse(string):
+ result = []
+ for match in PYTHON_FORMAT.finditer(string):
+ name, format, typechar = match.groups()
+ if typechar == '%' and name is None:
+ continue
+ result.append((name, str(typechar)))
+ return result
+
+ def _compatible(a, b):
+ if a == b:
+ return True
+ for set in _string_format_compatibilities:
+ if a in set and b in set:
+ return True
+ return False
+
+ def _check_positional(results):
+ positional = None
+ for name, char in results:
+ if positional is None:
+ positional = name is None
+ else:
+ if (name is None) != positional:
+ raise TranslationError('format string mixes positional '
+ 'and named placeholders')
+ return bool(positional)
+
+ a, b = map(_parse, (format, alternative))
+
+ # now check if both strings are positional or named
+ a_positional, b_positional = map(_check_positional, (a, b))
+ if a_positional and not b_positional and not b:
+ raise TranslationError('placeholders are incompatible')
+ elif a_positional != b_positional:
+ raise TranslationError('the format strings are of different kinds')
+
+ # if we are operating on positional strings both must have the
+ # same number of format chars and those must be compatible
+ if a_positional:
+ if len(a) != len(b):
+ raise TranslationError('positional format placeholders are '
+ 'unbalanced')
+ for idx, ((_, first), (_, second)) in enumerate(izip(a, b)):
+ if not _compatible(first, second):
+ raise TranslationError('incompatible format for placeholder '
+ '%d: %r and %r are not compatible' %
+ (idx + 1, first, second))
+
+ # otherwise the second string must not have names the first one
+ # doesn't have and the types of those included must be compatible
+ else:
+ type_map = dict(a)
+ for name, typechar in b:
+ if name not in type_map:
+ raise TranslationError('unknown named placeholder %r' % name)
+ elif not _compatible(typechar, type_map[name]):
+ raise TranslationError('incompatible format for '
+ 'placeholder %r: '
+ '%r and %r are not compatible' %
+ (name, typechar, type_map[name]))
+
+
+def _find_checkers():
+ checkers = []
+ try:
+ from pkg_resources import working_set
+ except ImportError:
+ pass
+ else:
+ for entry_point in working_set.iter_entry_points('babel.checkers'):
+ checkers.append(entry_point.load())
+ if len(checkers) == 0:
+ # if pkg_resources is not available or no usable egg-info was found
+ # (see #230), just resort to hard-coded checkers
+ return [num_plurals, python_format]
+ return checkers
+
+
+checkers = _find_checkers()
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/messages/extract.py b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/messages/extract.py
new file mode 100644
index 000000000..8fe3f606c
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/messages/extract.py
@@ -0,0 +1,567 @@
+# -*- coding: utf-8 -*-
+"""
+ babel.messages.extract
+ ~~~~~~~~~~~~~~~~~~~~~~
+
+ Basic infrastructure for extracting localizable messages from source files.
+
+ This module defines an extensible system for collecting localizable message
+ strings from a variety of sources. A native extractor for Python source
+ files is builtin, extractors for other sources can be added using very
+ simple plugins.
+
+ The main entry points into the extraction functionality are the functions
+ `extract_from_dir` and `extract_from_file`.
+
+ :copyright: (c) 2013 by the Babel Team.
+ :license: BSD, see LICENSE for more details.
+"""
+
+import os
+from os.path import relpath
+import sys
+from tokenize import generate_tokens, COMMENT, NAME, OP, STRING
+
+from babel.util import parse_encoding, pathmatch
+from babel._compat import PY2, text_type
+from textwrap import dedent
+
+
+GROUP_NAME = 'babel.extractors'
+
+DEFAULT_KEYWORDS = {
+ '_': None,
+ 'gettext': None,
+ 'ngettext': (1, 2),
+ 'ugettext': None,
+ 'ungettext': (1, 2),
+ 'dgettext': (2,),
+ 'dngettext': (2, 3),
+ 'N_': None,
+ 'pgettext': ((1, 'c'), 2)
+}
+
+DEFAULT_MAPPING = [('**.py', 'python')]
+
+empty_msgid_warning = (
+'%s: warning: Empty msgid. It is reserved by GNU gettext: gettext("") '
+'returns the header entry with meta information, not the empty string.')
+
+
+def _strip_comment_tags(comments, tags):
+ """Helper function for `extract` that strips comment tags from strings
+ in a list of comment lines. This functions operates in-place.
+ """
+ def _strip(line):
+ for tag in tags:
+ if line.startswith(tag):
+ return line[len(tag):].strip()
+ return line
+ comments[:] = map(_strip, comments)
+
+
+def extract_from_dir(dirname=None, method_map=DEFAULT_MAPPING,
+ options_map=None, keywords=DEFAULT_KEYWORDS,
+ comment_tags=(), callback=None, strip_comment_tags=False):
+ """Extract messages from any source files found in the given directory.
+
+ This function generates tuples of the form ``(filename, lineno, message,
+ comments, context)``.
+
+ Which extraction method is used per file is determined by the `method_map`
+ parameter, which maps extended glob patterns to extraction method names.
+ For example, the following is the default mapping:
+
+ >>> method_map = [
+ ... ('**.py', 'python')
+ ... ]
+
+ This basically says that files with the filename extension ".py" at any
+ level inside the directory should be processed by the "python" extraction
+ method. Files that don't match any of the mapping patterns are ignored. See
+ the documentation of the `pathmatch` function for details on the pattern
+ syntax.
+
+ The following extended mapping would also use the "genshi" extraction
+ method on any file in "templates" subdirectory:
+
+ >>> method_map = [
+ ... ('**/templates/**.*', 'genshi'),
+ ... ('**.py', 'python')
+ ... ]
+
+ The dictionary provided by the optional `options_map` parameter augments
+ these mappings. It uses extended glob patterns as keys, and the values are
+ dictionaries mapping options names to option values (both strings).
+
+ The glob patterns of the `options_map` do not necessarily need to be the
+ same as those used in the method mapping. For example, while all files in
+ the ``templates`` folders in an application may be Genshi applications, the
+ options for those files may differ based on extension:
+
+ >>> options_map = {
+ ... '**/templates/**.txt': {
+ ... 'template_class': 'genshi.template:TextTemplate',
+ ... 'encoding': 'latin-1'
+ ... },
+ ... '**/templates/**.html': {
+ ... 'include_attrs': ''
+ ... }
+ ... }
+
+ :param dirname: the path to the directory to extract messages from. If
+ not given the current working directory is used.
+ :param method_map: a list of ``(pattern, method)`` tuples that maps of
+ extraction method names to extended glob patterns
+ :param options_map: a dictionary of additional options (optional)
+ :param keywords: a dictionary mapping keywords (i.e. names of functions
+ that should be recognized as translation functions) to
+ tuples that specify which of their arguments contain
+ localizable strings
+ :param comment_tags: a list of tags of translator comments to search for
+ and include in the results
+ :param callback: a function that is called for every file that message are
+ extracted from, just before the extraction itself is
+ performed; the function is passed the filename, the name
+ of the extraction method and and the options dictionary as
+ positional arguments, in that order
+ :param strip_comment_tags: a flag that if set to `True` causes all comment
+ tags to be removed from the collected comments.
+ :see: `pathmatch`
+ """
+ if dirname is None:
+ dirname = os.getcwd()
+ if options_map is None:
+ options_map = {}
+
+ absname = os.path.abspath(dirname)
+ for root, dirnames, filenames in os.walk(absname):
+ for subdir in dirnames:
+ if subdir.startswith('.') or subdir.startswith('_'):
+ dirnames.remove(subdir)
+ dirnames.sort()
+ filenames.sort()
+ for filename in filenames:
+ filename = relpath(
+ os.path.join(root, filename).replace(os.sep, '/'),
+ dirname
+ )
+ for pattern, method in method_map:
+ if pathmatch(pattern, filename):
+ filepath = os.path.join(absname, filename)
+ options = {}
+ for opattern, odict in options_map.items():
+ if pathmatch(opattern, filename):
+ options = odict
+ if callback:
+ callback(filename, method, options)
+ for lineno, message, comments, context in \
+ extract_from_file(method, filepath,
+ keywords=keywords,
+ comment_tags=comment_tags,
+ options=options,
+ strip_comment_tags=
+ strip_comment_tags):
+ yield filename, lineno, message, comments, context
+ break
+
+
+def extract_from_file(method, filename, keywords=DEFAULT_KEYWORDS,
+ comment_tags=(), options=None, strip_comment_tags=False):
+ """Extract messages from a specific file.
+
+ This function returns a list of tuples of the form ``(lineno, funcname,
+ message)``.
+
+ :param filename: the path to the file to extract messages from
+ :param method: a string specifying the extraction method (.e.g. "python")
+ :param keywords: a dictionary mapping keywords (i.e. names of functions
+ that should be recognized as translation functions) to
+ tuples that specify which of their arguments contain
+ localizable strings
+ :param comment_tags: a list of translator tags to search for and include
+ in the results
+ :param strip_comment_tags: a flag that if set to `True` causes all comment
+ tags to be removed from the collected comments.
+ :param options: a dictionary of additional options (optional)
+ """
+ fileobj = open(filename, 'rb')
+ try:
+ return list(extract(method, fileobj, keywords, comment_tags, options,
+ strip_comment_tags))
+ finally:
+ fileobj.close()
+
+
+def extract(method, fileobj, keywords=DEFAULT_KEYWORDS, comment_tags=(),
+ options=None, strip_comment_tags=False):
+ """Extract messages from the given file-like object using the specified
+ extraction method.
+
+ This function returns tuples of the form ``(lineno, message, comments)``.
+
+ The implementation dispatches the actual extraction to plugins, based on the
+ value of the ``method`` parameter.
+
+ >>> source = b'''# foo module
+ ... def run(argv):
+ ... print(_('Hello, world!'))
+ ... '''
+
+ >>> from babel._compat import BytesIO
+ >>> for message in extract('python', BytesIO(source)):
+ ... print(message)
+ (3, u'Hello, world!', [], None)
+
+ :param method: an extraction method (a callable), or
+ a string specifying the extraction method (.e.g. "python");
+ if this is a simple name, the extraction function will be
+ looked up by entry point; if it is an explicit reference
+ to a function (of the form ``package.module:funcname`` or
+ ``package.module.funcname``), the corresponding function
+ will be imported and used
+ :param fileobj: the file-like object the messages should be extracted from
+ :param keywords: a dictionary mapping keywords (i.e. names of functions
+ that should be recognized as translation functions) to
+ tuples that specify which of their arguments contain
+ localizable strings
+ :param comment_tags: a list of translator tags to search for and include
+ in the results
+ :param options: a dictionary of additional options (optional)
+ :param strip_comment_tags: a flag that if set to `True` causes all comment
+ tags to be removed from the collected comments.
+ :raise ValueError: if the extraction method is not registered
+ """
+ func = None
+ if callable(method):
+ func = method
+ elif ':' in method or '.' in method:
+ if ':' not in method:
+ lastdot = method.rfind('.')
+ module, attrname = method[:lastdot], method[lastdot + 1:]
+ else:
+ module, attrname = method.split(':', 1)
+ func = getattr(__import__(module, {}, {}, [attrname]), attrname)
+ else:
+ try:
+ from pkg_resources import working_set
+ except ImportError:
+ pass
+ else:
+ for entry_point in working_set.iter_entry_points(GROUP_NAME,
+ method):
+ func = entry_point.load(require=True)
+ break
+ if func is None:
+ # if pkg_resources is not available or no usable egg-info was found
+ # (see #230), we resort to looking up the builtin extractors
+ # directly
+ builtin = {
+ 'ignore': extract_nothing,
+ 'python': extract_python,
+ 'javascript': extract_javascript
+ }
+ func = builtin.get(method)
+
+ if func is None:
+ raise ValueError('Unknown extraction method %r' % method)
+
+ results = func(fileobj, keywords.keys(), comment_tags,
+ options=options or {})
+
+ for lineno, funcname, messages, comments in results:
+ if funcname:
+ spec = keywords[funcname] or (1,)
+ else:
+ spec = (1,)
+ if not isinstance(messages, (list, tuple)):
+ messages = [messages]
+ if not messages:
+ continue
+
+ # Validate the messages against the keyword's specification
+ context = None
+ msgs = []
+ invalid = False
+ # last_index is 1 based like the keyword spec
+ last_index = len(messages)
+ for index in spec:
+ if isinstance(index, tuple):
+ context = messages[index[0] - 1]
+ continue
+ if last_index < index:
+ # Not enough arguments
+ invalid = True
+ break
+ message = messages[index - 1]
+ if message is None:
+ invalid = True
+ break
+ msgs.append(message)
+ if invalid:
+ continue
+
+ # keyword spec indexes are 1 based, therefore '-1'
+ if isinstance(spec[0], tuple):
+ # context-aware *gettext method
+ first_msg_index = spec[1] - 1
+ else:
+ first_msg_index = spec[0] - 1
+ if not messages[first_msg_index]:
+ # An empty string msgid isn't valid, emit a warning
+ where = '%s:%i' % (hasattr(fileobj, 'name') and \
+ fileobj.name or '(unknown)', lineno)
+ sys.stderr.write((empty_msgid_warning % where) + '\n')
+ continue
+
+ messages = tuple(msgs)
+ if len(messages) == 1:
+ messages = messages[0]
+
+ if strip_comment_tags:
+ _strip_comment_tags(comments, comment_tags)
+ yield lineno, messages, comments, context
+
+
+def extract_nothing(fileobj, keywords, comment_tags, options):
+ """Pseudo extractor that does not actually extract anything, but simply
+ returns an empty list.
+ """
+ return []
+
+
+def extract_python(fileobj, keywords, comment_tags, options):
+ """Extract messages from Python source code.
+
+ It returns an iterator yielding tuples in the following form ``(lineno,
+ funcname, message, comments)``.
+
+ :param fileobj: the seekable, file-like object the messages should be
+ extracted from
+ :param keywords: a list of keywords (i.e. function names) that should be
+ recognized as translation functions
+ :param comment_tags: a list of translator tags to search for and include
+ in the results
+ :param options: a dictionary of additional options (optional)
+ :rtype: ``iterator``
+ """
+ funcname = lineno = message_lineno = None
+ call_stack = -1
+ buf = []
+ messages = []
+ translator_comments = []
+ in_def = in_translator_comments = False
+ comment_tag = None
+
+ encoding = parse_encoding(fileobj) or options.get('encoding', 'iso-8859-1')
+
+ if PY2:
+ next_line = fileobj.readline
+ else:
+ next_line = lambda: fileobj.readline().decode(encoding)
+
+ tokens = generate_tokens(next_line)
+ for tok, value, (lineno, _), _, _ in tokens:
+ if call_stack == -1 and tok == NAME and value in ('def', 'class'):
+ in_def = True
+ elif tok == OP and value == '(':
+ if in_def:
+ # Avoid false positives for declarations such as:
+ # def gettext(arg='message'):
+ in_def = False
+ continue
+ if funcname:
+ message_lineno = lineno
+ call_stack += 1
+ elif in_def and tok == OP and value == ':':
+ # End of a class definition without parens
+ in_def = False
+ continue
+ elif call_stack == -1 and tok == COMMENT:
+ # Strip the comment token from the line
+ if PY2:
+ value = value.decode(encoding)
+ value = value[1:].strip()
+ if in_translator_comments and \
+ translator_comments[-1][0] == lineno - 1:
+ # We're already inside a translator comment, continue appending
+ translator_comments.append((lineno, value))
+ continue
+ # If execution reaches this point, let's see if comment line
+ # starts with one of the comment tags
+ for comment_tag in comment_tags:
+ if value.startswith(comment_tag):
+ in_translator_comments = True
+ translator_comments.append((lineno, value))
+ break
+ elif funcname and call_stack == 0:
+ if tok == OP and value == ')':
+ if buf:
+ messages.append(''.join(buf))
+ del buf[:]
+ else:
+ messages.append(None)
+
+ if len(messages) > 1:
+ messages = tuple(messages)
+ else:
+ messages = messages[0]
+ # Comments don't apply unless they immediately preceed the
+ # message
+ if translator_comments and \
+ translator_comments[-1][0] < message_lineno - 1:
+ translator_comments = []
+
+ yield (message_lineno, funcname, messages,
+ [comment[1] for comment in translator_comments])
+
+ funcname = lineno = message_lineno = None
+ call_stack = -1
+ messages = []
+ translator_comments = []
+ in_translator_comments = False
+ elif tok == STRING:
+ # Unwrap quotes in a safe manner, maintaining the string's
+ # encoding
+ # https://sourceforge.net/tracker/?func=detail&atid=355470&
+ # aid=617979&group_id=5470
+ value = eval('# coding=%s\n%s' % (str(encoding), value),
+ {'__builtins__':{}}, {})
+ if PY2 and not isinstance(value, text_type):
+ value = value.decode(encoding)
+ buf.append(value)
+ elif tok == OP and value == ',':
+ if buf:
+ messages.append(''.join(buf))
+ del buf[:]
+ else:
+ messages.append(None)
+ if translator_comments:
+ # We have translator comments, and since we're on a
+ # comma(,) user is allowed to break into a new line
+ # Let's increase the last comment's lineno in order
+ # for the comment to still be a valid one
+ old_lineno, old_comment = translator_comments.pop()
+ translator_comments.append((old_lineno+1, old_comment))
+ elif call_stack > 0 and tok == OP and value == ')':
+ call_stack -= 1
+ elif funcname and call_stack == -1:
+ funcname = None
+ elif tok == NAME and value in keywords:
+ funcname = value
+
+
+def extract_javascript(fileobj, keywords, comment_tags, options):
+ """Extract messages from JavaScript source code.
+
+ :param fileobj: the seekable, file-like object the messages should be
+ extracted from
+ :param keywords: a list of keywords (i.e. function names) that should be
+ recognized as translation functions
+ :param comment_tags: a list of translator tags to search for and include
+ in the results
+ :param options: a dictionary of additional options (optional)
+ """
+ from babel.messages.jslexer import tokenize, unquote_string
+ funcname = message_lineno = None
+ messages = []
+ last_argument = None
+ translator_comments = []
+ concatenate_next = False
+ encoding = options.get('encoding', 'utf-8')
+ last_token = None
+ call_stack = -1
+
+ for token in tokenize(fileobj.read().decode(encoding)):
+ if token.type == 'operator' and token.value == '(':
+ if funcname:
+ message_lineno = token.lineno
+ call_stack += 1
+
+ elif call_stack == -1 and token.type == 'linecomment':
+ value = token.value[2:].strip()
+ if translator_comments and \
+ translator_comments[-1][0] == token.lineno - 1:
+ translator_comments.append((token.lineno, value))
+ continue
+
+ for comment_tag in comment_tags:
+ if value.startswith(comment_tag):
+ translator_comments.append((token.lineno, value.strip()))
+ break
+
+ elif token.type == 'multilinecomment':
+ # only one multi-line comment may preceed a translation
+ translator_comments = []
+ value = token.value[2:-2].strip()
+ for comment_tag in comment_tags:
+ if value.startswith(comment_tag):
+ lines = value.splitlines()
+ if lines:
+ lines[0] = lines[0].strip()
+ lines[1:] = dedent('\n'.join(lines[1:])).splitlines()
+ for offset, line in enumerate(lines):
+ translator_comments.append((token.lineno + offset,
+ line))
+ break
+
+ elif funcname and call_stack == 0:
+ if token.type == 'operator' and token.value == ')':
+ if last_argument is not None:
+ messages.append(last_argument)
+ if len(messages) > 1:
+ messages = tuple(messages)
+ elif messages:
+ messages = messages[0]
+ else:
+ messages = None
+
+ # Comments don't apply unless they immediately precede the
+ # message
+ if translator_comments and \
+ translator_comments[-1][0] < message_lineno - 1:
+ translator_comments = []
+
+ if messages is not None:
+ yield (message_lineno, funcname, messages,
+ [comment[1] for comment in translator_comments])
+
+ funcname = message_lineno = last_argument = None
+ concatenate_next = False
+ translator_comments = []
+ messages = []
+ call_stack = -1
+
+ elif token.type == 'string':
+ new_value = unquote_string(token.value)
+ if concatenate_next:
+ last_argument = (last_argument or '') + new_value
+ concatenate_next = False
+ else:
+ last_argument = new_value
+
+ elif token.type == 'operator':
+ if token.value == ',':
+ if last_argument is not None:
+ messages.append(last_argument)
+ last_argument = None
+ else:
+ messages.append(None)
+ concatenate_next = False
+ elif token.value == '+':
+ concatenate_next = True
+
+ elif call_stack > 0 and token.type == 'operator' \
+ and token.value == ')':
+ call_stack -= 1
+
+ elif funcname and call_stack == -1:
+ funcname = None
+
+ elif call_stack == -1 and token.type == 'name' and \
+ token.value in keywords and \
+ (last_token is None or last_token.type != 'name' or
+ last_token.value != 'function'):
+ funcname = token.value
+
+ last_token = token
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/messages/frontend.py b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/messages/frontend.py
new file mode 100644
index 000000000..56f1b7677
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/messages/frontend.py
@@ -0,0 +1,1258 @@
+# -*- coding: utf-8 -*-
+"""
+ babel.messages.frontend
+ ~~~~~~~~~~~~~~~~~~~~~~~
+
+ Frontends for the message extraction functionality.
+
+ :copyright: (c) 2013 by the Babel Team.
+ :license: BSD, see LICENSE for more details.
+"""
+from __future__ import print_function
+try:
+ from ConfigParser import RawConfigParser
+except ImportError:
+ from configparser import RawConfigParser
+from datetime import datetime
+from distutils import log
+from distutils.cmd import Command
+from distutils.errors import DistutilsOptionError, DistutilsSetupError
+from locale import getpreferredencoding
+import logging
+from optparse import OptionParser
+import os
+import re
+import shutil
+import sys
+import tempfile
+
+from babel import __version__ as VERSION
+from babel import Locale, localedata
+from babel.core import UnknownLocaleError
+from babel.messages.catalog import Catalog
+from babel.messages.extract import extract_from_dir, DEFAULT_KEYWORDS, \
+ DEFAULT_MAPPING
+from babel.messages.mofile import write_mo
+from babel.messages.pofile import read_po, write_po
+from babel.util import odict, LOCALTZ
+from babel._compat import string_types, StringIO, PY2
+
+
+class compile_catalog(Command):
+ """Catalog compilation command for use in ``setup.py`` scripts.
+
+ If correctly installed, this command is available to Setuptools-using
+ setup scripts automatically. For projects using plain old ``distutils``,
+ the command needs to be registered explicitly in ``setup.py``::
+
+ from babel.messages.frontend import compile_catalog
+
+ setup(
+ ...
+ cmdclass = {'compile_catalog': compile_catalog}
+ )
+
+ .. versionadded:: 0.9
+ """
+
+ description = 'compile message catalogs to binary MO files'
+ user_options = [
+ ('domain=', 'D',
+ "domain of PO file (default 'messages')"),
+ ('directory=', 'd',
+ 'path to base directory containing the catalogs'),
+ ('input-file=', 'i',
+ 'name of the input file'),
+ ('output-file=', 'o',
+ "name of the output file (default "
+ "'//LC_MESSAGES/.mo')"),
+ ('locale=', 'l',
+ 'locale of the catalog to compile'),
+ ('use-fuzzy', 'f',
+ 'also include fuzzy translations'),
+ ('statistics', None,
+ 'print statistics about translations')
+ ]
+ boolean_options = ['use-fuzzy', 'statistics']
+
+ def initialize_options(self):
+ self.domain = 'messages'
+ self.directory = None
+ self.input_file = None
+ self.output_file = None
+ self.locale = None
+ self.use_fuzzy = False
+ self.statistics = False
+
+ def finalize_options(self):
+ if not self.input_file and not self.directory:
+ raise DistutilsOptionError('you must specify either the input file '
+ 'or the base directory')
+ if not self.output_file and not self.directory:
+ raise DistutilsOptionError('you must specify either the output file '
+ 'or the base directory')
+
+ def run(self):
+ po_files = []
+ mo_files = []
+
+ if not self.input_file:
+ if self.locale:
+ po_files.append((self.locale,
+ os.path.join(self.directory, self.locale,
+ 'LC_MESSAGES',
+ self.domain + '.po')))
+ mo_files.append(os.path.join(self.directory, self.locale,
+ 'LC_MESSAGES',
+ self.domain + '.mo'))
+ else:
+ for locale in os.listdir(self.directory):
+ po_file = os.path.join(self.directory, locale,
+ 'LC_MESSAGES', self.domain + '.po')
+ if os.path.exists(po_file):
+ po_files.append((locale, po_file))
+ mo_files.append(os.path.join(self.directory, locale,
+ 'LC_MESSAGES',
+ self.domain + '.mo'))
+ else:
+ po_files.append((self.locale, self.input_file))
+ if self.output_file:
+ mo_files.append(self.output_file)
+ else:
+ mo_files.append(os.path.join(self.directory, self.locale,
+ 'LC_MESSAGES',
+ self.domain + '.mo'))
+
+ if not po_files:
+ raise DistutilsOptionError('no message catalogs found')
+
+ for idx, (locale, po_file) in enumerate(po_files):
+ mo_file = mo_files[idx]
+ infile = open(po_file, 'rb')
+ try:
+ catalog = read_po(infile, locale)
+ finally:
+ infile.close()
+
+ if self.statistics:
+ translated = 0
+ for message in list(catalog)[1:]:
+ if message.string:
+ translated +=1
+ percentage = 0
+ if len(catalog):
+ percentage = translated * 100 // len(catalog)
+ log.info('%d of %d messages (%d%%) translated in %r',
+ translated, len(catalog), percentage, po_file)
+
+ if catalog.fuzzy and not self.use_fuzzy:
+ log.warn('catalog %r is marked as fuzzy, skipping', po_file)
+ continue
+
+ for message, errors in catalog.check():
+ for error in errors:
+ log.error('error: %s:%d: %s', po_file, message.lineno,
+ error)
+
+ log.info('compiling catalog %r to %r', po_file, mo_file)
+
+ outfile = open(mo_file, 'wb')
+ try:
+ write_mo(outfile, catalog, use_fuzzy=self.use_fuzzy)
+ finally:
+ outfile.close()
+
+
+class extract_messages(Command):
+ """Message extraction command for use in ``setup.py`` scripts.
+
+ If correctly installed, this command is available to Setuptools-using
+ setup scripts automatically. For projects using plain old ``distutils``,
+ the command needs to be registered explicitly in ``setup.py``::
+
+ from babel.messages.frontend import extract_messages
+
+ setup(
+ ...
+ cmdclass = {'extract_messages': extract_messages}
+ )
+ """
+
+ description = 'extract localizable strings from the project code'
+ user_options = [
+ ('charset=', None,
+ 'charset to use in the output file'),
+ ('keywords=', 'k',
+ 'space-separated list of keywords to look for in addition to the '
+ 'defaults'),
+ ('no-default-keywords', None,
+ 'do not include the default keywords'),
+ ('mapping-file=', 'F',
+ 'path to the mapping configuration file'),
+ ('no-location', None,
+ 'do not include location comments with filename and line number'),
+ ('omit-header', None,
+ 'do not include msgid "" entry in header'),
+ ('output-file=', 'o',
+ 'name of the output file'),
+ ('width=', 'w',
+ 'set output line width (default 76)'),
+ ('no-wrap', None,
+ 'do not break long message lines, longer than the output line width, '
+ 'into several lines'),
+ ('sort-output', None,
+ 'generate sorted output (default False)'),
+ ('sort-by-file', None,
+ 'sort output by file location (default False)'),
+ ('msgid-bugs-address=', None,
+ 'set report address for msgid'),
+ ('copyright-holder=', None,
+ 'set copyright holder in output'),
+ ('add-comments=', 'c',
+ 'place comment block with TAG (or those preceding keyword lines) in '
+ 'output file. Separate multiple TAGs with commas(,)'),
+ ('strip-comments', None,
+ 'strip the comment TAGs from the comments.'),
+ ('input-dirs=', None,
+ 'directories that should be scanned for messages. Separate multiple '
+ 'directories with commas(,)'),
+ ]
+ boolean_options = [
+ 'no-default-keywords', 'no-location', 'omit-header', 'no-wrap',
+ 'sort-output', 'sort-by-file', 'strip-comments'
+ ]
+
+ def initialize_options(self):
+ self.charset = 'utf-8'
+ self.keywords = ''
+ self._keywords = DEFAULT_KEYWORDS.copy()
+ self.no_default_keywords = False
+ self.mapping_file = None
+ self.no_location = False
+ self.omit_header = False
+ self.output_file = None
+ self.input_dirs = None
+ self.width = None
+ self.no_wrap = False
+ self.sort_output = False
+ self.sort_by_file = False
+ self.msgid_bugs_address = None
+ self.copyright_holder = None
+ self.add_comments = None
+ self._add_comments = []
+ self.strip_comments = False
+
+ def finalize_options(self):
+ if self.no_default_keywords and not self.keywords:
+ raise DistutilsOptionError('you must specify new keywords if you '
+ 'disable the default ones')
+ if self.no_default_keywords:
+ self._keywords = {}
+ if self.keywords:
+ self._keywords.update(parse_keywords(self.keywords.split()))
+
+ if not self.output_file:
+ raise DistutilsOptionError('no output file specified')
+ if self.no_wrap and self.width:
+ raise DistutilsOptionError("'--no-wrap' and '--width' are mutually "
+ "exclusive")
+ if not self.no_wrap and not self.width:
+ self.width = 76
+ elif self.width is not None:
+ self.width = int(self.width)
+
+ if self.sort_output and self.sort_by_file:
+ raise DistutilsOptionError("'--sort-output' and '--sort-by-file' "
+ "are mutually exclusive")
+
+ if self.input_dirs:
+ self.input_dirs = re.split(',\s*', self.input_dirs)
+ else:
+ self.input_dirs = dict.fromkeys([k.split('.',1)[0]
+ for k in self.distribution.packages
+ ]).keys()
+
+ if self.add_comments:
+ self._add_comments = self.add_comments.split(',')
+
+ def run(self):
+ mappings = self._get_mappings()
+ outfile = open(self.output_file, 'wb')
+ try:
+ catalog = Catalog(project=self.distribution.get_name(),
+ version=self.distribution.get_version(),
+ msgid_bugs_address=self.msgid_bugs_address,
+ copyright_holder=self.copyright_holder,
+ charset=self.charset)
+
+ for dirname, (method_map, options_map) in mappings.items():
+ def callback(filename, method, options):
+ if method == 'ignore':
+ return
+ filepath = os.path.normpath(os.path.join(dirname, filename))
+ optstr = ''
+ if options:
+ optstr = ' (%s)' % ', '.join(['%s="%s"' % (k, v) for
+ k, v in options.items()])
+ log.info('extracting messages from %s%s', filepath, optstr)
+
+ extracted = extract_from_dir(dirname, method_map, options_map,
+ keywords=self._keywords,
+ comment_tags=self._add_comments,
+ callback=callback,
+ strip_comment_tags=
+ self.strip_comments)
+ for filename, lineno, message, comments, context in extracted:
+ filepath = os.path.normpath(os.path.join(dirname, filename))
+ catalog.add(message, None, [(filepath, lineno)],
+ auto_comments=comments, context=context)
+
+ log.info('writing PO template file to %s' % self.output_file)
+ write_po(outfile, catalog, width=self.width,
+ no_location=self.no_location,
+ omit_header=self.omit_header,
+ sort_output=self.sort_output,
+ sort_by_file=self.sort_by_file)
+ finally:
+ outfile.close()
+
+ def _get_mappings(self):
+ mappings = {}
+
+ if self.mapping_file:
+ fileobj = open(self.mapping_file, 'U')
+ try:
+ method_map, options_map = parse_mapping(fileobj)
+ for dirname in self.input_dirs:
+ mappings[dirname] = method_map, options_map
+ finally:
+ fileobj.close()
+
+ elif getattr(self.distribution, 'message_extractors', None):
+ message_extractors = self.distribution.message_extractors
+ for dirname, mapping in message_extractors.items():
+ if isinstance(mapping, string_types):
+ method_map, options_map = parse_mapping(StringIO(mapping))
+ else:
+ method_map, options_map = [], {}
+ for pattern, method, options in mapping:
+ method_map.append((pattern, method))
+ options_map[pattern] = options or {}
+ mappings[dirname] = method_map, options_map
+
+ else:
+ for dirname in self.input_dirs:
+ mappings[dirname] = DEFAULT_MAPPING, {}
+
+ return mappings
+
+
+def check_message_extractors(dist, name, value):
+ """Validate the ``message_extractors`` keyword argument to ``setup()``.
+
+ :param dist: the distutils/setuptools ``Distribution`` object
+ :param name: the name of the keyword argument (should always be
+ "message_extractors")
+ :param value: the value of the keyword argument
+ :raise `DistutilsSetupError`: if the value is not valid
+ """
+ assert name == 'message_extractors'
+ if not isinstance(value, dict):
+ raise DistutilsSetupError('the value of the "message_extractors" '
+ 'parameter must be a dictionary')
+
+
+class init_catalog(Command):
+ """New catalog initialization command for use in ``setup.py`` scripts.
+
+ If correctly installed, this command is available to Setuptools-using
+ setup scripts automatically. For projects using plain old ``distutils``,
+ the command needs to be registered explicitly in ``setup.py``::
+
+ from babel.messages.frontend import init_catalog
+
+ setup(
+ ...
+ cmdclass = {'init_catalog': init_catalog}
+ )
+ """
+
+ description = 'create a new catalog based on a POT file'
+ user_options = [
+ ('domain=', 'D',
+ "domain of PO file (default 'messages')"),
+ ('input-file=', 'i',
+ 'name of the input file'),
+ ('output-dir=', 'd',
+ 'path to output directory'),
+ ('output-file=', 'o',
+ "name of the output file (default "
+ "'//LC_MESSAGES/.po')"),
+ ('locale=', 'l',
+ 'locale for the new localized catalog'),
+ ('width=', 'w',
+ 'set output line width (default 76)'),
+ ('no-wrap', None,
+ 'do not break long message lines, longer than the output line width, '
+ 'into several lines'),
+ ]
+ boolean_options = ['no-wrap']
+
+ def initialize_options(self):
+ self.output_dir = None
+ self.output_file = None
+ self.input_file = None
+ self.locale = None
+ self.domain = 'messages'
+ self.no_wrap = False
+ self.width = None
+
+ def finalize_options(self):
+ if not self.input_file:
+ raise DistutilsOptionError('you must specify the input file')
+
+ if not self.locale:
+ raise DistutilsOptionError('you must provide a locale for the '
+ 'new catalog')
+ try:
+ self._locale = Locale.parse(self.locale)
+ except UnknownLocaleError as e:
+ raise DistutilsOptionError(e)
+
+ if not self.output_file and not self.output_dir:
+ raise DistutilsOptionError('you must specify the output directory')
+ if not self.output_file:
+ self.output_file = os.path.join(self.output_dir, self.locale,
+ 'LC_MESSAGES', self.domain + '.po')
+
+ if not os.path.exists(os.path.dirname(self.output_file)):
+ os.makedirs(os.path.dirname(self.output_file))
+ if self.no_wrap and self.width:
+ raise DistutilsOptionError("'--no-wrap' and '--width' are mutually "
+ "exclusive")
+ if not self.no_wrap and not self.width:
+ self.width = 76
+ elif self.width is not None:
+ self.width = int(self.width)
+
+ def run(self):
+ log.info('creating catalog %r based on %r', self.output_file,
+ self.input_file)
+
+ infile = open(self.input_file, 'rb')
+ try:
+ # Although reading from the catalog template, read_po must be fed
+ # the locale in order to correctly calculate plurals
+ catalog = read_po(infile, locale=self.locale)
+ finally:
+ infile.close()
+
+ catalog.locale = self._locale
+ catalog.revision_date = datetime.now(LOCALTZ)
+ catalog.fuzzy = False
+
+ outfile = open(self.output_file, 'wb')
+ try:
+ write_po(outfile, catalog, width=self.width)
+ finally:
+ outfile.close()
+
+
+class update_catalog(Command):
+ """Catalog merging command for use in ``setup.py`` scripts.
+
+ If correctly installed, this command is available to Setuptools-using
+ setup scripts automatically. For projects using plain old ``distutils``,
+ the command needs to be registered explicitly in ``setup.py``::
+
+ from babel.messages.frontend import update_catalog
+
+ setup(
+ ...
+ cmdclass = {'update_catalog': update_catalog}
+ )
+
+ .. versionadded:: 0.9
+ """
+
+ description = 'update message catalogs from a POT file'
+ user_options = [
+ ('domain=', 'D',
+ "domain of PO file (default 'messages')"),
+ ('input-file=', 'i',
+ 'name of the input file'),
+ ('output-dir=', 'd',
+ 'path to base directory containing the catalogs'),
+ ('output-file=', 'o',
+ "name of the output file (default "
+ "'//LC_MESSAGES/.po')"),
+ ('locale=', 'l',
+ 'locale of the catalog to compile'),
+ ('width=', 'w',
+ 'set output line width (default 76)'),
+ ('no-wrap', None,
+ 'do not break long message lines, longer than the output line width, '
+ 'into several lines'),
+ ('ignore-obsolete=', None,
+ 'whether to omit obsolete messages from the output'),
+ ('no-fuzzy-matching', 'N',
+ 'do not use fuzzy matching'),
+ ('previous', None,
+ 'keep previous msgids of translated messages')
+ ]
+ boolean_options = ['ignore_obsolete', 'no_fuzzy_matching', 'previous']
+
+ def initialize_options(self):
+ self.domain = 'messages'
+ self.input_file = None
+ self.output_dir = None
+ self.output_file = None
+ self.locale = None
+ self.width = None
+ self.no_wrap = False
+ self.ignore_obsolete = False
+ self.no_fuzzy_matching = False
+ self.previous = False
+
+ def finalize_options(self):
+ if not self.input_file:
+ raise DistutilsOptionError('you must specify the input file')
+ if not self.output_file and not self.output_dir:
+ raise DistutilsOptionError('you must specify the output file or '
+ 'directory')
+ if self.output_file and not self.locale:
+ raise DistutilsOptionError('you must specify the locale')
+ if self.no_wrap and self.width:
+ raise DistutilsOptionError("'--no-wrap' and '--width' are mutually "
+ "exclusive")
+ if not self.no_wrap and not self.width:
+ self.width = 76
+ elif self.width is not None:
+ self.width = int(self.width)
+ if self.no_fuzzy_matching and self.previous:
+ self.previous = False
+
+ def run(self):
+ po_files = []
+ if not self.output_file:
+ if self.locale:
+ po_files.append((self.locale,
+ os.path.join(self.output_dir, self.locale,
+ 'LC_MESSAGES',
+ self.domain + '.po')))
+ else:
+ for locale in os.listdir(self.output_dir):
+ po_file = os.path.join(self.output_dir, locale,
+ 'LC_MESSAGES',
+ self.domain + '.po')
+ if os.path.exists(po_file):
+ po_files.append((locale, po_file))
+ else:
+ po_files.append((self.locale, self.output_file))
+
+ domain = self.domain
+ if not domain:
+ domain = os.path.splitext(os.path.basename(self.input_file))[0]
+
+ infile = open(self.input_file, 'rb')
+ try:
+ template = read_po(infile)
+ finally:
+ infile.close()
+
+ if not po_files:
+ raise DistutilsOptionError('no message catalogs found')
+
+ for locale, filename in po_files:
+ log.info('updating catalog %r based on %r', filename,
+ self.input_file)
+ infile = open(filename, 'rb')
+ try:
+ catalog = read_po(infile, locale=locale, domain=domain)
+ finally:
+ infile.close()
+
+ catalog.update(template, self.no_fuzzy_matching)
+
+ tmpname = os.path.join(os.path.dirname(filename),
+ tempfile.gettempprefix() +
+ os.path.basename(filename))
+ tmpfile = open(tmpname, 'wb')
+ try:
+ try:
+ write_po(tmpfile, catalog,
+ ignore_obsolete=self.ignore_obsolete,
+ include_previous=self.previous, width=self.width)
+ finally:
+ tmpfile.close()
+ except:
+ os.remove(tmpname)
+ raise
+
+ try:
+ os.rename(tmpname, filename)
+ except OSError:
+ # We're probably on Windows, which doesn't support atomic
+ # renames, at least not through Python
+ # If the error is in fact due to a permissions problem, that
+ # same error is going to be raised from one of the following
+ # operations
+ os.remove(filename)
+ shutil.copy(tmpname, filename)
+ os.remove(tmpname)
+
+
+class CommandLineInterface(object):
+ """Command-line interface.
+
+ This class provides a simple command-line interface to the message
+ extraction and PO file generation functionality.
+ """
+
+ usage = '%%prog %s [options] %s'
+ version = '%%prog %s' % VERSION
+ commands = {
+ 'compile': 'compile message catalogs to MO files',
+ 'extract': 'extract messages from source files and generate a POT file',
+ 'init': 'create new message catalogs from a POT file',
+ 'update': 'update existing message catalogs from a POT file'
+ }
+
+ def run(self, argv=sys.argv):
+ """Main entry point of the command-line interface.
+
+ :param argv: list of arguments passed on the command-line
+ """
+ self.parser = OptionParser(usage=self.usage % ('command', '[args]'),
+ version=self.version)
+ self.parser.disable_interspersed_args()
+ self.parser.print_help = self._help
+ self.parser.add_option('--list-locales', dest='list_locales',
+ action='store_true',
+ help="print all known locales and exit")
+ self.parser.add_option('-v', '--verbose', action='store_const',
+ dest='loglevel', const=logging.DEBUG,
+ help='print as much as possible')
+ self.parser.add_option('-q', '--quiet', action='store_const',
+ dest='loglevel', const=logging.ERROR,
+ help='print as little as possible')
+ self.parser.set_defaults(list_locales=False, loglevel=logging.INFO)
+
+ options, args = self.parser.parse_args(argv[1:])
+
+ self._configure_logging(options.loglevel)
+ if options.list_locales:
+ identifiers = localedata.locale_identifiers()
+ longest = max([len(identifier) for identifier in identifiers])
+ identifiers.sort()
+ format = u'%%-%ds %%s' % (longest + 1)
+ for identifier in identifiers:
+ locale = Locale.parse(identifier)
+ output = format % (identifier, locale.english_name)
+ print(output.encode(sys.stdout.encoding or
+ getpreferredencoding() or
+ 'ascii', 'replace'))
+ return 0
+
+ if not args:
+ self.parser.error('no valid command or option passed. '
+ 'Try the -h/--help option for more information.')
+
+ cmdname = args[0]
+ if cmdname not in self.commands:
+ self.parser.error('unknown command "%s"' % cmdname)
+
+ return getattr(self, cmdname)(args[1:])
+
+ def _configure_logging(self, loglevel):
+ self.log = logging.getLogger('babel')
+ self.log.setLevel(loglevel)
+ # Don't add a new handler for every instance initialization (#227), this
+ # would cause duplicated output when the CommandLineInterface as an
+ # normal Python class.
+ if self.log.handlers:
+ handler = self.log.handlers[0]
+ else:
+ handler = logging.StreamHandler()
+ self.log.addHandler(handler)
+ handler.setLevel(loglevel)
+ formatter = logging.Formatter('%(message)s')
+ handler.setFormatter(formatter)
+
+ def _help(self):
+ print(self.parser.format_help())
+ print("commands:")
+ longest = max([len(command) for command in self.commands])
+ format = " %%-%ds %%s" % max(8, longest + 1)
+ commands = sorted(self.commands.items())
+ for name, description in commands:
+ print(format % (name, description))
+
+ def compile(self, argv):
+ """Subcommand for compiling a message catalog to a MO file.
+
+ :param argv: the command arguments
+ :since: version 0.9
+ """
+ parser = OptionParser(usage=self.usage % ('compile', ''),
+ description=self.commands['compile'])
+ parser.add_option('--domain', '-D', dest='domain',
+ help="domain of MO and PO files (default '%default')")
+ parser.add_option('--directory', '-d', dest='directory',
+ metavar='DIR', help='base directory of catalog files')
+ parser.add_option('--locale', '-l', dest='locale', metavar='LOCALE',
+ help='locale of the catalog')
+ parser.add_option('--input-file', '-i', dest='input_file',
+ metavar='FILE', help='name of the input file')
+ parser.add_option('--output-file', '-o', dest='output_file',
+ metavar='FILE',
+ help="name of the output file (default "
+ "'//LC_MESSAGES/"
+ ".mo')")
+ parser.add_option('--use-fuzzy', '-f', dest='use_fuzzy',
+ action='store_true',
+ help='also include fuzzy translations (default '
+ '%default)')
+ parser.add_option('--statistics', dest='statistics',
+ action='store_true',
+ help='print statistics about translations')
+
+ parser.set_defaults(domain='messages', use_fuzzy=False,
+ compile_all=False, statistics=False)
+ options, args = parser.parse_args(argv)
+
+ po_files = []
+ mo_files = []
+ if not options.input_file:
+ if not options.directory:
+ parser.error('you must specify either the input file or the '
+ 'base directory')
+ if options.locale:
+ po_files.append((options.locale,
+ os.path.join(options.directory,
+ options.locale, 'LC_MESSAGES',
+ options.domain + '.po')))
+ mo_files.append(os.path.join(options.directory, options.locale,
+ 'LC_MESSAGES',
+ options.domain + '.mo'))
+ else:
+ for locale in os.listdir(options.directory):
+ po_file = os.path.join(options.directory, locale,
+ 'LC_MESSAGES', options.domain + '.po')
+ if os.path.exists(po_file):
+ po_files.append((locale, po_file))
+ mo_files.append(os.path.join(options.directory, locale,
+ 'LC_MESSAGES',
+ options.domain + '.mo'))
+ else:
+ po_files.append((options.locale, options.input_file))
+ if options.output_file:
+ mo_files.append(options.output_file)
+ else:
+ if not options.directory:
+ parser.error('you must specify either the output file or '
+ 'the base directory')
+ mo_files.append(os.path.join(options.directory, options.locale,
+ 'LC_MESSAGES',
+ options.domain + '.mo'))
+ if not po_files:
+ parser.error('no message catalogs found')
+
+ for idx, (locale, po_file) in enumerate(po_files):
+ mo_file = mo_files[idx]
+ infile = open(po_file, 'rb')
+ try:
+ catalog = read_po(infile, locale)
+ finally:
+ infile.close()
+
+ if options.statistics:
+ translated = 0
+ for message in list(catalog)[1:]:
+ if message.string:
+ translated +=1
+ percentage = 0
+ if len(catalog):
+ percentage = translated * 100 // len(catalog)
+ self.log.info("%d of %d messages (%d%%) translated in %r",
+ translated, len(catalog), percentage, po_file)
+
+ if catalog.fuzzy and not options.use_fuzzy:
+ self.log.warning('catalog %r is marked as fuzzy, skipping',
+ po_file)
+ continue
+
+ for message, errors in catalog.check():
+ for error in errors:
+ self.log.error('error: %s:%d: %s', po_file, message.lineno,
+ error)
+
+ self.log.info('compiling catalog %r to %r', po_file, mo_file)
+
+ outfile = open(mo_file, 'wb')
+ try:
+ write_mo(outfile, catalog, use_fuzzy=options.use_fuzzy)
+ finally:
+ outfile.close()
+
+ def extract(self, argv):
+ """Subcommand for extracting messages from source files and generating
+ a POT file.
+
+ :param argv: the command arguments
+ """
+ parser = OptionParser(usage=self.usage % ('extract', 'dir1 ...'),
+ description=self.commands['extract'])
+ parser.add_option('--charset', dest='charset',
+ help='charset to use in the output (default '
+ '"%default")')
+ parser.add_option('-k', '--keyword', dest='keywords', action='append',
+ help='keywords to look for in addition to the '
+ 'defaults. You can specify multiple -k flags on '
+ 'the command line.')
+ parser.add_option('--no-default-keywords', dest='no_default_keywords',
+ action='store_true',
+ help="do not include the default keywords")
+ parser.add_option('--mapping', '-F', dest='mapping_file',
+ help='path to the extraction mapping file')
+ parser.add_option('--no-location', dest='no_location',
+ action='store_true',
+ help='do not include location comments with filename '
+ 'and line number')
+ parser.add_option('--omit-header', dest='omit_header',
+ action='store_true',
+ help='do not include msgid "" entry in header')
+ parser.add_option('-o', '--output', dest='output',
+ help='path to the output POT file')
+ parser.add_option('-w', '--width', dest='width', type='int',
+ help="set output line width (default 76)")
+ parser.add_option('--no-wrap', dest='no_wrap', action='store_true',
+ help='do not break long message lines, longer than '
+ 'the output line width, into several lines')
+ parser.add_option('--sort-output', dest='sort_output',
+ action='store_true',
+ help='generate sorted output (default False)')
+ parser.add_option('--sort-by-file', dest='sort_by_file',
+ action='store_true',
+ help='sort output by file location (default False)')
+ parser.add_option('--msgid-bugs-address', dest='msgid_bugs_address',
+ metavar='EMAIL@ADDRESS',
+ help='set report address for msgid')
+ parser.add_option('--copyright-holder', dest='copyright_holder',
+ help='set copyright holder in output')
+ parser.add_option('--project', dest='project',
+ help='set project name in output')
+ parser.add_option('--version', dest='version',
+ help='set project version in output')
+ parser.add_option('--add-comments', '-c', dest='comment_tags',
+ metavar='TAG', action='append',
+ help='place comment block with TAG (or those '
+ 'preceding keyword lines) in output file. One '
+ 'TAG per argument call')
+ parser.add_option('--strip-comment-tags', '-s',
+ dest='strip_comment_tags', action='store_true',
+ help='Strip the comment tags from the comments.')
+
+ parser.set_defaults(charset='utf-8', keywords=[],
+ no_default_keywords=False, no_location=False,
+ omit_header = False, width=None, no_wrap=False,
+ sort_output=False, sort_by_file=False,
+ comment_tags=[], strip_comment_tags=False)
+ options, args = parser.parse_args(argv)
+ if not args:
+ parser.error('incorrect number of arguments')
+
+ keywords = DEFAULT_KEYWORDS.copy()
+ if options.no_default_keywords:
+ if not options.keywords:
+ parser.error('you must specify new keywords if you disable the '
+ 'default ones')
+ keywords = {}
+ if options.keywords:
+ keywords.update(parse_keywords(options.keywords))
+
+ if options.mapping_file:
+ fileobj = open(options.mapping_file, 'U')
+ try:
+ method_map, options_map = parse_mapping(fileobj)
+ finally:
+ fileobj.close()
+ else:
+ method_map = DEFAULT_MAPPING
+ options_map = {}
+
+ if options.width and options.no_wrap:
+ parser.error("'--no-wrap' and '--width' are mutually exclusive.")
+ elif not options.width and not options.no_wrap:
+ options.width = 76
+
+ if options.sort_output and options.sort_by_file:
+ parser.error("'--sort-output' and '--sort-by-file' are mutually "
+ "exclusive")
+
+ catalog = Catalog(project=options.project,
+ version=options.version,
+ msgid_bugs_address=options.msgid_bugs_address,
+ copyright_holder=options.copyright_holder,
+ charset=options.charset)
+
+ for dirname in args:
+ if not os.path.isdir(dirname):
+ parser.error('%r is not a directory' % dirname)
+
+ def callback(filename, method, options):
+ if method == 'ignore':
+ return
+ filepath = os.path.normpath(os.path.join(dirname, filename))
+ optstr = ''
+ if options:
+ optstr = ' (%s)' % ', '.join(['%s="%s"' % (k, v) for
+ k, v in options.items()])
+ self.log.info('extracting messages from %s%s', filepath,
+ optstr)
+
+ extracted = extract_from_dir(dirname, method_map, options_map,
+ keywords, options.comment_tags,
+ callback=callback,
+ strip_comment_tags=
+ options.strip_comment_tags)
+ for filename, lineno, message, comments, context in extracted:
+ filepath = os.path.normpath(os.path.join(dirname, filename))
+ catalog.add(message, None, [(filepath, lineno)],
+ auto_comments=comments, context=context)
+
+ catalog_charset = catalog.charset
+ if options.output not in (None, '-'):
+ self.log.info('writing PO template file to %s' % options.output)
+ outfile = open(options.output, 'wb')
+ close_output = True
+ else:
+ outfile = sys.stdout
+
+ # This is a bit of a hack on Python 3. stdout is a text stream so
+ # we need to find the underlying file when we write the PO. In
+ # later versions of Babel we want the write_po function to accept
+ # text or binary streams and automatically adjust the encoding.
+ if not PY2 and hasattr(outfile, 'buffer'):
+ catalog.charset = outfile.encoding
+ outfile = outfile.buffer.raw
+
+ close_output = False
+
+ try:
+ write_po(outfile, catalog, width=options.width,
+ no_location=options.no_location,
+ omit_header=options.omit_header,
+ sort_output=options.sort_output,
+ sort_by_file=options.sort_by_file)
+ finally:
+ if close_output:
+ outfile.close()
+ catalog.charset = catalog_charset
+
+ def init(self, argv):
+ """Subcommand for creating new message catalogs from a template.
+
+ :param argv: the command arguments
+ """
+ parser = OptionParser(usage=self.usage % ('init', ''),
+ description=self.commands['init'])
+ parser.add_option('--domain', '-D', dest='domain',
+ help="domain of PO file (default '%default')")
+ parser.add_option('--input-file', '-i', dest='input_file',
+ metavar='FILE', help='name of the input file')
+ parser.add_option('--output-dir', '-d', dest='output_dir',
+ metavar='DIR', help='path to output directory')
+ parser.add_option('--output-file', '-o', dest='output_file',
+ metavar='FILE',
+ help="name of the output file (default "
+ "'//LC_MESSAGES/"
+ ".po')")
+ parser.add_option('--locale', '-l', dest='locale', metavar='LOCALE',
+ help='locale for the new localized catalog')
+ parser.add_option('-w', '--width', dest='width', type='int',
+ help="set output line width (default 76)")
+ parser.add_option('--no-wrap', dest='no_wrap', action='store_true',
+ help='do not break long message lines, longer than '
+ 'the output line width, into several lines')
+
+ parser.set_defaults(domain='messages')
+ options, args = parser.parse_args(argv)
+
+ if not options.locale:
+ parser.error('you must provide a locale for the new catalog')
+ try:
+ locale = Locale.parse(options.locale)
+ except UnknownLocaleError as e:
+ parser.error(e)
+
+ if not options.input_file:
+ parser.error('you must specify the input file')
+
+ if not options.output_file and not options.output_dir:
+ parser.error('you must specify the output file or directory')
+
+ if not options.output_file:
+ options.output_file = os.path.join(options.output_dir,
+ options.locale, 'LC_MESSAGES',
+ options.domain + '.po')
+ if not os.path.exists(os.path.dirname(options.output_file)):
+ os.makedirs(os.path.dirname(options.output_file))
+ if options.width and options.no_wrap:
+ parser.error("'--no-wrap' and '--width' are mutually exclusive.")
+ elif not options.width and not options.no_wrap:
+ options.width = 76
+
+ infile = open(options.input_file, 'r')
+ try:
+ # Although reading from the catalog template, read_po must be fed
+ # the locale in order to correctly calculate plurals
+ catalog = read_po(infile, locale=options.locale)
+ finally:
+ infile.close()
+
+ catalog.locale = locale
+ catalog.revision_date = datetime.now(LOCALTZ)
+
+ self.log.info('creating catalog %r based on %r', options.output_file,
+ options.input_file)
+
+ outfile = open(options.output_file, 'wb')
+ try:
+ write_po(outfile, catalog, width=options.width)
+ finally:
+ outfile.close()
+
+ def update(self, argv):
+ """Subcommand for updating existing message catalogs from a template.
+
+ :param argv: the command arguments
+ :since: version 0.9
+ """
+ parser = OptionParser(usage=self.usage % ('update', ''),
+ description=self.commands['update'])
+ parser.add_option('--domain', '-D', dest='domain',
+ help="domain of PO file (default '%default')")
+ parser.add_option('--input-file', '-i', dest='input_file',
+ metavar='FILE', help='name of the input file')
+ parser.add_option('--output-dir', '-d', dest='output_dir',
+ metavar='DIR', help='path to output directory')
+ parser.add_option('--output-file', '-o', dest='output_file',
+ metavar='FILE',
+ help="name of the output file (default "
+ "'//LC_MESSAGES/"
+ ".po')")
+ parser.add_option('--locale', '-l', dest='locale', metavar='LOCALE',
+ help='locale of the translations catalog')
+ parser.add_option('-w', '--width', dest='width', type='int',
+ help="set output line width (default 76)")
+ parser.add_option('--no-wrap', dest='no_wrap', action = 'store_true',
+ help='do not break long message lines, longer than '
+ 'the output line width, into several lines')
+ parser.add_option('--ignore-obsolete', dest='ignore_obsolete',
+ action='store_true',
+ help='do not include obsolete messages in the output '
+ '(default %default)')
+ parser.add_option('--no-fuzzy-matching', '-N', dest='no_fuzzy_matching',
+ action='store_true',
+ help='do not use fuzzy matching (default %default)')
+ parser.add_option('--previous', dest='previous', action='store_true',
+ help='keep previous msgids of translated messages '
+ '(default %default)')
+
+ parser.set_defaults(domain='messages', ignore_obsolete=False,
+ no_fuzzy_matching=False, previous=False)
+ options, args = parser.parse_args(argv)
+
+ if not options.input_file:
+ parser.error('you must specify the input file')
+ if not options.output_file and not options.output_dir:
+ parser.error('you must specify the output file or directory')
+ if options.output_file and not options.locale:
+ parser.error('you must specify the locale')
+ if options.no_fuzzy_matching and options.previous:
+ options.previous = False
+
+ po_files = []
+ if not options.output_file:
+ if options.locale:
+ po_files.append((options.locale,
+ os.path.join(options.output_dir,
+ options.locale, 'LC_MESSAGES',
+ options.domain + '.po')))
+ else:
+ for locale in os.listdir(options.output_dir):
+ po_file = os.path.join(options.output_dir, locale,
+ 'LC_MESSAGES',
+ options.domain + '.po')
+ if os.path.exists(po_file):
+ po_files.append((locale, po_file))
+ else:
+ po_files.append((options.locale, options.output_file))
+
+ domain = options.domain
+ if not domain:
+ domain = os.path.splitext(os.path.basename(options.input_file))[0]
+
+ infile = open(options.input_file, 'U')
+ try:
+ template = read_po(infile)
+ finally:
+ infile.close()
+
+ if not po_files:
+ parser.error('no message catalogs found')
+
+ if options.width and options.no_wrap:
+ parser.error("'--no-wrap' and '--width' are mutually exclusive.")
+ elif not options.width and not options.no_wrap:
+ options.width = 76
+ for locale, filename in po_files:
+ self.log.info('updating catalog %r based on %r', filename,
+ options.input_file)
+ infile = open(filename, 'U')
+ try:
+ catalog = read_po(infile, locale=locale, domain=domain)
+ finally:
+ infile.close()
+
+ catalog.update(template, options.no_fuzzy_matching)
+
+ tmpname = os.path.join(os.path.dirname(filename),
+ tempfile.gettempprefix() +
+ os.path.basename(filename))
+ tmpfile = open(tmpname, 'wb')
+ try:
+ try:
+ write_po(tmpfile, catalog,
+ ignore_obsolete=options.ignore_obsolete,
+ include_previous=options.previous,
+ width=options.width)
+ finally:
+ tmpfile.close()
+ except:
+ os.remove(tmpname)
+ raise
+
+ try:
+ os.rename(tmpname, filename)
+ except OSError:
+ # We're probably on Windows, which doesn't support atomic
+ # renames, at least not through Python
+ # If the error is in fact due to a permissions problem, that
+ # same error is going to be raised from one of the following
+ # operations
+ os.remove(filename)
+ shutil.copy(tmpname, filename)
+ os.remove(tmpname)
+
+
+def main():
+ return CommandLineInterface().run(sys.argv)
+
+
+def parse_mapping(fileobj, filename=None):
+ """Parse an extraction method mapping from a file-like object.
+
+ >>> buf = StringIO('''
+ ... [extractors]
+ ... custom = mypackage.module:myfunc
+ ...
+ ... # Python source files
+ ... [python: **.py]
+ ...
+ ... # Genshi templates
+ ... [genshi: **/templates/**.html]
+ ... include_attrs =
+ ... [genshi: **/templates/**.txt]
+ ... template_class = genshi.template:TextTemplate
+ ... encoding = latin-1
+ ...
+ ... # Some custom extractor
+ ... [custom: **/custom/*.*]
+ ... ''')
+
+ >>> method_map, options_map = parse_mapping(buf)
+ >>> len(method_map)
+ 4
+
+ >>> method_map[0]
+ ('**.py', 'python')
+ >>> options_map['**.py']
+ {}
+ >>> method_map[1]
+ ('**/templates/**.html', 'genshi')
+ >>> options_map['**/templates/**.html']['include_attrs']
+ ''
+ >>> method_map[2]
+ ('**/templates/**.txt', 'genshi')
+ >>> options_map['**/templates/**.txt']['template_class']
+ 'genshi.template:TextTemplate'
+ >>> options_map['**/templates/**.txt']['encoding']
+ 'latin-1'
+
+ >>> method_map[3]
+ ('**/custom/*.*', 'mypackage.module:myfunc')
+ >>> options_map['**/custom/*.*']
+ {}
+
+ :param fileobj: a readable file-like object containing the configuration
+ text to parse
+ :see: `extract_from_directory`
+ """
+ extractors = {}
+ method_map = []
+ options_map = {}
+
+ parser = RawConfigParser()
+ parser._sections = odict(parser._sections) # We need ordered sections
+ parser.readfp(fileobj, filename)
+ for section in parser.sections():
+ if section == 'extractors':
+ extractors = dict(parser.items(section))
+ else:
+ method, pattern = [part.strip() for part in section.split(':', 1)]
+ method_map.append((pattern, method))
+ options_map[pattern] = dict(parser.items(section))
+
+ if extractors:
+ for idx, (pattern, method) in enumerate(method_map):
+ if method in extractors:
+ method = extractors[method]
+ method_map[idx] = (pattern, method)
+
+ return (method_map, options_map)
+
+
+def parse_keywords(strings=[]):
+ """Parse keywords specifications from the given list of strings.
+
+ >>> kw = sorted(parse_keywords(['_', 'dgettext:2', 'dngettext:2,3', 'pgettext:1c,2']).items())
+ >>> for keyword, indices in kw:
+ ... print((keyword, indices))
+ ('_', None)
+ ('dgettext', (2,))
+ ('dngettext', (2, 3))
+ ('pgettext', ((1, 'c'), 2))
+ """
+ keywords = {}
+ for string in strings:
+ if ':' in string:
+ funcname, indices = string.split(':')
+ else:
+ funcname, indices = string, None
+ if funcname not in keywords:
+ if indices:
+ inds = []
+ for x in indices.split(','):
+ if x[-1] == 'c':
+ inds.append((int(x[:-1]), 'c'))
+ else:
+ inds.append(int(x))
+ indices = tuple(inds)
+ keywords[funcname] = indices
+ return keywords
+
+
+if __name__ == '__main__':
+ main()
diff --git a/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/messages/jslexer.py b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/messages/jslexer.py
new file mode 100644
index 000000000..22c6e1f9c
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/Babel-2.2.0-py2.7.egg/babel/messages/jslexer.py
@@ -0,0 +1,166 @@
+# -*- coding: utf-8 -*-
+"""
+ babel.messages.jslexer
+ ~~~~~~~~~~~~~~~~~~~~~~
+
+ A simple JavaScript 1.5 lexer which is used for the JavaScript
+ extractor.
+
+ :copyright: (c) 2013 by the Babel Team.
+ :license: BSD, see LICENSE for more details.
+"""
+
+from operator import itemgetter
+import re
+from babel._compat import unichr
+
+operators = [
+ '+', '-', '*', '%', '!=', '==', '<', '>', '<=', '>=', '=',
+ '+=', '-=', '*=', '%=', '<<', '>>', '>>>', '<<=', '>>=',
+ '>>>=', '&', '&=', '|', '|=', '&&', '||', '^', '^=', '(', ')',
+ '[', ']', '{', '}', '!', '--', '++', '~', ',', ';', '.', ':'
+]
+operators.sort(key=lambda a: -len(a))
+
+escapes = {'b': '\b', 'f': '\f', 'n': '\n', 'r': '\r', 't': '\t'}
+
+rules = [
+ (None, re.compile(r'\s+(?u)')),
+ (None, re.compile(r'' % (
+ render_traceback(self, full=full),
+ self.render_as_text().decode('utf-8', 'replace')
+ )
+
+ @property
+ def is_template_syntax_error(self):
+ """`True` if this is a template syntax error."""
+ return isinstance(self.exc_value, TemplateSyntaxError)
+
+ @property
+ def exc_info(self):
+ """Exception info tuple with a proxy around the frame objects."""
+ return self.exc_type, self.exc_value, self.frames[0]
+
+ @property
+ def standard_exc_info(self):
+ """Standard python exc_info for re-raising"""
+ tb = self.frames[0]
+ # the frame will be an actual traceback (or transparent proxy) if
+ # we are on pypy or a python implementation with support for tproxy
+ if type(tb) is not TracebackType:
+ tb = tb.tb
+ return self.exc_type, self.exc_value, tb
+
+
+def make_traceback(exc_info, source_hint=None):
+ """Creates a processed traceback object from the exc_info."""
+ exc_type, exc_value, tb = exc_info
+ if isinstance(exc_value, TemplateSyntaxError):
+ exc_info = translate_syntax_error(exc_value, source_hint)
+ initial_skip = 0
+ else:
+ initial_skip = 1
+ return translate_exception(exc_info, initial_skip)
+
+
+def translate_syntax_error(error, source=None):
+ """Rewrites a syntax error to please traceback systems."""
+ error.source = source
+ error.translated = True
+ exc_info = (error.__class__, error, None)
+ filename = error.filename
+ if filename is None:
+ filename = ''
+ return fake_exc_info(exc_info, filename, error.lineno)
+
+
+def translate_exception(exc_info, initial_skip=0):
+ """If passed an exc_info it will automatically rewrite the exceptions
+ all the way down to the correct line numbers and frames.
+ """
+ tb = exc_info[2]
+ frames = []
+
+ # skip some internal frames if wanted
+ for x in range(initial_skip):
+ if tb is not None:
+ tb = tb.tb_next
+ initial_tb = tb
+
+ while tb is not None:
+ # skip frames decorated with @internalcode. These are internal
+ # calls we can't avoid and that are useless in template debugging
+ # output.
+ if tb.tb_frame.f_code in internal_code:
+ tb = tb.tb_next
+ continue
+
+ # save a reference to the next frame if we override the current
+ # one with a faked one.
+ next = tb.tb_next
+
+ # fake template exceptions
+ template = tb.tb_frame.f_globals.get('__jinja_template__')
+ if template is not None:
+ lineno = template.get_corresponding_lineno(tb.tb_lineno)
+ tb = fake_exc_info(exc_info[:2] + (tb,), template.filename,
+ lineno)[2]
+
+ frames.append(make_frame_proxy(tb))
+ tb = next
+
+ # if we don't have any exceptions in the frames left, we have to
+ # reraise it unchanged.
+ # XXX: can we backup here? when could this happen?
+ if not frames:
+ reraise(exc_info[0], exc_info[1], exc_info[2])
+
+ return ProcessedTraceback(exc_info[0], exc_info[1], frames)
+
+
+def fake_exc_info(exc_info, filename, lineno):
+ """Helper for `translate_exception`."""
+ exc_type, exc_value, tb = exc_info
+
+ # figure the real context out
+ if tb is not None:
+ real_locals = tb.tb_frame.f_locals.copy()
+ ctx = real_locals.get('context')
+ if ctx:
+ locals = ctx.get_all()
+ else:
+ locals = {}
+ for name, value in iteritems(real_locals):
+ if name.startswith('l_') and value is not missing:
+ locals[name[2:]] = value
+
+ # if there is a local called __jinja_exception__, we get
+ # rid of it to not break the debug functionality.
+ locals.pop('__jinja_exception__', None)
+ else:
+ locals = {}
+
+ # assamble fake globals we need
+ globals = {
+ '__name__': filename,
+ '__file__': filename,
+ '__jinja_exception__': exc_info[:2],
+
+ # we don't want to keep the reference to the template around
+ # to not cause circular dependencies, but we mark it as Jinja
+ # frame for the ProcessedTraceback
+ '__jinja_template__': None
+ }
+
+ # and fake the exception
+ code = compile('\n' * (lineno - 1) + raise_helper, filename, 'exec')
+
+ # if it's possible, change the name of the code. This won't work
+ # on some python environments such as google appengine
+ try:
+ if tb is None:
+ location = 'template'
+ else:
+ function = tb.tb_frame.f_code.co_name
+ if function == 'root':
+ location = 'top-level template code'
+ elif function.startswith('block_'):
+ location = 'block "%s"' % function[6:]
+ else:
+ location = 'template'
+
+ if PY2:
+ code = CodeType(0, code.co_nlocals, code.co_stacksize,
+ code.co_flags, code.co_code, code.co_consts,
+ code.co_names, code.co_varnames, filename,
+ location, code.co_firstlineno,
+ code.co_lnotab, (), ())
+ else:
+ code = CodeType(0, code.co_kwonlyargcount,
+ code.co_nlocals, code.co_stacksize,
+ code.co_flags, code.co_code, code.co_consts,
+ code.co_names, code.co_varnames, filename,
+ location, code.co_firstlineno,
+ code.co_lnotab, (), ())
+ except Exception as e:
+ pass
+
+ # execute the code and catch the new traceback
+ try:
+ exec(code, globals, locals)
+ except:
+ exc_info = sys.exc_info()
+ new_tb = exc_info[2].tb_next
+
+ # return without this frame
+ return exc_info[:2] + (new_tb,)
+
+
+def _init_ugly_crap():
+ """This function implements a few ugly things so that we can patch the
+ traceback objects. The function returned allows resetting `tb_next` on
+ any python traceback object. Do not attempt to use this on non cpython
+ interpreters
+ """
+ import ctypes
+ from types import TracebackType
+
+ if PY2:
+ # figure out size of _Py_ssize_t for Python 2:
+ if hasattr(ctypes.pythonapi, 'Py_InitModule4_64'):
+ _Py_ssize_t = ctypes.c_int64
+ else:
+ _Py_ssize_t = ctypes.c_int
+ else:
+ # platform ssize_t on Python 3
+ _Py_ssize_t = ctypes.c_ssize_t
+
+ # regular python
+ class _PyObject(ctypes.Structure):
+ pass
+ _PyObject._fields_ = [
+ ('ob_refcnt', _Py_ssize_t),
+ ('ob_type', ctypes.POINTER(_PyObject))
+ ]
+
+ # python with trace
+ if hasattr(sys, 'getobjects'):
+ class _PyObject(ctypes.Structure):
+ pass
+ _PyObject._fields_ = [
+ ('_ob_next', ctypes.POINTER(_PyObject)),
+ ('_ob_prev', ctypes.POINTER(_PyObject)),
+ ('ob_refcnt', _Py_ssize_t),
+ ('ob_type', ctypes.POINTER(_PyObject))
+ ]
+
+ class _Traceback(_PyObject):
+ pass
+ _Traceback._fields_ = [
+ ('tb_next', ctypes.POINTER(_Traceback)),
+ ('tb_frame', ctypes.POINTER(_PyObject)),
+ ('tb_lasti', ctypes.c_int),
+ ('tb_lineno', ctypes.c_int)
+ ]
+
+ def tb_set_next(tb, next):
+ """Set the tb_next attribute of a traceback object."""
+ if not (isinstance(tb, TracebackType) and
+ (next is None or isinstance(next, TracebackType))):
+ raise TypeError('tb_set_next arguments must be traceback objects')
+ obj = _Traceback.from_address(id(tb))
+ if tb.tb_next is not None:
+ old = _Traceback.from_address(id(tb.tb_next))
+ old.ob_refcnt -= 1
+ if next is None:
+ obj.tb_next = ctypes.POINTER(_Traceback)()
+ else:
+ next = _Traceback.from_address(id(next))
+ next.ob_refcnt += 1
+ obj.tb_next = ctypes.pointer(next)
+
+ return tb_set_next
+
+
+# try to get a tb_set_next implementation if we don't have transparent
+# proxies.
+tb_set_next = None
+if tproxy is None:
+ try:
+ tb_set_next = _init_ugly_crap()
+ except:
+ pass
+ del _init_ugly_crap
diff --git a/venv/lib/python2.7/site-packages/Jinja2-2.8-py2.7.egg/jinja2/defaults.py b/venv/lib/python2.7/site-packages/Jinja2-2.8-py2.7.egg/jinja2/defaults.py
new file mode 100644
index 000000000..3717a7223
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/Jinja2-2.8-py2.7.egg/jinja2/defaults.py
@@ -0,0 +1,43 @@
+# -*- coding: utf-8 -*-
+"""
+ jinja2.defaults
+ ~~~~~~~~~~~~~~~
+
+ Jinja default filters and tags.
+
+ :copyright: (c) 2010 by the Jinja Team.
+ :license: BSD, see LICENSE for more details.
+"""
+from jinja2._compat import range_type
+from jinja2.utils import generate_lorem_ipsum, Cycler, Joiner
+
+
+# defaults for the parser / lexer
+BLOCK_START_STRING = '{%'
+BLOCK_END_STRING = '%}'
+VARIABLE_START_STRING = '{{'
+VARIABLE_END_STRING = '}}'
+COMMENT_START_STRING = '{#'
+COMMENT_END_STRING = '#}'
+LINE_STATEMENT_PREFIX = None
+LINE_COMMENT_PREFIX = None
+TRIM_BLOCKS = False
+LSTRIP_BLOCKS = False
+NEWLINE_SEQUENCE = '\n'
+KEEP_TRAILING_NEWLINE = False
+
+
+# default filters, tests and namespace
+from jinja2.filters import FILTERS as DEFAULT_FILTERS
+from jinja2.tests import TESTS as DEFAULT_TESTS
+DEFAULT_NAMESPACE = {
+ 'range': range_type,
+ 'dict': dict,
+ 'lipsum': generate_lorem_ipsum,
+ 'cycler': Cycler,
+ 'joiner': Joiner
+}
+
+
+# export all constants
+__all__ = tuple(x for x in locals().keys() if x.isupper())
diff --git a/venv/lib/python2.7/site-packages/Jinja2-2.8-py2.7.egg/jinja2/environment.py b/venv/lib/python2.7/site-packages/Jinja2-2.8-py2.7.egg/jinja2/environment.py
new file mode 100644
index 000000000..8b2572bb8
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/Jinja2-2.8-py2.7.egg/jinja2/environment.py
@@ -0,0 +1,1213 @@
+# -*- coding: utf-8 -*-
+"""
+ jinja2.environment
+ ~~~~~~~~~~~~~~~~~~
+
+ Provides a class that holds runtime and parsing time options.
+
+ :copyright: (c) 2010 by the Jinja Team.
+ :license: BSD, see LICENSE for more details.
+"""
+import os
+import sys
+from jinja2 import nodes
+from jinja2.defaults import BLOCK_START_STRING, \
+ BLOCK_END_STRING, VARIABLE_START_STRING, VARIABLE_END_STRING, \
+ COMMENT_START_STRING, COMMENT_END_STRING, LINE_STATEMENT_PREFIX, \
+ LINE_COMMENT_PREFIX, TRIM_BLOCKS, NEWLINE_SEQUENCE, \
+ DEFAULT_FILTERS, DEFAULT_TESTS, DEFAULT_NAMESPACE, \
+ KEEP_TRAILING_NEWLINE, LSTRIP_BLOCKS
+from jinja2.lexer import get_lexer, TokenStream
+from jinja2.parser import Parser
+from jinja2.nodes import EvalContext
+from jinja2.optimizer import optimize
+from jinja2.compiler import generate, CodeGenerator
+from jinja2.runtime import Undefined, new_context, Context
+from jinja2.exceptions import TemplateSyntaxError, TemplateNotFound, \
+ TemplatesNotFound, TemplateRuntimeError
+from jinja2.utils import import_string, LRUCache, Markup, missing, \
+ concat, consume, internalcode
+from jinja2._compat import imap, ifilter, string_types, iteritems, \
+ text_type, reraise, implements_iterator, implements_to_string, \
+ get_next, encode_filename, PY2, PYPY
+from functools import reduce
+
+
+# for direct template usage we have up to ten living environments
+_spontaneous_environments = LRUCache(10)
+
+# the function to create jinja traceback objects. This is dynamically
+# imported on the first exception in the exception handler.
+_make_traceback = None
+
+
+def get_spontaneous_environment(*args):
+ """Return a new spontaneous environment. A spontaneous environment is an
+ unnamed and unaccessible (in theory) environment that is used for
+ templates generated from a string and not from the file system.
+ """
+ try:
+ env = _spontaneous_environments.get(args)
+ except TypeError:
+ return Environment(*args)
+ if env is not None:
+ return env
+ _spontaneous_environments[args] = env = Environment(*args)
+ env.shared = True
+ return env
+
+
+def create_cache(size):
+ """Return the cache class for the given size."""
+ if size == 0:
+ return None
+ if size < 0:
+ return {}
+ return LRUCache(size)
+
+
+def copy_cache(cache):
+ """Create an empty copy of the given cache."""
+ if cache is None:
+ return None
+ elif type(cache) is dict:
+ return {}
+ return LRUCache(cache.capacity)
+
+
+def load_extensions(environment, extensions):
+ """Load the extensions from the list and bind it to the environment.
+ Returns a dict of instantiated environments.
+ """
+ result = {}
+ for extension in extensions:
+ if isinstance(extension, string_types):
+ extension = import_string(extension)
+ result[extension.identifier] = extension(environment)
+ return result
+
+
+def _environment_sanity_check(environment):
+ """Perform a sanity check on the environment."""
+ assert issubclass(environment.undefined, Undefined), 'undefined must ' \
+ 'be a subclass of undefined because filters depend on it.'
+ assert environment.block_start_string != \
+ environment.variable_start_string != \
+ environment.comment_start_string, 'block, variable and comment ' \
+ 'start strings must be different'
+ assert environment.newline_sequence in ('\r', '\r\n', '\n'), \
+ 'newline_sequence set to unknown line ending string.'
+ return environment
+
+
+class Environment(object):
+ r"""The core component of Jinja is the `Environment`. It contains
+ important shared variables like configuration, filters, tests,
+ globals and others. Instances of this class may be modified if
+ they are not shared and if no template was loaded so far.
+ Modifications on environments after the first template was loaded
+ will lead to surprising effects and undefined behavior.
+
+ Here are the possible initialization parameters:
+
+ `block_start_string`
+ The string marking the beginning of a block. Defaults to ``'{%'``.
+
+ `block_end_string`
+ The string marking the end of a block. Defaults to ``'%}'``.
+
+ `variable_start_string`
+ The string marking the beginning of a print statement.
+ Defaults to ``'{{'``.
+
+ `variable_end_string`
+ The string marking the end of a print statement. Defaults to
+ ``'}}'``.
+
+ `comment_start_string`
+ The string marking the beginning of a comment. Defaults to ``'{#'``.
+
+ `comment_end_string`
+ The string marking the end of a comment. Defaults to ``'#}'``.
+
+ `line_statement_prefix`
+ If given and a string, this will be used as prefix for line based
+ statements. See also :ref:`line-statements`.
+
+ `line_comment_prefix`
+ If given and a string, this will be used as prefix for line based
+ comments. See also :ref:`line-statements`.
+
+ .. versionadded:: 2.2
+
+ `trim_blocks`
+ If this is set to ``True`` the first newline after a block is
+ removed (block, not variable tag!). Defaults to `False`.
+
+ `lstrip_blocks`
+ If this is set to ``True`` leading spaces and tabs are stripped
+ from the start of a line to a block. Defaults to `False`.
+
+ `newline_sequence`
+ The sequence that starts a newline. Must be one of ``'\r'``,
+ ``'\n'`` or ``'\r\n'``. The default is ``'\n'`` which is a
+ useful default for Linux and OS X systems as well as web
+ applications.
+
+ `keep_trailing_newline`
+ Preserve the trailing newline when rendering templates.
+ The default is ``False``, which causes a single newline,
+ if present, to be stripped from the end of the template.
+
+ .. versionadded:: 2.7
+
+ `extensions`
+ List of Jinja extensions to use. This can either be import paths
+ as strings or extension classes. For more information have a
+ look at :ref:`the extensions documentation `.
+
+ `optimized`
+ should the optimizer be enabled? Default is `True`.
+
+ `undefined`
+ :class:`Undefined` or a subclass of it that is used to represent
+ undefined values in the template.
+
+ `finalize`
+ A callable that can be used to process the result of a variable
+ expression before it is output. For example one can convert
+ `None` implicitly into an empty string here.
+
+ `autoescape`
+ If set to true the XML/HTML autoescaping feature is enabled by
+ default. For more details about autoescaping see
+ :class:`~jinja2.utils.Markup`. As of Jinja 2.4 this can also
+ be a callable that is passed the template name and has to
+ return `True` or `False` depending on autoescape should be
+ enabled by default.
+
+ .. versionchanged:: 2.4
+ `autoescape` can now be a function
+
+ `loader`
+ The template loader for this environment.
+
+ `cache_size`
+ The size of the cache. Per default this is ``400`` which means
+ that if more than 400 templates are loaded the loader will clean
+ out the least recently used template. If the cache size is set to
+ ``0`` templates are recompiled all the time, if the cache size is
+ ``-1`` the cache will not be cleaned.
+
+ .. versionchanged:: 2.8
+ The cache size was increased to 400 from a low 50.
+
+ `auto_reload`
+ Some loaders load templates from locations where the template
+ sources may change (ie: file system or database). If
+ `auto_reload` is set to `True` (default) every time a template is
+ requested the loader checks if the source changed and if yes, it
+ will reload the template. For higher performance it's possible to
+ disable that.
+
+ `bytecode_cache`
+ If set to a bytecode cache object, this object will provide a
+ cache for the internal Jinja bytecode so that templates don't
+ have to be parsed if they were not changed.
+
+ See :ref:`bytecode-cache` for more information.
+ """
+
+ #: if this environment is sandboxed. Modifying this variable won't make
+ #: the environment sandboxed though. For a real sandboxed environment
+ #: have a look at jinja2.sandbox. This flag alone controls the code
+ #: generation by the compiler.
+ sandboxed = False
+
+ #: True if the environment is just an overlay
+ overlayed = False
+
+ #: the environment this environment is linked to if it is an overlay
+ linked_to = None
+
+ #: shared environments have this set to `True`. A shared environment
+ #: must not be modified
+ shared = False
+
+ #: these are currently EXPERIMENTAL undocumented features.
+ exception_handler = None
+ exception_formatter = None
+
+ #: the class that is used for code generation. See
+ #: :class:`~jinja2.compiler.CodeGenerator` for more information.
+ code_generator_class = CodeGenerator
+
+ #: the context class thatis used for templates. See
+ #: :class:`~jinja2.runtime.Context` for more information.
+ context_class = Context
+
+ def __init__(self,
+ block_start_string=BLOCK_START_STRING,
+ block_end_string=BLOCK_END_STRING,
+ variable_start_string=VARIABLE_START_STRING,
+ variable_end_string=VARIABLE_END_STRING,
+ comment_start_string=COMMENT_START_STRING,
+ comment_end_string=COMMENT_END_STRING,
+ line_statement_prefix=LINE_STATEMENT_PREFIX,
+ line_comment_prefix=LINE_COMMENT_PREFIX,
+ trim_blocks=TRIM_BLOCKS,
+ lstrip_blocks=LSTRIP_BLOCKS,
+ newline_sequence=NEWLINE_SEQUENCE,
+ keep_trailing_newline=KEEP_TRAILING_NEWLINE,
+ extensions=(),
+ optimized=True,
+ undefined=Undefined,
+ finalize=None,
+ autoescape=False,
+ loader=None,
+ cache_size=400,
+ auto_reload=True,
+ bytecode_cache=None):
+ # !!Important notice!!
+ # The constructor accepts quite a few arguments that should be
+ # passed by keyword rather than position. However it's important to
+ # not change the order of arguments because it's used at least
+ # internally in those cases:
+ # - spontaneous environments (i18n extension and Template)
+ # - unittests
+ # If parameter changes are required only add parameters at the end
+ # and don't change the arguments (or the defaults!) of the arguments
+ # existing already.
+
+ # lexer / parser information
+ self.block_start_string = block_start_string
+ self.block_end_string = block_end_string
+ self.variable_start_string = variable_start_string
+ self.variable_end_string = variable_end_string
+ self.comment_start_string = comment_start_string
+ self.comment_end_string = comment_end_string
+ self.line_statement_prefix = line_statement_prefix
+ self.line_comment_prefix = line_comment_prefix
+ self.trim_blocks = trim_blocks
+ self.lstrip_blocks = lstrip_blocks
+ self.newline_sequence = newline_sequence
+ self.keep_trailing_newline = keep_trailing_newline
+
+ # runtime information
+ self.undefined = undefined
+ self.optimized = optimized
+ self.finalize = finalize
+ self.autoescape = autoescape
+
+ # defaults
+ self.filters = DEFAULT_FILTERS.copy()
+ self.tests = DEFAULT_TESTS.copy()
+ self.globals = DEFAULT_NAMESPACE.copy()
+
+ # set the loader provided
+ self.loader = loader
+ self.cache = create_cache(cache_size)
+ self.bytecode_cache = bytecode_cache
+ self.auto_reload = auto_reload
+
+ # load extensions
+ self.extensions = load_extensions(self, extensions)
+
+ _environment_sanity_check(self)
+
+ def add_extension(self, extension):
+ """Adds an extension after the environment was created.
+
+ .. versionadded:: 2.5
+ """
+ self.extensions.update(load_extensions(self, [extension]))
+
+ def extend(self, **attributes):
+ """Add the items to the instance of the environment if they do not exist
+ yet. This is used by :ref:`extensions ` to register
+ callbacks and configuration values without breaking inheritance.
+ """
+ for key, value in iteritems(attributes):
+ if not hasattr(self, key):
+ setattr(self, key, value)
+
+ def overlay(self, block_start_string=missing, block_end_string=missing,
+ variable_start_string=missing, variable_end_string=missing,
+ comment_start_string=missing, comment_end_string=missing,
+ line_statement_prefix=missing, line_comment_prefix=missing,
+ trim_blocks=missing, lstrip_blocks=missing,
+ extensions=missing, optimized=missing,
+ undefined=missing, finalize=missing, autoescape=missing,
+ loader=missing, cache_size=missing, auto_reload=missing,
+ bytecode_cache=missing):
+ """Create a new overlay environment that shares all the data with the
+ current environment except for cache and the overridden attributes.
+ Extensions cannot be removed for an overlayed environment. An overlayed
+ environment automatically gets all the extensions of the environment it
+ is linked to plus optional extra extensions.
+
+ Creating overlays should happen after the initial environment was set
+ up completely. Not all attributes are truly linked, some are just
+ copied over so modifications on the original environment may not shine
+ through.
+ """
+ args = dict(locals())
+ del args['self'], args['cache_size'], args['extensions']
+
+ rv = object.__new__(self.__class__)
+ rv.__dict__.update(self.__dict__)
+ rv.overlayed = True
+ rv.linked_to = self
+
+ for key, value in iteritems(args):
+ if value is not missing:
+ setattr(rv, key, value)
+
+ if cache_size is not missing:
+ rv.cache = create_cache(cache_size)
+ else:
+ rv.cache = copy_cache(self.cache)
+
+ rv.extensions = {}
+ for key, value in iteritems(self.extensions):
+ rv.extensions[key] = value.bind(rv)
+ if extensions is not missing:
+ rv.extensions.update(load_extensions(rv, extensions))
+
+ return _environment_sanity_check(rv)
+
+ lexer = property(get_lexer, doc="The lexer for this environment.")
+
+ def iter_extensions(self):
+ """Iterates over the extensions by priority."""
+ return iter(sorted(self.extensions.values(),
+ key=lambda x: x.priority))
+
+ def getitem(self, obj, argument):
+ """Get an item or attribute of an object but prefer the item."""
+ try:
+ return obj[argument]
+ except (TypeError, LookupError):
+ if isinstance(argument, string_types):
+ try:
+ attr = str(argument)
+ except Exception:
+ pass
+ else:
+ try:
+ return getattr(obj, attr)
+ except AttributeError:
+ pass
+ return self.undefined(obj=obj, name=argument)
+
+ def getattr(self, obj, attribute):
+ """Get an item or attribute of an object but prefer the attribute.
+ Unlike :meth:`getitem` the attribute *must* be a bytestring.
+ """
+ try:
+ return getattr(obj, attribute)
+ except AttributeError:
+ pass
+ try:
+ return obj[attribute]
+ except (TypeError, LookupError, AttributeError):
+ return self.undefined(obj=obj, name=attribute)
+
+ def call_filter(self, name, value, args=None, kwargs=None,
+ context=None, eval_ctx=None):
+ """Invokes a filter on a value the same way the compiler does it.
+
+ .. versionadded:: 2.7
+ """
+ func = self.filters.get(name)
+ if func is None:
+ raise TemplateRuntimeError('no filter named %r' % name)
+ args = [value] + list(args or ())
+ if getattr(func, 'contextfilter', False):
+ if context is None:
+ raise TemplateRuntimeError('Attempted to invoke context '
+ 'filter without context')
+ args.insert(0, context)
+ elif getattr(func, 'evalcontextfilter', False):
+ if eval_ctx is None:
+ if context is not None:
+ eval_ctx = context.eval_ctx
+ else:
+ eval_ctx = EvalContext(self)
+ args.insert(0, eval_ctx)
+ elif getattr(func, 'environmentfilter', False):
+ args.insert(0, self)
+ return func(*args, **(kwargs or {}))
+
+ def call_test(self, name, value, args=None, kwargs=None):
+ """Invokes a test on a value the same way the compiler does it.
+
+ .. versionadded:: 2.7
+ """
+ func = self.tests.get(name)
+ if func is None:
+ raise TemplateRuntimeError('no test named %r' % name)
+ return func(value, *(args or ()), **(kwargs or {}))
+
+ @internalcode
+ def parse(self, source, name=None, filename=None):
+ """Parse the sourcecode and return the abstract syntax tree. This
+ tree of nodes is used by the compiler to convert the template into
+ executable source- or bytecode. This is useful for debugging or to
+ extract information from templates.
+
+ If you are :ref:`developing Jinja2 extensions `
+ this gives you a good overview of the node tree generated.
+ """
+ try:
+ return self._parse(source, name, filename)
+ except TemplateSyntaxError:
+ exc_info = sys.exc_info()
+ self.handle_exception(exc_info, source_hint=source)
+
+ def _parse(self, source, name, filename):
+ """Internal parsing function used by `parse` and `compile`."""
+ return Parser(self, source, name, encode_filename(filename)).parse()
+
+ def lex(self, source, name=None, filename=None):
+ """Lex the given sourcecode and return a generator that yields
+ tokens as tuples in the form ``(lineno, token_type, value)``.
+ This can be useful for :ref:`extension development `
+ and debugging templates.
+
+ This does not perform preprocessing. If you want the preprocessing
+ of the extensions to be applied you have to filter source through
+ the :meth:`preprocess` method.
+ """
+ source = text_type(source)
+ try:
+ return self.lexer.tokeniter(source, name, filename)
+ except TemplateSyntaxError:
+ exc_info = sys.exc_info()
+ self.handle_exception(exc_info, source_hint=source)
+
+ def preprocess(self, source, name=None, filename=None):
+ """Preprocesses the source with all extensions. This is automatically
+ called for all parsing and compiling methods but *not* for :meth:`lex`
+ because there you usually only want the actual source tokenized.
+ """
+ return reduce(lambda s, e: e.preprocess(s, name, filename),
+ self.iter_extensions(), text_type(source))
+
+ def _tokenize(self, source, name, filename=None, state=None):
+ """Called by the parser to do the preprocessing and filtering
+ for all the extensions. Returns a :class:`~jinja2.lexer.TokenStream`.
+ """
+ source = self.preprocess(source, name, filename)
+ stream = self.lexer.tokenize(source, name, filename, state)
+ for ext in self.iter_extensions():
+ stream = ext.filter_stream(stream)
+ if not isinstance(stream, TokenStream):
+ stream = TokenStream(stream, name, filename)
+ return stream
+
+ def _generate(self, source, name, filename, defer_init=False):
+ """Internal hook that can be overridden to hook a different generate
+ method in.
+
+ .. versionadded:: 2.5
+ """
+ return generate(source, self, name, filename, defer_init=defer_init)
+
+ def _compile(self, source, filename):
+ """Internal hook that can be overridden to hook a different compile
+ method in.
+
+ .. versionadded:: 2.5
+ """
+ return compile(source, filename, 'exec')
+
+ @internalcode
+ def compile(self, source, name=None, filename=None, raw=False,
+ defer_init=False):
+ """Compile a node or template source code. The `name` parameter is
+ the load name of the template after it was joined using
+ :meth:`join_path` if necessary, not the filename on the file system.
+ the `filename` parameter is the estimated filename of the template on
+ the file system. If the template came from a database or memory this
+ can be omitted.
+
+ The return value of this method is a python code object. If the `raw`
+ parameter is `True` the return value will be a string with python
+ code equivalent to the bytecode returned otherwise. This method is
+ mainly used internally.
+
+ `defer_init` is use internally to aid the module code generator. This
+ causes the generated code to be able to import without the global
+ environment variable to be set.
+
+ .. versionadded:: 2.4
+ `defer_init` parameter added.
+ """
+ source_hint = None
+ try:
+ if isinstance(source, string_types):
+ source_hint = source
+ source = self._parse(source, name, filename)
+ if self.optimized:
+ source = optimize(source, self)
+ source = self._generate(source, name, filename,
+ defer_init=defer_init)
+ if raw:
+ return source
+ if filename is None:
+ filename = ''
+ else:
+ filename = encode_filename(filename)
+ return self._compile(source, filename)
+ except TemplateSyntaxError:
+ exc_info = sys.exc_info()
+ self.handle_exception(exc_info, source_hint=source_hint)
+
+ def compile_expression(self, source, undefined_to_none=True):
+ """A handy helper method that returns a callable that accepts keyword
+ arguments that appear as variables in the expression. If called it
+ returns the result of the expression.
+
+ This is useful if applications want to use the same rules as Jinja
+ in template "configuration files" or similar situations.
+
+ Example usage:
+
+ >>> env = Environment()
+ >>> expr = env.compile_expression('foo == 42')
+ >>> expr(foo=23)
+ False
+ >>> expr(foo=42)
+ True
+
+ Per default the return value is converted to `None` if the
+ expression returns an undefined value. This can be changed
+ by setting `undefined_to_none` to `False`.
+
+ >>> env.compile_expression('var')() is None
+ True
+ >>> env.compile_expression('var', undefined_to_none=False)()
+ Undefined
+
+ .. versionadded:: 2.1
+ """
+ parser = Parser(self, source, state='variable')
+ exc_info = None
+ try:
+ expr = parser.parse_expression()
+ if not parser.stream.eos:
+ raise TemplateSyntaxError('chunk after expression',
+ parser.stream.current.lineno,
+ None, None)
+ expr.set_environment(self)
+ except TemplateSyntaxError:
+ exc_info = sys.exc_info()
+ if exc_info is not None:
+ self.handle_exception(exc_info, source_hint=source)
+ body = [nodes.Assign(nodes.Name('result', 'store'), expr, lineno=1)]
+ template = self.from_string(nodes.Template(body, lineno=1))
+ return TemplateExpression(template, undefined_to_none)
+
+ def compile_templates(self, target, extensions=None, filter_func=None,
+ zip='deflated', log_function=None,
+ ignore_errors=True, py_compile=False):
+ """Finds all the templates the loader can find, compiles them
+ and stores them in `target`. If `zip` is `None`, instead of in a
+ zipfile, the templates will be stored in a directory.
+ By default a deflate zip algorithm is used. To switch to
+ the stored algorithm, `zip` can be set to ``'stored'``.
+
+ `extensions` and `filter_func` are passed to :meth:`list_templates`.
+ Each template returned will be compiled to the target folder or
+ zipfile.
+
+ By default template compilation errors are ignored. In case a
+ log function is provided, errors are logged. If you want template
+ syntax errors to abort the compilation you can set `ignore_errors`
+ to `False` and you will get an exception on syntax errors.
+
+ If `py_compile` is set to `True` .pyc files will be written to the
+ target instead of standard .py files. This flag does not do anything
+ on pypy and Python 3 where pyc files are not picked up by itself and
+ don't give much benefit.
+
+ .. versionadded:: 2.4
+ """
+ from jinja2.loaders import ModuleLoader
+
+ if log_function is None:
+ log_function = lambda x: None
+
+ if py_compile:
+ if not PY2 or PYPY:
+ from warnings import warn
+ warn(Warning('py_compile has no effect on pypy or Python 3'))
+ py_compile = False
+ else:
+ import imp
+ import marshal
+ py_header = imp.get_magic() + \
+ u'\xff\xff\xff\xff'.encode('iso-8859-15')
+
+ # Python 3.3 added a source filesize to the header
+ if sys.version_info >= (3, 3):
+ py_header += u'\x00\x00\x00\x00'.encode('iso-8859-15')
+
+ def write_file(filename, data, mode):
+ if zip:
+ info = ZipInfo(filename)
+ info.external_attr = 0o755 << 16
+ zip_file.writestr(info, data)
+ else:
+ f = open(os.path.join(target, filename), mode)
+ try:
+ f.write(data)
+ finally:
+ f.close()
+
+ if zip is not None:
+ from zipfile import ZipFile, ZipInfo, ZIP_DEFLATED, ZIP_STORED
+ zip_file = ZipFile(target, 'w', dict(deflated=ZIP_DEFLATED,
+ stored=ZIP_STORED)[zip])
+ log_function('Compiling into Zip archive "%s"' % target)
+ else:
+ if not os.path.isdir(target):
+ os.makedirs(target)
+ log_function('Compiling into folder "%s"' % target)
+
+ try:
+ for name in self.list_templates(extensions, filter_func):
+ source, filename, _ = self.loader.get_source(self, name)
+ try:
+ code = self.compile(source, name, filename, True, True)
+ except TemplateSyntaxError as e:
+ if not ignore_errors:
+ raise
+ log_function('Could not compile "%s": %s' % (name, e))
+ continue
+
+ filename = ModuleLoader.get_module_filename(name)
+
+ if py_compile:
+ c = self._compile(code, encode_filename(filename))
+ write_file(filename + 'c', py_header +
+ marshal.dumps(c), 'wb')
+ log_function('Byte-compiled "%s" as %s' %
+ (name, filename + 'c'))
+ else:
+ write_file(filename, code, 'w')
+ log_function('Compiled "%s" as %s' % (name, filename))
+ finally:
+ if zip:
+ zip_file.close()
+
+ log_function('Finished compiling templates')
+
+ def list_templates(self, extensions=None, filter_func=None):
+ """Returns a list of templates for this environment. This requires
+ that the loader supports the loader's
+ :meth:`~BaseLoader.list_templates` method.
+
+ If there are other files in the template folder besides the
+ actual templates, the returned list can be filtered. There are two
+ ways: either `extensions` is set to a list of file extensions for
+ templates, or a `filter_func` can be provided which is a callable that
+ is passed a template name and should return `True` if it should end up
+ in the result list.
+
+ If the loader does not support that, a :exc:`TypeError` is raised.
+
+ .. versionadded:: 2.4
+ """
+ x = self.loader.list_templates()
+ if extensions is not None:
+ if filter_func is not None:
+ raise TypeError('either extensions or filter_func '
+ 'can be passed, but not both')
+ filter_func = lambda x: '.' in x and \
+ x.rsplit('.', 1)[1] in extensions
+ if filter_func is not None:
+ x = list(ifilter(filter_func, x))
+ return x
+
+ def handle_exception(self, exc_info=None, rendered=False, source_hint=None):
+ """Exception handling helper. This is used internally to either raise
+ rewritten exceptions or return a rendered traceback for the template.
+ """
+ global _make_traceback
+ if exc_info is None:
+ exc_info = sys.exc_info()
+
+ # the debugging module is imported when it's used for the first time.
+ # we're doing a lot of stuff there and for applications that do not
+ # get any exceptions in template rendering there is no need to load
+ # all of that.
+ if _make_traceback is None:
+ from jinja2.debug import make_traceback as _make_traceback
+ traceback = _make_traceback(exc_info, source_hint)
+ if rendered and self.exception_formatter is not None:
+ return self.exception_formatter(traceback)
+ if self.exception_handler is not None:
+ self.exception_handler(traceback)
+ exc_type, exc_value, tb = traceback.standard_exc_info
+ reraise(exc_type, exc_value, tb)
+
+ def join_path(self, template, parent):
+ """Join a template with the parent. By default all the lookups are
+ relative to the loader root so this method returns the `template`
+ parameter unchanged, but if the paths should be relative to the
+ parent template, this function can be used to calculate the real
+ template name.
+
+ Subclasses may override this method and implement template path
+ joining here.
+ """
+ return template
+
+ @internalcode
+ def _load_template(self, name, globals):
+ if self.loader is None:
+ raise TypeError('no loader for this environment specified')
+ try:
+ # use abs path for cache key
+ cache_key = self.loader.get_source(self, name)[1]
+ except RuntimeError:
+ # if loader does not implement get_source()
+ cache_key = None
+ # if template is not file, use name for cache key
+ if cache_key is None:
+ cache_key = name
+ if self.cache is not None:
+ template = self.cache.get(cache_key)
+ if template is not None and (not self.auto_reload or
+ template.is_up_to_date):
+ return template
+ template = self.loader.load(self, name, globals)
+ if self.cache is not None:
+ self.cache[cache_key] = template
+ return template
+
+ @internalcode
+ def get_template(self, name, parent=None, globals=None):
+ """Load a template from the loader. If a loader is configured this
+ method ask the loader for the template and returns a :class:`Template`.
+ If the `parent` parameter is not `None`, :meth:`join_path` is called
+ to get the real template name before loading.
+
+ The `globals` parameter can be used to provide template wide globals.
+ These variables are available in the context at render time.
+
+ If the template does not exist a :exc:`TemplateNotFound` exception is
+ raised.
+
+ .. versionchanged:: 2.4
+ If `name` is a :class:`Template` object it is returned from the
+ function unchanged.
+ """
+ if isinstance(name, Template):
+ return name
+ if parent is not None:
+ name = self.join_path(name, parent)
+ return self._load_template(name, self.make_globals(globals))
+
+ @internalcode
+ def select_template(self, names, parent=None, globals=None):
+ """Works like :meth:`get_template` but tries a number of templates
+ before it fails. If it cannot find any of the templates, it will
+ raise a :exc:`TemplatesNotFound` exception.
+
+ .. versionadded:: 2.3
+
+ .. versionchanged:: 2.4
+ If `names` contains a :class:`Template` object it is returned
+ from the function unchanged.
+ """
+ if not names:
+ raise TemplatesNotFound(message=u'Tried to select from an empty list '
+ u'of templates.')
+ globals = self.make_globals(globals)
+ for name in names:
+ if isinstance(name, Template):
+ return name
+ if parent is not None:
+ name = self.join_path(name, parent)
+ try:
+ return self._load_template(name, globals)
+ except TemplateNotFound:
+ pass
+ raise TemplatesNotFound(names)
+
+ @internalcode
+ def get_or_select_template(self, template_name_or_list,
+ parent=None, globals=None):
+ """Does a typecheck and dispatches to :meth:`select_template`
+ if an iterable of template names is given, otherwise to
+ :meth:`get_template`.
+
+ .. versionadded:: 2.3
+ """
+ if isinstance(template_name_or_list, string_types):
+ return self.get_template(template_name_or_list, parent, globals)
+ elif isinstance(template_name_or_list, Template):
+ return template_name_or_list
+ return self.select_template(template_name_or_list, parent, globals)
+
+ def from_string(self, source, globals=None, template_class=None):
+ """Load a template from a string. This parses the source given and
+ returns a :class:`Template` object.
+ """
+ globals = self.make_globals(globals)
+ cls = template_class or self.template_class
+ return cls.from_code(self, self.compile(source), globals, None)
+
+ def make_globals(self, d):
+ """Return a dict for the globals."""
+ if not d:
+ return self.globals
+ return dict(self.globals, **d)
+
+
+class Template(object):
+ """The central template object. This class represents a compiled template
+ and is used to evaluate it.
+
+ Normally the template object is generated from an :class:`Environment` but
+ it also has a constructor that makes it possible to create a template
+ instance directly using the constructor. It takes the same arguments as
+ the environment constructor but it's not possible to specify a loader.
+
+ Every template object has a few methods and members that are guaranteed
+ to exist. However it's important that a template object should be
+ considered immutable. Modifications on the object are not supported.
+
+ Template objects created from the constructor rather than an environment
+ do have an `environment` attribute that points to a temporary environment
+ that is probably shared with other templates created with the constructor
+ and compatible settings.
+
+ >>> template = Template('Hello {{ name }}!')
+ >>> template.render(name='John Doe') == u'Hello John Doe!'
+ True
+ >>> stream = template.stream(name='John Doe')
+ >>> next(stream) == u'Hello John Doe!'
+ True
+ >>> next(stream)
+ Traceback (most recent call last):
+ ...
+ StopIteration
+ """
+
+ def __new__(cls, source,
+ block_start_string=BLOCK_START_STRING,
+ block_end_string=BLOCK_END_STRING,
+ variable_start_string=VARIABLE_START_STRING,
+ variable_end_string=VARIABLE_END_STRING,
+ comment_start_string=COMMENT_START_STRING,
+ comment_end_string=COMMENT_END_STRING,
+ line_statement_prefix=LINE_STATEMENT_PREFIX,
+ line_comment_prefix=LINE_COMMENT_PREFIX,
+ trim_blocks=TRIM_BLOCKS,
+ lstrip_blocks=LSTRIP_BLOCKS,
+ newline_sequence=NEWLINE_SEQUENCE,
+ keep_trailing_newline=KEEP_TRAILING_NEWLINE,
+ extensions=(),
+ optimized=True,
+ undefined=Undefined,
+ finalize=None,
+ autoescape=False):
+ env = get_spontaneous_environment(
+ block_start_string, block_end_string, variable_start_string,
+ variable_end_string, comment_start_string, comment_end_string,
+ line_statement_prefix, line_comment_prefix, trim_blocks,
+ lstrip_blocks, newline_sequence, keep_trailing_newline,
+ frozenset(extensions), optimized, undefined, finalize, autoescape,
+ None, 0, False, None)
+ return env.from_string(source, template_class=cls)
+
+ @classmethod
+ def from_code(cls, environment, code, globals, uptodate=None):
+ """Creates a template object from compiled code and the globals. This
+ is used by the loaders and environment to create a template object.
+ """
+ namespace = {
+ 'environment': environment,
+ '__file__': code.co_filename
+ }
+ exec(code, namespace)
+ rv = cls._from_namespace(environment, namespace, globals)
+ rv._uptodate = uptodate
+ return rv
+
+ @classmethod
+ def from_module_dict(cls, environment, module_dict, globals):
+ """Creates a template object from a module. This is used by the
+ module loader to create a template object.
+
+ .. versionadded:: 2.4
+ """
+ return cls._from_namespace(environment, module_dict, globals)
+
+ @classmethod
+ def _from_namespace(cls, environment, namespace, globals):
+ t = object.__new__(cls)
+ t.environment = environment
+ t.globals = globals
+ t.name = namespace['name']
+ t.filename = namespace['__file__']
+ t.blocks = namespace['blocks']
+
+ # render function and module
+ t.root_render_func = namespace['root']
+ t._module = None
+
+ # debug and loader helpers
+ t._debug_info = namespace['debug_info']
+ t._uptodate = None
+
+ # store the reference
+ namespace['environment'] = environment
+ namespace['__jinja_template__'] = t
+
+ return t
+
+ def render(self, *args, **kwargs):
+ """This method accepts the same arguments as the `dict` constructor:
+ A dict, a dict subclass or some keyword arguments. If no arguments
+ are given the context will be empty. These two calls do the same::
+
+ template.render(knights='that say nih')
+ template.render({'knights': 'that say nih'})
+
+ This will return the rendered template as unicode string.
+ """
+ vars = dict(*args, **kwargs)
+ try:
+ return concat(self.root_render_func(self.new_context(vars)))
+ except Exception:
+ exc_info = sys.exc_info()
+ return self.environment.handle_exception(exc_info, True)
+
+ def stream(self, *args, **kwargs):
+ """Works exactly like :meth:`generate` but returns a
+ :class:`TemplateStream`.
+ """
+ return TemplateStream(self.generate(*args, **kwargs))
+
+ def generate(self, *args, **kwargs):
+ """For very large templates it can be useful to not render the whole
+ template at once but evaluate each statement after another and yield
+ piece for piece. This method basically does exactly that and returns
+ a generator that yields one item after another as unicode strings.
+
+ It accepts the same arguments as :meth:`render`.
+ """
+ vars = dict(*args, **kwargs)
+ try:
+ for event in self.root_render_func(self.new_context(vars)):
+ yield event
+ except Exception:
+ exc_info = sys.exc_info()
+ else:
+ return
+ yield self.environment.handle_exception(exc_info, True)
+
+ def new_context(self, vars=None, shared=False, locals=None):
+ """Create a new :class:`Context` for this template. The vars
+ provided will be passed to the template. Per default the globals
+ are added to the context. If shared is set to `True` the data
+ is passed as it to the context without adding the globals.
+
+ `locals` can be a dict of local variables for internal usage.
+ """
+ return new_context(self.environment, self.name, self.blocks,
+ vars, shared, self.globals, locals)
+
+ def make_module(self, vars=None, shared=False, locals=None):
+ """This method works like the :attr:`module` attribute when called
+ without arguments but it will evaluate the template on every call
+ rather than caching it. It's also possible to provide
+ a dict which is then used as context. The arguments are the same
+ as for the :meth:`new_context` method.
+ """
+ return TemplateModule(self, self.new_context(vars, shared, locals))
+
+ @property
+ def module(self):
+ """The template as module. This is used for imports in the
+ template runtime but is also useful if one wants to access
+ exported template variables from the Python layer:
+
+ >>> t = Template('{% macro foo() %}42{% endmacro %}23')
+ >>> str(t.module)
+ '23'
+ >>> t.module.foo() == u'42'
+ True
+ """
+ if self._module is not None:
+ return self._module
+ self._module = rv = self.make_module()
+ return rv
+
+ def get_corresponding_lineno(self, lineno):
+ """Return the source line number of a line number in the
+ generated bytecode as they are not in sync.
+ """
+ for template_line, code_line in reversed(self.debug_info):
+ if code_line <= lineno:
+ return template_line
+ return 1
+
+ @property
+ def is_up_to_date(self):
+ """If this variable is `False` there is a newer version available."""
+ if self._uptodate is None:
+ return True
+ return self._uptodate()
+
+ @property
+ def debug_info(self):
+ """The debug info mapping."""
+ return [tuple(imap(int, x.split('='))) for x in
+ self._debug_info.split('&')]
+
+ def __repr__(self):
+ if self.name is None:
+ name = 'memory:%x' % id(self)
+ else:
+ name = repr(self.name)
+ return '<%s %s>' % (self.__class__.__name__, name)
+
+
+@implements_to_string
+class TemplateModule(object):
+ """Represents an imported template. All the exported names of the
+ template are available as attributes on this object. Additionally
+ converting it into an unicode- or bytestrings renders the contents.
+ """
+
+ def __init__(self, template, context):
+ self._body_stream = list(template.root_render_func(context))
+ self.__dict__.update(context.get_exported())
+ self.__name__ = template.name
+
+ def __html__(self):
+ return Markup(concat(self._body_stream))
+
+ def __str__(self):
+ return concat(self._body_stream)
+
+ def __repr__(self):
+ if self.__name__ is None:
+ name = 'memory:%x' % id(self)
+ else:
+ name = repr(self.__name__)
+ return '<%s %s>' % (self.__class__.__name__, name)
+
+
+class TemplateExpression(object):
+ """The :meth:`jinja2.Environment.compile_expression` method returns an
+ instance of this object. It encapsulates the expression-like access
+ to the template with an expression it wraps.
+ """
+
+ def __init__(self, template, undefined_to_none):
+ self._template = template
+ self._undefined_to_none = undefined_to_none
+
+ def __call__(self, *args, **kwargs):
+ context = self._template.new_context(dict(*args, **kwargs))
+ consume(self._template.root_render_func(context))
+ rv = context.vars['result']
+ if self._undefined_to_none and isinstance(rv, Undefined):
+ rv = None
+ return rv
+
+
+@implements_iterator
+class TemplateStream(object):
+ """A template stream works pretty much like an ordinary python generator
+ but it can buffer multiple items to reduce the number of total iterations.
+ Per default the output is unbuffered which means that for every unbuffered
+ instruction in the template one unicode string is yielded.
+
+ If buffering is enabled with a buffer size of 5, five items are combined
+ into a new unicode string. This is mainly useful if you are streaming
+ big templates to a client via WSGI which flushes after each iteration.
+ """
+
+ def __init__(self, gen):
+ self._gen = gen
+ self.disable_buffering()
+
+ def dump(self, fp, encoding=None, errors='strict'):
+ """Dump the complete stream into a file or file-like object.
+ Per default unicode strings are written, if you want to encode
+ before writing specify an `encoding`.
+
+ Example usage::
+
+ Template('Hello {{ name }}!').stream(name='foo').dump('hello.html')
+ """
+ close = False
+ if isinstance(fp, string_types):
+ if encoding is None:
+ encoding = 'utf-8'
+ fp = open(fp, 'wb')
+ close = True
+ try:
+ if encoding is not None:
+ iterable = (x.encode(encoding, errors) for x in self)
+ else:
+ iterable = self
+ if hasattr(fp, 'writelines'):
+ fp.writelines(iterable)
+ else:
+ for item in iterable:
+ fp.write(item)
+ finally:
+ if close:
+ fp.close()
+
+ def disable_buffering(self):
+ """Disable the output buffering."""
+ self._next = get_next(self._gen)
+ self.buffered = False
+
+ def enable_buffering(self, size=5):
+ """Enable buffering. Buffer `size` items before yielding them."""
+ if size <= 1:
+ raise ValueError('buffer size too small')
+
+ def generator(next):
+ buf = []
+ c_size = 0
+ push = buf.append
+
+ while 1:
+ try:
+ while c_size < size:
+ c = next()
+ push(c)
+ if c:
+ c_size += 1
+ except StopIteration:
+ if not c_size:
+ return
+ yield concat(buf)
+ del buf[:]
+ c_size = 0
+
+ self.buffered = True
+ self._next = get_next(generator(get_next(self._gen)))
+
+ def __iter__(self):
+ return self
+
+ def __next__(self):
+ return self._next()
+
+
+# hook in default template class. if anyone reads this comment: ignore that
+# it's possible to use custom templates ;-)
+Environment.template_class = Template
diff --git a/venv/lib/python2.7/site-packages/Jinja2-2.8-py2.7.egg/jinja2/exceptions.py b/venv/lib/python2.7/site-packages/Jinja2-2.8-py2.7.egg/jinja2/exceptions.py
new file mode 100644
index 000000000..c9df6dc7c
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/Jinja2-2.8-py2.7.egg/jinja2/exceptions.py
@@ -0,0 +1,146 @@
+# -*- coding: utf-8 -*-
+"""
+ jinja2.exceptions
+ ~~~~~~~~~~~~~~~~~
+
+ Jinja exceptions.
+
+ :copyright: (c) 2010 by the Jinja Team.
+ :license: BSD, see LICENSE for more details.
+"""
+from jinja2._compat import imap, text_type, PY2, implements_to_string
+
+
+class TemplateError(Exception):
+ """Baseclass for all template errors."""
+
+ if PY2:
+ def __init__(self, message=None):
+ if message is not None:
+ message = text_type(message).encode('utf-8')
+ Exception.__init__(self, message)
+
+ @property
+ def message(self):
+ if self.args:
+ message = self.args[0]
+ if message is not None:
+ return message.decode('utf-8', 'replace')
+
+ def __unicode__(self):
+ return self.message or u''
+ else:
+ def __init__(self, message=None):
+ Exception.__init__(self, message)
+
+ @property
+ def message(self):
+ if self.args:
+ message = self.args[0]
+ if message is not None:
+ return message
+
+
+@implements_to_string
+class TemplateNotFound(IOError, LookupError, TemplateError):
+ """Raised if a template does not exist."""
+
+ # looks weird, but removes the warning descriptor that just
+ # bogusly warns us about message being deprecated
+ message = None
+
+ def __init__(self, name, message=None):
+ IOError.__init__(self)
+ if message is None:
+ message = name
+ self.message = message
+ self.name = name
+ self.templates = [name]
+
+ def __str__(self):
+ return self.message
+
+
+class TemplatesNotFound(TemplateNotFound):
+ """Like :class:`TemplateNotFound` but raised if multiple templates
+ are selected. This is a subclass of :class:`TemplateNotFound`
+ exception, so just catching the base exception will catch both.
+
+ .. versionadded:: 2.2
+ """
+
+ def __init__(self, names=(), message=None):
+ if message is None:
+ message = u'none of the templates given were found: ' + \
+ u', '.join(imap(text_type, names))
+ TemplateNotFound.__init__(self, names and names[-1] or None, message)
+ self.templates = list(names)
+
+
+@implements_to_string
+class TemplateSyntaxError(TemplateError):
+ """Raised to tell the user that there is a problem with the template."""
+
+ def __init__(self, message, lineno, name=None, filename=None):
+ TemplateError.__init__(self, message)
+ self.lineno = lineno
+ self.name = name
+ self.filename = filename
+ self.source = None
+
+ # this is set to True if the debug.translate_syntax_error
+ # function translated the syntax error into a new traceback
+ self.translated = False
+
+ def __str__(self):
+ # for translated errors we only return the message
+ if self.translated:
+ return self.message
+
+ # otherwise attach some stuff
+ location = 'line %d' % self.lineno
+ name = self.filename or self.name
+ if name:
+ location = 'File "%s", %s' % (name, location)
+ lines = [self.message, ' ' + location]
+
+ # if the source is set, add the line to the output
+ if self.source is not None:
+ try:
+ line = self.source.splitlines()[self.lineno - 1]
+ except IndexError:
+ line = None
+ if line:
+ lines.append(' ' + line.strip())
+
+ return u'\n'.join(lines)
+
+
+class TemplateAssertionError(TemplateSyntaxError):
+ """Like a template syntax error, but covers cases where something in the
+ template caused an error at compile time that wasn't necessarily caused
+ by a syntax error. However it's a direct subclass of
+ :exc:`TemplateSyntaxError` and has the same attributes.
+ """
+
+
+class TemplateRuntimeError(TemplateError):
+ """A generic runtime error in the template engine. Under some situations
+ Jinja may raise this exception.
+ """
+
+
+class UndefinedError(TemplateRuntimeError):
+ """Raised if a template tries to operate on :class:`Undefined`."""
+
+
+class SecurityError(TemplateRuntimeError):
+ """Raised if a template tries to do something insecure if the
+ sandbox is enabled.
+ """
+
+
+class FilterArgumentError(TemplateRuntimeError):
+ """This error is raised if a filter was called with inappropriate
+ arguments
+ """
diff --git a/venv/lib/python2.7/site-packages/Jinja2-2.8-py2.7.egg/jinja2/ext.py b/venv/lib/python2.7/site-packages/Jinja2-2.8-py2.7.egg/jinja2/ext.py
new file mode 100644
index 000000000..562ab506f
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/Jinja2-2.8-py2.7.egg/jinja2/ext.py
@@ -0,0 +1,636 @@
+# -*- coding: utf-8 -*-
+"""
+ jinja2.ext
+ ~~~~~~~~~~
+
+ Jinja extensions allow to add custom tags similar to the way django custom
+ tags work. By default two example extensions exist: an i18n and a cache
+ extension.
+
+ :copyright: (c) 2010 by the Jinja Team.
+ :license: BSD.
+"""
+from jinja2 import nodes
+from jinja2.defaults import BLOCK_START_STRING, \
+ BLOCK_END_STRING, VARIABLE_START_STRING, VARIABLE_END_STRING, \
+ COMMENT_START_STRING, COMMENT_END_STRING, LINE_STATEMENT_PREFIX, \
+ LINE_COMMENT_PREFIX, TRIM_BLOCKS, NEWLINE_SEQUENCE, \
+ KEEP_TRAILING_NEWLINE, LSTRIP_BLOCKS
+from jinja2.environment import Environment
+from jinja2.runtime import concat
+from jinja2.exceptions import TemplateAssertionError, TemplateSyntaxError
+from jinja2.utils import contextfunction, import_string, Markup
+from jinja2._compat import with_metaclass, string_types, iteritems
+
+
+# the only real useful gettext functions for a Jinja template. Note
+# that ugettext must be assigned to gettext as Jinja doesn't support
+# non unicode strings.
+GETTEXT_FUNCTIONS = ('_', 'gettext', 'ngettext')
+
+
+class ExtensionRegistry(type):
+ """Gives the extension an unique identifier."""
+
+ def __new__(cls, name, bases, d):
+ rv = type.__new__(cls, name, bases, d)
+ rv.identifier = rv.__module__ + '.' + rv.__name__
+ return rv
+
+
+class Extension(with_metaclass(ExtensionRegistry, object)):
+ """Extensions can be used to add extra functionality to the Jinja template
+ system at the parser level. Custom extensions are bound to an environment
+ but may not store environment specific data on `self`. The reason for
+ this is that an extension can be bound to another environment (for
+ overlays) by creating a copy and reassigning the `environment` attribute.
+
+ As extensions are created by the environment they cannot accept any
+ arguments for configuration. One may want to work around that by using
+ a factory function, but that is not possible as extensions are identified
+ by their import name. The correct way to configure the extension is
+ storing the configuration values on the environment. Because this way the
+ environment ends up acting as central configuration storage the
+ attributes may clash which is why extensions have to ensure that the names
+ they choose for configuration are not too generic. ``prefix`` for example
+ is a terrible name, ``fragment_cache_prefix`` on the other hand is a good
+ name as includes the name of the extension (fragment cache).
+ """
+
+ #: if this extension parses this is the list of tags it's listening to.
+ tags = set()
+
+ #: the priority of that extension. This is especially useful for
+ #: extensions that preprocess values. A lower value means higher
+ #: priority.
+ #:
+ #: .. versionadded:: 2.4
+ priority = 100
+
+ def __init__(self, environment):
+ self.environment = environment
+
+ def bind(self, environment):
+ """Create a copy of this extension bound to another environment."""
+ rv = object.__new__(self.__class__)
+ rv.__dict__.update(self.__dict__)
+ rv.environment = environment
+ return rv
+
+ def preprocess(self, source, name, filename=None):
+ """This method is called before the actual lexing and can be used to
+ preprocess the source. The `filename` is optional. The return value
+ must be the preprocessed source.
+ """
+ return source
+
+ def filter_stream(self, stream):
+ """It's passed a :class:`~jinja2.lexer.TokenStream` that can be used
+ to filter tokens returned. This method has to return an iterable of
+ :class:`~jinja2.lexer.Token`\s, but it doesn't have to return a
+ :class:`~jinja2.lexer.TokenStream`.
+
+ In the `ext` folder of the Jinja2 source distribution there is a file
+ called `inlinegettext.py` which implements a filter that utilizes this
+ method.
+ """
+ return stream
+
+ def parse(self, parser):
+ """If any of the :attr:`tags` matched this method is called with the
+ parser as first argument. The token the parser stream is pointing at
+ is the name token that matched. This method has to return one or a
+ list of multiple nodes.
+ """
+ raise NotImplementedError()
+
+ def attr(self, name, lineno=None):
+ """Return an attribute node for the current extension. This is useful
+ to pass constants on extensions to generated template code.
+
+ ::
+
+ self.attr('_my_attribute', lineno=lineno)
+ """
+ return nodes.ExtensionAttribute(self.identifier, name, lineno=lineno)
+
+ def call_method(self, name, args=None, kwargs=None, dyn_args=None,
+ dyn_kwargs=None, lineno=None):
+ """Call a method of the extension. This is a shortcut for
+ :meth:`attr` + :class:`jinja2.nodes.Call`.
+ """
+ if args is None:
+ args = []
+ if kwargs is None:
+ kwargs = []
+ return nodes.Call(self.attr(name, lineno=lineno), args, kwargs,
+ dyn_args, dyn_kwargs, lineno=lineno)
+
+
+@contextfunction
+def _gettext_alias(__context, *args, **kwargs):
+ return __context.call(__context.resolve('gettext'), *args, **kwargs)
+
+
+def _make_new_gettext(func):
+ @contextfunction
+ def gettext(__context, __string, **variables):
+ rv = __context.call(func, __string)
+ if __context.eval_ctx.autoescape:
+ rv = Markup(rv)
+ return rv % variables
+ return gettext
+
+
+def _make_new_ngettext(func):
+ @contextfunction
+ def ngettext(__context, __singular, __plural, __num, **variables):
+ variables.setdefault('num', __num)
+ rv = __context.call(func, __singular, __plural, __num)
+ if __context.eval_ctx.autoescape:
+ rv = Markup(rv)
+ return rv % variables
+ return ngettext
+
+
+class InternationalizationExtension(Extension):
+ """This extension adds gettext support to Jinja2."""
+ tags = set(['trans'])
+
+ # TODO: the i18n extension is currently reevaluating values in a few
+ # situations. Take this example:
+ # {% trans count=something() %}{{ count }} foo{% pluralize
+ # %}{{ count }} fooss{% endtrans %}
+ # something is called twice here. One time for the gettext value and
+ # the other time for the n-parameter of the ngettext function.
+
+ def __init__(self, environment):
+ Extension.__init__(self, environment)
+ environment.globals['_'] = _gettext_alias
+ environment.extend(
+ install_gettext_translations=self._install,
+ install_null_translations=self._install_null,
+ install_gettext_callables=self._install_callables,
+ uninstall_gettext_translations=self._uninstall,
+ extract_translations=self._extract,
+ newstyle_gettext=False
+ )
+
+ def _install(self, translations, newstyle=None):
+ gettext = getattr(translations, 'ugettext', None)
+ if gettext is None:
+ gettext = translations.gettext
+ ngettext = getattr(translations, 'ungettext', None)
+ if ngettext is None:
+ ngettext = translations.ngettext
+ self._install_callables(gettext, ngettext, newstyle)
+
+ def _install_null(self, newstyle=None):
+ self._install_callables(
+ lambda x: x,
+ lambda s, p, n: (n != 1 and (p,) or (s,))[0],
+ newstyle
+ )
+
+ def _install_callables(self, gettext, ngettext, newstyle=None):
+ if newstyle is not None:
+ self.environment.newstyle_gettext = newstyle
+ if self.environment.newstyle_gettext:
+ gettext = _make_new_gettext(gettext)
+ ngettext = _make_new_ngettext(ngettext)
+ self.environment.globals.update(
+ gettext=gettext,
+ ngettext=ngettext
+ )
+
+ def _uninstall(self, translations):
+ for key in 'gettext', 'ngettext':
+ self.environment.globals.pop(key, None)
+
+ def _extract(self, source, gettext_functions=GETTEXT_FUNCTIONS):
+ if isinstance(source, string_types):
+ source = self.environment.parse(source)
+ return extract_from_ast(source, gettext_functions)
+
+ def parse(self, parser):
+ """Parse a translatable tag."""
+ lineno = next(parser.stream).lineno
+ num_called_num = False
+
+ # find all the variables referenced. Additionally a variable can be
+ # defined in the body of the trans block too, but this is checked at
+ # a later state.
+ plural_expr = None
+ plural_expr_assignment = None
+ variables = {}
+ while parser.stream.current.type != 'block_end':
+ if variables:
+ parser.stream.expect('comma')
+
+ # skip colon for python compatibility
+ if parser.stream.skip_if('colon'):
+ break
+
+ name = parser.stream.expect('name')
+ if name.value in variables:
+ parser.fail('translatable variable %r defined twice.' %
+ name.value, name.lineno,
+ exc=TemplateAssertionError)
+
+ # expressions
+ if parser.stream.current.type == 'assign':
+ next(parser.stream)
+ variables[name.value] = var = parser.parse_expression()
+ else:
+ variables[name.value] = var = nodes.Name(name.value, 'load')
+
+ if plural_expr is None:
+ if isinstance(var, nodes.Call):
+ plural_expr = nodes.Name('_trans', 'load')
+ variables[name.value] = plural_expr
+ plural_expr_assignment = nodes.Assign(
+ nodes.Name('_trans', 'store'), var)
+ else:
+ plural_expr = var
+ num_called_num = name.value == 'num'
+
+ parser.stream.expect('block_end')
+
+ plural = plural_names = None
+ have_plural = False
+ referenced = set()
+
+ # now parse until endtrans or pluralize
+ singular_names, singular = self._parse_block(parser, True)
+ if singular_names:
+ referenced.update(singular_names)
+ if plural_expr is None:
+ plural_expr = nodes.Name(singular_names[0], 'load')
+ num_called_num = singular_names[0] == 'num'
+
+ # if we have a pluralize block, we parse that too
+ if parser.stream.current.test('name:pluralize'):
+ have_plural = True
+ next(parser.stream)
+ if parser.stream.current.type != 'block_end':
+ name = parser.stream.expect('name')
+ if name.value not in variables:
+ parser.fail('unknown variable %r for pluralization' %
+ name.value, name.lineno,
+ exc=TemplateAssertionError)
+ plural_expr = variables[name.value]
+ num_called_num = name.value == 'num'
+ parser.stream.expect('block_end')
+ plural_names, plural = self._parse_block(parser, False)
+ next(parser.stream)
+ referenced.update(plural_names)
+ else:
+ next(parser.stream)
+
+ # register free names as simple name expressions
+ for var in referenced:
+ if var not in variables:
+ variables[var] = nodes.Name(var, 'load')
+
+ if not have_plural:
+ plural_expr = None
+ elif plural_expr is None:
+ parser.fail('pluralize without variables', lineno)
+
+ node = self._make_node(singular, plural, variables, plural_expr,
+ bool(referenced),
+ num_called_num and have_plural)
+ node.set_lineno(lineno)
+ if plural_expr_assignment is not None:
+ return [plural_expr_assignment, node]
+ else:
+ return node
+
+ def _parse_block(self, parser, allow_pluralize):
+ """Parse until the next block tag with a given name."""
+ referenced = []
+ buf = []
+ while 1:
+ if parser.stream.current.type == 'data':
+ buf.append(parser.stream.current.value.replace('%', '%%'))
+ next(parser.stream)
+ elif parser.stream.current.type == 'variable_begin':
+ next(parser.stream)
+ name = parser.stream.expect('name').value
+ referenced.append(name)
+ buf.append('%%(%s)s' % name)
+ parser.stream.expect('variable_end')
+ elif parser.stream.current.type == 'block_begin':
+ next(parser.stream)
+ if parser.stream.current.test('name:endtrans'):
+ break
+ elif parser.stream.current.test('name:pluralize'):
+ if allow_pluralize:
+ break
+ parser.fail('a translatable section can have only one '
+ 'pluralize section')
+ parser.fail('control structures in translatable sections are '
+ 'not allowed')
+ elif parser.stream.eos:
+ parser.fail('unclosed translation block')
+ else:
+ assert False, 'internal parser error'
+
+ return referenced, concat(buf)
+
+ def _make_node(self, singular, plural, variables, plural_expr,
+ vars_referenced, num_called_num):
+ """Generates a useful node from the data provided."""
+ # no variables referenced? no need to escape for old style
+ # gettext invocations only if there are vars.
+ if not vars_referenced and not self.environment.newstyle_gettext:
+ singular = singular.replace('%%', '%')
+ if plural:
+ plural = plural.replace('%%', '%')
+
+ # singular only:
+ if plural_expr is None:
+ gettext = nodes.Name('gettext', 'load')
+ node = nodes.Call(gettext, [nodes.Const(singular)],
+ [], None, None)
+
+ # singular and plural
+ else:
+ ngettext = nodes.Name('ngettext', 'load')
+ node = nodes.Call(ngettext, [
+ nodes.Const(singular),
+ nodes.Const(plural),
+ plural_expr
+ ], [], None, None)
+
+ # in case newstyle gettext is used, the method is powerful
+ # enough to handle the variable expansion and autoescape
+ # handling itself
+ if self.environment.newstyle_gettext:
+ for key, value in iteritems(variables):
+ # the function adds that later anyways in case num was
+ # called num, so just skip it.
+ if num_called_num and key == 'num':
+ continue
+ node.kwargs.append(nodes.Keyword(key, value))
+
+ # otherwise do that here
+ else:
+ # mark the return value as safe if we are in an
+ # environment with autoescaping turned on
+ node = nodes.MarkSafeIfAutoescape(node)
+ if variables:
+ node = nodes.Mod(node, nodes.Dict([
+ nodes.Pair(nodes.Const(key), value)
+ for key, value in variables.items()
+ ]))
+ return nodes.Output([node])
+
+
+class ExprStmtExtension(Extension):
+ """Adds a `do` tag to Jinja2 that works like the print statement just
+ that it doesn't print the return value.
+ """
+ tags = set(['do'])
+
+ def parse(self, parser):
+ node = nodes.ExprStmt(lineno=next(parser.stream).lineno)
+ node.node = parser.parse_tuple()
+ return node
+
+
+class LoopControlExtension(Extension):
+ """Adds break and continue to the template engine."""
+ tags = set(['break', 'continue'])
+
+ def parse(self, parser):
+ token = next(parser.stream)
+ if token.value == 'break':
+ return nodes.Break(lineno=token.lineno)
+ return nodes.Continue(lineno=token.lineno)
+
+
+class WithExtension(Extension):
+ """Adds support for a django-like with block."""
+ tags = set(['with'])
+
+ def parse(self, parser):
+ node = nodes.Scope(lineno=next(parser.stream).lineno)
+ assignments = []
+ while parser.stream.current.type != 'block_end':
+ lineno = parser.stream.current.lineno
+ if assignments:
+ parser.stream.expect('comma')
+ target = parser.parse_assign_target()
+ parser.stream.expect('assign')
+ expr = parser.parse_expression()
+ assignments.append(nodes.Assign(target, expr, lineno=lineno))
+ node.body = assignments + \
+ list(parser.parse_statements(('name:endwith',),
+ drop_needle=True))
+ return node
+
+
+class AutoEscapeExtension(Extension):
+ """Changes auto escape rules for a scope."""
+ tags = set(['autoescape'])
+
+ def parse(self, parser):
+ node = nodes.ScopedEvalContextModifier(lineno=next(parser.stream).lineno)
+ node.options = [
+ nodes.Keyword('autoescape', parser.parse_expression())
+ ]
+ node.body = parser.parse_statements(('name:endautoescape',),
+ drop_needle=True)
+ return nodes.Scope([node])
+
+
+def extract_from_ast(node, gettext_functions=GETTEXT_FUNCTIONS,
+ babel_style=True):
+ """Extract localizable strings from the given template node. Per
+ default this function returns matches in babel style that means non string
+ parameters as well as keyword arguments are returned as `None`. This
+ allows Babel to figure out what you really meant if you are using
+ gettext functions that allow keyword arguments for placeholder expansion.
+ If you don't want that behavior set the `babel_style` parameter to `False`
+ which causes only strings to be returned and parameters are always stored
+ in tuples. As a consequence invalid gettext calls (calls without a single
+ string parameter or string parameters after non-string parameters) are
+ skipped.
+
+ This example explains the behavior:
+
+ >>> from jinja2 import Environment
+ >>> env = Environment()
+ >>> node = env.parse('{{ (_("foo"), _(), ngettext("foo", "bar", 42)) }}')
+ >>> list(extract_from_ast(node))
+ [(1, '_', 'foo'), (1, '_', ()), (1, 'ngettext', ('foo', 'bar', None))]
+ >>> list(extract_from_ast(node, babel_style=False))
+ [(1, '_', ('foo',)), (1, 'ngettext', ('foo', 'bar'))]
+
+ For every string found this function yields a ``(lineno, function,
+ message)`` tuple, where:
+
+ * ``lineno`` is the number of the line on which the string was found,
+ * ``function`` is the name of the ``gettext`` function used (if the
+ string was extracted from embedded Python code), and
+ * ``message`` is the string itself (a ``unicode`` object, or a tuple
+ of ``unicode`` objects for functions with multiple string arguments).
+
+ This extraction function operates on the AST and is because of that unable
+ to extract any comments. For comment support you have to use the babel
+ extraction interface or extract comments yourself.
+ """
+ for node in node.find_all(nodes.Call):
+ if not isinstance(node.node, nodes.Name) or \
+ node.node.name not in gettext_functions:
+ continue
+
+ strings = []
+ for arg in node.args:
+ if isinstance(arg, nodes.Const) and \
+ isinstance(arg.value, string_types):
+ strings.append(arg.value)
+ else:
+ strings.append(None)
+
+ for arg in node.kwargs:
+ strings.append(None)
+ if node.dyn_args is not None:
+ strings.append(None)
+ if node.dyn_kwargs is not None:
+ strings.append(None)
+
+ if not babel_style:
+ strings = tuple(x for x in strings if x is not None)
+ if not strings:
+ continue
+ else:
+ if len(strings) == 1:
+ strings = strings[0]
+ else:
+ strings = tuple(strings)
+ yield node.lineno, node.node.name, strings
+
+
+class _CommentFinder(object):
+ """Helper class to find comments in a token stream. Can only
+ find comments for gettext calls forwards. Once the comment
+ from line 4 is found, a comment for line 1 will not return a
+ usable value.
+ """
+
+ def __init__(self, tokens, comment_tags):
+ self.tokens = tokens
+ self.comment_tags = comment_tags
+ self.offset = 0
+ self.last_lineno = 0
+
+ def find_backwards(self, offset):
+ try:
+ for _, token_type, token_value in \
+ reversed(self.tokens[self.offset:offset]):
+ if token_type in ('comment', 'linecomment'):
+ try:
+ prefix, comment = token_value.split(None, 1)
+ except ValueError:
+ continue
+ if prefix in self.comment_tags:
+ return [comment.rstrip()]
+ return []
+ finally:
+ self.offset = offset
+
+ def find_comments(self, lineno):
+ if not self.comment_tags or self.last_lineno > lineno:
+ return []
+ for idx, (token_lineno, _, _) in enumerate(self.tokens[self.offset:]):
+ if token_lineno > lineno:
+ return self.find_backwards(self.offset + idx)
+ return self.find_backwards(len(self.tokens))
+
+
+def babel_extract(fileobj, keywords, comment_tags, options):
+ """Babel extraction method for Jinja templates.
+
+ .. versionchanged:: 2.3
+ Basic support for translation comments was added. If `comment_tags`
+ is now set to a list of keywords for extraction, the extractor will
+ try to find the best preceeding comment that begins with one of the
+ keywords. For best results, make sure to not have more than one
+ gettext call in one line of code and the matching comment in the
+ same line or the line before.
+
+ .. versionchanged:: 2.5.1
+ The `newstyle_gettext` flag can be set to `True` to enable newstyle
+ gettext calls.
+
+ .. versionchanged:: 2.7
+ A `silent` option can now be provided. If set to `False` template
+ syntax errors are propagated instead of being ignored.
+
+ :param fileobj: the file-like object the messages should be extracted from
+ :param keywords: a list of keywords (i.e. function names) that should be
+ recognized as translation functions
+ :param comment_tags: a list of translator tags to search for and include
+ in the results.
+ :param options: a dictionary of additional options (optional)
+ :return: an iterator over ``(lineno, funcname, message, comments)`` tuples.
+ (comments will be empty currently)
+ """
+ extensions = set()
+ for extension in options.get('extensions', '').split(','):
+ extension = extension.strip()
+ if not extension:
+ continue
+ extensions.add(import_string(extension))
+ if InternationalizationExtension not in extensions:
+ extensions.add(InternationalizationExtension)
+
+ def getbool(options, key, default=False):
+ return options.get(key, str(default)).lower() in \
+ ('1', 'on', 'yes', 'true')
+
+ silent = getbool(options, 'silent', True)
+ environment = Environment(
+ options.get('block_start_string', BLOCK_START_STRING),
+ options.get('block_end_string', BLOCK_END_STRING),
+ options.get('variable_start_string', VARIABLE_START_STRING),
+ options.get('variable_end_string', VARIABLE_END_STRING),
+ options.get('comment_start_string', COMMENT_START_STRING),
+ options.get('comment_end_string', COMMENT_END_STRING),
+ options.get('line_statement_prefix') or LINE_STATEMENT_PREFIX,
+ options.get('line_comment_prefix') or LINE_COMMENT_PREFIX,
+ getbool(options, 'trim_blocks', TRIM_BLOCKS),
+ getbool(options, 'lstrip_blocks', LSTRIP_BLOCKS),
+ NEWLINE_SEQUENCE,
+ getbool(options, 'keep_trailing_newline', KEEP_TRAILING_NEWLINE),
+ frozenset(extensions),
+ cache_size=0,
+ auto_reload=False
+ )
+
+ if getbool(options, 'newstyle_gettext'):
+ environment.newstyle_gettext = True
+
+ source = fileobj.read().decode(options.get('encoding', 'utf-8'))
+ try:
+ node = environment.parse(source)
+ tokens = list(environment.lex(environment.preprocess(source)))
+ except TemplateSyntaxError as e:
+ if not silent:
+ raise
+ # skip templates with syntax errors
+ return
+
+ finder = _CommentFinder(tokens, comment_tags)
+ for lineno, func, message in extract_from_ast(node, keywords):
+ yield lineno, func, message, finder.find_comments(lineno)
+
+
+#: nicer import names
+i18n = InternationalizationExtension
+do = ExprStmtExtension
+loopcontrols = LoopControlExtension
+with_ = WithExtension
+autoescape = AutoEscapeExtension
diff --git a/venv/lib/python2.7/site-packages/Jinja2-2.8-py2.7.egg/jinja2/filters.py b/venv/lib/python2.7/site-packages/Jinja2-2.8-py2.7.egg/jinja2/filters.py
new file mode 100644
index 000000000..e5c7a1ab4
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/Jinja2-2.8-py2.7.egg/jinja2/filters.py
@@ -0,0 +1,996 @@
+# -*- coding: utf-8 -*-
+"""
+ jinja2.filters
+ ~~~~~~~~~~~~~~
+
+ Bundled jinja filters.
+
+ :copyright: (c) 2010 by the Jinja Team.
+ :license: BSD, see LICENSE for more details.
+"""
+import re
+import math
+
+from random import choice
+from operator import itemgetter
+from itertools import groupby
+from jinja2.utils import Markup, escape, pformat, urlize, soft_unicode, \
+ unicode_urlencode
+from jinja2.runtime import Undefined
+from jinja2.exceptions import FilterArgumentError
+from jinja2._compat import imap, string_types, text_type, iteritems
+
+
+_word_re = re.compile(r'\w+(?u)')
+
+
+def contextfilter(f):
+ """Decorator for marking context dependent filters. The current
+ :class:`Context` will be passed as first argument.
+ """
+ f.contextfilter = True
+ return f
+
+
+def evalcontextfilter(f):
+ """Decorator for marking eval-context dependent filters. An eval
+ context object is passed as first argument. For more information
+ about the eval context, see :ref:`eval-context`.
+
+ .. versionadded:: 2.4
+ """
+ f.evalcontextfilter = True
+ return f
+
+
+def environmentfilter(f):
+ """Decorator for marking evironment dependent filters. The current
+ :class:`Environment` is passed to the filter as first argument.
+ """
+ f.environmentfilter = True
+ return f
+
+
+def make_attrgetter(environment, attribute):
+ """Returns a callable that looks up the given attribute from a
+ passed object with the rules of the environment. Dots are allowed
+ to access attributes of attributes. Integer parts in paths are
+ looked up as integers.
+ """
+ if not isinstance(attribute, string_types) \
+ or ('.' not in attribute and not attribute.isdigit()):
+ return lambda x: environment.getitem(x, attribute)
+ attribute = attribute.split('.')
+ def attrgetter(item):
+ for part in attribute:
+ if part.isdigit():
+ part = int(part)
+ item = environment.getitem(item, part)
+ return item
+ return attrgetter
+
+
+def do_forceescape(value):
+ """Enforce HTML escaping. This will probably double escape variables."""
+ if hasattr(value, '__html__'):
+ value = value.__html__()
+ return escape(text_type(value))
+
+
+def do_urlencode(value):
+ """Escape strings for use in URLs (uses UTF-8 encoding). It accepts both
+ dictionaries and regular strings as well as pairwise iterables.
+
+ .. versionadded:: 2.7
+ """
+ itemiter = None
+ if isinstance(value, dict):
+ itemiter = iteritems(value)
+ elif not isinstance(value, string_types):
+ try:
+ itemiter = iter(value)
+ except TypeError:
+ pass
+ if itemiter is None:
+ return unicode_urlencode(value)
+ return u'&'.join(unicode_urlencode(k) + '=' +
+ unicode_urlencode(v, for_qs=True)
+ for k, v in itemiter)
+
+
+@evalcontextfilter
+def do_replace(eval_ctx, s, old, new, count=None):
+ """Return a copy of the value with all occurrences of a substring
+ replaced with a new one. The first argument is the substring
+ that should be replaced, the second is the replacement string.
+ If the optional third argument ``count`` is given, only the first
+ ``count`` occurrences are replaced:
+
+ .. sourcecode:: jinja
+
+ {{ "Hello World"|replace("Hello", "Goodbye") }}
+ -> Goodbye World
+
+ {{ "aaaaargh"|replace("a", "d'oh, ", 2) }}
+ -> d'oh, d'oh, aaargh
+ """
+ if count is None:
+ count = -1
+ if not eval_ctx.autoescape:
+ return text_type(s).replace(text_type(old), text_type(new), count)
+ if hasattr(old, '__html__') or hasattr(new, '__html__') and \
+ not hasattr(s, '__html__'):
+ s = escape(s)
+ else:
+ s = soft_unicode(s)
+ return s.replace(soft_unicode(old), soft_unicode(new), count)
+
+
+def do_upper(s):
+ """Convert a value to uppercase."""
+ return soft_unicode(s).upper()
+
+
+def do_lower(s):
+ """Convert a value to lowercase."""
+ return soft_unicode(s).lower()
+
+
+@evalcontextfilter
+def do_xmlattr(_eval_ctx, d, autospace=True):
+ """Create an SGML/XML attribute string based on the items in a dict.
+ All values that are neither `none` nor `undefined` are automatically
+ escaped:
+
+ .. sourcecode:: html+jinja
+
+
+ ...
+
+
+ Results in something like this:
+
+ .. sourcecode:: html
+
+
+ """
+ tmp = []
+ for item in value:
+ if len(tmp) == linecount:
+ yield tmp
+ tmp = []
+ tmp.append(item)
+ if tmp:
+ if fill_with is not None and len(tmp) < linecount:
+ tmp += [fill_with] * (linecount - len(tmp))
+ yield tmp
+
+
+def do_round(value, precision=0, method='common'):
+ """Round the number to a given precision. The first
+ parameter specifies the precision (default is ``0``), the
+ second the rounding method:
+
+ - ``'common'`` rounds either up or down
+ - ``'ceil'`` always rounds up
+ - ``'floor'`` always rounds down
+
+ If you don't specify a method ``'common'`` is used.
+
+ .. sourcecode:: jinja
+
+ {{ 42.55|round }}
+ -> 43.0
+ {{ 42.55|round(1, 'floor') }}
+ -> 42.5
+
+ Note that even if rounded to 0 precision, a float is returned. If
+ you need a real integer, pipe it through `int`:
+
+ .. sourcecode:: jinja
+
+ {{ 42.55|round|int }}
+ -> 43
+ """
+ if not method in ('common', 'ceil', 'floor'):
+ raise FilterArgumentError('method must be common, ceil or floor')
+ if method == 'common':
+ return round(value, precision)
+ func = getattr(math, method)
+ return func(value * (10 ** precision)) / (10 ** precision)
+
+
+@environmentfilter
+def do_groupby(environment, value, attribute):
+ """Group a sequence of objects by a common attribute.
+
+ If you for example have a list of dicts or objects that represent persons
+ with `gender`, `first_name` and `last_name` attributes and you want to
+ group all users by genders you can do something like the following
+ snippet:
+
+ .. sourcecode:: html+jinja
+
+
+ {% for group in persons|groupby('gender') %}
+
{{ group.grouper }}
+ {% for person in group.list %}
+
{{ person.first_name }} {{ person.last_name }}
+ {% endfor %}
+ {% endfor %}
+
+
+ Additionally it's possible to use tuple unpacking for the grouper and
+ list:
+
+ .. sourcecode:: html+jinja
+
+
+ {% for grouper, list in persons|groupby('gender') %}
+ ...
+ {% endfor %}
+
+
+ As you can see the item we're grouping by is stored in the `grouper`
+ attribute and the `list` contains all the objects that have this grouper
+ in common.
+
+ .. versionchanged:: 2.6
+ It's now possible to use dotted notation to group by the child
+ attribute of another attribute.
+ """
+ expr = make_attrgetter(environment, attribute)
+ return sorted(map(_GroupTuple, groupby(sorted(value, key=expr), expr)))
+
+
+class _GroupTuple(tuple):
+ __slots__ = ()
+ grouper = property(itemgetter(0))
+ list = property(itemgetter(1))
+
+ def __new__(cls, xxx_todo_changeme):
+ (key, value) = xxx_todo_changeme
+ return tuple.__new__(cls, (key, list(value)))
+
+
+@environmentfilter
+def do_sum(environment, iterable, attribute=None, start=0):
+ """Returns the sum of a sequence of numbers plus the value of parameter
+ 'start' (which defaults to 0). When the sequence is empty it returns
+ start.
+
+ It is also possible to sum up only certain attributes:
+
+ .. sourcecode:: jinja
+
+ Total: {{ items|sum(attribute='price') }}
+
+ .. versionchanged:: 2.6
+ The `attribute` parameter was added to allow suming up over
+ attributes. Also the `start` parameter was moved on to the right.
+ """
+ if attribute is not None:
+ iterable = imap(make_attrgetter(environment, attribute), iterable)
+ return sum(iterable, start)
+
+
+def do_list(value):
+ """Convert the value into a list. If it was a string the returned list
+ will be a list of characters.
+ """
+ return list(value)
+
+
+def do_mark_safe(value):
+ """Mark the value as safe which means that in an environment with automatic
+ escaping enabled this variable will not be escaped.
+ """
+ return Markup(value)
+
+
+def do_mark_unsafe(value):
+ """Mark a value as unsafe. This is the reverse operation for :func:`safe`."""
+ return text_type(value)
+
+
+def do_reverse(value):
+ """Reverse the object or return an iterator that iterates over it the other
+ way round.
+ """
+ if isinstance(value, string_types):
+ return value[::-1]
+ try:
+ return reversed(value)
+ except TypeError:
+ try:
+ rv = list(value)
+ rv.reverse()
+ return rv
+ except TypeError:
+ raise FilterArgumentError('argument must be iterable')
+
+
+@environmentfilter
+def do_attr(environment, obj, name):
+ """Get an attribute of an object. ``foo|attr("bar")`` works like
+ ``foo.bar`` just that always an attribute is returned and items are not
+ looked up.
+
+ See :ref:`Notes on subscriptions ` for more details.
+ """
+ try:
+ name = str(name)
+ except UnicodeError:
+ pass
+ else:
+ try:
+ value = getattr(obj, name)
+ except AttributeError:
+ pass
+ else:
+ if environment.sandboxed and not \
+ environment.is_safe_attribute(obj, name, value):
+ return environment.unsafe_undefined(obj, name)
+ return value
+ return environment.undefined(obj=obj, name=name)
+
+
+@contextfilter
+def do_map(*args, **kwargs):
+ """Applies a filter on a sequence of objects or looks up an attribute.
+ This is useful when dealing with lists of objects but you are really
+ only interested in a certain value of it.
+
+ The basic usage is mapping on an attribute. Imagine you have a list
+ of users but you are only interested in a list of usernames:
+
+ .. sourcecode:: jinja
+
+ Users on this page: {{ users|map(attribute='username')|join(', ') }}
+
+ Alternatively you can let it invoke a filter by passing the name of the
+ filter and the arguments afterwards. A good example would be applying a
+ text conversion filter on a sequence:
+
+ .. sourcecode:: jinja
+
+ Users on this page: {{ titles|map('lower')|join(', ') }}
+
+ .. versionadded:: 2.7
+ """
+ context = args[0]
+ seq = args[1]
+
+ if len(args) == 2 and 'attribute' in kwargs:
+ attribute = kwargs.pop('attribute')
+ if kwargs:
+ raise FilterArgumentError('Unexpected keyword argument %r' %
+ next(iter(kwargs)))
+ func = make_attrgetter(context.environment, attribute)
+ else:
+ try:
+ name = args[2]
+ args = args[3:]
+ except LookupError:
+ raise FilterArgumentError('map requires a filter argument')
+ func = lambda item: context.environment.call_filter(
+ name, item, args, kwargs, context=context)
+
+ if seq:
+ for item in seq:
+ yield func(item)
+
+
+@contextfilter
+def do_select(*args, **kwargs):
+ """Filters a sequence of objects by applying a test to the object and only
+ selecting the ones with the test succeeding.
+
+ Example usage:
+
+ .. sourcecode:: jinja
+
+ {{ numbers|select("odd") }}
+ {{ numbers|select("odd") }}
+
+ .. versionadded:: 2.7
+ """
+ return _select_or_reject(args, kwargs, lambda x: x, False)
+
+
+@contextfilter
+def do_reject(*args, **kwargs):
+ """Filters a sequence of objects by applying a test to the object and
+ rejecting the ones with the test succeeding.
+
+ Example usage:
+
+ .. sourcecode:: jinja
+
+ {{ numbers|reject("odd") }}
+
+ .. versionadded:: 2.7
+ """
+ return _select_or_reject(args, kwargs, lambda x: not x, False)
+
+
+@contextfilter
+def do_selectattr(*args, **kwargs):
+ """Filters a sequence of objects by applying a test to an attribute of an
+ object and only selecting the ones with the test succeeding.
+
+ Example usage:
+
+ .. sourcecode:: jinja
+
+ {{ users|selectattr("is_active") }}
+ {{ users|selectattr("email", "none") }}
+
+ .. versionadded:: 2.7
+ """
+ return _select_or_reject(args, kwargs, lambda x: x, True)
+
+
+@contextfilter
+def do_rejectattr(*args, **kwargs):
+ """Filters a sequence of objects by applying a test to an attribute of an
+ object or the attribute and rejecting the ones with the test succeeding.
+
+ .. sourcecode:: jinja
+
+ {{ users|rejectattr("is_active") }}
+ {{ users|rejectattr("email", "none") }}
+
+ .. versionadded:: 2.7
+ """
+ return _select_or_reject(args, kwargs, lambda x: not x, True)
+
+
+def _select_or_reject(args, kwargs, modfunc, lookup_attr):
+ context = args[0]
+ seq = args[1]
+ if lookup_attr:
+ try:
+ attr = args[2]
+ except LookupError:
+ raise FilterArgumentError('Missing parameter for attribute name')
+ transfunc = make_attrgetter(context.environment, attr)
+ off = 1
+ else:
+ off = 0
+ transfunc = lambda x: x
+
+ try:
+ name = args[2 + off]
+ args = args[3 + off:]
+ func = lambda item: context.environment.call_test(
+ name, item, args, kwargs)
+ except LookupError:
+ func = bool
+
+ if seq:
+ for item in seq:
+ if modfunc(func(transfunc(item))):
+ yield item
+
+
+FILTERS = {
+ 'abs': abs,
+ 'attr': do_attr,
+ 'batch': do_batch,
+ 'capitalize': do_capitalize,
+ 'center': do_center,
+ 'count': len,
+ 'd': do_default,
+ 'default': do_default,
+ 'dictsort': do_dictsort,
+ 'e': escape,
+ 'escape': escape,
+ 'filesizeformat': do_filesizeformat,
+ 'first': do_first,
+ 'float': do_float,
+ 'forceescape': do_forceescape,
+ 'format': do_format,
+ 'groupby': do_groupby,
+ 'indent': do_indent,
+ 'int': do_int,
+ 'join': do_join,
+ 'last': do_last,
+ 'length': len,
+ 'list': do_list,
+ 'lower': do_lower,
+ 'map': do_map,
+ 'pprint': do_pprint,
+ 'random': do_random,
+ 'reject': do_reject,
+ 'rejectattr': do_rejectattr,
+ 'replace': do_replace,
+ 'reverse': do_reverse,
+ 'round': do_round,
+ 'safe': do_mark_safe,
+ 'select': do_select,
+ 'selectattr': do_selectattr,
+ 'slice': do_slice,
+ 'sort': do_sort,
+ 'string': soft_unicode,
+ 'striptags': do_striptags,
+ 'sum': do_sum,
+ 'title': do_title,
+ 'trim': do_trim,
+ 'truncate': do_truncate,
+ 'upper': do_upper,
+ 'urlencode': do_urlencode,
+ 'urlize': do_urlize,
+ 'wordcount': do_wordcount,
+ 'wordwrap': do_wordwrap,
+ 'xmlattr': do_xmlattr,
+}
diff --git a/venv/lib/python2.7/site-packages/Jinja2-2.8-py2.7.egg/jinja2/lexer.py b/venv/lib/python2.7/site-packages/Jinja2-2.8-py2.7.egg/jinja2/lexer.py
new file mode 100644
index 000000000..c8dac214e
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/Jinja2-2.8-py2.7.egg/jinja2/lexer.py
@@ -0,0 +1,734 @@
+# -*- coding: utf-8 -*-
+"""
+ jinja2.lexer
+ ~~~~~~~~~~~~
+
+ This module implements a Jinja / Python combination lexer. The
+ `Lexer` class provided by this module is used to do some preprocessing
+ for Jinja.
+
+ On the one hand it filters out invalid operators like the bitshift
+ operators we don't allow in templates. On the other hand it separates
+ template code and python code in expressions.
+
+ :copyright: (c) 2010 by the Jinja Team.
+ :license: BSD, see LICENSE for more details.
+"""
+import re
+
+from operator import itemgetter
+from collections import deque
+from jinja2.exceptions import TemplateSyntaxError
+from jinja2.utils import LRUCache
+from jinja2._compat import iteritems, implements_iterator, text_type, \
+ intern, PY2
+
+
+# cache for the lexers. Exists in order to be able to have multiple
+# environments with the same lexer
+_lexer_cache = LRUCache(50)
+
+# static regular expressions
+whitespace_re = re.compile(r'\s+', re.U)
+string_re = re.compile(r"('([^'\\]*(?:\\.[^'\\]*)*)'"
+ r'|"([^"\\]*(?:\\.[^"\\]*)*)")', re.S)
+integer_re = re.compile(r'\d+')
+
+# we use the unicode identifier rule if this python version is able
+# to handle unicode identifiers, otherwise the standard ASCII one.
+try:
+ compile('föö', '', 'eval')
+except SyntaxError:
+ name_re = re.compile(r'\b[a-zA-Z_][a-zA-Z0-9_]*\b')
+else:
+ from jinja2 import _stringdefs
+ name_re = re.compile(r'[%s][%s]*' % (_stringdefs.xid_start,
+ _stringdefs.xid_continue))
+
+float_re = re.compile(r'(?': TOKEN_GT,
+ '>=': TOKEN_GTEQ,
+ '<': TOKEN_LT,
+ '<=': TOKEN_LTEQ,
+ '=': TOKEN_ASSIGN,
+ '.': TOKEN_DOT,
+ ':': TOKEN_COLON,
+ '|': TOKEN_PIPE,
+ ',': TOKEN_COMMA,
+ ';': TOKEN_SEMICOLON
+}
+
+reverse_operators = dict([(v, k) for k, v in iteritems(operators)])
+assert len(operators) == len(reverse_operators), 'operators dropped'
+operator_re = re.compile('(%s)' % '|'.join(re.escape(x) for x in
+ sorted(operators, key=lambda x: -len(x))))
+
+ignored_tokens = frozenset([TOKEN_COMMENT_BEGIN, TOKEN_COMMENT,
+ TOKEN_COMMENT_END, TOKEN_WHITESPACE,
+ TOKEN_LINECOMMENT_BEGIN, TOKEN_LINECOMMENT_END,
+ TOKEN_LINECOMMENT])
+ignore_if_empty = frozenset([TOKEN_WHITESPACE, TOKEN_DATA,
+ TOKEN_COMMENT, TOKEN_LINECOMMENT])
+
+
+def _describe_token_type(token_type):
+ if token_type in reverse_operators:
+ return reverse_operators[token_type]
+ return {
+ TOKEN_COMMENT_BEGIN: 'begin of comment',
+ TOKEN_COMMENT_END: 'end of comment',
+ TOKEN_COMMENT: 'comment',
+ TOKEN_LINECOMMENT: 'comment',
+ TOKEN_BLOCK_BEGIN: 'begin of statement block',
+ TOKEN_BLOCK_END: 'end of statement block',
+ TOKEN_VARIABLE_BEGIN: 'begin of print statement',
+ TOKEN_VARIABLE_END: 'end of print statement',
+ TOKEN_LINESTATEMENT_BEGIN: 'begin of line statement',
+ TOKEN_LINESTATEMENT_END: 'end of line statement',
+ TOKEN_DATA: 'template data / text',
+ TOKEN_EOF: 'end of template'
+ }.get(token_type, token_type)
+
+
+def describe_token(token):
+ """Returns a description of the token."""
+ if token.type == 'name':
+ return token.value
+ return _describe_token_type(token.type)
+
+
+def describe_token_expr(expr):
+ """Like `describe_token` but for token expressions."""
+ if ':' in expr:
+ type, value = expr.split(':', 1)
+ if type == 'name':
+ return value
+ else:
+ type = expr
+ return _describe_token_type(type)
+
+
+def count_newlines(value):
+ """Count the number of newline characters in the string. This is
+ useful for extensions that filter a stream.
+ """
+ return len(newline_re.findall(value))
+
+
+def compile_rules(environment):
+ """Compiles all the rules from the environment into a list of rules."""
+ e = re.escape
+ rules = [
+ (len(environment.comment_start_string), 'comment',
+ e(environment.comment_start_string)),
+ (len(environment.block_start_string), 'block',
+ e(environment.block_start_string)),
+ (len(environment.variable_start_string), 'variable',
+ e(environment.variable_start_string))
+ ]
+
+ if environment.line_statement_prefix is not None:
+ rules.append((len(environment.line_statement_prefix), 'linestatement',
+ r'^[ \t\v]*' + e(environment.line_statement_prefix)))
+ if environment.line_comment_prefix is not None:
+ rules.append((len(environment.line_comment_prefix), 'linecomment',
+ r'(?:^|(?<=\S))[^\S\r\n]*' +
+ e(environment.line_comment_prefix)))
+
+ return [x[1:] for x in sorted(rules, reverse=True)]
+
+
+class Failure(object):
+ """Class that raises a `TemplateSyntaxError` if called.
+ Used by the `Lexer` to specify known errors.
+ """
+
+ def __init__(self, message, cls=TemplateSyntaxError):
+ self.message = message
+ self.error_class = cls
+
+ def __call__(self, lineno, filename):
+ raise self.error_class(self.message, lineno, filename)
+
+
+class Token(tuple):
+ """Token class."""
+ __slots__ = ()
+ lineno, type, value = (property(itemgetter(x)) for x in range(3))
+
+ def __new__(cls, lineno, type, value):
+ return tuple.__new__(cls, (lineno, intern(str(type)), value))
+
+ def __str__(self):
+ if self.type in reverse_operators:
+ return reverse_operators[self.type]
+ elif self.type == 'name':
+ return self.value
+ return self.type
+
+ def test(self, expr):
+ """Test a token against a token expression. This can either be a
+ token type or ``'token_type:token_value'``. This can only test
+ against string values and types.
+ """
+ # here we do a regular string equality check as test_any is usually
+ # passed an iterable of not interned strings.
+ if self.type == expr:
+ return True
+ elif ':' in expr:
+ return expr.split(':', 1) == [self.type, self.value]
+ return False
+
+ def test_any(self, *iterable):
+ """Test against multiple token expressions."""
+ for expr in iterable:
+ if self.test(expr):
+ return True
+ return False
+
+ def __repr__(self):
+ return 'Token(%r, %r, %r)' % (
+ self.lineno,
+ self.type,
+ self.value
+ )
+
+
+@implements_iterator
+class TokenStreamIterator(object):
+ """The iterator for tokenstreams. Iterate over the stream
+ until the eof token is reached.
+ """
+
+ def __init__(self, stream):
+ self.stream = stream
+
+ def __iter__(self):
+ return self
+
+ def __next__(self):
+ token = self.stream.current
+ if token.type is TOKEN_EOF:
+ self.stream.close()
+ raise StopIteration()
+ next(self.stream)
+ return token
+
+
+@implements_iterator
+class TokenStream(object):
+ """A token stream is an iterable that yields :class:`Token`\s. The
+ parser however does not iterate over it but calls :meth:`next` to go
+ one token ahead. The current active token is stored as :attr:`current`.
+ """
+
+ def __init__(self, generator, name, filename):
+ self._iter = iter(generator)
+ self._pushed = deque()
+ self.name = name
+ self.filename = filename
+ self.closed = False
+ self.current = Token(1, TOKEN_INITIAL, '')
+ next(self)
+
+ def __iter__(self):
+ return TokenStreamIterator(self)
+
+ def __bool__(self):
+ return bool(self._pushed) or self.current.type is not TOKEN_EOF
+ __nonzero__ = __bool__ # py2
+
+ eos = property(lambda x: not x, doc="Are we at the end of the stream?")
+
+ def push(self, token):
+ """Push a token back to the stream."""
+ self._pushed.append(token)
+
+ def look(self):
+ """Look at the next token."""
+ old_token = next(self)
+ result = self.current
+ self.push(result)
+ self.current = old_token
+ return result
+
+ def skip(self, n=1):
+ """Got n tokens ahead."""
+ for x in range(n):
+ next(self)
+
+ def next_if(self, expr):
+ """Perform the token test and return the token if it matched.
+ Otherwise the return value is `None`.
+ """
+ if self.current.test(expr):
+ return next(self)
+
+ def skip_if(self, expr):
+ """Like :meth:`next_if` but only returns `True` or `False`."""
+ return self.next_if(expr) is not None
+
+ def __next__(self):
+ """Go one token ahead and return the old one"""
+ rv = self.current
+ if self._pushed:
+ self.current = self._pushed.popleft()
+ elif self.current.type is not TOKEN_EOF:
+ try:
+ self.current = next(self._iter)
+ except StopIteration:
+ self.close()
+ return rv
+
+ def close(self):
+ """Close the stream."""
+ self.current = Token(self.current.lineno, TOKEN_EOF, '')
+ self._iter = None
+ self.closed = True
+
+ def expect(self, expr):
+ """Expect a given token type and return it. This accepts the same
+ argument as :meth:`jinja2.lexer.Token.test`.
+ """
+ if not self.current.test(expr):
+ expr = describe_token_expr(expr)
+ if self.current.type is TOKEN_EOF:
+ raise TemplateSyntaxError('unexpected end of template, '
+ 'expected %r.' % expr,
+ self.current.lineno,
+ self.name, self.filename)
+ raise TemplateSyntaxError("expected token %r, got %r" %
+ (expr, describe_token(self.current)),
+ self.current.lineno,
+ self.name, self.filename)
+ try:
+ return self.current
+ finally:
+ next(self)
+
+
+def get_lexer(environment):
+ """Return a lexer which is probably cached."""
+ key = (environment.block_start_string,
+ environment.block_end_string,
+ environment.variable_start_string,
+ environment.variable_end_string,
+ environment.comment_start_string,
+ environment.comment_end_string,
+ environment.line_statement_prefix,
+ environment.line_comment_prefix,
+ environment.trim_blocks,
+ environment.lstrip_blocks,
+ environment.newline_sequence,
+ environment.keep_trailing_newline)
+ lexer = _lexer_cache.get(key)
+ if lexer is None:
+ lexer = Lexer(environment)
+ _lexer_cache[key] = lexer
+ return lexer
+
+
+class Lexer(object):
+ """Class that implements a lexer for a given environment. Automatically
+ created by the environment class, usually you don't have to do that.
+
+ Note that the lexer is not automatically bound to an environment.
+ Multiple environments can share the same lexer.
+ """
+
+ def __init__(self, environment):
+ # shortcuts
+ c = lambda x: re.compile(x, re.M | re.S)
+ e = re.escape
+
+ # lexing rules for tags
+ tag_rules = [
+ (whitespace_re, TOKEN_WHITESPACE, None),
+ (float_re, TOKEN_FLOAT, None),
+ (integer_re, TOKEN_INTEGER, None),
+ (name_re, TOKEN_NAME, None),
+ (string_re, TOKEN_STRING, None),
+ (operator_re, TOKEN_OPERATOR, None)
+ ]
+
+ # assemble the root lexing rule. because "|" is ungreedy
+ # we have to sort by length so that the lexer continues working
+ # as expected when we have parsing rules like <% for block and
+ # <%= for variables. (if someone wants asp like syntax)
+ # variables are just part of the rules if variable processing
+ # is required.
+ root_tag_rules = compile_rules(environment)
+
+ # block suffix if trimming is enabled
+ block_suffix_re = environment.trim_blocks and '\\n?' or ''
+
+ # strip leading spaces if lstrip_blocks is enabled
+ prefix_re = {}
+ if environment.lstrip_blocks:
+ # use '{%+' to manually disable lstrip_blocks behavior
+ no_lstrip_re = e('+')
+ # detect overlap between block and variable or comment strings
+ block_diff = c(r'^%s(.*)' % e(environment.block_start_string))
+ # make sure we don't mistake a block for a variable or a comment
+ m = block_diff.match(environment.comment_start_string)
+ no_lstrip_re += m and r'|%s' % e(m.group(1)) or ''
+ m = block_diff.match(environment.variable_start_string)
+ no_lstrip_re += m and r'|%s' % e(m.group(1)) or ''
+
+ # detect overlap between comment and variable strings
+ comment_diff = c(r'^%s(.*)' % e(environment.comment_start_string))
+ m = comment_diff.match(environment.variable_start_string)
+ no_variable_re = m and r'(?!%s)' % e(m.group(1)) or ''
+
+ lstrip_re = r'^[ \t]*'
+ block_prefix_re = r'%s%s(?!%s)|%s\+?' % (
+ lstrip_re,
+ e(environment.block_start_string),
+ no_lstrip_re,
+ e(environment.block_start_string),
+ )
+ comment_prefix_re = r'%s%s%s|%s\+?' % (
+ lstrip_re,
+ e(environment.comment_start_string),
+ no_variable_re,
+ e(environment.comment_start_string),
+ )
+ prefix_re['block'] = block_prefix_re
+ prefix_re['comment'] = comment_prefix_re
+ else:
+ block_prefix_re = '%s' % e(environment.block_start_string)
+
+ self.newline_sequence = environment.newline_sequence
+ self.keep_trailing_newline = environment.keep_trailing_newline
+
+ # global lexing rules
+ self.rules = {
+ 'root': [
+ # directives
+ (c('(.*?)(?:%s)' % '|'.join(
+ [r'(?P(?:\s*%s\-|%s)\s*raw\s*(?:\-%s\s*|%s))' % (
+ e(environment.block_start_string),
+ block_prefix_re,
+ e(environment.block_end_string),
+ e(environment.block_end_string)
+ )] + [
+ r'(?P<%s_begin>\s*%s\-|%s)' % (n, r, prefix_re.get(n,r))
+ for n, r in root_tag_rules
+ ])), (TOKEN_DATA, '#bygroup'), '#bygroup'),
+ # data
+ (c('.+'), TOKEN_DATA, None)
+ ],
+ # comments
+ TOKEN_COMMENT_BEGIN: [
+ (c(r'(.*?)((?:\-%s\s*|%s)%s)' % (
+ e(environment.comment_end_string),
+ e(environment.comment_end_string),
+ block_suffix_re
+ )), (TOKEN_COMMENT, TOKEN_COMMENT_END), '#pop'),
+ (c('(.)'), (Failure('Missing end of comment tag'),), None)
+ ],
+ # blocks
+ TOKEN_BLOCK_BEGIN: [
+ (c('(?:\-%s\s*|%s)%s' % (
+ e(environment.block_end_string),
+ e(environment.block_end_string),
+ block_suffix_re
+ )), TOKEN_BLOCK_END, '#pop'),
+ ] + tag_rules,
+ # variables
+ TOKEN_VARIABLE_BEGIN: [
+ (c('\-%s\s*|%s' % (
+ e(environment.variable_end_string),
+ e(environment.variable_end_string)
+ )), TOKEN_VARIABLE_END, '#pop')
+ ] + tag_rules,
+ # raw block
+ TOKEN_RAW_BEGIN: [
+ (c('(.*?)((?:\s*%s\-|%s)\s*endraw\s*(?:\-%s\s*|%s%s))' % (
+ e(environment.block_start_string),
+ block_prefix_re,
+ e(environment.block_end_string),
+ e(environment.block_end_string),
+ block_suffix_re
+ )), (TOKEN_DATA, TOKEN_RAW_END), '#pop'),
+ (c('(.)'), (Failure('Missing end of raw directive'),), None)
+ ],
+ # line statements
+ TOKEN_LINESTATEMENT_BEGIN: [
+ (c(r'\s*(\n|$)'), TOKEN_LINESTATEMENT_END, '#pop')
+ ] + tag_rules,
+ # line comments
+ TOKEN_LINECOMMENT_BEGIN: [
+ (c(r'(.*?)()(?=\n|$)'), (TOKEN_LINECOMMENT,
+ TOKEN_LINECOMMENT_END), '#pop')
+ ]
+ }
+
+ def _normalize_newlines(self, value):
+ """Called for strings and template data to normalize it to unicode."""
+ return newline_re.sub(self.newline_sequence, value)
+
+ def tokenize(self, source, name=None, filename=None, state=None):
+ """Calls tokeniter + tokenize and wraps it in a token stream.
+ """
+ stream = self.tokeniter(source, name, filename, state)
+ return TokenStream(self.wrap(stream, name, filename), name, filename)
+
+ def wrap(self, stream, name=None, filename=None):
+ """This is called with the stream as returned by `tokenize` and wraps
+ every token in a :class:`Token` and converts the value.
+ """
+ for lineno, token, value in stream:
+ if token in ignored_tokens:
+ continue
+ elif token == 'linestatement_begin':
+ token = 'block_begin'
+ elif token == 'linestatement_end':
+ token = 'block_end'
+ # we are not interested in those tokens in the parser
+ elif token in ('raw_begin', 'raw_end'):
+ continue
+ elif token == 'data':
+ value = self._normalize_newlines(value)
+ elif token == 'keyword':
+ token = value
+ elif token == 'name':
+ value = str(value)
+ elif token == 'string':
+ # try to unescape string
+ try:
+ value = self._normalize_newlines(value[1:-1]) \
+ .encode('ascii', 'backslashreplace') \
+ .decode('unicode-escape')
+ except Exception as e:
+ msg = str(e).split(':')[-1].strip()
+ raise TemplateSyntaxError(msg, lineno, name, filename)
+ # if we can express it as bytestring (ascii only)
+ # we do that for support of semi broken APIs
+ # as datetime.datetime.strftime. On python 3 this
+ # call becomes a noop thanks to 2to3
+ if PY2:
+ try:
+ value = value.encode('ascii')
+ except UnicodeError:
+ pass
+ elif token == 'integer':
+ value = int(value)
+ elif token == 'float':
+ value = float(value)
+ elif token == 'operator':
+ token = operators[value]
+ yield Token(lineno, token, value)
+
+ def tokeniter(self, source, name, filename=None, state=None):
+ """This method tokenizes the text and returns the tokens in a
+ generator. Use this method if you just want to tokenize a template.
+ """
+ source = text_type(source)
+ lines = source.splitlines()
+ if self.keep_trailing_newline and source:
+ for newline in ('\r\n', '\r', '\n'):
+ if source.endswith(newline):
+ lines.append('')
+ break
+ source = '\n'.join(lines)
+ pos = 0
+ lineno = 1
+ stack = ['root']
+ if state is not None and state != 'root':
+ assert state in ('variable', 'block'), 'invalid state'
+ stack.append(state + '_begin')
+ else:
+ state = 'root'
+ statetokens = self.rules[stack[-1]]
+ source_length = len(source)
+
+ balancing_stack = []
+
+ while 1:
+ # tokenizer loop
+ for regex, tokens, new_state in statetokens:
+ m = regex.match(source, pos)
+ # if no match we try again with the next rule
+ if m is None:
+ continue
+
+ # we only match blocks and variables if braces / parentheses
+ # are balanced. continue parsing with the lower rule which
+ # is the operator rule. do this only if the end tags look
+ # like operators
+ if balancing_stack and \
+ tokens in ('variable_end', 'block_end',
+ 'linestatement_end'):
+ continue
+
+ # tuples support more options
+ if isinstance(tokens, tuple):
+ for idx, token in enumerate(tokens):
+ # failure group
+ if token.__class__ is Failure:
+ raise token(lineno, filename)
+ # bygroup is a bit more complex, in that case we
+ # yield for the current token the first named
+ # group that matched
+ elif token == '#bygroup':
+ for key, value in iteritems(m.groupdict()):
+ if value is not None:
+ yield lineno, key, value
+ lineno += value.count('\n')
+ break
+ else:
+ raise RuntimeError('%r wanted to resolve '
+ 'the token dynamically'
+ ' but no group matched'
+ % regex)
+ # normal group
+ else:
+ data = m.group(idx + 1)
+ if data or token not in ignore_if_empty:
+ yield lineno, token, data
+ lineno += data.count('\n')
+
+ # strings as token just are yielded as it.
+ else:
+ data = m.group()
+ # update brace/parentheses balance
+ if tokens == 'operator':
+ if data == '{':
+ balancing_stack.append('}')
+ elif data == '(':
+ balancing_stack.append(')')
+ elif data == '[':
+ balancing_stack.append(']')
+ elif data in ('}', ')', ']'):
+ if not balancing_stack:
+ raise TemplateSyntaxError('unexpected \'%s\'' %
+ data, lineno, name,
+ filename)
+ expected_op = balancing_stack.pop()
+ if expected_op != data:
+ raise TemplateSyntaxError('unexpected \'%s\', '
+ 'expected \'%s\'' %
+ (data, expected_op),
+ lineno, name,
+ filename)
+ # yield items
+ if data or tokens not in ignore_if_empty:
+ yield lineno, tokens, data
+ lineno += data.count('\n')
+
+ # fetch new position into new variable so that we can check
+ # if there is a internal parsing error which would result
+ # in an infinite loop
+ pos2 = m.end()
+
+ # handle state changes
+ if new_state is not None:
+ # remove the uppermost state
+ if new_state == '#pop':
+ stack.pop()
+ # resolve the new state by group checking
+ elif new_state == '#bygroup':
+ for key, value in iteritems(m.groupdict()):
+ if value is not None:
+ stack.append(key)
+ break
+ else:
+ raise RuntimeError('%r wanted to resolve the '
+ 'new state dynamically but'
+ ' no group matched' %
+ regex)
+ # direct state name given
+ else:
+ stack.append(new_state)
+ statetokens = self.rules[stack[-1]]
+ # we are still at the same position and no stack change.
+ # this means a loop without break condition, avoid that and
+ # raise error
+ elif pos2 == pos:
+ raise RuntimeError('%r yielded empty string without '
+ 'stack change' % regex)
+ # publish new function and start again
+ pos = pos2
+ break
+ # if loop terminated without break we haven't found a single match
+ # either we are at the end of the file or we have a problem
+ else:
+ # end of text
+ if pos >= source_length:
+ return
+ # something went wrong
+ raise TemplateSyntaxError('unexpected char %r at %d' %
+ (source[pos], pos), lineno,
+ name, filename)
diff --git a/venv/lib/python2.7/site-packages/Jinja2-2.8-py2.7.egg/jinja2/loaders.py b/venv/lib/python2.7/site-packages/Jinja2-2.8-py2.7.egg/jinja2/loaders.py
new file mode 100644
index 000000000..44aa3925a
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/Jinja2-2.8-py2.7.egg/jinja2/loaders.py
@@ -0,0 +1,481 @@
+# -*- coding: utf-8 -*-
+"""
+ jinja2.loaders
+ ~~~~~~~~~~~~~~
+
+ Jinja loader classes.
+
+ :copyright: (c) 2010 by the Jinja Team.
+ :license: BSD, see LICENSE for more details.
+"""
+import os
+import sys
+import weakref
+from types import ModuleType
+from os import path
+from hashlib import sha1
+from jinja2.exceptions import TemplateNotFound
+from jinja2.utils import open_if_exists, internalcode
+from jinja2._compat import string_types, iteritems
+
+
+def split_template_path(template):
+ """Split a path into segments and perform a sanity check. If it detects
+ '..' in the path it will raise a `TemplateNotFound` error.
+ """
+ pieces = []
+ for piece in template.split('/'):
+ if path.sep in piece \
+ or (path.altsep and path.altsep in piece) or \
+ piece == path.pardir:
+ raise TemplateNotFound(template)
+ elif piece and piece != '.':
+ pieces.append(piece)
+ return pieces
+
+
+class BaseLoader(object):
+ """Baseclass for all loaders. Subclass this and override `get_source` to
+ implement a custom loading mechanism. The environment provides a
+ `get_template` method that calls the loader's `load` method to get the
+ :class:`Template` object.
+
+ A very basic example for a loader that looks up templates on the file
+ system could look like this::
+
+ from jinja2 import BaseLoader, TemplateNotFound
+ from os.path import join, exists, getmtime
+
+ class MyLoader(BaseLoader):
+
+ def __init__(self, path):
+ self.path = path
+
+ def get_source(self, environment, template):
+ path = join(self.path, template)
+ if not exists(path):
+ raise TemplateNotFound(template)
+ mtime = getmtime(path)
+ with file(path) as f:
+ source = f.read().decode('utf-8')
+ return source, path, lambda: mtime == getmtime(path)
+ """
+
+ #: if set to `False` it indicates that the loader cannot provide access
+ #: to the source of templates.
+ #:
+ #: .. versionadded:: 2.4
+ has_source_access = True
+
+ def get_source(self, environment, template):
+ """Get the template source, filename and reload helper for a template.
+ It's passed the environment and template name and has to return a
+ tuple in the form ``(source, filename, uptodate)`` or raise a
+ `TemplateNotFound` error if it can't locate the template.
+
+ The source part of the returned tuple must be the source of the
+ template as unicode string or a ASCII bytestring. The filename should
+ be the name of the file on the filesystem if it was loaded from there,
+ otherwise `None`. The filename is used by python for the tracebacks
+ if no loader extension is used.
+
+ The last item in the tuple is the `uptodate` function. If auto
+ reloading is enabled it's always called to check if the template
+ changed. No arguments are passed so the function must store the
+ old state somewhere (for example in a closure). If it returns `False`
+ the template will be reloaded.
+ """
+ if not self.has_source_access:
+ raise RuntimeError('%s cannot provide access to the source' %
+ self.__class__.__name__)
+ raise TemplateNotFound(template)
+
+ def list_templates(self):
+ """Iterates over all templates. If the loader does not support that
+ it should raise a :exc:`TypeError` which is the default behavior.
+ """
+ raise TypeError('this loader cannot iterate over all templates')
+
+ @internalcode
+ def load(self, environment, name, globals=None):
+ """Loads a template. This method looks up the template in the cache
+ or loads one by calling :meth:`get_source`. Subclasses should not
+ override this method as loaders working on collections of other
+ loaders (such as :class:`PrefixLoader` or :class:`ChoiceLoader`)
+ will not call this method but `get_source` directly.
+ """
+ code = None
+ if globals is None:
+ globals = {}
+
+ # first we try to get the source for this template together
+ # with the filename and the uptodate function.
+ source, filename, uptodate = self.get_source(environment, name)
+
+ # try to load the code from the bytecode cache if there is a
+ # bytecode cache configured.
+ bcc = environment.bytecode_cache
+ if bcc is not None:
+ bucket = bcc.get_bucket(environment, name, filename, source)
+ code = bucket.code
+
+ # if we don't have code so far (not cached, no longer up to
+ # date) etc. we compile the template
+ if code is None:
+ code = environment.compile(source, name, filename)
+
+ # if the bytecode cache is available and the bucket doesn't
+ # have a code so far, we give the bucket the new code and put
+ # it back to the bytecode cache.
+ if bcc is not None and bucket.code is None:
+ bucket.code = code
+ bcc.set_bucket(bucket)
+
+ return environment.template_class.from_code(environment, code,
+ globals, uptodate)
+
+
+class FileSystemLoader(BaseLoader):
+ """Loads templates from the file system. This loader can find templates
+ in folders on the file system and is the preferred way to load them.
+
+ The loader takes the path to the templates as string, or if multiple
+ locations are wanted a list of them which is then looked up in the
+ given order::
+
+ >>> loader = FileSystemLoader('/path/to/templates')
+ >>> loader = FileSystemLoader(['/path/to/templates', '/other/path'])
+
+ Per default the template encoding is ``'utf-8'`` which can be changed
+ by setting the `encoding` parameter to something else.
+
+ To follow symbolic links, set the *followlinks* parameter to ``True``::
+
+ >>> loader = FileSystemLoader('/path/to/templates', followlinks=True)
+
+ .. versionchanged:: 2.8+
+ The *followlinks* parameter was added.
+ """
+
+ def __init__(self, searchpath, encoding='utf-8', followlinks=False):
+ if isinstance(searchpath, string_types):
+ searchpath = [searchpath]
+ self.searchpath = list(searchpath)
+ self.encoding = encoding
+ self.followlinks = followlinks
+
+ def get_source(self, environment, template):
+ pieces = split_template_path(template)
+ for searchpath in self.searchpath:
+ filename = path.join(searchpath, *pieces)
+ f = open_if_exists(filename)
+ if f is None:
+ continue
+ try:
+ contents = f.read().decode(self.encoding)
+ finally:
+ f.close()
+
+ mtime = path.getmtime(filename)
+
+ def uptodate():
+ try:
+ return path.getmtime(filename) == mtime
+ except OSError:
+ return False
+ return contents, filename, uptodate
+ raise TemplateNotFound(template)
+
+ def list_templates(self):
+ found = set()
+ for searchpath in self.searchpath:
+ walk_dir = os.walk(searchpath, followlinks=self.followlinks)
+ for dirpath, dirnames, filenames in walk_dir:
+ for filename in filenames:
+ template = os.path.join(dirpath, filename) \
+ [len(searchpath):].strip(os.path.sep) \
+ .replace(os.path.sep, '/')
+ if template[:2] == './':
+ template = template[2:]
+ if template not in found:
+ found.add(template)
+ return sorted(found)
+
+
+class PackageLoader(BaseLoader):
+ """Load templates from python eggs or packages. It is constructed with
+ the name of the python package and the path to the templates in that
+ package::
+
+ loader = PackageLoader('mypackage', 'views')
+
+ If the package path is not given, ``'templates'`` is assumed.
+
+ Per default the template encoding is ``'utf-8'`` which can be changed
+ by setting the `encoding` parameter to something else. Due to the nature
+ of eggs it's only possible to reload templates if the package was loaded
+ from the file system and not a zip file.
+ """
+
+ def __init__(self, package_name, package_path='templates',
+ encoding='utf-8'):
+ from pkg_resources import DefaultProvider, ResourceManager, \
+ get_provider
+ provider = get_provider(package_name)
+ self.encoding = encoding
+ self.manager = ResourceManager()
+ self.filesystem_bound = isinstance(provider, DefaultProvider)
+ self.provider = provider
+ self.package_path = package_path
+
+ def get_source(self, environment, template):
+ pieces = split_template_path(template)
+ p = '/'.join((self.package_path,) + tuple(pieces))
+ if not self.provider.has_resource(p):
+ raise TemplateNotFound(template)
+
+ filename = uptodate = None
+ if self.filesystem_bound:
+ filename = self.provider.get_resource_filename(self.manager, p)
+ mtime = path.getmtime(filename)
+ def uptodate():
+ try:
+ return path.getmtime(filename) == mtime
+ except OSError:
+ return False
+
+ source = self.provider.get_resource_string(self.manager, p)
+ return source.decode(self.encoding), filename, uptodate
+
+ def list_templates(self):
+ path = self.package_path
+ if path[:2] == './':
+ path = path[2:]
+ elif path == '.':
+ path = ''
+ offset = len(path)
+ results = []
+ def _walk(path):
+ for filename in self.provider.resource_listdir(path):
+ fullname = path + '/' + filename
+ if self.provider.resource_isdir(fullname):
+ _walk(fullname)
+ else:
+ results.append(fullname[offset:].lstrip('/'))
+ _walk(path)
+ results.sort()
+ return results
+
+
+class DictLoader(BaseLoader):
+ """Loads a template from a python dict. It's passed a dict of unicode
+ strings bound to template names. This loader is useful for unittesting:
+
+ >>> loader = DictLoader({'index.html': 'source here'})
+
+ Because auto reloading is rarely useful this is disabled per default.
+ """
+
+ def __init__(self, mapping):
+ self.mapping = mapping
+
+ def get_source(self, environment, template):
+ if template in self.mapping:
+ source = self.mapping[template]
+ return source, None, lambda: source == self.mapping.get(template)
+ raise TemplateNotFound(template)
+
+ def list_templates(self):
+ return sorted(self.mapping)
+
+
+class FunctionLoader(BaseLoader):
+ """A loader that is passed a function which does the loading. The
+ function receives the name of the template and has to return either
+ an unicode string with the template source, a tuple in the form ``(source,
+ filename, uptodatefunc)`` or `None` if the template does not exist.
+
+ >>> def load_template(name):
+ ... if name == 'index.html':
+ ... return '...'
+ ...
+ >>> loader = FunctionLoader(load_template)
+
+ The `uptodatefunc` is a function that is called if autoreload is enabled
+ and has to return `True` if the template is still up to date. For more
+ details have a look at :meth:`BaseLoader.get_source` which has the same
+ return value.
+ """
+
+ def __init__(self, load_func):
+ self.load_func = load_func
+
+ def get_source(self, environment, template):
+ rv = self.load_func(template)
+ if rv is None:
+ raise TemplateNotFound(template)
+ elif isinstance(rv, string_types):
+ return rv, None, None
+ return rv
+
+
+class PrefixLoader(BaseLoader):
+ """A loader that is passed a dict of loaders where each loader is bound
+ to a prefix. The prefix is delimited from the template by a slash per
+ default, which can be changed by setting the `delimiter` argument to
+ something else::
+
+ loader = PrefixLoader({
+ 'app1': PackageLoader('mypackage.app1'),
+ 'app2': PackageLoader('mypackage.app2')
+ })
+
+ By loading ``'app1/index.html'`` the file from the app1 package is loaded,
+ by loading ``'app2/index.html'`` the file from the second.
+ """
+
+ def __init__(self, mapping, delimiter='/'):
+ self.mapping = mapping
+ self.delimiter = delimiter
+
+ def get_loader(self, template):
+ try:
+ prefix, name = template.split(self.delimiter, 1)
+ loader = self.mapping[prefix]
+ except (ValueError, KeyError):
+ raise TemplateNotFound(template)
+ return loader, name
+
+ def get_source(self, environment, template):
+ loader, name = self.get_loader(template)
+ try:
+ return loader.get_source(environment, name)
+ except TemplateNotFound:
+ # re-raise the exception with the correct fileame here.
+ # (the one that includes the prefix)
+ raise TemplateNotFound(template)
+
+ @internalcode
+ def load(self, environment, name, globals=None):
+ loader, local_name = self.get_loader(name)
+ try:
+ return loader.load(environment, local_name, globals)
+ except TemplateNotFound:
+ # re-raise the exception with the correct fileame here.
+ # (the one that includes the prefix)
+ raise TemplateNotFound(name)
+
+ def list_templates(self):
+ result = []
+ for prefix, loader in iteritems(self.mapping):
+ for template in loader.list_templates():
+ result.append(prefix + self.delimiter + template)
+ return result
+
+
+class ChoiceLoader(BaseLoader):
+ """This loader works like the `PrefixLoader` just that no prefix is
+ specified. If a template could not be found by one loader the next one
+ is tried.
+
+ >>> loader = ChoiceLoader([
+ ... FileSystemLoader('/path/to/user/templates'),
+ ... FileSystemLoader('/path/to/system/templates')
+ ... ])
+
+ This is useful if you want to allow users to override builtin templates
+ from a different location.
+ """
+
+ def __init__(self, loaders):
+ self.loaders = loaders
+
+ def get_source(self, environment, template):
+ for loader in self.loaders:
+ try:
+ return loader.get_source(environment, template)
+ except TemplateNotFound:
+ pass
+ raise TemplateNotFound(template)
+
+ @internalcode
+ def load(self, environment, name, globals=None):
+ for loader in self.loaders:
+ try:
+ return loader.load(environment, name, globals)
+ except TemplateNotFound:
+ pass
+ raise TemplateNotFound(name)
+
+ def list_templates(self):
+ found = set()
+ for loader in self.loaders:
+ found.update(loader.list_templates())
+ return sorted(found)
+
+
+class _TemplateModule(ModuleType):
+ """Like a normal module but with support for weak references"""
+
+
+class ModuleLoader(BaseLoader):
+ """This loader loads templates from precompiled templates.
+
+ Example usage:
+
+ >>> loader = ChoiceLoader([
+ ... ModuleLoader('/path/to/compiled/templates'),
+ ... FileSystemLoader('/path/to/templates')
+ ... ])
+
+ Templates can be precompiled with :meth:`Environment.compile_templates`.
+ """
+
+ has_source_access = False
+
+ def __init__(self, path):
+ package_name = '_jinja2_module_templates_%x' % id(self)
+
+ # create a fake module that looks for the templates in the
+ # path given.
+ mod = _TemplateModule(package_name)
+ if isinstance(path, string_types):
+ path = [path]
+ else:
+ path = list(path)
+ mod.__path__ = path
+
+ sys.modules[package_name] = weakref.proxy(mod,
+ lambda x: sys.modules.pop(package_name, None))
+
+ # the only strong reference, the sys.modules entry is weak
+ # so that the garbage collector can remove it once the
+ # loader that created it goes out of business.
+ self.module = mod
+ self.package_name = package_name
+
+ @staticmethod
+ def get_template_key(name):
+ return 'tmpl_' + sha1(name.encode('utf-8')).hexdigest()
+
+ @staticmethod
+ def get_module_filename(name):
+ return ModuleLoader.get_template_key(name) + '.py'
+
+ @internalcode
+ def load(self, environment, name, globals=None):
+ key = self.get_template_key(name)
+ module = '%s.%s' % (self.package_name, key)
+ mod = getattr(self.module, module, None)
+ if mod is None:
+ try:
+ mod = __import__(module, None, None, ['root'])
+ except ImportError:
+ raise TemplateNotFound(name)
+
+ # remove the entry from sys.modules, we only want the attribute
+ # on the module object we have stored on the loader.
+ sys.modules.pop(module, None)
+
+ return environment.template_class.from_module_dict(
+ environment, mod.__dict__, globals)
diff --git a/venv/lib/python2.7/site-packages/Jinja2-2.8-py2.7.egg/jinja2/meta.py b/venv/lib/python2.7/site-packages/Jinja2-2.8-py2.7.egg/jinja2/meta.py
new file mode 100644
index 000000000..3dbab7c22
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/Jinja2-2.8-py2.7.egg/jinja2/meta.py
@@ -0,0 +1,103 @@
+# -*- coding: utf-8 -*-
+"""
+ jinja2.meta
+ ~~~~~~~~~~~
+
+ This module implements various functions that exposes information about
+ templates that might be interesting for various kinds of applications.
+
+ :copyright: (c) 2010 by the Jinja Team, see AUTHORS for more details.
+ :license: BSD, see LICENSE for more details.
+"""
+from jinja2 import nodes
+from jinja2.compiler import CodeGenerator
+from jinja2._compat import string_types
+
+
+class TrackingCodeGenerator(CodeGenerator):
+ """We abuse the code generator for introspection."""
+
+ def __init__(self, environment):
+ CodeGenerator.__init__(self, environment, '',
+ '')
+ self.undeclared_identifiers = set()
+
+ def write(self, x):
+ """Don't write."""
+
+ def pull_locals(self, frame):
+ """Remember all undeclared identifiers."""
+ self.undeclared_identifiers.update(frame.identifiers.undeclared)
+
+
+def find_undeclared_variables(ast):
+ """Returns a set of all variables in the AST that will be looked up from
+ the context at runtime. Because at compile time it's not known which
+ variables will be used depending on the path the execution takes at
+ runtime, all variables are returned.
+
+ >>> from jinja2 import Environment, meta
+ >>> env = Environment()
+ >>> ast = env.parse('{% set foo = 42 %}{{ bar + foo }}')
+ >>> meta.find_undeclared_variables(ast) == set(['bar'])
+ True
+
+ .. admonition:: Implementation
+
+ Internally the code generator is used for finding undeclared variables.
+ This is good to know because the code generator might raise a
+ :exc:`TemplateAssertionError` during compilation and as a matter of
+ fact this function can currently raise that exception as well.
+ """
+ codegen = TrackingCodeGenerator(ast.environment)
+ codegen.visit(ast)
+ return codegen.undeclared_identifiers
+
+
+def find_referenced_templates(ast):
+ """Finds all the referenced templates from the AST. This will return an
+ iterator over all the hardcoded template extensions, inclusions and
+ imports. If dynamic inheritance or inclusion is used, `None` will be
+ yielded.
+
+ >>> from jinja2 import Environment, meta
+ >>> env = Environment()
+ >>> ast = env.parse('{% extends "layout.html" %}{% include helper %}')
+ >>> list(meta.find_referenced_templates(ast))
+ ['layout.html', None]
+
+ This function is useful for dependency tracking. For example if you want
+ to rebuild parts of the website after a layout template has changed.
+ """
+ for node in ast.find_all((nodes.Extends, nodes.FromImport, nodes.Import,
+ nodes.Include)):
+ if not isinstance(node.template, nodes.Const):
+ # a tuple with some non consts in there
+ if isinstance(node.template, (nodes.Tuple, nodes.List)):
+ for template_name in node.template.items:
+ # something const, only yield the strings and ignore
+ # non-string consts that really just make no sense
+ if isinstance(template_name, nodes.Const):
+ if isinstance(template_name.value, string_types):
+ yield template_name.value
+ # something dynamic in there
+ else:
+ yield None
+ # something dynamic we don't know about here
+ else:
+ yield None
+ continue
+ # constant is a basestring, direct template name
+ if isinstance(node.template.value, string_types):
+ yield node.template.value
+ # a tuple or list (latter *should* not happen) made of consts,
+ # yield the consts that are strings. We could warn here for
+ # non string values
+ elif isinstance(node, nodes.Include) and \
+ isinstance(node.template.value, (tuple, list)):
+ for template_name in node.template.value:
+ if isinstance(template_name, string_types):
+ yield template_name
+ # something else we don't care about, we could warn here
+ else:
+ yield None
diff --git a/venv/lib/python2.7/site-packages/Jinja2-2.8-py2.7.egg/jinja2/nodes.py b/venv/lib/python2.7/site-packages/Jinja2-2.8-py2.7.egg/jinja2/nodes.py
new file mode 100644
index 000000000..d32046ce5
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/Jinja2-2.8-py2.7.egg/jinja2/nodes.py
@@ -0,0 +1,919 @@
+# -*- coding: utf-8 -*-
+"""
+ jinja2.nodes
+ ~~~~~~~~~~~~
+
+ This module implements additional nodes derived from the ast base node.
+
+ It also provides some node tree helper functions like `in_lineno` and
+ `get_nodes` used by the parser and translator in order to normalize
+ python and jinja nodes.
+
+ :copyright: (c) 2010 by the Jinja Team.
+ :license: BSD, see LICENSE for more details.
+"""
+import types
+import operator
+
+from collections import deque
+from jinja2.utils import Markup
+from jinja2._compat import izip, with_metaclass, text_type
+
+
+#: the types we support for context functions
+_context_function_types = (types.FunctionType, types.MethodType)
+
+
+_binop_to_func = {
+ '*': operator.mul,
+ '/': operator.truediv,
+ '//': operator.floordiv,
+ '**': operator.pow,
+ '%': operator.mod,
+ '+': operator.add,
+ '-': operator.sub
+}
+
+_uaop_to_func = {
+ 'not': operator.not_,
+ '+': operator.pos,
+ '-': operator.neg
+}
+
+_cmpop_to_func = {
+ 'eq': operator.eq,
+ 'ne': operator.ne,
+ 'gt': operator.gt,
+ 'gteq': operator.ge,
+ 'lt': operator.lt,
+ 'lteq': operator.le,
+ 'in': lambda a, b: a in b,
+ 'notin': lambda a, b: a not in b
+}
+
+
+class Impossible(Exception):
+ """Raised if the node could not perform a requested action."""
+
+
+class NodeType(type):
+ """A metaclass for nodes that handles the field and attribute
+ inheritance. fields and attributes from the parent class are
+ automatically forwarded to the child."""
+
+ def __new__(cls, name, bases, d):
+ for attr in 'fields', 'attributes':
+ storage = []
+ storage.extend(getattr(bases[0], attr, ()))
+ storage.extend(d.get(attr, ()))
+ assert len(bases) == 1, 'multiple inheritance not allowed'
+ assert len(storage) == len(set(storage)), 'layout conflict'
+ d[attr] = tuple(storage)
+ d.setdefault('abstract', False)
+ return type.__new__(cls, name, bases, d)
+
+
+class EvalContext(object):
+ """Holds evaluation time information. Custom attributes can be attached
+ to it in extensions.
+ """
+
+ def __init__(self, environment, template_name=None):
+ self.environment = environment
+ if callable(environment.autoescape):
+ self.autoescape = environment.autoescape(template_name)
+ else:
+ self.autoescape = environment.autoescape
+ self.volatile = False
+
+ def save(self):
+ return self.__dict__.copy()
+
+ def revert(self, old):
+ self.__dict__.clear()
+ self.__dict__.update(old)
+
+
+def get_eval_context(node, ctx):
+ if ctx is None:
+ if node.environment is None:
+ raise RuntimeError('if no eval context is passed, the '
+ 'node must have an attached '
+ 'environment.')
+ return EvalContext(node.environment)
+ return ctx
+
+
+class Node(with_metaclass(NodeType, object)):
+ """Baseclass for all Jinja2 nodes. There are a number of nodes available
+ of different types. There are four major types:
+
+ - :class:`Stmt`: statements
+ - :class:`Expr`: expressions
+ - :class:`Helper`: helper nodes
+ - :class:`Template`: the outermost wrapper node
+
+ All nodes have fields and attributes. Fields may be other nodes, lists,
+ or arbitrary values. Fields are passed to the constructor as regular
+ positional arguments, attributes as keyword arguments. Each node has
+ two attributes: `lineno` (the line number of the node) and `environment`.
+ The `environment` attribute is set at the end of the parsing process for
+ all nodes automatically.
+ """
+ fields = ()
+ attributes = ('lineno', 'environment')
+ abstract = True
+
+ def __init__(self, *fields, **attributes):
+ if self.abstract:
+ raise TypeError('abstract nodes are not instanciable')
+ if fields:
+ if len(fields) != len(self.fields):
+ if not self.fields:
+ raise TypeError('%r takes 0 arguments' %
+ self.__class__.__name__)
+ raise TypeError('%r takes 0 or %d argument%s' % (
+ self.__class__.__name__,
+ len(self.fields),
+ len(self.fields) != 1 and 's' or ''
+ ))
+ for name, arg in izip(self.fields, fields):
+ setattr(self, name, arg)
+ for attr in self.attributes:
+ setattr(self, attr, attributes.pop(attr, None))
+ if attributes:
+ raise TypeError('unknown attribute %r' %
+ next(iter(attributes)))
+
+ def iter_fields(self, exclude=None, only=None):
+ """This method iterates over all fields that are defined and yields
+ ``(key, value)`` tuples. Per default all fields are returned, but
+ it's possible to limit that to some fields by providing the `only`
+ parameter or to exclude some using the `exclude` parameter. Both
+ should be sets or tuples of field names.
+ """
+ for name in self.fields:
+ if (exclude is only is None) or \
+ (exclude is not None and name not in exclude) or \
+ (only is not None and name in only):
+ try:
+ yield name, getattr(self, name)
+ except AttributeError:
+ pass
+
+ def iter_child_nodes(self, exclude=None, only=None):
+ """Iterates over all direct child nodes of the node. This iterates
+ over all fields and yields the values of they are nodes. If the value
+ of a field is a list all the nodes in that list are returned.
+ """
+ for field, item in self.iter_fields(exclude, only):
+ if isinstance(item, list):
+ for n in item:
+ if isinstance(n, Node):
+ yield n
+ elif isinstance(item, Node):
+ yield item
+
+ def find(self, node_type):
+ """Find the first node of a given type. If no such node exists the
+ return value is `None`.
+ """
+ for result in self.find_all(node_type):
+ return result
+
+ def find_all(self, node_type):
+ """Find all the nodes of a given type. If the type is a tuple,
+ the check is performed for any of the tuple items.
+ """
+ for child in self.iter_child_nodes():
+ if isinstance(child, node_type):
+ yield child
+ for result in child.find_all(node_type):
+ yield result
+
+ def set_ctx(self, ctx):
+ """Reset the context of a node and all child nodes. Per default the
+ parser will all generate nodes that have a 'load' context as it's the
+ most common one. This method is used in the parser to set assignment
+ targets and other nodes to a store context.
+ """
+ todo = deque([self])
+ while todo:
+ node = todo.popleft()
+ if 'ctx' in node.fields:
+ node.ctx = ctx
+ todo.extend(node.iter_child_nodes())
+ return self
+
+ def set_lineno(self, lineno, override=False):
+ """Set the line numbers of the node and children."""
+ todo = deque([self])
+ while todo:
+ node = todo.popleft()
+ if 'lineno' in node.attributes:
+ if node.lineno is None or override:
+ node.lineno = lineno
+ todo.extend(node.iter_child_nodes())
+ return self
+
+ def set_environment(self, environment):
+ """Set the environment for all nodes."""
+ todo = deque([self])
+ while todo:
+ node = todo.popleft()
+ node.environment = environment
+ todo.extend(node.iter_child_nodes())
+ return self
+
+ def __eq__(self, other):
+ return type(self) is type(other) and \
+ tuple(self.iter_fields()) == tuple(other.iter_fields())
+
+ def __ne__(self, other):
+ return not self.__eq__(other)
+
+ # Restore Python 2 hashing behavior on Python 3
+ __hash__ = object.__hash__
+
+ def __repr__(self):
+ return '%s(%s)' % (
+ self.__class__.__name__,
+ ', '.join('%s=%r' % (arg, getattr(self, arg, None)) for
+ arg in self.fields)
+ )
+
+
+class Stmt(Node):
+ """Base node for all statements."""
+ abstract = True
+
+
+class Helper(Node):
+ """Nodes that exist in a specific context only."""
+ abstract = True
+
+
+class Template(Node):
+ """Node that represents a template. This must be the outermost node that
+ is passed to the compiler.
+ """
+ fields = ('body',)
+
+
+class Output(Stmt):
+ """A node that holds multiple expressions which are then printed out.
+ This is used both for the `print` statement and the regular template data.
+ """
+ fields = ('nodes',)
+
+
+class Extends(Stmt):
+ """Represents an extends statement."""
+ fields = ('template',)
+
+
+class For(Stmt):
+ """The for loop. `target` is the target for the iteration (usually a
+ :class:`Name` or :class:`Tuple`), `iter` the iterable. `body` is a list
+ of nodes that are used as loop-body, and `else_` a list of nodes for the
+ `else` block. If no else node exists it has to be an empty list.
+
+ For filtered nodes an expression can be stored as `test`, otherwise `None`.
+ """
+ fields = ('target', 'iter', 'body', 'else_', 'test', 'recursive')
+
+
+class If(Stmt):
+ """If `test` is true, `body` is rendered, else `else_`."""
+ fields = ('test', 'body', 'else_')
+
+
+class Macro(Stmt):
+ """A macro definition. `name` is the name of the macro, `args` a list of
+ arguments and `defaults` a list of defaults if there are any. `body` is
+ a list of nodes for the macro body.
+ """
+ fields = ('name', 'args', 'defaults', 'body')
+
+
+class CallBlock(Stmt):
+ """Like a macro without a name but a call instead. `call` is called with
+ the unnamed macro as `caller` argument this node holds.
+ """
+ fields = ('call', 'args', 'defaults', 'body')
+
+
+class FilterBlock(Stmt):
+ """Node for filter sections."""
+ fields = ('body', 'filter')
+
+
+class Block(Stmt):
+ """A node that represents a block."""
+ fields = ('name', 'body', 'scoped')
+
+
+class Include(Stmt):
+ """A node that represents the include tag."""
+ fields = ('template', 'with_context', 'ignore_missing')
+
+
+class Import(Stmt):
+ """A node that represents the import tag."""
+ fields = ('template', 'target', 'with_context')
+
+
+class FromImport(Stmt):
+ """A node that represents the from import tag. It's important to not
+ pass unsafe names to the name attribute. The compiler translates the
+ attribute lookups directly into getattr calls and does *not* use the
+ subscript callback of the interface. As exported variables may not
+ start with double underscores (which the parser asserts) this is not a
+ problem for regular Jinja code, but if this node is used in an extension
+ extra care must be taken.
+
+ The list of names may contain tuples if aliases are wanted.
+ """
+ fields = ('template', 'names', 'with_context')
+
+
+class ExprStmt(Stmt):
+ """A statement that evaluates an expression and discards the result."""
+ fields = ('node',)
+
+
+class Assign(Stmt):
+ """Assigns an expression to a target."""
+ fields = ('target', 'node')
+
+
+class AssignBlock(Stmt):
+ """Assigns a block to a target."""
+ fields = ('target', 'body')
+
+
+class Expr(Node):
+ """Baseclass for all expressions."""
+ abstract = True
+
+ def as_const(self, eval_ctx=None):
+ """Return the value of the expression as constant or raise
+ :exc:`Impossible` if this was not possible.
+
+ An :class:`EvalContext` can be provided, if none is given
+ a default context is created which requires the nodes to have
+ an attached environment.
+
+ .. versionchanged:: 2.4
+ the `eval_ctx` parameter was added.
+ """
+ raise Impossible()
+
+ def can_assign(self):
+ """Check if it's possible to assign something to this node."""
+ return False
+
+
+class BinExpr(Expr):
+ """Baseclass for all binary expressions."""
+ fields = ('left', 'right')
+ operator = None
+ abstract = True
+
+ def as_const(self, eval_ctx=None):
+ eval_ctx = get_eval_context(self, eval_ctx)
+ # intercepted operators cannot be folded at compile time
+ if self.environment.sandboxed and \
+ self.operator in self.environment.intercepted_binops:
+ raise Impossible()
+ f = _binop_to_func[self.operator]
+ try:
+ return f(self.left.as_const(eval_ctx), self.right.as_const(eval_ctx))
+ except Exception:
+ raise Impossible()
+
+
+class UnaryExpr(Expr):
+ """Baseclass for all unary expressions."""
+ fields = ('node',)
+ operator = None
+ abstract = True
+
+ def as_const(self, eval_ctx=None):
+ eval_ctx = get_eval_context(self, eval_ctx)
+ # intercepted operators cannot be folded at compile time
+ if self.environment.sandboxed and \
+ self.operator in self.environment.intercepted_unops:
+ raise Impossible()
+ f = _uaop_to_func[self.operator]
+ try:
+ return f(self.node.as_const(eval_ctx))
+ except Exception:
+ raise Impossible()
+
+
+class Name(Expr):
+ """Looks up a name or stores a value in a name.
+ The `ctx` of the node can be one of the following values:
+
+ - `store`: store a value in the name
+ - `load`: load that name
+ - `param`: like `store` but if the name was defined as function parameter.
+ """
+ fields = ('name', 'ctx')
+
+ def can_assign(self):
+ return self.name not in ('true', 'false', 'none',
+ 'True', 'False', 'None')
+
+
+class Literal(Expr):
+ """Baseclass for literals."""
+ abstract = True
+
+
+class Const(Literal):
+ """All constant values. The parser will return this node for simple
+ constants such as ``42`` or ``"foo"`` but it can be used to store more
+ complex values such as lists too. Only constants with a safe
+ representation (objects where ``eval(repr(x)) == x`` is true).
+ """
+ fields = ('value',)
+
+ def as_const(self, eval_ctx=None):
+ return self.value
+
+ @classmethod
+ def from_untrusted(cls, value, lineno=None, environment=None):
+ """Return a const object if the value is representable as
+ constant value in the generated code, otherwise it will raise
+ an `Impossible` exception.
+ """
+ from .compiler import has_safe_repr
+ if not has_safe_repr(value):
+ raise Impossible()
+ return cls(value, lineno=lineno, environment=environment)
+
+
+class TemplateData(Literal):
+ """A constant template string."""
+ fields = ('data',)
+
+ def as_const(self, eval_ctx=None):
+ eval_ctx = get_eval_context(self, eval_ctx)
+ if eval_ctx.volatile:
+ raise Impossible()
+ if eval_ctx.autoescape:
+ return Markup(self.data)
+ return self.data
+
+
+class Tuple(Literal):
+ """For loop unpacking and some other things like multiple arguments
+ for subscripts. Like for :class:`Name` `ctx` specifies if the tuple
+ is used for loading the names or storing.
+ """
+ fields = ('items', 'ctx')
+
+ def as_const(self, eval_ctx=None):
+ eval_ctx = get_eval_context(self, eval_ctx)
+ return tuple(x.as_const(eval_ctx) for x in self.items)
+
+ def can_assign(self):
+ for item in self.items:
+ if not item.can_assign():
+ return False
+ return True
+
+
+class List(Literal):
+ """Any list literal such as ``[1, 2, 3]``"""
+ fields = ('items',)
+
+ def as_const(self, eval_ctx=None):
+ eval_ctx = get_eval_context(self, eval_ctx)
+ return [x.as_const(eval_ctx) for x in self.items]
+
+
+class Dict(Literal):
+ """Any dict literal such as ``{1: 2, 3: 4}``. The items must be a list of
+ :class:`Pair` nodes.
+ """
+ fields = ('items',)
+
+ def as_const(self, eval_ctx=None):
+ eval_ctx = get_eval_context(self, eval_ctx)
+ return dict(x.as_const(eval_ctx) for x in self.items)
+
+
+class Pair(Helper):
+ """A key, value pair for dicts."""
+ fields = ('key', 'value')
+
+ def as_const(self, eval_ctx=None):
+ eval_ctx = get_eval_context(self, eval_ctx)
+ return self.key.as_const(eval_ctx), self.value.as_const(eval_ctx)
+
+
+class Keyword(Helper):
+ """A key, value pair for keyword arguments where key is a string."""
+ fields = ('key', 'value')
+
+ def as_const(self, eval_ctx=None):
+ eval_ctx = get_eval_context(self, eval_ctx)
+ return self.key, self.value.as_const(eval_ctx)
+
+
+class CondExpr(Expr):
+ """A conditional expression (inline if expression). (``{{
+ foo if bar else baz }}``)
+ """
+ fields = ('test', 'expr1', 'expr2')
+
+ def as_const(self, eval_ctx=None):
+ eval_ctx = get_eval_context(self, eval_ctx)
+ if self.test.as_const(eval_ctx):
+ return self.expr1.as_const(eval_ctx)
+
+ # if we evaluate to an undefined object, we better do that at runtime
+ if self.expr2 is None:
+ raise Impossible()
+
+ return self.expr2.as_const(eval_ctx)
+
+
+class Filter(Expr):
+ """This node applies a filter on an expression. `name` is the name of
+ the filter, the rest of the fields are the same as for :class:`Call`.
+
+ If the `node` of a filter is `None` the contents of the last buffer are
+ filtered. Buffers are created by macros and filter blocks.
+ """
+ fields = ('node', 'name', 'args', 'kwargs', 'dyn_args', 'dyn_kwargs')
+
+ def as_const(self, eval_ctx=None):
+ eval_ctx = get_eval_context(self, eval_ctx)
+ if eval_ctx.volatile or self.node is None:
+ raise Impossible()
+ # we have to be careful here because we call filter_ below.
+ # if this variable would be called filter, 2to3 would wrap the
+ # call in a list beause it is assuming we are talking about the
+ # builtin filter function here which no longer returns a list in
+ # python 3. because of that, do not rename filter_ to filter!
+ filter_ = self.environment.filters.get(self.name)
+ if filter_ is None or getattr(filter_, 'contextfilter', False):
+ raise Impossible()
+ obj = self.node.as_const(eval_ctx)
+ args = [x.as_const(eval_ctx) for x in self.args]
+ if getattr(filter_, 'evalcontextfilter', False):
+ args.insert(0, eval_ctx)
+ elif getattr(filter_, 'environmentfilter', False):
+ args.insert(0, self.environment)
+ kwargs = dict(x.as_const(eval_ctx) for x in self.kwargs)
+ if self.dyn_args is not None:
+ try:
+ args.extend(self.dyn_args.as_const(eval_ctx))
+ except Exception:
+ raise Impossible()
+ if self.dyn_kwargs is not None:
+ try:
+ kwargs.update(self.dyn_kwargs.as_const(eval_ctx))
+ except Exception:
+ raise Impossible()
+ try:
+ return filter_(obj, *args, **kwargs)
+ except Exception:
+ raise Impossible()
+
+
+class Test(Expr):
+ """Applies a test on an expression. `name` is the name of the test, the
+ rest of the fields are the same as for :class:`Call`.
+ """
+ fields = ('node', 'name', 'args', 'kwargs', 'dyn_args', 'dyn_kwargs')
+
+
+class Call(Expr):
+ """Calls an expression. `args` is a list of arguments, `kwargs` a list
+ of keyword arguments (list of :class:`Keyword` nodes), and `dyn_args`
+ and `dyn_kwargs` has to be either `None` or a node that is used as
+ node for dynamic positional (``*args``) or keyword (``**kwargs``)
+ arguments.
+ """
+ fields = ('node', 'args', 'kwargs', 'dyn_args', 'dyn_kwargs')
+
+ def as_const(self, eval_ctx=None):
+ eval_ctx = get_eval_context(self, eval_ctx)
+ if eval_ctx.volatile:
+ raise Impossible()
+ obj = self.node.as_const(eval_ctx)
+
+ # don't evaluate context functions
+ args = [x.as_const(eval_ctx) for x in self.args]
+ if isinstance(obj, _context_function_types):
+ if getattr(obj, 'contextfunction', False):
+ raise Impossible()
+ elif getattr(obj, 'evalcontextfunction', False):
+ args.insert(0, eval_ctx)
+ elif getattr(obj, 'environmentfunction', False):
+ args.insert(0, self.environment)
+
+ kwargs = dict(x.as_const(eval_ctx) for x in self.kwargs)
+ if self.dyn_args is not None:
+ try:
+ args.extend(self.dyn_args.as_const(eval_ctx))
+ except Exception:
+ raise Impossible()
+ if self.dyn_kwargs is not None:
+ try:
+ kwargs.update(self.dyn_kwargs.as_const(eval_ctx))
+ except Exception:
+ raise Impossible()
+ try:
+ return obj(*args, **kwargs)
+ except Exception:
+ raise Impossible()
+
+
+class Getitem(Expr):
+ """Get an attribute or item from an expression and prefer the item."""
+ fields = ('node', 'arg', 'ctx')
+
+ def as_const(self, eval_ctx=None):
+ eval_ctx = get_eval_context(self, eval_ctx)
+ if self.ctx != 'load':
+ raise Impossible()
+ try:
+ return self.environment.getitem(self.node.as_const(eval_ctx),
+ self.arg.as_const(eval_ctx))
+ except Exception:
+ raise Impossible()
+
+ def can_assign(self):
+ return False
+
+
+class Getattr(Expr):
+ """Get an attribute or item from an expression that is a ascii-only
+ bytestring and prefer the attribute.
+ """
+ fields = ('node', 'attr', 'ctx')
+
+ def as_const(self, eval_ctx=None):
+ if self.ctx != 'load':
+ raise Impossible()
+ try:
+ eval_ctx = get_eval_context(self, eval_ctx)
+ return self.environment.getattr(self.node.as_const(eval_ctx),
+ self.attr)
+ except Exception:
+ raise Impossible()
+
+ def can_assign(self):
+ return False
+
+
+class Slice(Expr):
+ """Represents a slice object. This must only be used as argument for
+ :class:`Subscript`.
+ """
+ fields = ('start', 'stop', 'step')
+
+ def as_const(self, eval_ctx=None):
+ eval_ctx = get_eval_context(self, eval_ctx)
+ def const(obj):
+ if obj is None:
+ return None
+ return obj.as_const(eval_ctx)
+ return slice(const(self.start), const(self.stop), const(self.step))
+
+
+class Concat(Expr):
+ """Concatenates the list of expressions provided after converting them to
+ unicode.
+ """
+ fields = ('nodes',)
+
+ def as_const(self, eval_ctx=None):
+ eval_ctx = get_eval_context(self, eval_ctx)
+ return ''.join(text_type(x.as_const(eval_ctx)) for x in self.nodes)
+
+
+class Compare(Expr):
+ """Compares an expression with some other expressions. `ops` must be a
+ list of :class:`Operand`\s.
+ """
+ fields = ('expr', 'ops')
+
+ def as_const(self, eval_ctx=None):
+ eval_ctx = get_eval_context(self, eval_ctx)
+ result = value = self.expr.as_const(eval_ctx)
+ try:
+ for op in self.ops:
+ new_value = op.expr.as_const(eval_ctx)
+ result = _cmpop_to_func[op.op](value, new_value)
+ value = new_value
+ except Exception:
+ raise Impossible()
+ return result
+
+
+class Operand(Helper):
+ """Holds an operator and an expression."""
+ fields = ('op', 'expr')
+
+if __debug__:
+ Operand.__doc__ += '\nThe following operators are available: ' + \
+ ', '.join(sorted('``%s``' % x for x in set(_binop_to_func) |
+ set(_uaop_to_func) | set(_cmpop_to_func)))
+
+
+class Mul(BinExpr):
+ """Multiplies the left with the right node."""
+ operator = '*'
+
+
+class Div(BinExpr):
+ """Divides the left by the right node."""
+ operator = '/'
+
+
+class FloorDiv(BinExpr):
+ """Divides the left by the right node and truncates conver the
+ result into an integer by truncating.
+ """
+ operator = '//'
+
+
+class Add(BinExpr):
+ """Add the left to the right node."""
+ operator = '+'
+
+
+class Sub(BinExpr):
+ """Subtract the right from the left node."""
+ operator = '-'
+
+
+class Mod(BinExpr):
+ """Left modulo right."""
+ operator = '%'
+
+
+class Pow(BinExpr):
+ """Left to the power of right."""
+ operator = '**'
+
+
+class And(BinExpr):
+ """Short circuited AND."""
+ operator = 'and'
+
+ def as_const(self, eval_ctx=None):
+ eval_ctx = get_eval_context(self, eval_ctx)
+ return self.left.as_const(eval_ctx) and self.right.as_const(eval_ctx)
+
+
+class Or(BinExpr):
+ """Short circuited OR."""
+ operator = 'or'
+
+ def as_const(self, eval_ctx=None):
+ eval_ctx = get_eval_context(self, eval_ctx)
+ return self.left.as_const(eval_ctx) or self.right.as_const(eval_ctx)
+
+
+class Not(UnaryExpr):
+ """Negate the expression."""
+ operator = 'not'
+
+
+class Neg(UnaryExpr):
+ """Make the expression negative."""
+ operator = '-'
+
+
+class Pos(UnaryExpr):
+ """Make the expression positive (noop for most expressions)"""
+ operator = '+'
+
+
+# Helpers for extensions
+
+
+class EnvironmentAttribute(Expr):
+ """Loads an attribute from the environment object. This is useful for
+ extensions that want to call a callback stored on the environment.
+ """
+ fields = ('name',)
+
+
+class ExtensionAttribute(Expr):
+ """Returns the attribute of an extension bound to the environment.
+ The identifier is the identifier of the :class:`Extension`.
+
+ This node is usually constructed by calling the
+ :meth:`~jinja2.ext.Extension.attr` method on an extension.
+ """
+ fields = ('identifier', 'name')
+
+
+class ImportedName(Expr):
+ """If created with an import name the import name is returned on node
+ access. For example ``ImportedName('cgi.escape')`` returns the `escape`
+ function from the cgi module on evaluation. Imports are optimized by the
+ compiler so there is no need to assign them to local variables.
+ """
+ fields = ('importname',)
+
+
+class InternalName(Expr):
+ """An internal name in the compiler. You cannot create these nodes
+ yourself but the parser provides a
+ :meth:`~jinja2.parser.Parser.free_identifier` method that creates
+ a new identifier for you. This identifier is not available from the
+ template and is not threated specially by the compiler.
+ """
+ fields = ('name',)
+
+ def __init__(self):
+ raise TypeError('Can\'t create internal names. Use the '
+ '`free_identifier` method on a parser.')
+
+
+class MarkSafe(Expr):
+ """Mark the wrapped expression as safe (wrap it as `Markup`)."""
+ fields = ('expr',)
+
+ def as_const(self, eval_ctx=None):
+ eval_ctx = get_eval_context(self, eval_ctx)
+ return Markup(self.expr.as_const(eval_ctx))
+
+
+class MarkSafeIfAutoescape(Expr):
+ """Mark the wrapped expression as safe (wrap it as `Markup`) but
+ only if autoescaping is active.
+
+ .. versionadded:: 2.5
+ """
+ fields = ('expr',)
+
+ def as_const(self, eval_ctx=None):
+ eval_ctx = get_eval_context(self, eval_ctx)
+ if eval_ctx.volatile:
+ raise Impossible()
+ expr = self.expr.as_const(eval_ctx)
+ if eval_ctx.autoescape:
+ return Markup(expr)
+ return expr
+
+
+class ContextReference(Expr):
+ """Returns the current template context. It can be used like a
+ :class:`Name` node, with a ``'load'`` ctx and will return the
+ current :class:`~jinja2.runtime.Context` object.
+
+ Here an example that assigns the current template name to a
+ variable named `foo`::
+
+ Assign(Name('foo', ctx='store'),
+ Getattr(ContextReference(), 'name'))
+ """
+
+
+class Continue(Stmt):
+ """Continue a loop."""
+
+
+class Break(Stmt):
+ """Break a loop."""
+
+
+class Scope(Stmt):
+ """An artificial scope."""
+ fields = ('body',)
+
+
+class EvalContextModifier(Stmt):
+ """Modifies the eval context. For each option that should be modified,
+ a :class:`Keyword` has to be added to the :attr:`options` list.
+
+ Example to change the `autoescape` setting::
+
+ EvalContextModifier(options=[Keyword('autoescape', Const(True))])
+ """
+ fields = ('options',)
+
+
+class ScopedEvalContextModifier(EvalContextModifier):
+ """Modifies the eval context and reverts it later. Works exactly like
+ :class:`EvalContextModifier` but will only modify the
+ :class:`~jinja2.nodes.EvalContext` for nodes in the :attr:`body`.
+ """
+ fields = ('body',)
+
+
+# make sure nobody creates custom nodes
+def _failing_new(*args, **kwargs):
+ raise TypeError('can\'t create custom node types')
+NodeType.__new__ = staticmethod(_failing_new); del _failing_new
diff --git a/venv/lib/python2.7/site-packages/Jinja2-2.8-py2.7.egg/jinja2/optimizer.py b/venv/lib/python2.7/site-packages/Jinja2-2.8-py2.7.egg/jinja2/optimizer.py
new file mode 100644
index 000000000..00eab115e
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/Jinja2-2.8-py2.7.egg/jinja2/optimizer.py
@@ -0,0 +1,68 @@
+# -*- coding: utf-8 -*-
+"""
+ jinja2.optimizer
+ ~~~~~~~~~~~~~~~~
+
+ The jinja optimizer is currently trying to constant fold a few expressions
+ and modify the AST in place so that it should be easier to evaluate it.
+
+ Because the AST does not contain all the scoping information and the
+ compiler has to find that out, we cannot do all the optimizations we
+ want. For example loop unrolling doesn't work because unrolled loops would
+ have a different scoping.
+
+ The solution would be a second syntax tree that has the scoping rules stored.
+
+ :copyright: (c) 2010 by the Jinja Team.
+ :license: BSD.
+"""
+from jinja2 import nodes
+from jinja2.visitor import NodeTransformer
+
+
+def optimize(node, environment):
+ """The context hint can be used to perform an static optimization
+ based on the context given."""
+ optimizer = Optimizer(environment)
+ return optimizer.visit(node)
+
+
+class Optimizer(NodeTransformer):
+
+ def __init__(self, environment):
+ self.environment = environment
+
+ def visit_If(self, node):
+ """Eliminate dead code."""
+ # do not optimize ifs that have a block inside so that it doesn't
+ # break super().
+ if node.find(nodes.Block) is not None:
+ return self.generic_visit(node)
+ try:
+ val = self.visit(node.test).as_const()
+ except nodes.Impossible:
+ return self.generic_visit(node)
+ if val:
+ body = node.body
+ else:
+ body = node.else_
+ result = []
+ for node in body:
+ result.extend(self.visit_list(node))
+ return result
+
+ def fold(self, node):
+ """Do constant folding."""
+ node = self.generic_visit(node)
+ try:
+ return nodes.Const.from_untrusted(node.as_const(),
+ lineno=node.lineno,
+ environment=self.environment)
+ except nodes.Impossible:
+ return node
+
+ visit_Add = visit_Sub = visit_Mul = visit_Div = visit_FloorDiv = \
+ visit_Pow = visit_Mod = visit_And = visit_Or = visit_Pos = visit_Neg = \
+ visit_Not = visit_Compare = visit_Getitem = visit_Getattr = visit_Call = \
+ visit_Filter = visit_Test = visit_CondExpr = fold
+ del fold
diff --git a/venv/lib/python2.7/site-packages/Jinja2-2.8-py2.7.egg/jinja2/parser.py b/venv/lib/python2.7/site-packages/Jinja2-2.8-py2.7.egg/jinja2/parser.py
new file mode 100644
index 000000000..d24da180e
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/Jinja2-2.8-py2.7.egg/jinja2/parser.py
@@ -0,0 +1,899 @@
+# -*- coding: utf-8 -*-
+"""
+ jinja2.parser
+ ~~~~~~~~~~~~~
+
+ Implements the template parser.
+
+ :copyright: (c) 2010 by the Jinja Team.
+ :license: BSD, see LICENSE for more details.
+"""
+from jinja2 import nodes
+from jinja2.exceptions import TemplateSyntaxError, TemplateAssertionError
+from jinja2.lexer import describe_token, describe_token_expr
+from jinja2._compat import imap
+
+
+_statement_keywords = frozenset(['for', 'if', 'block', 'extends', 'print',
+ 'macro', 'include', 'from', 'import',
+ 'set'])
+_compare_operators = frozenset(['eq', 'ne', 'lt', 'lteq', 'gt', 'gteq'])
+
+
+class Parser(object):
+ """This is the central parsing class Jinja2 uses. It's passed to
+ extensions and can be used to parse expressions or statements.
+ """
+
+ def __init__(self, environment, source, name=None, filename=None,
+ state=None):
+ self.environment = environment
+ self.stream = environment._tokenize(source, name, filename, state)
+ self.name = name
+ self.filename = filename
+ self.closed = False
+ self.extensions = {}
+ for extension in environment.iter_extensions():
+ for tag in extension.tags:
+ self.extensions[tag] = extension.parse
+ self._last_identifier = 0
+ self._tag_stack = []
+ self._end_token_stack = []
+
+ def fail(self, msg, lineno=None, exc=TemplateSyntaxError):
+ """Convenience method that raises `exc` with the message, passed
+ line number or last line number as well as the current name and
+ filename.
+ """
+ if lineno is None:
+ lineno = self.stream.current.lineno
+ raise exc(msg, lineno, self.name, self.filename)
+
+ def _fail_ut_eof(self, name, end_token_stack, lineno):
+ expected = []
+ for exprs in end_token_stack:
+ expected.extend(imap(describe_token_expr, exprs))
+ if end_token_stack:
+ currently_looking = ' or '.join(
+ "'%s'" % describe_token_expr(expr)
+ for expr in end_token_stack[-1])
+ else:
+ currently_looking = None
+
+ if name is None:
+ message = ['Unexpected end of template.']
+ else:
+ message = ['Encountered unknown tag \'%s\'.' % name]
+
+ if currently_looking:
+ if name is not None and name in expected:
+ message.append('You probably made a nesting mistake. Jinja '
+ 'is expecting this tag, but currently looking '
+ 'for %s.' % currently_looking)
+ else:
+ message.append('Jinja was looking for the following tags: '
+ '%s.' % currently_looking)
+
+ if self._tag_stack:
+ message.append('The innermost block that needs to be '
+ 'closed is \'%s\'.' % self._tag_stack[-1])
+
+ self.fail(' '.join(message), lineno)
+
+ def fail_unknown_tag(self, name, lineno=None):
+ """Called if the parser encounters an unknown tag. Tries to fail
+ with a human readable error message that could help to identify
+ the problem.
+ """
+ return self._fail_ut_eof(name, self._end_token_stack, lineno)
+
+ def fail_eof(self, end_tokens=None, lineno=None):
+ """Like fail_unknown_tag but for end of template situations."""
+ stack = list(self._end_token_stack)
+ if end_tokens is not None:
+ stack.append(end_tokens)
+ return self._fail_ut_eof(None, stack, lineno)
+
+ def is_tuple_end(self, extra_end_rules=None):
+ """Are we at the end of a tuple?"""
+ if self.stream.current.type in ('variable_end', 'block_end', 'rparen'):
+ return True
+ elif extra_end_rules is not None:
+ return self.stream.current.test_any(extra_end_rules)
+ return False
+
+ def free_identifier(self, lineno=None):
+ """Return a new free identifier as :class:`~jinja2.nodes.InternalName`."""
+ self._last_identifier += 1
+ rv = object.__new__(nodes.InternalName)
+ nodes.Node.__init__(rv, 'fi%d' % self._last_identifier, lineno=lineno)
+ return rv
+
+ def parse_statement(self):
+ """Parse a single statement."""
+ token = self.stream.current
+ if token.type != 'name':
+ self.fail('tag name expected', token.lineno)
+ self._tag_stack.append(token.value)
+ pop_tag = True
+ try:
+ if token.value in _statement_keywords:
+ return getattr(self, 'parse_' + self.stream.current.value)()
+ if token.value == 'call':
+ return self.parse_call_block()
+ if token.value == 'filter':
+ return self.parse_filter_block()
+ ext = self.extensions.get(token.value)
+ if ext is not None:
+ return ext(self)
+
+ # did not work out, remove the token we pushed by accident
+ # from the stack so that the unknown tag fail function can
+ # produce a proper error message.
+ self._tag_stack.pop()
+ pop_tag = False
+ self.fail_unknown_tag(token.value, token.lineno)
+ finally:
+ if pop_tag:
+ self._tag_stack.pop()
+
+ def parse_statements(self, end_tokens, drop_needle=False):
+ """Parse multiple statements into a list until one of the end tokens
+ is reached. This is used to parse the body of statements as it also
+ parses template data if appropriate. The parser checks first if the
+ current token is a colon and skips it if there is one. Then it checks
+ for the block end and parses until if one of the `end_tokens` is
+ reached. Per default the active token in the stream at the end of
+ the call is the matched end token. If this is not wanted `drop_needle`
+ can be set to `True` and the end token is removed.
+ """
+ # the first token may be a colon for python compatibility
+ self.stream.skip_if('colon')
+
+ # in the future it would be possible to add whole code sections
+ # by adding some sort of end of statement token and parsing those here.
+ self.stream.expect('block_end')
+ result = self.subparse(end_tokens)
+
+ # we reached the end of the template too early, the subparser
+ # does not check for this, so we do that now
+ if self.stream.current.type == 'eof':
+ self.fail_eof(end_tokens)
+
+ if drop_needle:
+ next(self.stream)
+ return result
+
+ def parse_set(self):
+ """Parse an assign statement."""
+ lineno = next(self.stream).lineno
+ target = self.parse_assign_target()
+ if self.stream.skip_if('assign'):
+ expr = self.parse_tuple()
+ return nodes.Assign(target, expr, lineno=lineno)
+ body = self.parse_statements(('name:endset',),
+ drop_needle=True)
+ return nodes.AssignBlock(target, body, lineno=lineno)
+
+ def parse_for(self):
+ """Parse a for loop."""
+ lineno = self.stream.expect('name:for').lineno
+ target = self.parse_assign_target(extra_end_rules=('name:in',))
+ self.stream.expect('name:in')
+ iter = self.parse_tuple(with_condexpr=False,
+ extra_end_rules=('name:recursive',))
+ test = None
+ if self.stream.skip_if('name:if'):
+ test = self.parse_expression()
+ recursive = self.stream.skip_if('name:recursive')
+ body = self.parse_statements(('name:endfor', 'name:else'))
+ if next(self.stream).value == 'endfor':
+ else_ = []
+ else:
+ else_ = self.parse_statements(('name:endfor',), drop_needle=True)
+ return nodes.For(target, iter, body, else_, test,
+ recursive, lineno=lineno)
+
+ def parse_if(self):
+ """Parse an if construct."""
+ node = result = nodes.If(lineno=self.stream.expect('name:if').lineno)
+ while 1:
+ node.test = self.parse_tuple(with_condexpr=False)
+ node.body = self.parse_statements(('name:elif', 'name:else',
+ 'name:endif'))
+ token = next(self.stream)
+ if token.test('name:elif'):
+ new_node = nodes.If(lineno=self.stream.current.lineno)
+ node.else_ = [new_node]
+ node = new_node
+ continue
+ elif token.test('name:else'):
+ node.else_ = self.parse_statements(('name:endif',),
+ drop_needle=True)
+ else:
+ node.else_ = []
+ break
+ return result
+
+ def parse_block(self):
+ node = nodes.Block(lineno=next(self.stream).lineno)
+ node.name = self.stream.expect('name').value
+ node.scoped = self.stream.skip_if('name:scoped')
+
+ # common problem people encounter when switching from django
+ # to jinja. we do not support hyphens in block names, so let's
+ # raise a nicer error message in that case.
+ if self.stream.current.type == 'sub':
+ self.fail('Block names in Jinja have to be valid Python '
+ 'identifiers and may not contain hyphens, use an '
+ 'underscore instead.')
+
+ node.body = self.parse_statements(('name:endblock',), drop_needle=True)
+ self.stream.skip_if('name:' + node.name)
+ return node
+
+ def parse_extends(self):
+ node = nodes.Extends(lineno=next(self.stream).lineno)
+ node.template = self.parse_expression()
+ return node
+
+ def parse_import_context(self, node, default):
+ if self.stream.current.test_any('name:with', 'name:without') and \
+ self.stream.look().test('name:context'):
+ node.with_context = next(self.stream).value == 'with'
+ self.stream.skip()
+ else:
+ node.with_context = default
+ return node
+
+ def parse_include(self):
+ node = nodes.Include(lineno=next(self.stream).lineno)
+ node.template = self.parse_expression()
+ if self.stream.current.test('name:ignore') and \
+ self.stream.look().test('name:missing'):
+ node.ignore_missing = True
+ self.stream.skip(2)
+ else:
+ node.ignore_missing = False
+ return self.parse_import_context(node, True)
+
+ def parse_import(self):
+ node = nodes.Import(lineno=next(self.stream).lineno)
+ node.template = self.parse_expression()
+ self.stream.expect('name:as')
+ node.target = self.parse_assign_target(name_only=True).name
+ return self.parse_import_context(node, False)
+
+ def parse_from(self):
+ node = nodes.FromImport(lineno=next(self.stream).lineno)
+ node.template = self.parse_expression()
+ self.stream.expect('name:import')
+ node.names = []
+
+ def parse_context():
+ if self.stream.current.value in ('with', 'without') and \
+ self.stream.look().test('name:context'):
+ node.with_context = next(self.stream).value == 'with'
+ self.stream.skip()
+ return True
+ return False
+
+ while 1:
+ if node.names:
+ self.stream.expect('comma')
+ if self.stream.current.type == 'name':
+ if parse_context():
+ break
+ target = self.parse_assign_target(name_only=True)
+ if target.name.startswith('_'):
+ self.fail('names starting with an underline can not '
+ 'be imported', target.lineno,
+ exc=TemplateAssertionError)
+ if self.stream.skip_if('name:as'):
+ alias = self.parse_assign_target(name_only=True)
+ node.names.append((target.name, alias.name))
+ else:
+ node.names.append(target.name)
+ if parse_context() or self.stream.current.type != 'comma':
+ break
+ else:
+ break
+ if not hasattr(node, 'with_context'):
+ node.with_context = False
+ self.stream.skip_if('comma')
+ return node
+
+ def parse_signature(self, node):
+ node.args = args = []
+ node.defaults = defaults = []
+ self.stream.expect('lparen')
+ while self.stream.current.type != 'rparen':
+ if args:
+ self.stream.expect('comma')
+ arg = self.parse_assign_target(name_only=True)
+ arg.set_ctx('param')
+ if self.stream.skip_if('assign'):
+ defaults.append(self.parse_expression())
+ elif defaults:
+ self.fail('non-default argument follows default argument')
+ args.append(arg)
+ self.stream.expect('rparen')
+
+ def parse_call_block(self):
+ node = nodes.CallBlock(lineno=next(self.stream).lineno)
+ if self.stream.current.type == 'lparen':
+ self.parse_signature(node)
+ else:
+ node.args = []
+ node.defaults = []
+
+ node.call = self.parse_expression()
+ if not isinstance(node.call, nodes.Call):
+ self.fail('expected call', node.lineno)
+ node.body = self.parse_statements(('name:endcall',), drop_needle=True)
+ return node
+
+ def parse_filter_block(self):
+ node = nodes.FilterBlock(lineno=next(self.stream).lineno)
+ node.filter = self.parse_filter(None, start_inline=True)
+ node.body = self.parse_statements(('name:endfilter',),
+ drop_needle=True)
+ return node
+
+ def parse_macro(self):
+ node = nodes.Macro(lineno=next(self.stream).lineno)
+ node.name = self.parse_assign_target(name_only=True).name
+ self.parse_signature(node)
+ node.body = self.parse_statements(('name:endmacro',),
+ drop_needle=True)
+ return node
+
+ def parse_print(self):
+ node = nodes.Output(lineno=next(self.stream).lineno)
+ node.nodes = []
+ while self.stream.current.type != 'block_end':
+ if node.nodes:
+ self.stream.expect('comma')
+ node.nodes.append(self.parse_expression())
+ return node
+
+ def parse_assign_target(self, with_tuple=True, name_only=False,
+ extra_end_rules=None):
+ """Parse an assignment target. As Jinja2 allows assignments to
+ tuples, this function can parse all allowed assignment targets. Per
+ default assignments to tuples are parsed, that can be disable however
+ by setting `with_tuple` to `False`. If only assignments to names are
+ wanted `name_only` can be set to `True`. The `extra_end_rules`
+ parameter is forwarded to the tuple parsing function.
+ """
+ if name_only:
+ token = self.stream.expect('name')
+ target = nodes.Name(token.value, 'store', lineno=token.lineno)
+ else:
+ if with_tuple:
+ target = self.parse_tuple(simplified=True,
+ extra_end_rules=extra_end_rules)
+ else:
+ target = self.parse_primary()
+ target.set_ctx('store')
+ if not target.can_assign():
+ self.fail('can\'t assign to %r' % target.__class__.
+ __name__.lower(), target.lineno)
+ return target
+
+ def parse_expression(self, with_condexpr=True):
+ """Parse an expression. Per default all expressions are parsed, if
+ the optional `with_condexpr` parameter is set to `False` conditional
+ expressions are not parsed.
+ """
+ if with_condexpr:
+ return self.parse_condexpr()
+ return self.parse_or()
+
+ def parse_condexpr(self):
+ lineno = self.stream.current.lineno
+ expr1 = self.parse_or()
+ while self.stream.skip_if('name:if'):
+ expr2 = self.parse_or()
+ if self.stream.skip_if('name:else'):
+ expr3 = self.parse_condexpr()
+ else:
+ expr3 = None
+ expr1 = nodes.CondExpr(expr2, expr1, expr3, lineno=lineno)
+ lineno = self.stream.current.lineno
+ return expr1
+
+ def parse_or(self):
+ lineno = self.stream.current.lineno
+ left = self.parse_and()
+ while self.stream.skip_if('name:or'):
+ right = self.parse_and()
+ left = nodes.Or(left, right, lineno=lineno)
+ lineno = self.stream.current.lineno
+ return left
+
+ def parse_and(self):
+ lineno = self.stream.current.lineno
+ left = self.parse_not()
+ while self.stream.skip_if('name:and'):
+ right = self.parse_not()
+ left = nodes.And(left, right, lineno=lineno)
+ lineno = self.stream.current.lineno
+ return left
+
+ def parse_not(self):
+ if self.stream.current.test('name:not'):
+ lineno = next(self.stream).lineno
+ return nodes.Not(self.parse_not(), lineno=lineno)
+ return self.parse_compare()
+
+ def parse_compare(self):
+ lineno = self.stream.current.lineno
+ expr = self.parse_add()
+ ops = []
+ while 1:
+ token_type = self.stream.current.type
+ if token_type in _compare_operators:
+ next(self.stream)
+ ops.append(nodes.Operand(token_type, self.parse_add()))
+ elif self.stream.skip_if('name:in'):
+ ops.append(nodes.Operand('in', self.parse_add()))
+ elif (self.stream.current.test('name:not') and
+ self.stream.look().test('name:in')):
+ self.stream.skip(2)
+ ops.append(nodes.Operand('notin', self.parse_add()))
+ else:
+ break
+ lineno = self.stream.current.lineno
+ if not ops:
+ return expr
+ return nodes.Compare(expr, ops, lineno=lineno)
+
+ def parse_add(self):
+ lineno = self.stream.current.lineno
+ left = self.parse_sub()
+ while self.stream.current.type == 'add':
+ next(self.stream)
+ right = self.parse_sub()
+ left = nodes.Add(left, right, lineno=lineno)
+ lineno = self.stream.current.lineno
+ return left
+
+ def parse_sub(self):
+ lineno = self.stream.current.lineno
+ left = self.parse_concat()
+ while self.stream.current.type == 'sub':
+ next(self.stream)
+ right = self.parse_concat()
+ left = nodes.Sub(left, right, lineno=lineno)
+ lineno = self.stream.current.lineno
+ return left
+
+ def parse_concat(self):
+ lineno = self.stream.current.lineno
+ args = [self.parse_mul()]
+ while self.stream.current.type == 'tilde':
+ next(self.stream)
+ args.append(self.parse_mul())
+ if len(args) == 1:
+ return args[0]
+ return nodes.Concat(args, lineno=lineno)
+
+ def parse_mul(self):
+ lineno = self.stream.current.lineno
+ left = self.parse_div()
+ while self.stream.current.type == 'mul':
+ next(self.stream)
+ right = self.parse_div()
+ left = nodes.Mul(left, right, lineno=lineno)
+ lineno = self.stream.current.lineno
+ return left
+
+ def parse_div(self):
+ lineno = self.stream.current.lineno
+ left = self.parse_floordiv()
+ while self.stream.current.type == 'div':
+ next(self.stream)
+ right = self.parse_floordiv()
+ left = nodes.Div(left, right, lineno=lineno)
+ lineno = self.stream.current.lineno
+ return left
+
+ def parse_floordiv(self):
+ lineno = self.stream.current.lineno
+ left = self.parse_mod()
+ while self.stream.current.type == 'floordiv':
+ next(self.stream)
+ right = self.parse_mod()
+ left = nodes.FloorDiv(left, right, lineno=lineno)
+ lineno = self.stream.current.lineno
+ return left
+
+ def parse_mod(self):
+ lineno = self.stream.current.lineno
+ left = self.parse_pow()
+ while self.stream.current.type == 'mod':
+ next(self.stream)
+ right = self.parse_pow()
+ left = nodes.Mod(left, right, lineno=lineno)
+ lineno = self.stream.current.lineno
+ return left
+
+ def parse_pow(self):
+ lineno = self.stream.current.lineno
+ left = self.parse_unary()
+ while self.stream.current.type == 'pow':
+ next(self.stream)
+ right = self.parse_unary()
+ left = nodes.Pow(left, right, lineno=lineno)
+ lineno = self.stream.current.lineno
+ return left
+
+ def parse_unary(self, with_filter=True):
+ token_type = self.stream.current.type
+ lineno = self.stream.current.lineno
+ if token_type == 'sub':
+ next(self.stream)
+ node = nodes.Neg(self.parse_unary(False), lineno=lineno)
+ elif token_type == 'add':
+ next(self.stream)
+ node = nodes.Pos(self.parse_unary(False), lineno=lineno)
+ else:
+ node = self.parse_primary()
+ node = self.parse_postfix(node)
+ if with_filter:
+ node = self.parse_filter_expr(node)
+ return node
+
+ def parse_primary(self):
+ token = self.stream.current
+ if token.type == 'name':
+ if token.value in ('true', 'false', 'True', 'False'):
+ node = nodes.Const(token.value in ('true', 'True'),
+ lineno=token.lineno)
+ elif token.value in ('none', 'None'):
+ node = nodes.Const(None, lineno=token.lineno)
+ else:
+ node = nodes.Name(token.value, 'load', lineno=token.lineno)
+ next(self.stream)
+ elif token.type == 'string':
+ next(self.stream)
+ buf = [token.value]
+ lineno = token.lineno
+ while self.stream.current.type == 'string':
+ buf.append(self.stream.current.value)
+ next(self.stream)
+ node = nodes.Const(''.join(buf), lineno=lineno)
+ elif token.type in ('integer', 'float'):
+ next(self.stream)
+ node = nodes.Const(token.value, lineno=token.lineno)
+ elif token.type == 'lparen':
+ next(self.stream)
+ node = self.parse_tuple(explicit_parentheses=True)
+ self.stream.expect('rparen')
+ elif token.type == 'lbracket':
+ node = self.parse_list()
+ elif token.type == 'lbrace':
+ node = self.parse_dict()
+ else:
+ self.fail("unexpected '%s'" % describe_token(token), token.lineno)
+ return node
+
+ def parse_tuple(self, simplified=False, with_condexpr=True,
+ extra_end_rules=None, explicit_parentheses=False):
+ """Works like `parse_expression` but if multiple expressions are
+ delimited by a comma a :class:`~jinja2.nodes.Tuple` node is created.
+ This method could also return a regular expression instead of a tuple
+ if no commas where found.
+
+ The default parsing mode is a full tuple. If `simplified` is `True`
+ only names and literals are parsed. The `no_condexpr` parameter is
+ forwarded to :meth:`parse_expression`.
+
+ Because tuples do not require delimiters and may end in a bogus comma
+ an extra hint is needed that marks the end of a tuple. For example
+ for loops support tuples between `for` and `in`. In that case the
+ `extra_end_rules` is set to ``['name:in']``.
+
+ `explicit_parentheses` is true if the parsing was triggered by an
+ expression in parentheses. This is used to figure out if an empty
+ tuple is a valid expression or not.
+ """
+ lineno = self.stream.current.lineno
+ if simplified:
+ parse = self.parse_primary
+ elif with_condexpr:
+ parse = self.parse_expression
+ else:
+ parse = lambda: self.parse_expression(with_condexpr=False)
+ args = []
+ is_tuple = False
+ while 1:
+ if args:
+ self.stream.expect('comma')
+ if self.is_tuple_end(extra_end_rules):
+ break
+ args.append(parse())
+ if self.stream.current.type == 'comma':
+ is_tuple = True
+ else:
+ break
+ lineno = self.stream.current.lineno
+
+ if not is_tuple:
+ if args:
+ return args[0]
+
+ # if we don't have explicit parentheses, an empty tuple is
+ # not a valid expression. This would mean nothing (literally
+ # nothing) in the spot of an expression would be an empty
+ # tuple.
+ if not explicit_parentheses:
+ self.fail('Expected an expression, got \'%s\'' %
+ describe_token(self.stream.current))
+
+ return nodes.Tuple(args, 'load', lineno=lineno)
+
+ def parse_list(self):
+ token = self.stream.expect('lbracket')
+ items = []
+ while self.stream.current.type != 'rbracket':
+ if items:
+ self.stream.expect('comma')
+ if self.stream.current.type == 'rbracket':
+ break
+ items.append(self.parse_expression())
+ self.stream.expect('rbracket')
+ return nodes.List(items, lineno=token.lineno)
+
+ def parse_dict(self):
+ token = self.stream.expect('lbrace')
+ items = []
+ while self.stream.current.type != 'rbrace':
+ if items:
+ self.stream.expect('comma')
+ if self.stream.current.type == 'rbrace':
+ break
+ key = self.parse_expression()
+ self.stream.expect('colon')
+ value = self.parse_expression()
+ items.append(nodes.Pair(key, value, lineno=key.lineno))
+ self.stream.expect('rbrace')
+ return nodes.Dict(items, lineno=token.lineno)
+
+ def parse_postfix(self, node):
+ while 1:
+ token_type = self.stream.current.type
+ if token_type == 'dot' or token_type == 'lbracket':
+ node = self.parse_subscript(node)
+ # calls are valid both after postfix expressions (getattr
+ # and getitem) as well as filters and tests
+ elif token_type == 'lparen':
+ node = self.parse_call(node)
+ else:
+ break
+ return node
+
+ def parse_filter_expr(self, node):
+ while 1:
+ token_type = self.stream.current.type
+ if token_type == 'pipe':
+ node = self.parse_filter(node)
+ elif token_type == 'name' and self.stream.current.value == 'is':
+ node = self.parse_test(node)
+ # calls are valid both after postfix expressions (getattr
+ # and getitem) as well as filters and tests
+ elif token_type == 'lparen':
+ node = self.parse_call(node)
+ else:
+ break
+ return node
+
+ def parse_subscript(self, node):
+ token = next(self.stream)
+ if token.type == 'dot':
+ attr_token = self.stream.current
+ next(self.stream)
+ if attr_token.type == 'name':
+ return nodes.Getattr(node, attr_token.value, 'load',
+ lineno=token.lineno)
+ elif attr_token.type != 'integer':
+ self.fail('expected name or number', attr_token.lineno)
+ arg = nodes.Const(attr_token.value, lineno=attr_token.lineno)
+ return nodes.Getitem(node, arg, 'load', lineno=token.lineno)
+ if token.type == 'lbracket':
+ args = []
+ while self.stream.current.type != 'rbracket':
+ if args:
+ self.stream.expect('comma')
+ args.append(self.parse_subscribed())
+ self.stream.expect('rbracket')
+ if len(args) == 1:
+ arg = args[0]
+ else:
+ arg = nodes.Tuple(args, 'load', lineno=token.lineno)
+ return nodes.Getitem(node, arg, 'load', lineno=token.lineno)
+ self.fail('expected subscript expression', self.lineno)
+
+ def parse_subscribed(self):
+ lineno = self.stream.current.lineno
+
+ if self.stream.current.type == 'colon':
+ next(self.stream)
+ args = [None]
+ else:
+ node = self.parse_expression()
+ if self.stream.current.type != 'colon':
+ return node
+ next(self.stream)
+ args = [node]
+
+ if self.stream.current.type == 'colon':
+ args.append(None)
+ elif self.stream.current.type not in ('rbracket', 'comma'):
+ args.append(self.parse_expression())
+ else:
+ args.append(None)
+
+ if self.stream.current.type == 'colon':
+ next(self.stream)
+ if self.stream.current.type not in ('rbracket', 'comma'):
+ args.append(self.parse_expression())
+ else:
+ args.append(None)
+ else:
+ args.append(None)
+
+ return nodes.Slice(lineno=lineno, *args)
+
+ def parse_call(self, node):
+ token = self.stream.expect('lparen')
+ args = []
+ kwargs = []
+ dyn_args = dyn_kwargs = None
+ require_comma = False
+
+ def ensure(expr):
+ if not expr:
+ self.fail('invalid syntax for function call expression',
+ token.lineno)
+
+ while self.stream.current.type != 'rparen':
+ if require_comma:
+ self.stream.expect('comma')
+ # support for trailing comma
+ if self.stream.current.type == 'rparen':
+ break
+ if self.stream.current.type == 'mul':
+ ensure(dyn_args is None and dyn_kwargs is None)
+ next(self.stream)
+ dyn_args = self.parse_expression()
+ elif self.stream.current.type == 'pow':
+ ensure(dyn_kwargs is None)
+ next(self.stream)
+ dyn_kwargs = self.parse_expression()
+ else:
+ ensure(dyn_args is None and dyn_kwargs is None)
+ if self.stream.current.type == 'name' and \
+ self.stream.look().type == 'assign':
+ key = self.stream.current.value
+ self.stream.skip(2)
+ value = self.parse_expression()
+ kwargs.append(nodes.Keyword(key, value,
+ lineno=value.lineno))
+ else:
+ ensure(not kwargs)
+ args.append(self.parse_expression())
+
+ require_comma = True
+ self.stream.expect('rparen')
+
+ if node is None:
+ return args, kwargs, dyn_args, dyn_kwargs
+ return nodes.Call(node, args, kwargs, dyn_args, dyn_kwargs,
+ lineno=token.lineno)
+
+ def parse_filter(self, node, start_inline=False):
+ while self.stream.current.type == 'pipe' or start_inline:
+ if not start_inline:
+ next(self.stream)
+ token = self.stream.expect('name')
+ name = token.value
+ while self.stream.current.type == 'dot':
+ next(self.stream)
+ name += '.' + self.stream.expect('name').value
+ if self.stream.current.type == 'lparen':
+ args, kwargs, dyn_args, dyn_kwargs = self.parse_call(None)
+ else:
+ args = []
+ kwargs = []
+ dyn_args = dyn_kwargs = None
+ node = nodes.Filter(node, name, args, kwargs, dyn_args,
+ dyn_kwargs, lineno=token.lineno)
+ start_inline = False
+ return node
+
+ def parse_test(self, node):
+ token = next(self.stream)
+ if self.stream.current.test('name:not'):
+ next(self.stream)
+ negated = True
+ else:
+ negated = False
+ name = self.stream.expect('name').value
+ while self.stream.current.type == 'dot':
+ next(self.stream)
+ name += '.' + self.stream.expect('name').value
+ dyn_args = dyn_kwargs = None
+ kwargs = []
+ if self.stream.current.type == 'lparen':
+ args, kwargs, dyn_args, dyn_kwargs = self.parse_call(None)
+ elif (self.stream.current.type in ('name', 'string', 'integer',
+ 'float', 'lparen', 'lbracket',
+ 'lbrace') and not
+ self.stream.current.test_any('name:else', 'name:or',
+ 'name:and')):
+ if self.stream.current.test('name:is'):
+ self.fail('You cannot chain multiple tests with is')
+ args = [self.parse_expression()]
+ else:
+ args = []
+ node = nodes.Test(node, name, args, kwargs, dyn_args,
+ dyn_kwargs, lineno=token.lineno)
+ if negated:
+ node = nodes.Not(node, lineno=token.lineno)
+ return node
+
+ def subparse(self, end_tokens=None):
+ body = []
+ data_buffer = []
+ add_data = data_buffer.append
+
+ if end_tokens is not None:
+ self._end_token_stack.append(end_tokens)
+
+ def flush_data():
+ if data_buffer:
+ lineno = data_buffer[0].lineno
+ body.append(nodes.Output(data_buffer[:], lineno=lineno))
+ del data_buffer[:]
+
+ try:
+ while self.stream:
+ token = self.stream.current
+ if token.type == 'data':
+ if token.value:
+ add_data(nodes.TemplateData(token.value,
+ lineno=token.lineno))
+ next(self.stream)
+ elif token.type == 'variable_begin':
+ next(self.stream)
+ add_data(self.parse_tuple(with_condexpr=True))
+ self.stream.expect('variable_end')
+ elif token.type == 'block_begin':
+ flush_data()
+ next(self.stream)
+ if end_tokens is not None and \
+ self.stream.current.test_any(*end_tokens):
+ return body
+ rv = self.parse_statement()
+ if isinstance(rv, list):
+ body.extend(rv)
+ else:
+ body.append(rv)
+ self.stream.expect('block_end')
+ else:
+ raise AssertionError('internal parsing error')
+
+ flush_data()
+ finally:
+ if end_tokens is not None:
+ self._end_token_stack.pop()
+
+ return body
+
+ def parse(self):
+ """Parse the whole template into a `Template` node."""
+ result = nodes.Template(self.subparse(), lineno=1)
+ result.set_environment(self.environment)
+ return result
diff --git a/venv/lib/python2.7/site-packages/Jinja2-2.8-py2.7.egg/jinja2/runtime.py b/venv/lib/python2.7/site-packages/Jinja2-2.8-py2.7.egg/jinja2/runtime.py
new file mode 100644
index 000000000..685a12da0
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/Jinja2-2.8-py2.7.egg/jinja2/runtime.py
@@ -0,0 +1,667 @@
+# -*- coding: utf-8 -*-
+"""
+ jinja2.runtime
+ ~~~~~~~~~~~~~~
+
+ Runtime helpers.
+
+ :copyright: (c) 2010 by the Jinja Team.
+ :license: BSD.
+"""
+import sys
+
+from itertools import chain
+from jinja2.nodes import EvalContext, _context_function_types
+from jinja2.utils import Markup, soft_unicode, escape, missing, concat, \
+ internalcode, object_type_repr
+from jinja2.exceptions import UndefinedError, TemplateRuntimeError, \
+ TemplateNotFound
+from jinja2._compat import imap, text_type, iteritems, \
+ implements_iterator, implements_to_string, string_types, PY2
+
+
+# these variables are exported to the template runtime
+__all__ = ['LoopContext', 'TemplateReference', 'Macro', 'Markup',
+ 'TemplateRuntimeError', 'missing', 'concat', 'escape',
+ 'markup_join', 'unicode_join', 'to_string', 'identity',
+ 'TemplateNotFound', 'make_logging_undefined']
+
+#: the name of the function that is used to convert something into
+#: a string. We can just use the text type here.
+to_string = text_type
+
+#: the identity function. Useful for certain things in the environment
+identity = lambda x: x
+
+_last_iteration = object()
+
+
+def markup_join(seq):
+ """Concatenation that escapes if necessary and converts to unicode."""
+ buf = []
+ iterator = imap(soft_unicode, seq)
+ for arg in iterator:
+ buf.append(arg)
+ if hasattr(arg, '__html__'):
+ return Markup(u'').join(chain(buf, iterator))
+ return concat(buf)
+
+
+def unicode_join(seq):
+ """Simple args to unicode conversion and concatenation."""
+ return concat(imap(text_type, seq))
+
+
+def new_context(environment, template_name, blocks, vars=None,
+ shared=None, globals=None, locals=None):
+ """Internal helper to for context creation."""
+ if vars is None:
+ vars = {}
+ if shared:
+ parent = vars
+ else:
+ parent = dict(globals or (), **vars)
+ if locals:
+ # if the parent is shared a copy should be created because
+ # we don't want to modify the dict passed
+ if shared:
+ parent = dict(parent)
+ for key, value in iteritems(locals):
+ if key[:2] == 'l_' and value is not missing:
+ parent[key[2:]] = value
+ return environment.context_class(environment, parent, template_name,
+ blocks)
+
+
+class TemplateReference(object):
+ """The `self` in templates."""
+
+ def __init__(self, context):
+ self.__context = context
+
+ def __getitem__(self, name):
+ blocks = self.__context.blocks[name]
+ return BlockReference(name, self.__context, blocks, 0)
+
+ def __repr__(self):
+ return '<%s %r>' % (
+ self.__class__.__name__,
+ self.__context.name
+ )
+
+
+class Context(object):
+ """The template context holds the variables of a template. It stores the
+ values passed to the template and also the names the template exports.
+ Creating instances is neither supported nor useful as it's created
+ automatically at various stages of the template evaluation and should not
+ be created by hand.
+
+ The context is immutable. Modifications on :attr:`parent` **must not**
+ happen and modifications on :attr:`vars` are allowed from generated
+ template code only. Template filters and global functions marked as
+ :func:`contextfunction`\s get the active context passed as first argument
+ and are allowed to access the context read-only.
+
+ The template context supports read only dict operations (`get`,
+ `keys`, `values`, `items`, `iterkeys`, `itervalues`, `iteritems`,
+ `__getitem__`, `__contains__`). Additionally there is a :meth:`resolve`
+ method that doesn't fail with a `KeyError` but returns an
+ :class:`Undefined` object for missing variables.
+ """
+ __slots__ = ('parent', 'vars', 'environment', 'eval_ctx', 'exported_vars',
+ 'name', 'blocks', '__weakref__')
+
+ def __init__(self, environment, parent, name, blocks):
+ self.parent = parent
+ self.vars = {}
+ self.environment = environment
+ self.eval_ctx = EvalContext(self.environment, name)
+ self.exported_vars = set()
+ self.name = name
+
+ # create the initial mapping of blocks. Whenever template inheritance
+ # takes place the runtime will update this mapping with the new blocks
+ # from the template.
+ self.blocks = dict((k, [v]) for k, v in iteritems(blocks))
+
+ def super(self, name, current):
+ """Render a parent block."""
+ try:
+ blocks = self.blocks[name]
+ index = blocks.index(current) + 1
+ blocks[index]
+ except LookupError:
+ return self.environment.undefined('there is no parent block '
+ 'called %r.' % name,
+ name='super')
+ return BlockReference(name, self, blocks, index)
+
+ def get(self, key, default=None):
+ """Returns an item from the template context, if it doesn't exist
+ `default` is returned.
+ """
+ try:
+ return self[key]
+ except KeyError:
+ return default
+
+ def resolve(self, key):
+ """Looks up a variable like `__getitem__` or `get` but returns an
+ :class:`Undefined` object with the name of the name looked up.
+ """
+ if key in self.vars:
+ return self.vars[key]
+ if key in self.parent:
+ return self.parent[key]
+ return self.environment.undefined(name=key)
+
+ def get_exported(self):
+ """Get a new dict with the exported variables."""
+ return dict((k, self.vars[k]) for k in self.exported_vars)
+
+ def get_all(self):
+ """Return a copy of the complete context as dict including the
+ exported variables.
+ """
+ return dict(self.parent, **self.vars)
+
+ @internalcode
+ def call(__self, __obj, *args, **kwargs):
+ """Call the callable with the arguments and keyword arguments
+ provided but inject the active context or environment as first
+ argument if the callable is a :func:`contextfunction` or
+ :func:`environmentfunction`.
+ """
+ if __debug__:
+ __traceback_hide__ = True # noqa
+
+ # Allow callable classes to take a context
+ fn = __obj.__call__
+ for fn_type in ('contextfunction',
+ 'evalcontextfunction',
+ 'environmentfunction'):
+ if hasattr(fn, fn_type):
+ __obj = fn
+ break
+
+ if isinstance(__obj, _context_function_types):
+ if getattr(__obj, 'contextfunction', 0):
+ args = (__self,) + args
+ elif getattr(__obj, 'evalcontextfunction', 0):
+ args = (__self.eval_ctx,) + args
+ elif getattr(__obj, 'environmentfunction', 0):
+ args = (__self.environment,) + args
+ try:
+ return __obj(*args, **kwargs)
+ except StopIteration:
+ return __self.environment.undefined('value was undefined because '
+ 'a callable raised a '
+ 'StopIteration exception')
+
+ def derived(self, locals=None):
+ """Internal helper function to create a derived context."""
+ context = new_context(self.environment, self.name, {},
+ self.parent, True, None, locals)
+ context.vars.update(self.vars)
+ context.eval_ctx = self.eval_ctx
+ context.blocks.update((k, list(v)) for k, v in iteritems(self.blocks))
+ return context
+
+ def _all(meth):
+ proxy = lambda self: getattr(self.get_all(), meth)()
+ proxy.__doc__ = getattr(dict, meth).__doc__
+ proxy.__name__ = meth
+ return proxy
+
+ keys = _all('keys')
+ values = _all('values')
+ items = _all('items')
+
+ # not available on python 3
+ if PY2:
+ iterkeys = _all('iterkeys')
+ itervalues = _all('itervalues')
+ iteritems = _all('iteritems')
+ del _all
+
+ def __contains__(self, name):
+ return name in self.vars or name in self.parent
+
+ def __getitem__(self, key):
+ """Lookup a variable or raise `KeyError` if the variable is
+ undefined.
+ """
+ item = self.resolve(key)
+ if isinstance(item, Undefined):
+ raise KeyError(key)
+ return item
+
+ def __repr__(self):
+ return '<%s %s of %r>' % (
+ self.__class__.__name__,
+ repr(self.get_all()),
+ self.name
+ )
+
+
+# register the context as mapping if possible
+try:
+ from collections import Mapping
+ Mapping.register(Context)
+except ImportError:
+ pass
+
+
+class BlockReference(object):
+ """One block on a template reference."""
+
+ def __init__(self, name, context, stack, depth):
+ self.name = name
+ self._context = context
+ self._stack = stack
+ self._depth = depth
+
+ @property
+ def super(self):
+ """Super the block."""
+ if self._depth + 1 >= len(self._stack):
+ return self._context.environment. \
+ undefined('there is no parent block called %r.' %
+ self.name, name='super')
+ return BlockReference(self.name, self._context, self._stack,
+ self._depth + 1)
+
+ @internalcode
+ def __call__(self):
+ rv = concat(self._stack[self._depth](self._context))
+ if self._context.eval_ctx.autoescape:
+ rv = Markup(rv)
+ return rv
+
+
+class LoopContext(object):
+ """A loop context for dynamic iteration."""
+
+ def __init__(self, iterable, recurse=None, depth0=0):
+ self._iterator = iter(iterable)
+ self._recurse = recurse
+ self._after = self._safe_next()
+ self.index0 = -1
+ self.depth0 = depth0
+
+ # try to get the length of the iterable early. This must be done
+ # here because there are some broken iterators around where there
+ # __len__ is the number of iterations left (i'm looking at your
+ # listreverseiterator!).
+ try:
+ self._length = len(iterable)
+ except (TypeError, AttributeError):
+ self._length = None
+
+ def cycle(self, *args):
+ """Cycles among the arguments with the current loop index."""
+ if not args:
+ raise TypeError('no items for cycling given')
+ return args[self.index0 % len(args)]
+
+ first = property(lambda x: x.index0 == 0)
+ last = property(lambda x: x._after is _last_iteration)
+ index = property(lambda x: x.index0 + 1)
+ revindex = property(lambda x: x.length - x.index0)
+ revindex0 = property(lambda x: x.length - x.index)
+ depth = property(lambda x: x.depth0 + 1)
+
+ def __len__(self):
+ return self.length
+
+ def __iter__(self):
+ return LoopContextIterator(self)
+
+ def _safe_next(self):
+ try:
+ return next(self._iterator)
+ except StopIteration:
+ return _last_iteration
+
+ @internalcode
+ def loop(self, iterable):
+ if self._recurse is None:
+ raise TypeError('Tried to call non recursive loop. Maybe you '
+ "forgot the 'recursive' modifier.")
+ return self._recurse(iterable, self._recurse, self.depth0 + 1)
+
+ # a nifty trick to enhance the error message if someone tried to call
+ # the the loop without or with too many arguments.
+ __call__ = loop
+ del loop
+
+ @property
+ def length(self):
+ if self._length is None:
+ # if was not possible to get the length of the iterator when
+ # the loop context was created (ie: iterating over a generator)
+ # we have to convert the iterable into a sequence and use the
+ # length of that + the number of iterations so far.
+ iterable = tuple(self._iterator)
+ self._iterator = iter(iterable)
+ iterations_done = self.index0 + 2
+ self._length = len(iterable) + iterations_done
+ return self._length
+
+ def __repr__(self):
+ return '<%s %r/%r>' % (
+ self.__class__.__name__,
+ self.index,
+ self.length
+ )
+
+
+@implements_iterator
+class LoopContextIterator(object):
+ """The iterator for a loop context."""
+ __slots__ = ('context',)
+
+ def __init__(self, context):
+ self.context = context
+
+ def __iter__(self):
+ return self
+
+ def __next__(self):
+ ctx = self.context
+ ctx.index0 += 1
+ if ctx._after is _last_iteration:
+ raise StopIteration()
+ next_elem = ctx._after
+ ctx._after = ctx._safe_next()
+ return next_elem, ctx
+
+
+class Macro(object):
+ """Wraps a macro function."""
+
+ def __init__(self, environment, func, name, arguments, defaults,
+ catch_kwargs, catch_varargs, caller):
+ self._environment = environment
+ self._func = func
+ self._argument_count = len(arguments)
+ self.name = name
+ self.arguments = arguments
+ self.defaults = defaults
+ self.catch_kwargs = catch_kwargs
+ self.catch_varargs = catch_varargs
+ self.caller = caller
+
+ @internalcode
+ def __call__(self, *args, **kwargs):
+ # try to consume the positional arguments
+ arguments = list(args[:self._argument_count])
+ off = len(arguments)
+
+ # if the number of arguments consumed is not the number of
+ # arguments expected we start filling in keyword arguments
+ # and defaults.
+ if off != self._argument_count:
+ for idx, name in enumerate(self.arguments[len(arguments):]):
+ try:
+ value = kwargs.pop(name)
+ except KeyError:
+ try:
+ value = self.defaults[idx - self._argument_count + off]
+ except IndexError:
+ value = self._environment.undefined(
+ 'parameter %r was not provided' % name, name=name)
+ arguments.append(value)
+
+ # it's important that the order of these arguments does not change
+ # if not also changed in the compiler's `function_scoping` method.
+ # the order is caller, keyword arguments, positional arguments!
+ if self.caller:
+ caller = kwargs.pop('caller', None)
+ if caller is None:
+ caller = self._environment.undefined('No caller defined',
+ name='caller')
+ arguments.append(caller)
+ if self.catch_kwargs:
+ arguments.append(kwargs)
+ elif kwargs:
+ raise TypeError('macro %r takes no keyword argument %r' %
+ (self.name, next(iter(kwargs))))
+ if self.catch_varargs:
+ arguments.append(args[self._argument_count:])
+ elif len(args) > self._argument_count:
+ raise TypeError('macro %r takes not more than %d argument(s)' %
+ (self.name, len(self.arguments)))
+ return self._func(*arguments)
+
+ def __repr__(self):
+ return '<%s %s>' % (
+ self.__class__.__name__,
+ self.name is None and 'anonymous' or repr(self.name)
+ )
+
+
+@implements_to_string
+class Undefined(object):
+ """The default undefined type. This undefined type can be printed and
+ iterated over, but every other access will raise an :exc:`jinja2.exceptions.UndefinedError`:
+
+ >>> foo = Undefined(name='foo')
+ >>> str(foo)
+ ''
+ >>> not foo
+ True
+ >>> foo + 42
+ Traceback (most recent call last):
+ ...
+ jinja2.exceptions.UndefinedError: 'foo' is undefined
+ """
+ __slots__ = ('_undefined_hint', '_undefined_obj', '_undefined_name',
+ '_undefined_exception')
+
+ def __init__(self, hint=None, obj=missing, name=None, exc=UndefinedError):
+ self._undefined_hint = hint
+ self._undefined_obj = obj
+ self._undefined_name = name
+ self._undefined_exception = exc
+
+ @internalcode
+ def _fail_with_undefined_error(self, *args, **kwargs):
+ """Regular callback function for undefined objects that raises an
+ `jinja2.exceptions.UndefinedError` on call.
+ """
+ if self._undefined_hint is None:
+ if self._undefined_obj is missing:
+ hint = '%r is undefined' % self._undefined_name
+ elif not isinstance(self._undefined_name, string_types):
+ hint = '%s has no element %r' % (
+ object_type_repr(self._undefined_obj),
+ self._undefined_name
+ )
+ else:
+ hint = '%r has no attribute %r' % (
+ object_type_repr(self._undefined_obj),
+ self._undefined_name
+ )
+ else:
+ hint = self._undefined_hint
+ raise self._undefined_exception(hint)
+
+ @internalcode
+ def __getattr__(self, name):
+ if name[:2] == '__':
+ raise AttributeError(name)
+ return self._fail_with_undefined_error()
+
+ __add__ = __radd__ = __mul__ = __rmul__ = __div__ = __rdiv__ = \
+ __truediv__ = __rtruediv__ = __floordiv__ = __rfloordiv__ = \
+ __mod__ = __rmod__ = __pos__ = __neg__ = __call__ = \
+ __getitem__ = __lt__ = __le__ = __gt__ = __ge__ = __int__ = \
+ __float__ = __complex__ = __pow__ = __rpow__ = \
+ _fail_with_undefined_error
+
+ def __eq__(self, other):
+ return type(self) is type(other)
+
+ def __ne__(self, other):
+ return not self.__eq__(other)
+
+ def __hash__(self):
+ return id(type(self))
+
+ def __str__(self):
+ return u''
+
+ def __len__(self):
+ return 0
+
+ def __iter__(self):
+ if 0:
+ yield None
+
+ def __nonzero__(self):
+ return False
+ __bool__ = __nonzero__
+
+ def __repr__(self):
+ return 'Undefined'
+
+
+def make_logging_undefined(logger=None, base=None):
+ """Given a logger object this returns a new undefined class that will
+ log certain failures. It will log iterations and printing. If no
+ logger is given a default logger is created.
+
+ Example::
+
+ logger = logging.getLogger(__name__)
+ LoggingUndefined = make_logging_undefined(
+ logger=logger,
+ base=Undefined
+ )
+
+ .. versionadded:: 2.8
+
+ :param logger: the logger to use. If not provided, a default logger
+ is created.
+ :param base: the base class to add logging functionality to. This
+ defaults to :class:`Undefined`.
+ """
+ if logger is None:
+ import logging
+ logger = logging.getLogger(__name__)
+ logger.addHandler(logging.StreamHandler(sys.stderr))
+ if base is None:
+ base = Undefined
+
+ def _log_message(undef):
+ if undef._undefined_hint is None:
+ if undef._undefined_obj is missing:
+ hint = '%s is undefined' % undef._undefined_name
+ elif not isinstance(undef._undefined_name, string_types):
+ hint = '%s has no element %s' % (
+ object_type_repr(undef._undefined_obj),
+ undef._undefined_name)
+ else:
+ hint = '%s has no attribute %s' % (
+ object_type_repr(undef._undefined_obj),
+ undef._undefined_name)
+ else:
+ hint = undef._undefined_hint
+ logger.warning('Template variable warning: %s', hint)
+
+ class LoggingUndefined(base):
+
+ def _fail_with_undefined_error(self, *args, **kwargs):
+ try:
+ return base._fail_with_undefined_error(self, *args, **kwargs)
+ except self._undefined_exception as e:
+ logger.error('Template variable error: %s', str(e))
+ raise e
+
+ def __str__(self):
+ rv = base.__str__(self)
+ _log_message(self)
+ return rv
+
+ def __iter__(self):
+ rv = base.__iter__(self)
+ _log_message(self)
+ return rv
+
+ if PY2:
+ def __nonzero__(self):
+ rv = base.__nonzero__(self)
+ _log_message(self)
+ return rv
+
+ def __unicode__(self):
+ rv = base.__unicode__(self)
+ _log_message(self)
+ return rv
+ else:
+ def __bool__(self):
+ rv = base.__bool__(self)
+ _log_message(self)
+ return rv
+
+ return LoggingUndefined
+
+
+@implements_to_string
+class DebugUndefined(Undefined):
+ """An undefined that returns the debug info when printed.
+
+ >>> foo = DebugUndefined(name='foo')
+ >>> str(foo)
+ '{{ foo }}'
+ >>> not foo
+ True
+ >>> foo + 42
+ Traceback (most recent call last):
+ ...
+ jinja2.exceptions.UndefinedError: 'foo' is undefined
+ """
+ __slots__ = ()
+
+ def __str__(self):
+ if self._undefined_hint is None:
+ if self._undefined_obj is missing:
+ return u'{{ %s }}' % self._undefined_name
+ return '{{ no such element: %s[%r] }}' % (
+ object_type_repr(self._undefined_obj),
+ self._undefined_name
+ )
+ return u'{{ undefined value printed: %s }}' % self._undefined_hint
+
+
+@implements_to_string
+class StrictUndefined(Undefined):
+ """An undefined that barks on print and iteration as well as boolean
+ tests and all kinds of comparisons. In other words: you can do nothing
+ with it except checking if it's defined using the `defined` test.
+
+ >>> foo = StrictUndefined(name='foo')
+ >>> str(foo)
+ Traceback (most recent call last):
+ ...
+ jinja2.exceptions.UndefinedError: 'foo' is undefined
+ >>> not foo
+ Traceback (most recent call last):
+ ...
+ jinja2.exceptions.UndefinedError: 'foo' is undefined
+ >>> foo + 42
+ Traceback (most recent call last):
+ ...
+ jinja2.exceptions.UndefinedError: 'foo' is undefined
+ """
+ __slots__ = ()
+ __iter__ = __str__ = __len__ = __nonzero__ = __eq__ = \
+ __ne__ = __bool__ = __hash__ = \
+ Undefined._fail_with_undefined_error
+
+
+# remove remaining slots attributes, after the metaclass did the magic they
+# are unneeded and irritating as they contain wrong data for the subclasses.
+del Undefined.__slots__, DebugUndefined.__slots__, StrictUndefined.__slots__
diff --git a/venv/lib/python2.7/site-packages/Jinja2-2.8-py2.7.egg/jinja2/sandbox.py b/venv/lib/python2.7/site-packages/Jinja2-2.8-py2.7.egg/jinja2/sandbox.py
new file mode 100644
index 000000000..7e40ab308
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/Jinja2-2.8-py2.7.egg/jinja2/sandbox.py
@@ -0,0 +1,367 @@
+# -*- coding: utf-8 -*-
+"""
+ jinja2.sandbox
+ ~~~~~~~~~~~~~~
+
+ Adds a sandbox layer to Jinja as it was the default behavior in the old
+ Jinja 1 releases. This sandbox is slightly different from Jinja 1 as the
+ default behavior is easier to use.
+
+ The behavior can be changed by subclassing the environment.
+
+ :copyright: (c) 2010 by the Jinja Team.
+ :license: BSD.
+"""
+import types
+import operator
+from jinja2.environment import Environment
+from jinja2.exceptions import SecurityError
+from jinja2._compat import string_types, PY2
+
+
+#: maximum number of items a range may produce
+MAX_RANGE = 100000
+
+#: attributes of function objects that are considered unsafe.
+if PY2:
+ UNSAFE_FUNCTION_ATTRIBUTES = set(['func_closure', 'func_code', 'func_dict',
+ 'func_defaults', 'func_globals'])
+else:
+ # On versions > python 2 the special attributes on functions are gone,
+ # but they remain on methods and generators for whatever reason.
+ UNSAFE_FUNCTION_ATTRIBUTES = set()
+
+
+#: unsafe method attributes. function attributes are unsafe for methods too
+UNSAFE_METHOD_ATTRIBUTES = set(['im_class', 'im_func', 'im_self'])
+
+#: unsafe generator attirbutes.
+UNSAFE_GENERATOR_ATTRIBUTES = set(['gi_frame', 'gi_code'])
+
+import warnings
+
+# make sure we don't warn in python 2.6 about stuff we don't care about
+warnings.filterwarnings('ignore', 'the sets module', DeprecationWarning,
+ module='jinja2.sandbox')
+
+from collections import deque
+
+_mutable_set_types = (set,)
+_mutable_mapping_types = (dict,)
+_mutable_sequence_types = (list,)
+
+
+# on python 2.x we can register the user collection types
+try:
+ from UserDict import UserDict, DictMixin
+ from UserList import UserList
+ _mutable_mapping_types += (UserDict, DictMixin)
+ _mutable_set_types += (UserList,)
+except ImportError:
+ pass
+
+# if sets is still available, register the mutable set from there as well
+try:
+ from sets import Set
+ _mutable_set_types += (Set,)
+except ImportError:
+ pass
+
+#: register Python 2.6 abstract base classes
+try:
+ from collections import MutableSet, MutableMapping, MutableSequence
+ _mutable_set_types += (MutableSet,)
+ _mutable_mapping_types += (MutableMapping,)
+ _mutable_sequence_types += (MutableSequence,)
+except ImportError:
+ pass
+
+_mutable_spec = (
+ (_mutable_set_types, frozenset([
+ 'add', 'clear', 'difference_update', 'discard', 'pop', 'remove',
+ 'symmetric_difference_update', 'update'
+ ])),
+ (_mutable_mapping_types, frozenset([
+ 'clear', 'pop', 'popitem', 'setdefault', 'update'
+ ])),
+ (_mutable_sequence_types, frozenset([
+ 'append', 'reverse', 'insert', 'sort', 'extend', 'remove'
+ ])),
+ (deque, frozenset([
+ 'append', 'appendleft', 'clear', 'extend', 'extendleft', 'pop',
+ 'popleft', 'remove', 'rotate'
+ ]))
+)
+
+
+def safe_range(*args):
+ """A range that can't generate ranges with a length of more than
+ MAX_RANGE items.
+ """
+ rng = range(*args)
+ if len(rng) > MAX_RANGE:
+ raise OverflowError('range too big, maximum size for range is %d' %
+ MAX_RANGE)
+ return rng
+
+
+def unsafe(f):
+ """Marks a function or method as unsafe.
+
+ ::
+
+ @unsafe
+ def delete(self):
+ pass
+ """
+ f.unsafe_callable = True
+ return f
+
+
+def is_internal_attribute(obj, attr):
+ """Test if the attribute given is an internal python attribute. For
+ example this function returns `True` for the `func_code` attribute of
+ python objects. This is useful if the environment method
+ :meth:`~SandboxedEnvironment.is_safe_attribute` is overridden.
+
+ >>> from jinja2.sandbox import is_internal_attribute
+ >>> is_internal_attribute(str, "mro")
+ True
+ >>> is_internal_attribute(str, "upper")
+ False
+ """
+ if isinstance(obj, types.FunctionType):
+ if attr in UNSAFE_FUNCTION_ATTRIBUTES:
+ return True
+ elif isinstance(obj, types.MethodType):
+ if attr in UNSAFE_FUNCTION_ATTRIBUTES or \
+ attr in UNSAFE_METHOD_ATTRIBUTES:
+ return True
+ elif isinstance(obj, type):
+ if attr == 'mro':
+ return True
+ elif isinstance(obj, (types.CodeType, types.TracebackType, types.FrameType)):
+ return True
+ elif isinstance(obj, types.GeneratorType):
+ if attr in UNSAFE_GENERATOR_ATTRIBUTES:
+ return True
+ return attr.startswith('__')
+
+
+def modifies_known_mutable(obj, attr):
+ """This function checks if an attribute on a builtin mutable object
+ (list, dict, set or deque) would modify it if called. It also supports
+ the "user"-versions of the objects (`sets.Set`, `UserDict.*` etc.) and
+ with Python 2.6 onwards the abstract base classes `MutableSet`,
+ `MutableMapping`, and `MutableSequence`.
+
+ >>> modifies_known_mutable({}, "clear")
+ True
+ >>> modifies_known_mutable({}, "keys")
+ False
+ >>> modifies_known_mutable([], "append")
+ True
+ >>> modifies_known_mutable([], "index")
+ False
+
+ If called with an unsupported object (such as unicode) `False` is
+ returned.
+
+ >>> modifies_known_mutable("foo", "upper")
+ False
+ """
+ for typespec, unsafe in _mutable_spec:
+ if isinstance(obj, typespec):
+ return attr in unsafe
+ return False
+
+
+class SandboxedEnvironment(Environment):
+ """The sandboxed environment. It works like the regular environment but
+ tells the compiler to generate sandboxed code. Additionally subclasses of
+ this environment may override the methods that tell the runtime what
+ attributes or functions are safe to access.
+
+ If the template tries to access insecure code a :exc:`SecurityError` is
+ raised. However also other exceptions may occour during the rendering so
+ the caller has to ensure that all exceptions are catched.
+ """
+ sandboxed = True
+
+ #: default callback table for the binary operators. A copy of this is
+ #: available on each instance of a sandboxed environment as
+ #: :attr:`binop_table`
+ default_binop_table = {
+ '+': operator.add,
+ '-': operator.sub,
+ '*': operator.mul,
+ '/': operator.truediv,
+ '//': operator.floordiv,
+ '**': operator.pow,
+ '%': operator.mod
+ }
+
+ #: default callback table for the unary operators. A copy of this is
+ #: available on each instance of a sandboxed environment as
+ #: :attr:`unop_table`
+ default_unop_table = {
+ '+': operator.pos,
+ '-': operator.neg
+ }
+
+ #: a set of binary operators that should be intercepted. Each operator
+ #: that is added to this set (empty by default) is delegated to the
+ #: :meth:`call_binop` method that will perform the operator. The default
+ #: operator callback is specified by :attr:`binop_table`.
+ #:
+ #: The following binary operators are interceptable:
+ #: ``//``, ``%``, ``+``, ``*``, ``-``, ``/``, and ``**``
+ #:
+ #: The default operation form the operator table corresponds to the
+ #: builtin function. Intercepted calls are always slower than the native
+ #: operator call, so make sure only to intercept the ones you are
+ #: interested in.
+ #:
+ #: .. versionadded:: 2.6
+ intercepted_binops = frozenset()
+
+ #: a set of unary operators that should be intercepted. Each operator
+ #: that is added to this set (empty by default) is delegated to the
+ #: :meth:`call_unop` method that will perform the operator. The default
+ #: operator callback is specified by :attr:`unop_table`.
+ #:
+ #: The following unary operators are interceptable: ``+``, ``-``
+ #:
+ #: The default operation form the operator table corresponds to the
+ #: builtin function. Intercepted calls are always slower than the native
+ #: operator call, so make sure only to intercept the ones you are
+ #: interested in.
+ #:
+ #: .. versionadded:: 2.6
+ intercepted_unops = frozenset()
+
+ def intercept_unop(self, operator):
+ """Called during template compilation with the name of a unary
+ operator to check if it should be intercepted at runtime. If this
+ method returns `True`, :meth:`call_unop` is excuted for this unary
+ operator. The default implementation of :meth:`call_unop` will use
+ the :attr:`unop_table` dictionary to perform the operator with the
+ same logic as the builtin one.
+
+ The following unary operators are interceptable: ``+`` and ``-``
+
+ Intercepted calls are always slower than the native operator call,
+ so make sure only to intercept the ones you are interested in.
+
+ .. versionadded:: 2.6
+ """
+ return False
+
+
+ def __init__(self, *args, **kwargs):
+ Environment.__init__(self, *args, **kwargs)
+ self.globals['range'] = safe_range
+ self.binop_table = self.default_binop_table.copy()
+ self.unop_table = self.default_unop_table.copy()
+
+ def is_safe_attribute(self, obj, attr, value):
+ """The sandboxed environment will call this method to check if the
+ attribute of an object is safe to access. Per default all attributes
+ starting with an underscore are considered private as well as the
+ special attributes of internal python objects as returned by the
+ :func:`is_internal_attribute` function.
+ """
+ return not (attr.startswith('_') or is_internal_attribute(obj, attr))
+
+ def is_safe_callable(self, obj):
+ """Check if an object is safely callable. Per default a function is
+ considered safe unless the `unsafe_callable` attribute exists and is
+ True. Override this method to alter the behavior, but this won't
+ affect the `unsafe` decorator from this module.
+ """
+ return not (getattr(obj, 'unsafe_callable', False) or
+ getattr(obj, 'alters_data', False))
+
+ def call_binop(self, context, operator, left, right):
+ """For intercepted binary operator calls (:meth:`intercepted_binops`)
+ this function is executed instead of the builtin operator. This can
+ be used to fine tune the behavior of certain operators.
+
+ .. versionadded:: 2.6
+ """
+ return self.binop_table[operator](left, right)
+
+ def call_unop(self, context, operator, arg):
+ """For intercepted unary operator calls (:meth:`intercepted_unops`)
+ this function is executed instead of the builtin operator. This can
+ be used to fine tune the behavior of certain operators.
+
+ .. versionadded:: 2.6
+ """
+ return self.unop_table[operator](arg)
+
+ def getitem(self, obj, argument):
+ """Subscribe an object from sandboxed code."""
+ try:
+ return obj[argument]
+ except (TypeError, LookupError):
+ if isinstance(argument, string_types):
+ try:
+ attr = str(argument)
+ except Exception:
+ pass
+ else:
+ try:
+ value = getattr(obj, attr)
+ except AttributeError:
+ pass
+ else:
+ if self.is_safe_attribute(obj, argument, value):
+ return value
+ return self.unsafe_undefined(obj, argument)
+ return self.undefined(obj=obj, name=argument)
+
+ def getattr(self, obj, attribute):
+ """Subscribe an object from sandboxed code and prefer the
+ attribute. The attribute passed *must* be a bytestring.
+ """
+ try:
+ value = getattr(obj, attribute)
+ except AttributeError:
+ try:
+ return obj[attribute]
+ except (TypeError, LookupError):
+ pass
+ else:
+ if self.is_safe_attribute(obj, attribute, value):
+ return value
+ return self.unsafe_undefined(obj, attribute)
+ return self.undefined(obj=obj, name=attribute)
+
+ def unsafe_undefined(self, obj, attribute):
+ """Return an undefined object for unsafe attributes."""
+ return self.undefined('access to attribute %r of %r '
+ 'object is unsafe.' % (
+ attribute,
+ obj.__class__.__name__
+ ), name=attribute, obj=obj, exc=SecurityError)
+
+ def call(__self, __context, __obj, *args, **kwargs):
+ """Call an object from sandboxed code."""
+ # the double prefixes are to avoid double keyword argument
+ # errors when proxying the call.
+ if not __self.is_safe_callable(__obj):
+ raise SecurityError('%r is not safely callable' % (__obj,))
+ return __context.call(__obj, *args, **kwargs)
+
+
+class ImmutableSandboxedEnvironment(SandboxedEnvironment):
+ """Works exactly like the regular `SandboxedEnvironment` but does not
+ permit modifications on the builtin mutable objects `list`, `set`, and
+ `dict` by using the :func:`modifies_known_mutable` function.
+ """
+
+ def is_safe_attribute(self, obj, attr, value):
+ if not SandboxedEnvironment.is_safe_attribute(self, obj, attr, value):
+ return False
+ return not modifies_known_mutable(obj, attr)
diff --git a/venv/lib/python2.7/site-packages/Jinja2-2.8-py2.7.egg/jinja2/tests.py b/venv/lib/python2.7/site-packages/Jinja2-2.8-py2.7.egg/jinja2/tests.py
new file mode 100644
index 000000000..bb32349df
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/Jinja2-2.8-py2.7.egg/jinja2/tests.py
@@ -0,0 +1,173 @@
+# -*- coding: utf-8 -*-
+"""
+ jinja2.tests
+ ~~~~~~~~~~~~
+
+ Jinja test functions. Used with the "is" operator.
+
+ :copyright: (c) 2010 by the Jinja Team.
+ :license: BSD, see LICENSE for more details.
+"""
+import re
+from collections import Mapping
+from jinja2.runtime import Undefined
+from jinja2._compat import text_type, string_types, integer_types
+import decimal
+
+number_re = re.compile(r'^-?\d+(\.\d+)?$')
+regex_type = type(number_re)
+
+
+test_callable = callable
+
+
+def test_odd(value):
+ """Return true if the variable is odd."""
+ return value % 2 == 1
+
+
+def test_even(value):
+ """Return true if the variable is even."""
+ return value % 2 == 0
+
+
+def test_divisibleby(value, num):
+ """Check if a variable is divisible by a number."""
+ return value % num == 0
+
+
+def test_defined(value):
+ """Return true if the variable is defined:
+
+ .. sourcecode:: jinja
+
+ {% if variable is defined %}
+ value of variable: {{ variable }}
+ {% else %}
+ variable is not defined
+ {% endif %}
+
+ See the :func:`default` filter for a simple way to set undefined
+ variables.
+ """
+ return not isinstance(value, Undefined)
+
+
+def test_undefined(value):
+ """Like :func:`defined` but the other way round."""
+ return isinstance(value, Undefined)
+
+
+def test_none(value):
+ """Return true if the variable is none."""
+ return value is None
+
+
+def test_lower(value):
+ """Return true if the variable is lowercased."""
+ return text_type(value).islower()
+
+
+def test_upper(value):
+ """Return true if the variable is uppercased."""
+ return text_type(value).isupper()
+
+
+def test_string(value):
+ """Return true if the object is a string."""
+ return isinstance(value, string_types)
+
+
+def test_mapping(value):
+ """Return true if the object is a mapping (dict etc.).
+
+ .. versionadded:: 2.6
+ """
+ return isinstance(value, Mapping)
+
+
+def test_number(value):
+ """Return true if the variable is a number."""
+ return isinstance(value, integer_types + (float, complex, decimal.Decimal))
+
+
+def test_sequence(value):
+ """Return true if the variable is a sequence. Sequences are variables
+ that are iterable.
+ """
+ try:
+ len(value)
+ value.__getitem__
+ except:
+ return False
+ return True
+
+
+def test_equalto(value, other):
+ """Check if an object has the same value as another object:
+
+ .. sourcecode:: jinja
+
+ {% if foo.expression is equalto 42 %}
+ the foo attribute evaluates to the constant 42
+ {% endif %}
+
+ This appears to be a useless test as it does exactly the same as the
+ ``==`` operator, but it can be useful when used together with the
+ `selectattr` function:
+
+ .. sourcecode:: jinja
+
+ {{ users|selectattr("email", "equalto", "foo@bar.invalid") }}
+
+ .. versionadded:: 2.8
+ """
+ return value == other
+
+
+def test_sameas(value, other):
+ """Check if an object points to the same memory address than another
+ object:
+
+ .. sourcecode:: jinja
+
+ {% if foo.attribute is sameas false %}
+ the foo attribute really is the `False` singleton
+ {% endif %}
+ """
+ return value is other
+
+
+def test_iterable(value):
+ """Check if it's possible to iterate over an object."""
+ try:
+ iter(value)
+ except TypeError:
+ return False
+ return True
+
+
+def test_escaped(value):
+ """Check if the value is escaped."""
+ return hasattr(value, '__html__')
+
+
+TESTS = {
+ 'odd': test_odd,
+ 'even': test_even,
+ 'divisibleby': test_divisibleby,
+ 'defined': test_defined,
+ 'undefined': test_undefined,
+ 'none': test_none,
+ 'lower': test_lower,
+ 'upper': test_upper,
+ 'string': test_string,
+ 'mapping': test_mapping,
+ 'number': test_number,
+ 'sequence': test_sequence,
+ 'iterable': test_iterable,
+ 'callable': test_callable,
+ 'sameas': test_sameas,
+ 'equalto': test_equalto,
+ 'escaped': test_escaped
+}
diff --git a/venv/lib/python2.7/site-packages/Jinja2-2.8-py2.7.egg/jinja2/utils.py b/venv/lib/python2.7/site-packages/Jinja2-2.8-py2.7.egg/jinja2/utils.py
new file mode 100644
index 000000000..cdd4cd3af
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/Jinja2-2.8-py2.7.egg/jinja2/utils.py
@@ -0,0 +1,531 @@
+# -*- coding: utf-8 -*-
+"""
+ jinja2.utils
+ ~~~~~~~~~~~~
+
+ Utility functions.
+
+ :copyright: (c) 2010 by the Jinja Team.
+ :license: BSD, see LICENSE for more details.
+"""
+import re
+import errno
+from collections import deque
+from threading import Lock
+from jinja2._compat import text_type, string_types, implements_iterator, \
+ url_quote
+
+
+_word_split_re = re.compile(r'(\s+)')
+_punctuation_re = re.compile(
+ '^(?P(?:%s)*)(?P.*?)(?P(?:%s)*)$' % (
+ '|'.join(map(re.escape, ('(', '<', '<'))),
+ '|'.join(map(re.escape, ('.', ',', ')', '>', '\n', '>')))
+ )
+)
+_simple_email_re = re.compile(r'^\S+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9._-]+$')
+_striptags_re = re.compile(r'(|<[^>]*>)')
+_entity_re = re.compile(r'&([^;]+);')
+_letters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
+_digits = '0123456789'
+
+# special singleton representing missing values for the runtime
+missing = type('MissingType', (), {'__repr__': lambda x: 'missing'})()
+
+# internal code
+internal_code = set()
+
+concat = u''.join
+
+
+def contextfunction(f):
+ """This decorator can be used to mark a function or method context callable.
+ A context callable is passed the active :class:`Context` as first argument when
+ called from the template. This is useful if a function wants to get access
+ to the context or functions provided on the context object. For example
+ a function that returns a sorted list of template variables the current
+ template exports could look like this::
+
+ @contextfunction
+ def get_exported_names(context):
+ return sorted(context.exported_vars)
+ """
+ f.contextfunction = True
+ return f
+
+
+def evalcontextfunction(f):
+ """This decorator can be used to mark a function or method as an eval
+ context callable. This is similar to the :func:`contextfunction`
+ but instead of passing the context, an evaluation context object is
+ passed. For more information about the eval context, see
+ :ref:`eval-context`.
+
+ .. versionadded:: 2.4
+ """
+ f.evalcontextfunction = True
+ return f
+
+
+def environmentfunction(f):
+ """This decorator can be used to mark a function or method as environment
+ callable. This decorator works exactly like the :func:`contextfunction`
+ decorator just that the first argument is the active :class:`Environment`
+ and not context.
+ """
+ f.environmentfunction = True
+ return f
+
+
+def internalcode(f):
+ """Marks the function as internally used"""
+ internal_code.add(f.__code__)
+ return f
+
+
+def is_undefined(obj):
+ """Check if the object passed is undefined. This does nothing more than
+ performing an instance check against :class:`Undefined` but looks nicer.
+ This can be used for custom filters or tests that want to react to
+ undefined variables. For example a custom default filter can look like
+ this::
+
+ def default(var, default=''):
+ if is_undefined(var):
+ return default
+ return var
+ """
+ from jinja2.runtime import Undefined
+ return isinstance(obj, Undefined)
+
+
+def consume(iterable):
+ """Consumes an iterable without doing anything with it."""
+ for event in iterable:
+ pass
+
+
+def clear_caches():
+ """Jinja2 keeps internal caches for environments and lexers. These are
+ used so that Jinja2 doesn't have to recreate environments and lexers all
+ the time. Normally you don't have to care about that but if you are
+ messuring memory consumption you may want to clean the caches.
+ """
+ from jinja2.environment import _spontaneous_environments
+ from jinja2.lexer import _lexer_cache
+ _spontaneous_environments.clear()
+ _lexer_cache.clear()
+
+
+def import_string(import_name, silent=False):
+ """Imports an object based on a string. This is useful if you want to
+ use import paths as endpoints or something similar. An import path can
+ be specified either in dotted notation (``xml.sax.saxutils.escape``)
+ or with a colon as object delimiter (``xml.sax.saxutils:escape``).
+
+ If the `silent` is True the return value will be `None` if the import
+ fails.
+
+ :return: imported object
+ """
+ try:
+ if ':' in import_name:
+ module, obj = import_name.split(':', 1)
+ elif '.' in import_name:
+ items = import_name.split('.')
+ module = '.'.join(items[:-1])
+ obj = items[-1]
+ else:
+ return __import__(import_name)
+ return getattr(__import__(module, None, None, [obj]), obj)
+ except (ImportError, AttributeError):
+ if not silent:
+ raise
+
+
+def open_if_exists(filename, mode='rb'):
+ """Returns a file descriptor for the filename if that file exists,
+ otherwise `None`.
+ """
+ try:
+ return open(filename, mode)
+ except IOError as e:
+ if e.errno not in (errno.ENOENT, errno.EISDIR, errno.EINVAL):
+ raise
+
+
+def object_type_repr(obj):
+ """Returns the name of the object's type. For some recognized
+ singletons the name of the object is returned instead. (For
+ example for `None` and `Ellipsis`).
+ """
+ if obj is None:
+ return 'None'
+ elif obj is Ellipsis:
+ return 'Ellipsis'
+ # __builtin__ in 2.x, builtins in 3.x
+ if obj.__class__.__module__ in ('__builtin__', 'builtins'):
+ name = obj.__class__.__name__
+ else:
+ name = obj.__class__.__module__ + '.' + obj.__class__.__name__
+ return '%s object' % name
+
+
+def pformat(obj, verbose=False):
+ """Prettyprint an object. Either use the `pretty` library or the
+ builtin `pprint`.
+ """
+ try:
+ from pretty import pretty
+ return pretty(obj, verbose=verbose)
+ except ImportError:
+ from pprint import pformat
+ return pformat(obj)
+
+
+def urlize(text, trim_url_limit=None, nofollow=False, target=None):
+ """Converts any URLs in text into clickable links. Works on http://,
+ https:// and www. links. Links can have trailing punctuation (periods,
+ commas, close-parens) and leading punctuation (opening parens) and
+ it'll still do the right thing.
+
+ If trim_url_limit is not None, the URLs in link text will be limited
+ to trim_url_limit characters.
+
+ If nofollow is True, the URLs in link text will get a rel="nofollow"
+ attribute.
+
+ If target is not None, a target attribute will be added to the link.
+ """
+ trim_url = lambda x, limit=trim_url_limit: limit is not None \
+ and (x[:limit] + (len(x) >=limit and '...'
+ or '')) or x
+ words = _word_split_re.split(text_type(escape(text)))
+ nofollow_attr = nofollow and ' rel="nofollow"' or ''
+ if target is not None and isinstance(target, string_types):
+ target_attr = ' target="%s"' % target
+ else:
+ target_attr = ''
+ for i, word in enumerate(words):
+ match = _punctuation_re.match(word)
+ if match:
+ lead, middle, trail = match.groups()
+ if middle.startswith('www.') or (
+ '@' not in middle and
+ not middle.startswith('http://') and
+ not middle.startswith('https://') and
+ len(middle) > 0 and
+ middle[0] in _letters + _digits and (
+ middle.endswith('.org') or
+ middle.endswith('.net') or
+ middle.endswith('.com')
+ )):
+ middle = '%s' % (middle,
+ nofollow_attr, target_attr, trim_url(middle))
+ if middle.startswith('http://') or \
+ middle.startswith('https://'):
+ middle = '%s' % (middle,
+ nofollow_attr, target_attr, trim_url(middle))
+ if '@' in middle and not middle.startswith('www.') and \
+ not ':' in middle and _simple_email_re.match(middle):
+ middle = '%s' % (middle, middle)
+ if lead + middle + trail != word:
+ words[i] = lead + middle + trail
+ return u''.join(words)
+
+
+def generate_lorem_ipsum(n=5, html=True, min=20, max=100):
+ """Generate some lorem ipsum for the template."""
+ from jinja2.constants import LOREM_IPSUM_WORDS
+ from random import choice, randrange
+ words = LOREM_IPSUM_WORDS.split()
+ result = []
+
+ for _ in range(n):
+ next_capitalized = True
+ last_comma = last_fullstop = 0
+ word = None
+ last = None
+ p = []
+
+ # each paragraph contains out of 20 to 100 words.
+ for idx, _ in enumerate(range(randrange(min, max))):
+ while True:
+ word = choice(words)
+ if word != last:
+ last = word
+ break
+ if next_capitalized:
+ word = word.capitalize()
+ next_capitalized = False
+ # add commas
+ if idx - randrange(3, 8) > last_comma:
+ last_comma = idx
+ last_fullstop += 2
+ word += ','
+ # add end of sentences
+ if idx - randrange(10, 20) > last_fullstop:
+ last_comma = last_fullstop = idx
+ word += '.'
+ next_capitalized = True
+ p.append(word)
+
+ # ensure that the paragraph ends with a dot.
+ p = u' '.join(p)
+ if p.endswith(','):
+ p = p[:-1] + '.'
+ elif not p.endswith('.'):
+ p += '.'
+ result.append(p)
+
+ if not html:
+ return u'\n\n'.join(result)
+ return Markup(u'\n'.join(u'
%s
' % escape(x) for x in result))
+
+
+def unicode_urlencode(obj, charset='utf-8', for_qs=False):
+ """URL escapes a single bytestring or unicode string with the
+ given charset if applicable to URL safe quoting under all rules
+ that need to be considered under all supported Python versions.
+
+ If non strings are provided they are converted to their unicode
+ representation first.
+ """
+ if not isinstance(obj, string_types):
+ obj = text_type(obj)
+ if isinstance(obj, text_type):
+ obj = obj.encode(charset)
+ safe = for_qs and b'' or b'/'
+ rv = text_type(url_quote(obj, safe))
+ if for_qs:
+ rv = rv.replace('%20', '+')
+ return rv
+
+
+class LRUCache(object):
+ """A simple LRU Cache implementation."""
+
+ # this is fast for small capacities (something below 1000) but doesn't
+ # scale. But as long as it's only used as storage for templates this
+ # won't do any harm.
+
+ def __init__(self, capacity):
+ self.capacity = capacity
+ self._mapping = {}
+ self._queue = deque()
+ self._postinit()
+
+ def _postinit(self):
+ # alias all queue methods for faster lookup
+ self._popleft = self._queue.popleft
+ self._pop = self._queue.pop
+ self._remove = self._queue.remove
+ self._wlock = Lock()
+ self._append = self._queue.append
+
+ def __getstate__(self):
+ return {
+ 'capacity': self.capacity,
+ '_mapping': self._mapping,
+ '_queue': self._queue
+ }
+
+ def __setstate__(self, d):
+ self.__dict__.update(d)
+ self._postinit()
+
+ def __getnewargs__(self):
+ return (self.capacity,)
+
+ def copy(self):
+ """Return a shallow copy of the instance."""
+ rv = self.__class__(self.capacity)
+ rv._mapping.update(self._mapping)
+ rv._queue = deque(self._queue)
+ return rv
+
+ def get(self, key, default=None):
+ """Return an item from the cache dict or `default`"""
+ try:
+ return self[key]
+ except KeyError:
+ return default
+
+ def setdefault(self, key, default=None):
+ """Set `default` if the key is not in the cache otherwise
+ leave unchanged. Return the value of this key.
+ """
+ self._wlock.acquire()
+ try:
+ try:
+ return self[key]
+ except KeyError:
+ self[key] = default
+ return default
+ finally:
+ self._wlock.release()
+
+ def clear(self):
+ """Clear the cache."""
+ self._wlock.acquire()
+ try:
+ self._mapping.clear()
+ self._queue.clear()
+ finally:
+ self._wlock.release()
+
+ def __contains__(self, key):
+ """Check if a key exists in this cache."""
+ return key in self._mapping
+
+ def __len__(self):
+ """Return the current size of the cache."""
+ return len(self._mapping)
+
+ def __repr__(self):
+ return '<%s %r>' % (
+ self.__class__.__name__,
+ self._mapping
+ )
+
+ def __getitem__(self, key):
+ """Get an item from the cache. Moves the item up so that it has the
+ highest priority then.
+
+ Raise a `KeyError` if it does not exist.
+ """
+ self._wlock.acquire()
+ try:
+ rv = self._mapping[key]
+ if self._queue[-1] != key:
+ try:
+ self._remove(key)
+ except ValueError:
+ # if something removed the key from the container
+ # when we read, ignore the ValueError that we would
+ # get otherwise.
+ pass
+ self._append(key)
+ return rv
+ finally:
+ self._wlock.release()
+
+ def __setitem__(self, key, value):
+ """Sets the value for an item. Moves the item up so that it
+ has the highest priority then.
+ """
+ self._wlock.acquire()
+ try:
+ if key in self._mapping:
+ self._remove(key)
+ elif len(self._mapping) == self.capacity:
+ del self._mapping[self._popleft()]
+ self._append(key)
+ self._mapping[key] = value
+ finally:
+ self._wlock.release()
+
+ def __delitem__(self, key):
+ """Remove an item from the cache dict.
+ Raise a `KeyError` if it does not exist.
+ """
+ self._wlock.acquire()
+ try:
+ del self._mapping[key]
+ try:
+ self._remove(key)
+ except ValueError:
+ # __getitem__ is not locked, it might happen
+ pass
+ finally:
+ self._wlock.release()
+
+ def items(self):
+ """Return a list of items."""
+ result = [(key, self._mapping[key]) for key in list(self._queue)]
+ result.reverse()
+ return result
+
+ def iteritems(self):
+ """Iterate over all items."""
+ return iter(self.items())
+
+ def values(self):
+ """Return a list of all values."""
+ return [x[1] for x in self.items()]
+
+ def itervalue(self):
+ """Iterate over all values."""
+ return iter(self.values())
+
+ def keys(self):
+ """Return a list of all keys ordered by most recent usage."""
+ return list(self)
+
+ def iterkeys(self):
+ """Iterate over all keys in the cache dict, ordered by
+ the most recent usage.
+ """
+ return reversed(tuple(self._queue))
+
+ __iter__ = iterkeys
+
+ def __reversed__(self):
+ """Iterate over the values in the cache dict, oldest items
+ coming first.
+ """
+ return iter(tuple(self._queue))
+
+ __copy__ = copy
+
+
+# register the LRU cache as mutable mapping if possible
+try:
+ from collections import MutableMapping
+ MutableMapping.register(LRUCache)
+except ImportError:
+ pass
+
+
+@implements_iterator
+class Cycler(object):
+ """A cycle helper for templates."""
+
+ def __init__(self, *items):
+ if not items:
+ raise RuntimeError('at least one item has to be provided')
+ self.items = items
+ self.reset()
+
+ def reset(self):
+ """Resets the cycle."""
+ self.pos = 0
+
+ @property
+ def current(self):
+ """Returns the current item."""
+ return self.items[self.pos]
+
+ def __next__(self):
+ """Goes one item ahead and returns it."""
+ rv = self.current
+ self.pos = (self.pos + 1) % len(self.items)
+ return rv
+
+
+class Joiner(object):
+ """A joining helper for templates."""
+
+ def __init__(self, sep=u', '):
+ self.sep = sep
+ self.used = False
+
+ def __call__(self):
+ if not self.used:
+ self.used = True
+ return u''
+ return self.sep
+
+
+# Imported here because that's where it was in the past
+from markupsafe import Markup, escape, soft_unicode
diff --git a/venv/lib/python2.7/site-packages/Jinja2-2.8-py2.7.egg/jinja2/visitor.py b/venv/lib/python2.7/site-packages/Jinja2-2.8-py2.7.egg/jinja2/visitor.py
new file mode 100644
index 000000000..413e7c309
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/Jinja2-2.8-py2.7.egg/jinja2/visitor.py
@@ -0,0 +1,87 @@
+# -*- coding: utf-8 -*-
+"""
+ jinja2.visitor
+ ~~~~~~~~~~~~~~
+
+ This module implements a visitor for the nodes.
+
+ :copyright: (c) 2010 by the Jinja Team.
+ :license: BSD.
+"""
+from jinja2.nodes import Node
+
+
+class NodeVisitor(object):
+ """Walks the abstract syntax tree and call visitor functions for every
+ node found. The visitor functions may return values which will be
+ forwarded by the `visit` method.
+
+ Per default the visitor functions for the nodes are ``'visit_'`` +
+ class name of the node. So a `TryFinally` node visit function would
+ be `visit_TryFinally`. This behavior can be changed by overriding
+ the `get_visitor` function. If no visitor function exists for a node
+ (return value `None`) the `generic_visit` visitor is used instead.
+ """
+
+ def get_visitor(self, node):
+ """Return the visitor function for this node or `None` if no visitor
+ exists for this node. In that case the generic visit function is
+ used instead.
+ """
+ method = 'visit_' + node.__class__.__name__
+ return getattr(self, method, None)
+
+ def visit(self, node, *args, **kwargs):
+ """Visit a node."""
+ f = self.get_visitor(node)
+ if f is not None:
+ return f(node, *args, **kwargs)
+ return self.generic_visit(node, *args, **kwargs)
+
+ def generic_visit(self, node, *args, **kwargs):
+ """Called if no explicit visitor function exists for a node."""
+ for node in node.iter_child_nodes():
+ self.visit(node, *args, **kwargs)
+
+
+class NodeTransformer(NodeVisitor):
+ """Walks the abstract syntax tree and allows modifications of nodes.
+
+ The `NodeTransformer` will walk the AST and use the return value of the
+ visitor functions to replace or remove the old node. If the return
+ value of the visitor function is `None` the node will be removed
+ from the previous location otherwise it's replaced with the return
+ value. The return value may be the original node in which case no
+ replacement takes place.
+ """
+
+ def generic_visit(self, node, *args, **kwargs):
+ for field, old_value in node.iter_fields():
+ if isinstance(old_value, list):
+ new_values = []
+ for value in old_value:
+ if isinstance(value, Node):
+ value = self.visit(value, *args, **kwargs)
+ if value is None:
+ continue
+ elif not isinstance(value, Node):
+ new_values.extend(value)
+ continue
+ new_values.append(value)
+ old_value[:] = new_values
+ elif isinstance(old_value, Node):
+ new_node = self.visit(old_value, *args, **kwargs)
+ if new_node is None:
+ delattr(node, field)
+ else:
+ setattr(node, field, new_node)
+ return node
+
+ def visit_list(self, node, *args, **kwargs):
+ """As transformers may return lists in some places this method
+ can be used to enforce a list as return value.
+ """
+ rv = self.visit(node, *args, **kwargs)
+ if not isinstance(rv, list):
+ rv = [rv]
+ return rv
diff --git a/venv/lib/python2.7/site-packages/MarkupSafe-0.23-py2.7-linux-armv7l.egg/EGG-INFO/PKG-INFO b/venv/lib/python2.7/site-packages/MarkupSafe-0.23-py2.7-linux-armv7l.egg/EGG-INFO/PKG-INFO
new file mode 100644
index 000000000..12aa93e3e
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/MarkupSafe-0.23-py2.7-linux-armv7l.egg/EGG-INFO/PKG-INFO
@@ -0,0 +1,119 @@
+Metadata-Version: 1.1
+Name: MarkupSafe
+Version: 0.23
+Summary: Implements a XML/HTML/XHTML Markup safe string for Python
+Home-page: http://github.com/mitsuhiko/markupsafe
+Author: Armin Ronacher
+Author-email: armin.ronacher@active-4.com
+License: BSD
+Description: MarkupSafe
+ ==========
+
+ Implements a unicode subclass that supports HTML strings:
+
+ >>> from markupsafe import Markup, escape
+ >>> escape("")
+ Markup(u'<script>alert(document.cookie);</script>')
+ >>> tmpl = Markup("%s")
+ >>> tmpl % "Peter > Lustig"
+ Markup(u'Peter > Lustig')
+
+ If you want to make an object unicode that is not yet unicode
+ but don't want to lose the taint information, you can use the
+ `soft_unicode` function. (On Python 3 you can also use `soft_str` which
+ is a different name for the same function).
+
+ >>> from markupsafe import soft_unicode
+ >>> soft_unicode(42)
+ u'42'
+ >>> soft_unicode(Markup('foo'))
+ Markup(u'foo')
+
+ HTML Representations
+ --------------------
+
+ Objects can customize their HTML markup equivalent by overriding
+ the `__html__` function:
+
+ >>> class Foo(object):
+ ... def __html__(self):
+ ... return 'Nice'
+ ...
+ >>> escape(Foo())
+ Markup(u'Nice')
+ >>> Markup(Foo())
+ Markup(u'Nice')
+
+ Silent Escapes
+ --------------
+
+ Since MarkupSafe 0.10 there is now also a separate escape function
+ called `escape_silent` that returns an empty string for `None` for
+ consistency with other systems that return empty strings for `None`
+ when escaping (for instance Pylons' webhelpers).
+
+ If you also want to use this for the escape method of the Markup
+ object, you can create your own subclass that does that::
+
+ from markupsafe import Markup, escape_silent as escape
+
+ class SilentMarkup(Markup):
+ __slots__ = ()
+
+ @classmethod
+ def escape(cls, s):
+ return cls(escape(s))
+
+ New-Style String Formatting
+ ---------------------------
+
+ Starting with MarkupSafe 0.21 new style string formats from Python 2.6 and
+ 3.x are now fully supported. Previously the escape behavior of those
+ functions was spotty at best. The new implementations operates under the
+ following algorithm:
+
+ 1. if an object has an ``__html_format__`` method it is called as
+ replacement for ``__format__`` with the format specifier. It either
+ has to return a string or markup object.
+ 2. if an object has an ``__html__`` method it is called.
+ 3. otherwise the default format system of Python kicks in and the result
+ is HTML escaped.
+
+ Here is how you can implement your own formatting::
+
+ class User(object):
+
+ def __init__(self, id, username):
+ self.id = id
+ self.username = username
+
+ def __html_format__(self, format_spec):
+ if format_spec == 'link':
+ return Markup('{1}').format(
+ self.id,
+ self.__html__(),
+ )
+ elif format_spec:
+ raise ValueError('Invalid format spec')
+ return self.__html__()
+
+ def __html__(self):
+ return Markup('{0}').format(self.username)
+
+ And to format that user:
+
+ >>> user = User(1, 'foo')
+ >>> Markup('
User: {0:link}').format(user)
+ Markup(u'
User: foo')
+
+Platform: UNKNOWN
+Classifier: Development Status :: 5 - Production/Stable
+Classifier: Environment :: Web Environment
+Classifier: Intended Audience :: Developers
+Classifier: License :: OSI Approved :: BSD License
+Classifier: Operating System :: OS Independent
+Classifier: Programming Language :: Python
+Classifier: Programming Language :: Python :: 3
+Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
+Classifier: Topic :: Software Development :: Libraries :: Python Modules
+Classifier: Topic :: Text Processing :: Markup :: HTML
diff --git a/venv/lib/python2.7/site-packages/MarkupSafe-0.23-py2.7-linux-armv7l.egg/EGG-INFO/SOURCES.txt b/venv/lib/python2.7/site-packages/MarkupSafe-0.23-py2.7-linux-armv7l.egg/EGG-INFO/SOURCES.txt
new file mode 100644
index 000000000..dfeb82b0f
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/MarkupSafe-0.23-py2.7-linux-armv7l.egg/EGG-INFO/SOURCES.txt
@@ -0,0 +1,17 @@
+AUTHORS
+LICENSE
+MANIFEST.in
+README.rst
+setup.cfg
+setup.py
+MarkupSafe.egg-info/PKG-INFO
+MarkupSafe.egg-info/SOURCES.txt
+MarkupSafe.egg-info/dependency_links.txt
+MarkupSafe.egg-info/not-zip-safe
+MarkupSafe.egg-info/top_level.txt
+markupsafe/__init__.py
+markupsafe/_compat.py
+markupsafe/_constants.py
+markupsafe/_native.py
+markupsafe/_speedups.c
+markupsafe/tests.py
\ No newline at end of file
diff --git a/venv/lib/python2.7/site-packages/MarkupSafe-0.23-py2.7-linux-armv7l.egg/EGG-INFO/dependency_links.txt b/venv/lib/python2.7/site-packages/MarkupSafe-0.23-py2.7-linux-armv7l.egg/EGG-INFO/dependency_links.txt
new file mode 100644
index 000000000..8b1378917
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/MarkupSafe-0.23-py2.7-linux-armv7l.egg/EGG-INFO/dependency_links.txt
@@ -0,0 +1 @@
+
diff --git a/venv/lib/python2.7/site-packages/MarkupSafe-0.23-py2.7-linux-armv7l.egg/EGG-INFO/native_libs.txt b/venv/lib/python2.7/site-packages/MarkupSafe-0.23-py2.7-linux-armv7l.egg/EGG-INFO/native_libs.txt
new file mode 100644
index 000000000..21e5cc040
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/MarkupSafe-0.23-py2.7-linux-armv7l.egg/EGG-INFO/native_libs.txt
@@ -0,0 +1 @@
+markupsafe/_speedups.so
diff --git a/venv/lib/python2.7/site-packages/MarkupSafe-0.23-py2.7-linux-armv7l.egg/EGG-INFO/not-zip-safe b/venv/lib/python2.7/site-packages/MarkupSafe-0.23-py2.7-linux-armv7l.egg/EGG-INFO/not-zip-safe
new file mode 100644
index 000000000..8b1378917
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/MarkupSafe-0.23-py2.7-linux-armv7l.egg/EGG-INFO/not-zip-safe
@@ -0,0 +1 @@
+
diff --git a/venv/lib/python2.7/site-packages/MarkupSafe-0.23-py2.7-linux-armv7l.egg/EGG-INFO/top_level.txt b/venv/lib/python2.7/site-packages/MarkupSafe-0.23-py2.7-linux-armv7l.egg/EGG-INFO/top_level.txt
new file mode 100644
index 000000000..75bf72925
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/MarkupSafe-0.23-py2.7-linux-armv7l.egg/EGG-INFO/top_level.txt
@@ -0,0 +1 @@
+markupsafe
diff --git a/venv/lib/python2.7/site-packages/MarkupSafe-0.23-py2.7-linux-armv7l.egg/markupsafe/__init__.py b/venv/lib/python2.7/site-packages/MarkupSafe-0.23-py2.7-linux-armv7l.egg/markupsafe/__init__.py
new file mode 100644
index 000000000..275540154
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/MarkupSafe-0.23-py2.7-linux-armv7l.egg/markupsafe/__init__.py
@@ -0,0 +1,298 @@
+# -*- coding: utf-8 -*-
+"""
+ markupsafe
+ ~~~~~~~~~~
+
+ Implements a Markup string.
+
+ :copyright: (c) 2010 by Armin Ronacher.
+ :license: BSD, see LICENSE for more details.
+"""
+import re
+import string
+from collections import Mapping
+from markupsafe._compat import text_type, string_types, int_types, \
+ unichr, iteritems, PY2
+
+
+__all__ = ['Markup', 'soft_unicode', 'escape', 'escape_silent']
+
+
+_striptags_re = re.compile(r'(|<[^>]*>)')
+_entity_re = re.compile(r'&([^;]+);')
+
+
+class Markup(text_type):
+ r"""Marks a string as being safe for inclusion in HTML/XML output without
+ needing to be escaped. This implements the `__html__` interface a couple
+ of frameworks and web applications use. :class:`Markup` is a direct
+ subclass of `unicode` and provides all the methods of `unicode` just that
+ it escapes arguments passed and always returns `Markup`.
+
+ The `escape` function returns markup objects so that double escaping can't
+ happen.
+
+ The constructor of the :class:`Markup` class can be used for three
+ different things: When passed an unicode object it's assumed to be safe,
+ when passed an object with an HTML representation (has an `__html__`
+ method) that representation is used, otherwise the object passed is
+ converted into a unicode string and then assumed to be safe:
+
+ >>> Markup("Hello World!")
+ Markup(u'Hello World!')
+ >>> class Foo(object):
+ ... def __html__(self):
+ ... return 'foo'
+ ...
+ >>> Markup(Foo())
+ Markup(u'foo')
+
+ If you want object passed being always treated as unsafe you can use the
+ :meth:`escape` classmethod to create a :class:`Markup` object:
+
+ >>> Markup.escape("Hello World!")
+ Markup(u'Hello <em>World</em>!')
+
+ Operations on a markup string are markup aware which means that all
+ arguments are passed through the :func:`escape` function:
+
+ >>> em = Markup("%s")
+ >>> em % "foo & bar"
+ Markup(u'foo & bar')
+ >>> strong = Markup("%(text)s")
+ >>> strong % {'text': ''}
+ Markup(u'<blink>hacker here</blink>')
+ >>> Markup("Hello ") + ""
+ Markup(u'Hello <foo>')
+ """
+ __slots__ = ()
+
+ def __new__(cls, base=u'', encoding=None, errors='strict'):
+ if hasattr(base, '__html__'):
+ base = base.__html__()
+ if encoding is None:
+ return text_type.__new__(cls, base)
+ return text_type.__new__(cls, base, encoding, errors)
+
+ def __html__(self):
+ return self
+
+ def __add__(self, other):
+ if isinstance(other, string_types) or hasattr(other, '__html__'):
+ return self.__class__(super(Markup, self).__add__(self.escape(other)))
+ return NotImplemented
+
+ def __radd__(self, other):
+ if hasattr(other, '__html__') or isinstance(other, string_types):
+ return self.escape(other).__add__(self)
+ return NotImplemented
+
+ def __mul__(self, num):
+ if isinstance(num, int_types):
+ return self.__class__(text_type.__mul__(self, num))
+ return NotImplemented
+ __rmul__ = __mul__
+
+ def __mod__(self, arg):
+ if isinstance(arg, tuple):
+ arg = tuple(_MarkupEscapeHelper(x, self.escape) for x in arg)
+ else:
+ arg = _MarkupEscapeHelper(arg, self.escape)
+ return self.__class__(text_type.__mod__(self, arg))
+
+ def __repr__(self):
+ return '%s(%s)' % (
+ self.__class__.__name__,
+ text_type.__repr__(self)
+ )
+
+ def join(self, seq):
+ return self.__class__(text_type.join(self, map(self.escape, seq)))
+ join.__doc__ = text_type.join.__doc__
+
+ def split(self, *args, **kwargs):
+ return list(map(self.__class__, text_type.split(self, *args, **kwargs)))
+ split.__doc__ = text_type.split.__doc__
+
+ def rsplit(self, *args, **kwargs):
+ return list(map(self.__class__, text_type.rsplit(self, *args, **kwargs)))
+ rsplit.__doc__ = text_type.rsplit.__doc__
+
+ def splitlines(self, *args, **kwargs):
+ return list(map(self.__class__, text_type.splitlines(
+ self, *args, **kwargs)))
+ splitlines.__doc__ = text_type.splitlines.__doc__
+
+ def unescape(self):
+ r"""Unescape markup again into an text_type string. This also resolves
+ known HTML4 and XHTML entities:
+
+ >>> Markup("Main » About").unescape()
+ u'Main \xbb About'
+ """
+ from markupsafe._constants import HTML_ENTITIES
+ def handle_match(m):
+ name = m.group(1)
+ if name in HTML_ENTITIES:
+ return unichr(HTML_ENTITIES[name])
+ try:
+ if name[:2] in ('#x', '#X'):
+ return unichr(int(name[2:], 16))
+ elif name.startswith('#'):
+ return unichr(int(name[1:]))
+ except ValueError:
+ pass
+ return u''
+ return _entity_re.sub(handle_match, text_type(self))
+
+ def striptags(self):
+ r"""Unescape markup into an text_type string and strip all tags. This
+ also resolves known HTML4 and XHTML entities. Whitespace is
+ normalized to one:
+
+ >>> Markup("Main » About").striptags()
+ u'Main \xbb About'
+ """
+ stripped = u' '.join(_striptags_re.sub('', self).split())
+ return Markup(stripped).unescape()
+
+ @classmethod
+ def escape(cls, s):
+ """Escape the string. Works like :func:`escape` with the difference
+ that for subclasses of :class:`Markup` this function would return the
+ correct subclass.
+ """
+ rv = escape(s)
+ if rv.__class__ is not cls:
+ return cls(rv)
+ return rv
+
+ def make_simple_escaping_wrapper(name):
+ orig = getattr(text_type, name)
+ def func(self, *args, **kwargs):
+ args = _escape_argspec(list(args), enumerate(args), self.escape)
+ _escape_argspec(kwargs, iteritems(kwargs), self.escape)
+ return self.__class__(orig(self, *args, **kwargs))
+ func.__name__ = orig.__name__
+ func.__doc__ = orig.__doc__
+ return func
+
+ for method in '__getitem__', 'capitalize', \
+ 'title', 'lower', 'upper', 'replace', 'ljust', \
+ 'rjust', 'lstrip', 'rstrip', 'center', 'strip', \
+ 'translate', 'expandtabs', 'swapcase', 'zfill':
+ locals()[method] = make_simple_escaping_wrapper(method)
+
+ # new in python 2.5
+ if hasattr(text_type, 'partition'):
+ def partition(self, sep):
+ return tuple(map(self.__class__,
+ text_type.partition(self, self.escape(sep))))
+ def rpartition(self, sep):
+ return tuple(map(self.__class__,
+ text_type.rpartition(self, self.escape(sep))))
+
+ # new in python 2.6
+ if hasattr(text_type, 'format'):
+ def format(*args, **kwargs):
+ self, args = args[0], args[1:]
+ formatter = EscapeFormatter(self.escape)
+ kwargs = _MagicFormatMapping(args, kwargs)
+ return self.__class__(formatter.vformat(self, args, kwargs))
+
+ def __html_format__(self, format_spec):
+ if format_spec:
+ raise ValueError('Unsupported format specification '
+ 'for Markup.')
+ return self
+
+ # not in python 3
+ if hasattr(text_type, '__getslice__'):
+ __getslice__ = make_simple_escaping_wrapper('__getslice__')
+
+ del method, make_simple_escaping_wrapper
+
+
+class _MagicFormatMapping(Mapping):
+ """This class implements a dummy wrapper to fix a bug in the Python
+ standard library for string formatting.
+
+ See http://bugs.python.org/issue13598 for information about why
+ this is necessary.
+ """
+
+ def __init__(self, args, kwargs):
+ self._args = args
+ self._kwargs = kwargs
+ self._last_index = 0
+
+ def __getitem__(self, key):
+ if key == '':
+ idx = self._last_index
+ self._last_index += 1
+ try:
+ return self._args[idx]
+ except LookupError:
+ pass
+ key = str(idx)
+ return self._kwargs[key]
+
+ def __iter__(self):
+ return iter(self._kwargs)
+
+ def __len__(self):
+ return len(self._kwargs)
+
+
+if hasattr(text_type, 'format'):
+ class EscapeFormatter(string.Formatter):
+
+ def __init__(self, escape):
+ self.escape = escape
+
+ def format_field(self, value, format_spec):
+ if hasattr(value, '__html_format__'):
+ rv = value.__html_format__(format_spec)
+ elif hasattr(value, '__html__'):
+ if format_spec:
+ raise ValueError('No format specification allowed '
+ 'when formatting an object with '
+ 'its __html__ method.')
+ rv = value.__html__()
+ else:
+ rv = string.Formatter.format_field(self, value, format_spec)
+ return text_type(self.escape(rv))
+
+
+def _escape_argspec(obj, iterable, escape):
+ """Helper for various string-wrapped functions."""
+ for key, value in iterable:
+ if hasattr(value, '__html__') or isinstance(value, string_types):
+ obj[key] = escape(value)
+ return obj
+
+
+class _MarkupEscapeHelper(object):
+ """Helper for Markup.__mod__"""
+
+ def __init__(self, obj, escape):
+ self.obj = obj
+ self.escape = escape
+
+ __getitem__ = lambda s, x: _MarkupEscapeHelper(s.obj[x], s.escape)
+ __unicode__ = __str__ = lambda s: text_type(s.escape(s.obj))
+ __repr__ = lambda s: str(s.escape(repr(s.obj)))
+ __int__ = lambda s: int(s.obj)
+ __float__ = lambda s: float(s.obj)
+
+
+# we have to import it down here as the speedups and native
+# modules imports the markup type which is define above.
+try:
+ from markupsafe._speedups import escape, escape_silent, soft_unicode
+except ImportError:
+ from markupsafe._native import escape, escape_silent, soft_unicode
+
+if not PY2:
+ soft_str = soft_unicode
+ __all__.append('soft_str')
diff --git a/venv/lib/python2.7/site-packages/MarkupSafe-0.23-py2.7-linux-armv7l.egg/markupsafe/_compat.py b/venv/lib/python2.7/site-packages/MarkupSafe-0.23-py2.7-linux-armv7l.egg/markupsafe/_compat.py
new file mode 100644
index 000000000..62e5632ad
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/MarkupSafe-0.23-py2.7-linux-armv7l.egg/markupsafe/_compat.py
@@ -0,0 +1,26 @@
+# -*- coding: utf-8 -*-
+"""
+ markupsafe._compat
+ ~~~~~~~~~~~~~~~~~~
+
+ Compatibility module for different Python versions.
+
+ :copyright: (c) 2013 by Armin Ronacher.
+ :license: BSD, see LICENSE for more details.
+"""
+import sys
+
+PY2 = sys.version_info[0] == 2
+
+if not PY2:
+ text_type = str
+ string_types = (str,)
+ unichr = chr
+ int_types = (int,)
+ iteritems = lambda x: iter(x.items())
+else:
+ text_type = unicode
+ string_types = (str, unicode)
+ unichr = unichr
+ int_types = (int, long)
+ iteritems = lambda x: x.iteritems()
diff --git a/venv/lib/python2.7/site-packages/MarkupSafe-0.23-py2.7-linux-armv7l.egg/markupsafe/_constants.py b/venv/lib/python2.7/site-packages/MarkupSafe-0.23-py2.7-linux-armv7l.egg/markupsafe/_constants.py
new file mode 100644
index 000000000..919bf03c5
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/MarkupSafe-0.23-py2.7-linux-armv7l.egg/markupsafe/_constants.py
@@ -0,0 +1,267 @@
+# -*- coding: utf-8 -*-
+"""
+ markupsafe._constants
+ ~~~~~~~~~~~~~~~~~~~~~
+
+ Highlevel implementation of the Markup string.
+
+ :copyright: (c) 2010 by Armin Ronacher.
+ :license: BSD, see LICENSE for more details.
+"""
+
+
+HTML_ENTITIES = {
+ 'AElig': 198,
+ 'Aacute': 193,
+ 'Acirc': 194,
+ 'Agrave': 192,
+ 'Alpha': 913,
+ 'Aring': 197,
+ 'Atilde': 195,
+ 'Auml': 196,
+ 'Beta': 914,
+ 'Ccedil': 199,
+ 'Chi': 935,
+ 'Dagger': 8225,
+ 'Delta': 916,
+ 'ETH': 208,
+ 'Eacute': 201,
+ 'Ecirc': 202,
+ 'Egrave': 200,
+ 'Epsilon': 917,
+ 'Eta': 919,
+ 'Euml': 203,
+ 'Gamma': 915,
+ 'Iacute': 205,
+ 'Icirc': 206,
+ 'Igrave': 204,
+ 'Iota': 921,
+ 'Iuml': 207,
+ 'Kappa': 922,
+ 'Lambda': 923,
+ 'Mu': 924,
+ 'Ntilde': 209,
+ 'Nu': 925,
+ 'OElig': 338,
+ 'Oacute': 211,
+ 'Ocirc': 212,
+ 'Ograve': 210,
+ 'Omega': 937,
+ 'Omicron': 927,
+ 'Oslash': 216,
+ 'Otilde': 213,
+ 'Ouml': 214,
+ 'Phi': 934,
+ 'Pi': 928,
+ 'Prime': 8243,
+ 'Psi': 936,
+ 'Rho': 929,
+ 'Scaron': 352,
+ 'Sigma': 931,
+ 'THORN': 222,
+ 'Tau': 932,
+ 'Theta': 920,
+ 'Uacute': 218,
+ 'Ucirc': 219,
+ 'Ugrave': 217,
+ 'Upsilon': 933,
+ 'Uuml': 220,
+ 'Xi': 926,
+ 'Yacute': 221,
+ 'Yuml': 376,
+ 'Zeta': 918,
+ 'aacute': 225,
+ 'acirc': 226,
+ 'acute': 180,
+ 'aelig': 230,
+ 'agrave': 224,
+ 'alefsym': 8501,
+ 'alpha': 945,
+ 'amp': 38,
+ 'and': 8743,
+ 'ang': 8736,
+ 'apos': 39,
+ 'aring': 229,
+ 'asymp': 8776,
+ 'atilde': 227,
+ 'auml': 228,
+ 'bdquo': 8222,
+ 'beta': 946,
+ 'brvbar': 166,
+ 'bull': 8226,
+ 'cap': 8745,
+ 'ccedil': 231,
+ 'cedil': 184,
+ 'cent': 162,
+ 'chi': 967,
+ 'circ': 710,
+ 'clubs': 9827,
+ 'cong': 8773,
+ 'copy': 169,
+ 'crarr': 8629,
+ 'cup': 8746,
+ 'curren': 164,
+ 'dArr': 8659,
+ 'dagger': 8224,
+ 'darr': 8595,
+ 'deg': 176,
+ 'delta': 948,
+ 'diams': 9830,
+ 'divide': 247,
+ 'eacute': 233,
+ 'ecirc': 234,
+ 'egrave': 232,
+ 'empty': 8709,
+ 'emsp': 8195,
+ 'ensp': 8194,
+ 'epsilon': 949,
+ 'equiv': 8801,
+ 'eta': 951,
+ 'eth': 240,
+ 'euml': 235,
+ 'euro': 8364,
+ 'exist': 8707,
+ 'fnof': 402,
+ 'forall': 8704,
+ 'frac12': 189,
+ 'frac14': 188,
+ 'frac34': 190,
+ 'frasl': 8260,
+ 'gamma': 947,
+ 'ge': 8805,
+ 'gt': 62,
+ 'hArr': 8660,
+ 'harr': 8596,
+ 'hearts': 9829,
+ 'hellip': 8230,
+ 'iacute': 237,
+ 'icirc': 238,
+ 'iexcl': 161,
+ 'igrave': 236,
+ 'image': 8465,
+ 'infin': 8734,
+ 'int': 8747,
+ 'iota': 953,
+ 'iquest': 191,
+ 'isin': 8712,
+ 'iuml': 239,
+ 'kappa': 954,
+ 'lArr': 8656,
+ 'lambda': 955,
+ 'lang': 9001,
+ 'laquo': 171,
+ 'larr': 8592,
+ 'lceil': 8968,
+ 'ldquo': 8220,
+ 'le': 8804,
+ 'lfloor': 8970,
+ 'lowast': 8727,
+ 'loz': 9674,
+ 'lrm': 8206,
+ 'lsaquo': 8249,
+ 'lsquo': 8216,
+ 'lt': 60,
+ 'macr': 175,
+ 'mdash': 8212,
+ 'micro': 181,
+ 'middot': 183,
+ 'minus': 8722,
+ 'mu': 956,
+ 'nabla': 8711,
+ 'nbsp': 160,
+ 'ndash': 8211,
+ 'ne': 8800,
+ 'ni': 8715,
+ 'not': 172,
+ 'notin': 8713,
+ 'nsub': 8836,
+ 'ntilde': 241,
+ 'nu': 957,
+ 'oacute': 243,
+ 'ocirc': 244,
+ 'oelig': 339,
+ 'ograve': 242,
+ 'oline': 8254,
+ 'omega': 969,
+ 'omicron': 959,
+ 'oplus': 8853,
+ 'or': 8744,
+ 'ordf': 170,
+ 'ordm': 186,
+ 'oslash': 248,
+ 'otilde': 245,
+ 'otimes': 8855,
+ 'ouml': 246,
+ 'para': 182,
+ 'part': 8706,
+ 'permil': 8240,
+ 'perp': 8869,
+ 'phi': 966,
+ 'pi': 960,
+ 'piv': 982,
+ 'plusmn': 177,
+ 'pound': 163,
+ 'prime': 8242,
+ 'prod': 8719,
+ 'prop': 8733,
+ 'psi': 968,
+ 'quot': 34,
+ 'rArr': 8658,
+ 'radic': 8730,
+ 'rang': 9002,
+ 'raquo': 187,
+ 'rarr': 8594,
+ 'rceil': 8969,
+ 'rdquo': 8221,
+ 'real': 8476,
+ 'reg': 174,
+ 'rfloor': 8971,
+ 'rho': 961,
+ 'rlm': 8207,
+ 'rsaquo': 8250,
+ 'rsquo': 8217,
+ 'sbquo': 8218,
+ 'scaron': 353,
+ 'sdot': 8901,
+ 'sect': 167,
+ 'shy': 173,
+ 'sigma': 963,
+ 'sigmaf': 962,
+ 'sim': 8764,
+ 'spades': 9824,
+ 'sub': 8834,
+ 'sube': 8838,
+ 'sum': 8721,
+ 'sup': 8835,
+ 'sup1': 185,
+ 'sup2': 178,
+ 'sup3': 179,
+ 'supe': 8839,
+ 'szlig': 223,
+ 'tau': 964,
+ 'there4': 8756,
+ 'theta': 952,
+ 'thetasym': 977,
+ 'thinsp': 8201,
+ 'thorn': 254,
+ 'tilde': 732,
+ 'times': 215,
+ 'trade': 8482,
+ 'uArr': 8657,
+ 'uacute': 250,
+ 'uarr': 8593,
+ 'ucirc': 251,
+ 'ugrave': 249,
+ 'uml': 168,
+ 'upsih': 978,
+ 'upsilon': 965,
+ 'uuml': 252,
+ 'weierp': 8472,
+ 'xi': 958,
+ 'yacute': 253,
+ 'yen': 165,
+ 'yuml': 255,
+ 'zeta': 950,
+ 'zwj': 8205,
+ 'zwnj': 8204
+}
diff --git a/venv/lib/python2.7/site-packages/MarkupSafe-0.23-py2.7-linux-armv7l.egg/markupsafe/_native.py b/venv/lib/python2.7/site-packages/MarkupSafe-0.23-py2.7-linux-armv7l.egg/markupsafe/_native.py
new file mode 100644
index 000000000..5e83f10a1
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/MarkupSafe-0.23-py2.7-linux-armv7l.egg/markupsafe/_native.py
@@ -0,0 +1,46 @@
+# -*- coding: utf-8 -*-
+"""
+ markupsafe._native
+ ~~~~~~~~~~~~~~~~~~
+
+ Native Python implementation the C module is not compiled.
+
+ :copyright: (c) 2010 by Armin Ronacher.
+ :license: BSD, see LICENSE for more details.
+"""
+from markupsafe import Markup
+from markupsafe._compat import text_type
+
+
+def escape(s):
+ """Convert the characters &, <, >, ' and " in string s to HTML-safe
+ sequences. Use this if you need to display text that might contain
+ such characters in HTML. Marks return value as markup string.
+ """
+ if hasattr(s, '__html__'):
+ return s.__html__()
+ return Markup(text_type(s)
+ .replace('&', '&')
+ .replace('>', '>')
+ .replace('<', '<')
+ .replace("'", ''')
+ .replace('"', '"')
+ )
+
+
+def escape_silent(s):
+ """Like :func:`escape` but converts `None` into an empty
+ markup string.
+ """
+ if s is None:
+ return Markup()
+ return escape(s)
+
+
+def soft_unicode(s):
+ """Make a string unicode if it isn't already. That way a markup
+ string is not converted back to unicode.
+ """
+ if not isinstance(s, text_type):
+ s = text_type(s)
+ return s
diff --git a/venv/lib/python2.7/site-packages/MarkupSafe-0.23-py2.7-linux-armv7l.egg/markupsafe/_speedups.c b/venv/lib/python2.7/site-packages/MarkupSafe-0.23-py2.7-linux-armv7l.egg/markupsafe/_speedups.c
new file mode 100644
index 000000000..f349febf2
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/MarkupSafe-0.23-py2.7-linux-armv7l.egg/markupsafe/_speedups.c
@@ -0,0 +1,239 @@
+/**
+ * markupsafe._speedups
+ * ~~~~~~~~~~~~~~~~~~~~
+ *
+ * This module implements functions for automatic escaping in C for better
+ * performance.
+ *
+ * :copyright: (c) 2010 by Armin Ronacher.
+ * :license: BSD.
+ */
+
+#include
+
+#define ESCAPED_CHARS_TABLE_SIZE 63
+#define UNICHR(x) (PyUnicode_AS_UNICODE((PyUnicodeObject*)PyUnicode_DecodeASCII(x, strlen(x), NULL)));
+
+#if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN)
+typedef int Py_ssize_t;
+#define PY_SSIZE_T_MAX INT_MAX
+#define PY_SSIZE_T_MIN INT_MIN
+#endif
+
+
+static PyObject* markup;
+static Py_ssize_t escaped_chars_delta_len[ESCAPED_CHARS_TABLE_SIZE];
+static Py_UNICODE *escaped_chars_repl[ESCAPED_CHARS_TABLE_SIZE];
+
+static int
+init_constants(void)
+{
+ PyObject *module;
+ /* happing of characters to replace */
+ escaped_chars_repl['"'] = UNICHR(""");
+ escaped_chars_repl['\''] = UNICHR("'");
+ escaped_chars_repl['&'] = UNICHR("&");
+ escaped_chars_repl['<'] = UNICHR("<");
+ escaped_chars_repl['>'] = UNICHR(">");
+
+ /* lengths of those characters when replaced - 1 */
+ memset(escaped_chars_delta_len, 0, sizeof (escaped_chars_delta_len));
+ escaped_chars_delta_len['"'] = escaped_chars_delta_len['\''] = \
+ escaped_chars_delta_len['&'] = 4;
+ escaped_chars_delta_len['<'] = escaped_chars_delta_len['>'] = 3;
+
+ /* import markup type so that we can mark the return value */
+ module = PyImport_ImportModule("markupsafe");
+ if (!module)
+ return 0;
+ markup = PyObject_GetAttrString(module, "Markup");
+ Py_DECREF(module);
+
+ return 1;
+}
+
+static PyObject*
+escape_unicode(PyUnicodeObject *in)
+{
+ PyUnicodeObject *out;
+ Py_UNICODE *inp = PyUnicode_AS_UNICODE(in);
+ const Py_UNICODE *inp_end = PyUnicode_AS_UNICODE(in) + PyUnicode_GET_SIZE(in);
+ Py_UNICODE *next_escp;
+ Py_UNICODE *outp;
+ Py_ssize_t delta=0, erepl=0, delta_len=0;
+
+ /* First we need to figure out how long the escaped string will be */
+ while (*(inp) || inp < inp_end) {
+ if (*inp < ESCAPED_CHARS_TABLE_SIZE) {
+ delta += escaped_chars_delta_len[*inp];
+ erepl += !!escaped_chars_delta_len[*inp];
+ }
+ ++inp;
+ }
+
+ /* Do we need to escape anything at all? */
+ if (!erepl) {
+ Py_INCREF(in);
+ return (PyObject*)in;
+ }
+
+ out = (PyUnicodeObject*)PyUnicode_FromUnicode(NULL, PyUnicode_GET_SIZE(in) + delta);
+ if (!out)
+ return NULL;
+
+ outp = PyUnicode_AS_UNICODE(out);
+ inp = PyUnicode_AS_UNICODE(in);
+ while (erepl-- > 0) {
+ /* look for the next substitution */
+ next_escp = inp;
+ while (next_escp < inp_end) {
+ if (*next_escp < ESCAPED_CHARS_TABLE_SIZE &&
+ (delta_len = escaped_chars_delta_len[*next_escp])) {
+ ++delta_len;
+ break;
+ }
+ ++next_escp;
+ }
+
+ if (next_escp > inp) {
+ /* copy unescaped chars between inp and next_escp */
+ Py_UNICODE_COPY(outp, inp, next_escp-inp);
+ outp += next_escp - inp;
+ }
+
+ /* escape 'next_escp' */
+ Py_UNICODE_COPY(outp, escaped_chars_repl[*next_escp], delta_len);
+ outp += delta_len;
+
+ inp = next_escp + 1;
+ }
+ if (inp < inp_end)
+ Py_UNICODE_COPY(outp, inp, PyUnicode_GET_SIZE(in) - (inp - PyUnicode_AS_UNICODE(in)));
+
+ return (PyObject*)out;
+}
+
+
+static PyObject*
+escape(PyObject *self, PyObject *text)
+{
+ PyObject *s = NULL, *rv = NULL, *html;
+
+ /* we don't have to escape integers, bools or floats */
+ if (PyLong_CheckExact(text) ||
+#if PY_MAJOR_VERSION < 3
+ PyInt_CheckExact(text) ||
+#endif
+ PyFloat_CheckExact(text) || PyBool_Check(text) ||
+ text == Py_None)
+ return PyObject_CallFunctionObjArgs(markup, text, NULL);
+
+ /* if the object has an __html__ method that performs the escaping */
+ html = PyObject_GetAttrString(text, "__html__");
+ if (html) {
+ rv = PyObject_CallObject(html, NULL);
+ Py_DECREF(html);
+ return rv;
+ }
+
+ /* otherwise make the object unicode if it isn't, then escape */
+ PyErr_Clear();
+ if (!PyUnicode_Check(text)) {
+#if PY_MAJOR_VERSION < 3
+ PyObject *unicode = PyObject_Unicode(text);
+#else
+ PyObject *unicode = PyObject_Str(text);
+#endif
+ if (!unicode)
+ return NULL;
+ s = escape_unicode((PyUnicodeObject*)unicode);
+ Py_DECREF(unicode);
+ }
+ else
+ s = escape_unicode((PyUnicodeObject*)text);
+
+ /* convert the unicode string into a markup object. */
+ rv = PyObject_CallFunctionObjArgs(markup, (PyObject*)s, NULL);
+ Py_DECREF(s);
+ return rv;
+}
+
+
+static PyObject*
+escape_silent(PyObject *self, PyObject *text)
+{
+ if (text != Py_None)
+ return escape(self, text);
+ return PyObject_CallFunctionObjArgs(markup, NULL);
+}
+
+
+static PyObject*
+soft_unicode(PyObject *self, PyObject *s)
+{
+ if (!PyUnicode_Check(s))
+#if PY_MAJOR_VERSION < 3
+ return PyObject_Unicode(s);
+#else
+ return PyObject_Str(s);
+#endif
+ Py_INCREF(s);
+ return s;
+}
+
+
+static PyMethodDef module_methods[] = {
+ {"escape", (PyCFunction)escape, METH_O,
+ "escape(s) -> markup\n\n"
+ "Convert the characters &, <, >, ', and \" in string s to HTML-safe\n"
+ "sequences. Use this if you need to display text that might contain\n"
+ "such characters in HTML. Marks return value as markup string."},
+ {"escape_silent", (PyCFunction)escape_silent, METH_O,
+ "escape_silent(s) -> markup\n\n"
+ "Like escape but converts None to an empty string."},
+ {"soft_unicode", (PyCFunction)soft_unicode, METH_O,
+ "soft_unicode(object) -> string\n\n"
+ "Make a string unicode if it isn't already. That way a markup\n"
+ "string is not converted back to unicode."},
+ {NULL, NULL, 0, NULL} /* Sentinel */
+};
+
+
+#if PY_MAJOR_VERSION < 3
+
+#ifndef PyMODINIT_FUNC /* declarations for DLL import/export */
+#define PyMODINIT_FUNC void
+#endif
+PyMODINIT_FUNC
+init_speedups(void)
+{
+ if (!init_constants())
+ return;
+
+ Py_InitModule3("markupsafe._speedups", module_methods, "");
+}
+
+#else /* Python 3.x module initialization */
+
+static struct PyModuleDef module_definition = {
+ PyModuleDef_HEAD_INIT,
+ "markupsafe._speedups",
+ NULL,
+ -1,
+ module_methods,
+ NULL,
+ NULL,
+ NULL,
+ NULL
+};
+
+PyMODINIT_FUNC
+PyInit__speedups(void)
+{
+ if (!init_constants())
+ return NULL;
+
+ return PyModule_Create(&module_definition);
+}
+
+#endif
diff --git a/venv/lib/python2.7/site-packages/MarkupSafe-0.23-py2.7-linux-armv7l.egg/markupsafe/_speedups.py b/venv/lib/python2.7/site-packages/MarkupSafe-0.23-py2.7-linux-armv7l.egg/markupsafe/_speedups.py
new file mode 100644
index 000000000..4dade56cd
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/MarkupSafe-0.23-py2.7-linux-armv7l.egg/markupsafe/_speedups.py
@@ -0,0 +1,7 @@
+def __bootstrap__():
+ global __bootstrap__, __loader__, __file__
+ import sys, pkg_resources, imp
+ __file__ = pkg_resources.resource_filename(__name__, '_speedups.so')
+ __loader__ = None; del __bootstrap__, __loader__
+ imp.load_dynamic(__name__,__file__)
+__bootstrap__()
diff --git a/venv/lib/python2.7/site-packages/MarkupSafe-0.23-py2.7-linux-armv7l.egg/markupsafe/_speedups.so b/venv/lib/python2.7/site-packages/MarkupSafe-0.23-py2.7-linux-armv7l.egg/markupsafe/_speedups.so
new file mode 100755
index 000000000..4b81c5150
Binary files /dev/null and b/venv/lib/python2.7/site-packages/MarkupSafe-0.23-py2.7-linux-armv7l.egg/markupsafe/_speedups.so differ
diff --git a/venv/lib/python2.7/site-packages/MarkupSafe-0.23-py2.7-linux-armv7l.egg/markupsafe/tests.py b/venv/lib/python2.7/site-packages/MarkupSafe-0.23-py2.7-linux-armv7l.egg/markupsafe/tests.py
new file mode 100644
index 000000000..636993629
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/MarkupSafe-0.23-py2.7-linux-armv7l.egg/markupsafe/tests.py
@@ -0,0 +1,179 @@
+# -*- coding: utf-8 -*-
+import gc
+import sys
+import unittest
+from markupsafe import Markup, escape, escape_silent
+from markupsafe._compat import text_type
+
+
+class MarkupTestCase(unittest.TestCase):
+
+ def test_adding(self):
+ # adding two strings should escape the unsafe one
+ unsafe = ''
+ safe = Markup('username')
+ assert unsafe + safe == text_type(escape(unsafe)) + text_type(safe)
+
+ def test_string_interpolation(self):
+ # string interpolations are safe to use too
+ assert Markup('%s') % '' == \
+ '<bad user>'
+ assert Markup('%(username)s') % {
+ 'username': ''
+ } == '<bad user>'
+
+ assert Markup('%i') % 3.14 == '3'
+ assert Markup('%.2f') % 3.14 == '3.14'
+
+ def test_type_behavior(self):
+ # an escaped object is markup too
+ assert type(Markup('foo') + 'bar') is Markup
+
+ # and it implements __html__ by returning itself
+ x = Markup("foo")
+ assert x.__html__() is x
+
+ def test_html_interop(self):
+ # it also knows how to treat __html__ objects
+ class Foo(object):
+ def __html__(self):
+ return 'awesome'
+ def __unicode__(self):
+ return 'awesome'
+ __str__ = __unicode__
+ assert Markup(Foo()) == 'awesome'
+ assert Markup('%s') % Foo() == \
+ 'awesome'
+
+ def test_tuple_interpol(self):
+ self.assertEqual(Markup('%s:%s') % (
+ '',
+ '',
+ ), Markup(u'<foo>:<bar>'))
+
+ def test_dict_interpol(self):
+ self.assertEqual(Markup('%(foo)s') % {
+ 'foo': '',
+ }, Markup(u'<foo>'))
+ self.assertEqual(Markup('%(foo)s:%(bar)s') % {
+ 'foo': '',
+ 'bar': '',
+ }, Markup(u'<foo>:<bar>'))
+
+ def test_escaping(self):
+ # escaping and unescaping
+ assert escape('"<>&\'') == '"<>&''
+ assert Markup("Foo & Bar").striptags() == "Foo & Bar"
+ assert Markup("<test>").unescape() == ""
+
+ def test_formatting(self):
+ for actual, expected in (
+ (Markup('%i') % 3.14, '3'),
+ (Markup('%.2f') % 3.14159, '3.14'),
+ (Markup('%s %s %s') % ('<', 123, '>'), '< 123 >'),
+ (Markup('{awesome}').format(awesome=''),
+ '<awesome>'),
+ (Markup('{0[1][bar]}').format([0, {'bar': ''}]),
+ '<bar/>'),
+ (Markup('{0[1][bar]}').format([0, {'bar': Markup('')}]),
+ '')):
+ assert actual == expected, "%r should be %r!" % (actual, expected)
+
+ # This is new in 2.7
+ if sys.version_info >= (2, 7):
+ def test_formatting_empty(self):
+ formatted = Markup('{}').format(0)
+ assert formatted == Markup('0')
+
+ def test_custom_formatting(self):
+ class HasHTMLOnly(object):
+ def __html__(self):
+ return Markup('')
+
+ class HasHTMLAndFormat(object):
+ def __html__(self):
+ return Markup('')
+ def __html_format__(self, spec):
+ return Markup('')
+
+ assert Markup('{0}').format(HasHTMLOnly()) == Markup('')
+ assert Markup('{0}').format(HasHTMLAndFormat()) == Markup('')
+
+ def test_complex_custom_formatting(self):
+ class User(object):
+ def __init__(self, id, username):
+ self.id = id
+ self.username = username
+ def __html_format__(self, format_spec):
+ if format_spec == 'link':
+ return Markup('{1}').format(
+ self.id,
+ self.__html__(),
+ )
+ elif format_spec:
+ raise ValueError('Invalid format spec')
+ return self.__html__()
+ def __html__(self):
+ return Markup('{0}').format(self.username)
+
+ user = User(1, 'foo')
+ assert Markup('
User: {0:link}').format(user) == \
+ Markup('
User: foo')
+
+ def test_all_set(self):
+ import markupsafe as markup
+ for item in markup.__all__:
+ getattr(markup, item)
+
+ def test_escape_silent(self):
+ assert escape_silent(None) == Markup()
+ assert escape(None) == Markup(None)
+ assert escape_silent('') == Markup(u'<foo>')
+
+ def test_splitting(self):
+ self.assertEqual(Markup('a b').split(), [
+ Markup('a'),
+ Markup('b')
+ ])
+ self.assertEqual(Markup('a b').rsplit(), [
+ Markup('a'),
+ Markup('b')
+ ])
+ self.assertEqual(Markup('a\nb').splitlines(), [
+ Markup('a'),
+ Markup('b')
+ ])
+
+ def test_mul(self):
+ self.assertEqual(Markup('a') * 3, Markup('aaa'))
+
+
+class MarkupLeakTestCase(unittest.TestCase):
+
+ def test_markup_leaks(self):
+ counts = set()
+ for count in range(20):
+ for item in range(1000):
+ escape("foo")
+ escape("")
+ escape(u"foo")
+ escape(u"")
+ counts.add(len(gc.get_objects()))
+ assert len(counts) == 1, 'ouch, c extension seems to leak objects'
+
+
+def suite():
+ suite = unittest.TestSuite()
+ suite.addTest(unittest.makeSuite(MarkupTestCase))
+
+ # this test only tests the c extension
+ if not hasattr(escape, 'func_code'):
+ suite.addTest(unittest.makeSuite(MarkupLeakTestCase))
+
+ return suite
+
+
+if __name__ == '__main__':
+ unittest.main(defaultTest='suite')
+
+# vim:sts=4:sw=4:et:
diff --git a/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/EGG-INFO/PKG-INFO b/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/EGG-INFO/PKG-INFO
new file mode 100644
index 000000000..4a1510378
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/EGG-INFO/PKG-INFO
@@ -0,0 +1,162 @@
+Metadata-Version: 1.1
+Name: OctoPrint
+Version: 1.2.8
+Summary: A snappy web interface for 3D printers
+Home-page: http://octoprint.org
+Author: Gina Häußge
+Author-email: osd@foosel.net
+License: AGPLv3
+Description: OctoPrint
+ =========
+
+ OctoPrint provides a snappy web interface for controlling a 3D printer (RepRap, Ultimaker, ...). It is Free Software
+ and released under the [GNU Affero General Public License V3](http://www.gnu.org/licenses/agpl.html).
+
+ Its website can be found at [octoprint.org](http://octoprint.org).
+
+ The documentation is located at [docs.octoprint.org](http://docs.octoprint.org).
+
+ The official plugin repository can be reached at [plugins.octoprint.org](http://plugins.octoprint.org).
+
+ 
+
+ You are currently looking at the source code repository of OctoPrint. If you already installed it
+ (e.g. by using the Raspberry Pi targeted distribution [OctoPi](https://github.com/guysoft/OctoPi)) and only
+ want to find out how to use it, [the documentation](http://docs.octoprint.org/) and [the public wiki](https://github.com/foosel/OctoPrint/wiki)
+ might be of more interest for you. You might also want to subscribe to [the mailing list](https://groups.google.com/group/octoprint)
+ or the [G+ Community](https://plus.google.com/communities/102771308349328485741) where there are other active users who might be
+ able to help you with any questions you might have.
+
+ Contributing
+ ------------
+
+ Contributions of all kinds are welcome, not only in the form of code but also with regards to the
+ [official documentation](http://docs.octoprint.org/) or [the public wiki](https://github.com/foosel/OctoPrint/wiki), support
+ of other users in the [bug tracker](https://github.com/foosel/OctoPrint/issues),
+ [the Mailinglist](https://groups.google.com/group/octoprint) or
+ [the G+ Community](https://plus.google.com/communities/102771308349328485741).
+
+ If you think something is bad as it is about OctoPrint or its documentation the way it is, please help
+ in any way to make it better instead of just complaining about it -- this is an Open Source Project
+ after all :)
+
+ For information about how to go about contributions of any kind, please see the project's
+ [Contribution Guidelines](https://github.com/foosel/OctoPrint/blob/master/CONTRIBUTING.md).
+
+ Installation
+ ------------
+
+ Installation instructions for installing from source for different operating
+ systems can be found [on the wiki](https://github.com/foosel/OctoPrint/wiki#assorted-guides).
+
+ If you want to run OctoPrint on a Raspberry Pi you might want to take a look at [OctoPi](https://github.com/guysoft/OctoPi)
+ which is a custom SD card image that includes OctoPrint plus dependencies.
+
+ The generic steps that should basically be done regardless of operating system
+ and runtime environment are the following (as *regular
+ user*, please keep your hands *off* of the `sudo` command here!) - this assumes
+ you already have Python 2.7, pip and virtualenv set up:
+
+ 1. Checkout OctoPrint: `git clone https://github.com/foosel/OctoPrint.git`
+ 2. Change into the OctoPrint folder: `cd OctoPrint`
+ 3. Create a user-owned virtual environment therein: `virtualenv --system-site-packages venv`
+ 4. Install OctoPrint *into that virtual environment*: `./venv/bin/python setup.py install`
+
+ You may then start the OctoPrint server via `/path/to/OctoPrint/venv/bin/octoprint`, see [Usage](#usage)
+ for details.
+
+ After installation, please make sure you follow the first-run wizard and set up
+ access control as necessary. If you want to not only be notified about new
+ releases but also be able to automatically upgrade to them from within
+ OctoPrint, take a look [at the documentation of the Software Update Plugin](https://github.com/foosel/OctoPrint/wiki/Plugin:-Software-Update#making-octoprint-updateable-on-existing-installations)
+ and at its settings.
+
+ Dependencies
+ ------------
+
+ OctoPrint depends on a couple of python modules to do its job. Those are automatically installed when installing
+ OctoPrint via `setup.py`:
+
+ python setup.py install
+
+ You should also do this every time after pulling from the repository, since the dependencies might have changed.
+
+ OctoPrint currently only supports Python 2.7.
+
+ Usage
+ -----
+
+ Running the `setup.py` script via
+
+ python setup.py install
+
+ installs the `octoprint` script in your Python installation's scripts folder
+ (which depending on whether you installed OctoPrint globally or into a virtual env will be on your `PATH` or not). The
+ following usage examples assume that said `octoprint` script is on your `PATH`.
+
+ You can start the server via
+
+ octoprint
+
+ By default it binds to all interfaces on port 5000 (so pointing your browser to `http://127.0.0.1:5000`
+ will do the trick). If you want to change that, use the additional command line parameters `host` and `port`,
+ which accept the host ip to bind to and the numeric port number respectively. If for example you want the server
+ to only listen on the local interface on port 8080, the command line would be
+
+ octoprint --host=127.0.0.1 --port=8080
+
+ Alternatively, the host and port on which to bind can be defined via the configuration.
+
+ If you want to run OctoPrint as a daemon (only supported on Linux), use
+
+ octoprint --daemon {start|stop|restart} [--pid PIDFILE]
+
+ If you do not supply a custom pidfile location via `--pid PIDFILE`, it will be created at `/tmp/octoprint.pid`.
+
+ You can also specify the configfile or the base directory (for basing off the `uploads`, `timelapse` and `logs` folders),
+ e.g.:
+
+ octoprint --config /path/to/another/config.yaml --basedir /path/to/my/basedir
+
+ See `octoprint --help` for further information.
+
+ OctoPrint also ships with a `run` script in its source directory. You can also invoke that to start up the server, it
+ takes the same command line arguments as the `octoprint` script.
+
+ Configuration
+ -------------
+
+ If not specified via the commandline, the configfile `config.yaml` for OctoPrint is expected in the settings folder,
+ which is located at `~/.octoprint` on Linux, at `%APPDATA%/OctoPrint` on Windows and
+ at `~/Library/Application Support/OctoPrint` on MacOS.
+
+ A comprehensive overview of all available configuration settings can be found
+ [in the docs](http://docs.octoprint.org/en/master/configuration/config_yaml.html).
+ Please note that the most commonly used configuration settings can also easily
+ be edited from OctoPrint's settings dialog.
+
+ Special Thanks
+ --------------
+
+ The development of OctoPrint is sponsored and maintained by [BQ](http://www.bq.com/).
+ Cross-browser testing services are kindly provided by [BrowserStack](http://www.browserstack.com/).
+ Profiling is done with the help of [PyVmMonitor](http://www.pyvmmonitor.com).
+
+Platform: UNKNOWN
+Classifier: Development Status :: 4 - Beta
+Classifier: Environment :: Web Environment
+Classifier: Framework :: Flask
+Classifier: Intended Audience :: Education
+Classifier: Intended Audience :: End Users/Desktop
+Classifier: Intended Audience :: Manufacturing
+Classifier: Intended Audience :: Science/Research
+Classifier: License :: OSI Approved :: GNU Affero General Public License v3
+Classifier: Natural Language :: English
+Classifier: Operating System :: OS Independent
+Classifier: Programming Language :: Python :: 2.7
+Classifier: Programming Language :: JavaScript
+Classifier: Topic :: Internet :: WWW/HTTP
+Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
+Classifier: Topic :: Internet :: WWW/HTTP :: WSGI
+Classifier: Topic :: Printing
+Classifier: Topic :: System :: Networking :: Monitoring
diff --git a/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/EGG-INFO/SOURCES.txt b/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/EGG-INFO/SOURCES.txt
new file mode 100644
index 000000000..ae2ab8c06
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/EGG-INFO/SOURCES.txt
@@ -0,0 +1,285 @@
+MANIFEST.in
+README.md
+requirements.txt
+setup.cfg
+setup.py
+versioneer.py
+src/OctoPrint.egg-info/PKG-INFO
+src/OctoPrint.egg-info/SOURCES.txt
+src/OctoPrint.egg-info/dependency_links.txt
+src/OctoPrint.egg-info/entry_points.txt
+src/OctoPrint.egg-info/not-zip-safe
+src/OctoPrint.egg-info/requires.txt
+src/OctoPrint.egg-info/top_level.txt
+src/octoprint/__init__.py
+src/octoprint/_version.py
+src/octoprint/daemon.py
+src/octoprint/events.py
+src/octoprint/settings.py
+src/octoprint/timelapse.py
+src/octoprint/users.py
+src/octoprint/filemanager/__init__.py
+src/octoprint/filemanager/analysis.py
+src/octoprint/filemanager/destinations.py
+src/octoprint/filemanager/storage.py
+src/octoprint/filemanager/util.py
+src/octoprint/plugin/__init__.py
+src/octoprint/plugin/core.py
+src/octoprint/plugin/types.py
+src/octoprint/plugins/cura/__init__.py
+src/octoprint/plugins/cura/profile.py
+src/octoprint/plugins/cura/profiles/default.profile.yaml
+src/octoprint/plugins/cura/static/css/cura.css
+src/octoprint/plugins/cura/static/js/cura.js
+src/octoprint/plugins/cura/static/less/cura.less
+src/octoprint/plugins/cura/templates/cura_settings.jinja2
+src/octoprint/plugins/discovery/__init__.py
+src/octoprint/plugins/discovery/templates/discovery.xml.jinja2
+src/octoprint/plugins/pluginmanager/__init__.py
+src/octoprint/plugins/pluginmanager/static/css/pluginmanager.css
+src/octoprint/plugins/pluginmanager/static/img/repo_unavailable.png
+src/octoprint/plugins/pluginmanager/static/js/pluginmanager.js
+src/octoprint/plugins/pluginmanager/static/less/pluginmanager.less
+src/octoprint/plugins/pluginmanager/templates/pluginmanager_settings.jinja2
+src/octoprint/plugins/softwareupdate/__init__.py
+src/octoprint/plugins/softwareupdate/exceptions.py
+src/octoprint/plugins/softwareupdate/util.py
+src/octoprint/plugins/softwareupdate/scripts/update-octoprint.py
+src/octoprint/plugins/softwareupdate/static/css/softwareupdate.css
+src/octoprint/plugins/softwareupdate/static/js/softwareupdate.js
+src/octoprint/plugins/softwareupdate/static/less/softwareupdate.less
+src/octoprint/plugins/softwareupdate/templates/softwareupdate_settings.jinja2
+src/octoprint/plugins/softwareupdate/updaters/__init__.py
+src/octoprint/plugins/softwareupdate/updaters/pip.py
+src/octoprint/plugins/softwareupdate/updaters/python_updater.py
+src/octoprint/plugins/softwareupdate/updaters/update_script.py
+src/octoprint/plugins/softwareupdate/version_checks/__init__.py
+src/octoprint/plugins/softwareupdate/version_checks/commandline.py
+src/octoprint/plugins/softwareupdate/version_checks/git_commit.py
+src/octoprint/plugins/softwareupdate/version_checks/github_commit.py
+src/octoprint/plugins/softwareupdate/version_checks/github_release.py
+src/octoprint/plugins/softwareupdate/version_checks/python_checker.py
+src/octoprint/plugins/virtual_printer/__init__.py
+src/octoprint/plugins/virtual_printer/virtual.py
+src/octoprint/printer/__init__.py
+src/octoprint/printer/estimation.py
+src/octoprint/printer/profile.py
+src/octoprint/printer/standard.py
+src/octoprint/server/__init__.py
+src/octoprint/server/views.py
+src/octoprint/server/api/__init__.py
+src/octoprint/server/api/connection.py
+src/octoprint/server/api/files.py
+src/octoprint/server/api/job.py
+src/octoprint/server/api/languages.py
+src/octoprint/server/api/log.py
+src/octoprint/server/api/printer.py
+src/octoprint/server/api/printer_profiles.py
+src/octoprint/server/api/settings.py
+src/octoprint/server/api/slicing.py
+src/octoprint/server/api/timelapse.py
+src/octoprint/server/api/users.py
+src/octoprint/server/apps/__init__.py
+src/octoprint/server/util/__init__.py
+src/octoprint/server/util/flask.py
+src/octoprint/server/util/sockjs.py
+src/octoprint/server/util/tornado.py
+src/octoprint/server/util/watchdog.py
+src/octoprint/slicing/__init__.py
+src/octoprint/slicing/exceptions.py
+src/octoprint/static/empty
+src/octoprint/static/robots.txt
+src/octoprint/static/css/bootstrap-modal.css
+src/octoprint/static/css/bootstrap-responsive.css
+src/octoprint/static/css/bootstrap-responsive.min.css
+src/octoprint/static/css/bootstrap-slider.css
+src/octoprint/static/css/bootstrap-tabdrop.css
+src/octoprint/static/css/bootstrap.css
+src/octoprint/static/css/bootstrap.min.css
+src/octoprint/static/css/font-awesome.min.css
+src/octoprint/static/css/jquery.fileupload-ui.css
+src/octoprint/static/css/octoprint.css
+src/octoprint/static/css/pnotify.min.css
+src/octoprint/static/font/FontAwesome.otf
+src/octoprint/static/font/fontawesome-webfont.eot
+src/octoprint/static/font/fontawesome-webfont.svg
+src/octoprint/static/font/fontawesome-webfont.ttf
+src/octoprint/static/font/fontawesome-webfont.woff
+src/octoprint/static/gcodeviewer/js/Worker.js
+src/octoprint/static/gcodeviewer/js/gCodeReader.js
+src/octoprint/static/gcodeviewer/js/renderer.js
+src/octoprint/static/gcodeviewer/js/renderer3d.js
+src/octoprint/static/gcodeviewer/js/ui.js
+src/octoprint/static/gcodeviewer/lib/TrackballControls.js
+src/octoprint/static/gcodeviewer/lib/codemirror.css
+src/octoprint/static/gcodeviewer/lib/codemirror.js
+src/octoprint/static/gcodeviewer/lib/three.js
+src/octoprint/static/gcodeviewer/lib/three.min.js
+src/octoprint/static/gcodeviewer/lib/mode_gcode/gcode_mode.js
+src/octoprint/static/img/apple-touch-icon-114x114.png
+src/octoprint/static/img/apple-touch-icon-144x144.png
+src/octoprint/static/img/glyphicons-halflings-white.png
+src/octoprint/static/img/glyphicons-halflings.png
+src/octoprint/static/img/graph-background.png
+src/octoprint/static/img/icon-sd-black-14.png
+src/octoprint/static/img/logo.png
+src/octoprint/static/img/tentacle-20x20-light.png
+src/octoprint/static/img/tentacle-20x20-light@2x.png
+src/octoprint/static/img/tentacle-20x20.png
+src/octoprint/static/img/tentacle-20x20@2x.png
+src/octoprint/static/img/tentacle-22x22.png
+src/octoprint/static/img/tentacle-32x32.png
+src/octoprint/static/img/tentacle-76x76.png
+src/octoprint/static/img/trans-background.png
+src/octoprint/static/img/watermark.png
+src/octoprint/static/js/app/dataupdater.js
+src/octoprint/static/js/app/helpers.js
+src/octoprint/static/js/app/main.js
+src/octoprint/static/js/app/viewmodels/appearance.js
+src/octoprint/static/js/app/viewmodels/connection.js
+src/octoprint/static/js/app/viewmodels/control.js
+src/octoprint/static/js/app/viewmodels/files.js
+src/octoprint/static/js/app/viewmodels/firstrun.js
+src/octoprint/static/js/app/viewmodels/gcode.js
+src/octoprint/static/js/app/viewmodels/log.js
+src/octoprint/static/js/app/viewmodels/loginstate.js
+src/octoprint/static/js/app/viewmodels/navigation.js
+src/octoprint/static/js/app/viewmodels/printerprofiles.js
+src/octoprint/static/js/app/viewmodels/printerstate.js
+src/octoprint/static/js/app/viewmodels/settings.js
+src/octoprint/static/js/app/viewmodels/slicing.js
+src/octoprint/static/js/app/viewmodels/temperature.js
+src/octoprint/static/js/app/viewmodels/terminal.js
+src/octoprint/static/js/app/viewmodels/timelapse.js
+src/octoprint/static/js/app/viewmodels/users.js
+src/octoprint/static/js/app/viewmodels/usersettings.js
+src/octoprint/static/js/lib/avltree.js
+src/octoprint/static/js/lib/babel.js
+src/octoprint/static/js/lib/bootstrap-slider-knockout-binding.js
+src/octoprint/static/js/lib/detectmobilebrowser.js
+src/octoprint/static/js/lib/knockout.js
+src/octoprint/static/js/lib/knockout.mapping-latest.js
+src/octoprint/static/js/lib/less.min.js
+src/octoprint/static/js/lib/lodash.min.js
+src/octoprint/static/js/lib/loglevel.min.js
+src/octoprint/static/js/lib/md5.min.js
+src/octoprint/static/js/lib/modernizr.custom.js
+src/octoprint/static/js/lib/moment-with-locales.min.js
+src/octoprint/static/js/lib/pnotify.min.js
+src/octoprint/static/js/lib/pusher.color.min.js
+src/octoprint/static/js/lib/sockjs-0.3.4.min.js
+src/octoprint/static/js/lib/sprintf.min.js
+src/octoprint/static/js/lib/bootstrap/bootstrap-modal.js
+src/octoprint/static/js/lib/bootstrap/bootstrap-modalmanager.js
+src/octoprint/static/js/lib/bootstrap/bootstrap-slider.js
+src/octoprint/static/js/lib/bootstrap/bootstrap-tabdrop.js
+src/octoprint/static/js/lib/bootstrap/bootstrap.js
+src/octoprint/static/js/lib/jquery/jquery.fileupload.js
+src/octoprint/static/js/lib/jquery/jquery.flot.js
+src/octoprint/static/js/lib/jquery/jquery.iframe-transport.js
+src/octoprint/static/js/lib/jquery/jquery.min.js
+src/octoprint/static/js/lib/jquery/jquery.qrcode.min.js
+src/octoprint/static/js/lib/jquery/jquery.slimscroll.min.js
+src/octoprint/static/js/lib/jquery/jquery.ui.core.js
+src/octoprint/static/js/lib/jquery/jquery.ui.mouse.js
+src/octoprint/static/js/lib/jquery/jquery.ui.slider.js
+src/octoprint/static/js/lib/jquery/jquery.ui.widget.js
+src/octoprint/static/less/font-awesome.less
+src/octoprint/static/less/mixins.less
+src/octoprint/static/less/octoprint.less
+src/octoprint/static/less/variables.less
+src/octoprint/static/less/bootstrap/accordion.less
+src/octoprint/static/less/bootstrap/alerts.less
+src/octoprint/static/less/bootstrap/bootstrap.less
+src/octoprint/static/less/bootstrap/breadcrumbs.less
+src/octoprint/static/less/bootstrap/button-groups.less
+src/octoprint/static/less/bootstrap/buttons.less
+src/octoprint/static/less/bootstrap/carousel.less
+src/octoprint/static/less/bootstrap/close.less
+src/octoprint/static/less/bootstrap/code.less
+src/octoprint/static/less/bootstrap/component-animations.less
+src/octoprint/static/less/bootstrap/dropdowns.less
+src/octoprint/static/less/bootstrap/forms.less
+src/octoprint/static/less/bootstrap/grid.less
+src/octoprint/static/less/bootstrap/hero-unit.less
+src/octoprint/static/less/bootstrap/labels-badges.less
+src/octoprint/static/less/bootstrap/layouts.less
+src/octoprint/static/less/bootstrap/media.less
+src/octoprint/static/less/bootstrap/mixins.less
+src/octoprint/static/less/bootstrap/modals.less
+src/octoprint/static/less/bootstrap/navbar.less
+src/octoprint/static/less/bootstrap/navs.less
+src/octoprint/static/less/bootstrap/pager.less
+src/octoprint/static/less/bootstrap/pagination.less
+src/octoprint/static/less/bootstrap/popovers.less
+src/octoprint/static/less/bootstrap/progress-bars.less
+src/octoprint/static/less/bootstrap/reset.less
+src/octoprint/static/less/bootstrap/responsive-1200px-min.less
+src/octoprint/static/less/bootstrap/responsive-767px-max.less
+src/octoprint/static/less/bootstrap/responsive-768px-979px.less
+src/octoprint/static/less/bootstrap/responsive-navbar.less
+src/octoprint/static/less/bootstrap/responsive-utilities.less
+src/octoprint/static/less/bootstrap/responsive.less
+src/octoprint/static/less/bootstrap/scaffolding.less
+src/octoprint/static/less/bootstrap/sprites.less
+src/octoprint/static/less/bootstrap/tables.less
+src/octoprint/static/less/bootstrap/thumbnails.less
+src/octoprint/static/less/bootstrap/tooltip.less
+src/octoprint/static/less/bootstrap/type.less
+src/octoprint/static/less/bootstrap/utilities.less
+src/octoprint/static/less/bootstrap/variables.less
+src/octoprint/static/less/bootstrap/wells.less
+src/octoprint/templates/i18n.js.jinja2
+src/octoprint/templates/index.jinja2
+src/octoprint/templates/initscript.jinja2
+src/octoprint/templates/javascripts.jinja2
+src/octoprint/templates/stylesheets.jinja2
+src/octoprint/templates/dialogs/confirmation.jinja2
+src/octoprint/templates/dialogs/firstrun.jinja2
+src/octoprint/templates/dialogs/settings.jinja2
+src/octoprint/templates/dialogs/slicing.jinja2
+src/octoprint/templates/dialogs/usersettings.jinja2
+src/octoprint/templates/dialogs/_snippets/changepassword.jinja2
+src/octoprint/templates/dialogs/settings/accesscontrol.jinja2
+src/octoprint/templates/dialogs/settings/api.jinja2
+src/octoprint/templates/dialogs/settings/appearance.jinja2
+src/octoprint/templates/dialogs/settings/features.jinja2
+src/octoprint/templates/dialogs/settings/folders.jinja2
+src/octoprint/templates/dialogs/settings/gcodescripts.jinja2
+src/octoprint/templates/dialogs/settings/logs.jinja2
+src/octoprint/templates/dialogs/settings/printerprofiles.jinja2
+src/octoprint/templates/dialogs/settings/serialconnection.jinja2
+src/octoprint/templates/dialogs/settings/server.jinja2
+src/octoprint/templates/dialogs/settings/temperatures.jinja2
+src/octoprint/templates/dialogs/settings/terminalfilters.jinja2
+src/octoprint/templates/dialogs/settings/webcam.jinja2
+src/octoprint/templates/dialogs/usersettings/access.jinja2
+src/octoprint/templates/dialogs/usersettings/interface.jinja2
+src/octoprint/templates/navbar/login.jinja2
+src/octoprint/templates/navbar/settings.jinja2
+src/octoprint/templates/navbar/systemmenu.jinja2
+src/octoprint/templates/overlays/dragndrop.jinja2
+src/octoprint/templates/overlays/offline.jinja2
+src/octoprint/templates/overlays/reloadui.jinja2
+src/octoprint/templates/sidebar/connection.jinja2
+src/octoprint/templates/sidebar/files.jinja2
+src/octoprint/templates/sidebar/files_header.jinja2
+src/octoprint/templates/sidebar/state.jinja2
+src/octoprint/templates/tabs/control.jinja2
+src/octoprint/templates/tabs/gcodeviewer.jinja2
+src/octoprint/templates/tabs/temperature.jinja2
+src/octoprint/templates/tabs/terminal.jinja2
+src/octoprint/templates/tabs/timelapse.jinja2
+src/octoprint/translations/de/LC_MESSAGES/messages.mo
+src/octoprint/translations/de/LC_MESSAGES/messages.po
+src/octoprint/util/__init__.py
+src/octoprint/util/comm.py
+src/octoprint/util/gcodeInterpreter.py
+src/octoprint/util/jinja.py
+src/octoprint/util/pip.py
+src/octoprint/util/avr_isp/__init__.py
+src/octoprint/util/avr_isp/chipDB.py
+src/octoprint/util/avr_isp/intelHex.py
+src/octoprint/util/avr_isp/ispBase.py
+src/octoprint/util/avr_isp/stk500v2.py
+src/octoprint_setuptools/__init__.py
\ No newline at end of file
diff --git a/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/EGG-INFO/dependency_links.txt b/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/EGG-INFO/dependency_links.txt
new file mode 100644
index 000000000..8b1378917
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/EGG-INFO/dependency_links.txt
@@ -0,0 +1 @@
+
diff --git a/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/EGG-INFO/entry_points.txt b/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/EGG-INFO/entry_points.txt
new file mode 100644
index 000000000..0458297f0
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/EGG-INFO/entry_points.txt
@@ -0,0 +1,3 @@
+[console_scripts]
+octoprint = octoprint:main
+
diff --git a/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/EGG-INFO/not-zip-safe b/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/EGG-INFO/not-zip-safe
new file mode 100644
index 000000000..8b1378917
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/EGG-INFO/not-zip-safe
@@ -0,0 +1 @@
+
diff --git a/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/EGG-INFO/requires.txt b/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/EGG-INFO/requires.txt
new file mode 100644
index 000000000..42fcdbd55
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/EGG-INFO/requires.txt
@@ -0,0 +1,32 @@
+flask>=0.9,<0.11
+werkzeug==0.8.3
+tornado==4.0.1
+sockjs-tornado==1.0.1
+PyYAML==3.10
+Flask-Login==0.2.2
+Flask-Principal==0.3.5
+Flask-Babel==0.9
+Flask-Assets==0.10
+pyserial==2.7
+netaddr==0.7.17
+watchdog==0.8.3
+sarge==0.1.4
+netifaces==0.10
+pylru==1.0.9
+rsa==3.2
+pkginfo==1.2.1
+requests==2.7.0
+semantic_version==2.4.2
+psutil==3.2.1
+
+[develop]
+mock>=1.0.1
+nose>=1.3.0
+ddt
+sphinx>=1.3
+sphinxcontrib-httpdomain
+sphinx_rtd_theme
+pypandoc
+
+[plugins]
+cookiecutter
diff --git a/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/EGG-INFO/top_level.txt b/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/EGG-INFO/top_level.txt
new file mode 100644
index 000000000..a90198a95
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/EGG-INFO/top_level.txt
@@ -0,0 +1,2 @@
+octoprint_setuptools
+octoprint
diff --git a/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/__init__.py b/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/__init__.py
new file mode 100644
index 000000000..67baa4f74
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/__init__.py
@@ -0,0 +1,84 @@
+#!/usr/bin/env python
+import sys
+from octoprint.daemon import Daemon
+from octoprint.server import Server
+
+#~~ version
+
+from ._version import get_versions
+__version__ = get_versions()['version']
+del get_versions
+
+#~~ main class
+
+class Main(Daemon):
+ def __init__(self, pidfile, configfile, basedir, host, port, debug, allowRoot, logConf):
+ Daemon.__init__(self, pidfile)
+
+ self._configfile = configfile
+ self._basedir = basedir
+ self._host = host
+ self._port = port
+ self._debug = debug
+ self._allowRoot = allowRoot
+ self._logConf = logConf
+
+ def run(self):
+ octoprint = Server(self._configfile, self._basedir, self._host, self._port, self._debug, self._allowRoot)
+ octoprint.run()
+
+def main():
+ import argparse
+
+ parser = argparse.ArgumentParser(prog="run")
+
+ parser.add_argument("-v", "--version", action="store_true", dest="version",
+ help="Output OctoPrint's version and exit")
+
+ parser.add_argument("-d", "--debug", action="store_true", dest="debug",
+ help="Enable debug mode")
+
+ parser.add_argument("--host", action="store", type=str, dest="host",
+ help="Specify the host on which to bind the server")
+ parser.add_argument("--port", action="store", type=int, dest="port",
+ help="Specify the port on which to bind the server")
+
+ parser.add_argument("-c", "--config", action="store", dest="config",
+ help="Specify the config file to use. OctoPrint needs to have write access for the settings dialog to work. Defaults to ~/.octoprint/config.yaml")
+ parser.add_argument("-b", "--basedir", action="store", dest="basedir",
+ help="Specify the basedir to use for uploads, timelapses etc. OctoPrint needs to have write access. Defaults to ~/.octoprint")
+ parser.add_argument("--logging", action="store", dest="logConf",
+ help="Specify the config file to use for configuring logging. Defaults to ~/.octoprint/logging.yaml")
+
+ parser.add_argument("--daemon", action="store", type=str, choices=["start", "stop", "restart"],
+ help="Daemonize/control daemonized OctoPrint instance (only supported under Linux right now)")
+ parser.add_argument("--pid", action="store", type=str, dest="pidfile", default="/tmp/octoprint.pid",
+ help="Pidfile to use for daemonizing, defaults to /tmp/octoprint.pid")
+
+ parser.add_argument("--iknowwhatimdoing", action="store_true", dest="allowRoot",
+ help="Allow OctoPrint to run as user root")
+
+ args = parser.parse_args()
+
+ if args.version:
+ print "OctoPrint version %s" % __version__
+ sys.exit(0)
+
+ if args.daemon:
+ if sys.platform == "darwin" or sys.platform == "win32":
+ print >> sys.stderr, "Sorry, daemon mode is only supported under Linux right now"
+ sys.exit(2)
+
+ daemon = Main(args.pidfile, args.config, args.basedir, args.host, args.port, args.debug, args.allowRoot, args.logConf)
+ if "start" == args.daemon:
+ daemon.start()
+ elif "stop" == args.daemon:
+ daemon.stop()
+ elif "restart" == args.daemon:
+ daemon.restart()
+ else:
+ octoprint = Server(args.config, args.basedir, args.host, args.port, args.debug, args.allowRoot, args.logConf)
+ octoprint.run()
+
+if __name__ == "__main__":
+ main()
diff --git a/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/_version.py b/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/_version.py
new file mode 100644
index 000000000..c70efb015
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/_version.py
@@ -0,0 +1,22 @@
+
+# This file was generated by 'versioneer.py' (0.15+dev) from
+# revision-control system data, or from the parent directory name of an
+# unpacked source archive. Distribution tarballs contain a pre-generated copy
+# of this file.
+
+import json
+import sys
+
+version_json = '''
+{
+ "branch": "master",
+ "dirty": false,
+ "error": null,
+ "full-revisionid": "dedadbc9ac0305799e94ae279d3bca131629c4c5",
+ "version": "1.2.8"
+}
+''' # END VERSION_JSON
+
+
+def get_versions():
+ return json.loads(version_json)
diff --git a/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/daemon.py b/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/daemon.py
new file mode 100644
index 000000000..4ef56b162
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/daemon.py
@@ -0,0 +1,128 @@
+"""
+Generic linux daemon base class for python 3.x
+
+Originally from http://www.jejik.com/articles/2007/02/a_simple_unix_linux_daemon_in_python/#c35
+"""
+
+import sys, os, time, signal
+
+class Daemon:
+ """A generic daemon class.
+
+ Usage: subclass the daemon class and override the run() method."""
+
+ def __init__(self, pidfile): self.pidfile = pidfile
+
+ def daemonize(self):
+ """Deamonize class. UNIX double fork mechanism."""
+
+ try:
+ pid = os.fork()
+ if pid > 0:
+ # exit first parent
+ sys.exit(0)
+ except OSError as err:
+ sys.stderr.write('fork #1 failed: {0}\n'.format(err))
+ sys.exit(1)
+
+ # decouple from parent environment
+ os.chdir('/')
+ os.setsid()
+ os.umask(002)
+
+ # do second fork
+ try:
+ pid = os.fork()
+ if pid > 0:
+
+ # exit from second parent
+ sys.exit(0)
+ except OSError as err:
+ sys.stderr.write('fork #2 failed: {0}\n'.format(err))
+ sys.exit(1)
+
+ # redirect standard file descriptors
+ sys.stdout.flush()
+ sys.stderr.flush()
+ si = open(os.devnull, 'r')
+ so = open(os.devnull, 'a+')
+ se = open(os.devnull, 'a+')
+
+ os.dup2(si.fileno(), sys.stdin.fileno())
+ os.dup2(so.fileno(), sys.stdout.fileno())
+ os.dup2(se.fileno(), sys.stderr.fileno())
+
+ # write pidfile
+ pid = str(os.getpid())
+ with open(self.pidfile,'w+') as f:
+ f.write(pid + '\n')
+
+ # register listener for SIGTERM
+ signal.signal(signal.SIGTERM, self.term)
+
+ def term(self, _signo, _stack_frame):
+ os.remove(self.pidfile)
+ sys.exit(0)
+
+ def start(self):
+ """Start the daemon."""
+
+ # Check for a pidfile to see if the daemon already runs
+ try:
+ with open(self.pidfile,'r') as pf:
+
+ pid = int(pf.read().strip())
+ except IOError:
+ pid = None
+
+ if pid:
+ message = "pidfile {0} already exist. " + \
+ "Daemon already running?\n"
+ sys.stderr.write(message.format(self.pidfile))
+ sys.exit(1)
+
+ # Start the daemon
+ self.daemonize()
+ self.run()
+
+ def stop(self):
+ """Stop the daemon."""
+
+ # Get the pid from the pidfile
+ try:
+ with open(self.pidfile,'r') as pf:
+ pid = int(pf.read().strip())
+ except IOError:
+ pid = None
+
+ if not pid:
+ message = "pidfile {0} does not exist. " + \
+ "Daemon not running?\n"
+ sys.stderr.write(message.format(self.pidfile))
+ return # not an error in a restart
+
+ # Try killing the daemon process
+ try:
+ while 1:
+ os.kill(pid, signal.SIGTERM)
+ time.sleep(0.1)
+ except OSError as err:
+ e = str(err.args)
+ if e.find("No such process") > 0:
+ if os.path.exists(self.pidfile):
+ os.remove(self.pidfile)
+ else:
+ print (str(err.args))
+ sys.exit(1)
+
+ def restart(self):
+ """Restart the daemon."""
+ self.stop()
+ self.start()
+
+ def run(self):
+ """You should override this method when you subclass Daemon.
+
+ It will be called after the process has been daemonized by
+ start() or restart()."""
+
diff --git a/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/events.py b/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/events.py
new file mode 100644
index 000000000..2cc765d9b
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/events.py
@@ -0,0 +1,366 @@
+# coding=utf-8
+from __future__ import (print_function, absolute_import)
+
+__author__ = "Gina Häußge , Lars Norpchen"
+__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
+__copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms of the AGPLv3 License"
+
+import datetime
+import logging
+import subprocess
+import Queue
+import threading
+import collections
+
+from octoprint.settings import settings
+import octoprint.plugin
+
+# singleton
+_instance = None
+
+
+def all_events():
+ return [getattr(Events, name) for name in Events.__dict__ if not name.startswith("__")]
+
+
+class Events(object):
+ # application startup
+ STARTUP = "Startup"
+
+ # connect/disconnect to printer
+ CONNECTED = "Connected"
+ DISCONNECTED = "Disconnected"
+
+ # connect/disconnect by client
+ CLIENT_OPENED = "ClientOpened"
+ CLIENT_CLOSED = "ClientClosed"
+
+ # File management
+ UPLOAD = "Upload"
+ FILE_SELECTED = "FileSelected"
+ FILE_DESELECTED = "FileDeselected"
+ UPDATED_FILES = "UpdatedFiles"
+ METADATA_ANALYSIS_STARTED = "MetadataAnalysisStarted"
+ METADATA_ANALYSIS_FINISHED = "MetadataAnalysisFinished"
+ METADATA_STATISTICS_UPDATED = "MetadataStatisticsUpdated"
+
+ # SD Upload
+ TRANSFER_STARTED = "TransferStarted"
+ TRANSFER_DONE = "TransferDone"
+
+ # print job
+ PRINT_STARTED = "PrintStarted"
+ PRINT_DONE = "PrintDone"
+ PRINT_FAILED = "PrintFailed"
+ PRINT_CANCELLED = "PrintCancelled"
+ PRINT_PAUSED = "PrintPaused"
+ PRINT_RESUMED = "PrintResumed"
+ ERROR = "Error"
+
+ # print/gcode events
+ POWER_ON = "PowerOn"
+ POWER_OFF = "PowerOff"
+ HOME = "Home"
+ Z_CHANGE = "ZChange"
+ WAITING = "Waiting"
+ DWELL = "Dwelling"
+ COOLING = "Cooling"
+ ALERT = "Alert"
+ CONVEYOR = "Conveyor"
+ EJECT = "Eject"
+ E_STOP = "EStop"
+ REGISTERED_MESSAGE_RECEIVED = "RegisteredMessageReceived"
+
+ # Timelapse
+ CAPTURE_START = "CaptureStart"
+ CAPTURE_DONE = "CaptureDone"
+ CAPTURE_FAILED = "CaptureFailed"
+ POSTROLL_START = "PostRollStart"
+ POSTROLL_END = "PostRollEnd"
+ MOVIE_RENDERING = "MovieRendering"
+ MOVIE_DONE = "MovieDone"
+ MOVIE_FAILED = "MovieFailed"
+
+ # Slicing
+ SLICING_STARTED = "SlicingStarted"
+ SLICING_DONE = "SlicingDone"
+ SLICING_FAILED = "SlicingFailed"
+ SLICING_CANCELLED = "SlicingCancelled"
+
+ # Settings
+ SETTINGS_UPDATED = "SettingsUpdated"
+
+
+def eventManager():
+ global _instance
+ if _instance is None:
+ _instance = EventManager()
+ return _instance
+
+
+class EventManager(object):
+ """
+ Handles receiving events and dispatching them to subscribers
+ """
+
+ def __init__(self):
+ self._registeredListeners = collections.defaultdict(list)
+ self._logger = logging.getLogger(__name__)
+
+ self._queue = Queue.PriorityQueue()
+ self._worker = threading.Thread(target=self._work)
+ self._worker.daemon = True
+ self._worker.start()
+
+ def _work(self):
+ try:
+ while True:
+ (event, payload) = self._queue.get(True)
+
+ eventListeners = self._registeredListeners[event]
+ self._logger.debug("Firing event: %s (Payload: %r)" % (event, payload))
+
+ for listener in eventListeners:
+ self._logger.debug("Sending action to %r" % listener)
+ try:
+ listener(event, payload)
+ except:
+ self._logger.exception("Got an exception while sending event %s (Payload: %r) to %s" % (event, payload, listener))
+
+ octoprint.plugin.call_plugin(octoprint.plugin.types.EventHandlerPlugin,
+ "on_event",
+ args=[event, payload])
+ except:
+ self._logger.exception("Ooops, the event bus worker loop crashed")
+
+ def fire(self, event, payload=None):
+ """
+ Fire an event to anyone subscribed to it
+
+ Any object can generate an event and any object can subscribe to the event's name as a string (arbitrary, but
+ case sensitive) and any extra payload data that may pertain to the event.
+
+ Callbacks must implement the signature "callback(event, payload)", with "event" being the event's name and
+ payload being a payload object specific to the event.
+ """
+
+ self._queue.put((event, payload), 0)
+
+ if event == Events.UPDATED_FILES and "type" in payload and payload["type"] == "printables":
+ # when sending UpdatedFiles with type "printables", also send another event with deprecated type "gcode"
+ # TODO v1.3.0 Remove again
+ import copy
+ legacy_payload = copy.deepcopy(payload)
+ legacy_payload["type"] = "gcode"
+ self._queue.put((event, legacy_payload), 0)
+
+
+ def subscribe(self, event, callback):
+ """
+ Subscribe a listener to an event -- pass in the event name (as a string) and the callback object
+ """
+
+ if callback in self._registeredListeners[event]:
+ # callback is already subscribed to the event
+ return
+
+ self._registeredListeners[event].append(callback)
+ self._logger.debug("Subscribed listener %r for event %s" % (callback, event))
+
+ def unsubscribe (self, event, callback):
+ """
+ Unsubscribe a listener from an event -- pass in the event name (as string) and the callback object
+ """
+
+ if not callback in self._registeredListeners[event]:
+ # callback not subscribed to event, just return
+ return
+
+ self._registeredListeners[event].remove(callback)
+ self._logger.debug("Unsubscribed listener %r for event %s" % (callback, event))
+
+
+class GenericEventListener(object):
+ """
+ The GenericEventListener can be subclassed to easily create custom event listeners.
+ """
+
+ def __init__(self):
+ self._logger = logging.getLogger(__name__)
+
+ def subscribe(self, events):
+ """
+ Subscribes the eventCallback method for all events in the given list.
+ """
+
+ for event in events:
+ eventManager().subscribe(event, self.eventCallback)
+
+ def unsubscribe(self, events):
+ """
+ Unsubscribes the eventCallback method for all events in the given list
+ """
+
+ for event in events:
+ eventManager().unsubscribe(event, self.eventCallback)
+
+ def eventCallback(self, event, payload):
+ """
+ Actual event callback called with name of event and optional payload. Not implemented here, override in
+ child classes.
+ """
+ pass
+
+
+class DebugEventListener(GenericEventListener):
+ def __init__(self):
+ GenericEventListener.__init__(self)
+
+ events = filter(lambda x: not x.startswith("__"), dir(Events))
+ self.subscribe(events)
+
+ def eventCallback(self, event, payload):
+ GenericEventListener.eventCallback(self, event, payload)
+ self._logger.debug("Received event: %s (Payload: %r)" % (event, payload))
+
+
+class CommandTrigger(GenericEventListener):
+ def __init__(self, printer):
+ GenericEventListener.__init__(self)
+ self._printer = printer
+ self._subscriptions = {}
+
+ self._initSubscriptions()
+
+ def _initSubscriptions(self):
+ """
+ Subscribes all events as defined in "events > $triggerType > subscriptions" in the settings with their
+ respective commands.
+ """
+ if not settings().get(["events"]):
+ return
+
+ if not settings().getBoolean(["events", "enabled"]):
+ return
+
+ eventsToSubscribe = []
+ for subscription in settings().get(["events", "subscriptions"]):
+ if not "event" in subscription.keys() or not "command" in subscription.keys() \
+ or not "type" in subscription.keys() or not subscription["type"] in ["system", "gcode"]:
+ self._logger.info("Invalid command trigger, missing either event, type or command or type is invalid: %r" % subscription)
+ continue
+
+ if "enabled" in subscription.keys() and not subscription["enabled"]:
+ self._logger.info("Disabled command trigger: %r" % subscription)
+ continue
+
+ event = subscription["event"]
+ command = subscription["command"]
+ commandType = subscription["type"]
+ debug = subscription["debug"] if "debug" in subscription else False
+
+ if not event in self._subscriptions.keys():
+ self._subscriptions[event] = []
+ self._subscriptions[event].append((command, commandType, debug))
+
+ if not event in eventsToSubscribe:
+ eventsToSubscribe.append(event)
+
+ self.subscribe(eventsToSubscribe)
+
+ def eventCallback(self, event, payload):
+ """
+ Event callback, iterates over all subscribed commands for the given event, processes the command
+ string and then executes the command via the abstract executeCommand method.
+ """
+
+ GenericEventListener.eventCallback(self, event, payload)
+
+ if not event in self._subscriptions:
+ return
+
+ for command, commandType, debug in self._subscriptions[event]:
+ try:
+ if isinstance(command, (tuple, list, set)):
+ processedCommand = []
+ for c in command:
+ processedCommand.append(self._processCommand(c, payload))
+ else:
+ processedCommand = self._processCommand(command, payload)
+ self.executeCommand(processedCommand, commandType, debug=debug)
+ except KeyError, e:
+ self._logger.warn("There was an error processing one or more placeholders in the following command: %s" % command)
+
+ def executeCommand(self, command, commandType, debug=False):
+ if commandType == "system":
+ self._executeSystemCommand(command, debug=debug)
+ elif commandType == "gcode":
+ self._executeGcodeCommand(command, debug=debug)
+
+ def _executeSystemCommand(self, command, debug=False):
+ def commandExecutioner(command):
+ if debug:
+ self._logger.info("Executing system command: %s" % command)
+ # we run this with shell=True since we have to trust whatever
+ # our admin configured as command and since we want to allow
+ # shell-alike handling here...
+ subprocess.Popen(command, shell=True)
+
+ try:
+ if isinstance(command, (list, tuple, set)):
+ for c in command:
+ commandExecutioner(c)
+ else:
+ commandExecutioner(command)
+ except subprocess.CalledProcessError, e:
+ self._logger.warn("Command failed with return code %i: %s" % (e.returncode, str(e)))
+ except:
+ self._logger.exception("Command failed")
+
+ def _executeGcodeCommand(self, command, debug=False):
+ commands = [command]
+ if isinstance(command, (list, tuple, set)):
+ commands = list(command)
+ if debug:
+ self._logger.info("Executing GCode commands: %r" % command)
+ self._printer.commands(commands)
+
+ def _processCommand(self, command, payload):
+ """
+ Performs string substitutions in the command string based on a couple of current parameters.
+
+ The following substitutions are currently supported:
+
+ - {__currentZ} : current Z position of the print head, or -1 if not available
+ - {__filename} : current selected filename, or "NO FILE" if no file is selected
+ - {__progress} : current print progress in percent, 0 if no print is in progress
+ - {__data} : the string representation of the event's payload
+ - {__now} : ISO 8601 representation of the current date and time
+
+ Additionally, the keys of the event's payload can also be used as placeholder.
+ """
+
+ params = {
+ "__currentZ": "-1",
+ "__filename": "NO FILE",
+ "__progress": "0",
+ "__data": str(payload),
+ "__now": datetime.datetime.now().isoformat()
+ }
+
+ currentData = self._printer.get_current_data()
+
+ if "currentZ" in currentData.keys() and currentData["currentZ"] is not None:
+ params["__currentZ"] = str(currentData["currentZ"])
+
+ if "job" in currentData.keys() and currentData["job"] is not None:
+ params["__filename"] = currentData["job"]["file"]["name"]
+ if "progress" in currentData.keys() and currentData["progress"] is not None \
+ and "completion" in currentData["progress"].keys() and currentData["progress"]["completion"] is not None:
+ params["__progress"] = str(round(currentData["progress"]["completion"] * 100))
+
+ # now add the payload keys as well
+ if isinstance(payload, dict):
+ params.update(payload)
+
+ return command.format(**params)
diff --git a/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/filemanager/__init__.py b/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/filemanager/__init__.py
new file mode 100644
index 000000000..34f31680c
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/filemanager/__init__.py
@@ -0,0 +1,458 @@
+# coding=utf-8
+from __future__ import absolute_import
+
+__author__ = "Gina Häußge "
+__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
+__copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms of the AGPLv3 License"
+
+import logging
+import os
+
+import octoprint.plugin
+import octoprint.util
+
+from octoprint.events import eventManager, Events
+
+from .destinations import FileDestinations
+from .analysis import QueueEntry, AnalysisQueue
+from .storage import LocalFileStorage
+from .util import AbstractFileWrapper, StreamWrapper, DiskFileWrapper
+
+from collections import namedtuple
+
+ContentTypeMapping = namedtuple("ContentTypeMapping", "extensions, content_type")
+ContentTypeDetector = namedtuple("ContentTypeDetector", "extensions, detector")
+
+extensions = dict(
+)
+
+def full_extension_tree():
+ result = dict(
+ # extensions for 3d model files
+ model=dict(
+ stl=ContentTypeMapping(["stl"], "application/sla")
+ ),
+ # extensions for printable machine code
+ machinecode=dict(
+ gcode=ContentTypeMapping(["gcode", "gco", "g"], "text/plain")
+ )
+ )
+
+ extension_tree_hooks = octoprint.plugin.plugin_manager().get_hooks("octoprint.filemanager.extension_tree")
+ for name, hook in extension_tree_hooks.items():
+ try:
+ hook_result = hook()
+ if hook_result is None or not isinstance(hook_result, dict):
+ continue
+ result = octoprint.util.dict_merge(result, hook_result)
+ except:
+ logging.getLogger(__name__).exception("Exception while retrieving additional extension tree entries from hook {name}".format(name=name))
+
+ return result
+
+def get_extensions(type, subtree=None):
+ if not subtree:
+ subtree = full_extension_tree()
+
+ for key, value in subtree.items():
+ if key == type:
+ return get_all_extensions(subtree=value)
+ elif isinstance(value, dict):
+ sub_extensions = get_extensions(type, subtree=value)
+ if sub_extensions:
+ return sub_extensions
+
+ return None
+
+def get_all_extensions(subtree=None):
+ if not subtree:
+ subtree = full_extension_tree()
+
+ result = []
+ if isinstance(subtree, dict):
+ for key, value in subtree.items():
+ if isinstance(value, dict):
+ result += get_all_extensions(value)
+ elif isinstance(value, (ContentTypeMapping, ContentTypeDetector)):
+ result += value.extensions
+ elif isinstance(value, (list, tuple)):
+ result += value
+ elif isinstance(subtree, (ContentTypeMapping, ContentTypeDetector)):
+ result = subtree.extensions
+ elif isinstance(subtree, (list, tuple)):
+ result = subtree
+ return result
+
+def get_path_for_extension(extension, subtree=None):
+ if not subtree:
+ subtree = full_extension_tree()
+
+ for key, value in subtree.items():
+ if isinstance(value, (ContentTypeMapping, ContentTypeDetector)) and extension in value.extensions:
+ return [key]
+ elif isinstance(value, (list, tuple)) and extension in value:
+ return [key]
+ elif isinstance(value, dict):
+ path = get_path_for_extension(extension, subtree=value)
+ if path:
+ return [key] + path
+
+ return None
+
+def get_content_type_mapping_for_extension(extension, subtree=None):
+ if not subtree:
+ subtree = full_extension_tree()
+
+ for key, value in subtree.items():
+ content_extension_matches = isinstance(value, (ContentTypeMapping, ContentTypeDetector)) and extension in value. extensions
+ list_extension_matches = isinstance(value, (list, tuple)) and extension in value
+
+ if content_extension_matches or list_extension_matches:
+ return value
+ elif isinstance(value, dict):
+ result = get_content_type_mapping_for_extension(extension, subtree=value)
+ if result is not None:
+ return result
+
+ return None
+
+def valid_extension(extension, type=None):
+ if not type:
+ return extension in get_all_extensions()
+ else:
+ extensions = get_extensions(type)
+ if extensions:
+ return extension in extensions
+
+def valid_file_type(filename, type=None):
+ _, extension = os.path.splitext(filename)
+ extension = extension[1:].lower()
+ return valid_extension(extension, type=type)
+
+def get_file_type(filename):
+ _, extension = os.path.splitext(filename)
+ extension = extension[1:].lower()
+ return get_path_for_extension(extension)
+
+def get_mime_type(filename):
+ _, extension = os.path.splitext(filename)
+ extension = extension[1:].lower()
+ mapping = get_content_type_mapping_for_extension(extension)
+ if mapping:
+ if isinstance(mapping, ContentTypeMapping) and mapping.content_type is not None:
+ return mapping.content_type
+ elif isinstance(mapping, ContentTypeDetector) and callable(mapping.detector):
+ result = mapping.detector(filename)
+ if result is not None:
+ return result
+ return "application/octet-stream"
+
+
+class NoSuchStorage(Exception):
+ pass
+
+
+class FileManager(object):
+ def __init__(self, analysis_queue, slicing_manager, printer_profile_manager, initial_storage_managers=None):
+ self._logger = logging.getLogger(__name__)
+ self._analysis_queue = analysis_queue
+ self._analysis_queue.register_finish_callback(self._on_analysis_finished)
+
+ self._storage_managers = dict()
+ if initial_storage_managers:
+ self._storage_managers.update(initial_storage_managers)
+
+ self._slicing_manager = slicing_manager
+ self._printer_profile_manager = printer_profile_manager
+
+ import threading
+ self._slicing_jobs = dict()
+ self._slicing_jobs_mutex = threading.Lock()
+
+ self._slicing_progress_callbacks = []
+ self._last_slicing_progress = None
+
+ self._progress_plugins = []
+ self._preprocessor_hooks = dict()
+
+ def initialize(self):
+ self.reload_plugins()
+
+ def worker():
+ self._logger.info("Adding backlog items from all storage types to analysis queue...".format(**locals()))
+ for storage_type, storage_manager in self._storage_managers.items():
+ self._determine_analysis_backlog(storage_type, storage_manager)
+
+ import threading
+ thread = threading.Thread(target=worker)
+ thread.daemon = True
+ thread.start()
+
+ def reload_plugins(self):
+ self._progress_plugins = octoprint.plugin.plugin_manager().get_implementations(octoprint.plugin.ProgressPlugin)
+ self._preprocessor_hooks = octoprint.plugin.plugin_manager().get_hooks("octoprint.filemanager.preprocessor")
+
+ def register_slicingprogress_callback(self, callback):
+ self._slicing_progress_callbacks.append(callback)
+
+ def unregister_slicingprogress_callback(self, callback):
+ try:
+ self._slicing_progress_callbacks.remove(callback)
+ except ValueError:
+ # callback was not registered
+ pass
+
+ def _determine_analysis_backlog(self, storage_type, storage_manager):
+ counter = 0
+ for entry, path, printer_profile in storage_manager.analysis_backlog:
+ file_type = get_file_type(path)[-1]
+
+ # we'll use the default printer profile for the backlog since we don't know better
+ queue_entry = QueueEntry(entry, file_type, storage_type, path, self._printer_profile_manager.get_default())
+ self._analysis_queue.enqueue(queue_entry, high_priority=False)
+ counter += 1
+ self._logger.info("Added {counter} items from storage type \"{storage_type}\" to analysis queue".format(**locals()))
+
+ def add_storage(self, storage_type, storage_manager):
+ self._storage_managers[storage_type] = storage_manager
+ self._determine_analysis_backlog(storage_type, storage_manager)
+
+ def remove_storage(self, type):
+ if not type in self._storage_managers:
+ return
+ del self._storage_managers[type]
+
+ @property
+ def slicing_enabled(self):
+ return self._slicing_manager.slicing_enabled
+
+ @property
+ def registered_slicers(self):
+ return self._slicing_manager.registered_slicers
+
+ @property
+ def default_slicer(self):
+ return self._slicing_manager.default_slicer
+
+ def slice(self, slicer_name, source_location, source_path, dest_location, dest_path,
+ position=None, profile=None, printer_profile_id=None, overrides=None, callback=None, callback_args=None):
+ absolute_source_path = self.path_on_disk(source_location, source_path)
+
+ def stlProcessed(source_location, source_path, tmp_path, dest_location, dest_path, start_time, printer_profile_id, callback, callback_args, _error=None, _cancelled=False, _analysis=None):
+ try:
+ if _error:
+ eventManager().fire(Events.SLICING_FAILED, {"stl": source_path, "gcode": dest_path, "reason": _error})
+ elif _cancelled:
+ eventManager().fire(Events.SLICING_CANCELLED, {"stl": source_path, "gcode": dest_path})
+ else:
+ source_meta = self.get_metadata(source_location, source_path)
+ hash = source_meta["hash"]
+
+ import io
+ links = [("model", dict(name=source_path))]
+ _, stl_name = self.split_path(source_location, source_path)
+ file_obj = StreamWrapper(os.path.basename(dest_path),
+ io.BytesIO(u";Generated from {stl_name} {hash}\n".format(**locals()).encode("ascii", "replace")),
+ io.FileIO(tmp_path, "rb"))
+
+ printer_profile = self._printer_profile_manager.get(printer_profile_id)
+ self.add_file(dest_location, dest_path, file_obj, links=links, allow_overwrite=True, printer_profile=printer_profile, analysis=_analysis)
+
+ end_time = time.time()
+ eventManager().fire(Events.SLICING_DONE, {"stl": source_path, "gcode": dest_path, "time": end_time - start_time})
+
+ if callback is not None:
+ if callback_args is None:
+ callback_args = ()
+ callback(*callback_args)
+ finally:
+ os.remove(tmp_path)
+
+ source_job_key = (source_location, source_path)
+ dest_job_key = (dest_location, dest_path)
+
+ with self._slicing_jobs_mutex:
+ if source_job_key in self._slicing_jobs:
+ del self._slicing_jobs[source_job_key]
+ if dest_job_key in self._slicing_jobs:
+ del self._slicing_jobs[dest_job_key]
+
+ slicer = self._slicing_manager.get_slicer(slicer_name)
+
+ import time
+ start_time = time.time()
+ eventManager().fire(Events.SLICING_STARTED, {"stl": source_path, "gcode": dest_path, "progressAvailable": slicer.get_slicer_properties()["progress_report"] if slicer else False})
+
+ import tempfile
+ f = tempfile.NamedTemporaryFile(suffix=".gco", delete=False)
+ temp_path = f.name
+ f.close()
+
+ with self._slicing_jobs_mutex:
+ source_job_key = (source_location, source_path)
+ dest_job_key = (dest_location, dest_path)
+ if dest_job_key in self._slicing_jobs:
+ job_slicer_name, job_absolute_source_path, job_temp_path = self._slicing_jobs[dest_job_key]
+
+ self._slicing_manager.cancel_slicing(job_slicer_name, job_absolute_source_path, job_temp_path)
+ del self._slicing_jobs[dest_job_key]
+
+ self._slicing_jobs[dest_job_key] = self._slicing_jobs[source_job_key] = (slicer_name, absolute_source_path, temp_path)
+
+ args = (source_location, source_path, temp_path, dest_location, dest_path, start_time, printer_profile_id, callback, callback_args)
+ self._slicing_manager.slice(slicer_name,
+ absolute_source_path,
+ temp_path,
+ profile,
+ stlProcessed,
+ position=position,
+ callback_args=args,
+ overrides=overrides,
+ printer_profile_id=printer_profile_id,
+ on_progress=self.on_slicing_progress,
+ on_progress_args=(slicer_name, source_location, source_path, dest_location, dest_path))
+
+ def on_slicing_progress(self, slicer, source_location, source_path, dest_location, dest_path, _progress=None):
+ if not _progress:
+ return
+
+ progress_int = int(_progress * 100)
+ if self._last_slicing_progress != progress_int:
+ self._last_slicing_progress = progress_int
+ for callback in self._slicing_progress_callbacks:
+ try: callback.sendSlicingProgress(slicer, source_location, source_path, dest_location, dest_path, progress_int)
+ except: self._logger.exception("Exception while pushing slicing progress")
+
+ if progress_int:
+ def call_plugins(slicer, source_location, source_path, dest_location, dest_path, progress):
+ for plugin in self._progress_plugins:
+ try:
+ plugin.on_slicing_progress(slicer, source_location, source_path, dest_location, dest_path, progress)
+ except:
+ self._logger.exception("Exception while sending slicing progress to plugin %s" % plugin._identifier)
+
+ import threading
+ thread = threading.Thread(target=call_plugins, args=(slicer, source_location, source_path, dest_location, dest_path, progress_int))
+ thread.daemon = False
+ thread.start()
+
+
+ def get_busy_files(self):
+ return self._slicing_jobs.keys()
+
+ def file_exists(self, destination, path):
+ return self._storage(destination).file_exists(path)
+
+ def list_files(self, destinations=None, path=None, filter=None, recursive=None):
+ if not destinations:
+ destinations = self._storage_managers.keys()
+ if isinstance(destinations, (str, unicode, basestring)):
+ destinations = [destinations]
+
+ result = dict()
+ for dst in destinations:
+ result[dst] = self._storage_managers[dst].list_files(path=path, filter=filter, recursive=recursive)
+ return result
+
+ def add_file(self, destination, path, file_object, links=None, allow_overwrite=False, printer_profile=None, analysis=None):
+ if printer_profile is None:
+ printer_profile = self._printer_profile_manager.get_current_or_default()
+
+ for hook in self._preprocessor_hooks.values():
+ try:
+ hook_file_object = hook(path, file_object, links=links, printer_profile=printer_profile, allow_overwrite=allow_overwrite)
+ except:
+ self._logger.exception("Error when calling preprocessor hook {}, ignoring".format(hook))
+ continue
+
+ if hook_file_object is not None:
+ file_object = hook_file_object
+ file_path = self._storage(destination).add_file(path, file_object, links=links, printer_profile=printer_profile, allow_overwrite=allow_overwrite)
+ absolute_path = self._storage(destination).path_on_disk(file_path)
+
+ if analysis is None:
+ file_type = get_file_type(absolute_path)
+ if file_type:
+ queue_entry = QueueEntry(file_path, file_type[-1], destination, absolute_path, printer_profile)
+ self._analysis_queue.enqueue(queue_entry, high_priority=True)
+ else:
+ self._add_analysis_result(destination, path, analysis)
+
+ eventManager().fire(Events.UPDATED_FILES, dict(type="printables"))
+ return file_path
+
+ def remove_file(self, destination, path):
+ self._storage(destination).remove_file(path)
+ eventManager().fire(Events.UPDATED_FILES, dict(type="printables"))
+
+ def add_folder(self, destination, path, ignore_existing=True):
+ folder_path = self._storage(destination).add_folder(path, ignore_existing=ignore_existing)
+ eventManager().fire(Events.UPDATED_FILES, dict(type="printables"))
+ return folder_path
+
+ def remove_folder(self, destination, path, recursive=True):
+ self._storage(destination).remove_folder(path, recursive=recursive)
+ eventManager().fire(Events.UPDATED_FILES, dict(type="printables"))
+
+ def get_metadata(self, destination, path):
+ return self._storage(destination).get_metadata(path)
+
+ def add_link(self, destination, path, rel, data):
+ self._storage(destination).add_link(path, rel, data)
+
+ def remove_link(self, destination, path, rel, data):
+ self._storage(destination).remove_link(path, rel, data)
+
+ def log_print(self, destination, path, timestamp, print_time, success, printer_profile):
+ try:
+ if success:
+ self._storage(destination).add_history(path, dict(timestamp=timestamp, printTime=print_time, success=success, printerProfile=printer_profile))
+ else:
+ self._storage(destination).add_history(path, dict(timestamp=timestamp, success=success, printerProfile=printer_profile))
+ eventManager().fire(Events.METADATA_STATISTICS_UPDATED, dict(storage=destination, path=path))
+ except NoSuchStorage:
+ # if there's no storage configured where to log the print, we'll just not log it
+ pass
+
+ def set_additional_metadata(self, destination, path, key, data, overwrite=False, merge=False):
+ self._storage(destination).set_additional_metadata(path, key, data, overwrite=overwrite, merge=merge)
+
+ def remove_additional_metadata(self, destination, path, key):
+ self._storage(destination).remove_additional_metadata(path, key)
+
+ def path_on_disk(self, destination, path):
+ return self._storage(destination).path_on_disk(path)
+
+ def sanitize(self, destination, path):
+ return self._storage(destination).sanitize(path)
+
+ def sanitize_name(self, destination, name):
+ return self._storage(destination).sanitize_name(name)
+
+ def sanitize_path(self, destination, path):
+ return self._storage(destination).sanitize_path(path)
+
+ def split_path(self, destination, path):
+ return self._storage(destination).split_path(path)
+
+ def join_path(self, destination, *path):
+ return self._storage(destination).join_path(*path)
+
+ def path_in_storage(self, destination, path):
+ return self._storage(destination).path_in_storage(path)
+
+ def _storage(self, destination):
+ if not destination in self._storage_managers:
+ raise NoSuchStorage("No storage configured for destination {destination}".format(**locals()))
+ return self._storage_managers[destination]
+
+ def _add_analysis_result(self, destination, path, result):
+ if not destination in self._storage_managers:
+ return
+
+ storage_manager = self._storage_managers[destination]
+ storage_manager.set_additional_metadata(path, "analysis", result)
+
+ def _on_analysis_finished(self, entry, result):
+ self._add_analysis_result(entry.location, entry.path, result)
+
diff --git a/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/filemanager/analysis.py b/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/filemanager/analysis.py
new file mode 100644
index 000000000..cd4ca7fdf
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/filemanager/analysis.py
@@ -0,0 +1,278 @@
+# coding=utf-8
+from __future__ import absolute_import
+
+__author__ = "Gina Häußge "
+__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
+__copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms of the AGPLv3 License"
+
+
+import logging
+import Queue as queue
+import os
+import threading
+import collections
+import time
+
+from octoprint.events import Events, eventManager
+
+import octoprint.util.gcodeInterpreter as gcodeInterpreter
+
+
+class QueueEntry(collections.namedtuple("QueueEntry", "path, type, location, absolute_path, printer_profile")):
+ """
+ A :class:`QueueEntry` for processing through the :class:`AnalysisQueue`. Wraps the entry's properties necessary
+ for processing.
+
+ Arguments:
+ path (str): Storage location specific path to the file to analyze.
+ type (str): Type of file to analyze, necessary to map to the correct :class:`AbstractAnalysisQueue` sub class.
+ At the moment, only ``gcode`` is supported here.
+ location (str): Location the file is located on.
+ absolute_path (str): Absolute path on disk through which to access the file.
+ printer_profile (PrinterProfile): :class:`PrinterProfile` which to use for analysis.
+ """
+
+ def __str__(self):
+ return "{location}:{path}".format(location=self.location, path=self.path)
+
+
+class AnalysisQueue(object):
+ """
+ OctoPrint's :class:`AnalysisQueue` can manage various :class:`AbstractAnalysisQueue` implementations, mapped
+ by their machine code type.
+
+ At the moment, only the analysis of GCODE files for 3D printing is supported, through :class:`GcodeAnalysisQueue`.
+
+ By invoking :meth:`register_finish_callback` it is possible to register oneself as a callback to be invoked each
+ time the analysis of a queue entry finishes. The call parameters will be the finished queue entry as the first
+ and the analysis result as the second parameter. It is also possible to remove the registration again by invoking
+ :meth:`unregister_finish_callback`.
+
+ :meth:`enqueue` allows enqueuing :class:`QueueEntry` instances to analyze. If the :attr:`QueueEntry.type` is unknown
+ (no specific child class of :class:`AbstractAnalysisQueue` is registered for it), nothing will happen. Otherwise the
+ entry will be enqueued with the type specific analysis queue.
+ """
+
+ def __init__(self):
+ self._logger = logging.getLogger(__name__)
+ self._callbacks = []
+ self._queues = dict(
+ gcode=GcodeAnalysisQueue(self._analysis_finished)
+ )
+
+ def register_finish_callback(self, callback):
+ self._callbacks.append(callback)
+
+ def unregister_finish_callback(self, callback):
+ self._callbacks.remove(callback)
+
+ def enqueue(self, entry, high_priority=False):
+ if not entry.type in self._queues:
+ return
+
+ self._queues[entry.type].enqueue(entry, high_priority=high_priority)
+
+ def pause(self):
+ for queue in self._queues.values():
+ queue.pause()
+
+ def resume(self):
+ for queue in self._queues.values():
+ queue.resume()
+
+ def _analysis_finished(self, entry, result):
+ for callback in self._callbacks:
+ callback(entry, result)
+ eventManager().fire(Events.METADATA_ANALYSIS_FINISHED, {"file": entry.path, "result": result})
+
+class AbstractAnalysisQueue(object):
+ """
+ The :class:`AbstractAnalysisQueue` is the parent class of all specific analysis queues such as the
+ :class:`GcodeAnalysisQueue`. It offers methods to enqueue new entries to analyze and pausing and resuming analysis
+ processing.
+
+ Arguments:
+ finished_callback (callable): Callback that will be called upon finishing analysis of an entry in the queue.
+ The callback will be called with the analyzed entry as the first argument and the analysis result as
+ returned from the queue implementation as the second parameter.
+
+ .. automethod:: _do_analysis
+
+ .. automethod:: _do_abort
+ """
+
+ LOW_PRIO = 0
+ HIGH_PRIO = 100
+
+ def __init__(self, finished_callback):
+ self._logger = logging.getLogger(__name__)
+
+ self._finished_callback = finished_callback
+
+ self._active = threading.Event()
+ self._active.set()
+
+ self._currentFile = None
+ self._currentProgress = None
+
+ self._queue = queue.PriorityQueue()
+ self._current = None
+
+ self._worker = threading.Thread(target=self._work)
+ self._worker.daemon = True
+ self._worker.start()
+
+ def enqueue(self, entry, high_priority=False):
+ """
+ Enqueues an ``entry`` for analysis by the queue.
+
+ If ``high_priority`` is True (defaults to False), the entry will be prioritized and hence processed before
+ other entries in the queue with normal priority.
+
+ Arguments:
+ entry (QueueEntry): The :class:`QueueEntry` to analyze.
+ high_priority (boolean): Whether to process the provided entry with high priority (True) or not
+ (False, default)
+ """
+
+ if high_priority:
+ self._logger.debug("Adding entry {entry} to analysis queue with high priority".format(entry=entry))
+ prio = self.__class__.HIGH_PRIO
+ else:
+ self._logger.debug("Adding entry {entry} to analysis queue with low priority".format(entry=entry))
+ prio = self.__class__.LOW_PRIO
+
+ self._queue.put((prio, entry))
+
+ def pause(self):
+ """
+ Pauses processing of the queue, e.g. when a print is active.
+ """
+
+ self._logger.debug("Pausing analysis")
+ self._active.clear()
+ if self._current is not None:
+ self._logger.debug("Aborting running analysis, will restart when analyzer is resumed")
+ self._do_abort()
+
+ def resume(self):
+ """
+ Resumes processing of the queue, e.g. when a print has finished.
+ """
+
+ self._logger.debug("Resuming analyzer")
+ self._active.set()
+
+ def _work(self):
+ aborted = None
+ while True:
+ if aborted is not None:
+ entry = aborted
+ aborted = None
+ self._logger.debug("Got an aborted analysis job for entry {entry}, processing this instead of first item in queue".format(**locals()))
+ else:
+ (priority, entry) = self._queue.get()
+ self._logger.debug("Processing entry {entry} from queue (priority {priority})".format(**locals()))
+
+ self._active.wait()
+
+ try:
+ self._analyze(entry, high_priority=(priority == self.__class__.HIGH_PRIO))
+ self._queue.task_done()
+ except gcodeInterpreter.AnalysisAborted:
+ aborted = entry
+ self._logger.debug("Running analysis of entry {entry} aborted".format(**locals()))
+ else:
+ time.sleep(1.0)
+
+ def _analyze(self, entry, high_priority=False):
+ path = entry.absolute_path
+ if path is None or not os.path.exists(path):
+ return
+
+ self._current = entry
+ self._current_progress = 0
+
+ try:
+ self._logger.info("Starting analysis of {entry}".format(**locals()))
+ eventManager().fire(Events.METADATA_ANALYSIS_STARTED, {"file": entry.path, "type": entry.type})
+ try:
+ result = self._do_analysis(high_priority=high_priority)
+ except TypeError:
+ result = self._do_analysis()
+ self._logger.debug("Analysis of entry {entry} finished, notifying callback".format(**locals()))
+ self._finished_callback(self._current, result)
+ finally:
+ self._current = None
+ self._current_progress = None
+
+ def _do_analysis(self, high_priority=False):
+ """
+ Performs the actual analysis of the current entry which can be accessed via ``self._current``. Needs to be
+ overridden by sub classes.
+
+ Arguments:
+ high_priority (bool): Whether the current entry has high priority or not.
+
+ Returns:
+ object: The result of the analysis which will be forwarded to the ``finished_callback`` provided during
+ construction.
+ """
+ return None
+
+ def _do_abort(self):
+ """
+ Aborts analysis of the current entry. Needs to be overridden by sub classes.
+ """
+ pass
+
+
+class GcodeAnalysisQueue(AbstractAnalysisQueue):
+ """
+ A queue to analyze GCODE files. Analysis results are :class:`dict` instances structured as follows:
+
+ .. list-table::
+ :widths: 25 70
+
+ - * **Key**
+ * **Description**
+ - * ``estimatedPrintTime``
+ * Estimated time the file take to print, in minutes
+ - * ``filament``
+ * Substructure describing estimated filament usage. Keys are ``tool0`` for the first extruder, ``tool1`` for
+ the second and so on. For each tool extruded length and volume (based on diameter) are provided.
+ - * ``filament.toolX.length``
+ * The extruded length in mm
+ - * ``filament.toolX.volume``
+ * The extruded volume in cm³
+ """
+
+ def _do_analysis(self, high_priority=False):
+ try:
+ def throttle():
+ time.sleep(0.01)
+
+ throttle_callback = throttle
+ if high_priority:
+ throttle_callback = None
+
+ self._gcode = gcodeInterpreter.gcode()
+ self._gcode.load(self._current.absolute_path, self._current.printer_profile, throttle=throttle_callback)
+
+ result = dict()
+ if self._gcode.totalMoveTimeMinute:
+ result["estimatedPrintTime"] = self._gcode.totalMoveTimeMinute * 60
+ if self._gcode.extrusionAmount:
+ result["filament"] = dict()
+ for i in range(len(self._gcode.extrusionAmount)):
+ result["filament"]["tool%d" % i] = {
+ "length": self._gcode.extrusionAmount[i],
+ "volume": self._gcode.extrusionVolume[i]
+ }
+ return result
+ finally:
+ self._gcode = None
+
+ def _do_abort(self):
+ if self._gcode:
+ self._gcode.abort()
diff --git a/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/filemanager/destinations.py b/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/filemanager/destinations.py
new file mode 100644
index 000000000..c84ea9b97
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/filemanager/destinations.py
@@ -0,0 +1,7 @@
+# coding=utf-8
+__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
+
+class FileDestinations(object):
+
+ SDCARD = "sdcard"
+ LOCAL = "local"
diff --git a/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/filemanager/storage.py b/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/filemanager/storage.py
new file mode 100644
index 000000000..6a2378dd6
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/filemanager/storage.py
@@ -0,0 +1,1023 @@
+# coding=utf-8
+from __future__ import absolute_import
+
+__author__ = "Gina Häußge "
+__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
+__copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms of the AGPLv3 License"
+
+
+import logging
+import os
+import pylru
+import tempfile
+
+import octoprint.filemanager
+
+from octoprint.util import is_hidden_path
+
+class StorageInterface(object):
+ """
+ Interface of storage adapters for OctoPrint.
+ """
+
+
+ @property
+ def analysis_backlog(self):
+ """
+ Get an iterator over all items stored in the storage that need to be analysed by the :class:`~octoprint.filemanager.AnalysisQueue`.
+
+ The yielded elements are expected as storage specific absolute paths to the respective files. Don't forget
+ to recurse into folders if your storage adapter supports those.
+
+ :return: an iterator yielding all un-analysed files in the storage
+ """
+ # empty generator pattern, yield is intentionally unreachable
+ return
+ yield
+
+ def file_exists(self, path):
+ """
+ Returns whether the file indicated by ``path`` exists or not.
+ :param string path: the path to check for existence
+ :return: ``True`` if the file exists, ``False`` otherwise
+ """
+ raise NotImplementedError()
+
+ def list_files(self, path=None, filter=None, recursive=True):
+ """
+ List all files in storage starting at ``path``. If ``recursive`` is set to True (the default), also dives into
+ subfolders.
+
+ An optional filter function can be supplied which will be called with a file name and file data and which has
+ to return True if the file is to be included in the result or False if not.
+
+ The data structure of the returned result will be a dictionary mapping from file names to entry data. File nodes
+ will contain their metadata here, folder nodes will contain their contained files and folders. Example::
+
+ {
+ "some_folder": {
+ "type": "folder",
+ "children": {
+ "some_sub_folder": {
+ "type": "folder",
+ "children": { ... }
+ },
+ "some_file.gcode": {
+ "type": "machinecode",
+ "hash": "",
+ "links": [ ... ],
+ ...
+ },
+ ...
+ }
+ "test.gcode": {
+ "type": "machinecode",
+ "hash": "",
+ "links": [...],
+ ...
+ },
+ "test.stl": {
+ "type": "model",
+ "hash": "",
+ "links": [...],
+ ...
+ },
+ ...
+ }
+
+ :param string path: base path from which to recursively list all files, optional, if not supplied listing will start
+ from root of base folder
+ :param function filter: a filter that matches the files that are to be returned, may be left out in which case no
+ filtering will take place
+ :param bool recursive: will also step into sub folders for building the complete list if set to True
+ :return: a dictionary mapping entry names to entry data that represents the whole file list
+ """
+ raise NotImplementedError()
+
+ def add_folder(self, path, ignore_existing=True):
+ """
+ Adds a folder as ``path``. The ``path`` will be sanitized.
+
+ :param string path: the path of the new folder
+ :param bool ignore_existing: if set to True, no error will be raised if the folder to be added already exists
+ :return: the sanitized name of the new folder to be used for future references to the folder
+ """
+ raise NotImplementedError()
+
+ def remove_folder(self, path, recursive=True):
+ """
+ Removes the folder at ``path``.
+
+ :param string path: the path of the folder to remove
+ :param bool recursive: if set to True, contained folders and files will also be removed, otherwise and error will
+ be raised if the folder is not empty (apart from ``.metadata.yaml``) when it's to be removed
+ """
+ raise NotImplementedError()
+
+ def add_file(self, path, file_object, printer_profile=None, links=None, allow_overwrite=False):
+ """
+ Adds the file ``file_object`` as ``path``
+
+ :param string path: the file's new path, will be sanitized
+ :param object file_object: a file object that provides a ``save`` method which will be called with the destination path
+ where the object should then store its contents
+ :param object printer_profile: the printer profile associated with this file (if any)
+ :param list links: any links to add with the file
+ :param bool allow_overwrite: if set to True no error will be raised if the file already exists and the existing file
+ and its metadata will just be silently overwritten
+ :return: the sanitized name of the file to be used for future references to it
+ """
+ raise NotImplementedError()
+
+ def remove_file(self, path):
+ """
+ Removes the file at ``path``. Will also take care of deleting the corresponding entries
+ in the metadata and deleting all links pointing to the file.
+
+ :param string path: path of the file to remove
+ """
+ raise NotImplementedError()
+
+ def get_metadata(self, path):
+ """
+ Retrieves the metadata for the file ``path``.
+
+ :param path: virtual path to the file for which to retrieve the metadata
+ :return: the metadata associated with the file
+ """
+ raise NotImplementedError()
+
+ def add_link(self, path, rel, data):
+ """
+ Adds a link of relation ``rel`` to file ``path`` with the given ``data``.
+
+ The following relation types are currently supported:
+
+ * ``model``: adds a link to a model from which the file was created/sliced, expected additional data is the ``name``
+ and optionally the ``hash`` of the file to link to. If the link can be resolved against another file on the
+ current ``path``, not only will it be added to the links of ``name`` but a reverse link of type ``machinecode``
+ refering to ``name`` and its hash will also be added to the linked ``model`` file
+ * ``machinecode``: adds a link to a file containing machine code created from the current file (model), expected
+ additional data is the ``name`` and optionally the ``hash`` of the file to link to. If the link can be resolved
+ against another file on the current ``path``, not only will it be added to the links of ``name`` but a reverse
+ link of type ``model`` refering to ``name`` and its hash will also be added to the linked ``model`` file.
+ * ``web``: adds a location on the web associated with this file (e.g. a website where to download a model),
+ expected additional data is a ``href`` attribute holding the website's URL and optionally a ``retrieved``
+ attribute describing when the content was retrieved
+
+ Note that adding ``model`` links to files identifying as models or ``machinecode`` links to files identifying
+ as machine code will be refused.
+
+ :param path: path of the file for which to add a link
+ :param rel: type of relation of the link to add (currently ``model``, ``machinecode`` and ``web`` are supported)
+ :param data: additional data of the link to add
+ """
+ raise NotImplementedError()
+
+ def remove_link(self, path, rel, data):
+ """
+ Removes the link consisting of ``rel`` and ``data`` from file ``name`` on ``path``.
+
+ :param path: path of the file from which to remove the link
+ :param rel: type of relation of the link to remove (currently ``model``, ``machinecode`` and ``web`` are supported)
+ :param data: additional data of the link to remove, must match existing link
+ """
+ raise NotImplementedError()
+
+ def set_additional_metadata(self, path, key, data, overwrite=False, merge=False):
+ """
+ Adds additional metadata to the metadata of ``path``. Metadata in ``data`` will be saved under ``key``.
+
+ If ``overwrite`` is set and ``key`` already exists in ``name``'s metadata, the current value will be overwritten.
+
+ If ``merge`` is set and ``key`` already exists and both ``data`` and the existing data under ``key`` are dictionaries,
+ the two dictionaries will be merged recursively.
+
+ :param path: the virtual path to the file for which to add additional metadata
+ :param key: key of metadata to add
+ :param data: metadata to add
+ :param overwrite: if True and ``key`` already exists, it will be overwritten
+ :param merge: if True and ``key`` already exists and both ``data`` and the existing data are dictionaries, they
+ will be merged
+ """
+ raise NotImplementedError()
+
+ def remove_additional_metadata(self, path, key):
+ """
+ Removes additional metadata under ``key`` for ``name`` on ``path``
+
+ :param path: the virtual path to the file for which to remove the metadata under ``key``
+ :param key: the key to remove
+ """
+ raise NotImplementedError()
+
+ def sanitize(self, path):
+ """
+ Sanitizes the given ``path``, stripping it of all invalid characters. The ``path`` may consist of both
+ folder and file name, the underlying implementation must separate those if necessary and sanitize individually.
+
+ :param string path: the path to sanitize
+ :return: a 2-tuple containing the sanitized path and file name
+ """
+ raise NotImplementedError()
+
+ def sanitize_path(self, path):
+ """
+ Sanitizes the given folder-only ``path``, stripping it of all invalid characters.
+ :param string path: the path to sanitize
+ :return: the sanitized path
+ """
+ raise NotImplementedError()
+
+ def sanitize_name(self, name):
+ """
+ Sanitizes the given file ``name``, stripping it of all invalid characters.
+ :param string name: the file name to sanitize
+ :return: the sanitized name
+ """
+ raise NotImplementedError()
+
+ def split_path(self, path):
+ """
+ Split ``path`` into base directory and file name.
+ :param path: the path to split
+ :return: a tuple (base directory, file name)
+ """
+ raise NotImplementedError()
+
+ def join_path(self, *path):
+ """
+ Join path elements together
+ :param path: path elements to join
+ :return: joined representation of the path to be usable as fully qualified path for further operations
+ """
+ raise NotImplementedError()
+
+ def path_on_disk(self, path):
+ """
+ Retrieves the path on disk for ``path``.
+
+ Note: if the storage is not on disk and there exists no path on disk to refer to it, this method should
+ raise an :class:`io.UnsupportedOperation`
+
+ Opposite of :func:`path_in_storage`.
+
+ :param string path: the virtual path for which to retrieve the path on disk
+ :return: the path on disk to ``path``
+ """
+ raise NotImplementedError()
+
+ def path_in_storage(self, path):
+ """
+ Retrieves the equivalent in the storage adapter for ``path``.
+
+ Opposite of :func:`path_on_disk`.
+
+ :param string path: the path for which to retrieve the storage path
+ :return: the path in storage to ``path``
+ """
+ raise NotImplementedError()
+
+
+
+class LocalFileStorage(StorageInterface):
+ """
+ The ``LocalFileStorage`` is a storage implementation which holds all files, folders and metadata on disk.
+
+ Metadata is managed inside ``.metadata.yaml`` files in the respective folders, indexed by the sanitized filenames
+ stored within the folder. Metadata access is managed through an LRU cache to minimize access overhead.
+
+ This storage type implements :func:`path_on_disk`.
+ """
+
+ def __init__(self, basefolder, create=False):
+ """
+ Initializes a ``LocalFileStorage`` instance under the given ``basefolder``, creating the necessary folder
+ if necessary and ``create`` is set to ``True``.
+
+ :param string basefolder: the path to the folder under which to create the storage
+ :param bool create: ``True`` if the folder should be created if it doesn't exist yet, ``False`` otherwise
+ """
+ self._logger = logging.getLogger(__name__)
+
+ self.basefolder = os.path.realpath(os.path.abspath(basefolder))
+ if not os.path.exists(self.basefolder) and create:
+ os.makedirs(self.basefolder)
+ if not os.path.exists(self.basefolder) or not os.path.isdir(self.basefolder):
+ raise RuntimeError("{basefolder} is not a valid directory".format(**locals()))
+
+ import threading
+ self._metadata_lock = threading.Lock()
+
+ self._metadata_cache = pylru.lrucache(10)
+
+ self._old_metadata = None
+ self._initialize_metadata()
+
+ def _initialize_metadata(self):
+ self._logger.info("Initializing the file metadata for {}...".format(self.basefolder))
+
+ old_metadata_path = os.path.join(self.basefolder, "metadata.yaml")
+ backup_path = os.path.join(self.basefolder, "metadata.yaml.backup")
+
+ if os.path.exists(old_metadata_path):
+ # load the old metadata file
+ try:
+ with open(old_metadata_path) as f:
+ import yaml
+ self._old_metadata = yaml.safe_load(f)
+ except:
+ self._logger.exception("Error while loading old metadata file")
+
+ # make sure the metadata is initialized as far as possible
+ self._list_folder(self.basefolder)
+
+ # rename the old metadata file
+ self._old_metadata = None
+ try:
+ import shutil
+ shutil.move(old_metadata_path, backup_path)
+ except:
+ self._logger.exception("Could not rename old metadata.yaml file")
+
+ else:
+ # make sure the metadata is initialized as far as possible
+ self._list_folder(self.basefolder)
+
+ self._logger.info("... file metadata for {} initialized successfully.".format(self.basefolder))
+
+ @property
+ def analysis_backlog(self):
+ for entry in self._analysis_backlog_generator():
+ yield entry
+
+ def _analysis_backlog_generator(self, path=None):
+ if path is None:
+ path = self.basefolder
+
+ metadata = self._get_metadata(path)
+ if not metadata:
+ metadata = dict()
+ for entry in os.listdir(path):
+ if is_hidden_path(entry) or not octoprint.filemanager.valid_file_type(entry):
+ continue
+
+ absolute_path = os.path.join(path, entry)
+ if os.path.isfile(absolute_path):
+ if not entry in metadata or not isinstance(metadata[entry], dict) or not "analysis" in metadata[entry]:
+ printer_profile_rels = self.get_link(absolute_path, "printerprofile")
+ if printer_profile_rels:
+ printer_profile_id = printer_profile_rels[0]["id"]
+ else:
+ printer_profile_id = None
+
+ yield entry, absolute_path, printer_profile_id
+ elif os.path.isdir(absolute_path):
+ for sub_entry in self._analysis_backlog_generator(absolute_path):
+ yield self.join_path(entry, sub_entry[0]), sub_entry[1], sub_entry[2]
+
+ def file_exists(self, path):
+ path, name = self.sanitize(path)
+ file_path = os.path.join(path, name)
+ return os.path.exists(file_path) and os.path.isfile(file_path)
+
+ def list_files(self, path=None, filter=None, recursive=True):
+ if path:
+ path = self.sanitize_path(path)
+ else:
+ path = self.basefolder
+ return self._list_folder(path, filter=filter, recursive=recursive)
+
+ def add_folder(self, path, ignore_existing=True):
+ path, name = self.sanitize(path)
+
+ folder_path = os.path.join(path, name)
+ if os.path.exists(folder_path):
+ if not ignore_existing:
+ raise RuntimeError("{sanitized_foldername} does already exist in {virtual_path}".format(**locals()))
+ else:
+ os.mkdir(folder_path)
+
+ return self.path_in_storage((path, name))
+
+ def remove_folder(self, path, recursive=True):
+ path, name = self.sanitize(path)
+
+ folder_path = os.path.join(path, name)
+ if not os.path.exists(folder_path):
+ return
+
+ contents = os.listdir(folder_path)
+ if ".metadata.yaml" in contents:
+ contents.remove(".metadata.yaml")
+ if contents and not recursive:
+ raise RuntimeError("{sanitized_foldername} in {virtual_path} is not empty".format(**locals()))
+
+ import shutil
+ shutil.rmtree(folder_path)
+
+ def add_file(self, path, file_object, printer_profile=None, links=None, allow_overwrite=False):
+ path, name = self.sanitize(path)
+ if not octoprint.filemanager.valid_file_type(name):
+ raise RuntimeError("{name} is an unrecognized file type".format(**locals()))
+
+ metadata = self._get_metadata(path)
+ if not metadata:
+ metadata = dict()
+
+ file_path = os.path.join(path, name)
+ if os.path.exists(file_path) and not os.path.isfile(file_path):
+ raise RuntimeError("{name} does already exist in {path} and is not a file".format(**locals()))
+ if os.path.exists(file_path) and not allow_overwrite:
+ raise RuntimeError("{name} does already exist in {path} and overwriting is prohibited".format(**locals()))
+
+ # make sure folders exist
+ if not os.path.exists(path):
+ os.makedirs(path)
+
+ # save the file
+ file_object.save(file_path)
+
+ # save the file's hash to the metadata of the folder
+ file_hash = self._create_hash(file_path)
+ if not name in metadata or not "hash" in metadata[name] or metadata[name]["hash"] != file_hash:
+ # make sure to create a new metadata entry if we've never seen that file with that content before
+ file_metadata = dict(
+ hash=file_hash
+ )
+ metadata[name] = file_metadata
+ self._save_metadata(path, metadata)
+
+ # process any links that were also provided for adding to the file
+ if not links:
+ links = []
+
+ if printer_profile is not None:
+ links.append(("printerprofile", dict(id=printer_profile["id"], name=printer_profile["name"])))
+
+ self._add_links(name, path, links)
+
+ # touch the file to set last access and modification time to now
+ os.utime(file_path, None)
+
+ return self.path_in_storage((path, name))
+
+ def remove_file(self, path):
+ path, name = self.sanitize(path)
+
+ metadata = self._get_metadata(path)
+
+ file_path = os.path.join(path, name)
+ if not os.path.exists(file_path):
+ return
+ if not os.path.isfile(file_path):
+ raise RuntimeError("{name} in {path} is not a file".format(**locals()))
+
+ try:
+ os.remove(file_path)
+ except Exception as e:
+ raise RuntimeError("Could not delete {name} in {path}".format(**locals()), e)
+
+ if name in metadata:
+ if "hash" in metadata[name]:
+ hash = metadata[name]["hash"]
+ for m in metadata.values():
+ if not "links" in m:
+ continue
+ for link in m["links"]:
+ if "rel" in link and "hash" in link and (link["rel"] == "model" or link["rel"] == "machinecode") and link["hash"] == hash:
+ m["links"].remove(link)
+ del metadata[name]
+ self._save_metadata(path, metadata)
+
+ def get_metadata(self, path):
+ path, name = self.sanitize(path)
+
+ metadata = self._get_metadata(path)
+ if name in metadata:
+ return metadata[name]
+ else:
+ return None
+
+ def get_link(self, path, rel):
+ path, name = self.sanitize(path)
+ return self._get_links(name, path, rel)
+
+
+ def add_link(self, path, rel, data):
+ path, name = self.sanitize(path)
+ self._add_links(name, path, [(rel, data)])
+
+ def remove_link(self, path, rel, data):
+ path, name = self.sanitize(path)
+ self._remove_links(name, path, [(rel, data)])
+
+ def add_history(self, path, data):
+ path, name = self.sanitize(path)
+ self._add_history(name, path, data)
+
+ def update_history(self, path, index, data):
+ path, name = self.sanitize(path)
+ self._update_history(name, path, index, data)
+
+ def remove_history(self, path, index):
+ path, name = self.sanitize(path)
+ self._update_history(name, path, index)
+
+ def set_additional_metadata(self, path, key, data, overwrite=False, merge=False):
+ path, name = self.sanitize(path)
+ metadata = self._get_metadata(path)
+ metadata_dirty = False
+
+ if not name in metadata:
+ return
+
+ if not key in metadata[name] or overwrite:
+ metadata[name][key] = data
+ metadata_dirty = True
+ elif key in metadata[name] and isinstance(metadata[name][key], dict) and isinstance(data, dict) and merge:
+ current_data = metadata[name][key]
+
+ import octoprint.util
+ new_data = octoprint.util.dict_merge(current_data, data)
+ metadata[name][key] = new_data
+ metadata_dirty = True
+ elif key in metadata[name] and overwrite:
+ metadata[name][key] = data
+ metadata_dirty = True
+
+ if metadata_dirty:
+ self._save_metadata(path, metadata)
+
+ def remove_additional_metadata(self, path, key):
+ path, name = self.sanitize(path)
+ metadata = self._get_metadata(path)
+
+ if not name in metadata:
+ return
+
+ if not key in metadata[name]:
+ return
+
+ del metadata[name][key]
+ self._save_metadata(path, metadata)
+
+ def split_path(self, path):
+ split = path.split("/")
+ if len(split) == 1:
+ return "", split[0]
+ else:
+ return self.join_path(*split[:-1]), split[-1]
+
+ def join_path(self, *path):
+ return "/".join(path)
+
+ def sanitize(self, path):
+ """
+ Returns a ``(path, name)`` tuple derived from the provided ``path``.
+
+ ``path`` may be:
+ * a storage path
+ * an absolute file system path
+ * a tuple or list containing all individual path elements
+ * a string representation of the path
+ * with or without a file name
+
+ Note that for a ``path`` without a trailing slash the last part will be considered a file name and
+ hence be returned at second position. If you only need to convert a folder path, be sure to
+ include a trailing slash for a string ``path`` or an empty last element for a list ``path``.
+ """
+ name = None
+ if isinstance(path, (str, unicode, basestring)):
+ if path.startswith(self.basefolder):
+ path = path[len(self.basefolder):]
+ path = path.replace(os.path.sep, "/")
+ path = path.split("/")
+ if isinstance(path, (list, tuple)):
+ if len(path) == 1:
+ name = path[0]
+ path = "/"
+ else:
+ name = path[-1]
+ path = "/" + self.join_path(*path[:-1])
+ if not path:
+ path = "/"
+
+ name = self.sanitize_name(name)
+ path = self.sanitize_path(path)
+ return path, name
+
+ def sanitize_name(self, name):
+ """
+ Raises a :class:`ValueError` for a ``name`` containing ``/`` or ``\``. Otherwise strips any characters from the
+ given ``name`` that are not any of the ASCII characters, digits, ``-``, ``_``, ``.``, ``(``, ``)`` or space and
+ replaces and spaces with ``_``.
+ """
+ if name is None:
+ return None
+
+ if "/" in name or "\\" in name:
+ raise ValueError("name must not contain / or \\")
+
+ import string
+ valid_chars = "-_.() {ascii}{digits}".format(ascii=string.ascii_letters, digits=string.digits)
+ sanitized_name = ''.join(c for c in name if c in valid_chars)
+ sanitized_name = sanitized_name.replace(" ", "_")
+ return sanitized_name
+
+ def sanitize_path(self, path):
+ """
+ Ensures that the on disk representation of ``path`` is located under the configured basefolder. Resolves all
+ relative path elements (e.g. ``..``) and sanitizes folder names using :func:`sanitize_name`. Final path is the
+ absolute path including leading ``basefolder`` path.
+ """
+ if path[0] == "/" or path[0] == ".":
+ path = path[1:]
+ path_elements = path.split("/")
+ joined_path = self.basefolder
+ for path_element in path_elements:
+ joined_path = os.path.join(joined_path, self.sanitize_name(path_element))
+ path = os.path.realpath(joined_path)
+ if not path.startswith(self.basefolder):
+ raise ValueError("path not contained in base folder: {path}".format(**locals()))
+ return path
+
+ def path_in_storage(self, path):
+ if isinstance(path, (tuple, list)):
+ path = self.join_path(*path)
+ if isinstance(path, (str, unicode, basestring)):
+ if path.startswith(self.basefolder):
+ path = path[len(self.basefolder):]
+ path = path.replace(os.path.sep, "/")
+ if path.startswith("/"):
+ path = path[1:]
+
+ return path
+
+ def path_on_disk(self, path):
+ path, name = self.sanitize(path)
+ return os.path.join(path, name)
+
+ ##~~ internals
+
+ def _add_history(self, name, path, data):
+ metadata = self._get_metadata(path)
+
+ if not name in metadata:
+ metadata[name] = dict()
+
+ if not "hash" in metadata[name]:
+ metadata[name]["hash"] = self._create_hash(os.path.join(path, name))
+
+ if not "history" in metadata[name]:
+ metadata[name]["history"] = []
+
+ metadata[name]["history"].append(data)
+ self._calculate_stats_from_history(name, path, metadata=metadata, save=False)
+ self._save_metadata(path, metadata)
+
+ def _update_history(self, name, path, index, data):
+ metadata = self._get_metadata(path)
+
+ if not name in metadata or not "history" in metadata[name]:
+ return
+
+ try:
+ metadata[name]["history"][index].update(data)
+ self._calculate_stats_from_history(name, path, metadata=metadata, save=False)
+ self._save_metadata(path, metadata)
+ except IndexError:
+ pass
+
+ def _delete_history(self, name, path, index):
+ metadata = self._get_metadata(path)
+
+ if not name in metadata or not "history" in metadata[name]:
+ return
+
+ try:
+ del metadata[name]["history"][index]
+ self._calculate_stats_from_history(name, path, metadata=metadata, save=False)
+ self._save_metadata(path, metadata)
+ except IndexError:
+ pass
+
+ def _calculate_stats_from_history(self, name, path, metadata=None, save=True):
+ if metadata is None:
+ metadata = self._get_metadata(path)
+
+ if not name in metadata or not "history" in metadata[name]:
+ return
+
+ # collect data from history
+ former_print_times = dict()
+ last_print = dict()
+
+
+ for history_entry in metadata[name]["history"]:
+ if not "printTime" in history_entry or not "success" in history_entry or not history_entry["success"] or not "printerProfile" in history_entry:
+ continue
+
+ printer_profile = history_entry["printerProfile"]
+ print_time = history_entry["printTime"]
+
+ if not printer_profile in former_print_times:
+ former_print_times[printer_profile] = []
+ former_print_times[printer_profile].append(print_time)
+
+ if not printer_profile in last_print or last_print[printer_profile] is None or ("timestamp" in history_entry and history_entry["timestamp"] > last_print[printer_profile]["timestamp"]):
+ last_print[printer_profile] = history_entry
+
+ # calculate stats
+ statistics = dict(averagePrintTime=dict(), lastPrintTime=dict())
+
+ for printer_profile in former_print_times:
+ if not former_print_times[printer_profile]:
+ continue
+ statistics["averagePrintTime"][printer_profile] = sum(former_print_times[printer_profile]) / float(len(former_print_times[printer_profile]))
+
+ for printer_profile in last_print:
+ if not last_print[printer_profile]:
+ continue
+ statistics["lastPrintTime"][printer_profile] = last_print[printer_profile]["printTime"]
+
+ metadata[name]["statistics"] = statistics
+
+ if save:
+ self._save_metadata(path, metadata)
+
+ def _get_links(self, name, path, searched_rel):
+ metadata = self._get_metadata(path)
+ result = []
+
+ if not name in metadata:
+ return result
+
+ if not "links" in metadata[name]:
+ return result
+
+ for data in metadata[name]["links"]:
+ if not "rel" in data or not data["rel"] == searched_rel:
+ continue
+ result.append(data)
+ return result
+
+ def _add_links(self, name, path, links):
+ file_type = octoprint.filemanager.get_file_type(name)
+ if file_type:
+ file_type = file_type[0]
+
+ metadata = self._get_metadata(path)
+ metadata_dirty = False
+
+ if not name in metadata:
+ metadata[name] = dict()
+
+ if not "hash" in metadata[name]:
+ metadata[name]["hash"] = self._create_hash(os.path.join(path, name))
+
+ if not "links" in metadata[name]:
+ metadata[name]["links"] = []
+
+ for rel, data in links:
+ if (rel == "model" or rel == "machinecode") and "name" in data:
+ if file_type == "model" and rel == "model":
+ # adding a model link to a model doesn't make sense
+ return
+ elif file_type == "machinecode" and rel == "machinecode":
+ # adding a machinecode link to a machinecode doesn't make sense
+ return
+
+ ref_path = os.path.join(path, data["name"])
+ if not os.path.exists(ref_path):
+ # file doesn't exist, we won't create the link
+ continue
+
+ # fetch hash of target file
+ if data["name"] in metadata and "hash" in metadata[data["name"]]:
+ hash = metadata[data["name"]]["hash"]
+ else:
+ hash = self._create_hash(ref_path)
+ if not data["name"] in metadata:
+ metadata[data["name"]] = dict(
+ hash=hash,
+ links=[]
+ )
+ else:
+ metadata[data["name"]]["hash"] = hash
+
+ if "hash" in data and not data["hash"] == hash:
+ # file doesn't have the correct hash, we won't create the link
+ continue
+
+ if not "links" in metadata[data["name"]]:
+ metadata[data["name"]]["links"] = []
+
+ # add reverse link to link target file
+ metadata[data["name"]]["links"].append(
+ dict(rel="machinecode" if rel == "model" else "model", name=name, hash=metadata[name]["hash"])
+ )
+ metadata_dirty = True
+
+ link_dict = dict(
+ rel=rel,
+ name=data["name"],
+ hash=hash
+ )
+
+ elif rel == "web" and "href" in data:
+ link_dict = dict(
+ rel=rel,
+ href=data["href"]
+ )
+ if "retrieved" in data:
+ link_dict["retrieved"] = data["retrieved"]
+
+ else:
+ continue
+
+ if link_dict:
+ metadata[name]["links"].append(link_dict)
+ metadata_dirty = True
+
+ if metadata_dirty:
+ self._save_metadata(path, metadata)
+
+ def _remove_links(self, name, path, links):
+ metadata = self._get_metadata(path)
+ metadata_dirty = False
+
+ if not name in metadata or not "hash" in metadata[name]:
+ hash = self._create_hash(os.path.join(path, name))
+ else:
+ hash = metadata[name]["hash"]
+
+ for rel, data in links:
+ if (rel == "model" or rel == "machinecode") and "name" in data:
+ if data["name"] in metadata and "links" in metadata[data["name"]]:
+ ref_rel = "model" if rel == "machinecode" else "machinecode"
+ for link in metadata[data["name"]]["links"]:
+ if link["rel"] == ref_rel and "name" in link and link["name"] == name and "hash" in link and link["hash"] == hash:
+ metadata[data["name"]]["links"].remove(link)
+ metadata_dirty = True
+
+ if "links" in metadata[name]:
+ for link in metadata[name]["links"]:
+ if not link["rel"] == rel:
+ continue
+
+ matches = True
+ for k, v in data.items():
+ if not k in link or not link[k] == v:
+ matches = False
+ break
+
+ if not matches:
+ continue
+
+ metadata[name]["links"].remove(link)
+ metadata_dirty = True
+
+ if metadata_dirty:
+ self._save_metadata(path, metadata)
+
+ def _list_folder(self, path, filter=None, recursive=True):
+ metadata = self._get_metadata(path)
+ if not metadata:
+ metadata = dict()
+ metadata_dirty = False
+
+ result = dict()
+ for entry in os.listdir(path):
+ if is_hidden_path(entry):
+ # no hidden files and folders
+ continue
+
+ entry_path = os.path.join(path, entry)
+
+ # file handling
+ if os.path.isfile(entry_path):
+ file_type = octoprint.filemanager.get_file_type(entry)
+ if not file_type:
+ # only supported extensions
+ continue
+ else:
+ file_type = file_type[0]
+
+ if entry in metadata and isinstance(metadata[entry], dict):
+ entry_data = metadata[entry]
+ else:
+ entry_data = self._add_basic_metadata(path, entry, save=False, metadata=metadata)
+ metadata_dirty = True
+
+ # TODO extract model hash from source if possible to recreate link
+
+ if not filter or filter(entry, entry_data):
+ # only add files passing the optional filter
+ extended_entry_data = dict()
+ extended_entry_data.update(entry_data)
+ extended_entry_data["name"] = entry
+ extended_entry_data["type"] = file_type
+ stat = os.stat(entry_path)
+ if stat:
+ extended_entry_data["size"] = stat.st_size
+ extended_entry_data["date"] = int(stat.st_mtime)
+
+ result[entry] = extended_entry_data
+
+ # folder recursion
+ elif os.path.isdir(entry_path) and recursive:
+ sub_result = self._list_folder(entry_path, filter=filter)
+ result[entry] = dict(
+ name=entry,
+ type="folder",
+ children=sub_result
+ )
+
+ # TODO recreate links if we have metadata less entries
+
+ # save metadata
+ if metadata_dirty:
+ self._save_metadata(path, metadata)
+
+ return result
+
+ def _add_basic_metadata(self, path, entry, additional_metadata=None, save=True, metadata=None):
+ if additional_metadata is None:
+ additional_metadata = dict()
+
+ if metadata is None:
+ metadata = self._get_metadata(path)
+
+ entry_data = dict(
+ hash=self._create_hash(os.path.join(path, entry)),
+ links=[],
+ notes=[]
+ )
+
+ if path == self.basefolder and self._old_metadata is not None and entry in self._old_metadata and "gcodeAnalysis" in self._old_metadata[entry]:
+ # if there is still old metadata available and that contains an analysis for this file, use it!
+ entry_data["analysis"] = self._old_metadata[entry]["gcodeAnalysis"]
+
+ entry_data.update(additional_metadata)
+ metadata[entry] = entry_data
+
+ if save:
+ self._save_metadata(path, metadata)
+
+ return entry_data
+
+ def _create_hash(self, path):
+ import hashlib
+
+ blocksize = 65536
+ hash = hashlib.sha1()
+ with open(path, "rb") as f:
+ buffer = f.read(blocksize)
+ while len(buffer) > 0:
+ hash.update(buffer)
+ buffer = f.read(blocksize)
+
+ return hash.hexdigest()
+
+ def _get_metadata(self, path):
+ if path in self._metadata_cache:
+ return self._metadata_cache[path]
+
+ metadata_path = os.path.join(path, ".metadata.yaml")
+ if os.path.exists(metadata_path):
+ with self._metadata_lock:
+ with open(metadata_path) as f:
+ try:
+ import yaml
+ metadata = yaml.safe_load(f)
+ except:
+ self._logger.exception("Error while reading .metadata.yaml from {path}".format(**locals()))
+ else:
+ self._metadata_cache[path] = metadata
+ return metadata
+ return dict()
+
+ def _save_metadata(self, path, metadata):
+ metadata_path = os.path.join(path, ".metadata.yaml")
+
+ with self._metadata_lock:
+ try:
+ import yaml
+ import shutil
+
+ file_obj = tempfile.NamedTemporaryFile(delete=False)
+ try:
+ yaml.safe_dump(metadata, stream=file_obj, default_flow_style=False, indent=" ", allow_unicode=True)
+ file_obj.close()
+ shutil.move(file_obj.name, metadata_path)
+ finally:
+ try:
+ if os.path.exists(file_obj.name):
+ os.remove(file_obj.name)
+ except Exception as e:
+ self._logger.warn("Could not delete file {}: {}".format(file_obj.name, str(e)))
+ except:
+ self._logger.exception("Error while writing .metadata.yaml to {path}".format(**locals()))
+ else:
+ self._metadata_cache[path] = metadata
diff --git a/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/filemanager/util.py b/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/filemanager/util.py
new file mode 100644
index 000000000..f3fe20fb3
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/filemanager/util.py
@@ -0,0 +1,241 @@
+# coding=utf-8
+from __future__ import absolute_import
+
+__author__ = "Gina Häußge "
+__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
+__copyright__ = "Copyright (C) 2015 The OctoPrint Project - Released under terms of the AGPLv3 License"
+
+import io
+
+from octoprint.util import atomic_write
+
+class AbstractFileWrapper(object):
+ """
+ Wrapper for file representations to save to storages.
+
+ Arguments:
+ filename (str): The file's name
+ """
+
+ def __init__(self, filename):
+ self.filename = filename
+
+ def save(self, path):
+ """
+ Saves the file's content to the given absolute path.
+
+ Arguments:
+ path (str): The absolute path to where to save the file
+ """
+ raise NotImplementedError()
+
+ def stream(self):
+ """
+ Returns a Python stream object (subclass of io.IOBase) representing the file's contents.
+
+ Returns:
+ io.IOBase: The file's contents as a stream.
+ """
+ raise NotImplementedError()
+
+class DiskFileWrapper(AbstractFileWrapper):
+ """
+ An implementation of :class:`.AbstractFileWrapper` that wraps an actual file on disk. The `save` implementations
+ will either copy the file to the new path (preserving file attributes) or -- if `move` is `True` (the default) --
+ move the file.
+
+ Arguments:
+ filename (str): The file's name
+ path (str): The file's absolute path
+ move (boolean): Whether to move the file upon saving (True, default) or copying.
+ """
+
+ def __init__(self, filename, path, move=True):
+ AbstractFileWrapper.__init__(self, filename)
+ self.path = path
+ self.move = move
+
+ def save(self, path):
+ import shutil
+
+ if self.move:
+ shutil.move(self.path, path)
+ else:
+ shutil.copy2(self.path, path)
+
+ def stream(self):
+ return io.open(self.path, "rb")
+
+class StreamWrapper(AbstractFileWrapper):
+ """
+ A wrapper allowing processing of one or more consecutive streams.
+
+ Arguments:
+ *streams (io.IOBase): One or more streams to process one after another to save to storage.
+ """
+ def __init__(self, filename, *streams):
+ if not len(streams) > 0:
+ raise ValueError("Need at least one stream to wrap")
+
+ AbstractFileWrapper.__init__(self, filename)
+ self.streams = streams
+
+ def save(self, path):
+ """
+ Will dump the contents of all streams provided during construction into the target file, in the order they were
+ provided.
+ """
+ import shutil
+
+ with atomic_write(path, "wb") as dest:
+ with self.stream() as source:
+ shutil.copyfileobj(source, dest)
+
+ def stream(self):
+ """
+ If more than one stream was provided to the constructor, will return a :class:`.MultiStream` wrapping all
+ provided streams in the order they were provided, else the first and only stream is returned directly.
+ """
+ if len(self.streams) > 1:
+ return MultiStream(*self.streams)
+ else:
+ return self.streams[0]
+
+class MultiStream(io.RawIOBase):
+ """
+ A stream implementation which when read reads from multiple streams, one after the other, basically concatenating
+ their contents in the order they are provided to the constructor.
+
+ Arguments:
+ *streams (io.IOBase): One or more streams to concatenate.
+ """
+ def __init__(self, *streams):
+ io.RawIOBase.__init__(self)
+ self.streams = streams
+ self.current_stream = 0
+
+ def read(self, n=-1):
+ if n == 0:
+ return b''
+
+ if len(self.streams) == 0:
+ return b''
+
+ while self.current_stream < len(self.streams):
+ stream = self.streams[self.current_stream]
+
+ result = stream.read(n)
+ if result is None or len(result) != 0:
+ return result
+ else:
+ self.current_stream += 1
+
+ return b''
+
+ def readinto(self, b):
+ n = len(b)
+ read = self.read(n)
+ b[:len(read)] = read
+ return len(read)
+
+ def close(self):
+ for stream in self.streams:
+ try:
+ stream.close()
+ except:
+ pass
+
+ def readable(self, *args, **kwargs):
+ return True
+
+ def seekable(self, *args, **kwargs):
+ return False
+
+ def writable(self, *args, **kwargs):
+ return False
+
+class LineProcessorStream(io.RawIOBase):
+ """
+ While reading from this stream the provided `input_stream` is read line by line, calling the (overridable) method
+ :meth:`.process_line` for each read line.
+
+ Sub classes can thus modify the contents of the `input_stream` in line, while it is being read.
+
+ Arguments:
+ input_stream (io.IOBase): The stream to process on the fly.
+ """
+
+ def __init__(self, input_stream):
+ io.RawIOBase.__init__(self)
+ self.input_stream = io.BufferedReader(input_stream)
+ self.leftover = None
+
+ def read(self, n=-1):
+ if n == 0:
+ return b''
+
+ result = b''
+ while len(result) < n or n == -1:
+ bytes_left = (n - len(result)) if n != -1 else -1
+ if self.leftover is not None:
+ if bytes_left != -1 and bytes_left < len(self.leftover):
+ result += self.leftover[:bytes_left]
+ self.leftover = self.leftover[bytes_left:]
+ break
+ else:
+ result += self.leftover
+ self.leftover = None
+
+ processed_line = None
+ while processed_line is None:
+ line = self.input_stream.readline()
+ if not line:
+ break
+ processed_line = self.process_line(line)
+
+ if processed_line is None:
+ break
+
+ bytes_left = (n - len(result)) if n != -1 else -1
+ if bytes_left != -1 and bytes_left < len(processed_line):
+ result += processed_line[:bytes_left]
+ self.leftover = processed_line[bytes_left:]
+ break
+ else:
+ result += processed_line
+
+ return result
+
+ def readinto(self, b):
+ n = len(b)
+ read = self.read(n)
+ b[:len(read)] = read
+ return len(read)
+
+ def process_line(self, line):
+ """
+ Called from the `read` Method of this stream with each line read from `self.input_stream`.
+
+ By returning ``None`` the line will not be returned from the read stream, effectively being stripped from the
+ wrapper `input_stream`.
+
+ Arguments:
+ line (str): The line as read from `self.input_stream`
+
+ Returns:
+ str or None: The processed version of the line (might also be multiple lines), or None if the line is to be
+ stripped from the processed stream.
+ """
+ return line
+
+ def close(self):
+ self.input_stream.close()
+
+ def readable(self, *args, **kwargs):
+ return True
+
+ def seekable(self, *args, **kwargs):
+ return False
+
+ def writable(self, *args, **kwargs):
+ return False
diff --git a/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/plugin/__init__.py b/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/plugin/__init__.py
new file mode 100644
index 000000000..0cc587150
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/plugin/__init__.py
@@ -0,0 +1,523 @@
+# coding=utf-8
+"""
+This module represents OctoPrint's plugin subsystem. This includes management and helper methods as well as the
+registered plugin types.
+
+.. autofunction:: plugin_manager
+
+.. autofunction:: plugin_settings
+
+.. autofunction:: call_plugin
+
+.. autoclass:: PluginSettings
+ :members:
+"""
+
+from __future__ import absolute_import
+
+__author__ = "Gina Häußge "
+__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
+__copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms of the AGPLv3 License"
+
+import os
+import logging
+
+from octoprint.settings import settings
+from octoprint.plugin.core import (PluginInfo, PluginManager, Plugin)
+from octoprint.plugin.types import *
+
+from octoprint.util import deprecated
+
+# singleton
+_instance = None
+
+def _validate_plugin(phase, plugin_info):
+ if phase == "after_load":
+ if plugin_info.implementation is not None and isinstance(plugin_info.implementation, AppPlugin):
+ # transform app plugin into hook
+ import warnings
+ warnings.warn("{name} uses deprecated plugin mixin AppPlugin, use octoprint.accesscontrol.appkey hook instead".format(name=plugin_info.key), DeprecationWarning)
+
+ hooks = plugin_info.hooks
+ if not "octoprint.accesscontrol.appkey" in hooks:
+ hooks["octoprint.accesscontrol.appkey"] = plugin_info.implementation.get_additional_apps
+ setattr(plugin_info.instance, PluginInfo.attr_hooks, hooks)
+
+def plugin_manager(init=False, plugin_folders=None, plugin_types=None, plugin_entry_points=None, plugin_disabled_list=None,
+ plugin_restart_needing_hooks=None, plugin_obsolete_hooks=None, plugin_validators=None):
+ """
+ Factory method for initially constructing and consecutively retrieving the :class:`~octoprint.plugin.core.PluginManager`
+ singleton.
+
+ Arguments:
+ init (boolean): A flag indicating whether this is the initial call to construct the singleton (True) or not
+ (False, default). If this is set to True and the plugin manager has already been initialized, a :class:`ValueError`
+ will be raised. The same will happen if the plugin manager has not yet been initialized and this is set to
+ False.
+ plugin_folders (list): A list of folders (as strings containing the absolute path to them) in which to look for
+ potential plugin modules. If not provided this defaults to the configured ``plugins`` base folder and
+ ``src/plugins`` within OctoPrint's code base.
+ plugin_types (list): A list of recognized plugin types for which to look for provided implementations. If not
+ provided this defaults to the plugin types found in :mod:`octoprint.plugin.types` without
+ :class:`~octoprint.plugin.OctoPrintPlugin`.
+ plugin_entry_points (list): A list of entry points pointing to modules which to load as plugins. If not provided
+ this defaults to the entry point ``octoprint.plugin``.
+ plugin_disabled_list (list): A list of plugin identifiers that are currently disabled. If not provided this
+ defaults to all plugins for which ``enabled`` is set to ``False`` in the settings.
+ plugin_restart_needing_hooks (list): A list of hook namespaces which cause a plugin to need a restart in order
+ be enabled/disabled. Does not have to contain full hook identifiers, will be matched with startswith similar
+ to logging handlers
+ plugin_obsolete_hooks (list): A list of hooks that have been declared obsolete. Plugins implementing them will
+ not be enabled since they might depend on functionality that is no longer available.
+ plugin_validators (list): A list of additional plugin validators through which to process each plugin.
+
+ Returns:
+ PluginManager: A fully initialized :class:`~octoprint.plugin.core.PluginManager` instance to be used for plugin
+ management tasks.
+
+ Raises:
+ ValueError: ``init`` was True although the plugin manager was already initialized, or it was False although
+ the plugin manager was not yet initialized.
+ """
+
+ global _instance
+ if _instance is not None:
+ if init:
+ raise ValueError("Plugin Manager already initialized")
+
+ else:
+ if init:
+ if plugin_folders is None:
+ plugin_folders = (
+ settings().getBaseFolder("plugins"),
+ (os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(__file__)), "..", "plugins")), True)
+ )
+ if plugin_types is None:
+ plugin_types = [StartupPlugin,
+ ShutdownPlugin,
+ TemplatePlugin,
+ SettingsPlugin,
+ SimpleApiPlugin,
+ AssetPlugin,
+ BlueprintPlugin,
+ EventHandlerPlugin,
+ SlicerPlugin,
+ AppPlugin,
+ ProgressPlugin]
+ if plugin_entry_points is None:
+ plugin_entry_points = "octoprint.plugin"
+ if plugin_disabled_list is None:
+ plugin_disabled_list = settings().get(["plugins", "_disabled"])
+ if plugin_restart_needing_hooks is None:
+ plugin_restart_needing_hooks = [
+ "octoprint.server.http"
+ ]
+ if plugin_obsolete_hooks is None:
+ plugin_obsolete_hooks = [
+ "octoprint.comm.protocol.gcode"
+ ]
+ if plugin_validators is None:
+ plugin_validators = [
+ _validate_plugin
+ ]
+
+ _instance = PluginManager(plugin_folders,
+ plugin_types,
+ plugin_entry_points,
+ logging_prefix="octoprint.plugins.",
+ plugin_disabled_list=plugin_disabled_list,
+ plugin_restart_needing_hooks=plugin_restart_needing_hooks,
+ plugin_obsolete_hooks=plugin_obsolete_hooks,
+ plugin_validators=plugin_validators)
+ else:
+ raise ValueError("Plugin Manager not initialized yet")
+ return _instance
+
+
+def plugin_settings(plugin_key, defaults=None, get_preprocessors=None, set_preprocessors=None):
+ """
+ Factory method for creating a :class:`PluginSettings` instance.
+
+ Arguments:
+ plugin_key (string): The plugin identifier for which to create the settings instance.
+ defaults (dict): The default settings for the plugin.
+ get_preprocessors (dict): The getter preprocessors for the plugin.
+ set_preprocessors (dict): The setter preprocessors for the plugin.
+
+ Returns:
+ PluginSettings: A fully initialized :class:`PluginSettings` instance to be used to access the plugin's
+ settings
+ """
+ return PluginSettings(settings(), plugin_key, defaults=defaults, get_preprocessors=get_preprocessors, set_preprocessors=set_preprocessors)
+
+
+def call_plugin(types, method, args=None, kwargs=None, callback=None, error_callback=None):
+ """
+ Helper method to invoke the indicated ``method`` on all registered plugin implementations implementing the
+ indicated ``types``. Allows providing method arguments and registering callbacks to call in case of success
+ and/or failure of each call which can be used to return individual results to the calling code.
+
+ Example:
+
+ .. sourcecode:: python
+
+ def my_success_callback(name, plugin, result):
+ print("{name} was called successfully and returned {result!r}".format(**locals()))
+
+ def my_error_callback(name, plugin, exc):
+ print("{name} raised an exception: {exc!s}".format(**locals()))
+
+ octoprint.plugin.call_plugin(
+ [octoprint.plugin.StartupPlugin],
+ "on_startup",
+ args=(my_host, my_port),
+ callback=my_success_callback,
+ error_callback=my_error_callback
+ )
+
+ Arguments:
+ types (list): A list of plugin implementation types to match against.
+ method (string): Name of the method to call on all matching implementations.
+ args (tuple): A tuple containing the arguments to supply to the called ``method``. Optional.
+ kwargs (dict): A dictionary containing the keyword arguments to supply to the called ``method``. Optional.
+ callback (function): A callback to invoke after an implementation has been called successfully. Will be called
+ with the three arguments ``name``, ``plugin`` and ``result``. ``name`` will be the plugin identifier,
+ ``plugin`` the plugin implementation instance itself and ``result`` the result returned from the
+ ``method`` invocation.
+ error_callback (function): A callback to invoke after the call of an implementation resulted in an exception.
+ Will be called with the three arguments ``name``, ``plugin`` and ``exc``. ``name`` will be the plugin
+ identifier, ``plugin`` the plugin implementation instance itself and ``exc`` the caught exception.
+
+ """
+
+ if not isinstance(types, (list, tuple)):
+ types = [types]
+ if args is None:
+ args = []
+ if kwargs is None:
+ kwargs = dict()
+
+ plugins = plugin_manager().get_implementations(*types)
+ for plugin in plugins:
+ if hasattr(plugin, method):
+ try:
+ result = getattr(plugin, method)(*args, **kwargs)
+ if callback:
+ callback(plugin._identifier, plugin, result)
+ except Exception as exc:
+ logging.getLogger(__name__).exception("Error while calling plugin %s" % plugin._identifier)
+ if error_callback:
+ error_callback(plugin._identifier, plugin, exc)
+
+
+class PluginSettings(object):
+ """
+ The :class:`PluginSettings` class is the interface for plugins to their own or globally defined settings.
+
+ It provides a couple of convenience methods for directly accessing plugin settings via the regular
+ :class:`octoprint.settings.Settings` interfaces as well as means to access plugin specific folder locations.
+
+ All getter and setter methods will ensure that plugin settings are stored in their correct location within the
+ settings structure by modifying the supplied paths accordingly.
+
+ Arguments:
+ settings (Settings): The :class:`~octoprint.settings.Settings` instance on which to operate.
+ plugin_key (str): The plugin identifier of the plugin for which to create this instance.
+ defaults (dict): The plugin's defaults settings, will be used to determine valid paths within the plugin's
+ settings structure
+
+ .. method:: get(path, merged=False, asdict=False)
+
+ Retrieves a raw value from the settings for ``path``, optionally merging the raw value with the default settings
+ if ``merged`` is set to True.
+
+ :param path: The path for which to retrieve the value.
+ :type path: list, tuple
+ :param boolean merged: Whether to merge the returned result with the default settings (True) or not (False,
+ default).
+ :returns: The retrieved settings value.
+ :rtype: object
+
+ .. method:: get_int(path)
+
+ Like :func:`get` but tries to convert the retrieved value to ``int``.
+
+ .. method:: get_float(path)
+
+ Like :func:`get` but tries to convert the retrieved value to ``float``.
+
+ .. method:: get_boolean(path)
+
+ Like :func:`get` but tries to convert the retrieved value to ``boolean``.
+
+ .. method:: set(path, value, force=False)
+
+ Sets the raw value on the settings for ``path``.
+
+ :param path: The path for which to retrieve the value.
+ :type path: list, tuple
+ :param object value: The value to set.
+ :param boolean force: If set to True, the modified configuration will even be written back to disk if
+ the value didn't change.
+
+ .. method:: set_int(path, value, force=False)
+
+ Like :func:`set` but ensures the value is an ``int`` through attempted conversion before setting it.
+
+ .. method:: set_float(path, value, force=False)
+
+ Like :func:`set` but ensures the value is an ``float`` through attempted conversion before setting it.
+
+ .. method:: set_boolean(path, value, force=False)
+
+ Like :func:`set` but ensures the value is an ``boolean`` through attempted conversion before setting it.
+ """
+
+ def __init__(self, settings, plugin_key, defaults=None, get_preprocessors=None, set_preprocessors=None):
+ self.settings = settings
+ self.plugin_key = plugin_key
+
+ if defaults is None:
+ defaults = dict()
+ self.defaults = dict(plugins=dict())
+ self.defaults["plugins"][plugin_key] = defaults
+ self.defaults["plugins"][plugin_key]["_config_version"] = None
+
+ if get_preprocessors is None:
+ get_preprocessors = dict()
+ self.get_preprocessors = dict(plugins=dict())
+ self.get_preprocessors["plugins"][plugin_key] = get_preprocessors
+
+ if set_preprocessors is None:
+ set_preprocessors = dict()
+ self.set_preprocessors = dict(plugins=dict())
+ self.set_preprocessors["plugins"][plugin_key] = set_preprocessors
+
+ def prefix_path_in_args(args, index=0):
+ result = []
+ if index == 0:
+ result.append(self._prefix_path(args[0]))
+ result.extend(args[1:])
+ else:
+ args_before = args[:index - 1]
+ args_after = args[index + 1:]
+ result.extend(args_before)
+ result.append(self._prefix_path(args[index]))
+ result.extend(args_after)
+ return result
+
+ def add_getter_kwargs(kwargs):
+ if not "defaults" in kwargs:
+ kwargs.update(defaults=self.defaults)
+ if not "preprocessors" in kwargs:
+ kwargs.update(preprocessors=self.get_preprocessors)
+ return kwargs
+
+ def add_setter_kwargs(kwargs):
+ if not "defaults" in kwargs:
+ kwargs.update(defaults=self.defaults)
+ if not "preprocessors" in kwargs:
+ kwargs.update(preprocessors=self.set_preprocessors)
+ return kwargs
+
+ self.access_methods = dict(
+ has =("has", prefix_path_in_args, add_getter_kwargs),
+ get =("get", prefix_path_in_args, add_getter_kwargs),
+ get_int =("getInt", prefix_path_in_args, add_getter_kwargs),
+ get_float =("getFloat", prefix_path_in_args, add_getter_kwargs),
+ get_boolean=("getBoolean", prefix_path_in_args, add_getter_kwargs),
+ set =("set", prefix_path_in_args, add_setter_kwargs),
+ set_int =("setInt", prefix_path_in_args, add_setter_kwargs),
+ set_float =("setFloat", prefix_path_in_args, add_setter_kwargs),
+ set_boolean=("setBoolean", prefix_path_in_args, add_setter_kwargs),
+ remove =("remove", prefix_path_in_args)
+ )
+ self.deprecated_access_methods = dict(
+ getInt ="get_int",
+ getFloat ="get_float",
+ getBoolean="get_boolean",
+ setInt ="set_int",
+ setFloat ="set_float",
+ setBoolean="set_boolean"
+ )
+
+ def _prefix_path(self, path=None):
+ if path is None:
+ path = list()
+ return ['plugins', self.plugin_key] + path
+
+ def global_has(self, path, **kwargs):
+ return self.settings.has(path, **kwargs)
+
+ def global_remove(self, path, **kwargs):
+ return self.settings.remove(path, **kwargs)
+
+ def global_get(self, path, **kwargs):
+ """
+ Getter for retrieving settings not managed by the plugin itself from the core settings structure. Use this
+ to access global settings outside of your plugin.
+
+ Directly forwards to :func:`octoprint.settings.Settings.get`.
+ """
+ return self.settings.get(path, **kwargs)
+
+ def global_get_int(self, path, **kwargs):
+ """
+ Like :func:`global_get` but directly forwards to :func:`octoprint.settings.Settings.getInt`.
+ """
+ return self.settings.getInt(path, **kwargs)
+
+ def global_get_float(self, path, **kwargs):
+ """
+ Like :func:`global_get` but directly forwards to :func:`octoprint.settings.Settings.getFloat`.
+ """
+ return self.settings.getFloat(path, **kwargs)
+
+ def global_get_boolean(self, path, **kwargs):
+ """
+ Like :func:`global_get` but directly orwards to :func:`octoprint.settings.Settings.getBoolean`.
+ """
+ return self.settings.getBoolean(path, **kwargs)
+
+ def global_set(self, path, value, **kwargs):
+ """
+ Setter for modifying settings not managed by the plugin itself on the core settings structure. Use this
+ to modify global settings outside of your plugin.
+
+ Directly forwards to :func:`octoprint.settings.Settings.set`.
+ """
+ self.settings.set(path, value, **kwargs)
+
+ def global_set_int(self, path, value, **kwargs):
+ """
+ Like :func:`global_set` but directly forwards to :func:`octoprint.settings.Settings.setInt`.
+ """
+ self.settings.setInt(path, value, **kwargs)
+
+ def global_set_float(self, path, value, **kwargs):
+ """
+ Like :func:`global_set` but directly forwards to :func:`octoprint.settings.Settings.setFloat`.
+ """
+ self.settings.setFloat(path, value, **kwargs)
+
+ def global_set_boolean(self, path, value, **kwargs):
+ """
+ Like :func:`global_set` but directly forwards to :func:`octoprint.settings.Settings.setBoolean`.
+ """
+ self.settings.setBoolean(path, value, **kwargs)
+
+ def global_get_basefolder(self, folder_type, **kwargs):
+ """
+ Retrieves a globally defined basefolder of the given ``folder_type``. Directly forwards to
+ :func:`octoprint.settings.Settings.getBaseFolder`.
+ """
+ return self.settings.getBaseFolder(folder_type, **kwargs)
+
+ def get_plugin_logfile_path(self, postfix=None):
+ """
+ Retrieves the path to a logfile specifically for the plugin. If ``postfix`` is not supplied, the logfile
+ will be named ``plugin_.log`` and located within the configured ``logs`` folder. If a
+ postfix is supplied, the name will be ``plugin__.log`` at the same location.
+
+ Plugins may use this for specific logging tasks. For example, a :class:`~octoprint.plugin.SlicingPlugin` might
+ want to create a log file for logging the output of the slicing engine itself if some debug flag is set.
+
+ Arguments:
+ postfix (str): Postfix of the logfile for which to create the path. If set, the file name of the log file
+ will be ``plugin__.log``, if not it will be
+ ``plugin_.log``.
+
+ Returns:
+ str: Absolute path to the log file, directly usable by the plugin.
+ """
+ filename = "plugin_" + self.plugin_key
+ if postfix is not None:
+ filename += "_" + postfix
+ filename += ".log"
+ return os.path.join(self.settings.getBaseFolder("logs"), filename)
+
+ @deprecated("PluginSettings.get_plugin_data_folder has been replaced by OctoPrintPlugin.get_plugin_data_folder",
+ includedoc="Replaced by :func:`~octoprint.plugin.types.OctoPrintPlugin.get_plugin_data_folder`",
+ since="1.2.0")
+ def get_plugin_data_folder(self):
+ path = os.path.join(self.settings.getBaseFolder("data"), self.plugin_key)
+ if not os.path.isdir(path):
+ os.makedirs(path)
+ return path
+
+ def get_all_data(self, **kwargs):
+ merged = kwargs.get("merged", True)
+ asdict = kwargs.get("asdict", True)
+ defaults = kwargs.get("defaults", self.defaults)
+ preprocessors = kwargs.get("preprocessors", self.get_preprocessors)
+
+ kwargs.update(dict(
+ merged=merged,
+ asdict=asdict,
+ defaults=defaults,
+ preprocessors=preprocessors
+ ))
+
+ return self.settings.get(self._prefix_path(), **kwargs)
+
+ def clean_all_data(self):
+ self.settings.remove(self._prefix_path())
+
+ def __getattr__(self, item):
+ all_access_methods = self.access_methods.keys() + self.deprecated_access_methods.keys()
+ if item in all_access_methods:
+ decorator = None
+ if item in self.deprecated_access_methods:
+ new = self.deprecated_access_methods[item]
+ decorator = deprecated("{old} has been renamed to {new}".format(old=item, new=new), stacklevel=2)
+ item = new
+
+ settings_name, args_mapper, kwargs_mapper = self.access_methods[item]
+ if hasattr(self.settings, settings_name) and callable(getattr(self.settings, settings_name)):
+ orig_func = getattr(self.settings, settings_name)
+ if decorator is not None:
+ orig_func = decorator(orig_func)
+
+ def _func(*args, **kwargs):
+ return orig_func(*args_mapper(args), **kwargs_mapper(kwargs))
+ _func.__name__ = item
+ _func.__doc__ = orig_func.__doc__ if "__doc__" in dir(orig_func) else None
+
+ return _func
+
+ return getattr(self.settings, item)
+
+ ##~~ deprecated methods follow
+
+ # TODO: Remove with release of 1.3.0
+
+ globalGet = deprecated("globalGet has been renamed to global_get",
+ includedoc="Replaced by :func:`global_get`",
+ since="1.2.0-dev-546")(global_get)
+ globalGetInt = deprecated("globalGetInt has been renamed to global_get_int",
+ includedoc="Replaced by :func:`global_get_int`",
+ since="1.2.0-dev-546")(global_get_int)
+ globalGetFloat = deprecated("globalGetFloat has been renamed to global_get_float",
+ includedoc="Replaced by :func:`global_get_float`",
+ since="1.2.0-dev-546")(global_get_float)
+ globalGetBoolean = deprecated("globalGetBoolean has been renamed to global_get_boolean",
+ includedoc="Replaced by :func:`global_get_boolean`",
+ since="1.2.0-dev-546")(global_get_boolean)
+ globalSet = deprecated("globalSet has been renamed to global_set",
+ includedoc="Replaced by :func:`global_set`",
+ since="1.2.0-dev-546")(global_set)
+ globalSetInt = deprecated("globalSetInt has been renamed to global_set_int",
+ includedoc="Replaced by :func:`global_set_int`",
+ since="1.2.0-dev-546")(global_set_int)
+ globalSetFloat = deprecated("globalSetFloat has been renamed to global_set_float",
+ includedoc="Replaced by :func:`global_set_float`",
+ since="1.2.0-dev-546")(global_set_float)
+ globalSetBoolean = deprecated("globalSetBoolean has been renamed to global_set_boolean",
+ includedoc="Replaced by :func:`global_set_boolean`",
+ since="1.2.0-dev-546")(global_set_boolean)
+ globalGetBaseFolder = deprecated("globalGetBaseFolder has been renamed to global_get_basefolder",
+ includedoc="Replaced by :func:`global_get_basefolder`",
+ since="1.2.0-dev-546")(global_get_basefolder)
+ getPluginLogfilePath = deprecated("getPluginLogfilePath has been renamed to get_plugin_logfile_path",
+ includedoc="Replaced by :func:`get_plugin_logfile_path`",
+ since="1.2.0-dev-546")(get_plugin_logfile_path)
diff --git a/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/plugin/core.py b/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/plugin/core.py
new file mode 100644
index 000000000..bcb28ce01
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/plugin/core.py
@@ -0,0 +1,1241 @@
+# coding=utf-8
+"""
+In this module resides the core data structures and logic of the plugin system. It is implemented in an OctoPrint-agnostic
+way and could be extracted into a separate Python module in the future.
+
+.. autoclass:: PluginManager
+ :members:
+
+.. autoclass:: PluginInfo
+ :members:
+
+.. autoclass:: Plugin
+ :members:
+
+"""
+
+from __future__ import absolute_import
+
+__author__ = "Gina Häußge "
+__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
+__copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms of the AGPLv3 License"
+
+
+import os
+import imp
+from collections import defaultdict, namedtuple
+import logging
+
+import pkg_resources
+import pkginfo
+
+EntryPointOrigin = namedtuple("EntryPointOrigin", "type, entry_point, module_name, package_name, package_version")
+FolderOrigin = namedtuple("FolderOrigin", "type, folder")
+
+class PluginInfo(object):
+ """
+ The :class:`PluginInfo` class wraps all available information about a registered plugin.
+
+ This includes its meta data (like name, description, version, etc) as well as the actual plugin extensions like
+ implementations, hooks and helpers.
+
+ It works on Python module objects and extracts the relevant data from those via accessing the
+ :ref:`control properties `.
+
+ Arguments:
+ key (str): Identifier of the plugin
+ location (str): Installation folder of the plugin
+ instance (module): Plugin module instance
+ name (str): Human readable name of the plugin
+ version (str): Version of the plugin
+ description (str): Description of the plugin
+ author (str): Author of the plugin
+ url (str): URL of the website of the plugin
+ license (str): License of the plugin
+ """
+
+ attr_name = '__plugin_name__'
+ """ Module attribute from which to retrieve the plugin's human readable name. """
+
+ attr_description = '__plugin_description__'
+ """ Module attribute from which to retrieve the plugin's description. """
+
+ attr_version = '__plugin_version__'
+ """ Module attribute from which to retrieve the plugin's version. """
+
+ attr_author = '__plugin_author__'
+ """ Module attribute from which to retrieve the plugin's author. """
+
+ attr_url = '__plugin_url__'
+ """ Module attribute from which to retrieve the plugin's website URL. """
+
+ attr_license = '__plugin_license__'
+ """ Module attribute from which to retrieve the plugin's license. """
+
+ attr_hooks = '__plugin_hooks__'
+ """ Module attribute from which to retrieve the plugin's provided hooks. """
+
+ attr_implementation = '__plugin_implementation__'
+ """ Module attribute from which to retrieve the plugin's provided mixin implementation. """
+
+ attr_implementations = '__plugin_implementations__'
+ """
+ Module attribute from which to retrieve the plugin's provided implementations.
+
+ This deprecated attribute will only be used if a plugin does not yet offer :attr:`attr_implementation`. Only the
+ first entry will be evaluated.
+
+ .. deprecated:: 1.2.0-dev-694
+
+ Use :attr:`attr_implementation` instead.
+ """
+
+ attr_helpers = '__plugin_helpers__'
+ """ Module attribute from which to retrieve the plugin's provided helpers. """
+
+ attr_check = '__plugin_check__'
+ """ Module attribute which to call to determine if the plugin can be loaded. """
+
+ attr_init = '__plugin_init__'
+ """
+ Module attribute which to call when loading the plugin.
+
+ This deprecated attribute will only be used if a plugin does not yet offer :attr:`attr_load`.
+
+ .. deprecated:: 1.2.0-dev-720
+
+ Use :attr:`attr_load` instead.
+ """
+
+ attr_load = '__plugin_load__'
+ """ Module attribute which to call when loading the plugin. """
+
+ attr_unload = '__plugin_unload__'
+ """ Module attribute which to call when unloading the plugin. """
+
+ attr_enable = '__plugin_enable__'
+ """ Module attribute which to call when enabling the plugin. """
+
+ attr_disable = '__plugin_disable__'
+ """ Module attribute which to call when disabling the plugin. """
+
+ def __init__(self, key, location, instance, name=None, version=None, description=None, author=None, url=None, license=None):
+ self.key = key
+ self.location = location
+ self.instance = instance
+ self.origin = None
+ self.enabled = True
+ self.bundled = False
+ self.loaded = False
+
+ self._name = name
+ self._version = version
+ self._description = description
+ self._author = author
+ self._url = url
+ self._license = license
+
+ def validate(self, phase, additional_validators=None):
+ if phase == "before_load":
+ # if the plugin still uses __plugin_init__, log a deprecation warning and move it to __plugin_load__
+ if hasattr(self.instance, self.__class__.attr_init):
+ if not hasattr(self.instance, self.__class__.attr_load):
+ # deprecation warning
+ import warnings
+ warnings.warn("{name} uses deprecated control property __plugin_init__, use __plugin_load__ instead".format(name=self.key), DeprecationWarning)
+
+ # move it
+ init = getattr(self.instance, self.__class__.attr_init)
+ setattr(self.instance, self.__class__.attr_load, init)
+
+ # delete __plugin_init__
+ delattr(self.instance, self.__class__.attr_init)
+
+ elif phase == "after_load":
+ # if the plugin still uses __plugin_implementations__, log a deprecation warning and put the first
+ # item into __plugin_implementation__
+ if hasattr(self.instance, self.__class__.attr_implementations):
+ if not hasattr(self.instance, self.__class__.attr_implementation):
+ # deprecation warning
+ import warnings
+ warnings.warn("{name} uses deprecated control property __plugin_implementations__, use __plugin_implementation__ instead - only the first implementation of {name} will be recognized".format(name=self.key), DeprecationWarning)
+
+ # put first item into __plugin_implementation__
+ implementations = getattr(self.instance, self.__class__.attr_implementations)
+ if len(implementations) > 0:
+ setattr(self.instance, self.__class__.attr_implementation, implementations[0])
+
+ # delete __plugin_implementations__
+ delattr(self.instance, self.__class__.attr_implementations)
+
+ if additional_validators is not None:
+ for validator in additional_validators:
+ validator(phase, self)
+
+ def __str__(self):
+ if self.version:
+ return "{name} ({version})".format(name=self.name, version=self.version)
+ else:
+ return self.name
+
+ def long_str(self, show_bundled=False, bundled_strs=(" [B]", ""),
+ show_location=False, location_str=" - {location}",
+ show_enabled=False, enabled_strs=("* ", " ")):
+ """
+ Long string representation of the plugin's information. Will return a string of the format ````.
+
+ ``enabled``, ``bundled`` and ``location`` will only be displayed if the corresponding flags are set to ``True``.
+ The will be filled from ``enabled_str``, ``bundled_str`` and ``location_str`` as follows:
+
+ ``enabled_str``
+ a 2-tuple, the first entry being the string to insert when the plugin is enabled, the second
+ entry the string to insert when it is not.
+ ``bundled_str``
+ a 2-tuple, the first entry being the string to insert when the plugin is bundled, the second
+ entry the string to insert when it is not.
+ ``location_str``
+ a format string (to be parsed with ``str.format``), the ``{location}`` placeholder will be
+ replaced with the plugin's installation folder on disk.
+
+ Arguments:
+ show_enabled (boolean): whether to show the ``enabled`` part
+ enabled_strs (tuple): the 2-tuple containing the two possible strings to use for displaying the enabled state
+ show_bundled (boolean): whether to show the ``bundled`` part
+ bundled_strs(tuple): the 2-tuple containing the two possible strings to use for displaying the bundled state
+ show_location (boolean): whether to show the ``location`` part
+ location_str (str): the format string to use for displaying the plugin's installation location
+
+ Returns:
+ str: The long string representation of the plugin as described above
+ """
+ if show_enabled:
+ ret = enabled_strs[0] if self.enabled else enabled_strs[1]
+ else:
+ ret = ""
+
+ ret += str(self)
+
+ if show_bundled:
+ ret += bundled_strs[0] if self.bundled else bundled_strs[1]
+
+ if show_location and self.location:
+ ret += location_str.format(location=self.location)
+
+ return ret
+
+ def get_hook(self, hook):
+ """
+ Arguments:
+ hook (str): Hook to return.
+
+ Returns:
+ callable or None: Handler for the requested ``hook`` or None if no handler is registered.
+ """
+
+ if not hook in self.hooks:
+ return None
+ return self.hooks[hook]
+
+ def get_implementation(self, *types):
+ """
+ Arguments:
+ types (list): List of :class:`Plugin` sub classes all returned implementations need to implement.
+
+ Returns:
+ object: The plugin's implementation if it matches all of the requested ``types``, None otherwise.
+ """
+
+ if not self.implementation:
+ return None
+
+ for t in types:
+ if not isinstance(self.implementation, t):
+ return None
+
+ return self.implementation
+
+ @property
+ def name(self):
+ """
+ Human readable name of the plugin. Will be taken from name attribute of the plugin module if available,
+ otherwise from the ``name`` supplied during construction with a fallback to ``key``.
+
+ Returns:
+ str: Name of the plugin, fallback is the plugin's identifier.
+ """
+ return self._get_instance_attribute(self.__class__.attr_name, defaults=(self._name, self.key))
+
+ @property
+ def description(self):
+ """
+ Description of the plugin. Will be taken from the description attribute of the plugin module as defined in
+ :attr:`attr_description` if available, otherwise from the ``description`` supplied during construction.
+ May be None.
+
+ Returns:
+ str or None: Description of the plugin.
+ """
+ return self._get_instance_attribute(self.__class__.attr_description, default=self._description)
+
+ @property
+ def version(self):
+ """
+ Version of the plugin. Will be taken from the version attribute of the plugin module as defined in
+ :attr:`attr_version` if available, otherwise from the ``version`` supplied during construction. May be None.
+
+ Returns:
+ str or None: Version of the plugin.
+ """
+ return self._version if self._version is not None else self._get_instance_attribute(self.__class__.attr_version, default=self._version)
+
+ @property
+ def author(self):
+ """
+ Author of the plugin. Will be taken from the author attribute of the plugin module as defined in
+ :attr:`attr_author` if available, otherwise from the ``author`` supplied during construction. May be None.
+
+ Returns:
+ str or None: Author of the plugin.
+ """
+ return self._get_instance_attribute(self.__class__.attr_author, default=self._author)
+
+ @property
+ def url(self):
+ """
+ Website URL for the plugin. Will be taken from the url attribute of the plugin module as defined in
+ :attr:`attr_url` if available, otherwise from the ``url`` supplied during construction. May be None.
+
+ Returns:
+ str or None: Website URL for the plugin.
+ """
+ return self._get_instance_attribute(self.__class__.attr_url, default=self._url)
+
+ @property
+ def license(self):
+ """
+ License of the plugin. Will be taken from the license attribute of the plugin module as defined in
+ :attr:`attr_license` if available, otherwise from the ``license`` supplied during construction. May be None.
+
+ Returns:
+ str or None: License of the plugin.
+ """
+ return self._get_instance_attribute(self.__class__.attr_license, default=self._license)
+
+ @property
+ def hooks(self):
+ """
+ Hooks provided by the plugin. Will be taken from the hooks attribute of the plugin module as defiend in
+ :attr:`attr_hooks` if available, otherwise an empty dictionary is returned.
+
+ Returns:
+ dict: Hooks provided by the plugin.
+ """
+ return self._get_instance_attribute(self.__class__.attr_hooks, default={})
+
+ @property
+ def implementation(self):
+ """
+ Implementation provided by the plugin. Will be taken from the implementation attribute of the plugin module
+ as defined in :attr:`attr_implementation` if available, otherwise None is returned.
+
+ Returns:
+ object: Implementation provided by the plugin.
+ """
+ return self._get_instance_attribute(self.__class__.attr_implementation, default=None)
+
+ @property
+ def helpers(self):
+ """
+ Helpers provided by the plugin. Will be taken from the helpers attribute of the plugin module as defined in
+ :attr:`attr_helpers` if available, otherwise an empty list is returned.
+
+ Returns:
+ dict: Helpers provided by the plugin.
+ """
+ return self._get_instance_attribute(self.__class__.attr_helpers, default={})
+
+ @property
+ def check(self):
+ """
+ Method for pre-load check of plugin. Will be taken from the check attribute of the plugin module as defined in
+ :attr:`attr_check` if available, otherwise a lambda always returning True is returned.
+
+ Returns:
+ callable: Check method for the plugin module which should return True if the plugin can be loaded, False
+ otherwise.
+ """
+ return self._get_instance_attribute(self.__class__.attr_check, default=lambda: True)
+
+ @property
+ def load(self):
+ """
+ Method for loading the plugin module. Will be taken from the load attribute of the plugin module as defined
+ in :attr:`attr_load` if available, otherwise a no-operation lambda will be returned.
+
+ Returns:
+ callable: Load method for the plugin module.
+ """
+ return self._get_instance_attribute(self.__class__.attr_load, default=lambda: True)
+
+ @property
+ def unload(self):
+ """
+ Method for unloading the plugin module. Will be taken from the unload attribute of the plugin module as defined
+ in :attr:`attr_unload` if available, otherwise a no-operation lambda will be returned.
+
+ Returns:
+ callable: Unload method for the plugin module.
+ """
+ return self._get_instance_attribute(self.__class__.attr_unload, default=lambda: True)
+
+ @property
+ def enable(self):
+ """
+ Method for enabling the plugin module. Will be taken from the enable attribute of the plugin module as defined
+ in :attr:`attr_enable` if available, otherwise a no-operation lambda will be returned.
+
+ Returns:
+ callable: Enable method for the plugin module.
+ """
+ return self._get_instance_attribute(self.__class__.attr_enable, default=lambda: True)
+
+ @property
+ def disable(self):
+ """
+ Method for disabling the plugin module. Will be taken from the disable attribute of the plugin module as defined
+ in :attr:`attr_disable` if available, otherwise a no-operation lambda will be returned.
+
+ Returns:
+ callable: Disable method for the plugin module.
+ """
+ return self._get_instance_attribute(self.__class__.attr_disable, default=lambda: True)
+
+ def _get_instance_attribute(self, attr, default=None, defaults=None):
+ if not hasattr(self.instance, attr):
+ if defaults is not None:
+ for value in defaults:
+ if value is not None:
+ return value
+ return default
+ return getattr(self.instance, attr)
+
+
+class PluginManager(object):
+ """
+ The :class:`PluginManager` is the central component for finding, loading and accessing plugins provided to the
+ system.
+
+ It is able to discover plugins both through possible file system locations as well as customizable entry points.
+ """
+
+ def __init__(self, plugin_folders, plugin_types, plugin_entry_points, logging_prefix=None,
+ plugin_disabled_list=None, plugin_restart_needing_hooks=None, plugin_obsolete_hooks=None,
+ plugin_validators=None):
+ self.logger = logging.getLogger(__name__)
+
+ if logging_prefix is None:
+ logging_prefix = ""
+ if plugin_disabled_list is None:
+ plugin_disabled_list = []
+
+ self.plugin_folders = plugin_folders
+ self.plugin_types = plugin_types
+ self.plugin_entry_points = plugin_entry_points
+ self.plugin_disabled_list = plugin_disabled_list
+ self.plugin_restart_needing_hooks = plugin_restart_needing_hooks
+ self.plugin_obsolete_hooks = plugin_obsolete_hooks
+ self.plugin_validators = plugin_validators
+ self.logging_prefix = logging_prefix
+
+ self.enabled_plugins = dict()
+ self.disabled_plugins = dict()
+ self.plugin_hooks = defaultdict(list)
+ self.plugin_implementations = dict()
+ self.plugin_implementations_by_type = defaultdict(list)
+
+ self.implementation_injects = dict()
+ self.implementation_inject_factories = []
+ self.implementation_pre_inits = []
+ self.implementation_post_inits = []
+
+ self.on_plugin_loaded = lambda *args, **kwargs: None
+ self.on_plugin_unloaded = lambda *args, **kwargs: None
+ self.on_plugin_enabled = lambda *args, **kwargs: None
+ self.on_plugin_disabled = lambda *args, **kwargs: None
+ self.on_plugin_implementations_initialized = lambda *args, **kwargs: None
+
+ self.registered_clients = []
+
+ self.marked_plugins = defaultdict(list)
+
+ self.reload_plugins(startup=True, initialize_implementations=False)
+
+ @property
+ def plugins(self):
+ plugins = dict(self.enabled_plugins)
+ plugins.update(self.disabled_plugins)
+ return plugins
+
+ def find_plugins(self, existing=None, ignore_uninstalled=True):
+ if existing is None:
+ existing = dict(self.plugins)
+
+ result = dict()
+ if self.plugin_folders:
+ result.update(self._find_plugins_from_folders(self.plugin_folders, existing, ignored_uninstalled=ignore_uninstalled))
+ if self.plugin_entry_points:
+ existing.update(result)
+ result.update(self._find_plugins_from_entry_points(self.plugin_entry_points, existing, ignore_uninstalled=ignore_uninstalled))
+ return result
+
+ def _find_plugins_from_folders(self, folders, existing, ignored_uninstalled=True):
+ result = dict()
+
+ for folder in folders:
+ readonly = False
+ if isinstance(folder, (list, tuple)):
+ if len(folder) == 2:
+ folder, readonly = folder
+ else:
+ continue
+
+ if not os.path.exists(folder):
+ self.logger.warn("Plugin folder {folder} could not be found, skipping it".format(folder=folder))
+ continue
+
+ entries = os.listdir(folder)
+ for entry in entries:
+ path = os.path.join(folder, entry)
+ if os.path.isdir(path) and os.path.isfile(os.path.join(path, "__init__.py")):
+ key = entry
+ elif os.path.isfile(path) and entry.endswith(".py"):
+ key = entry[:-3] # strip off the .py extension
+ else:
+ continue
+
+ if key in existing or key in result or (ignored_uninstalled and key in self.marked_plugins["uninstalled"]):
+ # plugin is already defined, ignore it
+ continue
+
+ plugin = self._import_plugin_from_module(key, folder=folder)
+ if plugin:
+ plugin.origin = FolderOrigin("folder", folder)
+ if readonly:
+ plugin.bundled = True
+
+ plugin.enabled = False
+
+ result[key] = plugin
+
+ return result
+
+ def _find_plugins_from_entry_points(self, groups, existing, ignore_uninstalled=True):
+ result = dict()
+
+ # let's make sure we have a current working set
+ working_set = pkg_resources.WorkingSet()
+
+ if not isinstance(groups, (list, tuple)):
+ groups = [groups]
+
+ for group in groups:
+ for entry_point in working_set.iter_entry_points(group=group, name=None):
+ key = entry_point.name
+ module_name = entry_point.module_name
+ version = entry_point.dist.version
+
+ if key in existing or key in result or (ignore_uninstalled and key in self.marked_plugins["uninstalled"]):
+ # plugin is already defined or marked as uninstalled, ignore it
+ continue
+
+ kwargs = dict(module_name=module_name, version=version)
+ package_name = None
+ try:
+ module_pkginfo = InstalledEntryPoint(entry_point)
+ except:
+ self.logger.exception("Something went wrong while retrieving package info data for module %s" % module_name)
+ else:
+ kwargs.update(dict(
+ name=module_pkginfo.name,
+ summary=module_pkginfo.summary,
+ author=module_pkginfo.author,
+ url=module_pkginfo.home_page,
+ license=module_pkginfo.license
+ ))
+ package_name = module_pkginfo.name
+
+ plugin = self._import_plugin_from_module(key, **kwargs)
+ if plugin:
+ plugin.origin = EntryPointOrigin("entry_point", group, module_name, package_name, version)
+ plugin.enabled = False
+ result[key] = plugin
+
+ return result
+
+ def _import_plugin_from_module(self, key, folder=None, module_name=None, name=None, version=None, summary=None, author=None, url=None, license=None):
+ # TODO error handling
+ try:
+ if folder:
+ module = imp.find_module(key, [folder])
+ elif module_name:
+ module = imp.find_module(module_name)
+ else:
+ return None
+ except:
+ self.logger.warn("Could not locate plugin {key}")
+ return None
+
+ plugin = self._import_plugin(key, *module, name=name, version=version, summary=summary, author=author, url=url, license=license)
+ if plugin is None:
+ return None
+
+ if plugin.check():
+ return plugin
+ else:
+ self.logger.warn("Plugin \"{plugin}\" did not pass check".format(plugin=str(plugin)))
+ return None
+
+
+ def _import_plugin(self, key, f, filename, description, name=None, version=None, summary=None, author=None, url=None, license=None):
+ try:
+ instance = imp.load_module(key, f, filename, description)
+ return PluginInfo(key, filename, instance, name=name, version=version, description=summary, author=author, url=url, license=license)
+ except:
+ self.logger.exception("Error loading plugin {key}".format(key=key))
+ return None
+
+ def _is_plugin_disabled(self, key):
+ return key in self.plugin_disabled_list or key.endswith('disabled')
+
+ def reload_plugins(self, startup=False, initialize_implementations=True, force_reload=None):
+ self.logger.info("Loading plugins from {folders} and installed plugin packages...".format(
+ folders=", ".join(map(lambda x: x[0] if isinstance(x, tuple) else str(x), self.plugin_folders))
+ ))
+
+ if force_reload is None:
+ force_reload = []
+
+ plugins = self.find_plugins(existing=dict((k, v) for k, v in self.plugins.items() if not k in force_reload))
+ self.disabled_plugins.update(plugins)
+
+ for name, plugin in plugins.items():
+ try:
+ self.load_plugin(name, plugin, startup=startup, initialize_implementation=initialize_implementations)
+ if not self._is_plugin_disabled(name):
+ self.enable_plugin(name, plugin=plugin, initialize_implementation=initialize_implementations, startup=startup)
+ except PluginNeedsRestart:
+ pass
+ except PluginLifecycleException as e:
+ self.logger.info(str(e))
+
+ if len(self.enabled_plugins) <= 0:
+ self.logger.info("No plugins found")
+ else:
+ self.logger.info("Found {count} plugin(s) providing {implementations} mixin implementations, {hooks} hook handlers".format(
+ count=len(self.enabled_plugins) + len(self.disabled_plugins),
+ implementations=len(self.plugin_implementations),
+ hooks=sum(map(lambda x: len(x), self.plugin_hooks.values()))
+ ))
+
+ def mark_plugin(self, name, uninstalled=None):
+ if not name in self.plugins:
+ self.logger.warn("Trying to mark an unknown plugin {name}".format(**locals()))
+
+ if uninstalled is not None:
+ if uninstalled and not name in self.marked_plugins["uninstalled"]:
+ self.marked_plugins["uninstalled"].append(name)
+ elif not uninstalled and name in self.marked_plugins["uninstalled"]:
+ self.marked_plugins["uninstalled"].remove(name)
+
+ def load_plugin(self, name, plugin=None, startup=False, initialize_implementation=True):
+ if not name in self.plugins:
+ self.logger.warn("Trying to load an unknown plugin {name}".format(**locals()))
+ return
+
+ if plugin is None:
+ plugin = self.plugins[name]
+
+ try:
+ plugin.validate("before_load", additional_validators=self.plugin_validators)
+ plugin.load()
+ plugin.validate("after_load", additional_validators=self.plugin_validators)
+ self.on_plugin_loaded(name, plugin)
+
+ plugin.loaded = True
+
+ self.logger.debug("Loaded plugin {name}: {plugin}".format(**locals()))
+ except PluginLifecycleException as e:
+ raise e
+ except:
+ self.logger.exception("There was an error loading plugin %s" % name)
+
+ def unload_plugin(self, name):
+ if not name in self.plugins:
+ self.logger.warn("Trying to unload unknown plugin {name}".format(**locals()))
+ return
+
+ plugin = self.plugins[name]
+
+ try:
+ if plugin.enabled:
+ self.disable_plugin(name, plugin=plugin)
+
+ plugin.unload()
+ self.on_plugin_unloaded(name, plugin)
+
+ if name in self.enabled_plugins:
+ del self.enabled_plugins[name]
+
+ if name in self.disabled_plugins:
+ del self.disabled_plugins[name]
+
+ plugin.loaded = False
+
+ self.logger.debug("Unloaded plugin {name}: {plugin}".format(**locals()))
+ except PluginLifecycleException as e:
+ raise e
+ except:
+ self.logger.exception("There was an error unloading plugin {name}".format(**locals()))
+
+ # make sure the plugin is NOT in the list of enabled plugins but in the list of disabled plugins
+ if name in self.enabled_plugins:
+ del self.enabled_plugins[name]
+ if not name in self.disabled_plugins:
+ self.disabled_plugins[name] = plugin
+
+ def enable_plugin(self, name, plugin=None, initialize_implementation=True, startup=False):
+ if not name in self.disabled_plugins:
+ self.logger.warn("Tried to enable plugin {name}, however it is not disabled".format(**locals()))
+ return
+
+ if plugin is None:
+ plugin = self.disabled_plugins[name]
+
+ if not startup and self.is_restart_needing_plugin(plugin):
+ raise PluginNeedsRestart(name)
+
+ if self.has_obsolete_hooks(plugin):
+ raise PluginCantEnable(name, "Dependency on obsolete hooks detected, full functionality cannot be guaranteed")
+
+ try:
+ plugin.enable()
+ self._activate_plugin(name, plugin)
+ except PluginLifecycleException as e:
+ raise e
+ except:
+ self.logger.exception("There was an error while enabling plugin {name}".format(**locals()))
+ return False
+ else:
+ if name in self.disabled_plugins:
+ del self.disabled_plugins[name]
+ self.enabled_plugins[name] = plugin
+ plugin.enabled = True
+
+ if plugin.implementation:
+ if initialize_implementation:
+ if not self.initialize_implementation_of_plugin(name, plugin):
+ return False
+ plugin.implementation.on_plugin_enabled()
+ self.on_plugin_enabled(name, plugin)
+
+ self.logger.debug("Enabled plugin {name}: {plugin}".format(**locals()))
+
+ return True
+
+ def disable_plugin(self, name, plugin=None):
+ if not name in self.enabled_plugins:
+ self.logger.warn("Tried to disable plugin {name}, however it is not enabled".format(**locals()))
+ return
+
+ if plugin is None:
+ plugin = self.enabled_plugins[name]
+
+ if self.is_restart_needing_plugin(plugin):
+ raise PluginNeedsRestart(name)
+
+ try:
+ plugin.disable()
+ self._deactivate_plugin(name, plugin)
+ except PluginLifecycleException as e:
+ raise e
+ except:
+ self.logger.exception("There was an error while disabling plugin {name}".format(**locals()))
+ return False
+ else:
+ if name in self.enabled_plugins:
+ del self.enabled_plugins[name]
+ self.disabled_plugins[name] = plugin
+ plugin.enabled = False
+
+ if plugin.implementation:
+ plugin.implementation.on_plugin_disabled()
+ self.on_plugin_disabled(name, plugin)
+
+ self.logger.debug("Disabled plugin {name}: {plugin}".format(**locals()))
+
+ return True
+
+ def _activate_plugin(self, name, plugin):
+ plugin.hotchangeable = self.is_restart_needing_plugin(plugin)
+
+ # evaluate registered hooks
+ for hook, callback in plugin.hooks.items():
+ self.plugin_hooks[hook].append((name, callback))
+
+ # evaluate registered implementation
+ if plugin.implementation:
+ for plugin_type in self.plugin_types:
+ if isinstance(plugin.implementation, plugin_type):
+ self.plugin_implementations_by_type[plugin_type].append((name, plugin.implementation))
+
+ self.plugin_implementations[name] = plugin.implementation
+
+ def _deactivate_plugin(self, name, plugin):
+ for hook, callback in plugin.hooks.items():
+ try:
+ self.plugin_hooks[hook].remove((name, callback))
+ except ValueError:
+ # that's ok, the plugin was just not registered for the hook
+ pass
+
+ if plugin.implementation is not None:
+ if name in self.plugin_implementations:
+ del self.plugin_implementations[name]
+
+ for plugin_type in self.plugin_types:
+ try:
+ self.plugin_implementations_by_type[plugin_type].remove((name, plugin.implementation))
+ except ValueError:
+ # that's ok, the plugin was just not registered for the type
+ pass
+
+ def is_restart_needing_plugin(self, plugin):
+ return self.has_restart_needing_implementation(plugin) or self.has_restart_needing_hooks(plugin)
+
+ def has_restart_needing_implementation(self, plugin):
+ if not plugin.implementation:
+ return False
+
+ return isinstance(plugin.implementation, RestartNeedingPlugin)
+
+ def has_restart_needing_hooks(self, plugin):
+ if not plugin.hooks:
+ return False
+
+ hooks = plugin.hooks.keys()
+ for hook in hooks:
+ if self.is_restart_needing_hook(hook):
+ return True
+ return False
+
+ def has_obsolete_hooks(self, plugin):
+ if not plugin.hooks:
+ return False
+
+ hooks = plugin.hooks.keys()
+ for hook in hooks:
+ if self.is_obsolete_hook(hook):
+ return True
+ return False
+
+ def is_restart_needing_hook(self, hook):
+ if self.plugin_restart_needing_hooks is None:
+ return False
+
+ for h in self.plugin_restart_needing_hooks:
+ if hook.startswith(h):
+ return True
+
+ return False
+
+ def is_obsolete_hook(self, hook):
+ if self.plugin_obsolete_hooks is None:
+ return False
+ return hook in self.plugin_obsolete_hooks
+
+ def initialize_implementations(self, additional_injects=None, additional_inject_factories=None, additional_pre_inits=None, additional_post_inits=None):
+ for name, plugin in self.enabled_plugins.items():
+ self.initialize_implementation_of_plugin(name, plugin,
+ additional_injects=additional_injects,
+ additional_inject_factories=additional_inject_factories,
+ additional_pre_inits=additional_pre_inits,
+ additional_post_inits=additional_post_inits)
+
+ self.logger.info("Initialized {count} plugin implementation(s)".format(count=len(self.plugin_implementations)))
+
+ def initialize_implementation_of_plugin(self, name, plugin, additional_injects=None, additional_inject_factories=None, additional_pre_inits=None, additional_post_inits=None):
+ if plugin.implementation is None:
+ return
+
+ return self.initialize_implementation(name, plugin, plugin.implementation,
+ additional_injects=additional_injects,
+ additional_inject_factories=additional_inject_factories,
+ additional_pre_inits=additional_pre_inits,
+ additional_post_inits=additional_post_inits)
+
+ def initialize_implementation(self, name, plugin, implementation, additional_injects=None, additional_inject_factories=None, additional_pre_inits=None, additional_post_inits=None):
+ if additional_injects is None:
+ additional_injects = dict()
+ if additional_inject_factories is None:
+ additional_inject_factories = []
+ if additional_pre_inits is None:
+ additional_pre_inits = []
+ if additional_post_inits is None:
+ additional_post_inits = []
+
+ injects = self.implementation_injects
+ injects.update(additional_injects)
+
+ inject_factories = self.implementation_inject_factories
+ inject_factories += additional_inject_factories
+
+ pre_inits = self.implementation_pre_inits
+ pre_inits += additional_pre_inits
+
+ post_inits = self.implementation_post_inits
+ post_inits += additional_post_inits
+
+ try:
+ kwargs = dict(injects)
+
+ kwargs.update(dict(
+ identifier=name,
+ plugin_name=plugin.name,
+ plugin_version=plugin.version,
+ basefolder=os.path.realpath(plugin.location),
+ logger=logging.getLogger(self.logging_prefix + name),
+ ))
+
+ # inject the additional_injects
+ for arg, value in kwargs.items():
+ setattr(implementation, "_" + arg, value)
+
+ # inject any injects produced in the additional_inject_factories
+ for factory in inject_factories:
+ try:
+ return_value = factory(name, implementation)
+ except:
+ self.logger.exception("Exception while executing injection factory %r" % factory)
+ else:
+ if return_value is not None:
+ if isinstance(return_value, dict):
+ for arg, value in return_value.items():
+ setattr(implementation, "_" + arg, value)
+
+ # execute any additional pre init methods
+ for pre_init in pre_inits:
+ pre_init(name, implementation)
+
+ implementation.initialize()
+
+ # execute any additional post init methods
+ for post_init in post_inits:
+ post_init(name, implementation)
+
+ except Exception as e:
+ self._deactivate_plugin(name, plugin)
+ plugin.enabled = False
+
+ if isinstance(e, PluginLifecycleException):
+ raise e
+ else:
+ self.logger.exception("Exception while initializing plugin {name}, disabling it".format(**locals()))
+ return False
+ else:
+ self.on_plugin_implementations_initialized(name, plugin)
+
+ self.logger.debug("Initialized plugin mixin implementation for plugin {name}".format(**locals()))
+ return True
+
+
+ def log_all_plugins(self, show_bundled=True, bundled_str=(" (bundled)", ""), show_location=True, location_str=" = {location}", show_enabled=True, enabled_str=(" ", "!")):
+ all_plugins = self.enabled_plugins.values() + self.disabled_plugins.values()
+
+ if len(all_plugins) <= 0:
+ self.logger.info("No plugins available")
+ else:
+ self.logger.info("{count} plugin(s) registered with the system:\n{plugins}".format(count=len(all_plugins), plugins="\n".join(
+ map(lambda x: "| " + x.long_str(show_bundled=show_bundled,
+ bundled_strs=bundled_str,
+ show_location=show_location,
+ location_str=location_str,
+ show_enabled=show_enabled,
+ enabled_strs=enabled_str),
+ sorted(self.plugins.values(), key=lambda x: str(x).lower()))
+ )))
+
+ def get_plugin(self, identifier, require_enabled=True):
+ """
+ Retrieves the module of the plugin identified by ``identifier``. If the plugin is not registered or disabled and
+ ``required_enabled`` is True (the default) None will be returned.
+
+ Arguments:
+ identifier (str): The identifier of the plugin to retrieve.
+ require_enabled (boolean): Whether to only return the plugin if is enabled (True, default) or also if it's
+ disabled.
+
+ Returns:
+ module: The requested plugin module or None
+ """
+
+ plugin_info = self.get_plugin_info(identifier, require_enabled=require_enabled)
+ if plugin_info is not None:
+ return plugin_info.instance
+ return None
+
+ def get_plugin_info(self, identifier, require_enabled=True):
+ """
+ Retrieves the :class:`PluginInfo` instance identified by ``identifier``. If the plugin is not registered or
+ disabled and ``required_enabled`` is True (the default) None will be returned.
+
+ Arguments:
+ identifier (str): The identifier of the plugin to retrieve.
+ require_enabled (boolean): Whether to only return the plugin if is enabled (True, default) or also if it's
+ disabled.
+
+ Returns:
+ ~.PluginInfo: The requested :class:`PluginInfo` or None
+ """
+
+ if identifier in self.enabled_plugins:
+ return self.enabled_plugins[identifier]
+ elif not require_enabled and identifier in self.disabled_plugins:
+ return self.disabled_plugins[identifier]
+
+ return None
+
+ def get_hooks(self, hook):
+ """
+ Retrieves all registered handlers for the specified hook.
+
+ Arguments:
+ hook (str): The hook for which to retrieve the handlers.
+
+ Returns:
+ dict: A dict containing all registered handlers mapped by their plugin's identifier.
+ """
+
+ if not hook in self.plugin_hooks:
+ return dict()
+ return {hook[0]: hook[1] for hook in self.plugin_hooks[hook]}
+
+ def get_implementations(self, *types):
+ """
+ Get all mixin implementations that implement *all* of the provided ``types``.
+
+ Arguments:
+ types (one or more type): The types a mixin implementation needs to implement in order to be returned.
+
+ Returns:
+ list: A list of all found implementations
+ """
+
+ result = None
+
+ for t in types:
+ implementations = self.plugin_implementations_by_type[t]
+ if result is None:
+ result = set(implementations)
+ else:
+ result = result.intersection(implementations)
+
+ if result is None:
+ return dict()
+ return [impl[1] for impl in result]
+
+ def get_filtered_implementations(self, f, *types):
+ """
+ Get all mixin implementation that implementat *all* of the provided ``types`` and match the provided filter `f`.
+
+ Arguments:
+ f (callable): A filter function returning True for implementations to return and False for those to exclude.
+ types (one or more type): The types a mixin implementation needs to implement in order to be returned.
+
+ Returns:
+ list: A list of all found and matching implementations.
+ """
+
+ assert callable(f)
+ implementations = self.get_implementations(*types)
+ return filter(f, implementations)
+
+ def get_helpers(self, name, *helpers):
+ """
+ Retrieves the named ``helpers`` for the plugin with identifier ``name``.
+
+ If the plugin is not available, returns None. Otherwise returns a :class:`dict` with the requested plugin
+ helper names mapped to the method - if a helper could not be resolved, it will be missing from the dict.
+
+ Arguments:
+ name (str): Identifier of the plugin for which to look up the ``helpers``.
+ helpers (one or more str): Identifiers of the helpers of plugin ``name`` to return.
+
+ Returns:
+ dict: A dictionary of all resolved helpers, mapped by their identifiers, or None if the plugin was not
+ registered with the system.
+ """
+
+ if not name in self.enabled_plugins:
+ return None
+ plugin = self.enabled_plugins[name]
+
+ all_helpers = plugin.helpers
+ if len(helpers):
+ return dict((k, v) for (k, v) in all_helpers.items() if k in helpers)
+ else:
+ return all_helpers
+
+ def register_message_receiver(self, client):
+ """
+ Registers a ``client`` for receiving plugin messages. The ``client`` needs to be a callable accepting two
+ input arguments, ``plugin`` (the sending plugin's identifier) and ``data`` (the message itself).
+ """
+
+ if client is None:
+ return
+ self.registered_clients.append(client)
+
+ def unregister_message_receiver(self, client):
+ """
+ Unregisters a ``client`` for receiving plugin messages.
+ """
+
+ self.registered_clients.remove(client)
+
+ def send_plugin_message(self, plugin, data):
+ """
+ Sends ``data`` in the name of ``plugin`` to all currently registered message receivers by invoking them
+ with the two arguments.
+
+ Arguments:
+ plugin (str): The sending plugin's identifier.
+ data (object): The message.
+ """
+
+ for client in self.registered_clients:
+ try: client(plugin, data)
+ except: self.logger.exception("Exception while sending plugin data to client")
+
+
+class InstalledEntryPoint(pkginfo.Installed):
+
+ def __init__(self, entry_point, metadata_version=None):
+ self.entry_point = entry_point
+ package = entry_point.module_name
+ pkginfo.Installed.__init__(self, package, metadata_version=metadata_version)
+
+ def read(self):
+ import sys
+ import glob
+ import warnings
+
+ opj = os.path.join
+ if self.package is not None:
+ package = self.package.__package__
+ if package is None:
+ package = self.package.__name__
+
+ project = pkg_resources.to_filename(pkg_resources.safe_name(self.entry_point.dist.project_name))
+
+ package_pattern = '%s*.egg-info' % package
+ project_pattern = '%s*.egg-info' % project
+
+ file = getattr(self.package, '__file__', None)
+ if file is not None:
+ candidates = []
+
+ def _add_candidate(where):
+ candidates.extend(glob.glob(where))
+
+ for entry in sys.path:
+ if file.startswith(entry):
+ _add_candidate(opj(entry, 'EGG-INFO')) # egg?
+ for pattern in (package_pattern, project_pattern): # dist-installed?
+ _add_candidate(opj(entry, pattern))
+
+ dir, name = os.path.split(self.package.__file__)
+ for pattern in (package_pattern, project_pattern):
+ _add_candidate(opj(dir, pattern))
+ _add_candidate(opj(dir, '..', pattern))
+
+ for candidate in candidates:
+ if os.path.isdir(candidate):
+ path = opj(candidate, 'PKG-INFO')
+ else:
+ path = candidate
+ if os.path.exists(path):
+ with open(path) as f:
+ return f.read()
+ warnings.warn('No PKG-INFO found for package: %s' % self.package_name)
+
+
+class Plugin(object):
+ """
+ The parent class of all plugin implementations.
+
+ .. attribute:: _identifier
+
+ The identifier of the plugin. Injected by the plugin core system upon initialization of the implementation.
+
+ .. attribute:: _plugin_name
+
+ The name of the plugin. Injected by the plugin core system upon initialization of the implementation.
+
+ .. attribute:: _plugin_version
+
+ The version of the plugin. Injected by the plugin core system upon initialization of the implementation.
+
+ .. attribute:: _basefolder
+
+ The base folder of the plugin. Injected by the plugin core system upon initialization of the implementation.
+
+ .. attribute:: _logger
+
+ The logger instance to use, with the logging name set to the :attr:`PluginManager.logging_prefix` of the
+ :class:`PluginManager` concatenated with :attr:`_identifier`. Injected by the plugin core system upon
+ initialization of the implementation.
+ """
+
+ def initialize(self):
+ """
+ Called by the plugin core after performing all injections. Override this to initialize your implementation.
+ """
+ pass
+
+ def on_plugin_enabled(self):
+ pass
+
+ def on_plugin_disabled(self):
+ pass
+
+class RestartNeedingPlugin(Plugin):
+ pass
+
+class PluginNeedsRestart(Exception):
+ def __init__(self, name):
+ Exception.__init__(self)
+ self.name = name
+ self.message = "Plugin {name} cannot be enabled or disabled after system startup".format(**locals())
+
+class PluginLifecycleException(Exception):
+ def __init__(self, name, reason, message):
+ Exception.__init__(self)
+ self.name = name
+ self.reason = reason
+
+ self.message = message.format(**locals())
+
+ def __str__(self):
+ return self.message
+
+class PluginCantInitialize(PluginLifecycleException):
+ def __init__(self, name, reason):
+ PluginLifecycleException.__init__(self, name, reason, "Plugin {name} cannot be initialized: {reason}")
+
+class PluginCantEnable(PluginLifecycleException):
+ def __init__(self, name, reason):
+ PluginLifecycleException.__init__(self, name, reason, "Plugin {name} cannot be enabled: {reason}")
+
+class PluginCantDisable(PluginLifecycleException):
+ def __init__(self, name, reason):
+ PluginLifecycleException.__init__(self, name, reason, "Plugin {name} cannot be disabled: {reason}")
diff --git a/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/plugin/types.py b/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/plugin/types.py
new file mode 100644
index 000000000..d1987ea6e
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/plugin/types.py
@@ -0,0 +1,1230 @@
+# coding=utf-8
+"""
+This module bundles all of OctoPrint's supported plugin implementation types as well as their common parent
+class, :class:`OctoPrintPlugin`.
+
+Please note that the plugin implementation types are documented in the section
+:ref:`Available plugin mixins `.
+
+.. autoclass:: OctoPrintPlugin
+ :show-inheritance:
+
+"""
+
+from __future__ import absolute_import
+
+__author__ = "Gina Häußge "
+__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
+__copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms of the AGPLv3 License"
+
+
+from .core import (Plugin, RestartNeedingPlugin)
+
+
+class OctoPrintPlugin(Plugin):
+ """
+ The parent class of all OctoPrint plugin mixins.
+
+ .. attribute:: _plugin_manager
+
+ The :class:`~octoprint.plugin.core.PluginManager` instance. Injected by the plugin core system upon
+ initialization of the implementation.
+
+ .. attribute:: _printer_profile_manager
+
+ The :class:`~octoprint.printer.profile.PrinterProfileManager` instance. Injected by the plugin core system upon
+ initialization of the implementation.
+
+ .. attribute:: _event_bus
+
+ The :class:`~octoprint.events.EventManager` instance. Injected by the plugin core system upon initialization of
+ the implementation.
+
+ .. attribute:: _analysis_queue
+
+ The :class:`~octoprint.filemanager.analysis.AnalysisQueue` instance. Injected by the plugin core system upon
+ initialization of the implementation.
+
+ .. attribute:: _slicing_manager
+
+ The :class:`~octoprint.slicing.SlicingManager` instance. Injected by the plugin core system upon initialization
+ of the implementation.
+
+ .. attribute:: _file_manager
+
+ The :class:`~octoprint.filemanager.FileManager` instance. Injected by the plugin core system upon initialization
+ of the implementation.
+
+ .. attribute:: _printer
+
+ The :class:`~octoprint.printer.PrinterInterface` instance. Injected by the plugin core system upon initialization
+ of the implementation.
+
+ .. attribute:: _app_session_manager
+
+ The :class:`~octoprint.users.SessionManager` instance. Injected by the plugin core system upon initialization of
+ the implementation.
+
+ .. attribute:: _plugin_lifecycle_manager
+
+ The :class:`~octoprint.server.LifecycleManager` instance. Injected by the plugin core system upon initialization
+ of the implementation.
+
+ .. attribute:: _data_folder
+
+ Path to the data folder for the plugin to use for any data it might have to persist. Should always be accessed
+ through :meth:`get_plugin_data_folder` since that function will also ensure that the data folder actually exists
+ and if not creating it before returning it. Injected by the plugin core system upon initialization of the
+ implementation.
+
+ .. automethod:: get_plugin_data_folder
+ """
+
+ def get_plugin_data_folder(self):
+ """
+ Retrieves the path to a data folder specifically for the plugin, ensuring it exists and if not creating it
+ before returning it.
+
+ Plugins may use this folder for storing additional data they need for their operation.
+ """
+ if self._data_folder is None:
+ raise RuntimeError("self._plugin_data_folder is None, has the plugin been initialized yet?")
+
+ import os
+ if not os.path.isdir(self._data_folder):
+ os.makedirs(self._data_folder)
+ return self._data_folder
+
+
+class ReloadNeedingPlugin(Plugin):
+ pass
+
+class StartupPlugin(OctoPrintPlugin):
+ """
+ The ``StartupPlugin`` allows hooking into the startup of OctoPrint. It can be used to start up additional services
+ on or just after the startup of the server.
+ """
+
+ def on_startup(self, host, port):
+ """
+ Called just before the server is actually launched. Plugins get supplied with the ``host`` and ``port`` the server
+ will listen on. Note that the ``host`` may be ``0.0.0.0`` if it will listen on all interfaces, so you can't just
+ blindly use this for constructing publicly reachable URLs. Also note that when this method is called, the server
+ is not actually up yet and none of your plugin's APIs or blueprints will be reachable yet. If you need to be
+ externally reachable, use :func:`on_after_startup` instead or additionally.
+
+ :param string host: the host the server will listen on, may be ``0.0.0.0``
+ :param int port: the port the server will listen on
+ """
+
+ pass
+
+ def on_after_startup(self):
+ """
+ Called just after launch of the server, so when the listen loop is actually running already.
+ """
+
+ pass
+
+
+class ShutdownPlugin(OctoPrintPlugin):
+ """
+ The ``ShutdownPlugin`` allows hooking into the shutdown of OctoPrint. It's usually used in conjunction with the
+ :class:`StartupPlugin` mixin, to cleanly shut down additional services again that where started by the :class:`StartupPlugin`
+ part of the plugin.
+ """
+
+ def on_shutdown(self):
+ """
+ Called upon the imminent shutdown of OctoPrint.
+ """
+ pass
+
+
+class AssetPlugin(OctoPrintPlugin, RestartNeedingPlugin):
+ """
+ The ``AssetPlugin`` mixin allows plugins to define additional static assets such as Javascript or CSS files to
+ be automatically embedded into the pages delivered by the server to be used within the client sided part of
+ the plugin.
+
+ A typical usage of the ``AssetPlugin`` functionality is to embed a custom view model to be used by templates injected
+ through a :class:`TemplatePlugin`.
+ """
+
+ def get_asset_folder(self):
+ """
+ Defines the folder where the plugin stores its static assets as defined in :func:`get_assets`. Override this if
+ your plugin stores its assets at some other place than the ``static`` sub folder in the plugin base directory.
+
+ :return string: the absolute path to the folder where the plugin stores its static assets
+ """
+ import os
+ return os.path.join(self._basefolder, "static")
+
+ def get_assets(self):
+ """
+ Defines the static assets the plugin offers. The following asset types are recognized and automatically
+ imported at the appropriate places to be available:
+
+ js
+ Javascript files, such as additional view models
+ css
+ CSS files with additional styles, will be embedded into delivered pages when not running in LESS mode.
+ less
+ LESS files with additional styles, will be embedded into delivered pages when running in LESS mode.
+
+ The expected format to be returned is a dictionary mapping one or more of these keys to a list of files of that
+ type, the files being represented as relative paths from the asset folder as defined via :func:`get_asset_folder`.
+ Example:
+
+ .. code-block:: python
+
+ def get_assets(self):
+ return dict(
+ js=['js/my_file.js', 'js/my_other_file.js'],
+ css=['css/my_styles.css'],
+ less=['less/my_styles.less']
+ )
+
+ The assets will be made available by OctoPrint under the URL ``/plugin//static/``, with
+ ``plugin identifier`` being the plugin's identifier and ``path`` being the path as defined in the asset dictionary.
+
+ Assets of the types ``js``, ``css`` and ``less`` will be automatically bundled by OctoPrint using
+ `Flask-Assets `_.
+
+ :return dict: a dictionary describing the static assets to publish for the plugin
+ """
+ return dict()
+
+
+class TemplatePlugin(OctoPrintPlugin, ReloadNeedingPlugin):
+ """
+ Using the ``TemplatePlugin`` mixin plugins may inject their own components into the OctoPrint web interface.
+
+ Currently OctoPrint supports the following types of injections out of the box:
+
+ Navbar
+ The right part of the navigation bar located at the top of the UI can be enriched with additional links. Note that
+ with the current implementation, plugins will always be located *to the left* of the existing links.
+
+ The included template must be called ``_navbar.jinja2`` (e.g. ``myplugin_navbar.jinja2``) unless
+ overridden by the configuration supplied through :func:`get_template_configs`.
+
+ The template will be already wrapped into the necessary structure, plugins just need to supply the pure content. The
+ wrapper structure will have all additional classes and styles applied as specified via the configuration supplied
+ through :func:`get_template_configs`.
+
+ Sidebar
+ The left side bar containing Connection, State and Files sections can be enriched with additional sections. Note
+ that with the current implementations, plugins will always be located *beneath* the existing sections.
+
+ The included template must be called ``_sidebar.jinja2`` (e.g. ``myplugin_sidebar.jinja2``) unless
+ overridden by the configuration supplied through :func:`get_template_configs`.
+
+ The template will be already wrapped into the necessary structure, plugins just need to supply the pure content. The
+ wrapper divs for both the whole box as well as the content pane will have all additional classes and styles applied
+ as specified via the configuration supplied through :func:`get_template_configs`.
+
+ Tabs
+ The available tabs of the main part of the interface may be extended with additional tabs originating from within
+ plugins. Note that with the current implementation, plugins will always be located *to the right* of the existing
+ tabs.
+
+ The included template must be called ``_tab.jinja2`` (e.g. ``myplugin_tab.jinja2``) unless
+ overridden by the configuration supplied through :func:`get_template_configs`.
+
+ The template will be already wrapped into the necessary structure, plugins just need to supply the pure content. The
+ wrapper div and the link in the navigation will have the additional classes and styles applied as specified via the
+ configuration supplied through :func:`get_template_configs`.
+
+ Settings
+ Plugins may inject a dialog into the existing settings view. Note that with the current implementations, plugins
+ will always be listed beneath the "Plugins" header in the settings link list, ordered alphabetically after
+ their displayed name.
+
+ The included template must be called ``_settings.jinja2`` (e.g. ``myplugin_settings.jinja2``) unless
+ overridden by the configuration supplied through :func:`get_template_configs`.
+
+ The template will be already wrapped into the necessary structure, plugins just need to supply the pure content. The
+ wrapper div and the link in the navigation will have the additional classes and styles applied as defined via the
+ supplied configuration supplied through :func:`get_template_configs`.
+
+ Generic
+ Plugins may also inject arbitrary templates into the page of the web interface itself, e.g. in order to
+ add overlays or dialogs to be called from within the plugin's javascript code.
+
+ .. figure:: ../images/template-plugin-types-main.png
+ :align: center
+ :alt: Template injection types in the main part of the interface
+
+ Template injection types in the main part of the interface
+
+ .. figure:: ../images/template-plugin-types-settings.png
+ :align: center
+ :alt: Template injection types in the settings
+
+ Template injection types in the settings
+
+ You can find an example for a simple plugin which injects navbar, tab and settings content into the interface in
+ the "helloworld" plugin in OctoPrint's :ref:`Plugin Tutorial `.
+
+ Plugins may replace existing components, see the ``replaces`` keyword in the template configurations returned by
+ :meth:`.get_template_configs` below. Note that if a plugin replaces a core component, it is the plugin's
+ responsibility to ensure that all core functionality is still maintained.
+
+ Plugins can also add additional template types by implementing the :ref:`octoprint.ui.web.templatetypes ` hook.
+ """
+
+ def get_template_configs(self):
+ """
+ Allows configuration of injected navbar, sidebar, tab and settings templates (and also additional templates of
+ types specified by plugins through the :ref:`octoprint.ui.web.templatetypes ` hook).
+ Should be a list containing one configuration object per template to inject. Each configuration object is
+ represented by a dictionary which may contain the following keys:
+
+ .. list-table::
+ :widths: 5 95
+
+ * - type
+ - The template type the configuration is targeting. Possible values here are ``navbar``, ``sidebar``,
+ ``tab``, ``settings`` and ``generic``. Mandatory.
+ * - name
+ - The name of the component, if not set the name of the plugin will be used. The name will be visible at
+ a location depending on the ``type``:
+
+ * ``navbar``: unused
+ * ``sidebar``: sidebar heading
+ * ``tab``: tab heading
+ * ``settings``: settings link
+ * ``generic``: unused
+
+ * - template
+ - Name of the template to inject, default value depends on the ``type``:
+
+ * ``navbar``: ``_navbar.jinja2``
+ * ``sidebar``: ``_sidebar.jinja2``
+ * ``tab``: ``_tab.jinja2``
+ * ``settings``: ``_settings.jinja2``
+ * ``generic``: ``.jinja2``
+
+ * - suffix
+ - Suffix to attach to the component identifier and the div identifier of the injected template. Will be
+ ``_`` if not provided and not the first template of the type, with ``index`` counting from 1 and
+ increasing for each template of the same type.
+
+ Example: If your plugin with identifier ``myplugin`` defines two tab components like this:
+
+ .. code-block:: python
+
+ return [
+ dict(type="tab", template="myplugin_first_tab.jinja2"),
+ dict(type="tab", template="myplugin_second_tab.jinja2")
+ ]
+
+ then the first tab will have the component identifier ``plugin_myplugin`` and the second one will have
+ the component identifier ``plugin_myplugin_2`` (the generated divs will be ``tab_plugin_myplugin`` and
+ ``tab_plugin_myplugin_2`` accordingly). Notice that the first tab is *not* called ``plugin_myplugin_1`` --
+ as stated above while the ``index`` used as default suffix starts counting at 1, it will not be applied
+ for the first component of a given type.
+
+ If on the other hand your plugin's definition looks like this:
+
+ .. code-block:: python
+
+ return [
+ dict(type="tab", template="myplugin_first_tab_jinja2", suffix="_1st"),
+ dict(type="tab", template="myplugin_second_tab_jinja2", suffix="_2nd")
+ ]
+
+ then the generated component identifier will be ``plugin_myplugin_1st`` and ``plugin_myplugin_2nd``
+ (and the divs will be ``tab_plugin_myplugin_1st`` and ``tab_plugin_myplugin_2nd``).
+
+ * - div
+ - Id for the div containing the component. If not provided, defaults to ``_plugin_`` plus
+ the ``suffix`` if provided or required.
+ * - replaces
+ - Id of the component this one replaces, might be either one of the core components or a component
+ provided by another plugin. A list of the core component identifiers can be found
+ :ref:`in the configuration documentation `. The identifiers of
+ other plugin components always follow the format described above.
+ * - custom_bindings
+ - A boolean value indicating whether the default view model should be bound to the component (``false``)
+ or if a custom binding will be used by the plugin (``true``, default).
+ * - data_bind
+ - Additional knockout data bindings to apply to the component, can be used to add further behaviour to
+ the container based on internal state if necessary.
+ * - classes
+ - Additional classes to apply to the component, as a list of individual classes
+ (e.g. ``classes=["myclass", "myotherclass"]``) which will be joined into the correct format by the template engine.
+ * - styles
+ - Additional CSS styles to apply to the component, as a list of individual declarations
+ (e.g. ``styles=["color: red", "display: block"]``) which will be joined into the correct format by the template
+ engine.
+
+ Further keys to be included in the dictionary depend on the type:
+
+ ``sidebar`` type
+
+ .. list-table::
+ :widths: 5 95
+
+ * - icon
+ - Icon to use for the sidebar header, should be the name of a Font Awesome icon without the leading ``icon-`` part.
+ * - template_header
+ - Additional template to include in the head section of the sidebar item. For an example of this, see the additional
+ options included in the "Files" section.
+ * - classes_wrapper
+ - Like ``classes`` but only applied to the whole wrapper around the sidebar box.
+ * - classes_content
+ - Like ``classes`` but only applied to the content pane itself.
+ * - styles_wrapper
+ - Like ``styles`` but only applied to the whole wrapper around the sidebar box.
+ * - styles_content
+ - Like ``styles`` but only applied to the content pane itself
+
+ ``tab`` type and ``settings`` type
+
+ .. list-table::
+ :widths: 5 95
+
+ * - classes_link
+ - Like ``classes`` but only applied to the link in the navigation.
+ * - classes_content
+ - Like ``classes`` but only applied to the content pane itself.
+ * - styles_link
+ - Like ``styles`` but only applied to the link in the navigation.
+ * - styles_content
+ - Like ``styles`` but only applied to the content pane itself.
+
+ .. note::
+
+ As already outlined above, each template type has a default template name (i.e. the default navbar template
+ of a plugin is called ``_navbar.jinja2``), which may be overridden using the template configuration.
+ If a plugin needs to include more than one template of a given type, it needs to provide an entry for each of
+ those, since the implicit default template will only be included automatically if no other templates of that
+ type are defined.
+
+ Example: If you have a plugin that injects two tab components, one defined in the template file
+ ``myplugin_tab.jinja2`` (the default template) and one in the template ``myplugin_othertab.jinja2``, you
+ might be tempted to just return the following configuration since one your templates is named by the default
+ template name:
+
+ .. code-block:: python
+
+ return [
+ dict(type="tab", template="myplugin_othertab.jinja2")
+ ]
+
+ This will only include the tab defined in ``myplugin_othertab.jinja2`` though, ``myplugin_tab.jinja2`` will
+ not be included automatically since the presence of a defintion for the ``tab`` type overrides the automatic
+ injection of the default template. You'll have to include it explicitely:
+
+ .. code-block:: python
+
+ return [
+ dict(type="tab", template="myplugin_tab.jinja2"),
+ dict(type="tab", template="myplugin_othertab.jinja2")
+ ]
+
+ :return list: a list containing the configuration options for the plugin's injected templates
+ """
+ return []
+
+ def get_template_vars(self):
+ """
+ Defines additional template variables to include into the template renderer. Variable names will be prefixed
+ with ``plugin__``.
+
+ :return dict: a dictionary containing any additional template variables to include in the renderer
+ """
+ return dict()
+
+ def get_template_folder(self):
+ """
+ Defines the folder where the plugin stores its templates. Override this if your plugin stores its templates at
+ some other place than the ``templates`` sub folder in the plugin base directory.
+
+ :return string: the absolute path to the folder where the plugin stores its jinja2 templates
+ """
+ import os
+ return os.path.join(self._basefolder, "templates")
+
+
+class SimpleApiPlugin(OctoPrintPlugin):
+ """
+ Utilizing the ``SimpleApiPlugin`` mixin plugins may implement a simple API based around one GET resource and one
+ resource accepting JSON commands POSTed to it. This is the easy alternative for plugin's which don't need the
+ full power of a `Flask Blueprint `_ that the :class:`BlueprintPlugin`
+ mixin offers.
+
+ Use this mixin if all you need to do is return some kind of dynamic data to your plugin from the backend
+ and/or want to react to simple commands which boil down to a type of command and a couple of flat parameters
+ supplied with it.
+
+ The simple API constructed by OctoPrint for you will be made available under ``/api/plugin//``.
+ OctoPrint will do some preliminary request validation for your defined commands, making sure the request body is in
+ the correct format (content type must be JSON) and contains all obligatory parameters for your command.
+
+ Let's take a look at a small example for such a simple API and how you would go about calling it.
+
+ Take this example of a plugin registered under plugin identifier ``mysimpleapiplugin``:
+
+ .. code-block:: python
+ :linenos:
+
+ import octoprint.plugin
+
+ import flask
+
+ class MySimpleApiPlugin(octoprint.plugin.SimpleApiPlugin):
+ def get_api_commands(self):
+ return dict(
+ command1=[],
+ command2=["some_parameter"]
+ )
+
+ def on_api_command(self, command, data):
+ import flask
+ if command == "command1":
+ parameter = "unset"
+ if "parameter" in data:
+ parameter = "set"
+ self._logger.info("command1 called, parameter is {parameter}".format(**locals()))
+ elif command == "command2":
+ self._logger.info("command2 called, some_parameter is {some_parameter}".format(**data))
+
+ def on_api_get(self, request):
+ return flask.jsonify(foo="bar")
+
+ __plugin_implementation__ = MySimpleApiPlugin()
+
+ Our plugin defines two commands, ``command1`` with no mandatory parameters and ``command2`` with one
+ mandatory parameter ``some_parameter``.
+
+ ``command1`` can also accept an optional parameter ``parameter``, and will log whether
+ that parameter was set or unset. ``command2`` will log the content of the mandatory ``some_parameter`` parameter.
+
+ A valid POST request for ``command2`` sent to ``/api/plugin/mysimpleapiplugin`` would look like this:
+
+ .. sourcecode:: http
+
+ POST /api/plugin/mysimpleapiplugin HTTP/1.1
+ Host: example.com
+ Content-Type: application/json
+ X-Api-Key: abcdef...
+
+ {
+ "command": "command2",
+ "some_parameter": "some_value",
+ "some_optional_parameter": 2342
+ }
+
+ which would produce a response like this:
+
+ .. sourcecode:: http
+
+ HTTP/1.1 204 No Content
+
+ and print something like this line to ``octoprint.log``::
+
+ 2015-02-12 17:40:21,140 - octoprint.plugins.mysimpleapiplugin - INFO - command2 called, some_parameter is some_value
+
+ A GET request on our plugin's simple API resource will only return a JSON document like this:
+
+ .. sourcecode:: http
+
+ HTTP/1.1 200 Ok
+ Content-Type: application/json
+
+ {
+ "foo": "bar"
+ }
+ """
+
+ def get_api_commands(self):
+ """
+ Return a dictionary here with the keys representing the accepted commands and the values being lists of
+ mandatory parameter names.
+ """
+ return None
+
+ def is_api_adminonly(self):
+ """
+ Return True if the API is only available to users having the admin role.
+ """
+ return False
+
+ def on_api_command(self, command, data):
+ """
+ Called by OctoPrint upon a POST request to ``/api/plugin/``. ``command`` will contain one of
+ the commands as specified via :func:`get_api_commands`, ``data`` will contain the full request body parsed
+ from JSON into a Python dictionary. Note that this will also contain the ``command`` attribute itself. For the
+ example given above, for the ``command2`` request the ``data`` received by the plugin would be equal to
+ ``dict(command="command2", some_parameter="some_value")``.
+
+ If your plugin returns nothing here, OctoPrint will return an empty response with return code ``204 No content``
+ for you. You may also return regular responses as you would return from any Flask view here though, e.g.
+ ``return flask.jsonify(result="some json result")`` or ``return flask.make_response("Not found", 404)``.
+
+ :param string command: the command with which the resource was called
+ :param dict data: the full request body of the POST request parsed from JSON into a Python dictionary
+ :return: ``None`` in which case OctoPrint will generate a ``204 No content`` response with empty body, or optionally
+ a proper Flask response.
+ """
+ return None
+
+ def on_api_get(self, request):
+ """
+ Called by OctoPrint upon a GET request to ``/api/plugin/``. ``request`` will contain the
+ received `Flask request object `_ which you may evaluate
+ for additional arguments supplied with the request.
+
+ If your plugin returns nothing here, OctoPrint will return an empty response with return code ``204 No content``
+ for you. You may also return regular responses as you would return from any Flask view here though, e.g.
+ ``return flask.jsonify(result="some json result")`` or ``return flask.make_response("Not found", 404)``.
+
+ :param request: the Flask request object
+ :return: ``None`` in which case OctoPrint will generate a ``204 No content`` response with empty body, or optionally
+ a proper Flask response.
+ """
+ return None
+
+
+class BlueprintPlugin(OctoPrintPlugin, RestartNeedingPlugin):
+ """
+ The ``BlueprintPlugin`` mixin allows plugins to define their own full fledged endpoints for whatever purpose,
+ be it a more sophisticated API than what is possible via the :class:`SimpleApiPlugin` or a custom web frontend.
+
+ The mechanism at work here is `Flask's `_ own `Blueprint mechanism `_.
+
+ The mixin automatically creates a blueprint for you that will be registered under ``/plugin//``.
+ All you need to do is decorate all of your view functions with the :func:`route` decorator,
+ which behaves exactly the same like Flask's regular ``route`` decorators. Example:
+
+ .. code-block:: python
+ :linenos:
+
+ import octoprint.plugin
+ import flask
+
+ class MyBlueprintPlugin(octoprint.plugin.BlueprintPlugin):
+ @octoprint.plugin.BlueprintPlugin.route("/echo", methods=["GET"])
+ def myEcho(self):
+ if not "text" in flask.request.values:
+ return flask.make_response("Expected a text to echo back.", 400)
+ return flask.request.values["text"]
+
+ __plugin_implementation__ = MyBlueprintPlugin()
+
+ Your blueprint will be published by OctoPrint under the base URL ``/plugin//``, so the above
+ example of a plugin with the identifier "myblueprintplugin" would be reachable under
+ ``/plugin/myblueprintplugin/echo``.
+
+ Just like with regular blueprints you'll be able to create URLs via ``url_for``, just use the prefix
+ ``plugin..``, e.g.:
+
+ .. code-block:: python
+
+ flask.url_for("plugin.myblueprintplugin.myEcho") # will return "/plugin/myblueprintplugin/echo"
+
+ """
+
+ @staticmethod
+ def route(rule, **options):
+ """
+ A decorator to mark view methods in your BlueprintPlugin subclass. Works just the same as Flask's
+ own ``route`` decorator available on blueprints.
+
+ See `the documentation for flask.Blueprint.route `_
+ and `the documentation for flask.Flask.route `_ for more
+ information.
+ """
+
+ from collections import defaultdict
+ def decorator(f):
+ # We attach the decorator parameters directly to the function object, because that's the only place
+ # we can access right now.
+ # This neat little trick was adapter from the Flask-Classy project: https://pythonhosted.org/Flask-Classy/
+ if not hasattr(f, "_blueprint_rules") or f._blueprint_rules is None:
+ f._blueprint_rules = defaultdict(list)
+ f._blueprint_rules[f.__name__].append((rule, options))
+ return f
+ return decorator
+
+ @staticmethod
+ def errorhandler(code_or_exception):
+ """
+ A decorator to mark errorhandlings methods in your BlueprintPlugin subclass. Works just the same as Flask's
+ own ``errorhandler`` decorator available on blueprints.
+
+ See `the documentation for flask.Blueprint.errorhandler `_
+ and `the documentation for flask.Flask.errorhandler `_ for more
+ information.
+ """
+ from collections import defaultdict
+ def decorator(f):
+ if not hasattr(f, "_blueprint_error_handler") or f._blueprint_error_handler is None:
+ f._blueprint_error_handler = defaultdict(list)
+ f._blueprint_error_handler[f.__name__].append(code_or_exception)
+ return f
+ return decorator
+
+ def get_blueprint(self):
+ """
+ Creates and returns the blueprint for your plugin. Override this if you want to define and handle your blueprint yourself.
+
+ This method will only be called once during server initialization.
+
+ :return: the blueprint ready to be registered with Flask
+ """
+
+ if hasattr(self, "_blueprint"):
+ # if we already constructed the blueprint and hence have it cached,
+ # return that instance - we don't want to instance it multiple times
+ return self._blueprint
+
+ import flask
+ kwargs = self.get_blueprint_kwargs()
+ blueprint = flask.Blueprint("plugin." + self._identifier, self._identifier, **kwargs)
+
+ # we now iterate over all members of ourselves and look if we find an attribute
+ # that has data originating from one of our decorators - we ignore anything
+ # starting with a _ to only handle public stuff
+ for member in [member for member in dir(self) if not member.startswith("_")]:
+ f = getattr(self, member)
+
+ if hasattr(f, "_blueprint_rules") and member in f._blueprint_rules:
+ # this attribute was annotated with our @route decorator
+ for blueprint_rule in f._blueprint_rules[member]:
+ rule, options = blueprint_rule
+ blueprint.add_url_rule(rule, options.pop("endpoint", f.__name__), view_func=f, **options)
+
+ if hasattr(f, "_blueprint_error_handler") and member in f._blueprint_error_handler:
+ # this attribute was annotated with our @error_handler decorator
+ for code_or_exception in f._blueprint_error_handler[member]:
+ blueprint.errorhandler(code_or_exception)(f)
+
+ # cache and return the blueprint object
+ self._blueprint = blueprint
+ return blueprint
+
+ def get_blueprint_kwargs(self):
+ """
+ Override this if you want your blueprint constructed with additional options such as ``static_folder``,
+ ``template_folder``, etc.
+
+ Defaults to the blueprint's ``static_folder`` and ``template_folder`` to be set to the plugin's basefolder
+ plus ``/static`` or respectively ``/templates``, or -- if the plugin also implements :class:`AssetPlugin` and/or
+ :class:`TemplatePlugin` -- the paths provided by ``get_asset_folder`` and ``get_template_folder`` respectively.
+ """
+ import os
+
+ if isinstance(self, AssetPlugin):
+ static_folder = self.get_asset_folder()
+ else:
+ static_folder = os.path.join(self._basefolder, "static")
+
+ if isinstance(self, TemplatePlugin):
+ template_folder = self.get_template_folder()
+ else:
+ template_folder = os.path.join(self._basefolder, "templates")
+
+ return dict(
+ static_folder=static_folder,
+ template_folder=template_folder
+ )
+
+ def is_blueprint_protected(self):
+ """
+ Whether a valid API key is needed to access the blueprint (the default) or not. Note that this only restricts
+ access to the blueprint's dynamic methods, static files are always accessible without API key.
+ """
+
+ return True
+
+
+class SettingsPlugin(OctoPrintPlugin):
+ """
+ Including the ``SettingsPlugin`` mixin allows plugins to store and retrieve their own settings within OctoPrint's
+ configuration.
+
+ Plugins including the mixing will get injected an additional property ``self._settings`` which is an instance of
+ :class:`PluginSettingsManager` already properly initialized for use by the plugin. In order for the manager to
+ know about the available settings structure and default values upon initialization, implementing plugins will need
+ to provide a dictionary with the plugin's default settings through overriding the method :func:`get_settings_defaults`.
+ The defined structure will then be available to access through the settings manager available as ``self._settings``.
+
+ If your plugin needs to react to the change of specific configuration values on the fly, e.g. to adjust the log level
+ of a logger when the user changes a corresponding flag via the settings dialog, you can override the
+ :func:`on_settings_save` method and wrap the call to the implementation from the parent class with retrieval of the
+ old and the new value and react accordingly.
+
+ Example:
+
+ .. code-block:: python
+
+ import octoprint.plugin
+
+ class MySettingsPlugin(octoprint.plugin.SettingsPlugin, octoprint.plugin.StartupPlugin):
+ def get_settings_defaults(self):
+ return dict(
+ some_setting="foo",
+ some_value=23,
+ sub=dict(
+ some_flag=True
+ )
+ )
+
+ def on_settings_save(self, data):
+ old_flag = self._settings.get_boolean(["sub", "some_flag"])
+
+ octoprint.plugin.SettingsPlugin.on_settings_save(self, data)
+
+ new_flag = self._settings.get_boolean(["sub", "some_flag"])
+ if old_flag != new_flag:
+ self._logger.info("sub.some_flag changed from {old_flag} to {new_flag}".format(**locals()))
+
+ def on_after_startup(self):
+ some_setting = self._settings.get(["some_setting"])
+ some_value = self._settings.get_int(["some_value"])
+ some_flag = self._settings.get_boolean(["sub", "some_flag"])
+ self._logger.info("some_setting = {some_setting}, some_value = {some_value}, sub.some_flag = {some_flag}".format(**locals())
+
+ __plugin_implementation__ = MySettingsPlugin()
+
+ Of course, you are always free to completely override both :func:`on_settings_load` and :func:`on_settings_save` if the
+ default implementations do not fit your requirements.
+
+ .. attribute:: _settings
+
+ The :class:`~octoprint.plugin.PluginSettings` instance to use for accessing the plugin's settings. Injected by
+ the plugin core system upon initialization of the implementation.
+ """
+
+ config_version_key = "_config_version"
+ """Key of the field in the settings that holds the configuration format version."""
+
+ def on_settings_load(self):
+ """
+ Loads the settings for the plugin, called by the Settings API view in order to retrieve all settings from
+ all plugins. Override this if you want to inject additional settings properties that are not stored within
+ OctoPrint's configuration.
+
+ .. note::
+
+ The default implementation will return your plugin's settings as is, so just in the structure and in the types
+ that are currently stored in OctoPrint's configuration.
+
+ If you need more granular control here, e.g. over the used data types, you'll need to override this method
+ and iterate yourself over all your settings, using the proper retriever methods on the settings manager
+ to retrieve the data in the correct format.
+
+ :return: the current settings of the plugin, as a dictionary
+ """
+ data = self._settings.get_all_data()
+ if self.config_version_key in data:
+ del data[self.config_version_key]
+ return data
+
+ def on_settings_save(self, data):
+ """
+ Saves the settings for the plugin, called by the Settings API view in order to persist all settings
+ from all plugins. Override this if you need to directly react to settings changes or want to extract
+ additional settings properties that are not stored within OctoPrint's configuration.
+
+ .. note::
+
+ The default implementation will persist your plugin's settings as is, so just in the structure and in the
+ types that were received by the Settings API view. Values identical to the default settings values
+ will *not* be persisted.
+
+ If you need more granular control here, e.g. over the used data types, you'll need to override this method
+ and iterate yourself over all your settings, retrieving them (if set) from the supplied received ``data``
+ and using the proper setter methods on the settings manager to persist the data in the correct format.
+
+ Arguments:
+ data (dict): The settings dictionary to be saved for the plugin
+
+ Returns:
+ dict: The settings that differed from the defaults and were actually saved.
+ """
+ import octoprint.util
+
+ # get the current data
+ current = self._settings.get_all_data()
+ if current is None:
+ current = dict()
+
+ # merge our new data on top of it
+ new_current = octoprint.util.dict_merge(current, data)
+ if self.config_version_key in new_current:
+ del new_current[self.config_version_key]
+
+ # determine diff dict that contains minimal set of changes against the
+ # default settings - we only want to persist that, not everything
+ diff = octoprint.util.dict_minimal_mergediff(self.get_settings_defaults(), new_current)
+
+ version = self.get_settings_version()
+
+ to_persist = dict(diff)
+ if version:
+ to_persist[self.config_version_key] = version
+
+ if to_persist:
+ self._settings.set([], to_persist)
+ else:
+ self._settings.clean_all_data()
+
+ return diff
+
+ def get_settings_defaults(self):
+ """
+ Retrieves the plugin's default settings with which the plugin's settings manager will be initialized.
+
+ Override this in your plugin's implementation and return a dictionary defining your settings data structure
+ with included default values.
+ """
+ return dict()
+
+ def get_settings_preprocessors(self):
+ """
+ Retrieves the plugin's preprocessors to use for preprocessing returned or set values prior to returning/setting
+ them.
+
+ The preprocessors should be provided as a dictionary mapping the path of the values to preprocess
+ (hierarchically) to a transform function which will get the value to transform as only input and should return
+ the transformed value.
+
+ Example:
+
+ .. code-block:: python
+
+ def get_settings_defaults(self):
+ return dict(some_key="Some_Value", some_other_key="Some_Value")
+
+ def get_settings_preprocessors(self):
+ return dict(some_key=lambda x: x.upper()), # getter preprocessors
+ dict(some_other_key=lambda x: x.lower()) # setter preprocessors
+
+ def some_method(self):
+ # getting the value for "some_key" should turn it to upper case
+ assert self._settings.get(["some_key"]) == "SOME_VALUE"
+
+ # the value for "some_other_key" should be left alone
+ assert self._settings.get(["some_other_key"] = "Some_Value"
+
+ # setting a value for "some_other_key" should cause the value to first be turned to lower case
+ self._settings.set(["some_other_key"], "SOME_OTHER_VALUE")
+ assert self._settings.get(["some_other_key"]) == "some_other_value"
+
+ Returns:
+ (dict, dict): A tuple consisting of two dictionaries, the first being the plugin's preprocessors for
+ getters, the second the preprocessors for setters
+ """
+ return dict(), dict()
+
+ def get_settings_version(self):
+ """
+ Retrieves the settings format version of the plugin.
+
+ Use this to have OctoPrint trigger your migration function if it detects an outdated settings version in
+ config.yaml.
+
+ Returns:
+ int or None: an int signifying the current settings format, should be incremented by plugins whenever there
+ are backwards incompatible changes. Returning None here disables the version tracking for the
+ plugin's configuration.
+ """
+ return None
+
+ def on_settings_migrate(self, target, current):
+ """
+ Called by OctoPrint if it detects that the installed version of the plugin necessitates a higher settings version
+ than the one currently stored in _config.yaml. Will also be called if the settings data stored in config.yaml
+ doesn't have version information, in which case the ``current`` parameter will be None.
+
+ Your plugin's implementation should take care of migrating any data by utilizing self._settings. OctoPrint
+ will take care of saving any changes to disk by calling `self._settings.save()` after returning from this method.
+
+ This method will be called before your plugin's :func:`on_settings_initialized` method, with all injections already
+ having taken place. You can therefore depend on the configuration having been migrated by the time
+ :func:`on_settings_initialized` is called.
+
+ Arguments:
+ target (int): The settings format version the plugin requires, this should always be the same value as
+ returned by :func:`get_settings_version`.
+ current (int or None): The settings format version as currently stored in config.yaml. May be None if
+ no version information can be found.
+ """
+ pass
+
+ def on_settings_cleanup(self):
+ """
+ Called after migration and initialization but before call to :func:`on_settings_initialized`.
+
+ Plugins may overwrite this method to perform additional clean up tasks.
+
+ The default implementation just minimizes the data persisted on disk to only contain
+ the differences to the defaults (in case the current data was persisted with an older
+ version of OctoPrint that still duplicated default data).
+ """
+ import octoprint.util
+ from octoprint.settings import NoSuchSettingsPath
+
+ try:
+ # let's fetch the current persisted config (so only the data on disk,
+ # without the defaults)
+ config = self._settings.get_all_data(merged=False, incl_defaults=False, error_on_path=True)
+ except NoSuchSettingsPath:
+ # no config persisted, nothing to do => get out of here
+ return
+
+ if config is None:
+ # config is set to None, that doesn't make sense, kill it and leave
+ self._settings.clean_all_data()
+ return
+
+ if self.config_version_key in config and config[self.config_version_key] is None:
+ # delete None entries for config version - it's the default, no need
+ del config[self.config_version_key]
+
+ # calculate a minimal diff between the settings and the current config -
+ # anything already in the settings will be removed from the persisted
+ # config, no need to duplicate it
+ defaults = self.get_settings_defaults()
+ diff = octoprint.util.dict_minimal_mergediff(defaults, config)
+
+ if not diff:
+ # no diff to defaults, no need to have anything persisted
+ self._settings.clean_all_data()
+ else:
+ # diff => persist only that
+ self._settings.set([], diff)
+
+ def on_settings_initialized(self):
+ """
+ Called after the settings have been initialized and - if necessary - also been migrated through a call to
+ func:`on_settings_migrate`.
+
+ This method will always be called after the `initialize` method.
+ """
+ pass
+
+
+class EventHandlerPlugin(OctoPrintPlugin):
+ """
+ The ``EventHandlerPlugin`` mixin allows OctoPrint plugins to react to any of :ref:`OctoPrint's events `.
+ OctoPrint will call the :func:`on_event` method for any event fired on its internal event bus, supplying the
+ event type and the associated payload. Please note that until your plugin returns from that method, further event
+ processing within OctoPrint will block - the event queue itself is run asynchronously from the rest of OctoPrint,
+ but the processing of the events within the queue itself happens consecutively.
+
+ This mixin is especially interesting for plugins which want to react on things like print jobs finishing, timelapse
+ videos rendering etc.
+ """
+
+ def on_event(self, event, payload):
+ """
+ Called by OctoPrint upon processing of a fired event on the platform.
+
+ Arguments:
+ event (str): The type of event that got fired, see :ref:`the list of events `
+ for possible values
+ payload (dict): The payload as provided with the event
+ """
+ pass
+
+
+class SlicerPlugin(OctoPrintPlugin):
+ """
+ Via the ``SlicerPlugin`` mixin plugins can add support for slicing engines to be used by OctoPrint.
+
+ """
+
+ def is_slicer_configured(self):
+ """
+ Unless the return value of this method is ``True``, OctoPrint will not register the slicer within the slicing
+ sub system upon startup. Plugins may use this to do some start up checks to verify that e.g. the path to
+ a slicing binary as set and the binary is executable, or credentials of a cloud slicing platform are properly
+ entered etc.
+ """
+ return False
+
+ def get_slicer_properties(self):
+ """
+ Plugins should override this method to return a ``dict`` containing a bunch of meta data about the implemented slicer.
+
+ The expected keys in the returned ``dict`` have the following meaning:
+
+ type
+ The type identifier to use for the slicer. This should be a short unique lower case string which will be
+ used to store slicer profiles under or refer to the slicer programmatically or from the API.
+ name
+ The human readable name of the slicer. This will be displayed to the user during slicer selection.
+ same_device
+ True if the slicer runs on the same device as OctoPrint, False otherwise. Slicers running on the same
+ device will not be allowed to slice while a print is running due to performance reasons. Slice requests
+ against slicers running on the same device will result in an error.
+ progress_report
+ ``True`` if the slicer can report back slicing progress to OctoPrint ``False`` otherwise.
+
+ Returns:
+ dict: A dict describing the slicer as outlined above.
+ """
+ return dict(
+ type=None,
+ name=None,
+ same_device=True,
+ progress_report=False
+ )
+
+ def get_slicer_default_profile(self):
+ """
+ Should return a :class:`~octoprint.slicing.SlicingProfile` containing the default slicing profile to use with
+ this slicer if no other profile has been selected.
+
+ Returns:
+ SlicingProfile: The :class:`~octoprint.slicing.SlicingProfile` containing the default slicing profile for
+ this slicer.
+ """
+ return None
+
+ def get_slicer_profile(self, path):
+ """
+ Should return a :class:`~octoprint.slicing.SlicingProfile` parsed from the slicing profile stored at the
+ indicated ``path``.
+
+ Arguments:
+ path (str): The absolute path from which to read the slicing profile.
+
+ Returns:
+ SlicingProfile: The specified slicing profile.
+ """
+ return None
+
+ def save_slicer_profile(self, path, profile, allow_overwrite=True, overrides=None):
+ """
+ Should save the provided :class:`~octoprint.slicing.SlicingProfile` to the indicated ``path``, after applying
+ any supplied ``overrides``. If a profile is already saved under the indicated path and ``allow_overwrite`` is
+ set to False (defaults to True), an :class:`IOError` should be raised.
+
+ Arguments:
+ path (str): The absolute path to which to save the profile.
+ profile (SlicingProfile): The profile to save.
+ allow_overwrite (boolean): Whether to allow to overwrite an existing profile at the indicated path (True,
+ default) or not (False). If a profile already exists on teh path and this is False an
+ :class:`IOError` should be raised.
+ overrides (dict): Profile overrides to apply to the ``profile`` before saving it
+ """
+ pass
+
+ def do_slice(self, model_path, printer_profile, machinecode_path=None, profile_path=None, position=None, on_progress=None, on_progress_args=None, on_progress_kwargs=None):
+ """
+ Called by OctoPrint to slice ``model_path`` for the indicated ``printer_profile``. If the ``machinecode_path`` is ``None``,
+ slicer implementations should generate it from the provided ``model_path``.
+
+ If provided, the ``profile_path`` is guaranteed by OctoPrint to be a serialized slicing profile created through the slicing
+ plugin's own :func:`save_slicer_profile` method.
+
+ If provided, ``position`` will be a ``dict`` containing and ``x`` and a ``y`` key, indicating the position
+ the center of the model on the print bed should have in the final sliced machine code. If not provided, slicer
+ implementations should place the model in the center of the print bed.
+
+ ``on_progress`` will be a callback which expects an additional keyword argument ``_progress`` with the current
+ slicing progress which - if progress reporting is supported - the slicing plugin should call like the following:
+
+ .. code-block:: python
+
+ if on_progress is not None:
+ if on_progress_args is None:
+ on_progress_args = ()
+ if on_progress_kwargs is None:
+ on_progress_kwargs = dict()
+
+ on_progress_kwargs["_progress"] = your_plugins_slicing_progress
+ on_progress(*on_progress_args, **on_progress_kwargs)
+
+ Please note that both ``on_progress_args`` and ``on_progress_kwargs`` as supplied by OctoPrint might be ``None``,
+ so always make sure to initialize those values to sane defaults like depicted above before invoking the callback.
+
+ In order to support external cancellation of an ongoing slicing job via :func:`cancel_slicing`, implementations
+ should make sure to track the started jobs via the ``machinecode_path``, if provided.
+
+ The method should return a 2-tuple consisting of a boolean ``flag`` indicating whether the slicing job was
+ finished successfully (True) or not (False) and a ``result`` depending on the success of the slicing job.
+
+ For jobs that finished successfully, ``result`` should be a :class:`dict` containing additional information
+ about the slicing job under the following keys:
+
+ _analysis
+ Analysis result of the generated machine code as returned by the slicer itself. This should match the
+ data structure described for the analysis queue of the matching maching code format, e.g.
+ :class:`~octoprint.filemanager.analysis.GcodeAnalysisQueue` for GCODE files.
+
+ For jobs that did not finish successfully (but not due to being cancelled!), ``result`` should be a :class:`str`
+ containing a human readable reason for the error.
+
+ If the job gets cancelled, a :class:`~octoprint.slicing.SlicingCancelled` exception should be raised.
+
+ Returns:
+ tuple: A 2-tuple (boolean, object) as outlined above.
+
+ Raises:
+ SlicingCancelled: The slicing job was cancelled (via :meth:`cancel_slicing`).
+ """
+ pass
+
+ def cancel_slicing(self, machinecode_path):
+ """
+ Cancels the slicing to the indicated file.
+
+ Arguments:
+ machinecode_path (str): The absolute path to the machine code file to which to stop slicing to.
+ """
+ pass
+
+
+class ProgressPlugin(OctoPrintPlugin):
+ """
+ Via the ``ProgressPlugin`` mixing plugins can let themselves be called upon progress in print jobs or slicing jobs,
+ limited to minimally 1% steps.
+ """
+
+ def on_print_progress(self, storage, path, progress):
+ """
+ Called by OctoPrint on minimally 1% increments during a running print job.
+
+ :param string location: Location of the file
+ :param string path: Path of the file
+ :param int progress: Current progress as a value between 0 and 100
+ """
+ pass
+
+ def on_slicing_progress(self, slicer, source_location, source_path, destination_location, destination_path, progress):
+ """
+ Called by OctoPrint on minimally 1% increments during a running slicing job.
+
+ :param string slicer: Key of the slicer reporting the progress
+ :param string source_location: Location of the source file
+ :param string source_path: Path of the source file
+ :param string destination_location: Location the destination file
+ :param string destination_path: Path of the destination file
+ :param int progress: Current progress as a value between 0 and 100
+ """
+ pass
+
+
+class AppPlugin(OctoPrintPlugin):
+ """
+ Using the :class:`AppPlugin mixin` plugins may register additional :ref:`App session key providers `
+ within the system.
+
+ .. deprecated:: 1.2.0
+
+ Refer to the :ref:`octoprint.accesscontrol.appkey hook ` instead.
+
+ """
+
+ def get_additional_apps(self):
+ return []
+
diff --git a/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/plugins/cura/__init__.py b/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/plugins/cura/__init__.py
new file mode 100644
index 000000000..095a274b5
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/plugins/cura/__init__.py
@@ -0,0 +1,420 @@
+# coding=utf-8
+from __future__ import absolute_import
+
+__author__ = "Gina Häußge "
+__license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html"
+__copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms of the AGPLv3 License"
+
+import logging
+import logging.handlers
+import os
+import flask
+import math
+
+import octoprint.plugin
+import octoprint.util
+import octoprint.slicing
+import octoprint.settings
+
+from .profile import Profile
+
+class CuraPlugin(octoprint.plugin.SlicerPlugin,
+ octoprint.plugin.SettingsPlugin,
+ octoprint.plugin.TemplatePlugin,
+ octoprint.plugin.AssetPlugin,
+ octoprint.plugin.BlueprintPlugin,
+ octoprint.plugin.StartupPlugin):
+
+ def __init__(self):
+ self._logger = logging.getLogger("octoprint.plugins.cura")
+ self._cura_logger = logging.getLogger("octoprint.plugins.cura.engine")
+
+ # setup job tracking across threads
+ import threading
+ self._slicing_commands = dict()
+ self._cancelled_jobs = []
+ self._job_mutex = threading.Lock()
+
+ ##~~ TemplatePlugin API
+
+ def get_template_vars(self):
+ return dict(
+ homepage=__plugin_url__
+ )
+
+ ##~~ StartupPlugin API
+
+ def on_startup(self, host, port):
+ # setup our custom logger
+ cura_logging_handler = logging.handlers.RotatingFileHandler(self._settings.get_plugin_logfile_path(postfix="engine"), maxBytes=2*1024*1024)
+ cura_logging_handler.setFormatter(logging.Formatter("%(asctime)s %(message)s"))
+ cura_logging_handler.setLevel(logging.DEBUG)
+
+ self._cura_logger.addHandler(cura_logging_handler)
+ self._cura_logger.setLevel(logging.DEBUG if self._settings.get_boolean(["debug_logging"]) else logging.CRITICAL)
+ self._cura_logger.propagate = False
+
+ ##~~ BlueprintPlugin API
+
+ @octoprint.plugin.BlueprintPlugin.route("/import", methods=["POST"])
+ def import_cura_profile(self):
+ import datetime
+ import tempfile
+
+ from octoprint.server import slicingManager
+
+ input_name = "file"
+ input_upload_name = input_name + "." + self._settings.global_get(["server", "uploads", "nameSuffix"])
+ input_upload_path = input_name + "." + self._settings.global_get(["server", "uploads", "pathSuffix"])
+
+ if input_upload_name in flask.request.values and input_upload_path in flask.request.values:
+ filename = flask.request.values[input_upload_name]
+ try:
+ profile_dict = Profile.from_cura_ini(flask.request.values[input_upload_path])
+ except Exception as e:
+ self._logger.exception("Error while converting the imported profile")
+ return flask.make_response("Something went wrong while converting imported profile: {message}".format(message=str(e)), 500)
+
+ else:
+ self._logger.warn("No profile file included for importing, aborting")
+ return flask.make_response("No file included", 400)
+
+ if profile_dict is None:
+ self._logger.warn("Could not convert profile, aborting")
+ return flask.make_response("Could not convert Cura profile", 400)
+
+ name, _ = os.path.splitext(filename)
+
+ # default values for name, display name and description
+ profile_name = _sanitize_name(name)
+ profile_display_name = name
+ profile_description = "Imported from {filename} on {date}".format(filename=filename, date=octoprint.util.get_formatted_datetime(datetime.datetime.now()))
+ profile_allow_overwrite = False
+
+ # overrides
+ if "name" in flask.request.values:
+ profile_name = flask.request.values["name"]
+ if "displayName" in flask.request.values:
+ profile_display_name = flask.request.values["displayName"]
+ if "description" in flask.request.values:
+ profile_description = flask.request.values["description"]
+ if "allowOverwrite" in flask.request.values:
+ from octoprint.server.api import valid_boolean_trues
+ profile_allow_overwrite = flask.request.values["allowOverwrite"] in valid_boolean_trues
+
+ try:
+ slicingManager.save_profile("cura",
+ profile_name,
+ profile_dict,
+ allow_overwrite=profile_allow_overwrite,
+ display_name=profile_display_name,
+ description=profile_description)
+ except octoprint.slicing.ProfileAlreadyExists:
+ self._logger.warn("Profile {profile_name} already exists, aborting".format(**locals()))
+ return flask.make_response("A profile named {profile_name} already exists for slicer cura".format(**locals()), 409)
+
+ result = dict(
+ resource=flask.url_for("api.slicingGetSlicerProfile", slicer="cura", name=profile_name, _external=True),
+ displayName=profile_display_name,
+ description=profile_description
+ )
+ r = flask.make_response(flask.jsonify(result), 201)
+ r.headers["Location"] = result["resource"]
+ return r
+
+ ##~~ AssetPlugin API
+
+ def get_assets(self):
+ return {
+ "js": ["js/cura.js"],
+ "less": ["less/cura.less"],
+ "css": ["css/cura.css"]
+ }
+
+ ##~~ SettingsPlugin API
+
+ def on_settings_save(self, data):
+ old_debug_logging = self._settings.get_boolean(["debug_logging"])
+
+ octoprint.plugin.SettingsPlugin.on_settings_save(self, data)
+
+ new_debug_logging = self._settings.get_boolean(["debug_logging"])
+ if old_debug_logging != new_debug_logging:
+ if new_debug_logging:
+ self._cura_logger.setLevel(logging.DEBUG)
+ else:
+ self._cura_logger.setLevel(logging.CRITICAL)
+
+ def get_settings_defaults(self):
+ return dict(
+ cura_engine=None,
+ default_profile=None,
+ debug_logging=False
+ )
+
+ ##~~ SlicerPlugin API
+
+ def is_slicer_configured(self):
+ cura_engine = self._settings.get(["cura_engine"])
+ if cura_engine is not None and os.path.exists(cura_engine):
+ return True
+ else:
+ self._logger.info("Path to CuraEngine has not been configured yet or does not exist (currently set to %r), Cura will not be selectable for slicing" % cura_engine)
+
+ def get_slicer_properties(self):
+ return dict(
+ type="cura",
+ name="CuraEngine",
+ same_device=True,
+ progress_report=True
+ )
+
+ def get_slicer_default_profile(self):
+ path = self._settings.get(["default_profile"])
+ if not path:
+ path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "profiles", "default.profile.yaml")
+ return self.get_slicer_profile(path)
+
+ def get_slicer_profile(self, path):
+ profile_dict = self._load_profile(path)
+
+ display_name = None
+ description = None
+ if "_display_name" in profile_dict:
+ display_name = profile_dict["_display_name"]
+ del profile_dict["_display_name"]
+ if "_description" in profile_dict:
+ description = profile_dict["_description"]
+ del profile_dict["_description"]
+
+ properties = self.get_slicer_properties()
+ return octoprint.slicing.SlicingProfile(properties["type"], "unknown", profile_dict, display_name=display_name, description=description)
+
+ def save_slicer_profile(self, path, profile, allow_overwrite=True, overrides=None):
+ if os.path.exists(path) and not allow_overwrite:
+ raise octoprint.slicing.ProfileAlreadyExists("cura", profile.name)
+
+ new_profile = Profile.merge_profile(profile.data, overrides=overrides)
+
+ if profile.display_name is not None:
+ new_profile["_display_name"] = profile.display_name
+ if profile.description is not None:
+ new_profile["_description"] = profile.description
+
+ self._save_profile(path, new_profile, allow_overwrite=allow_overwrite)
+
+ def do_slice(self, model_path, printer_profile, machinecode_path=None, profile_path=None, position=None, on_progress=None, on_progress_args=None, on_progress_kwargs=None):
+ try:
+ with self._job_mutex:
+ if not profile_path:
+ profile_path = self._settings.get(["default_profile"])
+ if not machinecode_path:
+ path, _ = os.path.splitext(model_path)
+ machinecode_path = path + ".gco"
+
+ if position and isinstance(position, dict) and "x" in position and "y" in position:
+ posX = position["x"]
+ posY = position["y"]
+ else:
+ posX = None
+ posY = None
+
+ if on_progress:
+ if not on_progress_args:
+ on_progress_args = ()
+ if not on_progress_kwargs:
+ on_progress_kwargs = dict()
+
+ self._cura_logger.info(u"### Slicing %s to %s using profile stored at %s" % (model_path, machinecode_path, profile_path))
+
+ engine_settings = self._convert_to_engine(profile_path, printer_profile, posX, posY)
+
+ executable = self._settings.get(["cura_engine"])
+ if not executable:
+ return False, "Path to CuraEngine is not configured "
+
+ working_dir, _ = os.path.split(executable)
+ args = [executable, '-v', '-p']
+ for k, v in engine_settings.items():
+ args += ["-s", "%s=%s" % (k, str(v))]
+ args += ["-o", machinecode_path, model_path]
+
+ self._logger.info(u"Running %r in %s" % (" ".join(args), working_dir))
+
+ import sarge
+ p = sarge.run(args, cwd=working_dir, async=True, stdout=sarge.Capture(), stderr=sarge.Capture())
+ p.wait_events()
+ self._slicing_commands[machinecode_path] = p.commands[0]
+
+ try:
+ layer_count = None
+ step_factor = dict(
+ inset=0,
+ skin=1,
+ export=2
+ )
+ analysis = None
+ while p.returncode is None:
+ line = p.stderr.readline(timeout=0.5)
+ if not line:
+ p.commands[0].poll()
+ continue
+
+ line = octoprint.util.to_unicode(line, errors="replace")
+ self._cura_logger.debug(line.strip())
+
+ if on_progress is not None:
+ # The Cura slicing process has three individual steps, each consisting of substeps:
+ #
+ # - inset
+ # - skin
+ # - export
+ #
+ # So each layer will be processed three times, once for each step, resulting in a total amount of
+ # substeps of 3 * .
+ #
+ # The CuraEngine reports the calculated layer count and the continuous progress on stderr.
+ # The layer count gets reported right at the beginning in a line of the format:
+ #
+ # Layer count:
+ #
+ # The individual progress per each of the three steps gets reported on stderr in a line of
+ # the format:
+ #
+ # Progress:::
+ #
+ # Thus, for determining the overall progress the following formula applies:
+ #
+ # progress = * + / * 3
+ #
+ # with being 0 for "inset", 1 for "skin" and 2 for "export".
+
+ if line.startswith(u"Layer count:") and layer_count is None:
+ try:
+ layer_count = float(line[len(u"Layer count:"):].strip())
+ except:
+ pass
+
+ elif line.startswith(u"Progress:"):
+ split_line = line[len(u"Progress:"):].strip().split(":")
+ if len(split_line) == 3:
+ step, current_layer, _ = split_line
+ try:
+ current_layer = float(current_layer)
+ except:
+ pass
+ else:
+ if not step in step_factor:
+ continue
+ on_progress_kwargs["_progress"] = (step_factor[step] * layer_count + current_layer) / (layer_count * 3)
+ on_progress(*on_progress_args, **on_progress_kwargs)
+
+ elif line.startswith(u"Print time:"):
+ try:
+ print_time = int(line[len(u"Print time:"):].strip())
+ if analysis is None:
+ analysis = dict()
+ analysis["estimatedPrintTime"] = print_time
+ except:
+ pass
+
+ elif line.startswith(u"Filament:") or line.startswith(u"Filament2:"):
+ if line.startswith(u"Filament:"):
+ filament_str = line[len(u"Filament:"):].strip()
+ tool_key = "tool0"
+ else:
+ filament_str = line[len(u"Filament2:"):].strip()
+ tool_key = "tool1"
+
+ try:
+ filament = int(filament_str)
+ if analysis is None:
+ analysis = dict()
+ if not "filament" in analysis:
+ analysis["filament"] = dict()
+ if not tool_key in analysis["filament"]:
+ analysis["filament"][tool_key] = dict()
+ analysis["filament"][tool_key]["length"] = filament
+ if "filamentDiameter" in engine_settings:
+ radius_in_cm = float(int(engine_settings["filamentDiameter"]) / 10000.0) / 2.0
+ filament_in_cm = filament / 10.0
+ analysis["filament"][tool_key]["volume"] = filament_in_cm * math.pi * radius_in_cm * radius_in_cm
+ except:
+ pass
+ finally:
+ p.close()
+
+ with self._job_mutex:
+ if machinecode_path in self._cancelled_jobs:
+ self._cura_logger.info(u"### Cancelled")
+ raise octoprint.slicing.SlicingCancelled()
+
+ self._cura_logger.info(u"### Finished, returncode %d" % p.returncode)
+ if p.returncode == 0:
+ return True, dict(analysis=analysis)
+ else:
+ self._logger.warn(u"Could not slice via Cura, got return code %r" % p.returncode)
+ return False, "Got returncode %r" % p.returncode
+
+ except octoprint.slicing.SlicingCancelled as e:
+ raise e
+ except:
+ self._logger.exception(u"Could not slice via Cura, got an unknown error")
+ return False, "Unknown error, please consult the log file"
+
+ finally:
+ with self._job_mutex:
+ if machinecode_path in self._cancelled_jobs:
+ self._cancelled_jobs.remove(machinecode_path)
+ if machinecode_path in self._slicing_commands:
+ del self._slicing_commands[machinecode_path]
+
+ self._cura_logger.info("-" * 40)
+
+ def cancel_slicing(self, machinecode_path):
+ with self._job_mutex:
+ if machinecode_path in self._slicing_commands:
+ self._cancelled_jobs.append(machinecode_path)
+ command = self._slicing_commands[machinecode_path]
+ if command is not None:
+ command.terminate()
+ self._logger.info(u"Cancelled slicing of %s" % machinecode_path)
+
+ def _load_profile(self, path):
+ import yaml
+ profile_dict = dict()
+ with open(path, "r") as f:
+ try:
+ profile_dict = yaml.safe_load(f)
+ except:
+ raise IOError("Couldn't read profile from {path}".format(path=path))
+ return profile_dict
+
+ def _save_profile(self, path, profile, allow_overwrite=True):
+ import yaml
+ with octoprint.util.atomic_write(path, "wb") as f:
+ yaml.safe_dump(profile, f, default_flow_style=False, indent=" ", allow_unicode=True)
+
+ def _convert_to_engine(self, profile_path, printer_profile, posX, posY):
+ profile = Profile(self._load_profile(profile_path), printer_profile, posX, posY)
+ return profile.convert_to_engine()
+
+def _sanitize_name(name):
+ if name is None:
+ return None
+
+ if "/" in name or "\\" in name:
+ raise ValueError("name must not contain / or \\")
+
+ import string
+ valid_chars = "-_.() {ascii}{digits}".format(ascii=string.ascii_letters, digits=string.digits)
+ sanitized_name = ''.join(c for c in name if c in valid_chars)
+ sanitized_name = sanitized_name.replace(" ", "_")
+ return sanitized_name.lower()
+
+__plugin_name__ = "CuraEngine (<= 15.04)"
+__plugin_author__ = "Gina Häußge"
+__plugin_url__ = "https://github.com/foosel/OctoPrint/wiki/Plugin:-Cura"
+__plugin_description__ = "Adds support for slicing via CuraEngine versions up to and including version 15.04 from within OctoPrint"
+__plugin_license__ = "AGPLv3"
+__plugin_implementation__ = CuraPlugin()
diff --git a/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/plugins/cura/profile.py b/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/plugins/cura/profile.py
new file mode 100644
index 000000000..59a0ee152
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/plugins/cura/profile.py
@@ -0,0 +1,980 @@
+# coding=utf-8
+from __future__ import absolute_import
+
+__author__ = "Gina Häußge "
+__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
+__copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms of the AGPLv3 License"
+
+
+import re
+
+class SupportLocationTypes(object):
+ NONE = "none"
+ TOUCHING_BUILDPLATE = "buildplate"
+ EVERYWHERE = "everywhere"
+
+class SupportDualTypes(object):
+ BOTH = "both"
+ FIRST = "first"
+ SECOND = "second"
+
+class SupportTypes(object):
+ GRID = "grid"
+ LINES = "lines"
+
+class PlatformAdhesionTypes(object):
+ NONE = "none"
+ BRIM = "brim"
+ RAFT = "raft"
+
+class MachineShapeTypes(object):
+ SQUARE = "square"
+ CIRCULAR = "circular"
+
+class GcodeFlavors(object):
+ REPRAP = "reprap"
+ REPRAP_VOLUME = "reprap_volume"
+ ULTIGCODE = "ultigcode"
+ MAKERBOT = "makerbot"
+ BFB = "bfb"
+ MACH3 = "mach3"
+
+
+defaults = dict(
+ layer_height=0.1,
+ wall_thickness=0.8,
+ solid_layer_thickness=0.6,
+ print_temperature=[220, 0, 0, 0],
+ print_bed_temperature=70,
+ platform_adhesion=PlatformAdhesionTypes.NONE,
+ filament_diameter=[2.85, 0, 0, 0],
+ filament_flow=100.0,
+ bottom_thickness=0.3,
+ first_layer_width_factor=100.0,
+ object_sink=0.0,
+
+ fill_density=20,
+ solid_top=True,
+ solid_bottom=True,
+ fill_overlap=15,
+
+ # speeds
+ print_speed=50.0,
+ travel_speed=150.0,
+ bottom_layer_speed=20.0,
+ infill_speed=0.0,
+ outer_shell_speed=0.0,
+ inner_shell_speed=0.0,
+
+ # dual extrusion
+ overlap_dual=0.15,
+ wipe_tower=False,
+ wipe_tower_volume=15,
+ ooze_shield=False,
+
+ # retraction
+ retraction_enable=True,
+ retraction_speed=40.0,
+ retraction_amount=4.5,
+ retraction_dual_amount=16.5,
+ retraction_min_travel=1.5,
+ retraction_combing=True,
+ retraction_minimal_extrusion=0.02,
+ retraction_hop=0.0,
+
+ # cooling
+ cool_min_layer_time=5,
+ fan_enabled=True,
+ fan_full_height=0.5,
+ fan_speed=100,
+ fan_speed_max=100,
+ cool_min_feedrate=10,
+ cool_head_lift=False,
+
+ # support
+ support=SupportLocationTypes.NONE,
+ support_type=SupportTypes.GRID,
+ support_angle=60.0,
+ support_fill_rate=15,
+ support_xy_distance=0.7,
+ support_z_distance=0.15,
+ support_dual_extrusion=SupportDualTypes.BOTH,
+
+ # platform adhesion
+ skirt_line_count=1,
+ skirt_gap=3.0,
+ skirt_minimal_length=150.0,
+ brim_line_count=20,
+ raft_margin=5.0,
+ raft_line_spacing=3.0,
+ raft_base_thickness=0.3,
+ raft_base_linewidth=1.0,
+ raft_interface_thickness=0.27,
+ raft_interface_linewidth=0.4,
+ raft_airgap=0.22,
+ raft_surface_layers=2,
+
+ # repairing
+ fix_horrible_union_all_type_a=True,
+ fix_horrible_union_all_type_b=False,
+ fix_horrible_use_open_bits=False,
+ fix_horrible_extensive_stitching=False,
+
+ # extras
+ spiralize=False,
+ follow_surface=False,
+
+ machine_width=205,
+ machine_depth=205,
+ machine_center_is_zero=False,
+ has_heated_bed=False,
+ gcode_flavor=GcodeFlavors.REPRAP,
+ extruder_amount=1,
+ steps_per_e=0,
+ start_gcode=[
+ # 1 extruder
+ """;Sliced at: {day} {date} {time}
+;Basic settings: Layer height: {layer_height} Walls: {wall_thickness} Fill: {fill_density}
+;M190 S{print_bed_temperature} ;Uncomment to add your own bed temperature line
+;M109 S{print_temperature} ;Uncomment to add your own temperature line
+G21 ;metric values
+G90 ;absolute positioning
+M82 ;set extruder to absolute mode
+M107 ;start with the fan off
+
+G28 X0 Y0 ;move X/Y to min endstops
+G28 Z0 ;move Z to min endstops
+
+G1 Z15.0 F{travel_speed} ;move the platform down 15mm
+
+G92 E0 ;zero the extruded length
+G1 F200 E3 ;extrude 3mm of feed stock
+G92 E0 ;zero the extruded length again
+G1 F{travel_speed}
+;Put printing message on LCD screen
+M117 Printing...
+""",
+ # 2 extruders
+ """;Sliced at: {day} {date} {time}
+;Basic settings: Layer height: {layer_height} Walls: {wall_thickness} Fill: {fill_density}
+;M190 S{print_bed_temperature} ;Uncomment to add your own bed temperature line
+;M104 S{print_temperature} ;Uncomment to add your own temperature line
+;M109 T1 S{print_temperature2} ;Uncomment to add your own temperature line
+;M109 T0 S{print_temperature} ;Uncomment to add your own temperature line
+G21 ;metric values
+G90 ;absolute positioning
+M107 ;start with the fan off
+
+G28 X0 Y0 ;move X/Y to min endstops
+G28 Z0 ;move Z to min endstops
+
+G1 Z15.0 F{travel_speed} ;move the platform down 15mm
+
+T1 ;Switch to the 2nd extruder
+G92 E0 ;zero the extruded length
+G1 F200 E10 ;extrude 10mm of feed stock
+G92 E0 ;zero the extruded length again
+G1 F200 E-{retraction_dual_amount}
+
+T0 ;Switch to the first extruder
+G92 E0 ;zero the extruded length
+G1 F200 E10 ;extrude 10mm of feed stock
+G92 E0 ;zero the extruded length again
+G1 F{travel_speed}
+;Put printing message on LCD screen
+M117 Printing...
+""",
+ # 3 extruders
+ """;Sliced at: {day} {date} {time}
+;Basic settings: Layer height: {layer_height} Walls: {wall_thickness} Fill: {fill_density}
+;M190 S{print_bed_temperature} ;Uncomment to add your own bed temperature line
+;M104 S{print_temperature} ;Uncomment to add your own temperature line
+;M109 T1 S{print_temperature2} ;Uncomment to add your own temperature line
+;M109 T0 S{print_temperature} ;Uncomment to add your own temperature line
+G21 ;metric values
+G90 ;absolute positioning
+M107 ;start with the fan off
+
+G28 X0 Y0 ;move X/Y to min endstops
+G28 Z0 ;move Z to min endstops
+
+G1 Z15.0 F{travel_speed} ;move the platform down 15mm
+
+T2 ;Switch to the 2nd extruder
+G92 E0 ;zero the extruded length
+G1 F200 E10 ;extrude 10mm of feed stock
+G92 E0 ;zero the extruded length again
+G1 F200 E-{retraction_dual_amount}
+
+T1 ;Switch to the 2nd extruder
+G92 E0 ;zero the extruded length
+G1 F200 E10 ;extrude 10mm of feed stock
+G92 E0 ;zero the extruded length again
+G1 F200 E-{retraction_dual_amount}
+
+T0 ;Switch to the first extruder
+G92 E0 ;zero the extruded length
+G1 F200 E10 ;extrude 10mm of feed stock
+G92 E0 ;zero the extruded length again
+G1 F{travel_speed}
+;Put printing message on LCD screen
+M117 Printing...
+""",
+ # 4 extruders
+ """;Sliced at: {day} {date} {time}
+;Basic settings: Layer height: {layer_height} Walls: {wall_thickness} Fill: {fill_density}
+;M190 S{print_bed_temperature} ;Uncomment to add your own bed temperature line
+;M104 S{print_temperature} ;Uncomment to add your own temperature line
+;M109 T2 S{print_temperature2} ;Uncomment to add your own temperature line
+;M109 T1 S{print_temperature2} ;Uncomment to add your own temperature line
+;M109 T0 S{print_temperature} ;Uncomment to add your own temperature line
+G21 ;metric values
+G90 ;absolute positioning
+M107 ;start with the fan off
+
+G28 X0 Y0 ;move X/Y to min endstops
+G28 Z0 ;move Z to min endstops
+
+G1 Z15.0 F{travel_speed} ;move the platform down 15mm
+
+T3 ;Switch to the 4th extruder
+G92 E0 ;zero the extruded length
+G1 F200 E10 ;extrude 10mm of feed stock
+G92 E0 ;zero the extruded length again
+G1 F200 E-{retraction_dual_amount}
+
+T2 ;Switch to the 3th extruder
+G92 E0 ;zero the extruded length
+G1 F200 E10 ;extrude 10mm of feed stock
+G92 E0 ;zero the extruded length again
+G1 F200 E-{retraction_dual_amount}
+
+T1 ;Switch to the 2nd extruder
+G92 E0 ;zero the extruded length
+G1 F200 E10 ;extrude 10mm of feed stock
+G92 E0 ;zero the extruded length again
+G1 F200 E-{retraction_dual_amount}
+
+T0 ;Switch to the first extruder
+G92 E0 ;zero the extruded length
+G1 F200 E10 ;extrude 10mm of feed stock
+G92 E0 ;zero the extruded length again
+G1 F{travel_speed}
+;Put printing message on LCD screen
+M117 Printing...
+"""
+ ],
+ end_gcode=[
+ # 1 extruder
+ """;End GCode
+M104 S0 ;extruder heater off
+M140 S0 ;heated bed heater off (if you have it)
+
+G91 ;relative positioning
+G1 E-1 F300 ;retract the filament a bit before lifting the nozzle, to release some of the pressure
+G1 Z+0.5 E-5 X-20 Y-20 F{travel_speed} ;move Z up a bit and retract filament even more
+G28 X0 Y0 ;move X/Y to min endstops, so the head is out of the way
+
+M84 ;steppers off
+G90 ;absolute positioning
+;{profile_string}
+""",
+ # 2 extruders
+ """;End GCode
+M104 T0 S0 ;extruder heater off
+M104 T1 S0 ;extruder heater off
+M140 S0 ;heated bed heater off (if you have it)
+
+G91 ;relative positioning
+G1 E-1 F300 ;retract the filament a bit before lifting the nozzle, to release some of the pressure
+G1 Z+0.5 E-5 X-20 Y-20 F{travel_speed} ;move Z up a bit and retract filament even more
+G28 X0 Y0 ;move X/Y to min endstops, so the head is out of the way
+
+M84 ;steppers off
+G90 ;absolute positioning
+;{profile_string}
+""",
+ # 3 extruders
+ """;End GCode
+M104 T0 S0 ;extruder heater off
+M104 T1 S0 ;extruder heater off
+M104 T2 S0 ;extruder heater off
+M140 S0 ;heated bed heater off (if you have it)
+
+G91 ;relative positioning
+G1 E-1 F300 ;retract the filament a bit before lifting the nozzle, to release some of the pressure
+G1 Z+0.5 E-5 X-20 Y-20 F{travel_speed} ;move Z up a bit and retract filament even more
+G28 X0 Y0 ;move X/Y to min endstops, so the head is out of the way
+
+M84 ;steppers off
+G90 ;absolute positioning
+;{profile_string}
+""",
+ # 4 extruders
+ """;End GCode
+M104 T0 S0 ;extruder heater off
+M104 T1 S0 ;extruder heater off
+M104 T2 S0 ;extruder heater off
+M104 T3 S0 ;extruder heater off
+M140 S0 ;heated bed heater off (if you have it)
+
+G91 ;relative positioning
+G1 E-1 F300 ;retract the filament a bit before lifting the nozzle, to release some of the pressure
+G1 Z+0.5 E-5 X-20 Y-20 F{travel_speed} ;move Z up a bit and retract filament even more
+G28 X0 Y0 ;move X/Y to min endstops, so the head is out of the way
+
+M84 ;steppers off
+G90 ;absolute positioning
+;{profile_string}
+"""
+ ],
+ preSwitchExtruder_gcode=""";Switch between the current extruder and the next extruder, when printing with multiple extruders.
+;This code is added before the T(n)
+""",
+ postSwitchExtruder_gcode=""";Switch between the current extruder and the next extruder, when printing with multiple extruders.
+;This code is added after the T(n)
+"""
+)
+
+
+class Profile(object):
+
+ regex_extruder_offset = re.compile("extruder_offset_([xy])(\d)")
+ regex_filament_diameter = re.compile("filament_diameter(\d?)")
+ regex_print_temperature = re.compile("print_temperature(\d?)")
+ regex_strip_comments = re.compile(";.*$", flags=re.MULTILINE)
+
+ @classmethod
+ def from_cura_ini(cls, path):
+ import logging
+ logger = logging.getLogger("octoprint.plugin.cura.profile")
+
+ import os
+ if not os.path.exists(path) or not os.path.isfile(path):
+ logger.warn("Path {path} does not exist or is not a file, cannot import".format(**locals()))
+ return None
+
+ import ConfigParser
+ config = ConfigParser.ConfigParser()
+ try:
+ config.read(path)
+ except:
+ logger.exception("Error while reading profile INI file from {path}".format(**locals()))
+ return None
+
+ arrayified_options = ["print_temperature", "filament_diameter", "start.gcode", "end.gcode"]
+ translated_options = dict(
+ inset0_speed="outer_shell_speed",
+ insetx_speed="inner_shell_speed",
+ layer0_width_factor="first_layer_width_factor",
+ simple_mode="follow_surface",
+ )
+ translated_options["start.gcode"] = "start_gcode"
+ translated_options["end.gcode"] = "end_gcode"
+ value_conversions = dict(
+ platform_adhesion={
+ "None": PlatformAdhesionTypes.NONE,
+ "Brim": PlatformAdhesionTypes.BRIM,
+ "Raft": PlatformAdhesionTypes.RAFT
+ },
+ support={
+ "None": SupportLocationTypes.NONE,
+ "Touching buildplate": SupportLocationTypes.TOUCHING_BUILDPLATE,
+ "Everywhere": SupportLocationTypes.EVERYWHERE
+ },
+ support_type={
+ "Lines": SupportTypes.LINES,
+ "Grid": SupportTypes.GRID
+ },
+ support_dual_extrusion={
+ "Both": SupportDualTypes.BOTH,
+ "First extruder": SupportDualTypes.FIRST,
+ "Second extruder": SupportDualTypes.SECOND
+ }
+ )
+
+ result = dict()
+ for section in config.sections():
+ if not section in ("profile", "alterations"):
+ continue
+
+ for option in config.options(section):
+ ignored = False
+ key = option
+
+ # try to fetch the value in the correct type
+ try:
+ value = config.getboolean(section, option)
+ except:
+ # no boolean, try int
+ try:
+ value = config.getint(section, option)
+ except:
+ # no int, try float
+ try:
+ value = config.getfloat(section, option)
+ except:
+ # no float, use str
+ value = config.get(section, option)
+ index = None
+
+ for opt in arrayified_options:
+ if key.startswith(opt):
+ if key == opt:
+ index = 0
+ else:
+ try:
+ # try to convert the target index, e.g. print_temperature2 => print_temperature[1]
+ index = int(key[len(opt):]) - 1
+ except ValueError:
+ # ignore entries for which that fails
+ ignored = True
+ key = opt
+ break
+ if ignored:
+ continue
+
+ if key in translated_options:
+ # if the key has to be translated to a new value, do that now
+ key = translated_options[key]
+
+ if key in value_conversions and value in value_conversions[key]:
+ value = value_conversions[key][value]
+
+ if index is not None:
+ # if we have an array to fill, make sure the target array exists and has the right size
+ if not key in result:
+ result[key] = []
+ if len(result[key]) <= index:
+ for n in xrange(index - len(result[key]) + 1):
+ result[key].append(None)
+ result[key][index] = value
+ else:
+ # just set the value if there's no array to fill
+ result[key] = value
+
+ # merge it with our default settings, the imported profile settings taking precedence
+ return cls.merge_profile(result)
+
+
+ @classmethod
+ def merge_profile(cls, profile, overrides=None):
+ result = dict()
+ for key in defaults.keys():
+ r = cls.merge_profile_key(key, profile, overrides=overrides)
+ if r is not None:
+ result[key] = r
+ return result
+
+ @classmethod
+ def merge_profile_key(cls, key, profile, overrides=None):
+ profile_value = None
+ override_value = None
+
+ if not key in defaults:
+ return None
+ import copy
+ result = copy.deepcopy(defaults[key])
+
+ if key in profile:
+ profile_value = profile[key]
+ if overrides and key in overrides:
+ override_value = overrides[key]
+
+ if profile_value is None and override_value is None:
+ # neither override nor profile, no need to handle this key further
+ return None
+
+ if key in ("filament_diameter", "print_temperature", "start_gcode", "end_gcode"):
+ # the array fields need some special treatment. Basically something like this:
+ #
+ # override_value: [None, "b"]
+ # profile_value : ["a" , None, "c"]
+ # default_value : ["d" , "e" , "f", "g"]
+ #
+ # should merge to something like this:
+ #
+ # ["a" , "b" , "c", "g"]
+ #
+ # So override > profile > default, if neither override nor profile value are available
+ # the default value should just be left as is
+
+ for x in xrange(len(result)):
+ if override_value is not None and x < len(override_value) and override_value[x] is not None:
+ # we have an override value for this location, so we use it
+ result[x] = override_value[x]
+ elif profile_value is not None and x < len(profile_value) and profile_value[x] is not None:
+ # we have a profile value for this location, so we use it
+ result[x] = profile_value[x]
+
+ else:
+ # just change the result value to the override_value if available, otherwise to the profile_value if
+ # that is given, else just leave as is
+ if override_value is not None:
+ result = override_value
+ elif profile_value is not None:
+ result = profile_value
+
+ return result
+
+ def __init__(self, profile, printer_profile, posX, posY, overrides=None):
+ self._profile = self.__class__.merge_profile(profile, overrides=overrides)
+ self._printer_profile = printer_profile
+ self._posX = posX
+ self._posY = posY
+
+ def profile(self):
+ import copy
+ return copy.deepcopy(self._profile)
+
+ def get(self, key):
+ if key in ("machine_width", "machine_depth", "machine_center_is_zero"):
+ if key == "machine_width":
+ return self._printer_profile["volume"]["width"]
+ elif key == "machine_depth":
+ return self._printer_profile["volume"]["depth"]
+ elif key == "machine_height":
+ return self._printer_profile["volume"]["height"]
+ elif key == "machine_center_is_zero":
+ return self._printer_profile["volume"]["formFactor"] == "circular" or self._printer_profile["volume"]["origin"] == "center"
+ else:
+ return None
+
+ elif key == "extruder_amount":
+ return self._printer_profile["extruder"]["count"]
+
+ elif key.startswith("extruder_offset_"):
+ extruder_offsets = self._printer_profile["extruder"]["offsets"]
+ match = Profile.regex_extruder_offset.match(key)
+ if not match:
+ return 0.0
+
+ axis, number = match.groups()
+ axis = axis.lower()
+ number = int(number)
+
+ if not axis in ("x", "y"):
+ return 0.0
+ if number >= len(extruder_offsets):
+ return 0.0
+
+ if axis == "x":
+ return extruder_offsets[number][0]
+ elif axis == "y":
+ return extruder_offsets[number][1]
+ else:
+ return 0.0
+
+ elif key == "has_heated_bed":
+ return self._printer_profile["heatedBed"]
+
+ elif key.startswith("filament_diameter"):
+ match = Profile.regex_filament_diameter.match(key)
+ if not match:
+ return 0.0
+
+ diameters = self._get("filament_diameter")
+ if not match.group(1):
+ return diameters[0]
+ index = int(match.group(1))
+ if index >= len(diameters):
+ return 0.0
+ return diameters[index]
+
+ elif key.startswith("print_temperature"):
+ match = Profile.regex_print_temperature.match(key)
+ if not match:
+ return 0.0
+
+ temperatures = self._get("print_temperature")
+ if not match.group(1):
+ return temperatures[0]
+ index = int(match.group(1))
+ if index >= len(temperatures):
+ return 0.0
+ return temperatures[index]
+
+ else:
+ return self._get(key)
+
+ def _get(self, key):
+ if key in self._profile:
+ return self._profile[key]
+ elif key in defaults:
+ return defaults[key]
+ else:
+ return None
+
+ def get_int(self, key, default=None):
+ value = self.get(key)
+ if value is None:
+ return default
+
+ try:
+ return int(value)
+ except ValueError:
+ return default
+
+ def get_float(self, key, default=None):
+ value = self.get(key)
+ if value is None:
+ return default
+
+ if isinstance(value, (str, unicode, basestring)):
+ value = value.replace(",", ".").strip()
+
+ try:
+ return float(value)
+ except ValueError:
+ return default
+
+ def get_boolean(self, key, default=None):
+ value = self.get(key)
+ if value is None:
+ return default
+
+ if isinstance(value, bool):
+ return value
+ elif isinstance(value, (str, unicode, basestring)):
+ return value.lower() == "true" or value.lower() == "yes" or value.lower() == "on" or value == "1"
+ elif isinstance(value, (int, float)):
+ return value > 0
+ else:
+ return value == True
+
+ def get_microns(self, key, default=None):
+ value = self.get_float(key, default=None)
+ if value is None:
+ return default
+ return int(value * 1000)
+
+ def get_gcode_template(self, key):
+ extruder_count = self.get_int("extruder_amount")
+
+ if key in self._profile:
+ gcode = self._profile[key]
+ else:
+ gcode = defaults[key]
+
+ if key in ("start_gcode", "end_gcode"):
+ return gcode[extruder_count-1]
+ else:
+ return gcode
+
+ def get_profile_string(self):
+ import base64
+ import zlib
+
+ import copy
+ profile = copy.deepcopy(defaults)
+ profile.update(self._profile)
+ for key in ("print_temperature", "print_temperature2", "print_temperature3", "print_temperature4",
+ "filament_diameter", "filament_diameter2", "filament_diameter3", "filament_diameter4"):
+ profile[key] = self.get(key)
+
+ result = []
+ for k, v in profile.items():
+ if isinstance(v, (str, unicode)):
+ result.append("{k}={v}".format(k=k, v=v.encode("utf-8")))
+ else:
+ result.append("{k}={v}".format(k=k, v=v))
+
+ return base64.b64encode(zlib.compress("\b".join(result), 9))
+
+ def replaceTagMatch(self, m):
+ import time
+
+ pre = m.group(1)
+ tag = m.group(2)
+
+ if tag == 'time':
+ return pre + time.strftime('%H:%M:%S')
+ if tag == 'date':
+ return pre + time.strftime('%d-%m-%Y')
+ if tag == 'day':
+ return pre + ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'][int(time.strftime('%w'))]
+ if tag == 'profile_string':
+ return pre + 'CURA_OCTO_PROFILE_STRING:%s' % (self.get_profile_string())
+
+ if pre == 'F' and tag == 'max_z_speed':
+ f = self.get_float("travel_speed") * 60
+ elif pre == 'F' and tag in ['print_speed', 'retraction_speed', 'travel_speed', 'bottom_layer_speed', 'cool_min_feedrate']:
+ f = self.get_float(tag) * 60
+ elif self.get(tag):
+ f = self.get(tag)
+ else:
+ return '%s?%s?' % (pre, tag)
+
+ if (f % 1) == 0:
+ return pre + str(int(f))
+
+ return pre + str(f)
+
+ def get_gcode(self, key):
+ extruder_count = self.get_int("extruder_amount")
+
+ prefix = ""
+ postfix = ""
+
+ if self.get("gcode_flavor") == GcodeFlavors.ULTIGCODE:
+ if key == "end_gcode":
+ return "M25 ;Stop reading from this point on.\n;CURA_PROFILE_STRING:%s\n" % (self.get_profile_string())
+ return ""
+
+ if key == "start_gcode":
+ contents = self.get_gcode_template("start_gcode")
+
+ e_steps = self.get_float("steps_per_e")
+ if e_steps > 0:
+ prefix += "M92 E{e_steps}\n" % (e_steps)
+ temp = self.get_float("print_temperature")
+
+ bed_temp = 0
+ if self.get_boolean("has_heated_bed"):
+ bed_temp = self.get_float("print_bed_temperature")
+ include_bed_temp = bed_temp > 0 and not "{print_bed_temperature}" in Profile.regex_strip_comments.sub("", contents)
+
+ if include_bed_temp:
+ prefix += "M140 S{bed_temp}\n".format(bed_temp=bed_temp)
+
+ if temp > 0 and not "{print_temperature}" in Profile.regex_strip_comments.sub("", contents):
+ if extruder_count > 0:
+ def temp_line(temp, extruder, template):
+ t = temp
+ if extruder > 0:
+ print_temp = self.get_float("print_temperature%d" % (extruder + 1))
+ if print_temp > 0:
+ t = print_temp
+ return template.format(extruder=extruder, temp=t)
+
+ prefix_preheat = ""
+ prefix_waitheat = ""
+ for n in xrange(0, extruder_count):
+ if n > 0:
+ prefix_preheat += temp_line(temp, n, "M104 T{extruder} S{temp}\n")
+ prefix_waitheat += temp_line(temp, n, "M109 T{extruder} S{temp}\n")
+ prefix += prefix_preheat + prefix_waitheat + "T0\n"
+ else:
+ prefix += "M109 S{temp}\n".format(temp=temp)
+
+ if include_bed_temp:
+ prefix += "M190 S{bed_temp}\n".format(bed_temp=bed_temp)
+
+ else:
+ contents = self.get_gcode_template(key)
+
+ return unicode(prefix + re.sub("(.)\{([^\}]*)\}", self.replaceTagMatch, contents).rstrip() + '\n' + postfix).strip().encode('utf-8') + '\n'
+
+ def calculate_edge_width_and_line_count(self):
+ wall_thickness = self.get_float("wall_thickness")
+ nozzle_size = self._printer_profile["extruder"]["nozzleDiameter"]
+
+ if self.get_boolean("spiralize") or self.get_boolean("follow_surface"):
+ return wall_thickness, 1
+ if wall_thickness < 0.01:
+ return nozzle_size, 0
+ if wall_thickness < nozzle_size:
+ return wall_thickness, 1
+
+ edge_width = None
+ line_count = int(wall_thickness / (nozzle_size - 0.0001))
+ if line_count < 1:
+ edge_width = nozzle_size
+ line_count = 1
+ line_width = wall_thickness / line_count
+ line_width_alt = wall_thickness / (line_count + 1)
+ if line_width > nozzle_size * 1.5:
+ return line_width_alt, line_count + 1
+ if not edge_width:
+ edge_width = line_width
+ return edge_width, line_count
+
+ def calculate_solid_layer_count(self):
+ layer_height = self.get_float("layer_height")
+ solid_thickness = self.get_float("solid_layer_thickness")
+ if layer_height == 0.0:
+ return 1
+ import math
+ return int(math.ceil(solid_thickness / (layer_height - 0.0001)))
+
+ def calculate_minimal_extruder_count(self):
+ extruder_count = self.get("extruder_amount")
+ if extruder_count < 2:
+ return 1
+ if self.get("support") == SupportLocationTypes.NONE:
+ return 1
+ if self.get("support_dual_extrusion") == SupportDualTypes.SECOND:
+ return 2
+ return 1
+
+ def get_pos_x(self):
+ if self._posX:
+ try:
+ return int(float(self._posX) * 1000)
+ except ValueError:
+ pass
+
+ return int(self.get_float("machine_width") / 2.0 * 1000) if not self.get_boolean("machine_center_is_zero") else 0.0
+
+ def get_pos_y(self):
+ if self._posY:
+ try:
+ return int(float(self._posY) * 1000)
+ except ValueError:
+ pass
+
+ return int(self.get_float("machine_depth") / 2.0 * 1000) if not self.get_boolean("machine_center_is_zero") else 0.0
+
+ def convert_to_engine(self):
+
+ edge_width, line_count = self.calculate_edge_width_and_line_count()
+ solid_layer_count = self.calculate_solid_layer_count()
+
+ extruder_count = self.get_int("extruder_amount")
+ minimal_extruder_count = self.calculate_minimal_extruder_count()
+
+ settings = {
+ "layerThickness": self.get_microns("layer_height"),
+ "initialLayerThickness": self.get_microns("bottom_thickness") if self.get_float("bottom_thickness") > 0.0 else self.get_microns("layer_height"),
+ "filamentDiameter": self.get_microns("filament_diameter"),
+ "filamentFlow": self.get_int("filament_flow"),
+ "extrusionWidth": edge_width * 1000,
+ "layer0extrusionWidth": int(edge_width * self.get_float("first_layer_width_factor") / 100 * 1000),
+ "insetCount": line_count,
+ "downSkinCount": solid_layer_count if self.get_boolean("solid_bottom") else 0,
+ "upSkinCount": solid_layer_count if self.get_boolean("solid_top") else 0,
+ "infillOverlap": self.get_int("fill_overlap"),
+ "initialSpeedupLayers": int(4),
+ "initialLayerSpeed": self.get_int("bottom_layer_speed"),
+ "printSpeed": self.get_int("print_speed"),
+ "infillSpeed": self.get_int("infill_speed") if self.get_int("infill_speed") > 0 else self.get_int("print_speed"),
+ "inset0Speed": self.get_int("outer_shell_speed") if self.get_int("outer_shell_speed") > 0 else self.get_int("print_speed"),
+ "insetXSpeed": self.get_int("inner_shell_speed") if self.get_int("inner_shell_speed") > 0 else self.get_int("print_speed"),
+ "moveSpeed": self.get_int("travel_speed"),
+ "fanSpeedMin": self.get_int("fan_speed") if self.get_boolean("fan_enabled") else 0,
+ "fanSpeedMax": self.get_int("fan_speed_max") if self.get_boolean("fan_enabled") else 0,
+ "supportAngle": int(-1) if self.get("support") == SupportLocationTypes.NONE else self.get_int("support_angle"),
+ "supportEverywhere": int(1) if self.get("support") == SupportLocationTypes.EVERYWHERE else int(0),
+ "supportLineDistance": int(100 * edge_width * 1000 / self.get_float("support_fill_rate")) if self.get_float("support_fill_rate") > 0 else -1,
+ "supportXYDistance": int(1000 * self.get_float("support_xy_distance")),
+ "supportZDistance": int(1000 * self.get_float("support_z_distance")),
+ "supportExtruder": 0 if self.get("support_dual_extrusion") == SupportDualTypes.FIRST else (1 if self.get("support_dual_extrusion") == SupportDualTypes.SECOND and minimal_extruder_count > 1 else -1),
+ "retractionAmount": self.get_microns("retraction_amount") if self.get_boolean("retraction_enable") else 0,
+ "retractionSpeed": self.get_int("retraction_speed"),
+ "retractionMinimalDistance": self.get_microns("retraction_min_travel"),
+ "retractionAmountExtruderSwitch": self.get_microns("retraction_dual_amount"),
+ "retractionZHop": self.get_microns("retraction_hop"),
+ "minimalExtrusionBeforeRetraction": self.get_microns("retraction_minimal_extrusion"),
+ "enableCombing": 1 if self.get_boolean("retraction_combing") else 0,
+ "multiVolumeOverlap": self.get_microns("overlap_dual"),
+ "objectSink": max(0, self.get_microns("object_sink")),
+ "minimalLayerTime": self.get_int("cool_min_layer_time"),
+ "minimalFeedrate": self.get_int("cool_min_feedrate"),
+ "coolHeadLift": 1 if self.get_boolean("cool_head_lift") else 0,
+
+ # model positioning
+ "posx": self.get_pos_x(),
+ "posy": self.get_pos_y(),
+
+ # gcodes
+ "startCode": self.get_gcode("start_gcode"),
+ "endCode": self.get_gcode("end_gcode"),
+ "preSwitchExtruderCode": self.get_gcode("preSwitchExtruder_gcode"),
+ "postSwitchExtruderCode": self.get_gcode("postSwitchExtruder_gcode"),
+
+ # fixing
+ "fixHorrible": 0,
+ }
+
+ for extruder in range(1, extruder_count):
+ for axis in ("x", "y"):
+ settings["extruderOffset[{extruder}].{axis}".format(extruder=extruder, axis=axis.upper())] = self.get("extruder_offset_{axis}{extruder}".format(extruder=extruder, axis=axis.lower()))
+
+ fanFullHeight = self.get_microns("fan_full_height")
+ settings["fanFullOnLayerNr"] = (fanFullHeight - settings["initialLayerThickness"] - 1) / settings["layerThickness"] + 1
+ if settings["fanFullOnLayerNr"] < 0:
+ settings["fanFullOnLayerNr"] = 0
+
+ if self.get("support_type") == SupportTypes.LINES:
+ settings["supportType"] = 1
+
+ # infill
+ if self.get_float("fill_density") == 0:
+ settings["sparseInfillLineDistance"] = -1
+
+ elif self.get_float("fill_density") == 100:
+ settings["sparseInfillLineDistance"] = settings["extrusionWidth"]
+ settings["downSkinCount"] = 10000
+ settings["upSkinCount"] = 10000
+
+ else:
+ settings["sparseInfillLineDistance"] = int(100 * edge_width * 1000 / self.get_float("fill_density"))
+
+ # brim/raft/skirt
+ if self.get("platform_adhesion") == PlatformAdhesionTypes.BRIM:
+ settings["skirtDistance"] = 0
+ settings["skirtLineCount"] = self.get_int("brim_line_count")
+
+ elif self.get("platform_adhesion") == PlatformAdhesionTypes.RAFT:
+ settings["skirtDistance"] = 0
+ settings["skirtLineCount"] = 0
+ settings["raftMargin"] = self.get_microns("raft_margin")
+ settings["raftLineSpacing"] = self.get_microns("raft_line_spacing")
+ settings["raftBaseThickness"] = self.get_microns("raft_base_thickness")
+ settings["raftBaseLinewidth"] = self.get_microns("raft_base_linewidth")
+ settings["raftInterfaceThickness"] = self.get_microns("raft_interface_thickness")
+ settings["raftInterfaceLinewidth"] = self.get_microns("raft_interface_linewidth")
+ settings["raftInterfaceLineSpacing"] = self.get_microns("raft_interface_linewidth") * 2
+ settings["raftAirGapLayer0"] = self.get_microns("raft_airgap")
+ settings["raftBaseSpeed"] = self.get_int("bottom_layer_speed")
+ settings["raftFanSpeed"] = 100
+ settings["raftSurfaceThickness"] = settings["raftInterfaceThickness"]
+ settings["raftSurfaceLinewidth"] = int(edge_width * 1000)
+ settings["raftSurfaceLineSpacing"] = int(edge_width * 1000 * 0.9)
+ settings["raftSurfaceLayers"] = self.get_int("raft_surface_layers")
+ settings["raftSurfaceSpeed"] = self.get_int("bottom_layer_speed")
+
+ else:
+ settings["skirtDistance"] = self.get_microns("skirt_gap")
+ settings["skirtLineCount"] = self.get_int("skirt_line_count")
+ settings["skirtMinLength"] = self.get_microns("skirt_minimal_length")
+
+ # fixing
+ if self.get_boolean("fix_horrible_union_all_type_a"):
+ settings["fixHorrible"] |= 0x01
+ if self.get_boolean("fix_horrible_union_all_type_b"):
+ settings["fixHorrible"] |= 0x02
+ if self.get_boolean("fix_horrible_use_open_bits"):
+ settings["fixHorrible"] |= 0x10
+ if self.get_boolean("fix_horrible_extensive_stitching"):
+ settings["fixHorrible"] |= 0x04
+
+ if settings["layerThickness"] <= 0:
+ settings["layerThickness"] = 1000
+
+ # gcode flavor
+ if self.get("gcode_flavor") == GcodeFlavors.ULTIGCODE:
+ settings["gcodeFlavor"] = 1
+ elif self.get("gcode_flavor") == GcodeFlavors.MAKERBOT:
+ settings["gcodeFlavor"] = 2
+ elif self.get("gcode_flavor") == GcodeFlavors.BFB:
+ settings["gcodeFlavor"] = 3
+ elif self.get("gcode_flavor") == GcodeFlavors.MACH3:
+ settings["gcodeFlavor"] = 4
+ elif self.get("gcode_flavor") == GcodeFlavors.REPRAP_VOLUME:
+ settings["gcodeFlavor"] = 5
+
+ # extras
+ if self.get_boolean("spiralize"):
+ settings["spiralizeMode"] = 1
+ if self.get_boolean("follow_surface"):
+ settings["simpleMode"] = 1
+
+ # dual extrusion
+ if self.get_boolean("wipe_tower") and extruder_count > 1:
+ import math
+ settings["wipeTowerSize"] = int(math.sqrt(self.get_float("wipe_tower_volume") * 1000 * 1000 * 1000 / settings["layerThickness"]))
+ if self.get_boolean("ooze_shield"):
+ settings["enableOozeShield"] = 1
+
+ return settings
diff --git a/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/plugins/cura/profiles/default.profile.yaml b/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/plugins/cura/profiles/default.profile.yaml
new file mode 100644
index 000000000..d53fabc61
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/plugins/cura/profiles/default.profile.yaml
@@ -0,0 +1,4 @@
+layer_height: 0.2
+print_temperature:
+- 220.0
+- 220.0
\ No newline at end of file
diff --git a/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/plugins/cura/static/css/cura.css b/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/plugins/cura/static/css/cura.css
new file mode 100644
index 000000000..f35eab40a
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/plugins/cura/static/css/cura.css
@@ -0,0 +1 @@
+table th.settings_plugin_cura_profiles_key,table td.settings_plugin_cura_profiles_key{text-overflow:ellipsis;text-align:left;width:200px}table th.settings_plugin_cura_profiles_name,table td.settings_plugin_cura_profiles_name{text-overflow:ellipsis;text-align:left}table th.settings_plugin_cura_profiles_actions,table td.settings_plugin_cura_profiles_actions{text-align:center;width:100px}table th.settings_plugin_cura_profiles_actions a,table td.settings_plugin_cura_profiles_actions a{text-decoration:none;color:#000}table th.settings_plugin_cura_profiles_actions a.disabled,table td.settings_plugin_cura_profiles_actions a.disabled{color:#ccc;cursor:default}
\ No newline at end of file
diff --git a/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/plugins/cura/static/js/cura.js b/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/plugins/cura/static/js/cura.js
new file mode 100644
index 000000000..23068292c
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/plugins/cura/static/js/cura.js
@@ -0,0 +1,195 @@
+$(function() {
+ function CuraViewModel(parameters) {
+ var self = this;
+
+ self.loginState = parameters[0];
+ self.settingsViewModel = parameters[1];
+ self.slicingViewModel = parameters[2];
+
+ self.fileName = ko.observable();
+
+ self.placeholderName = ko.observable();
+ self.placeholderDisplayName = ko.observable();
+ self.placeholderDescription = ko.observable();
+
+ self.profileName = ko.observable();
+ self.profileDisplayName = ko.observable();
+ self.profileDescription = ko.observable();
+ self.profileAllowOverwrite = ko.observable(true);
+
+ self.uploadElement = $("#settings-cura-import");
+ self.uploadButton = $("#settings-cura-import-start");
+
+ self.profiles = new ItemListHelper(
+ "plugin_cura_profiles",
+ {
+ "id": function(a, b) {
+ if (a["key"].toLocaleLowerCase() < b["key"].toLocaleLowerCase()) return -1;
+ if (a["key"].toLocaleLowerCase() > b["key"].toLocaleLowerCase()) return 1;
+ return 0;
+ },
+ "name": function(a, b) {
+ // sorts ascending
+ var aName = a.name();
+ if (aName === undefined) {
+ aName = "";
+ }
+ var bName = b.name();
+ if (bName === undefined) {
+ bName = "";
+ }
+
+ if (aName.toLocaleLowerCase() < bName.toLocaleLowerCase()) return -1;
+ if (aName.toLocaleLowerCase() > bName.toLocaleLowerCase()) return 1;
+ return 0;
+ }
+ },
+ {},
+ "id",
+ [],
+ [],
+ 5
+ );
+
+ self._sanitize = function(name) {
+ return name.replace(/[^a-zA-Z0-9\-_\.\(\) ]/g, "").replace(/ /g, "_");
+ };
+
+ self.uploadElement.fileupload({
+ dataType: "json",
+ maxNumberOfFiles: 1,
+ autoUpload: false,
+ add: function(e, data) {
+ if (data.files.length == 0) {
+ return false;
+ }
+
+ self.fileName(data.files[0].name);
+
+ var name = self.fileName().substr(0, self.fileName().lastIndexOf("."));
+ self.placeholderName(self._sanitize(name).toLowerCase());
+ self.placeholderDisplayName(name);
+ self.placeholderDescription("Imported from " + self.fileName() + " on " + formatDate(new Date().getTime() / 1000));
+
+ self.uploadButton.unbind("click");
+ self.uploadButton.on("click", function() {
+ var form = {
+ allowOverwrite: self.profileAllowOverwrite()
+ };
+
+ if (self.profileName() !== undefined) {
+ form["name"] = self.profileName();
+ }
+ if (self.profileDisplayName() !== undefined) {
+ form["displayName"] = self.profileDisplayName();
+ }
+ if (self.profileDescription() !== undefined) {
+ form["description"] = self.profileDescription();
+ }
+
+ data.formData = form;
+ data.submit();
+ });
+ },
+ done: function(e, data) {
+ self.fileName(undefined);
+ self.placeholderName(undefined);
+ self.placeholderDisplayName(undefined);
+ self.placeholderDescription(undefined);
+ self.profileName(undefined);
+ self.profileDisplayName(undefined);
+ self.profileDescription(undefined);
+ self.profileAllowOverwrite(true);
+
+ $("#settings_plugin_cura_import").modal("hide");
+ self.requestData();
+ self.slicingViewModel.requestData();
+ }
+ });
+
+ self.removeProfile = function(data) {
+ if (!data.resource) {
+ return;
+ }
+
+ self.profiles.removeItem(function(item) {
+ return (item.key == data.key);
+ });
+
+ $.ajax({
+ url: data.resource(),
+ type: "DELETE",
+ success: function() {
+ self.requestData();
+ self.slicingViewModel.requestData();
+ }
+ });
+ };
+
+ self.makeProfileDefault = function(data) {
+ if (!data.resource) {
+ return;
+ }
+
+ _.each(self.profiles.items(), function(item) {
+ item.isdefault(false);
+ });
+ var item = self.profiles.getItem(function(item) {
+ return item.key == data.key;
+ });
+ if (item !== undefined) {
+ item.isdefault(true);
+ }
+
+ $.ajax({
+ url: data.resource(),
+ type: "PATCH",
+ dataType: "json",
+ data: JSON.stringify({default: true}),
+ contentType: "application/json; charset=UTF-8",
+ success: function() {
+ self.requestData();
+ }
+ });
+ };
+
+ self.showImportProfileDialog = function() {
+ $("#settings_plugin_cura_import").modal("show");
+ };
+
+ self.requestData = function() {
+ $.ajax({
+ url: API_BASEURL + "slicing/cura/profiles",
+ type: "GET",
+ dataType: "json",
+ success: self.fromResponse
+ });
+ };
+
+ self.fromResponse = function(data) {
+ var profiles = [];
+ _.each(_.keys(data), function(key) {
+ profiles.push({
+ key: key,
+ name: ko.observable(data[key].displayName),
+ description: ko.observable(data[key].description),
+ isdefault: ko.observable(data[key].default),
+ resource: ko.observable(data[key].resource)
+ });
+ });
+ self.profiles.updateItems(profiles);
+ };
+
+ self.onBeforeBinding = function () {
+ self.settings = self.settingsViewModel.settings;
+ self.requestData();
+ };
+ }
+
+ // view model class, parameters for constructor, container to bind to
+ OCTOPRINT_VIEWMODELS.push([
+ CuraViewModel,
+ ["loginStateViewModel", "settingsViewModel", "slicingViewModel"],
+ "#settings_plugin_cura"
+ ]);
+});
\ No newline at end of file
diff --git a/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/plugins/cura/static/less/cura.less b/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/plugins/cura/static/less/cura.less
new file mode 100644
index 000000000..0d28da219
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/plugins/cura/static/less/cura.less
@@ -0,0 +1,29 @@
+table {
+ th, td {
+ &.settings_plugin_cura_profiles_key {
+ text-overflow: ellipsis;
+ text-align: left;
+ width: 200px;
+ }
+
+ &.settings_plugin_cura_profiles_name {
+ text-overflow: ellipsis;
+ text-align: left;
+ }
+
+ &.settings_plugin_cura_profiles_actions {
+ text-align: center;
+ width: 100px;
+
+ a {
+ text-decoration: none;
+ color: #000;
+
+ &.disabled {
+ color: #ccc;
+ cursor: default;
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/plugins/cura/templates/cura_settings.jinja2 b/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/plugins/cura/templates/cura_settings.jinja2
new file mode 100644
index 000000000..92cfe0ae0
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/plugins/cura/templates/cura_settings.jinja2
@@ -0,0 +1,125 @@
+
{{ _('General') }}
+
+
{% trans %}
+ Specify the path to the CuraEngine binary. Note that only
+ versions up to and including 15.04 are supported.
+ CuraEngine version 15.06 or newer is not
+ compatible with this plugin.
+{% endtrans %}
+
+
+ {% trans %}
+ You can import your existing profile .ini files from Cura (version up to and
+ including 15.04) here. Please be aware that neither the .json profile format
+ from Cura versions starting with 15.06 is supported, nor are the custom Cura profile formats
+ that third party tools like e.g. Repetier create.
+ {% endtrans %}
+
+
+
+
diff --git a/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/plugins/discovery/__init__.py b/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/plugins/discovery/__init__.py
new file mode 100644
index 000000000..4732ce19b
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/plugins/discovery/__init__.py
@@ -0,0 +1,683 @@
+# coding=utf-8
+from __future__ import absolute_import
+
+__author__ = "Gina Häußge "
+__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
+__copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms of the AGPLv3 License"
+
+"""
+The SSDP/UPNP implementations has been largely inspired by https://gist.github.com/schlamar/2428250
+"""
+
+import logging
+import os
+import flask
+
+import octoprint.plugin
+import octoprint.util
+
+try:
+ import pybonjour
+except:
+ pybonjour = False
+
+
+__plugin_name__ = "Discovery"
+__plugin_author__ = "Gina Häußge"
+__plugin_url__ = "https://github.com/foosel/OctoPrint/wiki/Plugin:-Discovery"
+__plugin_description__ = "Makes the OctoPrint instance discoverable via Bonjour/Avahi/Zeroconf and uPnP"
+__plugin_license__ = "AGPLv3"
+
+def __plugin_load__():
+ if not pybonjour:
+ # no pybonjour available, we can't use that
+ logging.getLogger("octoprint.plugins." + __name__).info("pybonjour is not installed, Zeroconf Discovery won't be available")
+
+ plugin = DiscoveryPlugin()
+
+ global __plugin_implementation__
+ __plugin_implementation__ = plugin
+
+ global __plugin_helpers__
+ __plugin_helpers__ = dict(
+ ssdp_browse=plugin.ssdp_browse
+ )
+ if pybonjour:
+ __plugin_helpers__.update(dict(
+ zeroconf_browse=plugin.zeroconf_browse,
+ zeroconf_register=plugin.zeroconf_register,
+ zeroconf_unregister=plugin.zeroconf_unregister
+ ))
+
+class DiscoveryPlugin(octoprint.plugin.StartupPlugin,
+ octoprint.plugin.ShutdownPlugin,
+ octoprint.plugin.BlueprintPlugin,
+ octoprint.plugin.SettingsPlugin):
+
+ ssdp_multicast_addr = "239.255.255.250"
+
+ ssdp_multicast_port = 1900
+
+ def __init__(self):
+ self.host = None
+ self.port = None
+
+ # zeroconf
+ self._sd_refs = dict()
+ self._cnames = dict()
+
+ # upnp/ssdp
+ self._ssdp_monitor_active = False
+ self._ssdp_monitor_thread = None
+ self._ssdp_notify_timeout = 10
+ self._ssdp_last_notify = 0
+
+ ##~~ SettingsPlugin API
+
+ def get_settings_defaults(self):
+ return {
+ "publicHost": None,
+ "publicPort": None,
+ "pathPrefix": None,
+ "httpUsername": None,
+ "httpPassword": None,
+ "upnpUuid": None,
+ "zeroConf": [],
+ "model": {
+ "name": None,
+ "description": None,
+ "number": None,
+ "url": None,
+ "serial": None,
+ "vendor": None,
+ "vendorUrl": None
+ }
+ }
+
+ ##~~ BlueprintPlugin API -- used for providing the SSDP device descriptor XML
+
+ @octoprint.plugin.BlueprintPlugin.route("/discovery.xml", methods=["GET"])
+ def discovery(self):
+ self._logger.debug("Rendering discovery.xml")
+
+ modelName = self._settings.get(["model", "name"])
+ if not modelName:
+ import octoprint.server
+ modelName = octoprint.server.DISPLAY_VERSION
+
+ vendor = self._settings.get(["model", "vendor"])
+ vendorUrl = self._settings.get(["model", "vendorUrl"])
+ if not vendor:
+ vendor = "The OctoPrint Project"
+ vendorUrl = "http://www.octoprint.org/"
+
+ response = flask.make_response(flask.render_template("discovery.xml.jinja2",
+ friendlyName=self.get_instance_name(),
+ manufacturer=vendor,
+ manufacturerUrl=vendorUrl,
+ modelName=modelName,
+ modelDescription=self._settings.get(["model", "description"]),
+ modelNumber=self._settings.get(["model", "number"]),
+ modelUrl=self._settings.get(["model", "url"]),
+ serialNumber=self._settings.get(["model", "serial"]),
+ uuid=self.get_uuid(),
+ presentationUrl=flask.url_for("index", _external=True)))
+ response.headers['Content-Type'] = 'application/xml'
+ return response
+
+ def is_blueprint_protected(self):
+ return False
+
+ ##~~ StartupPlugin API -- used for registering OctoPrint's Zeroconf and SSDP services upon application startup
+
+ def on_startup(self, host, port):
+ public_host = self._settings.get(["publicHost"])
+ if public_host:
+ host = public_host
+ public_port = self._settings.get(["publicPort"])
+ if public_port:
+ port = public_port
+
+ self.host = host
+ self.port = port
+
+ # Zeroconf
+ self.zeroconf_register("_http._tcp", self.get_instance_name(), txt_record=self._create_http_txt_record_dict())
+ self.zeroconf_register("_octoprint._tcp", self.get_instance_name(), txt_record=self._create_octoprint_txt_record_dict())
+ for zeroconf in self._settings.get(["zeroConf"]):
+ if "service" in zeroconf:
+ self.zeroconf_register(
+ zeroconf["service"],
+ zeroconf["name"] if "name" in zeroconf else self.get_instance_name(),
+ port=zeroconf["port"] if "port" in zeroconf else None,
+ txt_record=zeroconf["txtRecord"] if "txtRecord" in zeroconf else None
+ )
+
+ # SSDP
+ self._ssdp_register()
+
+ ##~~ ShutdownPlugin API -- used for unregistering OctoPrint's Zeroconf and SSDP service upon application shutdown
+
+ def on_shutdown(self):
+ for key in self._sd_refs:
+ reg_type, port = key
+ self.zeroconf_unregister(reg_type, port)
+
+ self._ssdp_unregister()
+
+ ##~~ helpers
+
+ # ZeroConf
+
+ def zeroconf_register(self, reg_type, name=None, port=None, txt_record=None):
+ """
+ Registers a new service with Zeroconf/Bonjour/Avahi.
+
+ :param reg_type: type of service to register, e.g. "_gntp._tcp"
+ :param name: displayable name of the service, if not given defaults to the OctoPrint instance name
+ :param port: port to register for the service, if not given defaults to OctoPrint's (public) port
+ :param txt_record: optional txt record to attach to the service, dictionary of key-value-pairs
+ """
+
+ if not pybonjour:
+ return
+
+ if not name:
+ name = self.get_instance_name()
+ if not port:
+ port = self.port
+
+ params = dict(
+ name=name,
+ regtype=reg_type,
+ port=port
+ )
+ if txt_record:
+ params["txtRecord"] = pybonjour.TXTRecord(txt_record)
+
+ key = (reg_type, port)
+ self._sd_refs[key] = pybonjour.DNSServiceRegister(**params)
+ self._logger.info(u"Registered {name} for {reg_type}".format(**locals()))
+
+ def zeroconf_unregister(self, reg_type, port=None):
+ """
+ Unregisteres a previously registered Zeroconf/Bonjour/Avahi service identified by service and port.
+
+ :param reg_type: the type of the service to be unregistered
+ :param port: the port of the service to be unregistered, defaults to OctoPrint's (public) port if not given
+ :return:
+ """
+
+ if not pybonjour:
+ return
+
+ if not port:
+ port = self.port
+
+ key = (reg_type, port)
+ if not key in self._sd_refs:
+ return
+
+ sd_ref = self._sd_refs[key]
+ try:
+ sd_ref.close()
+ self._logger.debug("Unregistered {reg_type} on port {port}".format(reg_type=reg_type, port=port))
+ except:
+ self._logger.exception("Could not unregister {reg_type} on port {port}".format(reg_type=reg_type, port=port))
+
+ def zeroconf_browse(self, service_type, block=True, callback=None, browse_timeout=5, resolve_timeout=5):
+ """
+ Browses for services on the local network providing the specified service type. Can be used either blocking or
+ non-blocking.
+
+ The non-blocking version (default behaviour) will not return until the lookup has completed and
+ return all results that were found.
+
+ For non-blocking version, set `block` to `False` and provide a `callback` to be called once the lookup completes.
+ If no callback is provided in non-blocking mode, a ValueError will be raised.
+
+ The results are provided as a list of discovered services, with each service being described by a dictionary
+ with the following keys:
+
+ * `name`: display name of the service
+ * `host`: host name of the service
+ * `post`: port the service is listening on
+ * `txt_record`: TXT record of the service as a dictionary, exact contents depend on the service
+
+ Callbacks will be called with that list as the single parameter supplied to them. Thus, the following is an
+ example for a valid callback:
+
+ def browse_callback(results):
+ for result in results:
+ print "Name: {name}, Host: {host}, Port: {port}, TXT: {txt_record!r}".format(**result)
+
+ :param service_type: the service type to browse for
+ :param block: whether to block, defaults to True
+ :param callback: callback to call once lookup has completed, must be set when `block` is set to `False`
+ :param browse_timeout: timeout for browsing operation
+ :param resolve_timeout: timeout for resolving operations for discovered records
+ :return: if `block` is `True` a list of the discovered services, an empty list otherwise (results will then be
+ supplied to the callback instead)
+ """
+
+ if not pybonjour:
+ return None
+
+ import threading
+ import select
+
+ if not block and not callback:
+ raise ValueError("Non-blocking mode but no callback given")
+
+ result = []
+ result_available = threading.Event()
+ result_available.clear()
+
+ resolved = []
+
+ def resolve_callback(sd_ref, flags, interface_index, error_code, fullname, hosttarget, port, txt_record):
+ if error_code == pybonjour.kDNSServiceErr_NoError:
+ txt_record_dict = None
+ if txt_record:
+ record = pybonjour.TXTRecord.parse(txt_record)
+ txt_record_dict = dict()
+ for key, value in record:
+ txt_record_dict[key] = value
+
+ name = fullname[:fullname.find(service_type) - 1].replace("\\032", " ")
+ host = hosttarget[:-1]
+
+ self._logger.debug("Resolved a result for Zeroconf resolution of {service_type}: {name} @ {host}".format(service_type=service_type, name=name, host=host))
+ result.append(dict(
+ name=name,
+ host=host,
+ port=port,
+ txt_record=txt_record_dict
+ ))
+ resolved.append(True)
+
+ def browse_callback(sd_ref, flags, interface_index, error_code, service_name, regtype, reply_domain):
+ if error_code != pybonjour.kDNSServiceErr_NoError:
+ return
+
+ if not (flags & pybonjour.kDNSServiceFlagsAdd):
+ return
+
+ self._logger.debug("Got a browsing result for Zeroconf resolution of {service_type}, resolving...".format(service_type=service_type))
+ resolve_ref = pybonjour.DNSServiceResolve(0, interface_index, service_name, regtype, reply_domain, resolve_callback)
+
+ try:
+ while not resolved:
+ ready = select.select([resolve_ref], [], [], resolve_timeout)
+ if resolve_ref not in ready[0]:
+ break
+
+ pybonjour.DNSServiceProcessResult(resolve_ref)
+ else:
+ resolved.pop()
+ finally:
+ resolve_ref.close()
+
+ self._logger.debug("Browsing Zeroconf for {service_type}".format(service_type=service_type))
+
+ def browse():
+ sd_ref = pybonjour.DNSServiceBrowse(regtype=service_type, callBack=browse_callback)
+ try:
+ while True:
+ ready = select.select([sd_ref], [], [], browse_timeout)
+
+ if not ready[0]:
+ break
+
+ if sd_ref in ready[0]:
+ pybonjour.DNSServiceProcessResult(sd_ref)
+ finally:
+ sd_ref.close()
+
+ if callback:
+ callback(result)
+ result_available.set()
+
+ browse_thread = threading.Thread(target=browse)
+ browse_thread.daemon = True
+ browse_thread.start()
+
+ if block:
+ result_available.wait()
+ return result
+ else:
+ return []
+
+ # SSDP/UPNP
+
+ def ssdp_browse(self, query, block=True, callback=None, timeout=1, retries=5):
+ """
+ Browses for UPNP services matching the supplied query. Can be used either blocking or
+ non-blocking.
+
+ The non-blocking version (default behaviour) will not return until the lookup has completed and
+ return all results that were found.
+
+ For non-blocking version, set `block` to `False` and provide a `callback` to be called once the lookup completes.
+ If no callback is provided in non-blocking mode, a ValueError will be raised.
+
+ The results are provided as a list of discovered locations of device descriptor files.
+
+ Callbacks will be called with that list as the single parameter supplied to them. Thus, the following is an
+ example for a valid callback:
+
+ def browse_callback(results):
+ for result in results:
+ print "Location: {}".format(result)
+
+ :param query: the SSDP query to send, e.g. "upnp:rootdevice" to search for all devices
+ :param block: whether to block, defaults to True
+ :param callback: callback to call in non-blocking mode when lookup has finished, must be set if block is False
+ :param timeout: timeout in seconds to wait for replies to the M-SEARCH query per interface, defaults to 1
+ :param retries: number of retries to perform the lookup on all interfaces, defaults to 5
+ :return: if `block` is `True` a list of the discovered devices, an empty list otherwise (results will then be
+ supplied to the callback instead)
+ """
+
+ import threading
+
+ import httplib
+ import io
+ class Response(httplib.HTTPResponse):
+ def __init__(self, response_text):
+ self.fp = io.BytesIO(response_text)
+ self.debuglevel = 0
+ self.strict = 0
+ self.msg = None
+ self._method = None
+ self.begin()
+
+ result = []
+ result_available = threading.Event()
+ result_available.clear()
+
+ def browse():
+ import socket
+
+ socket.setdefaulttimeout(timeout)
+
+ search_message = "".join([
+ "M-SEARCH * HTTP/1.1\r\n",
+ "ST: {query}\r\n",
+ "MX: 3\r\n",
+ "MAN: \"ssdp:discovery\"\r\n",
+ "HOST: {mcast_addr}:{mcast_port}\r\n\r\n"
+ ])
+
+ for _ in xrange(retries):
+ for addr in octoprint.util.interface_addresses():
+ try:
+ sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP)
+ sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
+ sock.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_TTL, 2)
+ sock.bind((addr, 0))
+
+ message = search_message.format(query=query,
+ mcast_addr=self.__class__.ssdp_multicast_addr,
+ mcast_port=self.__class__.ssdp_multicast_port)
+ for _ in xrange(2):
+ sock.sendto(message, (self.__class__.ssdp_multicast_addr, self.__class__.ssdp_multicast_port))
+
+ try:
+ data = sock.recv(1024)
+ except socket.timeout:
+ pass
+ else:
+ response = Response(data)
+
+ result.append(response.getheader("Location"))
+ except:
+ pass
+
+ if callback:
+ callback(result)
+ result_available.set()
+
+ browse_thread = threading.Thread(target=browse)
+ browse_thread.daemon = True
+ browse_thread.start()
+
+ if block:
+ result_available.wait()
+ return result
+ else:
+ return []
+
+ ##~~ internals
+
+ # Zeroconf
+
+ def _create_http_txt_record_dict(self):
+ """
+ Creates a TXT record for the _http._tcp Zeroconf service supplied by this OctoPrint instance.
+
+ Defines the keys for _http._tcp as defined in http://www.dns-sd.org/txtrecords.html
+
+ :return: a dictionary containing the defined key-value-pairs, ready to be turned into a TXT record
+ """
+
+ # determine path entry
+ path = "/"
+ if self._settings.get(["pathPrefix"]):
+ path = self._settings.get(["pathPrefix"])
+ else:
+ prefix = self._settings.global_get(["server", "reverseProxy", "prefixFallback"])
+ if prefix:
+ path = prefix
+
+ # fetch username and password (if set)
+ username = self._settings.get(["httpUsername"])
+ password = self._settings.get(["httpPassword"])
+
+ entries = dict(
+ path=path
+ )
+
+ if username and password:
+ entries.update(dict(u=username, p=password))
+
+ return entries
+
+ def _create_octoprint_txt_record_dict(self):
+ """
+ Creates a TXT record for the _octoprint._tcp Zeroconf service supplied by this OctoPrint instance.
+
+ The following keys are defined:
+
+ * `path`: path prefix to actual OctoPrint instance, inherited from _http._tcp
+ * `u`: username if HTTP Basic Auth is used, optional, inherited from _http._tcp
+ * `p`: password if HTTP Basic Auth is used, optional, inherited from _http._tcp
+ * `version`: OctoPrint software version
+ * `api`: OctoPrint API version
+ * `model`: Model of the device that is running OctoPrint
+ * `vendor`: Vendor of the device that is running OctoPrint
+
+ :return: a dictionary containing the defined key-value-pairs, ready to be turned into a TXT record
+ """
+
+ entries = self._create_http_txt_record_dict()
+
+ import octoprint.server
+ import octoprint.server.api
+
+ entries.update(dict(
+ version=octoprint.server.VERSION,
+ api=octoprint.server.api.VERSION,
+ ))
+
+ modelName = self._settings.get(["model", "name"])
+ if modelName:
+ entries.update(dict(model=modelName))
+ vendor = self._settings.get(["model", "vendor"])
+ if vendor:
+ entries.update(dict(vendor=vendor))
+
+ return entries
+
+ # SSDP/UPNP
+
+ def _ssdp_register(self):
+ """
+ Registers the OctoPrint instance as basic service with a presentation URL pointing to the web interface
+ """
+
+ import threading
+
+ self._ssdp_monitor_active = True
+
+ self._ssdp_monitor_thread = threading.Thread(target=self._ssdp_monitor, kwargs=dict(timeout=self._ssdp_notify_timeout))
+ self._ssdp_monitor_thread.daemon = True
+ self._ssdp_monitor_thread.start()
+
+ def _ssdp_unregister(self):
+ """
+ Unregisters the OctoPrint instance again
+ """
+
+ self._ssdp_monitor_active = False
+ if self.host and self.port:
+ for _ in xrange(2):
+ self._ssdp_notify(alive=False)
+
+ def _ssdp_notify(self, alive=True):
+ """
+ Sends an SSDP notify message across the connected networks.
+
+ :param alive: True to send an "ssdp:alive" message, False to send an "ssdp:byebye" message
+ """
+
+ import socket
+ import time
+
+ if alive and self._ssdp_last_notify + self._ssdp_notify_timeout > time.time():
+ # we just sent an alive, no need to send another one now
+ return
+
+ if alive and not self._ssdp_monitor_active:
+ # the monitor already shut down, alive messages don't make sense anymore as byebye will shortly follow
+ return
+
+ for addr in octoprint.util.interface_addresses():
+ try:
+ sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP)
+ sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
+ sock.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_TTL, 2)
+ sock.bind((addr, 0))
+
+ location = "http://{addr}:{port}/plugin/discovery/discovery.xml".format(addr=addr, port=self.port)
+
+ self._logger.debug("Sending NOTIFY {} via {}".format("alive" if alive else "byebye", addr))
+ notify_message = "".join([
+ "NOTIFY * HTTP/1.1\r\n",
+ "Server: Python/2.7\r\n",
+ "Cache-Control: max-age=900\r\n",
+ "Location: {location}\r\n",
+ "NTS: {nts}\r\n",
+ "NT: upnp:rootdevice\r\n",
+ "USN: uuid:{uuid}::upnp:rootdevice\r\n",
+ "HOST: {mcast_addr}:{mcast_port}\r\n\r\n"
+ ])
+ message = notify_message.format(uuid=self.get_uuid(),
+ location=location,
+ nts="ssdp:alive" if alive else "ssdp:byebye",
+ mcast_addr=self.__class__.ssdp_multicast_addr,
+ mcast_port=self.__class__.ssdp_multicast_port)
+ for _ in xrange(2):
+ # send twice, stuff might get lost, it's only UDP
+ sock.sendto(message, (self.__class__.ssdp_multicast_addr, self.__class__.ssdp_multicast_port))
+ except:
+ pass
+
+ self._ssdp_last_notify = time.time()
+
+ def _ssdp_monitor(self, timeout=5):
+ """
+ Monitor thread that listens on the multicast address for M-SEARCH requests and answers them if they are relevant
+
+ :param timeout: timeout after which to stop waiting for M-SEARCHs for a short while in order to put out an
+ alive message
+ """
+
+ from BaseHTTPServer import BaseHTTPRequestHandler
+ from StringIO import StringIO
+ import socket
+
+ socket.setdefaulttimeout(timeout)
+
+ location_message = "".join([
+ "HTTP/1.1 200 OK\r\n",
+ "ST: upnp:rootdevice\r\n",
+ "USN: uuid:{uuid}::upnp:rootdevice\r\n",
+ "Location: {location}\r\n",
+ "Cache-Control: max-age=60\r\n\r\n"
+ ])
+
+ class Request(BaseHTTPRequestHandler):
+
+ def __init__(self, request_text):
+ self.rfile = StringIO(request_text)
+ self.raw_requestline = self.rfile.readline()
+ self.error_code = self.error_message = None
+ self.parse_request()
+
+ def send_error(self, code, message=None):
+ self.error_code = code
+ self.error_message = message
+
+ sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP)
+ sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
+ sock.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_TTL, 2)
+ sock.bind(('', self.__class__.ssdp_multicast_port))
+
+ sock.setsockopt(socket.IPPROTO_IP, socket.IP_ADD_MEMBERSHIP, socket.inet_aton(self.__class__.ssdp_multicast_addr) + socket.inet_aton('0.0.0.0'))
+
+ self._logger.info(u"Registered {} for SSDP".format(self.get_instance_name()))
+
+ self._ssdp_notify(alive=True)
+
+ try:
+ while (self._ssdp_monitor_active):
+ try:
+ data, address = sock.recvfrom(4096)
+ request = Request(data)
+ if not request.error_code and request.command == "M-SEARCH" and request.path == "*" and (request.headers["ST"] == "upnp:rootdevice" or request.headers["ST"] == "ssdp:all") and request.headers["MAN"] == '"ssdp:discover"':
+ interface_address = octoprint.util.address_for_client(*address)
+ if not interface_address:
+ self._logger.warn("Can't determine address to user for client {}, not sending a M-SEARCH reply".format(address))
+ continue
+ message = location_message.format(uuid=self.get_uuid(), location="http://{host}:{port}/plugin/discovery/discovery.xml".format(host=interface_address, port=self.port))
+ sock.sendto(message, address)
+ self._logger.debug("Sent M-SEARCH reply for {path} and {st} to {address!r}".format(path=request.path, st=request.headers["ST"], address=address))
+ except socket.timeout:
+ pass
+ finally:
+ self._ssdp_notify(alive=True)
+ finally:
+ try:
+ sock.close()
+ except:
+ pass
+
+ ##~~ helpers
+
+ def get_uuid(self):
+ upnpUuid = self._settings.get(["upnpUuid"])
+ if upnpUuid is None:
+ import uuid
+ upnpUuid = str(uuid.uuid4())
+ self._settings.set(["upnpUuid"], upnpUuid)
+ self._settings.save()
+ return upnpUuid
+
+ def get_instance_name(self):
+ name = self._settings.global_get(["appearance", "name"])
+ if name:
+ return u"OctoPrint instance \"{}\"".format(name)
+ else:
+ import socket
+ return u"OctoPrint instance on {}".format(socket.gethostname())
diff --git a/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/plugins/discovery/templates/discovery.xml.jinja2 b/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/plugins/discovery/templates/discovery.xml.jinja2
new file mode 100644
index 000000000..413c84f7a
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/plugins/discovery/templates/discovery.xml.jinja2
@@ -0,0 +1,22 @@
+
+
+
+ 1
+ 0
+
+
+ urn:schemas-upnp-org:device:Basic:1
+ {{ friendlyName }}
+ {{ manufacturer }}
+ {% if manufacturerUrl %}{{ manufacturerUrl }}{% endif %}
+ {{ modelName }}
+ {% if modelDescription %}{{ modelDescription }}{% endif %}
+ {% if modelNumber %}{{ modelNumber }}{% endif %}
+ {% if modelUrl %}{{ modelUrl }}{% endif %}
+ {% if serialNumber %}{{ serialNumber }}{% endif %}
+ uuid:{{ uuid }}
+
+
+ {{ presentationUrl }}
+
+
\ No newline at end of file
diff --git a/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/plugins/pluginmanager/__init__.py b/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/plugins/pluginmanager/__init__.py
new file mode 100644
index 000000000..0c40562a1
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/plugins/pluginmanager/__init__.py
@@ -0,0 +1,649 @@
+# coding=utf-8
+from __future__ import absolute_import
+
+__author__ = "Gina Häußge "
+__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
+__copyright__ = "Copyright (C) 2015 The OctoPrint Project - Released under terms of the AGPLv3 License"
+
+
+import octoprint.plugin
+import octoprint.plugin.core
+
+from octoprint.settings import valid_boolean_trues
+from octoprint.server.util.flask import restricted_access
+from octoprint.server import admin_permission
+from octoprint.util.pip import PipCaller, UnknownPip
+
+from flask import jsonify, make_response
+from flask.ext.babel import gettext
+
+import logging
+import sarge
+import sys
+import requests
+import re
+import os
+import pkg_resources
+
+class PluginManagerPlugin(octoprint.plugin.SimpleApiPlugin,
+ octoprint.plugin.TemplatePlugin,
+ octoprint.plugin.AssetPlugin,
+ octoprint.plugin.SettingsPlugin,
+ octoprint.plugin.StartupPlugin,
+ octoprint.plugin.BlueprintPlugin):
+
+ def __init__(self):
+ self._pending_enable = set()
+ self._pending_disable = set()
+ self._pending_install = set()
+ self._pending_uninstall = set()
+
+ self._pip_caller = None
+ self._pip_version_dependency_links = pkg_resources.parse_version("1.5")
+
+ self._repository_available = False
+ self._repository_plugins = []
+ self._repository_cache_path = None
+ self._repository_cache_ttl = 0
+
+ def initialize(self):
+ self._console_logger = logging.getLogger("octoprint.plugins.pluginmanager.console")
+ self._repository_cache_path = os.path.join(self.get_plugin_data_folder(), "plugins.json")
+ self._repository_cache_ttl = self._settings.get_int(["repository_ttl"]) * 60
+
+ self._pip_caller = PipCaller(configured=self._settings.get(["pip"]))
+ self._pip_caller.on_log_call = self._log_call
+ self._pip_caller.on_log_stdout = self._log_stdout
+ self._pip_caller.on_log_stderr = self._log_stderr
+
+ ##~~ Body size hook
+
+ def increase_upload_bodysize(self, current_max_body_sizes, *args, **kwargs):
+ # set a maximum body size of 50 MB for plugin archive uploads
+ return [("POST", r"/upload_archive", 50 * 1024 * 1024)]
+
+ ##~~ StartupPlugin
+
+ def on_startup(self, host, port):
+ console_logging_handler = logging.handlers.RotatingFileHandler(self._settings.get_plugin_logfile_path(postfix="console"), maxBytes=2*1024*1024)
+ console_logging_handler.setFormatter(logging.Formatter("%(asctime)s %(message)s"))
+ console_logging_handler.setLevel(logging.DEBUG)
+
+ self._console_logger.addHandler(console_logging_handler)
+ self._console_logger.setLevel(logging.DEBUG)
+ self._console_logger.propagate = False
+
+ self._repository_available = self._fetch_repository_from_disk()
+
+ ##~~ SettingsPlugin
+
+ def get_settings_defaults(self):
+ return dict(
+ repository="http://plugins.octoprint.org/plugins.json",
+ repository_ttl=24*60,
+ pip=None,
+ pip_args=None,
+ dependency_links=False,
+ hidden=[]
+ )
+
+ def on_settings_save(self, data):
+ old_pip = self._settings.get(["pip"])
+ octoprint.plugin.SettingsPlugin.on_settings_save(self, data)
+ new_pip = self._settings.get(["pip"])
+
+ self._repository_cache_ttl = self._settings.get_int(["repository_ttl"]) * 60
+ if old_pip != new_pip:
+ self._pip_caller.configured = new_pip
+ try:
+ self._pip_caller.trigger_refresh()
+ except:
+ self._pip_caller
+
+ ##~~ AssetPlugin
+
+ def get_assets(self):
+ return dict(
+ js=["js/pluginmanager.js"],
+ css=["css/pluginmanager.css"],
+ less=["less/pluginmanager.less"]
+ )
+
+ ##~~ TemplatePlugin
+
+ def get_template_configs(self):
+ return [
+ dict(type="settings", name=gettext("Plugin Manager"), template="pluginmanager_settings.jinja2", custom_bindings=True)
+ ]
+
+ ##~~ BlueprintPlugin
+
+ @octoprint.plugin.BlueprintPlugin.route("/upload_archive", methods=["POST"])
+ @restricted_access
+ @admin_permission.require(403)
+ def upload_archive(self):
+ import flask
+
+ input_name = "file"
+ input_upload_path = input_name + "." + self._settings.global_get(["server", "uploads", "pathSuffix"])
+ input_upload_name = input_name + "." + self._settings.global_get(["server", "uploads", "nameSuffix"])
+
+ if input_upload_path not in flask.request.values or input_upload_name not in flask.request.values:
+ return flask.make_response("No file included", 400)
+ upload_path = flask.request.values[input_upload_path]
+ upload_name = flask.request.values[input_upload_name]
+
+ exts = filter(lambda x: upload_name.lower().endswith(x), (".zip", ".tar.gz", ".tgz", ".tar"))
+ if not len(exts):
+ return flask.make_response("File doesn't have a valid extension for a plugin archive", 400)
+
+ ext = exts[0]
+
+ import tempfile
+ import shutil
+ import os
+
+ archive = tempfile.NamedTemporaryFile(delete=False, suffix="{ext}".format(**locals()))
+ try:
+ archive.close()
+ shutil.copy(upload_path, archive.name)
+ return self.command_install(path=archive.name, force="force" in flask.request.values and flask.request.values["force"] in valid_boolean_trues)
+ finally:
+ try:
+ os.remove(archive.name)
+ except Exception as e:
+ self._logger.warn("Could not remove temporary file {path} again: {message}".format(path=archive.name, message=str(e)))
+
+ ##~~ SimpleApiPlugin
+
+ def get_api_commands(self):
+ return {
+ "install": ["url"],
+ "uninstall": ["plugin"],
+ "enable": ["plugin"],
+ "disable": ["plugin"],
+ "refresh_repository": []
+ }
+
+ def on_api_get(self, request):
+ if not admin_permission.can():
+ return make_response("Insufficient rights", 403)
+
+ plugins = self._plugin_manager.plugins
+
+ result = []
+ for name, plugin in plugins.items():
+ result.append(self._to_external_representation(plugin))
+
+ if "refresh_repository" in request.values and request.values["refresh_repository"] in valid_boolean_trues:
+ self._repository_available = self._refresh_repository()
+
+ return jsonify(plugins=result,
+ repository=dict(
+ available=self._repository_available,
+ plugins=self._repository_plugins
+ ),
+ os=self._get_os(),
+ octoprint=self._get_octoprint_version(),
+ pip=dict(
+ available=self._pip_caller.available,
+ command=self._pip_caller.command,
+ version=self._pip_caller.version_string,
+ use_sudo=self._pip_caller.use_sudo,
+ additional_args=self._settings.get(["pip_args"])
+ ))
+
+ def on_api_command(self, command, data):
+ if not admin_permission.can():
+ return make_response("Insufficient rights", 403)
+
+ if self._printer.is_printing() or self._printer.is_paused():
+ # do not update while a print job is running
+ return make_response("Printer is currently printing or paused", 409)
+
+ if command == "install":
+ url = data["url"]
+ plugin_name = data["plugin"] if "plugin" in data else None
+ return self.command_install(url=url,
+ force="force" in data and data["force"] in valid_boolean_trues,
+ dependency_links="dependency_links" in data and data["dependency_links"] in valid_boolean_trues,
+ reinstall=plugin_name)
+
+ elif command == "uninstall":
+ plugin_name = data["plugin"]
+ if not plugin_name in self._plugin_manager.plugins:
+ return make_response("Unknown plugin: %s" % plugin_name, 404)
+
+ plugin = self._plugin_manager.plugins[plugin_name]
+ return self.command_uninstall(plugin)
+
+ elif command == "enable" or command == "disable":
+ plugin_name = data["plugin"]
+ if not plugin_name in self._plugin_manager.plugins:
+ return make_response("Unknown plugin: %s" % plugin_name, 404)
+
+ plugin = self._plugin_manager.plugins[plugin_name]
+ return self.command_toggle(plugin, command)
+
+ def command_install(self, url=None, path=None, force=False, reinstall=None, dependency_links=False):
+ if url is not None:
+ pip_args = ["install", sarge.shell_quote(url)]
+ elif path is not None:
+ pip_args = ["install", sarge.shell_quote(path)]
+ else:
+ raise ValueError("Either url or path must be provided")
+
+ if dependency_links or self._settings.get_boolean(["dependency_links"]):
+ pip_args.append("--process-dependency-links")
+
+ all_plugins_before = self._plugin_manager.find_plugins()
+
+ success_string = "Successfully installed"
+ failure_string = "Could not install"
+ try:
+ returncode, stdout, stderr = self._call_pip(pip_args)
+ except:
+ self._logger.exception("Could not install plugin from %s" % url)
+ return make_response("Could not install plugin from url, see the log for more details", 500)
+ else:
+ if force:
+ pip_args += ["--ignore-installed", "--force-reinstall", "--no-deps"]
+ try:
+ returncode, stdout, stderr = self._call_pip(pip_args)
+ except:
+ self._logger.exception("Could not install plugin from %s" % url)
+ return make_response("Could not install plugin from url, see the log for more details", 500)
+
+ try:
+ result_line = filter(lambda x: x.startswith(success_string) or x.startswith(failure_string), stdout)[-1]
+ except IndexError:
+ result = dict(result=False, reason="Could not parse output from pip")
+ self._send_result_notification("install", result)
+ return jsonify(result)
+
+ # The final output of a pip install command looks something like this:
+ #
+ # Successfully installed OctoPrint-Plugin-1.0 Dependency-One-0.1 Dependency-Two-9.3
+ #
+ # or this:
+ #
+ # Successfully installed OctoPrint-Plugin Dependency-One Dependency-Two
+ # Cleaning up...
+ #
+ # So we'll need to fetch the "Successfully installed" line, strip the "Successfully" part, then split by whitespace
+ # and strip to get all installed packages.
+ #
+ # We then need to iterate over all known plugins and see if either the package name or the package name plus
+ # version number matches one of our installed packages. If it does, that's our installed plugin.
+ #
+ # Known issue: This might return the wrong plugin if more than one plugin was installed through this
+ # command (e.g. due to pulling in another plugin as dependency). It should be safe for now though to
+ # consider this a rare corner case. Once it becomes a real problem we'll just extend the plugin manager
+ # so that it can report on more than one installed plugin.
+
+ result_line = result_line.strip()
+ if not result_line.startswith(success_string):
+ result = dict(result=False, reason="Pip did not report successful installation")
+ self._send_result_notification("install", result)
+ return jsonify(result)
+
+ installed = map(lambda x: x.strip(), result_line[len(success_string):].split(" "))
+ all_plugins_after = self._plugin_manager.find_plugins(existing=dict(), ignore_uninstalled=False)
+
+ for key, plugin in all_plugins_after.items():
+ if plugin.origin is None or plugin.origin.type != "entry_point":
+ continue
+
+ package_name = plugin.origin.package_name
+ package_version = plugin.origin.package_version
+ versioned_package = "{package_name}-{package_version}".format(**locals())
+
+ if package_name in installed or versioned_package in installed:
+ # exact match, we are done here
+ new_plugin_key = key
+ new_plugin = plugin
+ break
+
+ else:
+ # it might still be a version that got stripped by python's package resources, e.g. 1.4.5a0 => 1.4.5a
+ found = False
+
+ for inst in installed:
+ if inst.startswith(versioned_package):
+ found = True
+ break
+
+ if found:
+ new_plugin_key = key
+ new_plugin = plugin
+ break
+ else:
+ self._logger.warn("The plugin was installed successfully, but couldn't be found afterwards to initialize properly during runtime. Please restart OctoPrint.")
+ result = dict(result=True, url=url, needs_restart=True, needs_refresh=True, was_reinstalled=False, plugin="unknown")
+ self._send_result_notification("install", result)
+ return jsonify(result)
+
+ self._plugin_manager.mark_plugin(new_plugin_key, uninstalled=False)
+ self._plugin_manager.reload_plugins()
+
+ needs_restart = self._plugin_manager.is_restart_needing_plugin(new_plugin) or new_plugin_key in all_plugins_before or reinstall is not None
+ needs_refresh = new_plugin.implementation and isinstance(new_plugin.implementation, octoprint.plugin.ReloadNeedingPlugin)
+
+ self._plugin_manager.log_all_plugins()
+
+ result = dict(result=True, url=url, needs_restart=needs_restart, needs_refresh=needs_refresh, was_reinstalled=new_plugin_key in all_plugins_before or reinstall is not None, plugin=self._to_external_representation(new_plugin))
+ self._send_result_notification("install", result)
+ return jsonify(result)
+
+ def command_uninstall(self, plugin):
+ if plugin.key == "pluginmanager":
+ return make_response("Can't uninstall Plugin Manager", 400)
+
+ if plugin.bundled:
+ return make_response("Bundled plugins cannot be uninstalled", 400)
+
+ if plugin.origin is None:
+ self._logger.warn(u"Trying to uninstall plugin {plugin} but origin is unknown".format(**locals()))
+ return make_response("Could not uninstall plugin, its origin is unknown")
+
+ if plugin.origin.type == "entry_point":
+ # plugin is installed through entry point, need to use pip to uninstall it
+ origin = plugin.origin[3]
+ if origin is None:
+ origin = plugin.origin[2]
+
+ pip_args = ["uninstall", "--yes", origin]
+ try:
+ self._call_pip(pip_args)
+ except:
+ self._logger.exception(u"Could not uninstall plugin via pip")
+ return make_response("Could not uninstall plugin via pip, see the log for more details", 500)
+
+ elif plugin.origin.type == "folder":
+ import os
+ import shutil
+ full_path = os.path.realpath(plugin.location)
+
+ if os.path.isdir(full_path):
+ # plugin is installed via a plugin folder, need to use rmtree to get rid of it
+ self._log_stdout(u"Deleting plugin from {folder}".format(folder=plugin.location))
+ shutil.rmtree(full_path)
+ elif os.path.isfile(full_path):
+ self._log_stdout(u"Deleting plugin from {file}".format(file=plugin.location))
+ os.remove(full_path)
+
+ if full_path.endswith(".py"):
+ pyc_file = "{full_path}c".format(**locals())
+ if os.path.isfile(pyc_file):
+ os.remove(pyc_file)
+
+ else:
+ self._logger.warn(u"Trying to uninstall plugin {plugin} but origin is unknown ({plugin.origin.type})".format(**locals()))
+ return make_response("Could not uninstall plugin, its origin is unknown")
+
+ needs_restart = self._plugin_manager.is_restart_needing_plugin(plugin)
+ needs_refresh = plugin.implementation and isinstance(plugin.implementation, octoprint.plugin.ReloadNeedingPlugin)
+
+ self._plugin_manager.mark_plugin(plugin.key, uninstalled=True)
+
+ if not needs_restart:
+ try:
+ self._plugin_manager.disable_plugin(plugin.key, plugin=plugin)
+ except octoprint.plugin.core.PluginLifecycleException as e:
+ self._logger.exception(u"Problem disabling plugin {name}".format(name=plugin.key))
+ result = dict(result=False, uninstalled=True, disabled=False, unloaded=False, reason=e.reason)
+ self._send_result_notification("uninstall", result)
+ return jsonify(result)
+
+ try:
+ self._plugin_manager.unload_plugin(plugin.key)
+ except octoprint.plugin.core.PluginLifecycleException as e:
+ self._logger.exception(u"Problem unloading plugin {name}".format(name=plugin.key))
+ result = dict(result=False, uninstalled=True, disabled=True, unloaded=False, reason=e.reason)
+ self._send_result_notification("uninstall", result)
+ return jsonify(result)
+
+ self._plugin_manager.reload_plugins()
+
+ result = dict(result=True, needs_restart=needs_restart, needs_refresh=needs_refresh, plugin=self._to_external_representation(plugin))
+ self._send_result_notification("uninstall", result)
+ return jsonify(result)
+
+ def command_toggle(self, plugin, command):
+ if plugin.key == "pluginmanager":
+ return make_response("Can't enable/disable Plugin Manager", 400)
+
+ needs_restart = self._plugin_manager.is_restart_needing_plugin(plugin)
+ needs_refresh = plugin.implementation and isinstance(plugin.implementation, octoprint.plugin.ReloadNeedingPlugin)
+
+ pending = ((command == "disable" and plugin.key in self._pending_enable) or (command == "enable" and plugin.key in self._pending_disable))
+ needs_restart_api = needs_restart and not pending
+ needs_refresh_api = needs_refresh and not pending
+
+ try:
+ if command == "disable":
+ self._mark_plugin_disabled(plugin, needs_restart=needs_restart)
+ elif command == "enable":
+ self._mark_plugin_enabled(plugin, needs_restart=needs_restart)
+ except octoprint.plugin.core.PluginLifecycleException as e:
+ self._logger.exception(u"Problem toggling enabled state of {name}: {reason}".format(name=plugin.key, reason=e.reason))
+ result = dict(result=False, reason=e.reason)
+ except octoprint.plugin.core.PluginNeedsRestart:
+ result = dict(result=True, needs_restart=True, needs_refresh=True, plugin=self._to_external_representation(plugin))
+ else:
+ result = dict(result=True, needs_restart=needs_restart_api, needs_refresh=needs_refresh_api, plugin=self._to_external_representation(plugin))
+
+ self._send_result_notification(command, result)
+ return jsonify(result)
+
+ def _send_result_notification(self, action, result):
+ notification = dict(type="result", action=action)
+ notification.update(result)
+ self._plugin_manager.send_plugin_message(self._identifier, notification)
+
+ def _call_pip(self, args):
+ if self._pip_caller is None or not self._pip_caller.available:
+ raise RuntimeError(u"No pip available, can't operate".format(**locals()))
+
+ if "--process-dependency-links" in args:
+ self._log_message(u"Installation needs to process external dependencies, that might make it take a bit longer than usual depending on the pip version")
+ if self._pip_caller < self._pip_version_dependency_links:
+ args.remove("--process-dependency-links")
+
+ additional_args = self._settings.get(["pip_args"])
+ if additional_args:
+ args.append(additional_args)
+
+ return self._pip_caller.execute(*args)
+
+ def _log_message(self, *lines):
+ self._log(lines, prefix=u"*", stream="message")
+
+ def _log_call(self, *lines):
+ self._log(lines, prefix=u" ", stream="call")
+
+ def _log_stdout(self, *lines):
+ self._log(lines, prefix=u">", stream="stdout")
+
+ def _log_stderr(self, *lines):
+ self._log(lines, prefix=u"!", stream="stderr")
+
+ def _log(self, lines, prefix=None, stream=None, strip=True):
+ if strip:
+ lines = map(lambda x: x.strip(), lines)
+
+ self._plugin_manager.send_plugin_message(self._identifier, dict(type="loglines", loglines=[dict(line=line, stream=stream) for line in lines]))
+ for line in lines:
+ self._console_logger.debug(u"{prefix} {line}".format(**locals()))
+
+ def _mark_plugin_enabled(self, plugin, needs_restart=False):
+ disabled_list = list(self._settings.global_get(["plugins", "_disabled"]))
+ if plugin.key in disabled_list:
+ disabled_list.remove(plugin.key)
+ self._settings.global_set(["plugins", "_disabled"], disabled_list)
+ self._settings.save(force=True)
+
+ if not needs_restart:
+ self._plugin_manager.enable_plugin(plugin.key)
+ else:
+ if plugin.key in self._pending_disable:
+ self._pending_disable.remove(plugin.key)
+ elif not plugin.enabled and plugin.key not in self._pending_enable:
+ self._pending_enable.add(plugin.key)
+
+ def _mark_plugin_disabled(self, plugin, needs_restart=False):
+ disabled_list = list(self._settings.global_get(["plugins", "_disabled"]))
+ if not plugin.key in disabled_list:
+ disabled_list.append(plugin.key)
+ self._settings.global_set(["plugins", "_disabled"], disabled_list)
+ self._settings.save(force=True)
+
+ if not needs_restart:
+ self._plugin_manager.disable_plugin(plugin.key)
+ else:
+ if plugin.key in self._pending_enable:
+ self._pending_enable.remove(plugin.key)
+ elif plugin.enabled and plugin.key not in self._pending_disable:
+ self._pending_disable.add(plugin.key)
+
+ def _fetch_repository_from_disk(self):
+ repo_data = None
+ if os.path.isfile(self._repository_cache_path):
+ import time
+ mtime = os.path.getmtime(self._repository_cache_path)
+ if mtime + self._repository_cache_ttl >= time.time() > mtime:
+ try:
+ import json
+ with open(self._repository_cache_path) as f:
+ repo_data = json.load(f)
+ self._logger.info("Loaded plugin repository data from disk, was still valid")
+ except:
+ self._logger.exception("Error while loading repository data from {}".format(self._repository_cache_path))
+
+ return self._refresh_repository(repo_data=repo_data)
+
+ def _fetch_repository_from_url(self):
+ import requests
+ repository_url = self._settings.get(["repository"])
+ try:
+ r = requests.get(repository_url)
+ self._logger.info("Loaded plugin repository data from {}".format(repository_url))
+ except Exception as e:
+ self._logger.exception("Could not fetch plugins from repository at {repository_url}: {message}".format(repository_url=repository_url, message=str(e)))
+ return None
+
+ repo_data = r.json()
+
+ try:
+ import json
+ with octoprint.util.atomic_write(self._repository_cache_path, "wb") as f:
+ json.dump(repo_data, f)
+ except Exception as e:
+ self._logger.exception("Error while saving repository data to {}: {}".format(self._repository_cache_path, str(e)))
+
+ return repo_data
+
+ def _refresh_repository(self, repo_data=None):
+ if repo_data is None:
+ repo_data = self._fetch_repository_from_url()
+ if repo_data is None:
+ return False
+
+ current_os = self._get_os()
+ octoprint_version = self._get_octoprint_version()
+ if "-" in octoprint_version:
+ octoprint_version = octoprint_version[:octoprint_version.find("-")]
+
+ def map_repository_entry(entry):
+ result = dict(entry)
+
+ if not "follow_dependency_links" in result:
+ result["follow_dependency_links"] = False
+
+ result["is_compatible"] = dict(
+ octoprint=True,
+ os=True
+ )
+
+ if "compatibility" in entry:
+ if "octoprint" in entry["compatibility"] and entry["compatibility"]["octoprint"] is not None and len(entry["compatibility"]["octoprint"]):
+ result["is_compatible"]["octoprint"] = self._is_octoprint_compatible(octoprint_version, entry["compatibility"]["octoprint"])
+
+ if "os" in entry["compatibility"] and entry["compatibility"]["os"] is not None and len(entry["compatibility"]["os"]):
+ result["is_compatible"]["os"] = self._is_os_compatible(current_os, entry["compatibility"]["os"])
+
+ return result
+
+ self._repository_plugins = map(map_repository_entry, repo_data)
+ return True
+
+ def _is_octoprint_compatible(self, octoprint_version_string, compatibility_entries):
+ """
+ Tests if the current ``octoprint_version`` is compatible to any of the provided ``compatibility_entries``.
+ """
+
+ octoprint_version = pkg_resources.parse_version(octoprint_version_string)
+ for octo_compat in compatibility_entries:
+ if not any(octo_compat.startswith(c) for c in ("<", "<=", "!=", "==", ">=", ">", "~=", "===")):
+ octo_compat = ">={}".format(octo_compat)
+
+ s = next(pkg_resources.parse_requirements("OctoPrint" + octo_compat))
+ if octoprint_version in s:
+ break
+ else:
+ return False
+
+ return True
+
+ def _is_os_compatible(self, current_os, compatibility_entries):
+ """
+ Tests if the ``current_os`` matches any of the provided ``compatibility_entries``.
+ """
+ return current_os in compatibility_entries
+
+ def _get_os(self):
+ if sys.platform == "win32":
+ return "windows"
+ elif sys.platform == "linux2":
+ return "linux"
+ elif sys.platform == "darwin":
+ return "macos"
+ else:
+ return "unknown"
+
+ def _get_octoprint_version(self):
+ from octoprint._version import get_versions
+ return get_versions()["version"]
+
+ def _to_external_representation(self, plugin):
+ return dict(
+ key=plugin.key,
+ name=plugin.name,
+ description=plugin.description,
+ author=plugin.author,
+ version=plugin.version,
+ url=plugin.url,
+ license=plugin.license,
+ bundled=plugin.bundled,
+ enabled=plugin.enabled,
+ pending_enable=(not plugin.enabled and plugin.key in self._pending_enable),
+ pending_disable=(plugin.enabled and plugin.key in self._pending_disable),
+ pending_install=(plugin.key in self._pending_install),
+ pending_uninstall=(plugin.key in self._pending_uninstall),
+ origin=plugin.origin.type
+ )
+
+__plugin_name__ = "Plugin Manager"
+__plugin_author__ = "Gina Häußge"
+__plugin_url__ = "https://github.com/foosel/OctoPrint/wiki/Plugin:-Plugin-Manager"
+__plugin_description__ = "Allows installing and managing OctoPrint plugins"
+__plugin_license__ = "AGPLv3"
+
+def __plugin_load__():
+ global __plugin_implementation__
+ __plugin_implementation__ = PluginManagerPlugin()
+
+ global __plugin_hooks__
+ __plugin_hooks__ = {
+ "octoprint.server.http.bodysize": __plugin_implementation__.increase_upload_bodysize
+ }
diff --git a/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/plugins/pluginmanager/static/css/pluginmanager.css b/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/plugins/pluginmanager/static/css/pluginmanager.css
new file mode 100644
index 000000000..b1cbc9af7
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/plugins/pluginmanager/static/css/pluginmanager.css
@@ -0,0 +1 @@
+table th.settings_plugin_plugin_manager_plugins_name,table td.settings_plugin_plugin_manager_plugins_name{text-overflow:ellipsis;text-align:left}table th.settings_plugin_plugin_manager_plugins_actions,table td.settings_plugin_plugin_manager_plugins_actions{text-align:center;width:80px}table th.settings_plugin_plugin_manager_plugins_actions a,table td.settings_plugin_plugin_manager_plugins_actions a{text-decoration:none;color:#000}table th.settings_plugin_plugin_manager_plugins_actions a.disabled,table td.settings_plugin_plugin_manager_plugins_actions a.disabled{color:#ccc;cursor:default}#settings_plugin_pluginmanager_repositorydialog .slimScrollDiv{margin-bottom:20px}#settings_plugin_pluginmanager_repositorydialog h4{position:relative}#settings_plugin_pluginmanager_repositorydialog h4 a.dropdown-toggle{color:inherit;text-decoration:none;font-size:14px}#settings_plugin_pluginmanager_repositorydialog h4 ul.dropdown-menu{font-size:14px}#settings_plugin_pluginmanager_repositorydialog .form-search{text-align:center;margin-bottom:5px!important}#settings_plugin_pluginmanager_repositorydialog .form-inline{padding:5px;padding-right:10px;margin-bottom:0}#settings_plugin_pluginmanager_repositorydialog .form-inline .help-block{margin-bottom:0;font-size:85%}#settings_plugin_pluginmanager_repositorydialog #settings_plugin_pluginmanager_repositorydialog_unavailable{overflow:hidden;width:100%;height:300px;background-image:url("../img/repo_unavailable.png");text-align:center;display:table}#settings_plugin_pluginmanager_repositorydialog #settings_plugin_pluginmanager_repositorydialog_unavailable div{display:table-cell;vertical-align:middle}#settings_plugin_pluginmanager_repositorydialog #settings_plugin_pluginmanager_repositorydialog_list{overflow:hidden;width:auto;height:300px}#settings_plugin_pluginmanager_repositorydialog #settings_plugin_pluginmanager_repositorydialog_list .entry{border-bottom:1px solid #ddd;padding:5px;padding-right:10px}#settings_plugin_pluginmanager_workingdialog_output .message{font-weight:bold}#settings_plugin_pluginmanager_workingdialog_output .stdout{color:#333}#settings_plugin_pluginmanager_workingdialog_output .stderr{color:#900}#settings_plugin_pluginmanager_workingdialog_output .call{color:#009}
\ No newline at end of file
diff --git a/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/plugins/pluginmanager/static/img/repo_unavailable.png b/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/plugins/pluginmanager/static/img/repo_unavailable.png
new file mode 100644
index 000000000..cc9f84d44
Binary files /dev/null and b/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/plugins/pluginmanager/static/img/repo_unavailable.png differ
diff --git a/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/plugins/pluginmanager/static/js/pluginmanager.js b/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/plugins/pluginmanager/static/js/pluginmanager.js
new file mode 100644
index 000000000..75c8e2f39
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/plugins/pluginmanager/static/js/pluginmanager.js
@@ -0,0 +1,711 @@
+$(function() {
+ function PluginManagerViewModel(parameters) {
+ var self = this;
+
+ self.loginState = parameters[0];
+ self.settingsViewModel = parameters[1];
+ self.printerState = parameters[2];
+
+ self.config_repositoryUrl = ko.observable();
+ self.config_repositoryTtl = ko.observable();
+ self.config_pipCommand = ko.observable();
+ self.config_pipAdditionalArgs = ko.observable();
+
+ self.configurationDialog = $("#settings_plugin_pluginmanager_configurationdialog");
+
+ self.plugins = new ItemListHelper(
+ "plugin.pluginmanager.installedplugins",
+ {
+ "name": function (a, b) {
+ // sorts ascending
+ if (a["name"].toLocaleLowerCase() < b["name"].toLocaleLowerCase()) return -1;
+ if (a["name"].toLocaleLowerCase() > b["name"].toLocaleLowerCase()) return 1;
+ return 0;
+ }
+ },
+ {
+ },
+ "name",
+ [],
+ [],
+ 5
+ );
+
+ self.repositoryplugins = new ItemListHelper(
+ "plugin.pluginmanager.repositoryplugins",
+ {
+ "title": function (a, b) {
+ // sorts ascending
+ if (a["title"].toLocaleLowerCase() < b["title"].toLocaleLowerCase()) return -1;
+ if (a["title"].toLocaleLowerCase() > b["title"].toLocaleLowerCase()) return 1;
+ return 0;
+ },
+ "published": function (a, b) {
+ // sorts descending
+ if (a["published"].toLocaleLowerCase() > b["published"].toLocaleLowerCase()) return -1;
+ if (a["published"].toLocaleLowerCase() < b["published"].toLocaleLowerCase()) return 1;
+ return 0;
+ }
+ },
+ {
+ "filter_installed": function(plugin) {
+ return !self.installed(plugin);
+ },
+ "filter_incompatible": function(plugin) {
+ return plugin.is_compatible.octoprint && plugin.is_compatible.os;
+ }
+ },
+ "title",
+ ["filter_installed", "filter_incompatible"],
+ [],
+ 0
+ );
+
+ self.uploadElement = $("#settings_plugin_pluginmanager_repositorydialog_upload");
+ self.uploadButton = $("#settings_plugin_pluginmanager_repositorydialog_upload_start");
+
+ self.repositoryAvailable = ko.observable(false);
+
+ self.repositorySearchQuery = ko.observable();
+ self.repositorySearchQuery.subscribe(function() {
+ self.performRepositorySearch();
+ });
+
+ self.installUrl = ko.observable();
+ self.uploadFilename = ko.observable();
+
+ self.loglines = ko.observableArray([]);
+ self.installedPlugins = ko.observableArray([]);
+
+ self.followDependencyLinks = ko.observable(false);
+
+ self.pipAvailable = ko.observable(false);
+ self.pipCommand = ko.observable();
+ self.pipVersion = ko.observable();
+ self.pipUseSudo = ko.observable();
+ self.pipAdditionalArgs = ko.observable();
+
+ self.working = ko.observable(false);
+ self.workingTitle = ko.observable();
+ self.workingDialog = undefined;
+ self.workingOutput = undefined;
+
+ self.enableManagement = ko.computed(function() {
+ return !self.printerState.isPrinting();
+ });
+
+ self.enableToggle = function(data) {
+ return self.enableManagement() && data.key != 'pluginmanager';
+ };
+
+ self.enableUninstall = function(data) {
+ return self.enableManagement()
+ && (data.origin != "entry_point" || self.pipAvailable())
+ && !data.bundled
+ && data.key != 'pluginmanager'
+ && !data.pending_uninstall;
+ };
+
+ self.enableRepoInstall = function(data) {
+ return self.enableManagement() && self.pipAvailable() && self.isCompatible(data);
+ };
+
+ self.invalidUrl = ko.computed(function() {
+ var url = self.installUrl();
+ return url !== undefined && url.trim() != "" && !(_.startsWith(url.toLocaleLowerCase(), "http://") || _.startsWith(url.toLocaleLowerCase(), "https://"));
+ });
+
+ self.enableUrlInstall = ko.computed(function() {
+ var url = self.installUrl();
+ return self.enableManagement() && self.pipAvailable() && url !== undefined && url.trim() != "" && !self.invalidUrl();
+ });
+
+ self.invalidArchive = ko.computed(function() {
+ var name = self.uploadFilename();
+ return name !== undefined && !(_.endsWith(name.toLocaleLowerCase(), ".zip") || _.endsWith(name.toLocaleLowerCase(), ".tar.gz") || _.endsWith(name.toLocaleLowerCase(), ".tgz") || _.endsWith(name.toLocaleLowerCase(), ".tar"));
+ });
+
+ self.enableArchiveInstall = ko.computed(function() {
+ var name = self.uploadFilename();
+ return self.enableManagement() && self.pipAvailable() && name !== undefined && name.trim() != "" && !self.invalidArchive();
+ });
+
+ self.uploadElement.fileupload({
+ dataType: "json",
+ maxNumberOfFiles: 1,
+ autoUpload: false,
+ add: function(e, data) {
+ if (data.files.length == 0) {
+ return false;
+ }
+
+ self.uploadFilename(data.files[0].name);
+
+ self.uploadButton.unbind("click");
+ self.uploadButton.bind("click", function() {
+ self._markWorking(gettext("Installing plugin..."), gettext("Installing plugin from uploaded archive..."));
+ data.formData = {
+ dependency_links: self.followDependencyLinks()
+ };
+ data.submit();
+ return false;
+ });
+ },
+ done: function(e, data) {
+ self._markDone();
+ self.uploadButton.unbind("click");
+ self.uploadFilename("");
+ },
+ fail: function(e, data) {
+ new PNotify({
+ title: gettext("Something went wrong"),
+ text: gettext("Please consult octoprint.log for details"),
+ type: "error",
+ hide: false
+ });
+ self._markDone();
+ self.uploadButton.unbind("click");
+ self.uploadFilename("");
+ }
+ });
+
+ self.performRepositorySearch = function() {
+ var query = self.repositorySearchQuery();
+ if (query !== undefined && query.trim() != "") {
+ query = query.toLocaleLowerCase();
+ self.repositoryplugins.changeSearchFunction(function(entry) {
+ return entry && (entry["title"].toLocaleLowerCase().indexOf(query) > -1 || entry["description"].toLocaleLowerCase().indexOf(query) > -1);
+ });
+ } else {
+ self.repositoryplugins.resetSearch();
+ }
+ return false;
+ };
+
+ self.fromResponse = function(data) {
+ self._fromPluginsResponse(data.plugins);
+ self._fromRepositoryResponse(data.repository);
+ self._fromPipResponse(data.pip);
+ };
+
+ self._fromPluginsResponse = function(data) {
+ var installedPlugins = [];
+ _.each(data, function(plugin) {
+ installedPlugins.push(plugin.key);
+ });
+ self.installedPlugins(installedPlugins);
+ self.plugins.updateItems(data);
+ };
+
+ self._fromRepositoryResponse = function(data) {
+ self.repositoryAvailable(data.available);
+ if (data.available) {
+ self.repositoryplugins.updateItems(data.plugins);
+ } else {
+ self.repositoryplugins.updateItems([]);
+ }
+ };
+
+ self._fromPipResponse = function(data) {
+ self.pipAvailable(data.available);
+ if (data.available) {
+ self.pipCommand(data.command);
+ self.pipVersion(data.version);
+ self.pipUseSudo(data.use_sudo);
+ self.pipAdditionalArgs(data.additional_args);
+ } else {
+ self.pipCommand(undefined);
+ self.pipVersion(undefined);
+ self.pipUseSudo(undefined);
+ self.pipAdditionalArgs(undefined);
+ }
+ };
+
+ self.requestData = function(includeRepo) {
+ if (!self.loginState.isAdmin()) {
+ return;
+ }
+
+ $.ajax({
+ url: API_BASEURL + "plugin/pluginmanager" + ((includeRepo) ? "?refresh_repository=true" : ""),
+ type: "GET",
+ dataType: "json",
+ success: self.fromResponse
+ });
+ };
+
+ self.togglePlugin = function(data) {
+ if (!self.loginState.isAdmin()) {
+ return;
+ }
+
+ if (!self.enableManagement()) {
+ return;
+ }
+
+ if (data.key == "pluginmanager") return;
+
+ var command = self._getToggleCommand(data);
+
+ var payload = {plugin: data.key};
+ self._postCommand(command, payload, function(response) {
+ self.requestData();
+ }, function() {
+ new PNotify({
+ title: gettext("Something went wrong"),
+ text: gettext("Please consult octoprint.log for details"),
+ type: "error",
+ hide: false
+ })
+ });
+ };
+
+ self.showRepository = function() {
+ self.repositoryDialog.modal("show");
+ };
+
+ self.pluginDetails = function(data) {
+ window.open(data.page);
+ };
+
+ self.installFromRepository = function(data) {
+ if (!self.loginState.isAdmin()) {
+ return;
+ }
+
+ if (!self.enableManagement()) {
+ return;
+ }
+
+ if (self.installed(data)) {
+ self.installPlugin(data.archive, data.title, data.id, data.follow_dependency_links || self.followDependencyLinks());
+ } else {
+ self.installPlugin(data.archive, data.title, undefined, data.follow_dependency_links || self.followDependencyLinks());
+ }
+ };
+
+ self.installPlugin = function(url, name, reinstall, followDependencyLinks) {
+ if (!self.loginState.isAdmin()) {
+ return;
+ }
+
+ if (!self.enableManagement()) {
+ return;
+ }
+
+ if (url === undefined) {
+ url = self.installUrl();
+ }
+ if (!url) return;
+
+ if (followDependencyLinks === undefined) {
+ followDependencyLinks = self.followDependencyLinks();
+ }
+
+ var workTitle, workText;
+ if (!reinstall) {
+ workTitle = gettext("Installing plugin...");
+ if (name) {
+ workText = _.sprintf(gettext("Installing plugin \"%(name)s\" from %(url)s..."), {url: url, name: name});
+ } else {
+ workText = _.sprintf(gettext("Installing plugin from %(url)s..."), {url: url});
+ }
+ } else {
+ workTitle = gettext("Reinstalling plugin...");
+ workText = _.sprintf(gettext("Reinstalling plugin \"%(name)s\" from %(url)s..."), {url: url, name: name});
+ }
+ self._markWorking(workTitle, workText);
+
+ var command = "install";
+ var payload = {url: url, dependency_links: followDependencyLinks};
+ if (reinstall) {
+ payload["plugin"] = reinstall;
+ payload["force"] = true;
+ }
+
+ self._postCommand(command, payload, function(response) {
+ self.requestData();
+ self._markDone();
+ self.installUrl("");
+ }, function() {
+ new PNotify({
+ title: gettext("Something went wrong"),
+ text: gettext("Please consult octoprint.log for details"),
+ type: "error",
+ hide: false
+ });
+ self._markDone();
+ });
+ };
+
+ self.uninstallPlugin = function(data) {
+ if (!self.loginState.isAdmin()) {
+ return;
+ }
+
+ if (!self.enableManagement()) {
+ return;
+ }
+
+ if (data.bundled) return;
+ if (data.key == "pluginmanager") return;
+
+ self._markWorking(gettext("Uninstalling plugin..."), _.sprintf(gettext("Uninstalling plugin \"%(name)s\""), {name: data.name}));
+
+ var command = "uninstall";
+ var payload = {plugin: data.key};
+ self._postCommand(command, payload, function(response) {
+ self.requestData();
+ self._markDone();
+ }, function() {
+ new PNotify({
+ title: gettext("Something went wrong"),
+ text: gettext("Please consult octoprint.log for details"),
+ type: "error",
+ hide: false
+ });
+ self._markDone();
+ });
+ };
+
+ self.refreshRepository = function() {
+ if (!self.loginState.isAdmin()) {
+ return;
+ }
+
+ self.requestData(true);
+ };
+
+ self.showPluginSettings = function() {
+ self._copyConfig();
+ self.configurationDialog.modal();
+ };
+
+ self.savePluginSettings = function() {
+ var pipCommand = self.config_pipCommand();
+ if (pipCommand != undefined && pipCommand.trim() == "") {
+ pipCommand = null;
+ }
+
+ var repository = self.config_repositoryUrl();
+ if (repository != undefined && repository.trim() == "") {
+ repository = null;
+ }
+
+ var repositoryTtl;
+ try {
+ repositoryTtl = parseInt(self.config_repositoryTtl());
+ } catch (ex) {
+ repositoryTtl = null;
+ }
+
+ var pipArgs = self.config_pipAdditionalArgs();
+ if (pipArgs != undefined && pipArgs.trim() == "") {
+ pipArgs = null;
+ }
+
+ var data = {
+ plugins: {
+ pluginmanager: {
+ repository: repository,
+ repository_ttl: repositoryTtl,
+ pip: pipCommand,
+ pip_args: pipArgs
+ }
+ }
+ };
+ self.settingsViewModel.saveData(data, function() {
+ self.configurationDialog.modal("hide");
+ self._copyConfig();
+ self.refreshRepository();
+ });
+ };
+
+ self._copyConfig = function() {
+ self.config_repositoryUrl(self.settingsViewModel.settings.plugins.pluginmanager.repository());
+ self.config_repositoryTtl(self.settingsViewModel.settings.plugins.pluginmanager.repository_ttl());
+ self.config_pipCommand(self.settingsViewModel.settings.plugins.pluginmanager.pip());
+ self.config_pipAdditionalArgs(self.settingsViewModel.settings.plugins.pluginmanager.pip_args());
+ };
+
+ self.installed = function(data) {
+ return _.includes(self.installedPlugins(), data.id);
+ };
+
+ self.isCompatible = function(data) {
+ return data.is_compatible.octoprint && data.is_compatible.os;
+ };
+
+ self.installButtonText = function(data) {
+ return self.isCompatible(data) ? (self.installed(data) ? gettext("Reinstall") : gettext("Install")) : gettext("Incompatible");
+ };
+
+ self._displayNotification = function(response, titleSuccess, textSuccess, textRestart, textReload, titleError, textError) {
+ if (response.result) {
+ if (response.needs_restart) {
+ new PNotify({
+ title: titleSuccess,
+ text: textRestart,
+ hide: false
+ });
+ } else if (response.needs_refresh) {
+ new PNotify({
+ title: titleSuccess,
+ text: textReload,
+ confirm: {
+ confirm: true,
+ buttons: [{
+ text: gettext("Reload now"),
+ click: function () {
+ location.reload(true);
+ }
+ }]
+ },
+ buttons: {
+ closer: false,
+ sticker: false
+ },
+ hide: false
+ })
+ } else {
+ new PNotify({
+ title: titleSuccess,
+ text: textSuccess,
+ type: "success",
+ hide: false
+ })
+ }
+ } else {
+ new PNotify({
+ title: titleError,
+ text: textError,
+ type: "error",
+ hide: false
+ });
+ }
+ };
+
+ self._postCommand = function (command, data, successCallback, failureCallback, alwaysCallback, timeout) {
+ var payload = _.extend(data, {command: command});
+
+ var params = {
+ url: API_BASEURL + "plugin/pluginmanager",
+ type: "POST",
+ dataType: "json",
+ data: JSON.stringify(payload),
+ contentType: "application/json; charset=UTF-8",
+ success: function(response) {
+ if (successCallback) successCallback(response);
+ },
+ error: function() {
+ if (failureCallback) failureCallback();
+ },
+ complete: function() {
+ if (alwaysCallback) alwaysCallback();
+ }
+ };
+
+ if (timeout != undefined) {
+ params.timeout = timeout;
+ }
+
+ $.ajax(params);
+ };
+
+ self._markWorking = function(title, line) {
+ self.working(true);
+ self.workingTitle(title);
+
+ self.loglines.removeAll();
+ self.loglines.push({line: line, stream: "message"});
+
+ self.workingDialog.modal("show");
+ };
+
+ self._markDone = function() {
+ self.working(false);
+ self.loglines.push({line: gettext("Done!"), stream: "message"});
+ self._scrollWorkingOutputToEnd();
+ };
+
+ self._scrollWorkingOutputToEnd = function() {
+ self.workingOutput.scrollTop(self.workingOutput[0].scrollHeight - self.workingOutput.height());
+ };
+
+ self._getToggleCommand = function(data) {
+ return ((!data.enabled || data.pending_disable) && !data.pending_enable) ? "enable" : "disable";
+ };
+
+ self.toggleButtonCss = function(data) {
+ var icon = self._getToggleCommand(data) == "enable" ? "icon-circle-blank" : "icon-circle";
+ var disabled = (self.enableToggle(data)) ? "" : " disabled";
+
+ return icon + disabled;
+ };
+
+ self.toggleButtonTitle = function(data) {
+ return self._getToggleCommand(data) == "enable" ? gettext("Enable Plugin") : gettext("Disable Plugin");
+ };
+
+ self.onBeforeBinding = function() {
+ self.settings = self.settingsViewModel.settings;
+ };
+
+ self.onUserLoggedIn = function(user) {
+ if (user.admin) {
+ self.requestData();
+ }
+ };
+
+ self.onStartup = function() {
+ self.workingDialog = $("#settings_plugin_pluginmanager_workingdialog");
+ self.workingOutput = $("#settings_plugin_pluginmanager_workingdialog_output");
+ self.repositoryDialog = $("#settings_plugin_pluginmanager_repositorydialog");
+
+ $("#settings_plugin_pluginmanager_repositorydialog_list").slimScroll({
+ height: "306px",
+ size: "5px",
+ distance: "0",
+ railVisible: true,
+ alwaysVisible: true,
+ scrollBy: "102px"
+ });
+ };
+
+ self.onDataUpdaterPluginMessage = function(plugin, data) {
+ if (plugin != "pluginmanager") {
+ return;
+ }
+
+ if (!self.loginState.isAdmin()) {
+ return;
+ }
+
+ if (!data.hasOwnProperty("type")) {
+ return;
+ }
+
+ var messageType = data.type;
+
+ if (messageType == "loglines" && self.working()) {
+ _.each(data.loglines, function(line) {
+ self.loglines.push(line);
+ });
+ self._scrollWorkingOutputToEnd();
+ } else if (messageType == "result") {
+ var titleSuccess, textSuccess, textRestart, textReload, titleError, textError;
+ var action = data.action;
+
+ var name = "Unknown";
+ if (action == "install") {
+ var unknown = false;
+
+ if (data.hasOwnProperty("plugin")) {
+ if (data.plugin == "unknown") {
+ unknown = true;
+ } else {
+ name = data.plugin.name;
+ }
+ }
+
+ if (unknown) {
+ titleSuccess = _.sprintf(gettext("Plugin installed"));
+ textSuccess = gettext("A plugin was installed successfully, however it was impossible to detect which one. Please Restart OctoPrint to make sure everything will be registered properly");
+ textRestart = textSuccess;
+ textReload = textSuccess;
+ } else if (data.was_reinstalled) {
+ titleSuccess = _.sprintf(gettext("Plugin \"%(name)s\" reinstalled"), {name: name});
+ textSuccess = gettext("The plugin was reinstalled successfully");
+ textRestart = gettext("The plugin was reinstalled successfully, however a restart of OctoPrint is needed for that to take effect.");
+ textReload = gettext("The plugin was reinstalled successfully, however a reload of the page is needed for that to take effect.");
+ } else {
+ titleSuccess = _.sprintf(gettext("Plugin \"%(name)s\" installed"), {name: name});
+ textSuccess = gettext("The plugin was installed successfully");
+ textRestart = gettext("The plugin was installed successfully, however a restart of OctoPrint is needed for that to take effect.");
+ textReload = gettext("The plugin was installed successfully, however a reload of the page is needed for that to take effect.");
+ }
+
+ titleError = gettext("Something went wrong");
+ var url = "unknown";
+ if (data.hasOwnProperty("url")) {
+ url = data.url;
+ }
+
+ if (data.hasOwnProperty("reason")) {
+ if (data.was_reinstalled) {
+ textError = _.sprintf(gettext("Reinstalling the plugin from URL \"%(url)s\" failed: %(reason)s"), {reason: data.reason, url: url});
+ } else {
+ textError = _.sprintf(gettext("Installing the plugin from URL \"%(url)s\" failed: %(reason)s"), {reason: data.reason, url: url});
+ }
+ } else {
+ if (data.was_reinstalled) {
+ textError = _.sprintf(gettext("Reinstalling the plugin from URL \"%(url)s\" failed, please see the log for details."), {url: url});
+ } else {
+ textError = _.sprintf(gettext("Installing the plugin from URL \"%(url)s\" failed, please see the log for details."), {url: url});
+ }
+ }
+
+ } else if (action == "uninstall") {
+ if (data.hasOwnProperty("plugin")) {
+ name = data.plugin.name;
+ }
+
+ titleSuccess = _.sprintf(gettext("Plugin \"%(name)s\" uninstalled"), {name: name});
+ textSuccess = gettext("The plugin was uninstalled successfully");
+ textRestart = gettext("The plugin was uninstalled successfully, however a restart of OctoPrint is needed for that to take effect.");
+ textReload = gettext("The plugin was uninstalled successfully, however a reload of the page is needed for that to take effect.");
+
+ titleError = gettext("Something went wrong");
+ if (data.hasOwnProperty("reason")) {
+ textError = _.sprintf(gettext("Uninstalling the plugin failed: %(reason)s"), {reason: data.reason});
+ } else {
+ textError = gettext("Uninstalling the plugin failed, please see the log for details.");
+ }
+
+ } else if (action == "enable") {
+ if (data.hasOwnProperty("plugin")) {
+ name = data.plugin.name;
+ }
+
+ titleSuccess = _.sprintf(gettext("Plugin \"%(name)s\" enabled"), {name: name});
+ textSuccess = gettext("The plugin was enabled successfully.");
+ textRestart = gettext("The plugin was enabled successfully, however a restart of OctoPrint is needed for that to take effect.");
+ textReload = gettext("The plugin was enabled successfully, however a reload of the page is needed for that to take effect.");
+
+ titleError = gettext("Something went wrong");
+ if (data.hasOwnProperty("reason")) {
+ textError = _.sprintf(gettext("Toggling the plugin failed: %(reason)s"), {reason: data.reason});
+ } else {
+ textError = gettext("Toggling the plugin failed, please see the log for details.");
+ }
+
+ } else if (action == "disable") {
+ if (data.hasOwnProperty("plugin")) {
+ name = data.plugin.name;
+ }
+
+ titleSuccess = _.sprintf(gettext("Plugin \"%(name)s\" disabled"), {name: name});
+ textSuccess = gettext("The plugin was disabled successfully.");
+ textRestart = gettext("The plugin was disabled successfully, however a restart of OctoPrint is needed for that to take effect.");
+ textReload = gettext("The plugin was disabled successfully, however a reload of the page is needed for that to take effect.");
+
+ titleError = gettext("Something went wrong");
+ if (data.hasOwnProperty("reason")) {
+ textError = _.sprintf(gettext("Toggling the plugin failed: %(reason)s"), {reason: data.reason});
+ } else {
+ textError = gettext("Toggling the plugin failed, please see the log for details.");
+ }
+
+ } else {
+ return;
+ }
+
+ self._displayNotification(data, titleSuccess, textSuccess, textRestart, textReload, titleError, textError);
+ self.requestData();
+ }
+ };
+ }
+
+ // view model class, parameters for constructor, container to bind to
+ ADDITIONAL_VIEWMODELS.push([PluginManagerViewModel, ["loginStateViewModel", "settingsViewModel", "printerStateViewModel"], "#settings_plugin_pluginmanager"]);
+});
diff --git a/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/plugins/pluginmanager/static/less/pluginmanager.less b/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/plugins/pluginmanager/static/less/pluginmanager.less
new file mode 100644
index 000000000..a14c2f6b3
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/plugins/pluginmanager/static/less/pluginmanager.less
@@ -0,0 +1,103 @@
+table {
+ th, td {
+ &.settings_plugin_plugin_manager_plugins_name {
+ text-overflow: ellipsis;
+ text-align: left;
+ }
+
+ &.settings_plugin_plugin_manager_plugins_actions {
+ text-align: center;
+ width: 80px;
+
+ a {
+ text-decoration: none;
+ color: #000;
+
+ &.disabled {
+ color: #ccc;
+ cursor: default;
+ }
+ }
+ }
+ }
+}
+
+#settings_plugin_pluginmanager_repositorydialog {
+ .slimScrollDiv {
+ margin-bottom: 20px;
+ }
+
+ h4 {
+ position: relative;
+
+ a.dropdown-toggle {
+ color: inherit;
+ text-decoration: none;
+ font-size: 14px;
+ }
+
+ ul.dropdown-menu {
+ font-size: 14px;
+ }
+ }
+
+ .form-search {
+ text-align: center;
+ margin-bottom: 5px !important;
+ }
+
+ .form-inline {
+ padding: 5px;
+ padding-right: 10px;
+ margin-bottom: 0;
+
+ .help-block {
+ margin-bottom: 0;
+ font-size: 85%;
+ }
+ }
+
+ #settings_plugin_pluginmanager_repositorydialog_unavailable {
+ overflow: hidden;
+ width: 100%;
+ height: 300px;
+ background-image: url("../img/repo_unavailable.png");
+ text-align: center;
+ display: table;
+
+ div {
+ display: table-cell;
+ vertical-align: middle;
+ }
+ }
+
+ #settings_plugin_pluginmanager_repositorydialog_list {
+ overflow: hidden;
+ width: auto;
+ height: 300px;
+
+ .entry {
+ border-bottom: 1px solid #ddd;
+ padding: 5px;
+ padding-right: 10px;
+ }
+ }
+}
+
+#settings_plugin_pluginmanager_workingdialog_output {
+ .message {
+ font-weight: bold;
+ }
+
+ .stdout {
+ color: #333333;
+ }
+
+ .stderr {
+ color: #990000;
+ }
+
+ .call {
+ color: #000099;
+ }
+}
diff --git a/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/plugins/pluginmanager/templates/pluginmanager_settings.jinja2 b/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/plugins/pluginmanager/templates/pluginmanager_settings.jinja2
new file mode 100644
index 000000000..d399b593c
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/plugins/pluginmanager/templates/pluginmanager_settings.jinja2
@@ -0,0 +1,243 @@
+{% macro pluginmanager_printing() %}
+
+ {{ _('Take note that all plugin management functionality is disabled while your printer is printing.') }}
+
{% trans %}
+ The pip command could not be found.
+ Please configure it manually. No installation and uninstallation of plugin
+ packages is possible while pip is unavailable.
+{% endtrans %}
{% trans %}
+ The pip command is configured to use sudo. This
+ is not recommended due to security reasons. It is strongly
+ suggested you install OctoPrint under a
+ user-owned virtual environment
+ so that the use of sudo is not needed for plugin management.
+{% endtrans %}
";
+
+ text += "" + gettext("Those components marked with can be updated directly.") + "";
+
+ var options = {
+ title: gettext("Update Available"),
+ text: text,
+ hide: false
+ };
+ var eventListeners = {};
+
+ if (data.status == "updatePossible" && self.loginState.isAdmin()) {
+ // if user is admin, add action buttons
+ options["confirm"] = {
+ confirm: true,
+ buttons: [{
+ text: gettext("Ignore"),
+ click: function() {
+ self._markNotificationAsSeen(data.information);
+ self._showPopup({
+ text: gettext("You can make this message display again via \"Settings\" > \"Software Update\" > \"Check for update now\"")
+ });
+ }
+ }, {
+ text: gettext("Update now"),
+ addClass: "btn-primary",
+ click: self.update
+ }]
+ };
+ options["buttons"] = {
+ closer: false,
+ sticker: false
+ };
+ }
+
+ if (ignoreSeen || !self._hasNotificationBeenSeen(data.information)) {
+ self._showPopup(options, eventListeners);
+ }
+ } else if (data.status == "current") {
+ if (showIfNothingNew) {
+ self._showPopup({
+ title: gettext("Everything is up-to-date"),
+ hide: false,
+ type: "success"
+ });
+ } else {
+ self._closePopup();
+ }
+ }
+ };
+
+ self.performCheck = function(showIfNothingNew, force, ignoreSeen) {
+ if (!self.loginState.isUser()) return;
+
+ var url = PLUGIN_BASEURL + "softwareupdate/check";
+ if (force) {
+ url += "?force=true";
+ }
+
+ $.ajax({
+ url: url,
+ type: "GET",
+ dataType: "json",
+ success: function(data) {
+ self.fromCheckResponse(data, ignoreSeen, showIfNothingNew);
+ }
+ });
+ };
+
+ self._markNotificationAsSeen = function(data) {
+ if (!Modernizr.localstorage)
+ return false;
+ localStorage["plugin.softwareupdate.seen_information"] = JSON.stringify(self._informationToRemoteVersions(data));
+ };
+
+ self._hasNotificationBeenSeen = function(data) {
+ if (!Modernizr.localstorage)
+ return false;
+
+ if (localStorage["plugin.softwareupdate.seen_information"] == undefined)
+ return false;
+
+ var knownData = JSON.parse(localStorage["plugin.softwareupdate.seen_information"]);
+ var freshData = self._informationToRemoteVersions(data);
+
+ var hasBeenSeen = true;
+ _.each(freshData, function(value, key) {
+ if (!_.has(knownData, key) || knownData[key] != freshData[key]) {
+ hasBeenSeen = false;
+ }
+ });
+ return hasBeenSeen;
+ };
+
+ self._informationToRemoteVersions = function(data) {
+ var result = {};
+ _.each(data, function(value, key) {
+ result[key] = value.information.remote.value;
+ });
+ return result;
+ };
+
+ self.performUpdate = function(force) {
+ self.updateInProgress = true;
+
+ var options = {
+ title: gettext("Updating..."),
+ text: gettext("Now updating, please wait."),
+ icon: "icon-cog icon-spin",
+ hide: false,
+ buttons: {
+ closer: false,
+ sticker: false
+ }
+ };
+ self._showPopup(options);
+
+ $.ajax({
+ url: PLUGIN_BASEURL + "softwareupdate/update",
+ type: "POST",
+ dataType: "json",
+ contentType: "application/json; charset=UTF-8",
+ data: JSON.stringify({force: (force == true)}),
+ error: function() {
+ self.updateInProgress = false;
+ self._showPopup({
+ title: gettext("Update not started!"),
+ text: gettext("The update could not be started. Is it already active? Please consult the log for details."),
+ type: "error",
+ hide: false,
+ buttons: {
+ sticker: false
+ }
+ });
+ },
+ success: function(data) {
+ self.currentlyBeingUpdated = data.checks;
+ }
+ });
+ };
+
+ self.update = function(force) {
+ if (self.updateInProgress) return;
+ if (!self.loginState.isAdmin()) return;
+
+ force = (force == true);
+
+ if (self.printerState.isPrinting()) {
+ self._showPopup({
+ title: gettext("Can't update while printing"),
+ text: gettext("A print job is currently in progress. Updating will be prevented until it is done."),
+ type: "error"
+ });
+ } else {
+ $("#confirmation_dialog .confirmation_dialog_message").text(gettext("This will update your OctoPrint installation and restart the server."));
+ $("#confirmation_dialog .confirmation_dialog_acknowledge").unbind("click");
+ $("#confirmation_dialog .confirmation_dialog_acknowledge").click(function(e) {
+ e.preventDefault();
+ $("#confirmation_dialog").modal("hide");
+ self.performUpdate(force);
+ });
+ $("#confirmation_dialog").modal("show");
+ }
+
+ };
+
+ self.onServerDisconnect = function() {
+ if (self.restartTimeout !== undefined) {
+ clearTimeout(self.restartTimeout);
+ }
+ return true;
+ };
+
+ self.onDataUpdaterReconnect = function() {
+ if (self.waitingForRestart) {
+ self.waitingForRestart = false;
+ self.updateInProgress = false;
+ if (!self.reloadOverlay.is(":visible")) {
+ self.reloadOverlay.show();
+ }
+ }
+ };
+
+ self.onDataUpdaterPluginMessage = function(plugin, data) {
+ if (plugin != "softwareupdate") {
+ return;
+ }
+
+ var messageType = data.type;
+ var messageData = data.data;
+
+ var options = undefined;
+
+ switch (messageType) {
+ case "updating": {
+ console.log(JSON.stringify(messageData));
+
+ var name = self.currentlyBeingUpdated[messageData.target];
+ if (name == undefined) {
+ name = messageData.target;
+ }
+
+ self._updatePopup({
+ text: _.sprintf(gettext("Now updating %(name)s to %(version)s"), {name: name, version: messageData.version})
+ });
+ break;
+ }
+ case "restarting": {
+ console.log(JSON.stringify(messageData));
+
+ options = {
+ title: gettext("Update successful, restarting!"),
+ text: gettext("The update finished successfully and the server will now be restarted."),
+ type: "success",
+ hide: false,
+ buttons: {
+ sticker: false
+ }
+ };
+
+ self.waitingForRestart = true;
+ self.restartTimeout = setTimeout(function() {
+ self._showPopup({
+ title: gettext("Restart failed"),
+ text: gettext("The server apparently did not restart by itself, you'll have to do it manually. Please consult the log file on what went wrong."),
+ type: "error",
+ hide: false,
+ buttons: {
+ sticker: false
+ }
+ });
+ self.waitingForRestart = false;
+ }, 60000);
+
+ break;
+ }
+ case "restart_manually": {
+ console.log(JSON.stringify(messageData));
+
+ var restartType = messageData.restart_type;
+ var text = gettext("The update finished successfully, please restart OctoPrint now.");
+ if (restartType == "environment") {
+ text = gettext("The update finished successfully, please reboot the server now.");
+ }
+
+ options = {
+ title: gettext("Update successful, restart required!"),
+ text: text,
+ type: "success",
+ hide: false,
+ buttons: {
+ sticker: false
+ }
+ };
+ self.updateInProgress = false;
+ break;
+ }
+ case "restart_failed": {
+ var restartType = messageData.restart_type;
+ var text = gettext("Restarting OctoPrint failed, please restart it manually. You might also want to consult the log file on what went wrong here.");
+ if (restartType == "environment") {
+ text = gettext("Rebooting the server failed, please reboot it manually. You might also want to consult the log file on what went wrong here.");
+ }
+
+ options = {
+ title: gettext("Restart failed"),
+ test: gettext("The server apparently did not restart by itself, you'll have to do it manually. Please consult the log file on what went wrong."),
+ type: "error",
+ hide: false,
+ buttons: {
+ sticker: false
+ }
+ };
+ self.waitingForRestart = false;
+ self.updateInProgress = false;
+ break;
+ }
+ case "success": {
+ options = {
+ title: gettext("Update successful!"),
+ text: gettext("The update finished successfully."),
+ type: "success",
+ hide: false,
+ buttons: {
+ sticker: false
+ }
+ };
+ self.updateInProgress = false;
+ break;
+ }
+ case "error": {
+ self._showPopup({
+ title: gettext("Update failed!"),
+ text: gettext("The update did not finish successfully. Please consult the log for details."),
+ type: "error",
+ hide: false,
+ buttons: {
+ sticker: false
+ }
+ });
+ self.updateInProgress = false;
+ break;
+ }
+ case "update_versions": {
+ self.performCheck();
+ break;
+ }
+ }
+
+ if (options != undefined) {
+ self._showPopup(options);
+ }
+ };
+
+ }
+
+ // view model class, parameters for constructor, container to bind to
+ ADDITIONAL_VIEWMODELS.push([SoftwareUpdateViewModel, ["loginStateViewModel", "printerStateViewModel", "settingsViewModel"], document.getElementById("settings_plugin_softwareupdate")]);
+});
diff --git a/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/plugins/softwareupdate/static/less/softwareupdate.less b/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/plugins/softwareupdate/static/less/softwareupdate.less
new file mode 100644
index 000000000..50939bae0
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/plugins/softwareupdate/static/less/softwareupdate.less
@@ -0,0 +1,3 @@
+td.settings_plugin_softwareupdate_column_update {
+ width: 16px;
+}
\ No newline at end of file
diff --git a/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/plugins/softwareupdate/templates/softwareupdate_settings.jinja2 b/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/plugins/softwareupdate/templates/softwareupdate_settings.jinja2
new file mode 100644
index 000000000..c3b0bdc8a
--- /dev/null
+++ b/venv/lib/python2.7/site-packages/OctoPrint-1.2.8-py2.7.egg/octoprint/plugins/softwareupdate/templates/softwareupdate_settings.jinja2
@@ -0,0 +1,104 @@
+
{% trans %}
+ Please configure the checkout folder of OctoPrint, otherwise
+ this plugin won't be able to update it. Click on the button
+ to do this. Also refer to the Documentation.
+{% endtrans %}
+
{% trans %}
+
+ You are running a non-release version of OctoPrint but are tracking OctoPrint
+ releases.
+
+ You probably want OctoPrint to track the matching development version instead.
+ If you have a local OctoPrint checkout folder switched to another branch,
+ simply switching over to "Commit" tracking will already
+ take care of that. Otherwise please take a look at the
+ Documentation.
+