From 60cbd8f8de59cb304c2a94873fd1d76b77425246 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sat, 23 Jan 2021 12:51:41 -0500 Subject: [PATCH] test.py: use py3 by default --- test.py | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/test.py b/test.py index 9edf5dd..048752f 100755 --- a/test.py +++ b/test.py @@ -1,5 +1,4 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 """Test module for quick hacking.""" @@ -10,7 +9,7 @@ from __future__ import print_function # pylint: disable=unused-import import abc, argparse, atexit import base64, binascii -import codecs, collections, contextlib +import codecs, collections, configparser, contextlib import datetime import errno import fcntl, fileinput, fnmatch @@ -21,25 +20,23 @@ import json import logging import multiprocessing import os -import pprint +import pathlib, pprint +from pathlib import Path import re import shlex, shutil, signal, socket, struct, subprocess, sys -import tarfile, tempfile, time, traceback +import tarfile, tempfile, time, traceback, typing +from typing import ( + Any, Callable, Dict, Generator, Iterable, Iterator, List, NamedTuple, + Optional, Set, Tuple, Union, +) import unittest +from unittest import mock -if sys.version_info.major < 3: - import mock -else: - import pathlib - from pathlib import Path - import typing - from typing import ( - Any, Callable, Dict, Generator, Iterable, Iterator, List, NamedTuple, - Optional, Set, Tuple, Union, - ) - from unittest import mock - -import requests + +try: + import requests +except ImportError: + pass import six -- 2.39.5