PATH:
opt
/
cloudlinux
/
venv
/
lib
/
python3.11
/
site-packages
/
astroid
/
brain
# Licensed under the LGPL: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html # For details: https://github.com/PyCQA/astroid/blob/main/LICENSE # Copyright (c) https://github.com/PyCQA/astroid/blob/main/CONTRIBUTORS.txt from __future__ import annotations import collections.abc from typing import TypeVar from astroid import nodes from astroid.manager import AstroidManager _NodeT = TypeVar("_NodeT", bound=nodes.NodeNG) def _clone_node_with_lineno( node: _NodeT, parent: nodes.NodeNG, lineno: int | None ) -> _NodeT: cls = node.__class__ other_fields = node._other_fields _astroid_fields = node._astroid_fields init_params = {"lineno": lineno, "col_offset": node.col_offset, "parent": parent} postinit_params = {param: getattr(node, param) for param in _astroid_fields} if other_fields: init_params.update({param: getattr(node, param) for param in other_fields}) new_node = cls(**init_params) if hasattr(node, "postinit") and _astroid_fields: for param, child in postinit_params.items(): if child and not isinstance(child, collections.abc.Sequence): cloned_child = _clone_node_with_lineno( node=child, lineno=new_node.lineno, parent=new_node ) postinit_params[param] = cloned_child new_node.postinit(**postinit_params) return new_node def _transform_formatted_value( # pylint: disable=inconsistent-return-statements node: nodes.FormattedValue, ) -> nodes.FormattedValue | None: if node.value and node.value.lineno == 1: if node.lineno != node.value.lineno: new_node = nodes.FormattedValue( lineno=node.lineno, col_offset=node.col_offset, parent=node.parent ) new_value = _clone_node_with_lineno( node=node.value, lineno=node.lineno, parent=new_node ) new_node.postinit( value=new_value, conversion=node.conversion, format_spec=node.format_spec, ) return new_node # TODO: this fix tries to *patch* http://bugs.python.org/issue29051 # The problem is that FormattedValue.value, which is a Name node, # has wrong line numbers, usually 1. This creates problems for pylint, # which expects correct line numbers for things such as message control. AstroidManager().register_transform(nodes.FormattedValue, _transform_formatted_value)
[-] brain_regex.py
[open]
[-] brain_typing.py
[open]
[-] brain_unittest.py
[open]
[-] brain_type.py
[open]
[+]
..
[-] brain_collections.py
[open]
[+]
__pycache__
[-] brain_hypothesis.py
[open]
[-] brain_dateutil.py
[open]
[-] brain_io.py
[open]
[-] brain_random.py
[open]
[-] brain_crypt.py
[open]
[-] brain_numpy_core_fromnumeric.py
[open]
[-] brain_subprocess.py
[open]
[-] brain_numpy_core_numerictypes.py
[open]
[-] brain_six.py
[open]
[-] brain_numpy_utils.py
[open]
[-] brain_qt.py
[open]
[-] brain_hashlib.py
[open]
[-] brain_curses.py
[open]
[-] brain_numpy_core_umath.py
[open]
[-] brain_scipy_signal.py
[open]
[-] brain_numpy_ndarray.py
[open]
[-] brain_mechanize.py
[open]
[-] brain_numpy_core_multiarray.py
[open]
[-] brain_numpy_core_numeric.py
[open]
[-] brain_signal.py
[open]
[-] brain_dataclasses.py
[open]
[-] brain_namedtuple_enum.py
[open]
[-] brain_argparse.py
[open]
[-] brain_ctypes.py
[open]
[-] helpers.py
[open]
[-] brain_pytest.py
[open]
[-] brain_numpy_ma.py
[open]
[-] brain_functools.py
[open]
[-] brain_nose.py
[open]
[-] brain_attrs.py
[open]
[-] brain_pkg_resources.py
[open]
[-] brain_numpy_random_mtrand.py
[open]
[-] brain_ssl.py
[open]
[-] brain_re.py
[open]
[-] brain_builtin_inference.py
[open]
[-] brain_numpy_core_function_base.py
[open]
[-] __init__.py
[open]
[-] brain_uuid.py
[open]
[-] brain_sqlalchemy.py
[open]
[-] brain_threading.py
[open]
[-] brain_pathlib.py
[open]
[-] brain_fstrings.py
[open]
[-] brain_responses.py
[open]
[-] brain_multiprocessing.py
[open]
[-] brain_numpy_core_einsumfunc.py
[open]
[-] brain_boto3.py
[open]
[-] brain_http.py
[open]
[-] brain_gi.py
[open]