Portable Python script across Python version

Make scripts more future-proof by importing most __future__ stuff.

Differential Revision: https://reviews.llvm.org/D55208

llvm-svn: 349504
This commit is contained in:
Serge Guelton 2018-12-18 16:07:37 +00:00
parent 3ee1ffc9fc
commit b748c0e696
23 changed files with 23 additions and 23 deletions

View File

@ -44,7 +44,7 @@ The major indexing objects are:
Most object information is exposed using properties, when the underlying API
call is efficient.
"""
from __future__ import print_function
from __future__ import absolute_import, division, print_function
# TODO
# ====

View File

@ -11,7 +11,7 @@
# All configuration values have a default; values that are commented out
# serve to show the default.
from __future__ import print_function
from __future__ import absolute_import, division, print_function
import sys, os
from datetime import date

View File

@ -21,7 +21,7 @@ Example usage for git/svn users:
svn diff --diff-cmd=diff -x-U0 | clang-format-diff.py -i
"""
from __future__ import print_function
from __future__ import absolute_import, division, print_function
import argparse
import difflib

View File

@ -12,7 +12,7 @@
# It operates on the current, potentially unsaved buffer and does not create
# or save any files. To revert a formatting, just undo.
from __future__ import print_function
from __future__ import absolute_import, division, print_function
import sublime
import sublime_plugin
import subprocess

View File

@ -25,7 +25,7 @@
#
# It operates on the current, potentially unsaved buffer and does not create
# or save any files. To revert a formatting, just undo.
from __future__ import print_function
from __future__ import absolute_import, division, print_function
import difflib
import json

View File

@ -23,7 +23,7 @@ git clang-format -h
Requires Python 2.7 or Python 3
"""
from __future__ import print_function
from __future__ import absolute_import, division, print_function
import argparse
import collections
import contextlib

View File

@ -22,7 +22,7 @@ you would like to rename and press '<leader>cr'. You will be prompted for a new
name if the cursor points to a valid symbol.
'''
from __future__ import print_function
from __future__ import absolute_import, division, print_function
import vim
import subprocess
import sys

View File

@ -12,7 +12,7 @@ earlier.)
It also implements basic validation methods, related to the command.
Validations are mostly calling specific help methods, or mangling values.
"""
from __future__ import print_function
from __future__ import absolute_import, division, print_function
import os
import sys

View File

@ -1,6 +1,6 @@
#!/usr/bin/env python
from __future__ import print_function
from __future__ import absolute_import, division, print_function
from pprint import pprint
import random, atexit, time
from random import randrange

View File

@ -1,6 +1,6 @@
"""Utilities for enumeration of finite and countably infinite sets.
"""
from __future__ import print_function
from __future__ import absolute_import, division, print_function
###
# Countable iteration

View File

@ -1,5 +1,5 @@
#!/usr/bin/env python
from __future__ import print_function
from __future__ import absolute_import, division, print_function
import sys
from socket import *
from time import strftime

View File

@ -1,6 +1,6 @@
#!/usr/bin/env python
from __future__ import print_function
from __future__ import absolute_import, division, print_function
def pcall(f, N):
if N == 0:
print(' f(0)', file=f)

View File

@ -42,7 +42,7 @@ the Repository Directory.
diff -ur CachedSource PatchedSource \
> changes_for_analyzer.patch
"""
from __future__ import print_function
from __future__ import absolute_import, division, print_function
import SATestBuild
import os

View File

@ -3,7 +3,7 @@
"""
Update reference results for static analyzer.
"""
from __future__ import print_function
from __future__ import absolute_import, division, print_function
import SATestBuild

View File

@ -6,7 +6,7 @@ Script to Summarize statistics in the scan-build output.
Statistics are enabled by passing '-internal-stats' option to scan-build
(or '-analyzer-stats' to the analyzer).
"""
from __future__ import print_function
from __future__ import absolute_import, division, print_function
import sys

View File

@ -47,7 +47,7 @@ To add a new check:
subclass.
"""
from __future__ import print_function
from __future__ import absolute_import, division, print_function
import imp
import os

View File

@ -1,6 +1,6 @@
#!/usr/bin/env python2.7
from __future__ import print_function
from __future__ import absolute_import, division, print_function
import argparse
import difflib

View File

@ -1,7 +1,7 @@
"""For use on Windows. Run with:
python.exe setup.py py2exe
"""
from __future__ import print_function
from __future__ import absolute_import, division, print_function
from distutils.core import setup
try:
import py2exe

View File

@ -9,7 +9,7 @@
# (lldb) command script import /path/to/clandiag.py
#----------------------------------------------------------------------
from __future__ import print_function
from __future__ import absolute_import, division, print_function
import lldb
import argparse
import shlex

View File

@ -1,5 +1,5 @@
#!/usr/bin/env python
from __future__ import print_function
from __future__ import absolute_import, division, print_function
import json
import optparse

View File

@ -4,7 +4,7 @@
# 1) Update the 'decls' list below with your fuzzing configuration.
# 2) Run with the clang binary as the command-line argument.
from __future__ import print_function
from __future__ import absolute_import, division, print_function
import random
import subprocess
import sys

View File

@ -7,7 +7,7 @@
#
#===------------------------------------------------------------------------===#
from __future__ import print_function
from __future__ import absolute_import, division, print_function
import sys
import os

View File

@ -1,6 +1,6 @@
#!/usr/bin/env python
from __future__ import print_function
from __future__ import absolute_import, division, print_function
import os
import re
import subprocess