sagemath / sage

Main repository of SageMath
https://www.sagemath.org
Other
1.33k stars 453 forks source link

IPython cell magic %%no_preparse that disables the Sage preparser #25522

Open b0bf1a7b-bfe9-44fe-8236-57b33990cc18 opened 6 years ago

b0bf1a7b-bfe9-44fe-8236-57b33990cc18 commented 6 years ago

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).

CC: @nbruin

Component: user interface

Keywords: ipython magic

Author: Bryan Gin-ge Chen

Branch/Commit: u/gh-bryangingechen/nopreparse @ b231bca

Issue created by migration from https://trac.sagemath.org/ticket/25522

b0bf1a7b-bfe9-44fe-8236-57b33990cc18 commented 6 years ago
comment:1

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?

b0bf1a7b-bfe9-44fe-8236-57b33990cc18 commented 6 years ago
comment:2

I decided to use the name %%nopreparse instead.


New commits:

773be9eAdd %%nopreparse cell magic
b0bf1a7b-bfe9-44fe-8236-57b33990cc18 commented 6 years ago

Branch: u/gh-bryangingechen/nopreparse

b0bf1a7b-bfe9-44fe-8236-57b33990cc18 commented 6 years ago

Commit: 773be9e

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 6 years ago

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

3f959f4Rename to no_preparse
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 6 years ago

Changed commit from 773be9e to 3f959f4

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 6 years ago

Changed commit from 3f959f4 to b231bca

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 6 years ago

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

b231bcaremove trailing whitespace
b0bf1a7b-bfe9-44fe-8236-57b33990cc18 commented 6 years ago
comment:5

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

b0bf1a7b-bfe9-44fe-8236-57b33990cc18 commented 6 years ago

Changed author from gh-bryangingechen to Bryan Gin-ge Chen

b0bf1a7b-bfe9-44fe-8236-57b33990cc18 commented 6 years ago
comment:7

patchbot failures seem unrelated

b0bf1a7b-bfe9-44fe-8236-57b33990cc18 commented 6 years ago

Changed keywords from none to ipython magic