v.0.10.0 redesign prj structure, multi dev containers
This commit is contained in:
39
pico-client/utils/simple_counter.py
Normal file
39
pico-client/utils/simple_counter.py
Normal file
@@ -0,0 +1,39 @@
|
||||
class SimpleCounter:
|
||||
_value: int
|
||||
|
||||
def __init__(self):
|
||||
self._value = 0
|
||||
|
||||
@property
|
||||
def value(self):
|
||||
return self._value
|
||||
|
||||
@value.setter
|
||||
def value(self, value):
|
||||
self._value = value
|
||||
|
||||
# Arithmetic operators
|
||||
def __add__(self, other):
|
||||
return self._value + other
|
||||
|
||||
def __sub__(self, other):
|
||||
return self._value - other
|
||||
|
||||
# In-place operators
|
||||
def __iadd__(self, other):
|
||||
self._value += other
|
||||
return self
|
||||
|
||||
def __isub__(self, other):
|
||||
self._value -= other
|
||||
return self
|
||||
|
||||
# Conversion and representation
|
||||
def __int__(self):
|
||||
return self._value
|
||||
|
||||
def __str__(self):
|
||||
return str(self._value)
|
||||
|
||||
def __repr__(self):
|
||||
return f"SimpleCounter(value={self._value})"
|
||||
Reference in New Issue
Block a user