MilesCranmer commited on
Commit
f3f3c91
·
unverified ·
1 Parent(s): 69ad41d

Add pre-commit config

Browse files
Files changed (4) hide show
  1. .pre-commit-config.yaml +33 -0
  2. app.py +5 -5
  3. fonts/OFL.txt +1 -1
  4. gen_example_data.py +1 -1
.pre-commit-config.yaml ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ repos:
2
+ # General linting
3
+ - repo: https://github.com/pre-commit/pre-commit-hooks
4
+ rev: v4.5.0
5
+ hooks:
6
+ - id: trailing-whitespace
7
+ - id: end-of-file-fixer
8
+ - id: check-yaml
9
+ - id: check-added-large-files
10
+ # General formatting
11
+ - repo: https://github.com/psf/black
12
+ rev: 23.12.1
13
+ hooks:
14
+ - id: black
15
+ - id: black-jupyter
16
+ exclude: pysr/test/test_nb.ipynb
17
+ # Stripping notebooks
18
+ - repo: https://github.com/kynan/nbstripout
19
+ rev: 0.6.1
20
+ hooks:
21
+ - id: nbstripout
22
+ exclude: pysr/test/test_nb.ipynb
23
+ # Unused imports
24
+ - repo: https://github.com/hadialqattan/pycln
25
+ rev: "v2.4.0"
26
+ hooks:
27
+ - id: pycln
28
+ # Sorted imports
29
+ - repo: https://github.com/PyCQA/isort
30
+ rev: "5.13.2"
31
+ hooks:
32
+ - id: isort
33
+ additional_dependencies: [toml]
app.py CHANGED
@@ -1,14 +1,14 @@
 
 
 
 
1
  import gradio as gr
2
  import numpy as np
3
- import os
4
  import pandas as pd
5
- import time
6
- import multiprocessing as mp
7
  from matplotlib import pyplot as plt
8
 
9
  plt.ioff()
10
  import tempfile
11
- from typing import Optional, Union
12
  from pathlib import Path
13
 
14
  empty_df = pd.DataFrame(
@@ -25,7 +25,7 @@ test_equations = ["sin(2*x)/x + 0.1*x"]
25
  def generate_data(s: str, num_points: int, noise_level: float, data_seed: int):
26
  rstate = np.random.RandomState(data_seed)
27
  x = rstate.uniform(-10, 10, num_points)
28
- for (k, v) in {
29
  "sin": "np.sin",
30
  "cos": "np.cos",
31
  "exp": "np.exp",
 
1
+ import multiprocessing as mp
2
+ import os
3
+ import time
4
+
5
  import gradio as gr
6
  import numpy as np
 
7
  import pandas as pd
 
 
8
  from matplotlib import pyplot as plt
9
 
10
  plt.ioff()
11
  import tempfile
 
12
  from pathlib import Path
13
 
14
  empty_df = pd.DataFrame(
 
25
  def generate_data(s: str, num_points: int, noise_level: float, data_seed: int):
26
  rstate = np.random.RandomState(data_seed)
27
  x = rstate.uniform(-10, 10, num_points)
28
+ for k, v in {
29
  "sin": "np.sin",
30
  "cos": "np.cos",
31
  "exp": "np.exp",
fonts/OFL.txt CHANGED
@@ -18,7 +18,7 @@ with others.
18
 
19
  The OFL allows the licensed fonts to be used, studied, modified and
20
  redistributed freely as long as they are not sold by themselves. The
21
- fonts, including any derivative works, can be bundled, embedded,
22
  redistributed and/or sold with any software provided that any reserved
23
  names are not used by derivative works. The fonts and derivatives,
24
  however, cannot be released under any other type of license. The
 
18
 
19
  The OFL allows the licensed fonts to be used, studied, modified and
20
  redistributed freely as long as they are not sold by themselves. The
21
+ fonts, including any derivative works, can be bundled, embedded,
22
  redistributed and/or sold with any software provided that any reserved
23
  names are not used by derivative works. The fonts and derivatives,
24
  however, cannot be released under any other type of license. The
gen_example_data.py CHANGED
@@ -1,5 +1,5 @@
1
- import pandas as pd
2
  import numpy as np
 
3
 
4
  rand_between = lambda a, b, size: np.random.rand(*size) * (b - a) + a
5
 
 
 
1
  import numpy as np
2
+ import pandas as pd
3
 
4
  rand_between = lambda a, b, size: np.random.rand(*size) * (b - a) + a
5