Skip to content

Commit

Permalink
restore copydoc (for Python 3.8 & 3.10) just without type hints
Browse files Browse the repository at this point in the history
  • Loading branch information
schiebel committed Feb 5, 2024
1 parent 3851c63 commit 21adc31
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion casagui/apps/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
from ..utils import copydoc
initialize_session()

#@copydoc(InteractiveClean)
@copydoc(InteractiveClean)
def run_iclean( *args, **kwargs ):
ic = InteractiveClean( *args, **kwargs )
return ic( )
14 changes: 12 additions & 2 deletions casagui/utils/_copydoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,16 @@
#
########################################################################
'''Reuse doc string'''
import os

#--------------------------------------------------
# ParamSpec is available with Python >= 3.10
#--------------------------------------------------
#from typing import Callable, TypeVar, ParamSpec
#
#P = ParamSpec("P")
#T = TypeVar("T")
#
def copydoc(src):
#def copydoc(src: Callable[P, T]):
# """Copy documentation from src"""
#
Expand All @@ -42,4 +44,12 @@ def copydoc(src):
# return dest
#
# return decorator
pass

def copydoc(src):
"""Copy documentation from src"""

def decorator(dest):
dest.__doc__ = src.__doc__
return dest

return decorator

0 comments on commit 21adc31

Please sign in to comment.