Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Open sidebar
team-simpy
simpy
Commits
28dfb0a3
Commit
28dfb0a3
authored
Sep 04, 2013
by
Stefan Scherfke
Browse files
Added some comments to help navigating within core.py. It’s just gotten too long. :)
parent
7ba67230
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
4 deletions
+36
-4
simpy/core.py
simpy/core.py
+36
-4
No files found.
simpy/core.py
View file @
28dfb0a3
...
...
@@ -14,6 +14,18 @@ if PY2:
import
sys
# Contents:
#
# - Constants
# - Helpers and exceptions
# - Event types
# - Environments
# - Internal helpers
###############################################################################
# Constants
#
Infinity
=
float
(
'inf'
)
#: Convenience alias for infinity
PENDING
=
object
()
#: Unique object to identify pending values of events
...
...
@@ -23,6 +35,11 @@ DEFAULT_PRIORITY = 1 #: Default priority used by events
LOW_PRIORITY
=
2
#: Priority of timeouts
###############################################################################
# Helpers and exceptions
#
class
BoundClass
(
object
):
"""Allows classes to behave like methods.
...
...
@@ -80,6 +97,17 @@ class Interrupt(Exception):
return
self
.
args
[
0
]
class
EmptySchedule
(
Exception
):
"""Thrown by the :class:`Environment` if there are no further events to be
processed."""
pass
###############################################################################
# Event types
#
class
Event
(
object
):
"""Base class for all events.
...
...
@@ -527,10 +555,9 @@ class Process(Event):
self
.
env
.
_active_proc
=
None
class
EmptySchedule
(
Exception
):
"""Thrown by the :class:`Environment` if there are no further events to be
processed."""
pass
###############################################################################
# Environments
#
class
BaseEnvironment
(
object
):
...
...
@@ -691,6 +718,11 @@ class Environment(BaseEnvironment):
raise
event
.
_value
###############################################################################
# Internal helpers
#
def
_describe_frame
(
frame
):
"""Print filename, line number and function name of a stack frame."""
filename
,
name
=
frame
.
f_code
.
co_filename
,
frame
.
f_code
.
co_name
...
...
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