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

Bdb: add docstrings #74397

Closed
csabella opened this issue Apr 29, 2017 · 10 comments
Closed

Bdb: add docstrings #74397

csabella opened this issue Apr 29, 2017 · 10 comments
Assignees
Labels
3.7 (EOL) end of life docs Documentation in the Doc dir type-feature A feature request or enhancement

Comments

@csabella
Copy link
Contributor

BPO 30211
Nosy @terryjreedy, @csabella
PRs
  • bpo-30211: bdb: add docstrings #1350
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/terryjreedy'
    closed_at = None
    created_at = <Date 2017-04-29.19:54:20.829>
    labels = ['type-feature', '3.7', 'docs']
    title = 'Bdb: add docstrings'
    updated_at = <Date 2017-05-17.00:43:10.820>
    user = 'https://github.com/csabella'

    bugs.python.org fields:

    activity = <Date 2017-05-17.00:43:10.820>
    actor = 'terry.reedy'
    assignee = 'terry.reedy'
    closed = False
    closed_date = None
    closer = None
    components = ['Documentation']
    creation = <Date 2017-04-29.19:54:20.829>
    creator = 'cheryl.sabella'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 30211
    keywords = []
    message_count = 8.0
    messages = ['292598', '293743', '293744', '293752', '293763', '293782', '293813', '293831']
    nosy_count = 3.0
    nosy_names = ['terry.reedy', 'docs@python', 'cheryl.sabella']
    pr_nums = ['1350']
    priority = 'normal'
    resolution = None
    stage = 'commit review'
    status = 'open'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue30211'
    versions = ['Python 3.7']

    @csabella
    Copy link
    Contributor Author

    Add docstrings to Bdb. See bpo-19417.

    @csabella csabella added the docs Documentation in the Doc dir label Apr 29, 2017
    @csabella csabella added 3.7 (EOL) end of life type-feature A feature request or enhancement topic-IDLE docs Documentation in the Doc dir and removed docs Documentation in the Doc dir topic-IDLE labels Apr 29, 2017
    @terryjreedy
    Copy link
    Member

    In the entry at https://docs.python.org/3/library/bdb.html#bdb.Bdb.canonic,
    ", stripped of surrounding angle brackets"
    is wrong, and should be replaced by
    ". 'Filenames' with angle brackets, such as "<stdin>", generated in interactive mode, are returned unchanged"

    >>> 1/0
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    ZeroDivisionError: division by zero

    (IDLE generates "<PyShell#n>", when n is statement number, starting with 0.)

    This and any other doc errors we find should be corrected in this issue, but perhaps in a separate PR that can be backported separately.

    @terryjreedy
    Copy link
    Member

    As I just posted to core-mentorship, my attempt to push to the PR failed. Did you leave the 'allow pushes' box checked when you created the PR?

    @terryjreedy
    Copy link
    Member

    The bdb class or __init__ docstring needs to document the data members with a short explanation. Some of the args need better explanation. Some of this I may fill in *after* reviewing the proposed tests, when I understand the code better. Reviewing pdb and IDLE's Idb and Debugger (my real interest here) will help.

    is_skipped_module is public, by its name, but is not in the doc.

    break_here: " If the breakpoint is a temporary one, this method deletes it." maybe (if flag from effective is True)

    The first comment and the code that follows do not seem to match. IDLE does not set breakpoints for functions, so I cannot test the behavior here with its debugger.

    set_break doc says filename should be canonic, but function then calls canonic. So canonic not needed. If it is, result is self.fncache[canonic_filename] = self.fncache[canonic_filename]. But I will leave suggestion as is for now.

    get_stack: return 'size of the higher part': If higher part does not stop as self.botframe (which might be None?), the size is of the lower part. I need to review frame and tb objects pin down this docstring.

    I just pushed my changes. Please review for typos and anything you think is a new error. Otherwise, I think this is about good enough to merge.

    @csabella
    Copy link
    Contributor Author

    Thank you. I had some questions that I put on the commit.

    You're right about it saying it must be in canonic form and then it calls canonic. I figured someone added the call later to prevent an error, but didn't change the warning, but I didn't know if I should change it.

    I added a comment about get_stack on github. I know I'm missing something here, but I had trouble documenting that because it didn't look like it was doing what the doc said.

    I'm not at my regular computer this week, so I can't add any changes until Saturday. I'll do the is_skipped_module doc then.

    Thank you for the edits on the other docstrings. They make a lot more sense now. Although I still don't like the user_* ones. I hadn't changed them from the original before, but it feels like they should say something else, like what's expected of them. The test example within bdb.py helped me understand what can be done with them.

    @terryjreedy
    Copy link
    Member

    I plan to merge when I can. Possible future improvements for bdb.py.

    1. Bdb attributes.
    2. Say what user_xyz functions might do. Anything better than 'Intervene in debugging process.'?
    3. Clarify what get_stack does.

    Improvement for bdb.rst (optional for this issue).

    1. Add is_skipped_module
    2. Fix overt errors we are sure of, noted above
    • canonic: <> not stripped
    • break_here: temps *may* be deleted
    • get_stack: length may or may not be what says.

    @terryjreedy
    Copy link
    Member

    New changeset 0774e79 by terryjreedy (csabella) in branch 'master':
    bpo-30211: bdb: add docstrings (bpo-1350)
    0774e79

    @terryjreedy
    Copy link
    Member

    I still need to push a News Entry.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    @slateny
    Copy link
    Contributor

    slateny commented May 14, 2022

    Taking a look at bdb.py, the methods have docstrings, and the __init__ args are documented in the docstrings of the classes, so looks like this is resolved.

    @slateny slateny closed this as completed May 14, 2022
    @terryjreedy
    Copy link
    Member

    Thank you. Whether I did or did not add a news entry 5 years ago is irrelevant now.

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life docs Documentation in the Doc dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants