File tree Expand file tree Collapse file tree 4 files changed +31
-18
lines changed
resources/clj-kondo.exports/clj-python/libpython-clj
hooks/libpython_clj/python Expand file tree Collapse file tree 4 files changed +31
-18
lines changed Original file line number Diff line number Diff line change 1212 libpython-clj2.require/require-python
1313 hooks.libpython-clj.require.require-python/require-python
1414
15- libpython-clj2.python/py..
16- hooks.libpython-clj.python.py-dot-dot/py..
1715 libpython-clj2.python/py.
18- hooks.libpython-clj.python.py-dot-dot/py..}}
16+ hooks.libpython-clj.python.py-macros/py-macro
17+ libpython-clj2.python/py..
18+ hooks.libpython-clj.python.py-macros/py-macro
19+ libpython-clj2.python/py.-
20+ hooks.libpython-clj.python.py-macros/py-macro
21+ libpython-clj2.python/py*
22+ hooks.libpython-clj.python.py-macros/py-macro
23+ libpython-clj2.python/py**
24+ hooks.libpython-clj.python.py-macros/py-macro}}
1925
2026 :linters
2127 {:unresolved-namespace
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ (ns hooks.libpython-clj.python.py-macros
2+ (:require [clj-kondo.hooks-api :as api]))
3+
4+ (defn py-macro
5+ " Transform py macros to just evaluate the object, ignoring method/attribute symbols.
6+ (py. obj method arg) -> obj
7+ (py.. obj method1 method2) -> obj
8+ (py.- obj attr) -> obj
9+ (py* callable args) -> callable
10+ (py** callable args kwargs) -> callable"
11+ [{:keys [node]}]
12+ (let [children (:children node)
13+ obj-node (second children)]
14+ (if obj-node
15+ {:node obj-node}
16+ {:node (api/token-node nil )})))
Original file line number Diff line number Diff line change 11(ns clj-kondo.fixtures.py-dot-test
2- (:require [libpython-clj2.python :refer [py. py..]]))
2+ (:require [libpython-clj2.python :refer [py. py.. py.- py* py** ]]))
33
4- (defn test-py-dot []
4+ (defn test-py-macros []
55 (let [obj {:foo " bar" }]
66 (py. obj method arg1 arg2)
7- (py.. obj method1 method2 method3)))
7+ (py.. obj method1 method2 method3)
8+ (py.- obj attribute)
9+ (py* callable [arg1 arg2])
10+ (py** callable [arg1] {:kwarg1 val1})))
You can’t perform that action at this time.
0 commit comments