Check for the presence of docstrings, but ignore some of the options
6247
def hacked_pep257(to_lint):
    
    def ignore(*args, **kwargs):
        pass

    pep257.check_blank_before_after_class = ignore
    pep257.check_blank_after_last_paragraph = ignore
    pep257.check_blank_after_summary = ignore
    pep257.check_ends_with_period = ignore
    pep257.check_one_liners = ignore
    pep257.check_imperative_mood = ignore

    original_check_return_type = pep257.check_return_type

    def better_check_return_type(def_docstring, context, is_script):
        """
        Ignore private methods
        """
        def_name = context.split()[1]
        if def_name.startswith('_') and not def_name.endswith('__'):
            original_check_return_type(def_docstring, context, is_script)

    pep257.check_return_type = better_check_return_type

    errors = []
    for filename in to_lint:
        with open(filename) as f:
            source = f.read()
            if source:
                errors.extend(pep257.check_source(source, filename))
    return '\n'.join([str(error) for error in sorted(errors)])
1095915
def _if_not_freed(f):
    """"""
    @add_signature_to_docstring(f)
    @functools.wraps(f)
    def f_(self, *args, **kwargs):
        if self._freed:
            raise OSError
        return f(self, *args, **kwargs)

    return f_
783896
def strip_rst(docs):
    '''
    
    '''
    for func, docstring in six.iteritems(docs):
        log.debug('Stripping docstring for %s', func)
        if not docstring:
            continue
        docstring_new = docstring if six.PY3 else salt.utils.data.encode(docstring)
        for regex, repl in (
                (r' *.. code-block:: \S+\n{1,2}', ''),
                ('.. note::', 'Note:'),
                ('.. warning::', 'Warning:'),
                ('.. versionadded::', 'New in version'),
                ('.. versionchanged::', 'Changed in version')):
            if six.PY2:
                regex = salt.utils.data.encode(regex)
                repl = salt.utils.data.encode(repl)
            try:
                docstring_new = re.sub(regex, repl, docstring_new)
            except Exception:
                log.debug(
                    'Exception encountered while matching regex %r to '
                    'docstring for function %s', regex, func,
                    exc_info=True
                )
        if six.PY2:
            docstring_new = salt.utils.data.decode(docstring_new)
        if docstring != docstring_new:
            docs[func] = docstring_new
    return docs
1056877
def auto_change_docstring(app, what, name, obj, options, lines):
    
    """
    if what == 'module' and name.startswith('pylatex'):
        lines.insert(0, len(name) * '=')
        lines.insert(0, name)

    hits = 0
    for i, line in enumerate(lines.copy()):
        if line.endswith('\\'):
            lines[i - hits] += lines.pop(i + 1 - hits)
            hits += 1
1135443
def ignore_code(self, code):
        
        if len(code) < 4 and any(s.startswith(code)
                                 for s in self.options.select):
            return False
        return (code.startswith(self.options.ignore) and
                not code.startswith(self.options.select))
806759
def _checkEpytext(self, node_type, node, linenoDocstring):
        
        if node_type not in ['function', 'method']:
            return
        # Check for arguments.
        # If current node is method,
        # then first argument could not have a epytext markup.
        # The first argument usually named 'self'.
        argnames = (node.argnames()[1:] if node_type == 'method'
                    else node.argnames())

        if _isSetter(node_type, node):
            # For setter methods we remove the `value` argument as it
            # does not need to be documented.
            try:
                argnames.remove('value')
            except ValueError:
                # No `value` in arguments.
                pass

        for argname in argnames:
            if node.name.startswith('opt_'):
                # The docstring for option methods is presented as user-facing
                # documentation.  Avoid requiring epytext in them.
                return
            if not re.search(r"@param\s+%s\s*:" % argname, node.doc):
                self.add_message('W9202', line=linenoDocstring,
                                 node=node, args=argname)
            if not re.search(r"@type\s+%s\s*:" % argname, node.doc):
                self.add_message('W9203', line=linenoDocstring,
                                 node=node, args=argname)

        self._checkReturnValueEpytext(node, linenoDocstring)
63260
def render_docstring(self):
        """"""
        default = (' = ' + str(self.default)) if self.default else ''
        opt = 'optional' if self.is_optional else ''
        can_be = ' '.join(self.possible_values) if self.possible_values else ''
        can_be = 'one of [{}]'.format(can_be) if can_be else ''
        type_ = 'of type "' + str(self.type) + '"'
        res = ' '.join([opt, '"' + self.field + '"', default, type_, can_be, '\n'])
        return res.replace('  ', ' ').lstrip()
870663
def _chk_docopt_kws(self, docdict, exp):
        """"""
        for key, val in docdict.items():
            if isinstance(val, str):
                assert '=' not in val, self._err("'=' FOUND IN VALUE", key, val, exp)
            elif key != 'help' and key not in self.exp_keys and key not in self.exp_elems:
                raise RuntimeError(self._err("UNKNOWN KEY", key, val, exp))
140214
def is_ignored(self, options):
        

        if not self.is_change():
            return False

        changes = self.collect()
        if not changes:
            return False

        for change in changes:
            if change.is_change() and not change.is_ignored(options):
                return False
        return True
207597
def _sanitize_config(config):
        ''''''
        if 'checks' in config:
            checks = config['checks']
            if 'structural_checks' not in checks:
                checks['structural_checks'] = []
            if 'neuron_checks' not in checks:
                checks['neuron_checks'] = []
        else:
            raise ConfigError('Need to have "checks" in the config')

        if 'options' not in config:
            L.debug('Using default options')
            config['options'] = {}

        if 'color' not in config:
            config['color'] = False

        return config
728795
function detect_doc(docs, customTags) {
    var ignore_tags = _.union(["param", "return", "author", "version", 
                               "cancelable", "bubbles", "since", "inherits", "todo", "deprecated"], customTags);
    var doc_tags = _.filter(docs, function(tag) { return !_.include(ignore_tags, tag["tagname"]) && !subproperty(tag) });
    return _.compact(_.map(doc_tags, function(tag) { return tag["doc"] })).join(" ");
}
230475
def shall_skip(module, opts):
    # type: (unicode, Any) -> bool
    """"""
    # skip if the file doesn't exist and not using implicit namespaces
    if not opts.implicit_namespaces and not path.exists(module):
        return True

    # skip it if there is nothing (or just \n or \r\n) in the file
    if path.exists(module) and path.getsize(module) <= 2:
        return True

    # skip if it has a "private" name and this is selected
    filename = path.basename(module)
    if filename != '__init__.py' and filename.startswith('_') and \
       not opts.includeprivate:
        return True
    return False
335926
def _skip(options):
    """"""
    values = [options.missing_direct_deps, options.unnecessary_deps]
    return all(v == 'off' for v in values)
778174
def options
      exclude = %w[
        docs
        spec
        vendor
        core.rb
        .js
        templates
        commands
        internal
        support
        Dockerfile
        Dockerfile.base
        Gemfile
        Gemfile.lock
        Guardfile
        LICENSE
        Procfile
        Rakefile
        bin
      ]
      exclude = exclude.map { |word| ['-x', word] }.flatten
      ["-m", "README.md", "--markup", "tomdoc"] + exclude
    end
586527
def _prepare_docstrings():
    """"""
    if config.USEAUTODOC:
        source = inspect.getsource(Options)
        docstrings = source.split('"""')[3::2]
        attributes = [line.strip().split()[0] for line in source.split('\n')
                      if '_Option(' in line]
        for attribute, docstring in zip(attributes, docstrings):
            Options.__dict__[attribute].__doc__ = docstring
758170
def _check_building_options(string):
    
    opener, closer = '{', '}'
    _check_enclosing_characters(string, opener, closer)
    if opener in string:
        if string[-1] != closer:
            raise ValueError(OPTIONS_NOT_LAST)
        ret = True
    else:
        ret = False
    return ret
1145607
def parse_list_or_docstring(options, sps):
    
    import py3status.docstrings as docstrings

    # HARDCODE: make include path to search for user modules
    home_path = os.path.expanduser("~")
    xdg_home_path = os.environ.get("XDG_CONFIG_HOME", "{}/.config".format(home_path))
    options.include_paths = [
        "{}/py3status/modules".format(xdg_home_path),
        "{}/i3status/py3status".format(xdg_home_path),
        "{}/i3/py3status".format(xdg_home_path),
        "{}/.i3/py3status".format(home_path),
    ]
    include_paths = []
    for path in options.include_paths:
        path = os.path.abspath(path)
        if os.path.isdir(path) and os.listdir(path):
            include_paths.append(path)
    options.include_paths = include_paths

    # init
    config = vars(options)
    modules = [x.rsplit(".py", 1)[0] for x in config["module"]]

    # list module names and details
    if config["command"] == "list":
        tests = [not config[x] for x in ["all", "user", "core"]]
        if all([not modules] + tests):
            msg = "missing positional or optional arguments"
            sps["list"].error(msg)
        docstrings.show_modules(config, modules)

    # docstring formatting and checking
    elif config["command"] == "docstring":
        if config["check"]:
            docstrings.check_docstrings(False, config, modules)
        elif config["diff"]:
            docstrings.check_docstrings(True, config, None)
        elif config["update"]:
            if not modules:
                msg = "missing positional arguments or `modules`"
                sps["docstring"].error(msg)
            if "modules" in modules:
                docstrings.update_docstrings()
            else:
                docstrings.update_readme_for_modules(modules)
        else:
            msg = "missing positional or optional arguments"
            sps["docstring"].error(msg)