_id stringlengths 2 6 | title stringlengths 9 130 | partition stringclasses 3
values | text stringlengths 30 4.3k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q9200 | Fishbans.BlockEngine.get_block | train | def get_block(id, metadata = nil, size = 42)
url = "http://blocks.fishbans.com/#{id}"
url += "-#{metadata}" unless metadata.nil?
url += "/#{size}" if size != 42
| ruby | {
"resource": ""
} |
q9201 | Fishbans.BlockEngine.get_monster | train | def get_monster(id, three = false, size = 42)
id = id.to_s
url = 'http://blocks.fishbans.com'
url += "/#{id}" if id =~ /^m/
url += "/m#{id}" if id !~ /^m/
url += '-3d' if three
url += "/#{size}" if | ruby | {
"resource": ""
} |
q9202 | Osiris.ZipFileGenerator.write | train | def write(inputDir, outputFile)
entries = Dir.entries(inputDir); entries.delete("."); entries.delete("..")
io = Zip::File.open(outputFile, | ruby | {
"resource": ""
} |
q9203 | FileBlobs.ActiveRecordFixtureSetExtensions.file_blob_id | train | def file_blob_id(path)
file_path = Rails.root.join('test/fixtures'.freeze).join(path)
blob_contents = | ruby | {
"resource": ""
} |
q9204 | FileBlobs.ActiveRecordFixtureSetExtensions.file_blob_data | train | def file_blob_data(path, options = {})
# The line with base64 data must be indented further than the current line.
indent = ' ' * ((options[:indent] || 2) + 2)
file_path = | ruby | {
"resource": ""
} |
q9205 | FileBlobs.ActiveRecordFixtureSetExtensions.file_blob_size | train | def file_blob_size(path)
file_path = Rails.root.join('test/fixtures'.freeze).join( | ruby | {
"resource": ""
} |
q9206 | StorageRoom.File.set_with_filename | train | def set_with_filename(path)
return if path.blank?
self.filename = ::File.basename(path) | ruby | {
"resource": ""
} |
q9207 | StorageRoom.File.download_to_directory | train | def download_to_directory(path)
Dir.mkdir(path) unless ::File.directory?(path) | ruby | {
"resource": ""
} |
q9208 | ICU.Player.to_sp_text | train | def to_sp_text(rounds, columns, formats)
values = columns.inject([]) do |vals,col|
val = send(col).to_s
val.sub!(/\.0/, '') if col == :points
vals << val
end
(1..rounds).each do |r|
| ruby | {
"resource": ""
} |
q9209 | NumericArray.InstanceMethods.variance | train | def variance(sample = false)
a = numerify
avg = a.average
sum = a.inject(0) { |sum, value| sum + (value - | ruby | {
"resource": ""
} |
q9210 | GemFootprintAnalyzer.CLI.run | train | def run(args = ARGV)
opts.parse!(args)
if !analyze_gemfile? && args.empty?
puts opts.parser
| ruby | {
"resource": ""
} |
q9211 | StreamBot.Tracker.start | train | def start
keywords = self.params["keywords"]
@thread = Thread.new do
@client.filter_by_keywords(keywords) do |status|
| ruby | {
"resource": ""
} |
q9212 | StreamBot.Tracker.load_filters | train | def load_filters
filters_config = self.params["filters_config" ]
if !filters_config.nil? && File.exists?(filters_config)
begin
| ruby | {
"resource": ""
} |
q9213 | StreamBot.Tracker.retweet? | train | def retweet?(status)
filters = load_filters
retweet = true
if !filters.nil?
filters.each_pair do |path, value|
array = []
array << value
array.flatten.each do |filter_value|
| ruby | {
"resource": ""
} |
q9214 | HTML.AutoTag.tag | train | def tag( params )
# TODO: make these method args if possible
tag = params['tag']
attr = params['attr']
cdata = params['cdata']
unless attr.kind_of?( HTML::AutoAttr )
attr = HTML::AutoAttr.new( attr, @sorted )
end
#... | ruby | {
"resource": ""
} |
q9215 | Chartify.ChartBase.darken_color | train | def darken_color(hex_color, amount=0.4)
hex_color = hex_color.gsub('#', '')
rgb = hex_color.scan(/../).map { |color| color.hex }
rgb[0] = (rgb[0].to_i * amount).round
| ruby | {
"resource": ""
} |
q9216 | Chartify.ChartBase.lighten_color | train | def lighten_color(hex_color, amount=0.6)
hex_color = hex_color.gsub('#', '')
rgb = hex_color.scan(/../).map { |color| color.hex }
rgb[0] = [(rgb[0].to_i + 255 * amount).round, 255].min
rgb[1] | ruby | {
"resource": ""
} |
q9217 | Trax.Model.reverse_assign_attributes | train | def reverse_assign_attributes(attributes_hash)
attributes_to_assign = attributes_hash.keys.reject{|_attribute_name| | ruby | {
"resource": ""
} |
q9218 | MediaWiki.Query.pages | train | def pages
result_map = map_query_to_results
query_result["query"]["pages"].each do |key, value|
page_title = | ruby | {
"resource": ""
} |
q9219 | MediaWiki.Query.map_query_to_results | train | def map_query_to_results
#Initalize map
result_map = initialize_map
# Apply the normalization to the result map
normalized = get_query_map("normalized")
if normalized
result_map = get_normalizations_for(result_map, normalized)
end
# Apply | ruby | {
"resource": ""
} |
q9220 | WhereWasI.Track.add_point | train | def add_point(lat:, lon:, elevation:, time:)
time = Time.parse(time) if ! time.is_a?(Time)
current = [lat, lon, elevation]
if @start_time.nil? || time < @start_time
@start_time = time
@start_location = current
end
| ruby | {
"resource": ""
} |
q9221 | WhereWasI.Track.in_time_range? | train | def in_time_range?(time)
time = Time.parse(time) if ! time.is_a?(Time)
| ruby | {
"resource": ""
} |
q9222 | WhereWasI.Track.at | train | def at(time)
if time.is_a?(String)
time = Time.parse(time)
end
if time.is_a?(Integer)
time = Time.at(time)
end
raise ArgumentError, "time must be a Time,String, or Fixnum" if ! time.is_a?(Time)
return | ruby | {
"resource": ""
} |
q9223 | LooseLeaf.TaskHelpers.sh_in_dir | train | def sh_in_dir(dir, shell_commands)
shell_commands = [shell_commands] if shell_commands.is_a?(String) | ruby | {
"resource": ""
} |
q9224 | ODBA.Cache.create_deferred_indices | train | def create_deferred_indices(drop_existing = false)
@deferred_indices.each { |definition|
name = definition.index_name
if(drop_existing && self.indices.include?(name))
drop_index(name)
end
unless(self.indices.include?(name))
| ruby | {
"resource": ""
} |
q9225 | ODBA.Cache.create_index | train | def create_index(index_definition, origin_module=Object)
transaction {
klass = if(index_definition.fulltext)
FulltextIndex
elsif(index_definition.resolve_search_term.is_a?(Hash))
ConditionIndex
else
Index
| ruby | {
"resource": ""
} |
q9226 | ODBA.Cache.delete | train | def delete(odba_object)
odba_id = odba_object.odba_id
name = odba_object.odba_name
odba_object.odba_notify_observers(:delete, odba_id, odba_object.object_id)
rows = ODBA.storage.retrieve_connected_objects(odba_id)
rows.each { |row|
id = row.first
# Self-Referencing objects don't have to be ... | ruby | {
"resource": ""
} |
q9227 | ODBA.Cache.drop_index | train | def drop_index(index_name)
transaction {
ODBA.storage.drop_index(index_name)
| ruby | {
"resource": ""
} |
q9228 | ODBA.Cache.next_id | train | def next_id
if @file_lock
dbname = ODBA.storage.instance_variable_get('@dbi').dbi_args.first.split(/:/).last
id = new_id(dbname, ODBA.storage)
else
id = ODBA.storage.next_id
end
@peers.each do |peer|
| ruby | {
"resource": ""
} |
q9229 | ODBA.Cache.retrieve_from_index | train | def retrieve_from_index(index_name, search_term, meta=nil)
index = indices.fetch(index_name)
ids = index.fetch_ids(search_term, meta)
if meta.respond_to?(:error_limit) && (limit = meta.error_limit) \
&& (size = ids.size) > limit.to_i
error = OdbaResultLimitError.new
error.limit = | ruby | {
"resource": ""
} |
q9230 | ODBA.Cache.store | train | def store(object)
odba_id = object.odba_id
name = object.odba_name
object.odba_notify_observers(:store, odba_id, object.object_id)
if(ids = Thread.current[:txids])
ids.unshift([odba_id,name])
end
## get target_ids before anything else
target_ids = object.odba_target_ids
changes = st... | ruby | {
"resource": ""
} |
q9231 | I18nAdminUtils.ApplicationHelper.translation_missing_icon | train | def translation_missing_icon(translation)
missing_translations = translation.missing_translations
color_id = (missing_translations.size.to_f/translation.translations.size.to_f*5).ceil-1
if missing_translations.size == 0
content_tag 'span', '', :class => 'glyphicon glyphicon-ok greentext',
... | ruby | {
"resource": ""
} |
q9232 | Blueprint.Namespace.add_namespace | train | def add_namespace(html, namespace)
html.gsub!(/(class=")([a-zA-Z0-9\-_ ]*)(")/) do |m|
classes = | ruby | {
"resource": ""
} |
q9233 | StixSchemaSpy.SimpleType.enumeration_values | train | def enumeration_values
enumeration = @xml.xpath('./xs:restriction/xs:enumeration', {'xs' => 'http://www.w3.org/2001/XMLSchema'})
if enumeration.length > 0
| ruby | {
"resource": ""
} |
q9234 | LatoBlog.Interface::Categories.blog__create_default_category | train | def blog__create_default_category
category_parent = LatoBlog::CategoryParent.find_by(meta_default: true)
return if category_parent
category_parent = LatoBlog::CategoryParent.new(meta_default: true)
throw 'Impossible to create default category parent' unless category_parent.save
| ruby | {
"resource": ""
} |
q9235 | LatoBlog.Interface::Categories.blog__clean_category_parents | train | def blog__clean_category_parents
category_parents = LatoBlog::CategoryParent.all | ruby | {
"resource": ""
} |
q9236 | LatoBlog.Interface::Categories.blog__get_categories | train | def blog__get_categories(
order: nil,
language: nil,
search: nil,
page: nil,
per_page: nil
)
categories = LatoBlog::Category.all
# apply filters
order = order && order == 'ASC' ? 'ASC' : 'DESC'
categories = _categories_filter_by_order(categories, order)
c... | ruby | {
"resource": ""
} |
q9237 | SugarfreeConfig.Config.fetch_config | train | def fetch_config
Rails.logger.debug "Loading #{@file}::#{@env}" if Object.const_defined?('Rails') && | ruby | {
"resource": ""
} |
q9238 | SugarfreeConfig.Config.default_options | train | def default_options
if Object.const_defined?('Rails')
{
:file => Rails.root.join('config', 'config.yml'),
:reload => Rails.env.development?,
| ruby | {
"resource": ""
} |
q9239 | SugarfreeConfig.ConfigIterator.next | train | def next
if (value = @scoped_config[@path_elements.last]).nil?
raise ConfigKeyException.new(@path_elements)
| ruby | {
"resource": ""
} |
q9240 | ClassProxy.ClassMethods.proxy_methods | train | def proxy_methods(*methods)
@_methods ||= {}
methods.each do |method|
if method.is_a? Symbol
# If given a symbol, store as a method to overwrite and use the default loader
proxy_method method
elsif method.is_a? Hash
# | ruby | {
"resource": ""
} |
q9241 | ClassProxy.ClassMethods.fetch | train | def fetch(args, options={})
@primary_fetch.is_a?(Proc) ? @primary_fetch[args] : | ruby | {
"resource": ""
} |
q9242 | Weechat.Plugin.unload | train | def unload(force = false)
if name == "ruby" and !force
Weechat.puts "Won't unload the ruby plugin unless you force it."
false
| ruby | {
"resource": ""
} |
q9243 | Weechat.Plugin.scripts | train | def scripts
scripts = []
Infolist.parse("#{name}_script").each do |script|
| ruby | {
"resource": ""
} |
q9244 | HttpPing.HttpPing::WMI.ping | train | def ping(host = @host, options = {})
super(host)
lhost = Socket.gethostname
cs = "winmgmts:{impersonationLevel=impersonate}!//#{lhost}/root/cimv2"
wmi = WIN32OLE.connect(cs)
query = "select * from win32_pingstatus where address = '#{host}'"
unless options.empty?
options.e... | ruby | {
"resource": ""
} |
q9245 | CaRuby.SQLExecutor.query | train | def query(sql, *args, &block)
fetched = nil
execute do |dbh|
result = dbh.execute(sql, *args)
if block_given? then
result.each(&block)
else
| ruby | {
"resource": ""
} |
q9246 | CaRuby.SQLExecutor.transact | train | def transact(sql=nil, *args)
# Work-around for rcbi nil substitution.
if sql then
sql, *args = replace_nil_binds(sql, args)
transact { |dbh| dbh.execute(sql, *args) }
elsif block_given? then
| ruby | {
"resource": ""
} |
q9247 | CaRuby.SQLExecutor.replace_nil_binds | train | def replace_nil_binds(sql, args)
nils = []
args.each_with_index { |value, i| nils << i if value.nil? }
unless nils.empty? then
logger.debug { "SQL executor working around RDBI bug by eliminating the nil arguments #{nils.to_series} for the SQL:\n#{sql}..." }
# Quoted ? is too much of a ... | ruby | {
"resource": ""
} |
q9248 | BuoyData.NoaaStation.current_reading | train | def current_reading(doc)
reading = {}
xpath = "//table/caption[@class='titleDataHeader']["
xpath += "contains(text(),'Conditions')"
xpath += " and "
xpath += "not(contains(text(),'Solar Radiation'))"
xpath += "]"
# Get the reading timestamp
source_updated_at = reading_t... | ruby | {
"resource": ""
} |
q9249 | VcenterLib.VmConverter.facts | train | def facts
logger.debug "get complete data of all VMs in all datacenters: begin"
result = Hash[vm_mos_to_h(@vcenter.vms).map do |h|
[h['name'], Hash[h.map { |k, v| [k.tr('.', '_'), v] | ruby | {
"resource": ""
} |
q9250 | Duxml.ElementGuts.traverse | train | def traverse(node=nil, &block)
return self.to_enum unless block_given?
node_stack = [node || self]
until node_stack.empty?
current = node_stack.shift
if current
yield current
node_stack = | ruby | {
"resource": ""
} |
q9251 | Cloudpassage.Base.method_missing | train | def method_missing(sym, *args, &block)
if (data && data[sym])
data[sym]
else
| ruby | {
"resource": ""
} |
q9252 | Derelict.Instance.validate! | train | def validate!
logger.debug "Starting validation for #{description}"
raise NotFound.new path unless File.exists? path
raise NonDirectory.new path unless File.directory? path
raise MissingBinary.new vagrant unless File.exists? vagrant
| ruby | {
"resource": ""
} |
q9253 | Derelict.Instance.version | train | def version
logger.info "Determining Vagrant version for #{description}"
output = execute!("--version").stdout | ruby | {
"resource": ""
} |
q9254 | Derelict.Instance.execute | train | def execute(subcommand, *arguments, &block)
options = arguments.last.is_a?(Hash) ? arguments.pop : Hash.new
command = command(subcommand, *arguments)
command = "sudo -- #{command}" if options.delete(:sudo)
| ruby | {
"resource": ""
} |
q9255 | Derelict.Instance.command | train | def command(subcommand, *arguments)
args = [vagrant, subcommand.to_s, arguments].flatten
args.map {|a| Shellwords.escape a }.join(' ').tap | ruby | {
"resource": ""
} |
q9256 | Deas.ShowExceptions.call! | train | def call!(env)
status, headers, body = @app.call(env)
if error = env['deas.error']
error_body = Body.new(error)
headers['Content-Length'] = error_body.size.to_s
headers['Content-Type'] | ruby | {
"resource": ""
} |
q9257 | HelpDeskAPI.Client.sign_in | train | def sign_in
# Contact sign in page to set cookies.
begin
sign_in_res = RestClient.get(Endpoints::SIGN_IN)
rescue RestClient::ExceptionWithResponse => error
fail HelpDeskAPI::Exceptions.SignInError, "Error contacting #{Endpoints::SIGN_IN}: #{error}"
end
# Parse authenticity... | ruby | {
"resource": ""
} |
q9258 | XS.Message.copy_in_bytes | train | def copy_in_bytes bytes, len
data_buffer = LibC.malloc len
# writes the exact number of bytes, no null byte to terminate string
data_buffer.write_string bytes, len
# use libC to call free on the data buffer; earlier versions used an
# FFI::Function here that called back into Ruby, but Rub... | ruby | {
"resource": ""
} |
q9259 | Confuse.Config.check | train | def check
@definition.namespaces.each do |(namespace, ns)|
ns.items.each do |key, _|
| ruby | {
"resource": ""
} |
q9260 | Rsxml.Util.check_opts | train | def check_opts(constraints, opts)
opts ||= {}
opts.each{|k,v| raise "opt not permitted: #{k.inspect}" if !constraints.has_key?(k)}
Hash[constraints.map do |k,constraint|
if opts.has_key?(k)
v = opts[k]
if constraint.is_a?(Array)
| ruby | {
"resource": ""
} |
q9261 | Align.PairwiseAlgorithm.max4 | train | def max4(a,b,c,d)
x = a >= b ? a : b | ruby | {
"resource": ""
} |
q9262 | MultiForecast.Client.get_complex | train | def get_complex(path)
client(path).get_complex(service_name(path), section_name(path), graph_name(path)).tap do |graph|
| ruby | {
"resource": ""
} |
q9263 | MultiForecast.Client.delete_complex | train | def delete_complex(path)
client(path).delete_complex(service_name(path), | ruby | {
"resource": ""
} |
q9264 | FentonShell.Certificate.certificate_create | train | def certificate_create(global_options, options)
result = Excon.post(
"#{global_options[:fenton_server_url]}/certificates.json",
body: certificate_json(options),
| ruby | {
"resource": ""
} |
q9265 | HasMedia.ClassMethods.set_relations | train | def set_relations(context, relation)
@contexts ||= {}
@contexts[relation] ||= []
@media_relation_set ||= []
if @contexts[relation].include?(context)
raise Exception.new("You should NOT use same context identifier for several has_one or has_many relation to media")
end
@contex... | ruby | {
"resource": ""
} |
q9266 | Some.API.method_missing | train | def method_missing meth, *args, &block
meth_s = meth.to_s
if @method && meth_s =~ API_REGEX
if meth_s.end_with?('!')
# `foo! bar' is syntactic sugar for `foo.! bar'
self[meth_s[0...-1]].!(args[0] || {})
else
| ruby | {
"resource": ""
} |
q9267 | Xcellus.Instance.save | train | def save(path)
unless path.kind_of? String
raise ArgumentError, 'save expects a string path'
| ruby | {
"resource": ""
} |
q9268 | Samsao.Helpers.changelog_modified? | train | def changelog_modified?(*changelogs)
changelogs = config.changelogs if changelogs.nil? || changelogs.empty?
| ruby | {
"resource": ""
} |
q9269 | Samsao.Helpers.has_app_changes? | train | def has_app_changes?(*sources)
sources = config.sources if sources.nil? || sources.empty?
sources.any? do |source|
| ruby | {
"resource": ""
} |
q9270 | Samsao.Helpers.truncate | train | def truncate(input, max = 30)
return input if input.nil? || input.length <= max
| ruby | {
"resource": ""
} |
q9271 | MultiGit.Ref.resolve | train | def resolve
@leaf ||= begin
ref = self
loop do
break ref unless ref.target.kind_of? MultiGit::Ref | ruby | {
"resource": ""
} |
q9272 | MultiGit.Ref.commit | train | def commit(options = {}, &block)
resolve.update(options.fetch(:lock, :optimistic)) do |current|
| ruby | {
"resource": ""
} |
q9273 | Authpwn.ControllerInstanceMethods.set_session_current_user | train | def set_session_current_user(user)
self.current_user = user
# Try to reuse existing sessions.
if session[:authpwn_suid]
token = Tokens::SessionUid.with_code(session[:authpwn_suid]).first
if token
if token.user == user
token.touch
return user
else
tok... | ruby | {
"resource": ""
} |
q9274 | Authpwn.ControllerInstanceMethods.authenticate_using_session | train | def authenticate_using_session
return if current_user
session_uid = session[:authpwn_suid]
user = session_uid && Tokens::SessionUid.authenticate(session_uid) | ruby | {
"resource": ""
} |
q9275 | Tkar.Canvas.del | train | def del tkar_id
tkaroid = @objects[tkar_id]
if tkaroid
if @follow_id == tkar_id
follow nil
end
delete tkaroid.tag
@objects.delete tkar_id
| ruby | {
"resource": ""
} |
q9276 | Aptly.Repo.add | train | def add path, kwargs={}
remove_files = kwargs.arg :remove_files, false
cmd = 'aptly repo add'
cmd += ' -remove-files' if remove_files
| ruby | {
"resource": ""
} |
q9277 | Aptly.Repo.import | train | def import from_mirror, kwargs={}
deps = kwargs.arg :deps, false
packages = kwargs.arg :packages, []
if packages.length == 0
raise AptlyError.new '1 or more packages are required'
end
cmd = 'aptly repo import'
cmd += ' -with-deps' if | ruby | {
"resource": ""
} |
q9278 | Aptly.Repo.copy | train | def copy from_repo, to_repo, kwargs={}
deps = kwargs.arg :deps, false
packages = kwargs.arg :packages, []
if packages.length == 0
raise AptlyError.new '1 or more packages are required'
end
cmd = 'aptly repo copy'
cmd += ' -with-deps' if | ruby | {
"resource": ""
} |
q9279 | GoogleApi.Session.login | train | def login(code = nil)
@client = Google::APIClient.new
@client.authorization.client_id = c('client_id')
@client.authorization.client_secret = c('client_secret')
@client.authorization.scope = @scope
@client.authorization.redirect_uri = | ruby | {
"resource": ""
} |
q9280 | GoogleApi.Session.login_by_line | train | def login_by_line(server = 'http://localhost/oauth2callback', port = 0)
begin
require "launchy" # open browser
rescue
raise GoogleApi::RequireError, "You don't have launchy gem. Firt install it: gem install launchy."
end
require "socket" # make tcp server
require "... | ruby | {
"resource": ""
} |
q9281 | Vtasks.Docker.add_namespace | train | def add_namespace(image, path)
namespace path.to_sym do |_args|
require 'rspec/core/rake_task'
::RSpec::Core::RakeTask.new(:spec) do |task|
task.pattern = "#{path}/spec/*_spec.rb"
end
docker_image = Vtasks::Docker::Image.new(image, path, args)
lint_image(path)
... | ruby | {
"resource": ""
} |
q9282 | Vtasks.Docker.dockerfiles | train | def dockerfiles
@dockerfiles = Dir.glob('*').select do |dir|
| ruby | {
"resource": ""
} |
q9283 | Vtasks.Docker.list_images | train | def list_images
desc 'List all Docker images'
task :list do
| ruby | {
"resource": ""
} |
q9284 | ReturnHook.FormTagHelper.html_options_for_form | train | def html_options_for_form(url_for_options, options)
options.stringify_keys.tap do |html_options|
html_options["enctype"] = "multipart/form-data" if html_options.delete("multipart")
# The following URL is unescaped, this is just a hash of options, and it is the
# responsibility of the calle... | ruby | {
"resource": ""
} |
q9285 | Beanstalkify.Environment.deploy! | train | def deploy!(app, settings=[])
@beanstalk.update_environment({
version_label: app.version,
| ruby | {
"resource": ""
} |
q9286 | Beanstalkify.Environment.create! | train | def create!(archive, stack, cnames, settings=[])
params = {
application_name: archive.app_name,
version_label: archive.version,
environment_name: self.name,
solution_stack_name: stack,
option_settings: settings
}
cnames.each do |c|
if | ruby | {
"resource": ""
} |
q9287 | DR.Encoding.fix_utf8 | train | def fix_utf8(s=nil)
s=self if s.nil? #if we are included
if String.method_defined?(:scrub)
#Ruby 2.1
#cf http://ruby-doc.org/core-2.1.0/String.html#method-i-scrub
| ruby | {
"resource": ""
} |
q9288 | DR.Encoding.to_utf8! | train | def to_utf8!(s=nil,from:nil)
s=self if s.nil? #if we are included
from=s.encoding if from.nil?
return s.encode!('UTF-8',from, :invalid => :replace, :undef => :replace,
| ruby | {
"resource": ""
} |
q9289 | Muack.Spy.__mock_dispatch_spy | train | def __mock_dispatch_spy
@stub.__mock_disps.values.flatten.each do |disp|
next unless __mock_defis.key?(disp.msg) # ignore undefined spies
defis = __mock_defis[disp.msg]
if idx = __mock_find_checked_difi(defis, disp.args, :index) | ruby | {
"resource": ""
} |
q9290 | Samsao.Actions.check_non_single_commit_feature | train | def check_non_single_commit_feature(level = :fail)
commit_count = git.commits.size
message = "Your feature branch should have a single commit but found #{commit_count}, | ruby | {
"resource": ""
} |
q9291 | Samsao.Actions.check_feature_jira_issue_number | train | def check_feature_jira_issue_number(level = :fail)
return if samsao.trivial_change? || !samsao.feature_branch?
return report(:fail, 'Your Danger config is missing a `jira_project_key` value.') unless | ruby | {
"resource": ""
} |
q9292 | Samsao.Actions.check_fix_jira_issue_number | train | def check_fix_jira_issue_number(level = :warn)
return if samsao.trivial_change? || !samsao.fix_branch?
return report(:fail, 'Your | ruby | {
"resource": ""
} |
q9293 | Samsao.Actions.check_acceptance_criteria | train | def check_acceptance_criteria(level = :warn)
return unless samsao.feature_branch?
message = 'The PR | ruby | {
"resource": ""
} |
q9294 | Samsao.Actions.check_label_pr | train | def check_label_pr(level = :fail)
message = 'The PR should have at least one label added to it.'
| ruby | {
"resource": ""
} |
q9295 | Samsao.Actions.report | train | def report(level, content)
case level
when :warn
warn content
when :fail
| ruby | {
"resource": ""
} |
q9296 | Samsao.Actions.check_commit_contains_jira_issue_number | train | def check_commit_contains_jira_issue_number(commit, type)
commit_id = "#{shorten_sha(commit.sha)} ('#{truncate(commit.message)}')"
jira_project_key = config.jira_project_key
message = "The commit message #{commit_id} should contain JIRA issue number" \
" between square brackets (i.e. | ruby | {
"resource": ""
} |
q9297 | ZTK.Background.wait | train | def wait
config.ui.logger.debug { "wait" }
pid, status = (Process.wait2(@pid) rescue nil)
if !pid.nil? && !status.nil?
data = (Marshal.load(Base64.decode64(@parent_reader.read.to_s)) rescue nil)
config.ui.logger.debug { "read(#{data.inspect})" }
| ruby | {
"resource": ""
} |
q9298 | SycLink.Formatter.extract_columns | train | def extract_columns(rows, header)
columns = []
header.each do |h|
columns << rows.map do |r|
| ruby | {
"resource": ""
} |
q9299 | SycLink.Formatter.max_column_widths | train | def max_column_widths(columns, header, opts = {})
row_column_widths = columns.map do |c|
c.reduce(0) { |m, v| [m, v.nil? ? 0 : v.length].max }
end
header_column_widths = header.map { |h| h.length }
row_column_widths = header_column_widths if row_column_widths.empty?
| 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.