Skip to content

Commit 9aa8be1

Browse files
pre-commit-ci[bot]peymanslh
authored andcommitted
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 3a0bb76 commit 9aa8be1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1058
-1003
lines changed

docs/conf.py

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,20 @@
2525
extensions = []
2626

2727
# Add any paths that contain templates here, relative to this directory.
28-
templates_path = ['_templates']
28+
templates_path = ["_templates"]
2929

3030
# The suffix of source filenames.
31-
source_suffix = '.rst'
31+
source_suffix = ".rst"
3232

3333
# The encoding of source files.
3434
# source_encoding = 'utf-8-sig'
3535

3636
# The master toctree document.
37-
master_doc = 'index'
37+
master_doc = "index"
3838

3939
# General information about the project.
40-
project = 'django-pipeline'
41-
copyright = '2011-2014, Timothée Peignier'
40+
project = "django-pipeline"
41+
copyright = "2011-2014, Timothée Peignier"
4242

4343
# The version info for the project you're documenting, acts as replacement for
4444
# |version| and |release|, also used in various other places throughout the
@@ -61,7 +61,7 @@
6161

6262
# List of patterns, relative to source directory, that match files and
6363
# directories to ignore when looking for source files.
64-
exclude_patterns = ['_build']
64+
exclude_patterns = ["_build"]
6565

6666
# The reST default role (used for this markup: `text`) to use for all documents.
6767
# default_role = None
@@ -78,7 +78,7 @@
7878
# show_authors = False
7979

8080
# The name of the Pygments (syntax highlighting) style to use.
81-
pygments_style = 'sphinx'
81+
pygments_style = "sphinx"
8282

8383
# A list of ignored prefixes for module index sorting.
8484
# modindex_common_prefix = []
@@ -88,7 +88,7 @@
8888

8989
# The theme to use for HTML and HTML Help pages. See the documentation for
9090
# a list of builtin themes.
91-
html_theme = 'default'
91+
html_theme = "default"
9292

9393
# Theme options are theme-specific and customize the look and feel of a theme
9494
# further. For a list of options available for each theme, see the
@@ -161,7 +161,7 @@
161161
# html_file_suffix = None
162162

163163
# Output file base name for HTML help builder.
164-
htmlhelp_basename = 'django-pipelinedoc'
164+
htmlhelp_basename = "django-pipelinedoc"
165165

166166

167167
# -- Options for LaTeX output --------------------------------------------------
@@ -175,8 +175,13 @@
175175
# Grouping the document tree into LaTeX files. List of tuples
176176
# (source start file, target name, title, author, documentclass [howto/manual]).
177177
latex_documents = [
178-
('index', 'django-pipeline.tex', 'Pipeline Documentation',
179-
'Timothée Peignier', 'manual'),
178+
(
179+
"index",
180+
"django-pipeline.tex",
181+
"Pipeline Documentation",
182+
"Timothée Peignier",
183+
"manual",
184+
),
180185
]
181186

182187
# The name of an image file (relative to this directory) to place at the top of
@@ -208,6 +213,5 @@
208213
# One entry per manual page. List of tuples
209214
# (source start file, name, description, authors, manual section).
210215
man_pages = [
211-
('index', 'django-pipeline', 'Pipeline Documentation',
212-
['Timothée Peignier'], 1)
216+
("index", "django-pipeline", "Pipeline Documentation", ["Timothée Peignier"], 1)
213217
]

pipeline/collector.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,16 @@ def collect(self, request=None, files=[]):
3737
# Ignore our finder to avoid looping
3838
if isinstance(finder, PipelineFinder):
3939
continue
40-
for path, storage in finder.list(['CVS', '.*', '*~']):
40+
for path, storage in finder.list(["CVS", ".*", "*~"]):
4141
# Prefix the relative path if the source storage contains it
42-
if getattr(storage, 'prefix', None):
42+
if getattr(storage, "prefix", None):
4343
prefixed_path = os.path.join(storage.prefix, path)
4444
else:
4545
prefixed_path = path
4646

47-
if (prefixed_path not in found_files and
48-
(not files or prefixed_path in files)):
47+
if prefixed_path not in found_files and (
48+
not files or prefixed_path in files
49+
):
4950
found_files[prefixed_path] = (storage, path)
5051
self.copy_file(path, prefixed_path, storage)
5152

@@ -82,8 +83,9 @@ def delete_file(self, path, prefixed_path, source_storage):
8283
else:
8384
# Skip the file if the source file is younger
8485
# Avoid sub-second precision
85-
if (target_last_modified.replace(microsecond=0)
86-
>= source_last_modified.replace(microsecond=0)):
86+
if target_last_modified.replace(
87+
microsecond=0
88+
) >= source_last_modified.replace(microsecond=0):
8789
return False
8890
# Then delete the existing file if really needed
8991
self.storage.delete(prefixed_path)

pipeline/compilers/__init__.py

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,13 @@ def _compile(input_path):
3636
project_infile = finders.find(input_path)
3737
outfile = compiler.output_path(infile, compiler.output_extension)
3838
outdated = compiler.is_outdated(project_infile, outfile)
39-
compiler.compile_file(project_infile, outfile,
40-
outdated=outdated, force=force,
41-
**compiler_options)
39+
compiler.compile_file(
40+
project_infile,
41+
outfile,
42+
outdated=outdated,
43+
force=force,
44+
**compiler_options,
45+
)
4246

4347
return compiler.output_path(input_path, compiler.output_extension)
4448
else:
@@ -71,14 +75,14 @@ def save_file(self, path, content):
7175
return self.storage.save(path, ContentFile(content))
7276

7377
def read_file(self, path):
74-
file = self.storage.open(path, 'rb')
78+
file = self.storage.open(path, "rb")
7579
content = file.read()
7680
file.close()
7781
return content
7882

7983
def output_path(self, path, extension):
8084
path = os.path.splitext(path)
81-
return '.'.join((path[0], extension))
85+
return ".".join((path[0], extension))
8286

8387
def is_outdated(self, infile, outfile):
8488
if not os.path.exists(outfile):
@@ -125,12 +129,11 @@ def execute_command(self, command, cwd=None, stdout_captured=None):
125129
cwd or os.path.dirname(stdout_captured or "") or os.getcwd()
126130
)
127131
with NamedTemporaryFile(
128-
'wb', delete=False, dir=temp_file_container
132+
"wb", delete=False, dir=temp_file_container
129133
) as stdout:
130-
compiling = subprocess.Popen(argument_list,
131-
cwd=cwd,
132-
stdout=stdout,
133-
stderr=subprocess.PIPE)
134+
compiling = subprocess.Popen(
135+
argument_list, cwd=cwd, stdout=stdout, stderr=subprocess.PIPE
136+
)
134137
_, stderr = compiling.communicate()
135138
set_std_streams_blocking()
136139

@@ -139,17 +142,17 @@ def execute_command(self, command, cwd=None, stdout_captured=None):
139142
raise CompilerError(
140143
f"{argument_list!r} exit code {compiling.returncode}\n{stderr}",
141144
command=argument_list,
142-
error_output=force_str(stderr))
145+
error_output=force_str(stderr),
146+
)
143147

144148
# User wants to see everything that happened.
145149
if self.verbose:
146-
with open(stdout.name, 'rb') as out:
150+
with open(stdout.name, "rb") as out:
147151
print(out.read())
148152
print(stderr)
149153
except OSError as e:
150154
stdout_captured = None # Don't save erroneous result.
151-
raise CompilerError(e, command=argument_list,
152-
error_output=str(e))
155+
raise CompilerError(e, command=argument_list, error_output=str(e))
153156
finally:
154157
# Decide what to do with captured stdout.
155158
if stdout:

pipeline/compilers/coffee.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33

44

55
class CoffeeScriptCompiler(SubProcessCompiler):
6-
output_extension = 'js'
6+
output_extension = "js"
77

88
def match_file(self, path):
9-
return path.endswith('.coffee') or path.endswith('.litcoffee')
9+
return path.endswith(".coffee") or path.endswith(".litcoffee")
1010

1111
def compile_file(self, infile, outfile, outdated=False, force=False):
1212
if not outdated and not force:

pipeline/compilers/es6.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33

44

55
class ES6Compiler(SubProcessCompiler):
6-
output_extension = 'js'
6+
output_extension = "js"
77

88
def match_file(self, path):
9-
return path.endswith('.es6')
9+
return path.endswith(".es6")
1010

1111
def compile_file(self, infile, outfile, outdated=False, force=False):
1212
if not outdated and not force:
@@ -16,6 +16,6 @@ def compile_file(self, infile, outfile, outdated=False, force=False):
1616
settings.BABEL_ARGUMENTS,
1717
infile,
1818
"-o",
19-
outfile
19+
outfile,
2020
)
2121
return self.execute_command(command)

pipeline/compilers/less.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55

66

77
class LessCompiler(SubProcessCompiler):
8-
output_extension = 'css'
8+
output_extension = "css"
99

1010
def match_file(self, filename):
11-
return filename.endswith('.less')
11+
return filename.endswith(".less")
1212

1313
def compile_file(self, infile, outfile, outdated=False, force=False):
1414
# Pipe to file rather than provide outfile arg due to a bug in lessc

pipeline/compilers/livescript.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33

44

55
class LiveScriptCompiler(SubProcessCompiler):
6-
output_extension = 'js'
6+
output_extension = "js"
77

88
def match_file(self, path):
9-
return path.endswith('.ls')
9+
return path.endswith(".ls")
1010

1111
def compile_file(self, infile, outfile, outdated=False, force=False):
1212
if not outdated and not force:

pipeline/compilers/sass.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,11 @@
55

66

77
class SASSCompiler(SubProcessCompiler):
8-
output_extension = 'css'
8+
output_extension = "css"
99

1010
def match_file(self, filename):
11-
return filename.endswith(('.scss', '.sass'))
11+
return filename.endswith((".scss", ".sass"))
1212

1313
def compile_file(self, infile, outfile, outdated=False, force=False):
14-
command = (
15-
settings.SASS_BINARY,
16-
settings.SASS_ARGUMENTS,
17-
infile,
18-
outfile
19-
)
14+
command = (settings.SASS_BINARY, settings.SASS_ARGUMENTS, infile, outfile)
2015
return self.execute_command(command, cwd=dirname(infile))

pipeline/compilers/stylus.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,11 @@
55

66

77
class StylusCompiler(SubProcessCompiler):
8-
output_extension = 'css'
8+
output_extension = "css"
99

1010
def match_file(self, filename):
11-
return filename.endswith('.styl')
11+
return filename.endswith(".styl")
1212

1313
def compile_file(self, infile, outfile, outdated=False, force=False):
14-
command = (
15-
settings.STYLUS_BINARY,
16-
settings.STYLUS_ARGUMENTS,
17-
infile
18-
)
14+
command = (settings.STYLUS_BINARY, settings.STYLUS_ARGUMENTS, infile)
1915
return self.execute_command(command, cwd=dirname(infile))

pipeline/compilers/typescript.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33

44

55
class TypeScriptCompiler(SubProcessCompiler):
6-
output_extension = 'js'
6+
output_extension = "js"
77

88
def match_file(self, path):
9-
return path.endswith('.ts')
9+
return path.endswith(".ts")
1010

1111
def compile_file(self, infile, outfile, outdated=False, force=False):
1212
if not outdated and not force:
@@ -15,7 +15,7 @@ def compile_file(self, infile, outfile, outdated=False, force=False):
1515
settings.TYPE_SCRIPT_BINARY,
1616
settings.TYPE_SCRIPT_ARGUMENTS,
1717
infile,
18-
'--outFile',
18+
"--outFile",
1919
outfile,
2020
)
2121
return self.execute_command(command)

0 commit comments

Comments
 (0)