Skip to content

Commit d0eebd9

Browse files
committed
Switch to black formatting
1 parent 47ee3f5 commit d0eebd9

File tree

123 files changed

+5097
-5673
lines changed

Some content is hidden

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

123 files changed

+5097
-5673
lines changed

.pre-commit-config.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
repos:
2+
- repo: https://github.com/ambv/black
3+
rev: stable
4+
hooks:
5+
- id: black
6+
python_version: python3.6

.travis.yml

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
language: python
22

3-
matrix:
3+
stages:
4+
- linting
5+
- test
6+
7+
cache:
8+
pip: true
9+
directories:
10+
- $HOME/.cache/pypoetry
11+
12+
jobs:
413
fast_finish: true
514
include:
615
- python: 2.7
@@ -25,15 +34,18 @@ matrix:
2534
env: PENDULUM_EXTENSIONS=0
2635
- python: pypy
2736
- python: pypy3
37+
38+
- stage: linting
39+
python: "3.6"
40+
install:
41+
- pip install pre-commit
42+
- pre-commit install-hooks
43+
script:
44+
- pre-commit run --all-files
2845
allow_failures:
2946
- python: pypy
3047
- python: pypy3
3148

32-
cache:
33-
pip: true
34-
directories:
35-
- $HOME/.cache/pypoetry
36-
3749
before_install:
3850
- pip install codecov
3951

build.py

Lines changed: 16 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,24 @@
44

55
from distutils.core import Extension
66

7-
from distutils.errors import (CCompilerError, DistutilsExecError,
8-
DistutilsPlatformError)
7+
from distutils.errors import CCompilerError, DistutilsExecError, DistutilsPlatformError
98
from distutils.command.build_ext import build_ext
109

1110

1211
# C Extensions
13-
with_extensions = os.getenv('PENDULUM_EXTENSIONS', None)
12+
with_extensions = os.getenv("PENDULUM_EXTENSIONS", None)
1413

15-
if with_extensions == '1' or with_extensions is None:
14+
if with_extensions == "1" or with_extensions is None:
1615
with_extensions = True
1716

18-
if with_extensions == '0' or hasattr(sys, 'pypy_version_info'):
17+
if with_extensions == "0" or hasattr(sys, "pypy_version_info"):
1918
with_extensions = False
2019

2120
extensions = []
2221
if with_extensions:
2322
extensions = [
24-
Extension('pendulum._extensions._helpers',
25-
['pendulum/_extensions/_helpers.c']),
26-
Extension('pendulum.parsing._iso8601',
27-
['pendulum/parsing/_iso8601.c']),
23+
Extension("pendulum._extensions._helpers", ["pendulum/_extensions/_helpers.c"]),
24+
Extension("pendulum.parsing._iso8601", ["pendulum/parsing/_iso8601.c"]),
2825
]
2926

3027

@@ -40,39 +37,23 @@ def run(self):
4037
try:
4138
build_ext.run(self)
4239
except (DistutilsPlatformError, FileNotFoundError):
43-
print(
44-
"************************************************************"
45-
)
46-
print(
47-
"Cannot compile C accelerator module, use pure python version"
48-
)
49-
print(
50-
"************************************************************"
51-
)
40+
print("************************************************************")
41+
print("Cannot compile C accelerator module, use pure python version")
42+
print("************************************************************")
5243

5344
def build_extension(self, ext):
5445
try:
5546
build_ext.build_extension(self, ext)
56-
except (CCompilerError, DistutilsExecError,
57-
DistutilsPlatformError, ValueError):
58-
print(
59-
"************************************************************"
60-
)
61-
print(
62-
"Cannot compile C accelerator module, use pure python version"
63-
)
64-
print(
65-
"************************************************************"
66-
)
47+
except (CCompilerError, DistutilsExecError, DistutilsPlatformError, ValueError):
48+
print("************************************************************")
49+
print("Cannot compile C accelerator module, use pure python version")
50+
print("************************************************************")
6751

6852

6953
def build(setup_kwargs):
7054
"""
7155
This function is mandatory in order to build the extensions.
7256
"""
73-
setup_kwargs.update({
74-
'ext_modules': extensions,
75-
'cmdclass': {
76-
'build_ext': ExtBuilder
77-
}
78-
})
57+
setup_kwargs.update(
58+
{"ext_modules": extensions, "cmdclass": {"build_ext": ExtBuilder}}
59+
)

0 commit comments

Comments
 (0)