1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
2303
��EY�| � + @ s� d Z ddddddddd d
dgZydd
lmZ W n ek
rB Y nX ddlmZ ddlmZ ddl m
Z
ddlmZ ddl
mZ yddlmZ W n" ek
r� G dd� d�ZY nX dZZd[Zeefdd�Zeefdd�Zefdd�Zefd d!�Zefd"d#�Zefd$d%�Zefd&d'�Zefd(d)�Zefd*d+�Zefd,d-�Zefd.d/�Zefd0d1�Zefd2d3�Z efd4d5�Z!d6efd7efd8efgd8efd9efd6efgd9efd8efd7efgd7efd6e fd9e!fgd:�Z"d;d� Z#d<d� Z$ydd=lm$Z$ W n ek
�r� Y nX G d>d � d �Z%ydd?lm%Z% W n ek
�r* Y nX G d@d
� d
e&�Z'edAdBdCdDdEg�Z(G dFdG� dGe)�Z*e&� fe+e,e-e.dH�he/e.e0fdIdJ�Z1d\dMd�Z2dNdO� Z3yddPlm3Z3 W n ek
�r� Y nX dQdR� Z4d]dSdT�Z5dUdV� Z6dWdX� Z7dYd� Z8dHS )^zEfunctools.py - Tools for working with functions and callable objects
�update_wrapper�wraps�WRAPPER_ASSIGNMENTS�WRAPPER_UPDATES�total_ordering�
cmp_to_key� lru_cache�reduce�partial�
partialmethod�singledispatch� )r )�get_cache_token)�
namedtuple)�MappingProxyType)�WeakKeyDictionary)�recursive_repr)�RLockc @ s e Zd ZdZdd� Zdd� ZdS )r z/Dummy reentrant lock for builds without threadsc C s d S )N� )�selfr r �:D:\Robbie\Documents\dev\sm-ai-search\venv\lib\functools.py� __enter__ s zRLock.__enter__c C s d S )Nr )r ZexctypeZexcinstZexctbr r r �__exit__ s zRLock.__exit__N)�__name__�
__module__�__qualname__�__doc__r r r r r r r s r r r r r �__annotations__�__dict__c
C sn x<|D ]4}yt ||�}W n tk
r, Y qX t| ||� qW x$|D ]}t | |�jt ||i �� qDW || _| S )a Update a wrapper function to look like the wrapped function
wrapper is the function to be updated
wrapped is the original function
assigned is a tuple naming the attributes assigned directly
from the wrapped function to the wrapper function (defaults to
functools.WRAPPER_ASSIGNMENTS)
updated is a tuple naming the attributes of the wrapper that
are updated with the corresponding attribute from the wrapped
function (defaults to functools.WRAPPER_UPDATES)
)�getattr�AttributeError�setattr�updateZ__wrapped__)�wrapper�wrapped�assigned�updated�attr�valuer r r r , s
c C s t t| ||d�S )a� Decorator factory to apply update_wrapper() to a wrapper function
Returns a decorator that invokes update_wrapper() with the decorated
function as the wrapper argument and the arguments to wraps() as the
remaining arguments. Default arguments are as for update_wrapper().
This is a convenience function to simplify applying partial() to
update_wrapper().
)r# r$ r% )r r )r# r$ r% r r r r J s c C s$ | j |�}||kr|S | o"| |kS )zIReturn a > b. Computed by @total_ordering from (not a < b) and (a != b).)�__lt__)r �other�NotImplemented� op_resultr r r �_gt_from_ltb s
r, c C s | j |�}|p| |kS )zEReturn a <= b. Computed by @total_ordering from (a < b) or (a == b).)r( )r r) r* r+ r r r �_le_from_lti s
r- c C s | j |�}||kr|S | S )z=Return a >= b. Computed by @total_ordering from (not a < b).)r( )r r) r* r+ r r r �_ge_from_ltn s
r. c C s$ | j |�}||kr|S | p"| |kS )zJReturn a >= b. Computed by @total_ordering from (not a <= b) or (a == b).)�__le__)r r) r* r+ r r r �_ge_from_leu s
r0 c C s"