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
#!/usr/bin/env python3 | |
""" | |
Generate the repr for a class | |
""" | |
import argparse | |
import io | |
import subprocess | |
import platform | |
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
def strip_accents(text): | |
""" | |
Strips the accents, replace the dd, and lower case | |
""" | |
text = text.replace("đ", "d").replace("Đ", "d") | |
text = unicodedata.normalize("NFD", text) | |
text = text.encode("ascii", "ignore") | |
text = text.decode("utf-8") | |
text = text.lower() | |
return text |
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
# Detect platform in bash | |
# https://stackoverflow.com/a/3466183/459745 | |
case $(uname -s) in | |
Linux*) platform=Linux;; | |
Darwin*) platform=Mac;; | |
CYGWIN*) platform=Cygwin;; | |
MINGW*) platform=MinGw;; | |
*) platform=Unknown;; | |
esac |
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
""" | |
This script takes in a single parameter representing a directory | |
and traverse that directory to list the exceptions that are ignored. | |
""" | |
from __future__ import print_function | |
import ast | |
import os | |
import sys |
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
import functools | |
def accessible_while_closed(func): | |
""" | |
A decorator to mark a function as available, even after the object | |
closed. | |
""" | |
func.accessible_while_closed = True | |
return func |
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
Show hidden characters
{ | |
"always_show_minimap_viewport": true, | |
"ensure_newline_at_eof_on_save": true, | |
"font_size": 12, | |
"highlight_line": true, | |
"remember_full_screen": true, | |
"rulers": [72, 80, 120], | |
"show_encoding": true, | |
"show_line_endings": true, | |
"translate_tabs_to_spaces": true, |
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
{ | |
"anaconda_linter_underlines": false, | |
"pep8_max_line_length": 72, | |
"zzz": 1 | |
} |
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
#!/usr/bin/env python3 | |
def main(): | |
pass | |
if __name__ == "__main__": | |
main() |
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
class Foo(object): | |
def __invalid_action(self, *args, **kwargs): | |
raise IOError('Sorry, we are closed') | |
def __init__(self): | |
print 'create' | |
def read(self): | |
print 'read' |
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
#!/usr/bin/env python | |
""" Why return a mutable attribute might be dangerous """ | |
class Car(object): | |
def __init__(self, owners): | |
self._owners = owners | |
def get_owners(self): | |
""" Return a list of owners. Getter/setters are evil, but that |
NewerOlder