scout-essentials 1.6.0 → 1.6.2
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/.vimproject +2 -0
- data/VERSION +1 -1
- data/lib/scout/misc/digest.rb +1 -0
- data/lib/scout/misc/math.rb +13 -0
- data/lib/scout/misc/monitor.rb +1 -0
- data/lib/scout/named_array.rb +12 -3
- data/lib/scout/open/util.rb +1 -0
- data/lib/scout/path/digest.rb +13 -0
- data/lib/scout/path.rb +1 -0
- data/scout-essentials.gemspec +5 -3
- data/test/scout/misc/test_math.rb +6 -0
- data/test/scout/path/test_digest.rb +20 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a682bf691d2d27784726f6eb108223abc0cc62a3a289f5580ef3ec9a850daffa
|
4
|
+
data.tar.gz: ac4409c3954aeaa68bfb45844de8701c265b3e896fbe77bb51dfae953ad47035
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a9db53026e267d734499b85a2673933c43a7e549497fa76420872dff237fb2858da535fcd654c30153f5b78e4afc9568b884db0ca656f70f1a936d89cff570ab
|
7
|
+
data.tar.gz: 6868e8baf1d445bfc2aeebee9a0e0cb0c0f9e481e41ef87f3c670d2f9b628445fb8502b7a27a39decb445dabd4ff571145562f16fd0b477ae426d63e1a23d61b
|
data/.vimproject
CHANGED
@@ -50,6 +50,7 @@ scout-essentials=/$PWD filter="*.rb *.txt *.md *.conf *.yaml" {
|
|
50
50
|
find.rb
|
51
51
|
tmpfile.rb
|
52
52
|
util.rb
|
53
|
+
digest.rb
|
53
54
|
}
|
54
55
|
concurrent_stream.rb
|
55
56
|
cmd.rb
|
@@ -59,6 +60,7 @@ scout-essentials=/$PWD filter="*.rb *.txt *.md *.conf *.yaml" {
|
|
59
60
|
remote.rb
|
60
61
|
stream.rb
|
61
62
|
util.rb
|
63
|
+
bgzf.rb
|
62
64
|
}
|
63
65
|
resource.rb
|
64
66
|
resource=resource{
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.6.
|
1
|
+
1.6.2
|
data/lib/scout/misc/digest.rb
CHANGED
data/lib/scout/misc/math.rb
CHANGED
@@ -106,4 +106,17 @@ module Misc
|
|
106
106
|
sd = Misc.sd(list)
|
107
107
|
(e.to_f - m) / sd
|
108
108
|
end
|
109
|
+
|
110
|
+
def self.softmax(array)
|
111
|
+
# Compute the exponentials of the input array elements
|
112
|
+
exp_array = array.map { |x| Math.exp(x) }
|
113
|
+
|
114
|
+
# Sum of all exponentials
|
115
|
+
sum_exp = exp_array.sum
|
116
|
+
|
117
|
+
# Compute the softmax values by dividing each exponential by the sum of exponentials
|
118
|
+
softmax_array = exp_array.map { |x| x / sum_exp }
|
119
|
+
|
120
|
+
return softmax_array
|
121
|
+
end
|
109
122
|
end
|
data/lib/scout/misc/monitor.rb
CHANGED
data/lib/scout/named_array.rb
CHANGED
@@ -84,9 +84,18 @@ module NamedArray
|
|
84
84
|
|
85
85
|
|
86
86
|
def concat(other)
|
87
|
-
|
88
|
-
|
89
|
-
|
87
|
+
if Hash === other
|
88
|
+
new_fields = []
|
89
|
+
other.each do |k,v|
|
90
|
+
new_fields << k
|
91
|
+
self << v
|
92
|
+
end
|
93
|
+
self.fields.concat(new_fields)
|
94
|
+
else
|
95
|
+
super(other)
|
96
|
+
self.fields.concat(other.fields) if NamedArray === other
|
97
|
+
self
|
98
|
+
end
|
90
99
|
end
|
91
100
|
|
92
101
|
def to_hash
|
data/lib/scout/open/util.rb
CHANGED
@@ -0,0 +1,13 @@
|
|
1
|
+
require_relative '../misc/digest'
|
2
|
+
module Path
|
3
|
+
def digest_str
|
4
|
+
case
|
5
|
+
when File.directory?(self)
|
6
|
+
"Directory MD5: #{Misc.digest_str(Dir.glob(File.join(self, "*")))}"
|
7
|
+
when self.located? && File.exist?(self)
|
8
|
+
"File MD5: #{Misc.digest_file(self)}"
|
9
|
+
else
|
10
|
+
'\'' << self << '\''
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
data/lib/scout/path.rb
CHANGED
data/scout-essentials.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: scout-essentials 1.6.
|
5
|
+
# stub: scout-essentials 1.6.2 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "scout-essentials".freeze
|
9
|
-
s.version = "1.6.
|
9
|
+
s.version = "1.6.2".freeze
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib".freeze]
|
13
13
|
s.authors = ["Miguel Vazquez".freeze]
|
14
|
-
s.date = "2024-
|
14
|
+
s.date = "2024-07-01"
|
15
15
|
s.description = "Things a scout can use anywhere".freeze
|
16
16
|
s.email = "mikisvaz@gmail.com".freeze
|
17
17
|
s.extra_rdoc_files = [
|
@@ -63,6 +63,7 @@ Gem::Specification.new do |s|
|
|
63
63
|
"lib/scout/open/stream.rb",
|
64
64
|
"lib/scout/open/util.rb",
|
65
65
|
"lib/scout/path.rb",
|
66
|
+
"lib/scout/path/digest.rb",
|
66
67
|
"lib/scout/path/find.rb",
|
67
68
|
"lib/scout/path/tmpfile.rb",
|
68
69
|
"lib/scout/path/util.rb",
|
@@ -106,6 +107,7 @@ Gem::Specification.new do |s|
|
|
106
107
|
"test/scout/open/test_remote.rb",
|
107
108
|
"test/scout/open/test_stream.rb",
|
108
109
|
"test/scout/open/test_util.rb",
|
110
|
+
"test/scout/path/test_digest.rb",
|
109
111
|
"test/scout/path/test_find.rb",
|
110
112
|
"test/scout/path/test_util.rb",
|
111
113
|
"test/scout/persist/test_open.rb",
|
@@ -5,5 +5,11 @@ class TestMiscMath < Test::Unit::TestCase
|
|
5
5
|
def test_mean
|
6
6
|
assert_equal 4, Misc.mean([6,2])
|
7
7
|
end
|
8
|
+
|
9
|
+
def test_softmax
|
10
|
+
assert_equal 0.5, Misc.softmax([1,1]).first
|
11
|
+
assert Misc.softmax([1,2]).first < 0.5
|
12
|
+
assert Misc.softmax([2,1]).first > 0.5
|
13
|
+
end
|
8
14
|
end
|
9
15
|
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require File.expand_path(__FILE__).sub(%r(/test/.*), '/test/test_helper.rb')
|
2
|
+
require File.expand_path(__FILE__).sub(%r(.*/test/), '').sub(/test_(.*)\.rb/,'\1')
|
3
|
+
|
4
|
+
class TestClass < Test::Unit::TestCase
|
5
|
+
def test_digest_path
|
6
|
+
TmpFile.with_path("TEXT") do |file|
|
7
|
+
assert_include file.digest_str, "File MD5"
|
8
|
+
end
|
9
|
+
|
10
|
+
TmpFile.with_path do |dir|
|
11
|
+
Open.write(dir.test, "TEXT")
|
12
|
+
assert_include dir.digest_str, "Directory"
|
13
|
+
end
|
14
|
+
|
15
|
+
TmpFile.with_path do |file|
|
16
|
+
assert_include "'#{file}'", file.digest_str
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scout-essentials
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.
|
4
|
+
version: 1.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miguel Vazquez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-07-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: shoulda
|
@@ -160,6 +160,7 @@ files:
|
|
160
160
|
- lib/scout/open/stream.rb
|
161
161
|
- lib/scout/open/util.rb
|
162
162
|
- lib/scout/path.rb
|
163
|
+
- lib/scout/path/digest.rb
|
163
164
|
- lib/scout/path/find.rb
|
164
165
|
- lib/scout/path/tmpfile.rb
|
165
166
|
- lib/scout/path/util.rb
|
@@ -203,6 +204,7 @@ files:
|
|
203
204
|
- test/scout/open/test_remote.rb
|
204
205
|
- test/scout/open/test_stream.rb
|
205
206
|
- test/scout/open/test_util.rb
|
207
|
+
- test/scout/path/test_digest.rb
|
206
208
|
- test/scout/path/test_find.rb
|
207
209
|
- test/scout/path/test_util.rb
|
208
210
|
- test/scout/persist/test_open.rb
|