Skip to content

Commit 1f116af

Browse files
migrated to configurable code pattern
1 parent 88bca15 commit 1f116af

File tree

8 files changed

+40
-0
lines changed

8 files changed

+40
-0
lines changed

‎image_utils/__init__.py‎

Whitespace-only changes.

‎image_utils/config/__init__.py‎

Whitespace-only changes.

‎image_utils/config/settings.py‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from pathlib import Path
2+
3+
4+
VERBOSE = True
5+
DEFAULT_EXTENSION = 'jpeg'
6+
SKIP_EXISTING_FILES = True
7+
OVERRIDE_EXISTING_FILES = False
8+
BASE_DIR = Path(__file__).parent.parent
9+
SUPPORTED_EXTENSIONS = ('png', 'jpg', 'gif', 'jpeg')

‎image_utils/core/__init__.py‎

Whitespace-only changes.

‎image_utils/core/exceptions.py‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
""" Module containing all exceptions """
2+
3+
__all__ = (
4+
'MutualExclusionError',
5+
'MissingRequiredPathError',
6+
'NotAFileError',
7+
'InvalidImageTypeError',
8+
)
9+
10+
class MutualExclusionError(Exception):
11+
pass
12+
13+
class MissingRequiredPathError(Exception):
14+
pass
15+
16+
class InvalidImageTypeError(Exception):
17+
pass
18+
19+
class NotAFileError(Exception):
20+
pass

‎image_utils/core/utils.py‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
from typing import Any
2+
from image_utils.config import settings
3+
4+
5+
def get_supported_extensions_as_str() -> str:
6+
return ', '.join(settings.SUPPORTED_EXTENSIONS[:-1]) + ' or ' + settings.SUPPORTED_EXTENSIONS[-1]
7+
8+
def print_if_verbose(value: Any) -> None:
9+
if settings.VERBOSE:
10+
print(value)
11+

‎image_utils/image_resizer/__init__.py‎

Whitespace-only changes.

‎image_utils/validators/__init__.py‎

Whitespace-only changes.

0 commit comments

Comments
 (0)