rbbt-util 5.21.64 → 5.21.66

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: ee390df6f2ddf89732de28343a89e5997853547f
4
- data.tar.gz: ac029177dda7f0b1146c5ebadd3ef6785028f0c2
3
+ metadata.gz: 9ff21babc0504e17df0c48429ee4db81aebbac9a
4
+ data.tar.gz: 0c6ba9a55916f59bdc371510a696ec2a49582cbd
5
5
  SHA512:
6
- metadata.gz: 38322bb8dfccb2bdf40b89fffb43e4d1500fd1105fe5537b615040662e1075fac0e049b3fb5ed6a2cd5934f8f8d5daf2f5baccc828e46ff1417f7cb96ca2cdc3
7
- data.tar.gz: 3f28b826d350aee2f3bff57332f05ce33488e4eee3d4c805b823aab1f75310159180b57e58777438ff927480558ca7d3687257bdcf773633e429d9f4ea253dfc
6
+ metadata.gz: b34c51ad0a84893b4d809234d99e935a2d58c88fe89e04b76f9dee30c49d39f04844a7ad02dea30ac18bd98be611e226f500e2bb95248778f4689e437620a873
7
+ data.tar.gz: 50cb3f8b234f73a38bc406a2d328fafd2b87b83e9121e39a3885b52727c8649bcb0c456ae334f5a617343e595532d685aa567ba462942cfdc39e46c855fce68d
@@ -22,6 +22,7 @@ class WorkflowRESTClient
22
22
 
23
23
  def initialize(base_url, task = nil, base_name = nil, inputs = nil, result_type = nil, result_description = nil, is_exec = false, is_stream = false, stream_input = nil)
24
24
  @base_url, @task, @base_name, @inputs, @result_type, @result_description, @is_exec, @is_stream, @stream_input = base_url, task, base_name, inputs, result_type, result_description, is_exec, is_stream, stream_input
25
+ @base_url = "http://" << @base_url unless @base_url =~ /^https?:\/\//
25
26
  @mutex = Mutex.new
26
27
  end
27
28
 
data/lib/rbbt/tsv.rb CHANGED
@@ -161,6 +161,8 @@ module TSV
161
161
  data.serializer = :float
162
162
  when (parser.cast == :to_f and (parser.type == :list or parser.type == :flat))
163
163
  data.serializer = :float_array
164
+ else
165
+ data.serializer = :marshal
164
166
  end
165
167
  end
166
168
 
@@ -192,7 +192,7 @@ module TSV
192
192
 
193
193
 
194
194
  def attach(other, options = {})
195
- options = Misc.add_defaults options, :in_namespace => false, :persist_input => true
195
+ options = Misc.add_defaults options, :in_namespace => false, :persist_input => false
196
196
  fields, one2one, complete = Misc.process_options options, :fields, :one2one, :complete
197
197
  in_namespace = options[:in_namespace]
198
198
 
@@ -202,7 +202,7 @@ module TSV
202
202
  other.identifiers ||= other_identifier_file
203
203
  end
204
204
 
205
- fields = other.fields - [key_field].concat(self.fields) if fields.nil? or fields == :all
205
+ fields = other.fields - [key_field].concat(self.fields) if other.fields and (fields.nil? or fields == :all)
206
206
  if in_namespace
207
207
  fields = other.fields_in_namespace - [key_field].concat(self.fields) if fields.nil?
208
208
  else
@@ -0,0 +1,58 @@
1
+ module AnnotatedModule
2
+
3
+ def self.add_consummable_annotation(target, *annotations)
4
+ if annotations.length == 1 and Hash === annotations.first
5
+ annotations.first.each do |annotation, default|
6
+ target.send(:attr_accessor, annotation)
7
+ target.send(:define_method, "consume_#{annotation}") do
8
+ value = instance_variable_get("@#{annotation}") || default.dup
9
+ instance_variable_set("@#{annotation}", default.dup)
10
+ value
11
+ end
12
+ end
13
+ else
14
+ annotations.each do |annotation|
15
+ target.send(:attr_accessor, annotation)
16
+ target.send(:define_method, "consume_#{annotation}") do
17
+ value = instance_variable_get("@#{annotation}")
18
+ instance_variable_set("@#{annotation}", nil)
19
+ end
20
+ end
21
+ end
22
+ end
23
+
24
+ end
25
+
26
+
27
+ module InputModule
28
+ AnnotatedModule.add_consummable_annotation(self,
29
+ :inputs => [],
30
+ :required_inputs => [],
31
+ :input_types => {},
32
+ :input_descriptions => {},
33
+ :input_defaults => {},
34
+ :input_options => {})
35
+
36
+ def input(name, type = nil, desc = nil, default = nil, options = nil)
37
+ name = name.to_sym
38
+ type = type.to_sym
39
+
40
+ @inputs = [] if @inputs.nil?
41
+ @input_types = {} if @input_types.nil?
42
+ @input_descriptions = {} if @input_descriptions.nil?
43
+ @input_defaults = {} if @input_defaults.nil?
44
+ @input_options = {} if @input_options.nil?
45
+ @required_inputs = [] if @required_inputs.nil?
46
+
47
+ required = Misc.process_options options, :required if options
48
+ required, default = true, nil if default == :required
49
+ @required_inputs << name if required
50
+
51
+ @inputs << name
52
+ @input_types[name] = type unless type.nil?
53
+ @input_descriptions[name] = desc unless desc.nil?
54
+ @input_defaults[name] = default unless default.nil?
55
+ @input_options[name] = options unless options.nil?
56
+
57
+ end
58
+ end
@@ -21,35 +21,4 @@ module AnnotatedModule
21
21
  end
22
22
  end
23
23
 
24
- add_consummable_annotation(self,
25
- :description => "",
26
- :inputs => [],
27
- :required_inputs => [],
28
- :input_types => {},
29
- :input_descriptions => {},
30
- :input_defaults => {},
31
- :input_options => {})
32
-
33
- def input(name, type = nil, desc = nil, default = nil, options = nil)
34
- name = name.to_sym
35
- type = type.to_sym
36
-
37
- @inputs = [] if @inputs.nil?
38
- @input_types = {} if @input_types.nil?
39
- @input_descriptions = {} if @input_descriptions.nil?
40
- @input_defaults = {} if @input_defaults.nil?
41
- @input_options = {} if @input_options.nil?
42
- @required_inputs = [] if @required_inputs.nil?
43
-
44
- required = Misc.process_options options, :required if options
45
- required, default = true, nil if default == :required
46
- @required_inputs << name if required
47
-
48
- @inputs << name
49
- @input_types[name] = type unless type.nil?
50
- @input_descriptions[name] = desc unless desc.nil?
51
- @input_defaults[name] = default unless default.nil?
52
- @input_options[name] = options unless options.nil?
53
-
54
- end
55
24
  end
@@ -1,8 +1,7 @@
1
1
  require 'rbbt-util'
2
- require 'rbbt/workflow/annotate'
2
+ require 'rbbt/util/misc/annotated_module'
3
3
 
4
4
  module Workflow
5
- include AnnotatedModule
6
5
 
7
6
  module DependencyBlock
8
7
  attr_accessor :dependency
@@ -13,11 +12,15 @@ module Workflow
13
12
  end
14
13
  end
15
14
 
15
+ include InputModule
16
16
  AnnotatedModule.add_consummable_annotation(self,
17
- :result_description => "",
18
- :result_type => nil,
19
- :extension => '',
20
- :dependencies => [])
17
+ :dependencies => [],
18
+ :description => "",
19
+ :result_type => nil,
20
+ :result_description => "",
21
+ :extension => '')
22
+
23
+
21
24
  def helper(name, &block)
22
25
  helpers[name] = block
23
26
  end
@@ -32,7 +32,7 @@ module Workflow
32
32
  file = dir[input].find
33
33
  file = dir.glob(input.to_s + ".*").first if file.nil? or not file.exists?
34
34
  Log.debug "Trying #{ input }: #{file}"
35
- next unless file.exists?
35
+ next unless file and file.exists?
36
36
 
37
37
  case input_types[input]
38
38
  when :tsv, :array, :text, :file
data/share/config.ru CHANGED
@@ -70,6 +70,10 @@ load_file Rbbt.etc['app.d/preload.rb'].find_all
70
70
  #{{{ SINATRA
71
71
  load_file Rbbt.lib['sinatra.rb'].find_all
72
72
 
73
+ Entity.entity_list_cache = Rbbt.var.sinatra.app[app_name].find.entity_lists
74
+ Entity.entity_map_cache = Rbbt.var.sinatra.app[app_name].find.entity_maps
75
+ Entity.entity_property_cache = Rbbt.var.sinatra.app[app_name].find.entity_properties
76
+
73
77
  #{{{ RUN
74
78
 
75
79
  Sinatra::RbbtRESTMain.add_resource_path($app_dir.www.views.find, true)
@@ -72,4 +72,17 @@ class TestPersistTSV < Test::Unit::TestCase
72
72
  engine = "LMDB"
73
73
  run_bechmark(tsv_path, engine)
74
74
  end
75
+
76
+ def test_tsv_persist
77
+ content =<<-EOF
78
+ #: :cast=:to_f
79
+ #Key Value1 Value2
80
+ k1 1.1 2.1
81
+ k2 1.2 2.2
82
+ EOF
83
+ TmpFile.with_file(content) do |tsv_file|
84
+ tsv = TSV.open(tsv_file, :sep => " ", :persist => true, :type => :double, :merge => true)
85
+ iii tsv["k1"]
86
+ end
87
+ end
75
88
  end
@@ -240,7 +240,7 @@ class TestPersistTSVTC < Test::Unit::TestCase
240
240
  end
241
241
  end
242
242
 
243
- def test_fdb
243
+ def __test_fdb
244
244
  TmpFile.with_file do |tmp|
245
245
  repo = Persist.open_tokyocabinet(tmp, true, :list, TokyoCabinet::FDB)
246
246
  repo.write
@@ -350,7 +350,7 @@ b 2
350
350
  EOF
351
351
 
352
352
  TmpFile.with_file(content) do |filename|
353
- tsv = TSV.open(filename, :key_field => "Value", :grep => "#\\|2")
353
+ tsv = TSV.open(filename, :key_field => "Value", :grep => '2')
354
354
  assert(tsv.include?("2"))
355
355
  assert(! tsv.include?("7"))
356
356
  end
@@ -444,6 +444,10 @@ eum fugiat quo voluptas nulla pariatur?"
444
444
  ppp Misc.html_tag('textarea', "hola\nadios\nagain")
445
445
  end
446
446
 
447
+ def test_link_title
448
+ ppp Misc.html_tag('a', "hola\nadios\nagain", :title => "Hola adios")
449
+ end
450
+
447
451
  def __test_lock_fd
448
452
  require 'rbbt/workflow'
449
453
  Rbbt.var.jobs.Structure.neighbour_map.glob("*")[0..1000].each do |file|
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.64
4
+ version: 5.21.66
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-01-11 00:00:00.000000000 Z
11
+ date: 2017-01-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -281,6 +281,7 @@ files:
281
281
  - lib/rbbt/util/log/progress/report.rb
282
282
  - lib/rbbt/util/log/progress/util.rb
283
283
  - lib/rbbt/util/misc.rb
284
+ - lib/rbbt/util/misc/annotated_module.rb
284
285
  - lib/rbbt/util/misc/bgzf.rb
285
286
  - lib/rbbt/util/misc/concurrent_stream.rb
286
287
  - lib/rbbt/util/misc/development.rb