Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(511)

Side by Side Diff: appengine/predator/app/__init__.py

Issue 2447253002: [Findit & Predator] Code reorg of Findit. (Closed)
Patch Set: Clean up. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 import os
2 import sys
3
4
5 # Note: this hacky file will be excluded during deployment to AppEngine.
6 # Add the checking of APPLICATION_ID is to avoid possible side-effect for local
7 # AppEngine dev-server.
8
9 if not os.environ.get('APPLICATION_ID'): # pragma: no branch.
10 _THIS_DIR = os.path.dirname(os.path.realpath(__file__))
11
12 # This hack is due to testing setup and code structure.
13 #
14 # In testing setup, the root directory appengine/predator would be the current
15 # working directory during execution of unittests; and it is automatically
16 # added to sys.path or PYTHONPATH.
17 #
18 # For code structure, we wanted the AppEngine modules or services in separate
19 # sub-directories from the root directory in order to separate the code for
20 # AppEngine from those for the actual analysis -- core algorithm.
21 #
22 # With a module or service config file app.yaml or backend-*.yaml being in a
23 # sub-directory, that sub-directory would become the current working directory
24 # when the code is deployed to AppEngine or runs with AppEngine dev-server.
25 # This constraint requires that module importing in the code is based off the
26 # sub-directory.
27 #
28 # To avoid naming conflicts for module importing, we shouldn't put the *.yaml
29 # files to the sub-directories app/frontend and app/backend. Otherwise
30 # app/frontend and app/backend have to be added to sys.path or PYTHONPATH as
31 # explained above, and that will cause naming conflicts, because both of them
32 # will have same module names like handlers/, model/, etc.
33 #
34 # As the module or service config files *.yaml are in predator/app, it should
35 # be added to sys.path so that unittests won't complain about modules being
36 # not found.
37 sys.path.insert(0, _THIS_DIR)
38
39 # This hack is because the appengine_config.py is loaded by the testing setup
40 # only if it is in the root directory appengine/predator.
41 import appengine_config # Unused Variable pylint: disable=W0612
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698