Skip to content
This repository was archived by the owner on Dec 5, 2022. It is now read-only.

Commit 0e83c55

Browse files
committed
respect flake8 rules
1 parent fe5246f commit 0e83c55

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

nsenter/__init__.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#!/usr/bin/env python3
22

3-
'''
3+
"""
44
nsenter - run program with namespaces of other processes
5-
'''
5+
"""
66

77
import argparse
88
import ctypes
@@ -17,7 +17,8 @@
1717

1818
libc = ctypes.CDLL('libc.so.6')
1919

20-
def nsfd(process:str, ns_type:str) -> Path:
20+
21+
def nsfd(process: str, ns_type: str) -> Path:
2122
"""
2223
Returns the namespace file descriptor for process (self or PID) and namespace type
2324
"""
@@ -29,9 +30,9 @@ def __init__(self, pid: str, ns_type: str):
2930
self.pid = pid
3031
self.ns_type = ns_type
3132
self.parent_fd = nsfd('self', ns_type).open()
32-
self.parent_fileno =self.parent_fd.fileno()
33+
self.parent_fileno = self.parent_fd.fileno()
3334
self.target_fd = nsfd(pid, ns_type).open()
34-
self.target_fileno =self.target_fd.fileno()
35+
self.target_fileno = self.target_fd.fileno()
3536

3637
def __enter__(self):
3738
log.debug('Entering %s namespace %s', self.ns_type, self.pid)
@@ -46,9 +47,11 @@ def __exit__(self, type, value, tb):
4647
pass
4748
self.parent_fd.close()
4849

50+
4951
def main():
5052
parser = argparse.ArgumentParser(description=__doc__)
51-
parser.add_argument('--target', '-t', required=True, metavar='PID', help='Specify a target process to get contexts from.')
53+
parser.add_argument('--target', '-t', required=True, metavar='PID',
54+
help='Specify a target process to get contexts from.')
5255
for ns in NAMESPACE_NAMES:
5356
parser.add_argument('--{}'.format(ns), action='store_true', help='Enter the {} namespace'.format(ns))
5457
parser.add_argument('--all', action='store_true', help='Enter all namespaces')

setup.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@
66

77
__location__ = os.path.join(os.getcwd(), os.path.dirname(inspect.getfile(inspect.currentframe())))
88

9+
910
def read(fname):
1011
return open(os.path.join(__location__, fname)).read()
1112

13+
1214
def setup_package():
1315
setuptools.setup(
1416
name='nsenter',
15-
version='0.1.4-1',
17+
version='0.1.4-2',
1618
url='https://github.com/zalando/python-nsenter',
1719
description='Enter kernel namespaces from Python',
1820
author='Henning Jacobs',
@@ -28,6 +30,7 @@ def setup_package():
2830
'Operating System :: POSIX :: Linux',
2931
'License :: OSI Approved :: Apache Software License'],
3032
test_suite='tests',
33+
setup_requires=['flake8'],
3134
packages=setuptools.find_packages(exclude=['tests', 'tests.*']),
3235
entry_points={'console_scripts': ['nsenter = nsenter:main']}
3336
)

tox.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[flake8]
2+
max-line-length=120

0 commit comments

Comments
 (0)