@BorussiaDortmund · Post #61387 · 03.05.2026 г., 13:46
Man UTD 🆚 Liverpool | Lineups ⏰ 14:30 GMT 🏟️ Old Trafford 📍 Manchester #EPL
Hashtags
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
Пребарај: #epl
@BorussiaDortmund · Post #61387 · 03.05.2026 г., 13:46
Man UTD 🆚 Liverpool | Lineups ⏰ 14:30 GMT 🏟️ Old Trafford 📍 Manchester #EPL
Hashtags
@reinseele1 · Post #321 · 24.11.2024 г., 12:13
Начинаем плей-офф European Pro League Season 21 с победы против Passion UA 😠 Продолжим 25 ноября в 19:00 по МСК против победителя пары NAVI Junior vs Level UP. #Dota2#EPL
@reinseele1 · Post #298 · 15.11.2024 г., 20:43
Спишь? А у нас второй матч группового этапа EPL S21. Подключаемся на самое сладкое 👇 ✨RU | ✨EN #Dota2#EPL
@reinseele1 · Post #288 · 12.11.2024 г., 14:19
Врываемся в групповой этап European Pro League Season 21. Первый противник — Dragon Esports Club. ✨ RU: https://www.twitch.tv/epldota_ru2 ✨ EN: https://www.twitch.tv/epldota_en2 #Dota2#EPL
@tonlines · Post #7241 · 16.05.2025 г., 14:14
Fanton EN: Friday EPL Fantasy Football Insights #EPL#Fanton Fanton EN provides updates for fantasy football fans with matches including Aston Villa against a lower-ranked team and Chelsea hosting Man United. Key players like Ollie Watkins and Enzo Fernández are highlighted for potential fantasy lineups. Participate in the EPL Double Tournament with an entry fee of $9 to secure top spots. Source: link @tonlines
@tonlines · Post #7231 · 15.05.2025 г., 18:16
Fanton EN: Secure Your Spot for the EPL Grand Tournament #EPL#Fanton Fanton EN is offering a promotional opportunity for players to secure tickets to the EPL Grand Tournament with a $2,000 guarantee. By making 7 entries by May 17th at 21:00 UTC, players can receive an additional free lineup and have the chance for more tickets by increasing their entries. Source: link @tonlines
@tonlines · Post #7131 · 09.05.2025 г., 07:58
⚡️Fanton EN: Last Call for EPL Grand Tournament Registration #Fanton#EPL Fanton EN announces the closing of registration for the English Premier League Grand Tournament, with $3,000 guaranteed. Top players in categories such as goalkeepers and defenders are highlighted, encouraging participation from fantasy players. Source: link @tonlines
@tonlines · Post #6734 · 12.04.2025 г., 11:43
Fanton EN: New EPL Round Registration Closing Soon #EPL#Fanton Fanton EN invites participants to join the new EPL round with a $9 entry fee, featuring matches between Brighton vs Leicester, Nottm Forest vs Everton, and Southampton vs Aston Villa. Registration concludes in 2.5 hours. Source: link @tonlines
@tonlines · Post #7649 · 29.11.2025 г., 13:20
Fanton EN: EPL Tournament Begins Soon! #EPL#tournament Fanton EN announces that the EPL tournament with a $300 prize pool is starting in 1.5 hours. Participants can enter for a 9 USDT fee and compete in the 4+1 format. Source: link @tonlines
Hashtags
@tonlines · Post #6787 · 15.04.2025 г., 17:41
⚡️Fanton EN: Exciting Grand Tournament Returns! #Tournament#EPL Fanton EN announces the return of the EPL Grand Tournament with a $5,000 prize pool. The tournament will take place on April 19–20 and offers thrilling competition for participants with a $9 USDT entry fee. Source: link @tonlines
Hashtags
@tonlines · Post #7687 · 02.12.2025 г., 17:35
⚡️Fanton EN: Exciting EPL Midweek Tournament! #EPL#prizes Fanton EN is hosting an exciting English Premier League tournament with a $200 prize pool. Don’t miss the matches from December 2-4, including Newcastle vs Tottenham and Fulham vs Man City. Join now with a $9 entry fee and compete for the prize! Source: link @tonlines
@tonlines · Post #7153 · 10.05.2025 г., 08:11
⚡️Fanton EN: Grand EPL Tournament Kicks Off Soon! #Fanton#USDT#EPL The Fanton EN channel announces the upcoming Grand EPL Tournament offering a prize pool of $3,000. Participants can join by building their teams and competing to win USDT or $FTON with an entry fee of just $11. Source: link @tonlines