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 |
|---|---|---|---|---|---|---|
The dependencies of the gem for this specification | def dependencies
spec.dependencies
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dependencies_for(specification)\n specification.dependencies\n end",
"def dependencies\n []\n end",
"def dependencies\n []\n end",
"def dependencies\n []\n end",
"def dependencies_for(specification)\n []\n end",
"def gem_requirements\n @met... | [
"0.8199883",
"0.80959564",
"0.8057263",
"0.8052083",
"0.7897831",
"0.7868105",
"0.7841912",
"0.7841912",
"0.7841912",
"0.7841912",
"0.78279305",
"0.7758478",
"0.7731829",
"0.7684384",
"0.76712054",
"0.76561284",
"0.76498467",
"0.76388997",
"0.76388997",
"0.76388997",
"0.76098... | 0.8158516 | 2 |
The required_ruby_version constraint for this specification A fallback is included because when generated, some marshalled specs have it set to +nil+. | def required_ruby_version
spec.required_ruby_version || Gem::Requirement.default
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def required_ruby_version\n spec.required_ruby_version\n end",
"def require_ruby_version *versions\n spec_extras[:required_ruby_version] = versions\n end",
"def required_version\n normalize_version(@required_version ||= nil)\n end",
"def required_ruby_version=(req)\n @required_ruby_ver... | [
"0.79251844",
"0.7197017",
"0.7146556",
"0.69488215",
"0.6826784",
"0.6736967",
"0.6688336",
"0.6606587",
"0.6533767",
"0.6508698",
"0.63807213",
"0.6198173",
"0.6167319",
"0.61393607",
"0.6076258",
"0.60701525",
"0.6065017",
"0.6065017",
"0.606176",
"0.60403955",
"0.60333776... | 0.79143447 | 1 |
The required_rubygems_version constraint for this specification A fallback is included because the original version of the specification API didn't include that field, so some marshalled specs in the index have it set to +nil+. | def required_rubygems_version
spec.required_rubygems_version || Gem::Requirement.default
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def required_rubygems_version\n spec.required_rubygems_version\n end",
"def required_rubygems_version=(req)\n @required_rubygems_version = Gem::Requirement.create req\n end",
"def required_version\n normalize_version(@required_version ||= nil)\n end",
"def version_constraint(gem_name); en... | [
"0.7708864",
"0.7130683",
"0.709428",
"0.7057734",
"0.676124",
"0.6759365",
"0.67303646",
"0.6681714",
"0.6454389",
"0.63872373",
"0.6352697",
"0.6321746",
"0.6298665",
"0.62794113",
"0.6243529",
"0.6169892",
"0.6125835",
"0.6095501",
"0.5993163",
"0.5993163",
"0.5986334",
... | 0.7634616 | 1 |
Fetches a Gem::Specification for this IndexSpecification from the source. | def spec # :nodoc:
@spec ||=
begin
tuple = Gem::NameTuple.new @name, @version, @platform
@source.fetch_spec tuple
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def specification\n Gem::Specification.find_by_name(name, requirement)\n rescue Gem::LoadError\n nil\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 ... | [
"0.6751882",
"0.67280394",
"0.67079777",
"0.6620913",
"0.6567045",
"0.654172",
"0.65395576",
"0.6493708",
"0.64499074",
"0.64137703",
"0.62800425",
"0.62759054",
"0.6209173",
"0.6194693",
"0.60744315",
"0.6067425",
"0.60530937",
"0.60349506",
"0.601421",
"0.6004052",
"0.60033... | 0.71119815 | 0 |
This is a null install as this specification is already installed. +options+ are ignored. | def install(options = {})
yield nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def install(options = {})\n destination = options[:install_dir] || Gem.dir\n\n if File.exist? File.join(destination, 'specifications', spec.spec_name)\n yield nil\n return\n end\n\n super\n end",
"def install\n nil\n end",
"def install_options\n collect_options(resource[:insta... | [
"0.7026612",
"0.69402194",
"0.66221166",
"0.6524104",
"0.6470162",
"0.6429724",
"0.6313231",
"0.62831885",
"0.62706023",
"0.62706023",
"0.6267455",
"0.6261712",
"0.61906236",
"0.6181347",
"0.6171406",
"0.6157393",
"0.61275804",
"0.6115361",
"0.60915947",
"0.60915947",
"0.6090... | 0.72621864 | 1 |
Returns +true+ if this gem is installable for the current platform. | def installable_platform?
# BACKCOMPAT If the file is coming out of a specified file, then we
# ignore the platform. This code can be removed in RG 3.0.
return true if @source.kind_of? Gem::Source::SpecificFile
super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def installable_platform?\n Gem::Platform.match_spec? spec\n end",
"def install?\n return false unless allowed_host?\n return false unless packages_installed?\n true\n end",
"def installed?\n false\n end",
"def installed?\n !IO.popen(\"which #{self}\"){|i| i.read}.empty?\n ... | [
"0.82791203",
"0.77532905",
"0.7449716",
"0.7226018",
"0.7146752",
"0.70928043",
"0.7040743",
"0.70077896",
"0.6998512",
"0.69835216",
"0.69464386",
"0.6934264",
"0.6933715",
"0.68844867",
"0.6883959",
"0.68822086",
"0.6876074",
"0.6848522",
"0.68336767",
"0.68260133",
"0.681... | 0.6910593 | 13 |
The source for this specification | def source
@source ||= Gem::Source::Installed.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def source\n @source\n end",
"def source\n @source\n end",
"def source; end",
"def source; end",
"def source; end",
"def source; end",
"def source; end",
"def source; end",
"def source; end",
"def source; end",
"def source; end",
"def source; end",
"def source; end",
"def ... | [
"0.8006606",
"0.8006606",
"0.7852768",
"0.7852768",
"0.7852768",
"0.7852768",
"0.7852768",
"0.7852768",
"0.7852768",
"0.7852768",
"0.7852768",
"0.7852768",
"0.7852768",
"0.7852768",
"0.7852768",
"0.7852768",
"0.7852768",
"0.7852768",
"0.7852768",
"0.78249586",
"0.7790749",
... | 0.0 | -1 |
This is a null install as a locked specification is considered installed. +options+ are ignored. | def install(options = {})
destination = options[:install_dir] || Gem.dir
if File.exist? File.join(destination, 'specifications', spec.spec_name)
yield nil
return
end
super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def install(options = {})\n yield nil\n end",
"def install(options = {})\n yield nil\n end",
"def install\n nil\n end",
"def check_for_installed_software_only\n check_all_installed @options\n end",
"def install_sol11_pkg(options,pkg_name)\n pkg_test = %x[which #{pkg_name}]\n if pkg_te... | [
"0.71196216",
"0.71196216",
"0.65926355",
"0.6375977",
"0.62477124",
"0.62475234",
"0.6225328",
"0.6198224",
"0.61866957",
"0.6151469",
"0.60786194",
"0.6071715",
"0.60541934",
"0.6042675",
"0.5991595",
"0.5991595",
"0.5991595",
"0.5991595",
"0.5991595",
"0.5991595",
"0.59915... | 0.66612947 | 2 |
Adds +dependency+ from the lockfile to this specification | def add_dependency(dependency) # :nodoc:
@dependencies << dependency
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_dependency(path, dependency); end",
"def add(dependency)\n @dependencies[cookbook_name(dependency)] = dependency\n end",
"def add_dependency(dependency)\n @dependencies << dependency\n end",
"def add_dependency(dependency)\n unrealize\n dependencies.push(dependency)\n depen... | [
"0.742443",
"0.71079046",
"0.6950469",
"0.6860219",
"0.68310803",
"0.6794424",
"0.67096186",
"0.6707274",
"0.65598315",
"0.65272826",
"0.64681053",
"0.64274937",
"0.63537735",
"0.6250331",
"0.6242693",
"0.6222958",
"0.61224484",
"0.6111205",
"0.61106426",
"0.60981965",
"0.606... | 0.69701165 | 2 |
A specification constructed from the lockfile is returned | def spec
@spec ||= Gem::Specification.find do |spec|
spec.name == @name and spec.version == @version
end
@spec ||= Gem::Specification.new do |s|
s.name = @name
s.version = @version
s.platform = @platform
s.dependencies.concat @dependencies
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lockfile_specs\n lockfile.specs\n end",
"def spec_file\n return @spec_file if defined?(@spec_file)\n return @spec_file = nil unless loaded_from && File.file?(loaded_from)\n @spec_file = begin\n file = { name: File.basename(loaded_from), dir: File.dirname(loaded_f... | [
"0.7071976",
"0.6479988",
"0.6437617",
"0.6323279",
"0.6298975",
"0.6283049",
"0.6209439",
"0.6204748",
"0.6185542",
"0.613054",
"0.61103237",
"0.60589314",
"0.60589314",
"0.59934396",
"0.59639984",
"0.5957698",
"0.5945987",
"0.59339947",
"0.59115076",
"0.590434",
"0.58955526... | 0.6225064 | 6 |
This is a null install as this gem was unpacked into a directory. +options+ are ignored. | def install(options = {})
yield nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def after_install(path, options = T.unsafe(nil)); end",
"def install(options = {})\n destination = options[:install_dir] || Gem.dir\n\n if File.exist? File.join(destination, 'specifications', spec.spec_name)\n yield nil\n return\n end\n\n super\n end",
"def install\n nil\n end",
... | [
"0.6887096",
"0.6699295",
"0.6631296",
"0.66044056",
"0.6598442",
"0.6362954",
"0.63284063",
"0.6295469",
"0.62846607",
"0.61763",
"0.6168626",
"0.6158691",
"0.6148865",
"0.6101883",
"0.6082155",
"0.60684204",
"0.60684204",
"0.6051468",
"0.6020896",
"0.5969643",
"0.5935415",
... | 0.7179794 | 0 |
Create Resolver object which will resolve the tree starting with +needed+ Dependency objects. +set+ is an object that provides where to look for specifications to satisfy the Dependencies. This defaults to IndexSet, which will query rubygems.org. | def initialize(needed, set = nil)
@set = set || Gem::Resolver::IndexSet.new
@needed = needed
@development = false
@development_shallow = false
@ignore_dependencies = false
@missing = []
@skip_gems = {}
@soft_missing = false
@stats =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resolve(set = Gem::Resolver::BestSet.new)\n @sets << set\n @sets << @git_set\n @sets << @vendor_set\n @sets << @source_set\n\n set = Gem::Resolver.compose_sets(*@sets)\n set.remote = @remote\n set.prerelease = @prerelease\n\n resolver = Gem::Resolver.new @dependencies, set\n resolver... | [
"0.791887",
"0.74697065",
"0.6830934",
"0.6424592",
"0.57672405",
"0.5699109",
"0.56054235",
"0.55916053",
"0.54837567",
"0.5454508",
"0.53981715",
"0.5364447",
"0.5349753",
"0.5319549",
"0.5306723",
"0.5306172",
"0.5302989",
"0.52309877",
"0.5193981",
"0.5080969",
"0.5060681... | 0.68036395 | 3 |
Creates an ActivationRequest for the given +dep+ and the last +possible+ specification. Returns the Specification and the ActivationRequest | def activation_request(dep, possible) # :nodoc:
spec = possible.pop
explain :activate, [spec.full_name, possible.size]
explain :possible, possible
activation_request =
Gem::Resolver::ActivationRequest.new spec, dep, possible
return spec, activation_request
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_version_req(dep)\n req = get_key_or_sym(dep, :version_requirement)\n req ||= get_key_or_sym(dep, :version_range)\n req\n end",
"def req *requirements\n return requirements.first if Gem::Requirement === requirements.first\n Gem::Requirement.create requirements\n end",
"def req *re... | [
"0.47569698",
"0.46295372",
"0.4628613",
"0.45376316",
"0.4487268",
"0.44645923",
"0.4433937",
"0.44078767",
"0.44054458",
"0.44054458",
"0.44054458",
"0.4405381",
"0.44035855",
"0.44024357",
"0.43740284",
"0.43736833",
"0.4345845",
"0.43186486",
"0.43108925",
"0.42998743",
"... | 0.8130085 | 0 |
Proceed with resolution! Returns an array of ActivationRequest objects. | def resolve
locking_dg = Molinillo::DependencyGraph.new
Molinillo::Resolver.new(self, self).resolve(@needed.map {|d| DependencyRequest.new d, nil }, locking_dg).tsort.map(&:payload).compact
rescue Molinillo::VersionConflict => e
conflict = e.conflicts.values.first
raise Gem::DependencyResolutionError,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def activation_request(dep, possible) # :nodoc:\n spec = possible.pop\n\n explain :activate, [spec.full_name, possible.size]\n explain :possible, possible\n\n activation_request =\n Gem::Resolver::ActivationRequest.new spec, dep, possible\n\n return spec, activation_request\n end",
"def regi... | [
"0.603134",
"0.53120613",
"0.5260844",
"0.52285177",
"0.51152575",
"0.5019571",
"0.49542657",
"0.49510115",
"0.49475542",
"0.49065807",
"0.4887008",
"0.48787853",
"0.48683515",
"0.48490474",
"0.48489147",
"0.4835058",
"0.48281372",
"0.4814904",
"0.4802882",
"0.47899735",
"0.4... | 0.0 | -1 |
Extracts the specifications that may be able to fulfill +dependency+ and returns those that match the local platform and all those that match. | def find_possible(dependency) # :nodoc:
all = @set.find_all dependency
if (skip_dep_gems = skip_gems[dependency.name]) && !skip_dep_gems.empty?
matching = all.select do |api_spec|
skip_dep_gems.any? {|s| api_spec.version == s.version }
end
all = matching unless matching.empty?
en... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_matching(dependency, all = false, matching_platform = true)\n found = {}\n\n list(all).each do |source_uri, specs|\n found[source_uri] = specs.select do |spec_name, version, spec_platform|\n dependency =~ Gem::Dependency.new(spec_name, version) and\n (not matching_platform or Ge... | [
"0.718164",
"0.6310655",
"0.6283271",
"0.6282772",
"0.623346",
"0.62232584",
"0.6129735",
"0.60934186",
"0.60694295",
"0.6067493",
"0.59901357",
"0.5981128",
"0.59247905",
"0.59066474",
"0.58798325",
"0.58657324",
"0.58588433",
"0.5840794",
"0.5835613",
"0.58285254",
"0.58278... | 0.79793155 | 0 |
Returns the gems in +specs+ that match the local platform. | def select_local_platforms(specs) # :nodoc:
specs.select do |spec|
Gem::Platform.installable? spec
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def platform_gemspec\n gemspecs.fetch(platform) { This.ruby_gemspec }\n end",
"def spec(platform = RUBY_PLATFORM[/java/] || 'ruby')\n @specs ||= %w(ruby java x86-mswin32).inject({}) { |hash, spec_platform|\n ENV['BUILDR_PLATFORM'] = spec_platform\n hash.update(spec_platform=> Gem::Specification.load('... | [
"0.67781174",
"0.66101766",
"0.6381568",
"0.6326737",
"0.63172317",
"0.631451",
"0.6177517",
"0.6153597",
"0.61355615",
"0.609795",
"0.60786915",
"0.6063445",
"0.60496014",
"0.6047693",
"0.6026377",
"0.6017607",
"0.5982909",
"0.5970681",
"0.5961666",
"0.5954999",
"0.5952215",... | 0.76787525 | 0 |
returns an integer \in (\infty, 0] a number closer to 0 means the dependency is less constraining dependencies w/ 0 or 1 possibilities (ignoring version requirements) are given very negative values, so they _always_ sort first, before dependencies that are unconstrained | def amount_constrained(dependency)
@amount_constrained ||= {}
@amount_constrained[dependency.name] ||= begin
name_dependency = Gem::Dependency.new(dependency.name)
dependency_request_for_name = Gem::Resolver::DependencyRequest.new(name_dependency, dependency.requester)
all = @set.find_all(depe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def euclidean_priority(x)\n priority = 0\n 0.upto(x.size-1) { |i|\n priority += (x[i] - @instance.final_capacities[i])**2\n }\n return Math.sqrt(priority).round\n end",
"def priority\n Rational(@successes + 1, tries_adj + 2) * ($use_cats && (self == $cur_element || ca... | [
"0.60099566",
"0.5954176",
"0.58355546",
"0.5768477",
"0.57635355",
"0.57173294",
"0.5663462",
"0.56631005",
"0.5629065",
"0.5624765",
"0.5620609",
"0.56147045",
"0.5612081",
"0.56051993",
"0.5524879",
"0.55073595",
"0.55020964",
"0.54833174",
"0.54741913",
"0.54719687",
"0.5... | 0.5425318 | 25 |
Returns a split URI against +regexp[:ABS_URI]+. | def split(uri)
case uri
when ''
# null uri
when @regexp[:ABS_URI]
scheme, opaque, userinfo, host, port,
registry, path, query, fragment = $~[1..-1]
# URI-reference = [ absoluteURI | relativeURI ] [ "#" fragment ]
# absoluteURI = scheme ":" ( hier_part | o... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_regexp(schemes = nil)\n unless schemes\n @regexp[:ABS_URI_REF]\n else\n /(?=#{Regexp.union(*schemes)}:)#{@pattern[:X_ABS_URI]}/x\n end\n end",
"def make_regexp(schemes = nil)\n unless schemes\n @regexp[:ABS_URI_REF]\n else\n /(?=#{Regexp.union(*sch... | [
"0.70333344",
"0.70333344",
"0.66362137",
"0.61158097",
"0.61158097",
"0.5698495",
"0.5698495",
"0.56521016",
"0.5533121",
"0.5483224",
"0.54645693",
"0.5461517",
"0.5447216",
"0.5393139",
"0.5378448",
"0.5367318",
"0.5229706",
"0.5168248",
"0.51028013",
"0.5098188",
"0.50537... | 0.5959071 | 6 |
== Args +uri+:: String == Description Parses +uri+ and constructs either matching URI scheme object (File, FTP, HTTP, HTTPS, LDAP, LDAPS, or MailTo) or URI::Generic. == Usage p = URI::Parser.new p.parse("ldap://ldap.example.com/dc=example?user=john") => | def parse(uri)
URI.for(*self.split(uri), self)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse(uri)\n scheme, userinfo, host, port,\n registry, path, opaque, query, fragment = self.split(uri)\n\n if scheme && URI.scheme_list.include?(scheme.upcase)\n URI.scheme_list[scheme.upcase].new(scheme, userinfo, host, port,\n registry, path, ... | [
"0.74768347",
"0.736202",
"0.67384",
"0.66835815",
"0.6494575",
"0.63570356",
"0.6356119",
"0.6350726",
"0.6350726",
"0.63480073",
"0.63222563",
"0.6267101",
"0.6196404",
"0.6146753",
"0.6144346",
"0.61175257",
"0.61143875",
"0.61143875",
"0.6068819",
"0.6042683",
"0.6039594"... | 0.69933933 | 2 |
== Args +uris+:: an Array of Strings == Description Attempts to parse and merge a set of URIs. | def join(*uris)
uris[0] = convert_to_uri(uris[0])
uris.inject :merge
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create(*uris); end",
"def update(uris)\n [uris].flatten.each do |uri|\n deserialize_referer_data(read_referer_data(uri), File.extname(uri).downcase)\n end\n\n true\n end",
"def find_ids(uris)\n uris.map { |uri| find_id(uri) }\n end",
"def delete(*uris); end",
"def cache(*ur... | [
"0.6280866",
"0.6105866",
"0.60422677",
"0.59485704",
"0.5907391",
"0.57886034",
"0.57886034",
"0.5777218",
"0.5745398",
"0.5661986",
"0.5633763",
"0.5625322",
"0.5548895",
"0.5462524",
"0.5462524",
"0.5462524",
"0.5442231",
"0.54356176",
"0.5380575",
"0.53585166",
"0.5286559... | 0.74621916 | 1 |
Returns Regexp that is default +self.regexp[:ABS_URI_REF]+, unless +schemes+ is provided. Then it is a Regexp.union with +self.pattern[:X_ABS_URI]+. | def make_regexp(schemes = nil)
unless schemes
@regexp[:ABS_URI_REF]
else
/(?=#{Regexp.union(*schemes)}:)#{@pattern[:X_ABS_URI]}/x
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize_regexp(pattern)\n ret = {}\n\n # for URI::split\n ret[:ABS_URI] = Regexp.new('\\A\\s*' + pattern[:X_ABS_URI] + '\\s*\\z', Regexp::EXTENDED)\n ret[:REL_URI] = Regexp.new('\\A\\s*' + pattern[:X_REL_URI] + '\\s*\\z', Regexp::EXTENDED)\n\n # for URI::extract\n ret[:URI_REF]... | [
"0.56273204",
"0.56273204",
"0.560128",
"0.5388264",
"0.5378384",
"0.5358044",
"0.53242844",
"0.531766",
"0.52917516",
"0.5261823",
"0.51805425",
"0.51003075",
"0.5092952",
"0.5076308",
"0.5076077",
"0.50726867",
"0.50607747",
"0.5060315",
"0.5050763",
"0.50463754",
"0.498438... | 0.85583234 | 1 |
:callseq: escape( str ) escape( str, unsafe ) == Args +str+:: String to make safe +unsafe+:: Regexp to apply. Defaults to +self.regexp[:UNSAFE]+ == Description Constructs a safe String from +str+, removing unsafe characters, replacing them with codes. | def escape(str, unsafe = @regexp[:UNSAFE])
unless unsafe.kind_of?(Regexp)
# perhaps unsafe is String object
unsafe = Regexp.new("[#{Regexp.quote(unsafe)}]", false)
end
str.gsub(unsafe) do
us = $&
tmp = ''
us.each_byte do |uc|
tmp << sprintf('%%%02X', u... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def escape(str); end",
"def escape(str, unsafe = UNSAFE)\n # URI.escape is obsolete\"\n DEFAULT_PARSER.escape(str, unsafe)\n end",
"def escape_str(str)\n str.gsub!(/[\\\\`\\#]/, '\\\\\\\\\\&')\n str.gsub!(/\\r\\n/, \"\\\\r\\r\\n\") if @newline == \"\\r\\n\"\n return str\n ... | [
"0.7157116",
"0.701173",
"0.67566925",
"0.6737652",
"0.66904366",
"0.66855353",
"0.6684388",
"0.66798764",
"0.66658765",
"0.663133",
"0.6564175",
"0.6543864",
"0.6514545",
"0.64970064",
"0.6490061",
"0.64327055",
"0.6385045",
"0.6340163",
"0.62743926",
"0.627417",
"0.62681097... | 0.7758739 | 1 |
:callseq: unescape( str ) unescape( str, escaped ) == Args +str+:: String to remove escapes from +escaped+:: Regexp to apply. Defaults to +self.regexp[:ESCAPED]+ == Description Removes escapes from +str+. | def unescape(str, escaped = @regexp[:ESCAPED])
enc = str.encoding
enc = Encoding::UTF_8 if enc == Encoding::US_ASCII
str.gsub(escaped) { [$&[1, 2]].pack('H2').force_encoding(enc) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unescape(escaped_string)\n escaped_string.\n gsub(/\\$\\$|\\$'|\\$L|\\$P|\\$R|\\$P|\\$T/i) do |match|\n case match\n when \"$$\"\n \"$\"\n when \"$'\"\n \"'\"\n when \"$L\", \"$l\"\n \"\\n\"\n ... | [
"0.7551299",
"0.6760163",
"0.66728723",
"0.65304035",
"0.6519861",
"0.62896436",
"0.6196283",
"0.6129868",
"0.61192214",
"0.60839957",
"0.5992109",
"0.5953842",
"0.58502096",
"0.5829791",
"0.5751844",
"0.5738581",
"0.5736157",
"0.57149476",
"0.5639849",
"0.5581566",
"0.558061... | 0.68906504 | 1 |
Constructs the default Hash of patterns. | def initialize_pattern(opts = {})
ret = {}
ret[:ESCAPED] = escaped = (opts.delete(:ESCAPED) || PATTERN::ESCAPED)
ret[:UNRESERVED] = unreserved = opts.delete(:UNRESERVED) || PATTERN::UNRESERVED
ret[:RESERVED] = reserved = opts.delete(:RESERVED) || PATTERN::RESERVED
ret[:DOMLABEL] = opts.del... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_starting_hash_pattern(opts)\n opts = check_params(opts,[:patterns])\n super(opts)\n end",
"def starting_hash_pattern\n super\n end",
"def all_patterns\n @mutex.synchronize do\n @patterns.keys.map{ |a_| a_.dup }\n end\n end",
"def patterns_for_file( file )\n ... | [
"0.65393686",
"0.64655966",
"0.62451804",
"0.6118747",
"0.5987059",
"0.5978927",
"0.59247154",
"0.58970517",
"0.58894444",
"0.5845772",
"0.5829209",
"0.58236057",
"0.57862467",
"0.57725286",
"0.5690115",
"0.56379914",
"0.56137764",
"0.55339175",
"0.55291504",
"0.55247444",
"0... | 0.54664433 | 24 |
Constructs the default Hash of Regexp's. | def initialize_regexp(pattern)
ret = {}
# for URI::split
ret[:ABS_URI] = Regexp.new('\A\s*' + pattern[:X_ABS_URI] + '\s*\z', Regexp::EXTENDED)
ret[:REL_URI] = Regexp.new('\A\s*' + pattern[:X_REL_URI] + '\s*\z', Regexp::EXTENDED)
# for URI::extract
ret[:URI_REF] = Regexp.new(pat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize()\n @regexps = Hash.new {|hash,key| hash[key] = Regexp.new(key)}\n @memoization = nil\n @terminal_parse_failures = nil\n end",
"def to_hash\n super.merge({\n format: @regexp\n }).freeze\n end",
"def initialize\n @regexp_handling = 1\n\n ... | [
"0.75191075",
"0.6411104",
"0.63927233",
"0.6163803",
"0.6099529",
"0.6090504",
"0.60144174",
"0.5982938",
"0.59581524",
"0.5945682",
"0.59126097",
"0.59001786",
"0.59001786",
"0.5872489",
"0.5864283",
"0.56725025",
"0.56189495",
"0.56189495",
"0.5613367",
"0.5599367",
"0.558... | 0.6817677 | 2 |
== Args +scheme+:: Protocol scheme, i.e. 'http','ftp','mailto' and so on. +userinfo+:: User name and password, i.e. 'sdmitry:bla'. +host+:: Server host name. +port+:: Server port. +registry+:: Registry of naming authorities. +path+:: Path on server. +opaque+:: Opaque part. +query+:: Query data. +fragment+:: Part of the... | def initialize(scheme,
userinfo, host, port, registry,
path, opaque,
query,
fragment,
parser = DEFAULT_PARSER,
arg_check = false)
@scheme = nil
@user = nil
@password = nil
@host = ni... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(scheme,\n userinfo, host, port, registry,\n path, opaque,\n query,\n fragment,\n parser = nil,\n arg_check = false)\n raise InvalidURIError unless path\n path = path.sub(/^\\//,'')\n... | [
"0.6361025",
"0.56973726",
"0.542146",
"0.5386496",
"0.5264129",
"0.5005691",
"0.49749577",
"0.49375874",
"0.4931855",
"0.49152115",
"0.48763847",
"0.48763847",
"0.4793387",
"0.47899416",
"0.47380382",
"0.47349414",
"0.47001556",
"0.46877995",
"0.46535864",
"0.46294644",
"0.4... | 0.7299485 | 0 |
Returns the parser to be used. Unless a URI::Parser is defined, DEFAULT_PARSER is used. | def parser
if !defined?(@parser) || !@parser
DEFAULT_PARSER
else
@parser || DEFAULT_PARSER
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parser\n @parser ||= Parser.new(self)\n end",
"def parser\n @parser ||= Parser.new(self)\n end",
"def parser\n @parser ||= Parser.new(self)\n end",
"def parser_class\n case @url\n when 'post.html' then HackerNews::Parser ## example case\n when @url then HackerNe... | [
"0.70434606",
"0.70420223",
"0.70420223",
"0.67562985",
"0.6731022",
"0.6629348",
"0.6486231",
"0.64216876",
"0.63348854",
"0.62152904",
"0.62152904",
"0.61938244",
"0.61271125",
"0.6112025",
"0.60029364",
"0.5905728",
"0.59049135",
"0.5896524",
"0.5889807",
"0.58888626",
"0.... | 0.84305847 | 0 |
Replaces self by other URI object. | def replace!(oth)
if self.class != oth.class
raise ArgumentError, "expected #{self.class} object"
end
component.each do |c|
self.__send__("#{c}=", oth.__send__(c))
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset(other)\n self.url = other.url\n self.attributes.replace(other.attributes)\n self\n end",
"def uri= new_uri\n @uri = self.class.build_uri new_uri\n end",
"def replace(other)\n if loaded?\n orphan_resources(self)\n end\n other = other.map { |r| r.... | [
"0.694135",
"0.61067307",
"0.605739",
"0.5908413",
"0.5738396",
"0.5643108",
"0.5634679",
"0.5632203",
"0.5603318",
"0.55737156",
"0.5543065",
"0.5536211",
"0.5437298",
"0.5419368",
"0.53747135",
"0.53729075",
"0.53729075",
"0.53729075",
"0.53729075",
"0.53729075",
"0.5372907... | 0.5255363 | 36 |
Components of the URI in the order. | def component
self.class.component
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parts\n prefix, parts = split_names(@path)\n prefix.empty? ? parts : [prefix] + parts\n end",
"def __endpoint_parts\n parts = @spec['url']['paths'].select do |a|\n a.keys.include?('parts')\n end.map do |path|\n path&.[]('parts')\n end\n (parts.inject(&:mer... | [
"0.64427805",
"0.62162083",
"0.61104435",
"0.6037966",
"0.5976587",
"0.5902429",
"0.5817729",
"0.57616293",
"0.56530887",
"0.5650854",
"0.5637375",
"0.5636977",
"0.5636977",
"0.559485",
"0.5461838",
"0.53837544",
"0.53693056",
"0.5337382",
"0.53160805",
"0.53160805",
"0.52550... | 0.0 | -1 |
Checks the scheme +v+ component against the URI::Parser Regexp for :SCHEME. | def check_scheme(v)
if v && parser.regexp[:SCHEME] !~ v
raise InvalidComponentError,
"bad component(expected scheme component): #{v}"
end
return true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_scheme(v)\n @scheme = v&.downcase\n end",
"def check_path(v)\n # raise if both hier and opaque are not nil, because:\n # absoluteURI = scheme \":\" ( hier_part | opaque_part )\n # hier_part = ( net_path | abs_path ) [ \"?\" query ]\n if v && @opaque\n raise Invali... | [
"0.65900433",
"0.6014983",
"0.59776187",
"0.5882723",
"0.5795302",
"0.5791023",
"0.5711075",
"0.57067394",
"0.55974793",
"0.5552967",
"0.55157435",
"0.55157435",
"0.5441834",
"0.5337693",
"0.53368264",
"0.5295464",
"0.5231396",
"0.5227486",
"0.5226084",
"0.51937973",
"0.51937... | 0.79242706 | 0 |
Protected setter for the scheme component +v+. See also URI::Generic.scheme=. | def set_scheme(v)
@scheme = v&.downcase
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scheme=(v)\n check_scheme(v)\n set_scheme(v)\n v\n end",
"def scheme_set(scheme)\n rebuild_uri :scheme => scheme\n end",
"def scheme(value = nil)\n if value\n @scheme = value\n else\n @scheme ||= 'http'\n end\n end",
"def scheme(new_scheme)\n all... | [
"0.852452",
"0.73977953",
"0.736151",
"0.7181598",
"0.66236264",
"0.6497339",
"0.6247693",
"0.6247693",
"0.6232721",
"0.6181156",
"0.6176007",
"0.6176007",
"0.6176007",
"0.6099036",
"0.6046248",
"0.6020014",
"0.60051847",
"0.59761935",
"0.5849372",
"0.584075",
"0.58102995",
... | 0.8078469 | 1 |
== Args +v+:: String == Description Public setter for the scheme component +v+ (with validation). See also URI::Generic.check_scheme. == Usage require 'uri' uri = URI.parse(" uri.scheme = "https" uri.to_s => " | def scheme=(v)
check_scheme(v)
set_scheme(v)
v
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_scheme(v)\n @scheme = v&.downcase\n end",
"def scheme(value = nil)\n if value\n @scheme = value\n else\n @scheme ||= 'http'\n end\n end",
"def check_scheme(v)\n if v && parser.regexp[:SCHEME] !~ v\n raise InvalidComponentError,\n \"bad compon... | [
"0.79676795",
"0.71435565",
"0.69996136",
"0.6875655",
"0.65466785",
"0.63624704",
"0.6169945",
"0.6165513",
"0.60344076",
"0.599392",
"0.5908603",
"0.5883607",
"0.58599144",
"0.57534915",
"0.5743679",
"0.5719243",
"0.57147217",
"0.5713936",
"0.5712693",
"0.56328726",
"0.5625... | 0.75271386 | 1 |
Checks the +user+ and +password+. If +password+ is not provided, then +user+ is split, using URI::Generic.split_userinfo, to pull +user+ and +password. See also URI::Generic.check_user, URI::Generic.check_password. | def check_userinfo(user, password = nil)
if !password
user, password = split_userinfo(user)
end
check_user(user)
check_password(password, user)
return true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_user?\n params['username'] && params['password']\n end",
"def authenticate!\n if params[:user]\n user = User.find_by(email: params[:user][:user_name])\n if user and user.local? and user.valid_password?(params[:user][:password])\n success!(user)\n els... | [
"0.6493669",
"0.64920044",
"0.64266497",
"0.63125145",
"0.6250733",
"0.62463874",
"0.6209715",
"0.6161628",
"0.6161101",
"0.61323655",
"0.6113018",
"0.601542",
"0.5989778",
"0.5971789",
"0.5918881",
"0.5916346",
"0.5912696",
"0.58953625",
"0.5861445",
"0.5858785",
"0.5853895"... | 0.74464345 | 0 |
Checks the user +v+ component for RFC2396 compliance and against the URI::Parser Regexp for :USERINFO. Can not have a registry or opaque component defined, with a user component defined. | def check_user(v)
if @opaque
raise InvalidURIError,
"can not set user with opaque"
end
return v unless v
if parser.regexp[:USERINFO] !~ v
raise InvalidComponentError,
"bad component(expected userinfo component or user component): #{v}"
end
retur... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_password(v, user = @user)\n if @opaque\n raise InvalidURIError,\n \"can not set password with opaque\"\n end\n return v unless v\n\n if !user\n raise InvalidURIError,\n \"password component depends user component\"\n end\n\n if parser.regexp[:... | [
"0.64419204",
"0.57660884",
"0.5510601",
"0.53443956",
"0.5228902",
"0.5215626",
"0.50689316",
"0.49811852",
"0.4959856",
"0.4952268",
"0.49123582",
"0.49017164",
"0.48667628",
"0.4861258",
"0.48549664",
"0.48549384",
"0.48437113",
"0.4843059",
"0.48321858",
"0.48298603",
"0.... | 0.7997965 | 0 |
Checks the password +v+ component for RFC2396 compliance and against the URI::Parser Regexp for :USERINFO. Can not have a registry or opaque component defined, with a user component defined. | def check_password(v, user = @user)
if @opaque
raise InvalidURIError,
"can not set password with opaque"
end
return v unless v
if !user
raise InvalidURIError,
"password component depends user component"
end
if parser.regexp[:USERINFO] !~ v
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_user(v)\n if @opaque\n raise InvalidURIError,\n \"can not set user with opaque\"\n end\n\n return v unless v\n\n if parser.regexp[:USERINFO] !~ v\n raise InvalidComponentError,\n \"bad component(expected userinfo component or user component): #{v}\"\n ... | [
"0.72213584",
"0.66599727",
"0.6051531",
"0.5557178",
"0.5553643",
"0.5532752",
"0.5491996",
"0.546365",
"0.54389447",
"0.5431008",
"0.5394161",
"0.5354933",
"0.53312165",
"0.52998495",
"0.5293812",
"0.5289003",
"0.52817106",
"0.5259777",
"0.52508926",
"0.52119195",
"0.521097... | 0.81759244 | 0 |
Sets userinfo, argument is string like 'name:pass'. | def userinfo=(userinfo)
if userinfo.nil?
return nil
end
check_userinfo(*userinfo)
set_userinfo(*userinfo)
# returns userinfo
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_userinfo(user, password = nil)\n unless password\n user, password = split_userinfo(user)\n end\n @user = user\n @password = password if password\n\n [@user, @password]\n end",
"def set_user(v)\n set_userinfo(v, @password)\n v\n end",
"def set_user_inf... | [
"0.77813035",
"0.69337714",
"0.6883072",
"0.6855671",
"0.6823048",
"0.68086195",
"0.68078613",
"0.68078613",
"0.68078613",
"0.68078613",
"0.68078613",
"0.68078613",
"0.68078613",
"0.66973066",
"0.66296613",
"0.6628813",
"0.6569158",
"0.6560548",
"0.65339226",
"0.6527675",
"0.... | 0.7272811 | 1 |
== Args +v+:: String == Description Public setter for the +user+ component (with validation). See also URI::Generic.check_user. == Usage require 'uri' | def user=(user)
check_user(user)
set_user(user)
# returns user
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_user(v)\n if @opaque\n raise InvalidURIError,\n \"can not set user with opaque\"\n end\n\n return v unless v\n\n if parser.regexp[:USERINFO] !~ v\n raise InvalidComponentError,\n \"bad component(expected userinfo component or user component): #{v}\"\n ... | [
"0.68361527",
"0.66879445",
"0.66879445",
"0.6654161",
"0.6498387",
"0.6413163",
"0.6413163",
"0.6413163",
"0.6413163",
"0.6413163",
"0.6413163",
"0.6413163",
"0.6413058",
"0.63811046",
"0.63421875",
"0.62565976",
"0.6249742",
"0.62459683",
"0.6242737",
"0.6220003",
"0.617803... | 0.6120128 | 23 |
== Args +v+:: String == Description Public setter for the +password+ component (with validation). See also URI::Generic.check_password. == Usage require 'uri' | def password=(password)
check_password(password)
set_password(password)
# returns password
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_password(v)\n @password = v\n # returns v\n end",
"def password=(arg)\n raise ArgumentError, \"password expected a string, not a #{arg.class}\" unless arg.is_a?(String)\n @password=arg\n end",
"def password=(value)\n @password = value\n end",
"def p... | [
"0.8005977",
"0.75353676",
"0.7460047",
"0.7393726",
"0.7234291",
"0.7215127",
"0.71434546",
"0.7141453",
"0.71321297",
"0.7089165",
"0.7074733",
"0.7069613",
"0.6961331",
"0.6953765",
"0.6925459",
"0.68923014",
"0.68923014",
"0.68923014",
"0.68923014",
"0.6886412",
"0.681795... | 0.67061317 | 38 |
Protected setter for the +user+ component, and +password+ if available (with validation). See also URI::Generic.userinfo=. | def set_userinfo(user, password = nil)
unless password
user, password = split_userinfo(user)
end
@user = user
@password = password if password
[@user, @password]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_auth(user, password)\n @user = user\n @password = password\n end",
"def set_user(v)\n set_userinfo(v, @password)\n v\n end",
"def user=(the_user)\n authentication.user = the_user\n end",
"def set_http_basic_user(user, password = nil)\n if user.nil?\n request.... | [
"0.7288826",
"0.68877447",
"0.67860895",
"0.6724524",
"0.6664167",
"0.6550883",
"0.6550883",
"0.65134144",
"0.6491516",
"0.644938",
"0.6417427",
"0.6413821",
"0.6410017",
"0.6347888",
"0.6338165",
"0.6338165",
"0.63046753",
"0.6296173",
"0.6292043",
"0.62910086",
"0.627919",
... | 0.72778064 | 1 |
Protected setter for the user component +v+. See also URI::Generic.user=. | def set_user(v)
set_userinfo(v, @password)
v
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user=(value)\n @user = value\n end",
"def user=(value)\n @user = value\n end",
"def user=(usr)\n raise 'You must pass a User class' unless usr.is_a?(User)\n @user = usr\n end",
"def user=(the_user)\n authentication.user = the_user\n ... | [
"0.75866926",
"0.75866926",
"0.7107435",
"0.6989968",
"0.697831",
"0.6953789",
"0.6909397",
"0.6909397",
"0.6909397",
"0.6909397",
"0.6909397",
"0.6909397",
"0.6909397",
"0.6909261",
"0.68808955",
"0.6846655",
"0.67653006",
"0.6753911",
"0.67404026",
"0.6695684",
"0.66715616"... | 0.7704162 | 0 |
Protected setter for the password component +v+. See also URI::Generic.password=. | def set_password(v)
@password = v
# returns v
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def password=(value)\n @password = value\n end",
"def password=(value)\n\t\t\t@password = value\n\t\tend",
"def password(value)\n @config[:password] = value\n end",
"def password=(value)\n if value.to_s.blank?\n @password = nil\n @password_updated = ... | [
"0.8008615",
"0.7985561",
"0.7643238",
"0.75525373",
"0.755146",
"0.7536789",
"0.7515455",
"0.74596536",
"0.744784",
"0.74166185",
"0.7412748",
"0.7397701",
"0.7397701",
"0.7397701",
"0.7362995",
"0.73409545",
"0.73409545",
"0.73409545",
"0.73409545",
"0.73409545",
"0.7340954... | 0.8544602 | 0 |
Returns the userinfo +ui+ as [user, password] if properly formatted as 'user:password'. | def split_userinfo(ui)
return nil, nil unless ui
user, password = ui.split(':', 2)
return user, password
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def userinfo\n if @user.nil?\n nil\n elsif @password.nil?\n @user\n else\n @user + ':' + @password\n end\n end",
"def normalized_userinfo\n normalized_user + (password ? \":#{normalized_password}\" : \"\") if userinfo\n end",
"def build_userinfo\n @passw... | [
"0.72650295",
"0.68958604",
"0.67905945",
"0.66392267",
"0.6632427",
"0.66205895",
"0.65507734",
"0.64894265",
"0.6397249",
"0.6391371",
"0.6375511",
"0.63160634",
"0.62957156",
"0.62957156",
"0.62837166",
"0.62756383",
"0.6270927",
"0.610354",
"0.610106",
"0.60811466",
"0.59... | 0.8196607 | 0 |
Escapes 'user:password' +v+ based on RFC 1738 section 3.1. | def escape_userpass(v)
parser.escape(v, /[@:\/]/o) # RFC 1738 section 3.1 #/
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_password_special_characters\n skip_legacy_defect?('7.3.[012].(N1|D1)',\n 'CSCuy87970: NXAPI incorrect backslash escape')\n # N6k output may triple-escape forward slashes. For now simplify pattern.\n test_pass = node.product_id[/N[56]/] ? 'hello!//#%$x' : 'hello!//\\\\#%$x'\... | [
"0.64139074",
"0.6357466",
"0.59449613",
"0.5832973",
"0.5805705",
"0.5783252",
"0.57415587",
"0.56872094",
"0.5656756",
"0.56153363",
"0.56072986",
"0.55734146",
"0.55734146",
"0.55567867",
"0.55457157",
"0.5485869",
"0.5382727",
"0.53591955",
"0.5350999",
"0.53481007",
"0.5... | 0.84723645 | 0 |
Returns the userinfo, either as 'user' or 'user:password'. | def userinfo
if @user.nil?
nil
elsif @password.nil?
@user
else
@user + ':' + @password
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_info\n auth_hash['user_info']\n end",
"def normalized_userinfo\n normalized_user + (password ? \":#{normalized_password}\" : \"\") if userinfo\n end",
"def user_info\n @user_info ||= raw_info\n end",
"def user_info\n @user_info ||= raw_info.nil? ? {} : raw_... | [
"0.7914473",
"0.7900556",
"0.7746407",
"0.7724853",
"0.7724853",
"0.7579874",
"0.7575744",
"0.7510933",
"0.74961954",
"0.7438122",
"0.73572665",
"0.73058915",
"0.7183769",
"0.71566623",
"0.7043178",
"0.7040307",
"0.70220953",
"0.6942876",
"0.6918292",
"0.6887994",
"0.68628156... | 0.8752616 | 0 |
Returns the user component. | def user
@user
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user\r\n return for_context(nil, false) { |c| c.user }\r\n end",
"def user\n return Etc.getlogin\n end",
"def user\n\t\t\treturn nil if ! logged_in?\n\n\t\t\tPicombo::Session.instance.get('user')\n\t\tend",
"def getUser()\n\t\treturn @user\n\tend",
"def user\n return @user ? @user ... | [
"0.7227141",
"0.71115446",
"0.71070796",
"0.7018703",
"0.7016232",
"0.69561976",
"0.69561976",
"0.6921809",
"0.69186324",
"0.69186324",
"0.69057477",
"0.6894407",
"0.682486",
"0.6773842",
"0.6691424",
"0.66825914",
"0.66653085",
"0.66509414",
"0.6636532",
"0.6621592",
"0.6616... | 0.68642616 | 12 |
Returns the password component. | def password
@password
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def password\n\t\tPassword.new( attribute_get(:password) )\n\tend",
"def password\n return @password\n end",
"def getPassword()\n return @password\n\tend",
"def password\n @password ||= match[4]\n end",
"def password\n return @password\n end",
... | [
"0.8008156",
"0.7977221",
"0.78880525",
"0.7876644",
"0.78658444",
"0.78574294",
"0.78574294",
"0.78493583",
"0.78179914",
"0.7817961",
"0.78139925",
"0.78139925",
"0.7777868",
"0.77614677",
"0.77542436",
"0.7652029",
"0.7591734",
"0.7589327",
"0.7542575",
"0.7498106",
"0.749... | 0.77163506 | 16 |
Checks the host +v+ component for RFC2396 compliance and against the URI::Parser Regexp for :HOST. Can not have a registry or opaque component defined, with a host component defined. | def check_host(v)
return v unless v
if @opaque
raise InvalidURIError,
"can not set host with registry or opaque"
elsif parser.regexp[:HOST] !~ v
raise InvalidComponentError,
"bad component(expected host component): #{v}"
end
return true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_host_header(value)\n # allow only valid hostnames\n value.match?(host_regex) && !value.match?(/_/)\n end",
"def build_host_string_check(hostname)\n @host_check = lambda do |url|\n if url.host != hostname\n [422, {}, \"URL must be from #{hostname}\"]\n e... | [
"0.72238624",
"0.66453844",
"0.65551",
"0.6475743",
"0.638906",
"0.63589054",
"0.625324",
"0.6237657",
"0.6221405",
"0.60889006",
"0.6050064",
"0.59736246",
"0.59721154",
"0.5971369",
"0.5969783",
"0.5966085",
"0.59196854",
"0.5916507",
"0.59049016",
"0.58931077",
"0.58819294... | 0.84235203 | 0 |
Protected setter for the host component +v+. See also URI::Generic.host=. | def set_host(v)
@host = v
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def host=(v)\n check_host(v)\n set_host(v)\n v\n end",
"def hostname=(v)\n v = \"[#{v}]\" if !(v&.start_with?('[') && v&.end_with?(']')) && v&.index(':')\n self.host = v\n end",
"def host(new_host)\n unless host_valid? new_host\n raise Urb::InvalidUrl 'Try to set a in... | [
"0.82512075",
"0.78800386",
"0.787303",
"0.7835617",
"0.7835617",
"0.7708645",
"0.7634277",
"0.75860584",
"0.75829846",
"0.74782133",
"0.7365905",
"0.73029256",
"0.72552556",
"0.7104667",
"0.7027131",
"0.7012285",
"0.6993946",
"0.6975767",
"0.6961896",
"0.69424313",
"0.693623... | 0.8047738 | 1 |
== Args +v+:: String == Description Public setter for the host component +v+ (with validation). See also URI::Generic.check_host. == Usage require 'uri' uri = URI.parse(" uri.host = "foo.com" uri.to_s => " | def host=(v)
check_host(v)
set_host(v)
v
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hostname=(v)\n v = \"[#{v}]\" if !(v&.start_with?('[') && v&.end_with?(']')) && v&.index(':')\n self.host = v\n end",
"def host(new_host)\n unless host_valid? new_host\n raise Urb::InvalidUrl 'Try to set a invalid value to host'\n end\n\n @host = new_host\n\n self\n ... | [
"0.7491091",
"0.74479705",
"0.7161546",
"0.712417",
"0.70848876",
"0.6920762",
"0.6835933",
"0.673067",
"0.6682886",
"0.6682886",
"0.65927047",
"0.64154816",
"0.640511",
"0.6375588",
"0.63368744",
"0.6321557",
"0.62664133",
"0.6233016",
"0.621928",
"0.6204922",
"0.6191002",
... | 0.72798824 | 2 |
Extract the host part of the URI and unwrap brackets for IPv6 addresses. This method is the same as URI::Generichost except brackets for IPv6 (and future IP) addresses are removed. uri = URI(" uri.hostname => "::1" uri.host => "[::1]" | def hostname
v = self.host
v&.start_with?('[') && v.end_with?(']') ? v[1..-2] : v
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def uri(*parts)\n # If an absolute URI already\n return parts.first if parts.first.is_a?(URI) && parts.first.host\n\n joined = [url, *parts].map(&:to_s).reject(&:empty?) * '/'\n\n URI.parse(joined)\n end",
"def host_and_path(uri)\n uri = URI.parse(uri) unless uri.is_a? URI\n... | [
"0.64463276",
"0.64117265",
"0.63239133",
"0.62749237",
"0.62749237",
"0.62317204",
"0.62317204",
"0.61973965",
"0.619452",
"0.6088612",
"0.60619795",
"0.6058299",
"0.60581857",
"0.6014825",
"0.59875137",
"0.5961793",
"0.5954475",
"0.59255135",
"0.57826227",
"0.57552636",
"0.... | 0.5769356 | 19 |
Sets the host part of the URI as the argument with brackets for IPv6 addresses. This method is the same as URI::Generichost= except the argument can be a bare IPv6 address. uri = URI(" uri.hostname = "::1" uri.to_s => " If the argument seems to be an IPv6 address, it is wrapped with brackets. | def hostname=(v)
v = "[#{v}]" if !(v&.start_with?('[') && v&.end_with?(']')) && v&.index(':')
self.host = v
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def host_set(host)\n rebuild_uri :host => host\n end",
"def host(new_host)\n unless host_valid? new_host\n raise Urb::InvalidUrl 'Try to set a invalid value to host'\n end\n\n @host = new_host\n\n self\n end",
"def ssh_uri\n unless @uri.host\n raise(InvalidConfig,\... | [
"0.7019621",
"0.6535389",
"0.6214547",
"0.61841595",
"0.61746126",
"0.5970244",
"0.59205675",
"0.58915174",
"0.58450943",
"0.5831328",
"0.58174103",
"0.5799591",
"0.57767034",
"0.5747468",
"0.5717897",
"0.5716234",
"0.5711682",
"0.5705286",
"0.5705286",
"0.5692876",
"0.567725... | 0.64304024 | 2 |
Checks the port +v+ component for RFC2396 compliance and against the URI::Parser Regexp for :PORT. Can not have a registry or opaque component defined, with a port component defined. | def check_port(v)
return v unless v
if @opaque
raise InvalidURIError,
"can not set port with registry or opaque"
elsif !v.kind_of?(Integer) && parser.regexp[:PORT] !~ v
raise InvalidComponentError,
"bad component(expected port component): #{v.inspect}"
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def visit_port?(port)\n @port_rules.accept?(port)\n end",
"def check_port(port)\n (port < 8000 || port > 65535) ? nil : port\n end",
"def port=(v)\n check_port(v)\n set_port(v)\n port\n end",
"def set_port(v)\n v = v.empty? ? nil : v.to_i unless !v || v.kind_of?(Integer... | [
"0.6915574",
"0.64527965",
"0.63045704",
"0.6295912",
"0.62611866",
"0.62464315",
"0.62133414",
"0.6130487",
"0.61098737",
"0.6092005",
"0.6063276",
"0.6061467",
"0.60003656",
"0.5988938",
"0.5924198",
"0.5915855",
"0.59100425",
"0.5856105",
"0.57670623",
"0.5749416",
"0.5744... | 0.85673577 | 0 |
Protected setter for the port component +v+. See also URI::Generic.port=. | def set_port(v)
v = v.empty? ? nil : v.to_i unless !v || v.kind_of?(Integer)
@port = v
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def port=(v)\n check_port(v)\n set_port(v)\n port\n end",
"def port=(p)\n attributes['port'] = p.to_s\n end",
"def port(new_port)\n unless port_valid? new_port\n raise Urb::InvalidUrl 'Try to set a invalid value to port'\n end\n\n @port = new_port\n\n se... | [
"0.8562578",
"0.8006245",
"0.7886444",
"0.75775087",
"0.74598986",
"0.7457586",
"0.74163675",
"0.733367",
"0.72661704",
"0.72510004",
"0.7177212",
"0.71426296",
"0.7140428",
"0.70419097",
"0.7038654",
"0.6984274",
"0.6964664",
"0.6950984",
"0.6876374",
"0.68641233",
"0.682409... | 0.8327307 | 1 |
== Args +v+:: String == Description Public setter for the port component +v+ (with validation). See also URI::Generic.check_port. == Usage require 'uri' uri = URI.parse(" uri.port = 8080 uri.to_s => " | def port=(v)
check_port(v)
set_port(v)
port
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_port(v)\n v = v.empty? ? nil : v.to_i unless !v || v.kind_of?(Integer)\n @port = v\n end",
"def port(new_port)\n unless port_valid? new_port\n raise Urb::InvalidUrl 'Try to set a invalid value to port'\n end\n\n @port = new_port\n\n self\n end",
"def check_por... | [
"0.7656025",
"0.7351945",
"0.7349574",
"0.7148364",
"0.70105356",
"0.68978965",
"0.6809563",
"0.6761821",
"0.6633273",
"0.65371555",
"0.6529675",
"0.6518542",
"0.64476174",
"0.6370042",
"0.63669604",
"0.63338256",
"0.63044",
"0.6303858",
"0.6287817",
"0.61919284",
"0.6164371"... | 0.7493497 | 1 |
Checks the path +v+ component for RFC2396 compliance and against the URI::Parser Regexp for :ABS_PATH and :REL_PATH. Can not have a opaque component defined, with a path component defined. | def check_path(v)
# raise if both hier and opaque are not nil, because:
# absoluteURI = scheme ":" ( hier_part | opaque_part )
# hier_part = ( net_path | abs_path ) [ "?" query ]
if v && @opaque
raise InvalidURIError,
"path conflicts with opaque"
end
# If sch... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check candidate_path\n # Convert dynamic segments into regexp captures\n matchable_path = candidate_path.gsub(/:\\w+/, '([^/]+)')\n\n # Don't match a partial segment. For example,\n # don't match /widget for /widgets.\n path.match(Regexp.new(\"^/?#{matchable_path}(?:/|$)\"))\n end",... | [
"0.64378935",
"0.624742",
"0.59681785",
"0.58785367",
"0.5873979",
"0.5847737",
"0.58151096",
"0.58026874",
"0.5749105",
"0.5729306",
"0.5700281",
"0.56860095",
"0.5599623",
"0.5596504",
"0.5589776",
"0.55774",
"0.55503345",
"0.5518424",
"0.5499649",
"0.5407271",
"0.5402175",... | 0.82920104 | 0 |
Protected setter for the path component +v+. See also URI::Generic.path=. | def set_path(v)
@path = v
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def path=(v)\n check_path(v)\n set_path(v)\n v\n end",
"def path(v)\n endpoint_info[:path] = v\n end",
"def set_path(v)\n super(\"/\" + v.sub(/^\\//, \"%2F\"))\n end",
"def path=(value)\n @path = value\n end",
"def path=(value)\n @path = valu... | [
"0.8441984",
"0.7875266",
"0.7824563",
"0.7520598",
"0.7500069",
"0.7500069",
"0.7500069",
"0.743742",
"0.71994376",
"0.71453696",
"0.70696175",
"0.70596766",
"0.6919511",
"0.68730503",
"0.6872134",
"0.6872134",
"0.6872134",
"0.6872134",
"0.6872134",
"0.6872134",
"0.6822113",... | 0.8407826 | 1 |
== Args +v+:: String == Description Public setter for the path component +v+ (with validation). See also URI::Generic.check_path. == Usage require 'uri' uri = URI.parse(" uri.path = "/faq/" uri.to_s => " | def path=(v)
check_path(v)
set_path(v)
v
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_path(v)\n @path = v\n end",
"def set_path(v)\n super(\"/\" + v.sub(/^\\//, \"%2F\"))\n end",
"def path=( value )\n self.path_matcher = self.class.compile_matcher value\n super( value )\n end",
"def check_path(v)\n # raise if both hier and opaque are not nil, because:\n ... | [
"0.70644534",
"0.7006868",
"0.65974295",
"0.6583953",
"0.6564097",
"0.6550186",
"0.64118606",
"0.6238464",
"0.6238464",
"0.6238464",
"0.6238464",
"0.6238464",
"0.6238464",
"0.61177135",
"0.60729676",
"0.60729676",
"0.60729676",
"0.6064145",
"0.6064145",
"0.60158056",
"0.60022... | 0.71301144 | 0 |
== Args +v+:: String == Description Public setter for the query component +v+. == Usage require 'uri' uri = URI.parse(" uri.query = "id=1" uri.to_s => " | def query=(v)
return @query = nil unless v
raise InvalidURIError, "query conflicts with opaque" if @opaque
x = v.to_str
v = x.dup if x.equal? v
v.encode!(Encoding::UTF_8) rescue nil
v.delete!("\t\r\n")
v.force_encoding(Encoding::ASCII_8BIT)
raise InvalidURIError, "invali... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def query=( uri )\n @query = Addressable::URI.parse( uri.to_s )\n #self.query = URI.parse( uri.to_s )\n uri\n end",
"def query_set(name, value)\n query = uri.query ? \"&#{uri.query}&\" : ''\n parameter = Regexp.new(\"&#{Regexp.escape name}=.+?&\")\n if query =~ parameter\n new_query =... | [
"0.748344",
"0.68506014",
"0.68047386",
"0.66429067",
"0.6482679",
"0.63597554",
"0.63101184",
"0.6309975",
"0.6309975",
"0.6309975",
"0.6309975",
"0.6309975",
"0.6309975",
"0.6309975",
"0.6309975",
"0.6309975",
"0.6309975",
"0.6309975",
"0.6309975",
"0.6309975",
"0.6309975",... | 0.77000535 | 0 |
Checks the opaque +v+ component for RFC2396 compliance and against the URI::Parser Regexp for :OPAQUE. Can not have a host, port, user, or path component defined, with an opaque component defined. | def check_opaque(v)
return v unless v
# raise if both hier and opaque are not nil, because:
# absoluteURI = scheme ":" ( hier_part | opaque_part )
# hier_part = ( net_path | abs_path ) [ "?" query ]
if @host || @port || @user || @path # userinfo = @user + ':' + @password
ra... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_host(v)\n return v unless v\n\n if @opaque\n raise InvalidURIError,\n \"can not set host with registry or opaque\"\n elsif parser.regexp[:HOST] !~ v\n raise InvalidComponentError,\n \"bad component(expected host component): #{v}\"\n end\n\n return ... | [
"0.70593506",
"0.6926627",
"0.64252526",
"0.638495",
"0.6249724",
"0.5755586",
"0.557522",
"0.5535808",
"0.547161",
"0.547161",
"0.5345081",
"0.527311",
"0.52545965",
"0.5230908",
"0.51755494",
"0.5160729",
"0.515291",
"0.51236856",
"0.51016605",
"0.5100972",
"0.50612485",
... | 0.8560135 | 0 |
Protected setter for the opaque component +v+. See also URI::Generic.opaque=. | def set_opaque(v)
@opaque = v
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def opaque=(v)\n check_opaque(v)\n set_opaque(v)\n v\n end",
"def check_opaque(v)\n return v unless v\n\n # raise if both hier and opaque are not nil, because:\n # absoluteURI = scheme \":\" ( hier_part | opaque_part )\n # hier_part = ( net_path | abs_path ) [ \"?\" qu... | [
"0.8722777",
"0.71148455",
"0.62433094",
"0.62433094",
"0.5959692",
"0.5926727",
"0.5785277",
"0.57169074",
"0.51065195",
"0.5011122",
"0.49726474",
"0.49726474",
"0.49601802",
"0.49558407",
"0.49238044",
"0.49187195",
"0.4862112",
"0.4852669",
"0.48230788",
"0.48192543",
"0.... | 0.83195126 | 1 |
== Args +v+:: String == Description Public setter for the opaque component +v+ (with validation). See also URI::Generic.check_opaque. | def opaque=(v)
check_opaque(v)
set_opaque(v)
v
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_opaque(v)\n return v unless v\n\n # raise if both hier and opaque are not nil, because:\n # absoluteURI = scheme \":\" ( hier_part | opaque_part )\n # hier_part = ( net_path | abs_path ) [ \"?\" query ]\n if @host || @port || @user || @path # userinfo = @user + ':' + @pass... | [
"0.7628915",
"0.7561535",
"0.6153022",
"0.582151",
"0.5757566",
"0.5757566",
"0.57024515",
"0.5521138",
"0.5352109",
"0.5232628",
"0.52141213",
"0.52134246",
"0.52134246",
"0.5204076",
"0.5142673",
"0.5067795",
"0.49305087",
"0.4902316",
"0.4875522",
"0.4872035",
"0.48577565"... | 0.80077 | 0 |
Checks the fragment +v+ component against the URI::Parser Regexp for :FRAGMENT. == Args +v+:: String == Description Public setter for the fragment component +v+ (with validation). == Usage require 'uri' uri = URI.parse(" uri.fragment = "time=1305212086" uri.to_s => " | def fragment=(v)
return @fragment = nil unless v
x = v.to_str
v = x.dup if x.equal? v
v.encode!(Encoding::UTF_8) rescue nil
v.delete!("\t\r\n")
v.force_encoding(Encoding::ASCII_8BIT)
v.gsub!(/(?!%\h\h|[!-~])./n){'%%%02X' % $&.ord}
v.force_encoding(Encoding::US_ASCII)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fragment(string); end",
"def process_fragment(fragment)\n Types.check( binding, { :fragment => Fragment } )\n\n if Blank === fragment\n then process_blank(fragment)\n else process_nonblank(fragment)\n end\n end",
"def fragment_set(fragment)\n rebuild_uri :fragment => fragment... | [
"0.57669526",
"0.56610334",
"0.55955225",
"0.54929817",
"0.5294934",
"0.5251019",
"0.5147447",
"0.51048684",
"0.5061711",
"0.50575525",
"0.5050615",
"0.50305647",
"0.5014902",
"0.500318",
"0.49806207",
"0.490124",
"0.4892301",
"0.48749903",
"0.48620638",
"0.4830397",
"0.48170... | 0.6668184 | 0 |
Returns true if URI is hierarchical. == Description URI has components listed in order of decreasing significance from left to right, see RFC3986 1.2.3. == Usage require 'uri' uri = URI.parse(" uri.hierarchical? => true | def hierarchical?
if @path
true
else
false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hierarchical?\n @hierarchical ||= !klass.fact_model.hierarchical_levels.empty?\n end",
"def hierarchical?\n false\n end",
"def hierarchical?()\n return self.id =~ /\\Ahl_/i\n end",
"def uri?\n children[0] && children[0].is_a?(Uri)\n end",
"def hier?\n !N... | [
"0.70829713",
"0.7068361",
"0.6711387",
"0.646997",
"0.5979575",
"0.594155",
"0.58137995",
"0.5753",
"0.5672801",
"0.5615062",
"0.5610776",
"0.5566197",
"0.55621105",
"0.55442774",
"0.55390537",
"0.5520135",
"0.54954666",
"0.5467368",
"0.5465846",
"0.54382896",
"0.54382896",
... | 0.7331051 | 0 |
Returns true if URI has a scheme (e.g. http:// or specified. | def absolute?
if @scheme
true
else
false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_scheme?\n !invalid_uri_error? && (@valid_schemes.include?(@scheme))\n end",
"def uri?(string)\n uri = URI.parse(string)\n %w[http https].include?(uri.scheme)\n rescue URI::BadURIError, URI::InvalidURIError\n false\n end",
"def uri?(string)\n\t\turi = URI.parse(string)\n\t\t%w( http... | [
"0.82262695",
"0.7943339",
"0.78138757",
"0.77236193",
"0.77236193",
"0.7706098",
"0.7702858",
"0.76577336",
"0.7646019",
"0.74471074",
"0.7421598",
"0.7384725",
"0.7235178",
"0.7221709",
"0.72124743",
"0.71829265",
"0.71043015",
"0.709392",
"0.7055619",
"0.69892436",
"0.6960... | 0.64835644 | 65 |
Returns true if URI does not have a scheme (e.g. http:// or specified. | def relative?
!absolute?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def invalid_uri?(uri)\n uri.grep(/^(#{PROTOCOLS.join('|')}):\\/\\/\\w/).empty?\n end",
"def valid_scheme?\n !invalid_uri_error? && (@valid_schemes.include?(@scheme))\n end",
"def uri?(string)\n uri = URI.parse(string)\n %w[http https].include?(uri.scheme)\n rescue URI::BadURIError, U... | [
"0.8377978",
"0.7775505",
"0.7633831",
"0.75863045",
"0.75863045",
"0.7581267",
"0.7576583",
"0.7575907",
"0.7555477",
"0.74815536",
"0.7462202",
"0.7272876",
"0.7250147",
"0.7242336",
"0.7126791",
"0.7113625",
"0.70331746",
"0.70278466",
"0.6982743",
"0.6972627",
"0.6925304"... | 0.0 | -1 |
Returns an Array of the path split on '/'. | def split_path(path)
path.split("/", -1)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def path_comps path\n path.nil? || path.empty? ? [] : path[1..(path[-1] == \"/\" ? -2 : -1)].split('/')\n end",
"def split(path)\n array = path.kind_of?(String) ? path.split(\"/\") : path.dup\n array.shift if nil_or_empty_string?(array[0])\n array.pop if nil_or_empty_string?(array[-1])... | [
"0.7922491",
"0.79163176",
"0.78624445",
"0.77075857",
"0.75403506",
"0.74706376",
"0.7410542",
"0.73919934",
"0.73919934",
"0.73762286",
"0.73604816",
"0.7303747",
"0.72815233",
"0.72263706",
"0.7071485",
"0.70159197",
"0.70159197",
"0.7007709",
"0.69725156",
"0.6954645",
"0... | 0.77527 | 3 |
Merges a base path +base+, with relative path +rel+, returns a modified base path. | def merge_path(base, rel)
# RFC2396, Section 5.2, 5)
# RFC2396, Section 5.2, 6)
base_path = split_path(base)
rel_path = split_path(rel)
# RFC2396, Section 5.2, 6), a)
base_path << '' if base_path.last == '..'
while i = base_path.index('..')
base_path.slice!(i - 1, 2)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def relative_path path, base\n (root? path) && (offset = descends_from? path, base) ? (path.slice offset, path.length) : path\n end",
"def path_join(base, path)\n return path if path_is_absolute(path)\n base.gsub(/[\\/]+$/, '') + '/' + path.gsub(/^[\\/]+/, '')\n end",
"def rebase(base_path)\n ... | [
"0.63090324",
"0.6047063",
"0.6027463",
"0.56859994",
"0.5667761",
"0.5666103",
"0.5664497",
"0.5557316",
"0.55454105",
"0.5484821",
"0.5442822",
"0.53517014",
"0.5331719",
"0.529659",
"0.52941227",
"0.5251224",
"0.52482504",
"0.51884425",
"0.51660687",
"0.5157106",
"0.514346... | 0.7384038 | 0 |
== Args +oth+:: URI or String == Description Destructive form of merge. == Usage require 'uri' uri = URI.parse(" uri.merge!("/main.rbx?page=1") uri.to_s => " | def merge!(oth)
t = merge(oth)
if self == t
nil
else
replace!(t)
self
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def merge(oth)\n rel = parser.__send__(:convert_to_uri, oth)\n\n if rel.absolute?\n #raise BadURIError, \"both URI are absolute\" if absolute?\n # hmm... should return oth for usability?\n return rel\n end\n\n unless self.absolute?\n raise BadURIError, \"both URI are... | [
"0.71001947",
"0.6956662",
"0.5450591",
"0.544652",
"0.5307507",
"0.52980685",
"0.5249979",
"0.52290404",
"0.52245826",
"0.51685727",
"0.51624537",
"0.51618636",
"0.51618636",
"0.51618636",
"0.51618636",
"0.51380754",
"0.5126943",
"0.50880134",
"0.50603163",
"0.5059134",
"0.5... | 0.49765566 | 44 |
== Args +oth+:: URI or String == Description Merges two URIs. == Usage require 'uri' uri = URI.parse(" uri.merge("/main.rbx?page=1") => " | def merge(oth)
rel = parser.__send__(:convert_to_uri, oth)
if rel.absolute?
#raise BadURIError, "both URI are absolute" if absolute?
# hmm... should return oth for usability?
return rel
end
unless self.absolute?
raise BadURIError, "both URI are relative"
e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def merge(oth)\n rel = parser.send(:convert_to_uri, oth)\n\n if rel.absolute?\n #raise BadURIError, \"both URI are absolute\" if absolute?\n # hmm... should return oth for usability?\n return rel\n end\n\n unless self.absolute?\n raise BadURIError, \"both URI are rel... | [
"0.7386355",
"0.6371943",
"0.6371943",
"0.61687064",
"0.593384",
"0.57150966",
"0.56212026",
"0.55313736",
"0.5508176",
"0.55036247",
"0.55036247",
"0.54538786",
"0.5447251",
"0.5440659",
"0.5432746",
"0.5416397",
"0.5351233",
"0.5332124",
"0.5306913",
"0.5286242",
"0.5220604... | 0.7531991 | 0 |
:startdoc: == Args +oth+:: URI or String == Description Calculates relative path from oth to self. == Usage require 'uri' uri = URI.parse(' uri.route_from(' => | def route_from(oth)
# you can modify `rel', but can not `oth'.
begin
oth, rel = route_from0(oth)
rescue
raise $!.class, $!.message
end
if oth == rel
return rel
end
rel.set_path(route_from_path(oth.path, self.path))
if rel.path == './' && self.quer... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def route_to(oth)\n parser.__send__(:convert_to_uri, oth).route_from(self)\n end",
"def relative_path_from(from); end",
"def relative_path(from, to); end",
"def to_relative_uri\n build_uri.route_from base_value\n end",
"def go_relative(uri)\n self.location = relative_uri(uri)\n ... | [
"0.7694296",
"0.7087943",
"0.6938702",
"0.68268716",
"0.6173084",
"0.59891945",
"0.5980258",
"0.5980258",
"0.5964621",
"0.5895889",
"0.5852862",
"0.5835591",
"0.5781328",
"0.5768239",
"0.57280093",
"0.57280093",
"0.56901914",
"0.5685183",
"0.5675095",
"0.5670675",
"0.56691736... | 0.770406 | 0 |
== Args +oth+:: URI or String == Description Calculates relative path to oth from self. == Usage require 'uri' uri = URI.parse(' uri.route_to(' => | def route_to(oth)
parser.__send__(:convert_to_uri, oth).route_from(self)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def route_from(oth)\n # you can modify `rel', but can not `oth'.\n begin\n oth, rel = route_from0(oth)\n rescue\n raise $!.class, $!.message\n end\n if oth == rel\n return rel\n end\n\n rel.set_path(route_from_path(oth.path, self.path))\n if rel.path == ... | [
"0.7583396",
"0.6830356",
"0.6764373",
"0.6403376",
"0.6294455",
"0.59947884",
"0.5969458",
"0.5955398",
"0.5945045",
"0.5879934",
"0.5878927",
"0.58581203",
"0.58561677",
"0.58195275",
"0.5761035",
"0.5748028",
"0.57363576",
"0.57363576",
"0.5731004",
"0.57041335",
"0.569955... | 0.81928563 | 0 |
Returns normalized URI. require 'uri' URI("HTTP://my.EXAMPLE.com").normalize => <URI::HTTP Normalization here means: scheme and host are converted to lowercase, an empty path component is set to "/". | def normalize
uri = dup
uri.normalize!
uri
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalize\n Wgit::Url.new(@uri.normalize.to_s)\n end",
"def normalize_uri uri\n (uri =~ /^https?:/) ? uri : \"http://#{uri}\"\n end",
"def uri_normalize(uri)\n \treturn 'http://' + uri unless uri =~ /http:\\/\\//\n \turi\n\tend",
"def uri_normalize(uri)\n \treturn 'http://' + uri unless ur... | [
"0.82200986",
"0.8040707",
"0.78208715",
"0.78208715",
"0.778254",
"0.7726412",
"0.76325995",
"0.75870687",
"0.7544523",
"0.74768454",
"0.72966254",
"0.71991354",
"0.718377",
"0.71749777",
"0.70714223",
"0.69377184",
"0.6901449",
"0.6827011",
"0.67323667",
"0.66885585",
"0.66... | 0.7751508 | 5 |
Destructive version of normalize. | def normalize!
if path&.empty?
set_path('/')
end
if scheme && scheme != scheme.downcase
set_scheme(self.scheme.downcase)
end
if host && host != host.downcase
set_host(self.host.downcase)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalize!; end",
"def normalize; end",
"def normalize\n self.dup.normalize!()\n end",
"def normalize\n end",
"def normalize!\n self.replace self.normalize\n end",
"def normalize\n self.dup.normalize!\n end",
"def normalize\n self.dup.normalize!\n end",
"def normalize\n\t\t\tself... | [
"0.8104123",
"0.80231446",
"0.8004055",
"0.79977834",
"0.78669643",
"0.7854025",
"0.7854025",
"0.7845501",
"0.78249687",
"0.78099555",
"0.7784594",
"0.7769867",
"0.76945084",
"0.76623154",
"0.7612944",
"0.76022696",
"0.75790614",
"0.75790614",
"0.7511253",
"0.7407937",
"0.730... | 0.5825307 | 82 |
Constructs String from URI. | def to_s
str = ''.dup
if @scheme
str << @scheme
str << ':'
end
if @opaque
str << @opaque
else
if @host || %w[file postgres].include?(@scheme)
str << '//'
end
if self.userinfo
str << self.userinfo
str << '@'
... | {
"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 |
== Args +components+:: Multiple Symbol arguments defined in URI::HTTP. == Description Selects specified components from URI. == Usage require 'uri' | def select(*components)
components.collect do |c|
if component.include?(c)
self.__send__(c)
else
raise ArgumentError,
"expected of components of #{self.class} (#{self.class.component.join(', ')})"
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def uri(*parts)\n # If an absolute URI already\n return parts.first if parts.first.is_a?(URI) && parts.first.host\n\n joined = [url, *parts].map(&:to_s).reject(&:empty?) * '/'\n\n URI.parse(joined)\n end",
"def url args, &block\n default args, &block\n require \"uri\"\n\n ... | [
"0.6299391",
"0.5861903",
"0.58550274",
"0.5655562",
"0.5632021",
"0.55489767",
"0.5527543",
"0.5527543",
"0.5524286",
"0.5442608",
"0.5436972",
"0.542978",
"0.5417844",
"0.5415494",
"0.5399342",
"0.5393172",
"0.5328815",
"0.5328815",
"0.5328815",
"0.5328815",
"0.53207934",
... | 0.4961924 | 45 |
== Args +v+:: URI or String == Description Attempts to parse other URI +oth+, returns [parsed_oth, self]. == Usage require 'uri' uri = URI.parse(" uri.coerce(" => [<URI::HTTP <URI::HTTP | def coerce(oth)
case oth
when String
oth = parser.parse(oth)
else
super
end
return oth, self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse(uri)\n URI.for(*self.split(uri), self)\n end",
"def parse(uri); end",
"def coerce_uri incoming_uri\n if incoming_uri.is_a? Hash\n Addressable::URI.new deep_hash_normalize(incoming_uri)\n elsif incoming_uri\n Addressable::URI.parse incoming_uri\n end\n ... | [
"0.6865351",
"0.6403429",
"0.6350107",
"0.6266544",
"0.6165273",
"0.57843095",
"0.5726923",
"0.5683313",
"0.5683313",
"0.56269574",
"0.56231785",
"0.56069446",
"0.56069446",
"0.5603844",
"0.5600357",
"0.55927885",
"0.5584047",
"0.55743283",
"0.55557615",
"0.5554735",
"0.55454... | 0.5804046 | 5 |
Returns a proxy URI. The proxy URI is obtained from environment variables such as http_proxy, ftp_proxy, no_proxy, etc. If there is no proper proxy, nil is returned. If the optional parameter +env+ is specified, it is used instead of ENV. Note that capitalized variables (HTTP_PROXY, FTP_PROXY, NO_PROXY, etc.) are exami... | def find_proxy(env=ENV)
raise BadURIError, "relative URI: #{self}" if self.relative?
name = self.scheme.downcase + '_proxy'
proxy_uri = nil
if name == 'http_proxy' && env.include?('REQUEST_METHOD') # CGI?
# HTTP_PROXY conflicts with *_proxy for proxy settings and
# HTTP_* for hea... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_proxy_from_env\n env_proxy = ENV['http_proxy'] || ENV['HTTP_PROXY']\n\n return nil if env_proxy.nil? or env_proxy.empty?\n\n uri = URI.parse env_proxy\n\n if uri and uri.user.nil? and uri.password.nil? then\n # Probably we have http_proxy_* variables?\n uri.user = escape(ENV['http_pro... | [
"0.83189386",
"0.79313236",
"0.7759979",
"0.67787343",
"0.67591643",
"0.66971",
"0.66738296",
"0.63731056",
"0.6220125",
"0.62188524",
"0.6204399",
"0.6187712",
"0.6166209",
"0.6003402",
"0.5955615",
"0.59472424",
"0.5921805",
"0.5913603",
"0.5809917",
"0.58039784",
"0.578063... | 0.79337096 | 1 |
Protected setter for the host component +v+. See also URI::Generic.host=. | def set_host(v)
v = "" if v.nil? || v == "localhost"
@host = v
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def host=(v)\n check_host(v)\n set_host(v)\n v\n end",
"def set_host(v)\n @host = v\n end",
"def hostname=(v)\n v = \"[#{v}]\" if !(v&.start_with?('[') && v&.end_with?(']')) && v&.index(':')\n self.host = v\n end",
"def host(new_host)\n unless host_valid? new_host\... | [
"0.8251908",
"0.8048547",
"0.7880431",
"0.7872747",
"0.7836417",
"0.7836417",
"0.77091414",
"0.763515",
"0.7587411",
"0.7582553",
"0.7366222",
"0.7303479",
"0.7254585",
"0.7103485",
"0.7027515",
"0.7012133",
"0.69940054",
"0.6975829",
"0.6961558",
"0.6941492",
"0.693472",
"... | 0.74791133 | 10 |
== Description Creates a new URI::FTP object from generic URL components with no syntax checking. Unlike build(), this method does not escape the path component as required by RFC1738; instead it is treated as per RFC2396. Arguments are +scheme+, +userinfo+, +host+, +port+, +registry+, +path+, +opaque+, +query+, and +f... | def initialize(scheme,
userinfo, host, port, registry,
path, opaque,
query,
fragment,
parser = nil,
arg_check = false)
raise InvalidURIError unless path
path = path.sub(/^\//,'')
path.sub!... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(scheme,\n userinfo, host, port, registry,\n path, opaque,\n query,\n fragment,\n parser = DEFAULT_PARSER,\n arg_check = false)\n @scheme = nil\n @user = nil\n @password = nil\n ... | [
"0.6393717",
"0.5412315",
"0.5379907",
"0.53662777",
"0.5297751",
"0.5237173",
"0.5226069",
"0.5117922",
"0.50655174",
"0.50575924",
"0.50271463",
"0.5025168",
"0.4991355",
"0.4987512",
"0.4917287",
"0.48986518",
"0.48986518",
"0.48986518",
"0.48740813",
"0.48116186",
"0.4808... | 0.58268785 | 1 |
Validates typecode +v+, returns +true+ or +false+. | def check_typecode(v)
if TYPECODE.include?(v)
return true
else
raise InvalidComponentError,
"bad typecode(expected #{TYPECODE.join(', ')}): #{v}"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid?(value)\n @type_checker.valid?(value)\n end",
"def is_invalid?(v, type)\n case type\n when 'json' then !v.is_a?(Hash)\n when 'date' then !v.is_a?(Date)\n when 'datetime' then !v.is_a?(DateTime)\n when 'number' then !v.is_a?(Numeric)\n when TrueFalse then !... | [
"0.6884398",
"0.6565806",
"0.6515216",
"0.64651114",
"0.6343039",
"0.631401",
"0.62408656",
"0.623851",
"0.62139374",
"0.612386",
"0.609099",
"0.609099",
"0.6070671",
"0.60662824",
"0.60532707",
"0.60525405",
"0.60457486",
"0.60457486",
"0.5983696",
"0.5974209",
"0.5960011",
... | 0.80575347 | 0 |
Private setter for the typecode +v+. See also URI::FTP.typecode=. | def set_typecode(v)
@typecode = v
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_type(v)\n self.type = v\n self\n end",
"def typecode=(typecode)\n check_typecode(typecode)\n set_typecode(typecode)\n typecode\n end",
"def type(val); @type = val; self; end",
"def set_server_type(server_type)\n if (server_type.casecmp('filer') == 0)\n @url = FI... | [
"0.65896964",
"0.64647496",
"0.6385584",
"0.62388265",
"0.62365305",
"0.61760354",
"0.61211675",
"0.6033428",
"0.6033428",
"0.6033428",
"0.6033428",
"0.6033428",
"0.6033428",
"0.6033428",
"0.60315406",
"0.5961027",
"0.5931865",
"0.58882225",
"0.5823331",
"0.58177507",
"0.5816... | 0.74794406 | 0 |
== Args +v+:: String == Description Public setter for the typecode +v+ (with validation). See also URI::FTP.check_typecode. == Usage require 'uri' | def typecode=(typecode)
check_typecode(typecode)
set_typecode(typecode)
typecode
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_typecode(v)\n @typecode = v\n end",
"def authen_type=(val)\n if (val.kind_of?(Integer))\n @authen_type = val & 0xff\n elsif(val.kind_of?(String))\n raise ArgumentError, \"Value must be 1-byte, but was #{val.length}.\" if (val.length != 1) \n ... | [
"0.76586235",
"0.64349866",
"0.6229844",
"0.61620826",
"0.6104366",
"0.6058006",
"0.6042047",
"0.6040327",
"0.6038976",
"0.59661484",
"0.59609604",
"0.5931395",
"0.59231734",
"0.59085256",
"0.5856246",
"0.5800552",
"0.5800304",
"0.5799096",
"0.57811636",
"0.5748627",
"0.57271... | 0.6489675 | 1 |
Returns the path from an FTP URI. RFC 1738 specifically states that the path for an FTP URI does not include the / which separates the URI path from the URI host. Example: ftp://ftp.example.com/pub/ruby The above URI indicates that the client should connect to ftp.example.com then cd to pub/ruby from the initial login ... | def path
return @path.sub(/^\//,'').sub(/^%2F/,'/')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ftp_host_path( append = nil )\n\t\tr = '/' + self.origin_ftp_host_path\n\t\tr += '/' + append.to_s unless append.nil?\n\t\tr\n\tend",
"def get_file_uri_path(uri)\n uri.sub(%r{\\Afile://}, '')\n end",
"def uri(path)\n s = File::expand_path(path).gsub(DIR, \"\").gsub(File::SEPARATOR, '/')\n return ... | [
"0.6825158",
"0.57417804",
"0.57223004",
"0.5711535",
"0.5697196",
"0.55934775",
"0.54863673",
"0.54380137",
"0.53603005",
"0.534546",
"0.5319029",
"0.5269926",
"0.51346254",
"0.5108034",
"0.51021117",
"0.5077085",
"0.5056774",
"0.5028424",
"0.4986392",
"0.4952734",
"0.494798... | 0.5337878 | 10 |
Private setter for the path of the URI::FTP. | def set_path(v)
super("/" + v.sub(/^\//, "%2F"))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ftp_host_path( append = nil )\n\t\tr = '/' + self.origin_ftp_host_path\n\t\tr += '/' + append.to_s unless append.nil?\n\t\tr\n\tend",
"def set_path\n self.path = File.join(self.store_dir, self.filename)\n end",
"def set_path(path)\n path\n end",
"def path=(value)\n @path = value\n ... | [
"0.64203113",
"0.6279898",
"0.5941341",
"0.59072745",
"0.5903002",
"0.5903002",
"0.5903002",
"0.58859307",
"0.5860616",
"0.58485353",
"0.5829762",
"0.582111",
"0.581925",
"0.5815346",
"0.5793119",
"0.5761652",
"0.5758226",
"0.5758226",
"0.5758226",
"0.5758226",
"0.5758226",
... | 0.5180502 | 51 |
Returns a String representation of the URI::FTP. | def to_s
save_path = nil
if @typecode
save_path = @path
@path = @path + TYPECODE_PREFIX + @typecode
end
str = super
if @typecode
@path = save_path
end
return str
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ftp_host_path( append = nil )\n\t\tr = '/' + self.origin_ftp_host_path\n\t\tr += '/' + append.to_s unless append.nil?\n\t\tr\n\tend",
"def raw_url(file_name)\n \"ftp://#{user}@#{host}#{folder}#{file_name}\"\n end",
"def to_s\n uri.to_s\n end",
"def to_s\n @uri.to_s\n end",... | [
"0.60015804",
"0.58356047",
"0.57873803",
"0.57701325",
"0.57701325",
"0.57038164",
"0.56345695",
"0.5611607",
"0.56075746",
"0.55960655",
"0.5584053",
"0.5527941",
"0.54982346",
"0.54950845",
"0.5493278",
"0.5485506",
"0.54168075",
"0.54121876",
"0.53808725",
"0.5344098",
"0... | 0.0 | -1 |
== Description Returns the full path for an HTTP request, as required by Net::HTTP::Get. If the URI contains a query, the full path is URIpath + '?' + URIquery. Otherwise, the path is simply URIpath. Example: uri = URI::HTTP.build(path: '/foo/bar', query: 'test=true') uri.request_uri => "/foo/bar?test=true" | def request_uri
return unless @path
url = @query ? "#@path?#@query" : @path.dup
url.start_with?(?/.freeze) ? url : ?/ + url
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def request_uri\n return nil if absolute? && scheme !~ /^https?$/\n res = path.to_s.empty? ? \"/\" : path\n res += \"?#{self.query}\" if self.query\n return res\n end",
"def request_uri(uri)\n if has_colon_path_separator?(uri)\n path = hostname_and_path(uri).split(':').all_but_... | [
"0.77717",
"0.71472144",
"0.6459811",
"0.644486",
"0.64262587",
"0.6343158",
"0.6315522",
"0.6295879",
"0.6295879",
"0.6275472",
"0.62649846",
"0.6259599",
"0.62545544",
"0.62544787",
"0.622111",
"0.6213985",
"0.6200388",
"0.61945647",
"0.61573684",
"0.61328524",
"0.6118027",... | 0.7666774 | 1 |
== Description Returns the authority for an HTTP uri, as defined in Example: URI::HTTP.build(host: ' path: '/foo/bar').authority => " URI::HTTP.build(host: ' port: 8000, path: '/foo/bar').authority => " URI::HTTP.build(host: ' port: 80, path: '/foo/bar').authority => " | def authority
if port == default_port
host
else
"#{host}:#{port}"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authority\n @authority ||= headers[AUTHORITY_KEY]\n end",
"def authority\n object.fetch(:authority) {\n @object[:authority] = (format_authority if @object[:host])\n }\n end",
"def normalized_authority\n if authority\n (userinfo ? normalized_userinfo.to_s + \"... | [
"0.74744064",
"0.7232238",
"0.7219138",
"0.618797",
"0.5669339",
"0.5563543",
"0.55372494",
"0.5491663",
"0.5491663",
"0.5491663",
"0.54804087",
"0.547639",
"0.54368526",
"0.54286796",
"0.52963597",
"0.5291662",
"0.5263994",
"0.5169372",
"0.5073856",
"0.5072523",
"0.5004428",... | 0.6146397 | 4 |
== Description Returns the origin for an HTTP uri, as defined in Example: URI::HTTP.build(host: ' path: '/foo/bar').origin => " URI::HTTP.build(host: ' port: 8000, path: '/foo/bar').origin => " URI::HTTP.build(host: ' port: 80, path: '/foo/bar').origin => " URI::HTTPS.build(host: ' path: '/foo/bar').origin => " | def origin
"#{scheme}://#{authority}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def smart_origin_url\n if params[:origin_url].blank?\n request.original_url\n else\n params[:origin_url]\n end\n end",
"def origin\n origins && origins.length == 1 && origins[0] || nil\n end",
"def origin_url\n @origin_url ||= `git config --get remote.origin.url`.strip\n end",
... | [
"0.66277945",
"0.6560014",
"0.647774",
"0.6435965",
"0.6426858",
"0.6355915",
"0.62586373",
"0.6201084",
"0.61271274",
"0.6100707",
"0.6007278",
"0.598343",
"0.5869007",
"0.5803517",
"0.57416666",
"0.56933606",
"0.56853324",
"0.56524146",
"0.55998755",
"0.55272096",
"0.549090... | 0.72382367 | 0 |
== Description Creates a new URI::LDAP object from generic URI components as per RFC 2396. No LDAPspecific syntax checking is performed. Arguments are +scheme+, +userinfo+, +host+, +port+, +registry+, +path+, +opaque+, +query+, and +fragment+, in that order. Example: uri = URI::LDAP.new("ldap", nil, "ldap.example.com",... | def initialize(*arg)
super(*arg)
if @fragment
raise InvalidURIError, 'bad LDAP URL'
end
parse_dn
parse_query
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(scheme,\n userinfo, host, port, registry,\n path, opaque,\n query,\n fragment,\n parser = DEFAULT_PARSER,\n arg_check = false)\n @scheme = nil\n @user = nil\n @password = nil\n ... | [
"0.6316063",
"0.609402",
"0.6037316",
"0.59242845",
"0.5739819",
"0.5625774",
"0.5588974",
"0.5553016",
"0.5545903",
"0.55173254",
"0.54438484",
"0.542139",
"0.53874505",
"0.5365862",
"0.5365862",
"0.532513",
"0.532513",
"0.5270934",
"0.5270934",
"0.5265365",
"0.52585435",
... | 0.63487124 | 0 |
Private method to cleanup +dn+ from using the +path+ component attribute. | def parse_dn
raise InvalidURIError, 'bad LDAP URL' unless @path
@dn = @path[1..-1]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cleanup\n File.delete(@path) if @path.is_a?(String) && File.exist?(@path)\n end",
"def cleanup\n cleanup_unpack_path\n cleanup_download_path\n end",
"def cleanup(paths)\n item = path_tree.descend(paths)\n item.cleanup \n save_path_tree\n # print w... | [
"0.6174526",
"0.6152572",
"0.60067964",
"0.60053205",
"0.5726811",
"0.55820423",
"0.5559326",
"0.5556758",
"0.5549507",
"0.5468427",
"0.54471236",
"0.5439921",
"0.53803194",
"0.5374812",
"0.53614235",
"0.5329302",
"0.53184575",
"0.53184575",
"0.53177285",
"0.5278708",
"0.5270... | 0.6198658 | 0 |
Private method to cleanup +attributes+, +scope+, +filter+, and +extensions+ from using the +query+ component attribute. | def parse_query
@attributes = nil
@scope = nil
@filter = nil
@extensions = nil
if @query
attrs, scope, filter, extensions = @query.split('?')
@attributes = attrs if attrs && attrs.size > 0
@scope = scope if scope && scope.size > 0
@filter ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset_query_state\n @scope.clear\n @extensions.clear\n @distinct = @columns = @where = @order = @limit = @offset = @group = @having = nil\n end",
"def query_unset_all\n rebuild_uri :query => nil\n end",
"def cleanup\n cleanup_nonces\n cleanup_asso... | [
"0.61099267",
"0.5894259",
"0.5643363",
"0.5598884",
"0.5304809",
"0.52666736",
"0.5260744",
"0.5260744",
"0.5254981",
"0.5198964",
"0.5191904",
"0.512063",
"0.51159394",
"0.5107517",
"0.5100502",
"0.5100502",
"0.5100502",
"0.5100502",
"0.5086863",
"0.50775266",
"0.5066747",
... | 0.58087337 | 2 |
Private method to assemble +query+ from +attributes+, +scope+, +filter+, and +extensions+. | def build_path_query
@path = '/' + @dn
query = []
[@extensions, @filter, @scope, @attributes].each do |x|
next if !x && query.size == 0
query.unshift(x)
end
@query = query.join('?')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_query(params)\n query = UserInteraction.includes(:user, :interaction, :answer)\n fields = get_fields()\n params.each do |filter|\n field_id = filter['field'].to_sym\n operator = filter['operand']\n operand = filter['value']\n if operator == FILTER_OPERATOR_CONTAINS\n q... | [
"0.68276274",
"0.66122264",
"0.6511647",
"0.63673156",
"0.63182324",
"0.63175017",
"0.62233734",
"0.60835665",
"0.60497",
"0.6035076",
"0.5971956",
"0.5963792",
"0.59330606",
"0.58833075",
"0.5843138",
"0.5835971",
"0.58350915",
"0.5829093",
"0.5825553",
"0.58180815",
"0.5815... | 0.64638394 | 3 |
Private setter for dn +val+. | def set_dn(val)
@dn = val
build_path_query
@dn
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dn=(val)\n set_dn(val)\n val\n end",
"def dn=( newdn )\n\t\tself.clear_caches\n\t\t@dn = newdn\n\tend",
"def set_attribute(name, value)\n # Get the attr and clean up the input\n attr = to_real_attribute_name(name)\n raise UnknownAttribute.new(name) if attr.nil?\n\n if attr ... | [
"0.88718116",
"0.7573691",
"0.66152155",
"0.65385723",
"0.60098964",
"0.6005612",
"0.600327",
"0.59744525",
"0.59407043",
"0.59002227",
"0.5883883",
"0.5755448",
"0.57369596",
"0.5726489",
"0.571957",
"0.570978",
"0.5657103",
"0.56006634",
"0.5594095",
"0.55353034",
"0.551925... | 0.81292146 | 1 |
Setter for dn +val+. | def dn=(val)
set_dn(val)
val
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_dn(val)\n @dn = val\n build_path_query\n @dn\n end",
"def dn=( newdn )\n\t\tself.clear_caches\n\t\t@dn = newdn\n\tend",
"def set_dn\n @dn = Dn.find(params[:id])\n end",
"def set_attribute(name, value)\n # Get the attr and clean up the input\n attr = to_real_attribu... | [
"0.84160304",
"0.74337083",
"0.6866939",
"0.65308064",
"0.6160303",
"0.60331476",
"0.5953973",
"0.59155846",
"0.5794103",
"0.5746752",
"0.5707296",
"0.56980604",
"0.568789",
"0.561489",
"0.5564403",
"0.5559309",
"0.55521125",
"0.5518485",
"0.55161333",
"0.5502206",
"0.5488968... | 0.8967284 | 0 |
Private setter for attributes +val+. | def set_attributes(val)
@attributes = val
build_path_query
@attributes
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def value=(val); end",
"def attributes=(val)\n set_attributes(val)\n val\n end",
"def set(val)\n @value = val\n @http_value = nil\n self\n end",
"def value=(val)\n self[:value] = serialize_value(val)\n end",
"def attribute=(name, val)\n write_attribute(name, val)\n... | [
"0.76236916",
"0.74767816",
"0.725066",
"0.7161154",
"0.7081361",
"0.70710105",
"0.70628804",
"0.700367",
"0.6770489",
"0.6722583",
"0.66949606",
"0.66933084",
"0.6693011",
"0.6675744",
"0.6618785",
"0.660316",
"0.660316",
"0.65668064",
"0.65600723",
"0.6530924",
"0.6513911",... | 0.6516478 | 20 |
Setter for attributes +val+. | def attributes=(val)
set_attributes(val)
val
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attribute=(name, val)\n write_attribute(name, val)\n end",
"def value=(val); end",
"def value= (val) ; write_attribute(:value, Marshal.dump(val)) ; end",
"def set_attr(name, value)\n each_value {|x| x[name] = value }\n end",
"def set(v)\n @val = v\n end",
"def value=(val... | [
"0.7403352",
"0.738045",
"0.7026399",
"0.6973699",
"0.69724786",
"0.69642687",
"0.6962518",
"0.69304574",
"0.69304574",
"0.6926451",
"0.6922254",
"0.69140726",
"0.68663025",
"0.6806746",
"0.6740829",
"0.672435",
"0.6644551",
"0.66000664",
"0.6578409",
"0.6518944",
"0.6518944"... | 0.778349 | 0 |
Private setter for scope +val+. | def set_scope(val)
@scope = val
build_path_query
@scope
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scope=(val)\n set_scope(val)\n val\n end",
"def set(v)\n @val = v\n end",
"def set(val)\n @value = val\n @http_value = nil\n self\n end",
"def value=(val); end",
"def value=(v)\n set(v)\n end",
"def val=(v)\n error_check( OpenCL::INVALID_VALUE ) if not self... | [
"0.7777084",
"0.73893857",
"0.72823644",
"0.72664714",
"0.67307484",
"0.66806984",
"0.6607054",
"0.65895134",
"0.65895134",
"0.6551218",
"0.6545439",
"0.6495361",
"0.6476603",
"0.64260626",
"0.63777465",
"0.6376883",
"0.63668287",
"0.6354049",
"0.62761915",
"0.62504274",
"0.6... | 0.65420324 | 11 |
Setter for scope +val+. | def scope=(val)
set_scope(val)
val
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set(v)\n @val = v\n end",
"def set_scope(val)\n @scope = val\n build_path_query\n @scope\n end",
"def set(val)\n @value = val\n @http_value = nil\n self\n end",
"def value=(val); end",
"def val=(v)\n error_check( OpenCL::INVALID_VALUE ) if not self.class.cod... | [
"0.7425381",
"0.71114403",
"0.704139",
"0.6893045",
"0.6807309",
"0.6656384",
"0.6656384",
"0.64901966",
"0.64840263",
"0.6478336",
"0.6478336",
"0.6478336",
"0.6478336",
"0.6478336",
"0.6478336",
"0.6433892",
"0.6377019",
"0.6340998",
"0.6325696",
"0.6325696",
"0.6325696",
... | 0.81849545 | 0 |
Private setter for filter +val+. | def set_filter(val)
@filter = val
build_path_query
@filter
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter=(val)\n set_filter(val)\n val\n end",
"def filter(val)\n raise \"filter requires a String.\" unless val.is_a? String\n @filter = val\n self\n end",
"def filter=(value)\n # nil and false disable the filter\n return @filter = false unless value # rubocop:di... | [
"0.8712771",
"0.7925231",
"0.7501669",
"0.7099085",
"0.7073953",
"0.69148844",
"0.67735875",
"0.6694301",
"0.63092244",
"0.6229369",
"0.61243564",
"0.61122245",
"0.60886174",
"0.6048456",
"0.60232455",
"0.6021485",
"0.5944737",
"0.59375405",
"0.59089684",
"0.58776563",
"0.585... | 0.7712802 | 2 |
Setter for filter +val+. | def filter=(val)
set_filter(val)
val
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_filter(val)\n @filter = val\n build_path_query\n @filter\n end",
"def filter(val)\n raise \"filter requires a String.\" unless val.is_a? String\n @filter = val\n self\n end",
"def filter=(value)\n # nil and false disable the filter\n return @filter = fa... | [
"0.78987503",
"0.78938437",
"0.7248644",
"0.698471",
"0.69658583",
"0.67968506",
"0.6493036",
"0.6333687",
"0.62755394",
"0.6161811",
"0.6064887",
"0.60330635",
"0.5998006",
"0.5891161",
"0.5870232",
"0.584192",
"0.5812479",
"0.5763792",
"0.57576",
"0.57576",
"0.57576",
"0.... | 0.8725978 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.