Skip to content

Commit 97f1e59

Browse files
committed
Remove RBS comments
1 parent 4d12946 commit 97f1e59

File tree

135 files changed

+18
-784
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

135 files changed

+18
-784
lines changed

rb/lib/selenium/devtools.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ module DevTools
2222
class << self
2323
attr_accessor :version
2424

25-
# @rbs () -> void
2625
def load_version
2726
require "selenium/devtools/v#{@version}"
2827
rescue LoadError

rb/lib/selenium/webdriver.rb

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,20 @@
3030

3131
module Selenium
3232
module WebDriver
33-
Point = Struct.new(:x, :y)
33+
Point = Struct.new(:x, :y)
3434
Dimension = Struct.new(:width, :height)
3535
Rectangle = Struct.new(:x, :y, :width, :height)
3636

37-
autoload :BiDi, 'selenium/webdriver/bidi'
38-
autoload :Chromium, 'selenium/webdriver/chromium'
39-
autoload :Chrome, 'selenium/webdriver/chrome'
40-
autoload :DevTools, 'selenium/webdriver/devtools'
41-
autoload :Edge, 'selenium/webdriver/edge'
42-
autoload :Firefox, 'selenium/webdriver/firefox'
43-
autoload :IE, 'selenium/webdriver/ie'
44-
autoload :Remote, 'selenium/webdriver/remote'
45-
autoload :Safari, 'selenium/webdriver/safari'
46-
autoload :Support, 'selenium/webdriver/support'
37+
autoload :BiDi, 'selenium/webdriver/bidi'
38+
autoload :Chromium, 'selenium/webdriver/chromium'
39+
autoload :Chrome, 'selenium/webdriver/chrome'
40+
autoload :DevTools, 'selenium/webdriver/devtools'
41+
autoload :Edge, 'selenium/webdriver/edge'
42+
autoload :Firefox, 'selenium/webdriver/firefox'
43+
autoload :IE, 'selenium/webdriver/ie'
44+
autoload :Remote, 'selenium/webdriver/remote'
45+
autoload :Safari, 'selenium/webdriver/safari'
46+
autoload :Support, 'selenium/webdriver/support'
4747

4848
# @api private
4949

@@ -94,7 +94,6 @@ def self.for(*)
9494
# @return [Logger]
9595
#
9696

97-
# @rbs (**untyped) -> Selenium::WebDriver::Logger
9897
def self.logger(**)
9998
level = $DEBUG || ENV.key?('DEBUG') ? :debug : :info
10099
@logger ||= WebDriver::Logger.new('Selenium', default_level: level, **)

rb/lib/selenium/webdriver/atoms.rb

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,17 @@
2020
module Selenium
2121
module WebDriver
2222
module Atoms
23-
# @rbs (Symbol) -> String
2423
def atom_script(function_name)
2524
format("/* #{function_name} */return (%<atom>s).apply(null, arguments)",
2625
atom: read_atom(function_name))
2726
end
2827

2928
private
3029

31-
# @rbs (Symbol) -> String
3230
def read_atom(function)
3331
File.read(File.expand_path("../atoms/#{function}.js", __FILE__))
3432
end
3533

36-
# @rbs (Symbol, *untyped) -> bool
3734
def execute_atom(function_name, *)
3835
execute_script(atom_script(function_name), *)
3936
end

rb/lib/selenium/webdriver/bidi.rb

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,46 +31,38 @@ class BiDi
3131
autoload :InterceptedAuth, 'selenium/webdriver/bidi/network/intercepted_auth'
3232
autoload :InterceptedItem, 'selenium/webdriver/bidi/network/intercepted_item'
3333

34-
# @rbs (url: String) -> void
3534
def initialize(url:)
3635
@ws = WebSocketConnection.new(url: url)
3736
end
3837

39-
# @rbs () -> nil
4038
def close
4139
@ws.close
4240
end
4341

44-
# @rbs () -> Hash[untyped, untyped]
4542
def callbacks
4643
@ws.callbacks
4744
end
4845

49-
# @rbs (String) -> void
5046
def add_callback(event, &block)
5147
@ws.add_callback(event, &block)
5248
end
5349

54-
# @rbs (String, Integer) -> void
5550
def remove_callback(event, id)
5651
@ws.remove_callback(event, id)
5752
end
5853

59-
# @rbs () -> Selenium::WebDriver::BiDi::Session
6054
def session
6155
@session ||= Session.new(self)
6256
end
6357

64-
# @rbs (String, **String | String | Integer | String | bool) -> Hash[untyped, untyped]
6558
def send_cmd(method, **params)
66-
data = {method: method, params: params.compact}
59+
data = { method: method, params: params.compact }
6760
message = @ws.send_cmd(**data)
6861
raise Error::WebDriverError, error_message(message) if message['error']
6962

7063
message['result']
7164
end
7265

73-
# @rbs (Hash[untyped, untyped]) -> String
7466
def error_message(message)
7567
"#{message['error']}: #{message['message']}\n#{message['stacktrace']}"
7668
end

rb/lib/selenium/webdriver/bidi/browsing_context.rb

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ class BrowsingContext
3232
}.freeze
3333

3434
# TODO: store current window handle in bridge object instead of always calling it
35-
# @rbs (Selenium::WebDriver::Remote::BiDiBridge) -> void
3635
def initialize(bridge)
3736
@bridge = bridge
3837
@bidi = @bridge.bidi
@@ -45,7 +44,6 @@ def initialize(bridge)
4544
# @param url [String] The URL to navigate to.
4645
# @param context_id [String, NilClass] The ID of the browsing context to navigate in.
4746
# Defaults to the window handle of the current context.
48-
# @rbs (String, ?context_id: nil) -> Hash[untyped, untyped]
4947
def navigate(url, context_id: nil)
5048
context_id ||= @bridge.window_handle
5149
@bidi.send_cmd('browsingContext.navigate', context: context_id, url: url, wait: @readiness)
@@ -57,7 +55,6 @@ def navigate(url, context_id: nil)
5755
# Positive values go forwards, negative values go backwards.
5856
# @param context_id [String, NilClass] The ID of the context to traverse.
5957
# Defaults to the window handle of the current context.
60-
# @rbs (Integer, ?context_id: nil) -> Hash[untyped, untyped]
6158
def traverse_history(delta, context_id: nil)
6259
context_id ||= @bridge.window_handle
6360
@bidi.send_cmd('browsingContext.traverseHistory', context: context_id, delta: delta)
@@ -68,18 +65,16 @@ def traverse_history(delta, context_id: nil)
6865
# Defaults to the window handle of the current context.
6966
# @param [Boolean] ignore_cache Whether to bypass the cache when reloading.
7067
# Defaults to false.
71-
# @rbs (?context_id: nil, ?ignore_cache: bool) -> Hash[untyped, untyped]
7268
def reload(context_id: nil, ignore_cache: false)
7369
context_id ||= @bridge.window_handle
74-
params = {context: context_id, ignore_cache: ignore_cache, wait: @readiness}
70+
params = { context: context_id, ignore_cache: ignore_cache, wait: @readiness }
7571
@bidi.send_cmd('browsingContext.reload', **params)
7672
end
7773

7874
# Closes the browsing context.
7975
#
8076
# @param [String] context_id The ID of the context to close.
8177
# Defaults to the window handle of the current context.
82-
# @rbs (?context_id: String) -> void
8378
def close(context_id: nil)
8479
context_id ||= @bridge.window_handle
8580
@bidi.send_cmd('browsingContext.close', context: context_id)
@@ -93,27 +88,23 @@ def close(context_id: nil)
9388
# Defaults to the current window handle.
9489
#
9590
# @return [String] The context ID of the created browsing context.
96-
# @rbs (?type: nil, ?context_id: nil) -> String
9791
def create(type: nil, context_id: nil)
9892
type ||= :window
9993
context_id ||= @bridge.window_handle
10094
result = @bidi.send_cmd('browsingContext.create', type: type.to_s, referenceContext: context_id)
10195
result['context']
10296
end
10397

104-
# @rbs (?context_id: nil, ?width: Integer, ?height: Integer, ?device_pixel_ratio: Float) -> void
10598
def set_viewport(context_id: nil, width: nil, height: nil, device_pixel_ratio: nil)
10699
context_id ||= @bridge.window_handle
107-
params = {context: context_id, viewport: {width:, height:}, device_pixel_ratio:}
100+
params = { context: context_id, viewport: { width:, height: }, device_pixel_ratio: }
108101
@bidi.send_cmd('browsingContext.setViewport', **params)
109102
end
110103

111-
# @rbs (String, ?accept: bool, ?text: nil | String) -> void
112104
def handle_user_prompt(context_id, accept: true, text: nil)
113105
@bidi.send_cmd('browsingContext.handleUserPrompt', context: context_id, accept: accept, text: text)
114106
end
115107

116-
# @rbs (?context_id: nil) -> void
117108
def activate(context_id: nil)
118109
context_id ||= @bridge.window_handle
119110
@bidi.send_cmd('browsingContext.activate', context: context_id)

rb/lib/selenium/webdriver/bidi/log_handler.rb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,13 @@ class LogHandler
2424
ConsoleLogEntry = BiDi::Struct.new(:level, :text, :timestamp, :stack_trace, :type, :source, :method, :args)
2525
JavaScriptLogEntry = BiDi::Struct.new(:level, :text, :timestamp, :stack_trace, :type, :source)
2626

27-
# @rbs (Selenium::WebDriver::BiDi) -> void
2827
def initialize(bidi)
2928
@bidi = bidi
3029
@log_entry_subscribed = false
3130
end
3231

3332
# @return [int] id of the handler
3433
# steep:ignore:start
35-
# @rbs (String) -> Integer
3634
def add_message_handler(type)
3735
subscribe_log_entry unless @log_entry_subscribed
3836
@bidi.add_callback('log.entryAdded') do |params|
@@ -42,18 +40,17 @@ def add_message_handler(type)
4240
end
4341
end
4442
end
43+
4544
# steep:ignore:end
4645

4746
# @param [int] id of the handler previously added
48-
# @rbs (Integer) -> nil
4947
def remove_message_handler(id)
5048
@bidi.remove_callback('log.entryAdded', id)
5149
unsubscribe_log_entry if @log_entry_subscribed && @bidi.callbacks['log.entryAdded'].empty?
5250
end
5351

5452
private
5553

56-
# @rbs () -> bool
5754
def subscribe_log_entry
5855
@bidi.session.subscribe('log.entryAdded')
5956
@log_entry_subscribed = true

rb/lib/selenium/webdriver/bidi/log_inspector.rb

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ class LogInspector
4040
WARNING: 'warning'
4141
}.freeze
4242

43-
# @rbs (Selenium::WebDriver::Chrome::Driver, ?nil) -> void
4443
def initialize(driver, browsing_context_ids = nil)
4544
WebDriver.logger.deprecate('LogInspector class',
4645
'Script class with driver.script',
@@ -55,7 +54,6 @@ def initialize(driver, browsing_context_ids = nil)
5554
@bidi.session.subscribe('log.entryAdded', browsing_context_ids)
5655
end
5756

58-
# @rbs (?Selenium::WebDriver::BiDi::FilterBy?) -> void
5957
def on_console_entry(filter_by = nil, &block)
6058
check_valid_filter(filter_by)
6159

@@ -65,7 +63,6 @@ def on_console_entry(filter_by = nil, &block)
6563
end
6664
end
6765

68-
# @rbs (?Selenium::WebDriver::BiDi::FilterBy?) -> void
6966
def on_javascript_log(filter_by = nil, &block)
7067
check_valid_filter(filter_by)
7168

@@ -75,15 +72,13 @@ def on_javascript_log(filter_by = nil, &block)
7572
end
7673
end
7774

78-
# @rbs () -> void
7975
def on_javascript_exception(&block)
8076
on_log do |params|
8177
type = params['type']
8278
javascript_log_events(params, FilterBy.log_level('error'), &block) if type.eql?('javascript')
8379
end
8480
end
8581

86-
# @rbs (?Selenium::WebDriver::BiDi::FilterBy?) -> Integer?
8782
def on_log(filter_by = nil, &block)
8883
unless filter_by.nil?
8984
check_valid_filter(filter_by)
@@ -99,20 +94,17 @@ def on_log(filter_by = nil, &block)
9994

10095
private
10196

102-
# @rbs (Symbol) -> Integer
10397
def on(event, &block)
10498
event = EVENTS[event] if event.is_a?(Symbol)
10599
@bidi.add_callback("log.#{event}", &block)
106100
end
107101

108-
# @rbs (Selenium::WebDriver::BiDi::FilterBy?) -> void
109102
def check_valid_filter(filter_by)
110103
return if filter_by.nil? || filter_by.instance_of?(FilterBy)
111104

112105
raise "Pass valid FilterBy object. Received: #{filter_by.inspect}"
113106
end
114107

115-
# @rbs (Hash[untyped, untyped], Selenium::WebDriver::BiDi::FilterBy?) -> Array[untyped]?
116108
def console_log_events(params, filter_by)
117109
event = ConsoleLogEntry.new(
118110
level: params['level'],
@@ -133,7 +125,6 @@ def console_log_events(params, filter_by)
133125
yield(event)
134126
end
135127

136-
# @rbs (Hash[untyped, untyped], Selenium::WebDriver::BiDi::FilterBy?) -> Selenium::WebDriver::BiDi::JavascriptLogEntry?
137128
def javascript_log_events(params, filter_by)
138129
event = JavascriptLogEntry.new(
139130
level: params['level'],

rb/lib/selenium/webdriver/bidi/network.rb

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,10 @@ class Network
3636
auth_required: 'authRequired'
3737
}.freeze
3838

39-
# @rbs (Selenium::WebDriver::BiDi) -> void
4039
def initialize(bidi)
4140
@bidi = bidi
4241
end
4342

44-
# @rbs (?phases: Array[untyped], ?contexts: nil, ?url_patterns: Array[untyped], ?pattern_type: nil | Symbol) -> Hash[untyped, untyped]
4543
def add_intercept(phases: [], contexts: nil, url_patterns: nil, pattern_type: :string)
4644
url_patterns = url_patterns && pattern_type ? UrlPattern.format_pattern(url_patterns, pattern_type) : nil
4745
@bidi.send_cmd('network.addIntercept',
@@ -50,12 +48,10 @@ def add_intercept(phases: [], contexts: nil, url_patterns: nil, pattern_type: :s
5048
urlPatterns: url_patterns)
5149
end
5250

53-
# @rbs (String) -> void
5451
def remove_intercept(intercept)
5552
@bidi.send_cmd('network.removeIntercept', intercept: intercept)
5653
end
5754

58-
# @rbs (String, String, String) -> Hash[untyped, untyped]
5955
def continue_with_auth(request_id, username, password)
6056
@bidi.send_cmd(
6157
'network.continueWithAuth',
@@ -69,7 +65,6 @@ def continue_with_auth(request_id, username, password)
6965
)
7066
end
7167

72-
# @rbs (String) -> Hash[untyped, untyped]
7368
def continue_without_auth(request_id)
7469
@bidi.send_cmd(
7570
'network.continueWithAuth',
@@ -78,7 +73,6 @@ def continue_without_auth(request_id)
7873
)
7974
end
8075

81-
# @rbs (String) -> Hash[untyped, untyped]
8276
def cancel_auth(request_id)
8377
@bidi.send_cmd(
8478
'network.continueWithAuth',
@@ -87,7 +81,6 @@ def cancel_auth(request_id)
8781
)
8882
end
8983

90-
# @rbs (**(String | Array[untyped])? | String | Hash[untyped, untyped] | Array[untyped]) -> Hash[untyped, untyped]?
9184
def continue_request(**args)
9285
@bidi.send_cmd(
9386
'network.continueRequest',
@@ -100,15 +93,13 @@ def continue_request(**args)
10093
)
10194
end
10295

103-
# @rbs (String) -> Hash[untyped, untyped]?
10496
def fail_request(request_id)
10597
@bidi.send_cmd(
10698
'network.failRequest',
10799
request: request_id
108100
)
109101
end
110102

111-
# @rbs (**(String | Array[untyped])? | (String | Array[untyped] | Hash[untyped, untyped])?) -> Hash[untyped, untyped]?
112103
def continue_response(**args)
113104
@bidi.send_cmd(
114105
'network.continueResponse',
@@ -121,7 +112,6 @@ def continue_response(**args)
121112
)
122113
end
123114

124-
# @rbs (**(String | Array[untyped] | Hash[untyped, untyped] | Integer)?) -> Hash[untyped, untyped]
125115
def provide_response(**args)
126116
@bidi.send_cmd(
127117
'network.provideResponse',
@@ -134,12 +124,10 @@ def provide_response(**args)
134124
)
135125
end
136126

137-
# @rbs (String, *String) -> Hash[untyped, untyped]
138127
def set_cache_behavior(behavior, *contexts)
139128
@bidi.send_cmd('network.setCacheBehavior', cacheBehavior: behavior, contexts: contexts)
140129
end
141130

142-
# @rbs (Symbol) -> Hash[untyped, untyped]
143131
def on(event, &block)
144132
event = EVENTS[event] if event.is_a?(Symbol)
145133
@bidi.add_callback(event, &block)

0 commit comments

Comments
 (0)