Package: just-time-it
JustTimeit.pyDon't have enough dependencies with poor documentation in your projects? Have an undying desire for more broken code for important functions? Eat cereal with water? Or just an all-round masochist? (Just kidding, we're all programmers, we're all masochists)Boy, do I have the solution for you.Hurt me harder daddyToo lazy to wrap your functions with this?importtimestarttime=time.time()defshakyRelationship(Wallet):whileTrue:ifWallet=="empty":breakelifWallet=="thicc":# stop lying to yourselfbreakreturn"big sad"YourWallet="empty"result=shakyRelationship(YourWallet)print(time.time()-starttime)>>>1.0940176924541224e-06Now you can wrap it like thisfromtimefunctionsimporttimefuncMyWallet="thicc"result=timefunc("shakyRelationship(MyWallet)",globals=globals())# Only include globals() if you have variables>>>TimeTakenforyourfunction:1.0940176924541224e-06.Repeated1time(s).This package can't save your relationships but it can save you that 3 seconds.Now you can go spend more time learning Tensorflow for that interesting python uncensoring project.RequirementsPython3.6+. Have anything older than Python3.6? You're either working corporate (see:FAQ) or a masochist (see:Support/Personal Issues)Installationpipinstalljust-time-itQuickstart/DocumentationLets define a example functiondefmultiply(x,y):returnx*yprintr=0 (default)Print function name without argumentsfromtimefunctionsimporttimefuncresult=timefunc("multiply(3,5)")>>>TimeTakenformultiply:1.0940176924541224e-06.Repeated1time(s).printr=1Print Function name with argumentsfromtimefunctionsimporttimefuncresult=timefunc("multiply(3,5)",printr=1)>>>TimeTakenformultiply(3,5):1.0940176924541224e-06.Repeated1time(s).printr=2Print nothingfromtimefunctionsimporttimefuncresult=timefunc("multiply(3,5)",printr=2)>>>returnr=0 (default)Return the result of your functionfromtimefunctionsimporttimefuncresult=timefunc("multiply(3,5)")print(result)>>>TimeTakenformultiply(3,5):1.0940176924541224e-06.Repeated1time(s).>>>15returnr=1Return the time taken for the function to completefromtimefunctionsimporttimefuncresult=timefunc("multiply(3,5)",returnr=1)print(result)>>>TimeTakenformultiply(3,5):1.0940176924541224e-06.Repeated1time(s).>>>1.0940176924541224e-06returnr=2Return both result and time takenfromtimefunctionsimporttimefuncresult=timefunc("multiply(3,5)",returnr=2)print(result)>>>TimeTakenformultiply(3,5):1.0940176924541224e-06.Repeated1time(s).>>>(1.0940176924541224e-06,15)returnr=2,printr=2Return result and time taken without printing anythingfromtimefunctionsimporttimefuncresult=timefunc("multiply(3,5)",printr=2,returnr=2)print(result)>>>(1.0940176924541224e-06,15)GlobalsHave variables? use globals=globals()fromtimefunctionsimporttimefuncx=3y=5result=timefunc("multiply(x,y)",globals=globals())print(result)>>>TimeTakenformultiply(x,y):1.0940176924541224e-06.Repeated1time(s).TechnologyJustTimeit.py uses Object-Oriented, Dynamic Programming, Augmented Reality, Machine Learning, Artificial Neural Networks, GPT-2 and my Big Data to ensure you save that 3 seconds.Testinggood jokeSupportFor Technical Issues:www.stackoverflow.comFor Personal Issues: Sounds like your own personal problem, let's keep it that way.FAQShould I use this?No, this is like the worst possible combination of words to ever grace this Earth.Can I change the README to be more professional?I'll put this entire file through an OwO generator if you tryI'm a born masochist, I still use Python2.3. Will there be support for Python3.5 or other earlier depreciated versions?If I wanted to torture myself with compatibility issues, I might as well go into the dating scene.Caveats/Warnings (Serious)This code is not accurate. Any function you are testing that is under 0.1 seconds should NOT rely on this package. A normal function that executes for around 0.9 seconds will look like this under different codeExample slow code# Around 0.9 seconds to rundefmultiply(x,y):fordinrange(10000000):xy=d*x*yreturnNoneNormal time.time()starttime=time.time()multiply(3,7)print("time.time()",(time.time()-starttime))>>>time.time()0.8946394920349121timeit with setupprint("timesetup",timeit.timeit("multiply(3,7)",setup="from /__main__ import multiply",number=ss))>>>timesetup0.9034562206940011timefunc (this package)timefunc("multiply(3,7)")>>>TimeTakenformultiply:0.84726418995648.Repeated1time(s).They are roughly similar with a maximum of 0.1 differences. You can try altering range(10000000) to see the differences in the code.LicenseGLWT(Good Luck With That) Public License