mirror of
https://github.com/langgenius/dify.git
synced 2026-04-20 02:37:20 +08:00
31 lines
694 B
YAML
31 lines
694 B
YAML
id: remove-nullable-arg
|
|
language: python
|
|
rule:
|
|
pattern: $X = mapped_column($$$ARGS)
|
|
any:
|
|
- pattern: $X = mapped_column($$$BEFORE, String, $$$MID, nullable=True, $$$AFTER)
|
|
- pattern: $X = mapped_column($$$BEFORE, String, $$$MID, nullable=True)
|
|
rewriters:
|
|
- id: filter-string-nullable
|
|
rule:
|
|
pattern: $ARG
|
|
inside:
|
|
kind: argument_list
|
|
all:
|
|
- not:
|
|
pattern: String
|
|
- not:
|
|
pattern:
|
|
context: a(nullable=True)
|
|
selector: keyword_argument
|
|
fix: $ARG
|
|
|
|
transform:
|
|
NEWARGS:
|
|
rewrite:
|
|
rewriters: [filter-string-nullable]
|
|
source: $$$ARGS
|
|
joinBy: ', '
|
|
fix: |-
|
|
$X: Mapped[str | None] = mapped_column($NEWARGS)
|