fix: enable and fix full type checking (#509)

* fix: enable and fix fully type checking

* chore: pre-commit autoupdate

* refactor: pull types out to file
This commit is contained in:
Henry Schreiner
2021-01-02 14:32:55 -05:00
committed by GitHub
parent bc8716c188
commit 2a73fee411
12 changed files with 110 additions and 87 deletions
+3 -3
View File
@@ -1,7 +1,7 @@
import subprocess
from typing import Callable, Dict, List, NamedTuple, Optional, Sequence
import bashlex # type: ignore
import bashlex
# a function that takes a command and the environment, and returns the result
EnvironmentExecutor = Callable[[List[str], Dict[str, str]], str]
@@ -50,7 +50,7 @@ def evaluate_node(node: bashlex.ast.node, context: NodeExecutionContext) -> str:
def evaluate_word_node(node: bashlex.ast.node, context: NodeExecutionContext) -> str:
value = node.word
value: str = node.word
for part in node.parts:
part_string = context.input[part.pos[0]:part.pos[1]]
@@ -95,7 +95,7 @@ def evaluate_nodes_as_compound_command(nodes: Sequence[bashlex.ast.node], contex
return result
def evaluate_nodes_as_simple_command(nodes: List[bashlex.ast.node], context: NodeExecutionContext):
def evaluate_nodes_as_simple_command(nodes: List[bashlex.ast.node], context: NodeExecutionContext) -> str:
command = [evaluate_node(part, context=context) for part in nodes]
return context.executor(command, context.environment)