summaryrefslogtreecommitdiff
path: root/linuxnamespaces/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'linuxnamespaces/__init__.py')
-rw-r--r--linuxnamespaces/__init__.py26
1 files changed, 15 insertions, 11 deletions
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)