Использование 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
• Наотрез (adverb)
[na-аt-ryez]
Meaning:
Наотрез signifies an absolute, categorical, point-blank, or flat refusal/denial. When someone says наотрез отказался [na-at-rez at-ka-zal-sya], it means they adamantly refused, leaving zero possibility of changing their mind. It conveys a sense of finality and uncompromising resolve.
Origin:
Наотрез literally translates to on the cut, stemming from the verb отрезать [at-re-zat'], which means to cut off - there's no going back from it. This imagery perfectly captures the adverb's meaning: a decision made with the finality of a sharp, irreversible cut, allowing no reconsideration.
Example:
• Они наотрез отказались разлучаться друг с другом!
They adamantly refused to be separated from each other!
#useful_vocabulary
#adverbs
😎RCR | Support | Boost
Начни свой день с чего-то действительно важного 🐱!
Start your day with something truly important.
👋Приветствую!
• Действительно (adverb)
[diy-ství-til'-nа]
Really, truly, actually, indeed
🔻Its meaning emphasizes the authenticity or importance of something. It strengthens the statement it modifies.
🔻It's generally placed before the word it modifies.
🔻To strengthen an adverb:
• Это действительно важно.
This is really important.
🔻To strengthen an adjective:
• Это действительно важный вопрос.
This is a really important question.
🔻To strengthen a verb:
• Он действительно старался.
He really tried (hard).
🔻Sometimes, действительно expresses surprise at the truth of something:
• Действительно, почему ты ещё в кровати?
Really, why are you still in bed?
🔻While often interchangeable with очень(very), действительно carries a stronger connotation of truthfulness and significance.
❓А что действительно важно для вас по утрам😉?
🎧🗣👇
#adverbs
#useful_vocabulary
😎 Stay with @learnRCRussian
Слишком 🆚️ Чересчур
🔢Слишком (adverb)
[slish-kam]
Too, overly, excessively
🔻It indicates that something exceeds a desirable or appropriate limit, but often in a neutral / general sense.
🔻It can be used with adjectives, adverbs, and verbs:
• Это слишком дорого!
It's too expensive. (слишком + short adjective)
• Ты слишком быстро говоришь.
You speak too fast. (слишком + adverb + verb)
• Он слишком много работает.
He works too much. (слишком + quantity много/мало + verb)
🔢Чересчур (adverb)
[chi-ris-chur]
Excessively, overly, beyond measure, too much (with emphasis).
🔻Чересчур carries a stronger, more emphatic meaning than слишком. It often implies that something is unacceptably excessive, goes beyond what's reasonable, or even sounds a bit disapproving or critical!
🔻It's less common in everyday, neutral contexts than слишком and often adds a touch of emotionality:
• Его реакция была чересчур бурной.
His reaction was excessively passionate. (Чересчур + adjective)
• Это уже чересчур!
That's too much! /That's outrageous! (Often used as an exclamation of exasperation.)
• Чересчур громко! (Чересчур + adverb)
Excessively loud!
💢Though being synonyms:
Слишком is general excess.
Чересчур has a more intense, often critical too much – beyond acceptable limits.
▶️Слишком рано!
🎧🗣👇Make up your own examples with both words!
#tricky_words
#adverbs
😎RCR | Support | Boost
ОK, я позже зайду!
OK, I'll drop in later!
👋Доброе утро, товарищи!
Позже 🆚️ попозже 🆚️ потом
🔻These adverbs all relate to time in the future and can be translated as later.
🔢Позже
[po-zhe]
Later
🔻This is the most general and neutral term, simply meaning "later." It doesn't specify how much later:
• Я приду позже.
I'll come later.
🔢Попозже
[pa-po-zhe]
А bit later
🔻This word adds the nuance of a little later, soon, or in a short while. It implies a shorter delay than позже. Think of the ПО- prefix as meaning a little:
• Я позвоню тебе попозже.
I'll call you a little later.
🔢Потом
[pа-tom]
Аfterwards, eventually
🔻This word implies a less definite, more distant future. It suggests something will happen after something else, but the exact time isn't specified:
• Сделаем это потом.
Let's do it afterwards/later.
🎧🗣👇
#tricky_words
#adverbs
😎RCRussian | Support | Boost
Если бы ChatGPT делал операцию...
- А почему у меня шрам слева, если аппендикс справа?
- Ты абсолютно прав, и молодец, что заметил. Сейчас я переделаю операцию с правильной стороны.
If ChatGPT were performing surgery...
- But why is my scar on the left, if appendicitis is on the right?
- You are absolutely correct, and excellent observation! I will now re-perform the operation on the correct side.
🔻These adverbs of place refer to a static position or location on the right/left side:
• Справа
[spra-va]
On the right
• Слева
[sle-va]
On the left
#AI
#adverbs
#just_a_joke
😎RCR | Support | Boost
Когда надо немного поработать в выходной.
When you need to do a little work on your day off.
🔢🔢🔢 Synonyms for a little bit:
1.Немного
[nim-nо-ga]
A little, a bit (neutral, most common)
2. Немножко
[nim-nоsh-ka]
A little bit (softer, more colloquial)
3. Чуть-чуть
[choot'-choot']
Just a tiny bit (emphasizes small amount)
4.Капельку
[ka-pil'-koo]
A drop, a tiny bit (literally "a droplet")
5.Чуток
[choo-tok]
A smidge, a tad (very informal slang)
Вам тоже пришлось сегодня чуть-чуть поработать? 😀
▶️Аlso an adjective Маленький
🎧🗣👇
#365_marathon
#survive_in_Russia
#adverbs
😎RCR | Support | Boost
#adverbs
#intensifying
@ieltsstrategies
♠️استفاده از highly به جاي very
قبل از اين صفات ميتوانيد از قيد highly استفاده كنيد به معني خيلي.
Likey- unlikely- unusual- successful- competitive- profitable- effective- controversial- recommended.
EXAMPLE:
🔷 it is highly unlikely that I'll finish my work on time.
🔷 Jill's highly unusual behaviour began to worry her parents.
استفاده از absolutely و utterly به جاي very
قبل از اين صفات ميتوانيد از قيد absolutely و utterly استفاده كنيد.
Ridiculous- stupid- impossible- wrong- alone- convinced- devastated- miserable
EXAMPLE:
🔷 It was an absolutely stupid comment to make.
🔷 The whole area was utterly devastated after the earthquake.
@fluencyinenglish
Оченьлюблю or Многолюблю?
🔻The adverbs много [mno-ga] and oчень [o-chin'] can be translated as а lot / very much. Но есть нюанс!
🔢Много goes with things you can measure or count:
• много работать(to work a lot)
• много есть(to eat a lot)
🔢Очень is usually used for emotions and states - things you can’t count:
• очень люблю(I love someone/something a lot)
• очень хочу(I do want something)
✅️ОЧЕНЬ люблю
✅️ОЧЕНЬ хочу
❌️МНОГО люблю
💢 BTW it is possible to use много хочу (I want a lot of...). When I was a child I often heard a proverb:
• Много хочешь - мало получишь!
SLT: Want much - get little!
Grasp all, lose all.
😉But that's not a healthy mindset, just so you know.
#tricky_words
#adverbs
#spoken_Russian
#grammar_tips
😎RCRussian | Support | Boost
• Мало (adverb)
[ma-la]
Little, few
🔻It indicates a small quantity or amount of something.
🔻It is used with countable nouns in plural or uncountables.
🔻Мало takes a noun in Genitive case:
• У меня мало (чего?) котов!
[u mi-nya ma-la ka-tof]
I have few cats!
💢 Also a colloquial variant:
• Маловато (будет)! (adverb)
[ma-la-va-ta (bu-dit)]
There'll be too few/little (of something)!
PS This is the most favourite phrase of the main character in a funny Soviet cartoon Падал прошлогодний снег(Last Year's Snow Was Falling) (1983): watch it on▶️here, and here is full version of this cartoon.
▶️Много, множество (Revision)
🎧🗣👇Отличной среды всем, товарищи!
#useful_vocabulary
#grammar_tips
#adverbs
#films
😎RCR | Support | Boost
😅Приветсвую, товарищи! Guess what the first 3 things I usually see when I barely open my eyes in the morning are.Right you are: my 3 hungry cats!
• Спросонья (adverb)
[spra-so-n'ya]
🔻Its synonym:
• Спросонок
[spra-so-nak]
Meaning:
Groggy, half-asleep, bleary-eyed, just woken up, straight out of bed
🔻It perfectly captures that fuzzy, disoriented state when you're not quite fully alert.
🔻I DO hope it's interesting not only to watch the cute cat video🐱 but also to look at the word building:
• Prefixes С- & ПРО- + root СОНЬ(dream) + suffix -Я = спросонья
• Prefixes С- & ПРО- + root СОН(dream) + suffix -ОК = спросонок
A purr-fect example:
• Спросонья я не понимаю, что от меня хотят мои кошки в 5 (пять) утра.
Being groggy with sleep, I have no idea what my cats want from me at 5 AM.
🎧🗣👇
#RussianLanguage
#useful_vocabulary
#prefixes
#adverbs
😎RCRussian | Support | Boost
😊 These two adverbs seem similar, but they’re quite different! 💡 Here’s a quick tip from Sian! 🤓 Now, complete the sentence:
George only came in _____ to pick up his jacket - he’d left it here yesterday.
1. briefly
2. shortly
🤔 Want to learn more? 🤩 Here’s a useful lesson on adverbs. Link in bio.
#learnenglish#englishtips#ELT#ielts#grammar#adverbs#briefly#shortly#confusingwords