Skip to content
Snippets Groups Projects
Commit 06bee48f authored by fxk8y's avatar fxk8y :spider:
Browse files

………

parent 6e621c5f
No related branches found
No related tags found
No related merge requests found
class MyDec:
def __init__(*args, **kwargs):
print(f'__init__ed with: {args} aaand: {kwargs}')
def __call__(self, *args, **kwargs):
print(f'called with: {args} aaand: {kwargs}')
if callable(args[0]):
print('used as decorated with arguments')
return self.execute
else:
print('used as decorator WITHOUT arguments (a long time ago ;) )')
self.execute()
def execute(*args, **kwargs):
print(f'executed with: {args} aaand: {kwargs}')
class C:
@MyDec
def decorated0(self, *args):
print(f'decorated0 called with: {args}')
return 'decorated0'
print('\n' + '-'*120 + '\n')
class D:
@MyDec(name='ctor-test')
def decorated42(self, *args):
print(f'decorated42 called with: {args}')
return 'decorated42'
c = C()
d = D()
......@@ -3,6 +3,9 @@ from typing import Any, Callable
# TODO: dev is stalled!
# at first, we'll design easier things to not loose focus on the project
# Just use simple properties and triggers to get the same (write-only) behavior
class MQTTProperty:
def __init__(self, name: str = None, initialValue: Any = None, getConvert: Callable[[str], Any] = None, setConvert: Callable[[Any], str] = None, readOnly = False):
......@@ -49,6 +52,27 @@ class MQTTProperty:
class MQTTTrigger:
def __init__(self):
pass
class Device:
def __init__(self, torch, name, online = True):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment