File tree Expand file tree Collapse file tree 4 files changed +34
-21
lines changed Expand file tree Collapse file tree 4 files changed +34
-21
lines changed Original file line number Diff line number Diff line change 1818 python-version : [ "3.9" ]
1919
2020 steps :
21+ - name : Cache
22+ uses : actions/cache@v3
23+ with :
24+ path : |
25+ ~/.cache/pooch
26+ key : ${{ runner.os }}-py${{ matrix.python-version }}-${{ github.job }}
27+
2128 - name : Set up Python ${{ matrix.python-version }}
2229 uses : actions/setup-python@v5
2330 with :
@@ -265,6 +272,13 @@ jobs:
265272 runs-on : macos-latest
266273
267274 steps :
275+ - name : Cache
276+ uses : actions/cache@v3
277+ with :
278+ path : |
279+ ~/Library/Caches/pooch
280+ key : ${{ runner.os }}-py${{ matrix.python-version }}-${{ github.job }}
281+
268282 - name : Set up Python
269283 uses : actions/setup-python@v5
270284 with :
Original file line number Diff line number Diff line change 6262 # unsupported x86_64 / x86_64h
6363 antimony!=2.14; platform_system=='Darwin' and platform_machine in 'x86_64h'
6464 scipy
65+ pooch
6566vis =
6667 matplotlib
6768 seaborn
Original file line number Diff line number Diff line change 155155def data_demartino2014 ():
156156 """Get tests from DeMartino2014 Suppl. Material"""
157157 import gzip
158- import io
159- import urllib .request
158+ import pooch
160159
161160 # stoichiometric matrix
162- response = urllib .request .urlopen (
163- r"https://github.com/AMICI-dev/AMICI/files/11430971/DeMartinoDe2014_test-ecoli.dat.gz" ,
164- timeout = 10 ,
161+ data = gzip .GzipFile (
162+ pooch .retrieve (
163+ "https://github.com/AMICI-dev/AMICI/files/11430971/DeMartinoDe2014_test-ecoli.dat.gz" ,
164+ known_hash = "md5:899873f8f1c413d13c3f8e94c1496b7e" ,
165+ )
165166 )
166- data = gzip .GzipFile (fileobj = io .BytesIO (response .read ()))
167167 S = [
168168 int (item )
169169 for sl in [
@@ -174,14 +174,13 @@ def data_demartino2014():
174174 ]
175175
176176 # metabolite / row names
177- response = urllib .request .urlopen (
178- r"https://github.com/AMICI-dev/AMICI/files/11430970/test-ecoli-met.txt" ,
179- timeout = 10 ,
180- )
181- row_names = [
182- entry .decode ("ascii" ).strip () for entry in io .BytesIO (response .read ())
183- ]
184-
177+ with open (
178+ pooch .retrieve (
179+ "https://github.com/AMICI-dev/AMICI/files/11430970/test-ecoli-met.txt" ,
180+ known_hash = "md5:d71e711a3655311390b38d00dcd6aa7f" ,
181+ )
182+ ) as f :
183+ row_names = [entry .strip () for entry in f .readlines ()]
185184 return S , row_names
186185
187186
Original file line number Diff line number Diff line change 33import re
44from numbers import Number
55from pathlib import Path
6- from urllib .request import urlopen
76
87import amici
98import libsbml
@@ -543,13 +542,13 @@ def test_sympy_exp_monkeypatch():
543542 monkeypatching sympy.Pow._eval_derivative in order to be able to compute
544543 non-nan sensitivities
545544 """
546- url = (
547- "https://www.ebi.ac.uk/biomodels/model/download/BIOMD0000000529.2?"
548- "filename=BIOMD0000000529_url.xml"
549- )
550- importer = amici .SbmlImporter (
551- urlopen (url , timeout = 20 ).read ().decode ("utf-8" ), from_file = False
545+ import pooch
546+
547+ model_file = pooch .retrieve (
548+ url = "https://www.ebi.ac.uk/biomodels/model/download/BIOMD0000000529.2?filename=BIOMD0000000529_url.xml" ,
549+ known_hash = "md5:c6e0b298397485b93d7acfab80b21fd4" ,
552550 )
551+ importer = amici .SbmlImporter (model_file )
553552 module_name = "BIOMD0000000529"
554553
555554 with TemporaryDirectory () as outdir :
You can’t perform that action at this time.
0 commit comments