anchor dict | positive dict | negative dict |
|---|---|---|
{
"audio": "",
"image": "",
"text": "def is_s3_bucket_name_available?(bucket_name)\n s3 = Fog::Storage::AWS.new(:aws_access_key_id => @access_key_id, :aws_secret_access_key => @secret_access_key)\n ",
"video": ""
} | {
"audio": "",
"image": "",
"text": " begin\n response = s3.get_bucket(bucket_name)\n rescue Exception => e\n response = e.response\n end\n not_found_status = 404\n return response[:status] == not_found_status\n end",
"video": ""
} | {
"audio": "",
"image": "",
"text": " creds['SECRET_ACCESS_KEY'] = @secret_access_key \\\n unless @secret_access_key == env_secret\n\n save_config('aws', creds)\n end",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "def to_h\n output = {}\n instance_variables.each do |var|\n output.merge!({",
"video": ""
} | {
"audio": "",
"image": "",
"text": " var[1..-1] => instance_variable_get(var) }) unless var == '@xml' # exclude the whole XML dump\n end\n output\n end",
"video": ""
} | {
"audio": "",
"image": "",
"text": " : {}\n vars.merge!(h.variables) if h.variables\n\n vars\n end",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "def get_devices\n devices = []\n run_adb(\"devices\") do |pout|\n pout.each do |line|\n line = line.strip\n if (!line.empty? && line",
"video": ""
} | {
"audio": "",
"image": "",
"text": " !~ /^List of devices/)\n parts = line.split\n device = AndroidAdb::Device.new(parts[0], parts[1])\n devices << device\n end\n end\n end\n return devices\n end",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n cmd.stdout.each_line do |line|\n yield line\n end\n end",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "def get_packages(adb_opts = {})\n packages = []\n run_adb_shell(\"pm list packages -f\", adb_opts) do |pout|\n pout.each do |line|\n @log.debug(\"{stdout} #{line}\") unless @log.nil?\n parts = line.split(\":\")\n if (parts.length > 1... | {
"audio": "",
"image": "",
"text": " info = parts[1].strip.split(\"=\")\n package = AndroidAdb::Package.new(info[1], info[0]);\n packages << package;\n end\n end\n end\n return packages\n end",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n else\n _packages.ids\n end\n end",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "def setup_celluloid_logger\n return if !debug_enabled? || (respond_to?(:log_file_path) && log_file_path.blank?)\n",
"video": ""
} | {
"audio": "",
"image": "",
"text": " setup_log_file\n Celluloid.logger = ::Logger.new(log_file_path.present? ? log_file_path : STDOUT)\n setup_celluloid_exception_handler\n end",
"video": ""
} | {
"audio": "",
"image": "",
"text": " File.file?(abs_path) && File.executable?(abs_path)\n end\n path && File.expand_path(executable, path)\n end\n end",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "def setup_celluloid_exception_handler\n Celluloid.task_class = defined?(Celluloid::TaskThread) ? Celluloid::TaskThread",
"video": ""
} | {
"audio": "",
"image": "",
"text": " : Celluloid::Task::Threaded\n Celluloid.exception_handler do |ex|\n puts ex unless filtered_error?(ex)\n end\n end",
"video": ""
} | {
"audio": "",
"image": "",
"text": " @permitter_class_to_permitter[pclass] = pclass.new(params, defined?(current_user) ? current_user : nil, current_authorizer_method && defined?(current_authorizer_method) ? __send__(current_authorizer_method) : nil)\n end",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "def setup_log_file\n return if !debug_enabled? || (respond_to?(:log_file_path) && log_file_path.blank?)\n ",
"video": ""
} | {
"audio": "",
"image": "",
"text": " FileUtils.mkdir_p(File.dirname(log_file_path)) unless File.directory?(log_file_path)\n log_file = File.open(log_file_path, 'w')\n log_file.sync = true\n end",
"video": ""
} | {
"audio": "",
"image": "",
"text": " File.file?(abs_path) && File.executable?(abs_path)\n end\n path && File.expand_path(executable, path)\n end\n end",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "def parse_options(options)\n options = options.is_a?(Array) ? options.first : options\n options",
"video": ""
} | {
"audio": "",
"image": "",
"text": " = options.is_a?(Hash) ? options.stringify_keys : {}\n options\n end",
"video": ""
} | {
"audio": "",
"image": "",
"text": " operations\n options = options.merge(processor: self::Processor) unless self.is_a?(Builder)\n options = options.merge(other_options)\n\n options.freeze\n\n Builder.new(options)\n end",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "def resolve\n list = dependency_list.sort { |a, b| a.last.size <=>",
"video": ""
} | {
"audio": "",
"image": "",
"text": " b.last.size }\n resolve_list(list)\n end",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n new_list = list.to_a.dup\n new_list[index] = value\n list.with_contents(new_list)\n end",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "def make_absolute_url(url)\n return url unless URI.parse(url).relative?\n",
"video": ""
} | {
"audio": "",
"image": "",
"text": " begin\n URI.parse(@page_url).merge(url).to_s\n rescue URI::Error\n url\n end\n end",
"video": ""
} | {
"audio": "",
"image": "",
"text": " #{url}\" unless url.to_s =~ /^http|socks/\n url.kind_of?(URI) ? url : URI(url)\n end",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "def []=(k, i=nil, v=nil)\n if v\n insert(i,k,v)\n else",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n store(k,i)\n end\n end",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\tv = false if ['no','false'].include?(v.to_s.downcase)\n\t\n\t\tk = k.downcase.gsub(' ','_')\n\t\treturn k, v\n\tend",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "def request method, path, opts={}\n conn_options = connection_options opts\n opts['api_key'] = api_key unless opts.has_key? 'api_key'\n opts['file_type'] = file_type unless opts.has_key? 'file_type'\n\n response = connection(conn_options).send(method) do |r... | {
"audio": "",
"image": "",
"text": " if conn_options[:force_urlencoded]\n request.url path, opts\n else\n request.path = path\n request.body = MultiJson.dump(opts) unless opts.empty?\n end\n end\n end\n\n response\n end",
"video": ""
} | {
"audio": "",
"image": "",
"text": " conn.ssl_config.set_trust_ca(opts[:ssl_ca_file]) if opts.include?(:ssl_ca_file)\n\n # Timeout options\n conn.receive_timeout = opts[:timeout] if opts.include?(:timeout)\n conn.connect_timeout = opts[:open_timeout] if opts.include?(:open_timeout)\n conn.se... |
{
"audio": "",
"image": "",
"text": "def enter!\n @state_machine.current_state = self\n\n @entry_actions.each do |entry_action|\n entry_action.call(@state_machine)\n end\n @transition_map.each do |type, events_to_transition_arrays|\n",
"video": ""
} | {
"audio": "",
"image": "",
"text": " events_to_transition_arrays.each do |event, transitions|\n transitions.each(&:arm)\n end\n end\n end",
"video": ""
} | {
"audio": "",
"image": "",
"text": " column_name.to_sym\n else\n @state_machine.config.column ||= :aasm_state\n end\n @state_machine.config.column\n end",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "def exit!\n map = @transition_map\n map.each do |type, events_to_transition_arrays|\n events_to_transition_arrays.each do |event, transitions|\n transitions.each(&:unarm)\n end\n end\n\n @exit_actions.each",
"video": ""
} | {
"audio": "",
"image": "",
"text": " do |exit_action|\n exit_action.call(@state_machine)\n end\n @state_machine.current_state = nil\n end",
"video": ""
} | {
"audio": "",
"image": "",
"text": " events_to_transition_arrays.each do |event, transitions|\n transitions.each(&:arm)\n end\n end\n end",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "def cleanup\n @transition_map.each do |type, events_to_transition_arrays|\n events_to_transition_arrays.each do |event, transitions|\n transitions.clear\n end\n end\n\n @transition_map",
"video": ""
} | {
"audio": "",
"image": "",
"text": " = nil\n @state_machine = nil\n @entry_actions = nil\n @exit_actions = nil\n end",
"video": ""
} | {
"audio": "",
"image": "",
"text": " events_to_transition_arrays.each do |event, transitions|\n transitions.each(&:arm)\n end\n end\n end",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "def guarded_execute(event_type, event_trigger_value)\n @state_machine.raise_outside_initial_queue\n\n return if terminating?\n\n if @transition_map[event_type].nil? ||\n @transition_map[event_type][event_trigger_value].nil?\n raise ArgumentError,\... | {
"audio": "",
"image": "",
"text": " \"-> #{t.options[:to]}\"\n end\n raise RuntimeError,\n \"Not sure which transition to trigger \"\\\n \"when #{symbol} while #{self} (allowed: #{list}). \"\\\n \"Please make sure guard conditions exclude each other.\"\n else\n ... | {
"audio": "",
"image": "",
"text": " events_to_transition_arrays.each do |event, transitions|\n transitions.each(&:arm)\n end\n end\n end",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "def validate\n raise GatticaError::InvalidEmail, \"The email address '#{@email}' is not valid\" if not @email.match(/^(?:[_a-z0-9-]+)(\\.[_a-z0-9-]+)*@([a-z0-9-]+)(\\.[a-zA-Z0-9\\-\\.]+)*(\\.[a-z]{2,4})$/i)",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n raise GatticaError::InvalidPassword, \"The password cannot be blank\" if @password.empty? || @password.nil?\n end",
"video": ""
} | {
"audio": "",
"image": "",
"text": " CommandError, \"an integration with the name #{name.inspect} \" \\\n 'does not exist'\n end",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "def options\n OPTION_KEYS.inject({}){|o,k|o.",
"video": ""
} | {
"audio": "",
"image": "",
"text": "merge!(k => send(k))}\n end",
"video": ""
} | {
"audio": "",
"image": "",
"text": " properties = options.delete(name)\n\n @associations[name] = default_options.merge({ :include => properties }).merge(options)\n elsif options.is_a?(Array)\n options.each do |option|\n association option\n end\n else\n @associ... |
{
"audio": "",
"image": "",
"text": "def recent_updates(options)\n default_options = {\n path: nil,\n limit: 10\n }\n options = default_options.merge(options)\n limit = [options[:limit], 1].max\n paging_window = limit * 2\n\n updates_hash = {}\n offset = 0\n until updates_hash.co... | {
"audio": "",
"image": "",
"text": " changes.nil? # we ran out of commits first\n group_changes_into_updates(changes, updates_hash)\n offset += paging_window\n end\n return updates_hash.values.take(limit)\n end",
"video": ""
} | {
"audio": "",
"image": "",
"text": " records = limit_records(records) if limit || offset > 0\n records\n end",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "def supervise_actors\n current_actor = Actor.current\n @actor.link current_actor if",
"video": ""
} | {
"audio": "",
"image": "",
"text": " @actor.respond_to?(:link)\n current_actor.link connection\n end",
"video": ""
} | {
"audio": "",
"image": "",
"text": " next unless node.actors.include? actor\n ractor = get_remote_actor actor, id\n actors << ractor if ractor\n end\n end",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "def on_message(data)\n message = JSON.parse(data)\n log_debug(\"#{@actor.class} received JSON #{message}\")\n",
"video": ""
} | {
"audio": "",
"image": "",
"text": " if @actor.respond_to?(:async)\n @actor.async.on_message(message)\n else\n @actor.on_message(message)\n end\n end",
"video": ""
} | {
"audio": "",
"image": "",
"text": " log_debug(\"#{@actor.class} sends JSON #{final_message}\")\n connection.text final_message\n end",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "def on_close(code, reason)\n connection.terminate\n terminate\n log_debug(\"#{@actor.class} dispatching on close #{code} #{reason}\")\n if @actor.respond_to?(:async)\n ",
"video": ""
} | {
"audio": "",
"image": "",
"text": " @actor.async.on_close(code, reason)\n else\n @actor.on_close(code, reason)\n end\n end",
"video": ""
} | {
"audio": "",
"image": "",
"text": " log_debug(\"#{@actor.class} sends JSON #{final_message}\")\n connection.text final_message\n end",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "def send_action(action, channel = nil, data = {})\n data = data.is_a?(Hash) ? data : {}\n publishing_data = { 'client_action' => action, 'channel' => channel, 'data'",
"video": ""
} | {
"audio": "",
"image": "",
"text": " => data }.reject { |_key, value| value.blank? }\n async.chat(publishing_data)\n end",
"video": ""
} | {
"audio": "",
"image": "",
"text": " data = layer.legend_data\n arr << data if data.is_a?(Hash)\n arr = arr + data if data.is_a?(Array)\n end\n arr\n end\n end",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "def chat(message)\n final_message = message.is_a?(Hash) ? message.to_json : JSON.dump(action: 'message', message: message)\n ",
"video": ""
} | {
"audio": "",
"image": "",
"text": " log_debug(\"#{@actor.class} sends JSON #{final_message}\")\n connection.text final_message\n end",
"video": ""
} | {
"audio": "",
"image": "",
"text": " response = API::Channel.create_message(token, channel, content, tts, embed ? embed.to_hash : nil)\n Message.new(JSON.parse(response), self)\n end",
"video": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.