"""The models page's Tidy check (api/model_placement.py): models in the wrong folder, identical copies, and moving a model with its covers and info. Files go to temporary folders.""" import asyncio import hashlib import json import os import struct import sys import tempfile import unittest from pathlib import Path from unittest import mock from aiohttp import web from aiohttp.test_utils import TestClient, TestServer PLUGIN = Path(__file__).resolve().parents[1] sys.path[:0] = [str(PLUGIN), str(PLUGIN.parents[1])] from api import model_placement # noqa: E402 def safetensors(*names): raw = json.dumps({name: {"dtype": "F16", "shape": [4, 4], "data_offsets": [0, 0]} for name in names}).encode() return struct.pack("