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

7 statements  

« prev     ^ index     » next       coverage.py v7.2.7, created at 2023-06-07 06:53 +0000

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 

16AstroidManager().register_transform( 

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

18)