Bladeren bron

fix: ruff check for True if ... else (#12576)

Signed-off-by: yihong0618 <zouzou0208@gmail.com>
tags/0.15.1
yihong 9 maanden geleden
bovenliggende
commit
4e101604c3
No account linked to committer's email address

+ 0
- 1
api/.ruff.toml Bestand weergeven

"SIM108", # if-else-block-instead-of-if-exp "SIM108", # if-else-block-instead-of-if-exp
"SIM113", # enumerate-for-loop "SIM113", # enumerate-for-loop
"SIM117", # multiple-with-statements "SIM117", # multiple-with-statements
"SIM210", # if-expr-with-true-false
] ]


[lint.per-file-ignores] [lint.per-file-ignores]

+ 1
- 1
api/controllers/console/explore/conversation.py Bestand weergeven



pinned = None pinned = None
if "pinned" in args and args["pinned"] is not None: if "pinned" in args and args["pinned"] is not None:
pinned = True if args["pinned"] == "true" else False
pinned = args["pinned"] == "true"


try: try:
with Session(db.engine) as session: with Session(db.engine) as session:

+ 1
- 1
api/controllers/service_api/wraps.py Bestand weergeven

tenant_id=app_model.tenant_id, tenant_id=app_model.tenant_id,
app_id=app_model.id, app_id=app_model.id,
type="service_api", type="service_api",
is_anonymous=True if user_id == "DEFAULT-USER" else False,
is_anonymous=user_id == "DEFAULT-USER",
session_id=user_id, session_id=user_id,
) )
db.session.add(end_user) db.session.add(end_user)

+ 1
- 1
api/controllers/web/conversation.py Bestand weergeven



pinned = None pinned = None
if "pinned" in args and args["pinned"] is not None: if "pinned" in args and args["pinned"] is not None:
pinned = True if args["pinned"] == "true" else False
pinned = args["pinned"] == "true"


try: try:
with Session(db.engine) as session: with Session(db.engine) as session:

+ 1
- 1
api/core/model_runtime/schema_validators/common_validator.py Bestand weergeven

if value.lower() not in {"true", "false"}: if value.lower() not in {"true", "false"}:
raise ValueError(f"Variable {credential_form_schema.variable} should be true or false") raise ValueError(f"Variable {credential_form_schema.variable} should be true or false")


value = True if value.lower() == "true" else False
value = value.lower() == "true"


return value return value

+ 2
- 2
api/core/rag/datasource/vdb/lindorm/lindorm_vector.py Bestand weergeven

hnsw_ef_construction = kwargs.pop("hnsw_ef_construction", 500) hnsw_ef_construction = kwargs.pop("hnsw_ef_construction", 500)
ivfpq_m = kwargs.pop("ivfpq_m", dimension) ivfpq_m = kwargs.pop("ivfpq_m", dimension)
nlist = kwargs.pop("nlist", 1000) nlist = kwargs.pop("nlist", 1000)
centroids_use_hnsw = kwargs.pop("centroids_use_hnsw", True if nlist >= 5000 else False)
centroids_use_hnsw = kwargs.pop("centroids_use_hnsw", nlist >= 5000)
centroids_hnsw_m = kwargs.pop("centroids_hnsw_m", 24) centroids_hnsw_m = kwargs.pop("centroids_hnsw_m", 24)
centroids_hnsw_ef_construct = kwargs.pop("centroids_hnsw_ef_construct", 500) centroids_hnsw_ef_construct = kwargs.pop("centroids_hnsw_ef_construct", 500)
centroids_hnsw_ef_search = kwargs.pop("centroids_hnsw_ef_search", 100) centroids_hnsw_ef_search = kwargs.pop("centroids_hnsw_ef_search", 100)
if method_name == "ivfpq": if method_name == "ivfpq":
ivfpq_m = kwargs["ivfpq_m"] ivfpq_m = kwargs["ivfpq_m"]
nlist = kwargs["nlist"] nlist = kwargs["nlist"]
centroids_use_hnsw = True if nlist > 10000 else False
centroids_use_hnsw = nlist > 10000
centroids_hnsw_m = 24 centroids_hnsw_m = 24
centroids_hnsw_ef_construct = 500 centroids_hnsw_ef_construct = 500
centroids_hnsw_ef_search = 100 centroids_hnsw_ef_search = 100

Laden…
Annuleren
Opslaan