Esempio n. 1
0
 def _cache_path(self, fileset, name=None, dataset=None):
     if dataset is None:
         dataset = fileset.dataset
     subj_dir, sess_dir = self._get_item_labels(fileset, dataset=dataset)
     cache_dir = op.join(self._cache_dir, dataset.name, subj_dir, sess_dir)
     makedirs(cache_dir, exist_ok=True)
     if name is None:
         name = '{}-{}'.format(fileset.id,
                               special_char_re.sub('_', fileset.name))
     return op.join(cache_dir, name)
Esempio n. 2
0
 def test_data_dir(cls):
     try:
         return cls._test_data_dir
     except AttributeError:
         try:
             cls._test_data_dir = os.environ['ARCANA_TEST_DATA']
             makedirs(cls._test_data_dir, exist_ok=True)
         except KeyError:
             cls._test_data_dir = op.join(cls.BASE_TEST_DIR, 'data')
         return cls._test_data_dir
Esempio n. 3
0
 def __init__(self, server, cache_dir, user=None,
              password=None, check_md5=True, race_cond_delay=30,
              session_filter=None):
     super().__init__()
     if not isinstance(server, basestring):
         raise ArcanaUsageError(
             "Invalid server url {}".format(server))
     self._server = server
     self._cache_dir = cache_dir
     makedirs(self._cache_dir, exist_ok=True)
     self._user = user
     self._password = password
     self._race_cond_delay = race_cond_delay
     self._check_md5 = check_md5
     self._session_filter = session_filter
     self._login = None
Esempio n. 4
0
 def __init__(self,
              server,
              project_id,
              cache_dir,
              user=None,
              password=None,
              check_md5=True,
              race_cond_delay=30):
     super(XnatRepository, self).__init__()
     self._project_id = project_id
     self._server = server
     self._cache_dir = cache_dir
     makedirs(self._cache_dir, exist_ok=True)
     self._user = user
     self._password = password
     self._race_cond_delay = race_cond_delay
     self._check_md5 = check_md5
     self._login = None
Esempio n. 5
0
 def _make_dir(self, path):
     makedirs(path, exist_ok=True)
     return path
Esempio n. 6
0
 def __init__(self, root_dir):
     self._root_dir = root_dir
     derivatives_path = op.join(root_dir, self.DERIVATIVES_SUB_PATH)
     makedirs(derivatives_path, exist_ok=True)
     DirectoryRepository.__init__(derivatives_path)
     self._layout = gb.BIDSLayout(self.base_dir)
Esempio n. 7
0
 def _cache_path(self, fileset):
     subj_dir, sess_dir = self._get_item_labels(fileset)
     cache_dir = op.join(self._cache_dir, self.project_id, subj_dir,
                         sess_dir)
     makedirs(cache_dir, exist_ok=True)
     return op.join(cache_dir, fileset.fname)