1
- # coding=utf-8
2
- from __future__ import unicode_literals
3
1
import re
4
2
import sys
5
3
import json
6
- import six
7
4
8
5
9
6
def to_json (value , fn = None ):
@@ -44,7 +41,7 @@ def scalars_equal(node1, node2, ignored_fields):
44
41
return node1 == node2
45
42
46
43
47
- class BaseNode ( object ) :
44
+ class BaseNode :
48
45
"""Base class for all Fluent AST nodes.
49
46
50
47
All productions described in the ASDL subclass BaseNode, including Span and
@@ -125,7 +122,7 @@ class SyntaxNode(BaseNode):
125
122
"""Base class for AST nodes which can have Spans."""
126
123
127
124
def __init__ (self , span = None , ** kwargs ):
128
- super (SyntaxNode , self ).__init__ (** kwargs )
125
+ super ().__init__ (** kwargs )
129
126
self .span = span
130
127
131
128
def add_span (self , start , end ):
@@ -134,7 +131,7 @@ def add_span(self, start, end):
134
131
135
132
class Resource (SyntaxNode ):
136
133
def __init__ (self , body = None , ** kwargs ):
137
- super (Resource , self ).__init__ (** kwargs )
134
+ super ().__init__ (** kwargs )
138
135
self .body = body or []
139
136
140
137
@@ -145,7 +142,7 @@ class Entry(SyntaxNode):
145
142
class Message (Entry ):
146
143
def __init__ (self , id , value = None , attributes = None ,
147
144
comment = None , ** kwargs ):
148
- super (Message , self ).__init__ (** kwargs )
145
+ super ().__init__ (** kwargs )
149
146
self .id = id
150
147
self .value = value
151
148
self .attributes = attributes or []
@@ -155,7 +152,7 @@ def __init__(self, id, value=None, attributes=None,
155
152
class Term (Entry ):
156
153
def __init__ (self , id , value , attributes = None ,
157
154
comment = None , ** kwargs ):
158
- super (Term , self ).__init__ (** kwargs )
155
+ super ().__init__ (** kwargs )
159
156
self .id = id
160
157
self .value = value
161
158
self .attributes = attributes or []
@@ -164,7 +161,7 @@ def __init__(self, id, value, attributes=None,
164
161
165
162
class Pattern (SyntaxNode ):
166
163
def __init__ (self , elements , ** kwargs ):
167
- super (Pattern , self ).__init__ (** kwargs )
164
+ super ().__init__ (** kwargs )
168
165
self .elements = elements
169
166
170
167
@@ -174,13 +171,13 @@ class PatternElement(SyntaxNode):
174
171
175
172
class TextElement (PatternElement ):
176
173
def __init__ (self , value , ** kwargs ):
177
- super (TextElement , self ).__init__ (** kwargs )
174
+ super ().__init__ (** kwargs )
178
175
self .value = value
179
176
180
177
181
178
class Placeable (PatternElement ):
182
179
def __init__ (self , expression , ** kwargs ):
183
- super (Placeable , self ).__init__ (** kwargs )
180
+ super ().__init__ (** kwargs )
184
181
self .expression = expression
185
182
186
183
@@ -191,7 +188,7 @@ class Expression(SyntaxNode):
191
188
class Literal (Expression ):
192
189
"""An abstract base class for literals."""
193
190
def __init__ (self , value , ** kwargs ):
194
- super (Literal , self ).__init__ (** kwargs )
191
+ super ().__init__ (** kwargs )
195
192
self .value = value
196
193
197
194
def parse (self ):
@@ -206,7 +203,7 @@ def from_escape_sequence(matchobj):
206
203
return c
207
204
codepoint = int (codepoint4 or codepoint6 , 16 )
208
205
if codepoint <= 0xD7FF or 0xE000 <= codepoint :
209
- return six . unichr (codepoint )
206
+ return chr (codepoint )
210
207
# Escape sequences reresenting surrogate code points are
211
208
# well-formed but invalid in Fluent. Replace them with U+FFFD
212
209
# REPLACEMENT CHARACTER.
@@ -235,98 +232,98 @@ def parse(self):
235
232
236
233
class MessageReference (Expression ):
237
234
def __init__ (self , id , attribute = None , ** kwargs ):
238
- super (MessageReference , self ).__init__ (** kwargs )
235
+ super ().__init__ (** kwargs )
239
236
self .id = id
240
237
self .attribute = attribute
241
238
242
239
243
240
class TermReference (Expression ):
244
241
def __init__ (self , id , attribute = None , arguments = None , ** kwargs ):
245
- super (TermReference , self ).__init__ (** kwargs )
242
+ super ().__init__ (** kwargs )
246
243
self .id = id
247
244
self .attribute = attribute
248
245
self .arguments = arguments
249
246
250
247
251
248
class VariableReference (Expression ):
252
249
def __init__ (self , id , ** kwargs ):
253
- super (VariableReference , self ).__init__ (** kwargs )
250
+ super ().__init__ (** kwargs )
254
251
self .id = id
255
252
256
253
257
254
class FunctionReference (Expression ):
258
255
def __init__ (self , id , arguments , ** kwargs ):
259
- super (FunctionReference , self ).__init__ (** kwargs )
256
+ super ().__init__ (** kwargs )
260
257
self .id = id
261
258
self .arguments = arguments
262
259
263
260
264
261
class SelectExpression (Expression ):
265
262
def __init__ (self , selector , variants , ** kwargs ):
266
- super (SelectExpression , self ).__init__ (** kwargs )
263
+ super ().__init__ (** kwargs )
267
264
self .selector = selector
268
265
self .variants = variants
269
266
270
267
271
268
class CallArguments (SyntaxNode ):
272
269
def __init__ (self , positional = None , named = None , ** kwargs ):
273
- super (CallArguments , self ).__init__ (** kwargs )
270
+ super ().__init__ (** kwargs )
274
271
self .positional = [] if positional is None else positional
275
272
self .named = [] if named is None else named
276
273
277
274
278
275
class Attribute (SyntaxNode ):
279
276
def __init__ (self , id , value , ** kwargs ):
280
- super (Attribute , self ).__init__ (** kwargs )
277
+ super ().__init__ (** kwargs )
281
278
self .id = id
282
279
self .value = value
283
280
284
281
285
282
class Variant (SyntaxNode ):
286
283
def __init__ (self , key , value , default = False , ** kwargs ):
287
- super (Variant , self ).__init__ (** kwargs )
284
+ super ().__init__ (** kwargs )
288
285
self .key = key
289
286
self .value = value
290
287
self .default = default
291
288
292
289
293
290
class NamedArgument (SyntaxNode ):
294
291
def __init__ (self , name , value , ** kwargs ):
295
- super (NamedArgument , self ).__init__ (** kwargs )
292
+ super ().__init__ (** kwargs )
296
293
self .name = name
297
294
self .value = value
298
295
299
296
300
297
class Identifier (SyntaxNode ):
301
298
def __init__ (self , name , ** kwargs ):
302
- super (Identifier , self ).__init__ (** kwargs )
299
+ super ().__init__ (** kwargs )
303
300
self .name = name
304
301
305
302
306
303
class BaseComment (Entry ):
307
304
def __init__ (self , content = None , ** kwargs ):
308
- super (BaseComment , self ).__init__ (** kwargs )
305
+ super ().__init__ (** kwargs )
309
306
self .content = content
310
307
311
308
312
309
class Comment (BaseComment ):
313
310
def __init__ (self , content = None , ** kwargs ):
314
- super (Comment , self ).__init__ (content , ** kwargs )
311
+ super ().__init__ (content , ** kwargs )
315
312
316
313
317
314
class GroupComment (BaseComment ):
318
315
def __init__ (self , content = None , ** kwargs ):
319
- super (GroupComment , self ).__init__ (content , ** kwargs )
316
+ super ().__init__ (content , ** kwargs )
320
317
321
318
322
319
class ResourceComment (BaseComment ):
323
320
def __init__ (self , content = None , ** kwargs ):
324
- super (ResourceComment , self ).__init__ (content , ** kwargs )
321
+ super ().__init__ (content , ** kwargs )
325
322
326
323
327
324
class Junk (SyntaxNode ):
328
325
def __init__ (self , content = None , annotations = None , ** kwargs ):
329
- super (Junk , self ).__init__ (** kwargs )
326
+ super ().__init__ (** kwargs )
330
327
self .content = content
331
328
self .annotations = annotations or []
332
329
@@ -336,14 +333,14 @@ def add_annotation(self, annot):
336
333
337
334
class Span (BaseNode ):
338
335
def __init__ (self , start , end , ** kwargs ):
339
- super (Span , self ).__init__ (** kwargs )
336
+ super ().__init__ (** kwargs )
340
337
self .start = start
341
338
self .end = end
342
339
343
340
344
341
class Annotation (SyntaxNode ):
345
342
def __init__ (self , code , arguments = None , message = None , ** kwargs ):
346
- super (Annotation , self ).__init__ (** kwargs )
343
+ super ().__init__ (** kwargs )
347
344
self .code = code
348
345
self .arguments = arguments or []
349
346
self .message = message
0 commit comments