Skip to content

Commit 9b9a857

Browse files
ArlindKadramfeurer
authored andcommitted
Adding support for home directory symbol (#441)
* Adding support for home directory symbol * Fixing backward compatibility
1 parent 87ad7b1 commit 9b9a857

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

openml/config.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def _setup():
5555
config = _parse_config()
5656
apikey = config.get('FAKE_SECTION', 'apikey')
5757
server = config.get('FAKE_SECTION', 'server')
58-
cache_directory = config.get('FAKE_SECTION', 'cachedir')
58+
cache_directory = os.path.expanduser(config.get('FAKE_SECTION', 'cachedir'))
5959
avoid_duplicate_runs = config.getboolean('FAKE_SECTION', 'avoid_duplicate_runs')
6060

6161

@@ -105,8 +105,27 @@ def get_cache_directory():
105105
return _cachedir
106106

107107

108+
def set_cache_directory(cachedir):
109+
"""Set module-wide cache directory.
110+
111+
Sets the cache directory into which to download datasets, tasks etc.
112+
113+
Parameters
114+
----------
115+
cachedir : string
116+
Path to use as cache directory.
117+
118+
See also
119+
--------
120+
get_cache_directory
121+
"""
122+
123+
global cache_directory
124+
cache_directory = cachedir
125+
126+
108127
__all__ = [
109-
'get_cache_directory',
128+
'get_cache_directory', 'set_cache_directory'
110129
]
111130

112131
_setup()

0 commit comments

Comments
 (0)