forked from jupyter-xeus/xeus-python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathxinput.hpp
50 lines (40 loc) · 1.46 KB
/
xinput.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/***************************************************************************
* Copyright (c) 2018, Martin Renou, Johan Mabille, Sylvain Corlay, and *
* Wolf Vollprecht *
* Copyright (c) 2018, QuantStack *
* *
* Distributed under the terms of the BSD 3-Clause License. *
* *
* The full license is in the file LICENSE, distributed with this software. *
****************************************************************************/
#ifndef XPYT_INPUT_HPP
#define XPYT_INPUT_HPP
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wattributes"
#endif
#include "pybind11/pybind11.h"
namespace py = pybind11;
namespace xpyt
{
/**
* Input_redirection is a scope guard implementing the redirection of
* input() and getpass() to the frontend through an input_request message.
*
* For Python 2, this also redirects raw_input().
*/
class input_redirection
{
public:
input_redirection(bool allow_stdin);
~input_redirection();
private:
py::object m_sys_input;
py::object m_sys_getpass;
py::object m_sys_raw_input; // Only used for Python 2
};
}
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
#endif