update type-hinting for compatibility

cli-info
Burhan 2 months ago
parent b1263cf4d5
commit 131bf65d09
  1. 3
      tests/test_cli.py
  2. 4
      ultralytics/cfg/__init__.py

@ -1,6 +1,7 @@
# Ultralytics YOLO 🚀, AGPL-3.0 license
import os
import subprocess
from typing import Tuple
import pytest
from PIL import Image
@ -108,7 +109,7 @@ def test_mobilesam():
# model(source)
def run_yolo_info(args) -> tuple[str, str]:
def run_yolo_info(args) -> Tuple[str, str]:
"""Run the yolo info command with specified arguments and capture the output."""
result = subprocess.run(f"yolo info {args}", shell=True, capture_output=True, text=True, encoding="utf-8")
return result.stdout, result.stderr

@ -6,7 +6,7 @@ import subprocess
import sys
from pathlib import Path
from types import SimpleNamespace
from typing import Dict, List, Union
from typing import Dict, List, Tuple, Union
from ultralytics.utils import (
ASSETS,
@ -572,7 +572,7 @@ def handle_yolo_info(args: List[str]) -> None:
for k, v in d.items():
yield f"\t{k}: {_obj_or_dict(v)}"
def _args_load(a: List[str]) -> tuple[dict, str]:
def _args_load(a: List[str]) -> Tuple[dict, str]:
"""Loads arguments from a list of strings."""
f = a.pop(0) if "=" not in a[0] else ""
d: dict = dict(DEFAULT_CFG) | dict(parse_key_value_pair(e) for e in args)

Loading…
Cancel
Save