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
ded47eec
Commit
ded47eec
authored
4 years ago
by
Piotr Maślanka
Browse files
Options
Downloads
Patches
Plain Diff
added ExceptionList
parent
9eee29c9
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CHANGELOG.md
+3
-0
3 additions, 0 deletions
CHANGELOG.md
docs/coding/typing.rst
+2
-0
2 additions, 0 deletions
docs/coding/typing.rst
satella/coding/typing.py
+6
-3
6 additions, 3 deletions
satella/coding/typing.py
with
11 additions
and
3 deletions
CHANGELOG.md
+
3
−
0
View file @
ded47eec
# v2.14.41
*
added
`ExceptionList`
*
added
`terminate_on`
for
`TerminableThread`
This diff is collapsed.
Click to expand it.
docs/coding/typing.rst
+
2
−
0
View file @
ded47eec
...
...
@@ -16,6 +16,8 @@ They are as follows:
* `Predicate` - a callable that accepts a `T` and returns a bool
* `KVTuple` - a tuple of (K, V)
* `Comparable` - a class that allows comparison between it's instances
* `ExceptionList` - either a single exception type or a tuple of exception types.
As used by `except` statement and some satella functions.
You may use these generics in your classes, eg.
...
...
This diff is collapsed.
Click to expand it.
satella/coding/typing.py
+
6
−
3
View file @
ded47eec
import
typing
as
tp
from
abc
import
ABCMeta
,
abstractmethod
__all__
=
[
'
Iteratable
'
,
'
T
'
,
'
U
'
,
'
V
'
,
'
K
'
,
'
Number
'
,
'
ExceptionClassType
'
,
'
NoArgCallable
'
,
'
Appendable
'
,
'
Predicate
'
,
'
KVTuple
'
,
'
Comparable
'
,
'
ExceptionList
'
]
NoneType
=
None
.
__class__
T
=
tp
.
TypeVar
(
'
T
'
)
Iteratable
=
tp
.
Union
[
tp
.
Iterator
[
T
],
tp
.
Iterable
[
T
]]
...
...
@@ -13,6 +18,7 @@ NoArgCallable = tp.Callable[[], T]
Predicate
=
tp
.
Callable
[[
T
],
bool
]
ExceptionClassType
=
tp
.
Type
[
Exception
]
ExceptionList
=
tp
.
Union
[
ExceptionClassType
,
tp
.
Tuple
[
ExceptionClassType
]]
class
ClassComparable
(
metaclass
=
ABCMeta
):
...
...
@@ -42,6 +48,3 @@ class Appendable(Protocol[T]):
...
__all__
=
[
'
Iteratable
'
,
'
T
'
,
'
U
'
,
'
V
'
,
'
K
'
,
'
Number
'
,
'
ExceptionClassType
'
,
'
NoArgCallable
'
,
'
Appendable
'
,
'
Predicate
'
,
'
KVTuple
'
,
'
Comparable
'
]
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