.. toctree:: :glob: helpers/*
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
| --- worker.log 2023-03-23 14:56:46.365050154 +0100 | |
| +++ job.log 2023-03-23 14:58:55.505729917 +0100 | |
| @@ -25,8 +25,6 @@ target_branch: | |
| 2023-03-23 11:57:05.612 DEBUG Cloning repo https://github.com/storaged-project/libbytesize.git -> /tmp/sandcastle using repository cache at /repository-cache | |
| 2023-03-23 11:57:05.612 DEBUG Repositories in the cache (1 project(s)): | |
| - lost+found | |
| -2023-03-23 11:57:05.612 DEBUG Popen(['git', 'clone', '-v', '--tags', '--', 'https://github.com/storaged-project/libbytesize.git', '/tmp/sandcastle'], cwd=/src, universal_newlines=True, shell=None, istream=None) | |
| -2023-03-23 11:57:06.558 DEBUG Cmd(['git', 'clone', '-v', '--tags', '--', 'https://github.com/storaged-project/libbytesize.git', '/tmp/sandcastle'])'s unused stdout: | |
| 2023-03-23 11:57:06.637 DEBUG We just cloned git repo https://github.com/storaged-project/libbytesize.git to /tmp/sandcastle. | |
| 2023-03-23 11:57:06.637 DEBUG Parsed ref 'master' from the repo <git.repo.base.Repo '/tmp/sandcastle/.git'>. |
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 inspect | |
| import types | |
| def setattr_(instance, name, value): | |
| try: | |
| if next(iter(inspect.signature(value).parameters), None) == 'self': | |
| # bind method to instance | |
| value = types.MethodType(value, instance) | |
| except TypeError: |
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
| #!/usr/bin/python | |
| import Xlib | |
| import Xlib.display | |
| def main(): | |
| display = Xlib.display.Display() | |
| screen = display.screen() | |
| screen.root.change_attributes(event_mask=Xlib.X.SubstructureNotifyMask) |
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
| diff --git a/test.c b/test.c | |
| index 05799bd..0f0153c 100644 | |
| --- a/test.c | |
| +++ b/test.c | |
| @@ -10,6 +10,11 @@ int variableA = -1; | |
| */ | |
| int variableB = 0; | |
| +/* | |
| + * this is variable C |
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
| .PHONY: install | |
| dirA: | |
| mkdir -p $(DESTDIR)/$@ | |
| touch $(DESTDIR)/$@/fileA | |
| touch $(DESTDIR)/$@/fileB | |
| dirB: | |
| mkdir -p $(DESTDIR)/$@ | |
| touch $(DESTDIR)/$@/fileX |
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
| match = re.match(r'^rgb:([A-Fa-f0-9]{1,4})/([A-Fa-f0-9]{1,4})/([A-Fa-f0-9]{1,4})$', spec) | |
| if match: | |
| rgb = match.groups()[1:] | |
| bitwidth = max([len(s) for s in rgb]) * 4 | |
| return [int(s, 16) for s in rgb], bitwidth |
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
| SUCCESS = logging.INFO + N | |
| ... | |
| _nameToLevel = { | |
| 'SUCCESS': SUCCESS, | |
| ... | |
| } |
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 __getattr__(self, level): | |
| severity = CUSTOM_LOGGING_LEVELS.get(level) | |
| def log_to_level(message, *args, **kwargs): | |
| if self.isEnabledFor(severity): | |
| self._log(severity, message, *args, **kwargs) | |
| if severity: | |
| return log_to_level |
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 Test(object): | |
| def __getattr__(self, name): | |
| def test(arg1, arg2): | |
| print('args: {0} {1}'.format(arg1, arg2)) | |
| if name in ['testA', 'testB']: | |
| return test | |
| raise AttributeError | |
NewerOlder