Skip to content

Commit 608206a

Browse files
authored
Merge pull request #384 from sass/all-repos_autofix_reorder-pre-commit-config
reorder pre-commit config
2 parents fb7f6d8 + 3fdd9de commit 608206a

File tree

9 files changed

+87
-78
lines changed

9 files changed

+87
-78
lines changed

.pre-commit-config.yaml

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,30 @@ 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
11-
hooks:
12-
- id: flake8
13-
exclude: ^docs/conf.py
14-
- repo: https://github.com/asottile/pyupgrade
15-
rev: v2.31.1
9+
- id: double-quote-string-fixer
10+
- id: name-tests-test
11+
- id: requirements-txt-fixer
12+
- repo: https://github.com/asottile/reorder_python_imports
13+
rev: v3.0.1
1614
hooks:
17-
- id: pyupgrade
15+
- id: reorder-python-imports
1816
args: [--py36-plus]
1917
- repo: https://github.com/asottile/add-trailing-comma
2018
rev: v2.2.1
2119
hooks:
2220
- id: add-trailing-comma
2321
args: [--py36-plus]
22+
- repo: https://github.com/asottile/pyupgrade
23+
rev: v2.31.1
24+
hooks:
25+
- id: pyupgrade
26+
args: [--py36-plus]
27+
- repo: https://github.com/pre-commit/mirrors-autopep8
28+
rev: v1.6.0
29+
hooks:
30+
- id: autopep8
31+
- repo: https://github.com/PyCQA/flake8
32+
rev: 4.0.1
33+
hooks:
34+
- id: flake8
35+
exclude: ^docs/conf.py

docs/conf.py

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,13 @@
1313
import sys
1414
import warnings
1515

16+
import sass
17+
1618
# If extensions (or modules to document with autodoc) are in another directory,
1719
# add these directories to sys.path here. If the directory is relative to the
1820
# documentation root, use os.path.abspath to make it absolute, like shown here.
1921
sys.path.insert(0, os.path.abspath('..'))
2022

21-
import sass
2223

2324
# -- General configuration -----------------------------------------------------
2425

@@ -179,23 +180,23 @@
179180
# -- Options for LaTeX output --------------------------------------------------
180181

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

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

188-
# Additional stuff for the LaTeX preamble.
189-
#'preamble': '',
189+
# Additional stuff for the LaTeX preamble.
190+
# 'preamble': '',
190191
}
191192

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

201202
# The name of an image file (relative to this directory) to place at the top of
@@ -240,11 +241,11 @@
240241
# (source start file, target name, title, author,
241242
# dir menu entry, description, category)
242243
texinfo_documents = [
243-
(
244-
'index', 'libsass', 'libsass Documentation',
245-
'Hong Minhee', 'libsass', 'One line description of project.',
246-
'Miscellaneous',
247-
),
244+
(
245+
'index', 'libsass', 'libsass Documentation',
246+
'Hong Minhee', 'libsass', 'One line description of project.',
247+
'Miscellaneous',
248+
),
248249
]
249250

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

pysassc.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@
8888
.. _SassC: https://github.com/sass/sassc
8989
9090
"""
91-
9291
import functools
9392
import optparse
9493
import sys

sass.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
'a b {\n color: blue; }\n'
1111
1212
"""
13-
1413
import collections.abc
1514
import inspect
1615
import os.path
@@ -56,6 +55,7 @@ class CompileError(ValueError):
5655
"""The exception type that is raised by :func:`compile()`.
5756
It is a subtype of :exc:`exceptions.ValueError`.
5857
"""
58+
5959
def __init__(self, msg):
6060
super().__init__(to_native_s(msg))
6161

@@ -573,7 +573,7 @@ def my_importer(path, prev):
573573
elif source_comments in ('line_numbers', 'default'):
574574
deprecation_message = (
575575
'you can simply pass True to '
576-
"source_comments instead of " +
576+
'source_comments instead of ' +
577577
repr(source_comments)
578578
)
579579
source_comments = True
@@ -789,7 +789,7 @@ def __new__(cls, r, g, b, a):
789789

790790
class SassList(
791791
collections.namedtuple(
792-
'SassList', ('items', 'separator', 'bracketed'),
792+
'SassList', ('items', 'separator', 'bracketed'),
793793
),
794794
):
795795

sasstests.py

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import glob
66
import io
77
import json
8-
import os
98
import os.path
109
import re
1110
import shutil
@@ -21,7 +20,8 @@
2120

2221
import pysassc
2322
import sass
24-
from sassutils.builder import Manifest, build_directory
23+
from sassutils.builder import build_directory
24+
from sassutils.builder import Manifest
2525
from sassutils.wsgi import SassMiddleware
2626

2727

@@ -424,11 +424,11 @@ def importer_with_srcmap(path):
424424
path,
425425
'a { color: red; }',
426426
json.dumps({
427-
"version": 3,
428-
"sources": [
429-
path + ".db",
427+
'version': 3,
428+
'sources': [
429+
path + '.db',
430430
],
431-
"mappings": ";AAAA,CAAC,CAAC;EAAE,KAAK,EAAE,GAAI,GAAI",
431+
'mappings': ';AAAA,CAAC,CAAC;EAAE,KAAK,EAAE,GAAI,GAAI',
432432
}),
433433
),
434434
)
@@ -448,13 +448,13 @@ def importer(path):
448448

449449
with assert_raises_compile_error(
450450
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',
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',
458458
),
459459
):
460460
sass.compile(string='@import "hi";', importers=((0, importer),))
@@ -465,14 +465,14 @@ def importer(path):
465465

466466
with assert_raises_compile_error(
467467
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',
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',
476476
),
477477
):
478478
sass.compile(string='@import "hi";', importers=((0, importer),))
@@ -483,14 +483,14 @@ def importer(path):
483483

484484
with assert_raises_compile_error(
485485
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',
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',
494494
),
495495
):
496496
sass.compile(string='@import "hi";', importers=((0, importer),))
@@ -1116,7 +1116,7 @@ def test_error(self):
11161116
class SassFunctionTest(unittest.TestCase):
11171117

11181118
def test_from_lambda(self):
1119-
lambda_ = lambda abc, d: None # pragma: no branch # noqa: E731
1119+
def lambda_(abc, d): return None # pragma: no branch # noqa: E731
11201120
sf = sass.SassFunction.from_lambda('func_name', lambda_)
11211121
assert 'func_name' == sf.name
11221122
assert ('$abc', '$d') == sf.arguments
@@ -1378,14 +1378,14 @@ class CustomFunctionsTest(unittest.TestCase):
13781378
def test_raises(self):
13791379
with assert_raises_compile_error(
13801380
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$',
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$',
13891389
),
13901390
):
13911391
compile_with_func('a { content: raises(); }')

sassutils/builder.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
33
44
"""
5-
65
import collections.abc
76
import os.path
87
import re

sassutils/distutils.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,18 +67,17 @@
6767
Added ``--output-style``/``-s`` option to :class:`build_sass` command.
6868
6969
"""
70+
import functools
71+
import os.path
7072

7173
import distutils.errors
7274
import distutils.log
7375
import distutils.util
74-
import functools
75-
import os.path
76-
7776
from setuptools import Command
7877
from setuptools.command.sdist import sdist
7978

80-
from sass import OUTPUT_STYLES
8179
from .builder import Manifest
80+
from sass import OUTPUT_STYLES
8281

8382
__all__ = 'build_sass', 'validate_manifests'
8483

sassutils/wsgi.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,14 @@
22
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
33
44
"""
5-
65
import collections.abc
76
import logging
8-
import os
97
import os.path
108

119
from pkg_resources import resource_filename
1210

13-
from sass import CompileError
1411
from .builder import Manifest
12+
from sass import CompileError
1513

1614
__all__ = 'SassMiddleware',
1715

setup.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
import ast
22
import atexit
3-
import distutils.cmd
4-
import distutils.log
5-
import distutils.sysconfig
63
import os.path
74
import platform
85
import shutil
96
import subprocess
107
import sys
118
import tempfile
129

13-
from setuptools import Extension, setup
10+
import distutils.cmd
11+
import distutils.log
12+
import distutils.sysconfig
13+
from setuptools import Extension
14+
from setuptools import setup
1415

1516
MACOS_FLAG = ['-mmacosx-version-min=10.7']
1617
FLAGS_POSIX = [

0 commit comments

Comments
 (0)