This file contains hidden or 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 collections import defaultdict | |
| class Dog(object): | |
| __instance_count = defaultdict(int) | |
| def __init__(self): | |
| self.__instance_count[self.__class__.__name__] += 1 | |
| def __del__(self): |
This file contains hidden or 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 collections import defaultdict | |
| class Dog(object): | |
| __instance_count = defaultdict(int) | |
| def __init__(self, colour='white', breed='mutt'): | |
| self.colour = colour | |
| self.breed = breed |
This file contains hidden or 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 RegexDict(dict): | |
| def __get_regex_keys(self, pattern): | |
| return (key for key in self.keys() if pattern.match(key)) | |
| def __getitem__(self, key): | |
| if hasattr(key, 'match'): | |
| return [self[matched_key] for matched_key in self.__get_regex_keys(key)] | |
| else: | |
| return super(RegexDict, self).__getitem__(key) | |
This file contains hidden or 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
| <snip from Nginx logs> | |
| 190.141.110.70 - - [15/Jun/2013:19:16:45 +0000] "POST /wp-includes/Text/Diff/.svn/props/user.php HTTP/1.1" 200 50 "-" "Mozilla/5.0" "-" | |
| 190.141.110.70 - - [15/Jun/2013:19:16:46 +0000] "POST /wp-includes/Text/Diff/.svn/props/user.php HTTP/1.1" 200 50 "-" "Mozilla/5.0" "-" | |
| 190.141.110.70 - - [15/Jun/2013:19:16:47 +0000] "POST /wp-includes/Text/Diff/.svn/props/user.php HTTP/1.1" 200 50 "-" "Mozilla/5.0" "-" | |
| 190.141.110.70 - - [15/Jun/2013:19:16:48 +0000] "POST /wp-includes/Text/Diff/.svn/props/user.php HTTP/1.1" 200 50 "-" "Mozilla/5.0" "-" | |
| 190.141.110.70 - - [15/Jun/2013:19:16:49 +0000] "POST /wp-includes/Text/Diff/.svn/props/user.php HTTP/1.1" 200 50 "-" "Mozilla/5.0" "-" | |
| 190.141.110.70 - - [15/Jun/2013:19:16:51 +0000] "POST /wp-includes/Text/Diff/.svn/props/user.php HTTP/1.1" 200 50 "-" "Mozilla/5.0" "-" | |
| 190.141.110.70 - - [15/Jun/2013:19:16:52 +0000] "POST /wp-includes/Text/Diff/.svn/props/user.php HTTP/1.1" 200 50 "-" "Mozilla/5.0" "-" | |
| 190.141.110.70 - - [15/Jun/2013:19:16:53 +0000] " |
This file contains hidden or 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
| Standings: | |
| 1) Chris (0+0-0-0) [0.00%] => 0 points | |
| 2) Trevor (0+0-0-0) [0.00%] => 0 points | |
| 3) Michael (0+0-0-0) [0.00%] => 0 points | |
| 4) Angus (0+0-0-0) [0.00%] => 0 points | |
| 5) Sam (0+0-0-0) [0.00%] => 0 points | |
| 6) Ben (0+0-0-0) [0.00%] => 0 points | |
| 7) Jake (0+0-0-0) [0.00%] => 0 points | |
| Round 1 |
This file contains hidden or 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 freeseer.framework.config.options import StringOption, IntegerOption | |
| from freeseer.framework.config.persist import ParserConfig | |
| class FreeseerConfig(ParserConfig): | |
| name = StringOption('Michael Tom-Wing') | |
| age = IntegerOption(0) | |
| if __name__ == '__main__': |
This file contains hidden or 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 ConfigParser | |
| from ..core import ConfigManager | |
| class ConfigParserManager(ConfigManager): | |
| def __init__(self, manager, filename): | |
| super(ConfigParserManager, self).__init__(manager, filename) | |
| self.parser = ConfigParser.ConfigParser() | |
| self.parser.read([self.filepath]) |
This file contains hidden or 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 freeseer.framework.config.core import Config, ProfileManager | |
| from freeseer.framework.config.persist import ( | |
| ConfigParserManager, | |
| JSONConfigManager, | |
| ) | |
| import freeseer.framework.config.options as options | |
| class FreeseerConfig(Config): | |
| videodir = options.FolderOption('/home/mtomwing/Videos', auto_create=True) |
This file contains hidden or 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 freeseer.framework.config.core import Config, ProfileManager | |
| from freeseer.framework.config.persist import ( | |
| ConfigParserManager, | |
| JSONConfigManager, | |
| ) | |
| import freeseer.framework.config.options as options | |
| class FreeseerConfig(Config): | |
| videodir = options.FolderOption('/home/mtomwing/Videos', auto_create=True) |
This file contains hidden or 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 functools import reduce | |
| import sys | |
| from grammar import ( | |
| Program, | |
| Statement, | |
| Function, | |
| ArgumentList, | |
| Argument, | |
| Integer, |
OlderNewer