Skip to content

Commit a113ea9

Browse files
committed
Linting.
1 parent 1178351 commit a113ea9

File tree

7 files changed

+47
-12
lines changed

7 files changed

+47
-12
lines changed

domdf_python_tools/bases.py

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -380,17 +380,35 @@ def __init__(self, value: Union[SupportsFloat, _SupportsIndex, str, bytes, bytea
380380
self._value = (float(value), )
381381

382382
def as_integer_ratio(self) -> Tuple[int, int]:
383+
"""
384+
Returns the float as a fraction.
385+
"""
386+
383387
return float(self).as_integer_ratio()
384388

385-
def hex(self) -> str:
389+
def hex(self) -> str: # noqa: A003
390+
"""
391+
Returns the hexadecimal (base 16) representation of the float.
392+
"""
393+
386394
return float(self).hex()
387395

388396
def is_integer(self) -> bool:
397+
"""
398+
Returns whether the float is an integer.
399+
"""
400+
389401
return float(self).is_integer()
390402

391403
@classmethod
392-
def fromhex(cls: Type[_F], __s: str) -> _F:
393-
return cls(float.fromhex(__s))
404+
def fromhex(cls: Type[_F], string: str) -> _F:
405+
"""
406+
Create a floating-point number from a hexadecimal string.
407+
408+
:param string:
409+
"""
410+
411+
return cls(float.fromhex(string))
394412

395413
def __add__(self: _F, other: float) -> _F:
396414
return self.__class__(float(self).__add__(other))

domdf_python_tools/pagesizes/classes.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
# classes.py
44
"""
55
Classes representing pagesizes.
6-
7-
.. |AnyNumber| replace:: :py:data:`~typing.Union` [:class:`int`, :class:`float`, :class:`~decimal.Decimal`, :class:`~domdf_python_tools.pagesizes.Unit`]
86
"""
97
#
108
# Copyright © 2020 Dominic Davis-Foster <[email protected]>

domdf_python_tools/pagesizes/units.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
# !/usr/bin/env python
1+
#!/usr/bin/env python
22
#
33
# units.py
4+
"""
5+
Provides a variety of units for use with pagesizes.
6+
"""
47
#
58
# Copyright © 2020 Dominic Davis-Foster <[email protected]>
69
#

domdf_python_tools/terminal_colours.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,19 +105,19 @@
105105
style_stack: List[str] = []
106106

107107

108-
def code_to_chars(code) -> str:
108+
def code_to_chars(code) -> str: # noqa: D103
109109
return CSI + str(code) + 'm'
110110

111111

112-
def set_title(title: str) -> str:
112+
def set_title(title: str) -> str: # noqa: D103
113113
return OSC + "2;" + title + BEL
114114

115115

116-
def clear_screen(mode: int = 2) -> str:
116+
def clear_screen(mode: int = 2) -> str: # noqa: D103
117117
return CSI + str(mode) + 'J'
118118

119119

120-
def clear_line(mode: int = 2) -> str:
120+
def clear_line(mode: int = 2) -> str: # noqa: D103
121121
return CSI + str(mode) + 'K'
122122

123123

@@ -204,9 +204,15 @@ def __init__(self) -> None:
204204

205205

206206
class AnsiCursor:
207+
"""
208+
Provides methods to control the cursor.
209+
210+
.. TODO:: Add show and hide methods.
211+
"""
207212

208213
def UP(self, n: int = 1) -> str:
209214
"""
215+
Moves the cursor up.
210216
211217
:param n:
212218
"""
@@ -215,6 +221,7 @@ def UP(self, n: int = 1) -> str:
215221

216222
def DOWN(self, n: int = 1) -> str:
217223
"""
224+
Moves the cursor down.
218225
219226
:param n:
220227
"""
@@ -223,6 +230,7 @@ def DOWN(self, n: int = 1) -> str:
223230

224231
def FORWARD(self, n: int = 1) -> str:
225232
"""
233+
Moves the cursor forward (right).
226234
227235
:param n:
228236
"""
@@ -231,6 +239,7 @@ def FORWARD(self, n: int = 1) -> str:
231239

232240
def BACK(self, n: int = 1) -> str:
233241
"""
242+
Moves the cursor back (left).
234243
235244
:param n:
236245
"""
@@ -239,6 +248,7 @@ def BACK(self, n: int = 1) -> str:
239248

240249
def POS(self, x: int = 1, y: int = 1) -> str:
241250
"""
251+
Sets the position of the cursor.
242252
243253
:param x:
244254
:param y:

domdf_python_tools/testing.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ def testing_boolean_values(
214214

215215

216216
@lru_cache(1)
217-
def whitespace_perms_list() -> List[str]:
217+
def whitespace_perms_list() -> List[str]: # noqa: D103
218218
chain = itertools.chain.from_iterable(itertools.permutations(whitespace, n) for n in Len(whitespace))
219219
return list(''.join(x) for x in chain)
220220

@@ -393,7 +393,7 @@ def is_docker():
393393
<class 'bool'>
394394
395395
.. versionadded:: 0.6.0
396-
"""
396+
""" # noqa: D400
397397

398398
if os.path.exists("/.dockerenv"):
399399
return True

repo_helper.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,5 +66,6 @@ extra_sphinx_extensions:
6666

6767
tox_unmanaged:
6868
- testenv
69+
- flake8
6970

7071
tox_testenv_extras: all

tox.ini

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,14 @@ rst-directives =
125125
TODO
126126
envvar
127127
extras-require
128+
rst-roles = manpage
128129
per-file-ignores =
129130
tests/*: D100 D101 D102 D103 D104 D106 D201 D204 D207 D208 D209 D210 D211 D212 D213 D214 D215 D300 D301 D400 D402 D403 D404 D415 D417 DALL000
130131
*/*.pyi: D100 D101 D102 D103 D104 D106 D201 D204 D207 D208 D209 D210 D211 D212 D213 D214 D215 D300 D301 D400 D402 D403 D404 D415 D417 DALL000
132+
tests/list_tests.py: PT011 D100 D101 D102 D103 D104 D106 D201 D204 D207 D208 D209 D210 D211 D212 D213 D214 D215 D300 D301 D400 D402 D403 D404 D415 D417 DALL000
133+
tests/test_paths_stdlib.py: PT011 D100 D101 D102 D103 D104 D106 D201 D204 D207 D208 D209 D210 D211 D212 D213 D214 D215 D300 D301 D400 D402 D403 D404 D415 D417 DALL000
134+
tests/test_pretty_print.py: PT011 D100 D101 D102 D103 D104 D106 D201 D204 D207 D208 D209 D210 D211 D212 D213 D214 D215 D300 D301 D400 D402 D403 D404 D415 D417 DALL000
135+
tests/seq_tests.py: PT011 D100 D101 D102 D103 D104 D106 D201 D204 D207 D208 D209 D210 D211 D212 D213 D214 D215 D300 D301 D400 D402 D403 D404 D415 D417 DALL000
131136
pytest-parametrize-names-type = csv
132137
inline-quotes = "
133138
multiline-quotes = """

0 commit comments

Comments
 (0)