Skip to content

Commit 4c28b5c

Browse files
committed
Linting
1 parent 3b5f0d4 commit 4c28b5c

File tree

4 files changed

+13
-9
lines changed

4 files changed

+13
-9
lines changed

domdf_python_tools/pagesizes/classes.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
from typing import List, Tuple
4141

4242
# this package
43+
from domdf_python_tools.doctools import prettify_docstrings
4344
from domdf_python_tools.typing import AnyNumber
4445

4546
# this package
@@ -57,6 +58,7 @@
5758
]
5859

5960

61+
@prettify_docstrings
6062
class BaseSize(namedtuple("__BaseSize", "width, height")):
6163
"""
6264
Base class namedtuple representing a page size, in point.

domdf_python_tools/stringlist.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class Indent:
4646
Represents an indent, having a symbol/type and a size.
4747
"""
4848

49-
def __init__(self, size: int = 0, type: str = "\t"):
49+
def __init__(self, size: int = 0, type: str = "\t"): # noqa A002 # pylint: disable=redefined-builtin
5050
self.size = int(size)
5151
self.type = str(type)
5252

@@ -71,15 +71,15 @@ def size(self, size: int) -> None:
7171
self._size = int(size)
7272

7373
@property
74-
def type(self) -> str: # noqa A002
74+
def type(self) -> str: # noqa A002 # pylint: disable=redefined-builtin
7575
"""
7676
The indent character.
7777
"""
7878

7979
return self._type
8080

81-
@type.setter # noqa A002
82-
def type(self, type: str) -> None: # noqa A002
81+
@type.setter # noqa A002 # pylint: disable=redefined-builtin
82+
def type(self, type: str) -> None: # noqa A002 # pylint: disable=redefined-builtin
8383
if not str(type):
8484
raise ValueError("'type' cannot an empty string.")
8585

@@ -324,7 +324,7 @@ def indent_type(self) -> str:
324324
return str(self.indent.type)
325325

326326
@indent_type.setter
327-
def indent_type(self, type: str) -> None: # noqa: A002
327+
def indent_type(self, type: str) -> None: # noqa: A002 # pylint: disable=redefined-builtin
328328
"""
329329
Sets the indent type.
330330
"""

domdf_python_tools/utils.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,14 +437,16 @@ def __repr__(self) -> str:
437437
"""
438438

439439

440-
def head(obj: Union[Tuple, List, "DataFrame", "Series", "String"], n: int = 10) -> str:
440+
def head(obj: Union[Tuple, List, "DataFrame", "Series", String, HasHead], n: int = 10) -> str:
441441
"""
442442
Returns the head of the given object.
443443
444444
:param obj:
445445
:param n: Show the first ``n`` items of ``obj``.
446446
447447
.. versionadded:: 0.8.0
448+
449+
.. seealso:: :func:`textwrap.shorten`, which truncates a string to fit within a given number of characters.
448450
"""
449451

450452
if isinstance(obj, tuple) and hasattr(obj, "_fields"):

tests/test_stringlist.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ def test_str(self):
408408
@pytest.mark.xfail()
409409
def test_pickle(self):
410410
sl = StringList(['', '', "hello", "world", '', '', '', "1234"])
411-
assert sl == pickle.loads(pickle.dumps(sl))
411+
assert sl == pickle.loads(pickle.dumps(sl)) # nosec: B301
412412

413413

414414
class TestIndent:
@@ -490,8 +490,8 @@ def test_eq(self):
490490
assert Indent(2, "\t") == (2, "\t")
491491
assert Indent(2, "\t") == "\t\t"
492492

493-
assert not Indent() == 1
493+
assert Indent() != 1
494494

495495
def test_pickle(self):
496496
indent = Indent(2, " ")
497-
assert indent == pickle.loads(pickle.dumps(indent))
497+
assert indent == pickle.loads(pickle.dumps(indent)) # nosec: B301

0 commit comments

Comments
 (0)