style: drop redundant open mode arguments

This commit is contained in:
Mark Paronyan 2026-09-30 20:45:44 +03:00
parent d356a68987
commit 396407827e
No known key found for this signature in database
GPG Key ID: 8DC7338A87FE22F8
4 changed files with 7 additions and 7 deletions

View File

@ -278,7 +278,7 @@ class SkillsLoader:
return ""
try:
with open(prompt_file, "r", encoding="utf-8") as f:
with open(prompt_file, encoding="utf-8") as f:
content = f.read()
logger.debug(f"Loaded prompt: {prompt_name} from {prompt_file}")
return content
@ -302,7 +302,7 @@ class SkillsLoader:
try:
commands = []
with open(config_file, "r", encoding="utf-8") as f:
with open(config_file, encoding="utf-8") as f:
for line in f:
line = line.strip()
if not line or line.startswith("#"):
@ -364,7 +364,7 @@ class SkillsLoader:
Returns:
Parsed YAML content as dictionary, or empty dict if file is empty
"""
with open(file_path, "r", encoding="utf-8") as f:
with open(file_path, encoding="utf-8") as f:
data = yaml.safe_load(f)
if not isinstance(data, dict):
logger.warning(f"YAML file {file_path} is empty or has invalid format")

View File

@ -237,7 +237,7 @@ class VMware(BaseManager):
vmnet = f"vmnet{match.group(1)}"
if vmnet not in ("vmnet0", "vmnet1", "vmnet8"):
vmnet_interfaces[vmnet] = {}
with open(vmware_networking_file, "r", encoding="utf-8") as f:
with open(vmware_networking_file, encoding="utf-8") as f:
for line in f.read().splitlines():
match = re.search(r"VNET_([0-9]+)_HOSTONLY_SUBNET\s+(.*)", line)
if match:

View File

@ -25,7 +25,7 @@ def _read_requirements(filename):
base_dir = _find_base_dir()
filepath = os.path.join(base_dir, filename)
packages = []
with open(filepath, "r") as f:
with open(filepath) as f:
for line in f:
line = line.strip()
if not line or line.startswith("#"):

View File

@ -46,7 +46,7 @@ async def test_set_extra_options(gns3vm, vmx_path, windows_platform):
await gns3vm._set_extra_options()
with open(vmx_path, "r") as f:
with open(vmx_path) as f:
assert f.read() == 'vhv.enable = "TRUE"\n'
# when there is an entry, we don't modify it
@ -55,5 +55,5 @@ async def test_set_extra_options(gns3vm, vmx_path, windows_platform):
await gns3vm._set_extra_options()
with open(vmx_path, "r") as f:
with open(vmx_path) as f:
assert f.read() == 'vhv.enable = "FALSE"\n'