query stringlengths 7 9.55k | document stringlengths 10 363k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
convert boolean into int | def bln_to_int(bln)
bln ? 1 : 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bool_to_int(x)\n if x==true;1;elsif x==false;0;else; x;end\n end",
"def bool_to_i(b)\n (b) ? 1 : 0\nend",
"def boolean_int!(value)\n value.to_i\n end",
"def reduce_int(bool)\n to_reg.reduce_int(bool)\n end",
"def value_to_integer(value)\n case value\n when TrueCla... | [
"0.8478468",
"0.8459314",
"0.8329586",
"0.74269575",
"0.7049301",
"0.677256",
"0.6656879",
"0.66064864",
"0.6513704",
"0.6513704",
"0.6497409",
"0.6447541",
"0.643349",
"0.6352433",
"0.6329966",
"0.6307223",
"0.6304764",
"0.62781227",
"0.62599176",
"0.62570417",
"0.6255339",
... | 0.6029658 | 30 |
record id and 2 sec | def short_number(prenumber,n)
@str = prenumber.to_s + to_n(Time.now.sec.to_s,2).to_s
return to_n(@str,n)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def id ; @record.id if @record ; end",
"def id\n @record.Id\n end",
"def record_id\n block.id\n end",
"def begin_record(id_=nil)\n end_record if @current_record_id\n @current_record_id = (id_ || @record_id_generator.call).to_s\n @processor.begin_record(Entry::BeginRecor... | [
"0.6203947",
"0.5776882",
"0.57699007",
"0.5759807",
"0.5755818",
"0.5749335",
"0.5743685",
"0.5731155",
"0.5729672",
"0.5707433",
"0.568384",
"0.5679102",
"0.55860597",
"0.55736774",
"0.5568738",
"0.5568738",
"0.5568738",
"0.5568738",
"0.5568738",
"0.5568738",
"0.55430394",
... | 0.0 | -1 |
bugNo:27447 edit by ll 20110112 | def short_number_uuid(prenumber='01', n=10)
uuid_class = (UUIDTools::UUID rescue UUID)
uuid_class.random_create().to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def probers; end",
"def schubert; end",
"def bug\n end",
"def verdi; end",
"def berlioz; end",
"def deco_pos; end",
"def blg; end",
"def anchored; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def trd; end",
"def upc_e; end",
"... | [
"0.6544782",
"0.6326849",
"0.61198896",
"0.60276735",
"0.6014352",
"0.60033035",
"0.59645706",
"0.5957397",
"0.59529805",
"0.59460264",
"0.59460264",
"0.59460264",
"0.59460264",
"0.5932143",
"0.5924607",
"0.5898451",
"0.58780366",
"0.58206457",
"0.57953835",
"0.5765618",
"0.5... | 0.0 | -1 |
get day of the week | def day_week(date)
day_week = "--"
unless date.blank?
case date.strftime("%A")
when "Monday"
day_week = "月"
when "Tuesday"
day_week = "火"
when "Wednesday"
day_week = "水"
when "Thursday"
day_week = "木"
when "Friday"
day_week = "金"
when "Saturday"
day_week = "土"
when "Sunday"
day_week = "日"
end
else
end
return day_week
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def day_of_week\n to_time.wday\n end",
"def day_of_week\n # Date.wday returns 0-6 for Sunday,...Saturday\n return @day.wday\n end",
"def day_of_week\n start_on.strftime(WEEKDAY_NAME)\n end",
"def day_of_week\n dnum = day\n dnum -= 10 if dnum > 20\n dnum -= 10 if dnum >... | [
"0.8703183",
"0.85439473",
"0.830088",
"0.82861215",
"0.8274157",
"0.82299405",
"0.8161831",
"0.8136527",
"0.8082259",
"0.8026146",
"0.7887709",
"0.786826",
"0.7844248",
"0.78116995",
"0.77311116",
"0.7728233",
"0.77081823",
"0.7702498",
"0.76261497",
"0.7609969",
"0.7578541"... | 0.7380399 | 31 |
calculate from the current_time in 60 days | def time_allow(get_time, min_period_time, max_period_time)
to_time = Time.parse(get_time)
now_time = Time.now
return to_time - now_time < max_period_time - min_period_time && to_time - now_time > min_period_time
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_days; Rational === @val ? @val/60/60/24 : @val/60.0/60/24 end",
"def time_days() (@time_end.jd - @time_start.jd) + 1; end",
"def days() 24 * hours end",
"def melbCal(x)\n x = x / 60\n x = x / 60\n return x\n end",
"def calc_play_seconds\n @time_days.to_i * 86400 + @time_hours.to_i * 360... | [
"0.64424646",
"0.6378216",
"0.6350243",
"0.6270727",
"0.6256881",
"0.6230821",
"0.6230821",
"0.6163227",
"0.614481",
"0.61212",
"0.61131877",
"0.6086789",
"0.60811836",
"0.60291815",
"0.6015484",
"0.59909564",
"0.59717137",
"0.5965646",
"0.59561354",
"0.5943514",
"0.593331",
... | 0.0 | -1 |
end by dxy 20110714 | def show_date_format(time)
unless time.blank?
time.strftime("%Y年%m月%d日") rescue '--'
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def probers; end",
"def trd; end",
"def dh; end",
"def schubert; end",
"def stderrs; end",
"def berlioz; end",
"def tld; end",
"def tld; end",
"def sld; end",
"def verdi; end",
"def yyerrok; end",
"def yyerrok; end",
"def schumann; end",
"def terpene; end",
"def ma... | [
"0.693305",
"0.67800957",
"0.67554754",
"0.67156154",
"0.670623",
"0.66744614",
"0.66445935",
"0.6617251",
"0.6617251",
"0.65779966",
"0.65671927",
"0.6450704",
"0.6450704",
"0.643362",
"0.6398704",
"0.63582045",
"0.6297823",
"0.62683195",
"0.6257279",
"0.6227468",
"0.6210509... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_object_approver
@object_approver = ObjectApprover.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.61637366",
"0.60446453",
"0.59452957",
"0.591511",
"0.58885515",
"0.5834122",
"0.57761765",
"0.5702554",
"0.5702554",
"0.5652102",
"0.5619581",
"0.5423898",
"0.5409782",
"0.5409782",
"0.5409782",
"0.5394745",
"0.53780794",
"0.5356209",
"0.5338898",
"0.53381324",
"0.5328622... | 0.0 | -1 |
Only allow a trusted parameter "white list" through. | def object_approver_params
params.require(:object_approver).permit(:employee_id, :kind, :object_id, :object_type, :cancel_url, :redirect_url)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
... | [
"0.7122858",
"0.70540553",
"0.69476545",
"0.6902004",
"0.6735809",
"0.671776",
"0.668886",
"0.66776645",
"0.66611695",
"0.6555913",
"0.6527077",
"0.64584446",
"0.64516115",
"0.64500964",
"0.64474493",
"0.6435065",
"0.6413185",
"0.6413185",
"0.6391701",
"0.6380101",
"0.6380101... | 0.0 | -1 |
Takes in values and returns a normal structure that can be saved | def assemble(values)
if allow_blank
values
else
values.delete_if(&:blank?)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save\n values.save\n end",
"def to_h\n values.to_h\n end",
"def _save_set_values(values)\n ret = super\n load_typecast\n ret\n end",
"def convert_input_data(values)\r\n temp_hash = {}\r\n\r\n # This only applies to Procs in #insert, Proc... | [
"0.6089973",
"0.6052995",
"0.5763486",
"0.5708673",
"0.56730264",
"0.5637844",
"0.5595544",
"0.5546651",
"0.55239624",
"0.55238044",
"0.5477946",
"0.5477946",
"0.5466763",
"0.5459445",
"0.54567534",
"0.5442167",
"0.54236615",
"0.53829956",
"0.5348503",
"0.53479964",
"0.533745... | 0.50086904 | 88 |
Check if the opportunity is currently active | def is_active?
active
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def active?\r\n self.team.active?\r\n end",
"def active?\n active\n end",
"def active?\n true\n end",
"def active?\n if is_active\n return true\n else\n return false\n end\n end",
"def active?\n active\n end",
"def active?\n ... | [
"0.7402089",
"0.73730946",
"0.72924733",
"0.72569966",
"0.71941245",
"0.7185416",
"0.71726704",
"0.7166527",
"0.7161247",
"0.71572685",
"0.71482253",
"0.71482253",
"0.71482253",
"0.71453404",
"0.7143703",
"0.7143703",
"0.7143703",
"0.7135469",
"0.7135122",
"0.71350163",
"0.71... | 0.681964 | 69 |
Check if the opportunity is among the user's favorite opportunities | def is_favorite? (user_id)
self.favorite_opportunities.find_by user_id: user_id
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def favorited?(user, coffeeshop)\n coffeeshop.users.each do |coffeeshop_user|\n return true if coffeeshop_user == user\n end\n return false\n end",
"def show\n set_user\n @opportunities = @user.opportunities\n @opp = @user.favorite_opportunities\n end",
"def users_favorite?(user)\n ... | [
"0.68273884",
"0.6727841",
"0.66576713",
"0.6592853",
"0.6543904",
"0.6541906",
"0.65093637",
"0.64949673",
"0.64832896",
"0.6457644",
"0.64555365",
"0.6385246",
"0.6376153",
"0.63487214",
"0.63006485",
"0.62653077",
"0.6250512",
"0.62473774",
"0.6242815",
"0.623351",
"0.6219... | 0.7780154 | 0 |
Returns the current loggedin user (if any). | def current_user
@user ||= User.find_by(id: session[:user_id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_user\n if session[:user_id]\n return User.find(session[:id])\n else\n return nil\n end\n end",
"def current_user\n if session[:user_id]\n User.find(session[:user_id])\n else\n nil\n end\n end",
"def current_user\n return unless session[:user_id... | [
"0.8595121",
"0.8592477",
"0.85571194",
"0.85446614",
"0.8534988",
"0.8496989",
"0.84781706",
"0.8459429",
"0.8456244",
"0.84550375",
"0.8446549",
"0.84413755",
"0.84412014",
"0.8436105",
"0.83995825",
"0.83757716",
"0.8369018",
"0.8335767",
"0.8335767",
"0.8313423",
"0.83101... | 0.0 | -1 |
Returns true if the user is logged in, false otherwise. | def logged_in?
!!current_user
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_is_logged_in()\n user = get_user()\n if user != nil\n true\n else\n false\n end\n end",
"def logged_in?\n user._logged_in?\n end",
"def logged_in?\n if session[:username]\n if session[:logged_in?]\n return true\n end\n else\n r... | [
"0.9082417",
"0.8764097",
"0.87552106",
"0.8718715",
"0.86894006",
"0.86498255",
"0.86469626",
"0.86372185",
"0.8631328",
"0.86285406",
"0.86285406",
"0.8582609",
"0.85669243",
"0.85613596",
"0.85613596",
"0.8551865",
"0.85491496",
"0.85443276",
"0.85409296",
"0.8539988",
"0.... | 0.0 | -1 |
Logs out the current user. | def logout!
session.clear
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def log_out\n reset_session\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user ... | [
"0.85847217",
"0.8553567",
"0.8553567",
"0.8553567",
"0.8553567",
"0.8553567",
"0.85448325",
"0.85448325",
"0.85448325",
"0.85448325",
"0.85447145",
"0.8513818",
"0.85132295",
"0.85004026",
"0.8490199",
"0.84505224",
"0.84501094",
"0.84357476",
"0.843385",
"0.843385",
"0.8433... | 0.0 | -1 |
Returns a line full of escape sequences | def parse_colors(s)
line = ""
s.each_char do |c|
line.concat(@colors[c]) if @colors.has_key?(c)
line.concat(" ")
end
line.concat("\033[0m")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def escape(sequence)\n RUBY_PLATFORM =~ /(^win)|mingw/i ? '' : \"\\033[#{sequence}\" \n end",
"def nextline(distance = 1)\n ConsoleGlitter.escape(\"#{distance}E\")\n end",
"def ansi_sequences\n ANSI_ESCAPE_SEQUENCE_RX.each_match(self).collect do |match|\n ANSI.recognize(match[0])\n e... | [
"0.65726805",
"0.6231221",
"0.61889535",
"0.618074",
"0.6178224",
"0.61216503",
"0.6089933",
"0.60015947",
"0.59349763",
"0.59096146",
"0.5903451",
"0.5862649",
"0.5835454",
"0.5824154",
"0.5791258",
"0.57861394",
"0.5720787",
"0.56949866",
"0.5678487",
"0.56763786",
"0.56650... | 0.0 | -1 |
Allows to use SSH content instead of SSH key file (We need to place it into temporary file because Rugged needs it) | def ssh_private=(key_content)
@ssh_private_file = temp_file_manager.path('key')
IO.write(@ssh_private_file, key_content)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_ssh_key_to_temp_file(src_file = nil)\n\n src_file ||= self[:override_ssh_key] || infer_ssh_key_path\n\n begin\n src_file_contents = IO.read File.expand_path(src_file)\n rescue => err\n die \"can't read SSH key file: #{err}\"\n end\n if src_file_contents.include? 'AN... | [
"0.7100462",
"0.7089159",
"0.7053786",
"0.6756503",
"0.67385143",
"0.65544593",
"0.6457321",
"0.64440274",
"0.64433646",
"0.64228433",
"0.64189035",
"0.6332922",
"0.63068503",
"0.62854916",
"0.6254634",
"0.62522346",
"0.621362",
"0.6212999",
"0.61977327",
"0.6172533",
"0.6121... | 0.7020186 | 3 |
Allows to use SSH content instead of SSH key file (We need to place it into temporary file because Rugged needs it) | def ssh_public=(key_content)
@ssh_public_file = temp_file_manager.path('key.pub')
IO.write(@ssh_public_file, key_content)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_ssh_key_to_temp_file(src_file = nil)\n\n src_file ||= self[:override_ssh_key] || infer_ssh_key_path\n\n begin\n src_file_contents = IO.read File.expand_path(src_file)\n rescue => err\n die \"can't read SSH key file: #{err}\"\n end\n if src_file_contents.include? 'AN... | [
"0.7097895",
"0.70515513",
"0.7020105",
"0.67547274",
"0.6738609",
"0.65531224",
"0.6455479",
"0.64425683",
"0.64425075",
"0.6421936",
"0.64167887",
"0.6332681",
"0.63063806",
"0.62836593",
"0.62532693",
"0.62506807",
"0.6212667",
"0.62125033",
"0.6195762",
"0.6171718",
"0.61... | 0.7089064 | 1 |
Params (default: empty hash) | def params
@params ||= {}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def params\n {}\n end",
"def params\n {}\n end",
"def params\n @params.blank? ? default_hash : @params\n end",
"def params\n @params ||= {}\n end",
"def params\n @params ||= {}\n end",
"def params\n @params ||= { }\n end",
"def http_params\n {}\n ... | [
"0.8663924",
"0.84599",
"0.8253561",
"0.81403303",
"0.81403303",
"0.7941641",
"0.7814247",
"0.7721815",
"0.7636862",
"0.7607738",
"0.75335985",
"0.75335985",
"0.75335985",
"0.75335985",
"0.7515494",
"0.7515494",
"0.7470917",
"0.7468236",
"0.74652034",
"0.74632484",
"0.7463248... | 0.819622 | 4 |
Params validation on set | def params=(hash)
hash.each do |key, value|
raise InvalidRequestError, "Invalid format for request parameter #{key.inspect}" \
unless value.is_a? String or value.is_a? Numeric
end
@params = hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_params?; end",
"def check_params; true; end",
"def valid_params_request?; end",
"def validate_params(params)\n # This will be implemented by Validators which take parameters\n end",
"def validate_params\n @calls << [:validate_params]\n end",
"def validate_params!\n se... | [
"0.7931374",
"0.74636054",
"0.7433962",
"0.72686714",
"0.7158278",
"0.71539015",
"0.7069633",
"0.70003456",
"0.6974291",
"0.69692516",
"0.69337946",
"0.6917432",
"0.69156575",
"0.68584543",
"0.68297887",
"0.68215936",
"0.6815287",
"0.6801272",
"0.67992413",
"0.6777548",
"0.67... | 0.0 | -1 |
Loads request with data from hash | def load_from_hash!(hash)
hash.each do |k, v|
m = (k.to_s + '=').to_sym
raise InvalidRequestError, "Invalid key #{k.inspect}" unless respond_to?(m)
send(m, v)
end
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load(hash)\n Loader.load(hash)\n end",
"def load_hash(hash)\n @login = hash['login']\n @html_url = hash['html_url']\n @avatar_url = hash['avatar_url']\n @name = hash['name']\n @company = hash['company']\n @email = hash['email']\n end... | [
"0.6436689",
"0.64361084",
"0.64339703",
"0.59928197",
"0.5881657",
"0.5829836",
"0.5715951",
"0.5655234",
"0.5646264",
"0.5605214",
"0.5605214",
"0.5576397",
"0.55338985",
"0.5514547",
"0.550796",
"0.55020624",
"0.5479917",
"0.54729724",
"0.54608285",
"0.5457867",
"0.5440691... | 0.67598814 | 0 |
Loads request from JSON string | def load_from_json!(raw_data)
begin
hash = JSON.parse(raw_data, symbolize_names: true)
rescue JSON::ParserError => e
raise InvalidRequestError, "Malformed JSON data."
end
load_from_hash!(hash)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_from_json_string(json)\n load_from_hash(JSON.parse(json))\n end",
"def parse_request\n unless request.body.read.empty?\n @json = JSON.parse(request.body.read.html_safe)\n end\n end",
"def from_json!(string)\n JSON.parse(string).each do |var, val|\n self.instance_variable_se... | [
"0.67721057",
"0.64273465",
"0.63519424",
"0.6312996",
"0.630928",
"0.6295058",
"0.6295058",
"0.6281898",
"0.62013763",
"0.6190109",
"0.61883086",
"0.613058",
"0.6087288",
"0.5994398",
"0.5946529",
"0.59092647",
"0.5902748",
"0.5868394",
"0.58427626",
"0.58342415",
"0.5814997... | 0.6297754 | 5 |
Loads request fro local file | def load_from_file!(file_path)
raise IOError, "File #{file_path} not exist" unless File.exist?(file_path)
raw_data = IO.read(file_path)
load_from_json!(raw_data)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load\n begin\n http_request do |response|\n @target_file = file_from_header(response) || local_uri\n @remote_size = size_from_header(response)\n if File.exists? @target_file\n check_target_file\n else\n write_stream response\... | [
"0.7076706",
"0.6549494",
"0.6530074",
"0.6530074",
"0.64973336",
"0.6399205",
"0.6381647",
"0.63694555",
"0.63097394",
"0.62957275",
"0.6272679",
"0.62693137",
"0.6169513",
"0.6158584",
"0.6140262",
"0.6088572",
"0.6088572",
"0.6042849",
"0.60337096",
"0.6027258",
"0.6020091... | 0.55256665 | 81 |
Loads request from URL | def load_from_url!(url)
uri = URI(url)
req = Net::HTTP::Get.new(uri)
req['Accept'] = 'application/json'
res = Net::HTTP.start(uri.hostname, uri.port) do |http|
http.request(req)
end
# TODO: handle redirects
raise IOError, "Unable to load URL #{url}" unless res.is_a?(Net::HTTPOK)
load_from_json!(res.body)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def request\n EventMachine::HttpRequest.new(url)\n end",
"def http_request(url)\n uri = URI.parse(url)\n begin\n http = uri.read(read_timeout: 4)\n rescue OpenURI::HTTPError => e\n raise RequestError, YAML::dump(e)\n end\n end",
"def get(url); end",
... | [
"0.6908924",
"0.6856146",
"0.6764764",
"0.67028564",
"0.66764826",
"0.6588327",
"0.6566384",
"0.6544339",
"0.6484716",
"0.6440231",
"0.64308184",
"0.6389508",
"0.6364855",
"0.63445824",
"0.6341276",
"0.633308",
"0.6317765",
"0.63068384",
"0.63032985",
"0.62719786",
"0.6268916... | 0.69952065 | 0 |
Validates request and returns array of error messages or empty array if there are none | def errors
errors = []
if repo_url
begin
uri = URI(repo_url)
errors << "Invalid repository URL. Only SSH supported at the moment. Expected format: ssh://host/path/to/repo.git" \
unless uri.scheme == 'ssh'
rescue URI::InvalidURIError
errors << "Invalid repository URL. Expected format: ssh://host/path/to/repo.git"
end
end
unless [ssh_private_file, ssh_public_file].select { |v| v } .empty?
errors << "Missing SSH user." unless ssh_user
errors << "Missing private SSH key." unless ssh_private_file
errors << "Missing public SSH key." unless ssh_public_file
end
unless [docker_user, docker_password, docker_email].select { |v| v } .empty?
errors << "Missing Docker user." unless docker_user
errors << "Missing Docker password." unless docker_password
errors << "Missing Docker email." unless docker_email
end
if ping_url
begin
uri = URI(ping_url)
errors << "Invalid ping URL. Only HTTP / HTTPS supported at the moment. Expected format: https://domain.tld/api/notify" \
unless uri.scheme == 'http' || uri.scheme == 'https'
rescue URI::InvalidURIError
errors << "Invalid ping URL. Expected format: https://domain.tld/api/notify"
end
end
errors
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_request\n if @parsing_error\n return [400, \"Parsing error: #{@parsing_error}\"]\n elsif !@request_body || @request_body.empty?\n return [400, 'Request body is empty.']\n end\n\n return []\n end",
"def validate\n unless (e = errors).empty?\n raise InvalidRequestErr... | [
"0.76423645",
"0.7364759",
"0.7260222",
"0.71783394",
"0.7095804",
"0.7028368",
"0.699519",
"0.69894236",
"0.69894236",
"0.6882079",
"0.6827665",
"0.6816601",
"0.6812674",
"0.6787254",
"0.6708327",
"0.6708327",
"0.67009455",
"0.668716",
"0.668716",
"0.66554284",
"0.6640097",
... | 0.0 | -1 |
Validate request and raises first discovered error as an exception | def validate
unless (e = errors).empty?
raise InvalidRequestError, e.first
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_request(call)\n call.validate_request\n end",
"def validate!\n raise BadRequestError.new(self.errors.full_messages.uniq.join(', ')) unless valid?\n end",
"def validate!\n raise BadRequestError.new(self.errors.full_messages.uniq.join(', ')) unless valid?\n end",
"def r... | [
"0.7057664",
"0.6969029",
"0.6969029",
"0.69483626",
"0.67039263",
"0.66481584",
"0.6639452",
"0.6618237",
"0.650246",
"0.64663196",
"0.64460635",
"0.6351488",
"0.6324859",
"0.6316343",
"0.6313754",
"0.6295583",
"0.6295583",
"0.6247223",
"0.62443596",
"0.61996835",
"0.6176542... | 0.7949083 | 0 |
GET /short_urls or /short_urls.json | def index
@short_urls = ShortUrl.all
@short_url = ShortUrl.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n render json: {\n status: :success,\n urls: ShortUrl::top_100\n }\n end",
"def index\n @short_urls = @user.short_urls.paginate(:page => params[:page][:number], :per_page => params[:page][:size])\n if @short_urls.count > 0\n render json: @short_urls, meta: pagination_details... | [
"0.72652996",
"0.72427857",
"0.7137224",
"0.70784366",
"0.7045164",
"0.69650775",
"0.6892392",
"0.6779099",
"0.6761429",
"0.6711097",
"0.6703625",
"0.66313016",
"0.66228783",
"0.6611713",
"0.64753246",
"0.6449465",
"0.64275837",
"0.64257586",
"0.64081246",
"0.6399316",
"0.634... | 0.6077101 | 34 |
GET /short_urls/1 or /short_urls/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def short_url\n @json[\"shortUrl\"]\n end",
"def index\n render json: {\n status: :success,\n urls: ShortUrl::top_100\n }\n end",
"def short_url\n response[\"shortUrl\"]\n end",
"def index\n @short_urls = @user.short_urls.paginate(:page => params[:page][:number], :per_... | [
"0.7431069",
"0.7406855",
"0.7298582",
"0.72551996",
"0.717711",
"0.7175751",
"0.70784307",
"0.70499456",
"0.70481086",
"0.6955918",
"0.68453205",
"0.6828285",
"0.67094314",
"0.66915554",
"0.66759866",
"0.6644026",
"0.6633848",
"0.65922356",
"0.6576783",
"0.65397424",
"0.6534... | 0.0 | -1 |
POST /short_urls or /short_urls.json | def create
@short_url = ShortUrl.new(short_url_params)
respond_to do |format|
if @short_url.save
format.html { redirect_to "https://peteris-url-app.herokuapp.com/short_urls", notice: "Short url was successfully created." }
format.json { render :show, status: :created, location: @short_url }
else
format.html { render :new, status: :unprocessable_entity }
format.json { render json: @short_url.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n url = ShortenedUrl.find_by_long_url(shortened_urls_params[:long_url])\n \n if url\n render json: {shortUrl: url[:short_url]}\n else\n shortened_url = ShortenedUrl.new(shortened_urls_params)\n \n if shortened_url.save\n short_url = shortened_url.generate_short_url... | [
"0.7270255",
"0.7129487",
"0.6951126",
"0.69503397",
"0.69161326",
"0.6836265",
"0.6763736",
"0.6734383",
"0.67133546",
"0.67001444",
"0.66966087",
"0.6691724",
"0.66367227",
"0.6537744",
"0.6537141",
"0.65336037",
"0.65205616",
"0.6505113",
"0.65029114",
"0.64770794",
"0.645... | 0.68556744 | 5 |
PATCH/PUT /short_urls/1 or /short_urls/1.json | def update
respond_to do |format|
if @short_url.update(short_url_params)
format.html { redirect_to @short_url, notice: "Short url was successfully updated." }
format.json { render :show, status: :ok, location: @short_url }
else
format.html { render :edit, status: :unprocessable_entity }
format.json { render json: @short_url.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n if @short_url\n if @short_url.update(short_url_params)\n render json: {message: \"Successfully updated\"}, status: 204\n else\n render json: @short_url.errors, status: :unprocessable_entity\n end\n else\n render json: {errors: {message: \"No short_url with given... | [
"0.7649338",
"0.72182333",
"0.7157386",
"0.7105162",
"0.70742",
"0.6979416",
"0.6898693",
"0.68352836",
"0.6819776",
"0.67062366",
"0.6703416",
"0.66504204",
"0.66269875",
"0.66269875",
"0.66269875",
"0.66269875",
"0.66114897",
"0.6610174",
"0.6610174",
"0.6610174",
"0.656732... | 0.7237411 | 1 |
DELETE /short_urls/1 or /short_urls/1.json | def destroy
@short_url.destroy
respond_to do |format|
format.html { redirect_to short_urls_url, notice: "Short url was successfully destroyed." }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_short_url\n\t\turl_id = get_id_from_short_url params[:short_url]\n\t\turl = Url.find(url_id)\n\t\tcurrent_page_url = \"/urls/show_short_urls\"\n\n\t\turl.destroy\n respond_to do |format|\n format.html { redirect_to current_page_url, notice: 'url is successfully Deleted.' }\n format.json { h... | [
"0.79648006",
"0.7860916",
"0.77454156",
"0.7692981",
"0.7692981",
"0.76045465",
"0.75727683",
"0.7565657",
"0.7556083",
"0.75491154",
"0.74884254",
"0.7319606",
"0.7271845",
"0.72561866",
"0.6811029",
"0.6803729",
"0.67895347",
"0.67825925",
"0.6762321",
"0.66686916",
"0.661... | 0.7694318 | 3 |
Use callbacks to share common setup or constraints between actions. | def set_short_url
@short_url = ShortUrl.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.61637366",
"0.60446453",
"0.59452957",
"0.591511",
"0.58885515",
"0.5834122",
"0.57761765",
"0.5702554",
"0.5702554",
"0.5652102",
"0.5619581",
"0.5423898",
"0.5409782",
"0.5409782",
"0.5409782",
"0.5394745",
"0.53780794",
"0.5356209",
"0.5338898",
"0.53381324",
"0.5328622... | 0.0 | -1 |
Only allow a list of trusted parameters through. | def short_url_params
params.require(:short_url).permit(:mini_url, :original_url)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def param_whitelist\n [:role, :title]\... | [
"0.6948149",
"0.68135875",
"0.68015283",
"0.67953765",
"0.6745843",
"0.67416775",
"0.652725",
"0.6521263",
"0.649084",
"0.64307743",
"0.64307743",
"0.64307743",
"0.6398334",
"0.63553715",
"0.6355045",
"0.6346211",
"0.63444513",
"0.6338212",
"0.63267356",
"0.63267356",
"0.6326... | 0.0 | -1 |
Marks the worker as +queued+ so that, if the worker is not processed by the time the scheduler runs again, the same worker will not be enqueued, causing unneeded processing. | def update_status(worker)
worker.status = "queued"
BackgroundWorkerRepository.update(worker)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def queued\n @mutex.synchronize do\n raise Concurrent::ConcurrencyError.new('Cannot queue - Task is already queued') if @task_queued\n raise Concurrent::ConcurrencyError.new('Cannot queue - Task is already running') if @task_running\n raise Concurrent::ConcurrencyError.new('Cannot queue -... | [
"0.7098897",
"0.6830143",
"0.64635134",
"0.64149284",
"0.6379241",
"0.6364135",
"0.6332973",
"0.6274056",
"0.6160235",
"0.61401093",
"0.6120221",
"0.61154056",
"0.60575914",
"0.6055009",
"0.6003128",
"0.59540766",
"0.5952288",
"0.5941565",
"0.5940334",
"0.5937368",
"0.5933360... | 0.5807108 | 26 |
A list of activities the user likes | def likes
verbs_of_interest = %w[like unlike]
query = Activity.joins(:verb)
.with_actor_id(id: guid)
.with_target_id(id: nil)
.merge(Verb.with_display_name(name: verbs_of_interest))
@likes ||= query.group(:activity_object_id).having("COUNT(1) % 2 == 1")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def likes\n Activity.joins(:activity_verb).where('activity_verbs.name' => \"like\").\n joins(:activity_objects).where('activity_objects.id' => activity_object_id)\n end",
"def likes\n people = []\n query = Activity.joins { verb }.where { activity_object_id.eq(my { id }) }\n\n act... | [
"0.75189275",
"0.7455268",
"0.6918186",
"0.6700516",
"0.6592451",
"0.6554616",
"0.65352947",
"0.6494668",
"0.64317733",
"0.64050025",
"0.63936645",
"0.63914716",
"0.6347522",
"0.6337823",
"0.63099617",
"0.6304729",
"0.6294947",
"0.6287876",
"0.6277602",
"0.62576836",
"0.61990... | 0.7511381 | 1 |
Checks if the person likes the object or not | def likes?(object)
verbs_of_interest = %w[like unlike]
query = Activity.joins(:verb)
.with_activity_object_id(id: object.id)
.with_actor_id(id: guid)
.merge(Verb.with_display_name(name: verbs_of_interest))
query.count.odd?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def liked?(obj)\n Recommendations.redis.sismember(Recommendations::Helpers::RedisKeyMapper.liked_set_for(obj.class, id), obj.id)\n end",
"def likes?(obj)\n Recommendable.redis.sismember(Recommendable::Helpers::RedisKeyMapper.liked_set_for(obj.class, id), obj.id)\n end",
"def likes?(obje... | [
"0.79432714",
"0.79304",
"0.78122646",
"0.7579382",
"0.75357574",
"0.74432033",
"0.742974",
"0.73925376",
"0.7227986",
"0.72036046",
"0.7166424",
"0.71615016",
"0.7151259",
"0.708005",
"0.70611686",
"0.70465815",
"0.7037038",
"0.70201206",
"0.7011078",
"0.6996481",
"0.6958601... | 0.7514297 | 5 |
Constructor Optional arguments in params: start: the earliest time for this visit. Default value is 00:00, if not specified. end: the latest time for this visit. Default value is 23:59, if not specified. duration: the length of this visit in minutes demand: the capacity that this visit requires location: the location of the visit. Instance of Location | def initialize(id, params = {})
validate(params)
@id = id
@start = params["start"]
@end = params["end"]
@duration = params["duration"]
@demand = params["demand"]
@location = RoutificApi::Location.new(params["location"])
@priority = params["priority"]
@type = params["type"]
if params["time_windows"]
@time_windows = params["time_windows"].map{ |tw| TimeWindow.new(tw) }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(customer, location, start_time, description = nil, duration = 10,\n scheduled = true, worker = nil, summary = nil, purchase_order = nil)\n self.customer = customer\n self.location = location\n self.start_time = start_time\n #FIXME: taking a DateTime argument is friendlier\n #self.s... | [
"0.64450455",
"0.6348448",
"0.624877",
"0.6229777",
"0.6182577",
"0.61531746",
"0.60853356",
"0.6014484",
"0.5954208",
"0.59377635",
"0.5937097",
"0.593652",
"0.59046406",
"0.5891005",
"0.58768624",
"0.5831347",
"0.5826775",
"0.58173686",
"0.57761353",
"0.57448334",
"0.573788... | 0.6523091 | 0 |
Returns the JSON representation of this object def to_json(options = nil) | def as_json(options = nil)
json_data = {}
json_data["start"] = self.start if self.start
json_data["end"] = self.end if self.end
json_data["duration"] = self.duration if self.duration
json_data["demand"] = self.demand if self.demand
json_data["location"] = self.location.as_json
json_data["priority"] = self.priority if self.priority
json_data["type"] = self.type if self.type
if self.time_windows
json_data["time_windows"] = self.time_windows.map{ |tw| tw.as_json }
end
json_data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_json(options = {})\n as_json(options).to_json\n end",
"def to_json(options={})\n ::JSON.dump(to_hash(options))\n end",
"def to_json(options = {})\n ::JSON.dump(to_a(options))\n end",
"def to_json(*options)\n as_json.to_json(*options)\n end",
"def to_json(*options)... | [
"0.9259351",
"0.9177869",
"0.9068674",
"0.9003942",
"0.89369684",
"0.8856723",
"0.8833947",
"0.8827741",
"0.88189137",
"0.8812585",
"0.8721992",
"0.86884457",
"0.86873347",
"0.8672225",
"0.863888",
"0.863888",
"0.85726863",
"0.85719174",
"0.8564484",
"0.8546578",
"0.8509748",... | 0.0 | -1 |
Constructor Optional arguments start: start of the timewindow end: end of the timewindow | def initialize(params)
@start = params["start"]
@end = params["end"]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start=(time); end",
"def initialize(*args)\n if args.length == 2\n start_at, end_at_or_duration = *args\n elsif args.length == 1\n start_at = DateTime.now\n end_at_or_duration = args.first\n else\n raise ArgumentError, \"wrong number of arguments (#{args.length} for... | [
"0.71221197",
"0.6735008",
"0.6623456",
"0.6544099",
"0.6358359",
"0.6341966",
"0.6337864",
"0.6302019",
"0.61773586",
"0.61645436",
"0.615063",
"0.61221117",
"0.61221117",
"0.61221117",
"0.61221117",
"0.61221117",
"0.61084336",
"0.60557324",
"0.59923005",
"0.59923005",
"0.59... | 0.6623513 | 2 |
to make valid geoJSON | def type
"Feature"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def geojson\n obj = factory.parse_wkt(geometry_as_wkt)\n RGeo::GeoJSON.encode(obj).to_json\n rescue\n Geoblacklight.logger.warn \"Geometry is not valid: #{geom}\"\n default_extent\n end",
"def geojson(fields)\n geojson = Array.new\n fields.each do |field|\n geojson << {\n ... | [
"0.7122161",
"0.66762215",
"0.66501844",
"0.66224205",
"0.65439326",
"0.6508088",
"0.6503004",
"0.6487969",
"0.6472327",
"0.64323556",
"0.63907653",
"0.63883656",
"0.6383898",
"0.63434625",
"0.6307779",
"0.63011855",
"0.62938166",
"0.6164208",
"0.6124107",
"0.60762787",
"0.60... | 0.0 | -1 |
Get paginated datas for infinite scroll | def paginated_products
p = self.products.where(:admin_validation => true)
unless self.page.blank?
p.page(self.page)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch; @data = pager.fetcher[self.begin, pager.per_page]; end",
"def paginator; end",
"def pagy_get_items(collection, pagy)\n # this should work with ActiveRecord, Sequel, Mongoid...\n collection.offset(pagy.offset).limit(pagy.items)\n end",
"def paginate(type, request, ds, opts={})\n ... | [
"0.6993845",
"0.6883174",
"0.6848572",
"0.6754572",
"0.6672362",
"0.65951264",
"0.65857095",
"0.6561019",
"0.6545109",
"0.65444064",
"0.6541162",
"0.6513975",
"0.64908403",
"0.64697963",
"0.64685607",
"0.64619875",
"0.64526993",
"0.64028543",
"0.63932264",
"0.6388231",
"0.638... | 0.0 | -1 |
Where position is the position we are calculating for. To build the pattern: Repeat each element in the base pattern by the position num. | def build_pattern(position)
if !@patterns_for_positions.has_key?(position)
# e.g. if we have position = 2, then
# BASE_PATTERN => [0, 1, 0, -1]
# Array.new => [[0, 0], [1, 1], [0, 0], [-1, -1]]
# flatten => [0, 0, 1, 1, 0, 0, -1, -1] (final result)
pattern = BASE_PATTERN.map { |i| Array.new(position, i) }.flatten
@patterns_for_positions[position] = pattern
end
@patterns_for_positions[position]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generatePattern(numRepeats, theSize)\n\n\t# Generate the pattern\n\tbasePattern = [0, 1, 0, -1];\n\tthePattern = Array.new();\n\t\n\tbasePattern.each do |x|\n\t\tthePattern.concat(Array.new(numRepeats).fill(x));\n\tend\n\n\n\n\t# Repeat for size\n\twhile (thePattern.size < (theSize + 1))\n\t\tthePattern = the... | [
"0.69296676",
"0.6715291",
"0.65643585",
"0.6305227",
"0.6246405",
"0.6091",
"0.60494995",
"0.6046914",
"0.60176635",
"0.5966497",
"0.5900441",
"0.588536",
"0.58830637",
"0.586242",
"0.58324754",
"0.58313316",
"0.57873267",
"0.57805854",
"0.57792073",
"0.57792073",
"0.5719679... | 0.72795993 | 0 |
Note that this solution depends on some assumptions/observations: In second half of digit array, the pattern will include only 0s and 1s Each digit in the second half of the array only depends on the digit at that position and after in the rest of the array. So, we can speed up calculations to find the solution without generating the full transform for all digits. Furthermore, we can build the sum starting from the last digit, to avoid having to do a bunch of recalculations. | def run_phase
new_digits = []
running_sum = 0
@digits.reverse.each do |digit|
# We only care about the last digit in all sums
running_sum = (running_sum + digit) % 10
# Note that new digits will be in reverse order, so will reverse again after
new_digits << running_sum
end
@digits = new_digits.reverse
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def checksum(digits_array)\n # reverse the array , and iterate through the array.\n total = digits_array.reverse.each_with_index.inject(0) do |sum, (digit, index)|\n # Add digits together, doubling every other (even indexs)\n # Use sum_of_digits to sum the digits for products > 9\n sum + sum_o... | [
"0.6848948",
"0.67372495",
"0.63967353",
"0.6365141",
"0.63263905",
"0.6277568",
"0.6212812",
"0.6211661",
"0.619234",
"0.6192175",
"0.6167232",
"0.61564744",
"0.61486113",
"0.61380416",
"0.61127394",
"0.6078234",
"0.607257",
"0.60549253",
"0.60508555",
"0.6050102",
"0.603842... | 0.59223545 | 28 |
authenticates api access implements token expiry INPUT | def authenticate_api!
Rails.logger.info("Enter Authenticate Api")
# just to test we are using HTTP_HOST in test mode as HTTP_ORIGIN cant be set
Rails.env == "test" ? origin = request.env['HTTP_HOST'] : origin = request.env['HTTP_ORIGIN']
if !params["token"].blank? and origin.blank? # API Access
account_id = AccountsCache.access_token(params["token"])
raise et("application.unauthorized") if account_id.blank?
# set account_id in params
if params[:controller] == "accounts" and current_account
params[:id] = current_account._id.to_s if params[:id].blank?
else
params[:account_id] = current_account._id.to_s if params[:account_id].blank?
end
# set the request type
params[:request_type] = AppConstants.request_type_api
# mark already authenticated
set_authenticated
# make api request synchronous as of now
make_sync_request
end
rescue => e
Rails.logger.error("**** ERROR **** #{er(e)}")
head :unauthorized
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authenticate\n # if valid_access_token?\n # fetch_access_token\n # else\n get_new_access_token\n # end\n end",
"def authenticate\n Access.new(\n 'access_token' => access_token,\n 'token_type' => token_type,\n 'expires_in' => 1 << (1.size * 8 - 2) - 1 # ... | [
"0.737259",
"0.7245028",
"0.72349715",
"0.71447676",
"0.7049698",
"0.7041225",
"0.70303917",
"0.7021753",
"0.69873244",
"0.6889623",
"0.68170047",
"0.6796463",
"0.6756439",
"0.6756439",
"0.6756439",
"0.6741717",
"0.6713548",
"0.6706905",
"0.6700582",
"0.6676956",
"0.66583365"... | 0.6403611 | 55 |
Returns a hash that maps all dependency names to their location on disk by parsing every package.json file under node_modules. | def dependency_paths
@dependency_paths ||= [
*Dir.glob(config.pwd.join("**/node_modules/*/package.json")),
*Dir.glob(config.pwd.join("**/node_modules/@*/*/package.json"))
].each_with_object({}) do |file, hsh|
begin
dirname = File.dirname(file)
json = JSON.parse(File.read(file))
hsh["#{json["name"]}@#{json["version"]}"] = dirname
rescue JSON::ParserError
# don't crash execution if there is a problem parsing a package.json file
# if the bad package.json file relates to a package that licensed should be reporting on
# then this will still result in an error about a missing package
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bower_packages\n @bower_packages ||= Dir[\"#{File.expand_path(bower_root, gem_root)}/*/.bower.json\"].\n map{ |path| [File.basename(File.dirname(path)), File.read(path)] }.\n map{ |pkg, json| [pkg, JSON::Stream::Parser.parse(json) ]}.\n map{ |pkg, manifest| [pkg, manifest['main'... | [
"0.6618952",
"0.6604877",
"0.6548145",
"0.65371317",
"0.639582",
"0.6391081",
"0.61885893",
"0.6187005",
"0.6181134",
"0.61276895",
"0.6082537",
"0.6018755",
"0.598498",
"0.5961112",
"0.58751816",
"0.58561397",
"0.5843694",
"0.582892",
"0.582892",
"0.5820048",
"0.5801244",
... | 0.7820986 | 0 |
Your way of reading just confuses the issue. Adjust to the new habits of mind. Think like a programmer. Don't pay attention to extraneous stuff, just try to understand the conditions and account for each of them in turn. If this, then that. | def fizzbuzz(int)
if int % 3 == 0 && int % 5 == 0
"FizzBuzz"
elsif int % 3 == 0
"Fizz"
elsif int % 5 == 0
"Buzz"
else
nil
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def anchored; end",
"def silly_adjective; end",
"def who_we_are\r\n end",
"def required_positionals; end",
"def sharp; accidental; end",
"def oh_crap_i_forgot(title, person, location, date, thesis, major_accomplishment, pronoun)\n pronoun = 'male' ? p_use = 'he' : p_use = 'she'\n date < 1000 ? e_or_l ... | [
"0.61869663",
"0.61455035",
"0.60009515",
"0.57981926",
"0.57898426",
"0.5784014",
"0.5772303",
"0.5699795",
"0.5689232",
"0.56747836",
"0.56655383",
"0.5664293",
"0.559538",
"0.5576532",
"0.5542284",
"0.54990125",
"0.5477798",
"0.546988",
"0.54632545",
"0.5455865",
"0.541715... | 0.0 | -1 |
Find an element within this element | def find_in_children(*args)
child = nil
Capybara.current_session.within(element) do
child = self.class.new(:child, *args)
child.element
end
child
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find(el)\n BinarySearchTree.find!(@root, el)\n end",
"def find(selector)\n DOM::Element.from_node `#{@el}.querySelector(#{selector}) || Opal.nil`\n end",
"def find(selector)\n value = `#{@el}.querySelector(#{selector}) || false`\n value ? DOM::Element.fromNode(value) : nil\n end",
... | [
"0.711873",
"0.68414074",
"0.68292475",
"0.67754984",
"0.67718184",
"0.6702631",
"0.6658071",
"0.66340744",
"0.6629628",
"0.65264",
"0.65155196",
"0.65155196",
"0.6463767",
"0.64574355",
"0.64374197",
"0.64337444",
"0.63894767",
"0.6377228",
"0.63725036",
"0.635354",
"0.63449... | 0.0 | -1 |
TODO: list of verifications? And addition of callback or accessor/clear | def verify(timeout = nil)
timeout = Elementis.config.element_timeout if timeout.nil?
ElementVerification.new(self, timeout)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def callbacks; end",
"def callbacks; end",
"def methods() end",
"def methods; end",
"def methods; end",
"def methods; end",
"def methods; end",
"def refutal()\n end",
"def implementation; end",
"def implementation; end",
"def updated_data; end",
"def method; end",
"... | [
"0.708957",
"0.67224693",
"0.67224693",
"0.64767885",
"0.64436454",
"0.64436454",
"0.64436454",
"0.64436454",
"0.6422911",
"0.63783896",
"0.63783896",
"0.633007",
"0.62557405",
"0.62557405",
"0.62557405",
"0.62557405",
"0.62557405",
"0.62557405",
"0.62557405",
"0.62557405",
"... | 0.0 | -1 |
Override rails setter for rut column | def rut=(value)
value = Chilean::Rutify.format_rut(value) if rut_format == :classic
value = Chilean::Rutify.normalize_rut(value) if rut_format == :normalized
super(value)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_column_value(c, v)\n if col = model.set_column_conflicts[c]\n self[col] = v\n else\n super\n end\n end",
"def override_setter_on(model)\n model.class_eval %(\n def #{attribute}=(raw_value)\n definition = self.class.bitmask... | [
"0.6280664",
"0.62069887",
"0.6182714",
"0.6177751",
"0.6158791",
"0.6134903",
"0.61300325",
"0.61300325",
"0.61253893",
"0.6118089",
"0.60890114",
"0.6086607",
"0.6086607",
"0.6046589",
"0.6010608",
"0.6010608",
"0.6008657",
"0.59640324",
"0.59544283",
"0.5911149",
"0.591070... | 0.59247327 | 19 |
Public: Returns true if the Writer is closed, and false if it is open and available for writing. | def closed?
@closed
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def closed_write?\n io.closed_write?\n end",
"def closed?\n @reader.closed? && @writer.closed?\n end",
"def closed_write?\n end",
"def closed_write?()\n #This is a stub, used for indexing\n end",
"def closed_write?() end",
"def closed?\n @fd.closed?\n end",
"def closed?\n... | [
"0.82236123",
"0.7900433",
"0.7889187",
"0.7731962",
"0.7684398",
"0.7345511",
"0.7341927",
"0.733824",
"0.7336953",
"0.7262324",
"0.7250901",
"0.7249547",
"0.7248336",
"0.7231818",
"0.7231805",
"0.72282135",
"0.7216564",
"0.7193516",
"0.71770144",
"0.7121865",
"0.7095733",
... | 0.7215877 | 26 |
Public: Returns a Duration instance for the number of sample frames that have been written so far | def total_duration
Duration.new(@total_sample_frames, @format.sample_rate)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def duration\n return @data.size.to_f / @sample_rate\n end",
"def total_duration\n Duration.new(total_sample_frames, @data_chunk_reader.format.sample_rate)\n end",
"def total_duration\n Duration.new(total_sample_frames, @data_chunk_reader.format.sample_rate)\n end",
"def length; return @t... | [
"0.79239553",
"0.7309749",
"0.7309749",
"0.68815154",
"0.6880064",
"0.67915946",
"0.6733276",
"0.6733276",
"0.66914886",
"0.66826063",
"0.6626737",
"0.6499589",
"0.6453578",
"0.6453578",
"0.6453578",
"0.6453578",
"0.6453578",
"0.64240265",
"0.64240265",
"0.64064395",
"0.64007... | 0.7370018 | 2 |
Internal Writes the RIFF chunk header, format chunk, and the header for the data chunk. After this method is called the file will be "queued up" and ready for writing actual sample data. | def write_header(sample_frame_count)
extensible = @format.channels > 2 ||
(@format.sample_format == :pcm && @format.bits_per_sample != 8 && @format.bits_per_sample != 16) ||
(@format.channels == 1 && @format.speaker_mapping != [:front_center]) ||
(@format.channels == 2 && @format.speaker_mapping != [:front_left, :front_right])
format_code = extensible ? :extensible : @format.sample_format
requires_fact_chunk = (format_code != :pcm)
sample_data_byte_count = sample_frame_count * @format.block_align
riff_chunk_size = CANONICAL_HEADER_BYTE_LENGTH[format_code] + sample_data_byte_count
if sample_data_byte_count.odd?
riff_chunk_size += 1
end
# Write the header for the RIFF chunk
header = CHUNK_IDS[:riff]
header += [riff_chunk_size].pack(UNSIGNED_INT_32)
header += WAVEFILE_FORMAT_CODE
# Write the format chunk
header += CHUNK_IDS[:format]
header += [FORMAT_CHUNK_BYTE_LENGTH[format_code]].pack(UNSIGNED_INT_32)
header += [FORMAT_CODES[format_code]].pack(UNSIGNED_INT_16)
header += [@format.channels].pack(UNSIGNED_INT_16)
header += [@format.sample_rate].pack(UNSIGNED_INT_32)
header += [@format.byte_rate].pack(UNSIGNED_INT_32)
header += [@format.block_align].pack(UNSIGNED_INT_16)
header += [@format.bits_per_sample].pack(UNSIGNED_INT_16)
if format_code == :float
header += [0].pack(UNSIGNED_INT_16)
end
if extensible
header += [22].pack(UNSIGNED_INT_16)
header += [@format.bits_per_sample].pack(UNSIGNED_INT_16)
header += [pack_speaker_mapping(@format.speaker_mapping)].pack(UNSIGNED_INT_32)
if @format.sample_format == :pcm
format_guid = WaveFile::SUB_FORMAT_GUID_PCM
elsif @format.sample_format == :float
format_guid = WaveFile::SUB_FORMAT_GUID_FLOAT
end
header += format_guid
end
# Write the FACT chunk, if necessary
if requires_fact_chunk
header += CHUNK_IDS[:fact]
header += [4].pack(UNSIGNED_INT_32)
header += [sample_frame_count].pack(UNSIGNED_INT_32)
end
# Write the header for the data chunk
header += CHUNK_IDS[:data]
header += [sample_data_byte_count].pack(UNSIGNED_INT_32)
@io.write(header)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_wav_header()\n\t\t# calculate additional parameters included in the .wav header\n\t\tblock_align = (@bitsPerSample * @numChannels) / 8\n\t\tbyte_rate = (@sampleRate * @numChannels * @bitsPerSample) / 8\n\n\t\t# write first 16 bytes to file (always the same)\n\t\t# 'xxxx' portion will be modified in final... | [
"0.6815573",
"0.6336854",
"0.6336114",
"0.58043104",
"0.5737843",
"0.5732933",
"0.5412738",
"0.5379799",
"0.53738123",
"0.53670317",
"0.53543794",
"0.53013",
"0.5263941",
"0.5224846",
"0.5220642",
"0.51576823",
"0.5122042",
"0.51077425",
"0.51063186",
"0.51063186",
"0.5106318... | 0.5924627 | 3 |
Tell if the current position is a solution to the game. Check each tab clockwise : if it's a sad face, the game is lost. If it's a happy face, continue to the next tab. Otherwise, check the value of the next disk's tab. | def win?
for i in 0...DISK_SIZE do
@disks.reverse_each do |disk|
value = disk.value(i)
break if value == OK
return false if value == KO
end
end
return true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def game_over(player)\n if @@tab[0][0].status == player && @@tab[0][1].status == player && @@tab[0][2].status == player # verifie si des points sont alignés au 1er lignes\n true\n elsif @@tab[1][0].status == player && @@tab[1][1].status == player && @@tab[1][2].status == player # verifie s... | [
"0.667374",
"0.667374",
"0.66321594",
"0.6252652",
"0.6238016",
"0.61527425",
"0.6079378",
"0.6026934",
"0.6015793",
"0.6010353",
"0.6007311",
"0.5993935",
"0.5993935",
"0.5989379",
"0.59646046",
"0.59629893",
"0.59448457",
"0.59145147",
"0.59069544",
"0.59034944",
"0.5891751... | 0.5728241 | 45 |
Check if the current position wins the game and return true if successfully moved to the next one. Return false if the last position has been verified. | def shift(i = DISK_NUMBER - 1)
@solutions << solution if win?
return true if @disks[i].shift
return shift(i-1) if i != 1
return false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def winning_state_for_next_move?\n # for each possible move that could be made:\n # return true if the move leaves a losing_state_for_next_move for the opponent\n # else\n # false\n # end\n\n\n # a player can win with one move\n # / there is a move that makes true losing_state_for_next_mov... | [
"0.7601492",
"0.75736713",
"0.73213804",
"0.72339827",
"0.7089919",
"0.7070467",
"0.70263255",
"0.70258254",
"0.7022567",
"0.7009497",
"0.69913983",
"0.69894654",
"0.6989079",
"0.6956541",
"0.69520086",
"0.69408846",
"0.69320536",
"0.69290406",
"0.6928763",
"0.6918904",
"0.69... | 0.0 | -1 |
Test every possible solution in the game and return an array of solutions. | def solve
loop { break if !shift }
return @solutions
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_tests()\n check_solution(1, [1, 4, 10, 13, 15], true)\n check_solution(2, [1, 4, 10, 10, 13, 15], true)\n check_solution(3, [1, 2, 5, 3, 4 ], false)\nend",
"def run_tests()\n check_solution(1, [1, 4, 10, 13, 15], true)\n check_solution(2, [1, 4, 10, 10, 13, 15], true)\n check_solution(3... | [
"0.68930614",
"0.68930614",
"0.6830308",
"0.677105",
"0.67686397",
"0.6595782",
"0.6425017",
"0.634465",
"0.618841",
"0.6143108",
"0.6143108",
"0.6143108",
"0.6110681",
"0.6110357",
"0.6104915",
"0.60826737",
"0.60666716",
"0.6061124",
"0.59320784",
"0.5895286",
"0.58879495",... | 0.66556466 | 5 |
Return the offset of each disk's position. | def solution
return @disks.map { |disk| disk.position.offset }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pos_inode_array\n pos_list_entry + size_list_entry\n end",
"def offsets\n\t\t\tto_return = {}\n\t\t\tpiece_length = @parent.file_1.piece_length\n\t\t\t@difference_ids.each do |id|\n\t\t\t\tto_return[id] = id * piece_length\n\t\t\tend\n\t\t\treturn to_return\n\t\tend",
"def locations\n @locations ||=... | [
"0.6337699",
"0.6284154",
"0.62048703",
"0.6153747",
"0.6101751",
"0.60761434",
"0.6041412",
"0.602175",
"0.5863241",
"0.58519256",
"0.58112323",
"0.5709629",
"0.57055914",
"0.5696204",
"0.56916547",
"0.56759423",
"0.56258065",
"0.56036377",
"0.55993813",
"0.55936617",
"0.558... | 0.786093 | 0 |
Get sockets from stdlib | def colorize(text, color = :default, bg_color = :default)
colors = {
:default => "38",
:black => "30",
:red => "31",
:green => "32",
:brown => "33",
:blue => "34",
:purple => "35",
:cyan => "36",
:gray => "37",
:dark_gray => "1;30",
:light_red => "1;31",
:light_green => "1;32",
:yellow => "1;33",
:light_blue => "1;34",
:light_purple => "1;35",
:light_cyan => "1;36",
:white => "1;37"
}
bg_colors = {
:default => "0",
:black => "40",
:red => "41",
:green => "42",
:brown => "43",
:blue => "44",
:purple => "45",
:cyan => "46",
:gray => "47",
:dark_gray => "100",
:light_red => "101",
:light_green => "102",
:yellow => "103",
:light_blue => "104",
:light_purple => "105",
:light_cyan => "106",
:white => "107"
}
color_code = colors[color]
bg_color_code = bg_colors[bg_color]
return "\033[#{bg_color_code};#{color_code}m#{text}\033[0m"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getsockname(*) end",
"def getsockopt(*) end",
"def client_sockets\n @clients.map(&:socket)\n end",
"def socket; @socket; end",
"def fd\n return @sock\n end",
"def socket #:nodoc:\n return @socket\n end",
"def get_client_sockets\n\t\tclient_sockets = []\n\t\t@connection_array.e... | [
"0.6665043",
"0.6573392",
"0.64989054",
"0.6448878",
"0.6424538",
"0.6380692",
"0.6343135",
"0.63249856",
"0.63081795",
"0.61704385",
"0.6163828",
"0.61270165",
"0.60732937",
"0.6070474",
"0.6016794",
"0.5975897",
"0.5955522",
"0.59504515",
"0.5945727",
"0.5945654",
"0.594565... | 0.0 | -1 |
Run a remote recipe on the server. | def action_run
status = @recipe_helper.run(@new_resource.name, @new_resource.tags, @new_resource.attributes, @new_resource.match_all)
Chef::Log.info "Recipe executed '#{new_resource.name}' status:#{status}"
new_resource.updated_by_last_action(true)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deploy\n system %Q[ssh -lroot \"#{server}\" <<'EOF'\n \tcat >\"#{remote_script_name}\" <<'EOS'\n#{generate}EOS\nchmod +x \"#{remote_script_name}\"\nsource \"#{remote_script_name}\"\nEOF\n ]\n end",
"def call_remote \n def method_missing(*args)\n method, path = args\n if [:get, :pos... | [
"0.63993466",
"0.6380193",
"0.6303652",
"0.59551495",
"0.59309304",
"0.57422984",
"0.57305735",
"0.57071453",
"0.56983954",
"0.56641287",
"0.56455255",
"0.56137514",
"0.55794084",
"0.5562439",
"0.555942",
"0.55366623",
"0.5505713",
"0.54708534",
"0.54385376",
"0.54299086",
"0... | 0.5350176 | 27 |
Gets the remote recipe environment based on node values. | def get_helper(node)
Chef::RemoteRecipe.factory(node)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nodes_for_environment(name)\n ridley.partial_search(:node, \"chef_environment:#{name}\", [\"fqdn\", \"cloud.public_hostname\", \"name\", \"os\"])\n end",
"def find_chef_env\n require 'json'\n require 'rubygems'\n require 'ohai'\n require 'mixlib/shellout'\n o = Ohai::System.new\n o.all_plugins\... | [
"0.6725177",
"0.66695005",
"0.6554424",
"0.6549804",
"0.6269318",
"0.6148614",
"0.60013413",
"0.5936309",
"0.5928467",
"0.5836133",
"0.5829933",
"0.5827278",
"0.58120954",
"0.58097243",
"0.5805143",
"0.5802587",
"0.5682804",
"0.56690073",
"0.5657731",
"0.559754",
"0.55574566"... | 0.56786615 | 17 |
all user_ids that made it past the clickfiltering | def vertica_userids
dd = dy2k() - 3 #let's be very conservatibe
cmd = "select distinct(sifi_uid) from cost_events where clicks > 0 and dd_id >= #{dd}"
puts cmd
s = go_direct(cmd)
xs = s.split("\n")
vus = {}
xs.each do |x|
vus[x] = true
end
vus
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_unviewed_ids(user); end",
"def permitted_users_id\n\treturn_user_ids = Array.new\n\tif !self.venue_id.nil?\n\t return_user_ids = ActiveInVenue.where(venue_id: self.venue_id).where.not(user_id: self.user_id).map(&:user_id)\n end\n\tif self.allow_nearby\n\t\treturn_user_ids = return_user_ids | User.whe... | [
"0.7185835",
"0.66550696",
"0.6538673",
"0.65087366",
"0.64964586",
"0.64964586",
"0.64964586",
"0.6493489",
"0.64302456",
"0.63836664",
"0.63810587",
"0.63519484",
"0.630203",
"0.6285679",
"0.6285679",
"0.6269759",
"0.62478733",
"0.6237592",
"0.6210497",
"0.61914575",
"0.615... | 0.0 | -1 |
all userids from the raw logs | def raw_userids
users = {}
cmd = "find /data/log/ctr -name 'ctr*.gz' -mtime -2 | xargs zcat"
IO.popen(cmd) do |io|
while line = io.gets
r = get_uid(line)
#users[r[0]] = true # from cookie
users[r[1]] = true # from sifi param
end
end
users
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def userids\n metadata[\"userids\"]\n end",
"def user_ids\n array = Array.new\n\n self.each(\"USERS/ID\") do |id|\n array << id.text.to_i\n end\n\n return array\n end",
"def uids\n @uids ||= records.map(&:uid)\n end",
"... | [
"0.7188948",
"0.7133414",
"0.6716346",
"0.6628206",
"0.65358675",
"0.6531811",
"0.6531811",
"0.6531811",
"0.651923",
"0.6510884",
"0.64650196",
"0.645646",
"0.64393246",
"0.643563",
"0.64322585",
"0.6398749",
"0.6321435",
"0.62952906",
"0.62454236",
"0.6186948",
"0.61671054",... | 0.7413193 | 0 |
start peer handle msg, handle sub protocols | def start
executor.post {read_loop}
start_protocols
super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process(msg, peer)\n return nil unless msg\n \t\t\t\tcmd = verify(msg)\n \t\t\t\treturn nil unless cmd\n @callback.call(@name, peer, cmd) if @callback\n \t\t\t\tputs \"Nugache #{@name} Processing message\" if @@debug\n signed = sign(cmd)\n\t\t\t\t\t@pm.peers.each do |pr|\n\t\t\t\t... | [
"0.6220926",
"0.61111116",
"0.6026983",
"0.6018283",
"0.59578013",
"0.595284",
"0.5922898",
"0.58933526",
"0.58369964",
"0.5639354",
"0.5611202",
"0.5600977",
"0.5558924",
"0.55545634",
"0.55515313",
"0.55353653",
"0.5524392",
"0.54984003",
"0.548569",
"0.5485444",
"0.5479241... | 0.5245939 | 45 |
read and handle msg | def read_loop
loop do
msg = connection.read_msg
msg.received_at = Time.now
handle(msg)
end
rescue StandardError => e
self << [:raise_error, e]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def receive_msg msg\n # stub, overwrite this in your handler\n end",
"def handle_msg msg\n throw Exception(\"handle_msg must be implemented\")\n end",
"def parseMessage(msg)\n \n #\n # get args\n #\n tmp=msg.sub(/^:/,\"\").sub(/ :/,... | [
"0.7184989",
"0.70592827",
"0.7031998",
"0.7000524",
"0.69993937",
"0.69747066",
"0.69125116",
"0.69024444",
"0.69012713",
"0.6897454",
"0.68915325",
"0.6844053",
"0.682012",
"0.6816502",
"0.6769961",
"0.6764746",
"0.6730917",
"0.67272705",
"0.67219603",
"0.6642742",
"0.66409... | 0.6423109 | 33 |
return protocol_io_hash handle multiple sub protocols upon one io | def make_protocol_io_hash(protocols, caps, io)
# sub protocol offset
offset = RLPX::BASE_PROTOCOL_LENGTH
result = {}
# [name, version] as key
protocols_hash = protocols.map {|protocol| [[protocol.name, protocol.version], protocol]}.to_h
sorted_caps = caps.sort_by {|c| [c.name, c.version]}
sorted_caps.each do |cap|
protocol = protocols_hash[[cap.name, cap.version]]
next unless protocol
# ignore same name old protocols
if (old = result[cap.name])
result.delete(cap.name)
offset -= old.protocol.length
end
result[cap.name] = ProtocolIO.new(protocol, offset, io)
# move offset, to support next protocol
offset += protocol.length
end
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_protocol(protocol_string)\n [\"name\", \"shared\", \"guest access\", \"inherit perms\"].inject({}) do |hash, key|\n hash[key] = protocol_value_for_key_in_string(key, protocol_string)\n hash\n end\n end",
"def protocol\n @protocol ||= @raw_protocol[0..-4]\n end",
"def protocol_b... | [
"0.5555026",
"0.55357647",
"0.5523249",
"0.55213547",
"0.55213547",
"0.5363688",
"0.5363688",
"0.5363688",
"0.5363688",
"0.52391547",
"0.52111393",
"0.5126013",
"0.5124993",
"0.5109489",
"0.5103626",
"0.5090356",
"0.5049686",
"0.5049686",
"0.50285524",
"0.4964292",
"0.4936985... | 0.7240566 | 0 |
AFFICHER NOM ET PV DU JOUEUR | def show_state
puts "#{@name} à #{@life_points} points de vie"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nombre_y_apellido \n primer_nombre + ' ' + primer_apellido\n end",
"def presentacion\n \"La marca del Ventilador es #{@marca}\"\n end",
"def sigla; @nome; end",
"def acces_nome\r\n @nome\r\n end",
"def name; \"#{accidental.name}f\"; end",
"def agentes_serial\n Representante.find(... | [
"0.6034926",
"0.6025871",
"0.60228586",
"0.5931551",
"0.5924909",
"0.5914231",
"0.5830545",
"0.5828704",
"0.5827812",
"0.57966906",
"0.5796287",
"0.5782743",
"0.57595146",
"0.5758153",
"0.57240695",
"0.57138944",
"0.5708992",
"0.57085025",
"0.57010967",
"0.56991625",
"0.56873... | 0.0 | -1 |
ACTION ATTAQUER (INFLIGER DOMMAGES) | def attacks(player)
puts "#{@name} attaque le joueur #{player.name}"
player.gets_damage(compute_damage)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def modify_measure_img_click\n target_name = @data_mea['measure_target']['name_for_add']\n data_list = qone_data_list(measure_target_list_table,\"style*='display:none'\",:all)\n data_list.operate(target_name,0,:edit,2)\n end",
"def action\n play_decision_se\n s... | [
"0.60992247",
"0.5789965",
"0.5566807",
"0.55591834",
"0.5526841",
"0.5526841",
"0.55264235",
"0.5501589",
"0.5465763",
"0.543695",
"0.5413579",
"0.53798217",
"0.53433514",
"0.53383416",
"0.53167075",
"0.5302404",
"0.528408",
"0.52470165",
"0.5220213",
"0.51890856",
"0.518358... | 0.0 | -1 |
GENERATEUR DE DEGATS ALEATOIRE (1 a 6) | def compute_damage
return rand(1..6)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def grasa\n\t\t1.2*imc+0.23*@edad-10.8*@sexo-5.4\n\tend",
"def grasa\n\t\t1.2 * imc + 0.23 * @edad - 10.8 * ( sexo ? 1 : 0) - 5.4\n\tend",
"def grasa(sexo,peso,talla)\n\t\t@grasa = 1.2*imc(peso,talla)+0.23*@edad-10.8*sexo-5.4\n\tend",
"def dieta_gases_anuales(gramos)\n aux = @head\n ... | [
"0.6392289",
"0.6236964",
"0.6218448",
"0.6164024",
"0.60427123",
"0.5869744",
"0.5805158",
"0.5727952",
"0.5663806",
"0.5646559",
"0.56354856",
"0.56239086",
"0.560923",
"0.56052715",
"0.559072",
"0.55690914",
"0.5565281",
"0.556372",
"0.5559856",
"0.5558755",
"0.55335754",
... | 0.0 | -1 |
AFFICHER NOM, PV ET NIVEAU ARME DU JOUEUR | def show_state
puts "#{@name} à #{@life_points} points de vie et une arme de niveau #{@weapon_level}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nombre_y_apellido \n primer_nombre + ' ' + primer_apellido\n end",
"def fau\n @pubmed['FAU'].strip\n end",
"def fau\n @pubmed['FAU'].strip\n end",
"def full_name_apellido_paterno\n self.apellido_paterno.to_s + \" \" + self.apellido_materno.to_s + \" \" + self.nomb... | [
"0.6263996",
"0.6152049",
"0.6124341",
"0.61223644",
"0.60424066",
"0.60236233",
"0.5987208",
"0.59688866",
"0.5934775",
"0.5909258",
"0.5898624",
"0.58723426",
"0.5868975",
"0.58688855",
"0.585572",
"0.584136",
"0.584131",
"0.5815749",
"0.5792944",
"0.57817596",
"0.5712918",... | 0.0 | -1 |
GENERATEUR DE DEGATS ALEATOIRE (1 a 6) FOIS LVL ARME | def compute_damage
return rand(1..6) * @weapon_level
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def grasa\n\t\t1.2*imc+0.23*@edad-10.8*@sexo-5.4\n\tend",
"def grasa(sexo,peso,talla)\n\t\t@grasa = 1.2*imc(peso,talla)+0.23*@edad-10.8*sexo-5.4\n\tend",
"def grasa\n\t\t1.2 * imc + 0.23 * @edad - 10.8 * ( sexo ? 1 : 0) - 5.4\n\tend",
"def painel(ltChutes, numTentativas, numErros, totalAjudas, drawForca = 0)... | [
"0.6383993",
"0.62200624",
"0.6084598",
"0.5959971",
"0.59366924",
"0.59272796",
"0.5888038",
"0.5857211",
"0.58468",
"0.5798562",
"0.5747559",
"0.57193315",
"0.5692211",
"0.56685007",
"0.5663346",
"0.5660838",
"0.56510365",
"0.56471455",
"0.5642011",
"0.56277114",
"0.5613204... | 0.0 | -1 |
CHANGER D'ARME (CHERCHER UNE NOUVELLE) | def search_weapon
lvl = rand(1..6)
puts "Tu as trouvé une arme de niveau #{lvl}"
if @weapon_level >= lvl
puts "M@*#$... elle n'est pas mieux que ton arme actuelle..."
else
puts "Youhou ! elle est meilleure que ton arme actuelle : tu la prends."
@weapon_level = lvl
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mi_carrera\n\n\tend",
"def schumann; end",
"def recolectar_una\n\t\test = \"\"\n\t\tif @estado == ESTADO::MUERTE\n\t\t\test = \"El árbol está muerto\"\n\t\telse\n\t\t\tif @contador == 0\n\t\t\t\test = \"No hay más naranjas\"\n\t\t\telse\n\t\t\t\test = \"La naranja estaba deliciosa\"\n\t\t\t\t@contador -= 1... | [
"0.60847676",
"0.58507836",
"0.5811974",
"0.5811531",
"0.57831573",
"0.5710527",
"0.56946576",
"0.56819165",
"0.56428444",
"0.5613468",
"0.56062055",
"0.5602192",
"0.5598539",
"0.55864185",
"0.5571407",
"0.5557744",
"0.5549479",
"0.5536221",
"0.55292726",
"0.5522707",
"0.5501... | 0.0 | -1 |
CHERCHER UN PACK DE SOIN | def search_health_pack
des = rand(1..6)
if des == 1
puts "Tu n'as rien trouvé..."
elsif des >=2 && des <= 5
@life_points = @life_points + 50
puts "Bravo, tu as trouvé un pack de +50 points de vie !"
else
@life_points = @life_points + 80
puts "Waow, tu as trouvé un pack de +80 points de vie !"
end
if @life_points > 100
@life_points = 100
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pack(p0) end",
"def pack\n end",
"def pack_data value\r\n [value].pack('l>').split('').map(&:ord)\r\nend",
"def unpack(p0) end",
"def compute_pack_code(size: self.size, integer: self.integer?, unsigned: self.unsigned?)\n if integer\n INTEGER_PACK_CODES[[size, unsig... | [
"0.6097662",
"0.60769004",
"0.56861115",
"0.5466532",
"0.54340416",
"0.5320662",
"0.5123683",
"0.5100794",
"0.50951385",
"0.5090576",
"0.5087987",
"0.5087811",
"0.50846136",
"0.5078398",
"0.50713825",
"0.50686604",
"0.50544304",
"0.5036674",
"0.50275844",
"0.5015526",
"0.4985... | 0.0 | -1 |
Find the shortest substring that is repeated all over the original string | def isRepeated? subString, str
if str.length % subString.length != 0 then return false end
n = subString.length
max_repetitions = str.length / n
(0...max_repetitions).each do |i|
if str[n*i, n] != subString then return false end
end
return true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def solution(a)\n shortest = a.min_by &:length\n maxlen = shortest.length\n maxlen.downto(0) do |len|\n 0.upto(maxlen - len) do |start|\n substr = shortest[start,len]\n return substr if a.all?{|str| str.include? substr }\n end\n end\nend",
"def longest_repeated_substring(string)\n\n si... | [
"0.756878",
"0.73366004",
"0.73054427",
"0.7278175",
"0.72328186",
"0.7156366",
"0.7102422",
"0.7083179",
"0.70634025",
"0.70560944",
"0.70424014",
"0.70094794",
"0.70046335",
"0.6951015",
"0.693699",
"0.6908865",
"0.6907794",
"0.6901222",
"0.68949467",
"0.68913",
"0.68823934... | 0.0 | -1 |
GET /cov_pdps GET /cov_pdps.json | def index
# @cov_pdps = CovPdp.all.page(params[:page])
@q = CovPdp.ransack(params[:q])
@cov_pdps = @q.result(distinct: true).order('added_at DESC').page(params[:page])
authorize @cov_pdps
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_cov_pdp\n @cov_pdp = CovPdp.friendly.find(params[:id])\n end",
"def show\n\n authorize @cov_pdp\n end",
"def index\n @pcs = Pc.all\n end",
"def set_cov_odp\n @cov_odp = CovOdp.friendly.find(params[:id])\n end",
"def index\n @cps = Cp.all\n end",
"def cov_pdp_params\n ... | [
"0.62766117",
"0.59451735",
"0.56300557",
"0.55912364",
"0.5574914",
"0.54595757",
"0.53599626",
"0.53582984",
"0.5344281",
"0.52940726",
"0.5253994",
"0.5247511",
"0.523124",
"0.52107257",
"0.51774603",
"0.5162425",
"0.51287353",
"0.5086183",
"0.5058415",
"0.49858463",
"0.49... | 0.6328152 | 0 |
GET /cov_pdps/1 GET /cov_pdps/1.json | def show
authorize @cov_pdp
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_cov_pdp\n @cov_pdp = CovPdp.friendly.find(params[:id])\n end",
"def index\n # @cov_pdps = CovPdp.all.page(params[:page])\n @q = CovPdp.ransack(params[:q])\n @cov_pdps = @q.result(distinct: true).order('added_at DESC').page(params[:page])\n\n authorize @cov_pdps\n end",
"def set_cov... | [
"0.6423725",
"0.6313437",
"0.5890015",
"0.57007945",
"0.55786794",
"0.5478185",
"0.5477911",
"0.54272276",
"0.54169506",
"0.5413925",
"0.5409776",
"0.5401407",
"0.53922516",
"0.5372877",
"0.53614813",
"0.5321445",
"0.53137183",
"0.53005946",
"0.52931315",
"0.5286976",
"0.5273... | 0.6006815 | 2 |
POST /cov_pdps POST /cov_pdps.json | def create
@cov_pdp = CovPdp.new(cov_pdp_params)
# @cov_pdp.city = City.friendly.find(params[:cov_pdp][:city_id])
@city = City.find(@cov_pdp.city.id)
if (@city.cov_pdp_count == 0)
@diff_amount = @city.cov_pdp_count + @cov_pdp.amount
else
@diff_amount = @cov_pdp.amount - @city.cov_pdp_count
end
@cov_pdp.amount = @diff_amount
@cov_pdp.save
@city.cov_pdp_count += @cov_pdp.amount
@city.save
respond_to do |format|
if @cov_pdp.save
format.html { redirect_to @cov_pdp, notice: 'Cov pdp was successfully created.' }
format.json { render :show, status: :created, location: @cov_pdp }
else
format.html { render :new }
format.json { render json: @cov_pdp.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cov_pdp_params\n params.require(:cov_pdp).permit(:city_id, :amount, :added_at)\n end",
"def set_cov_pdp\n @cov_pdp = CovPdp.friendly.find(params[:id])\n end",
"def coverage_params\n params.require(:coverage).permit(:patientID, :policyID, :expirationDate)\n end",
"def create\n @... | [
"0.6248279",
"0.5822394",
"0.56696755",
"0.565644",
"0.5614519",
"0.5610831",
"0.56085",
"0.55679834",
"0.54067403",
"0.53505677",
"0.53503156",
"0.53314215",
"0.5326964",
"0.5310082",
"0.53072214",
"0.53015524",
"0.5300348",
"0.52831715",
"0.5265736",
"0.52639896",
"0.522426... | 0.5430474 | 8 |
PATCH/PUT /cov_pdps/1 PATCH/PUT /cov_pdps/1.json | def update
@city = City.find(@cov_pdp.city.id)
@city.cov_pdp_count -= @cov_pdp.amount
@city.save
# @cov_pdp.city = City.friendly.find(params[:cov_pdp][:city_id])
respond_to do |format|
if @cov_pdp.update(cov_pdp_params)
@city = City.find(@cov_pdp.city.id)
if (@city.cov_pdp_count == 0)
@diff_amount = @city.cov_pdp_count + @cov_pdp.amount
else
@diff_amount = @cov_pdp.amount - @city.cov_pdp_count
end
@cov_pdp.amount = @diff_amount
@cov_pdp.save
@city.cov_pdp_count += @cov_pdp.amount
@city.save
format.html { redirect_to @cov_pdp, notice: 'Cov pdp was successfully updated.' }
format.json { render :show, status: :ok, location: @cov_pdp }
else
format.html { render :edit }
format.json { render json: @cov_pdp.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @poc.update(poc_params)\n format.html { redirect_to @poc, notice: 'Poc was successfully updated.' }\n format.json { render :show, status: :ok, location: @poc }\n else\n format.html { render :edit }\n format.json { render json: @poc.e... | [
"0.6345607",
"0.61974365",
"0.6106805",
"0.59843725",
"0.5980628",
"0.5954783",
"0.5906821",
"0.5896084",
"0.5872745",
"0.58341295",
"0.5824684",
"0.58185506",
"0.5811456",
"0.58055794",
"0.5789823",
"0.5782804",
"0.5769908",
"0.57622975",
"0.57549566",
"0.57187444",
"0.57184... | 0.0 | -1 |
DELETE /cov_pdps/1 DELETE /cov_pdps/1.json | def destroy
authorize @cov_pdp
@city = City.find(@cov_pdp.city.id)
@city.cov_pdp_count -= @cov_pdp.amount
@city.save
@cov_pdp.destroy
respond_to do |format|
format.html { redirect_to cov_pdps_url, notice: 'Cov pdp was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n @pdk.destroy\n respond_to do |format|\n format.html { redirect_to pdks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pod_report.destroy\n resp... | [
"0.69344443",
"0.67151743",
"0.6664224",
"0.66082215",
"0.65869755",
"0.6543935",
"0.6543187",
"0.643104",
"0.6429592",
"0.63861144",
"0.6384382",
"0.6379401",
"0.63710576",
"0.6370566",
"0.63627636",
"0.63380855",
"0.63275474",
"0.6325159",
"0.63205713",
"0.6308323",
"0.6305... | 0.64301956 | 8 |
Use callbacks to share common setup or constraints between actions. | def set_cov_pdp
@cov_pdp = CovPdp.friendly.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Only allow a list of trusted parameters through. | def cov_pdp_params
params.require(:cov_pdp).permit(:city_id, :amount, :added_at)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def param_whitelist\n [:role, :title]\... | [
"0.69497335",
"0.6812623",
"0.6803639",
"0.6795365",
"0.67448795",
"0.67399913",
"0.6526815",
"0.6518771",
"0.64931697",
"0.6430388",
"0.6430388",
"0.6430388",
"0.63983387",
"0.6356042",
"0.63535863",
"0.63464934",
"0.63444513",
"0.6337208",
"0.6326454",
"0.6326454",
"0.63264... | 0.0 | -1 |
If more checks are needed add them to this collection with the same syntax. Redis is checked via Sidekiq so no need to add an explicit check. Note: `courtfinder` disabled because it is just too unreliable and we don't have any control over it so even if it goes down, we should not consider our service unhealthy. After all, inprogress/saved applications will continue working, it only affects new applications. rubocop:disable Style/RescueModifier | def checks
[
->(name: 'database') { [name, (ActiveRecord::Base.connection.active? rescue false)] },
->(name: 'sidekiq') { [name, (Sidekiq::ProcessSet.new.size.positive? rescue false)] },
->(name: 'sidekiq_latency') { [name, (Sidekiq::Queue.all.sum(&:latency) rescue false)] },
#->(name: 'courtfinder'){ [name, (C100App::CourtfinderAPI.new.is_ok? rescue false)] },
]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_check(check)\n @checks ||= []\n @checks << check\n end",
"def checks; end",
"def setup_should_update_checks!\n @should_update_checks = []\n @should_update_checks.push( lambda { |request| request.has_line_type?(options[:line_type]) } ) if options[:line_type]\n @should_update_checks... | [
"0.5740848",
"0.564856",
"0.560723",
"0.560723",
"0.54892594",
"0.5402978",
"0.5374017",
"0.53477585",
"0.52797693",
"0.5231846",
"0.5231017",
"0.5222297",
"0.52148634",
"0.5206262",
"0.51748544",
"0.51585644",
"0.51585644",
"0.51126546",
"0.5075342",
"0.5054409",
"0.50445855... | 0.61637676 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_appointment
@appointment = Appointment.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.61637366",
"0.60446453",
"0.59452957",
"0.591511",
"0.58885515",
"0.5834122",
"0.57761765",
"0.5702554",
"0.5702554",
"0.5652102",
"0.5619581",
"0.5423898",
"0.5409782",
"0.5409782",
"0.5409782",
"0.5394745",
"0.53780794",
"0.5356209",
"0.5338898",
"0.53381324",
"0.5328622... | 0.0 | -1 |
Only allow a list of trusted parameters through. | def appointment_params
params.fetch(:appointment, {}).permit(:name, :organization, :organization_mission, :organization_registered, :level_of_urgency, :level_of_exposure, :description, :participants, :looking_for, :contact, :patient_location, :links, :start_date, :end_date, :end_date_recurring, :compensation, :background_screening_required, :progress, :docs_and_demo, :number_of_patients, :was_helpful, :exit_comments, :visible, :category_slug, :page, :skill_list => [], :completion_list => [], :category_list => [], :location_list => [], :appointment_type_list => [], :vol_list => [])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def param_whitelist\n [:role, :title]\... | [
"0.69497335",
"0.6812623",
"0.6803639",
"0.6795365",
"0.67448795",
"0.67399913",
"0.6526815",
"0.6518771",
"0.64931697",
"0.6430388",
"0.6430388",
"0.6430388",
"0.63983387",
"0.6356042",
"0.63535863",
"0.63464934",
"0.63444513",
"0.6337208",
"0.6326454",
"0.6326454",
"0.63264... | 0.0 | -1 |
by default the program runs with address 1 as noun, and address 2 as verb | def run(program, noun = program[1], verb = program[2])
# initialize memory
memory = program.clone
memory[1, 2] = [noun, verb]
instruction_pointer = 0
# run program from memory
while true do
opcode, *parameters = memory[instruction_pointer, INSTRUCTION_LENGTH]
break unless OPERATIONS[opcode].call(memory, *parameters)
instruction_pointer += INSTRUCTION_LENGTH
end
if block_given?
return yield(memory)
end
memory[0]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def verb; end",
"def verb; end",
"def verb; end",
"def verb; end",
"def verb; end",
"def ingverb; end",
"def run_program!(program, noun, verb)\n program[1] = noun\n program[2] = verb\n\n program.each_slice(4) do |(opcode, read_addr_1, read_addr_2, write_addr)|\n case opcode\n when 1\n pro... | [
"0.640559",
"0.640559",
"0.640559",
"0.640559",
"0.640559",
"0.58521247",
"0.5742824",
"0.5675857",
"0.56097126",
"0.56097126",
"0.5554675",
"0.55317307",
"0.5501624",
"0.5466196",
"0.54536384",
"0.544813",
"0.5435126",
"0.54200584",
"0.540629",
"0.53542364",
"0.53344166",
... | 0.51569396 | 41 |
Formats stamp into UTC format | def now_stamp(now = nil)
now ||= Time.now
now.utc.strftime("%Y-%m-%dT%H:%M:%S.%6NZ")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_timestamp(raw_timestamp)\n Time.at(raw_timestamp).getutc.strftime(\"%Y%m%d%H%M%S\")\n end",
"def format_stamp( stamp )\n ( stamp.user.nil? ? 'anon' : stamp.user.login ) + \" (\" + stamp.created_at.strftime(\"%m/%d/%y - %I:%M %p\") + \")\"\n end",
"def getutc() end",
"def convert_happen... | [
"0.6938563",
"0.6717941",
"0.6693515",
"0.6597566",
"0.6470582",
"0.63838905",
"0.6382123",
"0.63169503",
"0.63130105",
"0.627986",
"0.62201697",
"0.617557",
"0.6157984",
"0.61499953",
"0.6129832",
"0.61213493",
"0.611343",
"0.6091169",
"0.6086744",
"0.60561925",
"0.6053118",... | 0.5989319 | 24 |
POST /results POST /results.json | def create
#p params
if params[:results].present? && params[:results][:answers].present?
answers = params[:results][:answers]
params[:results].delete :answers
#params[:aspects]=params[:aspects]+1
end
#p "Array?: " + params[:results][:aspects].is_a?(Array).to_s
#p "String?: " + params[:results][:aspects].is_a?(String).to_s
@results = Result.create(params[:results])
if answers
answers.each do |answer|
@results.answers.build(answer)
end
end
if @results.save
# @results.send_email
@results.delay.send_email
end
respond_with(@results)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post\n Typhoeus.post(@url,\n body: @results_hash.to_json,\n headers: { 'Content-Type' => 'application/json' })\n end",
"def create\n #TODO we need to look into the need for transactions in mongodb\n #Api::V1::Result.with_session do |session|\n #session.start_t... | [
"0.79618156",
"0.70347315",
"0.6430695",
"0.6363882",
"0.62522346",
"0.6239741",
"0.60929143",
"0.60929143",
"0.60773784",
"0.6051018",
"0.60151786",
"0.59909177",
"0.5975458",
"0.59725726",
"0.59725726",
"0.59725726",
"0.59665865",
"0.5965483",
"0.5954307",
"0.59362555",
"0.... | 0.6060322 | 9 |
How should a successful match on the token be enclosed in the DOM? There are defaults, but mainly it's also a function of the grammar, which is sitedependent | def tag_for_token token
if (grammar_hash = @grammar[token.to_sym]).is_a?(Hash) &&
(selector = grammar_hash[:in_css_match])
selector.split('.').first.if_present
end || Parser.tag_for_token(token)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def token(content, kind); end",
"def match_token(token)\n return true\n end",
"def step\n start_group :normal, matched if scan( /\\s+/ )\n if @in_tag\n case\n when scan( /([-\\w]+):([-\\w]+)/ )\n start_group :namespace, subgroup(1)\n start_group :punct, \":\"... | [
"0.6187362",
"0.61469233",
"0.61358285",
"0.6103279",
"0.6094519",
"0.6014522",
"0.597454",
"0.58901405",
"0.58901405",
"0.58901405",
"0.58901405",
"0.58901405",
"0.58901405",
"0.5878813",
"0.58374757",
"0.58374757",
"0.58374757",
"0.58300894",
"0.58129776",
"0.58035374",
"0.... | 0.5944851 | 7 |
Provide a list of tokens available to match | def tokens
@grammar.keys
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def match(tokens, definitions); end",
"def scan_tokens(tokens, options); end",
"def tokens; end",
"def tokens; end",
"def tokens; end",
"def tokens; end",
"def tokens; end",
"def tokens; end",
"def tokens; end",
"def tokens; end",
"def scan_for_all(token); end",
"def scan_for_all(token); end"... | [
"0.7531112",
"0.7140445",
"0.6757944",
"0.6757944",
"0.6757944",
"0.6757944",
"0.6757944",
"0.6757944",
"0.6757944",
"0.6757944",
"0.6671907",
"0.6671907",
"0.6671907",
"0.6493455",
"0.6477648",
"0.6443506",
"0.63642645",
"0.63598937",
"0.63366663",
"0.6322344",
"0.62562954",... | 0.60510087 | 39 |
Revise the default grammar by specifying new bindings for tokens 'gm' is a hash: keys are tokens in the grammar values are hashes to be merged with the existing entries | def modify_grammar gm
def cleanup_entry token, entry
return {} if entry.nil?
return entry.map { |subentry| cleanup_entry token, subentry } if entry.is_a?(Array)
# Convert a reference to a Seeker class to the class itself
return entry.constantize if entry.is_a?(String) && entry.match(/Seeker$/)
return entry unless entry.is_a?(Hash)
# Syntactic sugar: these flags may specify the actual match. Make this explicit
[
:checklist, # All elements must be matched, but the order is unimportant
:or, # The list is taken as an ordered set of alternatives, any of which will match the list
:repeating, # The spec will be matched repeatedly until the end of input
:orlist, # The item will be repeatedly matched in the form of a comma-separated, 'and'/'or' terminated list
# :accumulate, # Accumulate matches serially in a single child
:optional # Failure to match is not a failure
].each do |flag|
if entry[flag] && entry[flag] != true
entry[:match], entry[flag] = entry[flag], true
end
end
entry[:match] = cleanup_entry :match, entry[:match] if entry[:match]
keys = entry.keys.map &:to_sym # Ensure all keys are symbols
[
%i{ bound terminus }, # :bound and :terminus are exclusive options
%i{ atline inline }, # :atline and :inline are exclusive options
%i{ in_css_match at_css_match after_css_match } # :in_css_match, :at_css_match and :after_css_match are exclusive options
].each do |flagset|
# At most one of the flags in the flagset can be non-nil
setflags = (entry.slice *flagset).compact # Eliminating the nil flags
if setflags.count > 1
wrongstring = ':' + setflags.keys.map(&:to_s).join(', :')
flagstring = ':' + flagset.map(&:to_s).join(', :')
raise "Error: grammar entry for #{token} has #{wrongstring} flags. (Only one of #{flagstring} allowed)."
end
end
entry
end # cleanup_entry
# Do
def merge_entries original, mod
return original unless mod && mod != {}
return mod unless original&.is_a?(Hash)
mod.each do |key, value|
if value.nil?
original.delete key
else
original[key] = value.is_a?(Hash) ? merge_entries(original[key], value) : value
end
end
original
end
@grammar.keys.each do |key|
key = key.to_sym
entry = cleanup_entry key, @grammar[key]
mod = cleanup_entry key, gm[key]
@grammar[key] = merge_entries entry, mod # Allows elements to be removed
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deep_copy\n copy = Grammar.new( nil, @start_symbol )\n each_pair {|symb, alt| copy[symb] = alt.deep_copy }\n copy \n end",
"def merge(options)\n Grammar::GrammaticalContext.new(self.to_hash.merge(options.to_hash))\n end",
"def to_grammar\n raise NotImplementedError\n end",
"def ... | [
"0.581946",
"0.5621448",
"0.55194646",
"0.53318363",
"0.5263407",
"0.52248967",
"0.521597",
"0.5194031",
"0.5180191",
"0.51504326",
"0.5056538",
"0.50144166",
"0.49972454",
"0.49902913",
"0.49831703",
"0.49760494",
"0.49648097",
"0.4958076",
"0.49551234",
"0.49528486",
"0.494... | 0.60454595 | 0 |
Save the current grammar and apply mods to it for parsing | def push_grammar mods
@grammar_stack ||= []
@grammar_stack.push grammar
@grammar = YAML.load(grammar.to_yaml) # Clone the grammar for modification
modify_grammar YAML.load(mods.to_yaml)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_grammar\n raise NotImplementedError\n end",
"def rsg(filename)\n # TODO: your implementation here\n rawdef = read_grammar_defs(filename)\n spldef = split_definition(rawdef)\n gram = to_grammar_hash(spldef)\n expand(gram)\n #Calls each function independently so that there was no confusion when\n ... | [
"0.63614225",
"0.6058015",
"0.5938718",
"0.5910051",
"0.59065217",
"0.58535296",
"0.5672571",
"0.56598514",
"0.5633963",
"0.5632602",
"0.5623539",
"0.5583906",
"0.55237335",
"0.54839015",
"0.5480012",
"0.53688973",
"0.5363626",
"0.53581667",
"0.534391",
"0.52975476",
"0.52972... | 0.6759363 | 0 |
Restore the grammar to its prior state | def pop_grammar
@grammar = YAML.load(@grammar_stack.pop.to_yaml)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset\n lexer.reset\n self.in_def = false\n self.in_single = 0\n self.env.reset\n self.last_token_type = nil\n end",
"def restore\n parse\n end",
"def reset\n @stack = []\n @current_scope = @current_scope.parent until @current_scope.type == Scope::TYPE_MAIN\n @lexer.reset... | [
"0.675147",
"0.67098236",
"0.62176067",
"0.60886323",
"0.6073327",
"0.60609925",
"0.6009243",
"0.59915495",
"0.59847176",
"0.59611434",
"0.59339094",
"0.5919961",
"0.58946586",
"0.5894324",
"0.57946396",
"0.5784195",
"0.56916636",
"0.5675455",
"0.56350696",
"0.5611118",
"0.55... | 0.67326546 | 1 |
Match the spec (which may be a symbol referring to a grammar entry), to the current location in the stream | def match token, stream: @stream
matched = match_specification stream, grammar[token], token
matched
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tokens_spec\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 2 )\n return_value = TokensSpecReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n __TOKENS13__ = ni... | [
"0.6082709",
"0.6032019",
"0.59102076",
"0.58922905",
"0.57163525",
"0.5673496",
"0.5673496",
"0.5646122",
"0.5482557",
"0.54300207",
"0.54059756",
"0.53805685",
"0.53734666",
"0.5351934",
"0.5338682",
"0.5338145",
"0.53162146",
"0.5305626",
"0.52933306",
"0.5288418",
"0.5264... | 0.75217825 | 0 |
Scan down the stream, one token at a time, until the block returns true or the stream runs out | def seek stream=@stream, spec={}
unless stream.is_a?(NokoScanner)
stream, spec = @stream, stream
end
while stream.more?
mtch = (block_given? ? yield(stream) : match(spec, stream: stream))
return mtch if mtch.success?
stream = mtch.next
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def each\n until end_of_stream?\n sleep(@interval)\n output = read\n yield output unless output.empty?\n end\n end",
"def scan!\n find_match until @scanner.eos?\n end",
"def next\n catch :done do\n while !(info = progress)\n # do nothin... | [
"0.6767253",
"0.67335165",
"0.6605673",
"0.64604133",
"0.63994235",
"0.62770844",
"0.61179435",
"0.6057505",
"0.59867275",
"0.59250665",
"0.58770007",
"0.58615583",
"0.58128726",
"0.579038",
"0.5780568",
"0.5771843",
"0.57543206",
"0.5752393",
"0.5747992",
"0.5740779",
"0.574... | 0.5973431 | 9 |
Take an array of specifications and match them according to the context :checklist, :repeating, or :or. If no option, seek to satisfy all specifications in the array, in order, once. | def match_list start_stream, list_of_specs, token=nil, context={}
if token.is_a?(Hash)
token, context = nil, token
end
scanner = start_stream
children = []
end_stream = start_stream
# Individual elements get the same context as the list as a whole, except for the list-processing options
distributed_context = context.except :checklist, :repeating, :or, :optional
case
when context[:checklist] # All elements must be matched, but the order is unimportant
list_of_specs.each do |spec|
scanner = start_stream
best_guess = nil
while scanner.more? && !(child = match_specification scanner, spec, distributed_context).success? do
best_guess = child if child.enclose? # Save the last child to enclose
scanner = child.next # Skip past what the child rejected
end
return best_guess if best_guess&.hard_fail?
next unless child
children << child.if_succeeded
end_stream = child.tail_stream if child.tail_stream.pos > end_stream.pos # We'll set the scan after the last item
end
when context[:repeating] # The list will be matched repeatedly until the end of input
# Note: If there's no bound, the list will consume the entire stream
while end_stream.more? do
child = match_list end_stream, list_of_specs, context.except(:repeating)
children << child.if_succeeded
end_stream = child.tail_stream # next
end
when context[:or] # The list is taken as an ordered set of alternatives, any of which will match the list
list_of_specs.each do |spec|
child = match_specification start_stream, spec, token, distributed_context
if child.success?
return (token.nil? || child.token == token) ? child : Seeker.new(start_stream, child.tail_stream, token, [child])
end
end
return Seeker.failed(start_stream, token, context) # TODO: not retaining children discarded along the way
else # The default case: an ordered list of items to match
list_of_specs.each do |spec|
child = match_specification end_stream, spec, distributed_context
children << child.if_retain
end_stream = child.tail_stream
if child.hard_fail? && !child.enclose?
return Seeker.failed((children.first || child).head_stream,
end_stream,
token,
child.retain? ? context.merge(children: children.keep_if(&:'retain?')+[child]) : context)
end
end
end
# If there's only a single child and no token, just return that child
children.compact!
(children.count == 1 && token.nil?) ?
children.first :
Seeker.new(start_stream, end_stream, token, children)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def matching_opts(arg, list, i)\n\t\t# Returns field of all exactly or abbreviated matching options.\n\t\tm = @option.values.select { |o| o.match?(arg, list, i) == :exact }\n\t\tif m.empty?\n\t\t\t@option.values.select { |o| o.match?(arg, list, i) == :abbrev }\n\t\telse\n\t\t\tm\n\t\tend \n\tend",
"def match_m... | [
"0.6143948",
"0.58616054",
"0.57559204",
"0.5701811",
"0.56855625",
"0.5676856",
"0.565951",
"0.55660427",
"0.55259204",
"0.55247843",
"0.5516442",
"0.54602814",
"0.544103",
"0.5417856",
"0.5416554",
"0.5409966",
"0.53301835",
"0.52708495",
"0.52338946",
"0.52247465",
"0.5200... | 0.57657206 | 2 |
Extract a specification and options from a hash. We analyze out the target spec (item or list of items to match), and the remainder of the input spec is context for the matcher. This is where the option of asserting a list with :checklist, :repeating and :or options is interpreted. | def match_hash scanner, inspec, token=nil, context={}
if token.is_a?(Hash)
token, context = nil, token
end
spec = inspec.clone
# Check for an array to match
if flag = [ :checklist, # All elements must be matched, but the order is unimportant
:repeating, # The spec will be matched repeatedly until the end of input
:or, # The list is taken as an ordered set of alternatives, any of which will match the list
:orlist, # The item will be repeatedly matched in the form of
:parenthetical, # Match inside parentheses
:optional # Failure to match is not a failure
].find { |flag| spec.key?(flag) && spec[flag] != true }
to_match, spec[flag] = spec[flag], true
elsif to_match = spec[:tag] || spec[:tags] # Special processing for :tag specifier
# TagSeeker parses a single tag
# TagsSeeker parses a list of the form "tag1, tag2 and tag3" into a set of tags
klass = spec[:tag] ? TagSeeker : TagsSeeker
# Important: the :repeating option will have been applied at a higher level
return klass.match(scanner, lexaur: lexaur, token: token, types: to_match) ||
Seeker.failed(scanner, token, spec)
elsif to_match = spec[:regexp]
to_match = Regexp.new to_match
else
to_match = spec.delete :match
end
to_match = spec.delete :match if to_match == true # If any of the above appeared as flags, get match from the :match value
# We've extracted the specification to be matched into 'to_match', and use what's left as context for matching
match = match_specification scanner, to_match, token, spec
return match if match.success?
token ||= match.token
# If not successful, reconcile the spec that was just answered with the provided context
if (really_enclose = context[:enclose]) == :non_empty
really_enclose = match.children&.all?(:hard_fail?)
end
really_enclose ||= match.enclose? && (match.tail_stream != match.head_stream)
return Seeker.failed(match.head_stream,
match.tail_stream,
token,
enclose: (really_enclose ? true : false),
optional: ((context[:optional] || match.soft_fail?) ? true : false))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def matching_opts(arg, list, i)\n\t\t# Returns field of all exactly or abbreviated matching options.\n\t\tm = @option.values.select { |o| o.match?(arg, list, i) == :exact }\n\t\tif m.empty?\n\t\t\t@option.values.select { |o| o.match?(arg, list, i) == :abbrev }\n\t\telse\n\t\t\tm\n\t\tend \n\tend",
"def build_d... | [
"0.55582887",
"0.53715557",
"0.52656776",
"0.5237696",
"0.5120893",
"0.51055765",
"0.5051933",
"0.49878368",
"0.49833107",
"0.49129957",
"0.49078676",
"0.48576838",
"0.48136568",
"0.4807591",
"0.48047867",
"0.4779037",
"0.4745307",
"0.4706833",
"0.4657311",
"0.464784",
"0.464... | 0.5950188 | 0 |
Evaluate whether child_token can appear as a child of parent_token. | def can_include? parent_token, child_token, transitive = true
def refers_to? supe, sub, transitive=true
return unless (inclusions = @grammar_inclusions[supe])
inclusions.include?(sub) ||
transitive && inclusions.find { |inner| refers_to? inner, sub }
end
parent_token.nil? ||
child_token.nil? ||
refers_to?(parent_token.to_sym, child_token.to_sym, transitive)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def child_of?(parent); end",
"def is_child_of?(_parent)\n return false if (self == _parent) or self.root?\n _parent == self.parent\n end",
"def is_parent_of?(_child)\n return false if self == _child\n _child.is_child_of?(self)\n end",
"def child?\n parent_id = self[nested_set_parent]\n... | [
"0.75794196",
"0.7241923",
"0.72176015",
"0.70974296",
"0.70915765",
"0.70907706",
"0.70504",
"0.7043366",
"0.69873065",
"0.69519824",
"0.6943722",
"0.6936432",
"0.6936432",
"0.68901867",
"0.6871307",
"0.6871307",
"0.6871307",
"0.68438065",
"0.6781276",
"0.6781276",
"0.676708... | 0.6871489 | 14 |
created by mhassan772 This parser will get you the title and how to check the finding. You may uncomment the fix part to get the fix too. You wil need to install nokogiri gem | sudo gem install nokogiri Shows how to use the script | def usage()
puts "Usage is:"
puts "#{__FILE__} path/to/STIG/file.xml"
puts
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pageTitle(url)\r\n<<<<<<< HEAD\r\n\r\nresult = open(url).read.scan(/<title>(.*?)<\\/title>/)[0]\r\n result[0]\r\n\r\n=======\r\n # Fetch and parse HTML document\r\n doc = Nokogiri::HTML(open(url))\r\n doc.search('title').children[0].text\r\n>>>>>>> d785f49315f21edd5329234273e9431f9c199eea\r\nend",
"def f... | [
"0.64902955",
"0.6472563",
"0.6466396",
"0.63916355",
"0.63681793",
"0.6349397",
"0.6000884",
"0.593975",
"0.5907958",
"0.58876103",
"0.58825886",
"0.58566624",
"0.5828867",
"0.58282626",
"0.58279306",
"0.5805343",
"0.58030784",
"0.5738698",
"0.57360524",
"0.57215446",
"0.568... | 0.0 | -1 |
Make sure exam_date isn't in the past or more than 5 years in the future | def validate_dated_around_now
self.errors.add(:exam_date, "ist kein korrektes Datum, bitte versuche es erneut.") unless ((Date.today)..(5.years.from_now)).include?(self.exam_date)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exam_in_the_future\n if self.date < Date.today\n errors.add(:date, 'is in the past')\n end\n end",
"def is_past_5_years(date)\n fiveYearsAgo = (Time.now.year - 4).to_s\n dateYear = date.strftime('%Y')\n dateYear.between?(fiveYearsAgo, Time.now.year.to_s)\n end",
"def expiratio... | [
"0.75602955",
"0.6914001",
"0.6889302",
"0.68808377",
"0.6797276",
"0.6721167",
"0.668338",
"0.664767",
"0.66373944",
"0.6601043",
"0.6563047",
"0.65495574",
"0.649289",
"0.64178777",
"0.640378",
"0.6355497",
"0.6329796",
"0.63233715",
"0.6315897",
"0.6295846",
"0.6291582",
... | 0.8192355 | 1 |
POST Move to next Grid of the board for current court | def next_move
move_message = @board.move(params[:row], params[:col])
respond_to do |format|
if move_message == :next_move
@board.save!
format.json { render json: {
status: @board.status, current_player: @board.current_player,
move_message: move_message, code: 200
}
}
else
format.json { render json: {
status: @board.status, current_player: @board.current_player,
move_message: move_message, code: 200
}
}
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_move\n return false if @n.zero? && @grid.empty?\n show_path\n end",
"def nextMove(n,r,c,grid)\n # place m on grid at r,c\n actions = generate_path(grid, 'm','p')\n puts actions[0]\n grid[r][c] = '-'\n if actions[0] == 'LEFT'\n grid[r][c-1]='m'\n elsif actions[0] == 'RIGHT'\... | [
"0.6705869",
"0.6691772",
"0.66250014",
"0.63603795",
"0.62207055",
"0.60683316",
"0.6055596",
"0.6007282",
"0.6002591",
"0.5969452",
"0.5955937",
"0.5914925",
"0.5903032",
"0.58911735",
"0.5859513",
"0.5800375",
"0.5790548",
"0.57904685",
"0.57744",
"0.57602143",
"0.5719436"... | 0.6764416 | 0 |
load game and respective board | def load_game_board
@game = Game.find(params[:game_id])
@board = Board.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_game\n\t\tload_gameplay = YAML.load(File.read 'saved_game.yaml')\n\t\t@board = load_gameplay[0]\n\t\t@current_player = load_gameplay[1]\n\t\tshow_board\n\t\tinput_validation\n\tend",
"def load_game\n $pokemon_party = @all_window[@index].data\n $pokemon_party.expand_global_var\n $pokemon_p... | [
"0.7992575",
"0.7313197",
"0.72984624",
"0.7265231",
"0.7232954",
"0.7177949",
"0.7127077",
"0.7107115",
"0.7013337",
"0.6915855",
"0.6863455",
"0.6849937",
"0.68258566",
"0.6795446",
"0.6786039",
"0.67858064",
"0.675293",
"0.6749561",
"0.66242665",
"0.6620549",
"0.658484",
... | 0.78280336 | 1 |
Test 2: Cancel Delete Note Inline Comment | def test02_post_closed_news_CancelDeleteNoteOneComment_TC_24319
login $user_1_email, $master_password
$browser.goto($patch_news_post_closed_note)
sleep 2
commentPopSubmit "Test Comment #{random}"
sleep 2
commentCancelDelete
assert $comment_delete_link.exists?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test02_post_open_news_CancelDeleteNoteOneComment_TC_24319\n\t\tlogin $user_1_email, $master_password\n\t\t$browser.goto($patch_news_post_open_note)\n\t\t\n\t\tsleep 2\n\t\tcommentPopSubmit \"Test Comment #{random}\"\n\t\tsleep 2\n\t\tcommentCancelDelete\n\t\t\n\t\tassert $comment_delete_link.exists?\n\tend",
... | [
"0.74905074",
"0.74249995",
"0.7262646",
"0.72559494",
"0.71415526",
"0.71304405",
"0.7064715",
"0.704417",
"0.6907978",
"0.683381",
"0.6758911",
"0.67107266",
"0.6687647",
"0.6614897",
"0.6565867",
"0.654723",
"0.64517486",
"0.6407553",
"0.63471794",
"0.63372564",
"0.6321358... | 0.7490445 | 1 |
Test 3: Cancel Delete Article Inline Comment | def test03_post_closed_news_CancelDeleteArticleOneComment
login $user_1_email, $master_password
$browser.goto($patch_news_post_closed_article)
sleep 2
commentPopSubmit "Test Comment #{random}"
sleep 2
commentCancelDelete
assert $comment_delete_link.exists?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test03_post_open_news_CancelDeleteArticleOneComment\n\t\tlogin $user_1_email, $master_password\n\t\t$browser.goto($patch_news_post_open_article)\n\t\tsleep 2\n\t\tcommentPopSubmit \"Test Comment #{random}\"\n\t\tsleep 2\n\t\tcommentCancelDelete\n\t\t \n\t\tassert $comment_delete_link.exists?\n\tend",
"def te... | [
"0.7928353",
"0.7703459",
"0.75658035",
"0.75333524",
"0.74075687",
"0.73671734",
"0.7341108",
"0.7264295",
"0.7197464",
"0.71952116",
"0.7006728",
"0.6823882",
"0.67877805",
"0.67685986",
"0.6744207",
"0.67430645",
"0.67256314",
"0.6706647",
"0.6651758",
"0.6649356",
"0.6615... | 0.78993845 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.