Function: python--treesit-variable-p

python--treesit-variable-p is a byte-compiled function defined in python.el.gz.

Signature

(python--treesit-variable-p NODE)

Documentation

Check whether NODE is a variable.

NODE's type should be "identifier".

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/python.el.gz
(defun python--treesit-variable-p (node)
  "Check whether NODE is a variable.
NODE's type should be \"identifier\"."
  ;; An identifier can be a function/class name, a property, or a
  ;; variables.  This function filters out function/class names,
  ;; properties and method parameters.
  (pcase (treesit-node-type (treesit-node-parent node))
    ((or "function_definition" "class_definition" "parameters") nil)
    ("attribute"
     (pcase (treesit-node-field-name node)
       ("object" t)
       (_ nil)))
    (_ t)))