mirror of
https://github.com/zoriya/guessit.git
synced 2026-06-08 20:35:34 +00:00
Close resource after usage
This closes the resource 'tlds-alpha-by-domain.txt' after usage. Fixes #575
This commit is contained in:
committed by
GitHub
parent
a54e8acdd3
commit
b1d3f6fcb0
@@ -27,9 +27,12 @@ def website(config):
|
||||
rebulk = rebulk.regex_defaults(flags=re.IGNORECASE).string_defaults(ignore_case=True)
|
||||
rebulk.defaults(name="website")
|
||||
|
||||
tlds = [l.strip().decode('utf-8')
|
||||
for l in resource_stream('guessit', 'tlds-alpha-by-domain.txt').readlines()
|
||||
if b'--' not in l][1:] # All registered domain extension
|
||||
with resource_stream('guessit', 'tlds-alpha-by-domain.txt') as tld_file:
|
||||
tlds = [
|
||||
tld.strip().decode('utf-8')
|
||||
for tld in tld_file.readlines()
|
||||
if b'--' not in tld
|
||||
][1:] # All registered domain extension
|
||||
|
||||
safe_tlds = config['safe_tlds'] # For sure a website extension
|
||||
safe_subdomains = config['safe_subdomains'] # For sure a website subdomain
|
||||
|
||||
Reference in New Issue
Block a user