Show More
@@ -516,9 +516,17 b' def strip_encoding_cookie():' | |||||
516 | while line is not None: |
|
516 | while line is not None: | |
517 | line = (yield line) |
|
517 | line = (yield line) | |
518 |
|
518 | |||
519 |
|
519 | _assign_pat = \ | ||
520 | assign_system_re = re.compile(r'(?P<lhs>(\s*)([\w\.]+)((\s*,\s*[\w\.]+)*))' |
|
520 | r'''(?P<lhs>(\s*) | |
521 | r'\s*=\s*!\s*(?P<cmd>.*)') |
|
521 | ([\w\.]+) # Initial identifier | |
|
522 | (\s*,\s* | |||
|
523 | \*?[\w\.]+)* # Further identifiers for unpacking | |||
|
524 | \s*?,? # Trailing comma | |||
|
525 | ) | |||
|
526 | \s*=\s* | |||
|
527 | ''' | |||
|
528 | ||||
|
529 | assign_system_re = re.compile(r'{}!\s*(?P<cmd>.*)'.format(_assign_pat), re.VERBOSE) | |||
522 | assign_system_template = '%s = get_ipython().getoutput(%r)' |
|
530 | assign_system_template = '%s = get_ipython().getoutput(%r)' | |
523 | @StatelessInputTransformer.wrap |
|
531 | @StatelessInputTransformer.wrap | |
524 | def assign_from_system(line): |
|
532 | def assign_from_system(line): | |
@@ -529,8 +537,7 b' def assign_from_system(line):' | |||||
529 |
|
537 | |||
530 | return assign_system_template % m.group('lhs', 'cmd') |
|
538 | return assign_system_template % m.group('lhs', 'cmd') | |
531 |
|
539 | |||
532 | assign_magic_re = re.compile(r'(?P<lhs>(\s*)([\w\.]+)((\s*,\s*[\w\.]+)*))' |
|
540 | assign_magic_re = re.compile(r'{}%\s*(?P<cmd>.*)'.format(_assign_pat), re.VERBOSE) | |
533 | r'\s*=\s*%\s*(?P<cmd>.*)') |
|
|||
534 | assign_magic_template = '%s = get_ipython().magic(%r)' |
|
541 | assign_magic_template = '%s = get_ipython().magic(%r)' | |
535 | @StatelessInputTransformer.wrap |
|
542 | @StatelessInputTransformer.wrap | |
536 | def assign_from_magic(line): |
|
543 | def assign_from_magic(line): |
General Comments 0
You need to be logged in to leave comments.
Login now