Skip to content

Commit b9a7e03

Browse files
committed
Random cleanups
Remove some cruft from Sphinx config files, drop the use of 'u' prefixed strings, which are unnecessary in Python 3, and generally tidy stuff up. Change-Id: Ib0f33576e160ec842d7fc82b4fcfee99829623d7 Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
1 parent 8f50f84 commit b9a7e03

File tree

7 files changed

+18
-266
lines changed

7 files changed

+18
-266
lines changed

HACKING.rst

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,44 +5,26 @@ Nova Client Style Commandments
55
https://docs.openstack.org/hacking/latest
66
- Step 2: Read on
77

8-
98
Nova Client Specific Commandments
109
---------------------------------
1110
None so far
1211

1312
Text encoding
1413
-------------
15-
- All text within python code should be of type 'unicode'.
16-
17-
WRONG:
18-
19-
>>> s = 'foo'
20-
>>> s
21-
'foo'
22-
>>> type(s)
23-
<type 'str'>
24-
25-
RIGHT:
26-
27-
>>> u = u'foo'
28-
>>> u
29-
u'foo'
30-
>>> type(u)
31-
<type 'unicode'>
3214

3315
- Transitions between internal unicode and external strings should always
3416
be immediately and explicitly encoded or decoded.
3517

3618
- All external text that is not explicitly encoded (database storage,
3719
commandline arguments, etc.) should be presumed to be encoded as utf-8.
3820

39-
WRONG:
21+
Wrong::
4022

4123
mystring = infile.readline()
4224
myreturnstring = do_some_magic_with(mystring)
4325
outfile.write(myreturnstring)
4426

45-
RIGHT:
27+
Right::
4628

4729
mystring = infile.readline()
4830
mytext = s.decode('utf-8')
@@ -52,8 +34,8 @@ Text encoding
5234

5335
Running Tests
5436
-------------
55-
The testing system is based on a combination of tox and testr. If you just
56-
want to run the whole suite, run `tox` and all will be fine. However, if
37+
38+
The testing system is based on a combination of tox and stestr. If you just
39+
want to run the whole suite, run ``tox`` and all will be fine. However, if
5740
you'd like to dig in a bit more, you might want to learn some things about
58-
testr itself. A basic walkthrough for OpenStack can be found at
59-
http://wiki.openstack.org/testr
41+
stestr itself.

doc/source/conf.py

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,6 @@
3333
# directive.
3434
autoclass_content = 'both'
3535

36-
# Add any paths that contain templates here, relative to this directory.
37-
templates_path = ['_templates']
38-
39-
# The suffix of source filenames.
40-
source_suffix = '.rst'
41-
4236
# The master toctree document.
4337
master_doc = 'index'
4438

@@ -48,19 +42,6 @@
4842
bug_tag = 'doc'
4943
copyright = 'OpenStack Contributors'
5044

51-
# List of directories, relative to source directory, that shouldn't be searched
52-
# for source files.
53-
exclude_trees = []
54-
55-
# If true, '()' will be appended to :func: etc. cross-reference text.
56-
add_function_parentheses = True
57-
58-
# If true, the current module name will be prepended to all description
59-
# unit titles (such as .. function::).
60-
add_module_names = True
61-
62-
# The name of the Pygments (syntax highlighting) style to use.
63-
pygments_style = 'sphinx'
6445

6546
# -- Options for HTML output --------------------------------------------------
6647

@@ -72,11 +53,12 @@
7253
# robots.txt.
7354
html_extra_path = ['_extra']
7455

56+
7557
# -- Options for LaTeX output -------------------------------------------------
7658

7759
latex_documents = [
78-
('index', 'doc-python-novaclient.tex', u'python-novaclient Documentation',
79-
u'OpenStack Foundation', 'manual'),
60+
('index', 'doc-python-novaclient.tex', 'python-novaclient Documentation',
61+
'OpenStack Foundation', 'manual'),
8062
]
8163

8264
latex_elements = {

novaclient/tests/unit/test_utils.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -237,9 +237,9 @@ def test_print_list_sort_by_integer(self):
237237

238238
@mock.patch('sys.stdout', io.StringIO())
239239
def test_print_unicode_list(self):
240-
objs = [_FakeResult("k", u'\u2026')]
240+
objs = [_FakeResult("k", '\u2026')]
241241
utils.print_list(objs, ["Name", "Value"])
242-
s = u'\u2026'
242+
s = '\u2026'
243243
self.assertEqual('+------+-------+\n'
244244
'| Name | Value |\n'
245245
'+------+-------+\n'
@@ -314,9 +314,9 @@ def test_print_large_dict_list(self):
314314

315315
@mock.patch('sys.stdout', io.StringIO())
316316
def test_print_unicode_dict(self):
317-
dict = {'k': u'\u2026'}
317+
dict = {'k': '\u2026'}
318318
utils.print_dict(dict)
319-
s = u'\u2026'
319+
s = '\u2026'
320320
self.assertEqual('+----------+-------+\n'
321321
'| Property | Value |\n'
322322
'+----------+-------+\n'

novaclient/tests/unit/v2/test_hypervisors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def test_hypervisor_search(self):
109109
self.compare_to_expected(expected[idx], hyper)
110110

111111
def test_hypervisor_search_unicode(self):
112-
hypervisor_match = u'\\u5de5\\u4f5c'
112+
hypervisor_match = '\\u5de5\\u4f5c'
113113
if self.cs.api_version >= api_versions.APIVersion('2.53'):
114114
self.assertRaises(exceptions.BadRequest,
115115
self.cs.hypervisors.search,

novaclient/tests/unit/v2/test_instance_usage_audit_log.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,6 @@ def test_instance_usage_audit_log_with_before(self):
3838
'/os-instance_usage_audit_log/2016-12-10%2013%3A59%3A59.999999')
3939

4040
def test_instance_usage_audit_log_with_before_unicode(self):
41-
before = u'\\u5de5\\u4f5c'
41+
before = '\\u5de5\\u4f5c'
4242
self.assertRaises(exceptions.BadRequest,
4343
self.cs.instance_usage_audit_log.get, before)

novaclient/tests/unit/v2/test_servers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def test_list_servers(self):
5555
self.assertIsInstance(s, servers.Server)
5656

5757
def test_filter_servers_unicode(self):
58-
sl = self.cs.servers.list(search_opts={'name': u't€sting'})
58+
sl = self.cs.servers.list(search_opts={'name': 't€sting'})
5959
self.assert_request_id(sl, fakes.FAKE_REQUEST_ID_LIST)
6060
self.assert_called('GET', '/servers/detail?name=t%E2%82%ACsting')
6161
for s in sl:

releasenotes/source/conf.py

Lines changed: 2 additions & 214 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,9 @@
11
# -*- coding: utf-8 -*-
22
#
3-
# Nova Client Release Notes documentation build configuration file, created by
4-
# sphinx-quickstart on Mon Nov 23 20:38:38 2015.
5-
#
6-
# This file is execfile()d with the current directory set to its
7-
# containing dir.
8-
#
9-
# Note that not all possible configuration values are present in this
10-
# autogenerated file.
11-
#
12-
# All configuration values have a default; values that are commented out
13-
# serve to show the default.
14-
15-
# If extensions (or modules to document with autodoc) are in another directory,
16-
# add these directories to sys.path here. If the directory is relative to the
17-
# documentation root, use os.path.abspath to make it absolute, like shown here.
18-
#sys.path.insert(0, os.path.abspath('.'))
3+
# python-novaclient Release Notes documentation build configuration file
194

205
# -- General configuration ------------------------------------------------
216

22-
# If your documentation needs a minimal Sphinx version, state it here.
23-
#needs_sphinx = '1.0'
24-
257
# Add any Sphinx extension module names here, as strings. They can be
268
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
279
# ones.
@@ -30,211 +12,17 @@
3012
'openstackdocstheme',
3113
]
3214

33-
# Add any paths that contain templates here, relative to this directory.
34-
templates_path = ['_templates']
35-
36-
# The suffix of source filenames.
37-
source_suffix = '.rst'
38-
39-
# The encoding of source files.
40-
#source_encoding = 'utf-8-sig'
41-
4215
# The master toctree document.
4316
master_doc = 'index'
4417

45-
# General information about the project.
46-
copyright = u'2015, Nova developers'
47-
48-
# The language for content autogenerated by Sphinx. Refer to documentation
49-
# for a list of supported languages.
50-
#language = None
51-
52-
# There are two options for replacing |today|: either, you set today to some
53-
# non-false value, then it is used:
54-
#today = ''
55-
# Else, today_fmt is used as the format for a strftime call.
56-
#today_fmt = '%B %d, %Y'
57-
58-
# List of patterns, relative to source directory, that match files and
59-
# directories to ignore when looking for source files.
60-
exclude_patterns = []
61-
62-
# The reST default role (used for this markup: `text`) to use for all
63-
# documents.
64-
#default_role = None
65-
66-
# If true, '()' will be appended to :func: etc. cross-reference text.
67-
#add_function_parentheses = True
68-
69-
# If true, the current module name will be prepended to all description
70-
# unit titles (such as .. function::).
71-
#add_module_names = True
72-
73-
# If true, sectionauthor and moduleauthor directives will be shown in the
74-
# output. They are ignored by default.
75-
#show_authors = False
76-
77-
# The name of the Pygments (syntax highlighting) style to use.
78-
pygments_style = 'sphinx'
79-
80-
# A list of ignored prefixes for module index sorting.
81-
#modindex_common_prefix = []
82-
83-
# If true, keep warnings as "system message" paragraphs in the built documents.
84-
#keep_warnings = False
85-
8618

8719
# -- Options for HTML output ----------------------------------------------
8820

8921
# The theme to use for HTML and HTML Help pages. See the documentation for
9022
# a list of builtin themes.
9123
html_theme = 'openstackdocs'
9224

93-
# Theme options are theme-specific and customize the look and feel of a theme
94-
# further. For a list of options available for each theme, see the
95-
# documentation.
96-
#html_theme_options = {}
97-
98-
# Add any paths that contain custom themes here, relative to this directory.
99-
#html_theme_path = []
100-
101-
# The name for this set of Sphinx documents. If None, it defaults to
102-
# "<project> v<release> documentation".
103-
#html_title = None
104-
105-
# A shorter title for the navigation bar. Default is the same as html_title.
106-
#html_short_title = None
107-
108-
# The name of an image file (relative to this directory) to place at the top
109-
# of the sidebar.
110-
#html_logo = None
111-
112-
# The name of an image file (within the static path) to use as favicon of the
113-
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
114-
# pixels large.
115-
#html_favicon = None
116-
117-
# Add any paths that contain custom static files (such as style sheets) here,
118-
# relative to this directory. They are copied after the builtin static files,
119-
# so a file named "default.css" will overwrite the builtin "default.css".
120-
html_static_path = ['_static']
121-
122-
# Add any extra paths that contain custom files (such as robots.txt or
123-
# .htaccess) here, relative to this directory. These files are copied
124-
# directly to the root of the documentation.
125-
#html_extra_path = []
126-
127-
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
128-
# using the given strftime format.
129-
#html_last_updated_fmt = '%b %d, %Y'
130-
131-
# If true, SmartyPants will be used to convert quotes and dashes to
132-
# typographically correct entities.
133-
#html_use_smartypants = True
134-
135-
# Custom sidebar templates, maps document names to template names.
136-
#html_sidebars = {}
137-
138-
# Additional templates that should be rendered to pages, maps page names to
139-
# template names.
140-
#html_additional_pages = {}
141-
142-
# If false, no module index is generated.
143-
#html_domain_indices = True
144-
145-
# If false, no index is generated.
146-
#html_use_index = True
147-
148-
# If true, the index is split into individual pages for each letter.
149-
#html_split_index = False
150-
151-
# If true, links to the reST sources are added to the pages.
152-
#html_show_sourcelink = True
153-
154-
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
155-
#html_show_sphinx = True
156-
157-
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
158-
#html_show_copyright = True
159-
160-
# If true, an OpenSearch description file will be output, and all pages will
161-
# contain a <link> tag referring to it. The value of this option must be the
162-
# base URL from which the finished HTML is served.
163-
#html_use_opensearch = ''
164-
165-
# This is the file name suffix for HTML files (e.g. ".xhtml").
166-
#html_file_suffix = None
167-
168-
# Output file base name for HTML help builder.
169-
htmlhelp_basename = 'NovaClientReleaseNotestdoc'
170-
171-
172-
# -- Options for LaTeX output ---------------------------------------------
173-
174-
# Grouping the document tree into LaTeX files. List of tuples
175-
# (source start file, target name, title,
176-
# author, documentclass [howto, manual, or own class]).
177-
latex_documents = [
178-
('index', 'PythonNovaClient.tex', u'Nova Client Release Notes Documentation',
179-
u'Nova developers', 'manual'),
180-
]
181-
182-
# The name of an image file (relative to this directory) to place at the top of
183-
# the title page.
184-
#latex_logo = None
185-
186-
# For "manual" documents, if this is true, then toplevel headings are parts,
187-
# not chapters.
188-
#latex_use_parts = False
189-
190-
# If true, show page references after internal links.
191-
#latex_show_pagerefs = False
192-
193-
# If true, show URL addresses after external links.
194-
#latex_show_urls = False
195-
196-
# Documents to append as an appendix to all manuals.
197-
#latex_appendices = []
198-
199-
# If false, no module index is generated.
200-
#latex_domain_indices = True
201-
202-
203-
# -- Options for manual page output ---------------------------------------
204-
205-
# One entry per manual page. List of tuples
206-
# (source start file, name, description, authors, manual section).
207-
man_pages = [
208-
('index', 'pythonnovaclient', u'Nova Client Release Notes Documentation',
209-
[u'Nova developers'], 1)
210-
]
211-
212-
# If true, show URL addresses after external links.
213-
#man_show_urls = False
214-
215-
216-
# -- Options for Texinfo output -------------------------------------------
217-
218-
# Grouping the document tree into Texinfo files. List of tuples
219-
# (source start file, target name, title, author,
220-
# dir menu entry, description, category)
221-
texinfo_documents = [
222-
('index', 'PythonNovaClient', u'Nova Client Release Notes Documentation',
223-
u'Nova developers', 'PythonNovaClient', 'One line description of project.',
224-
'Miscellaneous'),
225-
]
226-
227-
# Documents to append as an appendix to all manuals.
228-
#texinfo_appendices = []
229-
230-
# If false, no module index is generated.
231-
#texinfo_domain_indices = True
232-
233-
# How to display URL addresses: 'footnote', 'no', or 'inline'.
234-
#texinfo_show_urls = 'footnote'
235-
236-
# If true, do not generate a @detailmenu in the "Top" node's menu.
237-
#texinfo_no_detailmenu = False
23825

23926
# -- Options for Internationalization output ------------------------------
27+
24028
locale_dirs = ['locale/']

0 commit comments

Comments
 (0)