<commit_before># -*- coding: utf-8 -*-
#
# Luigi documentation build configuration file, created by
# sphinx-quickstart on Sat Feb  8 00:56:43 2014.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.

import sys
import os
import sphinx.environment
from docutils.utils import get_source_line


def _warn_node(self, msg, node):<commit_msg>Add __repr__() to Parameter when generating docs<commit_after># -*- coding: utf-8 -*-
#
# Luigi documentation build configuration file, created by
# sphinx-quickstart on Sat Feb  8 00:56:43 2014.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.

import sys
import os
import sphinx.environment
from docutils.utils import get_source_line
import luigi
import luigi.parameter


def parameter_repr(self):
    """
    When building documentation, we want Parameter objects to show their
    description in a nice way
    """
    significance = 'Insignificant ' if not self.significant else ''
    class_name = self.__class__.__name__
    has_default = self._default != luigi.parameter._no_value
    default = ' (defaults to {})'.format(self._default) if has_default else ''
    description = (': ' + self.description if self.description else '')
    return significance + class_name + default + description

luigi.parameter.Parameter.__repr__ = parameter_repr


def assertIn(needle, haystack):
    """
    We test repr of Parameter objects, since it'll be used for readthedocs
    """
    assert needle in haystack

# TODO: find a better place to put this!
assertIn('IntParameter', repr(luigi.IntParameter()))
assertIn('defaults to 37', repr(luigi.IntParameter(default=37)))
assertIn('hi mom', repr(luigi.IntParameter(description='hi mom')))
assertIn('Insignificant BoolParameter', repr(luigi.BoolParameter(significant=False)))


def _warn_node(self, msg, node):
{'fraction_non_alphanumeric': 0.08986277113767153, 'fraction_numerical': 0.01239486498450642, 'mean_word_length': 4.580246913580247, 'pattern_counts': {'":': 0, '<': 3, '<?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': '1112077', 'n_tokens_mistral': 663, 'n_tokens_neox': 618, 'n_words': 242}