Skip to content

Commit fccbcf4

Browse files
authored
Add black (#256)
* Add black * run black
1 parent 111e2a1 commit fccbcf4

37 files changed

+1104
-2133
lines changed

README.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ python-jose
33

44
A JOSE implementation in Python
55

6-
|Github Actions CI Status| |Coverage Status| |Docs|
6+
|Github Actions CI Status| |Coverage Status| |Docs| |style|
77

88
Docs are available on ReadTheDocs_.
99

@@ -98,3 +98,6 @@ This library was originally based heavily on the work of the folks over at PyJWT
9898
.. _pycrypto: https://www.dlitz.net/software/pycrypto/
9999
.. _python-ecdsa: https://github.com/warner/python-ecdsa
100100
.. _python-rsa: https://stuvel.eu/rsa
101+
.. |style| image:: https://img.shields.io/badge/code%20style-black-000000.svg
102+
:target: https://github.com/psf/black
103+
:alt: Code style: black

docs/conf.py

Lines changed: 76 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -18,229 +18,219 @@
1818
# If extensions (or modules to document with autodoc) are in another directory,
1919
# add these directories to sys.path here. If the directory is relative to the
2020
# documentation root, use os.path.abspath to make it absolute, like shown here.
21-
#sys.path.insert(0, os.path.abspath('.'))
21+
# sys.path.insert(0, os.path.abspath('.'))
2222

23-
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
24-
sys.path.append(os.path.join(os.path.dirname(__file__), '../jose'))
25-
sys.path.append(os.path.join(os.path.dirname(__file__), '../jose/jws'))
26-
sys.path.append(os.path.join(os.path.dirname(__file__), '../jose/jwt'))
23+
sys.path.append(os.path.join(os.path.dirname(__file__), ".."))
24+
sys.path.append(os.path.join(os.path.dirname(__file__), "../jose"))
25+
sys.path.append(os.path.join(os.path.dirname(__file__), "../jose/jws"))
26+
sys.path.append(os.path.join(os.path.dirname(__file__), "../jose/jwt"))
2727

2828
# -- General configuration ------------------------------------------------
2929

3030
# If your documentation needs a minimal Sphinx version, state it here.
31-
#needs_sphinx = '1.0'
31+
# needs_sphinx = '1.0'
3232

3333
# Add any Sphinx extension module names here, as strings. They can be
3434
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
3535
# ones.
36-
extensions = [
37-
'sphinx.ext.autodoc',
38-
'sphinx.ext.coverage',
39-
'sphinx.ext.napoleon'
40-
]
36+
extensions = ["sphinx.ext.autodoc", "sphinx.ext.coverage", "sphinx.ext.napoleon"]
4137

4238
# Add any paths that contain templates here, relative to this directory.
43-
templates_path = ['_templates']
39+
templates_path = ["_templates"]
4440

4541
# The suffix of source filenames.
46-
source_suffix = '.rst'
42+
source_suffix = ".rst"
4743

4844
# The encoding of source files.
49-
#source_encoding = 'utf-8-sig'
45+
# source_encoding = 'utf-8-sig'
5046

5147
# The master toctree document.
52-
master_doc = 'index'
48+
master_doc = "index"
5349

5450
# General information about the project.
55-
project = u'python-jose'
56-
copyright = u'2015, Michael Davis'
51+
project = "python-jose"
52+
copyright = "2015, Michael Davis"
5753

5854
# The version info for the project you're documenting, acts as replacement for
5955
# |version| and |release|, also used in various other places throughout the
6056
# built documents.
6157
#
6258
# The short X.Y version.
63-
version = '0.2'
59+
version = "0.2"
6460
# The full version, including alpha/beta/rc tags.
65-
release = '0.2.0'
61+
release = "0.2.0"
6662

6763
# The language for content autogenerated by Sphinx. Refer to documentation
6864
# for a list of supported languages.
69-
#language = None
65+
# language = None
7066

7167
# There are two options for replacing |today|: either, you set today to some
7268
# non-false value, then it is used:
73-
#today = ''
69+
# today = ''
7470
# Else, today_fmt is used as the format for a strftime call.
75-
#today_fmt = '%B %d, %Y'
71+
# today_fmt = '%B %d, %Y'
7672

7773
# List of patterns, relative to source directory, that match files and
7874
# directories to ignore when looking for source files.
79-
exclude_patterns = ['_build']
75+
exclude_patterns = ["_build"]
8076

8177
# The reST default role (used for this markup: `text`) to use for all
8278
# documents.
83-
#default_role = None
79+
# default_role = None
8480

8581
# If true, '()' will be appended to :func: etc. cross-reference text.
86-
#add_function_parentheses = True
82+
# add_function_parentheses = True
8783

8884
# If true, the current module name will be prepended to all description
8985
# unit titles (such as .. function::).
90-
#add_module_names = True
86+
# add_module_names = True
9187

9288
# If true, sectionauthor and moduleauthor directives will be shown in the
9389
# output. They are ignored by default.
94-
#show_authors = False
90+
# show_authors = False
9591

9692
# The name of the Pygments (syntax highlighting) style to use.
97-
pygments_style = 'sphinx'
93+
pygments_style = "sphinx"
9894

9995
# A list of ignored prefixes for module index sorting.
100-
#modindex_common_prefix = []
96+
# modindex_common_prefix = []
10197

10298
# If true, keep warnings as "system message" paragraphs in the built documents.
103-
#keep_warnings = False
99+
# keep_warnings = False
104100

105101

106102
# -- Options for HTML output ----------------------------------------------
107103

108104
# The theme to use for HTML and HTML Help pages. See the documentation for
109105
# a list of builtin themes.
110-
html_theme = 'default'
106+
html_theme = "default"
111107

112108
# Theme options are theme-specific and customize the look and feel of a theme
113109
# further. For a list of options available for each theme, see the
114110
# documentation.
115-
#html_theme_options = {}
111+
# html_theme_options = {}
116112

117113
# Add any paths that contain custom themes here, relative to this directory.
118-
#html_theme_path = []
114+
# html_theme_path = []
119115

120116
# The name for this set of Sphinx documents. If None, it defaults to
121117
# "<project> v<release> documentation".
122-
#html_title = None
118+
# html_title = None
123119

124120
# A shorter title for the navigation bar. Default is the same as html_title.
125-
#html_short_title = None
121+
# html_short_title = None
126122

127123
# The name of an image file (relative to this directory) to place at the top
128124
# of the sidebar.
129-
#html_logo = None
125+
# html_logo = None
130126

131127
# The name of an image file (within the static path) to use as favicon of the
132128
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
133129
# pixels large.
134-
#html_favicon = None
130+
# html_favicon = None
135131

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

141137
# Add any extra paths that contain custom files (such as robots.txt or
142138
# .htaccess) here, relative to this directory. These files are copied
143139
# directly to the root of the documentation.
144-
#html_extra_path = []
140+
# html_extra_path = []
145141

146142
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
147143
# using the given strftime format.
148-
#html_last_updated_fmt = '%b %d, %Y'
144+
# html_last_updated_fmt = '%b %d, %Y'
149145

150146
# If true, SmartyPants will be used to convert quotes and dashes to
151147
# typographically correct entities.
152-
#html_use_smartypants = True
148+
# html_use_smartypants = True
153149

154150
# Custom sidebar templates, maps document names to template names.
155-
#html_sidebars = {}
151+
# html_sidebars = {}
156152

157153
# Additional templates that should be rendered to pages, maps page names to
158154
# template names.
159-
#html_additional_pages = {}
155+
# html_additional_pages = {}
160156

161157
# If false, no module index is generated.
162-
#html_domain_indices = True
158+
# html_domain_indices = True
163159

164160
# If false, no index is generated.
165-
#html_use_index = True
161+
# html_use_index = True
166162

167163
# If true, the index is split into individual pages for each letter.
168-
#html_split_index = False
164+
# html_split_index = False
169165

170166
# If true, links to the reST sources are added to the pages.
171-
#html_show_sourcelink = True
167+
# html_show_sourcelink = True
172168

173169
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
174-
#html_show_sphinx = True
170+
# html_show_sphinx = True
175171

176172
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
177-
#html_show_copyright = True
173+
# html_show_copyright = True
178174

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

184180
# This is the file name suffix for HTML files (e.g. ".xhtml").
185-
#html_file_suffix = None
181+
# html_file_suffix = None
186182

187183
# Output file base name for HTML help builder.
188-
htmlhelp_basename = 'python-josedoc'
184+
htmlhelp_basename = "python-josedoc"
189185

190186

191187
# -- Options for LaTeX output ---------------------------------------------
192188

193189
latex_elements = {
194-
# The paper size ('letterpaper' or 'a4paper').
195-
#'papersize': 'letterpaper',
196-
197-
# The font size ('10pt', '11pt' or '12pt').
198-
#'pointsize': '10pt',
199-
200-
# Additional stuff for the LaTeX preamble.
201-
#'preamble': '',
190+
# The paper size ('letterpaper' or 'a4paper').
191+
#'papersize': 'letterpaper',
192+
# The font size ('10pt', '11pt' or '12pt').
193+
#'pointsize': '10pt',
194+
# Additional stuff for the LaTeX preamble.
195+
#'preamble': '',
202196
}
203197

204198
# Grouping the document tree into LaTeX files. List of tuples
205199
# (source start file, target name, title,
206200
# author, documentclass [howto, manual, or own class]).
207201
latex_documents = [
208-
('index', 'python-jose.tex', u'python-jose Documentation',
209-
u'Michael Davis', 'manual'),
202+
("index", "python-jose.tex", "python-jose Documentation", "Michael Davis", "manual"),
210203
]
211204

212205
# The name of an image file (relative to this directory) to place at the top of
213206
# the title page.
214-
#latex_logo = None
207+
# latex_logo = None
215208

216209
# For "manual" documents, if this is true, then toplevel headings are parts,
217210
# not chapters.
218-
#latex_use_parts = False
211+
# latex_use_parts = False
219212

220213
# If true, show page references after internal links.
221-
#latex_show_pagerefs = False
214+
# latex_show_pagerefs = False
222215

223216
# If true, show URL addresses after external links.
224-
#latex_show_urls = False
217+
# latex_show_urls = False
225218

226219
# Documents to append as an appendix to all manuals.
227-
#latex_appendices = []
220+
# latex_appendices = []
228221

229222
# If false, no module index is generated.
230-
#latex_domain_indices = True
223+
# latex_domain_indices = True
231224

232225

233226
# -- Options for manual page output ---------------------------------------
234227

235228
# One entry per manual page. List of tuples
236229
# (source start file, name, description, authors, manual section).
237-
man_pages = [
238-
('index', 'python-jose', u'python-jose Documentation',
239-
[u'Michael Davis'], 1)
240-
]
230+
man_pages = [("index", "python-jose", "python-jose Documentation", ["Michael Davis"], 1)]
241231

242232
# If true, show URL addresses after external links.
243-
#man_show_urls = False
233+
# man_show_urls = False
244234

245235

246236
# -- Options for Texinfo output -------------------------------------------
@@ -249,19 +239,25 @@
249239
# (source start file, target name, title, author,
250240
# dir menu entry, description, category)
251241
texinfo_documents = [
252-
('index', 'python-jose', u'python-jose Documentation',
253-
u'Michael Davis', 'python-jose', 'One line description of project.',
254-
'Miscellaneous'),
242+
(
243+
"index",
244+
"python-jose",
245+
"python-jose Documentation",
246+
"Michael Davis",
247+
"python-jose",
248+
"One line description of project.",
249+
"Miscellaneous",
250+
),
255251
]
256252

257253
# Documents to append as an appendix to all manuals.
258-
#texinfo_appendices = []
254+
# texinfo_appendices = []
259255

260256
# If false, no module index is generated.
261-
#texinfo_domain_indices = True
257+
# texinfo_domain_indices = True
262258

263259
# How to display URL addresses: 'footnote', 'no', or 'inline'.
264-
#texinfo_show_urls = 'footnote'
260+
# texinfo_show_urls = 'footnote'
265261

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

jose/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
__version__ = "3.2.0"
2-
__author__ = 'Michael Davis'
3-
__license__ = 'MIT'
4-
__copyright__ = 'Copyright 2016 Michael Davis'
2+
__author__ = "Michael Davis"
3+
__license__ = "MIT"
4+
__copyright__ = "Copyright 2016 Michael Davis"
55

66

77
from .exceptions import ExpiredSignatureError # noqa: F401

jose/backends/_asn1.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,27 @@
1010

1111
class RsaAlgorithmIdentifier(univ.Sequence):
1212
"""ASN1 structure for recording RSA PrivateKeyAlgorithm identifiers."""
13+
1314
componentType = namedtype.NamedTypes(
14-
namedtype.NamedType("rsaEncryption", univ.ObjectIdentifier()),
15-
namedtype.NamedType("parameters", univ.Null())
15+
namedtype.NamedType("rsaEncryption", univ.ObjectIdentifier()), namedtype.NamedType("parameters", univ.Null())
1616
)
1717

1818

1919
class PKCS8PrivateKey(univ.Sequence):
2020
"""ASN1 structure for recording PKCS8 private keys."""
21+
2122
componentType = namedtype.NamedTypes(
2223
namedtype.NamedType("version", univ.Integer()),
2324
namedtype.NamedType("privateKeyAlgorithm", RsaAlgorithmIdentifier()),
24-
namedtype.NamedType("privateKey", univ.OctetString())
25+
namedtype.NamedType("privateKey", univ.OctetString()),
2526
)
2627

2728

2829
class PublicKeyInfo(univ.Sequence):
2930
"""ASN1 structure for recording PKCS8 public keys."""
31+
3032
componentType = namedtype.NamedTypes(
31-
namedtype.NamedType("algorithm", RsaAlgorithmIdentifier()),
32-
namedtype.NamedType("publicKey", univ.BitString())
33+
namedtype.NamedType("algorithm", RsaAlgorithmIdentifier()), namedtype.NamedType("publicKey", univ.BitString())
3334
)
3435

3536

0 commit comments

Comments
 (0)