Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.10/site-packages/astroid/brain/brain_uuid.py: 88%

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

8 statements  

1# Licensed under the LGPL: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html 

2# For details: https://github.com/pylint-dev/astroid/blob/main/LICENSE 

3# Copyright (c) https://github.com/pylint-dev/astroid/blob/main/CONTRIBUTORS.txt 

4 

5"""Astroid hooks for the UUID module.""" 

6from astroid.manager import AstroidManager 

7from astroid.nodes.node_classes import Const 

8from astroid.nodes.scoped_nodes import ClassDef 

9 

10 

11def _patch_uuid_class(node: ClassDef) -> None: 

12 # The .int member is patched using __dict__ 

13 node.locals["int"] = [Const(0, parent=node)] 

14 

15 

16def register(manager: AstroidManager) -> None: 

17 manager.register_transform( 

18 ClassDef, _patch_uuid_class, lambda node: node.qname() == "uuid.UUID" 

19 )