eric6/WebBrowser/SafeBrowsing/SafeBrowsingUrl.py

changeset 7988
c4c17121eff8
parent 7923
91e843545d9a
child 8207
d359172d11be
equal deleted inserted replaced
7987:e8eb8370ea94 7988:c4c17121eff8
37 def hashes(self): 37 def hashes(self):
38 """ 38 """
39 Public method to get the hashes of all possible permutations of the URL 39 Public method to get the hashes of all possible permutations of the URL
40 in canonical form. 40 in canonical form.
41 41
42 @return generator for the URL hashes 42 @yield URL hashes
43 @rtype generator of bytes 43 @ytype bytes
44 """ 44 """
45 for variant in self.permutations(self.canonical()): 45 for variant in self.permutations(self.canonical()):
46 urlHash = self.digest(variant) 46 urlHash = self.digest(variant)
47 yield urlHash 47 yield urlHash
48 48
131 Static method to determine all permutations of host name and path 131 Static method to determine all permutations of host name and path
132 which can be applied to blacklisted URLs. 132 which can be applied to blacklisted URLs.
133 133
134 @param url URL string to be permuted 134 @param url URL string to be permuted
135 @type str 135 @type str
136 @return generator of permuted URL strings 136 @yield permutated URL strings
137 @rtype generator of str 137 @ytype str
138 """ 138 """
139 def hostPermutations(host): 139 def hostPermutations(host):
140 """ 140 """
141 Method to generate the permutations of the host name. 141 Method to generate the permutations of the host name.
142 142
143 @param host host name 143 @param host host name
144 @type str 144 @type str
145 @return generator of permuted host names 145 @yield permutated host names
146 @rtype generator of str 146 @ytype str
147 """ 147 """
148 if re.match(r'\d+\.\d+\.\d+\.\d+', host): 148 if re.match(r'\d+\.\d+\.\d+\.\d+', host):
149 yield host 149 yield host
150 return 150 return
151 parts = host.split('.') 151 parts = host.split('.')
159 """ 159 """
160 Method to generate the permutations of the path. 160 Method to generate the permutations of the path.
161 161
162 @param path path to be processed 162 @param path path to be processed
163 @type str 163 @type str
164 @return generator of permuted paths 164 @yield permutated paths
165 @rtype generator of str 165 @ytype str
166 """ 166 """
167 yield path 167 yield path
168 query = None 168 query = None
169 if '?' in path: 169 if '?' in path:
170 path, query = path.split('?', 1) 170 path, query = path.split('?', 1)

eric ide

mercurial