File tree Expand file tree Collapse file tree 2 files changed +54
-0
lines changed Expand file tree Collapse file tree 2 files changed +54
-0
lines changed Original file line number Diff line number Diff line change 1+ # Copyright 2025 CloudWeGo Authors
2+ #
3+ # Licensed under the Apache License, Version 2.0 (the "License");
4+ # you may not use this file except in compliance with the License.
5+ # You may obtain a copy of the License at
6+ #
7+ # https://www.apache.org/licenses/LICENSE-2.0
8+ #
9+ # Unless required by applicable law or agreed to in writing, software
10+ # distributed under the License is distributed on an "AS IS" BASIS,
11+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+ # See the License for the specific language governing permissions and
13+ # limitations under the License.
14+
15+
16+ # fmt: off
117import abc
218import base64
319
Original file line number Diff line number Diff line change 1+ # Copyright 2025 CloudWeGo Authors
2+ #
3+ # Licensed under the Apache License, Version 2.0 (the "License");
4+ # you may not use this file except in compliance with the License.
5+ # You may obtain a copy of the License at
6+ #
7+ # https://www.apache.org/licenses/LICENSE-2.0
8+ #
9+ # Unless required by applicable law or agreed to in writing, software
10+ # distributed under the License is distributed on an "AS IS" BASIS,
11+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+ # See the License for the specific language governing permissions and
13+ # limitations under the License.
14+
15+
16+ class A :
17+ def __init__ (self ):
18+ self .value = 10
19+
20+ def get_value (self ):
21+ return self .value
22+
23+ def __add__ (self , other ):
24+ if isinstance (other , A ):
25+ return A (self .value + other .value )
26+ return NotImplemented
27+
28+
29+ def main ():
30+ a1 = A ()
31+ a2 = A ()
32+
33+ print ("Value of a1:" , a1 .get_value ())
34+ print ("Value of a2:" , a2 .get_value ())
35+
36+ # There should be a dependency from main to A.__add__
37+ a3 = a1 + a2
38+ print ("Value of a3 (a1 + a2):" , a3 .get_value ())
You can’t perform that action at this time.
0 commit comments