Skip to content

Commit 2d01d96

Browse files
committed
self._settings.getInt => self._settings.get_int
1 parent 40b72a2 commit 2d01d96

File tree

1 file changed

+27
-26
lines changed

1 file changed

+27
-26
lines changed

octoprint_netconnectd/__init__.py

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ def initialize(self):
2525

2626
@property
2727
def hostname(self):
28-
if self._settings.get(["hostname"]):
29-
return self._settings.get(["hostname"])
28+
hostname = self._settings.get(["hostname"])
29+
if hostname:
30+
return hostname
3031
else:
3132
import socket
3233
return socket.gethostname() + ".local"
@@ -38,11 +39,11 @@ def on_settings_save(self, data):
3839
self.address = self._settings.get(["socket"])
3940

4041
def get_settings_defaults(self):
41-
return {
42-
"socket": "/var/run/netconnectd.sock",
43-
"hostname": None,
44-
"timeout": 10,
45-
}
42+
return dict(
43+
socket="/var/run/netconnectd.sock",
44+
hostname=None,
45+
timeout=10
46+
)
4647

4748
##~~ TemplatePlugin API
4849

@@ -54,14 +55,14 @@ def get_template_configs(self):
5455
##~~ SimpleApiPlugin API
5556

5657
def get_api_commands(self):
57-
return {
58-
"start_ap": [],
59-
"stop_ap": [],
60-
"refresh_wifi": [],
61-
"configure_wifi": ["ssid", "psk"],
62-
"forget_wifi": [],
63-
"reset": []
64-
}
58+
return dict(
59+
start_ap=[],
60+
stop_ap=[],
61+
refresh_wifi=[],
62+
configure_wifi=[],
63+
forget_wifi=[],
64+
reset=[]
65+
)
6566

6667
def on_api_get(self, request):
6768
try:
@@ -70,11 +71,11 @@ def on_api_get(self, request):
7071
except Exception as e:
7172
return jsonify(dict(error=e.message))
7273

73-
return jsonify({
74-
"wifis": wifis,
75-
"status": status,
76-
"hostname": self.hostname
77-
})
74+
return jsonify(dict(
75+
wifis=wifis,
76+
status=status,
77+
hostname=self.hostname
78+
))
7879

7980
def on_api_command(self, command, data):
8081
if command == "refresh_wifi":
@@ -103,11 +104,11 @@ def on_api_command(self, command, data):
103104
##~~ AssetPlugin API
104105

105106
def get_assets(self):
106-
return {
107-
"js": ["js/netconnectd.js"],
108-
"css": ["css/netconnectd.css"],
109-
"less": ["less/netconnectd.less"]
110-
}
107+
return dict(
108+
js=["js/netconnectd.js"],
109+
css=["css/netconnectd.css"],
110+
less=["less/netconnectd.less"]
111+
)
111112

112113
##~~ Private helpers
113114

@@ -183,7 +184,7 @@ def _send_message(self, message, data):
183184

184185
import socket
185186
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
186-
sock.settimeout(self._settings.getInt(["timeout"]))
187+
sock.settimeout(self._settings.get_int(["timeout"]))
187188
try:
188189
sock.connect(self.address)
189190
sock.sendall(js + '\x00')

0 commit comments

Comments
 (0)