diff options
| author | Ben Finney <ben@benfinney.id.au> | 2008-05-16 18:04:01 +1000 |
|---|---|---|
| committer | Ben Finney <ben@benfinney.id.au> | 2008-05-16 18:04:01 +1000 |
| commit | 0d12af28d4de2745f8831abf0224ceabec693b76 (patch) | |
| tree | 01f46a2739eebc6676fc70a6ba93a69121e1bea6 /doc | |
| parent | ad7bc46acd80451de21ce58450edb0f4367a5c79 (diff) | |
| download | python-apt-0d12af28d4de2745f8831abf0224ceabec693b76.tar.gz | |
Fix spaces adjacent to commas and operators, to conform with PEP 8.
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/examples/acquire.py | 8 | ||||
| -rw-r--r-- | doc/examples/all_deps.py | 4 | ||||
| -rw-r--r-- | doc/examples/cdrom.py | 2 | ||||
| -rwxr-xr-x | doc/examples/config.py | 32 | ||||
| -rwxr-xr-x | doc/examples/configisc.py | 14 | ||||
| -rwxr-xr-x | doc/examples/deb_inspect.py | 8 | ||||
| -rw-r--r-- | doc/examples/desc.py | 6 | ||||
| -rwxr-xr-x | doc/examples/gui-inst.py | 8 | ||||
| -rw-r--r-- | doc/examples/indexfile.py | 2 | ||||
| -rw-r--r-- | doc/examples/inst.py | 4 | ||||
| -rw-r--r-- | doc/examples/metaindex.py | 6 | ||||
| -rwxr-xr-x | doc/examples/print_uris.py | 2 | ||||
| -rw-r--r-- | doc/examples/progress.py | 4 | ||||
| -rwxr-xr-x | doc/examples/tagfile.py | 6 | ||||
| -rwxr-xr-x | doc/examples/update.py | 2 | ||||
| -rwxr-xr-x | doc/examples/versiontest.py | 24 |
16 files changed, 66 insertions, 66 deletions
diff --git a/doc/examples/acquire.py b/doc/examples/acquire.py index 7bf7d646..e42a9401 100644 --- a/doc/examples/acquire.py +++ b/doc/examples/acquire.py @@ -20,7 +20,7 @@ def get_file(fetcher, uri, destFile): os.chdir(cwd) return False filename = os.path.basename(uri) - os.rename(dir+"/"+filename,destFile) + os.rename(dir+"/"+filename, destFile) # cleanup os.rmdir(dir) os.chdir(cwd) @@ -44,7 +44,7 @@ depcache.Upgrade(True) progress = apt.progress.TextFetchProgress() fetcher = apt_pkg.GetAcquire(progress) pm = apt_pkg.GetPackageManager(depcache) -pm.GetArchives(fetcher,list,recs) +pm.GetArchives(fetcher, list, recs) print "%s (%s)" % (apt_pkg.SizeToStr(fetcher.FetchNeeded), fetcher.FetchNeeded) actiongroup = apt_pkg.GetPkgActionGroup(depcache) for pkg in cache.Packages: @@ -55,7 +55,7 @@ try: os.mkdir("/tmp/pyapt-test/partial") except OSError: pass -apt_pkg.Config.Set("Dir::Cache::archives","/tmp/pyapt-test") +apt_pkg.Config.Set("Dir::Cache::archives", "/tmp/pyapt-test") pkg = cache["3ddesktop"] depcache.MarkInstall(pkg) @@ -70,7 +70,7 @@ print fetcher get_file(fetcher, "ftp://ftp.debian.org/debian/dists/README", "/tmp/lala") -pm.GetArchives(fetcher,list,recs) +pm.GetArchives(fetcher, list, recs) for item in fetcher.Items: print item diff --git a/doc/examples/all_deps.py b/doc/examples/all_deps.py index f4f1741c..37222463 100644 --- a/doc/examples/all_deps.py +++ b/doc/examples/all_deps.py @@ -26,9 +26,9 @@ pkg = c[pkgname] deps = set()
-deps = dependencies(c,pkg, deps, "Depends")
+deps = dependencies(c, pkg, deps, "Depends")
print " ".join(deps)
preDeps = set()
-preDeps = dependencies(c,pkg, preDeps, "PreDepends")
+preDeps = dependencies(c, pkg, preDeps, "PreDepends")
print " ".join(preDeps)
diff --git a/doc/examples/cdrom.py b/doc/examples/cdrom.py index e54eb763..289b10f1 100644 --- a/doc/examples/cdrom.py +++ b/doc/examples/cdrom.py @@ -16,7 +16,7 @@ print cdrom progress = CdromProgress() -(res,ident) = cdrom.Ident(progress) +(res, ident) = cdrom.Ident(progress) print "ident result is: %s (%s) " % (res, ident) apt_pkg.Config.Set("APT::CDROM::Rename", "True") diff --git a/doc/examples/config.py b/doc/examples/config.py index 337899f0..cd7bcae0 100755 --- a/doc/examples/config.py +++ b/doc/examples/config.py @@ -12,7 +12,7 @@ # This shows how to use the system for configuration and option control. # The other varient is for ISC object config files. See configisc.py. -import apt_pkg,sys,posixpath; +import apt_pkg, sys, posixpath # Create a new empty Configuration object - there is also the system global # configuration object apt_pkg.Config which is used interally by apt-pkg @@ -20,30 +20,30 @@ import apt_pkg,sys,posixpath; # whenever possible.. Cnf = apt_pkg.newConfiguration(); -print "Command line is",sys.argv +print "Command line is", sys.argv # Load the default configuration file, InitConfig() does this better.. -Cnf.Set("config-file","/etc/apt/apt.conf"); # or Cnf["config-file"] = ".."; +Cnf.Set("config-file", "/etc/apt/apt.conf") # or Cnf["config-file"] = ".." if posixpath.exists(Cnf.FindFile("config-file")): - apt_pkg.ReadConfigFile(Cnf,"/etc/apt/apt.conf"); + apt_pkg.ReadConfigFile(Cnf, "/etc/apt/apt.conf") # Merge the command line arguments into the configuration space -Arguments = [('h',"help","help"), - ('v',"version","version"), - ('q',"quiet","quiet","IntLevel"), - ('c',"config-file","","ConfigFile"), - ('o',"option","","ArbItem")] -print "FileNames",apt_pkg.ParseCommandLine(Cnf,Arguments,sys.argv); +Arguments = [('h', "help", "help"), + ('v', "version", "version"), + ('q', "quiet", "quiet", "IntLevel"), + ('c', "config-file", "", "ConfigFile"), + ('o', "option", "", "ArbItem")] +print "FileNames", apt_pkg.ParseCommandLine(Cnf, Arguments, sys.argv) -print "Quiet level selected is",Cnf.FindI("quiet",0); +print "Quiet level selected is", Cnf.FindI("quiet", 0) # Do some stuff with it -if Cnf.FindB("version",0) == 1: +if Cnf.FindB("version", 0) == 1: print "Version selected - 1.1"; -if Cnf.FindB("help",0) == 1: - print apt_pkg.Package,apt_pkg.Version,"for",apt_pkg.Architecture, \ - "compiled on",apt_pkg.Date,apt_pkg.Time; +if Cnf.FindB("help", 0) == 1: + print apt_pkg.Package, apt_pkg.Version, "for", apt_pkg.Architecture, \ + "compiled on", apt_pkg.Date, apt_pkg.Time print "Hi, I am the help text for this program"; sys.exit(0); @@ -52,4 +52,4 @@ print "No help for you, try -h"; # Print the configuration space print "The Configuration space looks like:"; for I in Cnf.keys(): - print "%s \"%s\";"%(I,Cnf[I]); + print "%s \"%s\";" % (I, Cnf[I]) diff --git a/doc/examples/configisc.py b/doc/examples/configisc.py index 45a9c7f6..4d0d33d4 100755 --- a/doc/examples/configisc.py +++ b/doc/examples/configisc.py @@ -8,32 +8,32 @@ # doc/examples/ftp-archive.conf # or a bind8 config file.. -import apt_pkg,sys,posixpath; +import apt_pkg, sys, posixpath -ConfigFile = apt_pkg.ParseCommandLine(apt_pkg.Config,[],sys.argv); +ConfigFile = apt_pkg.ParseCommandLine(apt_pkg.Config, [], sys.argv) if len(ConfigFile) != 1: print "Must have exactly 1 file name"; sys.exit(0); Cnf = apt_pkg.newConfiguration(); -apt_pkg.ReadConfigFileISC(Cnf,ConfigFile[0]); +apt_pkg.ReadConfigFileISC(Cnf, ConfigFile[0]) # Print the configuration space #print "The Configuration space looks like:"; #for I in Cnf.keys(): -# print "%s \"%s\";"%(I,Cnf[I]); +# print "%s \"%s\";" % (I, Cnf[I]) # bind8 config file.. if Cnf.has_key("Zone"): - print "Zones: ",Cnf.SubTree("zone").List(); + print "Zones: ", Cnf.SubTree("zone").List() for I in Cnf.List("zone"): SubCnf = Cnf.SubTree(I); if SubCnf.Find("type") == "slave": - print "Masters for %s: %s"%(SubCnf.MyTag(),SubCnf.ValueList("masters")); + print "Masters for %s: %s" % (SubCnf.MyTag(), SubCnf.ValueList("masters")) else: print "Tree definitions:"; for I in Cnf.List("tree"): SubCnf = Cnf.SubTree(I); # This could use Find which would eliminate the possibility of exceptions. - print "Subtree %s with sections '%s' and architectures '%s'"%(SubCnf.MyTag(),SubCnf["Sections"],SubCnf["Architectures"]); + print "Subtree %s with sections '%s' and architectures '%s'" % (SubCnf.MyTag(), SubCnf["Sections"], SubCnf["Architectures"]) diff --git a/doc/examples/deb_inspect.py b/doc/examples/deb_inspect.py index 68219d6d..f3e5ae2b 100755 --- a/doc/examples/deb_inspect.py +++ b/doc/examples/deb_inspect.py @@ -7,11 +7,11 @@ import sys import os.path -def Callback(What,Name,Link,Mode,UID,GID,Size,MTime,Major,Minor): +def Callback(What, Name, Link, Mode, UID, GID, Size, MTime, Major, Minor): """ callback for debExtract """ - print "%s '%s','%s',%u,%u,%u,%u,%u,%u,%u"\ - % (What,Name,Link,Mode,UID,GID,Size, MTime, Major, Minor); + print "%s '%s','%s',%u,%u,%u,%u,%u,%u,%u" \ + % (What, Name, Link, Mode, UID, GID, Size, MTime, Major, Minor) if __name__ == "__main__": @@ -40,7 +40,7 @@ if __name__ == "__main__": print "extracting archive" dir = "/tmp/deb" os.mkdir(dir) - apt_inst.debExtractArchive(open(file),dir) + apt_inst.debExtractArchive(open(file), dir) def visit(arg, dirname, names): print "%s/" % dirname diff --git a/doc/examples/desc.py b/doc/examples/desc.py index 1d43f2f9..f47517cf 100644 --- a/doc/examples/desc.py +++ b/doc/examples/desc.py @@ -3,7 +3,7 @@ import apt_pkg apt_pkg.init() -apt_pkg.Config.Set("APT::Acquire::Translation","de") +apt_pkg.Config.Set("APT::Acquire::Translation", "de") cache = apt_pkg.GetCache() depcache = apt_pkg.GetDepCache(cache) @@ -15,10 +15,10 @@ print cand desc = cand.TranslatedDescription print desc print desc.FileList -(f,index) = desc.FileList.pop(0) +(f, index) = desc.FileList.pop(0) records = apt_pkg.GetPkgRecords(cache) -records.Lookup((f,index)) +records.Lookup((f, index)) desc = records.LongDesc print len(desc) print desc diff --git a/doc/examples/gui-inst.py b/doc/examples/gui-inst.py index edaec455..61db63f8 100755 --- a/doc/examples/gui-inst.py +++ b/doc/examples/gui-inst.py @@ -32,7 +32,7 @@ class GuiFetchProgress(gtk.Window, FetchProgress): self.label.show() self.vbox.pack_start(self.progress) self.vbox.pack_start(self.label) - self.resize(300,100) + self.resize(300, 100) def start(self): print "start" @@ -64,15 +64,15 @@ class TermInstallProgress(InstallProgress, gtk.Window): self.term.show() # check for the child self.reaper = vte.reaper_get() - self.reaper.connect("child-exited",self.child_exited) + self.reaper.connect("child-exited", self.child_exited) self.finished = False box.pack_start(self.term) self.progressbar = gtk.ProgressBar() self.progressbar.show() box.pack_start(self.progressbar) - def child_exited(self,term, pid, status): - print "child_exited: %s %s %s %s" % (self,term,pid,status) + def child_exited(self, term, pid, status): + print "child_exited: %s %s %s %s" % (self, term, pid, status) self.apt_status = posix.WEXITSTATUS(status) self.finished = True diff --git a/doc/examples/indexfile.py b/doc/examples/indexfile.py index d383fd61..22d0b635 100644 --- a/doc/examples/indexfile.py +++ b/doc/examples/indexfile.py @@ -10,7 +10,7 @@ cache = apt_pkg.GetCache() depcache = apt_pkg.GetDepCache(cache) pkg = cache["libimlib2"] cand = depcache.GetCandidateVer(pkg) -for (f,i) in cand.FileList: +for (f, i) in cand.FileList: index = sources.FindIndex(f) print index if index: diff --git a/doc/examples/inst.py b/doc/examples/inst.py index b37ab4cd..723038c1 100644 --- a/doc/examples/inst.py +++ b/doc/examples/inst.py @@ -23,8 +23,8 @@ class TextInstallProgress(InstallProgress): sys.stdout.flush() self.last = self.percent - def conffile(self,current,new): - print "conffile prompt: %s %s" % (current,new) + def conffile(self, current, new): + print "conffile prompt: %s %s" % (current, new) def error(self, errorstr): print "got dpkg error: '%s'" % errorstr diff --git a/doc/examples/metaindex.py b/doc/examples/metaindex.py index 1bce0dba..f00a7e01 100644 --- a/doc/examples/metaindex.py +++ b/doc/examples/metaindex.py @@ -9,7 +9,7 @@ sources.ReadMainList() for metaindex in sources.List: print metaindex - print "URI: ",metaindex.URI - print "Dist: ",metaindex.Dist - print "IndexFiles: ","\n".join([str(i) for i in metaindex.IndexFiles]) + print "URI: ", metaindex.URI + print "Dist: ", metaindex.Dist + print "IndexFiles: ", "\n".join([str(i) for i in metaindex.IndexFiles]) print diff --git a/doc/examples/print_uris.py b/doc/examples/print_uris.py index 3c93a668..3b678e83 100755 --- a/doc/examples/print_uris.py +++ b/doc/examples/print_uris.py @@ -15,7 +15,7 @@ for pkg in upgradable: pkg._lookupRecord(True) path = apt_pkg.ParseSection(pkg._records.Record)["Filename"] cand = pkg._depcache.GetCandidateVer(pkg._pkg) - for (packagefile,i) in cand.FileList: + for (packagefile, i) in cand.FileList: indexfile = cache._list.FindIndex(packagefile) if indexfile: uri = indexfile.ArchiveURI(path) diff --git a/doc/examples/progress.py b/doc/examples/progress.py index d8f00a52..70fc92f3 100644 --- a/doc/examples/progress.py +++ b/doc/examples/progress.py @@ -34,7 +34,7 @@ class TextFetchProgress(apt.FetchProgress): pass def updateStatus(self, uri, descr, shortDescr, status): - print "UpdateStatus: '%s' '%s' '%s' '%i'" % (uri,descr,shortDescr, status) + print "UpdateStatus: '%s' '%s' '%s' '%i'" % (uri, descr, shortDescr, status) 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) @@ -86,7 +86,7 @@ class TextCdromProgress(apt.CdromProgress): def changeCdrom(self): print "Please insert cdrom and press <ENTER>" - answer = sys.stdin.readline() + answer = sys.stdin.readline() return True diff --git a/doc/examples/tagfile.py b/doc/examples/tagfile.py index aeba34d2..4faf08ac 100755 --- a/doc/examples/tagfile.py +++ b/doc/examples/tagfile.py @@ -1,8 +1,8 @@ #!/usr/bin/env python import apt_pkg -Parse = apt_pkg.ParseTagFile(open("/var/lib/dpkg/status","r")); +Parse = apt_pkg.ParseTagFile(open("/var/lib/dpkg/status", "r")) while Parse.Step() == 1: - print Parse.Section.get("Package"); - print apt_pkg.ParseDepends(Parse.Section.get("Depends","")); + print Parse.Section.get("Package") + print apt_pkg.ParseDepends(Parse.Section.get("Depends", "")) diff --git a/doc/examples/update.py b/doc/examples/update.py index be7bb679..364fa1c9 100755 --- a/doc/examples/update.py +++ b/doc/examples/update.py @@ -9,5 +9,5 @@ if __name__ == "__main__": "touch /tmp/update-was-run") c = apt.Cache() res = c.update(apt.progress.TextFetchProgress()) - print "res: ",res + print "res: ", res assert(os.path.exists("/tmp/update-about-to-run")) diff --git a/doc/examples/versiontest.py b/doc/examples/versiontest.py index 8f18f6c8..29da3b8f 100755 --- a/doc/examples/versiontest.py +++ b/doc/examples/versiontest.py @@ -1,17 +1,17 @@ #!/usr/bin/python # This is a simple clone of tests/versiontest.cc -import apt_pkg,sys,re,string; +import apt_pkg, sys, re, string apt_pkg.InitConfig(); apt_pkg.InitSystem(); -TestFile = apt_pkg.ParseCommandLine(apt_pkg.Config,[],sys.argv); +TestFile = apt_pkg.ParseCommandLine(apt_pkg.Config, [], sys.argv) if len(TestFile) != 1: print "Must have exactly 1 file name"; sys.exit(0); # Go over the file.. -List = open(TestFile[0],"r"); +List = open(TestFile[0], "r") CurLine = 0; while(1): Line = List.readline(); @@ -22,15 +22,15 @@ while(1): if len(Line) == 0 or Line[0] == '#': continue; - Split = re.split("[ \n]",Line); + Split = re.split("[ \n]", Line) # Check forward - if apt_pkg.VersionCompare(Split[0],Split[1]) != int(Split[2]): - print "Comparision failed on line %u. '%s' ? '%s' %i != %i"%(CurLine, - Split[0],Split[1],apt_pkg.VersionCompare(Split[0],Split[1]), - int(Split[2])); + if apt_pkg.VersionCompare(Split[0], Split[1]) != int(Split[2]): + print "Comparision failed on line %u. '%s' ? '%s' %i != %i" % (CurLine, + Split[0], Split[1], apt_pkg.VersionCompare(Split[0], Split[1]), + int(Split[2])) # Check reverse - if apt_pkg.VersionCompare(Split[1],Split[0]) != -1*int(Split[2]): - print "Comparision failed on line %u. '%s' ? '%s' %i != %i"%(CurLine, - Split[1],Split[0],apt_pkg.VersionCompare(Split[1],Split[0]), - -1*int(Split[2])); + if apt_pkg.VersionCompare(Split[1], Split[0]) != -1 * int(Split[2]): + print "Comparision failed on line %u. '%s' ? '%s' %i != %i" % (CurLine, + Split[1], Split[0], apt_pkg.VersionCompare(Split[1], Split[0]), + -1 * int(Split[2])) |
