From 3db6d6eec3033990ad4f4fdb9599929aa6872343 Mon Sep 17 00:00:00 2001 From: Justice Sidhu Date: Fri, 20 Sep 2024 12:36:05 -0700 Subject: [PATCH] remove cast --- samcli/lib/utils/file_observer.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/samcli/lib/utils/file_observer.py b/samcli/lib/utils/file_observer.py index 21331ea9b3..54095e2025 100644 --- a/samcli/lib/utils/file_observer.py +++ b/samcli/lib/utils/file_observer.py @@ -9,7 +9,7 @@ from abc import ABC, abstractmethod from pathlib import Path from threading import Lock, Thread -from typing import Callable, Dict, List, Optional, cast +from typing import Callable, Dict, List, Optional import docker from docker import DockerClient @@ -462,8 +462,8 @@ def on_change(self, event: FileSystemEvent) -> None: if path == event.src_path or path in self._watch_dog_observed_paths.get(f"{event.src_path!r}_False", []) ] - else: - observed_paths = [path for path in _observed_paths if cast(str, event.src_path).startswith(path)] + elif isinstance(event.src_path, str): + observed_paths = [path for path in _observed_paths if event.src_path.startswith(path)] if not observed_paths: continue