@xiaomi_12tpro_updates · Post #467 · 02.11.2025 г., 20:16
Redmi K50 Ultra, Xiaomi 12T Pro - China - OS3.0.0.1.VLFCNXM (Android 15) 🚨 New internal test version detected! #internal 📆2025/11/02 📱#diting
TGINSIGHT SIMILAR POSTS
Изворен канал @pythonotes · Post #397 · 12 ное.
Использование Pydantic сегодня стало нормой, и это правильно. Но иногда на ревью вижу, что используют его не всегда корректно. Например, метод BaseModel.model_dump() по умолчанию не преобразует стандартные типы, такие как datetime, UUID или Decimal, в простой сериализуемый для JSON вид. Тогда пишут кастмоный сериализатор для этих типов чтобы функция json.dump() не падала с ошибкой. import uuid from datetime import datetime from decimal import Decimal from uuid import UUID from pydantic import BaseModel class MyModel(BaseModel): id: UUID date: datetime value: Decimal obj = MyModel( id=uuid.uuid4(), date=datetime.now(), value='1.23' ) print(obj.model_dump()) # не подходит для json.dump # { # 'id': UUID('4f8c1bc4-25fd-40cd-9dbe-2c73639b0dc1'), # 'date': datetime.datetime(2025, 12, 12, 12, 12, 12, 111111), # 'value': Decimal('1.23') # } # добавляем свой кастомный сериализатор json.dumps(obj.model_dump(), cls=MySerializer) # { # 'id': '4f8c1bc4-25fd-40cd-9dbe-2c73639b0dc1', # 'date': '2025-12-12T12:12:12.111111', # 'value': '1.23' # } В данном случае класс MySerializer обрабатывает datetime, UUID и Decimal. Например так: class MySerializer(json.JSONEncoder): def default(self, o): if isinstance(o, Decimal): return str(o) elif isinstance(o, datetime): return o.isoformat() elif isinstance(o, UUID): return str(o) return super().default(o) Специально для тех, кто всё еще так делает - в этом нет необходимости! Pydantic может это сделать сам, просто нужно добавить параметр mode="json". json.dumps(obj.model_dump(mode="json")) # { # 'id': '4f8c1bc4-25fd-40cd-9dbe-2c73639b0dc1', # 'date': '2012-12-12T12:12:12.111111', # 'value': '1.23' # } #pydantic#libs
Пребарај: #internal
@xiaomi_12tpro_updates · Post #467 · 02.11.2025 г., 20:16
Redmi K50 Ultra, Xiaomi 12T Pro - China - OS3.0.0.1.VLFCNXM (Android 15) 🚨 New internal test version detected! #internal 📆2025/11/02 📱#diting
@xiaomi_12tpro_updates · Post #452 · 17.10.2025 г., 15:45
Redmi K50 Ultra, Xiaomi 12T Pro - China - OS3.0.250923.1.VLFCNXM.PRE (Android 15) 🚨 New internal test version detected! #internal 📆2025/09/23 📱#diting 🔗@xiaomiui | @miui_download | @hyperosfirmware | HyperOS Updates | XiaomiTime
@testflightynoti · Post #37418 · 02.05.2026 г., 12:04
#Sunflower#Internal Join the Sunflower Internal beta on ✈️#TestFlight 🔗 Link: https://testflight.apple.com/join/TcuN9rry Shared by Dimitri
Hashtags
@TestFlightX · Post #34447 · 03.11.2024 г., 15:18
#RN#APPKIT#INTERNAL https://testflight.apple.com/join/Ivd8bg7s
@miui_download · Post #24507 · 18.04.2026 г., 11:58
POCO M7 5G, Redmi 14R 5G - China - OS3.0.301.0.WGUCNXM (Android 16) 🚨 New internal test version detected! #internal 📆2026/04/18 📱#flame 🔗@xiaomiui | @miui_download | @hyperosfirmware | HyperOS Updates | XimiTime
@miui_download · Post #24278 · 10.04.2026 г., 06:08
POCO M7 5G, Redmi 14R 5G - China - OS3.0.300.4.WGUCNXM (Android 16) 🚨 New internal test version detected! #internal 📆2026/04/10 📱#flame 🔗@xiaomiui | @miui_download | @hyperosfirmware | HyperOS Updates | XimiTime
@miui_download · Post #24668 · 26.04.2026 г., 06:47
REDMI K90 Max - China - OS3.0.307.0.WAACNXM (Android 16) 🚨 New internal test version detected! #internal 📆2026/04/26 📱#prague 🔗@xiaomiui | @miui_download | @hyperosfirmware | HyperOS Updates | XimiTime
@miui_download · Post #24667 · 26.04.2026 г., 06:47
REDMI K90 Max - China - OS3.0.306.0.WAACNXM (Android 16) 🚨 New internal test version detected! #internal 📆2026/04/26 📱#prague 🔗@xiaomiui | @miui_download | @hyperosfirmware | HyperOS Updates | XimiTime
@miui_download · Post #24659 · 26.04.2026 г., 06:42
REDMI K90 Max - China - OS3.0.305.0.WAACNXM (Android 16) 🚨 New internal test version detected! #internal 📆2026/04/26 📱#prague 🔗@xiaomiui | @miui_download | @hyperosfirmware | HyperOS Updates | XimiTime
@miui_download · Post #24650 · 25.04.2026 г., 09:31
REDMI K90 Max - China - OS3.0.300.3.WAACNXM (Android 16) 🚨 New internal test version detected! #internal 📆2026/04/25 📱#prague 🔗@xiaomiui | @miui_download | @hyperosfirmware | HyperOS Updates | XimiTime
@miui_download · Post #24644 · 25.04.2026 г., 09:00
REDMI K90 Max - China - OS3.0.303.0.WAACNXM (Android 16) 🚨 New internal test version detected! #internal 📆2026/04/25 📱#prague 🔗@xiaomiui | @miui_download | @hyperosfirmware | HyperOS Updates | XimiTime
@miui_download · Post #24643 · 25.04.2026 г., 09:00
REDMI K90 Max - China - OS3.0.300.2.WAACNXM (Android 16) 🚨 New internal test version detected! #internal 📆2026/04/25 📱#prague 🔗@xiaomiui | @miui_download | @hyperosfirmware | HyperOS Updates | XimiTime