Skip to content

Commit

Permalink
fix: python's deps generation after updating converter
Browse files Browse the repository at this point in the history
  • Loading branch information
krvital committed Sep 26, 2024
1 parent fad2cd1 commit 8274cad
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions src/aidbox_sdk/generator/python.clj
Original file line number Diff line number Diff line change
Expand Up @@ -293,12 +293,13 @@
(generate-resource-module [_ ir-schema]
{:path (resource-file-path ir-schema)
:content (generate-module
:deps (concat [{:module "typing" :members ["Optional" "List"]}
{:module "dataclasses" :members ["dataclass", "field"]}]
(map (fn [d] {:module "base" :members [(class-alias d)]})
(:deps ir-schema)))
:classes [(generate-class ir-schema
(map generate-class (:backbone-elements ir-schema)))])})
:deps (concat [{:module "typing" :members ["Optional" "List"]}
{:module "dataclasses" :members ["dataclass", "field"]}]
(->> (:deps ir-schema)
(map ->pascal-case)
(map (fn [d] {:module "base" :members [d]}))))
:classes [(generate-class ir-schema
(map generate-class (:backbone-elements ir-schema)))])})

(generate-search-params [_ ir-schemas]
(map (fn [ir-schema]
Expand All @@ -321,12 +322,14 @@
(mapv (fn [[constraint-name schema]]
{:path (constraint-file-path schema constraint-name)
:content (generate-module
:deps (concat [{:module "typing" :members ["Optional" "List"]}
{:module "dataclasses" :members ["dataclass", "field"]}
#_{:module "pydantic" :members ["*"]}]
(map (fn [d] {:module (str "..base." d) :members [d]}) (:deps schema)))
:classes (generate-class (assoc schema :url constraint-name)
(map generate-class (:backbone-elements schema))))})
:deps (concat [{:module "typing" :members ["Optional" "List"]}
{:module "dataclasses" :members ["dataclass", "field"]}
#_{:module "pydantic" :members ["*"]}]
(->> (:deps schema)
(map ->pascal-case)
(map (fn [d] {:module "base" :members [d]}))))
:classes (generate-class (assoc schema :url constraint-name)
(map generate-class (:backbone-elements schema))))})
constraint-ir-schemas))

(generate-sdk-files [_] (generator/prepare-sdk-files :python)))
Expand Down

0 comments on commit 8274cad

Please sign in to comment.