Dataset Viewer
Auto-converted to Parquet Duplicate
function_name
stringlengths
2
43
file_path
stringlengths
20
71
focal_code
stringlengths
176
2.2k
file_content
stringlengths
428
89.7k
language
stringclasses
1 value
function_component
dict
metadata
dict
using_session
capybara/lib/capybara.rb
def using_session(name_or_session, &block) previous_session = current_session previous_session_info = { specified_session: specified_session, session_name: session_name, current_driver: current_driver, app: app } self.specified_session = self.session_name = nil ...
# frozen_string_literal: true require 'timeout' require 'nokogiri' require 'xpath' require 'forwardable' require 'capybara/config' require 'capybara/registration_container' module Capybara class CapybaraError < StandardError; end class DriverNotFoundError < CapybaraError; end class FrozenInTime < CapybaraError;...
Ruby
{ "end_line": 381, "name": "using_session", "signature": "def using_session(name_or_session, &block)", "start_line": 358 }
{ "class_name": "", "class_signature": "", "module": "Capybara" }
HTML
capybara/lib/capybara.rb
def HTML(html) # rubocop:disable Naming/MethodName # Nokogiri >= 1.12.0 or Nokogumbo installed and allowed for use html_parser, using_html5 = if defined?(Nokogiri::HTML5) && Capybara.use_html5_parsing [Nokogiri::HTML5, true] else [defined?(Nokogiri::HTML4) ? Nokogiri::HTML4 : Nokogiri:...
# frozen_string_literal: true require 'timeout' require 'nokogiri' require 'xpath' require 'forwardable' require 'capybara/config' require 'capybara/registration_container' module Capybara class CapybaraError < StandardError; end class DriverNotFoundError < CapybaraError; end class FrozenInTime < CapybaraError;...
Ruby
{ "end_line": 408, "name": "HTML", "signature": "def HTML(html) # rubocop:disable Naming/MethodName", "start_line": 390 }
{ "class_name": "", "class_signature": "", "module": "Capybara" }
server=
capybara/lib/capybara/config.rb
def server=(name) name, options = *name if name.is_a? Array @server = if name.respond_to? :call name elsif options proc { |app, port, host| Capybara.servers[name.to_sym].call(app, port, host, **options) } else Capybara.servers[name.to_sym] end end
# frozen_string_literal: true require 'forwardable' require 'capybara/session/config' module Capybara class Config extend Forwardable OPTIONS = %i[ app reuse_server threadsafe server default_driver javascript_driver use_html5_parsing allow_gumbo ].freeze attr_accessor :app, :use_html5_parsin...
Ruby
{ "end_line": 68, "name": "server=", "signature": "def server=(name)", "start_line": 59 }
{ "class_name": "Config", "class_signature": "class Config", "module": "Capybara" }
each
capybara/lib/capybara/result.rb
def each(&block) return enum_for(:each) unless block @result_cache.each(&block) loop do next_result = @results_enum.next add_to_cache(next_result) yield next_result end self end
# frozen_string_literal: true require 'forwardable' module Capybara ## # A {Capybara::Result} represents a collection of {Capybara::Node::Element} on the page. It is possible to interact with this # collection similar to an Array because it implements Enumerable and offers the following Array methods through de...
Ruby
{ "end_line": 51, "name": "each", "signature": "def each(&block)", "start_line": 41 }
{ "class_name": "Result", "class_signature": "class Result", "module": "Capybara" }
[]
capybara/lib/capybara/result.rb
def [](*args) idx, length = args max_idx = case idx when Integer if idx.negative? nil else length.nil? ? idx : idx + length - 1 end when Range # idx.max is broken with beginless ranges # idx.end && idx.max # endless range will have end ...
# frozen_string_literal: true require 'forwardable' module Capybara ## # A {Capybara::Result} represents a collection of {Capybara::Node::Element} on the page. It is possible to interact with this # collection similar to an Array because it implements Enumerable and offers the following Array methods through de...
Ruby
{ "end_line": 77, "name": "[]", "signature": "def [](*args)", "start_line": 53 }
{ "class_name": "Result", "class_signature": "class Result", "module": "Capybara" }
compare_count
capybara/lib/capybara/result.rb
def compare_count return 0 unless @query count, min, max, between = @query.options.values_at(:count, :minimum, :maximum, :between) # Only check filters for as many elements as necessary to determine result if count && (count = Integer(count)) return load_up_to(count + 1) <=> count ...
# frozen_string_literal: true require 'forwardable' module Capybara ## # A {Capybara::Result} represents a collection of {Capybara::Node::Element} on the page. It is possible to interact with this # collection similar to an Array because it implements Enumerable and offers the following Array methods through de...
Ruby
{ "end_line": 107, "name": "compare_count", "signature": "def compare_count", "start_line": 84 }
{ "class_name": "Result", "class_signature": "class Result", "module": "Capybara" }
failure_message
capybara/lib/capybara/result.rb
def failure_message message = @query.failure_message if count.zero? message << ' but there were no matches' else message << ", found #{count} #{Capybara::Helpers.declension('match', 'matches', count)}: " \ << full_results.map { |r| r.text.inspect }.join(', ') end ...
# frozen_string_literal: true require 'forwardable' module Capybara ## # A {Capybara::Result} represents a collection of {Capybara::Node::Element} on the page. It is possible to interact with this # collection similar to an Array because it implements Enumerable and offers the following Array methods through de...
Ruby
{ "end_line": 127, "name": "failure_message", "signature": "def failure_message", "start_line": 113 }
{ "class_name": "Result", "class_signature": "class Result", "module": "Capybara" }
initialize
capybara/lib/capybara/server.rb
def initialize(app, *deprecated_options, port: Capybara.server_port, host: Capybara.server_host, reportable_errors: Capybara.server_errors, extra_middleware: []) unless deprecated_options.empty? warn 'Positional...
# frozen_string_literal: true require 'uri' require 'net/http' require 'rack' require 'capybara/server/middleware' require 'capybara/server/animation_disabler' require 'capybara/server/checker' module Capybara # @api private class Server class << self def ports @ports ||= {} end end ...
Ruby
{ "end_line": 39, "name": "initialize", "signature": "def initialize(app,", "start_line": 21 }
{ "class_name": "Server", "class_signature": "class Server", "module": "Capybara" }
boot
capybara/lib/capybara/server.rb
def boot unless responsive? Capybara::Server.ports[port_key] = port @server_thread = Thread.new do Capybara.server.call(middleware, port, host) end timer = Capybara::Helpers.timer(expire_in: 60) until responsive? raise 'Rack application timed out durin...
# frozen_string_literal: true require 'uri' require 'net/http' require 'rack' require 'capybara/server/middleware' require 'capybara/server/animation_disabler' require 'capybara/server/checker' module Capybara # @api private class Server class << self def ports @ports ||= {} end end ...
Ruby
{ "end_line": 89, "name": "boot", "signature": "def boot", "start_line": 72 }
{ "class_name": "Server", "class_signature": "class Server", "module": "Capybara" }
find_available_port
capybara/lib/capybara/server.rb
def find_available_port(host) server = TCPServer.new(host, 0) port = server.addr[1] server.close # Workaround issue where some platforms (mac, ???) when passed a host # of '0.0.0.0' will return a port that is only available on one of the # ip addresses that resolves to, but the next...
# frozen_string_literal: true require 'uri' require 'net/http' require 'rack' require 'capybara/server/middleware' require 'capybara/server/animation_disabler' require 'capybara/server/checker' module Capybara # @api private class Server class << self def ports @ports ||= {} end end ...
Ruby
{ "end_line": 124, "name": "find_available_port", "signature": "def find_available_port(host)", "start_line": 109 }
{ "class_name": "Server", "class_signature": "class Server", "module": "Capybara" }
initialize
capybara/lib/capybara/session.rb
def initialize(mode, app = nil) if app && !app.respond_to?(:call) raise TypeError, 'The second parameter to Session::new should be a rack app if passed.' end @@instance_created = true # rubocop:disable Style/ClassVars @mode = mode @app = app if block_given? raise 'A ...
# frozen_string_literal: true require 'capybara/session/matchers' require 'addressable/uri' module Capybara ## # # The {Session} class represents a single user's interaction with the system. The {Session} can use # any of the underlying drivers. A session can be initialized manually like this: # # ses...
Ruby
{ "end_line": 98, "name": "initialize", "signature": "def initialize(mode, app = nil)", "start_line": 79 }
{ "class_name": "Session", "class_signature": "class Session", "module": "Capybara" }
driver
capybara/lib/capybara/session.rb
def driver @driver ||= begin unless Capybara.drivers[mode] other_drivers = Capybara.drivers.names.map(&:inspect) raise Capybara::DriverNotFoundError, "no driver called #{mode.inspect} was found, available drivers: #{other_drivers.join(', ')}" end driver = Capybara.drive...
# frozen_string_literal: true require 'capybara/session/matchers' require 'addressable/uri' module Capybara ## # # The {Session} class represents a single user's interaction with the system. The {Session} can use # any of the underlying drivers. A session can be initialized manually like this: # # ses...
Ruby
{ "end_line": 110, "name": "driver", "signature": "def driver", "start_line": 100 }
{ "class_name": "Session", "class_signature": "class Session", "module": "Capybara" }
reset!
capybara/lib/capybara/session.rb
def reset! if @touched driver.reset! @touched = false switch_to_frame(:top) rescue nil # rubocop:disable Style/RescueModifier @scopes = [nil] end @server&.wait_for_pending_requests raise_server_error! end
# frozen_string_literal: true require 'capybara/session/matchers' require 'addressable/uri' module Capybara ## # # The {Session} class represents a single user's interaction with the system. The {Session} can use # any of the underlying drivers. A session can be initialized manually like this: # # ses...
Ruby
{ "end_line": 139, "name": "reset!", "signature": "def reset!", "start_line": 130 }
{ "class_name": "Session", "class_signature": "class Session", "module": "Capybara" }
End of preview. Expand in Data Studio
README.md exists but content is empty.
Downloads last month
5