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