@googlefactss · Post #40104 · 16.11.2025 г., 19:01
Nomophobia is the fear of being without your mobile phone. 😱📵 [Source] @googlefactss#phobia
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
Пребарај: #phobia
@googlefactss · Post #40104 · 16.11.2025 г., 19:01
Nomophobia is the fear of being without your mobile phone. 😱📵 [Source] @googlefactss#phobia
Hashtags
@quweibb · Post #4830 · 02.04.2026 г., 10:47
#phobia
Hashtags
@googlefactss · Post #39921 · 13.10.2025 г., 11:55
Arachibutyrophobia is the irrational fear of peanut butter sticking to the roof of your mouth. @googlefactss#funfact#phobia
@googlefactss · Post #40083 · 13.11.2025 г., 23:01
Decidophobia is the fear of making decisions. Choose your source: [Source1] Or [Source2] Or [Source3] @googlefactss #phobia#choices
@googlefactss · Post #40426 · 28.12.2025 г., 11:02
Phobia is an intense, irrational fear of something that is often not dangerous. Fear is a normal reaction to real danger or threat. Phobias cause strong anxiety that is much bigger than the actual risk and can disrupt daily life. Fear helps keep us safe, but phobias are more about worry and avoidance even when there is little or no real danger. @googlefactss #Phobia#Fear#Anxiety#MentalHealth😨⚠️
@googlefactss · Post #40489 · 06.01.2026 г., 15:04
Allodoxaphobia means being very scared of what other people think. It is not an official medical condition but is similar to social anxiety, where people fear being judged or criticized. This fear can make people avoid social situations and feel very anxious. It is different from normal dislike because it causes strong fear that affects daily life. @googlefactss #Phobia#Anxiety#MentalHealth#SocialFear#Allodoxaphobia😟🧠
@googlefactss · Post #40709 · 26.02.2026 г., 23:01
Ablutophobia is a fear of bathing, cleaning or washing the body. It is a real anxiety disorder. People with it may feel panic or rapid heartbeat when thinking about bathing. The fear is stronger than normal dislike and can affect daily hygiene. Treatments like therapy can help manage it. 🚿😨🛁 [Read more] @googlefactss #MentalHealth#Anxiety#Phobia#Ablutophobia#SelfCare#HealthAwareness