MilesCranmer commited on
Commit
db5f4d5
1 Parent(s): 7021459

refactor: standardize constant

Browse files
Files changed (1) hide show
  1. pysr/sr.py +4 -4
pysr/sr.py CHANGED
@@ -57,7 +57,7 @@ from .utils import (
57
  _subscriptify,
58
  )
59
 
60
- already_ran = False
61
 
62
 
63
  def _process_constraints(binary_operators, unary_operators, constraints):
@@ -1602,7 +1602,7 @@ class PySRRegressor(MultiOutputMixin, RegressorMixin, BaseEstimator):
1602
  """
1603
  # Need to be global as we don't want to recreate/reinstate julia for
1604
  # every new instance of PySRRegressor
1605
- global already_ran
1606
 
1607
  # These are the parameters which may be modified from the ones
1608
  # specified in init, so we define them here locally:
@@ -1621,7 +1621,7 @@ class PySRRegressor(MultiOutputMixin, RegressorMixin, BaseEstimator):
1621
  cluster_manager = self.cluster_manager
1622
 
1623
  # Start julia backend processes
1624
- if not already_ran and update_verbosity != 0:
1625
  print("Compiling Julia backend...")
1626
 
1627
  if cluster_manager is not None:
@@ -1854,7 +1854,7 @@ class PySRRegressor(MultiOutputMixin, RegressorMixin, BaseEstimator):
1854
  if self.delete_tempfiles:
1855
  shutil.rmtree(self.tempdir_)
1856
 
1857
- already_ran = True
1858
 
1859
  return self
1860
 
 
57
  _subscriptify,
58
  )
59
 
60
+ ALREADY_RAN = False
61
 
62
 
63
  def _process_constraints(binary_operators, unary_operators, constraints):
 
1602
  """
1603
  # Need to be global as we don't want to recreate/reinstate julia for
1604
  # every new instance of PySRRegressor
1605
+ global ALREADY_RAN
1606
 
1607
  # These are the parameters which may be modified from the ones
1608
  # specified in init, so we define them here locally:
 
1621
  cluster_manager = self.cluster_manager
1622
 
1623
  # Start julia backend processes
1624
+ if not ALREADY_RAN and update_verbosity != 0:
1625
  print("Compiling Julia backend...")
1626
 
1627
  if cluster_manager is not None:
 
1854
  if self.delete_tempfiles:
1855
  shutil.rmtree(self.tempdir_)
1856
 
1857
+ ALREADY_RAN = True
1858
 
1859
  return self
1860