From eafa841e267340684e11d6661f2ed3812fde5a3c Mon Sep 17 00:00:00 2001 From: jverzani Date: Wed, 19 Feb 2025 13:36:51 -0500 Subject: [PATCH 1/3] set of tuples --- src/python_connection.jl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/python_connection.jl b/src/python_connection.jl index 562ae4b..ebc6e4d 100644 --- a/src/python_connection.jl +++ b/src/python_connection.jl @@ -34,9 +34,12 @@ SymPyCore.:↓(d::Dict) = pydict((↓(k) => ↓(v) for (k,v) ∈ pairs(d))) SymPyCore.:↓(x::Set) = _sympy_.sympify(pyset(↓(sᵢ) for sᵢ ∈ x)) SymPyCore.:↑(::Type{<:AbstractString}, x) = Sym(Py(x)) + +_Set(x) = Set(x) +_Set(xs...) = Set(xs) function SymPyCore.:↑(::Type{PythonCall.Py}, x) # this lower level approach shouldn't allocate - pyisinstance(x, pybuiltins.set) && return Set(Sym.(collect(x))) #Set(↑(xᵢ) for xᵢ ∈ x) + pyisinstance(x, pybuiltins.set) && return _Set(collect(map(↑, x))) pyisinstance(x, pybuiltins.tuple) && return Tuple(↑(xᵢ) for xᵢ ∈ x) pyisinstance(x, pybuiltins.list) && return [↑(xᵢ) for xᵢ ∈ x] pyisinstance(x, pybuiltins.dict) && return Dict(↑(k) => ↑(x[k]) for k ∈ x) From 09b48cd1db4422c1ece290e4ea5eecc0bae023b2 Mon Sep 17 00:00:00 2001 From: jverzani Date: Wed, 19 Feb 2025 13:36:55 -0500 Subject: [PATCH 2/3] set of tuples --- src/python_connection.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/python_connection.jl b/src/python_connection.jl index ebc6e4d..3233794 100644 --- a/src/python_connection.jl +++ b/src/python_connection.jl @@ -39,7 +39,7 @@ _Set(x) = Set(x) _Set(xs...) = Set(xs) function SymPyCore.:↑(::Type{PythonCall.Py}, x) # this lower level approach shouldn't allocate - pyisinstance(x, pybuiltins.set) && return _Set(collect(map(↑, x))) + pyisinstance(x, pybuiltins.set) && return _Set(collect(map(↑, x))...) pyisinstance(x, pybuiltins.tuple) && return Tuple(↑(xᵢ) for xᵢ ∈ x) pyisinstance(x, pybuiltins.list) && return [↑(xᵢ) for xᵢ ∈ x] pyisinstance(x, pybuiltins.dict) && return Dict(↑(k) => ↑(x[k]) for k ∈ x) From 83833a1655f7fe8817307be7f56cee611d514e49 Mon Sep 17 00:00:00 2001 From: jverzani Date: Wed, 19 Feb 2025 13:51:50 -0500 Subject: [PATCH 3/3] version bump --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 3ab37f7..239c828 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "SymPyPythonCall" uuid = "bc8888f7-b21e-4b7c-a06a-5d9c9496438c" authors = ["jverzani and contributors"] -version = "0.5.0" +version = "0.5.1" [deps]