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
Assigns m to the rank attribute of this object.
def rank=(m) @rank = m % (1 << size) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rank=(m)\n @rank = m % factorial(size)\n end", "def rank=(value)\n @rank = value\n end", "def set_rank\n @rank = Rank.find(params[:id])\n end", "def set_rank\n @rank = Rank.find(params[:id])\n end", "def set_rank\n @rank = Rank.find(params[:id]...
[ "0.76152587", "0.74578905", "0.7070407", "0.68718636", "0.68718636", "0.6750307", "0.6563231", "0.6545335", "0.6447588", "0.6442698", "0.6391471", "0.637754", "0.624146", "0.6186321", "0.6159849", "0.61410445", "0.6118293", "0.60740626", "0.60497576", "0.60390943", "0.6039094...
0.7990546
0
Returns the full path to where the bin wrapper script should be created. If Ruby was installed with a prefix or suffix it will be inflected and added to the name of the executable. If the prefix is, for instance, `mac' an executable like +macrake+ will be installed. With a suffix like `19' the name will be +rake19+.
def bin_wrapper_file rbconfig('ruby_install_name').match /^(.*)ruby(.*)$/ File.join(Config.bin_dir, "#{$1}#{@bin_name}#{$2}") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ruby_bin\n @ruby_bin ||= begin\n c = ::Config::CONFIG\n File.join(c['bindir'], c['ruby_install_name']) << c['EXEEXT']\n end\n end", "def bin_path(_opts)\n '/bin'\n end", "def bin_path(_opts)\n '/bin'\n end", "def bin_path(_opts)\n '/bin'\n end", "def binary\n ...
[ "0.7111921", "0.7059077", "0.7059077", "0.7059077", "0.6998277", "0.6925362", "0.68864805", "0.68615395", "0.6830671", "0.6787042", "0.67210263", "0.66533256", "0.6649281", "0.66133916", "0.6545067", "0.6545034", "0.64978826", "0.646433", "0.646433", "0.646433", "0.6437297", ...
0.76473564
0
Creates the bin wrapper script in bin_wrapper_file.
def create_bin_wrapper! Utils.log(:debug, "Creating bin wrapper `#{bin_wrapper_file}'") File.open(bin_wrapper_file, 'w') { |f| f << to_ruby } File.chmod(0755, bin_wrapper_file) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bin_wrapper_file\n rbconfig('ruby_install_name').match /^(.*)ruby(.*)$/\n File.join(Config.bin_dir, \"#{$1}#{@bin_name}#{$2}\")\n end", "def wrap bin_file, pythonpath\n bin_file = Pathname.new bin_file\n libexec_bin = Pathname.new libexec/'bin'\n libexec_bin.mkpath\n mv bin_fil...
[ "0.73506254", "0.7183065", "0.7183065", "0.7183065", "0.66861516", "0.57090926", "0.56985825", "0.5689301", "0.56490105", "0.5602203", "0.55913746", "0.558095", "0.5565157", "0.555904", "0.5514169", "0.54756874", "0.5470731", "0.54510725", "0.53776884", "0.53558725", "0.53439...
0.8945799
0
Adds the given list of project names to the exclusion set of this updater.
def exclude(project_list) project_list.each { |p| @excluded_projects[p] = true } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exclude(*names)\n project(*(map(&:name) - names))\n end", "def exclude(*files)\n @exclude += files.flatten\n self\n end", "def exclusions\n project.exclusions + %w(\n **/.git\n **/.hg\n **/.svn\n **/.gitkeep\n )\n end", "def ignore_only=(names...
[ "0.68831885", "0.67353773", "0.62806255", "0.62071306", "0.61030465", "0.60448426", "0.5999561", "0.5841393", "0.57208943", "0.5714696", "0.56601846", "0.56022626", "0.55809677", "0.55491906", "0.5537801", "0.55049354", "0.54737276", "0.5453259", "0.5453259", "0.5447674", "0....
0.72182447
0
Returns true if the given project is in the exclusion set of this updater; returns false otherwise.
def excluded?(project_name) @excluded_projects.has_key?(project_name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def project_allowed(project)\n Chef::Cache::KNOWN_PROJECTS.include? project\n end", "def is_project_disabled(proj)\n ## check project\n return true if proj.nil?\n\n ## check proj custom field\n proj_cf = ProjectCustomField.find_by_name(\"Hangouts Chat Webhook Disabled\")\n return tru...
[ "0.6702821", "0.65350467", "0.6459527", "0.64529914", "0.64078003", "0.63656276", "0.6254842", "0.62057394", "0.6198769", "0.61850864", "0.6083902", "0.60369515", "0.5985252", "0.5933135", "0.59222806", "0.58516645", "0.5798777", "0.57894695", "0.5750773", "0.57204574", "0.57...
0.74364233
0
Returns true if there are actions that have not been applied to the platform (including actions in derivative builds); returns false otherwise.
def pending_actions? return true if @log.pending_actions? @derivative_builds.each do |d| return true if d.pending_actions? end return false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def actions?\n non_empty?(@actions)\n end", "def has_actions?\n if self.actions == []\n return false\n else\n return true\n end\n end", "def action_argument_required?\n !AVAILABLE_ACTIONS.empty?\n end", "def empty?\n @actions.empty?\n end", "def all_o...
[ "0.7307512", "0.7282279", "0.6832453", "0.6501673", "0.6432667", "0.63622", "0.62694204", "0.6254466", "0.6243115", "0.6218956", "0.62068635", "0.6188491", "0.6115419", "0.607482", "0.6071691", "0.6066297", "0.6063726", "0.6057236", "0.6054853", "0.60479695", "0.60404646", ...
0.73041517
1
Enqueues a derivative build based on the specified project (which is typically, but not necessarily, an installation profile). Does nothing if the project does not contain any makefile whose name coincides with the name of the project.
def prepare_derivative_build(project) mf = project.makefile return false if mf.nil? debug "Preparing derivative build for #{mf.basename}" submake = Makefile.new(mf) subplatform = Platform.new(@platform.local_path) subplatform.contrib_path = @platform.dest_path(project) new_upda...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sync_projects(options = {})\n exclude(@core_projects) # Skip core projects\n processed = Array.new(excluded) # List of names of processed projects\n dep_queue = Array.new # Queue of Drupid::Project objects whose dependencies must be checked. This is always a subset of processed.\n\n @makefi...
[ "0.56846815", "0.55912864", "0.5513589", "0.5494061", "0.5298636", "0.52209896", "0.51895136", "0.51471674", "0.51296264", "0.51296264", "0.51268595", "0.5103079", "0.50922805", "0.50228286", "0.50168514", "0.5005818", "0.5002301", "0.5002301", "0.4996874", "0.49364513", "0.4...
0.6949515
0
Tries to reconcile the makefile with the platform by resolving unmet dependencies and determining which projects must be installed, upgraded, downgraded, moved or removed. This method does not return anything. The result of the synchronization can be inspected by accessing Drupid::Updaterlog. This method does not modif...
def sync(options = {}) @log.clear @platform.analyze # These paths are needed because Drupal allows libraries to be installed # inside modules. Hence, we must ignore them when synchronizing those modules. @makefile.each_library do |l| @libraries_paths << @platform.local_path + @plat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sync_projects(options = {})\n exclude(@core_projects) # Skip core projects\n processed = Array.new(excluded) # List of names of processed projects\n dep_queue = Array.new # Queue of Drupid::Project objects whose dependencies must be checked. This is always a subset of processed.\n\n @makefi...
[ "0.6326895", "0.60620624", "0.58456486", "0.57640713", "0.56247467", "0.54863507", "0.5342582", "0.53028053", "0.53020346", "0.53020346", "0.52525216", "0.5239834", "0.5223528", "0.52124864", "0.51764524", "0.5151317", "0.51455724", "0.51380175", "0.51168764", "0.50993544", "...
0.68297696
0
Synchronizes Drupal core. Returns true if the synchronization is successful; returns false otherwise.
def sync_drupal_core if @platform.drupal_project _compare_versions @makefile.drupal_project, @platform.drupal_project else log.action(InstallProjectAction.new(@platform, @makefile.drupal_project)) end return true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sync(options = {})\n @log.clear\n @platform.analyze\n # These paths are needed because Drupal allows libraries to be installed\n # inside modules. Hence, we must ignore them when synchronizing those modules.\n @makefile.each_library do |l|\n @libraries_paths << @platform.local_p...
[ "0.6161641", "0.61300874", "0.59196985", "0.58364224", "0.58020186", "0.5712556", "0.57095176", "0.56359845", "0.5625886", "0.56258696", "0.56258696", "0.562284", "0.562284", "0.55773866", "0.55654985", "0.5514116", "0.5500065", "0.5500065", "0.5480415", "0.54795945", "0.5479...
0.7660241
0
Synchronizes projects between the makefile and the platform. Options: nofollow
def sync_projects(options = {}) exclude(@core_projects) # Skip core projects processed = Array.new(excluded) # List of names of processed projects dep_queue = Array.new # Queue of Drupid::Project objects whose dependencies must be checked. This is always a subset of processed. @makefile.each_pr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sync(options = {})\n @log.clear\n @platform.analyze\n # These paths are needed because Drupal allows libraries to be installed\n # inside modules. Hence, we must ignore them when synchronizing those modules.\n @makefile.each_library do |l|\n @libraries_paths << @platform.local_p...
[ "0.6683863", "0.56792456", "0.55468845", "0.55014586", "0.53844863", "0.53599584", "0.5348983", "0.5344964", "0.5250378", "0.52189976", "0.5210855", "0.51804537", "0.51100457", "0.506904", "0.50681186", "0.5058532", "0.5052056", "0.5048105", "0.5027533", "0.50235605", "0.5013...
0.6025582
1
Performs the necessary synchronization actions for the given project. Returns true if the dependencies of the given project must be synchronized, too; returns false otherwise.
def sync_project(project) return false unless _fetch_and_patch(project) # Does this project contains a makefile? If so, enqueue a derivative build. has_makefile = prepare_derivative_build(project) # Ignore libraries that may be installed inside this project pp = @platform.local_path + @p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def project_saved?\n begin \n @project.transaction do\n # validations\n ensure_unique_project_name!\n ensure_unique_tasks_names! \n # save\n save_project!\n save_tasks!\n end\n return true \n rescue Exception => e\n return false\n end \n en...
[ "0.62062305", "0.5795183", "0.5784787", "0.55783385", "0.5441141", "0.5398129", "0.5176099", "0.5170818", "0.51311874", "0.5129792", "0.5086733", "0.5086733", "0.5018834", "0.50183266", "0.50104463", "0.5003509", "0.49797264", "0.49756303", "0.49735576", "0.4947927", "0.49358...
0.6416644
0
Synchronizes libraries between the makefile and the platform.
def sync_libraries debug 'Syncing libraries' processed_paths = [] @makefile.each_library do |lib| sync_library(lib) processed_paths << lib.target_path end # Determine libraries that should be deleted from the 'libraries' folder. # The above is a bit of an overstatemen...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_libraries uri\n src = sources.find(uri)\n libraries.each do |lib|\n lib.merge src if lib.contain?(src.filename)\n end\n diagnoser.schedule uri\n end", "def sync(options = {})\n @log.clear\n @platform.analyze\n # These paths are neede...
[ "0.7009991", "0.6698813", "0.63477683", "0.6338602", "0.60610497", "0.5996299", "0.5967169", "0.58087045", "0.5776323", "0.5725135", "0.5686601", "0.563684", "0.563684", "0.5625365", "0.5539826", "0.5488299", "0.5485501", "0.5478093", "0.54225814", "0.54070246", "0.5406288", ...
0.75132835
0
Applies any pending changes. This is the method that actually modifies the platform. Note that applying changes may be destructive (projects may be upgraded, downgraded, deleted from the platform, moved and/or patched). Always backup your site before calling this method! If :force is set to true, changes are applied ev...
def apply_changes(options = {}) raise "No changes can be applied because there are errors." if log.errors? and not options[:force] log.apply_pending_actions @derivative_builds.each { |updater| updater.apply_changes(options.merge(:no_lockfile => true)) } @log.clear @derivative_builds.clear ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n verify_no_uncommitted_merge\n verify_valid_update\n \n check_unknown if force\n check_collision if false # case-insensitive file-system? seriously? (uh... mac os x ring a bell?)\n \n @actions = []\n \n f...
[ "0.6055943", "0.5982402", "0.5627518", "0.5581999", "0.55807406", "0.5514358", "0.5505586", "0.54566884", "0.5426453", "0.5413427", "0.533434", "0.53160006", "0.531422", "0.5291006", "0.52754486", "0.5270214", "0.52656704", "0.52529675", "0.52236086", "0.5191947", "0.51876235...
0.60588956
0
Updates Drupal's database using drush updatedb. If site is defined, then updates only the specified site; otherwise, iterates over all Platformsite_names and updates each one in turn. Returns true upon success, false otherwise.
def updatedb ohai "Updating Drupal database..." blah "Platform: #{self.platform.local_path}" res = true site_list = (self.site) ? [self.site] : self.platform.site_names site_list.each do |s| site_path = self.platform.sites_path + s debug "Site path: #{site_path}" un...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n raise UnknownSite, \"Site not existent in Piwik yet, call 'save' first\" if new?\n raise ArgumentError, \"Name can not be blank\" if name.blank?\n raise ArgumentError, \"Main URL can not be blank\" if main_url.blank?\n xml = call('SitesManager.updateSite', :idSite => id, :siteName ...
[ "0.66756845", "0.56743914", "0.5558451", "0.54885405", "0.5330445", "0.5326549", "0.52271396", "0.52064204", "0.5200117", "0.51818675", "0.5154343", "0.51351756", "0.510574", "0.5096387", "0.5085939", "0.5059639", "0.50403637", "0.5034136", "0.5017829", "0.49873185", "0.49864...
0.8366164
0
Returns true if the given component is successfully cached and patched; return false otherwise.
def _fetch_and_patch component begin component.fetch rescue => ex @log.error("#{component.extended_name} could not be fetched.") debug "_fetch_and_patch: #{ex.message}" return false end if component.has_patches? begin component.patch resc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def patched?\n @patched\n end", "def patched?\n @patched\n end", "def patched?\n @patched\n end", "def patched?\n @patched\n end", "def patched?\n @patched\n end", "def cache?\n caching && true\n end", "def ...
[ "0.6425704", "0.6425704", "0.6425704", "0.6425704", "0.6425704", "0.60998744", "0.6063766", "0.6055901", "0.60394156", "0.6037532", "0.6027015", "0.59660506", "0.5933369", "0.5923776", "0.5917685", "0.58934426", "0.5872757", "0.5866805", "0.5865231", "0.5846616", "0.58278835"...
0.74526393
0
Compare project versions and log suitable actions.
def _compare_versions(makefile_project, platform_project) update_action = UpdateProjectAction.new(platform, makefile_project) case makefile_project <=> platform_project when 0 # up to date # Check whether the content of the projects is consistent begin diff = makefile_project...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compare_versions\n if @local_version && \n (@local_version.to_machine_format >= @website_version.to_machine_format)\n display_versions\n puts \"You have the most recent version.\"\n puts \"Exiting...\"\n exit 0\n end\nend", "def diff\n deprecation_notice!\n downstream = @cisau...
[ "0.6104768", "0.60805285", "0.5968963", "0.5905088", "0.58202505", "0.5816841", "0.57681805", "0.56585985", "0.56272554", "0.5576809", "0.555087", "0.5517455", "0.5487077", "0.5481953", "0.5424551", "0.5418769", "0.5416611", "0.5402685", "0.5395409", "0.53744745", "0.5371622"...
0.7295632
0
Deploys a library into the specified location.
def _install args = Array.new args << '-a' args << '--delete' component.ignore_paths.each { |p| args << "--exclude=#{p}" } dst_path = platform.local_path + platform.contrib_path + component.target_path dont_debug { dst_path.mkpath } args << component.local_path.to...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def install_local_library(path)\n src_path = path.realpath\n library_name = src_path.basename\n destination_path = library_path(library_name)\n\n # things get weird if the sketchbook contains the library.\n # check that first\n if destination_path.exist?\n uhoh = \"There is alr...
[ "0.5888976", "0.58690125", "0.57633793", "0.5740246", "0.5650665", "0.5595416", "0.5500695", "0.54927284", "0.5443853", "0.5400413", "0.5385371", "0.5382074", "0.5320944", "0.52846956", "0.5275405", "0.52716744", "0.5267564", "0.52641016", "0.52589405", "0.5245488", "0.523117...
0.6252304
0
Creates GitHub URLs with owner and repository name
def github(repository, owner = 'siimple') "https://github.com/#{owner}/#{repository}.git" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def github_url\n @github_url ||= \"https://github.com/#{options[:github_owner]}/#{name}\"\n end", "def url\n \"http://github.com/#{repo.owner.login}/#{repo.name}/#{name}\"\n end", "def name_to_url(name)\n \"https://github.com/#{name}.git\"\n end", "def github_url\n \"https://github.com/#{s...
[ "0.74512136", "0.73287416", "0.71374315", "0.7082303", "0.70542973", "0.7044448", "0.701122", "0.6988843", "0.6872043", "0.6682912", "0.66719663", "0.6652131", "0.66361123", "0.65884995", "0.6584942", "0.65788907", "0.652561", "0.64204496", "0.6414047", "0.64113456", "0.63616...
0.73397166
1
GET /vehicle_classes/new GET /vehicle_classes/new.json
def new @vehicle_class = VehicleClass.new respond_to do |format| format.html # new.html.erb format.json { render json: @vehicle_class } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @vehicle_class = VehicleClass.new(params[:vehicle_class])\n\n respond_to do |format|\n if @vehicle_class.save\n format.html { redirect_to @vehicle_class, notice: 'Vehicle class was successfully created.' }\n format.json { render json: @vehicle_class, status: :created, location...
[ "0.7480554", "0.71904474", "0.714868", "0.7079963", "0.7075884", "0.70171165", "0.68980235", "0.68858063", "0.68717206", "0.6846336", "0.6812928", "0.6785336", "0.6776849", "0.6772398", "0.67678136", "0.67497617", "0.67454517", "0.6737879", "0.6716264", "0.66884923", "0.66748...
0.7892947
0
POST /vehicle_classes POST /vehicle_classes.json
def create @vehicle_class = VehicleClass.new(params[:vehicle_class]) respond_to do |format| if @vehicle_class.save format.html { redirect_to @vehicle_class, notice: 'Vehicle class was successfully created.' } format.json { render json: @vehicle_class, status: :created, location: @vehicle_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @vehicle_class = VehicleClass.new(params[:vehicle_class])\n\n respond_to do |format|\n if @vehicle_class.save\n format.html { redirect_to(@vehicle_class, :notice => 'Vehicle class was successfully created.') }\n format.xml { render :xml => @vehicle_class, :status => :created,...
[ "0.6542053", "0.6026368", "0.6023204", "0.5992407", "0.594664", "0.59091014", "0.58558065", "0.5807038", "0.57515264", "0.5718768", "0.5703635", "0.56932074", "0.56687945", "0.56687945", "0.56687945", "0.5664808", "0.56447494", "0.56216687", "0.56014836", "0.5599138", "0.5576...
0.72509253
0
PUT /vehicle_classes/1 PUT /vehicle_classes/1.json
def update @vehicle_class = VehicleClass.find(params[:id]) respond_to do |format| if @vehicle_class.update_attributes(params[:vehicle_class]) format.html { redirect_to @vehicle_class, notice: 'Vehicle class was successfully updated.' } format.json { head :ok } else format.ht...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @vehicle_class = VehicleClass.find(params[:id])\n\n respond_to do |format|\n if @vehicle_class.update_attributes(params[:vehicle_class])\n format.html { redirect_to(@vehicle_class, :notice => 'Vehicle class was successfully updated.') }\n format.xml { head :ok }\n else\n...
[ "0.671833", "0.6302531", "0.6031832", "0.598615", "0.58934313", "0.58920443", "0.5878864", "0.58545864", "0.5802909", "0.57998174", "0.57807755", "0.5766228", "0.57642245", "0.57512605", "0.5731569", "0.57221085", "0.56918097", "0.56627613", "0.56342727", "0.56158066", "0.559...
0.72001874
0
DELETE /vehicle_classes/1 DELETE /vehicle_classes/1.json
def destroy @vehicle_class = VehicleClass.find(params[:id]) @vehicle_class.destroy respond_to do |format| format.html { redirect_to vehicle_classes_url } format.json { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @vehicle_class = VehicleClass.find(params[:id])\n @vehicle_class.destroy\n\n respond_to do |format|\n format.html { redirect_to(vehicle_classes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @clclass = Clclass.find(params[:id])\n @clclass.destroy\n\n ...
[ "0.7355878", "0.6966688", "0.69605184", "0.69605184", "0.6940561", "0.6938665", "0.6926449", "0.6896491", "0.6847445", "0.6825803", "0.68189377", "0.68188673", "0.6810061", "0.6809888", "0.68073875", "0.67771673", "0.67768013", "0.67690533", "0.6766512", "0.6754727", "0.67372...
0.78365064
0
Finds buildings from freebase designed by the architect.
def find_buildings(architect) name = architect.name url = Addressable::URI.parse('https://www.googleapis.com/freebase/v1/search') url.query_values = { query: name, type: "/architecture/structure", key: GOOGLE_CLIENT_ID } from_freebase = HTTParty.get(url, :format => :json) @...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def buildable\n b = []\n bts_here = @buildings.map { |b| b.type }\n BuildingType.all.each do |bt|\n if not bts_here.include? bt and bts_here.include? bt.prerequisite \\\n and residents.length >= bt.min_colony\n b << bt\n end\n end\n return b\n end", "def find_entries(buildin...
[ "0.6562974", "0.59953886", "0.5910194", "0.5878741", "0.575927", "0.5737529", "0.55921423", "0.5330418", "0.52442944", "0.52077883", "0.51805043", "0.5166892", "0.5140001", "0.51317763", "0.51228267", "0.5102703", "0.50916815", "0.5072862", "0.50587213", "0.50572646", "0.5045...
0.79563385
0
Gets a description of the architect from wikipedia
def get_description(architect) search = FreebaseAPI.session.search("#{architect.name}") resource_id = search[0]["id"] if resource_id == nil resource_id = search[0]["mid"] end resource = FreebaseAPI::Topic.get("#{resource_id}") @description = resource.description end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def description\n\t # if the description exists\n\t # return it \n\t # else \n\t # scrape to get the description\n\t # return it\n\t # end\n\tend", "def description\n search_by_itemprop 'description'\n end", "def description\n response_json = @client.api_get_request('', 'tree=descrip...
[ "0.65950304", "0.64274687", "0.63954026", "0.6331489", "0.6326101", "0.62938666", "0.62824494", "0.6216198", "0.6216198", "0.6149291", "0.614699", "0.614699", "0.61438996", "0.61161727", "0.6075466", "0.60579574", "0.6057704", "0.60223776", "0.60223776", "0.6013415", "0.59943...
0.7135378
0
Gets buildings in the database within a 3 mile radius of the current building.
def find_entries(building) @buildings_nearby = building.nearbys(3) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @buildings = Building.find_near_me(search_params)\n end", "def index\n if params[:search].present?\n @buildings = Building.near(params[:search], 50, :order => :distance)\n else\n @buildings = Building.all\n end\n\n end", "def index\n @params = params.permit(:building, :fl...
[ "0.6500157", "0.63188505", "0.6158715", "0.5812862", "0.58100957", "0.56593645", "0.5573889", "0.5507152", "0.5484832", "0.5345243", "0.529608", "0.52941185", "0.5285553", "0.52043456", "0.5142721", "0.5120539", "0.5109875", "0.5102623", "0.50942796", "0.5058412", "0.5056639"...
0.6963875
0
Generates a google static map of the building and buildings nearby
def get_map(building, array_of_buildings_nearby) each_result = array_of_buildings_nearby.map { |building| "markers=color:green%7Clabel:%7C#{building.latitude},#{building.longitude}&" } map_from_google = "http://maps.googleapis.com/maps/api/staticmap?center=#{building.latitude},#{building.longitude}&zoom=13&size...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_static_map\n legs = @itinerary.legs\n markers = create_markers\n polylines = create_polylines\n\n params = {\n 'size' => '700x435',\n 'maptype' => 'roadmap',\n }\n\n iconUrls = {\n 'blueMiniIcon' => 'https://maps.gstatic.com/intl/en_us/mapfiles/markers2/measle_blue...
[ "0.6961075", "0.68169886", "0.6733872", "0.66331744", "0.65577203", "0.65148115", "0.65103054", "0.644611", "0.6393634", "0.6349644", "0.6347425", "0.63309866", "0.6300873", "0.62705106", "0.6260547", "0.62421554", "0.62309664", "0.6206446", "0.61801183", "0.6142324", "0.6126...
0.8004162
0
Pulls the instagram location that matches the name of the building and coordinates of the building
def get_instagram_location_id(building) return_hash = HTTParty.get("https://api.instagram.com/v1/locations/search?lat=#{building.latitude}&lng=#{building.longitude}&distance=25&client_id=#{INSTAGRAM_CLIENT_ID}") data = return_hash["data"] location_hash = data.detect { |item| item["name"].include?(@building....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pull_photos(building)\n @location = get_instagram_location_id(building)\n unless @location == nil\n @photos = get_instagram_photos(@location)\n end\n end", "def location\n fetch('how_to_train_your_dragon.locations')\n end", "def locate_pins(location); end", "def get_locatio...
[ "0.6789773", "0.67645496", "0.66912407", "0.66529256", "0.64894986", "0.6479431", "0.63925785", "0.63309735", "0.63195944", "0.6300483", "0.6294831", "0.6293119", "0.6277442", "0.62539244", "0.62111926", "0.61902106", "0.61622113", "0.61420965", "0.6132925", "0.6113445", "0.6...
0.78662646
0
pulls a description of the building from freebase from Wikipedia
def get_building_description(building) search = FreebaseAPI.session.search("#{building.name}") if search != [] resource_id = search[0]["id"] resource = FreebaseAPI::Topic.get("#{resource_id}") @building_description = resource.description else @building_description = "There is no avai...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_info\n doc = Hpricot(open(noaa_url))\n puts noaa_url\n if !self.description\n doc.search(\"h1\").each do |elem| \n desc = elem.inner_html\n # remove imbeded links in the middle of the description\n desc.gsub!(/\\<a.href.*?\\<\\/a\\>/,' ')\n self.description = d...
[ "0.6826628", "0.64196634", "0.64164716", "0.64164716", "0.635525", "0.63461125", "0.6181845", "0.61718607", "0.6107073", "0.61048776", "0.6068321", "0.60587573", "0.6019766", "0.6019766", "0.5987795", "0.59378594", "0.5931605", "0.587386", "0.58379036", "0.5822485", "0.580316...
0.71829194
0
Pulls photos for the splash page from instagram
def get_photos tag = ["urbanlandscape","architecture","buildings","archidaily"].sample return_hash = HTTParty.get("https://api.instagram.com/v1/tags/#{tag}/media/recent?client_id=#{INSTAGRAM_CLIENT_ID}") @instagram_photos = [return_hash["data"].sample["images"]["low_resolution"]["url"], return_hash["data"]....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pull_photos(building)\n @location = get_instagram_location_id(building)\n unless @location == nil\n @photos = get_instagram_photos(@location)\n end\n end", "def grab_the_images\n get_the_url = RestClient.get(@url)\n doc = Nokogiri::HTML(get_the_url)\n images = doc.search(...
[ "0.7226892", "0.6969803", "0.6883585", "0.6859129", "0.6772523", "0.65424913", "0.6509472", "0.64508295", "0.6420674", "0.64179087", "0.6368606", "0.6290793", "0.6288707", "0.61813956", "0.6179772", "0.6164461", "0.6160972", "0.6127935", "0.6112806", "0.6109665", "0.6103119",...
0.74473906
0
GET /caracteristica_tipo_vehiculos GET /caracteristica_tipo_vehiculos.json
def index @caracteristica_tipo_vehiculos = CaracteristicaTipoVehiculo.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @tipo_vehiculo = TipoVehiculo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_vehiculo }\n end\n end", "def set_caracteristica_tipo_vehiculo\n @caracteristica_tipo_vehiculo = CaracteristicaTipoVehiculo.find(params[:...
[ "0.67287403", "0.6714293", "0.6675164", "0.6317971", "0.6298448", "0.6252864", "0.6237887", "0.62116313", "0.6205601", "0.6196258", "0.6196258", "0.6196258", "0.61919487", "0.6182495", "0.6166906", "0.61643827", "0.6161133", "0.6158662", "0.614944", "0.60912246", "0.60810816"...
0.70242286
0
POST /caracteristica_tipo_vehiculos POST /caracteristica_tipo_vehiculos.json
def create @caracteristica_tipo_vehiculo = CaracteristicaTipoVehiculo.new(caracteristica_tipo_vehiculo_params) respond_to do |format| if @caracteristica_tipo_vehiculo.save format.html { redirect_to @caracteristica_tipo_vehiculo, notice: 'Caracteristica tipo Vehiculo was successfully created.' } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def caracteristica_tipo_vehiculo_params\n params.require(:caracteristica_tipo_vehiculo).permit(:caracteristica, :requerido, :tipo_dato_id, :tipo_vehiculo_id, :orden)\n end", "def create\n @tipo_vehiculo = TipoVehiculo.new(params[:tipo_vehiculo])\n\n respond_to do |format|\n if @tipo_vehiculo.s...
[ "0.7142103", "0.6855672", "0.6756804", "0.66677755", "0.6600915", "0.65304816", "0.642999", "0.62615806", "0.62523407", "0.62275213", "0.6225034", "0.62203115", "0.61942595", "0.61918473", "0.6189913", "0.6187988", "0.61772424", "0.61559784", "0.6131049", "0.6131027", "0.6128...
0.68829685
1
PATCH/PUT /caracteristica_tipo_vehiculos/1 PATCH/PUT /caracteristica_tipo_vehiculos/1.json
def update respond_to do |format| if @caracteristica_tipo_vehiculo.update(caracteristica_tipo_vehiculo_params) format.html { redirect_to @caracteristica_tipo_vehiculo, notice: 'Caracteristica tipo Vehiculo was successfully updated.' } format.json { render :show, status: :ok, location: @caracte...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @tipo_vehiculo = TipoVehiculo.find(params[:id])\n\n respond_to do |format|\n if @tipo_vehiculo.update_attributes(params[:tipo_vehiculo])\n format.html { redirect_to @tipo_vehiculo, notice: 'Tipo vehiculo was successfully updated.' }\n format.json { head :no_content }\n el...
[ "0.6703473", "0.64150083", "0.6403183", "0.63103616", "0.6251855", "0.62437326", "0.62407446", "0.623896", "0.6235374", "0.6208206", "0.61891496", "0.617801", "0.617799", "0.6176649", "0.61757034", "0.6168954", "0.61610365", "0.61538714", "0.6136334", "0.61263084", "0.6118688...
0.66793483
1
DELETE /caracteristica_tipo_vehiculos/1 DELETE /caracteristica_tipo_vehiculos/1.json
def destroy @caracteristica_tipo_vehiculo.destroy respond_to do |format| format.html { redirect_to caracteristica_tipo_vehiculos_url, notice: 'Caracteristica tipo Vehiculo was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @tipo_vehiculo = TipoVehiculo.find(params[:id])\n @tipo_vehiculo.destroy\n\n respond_to do |format|\n format.html { redirect_to tipo_vehiculos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @veiculo = Veiculo.find(params[:id])\n @veiculo.destroy\n...
[ "0.72620416", "0.7072246", "0.7028626", "0.70176595", "0.69568795", "0.69474995", "0.69376594", "0.69361115", "0.69206196", "0.69167745", "0.69157434", "0.6912997", "0.69037396", "0.6896084", "0.68951166", "0.68947405", "0.6893536", "0.68873507", "0.6882184", "0.68803865", "0...
0.7395322
0
Nokogiri::HTML4 returns an empty Document when given a blank string GH11
def test_empty_string_returns_empty_doc doc = Nokogiri::HTML4("") assert_instance_of(Nokogiri::HTML4::Document, doc) assert_nil(doc.root) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean!(html)\n @whitelist_nodes = []\n fragment = Nokogiri::HTML::DocumentFragment.parse(html)\n clean_node!(fragment)\n @whitelist_nodes = []\n\n output_method_params = {:encoding => 'utf-8', :indent => 0}\n\n if @config[:output] == :xhtml\n output_method = fragment.method(:to_xhtml)\n ...
[ "0.61461294", "0.6067033", "0.6050667", "0.6016183", "0.60105026", "0.59127605", "0.59118646", "0.58931535", "0.5870417", "0.5856966", "0.58140177", "0.57919794", "0.5760161", "0.5754884", "0.57185584", "0.5705068", "0.5703725", "0.5668534", "0.5663352", "0.5653728", "0.56394...
0.81789225
0
Start a loop and work jobs indefinitely. Call this method to start the worker. This is the easiest way to start working jobs.
def start while @running @fork_worker ? fork_and_work : work end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start!\n until should_stop? do work end\n end", "def start\n @worker.start\n end", "def start\n prepare\n loop { fork_one_job }\n end", "def start_worker\n @worker = Thread.new do\n loop do\n fill_cache\n watch_to_update_cache\n ...
[ "0.7690687", "0.74406934", "0.74069166", "0.7239609", "0.71826047", "0.7138462", "0.71290505", "0.71236503", "0.7122355", "0.70866305", "0.7061016", "0.7021328", "0.6993364", "0.6988627", "0.6976624", "0.6968612", "0.69437313", "0.6894958", "0.6887947", "0.687392", "0.6873693...
0.8262869
0
This method will tell the ruby process to FORK. Define setup_child to hook into the forking process. Using setup_child is good for reestablishing database connections.
def fork_and_work cpid = fork {setup_child; work} log(:at => :fork, :pid => cpid) Process.wait(cpid) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start!\n @stopping = false\n\n @pid = fork_child do\n __info(\"Started\")\n\n @pid = $$\n\n if respond_to?(:after_fork)\n __debug(\"Running after fork callback\")\n after_fork\n __debug(\"Finished running after fork callback\")\n end\n\n @...
[ "0.6555636", "0.64870596", "0.64870596", "0.6371934", "0.63652146", "0.63288677", "0.62412685", "0.6237987", "0.6191708", "0.61820996", "0.61820996", "0.617719", "0.61660683", "0.614677", "0.61329204", "0.6109619", "0.6038466", "0.59626764", "0.5915185", "0.5863577", "0.58382...
0.688024
0
This method will lock a job & process the job.
def work if job = lock_job QC.log_yield(:at => "work", :job => job[:id]) do process(job) end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lock_job\n log(:at => \"lock_job\")\n job = nil\n while @running\n break if job = @queue.lock\n @queue.wait\n end\n job\n end", "def work\n if job = lock_job\n QC.log_yield(:action => \"work_job\", :job => job[:id]) do\n begin\n call(job)\n ...
[ "0.75984836", "0.74081296", "0.71562034", "0.6958986", "0.6915542", "0.6848545", "0.6818486", "0.67338485", "0.6617119", "0.6548684", "0.6544134", "0.65020645", "0.6388422", "0.63763344", "0.63583463", "0.6347701", "0.63031745", "0.6285066", "0.62428504", "0.6238647", "0.6235...
0.76929003
0
Attempt to lock a job in the queue's table. Return a hash when a job is locked. Caller responsible for deleting the job when finished.
def lock_job log(:at => "lock_job") job = nil while @running break if job = @queue.lock @queue.wait end job end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def work\n stat :attempting_lock_on, item_id: object_id\n if @mutex.try_lock\n stat :has_lock_on, item_id: object_id\n chore\n stat :releasing_lock_on, item_id: object_id\n @mutex.unlock\n else\n stat :bailed_on, item_id: object_id\n end\n end", "def lock...
[ "0.6452512", "0.6431981", "0.6416419", "0.63524985", "0.6215029", "0.61149627", "0.60660475", "0.6065861", "0.58844405", "0.58577037", "0.5808292", "0.57772124", "0.57528585", "0.57496834", "0.5696457", "0.56470734", "0.56314474", "0.55414003", "0.5536355", "0.5518415", "0.55...
0.70044535
0
Each job includes a method column. We will use ruby's eval to grab the ruby object from memory. We send the method to the object and pass the args.
def call(job) args = job[:args] klass = eval(job[:method].split(".").first) message = job[:method].split(".").last klass.send(message, *args) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run\r\n return unless if?\r\n job_name.constantize.send method_name, formatted_arguments\r\n end", "def run_job(func, *args)\n if self.method(func).arity > 1\n self.send(func, *args)\n else\n self.send(func, args)\n end\n end", "def invoke_job\n payload_object.per...
[ "0.6800136", "0.6119042", "0.60659945", "0.6003197", "0.5835748", "0.5820735", "0.5820339", "0.5695362", "0.56889665", "0.5594962", "0.5581115", "0.55651623", "0.5553086", "0.55027896", "0.5485583", "0.5466127", "0.54465723", "0.54454345", "0.5445061", "0.54314995", "0.540335...
0.6952951
0
Saves page as HTML files.
def save_pages path = SAVED_PAGES_DIR # prepare dir FileUtils.mkdir(path) unless File.directory?(path) # prepare filename url = @page.current_url url = url.sub(/#{Regexp.quote(Testing.base_url)}\//, '') # remove base url url = url.gsub(/\//, '_') # change / to _ url = 'homepage' if url...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_page(file_name = nil)\r\n file_name ||= Time.now.strftime(\"%Y%m%d%H%M%S\") + \".html\"\r\n puts \"about to save page: #{File.expand_path(file_name)}\" if $DEBUG\r\n File.open(file_name, \"w\").puts page_source\r\n end", "def XOsavePage()\n\t\tbegin\n\n\t\t\tfileName= $gcfd.log...
[ "0.8056935", "0.7496878", "0.7451122", "0.72687405", "0.7257353", "0.7221766", "0.71642417", "0.70610464", "0.69691384", "0.69001395", "0.69001395", "0.6792995", "0.67413515", "0.67035264", "0.6671045", "0.6603934", "0.6600621", "0.6598848", "0.64960265", "0.6471284", "0.6467...
0.79802847
1
Returns true if file with name was found in download path.
def downloaded_file?(name) begin true if check_for_downloaded_file(name) rescue Errno::ENOENT false ensure FileUtils.rm_rf(DOWNLOADS_DIR) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download?\n File.exist?(path) || data.exists? ? false : true\n end", "def has_file? name\n File.file? path / name\n end", "def file_exists?(name)\n File.file?(File.join(path, name))\n end", "def file?(name)\n File.file?(path(name))\n end", "def knows?(name)\n !find_...
[ "0.768257", "0.75007045", "0.7192698", "0.7155981", "0.701944", "0.69712734", "0.68998456", "0.68370384", "0.6787563", "0.6778114", "0.67778194", "0.67461026", "0.67211103", "0.66951305", "0.6686307", "0.6680138", "0.6641023", "0.66271234", "0.662026", "0.66171306", "0.661684...
0.81684387
0
Yields opened file and ensures downloads directory is removed after.
def downloaded_file(name) begin file = File.open(check_for_downloaded_file(name)) yield file if block_given? file.close ensure FileUtils.rm_rf(DOWNLOADS_DIR) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download!\n return download if file.nil?\n\n file.close\n file.unlink\n self.file = nil\n download\n end", "def cleanDownloads()\n dir(\"#{DOWNLOADS_DIR}/*\").each do |path|\n if path != PREV_DOWNLOADS_DIR\n # colourFile(path)\n moveOldDownload(path)\n e...
[ "0.64600426", "0.62767065", "0.6195767", "0.61815876", "0.61716676", "0.6117953", "0.60527706", "0.59716886", "0.5901977", "0.58466125", "0.5843151", "0.5815639", "0.5774412", "0.57603896", "0.57499844", "0.57289475", "0.5717408", "0.5708387", "0.5692621", "0.5678006", "0.567...
0.71847224
0
Returns user or creates new one by given role (nondefault).
def get_user(role, *args) # prepare role name role = role.parameterize(?_).to_sym unless role.is_a?(Symbol) if Testing.users[role] # reload user Testing.users[role].user.reload else # create user Testing.users[role] = Factory(role, *args) end Testing.users[role] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def with_role(role_name)\n self.role = Role.where(name: role_name).first_or_create\n self # returns the user\n end", "def create_login_user(role = nil)\n create(\"#{role || :admin}_user\").tap { |u| login_user(u) }\n end", "def find_or_create_user(site=nil)\n if site.nil? and !self.users.em...
[ "0.80796206", "0.75257456", "0.7084824", "0.704867", "0.70045424", "0.68900895", "0.68900895", "0.6850279", "0.6586881", "0.6580186", "0.65649736", "0.65100557", "0.64267343", "0.6420839", "0.6395152", "0.6395152", "0.6382855", "0.6372307", "0.6365006", "0.6345234", "0.634227...
0.7861061
1
Returns full name of user by his role.
def get_user_name(role) get_user(role).full_name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def role_name\n @role_name ||= object.meta[:role].try(:capitalize)\n end", "def name\n \"#{role_name} #{user&.email}\"\n end", "def role_name\r\n Role.find(object.role_id).role_name\r\n end", "def role\r\n r = read_attribute(:role)\r\n r.capitalize unless r.nil?\r\n end", "def get_ro...
[ "0.74773586", "0.73530936", "0.7335994", "0.7276779", "0.7251935", "0.7163674", "0.7071336", "0.70625144", "0.70043963", "0.6862761", "0.6818438", "0.6747765", "0.6747765", "0.6696236", "0.6688714", "0.6673189", "0.66266805", "0.66201437", "0.660149", "0.6546882", "0.65446573...
0.8967904
0
Returns email of user by his role.
def get_user_email(role) get_user(role).email end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_user_name(role)\n get_user(role).full_name\n end", "def get_user_email\n user = User.find(self.user_id)\n user.email\n end", "def admin_emails\n User.with_role(:admin, self).pluck(:email)\n end", "def email\n return unless @user.loa3?\n\n value_for('emails')&.first\n end",...
[ "0.70791024", "0.6951976", "0.6823246", "0.6756398", "0.67435795", "0.6634481", "0.65817404", "0.6566395", "0.6548022", "0.6535566", "0.6454505", "0.64337593", "0.64110744", "0.63814473", "0.631941", "0.62906945", "0.62682307", "0.62479496", "0.62455654", "0.62455654", "0.622...
0.90248567
0
Saves user with role and email into Testingusers hash.
def save_user(role, email) # prepare role name role = role.parameterize(?_).to_sym unless role.is_a?(Symbol) # make sure no user with same email is saved unless get_user(role).email == email Testing.users[role] = User.find_by_email(email) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_save\n # Create the user with a unique email.\n email = @user.email_address\n at_ndx = email.index('@')\n modifier = \"_#{Jinx::UID.generate}\"\n @user.email_address = email.insert(at_ndx, modifier)\n @user.login_name = nil\n verify_save(@user)\n \n # Update the address.\n lo...
[ "0.67035633", "0.6299905", "0.62603503", "0.6214829", "0.61662936", "0.6138687", "0.61385626", "0.6133372", "0.6131807", "0.6131807", "0.6128904", "0.6040694", "0.6033824", "0.60336715", "0.6021824", "0.60114974", "0.60092264", "0.60001874", "0.5986812", "0.59661204", "0.5932...
0.77372015
0
Calls block for email. If no options were passed, uses last email.
def open_email(opts = {}, &blk) opts.empty? ? blk.call(emails.last) : blk.call(find_email(opts)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def receive_inbound_email_from_mail(**kwargs, &block); end", "def email_to(email='weare@icalialabs.com', &block)\n puts \"Hi #{email}\"\n yield if block_given?\n puts \"It was nice talking to you, see you!\"\nend", "def email(name, &block)\n raise \"The email '#{name}' is already defined\" if self.me...
[ "0.6691691", "0.6509347", "0.6207139", "0.6155163", "0.61072505", "0.60718304", "0.60718304", "0.60470617", "0.59935564", "0.5986473", "0.5735649", "0.56812257", "0.56632024", "0.56632024", "0.56632024", "0.56632024", "0.565569", "0.56252104", "0.5616625", "0.5615721", "0.561...
0.68484765
0
Returns email which matches options.
def find_email(opts) find_emails(opts).first end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_emails(opts)\n emails.reverse.select do |email|\n email.to.include?(opts[:to]) || email.subject == opts[:subject]\n end\n end", "def hf_email_opts\n return options_for_select(@email_enum, @agg)\n end", "def email\n @email ||= select { |type,value| type == :email }.map do |(typ...
[ "0.7402068", "0.71108353", "0.665396", "0.66466504", "0.65922785", "0.6482124", "0.64553875", "0.62137663", "0.62112653", "0.61952025", "0.6156319", "0.6148581", "0.61339813", "0.6130241", "0.6122711", "0.61206514", "0.6111462", "0.610062", "0.6091365", "0.60588497", "0.60527...
0.7285309
1
Returns an array of emails which match options. Please note that it searches from the most recent to oldest emails.
def find_emails(opts) emails.reverse.select do |email| email.to.include?(opts[:to]) || email.subject == opts[:subject] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getEmailsByRecipient(recipientEmail)\n searchCriteria = Hash.new\n searchCriteria['recipient']= recipientEmail\n return getEmails(searchCriteria)\n end", "def complete_email_list\n #Email.select(:email).map{|email_record| email_record.email}\n User.all.map(&:email)\n end", "def all_a...
[ "0.63930243", "0.62542325", "0.62459", "0.6218688", "0.6195318", "0.611811", "0.6102273", "0.6073789", "0.6057075", "0.6051387", "0.6042426", "0.60371006", "0.6028046", "0.5992832", "0.59848726", "0.5976612", "0.59741294", "0.59592247", "0.5933756", "0.5932831", "0.59074754",...
0.81047475
0
GET /valoration_users GET /valoration_users.json
def index @valoration_users = ValorationUser.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def users\n get('get_users')\n end", "def users(args = {})\n get(\"/users.json\",args)\n end", "def list_users\n self.class.get('/users')\n end", "def index\n render json: current_org.users\n end", "def show\n @users = User.all\n json_response(@users)\n end", "def i...
[ "0.6857912", "0.67867386", "0.6713382", "0.6672931", "0.66613084", "0.6650944", "0.66458863", "0.6633754", "0.6615078", "0.66113013", "0.65589124", "0.65478677", "0.65461254", "0.65391105", "0.653215", "0.65111136", "0.6507204", "0.65040106", "0.6503044", "0.6501361", "0.6499...
0.7486669
0
DELETE /valoration_users/1 DELETE /valoration_users/1.json
def destroy @valoration_user.destroy respond_to do |format| format.html { redirect_to valoration_users_url, notice: 'Valoracion de usuario eliminada correctamente .' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def DeleteUser id\n \n APICall(path: \"users/#{id}.json\",method: 'DELETE')\n \n end", "def delete_user_for_tenant(args = {}) \n delete(\"/tenants.json/#{args[:tenantId]}/users/#{args[:userId]}\", args)\nend", "def delete\n render json: User.delete(params[\"id\"])\n end", "def d...
[ "0.71498907", "0.70878637", "0.7073339", "0.6991608", "0.69904757", "0.69669205", "0.69529426", "0.68953174", "0.6893181", "0.68703747", "0.6869683", "0.6856151", "0.6822391", "0.68212324", "0.68212324", "0.68152386", "0.68060744", "0.67937046", "0.6785788", "0.67701346", "0....
0.7270156
0
Index manifest range labels and OCR which is cached in Versionocr_text.
def manifest_content versions.flat_map(&:ocr_text).compact end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def manifestation_index_field_labels\n Blacklight.config[:manifestation_index_fields][:labels]\n end", "def image_ids_labels_from_manifest_as_hash(manifest)\n ids_labels = []\n page_number = 0\n manifest.sequences.first.canvases.each do |canvas|\n page_number += 1\n id = canvas.images.fi...
[ "0.5672804", "0.5596004", "0.5365592", "0.5259642", "0.5251661", "0.5234646", "0.5134985", "0.5097468", "0.5095543", "0.49989572", "0.49847534", "0.49847534", "0.49391136", "0.49298456", "0.4929787", "0.49023813", "0.48817268", "0.48682404", "0.48680332", "0.4862281", "0.4861...
0.6080244
0
Build an instance of PhoneNumberInstance
def get_instance(payload) PhoneNumberInstance.new(@version, payload) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_instance(payload)\n PhoneCallInstance.new(@version, payload, )\n end", "def initialize(phone)\n @phone = phone\n end", "def initialize(prefix = Address.new.phone_prefix, number = nil, extension = nil)\n @prefix = prefix.gsub(/\\A0/,\"\")\n\n if number\n @number ...
[ "0.64506793", "0.63382", "0.6279368", "0.6224359", "0.61491865", "0.6139333", "0.612227", "0.6105795", "0.60165995", "0.60073644", "0.59386724", "0.5908376", "0.59075874", "0.5867394", "0.58635527", "0.5844259", "0.5799482", "0.57856536", "0.5783605", "0.5729937", "0.5727775"...
0.7626814
1
Returns an array of all users with the specified campus code. Takes the code as a string. The array is shuffled so that with_campus_code('code')[0] will be a random selection from the list of matching users.
def with_campus_code(code) self.find_all{|user| user[1][:campus_code]==code }.shuffle end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_courses_by_code(org_unit_code)\n all_courses = get_all_courses\n courses = []\n all_courses.each do |course|\n courses.push(course) if course[\"Code\"].downcase.include? org_unit_code.to_s.downcase\n end\n courses\nend", "def show\n @users = User.where(:invite_code => @invitecode.name)\n\n en...
[ "0.5995328", "0.5387189", "0.5054169", "0.5042612", "0.50276196", "0.49935037", "0.49935", "0.49561834", "0.49471974", "0.49309725", "0.49127328", "0.49103442", "0.4897226", "0.48948523", "0.4870965", "0.48644084", "0.48505172", "0.48126933", "0.4803131", "0.4784939", "0.4780...
0.78927916
0
Returns an array of all users with the specified affiliation type. Takes the type name as a string. The array is shuffled so that with_affiliation_type('type name')[0] will be a random selection from the list of matching users.
def with_affiliation_type(type) self.find_all{|user| user[1][:affiliation_type]==type }.shuffle end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def users\n if params._type_filter != 'all'\n store.users.where(graduation_year: \"#{params._type_filter}\").all\n else\n store.users.all\n end\n end", "def find_users_of_type(group_type)\n begin\n Skype.groups.find { |g| g.gtype == group_type}.users\n rescu...
[ "0.60695195", "0.55628043", "0.5533681", "0.55197996", "0.53264534", "0.5293263", "0.5292187", "0.528896", "0.52577406", "0.520061", "0.5196832", "0.51526374", "0.5121851", "0.5083534", "0.50710106", "0.5062476", "0.5050427", "0.50411963", "0.5034412", "0.50284797", "0.502375...
0.7788377
0
rubocop:enable Metrics/AbcSize, Metrics/MethodLength Shows a specific university's information
def show @university = University.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def university; end", "def set_university\n @university = University.friendly.find(params[:id])\n end", "def set_university\n @university = University.friendly.find(params[:id])\n end", "def show\n @university = University.find(params[:id])\n\n respond_to do |format|\n format.html ...
[ "0.7918296", "0.72640204", "0.7262395", "0.708304", "0.708304", "0.70291805", "0.70291805", "0.69708335", "0.69067067", "0.68833584", "0.6851621", "0.6835079", "0.67795134", "0.65699196", "0.6426744", "0.6423309", "0.64140713", "0.64045537", "0.6394346", "0.6374416", "0.63591...
0.76468956
1
Displays the edit page for the university
def edit @university = University.find(params[:university_id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit\n\t\t# must have admin access or be in the course\n\tend", "def update\n @university = University.find(params[:university_id])\n if @university.update(university_params)\n flash[:success] = 'Information updated!'\n redirect_to @university\n else\n render 'edit'\n end\n end", ...
[ "0.7576261", "0.72493196", "0.72191083", "0.7212998", "0.70276296", "0.6965138", "0.69448525", "0.6943546", "0.6943546", "0.6939353", "0.6921962", "0.6910706", "0.6904647", "0.6878052", "0.6878052", "0.6878052", "0.6878052", "0.6878052", "0.6878052", "0.6878052", "0.6878052",...
0.8325032
0
Toggles the favorite status of this university for the current user rubocop:disable Metrics/AbcSize
def toggle_favorite return if current_user.nil? if current_user.favorite?(params[:university_id]) current_user.remove_favorite(params[:university_id]) else current_user.add_favorite(params[:university_id]) end flash[:success] = 'Favorites list updated!' redirect_to request.referer ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def toggle\n\t\tif is_favourited\n\t\t\tself.is_favourited = false\n\t\telse\n\t\t\tself.is_favourited = true\n\t\tend\n\t\tself.save\n\tend", "def toggle_favorite\n\t toggle_favorite_for User.current_user\n\tend", "def toggle_favorite_for user\n\t fave = user.favorites.find_by_page_id(self)\n\t if fave\n\t...
[ "0.7730504", "0.7716409", "0.73339504", "0.7014469", "0.6691316", "0.6397005", "0.63002366", "0.6222146", "0.6192686", "0.61536056", "0.6069941", "0.6044374", "0.60269773", "0.6024551", "0.5999595", "0.5989017", "0.598409", "0.5937639", "0.5831324", "0.58139414", "0.58118045"...
0.8347372
0
Checks if it has a 502, if it does it's considered a thesis
def thesis 'Thesis/Dissertation' if record.find { |a| a.tag == '502' } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def server_error?\n @status.between?(500, 599) if @status\n end", "def unc_thesis_dissertation?\n rec_type_match = manuscript_lang_rec_type? || lang_rec_type?\n nature_contents_match = record.fields('008').find do |field|\n (field.value.byteslice(24..27) || '')....
[ "0.5861513", "0.5711736", "0.5674996", "0.56668204", "0.5620021", "0.56074923", "0.5465322", "0.54640204", "0.5377562", "0.53278047", "0.5297188", "0.5276339", "0.5255286", "0.5243283", "0.5183556", "0.5153264", "0.5116197", "0.5101628", "0.5082114", "0.50678253", "0.5056442"...
0.5861468
1
Check leader byte 12 and 008 byte 29 for proceeding/congress
def proceeding_or_congress if record.leader[12] == '1' || (record['008'] && record['008'].value[29] == '1') || congress? 'Proceeding/Congress' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ldr06_invalid?\n return true unless leader\n leader[6] !~ /[acdefgijkmoprt]/\n end", "def ldr07_invalid?\n return true unless leader\n leader[7] !~ /[abcdims]/\n end", "def game?\n marc_leader_06_o_r_match = %w[o r].include?(record.leader.byteslice(6))\n marc...
[ "0.6418908", "0.60957813", "0.6018501", "0.60139203", "0.56511796", "0.5593865", "0.5544834", "0.5461461", "0.5410708", "0.5380553", "0.5302432", "0.5261071", "0.5256778", "0.5240219", "0.5240219", "0.52327156", "0.51997876", "0.51624", "0.5157352", "0.5146704", "0.5121905", ...
0.64782
0
Checks all $6xx for a $v "congress"
def congress? record.find do |field| field .tag .slice(0) == '6' && field .subfields .find { |sf| sf.code == 'v' && PsulibTraject.regex_to_extract_data_from_a_string(sf.value, /Congress/i) } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validateCZ(vat_number)\r\n total = 0\r\n multipliers = [8,7,6,5,4,3,2]\r\n # Only do check digit validation for standard VAT numbers\r\n return true unless vat_number.to_s.length == 8\r\n # Multiply by multipliers\r\n 0.upto(6) do |i|\r\n total = total + vat_number[i,1].to_i * multiplier...
[ "0.5797849", "0.54535055", "0.5433697", "0.5311011", "0.5214269", "0.5204784", "0.5195527", "0.5188247", "0.51843774", "0.51213604", "0.51066893", "0.50621516", "0.50555056", "0.50261", "0.50211585", "0.4995403", "0.4989062", "0.49484044", "0.4942425", "0.4942111", "0.4925156...
0.5650355
1
Override for Book when leader(67) is 'am' issue172
def book 'Book' if record.leader[6] == 'a' && record.leader[7] == 'm' && local_formats.include?('Archives/Manuscripts') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def award; end", "def book?\n marc_leader_06_match = %w[a t].include?(record.leader.byteslice(6))\n marc_leader_07_match = %w[a c d m].include?(record.leader.byteslice(7))\n marc_008_24_27_match = record.fields('008').find do |field|\n !(field.value.byteslice(24..27)...
[ "0.58043206", "0.56808156", "0.5354745", "0.5329781", "0.53210366", "0.5291353", "0.52802956", "0.5271217", "0.5253043", "0.52498794", "0.5244782", "0.5195514", "0.5195438", "0.51704353", "0.51378924", "0.5125665", "0.51195174", "0.51195174", "0.51195174", "0.51195174", "0.51...
0.5802138
1
Add more than one element at the same time. See push. The elements object must respond to to_a, or be a PQueue itself.
def concat(elements) if empty? if elements.kind_of?(PQueue) initialize_copy(elements) else replace(elements) end else if elements.kind_of?(PQueue) @que.concat(elements.que) sort! else @que.concat(elements.to_a) sort! end end...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def push(*elements)\n @buffer.push(*elements)\n @buffer = @buffer[-@size, @size] if(@buffer.size > @size)\n end", "def push(element)\t\t\n\t\twhile !@q1.empty? do\n\t\t\t@q2.enq(@q1.pop) # Dequeue element from queue q1 and enque the same to q2\n\t\tend\n\t\t@q1.enq(element)\n\t\twhile !@q2.empty? do...
[ "0.71183294", "0.69999754", "0.69036263", "0.68946546", "0.6850859", "0.6717591", "0.66829216", "0.6616964", "0.6426364", "0.6424759", "0.64021474", "0.6345348", "0.631591", "0.6315654", "0.62973654", "0.6258348", "0.6230813", "0.62253976", "0.6194361", "0.61846006", "0.61631...
0.7095438
1
Replace the content of the heap by the new elements. The elements object must respond to to_a, or to be a PQueue itself.
def replace(elements) if elements.kind_of?(PQueue) initialize_copy(elements) else @que.replace(elements.to_a) sort! end self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def concat(elements)\n if empty?\n if elements.kind_of?(PQueue)\n initialize_copy(elements)\n else\n replace(elements)\n end\n else\n if elements.kind_of?(PQueue)\n @que.concat(elements.que)\n sort!\n else\n @que.concat(elements.to_a)\n sort!...
[ "0.67022765", "0.6239388", "0.61114365", "0.6087757", "0.60655946", "0.60194683", "0.59953433", "0.5975584", "0.5920956", "0.5873406", "0.5853339", "0.58486205", "0.58019364", "0.57722855", "0.5754801", "0.57451075", "0.57240033", "0.57193977", "0.5713128", "0.5706845", "0.56...
0.816831
0
The element at index k will be repositioned to its proper place. This, of course, assumes the queue is already sorted.
def reheap(k) return self if size <= 1 que = @que.dup v = que.delete_at(k) i = binary_index(que, v) que.insert(i, v) @que = que self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solution(a, k)\n # write your code in Ruby 2.2\n \n unless a.empty?\n for i in 1..k\n last = a.pop\n a.insert(0, last)\n end\n end\n \n return a\nend", "def insert j, k\n if k && k != 0 && greater_than?(k, j) && less_than?(k - 1, j)\n self[k] = j\n return k\n ...
[ "0.6250075", "0.61070997", "0.60651135", "0.6045751", "0.60389817", "0.59790665", "0.595738", "0.5896565", "0.5881073", "0.5860043", "0.5823886", "0.5811274", "0.57280874", "0.57280266", "0.5724399", "0.56896585", "0.56732404", "0.56697774", "0.5659419", "0.56568813", "0.5654...
0.69713724
0
Sort the queue in accorance to the given comparison procedure.
def sort! @que.sort! do |a,b| case @cmp.call(a,b) when 0, nil then 0 when 1, true then 1 when -1, false then -1 else warn "bad comparison procedure in #{self.inspect}" 0 end end self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sort!\n lock.synchronize do\n queue.replace(\n Hash[\n queue.sort do |x,y|\n x,y = y,x if @reverse_sort\n (x.last.respond_to?(:call) ? x.last.call : x.last).to_f <=>\n (y.last.respond_to?(:call) ? y.last.call : y.last).to_f\n e...
[ "0.73638964", "0.71395195", "0.6997533", "0.68154347", "0.6751926", "0.6711971", "0.6680894", "0.663361", "0.66243804", "0.6619262", "0.66104317", "0.66002417", "0.6572275", "0.654175", "0.65317494", "0.65134597", "0.65091723", "0.6505699", "0.6491581", "0.6463892", "0.645422...
0.7416512
0
Parse line for authentication failures, attempts are turned in to objects
def parseLine(line) if line.include? "Failed password" and !line.include? "invalid user" lineArray = line.split(pattern=" ") $attempts.push(Attempt.new(lineArray[0], lineArray[1], lineArray[2], lineArray[10])) #noticed someone was brute forcing my ssh while I left it on overnight, noticed having #an invalid use...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_shadow_line(line)\n x = line.split(':')\n {\n 'user' => x.at(0),\n 'password' => x.at(1),\n 'last_change' => x.at(2),\n 'min_days' => x.at(3),\n 'max_days' => x.at(4),\n 'warn_days' => x.at(5),\n 'inactive_days' => x...
[ "0.59757906", "0.58948463", "0.581665", "0.56030965", "0.5596017", "0.5577017", "0.5551559", "0.5501202", "0.544915", "0.54125816", "0.5411792", "0.5397847", "0.5354549", "0.53473306", "0.5328617", "0.5310893", "0.5309286", "0.53072184", "0.52800006", "0.52478695", "0.5241923...
0.7923529
0
GET /cookbooks GET /cookbooks.json
def index @cookbooks = Cookbook.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @cookbooks = Cookbook.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cookbooks }\n end\n end", "def index\n @cook_books = CookBook.all\n end", "def show\n @cookbook = Cookbook.find(params[:id])\n\n respond_to do |format|\n ...
[ "0.7495707", "0.69763726", "0.6903592", "0.6808471", "0.66999954", "0.6469998", "0.6394657", "0.6367011", "0.6279346", "0.62402105", "0.61928874", "0.6180782", "0.6175882", "0.6144232", "0.6139425", "0.6089647", "0.6089177", "0.6020467", "0.6003112", "0.5989565", "0.59824216"...
0.7134527
1
GET /coupons/new GET /coupons/new.json
def new @coupon = current_user.coupons.new respond_to do |format| format.html # new.html.erb format.json { render json: @coupon } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @coupon = Coupon.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @coupon }\n end\n end", "def new\n @cupon = Cupon.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cupon }\n end\n e...
[ "0.7868737", "0.7523434", "0.72374946", "0.7144004", "0.70135856", "0.70075905", "0.70075905", "0.7007119", "0.69844955", "0.6973801", "0.69477874", "0.6930193", "0.6929261", "0.6923227", "0.6907321", "0.68361217", "0.6826948", "0.6818567", "0.6814209", "0.6814209", "0.681163...
0.79471594
0
DELETE /coupons/1 DELETE /coupons/1.json
def destroy @coupon = current_user.coupons.find(params[:id]) @coupon.destroy respond_to do |format| format.html { redirect_to coupons_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @coupone.destroy\n respond_to do |format|\n format.html { redirect_to admin_coupones_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @coupon = Coupon.find(params[:id])\n @coupon.destroy\n\n respond_to do |format|\n format.html { redirect_to co...
[ "0.7824454", "0.7560472", "0.7560472", "0.7426327", "0.7409436", "0.73012096", "0.7277388", "0.72567785", "0.72345173", "0.7221046", "0.7212118", "0.719454", "0.718116", "0.7180592", "0.7178381", "0.7178381", "0.71775025", "0.7155239", "0.69896907", "0.69573563", "0.6936005",...
0.75654614
1
Renders a section of the new course form as a partial, with the locals provided.
def render_form_section(step_number) render :partial => form_section_partial(step_number) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def collection_form(params)\n render(:partial => \"layouts/collection_form\", :locals => params)\n end", "def create\n @section = Section.new(section_params)\n @course = Course.find(params[:course_id])\n @section.course_id = @course.id\n respond_to do |format|\n if @section.save\n for...
[ "0.6517656", "0.6438588", "0.6257084", "0.6197232", "0.6195565", "0.6128075", "0.6099174", "0.5989343", "0.5924707", "0.5899397", "0.58902395", "0.5866849", "0.58593816", "0.58593816", "0.5828044", "0.58233833", "0.5815042", "0.5814026", "0.5811041", "0.5804293", "0.5801057",...
0.65311354
0
Renders a link to the new action of the current resource.
def link_new(text = t("admin.common.new_link"), url = new_resource_url) link_to text, url, :class => 'new' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def link_to_new(text, path, options={})\n if path.is_a? Class\n text ||= t(\"app.actions.new\", :default => \"New\") + ' ' + path.try(:human_name).to_s.downcase\n path = options.delete(:url) || new_polymorphic_path(path) unless path.is_a? String\n end\n link_to_action(text, path, options.reverse...
[ "0.71003175", "0.67470634", "0.6716058", "0.66174686", "0.6612417", "0.65951645", "0.65459746", "0.650439", "0.650439", "0.650439", "0.650439", "0.6401635", "0.63767475", "0.63767475", "0.6362285", "0.62672347", "0.62430656", "0.624117", "0.6194693", "0.61932355", "0.61634225...
0.7411677
0
Renders a table for a given ActiveRelation. Example:
def render_table(arel) return if arel.first.nil? partial :table, :locals => {:model => arel.first.class, :arel => arel} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def table options = {} \n render_partial :table, template_locals(:table_row, options)\n end", "def table_of(things,opts={})\n kind = things.first.table_name\n # columns = things.first.visible_columns\n add_class_to_html_options(opts, kind)\n content_tag(\n :table,\n ...
[ "0.685716", "0.66295767", "0.65225935", "0.630819", "0.60531455", "0.60243446", "0.60181785", "0.59902173", "0.5941051", "0.58121914", "0.5780403", "0.5778026", "0.5705918", "0.5691368", "0.5685244", "0.5676578", "0.56720835", "0.5663998", "0.56602997", "0.5642353", "0.562869...
0.71918875
0
p factorial(5) Write a method that accepts two arrays of numbers, and prints the sum of every combination of numbers from first and second array. For example, if the method receives [1, 5, 10] and [100, 500, 1000], the method should print a list: 101, 501, 1001, 105, 505, 1005, 110, 510, 1010].
def sum_combinations(first_array, second_array) new_array = [] first_array.each do |first_number| second_array.each do |second_number| new_array << first_number + second_number end end new_array end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sum_combinations(numbers1, numbers2)\n result = []\n numbers1.each do |number1|\n numbers2.each do |number2|\n result << number1 + number2\n end\n end\n result\nend", "def sum_combinations(numbers1, numbers2)\n result = []\n numbers1.each do |number1|\n numbers2.each do |number2|\n r...
[ "0.72538614", "0.72538614", "0.71575385", "0.68614876", "0.6598263", "0.6524028", "0.6419899", "0.6394974", "0.63879704", "0.6372417", "0.63713336", "0.6359029", "0.6342019", "0.62840295", "0.6276934", "0.62743974", "0.62480026", "0.6245428", "0.623474", "0.6233651", "0.62308...
0.7435915
0
Are we past all due_dates and section due_dates for this assignment? This does not take extensions into consideration.
def past_all_due_dates? # If no section due dates /!\ do not check empty? it could be wrong return false if !due_date.nil? && Time.current < due_date return false if section_due_dates.any? { |sec| !sec.due_date.nil? && Time.current < sec.due_date } true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def past_due?\n self.updated_at.to_date > self.due_date\n end", "def past?\n due_on < Date.today\n end", "def overdue?\n return true if @past_due\n false\n end", "def overdue?\n return false if due_at.nil?\n due_at < Time.now \n end", "def overdue?\n due < Date...
[ "0.75103384", "0.7506947", "0.7407898", "0.72714686", "0.71805996", "0.71388173", "0.70758104", "0.70613337", "0.69609195", "0.69539124", "0.69050086", "0.68459016", "0.68005824", "0.6785183", "0.6770382", "0.6728164", "0.6707958", "0.6673514", "0.6663262", "0.666038", "0.665...
0.85159796
0
Return an array with names of sections past
def section_names_past_due_date if !self.section_due_dates_type && !due_date.nil? && Time.current > due_date return [] end sections_past = [] self.section_due_dates.each do |d| if !d.due_date.nil? && Time.current > d.due_date sections_past << d.section.name end end se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sections\n @sections.values\n end", "def sections\n @data.keys\n end", "def sections\n @pages.collect { |p| p.sections }.flatten\n end", "def section_contents\n used_sections = {}\n\n each_method do |method|\n next unless method.display?\n\n used_sections[method.section] =...
[ "0.65460247", "0.6378971", "0.63661057", "0.6332716", "0.6199342", "0.61626226", "0.6130235", "0.61289954", "0.6107049", "0.60453933", "0.6034676", "0.6034676", "0.6029097", "0.5967057", "0.5951521", "0.5927236", "0.5893753", "0.5860448", "0.58439827", "0.5843596", "0.5814976...
0.71234185
0
Return the start_time for +section+ if it is not nil, otherwise return this assignments start_time instead.
def section_start_time(section) return start_time unless section_due_dates_type section&.section_due_dates&.find_by(assignment: self)&.start_time || start_time end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_time\n dtstart_property ? dtstart.to_datetime : nil\n end", "def start_t\n self.start_time.strftime(\"%I:%M\") if self.start_time\n end", "def start_time\n @parts.first.start_time\n end", "def start_time\n eval(start) if start.present?\n end", "def get_collection...
[ "0.6611356", "0.63496816", "0.63237846", "0.6315924", "0.61634696", "0.5929832", "0.59176123", "0.5888484", "0.58759874", "0.5828085", "0.5786118", "0.5782122", "0.5776625", "0.57565486", "0.57317555", "0.57188463", "0.5703946", "0.5685448", "0.5680661", "0.5667713", "0.56631...
0.83767444
0
Calculate the latest due date among all sections for the assignment.
def latest_due_date return due_date unless section_due_dates_type due_dates = section_due_dates.map(&:due_date) << due_date due_dates.compact.max end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def due_date\n if assignment.section_due_dates_type\n a_due_date = assignment.assessment_section_properties\n .find_by(section_id: inviter&.section)&.due_date || assignment.due_date\n else\n a_due_date = assignment.due_date\n end\n extension_time = (extension&.time...
[ "0.66624385", "0.64978683", "0.63785654", "0.6357543", "0.62413526", "0.6073185", "0.60312366", "0.5918119", "0.5880308", "0.58605635", "0.5858714", "0.58551776", "0.5819644", "0.5787709", "0.5778905", "0.57377017", "0.57364464", "0.57348734", "0.5726459", "0.5724474", "0.571...
0.7644729
0
Return collection date for all groupings as a hash mapping grouping_id to collection date.
def all_grouping_collection_dates submission_rule_hours = submission_rule.periods.pluck('periods.hours').sum.hours no_penalty = Set.new(groupings.joins(:extension).where('extensions.apply_penalty': false).pluck(:id)) collection_dates = Hash.new { |h, k| h[k] = due_date + submission_rule_hours } all_grou...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_grouping_due_dates\n section_due_dates = groupings.joins(inviter: [section: :section_due_dates])\n .where('section_due_dates.assessment_id': id)\n .pluck('groupings.id', 'section_due_dates.due_date')\n\n grouping_extensions = groupings.j...
[ "0.68985265", "0.6179693", "0.6074221", "0.5908538", "0.5896297", "0.58740526", "0.5835777", "0.5834629", "0.57039577", "0.5646266", "0.5592449", "0.55805844", "0.5535527", "0.5521801", "0.5419339", "0.5414376", "0.5407178", "0.53307223", "0.52696747", "0.5269064", "0.5261794...
0.80465966
0
Return due date for all groupings as a hash mapping grouping_id to due date.
def all_grouping_due_dates section_due_dates = groupings.joins(inviter: [section: :section_due_dates]) .where('section_due_dates.assessment_id': id) .pluck('groupings.id', 'section_due_dates.due_date') grouping_extensions = groupings.joins(:exte...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_grouping_collection_dates\n submission_rule_hours = submission_rule.periods.pluck('periods.hours').sum.hours\n no_penalty = Set.new(groupings.joins(:extension).where('extensions.apply_penalty': false).pluck(:id))\n collection_dates = Hash.new { |h, k| h[k] = due_date + submission_rule_hours }\n ...
[ "0.7547602", "0.5708773", "0.5608013", "0.5571348", "0.5565333", "0.5494454", "0.5491765", "0.5466965", "0.5460922", "0.54379493", "0.54379493", "0.5391702", "0.53843033", "0.5348482", "0.52871644", "0.52607083", "0.5225119", "0.52177906", "0.51892334", "0.51842934", "0.51721...
0.82948434
0
checks if the due date for +section+ has passed for this assignment or if the main due date has passed if +section+ is nil.
def past_collection_date?(section = nil) Time.current > submission_rule.calculate_collection_time(section) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def past_all_due_dates?\n # If no section due dates /!\\ do not check empty? it could be wrong\n return false if !due_date.nil? && Time.current < due_date\n return false if section_due_dates.any? { |sec| !sec.due_date.nil? && Time.current < sec.due_date }\n\n true\n end", "def section_start_time(sec...
[ "0.68316144", "0.6027668", "0.58691174", "0.5817499", "0.5736533", "0.57332796", "0.5676839", "0.562399", "0.55553293", "0.5540483", "0.55387837", "0.553669", "0.5522066", "0.5494772", "0.5493549", "0.54701877", "0.5455643", "0.54438186", "0.5436364", "0.5411823", "0.53773504...
0.6037223
1
Return true if this is a group assignment; false otherwise
def group_assignment? invalid_override || group_max > 1 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate_group(grp)\n true\n end", "def has_group?\n\t\t@group == ''\n\tend", "def has_group?\n @group == ''\n end", "def group?(group)\n\t\t\tend", "def group?\n true\n end", "def belongs_to_group?\n self.group ? true : false\n end", "def group?\n type == :group_i...
[ "0.73700017", "0.7085128", "0.7085075", "0.7007405", "0.69147724", "0.6789472", "0.67761934", "0.67761934", "0.67606944", "0.6724919", "0.6724355", "0.66221046", "0.6609396", "0.6609396", "0.6580318", "0.65559894", "0.6530837", "0.6528801", "0.64976317", "0.64862597", "0.6454...
0.7879265
0
Returns the group by the user for this assignment. If pending=true, it will return the group that the user has a pending invitation to. Returns nil if user does not have a group for this assignment, or if it is not a group assignment
def group_by(uid, pending=false) return unless group_assignment? # condition = "memberships.user_id = ?" # condition += " and memberships.status != 'rejected'" # add non-pending status clause to condition # condition += " and memberships.status != 'pending'" unless pending # groupings.first(inc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_group group_uuid\n group_uuid = @everyone_group if group_uuid.blank?\n \n return group_uuid if group_uuid.is_a?(Group)\n\n tmp = @groups.find{|grp|grp.uuid == group_uuid}\n \n raise \"unknown group or user with id #{group_uuid}\" unless tmp\n \n tmp\n ...
[ "0.64377785", "0.62712103", "0.6109005", "0.60526294", "0.59797424", "0.5970683", "0.59606713", "0.5936941", "0.58517164", "0.58206666", "0.5807047", "0.5767545", "0.5765994", "0.57379544", "0.57206124", "0.57015955", "0.5680632", "0.5659439", "0.563401", "0.5631924", "0.5548...
0.6889387
0
Returns a boolean indicating whether marking has started for at least one submission for this assignment. Only the most recently collected submissions are considered.
def marking_started? Result.joins(:marks, submission: :grouping) .where(groupings: { assessment_id: id }, submissions: { submission_version_used: true }) .where.not(marks: { mark: nil }) .any? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def at_submission_limit?\n if assessment.max_submissions == -1\n false\n else\n count = assessment.submissions.where(course_user_datum: course_user_datum).count\n count >= assessment.max_submissions\n end\n end", "def has_ta_for_marking?\n ta_memberships.count > 0\n end", "def has_...
[ "0.65497744", "0.6442843", "0.6427484", "0.6427484", "0.6427484", "0.6415172", "0.6296651", "0.6267579", "0.62600434", "0.6258977", "0.62069887", "0.6139671", "0.6119147", "0.60979986", "0.6074502", "0.6005708", "0.59459144", "0.59257805", "0.58691365", "0.5851322", "0.584381...
0.7670785
0
Returns a list of total marks for each complete result for this assignment. There is one mark per grouping (not per student). Does NOT include: groupings with no submission incomplete results original results when a grouping has submitted a remark request that is not complete
def completed_result_marks return @completed_result_marks if defined? @completed_result_marks @completed_result_marks = self.current_results .where(marking_state: Result::MARKING_STATES[:complete]) .order(:total_mark) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def percentage_grades_array(assignment)\n groupings = assignment.groupings\n .joins(:tas)\n .where(memberships: { user_id: id })\n grades = []\n\n if assignment.assign_graders_to_criteria\n criteria_ids = self.criterion_ta_associations.where(assessmen...
[ "0.66736305", "0.6563935", "0.60964465", "0.6092609", "0.59290284", "0.58807623", "0.58621305", "0.58563954", "0.563786", "0.56040406", "0.5603901", "0.5529249", "0.5495633", "0.5478703", "0.5440172", "0.5396839", "0.53787684", "0.5327259", "0.53193814", "0.52937317", "0.5288...
0.68614364
0
Clones the Groupings from the assignment with id assessment_id into self. Destroys any previously existing Groupings associated with this Assignment
def clone_groupings_from(assessment_id) warnings = [] original_assignment = Assignment.find(assessment_id) self.transaction do self.group_min = original_assignment.group_min self.group_max = original_assignment.group_max self.student_form_groups = original_assignment.student_form_groups ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_assignment_group(course_id,opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n :name,\n :position,\n :group_weight,\n :rules,\n \n ]\n\n # verify existence of params\n raise \"course_id is required\" if course_id.nil?\n...
[ "0.5652616", "0.54184777", "0.54184777", "0.5326901", "0.5303908", "0.5192986", "0.5096948", "0.49637893", "0.49484473", "0.49453995", "0.49220583", "0.48253575", "0.48099196", "0.48020983", "0.47992045", "0.4795924", "0.4756138", "0.47462055", "0.47451362", "0.47436652", "0....
0.77257097
0
Get a list of repo checkout client commands to be used for scripting
def get_repo_checkout_commands(ssh_url: false) self.groupings.includes(:group, :current_submission_used).map do |grouping| submission = grouping.current_submission_used next if submission&.revision_identifier.nil? url = ssh_url ? grouping.group.repository_ssh_access_url : grouping.group.repository...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def commands\n @commands ||= source.checkout(revision, configuration[:deploy_release])\n end", "def client_commands\n @client_commands ||= []\n end", "def available_commands(options)\n commands = %w[/start /checkin /checkout]\n response_to_user(options, commands.to_s)\n end", "...
[ "0.6906992", "0.66299105", "0.64811516", "0.6417524", "0.63387716", "0.62840855", "0.6183623", "0.61274904", "0.60522085", "0.6041457", "0.6018772", "0.60027796", "0.5930975", "0.59106493", "0.58975005", "0.5853557", "0.58476704", "0.5822731", "0.5821721", "0.5796154", "0.579...
0.669381
1
Generate JSON summary of grades for this assignment for the current user. The user should be an admin or TA.
def summary_json(user) return {} unless user.admin? || user.ta? if user.admin? groupings = self.groupings graders = groupings.joins(:tas) .pluck_to_hash(:id, 'users.user_name', 'users.first_name', 'users.last_name') .group_by { |x| x[:id] } as...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_grades\r\n grade_nodes = BankNodestructure.grade_gather(params[:subject])\r\n render json: grade_nodes.to_json\r\n end", "def show_grades(grades, format)\n puts 'Assessment\\'s grades'\n puts AssessmentSerializer::serialize_grades(grades, format)\n puts\n end", "def grade_for(u...
[ "0.65349764", "0.6458462", "0.63696796", "0.63133717", "0.62026393", "0.61628884", "0.612055", "0.61048", "0.60763615", "0.6075817", "0.60441387", "0.6010963", "0.5997677", "0.593085", "0.5891875", "0.5885968", "0.587215", "0.5867793", "0.58181137", "0.57529193", "0.57428896"...
0.6518727
1
Generate CSV summary of grades for this assignment for the current user. The user should be an admin or TA.
def summary_csv(user) return '' unless user.admin? if user.admin? groupings = self.groupings .includes(:group, :accepted_students, current_result: :marks) else groupings = self.groupings .include...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def student_all_report\n @user = User.find(params[:id])\n report = StringIO.new\n CSV::Writer.generate(report, ',') do |csv|\n #Get Words\n @words = @user.word_answers.find(:all, :order => \"question_id ASC\")\n csv << %w(question answer date)\n @words.each do |answer|\n csv <...
[ "0.64762557", "0.6321437", "0.61371285", "0.6104188", "0.60931075", "0.6081165", "0.6062825", "0.600055", "0.5902005", "0.5894944", "0.58642745", "0.5826113", "0.5805274", "0.5775729", "0.57514143", "0.5672579", "0.56558406", "0.56496567", "0.5637919", "0.56340665", "0.560769...
0.7496393
0
Returns an array of [mark, max_mark].
def get_marks_list(submission) criteria.map do |criterion| mark = submission.get_latest_result.marks.find_by(criterion: criterion) [(mark.nil? || mark.mark.nil?) ? '' : mark.mark, criterion.max_mark] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def max_markers\n @max_markers ||= arg ? arg.to_i : MAX_MARKERS\n end", "def marks\n marks = []\n if input =~ / *mark:(\\d\\S*)/i\n marks = $1.gsub /(\\d+)-(\\d+)/ do\n ($1.to_i..$2.to_i).to_a.join(',')\n end\n marks = marks.split(',').collect {|s| ...
[ "0.65130913", "0.6288525", "0.62065625", "0.5847636", "0.5839843", "0.5831783", "0.58300966", "0.58051425", "0.5730118", "0.5723641", "0.57102364", "0.5706892", "0.5682888", "0.56750625", "0.5651811", "0.5651421", "0.5602612", "0.55788976", "0.5578301", "0.5548771", "0.554877...
0.6789641
0
Returns all the TAs associated with the assignment
def tas Ta.find(ta_memberships.map(&:user_id)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all\n @assignments\n end", "def all\n @assignments = TaskAssignment.all\n\n end", "def get_assigned_transactions\n # find tag assignments relating to this pattern\n TagAssignment.find_all_by_source_and_source_info(2, self.id).map do |ta|\n # get the transaction to which the assignment re...
[ "0.6106364", "0.60140854", "0.59386253", "0.5815721", "0.577215", "0.57510734", "0.57510734", "0.57510734", "0.57510734", "0.57510734", "0.5709013", "0.5437892", "0.5429713", "0.5394504", "0.53821075", "0.5365384", "0.5359678", "0.5342053", "0.53200847", "0.52771217", "0.5270...
0.6438123
0
Returns all the submissions that have not been graded (completed). Note: This assumes that every submission has at least one result.
def ungraded_submission_results current_submissions_used.joins(:current_result) .where('results.marking_state': Result::MARKING_STATES[:incomplete]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_uncompleted_quests()\n Quest.all.select do |quest|\n quest.characters.include?(self) == false\n end\n\n end", "def uncompleted_students(assessment)\n course_users = assessment.course.course_users\n # Eager load :user as it's needed for the recipient email.\n students = course_users.s...
[ "0.6562504", "0.6243815", "0.6091786", "0.60580516", "0.60443515", "0.59850144", "0.59800386", "0.59739655", "0.59259164", "0.5905791", "0.5903663", "0.5900361", "0.5891795", "0.5876577", "0.58748436", "0.58684295", "0.5788737", "0.5778207", "0.57766414", "0.5775974", "0.5764...
0.77749896
0
Returns the groupings of this assignment associated with the given section
def section_groupings(section) groupings.select do |grouping| grouping.inviter.present? && grouping.inviter.has_section? && grouping.inviter.section.id == section.id end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def section_groups\n return @section_groups\n end", "def grouped_names(section)\n BASE_CONFIG[section].group_by { |_, v| v[:group] }.transform_values { |v| v.map(&:first) }\n end", "def groupbysection()\n merge(notgroupbysection: 'true')\n end", "def section_groups=(...
[ "0.7498284", "0.700692", "0.6822014", "0.6727", "0.6499582", "0.6297976", "0.6255746", "0.6225984", "0.62206864", "0.61077076", "0.6011966", "0.5975515", "0.59560347", "0.59146875", "0.59062314", "0.5886351", "0.585062", "0.5840111", "0.58187306", "0.5804865", "0.57734555", ...
0.83134943
0
Returns the groupings of this assignment that have no associated section
def sectionless_groupings groupings.select do |grouping| grouping.inviter.present? && !grouping.inviter.has_section? end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def section_groupings(section)\n groupings.select do |grouping|\n grouping.inviter.present? &&\n grouping.inviter.has_section? &&\n grouping.inviter.section.id == section.id\n end\n end", "def groupbysection()\n merge(notgroupbysection: 'true')\n end", "def possible_groups gro...
[ "0.65282017", "0.62313753", "0.6221667", "0.61291695", "0.59813946", "0.58380204", "0.57698745", "0.57679343", "0.57531184", "0.57531184", "0.57531184", "0.57382804", "0.57162774", "0.57115316", "0.56997824", "0.5666407", "0.56526107", "0.5646992", "0.5642918", "0.56289417", ...
0.760112
0
Returns true if this is a peer review, meaning it has a parent assignment, false otherwise.
def is_peer_review? !parent_assessment_id.nil? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_peer_review_assignment?\n not pr_assignment.nil?\n end", "def parent?\n !parent.nil?\n end", "def parent?\n not parent.nil?\n end", "def parent?\n true\n end", "def parent?\n ! parent.nil?\n end", "def requires_parent_approval?\n requires_paren...
[ "0.7613671", "0.71404904", "0.7124823", "0.7092197", "0.70604664", "0.70581985", "0.7031308", "0.70253164", "0.7008059", "0.69065076", "0.68752193", "0.6844034", "0.6798208", "0.67847764", "0.6759756", "0.67313075", "0.66988647", "0.6680572", "0.6639289", "0.6610706", "0.6586...
0.8202432
0
Yield an open repo for each grouping of this assignment, then yield again for each repo that raised an exception, to try to mitigate concurrent accesses to those repos.
def each_group_repo failed_groupings = [] self.groupings.each do |grouping| begin grouping.access_repo do |repo| yield(repo) end rescue StandardError # in the event of a concurrent repo modification, retry later failed_groupings << grouping end end...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def each_repository(&block)\n repositories.values.each(&block)\n end", "def all_repos_as_generator\n Enumerator.new do |enum|\n each do |repo|\n enum.yield repo\n end\n end\n end", "def all_repos_as_generator\n Enumerator.new do |enum|\n each do |repo|\n ...
[ "0.5769062", "0.54741853", "0.54741853", "0.5373891", "0.5342644", "0.5220153", "0.51537997", "0.5115386", "0.5093881", "0.5078732", "0.49326602", "0.4898599", "0.48803905", "0.48647445", "0.48645085", "0.48617437", "0.48591366", "0.48534536", "0.48212472", "0.4780582", "0.47...
0.80896103
0
zip all files in the folder at +self.autotest_files_dir+ and return the path to the zip file
def zip_automated_test_files(user) zip_name = "#{self.short_identifier}-testfiles-#{user.user_name}" zip_path = File.join('tmp', zip_name + '.zip') FileUtils.rm_rf zip_path files_dir = Pathname.new self.autotest_files_dir Zip::File.open(zip_path, Zip::File::CREATE) do |zip_file| self.autotest_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def zipfiles\n @zipfile_name = \"#{$zip_folder}#{$testcase}.zip\"\n Zip::File.open(\"#{@zipfile_name}\", Zip::File::CREATE) do |zipfile|\n Dir.glob(\"#{$image_folder}#{$testcase}*\").each do |filename|\n file = File.basename(\"#{filename}\")\n zipfile.add(file...
[ "0.7580474", "0.7249701", "0.69867814", "0.6880902", "0.6818721", "0.66885334", "0.6682488", "0.6645554", "0.6627621", "0.65886855", "0.6527539", "0.65157723", "0.65040874", "0.6441311", "0.6413885", "0.6413867", "0.6406123", "0.6397341", "0.6334762", "0.62782717", "0.6278271...
0.77902246
0
Returns the marking state used in the submission and course summary tables for the result(s) for single submission. +has_remark+ is a boolean indicating whether a remark request exists for this submission +result_marking_state+ is one of Result::MARKING_STATES or nil if there are no results for this submission +release...
def marking_state(has_remark, result_marking_state, released_to_students, collection_date) if result_marking_state.present? return 'remark' if result_marking_state == Result::MARKING_STATES[:incomplete] && has_remark return 'released' if released_to_students return result_marking_state end ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def marking_started?\n Result.joins(:marks, submission: :grouping)\n .where(groupings: { assessment_id: id },\n submissions: { submission_version_used: true })\n .where.not(marks: { mark: nil })\n .any?\n end", "def completed_result_marks\n return @completed_resu...
[ "0.6196458", "0.57900906", "0.55054015", "0.5472209", "0.5287388", "0.5229246", "0.5186584", "0.51033205", "0.49532717", "0.48759097", "0.4866761", "0.48430914", "0.47840425", "0.4767782", "0.47308603", "0.47213885", "0.46793315", "0.46694344", "0.4660344", "0.46467748", "0.4...
0.736618
0
output_image displays the original image array on the console
def output_image puts "Original Image" array.each do |row| puts row.join end puts "\n" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def output_image\n @image_array.each do |e|\n puts e.join\n end\n end", "def output_image\n @image.each do |image|\n puts image.join(' ')\n end\n end", "def output_image\r\n # loop continues through each Row and outputs content\r\n puts \"Original Image\"\r\n @array.each do |row|\r...
[ "0.8743838", "0.8411666", "0.83464825", "0.8229349", "0.8193728", "0.8159136", "0.7911556", "0.7807944", "0.7544636", "0.74437386", "0.74437386", "0.7297534", "0.6746136", "0.6692161", "0.647412", "0.6412234", "0.63871527", "0.6357325", "0.6318918", "0.63045055", "0.62975824"...
0.8688341
1
return short url append by host
def short_url "#{HOST_URL}/#{short_code}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def short(host,port)\n Rails.application.routes.url_helpers.short_url(slug: self.slug,host: host, port: port)\n end", "def build_url(host)\n host.protocol + host.url\n end", "def small_url(host=Smurl.host)\n custom_url = CustomUrl.last(smurl_id: id)\n link = custom_url.link if custom_...
[ "0.80925566", "0.7928922", "0.76821166", "0.7560309", "0.7550189", "0.75313836", "0.7279538", "0.71979976", "0.7113133", "0.70219237", "0.69709235", "0.69709235", "0.6969316", "0.6969316", "0.6963016", "0.6963016", "0.69367605", "0.69334364", "0.69334364", "0.6926783", "0.691...
0.8159383
0