Skip to content

Commit 03952e1

Browse files
committed
Fix external C++ doc
1 parent 8ec7d0a commit 03952e1

File tree

6 files changed

+46
-12
lines changed

6 files changed

+46
-12
lines changed

cmdstanpy/model.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,9 @@ def compile(
541541
x for x in lines if x.startswith('Semantic error')
542542
]
543543
exceptions = [
544-
x for x in lines if x.startswith('Uncaught exception')
544+
x
545+
for x in lines
546+
if 'Uncaught exception' in x or 'fatal error' in x
545547
]
546548
if (
547549
len(syntax_errors) > 0

cmdstanpy/stanfit/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,5 +217,5 @@ def from_csv(
217217
return None
218218
except (IOError, OSError, PermissionError) as e:
219219
raise ValueError(
220-
'An error occured processing the CSV files:\n\t{}'.format(str(e))
220+
'An error occurred processing the CSV files:\n\t{}'.format(str(e))
221221
) from e

docsrc/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ def emit(self, record):
403403
"CmdStanMCGQ": "~cmdstanpy.CmdStanMCGQ",
404404
}
405405

406-
nbsphinx_allow_errors = True
406+
nbsphinx_allow_errors = False
407407

408408
# Documents to append as an appendix to all manuals.
409409
# texinfo_appendices = []

docsrc/users-guide/examples/Using External C++.ipynb

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@
1919
{
2020
"cell_type": "code",
2121
"execution_count": null,
22-
"metadata": {"nbsphinx": "hidden"},
22+
"metadata": {
23+
"nbsphinx": "hidden"
24+
},
2325
"outputs": [],
2426
"source": [
2527
"import os\n",
@@ -50,7 +52,11 @@
5052
{
5153
"cell_type": "code",
5254
"execution_count": null,
53-
"metadata": {},
55+
"metadata": {
56+
"tags": [
57+
"raises-exception"
58+
]
59+
},
5460
"outputs": [],
5561
"source": [
5662
"model_external.compile()"
@@ -66,7 +72,11 @@
6672
{
6773
"cell_type": "code",
6874
"execution_count": null,
69-
"metadata": {},
75+
"metadata": {
76+
"tags": [
77+
"raises-exception"
78+
]
79+
},
7080
"outputs": [],
7181
"source": [
7282
"model_external.compile(stanc_options={'allow-undefined':True})"
@@ -135,7 +145,8 @@
135145
"hash": "8765ce46b013071999fc1966b52035a7309a0da7551e066cc0f0fa23e83d4f60"
136146
},
137147
"kernelspec": {
138-
"display_name": "Python 3.9.5 64-bit ('stan': conda)",
148+
"display_name": "Python 3",
149+
"language": "python",
139150
"name": "python3"
140151
},
141152
"language_info": {
@@ -149,9 +160,8 @@
149160
"nbconvert_exporter": "python",
150161
"pygments_lexer": "ipython3",
151162
"version": "3.9.5"
152-
},
153-
"orig_nbformat": 4
163+
}
154164
},
155165
"nbformat": 4,
156-
"nbformat_minor": 2
166+
"nbformat_minor": 4
157167
}

docsrc/users-guide/examples/Variational Inference.ipynb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,11 @@
109109
{
110110
"cell_type": "code",
111111
"execution_count": null,
112-
"metadata": {},
112+
"metadata": {
113+
"tags": [
114+
"raises-exception"
115+
]
116+
},
113117
"outputs": [],
114118
"source": [
115119
"model_fail = CmdStanModel(stan_file='eta_should_fail.stan')\n",
@@ -172,7 +176,7 @@
172176
"name": "python",
173177
"nbconvert_exporter": "python",
174178
"pygments_lexer": "ipython3",
175-
"version": "3.8.5"
179+
"version": "3.9.5"
176180
}
177181
},
178182
"nbformat": 4,
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
functions {
2+
real make_odds(real theta);
3+
}
4+
data {
5+
int<lower=0> N;
6+
array[N] int<lower=0, upper=1> y;
7+
}
8+
parameters {
9+
real<lower=0, upper=1> theta;
10+
}
11+
model {
12+
theta ~ beta(1, 1); // uniform prior on interval 0, 1
13+
y ~ bernoulli(theta);
14+
}
15+
generated quantities {
16+
real odds;
17+
odds = make_odds(theta);
18+
}

0 commit comments

Comments
 (0)