Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pytools
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Andreas Klöckner
pytools
Commits
85e8b72f
Commit
85e8b72f
authored
2 years ago
by
Andreas Klöckner
Committed by
Andreas Klöckner
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix type annotation of Taggable.tags_of_type
parent
e9dfa429
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#285966
passed
2 years ago
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
doc/conf.py
+0
-1
0 additions, 1 deletion
doc/conf.py
pytools/tag.py
+6
-8
6 additions, 8 deletions
pytools/tag.py
with
6 additions
and
9 deletions
doc/conf.py
+
0
−
1
View file @
85e8b72f
...
...
@@ -31,7 +31,6 @@ intersphinx_mapping = {
"
https://documen.tician.de/loopy/
"
:
None
,
}
nitpick_ignore_regex
=
[
[
"
py:class
"
,
r
"
typing_extensions\.(.+)
"
],
]
This diff is collapsed.
Click to expand it.
pytools/tag.py
+
6
−
8
View file @
85e8b72f
...
...
@@ -18,9 +18,9 @@ Supporting Functionality
Internal stuff that is only here because the documentation tool wants it
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. class:: Tag
sOfType
T
.. class:: TagT
A type variable
used in :meth:`Taggable.tags_of_type
`.
A type variable
with lower bound :class:`Tag
`.
"""
import
sys
...
...
@@ -166,7 +166,7 @@ class UniqueTag(Tag):
ToTagSetConvertible
=
Union
[
Iterable
[
Tag
],
Tag
,
None
]
Tag
sOfType
T
=
TypeVar
(
"
Tag
sOfType
T
"
,
bound
=
"
Type[
Tag
]
"
)
TagT
=
TypeVar
(
"
TagT
"
,
bound
=
"
Tag
"
)
# {{{ UniqueTag rules checking
...
...
@@ -313,15 +313,13 @@ class Taggable:
return
self
.
_with_new_tags
(
tags
=
check_tag_uniqueness
(
new_tags
))
@memoize_method
def
tags_of_type
(
self
,
tag_t
:
T
agsOfTypeT
)
->
FrozenSet
[
Tag
sOfType
T
]:
def
tags_of_type
(
self
,
tag_t
:
T
ype
[
TagT
]
)
->
FrozenSet
[
TagT
]:
"""
Returns *self*
'
s tags of type *tag_t*.
"""
# type-ignore reason: mypy can't tell the generator has elements of
# type 'TagsOfTypeT' (infers it as elements of type 'Tag')
return
frozenset
(
tag
# type: ignore[misc]
return
frozenset
({
tag
for
tag
in
self
.
tags
if
isinstance
(
tag
,
tag_t
))
if
isinstance
(
tag
,
tag_t
)
}
)
# }}}
...
...
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