コード例 #1
0
ファイル: setup.py プロジェクト: clarete/milieu
 def run(self):
     if not any([self.patch, self.minor, self.major]):
         print '>> Nothing to do'
     else:
         driver = lib2to3.pgen2.driver.Driver(
             lib2to3.pygram.python_grammar,
             convert=lib2to3.pytree.convert)
         refactor = lib2to3.refactor.RefactoringTool(
             ['setup'], {'command': self})
         parsed = driver.parse_string(local_file(PACKAGE, 'version.py'))
         refactor.refactor_tree(parsed, 'version')
         io.open(local_path(PACKAGE, 'version.py'), 'w').write(unicode(parsed))
         self.git_commit()
コード例 #2
0
ファイル: flake8.py プロジェクト: jayvdb/ebb-lint
def parse_source(driver, source):
    trailing_newline = not source or source.endswith('\n')
    # Thanks for this, lib2to3.
    if not trailing_newline:
        source += '\n'
    return driver.parse_string(source), trailing_newline
コード例 #3
0
def parse_source(driver, source):
    trailing_newline = not source or source.endswith('\n')
    # Thanks for this, lib2to3.
    if not trailing_newline:
        source += '\n'
    return driver.parse_string(source), trailing_newline
コード例 #4
0
ファイル: support.py プロジェクト: 2uller/LotF
def parse_string(string):
    return driver.parse_string(reformat(string), debug=True)
コード例 #5
0
def parse_string(string):
    return driver.parse_string(reformat(string), debug=True)