query
stringlengths
7
9.55k
document
stringlengths
10
363k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
List all metric values List all of the values across every breakdown for a specific metric
def list_all_metric_values(opts = {}) data, _status_code, _headers = list_all_metric_values_with_http_info(opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def metric_values\n return @metric_values\n end", "def get_metrics_list\n\t\ttest_file\n\t\t[@metric]\n end", "def all_metrics\n output = `cube_info #{@fname} -l`\n output.split(\"\\n\")\n end", "def values(metric_name, start_timestamp, end_timestamp=Time.n...
[ "0.69383633", "0.6856585", "0.6634863", "0.64855915", "0.6398502", "0.6347245", "0.6333907", "0.630585", "0.62697685", "0.6226212", "0.61543196", "0.60571676", "0.6005675", "0.59945434", "0.59945434", "0.5994294", "0.5910798", "0.5907358", "0.5855777", "0.583699", "0.5819034"...
0.665938
3
List all metric values List all of the values across every breakdown for a specific metric
def list_all_metric_values_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: MetricsApi.list_all_metric_values ...' end if @api_client.config.client_side_validation && opts[:'dimension'] && !['asn', 'browser', 'browser_version', 'cdn', 'cou...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def metric_values\n return @metric_values\n end", "def get_metrics_list\n\t\ttest_file\n\t\t[@metric]\n end", "def list_all_metric_values(opts = {})\n data, _status_code, _headers = list_all_metric_values_with_http_info(opts)\n data\n end", "def list_all_metric_v...
[ "0.69383633", "0.6856585", "0.665938", "0.665938", "0.6634863", "0.64855915", "0.6398502", "0.6347245", "0.6333907", "0.630585", "0.62697685", "0.6226212", "0.61543196", "0.60571676", "0.6005675", "0.59945434", "0.59945434", "0.5994294", "0.5910798", "0.5907358", "0.5855777",...
0.5692494
38
List breakdown values List the breakdown values for a specific metric
def list_breakdown_values(metric_id, opts = {}) data, _status_code, _headers = list_breakdown_values_with_http_info(metric_id, opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_metrics_list\n\t\ttest_file\n\t\t[@metric]\n end", "def metric_values\n return @metric_values\n end", "def annotated_values_list(values_to_split=self.values)\n values_to_split.split(VALUES_SPLITTER).map {|e|\n k = e.gsub(/\\((.*)?\\)/, '')\n $1 ? [$1, k] : ...
[ "0.62087584", "0.61654323", "0.6094615", "0.60079277", "0.5964905", "0.5917378", "0.57444537", "0.5704049", "0.5696518", "0.5671939", "0.5568417", "0.55562234", "0.55562234", "0.55562234", "0.55562234", "0.55562234", "0.55562234", "0.55562234", "0.5539368", "0.55320203", "0.5...
0.6551352
1
List breakdown values List the breakdown values for a specific metric
def list_breakdown_values_with_http_info(metric_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: MetricsApi.list_breakdown_values ...' end # verify the required parameter 'metric_id' is set if @api_client.config.client_side_validation && metric...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_breakdown_values(metric_id, opts = {})\n data, _status_code, _headers = list_breakdown_values_with_http_info(metric_id, opts)\n data\n end", "def list_breakdown_values(metric_id, opts = {})\n data, _status_code, _headers = list_breakdown_values_with_http_info(metric_id, opts)\n da...
[ "0.65506047", "0.65506047", "0.62097055", "0.61643124", "0.6094015", "0.60078853", "0.5964567", "0.59182465", "0.574345", "0.57043445", "0.5696682", "0.5672441", "0.5571174", "0.55586845", "0.55586845", "0.55586845", "0.55586845", "0.55586845", "0.55586845", "0.55586845", "0....
0.553915
20
List Insights Returns a list of insights for a metric. These are the worst performing values across all breakdowns sorted by how much they negatively impact a specific metric.
def list_insights(metric_id, opts = {}) data, _status_code, _headers = list_insights_with_http_info(metric_id, opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insights\n return @insights\n end", "def insights\n return @insights\n end", "def insights\n return @insights\n end", "def insights=(value)\n @insights = value\n end", "def insights=(value)\n ...
[ "0.63347274", "0.63347274", "0.63347274", "0.6292806", "0.6292806", "0.6292806", "0.6047449", "0.5892728", "0.5797191", "0.56731623", "0.5643961", "0.5624679", "0.55393666", "0.5497791", "0.5466502", "0.54464215", "0.54442143", "0.5398373", "0.5386901", "0.5374592", "0.530093...
0.64495665
1
List Insights Returns a list of insights for a metric. These are the worst performing values across all breakdowns sorted by how much they negatively impact a specific metric.
def list_insights_with_http_info(metric_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: MetricsApi.list_insights ...' end # verify the required parameter 'metric_id' is set if @api_client.config.client_side_validation && metric_id.nil? ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_insights(metric_id, opts = {})\n data, _status_code, _headers = list_insights_with_http_info(metric_id, opts)\n data\n end", "def list_insights(metric_id, opts = {})\n data, _status_code, _headers = list_insights_with_http_info(metric_id, opts)\n data\n end", "def insights\n ...
[ "0.6448569", "0.6448569", "0.63334745", "0.63334745", "0.63334745", "0.62908757", "0.62908757", "0.62908757", "0.60457385", "0.58915603", "0.57954615", "0.5672225", "0.5646594", "0.5625031", "0.55388033", "0.5467666", "0.5446651", "0.54435396", "0.5397047", "0.5387375", "0.53...
0.5496714
15
Returns Language name corresponding to the Language code passed
def find_lang (lang_code) LANGUAGE_LIST.each do |element| if element[1] == lang_code return element[0] end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_language_from_code code\n ISO_639.find(code).english_name if not(code.nil?)\n end", "def language_name(code)\n if configatron.locales.include?(code)\n t(:locale_name, :locale => code)\n else\n (entry = ISO_639.find(code.to_s)) ? entry.english_name : code.to_s\n end\n end", "def ...
[ "0.83019936", "0.8184565", "0.8182566", "0.81452173", "0.7756487", "0.77045923", "0.76507056", "0.75966847", "0.75825953", "0.7533546", "0.7463468", "0.7463468", "0.7463468", "0.7434681", "0.7418154", "0.7366151", "0.72281265", "0.72277105", "0.72262096", "0.7133138", "0.7121...
0.7327027
16
GET /users/1 Displays Translated Output with input details
def show if @user.from == "" then @user.from = @@translator.detect(@user.input) end @user.from = find_lang(@user.from.to_s) @user.to = find_lang(@user.to) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n render plain: User.order(:name).map { |user| user.to_pleasant_string }.join(\"\\n\")\n end", "def show\n @user = User.find(params[:id])\n @texts = Text.where({user_id: current_user.id})\n respond_to do |format|\n format.html{}\n format.json {render json: @user}\n\n end\n en...
[ "0.6645844", "0.6529399", "0.6443033", "0.64365387", "0.6421705", "0.63421714", "0.6323085", "0.62217444", "0.61996", "0.61915743", "0.6180177", "0.613442", "0.61343414", "0.6127048", "0.61266345", "0.61249065", "0.612089", "0.61159754", "0.611578", "0.61042225", "0.6076131",...
0.63220966
7
POST /users POST /users.json
def create @user = User.create(user_params) @user.output = translate_data(@user.input, @user.from, @user.to ) respond_to do |format| if @user.save format.html { redirect_to @user } format.json { render :show, status: :created, location: @user } else format.html { render :...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_users(users)\n self.class.post('https://api.yesgraph.com/v0/users', {\n :body => users.to_json,\n :headers => @options,\n })\n end", "def CreateUser params = {}\n \n APICall(path: 'users.json',method: 'POST',payload: params.to_json)\n \n end", "def post b...
[ "0.77179813", "0.75206673", "0.73831296", "0.72405374", "0.719841", "0.7140812", "0.71038526", "0.7058827", "0.7041636", "0.70236504", "0.7003128", "0.70021695", "0.70021695", "0.70021695", "0.69936967", "0.6990463", "0.6980393", "0.6979075", "0.69788617", "0.69788617", "0.69...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_user @user = User.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def user_params params.require(:user).permit(:input, :from, :to, :output) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69802505", "0.6781974", "0.67470175", "0.67430073", "0.67350477", "0.6593221", "0.6504263", "0.64988977", "0.6481794", "0.64800006", "0.64568025", "0.64411247", "0.6379476", "0.63765615", "0.6368045", "0.6320141", "0.6300363", "0.6300057", "0.62952244", "0.6294712", "0.629...
0.0
-1
Using an items server with the authentication on.
def setup @server = ItemServer.new :auth => :basic @server.start end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connect(username, password, options = {})\n server = options[:server] || Helpers::AuthHelper.read_server\n @server = RestClient::Resource.new server, DEFAULT_LOGIN_PAYLOAD\n\n super\n end", "def initialize(item, password)\n @item = item\n @password = password\n ...
[ "0.57213354", "0.56799555", "0.56473213", "0.5584362", "0.5544374", "0.5539366", "0.5477294", "0.5464273", "0.54299855", "0.54173", "0.53650045", "0.53613794", "0.5325159", "0.52852166", "0.5273275", "0.5273275", "0.5273275", "0.5266141", "0.5262254", "0.52575576", "0.5225257...
0.73283434
0
Return how many working days are between two date, ignoring hollidays
def calc_days_between_date(earlier_date, later_date) days_diff = (later_date - earlier_date).to_i weekdays = 0 if days_diff >= 7 whole_weeks = (days_diff/7).to_i later_date -= whole_weeks*7 weekdays += whole_weeks*5 end if later_date >= earlier_date dates_between = earlier_date..(la...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_working_days_between(start_date, end_date)\n start_date = to_date(start_date)\n end_date = to_date(end_date)\n populate_public_holiday_collection_for_year(start_date.year)\n populate_public_holiday_collection_for_year(end_date.year)\n if start_date >= end_date\n raise ArgumentError.ne...
[ "0.80646574", "0.789329", "0.7868698", "0.7710373", "0.75542814", "0.7510041", "0.73366195", "0.72407764", "0.7209336", "0.7204796", "0.7157534", "0.7099494", "0.70424175", "0.6962381", "0.69569576", "0.6929607", "0.6916211", "0.6859692", "0.68513966", "0.6846191", "0.6831304...
0.69936645
13
common initial kernel attribute values
def init_kernel kernel Mash.new [["uname -s", :name], ["uname -r", :release], ["uname -v", :version], ["uname -m", :machine], ["uname -p", :processor]].each do |cmd, property| so = shell_out(cmd) kernel[property] = so.stdout.strip end kernel end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attributes\n @attributes ||= begin\n attrs = {}\n self.class.key_attrs.values.each { |a| attrs[a.name] = a.initial_value }\n self.class.other_attrs.values.each { |a| attrs[a.name] = a.initial_value }\n attrs\n end\n end", "def initial_cut_values\n ...
[ "0.6096033", "0.5711607", "0.5692023", "0.56879026", "0.567297", "0.5637597", "0.5632745", "0.56086236", "0.5572", "0.55640334", "0.556285", "0.55335164", "0.55277187", "0.55013835", "0.5465146", "0.54603416", "0.5422431", "0.5377372", "0.53753483", "0.53721774", "0.53720886"...
0.52161115
29
common bsd code for collecting modules data
def bsd_modules(path) modules = Mash.new so = shell_out(Ohai.abs_path(path).to_s) so.stdout.lines do |line| # 1 7 0xc0400000 97f830 kernel if line =~ /(\d+)\s+(\d+)\s+([0-9a-fx]+)\s+([0-9a-fx]+)\s+([a-zA-Z0-9\_]+)/ modules[$5] = { size: $4, refcount: $2 } end end modu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def collect_module_data\n return unless collect_module_exists?\n collect_keys.each do |key|\n mod_array = collect_module[key]\n next if mod_array.blank?\n collect_module_data_for(key, mod_array)\n end\n end", "def modules; end", "def modules; end", "def modules; end", "def extract_...
[ "0.73707503", "0.7235236", "0.7235236", "0.7235236", "0.6659461", "0.6363833", "0.62839437", "0.6264449", "0.6163961", "0.60987735", "0.60585517", "0.6045942", "0.60346776", "0.6022249", "0.59888214", "0.59888214", "0.5965821", "0.5922338", "0.59170276", "0.5885923", "0.58837...
0.58367926
25
given the OperatingSystemSKU value from WMI's Win32_OperatingSystem class return if we're on a Server Core installation
def server_core?(sku) return true if [ 12, # Server Datacenter Core 39, # Server Datacenter without Hyper-V Core 14, # Server Enterprise Core 41, # Server Enterprise without Hyper-V Core 13, # Server Standard Core 40, # Server Standard without Hyper-V Core 63, # Small Busin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def minimum_supported_operating_system\n return @minimum_supported_operating_system\n end", "def minimum_supported_operating_system=(value)\n @minimum_supported_operating_system = value\n end", "def rhel?\n @flavor =~ /redhatenterpriseserver/\n end", ...
[ "0.6221697", "0.6121302", "0.6102458", "0.60710245", "0.5964941", "0.5959291", "0.58937657", "0.58332145", "0.57966244", "0.5744976", "0.5744976", "0.5744976", "0.57212484", "0.5705558", "0.5701821", "0.5700403", "0.568067", "0.56704026", "0.5615031", "0.56106734", "0.5607788...
0.7762464
0
given the SystemType value from WMI's Win32_ComputerSystem class return the architecture type
def arch_lookup(sys_type) return "x86_64" if sys_type == "x64-based PC" return "i386" if sys_type == "X86-based PC" sys_type end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def determine_system_architecture\n @info[:arch] = @shell.query('UNAME', 'uname -m')\n @info[:arch].gsub!(/i\\d86/, 'i386')\n end", "def detect_architecture()\r\n\t\tprint_status(\"Attempting to automatically detect the architecture\")\r\n\t\tres = send_serialized_request(\"osarch.bin\")\r\n\t\tif (...
[ "0.74836844", "0.74033", "0.71954906", "0.7141904", "0.7006779", "0.6934344", "0.68769926", "0.6862317", "0.6860418", "0.67959636", "0.67959636", "0.66794115", "0.66681695", "0.66197646", "0.6616222", "0.6505062", "0.6459955", "0.63897616", "0.63897616", "0.6307104", "0.62989...
0.77026373
0
given the ProductType value from WMI's Win32_OperatingSystem class return either workstation or server
def product_type_decode(type) return "Workstation" if type == 1 "Server" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_os\n system=`/usr/bin/sw_vers -productVersion`.chomp.split(\".\").slice(1).to_i\n if system==4 then\n return \"tiger\"\n else\n return \"leo\"\n end\nend", "def pc_system_type_decode(type)\n case type\n when 4 then \"Enterprise Server\" # most likely so first\n when 0 then \"Unspecif...
[ "0.6603898", "0.6589691", "0.6576348", "0.6523821", "0.6491599", "0.6466615", "0.6436035", "0.63471425", "0.63254946", "0.6241631", "0.6241631", "0.61556256", "0.6149793", "0.6064926", "0.60618544", "0.60590476", "0.60497564", "0.60472894", "0.6025754", "0.59976554", "0.59972...
0.69146216
0
decode the OSType field from WMI Win32_OperatingSystem class
def os_type_decode(sys_type) case sys_type when 18 then "WINNT" # most likely so first when 0 then "Unknown" when 1 then "Other" when 14 then "MSDOS" when 15 then "WIN3x" when 16 then "WIN95" when 17 then "WIN98" when 19 then "WINCE" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ostype\n return @rye_ostype if @rye_ostype # simple cache\n os = self.quietly { uname.first } rescue nil\n os ||= 'unknown'\n os &&= os.downcase\n @rye_ostype = os\n end", "def os_type\n FFI::Libvirt.virDomainGetOSType(self)\n end", "def os_type\n\n if @ostype\n ...
[ "0.7250184", "0.70091975", "0.67309624", "0.6485674", "0.64697087", "0.63488674", "0.6266685", "0.60889757", "0.599746", "0.5897145", "0.58876336", "0.5874648", "0.5873984", "0.5822192", "0.5821435", "0.5797133", "0.5795014", "0.5788551", "0.5776696", "0.5746392", "0.568966",...
0.6974482
2
decode the PCSystemType field from WMI Win32_OperatingSystem class
def pc_system_type_decode(type) case type when 4 then "Enterprise Server" # most likely so first when 0 then "Unspecified" when 1 then "Desktop" when 2 then "Mobile" when 3 then "Workstation" when 5 then "SOHO Server" when 6 then "Appliance PC" when 7 then "Performance Server" wh...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def os_type_decode(sys_type)\n case sys_type\n when 18 then \"WINNT\" # most likely so first\n when 0 then \"Unknown\"\n when 1 then \"Other\"\n when 14 then \"MSDOS\"\n when 15 then \"WIN3x\"\n when 16 then \"WIN95\"\n when 17 then \"WIN98\"\n when 19 then \"WINCE\"\n end\n end", ...
[ "0.7277568", "0.6545163", "0.6317074", "0.6258508", "0.622861", "0.6210735", "0.5967649", "0.5954566", "0.59441656", "0.590554", "0.5891024", "0.5891024", "0.5867764", "0.58672535", "0.5839327", "0.5833276", "0.5790531", "0.57636493", "0.5703283", "0.5688347", "0.5683431", ...
0.76368666
0
see if a WMI name is in the blocked list so we can avoid writing out useless data to ohai
def blocked_wmi_name?(name) [ "creation_class_name", # this is just the wmi name "cs_creation_class_name", # this is just the wmi name "oem_logo_bitmap", # this is the entire OEM bitmap file "total_swap_space_size", # already in memory plugin "total_virtual_memory_size", # already in memory...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def blocked?\n Rails.cache.exist?(\"block_#{@from}_#{@to}\")\n end", "def blocked?\n @blocked\n end", "def blocked?\n (status == BLOCKED)\n end", "def blocked?\n false\n end", "def userBlocked(userName)\n\n user = loadUser(userName)\n blocked = user[\"BLOCKED\"]\n if(blocked ...
[ "0.62326473", "0.6126341", "0.6105324", "0.59928125", "0.5955911", "0.5892339", "0.58287203", "0.5764767", "0.5746175", "0.5691173", "0.5675597", "0.56735754", "0.5659638", "0.56493866", "0.5629315", "0.54841876", "0.54585874", "0.54474187", "0.5446797", "0.5441773", "0.54303...
0.7810345
0
Returns a new Headers object extended as RequestHeaders. This is the default object which will be used when composing fresh Request header entities.
def default_headers_obj(*args) Headers.new(*args).extend(RequestHeaders) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def headers(new_headers = {})\n (@headers ||= {}).merge!(new_headers)\n end", "def merge_headers(headers)\n self.class.new(@request_env.merge(request_headers: @request_env[:request_headers].merge(headers)))\n end", "def build_request_headers(request)\n @request_headers.each do |key...
[ "0.7180828", "0.71449274", "0.70954365", "0.6782874", "0.66837853", "0.6498157", "0.6496291", "0.6488882", "0.6488257", "0.64595807", "0.6444842", "0.6434931", "0.6410872", "0.6399974", "0.6382845", "0.63742137", "0.6373077", "0.63570005", "0.63483846", "0.6335025", "0.632338...
0.72750527
0
Returns a new BoundBody object. This is the default object which will be used when composing fresh Request body entities.
def default_body_obj(*args) Body.new(*args) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default_body_obj(*args)\n BoundBody.new(*args)\n end", "def body(new = nil)\n if new.nil?\n @body\n else\n with(body: body.merge(new))\n end\n end", "def loaded_body\n @loaded_body ||= case ctype = request.content_type\n when /json/\n ...
[ "0.81027275", "0.677593", "0.5966383", "0.594696", "0.5846966", "0.58266145", "0.5684539", "0.56485194", "0.5593936", "0.55525327", "0.55274993", "0.55274993", "0.55073774", "0.54987454", "0.54298586", "0.53992987", "0.53799456", "0.53599906", "0.53572375", "0.53529215", "0.5...
0.7078306
1
Returns a raw HTTP request for this instance.
def to_raw() self.headers ||= default_headers_obj() self.body ||= default_body_obj() if len=@opts[:static_length] @body = Body.new(@body, @body.opts) {|x| x.base = self} @headers.set_header("Content-Length", len.to_i) elsif @opts[:ignore_content_length] @headers.delete_h...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def http_request\n req = VanillaRequest.new @http_method, @uri.request_uri, @headers\n\n if @oauth\n req['Authorization'] =\n SimpleOAuth::Header.new(@http_method, @uri, {}, self.oauth).to_s\n elsif @auth && @auth[:username]\n req.basic_auth @auth[:username], @auth[:password]\...
[ "0.7137622", "0.68920696", "0.6870267", "0.6802376", "0.6764175", "0.673614", "0.67151016", "0.6696993", "0.65884155", "0.6581511", "0.656702", "0.6547113", "0.65458", "0.6545282", "0.6530243", "0.6491887", "0.6485976", "0.64693886", "0.64551115", "0.6438421", "0.643362", "...
0.0
-1
Parses a raw HTTP request and captures data into the current instance.
def capture(str) raise "arg 0 must be a string" unless String === str hstr, bstr = str.split(/\s*\r?\n\r?\n/, 2) capture_headers(hstr) self.body = content_length ? BoundBody.new : Body.new capture_body(bstr) return self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse(raw_request)\n pieces = raw_request.split(' ')\n method = pieces[0]\n uri = pieces[1]\n http_v = pieces[2]\n route, query_param_string = uri.split('?')\n uri_fragments = route.split('/')\n protocol = uri_fragments[0][0..-2]\n full_url = uri_fragments[2]\n subdomain, domain_name, tld = full_ur...
[ "0.6975291", "0.6975291", "0.6708725", "0.6705757", "0.6543234", "0.6471868", "0.64012325", "0.6343809", "0.6328718", "0.6279217", "0.6242851", "0.61343414", "0.61000836", "0.60233974", "0.6012595", "0.60001016", "0.598954", "0.59712255", "0.59560174", "0.59551364", "0.593405...
0.0
-1
each consonant. You need to return the string before it becomes eggcoded
def unscramble_eggs(word) word.gsub(/egg/, " ") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def double_consonants(string)\n result = []\n string.each_char do |char|\n result << char_value(char)\n end\n p result.join\nend", "def consonants_adv(str)\r\n str = vowel_adv(str)\r\n consonants = [\"b\", \"c\", \"d\", \"f\", \"g\", \"h\", \"j\", \"k\", \"l\", \"m\", \"n\", \"p\", \"q\", \"r\", \"s\", ...
[ "0.747544", "0.7164341", "0.714025", "0.71379113", "0.7047642", "0.7034853", "0.6994722", "0.6991495", "0.69799596", "0.69416475", "0.69398946", "0.6917844", "0.69151026", "0.6910842", "0.69023687", "0.6893735", "0.688525", "0.68833715", "0.68778443", "0.68747604", "0.6872459...
0.0
-1
End of the config
def main # Check correct arguments if ARGV.length < 1 puts "Usage #{$0} <netgroup> [<netgroup> [...]]" exit 1 end ARGV.each do |netgroup| copy_netgroup netgroup end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def finish\n @config.save_history(Readline::HISTORY.to_a)\n end", "def at_end; end", "def after_configuration\n # do nothing by default\n end", "def end\n end", "def at_exit\n\n\t\tend", "def finalize!\n @finalized = true\n configure!\n @config.lint!\n end", ...
[ "0.68829024", "0.68241304", "0.6803086", "0.6779713", "0.6565877", "0.650085", "0.6453531", "0.6332923", "0.62705934", "0.6262058", "0.6236065", "0.6236065", "0.6235733", "0.6235733", "0.6235733", "0.620994", "0.62010276", "0.61871964", "0.61819774", "0.6180468", "0.61635125"...
0.0
-1
Create an array of hosts from a netgroup
def get_hosts netgroup hosts = [] # Bind RO to ldap for recursive searching netgroup. FIXME: hardcoded auth = { :method => :simple, :username => 'uid=network,ou=Netgroup,dc=catnip', :password => 'sedLdapPassword' } Net::LDAP.open(:host => 'ldap.cat.pdx.edu', :port => 636, :auth => auth, :encryption => :simple_t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_hosts_in(group)\n inventory.all_hosts_in(group).map { |i| server(i.to_sym) }\nend", "def get_hosts_by_group(name)\n begin\n groupid = get_group_by_name(name)[0][\"groupid\"].to_i\n hosts = @zbx.query( method: \"host.get\", params: {\"output\" => \"extend\", \"groupids\" => [groupid] }...
[ "0.7038822", "0.6812259", "0.6539069", "0.6451701", "0.6423743", "0.6383536", "0.6372631", "0.63342404", "0.62483007", "0.60356915", "0.5987423", "0.59772533", "0.5968498", "0.5836809", "0.5835319", "0.58155507", "0.57994246", "0.5757257", "0.5751042", "0.5720466", "0.5704465...
0.6484423
3
Returns a list of files for a given host FIXME Doesn't recognize difference between defined host with 0 files and undefined host. So no "blank host" definitions allowed
def backup_files host, config files = expand_files host, config files = expand_files "default", config if files.empty? # Undefined hosts get default return files end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hostfiles(options, which = :all)\n files = []\n\n files += Array(options[:user_known_hosts_file] || %w[~/.ssh/known_hosts ~/.ssh/known_hosts2]) if which == :all || which == :user\n\n if which == :all || which == :global\n files += Array(options[:global_known_hosts_file] ||...
[ "0.67866534", "0.65430236", "0.6449807", "0.6431239", "0.62863094", "0.6286061", "0.61290765", "0.6056752", "0.593903", "0.5863761", "0.58051574", "0.5791775", "0.5782775", "0.574033", "0.5718222", "0.5700205", "0.56959903", "0.56854737", "0.56767374", "0.5662598", "0.5660863...
0.6486712
2
Recursive function used by backup_files()
def expand_files map, config files = Array.new if config.has_key? map config[map].each do |v| m = /^\/.*/.match v #starts with /, otherwise it's a group name if m files << m.to_s else files + (expand_files m.to_s, config) end end end return files end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recursive => nil", "def all_files\n if !full && @last_full_backup\n backups = self.backups.select{|b| b.date >= @last_full_backup.date && b.date <= self.date }\n backups << self unless backups.include?(self)\n\n rfiles = backups.collect{|b| b.files}.flatten.uniq\n rfiles.reje...
[ "0.6622754", "0.59744716", "0.57791376", "0.5751917", "0.5600973", "0.55832946", "0.55745035", "0.5562982", "0.55444527", "0.54604775", "0.54292125", "0.54246116", "0.54146564", "0.5414257", "0.54088694", "0.5406678", "0.5396924", "0.5393025", "0.5388075", "0.53515655", "0.53...
0.0
-1
Copies a list of files from host to dir. Returns false if various things don't work
def copy files, host, dir dest = "#{dir}/#{host}" File.directory?(dest) || mkdir_p(dest) #puts "Connecting to #{host}" begin Net::SFTP.start(host, "root", :auth_methods => ["publickey"], :keys => [$key], :timeout => 1) do |sftp| files.each do |file| begin dir = File.dirname "#{dest}/...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def batch_copy_missing_destination_files(files)\n dest_domain = DestDomain.find_by_namespace(@dest_mogile.domain)\n\n files.each do |file|\n # Quit if no results\n break if file.nil?\n\n # Quit if program exit has been requested.\n break if SignalHandler.instance.should_quit\n\n # Lo...
[ "0.6747186", "0.66066176", "0.64839", "0.6470677", "0.6376486", "0.6373447", "0.6319183", "0.6278717", "0.6199682", "0.6144426", "0.6103377", "0.6089197", "0.60504955", "0.60080117", "0.597716", "0.59666526", "0.59646714", "0.5932935", "0.5926986", "0.59252095", "0.59032977",...
0.72274154
0
Reshares dir/host to host only
def reshare dir, host if File.exist? "#{dir}/#{host}/.completed" `share -F nfs -o ro=#{host},anon=0 #{dir}/#{host} > /dev/null 2>&1` end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def per_host\n @per_host = true\n end", "def make_host\n unless self.host.host\n self.host.update(:host => true)\n end\n end", "def write_host_files\n\n master.ssh(\"sudo bash -c \\\"echo '\n#auto-inserted by amatsung to allow resolving each clients hostname\n' >> /etc/hosts\\\"\")\n ...
[ "0.6051785", "0.59946334", "0.5711516", "0.5698548", "0.5644786", "0.5635569", "0.5583373", "0.5555362", "0.5551283", "0.55355215", "0.5484416", "0.5481614", "0.5433618", "0.53959477", "0.53770715", "0.53769135", "0.53446734", "0.53327554", "0.533213", "0.53175265", "0.531267...
0.64786315
0
version :thumb_wide_grey do process :grey_version end Add a white list of extensions which are allowed to be uploaded. For images you might use something like this:
def extension_white_list %w(jpg jpeg gif png) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extension_whitelist\n %w[jpg jpeg png]\n end", "def extension_whitelist\n %w[jpg jpeg gif png]\n end", "def extension_whitelist\n %w[jpg jpeg gif png]\n end", "def extension_whitelist\n %w[jpg jpeg gif png]\n end", "def extension_whitelist\n %w(jpg jpeg gif png)\n end", "def...
[ "0.71535444", "0.7127849", "0.7127849", "0.7127849", "0.71247846", "0.71168375", "0.71168375", "0.71168375", "0.7082604", "0.70764816", "0.70764816", "0.70764816", "0.70764816", "0.70764816", "0.70764816", "0.70764816", "0.70764816", "0.70764816", "0.70764816", "0.70764816", ...
0.6822183
94
GET /sugerencias/1 GET /sugerencias/1.json
def show @sugerencia = Sugerencia.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render :json => @sugerencia } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @seguro = Seguro.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @seguro }\n end\n end", "def show\n @suplente = Suplente.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format....
[ "0.6789368", "0.6731744", "0.661738", "0.65762", "0.6552081", "0.65184546", "0.6517061", "0.6509877", "0.6478224", "0.6468924", "0.6438622", "0.6417392", "0.64162964", "0.6404949", "0.64045966", "0.63975173", "0.63930416", "0.6384764", "0.63763815", "0.637412", "0.6365216", ...
0.72425586
0
GET /sugerencias/new GET /sugerencias/new.json
def new @sugerencia = Sugerencia.new respond_to do |format| format.html # new.html.erb format.json { render :json => @sugerencia } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @selecao = Selecao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @selecao }\n end\n end", "def new\n @suplente = Suplente.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @suplente }\n...
[ "0.7660044", "0.7616265", "0.76097155", "0.7582323", "0.75022507", "0.74643326", "0.74373007", "0.74128574", "0.74026513", "0.7367628", "0.7358671", "0.7354339", "0.73509425", "0.7336612", "0.7333237", "0.7312753", "0.730795", "0.7305373", "0.72996515", "0.72912157", "0.72894...
0.79302496
0
POST /sugerencias POST /sugerencias.json
def create @sugerencia = Sugerencia.new(params[:sugerencia]) respond_to do |format| if @sugerencia.save format.html { redirect_to @sugerencia, :notice => 'Sugerencia was successfully created.' } format.json { render :json => @sugerencia, :status => :created, :location => @sugerencia } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @sucursale = Sucursale.new(sucursale_params)\n @sucursale.usuarios_id = current_usuario.id\n respond_to do |format|\n if @sucursale.save\n format.html { redirect_to @sucursale, notice: 'Sucursal creada con exito!' }\n format.json { render :show, status: :created, location: ...
[ "0.64095134", "0.6371591", "0.63331544", "0.631727", "0.629091", "0.62569535", "0.62444335", "0.6226304", "0.6215284", "0.6213926", "0.62001044", "0.6190736", "0.6181234", "0.6179562", "0.61668825", "0.61631763", "0.61477184", "0.61307406", "0.6125646", "0.6122471", "0.611351...
0.7207612
0
PUT /sugerencias/1 PUT /sugerencias/1.json
def update @sugerencia = Sugerencia.find(params[:id]) respond_to do |format| if @sugerencia.update_attributes(params[:sugerencia]) format.html { redirect_to @sugerencia, :notice => 'Sugerencia was successfully updated.' } format.json { head :ok } else format.html { render :a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @seguro = Seguro.find(params[:id])\n\n respond_to do |format|\n if @seguro.update_attributes(params[:seguro])\n format.html { redirect_to @seguro, notice: 'Seguro was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: ...
[ "0.6348203", "0.6221762", "0.619435", "0.61891174", "0.6188457", "0.6187203", "0.6172406", "0.6164909", "0.6151137", "0.61455005", "0.61151814", "0.60499835", "0.6044278", "0.6039232", "0.60379076", "0.6036211", "0.6030201", "0.60222524", "0.60124433", "0.6005422", "0.6003269...
0.6884571
0
DELETE /sugerencias/1 DELETE /sugerencias/1.json
def destroy @sugerencia = Sugerencia.find(params[:id]) @sugerencia.destroy respond_to do |format| format.html { redirect_to sugerencias_url } format.json { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @asignatura.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @sugerencium.destroy\n respond_to do |format|\n format.html { redirect_to sugerencia_url, notice: 'Sugerencium was successfully destroyed.' }\n format.json { h...
[ "0.7355706", "0.718735", "0.7100396", "0.7100396", "0.70978", "0.7043115", "0.7041963", "0.7038754", "0.703732", "0.7009759", "0.7005852", "0.700172", "0.70006394", "0.69969654", "0.699483", "0.6972043", "0.69634384", "0.6948723", "0.6939831", "0.6936145", "0.6934889", "0.6...
0.7523326
0
show 404 page if debate is not found
def debate_not_found static_404_page end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_404\n show_error 'Page Not Found', :not_found\n end", "def page_not_found\n render file: Rails.root.join('public', '404.html'), status: :not_found, layout: false\n end", "def show\n if false\n else\n render :file => \"/public/404.html\",:status => \"404\" \n end\n end", ...
[ "0.79142666", "0.76287556", "0.76216704", "0.75201917", "0.74832374", "0.74829876", "0.7441987", "0.7441987", "0.7441987", "0.74296784", "0.7417595", "0.73938", "0.73901236", "0.7386904", "0.7376906", "0.73506165", "0.7331066", "0.7331066", "0.7331066", "0.7331066", "0.733106...
0.850134
0
show 404 page if argument is not found
def argument_not_found static_404_page end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_404\n show_error 'Page Not Found', :not_found\n end", "def show_404 error='', target=''\n show_error \"Page \\\"#{target}\\\" Not Found\", :not_found\n end", "def send_not_found(cli)\n custom_404_url = get_custom_404_url\n if custom_404_url.blank?\n super(cli)\n else\...
[ "0.85603297", "0.8376752", "0.7786904", "0.7784158", "0.7784106", "0.77561533", "0.7735675", "0.7725383", "0.7720683", "0.77182394", "0.7710665", "0.7710226", "0.7705778", "0.769805", "0.76571566", "0.7617178", "0.76045775", "0.7589383", "0.7584498", "0.75842875", "0.75636554...
0.8238061
2
theCount += 1 cartHash[food][:count] = theCount binding.pry else cartHash[food] = data cartHash[food][:count] = theCount binding.pry end binding.pry end answer = result end binding.pry end hash.each do |food, data| cartHash[food] = data theFood = hash[food] cartHash[food][:count] = 0 binding.pry cart.each do |hash_agai...
def apply_coupons(cart, coupons) coupons.each do |coupon| food = coupon[:item] if cart[food] && cart[food][:count] >= coupon[:num] if cart["#{food} W/COUPON"] cart["#{food} W/COUPON"][:count] += 1 else cart["#{food} W/COUPON"] = {count: 1, price: coupon[:cost]} cart["#{food...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_cart(cart)\n cart2 = {}\n #outer loop, then do each thing in the innner loop, than outer loop....\n cart.each do |item|\n # <{\"AVOCADO\" => {:price => 3.00, :clearance_items => true}}>\n item.each do |food, info|\n #<\"AVOCADO\" => {:price => 3.00, :clearance_items => true}>\n #if car...
[ "0.75373876", "0.7310909", "0.7225162", "0.72145563", "0.7158121", "0.7150812", "0.70764285", "0.70574445", "0.6960365", "0.6932902", "0.68713444", "0.6857209", "0.68413496", "0.6814376", "0.6777058", "0.6776762", "0.67719007", "0.6733836", "0.67006093", "0.6647493", "0.66387...
0.6017991
69
def apply_clearance(cart) cart.each do |hash| hash.each do |food, data| binding.pry if hash[food][:clearance] == true binding.pry hash[food][:price] = hash[food][:price].to_i 0.8 hash[food][:price] = hash[food][:price].round(2) binding.pry else binding.pry end end end end
def checkout(cart, coupons) total = 0 tidyCart = consolidate_cart(cart) coupon_cart = apply_coupons(tidyCart, coupons) clearance_cart = apply_clearance(coupon_cart) clearance_cart.each do |food, data| total += data[:price] * data[:count] end if total > 100 total = total * 0.9 end total end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply_clearance(cart)\n cart.each do |item, info_hash|\n if info_hash[:clearance] == true\n info_hash[:price] = (info_hash[:price] * 0.80).round(2)\n end\n end\nend", "def apply_clearance(cart)\n cart.each do |product_name, stats|\n stats[:price]-= stats[:price] * 0.2 if stats[:clearance]\n...
[ "0.8982679", "0.87393856", "0.87392265", "0.8737221", "0.87109494", "0.86795086", "0.8679435", "0.8642302", "0.8608146", "0.86005825", "0.83843195", "0.8321256", "0.8171985", "0.7781652", "0.77351314", "0.71593297", "0.7134731", "0.71223086", "0.7038708", "0.6991104", "0.6960...
0.68431646
22
Asserts that the request and response contain messages and no errors. Asserts that the request and response messages match the format in request_resource_prefix.request and response_resource_prefix.response respectively. If response_resource_prefix is not given it is assumed to be the same as the request_resource_prefi...
def validate_request_and_response(request, response, request_resource_prefix, response_resource_prefix=nil) # for request and response, check that the message exists in the logs and there is no error logged expect(request[0]).to_not be_nil expect(request[1]).to be_nil, "Error log...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_response(response, response_resource_prefix, request_id=nil)\n method = (response_resource_prefix + '_response').to_sym\n response_id = send(method, response[0])\n expect(response_id).to eq(request_id) unless request_id.nil?\nend", "def validate_request_and_error(request, response_error, resource...
[ "0.64380145", "0.6400991", "0.5486373", "0.53493804", "0.52908564", "0.5151591", "0.5117905", "0.50916445", "0.5036306", "0.5029624", "0.5023849", "0.49342442", "0.48831907", "0.48815995", "0.48571652", "0.48503992", "0.48310658", "0.4775227", "0.47527006", "0.47485182", "0.4...
0.7686749
0
Asserts that the request message matches the request format in _resource_prefix.request_ and that the request and error id are the same. Resource prefix is the location of the request resource, which will be appended with _.request_ to get the file location.
def validate_request_and_error(request, response_error, resource_prefix) request_id = validate_request(request, resource_prefix) validate_error(response_error, request_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_request_and_response(request, response,\n request_resource_prefix, response_resource_prefix=nil)\n # for request and response, check that the message exists in the logs and there is no error logged\n expect(request[0]).to_not be_nil\n expect(request[1]).to be_nil, \...
[ "0.7019225", "0.65094125", "0.62594324", "0.5736784", "0.5652171", "0.5555486", "0.528502", "0.52671117", "0.5264189", "0.524332", "0.5193928", "0.51781523", "0.5151866", "0.51262003", "0.5047973", "0.50381285", "0.4978053", "0.4964905", "0.4964718", "0.49637744", "0.49255937...
0.6959377
1
Asserts that the request message matches the request format in _resource_prefix.request_. Resource prefix is the location of the request resource, which will be appended with _.request_ to get the file location. Returns the request_id found in the request so it can be matched with a possible response or error
def validate_request(request, request_resource_prefix) method = (request_resource_prefix + '_request').to_sym return send(method, request[0]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_response(response, response_resource_prefix, request_id=nil)\n method = (response_resource_prefix + '_response').to_sym\n response_id = send(method, response[0])\n expect(response_id).to eq(request_id) unless request_id.nil?\nend", "def validate_request_and_response(request, response,\n ...
[ "0.634899", "0.6254332", "0.6085687", "0.59865177", "0.5976983", "0.59353536", "0.5659682", "0.55611765", "0.5461376", "0.54294354", "0.5374418", "0.53547096", "0.5303448", "0.5288345", "0.528131", "0.5268128", "0.52129036", "0.52129036", "0.5203089", "0.5198295", "0.51970667...
0.6825508
0
Asserts that the response message matches the response format in _resource_prefix.response_. Resource prefix is the location of the response resource, which will be appended with _.response_ to get the file location. If the parameter _request_id_ is given, it will be matched with the _request_id_ found in the response_...
def validate_response(response, response_resource_prefix, request_id=nil) method = (response_resource_prefix + '_response').to_sym response_id = send(method, response[0]) expect(response_id).to eq(request_id) unless request_id.nil? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_request_and_response(request, response,\n request_resource_prefix, response_resource_prefix=nil)\n # for request and response, check that the message exists in the logs and there is no error logged\n expect(request[0]).to_not be_nil\n expect(request[1]).to be_nil, \...
[ "0.6738627", "0.58665925", "0.56021297", "0.54942155", "0.5461479", "0.5435388", "0.5388683", "0.53878576", "0.5357735", "0.5351471", "0.5292151", "0.5208134", "0.52007633", "0.5196168", "0.514933", "0.51476806", "0.5143835", "0.5138242", "0.51330614", "0.5130609", "0.5130597...
0.74548537
0
Validates that the error message contains a requestId If a request_id is provided, it is matched against the error_id found in the error
def validate_error(error, request_id=nil) error_pattern_string = %r(Error occurred for outgoing request \(requestId='(?<error_id>[-a-zA-Z0-9]+)', \d+.\d* ms\)) expect(error[0]).to match(error_pattern_string) error[0] =~ error_pattern_string # match to capture id error_id = $1 expect(error_id).to eq(request_id...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_request_and_error(request, response_error, resource_prefix)\n request_id = validate_request(request, resource_prefix)\n validate_error(response_error, request_id)\nend", "def request_id\n @error['request_id']\n end", "def validate_request_and_response(request, response,\n ...
[ "0.65865445", "0.6448878", "0.5894497", "0.5651255", "0.55585873", "0.54385513", "0.52234566", "0.5145986", "0.5138806", "0.50911504", "0.5082342", "0.5006969", "0.4996378", "0.4985916", "0.4972069", "0.4932129", "0.49186298", "0.48998186", "0.48949188", "0.4892452", "0.48829...
0.72220284
0
GET /event_reviews GET /event_reviews.json
def index @event_reviews = EventReview.all redirect_to "/events" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @reviews = reviewable.reviews\n\n respond_to do |format|\n format.html\n format.json { render json: @reviews }\n end\n end", "def index\n @events = Event.all\n\n render json: @events, \n except: [:created_at, :updated_at], \n include: [:reviews => {include: [:a...
[ "0.6976849", "0.6855893", "0.67081475", "0.6624465", "0.6570695", "0.6570695", "0.65284693", "0.64978737", "0.64750755", "0.6463448", "0.6463448", "0.64458525", "0.6394655", "0.63937587", "0.6392075", "0.6373369", "0.6346486", "0.6345144", "0.63163495", "0.6301605", "0.629157...
0.7168028
0
GET /event_reviews/1 GET /event_reviews/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @reviews = reviewable.reviews\n\n respond_to do |format|\n format.html\n format.json { render json: @reviews }\n end\n end", "def index\n @event_reviews = EventReview.all\n redirect_to \"/events\"\n end", "def index\n @reviews = @place.reviews\n respond_to do |forma...
[ "0.701043", "0.69860595", "0.6726454", "0.66986185", "0.6689069", "0.66612166", "0.66612166", "0.6648957", "0.6589979", "0.6580074", "0.6580074", "0.65739536", "0.65307003", "0.6434089", "0.6416217", "0.6413007", "0.6406264", "0.6402256", "0.6375024", "0.6375024", "0.6375024"...
0.0
-1
POST /event_reviews POST /event_reviews.json
def create @event_review = EventReview.new(event_review_params) respond_to do |format| if @event_review.save format.html { redirect_to @event_review, notice: 'Event review was successfully created.' } format.json { render :show, status: :created, location: @event_review } else ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_review(booking, options = {})\n post(\"bookings/#{booking}/reviews\", reviews: [options]).pop\n end", "def event_review_params\n params.require(:event_review).permit(:review, :user_id, :event_id)\n end", "def create_pull_request_review(repo, pull_request_number, event, body = nil...
[ "0.6595921", "0.65923434", "0.6580745", "0.64729166", "0.64729166", "0.64729166", "0.64194113", "0.6392182", "0.63905656", "0.63524175", "0.6348429", "0.63442475", "0.63145125", "0.62702936", "0.6266557", "0.6262051", "0.62364525", "0.62245643", "0.62245643", "0.6223068", "0....
0.75765055
0
PATCH/PUT /event_reviews/1 PATCH/PUT /event_reviews/1.json
def update respond_to do |format| if @event_review.update(event_review_params) format.html { redirect_to @event_review, notice: 'Event review was successfully updated.' } format.json { render :show, status: :ok, location: @event_review } else format.html { render :edit } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @review = Review.find(params[:id])\n @review.update(review_params)\n render json: @review\n end", "def update\n if @review.update(review_params)\n render json: @review\n else\n render json: @review.errors, status: :unprocessable_entity\n end\nend", "def update\n respond...
[ "0.6926708", "0.663764", "0.6504503", "0.6451783", "0.6451783", "0.6451783", "0.64477575", "0.64109105", "0.6396269", "0.63936204", "0.6350918", "0.6350918", "0.6350918", "0.63433814", "0.63433814", "0.63433814", "0.63433814", "0.63278407", "0.631918", "0.631918", "0.631918",...
0.7219895
0
DELETE /event_reviews/1 DELETE /event_reviews/1.json
def destroy @event_review.destroy respond_to do |format| format.html { redirect_to event_reviews_url, notice: 'Event review was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @review = Review.find(params[:id])\n @review.destroy\n\n respond_to do |format|\n format.html { redirect_to reviews_url }\n format.json { head :ok }\n end\n end", "def _reviews_delete(id)\n delete id.to_s\n _response_status(204, last_response)\n end", "def destroy\n ...
[ "0.71665347", "0.71618414", "0.71500385", "0.71500385", "0.71500385", "0.71500385", "0.71500385", "0.7142165", "0.7142165", "0.7142165", "0.7141932", "0.7096588", "0.7040469", "0.69987124", "0.69744307", "0.6959993", "0.69521797", "0.69521797", "0.69521797", "0.69521797", "0....
0.7586672
0
Use callbacks to share common setup or constraints between actions.
def set_event_review @event_review = EventReview.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def event_review_params params.require(:event_review).permit(:review, :user_id, :event_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
reset must be called to print the struct again, as we don't want to repeatedly print the same struct when it occurs recursively in the input JSON
def reset @printed = false @structs.each(&:reset) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear\n json = parse({})\n\n super(json, { compression: false })\n\n json\n end", "def reset\n @lists = {}\n @references = {}\n @serialized = {}\n @graphs = {}\n @subjects = {}\n end", "def reset\n @parent_folder_id = nil\n @traversal = :s...
[ "0.59060764", "0.59036475", "0.5898224", "0.5825951", "0.58176446", "0.58090067", "0.58060426", "0.5775892", "0.5704055", "0.5602424", "0.55217624", "0.5472338", "0.54579407", "0.54425853", "0.5429719", "0.5423276", "0.5423276", "0.53984696", "0.53965014", "0.53962934", "0.53...
0.7680083
0
Add Value is how we add keys to the resulting Struct We need a name and a type, and potentially a subtype For example: types could be String, Fixnum, or Array If the tyoe is Array, then we need the subtype of the array, is it an array of integers or strings?
def add_value(name, type, subtype = nil) if type.class == RustyJson::RustStruct || subtype.class == RustyJson::RustStruct if type.class == RustyJson::RustStruct t = type type = type.name struct = t elsif subtype.class == RustyJson::RustStruct s = subtype ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(name, type, offset = nil)\n if type.respond_to?(:to_str) || type.respond_to?(:to_sym)\n type = registry.build(type.to_s)\n end\n @fields << [name.to_s, type, offset]\n end", "def add(*types)\n __types__.add(*types)\n end",...
[ "0.6667246", "0.6368099", "0.62511593", "0.62450045", "0.6200796", "0.60999763", "0.6083543", "0.6064537", "0.596152", "0.59591925", "0.5920141", "0.5868637", "0.586067", "0.58324313", "0.5790452", "0.5790452", "0.5734747", "0.5729819", "0.57296985", "0.57223755", "0.5717011"...
0.7631601
0
two Rust structs are equal if all of their keys / value types are the same
def ==(other) values == other.values end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ===(other)\n required = self.class.required_attributes\n\n other.respond_to?(:keys) && (common = other.keys & required) &&\n common.size == other.keys.size && common.size == required.size\n end", "def eql?(other)\n return false unless self.class == other.class\n self.key_attributes ...
[ "0.72047687", "0.71849644", "0.7111724", "0.7091531", "0.70733726", "0.7073089", "0.69714147", "0.69559157", "0.69540745", "0.69235843", "0.68939346", "0.68274266", "0.6815738", "0.681429", "0.6813648", "0.6813648", "0.6802683", "0.6688763", "0.6684372", "0.66635555", "0.6657...
0.62909484
67
to_s controlls how to display the RustStruct as a Rust Struct
def to_s return '' if @printed @printed = true struct = required_structs members = @values.map do |key, value| type = RustStruct.type_name(value[0]) subtype = RustStruct.type_name(value[1]) # TODO: add option for pub / private # Will this be a per field thin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def structToS( struct, width=20, cols=4 )\n col = 0\n s = ''\n struct.members.each{\n |k|\n ks = k.to_s.ljust( width )\n vs = struct[k].to_s.rjust( width )\n s += ks+vs+\" \"\n col += 1\n if( col == cols...
[ "0.68885595", "0.62819934", "0.61816674", "0.6141827", "0.61207646", "0.60746706", "0.60373104", "0.60373104", "0.60373104", "0.602526", "0.60182726", "0.59994274", "0.59964734", "0.59964734", "0.5993095", "0.59905064", "0.59857655", "0.5976848", "0.5970891", "0.5968185", "0....
0.76926225
0
Test Cases p sum_to(5) == 15 p sum_to(1) == 1 p sum_to(9) == 45 p sum_to(8) == nil
def add_numbers(nums_array = nil) return nil if nums_array.nil? return nums_array[0] if nums_array.length == 1 nums_array[0] + add_numbers(nums_array[1..-1]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sum_to(to)\n\treturn nil if to < 0\n\n\treturn 1 if to == 1\n\n\treturn to + sum_to(to - 1)\nend", "def sum_to(n)\n return 1 if n == 1\n return nil if n<1\n n + sum_to(n-1)\nend", "def sum_to(n)\n return nil if n < 1\n return n if n == 1\n \n n + sum_to(n - 1)\nend", "def sum_to(n)\n return 1 i...
[ "0.7233726", "0.69361454", "0.6918783", "0.6874774", "0.6859598", "0.68506354", "0.6845351", "0.6843029", "0.6840882", "0.6832162", "0.6831713", "0.68209815", "0.6805639", "0.67859364", "0.67575747", "0.6754997", "0.6749846", "0.6747451", "0.67093277", "0.6692689", "0.6622426...
0.0
-1
Test Cases p add_numbers([1,2,3,4]) == 10 p add_numbers([3]) == 3 p add_numbers([80,34,7]) == 39 p add_numbers() == nil
def gamma_fnc(n) return nil if n <= 0 return 1 if n <= 2 (n - 1) * gamma_fnc(n-1) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_numbers(nums_array)\n if nums_array.empty? \n 0\n else \n n = nums_array.pop\n return n + add_numbers(nums_array)\n end \nend", "def add_numbers(nums_array)\n return nil if nums_array.empty?\n return nums_array.pop if nums_array.length == 1\n return nums_array.pop + add_numbers(nums_array)...
[ "0.7745159", "0.77051425", "0.76854515", "0.76780266", "0.7627801", "0.7591095", "0.75321686", "0.75077343", "0.74993", "0.7493777", "0.74772245", "0.7472743", "0.7465228", "0.74635017", "0.7459958", "0.7442102", "0.74378455", "0.7426955", "0.74258137", "0.74039596", "0.74011...
0.0
-1
Get root nodes count/array for explorer tree
def x_get_tree_roots(count_only, _options) objects = Rbac.filtered(VmdbDatabase.my_database.evm_tables).to_a # storing table names and their id in hash so they can be used to build links on summary screen in top 5 boxes @sb[:vmdb_tables] = {} objects.each do |o| @sb[:vmdb_tables][o.name] = o.id ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def x_get_tree_roots\n count_only_or_objects(false, PxeServer.all, \"name\")\n end", "def x_get_tree_roots\n count_only_or_objects(false, StorageCluster.all)\n end", "def x_get_tree_roots\n count_only_or_objects(false, MiqPolicySet.all, :description)\n end", "def get_number_of_root_elements(eleme...
[ "0.769075", "0.7564679", "0.7150569", "0.7135373", "0.7068182", "0.7036481", "0.7035818", "0.70299476", "0.69325095", "0.6925408", "0.69242346", "0.6908054", "0.68336684", "0.6818326", "0.681651", "0.6807408", "0.68010336", "0.6789652", "0.67728794", "0.67718107", "0.67703456...
0.6880502
12
Handle custom tree nodes (object is a Hash)
def x_get_tree_custom_kids(object, count_only, _options) rec = VmdbTableEvm.find_by_id(from_cid(object[:id].split("|").last.split('-').last)) indexes = [] rec.vmdb_indexes.each do |ind| indexes.push(ind) if ind.vmdb_table.type == "VmdbTableEvm" end count_only_or_objects(count_only, indexes, "n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_node(key); end", "def for_node; end", "def tree=(data)\n @tree = HashWithIndifferentAccess.new(\n case data\n when Array\n hash_from_git(data)\n when Hash, HashWithIndifferentAccess\n data\n end\n )\n end", "def node_hash(node_id)\n \n en...
[ "0.62515", "0.6182488", "0.6100329", "0.6098425", "0.6074272", "0.5997073", "0.59958255", "0.59331596", "0.5886997", "0.5877732", "0.58549535", "0.5843519", "0.58186615", "0.5817136", "0.5817038", "0.58035195", "0.5778806", "0.5764574", "0.57574", "0.57561505", "0.5746136", ...
0.0
-1
Simple helper to render an informational message. Takes a block that yields the body of the message.
def info_message(title="Info", &block) render layout: "/flash_message", locals: { title: title, css_class: "infomessage" }, &block end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def info message = nil, &block\n if block_given?\n add 1, nil, message, &block\n else\n add 1, message, nil, &block\n end\n end", "def info(message, id: T.unsafe(nil), &block); end", "def show_info(message)\n say \"Information\", message, :cyan\n end", "def...
[ "0.6867613", "0.6783222", "0.65718156", "0.6519802", "0.6519802", "0.64954674", "0.6434068", "0.6388413", "0.6311509", "0.6238839", "0.6130066", "0.6124057", "0.6012838", "0.5995672", "0.5990379", "0.5936341", "0.59132576", "0.59041953", "0.5900665", "0.5891392", "0.58714163"...
0.74952304
0
Simple helper to render an alert message. Takes a block that yields the body of the message.
def alert_message(title="Alert", &block) render layout: "/flash_message", locals: { title: title, css_class: "alertmessage" }, &block end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def notify content = nil, options = nil, html_options = nil, &block\n UiBibz::Ui::Alert.new(content, options, html_options, &block).render\n end", "def display_alert(lead: 'Error', body: '', type: 'alert-danger')\n _div.alert class: type, role: 'alert' do\n _p.lead lead\n _markdown body\n end\nend", ...
[ "0.736344", "0.71001107", "0.70080745", "0.67885566", "0.6535143", "0.6405186", "0.63943166", "0.63943166", "0.6291855", "0.62429404", "0.6215475", "0.6182027", "0.61490405", "0.61444813", "0.61275655", "0.6112896", "0.60954297", "0.60543597", "0.60523623", "0.60384476", "0.5...
0.7742525
0
Method for initialize surgery location params
def new @surgery_location = SurgeryLocation.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize location=nil\n @location = location\n end", "def location_params\n params.fetch(:location, {})\n end", "def location_params\n params[:location]\n end", "def initialize(current_location)\n @location = current_location\n end", "def initialize(location = nil)\n self.l...
[ "0.70874226", "0.6934199", "0.6817758", "0.67122924", "0.6640589", "0.6592715", "0.652836", "0.6527053", "0.6448643", "0.64229065", "0.64015305", "0.6389122", "0.6379546", "0.63745874", "0.63409007", "0.6338784", "0.6332367", "0.6323717", "0.6319892", "0.63131446", "0.629893"...
0.67075425
4
Method for listing out the all the surgery locations
def index @surgery_locations = devise_current_user.setting.surgery_locations.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_surgery_location\n\t\t# Find the surgeon location based on the profile\n\t\t@surgery_locations = current_user.setting.surgery_locations.all\n\tend", "def find_surgery_location\n\t\t# Find the surgeon location based on the profile\n\t\t@surgery_locations = devise_current_user.setting.surgery_locations.al...
[ "0.74801505", "0.71808684", "0.7112752", "0.7081777", "0.70009315", "0.6972393", "0.6970259", "0.69565797", "0.6951214", "0.6942118", "0.6897221", "0.68651813", "0.68131036", "0.6794761", "0.67486054", "0.6700111", "0.6700111", "0.6700111", "0.6700111", "0.6700111", "0.670011...
0.7462246
1
Method for editing the surgery form
def edit end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit_surgery_name\n\tend", "def update\n # Updating the particular surgery and after update redirecto toe surgries page\n if @surgery.update(surgery_params)\n redirect_to surgeries_path\n else\n # else redirect to the same page surgery\n redirect_to :back\n end\n end...
[ "0.7386511", "0.7154304", "0.6808722", "0.6682379", "0.65912104", "0.6514769", "0.6511569", "0.64757353", "0.64757353", "0.64757353", "0.64757353", "0.64757353", "0.64757353", "0.64757353", "0.64685106", "0.6442623", "0.6442623", "0.6442623", "0.6442623", "0.6442623", "0.6442...
0.0
-1
Method for updating the surgery form
def update # updating the surgery location attribute @surgery_location.update(surgery_location_params) # redirect to the surgerylocations index page redirect_to surgery_locations_path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n # Updating the particular surgery and after update redirecto toe surgries page\n if @surgery.update(surgery_params)\n redirect_to surgeries_path\n else\n # else redirect to the same page surgery\n redirect_to :back\n end\n end", "def update\n respond_to d...
[ "0.7881137", "0.7154499", "0.6925853", "0.6890775", "0.66907305", "0.64351934", "0.64192194", "0.64058405", "0.6312918", "0.6308444", "0.6303765", "0.62406987", "0.61299187", "0.6093677", "0.6092998", "0.6045697", "0.60426944", "0.6032851", "0.60198313", "0.5982737", "0.59643...
0.67661613
4
Method for finding the particular surgery location
def find_location @surgery_location = SurgeryLocation.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_surgery_location\n\t\t# Find the surgeon location based on the profile\n\t\t@surgery_locations = current_user.setting.surgery_locations.all\n\tend", "def find_surgery_location\n\t\t# Find the surgeon location based on the profile\n\t\t@surgery_locations = devise_current_user.setting.surgery_locations.al...
[ "0.8261919", "0.79825175", "0.7090992", "0.69758344", "0.6970897", "0.69051033", "0.68212914", "0.6769524", "0.6673434", "0.66672176", "0.6632352", "0.66275406", "0.6578091", "0.6562807", "0.6554454", "0.6499701", "0.6497752", "0.6489336", "0.6483119", "0.64327323", "0.641653...
0.8153251
1
Should never be called directly, go through EPUBInfo.get
def initialize(node) self.identifier = node.content self.scheme = node.attribute('scheme').content rescue nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_epub_url\n if self.epub.attachment\n self.epub.key << \".epub\"\n self.epub_url = self.epub.service_url.split(\"?\").first\n end\n end", "def getTitle(book)\n book['volumeInfo']['title']\nend", "def get_title(book)\n book[\"volumeInfo\"][\"title\"]\nend", "d...
[ "0.5751706", "0.57392716", "0.5694744", "0.55699134", "0.5455682", "0.5357393", "0.5357393", "0.5357393", "0.5352489", "0.52583164", "0.523269", "0.5226666", "0.5224264", "0.5217355", "0.52096593", "0.5202586", "0.5201801", "0.51827663", "0.5164212", "0.51631", "0.515687", ...
0.0
-1
Returns Hash representation of an identifier
def to_hash { :identifier => @identifier, :scheme => @scheme } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash\n guid.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n ...
[ "0.7834081", "0.78210324", "0.7820463", "0.7820463", "0.7820463", "0.7820463", "0.7820463", "0.7820463", "0.7820463", "0.7820463", "0.7820463", "0.78195256", "0.77763295", "0.77369994", "0.77106494", "0.77106494", "0.7690914", "0.74620664", "0.7455959", "0.74369115", "0.73649...
0.64036137
69
initialize method is being called first
def initialize(name, age) #two instance variables inside method of class @name = name @age = age end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_initialize\n end", "def pre_initialize\n end", "def after_initialize\n end", "def at_init\n\n\t\tend", "def initialize\n initialize!\n end", "def initialize\n initialize!\n end", "def init\n end", "def init\n end", "def init\n end", "def init; en...
[ "0.82094145", "0.812725", "0.8061963", "0.8058361", "0.79323995", "0.79323995", "0.7928141", "0.7928141", "0.7928141", "0.79062283", "0.79062283", "0.79062283", "0.79062283", "0.78998", "0.7885539", "0.7859993", "0.7850828", "0.7817751", "0.7804051", "0.78020614", "0.7788348"...
0.0
-1
new method inside of the Person class
def increase_age(number) #@age = @age + number // does the same as line 20 @age += number end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_person\r\n @person = Person.new\r\n end", "def new\n @person = Person.new\n end", "def new\n @person = Person.new\n end", "def new\n @person = Person.new\n end", "def initialize(name)\n # self. refers to this class\n # self.name calls the method \"name\" of the instance ...
[ "0.75421554", "0.70574516", "0.70574516", "0.70574516", "0.702715", "0.66551733", "0.66551733", "0.66551733", "0.66551733", "0.66551733", "0.66551733", "0.66551733", "0.66551733", "0.66551733", "0.66366905", "0.65669304", "0.64571875", "0.64171106", "0.64171106", "0.64171106", ...
0.0
-1
Activity Worker for a Multiple Activites Class Make three instance of activity and pass their to Workflow
def activity_worker worker = AWS::Flow::ActivityWorker.new(@domain.client, @domain, ACTIVITY_TASKLIST) worker.add_implementation(SwfActivityOne.new) worker.add_implementation(SwfActivityTwo.new) worker.add_implementation(SwfActivityThree.new) worker end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_workflow(name)\n puts \"schedule the next Activity/Step for #{name}!\"\n #number is an array of Futures object (http://docs.aws.amazon.com//amazonswf/latest/awsrbflowapi/AWS/Flow/Core/Future.html)\n numbers = []\n numbers << client_one.send_async(:set_number)\n numbers << client_two.send_a...
[ "0.67251563", "0.6261136", "0.60756564", "0.60672826", "0.5743684", "0.564606", "0.5562609", "0.5549217", "0.5541681", "0.5537633", "0.54599035", "0.544119", "0.5429118", "0.5422764", "0.54162097", "0.53898233", "0.5354631", "0.5343464", "0.52836597", "0.5279615", "0.5212179"...
0.7698604
0
Use callbacks to share common setup or constraints between actions.
def set_message @message = Message.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6162554", "0.60452986", "0.5945278", "0.59169763", "0.58877826", "0.5834763", "0.5775349", "0.5704972", "0.5704972", "0.56543803", "0.5621491", "0.5427202", "0.54093206", "0.54093206", "0.54093206", "0.53975695", "0.53776276", "0.53562194", "0.5340594", "0.5337824", "0.532...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def message_params params.require(:message).permit(:playcelet_id, :invited_playcelet_id, :invited_playcelet_ids, :app_id, :type) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69811666", "0.6782836", "0.6747644", "0.6742015", "0.6735273", "0.6593917", "0.65037674", "0.6498627", "0.6482372", "0.64795715", "0.64566946", "0.6439213", "0.6380714", "0.6378147", "0.63657266", "0.63206697", "0.6300169", "0.62992156", "0.6295538", "0.62943023", "0.62915...
0.0
-1
GET /direccionts GET /direccionts.json
def index @direccionts = Direcciont.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @direcciones = Direccion.all\n end", "def index\n @direccions = Direccion.recientes.all\n end", "def index\n\t\t@direccions = Direccion.where(:personas_id => session[:id])\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.xml { render :xml => @direccions }\n\t...
[ "0.673341", "0.6543338", "0.635793", "0.6233017", "0.62213326", "0.59812427", "0.5909071", "0.58942735", "0.58489376", "0.58207774", "0.58138645", "0.5788128", "0.57479167", "0.5653746", "0.5630007", "0.5607279", "0.558356", "0.5570573", "0.55332506", "0.551464", "0.55003595"...
0.7017256
0
GET /direccionts/1 GET /direccionts/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @direccionts = Direcciont.all\n end", "def index\n @direcciones = Direccion.all\n end", "def index\n @direccions = Direccion.recientes.all\n end", "def index\n\t\t@direccions = Direccion.where(:personas_id => session[:id])\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html....
[ "0.6710802", "0.6507739", "0.6370664", "0.61483717", "0.61480397", "0.5925439", "0.591818", "0.5874766", "0.57862747", "0.5781208", "0.5781208", "0.5781208", "0.5760387", "0.5753577", "0.57523495", "0.57078636", "0.5612607", "0.56104684", "0.5572807", "0.5561066", "0.5548713"...
0.0
-1
POST /direccionts POST /direccionts.json
def create @direcciont = Direcciont.new(direcciont_params) respond_to do |format| if @direcciont.save format.html { redirect_to @direcciont, notice: 'Direcciont was successfully created.' } format.json { render :show, status: :created, location: @direcciont } else format.htm...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @direccion = Direccion.new(direccion_params)\n\n respond_to do |format|\n if @direccion.save\n format.html { redirect_to @direccion, notice: 'Direccion was successfully created.' }\n format.json { render :show, status: :created, location: @direccion }\n else\n form...
[ "0.64588946", "0.64588946", "0.6414668", "0.6220197", "0.60329187", "0.6003401", "0.59703267", "0.5963523", "0.58867145", "0.5687731", "0.567569", "0.55992067", "0.5460485", "0.5417254", "0.53452694", "0.53118134", "0.5308151", "0.5303772", "0.5301022", "0.5284135", "0.520710...
0.6727343
0
PATCH/PUT /direccionts/1 PATCH/PUT /direccionts/1.json
def update respond_to do |format| if @direcciont.update(direcciont_params) format.html { redirect_to @direcciont, notice: 'Direcciont was successfully updated.' } format.json { render :show, status: :ok, location: @direcciont } else format.html { render :edit } format.jso...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @direccion.update(direccion_params)\n format.html { redirect_to @direccion, notice: 'Direccion was successfully updated.' }\n format.json { render :show, status: :ok, location: @direccion }\n else\n format.html { render :edit }\n for...
[ "0.6512463", "0.6512463", "0.6478375", "0.64715755", "0.6401148", "0.63031197", "0.61861044", "0.6156134", "0.6154069", "0.61292106", "0.6122459", "0.6087247", "0.60859185", "0.6037951", "0.6003189", "0.5972746", "0.5934383", "0.589347", "0.5887229", "0.588666", "0.58793014",...
0.67774326
0
DELETE /direccionts/1 DELETE /direccionts/1.json
def destroy @direcciont.destroy respond_to do |format| format.html { redirect_to direccionts_url, notice: 'Direcciont was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @direccion.destroy\n respond_to do |format|\n format.html { redirect_to direcciones_url, notice: 'Direccion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", ...
[ "0.71430475", "0.7142549", "0.7117126", "0.71135217", "0.7067817", "0.69935197", "0.6979659", "0.69726926", "0.69625854", "0.68721443", "0.6844518", "0.683103", "0.675637", "0.6727167", "0.66944873", "0.6647984", "0.6639353", "0.66341436", "0.6618577", "0.6602907", "0.6601487...
0.72939825
0
Use callbacks to share common setup or constraints between actions.
def set_direcciont @direcciont = Direcciont.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def direcciont_params params.require(:direcciont).permit(:direccion, :sector, :cuidadt_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69802505", "0.6781974", "0.67470175", "0.67430073", "0.67350477", "0.6593221", "0.6504263", "0.64988977", "0.6481794", "0.64800006", "0.64568025", "0.64411247", "0.6379476", "0.63765615", "0.6368045", "0.6320141", "0.6300363", "0.6300057", "0.62952244", "0.6294712", "0.629...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_faq @faq = Faq.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163443", "0.604317", "0.5943409", "0.59143174", "0.5887026", "0.58335453", "0.57738566", "0.5701527", "0.5701527", "0.56534666", "0.5618685", "0.54237175", "0.5407991", "0.5407991", "0.5407991", "0.5394463", "0.5376582", "0.5355932", "0.53376216", "0.5337122", "0.5329516"...
0.0
-1
Only allow a trusted parameter "white list" through.
def faq_params params.require(:faq).permit(:question, :answer, :display, :priority, :placement).merge(:user_id => current_user.id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", ...
[ "0.7121987", "0.70541996", "0.69483954", "0.6902367", "0.6733912", "0.6717838", "0.6687021", "0.6676254", "0.66612333", "0.6555296", "0.6527056", "0.6456324", "0.6450841", "0.6450127", "0.6447226", "0.6434961", "0.64121825", "0.64121825", "0.63913447", "0.63804525", "0.638045...
0.0
-1
TODO: Extract this to ActiveFedora::Aggregations::ListSource
def ordered_docs @ordered_docs ||= ActiveFedora::SolrService.query("member_of_collection_ids_ssim:#{id}", rows: 10_000).map { |x| SolrDocument.new(x) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def source_list(label, *list)\n _logger.warn \"Duplicate source_list '#{label}'\" if @result.source_lists.has_key?(label)\n @result.source_lists[label] += list\n end", "def single_datasource_list_item(source, options)\n classes = []\n classes << 'minor_source' if options[:minor]\n query = o...
[ "0.64260155", "0.59224707", "0.57287085", "0.57215464", "0.5715139", "0.5626485", "0.55810153", "0.5563222", "0.5535849", "0.5508381", "0.55019534", "0.55019534", "0.54817", "0.54817", "0.54817", "0.54817", "0.54817", "0.5445717", "0.5431559", "0.5431559", "0.5431559", "0.5...
0.0
-1
Check if line can be ignored Excercise 5.2 change chomp to boring
def boring?(line) contains?(line, 'temp' ) or contains?(line, 'recycler' ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ignore?(buf); end", "def junky?(line)\n explode(line).select {|s| s && !s.strip.empty?}.count <= 2\n end", "def irrelevant_line?(source_line); end", "def chomp!(sep=$/) end", "def chomp!(sep=$/) end", "def line_is_empty? line\n\tcheck = line.clone\n\tcheck.strip!.empty?\nend", "def irrelevant_l...
[ "0.6631141", "0.65892494", "0.65619487", "0.64297646", "0.64292324", "0.6424661", "0.6401437", "0.6374383", "0.6270595", "0.62334025", "0.6130199", "0.61202157", "0.6099779", "0.60790104", "0.60694814", "0.6057101", "0.6043978", "0.60276574", "0.60150117", "0.6013774", "0.601...
0.0
-1
Excercise 5.3 move include to a method
def contains?(line, string) line.chomp.split('/' ).include?(string) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def include; end", "def include; end", "def included; end", "def include(mod,*more) end", "def add_include include\n add_to @includes, include\n\n include\n end", "def includes\n end", "def includes\n end", "def include=(_arg0); end", "def included(mod); end", "def include inc\n @in...
[ "0.81667906", "0.81667906", "0.76564413", "0.7489499", "0.74356264", "0.7423958", "0.7423958", "0.7335337", "0.73041075", "0.7181344", "0.7094033", "0.7039925", "0.6979349", "0.689659", "0.6881759", "0.68788385", "0.68773204", "0.6870826", "0.6834828", "0.6834828", "0.6780864...
0.0
-1
create method for comparing directories
def compare_inventory_files(old_file, new_file) old_inventory = inventory_from(old_file) new_inventory = inventory_from(new_file) x = (new_inventory - old_inventory).length # Excercise: add number of added files puts "The following #{x} file(s) have been added:" puts new_inventory - old_inventory y = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compare_folders(a, b)\n\n puts \"* Comparing contents...\".light_yellow\n puts if OPTIONS.verbose\n \n common_a, unique_to_a = a.compare_to(b)\n common_b, unique_to_b = b.compare_to(a, common_a)\n common = common_a | common_b\n\n puts\n [unique_to_a, common, unique_to_b]\nend", "def compareDirs( rela...
[ "0.74558693", "0.69561636", "0.6842774", "0.6833518", "0.6689244", "0.6574528", "0.6552533", "0.6541494", "0.65073293", "0.6385623", "0.6335597", "0.6275772", "0.6275772", "0.6247321", "0.6244533", "0.6233669", "0.62259454", "0.616134", "0.6160614", "0.61489654", "0.61331713"...
0.0
-1
This is debatably redundant with belongs_to in make_resourceful.
def _refine_top_query_scope # recommended before_filter for subclasses to restrict @parent_object further. raise "Override in subclass." end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def belongs_to?; false; end", "def belongs_to(*attrs)\n define_rid_method = attrs[1].try(:delete, :rid)\n super.tap do\n if define_rid_method != false\n relationship_name = attrs[0]\n rel = reflections[relationship_name] || reflections[relationship_name.to_s]\n\n retur...
[ "0.6556796", "0.6552212", "0.64130795", "0.63078916", "0.6258226", "0.6224328", "0.6056415", "0.60532784", "0.6040905", "0.6015688", "0.5992711", "0.5966786", "0.5966786", "0.5919931", "0.59171927", "0.5915497", "0.59145117", "0.58856463", "0.5870272", "0.5855234", "0.5844457...
0.0
-1
the false positive predictive rate (sometimes called the false positive rate). This is 1 precision
def fppr(num_target, num_decoy, pi_not=1.0) 1.0 - precision(num_target, num_decoy, pi_not=1.0) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rate\n @rate * ONE_NANOS\n end", "def precision_at_fraction_recall val\n @p.each_index do |i|\n return actual_precision(i) if tpr(i) < val\n end\n 0.0\n end", "def rate\n first_at, first_value = @samples.first\n last_at, last_value = @samples.l...
[ "0.6976939", "0.6857357", "0.66164577", "0.6535923", "0.6440721", "0.64140546", "0.6397502", "0.63950926", "0.63616973", "0.63014984", "0.6173222", "0.61718965", "0.61583394", "0.6149293", "0.61273986", "0.609616", "0.6072012", "0.6062992", "0.60495216", "0.6021864", "0.60215...
0.61734
10
set the price as a string with 2 decimal point accuracy
def price_as_string format("$%.2f", @price) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def price_as_string\n \"$%.2f\" % @price\n end", "def price_as_string()\n @price = '%.2f' % (@price)\n return \"$\"+@price.to_s \n end", "def price_as_string\n return \"$%.2f\" % @price.to_f #PassAll:price_as_string\n end", "def price_as_string\n return \"$\" + '%.2f' % @price\n end", "def ...
[ "0.8203932", "0.811772", "0.80385804", "0.7994542", "0.79890156", "0.79584676", "0.79551506", "0.7946436", "0.79390305", "0.7900496", "0.7890788", "0.7887288", "0.7873789", "0.7846273", "0.78377825", "0.78283215", "0.7812406", "0.7804234", "0.7801574", "0.7799389", "0.7793901...
0.7917296
10
create rooms and fill initial prices
def sync_rooms create_rooms if hotel.rooms.size.zero? hotel.rooms.real.each do |room| room_id = room.send(connector_room_id_key) setup_room_prices(room_id, room.id) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_rooms(rooms_params)\n\t\trooms_params[:extra_info] ||= \"\"\n\n\t\trooms_params[:range].each do |number|\n\t\t\trooms << Room.create( number: number.to_i, \n\t\t\t\t\t\t\t\t\t\t\t\t\t capacity: rooms_params[:capacity].to_i, \n\t\t\t\t\t\t\t\t\t\t\t\t\t extra_info: rooms_params[:extra_info],\n\t\t\t\t\...
[ "0.6945475", "0.68840754", "0.65252614", "0.64461267", "0.6409518", "0.63978624", "0.635867", "0.62965894", "0.6293294", "0.62165093", "0.6210004", "0.62053597", "0.6175357", "0.6163134", "0.6153627", "0.6143402", "0.61168253", "0.6113042", "0.60851866", "0.60658365", "0.6013...
0.6702881
2
remove useless room_settings useful when booking_id changed
def update_settings setting = company.setting_fallback RoomSetting.delete(setting.room_settings) setting.send(:create_room_settings) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear_room_instance_ids\n get_attribute(:room_instance_ids).clear\n nil\n end", "def clean_up\n if self.deleted?\n # clean room type mapping\n RoomTypeChannelMapping.find_all_by_room_type_id(self.id).each do |rtcm|\n rtcm.update_attribute(:deleted, true)\n end\n # c...
[ "0.57134545", "0.5655388", "0.562002", "0.56008065", "0.54882026", "0.54613405", "0.54404974", "0.5421194", "0.5387982", "0.5381982", "0.53527915", "0.53501004", "0.5333241", "0.52788264", "0.52617085", "0.5248746", "0.5245176", "0.5241486", "0.52301496", "0.52301496", "0.520...
0.62215436
0
Called when a new network interface is added to a container
def add_netif(opts) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def interface_add(network_interfaces, node_uid, interfaces)\n num1 = node_uid.split('-')[1].to_i\n if network_interfaces.has_value?(interfaces) == false\n network_interfaces[[num1]] = interfaces\n else\n num2 = network_interfaces.key(interfaces)\n network_interfaces.delete(num2)\n netw...
[ "0.64956164", "0.62389517", "0.62352926", "0.6108322", "0.60460514", "0.59021235", "0.58920705", "0.58300644", "0.57731205", "0.5731131", "0.5730863", "0.5604613", "0.552669", "0.5513667", "0.5507456", "0.5500319", "0.5496921", "0.5444435", "0.5361829", "0.5360992", "0.533492...
0.5184049
31
Called when a network interface is removed from a container
def remove_netif(opts) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def drop(interface)\n @pool.drop\n end", "def disconnected(interface)\n\t\t@status_lock.synchronize {\n\t\t\tstatus_array = @connected_interfaces.delete(interface)\n\t\t\tstatus_array.each do |status_hash|\n\t\t\t\tstatus_hash.delete(interface)\n\t\t\tend\n\t\t\t#\n\t\t\t# TODO::Refactor required\n\t\t\t...
[ "0.64128757", "0.6343649", "0.6319438", "0.6269814", "0.6185421", "0.6054838", "0.6035399", "0.5950248", "0.5883257", "0.5882047", "0.5871231", "0.58468354", "0.58159584", "0.58159584", "0.5814651", "0.5784622", "0.5780012", "0.5744778", "0.568539", "0.56729203", "0.5589055",...
0.5667921
22
Called when an existing network interface is renamed
def rename_netif(opts) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rename_netif(netifs, netif, old_name)\n end", "def rename_netif(netifs, netif, old_name)\n # Remove old network interface\n do_remove_netif(old_name)\n\n # Create the new interface\n do_create_netif(netif)\n end", "def onRenamed(item, oldName, newName)\n @object.renamed(impor...
[ "0.7386079", "0.7318025", "0.6469028", "0.6151278", "0.59545046", "0.5888089", "0.5760561", "0.5647251", "0.5647251", "0.5585602", "0.557492", "0.54986477", "0.5437905", "0.5394161", "0.53864264", "0.5385541", "0.53659827", "0.5354233", "0.53206354", "0.53186214", "0.53125674...
0.64375025
4
Return path to `/bin` or an alternative, where a shell is looked up
def bin_path(_opts) '/bin' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bin_path\n '/usr/local/bin'.p\n end", "def shell_path\n value = shell_name.to_s\n\n if value.match(/^\\//)\n # Absolute path already provided (starts with \"/\")\n value.p\n else\n # Shell name provided, use \"which\" to find the executable\n which(value).p\n end\n end", ...
[ "0.77079326", "0.7471957", "0.74108934", "0.7407706", "0.7277174", "0.72635853", "0.72635853", "0.7260902", "0.7249095", "0.72404087", "0.72404087", "0.72404087", "0.72404087", "0.72404087", "0.72404087", "0.72404087", "0.72404087", "0.72404087", "0.72404087", "0.72404087", "...
0.7370659
6
Update hostname in /etc/hosts, optionally removing configuration of old hostname.
def update_etc_hosts(old_hostname = nil) path = File.join(ct.rootfs, 'etc', 'hosts') return unless writable?(path) hosts = EtcHosts.new(path) if old_hostname hosts.replace(old_hostname, ct.hostname) else hosts.set(ct.hostname) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_etc_hosts(old_hostname = nil)\n regenerate_file(File.join(ct.rootfs, 'etc', 'hosts'), 0644) do |new, old|\n old.each_line do |line|\n if (/^127\\.0\\.0\\.1\\s/ =~ line || /^::1\\s/ =~ line) \\\n && !includes_hostname?(line, ct.hostname)\n\n if old_hostname && ...
[ "0.7932078", "0.7614524", "0.7595846", "0.7428402", "0.73826325", "0.73591787", "0.71430033", "0.7068094", "0.70367754", "0.69128805", "0.69097763", "0.6861164", "0.68333495", "0.68286896", "0.68166673", "0.68150824", "0.6741437", "0.67231643", "0.6687918", "0.66420925", "0.6...
0.76494056
1
Check if the file at `path` si writable by its user If the file doesn't exist, we take it as writable. If a block is given, it is called if `path` is writable.
def writable?(path) begin return if (File.stat(path).mode & 0200) != 0200 rescue Errno::ENOENT # pass end yield(path) if block_given? true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_writable(path)\n raise Error, \"The path '#{path}' is not writable\" if (path.exist? && !path.writable?) || !path.parent.writable?\n end", "def writable?(path)\n info = Private.info_with(path, GLib::G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE)\n GLib.g_file_info_get_attribute_boolean(info, GLib::G_...
[ "0.74405783", "0.7012061", "0.672441", "0.64537144", "0.6383822", "0.6377374", "0.60248893", "0.59290355", "0.5913477", "0.5824689", "0.58114445", "0.5809847", "0.57984734", "0.57171375", "0.56841063", "0.5668578", "0.5557024", "0.55115783", "0.5505753", "0.54880935", "0.5484...
0.81410724
0