From 226e83eb8f0662f302c7f98c6b77bf88fae01997 Mon Sep 17 00:00:00 2001 From: Helmut Grohne Date: Tue, 11 Jun 2024 23:00:14 +0200 Subject: fix formatting and spelling errors No functional changes. --- linuxnamespaces/__init__.py | 26 +++++++++++++++----------- linuxnamespaces/filedescriptor.py | 2 +- 2 files changed, 16 insertions(+), 12 deletions(-) (limited to 'linuxnamespaces') diff --git a/linuxnamespaces/__init__.py b/linuxnamespaces/__init__.py index 5a9ef39..df40dea 100644 --- a/linuxnamespaces/__init__.py +++ b/linuxnamespaces/__init__.py @@ -142,7 +142,7 @@ class IDAllocation: raised. """ if count < 0: - raise ValueError("nagative count") + raise ValueError("negative count") index = bisect.bisect_right(self.ranges, (start, float("inf"))) - 1 if index < 0: raise ValueError("range to reserve not found") @@ -165,7 +165,7 @@ class IDAllocation: # Requested range punches a hole into a matched range self.ranges.insert( index + 1, - (start + count, cur_start + cur_count - (start + count)) + (start + count, cur_start + cur_count - (start + count)), ) # else: Requested range is a tail of a matched range else: @@ -238,6 +238,7 @@ def newidmaps( class run_in_fork: """Decorator for running the decorated function once in a separate process. """ + def __init__(self, function: typing.Callable[[], None]): """Fork a new process that will eventually run the given function and then exit. @@ -277,6 +278,7 @@ class async_run_in_fork: uses the running event loop. The decorated function instead must be synchronous and it must not access the event loop of the main process. """ + def __init__(self, function: typing.Callable[[], None]): """Fork a new process that will eventually run the given function and then exit. @@ -363,12 +365,13 @@ class _ExceptionExitCallback: """Helper class that invokes a callback when a context manager exists with a failure. """ + def __init__( - self, - callback: typing.Callable[_P, typing.Any], - *args: _P.args, - **kwargs: _P.kwargs, - ) -> None: + self, + callback: typing.Callable[_P, typing.Any], + *args: _P.args, + **kwargs: _P.kwargs, + ) -> None: self.callback = callback self.args = args self.kwargs = kwargs @@ -376,10 +379,11 @@ class _ExceptionExitCallback: def __enter__(self) -> None: pass - def __exit__(self, - exc_type: type[BaseException] | None, - exc_value: BaseException | None, - traceback: typing.Any, + def __exit__( + self, + exc_type: type[BaseException] | None, + exc_value: BaseException | None, + traceback: typing.Any, ) -> None: if exc_type is not None: self.callback(*self.args, **self.kwargs) diff --git a/linuxnamespaces/filedescriptor.py b/linuxnamespaces/filedescriptor.py index 4395a54..e4eff9b 100644 --- a/linuxnamespaces/filedescriptor.py +++ b/linuxnamespaces/filedescriptor.py @@ -27,7 +27,7 @@ class FileDescriptor(int): def close(self) -> None: """Close the file descriptor. Since int is immutable, the caller is - responsibe for not closing twice. + responsible for not closing twice. """ os.close(self) -- cgit v1.2.3