Skip to content

Commit d170cd0

Browse files
committed
Add script for converting code from 3 to 4.
1 parent 862bd05 commit d170cd0

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

scripts/pymc3_to_4.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/bash
2+
3+
if [ -z "$1" ]
4+
then
5+
echo "Usage: pymc3_to_4.sh <path>"
6+
exit 1
7+
fi
8+
9+
declare -a replace_strings=(
10+
"s/az.from_pymc3/pm.to_inference_data/g"
11+
"s/arviz.from_pymc3/pm.to_inference_data/g"
12+
"s/pymc3/pymc/g"
13+
"s/PyMC3/PyMC/g"
14+
"s/from theano import tensor as tt/import aesara.tensor as at/g"
15+
"s/import theano\.tensor as tt/import aesara.tensor as at/g"
16+
"s/tt\./at./g"
17+
"s/aet/at/g"
18+
"s/studenat/studentt/g"
19+
"s/theano/aesara/g"
20+
"s/Theano/Aesara/g"
21+
"s/pm\.sample()/pm.sample(return_inferencedata=False)/g"
22+
"s/, return_inferencedata\=True//g"
23+
"s/return_inferencedata\=True, //g"
24+
"s/return_inferencedata\=True//g"
25+
)
26+
27+
for replace in "${replace_strings[@]}"; do
28+
find $1 -name "*.ipynb" -type f -exec sed -i -e "$replace" {} \;
29+
find $1 -name "*.py" -type f -exec sed -i -e "$replace" {} \;
30+
done

0 commit comments

Comments
 (0)