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