Skip to content

Commit 5eac2d1

Browse files
fix: bump sorbet version and fix new type errors from the breaking change
1 parent feb82d3 commit 5eac2d1

File tree

9 files changed

+68
-70
lines changed

9 files changed

+68
-70
lines changed

.rubocop.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ Naming/ClassAndModuleCamelCase:
149149
Naming/MethodParameterName:
150150
Enabled: false
151151

152-
Naming/PredicateName:
152+
Naming/PredicatePrefix:
153153
Exclude:
154154
- "**/*.rbi"
155155

Gemfile.lock

Lines changed: 51 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ PATH
1717
GEM
1818
remote: https://rubygems.org/
1919
specs:
20-
activesupport (8.0.2)
20+
activesupport (8.0.2.1)
2121
base64
2222
benchmark (>= 0.3)
2323
bigdecimal
@@ -33,45 +33,50 @@ GEM
3333
addressable (2.8.7)
3434
public_suffix (>= 2.0.2, < 7.0)
3535
ast (2.4.3)
36-
async (2.24.0)
36+
async (2.27.3)
3737
console (~> 1.29)
3838
fiber-annotation
39-
io-event (~> 1.9)
39+
io-event (~> 1.11)
4040
metrics (~> 0.12)
4141
traces (~> 0.15)
42-
base64 (0.2.0)
43-
benchmark (0.4.0)
44-
bigdecimal (3.1.9)
42+
base64 (0.3.0)
43+
benchmark (0.4.1)
44+
bigdecimal (3.2.2)
4545
concurrent-ruby (1.3.5)
4646
connection_pool (2.5.3)
47-
console (1.30.2)
47+
console (1.33.0)
4848
fiber-annotation
4949
fiber-local (~> 1.1)
5050
json
5151
crack (1.0.0)
5252
bigdecimal
5353
rexml
54-
csv (3.3.4)
55-
drb (2.2.1)
54+
csv (3.3.5)
55+
drb (2.2.3)
5656
erubi (1.13.1)
57+
ffi (1.17.2-aarch64-linux-gnu)
58+
ffi (1.17.2-aarch64-linux-musl)
59+
ffi (1.17.2-arm64-darwin)
60+
ffi (1.17.2-x86_64-darwin)
5761
ffi (1.17.2-x86_64-linux-gnu)
62+
ffi (1.17.2-x86_64-linux-musl)
5863
fiber-annotation (0.2.0)
5964
fiber-local (1.1.0)
6065
fiber-storage
6166
fiber-storage (1.0.1)
6267
fileutils (1.7.3)
63-
hashdiff (1.1.2)
68+
hashdiff (1.2.0)
6469
i18n (1.14.7)
6570
concurrent-ruby (~> 1.0)
66-
io-event (1.10.0)
67-
json (2.11.3)
68-
language_server-protocol (3.17.0.4)
71+
io-event (1.11.2)
72+
json (2.13.2)
73+
language_server-protocol (3.17.0.5)
6974
lint_roller (1.1.0)
7075
listen (3.9.0)
7176
rb-fsevent (~> 0.10, >= 0.10.3)
7277
rb-inotify (~> 0.9, >= 0.9.10)
7378
logger (1.7.0)
74-
metrics (0.12.2)
79+
metrics (0.13.0)
7580
minitest (5.25.5)
7681
minitest-focus (1.4.0)
7782
minitest (>= 4, < 6)
@@ -84,54 +89,56 @@ GEM
8489
mutex_m (0.3.0)
8590
netrc (0.11.0)
8691
parallel (1.27.0)
87-
parser (3.3.8.0)
92+
parser (3.3.9.0)
8893
ast (~> 2.4.1)
8994
racc
9095
prettier_print (1.2.1)
9196
prism (1.4.0)
9297
public_suffix (6.0.2)
9398
racc (1.8.1)
9499
rainbow (3.1.1)
95-
rake (13.2.1)
100+
rake (13.3.0)
96101
rb-fsevent (0.11.2)
97102
rb-inotify (0.11.1)
98103
ffi (~> 1.0)
99-
rbi (0.3.2)
104+
rbi (0.3.6)
100105
prism (~> 1.0)
101106
rbs (>= 3.4.4)
102-
sorbet-runtime (>= 0.5.9204)
103-
rbs (3.9.2)
107+
rbs (3.9.4)
104108
logger
105109
redcarpet (3.6.1)
106-
regexp_parser (2.10.0)
110+
regexp_parser (2.11.2)
107111
rexml (3.4.1)
108-
rubocop (1.75.5)
112+
rubocop (1.79.2)
109113
json (~> 2.3)
110114
language_server-protocol (~> 3.17.0.2)
111115
lint_roller (~> 1.1.0)
112116
parallel (~> 1.10)
113117
parser (>= 3.3.0.2)
114118
rainbow (>= 2.2.2, < 4.0)
115119
regexp_parser (>= 2.9.3, < 3.0)
116-
rubocop-ast (>= 1.44.0, < 2.0)
120+
rubocop-ast (>= 1.46.0, < 2.0)
117121
ruby-progressbar (~> 1.7)
118122
unicode-display_width (>= 2.4.0, < 4.0)
119-
rubocop-ast (1.44.1)
123+
rubocop-ast (1.46.0)
120124
parser (>= 3.3.7.2)
121125
prism (~> 1.4)
122126
ruby-progressbar (1.13.0)
123127
securerandom (0.4.1)
124-
sorbet (0.5.12067)
125-
sorbet-static (= 0.5.12067)
126-
sorbet-runtime (0.5.12067)
127-
sorbet-static (0.5.12067-x86_64-linux)
128-
sorbet-static-and-runtime (0.5.12067)
129-
sorbet (= 0.5.12067)
130-
sorbet-runtime (= 0.5.12067)
131-
spoom (1.6.1)
128+
sorbet (0.5.12424)
129+
sorbet-static (= 0.5.12424)
130+
sorbet-runtime (0.5.12424)
131+
sorbet-static (0.5.12424-aarch64-linux)
132+
sorbet-static (0.5.12424-universal-darwin)
133+
sorbet-static (0.5.12424-x86_64-linux)
134+
sorbet-static-and-runtime (0.5.12424)
135+
sorbet (= 0.5.12424)
136+
sorbet-runtime (= 0.5.12424)
137+
spoom (1.6.3)
132138
erubi (>= 1.10.0)
133139
prism (>= 0.28.0)
134-
rbi (>= 0.2.3)
140+
rbi (>= 0.3.3)
141+
rexml (>= 3.2.6)
135142
sorbet-static-and-runtime (>= 0.5.10187)
136143
thor (>= 0.19.2)
137144
steep (1.10.0)
@@ -152,7 +159,7 @@ GEM
152159
terminal-table (>= 2, < 5)
153160
uri (>= 0.12.0)
154161
strscan (3.1.5)
155-
syntax_tree (6.2.0)
162+
syntax_tree (6.3.0)
156163
prettier_print (>= 1.2.0)
157164
tapioca (0.16.11)
158165
benchmark
@@ -166,11 +173,11 @@ GEM
166173
yard-sorbet
167174
terminal-table (4.0.0)
168175
unicode-display_width (>= 1.1.1, < 4)
169-
thor (1.3.2)
170-
traces (0.15.2)
176+
thor (1.4.0)
177+
traces (0.17.0)
171178
tzinfo (2.0.6)
172179
concurrent-ruby (~> 1.0)
173-
unicode-display_width (3.1.4)
180+
unicode-display_width (3.1.5)
174181
unicode-emoji (~> 4.0, >= 4.0.4)
175182
unicode-emoji (4.0.4)
176183
uri (1.0.3)
@@ -185,7 +192,14 @@ GEM
185192
yard
186193

187194
PLATFORMS
188-
x86_64-linux
195+
aarch64-linux
196+
aarch64-linux-gnu
197+
aarch64-linux-musl
198+
arm64-darwin
199+
universal-darwin
200+
x86_64-darwin
201+
x86_64-linux-gnu
202+
x86_64-linux-musl
189203

190204
DEPENDENCIES
191205
async

lib/scrapegraphai/internal/transport/base_client.rb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -367,10 +367,7 @@ def initialize(
367367
# @return [Array(Integer, Net::HTTPResponse, Enumerable<String>)]
368368
def send_request(request, redirect_count:, retry_count:, send_retry_header:)
369369
url, headers, max_retries, timeout = request.fetch_values(:url, :headers, :max_retries, :timeout)
370-
input = {
371-
**request.except(:timeout),
372-
deadline: Scrapegraphai::Internal::Util.monotonic_secs + timeout
373-
}
370+
input = {**request.except(:timeout), deadline: Scrapegraphai::Internal::Util.monotonic_secs + timeout}
374371

375372
if send_retry_header
376373
headers["x-stainless-retry-count"] = retry_count.to_s

lib/scrapegraphai/internal/transport/pooled_net_requester.rb

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -193,15 +193,7 @@ def initialize(size: self.class::DEFAULT_MAX_CONNECTIONS)
193193
end
194194

195195
define_sorbet_constant!(:Request) do
196-
T.type_alias do
197-
{
198-
method: Symbol,
199-
url: URI::Generic,
200-
headers: T::Hash[String, String],
201-
body: T.anything,
202-
deadline: Float
203-
}
204-
end
196+
T.type_alias { {method: Symbol, url: URI::Generic, headers: T::Hash[String, String], body: T.anything, deadline: Float} }
205197
end
206198
end
207199
end

lib/scrapegraphai/internal/type/base_model.rb

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,7 @@ def fields
6464
setter = :"#{name_sym}="
6565
api_name = info.fetch(:api_name, name_sym)
6666
nilable = info.fetch(:nil?, false)
67-
const = if required && !nilable
68-
info.fetch(
69-
:const,
70-
Scrapegraphai::Internal::OMIT
71-
)
72-
else
73-
Scrapegraphai::Internal::OMIT
74-
end
67+
const = required && !nilable ? info.fetch(:const, Scrapegraphai::Internal::OMIT) : Scrapegraphai::Internal::OMIT
7568

7669
[name_sym, setter].each { undef_method(_1) } if known_fields.key?(name_sym)
7770

lib/scrapegraphai/internal/util.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ class << self
244244
#
245245
# @return [String]
246246
def uri_origin(uri)
247-
"#{uri.scheme}://#{uri.host}#{uri.port == uri.default_port ? '' : ":#{uri.port}"}"
247+
"#{uri.scheme}://#{uri.host}#{":#{uri.port}" unless uri.port == uri.default_port}"
248248
end
249249

250250
# @api private

rbi/scrapegraphai/errors.rbi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,10 @@ module Scrapegraphai
5959
end
6060

6161
class APIConnectionError < Scrapegraphai::Errors::APIError
62-
sig { void }
62+
sig { returns(NilClass) }
6363
attr_accessor :status
6464

65-
sig { void }
65+
sig { returns(NilClass) }
6666
attr_accessor :body
6767

6868
# @api private

test/scrapegraphai/internal/type/base_model_test.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ def test_dump_retry
157157
class Scrapegraphai::Test::EnumModelTest < Minitest::Test
158158
class E0
159159
include Scrapegraphai::Internal::Type::Enum
160+
160161
attr_reader :values
161162

162163
def initialize(*values) = (@values = values)
@@ -476,6 +477,7 @@ def initialize(*variants) = variants.each { variant(_1) }
476477

477478
module U1
478479
extend Scrapegraphai::Internal::Type::Union
480+
479481
variant const: :a
480482
variant const: 2
481483
end
@@ -492,6 +494,7 @@ class M2 < Scrapegraphai::Internal::Type::BaseModel
492494

493495
module U2
494496
extend Scrapegraphai::Internal::Type::Union
497+
495498
discriminator :type
496499

497500
variant :a, M1
@@ -500,6 +503,7 @@ module U2
500503

501504
module U3
502505
extend Scrapegraphai::Internal::Type::Union
506+
503507
discriminator :type
504508

505509
variant :a, M1
@@ -508,6 +512,7 @@ module U3
508512

509513
module U4
510514
extend Scrapegraphai::Internal::Type::Union
515+
511516
discriminator :type
512517

513518
variant String
@@ -601,6 +606,7 @@ def test_coerce
601606
class Scrapegraphai::Test::BaseModelQoLTest < Minitest::Test
602607
class E0
603608
include Scrapegraphai::Internal::Type::Enum
609+
604610
attr_reader :values
605611

606612
def initialize(*values) = (@values = values)

test/scrapegraphai/internal/util_test.rb

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -242,11 +242,7 @@ def test_hash_encode
242242
{strio: StringIO.new("a")} => {"strio" => "a"},
243243
{strio: Scrapegraphai::FilePart.new("a")} => {"strio" => "a"},
244244
{pathname: Pathname(__FILE__)} => {"pathname" => -> { _1.read in /^class Scrapegraphai/ }},
245-
{pathname: Scrapegraphai::FilePart.new(Pathname(__FILE__))} => {
246-
"pathname" => -> {
247-
_1.read in /^class Scrapegraphai/
248-
}
249-
}
245+
{pathname: Scrapegraphai::FilePart.new(Pathname(__FILE__))} => {"pathname" => -> { _1.read in /^class Scrapegraphai/ }}
250246
}
251247
cases.each do |body, testcase|
252248
encoded = Scrapegraphai::Internal::Util.encode_content(headers, body)
@@ -324,9 +320,9 @@ def test_rewind_chain
324320
end
325321

326322
def test_external_iteration
327-
it = [1, 2, 3].to_enum
328-
first = it.next
329-
fused = Scrapegraphai::Internal::Util.fused_enum(it, external: true)
323+
iter = [1, 2, 3].to_enum
324+
first = iter.next
325+
fused = Scrapegraphai::Internal::Util.fused_enum(iter, external: true)
330326

331327
assert_equal(1, first)
332328
assert_equal([2, 3], fused.to_a)

0 commit comments

Comments
 (0)