-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #89 from neutrinoceros/formatting_conf
STY: copy over yt's linting+formatting configuration
- Loading branch information
Showing
78 changed files
with
2,869 additions
and
2,099 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# migrate to black + isort + pyupgrade | ||
88e8d9e5afd0ca7d20afb0a15383bcede0f1b1cd | ||
8553023d396182eb2315f3816623f852d2a51dc7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# pre-commit 1.1.0 is required for `exclude` | ||
# however `minimum_pre_commit_version` itself requires 1.15.0 | ||
minimum_pre_commit_version: "1.15.0" | ||
|
||
ci: | ||
autofix_prs: true | ||
|
||
repos: | ||
#- repo: https://github.com/asottile/setup-cfg-fmt | ||
# rev: v1.17.0 | ||
# hooks: | ||
# - id: setup-cfg-fmt | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.0.1 | ||
hooks: | ||
- id: trailing-whitespace | ||
- id: end-of-file-fixer | ||
- id: no-commit-to-branch | ||
- repo: https://github.com/asottile/pyupgrade | ||
rev: v2.29.0 | ||
hooks: | ||
- id: pyupgrade | ||
args: [--py36-plus] | ||
- repo: https://github.com/psf/black | ||
rev: 21.9b0 | ||
hooks: | ||
- id: black | ||
- repo: https://github.com/PyCQA/isort | ||
rev: '5.9.3' | ||
hooks: | ||
- id: isort | ||
name: isort (python) | ||
- id: isort | ||
name: isort (cython) | ||
types: [cython] | ||
- repo: https://github.com/PyCQA/flake8 | ||
rev: '3.9.2' | ||
hooks: | ||
- id: flake8 | ||
additional_dependencies: [ | ||
flake8-bugbear==21.9.1, | ||
flake8-logging-format==0.6.0, | ||
flake8-2020==1.6.0, | ||
] | ||
- repo: https://github.com/asottile/blacken-docs | ||
rev: v1.11.0 | ||
hooks: | ||
- id: blacken-docs | ||
additional_dependencies: [black==21.8b0] | ||
#- repo: https://github.com/pre-commit/pygrep-hooks | ||
# rev: v1.9.0 | ||
# hooks: | ||
# - id: rst-backticks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,38 @@ | ||
import re | ||
import subprocess | ||
|
||
from docutils import statemachine | ||
from sphinx.util.compat import Directive | ||
|
||
|
||
def setup(app): | ||
app.add_directive('config_help', GetConfigHelp) | ||
app.add_directive("config_help", GetConfigHelp) | ||
setup.app = app | ||
setup.config = app.config | ||
setup.confdir = app.confdir | ||
|
||
retdict = dict( | ||
version='1.0', | ||
parallel_read_safe=True, | ||
parallel_write_safe=True | ||
) | ||
retdict = dict(version="1.0", parallel_read_safe=True, parallel_write_safe=True) | ||
|
||
return retdict | ||
|
||
|
||
class GetConfigHelp(Directive): | ||
required_arguments = 1 | ||
optional_arguments = 0 | ||
final_argument_whitespace = True | ||
|
||
def run(self): | ||
rst_file = self.state_machine.document.attributes['source'] | ||
data = subprocess.check_output( | ||
self.arguments[0].split(" ") + ['-h']).decode('utf8').split('\n') | ||
ind = next((i for i, val in enumerate(data) | ||
if re.match('\s{0,3}\{.*\}\s*$', val))) | ||
lines = ['.. code-block:: none', ''] + data[ind + 1:] | ||
rst_file = self.state_machine.document.attributes["source"] | ||
data = ( | ||
subprocess.check_output(self.arguments[0].split(" ") + ["-h"]) | ||
.decode("utf8") | ||
.split("\n") | ||
) | ||
ind = next( | ||
(i for i, val in enumerate(data) if re.match(r"\s{0,3}\{.*\}\s*$", val)) | ||
) | ||
lines = [".. code-block:: none", ""] + data[ind + 1 :] | ||
self.state_machine.insert_input( | ||
statemachine.string2lines("\n".join(lines)), rst_file) | ||
statemachine.string2lines("\n".join(lines)), rst_file | ||
) | ||
return [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.