Fix broken examples and wrong docstrings in documentation, deprecate old aliases CLong/Long.#948
Draft
Carreau wants to merge 2 commits into
Draft
Fix broken examples and wrong docstrings in documentation, deprecate old aliases CLong/Long.#948Carreau wants to merge 2 commits into
Carreau wants to merge 2 commits into
Conversation
Broken examples (all raised when run as written): - config.rst: the sample Configurable uses Integer but imports Int (NameError) - migration.rst: the observe_compat example read change['value'], a key that does not exist in change dicts (KeyError); use change['new'] - examples/myapp.py: the docstring described a 'shortname' tag feature that does not exist anywhere in traitlets (the tag was inert metadata); describe Application.aliases, the real mechanism, and drop the inert tag Wrong or incomplete docstrings: - api.rst claimed old_value is None when a dynamic-default trait is set before first read; it is actually the trait type's static default (or Undefined). Also fix a doubled word. - trait_types.rst still described Python 2 int/long behavior for Integer/Int/Long despite the package requiring Python 3 - import_item's Returns section claimed it returns a module; for dotted names it returns the named attribute, which can be any object - ArgParseConfigLoader.__init__ carried a copy-pasted Returns section describing a Config object; __init__ returns nothing - UseEnum's example dropped a stale Python 3.4/enum34 backport comment
Int and Long were separate traits back when Python 2 distinguished int and long; they are now just integers. Make Integer the canonical class and turn Int, Long (and the casting CLong) into deprecated subclasses that emit a DeprecationWarning on use, steering users to Integer / CInt. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Broken examples (all raised when run as written):
(NameError)
that does not exist in change dicts (KeyError); use change['new']
that does not exist anywhere in traitlets (the tag was inert
metadata); describe Application.aliases, the real mechanism, and
drop the inert tag
Wrong or incomplete docstrings:
before first read; it is actually the trait type's static default
(or Undefined). Also fix a doubled word.
Integer/Int/Long despite the package requiring Python 3
dotted names it returns the named attribute, which can be any object
describing a Config object; init returns nothing
--
I need to gather stats, but I think maybe we should not deprecate
Int.