From dcf1e3233befa7cd8e7609ef6e84a2e0b39d5cda Mon Sep 17 00:00:00 2001 From: Bolun Thompson Date: Thu, 12 Dec 2024 05:27:38 +0000 Subject: [PATCH] Fix linting errors --- shasta/bash_to_shasta_ast.py | 3 --- shasta/subst.py | 7 ++++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/shasta/bash_to_shasta_ast.py b/shasta/bash_to_shasta_ast.py index 85df683..5d2ce29 100644 --- a/shasta/bash_to_shasta_ast.py +++ b/shasta/bash_to_shasta_ast.py @@ -240,9 +240,6 @@ def to_function_def_node(node: Command) -> DefunNode: line_number = node.value.function_def.line name = node.value.function_def.name body = node.value.function_def.command - source_file = ( - node.value.function_def.source_file - ) # MICHAEL - for printing purposes this seems unimportant IN_FUNCTION = True ast_node = DefunNode( line_number=line_number, name=to_arg_char(name), body=to_ast_node(body) diff --git a/shasta/subst.py b/shasta/subst.py index 491f073..9a1fa1c 100644 --- a/shasta/subst.py +++ b/shasta/subst.py @@ -1,6 +1,7 @@ from __future__ import annotations -from .ast_node import * +from .ast_node import ArgChar, CArgChar + from math import log from .flags import WordDescFlag @@ -77,6 +78,6 @@ def utf8_to_unicode(c: int) -> int: b = c.to_bytes(num_bytes, byteorder="big") try: s = b.decode("utf-8") - return ord(s) - except: + except UnicodeDecodeError: return c + return ord(s)