query
stringlengths
7
6.41k
document
stringlengths
12
28.8k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
5
10
document_rank
stringclasses
2 values
End of walk_object_hierarchy Method: print_line Purpose: Wraps $evm.log(:info....) Arguments: indent_level: the indentation string string: the actual message to print Returns: Nothing
def print_line(indent_level, string) $evm.log("info", "#{$method}:[#{indent_level.to_s}] #{string}") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_automation_objects(indent_level, hierarchy)\n case hierarchy.position\n when 'root'\n print_line(indent_level, \"#{hierarchy.obj_name} ($evm.root)\")\n when 'parent'\n print_line(indent_level, \"#{hierarchy.obj_name} ($evm.parent)\")\n when 'object'\n print_line(indent_level, \"#{hierarchy...
[ "0.6409883", "0.58165276", "0.58151895", "0.5685281", "0.5683016", "0.5590414", "0.5551198", "0.55332106", "0.5520638", "0.55091083", "0.550132", "0.54611546", "0.54556197", "0.54556197", "0.54556197", "0.54556197", "0.54556197", "0.54556197", "0.54080385", "0.53998536", "0.5...
0.7413576
0
End of ping_attr Method: str_or_sym Purpose: format a string containing the argument correctly depending on whether the value is a symbol or string Arguments: value: the thing to be stringformatted Returns: string containing either ":value" or "'value'"
def str_or_sym(value) value_as_string = "" if value.is_a?(Symbol) value_as_string = ":#{value}" else value_as_string = "\'#{value}\'" end return value_as_string end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_str(arg)\n if arg.is_a?(Symbol)\n \":\" + arg.to_s\n elsif arg.nil?\n \"nil\"\n elsif arg.is_a?(String)\n \"'#{arg}'\"\n else\n arg.to_s\n end\n end", "def to_str(arg)\n if arg.is_a?(Symbol)\n \":\" + arg.to_s\n elsif arg.nil?\n \"nil\"\n elsif arg.is...
[ "0.6580558", "0.6580558", "0.64290214", "0.6374447", "0.6177938", "0.6117355", "0.59964705", "0.5992098", "0.5968117", "0.59486246", "0.58951235", "0.5872423", "0.5849036", "0.58371663", "0.5740083", "0.5713309", "0.5711262", "0.56904596", "0.5686483", "0.5686483", "0.5686483...
0.7422172
0
End of str_or_sym Method: print_attributes Purpose: Print the attributes of an object Arguments: object_string : friendly text string name for the object this_object : the Ruby object whose virtual_column_names are to be dumped Returns: None
def print_attributes(object_string, this_object) begin # # Print the attributes of this object # if this_object.respond_to?(:attributes) print_line($recursion_level, "Debug: this_object.inspected = #{this_object.inspect}") if $debug if this_object.attributes.respond_to?(:keys) if t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_custom_attributes(object_string, this_object)\n begin\n if this_object.respond_to?(:custom_keys)\n custom_attribute_keys = Array.wrap(this_object.custom_keys)\n if custom_attribute_keys.length.zero?\n print_line($recursion_level, \"--- no custom attributes ---\")\n else\n ...
[ "0.7548576", "0.7003994", "0.6802647", "0.6730234", "0.6509097", "0.6490177", "0.646289", "0.63599765", "0.62217087", "0.61246246", "0.5999873", "0.59849334", "0.59399784", "0.59260106", "0.59260106", "0.5909143", "0.58688456", "0.58434194", "0.57736546", "0.5770615", "0.5770...
0.8148297
0
End of print_attributes Method: print_virtual_columns Purpose: Prints the virtual_columns_names of the object passed to it Arguments: object_string : friendly text string name for the object this_object : the Ruby object whose virtual_column_names are to be dumped this_object_class : the class of the object whose assoc...
def print_virtual_columns(object_string, this_object, this_object_class) begin # # Only dump the virtual columns of an MiqAeMethodService::* class # if this_object.method_missing(:class).to_s =~ /^MiqAeMethodService.*/ # # Print the virtual columns of this object # virtual_col...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dump_virtual_columns(my_object, my_object_name)\n if my_object.respond_to?(\"virtual_column_names\")\n self.log(@dump_log_level, \"Begin #{my_object_name}.virtual_columns\")\n my_object.virtual_column_names.sort.each { |vcn| self.log(:info, \"#{my_object_name} Virtual Column - #{vcn}\")}\n se...
[ "0.8149296", "0.6227594", "0.6227594", "0.6129865", "0.60626733", "0.5890227", "0.5839619", "0.56068194", "0.5594218", "0.5587403", "0.5437805", "0.5437374", "0.5411703", "0.5389679", "0.5375347", "0.5261109", "0.5257295", "0.5251589", "0.5241231", "0.5229373", "0.52264297", ...
0.8270801
0
End of print_virtual_columns Method: is_plural? Purpose: Test whether a string is plural (as opposed to singular) Arguments: astring: text string to be tested Returns: Boolean
def is_plural?(astring) astring.singularize != astring end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_plural(word)\n\treturn word[-1] === 's' ? true : false\nend", "def plural?\n self == self.pluralize\n end", "def is_plural?(value)\n\t(value > 1) || (value < 1)\nend", "def plural?(is_plural,term)\n singular_plural = term.split('/')\n if singular_plural.size == 1\n sin...
[ "0.73216754", "0.73002934", "0.72870815", "0.70495206", "0.69248646", "0.69102776", "0.69025254", "0.6902409", "0.6580795", "0.6542817", "0.6453487", "0.62955916", "0.6260426", "0.6239439", "0.6238155", "0.6212102", "0.62064564", "0.61395943", "0.6068515", "0.6041791", "0.598...
0.807028
0
End of is_plural? Method: walk_association Purpose: Walks the association into the object passed to it Arguments: object_string : friendly text string name for the object association : friendly text string name for the association associated_objects : the list of objects in the association Returns: None
def walk_association(object_string, association, associated_objects) begin # # Assemble some fake code to make it look like we're iterating though associations (plural) # number_of_associated_objects = associated_objects.length if is_plural?(association) assignment_string = "#{object_string}...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def call_association(object, associations); end", "def print_associations(object_string, this_object, this_object_class)\n begin\n #\n # Only dump the associations of an MiqAeMethodService::* class\n #\n if this_object.method_missing(:class).to_s =~ /^MiqAeMethodService.*/\n #\n # Print th...
[ "0.64756316", "0.62145936", "0.595618", "0.5784524", "0.57229745", "0.57071847", "0.5684734", "0.56623", "0.5527177", "0.5404729", "0.53927237", "0.53807807", "0.52848095", "0.5259393", "0.5220017", "0.519091", "0.51880175", "0.51679283", "0.5161598", "0.5147637", "0.5104444"...
0.8364309
0
End of walk_association Method: print_associations Purpose: Prints the associations (if any) of the object passed to it Arguments: object_string : friendly text string name for the object this_object : the Ruby object whose associations are to be dumped this_object_class : the class of the object whose associations are...
def print_associations(object_string, this_object, this_object_class) begin # # Only dump the associations of an MiqAeMethodService::* class # if this_object.method_missing(:class).to_s =~ /^MiqAeMethodService.*/ # # Print the associations of this object according to the # $walk_asso...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def walk_association(object_string, association, associated_objects)\n begin\n #\n # Assemble some fake code to make it look like we're iterating though associations (plural)\n #\n number_of_associated_objects = associated_objects.length\n if is_plural?(association)\n assignment_string = \"#{o...
[ "0.73037016", "0.72469294", "0.6449096", "0.62647194", "0.6179434", "0.60254383", "0.5854516", "0.58438015", "0.5754523", "0.565204", "0.5524142", "0.55054826", "0.54988396", "0.5494011", "0.54886574", "0.54662234", "0.5437204", "0.53831834", "0.5371586", "0.53678095", "0.534...
0.81122863
0
End of print_associations Method: print_methods Purpose: Prints the methods (if any) of the object class passed to it Arguments: object_string : friendly text string name for the object this_object : the Ruby object whose methods are to be dumped Returns: None
def print_methods(object_string, this_object) begin # # Only dump the methods of an MiqAeMethodService::* class # if this_object.method_missing(:class).to_s =~ /^MiqAeMethodService.*/ print_line($recursion_level, "Class of remote DRb::DRbObject is: #{this_object.method_missing(:c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_associations(object_string, this_object, this_object_class)\n begin\n #\n # Only dump the associations of an MiqAeMethodService::* class\n #\n if this_object.method_missing(:class).to_s =~ /^MiqAeMethodService.*/\n #\n # Print the associations of this object according to the\n ...
[ "0.7377751", "0.6756606", "0.6730689", "0.62736297", "0.6253588", "0.6224839", "0.6133456", "0.6084404", "0.59996593", "0.5978311", "0.5966865", "0.5933512", "0.58986175", "0.58985925", "0.58644646", "0.58452266", "0.5844996", "0.5842908", "0.58336425", "0.5799953", "0.579359...
0.7420266
0
End of print_methods Method: print_tags Purpose: Prints the tags (if any) of the object class passed to it Arguments: this_object : the Ruby object whose tags are to be printed this_object_class : the class of the object whose associations are to be dumped Returns: None
def print_tags(this_object, this_object_class) begin if this_object.respond_to?(:taggable?) if this_object.taggable? tags = Array.wrap(this_object.tags) if tags.length.zero? print_line($recursion_level, "--- no tags ---") else print_line($recursion_level, "--- tag...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dump_tags(object)\n return if object.tags.nil?\n\n $evm.log(\"info\", \" Begin Tags [object.tags]\")\n object.tags.sort.each do |tag_element|\n tag_text = tag_element.split('/')\n $evm.log(\"info\", \" Category:<#{tag_text.first.inspect}> Tag:<#{tag_text.last.inspect}>\")\n end\n $evm.log(\"info...
[ "0.67090267", "0.62940216", "0.6273373", "0.6164496", "0.586712", "0.5850494", "0.5811628", "0.58027494", "0.5792961", "0.57860476", "0.5784236", "0.5771969", "0.57497245", "0.57469445", "0.57342416", "0.57162094", "0.5714655", "0.56722635", "0.5669556", "0.5601797", "0.55572...
0.8307177
0
End of print_tags Method: print_custom_attributes Purpose: Prints the custom attributes (if any) of the object class passed to it Arguments: object_string : friendly text string name for the object this_object : the Ruby object whose tags are to be printed Returns: None
def print_custom_attributes(object_string, this_object) begin if this_object.respond_to?(:custom_keys) custom_attribute_keys = Array.wrap(this_object.custom_keys) if custom_attribute_keys.length.zero? print_line($recursion_level, "--- no custom attributes ---") else print_line($r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_attributes(object_string, this_object)\n begin\n #\n # Print the attributes of this object\n #\n if this_object.respond_to?(:attributes)\n print_line($recursion_level, \"Debug: this_object.inspected = #{this_object.inspect}\") if $debug\n if this_object.attributes.respond_to?(:keys...
[ "0.74974066", "0.7122771", "0.69482476", "0.6200635", "0.6074842", "0.5990056", "0.5946502", "0.5888241", "0.5779293", "0.56118345", "0.5611337", "0.55958146", "0.54379874", "0.5406638", "0.5398406", "0.5379504", "0.5338478", "0.5294797", "0.5294797", "0.5271711", "0.52399147...
0.8780458
0
End of print_custom_attributes Method: walk_object Purpose: Prints the details of the object passed to it Arguments: indent_level : the numeric value to use to indicate output indent (represents recursion depth) object_string : friendly text string name for the object this_object : the Ruby object to be dumped Returns:...
def walk_object(object_string, this_object) begin # # Make sure that we don't exceed our maximum recursion level # $recursion_level += 1 if $recursion_level > $max_recursion_level print_line($recursion_level, "*** exceeded maximum recursion level ***") $recursion_level -= 1 retur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_custom_attributes(object_string, this_object)\n begin\n if this_object.respond_to?(:custom_keys)\n custom_attribute_keys = Array.wrap(this_object.custom_keys)\n if custom_attribute_keys.length.zero?\n print_line($recursion_level, \"--- no custom attributes ---\")\n else\n ...
[ "0.7560727", "0.7017619", "0.6732748", "0.6185369", "0.609328", "0.6090988", "0.58785987", "0.584458", "0.57857746", "0.57305235", "0.5726411", "0.5608725", "0.5607093", "0.55077946", "0.5441575", "0.5428698", "0.54253703", "0.5412108", "0.5394367", "0.53773934", "0.53701174"...
0.7258275
1
Generate the "official" name for the 7600B form, comprised of the GTC number, the order number , and the mod number, both padded to 4 digits and all separated by dashes.
def name "#{gtc_number}-#{name_str(order_number)}-#{name_str(mod_number)}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_name_with_digit (digit)\n char_array = ('a'..'z').to_a + ('0'..'9').to_a + ['_'] # char_array.length is 37\n\n quotient = digit\n queue = []\n while true do\n queue.push quotient % N_CHAR\n quotient = (quotient / N_CHAR).round - 1\n if quotient <= -1\n break\n en...
[ "0.6776644", "0.6734847", "0.66660166", "0.66488355", "0.6537759", "0.6443229", "0.6412352", "0.63953155", "0.63953155", "0.6392567", "0.6337869", "0.6336105", "0.6314855", "0.6234735", "0.62131804", "0.6210511", "0.620397", "0.618064", "0.6172254", "0.6171528", "0.6165391", ...
0.74425554
0
DELETE /mercadoria/1 DELETE /mercadoria/1.json
def destroy @mercadorium.destroy respond_to do |format| format.html { redirect_to mercadoria_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @asignatura.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @prueba_json.destroy\n respond_to do |format|\n format.html { redirect_to prueba_jsons_url }\n format...
[ "0.7356539", "0.7196844", "0.7193584", "0.7070339", "0.7066652", "0.7063075", "0.70554215", "0.7050196", "0.7041964", "0.7037224", "0.7035154", "0.70142454", "0.7003566", "0.6983386", "0.69828165", "0.69826126", "0.6982392", "0.69792145", "0.69763863", "0.6974049", "0.6969273...
0.7224526
1
POST /permits POST /permits.json
def create @permit = Permit.new(permit_params) @permit.category_id = params[:category_id] @permit.employee_id = params[:employee_id] @permit.site_id = params[:site_id] respond_to do |format| if @permit.save format.html { redirect_to @permit, notice: 'Permit was successfully created.'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @permit = Permit.new(permit_params)\n\n respond_to do |format|\n if @permit.save\n format.html { redirect_to @permit, notice: 'Permit was successfully created.' }\n format.json { render :show, status: :created, location: @permit }\n else\n format.html...
[ "0.7121574", "0.6456046", "0.6390089", "0.6292707", "0.61748934", "0.6170476", "0.6135272", "0.6074082", "0.60365325", "0.6006201", "0.5979559", "0.59678626", "0.5920976", "0.5881255", "0.58673215", "0.5848935", "0.58320343", "0.58314365", "0.58283794", "0.5823748", "0.581901...
0.658533
1
PATCH/PUT /permits/1 PATCH/PUT /permits/1.json
def update @permit.category_id = params[:category_id] @permit.employee_id = params[:employee_id] @permit.site_id = params[:site_id] respond_to do |format| if @permit.update(permit_params) format.html { redirect_to @permit, notice: 'Permit was successfully updated.' } format.j...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @permit.update(permit_params)\n format.html { redirect_to @permit, notice: 'Permit was successfully updated.' }\n format.json { render :show, status: :ok, location: @permit }\n else\n format.html { render :edit }\n form...
[ "0.7037591", "0.6089023", "0.5942867", "0.592158", "0.5903526", "0.5898621", "0.5896345", "0.58882254", "0.58475435", "0.5841189", "0.5823558", "0.5815913", "0.5815889", "0.5787355", "0.57859033", "0.5783836", "0.5781662", "0.576887", "0.57535344", "0.5747716", "0.5733261", ...
0.62426394
1
DELETE /permits/1 DELETE /permits/1.json
def destroy @permit.destroy respond_to do |format| format.html { redirect_to permits_url, notice: 'Permit was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @vehiclepermit.destroy\n respond_to do |format|\n format.html { redirect_to permits_url, notice: 'Permit was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @privilege.destroy\n respond_to do |format|\n format.html { redirect...
[ "0.7002032", "0.69629705", "0.679106", "0.6709306", "0.6706271", "0.6676756", "0.66675395", "0.66483545", "0.66381675", "0.66159225", "0.660326", "0.6602588", "0.65897876", "0.6589017", "0.65862536", "0.6574142", "0.6567747", "0.65636426", "0.65345496", "0.6531613", "0.650761...
0.77983844
0
Checkse if devfile has any user added observers and sends notification to those nodes
def checkForObservers(devfile) begin path = "/user/" + params[:username] + "/device/" + params[:devicename] + "/files" + devfile.path + devfile.name devfile.file_observers.each do |fo| begin if fo XmppHelper::notificationToNode(fo, devfile, "Content updated!") end...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def notify_users_and_add_it\n return # disabled for now\n return true if remote?\n User.find_all_by_notify_on_new_torrents(true).each do |user|\n Notifier.send_new(user,self) if user.notifiable_via_jabber?\n user.watch(self) unless user.dont_watch_new_torrents?\n end\n end", "def listeners...
[ "0.6577711", "0.63400346", "0.6026646", "0.6013105", "0.59164107", "0.59164107", "0.58937824", "0.58516836", "0.58486545", "0.58194673", "0.58098394", "0.58038056", "0.5787016", "0.576124", "0.57510984", "0.57427704", "0.5741569", "0.57150155", "0.5703422", "0.5702", "0.56673...
0.7739362
0
Updates file's metadata to db parameters: f filehash commit the commit the file belongs to
def updateDevfile(f, commit) #:doc: dev_file = nil begin # Checks if there is any changes in files. f_filedate = DateTime.strptime(f['filedate'], "%T %F") f_filedate = f_filedate.strftime('%F %T').to_s now = DateTime.now.strftime('%F %T') puts "name: #{f['name']}...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_file_metadata(data)\n update_attributes!( :file_size => data.bytesize, :file_hash => Digest::SHA1.hexdigest( data ) )\n end", "def update_file_in_db(file_id, filename, public_status, folder_id)\n $db.execute(\"UPDATE files SET file_name = ?, public_status = ?, folder_id = ? WHERE file_id = ?\",...
[ "0.6721979", "0.6275223", "0.62125784", "0.6174687", "0.609163", "0.6052312", "0.6048062", "0.6019263", "0.6007592", "0.5907478", "0.5837032", "0.5811534", "0.5783385", "0.5722229", "0.5706745", "0.56770873", "0.5673615", "0.5644141", "0.5643654", "0.5631918", "0.56115127", ...
0.6593738
1
Creates metadata of a new file to db parameters: f file commit the commit the file belongs to
def createDevfile(f, commit) #:doc: dev_file = nil blob = nil b_in_c = nil # If file already exists, raises an error but nothing needs to be deleted (except the commit is cancelled) begin dev_file = Devfile.find_by_name_and_path_and_device_id(f['name'], f['path'], @device.id) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prepare_db_data( f, cl, tbd, df )\n s = File::Stat.new( f )\n if ! s\n puts \"couldn't stat #{f}\\n\"\n next\n end\n\n # grab extension\n m = /(\\.\\w+)$/.match( f )\n if m && m[1]\n # yes it's redundant, but this way, if the file is outside of it's directory i have half a chance of knowing what...
[ "0.6870998", "0.6798961", "0.65737253", "0.6544489", "0.64065665", "0.64065665", "0.6313486", "0.63081837", "0.6294408", "0.6251297", "0.61757946", "0.61673397", "0.6143448", "0.6133419", "0.60675824", "0.6066988", "0.60098356", "0.6008737", "0.59878284", "0.59601647", "0.593...
0.6989372
0
add blobs from prev_commit to commit ignoring blobs in changed_files parameters: prev_commit The previous commit commit new commit changed_files list of files to ignore
def addUnchangedFilesToCommit(prev_commit, commit, changed_files) #:doc: # sql = "select devfiles.path, devfiles.name, devfiles.blob_id from devfiles, blobs, blobs_in_commits where blobs.devfile_id=devfiles.id and blobs_in_commits.blob_id=blobs.id and blobs_in_commits.commit_id=#{prev_commit.id};" # devfiles_of_p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def modified_files\n @modified_files ||= begin\n @modified_files = []\n\n rewritten_commits.each do |rewritten_commit|\n refs = \"#{rewritten_commit.old_hash} #{rewritten_commit.new_hash}\"\n @modified_files |= Overcommit::GitRepo.modified_files(refs: refs)\n end\n\n ...
[ "0.61535835", "0.585526", "0.58034074", "0.57718384", "0.575526", "0.57442135", "0.57291794", "0.57283944", "0.56657636", "0.5635432", "0.5591248", "0.5588017", "0.555051", "0.55259734", "0.54503167", "0.5441464", "0.5440389", "0.5426088", "0.54245037", "0.5422818", "0.542196...
0.83637303
0
check if commit is missing (some of) it's thumbnails. Sends xmppmessages to the device for the missing thumbnails. parameters: commit the commit in question
def checkForThumbs(commit) #:doc: prev_commit_blob_ids = Array.new prev_commit = Commit.find(:first, :conditions => ["id = ?", commit.previous_commit_id]) if prev_commit prev_commit.blobs.find_each(:batch_size => 1500) do |pb| prev_commit_blob_ids.push(pb.id) end end blobs_w...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_message_format(regex, oldrev, newrev)\n missed_revs = `git rev-list #{oldrev}..#{newrev}`.split(\"\\n\")\n bad_commits = \"\"\n auth_fail = 0\n missed_revs.each do |rev|\n message = `git cat-file commit #{rev} | sed '1,/^$/d'`\n if !regex.match(message) then\n bad_com...
[ "0.56348634", "0.55705476", "0.54291606", "0.539609", "0.5383907", "0.5365913", "0.53337544", "0.5283248", "0.52613395", "0.52486324", "0.52453136", "0.5227515", "0.52217984", "0.5221655", "0.5173013", "0.5149498", "0.51455617", "0.5126359", "0.51229066", "0.51177406", "0.511...
0.7809339
0
Checks that all necessary http parameters are given. parameters: username, password, devicename and dev_type. port is optionla, but if given must be a number. Returns false is some of the parameters is missing or is in wrong form. Returns true if parameters are fine. register uses this method.
def check_params #:doc: if params[:username] !~ /.{1,}/ or params[:password] !~ /.{1,}/ or params[:devicename] !~ /.{1,}/ or params[:dev_type] !~ /.{1,}/ or (params[:port] != nil and params[:port] !~ /\d{1,10}/) return false else return true end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_params\n # For each key,value in GLOBAL VAR **PARAMS**.\n PARAMS.each do |param, method|\n # Next if there isn't param in the request of client\n next unless params[param]\n # Check the *param* with *method*\n unless send(method, params[param])\n ...
[ "0.65269417", "0.649987", "0.62674534", "0.6239871", "0.6229742", "0.62291175", "0.621783", "0.6102586", "0.60032976", "0.59961194", "0.599198", "0.59414464", "0.590808", "0.58970714", "0.58827436", "0.58732766", "0.58732766", "0.5827013", "0.5811307", "0.5790262", "0.5785052...
0.7656105
0
Executes queries using the replica database. Fails over to primary if no replica is found. if you want to execute a block of code on the replica you can go: Account.on_replica do Account.first end the first account will be found on the replica DB For oneliners you can simply do Account.on_replica.first
def on_replica(&block) on_primary_or_replica(:replica, &block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_replica(&block)\n on_master_or_replica(:replica, &block)\n end", "def use_replica_if_available(&block)\n ::Gitlab::Database::LoadBalancing::Session.current.use_replicas_for_read_queries(&block)\n end", "def enable_replica\n begin\n ActiveRecord::Base.connection.enable_replica\n ...
[ "0.7477597", "0.668392", "0.6670695", "0.65752465", "0.608348", "0.608348", "0.60500693", "0.5932167", "0.59185046", "0.58502245", "0.5722108", "0.5598713", "0.5598639", "0.55542797", "0.5521975", "0.55065924", "0.55016047", "0.54923815", "0.5486671", "0.54787755", "0.5448023...
0.7675419
0
Enable saving of unknown barewords. With this, the only way to terminate parsing is to hit the end of the parse or with . You can retrieve the saved words from saved.
def save_unknown! @saved = [] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def configure_save\n save = load_save\n @word = save.word\n @hints = save.hints\n @incorrect = save.incorrect\n @lives = save.lives\n end", "def save_unmatched_words # :nodoc:\n tokens = phrase_without_matches.split(' ')\n unmatched_db = Corpus.new(\"unmatched-#{program_name}.db\")\n ...
[ "0.55728436", "0.5509204", "0.5457359", "0.533028", "0.523965", "0.52024263", "0.5179901", "0.5171566", "0.5164827", "0.51511115", "0.5146599", "0.51216525", "0.5108772", "0.50983286", "0.509507", "0.508494", "0.50693476", "0.50689787", "0.5053207", "0.502266", "0.5001643", ...
0.5656883
0
returns either the banner set with banner= or a simple banner like "Usage: $0 [arguments]"
def banner @banner || "Usage: #{program_prefix} [arguments]" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def banner\n unless @banner\n @banner = +\"Usage: #{program_name} [options]\"\n visit(:add_banner, @banner)\n end\n @banner\n end", "def banner(arg=nil)\n @banner = arg if arg\n @banner || description\n end", "def banner(arg=nil)\n arg.nil? ? @option_parser.banner : (@...
[ "0.843943", "0.8028383", "0.78630704", "0.7684364", "0.7683354", "0.7680522", "0.7669488", "0.76071167", "0.7602126", "0.7580503", "0.7570065", "0.7433965", "0.7418849", "0.7418849", "0.718152", "0.716194", "0.71595234", "0.71306896", "0.7129929", "0.70811784", "0.70571995", ...
0.86538833
0
Check the follower common event call
def check_follower_trigger_there(new_x, new_y) if @follower.x == new_x && @follower.y == new_y if @follower.is_a?(Game_Event) @follower.start else @follower.turn_toward_player $game_temp.common_event_id = Game_CommonEvent::FOLLOWER_SPEECH end return true end r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def following? subject\n has_event? 'follow', subject\n end", "def follow\n\n end", "def followers?\n following?\n end", "def notify_followers_if_necessary\n if state == MERGE_STATE['merge']\n notify_followers(jingle.id, child_jingle.user.id)\n end\n end", "def followed_by?(follower)\n...
[ "0.68459976", "0.6474227", "0.64201474", "0.63934547", "0.62816536", "0.6272473", "0.62413573", "0.62138695", "0.6174677", "0.61198324", "0.61060584", "0.6092439", "0.60899925", "0.6089084", "0.607554", "0.606005", "0.6048661", "0.6039396", "0.60291326", "0.60284", "0.5996545...
0.70777076
0
Execute a contentEditable command
def edit(command, value=nil) command = command.gsub(/_./) { |i| i[1].upcase } focus if value `#{document}.native.execCommand(#{command}, false, #{value})` else `#{document}.native.execCommand(#{command}, false)` end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit(content, editor: nil, command: nil)\n Editor.new(edit_command(editor, command), content: content).open\n end", "def commands\n\t\t\t{\n\t\t\t\t\"edit\" => \"A handy editor commmand\"\n\t\t\t}\n\t\tend", "def execEditorScript _obj, _args\n \"_obj execEditorScript _args;\" \n end", "de...
[ "0.67016417", "0.6207169", "0.6111128", "0.6016891", "0.6016891", "0.5993504", "0.5877074", "0.58044064", "0.57612485", "0.5753503", "0.569014", "0.5690111", "0.565304", "0.5607638", "0.55949473", "0.5586556", "0.55719775", "0.5546431", "0.5538674", "0.55344945", "0.55237323"...
0.7324193
0
Creates an instance of SeriesIndex for each series page, renders it, and writes the output to a file. +series_prefix+ is the String path to the series folder. +series+ is the series currently being processed.
def write_series_index(series_prefix, series, posts, authors) index = SeriesIndex.new(self, source, series_prefix, series, posts, authors) index.render(layouts, site_payload) index.write(dest) # Record the fact that this page has been added, otherwise Site::cleanup will remove it. pages <...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_series_indexes\n series_posts = {}\n\n series = posts.docs.flat_map { |p| p.data[\"series\"] }.compact.uniq\n series.each do |name|\n safe_name = name.gsub(/_|\\P{Word}/, '-').gsub(/-{2,}/, '-').downcase\n path = File.join(\"series\", safe_name)\n\n this_series_posts =...
[ "0.68740076", "0.60683554", "0.60683554", "0.58662814", "0.5787246", "0.5773513", "0.5765061", "0.5740758", "0.5740758", "0.5740758", "0.55970913", "0.5594287", "0.55917275", "0.55168784", "0.54875255", "0.5478108", "0.5463077", "0.54525703", "0.54490393", "0.54209954", "0.53...
0.7945249
0
Gets a series name, and pulls out a markdown header file returning either the rendered markdown, or an empty string
def series_bio(series) bio_path = "_includes/_series_bio/#{to_series_id(series)}.md" return "" unless File.exist?(bio_path) markdownify(File.read(bio_path)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def markdown_title\n render_as_markdown title\n end", "def extract_md_title(item)\n\t\tif (item[:extension] != 'md')\n\t\t\treturn nil\n\t\tend\n\n\t\tcontent = item.raw_content.lines.each{|l|\n\t\t\tif (l.start_with?('# '))\n\t\t\t\treturn l[2..-1].strip()\n\t\t\tend\n\t\t}\n\t\tnil\n\tend", "def title()\...
[ "0.6470619", "0.636914", "0.6249694", "0.614175", "0.5929194", "0.5911448", "0.5909682", "0.5903798", "0.58985376", "0.5889356", "0.58799535", "0.5820013", "0.5725712", "0.5659979", "0.5659979", "0.5653578", "0.56455696", "0.55961025", "0.55942786", "0.55597687", "0.55541897"...
0.66396815
0
return the G of the memory_used
def memory_used_with_g self.memory_memused.map { |i| i / 1000000000.0} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def memused\n @memtotal - @memfree\n end", "def used_space\n size - free_space\n end", "def get_system_used_memory_mb\n # (`free -ml | grep 'Mem:' | awk -F' ' '{ print $3 }'`.strip.to_i rescue 0).round(MEMORY_PRECISION)\n get_system_memory_info_mb[:used_memory]\n end", "def u...
[ "0.8192482", "0.74618405", "0.73698425", "0.725158", "0.72443634", "0.7104819", "0.7021407", "0.6937105", "0.69258064", "0.68833137", "0.68330634", "0.68243206", "0.68224776", "0.67919606", "0.67892736", "0.6735222", "0.6727308", "0.66770434", "0.66379344", "0.6554792", "0.65...
0.8770565
0
Get IPv6 addresses for given network interface
def ip6addr(iface=nil) @ip6addr[iface || default_iface] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ipv_6_address\n data[:ipv_6_address]\n end", "def get_network_by_interface(interface)\n\n ifconfig = `ifconfig`.split(\"\\n\\n\").index_by{|x| x[/\\w+/,0]}\n inet = ifconfig[interface][/inet addr:([^\\s]*)/, 1].split('.')\n broadcast = ifconfig[interface][/Bcast:([^\\s]*)/, 1].split('.')\n ...
[ "0.7116361", "0.6938847", "0.676212", "0.6639546", "0.6615338", "0.65693766", "0.6567787", "0.6519293", "0.64779574", "0.6440461", "0.6368515", "0.6365575", "0.634222", "0.6330421", "0.6313009", "0.6286359", "0.6276088", "0.62156713", "0.62151355", "0.6155032", "0.6131523", ...
0.732161
0
GET /vertices_scene3s GET /vertices_scene3s.json
def index @vertices_scene3s = VerticesScene3.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_vertices_scene3\n @vertices_scene3 = VerticesScene3.find(params[:id])\n end", "def index\n @position_scene3s = PositionScene3.all\n end", "def index\n @vertices_scene1s = VerticesScene1.all\n end", "def vertices_scene3_params\n params.require(:vertices_scene3).permit(:file_name, ...
[ "0.6947419", "0.6527479", "0.6461013", "0.64133304", "0.63261", "0.63257515", "0.6186886", "0.5959536", "0.57730824", "0.5721756", "0.5705856", "0.5575419", "0.55732656", "0.5552519", "0.55313027", "0.5500711", "0.54620427", "0.5449338", "0.54421437", "0.54275167", "0.5427031...
0.7805892
0
POST /vertices_scene3s POST /vertices_scene3s.json
def create @vertices_scene3 = VerticesScene3.new(vertices_scene3_params) respond_to do |format| if @vertices_scene3.save format.html { redirect_to @vertices_scene3, notice: 'Vertices scene3 was successfully created.' } format.json { render :show, status: :created, location: @vertices_scen...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vertices_scene3_params\n params.require(:vertices_scene3).permit(:file_name, :vertices_number, :space_ratio, :position_difference, :colour_difference, :scene_score, :admin_panel_id, :user_panel_id)\n end", "def index\n @vertices_scene3s = VerticesScene3.all\n end", "def set_vertices_scene3\n ...
[ "0.68933517", "0.6723877", "0.66946065", "0.6317433", "0.62770844", "0.61728966", "0.61580074", "0.61064494", "0.60265154", "0.594289", "0.5898349", "0.5845055", "0.5811973", "0.58016104", "0.5799848", "0.5784505", "0.5784068", "0.56881577", "0.5647149", "0.56080943", "0.5563...
0.71943593
0
PATCH/PUT /vertices_scene3s/1 PATCH/PUT /vertices_scene3s/1.json
def update respond_to do |format| if @vertices_scene3.update(vertices_scene3_params) format.html { redirect_to @vertices_scene3, notice: 'Vertices scene3 was successfully updated.' } format.json { render :show, status: :ok, location: @vertices_scene3 } else format.html { render :...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_vertices_scene3\n @vertices_scene3 = VerticesScene3.find(params[:id])\n end", "def update\n respond_to do |format|\n if @vertices_scene1.update(vertices_scene1_params)\n format.html { redirect_to @vertices_scene1, notice: 'Vertices scene1 was successfully updated.' }\n forma...
[ "0.7052359", "0.69707906", "0.6641705", "0.6636305", "0.6583439", "0.6511954", "0.63546145", "0.634106", "0.631423", "0.6267202", "0.618779", "0.61453265", "0.6047909", "0.6009059", "0.5997659", "0.5968267", "0.596286", "0.5947431", "0.58590555", "0.58210963", "0.5792335", ...
0.751043
0
DELETE /vertices_scene3s/1 DELETE /vertices_scene3s/1.json
def destroy @vertices_scene3.destroy respond_to do |format| format.html { redirect_to vertices_scene3s_url, notice: 'Vertices scene3 was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @vertices_scene1.destroy\n respond_to do |format|\n format.html { redirect_to vertices_scene1s_url, notice: 'Vertices scene1 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @vertices_scene2.destroy\n respond_to do |format|\n ...
[ "0.76638055", "0.7407991", "0.731544", "0.72432125", "0.7113815", "0.70814997", "0.70529634", "0.70463", "0.69181985", "0.679274", "0.6759311", "0.6703038", "0.6695807", "0.6664102", "0.65939665", "0.6548531", "0.65463", "0.65247935", "0.6513129", "0.6510034", "0.6486724", ...
0.8029167
0
Execute a read operation with retrying. This method performs server selection for the specified server selector and yields to the provided block, which should execute the initial query operation and return its result. The block will be passed the server selected for the operation. If the block raises an exception, and ...
def read_with_retry(session = nil, server_selector = nil, &block) if session.nil? && server_selector.nil? # Older versions of Mongoid call read_with_retry without arguments. # This is already not correct in a MongoDB 3.6+ environment with # sessions. For compatibility we emulate the legacy...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_with_retry(session = nil, server_selector = nil, &block)\n if session.nil? && server_selector.nil?\n deprecated_legacy_read_with_retry(&block)\n elsif session&.retry_reads?\n modern_read_with_retry(session, server_selector, &block)\n elsif client.max_read_retries > 0...
[ "0.7606874", "0.7516937", "0.7469495", "0.70588434", "0.6869285", "0.6843921", "0.5708621", "0.56916887", "0.55448127", "0.5526731", "0.5522171", "0.552151", "0.53208464", "0.5317746", "0.52924037", "0.5275784", "0.5245559", "0.5212862", "0.5204242", "0.5203501", "0.5188061",...
0.8007451
0
Execute a read operation with a single retry on network errors. This method is used by the driver for some of the internal housekeeping operations. Applicationrequested reads should use read_with_retry rather than this method.
def read_with_one_retry(options = nil) yield rescue Error::SocketError, Error::SocketTimeoutError => e retry_message = options && options[:retry_message] log_retry(e, message: retry_message) yield end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_with_one_retry(options = nil)\n yield\n rescue *retryable_exceptions, Error::PoolError => e\n raise e unless e.write_retryable?\n\n retry_message = options && options[:retry_message]\n log_retry(e, message: retry_message)\n yield\n end", "def retry_read(origi...
[ "0.7040673", "0.69741064", "0.6954268", "0.6710739", "0.6425707", "0.6406525", "0.63887227", "0.6345055", "0.63359636", "0.6294157", "0.62598115", "0.6087128", "0.60760576", "0.60479987", "0.5969055", "0.58734405", "0.586398", "0.5840996", "0.58271146", "0.58090657", "0.58001...
0.7404647
0
Retryable writes wrapper for operations not supporting modern retryable writes. If the driver is configured to use modern retryable writes, this method yields to the passed block exactly once, thus not retrying any writes. If the driver is configured to use legacy retryable writes, this method delegates to legacy_write...
def nro_write_with_retry(session, write_concern, &block) if session && session.client.options[:retry_writes] server = select_server(cluster, ServerSelector.primary, session) yield server else legacy_write_with_retry(nil, session, &block) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def legacy_write_with_retry(server = nil, session = nil)\n # This is the pre-session retry logic, and is not subject to\n # current retryable write specifications.\n # In particular it does not retry on SocketError and SocketTimeoutError.\n attempt = 0\n begin\n attempt += 1\n ...
[ "0.7332594", "0.62673813", "0.60600805", "0.6027896", "0.5854627", "0.57909036", "0.5641635", "0.56081116", "0.5550251", "0.54582137", "0.5435709", "0.5403387", "0.53221714", "0.5262427", "0.51594913", "0.5137914", "0.5129182", "0.5110893", "0.50913984", "0.5053862", "0.50491...
0.7439151
0
Implements legacy write retrying functionality by yielding to the passed block one or more times. This method is used for operations which are not supported by modern retryable writes, such as delete_many and update_many.
def legacy_write_with_retry(server = nil, session = nil) # This is the pre-session retry logic, and is not subject to # current retryable write specifications. # In particular it does not retry on SocketError and SocketTimeoutError. attempt = 0 begin attempt += 1 server ||=...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def retry\n raise \"#{@error_msg_prefix} must be passed a block\" unless block_given?\n\n attempts = 0\n start_time = Time.now\n begin\n attempts += 1\n yield attempts\n rescue InfluxError => e\n if attempts > @max_retries\n @api_client.log(:error, 'Maximum re...
[ "0.6986061", "0.6653464", "0.63490075", "0.6196515", "0.60775375", "0.5983991", "0.5978165", "0.59623253", "0.5922175", "0.5881764", "0.5860333", "0.57798904", "0.57437915", "0.56934613", "0.56842095", "0.5648848", "0.5647232", "0.5636999", "0.56354123", "0.5615424", "0.55967...
0.67037195
1
You are writing the user registration page for a secure web site. On the registration page, the user has to enter a user ID and a password, which has to adhere to the to following criteria: User ID and password cannot be the same User ID and password have to be at least six characters long Password has to contain at le...
def same (user_id, password) if user_id.downcase == password.downcase puts "User ID and password cannot be the same" else puts "Acceptable" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def same(userID, password)\n if (userID != password)\n false\n else (userID == password)\n true\n end\nend", "def validate_password\n puts \"Enter your User ID and Password here.\"\n user_id = gets.chomp\n password = gets.chomp\n\n same(user_id, password)\n long_enough(user_...
[ "0.76981306", "0.75316346", "0.7478769", "0.73651356", "0.7336832", "0.7139013", "0.7021972", "0.70057064", "0.69959897", "0.69346416", "0.68962824", "0.6889446", "0.6813908", "0.67890525", "0.6770607", "0.6770607", "0.67283314", "0.6713639", "0.6695211", "0.66751957", "0.665...
0.76284504
1
Function that accepts a password and determins if it is the word "password." If so, inform the user that the password cannot be the word "password." Else, return acceptable.
def is_password(password) if password.downcase == "password" puts "Password cannot be the word password" else puts "Acceptable" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_password_password(pass)\n if pass.downcase == 'password'\n 'Sorry, password cannot be password.'\n else\n 'Yay, password is not password.'\n end\nend", "def valid_password?(password); end", "def valid_password?(password)\n true\n end", "def password?\n password\n end", "def ...
[ "0.8635047", "0.8300314", "0.7876978", "0.7759409", "0.77545303", "0.7731918", "0.767898", "0.7655154", "0.751973", "0.75145894", "0.7486795", "0.74745005", "0.7455801", "0.73718923", "0.7338057", "0.7338057", "0.73269415", "0.73203856", "0.7289988", "0.728503", "0.72575027",...
0.84099275
1
Challenge Write a method that inputs user ID and password from the user, and then tells the user if the they are acceptable. Write a main method called validate_password that: First lets a user input both user ID and password, Then use the methods above to evaluate if the user ID and password combination is acceptable ...
def validate_password puts "Enter your User ID and Password here." user_id = gets.chomp password = gets.chomp same(user_id, password) long_enough(user_id) long_enough(password) does_not_contain_special(user_id) contains_special(password) is_password(password) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def input(user_id, password)\n if user_id == password\n 'Password and username cannot be the same'\n elsif user_id.length <= 6 && password.length <= 6\n 'Password and username must be at least six characters long'\n end\nend", "def valid_password?(password); end", "def validate_password\n puts 'Enter...
[ "0.787579", "0.738624", "0.72956103", "0.7281831", "0.72310627", "0.72258794", "0.71474636", "0.71118766", "0.70909023", "0.69785327", "0.69628257", "0.69377697", "0.68654037", "0.68412006", "0.68141174", "0.6794655", "0.6747935", "0.67042255", "0.66906774", "0.6677294", "0.6...
0.8541679
0
Nokogiri XML DOM for the current Brominet XML representation of the GUI
def dom_for_gui @dom = Nokogiri::XML self.dump end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def document_root_element; end", "def document\n @doc ||= Nokogiri::XML(@xml)\n end", "def xml_page\n page = BR.html\n Nokogiri::HTML(page)\nend", "def to_dom\n end", "def root_element\n root.xml \n end", "def xml_document\n xml = XML::Document.new\n xml.root = self.to_xml\n ...
[ "0.66034204", "0.6129919", "0.60748994", "0.60726964", "0.5955403", "0.5942814", "0.5925995", "0.5840247", "0.58319783", "0.58319783", "0.58211374", "0.5702781", "0.5672204", "0.5640138", "0.5640138", "0.5640138", "0.5640138", "0.5599672", "0.5513765", "0.55127746", "0.550664...
0.7758821
0
method will get the availability set using the resource group and availability set name will return whether or not the availability set exists.
def get(resource_group, availability_set) begin promise = @client.availability_sets.get(resource_group, availability_set).value! promise.body rescue MsRestAzure::AzureOperationError => e # if the error is that the availability set doe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get\n begin\n @compute_client.availability_sets.get(@rg_name, @as_name)\n rescue MsRestAzure::AzureOperationError => e\n # if the error is that the availability set doesn't exist,\n # just return a nil\n if e.response.status == 404\n puts 'Availability Set Not Fou...
[ "0.7890201", "0.6424305", "0.63078326", "0.62401146", "0.6052578", "0.594958", "0.5788202", "0.5751019", "0.5751019", "0.5751019", "0.5751019", "0.5686802", "0.5665306", "0.563477", "0.5490222", "0.547429", "0.5470106", "0.54405504", "0.54319423", "0.5431734", "0.5400787", ...
0.809806
0
this method will add the availability set if needed. it first checks to make sure the availability set exists, if not, it will create it.
def add(resource_group, availability_set, location) # check if it exists existance_promise = get(resource_group, availability_set) if !existance_promise.nil? OOLog.info("Availability Set #{existance_promise.name} exists in the #{existance_promise.location} region.") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add\n # check if it exists\n as_exist = @compute_client.availability_sets.check_availability_set_exists(@rg_name, @as_name)\n if as_exist\n OOLog.info(\"Availability Set #{@as_name} exists in the #{@location} region.\")\n else\n # need to create the availability set\n O...
[ "0.7660444", "0.61491245", "0.59813905", "0.58553535", "0.58325064", "0.58325064", "0.58325064", "0.58325064", "0.57462674", "0.5707677", "0.5688543", "0.56762767", "0.56389725", "0.56216985", "0.5620077", "0.5520083", "0.5517219", "0.5509976", "0.5502146", "0.5430218", "0.53...
0.6881376
1
create the properties object for creating availability sets
def get_avail_set_props(location) avail_set_props = Azure::ARM::Compute::Models::AvailabilitySetProperties.new # At least two domain faults avail_set_props.platform_fault_domain_count = 2 avail_set_props.platform_update_domain_count = 2 # At this point we do not have virtual machin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_avail_set_properties(location)\n avail_set_props = Azure::ARM::Compute::Models::AvailabilitySetProperties.new\n # At least two domain faults\n avail_set_props.platform_fault_domain_count = 2\n avail_set_props.platform_update_domain_count = 2\n # At this point we...
[ "0.73205966", "0.6218059", "0.62093174", "0.61300576", "0.6094609", "0.60843354", "0.6009558", "0.5990049", "0.59778494", "0.5895734", "0.585492", "0.58155525", "0.58021295", "0.57202053", "0.57202053", "0.5701352", "0.5646623", "0.55853707", "0.55706793", "0.5565353", "0.547...
0.71745366
1
Marks the current model as a canhaz subject for authorizations
def acts_as_canhaz_object include Canhaz::Mongoid::ObjectExtensions class_eval do has_many :permissions_subjects, :class_name => 'Canhaz::Mongoid::Permission', :inverse_of => 'cobject' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assign_canned_subject\n self.subject = canned_subject\n end", "def set_customer\n @customer = Customer.find(params[:id])\n \tauthorize [:admin, @customer]\n end", "def authorizer\n current_ability\n end", "def set_course\n @course = Course.find(params[:id])\n authorize @cours...
[ "0.64719343", "0.5896642", "0.57816106", "0.5768552", "0.5690575", "0.56610197", "0.55483085", "0.55109125", "0.5484293", "0.54701066", "0.5452519", "0.5452519", "0.5452519", "0.54390347", "0.5424163", "0.5422204", "0.5422204", "0.54215163", "0.54131734", "0.5393618", "0.5380...
0.60927516
1
GET /ingresos GET /ingresos.xml
def index @ingresos = Ingreso.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @ingresos } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @ingreso = Ingreso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ingreso }\n end\n end", "def get_xml\n response = @api.request(:get, @location, type: 'xml')\n response.body if response.status == 200\n ...
[ "0.67602265", "0.6271438", "0.62083125", "0.60266566", "0.5962408", "0.59559155", "0.59559155", "0.58988243", "0.58932346", "0.58791804", "0.5857486", "0.585649", "0.58455694", "0.583912", "0.583427", "0.5833589", "0.5796497", "0.5776844", "0.5776839", "0.57741034", "0.577281...
0.71346986
0
GET /ingresos/1 GET /ingresos/1.xml
def show @ingreso = Ingreso.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @ingreso } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @ingresos = Ingreso.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ingresos }\n end\n end", "def get_xml\n response = @api.request(:get, @location, type: 'xml')\n response.body if response.status == 200\n end", "d...
[ "0.6978563", "0.64224344", "0.6353134", "0.61663", "0.6113216", "0.6072116", "0.6072116", "0.6062996", "0.60625", "0.59631974", "0.59577423", "0.5953989", "0.5944342", "0.5931804", "0.5924002", "0.59162825", "0.588399", "0.5879852", "0.58795863", "0.58775866", "0.5870448", ...
0.6912649
1
GET /ingresos/new GET /ingresos/new.xml
def new @ingreso = Ingreso.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @ingreso } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @coating }\n end\n end", "def new\n @nossos_servico = NossosServico.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nossos_servico }\n end...
[ "0.668019", "0.6678379", "0.66758555", "0.6655681", "0.6642961", "0.6627256", "0.65785176", "0.6572661", "0.656599", "0.656554", "0.656096", "0.65548366", "0.65413344", "0.652003", "0.6502952", "0.64999324", "0.6478015", "0.64550453", "0.64550453", "0.64550453", "0.6444026", ...
0.72669965
0
POST /ingresos POST /ingresos.xml
def create @ingreso = Ingreso.new(params[:ingreso]) respond_to do |format| if @ingreso.save format.html { redirect_to(@ingreso, :notice => 'Ingreso was successfully created.') } format.xml { render :xml => @ingreso, :status => :created, :location => @ingreso } else format.h...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post(xmldoc)\n headers = {'Content-Type' => 'text/xml'}\n check_response( @httpcli.post(@endpoint, xmldoc, headers) )\n end", "def send_request( xml )\n write( xml )\n read\n end", "def post(uri, xml)\r\n req = Net::HTTP::Post.new(uri)\r\n req[\"content-type\"] = \"application...
[ "0.58762264", "0.5812487", "0.5627592", "0.5627289", "0.55471057", "0.5541224", "0.55269754", "0.5508053", "0.5506226", "0.5467767", "0.54398656", "0.5438833", "0.53721565", "0.5359356", "0.53447753", "0.5324208", "0.53221524", "0.5316563", "0.52632326", "0.5260282", "0.52530...
0.58996
0
DELETE /ingresos/1 DELETE /ingresos/1.xml
def destroy @ingreso = Ingreso.find(params[:id]) @ingreso.destroy respond_to do |format| format.html { redirect_to(ingresos_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end", "def delete()\n response = send_post_request(@xml_api_del...
[ "0.697945", "0.68795466", "0.6879137", "0.68102634", "0.65807986", "0.6395754", "0.63243705", "0.6322572", "0.6319816", "0.63187414", "0.63141567", "0.62983614", "0.6297758", "0.6286887", "0.6279561", "0.62663656", "0.62656796", "0.62638044", "0.62575054", "0.62342495", "0.62...
0.7006518
0
RESTful DELETE of the node resource
def destroy n = Node.find_key(params[:id] || params[:name]) render api_delete Node end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n authorize! :destroy, @node\n\n @node.destroy\n respond_to do |format|\n format.html { redirect_to nodes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @node = Node.find_key(params[:id] || params[:name])\n @node.destroy\n respond_to do |format|\...
[ "0.8125971", "0.809001", "0.8016774", "0.8016774", "0.8016774", "0.8004176", "0.8004176", "0.8004176", "0.8004176", "0.8004176", "0.79829395", "0.7981677", "0.79283303", "0.7916526", "0.78869337", "0.77878803", "0.77592057", "0.77592057", "0.77592057", "0.76455164", "0.763688...
0.81326723
0
Formula for side (2 cos[((n2) pi)/ (2 n)]
def side_length top = (@num_sides - 2) * Math::PI angle = top / (2 * @num_sides) @side_length = 2 * Math.cos(angle) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def side_from_sas(side1, angle, side2)\n Math.sqrt(\n (\n side1**2 + side2**2\n ) - (\n 2 * side1 * side2 * Math.cos(\n (angle * (Math::PI / 180))\n )\n )\n )\n end", "def cosine_omega\r\n lat_r = @latitude * @d2r\r\n d...
[ "0.65044355", "0.6304851", "0.62605315", "0.62544316", "0.62100244", "0.6194194", "0.61713237", "0.6136885", "0.6047905", "0.60448945", "0.5999373", "0.59327984", "0.5929859", "0.5905732", "0.58814245", "0.5877291", "0.58489364", "0.58431923", "0.5799411", "0.5769594", "0.576...
0.6352075
1
Agent filters are always present no matter what, so we cant raise an error if the capabilities suggest the discovery method cant do agents we just have to rely on the discovery plugin to not do stupid things in the presense of a agent filter
def check_capabilities(filter) capabilities = ddl.discovery_interface[:capabilities] unless capabilities.include?(:classes) raise "Cannot use class filters while using the '%s' discovery method" % discovery_method unless filter["cf_class"].empty? end unless capabilities.include?(:facts...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_filter(agent, filters, vars)\n agent.reset\n if filters[:discovery]\n agent.discover({:nodes => filters[:discovery]})\n else\n ['identity', 'fact', 'class', 'compound'].each do |kind|\n next unless filters[kind]\n add_filter = agent.method(\"#{kind}_filter\".to_sym)\n if filters[kin...
[ "0.6517474", "0.61861545", "0.5951934", "0.58789355", "0.5854995", "0.5852562", "0.5740693", "0.57117724", "0.5682581", "0.5487009", "0.54166657", "0.54166657", "0.52910566", "0.52450705", "0.5234832", "0.5220964", "0.5194587", "0.51904994", "0.51809955", "0.51784015", "0.517...
0.6375558
1
checks if compound filters are used and then forces the 'mc' discovery plugin
def force_discovery_method_by_filter(filter) unless discovery_method == "mc" unless filter["compound"].empty? Log.info "Switching to mc discovery method because compound filters are used" @client.options[:discovery_method] = "mc" return true end end retu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def or_filters_provided?\n true\n end", "def advanced_filters_provided?\n true\n end", "def apply_filter_config\r\n exec(\r\n 'require_once(\"shaper.inc\");',\r\n 'require_once(\"filter.inc\");',\r\n 'filter_configure_sync();'\r\n )\r...
[ "0.60175973", "0.5943134", "0.58652806", "0.58121777", "0.5759418", "0.5694268", "0.56464165", "0.5602484", "0.5596665", "0.55617255", "0.5529939", "0.552418", "0.55021983", "0.54675096", "0.5450949", "0.5450949", "0.54447466", "0.5443823", "0.5436667", "0.53854954", "0.53738...
0.7692432
0
if a compound filter is specified and it has any function then we read the DDL for each of those plugins and sum up the timeout declared in the DDL
def timeout_for_compound_filter(compound_filter) return 0 if compound_filter.nil? || compound_filter.empty? timeout = 0 compound_filter.each do |filter| filter.each do |statement| if statement["fstatement"] pluginname = Data.pluginname(statement["fstatement"]["name"]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ts_apply_filters\n # TODO: Make filters for Thinking Sphinx\n end", "def postFetchFilter\n @filtered= Filter.new(@detail.waypoints)\n\n # caches with warnings we choose not to include.\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['includeArchived']\n @appliedFilter...
[ "0.5582322", "0.5468602", "0.54093206", "0.53345585", "0.5278474", "0.52157444", "0.52079964", "0.51683015", "0.516706", "0.49910915", "0.49835807", "0.496885", "0.496885", "0.49558488", "0.49135563", "0.49094322", "0.4895519", "0.48122942", "0.48080233", "0.474341", "0.47434...
0.74729615
0
This should be called if you cannot find a paper through other means.
def fallback_to_first_possible_paper_reference model = @model_hash.values.detect { |model| model.try(:paper) } model.try(:paper) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def no_in_paper(paper = nil)\n if paper\n self.exam_papers_sections_exercises.where(exam_paper_id: paper.id).first.no_in_paper\n else\n # TODO\n self.exam_papers_sections_exercises.first.no_in_paper\n end\n end", "def best_hand\n raise\n end", "def associate_paper\n @paper = par...
[ "0.572399", "0.5189357", "0.5138551", "0.5111548", "0.5028924", "0.48507679", "0.48505953", "0.48331365", "0.4818173", "0.4807173", "0.479361", "0.47638682", "0.47476536", "0.47286904", "0.47204068", "0.4695673", "0.4673442", "0.4673442", "0.4673442", "0.4673442", "0.4673442"...
0.5293596
1
Read a yaml file containing a menu
def read_yml_menu(filename) # Load the yaml file into a hash settings = YAML::load_file filename # These are now hashes with ingredient name as key # with hashes representing ingredients, that contain metadata such as prices meats = settings[:ingredients][:meats] vegetables = settings[:ingredi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read file=STDIN\n\n yaml = case file\n when String\n raise \"Input file not defined\" unless file\n raise \"Input file does not exist\" unless File.exist? file\n raise \"Input file is not readable \" unless File.readable? file\n \n ...
[ "0.6833438", "0.68146545", "0.6746245", "0.67328376", "0.6678069", "0.6618213", "0.66043437", "0.65463096", "0.6497463", "0.6431694", "0.63932216", "0.6368525", "0.6357535", "0.63554156", "0.6302693", "0.6274248", "0.6261842", "0.6261842", "0.6194424", "0.61614686", "0.615865...
0.73081005
0
Convert a hash of ingredients with metadata to a list of Ingredient objects
def hash_to_ingredient(dict) ingredients = Array.new # Each ingredient has name as key, and metadata as a dictionary. # At this point, we just extract the price, but we can expand this later dict.each do |name,ingr| ingredients.push(Salads::Ingredient.new(name, ingr["price"])) end return...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ingredients\n recipe_ingredients.map do |r|\n r.ingredient\n end\n end", "def ingredients\n recipeingredient.map {|ri| ri.ingredient}\n end", "def parse_ingredients(ingredients)\n ret = {}\n ingredients.each do |ingredient|\n ing = parse_ingredient ingredient\n ret[ing.name....
[ "0.67869824", "0.6668641", "0.65020543", "0.63234955", "0.63051885", "0.6261077", "0.6194189", "0.6178999", "0.6157826", "0.61116165", "0.6081471", "0.5999418", "0.5971214", "0.5936107", "0.59352404", "0.5934728", "0.58762556", "0.58576584", "0.58471256", "0.5819716", "0.5809...
0.77040833
0
POST /stock_medicas POST /stock_medicas.json
def create @stock_medica = StockMedica.new(stock_medica_params) respond_to do |format| if @stock_medica.save format.html { redirect_to @stock_medica, notice: 'Fue Crado stock' } format.json { render :show, status: :created, location: @stock_medica } else format.html { ren...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stock_medica_params\n params.require(:stock_medica).permit(:cantidad, :medicamento_id)\n end", "def medicine_stock_params\n params.require(:medicine_stock).permit(:nome, :validade, :quantidade, :doenca)\n end", "def set_stock_medica\n @stock_medica = StockMedica.find(params[:id])\n ...
[ "0.68674546", "0.6660177", "0.6512324", "0.6466735", "0.6261089", "0.61612463", "0.61439186", "0.61146367", "0.6107671", "0.6107671", "0.6107671", "0.6107671", "0.6090492", "0.6090492", "0.6090492", "0.6090492", "0.6090492", "0.6090492", "0.60767686", "0.60551775", "0.6045734...
0.70743656
0
PATCH/PUT /stock_medicas/1 PATCH/PUT /stock_medicas/1.json
def update respond_to do |format| if @stock_medica.update(stock_medica_params) format.html { redirect_to @stock_medica, notice: 'Stock medica was successfully updated.' } format.json { render :show, status: :ok, location: @stock_medica } else format.html { render :edit } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @mateStock = MateStock.find(params[:id])\n\n respond_to do |format|\n if @mateStock.update_attributes(params[:mate_stock])\n format.html { redirect_to action: 'index', notice: 'Mate Stock was successfully updated.' }\n format.json { head :no_content }\n else\n form...
[ "0.6946556", "0.67807496", "0.67807496", "0.67807496", "0.67689514", "0.6759047", "0.6759047", "0.67585766", "0.67543346", "0.6736714", "0.6713804", "0.6711271", "0.670289", "0.6688767", "0.6688767", "0.6688767", "0.6688767", "0.6688767", "0.6688767", "0.6688767", "0.6688767"...
0.7168848
0
DELETE /stock_medicas/1 DELETE /stock_medicas/1.json
def destroy @stock_medica.destroy respond_to do |format| format.html { redirect_to stock_medicas_url, notice: 'Stock medica was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @stock.destroy\n respond_to do |format|\n format.html { redirect_to stocks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @stock.destroy\n respond_to do |format|\n format.html { redirect_to stocks_url }\n format.json { head :no_content }\n ...
[ "0.7307248", "0.7307248", "0.72975355", "0.7288655", "0.72691363", "0.72635055", "0.72635055", "0.72635055", "0.72635055", "0.72635055", "0.72635055", "0.72067565", "0.7117722", "0.7105835", "0.7072678", "0.7072678", "0.7072678", "0.7072678", "0.7072678", "0.7072678", "0.7072...
0.7680024
0
The number of rotational degrees required to display this image as upright
def required_rotation_for_upright_display required_rotation_orientation_in_degrees = (360 - self.orientation) % 360 return required_rotation_orientation_in_degrees end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def min_angle\n 6 * self.min\n end", "def max_tilt_angle; end", "def orientation \n @position - @prev_position\n end", "def degrees\n self * Math::PI / 180\n end", "def anglecw\n 360 - angle\n end", "def degrees\n self * Math::PI / 180.0\n end", "def height\n a = se...
[ "0.6687296", "0.6622544", "0.65924317", "0.65175134", "0.6424557", "0.6412511", "0.63951766", "0.6316775", "0.6288307", "0.6240502", "0.6186721", "0.6171652", "0.6130817", "0.6097932", "0.603196", "0.60202736", "0.6016953", "0.6011782", "0.59828997", "0.5945087", "0.59216946"...
0.78179806
0
Extracts an UID (room, grouping or app) from an URL/path.
def uid_from_path(url, base_store_url) return [:main, 0] if url.include?(base_store_url) return [:category, url.match(/viewGenre\?id\=(\d+)/)[1]] if url.include?("viewGenre?id=") return [:category, url.match(/viewGrouping\?id\=(\d+)/)[1]] if url.include?("viewGrouping?id=") return [:roo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_id\n return link.split(\"/\")[2]\n end", "def parse_site_user_id_from_url url\n url.scan(/cc\\/blog\\/([^\\/]+)/)[0][0].downcase rescue nil\n end", "def uid\n return nil unless user_id\n user_id.split('/').first\n end", "def uid\n return nil unless user_id\n user_id.split('/').f...
[ "0.7059051", "0.69124836", "0.6678153", "0.6678153", "0.6591005", "0.65751207", "0.65533423", "0.65050286", "0.6481659", "0.6453909", "0.6449052", "0.6428161", "0.63630307", "0.6361559", "0.6317997", "0.62547845", "0.6245712", "0.60574", "0.6031949", "0.60137314", "0.59629047...
0.741962
0
certinfos should be a hashlike where each entry describes a certificate. defaulthostname should be a string that will be inserted into %HOSTNAME% in certificate subject lines.
def initialize(certinfos, defaulthostname, config={}) @config = config @defaulthostname = defaulthostname @parenthostname = defaulthostname.sub(/^[\w-]+\./, '') # remove left-most label @certinfos = certinfos @certificates = {} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_subject_alternative_names(cert, factory, alt_names)\n fail 'alt_names must be an Array' unless alt_names.is_a?(Array)\n\n name_list = alt_names.map { |m| \"DNS:#{m}\" }.join(',')\n ext = factory.create_ext('subjectAltName', name_list, false)\n cert.add_extension(ext)\...
[ "0.5406824", "0.5148661", "0.50500333", "0.5033091", "0.50141954", "0.5010699", "0.50072384", "0.5003043", "0.49615765", "0.496073", "0.49592632", "0.49552926", "0.49547872", "0.49527764", "0.4935965", "0.49324802", "0.48976794", "0.48876724", "0.4883321", "0.4829508", "0.479...
0.74490815
0
FUNCTIONS a_anno 0:chr 1:pos 3:oldBase 4:newBase 5:quality 10:gene 11:/+ 12:exon/intron/promotor a_gen 1:gene 2:chr 3:+/ 4:start 5:stop 6:start_coding 7:end_coding 8:ofExons 9:ExonStarts 10:exonEnds
def mutations_effect(a_anno, a_gen) if $locus[a_anno[10]] && a_anno[3].length == a_anno[4].length $cdna.pos = $locus[a_anno[10]] transcript = original() exon_starts = a_gen[9].split(',') exon_ends = a_gen[10].split(',') mutation_position,exon_num = position_on_transcript(a_anno[1],a_gen[3],exon_s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def annotate\n genes={}\n File.open(ANNOTATION,'r').each do |line|\n temp=line.split\n genes[temp[9]]={}\n genes[temp[9]][\"start\"]=temp[3].to_i\n genes[temp[9]][\"end\"]=temp[4].to_i\n genes[temp[9]][\"strand\"]=temp[6]\n genes[temp[9]][\"length\"]=temp[4].to_i - 1 - temp[3].to_i\n end\n re...
[ "0.64421415", "0.5789212", "0.56554943", "0.56016725", "0.55067724", "0.5491933", "0.54730046", "0.54730046", "0.54730046", "0.54730046", "0.54730046", "0.54730046", "0.54730046", "0.54730046", "0.53668576", "0.533807", "0.530334", "0.5302836", "0.5302836", "0.5301391", "0.52...
0.6931948
0
GET /slow_things GET /slow_things.json
def index @slow_things = SlowThing.all respond_with @slow_things if stale? @slow_things, public: true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n respond_with @slow_thing if stale? @slow_thing, public: true\n end", "def index\n # sleep 3 # simulate a slow connection\n render json: Secret.all.reverse\n end", "def interesting(options = {})\n response = Typhoeus::Request.get(\"#{DARKSKY_API_URL}/interesting/#{@api_key}\", DEFAUL...
[ "0.5984558", "0.59120774", "0.5740068", "0.57172483", "0.5641928", "0.55835277", "0.55741984", "0.5570309", "0.5537178", "0.55098784", "0.5508085", "0.55048484", "0.5489543", "0.5489199", "0.5468746", "0.546777", "0.546486", "0.54524916", "0.54512143", "0.5450417", "0.5424806...
0.7145652
0
GET /slow_things/1 GET /slow_things/1.json
def show respond_with @slow_thing if stale? @slow_thing, public: true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @slow_things = SlowThing.all\n respond_with @slow_things if stale? @slow_things, public: true\n end", "def show\n @thing = Thing.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @thing }\n end\n end", "def index\n ...
[ "0.6930858", "0.58509856", "0.5813788", "0.5804802", "0.57894963", "0.5727108", "0.5678024", "0.5666806", "0.5627441", "0.5572159", "0.5568189", "0.55662334", "0.5565507", "0.5562831", "0.55625254", "0.55625254", "0.55449766", "0.5539758", "0.5525033", "0.55235505", "0.551996...
0.60379285
1
POST /slow_things POST /slow_things.json
def create @slow_thing = SlowThing.new(slow_thing_params) respond_to do |format| if @slow_thing.save domain = URI(root_url) Net::HTTP.start(domain.host, domain.port) do |http| Rails.logger.debug "purging #{domain}" http.request( Purge.new(domain) ) Rails.lo...
{ "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 slow_thing_params\n params.require(:slow_thing).permit(:name)\n end", "def long_slow_post(host, rate_limit, keep_alive) \r\n\trequest = ...
[ "0.59808415", "0.58987194", "0.5499058", "0.54937506", "0.5456881", "0.54096574", "0.53225213", "0.5315783", "0.5288149", "0.5279808", "0.5272885", "0.52636254", "0.52452856", "0.52263284", "0.5198195", "0.51827645", "0.5175397", "0.5158314", "0.5157859", "0.515723", "0.51291...
0.6336423
0
PATCH/PUT /slow_things/1 PATCH/PUT /slow_things/1.json
def update respond_to do |format| if @slow_thing.update(slow_thing_params) domain = URI(root_url) Net::HTTP.start(domain.host, domain.port) do |http| Rails.logger.debug "purging #{domain}" http.request( Purge.new(domain) ) Rails.logger.debug "purging #{slow_thin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end", "def patch!\n request! :patch\n end", "def update\n @thing = Thin...
[ "0.61767423", "0.6167336", "0.60733217", "0.5991576", "0.5977999", "0.5906642", "0.58816624", "0.5870645", "0.5865846", "0.5850524", "0.5814966", "0.5812773", "0.5788376", "0.5788376", "0.5788376", "0.5770086", "0.5765108", "0.5759052", "0.57523924", "0.5696049", "0.5691312",...
0.6187133
0
DELETE /slow_things/1 DELETE /slow_things/1.json
def destroy @slow_thing.destroy respond_to do |format| format.html { redirect_to slow_things_url, notice: 'Slow thing was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n client.delete(\"/#{id}\")\n end", "def delete\n client.delete(url)\n @deleted = true\nend", "def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end", "def delete!( opts = {} )\n http_...
[ "0.6906653", "0.6830822", "0.6699254", "0.6637343", "0.6631996", "0.6631996", "0.6583462", "0.65665853", "0.65101385", "0.65005887", "0.64581996", "0.6431477", "0.6429327", "0.6394287", "0.6376216", "0.6370607", "0.6327913", "0.6327492", "0.6314071", "0.63041776", "0.63016164...
0.69605523
0
Takes an array of strings, each representing a line Draws a box around the lines, and returns a new array padding may be provided
def box_it(array_of_lines, padding = 1, _box_colour = :bc_cyan) max_length = max_box_line_length(array_of_lines) pad_string = "\s" * padding box_lines = [ # Set the top box line "#{BOX_TOP_LEFT}#{BOX_HORIZONTAL_LINE * (max_length + (padding + 1))}#{BOX_TOP_RIGHT}" ] array...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_line(arr)\n x = TTY::Screen.width - 2\n small_items = 12\n first_item = x - 5 * small_items\n\n output = \"\"\n arr.each_with_index do |l, i|\n if i == 0\n output << l.to_s[0..first_item].ljust(first_item)\n else\n output << l.to_s[0..small_items].ljust(small_items...
[ "0.6492443", "0.6049305", "0.6040567", "0.60036755", "0.59825855", "0.5976544", "0.58638805", "0.5800494", "0.57781017", "0.5757104", "0.5705841", "0.5682537", "0.5593508", "0.5583972", "0.5553343", "0.551409", "0.54761165", "0.54586524", "0.54494214", "0.54325145", "0.543062...
0.7717645
0
MUST BE CALLED BY User.deliver_inactive_notification!
def inactive_notification(user) setup_email(user) @subject += subject_from_sym :inactive_notification @body[:name] = user.full_name || 'Eternos user' @body[:link] = account_setup_url(:id => user.perishable_token) add_category_header "Inactive Account Notice" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inactive_message; end", "def inactive_message; end", "def atest_ID_25861_suspended_user_notification()\n # Need suspended account\n end", "def atest_ID_25861_suspended_user_notification()\n # Need suspended account\n end", "def do_notify_disabled(transition)\n if user && Rails.application....
[ "0.70507026", "0.70507026", "0.70283043", "0.70283043", "0.69109446", "0.6864436", "0.6834575", "0.6804752", "0.679606", "0.6727194", "0.6695414", "0.66756546", "0.66666704", "0.66268843", "0.6583416", "0.65809834", "0.65647185", "0.6552468", "0.6536999", "0.6518272", "0.6498...
0.77993435
0
MUST BE CALLED BY User.deliver_account_setup_reminder!
def account_setup_reminder(user) setup_email(user) @subject = subject_from_sym :account_setup_reminder @body[:name] = user.full_name @body[:setup_url] = account_setup_url(:id => user.perishable_token, :ref => 'asr1') add_category_header "Account Setup Reminder" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_activation_or_reset_mail\n end", "def after_create_action\n sign_up_lead_rescuer\n send_email_to_lead_rescuer\n end", "def after_save(user)\n\n UserMailer.deliver_activation(user) if user.recently_activated? unless user.setup\n UserMailer.deliver_forgot_password(user) if user.recently_fo...
[ "0.6606731", "0.6575148", "0.6507075", "0.6507047", "0.64802533", "0.6461195", "0.641412", "0.64070123", "0.6403233", "0.640216", "0.6299094", "0.6288094", "0.6287524", "0.6253214", "0.6253214", "0.62082803", "0.62022585", "0.6196795", "0.61901027", "0.61893815", "0.61779714"...
0.7663771
0
Returns the current status of the state. This includes: Player status Room description Room's treasure Room's monster
def status output = StringIO.new output << @game.player.to_s output << "\n" output << "#{@game.current_room_model.description}\n" treasure = @game.current_room_model.treasure output << "\nThere is treasure here worth $#{treasure}.\n" if treasure && treasure > 0 monster = @game.current_roo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def status\n monster = @game.current_room_model.monster\n return unless monster\n\n weapons = @game.player.weapons\n\n output = \"Fighting against #{monster.name}\\n\"\n weapons.each_with_index do |weapon, i|\n output << \"#{i + 1} - #{weapon}\\n\"\n end\n\n output\n end", "def current...
[ "0.7418323", "0.7196079", "0.71288174", "0.695458", "0.6867524", "0.6855135", "0.68458354", "0.67172885", "0.6707165", "0.6702644", "0.6693608", "0.6693608", "0.6685253", "0.66622025", "0.6658545", "0.66447294", "0.65976554", "0.6577174", "0.6545302", "0.6545302", "0.6540487"...
0.7400184
1
Handles a command for this state. +command+ must be a symbol Possible commands: :north : Moves you to north :south : Moves you to south :east : Moves you to east :west : Moves you to west :up : Moves you to up :down : Moves you to down :tally : Shows you the current score and number of monsters killed :run : Tries to r...
def handle(command) puts "Doing #{command}..." method = command case command when :north then method = :move when :south then method = :move when :east then method = :move when :west then method = :move when :up then method = :move when :down then method = :move end ou...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_commands(command) # rubocop:todo Metrics/CyclomaticComplexity\n case command\n when '/start'\n greet_user\n when '/stop'\n send_message \"Bye, #{message.from.first_name}\"\n when '/help'\n send_message \"Please enter any of the following commands: #{@commands}\"\n when '/ne...
[ "0.72250944", "0.694959", "0.68654424", "0.68584615", "0.6844924", "0.68447775", "0.6775846", "0.66902363", "0.6613155", "0.65450585", "0.65082353", "0.6505146", "0.64745176", "0.6458155", "0.6451383", "0.6414209", "0.6382764", "0.6365964", "0.6321472", "0.63044596", "0.63027...
0.7829914
0
Pickup the treasure in the room if there is any
def pick_up treasure = @game.current_room_model.treasure has_torch = @game.player.has_torch? return "There is no treasure to pick up\n" unless treasure && treasure > 0 return "You cannot see where it is\n" unless has_torch @game.player.wealth += treasure return "You picked-up gems worth $#{tr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pick_up(item)\n @items.push(item) unless items_weight + item.weight > CAPACITY\n @equipped_weapon = item if item.is_a?(Weapon) \n if item.is_a?(BoxOfBolts) \n item.feed(self) if self.health <= 80\n end\n end", "def pick_up(item_name)\n if current_room.has_item(item_name)\n item = c...
[ "0.6829087", "0.6488601", "0.6486497", "0.6458919", "0.6366758", "0.63478595", "0.6226282", "0.62037694", "0.61397445", "0.61397445", "0.61397445", "0.611368", "0.6049674", "0.59981954", "0.59724754", "0.59649205", "0.59354746", "0.5917451", "0.5849084", "0.58271927", "0.5781...
0.75312513
0
Transitions to the buying state
def inventory @game.state = BuyingState.new @game @game.state.handle end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def perform_state_update\n return unless state_changed?\n\n return if @ignore_state_changes\n\n case state_change\n when %w(mill_build buyer_unclaimed)\n transition_mill_build_to_buyer_unclaimed\n when %w(buyer_unclaimed buyer_build)\n transition_buyer_unclaimed_buyer_build\n when %w(bu...
[ "0.61791754", "0.5880421", "0.5840531", "0.5817714", "0.57507575", "0.5735825", "0.56918764", "0.5656137", "0.5631318", "0.5628945", "0.56050783", "0.5581032", "0.556287", "0.55328834", "0.552604", "0.5525676", "0.5499529", "0.54718024", "0.5467789", "0.54663014", "0.5457844"...
0.59932315
1
Converts +sexp+ into a Compiler::Node.
def sexp_to_node(sexp) return nil if sexp.nil? if node_class = Node::Mapping[sexp.first] node_class.create(self, sexp) else raise Error, "Unable to resolve '#{sexp.first.inspect}'" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sexp_to_ast(sexp)\n eval sexp\n end", "def compile_sexp(scope, *exp)\n compile_do(SexpScope.new(scope), *exp)\n end", "def compile_sexp(scope, *exp)\n compile_do(SexpScope.new(scope), *exp)\n end", "def expression sexp\n return nil if sexp == nil\n #pp sexp\n body = sexp.sexp_bod...
[ "0.70163244", "0.6789324", "0.6789324", "0.63605344", "0.63386464", "0.63065004", "0.588651", "0.5862931", "0.58546233", "0.5839368", "0.5668713", "0.5668713", "0.5547117", "0.544543", "0.5395736", "0.53711784", "0.53648275", "0.5350735", "0.53485763", "0.52576387", "0.523495...
0.73390305
0
Everything should have the same album tag
def all_same_album?(tags) all_same_tag?(tags, :album) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def album\r\n #prepare_new_album extracted for reuse from spec\r\n prepare_new_album unless @content\r\n end", "def target_albums(picture)\n self.albums.reject{ |album| album.pictures.include?(picture) }\n end", "def album_name_unique?(album_name, artist_name) \n album_names = self.albums.select{...
[ "0.6923608", "0.67246413", "0.6523389", "0.65015626", "0.6436978", "0.6390941", "0.6377134", "0.6305919", "0.6252742", "0.62405795", "0.62250346", "0.619325", "0.6103119", "0.6096799", "0.6064998", "0.603348", "0.6000499", "0.5995257", "0.5979279", "0.59691954", "0.5966707", ...
0.76919574
0
Everything should have the same year tag
def all_same_year?(tags) all_same_tag?(tags, :year) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def year() end", "def match_year?(doc, date)\n return true unless year\n\n idate = RelatonBib.parse_date doc[\"issued-date\"], false\n idate.between? date, date.next_year.prev_day\n end", "def year? = unit == 'year'", "def year; end", "def year; end", "def could_be_year?(year); end", ...
[ "0.7077845", "0.7006944", "0.69565284", "0.68290323", "0.68290323", "0.66205627", "0.6616259", "0.6578683", "0.6476764", "0.64315605", "0.6416924", "0.6416281", "0.6391615", "0.6381706", "0.6340546", "0.63311565", "0.63275373", "0.63248825", "0.6311434", "0.6299756", "0.62830...
0.76637894
0
And probably of the same genre. (Who cares, really, about the genre tag anyway?)
def all_same_genre?(tags) all_same_tag?(tags, :genre) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def genres\n songs.collect do |song|\n song.genre\n end\n .uniq #does not return duplicate genres if the artist has more than one song of a particular genre (artist has many genres through songs)\n end", "def genre; end", "def genre; end", "def genre\n genres = tracks....
[ "0.7438682", "0.73783296", "0.73783296", "0.73542935", "0.7340227", "0.71654063", "0.7084807", "0.7070509", "0.70590407", "0.70494056", "0.70195603", "0.69873226", "0.6970553", "0.69408435", "0.69408435", "0.6923133", "0.6910801", "0.69086796", "0.6896273", "0.68304724", "0.6...
0.7803016
0
Get the relevant tags for all files.
def all_tags(files) supported(files).map { |f| Aur::FileInfo.new(f).our_tags } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_all_files\n self.files.order('tag')\n end", "def tags_used\n s = Set.new\n @selected_files.each do |file|\n s.merge file.tags\n end\n s.to_a.map { |v| v.downcase }\n end", "def tags\n return @tags_cache if (@tags_cache ||= nil)\n ...
[ "0.7601869", "0.7493188", "0.7079424", "0.70394146", "0.69350046", "0.68186414", "0.6686296", "0.66116554", "0.6602238", "0.6523977", "0.6439757", "0.64328825", "0.6408906", "0.6374971", "0.6370682", "0.63505965", "0.63251954", "0.63251954", "0.6319831", "0.62956005", "0.6294...
0.7838998
0
Return a Hash of only the rakefiles that have tasks to be run. key = rakefile name, value = EvaluatedRakeFile Add the tasks to run for each EvaluatedRakeFile
def rakefiles_with_tasks_to_run rakefiles_with_tasks = new_hash_of_eval_rakefiles # This isn't efficient, but it's clear: all_tasks_to_run.each do |task_to_run| rakefilename = task_to_run.filename ev_rakefile_to_run = self.all_rakefiles[rakefilename] ev_rakefile_to_run.tasks_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_rakefiles\n @all_rakefiles ||= new_hash_of_eval_rakefiles\n end", "def get_tasks_from_rakefiles\n\n # ensure we're starting out with no tasks or rakefiles\n clear_all_tasks_and_rakefiles\n\n rakefiles_to_read = onetime_rake_files\n\n return [] if rakefiles_to_read.empty?\n\n ...
[ "0.7285169", "0.66919297", "0.66704816", "0.66661507", "0.65413934", "0.63483906", "0.63473564", "0.6193978", "0.6183303", "0.6137314", "0.604493", "0.60397017", "0.6003204", "0.59804475", "0.59750575", "0.58867973", "0.5878638", "0.5859774", "0.58397454", "0.5805866", "0.572...
0.8255744
0
If there are tasks with the same name, mark them as duplicates and log them.
def set_and_log_duplicate_tasks(evaluated_tasks) return [] if evaluated_tasks.empty? # get all of the task_names that are duplicates (TODO ruby 2.7: replace this with .tally) duplicated_names = evaluated_tasks.group_by(&:name).select { |_name, tasks | tasks.size > 1 }.keys # Guard condition: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_hardcoded_duplicates(task)\n task.add_duplicate('t1 duplicate 1')\n task.add_duplicate('t1 duplicate 2')\n end", "def ensure_unique_tasks_names! \n for i in 0..(@tasks_params.count-2)\n for j in (i+1)..(@tasks_params.count-1)\n raise RuntimeError, 'Duplicated tasks names' if @...
[ "0.7487215", "0.6605103", "0.6405019", "0.60654604", "0.5852868", "0.5769097", "0.5662074", "0.56507", "0.56316274", "0.5559704", "0.5549536", "0.5540729", "0.5464778", "0.54593104", "0.54243994", "0.5344918", "0.53351897", "0.53347844", "0.5325831", "0.5311978", "0.5272812",...
0.7115204
1
Return all of the tasks that should be run: No duplicates, no tasks that have previously been run successfully.
def all_tasks_to_run self.all_tasks - all_tasks_previously_run - all_tasks_duplicates end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def successful_tasks\n @successful_tasks ||= @tasks_results.select(&:success?)\n end", "def tasks\n @db[:tasks].keys.compact.uniq || []\n end", "def incomplete_tasks\n\t\ttasks.select{ |t| !t.completed? }\n\tend", "def failed_tasks\n each_task.select do |task|\n task.status == :fa...
[ "0.7313079", "0.71757704", "0.7043827", "0.69873416", "0.695203", "0.69262904", "0.68982226", "0.68448985", "0.677307", "0.6768514", "0.6734776", "0.6730305", "0.67107046", "0.6672557", "0.66699564", "0.66674894", "0.6662218", "0.6659026", "0.66383284", "0.6623067", "0.662127...
0.8064616
0
All .rake files in the onetime_tasks_path
def onetime_rake_files tasks_dir = self.tasks_directory return [] unless Dir.exist?(tasks_dir) && !Dir.empty?(tasks_dir) Dir.glob(File.join('**', '*.rake'), base: tasks_dir) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_rakefiles\n @all_rakefiles ||= new_hash_of_eval_rakefiles\n end", "def task_files\r\n Dir.chdir(Rails.root.join('lib', 'tasks')) do |dir|\r\n @task_files = Dir[\"*.rake\"]\r\n end\r\n @task_files = @task_files.reject{|task|\r\n task !~ /\\Abg_worker_/}.map{|task|\r\n task.su...
[ "0.76642257", "0.75222826", "0.7440642", "0.730027", "0.72978675", "0.71560735", "0.7070981", "0.67436665", "0.6703166", "0.6613974", "0.6610863", "0.6602038", "0.65127033", "0.65127033", "0.6434379", "0.6431884", "0.6407418", "0.6406959", "0.6332786", "0.6290942", "0.6285782...
0.8908357
0
Add a new EvaluatedRakeFile for the rakefilename if we don't already have it. Add all task names to the EvalutedRakeFile that it doesn't already have.
def add_rakefile_and_tasks(rakefilename, task_names) # creates a new EvaluatedRakeFile entry if needed ev_rakefile = self.all_rakefiles[rakefilename] ev_rakefile.add_task_names(task_names) self.all_tasks.concat(ev_rakefile.all_tasks) ev_rakefile end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_eval_task_named(task_name)\n new_ev_task = EvaluatedRakeTask.new(task_name, self.filename)\n add_eval_task(new_ev_task)\n\n new_ev_task\n end", "def rakefiles_with_tasks_to_run\n\n rakefiles_with_tasks = new_hash_of_eval_rakefiles\n\n # This isn't efficient, but it's clear:\n ...
[ "0.74772257", "0.6796576", "0.58848387", "0.5873985", "0.5728471", "0.5652964", "0.5614601", "0.55818975", "0.55703884", "0.5515117", "0.5510157", "0.5413402", "0.5365747", "0.52929115", "0.52316236", "0.51894283", "0.51660335", "0.510383", "0.5093368", "0.50860965", "0.50282...
0.7244897
1
Find a SuccessfulAttempt for the EvaluatedTask. if a SuccessfulAttempt is found, return the first one found. else return nil if none found
def find_successful_attempt_for_task(evaluated_task) self.successful_task_attempts.detect { |already_ran_task| already_ran_task.task_name == evaluated_task.name } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_attempt(problem)\n\t\tif problem\n\t\t\treturn self.attempts.where(problem_id: problem.id).first\n\t\tend\n\tend", "def assignment_solution(ass_id)\n self.final_completed_assignments.select{ |a| a.assignment_id == ass_id }.first\n end", "def return_solution_found\n @open.select(&:goal).first\n ...
[ "0.59902287", "0.54860675", "0.5393403", "0.5380933", "0.5239204", "0.5222303", "0.5192073", "0.51379395", "0.51314205", "0.50945306", "0.5085403", "0.50730133", "0.5069035", "0.5061519", "0.5054054", "0.5049524", "0.50483805", "0.5044419", "0.50382704", "0.49822503", "0.4968...
0.75626284
0
Creates a new element on any method missing calls. Returns self, so you can chain calls (eg html.div('foo').span('bar') )
def method_missing(method, *args, &block) parts = method.to_s.match(/^([a-z]+[0-9]?)$/) if parts # Assume it's a new element, create the tag tag(parts[1], *args, &block) else # There really is no method... super end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def method_missing(method, *args, &block)\n super(method, *args) unless block_given?\n options, attrs, element = (args.detect { |arg| arg.is_a?(Hash) } || {}), {}, nil\n\n # handle methods separately if they match the pre-defined elements\n if ELEMENTS.include?(method.to_sym)\n ...
[ "0.6483127", "0.63952464", "0.5681417", "0.564917", "0.56264347", "0.560671", "0.5602902", "0.54857296", "0.54509574", "0.54509574", "0.53960353", "0.53789043", "0.5373109", "0.5336202", "0.5317931", "0.5313115", "0.5299496", "0.5299496", "0.5297895", "0.52955025", "0.5293478...
0.65207535
0
GET /public_repositories GET /public_repositories.json
def index @public_repositories = PublicRepository.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def repositories\n response = self.class.get('/repositories').body\n JSON.parse(response)\n end", "def list_repositories\n JSON.parse(request(:get, ''))\n end", "def public_repositories\n raw_repos = GitHub::API.json(\"/organizations/#{self.login}/public_repositories\")['repositories']\n ...
[ "0.78826284", "0.77906513", "0.7607299", "0.75962114", "0.7578652", "0.75022125", "0.7365388", "0.7232404", "0.72304016", "0.7222917", "0.71868205", "0.7180374", "0.7151602", "0.70675856", "0.706707", "0.7039443", "0.69558156", "0.69347835", "0.6913989", "0.6825737", "0.68147...
0.83718145
0
POST /public_repositories POST /public_repositories.json
def create @public_repository = PublicRepository.new(public_repository_params) respond_to do |format| if @public_repository.save format.html { redirect_to @public_repository, notice: 'Public repository was successfully created.' } format.json { render :show, status: :created, location: @p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @public_repositories = PublicRepository.all\n end", "def create\n #@repo = Repo.new(repo_params)\n\n user= params[:user]\n repo= params[:repos]\n\n url = BASE_URL + \"repos/\" + user + \"/\" + repo + \"/collaborators\"\n # url = BASE_URL + \"repos/rails/rails/collaborators\"\n #...
[ "0.71290064", "0.68316734", "0.66983736", "0.6648425", "0.6557433", "0.64827067", "0.6468792", "0.64037853", "0.63793594", "0.6345854", "0.6336951", "0.62572116", "0.62235355", "0.6174402", "0.6172524", "0.61462986", "0.6130395", "0.6120652", "0.60852766", "0.6064981", "0.605...
0.7281976
0
DELETE /public_repositories/1 DELETE /public_repositories/1.json
def destroy @public_repository.destroy respond_to do |format| format.html { redirect_to public_repositories_url, notice: 'Public repository was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @repository = Repository.find(params[:id])\n @repository.destroy\n\n respond_to do |format|\n format.html { redirect_to repositories_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @repository = @project.repositories.find(params[:id])\n @repositor...
[ "0.7298792", "0.7293004", "0.7288492", "0.7246774", "0.7238375", "0.72131383", "0.716087", "0.70857424", "0.7051341", "0.70495045", "0.7045577", "0.70149195", "0.70111895", "0.6992315", "0.6992315", "0.6992315", "0.6963399", "0.69523406", "0.69523406", "0.68760896", "0.683452...
0.7528295
0
Use this method in DSL methods to add a file pattern to config
def add_file_pattern(name, pattern_string) if name.to_s !~ FILE_PATTERN_NAME_REGEX raise ArgumentError.new("A file pattern name must match this regex: #{ FILE_PATTERN_NAME_REGEX.inspect }") end @file_patterns[name.to_sym] = pattern_string.to_s end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_pattern( pattern )\n self.class_eval { @file_pattern = pattern }\n end", "def file_pattern(name)\n if name.to_s !~ FILE_PATTERN_NAME_REGEX\n raise ArgumentError.new(\"A file pattern name must match this regex: #{ FILE_PATTERN_NAME_REGEX.inspect }\")\n end\n get_...
[ "0.743196", "0.6343401", "0.6074771", "0.60525686", "0.60164654", "0.60104054", "0.59868294", "0.5922678", "0.5912519", "0.58953154", "0.5893319", "0.5879828", "0.5864538", "0.58395886", "0.581435", "0.58139163", "0.57998145", "0.57668275", "0.5756211", "0.57376087", "0.56720...
0.65437317
1
Use this method in DSL methods to add a kramdown converter method to config
def add_kramdown_converter_method(name, method_name) @kramdown_converter_methods[name.to_sym] = method_name.to_sym end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def kramdown_converter_method(name)\n get_config_val(@kramdown_converter_methods, name)\n end", "def kramdown_conversion_method_name\n :to_kramdown_repositext\n end", "def add_kramdown_parser(name, class_name)\n @kramdown_parsers[name.to_sym] = Object.const_get(class_name)\n ...
[ "0.73307276", "0.6454526", "0.59406716", "0.5802251", "0.57538885", "0.5658694", "0.55258095", "0.55220056", "0.52579296", "0.52572477", "0.5236103", "0.521867", "0.5200783", "0.5179824", "0.5065934", "0.50557727", "0.50371003", "0.50331336", "0.49899033", "0.49649683", "0.49...
0.7367091
0
Retrieve a kramdown converter method
def kramdown_converter_method(name) get_config_val(@kramdown_converter_methods, name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def kramdown_conversion_method_name\n :to_kramdown_repositext\n end", "def add_kramdown_converter_method(name, method_name)\n @kramdown_converter_methods[name.to_sym] = method_name.to_sym\n end", "def html_converter_class\n ::Kramdown::Converter::Html\n end", "def converte...
[ "0.7986022", "0.67469233", "0.6563834", "0.6379176", "0.6267418", "0.6179751", "0.5775949", "0.5773782", "0.575055", "0.5741612", "0.5649745", "0.55886316", "0.55401486", "0.5426026", "0.5426026", "0.5426026", "0.53737456", "0.53737456", "0.533407", "0.53124577", "0.5285807",...
0.7484731
1
Computes a glob pattern from file spec
def compute_glob_pattern(file_spec) segments = file_spec.split(Repositext::Cli::FILE_SPEC_DELIMITER) r = '' if segments.all? { |e| e =~ BASE_DIR_NAME_REGEX || e =~ FILE_PATTERN_NAME_REGEX } # file_spec consists of named base_dir and/or file_pattern bd = segments.detect { |e| ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def glob pattern\n Dir[File.join(@originals,pattern)].collect do |f|\n File.basename(f)\n end\n end", "def glob(*pat, &blk)\n regexes = pat.flatten.map {|pat| Bun.convert_glob(pat) }\n enum = self.class.new(@collection) do |yielder|\n self.each do |fname|\n #...
[ "0.73991126", "0.73890775", "0.73805094", "0.73424846", "0.7341463", "0.7321767", "0.7315161", "0.71776307", "0.7175369", "0.71287674", "0.7073747", "0.7070709", "0.6996914", "0.69651437", "0.69538486", "0.69528484", "0.6923822", "0.6908099", "0.6908099", "0.6870214", "0.6870...
0.84700894
0
Computes a hash with validation file specs from input_file_specs
def compute_validation_file_specs(input_file_specs) input_file_specs.inject({}) { |m,(fs_name, fs_string)| base_dir, file_pattern = fs_string.split(Repositext::Cli::FILE_SPEC_DELIMITER).compact if base_dir.nil? || file_pattern.nil? raise ArgumentError.new("file_spec requires both...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_digest_byte_tests\n FILES.each do |path, hashlen|\n name = File.basename(path).split('.')[0]\n\n f = File.new(\"sha3_digest_#{hashlen}_spec.rb\", 'w')\n f.puts(REQUIRED)\n f.puts(\n SPEC\n .gsub(/HASH_LEN/, hashlen.to_s)\n .gsub(/NAME/, name)\n )\n\n contents = File.read(p...
[ "0.6164329", "0.61465913", "0.6007509", "0.5970157", "0.5961918", "0.592387", "0.5775693", "0.5747631", "0.57236147", "0.5667557", "0.5638504", "0.5620693", "0.56157726", "0.5602275", "0.5580187", "0.55777556", "0.557338", "0.55539995", "0.5546367", "0.5531555", "0.5529126", ...
0.7514599
0
Returns the absolute path of primary_repo with a guaranteed trailing slash at the end
def primary_repo_base_dir File.expand_path( setting(:relative_path_to_primary_repo), base_dir(:rtfile_dir) ).sub(/\/?\z/, '') + '/' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def repo_path\n @config.get_value('GIT_REPO_ROOT')\n end", "def abspath\n \"#{repo_base_path}/#{self.git_repo_path}\"\n end", "def repository_root\n File.expand_path(@repo.path + \"/../\")\n end", "def absolute_repository_path\n File.join(\n OpenProject::Revisions::Git...
[ "0.6840974", "0.68346095", "0.6793713", "0.6643713", "0.65871274", "0.6514559", "0.65050054", "0.6468484", "0.63940626", "0.6347272", "0.6298935", "0.6293408", "0.62834775", "0.626672", "0.6258216", "0.625578", "0.6234172", "0.6213185", "0.61406183", "0.61352944", "0.612355",...
0.7727887
0