Alright, here is my first open-source project patch: http://www.math.uiuc.edu/~rkirov2/sage/11803.patch
The description in the patch file is short because vi is driving me insane. I was going to add a better description in the .patch file with gedit but wasn't sure if it is checksumed. Here is more detailed description of what the patch does: - for sage prompt, I added attached_files to the imported functions in sage.misc.all - for sage prompt, I added detach magic word (to mirror the build-in behaviour in the notebook). - for notebook attach and load, I used shlex.split (shlex is a standard python library for shell commands), instead of regular split. This makes sure that if your file has spacebars you can still call it as long as it is enclosed by double-quotation marks i.e. "file1". - for notebook detach, there was a simple bug (I must be the first one to use it), where variable "filename" was referenced before being defined. - for notebook I exposed the build in function "attached_files()", by adding it the preparser. This is a bit hacky, since it makes it look like a function but it is not. Things like "detach attached_files() [0]" won't work in notebook. One thing worth mentioning is that in sage prompt, load and attach cannot work with multiple files like in notebook. I figured that ideally the prompt preparser should be unified with the notebook one (the notebook code for loading and attaching is quite different), which is a bigger project and should be well-thought out first. Rado On Apr 25, 7:50 pm, William Stein <wst...@gmail.com> wrote: > On Sat, Apr 25, 2009 at 4:30 PM, Rado <rki...@gmail.com> wrote: > > > Sweet, I will give it a shot. > > > One last thing I noticed is that attached_files() is not exposed to > > the user. Again not sure if this is how its supposed to work or an > > actual bug. But if one can attach without refering to a library it > > would make sense to see what is currently attached again without extra > > work. Or at least the doc should be clearer on this. Here is what I > > mean: > > > in command line: > > sage:attach test.py > > sage:attached_files() <---- fail, NameError: name 'attach_files' is > > not defined > > sage:sage.misc.interpreter.attached_files() <----works > > > in notebook: > > sage:attach test.py > > sage:attached_files() <---- fail, AttributeError: 'module' object has > > no attribute 'attached_files' > > sage:w.attached_files() <--- this should work theoretically, once I > > figure out how to get a hold of the current worksheet and assign it to > > w. Any ideas? > > attached_files *used* to be available on the command line. Somebody > must have removed it. > Just add importing it back in misc/all_cmdline.py. For the > notebook, the function > sage.misc.interpreter.attached_files() > actually does *not* give the attached files, so don't add it to > all_notebook.py, unless it is fixed > to give the attached files. > > William --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to sage-devel-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---