| 925 | |
| 926 | # Wrapper for pooch.retrieve(...) and pooch.create(...) |
| 927 | def __call__(self, *args, **kwargs): |
| 928 | assert "path" in kwargs |
| 929 | if "fname" in kwargs: # pooch.retrieve(...) |
| 930 | self.call_args_list.append((args, kwargs)) |
| 931 | path = Path(kwargs["path"], kwargs["fname"]) |
| 932 | path.parent.mkdir(parents=True, exist_ok=True) |
| 933 | path.write_text("test") |
| 934 | return path |
| 935 | else: # pooch.create(...) has been called |
| 936 | self.path = kwargs["path"] |
| 937 | return self |
| 938 | |
| 939 | # Wrappers for Pooch instances (e.g., in eegbci we pooch.create) |
| 940 | def fetch(self, fname): |