summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Vogt <mvo@debian.org>2013-12-31 23:18:43 +0100
committerMichael Vogt <mvo@debian.org>2014-01-05 20:04:26 +0100
commite3c26754af1891d2c50993730467fc9335ec5f09 (patch)
treea4caaa2974ef7108807a790885c7b560f900a783
parenteac4d047d8774def55b03cb82d505d237d93ea55 (diff)
downloadpython-apt-e3c26754af1891d2c50993730467fc9335ec5f09.tar.gz
make pyflakes clean
-rw-r--r--apt/__init__.py2
-rw-r--r--apt/auth.py1
-rw-r--r--apt/debfile.py1
-rw-r--r--apt/progress/__init__.py1
-rw-r--r--doc/examples/acquire.py3
-rw-r--r--doc/examples/progress.py1
-rw-r--r--doc/source/conf.py1
-rw-r--r--tests/test_aptsources.py2
-rw-r--r--tests/test_aptsources_ports.py1
-rw-r--r--tests/test_cache_invocation.py1
-rw-r--r--tests/test_debfile.py11
-rw-r--r--tests/test_debfile_multiarch.py2
-rw-r--r--tests/test_lp659438.py2
-rw-r--r--tests/test_paths.py1
-rw-r--r--tests/test_progress.py2
-rw-r--r--tests/test_utils.py4
-rwxr-xr-xutils/get_ubuntu_mirrors.py2
-rwxr-xr-xutils/get_ubuntu_mirrors_from_lp.py1
18 files changed, 12 insertions, 27 deletions
diff --git a/apt/__init__.py b/apt/__init__.py
index 7b04befb..c4e78ba0 100644
--- a/apt/__init__.py
+++ b/apt/__init__.py
@@ -23,6 +23,8 @@ import apt_pkg
# import some fancy classes
from apt.package import Package
from apt.cache import Cache, ProblemResolver
+Cache # pyflakes
+ProblemResolver # pyflakes
from apt.cdrom import Cdrom
# init the package system, but do not re-initialize config
diff --git a/apt/auth.py b/apt/auth.py
index c1b8da2a..d5a66b4a 100644
--- a/apt/auth.py
+++ b/apt/auth.py
@@ -24,7 +24,6 @@
# USA
"""Handle GnuPG keys used to trust signed repositories."""
-import atexit
import os
import os.path
import shutil
diff --git a/apt/debfile.py b/apt/debfile.py
index 7f9cf9fc..c845b1f2 100644
--- a/apt/debfile.py
+++ b/apt/debfile.py
@@ -508,6 +508,7 @@ class DebPackage(object):
# turn off MarkAndSweep via a action group (if available)
try:
_actiongroup = apt_pkg.ActionGroup(self._cache._depcache)
+ _actiongroup # pyflakes
except AttributeError:
pass
# check depends
diff --git a/apt/progress/__init__.py b/apt/progress/__init__.py
index 00dc768f..776a7034 100644
--- a/apt/progress/__init__.py
+++ b/apt/progress/__init__.py
@@ -22,7 +22,6 @@ This package provides progress reporting for the python-apt package. The module
'base' provides classes with no output, the module 'gtk2' provides classes for
GTK+ applications, and the module 'text' provides classes for terminals, etc.
"""
-import apt_pkg
__all__ = []
diff --git a/doc/examples/acquire.py b/doc/examples/acquire.py
index c2db8327..7381ad68 100644
--- a/doc/examples/acquire.py
+++ b/doc/examples/acquire.py
@@ -9,6 +9,7 @@ def get_file(fetcher, uri, destfile):
# get the file
af = apt_pkg.AcquireFile(fetcher, uri=uri, descr="sample descr",
destfile=destfile)
+ print "desc_uri: %s -> %s" % (af.desc_uri, af.destfile)
res = fetcher.run()
if res != fetcher.RESULT_CONTINUE:
return False
@@ -45,7 +46,7 @@ except OSError:
pass
apt_pkg.config.set("Dir::Cache::archives", "/tmp/pyapt-test")
-pkg = cache["3ddesktop"]
+pkg = cache["2vcard"]
depcache.mark_install(pkg)
progress = apt.progress.text.AcquireProgress()
diff --git a/doc/examples/progress.py b/doc/examples/progress.py
index 77985a51..d7c4fad8 100644
--- a/doc/examples/progress.py
+++ b/doc/examples/progress.py
@@ -98,6 +98,7 @@ class TextCdromProgress(apt.progress.base.CdromProgress):
def change_cdrom(self):
print "Please insert cdrom and press <ENTER>"
answer = sys.stdin.readline()
+ print answer
return True
diff --git a/doc/source/conf.py b/doc/source/conf.py
index bdf0579b..163f5074 100644
--- a/doc/source/conf.py
+++ b/doc/source/conf.py
@@ -26,6 +26,7 @@ if os.path.exists("../../build"):
sys.path.insert(0, os.path.abspath(os.path.dirname(apt_pkg_path)))
try:
import apt_pkg
+ apt_pkg # pyflakes
except ImportError as exc:
# Not the correct version
sys.stderr.write('W: Ignoring error %s\n' % exc)
diff --git a/tests/test_aptsources.py b/tests/test_aptsources.py
index 5a174f3b..0b74cb79 100644
--- a/tests/test_aptsources.py
+++ b/tests/test_aptsources.py
@@ -140,7 +140,6 @@ class TestAptSources(unittest.TestCase):
distro = aptsources.distro.get_distro(id="Ubuntu")
distro.get_sources(sources)
# test if all suits of the current distro were detected correctly
- dist_templates = set()
for s in sources:
if not s.template:
self.fail("source entry '%s' has no matcher" % s)
@@ -178,7 +177,6 @@ class TestAptSources(unittest.TestCase):
assert sources.list[9].line.strip() == str(sources.list[9])
def test_enable_component(self):
- from subprocess import Popen, PIPE
target = "./data/aptsources/sources.list.enable_comps"
line = "deb http://archive.ubuntu.com/ubuntu lucid main\n"
with open(target, "w") as target_file:
diff --git a/tests/test_aptsources_ports.py b/tests/test_aptsources_ports.py
index 67c21b9c..b625b8c4 100644
--- a/tests/test_aptsources_ports.py
+++ b/tests/test_aptsources_ports.py
@@ -31,7 +31,6 @@ class TestAptSourcesPorts(unittest.TestCase):
"8.04")
distro.get_sources(sources)
# test if all suits of the current distro were detected correctly
- dist_templates = set()
for s in sources:
if not s.line.strip() or s.line.startswith("#"):
continue
diff --git a/tests/test_cache_invocation.py b/tests/test_cache_invocation.py
index a89ef557..4bba0813 100644
--- a/tests/test_cache_invocation.py
+++ b/tests/test_cache_invocation.py
@@ -25,6 +25,7 @@ class TestCache(unittest.TestCase):
"""cache_invocation: Test correct invocation."""
apt_cache = apt_pkg.Cache(progress=None)
apt_depcache = apt_pkg.DepCache(apt_cache)
+ self.assertNotEqual(apt_depcache, None)
if __name__ == "__main__":
unittest.main()
diff --git a/tests/test_debfile.py b/tests/test_debfile.py
index 3e933944..9379884a 100644
--- a/tests/test_debfile.py
+++ b/tests/test_debfile.py
@@ -123,15 +123,8 @@ Description: testpackage for gdebi - contains usr/bin/binary for file reading
deb.missing_deps
def test_no_supported_data_tar(self):
- # ensure that a unknown data.tar.xxx raises a exception
- raised = False
- try:
- deb = apt.debfile.DebPackage("./data/test_debs/data-tar-broken.deb")
- except SystemError:
- raised = True
- # with self.assertRaises(SystemError): is more elegant above, but
- # we need to support python2.6
- self.assertTrue(raised)
+ with self.assertRaises(SystemError):
+ apt.debfile.DebPackage("./data/test_debs/data-tar-broken.deb")
def test_contains(self):
deb = apt.debfile.DebPackage("./data/test_debs/data-tar-xz.deb")
diff --git a/tests/test_debfile_multiarch.py b/tests/test_debfile_multiarch.py
index bbf62016..cf6479b1 100644
--- a/tests/test_debfile_multiarch.py
+++ b/tests/test_debfile_multiarch.py
@@ -7,8 +7,6 @@
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved.
"""Unit tests for verifying the correctness of DebPackage in apt.debfile."""
-import os
-import logging
import unittest
from test_all import get_library_dir
diff --git a/tests/test_lp659438.py b/tests/test_lp659438.py
index b9a837b4..334f574d 100644
--- a/tests/test_lp659438.py
+++ b/tests/test_lp659438.py
@@ -63,7 +63,7 @@ Architecture: all""")
def tearDown(self):
# this resets the rootdir apt_pkg.config to ensure it does not
# "pollute" the later tests
- cache = apt.cache.Cache(rootdir="/")
+ apt.cache.Cache(rootdir="/")
shutil.rmtree(self.chroot_path)
def test_survive_reqreinst(self):
diff --git a/tests/test_paths.py b/tests/test_paths.py
index 17f562d2..48f86c52 100644
--- a/tests/test_paths.py
+++ b/tests/test_paths.py
@@ -3,7 +3,6 @@
#
import os
import shutil
-import tempfile
import unittest
import apt_inst
diff --git a/tests/test_progress.py b/tests/test_progress.py
index e4a5fa3c..508da7d4 100644
--- a/tests/test_progress.py
+++ b/tests/test_progress.py
@@ -44,7 +44,7 @@ class TestProgress(unittest.TestCase):
def test_acquire_progress(self):
progress = TestAcquireProgress()
cache = apt.Cache()
- res = cache.update(progress)
+ cache.update(progress)
self.assertTrue(progress.pulsed)
if __name__ == "__main__":
diff --git a/tests/test_utils.py b/tests/test_utils.py
index 2676bb98..35c0a466 100644
--- a/tests/test_utils.py
+++ b/tests/test_utils.py
@@ -8,12 +8,8 @@
import datetime
import os
-import sys
import unittest
-import apt_pkg
-import apt.utils
-
from apt.utils import (
get_maintenance_end_date,
get_release_date_from_release_file,
diff --git a/utils/get_ubuntu_mirrors.py b/utils/get_ubuntu_mirrors.py
index ddd1e369..cf509088 100755
--- a/utils/get_ubuntu_mirrors.py
+++ b/utils/get_ubuntu_mirrors.py
@@ -26,8 +26,6 @@
import urllib2
import re
-import os
-import commands
import sys
# the list of official Ubuntu servers
diff --git a/utils/get_ubuntu_mirrors_from_lp.py b/utils/get_ubuntu_mirrors_from_lp.py
index 7c4d3831..6ff2d885 100755
--- a/utils/get_ubuntu_mirrors_from_lp.py
+++ b/utils/get_ubuntu_mirrors_from_lp.py
@@ -25,7 +25,6 @@
# USA
import feedparser
-import sys
d = feedparser.parse("https://launchpad.net/ubuntu/+archivemirrors-rss")
#d = feedparser.parse(open("+archivemirrors-rss"))