Created
September 3, 2018 08:11
-
-
Save dbr/50f9f164be4aea6d85d12c9856ab3ce0 to your computer and use it in GitHub Desktop.
pytoshop patches
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/pytoshop/layers.py b/pytoshop/layers.py | |
index d4bef85..a6577c4 100755 | |
--- a/pytoshop/layers.py | |
+++ b/pytoshop/layers.py | |
@@ -642,10 +642,14 @@ class LayerRecord(object): | |
visible=True, # type: bool | |
pixel_data_irrelevant=False, # type: bool | |
name='', # type: unicode | |
- channels={}, # type: Dict[int, ChannelImageData] | |
- blocks=[], # type: List[tagged_block.TaggedBlock] | |
+ channels=None, # type: Dict[int, ChannelImageData] | |
+ blocks=None, # type: List[tagged_block.TaggedBlock] | |
color_mode=None # type: Optional[int] | |
): # type: (...) -> None | |
+ if blocks is None: | |
+ blocks = [] | |
+ if channels is None: | |
+ channels = {} | |
self.top = top | |
self.left = left | |
self.bottom = bottom | |
@@ -1131,9 +1135,11 @@ class LayerInfo(object): | |
A set of `LayerRecord` instances. | |
""" | |
def __init__(self, | |
- layer_records=[], # type: List[LayerRecord] | |
+ layer_records=None, # type: List[LayerRecord] | |
use_alpha_channel=False # type: bool | |
): # type: (...) -> None | |
+ if layer_records is None: | |
+ layer_records = [] | |
self.layer_records = layer_records | |
self.use_alpha_channel = use_alpha_channel | |
@@ -1322,10 +1328,12 @@ class LayerAndMaskInfo(object): | |
self, | |
layer_info=None, # type: Optional[LayerInfo] | |
global_layer_mask_info=None, # type: Optional[GlobalLayerMaskInfo] | |
- additional_layer_info=[] # type: List[tagged_block.TaggedBlock] | |
+ additional_layer_info=None # type: List[tagged_block.TaggedBlock] | |
): # type: (...) -> None | |
if layer_info is None: | |
layer_info = LayerInfo() | |
+ if additional_layer_info is None: | |
+ additional_layer_info = [] | |
self.layer_info = layer_info | |
self.global_layer_mask_info = global_layer_mask_info | |
self.additional_layer_info = additional_layer_info |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/setup.py b/setup.py | |
index 1ef1e77..2979847 100755 | |
--- a/setup.py | |
+++ b/setup.py | |
@@ -24,7 +24,12 @@ test_requirements = [ | |
try: | |
from Cython.Build import cythonize | |
except ImportError: | |
- extensions = [] | |
+ extensions = [ | |
+ Extension( | |
+ "pytoshop.packbits", | |
+ ["pytoshop/packbits.c"] | |
+ ) | |
+ ] | |
else: | |
extensions = cythonize([ | |
Extension( |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment