Skip to content

Commit 605964f

Browse files
committed
[FritzCall] Adjust to FW 8.20, pylint cleaniing
1 parent e894ae4 commit 605964f

File tree

6 files changed

+178
-126
lines changed

6 files changed

+178
-126
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
eclipse.preferences.version=1
22
encoding//src/FritzCallFBF.py=utf-8
33
encoding//src/FritzConnection.py=utf-8
4+
encoding//src/__init__.py=utf-8
45
encoding//src/plugin.py=utf-8
56
encoding/<project>=UTF-8

src/FritzCallFBF.py

Lines changed: 27 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,33 @@
1-
# -*- coding: utf-8 -*-
1+
# -*- coding: utf-8 -*- # pylint: disable=too-many-lines
22
'''
33
Created on 30.09.2012
44
$Author: michael $
5-
$Revision: 1647 $
6-
$Date: 2023-08-12 12:10:38 +0200 (Sa., 12 Aug. 2023) $
7-
$Id: FritzCallFBF.py 1652 2023-10-21 13:37:57Z michael $
5+
$Revision: 1657 $
6+
$Date: 2025-08-10 15:43:32 +0200 (So., 10 Aug. 2025) $
7+
$Id: FritzCallFBF.py 1657 2025-08-10 13:43:32Z michael $
88
'''
99

10-
# C0111 (Missing docstring)
11-
# C0103 (Invalid name)
12-
# C0301 (line too long)
13-
# W0603 (global statement)
14-
# W0141 (map, filter, etc.)
15-
# W0110 lambda with map,filter
16-
# W0403 Relative import
17-
# W1401 Anomalous backslash in string
18-
# W0110 deprecated-lambda
19-
# C0302 too-many-lines
20-
# C0410 multiple-imports
21-
# E0611 No name %r in module %r
22-
# W1201 logging-not-lazy
23-
# pylint: disable=C0111,C0103,C0301,W0603,C0302,W0611,F0401,E0611,W1201,syntax-error,no-name-in-module,ungrouped-imports,consider-using-f-string,unspecified-encoding,used-before-assignment
10+
# missing-docstring / C0111
11+
# invalid-name / C0103
12+
# consider-iterating-dictionary / C0201
13+
# consider-using-f-string / C0209
14+
# line-too-long / C0301
15+
# too-many-lines / C0302
16+
# multiple-imports / C0410
17+
# ungrouped-imports / C0412
18+
# bad-builtin / W0141
19+
# deprecated-lambda / W0110
20+
# abstract-method / W0223
21+
# Relative import / W0403
22+
# global-statement / W0603
23+
# unused-argument / W0613
24+
# logging-not-lazy / W1201
25+
# logging-format-interpolation / W1202
26+
# anomalous-backslash-in-string / W1401
27+
# unspecified-encoding / W1514
28+
# no-name-in-module / E0611
29+
# no-member / E1101
30+
# pylint: disable=c0103,c0111,c0201,c0209,C0301,c0412,w0613,w1201,w1514
2431

2532
from __future__ import absolute_import
2633
import re
@@ -97,7 +104,7 @@ def resolveNumber(number, default=None, phonebook=None, debug=logging.debug):
97104
if name:
98105
number = number + ' ' + name
99106
elif number == "":
100-
number = _("UNKNOWN")
107+
number = _("UNKNOWN") # pylint: disable=used-before-assignment
101108
# if len(number) > 20: number = number[:20]
102109
return number
103110

@@ -3638,17 +3645,7 @@ def _getInfo(self, result):
36383645
})
36393646
self.debug("url: " + url + "?" + parms)
36403647

3641-
headers = {
3642-
'Content-Type': "application/x-www-form-urlencoded",
3643-
'Content-Length': str(len(parms))}
3644-
newheaders = {}
3645-
for h in six.iterkeys(headers):
3646-
newheaders[six.ensure_binary(h)] = six.ensure_binary(headers[h])
3647-
getPage(six.ensure_binary(url),
3648-
method=six.ensure_binary("POST"),
3649-
# agent=six.ensure_binary(USERAGENT),
3650-
headers=newheaders,
3651-
postdata=six.ensure_binary(parms)).addBoth(self._okGetInfo)
3648+
getPage(six.ensure_binary(url + "?" + parms), method="GET").addBoth(self._okGetInfo)
36523649

36533650
def _okGetInfo(self, result):
36543651
self.debug("")

src/FritzConnection.py

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,41 @@
2828
License: MIT https://opensource.org/licenses/MIT
2929
Source: https://bitbucket.org/kbr/fritzconnection
3030
Author: Klaus Bremer
31-
Modified to use async communication, content level authentication and plain xml.etree.ElementTree: DrMichael
31+
Modified to use async communication, content level authentication
32+
and plain xml.etree.ElementTree: DrMichael
3233
"""
33-
# pylint: disable=C0111,C0103,C0301,W0603,C0302
34+
35+
# missing-docstring / C0111
36+
# invalid-name / C0103
37+
# consider-iterating-dictionary / C0201
38+
# consider-using-f-string / C0209
39+
# line-too-long / C0301
40+
# too-many-lines / C0302
41+
# multiple-imports / C0410
42+
# ungrouped-imports / C0412
43+
# bad-builtin / W0141
44+
# deprecated-lambda / W0110
45+
# Relative import / W0403
46+
# anomalous-backslash-in-string / W1401
47+
# global-statement / W0603
48+
# unused-argument / W0613
49+
# logging-not-lazy / W1201
50+
# logging-format-interpolation / W1202
51+
# unspecified-encoding / W1514
52+
# no-name-in-module / E0611
53+
# pylint: disable=C0103,C0111,C0209,C0301,C0302,W0603,W1514
3454

3555
__version__ = '0.6'
3656

3757
import logging
3858
import re
39-
import six
4059
from hashlib import md5
41-
from . import getPage
4260
import xml.etree.ElementTree as ET
43-
4461
from Components.config import config
4562

63+
import six
64+
from . import getPage # @UnresolvedImport
65+
4666
USERAGENT = "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36"
4767

4868
# FritzConnection defaults:

src/__init__.py

Lines changed: 38 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,41 +2,64 @@
22
'''
33
general functions for FritzCall plugin
44
5-
$Id: __init__.py 1640 2023-01-13 15:56:29Z michael $
5+
$Id: __init__.py 1656 2025-08-10 13:02:41Z michael $
66
$Author: michael $
7-
$Revision: 1640 $
8-
$Date: 2023-01-13 16:56:29 +0100 (Fri, 13 Jan 2023) $
7+
$Revision: 1656 $
8+
$Date: 2025-08-10 15:02:41 +0200 (So., 10 Aug. 2025) $
99
'''
1010

11+
# missing-docstring / C0111
12+
# invalid-name / C0103
13+
# consider-iterating-dictionary / C0201
14+
# consider-using-f-string / C0209
15+
# line-too-long / C0301
16+
# too-many-lines / C0302
17+
# multiple-imports / C0410
18+
# ungrouped-imports / C0412
19+
# bad-builtin / W0141
20+
# deprecated-lambda / W0110
21+
# Relative import / W0403
22+
# anomalous-backslash-in-string / W1401
23+
# global-statement / W0603
24+
# unused-argument / W0613
25+
# logging-not-lazy / W1201
26+
# logging-format-interpolation / W1202
27+
# unspecified-encoding / W1514
28+
# no-name-in-module / E0611
29+
# pylint: disable=C0111,c0209,C0301
30+
1131
from __future__ import division
1232
import gettext
1333
import os
34+
import re
35+
import logging
1436
from logging import NOTSET
15-
from six.moves import range
37+
import requests # @UnresolvedImport # pylint: disable=unused-import,import-error
1638

1739
from Components.config import config # @UnresolvedImport
1840
from Components.Language import language
1941
from Tools.Directories import resolveFilename, SCOPE_LANGUAGE, SCOPE_PLUGINS, SCOPE_SKIN_IMAGE # @UnresolvedImport
2042
from enigma import eBackgroundFileEraser
2143

44+
from twisted.internet.threads import deferToThread
45+
46+
from six.moves import range
47+
2248
lang = language.getLanguage()
2349
os.environ["LANGUAGE"] = lang[:2]
2450
gettext.bindtextdomain("enigma2", resolveFilename(SCOPE_LANGUAGE))
2551
gettext.textdomain("enigma2")
2652
gettext.bindtextdomain("FritzCall", "%s%s" % (resolveFilename(SCOPE_PLUGINS), "Extensions/FritzCall/locale/"))
2753

28-
import logging
2954
logger = logging.getLogger("FritzCall.__init__")
3055
debug = logger.debug
3156
info = logger.info
3257
warning = logger.warning
3358
error = logger.error
3459
exception = logger.exception
3560

36-
from twisted.internet.threads import deferToThread
37-
import requests
3861
USERAGENT = "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36"
39-
def getPage(url, agent=USERAGENT, method="GET", postdata=None, headers={}):
62+
def getPage(url, agent=USERAGENT, method="GET", postdata=None, headers={}): # pylint disable=invalid-name,dangerous-default-value
4063
# debug(repr(method))
4164
headers["user-agent"] = agent
4265
# debug("params: " + repr(postdata))
@@ -46,16 +69,16 @@ def getPage(url, agent=USERAGENT, method="GET", postdata=None, headers={}):
4669
return deferToThread(requests.get, url, data=postdata, headers=headers, timeout=30.05, verify=False)
4770

4871

49-
def _(txt): # pylint: disable=C0103
50-
td = gettext.dgettext("FritzCall", txt)
51-
if td == txt:
52-
td = gettext.gettext(txt)
53-
return td
72+
def _(txt):
73+
translated = gettext.dgettext("FritzCall", txt)
74+
if translated == txt:
75+
translated = gettext.gettext(txt)
76+
return translated
5477

5578
# scramble text
5679

5780

58-
def __(text, front=True): #pylint: disable=unused-argument
81+
def __(text, front=True): # pylint disable=unused-argument
5982
#===========================================================================
6083
# if len(text) > 5:
6184
# if front:
@@ -76,10 +99,7 @@ def __(text, front=True): #pylint: disable=unused-argument
7699
return out
77100

78101

79-
import re
80-
81-
82-
def normalizePhoneNumber(intNo):
102+
def normalizePhoneNumber(intNo): # pylint disable=invalid-name
83103

84104
found = re.match(r'^\+' + config.plugins.FritzCall.country.value.replace('00', '') + '(.*)', intNo)
85105
if found:

src/nrzuname.py

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,41 @@
11
#!/usr/bin/python
22
# -*- coding: UTF-8 -*-
33
'''
4-
$Id: nrzuname.py 1633 2023-01-07 14:58:24Z michael $
4+
$Id: nrzuname.py 1656 2025-08-10 13:02:41Z michael $
55
$Author: michael $
6-
$Revision: 1633 $
7-
$Date: 2023-01-07 15:58:24 +0100 (Sat, 07 Jan 2023) $
6+
$Revision: 1656 $
7+
$Date: 2025-08-10 15:02:41 +0200 (So., 10 Aug. 2025) $
88
'''
99

10-
# C0111 (Missing docstring)
11-
# C0103 (Invalid name)
12-
# C0301 (line too long)
13-
# W0603 (global statement)
14-
# W0141 (map, filter, etc.)
15-
# W0110 lambda with map,filter
16-
# W0403 Relative import
17-
# W1401 Anomalous backslash in string
18-
# W0110 deprecated-lambda
19-
# C0302 too-many-lines
20-
# C0410 multiple-imports
21-
# pylint: disable=C0111,C0103,C0301,W0603,C0302
10+
# missing-docstring / C0111
11+
# invalid-name / C0103
12+
# consider-iterating-dictionary / C0201
13+
# consider-using-f-string / C0209
14+
# line-too-long / C0301
15+
# too-many-lines / C0302
16+
# multiple-imports / C0410
17+
# ungrouped-imports / C0412
18+
# bad-builtin / W0141
19+
# deprecated-lambda / W0110
20+
# Relative import / W0403
21+
# anomalous-backslash-in-string / W1401
22+
# global-statement / W0603
23+
# unused-argument / W0613
24+
# logging-not-lazy / W1201
25+
# logging-format-interpolation / W1202
26+
# unspecified-encoding / W1514
27+
# no-name-in-module / E0611
28+
# pylint: disable=C0111,C0103,C0209,C0301,W0603,C0302
2229

2330
from __future__ import print_function
2431
import re
2532
import sys
2633
import os
27-
import six
2834
from xml.dom.minidom import parse
35+
from twisted.internet import reactor # @UnresolvedImport
36+
from Tools.Directories import resolveFilename, SCOPE_PLUGINS
37+
38+
import six
2939
from six import unichr
3040
from six.moves import html_entities
3141

@@ -52,8 +62,6 @@ def debug(message):
5262
print(message)
5363

5464
from . import getPage # @UnresolvedImport
55-
from twisted.internet import reactor # @UnresolvedImport
56-
from Tools.Directories import resolveFilename, SCOPE_PLUGINS
5765

5866

5967
def html2unicode(in_html):

0 commit comments

Comments
 (0)