Commit 5775a6a5 authored by Amir MOHAMMADI's avatar Amir MOHAMMADI

not all databases have original_directory and original_extension

parent 759f10cc
Pipeline #16756 passed with stage
in 22 minutes and 7 seconds
......@@ -3,6 +3,7 @@
import os
import warnings
import logging
from . import utils
......@@ -14,6 +15,8 @@ from .utils import check_parameters_for_validity, \
file_names, \
sort_files
logger = logging.getLogger(__name__)
class FileDatabase(object):
"""Low-level File-based Database API to be used within Bob.
......@@ -46,17 +49,12 @@ class FileDatabase(object):
-------
list of :obj:`str`
The paths extracted for the files, in the same order.
Raises
------
ValueError
if original_directory or original_extension is None
"""
if self.original_directory is None:
raise ValueError(
logger.warning(
'self.original_directory was not provided (must not be None)!')
if self.original_extension is None:
raise ValueError(
logger.warning(
'self.original_extension was not provided (must not be None)!')
return file_names(
files, self.original_directory, self.original_extension)
......@@ -80,11 +78,11 @@ class FileDatabase(object):
Raises
------
ValueError
if original_directory or original_extension is None.
if the file is not found.
"""
# check if directory is set
if not self.original_directory or not self.original_extension:
raise ValueError(
logger.warning(
"The original_directory and/or the original_extension were not"
" specified in the constructor.")
# extract file name
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment