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
50d31873
Commit
50d31873
authored
4 years ago
by
Piotr Maślanka
Browse files
Options
Downloads
Patches
Plain Diff
fixed typing issue in `choose` and `choose_one`
parent
a5a0df2b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CHANGELOG.md
+2
-0
2 additions, 0 deletions
CHANGELOG.md
satella/__init__.py
+1
-1
1 addition, 1 deletion
satella/__init__.py
satella/coding/sequences/choose.py
+7
-6
7 additions, 6 deletions
satella/coding/sequences/choose.py
with
10 additions
and
7 deletions
CHANGELOG.md
+
2
−
0
View file @
50d31873
# v2.11.10
*
added
`make_list`
*
fixed typing issue in
`choose`
and
`choose_one`
This diff is collapsed.
Click to expand it.
satella/__init__.py
+
1
−
1
View file @
50d31873
__version__
=
'
2.11.10_a
2
'
__version__
=
'
2.11.10_a
3
'
This diff is collapsed.
Click to expand it.
satella/coding/sequences/choose.py
+
7
−
6
View file @
50d31873
import
typing
as
tp
T
=
tp
.
TypeVar
(
'
T
'
)
IteratorOrIterable
=
tp
.
Union
[
tp
.
Iterator
[
T
],
tp
.
Iterable
[
T
]]
IteratorOrIterable
=
tp
.
Union
[
tp
.
Iterator
,
tp
.
Iterable
]
def
choose_one
(
filter_fun
:
tp
.
Callable
[[
T
],
bool
],
iterable
:
IteratorOrIterable
)
->
T
:
def
choose_one
(
filter_fun
:
tp
.
Callable
[[
tp
.
Any
],
bool
],
iterable
:
IteratorOrIterable
)
->
tp
.
Any
:
"""
Syntactic sugar for
>>>
choose
(
filter_fun
,
iterable
,
True
)
>>>
choose
(
filter_fun
,
iterable
,
check_multiple
=
True
)
This exhausts the iterable.
:param filter_fun: function that returns bool on the single value
:param iterable: iterable to examine
...
...
@@ -18,8 +19,8 @@ def choose_one(filter_fun: tp.Callable[[T], bool], iterable: IteratorOrIterable)
return
choose
(
filter_fun
,
iterable
,
True
)
def
choose
(
filter_fun
:
tp
.
Callable
[[
T
],
bool
],
iterable
:
IteratorOrIterable
,
check_multiple
:
bool
=
False
)
->
T
:
def
choose
(
filter_fun
:
tp
.
Callable
[[
tp
.
Any
],
bool
],
iterable
:
IteratorOrIterable
,
check_multiple
:
bool
=
False
)
->
tp
.
Any
:
"""
Return a single value that exists in given iterable.
...
...
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