Skip to content

Commit 69760d9

Browse files
committed
reorder pre-commit config
Committed via https://github.com/asottile/all-repos
1 parent fb7f6d8 commit 69760d9

File tree

13 files changed

+108
-74
lines changed

13 files changed

+108
-74
lines changed

.pre-commit-config.yaml

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,33 @@ repos:
66
- id: end-of-file-fixer
77
- id: check-yaml
88
- id: debug-statements
9-
- repo: https://github.com/PyCQA/flake8
10-
rev: 4.0.1
9+
- id: double-quote-string-fixer
10+
- id: name-tests-test
11+
- id: requirements-txt-fixer
12+
- repo: https://github.com/asottile/setup-cfg-fmt
13+
rev: v1.20.0
1114
hooks:
12-
- id: flake8
13-
exclude: ^docs/conf.py
14-
- repo: https://github.com/asottile/pyupgrade
15-
rev: v2.31.1
15+
- id: setup-cfg-fmt
16+
- repo: https://github.com/asottile/reorder_python_imports
17+
rev: v3.0.1
1618
hooks:
17-
- id: pyupgrade
18-
args: [--py36-plus]
19+
- id: reorder-python-imports
20+
args: [--py37-plus, --add-import, 'from __future__ import annotations']
1921
- repo: https://github.com/asottile/add-trailing-comma
2022
rev: v2.2.1
2123
hooks:
2224
- id: add-trailing-comma
2325
args: [--py36-plus]
26+
- repo: https://github.com/asottile/pyupgrade
27+
rev: v2.31.1
28+
hooks:
29+
- id: pyupgrade
30+
args: [--py37-plus]
31+
- repo: https://github.com/pre-commit/mirrors-autopep8
32+
rev: v1.6.0
33+
hooks:
34+
- id: autopep8
35+
- repo: https://github.com/PyCQA/flake8
36+
rev: 4.0.1
37+
hooks:
38+
- id: flake8

bin/build-manylinux-wheels

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ Run me after putting the source distribution on pypi.
55
66
See: https://www.python.org/dev/peps/pep-0513/
77
"""
8+
from __future__ import annotations
9+
810
import os
911
import pipes
1012
import subprocess

bin/download-windows-wheels

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#!/usr/bin/env python3
2+
from __future__ import annotations
3+
24
import argparse
35
import io
46
import json

docs/conf.py

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
#
1010
# All configuration values have a default; values that are commented out
1111
# serve to show the default.
12+
from __future__ import annotations
13+
import sass
14+
1215
import os
1316
import sys
1417
import warnings
@@ -18,7 +21,6 @@
1821
# documentation root, use os.path.abspath to make it absolute, like shown here.
1922
sys.path.insert(0, os.path.abspath('..'))
2023

21-
import sass
2224

2325
# -- General configuration -----------------------------------------------------
2426

@@ -179,23 +181,23 @@
179181
# -- Options for LaTeX output --------------------------------------------------
180182

181183
latex_elements = {
182-
# The paper size ('letterpaper' or 'a4paper').
183-
#'papersize': 'letterpaper',
184+
# The paper size ('letterpaper' or 'a4paper').
185+
# 'papersize': 'letterpaper',
184186

185-
# The font size ('10pt', '11pt' or '12pt').
186-
#'pointsize': '10pt',
187+
# The font size ('10pt', '11pt' or '12pt').
188+
# 'pointsize': '10pt',
187189

188-
# Additional stuff for the LaTeX preamble.
189-
#'preamble': '',
190+
# Additional stuff for the LaTeX preamble.
191+
# 'preamble': '',
190192
}
191193

192194
# Grouping the document tree into LaTeX files. List of tuples
193195
# (source start file, target name, title, author, documentclass [howto/manual]).
194196
latex_documents = [
195-
(
196-
'index', 'libsass.tex', 'libsass Documentation',
197-
'Hong Minhee', 'manual',
198-
),
197+
(
198+
'index', 'libsass.tex', 'libsass Documentation',
199+
'Hong Minhee', 'manual',
200+
),
199201
]
200202

201203
# The name of an image file (relative to this directory) to place at the top of
@@ -240,11 +242,11 @@
240242
# (source start file, target name, title, author,
241243
# dir menu entry, description, category)
242244
texinfo_documents = [
243-
(
244-
'index', 'libsass', 'libsass Documentation',
245-
'Hong Minhee', 'libsass', 'One line description of project.',
246-
'Miscellaneous',
247-
),
245+
(
246+
'index', 'libsass', 'libsass Documentation',
247+
'Hong Minhee', 'libsass', 'One line description of project.',
248+
'Miscellaneous',
249+
),
248250
]
249251

250252
# Documents to append as an appendix to all manuals.

pysassc.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@
8888
.. _SassC: https://github.com/sass/sassc
8989
9090
"""
91+
from __future__ import annotations
9192

9293
import functools
9394
import optparse

sass.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
'a b {\n color: blue; }\n'
1111
1212
"""
13+
from __future__ import annotations
1314

1415
import collections.abc
1516
import inspect
@@ -56,6 +57,7 @@ class CompileError(ValueError):
5657
"""The exception type that is raised by :func:`compile()`.
5758
It is a subtype of :exc:`exceptions.ValueError`.
5859
"""
60+
5961
def __init__(self, msg):
6062
super().__init__(to_native_s(msg))
6163

@@ -573,7 +575,7 @@ def my_importer(path, prev):
573575
elif source_comments in ('line_numbers', 'default'):
574576
deprecation_message = (
575577
'you can simply pass True to '
576-
"source_comments instead of " +
578+
'source_comments instead of ' +
577579
repr(source_comments)
578580
)
579581
source_comments = True
@@ -789,7 +791,7 @@ def __new__(cls, r, g, b, a):
789791

790792
class SassList(
791793
collections.namedtuple(
792-
'SassList', ('items', 'separator', 'bracketed'),
794+
'SassList', ('items', 'separator', 'bracketed'),
793795
),
794796
):
795797

sasstests.py

Lines changed: 40 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1+
from __future__ import annotations
2+
13
import base64
24
import collections.abc
35
import contextlib
46
import functools
57
import glob
68
import io
79
import json
8-
import os
910
import os.path
1011
import re
1112
import shutil
@@ -21,7 +22,8 @@
2122

2223
import pysassc
2324
import sass
24-
from sassutils.builder import Manifest, build_directory
25+
from sassutils.builder import build_directory
26+
from sassutils.builder import Manifest
2527
from sassutils.wsgi import SassMiddleware
2628

2729

@@ -424,11 +426,11 @@ def importer_with_srcmap(path):
424426
path,
425427
'a { color: red; }',
426428
json.dumps({
427-
"version": 3,
428-
"sources": [
429-
path + ".db",
429+
'version': 3,
430+
'sources': [
431+
path + '.db',
430432
],
431-
"mappings": ";AAAA,CAAC,CAAC;EAAE,KAAK,EAAE,GAAI,GAAI",
433+
'mappings': ';AAAA,CAAC,CAAC;EAAE,KAAK,EAAE,GAAI,GAAI',
432434
}),
433435
),
434436
)
@@ -448,13 +450,13 @@ def importer(path):
448450

449451
with assert_raises_compile_error(
450452
RegexMatcher(
451-
r'^Error: \n'
452-
r' Traceback \(most recent call last\):\n'
453-
r'.+'
454-
r'ValueError: Bad path: hi\n'
455-
r' on line 1:9 of stdin\n'
456-
r'>> @import "hi";\n'
457-
r' --------\^\n',
453+
r'^Error: \n'
454+
r' Traceback \(most recent call last\):\n'
455+
r'.+'
456+
r'ValueError: Bad path: hi\n'
457+
r' on line 1:9 of stdin\n'
458+
r'>> @import "hi";\n'
459+
r' --------\^\n',
458460
),
459461
):
460462
sass.compile(string='@import "hi";', importers=((0, importer),))
@@ -465,14 +467,14 @@ def importer(path):
465467

466468
with assert_raises_compile_error(
467469
RegexMatcher(
468-
r'^Error: \n'
469-
r' Traceback \(most recent call last\):\n'
470-
r'.+'
471-
r'ValueError: Expected importer result to be a tuple of '
472-
r'length \(1, 2, 3\) but got 0: \(\)\n'
473-
r' on line 1:9 of stdin\n'
474-
r'>> @import "hi";\n'
475-
r' --------\^\n',
470+
r'^Error: \n'
471+
r' Traceback \(most recent call last\):\n'
472+
r'.+'
473+
r'ValueError: Expected importer result to be a tuple of '
474+
r'length \(1, 2, 3\) but got 0: \(\)\n'
475+
r' on line 1:9 of stdin\n'
476+
r'>> @import "hi";\n'
477+
r' --------\^\n',
476478
),
477479
):
478480
sass.compile(string='@import "hi";', importers=((0, importer),))
@@ -483,14 +485,14 @@ def importer(path):
483485

484486
with assert_raises_compile_error(
485487
RegexMatcher(
486-
r'^Error: \n'
487-
r' Traceback \(most recent call last\):\n'
488-
r'.+'
489-
r'ValueError: Expected importer result to be a tuple of '
490-
r"length \(1, 2, 3\) but got 4: \('a', 'b', 'c', 'd'\)\n"
491-
r' on line 1:9 of stdin\n'
492-
r'>> @import "hi";\n'
493-
r' --------\^\n',
488+
r'^Error: \n'
489+
r' Traceback \(most recent call last\):\n'
490+
r'.+'
491+
r'ValueError: Expected importer result to be a tuple of '
492+
r"length \(1, 2, 3\) but got 4: \('a', 'b', 'c', 'd'\)\n"
493+
r' on line 1:9 of stdin\n'
494+
r'>> @import "hi";\n'
495+
r' --------\^\n',
494496
),
495497
):
496498
sass.compile(string='@import "hi";', importers=((0, importer),))
@@ -1116,7 +1118,7 @@ def test_error(self):
11161118
class SassFunctionTest(unittest.TestCase):
11171119

11181120
def test_from_lambda(self):
1119-
lambda_ = lambda abc, d: None # pragma: no branch # noqa: E731
1121+
def lambda_(abc, d): return None # pragma: no branch # noqa: E731
11201122
sf = sass.SassFunction.from_lambda('func_name', lambda_)
11211123
assert 'func_name' == sf.name
11221124
assert ('$abc', '$d') == sf.arguments
@@ -1378,14 +1380,14 @@ class CustomFunctionsTest(unittest.TestCase):
13781380
def test_raises(self):
13791381
with assert_raises_compile_error(
13801382
RegexMatcher(
1381-
r'^Error: error in C function raises: \n'
1382-
r' Traceback \(most recent call last\):\n'
1383-
r'.+'
1384-
r'AssertionError: foo\n'
1385-
r' on line 1:14 of stdin, in function `raises`\n'
1386-
r' from line 1:14 of stdin\n'
1387-
r'>> a { content: raises\(\); }\n'
1388-
r' -------------\^\n$',
1383+
r'^Error: error in C function raises: \n'
1384+
r' Traceback \(most recent call last\):\n'
1385+
r'.+'
1386+
r'AssertionError: foo\n'
1387+
r' on line 1:14 of stdin, in function `raises`\n'
1388+
r' from line 1:14 of stdin\n'
1389+
r'>> a { content: raises\(\); }\n'
1390+
r' -------------\^\n$',
13891391
),
13901392
):
13911393
compile_with_func('a { content: raises(); }')

sassutils/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55
which depends on libsass core (:mod:`sass` module).
66
77
"""
8+
from __future__ import annotations

sassutils/builder.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
33
44
"""
5+
from __future__ import annotations
56

67
import collections.abc
78
import os.path

sassutils/distutils.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,18 +67,19 @@
6767
Added ``--output-style``/``-s`` option to :class:`build_sass` command.
6868
6969
"""
70+
from __future__ import annotations
7071

71-
import distutils.errors
72-
import distutils.log
73-
import distutils.util
7472
import functools
7573
import os.path
7674

75+
import distutils.errors
76+
import distutils.log
77+
import distutils.util
7778
from setuptools import Command
7879
from setuptools.command.sdist import sdist
7980

80-
from sass import OUTPUT_STYLES
8181
from .builder import Manifest
82+
from sass import OUTPUT_STYLES
8283

8384
__all__ = 'build_sass', 'validate_manifests'
8485

0 commit comments

Comments
 (0)