Show More
@@ -6,7 +6,7 b' Requires Python 2.3 or newer.' | |||
|
6 | 6 | |
|
7 | 7 | This file contains all the classes and helper functions specific to IPython. |
|
8 | 8 | |
|
9 |
$Id: iplib.py 11 |
|
|
9 | $Id: iplib.py 1111 2006-01-30 21:16:07Z vivainio $ | |
|
10 | 10 | """ |
|
11 | 11 | |
|
12 | 12 | #***************************************************************************** |
@@ -661,7 +661,7 b' class InteractiveShell(object,Magic):' | |||
|
661 | 661 | reference to IPython itself.""" |
|
662 | 662 | |
|
663 | 663 | # TODO: deprecate all except _ip; 'jobs' should be installed |
|
664 | # by an extension and the rest are under _ip | |
|
664 | # by an extension and the rest are under _ip, ipalias is redundant | |
|
665 | 665 | builtins_new = dict(__IPYTHON__ = self, |
|
666 | 666 | ip_set_hook = self.set_hook, |
|
667 | 667 | jobs = self.jobs, |
@@ -1500,14 +1500,10 b' want to merge them back into the new files.""" % locals()' | |||
|
1500 | 1500 | if self.InteractiveTB.call_pdb and self.has_readline: |
|
1501 | 1501 | self.readline.set_completer(self.Completer.complete) |
|
1502 | 1502 | |
|
1503 |
def |
|
|
1504 | """Call an alias given its name and the rest of the line. | |
|
1503 | def transform_alias(self, alias,rest=''): | |
|
1504 | """ Transform alias to system command string | |
|
1505 | 1505 | |
|
1506 | This function MUST be given a proper alias, because it doesn't make | |
|
1507 | any checks when looking up into the alias table. The caller is | |
|
1508 | responsible for invoking it only with a valid alias.""" | |
|
1509 | ||
|
1510 | #print 'ALIAS: <%s>+<%s>' % (alias,rest) # dbg | |
|
1506 | """ | |
|
1511 | 1507 | nargs,cmd = self.alias_table[alias] |
|
1512 | 1508 | # Expand the %l special to be the user's input line |
|
1513 | 1509 | if cmd.find('%l') >= 0: |
@@ -1522,9 +1518,20 b' want to merge them back into the new files.""" % locals()' | |||
|
1522 | 1518 | if len(args)< nargs: |
|
1523 | 1519 | error('Alias <%s> requires %s arguments, %s given.' % |
|
1524 | 1520 | (alias,nargs,len(args))) |
|
1525 | return | |
|
1521 | return None | |
|
1526 | 1522 | cmd = '%s %s' % (cmd % tuple(args[:nargs]),' '.join(args[nargs:])) |
|
1527 | 1523 | # Now call the macro, evaluating in the user's namespace |
|
1524 | ||
|
1525 | return cmd | |
|
1526 | ||
|
1527 | def call_alias(self,alias,rest=''): | |
|
1528 | """Call an alias given its name and the rest of the line. | |
|
1529 | ||
|
1530 | This is only used to provide backwards compatibility for users of | |
|
1531 | ipalias(), use of which is not recommended for anymore.""" | |
|
1532 | ||
|
1533 | # Now call the macro, evaluating in the user's namespace | |
|
1534 | cmd = self.transform_alias(alias, rest) | |
|
1528 | 1535 | try: |
|
1529 | 1536 | self.system(cmd) |
|
1530 | 1537 | except: |
@@ -1959,7 +1966,8 b' want to merge them back into the new files.""" % locals()' | |||
|
1959 | 1966 | |
|
1960 | 1967 | # pre is needed, because it carries the leading whitespace. Otherwise |
|
1961 | 1968 | # aliases won't work in indented sections. |
|
1962 | line_out = '%sipalias(%s)' % (pre,make_quoted_expr(iFun + " " + theRest)) | |
|
1969 | transformed = self.transform_alias(iFun, theRest) | |
|
1970 | line_out = '%s_ip.system(%s)' % (pre, make_quoted_expr( transformed )) | |
|
1963 | 1971 | self.log(line_out,continue_prompt) |
|
1964 | 1972 | return line_out |
|
1965 | 1973 |
@@ -6,7 +6,7 b' Requires Python 2.1 or better.' | |||
|
6 | 6 | |
|
7 | 7 | This file contains the main make_IPython() starter function. |
|
8 | 8 | |
|
9 |
$Id: ipmaker.py 1 |
|
|
9 | $Id: ipmaker.py 1111 2006-01-30 21:16:07Z vivainio $""" | |
|
10 | 10 | |
|
11 | 11 | #***************************************************************************** |
|
12 | 12 | # Copyright (C) 2001-2006 Fernando Perez. <fperez@colorado.edu> |
@@ -562,8 +562,6 b" object? -> Details about 'object'. ?object also works, ?? prints more." | |||
|
562 | 562 | print 'loaded first).\n' |
|
563 | 563 | pprint(IP_rc.__dict__) |
|
564 | 564 | |
|
565 | # Make it easy to import extensions | |
|
566 | sys.path.append(os.path.join(IPython_dir,"Extensions")) | |
|
567 | 565 | for mod in IP_rc.import_mod: |
|
568 | 566 | try: |
|
569 | 567 | exec 'import '+mod in IP.user_ns |
@@ -17,6 +17,9 b'' | |||
|
17 | 17 | IPython-specific import. Extensions added to pythonpath right |
|
18 | 18 | at __init__. |
|
19 | 19 | |
|
20 | * iplib.py: ipalias deprecated/redundant; aliases are converted and | |
|
21 | called with _ip.system and the pre-transformed command string. | |
|
22 | ||
|
20 | 23 | 2006-01-29 Fernando Perez <Fernando.Perez@colorado.edu> |
|
21 | 24 | |
|
22 | 25 | * IPython/iplib.py (interact): Fix that we were not catching |
General Comments 0
You need to be logged in to leave comments.
Login now