Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 5b645ae

Browse files
authored
Refactor entry points so that they all have a main function. (#13052)
1 parent c99b511 commit 5b645ae

File tree

11 files changed

+61
-10
lines changed

11 files changed

+61
-10
lines changed

changelog.d/13052.misc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Refactor entry points so that they all have a `main` function.

synapse/app/appservice.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@
1717
from synapse.app.generic_worker import start
1818
from synapse.util.logcontext import LoggingContext
1919

20-
if __name__ == "__main__":
20+
21+
def main() -> None:
2122
with LoggingContext("main"):
2223
start(sys.argv[1:])
24+
25+
26+
if __name__ == "__main__":
27+
main()

synapse/app/client_reader.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@
1717
from synapse.app.generic_worker import start
1818
from synapse.util.logcontext import LoggingContext
1919

20-
if __name__ == "__main__":
20+
21+
def main() -> None:
2122
with LoggingContext("main"):
2223
start(sys.argv[1:])
24+
25+
26+
if __name__ == "__main__":
27+
main()

synapse/app/event_creator.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@
1717
from synapse.app.generic_worker import start
1818
from synapse.util.logcontext import LoggingContext
1919

20-
if __name__ == "__main__":
20+
21+
def main() -> None:
2122
with LoggingContext("main"):
2223
start(sys.argv[1:])
24+
25+
26+
if __name__ == "__main__":
27+
main()

synapse/app/federation_reader.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@
1717
from synapse.app.generic_worker import start
1818
from synapse.util.logcontext import LoggingContext
1919

20-
if __name__ == "__main__":
20+
21+
def main() -> None:
2122
with LoggingContext("main"):
2223
start(sys.argv[1:])
24+
25+
26+
if __name__ == "__main__":
27+
main()

synapse/app/federation_sender.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@
1717
from synapse.app.generic_worker import start
1818
from synapse.util.logcontext import LoggingContext
1919

20-
if __name__ == "__main__":
20+
21+
def main() -> None:
2122
with LoggingContext("main"):
2223
start(sys.argv[1:])
24+
25+
26+
if __name__ == "__main__":
27+
main()

synapse/app/frontend_proxy.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@
1717
from synapse.app.generic_worker import start
1818
from synapse.util.logcontext import LoggingContext
1919

20-
if __name__ == "__main__":
20+
21+
def main() -> None:
2122
with LoggingContext("main"):
2223
start(sys.argv[1:])
24+
25+
26+
if __name__ == "__main__":
27+
main()

synapse/app/media_repository.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@
1717
from synapse.app.generic_worker import start
1818
from synapse.util.logcontext import LoggingContext
1919

20-
if __name__ == "__main__":
20+
21+
def main() -> None:
2122
with LoggingContext("main"):
2223
start(sys.argv[1:])
24+
25+
26+
if __name__ == "__main__":
27+
main()

synapse/app/pusher.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@
1717
from synapse.app.generic_worker import start
1818
from synapse.util.logcontext import LoggingContext
1919

20-
if __name__ == "__main__":
20+
21+
def main() -> None:
2122
with LoggingContext("main"):
2223
start(sys.argv[1:])
24+
25+
26+
if __name__ == "__main__":
27+
main()

synapse/app/synchrotron.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@
1717
from synapse.app.generic_worker import start
1818
from synapse.util.logcontext import LoggingContext
1919

20-
if __name__ == "__main__":
20+
21+
def main() -> None:
2122
with LoggingContext("main"):
2223
start(sys.argv[1:])
24+
25+
26+
if __name__ == "__main__":
27+
main()

0 commit comments

Comments
 (0)