@ncdcgov · Post #4574 · 02.12.2025 г., 19:45
Stay safe this festive season 🎄✨ #Lassa fever is real — keep your food tightly covered and protected NCDCNigeria #LassaFever#HealthyLiving
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
Пребарај: #lassa
@ncdcgov · Post #4574 · 02.12.2025 г., 19:45
Stay safe this festive season 🎄✨ #Lassa fever is real — keep your food tightly covered and protected NCDCNigeria #LassaFever#HealthyLiving
Hashtags
@ncdcgov · Post #4537 · 18.09.2025 г., 14:16
#Lassa Fever is highly infectious but preventable! ✨Keep your meals safe — store food properly, maintain good hygiene, and protect your loved ones. Hygiene is your first line of defense! 🛡️ Stay Informed, Stay Safe! #LassaFever#StaySafe#NCDCNigeria
@ncdcgov · Post #4522 · 04.09.2025 г., 17:41
#Lassa fever is a viral infection spread mainly through contact with food or household items contaminated by urine or droppings of infected rats.🐀 To prevent this spread; ✅ Store food in tightly covered containers to keep rodents away. ✅ Dispose of garbage properly and keep your surroundings clean. ✅ Avoid bush burning that drives rats into homes. ✅ Practice good hand hygiene—wash your hands regularly with soap and water. ✅ Seek medical attention immediately if you develop fever, weakness, or bleeding. Stay informed, Stay healthy! #StaySafe#HealthyLiving#NCDCNigeria
@ncdcgov · Post #4575 · 04.12.2025 г., 07:28
A clean home is your first defence against #Lassa fever. ☑️Store food properly and dispose of waste the right way. Don’t give rats a chance to thrive. Together, we can stay protected. #LassaFever#StayHealthy#NCDCNigeria
@ncdcgov · Post #4606 · 20.02.2026 г., 10:03
#Lassa fever is preventable, awareness is your first line of defense. ✅Avoid contact with rodents and their droppings ✅Store food properly ✅Maintain good hygiene by washing your hands regularly and keeping your surroundings clean and rodents free Seek medical care early if you notice symptoms such as : ✔️Fever ✔️Weakness ✔️Severe headache ✔️Cough ✔️Sore throat Stay informed, Stay Safe!! Prevent. Detect early. Save lives. #LassaFeverAwareness#PublicHealth#NCDCNigeria
@ncdcgov · Post #4571 · 10.11.2025 г., 12:17
#Lassa fever is a serious viral illness spread through contact with infected rodents or contaminated food and household items. ✔️Protect your health and community by reducing rodent exposure and practicing good hygiene always. Stay alert, stay informed, stay safe! #LassaFever#HealthAwareness#StaySafe#NCDCNigeria
@ncdcgov · Post #4597 · 11.02.2026 г., 15:55
#Lassa fever is not caused by witchcraft or spiritual attacks. It is a viral disease transmitted through contact with urine or droppings of an infected rat, contaminated food, or the body fluids of an infected person. Knowing the facts helps us act early and save lives. If you or anyone around you has a persistent fever, visit the nearest health facility immediately. #LassaFever#KnowTheFacts#PublicHealth#NCDCNigeria