mirror of
https://github.com/livebook-dev/livebook.git
synced 2025-09-07 21:44:36 +08:00
Fix dialyzer warnings
This commit is contained in:
parent
671c9b679e
commit
cfb719cbb0
8 changed files with 8 additions and 16 deletions
|
@ -310,6 +310,7 @@ defmodule Livebook.Config do
|
|||
@doc """
|
||||
Aborts booting due to a configuration error.
|
||||
"""
|
||||
@spec abort!(String.t()) :: no_return()
|
||||
def abort!(message) do
|
||||
IO.puts("\nERROR!!! [Livebook] " <> message)
|
||||
System.halt(1)
|
||||
|
|
|
@ -357,7 +357,6 @@ defmodule Livebook.Evaluator.IOProxy do
|
|||
end
|
||||
end
|
||||
|
||||
defp binary_to_list(data, _) when is_list(data), do: data
|
||||
defp binary_to_list(data, :unicode) when is_binary(data), do: String.to_charlist(data)
|
||||
defp binary_to_list(data, :latin1) when is_binary(data), do: :erlang.binary_to_list(data)
|
||||
|
||||
|
|
|
@ -160,7 +160,7 @@ defmodule Livebook.FileSystem.File do
|
|||
@doc """
|
||||
Creates the given directory unless it already exists.
|
||||
"""
|
||||
@spec create_dir(t()) :: {:ok, FileSystem.access()} | {:error, FileSystem.error()}
|
||||
@spec create_dir(t()) :: :ok | {:error, FileSystem.error()}
|
||||
def create_dir(file) do
|
||||
FileSystem.create_dir(file.file_system, file.path)
|
||||
end
|
||||
|
|
|
@ -110,7 +110,7 @@ defimpl Livebook.FileSystem, for: Livebook.FileSystem.Local do
|
|||
def remove(_file_system, path) do
|
||||
case File.rm_rf(path) do
|
||||
{:ok, _paths} -> :ok
|
||||
{:error, error} -> FileSystem.Utils.posix_error(error)
|
||||
{:error, error, _paths} -> FileSystem.Utils.posix_error(error)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -105,16 +105,6 @@ defmodule Livebook.Runtime.ErlDist.LoggerGLBackend do
|
|||
info[:dictionary][:"$initial_call"] == {Livebook.Evaluator.IOProxy, :init, 1}
|
||||
end
|
||||
|
||||
defp async_io(name, output) when is_atom(name) do
|
||||
case Process.whereis(name) do
|
||||
device when is_pid(device) ->
|
||||
async_io(device, output)
|
||||
|
||||
nil ->
|
||||
raise "no device registered with the name #{inspect(name)}"
|
||||
end
|
||||
end
|
||||
|
||||
defp async_io(device, output) when is_pid(device) do
|
||||
send(device, {:io_request, self(), make_ref(), {:put_chars, :unicode, output}})
|
||||
end
|
||||
|
|
|
@ -1106,7 +1106,8 @@ defmodule Livebook.Session.Data do
|
|||
|
||||
# Note: the session LV drops cell's source once it's no longer needed
|
||||
new_source =
|
||||
cell.source && JSInterop.apply_delta_to_string(transformed_new_delta, cell.source)
|
||||
Map.get(cell, :source) &&
|
||||
JSInterop.apply_delta_to_string(transformed_new_delta, cell.source)
|
||||
|
||||
data_actions
|
||||
|> set!(notebook: Notebook.update_cell(data.notebook, cell.id, &%{&1 | source: new_source}))
|
||||
|
|
|
@ -41,7 +41,8 @@ defmodule Livebook.Users.User do
|
|||
is returned, where `user` is partially updated by using
|
||||
only the valid attributes.
|
||||
"""
|
||||
@spec change(t(), %{binary() => any()}) :: {:ok, t()} | {:error, list(String.t()), t()}
|
||||
@spec change(t(), %{binary() => any()}) ::
|
||||
{:ok, t()} | {:error, list({atom(), String.t()}), t()}
|
||||
def change(user, attrs \\ %{}) do
|
||||
{user, []}
|
||||
|> change_name(attrs)
|
||||
|
|
|
@ -9,7 +9,7 @@ defmodule Livebook.Runtime.NoopRuntime do
|
|||
def new(), do: %__MODULE__{}
|
||||
|
||||
defimpl Livebook.Runtime do
|
||||
def connect(_), do: :ok
|
||||
def connect(_), do: make_ref()
|
||||
def disconnect(_), do: :ok
|
||||
def evaluate_code(_, _, _, _, _ \\ []), do: :ok
|
||||
def forget_evaluation(_, _), do: :ok
|
||||
|
|
Loading…
Add table
Reference in a new issue