Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: Clean-up docstrings for wildcard query methods and classes introduced in #62. #63

Merged
merged 6 commits into from
Jun 13, 2024

Conversation

LinZhihao-723
Copy link
Member

@LinZhihao-723 LinZhihao-723 commented Jun 12, 2024

References

Description

The docstrings in the new methods and classes introduced in #62 were not properly rendered in the doc webpage. There are two problems to solve:

  1. For overloaded methods, no auto docstring generation is supported: autodoc: Allow overloaded functions to have different docstrings sphinx-doc/sphinx#7787. Therefore, we need to manually write docstrings for every signature in Sphinx documentation format.
  2. We need to add a docstring for FullStringWildcardQuery's init function, otherwise, Sphinx will use the base class init, which is marked as deprecated in this case.

Validation performed

Build the site locally and ensure it is rendered as expected.

  1. For add_wildcard_query:
    image

  2. For FullStringWildcardQuery:
    image

@LinZhihao-723 LinZhihao-723 changed the title Docs: Update docstring of the methods and class introduced in #62. Docs: Update docstring of the methods and class introduced in (#62). Jun 12, 2024
@LinZhihao-723 LinZhihao-723 changed the title Docs: Update docstring of the methods and class introduced in (#62). Docs: Update docstring of the methods and class introduced in #62 Jun 12, 2024
@LinZhihao-723 LinZhihao-723 changed the title Docs: Update docstring of the methods and class introduced in #62 Docs: Update docstring of the methods and class introduced in #62. Jun 12, 2024
" should not be used directly. To create a wildcard query, please explicit instantiate"
" `clp_ffi_py.wildcard_query.SubstringWildcardQuery` or"
" `clp_ffi_py.wildcard_query.FullStringWildcardQuery`.",
reason=":class:`~clp_ffi_py.wildcard_query.WildcardQuery` is supposed to be an abstract"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While we're on the topic, I think it's worth improving the docstrings in this file.

WildcardQuery:

    An abstract class defining a wildcard query. Users should instantiate a
    wildcard query through :class:`SubstringWildcardQuery` or
    :class:`FullStringWildcardQuery`.

    A wildcard string may contain the following types of wildcards:

    1. '*': match 0 or more characters.
    2. '?': match any single character.

    Each wildcard can be escaped using a preceding '\\\\' (a single backslash).
    Other characters that are escaped are treated as normal characters.

WildcardQuery().__init__.deprecated:

        reason=":class:`WildcardQuery` will soon be made abstract and should"
        " not be used directly. To create a wildcard query, instead use"
        " :class:`SubstringWildcardQuery` or :class:`FullStringWildcardQuery`."

SubstringWildcardQuery:

    A wildcard query that can match a substring in a log event's message, in
    contrast with :class:`FullStringWildcardQuery` where the needs to match the
    entire message.

    This class is derived from :class:`WildcardQuery` by adding both a prefix
    and a postfix wildcard ("*") to the input wildcard string.

FullStringWildcardQuery:

    A wildcard query where the query must match the entirety of the log event's
    message, in contrast with :class:`SubstringWildcardQuery` where the query
    only needs to match a substring.

    This class is derived from :class:`WildcardQuery` as a more explicit
    interface for full-string matches.

    Users can create a match that's anchored to only one end of the message by
    adding a prefix OR postfix wildcard ("*").

All case_sensitive params:

        :param case_sensitive: Whether to perform case-sensitive matching.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make sense. Pushed

Copy link
Member

@kirkrodrigues kirkrodrigues left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the PR title, how about:

Docs: Clean-up docstrings for wildcard query methods and classes introduced in #62.

@LinZhihao-723
Copy link
Member Author

For the PR title, how about:

Docs: Clean-up docstrings for wildcard query methods and classes introduced in #62.

lgtm

@LinZhihao-723 LinZhihao-723 changed the title Docs: Update docstring of the methods and class introduced in #62. Docs: Clean-up docstrings for wildcard query methods and classes introduced in #62. Jun 13, 2024
@LinZhihao-723 LinZhihao-723 merged commit 2c1d42a into y-scope:main Jun 13, 2024
58 of 59 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants