File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4242 from xml .etree import ElementTree
4343
4444from .backports import subprocess
45- from .country_codes import get_country_code
4645from .which import which
4746
4847
@@ -303,19 +302,8 @@ def _get_languages(cls) -> set:
303302 url = urllib .parse .urljoin (cls ._url , "Languages" )
304303 languages = set ()
305304 for e in cls ._get_root (url , num_tries = 1 ):
306- language = e .get ("abbr" )
307- if len (re .split (r"[_-]" , language )) < 2 :
308- match = re .search (r"\((.*?)\)" , e .get ("name" ))
309- if match :
310- country_name = match .group (1 )
311- try :
312- country_code = get_country_code (country_name )
313- except KeyError :
314- warnings .warn (
315- "unknown language: {!r}" .format (e .get ("name" )))
316- else :
317- language += "-" + country_code
318- languages .add (language )
305+ languages .add (e .get ("abbr" ))
306+ languages .add (e .get ("abbrWithVariant" ))
319307 return languages
320308
321309 @classmethod
Load diff This file was deleted.
Original file line number Diff line number Diff line change 77from collections import namedtuple
88
99import language_tool
10- from language_tool .country_codes import get_country_code
1110
1211
1312class TestLanguageTool (unittest .TestCase ):
@@ -111,35 +110,5 @@ def test_version(self):
111110 self .assertTrue (version )
112111
113112
114- class TestCountryCodes (unittest .TestCase ):
115- tests = {
116- "Australian" : "AU" ,
117- "Canadian" : "CA" ,
118- "GB" : "GB" ,
119- "New Zealand" : "NZ" ,
120- "South African" : "ZA" ,
121- "US" : "US" ,
122- "Austria" : "AT" ,
123- "Germany" : "DE" ,
124- "Swiss" : "CH" ,
125- "Brazil" : "BR" ,
126- "Portugal" : "PT" ,
127-
128- "Australia" : "AU" ,
129- "Canada" : "CA" ,
130- "United Kingdom" : "GB" ,
131- "South Africa" : "ZA" ,
132- "United States" : "US" ,
133- "Switzerland" : "CH" ,
134-
135- "Austrian" : "AT" ,
136- "Brazilian" : "BR" ,
137- }
138-
139- def test_country_codes (self ):
140- for country , code in self .tests .items ():
141- self .assertEqual (get_country_code (country ), code )
142-
143-
144113if __name__ == "__main__" :
145114 unittest .main ()
You can’t perform that action at this time.
0 commit comments