# Buildsheet autogenerated by ravenadm tool -- Do not edit. NAMEBASE= python-flake8-builtins VERSION= 2.5.0 KEYWORDS= python VARIANTS= v11 v12 SDESC[v11]= Python builtins validation tool (3.11) SDESC[v12]= Python builtins validation tool (3.12) HOMEPAGE= https://github.com/gforcada/flake8-builtins CONTACT= Python_Automaton[python@ironwolf.systems] DOWNLOAD_GROUPS= main SITES[main]= PYPIWHL/14/33/e423d57dbe2a2ad664d166aeceac58b469510d6c763fada32afd47ffc9ef DISTFILE[1]= flake8_builtins-2.5.0-py3-none-any.whl:main DF_INDEX= 1 SPKGS[v11]= single SPKGS[v12]= single OPTIONS_AVAILABLE= PY311 PY312 OPTIONS_STANDARD= none VOPTS[v11]= PY311=ON PY312=OFF VOPTS[v12]= PY311=OFF PY312=ON DISTNAME= flake8_builtins-2.5.0.dist-info GENERATED= yes [PY311].RUN_DEPENDS_ON= python-flake8:single:v11 [PY311].USES_ON= python:v11,wheel [PY312].RUN_DEPENDS_ON= python-flake8:single:v12 [PY312].USES_ON= python:v12,wheel [FILE:2338:descriptions/desc.single] Flake8 Builtins plugin ====================== Check for python builtins being used as variables or parameters. Imagine some code like this: .. code:: Python def max_values(list, list2): max = list[0] for x in list: if x > 0: max = x all_values = list() all_values.append(max) max = list2[0] for x in list2: if x > 0: max = x all_values.append(max) return all_values max_values([3, 4, 5,], [5, 6, 7]) The last statement is not returning ``[5, 7]`` as one would expect, instead is raising this exception:: Traceback (most recent call last): File "test.py", line 17, in max_values([3,4,5], [4,5,6]) File "bla.py", line 6, in max_values all_values = list() TypeError: 'list' object is not callable **Why?** Because max_value function's first argument is list a Python builtin. Python allows to override them, but although could be useful in some really specific use cases, the general approach is to **not** do that as code then can suddenly break without a clear trace. Example ------- Given the following code: .. code:: Python def my_method(object, list, dict): max = 5 min = 3 zip = (4, 3) The following warnings are shown (via flake8):: test.py:1:15: A002 argument "object" is shadowing a python builtin test.py:1:23: A002 argument "list" is shadowing a python builtin test.py:1:29: A002 argument "dict" is shadowing a python builtin test.py:2:5: A001 variable "max" is shadowing a python builtin test.py:3:5: A001 variable "min" is shadowing a python builtin test.py:4:5: A001 variable "zip" is shadowing a python builtin Install ------- Install with pip:: $ python -m pip install flake8-builtins Options ------- One can use `--builtins-ignorelist` option, or configuration option, to ignore a custom list of builtins:: $ flake8 --builtins-ignorelist id,copyright *.py Requirements ------------ - Python 3.8, 3.9, 3.10, 3.11, 3.12, and pypy3 - flake8 Rules ----- A001: A variable is shadowing a Python builtin. A002: An argument is shadowing a Python builtin. A003: A class attribute is shadowing a Python builtin. A004: An import statement is shadowing a Python builtin. [FILE:117:distinfo] 8cac7c52c6f0708c0902b46b385bc7e368a9068965083796f1431c0d2e6550cf 11964 flake8_builtins-2.5.0-py3-none-any.whl