Skip to content

Commit

Permalink
Fix for babelfish converters lazy loading
Browse files Browse the repository at this point in the history
  • Loading branch information
Toilal committed Nov 19, 2013
1 parent 927b20c commit 8e71c24
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions guessit/language.py
Expand Up @@ -57,9 +57,9 @@ def __init__(self):
self.codes = set()
self.guessit_exceptions = {}

self.alpha3b = babelfish.converters.alpha3b.Alpha3BConverter()
self.alpha2 = babelfish.converters.alpha2.Alpha2Converter()
self.name = babelfish.converters.name.NameConverter()
self.alpha3b = babelfish.language.get_language_converter('alpha3b')
self.alpha2 = babelfish.language.get_language_converter('alpha2')
self.name = babelfish.language.get_language_converter('name')

self.codes |= LANGUAGES | self.alpha3b.codes | self.alpha2.codes | self.name.codes

Expand Down Expand Up @@ -118,7 +118,7 @@ def __init__(self):
self.codes = set()
self.guessit_exceptions = {}

self.name = babelfish.converters.countryname.CountryNameConverter()
self.name = babelfish.country.get_country_converter('name')

self.codes |= set(COUNTRIES.keys()) | self.name.codes

Expand Down

3 comments on commit 8e71c24

@Diaoul
Copy link
Member

@Diaoul Diaoul commented on 8e71c24 Nov 19, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use babelfish.language.get_language_converter and babelfish.country.get_country_converter directly from the babelfish namespace.

@Toilal
Copy link
Member Author

@Toilal Toilal commented on 8e71c24 Nov 20, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't what i've done here ?

@Toilal
Copy link
Member Author

@Toilal Toilal commented on 8e71c24 Nov 20, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can write babelfish.get_country_converter and babelfish.get_language_converter, ok, i'll change this :)

Please sign in to comment.