Skip to content

Commit

Permalink
Remove deprecated functions (#386)
Browse files Browse the repository at this point in the history
Remove deprecated APIs
  • Loading branch information
IsabelParedes authored Mar 12, 2024
1 parent 364f0ee commit 522fbb5
Show file tree
Hide file tree
Showing 7 changed files with 156 additions and 169 deletions.
19 changes: 0 additions & 19 deletions include/xeus/xeus_context.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@
namespace xeus
{

struct [[deprecated]] xempty_context_tag
{
};

template <class T>
class xcontext_impl;

Expand Down Expand Up @@ -68,21 +64,6 @@ namespace xeus
return impl->m_context;
}

// Deprecated: call the make_xxx_context function from the library providing the
// server implementation
template <class T, class... U>
std::unique_ptr<xcontext_impl<T>> make_context(U&&... u)
{
return std::unique_ptr<xcontext_impl<T>>(new xcontext_impl<T>(std::forward<U>(u)...));
}

[[deprecated]]
inline std::unique_ptr<xcontext_impl<xempty_context_tag>> make_empty_context()
{
return std::unique_ptr<xcontext_impl<xempty_context_tag>>(
new xcontext_impl<xempty_context_tag>()
);
}
}

#endif
5 changes: 1 addition & 4 deletions include/xeus/xhelper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,7 @@ namespace nl = nlohmann;

namespace xeus
{
XEUS_API std::string get_started_message(const xconfiguration& config);

[[deprecated("Use get_started_message instead")]]
XEUS_API std::string print_starting_message(const xconfiguration& config);
XEUS_API std::string get_starting_message(const xconfiguration& config);

XEUS_API std::string extract_filename(int argc, char* argv[]);

Expand Down
5 changes: 0 additions & 5 deletions include/xeus/xsystem.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@ namespace xeus
XEUS_API
int get_current_pid();

[[deprecated]] XEUS_API
std::string get_cell_tmp_file(const std::string& prefix,
int execution_count,
const std::string& extension);

XEUS_API
std::size_t get_tmp_hash_seed();

Expand Down
5 changes: 0 additions & 5 deletions src/xhelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,6 @@ namespace xeus
return kernel_info;
}

std::string print_starting_message(const xconfiguration& config)
{
return get_starting_message(config);
}

std::string extract_filename(int argc, char* argv[])
{
std::string res = "";
Expand Down
6 changes: 3 additions & 3 deletions test/test_unit_kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@ namespace xeus
{
TEST_SUITE("kernel")
{
TEST_CASE("print_starting_message")
TEST_CASE("get_starting_message")
{
auto context = make_empty_context();
auto context = make_mock_context();

using interpreter_ptr = std::unique_ptr<xmock_interpreter>;
interpreter_ptr interpreter = interpreter_ptr(new xmock_interpreter());
xkernel kernel(get_user_name(),
std::move(context),
std::move(interpreter),
make_mock_server);
std::string kernel_config = print_starting_message(kernel.get_config());
std::string kernel_config = get_starting_message(kernel.get_config());
std::cout << kernel_config << std::endl;
size_t pos = kernel_config.find("Starting kernel...\n"
"\n"
Expand Down
268 changes: 138 additions & 130 deletions test/xmock_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,133 +12,141 @@
namespace xeus
{

xmock_messenger::xmock_messenger(xmock_server* server)
: p_server(server)
{
}

nl::json xmock_messenger::send_to_shell_impl(const nl::json& message)
{
return p_server->notify_internal_listener(message);
}

xmock_server::xmock_server()
: m_messenger(this)
{
}

void xmock_server::receive_shell(xmessage message)
{
m_shell_messages.push(std::move(message));
}

void xmock_server::receive_control(xmessage message)
{
m_control_messages.push(std::move(message));
}

void xmock_server::receive_stdin(xmessage message)
{
m_stdin_messages.push(std::move(message));
}

std::size_t xmock_server::shell_size() const
{
return m_shell_messages.size();
}

xmessage xmock_server::read_shell()
{
return read_impl(m_shell_messages);
}

std::size_t xmock_server::control_size() const
{
return m_control_messages.size();
}

xmessage xmock_server::read_control()
{
return read_impl(m_control_messages);
}

std::size_t xmock_server::stdin_size() const
{
return m_stdin_messages.size();
}

xmessage xmock_server::read_stdin()
{
return read_impl(m_stdin_messages);
}

std::size_t xmock_server::iopub_size() const
{
return m_iopub_messages.size();
}

xpub_message xmock_server::read_iopub()
{
xpub_message res = std::move(m_iopub_messages.back());
m_iopub_messages.pop();
return res;
}

xmessage xmock_server::read_impl(message_queue& q)
{
xmessage res = std::move(q.back());
q.pop();
return res;
}

xcontrol_messenger& xmock_server::get_control_messenger_impl()
{
return m_messenger;
}

void xmock_server::send_shell_impl(xmessage message)
{
m_shell_messages.push(std::move(message));
}

void xmock_server::send_control_impl(xmessage message)
{
m_control_messages.push(std::move(message));
}

void xmock_server::send_stdin_impl(xmessage message)
{
m_stdin_messages.push(std::move(message));
}

void xmock_server::publish_impl(xpub_message message, channel)
{
m_iopub_messages.push(std::move(message));
}

void xmock_server::start_impl(xpub_message message)
{
m_iopub_messages.push(std::move(message));
}

void xmock_server::abort_queue_impl(const listener&, long)
{
}

void xmock_server::stop_impl()
{
}

void xmock_server::update_config_impl(xconfiguration&) const
{
}

std::unique_ptr<xserver> make_mock_server(xcontext&,
const xconfiguration&,
nl::json::error_handler_t)
{
return std::make_unique<xmock_server>();
}

}

xmock_messenger::xmock_messenger(xmock_server* server)
: p_server(server)
{
}

nl::json xmock_messenger::send_to_shell_impl(const nl::json& message)
{
return p_server->notify_internal_listener(message);
}

xmock_server::xmock_server()
: m_messenger(this)
{
}

void xmock_server::receive_shell(xmessage message)
{
m_shell_messages.push(std::move(message));
}

void xmock_server::receive_control(xmessage message)
{
m_control_messages.push(std::move(message));
}

void xmock_server::receive_stdin(xmessage message)
{
m_stdin_messages.push(std::move(message));
}

std::size_t xmock_server::shell_size() const
{
return m_shell_messages.size();
}

xmessage xmock_server::read_shell()
{
return read_impl(m_shell_messages);
}

std::size_t xmock_server::control_size() const
{
return m_control_messages.size();
}

xmessage xmock_server::read_control()
{
return read_impl(m_control_messages);
}

std::size_t xmock_server::stdin_size() const
{
return m_stdin_messages.size();
}

xmessage xmock_server::read_stdin()
{
return read_impl(m_stdin_messages);
}

std::size_t xmock_server::iopub_size() const
{
return m_iopub_messages.size();
}

xpub_message xmock_server::read_iopub()
{
xpub_message res = std::move(m_iopub_messages.back());
m_iopub_messages.pop();
return res;
}

xmessage xmock_server::read_impl(message_queue& q)
{
xmessage res = std::move(q.back());
q.pop();
return res;
}

xcontrol_messenger& xmock_server::get_control_messenger_impl()
{
return m_messenger;
}

void xmock_server::send_shell_impl(xmessage message)
{
m_shell_messages.push(std::move(message));
}

void xmock_server::send_control_impl(xmessage message)
{
m_control_messages.push(std::move(message));
}

void xmock_server::send_stdin_impl(xmessage message)
{
m_stdin_messages.push(std::move(message));
}

void xmock_server::publish_impl(xpub_message message, channel)
{
m_iopub_messages.push(std::move(message));
}

void xmock_server::start_impl(xpub_message message)
{
m_iopub_messages.push(std::move(message));
}

void xmock_server::abort_queue_impl(const listener&, long)
{
}

void xmock_server::stop_impl()
{
}

void xmock_server::update_config_impl(xconfiguration&) const
{
}

std::unique_ptr<xserver> make_mock_server(xcontext&,
const xconfiguration&,
nl::json::error_handler_t)
{
return std::make_unique<xmock_server>();
}

xmock_context::xmock_context() : xcontext()
{
}

std::unique_ptr<xcontext> make_mock_context()
{
return std::make_unique<xmock_context>();
}

} // namespace xeus
Loading

0 comments on commit 522fbb5

Please sign in to comment.