query stringlengths 7 6.41k | document stringlengths 12 28.8k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 5 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
POST /connectors POST /connectors.json | def create
@connector = Connector.new(connector_params)
respond_to do |format|
if @connector.save
format.html { redirect_to @connector, notice: 'Connector was successfully created.' }
format.json { render :show, status: :created, location: @connector }
else
format.html { ren... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def connectors_post(opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: ConnectorApi#connectors_post ...\"\n end\n \n # resource path\n path = \"/connectors\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_par... | [
"0.72071993",
"0.6536202",
"0.64566696",
"0.6264675",
"0.6264675",
"0.6186751",
"0.6156597",
"0.5947391",
"0.5875985",
"0.5864708",
"0.57912225",
"0.5660581",
"0.5622291",
"0.551319",
"0.544815",
"0.544497",
"0.54416513",
"0.54387206",
"0.5408554",
"0.5313349",
"0.5309515",
... | 0.6866876 | 1 |
PATCH/PUT /connectors/1 PATCH/PUT /connectors/1.json | def update
respond_to do |format|
if @connector.update(connector_params)
format.html { redirect_to @connector, notice: 'Connector was successfully updated.' }
format.json { render :show, status: :ok, location: @connector }
else
format.html { render :edit }
format.json { r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @url_connector = UrlConnector.find(params[:id])\n\n respond_to do |format|\n if @url_connector.update_attributes(params[:url_connector])\n format.html { redirect_to @url_connector, notice: 'Url connector was successfully updated.' }\n format.json { head :no_content }\n el... | [
"0.64440304",
"0.6419161",
"0.6087523",
"0.5842914",
"0.5832763",
"0.5822447",
"0.58125496",
"0.57372296",
"0.57372296",
"0.573005",
"0.5663236",
"0.56514657",
"0.56498235",
"0.5607775",
"0.55426246",
"0.55426246",
"0.55426246",
"0.55426246",
"0.55341756",
"0.55136704",
"0.54... | 0.6629357 | 0 |
DELETE /connectors/1 DELETE /connectors/1.json | def destroy
@connector.destroy
respond_to do |format|
format.html { redirect_to connectors_url, notice: 'Connector was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @url_connector = UrlConnector.find(params[:id])\n @url_connector.destroy\n\n respond_to do |format|\n format.html { redirect_to url_connectors_url }\n format.json { head :no_content }\n end\n end",
"def connectors_id_delete(id, opts = {})\n if Configuration.debugging\n ... | [
"0.74248743",
"0.6949447",
"0.6913631",
"0.67478865",
"0.6603385",
"0.65876436",
"0.65615493",
"0.6534312",
"0.65047103",
"0.6491685",
"0.64342993",
"0.6429",
"0.63927054",
"0.63927054",
"0.63890564",
"0.63669485",
"0.63462245",
"0.632686",
"0.632686",
"0.6267603",
"0.6237204... | 0.73246616 | 1 |
this could be optimized a tiny bit by only calling superclass.build_kiln but i am le tired | def build_kiln
@build_kiln ||= begin
retval = Hash.new { |hash,key| hash[key] = {} }
klasses = []
klass = self
while klass && klass <= UIView
klasses.unshift(klass)
klass = klass.superclass
end
klasses.each do |klass|
kiln_props = klas... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build; end",
"def build\r\n raise \"Not implemented\"\r\n end",
"def build_internal_nodes\n names.each do |tmp_geo_area|\n recurse_nodes(tmp_geo_area.parent_names, tmp_geo_area)\n end\n end",
"def build\r\n end",
"def build\r\n end",
"def kid_generato... | [
"0.574302",
"0.5575132",
"0.55477244",
"0.5443314",
"0.5443314",
"0.54090065",
"0.54090065",
"0.54090065",
"0.540197",
"0.53540945",
"0.5332637",
"0.53148705",
"0.5303159",
"0.5303159",
"0.5293818",
"0.52841735",
"0.5257594",
"0.5257594",
"0.5257594",
"0.523665",
"0.5226283",... | 0.68418276 | 0 |
Represents the pick of some user and chosen coordinates String player Player picking a coordinate Integer x X coordinate Integer y Y coordinate Exceptions Throws InvalidPickException if player is not valid or if coordinate is out of boundaries | def pick(player, x, y)
fail InvalidPickException.new('Invalid pick') unless valid_pick?(x, y) &&
valid_player?(player)
@game_array[x][y] = PLAYER_MARKS[player.to_sym]
@current_player = if @current_player == :player1
:player2
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_pick?(x, y)\n @game_array[x][y] == nil\n rescue\n fail InvalidPickException.new\n end",
"def player_select_coordinates\n parse_response(get_a_valid_destination)\n end",
"def invalid_user_shot\n \"Please enter a valid coordinate:\\n> \"\n end",
"def player_select_valid_piece_destinat... | [
"0.6357382",
"0.6326895",
"0.59886116",
"0.59806776",
"0.5870088",
"0.5845969",
"0.58289963",
"0.5804468",
"0.5748903",
"0.57455456",
"0.5734839",
"0.55847925",
"0.55539936",
"0.55123425",
"0.55029684",
"0.5471036",
"0.54590845",
"0.5450844",
"0.54354054",
"0.5429965",
"0.539... | 0.6759482 | 0 |
Returns a hash containing the current state of the game, the current user able to do the next pick. If the last pick resulted in a winner the player is returned. | def current_state
result = { current_state: @game_array,
current_player: @current_player }
mark = winner_mark
if mark
result.merge!(winner: player_by_mark(mark).name)
end
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def winner\n store_person = winner_function\n store_combo = won?\n if store_combo == false\n return nil\n elsif store_person == \"X\"\n return \"X\"\n elsif store_person == \"O\"\n return \"O\"\n else\n return false\n end\n end",
"def winner\n case\n when in_ch... | [
"0.6421932",
"0.633145",
"0.6323206",
"0.62890625",
"0.6282806",
"0.6246933",
"0.62404686",
"0.61526936",
"0.6102675",
"0.60710114",
"0.6065517",
"0.6040621",
"0.60367024",
"0.60008126",
"0.59787446",
"0.5972528",
"0.5962908",
"0.5958537",
"0.5951555",
"0.593951",
"0.59276766... | 0.6818288 | 0 |
Gets player based on his mark | def player_by_mark(mark)
player = if PLAYER_MARKS.key(mark) == :player1
@player1
else
@player2
end
player
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_player_by_marker(marker)\r\n @players.find { |player| player.marker == marker }\r\n end",
"def find_player(name)\n for footballer in @players\n return footballer if @players.include?(name)\n end\n end",
"def player\n fetch('football.players')\n end",
"def player_by_nam... | [
"0.7634937",
"0.6722426",
"0.6719397",
"0.6598804",
"0.6564673",
"0.65433323",
"0.65272146",
"0.64467496",
"0.6410199",
"0.64043903",
"0.63966817",
"0.6336073",
"0.63250595",
"0.6319834",
"0.63119364",
"0.6310581",
"0.6298843",
"0.6285358",
"0.62699217",
"0.6233654",
"0.61808... | 0.8405265 | 0 |
Run will validate all inputs; returning on input failures, resolving declared dependencies, then delegate to the handlers call method with its valid inputs and resolved dependencies. Finally it ensure every response is a Response object. | def run(inputs = {}, container = Dry::Container.new)
response = resolve_inputs(inputs)
return response if response.failure?
valid_inputs = response.ok
resolve_dependencies(container)
handler = self.new(container)
result = handler.call(valid_inputs)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def execute!\n validate_request!\n\n build_response!\n end",
"def run\n @response ||= build_response catch_halt{ @handler.run }\n end",
"def run\n response = nil\n @error_procs.each do |error_proc|\n result = nil\n begin\n result = error_proc.call(@exceptio... | [
"0.6401441",
"0.6194236",
"0.5995736",
"0.5994623",
"0.59863234",
"0.5978597",
"0.5978597",
"0.5967187",
"0.554513",
"0.5527933",
"0.54612654",
"0.5442071",
"0.5414022",
"0.5346584",
"0.53319234",
"0.5307139",
"0.5282684",
"0.52293",
"0.52106726",
"0.51954174",
"0.5194625",
... | 0.6806065 | 0 |
Getting the description of the character from the awoiaf Wiki page. | def char_description(character)
html = open("https://awoiaf.westeros.org/index.php/#{character}")
doc = Nokogiri::HTML(html)
if doc.css("div.hatnote:first-child").empty? #|| doc.css(".mw-parser-output .hatnote:nth-child(2)").empty?
description = doc.css(".mw-parser-output > p:nth-child(2)").text.gsub!(/[^A-Za-z ,.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def description\n text_get(7, @id)\n end",
"def description\n page.render_part('description') rescue ''\n end",
"def description\n page.render_part('description') rescue ''\n end",
"def description\n 'Bibita'\n end",
"def description\n info[\"Description\"]\n end",
"def descri... | [
"0.6682648",
"0.66258216",
"0.66258216",
"0.65930414",
"0.6577313",
"0.65666497",
"0.6555209",
"0.6518555",
"0.6463491",
"0.6460054",
"0.6452097",
"0.63818514",
"0.63511336",
"0.6347177",
"0.6339787",
"0.6339787",
"0.631929",
"0.6305004",
"0.6283876",
"0.6206441",
"0.6206441"... | 0.74901074 | 0 |
Checking to see if the character is still alive in the series by scraping the gameofthrones fandom site. | def char_alive?(user, result, character)
html = open("https://gameofthrones.fandom.com/wiki/#{character}")
doc = Nokogiri::HTML(html)
words = doc.css(".pi-item .pi-font a").text.split /(?=[A-Z])/
if words.include?("Alive")
puts "You are still alive!"
else
death = doc.css("div[data-source='Death'] .pi-font").te... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def checks_passed?\n if blacklisted_wifi?\n puts \"Blacklisted Network; Won't go online\"\n return false\n end\n\n # we don't want to spam himawari's site more than once every 10 minutes while running on a schedule\n return false if by_schedule && now.min % 10 != 1\n\n if `fi... | [
"0.57888335",
"0.5785615",
"0.5683552",
"0.5643582",
"0.5605951",
"0.5599776",
"0.5587042",
"0.5574685",
"0.5573726",
"0.557045",
"0.55326396",
"0.5531032",
"0.5499714",
"0.5486322",
"0.5474931",
"0.546841",
"0.5452214",
"0.54515773",
"0.54392844",
"0.5418807",
"0.538266",
... | 0.7387033 | 0 |
GET /dependences GET /dependences.json | def index
@dependences = Dependence.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @dependencies = Dependency.all\n end",
"def dependents(options: {})\n\n Collection.new(parse(client.get(\"/tasks/#{gid}/dependents\", options: options)), type: self.class, client: client)\n end",
"def index\n find_dependencias\n respond_to do |format|\n format.htm... | [
"0.6282729",
"0.60833704",
"0.59941137",
"0.5974323",
"0.59449285",
"0.59378165",
"0.59243274",
"0.5912404",
"0.58951056",
"0.5886674",
"0.5882696",
"0.5862524",
"0.5808963",
"0.580879",
"0.57879496",
"0.57823074",
"0.57759726",
"0.5769148",
"0.5765001",
"0.5753374",
"0.57489... | 0.6963232 | 0 |
DELETE /dependences/1 DELETE /dependences/1.json | def destroy
@dependence.destroy
respond_to do |format|
format.html { redirect_to dependences_url, notice: 'Dependence was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @service_dependance = ServiceDependance.find(params[:id])\n @service_dependance.destroy\n\n respond_to do |format|\n format.html { redirect_to service_dependances_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dependency.destroy\n respond_to do |... | [
"0.7124551",
"0.6988",
"0.69567114",
"0.65602773",
"0.65151024",
"0.64572155",
"0.64501333",
"0.6430625",
"0.6378849",
"0.63708097",
"0.63564163",
"0.6339734",
"0.63146865",
"0.630427",
"0.62699413",
"0.62500405",
"0.6242513",
"0.6217482",
"0.62140095",
"0.62140095",
"0.62140... | 0.71797246 | 0 |
Check active state condition id : skill ID | def skill_state_on(id)
if Skill_State_On[id]['include'] != nil
for i in Skill_State[id]['include']
return true if @state.include?(i)
end
end
if Skill_State[id]['set'] != nil
for i in Skill_State[id]['set']
return false unless @state.include?(i)
end
return true
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def guard_skill_id\r\n return 2\r\n end",
"def won?\n @state.id == 14\n end",
"def skill_sealed?(skill_id)\r\n features_set(FEATURE_SKILL_SEAL).include?(skill_id)\r\n end",
"def check_current_status(id, model)\n status = model.find(id)\n status.is_active? ? \"Deactivate\" : \"Activate\"\n ... | [
"0.63264453",
"0.61316097",
"0.610519",
"0.6038598",
"0.59788126",
"0.5957334",
"0.59418553",
"0.58565557",
"0.58250123",
"0.58119106",
"0.5799493",
"0.5785257",
"0.5733393",
"0.565602",
"0.5633138",
"0.56328356",
"0.5630677",
"0.56222636",
"0.5603394",
"0.5603394",
"0.559539... | 0.68436116 | 0 |
Check inactive state condition id : skill ID | def skill_state_off(id)
if Skill_State_On[id]['include'] != nil
for i in Skill_State[id]['include']
return false if @state.include?(i)
end
end
if Skill_State[id]['set'] != nil
for i in Skill_State[id]['set']
return true unless @state.include?(i)
end
return false... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def skill_state_on(id)\n if Skill_State_On[id]['include'] != nil\n for i in Skill_State[id]['include']\n return true if @state.include?(i)\n end\n end\n if Skill_State[id]['set'] != nil\n for i in Skill_State[id]['set']\n return false unless @state.include?(i)\n end\n ... | [
"0.64750046",
"0.6253902",
"0.6251744",
"0.6189769",
"0.60342383",
"0.6016555",
"0.598371",
"0.59776497",
"0.5961252",
"0.59382606",
"0.59132606",
"0.5871623",
"0.58465505",
"0.58208114",
"0.58152235",
"0.5798878",
"0.5773359",
"0.5750117",
"0.5748668",
"0.57402015",
"0.57293... | 0.66303855 | 0 |
Check active swithc condition id : skill ID | def skill_sw_on(id)
if Skill_Sw_On[id]['include'] != nil
for i in Skill_Sw_On[id]['include']
return true if $game_switches[i]
end
end
if Skill_Sw_On[id]['set'] != nil
for i in Skill_Sw_On[id]['set']
return false unless $game_switches[i]
end
return true
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def guard_skill_id\r\n return 2\r\n end",
"def attack_skill_id\r\n return 1\r\n end",
"def skill_sealed?(skill_id)\r\n features_set(FEATURE_SKILL_SEAL).include?(skill_id)\r\n end",
"def skill_learn?(skill_id)\n return @skills.include?(skill_id)\n end",
"def skill_conditions_met?(skill)\r\n ... | [
"0.65793777",
"0.62702954",
"0.6269415",
"0.61987203",
"0.59673107",
"0.5870263",
"0.5865037",
"0.5766478",
"0.57550406",
"0.5745022",
"0.57190704",
"0.57019264",
"0.56955755",
"0.56949335",
"0.55814713",
"0.5574198",
"0.5557739",
"0.5557588",
"0.5540415",
"0.5540138",
"0.550... | 0.66491723 | 0 |
Check inactive swithc condition id : skill ID | def skill_sw_off(id)
if Skill_Sw_Off[id]['include'] != nil
for i in Skill_Sw_Off[id]['include']
return true if $game_switches[i] == false
end
end
if Skill_Sw_Off[id]['set'] != nil
for i in Skill_Sw_Off[id]['set']
return false unless $game_switches[i] == false
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def skill_sw_on(id)\n if Skill_Sw_On[id]['include'] != nil\n for i in Skill_Sw_On[id]['include']\n return true if $game_switches[i]\n end\n end\n if Skill_Sw_On[id]['set'] != nil\n for i in Skill_Sw_On[id]['set']\n return false unless $game_switches[i]\n end\n return... | [
"0.6513623",
"0.63832504",
"0.62420905",
"0.609231",
"0.60493565",
"0.59335893",
"0.5884933",
"0.58252317",
"0.57625985",
"0.5760204",
"0.5743918",
"0.57438433",
"0.5717868",
"0.57051104",
"0.5704478",
"0.5699243",
"0.5688466",
"0.568029",
"0.5677594",
"0.564959",
"0.562893",... | 0.6482905 | 1 |
Check variable condition id : skill ID | def skill_var(id)
for var in Skill_Var[id]
return true if eval("$game_variables[#{var[0]}] #{var[1]}")
end
return false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def guard_skill_id\r\n return 2\r\n end",
"def skill_learn?(skill_id)\n return @skills.include?(skill_id)\n end",
"def attack_skill_id\r\n return 1\r\n end",
"def garbage_check(id)\n\t return @skills.include?(id)\n\tend",
"def skill_sealed?(skill_id)\r\n features_set(FEATURE_SKILL_SEAL).incl... | [
"0.6881555",
"0.640917",
"0.6312202",
"0.6262951",
"0.6088578",
"0.59307754",
"0.585379",
"0.5847933",
"0.58142793",
"0.5772137",
"0.57471144",
"0.57029593",
"0.5673212",
"0.5632115",
"0.55788827",
"0.55694836",
"0.5538258",
"0.55244523",
"0.5510854",
"0.54874116",
"0.5475369... | 0.70595515 | 0 |
Check HP condition id : skill ID | def skill_hp(id)
if Skill_Hp[id]['integer'] != nil
return true if eval("self.hp #{Skill_Hp[id]['integer']}")
end
if Skill_Hp[id]['rate'] != nil
return true if eval("(self.hp * 100 / self.maxhp) #{Skill_Hp[id]['rate']}")
end
return false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def guard_skill_id\r\n return 2\r\n end",
"def attack_skill_id\r\n return 1\r\n end",
"def skill_effect_scope(skill)\r\n # If skill scope is for ally with 1 or more HP, and your own HP = 0,\r\n # or skill scope is for ally with 0, and your own HP = 1 or more\r\n return (((skill.scope == 3 or s... | [
"0.6695021",
"0.66221845",
"0.6189036",
"0.6120013",
"0.60196644",
"0.6017671",
"0.59831667",
"0.5981362",
"0.5961391",
"0.5950628",
"0.59329593",
"0.58321065",
"0.5809862",
"0.5766323",
"0.5749785",
"0.5739937",
"0.5737943",
"0.57009745",
"0.5615313",
"0.55593765",
"0.555358... | 0.66674626 | 1 |
Check SP condition id : skill ID | def skill_sp(id)
if Skill_Sp[id]['integer'] != nil
return true if eval("self.sp #{Skill_Sp[id]['integer']}")
end
if Skill_Sp[id]['rate'] != nil
return true if eval("(self.sp * 100 / [self.maxsp, 1].max) #{Skill_Sp[id]['rate']}")
end
return false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def guard_skill_id\r\n return 2\r\n end",
"def attack_skill_id\r\n return 1\r\n end",
"def skill_sealed?(skill_id)\r\n features_set(FEATURE_SKILL_SEAL).include?(skill_id)\r\n end",
"def skill_learn?(skill_id)\n return @skills.include?(skill_id)\n end",
"def skill_conditions_met?(skill)\r\n ... | [
"0.67911553",
"0.61708826",
"0.5986448",
"0.59855115",
"0.57566106",
"0.5730158",
"0.57211494",
"0.57147837",
"0.5537426",
"0.5523886",
"0.5490673",
"0.5383702",
"0.5371006",
"0.53443813",
"0.5343247",
"0.53366303",
"0.53366303",
"0.53366303",
"0.53366303",
"0.5327093",
"0.53... | 0.6455193 | 1 |
function that takes the name of a file and loads in the stop words from the file. You could return a list from this function, but a hash might be easier and more efficient. (Why? Hint: think about how you'll use the stop words.) | def load_stopwords_file(file)
stop_words = {}
# Looping through the file and adding each word to a hash table after chomping them
File.open(file, "r").each_line do |line|
stop_words[line.chomp] = 1
end
return stop_words
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_stopwords_file(file)\n f = File.open(file, \"r\")\n stopwordH = {}\n f.each_line do |stopword|\n stopwordH[stopword] = 0\n end\n return stopwordH\nend",
"def get_stopword_list\n list = []\n \n begin\n File.open(\"stopwords.txt\", \"r\") do |file|\n file.each_line { |... | [
"0.7985723",
"0.7368552",
"0.7265786",
"0.72610134",
"0.7143473",
"0.70698315",
"0.70198655",
"0.70190686",
"0.6995447",
"0.68674725",
"0.6856073",
"0.6821236",
"0.67191386",
"0.6646942",
"0.66306347",
"0.6599554",
"0.65971243",
"0.6593243",
"0.6484252",
"0.6483898",
"0.64471... | 0.8104293 | 0 |
function that takes the name of a directory, and returns a list of all the filenames in that directory. | def list_files(dir)
# Getting all the files names in the directory
file_names = Dir[dir + "*"]
return file_names
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_files(dir)\n# Getting all the files names in the directory\n file_names = Dir[dir + \"*\"]\n return file_names\nend",
"def list_files_from_dir(path)\n Dir[path + \"/*/\"].map { |file| File.basename(file) }\n end",
"def list_files_in_directory dir\n files = Dir.glob File.join(dir, \"*\... | [
"0.80133253",
"0.78187627",
"0.7615698",
"0.74597514",
"0.7405495",
"0.73551685",
"0.73167235",
"0.720857",
"0.72048825",
"0.7196617",
"0.71838427",
"0.7153261",
"0.7131933",
"0.7131933",
"0.711905",
"0.7115317",
"0.709747",
"0.70915383",
"0.7090699",
"0.7077409",
"0.7062205"... | 0.80001473 | 1 |
CUSTOM FUNCTIONS parse_html takes the HTML code of a document and removes all the junk from it in order to return the text content on the page | def parse_html(html)
doc = Nokogiri::HTML(html)
# Removing style and script tag content such as Javascript tags in order to get rid of JUNK text
doc.xpath("//script").remove
doc.xpath("//style").remove
begin
text = doc.at('body').inner_text
rescue NoMethodError
puts "NoMethodError"
# puts file_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_html(html)\n cleaned = html.gsub(/\\n/, '').gsub(/>\\s*</m, '><').gsub /\\x00/, ''\n doc = Nokogiri::HTML(cleaned, nil, nil, Nokogiri::XML::ParseOptions.new.default_html.noblanks)\n # remove all 'script' and 'style' nodes from the document\n doc.css('style').each {|n| n.remove }\n ... | [
"0.7567121",
"0.7501477",
"0.7323203",
"0.7323203",
"0.7323203",
"0.7320719",
"0.72193927",
"0.7167748",
"0.71563166",
"0.712633",
"0.70980257",
"0.7087345",
"0.7078445",
"0.70275867",
"0.70126086",
"0.6989239",
"0.69694614",
"0.69290084",
"0.6917967",
"0.68704647",
"0.687046... | 0.779717 | 0 |
remove_punc takes a string containing text and removes all the punctuation from it in order to finally return a list of words/tokens in the text | def remove_punc(text)
word_list = []
# Checking for correct encoding and reencoding the string if necessary
if ! text.valid_encoding?
text = text.encode("UTF-16be", :invalid=>:replace, :replace=>"?").encode('UTF-8')
end
# Removing puctuation
words = text.split(/[ ,;{}`~!@#$%^&*<>.:"'|?\\()_+=\/\[... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_punctuation\n gsub /[[:punct:]]/, ''\n end",
"def remove_punc_and_add_index(word)\n punc_collection = []\n word.chars.each_with_index do |char, index|\n if char.match?(/[',.\\-]/)\n punc_collection << [char, index]\n end\n end\n punc_collection\nend",
"def removeQuot... | [
"0.7275276",
"0.7010769",
"0.70014066",
"0.6991378",
"0.6945574",
"0.6888791",
"0.6863058",
"0.68302804",
"0.6824321",
"0.6711469",
"0.6635981",
"0.6596482",
"0.6585817",
"0.6529046",
"0.6502719",
"0.6480986",
"0.64564526",
"0.6440277",
"0.6398475",
"0.63197947",
"0.63158095"... | 0.7881077 | 0 |
function that takes the name of an html file stored on disk, and returns a list of tokens (words) in that file. | def find_tokens(filename)
html = File.read(filename)
# Parsing the HTML content of the file
parsed_html = parse_html(html)
# Converting the text into a list of tokens after removing punctuation
tokens = remove_punc(parsed_html)
return tokens
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def content_tokens\n filename\n end",
"def get_html path\n array = []\n\n archivo = File.open(path, 'r:UTF-8')\n archivo.each do |l|\n array.push(l.strip)\n\tend\n archivo.close\n\n return array\nend",
"def read_tokens()\n\n # By adding @ to tokens, we're saving it also in the inst... | [
"0.68459404",
"0.6549772",
"0.63205284",
"0.61659604",
"0.6140782",
"0.611115",
"0.593393",
"0.59052026",
"0.5876549",
"0.5870015",
"0.581922",
"0.58115005",
"0.5761115",
"0.57432467",
"0.5727498",
"0.5725638",
"0.56991166",
"0.56788445",
"0.5674697",
"0.5656922",
"0.565593",... | 0.7772613 | 0 |
function that takes a list of tokens, and a list (or hash) of stop words, and returns a new list with all of the stop words removed | def remove_stop_tokens(tokens, stop_words)
# Looping through the list of tokens and removing all the stop words from the list
for i in tokens
if stop_words.member?(i)
tokens.delete(i)
end
end
return tokens
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_stop_words(list)\n list.select {|word| word unless @stopwords.include? word }\n end",
"def remove_stop_words(list)\n if @filter_stop_words\n list.select {|word| !@stopwords.include?(word) }\n else\n list\n end\n end",
"def removeBlackList words\n\t\tblacklist ... | [
"0.7914966",
"0.78771454",
"0.73791426",
"0.7214798",
"0.6798927",
"0.679369",
"0.6740443",
"0.6705289",
"0.66708285",
"0.6579485",
"0.64807314",
"0.6468068",
"0.644567",
"0.6221474",
"0.61697197",
"0.61367285",
"0.6133781",
"0.6107613",
"0.6104376",
"0.60622966",
"0.59931505... | 0.84956324 | 0 |
function that takes a list of tokens, runs a stemmer on each token, and then returns a new list with the stems | def stem_tokens(tokens)
stem_list = []
# Looping through the list and finding the stem word for each word
for word in tokens
word = word[/\w*/]
s = word.stem
stem_list.push(s)
end
return stem_list
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stem_each(ary)\n ary.map { |term| @stemmer.stem(term) }\n end",
"def analyze content\n unless content.respond_to? :split\n raise ArgumentError, \"#{content.class} has no #split\"\n end\n content.split(/\\s/).map {|w| @stemmer.stem w }\n end",
"def stem(word)\n stems = []... | [
"0.7383151",
"0.64352137",
"0.63437766",
"0.6334966",
"0.61397344",
"0.5948949",
"0.58141166",
"0.57272047",
"0.5698453",
"0.56388116",
"0.56388116",
"0.5521572",
"0.55069983",
"0.5476669",
"0.5476669",
"0.54756314",
"0.54756314",
"0.5455903",
"0.5452764",
"0.5451128",
"0.544... | 0.8478054 | 0 |
get_file_detials takes a file name containg the index and returns the data of the file i.e. its name and url in a hash table | def get_file_details(file_name)
fd = {}
# Looping through the file and updating the name and url variable with the new data
# and then finally adding them to the hash table
File.readlines(file_name).each do |line|
data = line.split(" ")
puts data[2]
name = data[0]
url = data[2]
fd[n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_list(hash)\n\nend",
"def file_list(hash)\n\nend",
"def get_file(url); end",
"def getFileAt(position)\n require 'rubygems/package'\n require 'zlib'\n\n @files = []\n f = File.new(@filename)\n tar_extract = Gem::Package::TarReader.new(f)\n tar_extract.rewind # The extract has to be r... | [
"0.63250715",
"0.63250715",
"0.6083411",
"0.60423857",
"0.6021029",
"0.59970486",
"0.59480125",
"0.5919553",
"0.5890083",
"0.58740073",
"0.5828078",
"0.58234",
"0.5817403",
"0.5815732",
"0.5810775",
"0.5804879",
"0.57983625",
"0.57846576",
"0.57770556",
"0.57633716",
"0.57631... | 0.6574043 | 0 |
Iterate over each bigram as an instance of Bigram. | def each
@table.each do |pair, bigram|
yield(bigram)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_bigrams\n bigrams = []\n\n begin\n sql = \"SELECT bigram_id, word1, word2, count FROM Bigrams;\"\n stm = @db.prepare sql\n rs = stm.execute\n\t\t while (row = rs.next) do\n\t\t id, w1, w2, c = *row\n\t\t bigrams << Bigrams.new(w1, w2, :count=>c, :id=>id)\n\t\t ... | [
"0.6529484",
"0.6284862",
"0.58925784",
"0.55048925",
"0.55033886",
"0.5483166",
"0.547559",
"0.54718196",
"0.53993124",
"0.53735304",
"0.53317696",
"0.5310152",
"0.5298479",
"0.52913725",
"0.5232824",
"0.52292114",
"0.522671",
"0.5221761",
"0.5211718",
"0.52070147",
"0.51845... | 0.7697235 | 0 |
Get a list of second words of bigrams matching the given first word. | def matching_bigrams(word1)
list = @index[word1]
list.map{ |word2| @table[[word1,word2]] }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_bigrams(string)\n s = string.downcase\n v = []\n (s.length-1).times{ |i|\n v[i] = s[i...i+2]\n }\n return v\n end",
"def find_bigrams(str, bigrams)\n bigrams.select { |bigram| str.include?(bigram)}\nend",
"def bigramate(word)\n (0..(word.length - 2)).map { |i| word.slice(i,... | [
"0.6646076",
"0.6422299",
"0.6274176",
"0.6154079",
"0.5990007",
"0.5912253",
"0.5783322",
"0.56626743",
"0.56262785",
"0.5603809",
"0.5599354",
"0.5597414",
"0.5511246",
"0.54985464",
"0.5465181",
"0.54564214",
"0.54392844",
"0.5434038",
"0.5416444",
"0.5407946",
"0.5404497"... | 0.73009706 | 0 |
Probability of bigram's occurance in the corpus. | def probability(word1, word2=nil)
bigram = (Bigram === word1 ? word1 : get(word1, word2))
BigDecimal.new(bigram.count) / total #size
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bigram_count()\n\t@corpus.each { |sentence_arr|\n\t prev_word = \"\"\n\t sentence_arr.each { |word|\n\t\tif(prev_word != \"\")\n\t\t @bifreq[prev_word + \" \" + word] += 1\n\t\telse\n\t\t @bifreq[\"PHI \"+word] += 1\n\t\tend \t \t\n\t\tprev_word = word\n\t }\n\t}\n end",
"def probability_o... | [
"0.73970234",
"0.70978487",
"0.6869366",
"0.68479264",
"0.68038917",
"0.6757227",
"0.6729877",
"0.6543553",
"0.64418244",
"0.6419717",
"0.6325295",
"0.63038254",
"0.62904406",
"0.62812465",
"0.62567854",
"0.62363577",
"0.62209475",
"0.6212022",
"0.62085927",
"0.6198233",
"0.6... | 0.7525785 | 0 |
Check if a given word should be considered an acceptable bigram. | def good_bigram?(word)
return false if REJECT_BIGRAMS.include?(word)
return false if word.size < 2
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def legal_word?(word)\n word.length >= 5 && word.length <= 12\n end",
"def is_word?(word)\r\n word = word.downcase\r\n word.each_char { |c| return false if not is_letter?(c) }\r\n !word.empty?\r\n end",
"def isAntigram(comparedWord)\n String.chars.each(comparedWord)\n end",
"def ... | [
"0.68942183",
"0.6835693",
"0.6639274",
"0.66050166",
"0.6576086",
"0.65585697",
"0.6549153",
"0.6535717",
"0.6491158",
"0.64656204",
"0.6460502",
"0.6431451",
"0.6418429",
"0.63703954",
"0.6333066",
"0.6326551",
"0.63233995",
"0.6312795",
"0.63071555",
"0.63029563",
"0.62864... | 0.8423245 | 0 |
Whether a single unique match was found. | def found_unique?
@flags.size == 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def match?\n false\n end",
"def one_result\n matched_combined = @matched_names.ids + @matched_tags.ids +\n @matched_queries.ids + @matched_creator.ids +\n @matched_modifier.ids\n return Asq.find(matched_combined[0]) if matched_combined.length == 1\n fa... | [
"0.6884946",
"0.6743467",
"0.66666603",
"0.6646708",
"0.6625602",
"0.6497823",
"0.6478675",
"0.64102274",
"0.6392388",
"0.6372588",
"0.6372588",
"0.6372588",
"0.6364799",
"0.6364799",
"0.6321445",
"0.6251311",
"0.624624",
"0.61834055",
"0.6135826",
"0.61332864",
"0.6130879",
... | 0.74470997 | 0 |
Whether multiple matches were found (i.e. ambiguous input). | def found_multiple?
@flags.size > 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def match?(given_names); end",
"def matched?( other = nil )\n return full? if other.nil?\n matches.include? other\n end",
"def multiple_search?\n\t\t@attempts > 1\n\tend",
"def multiple_match?\n acknowledgement_detail = locate_element(@original_body, ACKNOWLEDGEMENT_DETAIL_XPATH)\n ... | [
"0.6815673",
"0.6742606",
"0.6726413",
"0.6694285",
"0.6620158",
"0.6601435",
"0.6599376",
"0.6591933",
"0.6579682",
"0.6571317",
"0.64545715",
"0.6444007",
"0.64392936",
"0.6410695",
"0.63753486",
"0.6371641",
"0.6356452",
"0.62906396",
"0.62896234",
"0.628535",
"0.6248091",... | 0.7021841 | 0 |
Return whether the unique match was a hit on the negative (`no`) case, or `nil` if not found or not unique. | def unique_flag_negative?
found_unique? ? @flags.first[2] : nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def matched?\n not @match.equal?(nil)\n end",
"def not_a_match(no)\n if no == false\n @e += 1 \n else nil \n end\n end",
"def found_unique?\n @flags.size == 1\n end",
"def match?\n false\n end",
"def has?(arg)\n !!find(arg)\n end",
"def opt_unique?(s... | [
"0.62677383",
"0.6039822",
"0.58324856",
"0.5694558",
"0.55955046",
"0.5581306",
"0.55777735",
"0.5427091",
"0.5362162",
"0.5359665",
"0.535418",
"0.52943647",
"0.52836794",
"0.5280835",
"0.5261147",
"0.524693",
"0.5243467",
"0.52339256",
"0.5231494",
"0.5227676",
"0.5221369"... | 0.68606395 | 0 |
Returns an array of the matching full flag strings. | def matching_flag_strings
@flags.map do |_flag, flag_syntax, negative|
negative ? flag_syntax.negative_flag : flag_syntax.positive_flag
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flags\n match(/Flags\\s+:\\s+(.+)$/).split rescue []\n end",
"def flags\n match(/Flags\\s+:\\s+(.+)$/).split rescue []\n end",
"def get_flags(*files)\n matches = []\n begin\n files.each do |f|\n file = File.new(f, 'r')\n while (line = file.gets)\n m = line.match(/(^.*=... | [
"0.7122982",
"0.7122982",
"0.6619203",
"0.649433",
"0.60035",
"0.60031104",
"0.59638727",
"0.59401083",
"0.5879179",
"0.5834999",
"0.580956",
"0.5784173",
"0.5769756",
"0.5763876",
"0.5746046",
"0.56907606",
"0.56907606",
"0.5672787",
"0.56592214",
"0.5626698",
"0.5591124",
... | 0.7852811 | 0 |
Whether to include short flags | def include_short?
@include_short
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def short_flag_syntax\n @short_flag_syntax ||= flag_syntax.find_all { |ss| ss.flag_style == :short }\n end",
"def short_flag_exist?(flag)\n flags.select { |f| f.short == flag }.any?\n end",
"def flags\n [long, short].compact\n end",
"def short\n @short\n end",
"def s... | [
"0.75528914",
"0.71379894",
"0.6998727",
"0.6910547",
"0.6707933",
"0.65746135",
"0.65517926",
"0.6400962",
"0.6104154",
"0.6086827",
"0.607279",
"0.60326034",
"0.60232764",
"0.6019786",
"0.5986978",
"0.5936265",
"0.5927495",
"0.5918958",
"0.58649856",
"0.58321273",
"0.582236... | 0.77422243 | 0 |
Whether to include long flags | def include_long?
@include_long
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def long_flag_syntax\n @long_flag_syntax ||= flag_syntax.find_all { |ss| ss.flag_style == :long }\n end",
"def flags\n [long, negative_long, short].compact\n end",
"def flags\n [long, short].compact\n end",
"def test_long\n LinuxFortune.long = true\n assert LinuxFortune.long ... | [
"0.7245966",
"0.6807072",
"0.66324544",
"0.6364071",
"0.63171667",
"0.5945385",
"0.5848188",
"0.5839984",
"0.5796883",
"0.5730932",
"0.57299966",
"0.5712589",
"0.5686601",
"0.5647302",
"0.5640962",
"0.5616302",
"0.5598856",
"0.5587657",
"0.5584795",
"0.55703974",
"0.55698246"... | 0.7485818 | 0 |
An array of Flag::Syntax including only short (single dash) flags. | def short_flag_syntax
@short_flag_syntax ||= flag_syntax.find_all { |ss| ss.flag_style == :short }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dashed_flags *settings_and_names\n settings_and_names.map{|args| dashed_flag_for(*args) }.compact\n end",
"def matching_flag_strings\n @flags.map do |_flag, flag_syntax, negative|\n negative ? flag_syntax.negative_flag : flag_syntax.positive_flag\n end\n end",
"def flags... | [
"0.68840307",
"0.68386215",
"0.67959255",
"0.67517674",
"0.66765195",
"0.63936436",
"0.6337571",
"0.6337571",
"0.61796635",
"0.61295277",
"0.6074809",
"0.60621995",
"0.60491186",
"0.6028328",
"0.59460676",
"0.592124",
"0.5807492",
"0.578661",
"0.5730183",
"0.5730183",
"0.5650... | 0.72635776 | 0 |
An array of Flag::Syntax including only long (doubledash) flags. | def long_flag_syntax
@long_flag_syntax ||= flag_syntax.find_all { |ss| ss.flag_style == :long }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def matching_flag_strings\n @flags.map do |_flag, flag_syntax, negative|\n negative ? flag_syntax.negative_flag : flag_syntax.positive_flag\n end\n end",
"def flags\n return [] unless options[\"flags\"]\n options[\"flags\"].map do |options|\n Flag.new options\n ... | [
"0.6855186",
"0.6651415",
"0.66093004",
"0.64483005",
"0.6438081",
"0.6377476",
"0.6377476",
"0.6302847",
"0.6183081",
"0.61217344",
"0.6095984",
"0.6052623",
"0.6025771",
"0.59871995",
"0.5987073",
"0.59280264",
"0.5864525",
"0.5832347",
"0.5785188",
"0.5709738",
"0.5709738"... | 0.73501015 | 0 |
The list of all effective flags used. | def effective_flags
@effective_flags ||= flag_syntax.flat_map(&:flags)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flags\n FLAGS.find_all{ |k,v| (self.Characteristics & k) != 0 }.map(&:last)\n end",
"def flags\n @flags ||= Set.new([])\n end",
"def flags\n @flags\n end",
"def flags\n @flags\n end",
"def whitelisted_flags\n flags.select &:allowed\n end",
"def flags\n ... | [
"0.71123785",
"0.7064988",
"0.677054",
"0.677054",
"0.6765211",
"0.6728041",
"0.6672082",
"0.65038013",
"0.65038013",
"0.64296246",
"0.6422122",
"0.6413207",
"0.63778657",
"0.63652533",
"0.6348326",
"0.6332696",
"0.6223134",
"0.6174319",
"0.61449414",
"0.6109141",
"0.6054181"... | 0.8119101 | 0 |
Look up the flag by string. Returns an object that indicates whether the given string matched this flag, whether the match was unique, and other pertinent information. | def resolve(str)
resolution = Resolution.new(str)
flag_syntax.each do |fs|
if fs.positive_flag == str
resolution.add!(self, fs, false, true)
elsif fs.negative_flag == str
resolution.add!(self, fs, true, true)
elsif fs.positive_flag.start_with?(str)
resol... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resolve_flag(str)\n result = Flag::Resolution.new(str)\n flags.each do |flag_def|\n result.merge!(flag_def.resolve(str))\n end\n result\n end",
"def find_flag(flag_name, flag_state=nil)\n detect do |flag|\n flag.name == flag_name && (flag_state.nil? || flag.state == ... | [
"0.63491124",
"0.5969406",
"0.5878499",
"0.5723808",
"0.57181597",
"0.5655273",
"0.5599379",
"0.54669285",
"0.5410632",
"0.5387644",
"0.5373354",
"0.5289001",
"0.5254369",
"0.5249525",
"0.5230608",
"0.5222844",
"0.5198079",
"0.51768315",
"0.5154593",
"0.51312244",
"0.51157",
... | 0.61936486 | 1 |
A list of canonical flag syntax strings. | def canonical_syntax_strings
@canonical_syntax_strings ||= flag_syntax.map(&:canonical_str)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def matching_flag_strings\n @flags.map do |_flag, flag_syntax, negative|\n negative ? flag_syntax.negative_flag : flag_syntax.positive_flag\n end\n end",
"def scm_flags\n @flags.join(\" \")\n end",
"def generate_cli_flags\n @flags.map{|pair| pair.join(' ')}.join(' ').... | [
"0.7066683",
"0.69394684",
"0.6563283",
"0.65382355",
"0.65382355",
"0.64747995",
"0.63405854",
"0.63405854",
"0.6232747",
"0.6224358",
"0.61657566",
"0.61653584",
"0.6146682",
"0.6134414",
"0.6115361",
"0.608132",
"0.6080026",
"0.60568523",
"0.6056155",
"0.60351515",
"0.6029... | 0.8113947 | 0 |
Whether this flag is activethat is, it has a nonempty flags list. | def active?
!effective_flags.empty?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flags?\n !@flags.empty?\n end",
"def empty?\n flags.empty?\n end",
"def complete_flags?\n @complete_flags\n end",
"def flagged?\n !(%w(flagged) & flags).empty?\n end",
"def flagged?\n !(%w(flagged) & flags).empty?\n end",
"def is_flagged?\n return se... | [
"0.7888239",
"0.7835755",
"0.7354448",
"0.72545123",
"0.71221733",
"0.682791",
"0.6746434",
"0.6713567",
"0.66841596",
"0.6674785",
"0.66655344",
"0.6608056",
"0.6527947",
"0.6527947",
"0.6504524",
"0.65022874",
"0.64490014",
"0.64420986",
"0.64420986",
"0.64420986",
"0.64022... | 0.81619895 | 0 |
GET /agencyfeed.json Get all the agency feed available | def index
@agencyfeeds = AgencyFeed.all
render :index, status: :ok
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def feeds\n all.select { |c| c.google_id =~ /^feed/ }\n end",
"def index\n @feed_sources = FeedSource.all\n end",
"def index\n @feeds = Feed.all\n end",
"def index\n @feeds = Feed.all\n end",
"def index\n @feeds = Feed.all\n end",
"def index\n @feeds = Feed.all\n end",... | [
"0.65294206",
"0.64663476",
"0.6448661",
"0.6448661",
"0.6448661",
"0.6448661",
"0.6448661",
"0.63958734",
"0.63335794",
"0.62580824",
"0.62517816",
"0.62203056",
"0.6194411",
"0.6180867",
"0.6121181",
"0.6120239",
"0.61178607",
"0.6113262",
"0.610972",
"0.6106641",
"0.610293... | 0.768968 | 0 |
POST /agencyfeed.json Create agency with params | def create
@agencyfeed = AgencyFeed.create! agencyfeed_params
render :show, status: :created
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @agency = Agency.new(agency_params)\n\n if @agency.save\n render json: @agency, status: :created, location: @agency\n else\n render json: @agency.errors, status: :unprocessable_entity\n end\n end",
"def create\n @agency = Agency.new(agency_params)\n\n if @agency.... | [
"0.7524271",
"0.74258316",
"0.7219422",
"0.69869757",
"0.6933055",
"0.6844494",
"0.6835852",
"0.66698694",
"0.6668519",
"0.6613647",
"0.660936",
"0.6579963",
"0.6416047",
"0.64136416",
"0.63984895",
"0.63452095",
"0.6283765",
"0.62245864",
"0.6209959",
"0.61748606",
"0.608486... | 0.7636001 | 0 |
PUT/PATCH agencyfeed.json update the configuration of agency and category | def update
@agencyfeed.update! agencyfeed_params
render :show, status: :ok
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n json_update(category,category_params, Category)\n end",
"def UpdateCategory params = {}\n \n APICall(path: 'categories.json',method: 'PUT',payload: params.to_json)\n \n end",
"def update!(**args)\n @category = args[:category] if args.key?(:category)\n ... | [
"0.65837145",
"0.64573747",
"0.6200794",
"0.6153669",
"0.61454356",
"0.60933644",
"0.6020954",
"0.6004011",
"0.5993255",
"0.5993255",
"0.59900177",
"0.5969397",
"0.59490365",
"0.5918142",
"0.5916518",
"0.59069264",
"0.59056515",
"0.5890757",
"0.5870441",
"0.5852912",
"0.58415... | 0.69128275 | 0 |
GET /agencyfeed/:id/fetch_news.json fetch all the news and update db for a specific agencyfeed. | def fetch_news
@news = News.fetch_and_store_news! @agencyfeed
render template: 'news/list', status: :ok
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch\n ##\n # an array of { category_id: number, news: array }\n @fetched = News.fetch_and_store_news_from_all_agency_feed!\n render :fetch, status: :ok\n end",
"def fetch_data\n rss_provider = RssProvider.find(params[:format])\n unless rss_provider.rss_url.include?(\"indiatvnews... | [
"0.7513578",
"0.68720174",
"0.68716896",
"0.6681916",
"0.6586323",
"0.6517632",
"0.6508943",
"0.6480259",
"0.64605004",
"0.6435497",
"0.6354102",
"0.6225285",
"0.62074596",
"0.61961514",
"0.61918014",
"0.61565053",
"0.61554474",
"0.61537933",
"0.6133251",
"0.6123011",
"0.6104... | 0.81743777 | 0 |
returns "STANDARD_CLAIM_PROCESS", "BDD_PROGRAM", or "FDC_PROGRAM" based off of a few attributes in the evss data | def evss_claims_process_type(form526)
if form526['bddQualified']
return 'BDD_PROGRAM'
elsif form526['standardClaim']
return 'STANDARD_CLAIM_PROCESS'
end
'FDC_PROGRAM'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_system(code)\n return code[2][1][0][1][1][1]\n end",
"def proc_name\n data = read_cpuinfo.match(/model name\\s*:\\s*(.+)/)[1]\n\n return data.strip\n end",
"def getSecurityEvent( event_id )\r\n\r\nputs case event_id\r\nwhen 4608 \r\n return \"Startup\"\r\nwhen 4609 \r\n ... | [
"0.56413835",
"0.5547117",
"0.55038613",
"0.5410344",
"0.54024947",
"0.54024947",
"0.53961504",
"0.5374258",
"0.53301316",
"0.5328355",
"0.52793306",
"0.52515835",
"0.5239102",
"0.52355474",
"0.52233654",
"0.52154016",
"0.52050954",
"0.52020055",
"0.51988494",
"0.5191708",
"0... | 0.7315199 | 0 |
returns either 'Active', 'Reserves' or 'National Guard' based on the service branch | def convert_to_service_component(service_branch)
service_branch = service_branch.downcase
return 'Reserves' if service_branch.include?('reserves')
return 'National Guard' if service_branch.include?('national guard')
'Active'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def branch_of_service\n SERVICE_BRANCHES[branch_of_service_code]\n end",
"def hca_branch_of_service\n HCA_SERVICE_BRANCHES[branch_of_service_code] || 'other'\n end",
"def get_branch \n branch = case @os_svninfo['URL']\n when /trunk/ then \"trunk\"\n when /branches\\/private\... | [
"0.7212287",
"0.7156464",
"0.6361214",
"0.619933",
"0.60374534",
"0.5984082",
"0.5964916",
"0.59352756",
"0.59222555",
"0.59166205",
"0.5904862",
"0.5904862",
"0.5887707",
"0.5879764",
"0.5865017",
"0.584003",
"0.5736813",
"0.5725427",
"0.56407464",
"0.5610731",
"0.5597073",
... | 0.8002263 | 0 |
GET /variant_images GET /variant_images.json | def index
@variant_images = VariantImage.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @variant_images }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_variant\n @product = Spree::Product.find_by :slug => params[:product_id]\n @variant = @product.find_variant_by_options(params[:ids].split(','))\n if @variant\n respond_to do |format|\n format.json {render json: {variant_id: @variant.id, image_ids: @variant.image_ids}}\n end\n e... | [
"0.72741795",
"0.72619855",
"0.7065044",
"0.7058683",
"0.68506616",
"0.6846892",
"0.6785741",
"0.67399204",
"0.66757697",
"0.6659554",
"0.6637402",
"0.6637402",
"0.6605622",
"0.6602113",
"0.6601908",
"0.65993196",
"0.6594103",
"0.65900457",
"0.6587071",
"0.65866446",
"0.65840... | 0.7974657 | 0 |
GET /variant_images/1 GET /variant_images/1.json | def show
@variant_image = VariantImage.find(params[:id])
@variant = @variant_image.variant
respond_to do |format|
format.html # show.html.erb
format.js
format.json { render json: @variant_image }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @variant_images = VariantImage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @variant_images }\n end\n end",
"def get_variant\n @product = Spree::Product.find_by :slug => params[:product_id]\n @variant = @product.find_variant_by_o... | [
"0.7800791",
"0.7155099",
"0.70267254",
"0.69889295",
"0.6987502",
"0.6987502",
"0.67943203",
"0.6752776",
"0.66671115",
"0.66671115",
"0.66671115",
"0.66671115",
"0.6665982",
"0.6631958",
"0.6629154",
"0.6613807",
"0.6606048",
"0.66020113",
"0.66002864",
"0.65955347",
"0.658... | 0.7340816 | 1 |
GET /variant_images/new GET /variant_images/new.json | def new
@variant_image = VariantImage.new
@variant = Variant.find(params[:variant_id])
@variant_image.variant_id = @variant.id
@product = @variant.product
respond_to do |format|
format.html # new.html.erb
format.js # new.js.erb
format.json { render json: @variant_image }
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @image = Image.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @image }\n end\n end",
"def new\n @image = Image.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @image }\n end\n end"... | [
"0.7331562",
"0.7331562",
"0.7331562",
"0.7331562",
"0.7331562",
"0.7331562",
"0.7296701",
"0.72743815",
"0.7256295",
"0.71241343",
"0.71211594",
"0.7083276",
"0.70256233",
"0.70135015",
"0.69998044",
"0.6992117",
"0.6989176",
"0.6984019",
"0.697423",
"0.697423",
"0.6973233",... | 0.7732069 | 0 |
POST /variant_images POST /variant_images.json | def create
params[:variant_image][:image2] = params[:variant_image][:image] # For image replication across two s3 accounts
@variant_image = VariantImage.new(params[:variant_image])
@variant = @variant_image.variant
@product = @variant.product
respond_to do |format|
if @variant_image.save
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @variant_image = VariantImage.new\n @variant = Variant.find(params[:variant_id])\n @variant_image.variant_id = @variant.id\n @product = @variant.product\n\n respond_to do |format|\n format.html # new.html.erb\n format.js # new.js.erb\n format.json { render json: @variant_ima... | [
"0.65627486",
"0.65037525",
"0.6433147",
"0.64226496",
"0.6414937",
"0.6413051",
"0.63565314",
"0.6343757",
"0.6338299",
"0.6301123",
"0.6272123",
"0.62499154",
"0.6220626",
"0.617524",
"0.617524",
"0.61609745",
"0.6148033",
"0.612654",
"0.60613704",
"0.6023113",
"0.6020223",... | 0.72633463 | 0 |
PUT /variant_images/1 PUT /variant_images/1.json | def update
@variant_image = VariantImage.find(params[:id])
respond_to do |format|
if @variant_image.update_attributes(params[:variant_image])
format.html { redirect_to @variant_image, notice: 'Variant image was successfully updated.' }
format.json { head :ok }
else
format.ht... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n params[:variant_image][:image2] = params[:variant_image][:image] # For image replication across two s3 accounts\n @variant_image = VariantImage.new(params[:variant_image])\n\t\t@variant = @variant_image.variant\n @product = @variant.product \n\n respond_to do |format|\n if @variant... | [
"0.685779",
"0.6613139",
"0.65422946",
"0.65422946",
"0.64632577",
"0.6349292",
"0.62428784",
"0.62285197",
"0.6191053",
"0.61872923",
"0.6173035",
"0.6151853",
"0.6150835",
"0.6141934",
"0.61195475",
"0.61183",
"0.6104693",
"0.6087452",
"0.60852027",
"0.6080466",
"0.60675687... | 0.7366369 | 0 |
DELETE /variant_images/1 DELETE /variant_images/1.json | def destroy
@variant_image = VariantImage.find(params[:id])
@variant = @variant_image.variant
@variant_image.destroy
respond_to do |format|
format.html { redirect_to @variant.product }
format.json { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n #Finds selected image\n @image = Image.find(params[:id])\n #destroy image\n @image.destroy\n respond_to do |format|\n format.html { redirect_to '/admin' }\n format.json { head :ok }\n end\n end",
"def destroy\n @image = Image.find(params[:id])\n @image.destroy\n ... | [
"0.71142924",
"0.7108093",
"0.7081805",
"0.7033761",
"0.6999009",
"0.69973284",
"0.69886255",
"0.6982736",
"0.69627947",
"0.6953001",
"0.6953001",
"0.6953001",
"0.6953001",
"0.6953001",
"0.6953001",
"0.6943084",
"0.691388",
"0.69135904",
"0.69056183",
"0.68884355",
"0.688669"... | 0.76444316 | 0 |
Return an absolute path within the working directory. The working directory is determined: value of BREWED_WORKING_DIR env var When run_mode is :daemon, the working dir is state_dir. Otherwise, the current directory. | def working_dir(*path)
if _working_dir.nil?
@_working_dir = ENV['PROJECT_WORKING_DIR']
if _working_dir != nil
@_working_dir = Pathname.new(expand_variables _working_dir)
Dir.chdir _working_dir.to_s
elsif run_mode == :daemon
@_working_dir = state_dir
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def working_dir\n ENV['PWD'] || Dir.pwd\n end",
"def working_dir\n @_working_dir ||= File.expand_path(options['merb-root'] || Dir.pwd)\n end",
"def working_dir\n @_working_dir ||= File.expand_path(options['merb-root'] || Dir.pwd)\n end",
"def working_dir\n @_working_dir ||= File.ex... | [
"0.7353413",
"0.70150113",
"0.70150113",
"0.70150113",
"0.6645491",
"0.6588737",
"0.6554053",
"0.6401448",
"0.6390032",
"0.63678426",
"0.6304743",
"0.6300227",
"0.6096617",
"0.60856885",
"0.6035078",
"0.6032209",
"0.5986275",
"0.5929604",
"0.58885217",
"0.58795285",
"0.587952... | 0.735547 | 0 |
Provide the absolute path to this Brewed's lib dir. | def libdir()
LIBDIR
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lib_path; end",
"def lib_path; end",
"def lib_path; end",
"def _lib_dir\n File.join(get_pref(\"sketchbook.path\"), \"libraries\")\n end",
"def lib_dir\n LIB_DIR\n end",
"def lib_dir\n File.join(root, 'lib')\n end",
"def lib\n File.join(@root, 'lib')\n end",
"def path\n ... | [
"0.7990427",
"0.7990427",
"0.7990427",
"0.79743385",
"0.7927845",
"0.7907323",
"0.77938616",
"0.7615941",
"0.7605704",
"0.7605704",
"0.7589429",
"0.7589429",
"0.7515817",
"0.7508454",
"0.7396474",
"0.73448074",
"0.72190243",
"0.72182333",
"0.7168761",
"0.7134664",
"0.7123414"... | 0.79928905 | 0 |
=============================================================================== Moon phases and Zodiac =============================================================================== Calculates the phase of the moon. 0 New Moon 1 Waxing Crescent 2 First Quarter 3 Waxing Gibbous 4 Full Moon 5 Waning Gibbous 6 Last Quart... | def moonphase(time=nil) # in UTC
time = pbGetTimeNow if !time
transitions = [
1.8456618033125,
5.5369854099375,
9.2283090165625,
12.9196326231875,
16.6109562298125,
20.3022798364375,
23.9936034430625,
27.6849270496875]
yy = time.year-((12-time.mon)/10.0).floor
j = (365.25... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def moonphase(time) # in UTC\n transitions=[\n 1.8456618033125,\n 5.5369854099375,\n 9.2283090165625,\n 12.9196326231875,\n 16.6109562298125,\n 20.3022798364375,\n 23.9936034430625,\n 27.6849270496875]\n yy=time.year-((12-time.mon)/10.0).floor\n j=(365.25*(4712+yy)).floor + (((ti... | [
"0.7135922",
"0.6571321",
"0.60677487",
"0.5964015",
"0.5677756",
"0.56502366",
"0.56364274",
"0.55768466",
"0.550457",
"0.546058",
"0.54316163",
"0.54068017",
"0.53350204",
"0.5332118",
"0.5297813",
"0.52955884",
"0.52828133",
"0.52504575",
"0.52006185",
"0.5193434",
"0.5191... | 0.72937435 | 0 |
Calculates the zodiac sign based on the given month and day: 0 is Aries, 11 is Pisces. Month is 1 if January, and so on. | def zodiac(month,day)
time = [
3,21,4,19, # Aries
4,20,5,20, # Taurus
5,21,6,20, # Gemini
6,21,7,20, # Cancer
7,23,8,22, # Leo
8,23,9,22, # Virgo
9,23,10,22, # Libra
10,23,11,21, # Scorpio
11,22,12,21, # Sagittarius
12,22,1,19, # Capricorn
1,20,2,1... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zodiac(month,day)\n time=[\n 1,1,1,31, # The Apprentice\n 2,1,2,28, # The Companion\n 3,1,3,31, # The Beacon\n 4,1,4,30, # The Savage\n 5,1,5,31, # The Prodigy\n 6,1,6,30, # The Martyr\n 7,1,7,31, # The Maiden\n 8,1,8,31, # The Gladiator\n 9,1,9,30, # The ... | [
"0.7116016",
"0.69404125",
"0.6122316",
"0.6122316",
"0.5967227",
"0.59496856",
"0.5906849",
"0.58797467",
"0.58797467",
"0.5717164",
"0.57162505",
"0.57162505",
"0.5711818",
"0.5694669",
"0.5647944",
"0.5647944",
"0.5646241",
"0.5644094",
"0.56300116",
"0.55933905",
"0.55865... | 0.72031826 | 0 |
Returns the opposite of the given zodiac sign. 0 is Aries, 11 is Pisces. | def zodiacOpposite(sign)
return (sign+6)%12
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def negative\n abs.flip_sign\n end",
"def reverse_sign(an_integer)\n return 0 - an_integer\nend",
"def reverse_sign(an_integer)\n return 0 - an_integer\nend",
"def opposite(number)\r\n return number * (-1)\r\nend",
"def zodiacValue(sign)\n return (sign)%12\nend",
"def opposite(number)\n re... | [
"0.6672668",
"0.6554936",
"0.6554936",
"0.65460396",
"0.6495725",
"0.64195913",
"0.6415371",
"0.641393",
"0.6412919",
"0.6399172",
"0.6367187",
"0.63448083",
"0.62792665",
"0.6030122",
"0.60131836",
"0.59967226",
"0.5991377",
"0.5991377",
"0.59625506",
"0.59225416",
"0.592254... | 0.78304255 | 0 |
unmark a lineitem for refulfillment, chose not to increment the inventory count due possibility that inventory was refreshed, better to err on side of less inventory | def unrefulfill_line_item(line_item_id)
li = Spree::LineItem.find(line_item_id)
li.refulfill = nil
li.save
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decrement_line_item_quantity(line_item_id)\n current_item = line_items.find(line_item_id)\n if current_item.quantity > 1\n current_item.quantity -= 1\n else\n current_item.destroy\n end\n current_item\n end",
"def recover_usage(quantity_to_be_recovered)\n self.used_quantity -= qu... | [
"0.6766502",
"0.6419233",
"0.6412429",
"0.63957113",
"0.6360755",
"0.63582975",
"0.6263182",
"0.6224137",
"0.6224137",
"0.6195032",
"0.61344975",
"0.6108307",
"0.60007876",
"0.59919155",
"0.59865284",
"0.5963751",
"0.59574777",
"0.5936173",
"0.5917403",
"0.59152454",
"0.58837... | 0.6989728 | 0 |
Get the current rockreleasebased prefix for rock packages | def rock_release_prefix(release_name = nil)
release_name ||= rock_release_name
if release_name
pkg_prefix_base + "-#{release_name}-"
else
pkg_prefix_base + "-"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rock_ruby_release_prefix(release_name = nil)\n rock_release_prefix(release_name) + \"ruby-\"\n end",
"def base_prefix\n Starter::Config.read[:prefix]\n end",
"def prefix\n regexify(bothify(fetch('aircraft.prefix')))\n end",
"def prefixed_label(package... | [
"0.72332764",
"0.67280084",
"0.65037626",
"0.63198924",
"0.6315063",
"0.61651635",
"0.6145332",
"0.6092354",
"0.60850835",
"0.6037899",
"0.6021138",
"0.5943009",
"0.5934455",
"0.5924296",
"0.5882006",
"0.585637",
"0.58560544",
"0.58445877",
"0.583058",
"0.5828399",
"0.5825916... | 0.7785496 | 0 |
Get the current rockreleasebased prefix for rock(ruby) packages | def rock_ruby_release_prefix(release_name = nil)
rock_release_prefix(release_name) + "ruby-"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rock_release_prefix(release_name = nil)\n release_name ||= rock_release_name\n if release_name\n pkg_prefix_base + \"-#{release_name}-\"\n else\n pkg_prefix_base + \"-\"\n end\n ... | [
"0.7867165",
"0.66621006",
"0.6451794",
"0.64171606",
"0.6342943",
"0.6251559",
"0.62242717",
"0.620227",
"0.61056644",
"0.6062629",
"0.60344064",
"0.6009978",
"0.5993054",
"0.5879808",
"0.5875949",
"0.5858529",
"0.58561265",
"0.58542913",
"0.5852562",
"0.5847498",
"0.5840739... | 0.76407176 | 1 |
Create a debian package name from a given plain name according to build type, release name and release_prefix setting | def debianize_name(name, build_type: :cmake, with_rock_release_prefix: true, release_name: rock_release_name)
if build_type == :ruby
if with_rock_release_prefix
rock_release_prefix(release_name) + "ruby-" + Deb.canonize(name)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def debian_name(pkginfo, with_rock_release_prefix = true, release_name = nil)\n if pkginfo.kind_of?(String)\n raise ArgumentError, \"method debian_name expects a PackageInfo as argument, got: #{pkginfo.class} '#{pkginfo}'\"\n end\n nam... | [
"0.79385996",
"0.7263144",
"0.71180815",
"0.70813316",
"0.7042691",
"0.7033252",
"0.6661746",
"0.6645817",
"0.66052526",
"0.6584799",
"0.65558136",
"0.64697367",
"0.6411772",
"0.6375237",
"0.6351443",
"0.6343119",
"0.63246405",
"0.6296833",
"0.6254793",
"0.62546974",
"0.62287... | 0.8442843 | 0 |
The debian name of a meta package rock[]meta and the releasename can be avoided by setting with_rock_release_prefix to false | def debian_meta_name(name, with_rock_release_prefix = true)
if with_rock_release_prefix
rock_release_prefix + "meta-" + Deb.canonize(name)
else
pkg_prefix_base + "meta-" + Deb.canonize(name)
end
e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def debian_name(pkg)\n if pkg.kind_of?(Autoproj::RubyPackage)\n debian_ruby_name(pkg.name)\n else\n \"rock-\" + canonize(pkg.name)\n end\n end",
"def rock_release_prefix(release_name = nil)\n release_n... | [
"0.7454804",
"0.7094609",
"0.7083253",
"0.69993",
"0.6651239",
"0.6450723",
"0.6414287",
"0.6396047",
"0.6259771",
"0.62469524",
"0.6229925",
"0.62116957",
"0.6173754",
"0.601299",
"0.6005974",
"0.5993302",
"0.5990938",
"0.58022726",
"0.5784182",
"0.578295",
"0.57796746",
"... | 0.8754608 | 0 |
The debian name of a package [rock]ruby and the releasename prefix can be avoided by setting with_rock_release_prefix to false | def debian_ruby_name(name, with_rock_release_prefix = true, release_name = nil)
if with_rock_release_prefix
rock_ruby_release_prefix(release_name) + Deb.canonize(name)
else
"ruby-" + Deb.canonize(name)
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def debian_name(pkg)\n if pkg.kind_of?(Autoproj::RubyPackage)\n debian_ruby_name(pkg.name)\n else\n \"rock-\" + canonize(pkg.name)\n end\n end",
"def debian_meta_name(name, with_rock_release_prefix = true)\n ... | [
"0.8155794",
"0.7976292",
"0.78808445",
"0.7630828",
"0.7524989",
"0.7514469",
"0.6860359",
"0.68594384",
"0.6740509",
"0.671844",
"0.66456854",
"0.65610325",
"0.648769",
"0.6372021",
"0.63600284",
"0.6351584",
"0.63399094",
"0.6310774",
"0.63089454",
"0.6305904",
"0.629034",... | 0.82506204 | 0 |
Commit changes of a debian package using dpkgsource commit in a given directory (or the current one by default) | def dpkg_commit_changes(patch_name, directory = Dir.pwd,
prefix: "apaka-",
logfile: nil,
include_removal: false
)
Dir.chdir(directory) do
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dpkg_commit_changes(patch_name, directory = Dir.pwd)\n Dir.chdir(directory) do\n Packager.info (\"commit changes to debian pkg: #{patch_name}\")\n # Since dpkg-source will open an editor we have to\n # take this approach to make it pass di... | [
"0.7835676",
"0.64839965",
"0.5969037",
"0.5942226",
"0.5895876",
"0.58421993",
"0.5836047",
"0.5763407",
"0.57430965",
"0.57420176",
"0.56336474",
"0.55841255",
"0.5577395",
"0.55551475",
"0.55478275",
"0.5509306",
"0.54801506",
"0.54568374",
"0.54221076",
"0.53568935",
"0.5... | 0.7725159 | 1 |
Generate the debian/ subfolder cindlugin control/rules/install files to prepare the debian package build instructions | def generate_debian_dir(pkginfo, dir, options)
options, unknown_options = Kernel.filter_options options,
:distribution => nil,
:override_existing => true,
:patch_dir => nil
distribution = options[:distributi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def install\n run \"bundle exec backup generate:config --config-path=config/backup\" unless File.exists?(\"config/backup/config.rb\")\n template \"general.rb\", \"config/backup/models/general.rb\"\n if File.exists? \".env\"\n append_file \".env\" do\n File.read(F... | [
"0.63612086",
"0.62468463",
"0.62115836",
"0.619243",
"0.6188494",
"0.61588025",
"0.6139201",
"0.6111842",
"0.6008117",
"0.60080624",
"0.60006094",
"0.59659886",
"0.59646237",
"0.5957808",
"0.5957808",
"0.5948403",
"0.59406453",
"0.59402007",
"0.5930946",
"0.59274274",
"0.592... | 0.62992585 | 1 |
Generate the debian_dir for a meta package i.e. representing a package set or a full release return [String] the main packages directory | def generate_debian_dir_meta(name, depends, base_dir: Dir.pwd, version: "0.1", distribution: nil)
existing_debian_dir = File.join("#{name}-#{version}","debian-meta")
template_dir =
if File.directory?(existing_debian_dir)
existin... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_debian_dir(pkginfo, dir, options)\n options, unknown_options = Kernel.filter_options options,\n :distribution => nil,\n :override_existing => true,\n :patch_dir => nil\n\n distribution = options[... | [
"0.7038908",
"0.6894775",
"0.6833736",
"0.681512",
"0.6646762",
"0.6568039",
"0.6338617",
"0.63289803",
"0.62737525",
"0.62679255",
"0.6170336",
"0.61601603",
"0.6086764",
"0.5999166",
"0.59521484",
"0.5935174",
"0.5926287",
"0.5916547",
"0.589468",
"0.5887863",
"0.58775705",... | 0.7265215 | 0 |
A tar gzip version that reproduces same checksums on the same day when file content does not change Required to package orig.tar.gz | def tar_gzip(archive, tarfile, pkg_time, distribution = nil,
logfile: nil)
# Make sure no distribution information leaks into the package
if distribution and archive =~ /~#{distribution}/
archive_plain_name = archive.gsub(/~#{d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tar_gz_file\n \"#{package_name}.tar.gz\"\n end",
"def get_gzipped_backup\n tar_file = get_tempfile\n safe_run \"tar -czf #{tar_file} #{tar_dir}\"\n tar_file\n end",
"def compress_source_tgz(path)\n tarfile = Tempfile.create([\"vagrant\", \".tar\"])\n tarfile.close\n t... | [
"0.6814556",
"0.6727206",
"0.6657132",
"0.6571898",
"0.6375211",
"0.63011515",
"0.6265729",
"0.62573904",
"0.6230874",
"0.6166431",
"0.6116192",
"0.6047838",
"0.6046607",
"0.60226125",
"0.602238",
"0.6006378",
"0.5954265",
"0.5954103",
"0.59446114",
"0.5941396",
"0.59183174",... | 0.72869587 | 0 |
Update the debian directory with overlay and env.sh/env.yml | def update_debian_dir(pkginfo, options)
# Generate the debian directory
generate_debian_dir(pkginfo, pkginfo.srcdir, options)
if options[:patch_dir] && File.exist?(options[:patch_dir])
if patch_pkg_dir(pkginfo.name, options[:patch_dir]... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup debian_repository\n write_config debian_repository\n restart\n end",
"def etc_update \n announcing 'Running etc-update' do\n system(\"chroot #{$chrootdir} /scripts/run.sh update_configs\")\n end\n send_to_state('build', 'etc_update')\n end",
"def apt_update(vm)\n... | [
"0.721814",
"0.6581492",
"0.6412914",
"0.62594265",
"0.6220686",
"0.61962616",
"0.60835385",
"0.59578365",
"0.5928997",
"0.58600885",
"0.58563536",
"0.57297826",
"0.56680995",
"0.56155807",
"0.5538033",
"0.55320096",
"0.550211",
"0.5484689",
"0.54720473",
"0.545635",
"0.54522... | 0.7720927 | 0 |
Install package name, where pkg is the debian package name | def install(pkg_name)
begin
pkg_build_dir = packaging_dir(pkg_name)
filepath = Dir.glob("#{pkg_build_dir}/*.deb")
if filepath.size < 1
raise RuntimeError, "No debian file found for #{pkg_name} in #{pk... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def install_package host, package_name\n host.install_package package_name\n end",
"def install(pkg)\n package pkg do\n action :install\n end\nend",
"def install(packagename, force=false)\n\t\t\t\traise(InstallError, \"Automated package installation is not implemented on OpenBSD\")\n\t\t\tend"... | [
"0.7270667",
"0.7244659",
"0.7169353",
"0.70323354",
"0.7023716",
"0.6977101",
"0.6951155",
"0.6922259",
"0.6880965",
"0.68577975",
"0.684019",
"0.6804202",
"0.6784884",
"0.67558724",
"0.6749211",
"0.6739366",
"0.67260814",
"0.67077416",
"0.67010355",
"0.6678488",
"0.6654429"... | 0.7763115 | 0 |
Compute the ruby arch setup for passing through sed escaping is required for using with file rendering no escaping is required | def ruby_arch_setup(do_escape = false)
Packager.info "Creating ruby env setup"
if do_escape
setup = Regexp.escape("arch=$(shell gcc -print-multiarch)\n")
# Extract the default ruby version to build for on that platform
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shell_ruby_platform\n `ruby -rrbconfig -e \"puts RbConfig::CONFIG['sitearchdir']\"`\n end",
"def archs_for_command cmd\n cmd = cmd.to_s # If we were passed a Pathname, turn it into a string.\n cmd = `/usr/bin/which #{cmd}` unless Pathname.new(cmd).absolute?\n cmd.gsub! ' ', '\\\\ ' # Escape spaces in... | [
"0.5715107",
"0.5702827",
"0.5696714",
"0.560849",
"0.533406",
"0.5309851",
"0.5295959",
"0.5290549",
"0.5278227",
"0.52700776",
"0.52656204",
"0.5238063",
"0.52332914",
"0.521695",
"0.5212728",
"0.521216",
"0.5198948",
"0.5113907",
"0.50973797",
"0.50776345",
"0.50765723",
... | 0.68672913 | 0 |
Define the default compat level | def set_compat_level(compatlevel = DEBHELPER_DEFAULT_COMPAT_LEVEL, compatfile = "debian/compat")
if File.exist?(compatfile)
existing_compatlevel = `cat #{compatfile}`.strip
Packager.warn "Apaka::Packaging::Debian::set_compat_level: existing '#{compatfi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bump_level\n return :major if @options[:major]\n return :minor if @options[:minor]\n return :patch if @options[:patch]\n end",
"def compat\n\t\tmodule_info['Compat'] || {}\n\tend",
"def level\n [MAJOR, MINOR, PATCH, PRE].compact.join(\".\")\n end",
"def compatibility_mode(compat... | [
"0.66932446",
"0.6421182",
"0.6386833",
"0.6287057",
"0.61542505",
"0.6137305",
"0.6110456",
"0.5946597",
"0.5921266",
"0.58900195",
"0.5840121",
"0.5821903",
"0.5821903",
"0.58121353",
"0.5804544",
"0.5798878",
"0.5747369",
"0.5746987",
"0.572297",
"0.57138383",
"0.5693415",... | 0.7287851 | 0 |
Compute the build dependencies for a packag info object return [Array] list of dependencies | def build_dependencies(pkginfo)
dependencies = []
pkgdeps = pkginfo.dependencies
deps = pkgdeps[:rock_pkginfo].select do |pkginfo|
pkg_name = debian_name(pkginfo, true)
!rock_release_platform.ancestorContains(pkg... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_revdeps\n result = Hash.new { |h, k| h[k] = Set.new }\n each_autobuild_package do |pkg|\n pkg.dependencies.each do |pkg_name|\n result[pkg_name] << pkg.name\n end\n pkg.optional_dependencies.each do |pkg_name|\n ... | [
"0.70117927",
"0.67955554",
"0.67798376",
"0.671425",
"0.6661538",
"0.66558045",
"0.6655384",
"0.6621452",
"0.65861356",
"0.6531026",
"0.65242946",
"0.6503561",
"0.6468593",
"0.64621544",
"0.6460762",
"0.6459045",
"0.644103",
"0.64374304",
"0.64142406",
"0.6410538",
"0.637257... | 0.7326735 | 0 |
Newlinedelimited list of actions | def encode(serialized_actions = [])
serialized_actions.join("\n")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_actions\n\n actions = []\n\n unless self.actions.nil? or self.actions.empty?\n actions = self.actions.split(\"\\n\").collect {|entry| entry.split('-') }\n end\n return actions\n end",
"def actions!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __... | [
"0.6600519",
"0.60031545",
"0.59979725",
"0.59924996",
"0.59924996",
"0.59924996",
"0.5932228",
"0.58856696",
"0.5872141",
"0.5813266",
"0.57589763",
"0.5752623",
"0.57341725",
"0.5712437",
"0.5682996",
"0.5682996",
"0.56825763",
"0.5673276",
"0.5631639",
"0.5614074",
"0.5613... | 0.60092807 | 1 |
Maximum content length before a URL, this is 140 (maximum length of a Twitter message) minus 21 (space plus 20 characters for a t.co URL) or 22 with the https protocol | def max_content_length
@@max_content_length ||= Config.web =~ /^https/ ? 118 : 119
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def too_long? content\n content.length > MaxTweetLength\n end",
"def for_web_urls\n self.fixed_length\n end",
"def length\n [default&.length, max_content_length].compact.max\n end",
"def content_length; end",
"def content_length; end",
"def content_length; end",
"def max_length\n ... | [
"0.7034747",
"0.6990235",
"0.67459667",
"0.6643421",
"0.6643421",
"0.6643421",
"0.650526",
"0.6440131",
"0.63746667",
"0.63328135",
"0.62714547",
"0.6236814",
"0.6193767",
"0.6193416",
"0.60863227",
"0.60849625",
"0.6076017",
"0.60754406",
"0.60221374",
"0.6010283",
"0.594098... | 0.7638888 | 0 |
wraper for the brand method ActiveMerchant returns master or american_express Banwire requires mastercard and amex | def get_brand(brand)
case brand
when "master"
return "mastercard"
when "american_express"
return "amex"
else
return brand
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def brand\n cc_type\n end",
"def brand\n cc_type\n end",
"def is_brand? brand\n Handset.is_brand? request.user_agent, brand\n end",
"def brand_name\n maintenance_record_hub.try(:brand) || car.try(:brand_name)\n end",
"def brand_name\n product.brand_name\n end",
"def brand_name... | [
"0.6565322",
"0.65630853",
"0.647237",
"0.6302554",
"0.6068399",
"0.59349877",
"0.59022504",
"0.58542854",
"0.5850447",
"0.5816948",
"0.58104074",
"0.57395095",
"0.57395095",
"0.5686578",
"0.56758773",
"0.5652856",
"0.5618775",
"0.5617302",
"0.5580419",
"0.54561615",
"0.54204... | 0.7343426 | 0 |
GET /farms GET /farms.json | def index
@farms = Farm.all
respond_with(@users,@farms)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def farms\n user = User.find(params[:id])\n\n @farms = []\n # Find which farms this user is authorized to access\n if (user.is_hog_owner?)\n @farms = user.owner.farms\n elsif user.is_barn_manager?\n @farms << user.owner.barn.location.farm\n elsif user.is_site_manager?\n @farms << u... | [
"0.7742577",
"0.7169997",
"0.7169997",
"0.70576215",
"0.67901725",
"0.66245574",
"0.658241",
"0.635273",
"0.6294622",
"0.62944347",
"0.62555987",
"0.62397563",
"0.6227292",
"0.6200471",
"0.6131185",
"0.60921496",
"0.60811955",
"0.6057075",
"0.60558754",
"0.6051409",
"0.604940... | 0.7302946 | 1 |
def cache(path, original_filename, output_filename, data=nil) | def cache(input_path, output_path, data=nil)
path = input_path
@new_hashes[input_path] = hash(@input_directory, input_path)
if data
@data[path] = data if data
@wildcard_dependencies[path] = data[:wildcard_dependencies] if data[:wildcard_dependencies]
@dependencies[path] = data... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cache(data); end",
"def cache(gist, file, data)\n cache_file = get_cache_file_for gist, file\n File.open(cache_file, \"w\") do |io|\n io.write data\n end\n end",
"def caching\n @caching = \"data_update[#{data_path}]\"\n end",
"def caching\n @caching = \"data... | [
"0.7448695",
"0.74201995",
"0.7315937",
"0.7315937",
"0.7315937",
"0.7315937",
"0.73099744",
"0.73099744",
"0.72626126",
"0.7227641",
"0.7171443",
"0.70319706",
"0.69553924",
"0.6954398",
"0.69367135",
"0.6930686",
"0.6914109",
"0.68401515",
"0.6818943",
"0.6818943",
"0.68189... | 0.7517386 | 0 |
Create L2VPN session Create L2VPN session and bind to a L2VPNService | def create_l2_vpn_session(l2_vpn_session, opts = {})
data, _status_code, _headers = create_l2_vpn_session_with_http_info(l2_vpn_session, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_l2_vpn_session_with_http_info(l2_vpn_session, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiVpnL2VpnSessionsApi.create_l2_vpn_session ...'\n end\n # verify the required parameter 'l2_vpn_session' is set\n if @api... | [
"0.6675386",
"0.61380833",
"0.6061185",
"0.5906935",
"0.58896804",
"0.58732396",
"0.58028316",
"0.57887095",
"0.5749061",
"0.5645838",
"0.5626455",
"0.55933565",
"0.55907303",
"0.54721963",
"0.5393742",
"0.5384021",
"0.53733975",
"0.5359921",
"0.5348103",
"0.53226995",
"0.530... | 0.685843 | 0 |
Create L2VPN session Create L2VPN session and bind to a L2VPNService | def create_l2_vpn_session_with_http_info(l2_vpn_session, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementPlaneApiVpnL2VpnSessionsApi.create_l2_vpn_session ...'
end
# verify the required parameter 'l2_vpn_session' is set
if @api_client.co... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_l2_vpn_session(l2_vpn_session, opts = {})\n data, _status_code, _headers = create_l2_vpn_session_with_http_info(l2_vpn_session, opts)\n data\n end",
"def create_or_patch_l2_vpn(tier_0_id, locale_service_id, l2vpn_id, l2_vpn, opts = {})\n create_or_patch_l2_vpn_with_http_info(tier_0_i... | [
"0.685843",
"0.61380833",
"0.6061185",
"0.5906935",
"0.58896804",
"0.58732396",
"0.58028316",
"0.57887095",
"0.5749061",
"0.5645838",
"0.5626455",
"0.55933565",
"0.55907303",
"0.54721963",
"0.5393742",
"0.5384021",
"0.53733975",
"0.5359921",
"0.5348103",
"0.53226995",
"0.5309... | 0.6675386 | 1 |
Delete a L2VPN session Delete a specific L2VPN session. If there are any logical switch ports attached to it, those needs to be deleted first. | def delete_l2_vpn_session_with_http_info(l2vpn_session_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementPlaneApiVpnL2VpnSessionsApi.delete_l2_vpn_session ...'
end
# verify the required parameter 'l2vpn_session_id' is set
if @api_clien... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_session(env, sid, options); end",
"def delete_l2_vpn_session(l2vpn_session_id, opts = {})\n delete_l2_vpn_session_with_http_info(l2vpn_session_id, opts)\n nil\n end",
"def delete\n if @session\n @session.destroy\n @session = nil\n end\n end",
"def delete_session\n ... | [
"0.6753051",
"0.6744462",
"0.6662052",
"0.65379804",
"0.6346409",
"0.62133276",
"0.6111714",
"0.60931176",
"0.6034961",
"0.60064596",
"0.59941137",
"0.59852016",
"0.59428304",
"0.5897266",
"0.5892356",
"0.5884579",
"0.5878992",
"0.58543134",
"0.5823081",
"0.5802549",
"0.57815... | 0.68838084 | 0 |
Get a L2VPN session Get a specific L2VPN session | def get_l2_vpn_session(l2vpn_session_id, opts = {})
data, _status_code, _headers = get_l2_vpn_session_with_http_info(l2vpn_session_id, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_l2_vpn_session_with_http_info(l2vpn_session_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiVpnL2VpnSessionsApi.get_l2_vpn_session ...'\n end\n # verify the required parameter 'l2vpn_session_id' is set\n if @api_c... | [
"0.68863684",
"0.65346664",
"0.6142881",
"0.6033498",
"0.5987291",
"0.58496064",
"0.582263",
"0.5783638",
"0.57282025",
"0.570861",
"0.5691314",
"0.56578994",
"0.56189305",
"0.55903184",
"0.55779153",
"0.5559573",
"0.5545683",
"0.55303633",
"0.55278563",
"0.55197275",
"0.5499... | 0.67856747 | 1 |
Get a L2VPN session Get a specific L2VPN session | def get_l2_vpn_session_with_http_info(l2vpn_session_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementPlaneApiVpnL2VpnSessionsApi.get_l2_vpn_session ...'
end
# verify the required parameter 'l2vpn_session_id' is set
if @api_client.conf... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_l2_vpn_session(l2vpn_session_id, opts = {})\n data, _status_code, _headers = get_l2_vpn_session_with_http_info(l2vpn_session_id, opts)\n data\n end",
"def get_session2\n privileged = @@session_id_privileged rescue false\n if !privileged\n @@session_id = nil\n @@session_id_pri... | [
"0.67856747",
"0.65346664",
"0.6142881",
"0.6033498",
"0.5987291",
"0.58496064",
"0.582263",
"0.5783638",
"0.57282025",
"0.570861",
"0.5691314",
"0.56578994",
"0.56189305",
"0.55903184",
"0.55779153",
"0.5559573",
"0.5545683",
"0.55303633",
"0.55278563",
"0.55197275",
"0.5499... | 0.68863684 | 0 |
Get peer codes for the L2VpnSession Get peer codes for the L2VPN session to program the remote side of the tunnel. | def get_l2_vpn_session_peer_codes(l2vpn_session_id, opts = {})
data, _status_code, _headers = get_l2_vpn_session_peer_codes_with_http_info(l2vpn_session_id, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_l2_vpn_session_peer_codes_with_http_info(l2vpn_session_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiVpnL2VpnSessionsApi.get_l2_vpn_session_peer_codes ...'\n end\n # verify the required parameter 'l2vpn_session_id' i... | [
"0.71293914",
"0.5819167",
"0.5471055",
"0.5189417",
"0.51367766",
"0.5108261",
"0.5076274",
"0.5057087",
"0.5023644",
"0.4959744",
"0.49277085",
"0.49203652",
"0.48814026",
"0.4824515",
"0.48199093",
"0.47869185",
"0.4767501",
"0.4755308",
"0.47380775",
"0.47254547",
"0.4706... | 0.79052573 | 0 |
Get peer codes for the L2VpnSession Get peer codes for the L2VPN session to program the remote side of the tunnel. | def get_l2_vpn_session_peer_codes_with_http_info(l2vpn_session_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementPlaneApiVpnL2VpnSessionsApi.get_l2_vpn_session_peer_codes ...'
end
# verify the required parameter 'l2vpn_session_id' is set
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_l2_vpn_session_peer_codes(l2vpn_session_id, opts = {})\n data, _status_code, _headers = get_l2_vpn_session_peer_codes_with_http_info(l2vpn_session_id, opts)\n data\n end",
"def list_l2_vpn_sessions(opts = {})\n data, _status_code, _headers = list_l2_vpn_sessions_with_http_info(opts)\n ... | [
"0.79057103",
"0.58211654",
"0.54679704",
"0.5190082",
"0.5138232",
"0.5109675",
"0.5076664",
"0.50579065",
"0.502413",
"0.49591893",
"0.49243572",
"0.4920729",
"0.48780403",
"0.4823812",
"0.48201475",
"0.47893485",
"0.47692594",
"0.47544664",
"0.47376856",
"0.47256473",
"0.4... | 0.7128506 | 1 |
Get all L2VPN sessions Get paginated list of all L2VPN sessions | def list_l2_vpn_sessions(opts = {})
data, _status_code, _headers = list_l2_vpn_sessions_with_http_info(opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_l2_vpn_sessions_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiVpnL2VpnSessionsApi.list_l2_vpn_sessions ...'\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_... | [
"0.7177643",
"0.62780446",
"0.62716323",
"0.60475665",
"0.5932879",
"0.5919063",
"0.591813",
"0.58998376",
"0.5872089",
"0.5872089",
"0.5872089",
"0.5872089",
"0.5816827",
"0.5789972",
"0.5785835",
"0.569206",
"0.5642155",
"0.5592925",
"0.5585024",
"0.5576251",
"0.5561094",
... | 0.74568003 | 0 |
Get all L2VPN sessions Get paginated list of all L2VPN sessions | def list_l2_vpn_sessions_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementPlaneApiVpnL2VpnSessionsApi.list_l2_vpn_sessions ...'
end
if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_l2_vpn_sessions(opts = {})\n data, _status_code, _headers = list_l2_vpn_sessions_with_http_info(opts)\n data\n end",
"def index\n sessions = request do\n api.request(\n :expects => 200,\n :headers => headers,\n :method => :get,\n :path => \"/oauth/ses... | [
"0.74568003",
"0.62780446",
"0.62716323",
"0.60475665",
"0.5932879",
"0.5919063",
"0.591813",
"0.58998376",
"0.5872089",
"0.5872089",
"0.5872089",
"0.5872089",
"0.5816827",
"0.5789972",
"0.5785835",
"0.569206",
"0.5642155",
"0.5592925",
"0.5585024",
"0.5576251",
"0.5561094",
... | 0.7177643 | 1 |
Edit a L2VPN session Edit a specific L2VPN session | def update_l2_vpn_session_with_http_info(l2vpn_session_id, l2_vpn_session, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementPlaneApiVpnL2VpnSessionsApi.update_l2_vpn_session ...'
end
# verify the required parameter 'l2vpn_session_id' is set
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit(struct)\n struct.remapkeys!\n if struct.has_key? :user and struct.has_key? :pass\n rt = RT_Client.new(:user => struct[:user], :pass => struct[:pass])\n struct.delete(:user)\n struct.delete(:pass)\n else\n rt = RT_Client.new\n end\n val = rt.edit(struct)\n rt = nil\n ... | [
"0.60819167",
"0.59483075",
"0.5897877",
"0.58323157",
"0.58171827",
"0.5757632",
"0.5704464",
"0.56998515",
"0.56495434",
"0.56353724",
"0.5609072",
"0.55920726",
"0.5590826",
"0.558789",
"0.5574672",
"0.55618584",
"0.55611956",
"0.54988873",
"0.5496382",
"0.5487196",
"0.548... | 0.63248646 | 0 |
GET /mbrackets GET /mbrackets.json | def index
@mbrackets = Mbracket.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @cnmrbrackets = Cnmrbracket.all\n end",
"def list_assets\n get('/video/v1/assets')\n end",
"def index\n @abuckets = @account.abuckets\n @help = \"Bucket List\"\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @abuckets }\n end\n e... | [
"0.61459535",
"0.5878671",
"0.57804185",
"0.5624205",
"0.5548744",
"0.5442309",
"0.5441612",
"0.54038733",
"0.5327505",
"0.5325637",
"0.5309805",
"0.5285535",
"0.52602696",
"0.5228278",
"0.52167517",
"0.5215463",
"0.52030003",
"0.5196619",
"0.51772296",
"0.51601577",
"0.51545... | 0.6294522 | 0 |
POST /mbrackets POST /mbrackets.json | def create
@mbracket = Mbracket.new(mbracket_params)
respond_to do |format|
if @mbracket.save
format.html { redirect_to @mbracket, notice: 'Mbracket was successfully created.' }
format.json { render :show, status: :created, location: @mbracket }
else
format.html { render :ne... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @abucket = @account.abuckets.build(params[:abucket])\n respond_to do |format|\n if @abucket.save\n flash[:notice] = 'Bucket was successfully assigned.'\n format.html { redirect_to(account_abuckets_path(@account)) }\n format.xml { render :xml => @abucket, :status => :cr... | [
"0.58926225",
"0.5855267",
"0.5675764",
"0.5573238",
"0.5555356",
"0.54543626",
"0.5419137",
"0.5354525",
"0.53034854",
"0.5223558",
"0.51780456",
"0.5177694",
"0.5146059",
"0.51358217",
"0.5079961",
"0.5068309",
"0.5057744",
"0.5056958",
"0.50495857",
"0.50196517",
"0.499712... | 0.59274787 | 0 |
PATCH/PUT /mbrackets/1 PATCH/PUT /mbrackets/1.json | def update
respond_to do |format|
if @mbracket.update(mbracket_params)
format.html { redirect_to @mbracket, notice: 'Mbracket was successfully updated.' }
format.json { render :show, status: :ok, location: @mbracket }
else
format.html { render :edit }
format.json { render... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @abucket.update_attributes(params[:abucket])\n flash[:notice] = 'Bucket was successfully updated.'\n format.html { redirect_to(account_abuckets_path(@account)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"e... | [
"0.6146706",
"0.59289056",
"0.5795",
"0.57512766",
"0.5737652",
"0.56975603",
"0.56896573",
"0.56379503",
"0.55683506",
"0.5561941",
"0.5560071",
"0.5523778",
"0.5479658",
"0.5464934",
"0.54600555",
"0.54535997",
"0.54489356",
"0.5421928",
"0.5415702",
"0.5405829",
"0.5405829... | 0.608883 | 1 |
Read a save file, and attempt to initialize a game from it | def load_game
print_saves
begin
read_save
rescue IOError, SystemCallError
puts 'File not found'
load_game
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load\n file_name = ask_save_file\n save_file = File.open(file_name, 'r')\n save_file.pos = 0\n contents = unserialize(save_file.read)\n @name = contents['name']\n @guess = contents['guess']\n @word = contents['word']\n @bank = contents['bank']\n @lives = contents['lives']\n @lette... | [
"0.7642684",
"0.76054585",
"0.7590426",
"0.7520142",
"0.7355775",
"0.72137725",
"0.71496314",
"0.7041646",
"0.7003075",
"0.6940102",
"0.68225586",
"0.68003446",
"0.67826295",
"0.67689615",
"0.67403746",
"0.67222226",
"0.6719393",
"0.6710889",
"0.6656671",
"0.6475185",
"0.6466... | 0.81866574 | 0 |
Create slicing planes which are perpendicular to the reference segment. | def slicing_planes(segmenter)
plane_normal = segmenter.segment.line[1]
segmenter.points.map { |point|
[point.clone, plane_normal.clone]
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_perpendicular\n p1dot_ = self * P1\n p2dot_ = self * P2\n p1dot_ = -p1dot_ if p1dot_ < 0\n p2dot_ = -p2dot_ if p2dot_ < 0\n p1dot_ < p2dot_ ? (self % P1) : (self % P2)\n end",
"def plane\n return nil if @vertices.length < 3\n Plane.three_po... | [
"0.60368395",
"0.59248894",
"0.57970124",
"0.547599",
"0.5413303",
"0.5211689",
"0.5192795",
"0.5153421",
"0.51324207",
"0.5099675",
"0.5024902",
"0.5005301",
"0.4974331",
"0.49632823",
"0.49546692",
"0.49196318",
"0.49046892",
"0.48149726",
"0.47870997",
"0.47808498",
"0.477... | 0.7468517 | 0 |
Takes a date range and breaks it into an array of ranges by month. The first and last items may be partial months (ex starting in the middle and ending at the end) and the intermediate items are always full months (1st to last of month) | def months(date_range)
results = []
results << (date_range.begin..date_range.begin.end_of_month)
current = date_range.begin.end_of_month + 1.day
while current < date_range.end.beginning_of_month
month_start = current.beginning_of_month
month_end = current.end_of_month
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def month_range start_time, end_time\n start_date = start_time.month_start.to_date\n end_date = end_time.month_start.to_date\n current_date = start_date\n result = []\n while current_date <= end_date\n result << current_date.to_time\n current_date = current_date.next_month\n end\n result\nend",
"def... | [
"0.757665",
"0.73225707",
"0.7177227",
"0.70933497",
"0.7092237",
"0.7079848",
"0.69416416",
"0.68823355",
"0.6880895",
"0.6837699",
"0.682649",
"0.6821009",
"0.6760408",
"0.67402565",
"0.6560415",
"0.65319514",
"0.65215003",
"0.64339083",
"0.63829774",
"0.63628393",
"0.62705... | 0.85104007 | 0 |
GET|POST /sites/filter GET|POST /projects/:project_id/sites/filter | def filter
do_authorize_class
get_project_if_exists
do_authorize_instance(:show, @project) unless @project.nil?
filter_response, opts = Settings.api_response.response_advanced(
api_filter_params,
list_permissions,
Site,
Site.filter_settings
)
respond_filter(filter_respon... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @projects = Project.all\n \n filter = params[:filter]\n by = params[:by]\n \n if filter == 'all' or filter == 'New Posts'\n @projects = filter_projects(filter)\n elsif filter == 'Type' or filter == 'Region' or filter == 'Budget' or filter == 'Popular'\n @projects = filter... | [
"0.6695942",
"0.65546066",
"0.6224362",
"0.62091506",
"0.61379486",
"0.61110914",
"0.60876745",
"0.6036601",
"0.6003981",
"0.59945613",
"0.59913814",
"0.59524214",
"0.59524214",
"0.5950059",
"0.59470063",
"0.58867913",
"0.5873827",
"0.5869289",
"0.58607066",
"0.58587646",
"0.... | 0.6942313 | 0 |
include Override Objectinclude so that modules extending Module instance can define include. | def include( *modules )
super if defined?( super )
original_include( *modules )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_include(include)\n object_class.record_location self\n return include unless @document_self\n object_class.add_include include\n end",
"def add_include include\n add_to @includes, include\n\n include\n end",
"def include; end",
"def include; end",
"def include(mod)\n mod.inclu... | [
"0.77406377",
"0.76823545",
"0.76145893",
"0.76145893",
"0.75136584",
"0.748567",
"0.748567",
"0.7480797",
"0.73424315",
"0.7187626",
"0.71865445",
"0.7132548",
"0.70626134",
"0.70600283",
"0.70591635",
"0.70266175",
"0.70034164",
"0.69935614",
"0.69613117",
"0.6959581",
"0.6... | 0.782343 | 0 |
extend_object Override Module.extended so that modules extending Module can define extend_object. | def extend_object( hooked_instance )
original_extend_object( hooked_instance )
super if defined?( super )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extend_object(obj) end",
"def representer_module_for(object, *args)\n evaluate_option(:extend, object) # TODO: pass args? do we actually have args at the time this is called (compile-time)?\n end",
"def extended(object)\n super\n\n case object\n when Class\n raise RuntimeError... | [
"0.8195318",
"0.7320905",
"0.7275163",
"0.7273842",
"0.72107977",
"0.69822526",
"0.6912915",
"0.68997276",
"0.680728",
"0.680653",
"0.6763356",
"0.6682619",
"0.6562188",
"0.6475795",
"0.64347625",
"0.63667876",
"0.6320993",
"0.6162019",
"0.6150696",
"0.6064884",
"0.60126346",... | 0.7342474 | 1 |
Ensure supplied GitHub usernames are real | def test_github_profile_exists
people.each do |name, info|
github_username = info.fetch("github", false)
if github_username
assert_kind_of Sawyer::Resource, octokit.user(github_username), "#{github_username} is not a real GitHub account"
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def username_exists?(github_username)\n !!User.all.find_by(github_username: github_username)\n end",
"def test_username_with_invalid_examples\n person = @valid_person\n invalid_usernames = %w{rails/rocks web2.0 javscript:something ME}\n invalid_usernames.each do |username|\n person.username = u... | [
"0.64287794",
"0.6357639",
"0.6189124",
"0.61513263",
"0.6128418",
"0.59871584",
"0.5966224",
"0.59537137",
"0.59128714",
"0.5866562",
"0.5853227",
"0.5853227",
"0.5822763",
"0.5805044",
"0.5790539",
"0.57476133",
"0.57420015",
"0.5684714",
"0.56837326",
"0.5681776",
"0.56736... | 0.6685057 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.