gobject-introspection 2.0.2-x86-mingw32 → 2.0.3-x86-mingw32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. checksums.yaml +7 -0
  2. data/Rakefile +5 -2
  3. data/ext/gobject-introspection/rb-gi-argument.c +215 -4
  4. data/ext/gobject-introspection/rb-gi-loader.c +7 -2
  5. data/ext/gobject-introspection/rb-gi-struct-info.c +1 -1
  6. data/lib/1.9/gobject_introspection.so +0 -0
  7. data/lib/2.0/gobject_introspection.so +0 -0
  8. data/test/test-function-info.rb +3 -1
  9. data/vendor/local/bin/g-ir-compiler.exe +0 -0
  10. data/vendor/local/bin/g-ir-generate.exe +0 -0
  11. data/vendor/local/bin/libgirepository-1.0-1.dll +0 -0
  12. data/vendor/local/lib/girepository-1.0/DBus-1.0.typelib +0 -0
  13. data/vendor/local/lib/girepository-1.0/DBusGLib-1.0.typelib +0 -0
  14. data/vendor/local/lib/girepository-1.0/GIRepository-2.0.typelib +0 -0
  15. data/vendor/local/lib/girepository-1.0/GLib-2.0.typelib +0 -0
  16. data/vendor/local/lib/girepository-1.0/GModule-2.0.typelib +0 -0
  17. data/vendor/local/lib/girepository-1.0/GObject-2.0.typelib +0 -0
  18. data/vendor/local/lib/girepository-1.0/Gio-2.0.typelib +0 -0
  19. data/vendor/local/lib/girepository-1.0/win32-1.0.typelib +0 -0
  20. data/vendor/local/lib/gobject-introspection/giscanner/__init__.pyc +0 -0
  21. data/vendor/local/lib/gobject-introspection/giscanner/__init__.pyo +0 -0
  22. data/vendor/local/lib/gobject-introspection/giscanner/annotationmain.py +1 -0
  23. data/vendor/local/lib/gobject-introspection/giscanner/annotationmain.pyc +0 -0
  24. data/vendor/local/lib/gobject-introspection/giscanner/annotationmain.pyo +0 -0
  25. data/vendor/local/lib/gobject-introspection/giscanner/annotationparser.py +52 -47
  26. data/vendor/local/lib/gobject-introspection/giscanner/annotationparser.pyc +0 -0
  27. data/vendor/local/lib/gobject-introspection/giscanner/annotationparser.pyo +0 -0
  28. data/vendor/local/lib/gobject-introspection/giscanner/ast.py +48 -42
  29. data/vendor/local/lib/gobject-introspection/giscanner/ast.pyc +0 -0
  30. data/vendor/local/lib/gobject-introspection/giscanner/ast.pyo +0 -0
  31. data/vendor/local/lib/gobject-introspection/giscanner/cachestore.py +11 -10
  32. data/vendor/local/lib/gobject-introspection/giscanner/cachestore.pyc +0 -0
  33. data/vendor/local/lib/gobject-introspection/giscanner/cachestore.pyo +0 -0
  34. data/vendor/local/lib/gobject-introspection/giscanner/codegen.py +7 -5
  35. data/vendor/local/lib/gobject-introspection/giscanner/codegen.pyc +0 -0
  36. data/vendor/local/lib/gobject-introspection/giscanner/codegen.pyo +0 -0
  37. data/vendor/local/lib/gobject-introspection/giscanner/collections/__init__.py +22 -0
  38. data/vendor/local/lib/gobject-introspection/giscanner/collections/__init__.pyc +0 -0
  39. data/vendor/local/lib/gobject-introspection/giscanner/collections/__init__.pyo +0 -0
  40. data/vendor/local/lib/gobject-introspection/giscanner/collections/ordereddict.py +120 -0
  41. data/vendor/local/lib/gobject-introspection/giscanner/collections/ordereddict.pyc +0 -0
  42. data/vendor/local/lib/gobject-introspection/giscanner/collections/ordereddict.pyo +0 -0
  43. data/vendor/local/lib/gobject-introspection/giscanner/docmain.py +14 -2
  44. data/vendor/local/lib/gobject-introspection/giscanner/docmain.pyc +0 -0
  45. data/vendor/local/lib/gobject-introspection/giscanner/docmain.pyo +0 -0
  46. data/vendor/local/lib/gobject-introspection/giscanner/docwriter.py +19 -10
  47. data/vendor/local/lib/gobject-introspection/giscanner/docwriter.pyc +0 -0
  48. data/vendor/local/lib/gobject-introspection/giscanner/docwriter.pyo +0 -0
  49. data/vendor/local/lib/gobject-introspection/giscanner/dumper.py +18 -11
  50. data/vendor/local/lib/gobject-introspection/giscanner/dumper.pyc +0 -0
  51. data/vendor/local/lib/gobject-introspection/giscanner/dumper.pyo +0 -0
  52. data/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.py +10 -13
  53. data/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyc +0 -0
  54. data/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyo +0 -0
  55. data/vendor/local/lib/gobject-introspection/giscanner/girparser.py +24 -30
  56. data/vendor/local/lib/gobject-introspection/giscanner/girparser.pyc +0 -0
  57. data/vendor/local/lib/gobject-introspection/giscanner/girparser.pyo +0 -0
  58. data/vendor/local/lib/gobject-introspection/giscanner/girwriter.py +11 -12
  59. data/vendor/local/lib/gobject-introspection/giscanner/girwriter.pyc +0 -0
  60. data/vendor/local/lib/gobject-introspection/giscanner/girwriter.pyo +0 -0
  61. data/vendor/local/lib/gobject-introspection/giscanner/introspectablepass.py +25 -21
  62. data/vendor/local/lib/gobject-introspection/giscanner/introspectablepass.pyc +0 -0
  63. data/vendor/local/lib/gobject-introspection/giscanner/introspectablepass.pyo +0 -0
  64. data/vendor/local/lib/gobject-introspection/giscanner/libtoolimporter.py +1 -1
  65. data/vendor/local/lib/gobject-introspection/giscanner/libtoolimporter.pyc +0 -0
  66. data/vendor/local/lib/gobject-introspection/giscanner/libtoolimporter.pyo +0 -0
  67. data/vendor/local/lib/gobject-introspection/giscanner/maintransformer.py +98 -100
  68. data/vendor/local/lib/gobject-introspection/giscanner/maintransformer.pyc +0 -0
  69. data/vendor/local/lib/gobject-introspection/giscanner/maintransformer.pyo +0 -0
  70. data/vendor/local/lib/gobject-introspection/giscanner/message.py +10 -8
  71. data/vendor/local/lib/gobject-introspection/giscanner/message.pyc +0 -0
  72. data/vendor/local/lib/gobject-introspection/giscanner/message.pyo +0 -0
  73. data/vendor/local/lib/gobject-introspection/giscanner/scannermain.py +28 -16
  74. data/vendor/local/lib/gobject-introspection/giscanner/scannermain.pyc +0 -0
  75. data/vendor/local/lib/gobject-introspection/giscanner/scannermain.pyo +0 -0
  76. data/vendor/local/lib/gobject-introspection/giscanner/sectionparser.py +83 -9
  77. data/vendor/local/lib/gobject-introspection/giscanner/sectionparser.pyc +0 -0
  78. data/vendor/local/lib/gobject-introspection/giscanner/sectionparser.pyo +0 -0
  79. data/vendor/local/lib/gobject-introspection/giscanner/shlibs.py +5 -1
  80. data/vendor/local/lib/gobject-introspection/giscanner/shlibs.pyc +0 -0
  81. data/vendor/local/lib/gobject-introspection/giscanner/shlibs.pyo +0 -0
  82. data/vendor/local/lib/gobject-introspection/giscanner/sourcescanner.py +20 -21
  83. data/vendor/local/lib/gobject-introspection/giscanner/sourcescanner.pyc +0 -0
  84. data/vendor/local/lib/gobject-introspection/giscanner/sourcescanner.pyo +0 -0
  85. data/vendor/local/lib/gobject-introspection/giscanner/testcodegen.py +3 -0
  86. data/vendor/local/lib/gobject-introspection/giscanner/testcodegen.pyc +0 -0
  87. data/vendor/local/lib/gobject-introspection/giscanner/testcodegen.pyo +0 -0
  88. data/vendor/local/lib/gobject-introspection/giscanner/transformer.py +32 -41
  89. data/vendor/local/lib/gobject-introspection/giscanner/transformer.pyc +0 -0
  90. data/vendor/local/lib/gobject-introspection/giscanner/transformer.pyo +0 -0
  91. data/vendor/local/lib/gobject-introspection/giscanner/utils.py +9 -0
  92. data/vendor/local/lib/gobject-introspection/giscanner/utils.pyc +0 -0
  93. data/vendor/local/lib/gobject-introspection/giscanner/utils.pyo +0 -0
  94. data/vendor/local/lib/gobject-introspection/giscanner/xmlwriter.py +9 -11
  95. data/vendor/local/lib/gobject-introspection/giscanner/xmlwriter.pyc +0 -0
  96. data/vendor/local/lib/gobject-introspection/giscanner/xmlwriter.pyo +0 -0
  97. data/vendor/local/lib/libgirepository-1.0.a +0 -0
  98. data/vendor/local/lib/libgirepository-1.0.dll.a +0 -0
  99. data/vendor/local/lib/libgirepository-1.0.la +1 -1
  100. data/vendor/local/lib/pkgconfig/gobject-introspection-1.0.pc +1 -1
  101. data/vendor/local/lib/pkgconfig/gobject-introspection-no-export-1.0.pc +1 -1
  102. data/vendor/local/share/gir-1.0/GIRepository-2.0.gir +691 -691
  103. data/vendor/local/share/gir-1.0/GLib-2.0.gir +6972 -6467
  104. data/vendor/local/share/gir-1.0/GModule-2.0.gir +103 -4
  105. data/vendor/local/share/gir-1.0/GObject-2.0.gir +2085 -1955
  106. data/vendor/local/share/gir-1.0/Gio-2.0.gir +10955 -9269
  107. data/vendor/local/share/gir-1.0/win32-1.0.gir +19 -0
  108. data/vendor/local/share/gobject-introspection-1.0/Makefile.introspection +2 -2
  109. data/vendor/local/share/gobject-introspection-1.0/gdump.c +7 -2
  110. data/vendor/local/share/gobject-introspection-1.0/tests/annotation.c +15 -15
  111. data/vendor/local/share/gobject-introspection-1.0/tests/annotation.h +1 -1
  112. data/vendor/local/share/gobject-introspection-1.0/tests/gimarshallingtests.c +14 -0
  113. data/vendor/local/share/gobject-introspection-1.0/tests/gimarshallingtests.h +2 -2
  114. data/vendor/local/share/gobject-introspection-1.0/tests/regress.c +8 -0
  115. data/vendor/local/share/gobject-introspection-1.0/tests/regress.h +9 -0
  116. metadata +20 -21
  117. data/vendor/local/lib/gobject-introspection/giscanner/odict.py +0 -50
  118. data/vendor/local/lib/gobject-introspection/giscanner/odict.pyc +0 -0
  119. data/vendor/local/lib/gobject-introspection/giscanner/odict.pyo +0 -0
@@ -26,7 +26,7 @@
26
26
  import re
27
27
 
28
28
  from . import message
29
- from .odict import odict
29
+ from .collections import OrderedDict
30
30
 
31
31
 
32
32
  # GTK-Doc comment block parts
@@ -141,7 +141,8 @@ OPT_TRANSFER_FLOATING = 'floating'
141
141
  # Program matching the start of a comment block.
142
142
  #
143
143
  # Results in 0 symbolic groups.
144
- COMMENT_START_RE = re.compile(r'''
144
+ COMMENT_START_RE = re.compile(
145
+ r'''
145
146
  ^ # start
146
147
  [^\S\n\r]* # 0 or more whitespace characters
147
148
  / # 1 forward slash character
@@ -157,7 +158,8 @@ COMMENT_START_RE = re.compile(r'''
157
158
  #
158
159
  # Results in 1 symbolic group:
159
160
  # - group 1 = description
160
- COMMENT_END_RE = re.compile(r'''
161
+ COMMENT_END_RE = re.compile(
162
+ r'''
161
163
  ^ # start
162
164
  [^\S\n\r]* # 0 or more whitespace characters
163
165
  (?P<description>.*?) # description text
@@ -173,7 +175,8 @@ COMMENT_END_RE = re.compile(r'''
173
175
  # line inside a comment block.
174
176
  #
175
177
  # Results in 0 symbolic groups.
176
- COMMENT_ASTERISK_RE = re.compile(r'''
178
+ COMMENT_ASTERISK_RE = re.compile(
179
+ r'''
177
180
  ^ # start
178
181
  [^\S\n\r]* # 0 or more whitespace characters
179
182
  \* # 1 asterisk character
@@ -189,7 +192,8 @@ COMMENT_ASTERISK_RE = re.compile(r'''
189
192
  #
190
193
  # Results in 1 symbolic group:
191
194
  # - group 1 = indentation
192
- COMMENT_INDENTATION_RE = re.compile(r'''
195
+ COMMENT_INDENTATION_RE = re.compile(
196
+ r'''
193
197
  ^
194
198
  (?P<indentation>[^\S\n\r]*) # 0 or more whitespace characters
195
199
  .*
@@ -200,7 +204,8 @@ COMMENT_INDENTATION_RE = re.compile(r'''
200
204
  # Program matching an empty line.
201
205
  #
202
206
  # Results in 0 symbolic groups.
203
- EMPTY_LINE_RE = re.compile(r'''
207
+ EMPTY_LINE_RE = re.compile(
208
+ r'''
204
209
  ^ # start
205
210
  [^\S\n\r]* # 0 or more whitespace characters
206
211
  $ # end
@@ -212,7 +217,8 @@ EMPTY_LINE_RE = re.compile(r'''
212
217
  # Results in 2 symbolic groups:
213
218
  # - group 1 = colon
214
219
  # - group 2 = section_name
215
- SECTION_RE = re.compile(r'''
220
+ SECTION_RE = re.compile(
221
+ r'''
216
222
  ^ # start
217
223
  [^\S\n\r]* # 0 or more whitespace characters
218
224
  SECTION # SECTION
@@ -231,7 +237,8 @@ SECTION_RE = re.compile(r'''
231
237
  # - group 1 = symbol_name
232
238
  # - group 2 = colon
233
239
  # - group 3 = annotations
234
- SYMBOL_RE = re.compile(r'''
240
+ SYMBOL_RE = re.compile(
241
+ r'''
235
242
  ^ # start
236
243
  [^\S\n\r]* # 0 or more whitespace characters
237
244
  (?P<symbol_name>[\w-]*\w) # symbol name
@@ -251,7 +258,8 @@ SYMBOL_RE = re.compile(r'''
251
258
  # - group 2 = property_name
252
259
  # - group 3 = colon
253
260
  # - group 4 = annotations
254
- PROPERTY_RE = re.compile(r'''
261
+ PROPERTY_RE = re.compile(
262
+ r'''
255
263
  ^ # start
256
264
  [^\S\n\r]* # 0 or more whitespace characters
257
265
  (?P<class_name>[\w]+) # class name
@@ -275,7 +283,8 @@ PROPERTY_RE = re.compile(r'''
275
283
  # - group 2 = signal_name
276
284
  # - group 3 = colon
277
285
  # - group 4 = annotations
278
- SIGNAL_RE = re.compile(r'''
286
+ SIGNAL_RE = re.compile(
287
+ r'''
279
288
  ^ # start
280
289
  [^\S\n\r]* # 0 or more whitespace characters
281
290
  (?P<class_name>[\w]+) # class name
@@ -299,7 +308,8 @@ SIGNAL_RE = re.compile(r'''
299
308
  # - group 2 = annotations
300
309
  # - group 3 = colon
301
310
  # - group 4 = description
302
- PARAMETER_RE = re.compile(r'''
311
+ PARAMETER_RE = re.compile(
312
+ r'''
303
313
  ^ # start
304
314
  [^\S\n\r]* # 0 or more whitespace characters
305
315
  @ # @ character
@@ -324,7 +334,8 @@ PARAMETER_RE = re.compile(r'''
324
334
  # - group 3 = colon
325
335
  # - group 4 = description
326
336
  _all_tags = '|'.join(_ALL_TAGS).replace(' ', '\\ ')
327
- TAG_RE = re.compile(r'''
337
+ TAG_RE = re.compile(
338
+ r'''
328
339
  ^ # start
329
340
  [^\S\n\r]* # 0 or more whitespace characters
330
341
  (?P<tag_name>''' + _all_tags + r''') # tag name
@@ -348,7 +359,8 @@ TAG_RE = re.compile(r'''
348
359
  # - group 2 = annotations
349
360
  # - group 3 = colon
350
361
  # - group 4 = description
351
- MULTILINE_ANNOTATION_CONTINUATION_RE = re.compile(r'''
362
+ MULTILINE_ANNOTATION_CONTINUATION_RE = re.compile(
363
+ r'''
352
364
  ^ # start
353
365
  [^\S\n\r]* # 0 or more whitespace characters
354
366
  (?P<annotations>(?:\(.*?\)[^\S\n\r]*)*) # annotations
@@ -367,9 +379,9 @@ class DocBlock(object):
367
379
  self.name = name
368
380
  self.options = DocOptions()
369
381
  self.value = None
370
- self.tags = odict()
382
+ self.tags = OrderedDict()
371
383
  self.comment = None
372
- self.params = odict()
384
+ self.params = OrderedDict()
373
385
  self.position = None
374
386
 
375
387
  def __cmp__(self, other):
@@ -378,12 +390,6 @@ class DocBlock(object):
378
390
  def __repr__(self):
379
391
  return '<DocBlock %r %r>' % (self.name, self.options)
380
392
 
381
- def get_tag(self, name):
382
- return self.tags.get(name)
383
-
384
- def get_param(self, name):
385
- return self.params.get(name)
386
-
387
393
  def to_gtk_doc(self):
388
394
  options = ''
389
395
  if self.options:
@@ -450,8 +456,8 @@ class DocTag(object):
450
456
  s = 'one value'
451
457
  else:
452
458
  s = '%d values' % (n_params, )
453
- if ((n_params > 0 and (value is None or value.length() != n_params)) or
454
- n_params == 0 and value is not None):
459
+ if ((n_params > 0 and (value is None or value.length() != n_params))
460
+ or n_params == 0 and value is not None):
455
461
  if value is None:
456
462
  length = 0
457
463
  else:
@@ -500,7 +506,7 @@ class DocTag(object):
500
506
  if value is not None and value.length() > 1:
501
507
  message.warn(
502
508
  'closure takes at most 1 value, %d given' % (
503
- value.length()), self.position)
509
+ value.length(), ), self.position)
504
510
 
505
511
  def _validate_element_type(self, option, value):
506
512
  self._validate_option(option, value, required=True)
@@ -512,7 +518,7 @@ class DocTag(object):
512
518
  if value.length() > 2:
513
519
  message.warn(
514
520
  'element-type takes at most 2 values, %d given' % (
515
- value.length()), self.position)
521
+ value.length(), ), self.position)
516
522
  return
517
523
 
518
524
  def _validate_out(self, option, value):
@@ -521,13 +527,13 @@ class DocTag(object):
521
527
  if value.length() > 1:
522
528
  message.warn(
523
529
  'out annotation takes at most 1 value, %d given' % (
524
- value.length()), self.position)
530
+ value.length(), ), self.position)
525
531
  return
526
532
  value_str = value.one()
527
533
  if value_str not in [OPT_OUT_CALLEE_ALLOCATES,
528
534
  OPT_OUT_CALLER_ALLOCATES]:
529
535
  message.warn("out annotation value is invalid: %r" % (
530
- value_str), self.position)
536
+ value_str, ), self.position)
531
537
  return
532
538
 
533
539
  def _get_gtk_doc_value(self):
@@ -655,7 +661,7 @@ class DocOption(object):
655
661
  def __init__(self, tag, option):
656
662
  self.tag = tag
657
663
  self._array = []
658
- self._dict = odict()
664
+ self._dict = OrderedDict()
659
665
  # (annotation option1=value1 option2=value2) etc
660
666
  for p in option.split(' '):
661
667
  if '=' in p:
@@ -783,7 +789,7 @@ class AnnotationParser(object):
783
789
  # emit a warning.
784
790
  if comment_block.name in comment_blocks:
785
791
  message.warn("multiple comment blocks documenting '%s:' identifier." %
786
- (comment_block.name),
792
+ (comment_block.name, ),
787
793
  comment_block.position)
788
794
 
789
795
  comment_blocks[comment_block.name] = comment_block
@@ -820,7 +826,7 @@ class AnnotationParser(object):
820
826
  if description:
821
827
  comment_lines[-1] = (line_offset, description)
822
828
  position = message.Position(filename, lineno + line_offset)
823
- marker = ' '*result.end('description') + '^'
829
+ marker = ' ' * result.end('description') + '^'
824
830
  message.warn("Comments should end with */ on a new line:\n%s\n%s" %
825
831
  (line, marker),
826
832
  position)
@@ -892,14 +898,14 @@ class AnnotationParser(object):
892
898
  result = SECTION_RE.match(line)
893
899
  if result:
894
900
  identifier = IDENTIFIER_SECTION
895
- identifier_name = 'SECTION:%s' % (result.group('section_name'))
901
+ identifier_name = 'SECTION:%s' % (result.group('section_name'), )
896
902
  column = result.start('section_name') + column_offset
897
903
 
898
904
  if not identifier:
899
905
  result = SYMBOL_RE.match(line)
900
906
  if result:
901
907
  identifier = IDENTIFIER_SYMBOL
902
- identifier_name = '%s' % (result.group('symbol_name'))
908
+ identifier_name = '%s' % (result.group('symbol_name'), )
903
909
  column = result.start('symbol_name') + column_offset
904
910
 
905
911
  if not identifier:
@@ -928,7 +934,7 @@ class AnnotationParser(object):
928
934
  if 'colon' in result.groupdict() and result.group('colon') != ':':
929
935
  colon_start = result.start('colon')
930
936
  colon_column = column_offset + colon_start
931
- marker = ' '*colon_column + '^'
937
+ marker = ' ' * colon_column + '^'
932
938
  message.warn("missing ':' at column %s:\n%s\n%s" %
933
939
  (colon_column + 1, original_line, marker),
934
940
  position)
@@ -948,7 +954,7 @@ class AnnotationParser(object):
948
954
  # right thing to do because sooner or later some long
949
955
  # descriptions will contain something matching an identifier
950
956
  # pattern by accident.
951
- marker = ' '*column_offset + '^'
957
+ marker = ' ' * column_offset + '^'
952
958
  message.warn('ignoring unrecognized GTK-Doc comment block, identifier not '
953
959
  'found:\n%s\n%s' % (original_line, marker),
954
960
  position)
@@ -971,7 +977,7 @@ class AnnotationParser(object):
971
977
 
972
978
  if in_part != PART_PARAMETERS:
973
979
  column = result.start('parameter_name') + column_offset
974
- marker = ' '*column + '^'
980
+ marker = ' ' * column + '^'
975
981
  message.warn("'@%s' parameter unexpected at this location:\n%s\n%s" %
976
982
  (param_name, original_line, marker),
977
983
  position)
@@ -985,11 +991,11 @@ class AnnotationParser(object):
985
991
  returns_seen = True
986
992
  else:
987
993
  message.warn("encountered multiple 'Returns' parameters or tags for "
988
- "'%s'." % (comment_block.name),
994
+ "'%s'." % (comment_block.name, ),
989
995
  position)
990
996
  elif param_name in comment_block.params.keys():
991
997
  column = result.start('parameter_name') + column_offset
992
- marker = ' '*column + '^'
998
+ marker = ' ' * column + '^'
993
999
  message.warn("multiple '@%s' parameters for identifier '%s':\n%s\n%s" %
994
1000
  (param_name, comment_block.name, original_line, marker),
995
1001
  position)
@@ -1013,8 +1019,7 @@ class AnnotationParser(object):
1013
1019
  # identifier (when there are no parameters) and encounter an empty
1014
1020
  # line, we must be parsing the comment block description.
1015
1021
  ####################################################################
1016
- if (EMPTY_LINE_RE.match(line)
1017
- and in_part in [PART_IDENTIFIER, PART_PARAMETERS]):
1022
+ if (EMPTY_LINE_RE.match(line) and in_part in [PART_IDENTIFIER, PART_PARAMETERS]):
1018
1023
  in_part = PART_DESCRIPTION
1019
1024
  part_indent = line_indent
1020
1025
  continue
@@ -1028,7 +1033,7 @@ class AnnotationParser(object):
1028
1033
  tag_annotations = result.group('annotations')
1029
1034
  tag_description = result.group('description')
1030
1035
 
1031
- marker = ' '*(result.start('tag_name') + column_offset) + '^'
1036
+ marker = ' ' * (result.start('tag_name') + column_offset) + '^'
1032
1037
 
1033
1038
  # Deprecated GTK-Doc Description: tag
1034
1039
  if tag_name.lower() == TAG_DESCRIPTION:
@@ -1053,7 +1058,7 @@ class AnnotationParser(object):
1053
1058
 
1054
1059
  if in_part != PART_TAGS:
1055
1060
  column = result.start('tag_name') + column_offset
1056
- marker = ' '*column + '^'
1061
+ marker = ' ' * column + '^'
1057
1062
  message.warn("'%s:' tag unexpected at this location:\n%s\n%s" %
1058
1063
  (tag_name, original_line, marker),
1059
1064
  position)
@@ -1063,7 +1068,7 @@ class AnnotationParser(object):
1063
1068
  returns_seen = True
1064
1069
  else:
1065
1070
  message.warn("encountered multiple 'Returns' parameters or tags for "
1066
- "'%s'." % (comment_block.name),
1071
+ "'%s'." % (comment_block.name, ),
1067
1072
  position)
1068
1073
 
1069
1074
  tag = DocTag(comment_block, TAG_RETURNS)
@@ -1077,7 +1082,7 @@ class AnnotationParser(object):
1077
1082
  else:
1078
1083
  if tag_name.lower() in comment_block.tags.keys():
1079
1084
  column = result.start('tag_name') + column_offset
1080
- marker = ' '*column + '^'
1085
+ marker = ' ' * column + '^'
1081
1086
  message.warn("multiple '%s:' tags for identifier '%s':\n%s\n%s" %
1082
1087
  (tag_name, comment_block.name, original_line, marker),
1083
1088
  position)
@@ -1090,7 +1095,7 @@ class AnnotationParser(object):
1090
1095
  tag.options = self.parse_options(tag, tag_annotations)
1091
1096
  else:
1092
1097
  message.warn("annotations not supported for tag '%s:'." %
1093
- (tag_name),
1098
+ (tag_name, ),
1094
1099
  position)
1095
1100
  comment_block.tags[tag_name.lower()] = tag
1096
1101
  current_tag = tag
@@ -1155,7 +1160,7 @@ class AnnotationParser(object):
1155
1160
  part.value = ''
1156
1161
 
1157
1162
  def _validate_multiline_annotation_continuation(self, line, original_line,
1158
- column_offset, position):
1163
+ column_offset, position):
1159
1164
  '''
1160
1165
  Validate parameters and tags (except the first line) and generate
1161
1166
  warnings about invalid annotations spanning multiple lines.
@@ -1169,7 +1174,7 @@ class AnnotationParser(object):
1169
1174
  result = MULTILINE_ANNOTATION_CONTINUATION_RE.match(line)
1170
1175
  if result:
1171
1176
  column = result.start('annotations') + column_offset
1172
- marker = ' '*column + '^'
1177
+ marker = ' ' * column + '^'
1173
1178
  message.warn('ignoring invalid multiline annotation continuation:\n'
1174
1179
  '%s\n%s' % (original_line, marker),
1175
1180
  position)
@@ -1185,7 +1190,7 @@ class AnnotationParser(object):
1185
1190
 
1186
1191
  for i, c in enumerate(value):
1187
1192
  if c == '(' and opened == -1:
1188
- opened = i+1
1193
+ opened = i + 1
1189
1194
  if c == ')' and opened != -1:
1190
1195
  segment = value[opened:i]
1191
1196
  parts = segment.split(' ', 1)
@@ -24,19 +24,21 @@ from itertools import chain
24
24
 
25
25
  from . import message
26
26
 
27
+ from .collections import OrderedDict
27
28
  from .message import Position
28
- from .odict import odict
29
29
  from .utils import to_underscores
30
30
 
31
+
31
32
  class Type(object):
32
- """A Type can be either:
33
- * A reference to a node (target_giname)
34
- * A reference to a "fundamental" type like 'utf8'
35
- * A "foreign" type - this can be any string."
36
- If none are specified, then it's in an "unresolved" state. An
37
- unresolved type can have two data sources; a "ctype" which comes
38
- from a C type string, or a gtype_name (from g_type_name()).
39
- """ # '''
33
+ """
34
+ A Type can be either:
35
+ * A reference to a node (target_giname)
36
+ * A reference to a "fundamental" type like 'utf8'
37
+ * A "foreign" type - this can be any string."
38
+ If none are specified, then it's in an "unresolved" state. An
39
+ unresolved type can have two data sources; a "ctype" which comes
40
+ from a C type string, or a gtype_name (from g_type_name()).
41
+ """
40
42
 
41
43
  def __init__(self,
42
44
  ctype=None,
@@ -125,11 +127,12 @@ in contrast to the other create_type() functions."""
125
127
  def __cmp__(self, other):
126
128
  if self.target_fundamental:
127
129
  return cmp(self.target_fundamental, other.target_fundamental)
128
- if self.target_giname:
130
+ elif self.target_giname:
129
131
  return cmp(self.target_giname, other.target_giname)
130
- if self.target_foreign:
132
+ elif self.target_foreign:
131
133
  return cmp(self.target_foreign, other.target_foreign)
132
- return cmp(self.ctype, other.ctype)
134
+ else:
135
+ return cmp(self.ctype, other.ctype)
133
136
 
134
137
  def is_equiv(self, typeval):
135
138
  """Return True if the specified types are compatible at
@@ -170,6 +173,7 @@ in contrast to the other create_type() functions."""
170
173
  data = ''
171
174
  return '%s(%sctype=%s)' % (self.__class__.__name__, data, self.ctype)
172
175
 
176
+
173
177
  class TypeUnknown(Type):
174
178
  def __init__(self):
175
179
  Type.__init__(self, _target_unknown=True)
@@ -351,9 +355,7 @@ SIGNAL_MUST_COLLECT = 'must-collect'
351
355
 
352
356
 
353
357
  class Namespace(object):
354
- def __init__(self, name, version,
355
- identifier_prefixes=None,
356
- symbol_prefixes=None):
358
+ def __init__(self, name, version, identifier_prefixes=None, symbol_prefixes=None):
357
359
  self.name = name
358
360
  self.version = version
359
361
  if identifier_prefixes is not None:
@@ -367,15 +369,15 @@ class Namespace(object):
367
369
  self.symbol_prefixes = [to_underscores(p).lower() for p in ps]
368
370
  # cache upper-cased versions
369
371
  self._ucase_symbol_prefixes = [p.upper() for p in self.symbol_prefixes]
370
- self.names = odict() # Maps from GIName -> node
371
- self.aliases = {} # Maps from GIName -> GIName
372
- self.type_names = {} # Maps from GTName -> node
373
- self.ctypes = {} # Maps from CType -> node
374
- self.symbols = {} # Maps from function symbols -> Function
375
- self.includes = set() # Include
376
- self.shared_libraries = [] # str
377
- self.c_includes = [] # str
378
- self.exported_packages = [] # str
372
+ self.names = OrderedDict() # Maps from GIName -> node
373
+ self.aliases = {} # Maps from GIName -> GIName
374
+ self.type_names = {} # Maps from GTName -> node
375
+ self.ctypes = {} # Maps from CType -> node
376
+ self.symbols = {} # Maps from function symbols -> Function
377
+ self.includes = set() # Include
378
+ self.shared_libraries = [] # str
379
+ self.c_includes = [] # str
380
+ self.exported_packages = [] # str
379
381
 
380
382
  def type_from_name(self, name, ctype=None):
381
383
  """Backwards compatibility method for older .gir files, which
@@ -416,7 +418,7 @@ but adds it to things like ctypes, symbols, and type_names.
416
418
  if isinstance(node, (Class, Interface)):
417
419
  for m in chain(node.signals, node.properties):
418
420
  m.namespace = self
419
- if isinstance(node, Enum) or isinstance(node, Bitfield):
421
+ if isinstance(node, (Enum, Bitfield)):
420
422
  for fn in node.static_methods:
421
423
  if not isinstance(fn, Function):
422
424
  continue
@@ -482,6 +484,7 @@ functions via get_by_symbol()."""
482
484
  for node in self.itervalues():
483
485
  node.walk(callback, [])
484
486
 
487
+
485
488
  class Include(object):
486
489
 
487
490
  def __init__(self, name, version):
@@ -504,6 +507,7 @@ class Include(object):
504
507
  def __str__(self):
505
508
  return '%s-%s' % (self.name, self.version)
506
509
 
510
+
507
511
  class Annotated(object):
508
512
  """An object which has a few generic metadata
509
513
  properties."""
@@ -511,12 +515,13 @@ properties."""
511
515
  self.version = None
512
516
  self.skip = False
513
517
  self.introspectable = True
514
- self.attributes = [] # (key, value)*
518
+ self.attributes = [] # (key, value)*
515
519
  self.stability = None
516
520
  self.deprecated = None
517
521
  self.deprecated_version = None
518
522
  self.doc = None
519
523
 
524
+
520
525
  class Node(Annotated):
521
526
  """A node is a type of object which is uniquely identified by its
522
527
  (namespace, name) pair. When combined with a ., this is called a
@@ -527,7 +532,7 @@ GIName. It's possible for nodes to contain or point to other nodes."""
527
532
 
528
533
  def __init__(self, name=None):
529
534
  Annotated.__init__(self)
530
- self.namespace = None # Should be set later by Namespace.append()
535
+ self.namespace = None # Should be set later by Namespace.append()
531
536
  self.name = name
532
537
  self.foreign = False
533
538
  self.file_positions = set()
@@ -596,8 +601,8 @@ class Callable(Node):
596
601
  self.retval = retval
597
602
  self.parameters = parameters
598
603
  self.throws = not not throws
599
- self.instance_parameter = None # Parameter
600
- self.parent = None # A Class or Interface
604
+ self.instance_parameter = None # Parameter
605
+ self.parent = None # A Class or Interface
601
606
 
602
607
  # Returns all parameters, including the instance parameter
603
608
  @property
@@ -627,10 +632,10 @@ class Function(Callable):
627
632
  self.symbol = symbol
628
633
  self.is_method = False
629
634
  self.is_constructor = False
630
- self.shadowed_by = None # C symbol string
631
- self.shadows = None # C symbol string
632
- self.moved_to = None # namespaced function name string
633
- self.internal_skipped = False # if True, this func will not be written to GIR
635
+ self.shadowed_by = None # C symbol string
636
+ self.shadows = None # C symbol string
637
+ self.moved_to = None # namespaced function name string
638
+ self.internal_skipped = False # if True, this func will not be written to GIR
634
639
 
635
640
  def clone(self):
636
641
  clone = copy.copy(self)
@@ -641,8 +646,7 @@ class Function(Callable):
641
646
 
642
647
  def is_type_meta_function(self):
643
648
  # Named correctly
644
- if not (self.name.endswith('_get_type') or
645
- self.name.endswith('_get_gtype')):
649
+ if not (self.name.endswith('_get_type') or self.name.endswith('_get_gtype')):
646
650
  return False
647
651
 
648
652
  # Doesn't have any parameters
@@ -651,14 +655,13 @@ class Function(Callable):
651
655
 
652
656
  # Returns GType
653
657
  rettype = self.retval.type
654
- if (not rettype.is_equiv(TYPE_GTYPE) and
655
- rettype.target_giname != 'Gtk.Type'):
656
- message.warn("function '%s' returns '%r', not a GType" %
657
- (self.name, rettype))
658
+ if (not rettype.is_equiv(TYPE_GTYPE) and rettype.target_giname != 'Gtk.Type'):
659
+ message.warn("function '%s' returns '%r', not a GType" % (self.name, rettype))
658
660
  return False
659
661
 
660
662
  return True
661
663
 
664
+
662
665
  class ErrorQuarkFunction(Function):
663
666
 
664
667
  def __init__(self, name, retval, parameters, throws, symbol, error_domain):
@@ -679,7 +682,6 @@ class VFunction(Callable):
679
682
  return obj
680
683
 
681
684
 
682
-
683
685
  class Varargs(Type):
684
686
 
685
687
  def __init__(self):
@@ -715,6 +717,7 @@ class Array(Type):
715
717
  arr.size = self.size
716
718
  return arr
717
719
 
720
+
718
721
  class List(Type):
719
722
 
720
723
  def __init__(self, name, element_type, **kwargs):
@@ -727,6 +730,7 @@ class List(Type):
727
730
  def clone(self):
728
731
  return List(self.name, self.element_type)
729
732
 
733
+
730
734
  class Map(Type):
731
735
 
732
736
  def __init__(self, key_type, value_type, **kwargs):
@@ -739,6 +743,7 @@ class Map(Type):
739
743
  def clone(self):
740
744
  return Map(self.key_type, self.value_type)
741
745
 
746
+
742
747
  class Alias(Node):
743
748
 
744
749
  def __init__(self, name, target, ctype=None):
@@ -881,6 +886,7 @@ class Compound(Node, Registered):
881
886
  if field.anonymous_node is not None:
882
887
  field.anonymous_node.walk(callback, chain)
883
888
 
889
+
884
890
  class Field(Annotated):
885
891
 
886
892
  def __init__(self, name, typenode, readable, writable, bits=None,
@@ -894,7 +900,7 @@ class Field(Annotated):
894
900
  self.bits = bits
895
901
  self.anonymous_node = anonymous_node
896
902
  self.private = False
897
- self.parent = None # a compound
903
+ self.parent = None # a compound
898
904
 
899
905
  def __cmp__(self, other):
900
906
  return cmp(self.name, other.name)
@@ -1090,7 +1096,7 @@ class Property(Node):
1090
1096
  self.transfer = PARAM_TRANSFER_NONE
1091
1097
  else:
1092
1098
  self.transfer = transfer
1093
- self.parent = None # A Class or Interface
1099
+ self.parent = None # A Class or Interface
1094
1100
 
1095
1101
 
1096
1102
  class Callback(Callable):