Opened 4 years ago

Last modified 4 years ago

#25522 needs_review enhancement

IPython cell magic %%no_preparse that disables the Sage preparser

Reported by: Bryan Gin-ge Chen Owned by:
Priority: minor Milestone: sage-8.4
Component: user interface Keywords: ipython magic
Cc: Nils Bruin Merged in:
Authors: Bryan Gin-ge Chen Reviewers:
Report Upstream: N/A Work issues:
Branch: u/gh-bryangingechen/nopreparse (Commits, GitHub, GitLab) Commit: b231bca998b28232cb13e0310fa1d899cb2a74a0
Dependencies: Stopgaps:

Status badges

Description

I'm opening this ticket because of nbruin's suggestion for my answer https://ask.sagemath.org/question/9277/preparser-state-for-regexs/?answer=42530#post-id-42530

There I shared code for an IPython extension which registers a cell magic which disables the Sage preparser (by toggling the state of the global variable sage.repl.interpreter._do_preparse before and after running the cell).

Change History (7)

comment:1 Changed 4 years ago by Bryan Gin-ge Chen

Before I create a branch, I'd like to get feedback on the following:

Does the name %%noparse work, or should I change it to something else?

I was thinking of adding the magic to the end of the class SageMagics? in sage/repl/ipython_extension.py . Any objections?

Anything else for a first-time contributor to keep in mind?

comment:2 Changed 4 years ago by Bryan Gin-ge Chen

Branch: u/gh-bryangingechen/nopreparse
Commit: 773be9ef2fc37d717f011ad66110db795881e3ec
Status: newneeds_review

I decided to use the name %%nopreparse instead.


New commits:

773be9eAdd %%nopreparse cell magic

comment:3 Changed 4 years ago by git

Commit: 773be9ef2fc37d717f011ad66110db795881e3ec3f959f448aa7173b2caee45ad19a4c4f75875b11

Branch pushed to git repo; I updated commit sha1. New commits:

3f959f4Rename to no_preparse

comment:4 Changed 4 years ago by git

Commit: 3f959f448aa7173b2caee45ad19a4c4f75875b11b231bca998b28232cb13e0310fa1d899cb2a74a0

Branch pushed to git repo; I updated commit sha1. New commits:

b231bcaremove trailing whitespace

comment:5 Changed 4 years ago by Bryan Gin-ge Chen

Summary: ipython cell magic to disable preparserIPython cell magic %%no_preparse that disables the Sage preparser

no_preparse seems to be more in line with the accepted Python code style.

comment:6 Changed 4 years ago by Bryan Gin-ge Chen

Authors: gh-bryangingechenBryan Gin-ge Chen

comment:7 Changed 4 years ago by Bryan Gin-ge Chen

Component: notebookuser interface
Keywords: ipython magic added
Milestone: sage-8.3sage-8.4

patchbot failures seem unrelated

Note: See TracTickets for help on using tickets.