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
# This file is part of Buildbot. Buildbot is free software: you can | |
# redistribute it and/or modify it under the terms of the GNU General Public | |
# License as published by the Free Software Foundation, version 2. | |
# | |
# This program is distributed in the hope that it will be useful, but WITHOUT | |
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | |
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | |
# details. | |
# | |
# You should have received a copy of the GNU General Public License along with |
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 | |
import types | |
class ExplicitOverloadType(type): | |
def __init__(self, name, bases, dict): | |
for key, val in dict.items(): | |
if isinstance(val, types.FunctionType): | |
if getattr(val, "_is_overriden", False): |
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 | |
import sys | |
ports = set() | |
for s in ("tcp","udp","tcp6","udp6"): | |
with open("/proc/net/%s" % s) as f: | |
for l in f.readlines()[1:]: | |
ports.add(int(l.split(":")[2][:4],16)) |
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 *-* | |
from __future__ import print_function, unicode_literals | |
import os | |
import sys | |
import subprocess | |
def get_merged_version(cwd, branch): | |
""" Attempt to find the version at which branch was merged """ |
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 | |
# inspired by http://tech.myemma.com/python-pep8-git-hooks/ | |
from __future__ import with_statement | |
import re | |
import subprocess | |
import sys | |
def system(*args, **kwargs): | |
kwargs.setdefault('stdout', subprocess.PIPE) |
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 types import FunctionType, CodeType | |
import opcode | |
import struct | |
import sys | |
_BUILDMAP = opcode.opmap['BUILD_MAP'] | |
if sys.version_info.major > 2: | |
from io import BytesIO | |
exop = int |
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
for i in range(1, 100): | |
print ''.join(["Fizz", "Buzz"][1-(i%3==0):1+(i%5==0)]) or i |
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 p.a | |
B notfound | |
A <module 'p.b' from 'p/b.py'> |