Исанбеков Дамир 414 КФ AnnoDoc 17126
Жан-Юль-Ян Азель, 414 группа (КФ) AnnoDoc 17163
f1class AnnoDoc(type):f1class AnnoDoc(type):
22
n3    def __new__(cls, class_name, base_classes, class_dict):n3    def __new__(metacls, cls_name, cls_bases, cls_dict):
4        created_class = super().__new__(cls, class_name, base_classes, c4        cls_instance = super().__new__(metacls, cls_name, cls_bases, cls
>lass_dict)>_dict)
5        doc_content = []5        doc_parts = []
6        if created_class.__doc__:6        if cls_instance.__doc__:
7            doc_content.append(created_class.__doc__)7            doc_parts.append(cls_instance.__doc__)
8        type_annotations = {}8        annots = {}
9        for attribute, annotation in class_dict.get('__annotations__', {9        for attr_name, attr_type in cls_dict.get('__annotations__', {}).
>}).items():>items():
10            if isinstance(annotation, str):10            if isinstance(attr_type, str):
11                doc_content.append(f'{attribute}: {annotation}')11                doc_parts.append(f'{attr_name}: {attr_type}')
12                if attribute not in class_dict:12                if attr_name not in cls_dict:
13                    continue13                    continue
t14            type_annotations[attribute] = type(class_dict[attribute]) ift14            annots[attr_name] = type(cls_dict[attr_name]) if attr_name i
> attribute in class_dict else annotation>n cls_dict else attr_type
15        created_class.__doc__ = '\n'.join(doc_content) if doc_content el15        cls_instance.__doc__ = '\n'.join(doc_parts) if doc_parts else No
>se None>ne
16        created_class.__annotations__ = type_annotations16        cls_instance.__annotations__ = annots
17        return created_class17        return cls_instance
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op