관리-도구
편집 파일: nested_min_max.cpython-311.pyc
� �܋f� � �� � d Z ddlmZ ddlZddlmZ ddlmZmZ ddl m Z ddlmZm Z ddlmZ erdd lmZ ej ej ej ej j fZ G d � de � � Zdd�ZdS )z*Check for use of nested min/max functions.� )�annotationsN)� TYPE_CHECKING)�nodes�objects)�BaseChecker)�only_required_for_messages� safe_infer)� INFERENCE)�PyLinterc �| � e Zd ZdZdZdZddiZedd �� � Zedd �� � Z e d� � dd�� � ZdS )�NestedMinMaxCheckerz�Multiple nested min/max calls on the same line will raise multiple messages. This behaviour is intended as it would slow down the checker to check for nested call with minimal benefits. )zbuiltins.minzbuiltins.max�nested_min_max�W3301)z@Do not use nested call of '%s'; it's possible to do '%s' instead�nested-min-maxzHNested calls ``min(1, min(2, 3))`` can be rewritten as ``min(1, 2, 3)``.�node�nodes.NodeNG�return�boolc �� � t |t j � � sdS t |j � � }t |t j � � o|� � � | j v S )NF)� isinstancer �Callr �func�FunctionDef�qname� FUNC_NAMES)�clsr �inferreds �o/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/pylint/checkers/nested_min_max.py�is_min_max_callz#NestedMinMaxChecker.is_min_max_call/ sX � ��$�� �+�+� ��5��d�i�(�(���x��!2�3�3� 3���� � �C�N�2� � � nodes.Call�list[nodes.Call]c �. � �� � �fd��j D � � S )Nc �r �� g | ]3}�� |� � r|j j �j j k �1|��4S � )r r �name)�.0�argr r s ��r � <listcomp>z;NestedMinMaxChecker.get_redundant_calls.<locals>.<listcomp><