Skip to content

Commit a3fb50b

Browse files
committed
Merge pull request #83 from zachlowry/code-cleanup-and-fixes
Code cleanup and fixes
2 parents 0157d26 + 9b9ffb5 commit a3fb50b

Some content is hidden

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

75 files changed

+890
-533
lines changed

docs/source/conf.py

Lines changed: 52 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,19 @@
2222

2323
# -- General configuration ------------------------------------------------
2424

25+
2526
# Ensure that the __init__ method gets documented.
2627
def skip(app, what, name, obj, skip, options):
2728
if name == "__init__":
2829
return False
2930
return skip
3031

32+
3133
def setup(app):
3234
app.connect("autodoc-skip-member", skip)
3335

3436
# If your documentation needs a minimal Sphinx version, state it here.
35-
#needs_sphinx = '1.0'
37+
# #needs_sphinx = '1.0'
3638

3739
# Add any Sphinx extension module names here, as strings. They can be
3840
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
@@ -48,7 +50,7 @@ def setup(app):
4850
source_suffix = '.rst'
4951

5052
# The encoding of source files.
51-
#source_encoding = 'utf-8-sig'
53+
# #source_encoding = 'utf-8-sig'
5254

5355
# The master toctree document.
5456
master_doc = 'index'
@@ -68,41 +70,41 @@ def setup(app):
6870

6971
# The language for content autogenerated by Sphinx. Refer to documentation
7072
# for a list of supported languages.
71-
#language = None
73+
# #language = None
7274

7375
# There are two options for replacing |today|: either, you set today to some
7476
# non-false value, then it is used:
75-
#today = ''
77+
# #today = ''
7678
# Else, today_fmt is used as the format for a strftime call.
77-
#today_fmt = '%B %d, %Y'
79+
# #today_fmt = '%B %d, %Y'
7880

7981
# List of patterns, relative to source directory, that match files and
8082
# directories to ignore when looking for source files.
8183
exclude_patterns = []
8284

8385
# The reST default role (used for this markup: `text`) to use for all
8486
# documents.
85-
#default_role = None
87+
# #default_role = None
8688

8789
# If true, '()' will be appended to :func: etc. cross-reference text.
88-
#add_function_parentheses = True
90+
# #add_function_parentheses = True
8991

9092
# If true, the current module name will be prepended to all description
9193
# unit titles (such as .. function::).
92-
#add_module_names = True
94+
# #add_module_names = True
9395

9496
# If true, sectionauthor and moduleauthor directives will be shown in the
9597
# output. They are ignored by default.
96-
#show_authors = False
98+
# #show_authors = False
9799

98100
# The name of the Pygments (syntax highlighting) style to use.
99101
pygments_style = 'sphinx'
100102

101103
# A list of ignored prefixes for module index sorting.
102-
#modindex_common_prefix = []
104+
# #modindex_common_prefix = []
103105

104106
# If true, keep warnings as "system message" paragraphs in the built documents.
105-
#keep_warnings = False
107+
# #keep_warnings = False
106108

107109

108110
# -- Options for HTML output ----------------------------------------------
@@ -114,26 +116,26 @@ def setup(app):
114116
# Theme options are theme-specific and customize the look and feel of a theme
115117
# further. For a list of options available for each theme, see the
116118
# documentation.
117-
#html_theme_options = {}
119+
# #html_theme_options = {}
118120

119121
# Add any paths that contain custom themes here, relative to this directory.
120-
#html_theme_path = []
122+
# #html_theme_path = []
121123

122124
# The name for this set of Sphinx documents. If None, it defaults to
123125
# "<project> v<release> documentation".
124-
#html_title = None
126+
# #html_title = None
125127

126128
# A shorter title for the navigation bar. Default is the same as html_title.
127-
#html_short_title = None
129+
# #html_short_title = None
128130

129131
# The name of an image file (relative to this directory) to place at the top
130132
# of the sidebar.
131-
#html_logo = None
133+
# #html_logo = None
132134

133135
# The name of an image file (within the static path) to use as favicon of the
134136
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
135137
# pixels large.
136-
#html_favicon = None
138+
# #html_favicon = None
137139

138140
# Add any paths that contain custom static files (such as style sheets) here,
139141
# relative to this directory. They are copied after the builtin static files,
@@ -143,93 +145,92 @@ def setup(app):
143145
# Add any extra paths that contain custom files (such as robots.txt or
144146
# .htaccess) here, relative to this directory. These files are copied
145147
# directly to the root of the documentation.
146-
#html_extra_path = []
148+
# #html_extra_path = []
147149

148150
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
149151
# using the given strftime format.
150-
#html_last_updated_fmt = '%b %d, %Y'
152+
# #html_last_updated_fmt = '%b %d, %Y'
151153

152154
# If true, SmartyPants will be used to convert quotes and dashes to
153155
# typographically correct entities.
154-
#html_use_smartypants = True
156+
# #html_use_smartypants = True
155157

156158
# Custom sidebar templates, maps document names to template names.
157-
#html_sidebars = {}
159+
# #html_sidebars = {}
158160

159161
# Additional templates that should be rendered to pages, maps page names to
160162
# template names.
161-
#html_additional_pages = {}
163+
# #html_additional_pages = {}
162164

163165
# If false, no module index is generated.
164-
#html_domain_indices = True
166+
# #html_domain_indices = True
165167

166168
# If false, no index is generated.
167-
#html_use_index = True
169+
# #html_use_index = True
168170

169171
# If true, the index is split into individual pages for each letter.
170-
#html_split_index = False
172+
# #html_split_index = False
171173

172174
# If true, links to the reST sources are added to the pages.
173-
#html_show_sourcelink = True
175+
# #html_show_sourcelink = True
174176

175177
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
176-
#html_show_sphinx = True
178+
# #html_show_sphinx = True
177179

178180
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
179-
#html_show_copyright = True
181+
# #html_show_copyright = True
180182

181183
# If true, an OpenSearch description file will be output, and all pages will
182184
# contain a <link> tag referring to it. The value of this option must be the
183185
# base URL from which the finished HTML is served.
184-
#html_use_opensearch = ''
186+
# #html_use_opensearch = ''
185187

186188
# This is the file name suffix for HTML files (e.g. ".xhtml").
187-
#html_file_suffix = None
189+
# #html_file_suffix = None
188190

189191
# Output file base name for HTML help builder.
190192
htmlhelp_basename = 'TinCanPythondoc'
191193

192194

193195
# -- Options for LaTeX output ---------------------------------------------
194196

195-
latex_elements = {
196197
# The paper size ('letterpaper' or 'a4paper').
197-
#'papersize': 'letterpaper',
198+
# #'papersize': 'letterpaper',
198199

199200
# The font size ('10pt', '11pt' or '12pt').
200-
#'pointsize': '10pt',
201+
# #'pointsize': '10pt',
201202

202203
# Additional stuff for the LaTeX preamble.
203-
#'preamble': '',
204-
}
204+
# #'preamble': '',
205+
latex_elements = {}
205206

206207
# Grouping the document tree into LaTeX files. List of tuples
207208
# (source start file, target name, title,
208209
# author, documentclass [howto, manual, or own class]).
209210
latex_documents = [
210-
('index', 'TinCanPython.tex', u'Tin Can Python Documentation',
211-
u'Rustici Software', 'manual'),
211+
('index', 'TinCanPython.tex', u'Tin Can Python Documentation',
212+
u'Rustici Software', 'manual'),
212213
]
213214

214215
# The name of an image file (relative to this directory) to place at the top of
215216
# the title page.
216-
#latex_logo = None
217+
# #latex_logo = None
217218

218219
# For "manual" documents, if this is true, then toplevel headings are parts,
219220
# not chapters.
220-
#latex_use_parts = False
221+
# #latex_use_parts = False
221222

222223
# If true, show page references after internal links.
223-
#latex_show_pagerefs = False
224+
# #latex_show_pagerefs = False
224225

225226
# If true, show URL addresses after external links.
226-
#latex_show_urls = False
227+
# #latex_show_urls = False
227228

228229
# Documents to append as an appendix to all manuals.
229-
#latex_appendices = []
230+
# #latex_appendices = []
230231

231232
# If false, no module index is generated.
232-
#latex_domain_indices = True
233+
# #latex_domain_indices = True
233234

234235

235236
# -- Options for manual page output ---------------------------------------
@@ -242,7 +243,7 @@ def setup(app):
242243
]
243244

244245
# If true, show URL addresses after external links.
245-
#man_show_urls = False
246+
# #man_show_urls = False
246247

247248

248249
# -- Options for Texinfo output -------------------------------------------
@@ -251,19 +252,19 @@ def setup(app):
251252
# (source start file, target name, title, author,
252253
# dir menu entry, description, category)
253254
texinfo_documents = [
254-
('index', 'TinCanPython', u'Tin Can Python Documentation',
255-
u'Rustici Software', 'TinCanPython', 'One line description of project.',
256-
'Miscellaneous'),
255+
('index', 'TinCanPython', u'Tin Can Python Documentation',
256+
u'Rustici Software', 'TinCanPython',
257+
'One line description of project.', 'Miscellaneous'),
257258
]
258259

259260
# Documents to append as an appendix to all manuals.
260-
#texinfo_appendices = []
261+
# #texinfo_appendices = []
261262

262263
# If false, no module index is generated.
263-
#texinfo_domain_indices = True
264+
# #texinfo_domain_indices = True
264265

265266
# How to display URL addresses: 'footnote', 'no', or 'inline'.
266-
#texinfo_show_urls = 'footnote'
267+
# #texinfo_show_urls = 'footnote'
267268

268269
# If true, do not generate a @detailmenu in the "Top" node's menu.
269-
#texinfo_no_detailmenu = False
270+
# #texinfo_no_detailmenu = False

examples/example_script.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# An example script showing the functionality of the TinCanPython Library
22

33
import uuid
4+
45
from resources import lrs_properties
56
from tincan import (
67
RemoteLRS,
@@ -14,6 +15,7 @@
1415
StateDocument,
1516
)
1617

18+
1719
# construct an LRS
1820
print "constructing the LRS..."
1921
lrs = RemoteLRS(
@@ -59,7 +61,7 @@
5961
name='Lord TinCan',
6062
mbox='mailto:lordtincan@tincanapi.com',
6163
),
62-
#language='en-US',
64+
# language='en-US',
6365
)
6466
print "...done"
6567

@@ -105,7 +107,7 @@
105107
# we can query our statements using an object
106108
# constructing the query object with common fields
107109
# note: more information about queries can be found in the API documentation:
108-
# docs/build/html/tincan.html#module-tincan.remote_lrs
110+
# docs/build/html/tincan.html#module-tincan.remote_lrs
109111
query = {
110112
"agent": actor,
111113
"verb": verb,

setup.cfg

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
[metadata]
22
description-file = README.md
3+
4+
[pep8]
5+
max-line-length = 120

test/about_test.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2014 Rustici Software
1+
# Copyright 2014 Rustici Software
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -16,13 +16,13 @@
1616

1717
if __name__ == '__main__':
1818
from main import setup_tincan_path
19+
1920
setup_tincan_path()
2021
from test_utils import TinCanBaseTestCase
2122
from tincan import Version, About
2223

2324

2425
class AboutTest(TinCanBaseTestCase):
25-
2626
def test_defaults(self):
2727
a = About()
2828
self.assertEqual(a.version, [Version.latest])
@@ -83,4 +83,4 @@ def test_bad_version_init(self):
8383

8484
if __name__ == '__main__':
8585
suite = unittest.TestLoader().loadTestsFromTestCase(AboutTest)
86-
unittest.TextTestRunner(verbosity=2).run(suite)
86+
unittest.TextTestRunner(verbosity=2).run(suite)

test/activity_test.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2014 Rustici Software
1+
# Copyright 2014 Rustici Software
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -16,6 +16,7 @@
1616

1717
if __name__ == '__main__':
1818
from main import setup_tincan_path
19+
1920
setup_tincan_path()
2021
from tincan import (
2122
Activity,
@@ -26,7 +27,6 @@
2627

2728

2829
class ActivityTest(unittest.TestCase):
29-
3030
def test_InitEmpty(self):
3131
activity = Activity()
3232
self.assertIsNone(activity.id)
@@ -95,7 +95,7 @@ def test_ToJSONFromJSON(self):
9595

9696
def test_ToJSON(self):
9797
check_str = '{"definition": {}, "id": "test", "objectType": "Activity"}'
98-
activity = Activity(**{'id':'test', 'definition':{}, 'object_type':'Activity'})
98+
activity = Activity(**{'id': 'test', 'definition': {}, 'object_type': 'Activity'})
9999
self.assertEqual(activity.to_json(), check_str)
100100

101101
def test_setDefinitionException(self):
@@ -128,6 +128,7 @@ def activityVerificationHelper(self, activity):
128128
self.assertIsInstance(activity.definition, ActivityDefinition)
129129
self.assertEqual(activity.object_type, 'Activity')
130130

131+
131132
if __name__ == '__main__':
132133
suite = unittest.TestLoader().loadTestsFromTestCase(ActivityTest)
133134
unittest.TextTestRunner(verbosity=2).run(suite)

0 commit comments

Comments
 (0)