-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bump version, merge pull request #9 from AMYPAD/devel
- Loading branch information
Showing
21 changed files
with
297 additions
and
45 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
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,32 @@ | ||
default_language_version: | ||
python: python3 | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v2.4.0 | ||
hooks: | ||
- id: check-added-large-files | ||
- id: check-case-conflict | ||
- id: check-docstring-first | ||
- id: check-executables-have-shebangs | ||
- id: check-toml | ||
- id: check-yaml | ||
- id: end-of-file-fixer | ||
- id: mixed-line-ending | ||
- id: trailing-whitespace | ||
- hooks: | ||
- id: flake8 | ||
additional_dependencies: | ||
- flake8-bugbear | ||
- flake8-comprehensions | ||
- flake8-debugger | ||
- flake8-string-format | ||
repo: https://gitlab.com/pycqa/flake8 | ||
rev: 3.8.4 | ||
- hooks: | ||
- id: black | ||
repo: https://github.com/psf/black | ||
rev: 19.10b0 | ||
- hooks: | ||
- id: isort | ||
repo: https://github.com/timothycrosley/isort | ||
rev: 5.6.4 |
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,9 @@ | ||
- id: mbeautify | ||
name: mbeautify | ||
description: '`mbeautify` is a command-line utility for enforcing style consistency across Matlab projects.' | ||
entry: mbeautify | ||
language: python | ||
additional_dependencies: ['.[mbeautify]'] | ||
types: [text] | ||
files: \.(m)$ | ||
require_serial: true |
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
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
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 @@ | ||
#!/usr/bin/env python | ||
"""Usage: | ||
mbeautify <mfile>... | ||
Arguments: | ||
<mfile> : Path to `*.m` file | ||
""" | ||
import logging | ||
from functools import lru_cache, wraps | ||
from os import path | ||
from zipfile import ZipFile | ||
|
||
from argopt import argopt | ||
from tqdm.contrib import tmap | ||
|
||
from ..web import get_file | ||
from . import get_engine | ||
|
||
log = logging.getLogger(__name__) | ||
MBEAUTIFIER_REV = "aad307c62532cd7c852aab9bac44fd6443b90bef" | ||
|
||
|
||
@lru_cache() | ||
@wraps(get_engine) | ||
def ensure_mbeautifier(*args, **kwargs): | ||
eng = get_engine(*args, **kwargs) | ||
fn = get_file( | ||
"MBeautifier-aad307c.zip", | ||
"https://github.com/davidvarga/MBeautifier/archive/%s.zip" % MBEAUTIFIER_REV, | ||
) | ||
outpath = path.join(path.dirname(fn), "MBeautifier-%s" % MBEAUTIFIER_REV) | ||
if not path.exists(outpath): | ||
with ZipFile(fn) as fd: | ||
fd.extractall(path=path.dirname(outpath)) | ||
assert path.exists(outpath), "Error extracting" | ||
log.debug("adding wrappers (%s) to MATLAB path", outpath) | ||
eng.addpath(outpath, nargout=0) | ||
return eng | ||
|
||
|
||
def main(*args, **kwargs): | ||
args = argopt(__doc__).parse_args(*args, **kwargs) | ||
logging.basicConfig(level=logging.INFO) | ||
eng = ensure_mbeautifier() | ||
formatter = eng.MBeautify.formatFileNoEditor | ||
|
||
for fn in tmap(path.abspath, args.mfile): | ||
log.debug("file:%s", fn) | ||
formatter(fn, fn, nargout=0) | ||
|
||
|
||
if __name__ == "__main__": # pragma: no cover | ||
main() |
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.