Selaa lähdekoodia

Tidy up and format main.py a little

master
Chris Smith 5 vuotta sitten
vanhempi
commit
cd5b366256
1 muutettua tiedostoa jossa 8 lisäystä ja 8 poistoa
  1. 8
    8
      main.py

+ 8
- 8
main.py Näytä tiedosto

3
 from lineandsinker.common import get_hook_key
3
 from lineandsinker.common import get_hook_key
4
 from lineandsinker.services import services
4
 from lineandsinker.services import services
5
 
5
 
6
-for service in services.values():
7
-    service.refresh()
8
 
6
 
7
+def refresh_services():
8
+    for service in services.values():
9
+        service.refresh()
10
+
11
+
12
+refresh_services()
9
 app = Flask(__name__)
13
 app = Flask(__name__)
10
 
14
 
11
 
15
 
20
 
24
 
21
                 for commit in event["commits"][::-1][:3]:
25
                 for commit in event["commits"][::-1][:3]:
22
                     line = commit["message"].split("\n")[0][:100]
26
                     line = commit["message"].split("\n")[0][:100]
23
-                    services["irccat"].announce(
24
-                        f"\002[git]\002 {commit['id']}: {line}"
25
-                    )
27
+                    services["irccat"].announce(f"\002[git]\002 {commit['id']}: {line}")
26
         elif event["type"] == "docker.push":
28
         elif event["type"] == "docker.push":
27
             services["irccat"].announce(
29
             services["irccat"].announce(
28
                 f"\002[registry]\002 New manifest pushed to {event['host']}/{event['repo']}:{event['tag']} by {event['user']}"
30
                 f"\002[registry]\002 New manifest pushed to {event['host']}/{event['repo']}:{event['tag']} by {event['user']}"
29
             )
31
             )
30
         elif event["type"] == "slack":
32
         elif event["type"] == "slack":
31
-            services["irccat"].announce(
32
-                f"\002[{event['source']}]\002 {event['text']}"
33
-            )
33
+            services["irccat"].announce(f"\002[{event['source']}]\002 {event['text']}")
34
 
34
 
35
 
35
 
36
 @app.route("/")
36
 @app.route("/")

Loading…
Peruuta
Tallenna