Spaces:
Sleeping
Sleeping
Commit
·
db11d11
1
Parent(s):
28fe28e
Clean up anti-patterns
Browse files- pysr/sr.py +4 -5
pysr/sr.py
CHANGED
|
@@ -264,17 +264,16 @@ def pysr(
|
|
| 264 |
if constraints is None:
|
| 265 |
constraints = {}
|
| 266 |
|
|
|
|
|
|
|
| 267 |
if progress is not None:
|
| 268 |
-
if progress and
|
| 269 |
warnings.warn(
|
| 270 |
"Note: it looks like you are running in Jupyter. The progress bar will be turned off."
|
| 271 |
)
|
| 272 |
progress = False
|
| 273 |
else:
|
| 274 |
-
|
| 275 |
-
progress = True
|
| 276 |
-
else:
|
| 277 |
-
progress = False
|
| 278 |
|
| 279 |
assert optimizer_algorithm in ["NelderMead", "BFGS"]
|
| 280 |
assert tournament_selection_n < npop
|
|
|
|
| 264 |
if constraints is None:
|
| 265 |
constraints = {}
|
| 266 |
|
| 267 |
+
buffer_available = "buffer" in sys.stdout.__dir__()
|
| 268 |
+
|
| 269 |
if progress is not None:
|
| 270 |
+
if progress and not buffer_available:
|
| 271 |
warnings.warn(
|
| 272 |
"Note: it looks like you are running in Jupyter. The progress bar will be turned off."
|
| 273 |
)
|
| 274 |
progress = False
|
| 275 |
else:
|
| 276 |
+
progress = buffer_available
|
|
|
|
|
|
|
|
|
|
| 277 |
|
| 278 |
assert optimizer_algorithm in ["NelderMead", "BFGS"]
|
| 279 |
assert tournament_selection_n < npop
|