Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
240e9d6
Science fiction for expense report example application.
tseaver Aug 28, 2014
6a913d3
Update science-fiction CLI.
tseaver Oct 3, 2014
580fb03
Initial CLI skeleton to support datastore narrative example.
tseaver Oct 3, 2014
01d8f95
PEP8
tseaver Oct 9, 2014
6426aba
Suppress two useless PEP8 errors.
tseaver Oct 9, 2014
943f9df
Progress toward sample implementation.
tseaver Oct 13, 2014
e95392e
Get exp report creation actually working.
tseaver Oct 20, 2014
4f8c242
Use same Oauth envvars as regression tests.
tseaver Oct 22, 2014
d9c3af1
Enforce distinction between creating / updating expense reports.
tseaver Oct 22, 2014
afb287e
Add 'delete' command.
tseaver Oct 22, 2014
e836913
Add checks for valid report status to update / delete commands.
tseaver Oct 22, 2014
ebae693
Record metadata (description, created, updated) for expense reports.
tseaver Oct 22, 2014
666b6a4
Make 'review_expenses list' work with live data.
tseaver Oct 22, 2014
578d40a
Make 'review_expenses show' work with live data.
tseaver Oct 22, 2014
31dd159
Housekeeping.
tseaver Oct 22, 2014
7da8592
Reconcile command output w/ Sphinx.
tseaver Oct 22, 2014
7a58c95
Drop unneeded base exception.
tseaver Oct 22, 2014
b209068
Get 'review_expenses {approve,reject}' working w/ live data.
tseaver Oct 22, 2014
a98b440
Wire in the datastore narrative example.
tseaver Oct 22, 2014
42ecfe8
'csv' is not a known highlight syntax.
tseaver Oct 22, 2014
10e9f9f
Describe top-down flow of creating an expense report from a CSV file.
tseaver Oct 22, 2014
5090a3b
Add narrative for 'update_report'.
tseaver Oct 22, 2014
44812da
Typos, clarifications.
tseaver Oct 23, 2014
911ed7c
Add discussion of 'review_expenses list'.
tseaver Oct 23, 2014
8eadf43
Require 'employee_id' arg for 'review_expenses show'.
tseaver Oct 23, 2014
7f38c3a
Add discussion of 'review_expenses show'.
tseaver Oct 23, 2014
239d86f
Add discussion of 'review_expenses {approve,reject}'.
tseaver Oct 23, 2014
021b797
Cross-ref overview narrative to functional sections.
tseaver Oct 23, 2014
1579110
Add discussion of 'submit_expenses delete'.
tseaver Oct 23, 2014
4879512
Typo.
tseaver Oct 23, 2014
bdc32ab
Revert "Suppress two useless PEP8 errors."
tseaver Oct 23, 2014
bf5e420
PEP8.
tseaver Oct 23, 2014
b7e7f9c
pylint (reduced set, as in tests / demos / regression).
tseaver Oct 23, 2014
64cc17a
Typos.
tseaver Oct 23, 2014
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
PEP8
  • Loading branch information
tseaver committed Oct 23, 2014
commit 01d8f95fb8b2df9eb48aac80c6cbb8b2b2fbeccd
2 changes: 1 addition & 1 deletion docs/examples/expenses/expenses/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
#package
# package
2 changes: 1 addition & 1 deletion docs/examples/expenses/expenses/scripts/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
#package
# package
12 changes: 6 additions & 6 deletions docs/examples/expenses/expenses/scripts/review_expenses.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class InvalidCommandLine(ValueError):
class NotACommand(object):
def __init__(self, bogus):
self.bogus = bogus

def __call__(self):
raise InvalidCommandLine('Not a command: %s' % self.bogus)

Expand All @@ -21,8 +22,7 @@ def _get_csv(args):
csv_file, = args
except:
raise InvalidCommandLine('Specify one CSV file')
csv_file = os.path.abspath(
os.path.normpath(csv_file))
csv_file = os.path.abspath(os.path.normpath(csv_file))
if not os.path.exists(csv_file):
raise InvalidCommandLine('Invalid CSV file: %s' % csv_file)
with open(csv_file) as f:
Expand Down Expand Up @@ -76,7 +76,7 @@ def list_reports(self):
]

def __call__(self):
fieldnames = ["Report ID","Description","Status","Memo"]
fieldnames = ["Report ID", "Description", "Status", "Memo"]
writer = csv.DictWriter(sys.stdout, fieldnames)
writer.writerow(dict(zip(fieldnames, fieldnames)))
for report in self.list_reports():
Expand Down Expand Up @@ -195,7 +195,7 @@ def get_description(command):


class ReviewExpenses(object):
""" Driver for the :command:`review_expenses` command-line script.
""" Driver for the :command:`review_expenses` command-line script.
"""
def __init__(self, argv=None, logger=None):
self.commands = []
Expand Down Expand Up @@ -281,7 +281,7 @@ def __call__(self):
for command in self.commands:
command()

def _print(self, text): # pragma NO COVERAGE
def _print(self, text): # pragma NO COVERAGE
print(text)

def error(self, text):
Expand All @@ -295,6 +295,6 @@ def blather(self, text, min_level=1):
def main(argv=sys.argv[1:]):
try:
ReviewExpenses(argv)()
except InvalidCommandLine as e: #pragma NO COVERAGE
except InvalidCommandLine as e: # pragma NO COVERAGE
print(str(e))
sys.exit(1)
11 changes: 5 additions & 6 deletions docs/examples/expenses/expenses/scripts/submit_expenses.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class InvalidCommandLine(ValueError):
class NotACommand(object):
def __init__(self, bogus):
self.bogus = bogus

def __call__(self):
raise InvalidCommandLine('Not a command: %s' % self.bogus)

Expand All @@ -21,8 +22,7 @@ def _get_csv(args):
csv_file, = args
except:
raise InvalidCommandLine('Specify one CSV file')
csv_file = os.path.abspath(
os.path.normpath(csv_file))
csv_file = os.path.abspath(os.path.normpath(csv_file))
if not os.path.exists(csv_file):
raise InvalidCommandLine('Invalid CSV file: %s' % csv_file)
with open(csv_file) as f:
Expand Down Expand Up @@ -86,7 +86,6 @@ def __call__(self):
self.submitter.blather("Updated, report ID: %s" % self.report_id)



_COMMANDS = {
'create': CreateReport,
'update': UpdateReport,
Expand All @@ -102,7 +101,7 @@ def get_description(command):


class SubmitExpenses(object):
""" Driver for the :command:`submit_expenses` command-line script.
""" Driver for the :command:`submit_expenses` command-line script.
"""
def __init__(self, argv=None, logger=None):
self.commands = []
Expand Down Expand Up @@ -188,7 +187,7 @@ def __call__(self):
for command in self.commands:
command()

def _print(self, text): # pragma NO COVERAGE
def _print(self, text): # pragma NO COVERAGE
print(text)

def error(self, text):
Expand All @@ -202,6 +201,6 @@ def blather(self, text, min_level=1):
def main(argv=sys.argv[1:]):
try:
SubmitExpenses(argv)()
except InvalidCommandLine as e: #pragma NO COVERAGE
except InvalidCommandLine as e: # pragma NO COVERAGE
print(str(e))
sys.exit(1)
2 changes: 1 addition & 1 deletion docs/examples/expenses/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
install_requires=[
'gcloud',
],
entry_points = {
entry_points={
'console_scripts': [
'submit_expenses = expenses.scripts.submit_expenses:main',
'review_expenses = expenses.scripts.review_expenses:main',
Expand Down