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

Резултати

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

Пребарај: #euex

当前筛选 #euex清除筛选
OnePlus OS Update Tracker

@OnePlusOTA · Post #837 · 05.11.2022 г., 09:02

OnePlus 9 Pro OxygenOS 12.1 C.65 EUEX System • Integrates the September 2022 Android security patch to enhance system security. MD5 Full: b729f909d80ccc9537891d1745012435 Size Full: 4.20 GB (4507755544) Downloads ColorOS Global Server: Full ColorOS Europe Server: Full ColorOS India Server: Full Exported by MlgmXyysd Color OTA Bot@OnePlusOTA #Oxygen#lemonadep#Europe#EUEX#Full#Stable#LE2123

OnePlus OS Update Tracker

@OnePlusOTA · Post #787 · 03.10.2022 г., 03:03

OnePlus 9 Pro OxygenOS 12 C.64 EUEX System • Improves system stability. • Integrates the August 2022 Android security patch to enhance system security. Camera • Adds three filters, including Radiance, Serenity and Emerald. • Adds Movie and Dual-view video modes to improve user experience. • Adds Long Exposure mode that provides you with more options on the exposure time. You can use this mode to capture the movement of objects or lights. MD5 Full: 26971c50bde0ebab311089e2278fb725 Size Full: 4.19 GB (4502064809) Downloads ColorOS Global Server: Full ColorOS Europe Server: Full ColorOS India Server: Full Exported by MlgmXyysd Color OTA Bot@OnePlusOTA #Oxygen#lemonadep#Europe#EUEX#Full#Stable#LE2123

OnePlus OS Update Tracker

@OnePlusOTA · Post #838 · 05.11.2022 г., 09:02

OnePlus 9 OxygenOS 12.1 C.65 EUEX System • Integrates the September 2022 Android security patch to enhance system security. MD5 Full: 65f90b277d346df9e328bc3ff94a9105 Size Full: 4.12 GB (4423313513) Downloads ColorOS Global Server: Full ColorOS Europe Server: Full ColorOS India Server: Full Exported by MlgmXyysd Color OTA Bot@OnePlusOTA #Oxygen#lemonade#Europe#EUEX#Full#Stable#LE2113

OnePlus OS Update Tracker

@OnePlusOTA · Post #788 · 03.10.2022 г., 03:04

OnePlus 9 OxygenOS 12 C.64 EUEX System • Improves system stability. • Integrates the August 2022 Android security patch to enhance system security. Camera • Adds three filters, including Radiance, Serenity and Emerald. • Adds Movie and Dual-view video modes to improve user experience. • Adds Long Exposure mode that provides you with more options on the exposure time. You can use this mode to capture the movement of objects or lights. MD5 Full: 7a2f73d27902d7b84f399dace9d03ed1 Size Full: 4.11 GB (4417007451) Downloads ColorOS Global Server: Full ColorOS Europe Server: Full ColorOS India Server: Full Exported by MlgmXyysd Color OTA Bot@OnePlusOTA #Oxygen#lemonade#Europe#EUEX#Full#Stable#LE2113

OnePlus OS Update Tracker

@OnePlusOTA · Post #709 · 05.08.2022 г., 04:15

OnePlus 8T OxygenOS 12.1 C.33 EUEX System • Improves system stability for some scenarios. • Fixes an issue where fingerprint unlock might be slow to respond. • Optimizes the experience of fingerprint unlocking. • Integrates the July 2022 Android security patch to enhance system security. Communication • Improves stability of mobile network connections. MD5 Full: 58e1b5146b2c1aee5e826db05ad65508 Size Full: 3.81 GB (4094575512) Downloads ColorOS Global Server: Full Exported by MlgmXyysd Color OTA Bot@OnePlusOTA #Oxygen#kebab#Europe#EUEX#Full#Stable#KB2003

OnePlus OS Update Tracker

@OnePlusOTA · Post #734 · 16.08.2022 г., 04:03

Known Issues • RCC cannot work normally in this build. • The carrier version (Zain) in Kuwait is unable to send MMS. • The carrier version (Telecom) in North Macedonia is unable to send IMS. • There is no response when clicking Capture log after switching Multiple users/System cloner/Languages. (You need to switch Multiple users/System cloner/Languages first before capturing the log in the feedback tool). • A dot will display abnormally when pairing Bluetooth. • The photos might be blurred when taking multiple pictures of people with Ultra Dark mode and zoom out at the same time. • The screen will freeze when taking videos in specific scenarios. • The pictures might be black when taking photos in the dark with Night mode. • A dot displays abnormally in the status bar. MD5 Full: - Size Full: 4.49 GB (4820065538) Downloads Oxygen Website Server: Full Exported by MlgmXyysd Color OTA Bot@OnePlusOTA [2/2] #Oxygen#negroni#Europe#EUEX#Global#Full#OpenBeta#NE2213

OnePlus OS Update Tracker

@OnePlusOTA · Post #733 · 16.08.2022 г., 04:02

OnePlus 10 Pro OxygenOS 13.0.0 Open Beta C.17 EUEX Aquamorphic Design • Adds Aquamorphic Design theme colors for enhanced visual comfort. • Applies the Aquamorphic Design philosophy to animations to make them natural and vivid. • Adds a Home screen world clock widget to show the time in different time zones. • Upgrades to Quantum Animation Engine 4.0, with a new behavior recognition feature, which recognizes complex gestures and provides optimized interactions. • Applies real-world physical motions to animations to make them look more natural and intuitive. • Optimizes fonts for better readability. • Enriches and optimizes illustrations for features by incorporating multicultural and inclusive elements. Efficiency • Adds Meeting Assistant to enhance the meeting connection and introduces an option to make notifications more subtle and less distracting. • Adds large folders to the Home screen. You can now open an app in an enlarged folder with just one tap and turn pages in the folder with a swipe. • Adds media playback control, and optimizes the Quick Settings experience. • Adds more markup tools for screenshot editing. • Optimizes Shelf. Swiping down on the Home screen will bring up the Shelf by default. You can search content online and on your device. Seamless interconnection • Optimizes earphone connectivity to deliver a more seamless experience. Personalization • Optimizes Bitmoji to offer more Always-On Display animations. • Optimizes Insight Always-On Display, with more personalized Always-On Display settings available. • Optimizes Canvas Always-On Display, with more drawing tools and line colors available. Security & privacy • Adds an automatic pixelation feature for screenshots of chats. The system can identify and automatically pixelate profile pictures and display names in a chat screenshot to protect your privacy. • Adds regular clearing of clipboard data for privacy protection. • Optimizes Private Safe. The Advanced Encryption Standard (AES) is used to encrypt all files for enhanced security of private files. Health & Digital wellbeing • Adds Kid Space, providing screen time limit, ambient light reminders, and Eye-protecting display features. Performance optimization • Adds Dynamic Computing Engine to improve the system speed, stability, battery life, and app experience. • Optimizes Dolby Sound effects with enhanced spatial sound field perception and more accurate sound sourcing. Gaming experience • Upgrades to HyperBoost GPA 4.0 to stabilize the frame rate and balance the performance and power consumption in key scenarios. System • Improves system stability for some scenarios. • Fixes an issue where icons would sometimes overlap in Quick Settings. • Fixes an issue where a panel might be automatically pulled down from the status bar in some cases. • Fixes an issue that might cause auto brightness to respond slowly. • Fixes an occasional flicker issue that might occur when your device screen is turned off or on. • Fixes an issue where the Quick Settings background might appear transparent. • Fixes an issue where you might be unable to wake your screen by double-tapping it in Guest mode. • Fixes an issue where your screen might be slow to wake when the Power button is pressed. • Fixes an issue where the "Other" category might take up a huge portion of your device storage. Camera • Fixes an issue where the Camera would lag. Exported by MlgmXyysd Color OTA Bot@OnePlusOTA [1/2] #Oxygen#negroni#Europe#EUEX#Global#Full#OpenBeta#NE2213

OnePlus OS Update Tracker

@OnePlusOTA · Post #609 · 30.05.2022 г., 17:33

OnePlus 8T OxygenOS 12.1 C.20 EUEX System [Improved] system stability [Updated] Android security patch to 2022.05 MD5 Full: 4f491ce9d3aeb53ef9fff2dc3c188790 SHA-1 Increment (KB2003_11_C.16): 85a46397b897f35490e6526298947da63aba9295 Size Increment (KB2003_11_C.16): 1.00 GB (1076999412) Full: 3.75 GB (4031195317) Downloads Google OTA Server: Increment (KB2003_11_C.16) ColorOS Global Server: Full Exported by MlgmXyysd Color OTA Bot@OnePlusOTA #Oxygen#kebab#Europe#EUEX#Increment#Full#Stable#KB2003

OnePlus OS Update Tracker

@OnePlusOTA · Post #610 · 30.05.2022 г., 17:40

OnePlus 8 Pro OxygenOS 12.1 C.20 EUEX System [Improved] system stability [Updated] Android security patch to 2022.05 MD5 Full: 2edc9e2c746b87b7286022608092ef60 SHA-1 Increment (IN2023_11_C.16): bdbef9af696f9431265757c7dd0302a9530c8cc2 Size Increment (IN2023_11_C.16): 1.08 GB (1159362431) Full: 3.86 GB (4146386209) Downloads Google OTA Server: Increment (IN2023_11_C.16) ColorOS Global Server: Full Exported by MlgmXyysd Color OTA Bot@OnePlusOTA #Oxygen#instantnoodlep#Europe#EUEX#Increment#Full#Stable#IN2023

OnePlus OS Update Tracker

@OnePlusOTA · Post #611 · 30.05.2022 г., 17:42

OnePlus 8 OxygenOS 12.1 C.20 EUEX System [Improved] system stability [Updated] Android security patch to 2022.05 MD5 Full: 6c5d5db080b003654508df8815f664ae SHA-1 Increment (IN2013_11_C.16): 58304d0cb92b8efbf936b7579f16dbed521603b1 Size Increment (IN2013_11_C.16): 1.08 GB (1159322916) Full: 3.82 GB (4105488499) Downloads Google OTA Server: Increment (IN2013_11_C.16) ColorOS Global Server: Full Exported by MlgmXyysd Color OTA Bot@OnePlusOTA #Oxygen#instantnoodle#Europe#EUEX#Increment#Full#Stable#IN2013

OnePlus OS Update Tracker

@OnePlusOTA · Post #4 · 22.02.2021 г., 05:49

Welcome to OnePlus OS Update Tracker! This channel tracks system updates for OnePlus related devices. The bot has not yet been completed and is currently posted manually 该频道负责追踪 OnePlus 相关设备的系统更新,机器人尚未完工,目前暂为手动发布 Donation / 捐赠 https://www.neko.ink/ (Buy me a coffee) Language / 语言 EN / English / 英语 ZH / Simplified Chinese / 简体中文 Catalogue / 目录 You can use these tags to quickly find what you want 你可以使用这些标签快速找到你需要的 Announcement / 公告: #NeverSettle By System / 系统: HydrogenOS / 氢 OS: #Hydrogen OxygenOS / 氧 OS: #Oxygen ColorOS: #Color Wear OS by Google: #WearOS RTOS: #RTOS By Region / 区域: China / 中国 CHN: #China#CMCC India / 印度 IND: #India Europe / 欧洲 EEA: #Europe#EUEX#EE Global / 全球 GLO: #Global America / 北美 USA: #NorthAmerica#TMobile#Sprint By Stage / 阶段: Stable / 稳定:#Stable Beta / 公测: #Beta#OpenBeta Alpha / 内测: #Alpha Trial / 尝鲜: #Trial Preview / 预览: #Preview By Type / 类型: Full / 全量包: #Full Increment / 增量包: #Increment Component / 组件包: #Component Downgrade / 降级包: #Downgrade Emergency / 线刷包: #Emergency By Device / 设备机型: OnePlus Nord 5: #lexus OnePlus Ace 5 Ultra: #emira OnePlus Ace 5 Race: #subatu OnePlus 13T / 13s: #pagani OnePlus Ace 5 Pro: #hummer OnePlus 13R / OnePlus Ace 5: #giulia OnePlus 13: #dodge OnePlus Ace 3 Pro: #corvette OnePlus Nord 4: #avalon OnePlus Ace 3V: #audi OnePlus 12R / OnePlus 12R Genshin Impact / OnePlus Ace 3 / OnePlus Ace 3 Genshin Impact: #aston#martin OnePlus 12: #waffle OnePlus Open: #hedwig#xueying OnePlus Ace 2 Pro: #xigua#xiyou OnePlus Nord 3 / OnePlus Ace 2V: #vitamin OnePlus 11R / OnePlus Ace 2 / OnePlus Ace 2Genshin Impact: #udon OnePlus 11: #salami OnePlus 10T / OnePlus Ace Pro / OnePlus Ace Pro Genshin Impact: #ovaltine OnePlus Ace Race: #qqcandy OnePlus 10R / OnePlus 10R Endurance / OnePlus Ace: #pickle OnePlus 10 Pro: #negroni OnePlus 9RT: #martini OnePlus 9 Pro: #lemonadep OnePlus 9: #lemonade OnePlus 9R: #lemonades OnePlus 8T+ (T-Mobile): #kebabt OnePlus 8T: #kebab OnePlus 8 Pro: #instantnoodlep OnePlus 8: #instantnoodle OnePlus 7T Pro 5G: #hotdogg OnePlus 7T Pro: #hotdog OnePlus 7T: #hotdogb OnePlus 7 Pro 5G (EE):#guacamoleg OnePlus 7 Pro 5G (Sprint): #guacamoles OnePlus 7 Pro (T-Mobile): #guacamolet OnePlus 7 Pro: #guacamole OnePlus 7: #guacamoleb OnePlus 6T: #fajita OnePlus 6: #enchilada OnePlus 5T: #dumpling OnePlus 5: #cheeseburger OnePlus 3T: #oneplus3t OnePlus 3: #oneplus3 OnePlus X: #onyx OnePlus 2: #oneplus2 OnePlus One: #bacon OnePlus Nord CE 5: #honda OnePlus Nord CE 4 Lite: #camry OnePlus Nord CE 4: #benz OnePlus Nord CE 3 Lite / Nord N30: #larry OnePlus Nord CE 3: #ziti OnePlus Nord CE 2 Lite: #oscar OnePlus Nord CE 2: #ivan OnePlus Nord CE: #ebba OnePlus Nord 2T: #karen OnePlus Nord 2: #denniz OnePlus Nord: #avicii OnePlus Nord N300: #hlida OnePlus Nord N200: #dre9#dre8t OnePlus Nord N100: #bengal OnePlus Nord N30 SE: #fanli-o OnePlus Nord N20 SE: #zhaoyun-o OnePlus Nord N20: #gunnar OnePlus Nord N10: #billie8#billie8t OnePlus Pad 3 / OnePlus Pad 2 Pro: #erhai-o OnePlus Pad 2 / OnePlus Pad Pro: #rainbow#caihong OnePlus Pad (CN):#dunhuang-o OnePlus Pad Go Wi-Fi / OnePlus Pad Go LTE: #bluey OnePlus Pad: #aries OnePlus Watch 3: #chili OnePlus Watch 2R / OnePlus Watch 2 (CN): #bagel OnePlus Watch 2: #almond OnePlus Watch: #W301CN#W501CN#W301GB OnePlus Band: #W101IN Links / 友情链接 @MlgmXyysd_bibilailai @OnePlusChat @OnePlusRes @OPUpdatesTracker Do you have a question? Want to exchange links? Add your device model? Notify an update? 有任何的疑问? 想要交换友情链接? 添加欲更新的设备型号? 提醒更新? Contact me here -> @MlgmXyysd #NeverSettle