Skip to content

Commit

Permalink
Use black for code formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
tpazderka committed Apr 12, 2019
1 parent e94b812 commit e94a189
Show file tree
Hide file tree
Showing 67 changed files with 4,432 additions and 2,897 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ foo.*
.coverage
.cache/
.pytest_cache
.mypy_cache

# Dynamically created doc folders
doc/_build
Expand Down
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ help:
@echo " install to install the python dependencies for development"
@echo " test to run the tests"
@echo " isort to sort imports"
@echo " blacken to format the code"
.PHONY: help

clean:
Expand Down Expand Up @@ -47,6 +48,13 @@ check-isort:
@pipenv run isort --recursive --diff --check-only $(OICDIR) $(TESTDIR)
.PHONY: isort check-isort

blacken:
@pipenv run black src/

check-black:
@pipenv run black src/ --check
.PHONY: blacken check-black

check-pylama:
@pipenv run pylama $(OICDIR) $(TESTDIR)
.PHONY: check-pylama
Expand Down
3 changes: 2 additions & 1 deletion pylama.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
linters = pyflakes,eradicate,pycodestyle,mccabe,pep257
# D10X - Ignore complains about missing docstrings - we want to enforce style but do not want to add all docstrings
# D203/D204 and D212/D213 are mutually exclusive, pick one
ignore = D100,D101,D102,D103,D104,D105,D106,D107,D203,D212
# E203 is not PEP8 compliant in pycodestyle
ignore = D100,D101,D102,D103,D104,D105,D106,D107,D203,D212,E203

[pylama:pycodestyle]
max_line_length = 120
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def run_tests(self):
'develop': ["cherrypy==3.2.4", "pyOpenSSL"],
'testing': tests_requires,
'docs': ['Sphinx', 'sphinx-autobuild', 'alabaster'],
'quality': ['pylama', 'isort', 'eradicate', 'mypy'],
'quality': ['pylama', 'isort', 'eradicate', 'mypy', 'black'],
'ldap_authn': ['pyldap'],
},
install_requires=[
Expand Down
17 changes: 8 additions & 9 deletions src/oic/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,28 @@
from secrets import choice
except ImportError:
import random

try:
# Python 2.4+ if available on the platform
_sysrand = random.SystemRandom()
choice = _sysrand.choice
except AttributeError:
# Fallback, really bad
import warnings

choice = random.choice
warnings.warn(
"No good random number generator available on this platform. "
"Security tokens will be weak and guessable.",
RuntimeWarning)
RuntimeWarning,
)

__author__ = 'Roland Hedberg'
__version__ = '0.15.1'
__author__ = "Roland Hedberg"
__version__ = "0.15.1"


OIDCONF_PATTERN = "%s/.well-known/openid-configuration"
CC_METHOD = {
'S256': hashlib.sha256,
'S384': hashlib.sha384,
'S512': hashlib.sha512,
}
CC_METHOD = {"S256": hashlib.sha256, "S384": hashlib.sha384, "S512": hashlib.sha512}


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


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


def unreserved(size=64):
Expand Down
2 changes: 1 addition & 1 deletion src/oic/exception.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__author__ = 'rohe0002'
__author__ = "rohe0002"


class PyoidcError(Exception):
Expand Down
2 changes: 1 addition & 1 deletion src/oic/extension/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__author__ = 'roland'
__author__ = "roland"
Loading

0 comments on commit e94a189

Please sign in to comment.