_id stringlengths 2 6 | title stringlengths 9 130 | partition stringclasses 3
values | text stringlengths 30 4.3k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q16400 | Lit.Import.upsert | train | def upsert(locale, key, value) # rubocop:disable Metrics/MethodLength
I18n.with_locale(locale) do
# when an array has to be inserted with a default value, it needs to
# be done like:
# I18n.t('foo', default: [['bar', 'baz']])
# because without the double array, array items are trea... | ruby | {
"resource": ""
} |
q16401 | Babosa.Identifier.transliterate! | train | def transliterate!(*kinds)
kinds.compact!
kinds = [:latin] if kinds.empty?
kinds.each do |kind|
transliterator = Transliterator.get(kind).instance
| ruby | {
"resource": ""
} |
q16402 | Babosa.Identifier.to_ruby_method! | train | def to_ruby_method!(allow_bangs = true)
leader, trailer = @wrapped_string.strip.scan(/\A(.+)(.)\z/).flatten
leader = leader.to_s
trailer = trailer.to_s
if allow_bangs
trailer.downcase!
trailer.gsub!(/[^a-z0-9!=\\?]/, '')
| ruby | {
"resource": ""
} |
q16403 | Babosa.Identifier.truncate_bytes! | train | def truncate_bytes!(max)
return @wrapped_string if @wrapped_string.bytesize <= max
curr = 0
new = []
unpack("U*").each do |char|
break if curr > max
char = [char].pack("U")
curr += | ruby | {
"resource": ""
} |
q16404 | Babosa.Identifier.send_to_new_instance | train | def send_to_new_instance(*args)
id = Identifier.allocate | ruby | {
"resource": ""
} |
q16405 | NyanCat.Common.nyan_cat | train | def nyan_cat
if self.failed_or_pending? && self.finished?
ascii_cat('x')[@color_index%2].join("\n") #'~|_(x.x)'
elsif self.failed_or_pending?
ascii_cat('o')[@color_index%2].join("\n") #'~|_(o.o)'
elsif self.finished?
| ruby | {
"resource": ""
} |
q16406 | NyanCat.Common.terminal_width | train | def terminal_width
if defined? JRUBY_VERSION
default_width = 80
else
default_width = `stty | ruby | {
"resource": ""
} |
q16407 | NyanCat.Common.scoreboard | train | def scoreboard
@pending_examples ||= []
@failed_examples ||= []
padding = @example_count.to_s.length
[ @current.to_s.rjust(padding),
| ruby | {
"resource": ""
} |
q16408 | NyanCat.Common.nyan_trail | train | def nyan_trail
marks = @example_results.each_with_index.map{ |mark, i| highlight(mark) * example_width(i) }
marks.shift(current_width - terminal_width) if current_width >= terminal_width
| ruby | {
"resource": ""
} |
q16409 | NyanCat.Common.colors | train | def colors
@colors ||= (0...(6 * 7)).map do |n|
pi_3 = Math::PI / 3
n *= 1.0 / 6
r = (3 * Math.sin(n ) + 3).to_i
g = (3 * Math.sin(n + 2 * pi_3) + 3).to_i
| ruby | {
"resource": ""
} |
q16410 | NyanCat.Common.highlight | train | def highlight(mark = PASS)
case mark
when PASS; rainbowify PASS_ARY[@color_index%2]
| ruby | {
"resource": ""
} |
q16411 | InvoicePrinter.PDFDocument.set_fonts | train | def set_fonts(font)
font_name = Pathname.new(font).basename
@pdf.font_families.update(
"#{font_name}" => {
normal: font,
italic: font,
| ruby | {
"resource": ""
} |
q16412 | InvoicePrinter.PDFDocument.build_pdf | train | def build_pdf
@push_down = 0
@push_items_table = 0
@pdf.fill_color '000000'
build_header
build_provider_box
build_purchaser_box
build_payment_method_box
| ruby | {
"resource": ""
} |
q16413 | InvoicePrinter.PDFDocument.determine_items_structure | train | def determine_items_structure
items_params = {}
@document.items.each do |item|
items_params[:names] = true unless item.name.empty?
items_params[:variables] = true unless item.variable.empty?
items_params[:quantities] = true unless item.quantity.empty?
items_params[:units] = t... | ruby | {
"resource": ""
} |
q16414 | InvoicePrinter.PDFDocument.build_items_data | train | def build_items_data(items_params)
@document.items.map do |item|
line = []
line << item.name if items_params[:names]
line << item.variable if items_params[:variables]
line << item.quantity if items_params[:quantities]
line << item.unit if items_params[:units]
line <... | ruby | {
"resource": ""
} |
q16415 | InvoicePrinter.PDFDocument.build_items_header | train | def build_items_header(items_params)
headers = []
headers << { text: label_with_sublabel(:item) } if items_params[:names]
headers << { text: label_with_sublabel(:variable) } if items_params[:variables]
headers << { text: label_with_sublabel(:quantity) } if items_params[:quantities]
headers... | ruby | {
"resource": ""
} |
q16416 | MAuth.Proxy.call | train | def call(request_env)
request = ::Rack::Request.new(request_env)
request_method = request_env['REQUEST_METHOD'].downcase.to_sym
request_env['rack.input'].rewind
request_body = request_env['rack.input'].read
request_env['rack.input'].rewind
request_headers = {}
request_env.each ... | ruby | {
"resource": ""
} |
q16417 | MAuth.Client.symbolize_keys | train | def symbolize_keys(hash)
hash.keys.each do |key|
hash[(key.to_sym rescue key) || key] | ruby | {
"resource": ""
} |
q16418 | Determinator.Control.for_actor | train | def for_actor(id: nil, guid: nil, default_properties: {})
| ruby | {
"resource": ""
} |
q16419 | Determinator.Control.feature_flag_on? | train | def feature_flag_on?(name, id: nil, guid: nil, properties: {})
determinate_and_notice(name, id: id, guid: guid, | ruby | {
"resource": ""
} |
q16420 | Determinator.Control.which_variant | train | def which_variant(name, id: nil, guid: nil, properties: {})
determinate_and_notice(name, id: id, guid: guid, | ruby | {
"resource": ""
} |
q16421 | Determinator.Feature.parse_outcome | train | def parse_outcome(outcome, allow_exclusion:)
valid_outcomes = experiment? ? variants.keys : [true]
valid_outcomes | ruby | {
"resource": ""
} |
q16422 | ROR.SubProcess.stop | train | def stop
return self if @pid.nil?
_log "stopping (##{@pid})"
Process.kill('INT', @pid)
Timeout::timeout(10) do
sleep(10e-3) until Process.wait(@pid, | ruby | {
"resource": ""
} |
q16423 | ROR.SubProcess.wait_log | train | def wait_log(regexp)
cursor = 0
Timeout::timeout(10) do
loop do
line = @loglines[cursor]
sleep(10e-3) if line.nil?
| ruby | {
"resource": ""
} |
q16424 | Unread.GarbageCollector.readers_to_cleanup | train | def readers_to_cleanup(reader_class)
reader_class.
reader_scope.
joins(:read_marks).
where(ReadMark.table_name => { readable_type: readable_class.name }).
group("#{ReadMark.quoted_table_name}.reader_type, #{ReadMark.quoted_table_name}.reader_id, #{reader_class.quoted_table_name}.#{... | ruby | {
"resource": ""
} |
q16425 | Artifactory.Util.truncate | train | def truncate(string, options = {})
length = options[:length] || 30
if string.length > length
string[0..length | ruby | {
"resource": ""
} |
q16426 | Artifactory.Util.rename_keys | train | def rename_keys(options, map = {})
Hash[options.map | ruby | {
"resource": ""
} |
q16427 | Artifactory.Util.slice | train | def slice(options, *keys)
keys.inject({}) do |hash, key|
| ruby | {
"resource": ""
} |
q16428 | Artifactory.Util.xml_to_hash | train | def xml_to_hash(element, child_with_children = "", unique_children = true)
properties = {}
element.each_element_with_text do |e|
if e.name.eql?(child_with_children)
if unique_children
e.each_element_with_text do |t|
properties[t.name] = to_type(t.text)
... | ruby | {
"resource": ""
} |
q16429 | Artifactory.Resource::Artifact.properties | train | def properties(props = nil)
if props.nil? || props.empty?
get_properties
else
| ruby | {
"resource": ""
} |
q16430 | Artifactory.Resource::Artifact.download | train | def download(target = Dir.mktmpdir, options = {})
target = File.expand_path(target)
# Make the directory if it doesn't yet exist
FileUtils.mkdir_p(target) unless File.exist?(target)
# Use the server artifact's filename if one wasn't given
filename = options[:filename] || File.basename(do... | ruby | {
"resource": ""
} |
q16431 | Artifactory.Resource::Artifact.upload | train | def upload(repo, remote_path, properties = {}, headers = {})
file = File.new(File.expand_path(local_path))
matrix = to_matrix_properties(properties)
endpoint = File.join("#{url_safe(repo)}#{matrix}", remote_path)
| ruby | {
"resource": ""
} |
q16432 | Artifactory.Resource::Artifact.get_properties | train | def get_properties(refresh_cache = false)
if refresh_cache || @properties.nil?
@properties = | ruby | {
"resource": ""
} |
q16433 | Artifactory.Resource::Artifact.set_properties | train | def set_properties(properties)
matrix = to_matrix_properties(properties)
| ruby | {
"resource": ""
} |
q16434 | Artifactory.Resource::Artifact.copy_or_move | train | def copy_or_move(action, destination, options = {})
params = {}.tap do |param|
param[:to] = destination
param[:failFast] = 1 if options[:fail_fast]
param[:suppressLayouts] = 1 if options[:suppress_layouts]
param[:dry] = 1 | ruby | {
"resource": ""
} |
q16435 | Artifactory.Resource::Base.to_hash | train | def to_hash
attributes.inject({}) do |hash, (key, value)|
unless Resource::Base.has_attribute?(key)
| ruby | {
"resource": ""
} |
q16436 | Artifactory.Resource::Base.to_matrix_properties | train | def to_matrix_properties(hash = {})
properties = hash.map do |k, v|
key = CGI.escape(k.to_s)
| ruby | {
"resource": ""
} |
q16437 | Artifactory.Resource::Base.to_query_string_parameters | train | def to_query_string_parameters(hash = {})
properties = hash.map do |k, v|
key = URI.escape(k.to_s)
value = URI.escape(v.to_s)
"#{key}=#{value}"
end
if | ruby | {
"resource": ""
} |
q16438 | Artifactory.Resource::Build.promote | train | def promote(target_repo, options = {})
request_body = {}.tap do |body|
body[:status] = options[:status] || "promoted"
body[:comment] = options[:comment] || ""
body[:ciUser] = options[:user] || Artifactory.username
body[:dryRun] = options[:dry_run] || false
... | ruby | {
"resource": ""
} |
q16439 | Artifactory.Resource::Build.save | train | def save
raise Error::InvalidBuildType.new(type) unless BUILD_TYPES.include?(type)
file = Tempfile.new("build.json")
file.write(to_json)
file.rewind
client.put("/api/build", file,
| ruby | {
"resource": ""
} |
q16440 | Artifactory.Resource::BuildComponent.builds | train | def builds
@builds ||= Collection::Build.new(self, name: name) do
| ruby | {
"resource": ""
} |
q16441 | Artifactory.Resource::BuildComponent.delete | train | def delete(options = {})
params = {}.tap do |param|
param[:buildNumbers] = options[:build_numbers].join(",") if options[:build_numbers]
param[:artifacts] = 1 if options[:artifacts]
param[:deleteAll] = 1 if options[:delete_all]
end
| ruby | {
"resource": ""
} |
q16442 | Artifactory.Resource::BuildComponent.rename | train | def rename(new_name, options = {})
endpoint = "/api/build/rename/#{url_safe(name)}" + "?to=#{new_name}"
client.post(endpoint, | ruby | {
"resource": ""
} |
q16443 | Artifactory.Resource::Repository.upload | train | def upload(local_path, remote_path, properties = {}, headers = {})
artifact = Resource::Artifact.new(local_path: local_path)
| ruby | {
"resource": ""
} |
q16444 | Artifactory.Resource::Repository.upload_from_archive | train | def upload_from_archive(local_path, remote_path, properties = {})
artifact = Resource::Artifact.new(local_path: local_path)
| ruby | {
"resource": ""
} |
q16445 | Artifactory.Resource::Repository.artifacts | train | def artifacts
@artifacts ||= Collection::Artifact.new(self, repos: key) do
| ruby | {
"resource": ""
} |
q16446 | Subprocess.Process.drain_fd | train | def drain_fd(fd, buf=nil)
loop do
tmp = fd.read_nonblock(4096)
buf << tmp unless buf.nil?
| ruby | {
"resource": ""
} |
q16447 | Subprocess.Process.select_until | train | def select_until(read_array, write_array, err_array, timeout_at)
if !timeout_at
return IO.select(read_array, write_array, err_array)
end
remaining = | ruby | {
"resource": ""
} |
q16448 | Predictor.InputMatrix.remove_from_set | train | def remove_from_set(set, item)
Predictor.redis.multi do |redis|
| ruby | {
"resource": ""
} |
q16449 | Predictor.InputMatrix.delete_item | train | def delete_item(item)
Predictor.redis.watch(redis_key(:sets, item)) do
sets = Predictor.redis.smembers(redis_key(:sets, item))
Predictor.redis.multi do |multi|
sets.each do |set|
| ruby | {
"resource": ""
} |
q16450 | ADAL.AuthenticationContext.acquire_token_for_client | train | def acquire_token_for_client(resource, client_cred)
fail_if_arguments_nil(resource, | ruby | {
"resource": ""
} |
q16451 | ADAL.AuthenticationContext.acquire_token_with_authorization_code | train | def acquire_token_with_authorization_code(
auth_code, redirect_uri, client_cred, resource = nil)
fail_if_arguments_nil(auth_code, | ruby | {
"resource": ""
} |
q16452 | ADAL.AuthenticationContext.acquire_token_with_refresh_token | train | def acquire_token_with_refresh_token(
refresh_token, client_cred, resource = nil)
fail_if_arguments_nil(refresh_token, | ruby | {
"resource": ""
} |
q16453 | ADAL.AuthenticationContext.authorization_request_url | train | def authorization_request_url(
resource, client_id, redirect_uri, extra_query_params = {})
@authority.authorize_endpoint(
extra_query_params.reverse_merge(
client_id: client_id,
| ruby | {
"resource": ""
} |
q16454 | ADAL.ClientAssertionCertificate.request_params | train | def request_params
jwt_assertion = SelfSignedJwtFactory
.new(@client_id, @authority.token_endpoint)
| ruby | {
"resource": ""
} |
q16455 | ADAL.UserCredential.request_params | train | def request_params
case account_type
when AccountType::MANAGED
managed_request_params
when AccountType::FEDERATED
federated_request_params
| ruby | {
"resource": ""
} |
q16456 | ADAL.WSTrustRequest.execute | train | def execute(username, password)
logger.verbose("Making a WSTrust request with action #{@action}.")
request = Net::HTTP::Get.new(@endpoint.path)
add_headers(request)
request.body | ruby | {
"resource": ""
} |
q16457 | ADAL.MexRequest.execute | train | def execute
request = Net::HTTP::Get.new(@endpoint.path)
request.add_field('Content-Type', | ruby | {
"resource": ""
} |
q16458 | ADAL.Authority.authorize_endpoint | train | def authorize_endpoint(params = nil)
params = params.select { |_, v| !v.nil? } if params.respond_to? :select
if params.nil? || params.empty?
URI::HTTPS.build(host: @host, path: '/' + @tenant + AUTHORIZE_PATH)
else
URI::HTTPS.build(host: @host,
| ruby | {
"resource": ""
} |
q16459 | ADAL.Authority.discovery_uri | train | def discovery_uri(host = WORLD_WIDE_AUTHORITY)
URI(DISCOVERY_TEMPLATE.expand(host: | ruby | {
"resource": ""
} |
q16460 | ADAL.Authority.validated_dynamically? | train | def validated_dynamically?
logger.verbose("Attempting instance discovery at: #{discovery_uri}.")
http_response = Net::HTTP.get(discovery_uri)
if http_response.nil?
logger.error('Dynamic validation | ruby | {
"resource": ""
} |
q16461 | ADAL.WSTrustResponse.grant_type | train | def grant_type
case @token_type
when TokenType::V1
TokenRequest::GrantType::SAML1
when TokenType::V2
| ruby | {
"resource": ""
} |
q16462 | ADAL.SelfSignedJwtFactory.create_and_sign_jwt | train | def create_and_sign_jwt(certificate, private_key) | ruby | {
"resource": ""
} |
q16463 | ADAL.SelfSignedJwtFactory.header | train | def header(certificate)
x5t = thumbprint(certificate)
logger.verbose("Creating self signed | ruby | {
"resource": ""
} |
q16464 | ADAL.SelfSignedJwtFactory.payload | train | def payload
now = Time.now - 1
expires = now + 60 * SELF_SIGNED_JWT_LIFETIME
logger.verbose("Creating self signed JWT payload. Expires: #{expires}. " \
"NotBefore: #{now}.")
{ AUDIENCE => @token_endpoint,
| ruby | {
"resource": ""
} |
q16465 | ADAL.TokenRequest.get_for_client | train | def get_for_client(resource)
logger.verbose("TokenRequest getting token for client for #{resource}.")
request(GRANT_TYPE | ruby | {
"resource": ""
} |
q16466 | ADAL.TokenRequest.get_with_authorization_code | train | def get_with_authorization_code(auth_code, redirect_uri, resource = nil)
logger.verbose('TokenRequest getting token with authorization code ' \
"#{auth_code}, redirect_uri #{redirect_uri} and " \
"resource #{resource}.")
request(CODE => | ruby | {
"resource": ""
} |
q16467 | ADAL.TokenRequest.get_with_refresh_token | train | def get_with_refresh_token(refresh_token, resource = nil)
logger.verbose('TokenRequest getting token with refresh token digest ' \
"#{Digest::SHA256.hexdigest refresh_token} and | ruby | {
"resource": ""
} |
q16468 | ADAL.TokenRequest.get_with_user_credential | train | def get_with_user_credential(user_cred, resource = nil)
logger.verbose('TokenRequest getting token with user credential ' \
"#{user_cred} and resource #{resource}.")
oauth = if user_cred.is_a? UserIdentifier
lambda do
fail UserCredentialError,
... | ruby | {
"resource": ""
} |
q16469 | ADAL.TokenRequest.request | train | def request(params, &block)
cached_token = check_cache(request_params(params))
| ruby | {
"resource": ""
} |
q16470 | ADAL.CacheDriver.add | train | def add(token_response)
return unless token_response.instance_of? SuccessResponse
logger.verbose('Adding successful TokenResponse to cache.')
| ruby | {
"resource": ""
} |
q16471 | ADAL.CacheDriver.find | train | def find(query = {})
query = query.map { |k, v| [FIELDS[k], v] if FIELDS[k] }.compact.to_h
resource = query.delete(RESOURCE)
matches = validate(
| ruby | {
"resource": ""
} |
q16472 | ADAL.CacheDriver.find_all_cached_entries | train | def find_all_cached_entries(query)
logger.verbose("Searching cache for tokens by keys: #{query.keys}.")
@token_cache.find do |entry|
query.map do |k, v|
| ruby | {
"resource": ""
} |
q16473 | ADAL.CacheDriver.refresh_mrrt | train | def refresh_mrrt(responses, resource)
logger.verbose("Attempting to obtain access token for #{resource} by " \
"refreshing 1 of #{responses.count(&:mrrt?)} matching " \
'MRRTs.')
responses.each do |response|
| ruby | {
"resource": ""
} |
q16474 | ADAL.CacheDriver.resource_specific | train | def resource_specific(responses, resource)
logger.verbose("Looking through #{responses.size} matching cache " \
| ruby | {
"resource": ""
} |
q16475 | ADAL.CacheDriver.update_refresh_tokens | train | def update_refresh_tokens(mrrt)
fail ArgumentError, 'Token must contain an MRRT.' unless mrrt.mrrt?
| ruby | {
"resource": ""
} |
q16476 | ADAL.CacheDriver.validate | train | def validate(entries)
logger.verbose("Validating #{entries.size} possible cache matches.")
| ruby | {
"resource": ""
} |
q16477 | ADAL.CachedTokenResponse.to_json | train | def to_json(_ = nil)
JSON.unparse(authority: [authority.host, authority.tenant],
| ruby | {
"resource": ""
} |
q16478 | ADAL.CachedTokenResponse.can_refresh? | train | def can_refresh?(other)
mrrt? && (authority == other.authority) &&
| ruby | {
"resource": ""
} |
q16479 | ADAL.CachedTokenResponse.validate | train | def validate(expiration_buffer_sec = 0)
return true if (Time.now + expiration_buffer_sec).to_i < expires_on
unless refresh_token
logger.verbose('Cached token is almost expired but no refresh token ' \
'is available.')
return false
end
logger.verbose('Cached... | ruby | {
"resource": ""
} |
q16480 | ADAL.CachedTokenResponse.refresh | train | def refresh(new_resource = resource)
token_response = TokenRequest
.new(authority, @client)
.get_with_refresh_token(refresh_token, new_resource)
if | ruby | {
"resource": ""
} |
q16481 | ADAL.Util.string_hash | train | def string_hash(hash)
hash.map | ruby | {
"resource": ""
} |
q16482 | ADAL.MemoryCache.add | train | def add(entries)
entries = Array(entries) # If entries is an array, this is a no-op.
old_size = @entries.size
@entries |= entries
| ruby | {
"resource": ""
} |
q16483 | ADAL.OAuthRequest.execute | train | def execute
request = Net::HTTP::Post.new(@endpoint_uri.path)
add_headers(request)
| ruby | {
"resource": ""
} |
q16484 | ADAL.OAuthRequest.add_headers | train | def add_headers(request)
return if Logging.correlation_id.nil?
request.add_field(CLIENT_REQUEST_ID.to_s, | ruby | {
"resource": ""
} |
q16485 | U2F.U2F.authenticate! | train | def authenticate!(challenge, response, registration_public_key, registration_counter)
# TODO: check that it's the correct key_handle as well
raise NoMatchingRequestError unless challenge == response.client_data.challenge
raise ClientDataTypeError unless response.client_data.authentication?
| ruby | {
"resource": ""
} |
q16486 | U2F.U2F.register! | train | def register!(challenges, response)
challenges = [challenges] unless challenges.is_a? Array
challenge = challenges.detect do |chg|
chg == response.client_data.challenge
end
raise UnmatchedChallengeError unless challenge
raise ClientDataTypeError unless response.client_data.regist... | ruby | {
"resource": ""
} |
q16487 | U2F.SignResponse.verify | train | def verify(app_id, public_key_pem)
data = [
::U2F::DIGEST.digest(app_id),
signature_data.byteslice(0, 5),
::U2F::DIGEST.digest(client_data_json)
| ruby | {
"resource": ""
} |
q16488 | U2F.RegisterResponse.verify | train | def verify(app_id)
# Chapter 4.3 in
# http://fidoalliance.org/specs/fido-u2f-raw-message-formats-v1.0-rd-20141008.pdf
data = [
"\x00",
::U2F::DIGEST.digest(app_id),
::U2F::DIGEST.digest(client_data_json),
key_handle_raw,
public_key_raw
].join
| ruby | {
"resource": ""
} |
q16489 | U2F.FakeU2F.register_response | train | def register_response(challenge, error = false)
if error
JSON.dump(errorCode: 4)
else
client_data_json = client_data(::U2F::ClientData::REGISTRATION_TYP, challenge)
JSON.dump(
| ruby | {
"resource": ""
} |
q16490 | U2F.FakeU2F.sign_response | train | def sign_response(challenge)
client_data_json = client_data(::U2F::ClientData::AUTHENTICATION_TYP, challenge)
JSON.dump(
clientData: ::U2F.urlsafe_encode64(client_data_json),
| ruby | {
"resource": ""
} |
q16491 | U2F.FakeU2F.reg_registration_data | train | def reg_registration_data(client_data_json)
::U2F.urlsafe_encode64(
[
5,
origin_public_key_raw,
key_handle_raw.bytesize,
key_handle_raw,
cert_raw,
| ruby | {
"resource": ""
} |
q16492 | U2F.FakeU2F.reg_signature | train | def reg_signature(client_data_json)
payload = [
"\x00",
::U2F::DIGEST.digest(app_id),
::U2F::DIGEST.digest(client_data_json),
key_handle_raw,
| ruby | {
"resource": ""
} |
q16493 | U2F.FakeU2F.auth_signature | train | def auth_signature(client_data_json)
data = [
::U2F::DIGEST.digest(app_id),
1, # User present
counter,
| ruby | {
"resource": ""
} |
q16494 | U2F.FakeU2F.client_data | train | def client_data(typ, challenge)
JSON.dump(
challenge: challenge,
| ruby | {
"resource": ""
} |
q16495 | U2F.FakeU2F.cert | train | def cert
@cert ||= OpenSSL::X509::Certificate.new.tap do |c|
c.subject = c.issuer = OpenSSL::X509::Name.parse(cert_subject)
c.not_before | ruby | {
"resource": ""
} |
q16496 | Fast.Rewriter.replace_on | train | def replace_on(*types)
types.map do |type|
self.class.send :define_method, "on_#{type}" do |node|
if captures = match?(node) # | ruby | {
"resource": ""
} |
q16497 | Fast.Matcher.captures? | train | def captures?(fast = @fast)
case fast
when Capture then true
when Array then fast.any?(&method(:captures?))
| ruby | {
"resource": ""
} |
q16498 | Fast.Matcher.find_captures | train | def find_captures(fast = @fast)
return true if fast == @fast && !captures?(fast)
case fast
when Capture then fast.captures
| ruby | {
"resource": ""
} |
q16499 | Fast.Matcher.prepare_arguments | train | def prepare_arguments(expression, arguments)
case expression
when Array
expression.each do |item|
prepare_arguments(item, arguments)
end
when Fast::FindFromArgument | ruby | {
"resource": ""
} |
Subsets and Splits
SQL Console for CoIR-Retrieval/CodeSearchNet-ccr-ruby-queries-corpus
Retrieves a large number of entries in the 'ruby' language, providing basic information but limited analytical value.