Spaces:
Running
Running
MilesCranmer
commited on
Commit
•
63ae9cd
1
Parent(s):
d3c4f72
Add pre-commit config
Browse files- gui/.pre-commit-config.yaml +33 -0
- gui/app.py +5 -5
- gui/gen_example_data.py +1 -1
gui/.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]
|
gui/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
|
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",
|
gui/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 |
|