Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_base_runner_1(data):
assert BaseRunner.check_device(False).type == 'cpu'
assert BaseRunner.check_device('cpu').type == 'cpu'
with pytest.raises(RuntimeError, match='could not use CUDA on this machine'):
BaseRunner.check_device(True)
with pytest.raises(RuntimeError, match='could not use CUDA on this machine'):
BaseRunner.check_device('cuda')
with pytest.raises(RuntimeError, match='wrong device identifier'):
BaseRunner.check_device('other illegal')
def test_base_runner_1(data):
assert BaseRunner.check_device(False).type == 'cpu'
assert BaseRunner.check_device('cpu').type == 'cpu'
with pytest.raises(RuntimeError, match='could not use CUDA on this machine'):
BaseRunner.check_device(True)
with pytest.raises(RuntimeError, match='could not use CUDA on this machine'):
BaseRunner.check_device('cuda')
with pytest.raises(RuntimeError, match='wrong device identifier'):
BaseRunner.check_device('other illegal')
def test_base_runner_1(data):
assert BaseRunner.check_device(False).type == 'cpu'
assert BaseRunner.check_device('cpu').type == 'cpu'
with pytest.raises(RuntimeError, match='could not use CUDA on this machine'):
BaseRunner.check_device(True)
with pytest.raises(RuntimeError, match='could not use CUDA on this machine'):
BaseRunner.check_device('cuda')
with pytest.raises(RuntimeError, match='wrong device identifier'):
BaseRunner.check_device('other illegal')
def test_base_runner_1(data):
assert BaseRunner.check_device(False).type == 'cpu'
assert BaseRunner.check_device('cpu').type == 'cpu'
with pytest.raises(RuntimeError, match='could not use CUDA on this machine'):
BaseRunner.check_device(True)
with pytest.raises(RuntimeError, match='could not use CUDA on this machine'):
BaseRunner.check_device('cuda')
with pytest.raises(RuntimeError, match='wrong device identifier'):
BaseRunner.check_device('other illegal')
def test_base_runner_1(data):
assert BaseRunner.check_device(False).type == 'cpu'
assert BaseRunner.check_device('cpu').type == 'cpu'
with pytest.raises(RuntimeError, match='could not use CUDA on this machine'):
BaseRunner.check_device(True)
with pytest.raises(RuntimeError, match='could not use CUDA on this machine'):
BaseRunner.check_device('cuda')
with pytest.raises(RuntimeError, match='wrong device identifier'):
BaseRunner.check_device('other illegal')
Set to ``True`` to prevent the potential risk of overwriting.
Default ``False``.
"""
if path is None:
path = Path().resolve()
self._path = path / path.name
else:
self._path = Path(path).resolve()
if increment:
i = 1
while Path(f'{path}@{i}').exists():
i += 1
self._path = Path(f'{path}@{i}').resolve()
self._path.mkdir(parents=True, exist_ok=True)
# self._path = self._path.resolve()
self._device = BaseRunner.check_device(device)
self._handle = default_handle
self._files: Dict[str, str] = defaultdict(str)
self._make_file_index()