summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrédéric Péters <fpeters@entrouvert.com>2022-04-20 12:35:16 (GMT)
committerFrédéric Péters <fpeters@entrouvert.com>2022-04-20 12:35:16 (GMT)
commitebe218ee01b2e2b04bf6571e02aaf8bf6a8d103d (patch)
treef78a5c2eca3ba05f2d4d8e61266fe2dccbd6e439
parentaa886950b1bbef2751e0c77a99feb25e7251671b (diff)
downloadmisc-fred-ebe218ee01b2e2b04bf6571e02aaf8bf6a8d103d.zip
misc-fred-ebe218ee01b2e2b04bf6571e02aaf8bf6a8d103d.tar.gz
misc-fred-ebe218ee01b2e2b04bf6571e02aaf8bf6a8d103d.tar.bz2
sassw: apply black
-rwxr-xr-xbin/sassw26
1 files changed, 18 insertions, 8 deletions
diff --git a/bin/sassw b/bin/sassw
index af1c693..949ee83 100755
--- a/bin/sassw
+++ b/bin/sassw
@@ -22,31 +22,41 @@ if os.path.isdir(filename):
else:
filenames = sys.argv[1:]
+
def build():
global sources, directories
directories = set()
sources = set()
for filename in filenames:
result = subprocess.run(
- ['sassc', '-mauto', filename, filename.replace('.scss', '.css')],
- capture_output=True,
- text=True)
+ ['sassc', '-mauto', filename, filename.replace('.scss', '.css')], capture_output=True, text=True
+ )
sys.stdout.write(result.stdout)
sys.stderr.write(result.stderr)
if result.returncode:
# error
with open(filename.replace('.scss', '.css'), 'w') as fd:
- print('''body::before {
+ print(
+ '''body::before {
white-space: pre;
font-family: monospace;
content: "%s";
- }''' % result.stderr.replace('\n', '\\A').replace('"', '\\"'),
- file=fd)
+ }'''
+ % result.stderr.replace('\n', '\\A').replace('"', '\\"'),
+ file=fd,
+ )
basepath = os.path.abspath(os.path.dirname(filename))
- sources = sources.union(set([os.path.abspath(os.path.join(basepath, x))
- for x in json.load(open(filename.replace('.scss', '.css.map')))['sources']]))
+ sources = sources.union(
+ set(
+ [
+ os.path.abspath(os.path.join(basepath, x))
+ for x in json.load(open(filename.replace('.scss', '.css.map')))['sources']
+ ]
+ )
+ )
directories = directories.union(set([os.path.dirname(x) for x in sources]))
+
class EventManager(pyinotify.ProcessEvent):
def process_default(self, event):
if event.pathname in sources: