everypolitician-daff 1.3.26

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +252 -0
  3. data/bin/daff.rb +3 -0
  4. data/lib/daff.rb +150 -0
  5. data/lib/lib/coopy/alignment.rb +307 -0
  6. data/lib/lib/coopy/cell_builder.rb +17 -0
  7. data/lib/lib/coopy/cell_info.rb +33 -0
  8. data/lib/lib/coopy/column_change.rb +16 -0
  9. data/lib/lib/coopy/combined_table.rb +127 -0
  10. data/lib/lib/coopy/combined_table_body.rb +151 -0
  11. data/lib/lib/coopy/combined_table_head.rb +103 -0
  12. data/lib/lib/coopy/compare_flags.rb +127 -0
  13. data/lib/lib/coopy/compare_table.rb +688 -0
  14. data/lib/lib/coopy/conflict_info.rb +23 -0
  15. data/lib/lib/coopy/coopy.rb +1065 -0
  16. data/lib/lib/coopy/cross_match.rb +17 -0
  17. data/lib/lib/coopy/csv.rb +290 -0
  18. data/lib/lib/coopy/diff_render.rb +339 -0
  19. data/lib/lib/coopy/diff_summary.rb +28 -0
  20. data/lib/lib/coopy/flat_cell_builder.rb +75 -0
  21. data/lib/lib/coopy/highlight_patch.rb +977 -0
  22. data/lib/lib/coopy/highlight_patch_unit.rb +38 -0
  23. data/lib/lib/coopy/index.rb +131 -0
  24. data/lib/lib/coopy/index_item.rb +37 -0
  25. data/lib/lib/coopy/index_pair.rb +96 -0
  26. data/lib/lib/coopy/json_table.rb +165 -0
  27. data/lib/lib/coopy/json_tables.rb +129 -0
  28. data/lib/lib/coopy/merger.rb +197 -0
  29. data/lib/lib/coopy/meta.rb +20 -0
  30. data/lib/lib/coopy/mover.rb +197 -0
  31. data/lib/lib/coopy/ndjson.rb +134 -0
  32. data/lib/lib/coopy/nested_cell_builder.rb +74 -0
  33. data/lib/lib/coopy/ordering.rb +54 -0
  34. data/lib/lib/coopy/property_change.rb +16 -0
  35. data/lib/lib/coopy/row.rb +11 -0
  36. data/lib/lib/coopy/row_change.rb +42 -0
  37. data/lib/lib/coopy/row_stream.rb +11 -0
  38. data/lib/lib/coopy/simple_meta.rb +314 -0
  39. data/lib/lib/coopy/simple_table.rb +345 -0
  40. data/lib/lib/coopy/simple_view.rb +70 -0
  41. data/lib/lib/coopy/sparse_sheet.rb +51 -0
  42. data/lib/lib/coopy/sql_column.rb +47 -0
  43. data/lib/lib/coopy/sql_compare.rb +605 -0
  44. data/lib/lib/coopy/sql_database.rb +21 -0
  45. data/lib/lib/coopy/sql_helper.rb +17 -0
  46. data/lib/lib/coopy/sql_table.rb +335 -0
  47. data/lib/lib/coopy/sql_table_name.rb +23 -0
  48. data/lib/lib/coopy/sql_tables.rb +128 -0
  49. data/lib/lib/coopy/sqlite_helper.rb +316 -0
  50. data/lib/lib/coopy/table.rb +24 -0
  51. data/lib/lib/coopy/table_comparison_state.rb +50 -0
  52. data/lib/lib/coopy/table_diff.rb +1185 -0
  53. data/lib/lib/coopy/table_io.rb +72 -0
  54. data/lib/lib/coopy/table_modifier.rb +40 -0
  55. data/lib/lib/coopy/table_stream.rb +102 -0
  56. data/lib/lib/coopy/table_view.rb +148 -0
  57. data/lib/lib/coopy/tables.rb +52 -0
  58. data/lib/lib/coopy/terminal_diff_render.rb +213 -0
  59. data/lib/lib/coopy/unit.rb +93 -0
  60. data/lib/lib/coopy/view.rb +20 -0
  61. data/lib/lib/coopy/viterbi.rb +177 -0
  62. data/lib/lib/haxe/ds/int_map.rb +19 -0
  63. data/lib/lib/haxe/ds/string_map.rb +19 -0
  64. data/lib/lib/haxe/format/json_parser.rb +265 -0
  65. data/lib/lib/haxe/format/json_printer.rb +240 -0
  66. data/lib/lib/haxe/imap.rb +10 -0
  67. data/lib/lib/haxe/io/bytes.rb +34 -0
  68. data/lib/lib/haxe/io/eof.rb +18 -0
  69. data/lib/lib/haxe/io/error.rb +22 -0
  70. data/lib/lib/haxe/io/output.rb +41 -0
  71. data/lib/lib/hx_overrides.rb +19 -0
  72. data/lib/lib/hx_sys.rb +74 -0
  73. data/lib/lib/lambda.rb +37 -0
  74. data/lib/lib/list.rb +36 -0
  75. data/lib/lib/math.rb +5 -0
  76. data/lib/lib/rb/boot.rb +39 -0
  77. data/lib/lib/rb/ruby_iterator.rb +50 -0
  78. data/lib/lib/reflect.rb +41 -0
  79. data/lib/lib/std.rb +12 -0
  80. data/lib/lib/string_buf.rb +19 -0
  81. data/lib/lib/sys/io/file_handle.rb +18 -0
  82. data/lib/lib/sys/io/file_output.rb +36 -0
  83. data/lib/lib/sys/io/hx_file.rb +20 -0
  84. data/lib/lib/type.rb +37 -0
  85. data/lib/lib/value_type.rb +23 -0
  86. data/lib/lib/x_list/list_iterator.rb +32 -0
  87. metadata +235 -0
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+ # encoding: utf-8
3
+
4
+ module Coopy
5
+ class CellBuilder
6
+ def needSeparator() puts "Abstract CellBuilder.needSeparator called" end
7
+ def setSeparator(separator) puts "Abstract CellBuilder.setSeparator called" end
8
+ def setConflictSeparator(separator) puts "Abstract CellBuilder.setConflictSeparator called" end
9
+ def setView(view) puts "Abstract CellBuilder.setView called" end
10
+ def update(local,remote) puts "Abstract CellBuilder.update called" end
11
+ def conflict(parent,local,remote) puts "Abstract CellBuilder.conflict called" end
12
+ def marker(label) puts "Abstract CellBuilder.marker called" end
13
+ def links(unit,row_like) puts "Abstract CellBuilder.links called" end
14
+ haxe_me ["coopy", "CellBuilder"]
15
+ end
16
+
17
+ end
@@ -0,0 +1,33 @@
1
+ #!/usr/bin/env ruby
2
+ # encoding: utf-8
3
+
4
+ module Coopy
5
+ class CellInfo
6
+
7
+ def initialize
8
+ end
9
+
10
+ attr_accessor :raw
11
+ attr_accessor :value
12
+ attr_accessor :pretty_value
13
+ attr_accessor :category
14
+ attr_accessor :category_given_tr
15
+ attr_accessor :separator
16
+ attr_accessor :pretty_separator
17
+ attr_accessor :updated
18
+ attr_accessor :conflicted
19
+ attr_accessor :pvalue
20
+ attr_accessor :lvalue
21
+ attr_accessor :rvalue
22
+ attr_accessor :meta
23
+
24
+ def to_s
25
+ return @value if !@updated
26
+ return _hx_str(@lvalue) + "::" + _hx_str(@rvalue) if !@conflicted
27
+ _hx_str(@pvalue) + "||" + _hx_str(@lvalue) + "::" + _hx_str(@rvalue)
28
+ end
29
+
30
+ haxe_me ["coopy", "CellInfo"]
31
+ end
32
+
33
+ end
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ # encoding: utf-8
3
+
4
+ module Coopy
5
+ class ColumnChange
6
+
7
+ def initialize
8
+ end
9
+
10
+ attr_accessor :prev_name
11
+ attr_accessor :name
12
+ attr_accessor :props
13
+ haxe_me ["coopy", "ColumnChange"]
14
+ end
15
+
16
+ end
@@ -0,0 +1,127 @@
1
+ #!/usr/bin/env ruby
2
+ # encoding: utf-8
3
+
4
+ module Coopy
5
+ class CombinedTable
6
+
7
+ def initialize(t)
8
+ @t = t
9
+ @dx = 0
10
+ @dy = 0
11
+ @core = t
12
+ @head = nil
13
+ return if t.get_width < 1 || t.get_height < 1
14
+ v = t.get_cell_view
15
+ return if v.to_s(t.get_cell(0,0)) != "@@"
16
+ @dx = 1
17
+ @dy = 0
18
+ begin
19
+ _g1 = 0
20
+ _g = t.get_height
21
+ while(_g1 < _g)
22
+ y = _g1
23
+ _g1+=1
24
+ txt = v.to_s(t.get_cell(0,y))
25
+ break if txt == nil || txt == "" || txt == "null"
26
+ @dy+=1
27
+ end
28
+ end
29
+ @head = ::Coopy::CombinedTableHead.new(self,@dx,@dy)
30
+ @body = ::Coopy::CombinedTableBody.new(self,@dx,@dy)
31
+ @core = @body
32
+ @meta = ::Coopy::SimpleMeta.new(@head)
33
+ end
34
+
35
+ protected
36
+
37
+ attr_accessor :t
38
+ attr_accessor :body
39
+ attr_accessor :head
40
+ attr_accessor :dx
41
+ attr_accessor :dy
42
+ attr_accessor :core
43
+ attr_accessor :meta
44
+
45
+ public
46
+
47
+ def all
48
+ @t
49
+ end
50
+
51
+ def get_table
52
+ self
53
+ end
54
+
55
+ def height() get_height end
56
+ def height=(__v) @height = __v end
57
+ def width() get_width end
58
+ def width=(__v) @width = __v end
59
+
60
+ def get_width
61
+ @core.get_width
62
+ end
63
+
64
+ def get_height
65
+ @core.get_height
66
+ end
67
+
68
+ def get_cell(x,y)
69
+ @core.get_cell(x,y)
70
+ end
71
+
72
+ def set_cell(x,y,c)
73
+ @core.set_cell(x,y,c)
74
+ end
75
+
76
+ def to_s
77
+ ::Coopy::SimpleTable.table_to_string(self)
78
+ end
79
+
80
+ def get_cell_view
81
+ @t.get_cell_view
82
+ end
83
+
84
+ def is_resizable
85
+ @core.is_resizable
86
+ end
87
+
88
+ def resize(w,h)
89
+ @core.resize(h,w)
90
+ end
91
+
92
+ def clear
93
+ @core.clear
94
+ end
95
+
96
+ def insert_or_delete_rows(fate,hfate)
97
+ @core.insert_or_delete_rows(fate,hfate)
98
+ end
99
+
100
+ def insert_or_delete_columns(fate,wfate)
101
+ @core.insert_or_delete_columns(fate,wfate)
102
+ end
103
+
104
+ def trim_blank
105
+ @core.trim_blank
106
+ end
107
+
108
+ def get_data
109
+ nil
110
+ end
111
+
112
+ def clone
113
+ @core.clone
114
+ end
115
+
116
+ def create
117
+ @t.create
118
+ end
119
+
120
+ def get_meta
121
+ @meta
122
+ end
123
+
124
+ haxe_me ["coopy", "CombinedTable"]
125
+ end
126
+
127
+ end
@@ -0,0 +1,151 @@
1
+ #!/usr/bin/env ruby
2
+ # encoding: utf-8
3
+
4
+ module Coopy
5
+ class CombinedTableBody
6
+
7
+ def initialize(parent,dx,dy)
8
+ @parent = parent
9
+ @dx = dx
10
+ @dy = dy
11
+ @all = parent.all
12
+ end
13
+
14
+ protected
15
+
16
+ attr_accessor :parent
17
+ attr_accessor :dx
18
+ attr_accessor :dy
19
+ attr_accessor :all
20
+ attr_accessor :meta
21
+
22
+ public
23
+
24
+ def get_table
25
+ self
26
+ end
27
+
28
+ def height() get_height end
29
+ def height=(__v) @height = __v end
30
+ def width() get_width end
31
+ def width=(__v) @width = __v end
32
+
33
+ def get_width
34
+ @all.get_width - 1
35
+ end
36
+
37
+ def get_height
38
+ @all.get_height - @dy + 1
39
+ end
40
+
41
+ def get_cell(x,y)
42
+ if y == 0
43
+ @meta = @parent.get_meta.as_table if @meta == nil
44
+ return @meta.get_cell(x + @dx,0)
45
+ end
46
+ @all.get_cell(x + @dx,y + @dy - 1)
47
+ end
48
+
49
+ def set_cell(x,y,c)
50
+ if y == 0
51
+ @all.set_cell(x + @dx,0,c)
52
+ return
53
+ end
54
+ @all.set_cell(x + @dx,y + @dy - 1,c)
55
+ end
56
+
57
+ def to_s
58
+ ::Coopy::SimpleTable.table_to_string(self)
59
+ end
60
+
61
+ def get_cell_view
62
+ @all.get_cell_view
63
+ end
64
+
65
+ def is_resizable
66
+ @all.is_resizable
67
+ end
68
+
69
+ def resize(w,h)
70
+ @all.resize(w + 1,h + @dy)
71
+ end
72
+
73
+ def clear
74
+ @all.clear
75
+ @dx = 0
76
+ @dy = 0
77
+ end
78
+
79
+ def insert_or_delete_rows(fate,hfate)
80
+ fate2 = Array.new
81
+ begin
82
+ _g1 = 0
83
+ _g = @dy
84
+ while(_g1 < _g)
85
+ y = _g1
86
+ _g1+=1
87
+ fate2.push(y)
88
+ end
89
+ end
90
+ hdr = true
91
+ begin
92
+ _g2 = 0
93
+ while(_g2 < fate.length)
94
+ f = fate[_g2]
95
+ _g2+=1
96
+ if hdr
97
+ hdr = false
98
+ next
99
+ end
100
+ fate2.push(((f >= 0) ? f + @dy - 1 : f))
101
+ end
102
+ end
103
+ @all.insert_or_delete_rows(fate2,hfate + @dy - 1)
104
+ end
105
+
106
+ def insert_or_delete_columns(fate,wfate)
107
+ fate2 = Array.new
108
+ begin
109
+ _g1 = 0
110
+ _g = @dx + 1
111
+ while(_g1 < _g)
112
+ x = _g1
113
+ _g1+=1
114
+ fate2.push(x)
115
+ end
116
+ end
117
+ begin
118
+ _g2 = 0
119
+ while(_g2 < fate.length)
120
+ f = fate[_g2]
121
+ _g2+=1
122
+ fate2.push(((f >= 0) ? f + @dx + 1 : f))
123
+ end
124
+ end
125
+ @all.insert_or_delete_columns(fate2,wfate + @dx)
126
+ end
127
+
128
+ def trim_blank
129
+ @all.trim_blank
130
+ end
131
+
132
+ def get_data
133
+ nil
134
+ end
135
+
136
+ def clone
137
+ ::Coopy::CombinedTable.new(@all.clone)
138
+ end
139
+
140
+ def create
141
+ ::Coopy::CombinedTable.new(@all.create)
142
+ end
143
+
144
+ def get_meta
145
+ @parent.get_meta
146
+ end
147
+
148
+ haxe_me ["coopy", "CombinedTableBody"]
149
+ end
150
+
151
+ end
@@ -0,0 +1,103 @@
1
+ #!/usr/bin/env ruby
2
+ # encoding: utf-8
3
+
4
+ module Coopy
5
+ class CombinedTableHead
6
+
7
+ def initialize(parent,dx,dy)
8
+ @parent = parent
9
+ @dx = dx
10
+ @dy = dy
11
+ @all = parent.all
12
+ end
13
+
14
+ protected
15
+
16
+ attr_accessor :parent
17
+ attr_accessor :dx
18
+ attr_accessor :dy
19
+ attr_accessor :all
20
+
21
+ public
22
+
23
+ def get_table
24
+ self
25
+ end
26
+
27
+ def height() get_height end
28
+ def height=(__v) @height = __v end
29
+ def width() get_width end
30
+ def width=(__v) @width = __v end
31
+
32
+ def get_width
33
+ @all.get_width
34
+ end
35
+
36
+ def get_height
37
+ @dy
38
+ end
39
+
40
+ def get_cell(x,y)
41
+ if x == 0
42
+ v = self.get_cell_view
43
+ txt = v.to_s(@all.get_cell(x,y))
44
+ return txt[1,txt.length] if txt[0] == "@"
45
+ end
46
+ @all.get_cell(x,y)
47
+ end
48
+
49
+ def set_cell(x,y,c)
50
+ @all.set_cell(x,y,c)
51
+ end
52
+
53
+ def to_s
54
+ ::Coopy::SimpleTable.table_to_string(self)
55
+ end
56
+
57
+ def get_cell_view
58
+ @all.get_cell_view
59
+ end
60
+
61
+ def is_resizable
62
+ false
63
+ end
64
+
65
+ def resize(w,h)
66
+ false
67
+ end
68
+
69
+ def clear
70
+ end
71
+
72
+ def insert_or_delete_rows(fate,hfate)
73
+ false
74
+ end
75
+
76
+ def insert_or_delete_columns(fate,wfate)
77
+ @all.insert_or_delete_columns(fate,wfate)
78
+ end
79
+
80
+ def trim_blank
81
+ false
82
+ end
83
+
84
+ def get_data
85
+ nil
86
+ end
87
+
88
+ def clone
89
+ nil
90
+ end
91
+
92
+ def create
93
+ nil
94
+ end
95
+
96
+ def get_meta
97
+ nil
98
+ end
99
+
100
+ haxe_me ["coopy", "CombinedTableHead"]
101
+ end
102
+
103
+ end