Your IP : 216.73.217.111
B
A!p\8 � @ s� d Z ddlZddlZddlmZ ddlmZ ddlmZ ddlm Z ddd d
ddd
d�Z
ddddddddhZd"dd�ZG dd� dej
�Zdd� Zdd� Zd d!� ZdS )#z"checker for use of Python logging
� N)�checkers)�
interfaces)�utils)�check_messages)z>Specify string format arguments as logging function parameterszlogging-not-lazya� Used when a logging statement has a call form of "logging.<logging method>(format_string % (format_args...))". Such calls should leave string interpolation to the logging method itself and be written "logging.<logging method>(format_string, format_args...)" so that the program may avoid incurring the cost of the interpolation in those cases in which no message will be logged. For more, see http://www.python.org/dev/peps/pep-0282/.)zLUse % formatting in logging functions and pass the % parameters as argumentszlogging-format-interpolationz�Used when a logging statement has a call form of "logging.<logging method>(format_string.format(format_args...))". Such calls should use % formatting instead, but leave interpolation to the logging function by passing the parameters as arguments.)zLUse % formatting in logging functions and pass the % parameters as argumentszlogging-fstring-interpolationz�Used when a logging statement has a call form of "logging.method(f"..."))". Such calls should use % formatting instead, but leave interpolation to the logging function by passing the parameters as arguments.)z;Unsupported logging format character %r (%#02x) at index %dzlogging-unsupported-formatzWUsed when an unsupported format character is used in a logging statement format string.)z<Logging format string ends in middle of conversion specifierzlogging-format-truncatedz`Used when a logging statement format string terminates before the end of a conversion specifier.)z,Too many arguments for logging format stringzlogging-too-many-argsz>Used when a logging format string is given too many arguments.)z.Not enough arguments for logging format stringzlogging-too-few-argsz=Used when a logging format string is given too few arguments.)ZW1201ZW1202ZW1203ZE1200ZE1201ZE1205ZE1206Zcritical�debug�error� exception�fatal�info�warn�warning� c C s@ t | tj�o>t | jtj�o>|r*| jj|kndo>|r<| j|kS dS )a� Determines if a BoundMethod node represents a method call.
Args:
func (astroid.BoundMethod): The BoundMethod AST node to check.
types (Optional[String]): Optional sequence of caller type names to restrict check.
methods (Optional[String]): Optional sequence of method names to restrict check.
Returns:
bool: true if the node represents a method call for the given type and
method names, False otherwise.
T)�
isinstance�astroid�BoundMethod�boundZInstance�name)�func�types�methodsr
r
�H/opt/alt/python37/lib/python3.7/site-packages/pylint/checkers/logging.py�is_method_calle s
r c @ s� e Zd ZdZejZdZeZ dddddd�fd d
ddd
d
gdd�ffZ
dd� Zdd� Zdd� Z
ee� dd� �Zdd� Zedd� �Zdd� Zdd� Zd S )!�LoggingCheckerz!Checks use of the logging module.�loggingzlogging-modules)r Zcsvz<comma separated list>zcLogging modules to check that the string format arguments are in logging function parameter format.)�default�type�metavar�helpzlogging-format-style�old�choicez<old (%) or new ({)>�newzuFormat style used to check logging format string. `old` means using % formatting, while `new` is for `{}` formatting.)r r r �choicesr c C sf t � | _| jj}| jj| _t |�| _i | _x6|D ].}|�dd�}t |�dkr0|d | j|d <