goodbye pydocstyle, more lint

This commit is contained in:
Jesse Bannon 2023-12-14 23:18:00 -08:00
parent 92961c8f58
commit bb6829a4bc
5 changed files with 40 additions and 12 deletions

View file

@ -17,12 +17,10 @@ lint:
@-isort . @-isort .
@-black . @-black .
@-pylint src/ @-pylint src/
@-pydocstyle src/*
check_lint: check_lint:
isort . --check-only --diff \ isort . --check-only --diff \
&& black . --check \ && black . --check \
&& pylint src/ \ && pylint src/
&& pydocstyle src/*
wheel: clean wheel: clean
$(shell echo "__pypi_version__ = \"$(PYPI_VERSION)\"\n__local_version__ = \"$(LOCAL_VERSION)\"" > src/ytdl_sub/__init__.py) $(shell echo "__pypi_version__ = \"$(PYPI_VERSION)\"\n__local_version__ = \"$(LOCAL_VERSION)\"" > src/ytdl_sub/__init__.py)
cat src/ytdl_sub/__init__.py cat src/ytdl_sub/__init__.py

View file

@ -49,7 +49,6 @@ lint =
black==22.3.0 black==22.3.0
isort==5.10.1 isort==5.10.1
pylint==2.13.5 pylint==2.13.5
pydocstyle[toml]==6.1.1
docs = docs =
sphinx==4.5.0 sphinx==4.5.0
sphinx-rtd-theme==1.0.0 sphinx-rtd-theme==1.0.0

View file

@ -1,3 +1,4 @@
# pylint: disable=missing-raises-doc
from typing import Dict from typing import Dict
from typing import List from typing import List
from typing import Optional 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.name_validation import validate_variable_name
from ytdl_sub.script.utils.type_checking import FunctionSpec from ytdl_sub.script.utils.type_checking import FunctionSpec
# pylint: disable=missing-raises-doc
def _is_function(override_name: str): def _is_function(override_name: str):
return override_name.startswith("%") return override_name.startswith("%")
@ -421,7 +420,8 @@ class Script:
Returns Returns
------- -------
Dict containing the variable names to their resolved values. Dict[str, Resolvable]
Dict containing the variable names to their resolved values.
""" """
try: try:
self.add(variable_definitions) self.add(variable_definitions)
@ -436,6 +436,22 @@ class Script:
del self._variables[name] del self._variables[name]
def get(self, variable_name: str) -> Resolvable: 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: if variable_name not in self._variables:
raise RuntimeException( raise RuntimeException(
f"Tried to get resolved variable {variable_name}, but it does not exist" f"Tried to get resolved variable {variable_name}, but it does not exist"
@ -448,4 +464,10 @@ class Script:
@property @property
def variable_names(self) -> Set[str]: def variable_names(self) -> Set[str]:
"""
Returns
-------
Set[str]
Names of all the variables within the Script.
"""
return set(list(self._variables.keys())) return set(list(self._variables.keys()))

View file

@ -105,7 +105,9 @@ class FutureResolvable(AnyArgument, ABC):
@abstractmethod @abstractmethod
def future_resolvable_type(self) -> Type[Resolvable]: def future_resolvable_type(self) -> Type[Resolvable]:
pass """
The resolvable type that this type is known to turn into
"""
@dataclass(frozen=True) @dataclass(frozen=True)
@ -197,7 +199,11 @@ class FunctionType(NamedArgument, ABC):
class BuiltInFunctionType(FunctionType, ABC): class BuiltInFunctionType(FunctionType, ABC):
@abstractmethod @abstractmethod
def output_type(self) -> Type[Resolvable]: def output_type(self) -> Type[Resolvable]:
pass """
Returns
-------
The known Resolvable type that a BuiltInFunction will output
"""
@dataclass(frozen=True) @dataclass(frozen=True)
@ -210,6 +216,11 @@ class Lambda(Resolvable):
@classmethod @classmethod
def num_input_args(cls) -> int: def num_input_args(cls) -> int:
"""
Returns
-------
The number of input args the Lambda function takes
"""
return 1 return 1

View file

@ -3,11 +3,9 @@
if [[ $1 = "check" ]]; then if [[ $1 = "check" ]]; then
isort . --check-only --diff \ isort . --check-only --diff \
&& black . --check \ && black . --check \
&& pylint src/ \ && pylint src/
&& pydocstyle src/*
else else
isort . isort .
black . black .
pylint src/ pylint src/
pydocstyle src/*
fi fi