Skip to content
This repository was archived by the owner on Mar 9, 2023. It is now read-only.

Commit e94a189

Browse files
committed
Use black for code formatting
1 parent e94b812 commit e94a189

Some content is hidden

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

67 files changed

+4432
-2897
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ foo.*
3434
.coverage
3535
.cache/
3636
.pytest_cache
37+
.mypy_cache
3738

3839
# Dynamically created doc folders
3940
doc/_build

Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ help:
1515
@echo " install to install the python dependencies for development"
1616
@echo " test to run the tests"
1717
@echo " isort to sort imports"
18+
@echo " blacken to format the code"
1819
.PHONY: help
1920

2021
clean:
@@ -47,6 +48,13 @@ check-isort:
4748
@pipenv run isort --recursive --diff --check-only $(OICDIR) $(TESTDIR)
4849
.PHONY: isort check-isort
4950

51+
blacken:
52+
@pipenv run black src/
53+
54+
check-black:
55+
@pipenv run black src/ --check
56+
.PHONY: blacken check-black
57+
5058
check-pylama:
5159
@pipenv run pylama $(OICDIR) $(TESTDIR)
5260
.PHONY: check-pylama

pylama.ini

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
linters = pyflakes,eradicate,pycodestyle,mccabe,pep257
33
# D10X - Ignore complains about missing docstrings - we want to enforce style but do not want to add all docstrings
44
# D203/D204 and D212/D213 are mutually exclusive, pick one
5-
ignore = D100,D101,D102,D103,D104,D105,D106,D107,D203,D212
5+
# E203 is not PEP8 compliant in pycodestyle
6+
ignore = D100,D101,D102,D103,D104,D105,D106,D107,D203,D212,E203
67

78
[pylama:pycodestyle]
89
max_line_length = 120

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def run_tests(self):
7575
'develop': ["cherrypy==3.2.4", "pyOpenSSL"],
7676
'testing': tests_requires,
7777
'docs': ['Sphinx', 'sphinx-autobuild', 'alabaster'],
78-
'quality': ['pylama', 'isort', 'eradicate', 'mypy'],
78+
'quality': ['pylama', 'isort', 'eradicate', 'mypy', 'black'],
7979
'ldap_authn': ['pyldap'],
8080
},
8181
install_requires=[

src/oic/__init__.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,28 @@
77
from secrets import choice
88
except ImportError:
99
import random
10+
1011
try:
1112
# Python 2.4+ if available on the platform
1213
_sysrand = random.SystemRandom()
1314
choice = _sysrand.choice
1415
except AttributeError:
1516
# Fallback, really bad
1617
import warnings
18+
1719
choice = random.choice
1820
warnings.warn(
1921
"No good random number generator available on this platform. "
2022
"Security tokens will be weak and guessable.",
21-
RuntimeWarning)
23+
RuntimeWarning,
24+
)
2225

23-
__author__ = 'Roland Hedberg'
24-
__version__ = '0.15.1'
26+
__author__ = "Roland Hedberg"
27+
__version__ = "0.15.1"
2528

2629

2730
OIDCONF_PATTERN = "%s/.well-known/openid-configuration"
28-
CC_METHOD = {
29-
'S256': hashlib.sha256,
30-
'S384': hashlib.sha384,
31-
'S512': hashlib.sha512,
32-
}
31+
CC_METHOD = {"S256": hashlib.sha256, "S384": hashlib.sha384, "S512": hashlib.sha512}
3332

3433

3534
def rndstr(size=16):
@@ -43,7 +42,7 @@ def rndstr(size=16):
4342
return "".join([choice(_basech) for _ in range(size)])
4443

4544

46-
BASECH = string.ascii_letters + string.digits + '-._~'
45+
BASECH = string.ascii_letters + string.digits + "-._~"
4746

4847

4948
def unreserved(size=64):

src/oic/exception.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__author__ = 'rohe0002'
1+
__author__ = "rohe0002"
22

33

44
class PyoidcError(Exception):

src/oic/extension/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__author__ = 'roland'
1+
__author__ = "roland"

0 commit comments

Comments
 (0)