Skip to content

Commit

Permalink
Merge branch 'release/1.1.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
cnheider committed Oct 3, 2023
2 parents 4edaaf6 + d8403a9 commit 411f220
Show file tree
Hide file tree
Showing 12 changed files with 68 additions and 34 deletions.
2 changes: 1 addition & 1 deletion draugr/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

__project__ = "Draugr"
__author__ = "Christian Heider Nielsen"
__version__ = "1.1.1"
__version__ = "1.1.2"
__doc__ = r"""
Created on 27/04/2019
Expand Down
1 change: 0 additions & 1 deletion draugr/numpy_utilities/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
try:
from .channel_transform import *
from .manipulation import *
from .resize import *
from .datasets import *
from .sampling import *
from .powers import *
Expand Down
3 changes: 3 additions & 0 deletions draugr/visualisation/pillow_utilities/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from .resize import *
from .conversion import *
from .enums import *
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
Created on 17/07/2020
"""

from enum import Enum
from typing import Tuple, Union

import numpy
Expand All @@ -23,28 +22,6 @@
import io

from PIL import Image
from sorcery import assigned_names


class PilModesEnum(Enum):
"""
PIL pixel formats:
RGB 24bits per pixel, 8-bit-per-channel RGB), 3 channels
RGBA (8-bit-per-channel RGBA), 4 channels
RGBa (8-bit-per-channel RGBA, remultiplied alpha), 4 channels
1 - 1bpp, often for masks, 1 channel
L - 8bpp, grayscale, 1 channel
P - 8bpp, paletted, 1 channel
I - 32-bit integers, grayscale, 1 channel
F - 32-bit floats, grayscale, 1 channel
CMYK - 8 bits per channel, 4 channels
YCbCr - 8 bits per channel, 3 channels
"""

OneBpp = "1"
CMYK, F, HSV, I, L, LAB, P, RGB, RGBA, RGBX, YCbCr = assigned_names()


"""
1 (1-bit pixels, black and white, stored with one pixel per byte)
Expand Down
27 changes: 27 additions & 0 deletions draugr/visualisation/pillow_utilities/enums.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from enum import Enum

from sorcery import assigned_names

__all__ = [
"PilModesEnum",
]


class PilModesEnum(Enum):
"""
PIL pixel formats:
RGB 24bits per pixel, 8-bit-per-channel RGB), 3 channels
RGBA (8-bit-per-channel RGBA), 4 channels
RGBa (8-bit-per-channel RGBA, remultiplied alpha), 4 channels
1 - 1bpp, often for masks, 1 channel
L - 8bpp, grayscale, 1 channel
P - 8bpp, paletted, 1 channel
I - 32-bit integers, grayscale, 1 channel
F - 32-bit floats, grayscale, 1 channel
CMYK - 8 bits per channel, 4 channels
YCbCr - 8 bits per channel, 3 channels
"""

OneBpp = "1"
CMYK, F, HSV, I, L, LAB, P, RGB, RGBA, RGBX, YCbCr = assigned_names()
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import PIL.Image
import numpy
from draugr.visualisation.pillow_utilities import np_array_to_pil_img
from .conversion import np_array_to_pil_img

__all__ = ["resize_array"]

Expand Down
5 changes: 4 additions & 1 deletion requirements/requirements_dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ doc8>=0.11.2
flake8>=4.0.1
bandit>=1.7.4
matplotlib>=3.5.2
types-six>=1.1.1

-r ../requirements.txt
-r requirements_docs.txt
Expand All @@ -35,6 +36,8 @@ matplotlib>=3.5.2
-r requirements_extensions.txt
-r requirements_multiprocessing.txt
-r requirements_pygame.txt

# full install
setuptools>=65.5.1 # not directly required, pinned by Snyk to avoid a vulnerability
numpy>=1.22.2 # not directly required, pinned by Snyk to avoid a vulnerability
numpy>=1.22.2 # not directly required, pinned by Snyk to avoid a vulnerability
pillow>=10.0.1 # not directly required, pinned by Snyk to avoid a vulnerability
1 change: 1 addition & 0 deletions requirements/requirements_opencv.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
opencv-python
numpy>=1.22.2 # not directly required, pinned by Snyk to avoid a vulnerability
1 change: 1 addition & 0 deletions requirements/requirements_torch.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ torch>=1.12.0
tensorboard
torchvision>=0.13.0
wheel>=0.38.0 # not directly required, pinned by Snyk to avoid a vulnerability
pillow>=10.0.1 # not directly required, pinned by Snyk to avoid a vulnerability
13 changes: 7 additions & 6 deletions requirements/requirements_visualisation.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
matplotlib
pandas
scikit-learn
numpy
seaborn
matplotlib>=3.8.0
pandas>=2.1.1
scikit-learn>=1.3.1
numpy>=1.26.0
seaborn>=0.13.0
progress # remove this shit
setuptools>=65.5.1 # not directly required, pinned by Snyk to avoid a vulnerability
setuptools>=65.5.1 # not directly required, pinned by Snyk to avoid a vulnerability
pillow>=10.0.1 # not directly required, pinned by Snyk to avoid a vulnerability
3 changes: 2 additions & 1 deletion requirements/requirements_writers.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ scikit-learn
numpy
visdom
sorcery
tornado>=6.3.2 # not directly required, pinned by Snyk to avoid a vulnerability
tornado>=6.3.2 # not directly required, pinned by Snyk to avoid a vulnerability
pillow>=10.0.1 # not directly required, pinned by Snyk to avoid a vulnerability
21 changes: 21 additions & 0 deletions samples/python_tools/logging_filter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import logging


class ContextFilterWorstLevel(logging.Filter):
def __init__(self):
self.worst_level = logging.INFO

def filter(self, record):
if record.levelno > self.worst_level:
self.worst_level = record.levelno
return True


# Create a logger object and add the filter
logger = logging.getLogger()
logger.addFilter(ContextFilterWorstLevel())

# Check the worst log level called later
for filter in logger.filters:
if isinstance(filter, ContextFilterWorstLevel):
print(filter.worst_level)

0 comments on commit 411f220

Please sign in to comment.