Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(214)

Unified Diff: third_party/twisted_8_1/twisted/names/hosts.py

Issue 12261012: Remove third_party/twisted_8_1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/twisted_8_1/twisted/names/error.py ('k') | third_party/twisted_8_1/twisted/names/resolve.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/twisted_8_1/twisted/names/hosts.py
diff --git a/third_party/twisted_8_1/twisted/names/hosts.py b/third_party/twisted_8_1/twisted/names/hosts.py
deleted file mode 100644
index fa0b340227b88e185ca27b83f81e1a91a035a54f..0000000000000000000000000000000000000000
--- a/third_party/twisted_8_1/twisted/names/hosts.py
+++ /dev/null
@@ -1,61 +0,0 @@
-# Copyright (c) 2001-2004 Twisted Matrix Laboratories.
-# See LICENSE for details.
-
-
-from twisted.names import dns
-from twisted.persisted import styles
-from twisted.python import failure
-from twisted.internet import defer
-
-from twisted.names import common
-
-def searchFileFor(file, name):
- try:
- fp = open(file)
- except:
- return None
-
- lines = fp.readlines()
- for line in lines:
- idx = line.find('#')
- if idx != -1:
- line = line[:idx]
- if not line:
- continue
- parts = line.split()
- if name.lower() in [s.lower() for s in parts[1:]]:
- return parts[0]
- return None
-
-
-
-class Resolver(common.ResolverBase, styles.Versioned):
- """A resolver that services hosts(5) format files."""
- #TODO: IPv6 support
-
- persistenceVersion = 1
-
- def upgradeToVersion1(self):
- # <3 exarkun
- self.typeToMethod = {}
- for (k, v) in common.typeToMethod.items():
- self.typeToMethod[k] = getattr(self, v)
-
-
- def __init__(self, file='/etc/hosts', ttl = 60 * 60):
- common.ResolverBase.__init__(self)
- self.file = file
- self.ttl = ttl
-
-
- def lookupAddress(self, name, timeout = None):
- res = searchFileFor(self.file, name)
- if res:
- return defer.succeed([
- (dns.RRHeader(name, dns.A, dns.IN, self.ttl, dns.Record_A(res, self.ttl)),), (), ()
- ])
- return defer.fail(failure.Failure(dns.DomainError(name)))
-
-
- # When we put IPv6 support in, this'll need a real impl
- lookupAllRecords = lookupAddress
« no previous file with comments | « third_party/twisted_8_1/twisted/names/error.py ('k') | third_party/twisted_8_1/twisted/names/resolve.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698