Skip to content

Commit c2e31aa

Browse files
committed
move test files to tests/data, send request to pymc-examples for other files
1 parent 4e5edd5 commit c2e31aa

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+11
-112226
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
exclude: ^(docs/logos|pymc3/examples/data)/
1+
exclude: ^(docs/logos|pymc3/tests/data)/
22
repos:
33
- repo: https://github.com/pre-commit/pre-commit-hooks
44
rev: v3.3.0

MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
recursive-include pymc3/examples/data *
1+
recursive-include pymc3/tests/data *
22
recursive-include source *
33
# because of an upload-size limit by PyPI, we're temporarily removing docs from the tarball:
44
recursive-exclude docs *

pymc3/data.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import io
1717
import os
1818
import pkgutil
19+
import urllib.request
1920

2021
from copy import copy
2122
from typing import Any, Dict, List
@@ -34,6 +35,7 @@
3435
"align_minibatches",
3536
"Data",
3637
]
38+
BASE_URL = "https://raw.githubusercontent.com/pymc-devs/pymc-examples/main/examples/data/{filename}"
3739

3840

3941
def get_data(filename):
@@ -48,8 +50,13 @@ def get_data(filename):
4850
-------
4951
BytesIO of the data
5052
"""
51-
data_pkg = "pymc3.examples"
52-
return io.BytesIO(pkgutil.get_data(data_pkg, os.path.join("data", filename)))
53+
data_pkg = "pymc3.tests"
54+
try:
55+
content = pkgutil.get_data(data_pkg, os.path.join("data", filename))
56+
except FileNotFoundError:
57+
with urllib.request.urlopen(BASE_URL.format(filename=filename)) as handle:
58+
content = handle.read()
59+
return io.BytesIO(content)
5360

5461

5562
class GenTensorVariable(tt.TensorVariable):

pymc3/examples/GHME_2013.py

Lines changed: 0 additions & 75 deletions
This file was deleted.

pymc3/examples/LKJ_correlation.py

Lines changed: 0 additions & 62 deletions
This file was deleted.

pymc3/examples/__init__.py

Whitespace-only changes.

pymc3/examples/arbitrary_stochastic.py

Lines changed: 0 additions & 32 deletions
This file was deleted.

pymc3/examples/arma_example.py

Lines changed: 0 additions & 90 deletions
This file was deleted.

pymc3/examples/baseball.py

Lines changed: 0 additions & 41 deletions
This file was deleted.

0 commit comments

Comments
 (0)