Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nemu3
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
nemu3
Commits
675a3819
Commit
675a3819
authored
Apr 02, 2012
by
Martín Ferrari
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pylinting __init__.
parent
cdeed82e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
7 deletions
+19
-7
src/nemu/__init__.py
src/nemu/__init__.py
+19
-7
No files found.
src/nemu/__init__.py
View file @
675a3819
...
...
@@ -17,20 +17,30 @@
# You should have received a copy of the GNU General Public License along with
# Nemu. If not, see <http://www.gnu.org/licenses/>.
"""Nemu package.
Nemu (Netwok EMUlator) is a small Python library to create emulated networks
and run and test programs in them.
"""
# pylint: disable=W0401,R0903
import
os
,
pwd
from
nemu.node
import
*
from
nemu.interface
import
*
class
__Config
(
object
):
class
_Config
(
object
):
"""Global configuration singleton for Nemu."""
def
__init__
(
self
):
self
.
_run_as
=
65534
try
:
pwd
.
getpwnam
(
'nobody'
)
self
.
_run_as
=
'nobody'
except
:
pass
except
KeyError
:
pass
# User not found.
def
_set_run_as
(
self
,
user
):
"""Setter for `run_as'."""
if
str
(
user
).
isdigit
():
uid
=
int
(
user
)
try
:
...
...
@@ -48,18 +58,20 @@ class __Config(object):
raise
AttributeError
(
"Cannot run as root by default"
)
self
.
_run_as
=
run_as
return
run_as
def
_get_run_as
(
self
):
"""Setter for `run_as'."""
return
self
.
_run_as
run_as
=
property
(
_get_run_as
,
_set_run_as
,
None
,
"Default user to run applications as"
)
config
=
_
_Config
()
config
=
_
Config
()
# pylint: disable=C0103
# FIXME: set atfork hooks
# http://code.google.com/p/python-atfork/source/browse/atfork/__init__.py
def
set_cleanup_hooks
(
on_exit
=
False
,
on_signals
=
[]):
pass
#def set_cleanup_hooks(on_exit = False, on_signals = []):
# pass
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment