Package: overloadlib
FeaturesIntroduces@overload,@overrideand@<Function>.adddecorators, allowing one to overload and override functions. Functions are then called according to their argument types:@overloaddeffunc(var:str):returnvar# via @<Function>.add@func.adddef_(var:int)->str:returnstr(var*5)# via @overload@overloaddeffunc()->str:return"Functions don't need to have arguments."# via @override@override(funcs=[func])defnew(str_1:str,int_1:int):returnstr_1*int_1assertfunc("a")=="a"==new("a")assertfunc(1)=="5"==new(1)assertfunc()=="Functions don't need to have arguments."==new()assertnew("house",2)=="househouse"Raises human readable errors, if no callable was determined with the given arguments. For example the following given:@overloaddefsome_func(str_1:str,int_1:int):returnstr_1+str(int_1)@overloaddefsome_func(str_1:str):returnstr_1Calling:>>> some_func(str_1=2)
PyOverloadError:
Error when calling:
(__main__.some_func):
        def some_func(str_1: int):
                ...:
        'str_1' needs to be of type (<class 'str'>,) (is type <class 'int'>)or>>>some_func(10)__main__.NoFunctionFoundError:Nomatchingfunctionfound.Followingdefinitionsof'some_func'werefound:(__main__.some_func):defsome_func(str_1:str,int_1:int):...(__main__.some_func):defsome_func(str_1:str):...Thefollowingcallwasmade:(__main__.some_func):defsome_func(int_1:int):...Any type of variables is allowed: Build-in ones likestr, int, Listbut also own ones, like classes etc.@overloadusesget_type_hintsto identify the right function call via type-checking. Hence, it may also be used as a type-checker for functions.Forgot, which overloads of a specific function have been implemented? No worries, you can print them with their typing information usingprint(func_versions_info(<my_func>)), e.g.>>> print(func_versions_info(some_func))

Following overloads of 'some_func' exist:
(__main__.some_func):
         def some_func(str_1: str, int_1: int):
               ...
(__main__.some_func):
         def some_func(str_1: str):
               ...RequirementsRequires Python 3.7+.InstallationYou can installOverloadlibviapipfromPyPI:$pipinstalloverloadlibor install withPoetry$poetryaddoverloadlibThen you can run$overloadlib--helpor withPoetry:$poetryrunoverloadlib--help<details>
<summary>Installing Poetry</summary>
<p>To download and install Poetry run (with curl):$curl-sSLhttps://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py|python-or on windows (without curl):$(Invoke-WebRequest-Urihttps://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py-UseBasicParsing).Content|python-</p>
</details>UninstallIf you wan to uninstall the package, simply run$pipuninstalloverloadlibor withPoetry:$poetryremoveoverloadlibUsagePlease see theCommand-line Referencefor details.ContributingContributions are very welcome.
To learn more, see theContributor Guide.LicenseDistributed under the terms of theMIT license,Overloadlibis free and open source software.IssuesIf you encounter any problems,
pleasefile an issuealong with a detailed description.CreditsThis project was generated by a template inspired by@cjolowicz’sHypermodern Python Cookiecuttertemplate and@TezRomacH’spython-package-template