This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.template import engines | |
class ReprMixin(object): | |
TEMPLATE = """<{{ class }}{% for field, value in fields_values %} | |
{{ field }}={{ value }}{% endfor %}>""" | |
def __repr__(self): | |
django_engine = engines['django'] | |
template = django_engine.from_string(self.TEMPLATE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
README: | |
Side Note: | |
I've never used attrs before, so thought it would be fun to try them out | |
see https://glyph.twistedmatrix.com/2016/08/attrs.html for an explanation of attrs | |
Runtime Complexity: | |
I originaly wrote as nexted for loops, which is O(n^2), but switched to |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
____ ____ _____ | |
| _ \| _ \| ___| | |
| | | | |_) | | | |
| |_| | _ <| _| | |
|____/|_| \_\_| | |
_____ _ _____ _ _ ___ _ _ _ | |
|_ _(_)_ __ ___ |_ _| __(_) ___| | _____ ( _ ) | | | | __ _ ___| | _____ | |
| | | | '_ \/ __| | || '__| |/ __| |/ / __| / _ \/\ | |_| |/ _` |/ __| |/ / __| |