Skip to content

Commit 6fcd7f6

Browse files
Dominik NeiseStoicLoofah
authored andcommitted
reformat codebase using python/black (#87)
* reformat codebase using python/black * black -l 80 * run black --check * mention coding style * just use black without options * run black only on py3 * use yaml merge key to define a few special steps for py3 * lists cannot be merged ... my YAML foo is weak :-( * maybe conditions do the trick * bad old copy & paste * define a new job, only for style checks * fix typo; add link to black editor integration * blacken setup.py * remove accidentally added test_script
1 parent 378c10a commit 6fcd7f6

Some content is hidden

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

45 files changed

+3811
-2335
lines changed

.circleci/config.yml

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,44 @@
11
version: 2.0
22

3-
my-steps: &steps
3+
build_and_test: &build_and_test_steps
44
- checkout
55
- run: sudo pip install -r requirements.txt
6-
- run: sudo pip install flake8 pytest
7-
- run: python --version ; pip --version ; pwd ; ls -l
86
- run: pip install --user .
9-
# stop the build if there are Python syntax errors or undefined names
10-
- run: flake8 . --count --select=E9,F63,F72,F82 --show-source --statistics
11-
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
12-
- run: flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
7+
- run: sudo pip install pytest
8+
- run: python --version ; pip --version ; pwd ; ls -l
139
- run: pytest
1410

11+
1512
jobs:
13+
StyleCheck:
14+
docker:
15+
- image: circleci/python:3.7
16+
steps:
17+
- checkout
18+
- run: sudo pip install flake8 black
19+
- run: python --version ; pip --version ; pwd ; ls -l
20+
# stop the build if there are Python syntax errors or undefined names
21+
- run: flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics
22+
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
23+
- run: flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
24+
- run: black . --check
25+
26+
1627
Python2:
1728
docker:
1829
- image: circleci/python:2.7.15
19-
steps: *steps
30+
steps: *build_and_test_steps
2031

2132
Python3:
2233
docker:
2334
- image: circleci/python:3.7
24-
steps: *steps
35+
steps: *build_and_test_steps
36+
2537

2638
workflows:
2739
version: 2
2840
build:
2941
jobs:
42+
- StyleCheck
3043
- Python2
3144
- Python3

CONTRIBUTING.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,18 @@ Please submit patches by pull request where possible. Patches should add a test
1818

1919
If you are having trouble running/add/fixing tests for your patch let me know and I'll see if I can help.
2020

21+
22+
Coding Style
23+
==============
24+
25+
We'd like our code to follow PEP8 coding style in this project.
26+
We use [python/black](https://github.com/python/black) in order to make our lives easier.
27+
We propose you do the same within this project, otherwise you might be asked to
28+
reformat your pull requests.
29+
30+
It's really simple just:
31+
32+
pip install black
33+
black .
34+
35+
And [there are plugins for many editors](https://black.readthedocs.io/en/stable/editor_integration.html).

docs/source/conf.py

Lines changed: 50 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -19,32 +19,32 @@
1919
# If extensions (or modules to document with autodoc) are in another directory,
2020
# add these directories to sys.path here. If the directory is relative to the
2121
# documentation root, use os.path.abspath to make it absolute, like shown here.
22-
#sys.path.insert(0, os.path.abspath('.'))
22+
# sys.path.insert(0, os.path.abspath('.'))
2323

2424
# -- General configuration -----------------------------------------------------
2525

2626
# If your documentation needs a minimal Sphinx version, state it here.
27-
#needs_sphinx = '1.0'
27+
# needs_sphinx = '1.0'
2828

2929
# Add any Sphinx extension module names here, as strings. They can be extensions
3030
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
31-
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.pngmath', 'sphinx.ext.viewcode']
31+
extensions = ["sphinx.ext.autodoc", "sphinx.ext.pngmath", "sphinx.ext.viewcode"]
3232

3333
# Add any paths that contain templates here, relative to this directory.
34-
templates_path = ['_templates']
34+
templates_path = ["_templates"]
3535

3636
# The suffix of source filenames.
37-
source_suffix = '.rst'
37+
source_suffix = ".rst"
3838

3939
# The encoding of source files.
40-
#source_encoding = 'utf-8-sig'
40+
# source_encoding = 'utf-8-sig'
4141

4242
# The master toctree document.
43-
master_doc = 'index'
43+
master_doc = "index"
4444

4545
# General information about the project.
46-
project = u'sc2reader'
47-
copyright = u'2011-2013'
46+
project = u"sc2reader"
47+
copyright = u"2011-2013"
4848

4949
# The version info for the project you're documenting, acts as replacement for
5050
# |version| and |release|, also used in various other places throughout the
@@ -58,163 +58,159 @@
5858

5959
# The language for content autogenerated by Sphinx. Refer to documentation
6060
# for a list of supported languages.
61-
#language = None
61+
# language = None
6262

6363
# There are two options for replacing |today|: either, you set today to some
6464
# non-false value, then it is used:
65-
#today = ''
65+
# today = ''
6666
# Else, today_fmt is used as the format for a strftime call.
67-
#today_fmt = '%B %d, %Y'
67+
# today_fmt = '%B %d, %Y'
6868

6969
# List of patterns, relative to source directory, that match files and
7070
# directories to ignore when looking for source files.
7171
exclude_patterns = []
7272

7373
# The reST default role (used for this markup: `text`) to use for all documents.
74-
#default_role = None
74+
# default_role = None
7575

7676
# If true, '()' will be appended to :func: etc. cross-reference text.
77-
#add_function_parentheses = True
77+
# add_function_parentheses = True
7878

7979
# If true, the current module name will be prepended to all description
8080
# unit titles (such as .. function::).
81-
#add_module_names = True
81+
# add_module_names = True
8282

8383
# If true, sectionauthor and moduleauthor directives will be shown in the
8484
# output. They are ignored by default.
85-
#show_authors = False
85+
# show_authors = False
8686

8787
# The name of the Pygments (syntax highlighting) style to use.
88-
pygments_style = 'sphinx'
88+
pygments_style = "sphinx"
8989

9090
# A list of ignored prefixes for module index sorting.
91-
#modindex_common_prefix = []
91+
# modindex_common_prefix = []
9292

9393

9494
# -- Options for HTML output ---------------------------------------------------
9595

9696
# The theme to use for HTML and HTML Help pages. See the documentation for
9797
# a list of builtin themes.
98-
html_theme = 'nature'
98+
html_theme = "nature"
9999

100100
# Theme options are theme-specific and customize the look and feel of a theme
101101
# further. For a list of options available for each theme, see the
102102
# documentation.
103-
#html_theme_options = {}
103+
# html_theme_options = {}
104104

105105
# Add any paths that contain custom themes here, relative to this directory.
106-
#html_theme_path = []
106+
# html_theme_path = []
107107

108108
# The name for this set of Sphinx documents. If None, it defaults to
109109
# "<project> v<release> documentation".
110-
#html_title = None
110+
# html_title = None
111111

112112
# A shorter title for the navigation bar. Default is the same as html_title.
113-
#html_short_title = None
113+
# html_short_title = None
114114

115115
# The name of an image file (relative to this directory) to place at the top
116116
# of the sidebar.
117-
#html_logo = None
117+
# html_logo = None
118118

119119
# The name of an image file (within the static path) to use as favicon of the
120120
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
121121
# pixels large.
122-
#html_favicon = None
122+
# html_favicon = None
123123

124124
# Add any paths that contain custom static files (such as style sheets) here,
125125
# relative to this directory. They are copied after the builtin static files,
126126
# so a file named "default.css" will overwrite the builtin "default.css".
127-
html_static_path = ['_static']
127+
html_static_path = ["_static"]
128128

129129
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
130130
# using the given strftime format.
131-
#html_last_updated_fmt = '%b %d, %Y'
131+
# html_last_updated_fmt = '%b %d, %Y'
132132

133133
# If true, SmartyPants will be used to convert quotes and dashes to
134134
# typographically correct entities.
135-
#html_use_smartypants = True
135+
# html_use_smartypants = True
136136

137137
# Custom sidebar templates, maps document names to template names.
138-
#html_sidebars = {}
138+
# html_sidebars = {}
139139

140140
# Additional templates that should be rendered to pages, maps page names to
141141
# template names.
142-
#html_additional_pages = {}
142+
# html_additional_pages = {}
143143

144144
# If false, no module index is generated.
145-
#html_domain_indices = True
145+
# html_domain_indices = True
146146

147147
# If false, no index is generated.
148-
#html_use_index = True
148+
# html_use_index = True
149149

150150
# If true, the index is split into individual pages for each letter.
151-
#html_split_index = False
151+
# html_split_index = False
152152

153153
# If true, links to the reST sources are added to the pages.
154-
#html_show_sourcelink = True
154+
# html_show_sourcelink = True
155155

156156
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
157-
#html_show_sphinx = True
157+
# html_show_sphinx = True
158158

159159
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
160-
#html_show_copyright = True
160+
# html_show_copyright = True
161161

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

167167
# This is the file name suffix for HTML files (e.g. ".xhtml").
168-
#html_file_suffix = None
168+
# html_file_suffix = None
169169

170170
# Output file base name for HTML help builder.
171-
htmlhelp_basename = 'sc2readerdoc'
171+
htmlhelp_basename = "sc2readerdoc"
172172

173173

174174
# -- Options for LaTeX output --------------------------------------------------
175175

176176
# The paper size ('letter' or 'a4').
177-
#latex_paper_size = 'letter'
177+
# latex_paper_size = 'letter'
178178

179179
# The font size ('10pt', '11pt' or '12pt').
180-
#latex_font_size = '10pt'
180+
# latex_font_size = '10pt'
181181

182182
# Grouping the document tree into LaTeX files. List of tuples
183183
# (source start file, target name, title, author, documentclass [howto/manual]).
184184
latex_documents = [
185-
('index', 'sc2reader.tex', u'sc2reader Documentation',
186-
u'Graylin Kim', 'manual'),
185+
("index", "sc2reader.tex", u"sc2reader Documentation", u"Graylin Kim", "manual")
187186
]
188187

189188
# The name of an image file (relative to this directory) to place at the top of
190189
# the title page.
191-
#latex_logo = None
190+
# latex_logo = None
192191

193192
# For "manual" documents, if this is true, then toplevel headings are parts,
194193
# not chapters.
195-
#latex_use_parts = False
194+
# latex_use_parts = False
196195

197196
# If true, show page references after internal links.
198-
#latex_show_pagerefs = False
197+
# latex_show_pagerefs = False
199198

200199
# If true, show URL addresses after external links.
201-
#latex_show_urls = False
200+
# latex_show_urls = False
202201

203202
# Additional stuff for the LaTeX preamble.
204-
#latex_preamble = ''
203+
# latex_preamble = ''
205204

206205
# Documents to append as an appendix to all manuals.
207-
#latex_appendices = []
206+
# latex_appendices = []
208207

209208
# If false, no module index is generated.
210-
#latex_domain_indices = True
209+
# latex_domain_indices = True
211210

212211

213212
# -- Options for manual page output --------------------------------------------
214213

215214
# One entry per manual page. List of tuples
216215
# (source start file, name, description, authors, manual section).
217-
man_pages = [
218-
('index', 'sc2reader', u'sc2reader Documentation',
219-
[u'Graylin Kim'], 1)
220-
]
216+
man_pages = [("index", "sc2reader", u"sc2reader Documentation", [u"Graylin Kim"], 1)]

0 commit comments

Comments
 (0)