Skip to content

Commit

Permalink
to_int_or_none included
Browse files Browse the repository at this point in the history
  • Loading branch information
soeren-kirchner committed Nov 9, 2019
1 parent 0cb8f40 commit 4f309bf
Showing 1 changed file with 31 additions and 4 deletions.
35 changes: 31 additions & 4 deletions pyimgbatch/pyimgbatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from PIL import Image
from PIL import ImageCms

from .helper import to_int_or_none
# from .helper import to_int_or_none


WEBSETS = {'@2x': 2, '@3x': 3}
Expand Down Expand Up @@ -365,6 +365,14 @@ def exec(self):


class Size(object):
"""[summary]
:param object: [description]
:type object: [type]
:raises Exception: [description]
:return: [description]
:rtype: [type]
"""
def __init__(self, *args):
if len(args) == 1 and type(args[0]) is tuple:
# TODO: to_int_or_none for tuple too
Expand Down Expand Up @@ -415,6 +423,8 @@ def __init__(self, total, disable=True):


class Out:
"""Class description
"""

outfunction = print
project_bar = None
Expand All @@ -424,9 +434,9 @@ class Out:
def out(cls, *args):
cls.outfunction(*args)

@classmethod
def __call__(cls, *args):
cls.out(*args)
# @classmethod
# def __call__(cls, *args):
# cls.out(*args)

@classmethod
def init_project_bar(cls, disable=True):
Expand All @@ -444,3 +454,20 @@ def init_image_bar(cls, disable=True):
def __del__(cls):
cls.image_bar.close()
cls.project_bar.close()


def to_int_or_none(value, multiplier=1):
"""[summary]
:param value: [description]
:type value: [type]
:param multiplier: [description], defaults to 1
:type multiplier: int, optional
:return: [description]
:rtype: [type]
"""
try:
value = int(value) * multiplier
return value
except:
return None

0 comments on commit 4f309bf

Please sign in to comment.