ZTWHHH commited on
Commit
fd8beb4
·
verified ·
1 Parent(s): dca6dc5

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. evalkit_tf437/lib/python3.10/site-packages/antlr4/__pycache__/Recognizer.cpython-310.pyc +0 -0
  2. evalkit_tf437/lib/python3.10/site-packages/antlr4/__pycache__/Token.cpython-310.pyc +0 -0
  3. evalkit_tf437/lib/python3.10/site-packages/antlr4/atn/__pycache__/ATNDeserializer.cpython-310.pyc +0 -0
  4. evalkit_tf437/lib/python3.10/site-packages/antlr4/error/Errors.py +172 -0
  5. evalkit_tf437/lib/python3.10/site-packages/antlr4/error/__pycache__/ErrorStrategy.cpython-310.pyc +0 -0
  6. evalkit_tf437/lib/python3.10/site-packages/antlr4/error/__pycache__/Errors.cpython-310.pyc +0 -0
  7. evalkit_tf437/lib/python3.10/site-packages/antlr4/tree/__pycache__/Chunk.cpython-310.pyc +0 -0
  8. evalkit_tf437/lib/python3.10/site-packages/antlr4/tree/__pycache__/ParseTreePattern.cpython-310.pyc +0 -0
  9. evalkit_tf437/lib/python3.10/site-packages/antlr4/tree/__pycache__/ParseTreePatternMatcher.cpython-310.pyc +0 -0
  10. evalkit_tf437/lib/python3.10/site-packages/antlr4/tree/__pycache__/__init__.cpython-310.pyc +0 -0
  11. evalkit_tf437/lib/python3.10/site-packages/async_timeout-4.0.3.dist-info/INSTALLER +1 -0
  12. evalkit_tf437/lib/python3.10/site-packages/async_timeout-4.0.3.dist-info/LICENSE +13 -0
  13. evalkit_tf437/lib/python3.10/site-packages/async_timeout-4.0.3.dist-info/RECORD +11 -0
  14. evalkit_tf437/lib/python3.10/site-packages/async_timeout-4.0.3.dist-info/REQUESTED +0 -0
  15. evalkit_tf437/lib/python3.10/site-packages/async_timeout-4.0.3.dist-info/WHEEL +5 -0
  16. evalkit_tf437/lib/python3.10/site-packages/async_timeout-4.0.3.dist-info/zip-safe +1 -0
  17. evalkit_tf437/lib/python3.10/site-packages/openpyxl-3.1.5.dist-info/INSTALLER +1 -0
  18. evalkit_tf437/lib/python3.10/site-packages/openpyxl-3.1.5.dist-info/LICENCE.rst +23 -0
  19. evalkit_tf437/lib/python3.10/site-packages/openpyxl-3.1.5.dist-info/WHEEL +6 -0
  20. evalkit_tf437/lib/python3.10/site-packages/openpyxl-3.1.5.dist-info/top_level.txt +1 -0
  21. evalkit_tf437/lib/python3.10/site-packages/pip-25.0.1.dist-info/top_level.txt +1 -0
  22. evalkit_tf437/lib/python3.10/site-packages/proto/__pycache__/__init__.cpython-310.pyc +0 -0
  23. evalkit_tf437/lib/python3.10/site-packages/proto/__pycache__/_file_info.cpython-310.pyc +0 -0
  24. evalkit_tf437/lib/python3.10/site-packages/proto/__pycache__/datetime_helpers.cpython-310.pyc +0 -0
  25. evalkit_tf437/lib/python3.10/site-packages/proto/__pycache__/enums.cpython-310.pyc +0 -0
  26. evalkit_tf437/lib/python3.10/site-packages/proto/__pycache__/fields.cpython-310.pyc +0 -0
  27. evalkit_tf437/lib/python3.10/site-packages/proto/__pycache__/message.cpython-310.pyc +0 -0
  28. evalkit_tf437/lib/python3.10/site-packages/proto/__pycache__/modules.cpython-310.pyc +0 -0
  29. evalkit_tf437/lib/python3.10/site-packages/proto/__pycache__/primitives.cpython-310.pyc +0 -0
  30. evalkit_tf437/lib/python3.10/site-packages/proto/__pycache__/utils.cpython-310.pyc +0 -0
  31. evalkit_tf437/lib/python3.10/site-packages/proto/__pycache__/version.cpython-310.pyc +0 -0
  32. evalkit_tf437/lib/python3.10/site-packages/proto/enums.py +163 -0
  33. evalkit_tf437/lib/python3.10/site-packages/proto/fields.py +165 -0
  34. evalkit_tf437/lib/python3.10/site-packages/proto/marshal/__init__.py +18 -0
  35. evalkit_tf437/lib/python3.10/site-packages/proto/marshal/__pycache__/__init__.cpython-310.pyc +0 -0
  36. evalkit_tf437/lib/python3.10/site-packages/proto/marshal/__pycache__/compat.cpython-310.pyc +0 -0
  37. evalkit_tf437/lib/python3.10/site-packages/proto/marshal/collections/__init__.py +24 -0
  38. evalkit_tf437/lib/python3.10/site-packages/proto/marshal/collections/__pycache__/__init__.cpython-310.pyc +0 -0
  39. evalkit_tf437/lib/python3.10/site-packages/proto/marshal/collections/__pycache__/maps.cpython-310.pyc +0 -0
  40. evalkit_tf437/lib/python3.10/site-packages/proto/marshal/collections/__pycache__/repeated.cpython-310.pyc +0 -0
  41. evalkit_tf437/lib/python3.10/site-packages/proto/marshal/collections/maps.py +82 -0
  42. evalkit_tf437/lib/python3.10/site-packages/proto/marshal/collections/repeated.py +189 -0
  43. evalkit_tf437/lib/python3.10/site-packages/proto/marshal/compat.py +64 -0
  44. evalkit_tf437/lib/python3.10/site-packages/proto/marshal/marshal.py +297 -0
  45. evalkit_tf437/lib/python3.10/site-packages/proto/marshal/rules/__init__.py +13 -0
  46. evalkit_tf437/lib/python3.10/site-packages/proto/marshal/rules/__pycache__/enums.cpython-310.pyc +0 -0
  47. evalkit_tf437/lib/python3.10/site-packages/proto/marshal/rules/__pycache__/field_mask.cpython-310.pyc +0 -0
  48. evalkit_tf437/lib/python3.10/site-packages/proto/marshal/rules/__pycache__/message.cpython-310.pyc +0 -0
  49. evalkit_tf437/lib/python3.10/site-packages/proto/marshal/rules/__pycache__/stringy_numbers.cpython-310.pyc +0 -0
  50. evalkit_tf437/lib/python3.10/site-packages/proto/marshal/rules/__pycache__/struct.cpython-310.pyc +0 -0
evalkit_tf437/lib/python3.10/site-packages/antlr4/__pycache__/Recognizer.cpython-310.pyc ADDED
Binary file (4.44 kB). View file
 
evalkit_tf437/lib/python3.10/site-packages/antlr4/__pycache__/Token.cpython-310.pyc ADDED
Binary file (3.17 kB). View file
 
evalkit_tf437/lib/python3.10/site-packages/antlr4/atn/__pycache__/ATNDeserializer.cpython-310.pyc ADDED
Binary file (15.6 kB). View file
 
evalkit_tf437/lib/python3.10/site-packages/antlr4/error/Errors.py ADDED
@@ -0,0 +1,172 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
2
+ # Use of this file is governed by the BSD 3-clause license that
3
+ # can be found in the LICENSE.txt file in the project root.
4
+ #
5
+
6
+ # need forward declaration
7
+ Token = None
8
+ Lexer = None
9
+ Parser = None
10
+ TokenStream = None
11
+ ATNConfigSet = None
12
+ ParserRulecontext = None
13
+ PredicateTransition = None
14
+ BufferedTokenStream = None
15
+
16
+ class UnsupportedOperationException(Exception):
17
+
18
+ def __init__(self, msg:str):
19
+ super().__init__(msg)
20
+
21
+ class IllegalStateException(Exception):
22
+
23
+ def __init__(self, msg:str):
24
+ super().__init__(msg)
25
+
26
+ class CancellationException(IllegalStateException):
27
+
28
+ def __init__(self, msg:str):
29
+ super().__init__(msg)
30
+
31
+ # The root of the ANTLR exception hierarchy. In general, ANTLR tracks just
32
+ # 3 kinds of errors: prediction errors, failed predicate errors, and
33
+ # mismatched input errors. In each case, the parser knows where it is
34
+ # in the input, where it is in the ATN, the rule invocation stack,
35
+ # and what kind of problem occurred.
36
+
37
+ from antlr4.InputStream import InputStream
38
+ from antlr4.ParserRuleContext import ParserRuleContext
39
+ from antlr4.Recognizer import Recognizer
40
+
41
+ class RecognitionException(Exception):
42
+
43
+
44
+ def __init__(self, message:str=None, recognizer:Recognizer=None, input:InputStream=None, ctx:ParserRulecontext=None):
45
+ super().__init__(message)
46
+ self.message = message
47
+ self.recognizer = recognizer
48
+ self.input = input
49
+ self.ctx = ctx
50
+ # The current {@link Token} when an error occurred. Since not all streams
51
+ # support accessing symbols by index, we have to track the {@link Token}
52
+ # instance itself.
53
+ self.offendingToken = None
54
+ # Get the ATN state number the parser was in at the time the error
55
+ # occurred. For {@link NoViableAltException} and
56
+ # {@link LexerNoViableAltException} exceptions, this is the
57
+ # {@link DecisionState} number. For others, it is the state whose outgoing
58
+ # edge we couldn't match.
59
+ self.offendingState = -1
60
+ if recognizer is not None:
61
+ self.offendingState = recognizer.state
62
+
63
+ # <p>If the state number is not known, this method returns -1.</p>
64
+
65
+ #
66
+ # Gets the set of input symbols which could potentially follow the
67
+ # previously matched symbol at the time this exception was thrown.
68
+ #
69
+ # <p>If the set of expected tokens is not known and could not be computed,
70
+ # this method returns {@code null}.</p>
71
+ #
72
+ # @return The set of token types that could potentially follow the current
73
+ # state in the ATN, or {@code null} if the information is not available.
74
+ #/
75
+ def getExpectedTokens(self):
76
+ if self.recognizer is not None:
77
+ return self.recognizer.atn.getExpectedTokens(self.offendingState, self.ctx)
78
+ else:
79
+ return None
80
+
81
+
82
+ class LexerNoViableAltException(RecognitionException):
83
+
84
+ def __init__(self, lexer:Lexer, input:InputStream, startIndex:int, deadEndConfigs:ATNConfigSet):
85
+ super().__init__(message=None, recognizer=lexer, input=input, ctx=None)
86
+ self.startIndex = startIndex
87
+ self.deadEndConfigs = deadEndConfigs
88
+
89
+ def __str__(self):
90
+ symbol = ""
91
+ if self.startIndex >= 0 and self.startIndex < self.input.size:
92
+ symbol = self.input.getText(self.startIndex, self.startIndex)
93
+ # TODO symbol = Utils.escapeWhitespace(symbol, false);
94
+ return "LexerNoViableAltException('" + symbol + "')"
95
+
96
+ # Indicates that the parser could not decide which of two or more paths
97
+ # to take based upon the remaining input. It tracks the starting token
98
+ # of the offending input and also knows where the parser was
99
+ # in the various paths when the error. Reported by reportNoViableAlternative()
100
+ #
101
+ class NoViableAltException(RecognitionException):
102
+
103
+ def __init__(self, recognizer:Parser, input:TokenStream=None, startToken:Token=None,
104
+ offendingToken:Token=None, deadEndConfigs:ATNConfigSet=None, ctx:ParserRuleContext=None):
105
+ if ctx is None:
106
+ ctx = recognizer._ctx
107
+ if offendingToken is None:
108
+ offendingToken = recognizer.getCurrentToken()
109
+ if startToken is None:
110
+ startToken = recognizer.getCurrentToken()
111
+ if input is None:
112
+ input = recognizer.getInputStream()
113
+ super().__init__(recognizer=recognizer, input=input, ctx=ctx)
114
+ # Which configurations did we try at input.index() that couldn't match input.LT(1)?#
115
+ self.deadEndConfigs = deadEndConfigs
116
+ # The token object at the start index; the input stream might
117
+ # not be buffering tokens so get a reference to it. (At the
118
+ # time the error occurred, of course the stream needs to keep a
119
+ # buffer all of the tokens but later we might not have access to those.)
120
+ self.startToken = startToken
121
+ self.offendingToken = offendingToken
122
+
123
+ # This signifies any kind of mismatched input exceptions such as
124
+ # when the current input does not match the expected token.
125
+ #
126
+ class InputMismatchException(RecognitionException):
127
+
128
+ def __init__(self, recognizer:Parser):
129
+ super().__init__(recognizer=recognizer, input=recognizer.getInputStream(), ctx=recognizer._ctx)
130
+ self.offendingToken = recognizer.getCurrentToken()
131
+
132
+
133
+ # A semantic predicate failed during validation. Validation of predicates
134
+ # occurs when normally parsing the alternative just like matching a token.
135
+ # Disambiguating predicate evaluation occurs when we test a predicate during
136
+ # prediction.
137
+
138
+ class FailedPredicateException(RecognitionException):
139
+
140
+ def __init__(self, recognizer:Parser, predicate:str=None, message:str=None):
141
+ super().__init__(message=self.formatMessage(predicate,message), recognizer=recognizer,
142
+ input=recognizer.getInputStream(), ctx=recognizer._ctx)
143
+ s = recognizer._interp.atn.states[recognizer.state]
144
+ trans = s.transitions[0]
145
+ from antlr4.atn.Transition import PredicateTransition
146
+ if isinstance(trans, PredicateTransition):
147
+ self.ruleIndex = trans.ruleIndex
148
+ self.predicateIndex = trans.predIndex
149
+ else:
150
+ self.ruleIndex = 0
151
+ self.predicateIndex = 0
152
+ self.predicate = predicate
153
+ self.offendingToken = recognizer.getCurrentToken()
154
+
155
+ def formatMessage(self, predicate:str, message:str):
156
+ if message is not None:
157
+ return message
158
+ else:
159
+ return "failed predicate: {" + predicate + "}?"
160
+
161
+ class ParseCancellationException(CancellationException):
162
+
163
+ pass
164
+
165
+ del Token
166
+ del Lexer
167
+ del Parser
168
+ del TokenStream
169
+ del ATNConfigSet
170
+ del ParserRulecontext
171
+ del PredicateTransition
172
+ del BufferedTokenStream
evalkit_tf437/lib/python3.10/site-packages/antlr4/error/__pycache__/ErrorStrategy.cpython-310.pyc ADDED
Binary file (9.88 kB). View file
 
evalkit_tf437/lib/python3.10/site-packages/antlr4/error/__pycache__/Errors.cpython-310.pyc ADDED
Binary file (4.92 kB). View file
 
evalkit_tf437/lib/python3.10/site-packages/antlr4/tree/__pycache__/Chunk.cpython-310.pyc ADDED
Binary file (1.22 kB). View file
 
evalkit_tf437/lib/python3.10/site-packages/antlr4/tree/__pycache__/ParseTreePattern.cpython-310.pyc ADDED
Binary file (1.45 kB). View file
 
evalkit_tf437/lib/python3.10/site-packages/antlr4/tree/__pycache__/ParseTreePatternMatcher.cpython-310.pyc ADDED
Binary file (7.69 kB). View file
 
evalkit_tf437/lib/python3.10/site-packages/antlr4/tree/__pycache__/__init__.cpython-310.pyc ADDED
Binary file (170 Bytes). View file
 
evalkit_tf437/lib/python3.10/site-packages/async_timeout-4.0.3.dist-info/INSTALLER ADDED
@@ -0,0 +1 @@
 
 
1
+ pip
evalkit_tf437/lib/python3.10/site-packages/async_timeout-4.0.3.dist-info/LICENSE ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Copyright 2016-2020 aio-libs collaboration.
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
+ http://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.
evalkit_tf437/lib/python3.10/site-packages/async_timeout-4.0.3.dist-info/RECORD ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ async_timeout-4.0.3.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
2
+ async_timeout-4.0.3.dist-info/LICENSE,sha256=4Y17uPUT4sRrtYXJS1hb0wcg3TzLId2weG9y0WZY-Sw,568
3
+ async_timeout-4.0.3.dist-info/METADATA,sha256=WQVcnDIXQ2ntebcm-vYjhNLg_VMeTWw13_ReT-U36J4,4209
4
+ async_timeout-4.0.3.dist-info/RECORD,,
5
+ async_timeout-4.0.3.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
+ async_timeout-4.0.3.dist-info/WHEEL,sha256=5sUXSg9e4bi7lTLOHcm6QEYwO5TIF1TNbTSVFVjcJcc,92
7
+ async_timeout-4.0.3.dist-info/top_level.txt,sha256=9oM4e7Twq8iD_7_Q3Mz0E6GPIB6vJvRFo-UBwUQtBDU,14
8
+ async_timeout-4.0.3.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
9
+ async_timeout/__init__.py,sha256=A0VOqDGQ3cCPFp0NZJKIbx_VRP1Y2xPtQOZebVIUB88,7242
10
+ async_timeout/__pycache__/__init__.cpython-310.pyc,,
11
+ async_timeout/py.typed,sha256=tyozzRT1fziXETDxokmuyt6jhOmtjUbnVNJdZcG7ik0,12
evalkit_tf437/lib/python3.10/site-packages/async_timeout-4.0.3.dist-info/REQUESTED ADDED
File without changes
evalkit_tf437/lib/python3.10/site-packages/async_timeout-4.0.3.dist-info/WHEEL ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ Wheel-Version: 1.0
2
+ Generator: bdist_wheel (0.41.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
evalkit_tf437/lib/python3.10/site-packages/async_timeout-4.0.3.dist-info/zip-safe ADDED
@@ -0,0 +1 @@
 
 
1
+
evalkit_tf437/lib/python3.10/site-packages/openpyxl-3.1.5.dist-info/INSTALLER ADDED
@@ -0,0 +1 @@
 
 
1
+ pip
evalkit_tf437/lib/python3.10/site-packages/openpyxl-3.1.5.dist-info/LICENCE.rst ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ This software is under the MIT Licence
2
+ ======================================
3
+
4
+ Copyright (c) 2010 openpyxl
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a
7
+ copy of this software and associated documentation files (the
8
+ "Software"), to deal in the Software without restriction, including
9
+ without limitation the rights to use, copy, modify, merge, publish,
10
+ distribute, sublicense, and/or sell copies of the Software, and to
11
+ permit persons to whom the Software is furnished to do so, subject to
12
+ the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be included
15
+ in all copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
21
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
evalkit_tf437/lib/python3.10/site-packages/openpyxl-3.1.5.dist-info/WHEEL ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ Wheel-Version: 1.0
2
+ Generator: bdist_wheel (0.43.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py2-none-any
5
+ Tag: py3-none-any
6
+
evalkit_tf437/lib/python3.10/site-packages/openpyxl-3.1.5.dist-info/top_level.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ openpyxl
evalkit_tf437/lib/python3.10/site-packages/pip-25.0.1.dist-info/top_level.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ pip
evalkit_tf437/lib/python3.10/site-packages/proto/__pycache__/__init__.cpython-310.pyc ADDED
Binary file (932 Bytes). View file
 
evalkit_tf437/lib/python3.10/site-packages/proto/__pycache__/_file_info.cpython-310.pyc ADDED
Binary file (5 kB). View file
 
evalkit_tf437/lib/python3.10/site-packages/proto/__pycache__/datetime_helpers.cpython-310.pyc ADDED
Binary file (6.1 kB). View file
 
evalkit_tf437/lib/python3.10/site-packages/proto/__pycache__/enums.cpython-310.pyc ADDED
Binary file (3.88 kB). View file
 
evalkit_tf437/lib/python3.10/site-packages/proto/__pycache__/fields.cpython-310.pyc ADDED
Binary file (3.26 kB). View file
 
evalkit_tf437/lib/python3.10/site-packages/proto/__pycache__/message.cpython-310.pyc ADDED
Binary file (26 kB). View file
 
evalkit_tf437/lib/python3.10/site-packages/proto/__pycache__/modules.cpython-310.pyc ADDED
Binary file (1.14 kB). View file
 
evalkit_tf437/lib/python3.10/site-packages/proto/__pycache__/primitives.cpython-310.pyc ADDED
Binary file (733 Bytes). View file
 
evalkit_tf437/lib/python3.10/site-packages/proto/__pycache__/utils.cpython-310.pyc ADDED
Binary file (1.07 kB). View file
 
evalkit_tf437/lib/python3.10/site-packages/proto/__pycache__/version.cpython-310.pyc ADDED
Binary file (185 Bytes). View file
 
evalkit_tf437/lib/python3.10/site-packages/proto/enums.py ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2019 Google LLC
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
+ import enum
16
+
17
+ from google.protobuf import descriptor_pb2
18
+
19
+ from proto import _file_info
20
+ from proto import _package_info
21
+ from proto.marshal.rules.enums import EnumRule
22
+
23
+
24
+ class ProtoEnumMeta(enum.EnumMeta):
25
+ """A metaclass for building and registering protobuf enums."""
26
+
27
+ def __new__(mcls, name, bases, attrs):
28
+ # Do not do any special behavior for `proto.Enum` itself.
29
+ if bases[0] == enum.IntEnum:
30
+ return super().__new__(mcls, name, bases, attrs)
31
+
32
+ # Get the essential information about the proto package, and where
33
+ # this component belongs within the file.
34
+ package, marshal = _package_info.compile(name, attrs)
35
+
36
+ # Determine the local path of this proto component within the file.
37
+ local_path = tuple(attrs.get("__qualname__", name).split("."))
38
+
39
+ # Sanity check: We get the wrong full name if a class is declared
40
+ # inside a function local scope; correct this.
41
+ if "<locals>" in local_path:
42
+ ix = local_path.index("<locals>")
43
+ local_path = local_path[: ix - 1] + local_path[ix + 1 :]
44
+
45
+ # Determine the full name in protocol buffers.
46
+ full_name = ".".join((package,) + local_path).lstrip(".")
47
+ filename = _file_info._FileInfo.proto_file_name(
48
+ attrs.get("__module__", name.lower())
49
+ )
50
+
51
+ # Retrieve any enum options.
52
+ # We expect something that looks like an EnumOptions message,
53
+ # either an actual instance or a dict-like representation.
54
+ pb_options = "_pb_options"
55
+ opts = attrs.pop(pb_options, {})
56
+ # This is the only portable way to remove the _pb_options name
57
+ # from the enum attrs.
58
+ # In 3.7 onwards, we can define an _ignore_ attribute and do some
59
+ # mucking around with that.
60
+ if pb_options in attrs._member_names:
61
+ if isinstance(attrs._member_names, list):
62
+ idx = attrs._member_names.index(pb_options)
63
+ attrs._member_names.pop(idx)
64
+ else: # Python 3.11.0b3
65
+ del attrs._member_names[pb_options]
66
+
67
+ # Make the descriptor.
68
+ enum_desc = descriptor_pb2.EnumDescriptorProto(
69
+ name=name,
70
+ # Note: the superclass ctor removes the variants, so get them now.
71
+ # Note: proto3 requires that the first variant value be zero.
72
+ value=sorted(
73
+ (
74
+ descriptor_pb2.EnumValueDescriptorProto(name=name, number=number)
75
+ # Minor hack to get all the enum variants out.
76
+ # Use the `_member_names` property to get only the enum members
77
+ # See https://github.com/googleapis/proto-plus-python/issues/490
78
+ for name, number in attrs.items()
79
+ if name in attrs._member_names and isinstance(number, int)
80
+ ),
81
+ key=lambda v: v.number,
82
+ ),
83
+ options=opts,
84
+ )
85
+
86
+ file_info = _file_info._FileInfo.maybe_add_descriptor(filename, package)
87
+ if len(local_path) == 1:
88
+ file_info.descriptor.enum_type.add().MergeFrom(enum_desc)
89
+ else:
90
+ file_info.nested_enum[local_path] = enum_desc
91
+
92
+ # Run the superclass constructor.
93
+ cls = super().__new__(mcls, name, bases, attrs)
94
+
95
+ # We can't just add a "_meta" element to attrs because the Enum
96
+ # machinery doesn't know what to do with a non-int value.
97
+ # The pb is set later, in generate_file_pb
98
+ cls._meta = _EnumInfo(full_name=full_name, pb=None)
99
+
100
+ file_info.enums[full_name] = cls
101
+
102
+ # Register the enum with the marshal.
103
+ marshal.register(cls, EnumRule(cls))
104
+
105
+ # Generate the descriptor for the file if it is ready.
106
+ if file_info.ready(new_class=cls):
107
+ file_info.generate_file_pb(new_class=cls, fallback_salt=full_name)
108
+
109
+ # Done; return the class.
110
+ return cls
111
+
112
+
113
+ class Enum(enum.IntEnum, metaclass=ProtoEnumMeta):
114
+ """A enum object that also builds a protobuf enum descriptor."""
115
+
116
+ def _comparable(self, other):
117
+ # Avoid 'isinstance' to prevent other IntEnums from matching
118
+ return type(other) in (type(self), int)
119
+
120
+ def __hash__(self):
121
+ return hash(self.value)
122
+
123
+ def __eq__(self, other):
124
+ if not self._comparable(other):
125
+ return NotImplemented
126
+
127
+ return self.value == int(other)
128
+
129
+ def __ne__(self, other):
130
+ if not self._comparable(other):
131
+ return NotImplemented
132
+
133
+ return self.value != int(other)
134
+
135
+ def __lt__(self, other):
136
+ if not self._comparable(other):
137
+ return NotImplemented
138
+
139
+ return self.value < int(other)
140
+
141
+ def __le__(self, other):
142
+ if not self._comparable(other):
143
+ return NotImplemented
144
+
145
+ return self.value <= int(other)
146
+
147
+ def __ge__(self, other):
148
+ if not self._comparable(other):
149
+ return NotImplemented
150
+
151
+ return self.value >= int(other)
152
+
153
+ def __gt__(self, other):
154
+ if not self._comparable(other):
155
+ return NotImplemented
156
+
157
+ return self.value > int(other)
158
+
159
+
160
+ class _EnumInfo:
161
+ def __init__(self, *, full_name: str, pb):
162
+ self.full_name = full_name
163
+ self.pb = pb
evalkit_tf437/lib/python3.10/site-packages/proto/fields.py ADDED
@@ -0,0 +1,165 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2018 Google LLC
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
+ from enum import EnumMeta
16
+
17
+ from google.protobuf import descriptor_pb2
18
+ from google.protobuf.internal.enum_type_wrapper import EnumTypeWrapper
19
+
20
+ from proto.primitives import ProtoType
21
+
22
+
23
+ class Field:
24
+ """A representation of a type of field in protocol buffers."""
25
+
26
+ # Fields are NOT repeated nor maps.
27
+ # The RepeatedField overrides this values.
28
+ repeated = False
29
+
30
+ def __init__(
31
+ self,
32
+ proto_type,
33
+ *,
34
+ number: int,
35
+ message=None,
36
+ enum=None,
37
+ oneof: str = None,
38
+ json_name: str = None,
39
+ optional: bool = False
40
+ ):
41
+ # This class is not intended to stand entirely alone;
42
+ # data is augmented by the metaclass for Message.
43
+ self.mcls_data = None
44
+ self.parent = None
45
+
46
+ # If the proto type sent is an object or a string, it is really
47
+ # a message or enum.
48
+ if not isinstance(proto_type, int):
49
+ # Note: We only support the "shortcut syntax" for enums
50
+ # when receiving the actual class.
51
+ if isinstance(proto_type, (EnumMeta, EnumTypeWrapper)):
52
+ enum = proto_type
53
+ proto_type = ProtoType.ENUM
54
+ else:
55
+ message = proto_type
56
+ proto_type = ProtoType.MESSAGE
57
+
58
+ # Save the direct arguments.
59
+ self.number = number
60
+ self.proto_type = proto_type
61
+ self.message = message
62
+ self.enum = enum
63
+ self.json_name = json_name
64
+ self.optional = optional
65
+ self.oneof = oneof
66
+
67
+ # Once the descriptor is accessed the first time, cache it.
68
+ # This is important because in rare cases the message or enum
69
+ # types are written later.
70
+ self._descriptor = None
71
+
72
+ @property
73
+ def descriptor(self):
74
+ """Return the descriptor for the field."""
75
+ if not self._descriptor:
76
+ # Resolve the message type, if any, to a string.
77
+ type_name = None
78
+ if isinstance(self.message, str):
79
+ if not self.message.startswith(self.package):
80
+ self.message = "{package}.{name}".format(
81
+ package=self.package,
82
+ name=self.message,
83
+ )
84
+ type_name = self.message
85
+ elif self.message:
86
+ type_name = (
87
+ self.message.DESCRIPTOR.full_name
88
+ if hasattr(self.message, "DESCRIPTOR")
89
+ else self.message._meta.full_name
90
+ )
91
+ elif isinstance(self.enum, str):
92
+ if not self.enum.startswith(self.package):
93
+ self.enum = "{package}.{name}".format(
94
+ package=self.package,
95
+ name=self.enum,
96
+ )
97
+ type_name = self.enum
98
+ elif self.enum:
99
+ type_name = (
100
+ self.enum.DESCRIPTOR.full_name
101
+ if hasattr(self.enum, "DESCRIPTOR")
102
+ else self.enum._meta.full_name
103
+ )
104
+
105
+ # Set the descriptor.
106
+ self._descriptor = descriptor_pb2.FieldDescriptorProto(
107
+ name=self.name,
108
+ number=self.number,
109
+ label=3 if self.repeated else 1,
110
+ type=self.proto_type,
111
+ type_name=type_name,
112
+ json_name=self.json_name,
113
+ proto3_optional=self.optional,
114
+ )
115
+
116
+ # Return the descriptor.
117
+ return self._descriptor
118
+
119
+ @property
120
+ def name(self) -> str:
121
+ """Return the name of the field."""
122
+ return self.mcls_data["name"]
123
+
124
+ @property
125
+ def package(self) -> str:
126
+ """Return the package of the field."""
127
+ return self.mcls_data["package"]
128
+
129
+ @property
130
+ def pb_type(self):
131
+ """Return the composite type of the field, or the primitive type if a primitive."""
132
+ # For enums, return the Python enum.
133
+ if self.enum:
134
+ return self.enum
135
+
136
+ # For primitive fields, we still want to know
137
+ # what the type is.
138
+ if not self.message:
139
+ return self.proto_type
140
+
141
+ # Return the internal protobuf message.
142
+ if hasattr(self.message, "_meta"):
143
+ return self.message.pb()
144
+ return self.message
145
+
146
+
147
+ class RepeatedField(Field):
148
+ """A representation of a repeated field in protocol buffers."""
149
+
150
+ repeated = True
151
+
152
+
153
+ class MapField(Field):
154
+ """A representation of a map field in protocol buffers."""
155
+
156
+ def __init__(self, key_type, value_type, *, number: int, message=None, enum=None):
157
+ super().__init__(value_type, number=number, message=message, enum=enum)
158
+ self.map_key_type = key_type
159
+
160
+
161
+ __all__ = (
162
+ "Field",
163
+ "MapField",
164
+ "RepeatedField",
165
+ )
evalkit_tf437/lib/python3.10/site-packages/proto/marshal/__init__.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2018 Google LLC
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
+ from .marshal import Marshal
16
+
17
+
18
+ __all__ = ("Marshal",)
evalkit_tf437/lib/python3.10/site-packages/proto/marshal/__pycache__/__init__.cpython-310.pyc ADDED
Binary file (226 Bytes). View file
 
evalkit_tf437/lib/python3.10/site-packages/proto/marshal/__pycache__/compat.cpython-310.pyc ADDED
Binary file (873 Bytes). View file
 
evalkit_tf437/lib/python3.10/site-packages/proto/marshal/collections/__init__.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2018 Google LLC
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
+ from .maps import MapComposite
16
+ from .repeated import Repeated
17
+ from .repeated import RepeatedComposite
18
+
19
+
20
+ __all__ = (
21
+ "MapComposite",
22
+ "Repeated",
23
+ "RepeatedComposite",
24
+ )
evalkit_tf437/lib/python3.10/site-packages/proto/marshal/collections/__pycache__/__init__.cpython-310.pyc ADDED
Binary file (338 Bytes). View file
 
evalkit_tf437/lib/python3.10/site-packages/proto/marshal/collections/__pycache__/maps.cpython-310.pyc ADDED
Binary file (2.5 kB). View file
 
evalkit_tf437/lib/python3.10/site-packages/proto/marshal/collections/__pycache__/repeated.cpython-310.pyc ADDED
Binary file (5.51 kB). View file
 
evalkit_tf437/lib/python3.10/site-packages/proto/marshal/collections/maps.py ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2018 Google LLC
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
+ import collections
16
+
17
+ from proto.utils import cached_property
18
+ from google.protobuf.message import Message
19
+
20
+
21
+ class MapComposite(collections.abc.MutableMapping):
22
+ """A view around a mutable sequence in protocol buffers.
23
+
24
+ This implements the full Python MutableMapping interface, but all methods
25
+ modify the underlying field container directly.
26
+ """
27
+
28
+ @cached_property
29
+ def _pb_type(self):
30
+ """Return the protocol buffer type for this sequence."""
31
+ # Huzzah, another hack. Still less bad than RepeatedComposite.
32
+ return type(self.pb.GetEntryClass()().value)
33
+
34
+ def __init__(self, sequence, *, marshal):
35
+ """Initialize a wrapper around a protobuf map.
36
+
37
+ Args:
38
+ sequence: A protocol buffers map.
39
+ marshal (~.MarshalRegistry): An instantiated marshal, used to
40
+ convert values going to and from this map.
41
+ """
42
+ self._pb = sequence
43
+ self._marshal = marshal
44
+
45
+ def __contains__(self, key):
46
+ # Protocol buffers is so permissive that querying for the existence
47
+ # of a key will in of itself create it.
48
+ #
49
+ # By taking a tuple of the keys and querying that, we avoid sending
50
+ # the lookup to protocol buffers and therefore avoid creating the key.
51
+ return key in tuple(self.keys())
52
+
53
+ def __getitem__(self, key):
54
+ # We handle raising KeyError ourselves, because otherwise protocol
55
+ # buffers will create the key if it does not exist.
56
+ if key not in self:
57
+ raise KeyError(key)
58
+ return self._marshal.to_python(self._pb_type, self.pb[key])
59
+
60
+ def __setitem__(self, key, value):
61
+ pb_value = self._marshal.to_proto(self._pb_type, value, strict=True)
62
+ # Directly setting a key is not allowed; however, protocol buffers
63
+ # is so permissive that querying for the existence of a key will in
64
+ # of itself create it.
65
+ #
66
+ # Therefore, we create a key that way (clearing any fields that may
67
+ # be set) and then merge in our values.
68
+ self.pb[key].Clear()
69
+ self.pb[key].MergeFrom(pb_value)
70
+
71
+ def __delitem__(self, key):
72
+ self.pb.pop(key)
73
+
74
+ def __len__(self):
75
+ return len(self.pb)
76
+
77
+ def __iter__(self):
78
+ return iter(self.pb)
79
+
80
+ @property
81
+ def pb(self):
82
+ return self._pb
evalkit_tf437/lib/python3.10/site-packages/proto/marshal/collections/repeated.py ADDED
@@ -0,0 +1,189 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2018 Google LLC
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
+ import collections
16
+ import copy
17
+ from typing import Iterable
18
+
19
+ from proto.utils import cached_property
20
+
21
+
22
+ class Repeated(collections.abc.MutableSequence):
23
+ """A view around a mutable sequence in protocol buffers.
24
+
25
+ This implements the full Python MutableSequence interface, but all methods
26
+ modify the underlying field container directly.
27
+ """
28
+
29
+ def __init__(self, sequence, *, marshal, proto_type=None):
30
+ """Initialize a wrapper around a protobuf repeated field.
31
+
32
+ Args:
33
+ sequence: A protocol buffers repeated field.
34
+ marshal (~.MarshalRegistry): An instantiated marshal, used to
35
+ convert values going to and from this map.
36
+ """
37
+ self._pb = sequence
38
+ self._marshal = marshal
39
+ self._proto_type = proto_type
40
+
41
+ def __copy__(self):
42
+ """Copy this object and return the copy."""
43
+ return type(self)(self.pb[:], marshal=self._marshal)
44
+
45
+ def __delitem__(self, key):
46
+ """Delete the given item."""
47
+ del self.pb[key]
48
+
49
+ def __eq__(self, other):
50
+ if hasattr(other, "pb"):
51
+ return tuple(self.pb) == tuple(other.pb)
52
+ return tuple(self.pb) == tuple(other) if isinstance(other, Iterable) else False
53
+
54
+ def __getitem__(self, key):
55
+ """Return the given item."""
56
+ return self.pb[key]
57
+
58
+ def __len__(self):
59
+ """Return the length of the sequence."""
60
+ return len(self.pb)
61
+
62
+ def __ne__(self, other):
63
+ return not self == other
64
+
65
+ def __repr__(self):
66
+ return repr([*self])
67
+
68
+ def __setitem__(self, key, value):
69
+ self.pb[key] = value
70
+
71
+ def insert(self, index: int, value):
72
+ """Insert ``value`` in the sequence before ``index``."""
73
+ self.pb.insert(index, value)
74
+
75
+ def sort(self, *, key: str = None, reverse: bool = False):
76
+ """Stable sort *IN PLACE*."""
77
+ self.pb.sort(key=key, reverse=reverse)
78
+
79
+ @property
80
+ def pb(self):
81
+ return self._pb
82
+
83
+
84
+ class RepeatedComposite(Repeated):
85
+ """A view around a mutable sequence of messages in protocol buffers.
86
+
87
+ This implements the full Python MutableSequence interface, but all methods
88
+ modify the underlying field container directly.
89
+ """
90
+
91
+ @cached_property
92
+ def _pb_type(self):
93
+ """Return the protocol buffer type for this sequence."""
94
+ # Provide the marshal-given proto_type, if any.
95
+ # Used for RepeatedComposite of Enum.
96
+ if self._proto_type is not None:
97
+ return self._proto_type
98
+
99
+ # There is no public-interface mechanism to determine the type
100
+ # of what should go in the list (and the C implementation seems to
101
+ # have no exposed mechanism at all).
102
+ #
103
+ # If the list has members, use the existing list members to
104
+ # determine the type.
105
+ if len(self.pb) > 0:
106
+ return type(self.pb[0])
107
+
108
+ # We have no members in the list, so we get the type from the attributes.
109
+ if hasattr(self.pb, "_message_descriptor") and hasattr(
110
+ self.pb._message_descriptor, "_concrete_class"
111
+ ):
112
+ return self.pb._message_descriptor._concrete_class
113
+
114
+ # Fallback logic in case attributes are not available
115
+ # In order to get the type, we create a throw-away copy and add a
116
+ # blank member to it.
117
+ canary = copy.deepcopy(self.pb).add()
118
+ return type(canary)
119
+
120
+ def __eq__(self, other):
121
+ if super().__eq__(other):
122
+ return True
123
+ return (
124
+ tuple([i for i in self]) == tuple(other)
125
+ if isinstance(other, Iterable)
126
+ else False
127
+ )
128
+
129
+ def __getitem__(self, key):
130
+ return self._marshal.to_python(self._pb_type, self.pb[key])
131
+
132
+ def __setitem__(self, key, value):
133
+ # The underlying protocol buffer does not define __setitem__, so we
134
+ # have to implement all the operations on our own.
135
+
136
+ # If ``key`` is an integer, as in list[index] = value:
137
+ if isinstance(key, int):
138
+ if -len(self) <= key < len(self):
139
+ self.pop(key) # Delete the old item.
140
+ self.insert(key, value) # Insert the new item in its place.
141
+ else:
142
+ raise IndexError("list assignment index out of range")
143
+
144
+ # If ``key`` is a slice object, as in list[start:stop:step] = [values]:
145
+ elif isinstance(key, slice):
146
+ start, stop, step = key.indices(len(self))
147
+
148
+ if not isinstance(value, collections.abc.Iterable):
149
+ raise TypeError("can only assign an iterable")
150
+
151
+ if step == 1: # Is not an extended slice.
152
+ # Assign all the new values to the sliced part, replacing the
153
+ # old values, if any, and unconditionally inserting those
154
+ # values whose indices already exceed the slice length.
155
+ for index, item in enumerate(value):
156
+ if start + index < stop:
157
+ self.pop(start + index)
158
+ self.insert(start + index, item)
159
+
160
+ # If there are less values than the length of the slice, remove
161
+ # the remaining elements so that the slice adapts to the
162
+ # newly provided values.
163
+ for _ in range(stop - start - len(value)):
164
+ self.pop(start + len(value))
165
+
166
+ else: # Is an extended slice.
167
+ indices = range(start, stop, step)
168
+
169
+ if len(value) != len(indices): # XXX: Use PEP 572 on 3.8+
170
+ raise ValueError(
171
+ f"attempt to assign sequence of size "
172
+ f"{len(value)} to extended slice of size "
173
+ f"{len(indices)}"
174
+ )
175
+
176
+ # Assign each value to its index, calling this function again
177
+ # with individual integer indexes that get processed above.
178
+ for index, item in zip(indices, value):
179
+ self[index] = item
180
+
181
+ else:
182
+ raise TypeError(
183
+ f"list indices must be integers or slices, not {type(key).__name__}"
184
+ )
185
+
186
+ def insert(self, index: int, value):
187
+ """Insert ``value`` in the sequence before ``index``."""
188
+ pb_value = self._marshal.to_proto(self._pb_type, value)
189
+ self.pb.insert(index, pb_value)
evalkit_tf437/lib/python3.10/site-packages/proto/marshal/compat.py ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2018 Google LLC
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
+ # This file pulls in the container types from internal protocol buffers,
16
+ # and exports the types available.
17
+ #
18
+ # If the C extensions were not installed, then their container types will
19
+ # not be included.
20
+
21
+ from google.protobuf.internal import containers
22
+
23
+ # Import all message types to ensure that pyext types are recognized
24
+ # when upb types exist. Conda's protobuf defaults to pyext despite upb existing.
25
+ # See https://github.com/googleapis/proto-plus-python/issues/470
26
+ try:
27
+ from google._upb import _message as _message_upb
28
+ except ImportError:
29
+ _message_upb = None
30
+
31
+ try:
32
+ from google.protobuf.pyext import _message as _message_pyext
33
+ except ImportError:
34
+ _message_pyext = None
35
+
36
+
37
+ repeated_composite_types = (containers.RepeatedCompositeFieldContainer,)
38
+ repeated_scalar_types = (containers.RepeatedScalarFieldContainer,)
39
+ map_composite_types = (containers.MessageMap,)
40
+
41
+ # In `proto/marshal.py`, for compatibility with protobuf 5.x,
42
+ # we'll use `map_composite_type_names` to check whether
43
+ # the name of the class of a protobuf type is
44
+ # `MessageMapContainer`, and, if `True`, return a MapComposite.
45
+ # See https://github.com/protocolbuffers/protobuf/issues/16596
46
+ map_composite_type_names = ("MessageMapContainer",)
47
+
48
+ for message in [_message_upb, _message_pyext]:
49
+ if message:
50
+ repeated_composite_types += (message.RepeatedCompositeContainer,)
51
+ repeated_scalar_types += (message.RepeatedScalarContainer,)
52
+
53
+ try:
54
+ map_composite_types += (message.MessageMapContainer,)
55
+ except AttributeError:
56
+ # The `MessageMapContainer` attribute is not available in Protobuf 5.x+
57
+ pass
58
+
59
+ __all__ = (
60
+ "repeated_composite_types",
61
+ "repeated_scalar_types",
62
+ "map_composite_types",
63
+ "map_composite_type_names",
64
+ )
evalkit_tf437/lib/python3.10/site-packages/proto/marshal/marshal.py ADDED
@@ -0,0 +1,297 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2018 Google LLC
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
+ import abc
16
+ import enum
17
+
18
+ from google.protobuf import message
19
+ from google.protobuf import duration_pb2
20
+ from google.protobuf import timestamp_pb2
21
+ from google.protobuf import field_mask_pb2
22
+ from google.protobuf import struct_pb2
23
+ from google.protobuf import wrappers_pb2
24
+
25
+ from proto.marshal import compat
26
+ from proto.marshal.collections import MapComposite
27
+ from proto.marshal.collections import Repeated
28
+ from proto.marshal.collections import RepeatedComposite
29
+
30
+ from proto.marshal.rules import bytes as pb_bytes
31
+ from proto.marshal.rules import stringy_numbers
32
+ from proto.marshal.rules import dates
33
+ from proto.marshal.rules import struct
34
+ from proto.marshal.rules import wrappers
35
+ from proto.marshal.rules import field_mask
36
+ from proto.primitives import ProtoType
37
+
38
+
39
+ class Rule(abc.ABC):
40
+ """Abstract class definition for marshal rules."""
41
+
42
+ @classmethod
43
+ def __subclasshook__(cls, C):
44
+ if hasattr(C, "to_python") and hasattr(C, "to_proto"):
45
+ return True
46
+ return NotImplemented
47
+
48
+
49
+ class BaseMarshal:
50
+ """The base class to translate between protobuf and Python classes.
51
+
52
+ Protocol buffers defines many common types (e.g. Timestamp, Duration)
53
+ which also exist in the Python standard library. The marshal essentially
54
+ translates between these: it keeps a registry of common protocol buffers
55
+ and their Python representations, and translates back and forth.
56
+
57
+ The protocol buffer class is always the "key" in this relationship; when
58
+ presenting a message, the declared field types are used to determine
59
+ whether a value should be transformed into another class. Similarly,
60
+ when accepting a Python value (when setting a field, for example),
61
+ the declared field type is still used. This means that, if appropriate,
62
+ multiple protocol buffer types may use the same Python type.
63
+
64
+ The primary implementation of this is :class:`Marshal`, which should
65
+ usually be used instead of this class directly.
66
+ """
67
+
68
+ def __init__(self):
69
+ self._rules = {}
70
+ self._noop = NoopRule()
71
+ self.reset()
72
+
73
+ def register(self, proto_type: type, rule: Rule = None):
74
+ """Register a rule against the given ``proto_type``.
75
+
76
+ This function expects a ``proto_type`` (the descriptor class) and
77
+ a ``rule``; an object with a ``to_python`` and ``to_proto`` method.
78
+ Each method should return the appropriate Python or protocol buffer
79
+ type, and be idempotent (e.g. accept either type as input).
80
+
81
+ This function can also be used as a decorator::
82
+
83
+ @marshal.register(timestamp_pb2.Timestamp)
84
+ class TimestampRule:
85
+ ...
86
+
87
+ In this case, the class will be initialized for you with zero
88
+ arguments.
89
+
90
+ Args:
91
+ proto_type (type): A protocol buffer message type.
92
+ rule: A marshal object
93
+ """
94
+ # If a rule was provided, register it and be done.
95
+ if rule:
96
+ # Ensure the rule implements Rule.
97
+ if not isinstance(rule, Rule):
98
+ raise TypeError(
99
+ "Marshal rule instances must implement "
100
+ "`to_proto` and `to_python` methods."
101
+ )
102
+
103
+ # Register the rule.
104
+ self._rules[proto_type] = rule
105
+ return
106
+
107
+ # Create an inner function that will register an instance of the
108
+ # marshal class to this object's registry, and return it.
109
+ def register_rule_class(rule_class: type):
110
+ # Ensure the rule class is a valid rule.
111
+ if not issubclass(rule_class, Rule):
112
+ raise TypeError(
113
+ "Marshal rule subclasses must implement "
114
+ "`to_proto` and `to_python` methods."
115
+ )
116
+
117
+ # Register the rule class.
118
+ self._rules[proto_type] = rule_class()
119
+ return rule_class
120
+
121
+ return register_rule_class
122
+
123
+ def reset(self):
124
+ """Reset the registry to its initial state."""
125
+ self._rules.clear()
126
+
127
+ # Register date and time wrappers.
128
+ self.register(timestamp_pb2.Timestamp, dates.TimestampRule())
129
+ self.register(duration_pb2.Duration, dates.DurationRule())
130
+
131
+ # Register FieldMask wrappers.
132
+ self.register(field_mask_pb2.FieldMask, field_mask.FieldMaskRule())
133
+
134
+ # Register nullable primitive wrappers.
135
+ self.register(wrappers_pb2.BoolValue, wrappers.BoolValueRule())
136
+ self.register(wrappers_pb2.BytesValue, wrappers.BytesValueRule())
137
+ self.register(wrappers_pb2.DoubleValue, wrappers.DoubleValueRule())
138
+ self.register(wrappers_pb2.FloatValue, wrappers.FloatValueRule())
139
+ self.register(wrappers_pb2.Int32Value, wrappers.Int32ValueRule())
140
+ self.register(wrappers_pb2.Int64Value, wrappers.Int64ValueRule())
141
+ self.register(wrappers_pb2.StringValue, wrappers.StringValueRule())
142
+ self.register(wrappers_pb2.UInt32Value, wrappers.UInt32ValueRule())
143
+ self.register(wrappers_pb2.UInt64Value, wrappers.UInt64ValueRule())
144
+
145
+ # Register the google.protobuf.Struct wrappers.
146
+ #
147
+ # These are aware of the marshal that created them, because they
148
+ # create RepeatedComposite and MapComposite instances directly and
149
+ # need to pass the marshal to them.
150
+ self.register(struct_pb2.Value, struct.ValueRule(marshal=self))
151
+ self.register(struct_pb2.ListValue, struct.ListValueRule(marshal=self))
152
+ self.register(struct_pb2.Struct, struct.StructRule(marshal=self))
153
+
154
+ # Special case for bytes to allow base64 encode/decode
155
+ self.register(ProtoType.BYTES, pb_bytes.BytesRule())
156
+
157
+ # Special case for int64 from strings because of dict round trip.
158
+ # See https://github.com/protocolbuffers/protobuf/issues/2679
159
+ for rule_class in stringy_numbers.STRINGY_NUMBER_RULES:
160
+ self.register(rule_class._proto_type, rule_class())
161
+
162
+ def get_rule(self, proto_type):
163
+ # Rules are needed to convert values between proto-plus and pb.
164
+ # Retrieve the rule for the specified proto type.
165
+ # The NoopRule will be used when a rule is not found.
166
+ rule = self._rules.get(proto_type, self._noop)
167
+
168
+ # If we don't find a rule, also check under `_instances`
169
+ # in case there is a rule in another package.
170
+ # See https://github.com/googleapis/proto-plus-python/issues/349
171
+ if rule == self._noop and hasattr(self, "_instances"):
172
+ for _, instance in self._instances.items():
173
+ rule = instance._rules.get(proto_type, self._noop)
174
+ if rule != self._noop:
175
+ break
176
+ return rule
177
+
178
+ def to_python(self, proto_type, value, *, absent: bool = None):
179
+ # Internal protobuf has its own special type for lists of values.
180
+ # Return a view around it that implements MutableSequence.
181
+ value_type = type(value) # Minor performance boost over isinstance
182
+ if value_type in compat.repeated_composite_types:
183
+ return RepeatedComposite(value, marshal=self)
184
+ if value_type in compat.repeated_scalar_types:
185
+ if isinstance(proto_type, type):
186
+ return RepeatedComposite(value, marshal=self, proto_type=proto_type)
187
+ else:
188
+ return Repeated(value, marshal=self)
189
+
190
+ # Same thing for maps of messages.
191
+ # See https://github.com/protocolbuffers/protobuf/issues/16596
192
+ # We need to look up the name of the type in compat.map_composite_type_names
193
+ # as class `MessageMapContainer` is no longer exposed
194
+ # This is done to avoid taking a breaking change in proto-plus.
195
+ if (
196
+ value_type in compat.map_composite_types
197
+ or value_type.__name__ in compat.map_composite_type_names
198
+ ):
199
+ return MapComposite(value, marshal=self)
200
+ return self.get_rule(proto_type=proto_type).to_python(value, absent=absent)
201
+
202
+ def to_proto(self, proto_type, value, *, strict: bool = False):
203
+ # The protos in google/protobuf/struct.proto are exceptional cases,
204
+ # because they can and should represent themselves as lists and dicts.
205
+ # These cases are handled in their rule classes.
206
+ if proto_type not in (
207
+ struct_pb2.Value,
208
+ struct_pb2.ListValue,
209
+ struct_pb2.Struct,
210
+ ):
211
+ # For our repeated and map view objects, simply return the
212
+ # underlying pb.
213
+ if isinstance(value, (Repeated, MapComposite)):
214
+ return value.pb
215
+
216
+ # Convert lists and tuples recursively.
217
+ if isinstance(value, (list, tuple)):
218
+ return type(value)(self.to_proto(proto_type, i) for i in value)
219
+
220
+ # Convert dictionaries recursively when the proto type is a map.
221
+ # This is slightly more complicated than converting a list or tuple
222
+ # because we have to step through the magic that protocol buffers does.
223
+ #
224
+ # Essentially, a type of map<string, Foo> will show up here as
225
+ # a FoosEntry with a `key` field, `value` field, and a `map_entry`
226
+ # annotation. We need to do the conversion based on the `value`
227
+ # field's type.
228
+ if isinstance(value, dict) and (
229
+ proto_type.DESCRIPTOR.has_options
230
+ and proto_type.DESCRIPTOR.GetOptions().map_entry
231
+ ):
232
+ recursive_type = type(proto_type().value)
233
+ return {k: self.to_proto(recursive_type, v) for k, v in value.items()}
234
+
235
+ pb_value = self.get_rule(proto_type=proto_type).to_proto(value)
236
+
237
+ # Sanity check: If we are in strict mode, did we get the value we want?
238
+ if strict and not isinstance(pb_value, proto_type):
239
+ raise TypeError(
240
+ "Parameter must be instance of the same class; "
241
+ "expected {expected}, got {got}".format(
242
+ expected=proto_type.__name__,
243
+ got=pb_value.__class__.__name__,
244
+ ),
245
+ )
246
+ # Return the final value.
247
+ return pb_value
248
+
249
+
250
+ class Marshal(BaseMarshal):
251
+ """The translator between protocol buffer and Python instances.
252
+
253
+ The bulk of the implementation is in :class:`BaseMarshal`. This class
254
+ adds identity tracking: multiple instantiations of :class:`Marshal` with
255
+ the same name will provide the same instance.
256
+ """
257
+
258
+ _instances = {}
259
+
260
+ def __new__(cls, *, name: str):
261
+ """Create a marshal instance.
262
+
263
+ Args:
264
+ name (str): The name of the marshal. Instantiating multiple
265
+ marshals with the same ``name`` argument will provide the
266
+ same marshal each time.
267
+ """
268
+ klass = cls._instances.get(name)
269
+ if klass is None:
270
+ klass = cls._instances[name] = super().__new__(cls)
271
+
272
+ return klass
273
+
274
+ def __init__(self, *, name: str):
275
+ """Instantiate a marshal.
276
+
277
+ Args:
278
+ name (str): The name of the marshal. Instantiating multiple
279
+ marshals with the same ``name`` argument will provide the
280
+ same marshal each time.
281
+ """
282
+ self._name = name
283
+ if not hasattr(self, "_rules"):
284
+ super().__init__()
285
+
286
+
287
+ class NoopRule:
288
+ """A catch-all rule that does nothing."""
289
+
290
+ def to_python(self, pb_value, *, absent: bool = None):
291
+ return pb_value
292
+
293
+ def to_proto(self, value):
294
+ return value
295
+
296
+
297
+ __all__ = ("Marshal",)
evalkit_tf437/lib/python3.10/site-packages/proto/marshal/rules/__init__.py ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2018 Google LLC
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.
evalkit_tf437/lib/python3.10/site-packages/proto/marshal/rules/__pycache__/enums.cpython-310.pyc ADDED
Binary file (1.23 kB). View file
 
evalkit_tf437/lib/python3.10/site-packages/proto/marshal/rules/__pycache__/field_mask.cpython-310.pyc ADDED
Binary file (1.04 kB). View file
 
evalkit_tf437/lib/python3.10/site-packages/proto/marshal/rules/__pycache__/message.cpython-310.pyc ADDED
Binary file (1.44 kB). View file
 
evalkit_tf437/lib/python3.10/site-packages/proto/marshal/rules/__pycache__/stringy_numbers.cpython-310.pyc ADDED
Binary file (1.94 kB). View file
 
evalkit_tf437/lib/python3.10/site-packages/proto/marshal/rules/__pycache__/struct.cpython-310.pyc ADDED
Binary file (4.37 kB). View file