Input buildinfo: https://buildinfos.debian.net/buildinfo-pool/p/python-dsv/python-dsv_1.4.1-11_all.buildinfo Use metasnap for getting required timestamps New buildinfo file: /tmp/python-dsv-1.4.1-11lmr82cqs/python-dsv_1.4.1-11_all.buildinfo Get source package info: python-dsv=1.4.1-11 Source URL: http://snapshot.notset.fr/mr/package/python-dsv/1.4.1-11/srcfiles?fileinfo=1 env -i PATH=/usr/sbin:/usr/bin:/sbin:/bin TMPDIR=/tmp mmdebstrap --arch=amd64 --include=2to3=3.9.1-1 autoconf=2.69-14 automake=1:1.16.3-2 autopoint=0.21-4 autotools-dev=20180224.1+nmu1 base-files=11 base-passwd=3.5.49 bash=5.1-2 binutils=2.35.1-7 binutils-common=2.35.1-7 binutils-x86-64-linux-gnu=2.35.1-7 bsdextrautils=2.36.1-7 bsdutils=1:2.36.1-7 build-essential=12.9 bzip2=1.0.8-4 coreutils=8.32-4+b1 cpp=4:10.2.1-1 cpp-10=10.2.1-6 dash=0.5.11+git20200708+dd9ef66-5 debconf=1.5.74 debhelper=13.3.3 debianutils=4.11.2 dh-autoreconf=20 dh-python=4.20201102 dh-strip-nondeterminism=1.11.0-1 diffutils=1:3.7-5 dpkg=1.20.7.1 dpkg-dev=1.20.7.1 dwz=0.13+20210201-1 file=1:5.39-3 findutils=4.8.0-1 g++=4:10.2.1-1 g++-10=10.2.1-6 gcc=4:10.2.1-1 gcc-10=10.2.1-6 gcc-10-base=10.2.1-6 gettext=0.21-4 gettext-base=0.21-4 grep=3.6-1 groff-base=1.22.4-6 gzip=1.10-2 hostname=3.23 init-system-helpers=1.60 intltool-debian=0.35.0+20060710.5 libacl1=2.2.53-10 libarchive-zip-perl=1.68-1 libasan6=10.2.1-6 libatomic1=10.2.1-6 libattr1=1:2.4.48-6 libaudit-common=1:3.0-2 libaudit1=1:3.0-2 libbinutils=2.35.1-7 libblkid1=2.36.1-7 libbz2-1.0=1.0.8-4 libc-bin=2.31-9 libc-dev-bin=2.31-9 libc6=2.31-9 libc6-dev=2.31-9 libcap-ng0=0.7.9-2.2+b1 libcc1-0=10.2.1-6 libcom-err2=1.45.7-1 libcrypt-dev=1:4.4.17-1 libcrypt1=1:4.4.17-1 libctf-nobfd0=2.35.1-7 libctf0=2.35.1-7 libdb5.3=5.3.28+dfsg1-0.8 libdebconfclient0=0.256 libdebhelper-perl=13.3.3 libdpkg-perl=1.20.7.1 libelf1=0.183-1 libexpat1=2.2.10-1 libffi7=3.3-5 libfile-stripnondeterminism-perl=1.11.0-1 libgcc-10-dev=10.2.1-6 libgcc-s1=10.2.1-6 libgcrypt20=1.8.7-2 libgdbm-compat4=1.19-2 libgdbm6=1.19-2 libgmp10=2:6.2.1+dfsg-1 libgomp1=10.2.1-6 libgpg-error0=1.38-2 libgssapi-krb5-2=1.18.3-4 libicu67=67.1-6 libisl23=0.23-1 libitm1=10.2.1-6 libk5crypto3=1.18.3-4 libkeyutils1=1.6.1-2 libkrb5-3=1.18.3-4 libkrb5support0=1.18.3-4 liblsan0=10.2.1-6 liblz4-1=1.9.3-1 liblzma5=5.2.5-1.0 libmagic-mgc=1:5.39-3 libmagic1=1:5.39-3 libmount1=2.36.1-7 libmpc3=1.2.0-1 libmpdec3=2.5.1-1 libmpfr6=4.1.0-3 libncursesw6=6.2+20201114-2 libnsl-dev=1.3.0-2 libnsl2=1.3.0-2 libpam-modules=1.4.0-4 libpam-modules-bin=1.4.0-4 libpam-runtime=1.4.0-4 libpam0g=1.4.0-4 libpcre2-8-0=10.36-2 libpcre3=2:8.39-13 libperl5.32=5.32.1-2 libpipeline1=1.5.3-1 libpython3-stdlib=3.9.1-1 libpython3.9-minimal=3.9.1-4 libpython3.9-stdlib=3.9.1-4 libquadmath0=10.2.1-6 libreadline8=8.1-1 libseccomp2=2.5.1-1 libselinux1=3.1-2+b2 libsigsegv2=2.13-1 libsmartcols1=2.36.1-7 libsqlite3-0=3.34.1-1 libssl1.1=1.1.1i-3 libstdc++-10-dev=10.2.1-6 libstdc++6=10.2.1-6 libsub-override-perl=0.09-2 libsystemd0=247.3-1 libtinfo6=6.2+20201114-2 libtirpc-common=1.3.1-1 libtirpc-dev=1.3.1-1 libtirpc3=1.3.1-1 libtool=2.4.6-15 libtsan0=10.2.1-6 libubsan1=10.2.1-6 libuchardet0=0.0.7-1 libudev1=247.3-1 libunistring2=0.9.10-4 libuuid1=2.36.1-7 libxml2=2.9.10+dfsg-6.3+b1 libzstd1=1.4.8+dfsg-1 linux-libc-dev=5.10.13-1 login=1:4.8.1-1 lsb-base=11.1.0 m4=1.4.18-5 make=4.3-4 man-db=2.9.4-1 mawk=1.3.4.20200120-2 media-types=4.0.0 ncurses-base=6.2+20201114-2 ncurses-bin=6.2+20201114-2 patch=2.7.6-7 perl=5.32.1-2 perl-base=5.32.1-2 perl-modules-5.32=5.32.1-2 po-debconf=1.0.21+nmu1 python3=3.9.1-1 python3-all=3.9.1-1 python3-distutils=3.9.1-2 python3-lib2to3=3.9.1-2 python3-minimal=3.9.1-1 python3-pkg-resources=52.0.0-1 python3-setuptools=52.0.0-1 python3.9=3.9.1-4 python3.9-minimal=3.9.1-4 readline-common=8.1-1 sed=4.7-1 sensible-utils=0.0.14 sysvinit-utils=2.96-5 tar=1.32+dfsg-1 tzdata=2021a-1 util-linux=2.36.1-7 xz-utils=5.2.5-1.0 zlib1g=1:1.2.11.dfsg-2 --variant=apt --aptopt=Acquire::Check-Valid-Until "false" --aptopt=Acquire::http::Dl-Limit "1000"; --aptopt=Acquire::https::Dl-Limit "1000"; --aptopt=Acquire::Retries "5"; --aptopt=APT::Get::allow-downgrades "true"; --keyring=/usr/share/keyrings/ --essential-hook=chroot "$1" sh -c "apt-get --yes install fakeroot util-linux" --essential-hook=copy-in /usr/share/keyrings/debian-archive-bullseye-automatic.gpg /usr/share/keyrings/debian-archive-bullseye-security-automatic.gpg /usr/share/keyrings/debian-archive-bullseye-stable.gpg /usr/share/keyrings/debian-archive-buster-automatic.gpg /usr/share/keyrings/debian-archive-buster-security-automatic.gpg /usr/share/keyrings/debian-archive-buster-stable.gpg /usr/share/keyrings/debian-archive-keyring.gpg /usr/share/keyrings/debian-archive-removed-keys.gpg /usr/share/keyrings/debian-archive-stretch-automatic.gpg /usr/share/keyrings/debian-archive-stretch-security-automatic.gpg /usr/share/keyrings/debian-archive-stretch-stable.gpg /usr/share/keyrings/debian-ports-archive-keyring-removed.gpg /usr/share/keyrings/debian-ports-archive-keyring.gpg /usr/share/keyrings/debian-keyring.gpg /etc/apt/trusted.gpg.d/ --essential-hook=chroot "$1" sh -c "rm /etc/apt/sources.list && echo 'deb http://snapshot.notset.fr/archive/debian/20210814T212851Z/ bookworm main deb-src http://snapshot.notset.fr/archive/debian/20210814T212851Z/ bookworm main deb http://snapshot.notset.fr/archive/debian/20210209T091207Z/ unstable main' >> /etc/apt/sources.list && apt-get update" --customize-hook=chroot "$1" useradd --no-create-home -d /nonexistent -p "" builduser -s /bin/bash --customize-hook=chroot "$1" env sh -c "apt-get source --only-source -d python-dsv=1.4.1-11 && mkdir -p /build/python-dsv-POyYa1 && dpkg-source --no-check -x /*.dsc /build/python-dsv-POyYa1/python-dsv-1.4.1 && chown -R builduser:builduser /build/python-dsv-POyYa1" --customize-hook=chroot "$1" env --unset=TMPDIR runuser builduser -c "cd /build/python-dsv-POyYa1/python-dsv-1.4.1 && env DEB_BUILD_OPTIONS="parallel=4" LC_ALL="C.UTF-8" SOURCE_DATE_EPOCH="1612926595" dpkg-buildpackage -uc -a amd64 --build=all" --customize-hook=sync-out /build/python-dsv-POyYa1 /tmp/python-dsv-1.4.1-11lmr82cqs bullseye /dev/null deb http://snapshot.notset.fr/archive/debian/20210209T091207Z unstable main I: automatically chosen mode: root I: chroot architecture amd64 is equal to the host's architecture I: automatically chosen format: tar I: using /tmp/mmdebstrap.kQDRUVJTfg as tempdir I: running apt-get update... I: downloading packages with apt... I: extracting archives... I: installing essential packages... I: running --essential-hook in shell: sh -c 'chroot "$1" sh -c "apt-get --yes install fakeroot util-linux"' exec /tmp/mmdebstrap.kQDRUVJTfg Reading package lists... Building dependency tree... util-linux is already the newest version (2.36.1-7). The following NEW packages will be installed: fakeroot libfakeroot 0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. Need to get 134 kB of archives. After this operation, 397 kB of additional disk space will be used. Get:1 http://snapshot.notset.fr/archive/debian/20210209T091207Z unstable/main amd64 libfakeroot amd64 1.25.3-1.1 [47.0 kB] Get:2 http://snapshot.notset.fr/archive/debian/20210209T091207Z unstable/main amd64 fakeroot amd64 1.25.3-1.1 [87.0 kB] debconf: delaying package configuration, since apt-utils is not installed Fetched 134 kB in 0s (950 kB/s) Selecting previously unselected package libfakeroot:amd64. (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 4663 files and directories currently installed.) Preparing to unpack .../libfakeroot_1.25.3-1.1_amd64.deb ... Unpacking libfakeroot:amd64 (1.25.3-1.1) ... Selecting previously unselected package fakeroot. Preparing to unpack .../fakeroot_1.25.3-1.1_amd64.deb ... Unpacking fakeroot (1.25.3-1.1) ... Setting up libfakeroot:amd64 (1.25.3-1.1) ... Setting up fakeroot (1.25.3-1.1) ... update-alternatives: using /usr/bin/fakeroot-sysv to provide /usr/bin/fakeroot (fakeroot) in auto mode Processing triggers for libc-bin (2.31-9) ... I: running special hook: copy-in /usr/share/keyrings/debian-archive-bullseye-automatic.gpg /usr/share/keyrings/debian-archive-bullseye-security-automatic.gpg /usr/share/keyrings/debian-archive-bullseye-stable.gpg /usr/share/keyrings/debian-archive-buster-automatic.gpg /usr/share/keyrings/debian-archive-buster-security-automatic.gpg /usr/share/keyrings/debian-archive-buster-stable.gpg /usr/share/keyrings/debian-archive-keyring.gpg /usr/share/keyrings/debian-archive-removed-keys.gpg /usr/share/keyrings/debian-archive-stretch-automatic.gpg /usr/share/keyrings/debian-archive-stretch-security-automatic.gpg /usr/share/keyrings/debian-archive-stretch-stable.gpg /usr/share/keyrings/debian-ports-archive-keyring-removed.gpg /usr/share/keyrings/debian-ports-archive-keyring.gpg /usr/share/keyrings/debian-keyring.gpg /etc/apt/trusted.gpg.d/ I: running --essential-hook in shell: sh -c 'chroot "$1" sh -c "rm /etc/apt/sources.list && echo 'deb http://snapshot.notset.fr/archive/debian/20210814T212851Z/ bookworm main deb-src http://snapshot.notset.fr/archive/debian/20210814T212851Z/ bookworm main deb http://snapshot.notset.fr/archive/debian/20210209T091207Z/ unstable main' >> /etc/apt/sources.list && apt-get update"' exec /tmp/mmdebstrap.kQDRUVJTfg Get:1 http://snapshot.notset.fr/archive/debian/20210814T212851Z bookworm InRelease [81.6 kB] Hit:2 http://snapshot.notset.fr/archive/debian/20210209T091207Z unstable InRelease Ign:3 http://snapshot.notset.fr/archive/debian/20210814T212851Z bookworm/main Sources Ign:4 http://snapshot.notset.fr/archive/debian/20210814T212851Z bookworm/main amd64 Packages Ign:3 http://snapshot.notset.fr/archive/debian/20210814T212851Z bookworm/main Sources Ign:4 http://snapshot.notset.fr/archive/debian/20210814T212851Z bookworm/main amd64 Packages Ign:3 http://snapshot.notset.fr/archive/debian/20210814T212851Z bookworm/main Sources Ign:4 http://snapshot.notset.fr/archive/debian/20210814T212851Z bookworm/main amd64 Packages Get:3 http://snapshot.notset.fr/archive/debian/20210814T212851Z bookworm/main Sources [11.4 MB] Get:4 http://snapshot.notset.fr/archive/debian/20210814T212851Z bookworm/main amd64 Packages [11.1 MB] Fetched 22.6 MB in 21s (1066 kB/s) Reading package lists... I: installing remaining packages inside the chroot... I: running --customize-hook in shell: sh -c 'chroot "$1" useradd --no-create-home -d /nonexistent -p "" builduser -s /bin/bash' exec /tmp/mmdebstrap.kQDRUVJTfg I: running --customize-hook in shell: sh -c 'chroot "$1" env sh -c "apt-get source --only-source -d python-dsv=1.4.1-11 && mkdir -p /build/python-dsv-POyYa1 && dpkg-source --no-check -x /*.dsc /build/python-dsv-POyYa1/python-dsv-1.4.1 && chown -R builduser:builduser /build/python-dsv-POyYa1"' exec /tmp/mmdebstrap.kQDRUVJTfg Reading package lists... NOTICE: 'python-dsv' packaging is maintained in the 'Git' version control system at: https://salsa.debian.org/python-team/packages/python-dsv.git Please use: git clone https://salsa.debian.org/python-team/packages/python-dsv.git to retrieve the latest (possibly unreleased) updates to the package. Need to get 27.2 kB of source archives. Get:1 http://snapshot.notset.fr/archive/debian/20210814T212851Z bookworm/main python-dsv 1.4.1-11 (dsc) [2141 B] Get:2 http://snapshot.notset.fr/archive/debian/20210814T212851Z bookworm/main python-dsv 1.4.1-11 (tar) [14.7 kB] Get:3 http://snapshot.notset.fr/archive/debian/20210814T212851Z bookworm/main python-dsv 1.4.1-11 (diff) [10.4 kB] Fetched 27.2 kB in 0s (204 kB/s) Download complete and in download only mode W: Download is performed unsandboxed as root as file 'python-dsv_1.4.1-11.dsc' couldn't be accessed by user '_apt'. - pkgAcquire::Run (13: Permission denied) dpkg-source: info: extracting python-dsv in /build/python-dsv-POyYa1/python-dsv-1.4.1 dpkg-source: info: unpacking python-dsv_1.4.1.orig.tar.gz dpkg-source: info: unpacking python-dsv_1.4.1-11.debian.tar.xz dpkg-source: info: using patch list from debian/patches/series dpkg-source: info: applying 01-leave-env-alone.patch dpkg-source: info: applying 02-wx-namespace-transition.patch dpkg-source: info: applying 03-avoid-unicoditis.patch dpkg-source: info: applying 04-wx3.0-compat.patch dpkg-source: info: applying 05-no-import-exceptions.patch I: running --customize-hook in shell: sh -c 'chroot "$1" env --unset=TMPDIR runuser builduser -c "cd /build/python-dsv-POyYa1/python-dsv-1.4.1 && env DEB_BUILD_OPTIONS="parallel=4" LC_ALL="C.UTF-8" SOURCE_DATE_EPOCH="1612926595" dpkg-buildpackage -uc -a amd64 --build=all"' exec /tmp/mmdebstrap.kQDRUVJTfg dpkg-buildpackage: info: source package python-dsv dpkg-buildpackage: info: source version 1.4.1-11 dpkg-buildpackage: info: source distribution unstable dpkg-buildpackage: info: source changed by Aaron M. Ucko dpkg-source --before-build . debian/rules clean dh clean --with python3 --buildsystem=pybuild debian/rules override_dh_auto_clean make[1]: Entering directory '/build/python-dsv-POyYa1/python-dsv-1.4.1' [ ! -f DSV/DSV.py.bak ] || mv -v DSV/DSV.py.bak DSV/DSV.py dh_auto_clean I: pybuild base:232: python3.9 setup.py clean running clean removing '/build/python-dsv-POyYa1/python-dsv-1.4.1/.pybuild/cpython3_3.9_dsv/build' (and everything under it) 'build/bdist.linux-x86_64' does not exist -- can't clean it 'build/scripts-3.9' does not exist -- can't clean it make[1]: Leaving directory '/build/python-dsv-POyYa1/python-dsv-1.4.1' dh_autoreconf_clean -O--buildsystem=pybuild dh_clean -O--buildsystem=pybuild debian/rules binary-indep dh binary-indep --with python3 --buildsystem=pybuild dh_update_autotools_config -i -O--buildsystem=pybuild dh_autoreconf -i -O--buildsystem=pybuild dh_auto_configure -i -O--buildsystem=pybuild I: pybuild base:232: python3.9 setup.py config running config dh_auto_build -i -O--buildsystem=pybuild I: pybuild pybuild:284: 2to3 -w DSV/DSV.py RefactoringTool: Skipping optional fixer: buffer RefactoringTool: Skipping optional fixer: idioms RefactoringTool: Skipping optional fixer: set_literal RefactoringTool: Skipping optional fixer: ws_comma RefactoringTool: Refactored DSV/DSV.py --- DSV/DSV.py (original) +++ DSV/DSV.py (refactored) @@ -129,6 +129,7 @@ import re import copy import string +from functools import reduce ## RedHat 8.0 (or rather GTK2?) sets LANG = en_us.UTF-8 and apparently some ## older apps (including wxGTK) can't handle this. The fix is to set LANG=C ## before running the app. Thanks to Ahmad Baitalmal for supplying this info. @@ -146,10 +147,10 @@ except ImportError: wx = None -class InvalidDelimiter(StandardError): pass -class InvalidTextQualifier(StandardError): pass -class InvalidData(StandardError): pass -class InvalidNumberOfColumns(StandardError): pass +class InvalidDelimiter(Exception): pass +class InvalidTextQualifier(Exception): pass +class InvalidData(Exception): pass +class InvalidNumberOfColumns(Exception): pass # ------------------------------------------------------------------------------ def guessTextQualifier(input): @@ -176,7 +177,7 @@ regexp = re.compile('(?:(?:^|\n)(?P["\']).*?(?P=b_quote))|' '(?:(?P.)(?P["\']).*?(?P=quote)(?=(?P=delim)|\n))|' '(?:(?P["\']).*?(?P=e_quote)$)', re.M | re.S) - matches = filter(lambda i: reduce(lambda a, b: a + b, i), regexp.findall(data)) + matches = [i for i in regexp.findall(data) if reduce(lambda a, b: a + b, i)] if not matches: return None quotes = {} @@ -188,7 +189,7 @@ quotes[key] = quotes.get(key, 0) + 1 return reduce(lambda a, b, quotes = quotes: - (quotes[a] > quotes[b]) and a or b, quotes.keys()) + (quotes[a] > quotes[b]) and a or b, list(quotes.keys())) # ------------------------------------------------------------------------------ def guessDelimiter(input, textQualifier = '"'): @@ -247,8 +248,8 @@ metafrequency[freq] = metafrequency.get(freq, 0) + 1 # value is the mode charFrequency[char] = metafrequency - for char in charFrequency.keys(): - items = charFrequency[char].items() + for char in list(charFrequency.keys()): + items = list(charFrequency[char].items()) if len(items) == 1 and items[0][0] == 0: continue # get the mode of the frequencies if len(items) > 1: @@ -261,7 +262,7 @@ modes[char] = items[0] # build a list of possible delimiters - modeList = modes.items() + modeList = list(modes.items()) total = float(chunkLength * iteration) consistency = 1.0 # (rows of consistent data) / (number of rows) = 100% threshold = 0.9 # minimum consistency threshold @@ -273,7 +274,7 @@ consistency -= 0.01 if len(delims) == 1: - return delims.keys()[0] + return list(delims.keys())[0] # analyze another chunkLength lines start = end @@ -288,20 +289,20 @@ regexp = re.compile('%s(.*?)%s' % (textQualifier, textQualifier), re.S) for line in input: inQuotes = "".join(regexp.findall(line)) - for d in delims.keys(): + for d in list(delims.keys()): if not d in inQuotes: del delims[d] if len(delims) == 1: - return delims.keys()[0] + return list(delims.keys())[0] # if there's *still* more than one, fall back to a 'preferred' list if len(delims) > 1: for d in ['\t', ',', ';', ' ', ':']: - if d in delims.keys(): + if d in list(delims.keys()): return d # finally, just return the first damn character in the list - return delims.keys()[0] + return list(delims.keys())[0] # ------------------------------------------------------------------------------ def modeOfLengths(input): @@ -320,7 +321,7 @@ l = len(row) freq[l] = freq.get(l, 0) + 1 - return reduce(lambda a, b, freq = freq: (freq[a] > freq[b]) and a or b, freq.keys()) + return reduce(lambda a, b, freq = freq: (freq[a] > freq[b]) and a or b, list(freq.keys())) # ------------------------------------------------------------------------------ def guessHeaders(input, columns = 0): @@ -344,7 +345,7 @@ # Finally, a 'vote' is taken at the end for each column, adding or subtracting from # the likelihood of the first row being a header. - if type(input) != type([]): raise InvalidData, "list expected." + if type(input) != type([]): raise InvalidData("list expected.") if len(input) < 2: return 0 if not columns: @@ -356,7 +357,7 @@ for row in input[1:]: if len(row) != columns: continue # skip rows that have irregular number of columns - for col in columnTypes.keys(): + for col in list(columnTypes.keys()): try: try: # is it a built-in type (besides string)? @@ -377,7 +378,7 @@ # finally, compare results against first row and vote on whether it's a header hasHeader = 0 - for col, colType in columnTypes.items(): + for col, colType in list(columnTypes.items()): if type(colType) == type(0): # it's a length if len(input[0][col]) != colType: hasHeader += 1 @@ -430,7 +431,7 @@ # filter out empty lines # data = filter(lambda i: "".join(i), data) - data = filter(string.join, data) + data = list(filter(string.join, data)) return data # ------------------------------------------------------------------------------ @@ -485,15 +486,15 @@ list of lists of data """ if type(input) != type([]): - raise InvalidData, "expected list of lists of strings" + raise InvalidData("expected list of lists of strings") # Try to convert Unicode delimiters back to ASCII (wxPython can be # overenthusiastic), but ultimately support either. try: delimiter = delimiter.encode() except: pass - if (type(delimiter) != str and type(delimiter) != unicode) or not delimiter: - raise InvalidDelimiter, `delimiter` + if (type(delimiter) != str and type(delimiter) != str) or not delimiter: + raise InvalidDelimiter(repr(delimiter)) ## if textQualifier: ## # fieldRex=re.compile('(?:(?:[,]|^)"(.*?)"(?=[,]|$))|(?:(?:[,]|^)([^",]*?)(?=[,]|$))') @@ -560,10 +561,10 @@ record.append(accu) else: #record = map(lambda x: x.strip(), line.split(delimiter)) - record = map(string.strip, line.split(delimiter)) + record = list(map(string.strip, line.split(delimiter))) if stripall: # 1.4.1 - record = map(string.strip, record) + record = list(map(string.strip, record)) newdata.append(record) # (end of replacement code) @@ -581,18 +582,18 @@ maxColumns = max([len(line) for line in newdata]) # consistency check - for record in xrange(len(newdata)): + for record in range(len(newdata)): length = len(newdata[record]) difference = length - columns if difference: if errorHandler is None: - raise InvalidNumberOfColumns, "Expected %d, got %d" % (columns, length) + raise InvalidNumberOfColumns("Expected %d, got %d" % (columns, length)) else: newdata[record] = errorHandler(record, input[record], newdata[record], columns, maxColumns) # remove null values from data # newdata = filter(lambda i: i, newdata) - newdata = filter(None, newdata) + newdata = [_f for _f in newdata if _f] return newdata @@ -617,19 +618,19 @@ if not textQualifier or type(delimiter) != type(''): raise InvalidTextQualifier # double-up all text qualifiers in data (i.e. can't becomes can''t) - data = map(lambda i, q = textQualifier: - map(lambda j, q = q: str(j).replace(q, q * 2), i), - input) + data = list(map(lambda i, q = textQualifier: + list(map(lambda j, q = q: str(j).replace(q, q * 2), i)),RefactoringTool: Files that were modified: RefactoringTool: DSV/DSV.py + input)) if quoteall: # quote every data value - data = map(lambda i, q = textQualifier: - map(lambda j, q = q: q + j + q, i), - data) + data = list(map(lambda i, q = textQualifier: + list(map(lambda j, q = q: q + j + q, i)), + data)) else: # quote only the values that contain qualifiers, delimiters or newlines - data = map(lambda i, q = textQualifier, d = delimiter: - map(lambda j, q = q, d = d: ((j.find(q) != -1 or j.find(d) != -1 + data = list(map(lambda i, q = textQualifier, d = delimiter: + list(map(lambda j, q = q, d = d: ((j.find(q) != -1 or j.find(d) != -1 or j.find('\n') != -1) - and (q + j + q)) or j, i), data) + and (q + j + q)) or j, i)), data)) # assemble each line with delimiters data = [delimiter.join(line) for line in data] @@ -717,7 +718,7 @@ self.delimChecks = {} - for label, value in delims.items(): + for label, value in list(delims.items()): self.delimChecks[value] = wx.CheckBox(self, -1, label) delimGridSizer.Add(self.delimChecks[value], 0, wx.ALL, 3) wx.EVT_CHECKBOX(self, self.delimChecks[value].GetId(), self.Validate) @@ -730,7 +731,7 @@ self.otherDelim = wx.TextCtrl(self, -1, size = (20, -1)) wx.EVT_TEXT(self, self.otherDelim.GetId(), self.OnCustomDelim) - if self.delimChecks.has_key(delimiter): + if delimiter in self.delimChecks: self.delimChecks[delimiter].SetValue(True) elif delimiter is not None: self.delimChecks['Other'].SetValue(True) @@ -859,7 +860,7 @@ self.BuildPreview() def Validate(self, event = None): - hasDelimiter = reduce(lambda a, b: a + b, [cb.GetValue() for cb in self.delimChecks.values()]) + hasDelimiter = reduce(lambda a, b: a + b, [cb.GetValue() for cb in list(self.delimChecks.values())]) if hasDelimiter == 1 and self.delimChecks['Other'].GetValue(): hasDelimiter = self.otherDelim.GetValue() != "" self.BuildPreview() @@ -880,8 +881,8 @@ textQualifier = self.textQualifierChoice.GetStringSelection() if textQualifier == '{None}': textQualifier = None other = self.otherDelim.GetValue() - delimiter = map(lambda i, other = other: i[0] != 'Other' and i[0] or other, - filter(lambda i: i[1].GetValue(), self.delimChecks.items())) + delimiter = list(map(lambda i, other = other: i[0] != 'Other' and i[0] or other, + [i for i in list(self.delimChecks.items()) if i[1].GetValue()])) delimiter = "".join(delimiter) rows = self.previewRows.GetValue() @@ -892,8 +893,8 @@ textQualifier = textQualifier, delimiter = delimiter, errorHandler = padRow) - except InvalidDelimiter, e: - previewData = map(lambda i: [i], newdata[:rows]) + except InvalidDelimiter as e: + previewData = [[i] for i in newdata[:rows]] rows = min(rows, len(previewData)) hasHeaders = self.hasHeaderRow.GetValue() @@ -1041,9 +1042,9 @@ # ------------------------------------------------------------------------------ if __name__ == '__main__': if wx is None: - print "\nYou need wxPython to run this sample*." - print "\n*Note that wxPython is _not_ necessary to use this module, but it is required" - print "to use the wizard dialog (which the sample requires)." + print("\nYou need wxPython to run this sample*.") + print("\n*Note that wxPython is _not_ necessary to use this module, but it is required") + print("to use the wizard dialog (which the sample requires).") raise SystemExit @@ -1072,16 +1073,16 @@ headers, data = results if 0: # print the output to stdout if headers: - print headers - print 80*'=' + print(headers) + print(80*'=') for row in data: - print row + print(row) if 0: # for testing export functionality if headers: - print exportDSV([headers] + data) + print(exportDSV([headers] + data)) else: - print exportDSV(data) + print(exportDSV(data)) else: dlg.Destroy() I: pybuild base:232: /usr/bin/python3 setup.py build running build running build_py creating /build/python-dsv-POyYa1/python-dsv-1.4.1/.pybuild/cpython3_3.9_dsv/build/DSV copying DSV/__init__.py -> /build/python-dsv-POyYa1/python-dsv-1.4.1/.pybuild/cpython3_3.9_dsv/build/DSV copying DSV/DSV.py -> /build/python-dsv-POyYa1/python-dsv-1.4.1/.pybuild/cpython3_3.9_dsv/build/DSV dh_auto_test -i -O--buildsystem=pybuild I: pybuild base:232: cd /build/python-dsv-POyYa1/python-dsv-1.4.1/.pybuild/cpython3_3.9_dsv/build; python3.9 -m unittest discover -v ---------------------------------------------------------------------- Ran 0 tests in 0.000s OK create-stamp debian/debhelper-build-stamp dh_testroot -i -O--buildsystem=pybuild dh_prep -i -O--buildsystem=pybuild dh_auto_install -i -O--buildsystem=pybuild I: pybuild base:232: /usr/bin/python3 setup.py install --root /build/python-dsv-POyYa1/python-dsv-1.4.1/debian/python3-dsv running install running build running build_py running install_lib creating /build/python-dsv-POyYa1/python-dsv-1.4.1/debian/python3-dsv/usr creating /build/python-dsv-POyYa1/python-dsv-1.4.1/debian/python3-dsv/usr/lib creating /build/python-dsv-POyYa1/python-dsv-1.4.1/debian/python3-dsv/usr/lib/python3.9 creating /build/python-dsv-POyYa1/python-dsv-1.4.1/debian/python3-dsv/usr/lib/python3.9/dist-packages creating /build/python-dsv-POyYa1/python-dsv-1.4.1/debian/python3-dsv/usr/lib/python3.9/dist-packages/DSV copying /build/python-dsv-POyYa1/python-dsv-1.4.1/.pybuild/cpython3_3.9_dsv/build/DSV/__init__.py -> /build/python-dsv-POyYa1/python-dsv-1.4.1/debian/python3-dsv/usr/lib/python3.9/dist-packages/DSV copying /build/python-dsv-POyYa1/python-dsv-1.4.1/.pybuild/cpython3_3.9_dsv/build/DSV/DSV.py -> /build/python-dsv-POyYa1/python-dsv-1.4.1/debian/python3-dsv/usr/lib/python3.9/dist-packages/DSV creating /build/python-dsv-POyYa1/python-dsv-1.4.1/debian/python3-dsv/usr/lib/python3.9/dist-packages/DSV/__pycache__ copying /build/python-dsv-POyYa1/python-dsv-1.4.1/.pybuild/cpython3_3.9_dsv/build/DSV/__pycache__/__init__.cpython-39.pyc -> /build/python-dsv-POyYa1/python-dsv-1.4.1/debian/python3-dsv/usr/lib/python3.9/dist-packages/DSV/__pycache__ byte-compiling /build/python-dsv-POyYa1/python-dsv-1.4.1/debian/python3-dsv/usr/lib/python3.9/dist-packages/DSV/__init__.py to __init__.cpython-39.pyc byte-compiling /build/python-dsv-POyYa1/python-dsv-1.4.1/debian/python3-dsv/usr/lib/python3.9/dist-packages/DSV/DSV.py to DSV.cpython-39.pyc running install_egg_info Writing /build/python-dsv-POyYa1/python-dsv-1.4.1/debian/python3-dsv/usr/lib/python3.9/dist-packages/DSV-1.4.1.egg-info dh_installdocs -i -O--buildsystem=pybuild dh_installchangelogs -i -O--buildsystem=pybuild dh_python3 -i -O--buildsystem=pybuild dh_installsystemduser -i -O--buildsystem=pybuild dh_perl -i -O--buildsystem=pybuild dh_link -i -O--buildsystem=pybuild dh_strip_nondeterminism -i -O--buildsystem=pybuild dh_compress -i -O--buildsystem=pybuild dh_fixperms -i -O--buildsystem=pybuild dh_missing -i -O--buildsystem=pybuild dh_installdeb -i -O--buildsystem=pybuild dh_gencontrol -i -O--buildsystem=pybuild dpkg-gencontrol: warning: Provides field of package python3-dsv: substitution variable ${python3:Provides} used, but is not defined dh_md5sums -i -O--buildsystem=pybuild dh_builddeb -i -O--buildsystem=pybuild dpkg-deb: building package 'python3-dsv' in '../python3-dsv_1.4.1-11_all.deb'. dpkg-genbuildinfo --build=all dpkg-genchanges --build=all >../python-dsv_1.4.1-11_all.changes dpkg-genchanges: info: binary-only arch-indep upload (source code and arch-specific packages not included) dpkg-source --after-build . dpkg-buildpackage: info: binary-only upload (no source included) I: running special hook: sync-out /build/python-dsv-POyYa1 /tmp/python-dsv-1.4.1-11lmr82cqs I: cleaning package lists and apt cache... I: creating tarball... I: done I: removing tempdir /tmp/mmdebstrap.kQDRUVJTfg... I: success in 338.8181 seconds md5: python3-dsv_1.4.1-11_all.deb: OK sha1: python3-dsv_1.4.1-11_all.deb: OK sha256: python3-dsv_1.4.1-11_all.deb: OK Checksums: OK