commit 31491ce82aa7f1f5b9485e5ac61cce1d8569717f Author: vaydheesh Date: Tue Jun 11 13:57:42 2019 +0000 Added TypeAnnotation and flake8 ignore apertium/swig diff --git a/.flake8 b/.flake8 index 331cb8d..0fe567f 100644 --- a/.flake8 +++ b/.flake8 @@ -1,2 +1,3 @@ [flake8] max-line-length=160 +exclude=apertium/swig/ diff --git a/apertium/lttoolbox.py b/apertium/lttoolbox.py index 8154a6b..9a61f65 100644 --- a/apertium/lttoolbox.py +++ b/apertium/lttoolbox.py @@ -1,6 +1,6 @@ import platform import tempfile - +from typing import ByteString if platform.system() == 'Linux': from apertium.swig.linux import lttoolbox elif platform.system() == 'Windows': @@ -16,7 +16,7 @@ class LtProc: output_text (str) """ - def __init__(self, input_text, arg_index, path): + def __init__(self, input_text, arg_index, path): # type: (LtProc, str, int, str) -> None """ Args: input_text (str) @@ -46,7 +46,7 @@ class LtProc: fst.analyze(self.path, input_file.name, output_file.name) self.output_text = output_file.read() - def execute(self): + def execute(self): # type: (LtProc) -> ByteString """ Executes the required method, depending upon the argument for lt-proc @@ -54,7 +54,7 @@ class LtProc: self (LtProc) Returns: - (bytes) + (ByteString) """ if self.arg_index == '-w': self.analyze()