TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

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

Резултати

Пронајдени 9 слични објави

Пребарај: #lunarisos

当前筛选 #lunarisos清除筛选
Nothing Phone (2) | Updates

@NothingPhone2Updates · Post #644 · 28.06.2025 г., 12:45

Lunaris OS | CLO | Android 15 | Nothing Phone (2) ✍️ Details: - Version: 2.13 - Released: 28/06/25 🔽 Download: Here 🆘 Support : TG ⚙️ Installation: Here 📓 Kernel: Here 📸 Screenshots : Here 🔩 Beta builds : Here 💰 Donation: BMC | steinsgate007@axl ❗️ Tags : #ROM#CLO#V#LunarisOS#NothingPhone2 ✍️ Note: - Recommended to use this kernel - Dolby and nothing camera support available - Latest nothing firmware required - Found bugs! Report in group with proper logs 🔖 Changelog - Merged System LA.QSSI.15.0.r1-16100 (June Patch) - Add Per-app refresh rate selector - Add keybox spoofing (Thanks to HELLBOY017) - Add LMO SystemClocks - Forcefully enable hotspot speed settings - Add support for omni statusbar weather logo - Improvements to performance and system stability 🏆 Credits: - Nothing Phone 2 community for their support - All testers and beta users - For source and features AOSPA team, axionAOSP, risingOS, TenXOS etc 😎 Maintainer : @Ghosutox 🔔 Updates : @NothingPhone2Updates 💬 Chat : @NothingPhone2

Nothing Phone (2) | Updates

@NothingPhone2Updates · Post #623 · 25.05.2025 г., 04:37

Lunaris OS | Radahn - CLO | Android 15 | Nothing Phone (2) ✍️ Details: - Version: 2.12 - Released: 25/05/25 🔽 Download: Recovery | Fastboot | Mirror 🆘 Support : TG ⚙️ Installation: Here 📓 Kernel: Here 📸 Screenshots : Here 🔩 Beta builds : Here 💰 Donation: BMC | steinsgate007@axl ❗️ Tags : #ROM#CLO#V#LunarisOS#NothingPhone2 ✍️ Note: - Recommended to use this kernel - Latest nothing firmware required - Found bugs! Report in group with proper logs 🔖 Changelog - Add back NOS camera sepolicy - Merged System LA.QSSI.15.0.r1-15600-qssi.0 - Configurable Nothing OS inspired doze animation - Add experimental SDK 32 play store spoof switch for integrity - Switch to adreno-t drivers - Some bugs and NPE fixes - Improvements to performance and system stability 🏆 Credits: - Nothing Phone 2 community for their support - All testers and beta users - For source and features AOSPA team, axionAOSP, risingOS, TenXOS etc 😎 Maintainer : @Ghosutox 🔔 Updates : @NothingPhone2Updates 💬 Chat : @NothingPhone2

Nothing Phone (2) | Updates

@NothingPhone2Updates · Post #616 · 14.05.2025 г., 18:51

Lunaris OS | Twilight - CLO | Android 15 | Nothing Phone (2) ✍️ Details: - Version: 2.11 - Released: 14/05/25 🔽 Download: Recovery & Fastboot | Mirror 🆘 Support : TG ⚙️ Installation: Here 📓 Kernel: Here 📸 Screenshots : Here 🔩 Beta builds : Here 💰 Donation: BMC | steinsgate007@axl ❗️ Tags : #ROM#CLO#V#LunarisOS#NothingPhone2 ✍️ Note: - Clean flash recommended from ver.2.6, dirty possible from beta builds - Recommended to use this kernel - Latest nothing firmware required - Use Ofox to flash recovery build - Device may heat up during the first dexopt 🔖Device changelog - Improve dolby dax config - Unlock additional Aperture camera frame rate - Checkout fstab from nos - Improve haptics - Improve audio - Improvements to performance and system stability 🏆 Credits: - Nothing Phone 2 community for their support - All testers and beta users - For source and features AOSPA team, axionAOSP, risingOS, TenXOS etc 😎 Maintainer : @Ghosutox 🔔 Updates : @NothingPhone2Updates 💬 Chat : @NothingPhone2

Nothing Phone (2) | Updates

@NothingPhone2Updates · Post #563 · 13.02.2025 г., 10:24

Lunaris OS | Kitsune - CLO | Android 15 | Nothing Phone (2) ✍️ Details: - Version: 2.6 - Codename: #Pong - Released: 13/02/25 🔽 Download: Download | Mirror 🆘 Support : TG ⚙️ Installation: Here 📖 Changelogs: Here 📸 Screenshots : Here 🔩 Beta builds : Here 💰 Donation: BMC | steinsgate007@axl ❗️ Tags : #ROM#CLO#V#LunarisOS#NothingPhone2 ✍️ Note: - Dirty flash possible from previous build (read installation process) - Both fastboot and recovery build available - Dolby Atmos available - KSU not pre-patched, Flash Meteoric for KSU 🏆 Credits: - Nothing Phone 2 community for their support - All testers and beta users - For source and features AOSPA team, risingOS, crDroid, TenXOS etc 😎 Maintainer : @Ghosutox 🔔 Updates : @NothingPhone2Updates 💬 Chat : @NothingPhone2

Nothing Phone (2) | Updates

@NothingPhone2Updates · Post #540 · 30.01.2025 г., 05:40

Lunaris OS | Monarch - CLO | Android 15 | Nothing Phone (2) ✍️ Details: - Version: 2.5 - Codename: #Pong - Released: 29/01/25 🔽 Download: Download | Mirror 🆘 Support : TG ⚙️ Installation: Here 📖 Changelogs: Here 📸 Screenshots : Here 🔩 Beta builds : Here 💰 Donation: BMC | steinsgate007@axl ❗️ Tags : #ROM#CLO#V#LunarisOS#NothingPhone2 📚 Device changelogs: • Switch to common init • Update blobs from Pong_V3.0-250113-1723_3.0 • Improvements to performance and system stability • Update inbuild kernel ✍️ Note: - Dirty flash possible from previous build (read installation process) - Both fastboot and recovery build available - Dolby Atmos available - KSU not pre-patched, Flash Meteoric for KSU 🏆 Credits: - Nothing Phone 2 community for their support - All testers and beta users - For source and features AOSPA team, risingOS, crDroid, TenXOS etc 😎 Maintainer : @Ghosutox 🔔 Updates : @NothingPhone2Updates 💬 Chat : @NothingPhone2

Nothing Phone (2) | Updates

@NothingPhone2Updates · Post #516 · 21.01.2025 г., 06:31

Lunaris OS | Eclipse - CLO | Android 15 | Nothing Phone (2) ✍️ Details: - Version: 2.4 - Codename: #Pong - Released: 21/01/25 🔽 Download: Recovery | Fastboot | Mirror 🆘 Support : TG ⚙️ Installation: Here 📖 Changelogs: Here 📸 Screenshots : Here 🔩 Beta builds : Here 💰 Donation: BMC | steinsgate007@axl ❗️ Tags : #ROM#CLO#V#LunarisOS#NothingPhone2 ✍️ Note: - Dirty flash possible from previous build (read installation process) - Both fastboot and recovery build available - Dolby Atmos available - Recommended to flash this kernel for better experience (KSU included) 🏆 Credits: - Nothing Phone 2 community for their support - All testers and beta users - For source and features AOSPA team, risingOS, crDroid, TenXOS etc 😎 Maintainer : @Ghosutox 🔔 Updates : @NothingPhone2Updates 💬 Chat : @NothingPhone2

Nothing Phone (2) | Updates

@NothingPhone2Updates · Post #492 · 19.12.2024 г., 13:17

Lunaris OS | Eclipse - CLO | Android 15 | Nothing Phone (2) ✍️ Details: - Version: 2.3 - Codename: #Pong - Released: 19/12/24 🔽 Download: Recovery | Fastboot | Mirror 🆘 Support : TG ⚙️ Installation: Here 📖 Changelogs: Here 📸 Screenshots : Here 🔩 Beta builds : Here 💰 Donation: BMC | steinsgate007@axl ❗️ Tags : #ROM#CLO#V#LunarisOS#NothingPhone2 ✍️ Note: - Dirty flash possible from previous build (read installation process) - Both fastboot and recovery build available - Dolby Atmos available - Recommended to flash this kernel for better experience (KSU included) 🏆 Credits: - Nothing Phone 2 community for their support - All testers and beta users - For source and features AOSPA team, risingOS, crDroid, TenXOS etc 😎 Maintainer : @Ghosutox 🔔 Updates : @NothingPhone2Updates 💬 Chat : @NothingPhone2

Nothing Phone (2) | Updates

@NothingPhone2Updates · Post #477 · 27.11.2024 г., 12:14

Lunaris OS | Optimus - CLO | Android 15 | Nothing Phone (2) ✍️ Details: - Version: 2.2 - Codename: #Pong - Released: 27/11/24 🔽 Download: Recovery | Fastboot | Mirror 🆘 Support : TG ⚙️ Installation: Here 📖 Changelogs: Here 📸 Screenshots : Here 🔩 Beta builds : Here 💰 Donation: steinsgate007@axl ❗️ Tags : #ROM#CLO#V#LunarisOS#NothingPhone2 ✍️ Note: - Dirty flash possible from previous build (read installation process) - Circle to search available in both Pixel launcher and Launcher3 - Both fastboot and recovery build available - Dolby Atmos available - Recommended to flash this kernel for better experience (KSU included) 🏆 Credits: - Nothing Phone 2 community for their support - All testers and beta users - For source and features AOSPA team, risingOS, crDroid, TenXOS etc 😎 Maintainer : @Ghosutox 🔔 Updates : @NothingPhone2Updates 💬 Chat : @NothingPhone2

Nothing Phone (2) | Updates

@NothingPhone2Updates · Post #473 · 17.11.2024 г., 15:37

Lunaris OS | Ember - CLO | Android 15 | Nothing Phone (2) ✍️ Details: - Version: 2.1 - Codename: #Pong - Released: 17/11/24 🔽 Download: Recovery | Fastboot | Mirror 🆘 Support : TG ⚙️ Installation: Here 📸 Screenshots : Here 💰 Donation: steinsgate007@axl ❗️ Tags : #ROM#CLO#V#LunarisOS#NothingPhone2 ✍️ Note: - Initial public release - Both fastboot and recovery build available - Dolby Atmos available - Clean flash must (Dirty possible from previous beta) - If face You tube lag flash this kernel (KSU included) 🏆 Credits: - Nothing Phone 2 community for their support 😎 Maintainer : @Ghosutox 🔔 Updates : @NothingPhone2Updates 💬 Chat : @NothingPhone2