Closed sq6jnx closed 9 years ago
HINT#2: add decorator to remove diacritics accents
HINT#3: add function/method/lambda to remove spaces in weather codes dictionary
Not pretty, but works with ł
and Ł
:
# -*- coding: utf-8 -*-
from six import u
from functools import wraps
def remove_accents(function):
""" unicodedata.normalize() doesn't work with ł and Ł"""
@wraps(function)
def wrapper(*args, **kwargs):
return function(*args, **kwargs)\
.replace(u("ą"), "a")\
.replace(u("ć"), "c")\
.replace(u("ę"), "e")\
.replace(u("ł"), "l")\
.replace(u("ń"), "n")\
.replace(u("ó"), "o")\
.replace(u("ś"), "s")\
.replace(u("ź"), "z")\
.replace(u("ż"), "z")
return wrapper
@remove_accents
def test():
return u("Zażółcić gęślą jaźń ZAZÓŁCIĆ GĘŚLĄ JAŹŃ")
print(test())
print(test.__name__)
print(test.__doc__)
I believe I fixed it.
__init__
?pl_google
should be a classget_data()
:HINT: first add methods to "prototype" / parent class, each of which will raise
NotImplementedError
.