lyrpy 1.0.0__py3-none-any.whl → 2024.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.
Potentially problematic release.
This version of lyrpy might be problematic. Click here for more details.
- {SRC/LIB/lyrpy → lyr}/LUConsole.py +1 -1
- lyr/LUConst.py +45 -0
- {SRC/LIB/lyrpy → lyr}/LUDateTime.py +4 -2
- {SRC/LIB/lyrpy → lyr}/LUDecotators.py +3 -2
- {SRC/LIB/lyrpy → lyr}/LUDict.py +1 -0
- {SRC/LIB/lyrpy → lyr}/LUDoc.py +4 -5
- {SRC/LIB/lyrpy → lyr}/LUErrors.py +1 -0
- {SRC/LIB/lyrpy → lyr}/LUFile.py +66 -120
- {SRC/LIB/lyrpy → lyr}/LUFileUtils.py +45 -60
- {SRC/LIB/lyrpy → lyr}/LULog.py +232 -307
- {SRC/LIB/lyrpy → lyr}/LUObjects.py +4 -4
- {SRC/LIB/lyrpy → lyr}/LUObjectsYT.py +22 -39
- {SRC/LIB/lyrpy → lyr}/LUParserARG.py +3 -2
- {SRC/LIB/lyrpy → lyr}/LUParserINI.py +9 -14
- {SRC/LIB/lyrpy → lyr}/LUParserREG.py +1 -5
- {SRC/LIB/lyrpy → lyr}/LUQThread.py +4 -6
- {SRC/LIB/lyrpy → lyr}/LUQTimer.py +5 -5
- {SRC/LIB/lyrpy → lyr}/LUSheduler.py +23 -24
- {SRC/LIB/lyrpy → lyr}/LUThread.py +6 -7
- {SRC/LIB/lyrpy → lyr}/LUTimer.py +3 -5
- {SRC/LIB/lyrpy → lyr}/LUVersion.py +1 -4
- {SRC/LIB/lyrpy → lyr}/LUYouTube.py +7 -6
- {SRC/LIB/lyrpy → lyr}/LUos.py +5 -15
- {SRC/LIB/lyrpy → lyr}/__init__.py +2 -2
- {SRC/LIB/lyrpy → lyr}/__main__.py +19 -20
- lyrpy-2024.0.2.data/data/data/text.txt +1 -0
- lyrpy-2024.0.2.dist-info/METADATA +44 -0
- lyrpy-2024.0.2.dist-info/RECORD +38 -0
- {lyrpy-1.0.0.dist-info → lyrpy-2024.0.2.dist-info}/WHEEL +1 -1
- lyrpy-2024.0.2.dist-info/top_level.txt +1 -0
- SRC/LIB/__init__.py +0 -0
- SRC/LIB/lyrpy/LUConst.py +0 -358
- SRC/LIB/lyrpy/LUTelegram.py +0 -428
- SRC/__init__.py +0 -0
- TESTS/__init__.py +0 -0
- TESTS/test_main.py +0 -10
- lyrpy-1.0.0.dist-info/METADATA +0 -24
- lyrpy-1.0.0.dist-info/RECORD +0 -42
- lyrpy-1.0.0.dist-info/top_level.txt +0 -2
- {SRC/LIB/lyrpy → lyr}/LUNetwork.py +0 -0
- {SRC/LIB/lyrpy → lyr}/LUNumUtils.py +0 -0
- {SRC/LIB/lyrpy → lyr}/LUProc.py +0 -0
- {SRC/LIB/lyrpy → lyr}/LUStrDecode.py +0 -0
- {SRC/LIB/lyrpy → lyr}/LUStrUtils.py +0 -0
- {SRC/LIB/lyrpy → lyr}/LUSupport.py +0 -0
- {SRC/LIB/lyrpy → lyr}/LUsys.py +0 -0
- {lyrpy-1.0.0.dist-info/licenses → lyrpy-2024.0.2.dist-info}/LICENSE +0 -0
|
@@ -38,11 +38,11 @@ import platform
|
|
|
38
38
|
#------------------------------------------
|
|
39
39
|
# БИБЛИОТЕКА LU
|
|
40
40
|
#------------------------------------------
|
|
41
|
-
import
|
|
42
|
-
import
|
|
43
|
-
import
|
|
44
|
-
import
|
|
45
|
-
import
|
|
41
|
+
import lyr.LUErrors as LUErrors
|
|
42
|
+
import lyr.LUFile as LUFile
|
|
43
|
+
import lyr.LUStrDecode as LUStrDecode
|
|
44
|
+
import lyr.LULog as LULog
|
|
45
|
+
import lyr.LUDateTime as LUDateTime
|
|
46
46
|
|
|
47
47
|
#------------------------------------------
|
|
48
48
|
#CONST
|
|
@@ -58,13 +58,13 @@ GLevelMAX = sys.maxsize
|
|
|
58
58
|
#-------------------------------------------------------------------------------
|
|
59
59
|
# __OUTFILE
|
|
60
60
|
#-------------------------------------------------------------------------------
|
|
61
|
-
def __OUTFILE (s: str,
|
|
61
|
+
def __OUTFILE (s: str, _OutFile: str):
|
|
62
62
|
#beginfunction
|
|
63
|
-
if
|
|
64
|
-
if
|
|
63
|
+
if (_OutFile) and (s != ''):
|
|
64
|
+
if (_OutFile.upper () == 'CONSOLE'):
|
|
65
65
|
print (s)
|
|
66
66
|
else:
|
|
67
|
-
LUFile.WriteStrToFile (
|
|
67
|
+
LUFile.WriteStrToFile (_OutFile, s + '\n')
|
|
68
68
|
#endif
|
|
69
69
|
#endif
|
|
70
70
|
#endfunction
|
|
@@ -80,7 +80,7 @@ def __ListFile (APathSource, AMask, APathDest,
|
|
|
80
80
|
LFileCount = 0
|
|
81
81
|
with os.scandir(APathSource) as LFiles:
|
|
82
82
|
for LFile in LFiles:
|
|
83
|
-
if not LFile.is_symlink ():
|
|
83
|
+
if (not LFile.is_symlink ()):
|
|
84
84
|
if LFile.is_file() and LUFile.CheckFileNameMask (LFile.name, AMask):
|
|
85
85
|
#------------------------------------------------------------
|
|
86
86
|
# class os.DirEntry - Это файл
|
|
@@ -104,7 +104,7 @@ def __ListFile (APathSource, AMask, APathDest,
|
|
|
104
104
|
__OUTFILE (s, _OutFile)
|
|
105
105
|
|
|
106
106
|
if _FuncFile:
|
|
107
|
-
|
|
107
|
+
s = f'_FuncFile: {_FuncFile.__name__:s}'
|
|
108
108
|
# LULog.LoggerTOOLS_AddLevel (logging.DEBUG, s)
|
|
109
109
|
_FuncFile (LUFile.ExpandFileName (LFile.path), APathDest)
|
|
110
110
|
#endif
|
|
@@ -131,10 +131,9 @@ def __ListFile (APathSource, AMask, APathDest,
|
|
|
131
131
|
#
|
|
132
132
|
#------------------------------------------------------------
|
|
133
133
|
if _FuncDir:
|
|
134
|
-
|
|
134
|
+
s = f'_FuncDir: {_FuncDir.__name__:s}'
|
|
135
135
|
# LULog.LoggerTOOLS_AddLevel (logging.DEBUG, s)
|
|
136
|
-
|
|
137
|
-
pass
|
|
136
|
+
_FuncDir (LUFile.ExpandFileName (LFile.path), APathDest)
|
|
138
137
|
#endif
|
|
139
138
|
#endif
|
|
140
139
|
#endfor
|
|
@@ -178,8 +177,7 @@ def __ListDir (APathSource, AMask, ASubdir, APathDest,
|
|
|
178
177
|
#endmatch
|
|
179
178
|
__OUTFILE (s, _OutFile)
|
|
180
179
|
|
|
181
|
-
|
|
182
|
-
LFileCount = __ListFile (APathSource, AMask, APathDest, _OutFile, _Option, None, _FuncFile)
|
|
180
|
+
LFileCount = __ListFile (APathSource, AMask, APathDest, _OutFile, _Option, _FuncDir, _FuncFile)
|
|
183
181
|
|
|
184
182
|
match _Option:
|
|
185
183
|
case 1 | 11:
|
|
@@ -194,22 +192,13 @@ def __ListDir (APathSource, AMask, ASubdir, APathDest,
|
|
|
194
192
|
|
|
195
193
|
with os.scandir(APathSource) as LFiles:
|
|
196
194
|
for LFile in LFiles:
|
|
197
|
-
if not LFile.is_symlink():
|
|
195
|
+
if (not LFile.is_symlink()):
|
|
198
196
|
if LFile.is_dir (): # and (not LFile.name.startswith('.')):
|
|
199
|
-
#------------------------------------------------------------
|
|
200
|
-
#
|
|
201
|
-
#------------------------------------------------------------
|
|
202
|
-
if _FuncDir:
|
|
203
|
-
# s = f'_FuncDir: {_FuncDir.__name__:s}'
|
|
204
|
-
# LULog.LoggerTOOLS_AddLevel (logging.DEBUG, s)
|
|
205
|
-
_FuncDir (LUFile.ExpandFileName (LFile.path), APathDest)
|
|
206
|
-
#endif
|
|
207
|
-
|
|
208
197
|
#------------------------------------------------------------
|
|
209
198
|
# class os.DirEntry - Это каталог
|
|
210
199
|
#------------------------------------------------------------
|
|
211
|
-
|
|
212
|
-
|
|
200
|
+
LBaseName = os.path.basename (LFile.path)
|
|
201
|
+
LPathTimeSource = LUFile.GetFileDateTime (LFile.path)[2]
|
|
213
202
|
|
|
214
203
|
#------------------------------------------------------------
|
|
215
204
|
# на следующий уровень
|
|
@@ -244,20 +233,20 @@ def BacFiles (APathSource, AMask, ASubDir, APathDest,
|
|
|
244
233
|
LPathSource = _APathSource
|
|
245
234
|
LBaseName = os.path.basename (_APathSource)
|
|
246
235
|
LPathDest = os.path.join (_APathDest, LBaseName)
|
|
247
|
-
|
|
236
|
+
LPathTimeSource = LUFile.GetFileDateTime (_APathSource) [2]
|
|
248
237
|
Lattr = LUFile.GetFileAttr (_APathSource)
|
|
249
238
|
if not _ASync:
|
|
250
239
|
if not LUFile.DirectoryExists(LPathDest):
|
|
251
240
|
s = f'Create {LPathDest:s} ...'
|
|
252
|
-
LULog.
|
|
241
|
+
LULog.LoggerTOOLS_AddLevel (logging.DEBUG, s)
|
|
253
242
|
LUFile.ForceDirectories(LPathDest)
|
|
254
243
|
LUFile.SetFileAttr(LPathDest, Lattr, False)
|
|
255
244
|
#endif
|
|
256
245
|
else:
|
|
257
246
|
if not LUFile.DirectoryExists(LPathDest):
|
|
258
247
|
s = f'Delete {LPathSource:s} ...'
|
|
259
|
-
LULog.
|
|
260
|
-
LUFile.
|
|
248
|
+
LULog.LoggerTOOLS_AddLevel (logging.DEBUG, s)
|
|
249
|
+
LUFile.DirectoryDelete(LPathSource)
|
|
261
250
|
#endif
|
|
262
251
|
#endif
|
|
263
252
|
#endfunction
|
|
@@ -269,7 +258,7 @@ def BacFiles (APathSource, AMask, ASubDir, APathDest,
|
|
|
269
258
|
#beginfunction
|
|
270
259
|
LFileNameSource = AFileName
|
|
271
260
|
LBaseName = os.path.basename (AFileName)
|
|
272
|
-
|
|
261
|
+
LFileTimeSource = LUFile.GetFileDateTime (AFileName) [2]
|
|
273
262
|
LFileSizeSource = LUFile.GetFileSize (AFileName)
|
|
274
263
|
LFileAttrSource = LUFile.GetFileAttr (AFileName)
|
|
275
264
|
|
|
@@ -280,14 +269,11 @@ def BacFiles (APathSource, AMask, ASubDir, APathDest,
|
|
|
280
269
|
#--------------------------------------------------------------------
|
|
281
270
|
# Check Result
|
|
282
271
|
#--------------------------------------------------------------------
|
|
283
|
-
LCopy = False
|
|
284
|
-
LDelete = False
|
|
285
|
-
|
|
286
272
|
match LResult:
|
|
287
273
|
case -3:
|
|
288
274
|
# -3 File2 could not be opened (see @ERROR for more information).
|
|
289
|
-
|
|
290
|
-
|
|
275
|
+
LFileSizeDest = 0
|
|
276
|
+
LFileTimeDest = 0
|
|
291
277
|
LDelete = False
|
|
292
278
|
LCopy = True
|
|
293
279
|
if _ASync:
|
|
@@ -306,10 +292,10 @@ def BacFiles (APathSource, AMask, ASubDir, APathDest,
|
|
|
306
292
|
# 0 File1 and file2 have the same date and time.
|
|
307
293
|
LDelete = False
|
|
308
294
|
LCopy = False
|
|
309
|
-
|
|
295
|
+
LFileTimeDest = LUFile.GetFileDateTime (LFileNameDest) [2]
|
|
310
296
|
LFileSizeDest = LUFile.GetFileSize (LFileNameDest)
|
|
311
|
-
|
|
312
|
-
if LFileSizeSource != LFileSizeDest:
|
|
297
|
+
LFileAttrDest = LUFile.GetFileAttr (LFileNameDest)
|
|
298
|
+
if (LFileSizeSource != LFileSizeDest):
|
|
313
299
|
LCopy = True
|
|
314
300
|
else:
|
|
315
301
|
LUFile.SetFileAttr(LFileNameDest, LFileAttrSource, False)
|
|
@@ -326,7 +312,7 @@ def BacFiles (APathSource, AMask, ASubDir, APathDest,
|
|
|
326
312
|
#--------------------------------------------------------------------
|
|
327
313
|
if LCopy == True:
|
|
328
314
|
s = f'Copy {LFileNameSource:s} -> {LFileNameDest:s} ...'
|
|
329
|
-
LULog.
|
|
315
|
+
LULog.LoggerTOOLS_AddLevel (logging.DEBUG, s)
|
|
330
316
|
LUFile.FileCopy (LFileNameSource, LFileNameDest, True)
|
|
331
317
|
#endif
|
|
332
318
|
|
|
@@ -335,17 +321,17 @@ def BacFiles (APathSource, AMask, ASubDir, APathDest,
|
|
|
335
321
|
#--------------------------------------------------------------------
|
|
336
322
|
if LDelete == True:
|
|
337
323
|
s = f'Delete {LFileNameSource:s} ...'
|
|
338
|
-
LULog.
|
|
324
|
+
LULog.LoggerTOOLS_AddLevel (logging.DEBUG, s)
|
|
339
325
|
LUFile.FileDelete (LFileNameSource)
|
|
340
326
|
#endif
|
|
341
327
|
#endfunction
|
|
342
328
|
|
|
343
329
|
#beginfunction
|
|
344
330
|
if (APathSource != "") and (APathDest != ""):
|
|
345
|
-
|
|
331
|
+
LBaseName = os.path.basename (APathSource)
|
|
346
332
|
LPathDest = APathDest
|
|
347
|
-
|
|
348
|
-
LULog.
|
|
333
|
+
s = f'BacFiles: {APathSource:s} {AMask:s} => {APathDest:s} ...'
|
|
334
|
+
LULog.LoggerTOOLS_AddLevel (LULog.TEXT, s)
|
|
349
335
|
__ListDir (APathSource, AMask, ASubDir, LPathDest, _OutFile, _Option, FuncDir, FuncFile)
|
|
350
336
|
#endif
|
|
351
337
|
#endfunction
|
|
@@ -356,7 +342,7 @@ def BacFiles (APathSource, AMask, ASubDir, APathDest,
|
|
|
356
342
|
def SyncFiles (APathSource, AMask, APathDest, _OutFile, _Option):
|
|
357
343
|
#beginfunction
|
|
358
344
|
s = f'SyncFiles: {APathSource:s} {AMask:s} => {APathDest:s} ...'
|
|
359
|
-
LULog.
|
|
345
|
+
LULog.LoggerTOOLS_AddLevel (LULog.TEXT, s)
|
|
360
346
|
|
|
361
347
|
BacFiles (APathSource, AMask, True, APathDest, _OutFile, _Option, False)
|
|
362
348
|
BacFiles (APathDest, AMask, True, APathSource, _OutFile, _Option, True)
|
|
@@ -368,9 +354,9 @@ def SyncFiles (APathSource, AMask, APathDest, _OutFile, _Option):
|
|
|
368
354
|
def DirFiles (APathSource, AMask, ASubDir,
|
|
369
355
|
_OutFile, _Option, _FuncDir, _FuncFile):
|
|
370
356
|
#beginfunction
|
|
371
|
-
if APathSource != "":
|
|
357
|
+
if (APathSource != ""):
|
|
372
358
|
s = f'DirFiles: {APathSource:s} {AMask:s} ...'
|
|
373
|
-
LULog.
|
|
359
|
+
LULog.LoggerTOOLS_AddLevel (LULog.TEXT, s)
|
|
374
360
|
__ListDir(APathSource, AMask, ASubDir, '', _OutFile, _Option, _FuncDir, _FuncFile)
|
|
375
361
|
#endif
|
|
376
362
|
#endfunction
|
|
@@ -392,7 +378,7 @@ def __FakeFile (APathSource,
|
|
|
392
378
|
LUFile.CloseTextFile(LHahdle)
|
|
393
379
|
|
|
394
380
|
if _FuncFile:
|
|
395
|
-
|
|
381
|
+
s = f'_FuncFile: {_FuncFile.__name__:s}'
|
|
396
382
|
# LULog.LoggerTOOLS_AddLevel (logging.DEBUG, s)
|
|
397
383
|
_FuncFile (LFileName)
|
|
398
384
|
#endif
|
|
@@ -410,15 +396,14 @@ def __FakeDir (APathSource,
|
|
|
410
396
|
#------------------------------------------------------------
|
|
411
397
|
# Dir
|
|
412
398
|
#------------------------------------------------------------
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
LULog.LoggerAdd (LULog.LoggerTOOLS, LULog.TEXT, s)
|
|
399
|
+
LBaseName = os.path.basename (APathSource)
|
|
400
|
+
LULog.LoggerTOOLS_AddLevel (LULog.TEXT, LUFile.ExpandFileName (APathSource))
|
|
416
401
|
|
|
417
402
|
#------------------------------------------------------------
|
|
418
403
|
#
|
|
419
404
|
#------------------------------------------------------------
|
|
420
405
|
if _FuncDir:
|
|
421
|
-
|
|
406
|
+
s = f'_FuncDir: {_FuncDir.__name__:s}'
|
|
422
407
|
# LULog.LoggerTOOLS_AddLevel (logging.DEBUG, s)
|
|
423
408
|
_FuncDir (LUFile.ExpandFileName (APathSource))
|
|
424
409
|
#endif
|
|
@@ -447,9 +432,9 @@ def __FakeDir (APathSource,
|
|
|
447
432
|
def FakeFiles (APathSource,
|
|
448
433
|
_OutFile, _Option, _FuncDir, _FuncFile):
|
|
449
434
|
#beginfunction
|
|
450
|
-
if APathSource != "":
|
|
435
|
+
if (APathSource != ""):
|
|
451
436
|
s = f'FakeFiles: {APathSource:s} ...'
|
|
452
|
-
LULog.
|
|
437
|
+
LULog.LoggerTOOLS_AddLevel (LULog.TEXT, s)
|
|
453
438
|
__FakeDir(APathSource, _OutFile, _Option, _FuncDir, _FuncFile)
|
|
454
439
|
#endif
|
|
455
440
|
#endfunction
|
|
@@ -471,15 +456,15 @@ def DelFiles (APathSource, AMask, ASubDir, _OutFile, _Option, _Older: int):
|
|
|
471
456
|
# print ((LDay - LFileTimeSource).days)
|
|
472
457
|
if (LDay - LFileTimeSource).days > _Older:
|
|
473
458
|
s = f'Delete {AFileName:s} ...'
|
|
474
|
-
LULog.
|
|
459
|
+
LULog.LoggerTOOLS_AddLevel (logging.DEBUG, s)
|
|
475
460
|
LUFile.FileDelete(AFileName)
|
|
476
461
|
#endif
|
|
477
462
|
#endfunction
|
|
478
463
|
|
|
479
464
|
#beginfunction
|
|
480
|
-
if APathSource != "":
|
|
481
|
-
|
|
482
|
-
LULog.
|
|
465
|
+
if (APathSource != ""):
|
|
466
|
+
stat = f'DelFiles: {APathSource:s} {AMask:s} ...'
|
|
467
|
+
LULog.LoggerTOOLS_AddLevel (lyr.LULog.TEXT, s)
|
|
483
468
|
__ListDir (APathSource, AMask, ASubDir, '', _OutFile, _Option, None, DelFile)
|
|
484
469
|
#endif
|
|
485
470
|
#endfunction
|