r165 - in /debtorrent/trunk: DebTorrent/BT1/AptListener.py debtorrent-client.py

camrdale-guest at users.alioth.debian.org camrdale-guest at users.alioth.debian.org
Sat Jul 14 06:55:19 UTC 2007


Author: camrdale-guest
Date: Sat Jul 14 06:55:18 2007
New Revision: 165

URL: http://svn.debian.org/wsvn/debtorrent/?sc=1&rev=165
Log:
Clean up some of the unused imports.

Modified:
    debtorrent/trunk/DebTorrent/BT1/AptListener.py
    debtorrent/trunk/debtorrent-client.py

Modified: debtorrent/trunk/DebTorrent/BT1/AptListener.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/BT1/AptListener.py?rev=165&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/BT1/AptListener.py (original)
+++ debtorrent/trunk/DebTorrent/BT1/AptListener.py Sat Jul 14 06:55:18 2007
@@ -12,46 +12,26 @@
 
 """
 
-from DebTorrent.parseargs import parseargs, formatDefinitions
-from DebTorrent.RawServer import RawServer, autodetect_ipv6, autodetect_socket_style
-from DebTorrent.HTTPHandler import HTTPHandler, months, weekdays
-from DebTorrent.parsedir import parsedir
-from DebTorrent.subnetparse import IP_List, ipv6_to_ipv4, to_ipv4, is_valid_ip, is_ipv4
+from DebTorrent.subnetparse import IP_List, ipv6_to_ipv4, is_ipv4
 from DebTorrent.iprangeparse import IP_List as IP_Range_List
-from DebTorrent.torrentlistparse import parsetorrentlist
-from threading import Event, Thread
-from DebTorrent.bencode import bencode, bdecode, Bencached
-from DebTorrent.zurllib import urlopen, quote, unquote
+from DebTorrent.bencode import bencode
+from DebTorrent.zurllib import quote, unquote
 from Filter import Filter
 from urlparse import urlparse
-from os import rename, getpid
-from os.path import exists, isfile, join
+from os.path import join
 from cStringIO import StringIO
 from gzip import GzipFile
 from bz2 import decompress
 from traceback import print_exc
-from time import time, gmtime, strftime, localtime
+from time import time, gmtime, strftime
 from DebTorrent.clock import clock
-from random import shuffle, seed, randrange
 from sha import sha
-from types import StringType, IntType, LongType, ListType, DictType
-from binascii import b2a_hex, a2b_hex, a2b_base64
-from string import lower
+from binascii import b2a_hex
 from makemetafile import getpieces, getsubpieces, uniconvert, convert_all
 from DebTorrent.HTTPCache import HTTPCache
-import sys, os
-import signal
-import re
-import DebTorrent.__init__
-from DebTorrent.__init__ import version, createPeerID, product_name,version_short
-
-try:
-    True
-except:
-    True = 1
-    False = 0
-    bool = lambda x: not not x
-    
+import os
+from DebTorrent.__init__ import version, product_name,version_short
+
 DEBUG = True
 
 VERSION = product_name+'/'+version_short
@@ -100,8 +80,6 @@
     @ivar allowed_ip_mtime: unknown
     @type banned_ip_mtime: unknown
     @ivar banned_ip_mtime: unknown
-    @type trackerid: unknown
-    @ivar trackerid: unknown
     @type prevtime: unknown
     @ivar prevtime: unknown
     @type allow_get: unknown
@@ -160,9 +138,6 @@
             self.allowed_ip_mtime = 0
             self.banned_ip_mtime = 0
             self.read_ip_lists()
-                
-        self.trackerid = createPeerID('-T-')
-        seed(self.trackerid)
                 
         self.prevtime = clock()
                 
@@ -642,14 +617,11 @@
 #        return (404, 'Not Found', {'Content-Type': 'text/plain', 'Pragma': 'no-cache'}, alas)
         real_ip = connection.get_ip()
         ip = real_ip
-        if is_ipv4(ip):
-            ipv4 = True
-        else:
+        if not is_ipv4(ip):
             try:
                 ip = ipv6_to_ipv4(ip)
-                ipv4 = True
             except ValueError:
-                ipv4 = False
+                pass
 
         if ( (self.allowed_IPs and not self.allowed_IPs.includes(ip))
              or (self.banned_IPs and self.banned_IPs.includes(ip)) ):

Modified: debtorrent/trunk/debtorrent-client.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/debtorrent-client.py?rev=165&op=diff
==============================================================================
--- debtorrent/trunk/debtorrent-client.py (original)
+++ debtorrent/trunk/debtorrent-client.py Sat Jul 14 06:55:18 2007
@@ -8,6 +8,9 @@
 
 This script implements a client daemon for managing multiple 
 debtorrent downloads.
+
+ at type Exceptions: C{string}
+ at var Exceptions: the exceptions that have occurred.
 
 """
 
@@ -23,9 +26,8 @@
 from DebTorrent.launchmanycore import LaunchMany
 from DebTorrent.download_bt1 import defaults, defaults_many, get_usage
 from DebTorrent.parseargs import parseargs
-from threading import Event
 from sys import argv, exit
-import sys, os
+import os
 from DebTorrent import version, report_email
 from DebTorrent.ConfigDir import ConfigDir
 
@@ -58,7 +60,6 @@
 
 
 Exceptions = []
-"""The exceptions that have occurred."""
 
 class HeadlessDisplayer:
     """Displays on the command-line the status of the downloads.




More information about the Debtorrent-commits mailing list