<commit_before># -*- coding: utf-8 -*-

"""Contains a single decorator function for inheriting docstrings."""

__date__ = '2014-05-25'  # YYYY-MM-DD

import sys
import functools


if sys.version_info[0] < 3:
    import types
    ClassType = types.ClassType

    def iteritems(d):
        return d.iteritems()
else:
    ClassType = type

    def iteritems(d):
        return d.items()


def inherit_docstrings(cls):
    """Class decorator for inheriting docstrings.

    Automatically inherits base class doc-strings if not present in the
    derived class.

    """
    @functools.wraps(cls)
    def _inherit_docstrings(cls):
        if not isinstance(cls, (type, ClassType)):
            raise RuntimeError("Type is not a class")

        for name, value in iteritems(vars(cls)):
            if isinstance(getattr(cls, name), types.MethodType):
                if not getattr(value, '__doc__', None):
                    for base in cls.__bases__:<commit_msg>Fixed a Python 3+ import error<commit_after># -*- coding: utf-8 -*-

"""Contains a single decorator function for inheriting docstrings."""

__date__ = '2014-05-25'  # YYYY-MM-DD

import sys
import types
import functools


if sys.version_info[0] < 3:
    ClassType = types.ClassType

    def iteritems(d):
        return d.iteritems()
else:
    ClassType = type

    def iteritems(d):
        return d.items()


def inherit_docstrings(cls):
    """Class decorator for inheriting docstrings.

    Automatically inherits base class doc-strings if not present in the
    derived class.

    """
    @functools.wraps(cls)
    def _inherit_docstrings(cls):
        if not isinstance(cls, (type, ClassType)):
            raise RuntimeError("Type is not a class")

        for name, value in iteritems(vars(cls)):
            if isinstance(getattr(cls, name), types.MethodType):
                if not getattr(value, '__doc__', None):
                    for base in cls.__bases__:
{'fraction_non_alphanumeric': 0.10501810657009829, 'fraction_numerical': 0.01189860320744956, 'mean_word_length': 2.662878787878788, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5593561', 'n_tokens_mistral': 601, 'n_tokens_neox': 573, 'n_words': 178}