Changeset 7358:b00b6e273167 in orange


Ignore:
Timestamp:
02/04/11 00:00:00 (3 years ago)
Author:
ales_erjavec <ales.erjavec@…>
Branch:
default
Convert:
2dab6d90e7a50a4f7f836510e0c4b891c369f76e
Message:
  • added diff_texts and warn functions (not present on python 2.6.4 in lib2to3.main)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • orange/orange2to25.py

    r7347 r7358  
    33 
    44from lib2to3 import refactor, main 
    5 from lib2to3.main import diff_texts, StdoutRefactoringTool, warn 
     5from lib2to3.main import StdoutRefactoringTool 
    66 
    77#fixes = refactor.get_fixers_from_package("lib2to3.fixes")     
     
    1010import logging 
    1111import shutil 
     12import difflib 
     13 
     14 
     15def diff_texts(a, b, filename): 
     16    """Return a unified diff of two strings.""" 
     17    a = a.splitlines() 
     18    b = b.splitlines() 
     19    return difflib.unified_diff(a, b, filename, filename, 
     20                                "(original)", "(refactored)", 
     21                                lineterm="") 
     22     
     23def warn(msg): 
     24    print >> sys.stderr, "WARNING: %s" % (msg,) 
    1225 
    1326class MyStdRefactoringTool(StdoutRefactoringTool): 
Note: See TracChangeset for help on using the changeset viewer.