rbbt-util 5.21.85 → 5.21.86
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.
- checksums.yaml +4 -4
- data/lib/rbbt/association/util.rb +2 -2
- data/lib/rbbt/persist/tsv/fix_width_table.rb +1 -1
- data/lib/rbbt/persist/tsv/packed_index.rb +2 -2
- data/lib/rbbt/tsv/manipulate.rb +4 -4
- data/lib/rbbt/tsv/parallel/traverse.rb +1 -1
- data/lib/rbbt/util/R.rb +1 -1
- data/lib/rbbt/util/R/model.rb +1 -1
- data/lib/rbbt/util/R/plot.rb +3 -3
- data/lib/rbbt/util/color.rb +1 -1
- data/lib/rbbt/util/colorize.rb +1 -1
- data/lib/rbbt/util/concurrency/processes/worker.rb +1 -1
- data/lib/rbbt/util/log.rb +3 -3
- data/lib/rbbt/util/misc.rb +2 -2
- data/lib/rbbt/util/misc/options.rb +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 14c71affcd04cfc765824f452e0455dd0a59befe
|
4
|
+
data.tar.gz: 57821f59ec541b8cb173fbcf64861ca793a0a032
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 81cd59fb9a32bddf24ca25a7bb614faab5ced6bfdff678454b688992674c84029312d8c52dc2a29f9c3511945daf6be91e90375ba8b661e184a08330229be203
|
7
|
+
data.tar.gz: 2e45a91dcd62e667d9f16e83ff1c20f58bbf2111ab631e82a0e287cfa97a8e5c46af6fe6f0c79f75b99c30d6fceb62d91dcca2fe72eec4bc28d313386483df1f
|
@@ -10,7 +10,7 @@ module Association
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def self.parse_field_specification(spec)
|
13
|
-
return [2,nil,nil] if
|
13
|
+
return [2,nil,nil] if Numeric === spec
|
14
14
|
spec = spec.split "=>" unless Array === spec
|
15
15
|
field_part, final_format = spec
|
16
16
|
|
@@ -131,7 +131,7 @@ module Association
|
|
131
131
|
header = case field
|
132
132
|
when String
|
133
133
|
field
|
134
|
-
when
|
134
|
+
when Numeric
|
135
135
|
all_fields[field]
|
136
136
|
when :key
|
137
137
|
all_fields.first
|
@@ -62,7 +62,7 @@ module Persist
|
|
62
62
|
|
63
63
|
def add(key, value)
|
64
64
|
key = pos_function.call(key) if pos_function
|
65
|
-
if
|
65
|
+
if Numeric === key
|
66
66
|
@_last ||= -1
|
67
67
|
skipped = key - @_last - 1
|
68
68
|
skipped.times do
|
@@ -79,7 +79,7 @@ module Persist
|
|
79
79
|
end
|
80
80
|
|
81
81
|
def include?(i)
|
82
|
-
return true if
|
82
|
+
return true if Numeric === i and i < size
|
83
83
|
return true if metadata.include? i
|
84
84
|
false
|
85
85
|
end
|
data/lib/rbbt/tsv/manipulate.rb
CHANGED
@@ -114,7 +114,7 @@ module TSV
|
|
114
114
|
end
|
115
115
|
when @new_fields == :all
|
116
116
|
fields
|
117
|
-
when (
|
117
|
+
when (Numeric === @new_fields and @new_fields <= 0)
|
118
118
|
new = fields.dup
|
119
119
|
new.delete_at(- @new_fields)
|
120
120
|
new.unshift key_field
|
@@ -127,13 +127,13 @@ module TSV
|
|
127
127
|
self.instance_eval do alias process process_null end
|
128
128
|
when @new_key_field == :key
|
129
129
|
if type == :double
|
130
|
-
if
|
130
|
+
if Numeric === @new_fields and @new_fields <= 0
|
131
131
|
self.instance_eval do alias process process_subset_all_but_double end
|
132
132
|
else
|
133
133
|
self.instance_eval do alias process process_subset_double end
|
134
134
|
end
|
135
135
|
else
|
136
|
-
if
|
136
|
+
if Numeric === @new_fields and @new_fields <= 0
|
137
137
|
self.instance_eval do alias process process_subset_all_but_list end
|
138
138
|
else
|
139
139
|
self.instance_eval do alias process process_subset_list end
|
@@ -523,7 +523,7 @@ module TSV
|
|
523
523
|
end
|
524
524
|
end
|
525
525
|
|
526
|
-
when
|
526
|
+
when Numeric === method
|
527
527
|
with_unnamed do
|
528
528
|
through :key, key do |key, values|
|
529
529
|
new[key] = self[key] if invert ^ (values.flatten.length >= method)
|
data/lib/rbbt/util/R.rb
CHANGED
data/lib/rbbt/util/R/model.rb
CHANGED
@@ -105,7 +105,7 @@ model = rbbt.model.load('#{model_file}');
|
|
105
105
|
predict(model, data.frame(#{R.ruby2R tsv}));
|
106
106
|
EOF
|
107
107
|
Array === tsv.values.first ? res : res.first
|
108
|
-
when
|
108
|
+
when Numeric, Array, String
|
109
109
|
field = formula.split("~").last.strip
|
110
110
|
field.gsub!(/log\((.*)\)/,'\1')
|
111
111
|
|
data/lib/rbbt/util/R/plot.rb
CHANGED
@@ -31,7 +31,7 @@ module R
|
|
31
31
|
case v
|
32
32
|
when FalseClass, TrueClass
|
33
33
|
"'logical'"
|
34
|
-
when
|
34
|
+
when Numeric
|
35
35
|
"'numeric'"
|
36
36
|
when String
|
37
37
|
if v.strip =~ /^[-+]?[\d\.]+$/
|
@@ -97,7 +97,7 @@ module R
|
|
97
97
|
case v
|
98
98
|
when FalseClass, TrueClass
|
99
99
|
"'logical'"
|
100
|
-
when
|
100
|
+
when Numeric
|
101
101
|
"'numeric'"
|
102
102
|
when String
|
103
103
|
if v.strip =~ /^[-+]?[\d\.]+$/
|
@@ -178,7 +178,7 @@ data = NULL
|
|
178
178
|
case v
|
179
179
|
when FalseClass, TrueClass
|
180
180
|
"'logical'"
|
181
|
-
when
|
181
|
+
when Numeric
|
182
182
|
"'numeric'"
|
183
183
|
when String
|
184
184
|
if v.strip =~ /^[-+]?[\d\.]+$/
|
data/lib/rbbt/util/color.rb
CHANGED
@@ -106,7 +106,7 @@ class Color
|
|
106
106
|
return val if val.is_a?(Color)
|
107
107
|
|
108
108
|
# Single value, assume grayscale
|
109
|
-
return Color.new(val, val, val) if val.is_a?(
|
109
|
+
return Color.new(val, val, val) if val.is_a?(Numeric)
|
110
110
|
|
111
111
|
# Assume string
|
112
112
|
str = val.to_s.upcase
|
data/lib/rbbt/util/colorize.rb
CHANGED
@@ -74,7 +74,7 @@ module Colorize
|
|
74
74
|
|
75
75
|
def self.tsv(tsv, options = {})
|
76
76
|
values = tsv.values.flatten
|
77
|
-
if
|
77
|
+
if Numeric === values.first or (values.first.to_f != 0 and values[0] != "0" and values[0] != "0.0")
|
78
78
|
value_colors = Misc.process_to_hash(values){continuous(values)}
|
79
79
|
else
|
80
80
|
value_colors = Misc.process_to_hash(values){distinct(values)}
|
data/lib/rbbt/util/log.rb
CHANGED
@@ -54,8 +54,8 @@ module Log
|
|
54
54
|
|
55
55
|
def self.get_level(level)
|
56
56
|
case level
|
57
|
-
when
|
58
|
-
level
|
57
|
+
when Numeric
|
58
|
+
level.to_i
|
59
59
|
when String
|
60
60
|
begin
|
61
61
|
Log.const_get(level.upcase)
|
@@ -123,7 +123,7 @@ module Log
|
|
123
123
|
def self.color(severity, str = nil, reset = false)
|
124
124
|
return str || "" if nocolor
|
125
125
|
color = reset ? Term::ANSIColor.reset : ""
|
126
|
-
color << SEVERITY_COLOR[severity] if
|
126
|
+
color << SEVERITY_COLOR[severity] if Integer === severity
|
127
127
|
color << Term::ANSIColor.send(severity) if Symbol === severity and Term::ANSIColor.respond_to? severity
|
128
128
|
if str.nil?
|
129
129
|
color
|
data/lib/rbbt/util/misc.rb
CHANGED
@@ -47,8 +47,8 @@ module Misc
|
|
47
47
|
when FalseClass
|
48
48
|
value === FalseClass or (String === value and value.downcase == 'false')
|
49
49
|
when String
|
50
|
-
|
51
|
-
when
|
50
|
+
Numeric === value ? value.to_f == condition.to_f : value == condition
|
51
|
+
when Numeric
|
52
52
|
value.to_f == condition.to_f
|
53
53
|
when Array
|
54
54
|
case condition.first
|
@@ -45,7 +45,7 @@ module Misc
|
|
45
45
|
|
46
46
|
def self.hash2string(hash)
|
47
47
|
hash.sort_by{|k,v| k.to_s}.collect{|k,v|
|
48
|
-
next unless %w(Symbol String Float Fixnum Integer TrueClass FalseClass Module Class Object).include? v.class.to_s
|
48
|
+
next unless %w(Symbol String Float Fixnum Integer Numeric TrueClass FalseClass Module Class Object).include? v.class.to_s
|
49
49
|
[ Symbol === k ? ":" << k.to_s : k,
|
50
50
|
Symbol === v ? ":" << v.to_s : v] * "="
|
51
51
|
}.compact * "#"
|
@@ -62,7 +62,7 @@ module Misc
|
|
62
62
|
|
63
63
|
def self.hash2GET_params(hash)
|
64
64
|
hash.sort_by{|k,v| k.to_s}.collect{|k,v|
|
65
|
-
next unless %w(Symbol String Float Fixnum Integer TrueClass FalseClass Module Class Object Array).include? v.class.to_s
|
65
|
+
next unless %w(Symbol String Float Fixnum Integer Numeric TrueClass FalseClass Module Class Object Array).include? v.class.to_s
|
66
66
|
v = case
|
67
67
|
when Symbol === v
|
68
68
|
v.to_s
|
@@ -97,7 +97,7 @@ module Misc
|
|
97
97
|
[k,"'" << v.to_s << "'"] * "="
|
98
98
|
when TrueClass === v
|
99
99
|
[k,"'" << v.to_s << "'"] * "="
|
100
|
-
when
|
100
|
+
when Numeric === v
|
101
101
|
[k,"'" << v.to_s << "'"] * "="
|
102
102
|
else
|
103
103
|
nil
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbbt-util
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.21.
|
4
|
+
version: 5.21.86
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miguel Vazquez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-06-
|
11
|
+
date: 2017-06-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|