-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtasks.py
More file actions
68 lines (46 loc) · 1.16 KB
/
tasks.py
File metadata and controls
68 lines (46 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import shutil
from pathlib import Path
from invoke import task
project_root = Path(__file__).parent
@task
def clean(c):
cache_directories = [project_root / ".mypy_cache", project_root / "dist"]
for directory in cache_directories:
if directory.exists():
shutil.rmtree(directory)
@task
def clean_results(c):
analysis_root = project_root / "src/afm_simulations/analysis"
for root in (project_root, analysis_root):
results_directories = [
root / "cache",
root / "data",
root / "fig",
]
for directory in results_directories:
if directory.exists():
shutil.rmtree(directory)
@task
def black(c):
c.run(f"black --check {project_root}")
@task
def isort(c):
c.run(f"isort --check {project_root}")
@task
def flake(c):
c.run(f"flake8 {project_root}")
@task
def mypy(c):
c.run(f"mypy {project_root}")
@task(black, isort, flake, mypy)
def check(c):
pass
@task
def black_fix(c):
c.run(f"black {project_root}")
@task
def isort_fix(c):
c.run(f"isort {project_root}")
@task(black_fix, isort_fix, black_fix)
def fix(c):
pass