Beispiel #1
0
    def __init__(self, K, threads):
        self.logger = logging.getLogger()

        self.K = K
        self.compl = bytes.maketrans('ACGT', 'TGCA')
        self.kmerCols, self.kmerToCanonicalIndex = self.__makeKmerColNames()

        self.totalThreads = threads
Beispiel #2
0
                                    compare_attrs)
        return dict([(k, getattr(self, k)) for k in compare_attrs
                     if hasattr(self, k) and k not in ("passwd", "password")])


def diffSets(old, new):
    if not isinstance(old, set):
        old = set(old)
    if not isinstance(new, set):
        new = set(new)
    return old - new, new - old


# Remove potentially harmful characters from builder name if it is to be
# used as the build dir.
badchars_map = bytes.maketrans(b"\t !#$%&'()*+,./:;<=>?@[\\]^{|}~",
                               b"______________________________")


def safeTranslate(s):
    if isinstance(s, text_type):
        s = s.encode('utf8')
    return s.translate(badchars_map)


def encodeString(s, encoding='utf-8'):
    if isinstance(s, text_type):
        return s.encode(encoding)
    return s


def none_or_str(x):
Beispiel #3
0
        return {k: getattr(self, k)
                for k in compare_attrs
                if hasattr(self, k) and k not in ("passwd", "password")}


def diffSets(old, new):
    if not isinstance(old, set):
        old = set(old)
    if not isinstance(new, set):
        new = set(new)
    return old - new, new - old


# Remove potentially harmful characters from builder name if it is to be
# used as the build dir.
badchars_map = bytes.maketrans(b"\t !#$%&'()*+,./:;<=>?@[\\]^{|}~",
                               b"______________________________")


def safeTranslate(s):
    if isinstance(s, str):
        s = s.encode('utf8')
    return s.translate(badchars_map)


def none_or_str(x):
    if x is not None and not isinstance(x, str):
        return str(x)
    return x


def unicode2bytes(x, encoding='utf-8', errors='strict'):