kaba 0.2.1 → 0.2.3

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
  SHA256:
3
- metadata.gz: 73fe981d3fc1a765b78b603f5f04ee8cd23514cc620f601e437363b158362d8b
4
- data.tar.gz: bac9dcf38f519286ac2d9d1fd2b24ff3f1c2dabf3a0c85a93b761394f6d13db8
3
+ metadata.gz: '0819a2ca5b94fd6ce32a48fc973dd86d0c2234a073bf32ee9327e02f572b45b2'
4
+ data.tar.gz: 203c7c8cfcc4d1d059c01b01467f8b897580c4422d25db85335a2b119e674401
5
5
  SHA512:
6
- metadata.gz: 5f60669e92bc3851fe7c481d2271d64cca8cfc1c1e67ffeb2e6ce24c0749171366360b330cfa7e9453e1a30876fbfcdc2c41cd42ef5de97a1a3a31e1000d4f35
7
- data.tar.gz: 2139393a5569187cb8d7b5a32d9a641b33f26b93ac0c8b799ac991aad2db965db8d755d23850895af16f95c15518a8b9f6ca58df6d16e1497763c58d0498a071
6
+ metadata.gz: 8abc31a51664418d2c8df17d2ff370c71b3124df3eb4cd17b9f05d3162e75b7fe76945986e47ae6415d0d43147be83c9627a41e9b9f7181623dcb752e91a0873
7
+ data.tar.gz: cc4078a6d7b4205d4403a4451ec95d4020c354809332788c755f0d2a2f6381f3d36d5206f96f7b04312a7ddf72348c2fadcf8ee519e63be4bcd730a76761b3bd
data/exe/kaba CHANGED
@@ -1,12 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  require "bundler/setup"
3
3
 
4
- require 'async'
5
- require 'faraday'
6
- require 'colorize'
7
- require 'tty-progressbar'
8
- require 'async/http/faraday'
9
-
10
4
  require 'json'
11
5
  require "kaba"
12
6
 
@@ -25,10 +19,5 @@ class Application
25
19
  end
26
20
  end
27
21
 
28
- def ddbug
29
- require 'irb'
30
- binding.irb
31
- end
32
-
33
22
  # 运行 DPodfile 文件,DPodfile 是一个 Ruby 文件
34
23
  load DatasetSource.podfile
data/lib/kaba/_DPodfile_ CHANGED
@@ -1,5 +1,5 @@
1
1
  ## 使用 Ruby 语言编写的数据集校验脚本
2
- # ddbug 断点调试
2
+ # binding.irb 断点调试
3
3
  # 使用 colorize 来输出带颜色的信息,https://github.com/fazibear/colorize
4
4
  # 使用 progressbar 来显示进度条,https://github.com/piotrmurach/tty-progressbar
5
5
  # 设置数据集目录, 如果使用 Docker 方式运行,需要将数据集挂载到 /data 目录下,DatasetSource 会自动加载 /data 目录下的数据集
@@ -24,6 +24,8 @@ validate.run_files(source.row)
24
24
  dataset.scan()
25
25
  dataset.save(source.join('train.jsonl'))
26
26
 
27
+ puts "Dataset 校验结果:#{dataset.validate}"
28
+
27
29
  ## 高级玩法,不要轻易尝试
28
30
  #
29
31
  ### 可以加入 limit 来限制读取的文件数量,validate.run_files('./data/row', limit: 1) do |response, json, file|
data/lib/kaba/validate.rb CHANGED
@@ -18,7 +18,7 @@ class Validate
18
18
  # 读取某个文件然后运行
19
19
  def run_file(file)
20
20
  input = JSON.parse File.read(File.expand_path file)
21
- ValidateReponse.new run(input)
21
+ ValidateReponse.new run(input), file: file
22
22
  end
23
23
 
24
24
  # 读取某个文件夹下的然后运行,运行有结果了 block 会被调用
@@ -75,8 +75,8 @@ class Validate
75
75
 
76
76
  def to_s
77
77
  s = "#{'success:'.colorize(:bold_blue)} #{success? ? 'true'.colorize(:green) : 'false'.colorize(:red)}"
78
- s += "\n#{'file:'.colorize(:bold_blue)} #{file.colorize(:yellow)}"
79
- s += "\n#{'message:'.colorize(:bold_blue)} #{message.colorize(:yellow)}" unless success?
78
+ s += "\n#{'file:'.colorize(:bold_blue)} #{file&.to_s&.colorize(:yellow)}"
79
+ s += "\n#{'message:'.colorize(:bold_blue)} #{message&.colorize(:yellow)}" unless success?
80
80
  s += "\n\n"
81
81
  end
82
82
  end
data/lib/kaba/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Kaba
4
- VERSION = "0.2.1"
4
+ VERSION = "0.2.3"
5
5
  end
data/lib/kaba.rb CHANGED
@@ -1,5 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'async'
4
+ require 'faraday'
5
+ require 'colorize'
6
+ require 'tty-progressbar'
7
+ require 'async/http/faraday'
8
+
3
9
  require_relative "kaba/version"
4
10
  require_relative "kaba/dataset"
5
11
  require_relative "kaba/dataset_source"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kaba
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - MJ
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-11-13 00:00:00.000000000 Z
11
+ date: 2024-11-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: async