src/eric7/EricNetwork/EricTldExtractor.py

branch
eric7
changeset 9500
5771348ded12
parent 9413
80c06d472826
child 9653
e67609152c5e
equal deleted inserted replaced
9499:dd389c57c2f0 9500:5771348ded12
13 # 13 #
14 14
15 import collections 15 import collections
16 import os 16 import os
17 17
18 from dataclasses import dataclass
19
18 from PyQt6.QtCore import QObject, QUrl, qWarning 20 from PyQt6.QtCore import QObject, QUrl, qWarning
19 21
20 from eric7.EricWidgets import EricMessageBox 22 from eric7.EricWidgets import EricMessageBox
21 23
22 24
25 @dataclass
23 class EricTldHostParts: 26 class EricTldHostParts:
24 """ 27 """
25 Class implementing the host parts helper. 28 Class implementing the host parts helper.
26 """ 29 """
27 30
28 def __init__(self): 31 host: str = ""
29 """ 32 tld: str = ""
30 Constructor 33 domain: str = ""
31 """ 34 registrableDomain: str = ""
32 self.host = "" 35 subdomain: str = ""
33 self.tld = ""
34 self.domain = ""
35 self.registrableDomain = ""
36 self.subdomain = ""
37 36
38 37
39 class EricTldExtractor(QObject): 38 class EricTldExtractor(QObject):
40 """ 39 """
41 Class implementing the TLD Extractor. 40 Class implementing the TLD Extractor.
199 @param host host address to be split 198 @param host host address to be split
200 @type str 199 @type str
201 @return splitted host address 200 @return splitted host address
202 @rtype EricTldHostParts 201 @rtype EricTldHostParts
203 """ 202 """
204 hostParts = EricTldHostParts() 203 tld = self.tld(host)
205 hostParts.host = host 204 domain = self.__domainHelper(host, tld)
206 hostParts.tld = self.tld(host) 205 registrableDomain = self.__registrableDomainHelper(domain, tld)
207 hostParts.domain = self.__domainHelper(host, hostParts.tld) 206 subdomain = self.__subdomainHelper(host, registrableDomain)
208 hostParts.registrableDomain = self.__registrableDomainHelper( 207
209 hostParts.domain, hostParts.tld 208 hostParts = EricTldHostParts(
209 host=host,
210 tld=tld,
211 domain=domain,
212 registrableDomain=registrableDomain,
213 subdomain=subdomain,
210 ) 214 )
211 hostParts.subdomain = self.__subdomainHelper(host, hostParts.registrableDomain)
212 215
213 return hostParts 216 return hostParts
214 217
215 def dataSearchPaths(self): 218 def dataSearchPaths(self):
216 """ 219 """

eric ide

mercurial