github / github/codeql

General issue Python:Unable to recognize calling a method through an instance member of a class

未關閉
#14,899 6 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
acknowledged Python question
主要語言
CodeQL
星號
10.1k
分支
2.1k
平均合併
2 天 15 小時
30 天內合併 PR
141

描述

when evaluate """private API::Node connection()""", the query result should find """self.orm.connection()""".But the query result is none
```
private API::Node dbClient() {
result = API::moduleImport("dbutils").getMember("pooled_db").getMember("PooledDB").getReturn()
}

private API::Node connection() {
result = dbClient().getMember("connection").getReturn()
}
```

python demo here
```
import flask
import pymysql
from flask import request
from dbutils.pooled_db import PooledDB

app = flask.Flask(__name__)

class Database:
def __init__(self):
self.orm = self.dbpool()

def dbpool(self):
pool = PooledDB(
creator=pymysql
)
return pool

def conn(self):
self.orm.connection()

@app.route('/search')
def search():
query = request.args.get('query')
database = Database()
database.conn()
database.orm.connection()
return f"Search query: {query}"

if __name__ == '__main__':
app.run()
```

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。