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
| # Happily turned this ugly thing: | |
| class Foo(object): | |
| pass | |
| class Bar(object): | |
| pass | |
| class User(object): | |
| def collect(objects): | |
| foos = [x for x in objects if isinstance(x, Foo)] |
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 buildbot.process.properties import WithProperties | |
| from buildbot.steps.shell import ShellCommand | |
| from buildbot.interface import LOG_CHANNEL_STDERR as STDERR | |
| class Nose(ShellCommand): | |
| def __init__(self): | |
| self.coverage_path = '/var/www/foo/coverage-%s' | |
| self.coverage_url = 'http://example.com/foo/coverage-%s' | |
| d = WithProperties('--cover-html-dir=' + self.coverage_path, | |
| 'buildnumber') |
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 VerboseCommand(ShellCommand): | |
| def __init__(self, command=None): | |
| ShellCommand.__init__(self, command=command + ['-v']) |
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 VerboseCommand(ShellCommand): | |
| def __init__(self, command=None, is_factory_call=True): | |
| ShellCommand.__init__(self, command=command) | |
| if is_factory_call: | |
| self.addFactoryArguments(is_factory_call=False) | |
| else: | |
| self.command = self.command + ['-v'] |
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
| def selfish(f): | |
| def wrapper(self, *args, **kwargs): | |
| f.func_globals.update(dict((x, getattr(self, x)) for x in dir(self))) | |
| return f(self, *args, **kwargs) | |
| return wrapper | |
| class Test(object): | |
| def foo(self): | |
| print "foo!" | |
| @selfish |
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 VCR: | |
| function eject: | |
| _rewind | |
| _open_lid | |
| class VCRTest: | |
| function test_rewinds_when_ejecting: | |
| # stuff | |
| function test_opens_lid_to_eject: |
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 VCR: | |
| function eject(should_rewind=True): | |
| if should_rewind: | |
| rewind | |
| _open_lid | |
| class VCRTest: | |
| function test_rewinds_when_ejecting: | |
| # stuff | |
| function test_opens_lid_to_eject: |
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 VCR: | |
| function eject: | |
| _open_lid | |
| function rewind: | |
| # stuff | |
| class VCRTest: | |
| function test_opens_lid_to_eject: | |
| # stuff | |
| function test_rewind_actually_spins_tape: |
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
| lklkj |
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
| public class SessionConverter extends ClassicConverter { | |
| @Override | |
| public String convert(ILoggingEvent event) { | |
| RequestAttributes attrs = RequestContextHolder.getRequestAttributes(); | |
| if (attrs != null) { | |
| return attrs.getSessionId(); | |
| } | |
| return "NO_SESSION"; | |
| } | |
| } |
OlderNewer