38 changed files with 866 additions and 95 deletions
@ -0,0 +1,71 @@
|
||||
#!/usr/bin/env python3 |
||||
|
||||
# MIT License |
||||
# |
||||
# Copyright (c) 2024 Eugenio Parodi <ceccopierangiolieugenio AT googlemail DOT com> |
||||
# |
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy |
||||
# of this software and associated documentation files (the "Software"), to deal |
||||
# in the Software without restriction, including without limitation the rights |
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
||||
# copies of the Software, and to permit persons to whom the Software is |
||||
# furnished to do so, subject to the following conditions: |
||||
# |
||||
# The above copyright notice and this permission notice shall be included in all |
||||
# copies or substantial portions of the Software. |
||||
# |
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
||||
# SOFTWARE. |
||||
|
||||
class A(): |
||||
def __init__(self,a,b) -> None: |
||||
self.a = a |
||||
self.b = b |
||||
|
||||
def __eq__(self, value: object) -> bool: |
||||
print(f"A.eq - {self=},{value=}") |
||||
return self.a==value.a and self.b==value.b |
||||
|
||||
class B(): |
||||
def __init__(self,a,b) -> None: |
||||
self.a = a |
||||
self.b = b |
||||
|
||||
def __eq__(self, value: object) -> bool: |
||||
print(f"B.eq - {self=},{value=}") |
||||
return self.a==value.a and self.b==value.b |
||||
|
||||
class C(A): |
||||
def __eq__(self, value: object) -> bool: |
||||
print(f"C(A).eq - {self=},{value=}") |
||||
return self.a==value.a and self.b==value.b |
||||
|
||||
class D(): |
||||
def __init__(self,a,b) -> None: |
||||
self.a = a |
||||
self.b = b |
||||
|
||||
a = A(1,2) |
||||
aa = a |
||||
b = B(1,2) |
||||
bb = b |
||||
c = C(1,2) |
||||
cc = c |
||||
d = D(1,2) |
||||
|
||||
|
||||
print(f"{(a==aa)=}") |
||||
print(f"{(aa==a)=}") |
||||
print(f"{(a==c )=}") |
||||
print(f"{(c==a )=}") |
||||
print(f"{(a==b )=}") |
||||
print(f"{(b==a )=}") |
||||
print(f"{(b==c )=}") |
||||
print(f"{(c==b )=}") |
||||
print(f"{(c==d )=}") |
||||
print(f"{(d==c )=}") |
||||
@ -0,0 +1,76 @@
|
||||
#!/usr/bin/env python3 |
||||
|
||||
# MIT License |
||||
# |
||||
# Copyright (c) 2024 Eugenio Parodi <ceccopierangiolieugenio AT googlemail DOT com> |
||||
# |
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy |
||||
# of this software and associated documentation files (the "Software"), to deal |
||||
# in the Software without restriction, including without limitation the rights |
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
||||
# copies of the Software, and to permit persons to whom the Software is |
||||
# furnished to do so, subject to the following conditions: |
||||
# |
||||
# The above copyright notice and this permission notice shall be included in all |
||||
# copies or substantial portions of the Software. |
||||
# |
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
||||
# SOFTWARE. |
||||
|
||||
class A(): |
||||
def __init__(self,a,b) -> None: |
||||
self.a = a |
||||
self.b = b |
||||
|
||||
def __str__(self): |
||||
return f"a={self.a}, b={self.b}" |
||||
|
||||
def __sub__(self, other: object) -> bool: |
||||
return f"A( ). sub - {self=},{other=}" |
||||
|
||||
class B(): |
||||
def __init__(self,a,b) -> None: |
||||
self.a = a |
||||
self.b = b |
||||
|
||||
def __sub__(self, other: object) -> bool: |
||||
return f"B( ). sub - {self=},{other=}" |
||||
|
||||
class C(A): |
||||
def __sub__(self, other: object) -> bool: |
||||
return f"C(A). sub - {self=},{other=}" |
||||
|
||||
class D(C): |
||||
def __init__(self,a,b) -> None: |
||||
self.a = a |
||||
self.b = b |
||||
def __sub__(self, other: object) -> bool: |
||||
return f"D(C). sub - {self=},{other=}" |
||||
def __rsub__(self, other: object) -> bool: |
||||
return f"D(C).R-sub - {self=},{other=}" |
||||
|
||||
a = A(1,2) |
||||
aa = a |
||||
b = B(1,2) |
||||
bb = b |
||||
c = C(1,2) |
||||
cc = c |
||||
d = D(1,2) |
||||
|
||||
|
||||
print(f"{(a-aa)=}") |
||||
print(f"{(aa-a)=}") |
||||
print(f"{(a-c )=}") |
||||
print(f"{(c-a )=}") |
||||
print(f"{(a-b )=}") |
||||
print(f"{(b-a )=}") |
||||
print(f"{(b-c )=}") |
||||
print(f"{(c-b )=}") |
||||
print(f"{(c-d )=}") |
||||
print(f"{(d-c )=}") |
||||
print(f"{(d-d )=}") |
||||
@ -0,0 +1,73 @@
|
||||
#!/usr/bin/env python3 |
||||
|
||||
# MIT License |
||||
# |
||||
# Copyright (c) 2024 Eugenio Parodi <ceccopierangiolieugenio AT googlemail DOT com> |
||||
# |
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy |
||||
# of this software and associated documentation files (the "Software"), to deal |
||||
# in the Software without restriction, including without limitation the rights |
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
||||
# copies of the Software, and to permit persons to whom the Software is |
||||
# furnished to do so, subject to the following conditions: |
||||
# |
||||
# The above copyright notice and this permission notice shall be included in all |
||||
# copies or substantial portions of the Software. |
||||
# |
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
||||
# SOFTWARE. |
||||
|
||||
class A(): |
||||
def __init__(self,a,b) -> None: |
||||
self.a = a |
||||
self.b = b |
||||
|
||||
def __str__(self): return f"a={self.a}, b={self.b}" |
||||
def __sub__(self, other): return f"A( ). sub {type(self).__name__} {type(other).__name__}" |
||||
def __or__( self, other): return f"A( ). or {type(self).__name__} {type(other).__name__}" |
||||
def __ror__(self, other): return f"A( ).R-or {type(self).__name__} {type(other).__name__}" |
||||
|
||||
class B(): |
||||
def __init__(self,a,b) -> None: |
||||
self.a = a |
||||
self.b = b |
||||
|
||||
def __sub__(self, other): return f"B( ). sub {type(self).__name__} {type(other).__name__}" |
||||
|
||||
class C(A): |
||||
def __sub__(self, other): return f"C(A). sub {type(self).__name__} {type(other).__name__}" |
||||
def __or__( self, other): return f"C(C). or {type(self).__name__} {type(other).__name__}" |
||||
|
||||
class D(C): |
||||
def __init__(self,a,b) -> None: |
||||
self.a = a |
||||
self.b = b |
||||
def __sub__( self, other): return f"D(C). sub {type(self).__name__} {type(other).__name__}" |
||||
def __rsub__(self, other): return f"D(C).R-sub {type(self).__name__} {type(other).__name__}" |
||||
def __or__( self, other): return f"D(C). or {type(self).__name__} {type(other).__name__}" |
||||
def __ror__( self, other): return f"D(C).R-or {type(self).__name__} {type(other).__name__}" |
||||
a = A(1,2) |
||||
aa = a |
||||
b = B(1,2) |
||||
bb = b |
||||
c = C(1,2) |
||||
cc = c |
||||
d = D(1,2) |
||||
|
||||
|
||||
print(f"{(a-aa)=} | {(a|aa)=}") |
||||
print(f"{(aa-a)=} | {(aa|a)=}") |
||||
print(f"{(a-c )=} | {(a|c )=}") |
||||
print(f"{(c-a )=} | {(c|a )=}") |
||||
print(f"{(a-b )=} | {(a|b )=}") |
||||
print(f"{(b-a )=} | {(b|a )=}") |
||||
print(f"{(b-c )=} | {(b|c )=}") |
||||
print(f"{(c-b )=} | {(c|b )=}") |
||||
print(f"{(c-d )=} | {(c|d )=}") |
||||
print(f"{(d-c )=} | {(d|c )=}") |
||||
print(f"{(d-d )=} | {(d|d )=}") |
||||
@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env python3 |
||||
|
||||
# MIT License |
||||
# |
||||
# Copyright (c) 2021 Eugenio Parodi <ceccopierangiolieugenio AT googlemail DOT com> |
||||
# |
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy |
||||
# of this software and associated documentation files (the "Software"), to deal |
||||
# in the Software without restriction, including without limitation the rights |
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
||||
# copies of the Software, and to permit persons to whom the Software is |
||||
# furnished to do so, subject to the following conditions: |
||||
# |
||||
# The above copyright notice and this permission notice shall be included in all |
||||
# copies or substantial portions of the Software. |
||||
# |
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
||||
# SOFTWARE. |
||||
|
||||
|
||||
|
||||
for i in range(0xF): |
||||
a,b,c,d = i&1,i&1<<1,i&1<<2,i&1<<3 |
||||
print(f"{a} {b} {c} {d} = {a or not (b or c or d)} -> {a or not (b or c) and not d}") |
||||
@ -0,0 +1,48 @@
|
||||
#!/usr/bin/env python3 |
||||
|
||||
# MIT License |
||||
# |
||||
# Copyright (c) 2021 Eugenio Parodi <ceccopierangiolieugenio AT googlemail DOT com> |
||||
# |
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy |
||||
# of this software and associated documentation files (the "Software"), to deal |
||||
# in the Software without restriction, including without limitation the rights |
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
||||
# copies of the Software, and to permit persons to whom the Software is |
||||
# furnished to do so, subject to the following conditions: |
||||
# |
||||
# The above copyright notice and this permission notice shall be included in all |
||||
# copies or substantial portions of the Software. |
||||
# |
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
||||
# SOFTWARE. |
||||
|
||||
import sys, os |
||||
|
||||
|
||||
sys.path.append(os.path.join(sys.path[0],'../..')) |
||||
import TermTk as ttk |
||||
|
||||
class WidLink1(ttk.TTkWidget): |
||||
def paintEvent(self, canvas: ttk.TTkCanvas): |
||||
canvas.drawText(pos=( 0,0),text=ttk.TTkString('Link1abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',ttk.TTkColor.fg('#FFFF00', link="http://www.google.com"))) |
||||
canvas.drawText(pos=( 0,1),text=ttk.TTkString('Link2abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',ttk.TTkColor.fg('#00FFFF', link="http://www.reddit.com"))) |
||||
canvas.drawText(pos=( 0,2),text=ttk.TTkString('Link3abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',ttk.TTkColor.fg('#FF00FF', link="http://www.github.com"))) |
||||
canvas.drawText(pos=( 0,3),text=ttk.TTkString('Link4abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',ttk.TTkColor.fg('#FF0000', link="http://www.example.com"))) |
||||
canvas.drawText(pos=( 0,4),text=ttk.TTkString('Link5abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',ttk.TTkColor.fg('#00FF00', link="file:///home/"))) |
||||
canvas.drawText(pos=(20,3),text=ttk.TTkString('<XXXXXXXXX>',ttk.TTkColor.fg('#0000FF', link="http:///www.python.com/"))) |
||||
return super().paintEvent(canvas) |
||||
|
||||
root = ttk.TTk() |
||||
|
||||
win1 = ttk.TTkWindow(parent=root, layout=ttk.TTkGridLayout(), size=(50,10)) |
||||
WidLink1(parent=win1) |
||||
win1 = ttk.TTkWindow(parent=root, layout=ttk.TTkGridLayout(), size=(50,10)) |
||||
WidLink1(parent=win1) |
||||
|
||||
root.mainloop() |
||||
@ -0,0 +1,88 @@
|
||||
#!/usr/bin/env python3 |
||||
|
||||
# MIT License |
||||
# |
||||
# Copyright (c) 2023 Eugenio Parodi <ceccopierangiolieugenio AT googlemail DOT com> |
||||
# |
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy |
||||
# of this software and associated documentation files (the "Software"), to deal |
||||
# in the Software without restriction, including without limitation the rights |
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
||||
# copies of the Software, and to permit persons to whom the Software is |
||||
# furnished to do so, subject to the following conditions: |
||||
# |
||||
# The above copyright notice and this permission notice shall be included in all |
||||
# copies or substantial portions of the Software. |
||||
# |
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
||||
# SOFTWARE. |
||||
|
||||
import timeit, pickle |
||||
|
||||
class A(): |
||||
def __init__(self,a,b) -> None: |
||||
self.a = a |
||||
self.b = b |
||||
|
||||
def __eq__(self, value: object) -> bool: |
||||
# print(f"A.eq - {self=},{value=}") |
||||
return self.a==value.a and self.b==value.b |
||||
|
||||
class B(): |
||||
def __init__(self,a,b) -> None: |
||||
self.a = a |
||||
self.b = b |
||||
|
||||
def __eq__(self, value: object) -> bool: |
||||
# print(f"B.eq - {self=},{value=}") |
||||
return self.a==value.a and self.b==value.b |
||||
|
||||
class C(A): |
||||
def __eq__(self, value: object) -> bool: |
||||
# print(f"C(A).eq - {self=},{value=}") |
||||
return self.a==value.a and self.b==value.b |
||||
|
||||
|
||||
a = A(1,2) |
||||
aa = a |
||||
b = B(1,2) |
||||
bb = b |
||||
c = C(1,2) |
||||
cc = c |
||||
|
||||
print(f"{(a==aa)=}") |
||||
print(f"{(aa==a)=}") |
||||
print(f"{(a==c )=}") |
||||
print(f"{(c==a )=}") |
||||
print(f"{(a==b )=}") |
||||
print(f"{(b==a )=}") |
||||
print(f"{(b==c )=}") |
||||
print(f"{(c==b )=}") |
||||
|
||||
def test_ti_00_x000(a,aa,b,c): return len([a==aa for _ in range(1000)]) |
||||
def test_ti_00_x001(a,aa,b,c): return len([a==aa for _ in range(1000)]) |
||||
def test_ti_00_x002(a,aa,b,c): return len([a==aa for _ in range(1000)]) |
||||
def test_ti_00_x003(a,aa,b,c): return len([a==aa for _ in range(1000)]) |
||||
def test_ti_00_x004(a,aa,b,c): return len([a==aa for _ in range(100)]) |
||||
def test_ti_01_A_AA(a,aa,b,c): return len([a==aa for _ in range(1000)]) |
||||
def test_ti_01_AA_A(a,aa,b,c): return len([aa==a for _ in range(1000)]) |
||||
def test_ti_02_A_B_(a,aa,b,c): return len([a==b for _ in range(1000)]) |
||||
def test_ti_02_B_A_(a,aa,b,c): return len([b==a for _ in range(1000)]) |
||||
def test_ti_03_A_C_(a,aa,b,c): return len([a==c for _ in range(1000)]) |
||||
def test_ti_03_C_A_(a,aa,b,c): return len([c==a for _ in range(1000)]) |
||||
def test_ti_04_B_C_(a,aa,b,c): return len([b==c for _ in range(1000)]) |
||||
def test_ti_04_C_B_(a,aa,b,c): return len([c==b for _ in range(1000)]) |
||||
|
||||
loop = 1000 |
||||
|
||||
a = {'a':a,'aa':aa,'b':b,'c':c} |
||||
|
||||
for testName in sorted([tn for tn in globals() if tn.startswith('test_ti_')]): |
||||
result = timeit.timeit(f'{testName}(*a)', globals=globals(), number=loop) |
||||
# print(f"test{iii}) fps {loop / result :.3f} - s {result / loop:.10f} - {result / loop} {globals()[testName](*a)}") |
||||
print(f"{testName} | {result / loop:.10f} sec. | {loop / result : 15.3f} Fps ╞╡-> {globals()[testName](*a)}") |
||||
@ -0,0 +1,59 @@
|
||||
#!/usr/bin/env python3 |
||||
|
||||
# MIT License |
||||
# |
||||
# Copyright (c) 2024 Eugenio Parodi <ceccopierangiolieugenio AT googlemail DOT com> |
||||
# |
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy |
||||
# of this software and associated documentation files (the "Software"), to deal |
||||
# in the Software without restriction, including without limitation the rights |
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
||||
# copies of the Software, and to permit persons to whom the Software is |
||||
# furnished to do so, subject to the following conditions: |
||||
# |
||||
# The above copyright notice and this permission notice shall be included in all |
||||
# copies or substantial portions of the Software. |
||||
# |
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
||||
# SOFTWARE. |
||||
|
||||
|
||||
import os |
||||
import sys |
||||
import argparse |
||||
import operator |
||||
import json |
||||
import timeit |
||||
|
||||
sys.path.append(os.path.join(sys.path[0],'../..')) |
||||
import TermTk as ttk |
||||
|
||||
c01 = [ttk.TTkColor.fg( f'#0000{x:02X}') for x in range(200)] |
||||
c02 = [ttk.TTkColor.bg( f'#0000{x:02X}') for x in range(200)] |
||||
c03 = [ttk.TTkColor.fg( f'#0000{x:02X}')+ttk.TTkColor.UNDERLINE for x in range(200)] |
||||
c04 = [ttk.TTkColor.bg( f'#0000{x:02X}')+ttk.TTkColor.UNDERLINE for x in range(200)] |
||||
c10 = [ttk.TTkColor.fgbg(f'#0000{x:02X}',f'#0000{x:02X}') for x in range(200)] |
||||
c11 = [ttk.TTkColor.fgbg(f'#0000{x:02X}',f'#0000{x:02X}')+ttk.TTkColor.BOLD for x in range(200)] |
||||
c20 = [ttk.TTkColor.fgbg(f'#0000{x:02X}',f'#0000{x:02X}','http://www.example.com/{x:02X}')+ttk.TTkColor.UNDERLINE for x in range(200)] |
||||
|
||||
def test_ti_01(): return len(''.join([str(x) for x in c01])) |
||||
def test_ti_02(): return len(''.join([str(x) for x in c02])) |
||||
def test_ti_03(): return len(''.join([str(x) for x in c03])) |
||||
def test_ti_04(): return len(''.join([str(x) for x in c04])) |
||||
def test_ti_10(): return len(''.join([str(x) for x in c10])) |
||||
def test_ti_11(): return len(''.join([str(x) for x in c11])) |
||||
def test_ti_20(): return len(''.join([str(x) for x in c20])) |
||||
|
||||
loop = 10000 |
||||
|
||||
a = {} |
||||
|
||||
for testName in sorted([tn for tn in globals() if tn.startswith('test_ti_')]): |
||||
result = timeit.timeit(f'{testName}(*a)', globals=globals(), number=loop) |
||||
# print(f"test{iii}) fps {loop / result :.3f} - s {result / loop:.10f} - {result / loop} {globals()[testName](*a)}") |
||||
print(f"{testName} | {result / loop:.10f} sec. | {loop / result : 15.3f} Fps ╞╡-> {globals()[testName](*a)}") |
||||
Loading…
Reference in new issue