Class: Abliteration::Dataset

Inherits:
ApiModelBase show all
Defined in:
lib/abliteration/models/dataset.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 = {}) ⇒ Dataset

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
# File 'lib/abliteration/models/dataset.rb', line 162

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Abliteration::Dataset` 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::Dataset`. 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
end

Instance Attribute Details

#age_days ⇒ Object

Returns the value of attribute age_days.



48
49
50
# File 'lib/abliteration/models/dataset.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.rb', line 20

def author
  @author
end

#category ⇒ Object

Returns the value of attribute category.



24
25
26
# File 'lib/abliteration/models/dataset.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.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.rb', line 56

def description
  @description
end

#downloads ⇒ Object

Recent-window downloads reported by the Hub.



31
32
33
# File 'lib/abliteration/models/dataset.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.rb', line 34

def downloads_all
  @downloads_all
end

#first_seen_at ⇒ Object

Returns the value of attribute first_seen_at.



66
67
68
# File 'lib/abliteration/models/dataset.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.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.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.rb', line 18

def id
  @id
end

Server returns 0/1, not a JSON boolean.



51
52
53
# File 'lib/abliteration/models/dataset.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.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.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.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.rb', line 26

def license
  @license
end

#likes ⇒ Object

Returns the value of attribute likes.



36
37
38
# File 'lib/abliteration/models/dataset.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.rb', line 43

def main_size_bytes
  @main_size_bytes
end

#size_display ⇒ Object

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



46
47
48
# File 'lib/abliteration/models/dataset.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.rb', line 22

def slug
  @slug
end

#tags ⇒ Object

Returns the value of attribute tags.



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

def tags
  @tags
end

Returns the value of attribute trending_score.



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

def trending_score
  @trending_score
end

Class Method Details

.acceptable_attribute_map ⇒ Object

Returns attribute mapping this model knows about



97
98
99
# File 'lib/abliteration/models/dataset.rb', line 97

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributes ⇒ Object

Returns all the JSON keys this model knows about



102
103
104
# File 'lib/abliteration/models/dataset.rb', line 102

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_map ⇒ Object

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



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/abliteration/models/dataset.rb', line 69

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'
  }
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



326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
# File 'lib/abliteration/models/dataset.rb', line 326

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_nullable ⇒ Object

List of attributes with nullable: true



135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
# File 'lib/abliteration/models/dataset.rb', line 135

def self.openapi_nullable
  Set.new([
    :'author',
    :'slug',
    :'category',
    :'license',
    :'language',
    :'downloads',
    :'downloads_all',
    :'likes',
    :'trending_score',
    :'gated',
    :'main_size_bytes',
    :'size_display',
    :'age_days',
    :'is_trending',
    :'just_added',
    :'description',
    :'hf_url',
    :'created_at',
    :'last_modified_at',
    :'first_seen_at'
  ])
end

.openapi_types ⇒ Object

Attribute type mapping.



107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# File 'lib/abliteration/models/dataset.rb', line 107

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'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object) —

    to be compared



284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
# File 'lib/abliteration/models/dataset.rb', line 284

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
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object) —

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


313
314
315
# File 'lib/abliteration/models/dataset.rb', line 313

def eql?(o)
  self == o
end

#hash ⇒ Integer

Calculates hash code according to all attributes.

Returns:

  • (Integer) —

    Hash code



319
320
321
# File 'lib/abliteration/models/dataset.rb', line 319

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].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



269
270
271
272
273
# File 'lib/abliteration/models/dataset.rb', line 269

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



348
349
350
351
352
353
354
355
356
357
358
359
360
# File 'lib/abliteration/models/dataset.rb', line 348

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



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

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