python-gammu 3.2.3__tar.gz → 3.2.5__tar.gz

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 (123) hide show
  1. {python-gammu-3.2.3 → python_gammu-3.2.5}/NEWS.rst +17 -1
  2. {python-gammu-3.2.3 → python_gammu-3.2.5}/PKG-INFO +18 -39
  3. {python-gammu-3.2.3 → python_gammu-3.2.5}/README.rst +2 -21
  4. {python-gammu-3.2.3 → python_gammu-3.2.5}/examples/addcontacts.py +1 -1
  5. {python-gammu-3.2.3 → python_gammu-3.2.5}/examples/addfile.py +3 -3
  6. {python-gammu-3.2.3 → python_gammu-3.2.5}/examples/async.py +30 -22
  7. {python-gammu-3.2.3 → python_gammu-3.2.5}/examples/backup_convertor.py +1 -3
  8. {python-gammu-3.2.3 → python_gammu-3.2.5}/examples/debugging.py +6 -6
  9. {python-gammu-3.2.3 → python_gammu-3.2.5}/examples/doc-exceptions.py +3 -3
  10. {python-gammu-3.2.3 → python_gammu-3.2.5}/examples/dummy_phone.py +36 -40
  11. {python-gammu-3.2.3 → python_gammu-3.2.5}/examples/filesystem_test.py +66 -116
  12. {python-gammu-3.2.3 → python_gammu-3.2.5}/examples/getallcalendar.py +5 -6
  13. {python-gammu-3.2.3 → python_gammu-3.2.5}/examples/getallmemory.py +4 -4
  14. {python-gammu-3.2.3 → python_gammu-3.2.5}/examples/getallmemory_nonext.py +5 -5
  15. {python-gammu-3.2.3 → python_gammu-3.2.5}/examples/getallsms.py +6 -6
  16. {python-gammu-3.2.3 → python_gammu-3.2.5}/examples/getallsms_decode.py +9 -9
  17. {python-gammu-3.2.3 → python_gammu-3.2.5}/examples/getalltodo.py +5 -5
  18. {python-gammu-3.2.3 → python_gammu-3.2.5}/examples/incoming.py +5 -5
  19. {python-gammu-3.2.3 → python_gammu-3.2.5}/examples/listfilesystem.py +8 -21
  20. {python-gammu-3.2.3 → python_gammu-3.2.5}/examples/mass_sms.py +2 -3
  21. python_gammu-3.2.5/examples/network_info.py +106 -0
  22. {python-gammu-3.2.3 → python_gammu-3.2.5}/examples/read_sms_backup.py +10 -10
  23. {python-gammu-3.2.3 → python_gammu-3.2.5}/examples/savesmspercontact.py +20 -25
  24. {python-gammu-3.2.3 → python_gammu-3.2.5}/examples/sendlongsms.py +1 -2
  25. {python-gammu-3.2.3 → python_gammu-3.2.5}/examples/sendsms.py +1 -4
  26. python_gammu-3.2.5/examples/service_numbers.py +94 -0
  27. {python-gammu-3.2.3 → python_gammu-3.2.5}/examples/sms_replier.py +6 -6
  28. {python-gammu-3.2.3 → python_gammu-3.2.5}/examples/smsbackup.py +1 -3
  29. {python-gammu-3.2.3 → python_gammu-3.2.5}/examples/smsd_inject.py +1 -2
  30. {python-gammu-3.2.3 → python_gammu-3.2.5}/examples/smsd_state.py +1 -2
  31. {python-gammu-3.2.3 → python_gammu-3.2.5}/examples/vcs.py +2 -6
  32. {python-gammu-3.2.3 → python_gammu-3.2.5}/examples/worker.py +13 -21
  33. {python-gammu-3.2.3/test → python_gammu-3.2.5/gammu}/__init__.py +5 -0
  34. {python-gammu-3.2.3 → python_gammu-3.2.5}/gammu/asyncworker.py +36 -19
  35. {python-gammu-3.2.3 → python_gammu-3.2.5}/gammu/data.py +5 -6
  36. {python-gammu-3.2.3 → python_gammu-3.2.5}/gammu/exception.py +2 -4
  37. {python-gammu-3.2.3 → python_gammu-3.2.5}/gammu/smsd.py +2 -3
  38. {python-gammu-3.2.3 → python_gammu-3.2.5}/gammu/src/convertors/backup.c +1 -1
  39. {python-gammu-3.2.3 → python_gammu-3.2.5}/gammu/src/convertors/base.c +1 -58
  40. {python-gammu-3.2.3 → python_gammu-3.2.5}/gammu/src/convertors/bitmap.c +3 -3
  41. {python-gammu-3.2.3 → python_gammu-3.2.5}/gammu/src/convertors/calendar.c +2 -2
  42. {python-gammu-3.2.3 → python_gammu-3.2.5}/gammu/src/convertors/call.c +1 -1
  43. {python-gammu-3.2.3 → python_gammu-3.2.5}/gammu/src/convertors/diverts.c +1 -1
  44. {python-gammu-3.2.3 → python_gammu-3.2.5}/gammu/src/convertors/file.c +1 -1
  45. {python-gammu-3.2.3 → python_gammu-3.2.5}/gammu/src/convertors/memory.c +2 -2
  46. {python-gammu-3.2.3 → python_gammu-3.2.5}/gammu/src/convertors/misc.c +1 -1
  47. {python-gammu-3.2.3 → python_gammu-3.2.5}/gammu/src/convertors/ringtone.c +5 -5
  48. {python-gammu-3.2.3 → python_gammu-3.2.5}/gammu/src/convertors/sms.c +7 -10
  49. {python-gammu-3.2.3 → python_gammu-3.2.5}/gammu/src/convertors/string.c +45 -22
  50. {python-gammu-3.2.3 → python_gammu-3.2.5}/gammu/src/convertors/time.c +25 -30
  51. {python-gammu-3.2.3 → python_gammu-3.2.5}/gammu/src/convertors/todo.c +2 -2
  52. {python-gammu-3.2.3 → python_gammu-3.2.5}/gammu/src/convertors/wap.c +2 -2
  53. {python-gammu-3.2.3 → python_gammu-3.2.5}/gammu/src/data.c +1 -1
  54. {python-gammu-3.2.3 → python_gammu-3.2.5}/gammu/src/errors.c +1 -1
  55. {python-gammu-3.2.3 → python_gammu-3.2.5}/gammu/src/gammu.c +61 -96
  56. {python-gammu-3.2.3 → python_gammu-3.2.5}/gammu/src/misc.c +1 -1
  57. {python-gammu-3.2.3 → python_gammu-3.2.5}/gammu/src/smsd.c +4 -7
  58. {python-gammu-3.2.3 → python_gammu-3.2.5}/gammu/worker.py +49 -84
  59. {python-gammu-3.2.3 → python_gammu-3.2.5}/include/convertors.h +4 -4
  60. {python-gammu-3.2.3 → python_gammu-3.2.5}/include/data.h +1 -1
  61. {python-gammu-3.2.3 → python_gammu-3.2.5}/include/errors.h +1 -1
  62. {python-gammu-3.2.3 → python_gammu-3.2.5}/include/misc.h +2 -2
  63. python_gammu-3.2.5/pyproject.toml +194 -0
  64. {python-gammu-3.2.3 → python_gammu-3.2.5}/python_gammu.egg-info/PKG-INFO +18 -39
  65. {python-gammu-3.2.3 → python_gammu-3.2.5}/python_gammu.egg-info/SOURCES.txt +3 -2
  66. python_gammu-3.2.5/setup.cfg +4 -0
  67. {python-gammu-3.2.3 → python_gammu-3.2.5}/setup.py +15 -61
  68. {python-gammu-3.2.3 → python_gammu-3.2.5}/test/test_asyncworker.py +12 -9
  69. {python-gammu-3.2.3 → python_gammu-3.2.5}/test/test_backup.py +15 -17
  70. {python-gammu-3.2.3 → python_gammu-3.2.5}/test/test_config.py +27 -26
  71. python_gammu-3.2.5/test/test_data.py +54 -0
  72. {python-gammu-3.2.3 → python_gammu-3.2.5}/test/test_dummy.py +188 -117
  73. {python-gammu-3.2.3 → python_gammu-3.2.5}/test/test_errors.py +8 -7
  74. {python-gammu-3.2.3 → python_gammu-3.2.5}/test/test_sms.py +23 -28
  75. {python-gammu-3.2.3 → python_gammu-3.2.5}/test/test_smsd.py +42 -24
  76. python_gammu-3.2.5/test/test_unicode_surrogates.py +163 -0
  77. {python-gammu-3.2.3 → python_gammu-3.2.5}/test/test_worker.py +7 -7
  78. python-gammu-3.2.3/examples/service_numbers.py +0 -104
  79. python-gammu-3.2.3/gammu/__init__.py +0 -36
  80. python-gammu-3.2.3/setup.cfg +0 -12
  81. python-gammu-3.2.3/test/test_data.py +0 -32
  82. {python-gammu-3.2.3 → python_gammu-3.2.5}/AUTHORS +0 -0
  83. {python-gammu-3.2.3 → python_gammu-3.2.5}/COPYING +0 -0
  84. {python-gammu-3.2.3 → python_gammu-3.2.5}/MANIFEST.in +0 -0
  85. {python-gammu-3.2.3 → python_gammu-3.2.5}/examples/batteryinfo.py +0 -0
  86. {python-gammu-3.2.3 → python_gammu-3.2.5}/examples/data/cgi.jpg +0 -0
  87. {python-gammu-3.2.3 → python_gammu-3.2.5}/examples/dialvoice.py +0 -0
  88. {python-gammu-3.2.3 → python_gammu-3.2.5}/examples/getdiverts.py +0 -0
  89. {python-gammu-3.2.3 → python_gammu-3.2.5}/examples/pdu_decoder.py +0 -0
  90. {python-gammu-3.2.3 → python_gammu-3.2.5}/examples/setdiverts.py +0 -0
  91. {python-gammu-3.2.3 → python_gammu-3.2.5}/python_gammu.egg-info/dependency_links.txt +0 -0
  92. {python-gammu-3.2.3 → python_gammu-3.2.5}/python_gammu.egg-info/top_level.txt +0 -0
  93. {python-gammu-3.2.3/examples → python_gammu-3.2.5/test}/__init__.py +0 -0
  94. {python-gammu-3.2.3 → python_gammu-3.2.5}/test/data/02.vcs +0 -0
  95. {python-gammu-3.2.3 → python_gammu-3.2.5}/test/data/UK32Holidays.ics +0 -0
  96. {python-gammu-3.2.3 → python_gammu-3.2.5}/test/data/bug-779.vcf +0 -0
  97. {python-gammu-3.2.3 → python_gammu-3.2.5}/test/data/gammu-dummy/calendar/2 +0 -0
  98. {python-gammu-3.2.3 → python_gammu-3.2.5}/test/data/gammu-dummy/calendar/22 +0 -0
  99. {python-gammu-3.2.3 → python_gammu-3.2.5}/test/data/gammu-dummy/fs/dir2/dir2-5/file1 +0 -0
  100. {python-gammu-3.2.3 → python_gammu-3.2.5}/test/data/gammu-dummy/fs/dir2/dir2-5/file2 +0 -0
  101. {python-gammu-3.2.3 → python_gammu-3.2.5}/test/data/gammu-dummy/fs/dir2/dir2-5/file3 +0 -0
  102. {python-gammu-3.2.3 → python_gammu-3.2.5}/test/data/gammu-dummy/fs/dir2/dir2-5/file4 +0 -0
  103. {python-gammu-3.2.3 → python_gammu-3.2.5}/test/data/gammu-dummy/fs/dir2/file5 +0 -0
  104. {python-gammu-3.2.3 → python_gammu-3.2.5}/test/data/gammu-dummy/fs/file5 +0 -0
  105. {python-gammu-3.2.3 → python_gammu-3.2.5}/test/data/gammu-dummy/pbk/ME/1 +0 -0
  106. {python-gammu-3.2.3 → python_gammu-3.2.5}/test/data/gammu-dummy/pbk/ME/101 +0 -0
  107. {python-gammu-3.2.3 → python_gammu-3.2.5}/test/data/gammu-dummy/pbk/ME/103 +0 -0
  108. {python-gammu-3.2.3 → python_gammu-3.2.5}/test/data/gammu-dummy/pbk/SM/1 +0 -0
  109. {python-gammu-3.2.3 → python_gammu-3.2.5}/test/data/gammu-dummy/sms/1/1 +0 -0
  110. {python-gammu-3.2.3 → python_gammu-3.2.5}/test/data/gammu-dummy/sms/2/10 +0 -0
  111. {python-gammu-3.2.3 → python_gammu-3.2.5}/test/data/gammu-dummy/sms/3/42 +0 -0
  112. {python-gammu-3.2.3 → python_gammu-3.2.5}/test/data/gammu-dummy/sms/4/15 +0 -0
  113. {python-gammu-3.2.3 → python_gammu-3.2.5}/test/data/gammu-dummy/sms/4/20 +0 -0
  114. {python-gammu-3.2.3 → python_gammu-3.2.5}/test/data/gammu-dummy/sms/4/21 +0 -0
  115. {python-gammu-3.2.3 → python_gammu-3.2.5}/test/data/gammu-dummy/todo/22 +0 -0
  116. {python-gammu-3.2.3 → python_gammu-3.2.5}/test/data/gammu-dummy/todo/3 +0 -0
  117. {python-gammu-3.2.3 → python_gammu-3.2.5}/test/data/gammu.vcf +0 -0
  118. {python-gammu-3.2.3 → python_gammu-3.2.5}/test/data/k770.vcs +0 -0
  119. {python-gammu-3.2.3 → python_gammu-3.2.5}/test/data/rrule.ics +0 -0
  120. {python-gammu-3.2.3 → python_gammu-3.2.5}/test/data/sqlite-14.sql +0 -0
  121. {python-gammu-3.2.3 → python_gammu-3.2.5}/test/data/sqlite-15.sql +0 -0
  122. {python-gammu-3.2.3 → python_gammu-3.2.5}/test/data/sqlite-16.sql +0 -0
  123. {python-gammu-3.2.3 → python_gammu-3.2.5}/test/data/sqlite-17.sql +0 -0
@@ -1,7 +1,23 @@
1
+ 3.2.5
2
+ =====
3
+
4
+ * Compatibility with Python 3.11-3.14.
5
+ * Dropped support for Python 3.6-3.9.
6
+ * Modernized build system.
7
+ * Binary wheels are now provided only for 64-bit Windows.
8
+ * Fixed depreciation warnings while compiling.
9
+ * Safer decoding of Unicode strings.
10
+ * Corrected NetworkName return value.
11
+
12
+ 3.2.4
13
+ =====
14
+
15
+ * Compatibility with Python 3.10.
16
+
1
17
  3.2.3
2
18
  =====
3
19
 
4
- * Fixed uninitalized memory usage in DeleteSMS.
20
+ * Fixed uninitialized memory usage in DeleteSMS.
5
21
 
6
22
  3.2.2
7
23
  =====
@@ -1,39 +1,39 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: python-gammu
3
- Version: 3.2.3
3
+ Version: 3.2.5
4
4
  Summary: Gammu bindings
5
- Home-page: https://wammu.eu/python-gammu/
6
- Author: Michal Cihar
7
- Author-email: michal@cihar.com
8
- License: GPLv2+
9
- Download-URL: https://wammu.eu/download/python-gammu/
10
- Keywords: mobile,phone,SMS,contact,gammu,calendar,todo
5
+ Author-email: Michal Čihař <michal@cihar.com>
6
+ License-Expression: GPL-2.0-or-later
7
+ Project-URL: Download, https://wammu.eu/download/python-gammu/
8
+ Project-URL: Homepage, https://wammu.eu/python-gammu/
9
+ Keywords: calendar,contact,gammu,mobile,phone,SMS,todo
11
10
  Platform: Linux
12
11
  Platform: Mac OSX
13
- Platform: Windows XP/2000/NT
14
12
  Platform: Windows 95/98/ME
13
+ Platform: Windows XP/2000/NT
15
14
  Classifier: Development Status :: 6 - Mature
16
15
  Classifier: Intended Audience :: Developers
17
16
  Classifier: Intended Audience :: Telecommunications Industry
18
- Classifier: License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)
19
17
  Classifier: Operating System :: MacOS
20
18
  Classifier: Operating System :: Microsoft :: Windows
21
19
  Classifier: Operating System :: POSIX
22
20
  Classifier: Operating System :: Unix
23
21
  Classifier: Programming Language :: C
24
- Classifier: Programming Language :: Python
25
22
  Classifier: Programming Language :: Python :: 3
26
- Classifier: Programming Language :: Python :: 3.6
27
- Classifier: Programming Language :: Python :: 3.7
28
- Classifier: Programming Language :: Python :: 3.8
29
- Classifier: Programming Language :: Python :: 3.9
23
+ Classifier: Programming Language :: Python :: 3.10
24
+ Classifier: Programming Language :: Python :: 3.11
25
+ Classifier: Programming Language :: Python :: 3.12
26
+ Classifier: Programming Language :: Python :: 3.13
27
+ Classifier: Programming Language :: Python :: 3.14
28
+ Classifier: Programming Language :: Python
30
29
  Classifier: Topic :: Communications :: Telephony
31
30
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
32
31
  Classifier: Topic :: System :: Hardware
33
- Requires-Python: >=3.6
32
+ Requires-Python: >=3.10
34
33
  Description-Content-Type: text/x-rst
35
34
  License-File: COPYING
36
35
  License-File: AUTHORS
36
+ Dynamic: license-file
37
37
 
38
38
  python-gammu
39
39
  ============
@@ -43,23 +43,10 @@ Python bindings for the `Gammu library <https://wammu.eu/gammu/>`_.
43
43
  .. image:: https://github.com/gammu/python-gammu/actions/workflows/test.yml/badge.svg
44
44
  :target: https://github.com/gammu/python-gammu/actions/workflows/test.yml
45
45
 
46
- .. image:: https://api.codacy.com/project/badge/Grade/c7e87df480fb4609aa48482873f5c46b
47
- :target: https://www.codacy.com/app/Gammu/python-gammu
48
-
49
- .. image:: https://coveralls.io/repos/gammu/python-gammu/badge.svg
50
- :target: https://coveralls.io/r/gammu/python-gammu
51
-
52
- .. image:: https://scan.coverity.com/projects/4837/badge.svg
53
- :target: https://scan.coverity.com/projects/4837
54
-
55
46
  .. image:: https://img.shields.io/liberapay/receives/Gammu.svg
56
47
  :alt: Liberapay
57
48
  :target: https://liberapay.com/Gammu/donate
58
49
 
59
- .. image:: https://www.bountysource.com/badge/team?team_id=23177&style=bounties_received
60
- :alt: Bountysource
61
- :target: https://www.bountysource.com/teams/gammu/issues?utm_source=Gammu&utm_medium=shield&utm_campaign=bounties_received
62
-
63
50
  .. image:: https://img.shields.io/pypi/v/python-gammu.svg
64
51
  :alt: PyPI
65
52
  :target: https://pypi.python.org/pypi/python-gammu/
@@ -72,7 +59,7 @@ Homepage
72
59
  License
73
60
  =======
74
61
 
75
- Copyright (C) 2003 - 2018 Michal Cihar
62
+ Copyright (C) Michal Čihař <michal@cihar.com>
76
63
 
77
64
  This program is free software; you can redistribute it and/or modify
78
65
  it under the terms of the GNU General Public License as published by
@@ -91,13 +78,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
91
78
  Installing
92
79
  ==========
93
80
 
94
- You can install in a usual way for Python modules using distutils, so use
95
- ``setup.py`` which is placed in the top level directory::
96
-
97
- ./setup.py build
98
- sudo ./setup.py install
99
-
100
- You can also install it using pip installer::
81
+ Install it using pip installer::
101
82
 
102
83
  pip install python-gammu
103
84
 
@@ -137,5 +118,3 @@ Feedback and bug reports
137
118
 
138
119
  Any feedback is welcome, see <https://wammu.eu/support/> for information
139
120
  how to contact developers.
140
-
141
-
@@ -6,23 +6,10 @@ Python bindings for the `Gammu library <https://wammu.eu/gammu/>`_.
6
6
  .. image:: https://github.com/gammu/python-gammu/actions/workflows/test.yml/badge.svg
7
7
  :target: https://github.com/gammu/python-gammu/actions/workflows/test.yml
8
8
 
9
- .. image:: https://api.codacy.com/project/badge/Grade/c7e87df480fb4609aa48482873f5c46b
10
- :target: https://www.codacy.com/app/Gammu/python-gammu
11
-
12
- .. image:: https://coveralls.io/repos/gammu/python-gammu/badge.svg
13
- :target: https://coveralls.io/r/gammu/python-gammu
14
-
15
- .. image:: https://scan.coverity.com/projects/4837/badge.svg
16
- :target: https://scan.coverity.com/projects/4837
17
-
18
9
  .. image:: https://img.shields.io/liberapay/receives/Gammu.svg
19
10
  :alt: Liberapay
20
11
  :target: https://liberapay.com/Gammu/donate
21
12
 
22
- .. image:: https://www.bountysource.com/badge/team?team_id=23177&style=bounties_received
23
- :alt: Bountysource
24
- :target: https://www.bountysource.com/teams/gammu/issues?utm_source=Gammu&utm_medium=shield&utm_campaign=bounties_received
25
-
26
13
  .. image:: https://img.shields.io/pypi/v/python-gammu.svg
27
14
  :alt: PyPI
28
15
  :target: https://pypi.python.org/pypi/python-gammu/
@@ -35,7 +22,7 @@ Homepage
35
22
  License
36
23
  =======
37
24
 
38
- Copyright (C) 2003 - 2018 Michal Cihar
25
+ Copyright (C) Michal Čihař <michal@cihar.com>
39
26
 
40
27
  This program is free software; you can redistribute it and/or modify
41
28
  it under the terms of the GNU General Public License as published by
@@ -54,13 +41,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
54
41
  Installing
55
42
  ==========
56
43
 
57
- You can install in a usual way for Python modules using distutils, so use
58
- ``setup.py`` which is placed in the top level directory::
59
-
60
- ./setup.py build
61
- sudo ./setup.py install
62
-
63
- You can also install it using pip installer::
44
+ Install it using pip installer::
64
45
 
65
46
  pip install python-gammu
66
47
 
@@ -26,7 +26,7 @@ import sys
26
26
  import gammu
27
27
 
28
28
 
29
- def main():
29
+ def main() -> None:
30
30
  if len(sys.argv) != 3:
31
31
  print("This requires two parameters: memory_type and backup file (eg. vcard)!")
32
32
  sys.exit(1)
@@ -22,18 +22,18 @@
22
22
 
23
23
 
24
24
  import os
25
+ import pathlib
25
26
  import sys
26
27
 
27
28
  import gammu
28
29
 
29
30
 
30
- def main():
31
+ def main() -> None:
31
32
  if len(sys.argv) != 3:
32
33
  print("This requires two parameters: file to upload and path!")
33
34
  sys.exit(1)
34
35
 
35
- with open(sys.argv[1], "rb") as handle:
36
- data = handle.read()
36
+ data = pathlib.Path(sys.argv[1]).read_bytes()
37
37
 
38
38
  state_machine = gammu.StateMachine()
39
39
  state_machine.ReadConfig()
@@ -19,10 +19,10 @@
19
19
  # with this program; if not, write to the Free Software Foundation, Inc.,
20
20
  # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21
21
  """
22
- python-gammu - Phone communication libary
23
- Gammu asynchronous wrapper example with asyncio. This allows your application to care
24
- only about handling received data and not about phone communication
25
- details.
22
+ Gammu asynchronous wrapper example with asyncio.
23
+
24
+ This allows your application to care only about handling received data and not
25
+ about phone communication details.
26
26
  """
27
27
 
28
28
  import asyncio
@@ -32,7 +32,7 @@ import gammu
32
32
  import gammu.asyncworker
33
33
 
34
34
 
35
- async def send_message_async(state_machine, number, message):
35
+ async def send_message_async(state_machine, number, message) -> None:
36
36
  smsinfo = {
37
37
  "Class": -1,
38
38
  "Unicode": False,
@@ -41,41 +41,49 @@ async def send_message_async(state_machine, number, message):
41
41
  # Encode messages
42
42
  encoded = gammu.EncodeSMS(smsinfo)
43
43
  # Send messages
44
- for message in encoded:
44
+ for encoded_message in encoded:
45
45
  # Fill in numbers
46
- message["SMSC"] = {"Location": 1}
47
- message["Number"] = number
46
+ encoded_message["SMSC"] = {"Location": 1}
47
+ encoded_message["Number"] = number
48
48
  # Actually send the message
49
- await state_machine.send_sms_async(message)
49
+ await state_machine.send_sms_async(encoded_message)
50
50
 
51
51
 
52
- async def get_network_info(worker):
52
+ async def get_network_info(worker) -> None:
53
53
  info = await worker.get_network_info_async()
54
54
  print("NetworkName:", info["NetworkName"])
55
+
56
+ # If NetworkName is empty, look it up in the GSMNetworks database
57
+ if not info["NetworkName"] and info["NetworkCode"]:
58
+ network_code = info["NetworkCode"]
59
+ if network_code in gammu.GSMNetworks:
60
+ print(" NetworkName (from DB):", gammu.GSMNetworks[network_code])
61
+ else:
62
+ print(" NetworkName (from DB): Unknown network code")
63
+
55
64
  print(" State:", info["State"])
56
65
  print(" NetworkCode:", info["NetworkCode"])
57
66
  print(" CID:", info["CID"])
58
67
  print(" LAC:", info["LAC"])
59
68
 
60
69
 
61
- async def get_info(worker):
62
- print("Phone infomation:")
70
+ async def get_info(worker) -> None:
71
+ print("Phone information:")
63
72
  manufacturer = await worker.get_manufacturer_async()
64
- print("{:<15}: {}".format("Manufacturer", manufacturer))
73
+ print(f"{'Manufacturer':<15}: {manufacturer}")
65
74
  model = await worker.get_model_async()
66
- print("{:<15}: {} ({})".format("Model", model[0], model[1]))
75
+ print(f"{'Model':<15}: {model[0]} ({model[1]})")
67
76
  imei = await worker.get_imei_async()
68
- print("{:<15}: {}".format("IMEI", imei))
77
+ print(f"{'IMEI':<15}: {imei}")
69
78
  firmware = await worker.get_firmware_async()
70
- print("{:<15}: {}".format("Firmware", firmware[0]))
71
-
79
+ print(f"{'Firmware':<15}: {firmware[0]}")
72
80
 
73
- async def main():
74
81
 
82
+ async def main() -> None:
75
83
  gammu.SetDebugFile(sys.stderr)
76
84
  gammu.SetDebugLevel("textall")
77
85
 
78
- config = dict(Device="/dev/ttyS6", Connection="at")
86
+ config = {"Device": "/dev/ttyS6", "Connection": "at"}
79
87
  worker = gammu.asyncworker.GammuAsyncWorker()
80
88
  worker.configure(config)
81
89
 
@@ -93,13 +101,13 @@ async def main():
93
101
  while 1:
94
102
  try:
95
103
  signal = await worker.get_signal_quality_async()
96
- print("Signal is at {:d}%".format(signal["SignalPercent"]))
97
- except Exception as e:
104
+ print(f"Signal is at {signal['SignalPercent']:d}%")
105
+ except Exception as e: # noqa: BLE001
98
106
  print(f"Exception reading signal: {e}")
99
107
 
100
108
  await asyncio.sleep(10)
101
109
 
102
- except Exception as e:
110
+ except Exception as e: # noqa: BLE001
103
111
  print("Exception:")
104
112
  print(e)
105
113
 
@@ -26,9 +26,7 @@ import sys
26
26
  import gammu
27
27
 
28
28
  if len(sys.argv) != 3:
29
- print(
30
- "This requires two parameter with file names!" " First is input, second output."
31
- )
29
+ print("This requires two parameter with file names! First is input, second output.")
32
30
  sys.exit(1)
33
31
 
34
32
  backup = gammu.ReadBackup(sys.argv[1])
@@ -26,7 +26,7 @@ import sys
26
26
  import gammu
27
27
 
28
28
 
29
- def main():
29
+ def main() -> None:
30
30
  # Global debug level
31
31
  gammu.SetDebugFile(sys.stderr)
32
32
  gammu.SetDebugLevel("textall")
@@ -45,11 +45,11 @@ def main():
45
45
  model = state_machine.GetModel()
46
46
  imei = state_machine.GetIMEI()
47
47
  firmware = state_machine.GetFirmware()
48
- print("Phone infomation:")
49
- print("{:<15}: {}".format("Manufacturer", manufacturer))
50
- print("{:<15}: {} ({})".format("Model", model[0], model[1]))
51
- print("{:<15}: {}".format("IMEI", imei))
52
- print("{:<15}: {}".format("Firmware", firmware[0]))
48
+ print("Phone information:")
49
+ print(f"{'Manufacturer':<15}: {manufacturer}")
50
+ print(f"{'Model':<15}: {model[0]} ({model[1]})")
51
+ print(f"{'IMEI':<15}: {imei}")
52
+ print(f"{'Firmware':<15}: {firmware[0]}")
53
53
 
54
54
 
55
55
  if __name__ == "__main__":
@@ -24,13 +24,13 @@
24
24
  import gammu.exception
25
25
 
26
26
 
27
- def main():
27
+ def main() -> None:
28
28
  for exc in sorted(gammu.exception.__all__):
29
29
  print(f".. exception:: gammu.{exc}")
30
30
  print()
31
31
  doc = getattr(gammu.exception, exc).__doc__
32
- for doc in doc.splitlines():
33
- print(f" {doc}")
32
+ for line in doc.splitlines():
33
+ print(f" {line}")
34
34
  print()
35
35
 
36
36
 
@@ -20,17 +20,18 @@
20
20
  # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21
21
  #
22
22
  """
23
- python-gammu - Test script to test several Gammu operations
24
- (usually using dummy driver, but it depends on config)
25
- """
23
+ Dummy driver example.
26
24
 
25
+ Test script to test several Gammu operations (usually using dummy driver, but
26
+ it depends on config).
27
+ """
27
28
 
28
29
  import sys
29
30
 
30
31
  import gammu
31
32
 
32
33
 
33
- def get_all_memory(state_machine, memory_type):
34
+ def get_all_memory(state_machine, memory_type) -> None:
34
35
  status = state_machine.GetMemoryStatus(Type=memory_type)
35
36
 
36
37
  remain = status["Used"]
@@ -45,18 +46,18 @@ def get_all_memory(state_machine, memory_type):
45
46
  entry = state_machine.GetNextMemory(
46
47
  Location=entry["Location"], Type=memory_type
47
48
  )
48
- remain = remain - 1
49
+ remain -= 1
49
50
 
50
51
  print()
51
- print("{:<15}: {:d}".format("Location", entry["Location"]))
52
+ print(f"{'Location':<15}: {entry['Location']:d}")
52
53
  for v in entry["Entries"]:
53
54
  if v["Type"] in ("Photo"):
54
- print("{:<15}: {}...".format(v["Type"], repr(v["Value"])[:30]))
55
+ print(f"{v['Type']:<15}: {repr(v['Value'])[:30]}...")
55
56
  else:
56
- print("{:<15}: {}".format(v["Type"], v["Value"]))
57
+ print(f"{v['Type']:<15}: {v['Value']}")
57
58
 
58
59
 
59
- def get_all_calendar(state_machine):
60
+ def get_all_calendar(state_machine) -> None:
60
61
  status = state_machine.GetCalendarStatus()
61
62
 
62
63
  remain = status["Used"]
@@ -69,16 +70,16 @@ def get_all_calendar(state_machine):
69
70
  start = False
70
71
  else:
71
72
  entry = state_machine.GetNextCalendar(Location=entry["Location"])
72
- remain = remain - 1
73
+ remain -= 1
73
74
 
74
75
  print()
75
- print("{:<20}: {:d}".format("Location", entry["Location"]))
76
- print("{:<20}: {}".format("Type", entry["Type"]))
76
+ print(f"{'Location':<20}: {entry['Location']:d}")
77
+ print(f"{'Type':<20}: {entry['Type']}")
77
78
  for v in entry["Entries"]:
78
- print("{:<20}: {}".format(v["Type"], v["Value"]))
79
+ print(f"{v['Type']:<20}: {v['Value']}")
79
80
 
80
81
 
81
- def get_battery_status(state_machine):
82
+ def get_battery_status(state_machine) -> None:
82
83
  status = state_machine.GetBatteryCharge()
83
84
 
84
85
  for x in status:
@@ -99,37 +100,32 @@ def get_all_sms(state_machine):
99
100
  start = False
100
101
  else:
101
102
  sms = state_machine.GetNextSMS(Location=sms[0]["Location"], Folder=0)
102
- remain = remain - len(sms)
103
+ remain -= len(sms)
103
104
 
104
105
  return sms
105
106
 
106
107
 
107
- def print_sms_header(message, folders):
108
+ def print_sms_header(message, folders) -> None:
108
109
  print()
109
- print("{:<15}: {}".format("Number", message["Number"]))
110
- print("{:<15}: {}".format("Date", message["DateTime"]))
111
- print("{:<15}: {}".format("State", message["State"]))
110
+ print(f"{'Number':<15}: {message['Number']}")
111
+ print(f"{'Date':<15}: {message['DateTime']}")
112
+ print(f"{'State':<15}: {message['State']}")
112
113
  print(
113
- "{:<15}: {} {} ({:d})".format(
114
- "Folder",
115
- folders[message["Folder"]]["Name"],
116
- folders[message["Folder"]]["Memory"],
117
- message["Folder"],
118
- )
114
+ f"{'Folder':<15}: {folders[message['Folder']]['Name']} {folders[message['Folder']]['Memory']} ({message['Folder']:d})"
119
115
  )
120
- print("{:<15}: {}".format("Validity", message["SMSC"]["Validity"]))
116
+ print(f"{'Validity':<15}: {message['SMSC']['Validity']}")
121
117
 
122
118
 
123
- def print_all_sms(sms, folders):
119
+ def print_all_sms(sms, folders) -> None:
124
120
  for m in sms:
125
121
  print_sms_header(m, folders)
126
- print("\n{}".format(m["Text"]))
122
+ print(f"\n{m['Text']}")
127
123
 
128
124
 
129
- def link_all_sms(sms, folders):
125
+ def link_all_sms(sms, folders) -> None:
130
126
  data = gammu.LinkSMS([[msg] for msg in sms])
131
127
 
132
- for x in data:
128
+ for x in data: # noqa: PLR1702
133
129
  v = gammu.DecodeSMS(x)
134
130
 
135
131
  m = x[0]
@@ -137,13 +133,13 @@ def link_all_sms(sms, folders):
137
133
  loc = []
138
134
  for m in x:
139
135
  loc.append(m["Location"])
140
- print("{:<15}: {}".format("Location(s)", ", ".join(loc)))
136
+ print(f"{'Location(s)':<15}: {', '.join(loc)}")
141
137
  if v is None:
142
- print("\n{}".format(m["Text"]))
138
+ print(f"\n{m['Text']}")
143
139
  else:
144
140
  for e in v["Entries"]:
145
141
  print()
146
- print("{:<15}: {}".format("Type", e["ID"]))
142
+ print(f"{'Type':<15}: {e['ID']}")
147
143
  if e["Bitmap"] is not None:
148
144
  for bmp in e["Bitmap"]:
149
145
  print("Bitmap:")
@@ -156,7 +152,7 @@ def link_all_sms(sms, folders):
156
152
  print()
157
153
 
158
154
 
159
- def get_all_todo(state_machine):
155
+ def get_all_todo(state_machine) -> None:
160
156
  status = state_machine.GetToDoStatus()
161
157
 
162
158
  remain = status["Used"]
@@ -169,19 +165,19 @@ def get_all_todo(state_machine):
169
165
  start = False
170
166
  else:
171
167
  entry = state_machine.GetNextToDo(Location=entry["Location"])
172
- remain = remain - 1
168
+ remain -= 1
173
169
 
174
170
  print()
175
- print("{:<15}: {:d}".format("Location", entry["Location"]))
176
- print("{:<15}: {}".format("Priority", entry["Priority"]))
171
+ print(f"{'Location':<15}: {entry['Location']:d}")
172
+ print(f"{'Priority':<15}: {entry['Priority']}")
177
173
  for v in entry["Entries"]:
178
- print("{:<15}: {}".format(v["Type"], v["Value"]))
174
+ print(f"{v['Type']:<15}: {v['Value']}")
179
175
 
180
176
 
181
177
  def get_sms_folders(state_machine):
182
178
  folders = state_machine.GetSMSFolders()
183
179
  for i, folder in enumerate(folders):
184
- print("Folder {:d}: {} ({})".format(i, folder["Name"], folder["Memory"]))
180
+ print(f"Folder {i:d}: {folder['Name']} ({folder['Memory']})")
185
181
  return folders
186
182
 
187
183
 
@@ -192,7 +188,7 @@ def get_set_date_time(state_machine):
192
188
  return dt
193
189
 
194
190
 
195
- def main():
191
+ def main() -> None:
196
192
  if len(sys.argv) != 2:
197
193
  print("This requires one parameter with location of config file!")
198
194
  sys.exit(1)