;; Python 标签查询
;; 定义使用 @name.definition.* 前缀
;; 引用使用 @name.reference.* 前缀

;; ==================== 定义 ====================

;; 函数定义
(function_definition
  name: (identifier) @name.definition.function) @definition.function

;; 类定义
(class_definition
  name: (identifier) @name.definition.class) @definition.class

;; 装饰器函数 (通常也是定义)
(decorated_definition
  (function_definition
    name: (identifier) @name.definition.function)) @definition.function

(decorated_definition
  (class_definition
    name: (identifier) @name.definition.class)) @definition.class

;; ==================== 引用 ====================

;; 函数调用
(call
  function: (identifier) @name.reference.call) @reference.call

(call
  function: (attribute
    attribute: (identifier) @name.reference.call)) @reference.call

;; 类继承
(class_definition
  superclasses: (argument_list
    (identifier) @name.reference.class)) @reference.class
