Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
satella
Manage
Activity
Members
Labels
Plan
Issues
1
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
public
satella
Commits
d0fee05f
Commit
d0fee05f
authored
5 years ago
by
Piotr Maślanka
Browse files
Options
Downloads
Patches
Plain Diff
clean up structures
parent
43777567
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
satella/coding/structures/structures.py
+5
-6
5 additions, 6 deletions
satella/coding/structures/structures.py
with
5 additions
and
6 deletions
satella/coding/structures/structures.py
+
5
−
6
View file @
d0fee05f
...
...
@@ -208,18 +208,17 @@ class TimeBasedHeap(Heap):
self
.
default_clock_source
=
default_clock_source
or
time
.
monotonic
super
(
TimeBasedHeap
,
self
).
__init__
(
from_list
=
())
def
put
(
self
,
*
args
):
def
put
(
self
,
timestamp_or_value
:
tp
.
Union
[
tp
.
Tuple
[
tp
.
Union
[
float
,
int
],
HeapVar
]],
value
:
tp
.
Optional
[
HeapVar
]
=
None
)
->
None
:
"""
Put an item on heap.
Pass timestamp, item or just an item for default time
"""
assert
len
(
args
)
in
(
1
,
2
)
if
len
(
args
)
==
1
:
timestamp
,
item
=
self
.
default_clock_source
(),
args
[
0
]
if
value
is
None
:
timestamp
,
item
=
self
.
default_clock_source
(),
timestamp_or_value
else
:
timestamp
,
item
=
args
timestamp
,
item
=
timestamp_or_value
,
value
assert
timestamp
is
not
None
self
.
push
((
timestamp
,
item
))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment