lyrpy 0.0.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- lyr/LUConsole.py +402 -0
- lyr/LUConst.py +45 -0
- lyr/LUDateTime.py +207 -0
- lyr/LUDecotators.py +418 -0
- lyr/LUDict.py +117 -0
- lyr/LUDoc.py +61 -0
- lyr/LUErrors.py +80 -0
- lyr/LUFile.py +1174 -0
- lyr/LUFileUtils.py +486 -0
- lyr/LULog.py +2249 -0
- lyr/LUNetwork.py +277 -0
- lyr/LUNumUtils.py +305 -0
- lyr/LUObjects.py +208 -0
- lyr/LUObjectsYT.py +829 -0
- lyr/LUParserARG.py +365 -0
- lyr/LUParserINI.py +371 -0
- lyr/LUParserREG.py +510 -0
- lyr/LUProc.py +110 -0
- lyr/LUQThread.py +139 -0
- lyr/LUQTimer.py +197 -0
- lyr/LUSheduler.py +940 -0
- lyr/LUStrDecode.py +223 -0
- lyr/LUStrUtils.py +633 -0
- lyr/LUSupport.py +124 -0
- lyr/LUThread.py +176 -0
- lyr/LUTimer.py +139 -0
- lyr/LUVersion.py +380 -0
- lyr/LUYouTube.py +204 -0
- lyr/LUos.py +797 -0
- lyr/LUsys.py +47 -0
- lyr/__init__.py +21 -0
- lyr/__main__.py +19 -0
- lyrpy-0.0.2.dist-info/LICENSE +19 -0
- lyrpy-0.0.2.dist-info/METADATA +19 -0
- lyrpy-0.0.2.dist-info/RECORD +37 -0
- lyrpy-0.0.2.dist-info/WHEEL +5 -0
- lyrpy-0.0.2.dist-info/top_level.txt +1 -0
lyr/LUSupport.py
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"""LUSupport.py"""
|
|
2
|
+
# -*- coding: UTF-8 -*-
|
|
3
|
+
__annotations__ = """
|
|
4
|
+
=======================================================
|
|
5
|
+
Copyright (c) 2023-2024
|
|
6
|
+
Author:
|
|
7
|
+
Lisitsin Y.R.
|
|
8
|
+
Project:
|
|
9
|
+
LU_PY
|
|
10
|
+
Python (LU)
|
|
11
|
+
Module:
|
|
12
|
+
LUSupport.py
|
|
13
|
+
|
|
14
|
+
=======================================================
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
#------------------------------------------
|
|
18
|
+
# БИБЛИОТЕКИ python
|
|
19
|
+
#------------------------------------------
|
|
20
|
+
import sys
|
|
21
|
+
|
|
22
|
+
#------------------------------------------
|
|
23
|
+
# БИБЛИОТЕКИ сторонние
|
|
24
|
+
#------------------------------------------
|
|
25
|
+
|
|
26
|
+
#------------------------------------------
|
|
27
|
+
# БИБЛИОТЕКИ LU
|
|
28
|
+
#------------------------------------------
|
|
29
|
+
|
|
30
|
+
"""
|
|
31
|
+
function LoadDLL (NameDll: string; var HandleDLL: HModule): Boolean;
|
|
32
|
+
{ LoadDLL }
|
|
33
|
+
begin
|
|
34
|
+
HandleDLL := LoadLibrary (PChar(NameDll));
|
|
35
|
+
Result := (HandleDLL >= HINSTANCE_ERROR);
|
|
36
|
+
end;
|
|
37
|
+
|
|
38
|
+
function UnLoadDLL (HandleDLL: HModule): Boolean;
|
|
39
|
+
{ UnLoadDLL }
|
|
40
|
+
begin
|
|
41
|
+
Result := FreeLibrary (HandleDLL);
|
|
42
|
+
end;
|
|
43
|
+
|
|
44
|
+
function GetFunc (HandleDLL: HModule; NameFunc: string; var AddFunc: Pointer): Boolean;
|
|
45
|
+
{ GetFunc }
|
|
46
|
+
begin
|
|
47
|
+
try
|
|
48
|
+
AddFunc := GetProcAddress (HandleDLL, PChar(NameFunc));
|
|
49
|
+
except
|
|
50
|
+
AddFunc := nil;
|
|
51
|
+
end;
|
|
52
|
+
Result := Assigned (AddFunc);
|
|
53
|
+
end;
|
|
54
|
+
|
|
55
|
+
function ErrorString (Error: DWORD): string;
|
|
56
|
+
{ ErrorString }
|
|
57
|
+
begin
|
|
58
|
+
Result := SysErrorMessage (Error);
|
|
59
|
+
end;
|
|
60
|
+
|
|
61
|
+
function LastErrorString: string;
|
|
62
|
+
{ LastErrorString }
|
|
63
|
+
begin
|
|
64
|
+
Result := ErrorString (GetLastError);
|
|
65
|
+
end;
|
|
66
|
+
"""
|
|
67
|
+
|
|
68
|
+
#-------------------------------------------------
|
|
69
|
+
# IsTerminal
|
|
70
|
+
# Возвращает True, если текущая консоль является терминалом
|
|
71
|
+
#-------------------------------------------------
|
|
72
|
+
def IsTerminal () -> bool:
|
|
73
|
+
"""IsTerminal"""
|
|
74
|
+
#beginfunction
|
|
75
|
+
return sys.stdout.isatty ()
|
|
76
|
+
#endfunction
|
|
77
|
+
|
|
78
|
+
#-------------------------------------------------
|
|
79
|
+
# TupleToStr
|
|
80
|
+
# Возвращает кортеж в виде строки, состоящей из элементов ATuple
|
|
81
|
+
#-------------------------------------------------
|
|
82
|
+
def TupleToStr (ATuple:()) -> str:
|
|
83
|
+
"""TupleToStr"""
|
|
84
|
+
#beginfunction
|
|
85
|
+
LResult = ''
|
|
86
|
+
i = 0
|
|
87
|
+
j = 0
|
|
88
|
+
if type(ATuple) is tuple:
|
|
89
|
+
for r in ATuple:
|
|
90
|
+
i = i + 1
|
|
91
|
+
if r != '':
|
|
92
|
+
j = j + 1
|
|
93
|
+
if j == 1:
|
|
94
|
+
LResult = LResult + r
|
|
95
|
+
else:
|
|
96
|
+
LResult = LResult + ';' + r
|
|
97
|
+
#endif
|
|
98
|
+
#endif
|
|
99
|
+
#endfor
|
|
100
|
+
else:
|
|
101
|
+
if len (ATuple) > 0:
|
|
102
|
+
LResult = LResult + ATuple
|
|
103
|
+
#endif
|
|
104
|
+
#endif
|
|
105
|
+
return LResult
|
|
106
|
+
#endfunction
|
|
107
|
+
|
|
108
|
+
#---------------------------------------------------------
|
|
109
|
+
# main
|
|
110
|
+
#---------------------------------------------------------
|
|
111
|
+
def main ():
|
|
112
|
+
#beginfunction
|
|
113
|
+
...
|
|
114
|
+
#endfunction
|
|
115
|
+
|
|
116
|
+
#---------------------------------------------------------
|
|
117
|
+
#
|
|
118
|
+
#---------------------------------------------------------
|
|
119
|
+
#beginmodule
|
|
120
|
+
if __name__ == "__main__":
|
|
121
|
+
main()
|
|
122
|
+
#endif
|
|
123
|
+
|
|
124
|
+
#endmodule
|
lyr/LUThread.py
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
"""LUThread.py"""
|
|
2
|
+
# -*- coding: UTF-8 -*-
|
|
3
|
+
__annotations__ = """
|
|
4
|
+
=======================================================
|
|
5
|
+
Copyright (c) 2023-2024
|
|
6
|
+
Author:
|
|
7
|
+
Lisitsin Y.R.
|
|
8
|
+
Project:
|
|
9
|
+
LU_PY
|
|
10
|
+
Python (LU)
|
|
11
|
+
Module:
|
|
12
|
+
LUThread.py
|
|
13
|
+
|
|
14
|
+
=======================================================
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
#------------------------------------------
|
|
18
|
+
# БИБЛИОТЕКИ python
|
|
19
|
+
#------------------------------------------
|
|
20
|
+
import threading
|
|
21
|
+
|
|
22
|
+
#------------------------------------------
|
|
23
|
+
# БИБЛИОТЕКИ сторонние
|
|
24
|
+
#------------------------------------------
|
|
25
|
+
|
|
26
|
+
#------------------------------------------
|
|
27
|
+
# БИБЛИОТЕКА LU
|
|
28
|
+
#------------------------------------------
|
|
29
|
+
import lyr.LULog as LULog
|
|
30
|
+
|
|
31
|
+
# class ScheduleThread (threading.Thread):
|
|
32
|
+
# @classmethod
|
|
33
|
+
# def run (cls):
|
|
34
|
+
# while not cease_continuous_run.is_set ():
|
|
35
|
+
# schedule.run_pending ()
|
|
36
|
+
# time.sleep (interval)
|
|
37
|
+
|
|
38
|
+
# threading.Thread.name
|
|
39
|
+
#threading.active_count() количество живых потоков,
|
|
40
|
+
#threading.current_thread() текущий поток,
|
|
41
|
+
#threading.excepthook() обрабатывает неперехваченные исключения в потоках,
|
|
42
|
+
#threading.get_ident() идентификатор текущего потока,
|
|
43
|
+
#threading.get_native_id() интегральный идентификатор текущего потока,
|
|
44
|
+
#threading.enumerate() список объектов всех живых потоков,
|
|
45
|
+
#threading.main_thread() объект основной потока,
|
|
46
|
+
#threading.TIMEOUT_MAX максимально значение для тайм-аута блокировки.
|
|
47
|
+
|
|
48
|
+
#threading.active_count():
|
|
49
|
+
#Функция threading.active_count() возвращает количество живых потоков - объектов threading.Thread().
|
|
50
|
+
#Возвращенное количество равно длине списка, возвращаемого функцией threading.enumerate().
|
|
51
|
+
|
|
52
|
+
#threading.get_ident():
|
|
53
|
+
#Функция threading.get_ident() возвращает идентификатор текущего потока. Это ненулевое целое число.
|
|
54
|
+
|
|
55
|
+
#threading.enumerate():
|
|
56
|
+
#Функция threading.enumerate() возвращает список объектов threading.Thread() всех живых потоков.
|
|
57
|
+
|
|
58
|
+
class TThread (threading.Thread):
|
|
59
|
+
"""TThread"""
|
|
60
|
+
luClassName = 'TThread'
|
|
61
|
+
|
|
62
|
+
#--------------------------------------------------
|
|
63
|
+
# constructor
|
|
64
|
+
#--------------------------------------------------
|
|
65
|
+
def __init__ (self, *args, **kwargs):
|
|
66
|
+
# def __init__ (self, group = None, target = None,
|
|
67
|
+
# name = None, args = (),
|
|
68
|
+
# kwargs = {}, *, daemon = None):
|
|
69
|
+
|
|
70
|
+
"""Constructor"""
|
|
71
|
+
#beginfunction
|
|
72
|
+
super ().__init__ (*args, **kwargs)
|
|
73
|
+
# super ().__init__ (group = group, target = target,
|
|
74
|
+
# name = name,
|
|
75
|
+
# *args,
|
|
76
|
+
# **kwargs,
|
|
77
|
+
# daemon = daemon)
|
|
78
|
+
#
|
|
79
|
+
self.args = args
|
|
80
|
+
self.kwargs = kwargs
|
|
81
|
+
# print ('args=',args)
|
|
82
|
+
# print ('kwargs=',kwargs)
|
|
83
|
+
self.__FStopThread = False
|
|
84
|
+
#endfunction
|
|
85
|
+
|
|
86
|
+
#--------------------------------------------------
|
|
87
|
+
# destructor
|
|
88
|
+
#--------------------------------------------------
|
|
89
|
+
def __del__ (self):
|
|
90
|
+
"""destructor"""
|
|
91
|
+
#beginfunction
|
|
92
|
+
LClassName = self.__class__.__name__
|
|
93
|
+
s = '{} уничтожен'.format (LClassName)
|
|
94
|
+
# LULog.LoggerTOOLS_AddLevel (LULog.DEBUGTEXT, s)
|
|
95
|
+
#print (s)
|
|
96
|
+
#endfunction
|
|
97
|
+
|
|
98
|
+
#--------------------------------------------------
|
|
99
|
+
# @property Thread
|
|
100
|
+
#--------------------------------------------------
|
|
101
|
+
# getter
|
|
102
|
+
@property
|
|
103
|
+
def Thread(self) -> threading.Thread:
|
|
104
|
+
#beginfunction
|
|
105
|
+
return self
|
|
106
|
+
#endfunction
|
|
107
|
+
|
|
108
|
+
# #--------------------------------------------------
|
|
109
|
+
# # start
|
|
110
|
+
# #--------------------------------------------------
|
|
111
|
+
# def start(self):
|
|
112
|
+
# """start - Запуск потока"""
|
|
113
|
+
# #beginfunction
|
|
114
|
+
# s = 'start - Запуск потока...'
|
|
115
|
+
# LULog.LoggerTOOLS_AddLevel (LULog.DEBUGTEXT, s)
|
|
116
|
+
# # self.Function ()
|
|
117
|
+
# super ().start ()
|
|
118
|
+
# #endfunction
|
|
119
|
+
|
|
120
|
+
#--------------------------------------------------
|
|
121
|
+
# run
|
|
122
|
+
#--------------------------------------------------
|
|
123
|
+
def run(self):
|
|
124
|
+
"""run - Запуск потока"""
|
|
125
|
+
#beginfunction
|
|
126
|
+
s = 'run - Запуск потока...'
|
|
127
|
+
LULog.LoggerTOOLS_AddDebug (s)
|
|
128
|
+
super ().run()
|
|
129
|
+
while not self.__FStopThread:
|
|
130
|
+
s = 'Выполнение потока...'
|
|
131
|
+
# LULog.LoggerTOOLS_AddDebug (s)
|
|
132
|
+
continue
|
|
133
|
+
#endwhile
|
|
134
|
+
#endfunction
|
|
135
|
+
|
|
136
|
+
#--------------------------------------------------
|
|
137
|
+
# StartThread
|
|
138
|
+
#--------------------------------------------------
|
|
139
|
+
def StartThread(self):
|
|
140
|
+
"""StartThread"""
|
|
141
|
+
#beginfunction
|
|
142
|
+
s = 'StartThread...'
|
|
143
|
+
LULog.LoggerTOOLS_AddDebug (s)
|
|
144
|
+
self.__FStopThread = False
|
|
145
|
+
self.run()
|
|
146
|
+
#endfunction
|
|
147
|
+
#--------------------------------------------------
|
|
148
|
+
# StopThread
|
|
149
|
+
#--------------------------------------------------
|
|
150
|
+
def StopThread(self):
|
|
151
|
+
"""StopThread"""
|
|
152
|
+
#beginfunction
|
|
153
|
+
s = 'StopThread...'
|
|
154
|
+
LULog.LoggerTOOLS_AddDebug (s)
|
|
155
|
+
self.__FStopThread = True
|
|
156
|
+
#endfunction
|
|
157
|
+
|
|
158
|
+
#endclass
|
|
159
|
+
|
|
160
|
+
#---------------------------------------------------------
|
|
161
|
+
# main
|
|
162
|
+
#---------------------------------------------------------
|
|
163
|
+
def main ():
|
|
164
|
+
#beginfunction
|
|
165
|
+
...
|
|
166
|
+
#endfunction
|
|
167
|
+
|
|
168
|
+
#---------------------------------------------------------
|
|
169
|
+
#
|
|
170
|
+
#---------------------------------------------------------
|
|
171
|
+
#beginmodule
|
|
172
|
+
if __name__ == "__main__":
|
|
173
|
+
main()
|
|
174
|
+
#endif
|
|
175
|
+
|
|
176
|
+
#endmodule
|
lyr/LUTimer.py
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"""LUThread.py"""
|
|
2
|
+
# -*- coding: UTF-8 -*-
|
|
3
|
+
__annotations__ = """
|
|
4
|
+
=======================================================
|
|
5
|
+
Copyright (c) 2023-2024
|
|
6
|
+
Author:
|
|
7
|
+
Lisitsin Y.R.
|
|
8
|
+
Project:
|
|
9
|
+
LU_PY
|
|
10
|
+
Python (LU)
|
|
11
|
+
Module:
|
|
12
|
+
LUTimer.py
|
|
13
|
+
|
|
14
|
+
=======================================================
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
#------------------------------------------
|
|
18
|
+
# БИБЛИОТЕКИ python
|
|
19
|
+
#------------------------------------------
|
|
20
|
+
import threading
|
|
21
|
+
|
|
22
|
+
#------------------------------------------
|
|
23
|
+
# БИБЛИОТЕКИ сторонние
|
|
24
|
+
#------------------------------------------
|
|
25
|
+
|
|
26
|
+
#------------------------------------------
|
|
27
|
+
# БИБЛИОТЕКА LU
|
|
28
|
+
#------------------------------------------
|
|
29
|
+
|
|
30
|
+
# Create the Worker Thread
|
|
31
|
+
class TTimer (threading.Timer):
|
|
32
|
+
"""TQTimer"""
|
|
33
|
+
luClassName = 'TTimer'
|
|
34
|
+
|
|
35
|
+
#--------------------------------------------------
|
|
36
|
+
# constructor
|
|
37
|
+
#--------------------------------------------------
|
|
38
|
+
# def __init__ (self, AFuction, parent = None):
|
|
39
|
+
def __init__ (self, AInterval, AFunction, *args, **kwargs):
|
|
40
|
+
#beginfunction
|
|
41
|
+
super ().__init__ (AInterval, AFunction, *args, **kwargs)
|
|
42
|
+
self.args = args
|
|
43
|
+
self.kwargs = kwargs
|
|
44
|
+
|
|
45
|
+
self.__FFunction = AFunction
|
|
46
|
+
|
|
47
|
+
# # Instantiate signals and connect signals to the slots
|
|
48
|
+
# self.signals = MySignals ()
|
|
49
|
+
# self.signals.signal_str.connect (parent.update_str_field)
|
|
50
|
+
# self.signals.signal_int.connect (parent.update_int_field)
|
|
51
|
+
|
|
52
|
+
self.__FStopTimer = False
|
|
53
|
+
|
|
54
|
+
#endfunction
|
|
55
|
+
|
|
56
|
+
#--------------------------------------------------
|
|
57
|
+
# destructor
|
|
58
|
+
#--------------------------------------------------
|
|
59
|
+
def __del__ (self):
|
|
60
|
+
"""destructor"""
|
|
61
|
+
#beginfunction
|
|
62
|
+
LClassName = self.__class__.__name__
|
|
63
|
+
s = '{} уничтожен'.format (LClassName)
|
|
64
|
+
# LULog.LoggerTOOLS_AddLevel (LULog.DEBUGTEXT, s)
|
|
65
|
+
#print (s)
|
|
66
|
+
#endfunction
|
|
67
|
+
|
|
68
|
+
#--------------------------------------------------
|
|
69
|
+
# @property TQTimer
|
|
70
|
+
#--------------------------------------------------
|
|
71
|
+
# getter
|
|
72
|
+
@property
|
|
73
|
+
def Timer(self):
|
|
74
|
+
#beginfunction
|
|
75
|
+
return self
|
|
76
|
+
#endfunction
|
|
77
|
+
|
|
78
|
+
# #--------------------------------------------------
|
|
79
|
+
# # start
|
|
80
|
+
# #--------------------------------------------------
|
|
81
|
+
# def start(self):
|
|
82
|
+
# """start - Запуск таймера"""
|
|
83
|
+
# #beginfunction
|
|
84
|
+
# s = 'Запуск таймера...'
|
|
85
|
+
# LULog.LoggerTOOLS_AddLevel (LULog.DEBUGTEXT, s)
|
|
86
|
+
# # self.Function ()
|
|
87
|
+
# super ().start ()
|
|
88
|
+
# #endfunction
|
|
89
|
+
|
|
90
|
+
#--------------------------------------------------
|
|
91
|
+
# run
|
|
92
|
+
#--------------------------------------------------
|
|
93
|
+
def run(self):
|
|
94
|
+
"""run - Запуск таймера"""
|
|
95
|
+
#beginfunction
|
|
96
|
+
s = 'run - Запуск таймера...'
|
|
97
|
+
LULog.LoggerTOOLS_AddDebug (s)
|
|
98
|
+
# super ().run()
|
|
99
|
+
|
|
100
|
+
# self.Function()
|
|
101
|
+
|
|
102
|
+
while not self.__FStopTimer:
|
|
103
|
+
s = 'Выполнение таймера...'
|
|
104
|
+
# LULog.LoggerTOOLS_AddDebug (s)
|
|
105
|
+
continue
|
|
106
|
+
#endwhile
|
|
107
|
+
|
|
108
|
+
# # Do something on the worker thread
|
|
109
|
+
# a = 1 + 1
|
|
110
|
+
# # Emit signals whenever you want
|
|
111
|
+
# self.signals.signal_int.emit (a)
|
|
112
|
+
# self.signals.signal_str.emit ("This text comes to Main thread from our Worker thread.")
|
|
113
|
+
|
|
114
|
+
# while 1:
|
|
115
|
+
# Lval = psutil.cpu_percent ()
|
|
116
|
+
# # self.emit(QtCore.SIGNAL('CPU_VALUE'), Lval)
|
|
117
|
+
# ...
|
|
118
|
+
# #endwhile
|
|
119
|
+
|
|
120
|
+
#endfunction
|
|
121
|
+
#endclass
|
|
122
|
+
|
|
123
|
+
#---------------------------------------------------------
|
|
124
|
+
# main
|
|
125
|
+
#---------------------------------------------------------
|
|
126
|
+
def main ():
|
|
127
|
+
#beginfunction
|
|
128
|
+
...
|
|
129
|
+
#endfunction
|
|
130
|
+
|
|
131
|
+
#---------------------------------------------------------
|
|
132
|
+
#
|
|
133
|
+
#---------------------------------------------------------
|
|
134
|
+
#beginmodule
|
|
135
|
+
if __name__ == "__main__":
|
|
136
|
+
main()
|
|
137
|
+
#endif
|
|
138
|
+
|
|
139
|
+
#endmodule
|