Updated typehints from str values to bytes

This commit is contained in:
Martin Gaňo
2022-01-03 01:02:16 +01:00
parent f7983fd313
commit 140f5be289
6 changed files with 13 additions and 13 deletions

View File

@@ -1,5 +1,5 @@
#!/usr/bin/env python
# SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
# SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: Apache-2.0
import os
@@ -107,7 +107,7 @@ class FATFS:
parent_dir = self.root_directory.recursive_search(path_from_root, self.root_directory)
self.root_directory.new_directory(name=name, parent=parent_dir, path_from_root=path_from_root)
def write_content(self, path_from_root: List[str], content: str) -> None:
def write_content(self, path_from_root: List[str], content: bytes) -> None:
"""
fat fs invokes root directory to recursively find the required file and writes the content
"""
@@ -167,7 +167,7 @@ class FATFS:
normal_path = os.path.normpath(folder_relative_path)
split_path = normal_path.split(os.sep)
if os.path.isfile(real_path):
with open(real_path, "rb") as file:
with open(real_path, 'rb') as file:
content = file.read()
file_name, extension = os.path.splitext(split_path[-1])
extension = extension[1:] # remove the dot from the extension