Skip to content

Instantly share code, notes, and snippets.

View johnberroa's full-sized avatar

John johnberroa

View GitHub Profile
@johnberroa
johnberroa / remove_umlauts.py
Created July 26, 2018 20:00
Remove umlauts from text in Python
def remove_umlaut(string):
"""
Removes umlauts from strings and replaces them with the letter+e convention
:param string: string to remove umlauts from
:return: unumlauted string
"""
u = 'ü'.encode()
U = 'Ü'.encode()
a = 'ä'.encode()
A = 'Ä'.encode()
@johnberroa
johnberroa / absorber.py
Last active October 11, 2019 15:05
Replace any class with this to essentially disable all references to it in code. Use this instead of many try/excepts or ifs.
class Disabled:
"""Class that absorbs all attribute and method calls on it"""
def __init__(self, *args, **kwargs):
pass
def __getattr__(self, item):
return self
def __call__(self, *args, **kwargs):