File tree Expand file tree Collapse file tree 1 file changed +0
-9
lines changed
Expand file tree Collapse file tree 1 file changed +0
-9
lines changed Original file line number Diff line number Diff line change @@ -20,27 +20,18 @@ def inherit_docs(source_class):
2020 """
2121
2222 def decorator (target_class ):
23- # 1. Steal the main class docstring if the target doesn't have one
2423 if not target_class .__doc__ and source_class .__doc__ :
2524 target_class .__doc__ = source_class .__doc__
2625
27- # 2. Iterate over all attributes in the source class
2826 for name , source_item in vars (source_class ).items ():
29- # Check if the target class has the same attribute
3027 if name in vars (target_class ):
3128 target_item = getattr (target_class , name )
3229
33- # Only copy if the target doesn't have a docstring
34- # and the source does
3530 if hasattr (target_item , "__doc__" ) and not target_item .__doc__ :
3631 if hasattr (source_item , "__doc__" ) and source_item .__doc__ :
3732 try :
38- # Use functools.update_wrapper or manual assignment
39- # for methods, properties, and static methods
4033 target_item .__doc__ = source_item .__doc__
4134 except AttributeError :
42- # Read-only attributes or certain built-ins
43- # might skip docstring assignment
4435 pass
4536
4637 return target_class
You can’t perform that action at this time.
0 commit comments