Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkusSintonen committed Oct 19, 2024
1 parent 20c17bf commit 0ea8bb3
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/schema_traverse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,16 +170,14 @@ pub fn gather_schemas_for_cleaning<'py>(
definitions: &Bound<'py, PyAny>,
) -> PyResult<Bound<'py, PyDict>> {
let py = schema.py();
let schema_dict = schema.downcast_exact::<PyDict>()?;

let mut ctx = GatherCtx {
definitions_dict: definitions.downcast_exact()?,
def_refs: PyDict::new_bound(definitions.py()),
recursive_def_refs: PySet::empty_bound(definitions.py())?,
discriminators: PyList::empty_bound(definitions.py()),
def_refs: PyDict::new_bound(py),
recursive_def_refs: PySet::empty_bound(py)?,
discriminators: PyList::empty_bound(py),
recursively_seen_refs: HashSet::new(),
};
gather_schema(schema_dict, &mut ctx)?;
gather_schema(schema.downcast_exact::<PyDict>()?, &mut ctx)?;

let res = PyDict::new_bound(py);
res.set_item(intern!(py, "definition_refs"), ctx.def_refs)?;
Expand Down

0 comments on commit 0ea8bb3

Please sign in to comment.