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 |
|---|---|---|---|---|---|---|
XBMC API Commands that Retrieve Information | def GetMediaLocation(type, path=nil, showdate=false)
if(showdate)
parse_asdictlist(cmd(with_args(type, path, "showdate")), ["name", "path", "type", "date"])
else
parse_asdictlist(cmd(with_args(type, path)), ["name", "path", "type"])
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cobbler_info(system_name,options)\n connection = XMLRPC::Client.new2(\"#{options[:cobbler_api]}\")\n system_data = connection.call(\"get_system_as_rendered\",\"#{system_name}\")\n return(system_data)\nend",
"def info\n IbmCloudRest.get \"#{@uri}/\"\n end",
"def getinfo\n @api.request 'getinfo... | [
"0.65309876",
"0.6409811",
"0.62974566",
"0.6061864",
"0.60060793",
"0.57415724",
"0.5739558",
"0.5722068",
"0.57073027",
"0.57073027",
"0.57073027",
"0.56960297",
"0.567037",
"0.56318897",
"0.5605633",
"0.56046313",
"0.5588338",
"0.5548123",
"0.55378926",
"0.55189514",
"0.55... | 0.0 | -1 |
Commands that Modify Settings | def AddToPlayList(media, playlist=nil, mask=nil, recursive=true)
if(recursive == true)
recursive = 1
else
recursive = 0
end
success?(parse(cmd(with_args(media, playlist, mask, recursive))))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_settings\n end",
"def settings\n cmd.settings\n end",
"def settings\n @cmd.settings\n end",
"def settings\n end",
"def edit_settings(settings)\n queries = password_hash\n queries[:query][:settings] = \"#{settings.to_json}\"\n put \"/setup/api/settings\", queries\n ... | [
"0.7600295",
"0.71948886",
"0.6837904",
"0.6666752",
"0.6656295",
"0.66357845",
"0.6625044",
"0.65310884",
"0.65310884",
"0.63763535",
"0.63511854",
"0.63511854",
"0.6288414",
"0.62614775",
"0.6232936",
"0.61723864",
"0.6081803",
"0.6077537",
"0.59902626",
"0.5966115",
"0.596... | 0.0 | -1 |
Commands that Generate Actions | def Action(code) # Sends a raw Action ID (see key.h)
success?(parse(cmd(with_args(code))))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def actions; end",
"def run_actions; end",
"def commands; end",
"def actions() ; info[:actions] ; end",
"def actions() ; info[:actions] ; end",
"def command; end",
"def command; end",
"def command; end",
"def command; end",
"def command; end",
"def co... | [
"0.72752565",
"0.71903735",
"0.7179213",
"0.70244884",
"0.70244884",
"0.68519276",
"0.68519276",
"0.68519276",
"0.68519276",
"0.68519276",
"0.68519276",
"0.68127185",
"0.6787781",
"0.6700819",
"0.6657867",
"0.6635613",
"0.6632413",
"0.6631586",
"0.6619946",
"0.6617919",
"0.65... | 0.0 | -1 |
Commands that Modify Files | def FileCopy(src, dst)
success?(parse(cmd(with_args(src, dst))))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit_file( path)\n\t\tVim::command(\"edit #{path}\")\n\tend",
"def modified_files(options); end",
"def modified_files(options); end",
"def edit_file(filename, content, options={})\n end",
"def update!(**args)\n @delete_file = args[:delete_file] if args.key?(:delete_file)\n @write_f... | [
"0.70239353",
"0.70077604",
"0.70077604",
"0.6936737",
"0.65517294",
"0.6543674",
"0.6490414",
"0.63851327",
"0.6348991",
"0.62937605",
"0.6276319",
"0.62540394",
"0.6251898",
"0.62248373",
"0.62108546",
"0.6202451",
"0.60988015",
"0.60828847",
"0.60510796",
"0.60510796",
"0.... | 0.0 | -1 |
Remove the given node | def remove(node)
if link = Likewise::Link.find_by_id(key_for(node))
remove_link(link)
element_removed!
element_decremented!(link[:weight])
end
node.context = link
node
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove(node)\n end",
"def delete(node)\n remove_node(node)\n end",
"def remove_node\n remove_node_helper(@root)\n end",
"def node_remove(node)\n return unless node_present? node\n nodes.delete prepare_key(node)\n end",
"def remove(node)\n node = node.name if Node === no... | [
"0.88360304",
"0.84460044",
"0.83692056",
"0.8358807",
"0.80639493",
"0.7964181",
"0.7935737",
"0.7860833",
"0.7806814",
"0.7754569",
"0.7741812",
"0.76920724",
"0.7648521",
"0.7593704",
"0.7537137",
"0.7510973",
"0.74814844",
"0.7430064",
"0.72984487",
"0.728082",
"0.7254507... | 0.76544714 | 12 |
Set the weight of a given node | def set(node, weight)
change_by node, nil, weight
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def weight=(value)\n @weight = value\n end",
"def set_weight(provider, weight, safe=true)\n get_yn(\"You're about to modify the weight of #{provider} to #{weight} are you sure (Y|N)?\") unless safe == false\n # do it\n @nodes.each do |node|\n old_weight = @weights[... | [
"0.76406705",
"0.7294768",
"0.7176214",
"0.7176214",
"0.7148288",
"0.70282555",
"0.68297106",
"0.68297106",
"0.68297106",
"0.68297106",
"0.681463",
"0.67482716",
"0.6740333",
"0.6711336",
"0.67113",
"0.6633663",
"0.6616817",
"0.66033536",
"0.6596299",
"0.6342344",
"0.63222194... | 0.8736268 | 0 |
Increment a node by 1 | def increment(node)
change_by node, 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def incr\n add(1)\n end",
"def incr(key)\n node_for(key).incr(key)\n end",
"def next(num)\n @node = num\n @hour.number +=1\n end",
"def incr(x) x + 1 end",
"def increment\n @value += 1\n end",
"def increment\n self.class.increment(self)\n end",
"def increment\n ... | [
"0.7466809",
"0.73725706",
"0.73549575",
"0.7073205",
"0.70480907",
"0.6899716",
"0.68359387",
"0.68355644",
"0.6811129",
"0.6798408",
"0.6769692",
"0.67381346",
"0.6700687",
"0.65766376",
"0.65627384",
"0.65419894",
"0.6538438",
"0.6507214",
"0.6487568",
"0.64169836",
"0.641... | 0.8922636 | 0 |
Increment a node by a given value | def increment_by(node, weight)
raise ArgumentError.new('please use #decrement_by') if weight < 0
change_by node, weight
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def increment(node)\n change_by node, 1\n end",
"def increment\n @value += 1\n end",
"def incr(key)\n node_for(key).incr(key)\n end",
"def incr(x) x + 1 end",
"def incrby(key, increment)\n node_for(key).incrby(key, increment)\n end",
"def increment!\n @value += @increme... | [
"0.8429351",
"0.74313504",
"0.737669",
"0.71802616",
"0.7126537",
"0.70331484",
"0.6988923",
"0.69389933",
"0.6890044",
"0.67450887",
"0.67435557",
"0.6728592",
"0.67154586",
"0.6589925",
"0.6581374",
"0.6424423",
"0.64183223",
"0.64037514",
"0.6396027",
"0.63779867",
"0.6374... | 0.69996166 | 6 |
Decrement a node by 1 | def decrement(node)
change_by node, -1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decrement\n @value -= 1\n end",
"def remove_or_decrement_ref(*nodes); end",
"def decrement\n @counter = @counter - 1\n end",
"def decrement!\n @value -= @increment\n \n self\n end",
"def decrement_by(node, weight)\n raise ArgumentError.new('please use #increment_b... | [
"0.7390506",
"0.72184694",
"0.7034384",
"0.6861959",
"0.6675042",
"0.666805",
"0.65283173",
"0.65283173",
"0.65283173",
"0.65283173",
"0.65283173",
"0.6481354",
"0.64408356",
"0.6415134",
"0.6370659",
"0.6352612",
"0.6319263",
"0.62862724",
"0.6263157",
"0.6247475",
"0.623407... | 0.874254 | 0 |
Decrement a node by a given value | def decrement_by(node, weight)
raise ArgumentError.new('please use #increment_by') if weight < 0
change_by node, -weight
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decrement(node)\n change_by node, -1\n end",
"def decrement\n @value -= 1\n end",
"def remove_or_decrement_ref(*nodes); end",
"def decrement!\n @value -= @increment\n \n self\n end",
"def decrby(key, decrement)\n node_for(key).decrby(key, decrement)\n end",... | [
"0.85383654",
"0.76631516",
"0.7092519",
"0.6998988",
"0.6748",
"0.672941",
"0.66154635",
"0.6601803",
"0.653701",
"0.6527995",
"0.6504193",
"0.6504193",
"0.6504193",
"0.6504193",
"0.6504193",
"0.6500717",
"0.64973736",
"0.6422662",
"0.6422662",
"0.64190984",
"0.64146227",
... | 0.6925729 | 4 |
Since a node only appears once we can use this for quick find | def key_for(node)
"#{id}-#{node.id}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_or_find_duplicate(node)\n @nodes[node.path] ||= node\n @nodes[node.path]\n end",
"def find_duplicate(nums)\n if !nums or nums.size == 0\n return nil\n else\n fast = nums[ 0 ]\n slow = nums[ 0 ]\n while true\n fast = nums[ fast ]\n ... | [
"0.69137305",
"0.60900265",
"0.60799617",
"0.6055323",
"0.602898",
"0.59730035",
"0.5958009",
"0.59140533",
"0.5895693",
"0.58843195",
"0.58815134",
"0.58657515",
"0.5864408",
"0.58594286",
"0.58314204",
"0.58069193",
"0.5800906",
"0.5795695",
"0.57831633",
"0.5749389",
"0.57... | 0.0 | -1 |
All a member to the collection If it is already in, increment its weight TODO if it doesn't need to move, don't move it | def change_by(node, by, set = nil)
raise 'Node must be persisted!' unless node.persisted?
# first find out where it is
the_link = Likewise::Link.find_by_id key_for(node)
# Allow set to work
by = the_link.nil? ? set : set - the_link[:weight] if set
# If we found no link, we'll need to... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_up_in_collection!\n weight = self.weight\n\n if previous_item = self.prioritizable_collection.where(['weight > ?', weight]).last\n swap_weight_with_other_item!(previous_item)\n end\n end",
"def add_members_to_collection collection = nil\n collection ||= @collection\n collection.... | [
"0.6860784",
"0.6008147",
"0.58039457",
"0.56696856",
"0.5596699",
"0.55104285",
"0.54624355",
"0.54287636",
"0.53987604",
"0.535162",
"0.53308105",
"0.5328515",
"0.53228843",
"0.5298794",
"0.52891505",
"0.5231966",
"0.52135944",
"0.51883346",
"0.5175157",
"0.5168044",
"0.516... | 0.0 | -1 |
Place a given link in the set just before the dest | def place_link(link, dest, last_link)
# If there is no dest, we are meant to be
if dest.nil?
# If we have no last link, we are alone - and are head
# and link's prev remains nil
if last_link.nil?
self[:head_id] = link.id
# If we have the last link, we want to be af... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move\n # Noting that insert, if applied to an existing resource, moves it\n # to its new URL.\n item_insert(item_find)\n end",
"def update_link!(link)\n key = link.key\n val = link.val\n @store.remove(key)\n link = @store.append(key,val) #this is where y... | [
"0.59366107",
"0.5907995",
"0.5863514",
"0.5859705",
"0.5486641",
"0.54791796",
"0.5478274",
"0.53421366",
"0.53421366",
"0.5258509",
"0.5258509",
"0.52575666",
"0.52444935",
"0.5202523",
"0.51937264",
"0.5178783",
"0.51505184",
"0.5144108",
"0.5120045",
"0.5106267",
"0.51053... | 0.6602143 | 0 |
Remove a given link entirely The link MUST exist in the set | def remove_link(link)
# If the_link is head, set head to nil
if self[:head_id] == link.id
self[:head_id] = link.next_id
end
if link.prev
# If things on both sides, link them
if link.next
link.prev.next_id = link.next_id
link.next.prev_id = link.prev_id... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_link(link)\n links.delete(link)\n end",
"def unlinked\n reject(&:linked?)\n end",
"def invalidate_link link\n @links.delete(link.condition)\n \n end",
"def remove_link(from,to,tag)\n link = JiakLink.new(to.jiak.object.bucket, to.jiak.object.key, tag)\n has_link... | [
"0.7703839",
"0.69554937",
"0.6955326",
"0.69084287",
"0.67965156",
"0.6795523",
"0.67111826",
"0.66943604",
"0.6462588",
"0.64224446",
"0.6376688",
"0.6365285",
"0.63531536",
"0.63525224",
"0.6318781",
"0.63185704",
"0.62719214",
"0.6225598",
"0.62142617",
"0.61921054",
"0.6... | 0.71067786 | 1 |
Use callbacks to share common setup or constraints between actions. | def set_weed
@weed = Weed.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 |
Only allow a trusted parameter "white list" through. | def weed_params
params.require(:weed).permit(:strain, :type, :brand)
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 |
Either render the link to authorization or render the files providershow method is invoked here | def show
::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,
::Deepblue::LoggingHelper.called_from,
"params=#{params}",
"" ] if browse_everything_controller_debug_verbo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_oauth_partial_links\n template \"views/users/shared/_link.html.slim\", \"app/views/users/shared/_link.html.slim\"\n puts 'Check your app/views/users/shared/_link.html.slim to custom the OAuth links'.colorize(:light_green)\n end",
"def link_to_if_authorized(group,name, options = {}, htm... | [
"0.61997366",
"0.6152511",
"0.61469835",
"0.5912469",
"0.5911688",
"0.59072626",
"0.5889438",
"0.58391273",
"0.5830438",
"0.58051735",
"0.57975733",
"0.5749271",
"0.5747187",
"0.57395995",
"0.5731231",
"0.5728175",
"0.5698559",
"0.56972533",
"0.5693353",
"0.5678595",
"0.56560... | 0.5916298 | 3 |
Action for the OAuth2 callback Authenticate against the API and store the token in the session | def auth
::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,
::Deepblue::LoggingHelper.called_from,
"params=#{params}",
"" ] if browse_everything_controller_debug_verbo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def login\n oauth_callback = url_for(:action => :authorize)\n request_token = @consumer.get_request_token(:oauth_callback => oauth_callback)\n session[:request_token] = request_token\n redirect_to request_token.authorize_url\n end",
"def authorize_callback\n @request_token = OAuth::RequestTok... | [
"0.76030046",
"0.7476495",
"0.74701655",
"0.73537534",
"0.73085004",
"0.7256821",
"0.7247788",
"0.72302926",
"0.72119695",
"0.7206215",
"0.7182202",
"0.7066759",
"0.70441216",
"0.7026597",
"0.70089513",
"0.70070523",
"0.69437265",
"0.69246656",
"0.6904712",
"0.69044733",
"0.6... | 0.70862806 | 11 |
Constructs or accesses an existing session manager Object | def provider_session
::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,
::Deepblue::LoggingHelper.called_from,
"" ] if browse_everything_controller2_debug_verbose
sess = session
prov_name = provider_nam... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_manager_session\n @manager_session = ManagerSession.find(params[:id])\n end",
"def session; @session; end",
"def session; @session; end",
"def session; @session; end",
"def new\n @session = Session.new\n end",
"def session\n Session.instance\n end",
"def session\n @... | [
"0.7058704",
"0.64682066",
"0.64682066",
"0.64682066",
"0.64362866",
"0.6416882",
"0.64166635",
"0.6388123",
"0.63669384",
"0.6362148",
"0.6361351",
"0.6338201",
"0.6325161",
"0.63164383",
"0.63011396",
"0.6298017",
"0.6296611",
"0.6288099",
"0.62799776",
"0.62771606",
"0.627... | 0.0 | -1 |
Clears all authentication tokens, codes, and other data from the Rails session | def reset_provider_session!
::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,
::Deepblue::LoggingHelper.called_from,
"" ] if browse_everything_controller2_debug_verbose
return unless @provider_session
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clear_session\n @session = @login_info = nil\n end",
"def clear_session\n\t\tsession[:email] = nil \n\t\tsession[:player_id] = nil\n\t\tsession[:admin] = nil\n\t\tsession[:login_time] = nil \n\tend",
"def clear_session\n session[:timeout] = nil\n session[:user_name] = nil\n session[:rea... | [
"0.82931113",
"0.8015241",
"0.7938358",
"0.7918532",
"0.78907853",
"0.7888203",
"0.7881173",
"0.78262436",
"0.7767669",
"0.77132666",
"0.7700618",
"0.76823574",
"0.7674298",
"0.76312506",
"0.75951463",
"0.75432104",
"0.75391173",
"0.75175804",
"0.74637115",
"0.74236286",
"0.7... | 0.6635178 | 97 |
Generates the authentication link for a given provider service | def auth_link
::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,
::Deepblue::LoggingHelper.called_from,
"provider=#{provider}",
"" ] if browse_everything_controller_de... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def url_to_social_login( provider_key, on_success = nil )\n provider = Aerogel::Auth.providers[provider_key] || {}\n origin = on_success || params['on_success']\n query_string = origin ? \"?origin=#{origin}\" : ''\n \"/auth/#{provider_key}#{query_string}\"\nend",
"def link_to_authorize_social(provider, optio... | [
"0.6733483",
"0.6376113",
"0.63022906",
"0.63006526",
"0.6060531",
"0.6031617",
"0.6015832",
"0.5974772",
"0.5947384",
"0.5946275",
"0.5946275",
"0.5937879",
"0.5804836",
"0.57930684",
"0.5780917",
"0.57806194",
"0.5752525",
"0.5720303",
"0.57172",
"0.57170904",
"0.5661131",
... | 0.6710767 | 1 |
Accesses the relative path for browsing from the Rails session | def browse_path
::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,
::Deepblue::LoggingHelper.called_from,
"" ] if browse_everything_controller2_debug_verbose
rv = params[:path] || ''
::Deepblue::Logging... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def path\n\t\trequest.original_fullpath\n\tend",
"def get_current_path\n decompress_value(session['app.current_path']).tap do |path|\n session.delete('app.current_path') if path.blank?\n end\n end",
"def set_current_path; end",
"def store_location\n # RAILS 3 request_uri is deprecated, use f... | [
"0.67532766",
"0.6752861",
"0.66989964",
"0.66565233",
"0.662629",
"0.65876514",
"0.653544",
"0.65349597",
"0.6527859",
"0.6527859",
"0.6527859",
"0.6527859",
"0.6527859",
"0.65055364",
"0.64960396",
"0.64763117",
"0.646245",
"0.6456663",
"0.6448399",
"0.6447646",
"0.6441377"... | 0.0 | -1 |
Generate the provider name from the Rails session state value | def provider_name_from_state
::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,
::Deepblue::LoggingHelper.called_from,
"" ] if browse_everything_controller2_debug_verbose
rv = params[:state].to_s.split(/\|/... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def provider_name\n ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n ::Deepblue::LoggingHelper.called_from,\n \"\" ] if browse_everything_controller2_debug_verbose\n rv = params[:provider] || provider_... | [
"0.7005585",
"0.681766",
"0.6656633",
"0.6605691",
"0.65982467",
"0.6559618",
"0.63523644",
"0.6333156",
"0.6117886",
"0.6099084",
"0.6067309",
"0.60398626",
"0.6038134",
"0.6024743",
"0.59745216",
"0.5931792",
"0.5875596",
"0.5859347",
"0.58006084",
"0.57944703",
"0.5774782"... | 0.71150786 | 0 |
Generates the name of the provider using Rails session values | def provider_name
::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,
::Deepblue::LoggingHelper.called_from,
"" ] if browse_everything_controller2_debug_verbose
rv = params[:provider] || provider_name_from_s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name\n @provider[:name]\n end",
"def name\n @provider_name\n end",
"def provider_name\n return @provider_name\n end",
"def provider_name\n object.provider_id.titleize\n end",
"def provider_name(provider)\n Account.provider_name(provider)\n end",... | [
"0.73704576",
"0.72447795",
"0.72155917",
"0.7107809",
"0.7083607",
"0.6801726",
"0.6532036",
"0.65106255",
"0.65067977",
"0.64912987",
"0.64777666",
"0.6420135",
"0.63679403",
"0.62481296",
"0.6196398",
"0.6193221",
"0.61674124",
"0.61647236",
"0.6050679",
"0.604495",
"0.600... | 0.7143134 | 3 |
Retrieve the Driver for each request | def provider
::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,
::Deepblue::LoggingHelper.called_from,
"" ] if browse_everything_controller2_debug_verbose
prov_name = provider_name
rv = browser.provider... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getDriver\n @driver\n end",
"def getDriver\n @driver\n end",
"def drivers\n send :adapters\n end",
"def driver\n @data[\"driver\"]\n end",
"def return_driver\r\n\t\treturn @driver\r\n\tend",
"def get_drivers\n drivers\n end",
"def get_driver\n @@semaphore.synchronize ... | [
"0.7018832",
"0.7018832",
"0.67225456",
"0.66276115",
"0.65891373",
"0.65767276",
"0.6561918",
"0.6543335",
"0.6441362",
"0.6398673",
"0.6315198",
"0.6197248",
"0.60666925",
"0.58834666",
"0.5837882",
"0.5837882",
"0.580077",
"0.57949287",
"0.5791625",
"0.5773513",
"0.5753849... | 0.0 | -1 |
Constructs a browser manager Object Browser state cannot persist between requests to the Controller Hence, a Browser must be reinstantiated for each request using the state provided in the Rails session | def browser
::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,
::Deepblue::LoggingHelper.called_from,
"" ] if browse_everything_controller2_debug_verbose
rv = BrowserFactory.build(session: session, url_opti... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize browser\n @browser = browser\n end",
"def initialize_browser\n if @browser\n @leave_open = true\n else\n @browser = Browser.create(config)\n end\n @browser.goto origin\n bring_to_front_if_appropriate\n @leave_open ||= config[:leave_open]\n end",
... | [
"0.6908861",
"0.6873255",
"0.67845184",
"0.6621515",
"0.6616415",
"0.6506507",
"0.6480909",
"0.6475507",
"0.6456203",
"0.64405525",
"0.64405525",
"0.64280736",
"0.63966626",
"0.6390061",
"0.6369471",
"0.636292",
"0.63608956",
"0.631851",
"0.62183774",
"0.61788845",
"0.6177733... | 0.7066106 | 0 |
Create database and import test data | def create_database
DATA[:accounts].each do |account|
CalendarCoordinator::AccountService.create(data: account).save
end
account = CalendarCoordinator::Account.first
DATA[:calendars].each do |calendar|
account.add_owned_calendar(calendar)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup\n begin\n create_campaign_table_if_not_exist\n seed_data\n rescue Exception => e\n raise \"Database setup failed with error #{e}\"\n ensure\n @connection.close\n end\n end",
"def create_physical_databases\n FileUtils.rm_rf File.expand_path('../fix... | [
"0.71396667",
"0.70055616",
"0.69729465",
"0.6923663",
"0.6892967",
"0.6866736",
"0.67734414",
"0.6753513",
"0.6664905",
"0.66291124",
"0.66291124",
"0.66270643",
"0.66098404",
"0.66094804",
"0.6587013",
"0.65560097",
"0.65447295",
"0.6540283",
"0.6520093",
"0.651364",
"0.647... | 0.6325545 | 39 |
Create a Firewall resource | def insert_firewall(firewall_name, opts = {})
if opts.key?(:network) && !opts[:network].empty?
unless opts[:network].start_with?("http://", "https://", "projects/", "global/")
opts[:network] = "projects/#{@project}/global/networks/#{opts[:network]}"
end
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_create\n msg = {:action => \"create\", :object => \"firewall\", :objectid => self.id, :accountid => self.account_id }.to_yaml\n sendMsg(msg)\n end",
"def create\r\n @firewall = Firewall.new(firewall_params)\r\n\r\n respond_to do |format|\r\n if @firewall.save\r\n format.html { r... | [
"0.71935",
"0.7047602",
"0.68982816",
"0.6476222",
"0.62587196",
"0.6252283",
"0.60155",
"0.6002303",
"0.5945949",
"0.5914015",
"0.5912085",
"0.5799255",
"0.57719284",
"0.57717735",
"0.5771303",
"0.5760266",
"0.57528466",
"0.57296085",
"0.5697978",
"0.56676453",
"0.56563437",... | 0.5766247 | 15 |
Override to only link to logout | def login(params={})
params.merge!({institution: current_institution.code.downcase}) if current_institution
link_to_logout(params) if current_user
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def logout_path\n nil\n end",
"def logout\n end",
"def logout\n end",
"def require_logout\n redirect_to user_path(current_user) if logged_in?\n end",
"def logout\n raise NotImplementedError\n end",
"def logout\n self.logoutlink.click\n end",
"def logout\n \"/users/logout\"\nend",
... | [
"0.7600026",
"0.75239456",
"0.75239456",
"0.74004817",
"0.7391923",
"0.738393",
"0.7330462",
"0.73285383",
"0.7318866",
"0.7318866",
"0.7318866",
"0.7278598",
"0.7245952",
"0.7215512",
"0.7209806",
"0.71784616",
"0.71778286",
"0.7145251",
"0.7140136",
"0.71390545",
"0.7129912... | 0.0 | -1 |
Creates a new state by loading it from disk | def initialize(path, configuration)
@path = path
settings = if File.readable?(path)
YAML.load_file(path)
else
{}
end
area_name = settings[:area]
change_focus(area_name, configuration)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load\n statefile_filename = state_filename\n if File.exist?(statefile_filename) &&\n File.file?(statefile_filename) &&\n File.readable?(statefile_filename)\n $log.debug \"Loading state from #{statefile_filename}\"\n @state = YAML.load_file(statefile_filename)\n el... | [
"0.6786027",
"0.64162207",
"0.6350839",
"0.6349303",
"0.63352734",
"0.62987554",
"0.62870854",
"0.62840205",
"0.6272275",
"0.6254424",
"0.6216738",
"0.62058085",
"0.6204209",
"0.6199343",
"0.6190703",
"0.6127673",
"0.60849315",
"0.60735804",
"0.6031755",
"0.60311246",
"0.6015... | 0.0 | -1 |
Changes the focus. If the specified area doesn't exist, the focus is set to nil. | def change_focus(area_name, configuration)
@focus = if !area_name.nil? && configuration.areas.key?(area_name)
configuration.areas[area_name]
else
# This is a 'null' area, used when the focus is empty or invalid
{
key: 'null',
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def focus\r\n end",
"def set_focus\n\t\t@line.focus\n\tend",
"def focus!\n self.update_attribute :focus, 1\n end",
"def set_focus!(page=nil)\n @focus = page || @agent.current_page\n end",
"def focus\n assert_exists\n driver.execute_script \"return arguments[0].focus()\", @element\n... | [
"0.6216327",
"0.6144144",
"0.60759103",
"0.60112363",
"0.598797",
"0.598797",
"0.5785469",
"0.57838535",
"0.5780164",
"0.57707536",
"0.5766554",
"0.5765866",
"0.57656187",
"0.5753216",
"0.5753216",
"0.5677429",
"0.5653166",
"0.56266284",
"0.560651",
"0.5534993",
"0.5513495",
... | 0.74136126 | 0 |
Persists the current state to disk. It's persisted in the same location it was loaded from. | def persist
settings = {
area: @focus[:key]
}
File.open(@path, 'w') do |file|
file.write settings.to_yaml
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def persist!\n ::File.write(self.path, Marshal.dump(self))\n rescue => e\n puts e.message\n exit\n end",
"def save\n @saved = @state\n end",
"def save\n unless @changed\n $log.debug 'Not saving state, nothing changed'\n return\n end\n statefile_filename... | [
"0.74046737",
"0.7184271",
"0.70549923",
"0.6874632",
"0.67500335",
"0.6629993",
"0.66222775",
"0.66026133",
"0.66026133",
"0.6595115",
"0.6583781",
"0.65833944",
"0.6556913",
"0.65563923",
"0.6552268",
"0.6544225",
"0.6535553",
"0.6508407",
"0.65042657",
"0.6385439",
"0.6352... | 0.632883 | 23 |
Get instance of class :Tree | def get(path, layer)
Tree.new(path,layer)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tree\n Tree.new(self)\n end",
"def tree\n @tree ||= build_tree\n end",
"def tree\r\n @rootNode\r\n end",
"def tree(id = nil)\n res = get_object :tree, id\n return false unless res\n (res.type == :tree) ? res : res.tree\n end",
"def tree(id = nil)\n res = get_object ... | [
"0.8327083",
"0.76336473",
"0.72502303",
"0.7134316",
"0.7134316",
"0.6918187",
"0.68662816",
"0.67988855",
"0.669609",
"0.6684949",
"0.66199374",
"0.65696657",
"0.6562743",
"0.6552368",
"0.6503212",
"0.64992964",
"0.64531726",
"0.6385287",
"0.63366854",
"0.6328619",
"0.63104... | 0.67148924 | 8 |
def evaluate(value) return value if func.nil? return func.call(value) if func.is_a?(Proc) return base_klass.new.send(func, value) if func.is_a?(Symbol) nil end | def validate!(options)
raise ArgumentError, 'from is missing.' if options[:from].nil?
raise ArgumentError, 'to is missing.' if options[:to].nil?
if !(options[:func].nil? || options[:func].is_a?(Symbol) || options[:func].is_a?(Proc))
raise ArgumentError, 'func should be a symbol or proc.'
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def evaluate(value)\n if value.is_a?(Proc)\n value.call\n else\n value\n end\n end",
"def eval(_)\n value\n end",
"def value\n @value || __eval\n end",
"def eval_value(*args)\n eval(*args).value\n end",
"def value\n ... | [
"0.8220281",
"0.7280709",
"0.7136429",
"0.68545806",
"0.6740034",
"0.67179865",
"0.65515125",
"0.6547574",
"0.6524842",
"0.6520356",
"0.64759564",
"0.6448052",
"0.64242333",
"0.63044703",
"0.62917167",
"0.6262939",
"0.62513316",
"0.6195609",
"0.6164574",
"0.6153987",
"0.61025... | 0.0 | -1 |
GET /thing_lists GET /thing_lists.xml | def index
@thing_lists = ThingList.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @thing_lists }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_listings_xml(url)\n @client.get_content(url)\n end",
"def show\n @thing_list = ThingList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @thing_list }\n end\n end",
"def index\n @lists = List.find(:all)\n\n resp... | [
"0.72698224",
"0.70572037",
"0.68461615",
"0.6839099",
"0.68278193",
"0.6782506",
"0.65255326",
"0.6471514",
"0.64582306",
"0.63829166",
"0.6349256",
"0.6322167",
"0.63065225",
"0.62949544",
"0.6281833",
"0.62583345",
"0.624861",
"0.62454",
"0.62454",
"0.6241172",
"0.62228435... | 0.7639916 | 0 |
GET /thing_lists/1 GET /thing_lists/1.xml | def show
@thing_list = ThingList.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @thing_list }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @thing_lists = ThingList.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @thing_lists }\n end\n end",
"def get_listings_xml(url)\n @client.get_content(url)\n end",
"def index\n @list = List.find(params[:list_id])\n @list... | [
"0.74863565",
"0.70508534",
"0.6822762",
"0.66151947",
"0.63719046",
"0.63389814",
"0.63329273",
"0.6294884",
"0.6251464",
"0.6240649",
"0.6232579",
"0.6216956",
"0.6190014",
"0.6172519",
"0.61345196",
"0.61124444",
"0.6054159",
"0.60494417",
"0.6036275",
"0.60203904",
"0.598... | 0.72090244 | 1 |
GET /thing_lists/new GET /thing_lists/new.xml | def new
@thing_list = ThingList.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @thing_list }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @thing_list = ThingList.new(params[:thing_list])\n\n respond_to do |format|\n if @thing_list.save\n format.html { redirect_to(@thing_list, :notice => 'Thing list was successfully created.') }\n format.xml { render :xml => @thing_list, :status => :created, :location => @thing_... | [
"0.70738786",
"0.69431907",
"0.68568313",
"0.68425846",
"0.6670033",
"0.6663164",
"0.6641828",
"0.660811",
"0.66031116",
"0.6593891",
"0.65714276",
"0.6526294",
"0.65072155",
"0.65006596",
"0.6486322",
"0.64858365",
"0.6467122",
"0.6467122",
"0.6467122",
"0.64524746",
"0.6443... | 0.7893943 | 0 |
POST /thing_lists POST /thing_lists.xml | def create
@thing_list = ThingList.new(params[:thing_list])
respond_to do |format|
if @thing_list.save
format.html { redirect_to(@thing_list, :notice => 'Thing list was successfully created.') }
format.xml { render :xml => @thing_list, :status => :created, :location => @thing_list }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_list(params={})\n @obj.post('create-list', @auth.merge(params))\n end",
"def create_list(name)\n data = {\n list: {\n name: name\n }\n }\n rest(\"post\", \"lists\", data)\n end",
"def test_list\n @builder.write_list('http://lancaster.myreadinglists.org/lists/451... | [
"0.64315087",
"0.62885815",
"0.61963826",
"0.6165056",
"0.6011469",
"0.59851515",
"0.59670234",
"0.5912714",
"0.5910632",
"0.5844573",
"0.5833265",
"0.5808707",
"0.5799097",
"0.5772193",
"0.57483196",
"0.56867206",
"0.56751364",
"0.56751364",
"0.56751364",
"0.567236",
"0.5646... | 0.71116775 | 0 |
PUT /thing_lists/1 PUT /thing_lists/1.xml | def update
@thing_list = ThingList.find(params[:id])
respond_to do |format|
if @thing_list.update_attributes(params[:thing_list])
format.html { redirect_to(@thing_list, :notice => 'Thing list was successfully updated.') }
format.xml { head :ok }
else
format.html { render :a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_list(id, list)\n record \"/todos/update_list/#{id}\", :list => list\n end",
"def update_list(list_id, name)\n data = {\n list: {\n name: name\n }\n }\n rest(\"patch\", \"lists/#{list_id}\", data)\n end",
"def update\n @list = List.find(params[:id])\n @show_list =... | [
"0.6562837",
"0.6501752",
"0.6060759",
"0.6036078",
"0.59928894",
"0.5991028",
"0.5991028",
"0.5987053",
"0.5984066",
"0.5979058",
"0.59660405",
"0.5950549",
"0.59364736",
"0.5915257",
"0.586072",
"0.58473",
"0.5812601",
"0.581107",
"0.5803712",
"0.5796264",
"0.5793393",
"0... | 0.7161482 | 0 |
DELETE /thing_lists/1 DELETE /thing_lists/1.xml | def destroy
@thing_list = ThingList.find(params[:id])
@thing_list.destroy
respond_to do |format|
format.html { redirect_to(thing_lists_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def destroy\n @mylist = Mylist.find(params[:id])\n @mylist.destroy\n\n respond_to do |format|\n format.html { redirect_to(mylists_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n ... | [
"0.67220217",
"0.6584671",
"0.6560042",
"0.65550673",
"0.65425354",
"0.6518812",
"0.64724404",
"0.64629596",
"0.6454385",
"0.6406832",
"0.6382186",
"0.6322832",
"0.63213605",
"0.63105035",
"0.62948304",
"0.62757474",
"0.62491995",
"0.62289816",
"0.62278044",
"0.6222373",
"0.6... | 0.7345866 | 0 |
(Optional) Implement this method for automatic retrial of task in case of failures. | def on_error_retry_delay(_exception)
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_autoretries\n group_name = 'retries'\n r = @titan.groups_name_tasks_post(group_name, tasks: [{\n image: 'treeder/error:0.0.2', \n retries_delay: 5,\n max_retries: 2\n }])\n task = wait_for_completion(r.tasks[0])\n assert_equal \"error\", task.status\n p task\n # F... | [
"0.6606792",
"0.6515908",
"0.64976645",
"0.6493705",
"0.6463798",
"0.63997203",
"0.63990074",
"0.6290754",
"0.62581265",
"0.6207101",
"0.61655295",
"0.6133115",
"0.61166155",
"0.61070925",
"0.6098621",
"0.6072597",
"0.60086733",
"0.59885997",
"0.5975733",
"0.59565264",
"0.595... | 0.0 | -1 |
Writes pretty formatted JSON to the specified file and returns the same content as a string. | def to_file(out_file)
File.write(out_file, @json)
@json
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_pretty_json(filename, data)\n File.open(\"data/#{filename}\", 'w') do |f|\n f.write(JSON.pretty_generate(data))\n end\nend",
"def saveJsonFile(jsonFile, prettyP = false)\n open(jsonFile,\"w\") {|ostrm|\n saveJsonStream(ostrm, prettyP) ;\n }\n end",
"def to_file(filename)\n\tdata2writ... | [
"0.79792714",
"0.76311076",
"0.7516597",
"0.74521196",
"0.7417493",
"0.7048524",
"0.6982327",
"0.6944943",
"0.6814311",
"0.67951196",
"0.6790942",
"0.6781316",
"0.67054796",
"0.6697436",
"0.6662546",
"0.66408336",
"0.6599858",
"0.65980995",
"0.6596724",
"0.65768343",
"0.65064... | 0.69941074 | 6 |
Should detect only the first block call. | def call_meeee(number, zumba, &block)
block.call()
block.call
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def block\n true\n end",
"def after_block_boundary?; end",
"def before_block_boundary?; end",
"def blocks() end",
"def block_checker\n block_given?\nend",
"def block?; end",
"def candidate_block(block)\n return unless (my_index = block.parent.blocks.find_index block)\n\n next_blo... | [
"0.6520797",
"0.6497189",
"0.64285624",
"0.6305203",
"0.6275893",
"0.62738794",
"0.62696546",
"0.6268869",
"0.62683284",
"0.6268118",
"0.6262016",
"0.6254821",
"0.6219317",
"0.6212763",
"0.61737376",
"0.61098385",
"0.6099767",
"0.60976714",
"0.6097182",
"0.60752684",
"0.60740... | 0.0 | -1 |
Shouldn't detect the block call since it isn't in the arguments. | def call_meeee(number, zumba)
block.call
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def called_with_block?\n if block_given?\n p \"You called me with a block\"\n end\nend",
"def call(args)\n raise \"#{description} is unavailable because #{@why_unavailable}\" unless @available\n @block.call(args)\n end",
"def were_we_given_a_block?\n\tif block_given?\n\t\t\"WE GOT A BLOCK\"... | [
"0.72696835",
"0.7160824",
"0.70781374",
"0.7051753",
"0.7047931",
"0.7018517",
"0.70178425",
"0.70178425",
"0.6969169",
"0.69652605",
"0.6955958",
"0.69258577",
"0.6916411",
"0.68548983",
"0.68464935",
"0.683775",
"0.6831861",
"0.68308264",
"0.68217564",
"0.681138",
"0.67959... | 0.0 | -1 |
Should detect the block call with arguments. | def call_meeee(number, zumba, &block)
block.call(number)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def try args\n # the argument conditions matched\n @blk.call *args if match? args\n end",
"def block_checker(param) \n [ param , block_given? ]\nend",
"def called_with_block?\n if block_given?\n p \"You called me with a block\"\n end\nend",
"def passed_blockarg\n <<-CODE\n next_int... | [
"0.71775514",
"0.71593094",
"0.7154392",
"0.7096711",
"0.6949157",
"0.6886334",
"0.686393",
"0.6769899",
"0.66989344",
"0.66814375",
"0.66570574",
"0.66344696",
"0.65851444",
"0.65576285",
"0.6556332",
"0.6542815",
"0.65109175",
"0.6500734",
"0.6459821",
"0.64246166",
"0.6421... | 0.0 | -1 |
Pass in the file to be versioned and staged in the tmp document root. | def add(path, path_from_document_root=nil)
full_path = Pathname.new(path).expand_path(root)
path_from_document_root = Pathname.new(path_from_document_root || full_path.relative_path_from(document_root))
relative_dir = path_from_document_root.dirname
md5 = Digest::MD5.file(full_path).hexdigest
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_file \n Grit.debug = true\n contents = params[:contents]\n message = params[:commit_message]\n @node = Node.new(:name => params[:name], :git_repo_id => params[:git_repo_id], :git_repo_path => params[:git_repo_path])\n save_file_to_disk(contents, @node.abspath)\n stage_and_commit_file(@no... | [
"0.5925046",
"0.5710918",
"0.5656934",
"0.5652962",
"0.5627545",
"0.55712336",
"0.55705714",
"0.5501522",
"0.55010736",
"0.5480814",
"0.54642004",
"0.5442158",
"0.54375094",
"0.54286516",
"0.53781605",
"0.5372078",
"0.5351243",
"0.53497475",
"0.53491884",
"0.5293079",
"0.5292... | 0.5081084 | 34 |
Method to return the firmware_revision and environment | def firmware_and_environment
'#{firmware_revision}' + '--' + '#{environment}'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def determine_revision\n # Note the revision number we're running, and a\n # more-informative string containing it.\n number = `git log -1`.split(' ')[1][0...8] rescue '???'\n details = \"#{Rails.env} #{number} #{`hostname -f`.strip}\"\n return number, details\nend",
"def determine_revision\n # Note the re... | [
"0.6792544",
"0.67287815",
"0.66590655",
"0.65141207",
"0.62988406",
"0.6228969",
"0.61668015",
"0.61105543",
"0.607539",
"0.6027702",
"0.5942059",
"0.5942033",
"0.5908103",
"0.58971876",
"0.58841103",
"0.5868253",
"0.5863599",
"0.58587945",
"0.58564734",
"0.58504826",
"0.584... | 0.77012676 | 0 |
methods to organize pie chart data | def genre_count(term)
#count the genres in object.get_genres
genres = Hash.new(0)
object.get_genres(term).each do |genre|
case
when genre.include?("rap")
genres[:rap]+=1
when genre.include?("pop")
genres[:pop]+=1
when genre.include?("country")
genr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pie_chart_data\n response = api_request(:summary, {group_by: 'keywords'})\n results = extract_and_sort_results(response)\n\n total_other = results.drop(4).map {|row| row['total_calls']}.sum\n pie_segments = results.take(4)\n pie_segments << { \"key\" => \"Other\", \"total_calls\" => total_other ... | [
"0.75809807",
"0.685624",
"0.68243134",
"0.6687322",
"0.6686404",
"0.6600526",
"0.65995544",
"0.6569759",
"0.6494022",
"0.6480879",
"0.64785975",
"0.64086026",
"0.6379903",
"0.6374066",
"0.6322691",
"0.6207525",
"0.6160992",
"0.60938144",
"0.60729146",
"0.6068392",
"0.6039254... | 0.0 | -1 |
TODO: Handle closed stations | def update(prices)
data = prices.map do |station|
{
series: 'diesel',
values: { value: cents_10x(station) },
tags: {
station: station.id,
# TODO: Fetch station details that are not part of the price response
# brand: station[:brand],
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stations\n @stations ||= (exact_match? ? parse_station : parse_stations)\n end",
"def stations_status\n Citibikenyc.stations_status\n end",
"def next_station\n if @index + 1 != @stations.size\n @stations[@index + 1]\n else\n 'Это последняя станция'\n end\n end",
"def extra... | [
"0.66032904",
"0.65975094",
"0.6575555",
"0.6474761",
"0.6459115",
"0.6452309",
"0.6385785",
"0.63651645",
"0.6356616",
"0.6351215",
"0.6314038",
"0.62563765",
"0.62474245",
"0.61877376",
"0.61636287",
"0.61556035",
"0.61543477",
"0.6116558",
"0.60907793",
"0.6085033",
"0.607... | 0.0 | -1 |
This method retrieves the requested place (if it exists) and also pulls the reviews associated with the place | def show
@place = Place.find_by(:id => params["id"])
@reviews = Review.where(:place_id => params["id"]).order(id: :desc)
if @place != nil
render "show"
else
redirect_to "/", notice: "Place not found in this app!"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def review\n\t\t@place = Place.find_by(:id => params[\"id\"])\n\n\t\tif @place != nil\n\t\t\tr = Review.new\n\t\t\tr.place_id = params[\"id\"]\n\t\t\tr.title = params['rtitle']\n\t\t\tr.rating = params['rating']\n\t\t\tr.description = params['description']\n\t\t\tr.save\n\t\t\tredirect_to \"/places/#{@place.id}\"\... | [
"0.68892455",
"0.65725183",
"0.6340471",
"0.63196224",
"0.63196224",
"0.6220482",
"0.61928",
"0.6157892",
"0.61565346",
"0.6152885",
"0.60990256",
"0.60896206",
"0.60506696",
"0.6025686",
"0.6019001",
"0.6009577",
"0.5960822",
"0.5946133",
"0.5932143",
"0.58588713",
"0.584113... | 0.6950131 | 0 |
This method is used to direct the user to edit the page | def edit
@place = Place.find_by(:id=> params["id"])
if @place != nil
render "edit"
else
redirect_to "/", notice: "Place not found in this app!"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit\n\t\t@page_name = \" - Edit Show\"\n\tend",
"def edit\n \tredirect_to action: \"show\"\n end",
"def edit\n redirect_to root_url\n end",
"def edit\n redirect_to \"/\"\n end",
"def set_edit_page\n # Definimos el nombre de la página\n @page = \"Editar cuenta\"\n @edit = param... | [
"0.796853",
"0.78865576",
"0.78179777",
"0.7771217",
"0.7732361",
"0.76476246",
"0.7639696",
"0.7617919",
"0.759369",
"0.7567372",
"0.75671476",
"0.75671476",
"0.75671476",
"0.75671476",
"0.75671476",
"0.75671476",
"0.75671476",
"0.75671476",
"0.75671476",
"0.75671476",
"0.75... | 0.0 | -1 |
This method is used to update the page with modifications from edit | def update
p = Place.find_by(:id=> params["id"])
if p != nil
p.title = params['title']
p.photo_url = params['photo_url']
p.admission_price = params['admission_price']
p.description = params['description']
p.save
redirect_to "/"
else
redirect_to "/", notice: "Place not found in this app!"
e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit\n # Clear the page cache for this page... ?\n @page = ComatosePage.find params[:id]\n @root_pages = [fetch_root_page].flatten\n if request.post?\n @page.update_attributes(params[:page])\n @page.updated_on = Time.now\n @page.author = fetch_author_name\n if @page.save\n ... | [
"0.7424102",
"0.7405377",
"0.7185079",
"0.7155808",
"0.7142051",
"0.7142051",
"0.7142051",
"0.7142051",
"0.7142051",
"0.7142051",
"0.7142051",
"0.7142051",
"0.7142051",
"0.7142051",
"0.7142051",
"0.7142051",
"0.7142051",
"0.7142051",
"0.7142051",
"0.7142051",
"0.7142051",
"... | 0.0 | -1 |
This method is used to create a new place and save it to the model | def create
p = Place.new
p.title = params['title']
p.photo_url = params['photo_url']
p.admission_price = params['admission_price']
p.description = params['description']
p.save
redirect_to "/"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @place = Place.new(place_params)\n\n \n @place.save\n \n \n \n end",
"def create\n @place = Place.new(place_params)\n if @place.save\n redirect_to @place, notice: \"Place was successfully created.\"\n else\n render :new, status: :unprocessable_entity\n end\n en... | [
"0.83117986",
"0.781283",
"0.7798641",
"0.76981133",
"0.7688416",
"0.7603155",
"0.7589496",
"0.75878996",
"0.7570808",
"0.7570808",
"0.7570808",
"0.7570808",
"0.75663805",
"0.75663805",
"0.75663805",
"0.75567585",
"0.7554205",
"0.7551326",
"0.75363624",
"0.749827",
"0.7471360... | 0.73795927 | 28 |
This method is used to delete a place and remove it from the model | def delete
@place = Place.find_by(:id => params["id"])
if @place != nil
title = @place.title
@place.delete
redirect_to "/", notice: title + " was deleted!"
else
redirect_to "/", notice: "Place not found in this app!"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @place.destroy\n \n \n end",
"def destroy\n @place.destroy\n head :no_content\n end",
"def destroy\n @place = Place.find(params[:id])\n @place.destroy\n redirect_to places_path\n end",
"def destroy\n @parking_place.destroy\n end",
"def delete\n @place = ... | [
"0.8217203",
"0.7647221",
"0.7461961",
"0.7417108",
"0.7333689",
"0.7313229",
"0.72619283",
"0.7221167",
"0.712703",
"0.70560604",
"0.7017167",
"0.70107245",
"0.698039",
"0.69724625",
"0.696817",
"0.68708974",
"0.68470174",
"0.68400216",
"0.683882",
"0.682125",
"0.68069667",
... | 0.69597036 | 15 |
This method is used to create a new review, save it, and redirect to the appropriate places page | def review
@place = Place.find_by(:id => params["id"])
if @place != nil
r = Review.new
r.place_id = params["id"]
r.title = params['rtitle']
r.rating = params['rating']
r.description = params['description']
r.save
redirect_to "/places/#{@place.id}"
else
redirect_to "/", notice: "Place not ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @review = current_user.reviews.new(review_params)\n\n respond_to do |format|\n if @review.save\n format.html { redirect_to place_path(@review.place), notice: 'Review was successfully created.' }\n else\n format.html { redirect_to root_path }\n end\n end\n end",
... | [
"0.8167581",
"0.79992276",
"0.78091645",
"0.76993024",
"0.75945723",
"0.75811034",
"0.7574495",
"0.7562159",
"0.75073385",
"0.7480885",
"0.7465232",
"0.74461156",
"0.74272424",
"0.73351514",
"0.73167765",
"0.7315766",
"0.7315766",
"0.7306305",
"0.7302669",
"0.72562927",
"0.72... | 0.7483034 | 9 |
Utility method to recover tiles without location | def tile(x, y)
@tiles[x][y]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def verify_tiles\n end",
"def reachable_tiles\n @tiles\n end",
"def map_tile_nocavern(tile)\n (-1..1).all? { |dx| (-1..1).all? { |dy|\n next if not t = tile.offset(dx, dy)\n tm = t.tilemat\n if !t.designation.hidden\n t.designation... | [
"0.6350968",
"0.607095",
"0.59511393",
"0.5919561",
"0.5904333",
"0.58773464",
"0.5843063",
"0.5823475",
"0.581422",
"0.5780669",
"0.57611865",
"0.57546186",
"0.5736534",
"0.5691192",
"0.566606",
"0.5648776",
"0.56320643",
"0.56277955",
"0.5621188",
"0.5621188",
"0.56070685",... | 0.5208349 | 48 |
Utiliti method for show the status of the world | def show(banner)
ViewHelper.show(self, banner)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def status\n \"#{@name}: #{@lives}/3 \"\n end",
"def status\n \"#{@description} #{@status}\"\n end",
"def show_status\r\n puts \"Status for room #{id}:\"\r\n if @contents.empty?\r\n puts \" The room is empty.\"\r\n else\r\n puts \" Contents: #{sorted_contents.join(', ')}\"\r\n e... | [
"0.6935758",
"0.68819803",
"0.67669195",
"0.6695432",
"0.6679189",
"0.6670284",
"0.6670284",
"0.6670284",
"0.6670284",
"0.6667538",
"0.6630416",
"0.6581663",
"0.6578467",
"0.65712136",
"0.6559742",
"0.6548635",
"0.6548635",
"0.6548635",
"0.6548635",
"0.6548635",
"0.6548635",
... | 0.0 | -1 |
Populate the tiles of our world | def populate!()
tile_factory = TileFactory.new()
livingbeing_factory = LivingBeingFactory.new()
@m.times do |y|
@n.times do |x|
# Water vs Ground
location = Location.new(@n, @m, x, y)
wg = tile_factory.create(Utils.generate_random_percentage(), loc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize_tiles\n return if @ready\n\n cur_y, cur_x = @progress.divmod @map.logical_width\n puts \"Game#initialize_tiles: #{@progress}/#{@finished_at} = #{(initialization_percent * 100).floor}%\"\n\n start_t = Time.now\n\n cur_y.upto(@map.logical_height - 1) do |y|\n cur_x.upto(@map.logica... | [
"0.70883524",
"0.69455844",
"0.6873903",
"0.6799685",
"0.67536837",
"0.6752393",
"0.6672542",
"0.6635244",
"0.6613028",
"0.6525036",
"0.6465267",
"0.6423207",
"0.6420671",
"0.64140767",
"0.6408403",
"0.6403979",
"0.63936484",
"0.62993413",
"0.6295558",
"0.6292019",
"0.6289801... | 0.7467202 | 0 |
Computes one turn in our world | def turn!(x, y)
# Policy pesimistis lock... but simple to implement. The best option to solve this problem
# is force the thread wait only in the locks that represents de selected adjacent tile.
@mutex.synchronize do
tile = @tiles[x][y]
location = Location.new(@n, @m, x, y)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_turn\n\t@game.next_meter_reading_turn\n end",
"def turn\n @turn ||= (self.match.moves.index( self ) + 2) / 2\n end",
"def turn\n turns.fetch(0)\n end",
"def turn\n\n # calculates new amount of resources using the production function\n # world.production accepts a resources hash a... | [
"0.6949639",
"0.68583363",
"0.66424",
"0.6448763",
"0.6406872",
"0.63674664",
"0.6352815",
"0.62986755",
"0.6230212",
"0.6228372",
"0.6141559",
"0.6125951",
"0.6078138",
"0.6076578",
"0.60727745",
"0.60705686",
"0.60648364",
"0.60565037",
"0.60418195",
"0.60247904",
"0.602418... | 0.56272084 | 75 |
Computes one sequence in our world | def performs_sequential!()
@m.times do |y|
@n.times do |x|
turn!(x, y)
end
end
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start; @sequence[0]; end",
"def sequence\n @sequence\n end",
"def qseq; @seq1.seq; end",
"def calculate_sequence(*locations)\n sequence = []\n locations.each { |location| add_to_sequence(sequence, locations, location); break if sequence.size == locations.size}\n return sequence\nend",
... | [
"0.68467706",
"0.6356349",
"0.6352145",
"0.6321243",
"0.62568265",
"0.61715955",
"0.61706334",
"0.61244094",
"0.60892314",
"0.60826045",
"0.6023284",
"0.60123235",
"0.6006348",
"0.5994287",
"0.5972593",
"0.5967059",
"0.59524703",
"0.5915918",
"0.5913555",
"0.58847255",
"0.583... | 0.5979176 | 14 |
get all related records (including "subjects") that will be helpful in the audit log | def related_records_for(record, key = nil)
key ||= record.class.to_s.underscore.to_sym
related = [related_records[record.class] || []].flatten
include_self = ((!record.is_a?(ActiveRecord::Base)) || (!related.delete(:self).nil?))
recs = related.map do |r|
related_records_for(record.send(r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_subjects\n Subject.current.where(site_id: all_editable_sites.select(:id))\n end",
"def relation_subjects(record)\n query = ActiveFedora::SolrQueryBuilder.construct_query_for_rel(\n [[:has_model, proxy_class.to_rdf_representation], [:proxyFor, record.id]]\n )\n rows = Act... | [
"0.66638625",
"0.6498397",
"0.63339967",
"0.63100034",
"0.6254276",
"0.62339014",
"0.61297864",
"0.6095512",
"0.6074041",
"0.6015199",
"0.6013829",
"0.6003082",
"0.5995497",
"0.5931694",
"0.59261966",
"0.5890422",
"0.5859141",
"0.5856828",
"0.58207613",
"0.58131075",
"0.58090... | 0.5394507 | 70 |
This method, given a Redis command, will try to guess the right slot. It does not need to return the right slot, as redirection will fix that automatically. | def guess_hashslot(args)
cmd = args[0].to_s.downcase
case cmd
when "incr"
return slot_from_key(args[1])
when "get"
return slot_from_key(args[1])
when "set"
return slot_from_key(args[1])
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def command(command)\n transport.command(command) do |out|\n if out =~ %r{^%}mo || out =~ %r{^Command rejected:}mo\n # strip off the command just sent\n error = out.sub(command, '')\n Puppet.err _(\"Error while executing '%{command}', device returned: %{error}\") % { command: command, ... | [
"0.54683393",
"0.53661424",
"0.52957195",
"0.5292647",
"0.5157496",
"0.5141914",
"0.5134823",
"0.51221484",
"0.51187104",
"0.5117542",
"0.51172405",
"0.51058745",
"0.50779873",
"0.5051344",
"0.5038361",
"0.5036896",
"0.5028776",
"0.4992232",
"0.49740177",
"0.49570543",
"0.495... | 0.6850445 | 0 |
Determines if the information you provided for authentication is valid or not. If there is a problem with the information provided errors will be added to the errors object and this method will return false. | def valid?
errors.clear
self.attempted_record = nil
run_callbacks(:before_validation)
run_callbacks(new_session? ? :before_validation_on_create : :before_validation_on_update)
# eg. `Authlogic::Session::Password.validate_by_password`
# This is when `attempted_record` is... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_http_auth?\n controller.authenticate_with_http_basic do |login, password|\n if !login.blank? && !password.blank?\n send(\"#{login_field}=\", login)\n send(\"#{password_field}=\", password)\n return valid?\n end\n end\n \n fals... | [
"0.73595095",
"0.7125696",
"0.70967555",
"0.7002292",
"0.6895013",
"0.688551",
"0.6850057",
"0.6833672",
"0.6820575",
"0.6763354",
"0.6763354",
"0.6758388",
"0.6719743",
"0.6710743",
"0.6709702",
"0.6704793",
"0.67015123",
"0.66909504",
"0.6661623",
"0.66582125",
"0.663618",
... | 0.6546646 | 30 |
Infinite loop using function objects as arguments | def inf_loop(fps, xzoom, f)
s = Screen.new(W, H)
for x in 1...WI do
y = f.call(x/xzoom.to_f)
s.set(x, y)
s.print()
#s.unset(x, y)
sleep(1.0/fps)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def infinite_loop?; end",
"def loop; end",
"def loop_forever; end",
"def myloop\n while true\n yield\n end\nend",
"def my_loop\n while true\n yield\n end\nend",
"def foreverize\n loop do\n run\n end\n end",
"def endless_loop?; end",
"def block_and_forth_forever(&block)\n... | [
"0.67577827",
"0.65975773",
"0.656452",
"0.64309317",
"0.63567513",
"0.6282937",
"0.62331957",
"0.6196593",
"0.6196593",
"0.6196593",
"0.60601646",
"0.6012362",
"0.60048294",
"0.60048294",
"0.5992807",
"0.59820056",
"0.5968868",
"0.5941691",
"0.5894474",
"0.5884858",
"0.58484... | 0.5318707 | 82 |
Written in one line. | def pretty_print_export_header
text = name
text += " (#{unit})" if unit.present?
text
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def line_feed\n write_raw \"\\n\"\n end",
"def write; end",
"def write; end",
"def write_line data\n _data[:out].puts data\n _data[:out].flush\n end",
"def write(output, indent = T.unsafe(nil)); end",
"def writeline(str)\n writing { write0 str + \"\\r\\n\" }\n end",
"def wr... | [
"0.6986984",
"0.66547793",
"0.66547793",
"0.64596844",
"0.64399517",
"0.6427709",
"0.637716",
"0.63532424",
"0.6341194",
"0.6309453",
"0.6288248",
"0.6277919",
"0.6277919",
"0.6259779",
"0.62161696",
"0.62157685",
"0.6196914",
"0.61922663",
"0.6189732",
"0.6187724",
"0.617195... | 0.0 | -1 |
export interface for scubooks | def scubooks
sections = Section.all
render json: sections
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def odsa_books\n inst_books\n end",
"def interface; end",
"def interface; end",
"def implementation; end",
"def implementation; end",
"def manage_books\n\n end",
"def export\n raise NotImplementedError\n end",
"def raw_shelve\n raise NotImplementedError, _(\"must be implemented in a s... | [
"0.61241263",
"0.6046459",
"0.6046459",
"0.5715336",
"0.5715336",
"0.55085164",
"0.545868",
"0.54346126",
"0.5426204",
"0.5370965",
"0.53700125",
"0.53678817",
"0.53431714",
"0.532637",
"0.5290679",
"0.52562827",
"0.52562827",
"0.52557784",
"0.52532125",
"0.52460045",
"0.5227... | 0.50819856 | 37 |
Closes connection to mysql database | def close()
@db.close()
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close\n @mysql.close\n @mysql = nil\n end",
"def close_connection\n @db.close if @db\n end",
"def closeDBConn()\n if ( !@db_conn.nil? )\n begin\n @db_conn.finish()\n rescue Exception => e\n #ignore it\n end\n end\n end",
"def close\n\n @db.connectio... | [
"0.831086",
"0.8021625",
"0.8006253",
"0.7798156",
"0.7717048",
"0.7717048",
"0.76745635",
"0.75109154",
"0.74971163",
"0.74971163",
"0.74903274",
"0.7477331",
"0.7463798",
"0.7438626",
"0.73439455",
"0.7338773",
"0.73347044",
"0.732869",
"0.7319681",
"0.7275625",
"0.725317",... | 0.7660684 | 7 |
return highest game ID in saved game database | def get_game_id()
res = @db.query("SELECT MAX(GameID) FROM SavedGames;");
row = res.fetch_row
row[0].to_i
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_event_id; $game_map.max_id; end",
"def find_max_id(db, table)\r\n\t# Get list of ids\r\n\tid_array = db.execute(\"SELECT id FROM #{table}\")\r\n\t# Loop through list, checking for the highest number id\r\n\tmax_id = 0\r\n\tid_array.each do |cur_id|\r\n\t\tif cur_id[\"id\"] > max_id\r\n\t\t\tmax_id = cur_... | [
"0.7734999",
"0.70786697",
"0.7032712",
"0.67441225",
"0.6589405",
"0.6555324",
"0.6508029",
"0.6466703",
"0.6434083",
"0.63963073",
"0.637627",
"0.63733554",
"0.63712937",
"0.6351174",
"0.6339136",
"0.6290115",
"0.6280336",
"0.62720424",
"0.625677",
"0.6210986",
"0.6188249",... | 0.87509763 | 0 |
update database with win/lose results | def record_results(winner, loser, is_tie)
if !user_exist?(winner)
add_user(winner)
end
if !user_exist?(loser)
add_user(loser)
end
increment_field(winner, 'Played')
increment_field(loser, 'Played')
if !is_tie
increment_field(winner, 'Wins')
increment_field(loser, 'Lo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_ranking\n result = @core_game.segni_curr_match_sorted\n winner_info = result[0]\n loser_info = result[1]\n @log.info(\"Update the db for user #{winner_info[0]} and #{loser_info[0]}\")\n #winner\n user_name = winner_info[0]\n num_segni = winner_info[1]\n user_id = @players_indb[us... | [
"0.67738056",
"0.67605096",
"0.6647976",
"0.6474124",
"0.63956887",
"0.63094455",
"0.6250952",
"0.6138379",
"0.6123123",
"0.6073689",
"0.60679233",
"0.6023938",
"0.60179496",
"0.600369",
"0.59754366",
"0.593916",
"0.5937069",
"0.5937069",
"0.59364796",
"0.5935538",
"0.5920751... | 0.57533836 | 31 |
return array of user stats | def get_stats()
result = Array.new()
res = @db.query("SELECT * FROM UserStats;")
while row = res.fetch_row do
result.push(UserInfo.new(row[0], row[1], row[2], row[3]))
end
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stats\n users.stats.to_a.map { |row| { name: (row.fullname || row.username).strip, progress: \"#{'+' * row.count } (#{row.count})\" } }\n end",
"def user_stats\n generate 'sufia:user_stats'\n end",
"def users\n result_hash['usr']\n end",
"def stats\n StatsManager::StatsD.time(S... | [
"0.814519",
"0.7591166",
"0.73455465",
"0.725964",
"0.70417583",
"0.69461435",
"0.6844233",
"0.6836755",
"0.6835157",
"0.6828337",
"0.67278886",
"0.67199534",
"0.6674027",
"0.66183287",
"0.65964186",
"0.6543773",
"0.65272564",
"0.6508533",
"0.64919376",
"0.6478844",
"0.646467... | 0.8341364 | 0 |
get number of games played for a particular user | def get_game_count(username)
get_count(username, 'Played')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_total_games_played\n return games.size\n end",
"def get_total_games_played\n\t\treturn games.size\n\tend",
"def played_games\n Game.joins(:players).where(status: Game::STATUS_ENDED, players: { user_id: self.id }).count\n end",
"def games_played\n games.size\n end",
"def games_pl... | [
"0.7609495",
"0.7484377",
"0.7431419",
"0.73876595",
"0.73876595",
"0.71973217",
"0.71867037",
"0.71789557",
"0.71054816",
"0.708578",
"0.6995346",
"0.69943786",
"0.6777309",
"0.6769122",
"0.6730352",
"0.67171234",
"0.66135234",
"0.66036624",
"0.64617634",
"0.6440822",
"0.643... | 0.87496245 | 0 |
get number of wins for a particular user | def get_win_count(username)
get_count(username, 'Wins')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_game_count(username)\n get_count(username, 'Played')\n end",
"def count_wins(player, computer, wins)\n if winner?(player, computer)\n wins[:User] += 1\n elsif winner?(computer, player)\n wins[:Computer] += 1\n end\nend",
"def wins\n determine_stats[:wins]\n end",
"def get_wins(user_i... | [
"0.7629371",
"0.76252437",
"0.7620703",
"0.75989634",
"0.7303781",
"0.71727043",
"0.71457803",
"0.7054644",
"0.70534164",
"0.6995335",
"0.6990164",
"0.693843",
"0.6873827",
"0.6802716",
"0.6695669",
"0.66360146",
"0.66327006",
"0.65873474",
"0.654478",
"0.651638",
"0.6472365"... | 0.8828532 | 0 |
get number of losses for a particular user | def get_loss_count(username)
get_count(username, 'Losses')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def no_of_losses\n @participants&.where(status: 'loss').count\n end",
"def remaining_players\n losses.count { |_, v| v < MAX_LOSS_COUNT}\n end",
"def count_losses\n loss_no = 0\n Battle.where(\"movie_loser\" => self.id).each do\n loss_no += 1 \n end\n return loss_no\n en... | [
"0.70601505",
"0.6994875",
"0.69569063",
"0.6869513",
"0.6833746",
"0.66952765",
"0.6280418",
"0.6246535",
"0.6244607",
"0.6188972",
"0.6171587",
"0.61460954",
"0.6046189",
"0.60235834",
"0.5998148",
"0.5980497",
"0.596946",
"0.5945792",
"0.5943659",
"0.5927526",
"0.59260535"... | 0.8329799 | 0 |
print out stats table, for debugging | def print_stats_table()
res = @db.query("SELECT * FROM UserStats;")
while row = res.fetch_row do
printf "%s %s\n", row[0], row[1], row[2], row[3]
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_stats\n puts \"==================================================\"\n puts \"================= Statistics =====================\"\n puts \"==================================================\"\n \n calc_stats()\n \n puts \"Total Records = #{@total_rec_cnt}\"\n puts \"Well... | [
"0.75690967",
"0.72840905",
"0.7259465",
"0.7122171",
"0.7120976",
"0.6920712",
"0.6873045",
"0.686393",
"0.68591756",
"0.67891985",
"0.6715276",
"0.6711169",
"0.6675503",
"0.6663287",
"0.6643424",
"0.66426075",
"0.6588528",
"0.6569288",
"0.6569288",
"0.6558887",
"0.6552062",... | 0.81203943 | 0 |
save current game state | def save_game(game_id, user1, user2, game_state)
delete_saved_game(game_id)
@db.query("INSERT INTO SavedGames
(GameID, User1, User2, GameType, Board, Turn, LastPlayed)
VALUES (#{game_id},
'#{user1}',
'#{user2}',
'#{game_state.type}',
'#{get_board(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save\n @saved = @state\n end",
"def save_game\n\t\t# If current game was previously saved, delete the old version of current game...\n\t\tif @running_saved_game != nil\n\t\t\tover_write_data\n\t\tend\n\t\t# And add new version of current game to saved data\n\t\tFile.open(@path, 'a+') do |f|\n\t\t\t\t... | [
"0.75073606",
"0.7481804",
"0.7241672",
"0.7135643",
"0.7135643",
"0.71108496",
"0.70749134",
"0.7060557",
"0.7023584",
"0.70187455",
"0.69707346",
"0.6941439",
"0.6884561",
"0.6874603",
"0.6871855",
"0.6868656",
"0.68568814",
"0.68394816",
"0.6821879",
"0.68103063",
"0.68053... | 0.0 | -1 |
removed a saved game that has been completed, or is going to be saved over | def delete_saved_game(game_id)
@db.query("DELETE FROM SavedGames WHERE GameID = #{game_id};")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_game\n\t\tall_saved_games = yaml_load(SAVED_FILENAME)\n\t\tgame_name = get_game_name(all_saved_games, \"delete\")\n\t\treturn if game_name.nil?\n\n\t\tall_saved_games.delete(game_name)\n\t\tyaml_save(SAVED_FILENAME, all_saved_games)\n\t\tmessage_then_enter \"'#{ game_name }' successfully deleted.\"\n\te... | [
"0.73988926",
"0.73244554",
"0.6681876",
"0.6668041",
"0.6661137",
"0.6624152",
"0.6624152",
"0.6615032",
"0.6558093",
"0.651108",
"0.6483797",
"0.64802486",
"0.6450341",
"0.64105546",
"0.6406299",
"0.6356899",
"0.63485575",
"0.62992746",
"0.629466",
"0.6281855",
"0.6277509",... | 0.68475825 | 2 |
return a saved game that will be loaded into the current game | def get_saved_game(game_id)
res = @db.query("SELECT Board, GameType, Turn, LastPlayed FROM SavedGames WHERE GameID = #{game_id};")
row = res.fetch_row
rows, columns = get_col_row(row[0])
gs = GameState.new(2, row[1].to_sym, rows, columns)
set_board(gs, row[0], rows, columns)
coord = row[3].split... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_game_from_save\n #TODO implement game state saving and loading\n end",
"def save_game\n\t\tall_saved_games = yaml_load(SAVED_FILENAME)\n\t\tgame_name = get_save_name(all_saved_games)\n\t\treturn if game_name.nil?\n\n\t\tgame_string = self.to_yaml \n\t\tall_saved_games[game_name] = game_string\n\... | [
"0.8201133",
"0.73872745",
"0.72697324",
"0.7205457",
"0.70542425",
"0.69503814",
"0.69092166",
"0.6907299",
"0.68803936",
"0.6877351",
"0.68708336",
"0.68608665",
"0.685515",
"0.681402",
"0.6805681",
"0.6801814",
"0.68007356",
"0.67594296",
"0.67463046",
"0.67327416",
"0.671... | 0.7195096 | 4 |
get list of saved games for a particular user | def get_saved_games_list(username)
result = Array.new()
res = @db.query("SELECT DISTINCT GameID, User1, User2, GameType FROM SavedGames WHERE User1 = '#{username}' OR User2 = '#{username}';")
while row = res.fetch_row do
result.push(GameListElement.new(row[0], row[1], row[2], row[3]))
end
resu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_games\n @games = Game.where(:user_id=>:id)\n end",
"def index\n @available_games = Game.available(current_user)\n @users_games = Game.users_games(current_user)\n end",
"def index\n @user_games = UserGame.all\n \n end",
"def index\n @games = current_user.games\n end",
"def my_g... | [
"0.76472044",
"0.70129526",
"0.69102556",
"0.6907505",
"0.6729998",
"0.6710046",
"0.65988123",
"0.65972334",
"0.65950733",
"0.6567793",
"0.6543113",
"0.64317226",
"0.64191896",
"0.6383745",
"0.6345526",
"0.63071406",
"0.6231556",
"0.6225734",
"0.61769336",
"0.61475736",
"0.61... | 0.79259527 | 0 |
Given a generic lens key based on the nature of the provided document. | def key_for_doc(doc, default = true)
=begin # TODO: If Blacklight::Document responded to :lens_key
if doc.respond_to?(:lens_key)
doc.lens_key
elsif doc.to_s.include?('__')
Config::Articles.key
elsif doc.is_a?(String)
Config::Catalog.key
elsif default.is_a?(TrueClass)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def type(key); end",
"def type(key); end",
"def search_field_def_for_key(key, lens = nil)\n blacklight_config(lens).search_fields[key.to_s]\n end",
"def flexible_key; end",
"def lens_key\n Blacklight::Lens.key_for(controller_name, false)\n end",
"def coerce_key(*attrs); end",
"def record_ke... | [
"0.60157585",
"0.60157585",
"0.5747225",
"0.56153333",
"0.5569881",
"0.55073273",
"0.5505699",
"0.54929477",
"0.54921573",
"0.5491451",
"0.54060113",
"0.5383643",
"0.5342206",
"0.5294158",
"0.5294158",
"0.5294158",
"0.5278905",
"0.5270763",
"0.5247917",
"0.5244158",
"0.524415... | 0.7002388 | 0 |
Translate a named item to a lens key. If the name is derived from the current controller then the method will attempt to strip off name variations to find the core name (for example, 'video_advanced' will result in 'video'; 'articles_suggest' will result in 'articles', etc). | def key_for_name(name, default = true)
name = name.to_s.strip
result =
case name
when KEY_PATH_HINT
name.underscore
.sub(%r{^.*/([^/]+)$}, '\1') # "devise/catalog" -> "catalog"
.sub(/^config/, '') # "config_video" -> "_video"
.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lens_key\n Blacklight::Lens.key_for(controller_name, false)\n end",
"def key\n name.underscore.tr('/', '_').to_sym\n end",
"def keyName\n e = inherited_from || entity\n \"#{e.model.name}#{e.name}#{name.capitalize_first}\"\n end",
"def build_item_key(item)\n if options[... | [
"0.59484744",
"0.5875323",
"0.5737347",
"0.5612763",
"0.5612763",
"0.5570497",
"0.55385107",
"0.55353045",
"0.54875654",
"0.547815",
"0.5476213",
"0.5472586",
"0.5431053",
"0.5422391",
"0.53975874",
"0.5395243",
"0.53721917",
"0.5371863",
"0.5371863",
"0.5371863",
"0.53651226... | 0.60449785 | 0 |
Return the comment level if the comment works like a markdown headers. | def level
(@line[/^#+/] || '').size
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def comment_level\n @comment_level || SEVERITY_LEVELS.first\n end",
"def header_level\n if self.type != :header\n raise NodeError, \"can't get header_level for non-header\"\n end\n CMark.node_get_header_level(@pointer)\n end",
"def comment?\n @kind == :line_comment || @kind ... | [
"0.744132",
"0.6581329",
"0.59732753",
"0.5929221",
"0.59088266",
"0.5801099",
"0.57893056",
"0.5750243",
"0.5704934",
"0.56422824",
"0.56391054",
"0.5628087",
"0.5608624",
"0.55926013",
"0.55926013",
"0.554785",
"0.53656816",
"0.53392756",
"0.53125733",
"0.53118646",
"0.5286... | 0.5829317 | 5 |
Use callbacks to share common setup or constraints between actions. | def set_active_header
@active_header = ActiveHeader.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 |
Only allow a trusted parameter "white list" through. | def active_header_params
params.require(:active_header).permit(:header_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.7122899",
"0.7054107",
"0.69478",
"0.6902101",
"0.67359334",
"0.67178756",
"0.66889167",
"0.6677724",
"0.6661157",
"0.6555896",
"0.6527207",
"0.64584696",
"0.64517015",
"0.6450208",
"0.644749",
"0.6435074",
"0.6413329",
"0.6413329",
"0.6391818",
"0.6380081",
"0.6380081",
... | 0.0 | -1 |
Tests whether the matcher matches the +rendered+ string. It delegates matching to its matchers. It returns true if all of its matchers return true. It returns false if any of its matchers return false. | def matches?(rendered)
@rendered = rendered
@failures = matchers.reject do |matcher|
matcher.matches?(rendered)
end
@failures.empty?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def matches?(rendered)\n @rendered = rendered\n matches = Nokogiri::HTML::Document.parse(@rendered.to_s).css(@name).select do |element|\n matches_attributes?(element) && matches_content?(element) && matches_criteria?(element)\n end\n matches_count?(matches)\n end",
"def matches?\n ... | [
"0.71269274",
"0.59895116",
"0.59288365",
"0.5878742",
"0.5703834",
"0.55742955",
"0.55563885",
"0.5546239",
"0.55108935",
"0.54901385",
"0.54484975",
"0.54484975",
"0.5421244",
"0.54132324",
"0.53818715",
"0.5345221",
"0.5339412",
"0.52929723",
"0.5287222",
"0.5271399",
"0.5... | 0.7857742 | 0 |
Specifies the inputs' names with more accuracy than the default regular expressions. It delegates to each matcher's +for+ method. But it first appends the matcher's key to the last component of the input's name. | def for(*args)
@for = args.dup
@for.extend(DeepFlattening)
@for = @for.deep_flatten
@components.each do |index, matcher|
delegated_for(index, matcher, @for)
end
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_key_input(name); end",
"def matcher_name=(_arg0); end",
"def name=(val)\n self[:name] = val\n self[:key] = val.parameterize\n end",
"def name_attribute_multi\n %(name=\"#{name_base}[]\")\n end",
"def matcher_name; end",
"def matcher_name; end",
"def build_validator_key(na... | [
"0.5998395",
"0.5989314",
"0.58733255",
"0.5686753",
"0.551959",
"0.551959",
"0.5485558",
"0.5471355",
"0.54234725",
"0.5422968",
"0.5412381",
"0.53884286",
"0.53517735",
"0.5304674",
"0.53017277",
"0.52785975",
"0.526965",
"0.5249143",
"0.5233026",
"0.52273947",
"0.5217574",... | 0.0 | -1 |
Returns the failure messages from each failed matcher. | def failure_message
@failures.map(&:failure_message).join(" and ")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def failures\n ran_tests.select { |t| !t.passed? } + subcontexts.map { |s| s.failures }.flatten\n end",
"def negative_failure_message\n matchers.map(&:negative_failure_message).join(\" and \")\n end",
"def failure_list\n if self.failures.nil?\n return []\n end\n return self.fa... | [
"0.7238562",
"0.72263634",
"0.7033163",
"0.6898726",
"0.6853951",
"0.6757208",
"0.6739025",
"0.6620568",
"0.6604024",
"0.6571936",
"0.6445264",
"0.6434711",
"0.64127296",
"0.6357868",
"0.63243777",
"0.62211657",
"0.6212168",
"0.6172275",
"0.61682004",
"0.61666274",
"0.6159253... | 0.7201902 | 2 |
Returns the negative failure messages from every matcher. | def negative_failure_message
matchers.map(&:negative_failure_message).join(" and ")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def negative_failure_message\n return '' if found.nil?\n return [\n \"expected no tubes matching #{expected.to_s},\",\n \"found #{strategy.pretty_print_tube(found)}\",\n ].join(' ')\n end",
"def negative_failure_message\n return '' if found.nil? || found == []\n\n found_count = found.le... | [
"0.71337223",
"0.6969064",
"0.6804323",
"0.68015724",
"0.6645373",
"0.64680535",
"0.64680535",
"0.64680535",
"0.64338034",
"0.64092726",
"0.63842475",
"0.63768864",
"0.63347584",
"0.63347584",
"0.63309807",
"0.63080156",
"0.6302224",
"0.6261765",
"0.6212073",
"0.6198989",
"0.... | 0.84828776 | 0 |
Returns all the matchers. | def matchers
@components.values
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def matchers\n @matchers ||= []\n end",
"def matchers\n cached_matchers\n end",
"def matchers\n @matchers ||= {}\n end",
"def matchers\n self.class.matchers\n end",
"def matchers\n @known_classes.select {|c| c <= ::Dat::Analysis::Matcher }\n end",
"def matchers\n keywor... | [
"0.8490796",
"0.78731894",
"0.7679311",
"0.7657264",
"0.7588082",
"0.74286896",
"0.6603083",
"0.64873195",
"0.6446322",
"0.63776886",
"0.6369141",
"0.63331485",
"0.61821765",
"0.6170541",
"0.61250883",
"0.6119865",
"0.60941905",
"0.6069812",
"0.60625166",
"0.6013476",
"0.5971... | 0.7299814 | 6 |
=== CUSTOM PROMPT === wrap ANSI codes so Readline knows where the prompt ends | def colour(name, text)
if Pry.color
"\001#{Pry::Helpers::Text.send name, '{text}'}\002".sub '{text}', "\002#{text}\001"
else
text
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def chut\n IRB.conf[:PROMPT][ IRB.conf[:PROMPT_MODE] ][:RETURN].replace('')\nend",
"def prompt(msg)\n\t\tdivider = \"-⚑-\"\n\t\t@width.times { divider << \"--\" }\n\t\tdivider << \"-⚑-\"\n\t\tcenter_this [divider, msg, divider]\n\t\tputs\n\tend",
"def prompt_in\n \" > \".cyan\nend",
"def colored_prompt\n ... | [
"0.7290976",
"0.68934155",
"0.6850654",
"0.67918617",
"0.66587645",
"0.665323",
"0.6589658",
"0.65180755",
"0.65031046",
"0.6475575",
"0.644603",
"0.6380294",
"0.63734174",
"0.6361473",
"0.6354544",
"0.6313899",
"0.6311878",
"0.62675464",
"0.62641484",
"0.6257343",
"0.6247362... | 0.0 | -1 |
runs benchmark comparing an array of methods | def benchmark(methods)
Benchmark.ips do |x|
x.config(time: 5, warmup: 2)
methods.each do |name, method|
x.report(name) { method }
end
x.compare!
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compare_run_times(tests, method1, method2)\n total_time_map_reduce = 0\n total_time_regex = 0\n\n tests.each do |test|\n map_reduce_time = time_method(method1, test[:text])\n regex_time = time_method(method2, test[:text])\n\n total_time_map_reduce += map_reduce_time\n total_time_regex += regex_t... | [
"0.68497735",
"0.6839492",
"0.65129066",
"0.65013057",
"0.64459133",
"0.6257372",
"0.6204137",
"0.6094716",
"0.60757613",
"0.60449016",
"0.6034786",
"0.6026596",
"0.60186255",
"0.60167664",
"0.5997871",
"0.5997871",
"0.5991794",
"0.590556",
"0.58938575",
"0.5845717",
"0.58206... | 0.7401247 | 0 |
This pre setup method for case. It will be executed before each case is executed | def pre_setup_case()
return "pre_setup_for_case"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def before_setup\n # do nothing by default\n end",
"def post_setup\n end",
"def setup(&block)\n before(:each, &block)\n end",
"def before_setup; end",
"def setup\n # noop\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do noth... | [
"0.7351977",
"0.73319113",
"0.71751016",
"0.71415085",
"0.70756525",
"0.70633",
"0.70633",
"0.69665927",
"0.69430804",
"0.69430804",
"0.69430804",
"0.69430804",
"0.69430804",
"0.6932924",
"0.6916278",
"0.6910297",
"0.6910297",
"0.68336433",
"0.68336433",
"0.670153",
"0.670153... | 0.77006507 | 0 |
This tear down method for case. It will be executed after each case is executed | def tear_down_case()
return "tear_down_for_case"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tear_down; end",
"def teardown\n end",
"def teardown\n end",
"def teardown\n end",
"def teardown; end",
"def teardown; end",
"def teardown\r\n end",
"def teardown\n end",
"def teardown\n end",
"def teardown\n end",
"def teardown\n end",
"def teardown\n end... | [
"0.76564926",
"0.7382415",
"0.7382415",
"0.73687375",
"0.7136464",
"0.7136464",
"0.71297634",
"0.7098575",
"0.7098575",
"0.7098575",
"0.7098575",
"0.7098575",
"0.7098575",
"0.7098575",
"0.7098575",
"0.7037573",
"0.7033484",
"0.70314646",
"0.70314646",
"0.7010054",
"0.7010054"... | 0.7799046 | 0 |
This is somke test set definition. This smoke test will only run case_aaaa | def smoke_test()
return ["case_aaaa"]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_cases; end",
"def test_case; end",
"def running_test_case; end",
"def tests; end",
"def tests; end",
"def generate_alltest\n\n end",
"def default_test\r\n end",
"def test_setup\r\n \r\n end",
"def my_tests\n end",
"def test_0_dummy\n\t\tend",
"def testing\n # ..... | [
"0.76395744",
"0.7429829",
"0.7230475",
"0.7110406",
"0.7110406",
"0.693426",
"0.6722648",
"0.6719184",
"0.6679406",
"0.66020584",
"0.6588916",
"0.6580337",
"0.6568641",
"0.6555361",
"0.65523803",
"0.6501103",
"0.64763516",
"0.6473965",
"0.6465139",
"0.64508194",
"0.64508194"... | 0.72481483 | 2 |
This is integration test set definition. This Integration test will run case_aaaa and case_cccc. By default, regression test will also run all test cases. So you don't need to define regression test set | def integration_test()
int =["case_aaaa","case_cccc"]
return int
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_cases; end",
"def test_case; end",
"def generate_alltest\n\n end",
"def running_test_case; end",
"def run\n runner = self\n @test_cases.each do |path|\n next if ENV['TEST_CASE'] && !File.basename(path).match(ENV['TEST_CASE'])\n\n Aws::ModelValidators.load_json(path).tap do |test... | [
"0.7163436",
"0.6623253",
"0.63248307",
"0.6301869",
"0.6250998",
"0.6250933",
"0.6215951",
"0.6168848",
"0.613006",
"0.6108563",
"0.6108563",
"0.61014926",
"0.61014926",
"0.6093175",
"0.6080297",
"0.60785776",
"0.6064429",
"0.6031396",
"0.60223514",
"0.59845185",
"0.59479296... | 0.60581756 | 17 |
The followings are your test cases | def case_aaaa()
puts "case aaaa"
return 003
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_cases; end",
"def tests; end",
"def tests; end",
"def test_truth\n end",
"def test_case; end",
"def test_contains_four_eachface\n assert true == false\n end",
"def running_test_case; end",
"def compare_tests(test_a, test_b); end",
"def compare_tests(test_a, test_b); end",
"def testi... | [
"0.72789776",
"0.6701065",
"0.6701065",
"0.6645665",
"0.65870744",
"0.6553287",
"0.65500635",
"0.6543946",
"0.6543946",
"0.6537198",
"0.6532041",
"0.6479452",
"0.6458194",
"0.6437951",
"0.6428056",
"0.6418839",
"0.63956565",
"0.63884354",
"0.63649964",
"0.6363368",
"0.6341901... | 0.0 | -1 |
To display output immediately on windows using git bash | def sequence(count, start_num)
(1..count).map { |idx| start_num * idx }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prompt_git_branch\n if !is_git?\n return \"\"\n end\n stat = `git status`\n \"[#{stat.split(\"\\n\")[0].split(\" \")[-1]}]\".yellow\nend",
"def stdout; end",
"def stdout; end",
"def stdout; end",
"def stdout; end",
"def stdout; end",
"def stdout; end",
"def prep_screen\n system(\"clear\... | [
"0.6219506",
"0.61200327",
"0.61200327",
"0.61200327",
"0.61200327",
"0.61200327",
"0.61200327",
"0.6103044",
"0.60350794",
"0.59949106",
"0.5973232",
"0.59097284",
"0.58951396",
"0.5886012",
"0.586864",
"0.58550465",
"0.582788",
"0.5807792",
"0.5802978",
"0.5773198",
"0.5745... | 0.0 | -1 |
You may assume that every word contains at least one letter, and that the string will always contain at least one word. You may also assume that each string contains nothing but words and spaces | def swap(str)
arr = str.split(' ')
arr.each { |word| word[0], word[-1] = word[-1], word[0] }
arr.join(' ')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_word?(word, inner_letter, outer_letters)\n word.include?(inner_letter) && word.chars.uniq.all? {|l| @all_letters.chars.include?(l) }\n end",
"def words_from_string(string)\r\n string.downcase.scan(/[\\w']+/)\r\nend",
"def words_from_string(string) \n string.downcase.scan(/[\\w']+/)\nend",
"de... | [
"0.7168935",
"0.70953447",
"0.7032114",
"0.7026357",
"0.700436",
"0.700436",
"0.700436",
"0.69935036",
"0.69230336",
"0.6914677",
"0.68563",
"0.6844635",
"0.6780101",
"0.6760435",
"0.67473865",
"0.67285156",
"0.67064047",
"0.6697567",
"0.66823447",
"0.6680676",
"0.666739",
... | 0.0 | -1 |
The content of the email to send, include the headers and the body. Takes the same argument as error_email. | def error_email_content(exception)
email_opts = self.class.opts[:error_email]
headers = email_opts[:default_headers].call(email_opts, exception)
headers = headers.merge(email_opts[:headers])
headers = headers.map{|k,v| "#{k}: #{v.gsub(/\r?\n/m, "\r\n ")}"}.sort.join("\r\n")
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def error_mail_content(exception)\n _error_mail(exception).to_s\n end",
"def email\n\t\temail_response = EmailHandler.new(email_content).deliver_email\n\t\t\trender text: email_response + \"\\n\"\n\tend",
"def generate_error_email_body(email_type: :user)\n case email_type\n when :user\n ... | [
"0.74390936",
"0.6831965",
"0.65902513",
"0.647665",
"0.6312694",
"0.6251244",
"0.6156424",
"0.60964984",
"0.6095041",
"0.60715836",
"0.6061959",
"0.6058521",
"0.6037089",
"0.60052526",
"0.5980773",
"0.5926859",
"0.58937",
"0.5870241",
"0.58593094",
"0.58211493",
"0.5774238",... | 0.8074065 | 0 |
Game kind: HE, OH, 7S, ST limit: NL, FL, PL | def initialize(title, kind, date = nil)
@title = title
@kind = kind
@date = date
@table_name = nil
@total_pot = 0.0
@rake = 0.0
@blinds_amounts = { :bb => 0, :sb => 0, :ante => 0 }
@max_players = 0
@button_seat = -1
@actions = []
@players = []
@eve... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def game_mode; end",
"def limit_kind\n case @limit\n when 'NL', 'PL' then\n case buy_in\n when 0..1 then 'NanoLmimits'\n when 2..19 then 'MicroLimits'\n when 20..199 then 'LowLimits'\n when 200..999 then 'AverageLimits'\n when 1000..9999... | [
"0.629316",
"0.62298006",
"0.602082",
"0.59958535",
"0.59645396",
"0.59358287",
"0.58761424",
"0.57765466",
"0.5737525",
"0.5621926",
"0.5606601",
"0.56029373",
"0.55759007",
"0.5569241",
"0.5568309",
"0.55632496",
"0.5559832",
"0.55529946",
"0.55529886",
"0.5551514",
"0.5513... | 0.0 | -1 |
Limit kind MicroLimits, LowLimits, AverageLimits, HighLimits, UltrahighLimits | def limit_kind
case @limit
when 'NL', 'PL' then
case buy_in
when 0..1 then 'NanoLmimits'
when 2..19 then 'MicroLimits'
when 20..199 then 'LowLimits'
when 200..999 then 'AverageLimits'
when 1000..9999 then 'HighLimits'
when 1... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_limits\n # code\n end",
"def resource_limits; end",
"def resource_limits; end",
"def limits(limit,bust)\n @limit = limit\n @bust = bust\n end",
"def limits\n return @opts['api_limits']\n end",
"def call\n result[:limits] = plan.limits.map do |limit|\n ... | [
"0.7540085",
"0.6875879",
"0.6875879",
"0.6867888",
"0.6716006",
"0.6639455",
"0.658785",
"0.6422801",
"0.6389735",
"0.63706756",
"0.6366433",
"0.63206214",
"0.62857044",
"0.62834173",
"0.6251392",
"0.6238692",
"0.6227181",
"0.6227181",
"0.6227181",
"0.6227181",
"0.6227181",
... | 0.80232275 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.