daff 1.3.2 → 1.3.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f83e7c531044c8304fe471789f88f1a25ccc3618
4
- data.tar.gz: a131ce2c9f90a56e11c1cf7f0f7cf7216db7668a
3
+ metadata.gz: 56cd28220d87d43853faf7c8133eb23dcd7fc0b3
4
+ data.tar.gz: 0c14ac8d72f5f3348fe5b6b73c804a30364981f1
5
5
  SHA512:
6
- metadata.gz: 3125f64b0ebf44d43e3fa7fa68223d093803842e360680720a7fbdba7a250f872b4e906ce8adc8265abec8e5072608da4e330a3d95653581f00ff394232046f4
7
- data.tar.gz: 3ddd77a33fd57de5db60e056a9b269e07f3294e5a670d9ee5334d14e78bc75c1cff10dd867e768795217262091ebc6f04d1571a6c9003b882edfb7ce96ead4e1
6
+ metadata.gz: c26c1ed6019d5131a5623dbd6b3eb120d237724c39e8c3c037c921b78ec7996ad83ec9dc121c7cf518b635a143db696aa5b4d8f800795ca2228b8f3e443fca8a
7
+ data.tar.gz: 4a42d2fbe3732653ae83459aed3f01643c6ec8b78735717b0f248e5b763a332f851c79d00d61e18c669c2eacfbc17b872c227f9c06dab64dfaf561a7e8e7d9fc
data/README.md CHANGED
@@ -3,7 +3,8 @@
3
3
  [![Gem Version](https://badge.fury.io/rb/daff.svg)](http://badge.fury.io/rb/daff)
4
4
  [![PyPI version](https://badge.fury.io/py/daff.svg)](http://badge.fury.io/py/daff)
5
5
  [![PHP version](https://badge.fury.io/ph/paulfitz%2Fdaff-php.svg)](http://badge.fury.io/ph/paulfitz%2Fdaff-php)
6
- [![tips](https://img.shields.io/gratipay/paulfitz.svg)](https://gratipay.com/paulfitz/)
6
+ [![Bower version](https://badge.fury.io/bo/daff.svg)](http://badge.fury.io/bo/daff)
7
+ ![Badge count](http://img.shields.io/:badges-7/7-33aa33.svg)
7
8
 
8
9
  daff: data diff
9
10
  ===============
@@ -23,6 +24,7 @@ pip install daff # python
23
24
  gem install daff # ruby
24
25
  composer require paulfitz/daff-php # php
25
26
  install.packages('daff') # R wrapper by Edwin de Jonge
27
+ bower install daff # web/javascript
26
28
  ````
27
29
 
28
30
  Other translations are available here:
@@ -228,7 +230,9 @@ API documentation
228
230
  Sponsors
229
231
  --------
230
232
 
231
- The [Data Commons Co-op](http://datacommons.coop), "perhaps the geekiest of all cooperative organizations on the planet," has given great moral support during the initial development of `daff`. There's currently no financial support for `daff`. You could change that! [![tips](https://img.shields.io/gratipay/paulfitz.svg)](https://gratipay.com/paulfitz/)
233
+ <img src="http://datacommons.coop/images/the_zen_of_venn.png" alt="the zen of venn" height="100">
234
+ The [Data Commons Co-op](http://datacommons.coop), "perhaps the geekiest of all cooperative organizations on the planet," has given great moral support during the development of `daff`.
235
+ Donate a multiple of `42.42` in your currency to let them know you care: [http://datacommons.coop/donate/](http://datacommons.coop/donate/)
232
236
 
233
237
  Reading material
234
238
  ----------------
data/lib/daff.rb CHANGED
@@ -45,6 +45,7 @@ require_relative 'lib/lambda'
45
45
  require_relative 'lib/list'
46
46
  require_relative 'lib/x_list/list_iterator'
47
47
  require_relative 'lib/reflect'
48
+ require_relative 'lib/std'
48
49
  require_relative 'lib/string_buf'
49
50
  require_relative 'lib/hx_sys'
50
51
  require_relative 'lib/value_type'
@@ -53,6 +54,10 @@ require_relative 'lib/coopy/alignment'
53
54
  require_relative 'lib/coopy/cell_builder'
54
55
  require_relative 'lib/coopy/cell_info'
55
56
  require_relative 'lib/coopy/column_change'
57
+ require_relative 'lib/coopy/table'
58
+ require_relative 'lib/coopy/combined_table'
59
+ require_relative 'lib/coopy/combined_table_body'
60
+ require_relative 'lib/coopy/combined_table_head'
56
61
  require_relative 'lib/coopy/compare_flags'
57
62
  require_relative 'lib/coopy/compare_table'
58
63
  require_relative 'lib/coopy/coopy'
@@ -66,8 +71,10 @@ require_relative 'lib/coopy/highlight_patch_unit'
66
71
  require_relative 'lib/coopy/index'
67
72
  require_relative 'lib/coopy/index_item'
68
73
  require_relative 'lib/coopy/index_pair'
69
- require_relative 'lib/coopy/merger'
70
74
  require_relative 'lib/coopy/meta'
75
+ require_relative 'lib/coopy/json_table'
76
+ require_relative 'lib/coopy/json_tables'
77
+ require_relative 'lib/coopy/merger'
71
78
  require_relative 'lib/coopy/mover'
72
79
  require_relative 'lib/coopy/ndjson'
73
80
  require_relative 'lib/coopy/nested_cell_builder'
@@ -75,7 +82,7 @@ require_relative 'lib/coopy/ordering'
75
82
  require_relative 'lib/coopy/property_change'
76
83
  require_relative 'lib/coopy/row_change'
77
84
  require_relative 'lib/coopy/row_stream'
78
- require_relative 'lib/coopy/table'
85
+ require_relative 'lib/coopy/simple_meta'
79
86
  require_relative 'lib/coopy/simple_table'
80
87
  require_relative 'lib/coopy/view'
81
88
  require_relative 'lib/coopy/simple_view'
@@ -86,12 +93,14 @@ require_relative 'lib/coopy/sql_database'
86
93
  require_relative 'lib/coopy/sql_helper'
87
94
  require_relative 'lib/coopy/sql_table'
88
95
  require_relative 'lib/coopy/sql_table_name'
96
+ require_relative 'lib/coopy/sql_tables'
89
97
  require_relative 'lib/coopy/sqlite_helper'
90
98
  require_relative 'lib/coopy/table_comparison_state'
91
99
  require_relative 'lib/coopy/table_diff'
92
100
  require_relative 'lib/coopy/table_io'
93
101
  require_relative 'lib/coopy/table_modifier'
94
102
  require_relative 'lib/coopy/table_stream'
103
+ require_relative 'lib/coopy/tables'
95
104
  require_relative 'lib/coopy/terminal_diff_render'
96
105
  require_relative 'lib/coopy/unit'
97
106
  require_relative 'lib/coopy/viterbi'
@@ -11,9 +11,11 @@ module Coopy
11
11
  @map_count = 0
12
12
  @reference = nil
13
13
  @meta = nil
14
+ @comp = nil
14
15
  @order_cache_has_reference = false
15
16
  @ia = -1
16
17
  @ib = -1
18
+ @marked_as_identical = false
17
19
  end
18
20
 
19
21
  protected
@@ -30,11 +32,15 @@ module Coopy
30
32
  attr_accessor :order_cache
31
33
  attr_accessor :order_cache_has_reference
32
34
  attr_accessor :index_columns
35
+ attr_accessor :marked_as_identical
33
36
 
34
37
  public
35
38
 
36
39
  attr_accessor :reference
37
40
  attr_accessor :meta
41
+ attr_accessor :comp
42
+ attr_accessor :has_addition
43
+ attr_accessor :has_removal
38
44
 
39
45
  def range(ha,hb)
40
46
  @ha = ha
@@ -55,8 +61,16 @@ module Coopy
55
61
  end
56
62
 
57
63
  def link(a,b)
58
- @map_a2b[a] = b if a != -1
59
- @map_b2a[b] = a if b != -1
64
+ if a != -1
65
+ @map_a2b[a] = b
66
+ else
67
+ @has_addition = true
68
+ end
69
+ if b != -1
70
+ @map_b2a[b] = a
71
+ else
72
+ @has_removal = true
73
+ end
60
74
  @map_count+=1
61
75
  end
62
76
 
@@ -277,6 +291,16 @@ module Coopy
277
291
  result
278
292
  end
279
293
 
294
+ public
295
+
296
+ def mark_identical
297
+ @marked_as_identical = true
298
+ end
299
+
300
+ def is_marked_as_identical
301
+ @marked_as_identical
302
+ end
303
+
280
304
  haxe_me ["coopy", "Alignment"]
281
305
  end
282
306
 
@@ -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