Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 20 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,30 @@ repos:
- id: end-of-file-fixer
- id: check-yaml
- id: debug-statements
- repo: https://github.com/PyCQA/flake8
rev: 4.0.1
hooks:
- id: flake8
exclude: ^docs/conf.py
- repo: https://github.com/asottile/pyupgrade
rev: v2.31.1
- id: double-quote-string-fixer
- id: name-tests-test
- id: requirements-txt-fixer
- repo: https://github.com/asottile/reorder_python_imports
rev: v3.0.1
hooks:
- id: pyupgrade
- id: reorder-python-imports
args: [--py36-plus]
- repo: https://github.com/asottile/add-trailing-comma
rev: v2.2.1
hooks:
- id: add-trailing-comma
args: [--py36-plus]
- repo: https://github.com/asottile/pyupgrade
rev: v2.31.1
hooks:
- id: pyupgrade
args: [--py36-plus]
- repo: https://github.com/pre-commit/mirrors-autopep8
rev: v1.6.0
hooks:
- id: autopep8
- repo: https://github.com/PyCQA/flake8
rev: 4.0.1
hooks:
- id: flake8
exclude: ^docs/conf.py
33 changes: 17 additions & 16 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@
import sys
import warnings

import sass

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, os.path.abspath('..'))

import sass

# -- General configuration -----------------------------------------------------

Expand Down Expand Up @@ -179,23 +180,23 @@
# -- Options for LaTeX output --------------------------------------------------

latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#'papersize': 'letterpaper',
# The paper size ('letterpaper' or 'a4paper').
# 'papersize': 'letterpaper',

# The font size ('10pt', '11pt' or '12pt').
#'pointsize': '10pt',
# The font size ('10pt', '11pt' or '12pt').
# 'pointsize': '10pt',

# Additional stuff for the LaTeX preamble.
#'preamble': '',
# Additional stuff for the LaTeX preamble.
# 'preamble': '',
}

# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
(
'index', 'libsass.tex', 'libsass Documentation',
'Hong Minhee', 'manual',
),
(
'index', 'libsass.tex', 'libsass Documentation',
'Hong Minhee', 'manual',
),
]

# The name of an image file (relative to this directory) to place at the top of
Expand Down Expand Up @@ -240,11 +241,11 @@
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(
'index', 'libsass', 'libsass Documentation',
'Hong Minhee', 'libsass', 'One line description of project.',
'Miscellaneous',
),
(
'index', 'libsass', 'libsass Documentation',
'Hong Minhee', 'libsass', 'One line description of project.',
'Miscellaneous',
),
]

# Documents to append as an appendix to all manuals.
Expand Down
1 change: 0 additions & 1 deletion pysassc.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@
.. _SassC: https://github.com/sass/sassc

"""

import functools
import optparse
import sys
Expand Down
6 changes: 3 additions & 3 deletions sass.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
'a b {\n color: blue; }\n'

"""

import collections.abc
import inspect
import os.path
Expand Down Expand Up @@ -56,6 +55,7 @@ class CompileError(ValueError):
"""The exception type that is raised by :func:`compile()`.
It is a subtype of :exc:`exceptions.ValueError`.
"""

def __init__(self, msg):
super().__init__(to_native_s(msg))

Expand Down Expand Up @@ -573,7 +573,7 @@ def my_importer(path, prev):
elif source_comments in ('line_numbers', 'default'):
deprecation_message = (
'you can simply pass True to '
"source_comments instead of " +
'source_comments instead of ' +
repr(source_comments)
)
source_comments = True
Expand Down Expand Up @@ -789,7 +789,7 @@ def __new__(cls, r, g, b, a):

class SassList(
collections.namedtuple(
'SassList', ('items', 'separator', 'bracketed'),
'SassList', ('items', 'separator', 'bracketed'),
),
):

Expand Down
76 changes: 38 additions & 38 deletions sasstests.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import glob
import io
import json
import os
import os.path
import re
import shutil
Expand All @@ -21,7 +20,8 @@

import pysassc
import sass
from sassutils.builder import Manifest, build_directory
from sassutils.builder import build_directory
from sassutils.builder import Manifest
from sassutils.wsgi import SassMiddleware


Expand Down Expand Up @@ -424,11 +424,11 @@ def importer_with_srcmap(path):
path,
'a { color: red; }',
json.dumps({
"version": 3,
"sources": [
path + ".db",
'version': 3,
'sources': [
path + '.db',
],
"mappings": ";AAAA,CAAC,CAAC;EAAE,KAAK,EAAE,GAAI,GAAI",
'mappings': ';AAAA,CAAC,CAAC;EAAE,KAAK,EAAE,GAAI,GAAI',
}),
),
)
Expand All @@ -448,13 +448,13 @@ def importer(path):

with assert_raises_compile_error(
RegexMatcher(
r'^Error: \n'
r' Traceback \(most recent call last\):\n'
r'.+'
r'ValueError: Bad path: hi\n'
r' on line 1:9 of stdin\n'
r'>> @import "hi";\n'
r' --------\^\n',
r'^Error: \n'
r' Traceback \(most recent call last\):\n'
r'.+'
r'ValueError: Bad path: hi\n'
r' on line 1:9 of stdin\n'
r'>> @import "hi";\n'
r' --------\^\n',
),
):
sass.compile(string='@import "hi";', importers=((0, importer),))
Expand All @@ -465,14 +465,14 @@ def importer(path):

with assert_raises_compile_error(
RegexMatcher(
r'^Error: \n'
r' Traceback \(most recent call last\):\n'
r'.+'
r'ValueError: Expected importer result to be a tuple of '
r'length \(1, 2, 3\) but got 0: \(\)\n'
r' on line 1:9 of stdin\n'
r'>> @import "hi";\n'
r' --------\^\n',
r'^Error: \n'
r' Traceback \(most recent call last\):\n'
r'.+'
r'ValueError: Expected importer result to be a tuple of '
r'length \(1, 2, 3\) but got 0: \(\)\n'
r' on line 1:9 of stdin\n'
r'>> @import "hi";\n'
r' --------\^\n',
),
):
sass.compile(string='@import "hi";', importers=((0, importer),))
Expand All @@ -483,14 +483,14 @@ def importer(path):

with assert_raises_compile_error(
RegexMatcher(
r'^Error: \n'
r' Traceback \(most recent call last\):\n'
r'.+'
r'ValueError: Expected importer result to be a tuple of '
r"length \(1, 2, 3\) but got 4: \('a', 'b', 'c', 'd'\)\n"
r' on line 1:9 of stdin\n'
r'>> @import "hi";\n'
r' --------\^\n',
r'^Error: \n'
r' Traceback \(most recent call last\):\n'
r'.+'
r'ValueError: Expected importer result to be a tuple of '
r"length \(1, 2, 3\) but got 4: \('a', 'b', 'c', 'd'\)\n"
r' on line 1:9 of stdin\n'
r'>> @import "hi";\n'
r' --------\^\n',
),
):
sass.compile(string='@import "hi";', importers=((0, importer),))
Expand Down Expand Up @@ -1116,7 +1116,7 @@ def test_error(self):
class SassFunctionTest(unittest.TestCase):

def test_from_lambda(self):
lambda_ = lambda abc, d: None # pragma: no branch # noqa: E731
def lambda_(abc, d): return None # pragma: no branch # noqa: E731
sf = sass.SassFunction.from_lambda('func_name', lambda_)
assert 'func_name' == sf.name
assert ('$abc', '$d') == sf.arguments
Expand Down Expand Up @@ -1378,14 +1378,14 @@ class CustomFunctionsTest(unittest.TestCase):
def test_raises(self):
with assert_raises_compile_error(
RegexMatcher(
r'^Error: error in C function raises: \n'
r' Traceback \(most recent call last\):\n'
r'.+'
r'AssertionError: foo\n'
r' on line 1:14 of stdin, in function `raises`\n'
r' from line 1:14 of stdin\n'
r'>> a { content: raises\(\); }\n'
r' -------------\^\n$',
r'^Error: error in C function raises: \n'
r' Traceback \(most recent call last\):\n'
r'.+'
r'AssertionError: foo\n'
r' on line 1:14 of stdin, in function `raises`\n'
r' from line 1:14 of stdin\n'
r'>> a { content: raises\(\); }\n'
r' -------------\^\n$',
),
):
compile_with_func('a { content: raises(); }')
Expand Down
1 change: 0 additions & 1 deletion sassutils/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

"""

import collections.abc
import os.path
import re
Expand Down
7 changes: 3 additions & 4 deletions sassutils/distutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,18 +67,17 @@
Added ``--output-style``/``-s`` option to :class:`build_sass` command.

"""
import functools
import os.path

import distutils.errors
import distutils.log
import distutils.util
import functools
import os.path

from setuptools import Command
from setuptools.command.sdist import sdist

from sass import OUTPUT_STYLES
from .builder import Manifest
from sass import OUTPUT_STYLES

__all__ = 'build_sass', 'validate_manifests'

Expand Down
4 changes: 1 addition & 3 deletions sassutils/wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

"""

import collections.abc
import logging
import os
import os.path

from pkg_resources import resource_filename

from sass import CompileError
from .builder import Manifest
from sass import CompileError

__all__ = 'SassMiddleware',

Expand Down
9 changes: 5 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import ast
import atexit
import distutils.cmd
import distutils.log
import distutils.sysconfig
import os.path
import platform
import shutil
import subprocess
import sys
import tempfile

from setuptools import Extension, setup
import distutils.cmd
import distutils.log
import distutils.sysconfig
from setuptools import Extension
from setuptools import setup

MACOS_FLAG = ['-mmacosx-version-min=10.7']
FLAGS_POSIX = [
Expand Down