summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2009-01-12 17:01:34 +0100
committerJulian Andres Klode <jak@debian.org>2009-01-12 17:01:34 +0100
commit2e4443bbd9872f5599c9a8eb93a65d6c34c83ca2 (patch)
tree86e6f869f2f0e59f99df0f49f679dcd7eeba5255 /doc
parenteb32fb89da3e3e1ff4a9668aaed6d533f04e9ee7 (diff)
downloadpython-apt-2e4443bbd9872f5599c9a8eb93a65d6c34c83ca2.tar.gz
Cleanup: Comparisons to True/False, ==/!= None, deprecated modules
Diffstat (limited to 'doc')
-rw-r--r--doc/examples/action.py4
-rw-r--r--doc/examples/all_deps.py4
-rwxr-xr-xdoc/examples/build-deps.py3
-rw-r--r--doc/examples/depcache.py4
-rwxr-xr-xdoc/examples/dependant-pkgs.py2
-rwxr-xr-xdoc/examples/gui-inst.py9
-rw-r--r--doc/examples/progress.py9
-rwxr-xr-xdoc/examples/versiontest.py3
-rw-r--r--doc/source/conf.py18
-rw-r--r--doc/source/examples/missing-deps.py1
10 files changed, 25 insertions, 32 deletions
diff --git a/doc/examples/action.py b/doc/examples/action.py
index 7153292c..9b9d7dd3 100644
--- a/doc/examples/action.py
+++ b/doc/examples/action.py
@@ -86,7 +86,7 @@ print "UsrSize: %s " % apt_pkg.SizeToStr(depcache.UsrSize)
print "DebSize: %s " % apt_pkg.SizeToStr(depcache.DebSize)
for pkg in cache.Packages:
- if pkg.CurrentVer != None and not depcache.MarkedInstall(pkg) \
+ if pkg.CurrentVer is not None and not depcache.MarkedInstall(pkg) \
and depcache.IsUpgradable(pkg):
print "Upgrade didn't upgrade (kept): %s" % pkg.Name
@@ -101,7 +101,7 @@ print "DebSize: %s " % apt_pkg.SizeToStr(depcache.DebSize)
# overview about what would happen
for pkg in cache.Packages:
if depcache.MarkedInstall(pkg):
- if pkg.CurrentVer != None:
+ if pkg.CurrentVer is not None:
print "Marked upgrade: %s " % pkg.Name
else:
print "Marked install: %s" % pkg.Name
diff --git a/doc/examples/all_deps.py b/doc/examples/all_deps.py
index 0a2f3157..992e98d8 100644
--- a/doc/examples/all_deps.py
+++ b/doc/examples/all_deps.py
@@ -1,13 +1,13 @@
#!/usr/bin/env python
-
import sys
+
import apt
def dependencies(cache, pkg, deps, key="Depends"):
#print "pkg: %s (%s)" % (pkg.name, deps)
candver = cache._depcache.GetCandidateVer(pkg._pkg)
- if candver == None:
+ if candver is None:
return deps
dependslist = candver.DependsList
if key in dependslist:
diff --git a/doc/examples/build-deps.py b/doc/examples/build-deps.py
index dc1a6f4e..aeb5667c 100755
--- a/doc/examples/build-deps.py
+++ b/doc/examples/build-deps.py
@@ -3,7 +3,6 @@
import apt_pkg
import sys
-import sets # only needed for python2.3, python2.4 supports this naively
def get_source_pkg(pkg, records, depcache):
@@ -37,7 +36,7 @@ try:
except KeyError:
print "No package %s found" % sys.argv[1]
sys.exit(1)
-all_build_depends = sets.Set()
+all_build_depends = set()
# get the build depdends for the package itself
srcpkg_name = get_source_pkg(base, records, depcache)
diff --git a/doc/examples/depcache.py b/doc/examples/depcache.py
index ad884fe7..790cc9d6 100644
--- a/doc/examples/depcache.py
+++ b/doc/examples/depcache.py
@@ -84,7 +84,7 @@ print "UsrSize: %s " % apt_pkg.SizeToStr(depcache.UsrSize)
print "DebSize: %s " % apt_pkg.SizeToStr(depcache.DebSize)
for pkg in cache.Packages:
- if pkg.CurrentVer != None and not depcache.MarkedInstall(pkg) \
+ if pkg.CurrentVer is not None and not depcache.MarkedInstall(pkg) \
and depcache.IsUpgradable(pkg):
print "Upgrade didn't upgrade (kept): %s" % pkg.Name
@@ -100,7 +100,7 @@ print "DebSize: %s " % apt_pkg.SizeToStr(depcache.DebSize)
# overview about what would happen
for pkg in cache.Packages:
if depcache.MarkedInstall(pkg):
- if pkg.CurrentVer != None:
+ if pkg.CurrentVer is not None:
print "Marked upgrade: %s " % pkg.Name
else:
print "Marked install: %s" % pkg.Name
diff --git a/doc/examples/dependant-pkgs.py b/doc/examples/dependant-pkgs.py
index bb10ce70..5fbbc76d 100755
--- a/doc/examples/dependant-pkgs.py
+++ b/doc/examples/dependant-pkgs.py
@@ -7,7 +7,7 @@ pkgs = set()
cache = apt.Cache()
for pkg in cache:
candver = cache._depcache.GetCandidateVer(pkg._pkg)
- if candver == None:
+ if candver is None:
continue
dependslist = candver.DependsList
for dep in dependslist.keys():
diff --git a/doc/examples/gui-inst.py b/doc/examples/gui-inst.py
index cb49db3e..8138d922 100755
--- a/doc/examples/gui-inst.py
+++ b/doc/examples/gui-inst.py
@@ -1,20 +1,13 @@
#!/usr/bin/python
# example how to install in a custom terminal widget
# see also gnome bug: #169201
-
-import apt
-import apt_pkg
-import sys, os, fcntl
-import copy
-import string
-import fcntl
-
import pygtk
pygtk.require('2.0')
import gtk
import apt.gtk.widgets
+
if __name__ == "__main__":
win = gtk.Window()
diff --git a/doc/examples/progress.py b/doc/examples/progress.py
index c56734b7..83847598 100644
--- a/doc/examples/progress.py
+++ b/doc/examples/progress.py
@@ -1,8 +1,7 @@
-import apt
-from apt import SizeToStr
import sys
import time
-import string
+
+import apt
class TextProgress(apt.OpProgress):
@@ -39,8 +38,8 @@ class TextFetchProgress(apt.FetchProgress):
def pulse(self):
print "Pulse: CPS: %s/s; Bytes: %s/%s; Item: %s/%s" % (
- SizeToStr(self.currentCPS), SizeToStr(self.currentBytes),
- SizeToStr(self.totalBytes), self.currentItems, self.totalItems)
+ apt.SizeToStr(self.currentCPS), SizeToStr(self.currentBytes),
+ apt.SizeToStr(self.totalBytes), self.currentItems, self.totalItems)
return True
def mediaChange(self, medium, drive):
diff --git a/doc/examples/versiontest.py b/doc/examples/versiontest.py
index dd881f6b..fa13cc1c 100755
--- a/doc/examples/versiontest.py
+++ b/doc/examples/versiontest.py
@@ -4,7 +4,6 @@
import apt_pkg
import sys
import re
-import string
apt_pkg.InitConfig()
apt_pkg.InitSystem()
@@ -22,7 +21,7 @@ while(1):
CurLine = CurLine + 1
if Line == "":
break
- Line = string.strip(Line)
+ Line = Line.strip()
if len(Line) == 0 or Line[0] == '#':
continue
diff --git a/doc/source/conf.py b/doc/source/conf.py
index bb8056ad..8f71e3e3 100644
--- a/doc/source/conf.py
+++ b/doc/source/conf.py
@@ -3,18 +3,20 @@
# python-apt documentation build configuration file, created by
# sphinx-quickstart on Wed Jan 7 17:04:36 2009.
#
-# This file is execfile()d with the current directory set to its containing dir.
+# This file is execfile()d with the current directory set to its containing
+# dir.
#
# The contents of this file are pickled, so don't put values in the namespace
-# that aren't pickleable (module imports are okay, they're removed automatically).
+# that aren't pickleable (module imports are okay, they're removed
+# automatically).
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
-
-import sys, os
+import os
+import sys
# If your extensions are in another directory, add it here. If the directory
# is relative to the documentation root, use os.path.abspath to make it
@@ -28,8 +30,8 @@ if os.path.exists("../../build"):
# General configuration
# ---------------------
-# Add any Sphinx extension module names here, as strings. They can be extensions
-# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
+# Add any Sphinx extension module names here, as strings. They can be
+# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest',
'sphinx.ext.intersphinx', 'sphinx.ext.todo']
intersphinx_mapping = {'http://docs.python.org/': None}
@@ -76,7 +78,7 @@ release = '0.7.9~exp2'
# for source files.
exclude_trees = []
-# The reST default role (used for this markup: `text`) to use for all documents.
+# The reST default role (used for this markup: `text`) for all documents.
#default_role = None
# If true, '()' will be appended to :func: etc. cross-reference text.
@@ -172,7 +174,7 @@ htmlhelp_basename = 'python-aptdoc'
#latex_font_size = '10pt'
# Grouping the document tree into LaTeX files. List of tuples
-# (source start file, target name, title, author, document class [howto/manual]).
+# (source index, target name, title, author, document class [howto/manual]).
latex_documents = [
('index', 'python-apt.tex', ur'python-apt Documentation',
ur'Julian Andres Klode <jak@debian.org>', 'manual'),
diff --git a/doc/source/examples/missing-deps.py b/doc/source/examples/missing-deps.py
index 0870eb98..3ca16e45 100644
--- a/doc/source/examples/missing-deps.py
+++ b/doc/source/examples/missing-deps.py
@@ -10,6 +10,7 @@ def fmt_dep(dep):
ret += " (%s %s)" % (dep.CompType, dep.TargetVer)
return ret
+
def check_version(pkgver):
"""Check the version of the package"""
missing = []