mirror of
https://github.com/sshuttle/sshuttle.git
synced 2025-05-07 17:44:24 +02:00
PEP-8 compliance
This commit is contained in:
parent
8c96d7a5f5
commit
5c6ec7ff86
@ -14,13 +14,13 @@ def enter_namespace(namespace, namespace_pid):
|
||||
namespace_dir = f'{NETNS_RUN_DIR}/{namespace}'
|
||||
else:
|
||||
namespace_dir = f'/proc/{namespace_pid}/ns/net'
|
||||
|
||||
|
||||
if not os.path.exists(namespace_dir):
|
||||
raise Fatal('The namespace %r does not exists.' % namespace_dir)
|
||||
|
||||
debug2('loading libc')
|
||||
libc = ctypes.CDLL(ctypes.util.find_library("c"), use_errno=True)
|
||||
|
||||
|
||||
default_errcheck = libc.setns.errcheck
|
||||
|
||||
def errcheck(ret, *args):
|
||||
@ -29,8 +29,8 @@ def enter_namespace(namespace, namespace_pid):
|
||||
raise Fatal(e, os.strerror(e))
|
||||
if default_errcheck:
|
||||
return default_errcheck(ret, *args)
|
||||
|
||||
libc.setns.errcheck = errcheck # type: ignore
|
||||
|
||||
libc.setns.errcheck = errcheck # type: ignore
|
||||
|
||||
debug1('Entering namespace %r' % namespace_dir)
|
||||
|
||||
|
@ -189,7 +189,7 @@ def test_parse_namespace():
|
||||
'@my.long_namespace.with.multiple.dots',
|
||||
'my.Namespace.With.Mixed.Case',
|
||||
]
|
||||
|
||||
|
||||
for namespace in valid_namespaces:
|
||||
assert sshuttle.options.parse_namespace(namespace) == namespace
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user