Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
backend_common_py
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Package registry
Container registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
videoag
backend_common_py
Commits
17967563
Commit
17967563
authored
8 months ago
by
Simon Künzel
Browse files
Options
Downloads
Patches
Plain Diff
Fix object's super classes
parent
7281ce67
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/videoag_common/api_object/object_class.py
+12
-7
12 additions, 7 deletions
src/videoag_common/api_object/object_class.py
src/videoag_common/objects/medium.py
+1
-1
1 addition, 1 deletion
src/videoag_common/objects/medium.py
with
13 additions
and
8 deletions
src/videoag_common/api_object/object_class.py
+
12
−
7
View file @
17967563
...
...
@@ -140,6 +140,8 @@ class ApiObjectClass:
raise
Exception
(
f
"
Class
'
{
self
.
orm_class
.
__name__
}
'
has unknown variant
'
{
base_variant_id
}
'"
)
def
_post_init_variant_fields
(
self
,
all_classes
:
dict
[
str
,
"
ApiObjectClass
"
]):
variant_ignore_classes
=
set
(
recursive_flat_map_single
(
lambda
c
:
c
.
__bases__
,
self
.
orm_class
))
for
sub_class
in
self
.
orm_class
.
__subclasses__
():
if
not
hasattr
(
sub_class
,
"
__all_class_api_fields__
"
):
continue
...
...
@@ -153,13 +155,16 @@ class ApiObjectClass:
f
"'
{
self
.
_variant_field
.
enum_class
.
__name__
}
'"
)
# noinspection PyUnresolvedReferences
for
sub_field
in
sub_class
.
__all_class_api_fields__
:
for
super_sub_class
in
set
(
recursive_flat_map_single
(
lambda
c
:
c
.
__bases__
,
sub_class
))
-
variant_ignore_classes
:
if
not
hasattr
(
super_sub_class
,
"
__all_class_api_fields__
"
):
continue
for
sub_field
in
super_sub_class
.
__all_class_api_fields__
:
assert
isinstance
(
sub_field
,
ApiField
)
try
:
self
.
_add_field
(
all_classes
,
sub_field
,
sub_class
,
variant_id
)
except
Exception
as
e
:
raise
Exception
(
f
"
While initializing field for member
'
{
sub_field
.
member_name
}
'
in class
'
{
sub_class
.
__name__
}
'"
)
from
e
f
"
While initializing field for member
'
{
sub_field
.
member_name
}
'
in class
'
{
super_
sub_class
.
__name__
}
'"
)
from
e
for
sub2_class
in
filter
(
lambda
c
:
hasattr
(
c
,
"
__all_class_api_fields__
"
),
...
...
This diff is collapsed.
Click to expand it.
src/videoag_common/objects/medium.py
+
1
−
1
View file @
17967563
...
...
@@ -286,7 +286,7 @@ class PlainAudioTargetMedium(TargetMedium, FileMedium, SingleAudioContainingMedi
)
class
ThumbnailTargetMedium
(
FileMedium
):
class
ThumbnailTargetMedium
(
TargetMedium
,
FileMedium
):
__tablename__
=
None
# Prevent our own base from adding a table name. This should be a single-table inheritance
__mapper_args__
=
{
"
polymorphic_identity
"
:
TargetMediumType
.
THUMBNAIL
...
...
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