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 |
|---|---|---|---|---|---|---|
Private setter for extensions +val+. | def set_extensions(val)
@extensions = val
build_path_query
@extensions
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def value=(val); end",
"def extensions=(val)\n set_extensions(val)\n val\n end",
"def set(v)\n @val = v\n end",
"def value=(val)\n self[:value] = serialize_value(val)\n end",
"def value=(v)\n set(v)\n end",
"def set(val)\n @value = val\n @http_value = nil\n self\n ... | [
"0.7488874",
"0.7451278",
"0.6986095",
"0.67787266",
"0.6663018",
"0.65595436",
"0.6486286",
"0.64729416",
"0.6450398",
"0.6446164",
"0.6440185",
"0.6398086",
"0.63835883",
"0.6366468",
"0.6275599",
"0.62748194",
"0.62611043",
"0.6258852",
"0.61894155",
"0.6148568",
"0.613840... | 0.63267833 | 14 |
Setter for extensions +val+. | def extensions=(val)
set_extensions(val)
val
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def value=(val); end",
"def set(v)\n @val = v\n end",
"def set(value)\n case value\n when DateTime\n set(value.to_time)\n when Time\n set(value.to_i)\n when Integer\n self.val = value\n else\n self.val = value.to_i\n end\n ... | [
"0.7321347",
"0.7141514",
"0.6701608",
"0.66765064",
"0.6591225",
"0.65878767",
"0.6548945",
"0.653033",
"0.65099406",
"0.64574444",
"0.6425676",
"0.6389087",
"0.63120794",
"0.6305726",
"0.6286588",
"0.6182568",
"0.6174328",
"0.6162142",
"0.6136359",
"0.6135235",
"0.61299527"... | 0.7574763 | 0 |
Checks if URI has a path. For URI::LDAP this will return +false+. | def hierarchical?
false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def url?(uri)\n /\\w+\\:\\/\\// =~ uri\n end",
"def url?(uri)\n /\\w+\\:\\/\\// =~ uri\n end",
"def is_url?\n path =~ URL_PATHS\n end",
"def matches?(uri)\n !expired? && valid?(uri) && uri.path.start_with?(path)\n end",
"def valid_uri?\n !self.contenta... | [
"0.7547232",
"0.7493172",
"0.73865235",
"0.72844076",
"0.7181453",
"0.7130043",
"0.703872",
"0.7036227",
"0.70185566",
"0.70185566",
"0.69679993",
"0.69633496",
"0.69115007",
"0.6879477",
"0.6871115",
"0.6842029",
"0.68266296",
"0.68266296",
"0.6805682",
"0.6803528",
"0.67916... | 0.0 | -1 |
== Description Creates a new URI::MailTo object from generic URL components with no syntax checking. This method is usually called from URI::parse, which checks the validity of each component. | def initialize(*arg)
super(*arg)
@to = nil
@headers = []
# The RFC3986 parser does not normally populate opaque
@opaque = "?#{@query}" if @query && !@opaque
unless @opaque
raise InvalidComponentError,
"missing opaque part for mailto URL"
end
to, heade... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_to(v)\n return true unless v\n return true if v.size == 0\n\n v.split(/[,;]/).each do |addr|\n # check url safety as path-rootless\n if /\\A(?:%\\h\\h|[!$&-.0-;=@-Z_a-z~])*\\z/ !~ addr\n raise InvalidComponentError,\n \"an address in 'to' is invalid as URI... | [
"0.5851942",
"0.5593088",
"0.5550403",
"0.55111367",
"0.54876006",
"0.548131",
"0.53612995",
"0.5314292",
"0.53068984",
"0.52490026",
"0.5220756",
"0.5161469",
"0.5058724",
"0.5019313",
"0.4992174",
"0.49901074",
"0.4975434",
"0.49584922",
"0.49095538",
"0.4908723",
"0.490108... | 0.74995434 | 0 |
Checks the to +v+ component. | def check_to(v)
return true unless v
return true if v.size == 0
v.split(/[,;]/).each do |addr|
# check url safety as path-rootless
if /\A(?:%\h\h|[!$&-.0-;=@-Z_a-z~])*\z/ !~ addr
raise InvalidComponentError,
"an address in 'to' is invalid as URI #{addr.dump}"
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check(slf, *v, &blk)\n AndContract.check_array(@contracts, slf, *v, &blk)\n end",
"def validate(v, params)\n @params = params\n ret = valid?(v)\n @params = nil\n ret\n end",
"def _call_vet(what_to_check)\n if @vet.nil? then what_to_check\n else @vet.call what_... | [
"0.5528702",
"0.5506785",
"0.5440018",
"0.53706473",
"0.53706473",
"0.5288941",
"0.5173168",
"0.5156784",
"0.51199996",
"0.508254",
"0.50805414",
"0.50666463",
"0.5052084",
"0.5052084",
"0.50190717",
"0.50071365",
"0.49953166",
"0.4982976",
"0.49778596",
"0.49301985",
"0.4927... | 0.5195738 | 6 |
Private setter for to +v+. | def set_to(v)
@to = v
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set(v)\n @val = v\n end",
"def value=(v)\n set(v)\n end",
"def value=(v)\n self.explicitly_set_value = true\n @casted_value = nil\n @value = v\n end",
"def []=(k, v)\n return @value[k].value = v if not v.kind_of? Parsel\n @value[k] = v\n end"... | [
"0.7527351",
"0.73334837",
"0.6892809",
"0.6891008",
"0.6799029",
"0.6788108",
"0.67521155",
"0.6698979",
"0.6654759",
"0.66511905",
"0.6637097",
"0.6530234",
"0.65107393",
"0.64618045",
"0.6382158",
"0.6372917",
"0.63452405",
"0.6319145",
"0.62876683",
"0.628094",
"0.6208922... | 0.57656854 | 58 |
Setter for to +v+. | def to=(v)
check_to(v)
set_to(v)
v
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set(v)\n @val = v\n end",
"def value=(v)\n set(v)\n end",
"def value=(v)\n @value = from_type(v)\n end",
"def v=(new_val)\n old_v = @v\n # map new_val => boolean by Ruby's idiom\n if new_val\n @v = true\n data_change @v unless old_v\n else... | [
"0.7618431",
"0.7061413",
"0.6876886",
"0.6861492",
"0.6825862",
"0.6811254",
"0.66819364",
"0.6674108",
"0.6533745",
"0.6516567",
"0.64738214",
"0.6457178",
"0.6434531",
"0.63748115",
"0.631143",
"0.6286233",
"0.6278465",
"0.6262857",
"0.6189318",
"0.6114183",
"0.609237",
... | 0.6034056 | 24 |
Checks the headers +v+ component against either HEADER_REGEXP | def check_headers(v)
return true unless v
return true if v.size == 0
if HEADER_REGEXP !~ v
raise InvalidComponentError,
"bad component(expected opaque component): #{v}"
end
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_headers(headers)\n # check version from Accept headers; expect custom media type `spoonlibrary`\n accept = headers[:accept]\n accept&.include?(\"application/vnd.spoonlibrary.#{version}+json\")\n end",
"def contains_valid_headers(value)\n split_value = value.split(/\\n/)\n if split_v... | [
"0.67970604",
"0.6514751",
"0.62393355",
"0.6221037",
"0.61081517",
"0.6103664",
"0.6072168",
"0.60698575",
"0.5995491",
"0.5939529",
"0.59371215",
"0.5935862",
"0.5912581",
"0.5878252",
"0.5875266",
"0.58734053",
"0.5848347",
"0.58245635",
"0.57971656",
"0.5787823",
"0.57698... | 0.785344 | 0 |
Private setter for headers +v+. | def set_headers(v)
@headers = []
if v
v.split('&').each do |x|
@headers << x.split(/=/, 2)
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def headers=(v)\n check_headers(v)\n set_headers(v)\n v\n end",
"def headers=(v)\n cfg_set(:headers, v)\n end",
"def headers=(v)\n cfg_set(:headers, v)\n end",
"def headers=(hash)\n if headers\n headers.replace hash\n else\n super\n e... | [
"0.8926437",
"0.8458876",
"0.8402177",
"0.7698679",
"0.76608396",
"0.758337",
"0.743423",
"0.7345548",
"0.73317426",
"0.73317426",
"0.7179595",
"0.6958935",
"0.692368",
"0.68630004",
"0.6850348",
"0.6841035",
"0.68142503",
"0.68025875",
"0.6799975",
"0.6790435",
"0.6694306",
... | 0.79464555 | 3 |
Setter for headers +v+. | def headers=(v)
check_headers(v)
set_headers(v)
v
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def headers=(v)\n cfg_set(:headers, v)\n end",
"def headers=(v)\n cfg_set(:headers, v)\n end",
"def set_headers(v)\n @headers = []\n if v\n v.split('&').each do |x|\n @headers << x.split(/=/, 2)\n end\n end\n end",
"def []=(k, v) @headers[t... | [
"0.8624303",
"0.85950553",
"0.80321014",
"0.757205",
"0.756266",
"0.7421763",
"0.7250484",
"0.7195866",
"0.7106821",
"0.69731754",
"0.69731754",
"0.6951314",
"0.69279253",
"0.6920678",
"0.6823035",
"0.6812143",
"0.68083537",
"0.68053055",
"0.67990136",
"0.67833537",
"0.674252... | 0.88864106 | 0 |
Constructs String from URI. | def to_s
@scheme + ':' +
if @to
@to
else
''
end +
if @headers.size > 0
'?' + @headers.collect{|x| x.join('=')}.join('&')
else
''
end +
if @fragment
'#' + @fragment
else
''
end
en... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def construct_url(uri)\n \"#{uri.scheme}://#{uri.host}#{uri.path}\"\n end",
"def to_s\n uri.to_s\n end",
"def to_s\n uri_string\n end",
"def to_s\n @uri_string ||=\n begin\n uri_string = \"#{normalized_authority}:#{normalized_path}\"\n if uri_string.r... | [
"0.7229053",
"0.69332135",
"0.6824298",
"0.66844976",
"0.66258466",
"0.66127706",
"0.6592582",
"0.64861035",
"0.6484543",
"0.6484543",
"0.64726686",
"0.64705205",
"0.64487535",
"0.6402576",
"0.63961303",
"0.63875425",
"0.63778013",
"0.6364658",
"0.63604593",
"0.63484514",
"0.... | 0.0 | -1 |
Returns the RFC822 email text equivalent of the URL, as a String. Example: require 'uri' | def to_mailtext
to = URI.decode_www_form_component(@to)
head = ''
body = ''
@headers.each do |x|
case x[0]
when 'body'
body = URI.decode_www_form_component(x[1])
when 'to'
to << ', ' + URI.decode_www_form_component(x[1])
else
head << ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_s\n u = uri\n u = u.gsub(/^mailto: */i, '')\n\n if cn.length > 0\n \"#{cn.inspect} <#{uri}>\"\n else\n uri\n end\n end",
"def to_s\n uri.to_s\n end",
"def to_s\n uri_string\n end",
"def date_to_rfc822(date); end",
"def rea... | [
"0.7671663",
"0.6370504",
"0.6223686",
"0.61241746",
"0.60384196",
"0.60322165",
"0.60322165",
"0.60247666",
"0.59841037",
"0.59517777",
"0.595005",
"0.59406215",
"0.5927833",
"0.59212446",
"0.5886516",
"0.5885218",
"0.58815855",
"0.5831508",
"0.5812958",
"0.57992524",
"0.578... | 0.5675094 | 31 |
Creates a new git gem source for a gems from loaded from +repository+ at the given +reference+. The +name+ is only used to track the repository back to a gem dependencies file, it has no real significance as a git repository may contain multiple gems. If +submodules+ is true, submodules will be checked out when the gem... | def initialize(name, repository, reference, submodules = false)
super repository
@name = name
@repository = repository
@reference = reference
@need_submodules = submodules
@remote = true
@root_dir = Gem.dir
@git = ENV['git'] || 'git'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_git_spec(name, version, repository, reference, submodules) # :nodoc:\n add_git_gem name, repository, reference, submodules\n\n source = Gem::Source::Git.new name, repository, reference\n source.root_dir = @root_dir\n\n spec = Gem::Specification.new do |s|\n s.name = name\n s.versio... | [
"0.71863794",
"0.70213056",
"0.6208933",
"0.6095388",
"0.6007038",
"0.58957607",
"0.56644714",
"0.5530447",
"0.5440158",
"0.5439016",
"0.5439016",
"0.5439016",
"0.5439016",
"0.5439016",
"0.5439016",
"0.5439016",
"0.5439016",
"0.5439016",
"0.5439016",
"0.5427165",
"0.5427165",... | 0.6431571 | 2 |
Checks out the files for the repository into the install_dir. | def checkout # :nodoc:
cache
return false unless File.exist? repo_cache_dir
unless File.exist? install_dir
system @git, 'clone', '--quiet', '--no-checkout',
repo_cache_dir, install_dir
end
Dir.chdir install_dir do
system @git, 'fetch', '--quiet', '--force', '--tags', inst... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def installed_files\n Dir.chdir(@spec.gem_dir) { Dir['**/*'].reject {|fp| ::File.directory?(fp) } }\n end",
"def install(testmode=false)\n @changeset.clear\n extract_files(testmode)\n\n # Generate checksums and add to hash\n checksums = Hash.new\n if File.exists?(@install_dir)\n D... | [
"0.63023263",
"0.6172689",
"0.6035504",
"0.59345835",
"0.5911507",
"0.5896443",
"0.5865762",
"0.5841462",
"0.5819464",
"0.57644284",
"0.57333845",
"0.5705735",
"0.5664437",
"0.5645473",
"0.562563",
"0.557597",
"0.55314153",
"0.55306524",
"0.55272186",
"0.5488863",
"0.5488254"... | 0.5868041 | 6 |
Creates a local cache repository for the git gem. | def cache # :nodoc:
return unless @remote
if File.exist? repo_cache_dir
Dir.chdir repo_cache_dir do
system @git, 'fetch', '--quiet', '--force', '--tags',
@repository, 'refs/heads/*:refs/heads/*'
end
else
system @git, 'clone', '--quiet', '--bare', '--no-hardlinks',
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cache # :nodoc:\n if File.exist? repo_cache_dir then\n Dir.chdir repo_cache_dir do\n system @git, 'fetch', '--quiet', '--force', '--tags',\n @repository, 'refs/heads/*:refs/heads/*'\n end\n else\n system @git, 'clone', '--quiet', '--bare', '--no-hardlinks',\n ... | [
"0.7517374",
"0.72636753",
"0.71165925",
"0.70887023",
"0.7042209",
"0.7003464",
"0.6911157",
"0.6911157",
"0.67467034",
"0.6610834",
"0.65846294",
"0.6543115",
"0.6532236",
"0.6519754",
"0.6475586",
"0.6372852",
"0.6350531",
"0.6320809",
"0.6270762",
"0.62533873",
"0.6246748... | 0.7443415 | 1 |
Directory where git gems get unpacked and soforth. | def base_dir # :nodoc:
File.join @root_dir, 'bundler'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bundle_dir\n File.expand_path(File.join(Bixby.repo_path, self.relative_path))\n end",
"def install_dir # :nodoc:\n return unless File.exist? repo_cache_dir\n\n File.join base_dir, 'gems', \"#{@name}-#{dir_shortref}\"\n end",
"def installed_files\n Dir.chdir(@spec.gem_dir) { Dir['**/*'].re... | [
"0.72911465",
"0.7214497",
"0.7198874",
"0.7131239",
"0.7100506",
"0.70978427",
"0.70978427",
"0.7082812",
"0.706726",
"0.7027338",
"0.68200094",
"0.6818676",
"0.67907023",
"0.6711987",
"0.6674975",
"0.6671115",
"0.6622501",
"0.6562818",
"0.6529375",
"0.65262574",
"0.6515039"... | 0.6580791 | 17 |
A short reference for use in git gem directories | def dir_shortref # :nodoc:
rev_parse[0..11]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def git_dir; end",
"def gemspec_helper; end",
"def gemspec_helper; end",
"def gemspec_helper; end",
"def gemspec_helper; end",
"def gemspec_helper; end",
"def gemspec_helper; end",
"def gemspec; end",
"def gemspec; end",
"def gemspec; end",
"def gemspec; end",
"def gemspec; end",
"def gemsp... | [
"0.70025516",
"0.68980914",
"0.68980914",
"0.68980914",
"0.68980914",
"0.68980914",
"0.68980914",
"0.68917596",
"0.68917596",
"0.68917596",
"0.68917596",
"0.68917596",
"0.68917596",
"0.68917596",
"0.68917596",
"0.6844118",
"0.668669",
"0.668669",
"0.668669",
"0.668669",
"0.66... | 0.60102975 | 73 |
Nothing to download for git gems | def download(full_spec, path) # :nodoc:
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def download_prog(repo_hash)\n if (repo_hash[:source] == \"github\")\n clone_repo(repo_hash)\n elsif (repo_hash[:source] == \"rubygems\")\n puts \"Unpacking gem #{repo_hash[:name]}...\"\n system \"gem unpack #{repo_hash[:name]} --version #{repo_hash[:version]}\"\n else\n raise \"Unexpected source of... | [
"0.6551503",
"0.6422271",
"0.642163",
"0.6415758",
"0.63732904",
"0.6362877",
"0.6333285",
"0.62889516",
"0.62606364",
"0.6254578",
"0.624836",
"0.61970454",
"0.6177279",
"0.6176365",
"0.6176365",
"0.6176365",
"0.6166865",
"0.6166865",
"0.6166865",
"0.6166865",
"0.6166865",
... | 0.0 | -1 |
The directory where the git gem will be installed. | def install_dir # :nodoc:
return unless File.exist? repo_cache_dir
File.join base_dir, 'gems', "#{@name}-#{dir_shortref}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def git_dir; end",
"def git_directory\n @git_directory ||= root_glob(\".{,.,./..,./../..}/.git\").first\n end",
"def get_git_dir(path)\n get_dir(path, '', '.git')\n end",
"def install_dir # :nodoc:\n File.join Gem.dir, 'bundler', 'gems', \"#{@name}-#{dir_shortref}\"\n end",
"def gem_dir... | [
"0.7741915",
"0.77388316",
"0.75278103",
"0.7474076",
"0.7464815",
"0.7464815",
"0.74344444",
"0.7307026",
"0.7278311",
"0.7169625",
"0.71103704",
"0.70884",
"0.70755255",
"0.7074655",
"0.70279557",
"0.70199466",
"0.7011845",
"0.70029134",
"0.6981696",
"0.68981177",
"0.687793... | 0.75498 | 2 |
The directory where the git gem's repository will be cached. | def repo_cache_dir # :nodoc:
File.join @root_dir, 'cache', 'bundler', 'git', "#{@name}-#{uri_hash}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def repo_cache_dir\n File.join(cached_repos_dir, repository_directory)\n end",
"def repo_cache_dir # :nodoc:\n File.join Gem.dir, 'cache', 'bundler', 'git', \"#{@name}-#{uri_hash}\"\n end",
"def cache_repository_path\n File.absolute_path(File.join(Rails.root, 'cache', cached_directory))\n end",
"... | [
"0.8763724",
"0.86980253",
"0.8270701",
"0.82043326",
"0.79862535",
"0.7882457",
"0.7615078",
"0.75813264",
"0.7524027",
"0.75036573",
"0.7480764",
"0.74787605",
"0.74787605",
"0.74399966",
"0.74262816",
"0.7424164",
"0.74231553",
"0.739479",
"0.739479",
"0.7355846",
"0.73397... | 0.85861635 | 2 |
Converts the git reference for the repository into a commit hash. | def rev_parse # :nodoc:
hash = nil
Dir.chdir repo_cache_dir do
hash = Gem::Util.popen(@git, 'rev-parse', @reference).strip
end
raise Gem::Exception,
"unable to find reference #{@reference} in #{@repository}" unless
$?.success?
hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def git_sha_for(path)\n website.git_repository.git_sha path\n end",
"def commit_hash(branch_or_tag = nil)\n version = 'HEAD'\n working_dir do\n version = git 'rev-parse', branch_or_tag || 'HEAD'\n end\n version.strip\n end",
"def commit_hash(branch_or_tag = nil)\n git 're... | [
"0.73668617",
"0.71606916",
"0.7059025",
"0.70058167",
"0.6944291",
"0.693747",
"0.6925876",
"0.68897426",
"0.6800969",
"0.6756306",
"0.67107546",
"0.6685495",
"0.6656447",
"0.66282153",
"0.66264087",
"0.6620763",
"0.6562315",
"0.65150255",
"0.6507206",
"0.6401923",
"0.639265... | 0.622828 | 30 |
Loads all gemspecs in the repository | def specs
checkout
return [] unless install_dir
Dir.chdir install_dir do
Dir['{,*,*/*}.gemspec'].map do |spec_file|
directory = File.dirname spec_file
file = File.basename spec_file
Dir.chdir directory do
spec = Gem::Specification.load file
if spec
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_gems_in(*spec_dirs); end",
"def with_each_gemspec\n Dir[\"**/*.gemspec\"].each do |file|\n yield(file, Gem::Specification.load(file)) if block_given?\n end\nend",
"def gemspecs; end",
"def gemspecs\n return [] if directory.empty? || directory == '*'\n @gemspecs ||= Dir[File.join(direc... | [
"0.7298737",
"0.72863",
"0.71756065",
"0.7082235",
"0.69025904",
"0.676513",
"0.6634648",
"0.6566282",
"0.65636843",
"0.6489862",
"0.6488596",
"0.63698304",
"0.63698304",
"0.63698304",
"0.63698304",
"0.63698304",
"0.63698304",
"0.63698304",
"0.63698304",
"0.63654596",
"0.6349... | 0.73296887 | 0 |
A hash for the git gem based on the git repository URI. | def uri_hash # :nodoc:
require_relative '../openssl'
normalized =
if @repository =~ %r{^\w+://(\w+@)?}
uri = URI(@repository).normalize.to_s.sub %r{/$},''
uri.sub(/\A(\w+)/) { $1.downcase }
else
@repository
end
OpenSSL::Digest::SHA1.hexdigest normalized
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def uri_hash # :nodoc:\n normalized =\n if @repository =~ %r%^\\w+://(\\w+@)?% then\n uri = URI(@repository).normalize.to_s.sub %r%/$%,''\n uri.sub(/\\A(\\w+)/) { $1.downcase }\n else\n @repository\n end\n\n Digest::SHA1.hexdigest normalized\n end",
"def git_sha_for(pat... | [
"0.80263406",
"0.78267366",
"0.713539",
"0.7103495",
"0.693887",
"0.6816984",
"0.6613552",
"0.6600667",
"0.6591239",
"0.6494811",
"0.64331853",
"0.6398229",
"0.6398229",
"0.63498485",
"0.6347936",
"0.6327563",
"0.62651837",
"0.62473345",
"0.62464774",
"0.6226051",
"0.6222407"... | 0.8082328 | 0 |
Installed sources sort before all other sources | def <=>(other)
case other
when Gem::Source::Git,
Gem::Source::Lock,
Gem::Source::Vendor then
-1
when Gem::Source::Installed then
0
when Gem::Source then
1
else
nil
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sources\n sort!\n @sources\n end",
"def init_gemspecs\n Gem.source_index.map { |_, spec| spec }.sort { |a,b|\n\t(a.name <=> b.name).nonzero? || (b.version <=> a.version)\n }\n end",
"def ordered_sources\n @ordered_sources ||= sources.sort{|a, b| a.created_at <=> b.created_at}\n... | [
"0.7378753",
"0.6840254",
"0.6728501",
"0.6613713",
"0.65735805",
"0.6536081",
"0.6450526",
"0.63436854",
"0.62780434",
"0.6156428",
"0.60958165",
"0.60680455",
"0.6024562",
"0.6015469",
"0.5984568",
"0.59379095",
"0.59248793",
"0.59191495",
"0.583522",
"0.5815455",
"0.579700... | 0.0 | -1 |
We don't need to download an installed gem | def download(spec, path)
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def install_gem; end",
"def require_gems; end",
"def ensure_gem_installed(g)\n unless Gem.available? g\n run \"sudo gem install #{g}\"\n end\nend",
"def check_for_libraries; end",
"def gem_if_necessary(gem)\n grep = args = nil\n if gem =~ /(.*)-(\\d+\\.\\d+\\.\\d+)$/\n gem, version = ... | [
"0.71678156",
"0.70304847",
"0.7013915",
"0.6705731",
"0.6693774",
"0.6673416",
"0.6636396",
"0.65994626",
"0.6561877",
"0.6516913",
"0.64275724",
"0.6420434",
"0.6358279",
"0.6353605",
"0.63415766",
"0.6338328",
"0.6313467",
"0.6275455",
"0.623142",
"0.620761",
"0.61933494",... | 0.0 | -1 |
Creates a new SpecificFile for the gem in +file+ | def initialize(file)
@uri = nil
@path = ::File.expand_path(file)
@package = Gem::Package.new @path
@spec = @package.spec
@name = @spec.name_tuple
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_from_file\n end",
"def create_file(file)\n @generic_file = GenericFile.new\n @generic_file.batch_id = object.batch.pid\n @generic_file.add_file(file.read, 'content', file.name)\n @generic_file.apply_depositor_metadata(object.edit_users.first)\n @generic_file.date_uploaded = Time.no... | [
"0.6725643",
"0.6527118",
"0.64984846",
"0.6242257",
"0.6232494",
"0.6230777",
"0.620964",
"0.62044233",
"0.61245906",
"0.60735345",
"0.6070839",
"0.6069532",
"0.6060696",
"0.601776",
"0.60158247",
"0.59947366",
"0.5977751",
"0.5977122",
"0.5967078",
"0.5942858",
"0.5941416",... | 0.61135364 | 9 |
Orders this source against +other+. If +other+ is a SpecificFile from a different gem name +nil+ is returned. If +other+ is a SpecificFile from the same gem name the versions are compared using Gem::Version Otherwise Gem::Source is used. | def <=>(other)
case other
when Gem::Source::SpecificFile then
return nil if @spec.name != other.spec.name
@spec.version <=> other.spec.version
else
super
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def <=>(other)\n case other\n when Gem::Source::Installed,\n Gem::Source::Local,\n Gem::Source::Lock,\n Gem::Source::SpecificFile,\n Gem::Source::Git,\n Gem::Source::Vendor then\n -1\n when Gem::Source then\n if !@uri\n return 0 unless other.uri\n ... | [
"0.70380735",
"0.65675795",
"0.6371572",
"0.6028485",
"0.59520453",
"0.58887094",
"0.57709163",
"0.5647134",
"0.56159323",
"0.55853236",
"0.5526247",
"0.5522704",
"0.54939187",
"0.5464089",
"0.5445728",
"0.5428915",
"0.54098725",
"0.5404462",
"0.5345382",
"0.533847",
"0.53376... | 0.7998386 | 0 |
Local sorts before Gem::Source and after Gem::Source::Installed | def <=>(other)
case other
when Gem::Source::Installed,
Gem::Source::Lock then
-1
when Gem::Source::Local then
0
when Gem::Source then
1
else
nil
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_gemspecs\n Gem.source_index.map { |_, spec| spec }.sort { |a,b|\n\t(a.name <=> b.name).nonzero? || (b.version <=> a.version)\n }\n end",
"def sort_obj\n [@name, @version, Gem::Platform.sort_priority(@new_platform)]\n end",
"def requires\n sort!\n sources.map {|s| s.requires ... | [
"0.7594252",
"0.6565568",
"0.6266934",
"0.6206816",
"0.6115791",
"0.6097309",
"0.60854983",
"0.6028938",
"0.6006763",
"0.59894615",
"0.5941833",
"0.5925414",
"0.59191674",
"0.576801",
"0.5742595",
"0.57226086",
"0.56770986",
"0.56671566",
"0.5655047",
"0.5640157",
"0.5575258"... | 0.53519076 | 42 |
Creates a new Lock source that wraps +source+ and moves it earlier in the sort list. | def initialize(source)
@wrapped = source
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lock_source(source)\n @source_info ||= source\n self\n end",
"def initialize(source)\n @source = source.dup\n end",
"def new_source(source)\n begin\n @redis.set(source, \"2000-01-01 00:00:00\")\n a = @redis.get(\"SOURCES\")\n a = a +1\n @redis.set(\"SOURCES\", a)... | [
"0.66757756",
"0.53213567",
"0.5262589",
"0.52443224",
"0.5219495",
"0.5219495",
"0.517304",
"0.5151057",
"0.5141375",
"0.50992775",
"0.50922865",
"0.5086759",
"0.50256956",
"0.50170213",
"0.50111157",
"0.50111157",
"0.49322325",
"0.4909891",
"0.48807982",
"0.48807982",
"0.48... | 0.5093042 | 10 |
Delegates to the wrapped source's fetch_spec method. | def fetch_spec(name_tuple)
@wrapped.fetch_spec name_tuple
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch\n active_spec.fetch\n end",
"def method_missing(method, *args, &blk)\n fetch.send(method, *args, &blk)\n end",
"def fetch_data(source, opts)\n DataFetcher.new(source, **opts).fetch\n end",
"def fetch(*)\n raise NotImplementedError, 'This should be defined in a subclas... | [
"0.64130676",
"0.62888455",
"0.6279483",
"0.6255292",
"0.6122219",
"0.6103567",
"0.6081052",
"0.5904819",
"0.5821145",
"0.5798792",
"0.5758692",
"0.5750462",
"0.5742442",
"0.5740135",
"0.5701697",
"0.56921786",
"0.5643097",
"0.5603961",
"0.5596142",
"0.5589106",
"0.55859417",... | 0.5881026 | 8 |
Creates a new Source which will use the index located at +uri+. | def initialize(uri)
begin
unless uri.kind_of? URI
uri = URI.parse(uri.to_s)
end
rescue URI::InvalidURIError
raise if Gem::Source == self.class
end
@uri = uri
@update_cache = nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def source(uri)\n sources << uri\n end",
"def uri= uri\n raise Wukong::Error.new(\"'#{uri}' is not an ElasticSearch es://index/mapping specification\") unless self.class.matches?(uri)\n parts = uri.gsub(ES_SCHEME_REGEXP, '').gsub(/^\\/+/,'').gsub(/\\/+$/,'').split('/')\n \n ra... | [
"0.6487075",
"0.6082061",
"0.5957387",
"0.5912416",
"0.5892479",
"0.5801831",
"0.57225513",
"0.56785274",
"0.5664965",
"0.55957764",
"0.55757284",
"0.55754185",
"0.5573921",
"0.55715084",
"0.5569401",
"0.5522218",
"0.55114347",
"0.54696274",
"0.54684407",
"0.5438814",
"0.5430... | 0.62930524 | 1 |
Sources are ordered by installation preference. | def <=>(other)
case other
when Gem::Source::Installed,
Gem::Source::Local,
Gem::Source::Lock,
Gem::Source::SpecificFile,
Gem::Source::Git,
Gem::Source::Vendor then
-1
when Gem::Source then
if !@uri
return 0 unless other.uri
return 1
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sources\n sort!\n @sources\n end",
"def ordered_sources\n @ordered_sources ||= sources.sort{|a, b| a.created_at <=> b.created_at}\n end",
"def provides\n sort!\n sources.map {|s| s.provides }.flatten\n end",
"def sources\n @sources ||= []\n end",
"def preferred_sou... | [
"0.72608197",
"0.65658057",
"0.64747137",
"0.63963443",
"0.6303227",
"0.6264518",
"0.622301",
"0.61925805",
"0.6150471",
"0.61343926",
"0.6122145",
"0.61129826",
"0.6109057",
"0.6077962",
"0.6040413",
"0.6039637",
"0.59866005",
"0.5953138",
"0.59406817",
"0.5902056",
"0.58635... | 0.5235342 | 77 |
:nodoc: Returns a Set that can fetch specifications from this source. | def dependency_resolver_set # :nodoc:
return Gem::Resolver::IndexSet.new self if 'file' == uri.scheme
fetch_uri = if uri.host == "rubygems.org"
index_uri = uri.dup
index_uri.host = "index.rubygems.org"
index_uri
else
uri
end
bundler_api_uri = enforce_trailing_slash(fetch_ur... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pick_sets # :nodoc:\n @sources.each_source do |source|\n @sets << source.dependency_resolver_set\n end\n end",
"def sets\n return [EscholSet.new({name: \"everything\", spec: \"everything\"})]\n end",
"def representative_set(name)\n representative_source = nil\n highest_version... | [
"0.6556073",
"0.6467209",
"0.6424115",
"0.63154846",
"0.5949999",
"0.5900154",
"0.5867442",
"0.57500863",
"0.57473356",
"0.57393616",
"0.5652534",
"0.5624681",
"0.56229764",
"0.56203127",
"0.56066763",
"0.55303216",
"0.55240095",
"0.5479958",
"0.5470416",
"0.5458158",
"0.5456... | 0.0 | -1 |
Returns the local directory to write +uri+ to. | def cache_dir(uri)
# Correct for windows paths
escaped_path = uri.path.sub(/^\/([a-z]):\//i, '/\\1-/')
escaped_path.tap(&Gem::UNTAINT)
File.join Gem.spec_cache_dir, "#{uri.host}%#{uri.port}", File.dirname(escaped_path)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cache_dir(uri)\n File.join @dir, \"#{uri.host}%#{uri.port}\", File.dirname(uri.path)\n end",
"def fullpath(uri)\n return File.join(DIR, uri.gsub('/', File::SEPARATOR))\n end",
"def get_local_dir\n return @resource[:local_dir]\n end",
"def dir\n if url.end_with?(\"/\")\n ur... | [
"0.68019265",
"0.66676074",
"0.6092734",
"0.60664153",
"0.5951146",
"0.5899974",
"0.58839124",
"0.58515006",
"0.5844009",
"0.5822544",
"0.5772424",
"0.5714872",
"0.56993806",
"0.56916046",
"0.5671005",
"0.5665663",
"0.5543459",
"0.5529381",
"0.5523299",
"0.55119437",
"0.54847... | 0.6345744 | 2 |
Returns true when it is possible and safe to update the cache directory. | def update_cache?
return @update_cache unless @update_cache.nil?
@update_cache =
begin
File.stat(Gem.user_home).uid == Process.uid
rescue Errno::ENOENT
false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_root_cache?\n return true\n (! options[:purge_cache]) && File.directory?(options[:cache_dir])\n end",
"def already_cached?\n File.exist?(cached_installer_path) and File.zero?(cached_installer_path) == false\nend",
"def need_update?\n return true unless @lastread\n @lastread < File::... | [
"0.7243145",
"0.7000527",
"0.69482887",
"0.6946615",
"0.68654215",
"0.674646",
"0.67462444",
"0.6744441",
"0.6718177",
"0.66557235",
"0.6622127",
"0.6595922",
"0.65697014",
"0.6524227",
"0.652182",
"0.6481886",
"0.6427322",
"0.6386784",
"0.6351224",
"0.63481605",
"0.63454974"... | 0.76871014 | 0 |
Fetches a specification for the given +name_tuple+. | def fetch_spec(name_tuple)
fetcher = Gem::RemoteFetcher.fetcher
spec_file_name = name_tuple.spec_name
source_uri = enforce_trailing_slash(uri) + "#{Gem::MARSHAL_SPEC_DIR}#{spec_file_name}"
cache_dir = cache_dir source_uri
local_spec = File.join cache_dir, spec_file_name
if File.exist? local... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch_spec(name_tuple)\n @wrapped.fetch_spec name_tuple\n end",
"def fetch_specification(name, version)\n url = host + \"/quick/#{Configuration.marshal_identifier}\" \\\n \"/#{name}-#{version}.gemspec.rz\"\n\n http_get(url).body\n end",
"def spec(name)\n specs = if Gem::S... | [
"0.7997734",
"0.6385883",
"0.5900049",
"0.58220184",
"0.5740154",
"0.56443995",
"0.5588516",
"0.5568555",
"0.5511178",
"0.5452837",
"0.54192406",
"0.5392473",
"0.53045076",
"0.5279691",
"0.5156215",
"0.51489735",
"0.5104204",
"0.5091829",
"0.50795645",
"0.5041357",
"0.5041357... | 0.68689704 | 1 |
Downloads +spec+ and writes it to +dir+. See also Gem::RemoteFetcherdownload. | def download(spec, dir=Dir.pwd)
fetcher = Gem::RemoteFetcher.fetcher
fetcher.download spec, uri.to_s, dir
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def download(spec, target = nil)\n if target.nil?\n ext = File.extname(spec['file_name'])\n base = File.basename(spec['file_name'], ext)\n target = Dir::Tmpname.create([base, ext]) {}\n end\n\n File.open(target, 'wb') do |output|\n retrieve(spec) do |chunk, retrieved, tot... | [
"0.71048486",
"0.67813283",
"0.66397",
"0.621473",
"0.5965541",
"0.59320116",
"0.5724758",
"0.55655295",
"0.54849327",
"0.54728204",
"0.5472406",
"0.54498804",
"0.5427085",
"0.5421224",
"0.53265136",
"0.53044325",
"0.53036064",
"0.5291602",
"0.52874094",
"0.52842844",
"0.5284... | 0.8632541 | 0 |
Takes a hash as its argument. The key is a symbol or an array of symbols. These symbols correspond to method names, instance variable names, or constant names (see def_delegator). The value is the accessor to which the methods will be delegated. :callseq: delegate method => accessor delegate [method, method, ...] => ac... | def instance_delegate(hash)
hash.each do |methods, accessor|
unless defined?(methods.each)
def_instance_delegator(accessor, methods)
else
methods.each {|method| def_instance_delegator(accessor, method)}
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def data_delegator(key)\n define_method(key.to_sym) { @obj.data[key] }\n end",
"def def_hash_delegator(hash, method, key: method, **kwd)\n prefix, suffix, wrap = prepare_delegate(**kwd)\n\n if suffix\n method = method.to_s.gsub(\n /\\?$/, \"\"\n )\n end\n\n ... | [
"0.7308867",
"0.72039306",
"0.6645523",
"0.6598418",
"0.65621054",
"0.65621054",
"0.6316496",
"0.6098927",
"0.6033842",
"0.60064924",
"0.5913977",
"0.5868104",
"0.58592784",
"0.583646",
"0.58174807",
"0.5804042",
"0.56830496",
"0.56769395",
"0.562428",
"0.5599899",
"0.5586051... | 0.7126559 | 2 |
Shortcut for defining multiple delegator methods, but with no provision for using a different name. The following two code samples have the same effect: | def def_instance_delegators(accessor, *methods)
methods.each do |method|
next if /\A__(?:send|id)__\z/ =~ method
def_instance_delegator(accessor, method)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delegate *names, to:\n names.each do |name|\n def_delegator to, name\n end\n end",
"def delegate_methods_to(methods, ivar)\n return if methods.blank?\n def_delegators ivar, *methods\n end",
"def def_single_delegators(accessor, *methods)\n methods.each do |m... | [
"0.7363761",
"0.6711329",
"0.6616362",
"0.6582872",
"0.65618616",
"0.65551436",
"0.64929366",
"0.6487471",
"0.647922",
"0.6474722",
"0.64322066",
"0.64233625",
"0.6415274",
"0.63946474",
"0.6391701",
"0.6362517",
"0.6320977",
"0.62248665",
"0.6075109",
"0.607481",
"0.6035006"... | 0.6452366 | 10 |
Shortcut for defining multiple delegator methods, but with no provision for using a different name. The following two code samples have the same effect: | def def_single_delegators(accessor, *methods)
methods.each do |method|
next if /\A__(?:send|id)__\z/ =~ method
def_single_delegator(accessor, method)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delegate *names, to:\n names.each do |name|\n def_delegator to, name\n end\n end",
"def delegate_methods_to(methods, ivar)\n return if methods.blank?\n def_delegators ivar, *methods\n end",
"def delegate(*methods)\n options = methods.pop\n unless opt... | [
"0.73640645",
"0.6709238",
"0.65804225",
"0.6559031",
"0.65521",
"0.6490356",
"0.6487567",
"0.64775646",
"0.6472135",
"0.6451405",
"0.64326054",
"0.642074",
"0.64145577",
"0.6391977",
"0.6390076",
"0.6360742",
"0.63197815",
"0.62225026",
"0.6074322",
"0.60736054",
"0.6032983"... | 0.66151434 | 2 |
:callseq: def_single_delegator(accessor, method, new_name=method) Defines a method _method_ which delegates to _accessor_ (i.e. it calls the method of the same name in _accessor_). If _new_name_ is provided, it is used as the name for the delegate method. Returns the name of the method defined. | def def_single_delegator(accessor, method, ali = method)
gen = Forwardable._delegator_method(self, accessor, method, ali)
ret = instance_eval(&gen)
singleton_class.__send__(:ruby2_keywords, ali) if RUBY_VERSION >= '2.7'
ret
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def define_delegator(method_name)\n target_name = @target_name\n @scope.send(:define_method, method_name) do |*args|\n send(target_name).public_send(method_name, *args)\n end\n end",
"def def_single_delegators(accessor, *methods)\n methods.each do |method|\n next if /\\A__(?:send... | [
"0.66777164",
"0.6658841",
"0.63145226",
"0.6288051",
"0.6111103",
"0.6102235",
"0.5616805",
"0.54380786",
"0.53767234",
"0.5272477",
"0.5247333",
"0.5231332",
"0.5229353",
"0.5169548",
"0.5168741",
"0.51664066",
"0.51169956",
"0.5067724",
"0.50633657",
"0.5022447",
"0.497554... | 0.7471794 | 0 |
:startdoc: :method: raise Use __raise__ if your Delegator does not have a object to delegate the raise method call. Pass in the _obj_ to delegate method calls to. All methods supported by _obj_ will be delegated to. | def initialize(obj)
__setobj__(obj)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def method_missing(method, *args, &block)\n @delegate.send(method, *args, &block)\n rescue NoMethodError => e\n raise e, e.message.sub(/ for #<.*$/, \" via proxy for #{@delegate}\")\n end",
"def method_missing(id,*args,&block)\n return @delegated_to_object.send(id,*args,&block) if ... | [
"0.6657127",
"0.66389495",
"0.66389495",
"0.64325345",
"0.63805157",
"0.633452",
"0.6275834",
"0.6257252",
"0.62439954",
"0.6115521",
"0.60550773",
"0.6025287",
"0.6004818",
"0.59720266",
"0.5868945",
"0.5832373",
"0.5793008",
"0.5788982",
"0.5788982",
"0.577102",
"0.5751402"... | 0.0 | -1 |
Checks for a method provided by this the delegate object by forwarding the call through \_\_getobj\_\_. | def respond_to_missing?(m, include_private)
r = true
target = self.__getobj__ {r = false}
r &&= target_respond_to?(target, m, include_private)
if r && include_private && !target_respond_to?(target, m, false)
warn "delegator does not forward private method \##{m}", uplevel: 3
return false
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def method_missing(id,*args,&block)\n return @delegated_to_object.send(id,*args,&block) if delegated_instance_methods.include?(id)\n super\n end",
"def method_missing(id,*args,&block)\n return @delegated_to_object.send(id,*args,&block) if delegated_instance_methods.include?(id)\n ... | [
"0.69287395",
"0.69287395",
"0.66794086",
"0.6672783",
"0.6644133",
"0.63442737",
"0.62918466",
"0.6291121",
"0.62770814",
"0.62751615",
"0.6272288",
"0.62261117",
"0.6210139",
"0.6161094",
"0.61112356",
"0.6102798",
"0.6081947",
"0.6075515",
"0.6039568",
"0.5991256",
"0.5978... | 0.5954791 | 24 |
Returns the methods available to this delegate object as the union of this object's and \_\_getobj\_\_ methods. | def methods(all=true)
__getobj__.methods(all) | super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def methods(*args)\n (super + analyser.delegatable_methods).uniq\n end",
"def get_methods(obj)\n meths = obj.methods.grep(/impl/)\n meths.map { |m| m.to_s.gsub('impl_', '') + '!' }\n end",
"def methods\n delegated_instance_methods + old_methods\n end",
"def methods\n delegat... | [
"0.7059187",
"0.7040685",
"0.66267693",
"0.66267693",
"0.65377057",
"0.6520087",
"0.6518747",
"0.6495058",
"0.64634866",
"0.64220643",
"0.6420776",
"0.636928",
"0.6342296",
"0.6332147",
"0.632704",
"0.632704",
"0.6305928",
"0.6300953",
"0.6278314",
"0.6278314",
"0.6265427",
... | 0.69222164 | 2 |
Returns the methods available to this delegate object as the union of this object's and \_\_getobj\_\_ public methods. | def public_methods(all=true)
__getobj__.public_methods(all) | super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def methods(*args)\n (super + analyser.delegatable_methods).uniq\n end",
"def get_methods(obj)\n meths = obj.methods.grep(/impl/)\n meths.map { |m| m.to_s.gsub('impl_', '') + '!' }\n end",
"def methods(all=true)\n __getobj__.methods(all) | super\n end",
"def instance_methods\n all_met... | [
"0.70955867",
"0.70562243",
"0.6994965",
"0.6858828",
"0.6750117",
"0.6721873",
"0.66960615",
"0.66960615",
"0.6680052",
"0.66485333",
"0.66485333",
"0.66195923",
"0.6604359",
"0.65678203",
"0.6564032",
"0.65412253",
"0.6500255",
"0.64718395",
"0.64718395",
"0.6471127",
"0.64... | 0.7031669 | 2 |
Returns the methods available to this delegate object as the union of this object's and \_\_getobj\_\_ protected methods. | def protected_methods(all=true)
__getobj__.protected_methods(all) | super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def methods(*args)\n (super + analyser.delegatable_methods).uniq\n end",
"def get_methods(obj)\n meths = obj.methods.grep(/impl/)\n meths.map { |m| m.to_s.gsub('impl_', '') + '!' }\n end",
"def methods(all=true)\n __getobj__.methods(all) | super\n end",
"def methods\n delegated_inst... | [
"0.70963573",
"0.69421387",
"0.68471694",
"0.674324",
"0.674324",
"0.6717272",
"0.67044497",
"0.6669594",
"0.6625282",
"0.65466493",
"0.65227973",
"0.6502745",
"0.6488282",
"0.64786524",
"0.6475653",
"0.6475653",
"0.645414",
"0.6442546",
"0.6425104",
"0.64236337",
"0.6400212"... | 0.6453289 | 17 |
Note: no need to specialize private_methods, since they are not forwarded Returns true if two objects are considered of equal value. | def ==(obj)
return true if obj.equal?(self)
self.__getobj__ == obj
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def eql?(*) end",
"def equal?(other); end",
"def eql?(other)\n self.test_class == other.test_class &&\n self.method == other.method\n end",
"def eql?(other); end",
"def eql?(other); end",
"def eql?(other); end",
"def eql?(other); end",
"def eql?(other); end",
"def eql?(other); end",
"d... | [
"0.6924812",
"0.68971545",
"0.68627673",
"0.67502195",
"0.67502195",
"0.67502195",
"0.67502195",
"0.67502195",
"0.67502195",
"0.67502195",
"0.6682588",
"0.66632664",
"0.6655256",
"0.66551894",
"0.6654982",
"0.6647256",
"0.6647256",
"0.6637043",
"0.6631541",
"0.661634",
"0.661... | 0.64152163 | 58 |
Returns true if two objects are not considered of equal value. | def !=(obj)
return false if obj.equal?(self)
__getobj__ != obj
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def not_equal (other)\n (self == other).to_bool ? False : True\n end",
"def !=(other)\n !(self == other)\n end",
"def !=(other)\n !(self == other)\n end",
"def !=(other)\n !(self == other)\n end",
"def !=(other)\n value != other.value\n end",
"def != other\n ... | [
"0.81681585",
"0.7643259",
"0.7583171",
"0.7583171",
"0.7398343",
"0.7279373",
"0.7176695",
"0.71167606",
"0.7049725",
"0.68821716",
"0.6843004",
"0.68161476",
"0.6789329",
"0.67708737",
"0.673466",
"0.67198384",
"0.66980195",
"0.66843307",
"0.6668103",
"0.6660467",
"0.663071... | 0.75275964 | 4 |
Returns true if two objects are considered of equal value. | def eql?(obj)
return true if obj.equal?(self)
obj.eql?(__getobj__)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def eqv?(obj1, obj2)\n obj1 == obj2\n end",
"def equal?(other); end",
"def eql?(other)\n return false unless self.class.eql?(other.class)\n instance_variables.map do |var|\n instance_variable_get(var).eql?(other.instance_variable_get(var))\n end.all?\n end",
"def eql?(oth... | [
"0.7742546",
"0.7722221",
"0.7694772",
"0.7674041",
"0.7674041",
"0.76671445",
"0.7641253",
"0.7616296",
"0.7591557",
"0.7554855",
"0.7554855",
"0.75534314",
"0.75534314",
"0.75451636",
"0.75294995",
"0.75294995",
"0.75119346",
"0.7454895",
"0.74318975",
"0.74148095",
"0.7401... | 0.71594155 | 98 |
Delegates ! to the \_\_getobj\_\_ | def !
!__getobj__
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __getobj__; end",
"def __getobj__\n end",
"def __setobj__(obj); end",
"def __getobj__\n __raise__ ::NotImplementedError, \"need to define `__getobj__'\"\n end",
"def __setobj__(obj)\n __raise__ ::NotImplementedError, \"need to define `__setobj__'\"\n end",
"def __setobj__\n raise \"Obje... | [
"0.80436623",
"0.7876237",
"0.7587622",
"0.7539702",
"0.7093771",
"0.7046752",
"0.69531596",
"0.68349034",
"0.6764503",
"0.6723533",
"0.66832244",
"0.6673823",
"0.6673823",
"0.6673823",
"0.6673823",
"0.6673823",
"0.6673823",
"0.6673823",
"0.6673823",
"0.6673823",
"0.6673823",... | 0.73252434 | 4 |
This method must be overridden by subclasses and should return the object method calls are being delegated to. | def __getobj__
__raise__ ::NotImplementedError, "need to define `__getobj__'"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delegating_method; end",
"def method_missing(id,*args,&block)\n return @delegated_to_object.send(id,*args,&block) if delegated_instance_methods.include?(id)\n super\n end",
"def method_missing(id,*args,&block)\n return @delegated_to_object.send(id,*args,&block) if delegated_instan... | [
"0.69631666",
"0.651127",
"0.651127",
"0.6297923",
"0.62859744",
"0.6278284",
"0.62157154",
"0.62157154",
"0.62157154",
"0.62157154",
"0.6146854",
"0.61409765",
"0.61199",
"0.61199",
"0.6113847",
"0.6067836",
"0.6067836",
"0.59880036",
"0.58944726",
"0.5882229",
"0.5837966",
... | 0.0 | -1 |
This method must be overridden by subclasses and change the object delegate to _obj_. | def __setobj__(obj)
__raise__ ::NotImplementedError, "need to define `__setobj__'"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __setobj__(obj); end",
"def __setobj__\n raise \"ObjectProxy does not support changing referenced object\"\n end",
"def delegate_object; end",
"def obj\n self\n end",
"def delegate_object_reader_method; end",
"def __delegate\n @o\n end",
"def bound_object\n @obj\n end",
... | [
"0.7533008",
"0.73117346",
"0.69380903",
"0.66636944",
"0.6639173",
"0.6548661",
"0.65459245",
"0.6497895",
"0.64845353",
"0.6452932",
"0.64376855",
"0.64335835",
"0.6372162",
"0.6339434",
"0.6286674",
"0.6248881",
"0.6248881",
"0.6218475",
"0.6217073",
"0.6167673",
"0.614103... | 0.7037639 | 2 |
Serialization support for the object returned by \_\_getobj\_\_. | def marshal_dump
ivars = instance_variables.reject {|var| /\A@delegate_/ =~ var}
[
:__v2__,
ivars, ivars.map {|var| instance_variable_get(var)},
__getobj__
]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def serialize(object) end",
"def serialize(_object, data); end",
"def serialize(_object, data); end",
"def serialize(object, data); end",
"def serialize; end",
"def serialize; end",
"def serialize(object)\n return Rubyprot::Serializer.serialize(object)\n end",
"def encode(obj); end",
"def s... | [
"0.8326248",
"0.79471546",
"0.79471546",
"0.7900054",
"0.7310129",
"0.7310129",
"0.72310525",
"0.7112538",
"0.7048262",
"0.703352",
"0.7022918",
"0.701683",
"0.701683",
"0.6909082",
"0.68769294",
"0.6864365",
"0.6832805",
"0.6812252",
"0.6765987",
"0.67388546",
"0.67236495",
... | 0.6222197 | 53 |
Reinitializes delegation from a serialized object. | def marshal_load(data)
version, vars, values, obj = data
if version == :__v2__
vars.each_with_index {|var, i| instance_variable_set(var, values[i])}
__setobj__(obj)
else
__setobj__(data)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reinit\n @initializer.call(self)\n end",
"def unmarshal\n Marshal.restore self\n end",
"def deserialized\n @deserialized ||= @serializer.deserialize @serialized_object\n end",
"def fill_from_object(object)\n self\n end",
"def refresh\n @deserialized_values = {}\n ... | [
"0.5920734",
"0.5436932",
"0.53901434",
"0.534213",
"0.5324536",
"0.5254814",
"0.52503103",
"0.5216621",
"0.5185758",
"0.51472664",
"0.51298094",
"0.51268715",
"0.5121824",
"0.5104313",
"0.50794303",
"0.50611883",
"0.50175834",
"0.5016374",
"0.50144255",
"0.50084984",
"0.5006... | 0.0 | -1 |
:method: freeze Freeze both the object returned by \_\_getobj\_\_ and self. | def freeze
__getobj__.freeze
super()
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def freeze() end",
"def freeze() end",
"def freeze; end",
"def freeze\n super\n # Nothing to do here\n extend Freezer\n self\n end",
"def freeze\n end",
"def freeze\n end",
"def freeze\n self\n end",
"def freeze()\n gibbler_deb... | [
"0.76767063",
"0.76767063",
"0.7602477",
"0.73293835",
"0.72874755",
"0.72874755",
"0.7268601",
"0.7254834",
"0.69649655",
"0.6833806",
"0.6826303",
"0.6769433",
"0.67578703",
"0.6611694",
"0.65831023",
"0.6456794",
"0.6390653",
"0.6362404",
"0.628714",
"0.6228153",
"0.622120... | 0.8052398 | 0 |
The primary interface to this library. Use to setup delegation when defining your class. class MyClass < DelegateClass(ClassToDelegateTo) Step 1 def initialize super(obj_of_ClassToDelegateTo) Step 2 end end or: MyClass = DelegateClass(ClassToDelegateTo) do Step 1 def initialize super(obj_of_ClassToDelegateTo) Step 2 en... | def DelegateClass(superclass, &block)
klass = Class.new(Delegator)
ignores = [*::Delegator.public_api, :to_s, :inspect, :=~, :!~, :===]
protected_instance_methods = superclass.protected_instance_methods
protected_instance_methods -= ignores
public_instance_methods = superclass.public_instance_methods
public... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(filename, type, tempfile, options)\n @filename = File.basename(filename)\n @type = type\n @tempfile = tempfile\n @realfile = nil\n\n trait :options => options\n end",
"def delegate_object; end",
"def initialize(delegate = nil)\n @deleg... | [
"0.5589953",
"0.5576477",
"0.54157835",
"0.540364",
"0.5337469",
"0.52809185",
"0.5207659",
"0.52002424",
"0.5118014",
"0.5114425",
"0.51132613",
"0.51132613",
"0.5094147",
"0.50674415",
"0.5061786",
"0.50475675",
"0.5045773",
"0.5039793",
"0.50142306",
"0.4998687",
"0.499405... | 0.50134754 | 19 |
Returns the name of the current directory. | def pwd
Dir.pwd
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name\n @name ||= File.basename(Dir.pwd)\n end",
"def directory_name\n return @directory_name.to_s if @directory_name\n return local_path.basename.to_s if exist?\n return name\n end",
"def current_directory\n File.expand_path @current_directory\n end",
"def current_dir; end",... | [
"0.77607954",
"0.7647766",
"0.74483293",
"0.71949327",
"0.70288384",
"0.69919336",
"0.6921006",
"0.691716",
"0.6902666",
"0.6832583",
"0.6832335",
"0.6822989",
"0.67899853",
"0.6778626",
"0.67072254",
"0.6677544",
"0.66756815",
"0.66723686",
"0.6630023",
"0.6619802",
"0.64740... | 0.60660356 | 48 |
Changes the current directory to the directory +dir+. If this method is called with block, resumes to the previous working directory after the block execution has finished. FileUtils.cd('/') change directory FileUtils.cd('/', verbose: true) change directory and report it FileUtils.cd('/') do change directory ... do som... | def cd(dir, verbose: nil, &block) # :yield: dir
fu_output_message "cd #{dir}" if verbose
result = Dir.chdir(dir, &block)
fu_output_message 'cd -' if verbose and block
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cd(dir, options = {}, &block) # :yield: dir\r\n fu_check_options options, :noop, :verbose\r\n fu_output_message \"cd #{dir}\" if options[:verbose]\r\n Dir.chdir(dir, &block) unless options[:noop]\r\n fu_output_message 'cd -' if options[:verbose] and block\r\n end",
"def cd(dir, options = {}, &bl... | [
"0.8003986",
"0.79927015",
"0.79927015",
"0.795306",
"0.7891408",
"0.76757807",
"0.7607715",
"0.75752145",
"0.7476348",
"0.740656",
"0.739413",
"0.73323184",
"0.7219562",
"0.72011185",
"0.7194682",
"0.71538866",
"0.70894134",
"0.7084497",
"0.7015647",
"0.7006366",
"0.68572843... | 0.80796033 | 0 |
Returns true if +new+ is newer than all +old_list+. Nonexistent files are older than any file. FileUtils.uptodate?('hello.o', %w(hello.c hello.h)) or \ system 'make hello.o' | def uptodate?(new, old_list)
return false unless File.exist?(new)
new_time = File.mtime(new)
old_list.each do |old|
if File.exist?(old)
return false unless new_time > File.mtime(old)
end
end
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def uptodate?(new, old_list, options = nil)\r\n raise ArgumentError, 'uptodate? does not accept any option' if options\r\n\r\n return false unless File.exist?(new)\r\n new_time = File.mtime(new)\r\n old_list.each do |old|\r\n if File.exist?(old)\r\n return false unless new_time > File.mtime... | [
"0.808094",
"0.808094",
"0.808094",
"0.6466318",
"0.62577057",
"0.6118674",
"0.57880586",
"0.573095",
"0.57272595",
"0.57229406",
"0.5687765",
"0.56631374",
"0.5640152",
"0.5618904",
"0.5603312",
"0.55947816",
"0.5565408",
"0.55630445",
"0.55549586",
"0.55190015",
"0.5516273"... | 0.8066776 | 3 |
Creates one or more directories. FileUtils.mkdir 'test' FileUtils.mkdir %w(tmp data) FileUtils.mkdir 'notexist', noop: true Does not really create. FileUtils.mkdir 'tmp', mode: 0700 | def mkdir(list, mode: nil, noop: nil, verbose: nil)
list = fu_list(list)
fu_output_message "mkdir #{mode ? ('-m %03o ' % mode) : ''}#{list.join ' '}" if verbose
return if noop
list.each do |dir|
fu_mkdir dir, mode
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_directories(path)\n FileUtils.mkdir_p(path) unless Dir.exists?(path)\nend",
"def create_dir(dir)\n unless File.directory?(dir)\n FileUtils.mkdir_p(dir)\n end\nend",
"def make_dirs\r\n FileUtils.rm_rf @dirs[:tmp]\r\n @dirs.each do |k, dir|\r\n FileUtils.mkdir_p dir\r\n end... | [
"0.7863382",
"0.7821042",
"0.7770501",
"0.77060604",
"0.767651",
"0.7675259",
"0.76536345",
"0.7628736",
"0.7616274",
"0.7613314",
"0.7608489",
"0.7567976",
"0.75497866",
"0.7521419",
"0.7493713",
"0.74696654",
"0.7458551",
"0.74398535",
"0.7437293",
"0.7435992",
"0.74170023"... | 0.7307423 | 29 |
Creates a directory and all its parent directories. For example, FileUtils.mkdir_p '/usr/local/lib/ruby' causes to make following directories, if they do not exist. /usr /usr/local /usr/local/lib /usr/local/lib/ruby You can pass several directories at a time in a list. | def mkdir_p(list, mode: nil, noop: nil, verbose: nil)
list = fu_list(list)
fu_output_message "mkdir -p #{mode ? ('-m %03o ' % mode) : ''}#{list.join ' '}" if verbose
return *list if noop
list.each do |item|
path = remove_trailing_slash(item)
stack = []
until File.directory?(path)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_directories(*args)\n args.each do |argument|\n FileUtils.mkdir_p(argument) unless File.directory?(argument)\n end\n end",
"def create_directories\n directory '.', './'\n end",
"def make_dirs(*args)\n FileUtils.mkdir_p(args)\nend",
"def mkdirs\n if (not exists?)\n ... | [
"0.795459",
"0.76991093",
"0.767883",
"0.7519533",
"0.7475287",
"0.7475287",
"0.7402178",
"0.7387781",
"0.7294104",
"0.7285115",
"0.7281044",
"0.7249271",
"0.7241928",
"0.72268987",
"0.721256",
"0.71922916",
"0.7158279",
"0.7153753",
"0.7147643",
"0.7136804",
"0.70982957",
... | 0.7095217 | 21 |
Removes one or more directories. FileUtils.rmdir 'somedir' FileUtils.rmdir %w(somedir anydir otherdir) Does not really remove directory; outputs message. FileUtils.rmdir 'somedir', verbose: true, noop: true | def rmdir(list, parents: nil, noop: nil, verbose: nil)
list = fu_list(list)
fu_output_message "rmdir #{parents ? '-p ' : ''}#{list.join ' '}" if verbose
return if noop
list.each do |dir|
Dir.rmdir(dir = remove_trailing_slash(dir))
if parents
begin
until (parent = File.dirna... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cmd_rmdir(*args)\n\t\tif (args.length == 0 or args.include?(\"-h\"))\n\t\t\tprint_line(\"Usage: rmdir dir1 dir2 dir3 ...\")\n\t\t\treturn true\n\t\tend\n\n\t\targs.each { |dir|\n\t\t\tprint_line(\"Removing directory: #{dir}\")\n\t\t\tclient.fs.dir.rmdir(dir)\n\t\t}\n\n\t\treturn true\n\tend",
"def rmdir(list... | [
"0.76279634",
"0.7185048",
"0.71827686",
"0.7061081",
"0.70436287",
"0.70436287",
"0.70166576",
"0.68349314",
"0.6826116",
"0.6812068",
"0.6785248",
"0.6784172",
"0.67176956",
"0.66716105",
"0.6592602",
"0.6577804",
"0.6567404",
"0.65273476",
"0.65065503",
"0.64917946",
"0.64... | 0.7276418 | 1 |
:callseq: FileUtils.ln(target, link, force: nil, noop: nil, verbose: nil) FileUtils.ln(target, dir, force: nil, noop: nil, verbose: nil) FileUtils.ln(targets, dir, force: nil, noop: nil, verbose: nil) In the first form, creates a hard link +link+ which points to +target+. If +link+ already exists, raises Errno::EEXIST.... | def ln(src, dest, force: nil, noop: nil, verbose: nil)
fu_output_message "ln#{force ? ' -f' : ''} #{[src,dest].flatten.join ' '}" if verbose
return if noop
fu_each_src_dest0(src, dest) do |s,d|
remove_file d, true if force
File.link s, d
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_link(source:, link:)\n @output.item @i18n.t('setup.ln', target: link, source: source)\n FileUtils::rm link if (File::symlink? link and not File::exist? link)\n FileUtils::ln_s source, link unless File::exist? link\n end",
"def link *args\n self.destination_and_options( a... | [
"0.7243521",
"0.72159195",
"0.71313936",
"0.71161336",
"0.6797291",
"0.67860055",
"0.6772644",
"0.6720828",
"0.6682216",
"0.66660273",
"0.6660697",
"0.66466767",
"0.657442",
"0.65194386",
"0.644933",
"0.64183307",
"0.6378898",
"0.6368799",
"0.6338944",
"0.63261396",
"0.628735... | 0.73739475 | 0 |
Hard link +src+ to +dest+. If +src+ is a directory, this method links all its contents recursively. If +dest+ is a directory, links +src+ to +dest/src+. +src+ can be a list of files. If +dereference_root+ is true, this method dereference tree root. If +remove_destination+ is true, this method removes each destination f... | def cp_lr(src, dest, noop: nil, verbose: nil,
dereference_root: true, remove_destination: false)
fu_output_message "cp -lr#{remove_destination ? ' --remove-destination' : ''} #{[src,dest].flatten.join ' '}" if verbose
return if noop
fu_each_src_dest(src, dest) do |s, d|
link_entry s, d, de... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def linkDirContents(rootDir, targetDir)\n\trootDir = Pathname.new(rootDir)\n\ttargetDir = Pathname.new(targetDir)\n\n\t# Recurisvely visit all files in the rootDir\n\tFind.find(rootDir.to_s) { |srcFullPath|\n\t\tsrcFullPath = Pathname.new(srcFullPath)\n\t\trelativePath = srcFullPath.relative_path_from(rootDir)\n\n... | [
"0.6052925",
"0.60488117",
"0.60488117",
"0.6046255",
"0.59957576",
"0.5894285",
"0.5825038",
"0.56814444",
"0.56779",
"0.5589565",
"0.55734473",
"0.5541477",
"0.5513549",
"0.5461204",
"0.5259027",
"0.5202056",
"0.5174585",
"0.51517767",
"0.51489073",
"0.5127619",
"0.5104871"... | 0.7156706 | 0 |
:callseq: FileUtils.ln_s(target, link, force: nil, noop: nil, verbose: nil) FileUtils.ln_s(target, dir, force: nil, noop: nil, verbose: nil) FileUtils.ln_s(targets, dir, force: nil, noop: nil, verbose: nil) In the first form, creates a symbolic link +link+ which points to +target+. If +link+ already exists, raises Errn... | def ln_s(src, dest, force: nil, noop: nil, verbose: nil)
fu_output_message "ln -s#{force ? 'f' : ''} #{[src,dest].flatten.join ' '}" if verbose
return if noop
fu_each_src_dest0(src, dest) do |s,d|
remove_file d, true if force
File.symlink s, d
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ln(src, dest, force: nil, noop: nil, verbose: nil)\n fu_output_message \"ln#{force ? ' -f' : ''} #{[src,dest].flatten.join ' '}\" if verbose\n return if noop\n fu_each_src_dest0(src, dest) do |s,d|\n remove_file d, true if force\n File.link s, d\n end\n end",
"def set_symlink(source,ta... | [
"0.70595545",
"0.684437",
"0.6763673",
"0.67422074",
"0.6664837",
"0.6662667",
"0.6662044",
"0.6626355",
"0.6547859",
"0.6504164",
"0.6440238",
"0.6354994",
"0.63079715",
"0.6271029",
"0.6239858",
"0.621333",
"0.62104404",
"0.6187648",
"0.6059236",
"0.60525686",
"0.6049554",
... | 0.7648672 | 0 |
:callseq: FileUtils.ln_sf(args) Same as FileUtils.ln_s(args, force: true) | def ln_sf(src, dest, noop: nil, verbose: nil)
ln_s src, dest, force: true, noop: noop, verbose: verbose
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ln_sf(src, dest, options = {})\r\n fu_check_options options, OPT_TABLE['ln_sf']\r\n options = options.dup\r\n options[:force] = true\r\n ln_s src, dest, options\r\n end",
"def ln_sf(src, dest, options = {})\r\n fu_check_options options, OPT_TABLE['ln_sf']\r\n options = options.dup\r\n o... | [
"0.7453833",
"0.7453833",
"0.73097754",
"0.67789215",
"0.584714",
"0.5652206",
"0.55690503",
"0.5554673",
"0.55339986",
"0.53657967",
"0.49550402",
"0.48742595",
"0.4853093",
"0.4830181",
"0.48278672",
"0.4775206",
"0.47691333",
"0.4766213",
"0.47527936",
"0.47500214",
"0.464... | 0.7102508 | 3 |
Hard links a file system entry +src+ to +dest+. If +src+ is a directory, this method links its contents recursively. Both of +src+ and +dest+ must be a path name. +src+ must exist, +dest+ must not exist. If +dereference_root+ is true, this method dereferences the tree root. If +remove_destination+ is true, this method ... | def link_entry(src, dest, dereference_root = false, remove_destination = false)
Entry_.new(src, nil, dereference_root).traverse do |ent|
destent = Entry_.new(dest, ent.rel, false)
File.unlink destent.path if remove_destination && File.file?(destent.path)
ent.link destent.path
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copy_entry(src, dest, preserve = false, dereference_root = false, remove_destination = false)\n if dereference_root\n src = File.realpath(src)\n end\n\n Entry_.new(src, nil, false).wrap_traverse(proc do |ent|\n destent = Entry_.new(dest, ent.rel, false)\n File.unlink destent.path if rem... | [
"0.6785239",
"0.649618",
"0.649618",
"0.596438",
"0.59030974",
"0.5742362",
"0.57168317",
"0.5582333",
"0.55597883",
"0.55597883",
"0.5557065",
"0.5508318",
"0.54497063",
"0.5418164",
"0.54168046",
"0.53868806",
"0.53868806",
"0.53562284",
"0.53517",
"0.5345459",
"0.533156",
... | 0.75056916 | 0 |
Copies a file content +src+ to +dest+. If +dest+ is a directory, copies +src+ to +dest/src+. If +src+ is a list of files, then +dest+ must be a directory. FileUtils.cp 'eval.c', 'eval.c.org' FileUtils.cp %w(cgi.rb complex.rb date.rb), '/usr/lib/ruby/1.6' FileUtils.cp %w(cgi.rb complex.rb date.rb), '/usr/lib/ruby/1.6', ... | def cp(src, dest, preserve: nil, noop: nil, verbose: nil)
fu_output_message "cp#{preserve ? ' -p' : ''} #{[src,dest].flatten.join ' '}" if verbose
return if noop
fu_each_src_dest(src, dest) do |s, d|
copy_file s, d, preserve
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cp(src, dest, options = {})\r\n fu_check_options options, OPT_TABLE['cp']\r\n fu_output_message \"cp#{options[:preserve] ? ' -p' : ''} #{[src,dest].flatten.join ' '}\" if options[:verbose]\r\n return if options[:noop]\r\n fu_each_src_dest(src, dest) do |s, d|\r\n copy_file s, d, options[:prese... | [
"0.78570104",
"0.78570104",
"0.77396494",
"0.7618019",
"0.76053643",
"0.7575804",
"0.72366524",
"0.7180375",
"0.7180375",
"0.7052006",
"0.7028417",
"0.701213",
"0.7002792",
"0.6939288",
"0.69035035",
"0.6889299",
"0.68881905",
"0.6796203",
"0.6796203",
"0.6789588",
"0.6723414... | 0.7625016 | 3 |
Copies +src+ to +dest+. If +src+ is a directory, this method copies all its contents recursively. If +dest+ is a directory, copies +src+ to +dest/src+. +src+ can be a list of files. If +dereference_root+ is true, this method dereference tree root. If +remove_destination+ is true, this method removes each destination fi... | def cp_r(src, dest, preserve: nil, noop: nil, verbose: nil,
dereference_root: true, remove_destination: nil)
fu_output_message "cp -r#{preserve ? 'p' : ''}#{remove_destination ? ' --remove-destination' : ''} #{[src,dest].flatten.join ' '}" if verbose
return if noop
fu_each_src_dest(src, dest) do ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cp_r(src, dest, options = {})\r\n fu_check_options options, OPT_TABLE['cp_r']\r\n fu_output_message \"cp -r#{options[:preserve] ? 'p' : ''}#{options[:remove_destination] ? ' --remove-destination' : ''} #{[src,dest].flatten.join ' '}\" if options[:verbose]\r\n return if options[:noop]\r\n options[:d... | [
"0.7553337",
"0.7553337",
"0.7292618",
"0.66144365",
"0.64420384",
"0.6347462",
"0.6313262",
"0.6112061",
"0.60390806",
"0.60390806",
"0.5878575",
"0.5713348",
"0.5680591",
"0.56483376",
"0.56041443",
"0.56040215",
"0.55826336",
"0.55825114",
"0.55739987",
"0.55739987",
"0.55... | 0.75752527 | 0 |
Copies a file system entry +src+ to +dest+. If +src+ is a directory, this method copies its contents recursively. This method preserves file types, c.f. symlink, directory... (FIFO, device files and etc. are not supported yet) Both of +src+ and +dest+ must be a path name. +src+ must exist, +dest+ must not exist. If +pr... | def copy_entry(src, dest, preserve = false, dereference_root = false, remove_destination = false)
if dereference_root
src = File.realpath(src)
end
Entry_.new(src, nil, false).wrap_traverse(proc do |ent|
destent = Entry_.new(dest, ent.rel, false)
File.unlink destent.path if remove_destinat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copy_entry(src, dest, preserve = false, dereference_root = false, remove_destination = false)\r\n Entry_.new(src, nil, dereference_root).traverse do |ent|\r\n destent = Entry_.new(dest, ent.rel, false)\r\n File.unlink destent.path if remove_destination && File.file?(destent.path)\r\n ent.copy... | [
"0.7068187",
"0.7068187",
"0.70314705",
"0.67178154",
"0.6712726",
"0.6712726",
"0.6683534",
"0.6683534",
"0.6515312",
"0.6363639",
"0.6305126",
"0.60732645",
"0.59483457",
"0.589216",
"0.5882599",
"0.5882599",
"0.5786595",
"0.5777892",
"0.56492126",
"0.56187314",
"0.5603945"... | 0.7347873 | 0 |
Copies file contents of +src+ to +dest+. Both of +src+ and +dest+ must be a path name. | def copy_file(src, dest, preserve = false, dereference = true)
ent = Entry_.new(src, nil, dereference)
ent.copy_file dest
ent.copy_metadata dest if preserve
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copy_file(src, dest)\r\n File.open(src, 'rb') {|r|\r\n File.open(dest, 'wb') {|w|\r\n copy_stream r, w\r\n }\r\n }\r\n end",
"def cp(src, dest)\n unless dest.dirname.exist?\n LOG.info \"MKDIR: #{dest.dirname}\"\n FileUtils.mkdir_p(dest.dirname)\n end\n\n ... | [
"0.78902036",
"0.7651033",
"0.7485401",
"0.7320665",
"0.7320665",
"0.72297823",
"0.72297823",
"0.7174234",
"0.712844",
"0.711695",
"0.70936334",
"0.7053658",
"0.7036133",
"0.7005349",
"0.6940884",
"0.6940884",
"0.68245375",
"0.6788109",
"0.67720896",
"0.67628205",
"0.67211133... | 0.68415874 | 16 |
Copies stream +src+ to +dest+. +src+ must respond to read(n) and +dest+ must respond to write(str). | def copy_stream(src, dest)
IO.copy_stream(src, dest)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copy_stream(src, dest)\r\n bsize = fu_stream_blksize(src, dest)\r\n begin\r\n while true\r\n dest.syswrite src.sysread(bsize)\r\n end\r\n rescue EOFError\r\n end\r\n end",
"def copy_stream(src, dest)\r\n fu_copy_stream0 src, dest, fu_stream_blksize(src, dest)\r\n end",
"de... | [
"0.79221445",
"0.7188555",
"0.7188555",
"0.716174",
"0.683199",
"0.65945315",
"0.64951473",
"0.64951473",
"0.6444153",
"0.6397046",
"0.63592947",
"0.634399",
"0.626254",
"0.626254",
"0.626254",
"0.62427014",
"0.61984974",
"0.6107655",
"0.6105383",
"0.6090704",
"0.6083809",
... | 0.7706105 | 1 |
Moves file(s) +src+ to +dest+. If +file+ and +dest+ exist on the different disk partition, the file is copied then the original file is removed. FileUtils.mv 'badname.rb', 'goodname.rb' FileUtils.mv 'stuff.rb', '/notexist/lib/ruby', force: true no error FileUtils.mv %w(junk.txt dust.txt), '/home/foo/.trash/' FileUtils.... | def mv(src, dest, force: nil, noop: nil, verbose: nil, secure: nil)
fu_output_message "mv#{force ? ' -f' : ''} #{[src,dest].flatten.join ' '}" if verbose
return if noop
fu_each_src_dest(src, dest) do |s, d|
destent = Entry_.new(d, nil, true)
begin
if destent.exist?
if destent.d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mv(src, dest, options = {})\r\n fu_check_options options, :noop, :verbose\r\n fu_output_message \"mv #{[src,dest].flatten.join ' '}\" if options[:verbose]\r\n return if options[:noop]\r\n\r\n fu_each_src_dest(src, dest) do |s,d|\r\n if rename_cannot_overwrite_file? and File.file?(d)\r\n ... | [
"0.8018197",
"0.78269625",
"0.77844846",
"0.77844846",
"0.73614985",
"0.7343652",
"0.7231475",
"0.7093581",
"0.7038839",
"0.6877487",
"0.6785131",
"0.6756329",
"0.6742871",
"0.66861117",
"0.6675952",
"0.6611892",
"0.6506983",
"0.6493018",
"0.6476846",
"0.64735836",
"0.6432567... | 0.7799455 | 2 |
Equivalent to FileUtils.rm(list, force: true) | def rm_f(list, noop: nil, verbose: nil)
rm list, force: true, noop: noop, verbose: verbose
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rm(list, options = {})\r\n fu_check_options options, :force, :noop, :verbose\r\n list = fu_list(list)\r\n fu_output_message \"rm#{options[:force] ? ' -f' : ''} #{list.join ' '}\" if options[:verbose]\r\n return if options[:noop]\r\n\r\n list.each do |fname|\r\n remove_file fname, options[:f... | [
"0.9033218",
"0.85358804",
"0.8185072",
"0.8144432",
"0.8144432",
"0.7969099",
"0.7936622",
"0.7923993",
"0.79016215",
"0.76539314",
"0.7569293",
"0.7569293",
"0.7213883",
"0.7137647",
"0.7096884",
"0.7075024",
"0.7075024",
"0.65629375",
"0.6548002",
"0.6548002",
"0.65178686"... | 0.8544437 | 1 |
Equivalent to FileUtils.rm_r(list, force: true) WARNING: This method causes local vulnerability. Read the documentation of rm_r first. | def rm_rf(list, noop: nil, verbose: nil, secure: nil)
rm_r list, force: true, noop: noop, verbose: verbose, secure: secure
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rm_r(options={})\n #list = list.to_a\n fileutils.rm_r(list, options)\n end",
"def rm(list, options = {})\r\n fu_check_options options, :force, :noop, :verbose\r\n list = fu_list(list)\r\n fu_output_message \"rm#{options[:force] ? ' -f' : ''} #{list.join ' '}\" if options[:verbose]\r\n ... | [
"0.8716333",
"0.8193146",
"0.79547364",
"0.79547364",
"0.7910081",
"0.7831515",
"0.7821863",
"0.7811131",
"0.7787907",
"0.7787907",
"0.77711904",
"0.7688563",
"0.6843022",
"0.6801203",
"0.6767912",
"0.66894436",
"0.66894436",
"0.65607136",
"0.63801366",
"0.6370874",
"0.633230... | 0.78758454 | 5 |
This method removes a file system entry +path+. +path+ shall be a regular file, a directory, or something. If +path+ is a directory, remove it recursively. This method is required to avoid TOCTTOU (timeofchecktotimeofuse) local security vulnerability of rm_r. rm_r causes security hole when: Parent directory is world wr... | def remove_entry_secure(path, force = false)
unless fu_have_symlink?
remove_entry path, force
return
end
fullpath = File.expand_path(path)
st = File.lstat(fullpath)
unless st.directory?
File.unlink fullpath
return
end
# is a directory.
parent_st = File.stat(File.d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rm(path)\n remove(path, nil, true, false)\n end",
"def remove_directory(path)\n FileUtils.rm_rf(path)\n end",
"def remove_directory(path)\n FileUtils.rm_rf(path)\n end",
"def remove_dir(path)\n FileUtils.remove_dir(path) if File.directory?(path)\n end",
"def unlink(path)... | [
"0.741108",
"0.72239625",
"0.72239625",
"0.7201917",
"0.71926713",
"0.7141704",
"0.71040463",
"0.70668286",
"0.6995548",
"0.6944202",
"0.69114757",
"0.6898605",
"0.68958336",
"0.68627304",
"0.6855217",
"0.68532324",
"0.68381786",
"0.68250275",
"0.6819792",
"0.6819792",
"0.681... | 0.65469235 | 31 |
This method removes a file system entry +path+. +path+ might be a regular file, a directory, or something. If +path+ is a directory, remove it recursively. See also remove_entry_secure. | def remove_entry(path, force = false)
Entry_.new(path).postorder_traverse do |ent|
begin
ent.remove
rescue
raise unless force
end
end
rescue
raise unless force
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_entry(path)\n aug.rm(path_to_remove(path))\n end",
"def rm(path)\n remove(path, nil, true, false)\n end",
"def delete_if_exists(path)\n FileUtils.remove_entry_secure(path) if test(?e, path)\n end",
"def delete(path)\n path = self.class.path(path).to_s\n zip.fo... | [
"0.83132076",
"0.7272159",
"0.71477085",
"0.7114503",
"0.7100716",
"0.70762587",
"0.70762587",
"0.7062099",
"0.7048968",
"0.70407283",
"0.69674814",
"0.6923221",
"0.69177943",
"0.68435544",
"0.6808513",
"0.6808513",
"0.6689201",
"0.6651218",
"0.6628279",
"0.66074044",
"0.6607... | 0.7174155 | 2 |
Returns true if the contents of a file +a+ and a file +b+ are identical. FileUtils.compare_file('somefile', 'somefile') => true FileUtils.compare_file('/dev/null', '/dev/urandom') => false | def compare_file(a, b)
return false unless File.size(a) == File.size(b)
File.open(a, 'rb') {|fa|
File.open(b, 'rb') {|fb|
return compare_stream(fa, fb)
}
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compare_file(a, b)\r\n return false unless File.size(a) == File.size(b)\r\n File.open(a, 'rb') {|fa|\r\n File.open(b, 'rb') {|fb|\r\n return compare_stream(fa, fb)\r\n }\r\n }\r\n end",
"def files_are_same(file1, file2)\n begin\n File.open(file1, 'rb').read == File.open(file1, ... | [
"0.7888124",
"0.7707008",
"0.76067686",
"0.7601422",
"0.7435676",
"0.7327886",
"0.7327886",
"0.73142624",
"0.73112035",
"0.6946527",
"0.67411715",
"0.66744",
"0.659717",
"0.64615726",
"0.62929314",
"0.61660224",
"0.61511624",
"0.6097391",
"0.6074182",
"0.60722893",
"0.6072194... | 0.7935149 | 0 |
Returns true if the contents of a stream +a+ and +b+ are identical. | def compare_stream(a, b)
bsize = fu_stream_blksize(a, b)
sa = String.new(capacity: bsize)
sb = String.new(capacity: bsize)
begin
a.read(bsize, sa)
b.read(bsize, sb)
return true if sa.empty? && sb.empty?
end while sa == sb
false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compare_stream(a, b)\r\n bsize = fu_stream_blksize(a, b)\r\n sa = sb = nil\r\n while sa == sb\r\n sa = a.read(bsize)\r\n sb = b.read(bsize)\r\n unless sa and sb\r\n if sa.nil? and sb.nil?\r\n return true\r\n end\r\n end\r\n end\r\n false\r\n end",
"d... | [
"0.81010425",
"0.76146495",
"0.730915",
"0.67437553",
"0.6734809",
"0.65990406",
"0.6588006",
"0.6519945",
"0.6504485",
"0.63744754",
"0.6370818",
"0.62703127",
"0.625508",
"0.61913073",
"0.6174936",
"0.6174936",
"0.6166456",
"0.616373",
"0.61467296",
"0.6136367",
"0.6078493"... | 0.81547546 | 0 |
If +src+ is not same as +dest+, copies it and changes the permission mode to +mode+. If +dest+ is a directory, destination is +dest+/+src+. This method removes destination before copy. FileUtils.install 'ruby', '/usr/local/bin/ruby', mode: 0755, verbose: true FileUtils.install 'lib.rb', '/usr/local/lib/ruby/site_ruby',... | def install(src, dest, mode: nil, owner: nil, group: nil, preserve: nil,
noop: nil, verbose: nil)
if verbose
msg = +"install -c"
msg << ' -p' if preserve
msg << ' -m ' << mode_to_s(mode) if mode
msg << " -o #{owner}" if owner
msg << " -g #{group}" if group
msg << ' ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def install(src, dest, options = {})\r\n fu_check_options options, :mode, :preserve, :noop, :verbose\r\n fu_output_message \"install -c#{options[:preserve] && ' -p'}#{options[:mode] ? (' -m 0%o' % options[:mode]) : ''} #{[src,dest].flatten.join ' '}\" if options[:verbose]\r\n return if options[:noop]\r\n\... | [
"0.7821142",
"0.6856485",
"0.66597277",
"0.66200227",
"0.6502342",
"0.6478375",
"0.64441603",
"0.6435453",
"0.6435453",
"0.62516624",
"0.6249403",
"0.6225188",
"0.6222611",
"0.6219546",
"0.6216337",
"0.6179176",
"0.61377084",
"0.61377084",
"0.6077407",
"0.6043999",
"0.604209"... | 0.77742773 | 1 |
Changes permission bits on the named files (in +list+) to the bit pattern represented by +mode+. +mode+ is the symbolic and absolute mode can be used. Absolute mode is FileUtils.chmod 0755, 'somecommand' FileUtils.chmod 0644, %w(my.rb your.rb his.rb her.rb) FileUtils.chmod 0755, '/usr/bin/ruby', verbose: true Symbolic ... | def chmod(mode, list, noop: nil, verbose: nil)
list = fu_list(list)
fu_output_message sprintf('chmod %s %s', mode_to_s(mode), list.join(' ')) if verbose
return if noop
list.each do |path|
Entry_.new(path).chmod(fu_mode(mode, path))
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def chmod(mode, list, options = {})\r\n fu_check_options options, :noop, :verbose\r\n list = fu_list(list)\r\n fu_output_message sprintf('chmod %o %s', mode, list.join(' ')) if options[:verbose]\r\n return if options[:noop]\r\n File.chmod mode, *list\r\n end",
"def chmod(mode, options={})\n ... | [
"0.8403517",
"0.81451774",
"0.7651707",
"0.7624761",
"0.6651652",
"0.6590466",
"0.6586283",
"0.6564689",
"0.65489084",
"0.6531294",
"0.64855504",
"0.6458026",
"0.6431104",
"0.6361673",
"0.6336934",
"0.6326488",
"0.62598467",
"0.623524",
"0.62103766",
"0.6207418",
"0.61852235"... | 0.81905293 | 1 |
Changes owner and group on the named files (in +list+) to the user +user+ and the group +group+. +user+ and +group+ may be an ID (Integer/String) or a name (String). If +user+ or +group+ is nil, this method does not change the attribute. FileUtils.chown 'root', 'staff', '/usr/local/bin/ruby' FileUtils.chown nil, 'bin',... | def chown(user, group, list, noop: nil, verbose: nil)
list = fu_list(list)
fu_output_message sprintf('chown %s %s',
(group ? "#{user}:#{group}" : user || ':'),
list.join(' ')) if verbose
return if noop
uid = fu_get_uid(user)
gid = fu_get_gi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def chown(user, group, options={})\n #list = list.to_a\n fileutils.chown(user, group, list, options)\n end",
"def chown_R(user, group, list, noop: nil, verbose: nil, force: nil)\n list = fu_list(list)\n fu_output_message sprintf('chown -R%s %s %s',\n (force ? 'f' :... | [
"0.79419094",
"0.73927534",
"0.73829263",
"0.7249544",
"0.6717012",
"0.66707695",
"0.6583502",
"0.6489345",
"0.6393175",
"0.6385596",
"0.63290304",
"0.6209054",
"0.61859643",
"0.61287",
"0.61087126",
"0.6072341",
"0.60073733",
"0.59461147",
"0.5916975",
"0.589548",
"0.5816441... | 0.8025061 | 0 |
Changes owner and group on the named files (in +list+) to the user +user+ and the group +group+ recursively. +user+ and +group+ may be an ID (Integer/String) or a name (String). If +user+ or +group+ is nil, this method does not change the attribute. FileUtils.chown_R 'www', 'www', '/var/www/htdocs' FileUtils.chown_R 'c... | def chown_R(user, group, list, noop: nil, verbose: nil, force: nil)
list = fu_list(list)
fu_output_message sprintf('chown -R%s %s %s',
(force ? 'f' : ''),
(group ? "#{user}:#{group}" : user || ':'),
list.join(' ')) if verb... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def chown(user, group, options={})\n #list = list.to_a\n fileutils.chown(user, group, list, options)\n end",
"def chown(user, group, list, noop: nil, verbose: nil)\n list = fu_list(list)\n fu_output_message sprintf('chown %s %s',\n (group ? \"#{user}:#{group}\" : u... | [
"0.80331093",
"0.80113167",
"0.7893976",
"0.72609985",
"0.68571997",
"0.671772",
"0.6692561",
"0.6556192",
"0.64570326",
"0.64464724",
"0.6362654",
"0.63381344",
"0.62912256",
"0.6270708",
"0.6157512",
"0.61543727",
"0.61375827",
"0.6133483",
"0.5996318",
"0.57662845",
"0.564... | 0.7992318 | 2 |
Updates modification time (mtime) and access time (atime) of file(s) in +list+. Files are created if they don't exist. FileUtils.touch 'timestamp' FileUtils.touch Dir.glob('.c'); system 'make' | def touch(list, noop: nil, verbose: nil, mtime: nil, nocreate: nil)
list = fu_list(list)
t = mtime
if verbose
fu_output_message "touch #{nocreate ? '-c ' : ''}#{t ? t.strftime('-t %Y%m%d%H%M.%S ') : ''}#{list.join ' '}"
end
return if noop
list.each do |path|
created = nocreate
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def touch(list, options = {})\r\n fu_check_options options, :noop, :verbose\r\n list = fu_list(list)\r\n fu_output_message \"touch #{list.join ' '}\" if options[:verbose]\r\n return if options[:noop]\r\n\r\n t = Time.now\r\n list.each do |fname|\r\n begin\r\n File.utime(t, t, fname)\r... | [
"0.7769767",
"0.7014473",
"0.6225174",
"0.6156702",
"0.59982514",
"0.57934046",
"0.5644305",
"0.5612305",
"0.55710405",
"0.55710405",
"0.5564488",
"0.55564535",
"0.5519941",
"0.55169976",
"0.5474058",
"0.53805417",
"0.53805417",
"0.53728706",
"0.53561056",
"0.5344642",
"0.534... | 0.76108825 | 1 |
Opens or reopens the file with mode "r+". | def open
_close
mode = @mode & ~(File::CREAT|File::EXCL)
@tmpfile = File.open(@tmpfile.path, mode, **@opts)
__setobj__(@tmpfile)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reload!(mode)\n if @file && !@file.closed?\n @file.close\n end\n @file = File.open(@name, mode)\n end",
"def reopen\n @mutex.synchronize {\n if defined? @io and @io\n flush\n @io.close rescue nil\n end\n @io = ::File.new(@fn, @mode)\n ... | [
"0.75515544",
"0.716201",
"0.71245587",
"0.7045794",
"0.696506",
"0.690354",
"0.6767116",
"0.6652942",
"0.6567916",
"0.6357701",
"0.6311844",
"0.6222986",
"0.61549",
"0.6025181",
"0.6025181",
"0.6010836",
"0.5990979",
"0.5960485",
"0.5960371",
"0.59397066",
"0.5923425",
"0.... | 0.6403304 | 9 |
Closes the file. If +unlink_now+ is true, then the file will be unlinked (deleted) after closing. Of course, you can choose to later call unlink if you do not unlink it now. If you don't explicitly unlink the temporary file, the removal will be delayed until the object is finalized. | def close(unlink_now=false)
_close
unlink if unlink_now
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close(unlink_now=false)\n if unlink_now\n close!\n else\n _close\n end\n end",
"def close\n @handle.closeFile\n @handle = nil\n end",
"def close_file\n if is_file_open?\n @file_handle.close\n \n # reset 'flags' variables and positio... | [
"0.83177847",
"0.6430862",
"0.6347114",
"0.634584",
"0.6286652",
"0.61654663",
"0.61294293",
"0.6103867",
"0.60724217",
"0.6017352",
"0.59742415",
"0.59627384",
"0.59389406",
"0.59349006",
"0.58847535",
"0.5882253",
"0.5875408",
"0.57741946",
"0.5764895",
"0.57645273",
"0.572... | 0.81384885 | 1 |
Closes and unlinks (deletes) the file. Has the same effect as called close(true). | def close!
close(true)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close\n @handle.closeFile\n @handle = nil\n end",
"def close_file\n if is_file_open?\n @file_handle.close\n \n # reset 'flags' variables and position\n @file_handle = nil\n @position = 0\n end\n end",
"def close_file\n if is... | [
"0.7741979",
"0.7603121",
"0.7602434",
"0.75111777",
"0.74209726",
"0.74128646",
"0.7412",
"0.733533",
"0.7303238",
"0.72984713",
"0.72553086",
"0.72439724",
"0.7076768",
"0.7071115",
"0.7071115",
"0.7026431",
"0.6940999",
"0.6879305",
"0.68584347",
"0.6823596",
"0.67613536",... | 0.5881663 | 99 |
Unlinks (deletes) the file from the filesystem. One should always unlink the file after using it, as is explained in the "Explicit close" good practice section in the Tempfile overview: file = Tempfile.new('foo') begin ...do something with file... ensure file.close file.unlink deletes the temp file end === Unlinkbefore... | def unlink
return if @unlinked
begin
File.unlink(@tmpfile.path)
rescue Errno::ENOENT
rescue Errno::EACCES
# may not be able to unlink on Windows; just ignore
return
end
ObjectSpace.undefine_finalizer(self)
@unlinked = true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unlink\n # keep this order for thread safeness\n begin\n File.unlink(@tmpname) if File.exist?(@tmpname)\n @@cleanlist.delete(@tmpname)\n @data = @tmpname = nil\n ObjectSpace.undefine_finalizer(self)\n rescue Errno::EACCES\n # may not be able to unlink on Window... | [
"0.756299",
"0.7334959",
"0.7334959",
"0.732052",
"0.7274813",
"0.71347576",
"0.711079",
"0.707583",
"0.69985294",
"0.69003797",
"0.6862941",
"0.6818719",
"0.6809106",
"0.6793669",
"0.6785579",
"0.6776176",
"0.67524475",
"0.6749044",
"0.6722954",
"0.6688271",
"0.6669312",
"... | 0.783921 | 0 |
Returns the full path name of the temporary file. This will be nil if unlink has been called. | def path
@unlinked ? nil : @tmpfile.path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_free_file_path\n tempfile = Tempfile.new('foo', \"#{Rails.root}/test/fixtures/data/upload\")\n res = tempfile.path\n tempfile.close\n tempfile.unlink\n res\n end",
"def temp_value #:nodoc:\n if tempfile?\n if original_filename\n %(#{@temp_name}/#{filename};#{original_... | [
"0.73359215",
"0.70772606",
"0.69046235",
"0.6875726",
"0.683257",
"0.6827176",
"0.6762771",
"0.6761032",
"0.6754179",
"0.6725624",
"0.6719966",
"0.6594493",
"0.6591545",
"0.65886015",
"0.65556055",
"0.64522624",
"0.64378124",
"0.643052",
"0.64175177",
"0.640522",
"0.6374048"... | 0.7357984 | 0 |
Returns the size of the temporary file. As a side effect, the IO buffer is flushed before determining the size. | def size
if !@tmpfile.closed?
@tmpfile.size # File#size calls rb_io_flush_raw()
else
File.size(@tmpfile.path)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def size\n if @tmpfile\n @tmpfile.flush\n @tmpfile.stat.size\n else\n 0\n end\n end",
"def tempfile_length(io)\n file_length(io)\n end",
"def size\n instance_read(:file_size) || (@queued_for_write[:original] && @queued_for_write[:original].size)\n end",
... | [
"0.828404",
"0.7521098",
"0.70977426",
"0.69912493",
"0.6850122",
"0.6769796",
"0.67352885",
"0.67241496",
"0.6710634",
"0.6708642",
"0.66994",
"0.66645324",
"0.6652094",
"0.66364866",
"0.660589",
"0.65458196",
"0.6454184",
"0.645199",
"0.6451414",
"0.64384335",
"0.64381474",... | 0.8491243 | 0 |
Evaluate the given +statements+ within the context of this workspace. | def evaluate(context, statements, file = __FILE__, line = __LINE__)
eval(statements, @binding, file, line)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def execute_block(statements, environment)\n previous = @environment\n begin\n @environment = environment\n\n statements.each do |statement|\n execute statement\n end\n ensure\n @environment = previous\n end\n nil\n end",
"def statements sexp, resu... | [
"0.657803",
"0.6091418",
"0.59388757",
"0.59281194",
"0.5902412",
"0.5868377",
"0.5867546",
"0.5561917",
"0.5462178",
"0.54560286",
"0.53788006",
"0.5375426",
"0.5293901",
"0.52100825",
"0.52100825",
"0.5178166",
"0.5156341",
"0.5137399",
"0.5124562",
"0.508514",
"0.5062513",... | 0.70517427 | 0 |
Creates a new inspector object, using the given +inspect_proc+ when output return values in irb. | def initialize(inspect_proc, init_proc = nil)
@init = init_proc
@inspect = inspect_proc
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_inspect(aRuntime)\n primitive = lambda do |_runtime, arg_evaluated|\n $stderr.puts \"INSPECT>#{arg_evaluated.inspect}\"\n Skeem::SkmUndefined.instance\n end\n define_primitive_proc(aRuntime, '_inspect', unary, primitive)\n end",
"def make_inspect **options\n... | [
"0.63539004",
"0.5719432",
"0.5012294",
"0.4985735",
"0.4932865",
"0.4932865",
"0.4932865",
"0.4932865",
"0.4932865",
"0.48580477",
"0.48106623",
"0.48106623",
"0.48106623",
"0.48106623",
"0.48106623",
"0.48106623",
"0.48106623",
"0.48106623",
"0.48106623",
"0.48106623",
"0.4... | 0.5654028 | 2 |
Proc to call when the inspector is activated, good for requiring dependent libraries. | def init
@init.call if @init
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def activate()\n end",
"def startup_hook; end",
"def activate; end",
"def install_pre_hook\n end",
"def pre_hook_send(handler); end",
"def activate\n (self.class.activate_hooks + activate_hooks).each do |block|\n block.call self\n end\n end",
"def on_start(_klass, _method); end",
"def p... | [
"0.63846344",
"0.63280135",
"0.6274195",
"0.6242149",
"0.61371267",
"0.60734725",
"0.6000928",
"0.59904945",
"0.5891855",
"0.5864858",
"0.5810963",
"0.58082885",
"0.5798547",
"0.57892245",
"0.57856315",
"0.57760924",
"0.57753044",
"0.5763468",
"0.57618403",
"0.5742282",
"0.57... | 0.0 | -1 |
Proc to call when the input is evaluated and output in irb. | def inspect_value(v)
@inspect.call(v)
rescue
puts "(Object doesn't support #inspect)"
''
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_proc\n ->(input) { call(input) }\n end",
"def call(input)\n process(input)\n end",
"def call(input)\r\n process(*input)\r\n end",
"def handle_input(input)\n result = eval(input)\n puts(\" => #{result}\")\nend",
"def handle_input(input)\n result = eval(input)\n put... | [
"0.7313101",
"0.6824295",
"0.64760643",
"0.6461297",
"0.6461297",
"0.6375238",
"0.6375238",
"0.63379294",
"0.6192429",
"0.6149672",
"0.6119188",
"0.6070194",
"0.60631835",
"0.6027991",
"0.59862155",
"0.59862155",
"0.5969876",
"0.5969876",
"0.59648174",
"0.59587836",
"0.595878... | 0.0 | -1 |
Reads the next line from this input method. See IOgets for more information. | def gets
fail NotImplementedError, "gets"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def readline\n @handle.gets\n end",
"def next_line\n $stdin.tty? ?\n Readline.readline('> ', true) :\n $stdin.gets\n end",
"def next_line\n return nil if @input.eof?\n line, ch, @pos, @line_no = '', '', 0, @line_no + 1\n until ch == \"\\r\" || ch == \"\\n\" || c... | [
"0.78057957",
"0.7783704",
"0.75825244",
"0.7502848",
"0.7392771",
"0.73623085",
"0.7216161",
"0.71780384",
"0.70475715",
"0.7040226",
"0.6948474",
"0.6858508",
"0.68097866",
"0.6753403",
"0.6743692",
"0.6691443",
"0.6618903",
"0.65607995",
"0.65258086",
"0.64976496",
"0.6497... | 0.0 | -1 |
Whether this input method is still readable when there is no more data to read. See IOeof for more information. | def readable_after_eof?
false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def readable_after_eof?\n true\n end",
"def readable_after_eof?\n true\n end",
"def readable_after_eof?\n true\n end",
"def readable_after_eof?\n true\n end",
"def readable_after_eof?\n true\n end",
"def readable_after_eof?\n true\n end",
"def... | [
"0.79358494",
"0.79358494",
"0.79358494",
"0.7852117",
"0.7852117",
"0.7852117",
"0.7852117",
"0.7852117",
"0.770227",
"0.7504629",
"0.74458873",
"0.7240724",
"0.71985054",
"0.7186388",
"0.7160574",
"0.71448046",
"0.70653164",
"0.7054245",
"0.7054245",
"0.7050763",
"0.7049472... | 0.8101195 | 1 |
Reads the next line from this input method. See IOgets for more information. | def gets
print @prompt
line = @stdin.gets
@line[@line_no += 1] = line
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def readline\n @handle.gets\n end",
"def next_line\n $stdin.tty? ?\n Readline.readline('> ', true) :\n $stdin.gets\n end",
"def next_line\n return nil if @input.eof?\n line, ch, @pos, @line_no = '', '', 0, @line_no + 1\n until ch == \"\\r\" || ch == \"\\n\" || c... | [
"0.7804162",
"0.7784264",
"0.75842696",
"0.7501555",
"0.73926586",
"0.73627335",
"0.72175115",
"0.7178649",
"0.7049941",
"0.7039928",
"0.694934",
"0.6858305",
"0.6810599",
"0.67554563",
"0.67433083",
"0.6692614",
"0.6619185",
"0.65622807",
"0.6527588",
"0.6497652",
"0.6497479... | 0.64786154 | 26 |
Whether the end of this input method has been reached, returns +true+ if there is no more data to read. See IOeof? for more information. | def eof?
if @stdin.wait_readable(0.00001)
c = @stdin.getc
result = c.nil? ? true : false
@stdin.ungetc(c) unless c.nil?
result
else # buffer is empty
false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def eof?\n @input.eof?\n end",
"def eof?\n @io.eof?\n end",
"def eof?\n @io.eof?\n end",
"def eof?\n @io.eof?\n end",
"def eof?\n if @buffer.size > 0\n false\n else\n @io.eof?\n end\n end",
"def eof?\n @stdin.eof?\n end",
"... | [
"0.8427554",
"0.83269066",
"0.83269066",
"0.83269066",
"0.8319218",
"0.825478",
"0.825478",
"0.825478",
"0.82337767",
"0.8093038",
"0.8089921",
"0.80557567",
"0.80557567",
"0.8055129",
"0.80127895",
"0.80127895",
"0.80127895",
"0.80124694",
"0.80124694",
"0.80124694",
"0.7954... | 0.7959204 | 20 |
Whether this input method is still readable when there is no more data to read. See IOeof for more information. | def readable_after_eof?
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def readable_after_eof?\n false\n end",
"def readable_after_eof?\n false\n end",
"def readable_after_eof?\n true\n end",
"def readable_after_eof?\n true\n end",
"def readable_after_eof?\n true\n end",
"def read?\n !@read.nil?\n end",
"... | [
"0.81007844",
"0.81007844",
"0.79353905",
"0.79353905",
"0.79353905",
"0.7701659",
"0.75033706",
"0.7445043",
"0.72401077",
"0.71984696",
"0.7185892",
"0.7160068",
"0.7144063",
"0.70658004",
"0.70542705",
"0.70542705",
"0.70508385",
"0.70489913",
"0.7042181",
"0.7042181",
"0.... | 0.78516805 | 8 |
Returns the current line number for io. line counts the number of times gets is called. See IOlineno for more information. | def line(line_no)
@line[line_no]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lineno\n @__line\n end",
"def line_number(pos=pos())\n line_index(pos) + 1\n end",
"def line_number(pos=pos)\n line_index(pos) + 1\n end",
"def line_number\n\t\t\t@line_index + 1\n\t\tend",
"def lineno\n @_st_lineno\n end",
"def linenumber\n return @cmd.nil? ? 0 :... | [
"0.77966374",
"0.7547844",
"0.74908954",
"0.74756074",
"0.7408915",
"0.73889834",
"0.7375762",
"0.73385555",
"0.73202735",
"0.72944635",
"0.7249864",
"0.72158384",
"0.71936166",
"0.7136799",
"0.7136799",
"0.7136406",
"0.71351844",
"0.71045375",
"0.71045375",
"0.71045375",
"0.... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.