PythonExtensionsCollection 0.2.0__py3-none-any.whl → 0.13.0__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.
Files changed (55) hide show
  1. PythonExtensionsCollection/Comparison/CComparison.py +341 -0
  2. PythonExtensionsCollection/Comparison/__init__.py +13 -0
  3. PythonExtensionsCollection/File/CFile.py +326 -106
  4. PythonExtensionsCollection/File/__init__.py +1 -1
  5. PythonExtensionsCollection/Folder/CFolder.py +460 -0
  6. PythonExtensionsCollection/Folder/__init__.py +13 -0
  7. PythonExtensionsCollection/PythonExtensionsCollection.pdf +0 -0
  8. PythonExtensionsCollection/String/CString.py +128 -344
  9. PythonExtensionsCollection/String/__init__.py +1 -1
  10. PythonExtensionsCollection/Utils/CUtils.py +77 -74
  11. PythonExtensionsCollection/Utils/__init__.py +1 -1
  12. PythonExtensionsCollection/__init__.py +1 -1
  13. PythonExtensionsCollection/version.py +23 -0
  14. {PythonExtensionsCollection-0.2.0.dist-info → PythonExtensionsCollection-0.13.0.dist-info}/METADATA +57 -44
  15. PythonExtensionsCollection-0.13.0.dist-info/RECORD +18 -0
  16. {PythonExtensionsCollection-0.2.0.dist-info → PythonExtensionsCollection-0.13.0.dist-info}/WHEEL +1 -1
  17. PythonExtensionsCollection/doc/.buildinfo +0 -4
  18. PythonExtensionsCollection/doc/File.html +0 -315
  19. PythonExtensionsCollection/doc/String.html +0 -590
  20. PythonExtensionsCollection/doc/Utils.html +0 -209
  21. PythonExtensionsCollection/doc/_modules/PythonExtensionsCollection/File/CFile.html +0 -960
  22. PythonExtensionsCollection/doc/_modules/PythonExtensionsCollection/String/CString.html +0 -1221
  23. PythonExtensionsCollection/doc/_modules/PythonExtensionsCollection/Utils/CUtils.html +0 -431
  24. PythonExtensionsCollection/doc/_modules/index.html +0 -106
  25. PythonExtensionsCollection/doc/_sources/File.rst.txt +0 -28
  26. PythonExtensionsCollection/doc/_sources/String.rst.txt +0 -28
  27. PythonExtensionsCollection/doc/_sources/Utils.rst.txt +0 -28
  28. PythonExtensionsCollection/doc/_sources/additional_doc/Introduction.rst.txt +0 -365
  29. PythonExtensionsCollection/doc/_sources/index.rst.txt +0 -27
  30. PythonExtensionsCollection/doc/_static/_sphinx_javascript_frameworks_compat.js +0 -134
  31. PythonExtensionsCollection/doc/_static/alabaster.css +0 -701
  32. PythonExtensionsCollection/doc/_static/basic.css +0 -930
  33. PythonExtensionsCollection/doc/_static/custom.css +0 -1
  34. PythonExtensionsCollection/doc/_static/doctools.js +0 -264
  35. PythonExtensionsCollection/doc/_static/documentation_options.js +0 -14
  36. PythonExtensionsCollection/doc/_static/file.png +0 -0
  37. PythonExtensionsCollection/doc/_static/jquery-3.6.0.js +0 -10881
  38. PythonExtensionsCollection/doc/_static/jquery.js +0 -2
  39. PythonExtensionsCollection/doc/_static/language_data.js +0 -199
  40. PythonExtensionsCollection/doc/_static/minus.png +0 -0
  41. PythonExtensionsCollection/doc/_static/plus.png +0 -0
  42. PythonExtensionsCollection/doc/_static/pygments.css +0 -82
  43. PythonExtensionsCollection/doc/_static/searchtools.js +0 -531
  44. PythonExtensionsCollection/doc/_static/underscore-1.13.1.js +0 -2042
  45. PythonExtensionsCollection/doc/_static/underscore.js +0 -6
  46. PythonExtensionsCollection/doc/additional_doc/Introduction.html +0 -365
  47. PythonExtensionsCollection/doc/genindex.html +0 -292
  48. PythonExtensionsCollection/doc/index.html +0 -123
  49. PythonExtensionsCollection/doc/objects.inv +0 -0
  50. PythonExtensionsCollection/doc/py-modindex.html +0 -138
  51. PythonExtensionsCollection/doc/search.html +0 -127
  52. PythonExtensionsCollection/doc/searchindex.js +0 -1
  53. PythonExtensionsCollection-0.2.0.dist-info/RECORD +0 -48
  54. {PythonExtensionsCollection-0.2.0.dist-info → PythonExtensionsCollection-0.13.0.dist-info}/LICENSE +0 -0
  55. {PythonExtensionsCollection-0.2.0.dist-info → PythonExtensionsCollection-0.13.0.dist-info}/top_level.txt +0 -0
@@ -20,7 +20,7 @@
20
20
  #
21
21
  # XC-CT/ECA3-Queckenstedt
22
22
  #
23
- # 26.01.2022
23
+ # 15.11.2022
24
24
  #
25
25
  # **************************************************************************************************************
26
26
 
@@ -33,6 +33,14 @@ from PythonExtensionsCollection.String.CString import CString
33
33
  # **************************************************************************************************************
34
34
 
35
35
  class enFileStatiType:
36
+ """
37
+ The class ``enFileStatiType`` defines the sollowing file states:
38
+
39
+ * ``closed``
40
+ * ``openedforwriting``
41
+ * ``openedforappending``
42
+ * ``openedforreading``
43
+ """
36
44
  closed = "closed"
37
45
  openedforwriting = "openedforwriting"
38
46
  openedforappending = "openedforappending"
@@ -42,8 +50,6 @@ class enFileStatiType:
42
50
 
43
51
  class CFile(object):
44
52
  """
45
- |
46
-
47
53
  The class ``CFile`` provides a small set of file functions with extended parametrization (like switches
48
54
  defining if a file is allowed to be overwritten or not).
49
55
 
@@ -61,8 +67,6 @@ It is not possible to create an instance of this class with a file that is alrea
61
67
 
62
68
  It is also not possible to use ``CopyTo`` or ``MoveTo`` to overwrite files that are already in use by another instance.
63
69
  This makes the file handling more save against access violations.
64
-
65
- |
66
70
  """
67
71
  # --------------------------------------------------------------------------------------------------------------
68
72
  # TM***
@@ -97,6 +101,9 @@ This makes the file handling more save against access violations.
97
101
  # TM***
98
102
 
99
103
  def __bIsFreeToUse(self, sFile=None):
104
+ """
105
+ Checks if the file ``sFile`` is free to use, that means: not used by another instance of ``CFile``.
106
+ """
100
107
 
101
108
  bIsFreeToUse = False # init
102
109
  if sFile is None:
@@ -115,16 +122,12 @@ This makes the file handling more save against access violations.
115
122
 
116
123
  def __OpenForWriting(self):
117
124
  """
118
- |
119
-
120
125
  Opens a text file for writing.
121
126
 
122
127
  Returns ``bSuccess`` and ``sResult`` (feedback).
123
-
124
- |
125
128
  """
126
129
 
127
- sMethod = "CFile::__OpenForWriting"
130
+ sMethod = "CFile.__OpenForWriting"
128
131
 
129
132
  if self.__sFile is None:
130
133
  bSuccess = False
@@ -146,8 +149,8 @@ Returns ``bSuccess`` and ``sResult`` (feedback).
146
149
  self.Close()
147
150
  bSuccess = None
148
151
  sResult = f"Not possible to open file '{self.__sFile}' for writing.\nReason: " + str(reason)
152
+ sResult = CString.FormatResult(sMethod, bSuccess, sResult)
149
153
 
150
- sResult = CString.FormatResult(sMethod, bSuccess, sResult)
151
154
  return bSuccess, sResult
152
155
 
153
156
  # eof def __OpenForWriting(self):
@@ -157,16 +160,12 @@ Returns ``bSuccess`` and ``sResult`` (feedback).
157
160
 
158
161
  def __OpenForAppending(self):
159
162
  """
160
- |
161
-
162
163
  Opens a text file for appending.
163
164
 
164
165
  Returns ``bSuccess`` and ``sResult`` (feedback).
165
-
166
- |
167
166
  """
168
167
 
169
- sMethod = "CFile::__OpenForAppending"
168
+ sMethod = "CFile.__OpenForAppending"
170
169
 
171
170
  if self.__sFile is None:
172
171
  bSuccess = False
@@ -188,8 +187,8 @@ Returns ``bSuccess`` and ``sResult`` (feedback).
188
187
  self.Close()
189
188
  bSuccess = None
190
189
  sResult = f"Not possible to open file '{self.__sFile}' for appending.\nReason: " + str(reason)
190
+ sResult = CString.FormatResult(sMethod, bSuccess, sResult)
191
191
 
192
- sResult = CString.FormatResult(sMethod, bSuccess, sResult)
193
192
  return bSuccess, sResult
194
193
 
195
194
  # eof def __OpenForAppending(self):
@@ -199,16 +198,12 @@ Returns ``bSuccess`` and ``sResult`` (feedback).
199
198
 
200
199
  def __OpenForReading(self):
201
200
  """
202
- |
203
-
204
201
  Opens a text file for reading.
205
202
 
206
203
  Returns ``bSuccess`` and ``sResult`` (feedback).
207
-
208
- |
209
204
  """
210
205
 
211
- sMethod = "CFile::__OpenForReading"
206
+ sMethod = "CFile.__OpenForReading"
212
207
 
213
208
  if self.__sFile is None:
214
209
  bSuccess = False
@@ -230,8 +225,8 @@ Returns ``bSuccess`` and ``sResult`` (feedback).
230
225
  self.Close()
231
226
  bSuccess = None
232
227
  sResult = f"Not possible to open file '{self.__sFile}' for reading.\nReason: " + str(reason)
228
+ sResult = CString.FormatResult(sMethod, bSuccess, sResult)
233
229
 
234
- sResult = CString.FormatResult(sMethod, bSuccess, sResult)
235
230
  return bSuccess, sResult
236
231
 
237
232
  # eof def __OpenForReading(self):
@@ -241,15 +236,27 @@ Returns ``bSuccess`` and ``sResult`` (feedback).
241
236
 
242
237
  def Close(self):
243
238
  """
244
- |
245
-
246
239
  Closes the opened file.
247
240
 
248
- Returns ``bSuccess`` and ``sResult`` (feedback).
241
+ **Arguments:**
242
+
243
+ (no args)
244
+
245
+ **Returns:**
249
246
 
250
- |
247
+ * ``bSuccess``
248
+
249
+ / *Type*: bool /
250
+
251
+ Indicates if the computation of the method was successful or not.
252
+
253
+ * ``sResult``
254
+
255
+ / *Type*: str /
256
+
257
+ The result of the computation of the method.
251
258
  """
252
- sMethod = "CFile::Close"
259
+ sMethod = "CFile.Close"
253
260
 
254
261
  if self.__oFileHandle is not None:
255
262
  try:
@@ -260,6 +267,7 @@ Returns ``bSuccess`` and ``sResult`` (feedback).
260
267
  except Exception as reason:
261
268
  bSuccess = None
262
269
  sResult = f"Exception while closing file '{self.__sFile}'.\nReason: " + str(reason)
270
+ sResult = CString.FormatResult(sMethod, bSuccess, sResult)
263
271
  self.__oFileHandle = None
264
272
  else:
265
273
  bSuccess = True
@@ -267,7 +275,6 @@ Returns ``bSuccess`` and ``sResult`` (feedback).
267
275
 
268
276
  self.__oFileStatus = enFileStatiType.closed
269
277
 
270
- sResult = CString.FormatResult(sMethod, bSuccess, sResult)
271
278
  return bSuccess, sResult
272
279
 
273
280
  # eof def Close(self):
@@ -277,24 +284,36 @@ Returns ``bSuccess`` and ``sResult`` (feedback).
277
284
 
278
285
  def Delete(self, bConfirmDelete=True):
279
286
  """
280
- |
281
-
282
287
  Deletes the current file.
283
288
 
284
- **bConfirmDelete**
289
+ **Arguments:**
285
290
 
286
- Defines if it will be handled as error if the file does not exist.
291
+ * ``bConfirmDelete``
287
292
 
288
- If ``True``: If the file does not exist, the method indicates an error (``bSuccess = False``).
293
+ / *Condition*: optional / *Type*: bool / *Default*: True /
289
294
 
290
- If ``False``: It doesn't matter if the file exists or not.
295
+ Defines if it will be handled as error if the file does not exist.
291
296
 
292
- Returns ``bSuccess`` and ``sResult`` (feedback).
297
+ If ``True``: If the file does not exist, the method indicates an error (``bSuccess = False``).
298
+
299
+ If ``False``: It doesn't matter if the file exists or not.
300
+
301
+ **Returns:**
293
302
 
294
- |
303
+ * ``bSuccess``
304
+
305
+ / *Type*: bool /
306
+
307
+ Indicates if the computation of the method was successful or not.
308
+
309
+ * ``sResult``
310
+
311
+ / *Type*: str /
312
+
313
+ The result of the computation of the method.
295
314
  """
296
315
 
297
- sMethod = "CFile::Delete"
316
+ sMethod = "CFile.Delete"
298
317
 
299
318
  if self.__sFile is None:
300
319
  bSuccess = False
@@ -308,7 +327,6 @@ Returns ``bSuccess`` and ``sResult`` (feedback).
308
327
  else:
309
328
  bSuccess = True
310
329
  sResult = f"Nothing to delete. The file '{self.__sFile}' does not exist."
311
- sResult = CString.FormatResult(sMethod, bSuccess, sResult)
312
330
  return bSuccess, sResult
313
331
 
314
332
  bSuccess, sResult = self.Close()
@@ -323,8 +341,8 @@ Returns ``bSuccess`` and ``sResult`` (feedback).
323
341
  except Exception as reason:
324
342
  bSuccess = None
325
343
  sResult = f"Exception while deleting file '{self.__sFile}'.\nReason: " + str(reason)
344
+ sResult = CString.FormatResult(sMethod, bSuccess, sResult)
326
345
 
327
- sResult = CString.FormatResult(sMethod, bSuccess, sResult)
328
346
  return bSuccess, sResult
329
347
 
330
348
  # eof def Delete(self, bConfirmDelete=True):
@@ -334,13 +352,9 @@ Returns ``bSuccess`` and ``sResult`` (feedback).
334
352
 
335
353
  def __PrepareOutput(self, Content=""):
336
354
  """
337
- |
338
-
339
355
  Helper for ``Write`` and ``Append`` (consideration of composite data types).
340
356
 
341
357
  Returns a list of strings (that will be written to file).
342
-
343
- |
344
358
  """
345
359
 
346
360
  listOut = []
@@ -391,23 +405,50 @@ Returns a list of strings (that will be written to file).
391
405
 
392
406
  def Write(self, Content="", nVSpaceAfter=0, sPrefix=None, bToScreen=False):
393
407
  """
394
- |
395
-
396
408
  Writes the content of a variable ``Content`` to file.
397
409
 
398
- If ``Content`` is not a string, the ``Write`` method resolves the data structure (therefore ``Content`` can also be of type
399
- ``list``, ``tuple``, ``set``, ``dict``, ``dotdict``).
410
+ **Arguments:**
400
411
 
401
- Adds vertical space ``nVSpaceAfter`` (= number of blank lines) after ``Content``.
412
+ * ``Content``
402
413
 
403
- Prints ``Content`` also to screen in case of ``bToScreen`` is ``True`` (default: ``False``).
414
+ / *Condition*: required / *Type*: one of: str, list, tuple, set, dict, dotdict /
404
415
 
405
- Returns ``bSuccess`` and ``sResult`` (feedback).
416
+ If ``Content`` is not a string, the ``Write`` method resolves the data structure before writing the content to file.
417
+
418
+ * ``nVSpaceAfter``
419
+
420
+ / *Condition*: optional / *Type*: int / *Default*: 0 /
421
+
422
+ Adds vertical space ``nVSpaceAfter`` (= number of blank lines) after ``Content``.
423
+
424
+ * ``sPrefix``
425
+
426
+ / *Condition*: optional / *Type*: str / *Default*: None /
427
+
428
+ `sPrefix`` is added to every line of output (in case of ``sPrefix`` is not ``None``).
429
+
430
+ * ``bToScreen``
431
+
432
+ / *Condition*: optional / *Type*: bool / *Default*: False /
433
+
434
+ Prints ``Content`` also to screen (in case of ``bToScreen`` is ``True``).
406
435
 
407
- |
436
+ **Returns:**
437
+
438
+ * ``bSuccess``
439
+
440
+ / *Type*: bool /
441
+
442
+ Indicates if the computation of the method was successful or not.
443
+
444
+ * ``sResult``
445
+
446
+ / *Type*: str /
447
+
448
+ The result of the computation of the method.
408
449
  """
409
450
 
410
- sMethod = "CFile::Write"
451
+ sMethod = "CFile.Write"
411
452
 
412
453
  if self.__oFileStatus != enFileStatiType.openedforwriting:
413
454
  bSuccess, sResult = self.__OpenForWriting()
@@ -436,8 +477,8 @@ Returns ``bSuccess`` and ``sResult`` (feedback).
436
477
  except Exception as reason:
437
478
  bSuccess = None
438
479
  sResult = f"Not possible to write to file '{self.__sFile}'.\nReason: " + str(reason)
480
+ sResult = CString.FormatResult(sMethod, bSuccess, sResult)
439
481
 
440
- sResult = CString.FormatResult(sMethod, bSuccess, sResult)
441
482
  return bSuccess, sResult
442
483
 
443
484
  # eof def Write(self, Content="", nVSpaceAfter=0, sPrefix=None, bToScreen=False):
@@ -447,23 +488,49 @@ Returns ``bSuccess`` and ``sResult`` (feedback).
447
488
 
448
489
  def Append(self, Content="", nVSpaceAfter=0, sPrefix=None, bToScreen=False):
449
490
  """
450
- |
451
-
452
491
  Appends the content of a variable ``Content`` to file.
453
492
 
454
- If ``Content`` is not a string, the ``Write`` method resolves the data structure (therefore ``Content`` can also be of type
455
- ``list``, ``tuple``, ``set``, ``dict``, ``dotdict``).
493
+ **Arguments:**
456
494
 
457
- Adds vertical space ``nVSpaceAfter`` (= number of blank lines) after ``Content``.
495
+ * ``Content``
458
496
 
459
- Prints ``Content`` also to screen in case of ``bToScreen`` is ``True`` (default: ``False``).
497
+ / *Condition*: required / *Type*: one of: str, list, tuple, set, dict, dotdict /
460
498
 
461
- Returns ``bSuccess`` and ``sResult`` (feedback).
499
+ If ``Content`` is not a string, the ``Write`` method resolves the data structure before writing the content to file.
462
500
 
463
- |
464
- """
501
+ * ``nVSpaceAfter``
465
502
 
466
- sMethod = "CFile::Append"
503
+ / *Condition*: optional / *Type*: int / *Default*: 0 /
504
+
505
+ Adds vertical space ``nVSpaceAfter`` (= number of blank lines) after ``Content``.
506
+
507
+ * ``sPrefix``
508
+
509
+ / *Condition*: optional / *Type*: str / *Default*: None /
510
+
511
+ `sPrefix`` is added to every line of output (in case of ``sPrefix`` is not ``None``).
512
+
513
+ * ``bToScreen``
514
+
515
+ / *Condition*: optional / *Type*: bool / *Default*: False /
516
+
517
+ Prints ``Content`` also to screen (in case of ``bToScreen`` is ``True``).
518
+
519
+ **Returns:**
520
+
521
+ * ``bSuccess``
522
+
523
+ / *Type*: bool /
524
+
525
+ Indicates if the computation of the method was successful or not.
526
+
527
+ * ``sResult``
528
+
529
+ / *Type*: str /
530
+
531
+ The result of the computation of the method.
532
+ """
533
+ sMethod = "CFile.Append"
467
534
 
468
535
  if self.__oFileStatus != enFileStatiType.openedforappending:
469
536
  bSuccess, sResult = self.__OpenForAppending()
@@ -492,8 +559,8 @@ Returns ``bSuccess`` and ``sResult`` (feedback).
492
559
  except Exception as reason:
493
560
  bSuccess = None
494
561
  sResult = f"Not possible to append to file '{self.__sFile}'.\nReason: " + str(reason)
562
+ sResult = CString.FormatResult(sMethod, bSuccess, sResult)
495
563
 
496
- sResult = CString.FormatResult(sMethod, bSuccess, sResult)
497
564
  return bSuccess, sResult
498
565
 
499
566
  # eof def Append(self, Content="", nVSpaceAfter=0, sPrefix=None, bToScreen=False):
@@ -517,19 +584,119 @@ Returns ``bSuccess`` and ``sResult`` (feedback).
517
584
  bRStrip = True,
518
585
  bToScreen = False):
519
586
  """
520
- |
521
-
522
587
  Reads content from current file. Returns an array of lines together with ``bSuccess`` and ``sResult`` (feedback).
523
588
 
524
589
  The method takes care of opening and closing the file. The complete file content is read by ``ReadLines`` in one step,
525
590
  but with the help of further parameters it is possible to reduce the content by including and excluding lines.
526
591
 
527
- T.B.C.
592
+ Internally ``ReadLines`` uses the string filter method ``StringFilter``. All filter related input parameter of
593
+ ``ReadLines`` and ``StringFilter`` are the same.
594
+
595
+ The logical join of all filter is: ``AND``.
596
+
597
+ **Arguments:**
598
+
599
+ * ``bCaseSensitive``
528
600
 
529
- |
601
+ / *Condition*: optional / *Type*: bool / *Default*: True /
602
+
603
+ * If ``True``, the standard filters work case sensitive, otherwise not.
604
+ * This has no effect to the regular expression based filters ``sInclRegEx`` and ``sExclRegEx``.
605
+
606
+ * ``bSkipBlankLines``
607
+
608
+ / *Condition*: optional / *Type*: bool / *Default*: False /
609
+
610
+ If ``True``, blank lines will be skipped, otherwise not.
611
+
612
+ * ``sComment``
613
+
614
+ / *Condition*: optional / *Type*: str / *Default*: None /
615
+
616
+ In case of a line starts with the string ``sComment``, this line is skipped.
617
+
618
+ * ``sStartsWith``
619
+
620
+ / *Condition*: optional / *Type*: str / *Default*: None /
621
+
622
+ * The criterion of this filter is fulfilled in case of the input string starts with the string ``sStartsWith``
623
+ * More than one string can be provided (semicolon separated; logical join: ``OR``)
624
+
625
+ * ``sEndsWith``
626
+
627
+ / *Condition*: optional / *Type*: str / *Default*: None /
628
+
629
+ * The criterion of this filter is fulfilled in case of the input string ends with the string ``sEndsWith``
630
+ * More than one string can be provided (semicolon separated; logical join: ``OR``)
631
+
632
+ * ``sStartsNotWith``
633
+
634
+ / *Condition*: optional / *Type*: str / *Default*: None /
635
+
636
+ * The criterion of this filter is fulfilled in case of the input string starts not with the string ``sStartsNotWith``
637
+ * More than one string can be provided (semicolon separated; logical join: ``AND``)
638
+
639
+ * ``sEndsNotWith``
640
+
641
+ / *Condition*: optional / *Type*: str / *Default*: None /
642
+
643
+ * The criterion of this filter is fulfilled in case of the input string ends not with the string ``sEndsNotWith``
644
+ * More than one string can be provided (semicolon separated; logical join: ``AND``)
645
+
646
+ * ``sContains``
647
+
648
+ / *Condition*: optional / *Type*: str / *Default*: None /
649
+
650
+ * The criterion of this filter is fulfilled in case of the input string contains the string ``sContains`` at any position
651
+ * More than one string can be provided (semicolon separated; logical join: ``OR``)
652
+
653
+ * ``sContainsNot``
654
+
655
+ / *Condition*: optional / *Type*: str / *Default*: None /
656
+
657
+ * The criterion of this filter is fulfilled in case of the input string does **not** contain the string ``sContainsNot`` at any position
658
+ * More than one string can be provided (semicolon separated; logical join: ``AND``)
659
+
660
+ * ``sInclRegEx``
661
+
662
+ / *Condition*: optional / *Type*: str / *Default*: None /
663
+
664
+ * *Include* filter based on regular expressions (consider the syntax of regular expressions!)
665
+ * The criterion of this filter is fulfilled in case of the regular expression ``sInclRegEx`` matches the input string
666
+ * Leading and trailing blanks within the input string are considered
667
+ * ``bCaseSensitive`` has no effect
668
+ * A semicolon separated list of several regular expressions is **not** supported
669
+
670
+ * ``sExclRegEx``
671
+
672
+ / *Condition*: optional / *Type*: str / *Default*: None /
673
+
674
+ * *Exclude* filter based on regular expressions (consider the syntax of regular expressions!)
675
+ * The criterion of this filter is fulfilled in case of the regular expression ``sExclRegEx`` does **not** match the input string
676
+ * Leading and trailing blanks within the input string are considered
677
+ * ``bCaseSensitive`` has no effect
678
+ * A semicolon separated list of several regular expressions is **not** supported
679
+
680
+ * ``bLStrip``
681
+
682
+ / *Condition*: optional / *Type*: bool / *Default*: False /
683
+
684
+ If ``True``, leading spaces are removed from line before the filters are used, otherwise not.
685
+
686
+ * ``bRStrip``
687
+
688
+ / *Condition*: optional / *Type*: bool / *Default*: True /
689
+
690
+ If ``True``, trailing spaces are removed from line before the filters are used, otherwise not.
691
+
692
+ * ``bToScreen``
693
+
694
+ / *Condition*: optional / *Type*: bool / *Default*: False /
695
+
696
+ If ``True``, the content read from file is also printed to screen, otherwise not.
530
697
  """
531
698
 
532
- sMethod = "[CFile::ReadLines]"
699
+ sMethod = "CFile.ReadLines"
533
700
 
534
701
  listLines = []
535
702
 
@@ -593,7 +760,6 @@ T.B.C.
593
760
 
594
761
  bSuccess = True
595
762
  sResult = f"Read {nNrOfLines} lines from '{self.__sFile}'."
596
- sResult = CString.FormatResult(sMethod, bSuccess, sResult)
597
763
  return listLines, bSuccess, sResult
598
764
 
599
765
  # eof def ReadLines(...)
@@ -603,42 +769,55 @@ T.B.C.
603
769
 
604
770
  def GetFileInfo(self):
605
771
  """
606
- |
772
+ Returns the following informations about the file (encapsulated within a dictionary ``dFileInfo``):
607
773
 
608
- Returns the following informations about the file (encapsulated within a dictionary):
774
+ **Returns:**
609
775
 
610
- Key **sFile**
776
+ * Key ``sFile``
611
777
 
612
- Path and name of current file
778
+ / *Type*: str /
613
779
 
614
- Key **bFileIsExisting**
780
+ Path and name of current file
615
781
 
616
- ``True`` if file is existing, otherwise not
617
782
 
618
- Key **sFileName**
783
+ * Key ``bFileIsExisting``
619
784
 
620
- The name of the current file (incl. extension)
785
+ / *Type*: bool /
621
786
 
622
- Key **sFileExtension**
787
+ ``True`` if file is existing, otherwise ``False``
623
788
 
624
- The extension of the current file
789
+ * Key ``sFileName``
625
790
 
626
- Key **sFileNameOnly**
791
+ / *Type*: str /
627
792
 
628
- The pure name of the current file (without extension)
793
+ The name of the current file (incl. extension)
629
794
 
630
- Key **sFilePath**
795
+ * Key ``sFileExtension``
631
796
 
632
- The the path to current file
797
+ / *Type*: str /
633
798
 
634
- Key **bFilePathIsExisting**
799
+ The extension of the current file
635
800
 
636
- ``True`` if file path is existing, otherwise not
801
+ * Key ``sFileNameOnly``
637
802
 
638
- |
803
+ / *Type*: str /
804
+
805
+ The pure name of the current file (without extension)
806
+
807
+ * Key ``sFilePath``
808
+
809
+ / *Type*: str /
810
+
811
+ The the path to current file
812
+
813
+ * Key ``bFilePathIsExisting``
814
+
815
+ / *Type*: bool /
816
+
817
+ ``True`` if file path is existing, otherwise ``False``
639
818
  """
640
819
 
641
- sMethod = "CFile::GetFileInfo"
820
+ sMethod = "CFile.GetFileInfo"
642
821
 
643
822
  dFileInfo = {}
644
823
  dFileInfo['sFile'] = None
@@ -682,8 +861,6 @@ Key **bFilePathIsExisting**
682
861
 
683
862
  def CopyTo(self, sDestination=None, bOverwrite=False):
684
863
  """
685
- |
686
-
687
864
  Copies the current file to ``sDestination``, that can either be a path without file name or a path together with a file name.
688
865
 
689
866
  In case of the destination file already exists and ``bOverwrite`` is ``True``, than the destination file will be overwritten.
@@ -691,12 +868,37 @@ In case of the destination file already exists and ``bOverwrite`` is ``True``, t
691
868
  In case of the destination file already exists and ``bOverwrite`` is ``False`` (default), than the destination file will not be overwritten
692
869
  and ``CopyTo`` returns ``bSuccess = False``.
693
870
 
694
- Returns ``bSuccess`` and ``sResult`` (feedback).
871
+ **Arguments:**
695
872
 
696
- |
697
- """
873
+ * ``sDestination``
874
+
875
+ / *Condition*: required / *Type*: string /
876
+
877
+ The path to destination file (either incl. file name or without file name)
878
+
879
+ * ``bOverwrite``
880
+
881
+ / *Condition*: optional / *Type*: bool / *Default*: False /
882
+
883
+ * In case of the destination file already exists and ``bOverwrite`` is ``True``, than the destination file will be overwritten.
884
+ * In case of the destination file already exists and ``bOverwrite`` is ``False`` (default), than the destination file will not be overwritten
885
+ and ``CopyTo`` returns ``bSuccess = False``.
886
+
887
+ **Returns:**
888
+
889
+ * ``bSuccess``
890
+
891
+ / *Type*: bool /
892
+
893
+ Indicates if the computation of the method was successful or not.
894
+
895
+ * ``sResult``
698
896
 
699
- sMethod = "CFile::CopyTo"
897
+ / *Type*: str /
898
+
899
+ The result of the computation of the method.
900
+ """
901
+ sMethod = "CFile.CopyTo"
700
902
 
701
903
  if self.__sFile is None:
702
904
  bSuccess = False
@@ -786,6 +988,7 @@ Returns ``bSuccess`` and ``sResult`` (feedback).
786
988
  sResult = f"Exception while deleting destination file '{sDestFile}'.\nReason: " + str(reason)
787
989
  sResult = CString.FormatResult(sMethod, bSuccess, sResult)
788
990
  return bSuccess, sResult
991
+ # eof if bDeleteDestFile is True:
789
992
 
790
993
  try:
791
994
  shutil.copyfile(self.__sFile, sDestFile)
@@ -794,8 +997,8 @@ Returns ``bSuccess`` and ``sResult`` (feedback).
794
997
  except Exception as reason:
795
998
  bSuccess = None
796
999
  sResult = f"Exception while copying file '{self.__sFile}' to '{sDestFile}'.\nReason: " + str(reason)
1000
+ sResult = CString.FormatResult(sMethod, bSuccess, sResult)
797
1001
 
798
- sResult = CString.FormatResult(sMethod, bSuccess, sResult)
799
1002
  return bSuccess, sResult
800
1003
 
801
1004
  # eof def CopyTo(self, sDestination=None, bOverwrite=False):
@@ -805,21 +1008,39 @@ Returns ``bSuccess`` and ``sResult`` (feedback).
805
1008
 
806
1009
  def MoveTo(self, sDestination=None, bOverwrite=False):
807
1010
  """
808
- |
809
-
810
1011
  Moves the current file to ``sDestination``, that can either be a path without file name or a path together with a file name.
811
1012
 
812
- In case of the destination file already exists and ``bOverwrite`` is ``True``, than the destination file will be overwritten.
1013
+ **Arguments:**
813
1014
 
814
- In case of the destination file already exists and ``bOverwrite`` is ``False`` (default), than the destination file will not be overwritten
815
- and ``CopyTo`` returns ``bSuccess = False``.
1015
+ * ``sDestination``
816
1016
 
817
- Returns ``bSuccess`` and ``sResult`` (feedback).
1017
+ / *Condition*: required / *Type*: string /
818
1018
 
819
- |
820
- """
1019
+ The path to destination file (either incl. file name or without file name)
1020
+
1021
+ * ``bOverwrite``
821
1022
 
822
- sMethod = "CFile::MoveTo"
1023
+ / *Condition*: optional / *Type*: bool / *Default*: False /
1024
+
1025
+ * In case of the destination file already exists and ``bOverwrite`` is ``True``, than the destination file will be overwritten.
1026
+ * In case of the destination file already exists and ``bOverwrite`` is ``False`` (default), than the destination file will not be overwritten
1027
+ and ``MoveTo`` returns ``bSuccess = False``.
1028
+
1029
+ **Returns:**
1030
+
1031
+ * ``bSuccess``
1032
+
1033
+ / *Type*: bool /
1034
+
1035
+ Indicates if the computation was successful or not
1036
+
1037
+ * ``sResult``
1038
+
1039
+ / *Type*: str /
1040
+
1041
+ Contains details about what happens during computation
1042
+ """
1043
+ sMethod = "CFile.MoveTo"
823
1044
 
824
1045
  bSuccess, sResult = self.CopyTo(sDestination, bOverwrite)
825
1046
  if bSuccess is not True:
@@ -840,7 +1061,6 @@ Returns ``bSuccess`` and ``sResult`` (feedback).
840
1061
 
841
1062
  bSuccess = True
842
1063
  sResult = f"File moved from '{self.__sFile}' to '{self.__sLastDestination}'"
843
- sResult = CString.FormatResult(sMethod, bSuccess, sResult)
844
1064
  return bSuccess, sResult
845
1065
 
846
1066
  # eof def MoveTo(self, sDestination=None, bOverwrite=False):