Commits

Hong Minhee committed 295c40f

Some modifications to keep [http://vlastic.ruree.net/wiki/VlasticDev/CodingStyle coding style].

Comments (0)

Files changed (1)

 __all__ = ["Scheme", "Protocol", "Domain", "IPv6", "IPv4", "Port",
            "Authority", "Path", "URL", "QueryString"]
 
+
 class Normalizable(str):
+    """Normalizable URL components."""
+
     def normalize(self):
         return self
 
 
 
 class Component(Normalizable):
+    """Abstraction about components of URLs."""
+
     pass
 
 
 class Scheme(Component):
+    """First component of URLs."""
+
     def normalize(self, url=None):
         return Scheme(self.lower())
 
 
 class Protocol(Component):
+    """Protocol component of URLs."""
+
     JUSTCOLON = ["mailto"]
 
     def __init__(self, protocol):
 
 
 class Domain(Component):
+    """Hostname component with domains."""
+
     def normalize(self, url=None):
         return Domain(self.lower())
 
 
 class IPv6(Component):
+    """Hostname component with IPv6."""
+
     def normalize(self, url=None):
         methods = ["_contract_consecutive_zeros"]
         ip = self.lower()
 
 
 class IPv4(Component):
+    """Hostname components with IPv4."""
+
     pass
 
 
 class Port(Component):
+    """Port number."""
+
     DEFAULTPORTS = {20: "ftp", 22: "ssh", 23: "telnet", 25: "smtp",
                     80: "http", 194: "irc", 443: "https"}
 
 
 
 class Authority(Component):
+    """Authority component of URLs. It contains hostname and port number."""
+
     PATTERN = re.compile(r"""
         (?P<authority>
             (?:
 
 
 class Path(Component):
-    blahblah = ["http", "https"]
+    """Path component of URLs."""
+
+    SLASH_REQUIRED_SCHEMES = ["http", "https"]
+
     def normalize(self, url=None):
-        if not self and url and url.scheme.lower() in self.blahblah:
+        if (not self and url
+                     and url.scheme.lower() in self.SLASH_REQUIRED_SCHEMES):
             return Path("/")
         return self
 
 
 class URL(Normalizable):
+    """Full URL."""
+
     PATTERN = re.compile(r"""
         (?P<protocol>
             (?P<scheme> \w+ ) :