query stringlengths 7 9.55k | document stringlengths 10 363k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
Ensure local dir for storing data exists. | def ensure_data_folder
return if File.directory? DATA_DIR
Dir.mkdir DATA_DIR
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ensure_store_directory\n FileUtils.mkpath( store ) unless File.directory?( store )\n end",
"def ensure_directory_exists\r\n dir = File.dirname(full_path_from_current_attributes)\r\n FileUtils.mkdir_p(dir) unless File.exists?(dir)\r\n end",
"def make_data_dir\n unless Dir.exist?(self.dat... | [
"0.77069056",
"0.73458296",
"0.7160715",
"0.70196766",
"0.70196766",
"0.6968143",
"0.6881689",
"0.67823726",
"0.67821455",
"0.6773345",
"0.6716449",
"0.6716055",
"0.67021847",
"0.67021847",
"0.66874576",
"0.6670532",
"0.66578877",
"0.6627289",
"0.66101044",
"0.65479785",
"0.6... | 0.7437091 | 1 |
Ensure program log file exists. | def ensure_program_log_file
return if File.file? LOG_FILE
CSV.open(LOG_FILE, "wb") { |csv|
csv << LOG_HEADER
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_logfile\n # strip any trailing '/' in case the user supplied this as part of\n # an absolute path, so we can match it against File.expand_path()\n path = @options.log_path.chomp(\"/\")\n if path.empty?\n path = File.join(Backup::Config.root_path, \"log\")\n els... | [
"0.68973655",
"0.6645048",
"0.6235333",
"0.608454",
"0.6057632",
"0.605104",
"0.6049247",
"0.60068107",
"0.599235",
"0.59827477",
"0.59593004",
"0.59276307",
"0.5892227",
"0.5869826",
"0.58520305",
"0.58511937",
"0.58510685",
"0.58506435",
"0.58495003",
"0.5840562",
"0.583043... | 0.74982464 | 0 |
Save program called [+ name +]'s data which is stored in [+ meths_hash +]. Also saves [+ prog_log +], which contains the program log data, and [+ file_hashes +], which contains the md5 hashes of the program's files. | def save_app_data(name, meths_hash, prog_log, file_hashes)
Dir.chdir(DATA_DIR)
if !File.directory? name
Dir.mkdir name
Dir.chdir(name)
YARD::Registry.save
File.open(name + "-" + TYPE_DATA_JSON_FILE,"w") do |f|
f.write(JSON.pretty_generate(meths_hash))
end
File.open(name + "-" + FILE_MD... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save(replaced, newprog, code)\n oldfile = @files[replaced]\n newfile = File.join(@dir, newprog + '.bfjoust')\n\n # remove old file (if not a dummy program) unless replacing it\n\n unless oldfile.nil? || oldfile == newfile\n git('rm', '-q', '--', oldfile)\n @files.delete(replaced)\n end... | [
"0.5472366",
"0.53379124",
"0.5255505",
"0.51037925",
"0.50847507",
"0.5068841",
"0.50407404",
"0.50347555",
"0.4999643",
"0.49987128",
"0.49966392",
"0.4962901",
"0.49370548",
"0.49346372",
"0.49214354",
"0.4916071",
"0.49042156",
"0.49030492",
"0.48532706",
"0.4838255",
"0.... | 0.73243463 | 0 |
Generates program log information for [+ repo_hash +], a hash containing information about the program. The log information has the format shown in LOG_HEADER. | def get_prog_log(repo_hash)
time = Time.now.getutc.to_s
if (repo_hash[:source] == "github")
[repo_hash[:name], repo_hash[:name].hash, repo_hash[:source], repo_hash[:repo][:html_url], repo_hash[:repo][:default_branch], repo_hash[:version], "", time, "", "", ""]
elsif (repo_hash[:source] == "rubygems")
[rep... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_git_commit_log(rev=ENV['LAST_SUCCESS_REV'])\n g = Git.open(Dir.getwd)\n change_log = g.log.between(rev).map { |c| \"- \" + c.message.lines.first.chomp }.join \"\\n\"\n \"Commit Log:\\n\\n#{change_log}\\n\"\nend",
"def generate_git_commit_log(rev=ENV['LAST_SUCCESS_REV'])\n g = Git.open(Dir.getwd)... | [
"0.5791808",
"0.5791808",
"0.56965107",
"0.548986",
"0.5461863",
"0.5400937",
"0.5398725",
"0.5289799",
"0.5259475",
"0.52558106",
"0.5199451",
"0.5199451",
"0.5199451",
"0.518082",
"0.51567996",
"0.5090615",
"0.5086363",
"0.5083498",
"0.5047828",
"0.5041808",
"0.5028308",
... | 0.7724795 | 0 |
Downloads program represented by [+ repo_hash +]. | def download_prog(repo_hash)
if (repo_hash[:source] == "github")
clone_repo(repo_hash)
elsif (repo_hash[:source] == "rubygems")
puts "Unpacking gem #{repo_hash[:name]}..."
system "gem unpack #{repo_hash[:name]} --version #{repo_hash[:version]}"
else
raise "Unexpected source of repo #{repo_hash[:na... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def retrieve\n raise RetrieverError.new(\"download retriever is unavailable\") unless available?\n ::FileUtils.remove_entry_secure @repo_dir if File.exists?(@repo_dir)\n ::FileUtils.remove_entry_secure workdir if File.exists?(workdir)\n ::FileUtils.mkdir_p @repo_dir\n ::FileUtils.mkdir_p w... | [
"0.6257616",
"0.62563604",
"0.6065892",
"0.6034621",
"0.6013708",
"0.60065657",
"0.5931187",
"0.5931187",
"0.58728856",
"0.58535105",
"0.57349133",
"0.56983",
"0.5686214",
"0.5649611",
"0.56415194",
"0.56055355",
"0.5601028",
"0.5586626",
"0.5544551",
"0.5515127",
"0.54957324... | 0.7924054 | 0 |
[+ github_num +] is number of top starred Ruby repos to look at on github [+ rubygem_num +] is number of top gems to look at on RubyGems Only repos that actually have YARD data are added to the data set. | def collection_loop(github_num, rubygem_num)
client = create_client()
if USE_GOOGLE_DRIVE
google_session = GoogleDrive::Session.from_config(GOOGLE_DRIVE_API_CONFIG)
type_folder = ensure_google_type_folder(google_session)
end
ensure_data_folder
ensure_program_log_file
apps_hash = File.file?(TYPE_DATA... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def upsert_top_100_gems\n page_number = 1\n while page_number <= 10 do\n stats_page_url = @ruby_gems_base_url + \"/stats?page=#{page_number}\"\n doc = Nokogiri::HTML(open(stats_page_url))\n\n # TODO: refactor this is almost identical to pagination of all ruby gems\n doc.css('.... | [
"0.6328572",
"0.5983186",
"0.59389347",
"0.5855118",
"0.5820661",
"0.56972164",
"0.5683957",
"0.5564297",
"0.55458325",
"0.55173415",
"0.5498896",
"0.5428952",
"0.53978086",
"0.5390305",
"0.53812623",
"0.5378827",
"0.537488",
"0.5359609",
"0.5351161",
"0.53468627",
"0.5333971... | 0.54582286 | 11 |
Simple method to count how much data was actually created | def count_data(apps_hash)
num_apps = apps_hash.size
num_classes = num_meths = num_types = 0
apps_hash.each { |_, klasses|
num_classes += klasses.size
klasses.each { |_, meths|
num_meths += meths.size
meths.each { |_, meth|
num_types += meth["params"].size if meth["params"]
num... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count\n @data.size\n end",
"def count; end",
"def count; end",
"def count; end",
"def count\n count = 0\n each do |data|\n count += 1\n end\n count\n end",
"def count\n # implement in subclasses\n end",
"def count\n @count\n end",
"def count\n end",
"def c... | [
"0.77982396",
"0.7667197",
"0.7667197",
"0.7667197",
"0.75904924",
"0.75363135",
"0.7459681",
"0.74303335",
"0.74303335",
"0.7428829",
"0.7408845",
"0.73877233",
"0.73358446",
"0.73358446",
"0.73358446",
"0.7272271",
"0.72271323",
"0.72271323",
"0.7217479",
"0.7197644",
"0.71... | 0.0 | -1 |
Check file hashes to find if there were any duplicates. It's fine if there are a small number of duplicates across different apps. Mostly, we want to ensure we're not collecting data from the same app twice. | def find_dups(hash)
open("dups.txt", 'w') do |f|
f.puts '=== Identical Files ==='
hash.each_value do |a|
next if a.length == 1
a.each { |fname| f << ("\t" + fname) }
f << "\n\n"
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def findDups(objArray, dupsHashArray, emptyFileArray)\n objArray.each_with_index do |obj, idx1|\n if obj.is_empty?\n emptyFileArray.push(obj.fileName)\n next \n end\n objArray.each_with_index do |obj2, idx2|\n next if idx1 >= idx2 \n if obj.md5 === obj2.md5\n foundDupHash= {:filePath => o... | [
"0.66883415",
"0.65358293",
"0.64960575",
"0.648491",
"0.6408901",
"0.6390503",
"0.6279249",
"0.62175924",
"0.6048307",
"0.59753084",
"0.59204286",
"0.5911427",
"0.5901358",
"0.5898477",
"0.5879717",
"0.5869433",
"0.58475935",
"0.5843397",
"0.5839943",
"0.5822871",
"0.5818669... | 0.63988906 | 5 |
override the provider's initialize method so we can instantiate an instance variable to keep state required for later flushing all changes in one step | def initialize(attributes={})
super(attributes)
@share_edit_args = []
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post_initialize\n # raise NotImplementedError\n end",
"def initvars\n @provider_instances = []\n @needs_flush = false\n @failed = false\n end",
"def pre_initialize; end",
"def before_initialize(&block); end",
"def post_initialize\n end",
"def initialize(*args)\n @p... | [
"0.69506294",
"0.68895936",
"0.66526824",
"0.6644415",
"0.6613856",
"0.65683806",
"0.6506075",
"0.6495891",
"0.647248",
"0.6445543",
"0.6441453",
"0.64290917",
"0.64290917",
"0.64290917",
"0.64290917",
"0.6418212",
"0.6418212",
"0.6411608",
"0.6407966",
"0.6398629",
"0.639320... | 0.0 | -1 |
used by ensure property to see if this share already exists on the system since we use prefetching, we have already determined whether we exist ahead of time, so we can just check our ensure value | def exists?
self.ensure == :present
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shared?\n sharing != 'none'\n end",
"def shared?\n sharing != 'none'\n end",
"def exists?\n @provider.get(:ensure) != :absent\n end",
"def exists?\n properties[:ensure] != :absent\n end",
"def exists?\n Puppet.debug(self.class.to_s.split('::').last + ': Calling exists met... | [
"0.65596056",
"0.6508235",
"0.6385056",
"0.6372234",
"0.6370739",
"0.6326361",
"0.6250523",
"0.6224461",
"0.6153502",
"0.6151823",
"0.6151823",
"0.6151823",
"0.6133444",
"0.6126163",
"0.6102676",
"0.6074207",
"0.60716265",
"0.60716265",
"0.6058442",
"0.6025891",
"0.602328",
... | 0.66109157 | 0 |
called by ensure property when the share should be present, but isn't | def create
sharing("-a", name)
@property_hash[:ensure] = :present
# Setters for configuring the share are not automatically called on create, so we call them
resource.properties.each do |property|
property.sync unless property.name == :ensure
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shared?\n sharing != 'none'\n end",
"def shared?\n sharing != 'none'\n end",
"def for_share\n lock_style(:share)\n end",
"def share\n @share ? @share : 'yes'\n end",
"def is_shareable?\n true\n end",
"def require_share_recipient\n @attributes[:... | [
"0.6796985",
"0.67693126",
"0.6740954",
"0.664505",
"0.65464336",
"0.6532338",
"0.6530677",
"0.6450573",
"0.64316463",
"0.6388749",
"0.63391143",
"0.6332992",
"0.6280688",
"0.6210402",
"0.61885756",
"0.6181015",
"0.6171536",
"0.6170137",
"0.6102415",
"0.6055829",
"0.6055709",... | 0.6644403 | 4 |
called by ensure when the share exists, but should be absent | def destroy
sharing("-r", share_name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flush\n return unless resource.should(:ensure) == :present\n unless @share_edit_args.empty?\n sharing([\"-e\", existing_share_name] + @share_edit_args)\n end\n end",
"def reshare dir, host\n if File.exist? \"#{dir}/#{host}/.completed\"\n `share -F nfs -o ro=#{host},anon=0 #{dir}/#{host} > ... | [
"0.63725746",
"0.62016386",
"0.6175872",
"0.6014978",
"0.59979844",
"0.5978956",
"0.59236145",
"0.5766922",
"0.5744237",
"0.574077",
"0.5664584",
"0.56569",
"0.5655901",
"0.56429887",
"0.5631194",
"0.56087077",
"0.55940384",
"0.55605924",
"0.55426747",
"0.5505124",
"0.5504586... | 0.606692 | 3 |
returns most current share name | def existing_share_name
# name is a synonym for path here since that is our namevar. share_name is the actual share_name
self.class.all_shares_attributes[name][:share_name] || File.basename(name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def last_share_at\n shares.maximum(:created_at)\n end",
"def highest_scoring_home_team\n @teams.max_by { |team| team.average_home_goals }.team_name\n end",
"def get_max_snp_name\n max_name = 0\n chromhash.each_value do |chrom|\n if chrom.get_max_snp_name > max_name\n max_name = chrom.... | [
"0.6338931",
"0.6094393",
"0.60761",
"0.6015191",
"0.6001921",
"0.5990919",
"0.59411377",
"0.5860382",
"0.5846586",
"0.5846586",
"0.58247405",
"0.57980496",
"0.57963336",
"0.57724595",
"0.5771425",
"0.5718342",
"0.5710408",
"0.57102734",
"0.5703949",
"0.5688906",
"0.566955",
... | 0.6649959 | 0 |
flush is called at the end of the process as a hook to save the resource changes Properties will have already been set as having been synced here because setters will have already been called But then how do we know if properties are in actually insync at flush time? Therein lies the problem > because according to pupp... | def flush
return unless resource.should(:ensure) == :present
unless @share_edit_args.empty?
sharing(["-e", existing_share_name] + @share_edit_args)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flush\n flush_instance\n\n # Collect the resources again once they've been changed (that way `puppet\n # resource` will show the correct values after changes have been made).\n @property_hash = read_instance\n end",
"def flush\n self.wait_for_state_transitions\n self.flush_when_ready\n ... | [
"0.7587496",
"0.74958783",
"0.7176466",
"0.71241397",
"0.7110087",
"0.7110087",
"0.7110087",
"0.7075867",
"0.7035988",
"0.6708038",
"0.6702178",
"0.664932",
"0.6573427",
"0.6519721",
"0.6517643",
"0.6463562",
"0.6249002",
"0.60959876",
"0.6090372",
"0.6081524",
"0.60540915",
... | 0.0 | -1 |
Takes a list of protocols and returns the share/guest access flags These take the form of 100, 101, 001, where each place enables or disables for that protocol As of 10.9, these are the keys and values are the same for setting guest access and for enabling sharing | def flags_for_protocols(protocols)
flag_keys = {:afp => 100, :ftp => 10, :smb => 1 }
# Start with no flags (0) and add each protocol's flag
flags_number = 0
protocols.each {|protocol| flags_number += flag_keys[protocol.downcase.to_sym] }
number_to_flags(flags_number)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_enabled_protocols(protocols)\n Hash[ protocols.select {|k,v| v[\"shared\"] == \"1\" } ].keys\n end",
"def get_guest_protocols(protocols)\n Hash[ protocols.select {|k,v| v[\"guest access\"] == \"1\" } ].keys\n end",
"def guest_protocols=(desired_protocols)\n @share_edit_args += [ \"-g\", flag... | [
"0.7342358",
"0.70136845",
"0.6466426",
"0.6131312",
"0.59819406",
"0.5864782",
"0.5848751",
"0.5711615",
"0.5519983",
"0.5481335",
"0.5473267",
"0.5458266",
"0.54580486",
"0.54026115",
"0.5371117",
"0.53670275",
"0.5366199",
"0.52755195",
"0.5180381",
"0.5177345",
"0.5076938... | 0.7556997 | 0 |
Pads a number with zeros 3 places for use with sharing command flags | def number_to_flags(number)
number.to_s.rjust(3, "0")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pad(val, number_of_places)\n str = val.to_s\n while(str.length < number_of_places) do\n str = '0' + str\n end\n str\n end",
"def left_pad_with_zero(number)\n if (number.to_s.length == 1)\n \"0#{number}\"\n else\n number\n end\nend",
"def pad number\n \t\tif number.to_s.length >= ... | [
"0.7480142",
"0.7377563",
"0.7293053",
"0.7269653",
"0.72491276",
"0.71640706",
"0.714458",
"0.7137469",
"0.708499",
"0.70151174",
"0.7010479",
"0.7002367",
"0.6924279",
"0.69195145",
"0.6893275",
"0.6890841",
"0.6877722",
"0.68736285",
"0.68711555",
"0.68141925",
"0.67536485... | 0.64990467 | 32 |
Setter for protocols (called automatically when syncing the resource) | def protocols=(desired_protocols)
@share_edit_args += [ "-s", flags_for_protocols(desired_protocols) ]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def protocols=(value)\n Curl.set_option(:protocols, value_for(value, :enum, :protocols), handle)\n end",
"def set_protocol(opts)\n opts = check_params(opts,[:protocols])\n super(opts)\n end",
"def protocol; end",
"def protocol; end",
"def protocol; end",
"def protocol; end",
"d... | [
"0.720548",
"0.6945576",
"0.6903716",
"0.6903716",
"0.6903716",
"0.6903716",
"0.6749668",
"0.6730754",
"0.6704073",
"0.65580875",
"0.65526843",
"0.636383",
"0.63494176",
"0.63121754",
"0.629242",
"0.6284899",
"0.6170723",
"0.60996306",
"0.60732853",
"0.60732853",
"0.60525143"... | 0.65784305 | 9 |
Setter for guest protocols (called automatically when syncing the resource) | def guest_protocols=(desired_protocols)
@share_edit_args += [ "-g", flags_for_protocols(desired_protocols) ]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_guest_protocols(protocols)\n Hash[ protocols.select {|k,v| v[\"guest access\"] == \"1\" } ].keys\n end",
"def protocols=(value)\n Curl.set_option(:protocols, value_for(value, :enum, :protocols), handle)\n end",
"def protocols=(desired_protocols)\n @share_edit_args += [ \"-s\", flags_... | [
"0.63209164",
"0.6151744",
"0.60509294",
"0.60376877",
"0.5941133",
"0.5888675",
"0.5888675",
"0.5888675",
"0.5888675",
"0.5794647",
"0.5789095",
"0.5776461",
"0.5727091",
"0.5651734",
"0.56512564",
"0.56109047",
"0.557809",
"0.5544391",
"0.5501535",
"0.5493273",
"0.5491224",... | 0.7301478 | 0 |
Setter for share_name (called automatically when syncing the resource) | def share_name=(new_name)
@share_edit_args += [ "-n", new_name ]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def smb_name=(new_name)\n return if new_name == @resource.should(:share_name)\n @share_edit_args += [ \"-S\", new_name ]\n end",
"def existing_share_name\n # name is a synonym for path here since that is our namevar. share_name is the actual share_name\n self.class.all_shares_attributes[name][:shar... | [
"0.77840537",
"0.7750724",
"0.74376625",
"0.72127354",
"0.7082647",
"0.68978846",
"0.68683684",
"0.6676088",
"0.63737994",
"0.62129146",
"0.6182853",
"0.60919034",
"0.60914946",
"0.6079133",
"0.60572815",
"0.6033587",
"0.6033587",
"0.6033587",
"0.6033587",
"0.6033587",
"0.603... | 0.79185694 | 0 |
Setter for afp_name (called automatically when syncing the resource) | def afp_name=(new_name)
return if new_name == @resource.should(:share_name)
@share_edit_args += [ "-A", new_name ]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_name(a_name)\n @name = a_name\n end",
"def set_name(name)\n unless name.nil?\n @name = name\n end\n @name\n end",
"def new_name(new_name)\n @name = new_name\n end",
"def set_name(name)\n @name = name\n end",
"def set_name(info)\n # Do NOT override the val... | [
"0.7516995",
"0.68149817",
"0.6803108",
"0.6786548",
"0.6719244",
"0.6679297",
"0.6664355",
"0.66528153",
"0.6650638",
"0.6630181",
"0.66193134",
"0.66193134",
"0.6614185",
"0.66130316",
"0.66021186",
"0.66021186",
"0.66003996",
"0.659891",
"0.6581637",
"0.6570626",
"0.657062... | 0.75574213 | 0 |
Setter for smb_name (called automatically when syncing the resource) | def smb_name=(new_name)
return if new_name == @resource.should(:share_name)
@share_edit_args += [ "-S", new_name ]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name= (nm)\n _c_set_name(Slaw._ensure_utf8(nm))\n end",
"def name=(name)\n\t\tself.sname = name\n\tend",
"def name=(name)\n\t\tself.sname = name\n\tend",
"def name=(value)\n @name = value.to_s.strip\n end",
"def set_name(info)\n # Do NOT override the value if it's returned from t... | [
"0.6857354",
"0.6795886",
"0.6795472",
"0.66746944",
"0.6581956",
"0.6557547",
"0.6518925",
"0.6518925",
"0.6512665",
"0.64563984",
"0.6433393",
"0.64294934",
"0.64290565",
"0.64149565",
"0.6384227",
"0.6377629",
"0.63728523",
"0.63728523",
"0.6372301",
"0.6372301",
"0.636998... | 0.77908236 | 0 |
Setter for ftp_name (called automatically when syncing the resource) | def ftp_name=(new_name)
return if new_name == @resource.should(:share_name)
@share_edit_args += [ "-F", new_name ]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_name=(value)\n @file_name = value\n end",
"def file_name=(value)\n @file_name = value\n end",
"def file_or_folder_name=(value)\n @file_or_folder_name = value\n end",
"def set_name\n self.name = domain.name if name.blank... | [
"0.62773126",
"0.62773126",
"0.61938",
"0.61473644",
"0.6124296",
"0.60499483",
"0.60499483",
"0.60102993",
"0.6010138",
"0.5975752",
"0.5969383",
"0.596154",
"0.5948031",
"0.59108484",
"0.58985007",
"0.58703667",
"0.5834634",
"0.58278733",
"0.5801787",
"0.57971936",
"0.57958... | 0.75753534 | 0 |
Setter for afp_inherit_perms (called automatically when syncing the resource) | def afp_inherit_perms=(inherit)
@share_edit_args += [ "-i", inherit ? "10" : "00" ]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_perms\n self.perms = Access.for_user(self)\n end",
"def perms=(value)\n @hash[:perms] = value\n end",
"def effective_permissions\n source = self\n\n while source.inherit && source.forum.parent\n source = source.forum.parent.forum_permissions.find_by(group: group)\n end\n\n ... | [
"0.65599835",
"0.6144058",
"0.60455847",
"0.5876672",
"0.5800752",
"0.5534895",
"0.5458012",
"0.5378209",
"0.5368216",
"0.53676236",
"0.53374356",
"0.53374356",
"0.53150535",
"0.5313278",
"0.5284224",
"0.5268449",
"0.5248638",
"0.5244741",
"0.5241558",
"0.52390635",
"0.523047... | 0.80873984 | 0 |
returns list of supported protocols | def supported_protocols
["afp", "smb", "ftp"]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enabled_protocols\n self.overview.listeners.\n map { |lnr| lnr.protocol }.\n uniq\n end",
"def wp_allowed_protocols\n # TODO static $\n protocols = []\n\n if protocols.empty?\n protocols = [ 'http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp',... | [
"0.7522514",
"0.7386065",
"0.7256675",
"0.7256675",
"0.72507995",
"0.7176128",
"0.70767397",
"0.69922495",
"0.6874818",
"0.65996724",
"0.65254706",
"0.64752537",
"0.6174341",
"0.6117942",
"0.60974944",
"0.59523124",
"0.59200233",
"0.5888606",
"0.58744067",
"0.5819137",
"0.577... | 0.76916564 | 0 |
handles the parsing of config string snippet from sharing and returns hash of protocol info | def extract_protocols
protocol_info = Hash[*snippet.split(/(#{supported_protocols.join("|")}):\t*[{}]/)[1..-1]]
supported_protocols.each do |protocol_name|
protocol_info[protocol_name] = extract_protocol(protocol_info[protocol_name])
end
protocol_info
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_protocol(protocol_string)\n [\"name\", \"shared\", \"guest access\", \"inherit perms\"].inject({}) do |hash, key|\n hash[key] = protocol_value_for_key_in_string(key, protocol_string)\n hash\n end\n end",
"def protocol; config[:protocol]; end",
"def protocol\n @protocol ||= @raw_... | [
"0.703728",
"0.66650915",
"0.5864652",
"0.58525765",
"0.58278334",
"0.5758458",
"0.575327",
"0.5673854",
"0.5632555",
"0.5574814",
"0.5503476",
"0.54888755",
"0.5460639",
"0.5453584",
"0.54496187",
"0.5389911",
"0.53526807",
"0.5352578",
"0.5333876",
"0.5324959",
"0.5321576",... | 0.5976888 | 2 |
extracts the value for a protocol key | def protocol_value_for_key_in_string(key, string)
string.split(/#{key}:\t*/)[1].to_s.split("\n").first
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(key)\n b = get_as_bytes(key)\n\n return nil if b.nil?\n\n b.pack(\"U*\").strip\n end",
"def get key\n deserialize backend.get key.to_s rescue nil\n end",
"def map_protocol_value(protocol)\n protocol = protocol.downcase\n case protocol\n when \"... | [
"0.6585408",
"0.6493751",
"0.63274884",
"0.61824566",
"0.60870326",
"0.6080282",
"0.60625154",
"0.6043003",
"0.59980154",
"0.5996382",
"0.5980619",
"0.59556186",
"0.59536356",
"0.5943096",
"0.5943096",
"0.5943096",
"0.5943096",
"0.5922128",
"0.58927387",
"0.5890958",
"0.58743... | 0.7791294 | 0 |
takes a protocol string snippet and returns a hash of the protocol keys and values | def extract_protocol(protocol_string)
["name", "shared", "guest access", "inherit perms"].inject({}) do |hash, key|
hash[key] = protocol_value_for_key_in_string(key, protocol_string)
hash
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_hash_packet(data)\n hashes = []\n\n algo = data.read_string\n size = case algo\n when \"md5\" then 128\n when \"sha256\" then 256\n when \"sha384\" then 284\n when \"sha512\" then 512\n else raise NotImplementedError, \"unsupported algorithm: #{algo}\"... | [
"0.65474164",
"0.63770497",
"0.6189385",
"0.6121231",
"0.606418",
"0.58639127",
"0.58639127",
"0.58639127",
"0.58581376",
"0.5815673",
"0.57683516",
"0.5762156",
"0.5716921",
"0.570412",
"0.56567276",
"0.5653285",
"0.5622097",
"0.5611546",
"0.5597051",
"0.5594701",
"0.5547350... | 0.7918127 | 0 |
selects only the enabled protocols from a hash of protocols | def get_enabled_protocols(protocols)
Hash[ protocols.select {|k,v| v["shared"] == "1" } ].keys
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enabled_protocols\n self.overview.listeners.\n map { |lnr| lnr.protocol }.\n uniq\n end",
"def get_guest_protocols(protocols)\n Hash[ protocols.select {|k,v| v[\"guest access\"] == \"1\" } ].keys\n end",
"def collection_protocols\n collection_registrations.map { |reg|... | [
"0.7115605",
"0.70572376",
"0.63456225",
"0.63263243",
"0.6124767",
"0.602316",
"0.5825075",
"0.5755079",
"0.57026243",
"0.57026243",
"0.56764024",
"0.5579385",
"0.5579385",
"0.5552281",
"0.53661853",
"0.5350474",
"0.5324358",
"0.53148425",
"0.5286811",
"0.52668864",
"0.52526... | 0.7734768 | 0 |
selects only the guest enabled protocols from a hash of protocols | def get_guest_protocols(protocols)
Hash[ protocols.select {|k,v| v["guest access"] == "1" } ].keys
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_enabled_protocols(protocols)\n Hash[ protocols.select {|k,v| v[\"shared\"] == \"1\" } ].keys\n end",
"def enabled_protocols\n self.overview.listeners.\n map { |lnr| lnr.protocol }.\n uniq\n end",
"def collection_protocols\n collection_registrations.map { |reg| reg... | [
"0.70886695",
"0.61584795",
"0.5865149",
"0.5864799",
"0.57073635",
"0.5660308",
"0.55463153",
"0.54588807",
"0.54588807",
"0.54146427",
"0.5307608",
"0.52915186",
"0.5253307",
"0.5253307",
"0.5224102",
"0.5061647",
"0.5043608",
"0.49923554",
"0.49854484",
"0.49769676",
"0.48... | 0.7956928 | 0 |
Time Complexity O(n) Space Complexity O(n) Hint, you may want a recursive helper method | def fibonacci(n)
return fibonacci_top_down_helper(n, {})
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def recursive_solution\n\n end",
"def recursive => nil",
"def solution(a)\r\n n=a.size\r\n i=1\r\n for k in a.sort do\r\n\tif k!=i \r\n\t then \r\n\t return 0\r\n\t break;\r\n\tend\r\n i+=1;\r\n end\t\r\n return 1 if a.inject(:+) ==n*(n+1)/2;\r\nend",
"def f... | [
"0.6395889",
"0.63333136",
"0.6307341",
"0.6163818",
"0.6062601",
"0.60455203",
"0.59980667",
"0.5973596",
"0.592667",
"0.5882138",
"0.5869365",
"0.58544946",
"0.584376",
"0.58200246",
"0.57896274",
"0.57827806",
"0.5782224",
"0.57502013",
"0.5740515",
"0.573646",
"0.5702108"... | 0.0 | -1 |
For any URL, to_s should return the url passed to Git::URL.parse(url) | def test_to_s
GIT_URLS.each do |url_data|
url = url_data[:url]
to_s = Git::URL.parse(url).to_s
assert_equal(url, to_s, "Parsed URI#to_s does not return the original URL '#{url}' correctly")
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_s\n\t\turl.to_s\n\tend",
"def to_s; @url; end",
"def url_safe\n URI.parse(url).to_s\n rescue URI::InvalidURIError\n URI.escape url\n end",
"def to_uri\n URI.parse(url)\n end",
"def normalise\n Wgit::Url.new(@uri.normalize.to_s)\n end",
"def format_url\n self.url.... | [
"0.71851397",
"0.7167817",
"0.71593004",
"0.7122998",
"0.70634663",
"0.706024",
"0.7048041",
"0.703683",
"0.6997779",
"0.69264185",
"0.6912251",
"0.68866235",
"0.6815332",
"0.67533827",
"0.6651028",
"0.66397643",
"0.6618725",
"0.6533942",
"0.6517999",
"0.6516787",
"0.6516284"... | 0.7763827 | 0 |
before_filter :configure_sign_up_params, only: [:create] before_filter :configure_account_update_params, only: [:update] | def index
@users = User.order(:last_name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [:email,:password, :password_confirmation, :first_name, :last_name, :circonscription])\n devise_parameter_sanitizer.permit(:account_update, keys: [:first_name, :last_name, :email, :password, :password_confirmation, :circonscript... | [
"0.75338215",
"0.7401277",
"0.73954856",
"0.7387431",
"0.73670524",
"0.73479956",
"0.73181796",
"0.7289947",
"0.72874886",
"0.7277752",
"0.7275826",
"0.7269062",
"0.7260794",
"0.7255928",
"0.7249481",
"0.7245084",
"0.7239298",
"0.72374713",
"0.72343206",
"0.7228031",
"0.72197... | 0.0 | -1 |
GET /article/1 GET /article/1.json | def show
@page_title = t(:front_show_title)
@page_descr = @article.text.truncate(120)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @article = Article.where(id: params[:id]).last\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end",
"def show\n @article = Article.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb... | [
"0.7735423",
"0.7707456",
"0.77061135",
"0.766396",
"0.766396",
"0.766396",
"0.766396",
"0.766396",
"0.766396",
"0.766396",
"0.766396",
"0.766396",
"0.766396",
"0.766396",
"0.766396",
"0.766396",
"0.766396",
"0.7615923",
"0.7483601",
"0.74827385",
"0.74154",
"0.73392206",
... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_article
@article = Article.find_by(slug: params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def article_params
params.require(:article).permit(:title, :text, :image, :slug, :language, :category_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.6980957",
"0.6783065",
"0.6747844",
"0.6741468",
"0.67356336",
"0.6592548",
"0.65036845",
"0.64978707",
"0.64825076",
"0.64795035",
"0.64560914",
"0.64397955",
"0.6379666",
"0.6376688",
"0.6366702",
"0.6319728",
"0.6300833",
"0.6300629",
"0.6294277",
"0.6293905",
"0.629117... | 0.0 | -1 |
modified method to support JNDI connections | def new_connection(config)
username = nil
if config[:jndi]
jndi = config[:jndi].to_s
ctx = javax.naming.InitialContext.new
ds = nil
# tomcat needs first lookup method, oc4j (and maybe other application servers) need second method
begin
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remote_connections; end",
"def new_connection; end",
"def connection(env); end",
"def jmx_connection\n if @@jmx_connections[name].nil?\n url=JMXServiceURL.new uri\n map = java.util.HashMap.new\n creds = [username, password].to_java :String if !username.nil? #TODO: Encrypt pass?\n j... | [
"0.60845864",
"0.5934544",
"0.58322257",
"0.5812262",
"0.5731558",
"0.5608198",
"0.56038904",
"0.55941856",
"0.55941856",
"0.55941856",
"0.55941856",
"0.55941856",
"0.55941856",
"0.55941856",
"0.55941856",
"0.5488577",
"0.5458156",
"0.54420996",
"0.54350865",
"0.54162943",
"0... | 0.60979885 | 0 |
Checks connection, returns true if active. Note that ping actively checks the connection, while active? simply returns the last known state. | def ping
exec_no_retry("select 1 from dual")
@active = true
rescue Java::JavaSql::SQLException => e
@active = false
raise OracleEnhanced::ConnectionException, e.message
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def active?\n !!@raw_connection&.ping\n end",
"def active? # :nodoc:\n # Pings the connection to check if it's still good. Note that an\n # #active? method is also available, but that simply returns the\n # last known state, which isn't good enough if the connection has\n ... | [
"0.8227972",
"0.81345993",
"0.8115238",
"0.74726444",
"0.7467183",
"0.7461331",
"0.7415524",
"0.73814964",
"0.73687774",
"0.73687667",
"0.73687667",
"0.73537725",
"0.7266994",
"0.72641337",
"0.72641337",
"0.7219593",
"0.7194122",
"0.71915483",
"0.7185409",
"0.7160638",
"0.709... | 0.64962965 | 79 |
Resets connection, by logging off and creating a new connection. | def reset!
logoff rescue nil
begin
new_connection(@config)
@active = true
rescue Java::JavaSql::SQLException => e
@active = false
raise OracleEnhanced::ConnectionException, e.message
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset_connection!\n @connection = nil\n end",
"def reset_connection!\n @@socket = nil\n end",
"def reset!\n reconnect!\n end",
"def reset!\n clear_cache!(new_connection: true)\n reset_transaction\n configure_connection\n end",
"def reset_connect... | [
"0.8428679",
"0.7965523",
"0.7743743",
"0.7704008",
"0.7601195",
"0.7569169",
"0.7415635",
"0.7383601",
"0.71140844",
"0.6954879",
"0.6954066",
"0.6927395",
"0.6835458",
"0.67732924",
"0.67453355",
"0.6673137",
"0.66612345",
"0.6648117",
"0.65763235",
"0.65617865",
"0.6560426... | 0.782954 | 2 |
mark connection as dead if connection lost | def with_retry(&block)
should_retry = auto_retry? && autocommit?
begin
yield if block_given?
rescue Java::JavaSql::SQLException => e
raise unless /^(Closed Connection|Io exception:|No more data to read from socket|IO Error:)/.match?(e.message)
@active = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mark_dead(error)\n @sock.close if @sock && !@sock.closed?\n @sock = nil\n @retry = Time.now #+ RETRY_DELAY\n\n reason = \"#{error.class.name}: #{error.message}\"\n @status = sprintf \"%s:%s DEAD (%s), will retry at %s\", @host, @port, reason, @retry\n puts @status\n end",
"def disconnec... | [
"0.7327389",
"0.6960948",
"0.68107986",
"0.67045724",
"0.653286",
"0.64875996",
"0.64678234",
"0.63938344",
"0.6303198",
"0.62738025",
"0.62554306",
"0.6174917",
"0.6163963",
"0.6142304",
"0.6138769",
"0.6130161",
"0.612614",
"0.6117231",
"0.611597",
"0.608892",
"0.6086551",
... | 0.0 | -1 |
To allow private method called from `JDBCConnection` | def describe(name)
super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def jdbc_exception; @jdbc_exception end",
"def recoverable?; jdbc_exception.is_a?(Java::JavaSql::SQLRecoverableException) end",
"def prepare_sql; raise \"Define #prepare_sql in your subclass\"; end",
"def jdbc_connection\n raw_connection.connection\n end",
"def sql_state; jdbc_exception ? jdbc_... | [
"0.70079255",
"0.65094686",
"0.6486696",
"0.6374012",
"0.63628453",
"0.6281967",
"0.6240808",
"0.6115554",
"0.6027119",
"0.6027119",
"0.6027119",
"0.6027119",
"0.6027119",
"0.6027119",
"0.6027119",
"0.6027119",
"0.5887972",
"0.5849613",
"0.5834835",
"0.58122796",
"0.5756352",... | 0.0 | -1 |
Return java.sql.SQLException error code | def error_code(exception)
case exception
when Java::JavaSql::SQLException
exception.getErrorCode
else
nil
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def jdbc_exception; @jdbc_exception end",
"def error_code\n if ( @error_code ||= nil ).nil?\n @error_code = jdbc_exception ? jdbc_exception.getErrorCode : nil\n else\n @error_code\n end\n end",
"def sqlite_error_code(exception)\n exception.resultCode.code if exception.r... | [
"0.7523658",
"0.7444998",
"0.7374931",
"0.6895185",
"0.6581123",
"0.65686387",
"0.62635595",
"0.6247082",
"0.6131289",
"0.61094314",
"0.59316564",
"0.59001714",
"0.58387244",
"0.5806997",
"0.57283694",
"0.5724683",
"0.56937206",
"0.5690252",
"0.56521165",
"0.5635299",
"0.5608... | 0.7786676 | 0 |
Simplified "parser" for getting the HTTP request this is passed in specially by ApiController: it should not be processed in any way. | def parse_upload
expected_params[:upload] ||= ParameterDeclaration.new(:upload, :upload, {})
params[:upload]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_request\n p request.body.string\n case request.content_type\n when JSON_TYPE then parse_json_request\n else parse_http_request\n end\n end",
"def parse_request!\n REGEX_REQUEST.match(@request[FREQUEST])\n @method = $1 ? $1.downcase.to_sym : :unknown\n @path = $2 || ... | [
"0.74539965",
"0.7337621",
"0.69321334",
"0.6724896",
"0.6643751",
"0.6607682",
"0.6556153",
"0.650861",
"0.6436006",
"0.633079",
"0.633079",
"0.63233495",
"0.6285695",
"0.62820715",
"0.62481296",
"0.62347317",
"0.62346107",
"0.62080854",
"0.62080854",
"0.61785525",
"0.613525... | 0.0 | -1 |
These are the parameters which will show up in the help message. | def declare_parameter(key, type, args = {})
expected_params[key] ||= ParameterDeclaration.new(key, type, args)
expected_params[key].set_parameter = true if @mark_the_rest_as_set_params
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def help\n help_str = [ usage ]\n if respond_to?(:descriptions)\n help_str += [\"\\nParams\"]\n ordered_params_and_descs = descriptions.sort_by{|p,d| p.to_s }\n param_help_strings = ordered_params_and_descs.map do |param, desc|\n if flag = param_definitions[param][:fl... | [
"0.7786779",
"0.7084128",
"0.70327044",
"0.69763386",
"0.6904246",
"0.6829968",
"0.68278235",
"0.67431533",
"0.67062986",
"0.6686976",
"0.6686976",
"0.66716635",
"0.66651845",
"0.6650433",
"0.6606695",
"0.65883225",
"0.65883225",
"0.6547225",
"0.654634",
"0.6536622",
"0.65337... | 0.0 | -1 |
This tells declare_parameter to mark all the rest of the parameters as "set" parameters. Useful for separating "get" and "set" parameters in the help message. | def mark_the_rest_as_set_params
@mark_the_rest_as_set_params = true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def declare_parameter(key, type, args = {})\n expected_params[key] ||= ParameterDeclaration.new(key, type, args)\n expected_params[key].set_parameter = true if @mark_the_rest_as_set_params\n end",
"def parameters=(should)\n Puppet.debug \"Set paramemter:\\n#{should.pretty_inspect}\"\n @property_hash... | [
"0.63245374",
"0.61436135",
"0.61340237",
"0.6043252",
"0.6043252",
"0.5827085",
"0.5810205",
"0.5763799",
"0.57487667",
"0.5682348",
"0.56647015",
"0.5647085",
"0.56199616",
"0.5593832",
"0.55738187",
"0.55718565",
"0.552832",
"0.55147153",
"0.54814076",
"0.5465377",
"0.5460... | 0.69371986 | 0 |
These parameters will be ignored in the help message. | def ignore_parameter(key)
ignore_params[key] = nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def need_help \n end",
"def get_help\n nil\n end",
"def strip_help_param!\n @help_given = ARGV.delete('--help')\n end",
"def help\r\n end",
"def help\r\n end",
"def help\n end",
"def help_info\n \"\"\n end",
"def help\n end",
"def help\n end",
"def help\n end",
... | [
"0.72390574",
"0.71875286",
"0.71407604",
"0.71113706",
"0.71113706",
"0.7054416",
"0.69916165",
"0.698691",
"0.698691",
"0.698691",
"0.698691",
"0.698691",
"0.698691",
"0.698691",
"0.69784105",
"0.69784105",
"0.69784105",
"0.6850498",
"0.6746174",
"0.67266023",
"0.66553295",... | 0.0 | -1 |
These validators belong elsewhere. They are shared by multiple model apis. | def make_sure_location_isnt_dubious!(name)
return if name.blank? || Location.where(name: name).any?
citations =
Location.check_for_empty_name(name) +
Location.check_for_dubious_commas(name) +
Location.check_for_bad_country_or_state(name) +
Location.check_for_bad_terms(name) +
Locat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validator; end",
"def validators\n @validators ||= Settler.validations_for(self.key)\n end",
"def validators_on(name)\n ::Kernel.raise Errors::NotImplemented\n end",
"def load_validators(model, params)\n\n end",
"def validation; end",
"def validation; end",
"def validate\n ... | [
"0.77197784",
"0.7054594",
"0.705272",
"0.6994465",
"0.6930714",
"0.6930714",
"0.6913724",
"0.6893169",
"0.6876659",
"0.6848247",
"0.6806949",
"0.6804106",
"0.6749855",
"0.6740973",
"0.66655934",
"0.66478825",
"0.66478825",
"0.66478825",
"0.66478825",
"0.6610021",
"0.656514",... | 0.0 | -1 |
Runs percolator on the given files | def run
puts "\n--------------------------------"
puts "Running Percolator...\n\n"
outputs = []
threads = []
tab_files = []
# The format of the following function was chosen to rersult in the fastest processing time.
proteins = load_target(':')
GC.start
# Currently usi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run\n puts \"\\n--------------------------------\"\n puts \"Running Percolator...\\n\\n\"\n \n database = extractDatabase(@type).chomp(\"fasta\") + \"yml\"\n revDatabase = extractDatabase(@type + \"-r\").chomp(\"fasta.reverse\") + \"yml\"\n @proteins = Hash.new\n @decoyProteins = Hash.new\... | [
"0.66447777",
"0.6369424",
"0.63514096",
"0.59817255",
"0.5940837",
"0.5863181",
"0.58582616",
"0.5705252",
"0.565932",
"0.5659123",
"0.56218797",
"0.55434257",
"0.5489917",
"0.5481454",
"0.5467607",
"0.54624045",
"0.54322773",
"0.5398696",
"0.5391146",
"0.5369736",
"0.536973... | 0.70603234 | 0 |
Loads the peptide centric database into a hash | def load_target(delim)
proteins = {}
buffer = File.readlines(extractDatabase(@type).chomp("fasta") + "yml") #Loading into buffer is key to increasing speed.
buffer.each do |line|
index = line.index(delim) #Creating two arrays instead of using split greatly increases speed.
proteins[line[0... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cache_ids(use_pbar = @use_pbar)\n num_pep, num_db_seq, num_pep_ev = get_num_elements(nil)\n \n @pep_h = Hash.new\n @mod_h = Hash.new\n pbar1 = ProgressBar.new(\"peptides\", num_pep/2) if use_pbar\n reader = Nokogiri::XML::Reader(File.open(@mzid_file))\n reader.each do |node|\... | [
"0.58251524",
"0.5667745",
"0.56417763",
"0.56347656",
"0.5620899",
"0.5591757",
"0.5488172",
"0.5462893",
"0.5432905",
"0.5382754",
"0.5361671",
"0.5309529",
"0.52780235",
"0.5274337",
"0.52720386",
"0.5199512",
"0.5190523",
"0.5181782",
"0.51766187",
"0.5162506",
"0.5111534... | 0.49231935 | 47 |
Plays the game, asking each player for their move, displaying the board between each move, and then checking for a win condition based on the player's most recent move | def play_game
puts "Welcome to Tic Tac Toe (#{@dim} x #{@dim})!"
catch :game_end do
while(moves)
print_board
@players.each do |player|
# p moves
square_number = player.move(moves)
set_move(player, square_number)
# Checks if player just won with their... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def play_game\r\n\r\n player = \"X\" #Make Player X the default player for each\r\n #new game\r\n \r\n noOfMoves = 0 #Reset the value of the variable used to\r\n #keep track of the total number of moves\r\n #made in a game\r\n\r\n #Clear out the gam... | [
"0.8011311",
"0.794826",
"0.7708666",
"0.75779617",
"0.7567113",
"0.756429",
"0.7531291",
"0.74947",
"0.748254",
"0.74716383",
"0.7452057",
"0.74177206",
"0.741293",
"0.7384428",
"0.73645407",
"0.7339162",
"0.73359466",
"0.73227704",
"0.7320288",
"0.7285322",
"0.7280504",
"... | 0.0 | -1 |
Tells if the player won by looking at some square id'd by number | def won?(player, square_number)
get_containing(square_number).any? do |array|
array.all? { |element| element.to_s.strip == player.piece }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def player_win?(n)\n self.wins.each do |win| \n return true if (player_moves(\"#{n}\") & win).count == self.win_length\n end\n return false\n end",
"def check_for_win(player)\n\tif ($grid_hash[\"tl\"] == player) && ($grid_hash[\"tc\"] == player) && ($grid_hash[\"tr\"] == player)\n\t\twin(player)\n... | [
"0.7300213",
"0.7065786",
"0.6992079",
"0.69630647",
"0.69396836",
"0.69003576",
"0.6894053",
"0.6882226",
"0.6868571",
"0.68497604",
"0.68400556",
"0.6826748",
"0.68193513",
"0.68026316",
"0.67997074",
"0.67890096",
"0.67802227",
"0.6769049",
"0.67674476",
"0.6743776",
"0.67... | 0.7711188 | 0 |
Calls the given player's move method, then modifies the playing board | def set_move(player, square_number)
board_iterate do |element, row, col|
@board[row][col] = player.piece if element == square_number
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def turn\n current_move = current_player.move(@board)\n current_token = current_player.token\n if self.board.valid_move?(current_move)\n self.board.update(current_move, current_player)\n self.board.display\n # binding.pry\n else\n turn\n ... | [
"0.78060925",
"0.7797616",
"0.77702993",
"0.77453333",
"0.77102005",
"0.7645353",
"0.75835025",
"0.75321275",
"0.75206774",
"0.7506799",
"0.7474116",
"0.7451052",
"0.74492854",
"0.7432115",
"0.7432115",
"0.73962504",
"0.7385436",
"0.7380401",
"0.73314553",
"0.73114955",
"0.72... | 0.7259387 | 22 |
Iterates over each element, capturing indices, takes block | def board_iterate # (&given_proc)
@board.each_with_index do |row, i|
row.each_with_index do |element, j|
# given_proc.call(element)
yield(element, i, j)
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def each(&block_)\n @indexes.each(&block_)\n end",
"def each_with_index(&block)\n to_a.each_with_index(&block)\n end",
"def each_with_index(&block)\n to_a.each_with_index(&block)\n end",
"def each &block\n each_with_index {|x, i| block.call(x)}\n end",
"def each_... | [
"0.8026212",
"0.79811174",
"0.79811174",
"0.78366655",
"0.77494",
"0.7716122",
"0.76368904",
"0.75857097",
"0.75753754",
"0.7569523",
"0.7555414",
"0.7545555",
"0.75086844",
"0.750351",
"0.7502359",
"0.7493657",
"0.7483893",
"0.74603343",
"0.7447144",
"0.742741",
"0.740981",
... | 0.0 | -1 |
Returns array with arrays representing elements in the row, column, and diagonals of the given square | def get_containing(square)
to_return = []
square_row, square_col = @squares_to_coords[square]
cont_row, cont_col, cont_diag1, cont_diag2 = [], [], [], []
board_iterate do |ele, i, j|
cont_row.push(ele) if i == square_row
cont_col.push(ele) if j == square_col
cont_diag1.push(ele) if i =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def square_arrays\n squares = []\n org_row = 0\n org_col = 0\n (0..8).each do |i|\n squares[i] = []\n (org_row..org_row+2).each do |k|\n (org_col..org_col+2).each do |j|\n squares[i].push(@board[k][j])\n end \n end\n if org_row == 6\n ... | [
"0.71947485",
"0.6933333",
"0.66873336",
"0.66625285",
"0.6650364",
"0.65860194",
"0.6562105",
"0.64700884",
"0.6370563",
"0.62638223",
"0.6250562",
"0.62406284",
"0.6226703",
"0.6211735",
"0.620179",
"0.6175639",
"0.6107621",
"0.6078014",
"0.6073773",
"0.60677487",
"0.606636... | 0.6467018 | 8 |
Prints the current state of the playing board; looks like: 1 | 2 | 3 ++ 4 | 5 | 6 ++ 7 | 8 | 9 | def print_board
puts
@board.each_with_index do |row, index|
print " "
row.each_with_index do |element, index|
print " " + element.to_s.center(3, " ") + " "
if(index < row.length - 1)
print "|"
else
print "\n"
end
end
if(index ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def display_board(state)\n i = -1\n puts \" #{state[i+=1]} | #{state[i+=1]} | #{state[i+=1]} \"\n puts(\"-----------\")\n puts \" #{state[i+=1]} | #{state[i+=1]} | #{state[i+=1]} \"\n puts(\"-----------\")\n puts \" #{state[i+=1]} | #{state[i+=1]} | #{state[i+=1]} \"\nend",
"def display_board(gameState)\n ... | [
"0.8053864",
"0.7644798",
"0.75804234",
"0.7481642",
"0.7481063",
"0.7354479",
"0.73531735",
"0.7304795",
"0.723469",
"0.7198878",
"0.71386945",
"0.7137561",
"0.7129847",
"0.7119769",
"0.70956546",
"0.7086694",
"0.70863515",
"0.70780706",
"0.7077157",
"0.7070682",
"0.70677036... | 0.6968805 | 35 |
Returns all allowed moves from here on in | def moves
to_return = []
board_iterate do |i|
if(i.is_a? Numeric)
to_return.push(i)
end
end
to_return.empty? ? nil : to_return
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def possible_moves\n return []\n end",
"def get_valid_moves\n possible_moves.select do |dir, moves| \n moves.select! { |mov| check_bounds(mov[0], mov[1]) }\n !moves.empty? && move_directions.include?(dir)\n end\n end",
"def possible_moves\n # p possible_non_attack_moves\n # p possibl... | [
"0.78904444",
"0.7865762",
"0.77395684",
"0.7682707",
"0.76553726",
"0.7519181",
"0.75127727",
"0.74469507",
"0.7419429",
"0.7416154",
"0.73449105",
"0.73157465",
"0.7310206",
"0.7300921",
"0.72927934",
"0.72868514",
"0.72857666",
"0.72777015",
"0.7249378",
"0.7226223",
"0.72... | 0.0 | -1 |
GET /admin/subscription_plans GET /admin/subscription_plans.json | def index
@admin_subscription_plans = Admin::SubscriptionPlan.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plans\n subscriptions.map(&:plan)\n end",
"def plans(params = {})\n scope 'default'\n get('plans/', params)\n end",
"def show\n @plans = Stripe::Plan.all\n end",
"def plans\n\t @plans = Plan.all\n\t current_user.clean_subscriptions if current_user\n\tend",
"def read_service_plans... | [
"0.7556857",
"0.73784196",
"0.72852683",
"0.7283002",
"0.7129254",
"0.7107083",
"0.6986619",
"0.6971334",
"0.69459486",
"0.69123656",
"0.6857597",
"0.6818481",
"0.6818481",
"0.6806939",
"0.6789936",
"0.6770537",
"0.67436",
"0.67299145",
"0.6722855",
"0.67223436",
"0.66941464"... | 0.81290805 | 0 |
GET /admin/subscription_plans/1 GET /admin/subscription_plans/1.json | def show; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @admin_subscription_plans = Admin::SubscriptionPlan.all\n end",
"def show\n @plans = Stripe::Plan.all\n end",
"def plans(params = {})\n scope 'default'\n get('plans/', params)\n end",
"def plan_id\r\n subscription_plan_id\r\n end",
"def index\n @plans = Plan.all\... | [
"0.78961295",
"0.7287586",
"0.726182",
"0.7222897",
"0.7217147",
"0.7118028",
"0.69844896",
"0.69740474",
"0.69566816",
"0.6944104",
"0.69434106",
"0.69204396",
"0.6901756",
"0.6901756",
"0.688027",
"0.684139",
"0.683348",
"0.68242705",
"0.6805568",
"0.6704926",
"0.6673079",
... | 0.0 | -1 |
POST /admin/subscription_plans POST /admin/subscription_plans.json | def create
@admin_subscription_plan = Admin::SubscriptionPlan.new(admin_subscription_plan_params)
respond_to do |format|
if @admin_subscription_plan.save
format.html { redirect_to @admin_subscription_plan, notice: 'Subscription plan was successfully created.' }
format.json { ren... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n plan = Billingly::Plan.find(params[:plan_id])\n unless current_customer.can_subscribe_to?(plan)\n return redirect_to subscriptions_path, notice: 'Cannot subscribe to that plan'\n end\n current_customer.subscribe_to_plan(plan)\n on_subscription_success\n end",
"def create\n pl... | [
"0.73623645",
"0.73623645",
"0.7118631",
"0.6956508",
"0.6923232",
"0.68452346",
"0.67774343",
"0.6687939",
"0.6639584",
"0.6585635",
"0.6583055",
"0.6567495",
"0.656192",
"0.655145",
"0.65513724",
"0.6550267",
"0.65313005",
"0.6528174",
"0.65235186",
"0.65147233",
"0.6510376... | 0.77951056 | 0 |
PATCH/PUT /admin/subscription_plans/1 PATCH/PUT /admin/subscription_plans/1.json | def update
respond_to do |format|
if @admin_subscription_plan.update(admin_subscription_plan_params)
format.html { redirect_to @admin_subscription_plan, notice: 'Subscription plan was successfully updated.' }
format.json { render :show, status: :ok, location: @admin_subscription_plan }... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @plan = Plan.find(params[:id])\n\n if @plan.update(plan_params)\n head :no_content\n else\n render json: @plan.errors, status: :unprocessable_entity\n end\n end",
"def update\n @plan = Plan.find(params[:id])\n\n if @plan.update(params[:plan])\n head :no_content\n ... | [
"0.6735248",
"0.6706952",
"0.65782475",
"0.65576214",
"0.65086323",
"0.65086323",
"0.64827013",
"0.64803475",
"0.64667964",
"0.64595395",
"0.644015",
"0.6433143",
"0.6426631",
"0.6426631",
"0.6426631",
"0.6426631",
"0.6426631",
"0.64109695",
"0.6409623",
"0.64019054",
"0.6367... | 0.742234 | 0 |
DELETE /admin/subscription_plans/1 DELETE /admin/subscription_plans/1.json | def destroy
if @admin_subscription_plan.destroy
flash[:notice] = 'Subscription plan was successfully destroyed.'
else
flash[:error] = "Sorry your subscription plan couldn't be deleted"
end
respond_to do |format|
format.html { redirect_to admin_subscription_plans_url }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @billing_plan.destroy\n respond_to do |format|\n format.html { redirect_to billing_plans_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sslplan = Sslplan.find(params[:id])\n @sslplan.destroy\n\n respond_to do |format|\n format.html { redirec... | [
"0.7460671",
"0.74004346",
"0.7385231",
"0.7385231",
"0.73849547",
"0.7365049",
"0.73527473",
"0.73235714",
"0.73212844",
"0.73212844",
"0.73212844",
"0.7234262",
"0.71981466",
"0.7193032",
"0.7132654",
"0.7127216",
"0.7127216",
"0.7127216",
"0.7127216",
"0.7127216",
"0.71272... | 0.7524117 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_admin_subscription_plan
@admin_subscription_plan = Admin::SubscriptionPlan.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def admin_subscription_plan_params
params.require(:admin_subscription_plan).permit(:name, :price_cent, :billing_frequency_months, :currency, :stripe_uuid, :trial_period_days, :active, :subscription_product_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
GET /events GET /events.xml | def index
@events = current_user.family.events
@event = Event.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_events\n Resources::Event.parse(request(:get, \"Events\"))\n end",
"def get_events()\n @client.make_request(:get, @client.concat_user_path(\"#{CALL_PATH}/#{id}/events\"))[0]\n end",
"def get_events\n response = request(:get, \"/devmgr/v2/events\")\n #status(response, 200, ... | [
"0.8196554",
"0.7628968",
"0.7606237",
"0.738313",
"0.73515666",
"0.7307924",
"0.72622883",
"0.7256372",
"0.7234977",
"0.7234977",
"0.7234977",
"0.7234977",
"0.7200572",
"0.71624994",
"0.71107185",
"0.7077015",
"0.7075446",
"0.7048081",
"0.7040405",
"0.70267826",
"0.7016784",... | 0.0 | -1 |
GET /events/1 GET /events/1.xml | def show
@event = Event.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calendar_event(event_id)\n record \"/calendar_events/#{event_id}.xml\", :method => :get\n end",
"def get_events\n Resources::Event.parse(request(:get, \"Events\"))\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @events ... | [
"0.74074787",
"0.73822564",
"0.72317415",
"0.71266216",
"0.7051357",
"0.70203346",
"0.7014016",
"0.7014016",
"0.7014016",
"0.7014016",
"0.6992188",
"0.69583654",
"0.6933569",
"0.6924838",
"0.6916713",
"0.689496",
"0.68806356",
"0.6879873",
"0.6858128",
"0.6853787",
"0.6853787... | 0.0 | -1 |
GET /events/new GET /events/new.xml | def new
@event = Event.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n setup_variables\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"def new\n @event = Event.new_default\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render ... | [
"0.796233",
"0.79208916",
"0.78676033",
"0.78583014",
"0.78556705",
"0.78556705",
"0.78556705",
"0.78556705",
"0.78556705",
"0.78556705",
"0.78556705",
"0.78556705",
"0.78556705",
"0.78556705",
"0.78556705",
"0.78556705",
"0.78556705",
"0.7855334",
"0.78544503",
"0.7854193",
... | 0.0 | -1 |
POST /events POST /events.xml | def create
@event = Event.new(params[:event])
@event.set_time
@event.className = current_user.class_name
@entry = Entry.new
@entry.description = @event.title
@entry.user_id = current_user.id
@entry.family_id = current_user.family.id
@entry.save
respond_to do |format|
if @... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n Rails.logger.debug(\"Received event #{params[:event]}\")\n head :ok\n end",
"def create_event event, data={}\n data[:event] = event\n post '/event', data\n end",
"def save_event(event)\n method = (event.id == nil || event.id == '') ? :post : :put\n query_string ... | [
"0.6938859",
"0.6832928",
"0.6629996",
"0.6572941",
"0.65628463",
"0.64595443",
"0.644994",
"0.6432171",
"0.64178646",
"0.64178646",
"0.64178646",
"0.64178646",
"0.6415361",
"0.6409476",
"0.6409476",
"0.6409476",
"0.6409476",
"0.6409476",
"0.637794",
"0.6374196",
"0.633384",
... | 0.0 | -1 |
PUT /events/1 PUT /events/1.xml | def update
@event = Event.find(params[:id])
if @event.update_attributes(params[:event])
@event.set_time
@event.save
flash[:notice] = "Event Successfully Updated"
redirect_to events_path
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_event(event)\n method = (event.id == nil || event.id == '') ? :post : :put\n query_string = (method == :put) ? \"/#{event.id}\" : ''\n @connection.send(Addressable::URI.parse(events_url + query_string), method, event.to_xml)\n end",
"def put_events(args)\n\tapi_url = \"#{@base_url}/#{a... | [
"0.68006223",
"0.66227084",
"0.6586422",
"0.6582029",
"0.6582029",
"0.6582029",
"0.6582029",
"0.6582029",
"0.6582029",
"0.6582029",
"0.6538628",
"0.6528396",
"0.6528396",
"0.6528396",
"0.6528396",
"0.6504651",
"0.64950335",
"0.64886147",
"0.6481964",
"0.6477629",
"0.6464071",... | 0.0 | -1 |
DELETE /events/1 DELETE /events/1.xml | def destroy
@event = Event.find(params[:id])
@event.destroy
respond_to do |format|
format.html { redirect_to(events_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @event.destroy\n respond_to do | format |\n format.html { redirect_to events_path }\n ... | [
"0.71272403",
"0.71019286",
"0.7034015",
"0.7034015",
"0.7018114",
"0.6961932",
"0.6954058",
"0.6954058",
"0.6908071",
"0.688388",
"0.6860901",
"0.6859833",
"0.68565935",
"0.68509364",
"0.67942625",
"0.6784313",
"0.67591745",
"0.6756506",
"0.67406136",
"0.67341024",
"0.672263... | 0.7095852 | 24 |
Hook called when module gets included | def included(host)
REGISTRY[type] = host
host.class_eval do
include CONCORD, NamedChildren
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def included_modules() end",
"def included(mod); end",
"def included( hooked_instance )\n \n super if defined?( super )\n \n end",
"def included; end",
"def included(a_module)\n end",
"def included_modules; end",
"def included_modules\n end",
"def include; end",
"def include; end",
"d... | [
"0.7757375",
"0.7755393",
"0.74354196",
"0.7397514",
"0.733484",
"0.73158973",
"0.7187834",
"0.7072662",
"0.7072662",
"0.70126885",
"0.697677",
"0.697317",
"0.697288",
"0.68651915",
"0.6845848",
"0.67999744",
"0.6784904",
"0.6766852",
"0.6750816",
"0.67054635",
"0.66560996",
... | 0.0 | -1 |
Test if AST node is a valid assignment target | def assignment?
index_assignment? || attribute_assignment?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assignment?(node); end",
"def assignment?(node); end",
"def assignment?(node); end",
"def check_disjunctive_assignment(node); end",
"def assignment?\n Types::ASSIGNABLE_VARIABLES.include?(node.type)\n end",
"def first_assignment?(node); end",
"def assigned?(node)\n return f... | [
"0.76556367",
"0.76556367",
"0.76556367",
"0.7114996",
"0.691636",
"0.69022936",
"0.6615366",
"0.6524266",
"0.65225905",
"0.6485268",
"0.62646645",
"0.61052114",
"0.6092931",
"0.6039714",
"0.59051967",
"0.5894002",
"0.5846027",
"0.5845202",
"0.58396494",
"0.58212566",
"0.5714... | 0.5738962 | 20 |
Test if AST node is an attribute assignment? | def attribute_assignment?
arguments.one? && attribute_assignment_selector?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attribute?\n node_type == ATTRIBUTE_NODE\n end",
"def attribute_assignment?\n !BINARY_OPERATORS.include?(selector) && !UNARY_OPERATORS.include?(selector) && assignment? && !mlhs?\n end",
"def attribute_decl?\n node_type == ATTRIBUTE_DECL\n end",
"def is_attribute?(... | [
"0.72730047",
"0.71988803",
"0.7060549",
"0.6811513",
"0.6714517",
"0.6655986",
"0.66002625",
"0.6557938",
"0.6556334",
"0.6548956",
"0.6489559",
"0.64197195",
"0.64197195",
"0.64197195",
"0.6286326",
"0.6284561",
"0.6268679",
"0.62631315",
"0.6252617",
"0.62518686",
"0.61654... | 0.72405666 | 1 |
Test if AST node is an index assign | def index_assignment?
arguments.length.equal?(2) && index_assignment_selector?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index_assignment_selector?\n selector.equal?(INDEX_ASSIGNMENT_SELECTOR)\n end",
"def assignment?(node); end",
"def assignment?(node); end",
"def assignment?(node); end",
"def index(node = T.unsafe(nil)); end",
"def index(node = T.unsafe(nil)); end",
"def assignment?\n index... | [
"0.6719466",
"0.61369264",
"0.61369264",
"0.61369264",
"0.6051715",
"0.6051715",
"0.6048158",
"0.60404336",
"0.5839238",
"0.5839238",
"0.5812413",
"0.5796425",
"0.5758155",
"0.5758155",
"0.57014227",
"0.5627414",
"0.5613826",
"0.55907816",
"0.5541894",
"0.55355614",
"0.544282... | 0.66905755 | 1 |
Test for binary operator implemented as method | def binary_method_operator?
arguments.one? && Types::BINARY_METHOD_OPERATORS.include?(selector)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def binary_operator?\n arguments.one? && BINARY_METHOD_OPERATORS.include?(selector)\n end",
"def binary_operator?\n arguments.one? && BINARY_METHOD_OPERATORS.include?(selector)\n end",
"def binary_operator?\n Mutant::BINARY_METHOD_OPERATORS.include?(node.name)\n ... | [
"0.78430825",
"0.78430825",
"0.7795619",
"0.76175183",
"0.70902103",
"0.67115647",
"0.6457239",
"0.6414175",
"0.63965183",
"0.63897574",
"0.6335838",
"0.63166857",
"0.6260836",
"0.625896",
"0.62424177",
"0.6226768",
"0.6187854",
"0.6184808",
"0.61757827",
"0.61523706",
"0.612... | 0.7871442 | 0 |
Test for index assignment operator | def index_assignment_selector?
selector.equal?(INDEX_ASSIGNMENT_SELECTOR)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def []=(index, value)\n end",
"def []=(index, value)\n end",
"def index_assignment?\n arguments.length.equal?(2) && index_assignment_selector?\n end",
"def [](index)\n set?(index)\n end",
"def set(index, val)\n \n end",
"def operator=(_arg0); end",
"def []=( idx, v... | [
"0.68631387",
"0.68459046",
"0.6634436",
"0.6607517",
"0.6580266",
"0.64454955",
"0.6375101",
"0.6311281",
"0.6266319",
"0.62636274",
"0.62367123",
"0.6227442",
"0.6097977",
"0.6097472",
"0.60266095",
"0.602062",
"0.5995445",
"0.59528816",
"0.5949177",
"0.59189117",
"0.579485... | 0.62813866 | 8 |
Test for attribute assignment selector | def attribute_assignment_selector?
!Types::METHOD_OPERATORS.include?(selector) && selector.to_s.end_with?(ATTRIBUTE_ASSIGNMENT_SELECTOR_SUFFIX)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attribute_assignment?\n !BINARY_OPERATORS.include?(selector) && !UNARY_OPERATORS.include?(selector) && assignment? && !mlhs?\n end",
"def attribute_assignment?\n arguments.one? && attribute_assignment_selector?\n end",
"def dom_attribute(name); end",
"def attribute?(name)\... | [
"0.7005124",
"0.6785103",
"0.6635678",
"0.62135965",
"0.61822903",
"0.6162882",
"0.60629034",
"0.605894",
"0.60492516",
"0.5991486",
"0.5982288",
"0.5979055",
"0.5946678",
"0.59327257",
"0.5882528",
"0.5866866",
"0.586518",
"0.586518",
"0.5862052",
"0.5841971",
"0.5837702",
... | 0.7280829 | 0 |
Test if AST node is a valid assign target | def assignment?
Types::ASSIGNABLE_VARIABLES.include?(node.type)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assignment?(node); end",
"def assignment?(node); end",
"def assignment?(node); end",
"def first_assignment?(node); end",
"def check_disjunctive_assignment(node); end",
"def assigned?(node)\n return false unless (parent = node.parent)&.assignment?\n\n lhs, _method, _rhs = *parent\n ... | [
"0.7365027",
"0.7365027",
"0.7365027",
"0.6641054",
"0.64549506",
"0.6346509",
"0.62727123",
"0.62712353",
"0.6219401",
"0.6074103",
"0.5990217",
"0.5988527",
"0.5895993",
"0.58580035",
"0.5825822",
"0.5780669",
"0.57761765",
"0.57668054",
"0.57590634",
"0.5744894",
"0.574209... | 0.64136595 | 5 |
misc helpers turn items like '100KB' or '1.5 GB' to bytes | def bytes_from_nice_bytes( nice_bytes )
parts = nice_bytes.downcase.split( /(kb|mb|gb)/ )
n = Float( parts.first )
if parts[ 1 ]
case parts[ 1 ]
when 'kb'
n * Numeric::KILO.to_i
when 'mb'
n * Numeric::MEGA.to_i
when 'gb'
n * Numeric::GIGA.to_i
end
else
n
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def blocks_to_bytes(block_size, qty)\n size = ( block_size / 1024 ) * qty\n if size < 1000\n output = \"#{size} KB\"\n elsif size < 1000000\n output = \"#{size / 1000} MB\"\n elsif size < 1000000000\n output = \"#{size / 1000000} GB\"\n else\n output = \"#{size / 1000000000} TB\"\n end\n\n retur... | [
"0.7102579",
"0.7064581",
"0.70453787",
"0.69822747",
"0.6947024",
"0.6947024",
"0.68818974",
"0.68494296",
"0.67832386",
"0.67507726",
"0.67373484",
"0.6722589",
"0.6719146",
"0.66477126",
"0.66389215",
"0.6594229",
"0.65782976",
"0.65712553",
"0.6571093",
"0.63617873",
"0.6... | 0.6918318 | 6 |
Thanks to Rein Henrichs | def truncate( text, num_words = 6, truncate_string = " [...]" )
if text.nil? then return end
arr = text.split( ' ' )
arr.length > num_words ? arr[ 0...num_words ].join( ' ' ) + truncate_string : text
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def probers; end",
"def schubert; end",
"def formation; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def stderrs; end",
"def terpene; end",
"def verdi; end",
"def berlioz; end",
"def offences_by; end",
"def anchored; end",
"def i... | [
"0.72384834",
"0.6685331",
"0.63945377",
"0.63683635",
"0.62311465",
"0.62311465",
"0.62311465",
"0.62311465",
"0.6144715",
"0.6141357",
"0.61270994",
"0.6001212",
"0.59868854",
"0.5932114",
"0.59227264",
"0.59163404",
"0.58872813",
"0.5829282",
"0.5829282",
"0.58277375",
"0.... | 0.0 | -1 |
Initialize a new Timecode object with a certain amount of frames and a framerate will be interpreted as the total number of frames | def initialize(total = 0, fps = DEFAULT_FPS)
raise WrongFramerate, "FPS cannot be zero" if fps.zero?
# If total is a string, use parse
raise RangeError, "Timecode cannot be negative" if total.to_i < 0
# Always cast framerate to float, and num of rames to integer
@total, @fps = total.to_i, fps.to_f
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(frame_rate, list=[])\n @fps = frame_rate\n @list = list\n end",
"def initialize(tps, frameskip = 2)\n @ref = Time.now.to_f\n @step = 1.0/tps\n \n @ticks = 0\n @ref_ticks = 0\n \n @frameskip = frameskip\n @skipped = 0\n end",
"def frames_per_second=(a); motio... | [
"0.67203325",
"0.6501216",
"0.64472127",
"0.63781095",
"0.63781095",
"0.63781095",
"0.6358262",
"0.6358262",
"0.60585946",
"0.60585946",
"0.6027382",
"0.6027382",
"0.60137075",
"0.59987944",
"0.5986727",
"0.5951377",
"0.59408325",
"0.59010214",
"0.58426166",
"0.583908",
"0.58... | 0.6920404 | 1 |
Parse timecode and return zero if none matched | def soft_parse(input, with_fps = DEFAULT_FPS)
parse(input) rescue new(0, with_fps)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_time(timestr)\n return 0 if timestr.nil?\n \n h = 0\n m = 0\n\n if(not timestr.index(/(h|m)/).nil?)\n h = timestr.scan(/(\\d*)\\s*h/i).flatten.last\n m = timestr.scan(/(\\d*)\\s*m/i).flatten.last\n elsif(not timestr.index(\":\").nil?)\n h = timestr.scan(... | [
"0.658078",
"0.64732856",
"0.64567095",
"0.6451267",
"0.6356755",
"0.63169503",
"0.6000072",
"0.59953254",
"0.598706",
"0.59751695",
"0.59386545",
"0.5920989",
"0.58873427",
"0.58873427",
"0.58873427",
"0.5874955",
"0.5874955",
"0.58598024",
"0.5853512",
"0.58474",
"0.5841700... | 0.0 | -1 |
Parse timecode entered by the user. Will raise if the string cannot be parsed. The following formats are supported: 10h 20m 10s 1f (or any combination thereof) will be disassembled to hours, frames, seconds and so on automatically 123 will be parsed as 00:00:01:23 00:00:00:00 will be parsed as zero TC | def parse(input, with_fps = DEFAULT_FPS)
# Drop frame goodbye
if (input =~ DF_TC_RE)
raise Error, "We do not support drop-frame TC"
# 00:00:00:00
elsif (input =~ COMPLETE_TC_RE)
atoms_and_fps = input.scan(COMPLETE_TC_RE).to_a.flatten.map{|e| e.to_i} + [with_fps]
return at... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_time\n s0 = @scanner.pos\n if match_str('(') == :failed\n @scanner.pos = s0\n s0 = :failed\n else\n match_spaces\n s3 = parse_ms\n if s3 == :failed\n @scanner.pos = s0\n s0 = :failed\n else\n match... | [
"0.7721456",
"0.7396273",
"0.73224396",
"0.7117099",
"0.7105622",
"0.7030812",
"0.6981764",
"0.69533736",
"0.6881224",
"0.6846646",
"0.68159825",
"0.6807801",
"0.67340773",
"0.67340773",
"0.67340773",
"0.66595876",
"0.6655139",
"0.66512465",
"0.6626765",
"0.6612918",
"0.65328... | 0.62017584 | 54 |
Initialize a Timecode object at this specfic timecode | def at(hrs, mins, secs, frames, with_fps = DEFAULT_FPS)
validate_atoms!(hrs, mins, secs, frames, with_fps)
total = (hrs*(60*60*with_fps) + mins*(60*with_fps) + secs*with_fps + frames).round
new(total, with_fps)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(code = \"\", times = 0)\n @code = code\n @times = times\n end",
"def initialize(with_time=true)\n @with_time\n @day = Day.new # the time schedule for the mechanic\n end",
"def initialize(hour, minute)\n set_time hour, minute\n end",
"def initialize(time, in_ms = fa... | [
"0.689205",
"0.6798465",
"0.65551996",
"0.62496316",
"0.62175286",
"0.61958826",
"0.6176217",
"0.6126992",
"0.6101053",
"0.60745806",
"0.6061547",
"0.5994027",
"0.59422326",
"0.5933839",
"0.5932729",
"0.592518",
"0.59219843",
"0.5918619",
"0.5916334",
"0.58952403",
"0.5873031... | 0.0 | -1 |
Validate the passed atoms for the concrete framerate | def validate_atoms!(hrs, mins, secs, frames, with_fps)
case true
when hrs > 999
raise RangeError, "There can be no more than 999 hours, got #{hrs}"
when mins > 59
raise RangeError, "There can be no more than 59 minutes, got #{mins}"
when secs > 59
raise RangeE... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate!\n frames = @total\n secs = (@total.to_f/@fps).floor\n frames-=(secs*@fps)\n mins = (secs/60).floor\n secs -= (mins*60)\n hrs = (mins/60).floor\n mins-= (hrs*60)\n\n self.class.validate_atoms!(hrs, mins, secs, frames, @fps)\n\n [hrs, mins, secs, frames]\n end",
"def valid... | [
"0.7341493",
"0.7341493",
"0.72567177",
"0.5979116",
"0.5659851",
"0.5609363",
"0.53699577",
"0.5344292",
"0.52488124",
"0.5233177",
"0.5223239",
"0.5222069",
"0.51849324",
"0.5183814",
"0.51679707",
"0.5138379",
"0.5088411",
"0.50814706",
"0.506642",
"0.50466734",
"0.5046673... | 0.7218929 | 3 |
Parse a timecode with fractional seconds instead of frames. This is how ffmpeg reports a timecode | def parse_with_fractional_seconds(tc_with_fractions_of_second, fps = DEFAULT_FPS)
fraction_expr = /\.(\d+)$/
fraction_part = ('.' + tc_with_fractions_of_second.scan(fraction_expr)[0][0]).to_f
seconds_per_frame = 1.0 / fps.to_f
frame_idx = (fraction_part / seconds_per_frame).floor
tc_with... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse(input, with_fps = DEFAULT_FPS)\n # Drop frame goodbye\n raise TimecodeLibError, \"We do not support drop frame\" if (input =~ /\\;/)\n \n hrs, mins, secs, frames = 0,0,0,0\n atoms = []\n \n # 10h 20m 10s 1f\n if input =~ /\\s/\n # TODO - this is ActiveSuppor... | [
"0.6643332",
"0.6525361",
"0.6422346",
"0.62784266",
"0.6107815",
"0.6107815",
"0.59250635",
"0.59075236",
"0.5852399",
"0.57704455",
"0.5761347",
"0.56808376",
"0.56808376",
"0.5647506",
"0.5647506",
"0.56420726",
"0.5626915",
"0.5620023",
"0.55573535",
"0.55253434",
"0.5487... | 0.70258904 | 1 |
Parse a timecode with ticks of a second instead of frames. A 'tick' is defined as 4 msec and has a range of 0 to 249. This format can show up in subtitle files for digital cinema | def parse_with_ticks(tc_with_ticks, fps = DEFAULT_FPS)
ticks_expr = /(\d{3})$/
ticks_part = (tc_with_ticks.scan(ticks_expr)[0][0]).to_i
seconds_per_frame = 1.0 / fps
frame_idx = ((ticks_part * 0.004) / seconds_per_frame ).floor
tc_with_frameno = tc_with_ticks.gsub(ticks_expr, "%02d" % f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_dcsubtitle_tc_string( tc_string, fps )\n case tc_string\n when /\\d\\d:\\d\\d:\\d\\d:\\d\\d\\d/ # hh:mm:ss:ttt\n Timecode.parse_with_ticks( tc_string, fps )\n when /\\d\\d:\\d\\d:\\d\\d\\.\\d\\d\\d/ # hh:mm:ss.sss\n Timecode.parse( tc_string, fps )\n else\n nil\n end\nend",
"def parse(inp... | [
"0.6894583",
"0.65883535",
"0.6514446",
"0.6268229",
"0.61539716",
"0.61539716",
"0.60186756",
"0.60186756",
"0.58988285",
"0.57288355",
"0.57092965",
"0.5488385",
"0.5437233",
"0.54191893",
"0.54104275",
"0.53620225",
"0.5357411",
"0.5332596",
"0.53015614",
"0.52689517",
"0.... | 0.72445685 | 1 |
create a timecode from the number of seconds. This is how current time is supplied by QuickTime and other systems which have nonframebased timescales | def from_seconds(seconds_float, the_fps = DEFAULT_FPS)
total_frames = (seconds_float.to_f * the_fps.to_f).to_i
new(total_frames, the_fps)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sec() time[2] end",
"def seconds(num)\n t = current_time + num\n {\n type: :datetime,\n value: t.iso8601\n }\n end",
"def make_time(stime)\n stime.gsub!(/\\s+and\\s+/, \"+\")\n stime.gsub!(/\\s+/, \".\")\n stime = \"(\" + stime\n stime += \").seconds.from_now\"\n... | [
"0.64460003",
"0.644364",
"0.63836414",
"0.6340411",
"0.63299525",
"0.6325262",
"0.6288347",
"0.6278256",
"0.62761843",
"0.6242727",
"0.6221995",
"0.621192",
"0.62052315",
"0.620025",
"0.61725014",
"0.61719275",
"0.6165788",
"0.61599547",
"0.61568666",
"0.6151616",
"0.6102698... | 0.0 | -1 |
Some systems (like SGIs) and DPX format store timecode as unsigned integer, bitpacked. This method unpacks such an integer into a timecode. | def from_uint(uint, fps = DEFAULT_FPS)
tc_elements = (0..7).to_a.reverse.map do | multiplier |
((uint >> (multiplier * 4)) & 0x0F)
end.join.scan(/(\d{2})/).flatten.map{|e| e.to_i}
tc_elements << fps
at(*tc_elements)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_data\n data = @data.unpack(\"C*\")\n year = data[0..1]\n year = Shared::interpret_bytes_2(year)\n #Year, Month, Day, Hour, Min, Sec, UTC\n return Time.new(year, data[2],\n data[3], data[4],\n data[5], data[6], \"UTC\")\n end",
"def... | [
"0.59963727",
"0.59649616",
"0.59649616",
"0.57176167",
"0.5595648",
"0.55485404",
"0.55239105",
"0.54654926",
"0.5464081",
"0.5417559",
"0.5404233",
"0.53951776",
"0.5314535",
"0.52946514",
"0.5290289",
"0.52600384",
"0.52599716",
"0.5208019",
"0.5199319",
"0.5185572",
"0.51... | 0.0 | -1 |
is the timecode at 00:00:00:00 | def zero?
@total.zero?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time_define?\n !time.blank?\n end",
"def time?\n type == \"TIME\"\n end",
"def hour?\n at_match[2].present?\n end",
"def end_time_defined?(time)\n if time.empty?\n '24:00'\n else\n time\n end\n end",
"def correct_time?\n now = Time.zo... | [
"0.6596903",
"0.6573723",
"0.6566308",
"0.65368724",
"0.6497819",
"0.6372991",
"0.63710016",
"0.6317338",
"0.6317338",
"0.6257212",
"0.6194973",
"0.6140226",
"0.61400014",
"0.6098462",
"0.6096171",
"0.60938567",
"0.6073252",
"0.60673803",
"0.6007806",
"0.5963264",
"0.5961697"... | 0.0 | -1 |
get total frame count | def total
to_f
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def size\n frames.inject(0) do |sum, frame|\n sum += frame.bytesize\n end\n end",
"def length; return @totalFrames; end",
"def frame_count\n image.get(\"height\") / size.y\n end",
"def frame_count; motion.frame_count; end",
"def frame_total\n if last_frame?\n las... | [
"0.81113267",
"0.8096822",
"0.8060036",
"0.7832055",
"0.7331548",
"0.7313454",
"0.7313454",
"0.7209652",
"0.71049833",
"0.7095911",
"0.68990004",
"0.68370956",
"0.677048",
"0.6697981",
"0.6681426",
"0.6673756",
"0.6652235",
"0.6607959",
"0.6604641",
"0.65990925",
"0.65773225"... | 0.0 | -1 |
get the number of frames | def frames
value_parts[3]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def frame_count\n image.get(\"height\") / size.y\n end",
"def length; return @totalFrames; end",
"def frame_count; motion.frame_count; end",
"def frame_number\n @frame_number ||= valid? ? frame.size : frame.size - 1\n end",
"def size\n frames.inject(0) do |sum, frame|\n sum += f... | [
"0.84240603",
"0.84212893",
"0.82411236",
"0.7932214",
"0.7843005",
"0.7796518",
"0.7631863",
"0.73802525",
"0.7074324",
"0.7013755",
"0.6989096",
"0.69247746",
"0.69038343",
"0.68853486",
"0.6819959",
"0.6764635",
"0.6764635",
"0.67208636",
"0.6718759",
"0.6718759",
"0.66552... | 0.6391889 | 36 |
get the number of seconds | def seconds
value_parts[2]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def seconds\n _nudge[2]\n end",
"def seconds\n @time\n end",
"def seconds\n (Time.now - @start_time).to_i\n end",
"def sec\n return @t_sec\n end",
"def in_seconds\n @seconds\n end",
"def seconds\n ((@died_at - @time) / 1000).to_i\n end",
"def time_sec; Time.now.sec; end"... | [
"0.87163454",
"0.85110354",
"0.8152603",
"0.8106849",
"0.80560905",
"0.7988258",
"0.79868126",
"0.79193056",
"0.78875625",
"0.7844001",
"0.78369176",
"0.7831762",
"0.7775197",
"0.7768916",
"0.7699226",
"0.7692181",
"0.7583608",
"0.753461",
"0.7530171",
"0.7512235",
"0.7496844... | 0.776406 | 15 |
get the number of minutes | def minutes
value_parts[1]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def minutes\n _nudge[1]\n end",
"def minutes() 60 * seconds end",
"def minutes\n (seconds % 3600) / 60\n end",
"def seconds_in_minutes(num_min)\n\tnum_min * 60\nend",
"def getMinutes\r\n\t\t\t\t\treturn @minutes\r\n\t\t\t\tend",
"def minutes\n (@seconds.abs / 60) % 60 * (@seconds < 0 ? -... | [
"0.87578285",
"0.86155283",
"0.8270592",
"0.802137",
"0.7966866",
"0.7958939",
"0.7919668",
"0.7908529",
"0.789818",
"0.78509223",
"0.78509223",
"0.76957166",
"0.768563",
"0.768563",
"0.7645099",
"0.7630049",
"0.761332",
"0.7594933",
"0.7548243",
"0.75180703",
"0.7490912",
... | 0.8122225 | 4 |
get the number of hours | def hours
value_parts[0]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hours() 60 * minutes end",
"def hours\n _nudge[0]\n end",
"def hours\n self.to_i * 3_600\n end",
"def hours\n seconds / 3600\n end",
"def hours\n return \"There are #{self * (60 * 60)} seconds in #{self} hours\"\n end",
"def hours\n @seconds.abs / 60 / 60 * (@seconds < 0 ? -... | [
"0.83909804",
"0.83113873",
"0.82278347",
"0.8214109",
"0.8051538",
"0.8028283",
"0.79504836",
"0.7873682",
"0.77636313",
"0.77421266",
"0.7664587",
"0.76560074",
"0.7627916",
"0.76173365",
"0.7616956",
"0.7611184",
"0.761056",
"0.761056",
"0.76089287",
"0.7558555",
"0.751577... | 0.7883483 | 8 |
get frame interval in fractions of a second | def frame_interval
1.0/@fps
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_sec\n return (self / Graphics.frame_rate).to_i + 1\n end",
"def frame_rate\n return (1 / DT).to_i\n end",
"def with_frames_as_fraction\n vp = value_parts.dup\n vp[-1] = (100.0 / @fps) * vp[-1]\n WITH_FRACTIONS_OF_SECOND % vp\n end",
"def with_frames_as_fraction\n vp = value_parts.... | [
"0.7320206",
"0.7318437",
"0.7287294",
"0.7287294",
"0.71537125",
"0.7054459",
"0.7020367",
"0.67744434",
"0.6592424",
"0.6592424",
"0.6491766",
"0.648647",
"0.6372257",
"0.6308229",
"0.62983805",
"0.626975",
"0.6261458",
"0.6231384",
"0.6213084",
"0.6180261",
"0.61692625",
... | 0.7891125 | 2 |
get the timecode as bitpacked unsigned 32 bit int (suitable for DPX and SGI) | def to_uint
elements = (("%02d" * 4) % [hours,minutes,seconds,frames]).split(//).map{|e| e.to_i }
uint = 0
elements.reverse.each_with_index do | p, i |
uint |= p << 4 * i
end
uint
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def code\n return \"#{\"%04d\" % @t_year}#{\"%02d\" % @t_month}#{\"%02d\" % @t_day}#{\"%02d\" % @t_hour}#{\"%02d\" % @t_min}#{\"%02d\" % @t_sec}#{\"%05d\" % @t_usec}\"\n end",
"def timestamp_value\n @timestamp_value ||=\n ((@time_hi_and_version & 0b1111_1111_1111) << 48) |\n (@time_mid << 32) | ... | [
"0.6642419",
"0.6276044",
"0.6182341",
"0.61265653",
"0.608471",
"0.6063012",
"0.6057655",
"0.5995523",
"0.59771186",
"0.5967025",
"0.59632736",
"0.5855418",
"0.5730776",
"0.57213473",
"0.5691734",
"0.56782067",
"0.5614662",
"0.5584056",
"0.557128",
"0.5527884",
"0.5526016",
... | 0.6521505 | 2 |
get the timecode as a floatingpoint number of seconds (used in Quicktime) | def to_seconds
(@total / @fps)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def seconds\n value_parts[2]\n end",
"def seconds\n value_parts[2]\n end",
"def seconds\n _nudge[2]\n end",
"def usec_to_sec(ts)\n ts / USEC_ONE_SECOND\n end",
"def sec() time[2] end",
"def to_seconds\n @atom * self.factor\n end",
"def to_seconds\n atom * factor\n en... | [
"0.74110836",
"0.74110836",
"0.7394003",
"0.7306453",
"0.72102904",
"0.71123564",
"0.70970744",
"0.7060398",
"0.69945264",
"0.69553703",
"0.69317836",
"0.6880911",
"0.6846401",
"0.68241423",
"0.68153566",
"0.6813503",
"0.6793903",
"0.6769787",
"0.6769065",
"0.6765151",
"0.675... | 0.64544475 | 49 |
Convert to different framerate based on the total frames. Therefore, 1 second of PAL video will convert to 25 frames of NTSC (this is suitable for PAL to film TC conversions and back). | def convert(new_fps)
self.class.new(@total, new_fps)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fps_normalize(fps)\n if fps == 29.97\n nominal_fps = 30\n\n elsif fps == 23.98\n nominal_fps = 24\n\n else\n nominal_fps = fps\n end\n\n return nominal_fps\nend",
"def convert(new_fps)\n raise NonPositiveFps, \"FPS cannot be less than 0\" if new_fps < 1\n self.class.new((total/fps)*new_fp... | [
"0.6697998",
"0.66967195",
"0.62520903",
"0.62520903",
"0.6191774",
"0.6191774",
"0.6191774",
"0.61228204",
"0.605187",
"0.60460216",
"0.5878602",
"0.5849321",
"0.5832488",
"0.5829457",
"0.58245826",
"0.5812309",
"0.5719798",
"0.57060826",
"0.5652742",
"0.5652742",
"0.5612125... | 0.6289546 | 3 |
get formatted SMPTE timecode | def to_s
if (framerate_in_delta(fps, 24))
WITH_FRAMES_24 % value_parts
else
WITH_FRAMES % value_parts
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def code\n return \"#{\"%04d\" % @t_year}#{\"%02d\" % @t_month}#{\"%02d\" % @t_day}#{\"%02d\" % @t_hour}#{\"%02d\" % @t_min}#{\"%02d\" % @t_sec}#{\"%05d\" % @t_usec}\"\n end",
"def tt(time, format=:short); '13:37'; end",
"def time_s\n time_to_s(time)\n end",
"def to_s\n return \"#{\"%04d\" % @... | [
"0.7464148",
"0.7127073",
"0.6998758",
"0.682856",
"0.6730141",
"0.66631067",
"0.6646677",
"0.6628534",
"0.66249746",
"0.65264535",
"0.65151256",
"0.65132654",
"0.63906693",
"0.6376862",
"0.63748485",
"0.63677347",
"0.6342945",
"0.63259465",
"0.63213307",
"0.62824595",
"0.628... | 0.0 | -1 |
get total frames as float | def to_f
@total
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_seconds\n (@total / @fps)\n end",
"def to_seconds\n (@total / @fps)\n end",
"def frame_total\n if last_frame?\n last_frame_total\n else\n first_two + frame_bonus\n end\n end",
"def frames_per_second; motion.frames_per_second; end",
"def to_sec\n return (sel... | [
"0.79616034",
"0.79616034",
"0.75498855",
"0.75464684",
"0.7451952",
"0.74427456",
"0.74168164",
"0.7403956",
"0.7389555",
"0.73098",
"0.72626096",
"0.7241637",
"0.7183476",
"0.7163553",
"0.71363634",
"0.71086967",
"0.7046192",
"0.7032471",
"0.6935492",
"0.67654794",
"0.67063... | 0.0 | -1 |
get total frames as integer | def to_i
@total
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def frame_count\n image.get(\"height\") / size.y\n end",
"def length; return @totalFrames; end",
"def size\n frames.inject(0) do |sum, frame|\n sum += frame.bytesize\n end\n end",
"def frame_count; motion.frame_count; end",
"def frame_total\n if last_frame?\n las... | [
"0.80912435",
"0.804025",
"0.79728925",
"0.756747",
"0.730296",
"0.72636914",
"0.7231379",
"0.71430695",
"0.71191967",
"0.7063202",
"0.7024515",
"0.7018792",
"0.7014792",
"0.7014792",
"0.6840673",
"0.6812271",
"0.67977834",
"0.67977834",
"0.6787282",
"0.67577386",
"0.6694749"... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.