From bb6829a4bcd329aef169313d17ab3bd60fd2e097 Mon Sep 17 00:00:00 2001 From: Jesse Bannon Date: Thu, 14 Dec 2023 23:18:00 -0800 Subject: [PATCH] goodbye pydocstyle, more lint --- Makefile | 4 +--- setup.cfg | 1 - src/ytdl_sub/script/script.py | 28 ++++++++++++++++++++++--- src/ytdl_sub/script/types/resolvable.py | 15 +++++++++++-- tools/linter | 4 +--- 5 files changed, 40 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index 30ca26b3..df03c227 100644 --- a/Makefile +++ b/Makefile @@ -17,12 +17,10 @@ lint: @-isort . @-black . @-pylint src/ - @-pydocstyle src/* check_lint: isort . --check-only --diff \ && black . --check \ - && pylint src/ \ - && pydocstyle src/* + && pylint src/ wheel: clean $(shell echo "__pypi_version__ = \"$(PYPI_VERSION)\"\n__local_version__ = \"$(LOCAL_VERSION)\"" > src/ytdl_sub/__init__.py) cat src/ytdl_sub/__init__.py diff --git a/setup.cfg b/setup.cfg index 87546248..db9e581d 100644 --- a/setup.cfg +++ b/setup.cfg @@ -49,7 +49,6 @@ lint = black==22.3.0 isort==5.10.1 pylint==2.13.5 - pydocstyle[toml]==6.1.1 docs = sphinx==4.5.0 sphinx-rtd-theme==1.0.0 diff --git a/src/ytdl_sub/script/script.py b/src/ytdl_sub/script/script.py index 8e6302e3..6f3b50e6 100644 --- a/src/ytdl_sub/script/script.py +++ b/src/ytdl_sub/script/script.py @@ -1,3 +1,4 @@ +# pylint: disable=missing-raises-doc from typing import Dict from typing import List from typing import Optional @@ -18,8 +19,6 @@ from ytdl_sub.script.utils.exceptions import RuntimeException from ytdl_sub.script.utils.name_validation import validate_variable_name from ytdl_sub.script.utils.type_checking import FunctionSpec -# pylint: disable=missing-raises-doc - def _is_function(override_name: str): return override_name.startswith("%") @@ -421,7 +420,8 @@ class Script: Returns ------- - Dict containing the variable names to their resolved values. + Dict[str, Resolvable] + Dict containing the variable names to their resolved values. """ try: self.add(variable_definitions) @@ -436,6 +436,22 @@ class Script: del self._variables[name] def get(self, variable_name: str) -> Resolvable: + """ + Parameters + ---------- + variable_name + Name of the resolved variable to get. + + Returns + ------- + Resolvable + The resolved variable of the given name. + + Raises + ------ + RuntimeException + If the variable has not been resolved yet in the Script. + """ if variable_name not in self._variables: raise RuntimeException( f"Tried to get resolved variable {variable_name}, but it does not exist" @@ -448,4 +464,10 @@ class Script: @property def variable_names(self) -> Set[str]: + """ + Returns + ------- + Set[str] + Names of all the variables within the Script. + """ return set(list(self._variables.keys())) diff --git a/src/ytdl_sub/script/types/resolvable.py b/src/ytdl_sub/script/types/resolvable.py index 767d2ed9..829c0e78 100644 --- a/src/ytdl_sub/script/types/resolvable.py +++ b/src/ytdl_sub/script/types/resolvable.py @@ -105,7 +105,9 @@ class FutureResolvable(AnyArgument, ABC): @abstractmethod def future_resolvable_type(self) -> Type[Resolvable]: - pass + """ + The resolvable type that this type is known to turn into + """ @dataclass(frozen=True) @@ -197,7 +199,11 @@ class FunctionType(NamedArgument, ABC): class BuiltInFunctionType(FunctionType, ABC): @abstractmethod def output_type(self) -> Type[Resolvable]: - pass + """ + Returns + ------- + The known Resolvable type that a BuiltInFunction will output + """ @dataclass(frozen=True) @@ -210,6 +216,11 @@ class Lambda(Resolvable): @classmethod def num_input_args(cls) -> int: + """ + Returns + ------- + The number of input args the Lambda function takes + """ return 1 diff --git a/tools/linter b/tools/linter index 28394065..b3a4fb7f 100755 --- a/tools/linter +++ b/tools/linter @@ -3,11 +3,9 @@ if [[ $1 = "check" ]]; then isort . --check-only --diff \ && black . --check \ - && pylint src/ \ - && pydocstyle src/* + && pylint src/ else isort . black . pylint src/ - pydocstyle src/* fi \ No newline at end of file