Class: DurableHuggingfaceHub::Types::DatasetInfo
- Includes:
- Loadable
- Defined in:
- lib/durable_huggingface_hub/types/dataset_info.rb
Overview
Information about a dataset repository on HuggingFace Hub.
This structure represents metadata about a dataset, including its ID, tags, files, statistics, and configuration.
Instance Attribute Summary collapse
-
#author ⇒ String?
readonly
Author/organization name.
-
#card_data ⇒ Hash?
readonly
Dataset card metadata.
-
#citation ⇒ String?
readonly
Citation information.
-
#created_at ⇒ Time?
readonly
Repository creation timestamp.
-
#description ⇒ String?
readonly
Dataset description.
-
#disabled ⇒ Boolean?
readonly
Whether the repository is disabled.
-
#downloads ⇒ Integer?
readonly
Total number of downloads.
-
#downloads_all_time ⇒ Integer?
readonly
Total number of downloads all time.
-
#gated ⇒ Boolean, ...
readonly
Gated access status.
-
#id ⇒ String
readonly
Dataset repository ID.
-
#last_modified ⇒ Time?
readonly
Timestamp of last modification.
-
#likes ⇒ Integer?
readonly
Number of likes/stars.
-
#paperswithcode_id ⇒ String?
readonly
PapersWithCode identifier.
-
#private ⇒ Boolean?
readonly
Whether the repository is private.
-
#sha ⇒ String?
readonly
Git commit SHA of the current revision.
-
#siblings ⇒ Array<Hash>?
readonly
List of files in the repository.
-
#tags ⇒ Array<String>
readonly
Tags associated with the dataset.
-
#trending_score ⇒ Integer?
readonly
Trending score.
Class Method Summary collapse
-
.from_hash(data) ⇒ Object
Transform API response to filter out unknown keys.
Instance Method Summary collapse
-
#disabled? ⇒ Boolean
Checks if the repository is disabled.
-
#file_names ⇒ Array<String>
File names.
-
#gated? ⇒ Boolean
Checks if the repository is gated.
-
#has_tag?(tag) ⇒ Boolean
Checks if the dataset has a specific tag.
-
#inspect ⇒ String
Returns a detailed inspection string.
-
#public? ⇒ Boolean
Checks if the repository is public.
-
#to_s ⇒ String
Returns a short description of the dataset.
Instance Attribute Details
#author ⇒ String? (readonly)
Returns Author/organization name.
69 |
# File 'lib/durable_huggingface_hub/types/dataset_info.rb', line 69 attribute :author, Types::OptionalString.default(nil) |
#card_data ⇒ Hash? (readonly)
Returns Dataset card metadata.
77 |
# File 'lib/durable_huggingface_hub/types/dataset_info.rb', line 77 attribute :card_data, Types::OptionalHash.default(nil) |
#citation ⇒ String? (readonly)
Returns Citation information.
85 |
# File 'lib/durable_huggingface_hub/types/dataset_info.rb', line 85 attribute :citation, Types::OptionalString.default(nil) |
#created_at ⇒ Time? (readonly)
Returns Repository creation timestamp.
73 |
# File 'lib/durable_huggingface_hub/types/dataset_info.rb', line 73 attribute :created_at, Types::OptionalTimestamp.default(nil) |
#description ⇒ String? (readonly)
Returns Dataset description.
81 |
# File 'lib/durable_huggingface_hub/types/dataset_info.rb', line 81 attribute :description, Types::OptionalString.default(nil) |
#disabled ⇒ Boolean? (readonly)
Returns Whether the repository is disabled.
57 |
# File 'lib/durable_huggingface_hub/types/dataset_info.rb', line 57 attribute :disabled, Types::OptionalBool.default(nil) |
#downloads ⇒ Integer? (readonly)
Returns Total number of downloads.
61 |
# File 'lib/durable_huggingface_hub/types/dataset_info.rb', line 61 attribute :downloads, Types::OptionalInteger.default(nil) |
#downloads_all_time ⇒ Integer? (readonly)
Returns Total number of downloads all time.
89 |
# File 'lib/durable_huggingface_hub/types/dataset_info.rb', line 89 attribute :downloads_all_time, Types::OptionalInteger.default(nil) |
#gated ⇒ Boolean, ... (readonly)
Returns Gated access status.
53 |
# File 'lib/durable_huggingface_hub/types/dataset_info.rb', line 53 attribute :gated, Types::OptionalGated.default(nil) |
#id ⇒ String (readonly)
Returns Dataset repository ID.
29 |
# File 'lib/durable_huggingface_hub/types/dataset_info.rb', line 29 attribute :id, Types::RepoId |
#last_modified ⇒ Time? (readonly)
Returns Timestamp of last modification.
37 |
# File 'lib/durable_huggingface_hub/types/dataset_info.rb', line 37 attribute :last_modified, Types::OptionalTimestamp.default(nil) |
#likes ⇒ Integer? (readonly)
Returns Number of likes/stars.
65 |
# File 'lib/durable_huggingface_hub/types/dataset_info.rb', line 65 attribute :likes, Types::OptionalInteger.default(nil) |
#paperswithcode_id ⇒ String? (readonly)
Returns PapersWithCode identifier.
93 |
# File 'lib/durable_huggingface_hub/types/dataset_info.rb', line 93 attribute :paperswithcode_id, Types::OptionalString.default(nil) |
#private ⇒ Boolean? (readonly)
Returns Whether the repository is private.
49 |
# File 'lib/durable_huggingface_hub/types/dataset_info.rb', line 49 attribute :private, Types::OptionalBool.default(nil) |
#sha ⇒ String? (readonly)
Returns Git commit SHA of the current revision.
33 |
# File 'lib/durable_huggingface_hub/types/dataset_info.rb', line 33 attribute :sha, Types::OptionalString.default(nil) |
#siblings ⇒ Array<Hash>? (readonly)
Returns List of files in the repository.
45 |
# File 'lib/durable_huggingface_hub/types/dataset_info.rb', line 45 attribute :siblings, Types::OptionalFileSiblings.default(nil) |
#tags ⇒ Array<String> (readonly)
Returns Tags associated with the dataset.
41 |
# File 'lib/durable_huggingface_hub/types/dataset_info.rb', line 41 attribute :tags, Types::StringArray.default([].freeze) |
#trending_score ⇒ Integer? (readonly)
Returns Trending score.
97 |
# File 'lib/durable_huggingface_hub/types/dataset_info.rb', line 97 attribute :trending_score, Types::OptionalInteger.default(nil) |
Class Method Details
.from_hash(data) ⇒ Object
Transform API response to filter out unknown keys
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/durable_huggingface_hub/types/dataset_info.rb', line 100 def self.from_hash(data) transformed = data.dup # Filter out unknown keys to avoid dry-struct errors known_keys = [:id, :sha, :last_modified, :tags, :siblings, :private, :gated, :disabled, :downloads, :likes, :author, :created_at, :card_data, :description, :citation, :downloads_all_time, :paperswithcode_id, :trending_score, "id", "sha", "last_modified", "tags", "siblings", "private", "gated", "disabled", "downloads", "likes", "author", "created_at", "card_data", "description", "citation", "downloads_all_time", "paperswithcode_id", "trending_score"] transformed = transformed.select { |k, _| known_keys.include?(k) } new(transformed) end |
Instance Method Details
#disabled? ⇒ Boolean
Checks if the repository is disabled.
156 157 158 |
# File 'lib/durable_huggingface_hub/types/dataset_info.rb', line 156 def disabled? disabled == true end |
#file_names ⇒ Array<String>
Returns File names.
120 121 122 123 124 |
# File 'lib/durable_huggingface_hub/types/dataset_info.rb', line 120 def file_names return [] if siblings.nil? siblings.map { |s| s[:rfilename] || s["rfilename"] }.compact end |
#gated? ⇒ Boolean
Checks if the repository is gated.
144 145 146 147 148 149 150 151 |
# File 'lib/durable_huggingface_hub/types/dataset_info.rb', line 144 def gated? case gated when true, "auto", "manual" true else false end end |
#has_tag?(tag) ⇒ Boolean
Checks if the dataset has a specific tag.
130 131 132 |
# File 'lib/durable_huggingface_hub/types/dataset_info.rb', line 130 def has_tag?(tag) .include?(tag) end |
#inspect ⇒ String
Returns a detailed inspection string.
170 171 172 173 |
# File 'lib/durable_huggingface_hub/types/dataset_info.rb', line 170 def inspect "#<#{self.class.name} id=#{id.inspect} sha=#{sha&.[](0, 7).inspect} " \ "tags=#{.size} files=#{siblings&.size || 0}>" end |
#public? ⇒ Boolean
Checks if the repository is public.
137 138 139 |
# File 'lib/durable_huggingface_hub/types/dataset_info.rb', line 137 def public? !private end |
#to_s ⇒ String
Returns a short description of the dataset.
163 164 165 |
# File 'lib/durable_huggingface_hub/types/dataset_info.rb', line 163 def to_s id end |