File tree Expand file tree Collapse file tree 2 files changed +24
-22
lines changed
Expand file tree Collapse file tree 2 files changed +24
-22
lines changed Original file line number Diff line number Diff line change @@ -486,3 +486,23 @@ def format_stan_file(
486486
487487 except (ValueError , RuntimeError ) as e :
488488 raise RuntimeError ("Stanc formatting failed" ) from e
489+
490+
491+ def resolve_cpp_options (
492+ cpp_options : dict [str , Any ] | None , multithreading : bool
493+ ) -> dict [str , Any ]:
494+ out = cpp_options or {}
495+ out = out .copy ()
496+ if multithreading and "STAN_THREADS" not in out :
497+ out ["STAN_THREADS" ] = "TRUE"
498+ return out
499+
500+
501+ def resolve_stanc_options (
502+ stanc_options : dict [str , Any ] | None , stanc_optimizations : bool
503+ ) -> dict [str , Any ]:
504+ out = stanc_options or {}
505+ out = out .copy ()
506+ if stanc_optimizations and "O" not in out :
507+ out ["O" ] = 1
508+ return out
Original file line number Diff line number Diff line change @@ -119,10 +119,12 @@ def __init__(
119119 """
120120 self ._name = ''
121121 self ._stan_file = None
122- self ._stanc_options = self . _resolve_stanc_options (
122+ self ._stanc_options = compilation . resolve_stanc_options (
123123 stanc_options , stanc_optimizations
124124 )
125- cpp_options = self ._resolve_cpp_options (cpp_options , multithreading )
125+ cpp_options = compilation .resolve_cpp_options (
126+ cpp_options , multithreading
127+ )
126128
127129 self ._fixed_param = False
128130
@@ -260,26 +262,6 @@ def code(self) -> str | None:
260262 )
261263 return code
262264
263- @staticmethod
264- def _resolve_cpp_options (
265- cpp_options : dict [str , Any ] | None , multithreading : bool
266- ) -> dict [str , Any ]:
267- out = cpp_options or {}
268- out = out .copy ()
269- if multithreading and "STAN_THREADS" not in out :
270- out ["STAN_THREADS" ] = "TRUE"
271- return out
272-
273- @staticmethod
274- def _resolve_stanc_options (
275- stanc_options : dict [str , Any ] | None , stanc_optimizations : bool
276- ) -> dict [str , Any ]:
277- out = stanc_options or {}
278- out = out .copy ()
279- if stanc_optimizations and "O" not in out :
280- out ["O" ] = 1
281- return out
282-
283265 def optimize (
284266 self ,
285267 data : Mapping [str , Any ] | str | os .PathLike | None = None ,
You can’t perform that action at this time.
0 commit comments