%q cell magic
Is your feature request related to a problem? Please describe. Hi, no problem related. Pyq had the functionality of both cell and line magics which was useful to explore tables.
Describe the solution you'd like Adding the functionality
Describe alternatives you've considered
I changed locally my nbextension.py file to support it.
def q_line(code):
return q("", code + "\n")
def load_ipython_extension(ipython):
ipython.register_magic_function(q, "cell")
ipython.register_magic_function(q_line, "line", "q")
Second version, more clean but changes q function:
if code is None, it means line magic. We need to patch code and instructions to execute correctly.
def q(instructions,code=None):
if code == None:
code = instructions + "\n"
instructions = ""
...
def load_ipython_extension(ipython):
ipython.register_magic_function(q, "both")
Additional resource https://ipython.readthedocs.io/en/stable/api/generated/IPython.core.interactiveshell.html#IPython.core.interactiveshell.InteractiveShell.register_magic_function https://github.com/KxSystems/pyq/blob/8c31f19e6ee8970d5b4146c5593cb1ed174e1385/src/pyq/magic.py#L47