Skip to content

Commit e7fd4ed

Browse files
authored
add and run precommit to format codes (#24)
* add pre-commit config * run pre-commit
1 parent fcfdb0d commit e7fd4ed

16 files changed

+1705
-1023
lines changed

.github/workflows/python-publish.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
release:
88
types: [published]
99
workflow_dispatch:
10-
10+
1111

1212

1313
jobs:

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,4 @@ env/
5353
venv/
5454
ENV/
5555
env.bak/
56-
venv.bak/
56+
venv.bak/

.pre-commit-config.yaml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# See https://pre-commit.com for more information
2+
# See https://pre-commit.com/hooks.html for more hooks
3+
repos:
4+
- repo: https://github.com/pre-commit/pre-commit-hooks
5+
rev: v4.4.0
6+
hooks:
7+
- id: trailing-whitespace
8+
- id: end-of-file-fixer
9+
- id: check-yaml
10+
- id: check-json
11+
- id: check-added-large-files
12+
- id: check-merge-conflict
13+
- id: check-symlinks
14+
- id: check-toml
15+
# Python
16+
- repo: https://github.com/psf/black
17+
rev: 22.12.0
18+
hooks:
19+
- id: black-jupyter

README.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
# Argument checking for python programs
22

3-
This is a minimum version for checking the input argument dict.
4-
It would examine argument's type, as well as keys and types of its sub-arguments.
3+
This is a minimum version for checking the input argument dict.
4+
It would examine argument's type, as well as keys and types of its sub-arguments.
55

6-
A special case called *variant* is also handled,
7-
where you can determine the items of a dict based the value of on one of its `flag_name` key.
6+
A special case called *variant* is also handled,
7+
where you can determine the items of a dict based the value of on one of its `flag_name` key.
88

99
There are three main methods of `Argument` class:
1010

1111
- `check` method that takes a dict and see if its type follows the definition in the class
1212
- `normalize` method that takes a dict and convert alias and add default value into it
1313
- `gendoc` method that outputs the defined argument structure and corresponding docs
1414

15-
There are also `check_value` and `normalize_value` that
15+
There are also `check_value` and `normalize_value` that
1616
ignore the leading key comparing to the base version.
1717

18-
When targeting to html rendering, additional anchor can be made for cross reference.
18+
When targeting to html rendering, additional anchor can be made for cross reference.
1919
Set `make_anchor=True` when calling `gendoc` function and use standard ref syntax in rst.
2020
The id is the same as the argument path. Variant types would be in square brackets.
2121

dargs/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
from .dargs import Argument, Variant, ArgumentEncoder
22

3-
__all__ = ["Argument", "Variant", "ArgumentEncoder"]
3+
__all__ = ["Argument", "Variant", "ArgumentEncoder"]

0 commit comments

Comments
 (0)