TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

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

Резултати

Пронајдени 1 слични објави

Пребарај: #magiccircle

当前筛选 #magiccircle清除筛选
English Law Report

@enlawreport · Post #1758 · 01.11.2025 г., 07:26

💼 Advanced Legal Opinions — там, где тонкий риск превращается в юридическую броню. Вот 10 продвинутых промптов, которые используют юристы Magic Circle при подготовке комплексных legal opinions: от enforceability и санкций — до кросс-бордер и regulatory анализов. 🧩 PROMPT SET 1️⃣ Enforceability Opinion Draft an enforceability opinion for a loan agreement governed by English law and executed by a foreign borrower. Identify key issues (capacity, authority, governing law, jurisdiction, public policy) and formulate standard opinion wording. ⚖️Учимся писать главный раздел банковских opinion’ов. 2️⃣ Capacity and Authority Prepare the “corporate capacity and authority” section of a legal opinion for a foreign company entering an English law contract. Explain which documents and corporate actions you would verify. 📑Практика due diligence в юридическом мнении. 3️⃣ Regulatory Legal Opinion Draft the key parts of a regulatory legal opinion on whether a proposed financial product requires FCA authorisation under English law. Include relevant statutory references and FCA guidance. 🏛️Формат мнения для финансовых институтов. 4️⃣ Sanctions Exposure Draft a legal opinion analysing the impact of UK sanctions on the enforceability of a contract with a Russian counterparty. Identify how OFSI and UK sanctions regulations affect contractual obligations. 💣Тема с высоким риском и международным резонансом. 5️⃣ Cross-Border Recognition Write the “Recognition and Enforcement” section of a legal opinion for an English judgment to be enforced in another jurisdiction. Include analysis under the CJJA 1982 and relevant bilateral treaties. 🌍Отрабатываем мнение для трансграничных споров. 6️⃣ Conflict of Laws Draft an opinion analysing potential conflicts of law arising in a transaction involving English, French, and UAE parties. Identify governing law hierarchy and how Rome I applies. ⚙️Практикуем кросс-юрисдикционный анализ. 7️⃣ Material Adverse Effect Clause Prepare a legal opinion evaluating the enforceability and interpretation of a “Material Adverse Effect” clause under English law. Include relevant case law and contractual construction principles. 📊Для M&A и корпоративных сделок. 8️⃣ Force Majeure and Frustration Draft an analytical section comparing “force majeure” clauses and the doctrine of “frustration” under English law. Apply to a scenario involving supply chain disruption. ⚓Практический opinion для морских и коммерческих дел. 9️⃣ Legal Risk and Opinion Limitations Create a model paragraph explaining limitations of responsibility and legal uncertainty in a cross-border opinion. Include “reasoned opinion” vs “confirmation opinion” distinction. 🧩Профессиональное самострахование юриста. 🔟 Opinion Letter Formatting and Presentation Design a professional layout and heading system for a legal opinion letter issued by a Magic Circle firm. Include best practices for clarity, annex references, and signature blocks. 💼Финальный штрих — эстетика и структура документа. 🎓Хэштеги: #ELR#LegalOpinion#EnglishLaw#MagicCircle#LawyerSkills#AdvancedLaw