Skip to content

Commit 68e3b77

Browse files
committed
main branch merged rel branch
2 parents e137132 + c514bf2 commit 68e3b77

File tree

4 files changed

+24
-2
lines changed

4 files changed

+24
-2
lines changed

lyc_pyutils/libs/dotdict.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,10 @@ def fromdict____(cls, dic):
3030
"""
3131
# print(f"fromdict____ dic: {dic}") # Debug
3232
result = DotDict()
33+
3334
for key in dic:
3435
result.setattr____(key, dic[key])
36+
3537
return result
3638

3739
@classmethod
@@ -66,26 +68,34 @@ def __init__(self, *args, **kwargs):
6668
# Set the inherited keys from the custom class level
6769
if selftype is not DotDict and issubclass(selftype, DotDict):
6870
classdict = type(self).__dict__
71+
6972
for key in classdict:
7073
key = str(key)
7174
# print(f"__init__ classdict {key}: {classdict[key]}") # Debug
75+
7276
if not type(self).isprotected____(key):
7377
value = classdict[key]
7478
self.setattr____(key, value)
79+
# end for
80+
# end if
7581

7682
# Set keys with the key names from the variable arguments
7783
for arg in args:
7884
arg = str(arg)
7985
# print(f"__init__ *args arg {arg}") # Debug
86+
8087
if not selftype.isprotected____(key):
8188
self.setattr____(arg, None)
89+
# end for
8290

8391
# Set keys with the key names and values from the keyword arguments
8492
for kw in kwargs:
8593
kw = str(kw)
8694
# print(f"__init__ **kwargs kw {kw}: {kwargs[kw]}") # Debug
95+
8796
if not selftype.isprotected____(key):
8897
self.setattr____(kw, kwargs[kw])
98+
# end for
8999

90100
def __getattr__(self, name):
91101
return self.getattr____(name)
@@ -142,8 +152,10 @@ def setattr____(self, name, value):
142152
"""
143153
if isinstance(value, dict):
144154
value = DotDict.fromdict____(value)
155+
145156
if not type(self).isprotected____(name):
146157
self.__dict__[name] = value
158+
147159
value = self.__dict__[name]
148160
return value
149161

@@ -183,11 +195,14 @@ def setclassattr____(self, name, value):
183195
value: the value
184196
"""
185197
selftype = type(self)
198+
186199
if isinstance(value, DotDict):
187200
value = value.todict____()
201+
188202
if not selftype.isprotected____(name):
189203
self.setattr____(name, value)
190204
setattr(selftype, name, value)
205+
191206
value = selftype.__dict__[name]
192207
return value
193208

@@ -198,10 +213,12 @@ def str____(self):
198213
result: the resulting string representation
199214
"""
200215
result = ".{}"
216+
201217
if len(self.__dict__) <= 0:
202218
return result
203219

204220
result = ".{"
221+
205222
for key in self.__dict__:
206223
result += f"{key.__str__()}: {self.__dict__[key].__str__()}, "
207224

@@ -219,9 +236,14 @@ def todict____(self):
219236
result: the result dict
220237
"""
221238
result = {}
239+
222240
for key in self.__dict__:
223241
value = self.__dict__[key]
242+
224243
if isinstance(value, DotDict):
225244
value = value.todict____()
245+
226246
result[key] = value
247+
# end for
248+
227249
return result

lyc_pyutils/libs/functhread.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ def run(self):
5252
del self._target
5353
del self._args
5454
del self._kwargs
55+
# end try
5556

5657
def join(self, timeout=None):
5758
"""Joins the thread.

lyc_pyutils/libs/timedinput.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ def __init__(self):
4040
subproc_code = subproc_code.strip()
4141
subproc_code = subproc_code + "\n"
4242
self._subproc_code = subproc_code
43-
4443
self._subproc = None
4544

4645
async def _async_run_subproc(self):

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
def main():
2222
_setup(
2323
name="lyc-pyutils",
24-
version="0.11.3",
24+
version="1.0.0",
2525
description="LYC's personal Python utilities.",
2626
author="Yucheng Liu",
2727
packages=_find_packages(),

0 commit comments

Comments
 (0)