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
081efcce
Commit
081efcce
authored
5 years ago
by
Piotr Maślanka
Browse files
Options
Downloads
Patches
Plain Diff
fix tests
parent
776796f5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
satella/coding/sequences/iterators.py
+12
-9
12 additions, 9 deletions
satella/coding/sequences/iterators.py
tests/test_instrumentation/test_metrics/test_metrics.py
+0
-1
0 additions, 1 deletion
tests/test_instrumentation/test_metrics/test_metrics.py
with
12 additions
and
10 deletions
satella/coding/sequences/iterators.py
+
12
−
9
View file @
081efcce
...
...
@@ -12,29 +12,32 @@ IteratorOrIterable = tp.Union[tp.Iterator[T], tp.Iterable[T]]
@for_argument
(
iter
)
@silence_excs
(
StopIteration
)
def
even
(
sq
:
IteratorOrIterable
)
->
tp
.
Iterator
[
T
]:
"""
Return only elements with even indices in this iterable (first element will be returned,
as indices are counted from 0)
"""
while
True
:
yield
next
(
sq
)
next
(
sq
)
try
:
while
True
:
yield
next
(
sq
)
next
(
sq
)
except
StopIteration
:
return
@for_argument
(
iter
)
@silence_excs
(
StopIteration
)
def
odd
(
sq
:
IteratorOrIterable
)
->
tp
.
Iterator
[
T
]:
"""
Return only elements with odd indices in this iterable.
"""
while
True
:
next
(
sq
)
yield
next
(
sq
)
try
:
while
True
:
next
(
sq
)
yield
next
(
sq
)
except
StopIteration
:
return
@silence_excs
(
StopIteration
)
def
count
(
sq
:
IteratorOrIterable
,
start
:
tp
.
Optional
[
int
]
=
None
,
step
:
int
=
1
)
->
tp
.
Iterator
[
int
]:
"""
Return a sequence of integers, for each entry in the sequence with provided step.
...
...
This diff is collapsed.
Click to expand it.
tests/test_instrumentation/test_metrics/test_metrics.py
+
0
−
1
View file @
081efcce
...
...
@@ -138,7 +138,6 @@ class TestMetric(unittest.TestCase):
self
.
assertTrue
(
inspect
.
isgeneratorfunction
(
generator
))
self
.
assertGreaterEqual
(
next
(
iter
(
my_metric
.
to_metric_data
().
values
)).
value
,
1
)
def
test_quantile_context_manager
(
self
):
metric
=
getMetric
(
'
test_metric
'
,
'
summary
'
,
quantiles
=
[
0.5
])
with
metric
.
measure
():
...
...
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