Skip to content

Commit

Permalink
Add type_of list (#126)
Browse files Browse the repository at this point in the history
  • Loading branch information
cristineguadelupe authored Jan 2, 2024
1 parent c0592b7 commit 84c229d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/kino/explorer.ex
Original file line number Diff line number Diff line change
Expand Up @@ -134,14 +134,18 @@ defmodule Kino.Explorer do
if String.printable?(value, inspect_opts.limit), do: value, else: inspect(value)
end

defp value_to_string("list", value) do
inspect(value)
end

defp value_to_string(_type, value) do
to_string(value)
end

defp summaries(df, groups) do
df_series = DataFrame.to_series(df)
has_groups = length(groups) > 0
# hacky way to provide backward compatibility for {:list, numeric} error
# hacky way to provide backward compatibility for {:list, numeric} error
# https://github.com/elixir-explorer/explorer/issues/787
exp_ver_0_7_2_gte? = Explorer.Shared.dtypes() |> Enum.member?({:s, 8})

Expand Down Expand Up @@ -222,6 +226,7 @@ defmodule Kino.Explorer do
defp type_of(:boolean, _), do: "boolean"
defp type_of(:string, [data]), do: type_of_sample(data)
defp type_of(:binary, _), do: "binary"
defp type_of({:list, _}, _), do: "list"
defp type_of(dtype, _), do: if(numeric_type?(dtype), do: "number", else: "text")

defp type_of_sample("http" <> _rest), do: "uri"
Expand Down

0 comments on commit 84c229d

Please sign in to comment.