mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-12-06 07:33:26 +00:00
mark non-returning functions with typing.NoReturn
To help pylint, mark non-returning functions with `typing.NoReturn`.
This commit is contained in:
parent
2e041ac1ff
commit
45d317cc87
@ -25,6 +25,7 @@ import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
from typing import Any, NoReturn
|
||||
from urllib.parse import quote
|
||||
|
||||
try:
|
||||
@ -50,7 +51,7 @@ from ubuntutools.question import YesNoQuestion
|
||||
Logger = getLogger()
|
||||
|
||||
|
||||
def error(msg, *args):
|
||||
def error(msg: str, *args: Any) -> NoReturn:
|
||||
Logger.error(msg, *args)
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
@ -23,6 +23,7 @@
|
||||
|
||||
import argparse
|
||||
import sys
|
||||
from typing import Any, NoReturn
|
||||
|
||||
from launchpadlib.errors import HTTPError
|
||||
from launchpadlib.launchpad import Launchpad
|
||||
@ -33,7 +34,7 @@ from ubuntutools.config import UDTConfig
|
||||
Logger = getLogger()
|
||||
|
||||
|
||||
def error_out(msg, *args):
|
||||
def error_out(msg: str, *args: Any) -> NoReturn:
|
||||
Logger.error(msg, *args)
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
@ -22,6 +22,7 @@
|
||||
# pylint: enable=invalid-name
|
||||
|
||||
import sys
|
||||
from typing import NoReturn
|
||||
|
||||
from debian.changelog import Changelog
|
||||
|
||||
@ -30,7 +31,7 @@ from ubuntutools import getLogger
|
||||
Logger = getLogger()
|
||||
|
||||
|
||||
def usage(exit_code=1):
|
||||
def usage(exit_code: int = 1) -> NoReturn:
|
||||
Logger.info(
|
||||
"""Usage: merge-changelog <left changelog> <right changelog>
|
||||
|
||||
|
||||
@ -38,6 +38,7 @@ import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
from contextlib import suppress
|
||||
from typing import NoReturn
|
||||
|
||||
import debian.deb822
|
||||
from distro_info import DebianDistroInfo, DistroDataOutdated, UbuntuDistroInfo
|
||||
@ -411,7 +412,7 @@ class PbuilderDist:
|
||||
] + arguments
|
||||
|
||||
|
||||
def show_help(exit_code=0):
|
||||
def show_help(exit_code: int = 0) -> NoReturn:
|
||||
"""help() -> None
|
||||
|
||||
Print a help message for pbuilder-dist, and exit with the given code.
|
||||
|
||||
@ -16,6 +16,7 @@
|
||||
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
import sys
|
||||
from typing import NoReturn
|
||||
|
||||
from ubuntutools.question import Question, YesNoQuestion
|
||||
|
||||
@ -42,7 +43,7 @@ def ask_for_manual_fixing():
|
||||
user_abort()
|
||||
|
||||
|
||||
def user_abort():
|
||||
def user_abort() -> NoReturn:
|
||||
"""Print abort and quit the program."""
|
||||
|
||||
print("User abort.")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user