From c219b817a417bc60bd73d4406e5ed3b70ef66c56 Mon Sep 17 00:00:00 2001 From: "hao.long" Date: Wed, 8 Apr 2020 01:00:56 +0800 Subject: [PATCH] Fix pylint --- src/photoshop/__init__.py | 21 +++++++++++---------- src/photoshop/_active_document.py | 2 +- src/photoshop/_artlayers.py | 1 + src/photoshop/_document.py | 1 + src/photoshop/_documents.py | 1 + src/photoshop/_layer.py | 1 + src/photoshop/_layers.py | 9 +++++---- src/photoshop/_selection.py | 1 + 8 files changed, 22 insertions(+), 15 deletions(-) diff --git a/src/photoshop/__init__.py b/src/photoshop/__init__.py index 956890ad..c2ac9b4a 100644 --- a/src/photoshop/__init__.py +++ b/src/photoshop/__init__.py @@ -201,21 +201,22 @@ def __exit__(self, exc_type, exc_val, exc_tb): # All public APIs. __all__ = ( - 'ActionDescriptor', - 'ActionList', - 'ActionReference', - 'Application', - 'SolidColor', - 'TextFonts', - 'TextItem', - 'Session', - colors.__all__ + [ + 'ActionDescriptor', + 'ActionList', + 'ActionReference', + 'Application', + 'SolidColor', + 'TextFonts', + 'TextItem', + 'Session' + ] + + colors.__all__ + save_options.__all__ + enumerations.__all__ + errors.__all__ ) - __title__ = 'photoshop_python_api' __version__ = '0.8.0' __author__ = 'Long Hao' diff --git a/src/photoshop/_active_document.py b/src/photoshop/_active_document.py index 05d2b995..7f73ed68 100644 --- a/src/photoshop/_active_document.py +++ b/src/photoshop/_active_document.py @@ -3,5 +3,5 @@ class ActiveDocument(Document): - def __int__(self, parent): + def __init__(self, parent): super().__init__(parent=parent) diff --git a/src/photoshop/_artlayers.py b/src/photoshop/_artlayers.py index ace67269..19b0b092 100644 --- a/src/photoshop/_artlayers.py +++ b/src/photoshop/_artlayers.py @@ -2,6 +2,7 @@ from photoshop._layer import Layer +# pylint: disable=too-many-arguments class ArtLayers(Photoshop): def __init__(self, parent): diff --git a/src/photoshop/_document.py b/src/photoshop/_document.py index de4d652a..0c4bd3d1 100644 --- a/src/photoshop/_document.py +++ b/src/photoshop/_document.py @@ -11,6 +11,7 @@ from photoshop.enumerations import SaveOptions +# pylint: disable=too-many-public-methods class Document(Photoshop): object_name = 'Application' diff --git a/src/photoshop/_documents.py b/src/photoshop/_documents.py index abcd430f..ea43ba51 100644 --- a/src/photoshop/_documents.py +++ b/src/photoshop/_documents.py @@ -5,6 +5,7 @@ from photoshop.enumerations import BitsPerChannelType +# pylint: disable=too-many-public-methods class Documents(Photoshop): def __init__(self, parent): super().__init__(parent=parent) diff --git a/src/photoshop/_layer.py b/src/photoshop/_layer.py index 853150cb..ea96ad6d 100644 --- a/src/photoshop/_layer.py +++ b/src/photoshop/_layer.py @@ -3,6 +3,7 @@ from photoshop.enumerations import LayerKind +# pylint: disable=too-many-public-methods class Layer(Photoshop): def __init__(self, parent): super().__init__(parent=parent) diff --git a/src/photoshop/_layers.py b/src/photoshop/_layers.py index 46832090..d802ee41 100644 --- a/src/photoshop/_layers.py +++ b/src/photoshop/_layers.py @@ -1,6 +1,7 @@ from photoshop._core import Photoshop from photoshop._artlayer import ArtLayer from photoshop._layer import Layer +from photoshop.errors import COMError class Layers(Photoshop): @@ -17,10 +18,10 @@ def __len__(self): def __getitem__(self, key): item = self._layers[key] try: - # If have text item will be return ArtLayer. - item.textItem - return ArtLayer(item) - except: + if hasattr(item, 'textItem'): + # If have text item will be return ArtLayer. + return ArtLayer(item) + except COMError: return Layer(self._layers[key]) @property diff --git a/src/photoshop/_selection.py b/src/photoshop/_selection.py index 58970a27..530f9f0d 100644 --- a/src/photoshop/_selection.py +++ b/src/photoshop/_selection.py @@ -2,6 +2,7 @@ from photoshop.enumerations import SelectionType +# pylint: disable=too-many-public-methods class Selection(Photoshop): def __init__(self, parent=None): super().__init__(parent=parent)