Skip to content

Commit 4b62f1b

Browse files
committed
Run pre-commit autoupdate
Committed via https://github.com/asottile/all-repos
1 parent d398281 commit 4b62f1b

File tree

5 files changed

+108
-72
lines changed

5 files changed

+108
-72
lines changed

.pre-commit-config.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ repos:
77
- id: check-yaml
88
- id: debug-statements
99
- repo: https://gitlab.com/pycqa/flake8
10-
rev: 3.7.1
10+
rev: 3.7.7
1111
hooks:
1212
- id: flake8
1313
exclude: ^docs/conf.py
1414
- repo: https://github.com/asottile/pyupgrade
15-
rev: v1.11.1
15+
rev: v1.12.0
1616
hooks:
1717
- id: pyupgrade
1818
- repo: https://github.com/asottile/add-trailing-comma
19-
rev: v0.7.1
19+
rev: v1.0.0
2020
hooks:
2121
- id: add-trailing-comma

sass.py

+30-16
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,10 @@ def __init__(self, name, arguments, callable_):
145145
if not isinstance(name, string_types):
146146
raise TypeError('name must be a string, not ' + repr(name))
147147
elif not isinstance(arguments, collections_abc.Sequence):
148-
raise TypeError('arguments must be a sequence, not ' +
149-
repr(arguments))
148+
raise TypeError(
149+
'arguments must be a sequence, not ' +
150+
repr(arguments),
151+
)
150152
elif not callable(callable_):
151153
raise TypeError(repr(callable_) + ' is not callable')
152154
self.name = name
@@ -562,13 +564,17 @@ def my_importer(path, prev):
562564
precision = kwargs.pop('precision', 5)
563565
output_style = kwargs.pop('output_style', 'nested')
564566
if not isinstance(output_style, string_types):
565-
raise TypeError('output_style must be a string, not ' +
566-
repr(output_style))
567+
raise TypeError(
568+
'output_style must be a string, not ' +
569+
repr(output_style),
570+
)
567571
try:
568572
output_style = OUTPUT_STYLES[output_style]
569573
except KeyError:
570-
raise CompileError('{} is unsupported output_style; choose one of {}'
571-
''.format(output_style, and_join(OUTPUT_STYLES)))
574+
raise CompileError(
575+
'{} is unsupported output_style; choose one of {}'
576+
''.format(output_style, and_join(OUTPUT_STYLES)),
577+
)
572578
source_comments = kwargs.pop('source_comments', False)
573579
if source_comments in SOURCE_COMMENTS:
574580
if source_comments == 'none':
@@ -578,9 +584,11 @@ def my_importer(path, prev):
578584
)
579585
source_comments = False
580586
elif source_comments in ('line_numbers', 'default'):
581-
deprecation_message = ('you can simply pass True to '
582-
"source_comments instead of " +
583-
repr(source_comments))
587+
deprecation_message = (
588+
'you can simply pass True to '
589+
"source_comments instead of " +
590+
repr(source_comments)
591+
)
584592
source_comments = True
585593
else:
586594
deprecation_message = (
@@ -596,8 +604,10 @@ def my_importer(path, prev):
596604
FutureWarning,
597605
)
598606
if not isinstance(source_comments, bool):
599-
raise TypeError('source_comments must be bool, not ' +
600-
repr(source_comments))
607+
raise TypeError(
608+
'source_comments must be bool, not ' +
609+
repr(source_comments),
610+
)
601611
fs_encoding = sys.getfilesystemencoding() or sys.getdefaultencoding()
602612

603613
def _get_file_arg(key):
@@ -670,8 +680,10 @@ def _get_file_arg(key):
670680
string = string.encode('utf-8')
671681
indented = kwargs.pop('indented', False)
672682
if not isinstance(indented, bool):
673-
raise TypeError('indented must be bool, not ' +
674-
repr(source_comments))
683+
raise TypeError(
684+
'indented must be bool, not ' +
685+
repr(source_comments),
686+
)
675687
_check_no_remaining_kwargs(compile, kwargs)
676688
s, v = _sass.compile_string(
677689
string, output_style, source_comments, include_paths, precision,
@@ -788,9 +800,11 @@ def __new__(cls, r, g, b, a):
788800
SEPARATORS = frozenset((SASS_SEPARATOR_COMMA, SASS_SEPARATOR_SPACE))
789801

790802

791-
class SassList(collections.namedtuple(
792-
'SassList', ('items', 'separator', 'bracketed'),
793-
)):
803+
class SassList(
804+
collections.namedtuple(
805+
'SassList', ('items', 'separator', 'bracketed'),
806+
),
807+
):
794808

795809
def __new__(cls, items, separator, bracketed=False):
796810
items = tuple(items)

sasstests.py

+47-39
Original file line numberDiff line numberDiff line change
@@ -448,47 +448,53 @@ def test_importers_raises_exception(self):
448448
def importer(path):
449449
raise ValueError('Bad path: {}'.format(path))
450450

451-
with assert_raises_compile_error(RegexMatcher(
452-
r'^Error: \n'
453-
r' Traceback \(most recent call last\):\n'
454-
r'.+'
455-
r'ValueError: Bad path: hi\n'
456-
r' on line 1 of stdin\n'
457-
r'>> @import "hi";\n'
458-
r' --------\^\n',
459-
)):
451+
with assert_raises_compile_error(
452+
RegexMatcher(
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 of stdin\n'
458+
r'>> @import "hi";\n'
459+
r' --------\^\n',
460+
),
461+
):
460462
sass.compile(string='@import "hi";', importers=((0, importer),))
461463

462464
def test_importer_returns_wrong_tuple_size_zero(self):
463465
def importer(path):
464466
return ((),)
465467

466-
with assert_raises_compile_error(RegexMatcher(
467-
r'^Error: \n'
468-
r' Traceback \(most recent call last\):\n'
469-
r'.+'
470-
r'ValueError: Expected importer result to be a tuple of '
471-
r'length \(1, 2, 3\) but got 0: \(\)\n'
472-
r' on line 1 of stdin\n'
473-
r'>> @import "hi";\n'
474-
r' --------\^\n',
475-
)):
468+
with assert_raises_compile_error(
469+
RegexMatcher(
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 of stdin\n'
476+
r'>> @import "hi";\n'
477+
r' --------\^\n',
478+
),
479+
):
476480
sass.compile(string='@import "hi";', importers=((0, importer),))
477481

478482
def test_importer_returns_wrong_tuple_size_too_big(self):
479483
def importer(path):
480484
return (('a', 'b', 'c', 'd'),)
481485

482-
with assert_raises_compile_error(RegexMatcher(
483-
r'^Error: \n'
484-
r' Traceback \(most recent call last\):\n'
485-
r'.+'
486-
r'ValueError: Expected importer result to be a tuple of '
487-
r"length \(1, 2, 3\) but got 4: \('a', 'b', 'c', 'd'\)\n"
488-
r' on line 1 of stdin\n'
489-
r'>> @import "hi";\n'
490-
r' --------\^\n',
491-
)):
486+
with assert_raises_compile_error(
487+
RegexMatcher(
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 of stdin\n'
494+
r'>> @import "hi";\n'
495+
r' --------\^\n',
496+
),
497+
):
492498
sass.compile(string='@import "hi";', importers=((0, importer),))
493499

494500
def test_compile_string_deprecated_source_comments_line_numbers(self):
@@ -1383,16 +1389,18 @@ def __eq__(self, other):
13831389
class CustomFunctionsTest(unittest.TestCase):
13841390

13851391
def test_raises(self):
1386-
with assert_raises_compile_error(RegexMatcher(
1387-
r'^Error: error in C function raises: \n'
1388-
r' Traceback \(most recent call last\):\n'
1389-
r'.+'
1390-
r'AssertionError: foo\n'
1391-
r' on line 1 of stdin, in function `raises`\n'
1392-
r' from line 1 of stdin\n'
1393-
r'>> a { content: raises\(\); }\n'
1394-
r' -------------\^\n$',
1395-
)):
1392+
with assert_raises_compile_error(
1393+
RegexMatcher(
1394+
r'^Error: error in C function raises: \n'
1395+
r' Traceback \(most recent call last\):\n'
1396+
r'.+'
1397+
r'AssertionError: foo\n'
1398+
r' on line 1 of stdin, in function `raises`\n'
1399+
r' from line 1 of stdin\n'
1400+
r'>> a { content: raises\(\); }\n'
1401+
r' -------------\^\n$',
1402+
),
1403+
):
13961404
compile_with_func('a { content: raises(); }')
13971405

13981406
def test_warning(self):

sassutils/builder.py

+20-10
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,16 @@ def normalize_manifests(cls, manifests):
107107
elif isinstance(manifests, collections_abc.Mapping):
108108
manifests = dict(manifests)
109109
else:
110-
raise TypeError('manifests must be a mapping object, not ' +
111-
repr(manifests))
110+
raise TypeError(
111+
'manifests must be a mapping object, not ' +
112+
repr(manifests),
113+
)
112114
for package_name, manifest in manifests.items():
113115
if not isinstance(package_name, string_types):
114-
raise TypeError('manifest keys must be a string of package '
115-
'name, not ' + repr(package_name))
116+
raise TypeError(
117+
'manifest keys must be a string of package '
118+
'name, not ' + repr(package_name),
119+
)
116120
if isinstance(manifest, Manifest):
117121
continue
118122
elif isinstance(manifest, tuple):
@@ -138,18 +142,24 @@ def __init__(
138142
strip_extension=None,
139143
):
140144
if not isinstance(sass_path, string_types):
141-
raise TypeError('sass_path must be a string, not ' +
142-
repr(sass_path))
145+
raise TypeError(
146+
'sass_path must be a string, not ' +
147+
repr(sass_path),
148+
)
143149
if css_path is None:
144150
css_path = sass_path
145151
elif not isinstance(css_path, string_types):
146-
raise TypeError('css_path must be a string, not ' +
147-
repr(css_path))
152+
raise TypeError(
153+
'css_path must be a string, not ' +
154+
repr(css_path),
155+
)
148156
if wsgi_path is None:
149157
wsgi_path = css_path
150158
elif not isinstance(wsgi_path, string_types):
151-
raise TypeError('wsgi_path must be a string, not ' +
152-
repr(wsgi_path))
159+
raise TypeError(
160+
'wsgi_path must be a string, not ' +
161+
repr(wsgi_path),
162+
)
153163
if strip_extension is None:
154164
warnings.warn(
155165
'`strip_extension` was not specified, defaulting to `False`.\n'

sassutils/wsgi.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,17 @@ def __init__(
9494
error_status='200 OK',
9595
):
9696
if not callable(app):
97-
raise TypeError('app must be a WSGI-compliant callable object, '
98-
'not ' + repr(app))
97+
raise TypeError(
98+
'app must be a WSGI-compliant callable object, '
99+
'not ' + repr(app),
100+
)
99101
self.app = app
100102
self.manifests = Manifest.normalize_manifests(manifests)
101103
if not isinstance(package_dir, collections_abc.Mapping):
102-
raise TypeError('package_dir must be a mapping object, not ' +
103-
repr(package_dir))
104+
raise TypeError(
105+
'package_dir must be a mapping object, not ' +
106+
repr(package_dir),
107+
)
104108
self.error_status = error_status
105109
self.package_dir = dict(package_dir)
106110
for package_name in self.manifests:

0 commit comments

Comments
 (0)