Class: Abliteration::DatasetDetail

Inherits:
ApiModelBase show all
Defined in:
lib/abliteration/models/dataset_detail.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiModelBase

_deserialize, #_to_hash, #to_body, #to_s

Constructor Details

#initialize(attributes = {}) ⇒ DatasetDetail

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {}) —

    Model attributes in the form of hash



159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
# File 'lib/abliteration/models/dataset_detail.rb', line 159

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Abliteration::DatasetDetail` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  acceptable_attribute_map = self.class.acceptable_attribute_map
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!acceptable_attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `Abliteration::DatasetDetail`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'id')
    self.id = attributes[:'id']
  end

  if attributes.key?(:'author')
    self.author = attributes[:'author']
  end

  if attributes.key?(:'slug')
    self.slug = attributes[:'slug']
  end

  if attributes.key?(:'category')
    self.category = attributes[:'category']
  end

  if attributes.key?(:'license')
    self.license = attributes[:'license']
  end

  if attributes.key?(:'language')
    self.language = attributes[:'language']
  end

  if attributes.key?(:'downloads')
    self.downloads = attributes[:'downloads']
  end

  if attributes.key?(:'downloads_all')
    self.downloads_all = attributes[:'downloads_all']
  end

  if attributes.key?(:'likes')
    self.likes = attributes[:'likes']
  end

  if attributes.key?(:'trending_score')
    self.trending_score = attributes[:'trending_score']
  end

  if attributes.key?(:'gated')
    self.gated = attributes[:'gated']
  end

  if attributes.key?(:'main_size_bytes')
    self.main_size_bytes = attributes[:'main_size_bytes']
  end

  if attributes.key?(:'size_display')
    self.size_display = attributes[:'size_display']
  end

  if attributes.key?(:'age_days')
    self.age_days = attributes[:'age_days']
  end

  if attributes.key?(:'is_trending')
    self.is_trending = attributes[:'is_trending']
  end

  if attributes.key?(:'just_added')
    self.just_added = attributes[:'just_added']
  end

  if attributes.key?(:'description')
    self.description = attributes[:'description']
  end

  if attributes.key?(:'tags')
    if (value = attributes[:'tags']).is_a?(Array)
      self.tags = value
    end
  end

  if attributes.key?(:'hf_url')
    self.hf_url = attributes[:'hf_url']
  end

  if attributes.key?(:'created_at')
    self.created_at = attributes[:'created_at']
  end

  if attributes.key?(:'last_modified_at')
    self.last_modified_at = attributes[:'last_modified_at']
  end

  if attributes.key?(:'first_seen_at')
    self.first_seen_at = attributes[:'first_seen_at']
  end

  if attributes.key?(:'files')
    if (value = attributes[:'files']).is_a?(Array)
      self.files = value
    end
  end

  if attributes.key?(:'passport')
    self.passport = attributes[:'passport']
  end
end

Instance Attribute Details

#age_days ⇒ Object

Returns the value of attribute age_days.



48
49
50
# File 'lib/abliteration/models/dataset_detail.rb', line 48

def age_days
  @age_days
end

#author ⇒ Object

Returns the value of attribute author.



20
21
22
# File 'lib/abliteration/models/dataset_detail.rb', line 20

def author
  @author
end

#category ⇒ Object

Returns the value of attribute category.



24
25
26
# File 'lib/abliteration/models/dataset_detail.rb', line 24

def category
  @category
end

#created_at ⇒ Object

Returns the value of attribute created_at.



62
63
64
# File 'lib/abliteration/models/dataset_detail.rb', line 62

def created_at
  @created_at
end

#description ⇒ Object

Returns the value of attribute description.



56
57
58
# File 'lib/abliteration/models/dataset_detail.rb', line 56

def description
  @description
end

#downloads ⇒ Object

Recent-window downloads reported by the Hub.



31
32
33
# File 'lib/abliteration/models/dataset_detail.rb', line 31

def downloads
  @downloads
end

#downloads_all ⇒ Object

All-time downloads reported by the Hub.



34
35
36
# File 'lib/abliteration/models/dataset_detail.rb', line 34

def downloads_all
  @downloads_all
end

#files ⇒ Object

Per-file entries: path, type, size_bytes, is_lfs.



69
70
71
# File 'lib/abliteration/models/dataset_detail.rb', line 69

def files
  @files
end

#first_seen_at ⇒ Object

Returns the value of attribute first_seen_at.



66
67
68
# File 'lib/abliteration/models/dataset_detail.rb', line 66

def first_seen_at
  @first_seen_at
end

#gated ⇒ Object

Server returns 0/1 (SQLite bool convention), not a JSON boolean.



41
42
43
# File 'lib/abliteration/models/dataset_detail.rb', line 41

def gated
  @gated
end

#hf_url ⇒ Object

Returns the value of attribute hf_url.



60
61
62
# File 'lib/abliteration/models/dataset_detail.rb', line 60

def hf_url
  @hf_url
end

#id ⇒ Object

Returns the value of attribute id.



18
19
20
# File 'lib/abliteration/models/dataset_detail.rb', line 18

def id
  @id
end

Server returns 0/1, not a JSON boolean.



51
52
53
# File 'lib/abliteration/models/dataset_detail.rb', line 51

def is_trending
  @is_trending
end

#just_added ⇒ Object

Server returns 0/1, not a JSON boolean.



54
55
56
# File 'lib/abliteration/models/dataset_detail.rb', line 54

def just_added
  @just_added
end

#language ⇒ Object

Returns the value of attribute language.



28
29
30
# File 'lib/abliteration/models/dataset_detail.rb', line 28

def language
  @language
end

#last_modified_at ⇒ Object

Returns the value of attribute last_modified_at.



64
65
66
# File 'lib/abliteration/models/dataset_detail.rb', line 64

def last_modified_at
  @last_modified_at
end

#license ⇒ Object

Returns the value of attribute license.



26
27
28
# File 'lib/abliteration/models/dataset_detail.rb', line 26

def license
  @license
end

#likes ⇒ Object

Returns the value of attribute likes.



36
37
38
# File 'lib/abliteration/models/dataset_detail.rb', line 36

def likes
  @likes
end

#main_size_bytes ⇒ Object

Returns the value of attribute main_size_bytes.



43
44
45
# File 'lib/abliteration/models/dataset_detail.rb', line 43

def main_size_bytes
  @main_size_bytes
end

#passport ⇒ Object

Returns the value of attribute passport.



71
72
73
# File 'lib/abliteration/models/dataset_detail.rb', line 71

def passport
  @passport
end

#size_display ⇒ Object

Human-formatted size (e.g. "90.4 MB").



46
47
48
# File 'lib/abliteration/models/dataset_detail.rb', line 46

def size_display
  @size_display
end

#slug ⇒ Object

Returns the value of attribute slug.



22
23
24
# File 'lib/abliteration/models/dataset_detail.rb', line 22

def slug
  @slug
end

#tags ⇒ Object

Returns the value of attribute tags.



58
59
60
# File 'lib/abliteration/models/dataset_detail.rb', line 58

def tags
  @tags
end

Returns the value of attribute trending_score.



38
39
40
# File 'lib/abliteration/models/dataset_detail.rb', line 38

def trending_score
  @trending_score
end

Class Method Details

.acceptable_attribute_map ⇒ Object

Returns attribute mapping this model knows about



104
105
106
# File 'lib/abliteration/models/dataset_detail.rb', line 104

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributes ⇒ Object

Returns all the JSON keys this model knows about



109
110
111
# File 'lib/abliteration/models/dataset_detail.rb', line 109

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_map ⇒ Object

Attribute mapping from ruby-style variable name to JSON key.



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/abliteration/models/dataset_detail.rb', line 74

def self.attribute_map
  {
    :'id' => :'id',
    :'author' => :'author',
    :'slug' => :'slug',
    :'category' => :'category',
    :'license' => :'license',
    :'language' => :'language',
    :'downloads' => :'downloads',
    :'downloads_all' => :'downloads_all',
    :'likes' => :'likes',
    :'trending_score' => :'trending_score',
    :'gated' => :'gated',
    :'main_size_bytes' => :'main_size_bytes',
    :'size_display' => :'size_display',
    :'age_days' => :'age_days',
    :'is_trending' => :'is_trending',
    :'just_added' => :'just_added',
    :'description' => :'description',
    :'tags' => :'tags',
    :'hf_url' => :'hf_url',
    :'created_at' => :'created_at',
    :'last_modified_at' => :'last_modified_at',
    :'first_seen_at' => :'first_seen_at',
    :'files' => :'files',
    :'passport' => :'passport'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash) —

    Model attributes in the form of hash

Returns:

  • (Object) —

    Returns the model itself



335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
# File 'lib/abliteration/models/dataset_detail.rb', line 335

def self.build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  transformed_hash = {}
  openapi_types.each_pair do |key, type|
    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = nil
    elsif type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[attribute_map[key]].is_a?(Array)
        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
      end
    elsif !attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    end
  end
  new(transformed_hash)
end

.openapi_all_of ⇒ Object

List of class defined in allOf (OpenAPI v3)



151
152
153
154
155
# File 'lib/abliteration/models/dataset_detail.rb', line 151

def self.openapi_all_of
  [
  :'Dataset'
  ]
end

.openapi_nullable ⇒ Object

List of attributes with nullable: true



144
145
146
147
148
# File 'lib/abliteration/models/dataset_detail.rb', line 144

def self.openapi_nullable
  Set.new([
    :'passport'
  ])
end

.openapi_types ⇒ Object

Attribute type mapping.



114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# File 'lib/abliteration/models/dataset_detail.rb', line 114

def self.openapi_types
  {
    :'id' => :'String',
    :'author' => :'String',
    :'slug' => :'String',
    :'category' => :'String',
    :'license' => :'String',
    :'language' => :'String',
    :'downloads' => :'Integer',
    :'downloads_all' => :'Integer',
    :'likes' => :'Integer',
    :'trending_score' => :'Integer',
    :'gated' => :'Integer',
    :'main_size_bytes' => :'Integer',
    :'size_display' => :'String',
    :'age_days' => :'Integer',
    :'is_trending' => :'Integer',
    :'just_added' => :'Integer',
    :'description' => :'String',
    :'tags' => :'Array<String>',
    :'hf_url' => :'String',
    :'created_at' => :'String',
    :'last_modified_at' => :'String',
    :'first_seen_at' => :'String',
    :'files' => :'Array<Object>',
    :'passport' => :'Passport'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object) —

    to be compared



291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
# File 'lib/abliteration/models/dataset_detail.rb', line 291

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      id == o.id &&
      author == o.author &&
      slug == o.slug &&
      category == o.category &&
      license == o.license &&
      language == o.language &&
      downloads == o.downloads &&
      downloads_all == o.downloads_all &&
      likes == o.likes &&
      trending_score == o.trending_score &&
      gated == o.gated &&
      main_size_bytes == o.main_size_bytes &&
      size_display == o.size_display &&
      age_days == o.age_days &&
      is_trending == o.is_trending &&
      just_added == o.just_added &&
      description == o.description &&
      tags == o.tags &&
      hf_url == o.hf_url &&
      created_at == o.created_at &&
      last_modified_at == o.last_modified_at &&
      first_seen_at == o.first_seen_at &&
      files == o.files &&
      passport == o.passport
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object) —

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


322
323
324
# File 'lib/abliteration/models/dataset_detail.rb', line 322

def eql?(o)
  self == o
end

#hash ⇒ Integer

Calculates hash code according to all attributes.

Returns:

  • (Integer) —

    Hash code



328
329
330
# File 'lib/abliteration/models/dataset_detail.rb', line 328

def hash
  [id, author, slug, category, license, language, downloads, downloads_all, likes, trending_score, gated, main_size_bytes, size_display, age_days, is_trending, just_added, description, tags, hf_url, created_at, last_modified_at, first_seen_at, files, passport].hash
end

#list_invalid_properties ⇒ Object

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



276
277
278
279
280
# File 'lib/abliteration/models/dataset_detail.rb', line 276

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  invalid_properties
end

#to_hash ⇒ Hash

Returns the object in the form of hash

Returns:

  • (Hash) —

    Returns the object in the form of hash



357
358
359
360
361
362
363
364
365
366
367
368
369
# File 'lib/abliteration/models/dataset_detail.rb', line 357

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end

#valid? ⇒ Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean) —

    true if the model is valid



284
285
286
287
# File 'lib/abliteration/models/dataset_detail.rb', line 284

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  true
end