@AiGenLabsStyles · Post #1698 · 13.10.2025 г., 09:14
🔝🔝 --sref 2089811485 --s 150 --v 7 #Cinematic#Surreal#Vibrant#Detailed#Magenta#StyleRandom#MidJourney#AiGenLabs#Ai 〰️〰️〰️〰️〰️ 🔥AiGenLabs - main channel
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
Пребарај: #magenta
@AiGenLabsStyles · Post #1698 · 13.10.2025 г., 09:14
🔝🔝 --sref 2089811485 --s 150 --v 7 #Cinematic#Surreal#Vibrant#Detailed#Magenta#StyleRandom#MidJourney#AiGenLabs#Ai 〰️〰️〰️〰️〰️ 🔥AiGenLabs - main channel
@djangoproject · Post #252 · 02.02.2017 г., 18:13
https://magenta.tensorflow.org/welcome-to-magenta We’re happy to announce #Magenta, a project from the Google Brain team that asks: Can we use #machine_learning to create compelling art and music? If so, how? If not, why not? We’ll use #TensorFlow, and we’ll release our models and tools in open source on our GitHub. We’ll also post demos, tutorial blog postings and technical papers. Soon we’ll begin accepting code contributions from the community at large. If you’d like to keep up on Magenta as it grows, you can follow us on our GitHub and join our discussion group.
@AiGenLabsStyles · Post #1153 · 13.03.2025 г., 11:16
⭐️ --sref 2376998380 #Photography#Vintage#Muted#Orange#Magenta#Cinematic#Detailed#StyleRandom#MidJourney#AiGenLabs#Ai 〰️〰️〰️〰️〰️ 👥TheLab - our community 🔥AiGenLabs - main channel
@AiGenLabsStyles · Post #1734 · 30.10.2025 г., 07:12
🔝🔝 --sref 708454023 --v 7 #Cinematic#Surreal#Vibrant#Magenta#White#Minimalist#Detailed#StyleRandom#MidJourney#AiGenLabs#Ai 〰️〰️〰️〰️〰️ 🔥AiGenLabs - main channel
@AiGenLabsStyles · Post #1414 · 25.07.2025 г., 09:45
🔝🔝 --sref 2851911678 --v 7 #Illustration#2d#Vibrant#Minimalist#Magenta#Vector#Cute#StyleRandom#MidJourney#AiGenLabs#Ai 〰️〰️〰️〰️〰️ 🔥AiGenLabs - main channel
@AiGenLabsStyles · Post #1467 · 09.08.2025 г., 07:12
🔝🔝 --sref 481102813 --v 7 #Illustration#2d#Vibrant#Detailed#Dark#Magenta#Neon#Cartoon#StyleRandom#MidJourney#AiGenLabs#Ai 〰️〰️〰️〰️〰️ 🔥AiGenLabs - main channel
@DMJ_Themes · Post #141 · 04.10.2019 г., 05:39
Jimi Hendrix Psy Theme. https://t.me/addtheme/JimiHendrixPsy #violet#magenta#blue#aquamarine#psychedelic (Original theme here)
@DMJ_Themes · Post #56 · 07.05.2017 г., 21:05
#violet#magenta#blue#aquamarine#psychedelic @DMJ_Themes
@DMJ_Themes · Post #55 · 07.05.2017 г., 21:00
Jimi Hendrix desktop theme. A psychedelic telegram desktop theme. @DMJ_Themes #violet#magenta#blue#aquamarine#psychedelic t.me/DMJ_Themes
@AiGenLabsStyles · Post #1493 · 16.08.2025 г., 08:13
🔝🔝 --sref 3706150594 --v 7 #Illustration#2d#Vibrant#Minimalist#Magenta#Pink#Vector#Cute#StyleRandom#MidJourney#AiGenLabs#Ai 〰️〰️〰️〰️〰️ 🔥AiGenLabs - main channel
@AiGenLabsStyles · Post #1390 · 19.07.2025 г., 08:13
🔝🔝 --sref 3323562529 --v 7 #Illustration#2d#Vibrant#Minimalist#Magenta#Vector#Art#StyleRandom#MidJourney#AiGenLabs#Ai 〰️〰️〰️〰️〰️ 🔥AiGenLabs - main channel
@ThemesM8 · Post #210 · 06.09.2021 г., 13:28
https://t.me/addtheme/wyYnTX8llrx61I5B 🌈@ThemesM8✨ #dark#cat#kitten#android#purple#blue#black#amoled#pink#cute#cyan#magenta#violet#night#colors#colorful#desktop