-
Notifications
You must be signed in to change notification settings - Fork 19.6k
avoid failure when docstrings have been stripped (python -OO) #21477
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
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -487,6 +487,6 @@ def decode_predictions(preds, top=5): | |||||||||||||||
A Keras model instance. | ||||||||||||||||
""" | ||||||||||||||||
|
||||||||||||||||
setattr(DenseNet121, "__doc__", DenseNet121.__doc__ + DOC) | ||||||||||||||||
setattr(DenseNet169, "__doc__", DenseNet169.__doc__ + DOC) | ||||||||||||||||
setattr(DenseNet201, "__doc__", DenseNet201.__doc__ + DOC) | ||||||||||||||||
setattr(DenseNet121, "__doc__", (DenseNet121.__doc__ or '') + DOC) | ||||||||||||||||
setattr(DenseNet169, "__doc__", (DenseNet169.__doc__ or '') + DOC) | ||||||||||||||||
setattr(DenseNet201, "__doc__", (DenseNet201.__doc__ or '') + DOC) | ||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The current implementation uses To ensure consistency and improve code clarity, consider using a conditional check within a loop. This aligns the behavior with the rest of the changes in this pull request and enhances readability.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Adding a conditional check ensures that the docstring replacement only occurs if the setattr(DenseNet121, "__doc__", (DenseNet121.__doc__ or '') + DOC)
setattr(DenseNet169, "__doc__", (DenseNet169.__doc__ or '') + DOC)
setattr(DenseNet201, "__doc__", (DenseNet201.__doc__ or '') + DOC) |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -586,6 +586,7 @@ def decode_predictions(preds, top=5): | |||||||||||||||||||||||||||||||||
A Model instance. | ||||||||||||||||||||||||||||||||||
""" | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
setattr(ResNet50, "__doc__", ResNet50.__doc__ + DOC) | ||||||||||||||||||||||||||||||||||
setattr(ResNet101, "__doc__", ResNet101.__doc__ + DOC) | ||||||||||||||||||||||||||||||||||
setattr(ResNet152, "__doc__", ResNet152.__doc__ + DOC) | ||||||||||||||||||||||||||||||||||
if ResNet50.__doc__ is not None: | ||||||||||||||||||||||||||||||||||
setattr(ResNet50, "__doc__", ResNet50.__doc__ + DOC) | ||||||||||||||||||||||||||||||||||
setattr(ResNet101, "__doc__", ResNet101.__doc__ + DOC) | ||||||||||||||||||||||||||||||||||
setattr(ResNet152, "__doc__", ResNet152.__doc__ + DOC) | ||||||||||||||||||||||||||||||||||
Comment on lines
+589
to
+592
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The current check
Suggested change
Comment on lines
+589
to
+592
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Adding a conditional check ensures that the docstring replacement only occurs if the
Suggested change
|
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -203,6 +203,7 @@ def decode_predictions(preds, top=5): | |||||||||||||||||||||||||||||||||
A Model instance. | ||||||||||||||||||||||||||||||||||
""" | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
setattr(ResNet50V2, "__doc__", ResNet50V2.__doc__ + DOC) | ||||||||||||||||||||||||||||||||||
setattr(ResNet101V2, "__doc__", ResNet101V2.__doc__ + DOC) | ||||||||||||||||||||||||||||||||||
setattr(ResNet152V2, "__doc__", ResNet152V2.__doc__ + DOC) | ||||||||||||||||||||||||||||||||||
if ResNet50V2.__doc__ is not None: | ||||||||||||||||||||||||||||||||||
setattr(ResNet50V2, "__doc__", ResNet50V2.__doc__ + DOC) | ||||||||||||||||||||||||||||||||||
setattr(ResNet101V2, "__doc__", ResNet101V2.__doc__ + DOC) | ||||||||||||||||||||||||||||||||||
setattr(ResNet152V2, "__doc__", ResNet152V2.__doc__ + DOC) | ||||||||||||||||||||||||||||||||||
Comment on lines
+206
to
+209
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar to
Suggested change
Comment on lines
+206
to
+209
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Adding a conditional check ensures that the docstring replacement only occurs if the
Suggested change
|
Uh oh!
There was an error while loading. Please reload this page.