Skip to content

Commit 669cb40

Browse files
authored
Merge pull request #1 from ymkim92/ruff
Ruff
2 parents f65edcf + c7333cc commit 669cb40

File tree

9 files changed

+286
-81
lines changed

9 files changed

+286
-81
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
__pycache__
2+
.mypy_cache
3+
.coverage
4+
htmlcov

.justfile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
run-test:
2+
pytest -svv
3+
run-test-filter TEST:
4+
pytest -svv tests/*{{TEST}}*
5+
lint:
6+
ruff format src tests
7+
ruff check src tests --fix --exit-zero --line-length 100 --target-version py38
8+
9+
install-requirement:
10+
pip install -r requirements.txt
11+
list:
12+
mpremote ls
13+
upload:
14+
mpremote cp src/main.py :main.py
15+
mpremote mkdir :diy_clock || echo "Directory already exists."
16+
mpremote cp src/diy_clock/*.py :diy_clock/
17+
mount_and_run:
18+
mpremote mount src/ run src/main.py

.vscode/settings.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"editor.rulers": [
3+
100,
4+
],
5+
"[python]": {
6+
"editor.formatOnSave": true,
7+
"editor.defaultFormatter": "charliermarsh.ruff",
8+
},
9+
"pylint.enabled": false,
10+
"ruff.lint.enable": true,
11+
"ruff.lint.select": ["E501"],
12+
"python.testing.pytestArgs": [
13+
"src"
14+
],
15+
"python.testing.unittestEnabled": false,
16+
"python.testing.pytestEnabled": true,
17+
"editor.fontSize": 14,
18+
"flake8.enabled": false,
19+
}

just.bash

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
_just() {
2+
local i cur prev opts cmds
3+
COMPREPLY=()
4+
cur="${COMP_WORDS[COMP_CWORD]}"
5+
prev="${COMP_WORDS[COMP_CWORD-1]}"
6+
cmd=""
7+
opts=""
8+
9+
for i in ${COMP_WORDS[@]}
10+
do
11+
case "${i}" in
12+
"$1")
13+
cmd="just"
14+
;;
15+
16+
*)
17+
;;
18+
esac
19+
done
20+
21+
case "${cmd}" in
22+
just)
23+
opts=" -n -q -u -v -e -l -h -V -f -d -c -s --check --yes --dry-run --highlight --no-dotenv --no-highlight --quiet --shell-command --clear-shell-args --unsorted --unstable --verbose --changelog --choose --dump --edit --evaluate --fmt --init --list --summary --variables --help --version --chooser --color --command-color --dump-format --list-heading --list-prefix --justfile --set --shell --shell-arg --working-directory --command --completions --show --dotenv-filename --dotenv-path <ARGUMENTS>... "
24+
if [[ ${cur} == -* ]] ; then
25+
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
26+
return 0
27+
elif [[ ${COMP_CWORD} -eq 1 ]]; then
28+
local recipes=$(just --summary 2> /dev/null)
29+
30+
if echo "${cur}" | \grep -qF '/'; then
31+
local path_prefix=$(echo "${cur}" | sed 's/[/][^/]*$/\//')
32+
local recipes=$(just --summary 2> /dev/null -- "${path_prefix}")
33+
local recipes=$(printf "${path_prefix}%s\t" $recipes)
34+
fi
35+
36+
if [[ $? -eq 0 ]]; then
37+
COMPREPLY=( $(compgen -W "${recipes}" -- "${cur}") )
38+
return 0
39+
fi
40+
fi
41+
case "${prev}" in
42+
43+
--chooser)
44+
COMPREPLY=($(compgen -f "${cur}"))
45+
return 0
46+
;;
47+
--color)
48+
COMPREPLY=($(compgen -W "auto always never" -- "${cur}"))
49+
return 0
50+
;;
51+
--command-color)
52+
COMPREPLY=($(compgen -W "black blue cyan green purple red yellow" -- "${cur}"))
53+
return 0
54+
;;
55+
--dump-format)
56+
COMPREPLY=($(compgen -W "just json" -- "${cur}"))
57+
return 0
58+
;;
59+
--list-heading)
60+
COMPREPLY=($(compgen -f "${cur}"))
61+
return 0
62+
;;
63+
--list-prefix)
64+
COMPREPLY=($(compgen -f "${cur}"))
65+
return 0
66+
;;
67+
--justfile)
68+
COMPREPLY=($(compgen -f "${cur}"))
69+
return 0
70+
;;
71+
-f)
72+
COMPREPLY=($(compgen -f "${cur}"))
73+
return 0
74+
;;
75+
--set)
76+
COMPREPLY=($(compgen -f "${cur}"))
77+
return 0
78+
;;
79+
--shell)
80+
COMPREPLY=($(compgen -f "${cur}"))
81+
return 0
82+
;;
83+
--shell-arg)
84+
COMPREPLY=($(compgen -f "${cur}"))
85+
return 0
86+
;;
87+
--working-directory)
88+
COMPREPLY=($(compgen -f "${cur}"))
89+
return 0
90+
;;
91+
-d)
92+
COMPREPLY=($(compgen -f "${cur}"))
93+
return 0
94+
;;
95+
--command)
96+
COMPREPLY=($(compgen -f "${cur}"))
97+
return 0
98+
;;
99+
-c)
100+
COMPREPLY=($(compgen -f "${cur}"))
101+
return 0
102+
;;
103+
--completions)
104+
COMPREPLY=($(compgen -W "zsh bash fish powershell elvish" -- "${cur}"))
105+
return 0
106+
;;
107+
--show)
108+
COMPREPLY=($(compgen -f "${cur}"))
109+
return 0
110+
;;
111+
-s)
112+
COMPREPLY=($(compgen -f "${cur}"))
113+
return 0
114+
;;
115+
--dotenv-filename)
116+
COMPREPLY=($(compgen -f "${cur}"))
117+
return 0
118+
;;
119+
--dotenv-path)
120+
COMPREPLY=($(compgen -f "${cur}"))
121+
return 0
122+
;;
123+
*)
124+
COMPREPLY=()
125+
;;
126+
esac
127+
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
128+
return 0
129+
;;
130+
131+
esac
132+
}
133+
134+
complete -F _just -o bashdefault -o default just

pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[tool.ruff]
2+
line-length = 100
3+
# keep normal rules and add this extra one.
4+
lint.extend-select = ["E501"]

pytest.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[pytest]
2+
pythonpath = src

requirements.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
pytest
2+
mpremote
3+
ruff

main.py renamed to src/main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
while True:
1010
if wm.is_connected():
11-
print('Connected!')
11+
print("Connected!")
1212
else:
13-
print('Disconnected!')
13+
print("Disconnected!")
1414
utime.sleep(10)

0 commit comments

Comments
 (0)