qiaojunfeng commited on
Commit
8e3d125
·
1 Parent(s): 32d2da0

Run `pre-commit run --all-files`

Browse files
.pre-commit-config.yaml ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ repos:
2
+ - repo: https://github.com/Lucas-C/pre-commit-hooks
3
+ rev: v1.5.5
4
+ hooks:
5
+ - id: forbid-crlf
6
+ - id: remove-crlf
7
+ - repo: https://github.com/pre-commit/pre-commit-hooks
8
+ rev: v5.0.0
9
+ hooks:
10
+ - id: check-added-large-files
11
+ args: ['--maxkb=512000'] # 500MB
12
+ - id: check-executables-have-shebangs
13
+ - id: check-shebang-scripts-are-executable
14
+ - id: trailing-whitespace
15
+ exclude: &exclude_txtfiles >-
16
+ (?x)^(
17
+ datasets/.*\.amn|
18
+ datasets/.*\.mmn|
19
+ datasets/.*\.eig|
20
+ datasets/.*\.chk|
21
+ datasets/.*\.chk\.fmt|
22
+ datasets/.*\.spn|
23
+ datasets/.*\.spn\.fmt|
24
+ datasets/.*\.uHu\.fmt|
25
+ datasets/.*\.mud|
26
+ datasets/.*\.nnkp|
27
+ datasets/.*\.wout|
28
+ datasets/.*\.wpout|
29
+ datasets/.*_band\.dat|
30
+ datasets/.*_band\.kpt|
31
+ datasets/.*_band\.labelinfo\.dat|
32
+ datasets/.*_tb\.dat|
33
+ datasets/.*_hr\.dat|
34
+ datasets/.*_r\.dat|
35
+ datasets/.*_wsvec\.dat|
36
+ datasets/.*_u\.mat|
37
+ datasets/.*_u_dis\.mat|
38
+ datasets/.*\.xsf|
39
+ datasets/.*\.bxsf|
40
+ datasets/.*\.cube|
41
+ datasets/.*\.gnu|
42
+ datasets/.*-bands\.dat|
43
+ datasets/.*-curv\.dat|
44
+ datasets/.*-morb\.dat
45
+ )$
46
+ - id: mixed-line-ending
47
+ exclude: *exclude_txtfiles
48
+ - id: end-of-file-fixer
49
+ exclude: *exclude_txtfiles
50
+ - id: check-merge-conflict
51
+ - id: check-yaml
52
+ args: [ --unsafe ]
53
+ - id: check-json
54
+ - id: check-toml
55
+ - id: check-xml
56
+ - repo: https://github.com/qiaojunfeng/pre-commit-julia-format
57
+ rev: v0.2.0
58
+ hooks:
59
+ - id: julia-format
datasets/BN/inputs/LGXKG.txt CHANGED
@@ -110,7 +110,7 @@
110
  0.604166666667 0.604166666667 0.208333333333 0.00151975683891
111
  0.611111111111 0.611111111111 0.222222222222 0.00151975683891
112
  0.618055555556 0.618055555556 0.236111111111 0.00151975683891
113
- 0.625 0.625 0.25 0.00151975683891
114
  0.739386792453 0.369693396226 0.369693396226 0.00151975683891
115
  0.725235849057 0.362617924528 0.362617924528 0.00151975683891
116
  0.71108490566 0.35554245283 0.35554245283 0.00151975683891
 
110
  0.604166666667 0.604166666667 0.208333333333 0.00151975683891
111
  0.611111111111 0.611111111111 0.222222222222 0.00151975683891
112
  0.618055555556 0.618055555556 0.236111111111 0.00151975683891
113
+ 0.625 0.625 0.25 0.00151975683891
114
  0.739386792453 0.369693396226 0.369693396226 0.00151975683891
115
  0.725235849057 0.362617924528 0.362617924528 0.00151975683891
116
  0.71108490566 0.35554245283 0.35554245283 0.00151975683891
make_artifacts.jl CHANGED
@@ -22,7 +22,7 @@ const deploy_branch = "artifacts"
22
  folder: e.g. `"Si2"`
23
  local_url: use local file path for the url, for testing only
24
  """
25
- function create_artifact(folder::AbstractString; local_url::Bool=false)
26
  fullpath = joinpath(datasets_dir, folder)
27
  isdir(fullpath) || return
28
 
@@ -75,12 +75,13 @@ function create_artifact(folder::AbstractString; local_url::Bool=false)
75
  end
76
 
77
  artifact_name = folder
78
- res = artifact_name => Dict(
79
- "git-tree-sha1" => Tar.tree_hash(IOBuffer(inflate_gzip(outpath))),
80
- "lazy" => true,
81
- "download" =>
82
- [Dict("url" => url, "sha256" => bytes2hex(open(sha256, outpath)))],
83
- )
 
84
 
85
  # print the result as toml
86
  buf = IOBuffer()
@@ -91,7 +92,7 @@ function create_artifact(folder::AbstractString; local_url::Bool=false)
91
  return res
92
  end
93
 
94
- function git_hash(path::AbstractString; branch::AbstractString="HEAD")
95
  return read(`git log -n 1 --pretty=format:"%H" $branch -- "$path"`, String)
96
  end
97
 
@@ -109,7 +110,7 @@ function list_previous_artifacts()
109
  # to create the artifacts branch
110
  files = split(read(`git ls-tree -r --name-only $deploy_branch`, String))
111
  filter!(f -> endswith(f, ".tar.gz"), files)
112
- return Dict(f => git_hash(f; branch=deploy_branch) for f in files)
113
  end
114
 
115
  function list_new_folders()
@@ -141,7 +142,7 @@ function clean_artifacts_dir()
141
  println("Aborting...")
142
  return false
143
  end
144
- rm(artifacts_dir; force=true, recursive=true)
145
  mkpath(artifacts_dir)
146
  println("Cleaned `$(artifacts_dir)` folder.")
147
  return true
 
22
  folder: e.g. `"Si2"`
23
  local_url: use local file path for the url, for testing only
24
  """
25
+ function create_artifact(folder::AbstractString; local_url::Bool = false)
26
  fullpath = joinpath(datasets_dir, folder)
27
  isdir(fullpath) || return
28
 
 
75
  end
76
 
77
  artifact_name = folder
78
+ res =
79
+ artifact_name => Dict(
80
+ "git-tree-sha1" => Tar.tree_hash(IOBuffer(inflate_gzip(outpath))),
81
+ "lazy" => true,
82
+ "download" =>
83
+ [Dict("url" => url, "sha256" => bytes2hex(open(sha256, outpath)))],
84
+ )
85
 
86
  # print the result as toml
87
  buf = IOBuffer()
 
92
  return res
93
  end
94
 
95
+ function git_hash(path::AbstractString; branch::AbstractString = "HEAD")
96
  return read(`git log -n 1 --pretty=format:"%H" $branch -- "$path"`, String)
97
  end
98
 
 
110
  # to create the artifacts branch
111
  files = split(read(`git ls-tree -r --name-only $deploy_branch`, String))
112
  filter!(f -> endswith(f, ".tar.gz"), files)
113
+ return Dict(f => git_hash(f; branch = deploy_branch) for f in files)
114
  end
115
 
116
  function list_new_folders()
 
142
  println("Aborting...")
143
  return false
144
  end
145
+ rm(artifacts_dir; force = true, recursive = true)
146
  mkpath(artifacts_dir)
147
  println("Cleaned `$(artifacts_dir)` folder.")
148
  return true