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 |
|---|---|---|---|---|---|---|
Example: foo(42) ^^^ foo 42 ^^^ | def spot_fcall_for_name
mid, _nd_args = @node.children
fetch_line(@node.first_lineno)
if @snippet.match(/(#{ Regexp.quote(mid) })/, @node.first_column)
@beg_column = $~.begin(1)
@end_column = $~.end(1)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def foo(arg); end",
"def foo (x)\nend",
"def foo(bar)\n puts bar\nend",
"def foo(x,y)\nend",
"def foo(x,y)\nend",
"def foo(a, b)\n :two_args\n end",
"def foo(...)\n bar(...)\nend",
"def foo\n 123\nend",
"def ^(arg0)\n end",
"def ^(arg0)\n end",
"def ^(arg0)\n end",
"d... | [
"0.70128953",
"0.6927565",
"0.6680457",
"0.6545174",
"0.6545174",
"0.649589",
"0.64161223",
"0.638882",
"0.6313709",
"0.6313709",
"0.6313709",
"0.62792236",
"0.626989",
"0.6192662",
"0.6181489",
"0.61573005",
"0.61573005",
"0.6131925",
"0.61186635",
"0.608665",
"0.59922093",
... | 0.0 | -1 |
Example: foo(42) ^^ foo 42 ^^ | def spot_fcall_for_args
_mid, nd_args = @node.children
if nd_args && nd_args.first_lineno == nd_args.last_lineno
# binary operator
fetch_line(nd_args.first_lineno)
@beg_column = nd_args.first_column
@end_column = nd_args.last_column
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def foo(arg); end",
"def foo (x)\nend",
"def foo(bar)\n puts bar\nend",
"def foo(x,y)\nend",
"def foo(x,y)\nend",
"def foo\n 123\nend",
"def foo(...)\n bar(...)\nend",
"def foo(a, b)\n :two_args\n end",
"def foo\n 'foo'\n end",
"def foo2(x)\n bar(x)\n end",
... | [
"0.74346894",
"0.7245862",
"0.7131512",
"0.68482625",
"0.68482625",
"0.67403215",
"0.6708135",
"0.6699241",
"0.66613096",
"0.6652184",
"0.66413516",
"0.6458943",
"0.64533895",
"0.64533895",
"0.64316887",
"0.6330651",
"0.62742186",
"0.6190732",
"0.61669254",
"0.61545336",
"0.6... | 0.0 | -1 |
Example: x[1] += 42 ^^^ (for []) x[1] += 42 ^ (for +) x[1] += 42 ^^^^^^ (for []=) | def spot_op_asgn1_for_name
nd_recv, op, nd_args, _nd_rhs = @node.children
fetch_line(nd_recv.last_lineno)
if @snippet.match(/\G[\s)]*(\[)/, nd_recv.last_column)
bracket_beg_column = $~.begin(1)
args_last_column = $~.end(0)
if nd_args && nd_recv.last_lineno == nd_args.last_linen... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def my_array_modification_method(source, thing_to_modify)\n\t# #source[-1],source[2] = source[-1] + 1, source[2 ]+ 1 \n # source.collect! do |item|\n # # # if item.is_a?(Integer)\n # # # item = item + thing_to_modify\n # # # else \n # # # \titem = item\n # # end\n \n ... | [
"0.6448295",
"0.6303924",
"0.6158155",
"0.60990644",
"0.6098475",
"0.60904235",
"0.6018424",
"0.6007042",
"0.60068995",
"0.59689593",
"0.59120876",
"0.5901385",
"0.589022",
"0.58785546",
"0.5858377",
"0.584108",
"0.58296347",
"0.5820232",
"0.58108145",
"0.5806639",
"0.5802497... | 0.0 | -1 |
Example: x[1] += 42 ^^^^^^^^ | def spot_op_asgn1_for_args
nd_recv, mid, nd_args, nd_rhs = @node.children
fetch_line(nd_recv.last_lineno)
if mid == :[]= && @snippet.match(/\G\s*\[/, nd_recv.last_column)
@beg_column = $~.end(0)
if nd_recv.last_lineno == nd_rhs.last_lineno
@end_column = nd_rhs.last_column
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def my_array_modification_method!(array, num)\n array[2] = array[2] + num\n array[-1] = array[-1] + num\n array\nend",
"def my_array_modification_method!(source, thing_to_modify)\n source.each_index do |x|\n if (source[x].is_a?(Integer))\n source[x]+=thing_to_modify\n end\n end\n sou... | [
"0.7077109",
"0.6814494",
"0.6752681",
"0.6746846",
"0.66160274",
"0.6592167",
"0.65364724",
"0.65165126",
"0.648308",
"0.6422909",
"0.64121455",
"0.6406663",
"0.6390475",
"0.6387865",
"0.6387048",
"0.6381517",
"0.63784295",
"0.6376529",
"0.6351823",
"0.6349777",
"0.63384765"... | 0.0 | -1 |
Example: x.foo += 42 ^^^ (for foo) x.foo += 42 ^ (for +) x.foo += 42 ^^^^^^^ (for foo=) | def spot_op_asgn2_for_name
nd_recv, _qcall, attr, op, _nd_rhs = @node.children
fetch_line(nd_recv.last_lineno)
if @snippet.match(/\G[\s)]*(\.)\s*#{ Regexp.quote(attr) }()\s*(#{ Regexp.quote(op) })(=)/, nd_recv.last_column)
case @name
when attr
@beg_column = $~.begin(1)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_stuff\n 4 + \"foo\"\nend",
"def +(x); end",
"def tricky_method(a_string_param, an_array_param)\n a_string_param << \"rutabaga\" #originally +=. shovel operator modifies original object. \n an_array_param << \"rutabaga\" #(\"mutates the caller)\"\nend",
"def Add(val)\n self.value += val\n end",... | [
"0.61936957",
"0.6159674",
"0.615603",
"0.6132219",
"0.6089629",
"0.6045641",
"0.6045641",
"0.58973897",
"0.5883515",
"0.5867298",
"0.5859385",
"0.5850404",
"0.58399403",
"0.5812992",
"0.5810679",
"0.58012366",
"0.577542",
"0.576809",
"0.57188195",
"0.571734",
"0.5709523",
... | 0.0 | -1 |
Example: x.foo += 42 ^^ | def spot_op_asgn2_for_args
_nd_recv, _qcall, _attr, _op, nd_rhs = @node.children
if nd_rhs.first_lineno == nd_rhs.last_lineno
fetch_line(nd_rhs.first_lineno)
@beg_column = nd_rhs.first_column
@end_column = nd_rhs.last_column
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Add(val)\n self.value += val\n end",
"def +(x); end",
"def increase_age(number)\n #@age = @age + number // does the same as line 20 \n @age += number\n end",
"def add_stuff\n 4 + \"foo\"\nend",
"def +(y)\n @x + y\n end",
"def add!(p)\n@x += p.x\n@y += p.y\nself\nend",
"def add(thi... | [
"0.6672255",
"0.66102415",
"0.65973544",
"0.65948397",
"0.64923745",
"0.6424256",
"0.6370689",
"0.63336045",
"0.62269354",
"0.61750764",
"0.61750764",
"0.61630726",
"0.6158757",
"0.61190933",
"0.6103972",
"0.60714203",
"0.6016381",
"0.5987318",
"0.5982177",
"0.5963413",
"0.59... | 0.0 | -1 |
Example: Foo::Bar += 1 ^^^^^^^^ | def spot_op_cdecl
nd_lhs, op, _nd_rhs = @node.children
*nd_parent_lhs, _const = nd_lhs.children
if @name == op
@snippet = @fetch[nd_lhs.last_lineno]
if @snippet.match(/\G\s*(#{ Regexp.quote(op) })=/, nd_lhs.last_column)
@beg_column = $~.begin(1)
@end_column = $~.end... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def some_method\n p val += 1\nend",
"def some_method\n foo\n X::bar\nend",
"def increment(stat, value)\n\t\tcurrent = instance_variable_get(\"@#{stat}\") || 0\n\t\tinstance_variable_set(\"@#{stat}\", current + value)\n\tend",
"def increase(attr)\n raise NoMethodError, \"undefined method `#{attr}` for #... | [
"0.59780043",
"0.575985",
"0.57321244",
"0.5698074",
"0.5696225",
"0.5620969",
"0.54762244",
"0.54755235",
"0.54690164",
"0.54106504",
"0.53754574",
"0.5369408",
"0.53667015",
"0.53407913",
"0.53085494",
"0.52986896",
"0.5286341",
"0.528533",
"0.52761805",
"0.5268573",
"0.525... | 0.0 | -1 |
detects the minimum value out of three arguments. This method is faster than `[a, b, c].min` and puts less GC pressure. See for a performance benchmark. | def min3(a, b, c)
if a < b && a < c
a
elsif b < c
b
else
c
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def min_of_three(num1, num2, num3)\n if num1 < num2 and num1 < num3\n return num1\n end\n if num2 < num1 and num2 < num3\n return num2\n end\n return num3\nend",
"def min(num1, num2, num3)\n if num1 <= num2 and num1 <= num3\n return num1\n elsif num2 <= num1 and num2 <= num3... | [
"0.76542634",
"0.7630136",
"0.7620201",
"0.76118463",
"0.7593824",
"0.7586113",
"0.75496954",
"0.75478333",
"0.7480057",
"0.7480057",
"0.74327874",
"0.7327518",
"0.7321739",
"0.72737",
"0.7246255",
"0.7218792",
"0.71181095",
"0.7094266",
"0.7075981",
"0.7006424",
"0.699571",
... | 0.79410493 | 0 |
Should be implemented by a extended class. tsort_each_node is used to iterate for all nodes over a graph. | def tsort_each_node # :yields: node
raise NotImplementedError.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tsort_each_node(&block)\n self.each_key(&block)\n end",
"def tsort_each_node(&x)\n @rules.each_value(&x)\n end",
"def tsort_each_node(&block)\n @dependencies.each_key(&block)\n end",
"def tsort_each_node(&block)\n @table_names.each(&block)\n end",
"def tsort_each_node(&a... | [
"0.7843285",
"0.7398389",
"0.72682834",
"0.72578377",
"0.7206463",
"0.69790626",
"0.69748884",
"0.67738736",
"0.6614999",
"0.6614999",
"0.6614999",
"0.63419014",
"0.63149",
"0.6270343",
"0.6153684",
"0.6094618",
"0.6066692",
"0.60558873",
"0.5905484",
"0.5905484",
"0.5884755"... | 0.86904794 | 0 |
Should be implemented by a extended class. tsort_each_child is used to iterate for child nodes of _node_. | def tsort_each_child(node) # :yields: child
raise NotImplementedError.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tsort_each_node # :yields: node\n raise NotImplementedError.new\n end",
"def tsort_each_child(node, &block)\n query(:object => node) do |statement|\n block.call(statement.subject)\n end\n end",
"def tsort_each_child(node, &block)\n query(:object => node) do |statement|\n block.call(... | [
"0.8099941",
"0.80388224",
"0.80388224",
"0.80388224",
"0.73971987",
"0.7365169",
"0.7117943",
"0.69089794",
"0.68560576",
"0.6766842",
"0.67534375",
"0.67191356",
"0.662086",
"0.66175276",
"0.65926397",
"0.6539144",
"0.6370866",
"0.6325629",
"0.6263102",
"0.61472106",
"0.614... | 0.8931721 | 0 |
:nodoc: Creates a new GemDependencyAPI that will add dependencies to the Gem::RequestSet +set+ based on the dependency API description in +path+. | def initialize(set, path)
@set = set
@path = path
@current_groups = nil
@current_platforms = nil
@current_repository = nil
@dependencies = {}
@default_sources = true
@git_set = @set.git_set
@git_sources = {}
@installing = false
@requir... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_gemdeps(path, without_groups = [], installing = false)\n @git_set = Gem::Resolver::GitSet.new\n @vendor_set = Gem::Resolver::VendorSet.new\n @source_set = Gem::Resolver::SourceSet.new\n\n @git_set.root_dir = @install_dir\n\n lock_file = \"#{File.expand_path(path)}.lock\".dup.tap(&Gem::UN... | [
"0.6339033",
"0.63257515",
"0.63210464",
"0.6268073",
"0.6268073",
"0.6167162",
"0.60934705",
"0.5872305",
"0.5675338",
"0.5672312",
"0.5652301",
"0.5575827",
"0.55717766",
"0.55417",
"0.5502404",
"0.5493861",
"0.54897857",
"0.5479384",
"0.54216063",
"0.54045385",
"0.53754795... | 0.56449926 | 11 |
Adds +dependencies+ to the request set if any of the +groups+ are allowed. This is used for gemspec dependencies. | def add_dependencies(groups, dependencies) # :nodoc:
return unless (groups & @without_groups).empty?
dependencies.each do |dep|
@set.gem dep.name, *dep.requirement.as_list
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_dependencies(dependencies: required(\"dependencies\"), options: {}, **data)\n with_params = data.merge(dependencies: dependencies).reject { |_,v| v.nil? || Array(v).empty? }\n Collection.new(parse(client.post(\"/tasks/#{gid}/addDependencies\", body: with_params, options: options)), type: self... | [
"0.63320494",
"0.59777445",
"0.57990485",
"0.57748234",
"0.5765874",
"0.5757216",
"0.5683865",
"0.5657523",
"0.5646536",
"0.55969244",
"0.558601",
"0.55698925",
"0.55669236",
"0.55541986",
"0.55052763",
"0.5484878",
"0.5416539",
"0.53919554",
"0.53817314",
"0.5380544",
"0.537... | 0.7941039 | 0 |
Finds a gemspec with the given +name+ that lives at +path+. | def find_gemspec(name, path) # :nodoc:
glob = File.join path, "#{name}.gemspec"
spec_files = Dir[glob]
case spec_files.length
when 1 then
spec_file = spec_files.first
spec = Gem::Specification.load spec_file
return spec if spec
raise ArgumentError, "invalid gemspec #{spec_fi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find(path)\n @gemspecs.each do |spec|\n return spec if matching_file(spec, path)\n end\n nil\n end",
"def gemspec(path)\n installed_gemspec(path) || local_gemspec(path)\n end",
"def local_gemspec(path)\n glob = File.join(path, '{,*}.gemspec')\n Dir[glob].f... | [
"0.80185777",
"0.7085702",
"0.70007336",
"0.69808096",
"0.6678098",
"0.6515148",
"0.63074315",
"0.61647016",
"0.612698",
"0.6068194",
"0.59879607",
"0.59851843",
"0.59480864",
"0.58889854",
"0.5833939",
"0.58210284",
"0.58210284",
"0.5811534",
"0.5770899",
"0.5769878",
"0.572... | 0.8085932 | 0 |
Changes the behavior of gem dependency file loading to installing mode. In installing mode certain restrictions are ignored such as ruby version mismatch checks. | def installing=(installing) # :nodoc:
@installing = installing
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_always_install(dependency)\n request = Gem::Resolver::DependencyRequest.new dependency, nil\n\n found = find_all request\n\n found.delete_if do |s|\n s.version.prerelease? and not s.local?\n end unless dependency.prerelease?\n\n found = found.select do |s|\n Gem::Source::SpecificFi... | [
"0.67997617",
"0.659399",
"0.635804",
"0.63383496",
"0.63276124",
"0.6250583",
"0.62233996",
"0.6209373",
"0.619519",
"0.618447",
"0.61177963",
"0.61068875",
"0.6088719",
"0.59974456",
"0.5955397",
"0.5914721",
"0.5912215",
"0.5896831",
"0.58676004",
"0.58537567",
"0.5831043"... | 0.0 | -1 |
Loads the gem dependency file and returns self. | def load
instance_eval File.read(@path).tap(&Gem::UNTAINT), @path, 1
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load\n\t\tsource = self.depfile.read\n\t\tself.instance_eval( source, self.depfile.to_s, 1 )\n\tend",
"def load_gemfile(path)\n gf = GemFile.new(self, path)\n gf.load\n end",
"def load_gemdeps(path)\n gf = GemDepedencyAPI.new(self, path)\n gf.load\n end",
"def dependency\n ... | [
"0.70927215",
"0.6915482",
"0.6870188",
"0.68609995",
"0.6751587",
"0.6405981",
"0.6284293",
"0.6268903",
"0.6253855",
"0.6243432",
"0.61783165",
"0.6106646",
"0.61065555",
"0.60457957",
"0.5977588",
"0.5955435",
"0.59092003",
"0.59041446",
"0.585244",
"0.58360237",
"0.580869... | 0.63128096 | 6 |
:category: Gem Dependencies DSL :callseq: gem(name) gem(name, requirements) gem(name, requirements, options) Specifies a gem dependency with the given +name+ and +requirements+. You may also supply +options+ following the +requirements+ +options+ include: require: :: RubyGems does not provide any autorequire features s... | def gem(name, *requirements)
options = requirements.pop if requirements.last.kind_of?(Hash)
options ||= {}
options[:git] = @current_repository if @current_repository
source_set = false
source_set ||= gem_path name, options
source_set ||= gem_git name, options
source_set ||= g... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gem(name, *reqs)\n if dep = @dependency_names[name]\n dep.requirement.concat reqs\n else\n dep = Gem::Dependency.new name, *reqs\n @dependency_names[name] = dep\n @dependencies << dep\n end\n end",
"def gem(name, *reqs)\n @dependencies << Gem::Dependency.new(name, reqs)\n ... | [
"0.76517165",
"0.74354887",
"0.74354887",
"0.7391375",
"0.6779552",
"0.66086334",
"0.6540346",
"0.64919573",
"0.6437023",
"0.64088947",
"0.63790715",
"0.63693357",
"0.63664615",
"0.6334905",
"0.6286753",
"0.6244441",
"0.6212697",
"0.6204885",
"0.61915964",
"0.6189095",
"0.618... | 0.75352335 | 1 |
Handles the git: option from +options+ for gem +name+. Returns +true+ if the gist or git option was handled. | def gem_git(name, options) # :nodoc:
if gist = options.delete(:gist)
options[:git] = "https://gist.github.com/#{gist}.git"
end
return unless repository = options.delete(:git)
pin_gem_source name, :git, repository
reference = gem_git_reference options
submodules = options.delete :submod... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gem_git_source(name, options) # :nodoc:\n return unless git_source = (@git_sources.keys & options.keys).last\n\n source_callback = @git_sources[git_source]\n source_param = options.delete git_source\n\n git_url = source_callback.call source_param\n\n options[:git] = git_url\n\n gem_git name, ... | [
"0.73772174",
"0.61524117",
"0.61524117",
"0.60437745",
"0.6039982",
"0.5994737",
"0.59824455",
"0.595243",
"0.58785653",
"0.5750247",
"0.5740661",
"0.5733358",
"0.57296884",
"0.57296884",
"0.57015866",
"0.55525136",
"0.5531747",
"0.5494654",
"0.54946434",
"0.54302275",
"0.54... | 0.7178741 | 1 |
Handles the git options from +options+ for git gem. Returns reference for the git gem. | def gem_git_reference(options) # :nodoc:
ref = options.delete :ref
branch = options.delete :branch
tag = options.delete :tag
reference = nil
reference ||= ref
reference ||= branch
reference ||= tag
reference ||= 'master'
if ref && branch
warn <<-WARNING
Gem dependencies... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gem_git(name, options) # :nodoc:\n if gist = options.delete(:gist)\n options[:git] = \"https://gist.github.com/#{gist}.git\"\n end\n\n return unless repository = options.delete(:git)\n\n pin_gem_source name, :git, repository\n\n reference = gem_git_reference options\n\n submodules = opti... | [
"0.6936608",
"0.6801526",
"0.6699275",
"0.6185629",
"0.6086508",
"0.6006986",
"0.6005526",
"0.59857076",
"0.59740716",
"0.59566605",
"0.59566605",
"0.5897656",
"0.58926624",
"0.5873459",
"0.58260727",
"0.58149135",
"0.5771333",
"0.5771333",
"0.57310164",
"0.56972504",
"0.5697... | 0.6915095 | 1 |
Handles a git gem option from +options+ for gem +name+ for a git source registered through git_source. Returns +true+ if the custom source option was handled. | def gem_git_source(name, options) # :nodoc:
return unless git_source = (@git_sources.keys & options.keys).last
source_callback = @git_sources[git_source]
source_param = options.delete git_source
git_url = source_callback.call source_param
options[:git] = git_url
gem_git name, options
tr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gem_source(name, options) # :nodoc:\n return unless source = options.delete(:source)\n\n pin_gem_source name, :source, source\n\n @source_set.add_source_gem name, source\n\n true\n end",
"def gem_git(name, options) # :nodoc:\n if gist = options.delete(:gist)\n options[:git] = \"https://g... | [
"0.6822697",
"0.65944207",
"0.6370577",
"0.59137887",
"0.5834157",
"0.58144456",
"0.5759016",
"0.56946427",
"0.5617439",
"0.56099355",
"0.5581857",
"0.55558777",
"0.54223514",
"0.5413378",
"0.53943735",
"0.5359877",
"0.534848",
"0.53433764",
"0.52957296",
"0.5294824",
"0.5279... | 0.82700473 | 0 |
Handles the :group and :groups +options+ for the gem with the given +name+. | def gem_group(name, options) # :nodoc:
g = options.delete :group
all_groups = g ? Array(g) : []
groups = options.delete :groups
all_groups |= groups if groups
all_groups |= @current_groups if @current_groups
all_groups
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gem_group(*names, &block)\n options = names.extract_options!\n str = names.map(&:inspect)\n str << quote(options) unless options.empty?\n str = str.join(\", \")\n log :gemfile, \"group #{str}\"\n\n in_root do\n append_file \"Gemfile\", \"\\ngroup #{str} do\", ... | [
"0.730813",
"0.691577",
"0.6146001",
"0.61351556",
"0.6025029",
"0.6015694",
"0.5998539",
"0.58593124",
"0.58493155",
"0.58214366",
"0.5814772",
"0.5770578",
"0.5770578",
"0.57407826",
"0.5730279",
"0.5700868",
"0.5693564",
"0.5683095",
"0.56164265",
"0.560293",
"0.5597083",
... | 0.76661193 | 0 |
Handles the path: option from +options+ for gem +name+. Returns +true+ if the path option was handled. | def gem_path(name, options) # :nodoc:
return unless directory = options.delete(:path)
pin_gem_source name, :path, directory
@vendor_set.add_vendor_gem name, directory
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def in_path?(name)\n (`which #{name}`).to_s.strip.size > 0\n end",
"def in_path?(path); end",
"def supports_path?; end",
"def match?(path)\n has_real_path? path\n end",
"def is_path?(); @type == GRT_PATH; end",
"def handle_path\n raise Muvy::Errors::InvalidPathOption unless File.... | [
"0.5921038",
"0.58443075",
"0.5796263",
"0.5762304",
"0.57257533",
"0.56904393",
"0.564502",
"0.557355",
"0.5571608",
"0.55646116",
"0.55641824",
"0.5551445",
"0.55336934",
"0.54940957",
"0.5401195",
"0.53856224",
"0.5369142",
"0.5355112",
"0.5353346",
"0.53422415",
"0.533342... | 0.60279495 | 0 |
Handles the source: option from +options+ for gem +name+. Returns +true+ if the source option was handled. | def gem_source(name, options) # :nodoc:
return unless source = options.delete(:source)
pin_gem_source name, :source, source
@source_set.add_source_gem name, source
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gem_git_source(name, options) # :nodoc:\n return unless git_source = (@git_sources.keys & options.keys).last\n\n source_callback = @git_sources[git_source]\n source_param = options.delete git_source\n\n git_url = source_callback.call source_param\n\n options[:git] = git_url\n\n gem_git name, ... | [
"0.6984143",
"0.6035824",
"0.5988198",
"0.5959219",
"0.5953488",
"0.5953488",
"0.5935646",
"0.58953005",
"0.58917934",
"0.58917934",
"0.58917934",
"0.57988393",
"0.5798609",
"0.5743382",
"0.5743382",
"0.57432723",
"0.56886834",
"0.5577708",
"0.5519543",
"0.549251",
"0.5474142... | 0.741968 | 0 |
Handles the platforms: option from +options+. Returns true if the platform matches the current platform. | def gem_platforms(name, options) # :nodoc:
platform_names = Array(options.delete :platform)
platform_names.concat Array(options.delete :platforms)
platform_names.concat @current_platforms if @current_platforms
return true if platform_names.empty?
platform_names.any? do |platform_name|
raise ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def platform?(*args)\n has_platform = false\n\n args.flatten.each do |platform|\n has_platform = true if platform.to_s == node[:platform]\n end\n\n has_platform\n end",
"def match_platform?(*platforms)\n platforms.each do |platform|\n platform.to_s =~... | [
"0.7335449",
"0.7023184",
"0.6871792",
"0.68300784",
"0.68074363",
"0.6676948",
"0.6582179",
"0.6531652",
"0.65141803",
"0.6484862",
"0.6391735",
"0.63069916",
"0.6251407",
"0.6210844",
"0.6209271",
"0.6191445",
"0.6171442",
"0.6155881",
"0.61455613",
"0.6139001",
"0.61377764... | 0.76364654 | 0 |
Records the require: option from +options+ and adds those files, or the default file to the require list for +name+. | def gem_requires(name, options) # :nodoc:
if options.include? :require
if requires = options.delete(:require)
@requires[name].concat Array requires
end
else
@requires[name] << name
end
raise ArgumentError, "Unhandled gem options #{options.inspect}" unless options.empty?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def require(options={})\n options[:require] = true\n load(options)\n end",
"def add_asset_files(options)\n select_assets(options).each do |name, assets|\n next if name == 'config-file'\n assets.each {|file| file.add unless file.disabled? }\n end\n end",
"def de... | [
"0.62106943",
"0.6092453",
"0.5517617",
"0.54913723",
"0.5435867",
"0.53860694",
"0.5310504",
"0.5236052",
"0.52297443",
"0.5198026",
"0.51849437",
"0.51328784",
"0.5124946",
"0.51230764",
"0.5099024",
"0.5088517",
"0.5062238",
"0.50549215",
"0.5049255",
"0.50152355",
"0.5009... | 0.62434745 | 0 |
:category: Gem Dependencies DSL Block form for specifying gems from a git +repository+. git ' do gem 'activesupport' gem 'activerecord' end | def git(repository)
@current_repository = repository
yield
ensure
@current_repository = nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gemspec; end",
"def gemspec; end",
"def gemspec; end",
"def gemspec; end",
"def gemspec; end",
"def gemspec; end",
"def gemspec; end",
"def gemspec; end",
"def gem(*args)\n options = args.extract_options!\n name, version = args\n\n # Set the message to be shown in logs. Uses the git repo if ... | [
"0.67995656",
"0.67995656",
"0.67995656",
"0.67995656",
"0.67995656",
"0.67995656",
"0.67995656",
"0.67995656",
"0.67460805",
"0.66343135",
"0.65538293",
"0.65035105",
"0.65035105",
"0.65035105",
"0.64614564",
"0.63052857",
"0.62820786",
"0.6259633",
"0.6256784",
"0.62057716",
... | 0.0 | -1 |
Defines a custom git source that uses +name+ to expand git repositories for use in gems built from git repositories. You must provide a block that accepts a git repository name for expansion. | def git_source(name, &callback)
@git_sources[name] = callback
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gem_git_source(name, options) # :nodoc:\n return unless git_source = (@git_sources.keys & options.keys).last\n\n source_callback = @git_sources[git_source]\n source_param = options.delete git_source\n\n git_url = source_callback.call source_param\n\n options[:git] = git_url\n\n gem_git name, ... | [
"0.6858066",
"0.66832757",
"0.6648231",
"0.6379409",
"0.6270503",
"0.618776",
"0.60910094",
"0.60910094",
"0.59840924",
"0.59074384",
"0.5907197",
"0.5907197",
"0.5907197",
"0.5907197",
"0.5907197",
"0.5907197",
"0.5907197",
"0.5907197",
"0.5907197",
"0.5907197",
"0.5907197",... | 0.6885853 | 0 |
Returns the basename of the file the dependencies were loaded from | def gem_deps_file # :nodoc:
File.basename @path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inspect\n File.basename @__path\n end",
"def basename\n return self.name.downcase.gsub(/^.*::/, '')\n end",
"def file_name\n File.basename @path\n end",
"def file_name\n File.basename(file_path)\n end",
"def filename\n File.basename(path)\n end",
"def basename\n ... | [
"0.702996",
"0.69582343",
"0.69108194",
"0.68654037",
"0.6864489",
"0.68635195",
"0.6845723",
"0.6825876",
"0.6815774",
"0.67918444",
"0.678291",
"0.678291",
"0.676442",
"0.67446905",
"0.6738585",
"0.67333055",
"0.67308974",
"0.67308974",
"0.67291087",
"0.6727192",
"0.67236",... | 0.8068489 | 0 |
:category: Gem Dependencies DSL Loads dependencies from a gemspec file. +options+ include: name: :: The name portion of the gemspec file. Defaults to searching for any gemspec file in the current directory. gemspec name: 'my_gem' path: :: The path the gemspec lives in. Defaults to the current directory: gemspec 'my_gem... | def gemspec(options = {})
name = options.delete(:name) || '{,*}'
path = options.delete(:path) || '.'
development_group = options.delete(:development_group) || :development
spec = find_gemspec name, path
groups = gem_group spec.name, {}
self_dep = Gem::Dependency.new ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_gemspec\n\n text = File.read(gemspec_file)\n if text =~ /\\A---/ \n require 'yaml'\n spec = YAML.load(text)\n else\n #spec = eval(text) #, gemspec_file)\n spec = ::Gem::Specification.load(gemspec_file)\n end\n\n data = {}\n dat... | [
"0.71217364",
"0.65402144",
"0.6296496",
"0.6294612",
"0.6240469",
"0.6196282",
"0.6188138",
"0.6172671",
"0.6155536",
"0.61189485",
"0.6099256",
"0.6059539",
"0.6023394",
"0.5988399",
"0.5987726",
"0.59852594",
"0.5960681",
"0.5918184",
"0.59039855",
"0.59039855",
"0.5903985... | 0.78872883 | 0 |
:category: Gem Dependencies DSL Block form for placing a dependency in the given +groups+. group :development do gem 'debugger' end group :development, :test do gem 'minitest' end Groups can be excluded at install time using `gem install g without development`. See `gem help install` and `gem help gem_dependencies` for... | def group(*groups)
@current_groups = groups
yield
ensure
@current_groups = nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_dependencies(groups, dependencies) # :nodoc:\n return unless (groups & @without_groups).empty?\n\n dependencies.each do |dep|\n @set.gem dep.name, *dep.requirement.as_list\n end\n end",
"def gem( name, *requirements, **options )\n\t\tif options[:group] == :development ||\n\t\t\toptions[:gr... | [
"0.7153642",
"0.714595",
"0.7047007",
"0.6435397",
"0.64182717",
"0.63295233",
"0.6077147",
"0.5992175",
"0.5884597",
"0.5809905",
"0.57996666",
"0.5737189",
"0.5731101",
"0.56801033",
"0.56801033",
"0.56801033",
"0.5670569",
"0.56657255",
"0.5646579",
"0.563621",
"0.56252074... | 0.0 | -1 |
Pins the gem +name+ to the given +source+. Adding a gem with the same name from a different +source+ will raise an exception. | def pin_gem_source(name, type = :default, source = nil)
source_description =
case type
when :default then '(default)'
when :path then "path: #{source}"
when :git then "git: #{source}"
when :source then "source: #{source}"
else '(unknown)'
end
rais... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gem_source(name, options) # :nodoc:\n return unless source = options.delete(:source)\n\n pin_gem_source name, :source, source\n\n @source_set.add_source_gem name, source\n\n true\n end",
"def add_source(source)\n if has_source?(source)\n raise DuplicateSourceDefined, \"Berksfile cont... | [
"0.700196",
"0.5949661",
"0.58176714",
"0.5780266",
"0.56833786",
"0.56194365",
"0.5563498",
"0.55622405",
"0.5539494",
"0.5516405",
"0.55162954",
"0.5505468",
"0.55020326",
"0.54872185",
"0.54848105",
"0.5448476",
"0.54261196",
"0.5422756",
"0.5416567",
"0.5404425",
"0.53919... | 0.7532828 | 0 |
:category: Gem Dependencies DSL Block form for restricting gems to a set of platforms. The gem dependencies platform is different from Gem::Platform. A platform gem.deps.rb platform matches on the ruby engine, the ruby version and whether or not windows is allowed. :ruby, :ruby_XY :: Matches nonwindows, nonjruby implem... | def platform(*platforms)
@current_platforms = platforms
yield
ensure
@current_platforms = nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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('buildr.gemspec'))\n Gem::Specification._clear_load_cache\n ENV['BUILDR_PLATFORM... | [
"0.6575425",
"0.634064",
"0.6305378",
"0.62755585",
"0.6226577",
"0.6136352",
"0.58888316",
"0.5862313",
"0.58438194",
"0.58006036",
"0.5794203",
"0.57544124",
"0.57449985",
"0.5709681",
"0.5691765",
"0.5688318",
"0.5679242",
"0.5672952",
"0.5610353",
"0.56025213",
"0.5601550... | 0.0 | -1 |
:category: Gem Dependencies DSL Restricts this gem dependencies file to the given ruby +version+. You may also provide +engine:+ and +engine_version:+ options to restrict this gem dependencies file to a particular ruby engine and its engine version. This matching is performed by using the RUBY_ENGINE and RUBY_ENGINE_VE... | def ruby(version, options = {})
engine = options[:engine]
engine_version = options[:engine_version]
raise ArgumentError,
'You must specify engine_version along with the Ruby engine' if
engine and not engine_version
return true if @installing
unless RUBY_VERSION == ve... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def require_ruby_version *versions\n spec_extras[:required_ruby_version] = versions\n end",
"def required_ruby_version\n spec.required_ruby_version || Gem::Requirement.default\n end",
"def version_constraint(gem_name); end",
"def require_matched_dependency_version\n false\n end",
"d... | [
"0.62910104",
"0.59199965",
"0.5800864",
"0.5775815",
"0.572318",
"0.57107466",
"0.557416",
"0.5472025",
"0.5448699",
"0.53615123",
"0.53274155",
"0.53262866",
"0.5322476",
"0.530031",
"0.5296368",
"0.5259725",
"0.5246248",
"0.5223888",
"0.52159894",
"0.5185324",
"0.5178265",... | 0.6747165 | 0 |
:category: Gem Dependencies DSL Sets +url+ as a source for gems for this dependency API. RubyGems uses the default configured sources if no source was given. If a source is set only that source is used. This method differs in behavior from Bundler: The +:gemcutter+, +:rubygems+ and +:rubyforge+ sources are not supporte... | def source(url)
Gem.sources.clear if @default_sources
@default_sources = false
Gem.sources << url
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pin_gem_source(name, type = :default, source = nil)\n source_description =\n case type\n when :default then '(default)'\n when :path then \"path: #{source}\"\n when :git then \"git: #{source}\"\n when :source then \"source: #{source}\"\n else '(unknown)'\n... | [
"0.6527825",
"0.65053314",
"0.62208474",
"0.6138922",
"0.6136434",
"0.6123952",
"0.61062044",
"0.6059654",
"0.6046619",
"0.6038178",
"0.5969799",
"0.57771933",
"0.57578826",
"0.56698996",
"0.56674194",
"0.5660081",
"0.5638007",
"0.5539387",
"0.5511069",
"0.55062026",
"0.55062... | 0.7379032 | 0 |
Gets the next token for a Lockfile | def get(expected_types = nil, expected_value = nil) # :nodoc:
token = @tokens.shift
if expected_types and not Array(expected_types).include? token.type
unget token
message = "unexpected token [#{token.type.inspect}, #{token.value.inspect}], " +
"expected #{expected_types.inspect}"
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next\n\t\tif @next_token\n\t\t\ttoken = @next_token\n\t\t\t@next_token = nil\n\t\t\treturn token\n\t\telse\n\t\t\ttoken = read_token\n\t\t\treturn token\n\t\tend\n\tend",
"def next_token\n\t\t@tokens.next_token\n\tend",
"def next\n catch :done do\n while !(info = progress)\n ... | [
"0.69120157",
"0.6567315",
"0.65058196",
"0.6491039",
"0.6389642",
"0.63249075",
"0.63168114",
"0.6280424",
"0.6258557",
"0.61624724",
"0.61594915",
"0.6157505",
"0.6141695",
"0.6137693",
"0.6125186",
"0.61037433",
"0.6066697",
"0.6054833",
"0.59773743",
"0.5969412",
"0.59506... | 0.0 | -1 |
Parses the requirements following the dependency +name+ and the +op+ for the first token of the requirements and returns a Gem::Dependency object. | def parse_dependency(name, op) # :nodoc:
return Gem::Dependency.new name, op unless peek[0] == :text
version = get(:text).value
requirements = ["#{op} #{version}"]
while peek.type == :comma do
get :comma
op = get(:requirement).value
version = get(:text).value
requirement... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gem(name, *reqs)\n if dep = @dependency_names[name]\n dep.requirement.concat reqs\n else\n dep = Gem::Dependency.new name, *reqs\n @dependency_names[name] = dep\n @dependencies << dep\n end\n end",
"def parse_deps(input)\n matches = input.scan(/\\s+-\\s+\\[ \\]\\s+(\\S+)\\s+(... | [
"0.602376",
"0.5999521",
"0.5894456",
"0.5440913",
"0.5440913",
"0.5396542",
"0.5352887",
"0.525619",
"0.52270395",
"0.5179472",
"0.51779765",
"0.51779336",
"0.5155214",
"0.51548266",
"0.512744",
"0.5110721",
"0.5106433",
"0.50950354",
"0.50870556",
"0.5073625",
"0.5067985",
... | 0.8790173 | 0 |
Peeks at the next token for Lockfile | def peek # :nodoc:
@tokens.peek
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def peek\n @tok ||= read_token\n end",
"def peek_next(token)\r\n\t\tif !token.following.nil?\r\n\t\t return token.following\r\n\t\tend\r\n\r\n\t\tpeekToken = Token.new\r\n\t\tscan(peekToken)\r\n\t\ttoken.following = peekToken\r\n\t\treturn peekToken\r\n\tend",
"def peek_token\n token = @tokens.... | [
"0.67001486",
"0.6562878",
"0.63355666",
"0.63355666",
"0.6185657",
"0.61679435",
"0.61679435",
"0.61642635",
"0.61595666",
"0.6116315",
"0.610189",
"0.610189",
"0.6092524",
"0.60533804",
"0.6050385",
"0.6028934",
"0.5963559",
"0.59597206",
"0.59497255",
"0.5927399",
"0.58907... | 0.6398383 | 2 |
Ungets the last token retrieved by get | def unget(token) # :nodoc:
@tokens.unshift token
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unget\n token = @current_token\n p :unget => token if @debug\n raise Error, 'too many #ungets' if token == @tokens.first\n @tokens.unshift token if token\n end",
"def unget token = @current_token\n p :unget => token if @debug\n raise Error, 'too many #ungets' if token == @tokens.first\n ... | [
"0.8528493",
"0.84276074",
"0.7509127",
"0.74703383",
"0.71887916",
"0.7142674",
"0.7142674",
"0.6569722",
"0.6569722",
"0.65427893",
"0.64860123",
"0.64246917",
"0.64199",
"0.6349934",
"0.6300205",
"0.6091549",
"0.5997699",
"0.5997699",
"0.59350634",
"0.59236044",
"0.5912639... | 0.7063888 | 7 |
Calculates the column (by byte) and the line of the current token based on +byte_offset+. | def token_pos(byte_offset) # :nodoc:
[byte_offset - @line_pos, @line]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_line_and_column_from_chunk(offset)\n if offset.zero?\n return [@chunk_line, @chunk_column]\n end\n\n string =\n offset >= @chunk.size ? @chunk : @chunk[0..offset-1]\n\n line_count = string.count(\"\\n\")\n\n column = @chunk_column\n if line_count > 0\n lines = string.split(... | [
"0.73123854",
"0.69533145",
"0.686012",
"0.6838922",
"0.68073505",
"0.6750726",
"0.6750726",
"0.6546697",
"0.6521624",
"0.64754736",
"0.64322734",
"0.64288026",
"0.6391398",
"0.6388595",
"0.63382167",
"0.63304126",
"0.6308968",
"0.62837833",
"0.6277134",
"0.62721205",
"0.6246... | 0.787138 | 0 |
The contents of the lock file. | def to_s
out = []
groups = spec_groups
add_PATH out, groups.delete(Gem::Resolver::VendorSpecification) { [] }
add_GIT out, groups.delete(Gem::Resolver::GitSpecification) { [] }
add_GEM out, groups
add_PLATFORMS out
add_DEPENDENCIES out
out.join "\n"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get\n content =\n if @lock_file\n @lock_file.rewind\n @lock_file.read\n else\n File.read(lock_file_path) if File.exist?(lock_file_path)\n end\n if content\n content.strip!\n content == '' ? nil : content.to_i\n end\n end",
"def read(lockfile)\n Loc... | [
"0.7297783",
"0.7297488",
"0.7043831",
"0.697916",
"0.6878984",
"0.65884626",
"0.65617484",
"0.64492464",
"0.6367416",
"0.6354376",
"0.62992704",
"0.6257032",
"0.62443364",
"0.62443364",
"0.6236805",
"0.6175464",
"0.6160334",
"0.614331",
"0.6112958",
"0.60854685",
"0.60724795... | 0.0 | -1 |
Writes the lock file alongside the gem dependencies file | def write
content = to_s
File.open "#{@gem_deps_file}.lock", 'w' do |io|
io.write content
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_versionlock_file\n transform_str = \"<transform pkg depend -> default facet.version-lock.*> false>\"\n File.write(\"#{staging_dir}/version-lock\", transform_str)\n end",
"def write_lock\n FileUtils.touch(@lock_file)\n end",
"def write_lockfiles\n @lockfile = generate_lockfile\n\... | [
"0.7733984",
"0.7455987",
"0.73878413",
"0.70057184",
"0.682272",
"0.682272",
"0.67749256",
"0.6740288",
"0.66681963",
"0.65986955",
"0.65960777",
"0.65833896",
"0.65314335",
"0.6522447",
"0.65173084",
"0.6465461",
"0.63062114",
"0.62618464",
"0.6115845",
"0.6073048",
"0.6069... | 0.8678429 | 0 |
Creates a RequestSet for a list of Gem::Dependency objects, +deps+. You can then resolve and install the resolved list of dependencies. nokogiri = Gem::Dependency.new 'nokogiri', '~> 1.6' pg = Gem::Dependency.new 'pg', '~> 0.14' set = Gem::RequestSet.new nokogiri, pg | def initialize(*deps)
@dependencies = deps
@always_install = []
@conservative = false
@dependency_names = {}
@development = false
@development_shallow = false
@errors = []
@git_set = nil
@ignore_dependencies = false
@install_dir ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resolve(set=nil)\n r = Gem::DependencyResolver.new(@dependencies, set)\n @requests = r.resolve\n end",
"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 ... | [
"0.71326965",
"0.6874276",
"0.64007276",
"0.6261815",
"0.6223056",
"0.6109639",
"0.61070156",
"0.6018465",
"0.59849715",
"0.59033346",
"0.58805263",
"0.5852273",
"0.5849256",
"0.5787886",
"0.57858694",
"0.57829934",
"0.57782745",
"0.57782745",
"0.5743414",
"0.57108474",
"0.56... | 0.62698156 | 3 |
Declare that a gem of name +name+ with +reqs+ requirements is needed. | def gem(name, *reqs)
if dep = @dependency_names[name]
dep.requirement.concat reqs
else
dep = Gem::Dependency.new name, *reqs
@dependency_names[name] = dep
@dependencies << dep
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gem(name, *reqs)\n @dependencies << Gem::Dependency.new(name, reqs)\n end",
"def gem(name, *reqs)\n @dependencies << Gem::Dependency.new(name, reqs)\n end",
"def gem_requires(name, options) # :nodoc:\n if options.include? :require\n if requires = options.delete(:require)\n @r... | [
"0.79748994",
"0.79748994",
"0.7262244",
"0.70707244",
"0.70044637",
"0.69215024",
"0.6898013",
"0.685084",
"0.6793278",
"0.6792416",
"0.67881024",
"0.67463756",
"0.66196346",
"0.6610684",
"0.6579936",
"0.6368144",
"0.6337323",
"0.6330607",
"0.6311132",
"0.62924224",
"0.62904... | 0.8270009 | 0 |
Add +deps+ Gem::Dependency objects to the set. | def import(deps)
@dependencies.concat deps
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def requires *deps\n return unless @dependency_lib\n\n @parents.concat(deps).uniq!\n deps.each do |dep|\n @dependency_lib.dependencies[dep].each{|d| d.add_child(@name) }\n end\n end",
"def add_dependencies(groups, dependencies) # :nodoc:\n return unless (groups & @without_groups)... | [
"0.7425296",
"0.7403018",
"0.718801",
"0.6877217",
"0.6762271",
"0.670392",
"0.66637003",
"0.65985024",
"0.65822",
"0.6508836",
"0.64713955",
"0.64713955",
"0.63997495",
"0.639642",
"0.63344",
"0.6324904",
"0.6322227",
"0.6272101",
"0.61945575",
"0.61904275",
"0.6173635",
"... | 0.688078 | 3 |
Installs gems for this RequestSet using the Gem::Installer +options+. If a +block+ is given an activation +request+ and +installer+ are yielded. The +installer+ will be +nil+ if a gem matching the request was already installed. | def install(options, &block) # :yields: request, installer
if dir = options[:install_dir]
requests = install_into dir, false, options, &block
return requests
end
@prerelease = options[:prerelease]
requests = []
download_queue = Thread::Queue.new
# Create a thread-safe list of gems... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def install(options = {})\n require_relative '../installer'\n\n gem = download options\n\n installer = Gem::Installer.at gem, options\n\n yield installer if block_given?\n\n @spec = installer.install\n end",
"def install_from_gemdeps(options, &block)\n gemdeps = options[:gemdeps]\n\n @insta... | [
"0.6882298",
"0.68703324",
"0.6750111",
"0.6362227",
"0.6362227",
"0.5958528",
"0.57548356",
"0.5700174",
"0.5492262",
"0.5476466",
"0.5474689",
"0.53902626",
"0.53516436",
"0.523801",
"0.52243173",
"0.52148503",
"0.5173463",
"0.5128871",
"0.51061434",
"0.5093213",
"0.5087256... | 0.7182423 | 0 |
Installs from the gem dependencies files in the +:gemdeps+ option in +options+, yielding to the +block+ as in install. If +:without_groups+ is given in the +options+, those groups in the gem dependencies file are not used. See Gem::Installer for other +options+. | def install_from_gemdeps(options, &block)
gemdeps = options[:gemdeps]
@install_dir = options[:install_dir] || Gem.dir
@prerelease = options[:prerelease]
@remote = options[:domain] != :local
@conservative = true if options[:conservative]
gem_deps_api = load_gemdeps gemdeps, options[:witho... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def install_gem(gem_name, options = {})\n if options[:group]\n gem gem_name, group: options[:group]\n else\n gem gem_name\n end\n run_command \"gem install #{gem_name}\"\n run_command 'bundle install --local'\nend",
"def add_dependencies(groups, dependencies) # :nodoc:\n return unless (groups & @wi... | [
"0.65230536",
"0.6334295",
"0.62488264",
"0.6160211",
"0.61078566",
"0.59825194",
"0.59825194",
"0.59375644",
"0.5930029",
"0.56813014",
"0.56345",
"0.5626002",
"0.56253165",
"0.5616645",
"0.5606915",
"0.5586719",
"0.55572355",
"0.5530845",
"0.55217844",
"0.5506284",
"0.54988... | 0.81261873 | 0 |
Call hooks on installed gems | def install_hooks(requests, options)
specs = requests.map do |request|
case request
when Gem::Resolver::ActivationRequest then
request.spec.spec
else
request
end
end
require_relative "dependency_installer"
inst = Gem::DependencyInstaller.new options
inst.inst... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def install_pre_hook\n end",
"def install_post_hook\n end",
"def post_install\n end",
"def post_install; end",
"def load_gem_plugins; end",
"def require_gems; end",
"def install\r\n super\r\n automated_install {\r\n @local_gems.flush_gem_cache\r\n gem_name = @ov... | [
"0.7126404",
"0.6960404",
"0.6800944",
"0.6755685",
"0.6700467",
"0.6667806",
"0.6653375",
"0.65790474",
"0.65790474",
"0.65790474",
"0.6556236",
"0.6473965",
"0.6464047",
"0.6438465",
"0.63849914",
"0.63495713",
"0.63216394",
"0.63207835",
"0.6306141",
"0.6304537",
"0.630411... | 0.6633668 | 7 |
Load a dependency management file. | def load_gemdeps(path, without_groups = [], installing = false)
@git_set = Gem::Resolver::GitSet.new
@vendor_set = Gem::Resolver::VendorSet.new
@source_set = Gem::Resolver::SourceSet.new
@git_set.root_dir = @install_dir
lock_file = "#{File.expand_path(path)}.lock".dup.tap(&Gem::UNTAINT)
beg... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load\n\t\tsource = self.depfile.read\n\t\tself.instance_eval( source, self.depfile.to_s, 1 )\n\tend",
"def load!\n contents = File.read(filepath).strip\n hash = parse(contents)\n\n hash[:dependencies].each do |name, options|\n # Dynamically calculate paths relative to the Berksfile ... | [
"0.72677606",
"0.70169926",
"0.6617666",
"0.6575002",
"0.65559417",
"0.6544869",
"0.6381312",
"0.634785",
"0.63024586",
"0.629047",
"0.6263033",
"0.60645026",
"0.6013078",
"0.59423435",
"0.5928375",
"0.58791906",
"0.58785176",
"0.58785176",
"0.5858958",
"0.5827149",
"0.581423... | 0.5575024 | 42 |
Resolve the requested dependencies and return an Array of Specification objects to be activated. | def resolve(set = Gem::Resolver::BestSet.new)
@sets << set
@sets << @git_set
@sets << @vendor_set
@sets << @source_set
set = Gem::Resolver.compose_sets(*@sets)
set.remote = @remote
set.prerelease = @prerelease
resolver = Gem::Resolver.new @dependencies, set
resolver.development ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def specs\n @specs ||= begin\n specs = resolve.materialize(requested_dependencies)\n\n all_dependencies = requested_dependencies.concat(specs.flat_map(&:dependencies))\n if all_dependencies.any? { |d| d.name == \"bundler\" } && !specs[\"bundler\"].any?\n bundler = sourc... | [
"0.72479755",
"0.70768887",
"0.7041122",
"0.6968127",
"0.68024844",
"0.68009377",
"0.67372847",
"0.65676296",
"0.65207475",
"0.6463848",
"0.6458513",
"0.642877",
"0.63591105",
"0.6332196",
"0.6247352",
"0.62301016",
"0.6185193",
"0.6172897",
"0.6165247",
"0.613873",
"0.612311... | 0.5862958 | 30 |
Resolve the requested dependencies against the gems available via Gem.path and return an Array of Specification objects to be activated. | def resolve_current
resolve Gem::Resolver::CurrentSet.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_all_satisfiers(dep)\n Gem::Specification.each do |spec|\n yield spec if spec.satisfies_requirement? dep\n end\n end",
"def find_all(req)\n res = []\n\n dep = req.dependency\n\n return res if @ignore_dependencies and\n @always_install.none? {|spec| dep.match? spec }\n\n ... | [
"0.7426321",
"0.73905724",
"0.724543",
"0.71207273",
"0.69873184",
"0.6978708",
"0.6879099",
"0.6834265",
"0.6759716",
"0.6755977",
"0.67321956",
"0.6664971",
"0.6659301",
"0.664064",
"0.66357195",
"0.6633234",
"0.6581622",
"0.6573811",
"0.6564571",
"0.6526113",
"0.65194666",... | 0.0 | -1 |
The error message for the missing dependency, including the specifications that had this dependency. | def message
sources = required_by.map { |r| "`#{r}`" }.join(' and ')
message = "Unable to find a specification for `#{dependency}`"
message += " depended upon by #{sources}" unless sources.empty?
message
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def error_message\n @load.each {|f| loadable?(f, true) }\n \"Cyclic dependency prevented loading \\n#{@load.join(\"\\n\")}\"\n end",
"def _dependency_error(req, src, msg)\n raise LoadError, sprintf(msg, req, src)\n end",
"def cargo_required_msg\n cargo_msg('required')\n end",
"def gem_... | [
"0.69294095",
"0.6639917",
"0.64086634",
"0.6408312",
"0.6285345",
"0.622004",
"0.61657953",
"0.6103323",
"0.6103205",
"0.6061178",
"0.6051147",
"0.59807444",
"0.59719425",
"0.5971596",
"0.59653807",
"0.5953419",
"0.59431535",
"0.5888199",
"0.5885712",
"0.5876976",
"0.5861805... | 0.81964576 | 0 |
Initializes a new error with the given circular vertices. | def initialize(vertices)
super "There is a circular dependency between #{vertices.map(&:name).join(' and ')}"
@dependencies = vertices.map { |vertex| vertex.payload.possibilities.last }.to_set
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(vertices, edges)\r\n @vertices = vertices\r\n @edges = edges\r\n end",
"def initialize(r, c)\n [r, c].each do |input|\n raise ArgumentError,\n \"input must be a Numeric.\\n\" + \n \"Received a #{input.class}\" unless input.is_a? Numeric\n end\n @r = r\n @c = c... | [
"0.58884144",
"0.55013853",
"0.5476885",
"0.5437641",
"0.54321635",
"0.54272974",
"0.5376987",
"0.5308531",
"0.52907723",
"0.52243304",
"0.5219589",
"0.51396954",
"0.5135283",
"0.511421",
"0.5112179",
"0.5054093",
"0.5026133",
"0.5005035",
"0.49951354",
"0.49888062",
"0.49783... | 0.65665 | 0 |
Makes the set compare its elements by their identity and returns self. This method may not be supported by all subclasses of Set. | def compare_by_identity
if @hash.respond_to?(:compare_by_identity)
@hash.compare_by_identity
self
else
raise NotImplementedError, "#{self.class.name}\##{__method__} is not implemented"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_set\n ::Set.new(to_a)\n end",
"def to_set(klass = IntegerSet, *args, &block)\n return self if instance_of?(IntegerSet) && klass == IntegerSet && block.nil? && args.empty?\n klass.new(self, *args, &block)\n end",
"def to_set\n require 'set' unless defined?(::Set)\n each.to_se... | [
"0.6284302",
"0.6201168",
"0.6151969",
"0.6126562",
"0.6090626",
"0.60585624",
"0.6050142",
"0.6025872",
"0.5875106",
"0.5830679",
"0.58242095",
"0.5703577",
"0.5649129",
"0.5645337",
"0.5644274",
"0.5602431",
"0.5565139",
"0.55500066",
"0.55500066",
"0.5503018",
"0.5494092",... | 0.5427442 | 26 |
Returns true if the set will compare its elements by their identity. Also see Setcompare_by_identity. | def compare_by_identity?
@hash.respond_to?(:compare_by_identity?) && @hash.compare_by_identity?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def identity?\n [1, 2, 3, 5, 6, 7].all? { |i| self[i] == 0 } && [0, 4, 8].all? { |i| self[i] == 1 }\n end",
"def ==(set)\n equal?(set) and return true\n\n set.is_a?(Set) && size == set.size or return false\n\n hash = @hash.dup\n set.all? { |o| hash.include?(o) }\n end",
"def identity?\n ... | [
"0.67367876",
"0.6677462",
"0.6411214",
"0.6399839",
"0.62041914",
"0.62041914",
"0.61711645",
"0.61655396",
"0.6081366",
"0.6062389",
"0.604027",
"0.6028056",
"0.59635216",
"0.5937551",
"0.5925318",
"0.5919984",
"0.58914644",
"0.5874096",
"0.58264905",
"0.5811601",
"0.575218... | 0.71166956 | 0 |
Returns the number of elements. | def size
@hash.size
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def length\r\n elements.length\r\n end",
"def count\n elements.count\n end",
"def size\n @elements.length\n end",
"def size\n Integer.new.tap do |count|\n each { |element| count += 1 }\n end\n end",
"def size\n @elements.size\n end",
"def size\n @elements.si... | [
"0.8530973",
"0.84964323",
"0.8399763",
"0.8318897",
"0.82545125",
"0.82147294",
"0.8192391",
"0.8151407",
"0.80532426",
"0.7971111",
"0.7800058",
"0.77746934",
"0.7763093",
"0.7714512",
"0.76724255",
"0.7658094",
"0.7638569",
"0.76190615",
"0.7582801",
"0.758261",
"0.7577100... | 0.0 | -1 |
Returns true if the set contains no elements. | def empty?
@hash.empty?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __empty?\n all?(&:__empty?)\n end",
"def empty?\n _values.all?(&:empty?)\n end",
"def __empty?\n return false unless super\n __elements.values.all?(&:__empty?)\n end",
"def empty_piece_set?\n @piece_sets.any? { |c, piece_set| piece_set.empty? }\n end",
... | [
"0.77149636",
"0.7573135",
"0.7544633",
"0.7529679",
"0.75182074",
"0.75067425",
"0.7397846",
"0.7394712",
"0.7375246",
"0.7362599",
"0.7313121",
"0.73053324",
"0.72832084",
"0.72832084",
"0.72820234",
"0.7277977",
"0.7266268",
"0.72610825",
"0.72610825",
"0.72610825",
"0.725... | 0.0 | -1 |
Converts the set to an array. The order of elements is uncertain. Set[1, 2].to_a => [1, 2] Set[1, 'c', :s].to_a => [1, "c", :s] | def to_a
@hash.keys
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_a\n to_set.to_a\n end",
"def to_set\n ::Set.new(to_a)\n end",
"def to_a\n set\n end",
"def to_a\n array\n end",
"def to_array\n array = []\n self.each { |x| array.push x }\n return array\n end",
"def to_set\n require 'set' unless defined?(::Se... | [
"0.74451035",
"0.68717885",
"0.6864363",
"0.6790578",
"0.6768181",
"0.664474",
"0.6632242",
"0.6627467",
"0.66016495",
"0.65843177",
"0.65668976",
"0.65668976",
"0.6534267",
"0.6494274",
"0.6482679",
"0.6457573",
"0.6454295",
"0.64536625",
"0.64421165",
"0.639348",
"0.6366856... | 0.0 | -1 |
Returns self if no arguments are given. Otherwise, converts the set to another with `klass.new(self, args, &block)`. In subclasses, returns `klass.new(self, args, &block)` unless overridden. | def to_set(klass = Set, *args, &block)
return self if instance_of?(Set) && klass == Set && block.nil? && args.empty?
klass.new(self, *args, &block)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_set(klass = IntegerSet, *args, &block)\n return self if instance_of?(IntegerSet) && klass == IntegerSet && block.nil? && args.empty?\n klass.new(self, *args, &block)\n end",
"def _klass_new(*args, &block)\n inst = super()\n inst._set_self(_self)\n inst._struct_class = _struct_class\n... | [
"0.7301619",
"0.58013886",
"0.56990993",
"0.56921536",
"0.56341314",
"0.5579815",
"0.555353",
"0.55469316",
"0.55032337",
"0.5500041",
"0.54968965",
"0.54934835",
"0.5453056",
"0.5450459",
"0.544223",
"0.540859",
"0.5371825",
"0.53702843",
"0.5370272",
"0.5364762",
"0.5327722... | 0.752168 | 0 |
Returns a new set that is a copy of the set, flattening each containing set recursively. | def flatten
self.class.new.flatten_merge(self)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flatten!\n replace(flatten()) if any? { |e| e.is_a?(Set) }\n end",
"def flatten!\n if detect { |e| e.is_a?(Set) }\n replace(flatten())\n else\n nil\n end\n end",
"def flatten\n dup\n end",
"def clone\n new_set = TreeSet.new\n # Create new nodes in the same order as s... | [
"0.7746183",
"0.7116771",
"0.7038308",
"0.68679774",
"0.668503",
"0.6563927",
"0.64224744",
"0.6315626",
"0.6237105",
"0.62362516",
"0.6141065",
"0.61365724",
"0.6129426",
"0.6124841",
"0.60619247",
"0.6058868",
"0.60380876",
"0.60132515",
"0.59819",
"0.5976201",
"0.5966969",... | 0.6820094 | 5 |
Equivalent to Setflatten, but replaces the receiver with the result in place. Returns nil if no modifications were made. | def flatten!
replace(flatten()) if any? { |e| e.is_a?(Set) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flatten!\n self.replace(flatten)\n end",
"def my_flatten!\n self.replace(my_flatten)\n end",
"def flatten!\n if detect { |e| e.is_a?(Set) }\n replace(flatten())\n else\n nil\n end\n end",
"def flatten\n self.class.new.flatten_merge(self)\n end",
"def flatten\n self.cl... | [
"0.8162164",
"0.7770457",
"0.76846385",
"0.7258766",
"0.7258766",
"0.7130659",
"0.7111156",
"0.7043558",
"0.6762009",
"0.6697074",
"0.6426523",
"0.6329042",
"0.6313594",
"0.63130975",
"0.627822",
"0.6274606",
"0.6267801",
"0.62605894",
"0.6230132",
"0.6208361",
"0.6196399",
... | 0.71384734 | 5 |
Returns true if the set contains the given object. Note that include? and member? do not test member equality using == as do other Enumerables. See also Enumerableinclude? | def include?(o)
@hash[o]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def include?(obj)\n self.each{|*val|\n return true if val.__svalue == obj\n }\n false\n end",
"def include?(obj)\n each { |o| return true if o == obj }\n false\n end",
"def include?(obj)\n each { |o| return true if obj == o }\n false\n end",
"def include?(object)\n each {|item... | [
"0.73972267",
"0.7373548",
"0.7347843",
"0.72811097",
"0.72240794",
"0.720199",
"0.71886665",
"0.71886665",
"0.71750575",
"0.7089501",
"0.7029281",
"0.694644",
"0.6924978",
"0.6876551",
"0.6822524",
"0.6650712",
"0.6546894",
"0.648626",
"0.64410746",
"0.6365065",
"0.6365065",... | 0.6743355 | 15 |
Returns true if the set is a superset of the given set. | def superset?(set)
case
when set.instance_of?(self.class) && @hash.respond_to?(:>=)
@hash >= set.instance_variable_get(:@hash)
when set.is_a?(Set)
size >= set.size && set.all? { |o| include?(o) }
else
raise ArgumentError, "value must be a set"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def superset?(set)\n set.is_a?(Set) or raise ArgumentError, \"value must be a set\"\n return false if size < set.size\n set.all? { |o| include?(o) }\n end",
"def proper_superset?(set)\n set.is_a?(Set) or raise ArgumentError, \"value must be a set\"\n return false if size <= set.size\n set.all?... | [
"0.8864733",
"0.88596016",
"0.87935793",
"0.87692624",
"0.8576132",
"0.8387658",
"0.8172478",
"0.78771776",
"0.76320004",
"0.7519514",
"0.7494639",
"0.7466673",
"0.74023664",
"0.7291454",
"0.72127897",
"0.697179",
"0.6906721",
"0.6767533",
"0.6532307",
"0.65253544",
"0.651221... | 0.8432485 | 5 |
Returns true if the set is a proper superset of the given set. | def proper_superset?(set)
case
when set.instance_of?(self.class) && @hash.respond_to?(:>)
@hash > set.instance_variable_get(:@hash)
when set.is_a?(Set)
size > set.size && set.all? { |o| include?(o) }
else
raise ArgumentError, "value must be a set"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def proper_superset?(set)\n set.is_a?(Set) or raise ArgumentError, \"value must be a set\"\n return false if size <= set.size\n set.all? { |o| include?(o) }\n end",
"def proper_superset?(set)\n return self != set && superset?(set) if set.is_a?(IntegerSet)\n set.is_a?(Set) or raise ArgumentError, ... | [
"0.895602",
"0.88511217",
"0.86872",
"0.86211425",
"0.84341466",
"0.83447415",
"0.82040083",
"0.79529166",
"0.7817941",
"0.77710766",
"0.7686215",
"0.74118054",
"0.74037015",
"0.7323191",
"0.72531354",
"0.7244312",
"0.6952531",
"0.6929702",
"0.6822365",
"0.66910833",
"0.64684... | 0.82463366 | 6 |
Returns true if the set is a subset of the given set. | def subset?(set)
case
when set.instance_of?(self.class) && @hash.respond_to?(:<=)
@hash <= set.instance_variable_get(:@hash)
when set.is_a?(Set)
size <= set.size && all? { |o| set.include?(o) }
else
raise ArgumentError, "value must be a set"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subset?(set)\n set.is_a?(Set) or raise ArgumentError, \"value must be a set\"\n return false if set.size < size\n all? { |o| set.include?(o) }\n end",
"def subset?(set)\n set.all? { |val| self.include?(val) }\n end",
"def proper_subset?(set)\n set.is_a?(Set) or raise ArgumentError, \"v... | [
"0.9092463",
"0.904072",
"0.88729894",
"0.87656915",
"0.86218554",
"0.8248966",
"0.81712097",
"0.81253624",
"0.79822594",
"0.79524636",
"0.7916464",
"0.7782026",
"0.7721781",
"0.7634269",
"0.76280427",
"0.74710345",
"0.7419067",
"0.7226138",
"0.72202724",
"0.71677625",
"0.712... | 0.8579006 | 5 |
Returns true if the set is a proper subset of the given set. | def proper_subset?(set)
case
when set.instance_of?(self.class) && @hash.respond_to?(:<)
@hash < set.instance_variable_get(:@hash)
when set.is_a?(Set)
size < set.size && all? { |o| set.include?(o) }
else
raise ArgumentError, "value must be a set"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def proper_subset?(set)\n set.is_a?(Set) or raise ArgumentError, \"value must be a set\"\n return false if set.size <= size\n all? { |o| set.include?(o) }\n end",
"def proper_subset?(set)\n return self != set && subset?(set) if set.is_a?(IntegerSet)\n set.is_a?(Set) or raise ArgumentError, \"valu... | [
"0.9039534",
"0.8969179",
"0.8710061",
"0.8657601",
"0.83791727",
"0.83315027",
"0.82748514",
"0.80841416",
"0.79265267",
"0.78640586",
"0.78238434",
"0.77282894",
"0.769709",
"0.76786405",
"0.752219",
"0.74939317",
"0.7399944",
"0.7312544",
"0.7224059",
"0.71952564",
"0.7076... | 0.8434635 | 4 |
Returns 0 if the set are equal, 1 / +1 if the set is a proper subset / superset of the given set, or nil if they both have unique elements. | def <=>(set)
return unless set.is_a?(Set)
case size <=> set.size
when -1 then -1 if proper_subset?(set)
when +1 then +1 if proper_superset?(set)
else 0 if self.==(set)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def superset?(set)\n return (~@val & set.to_i) == 0 if set.is_a?(IntegerSet)\n set.is_a?(Set) or raise ArgumentError, \"value must be a set\"\n return false if size < set.size\n set.all? { |o| include?(o) }\n end",
"def proper_superset?(set)\n case\n when set.instance_of?(self.class) && @hash.... | [
"0.64473546",
"0.63924646",
"0.63900137",
"0.63351434",
"0.630781",
"0.620137",
"0.6082387",
"0.606707",
"0.6057407",
"0.6021478",
"0.5979248",
"0.59660035",
"0.5874845",
"0.58315516",
"0.5810403",
"0.57519406",
"0.57354",
"0.5728084",
"0.5701573",
"0.5688225",
"0.5669494",
... | 0.6946508 | 0 |
Returns true if the set and the given enumerable have at least one element in common. Set[1, 2, 3].intersect? Set[4, 5] => false Set[1, 2, 3].intersect? Set[3, 4] => true Set[1, 2, 3].intersect? 4..5 => false Set[1, 2, 3].intersect? [3, 4] => true | def intersect?(set)
case set
when Set
if size < set.size
any? { |o| set.include?(o) }
else
set.any? { |o| include?(o) }
end
when Enumerable
set.any? { |o| include?(o) }
else
raise ArgumentError, "value must be enumerable"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def intersect?(set)\n return (@val & set.to_i) > 0 if set.is_a?(IntegerSet)\n set.is_a?(Set) or raise ArgumentError, \"value must be a set\"\n if size < set.size\n any? { |o| set.include?(o) }\n else\n set.any? { |o| include?(o) }\n end\n end",
"def intersect?(other_set)\n requir... | [
"0.7872922",
"0.7714104",
"0.70915407",
"0.70357335",
"0.70252335",
"0.6919744",
"0.6794655",
"0.6767453",
"0.673377",
"0.673377",
"0.6687355",
"0.6631775",
"0.6602416",
"0.65742916",
"0.653101",
"0.6526544",
"0.65096354",
"0.65050226",
"0.64973956",
"0.64789057",
"0.63601124... | 0.8485178 | 0 |
Returns true if the set and the given enumerable have no element in common. This method is the opposite of `intersect?`. Set[1, 2, 3].disjoint? Set[3, 4] => false Set[1, 2, 3].disjoint? Set[4, 5] => true Set[1, 2, 3].disjoint? [3, 4] => false Set[1, 2, 3].disjoint? 4..5 => true | def disjoint?(set)
!intersect?(set)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def disjoint?(set)\n !intersect?(set)\n end",
"def disjoint?(*args)\n not intersects?(*args)\n end",
"def intersect?(other_set)\n requires_set(other_set, __method__)\n intersection(other_set).any?\n end",
"def intersect?(set)\n case set\n when Set\n if size < set.s... | [
"0.8192936",
"0.67798865",
"0.6521303",
"0.6515522",
"0.629359",
"0.629359",
"0.629359",
"0.6058832",
"0.60567874",
"0.5989785",
"0.5972146",
"0.59190243",
"0.5900131",
"0.58815145",
"0.58093894",
"0.58093894",
"0.5754633",
"0.5721724",
"0.57196426",
"0.5716097",
"0.56268203"... | 0.81201184 | 2 |
Calls the given block once for each element in the set, passing the element as parameter. Returns an enumerator if no block is given. | def each(&block)
block or return enum_for(__method__) { size }
@hash.each_key(&block)
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def each(&block)\n to_set.each(&block)\n end",
"def each(&block)\n return to_enum(:each) unless block_given?\n size.times.each { |i| yield @elements[i] }\n self\n end",
"def each(&block)\n i = @elements.length - 1\n while i >= 0\n yield @elements[i]\n i -= 1\n ... | [
"0.7111286",
"0.6834169",
"0.68160033",
"0.68076706",
"0.6764671",
"0.6700113",
"0.65759116",
"0.65691954",
"0.6522371",
"0.6480212",
"0.646126",
"0.6430577",
"0.63982946",
"0.6396594",
"0.6371225",
"0.635623",
"0.63516253",
"0.63512367",
"0.63471776",
"0.63334954",
"0.633019... | 0.0 | -1 |
Deletes the given object from the set and returns self. Use `subtract` to delete many items at once. | def delete(o)
@hash.delete(o)
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove(obj)\n @set.removeObject obj\n end",
"def delete(o); removeObject o end",
"def subtract(enum)\n if enum.instance_of?(IntegerSet)\n @val &= ~enum.to_i\n else\n do_with_enum(enum) { |o| delete(o) }\n end\n\n self\n end",
"def delete(o)\n @val &= ~(1 << o) if valid_m... | [
"0.72748166",
"0.6444232",
"0.63340575",
"0.62040913",
"0.60915244",
"0.6032067",
"0.6026127",
"0.59912777",
"0.5948086",
"0.5945579",
"0.5916429",
"0.5839276",
"0.5821947",
"0.5817852",
"0.57907784",
"0.5776789",
"0.5768297",
"0.57530653",
"0.5734335",
"0.57285976",
"0.56964... | 0.6153303 | 5 |
Deletes the given object from the set and returns self. If the object is not in the set, returns nil. | def delete?(o)
delete(o) if include?(o)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove(obj)\n @set.removeObject obj\n end",
"def delete(o)\n @hash.delete(o)\n self\n end",
"def delete(o)\n @hash.delete(o)\n self\n end",
"def delete_one(object)\n position = index(object)\n position ? delete_at(position) : nil\n end",
"def delete(o); removeOb... | [
"0.785437",
"0.6494673",
"0.6494673",
"0.636024",
"0.6344105",
"0.6221727",
"0.6195559",
"0.6076083",
"0.5973364",
"0.5940748",
"0.5881446",
"0.58746284",
"0.580699",
"0.5805514",
"0.57930005",
"0.5790464",
"0.57875395",
"0.5753106",
"0.57510394",
"0.5713379",
"0.5713379",
... | 0.52404404 | 44 |
Deletes every element of the set for which block evaluates to true, and returns self. Returns an enumerator if no block is given. | def delete_if
block_given? or return enum_for(__method__) { size }
# @hash.delete_if should be faster, but using it breaks the order
# of enumeration in subclasses.
select { |o| yield o }.each { |o| @hash.delete(o) }
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_if(&block)\n unless block_given?\n return ArrayEnumerator.new(self, :delete_if) # for 1.8.7\n end\n i = 0\n lim = self.__size\n while i < lim\n break if block.call(self.__at(i) )\n i += 1\n end\n\n fill_idx = i\n while i < lim\n el = self.__at(i)\n unless... | [
"0.6591967",
"0.6571777",
"0.6422458",
"0.6422458",
"0.62976867",
"0.62034494",
"0.6197347",
"0.6082609",
"0.6006837",
"0.60032964",
"0.59697235",
"0.5960063",
"0.5960063",
"0.584698",
"0.58236533",
"0.5781291",
"0.57661664",
"0.57339734",
"0.56938523",
"0.56740916",
"0.56435... | 0.6111686 | 7 |
Deletes every element of the set for which block evaluates to false, and returns self. Returns an enumerator if no block is given. | def keep_if
block_given? or return enum_for(__method__) { size }
# @hash.keep_if should be faster, but using it breaks the order of
# enumeration in subclasses.
reject { |o| yield o }.each { |o| @hash.delete(o) }
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def select!\n return enum_for(:select!) if not block_given?\n each { |n| remove(n) if not yield n }\n self\n end",
"def reject!\n return Enumerator.new(self, :reject!) unless block_given?\n select! { |key, obj| !yield(key, obj) }\n end",
"def delete_if(&block)\n unless block_given?\n ... | [
"0.6555311",
"0.6489236",
"0.64738286",
"0.6410115",
"0.6216023",
"0.6216023",
"0.6152456",
"0.6152456",
"0.61248636",
"0.6071128",
"0.6018757",
"0.5930931",
"0.5879128",
"0.5862951",
"0.5837237",
"0.58347017",
"0.57913727",
"0.57684135",
"0.5762956",
"0.5728561",
"0.57089096... | 0.55142707 | 28 |
Replaces the elements with ones returned by `collect()`. Returns an enumerator if no block is given. | def collect!
block_given? or return enum_for(__method__) { size }
set = self.class.new
each { |o| set << yield(o) }
replace(set)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def collect!(&block)\n unless block_given?\n return ArrayEnumerator.new(self, :collect! ) # for 1.8.7\n end\n i = 0\n sz = self.__size\n enum_res = self.each { | elem | # use self.each to handle break in block\n self.__at_put(i, block.call( elem ) )\n i += 1\n }\n if i < sz\n ... | [
"0.7318515",
"0.6570945",
"0.63264483",
"0.62089866",
"0.6032014",
"0.6001215",
"0.57832927",
"0.5745796",
"0.5737225",
"0.5735506",
"0.5735506",
"0.57314074",
"0.5649546",
"0.5631936",
"0.5628099",
"0.5625587",
"0.5614651",
"0.55665123",
"0.55636656",
"0.553971",
"0.553971",... | 0.62029415 | 4 |
Equivalent to Setdelete_if, but returns nil if no changes were made. Returns an enumerator if no block is given. | def reject!(&block)
block or return enum_for(__method__) { size }
n = size
delete_if(&block)
self if size != n
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_if\n block_given? or return enum_for(__method__)\n select { |o| yield o }.each { |o| delete(o) }\n self\n end",
"def delete_if(&block)\n unless block_given?\n return ArrayEnumerator.new(self, :delete_if) # for 1.8.7\n end\n i = 0\n lim = self.__size\n while i < lim\n ... | [
"0.7126879",
"0.70914763",
"0.67604953",
"0.6742619",
"0.67126906",
"0.6632846",
"0.66241646",
"0.65739566",
"0.6553992",
"0.65118134",
"0.61761427",
"0.61434174",
"0.60590386",
"0.6007616",
"0.5915386",
"0.59077996",
"0.59077996",
"0.589268",
"0.58704543",
"0.5684001",
"0.56... | 0.4583687 | 89 |
Equivalent to Setkeep_if, but returns nil if no changes were made. Returns an enumerator if no block is given. | def select!(&block)
block or return enum_for(__method__) { size }
n = size
keep_if(&block)
self if size != n
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def keep_if(&block); end",
"def keep_if\n delete_if { |item| not yield(item) }\n end",
"def keep_if\n block_given? or return enum_for(__method__)\n reject { |o| yield o }.each { |o| delete(o) }\n self\n end",
"def select!\n _check_frozen\n return to_enum(__callee__) unless block_given... | [
"0.6528833",
"0.63316345",
"0.62660843",
"0.6255282",
"0.6159283",
"0.6148443",
"0.5999091",
"0.59881777",
"0.5985795",
"0.58969957",
"0.5891522",
"0.58192563",
"0.57415175",
"0.57158405",
"0.568768",
"0.56831473",
"0.56457746",
"0.56407034",
"0.56338406",
"0.5632988",
"0.559... | 0.49105763 | 66 |
Merges the elements of the given enumerable object to the set and returns self. | def merge(enum)
if enum.instance_of?(self.class)
@hash.update(enum.instance_variable_get(:@hash))
else
do_with_enum(enum) { |o| add(o) }
end
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def merge(enum)\n if enum.is_a?(Set)\n @hash.update(enum.instance_eval { @hash })\n else\n enum.is_a?(Enumerable) or raise ArgumentError, \"value must be enumerable\"\n enum.each { |o| add(o) }\n end\n\n self\n end",
"def set(enumerable); end",
"def |(enum)\n if enum.is_a?(Set)\n... | [
"0.70508987",
"0.650582",
"0.6497025",
"0.6427933",
"0.6336321",
"0.61929286",
"0.61771244",
"0.61464256",
"0.6113279",
"0.6021787",
"0.59933966",
"0.58886755",
"0.58870804",
"0.56752527",
"0.56416196",
"0.55507994",
"0.5533572",
"0.55152035",
"0.5490271",
"0.5368241",
"0.532... | 0.50752157 | 38 |
Deletes every element that appears in the given enumerable object and returns self. | def subtract(enum)
do_with_enum(enum) { |o| delete(o) }
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subtract(enum)\n enum.is_a?(Enumerable) or raise ArgumentError, \"value must be enumerable\"\n enum.each { |o| delete(o) }\n self\n end",
"def clear\n return self if empty?\n\n entities = @entities.dup\n inverse_metadata = metadata.inverse_metadata\n\n @entities.clear\n\... | [
"0.5898701",
"0.58672845",
"0.58487654",
"0.5574761",
"0.55580074",
"0.54487914",
"0.5423562",
"0.5382546",
"0.5362261",
"0.5345186",
"0.53411007",
"0.5280276",
"0.52795833",
"0.5238224",
"0.5232396",
"0.5201476",
"0.5195876",
"0.51895547",
"0.5186822",
"0.5186753",
"0.518164... | 0.47695795 | 73 |
Returns true if two sets are equal. The equality of each couple of elements is defined according to Objecteql?. Set[1, 2] == Set[2, 1] => true Set[1, 3, 5] == Set[1, 5] => false Set['a', 'b', 'c'] == Set['a', 'c', 'b'] => true Set['a', 'b', 'c'] == ['a', 'c', 'b'] => false | def ==(other)
if self.equal?(other)
true
elsif other.instance_of?(self.class)
@hash == other.instance_variable_get(:@hash)
elsif other.is_a?(Set) && self.size == other.size
other.all? { |o| @hash.include?(o) }
else
false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ==(other_set)\n requires_set(other_set, __method__)\n other_set.instance_eval { @internal_hash } == @internal_hash\n end",
"def ===(other)\n to_set == other.to_set\n end",
"def same_set?(a, b)\n ((a - b) + (b - a)).blank?\n end",
"def ==(set)\n equal?(set) and return true\n\n ... | [
"0.74007916",
"0.7164914",
"0.7141594",
"0.7126959",
"0.69933224",
"0.69705623",
"0.6969241",
"0.68809927",
"0.6793661",
"0.664663",
"0.6595888",
"0.6551711",
"0.6518598",
"0.6469124",
"0.64623266",
"0.64549893",
"0.6449641",
"0.6441375",
"0.64256",
"0.6396948",
"0.63750494",... | 0.7393877 | 1 |
Resets the internal state after modification to existing elements and returns self. Elements will be reindexed and deduplicated. | def reset
if @hash.respond_to?(:rehash)
@hash.rehash # This should perform frozenness check.
else
raise FrozenError, "can't modify frozen #{self.class.name}" if frozen?
end
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clone\n obj = super\n elements = @elements.clone\n obj.instance_eval { @elements = elements }\n return obj\n end",
"def rehash\n @rules.rehash\n @elements = nil\n end",
"def clear\n @seen.clear\n return self\n end",
"def reset\n @ind... | [
"0.6471127",
"0.6389165",
"0.62673354",
"0.620311",
"0.6006981",
"0.5917559",
"0.58535296",
"0.58433425",
"0.5837438",
"0.57723504",
"0.57513773",
"0.569452",
"0.56890595",
"0.56570053",
"0.56506425",
"0.55922306",
"0.55191064",
"0.54974425",
"0.54852307",
"0.5468883",
"0.544... | 0.0 | -1 |
Returns a string created by converting each element of the set to a string See also: Arrayjoin | def join(separator=nil)
to_a.join(separator)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_s\n\t\t\t\t'[' << map(&:to_s).join(', ') << ']'\n\t\t\tend",
"def to_s\n\t\tself.to_a.map {|x| x.to_s}.join\n\tend",
"def to_s\n self.to_a.map {|x| x.to_s}.join\n end",
"def to_s\n self.to_a.map {|x| x.to_s}.join\n end",
"def to_s\n\t\t\tself.to_a.map {|x| x.to_s}.join\n\t\tend",
"... | [
"0.7058367",
"0.7039812",
"0.70084804",
"0.70084804",
"0.6905154",
"0.6905154",
"0.6905154",
"0.68888605",
"0.68825346",
"0.67685425",
"0.6731226",
"0.67233706",
"0.66925937",
"0.6675107",
"0.6661647",
"0.66034925",
"0.6602699",
"0.6602699",
"0.65526706",
"0.6538796",
"0.6486... | 0.0 | -1 |
Performs the action on the given graph. | def up(graph)
raise 'Abstract'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def method_missing(method, *args, &block)\n graph.send method, *args, &block\n end",
"def graph_call(path, args = {}, verb = \"get\", options = {}, &post_processing)\n result = api(path, args, verb, options) do |response|\n error = check_response(response)\n raise error if error\... | [
"0.6209385",
"0.5663119",
"0.5529424",
"0.55188996",
"0.5505209",
"0.5366893",
"0.5292161",
"0.52815944",
"0.5255059",
"0.5164777",
"0.5156358",
"0.5151336",
"0.5149512",
"0.51252294",
"0.5122551",
"0.509671",
"0.5092263",
"0.5084398",
"0.5065031",
"0.5065031",
"0.5044821",
... | 0.5161794 | 10 |
Reverses the action on the given graph. | def down(graph)
raise 'Abstract'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pop!(graph)\n return unless action = @current_action\n unless @current_action = action.previous\n @first_action = nil\n end\n action.down(graph)\n action\n end",
"def reverse_graph\n copy_graph # clone copy of old graph in cadj_lists, ca_matrix\n read_v... | [
"0.67112845",
"0.6305563",
"0.6134161",
"0.60882735",
"0.6085869",
"0.6023005",
"0.6006908",
"0.5942796",
"0.59306407",
"0.59306407",
"0.5833229",
"0.5809571",
"0.5809571",
"0.5754758",
"0.5726579",
"0.5726579",
"0.56881094",
"0.5643488",
"0.5635854",
"0.5635854",
"0.5605259"... | 0.59101754 | 10 |
Initialize an action to add an edge to a dependency graph | def initialize(origin, destination, requirement)
@origin = origin
@destination = destination
@requirement = requirement
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_edge( edge )\n super( edge.source, edge.target, edge )\n __add_edge__( edge )\n end",
"def add_edge(source, target, edge = Edge.new)\n _clear_cache\n @pathway.append(Bio::Relation.new(source, target, edge))\n edge\n end",
"def add_edge(e)\n @edges[e.from] << e\n ... | [
"0.68064123",
"0.6530506",
"0.6437699",
"0.6374471",
"0.63673097",
"0.6361885",
"0.6301423",
"0.6272684",
"0.62586087",
"0.62428695",
"0.62394935",
"0.61637104",
"0.6104087",
"0.60959345",
"0.60956573",
"0.6066604",
"0.6055956",
"0.60518104",
"0.604469",
"0.60223114",
"0.6014... | 0.0 | -1 |
Initialize an action to add a vertex to a dependency graph | def initialize(name, payload, root)
@name = name
@payload = payload
@root = root
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_vertex!(vertex)\n\tend",
"def add_vertex!(vertex)\n\tend",
"def add_vertex(node)\n @structure[node] ||= []\n end",
"def add_vertex(x)\n raise\n end",
"def add_vertex(payload)\n @v << Vertex.new(payload)\n end",
"def add_vertex(v)\n @vertices << v\n @edges[v] = []\n end",
"def... | [
"0.65981257",
"0.65981257",
"0.640351",
"0.6355321",
"0.6351292",
"0.6256213",
"0.6225423",
"0.6202656",
"0.61940706",
"0.6169334",
"0.6156644",
"0.61079603",
"0.61059505",
"0.60733765",
"0.60240936",
"0.6017804",
"0.596628",
"0.5849734",
"0.58272517",
"0.5774002",
"0.5774002... | 0.0 | -1 |
Initialize an action to add an edge to a dependency graph | def initialize(origin_name, destination_name, requirement)
@origin_name = origin_name
@destination_name = destination_name
@requirement = requirement
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_edge( edge )\n super( edge.source, edge.target, edge )\n __add_edge__( edge )\n end",
"def add_edge(source, target, edge = Edge.new)\n _clear_cache\n @pathway.append(Bio::Relation.new(source, target, edge))\n edge\n end",
"def add_edge(e)\n @edges[e.from] << e\n ... | [
"0.68067366",
"0.65316945",
"0.64392704",
"0.6375227",
"0.6367285",
"0.63638794",
"0.63025695",
"0.6274041",
"0.6260233",
"0.6244818",
"0.6240635",
"0.61643255",
"0.61069137",
"0.60975415",
"0.60972565",
"0.6067203",
"0.60581553",
"0.6052415",
"0.6045783",
"0.6023861",
"0.601... | 0.0 | -1 |
Initialize an action to detach a vertex from a dependency graph | def initialize(name)
@name = name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dependency(start, vertex, nested = T.unsafe(nil)); end",
"def remove_vertex(id)\n # YOUR WORK HERE\n end",
"def delete!\n graph.remove_vertex element\n end",
"def delete!\n graph.remove_vertex self\n end",
"def detach _args\n \"detach _args;\" \n end",
"def delete!\n ... | [
"0.5747497",
"0.5589899",
"0.5553638",
"0.5551867",
"0.54940414",
"0.5484971",
"0.546425",
"0.542079",
"0.542079",
"0.5410678",
"0.53443193",
"0.52643675",
"0.518293",
"0.51692516",
"0.51692516",
"0.5145249",
"0.51163447",
"0.5107403",
"0.50659955",
"0.50624233",
"0.50578827"... | 0.0 | -1 |
Initialize an action to add set the payload for a vertex in a dependency graph | def initialize(name, payload)
@name = name
@payload = payload
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_vertex(payload)\n @v << Vertex.new(payload)\n end",
"def add_vertex(name, payload, root = false)\n log.add_vertex(self, name, payload, root)\n end",
"def initialize(*payload)\n @in_edges = []\n @out_edges = []\n @payload = payload if payload\n end",
"def initialize\n @vertice... | [
"0.627601",
"0.58879364",
"0.57830113",
"0.56409025",
"0.56342316",
"0.5557868",
"0.5514648",
"0.5494761",
"0.5416405",
"0.5381186",
"0.5377023",
"0.5369651",
"0.5369651",
"0.53063405",
"0.5264982",
"0.52645886",
"0.52467656",
"0.5216332",
"0.51984894",
"0.5189366",
"0.518733... | 0.0 | -1 |
Initialize an action to tag a state of a dependency graph | def initialize(tag)
@tag = tag
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(_owner, _action, _actions_feats)\n @owner = _owner\n @action = _action\n @feats = _actions_feats\n @tag = nil\n end",
"def initialize( name , action )\n super(name)\n\n @action = action\n end",
"def initialize\n @actions = []\n ... | [
"0.652486",
"0.6192464",
"0.6150853",
"0.60039335",
"0.59987974",
"0.59798187",
"0.591974",
"0.5904539",
"0.5893354",
"0.5835287",
"0.5791806",
"0.5777283",
"0.57486963",
"0.57486963",
"0.57486963",
"0.57486963",
"0.57486963",
"0.57486963",
"0.57486963",
"0.57486963",
"0.5740... | 0.0 | -1 |
Pops the most recent action from the log and undoes the action | def pop!(graph)
return unless action = @current_action
unless @current_action = action.previous
@first_action = nil
end
action.down(graph)
action
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pop\n synchronize do\n @actions = actions.dup\n action = actions.pop\n @actions.freeze\n action\n end\n end",
"def clear_all_actions; end",
"def action_delete\n @original_cron_provider.action_delete\n @new_resource.updated_by_last_action(@original_cron... | [
"0.6570716",
"0.6463375",
"0.6179908",
"0.6095513",
"0.6055581",
"0.5957748",
"0.5950535",
"0.59487885",
"0.59415466",
"0.59261316",
"0.59259194",
"0.5918242",
"0.5869037",
"0.5832127",
"0.5815071",
"0.5732564",
"0.56606966",
"0.5645186",
"0.5638081",
"0.55834264",
"0.5531012... | 0.63234526 | 2 |
Adds the given action to the log, running the action | def push_action(graph, action)
action.previous = @current_action
@current_action.next = action if @current_action
@current_action = action
@first_action ||= action
action.up(graph)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def log_action actions, opts={}\n make_log_action_call actions, opts\n end",
"def log_action msg\n\t\t\t\tputs '=> ' + msg\n\t\t\tend",
"def log(action, *args)\n say format('%15s %s', action, args.join(' '))\n end",
"def record(action, *arguments)\n log \"#{action_padding(action)}#{acti... | [
"0.7633195",
"0.74495363",
"0.72761816",
"0.71663696",
"0.7043826",
"0.6904069",
"0.6868259",
"0.68679315",
"0.684424",
"0.67907685",
"0.6725525",
"0.67111814",
"0.66947234",
"0.6601881",
"0.6564471",
"0.6564471",
"0.6564471",
"0.6528025",
"0.64688164",
"0.6458073",
"0.645070... | 0.0 | -1 |
Enumerates through the vertices of the graph. | def each
return vertices.values.each unless block_given?
vertices.values.each { |v| yield v }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def each_vertex; @vertices.each {|v| yield v} end",
"def each_vertex\n\t\treturn enum_for(:each_vertex) unless block_given?\n\t\t\n\t\tsuper do |v|\n\t\t\tyield v\n\t\tend\n\tend",
"def each_vertex(&block) # :yields: v\n raise NotImplementedError\n end",
"def each(&block)\n each_vertex(&block)\n... | [
"0.77359927",
"0.72677714",
"0.7259493",
"0.70260775",
"0.68932265",
"0.68639654",
"0.6756435",
"0.65990293",
"0.6593331",
"0.6552895",
"0.6552895",
"0.6496952",
"0.6495733",
"0.6495733",
"0.64949167",
"0.6386747",
"0.6337499",
"0.63273966",
"0.6306184",
"0.63041914",
"0.6291... | 0.68874687 | 5 |
Initializes an empty dependency graph | def initialize
@vertices = {}
@log = Log.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_graph\n Graph.new(self, skip_track: :broad)\n end",
"def initialize\n @vertices = {}\n create_graph\n end",
"def initialize\n\t\t@classes = Array.new\n\t\t# A set instead of the hashes would be a nicer choice, but \n\t\t# RubyToDot should not depend on any library to allow more ... | [
"0.69982207",
"0.6848694",
"0.6629694",
"0.65764105",
"0.6532934",
"0.6481107",
"0.6481107",
"0.6387472",
"0.6380484",
"0.6354734",
"0.63413",
"0.6336244",
"0.6303792",
"0.6286512",
"0.6250679",
"0.62476707",
"0.62391216",
"0.6233106",
"0.6230193",
"0.61955136",
"0.6152018",
... | 0.5881343 | 44 |
Tags the current state of the dependency as the given tag | def tag(tag)
log.tag(self, tag)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tag(tag)\n @tagname = tag\n end",
"def tag(arg)\n @tag = arg.to_s\n self\n end",
"def tag tag = nil\n @tag = tag if tag\n @tag\n end",
"def tag(tag); end",
"def tag(tag); end",
"def tag(name); end",
"def tag=(value)\n @tag = value\n self.status... | [
"0.6004759",
"0.5979845",
"0.5972299",
"0.5964338",
"0.5964338",
"0.5934481",
"0.59335",
"0.59285843",
"0.59255505",
"0.5870418",
"0.5870418",
"0.58104736",
"0.57852167",
"0.57778275",
"0.57778275",
"0.5740411",
"0.5740411",
"0.569984",
"0.5628974",
"0.5573541",
"0.55670094",... | 0.5918645 | 9 |
Rewinds the graph to the state tagged as `tag` | def rewind_to(tag)
log.rewind_to(self, tag)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def advance(state)\n @state.finish\n @state = state\n end",
"def swap(node_or_tags); end",
"def swap(node_or_tags); end",
"def restore_graphics_state\n @stack.pop\n end",
"def reset(tag_name)\n git.reset(git_opts(:hard => true), tag_name)\n self\n end",
"def re... | [
"0.565496",
"0.56121784",
"0.56121784",
"0.5460996",
"0.539251",
"0.5321988",
"0.5308656",
"0.5266289",
"0.5224262",
"0.521642",
"0.5160936",
"0.5160631",
"0.5159995",
"0.5100536",
"0.50678074",
"0.5067178",
"0.5054298",
"0.503978",
"0.5024963",
"0.5002053",
"0.49927342",
"... | 0.62599164 | 0 |
Adds a vertex with the given name, or updates the existing one. | def add_vertex(name, payload, root = false)
log.add_vertex(self, name, payload, root)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_vertex(name, edges)\n @vertices[name] = edges\n end",
"def addVertex (name)\n @vertices[name] ||= Array.new\n end",
"def addVertex (name)\n @vertices[name] ||= Array.new\n end",
"def add_vertex(vertex)\n raise TypeError, 'Argument is not an instance of Vertex' unless vertex.instance_of... | [
"0.7909958",
"0.77199835",
"0.77199835",
"0.72863466",
"0.7005196",
"0.6897949",
"0.68284005",
"0.67584264",
"0.6608475",
"0.6588965",
"0.6550884",
"0.6537071",
"0.65343565",
"0.65343565",
"0.65307164",
"0.6502939",
"0.64960676",
"0.6436723",
"0.6430004",
"0.6426361",
"0.6387... | 0.6615105 | 8 |
Sets the payload of the vertex with the given name | def set_payload(name, payload)
log.set_payload(self, name, payload)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_vertex(name, payload, root = false)\n log.add_vertex(self, name, payload, root)\n end",
"def vertex_name=(a_proc)\n @vertex_name = a_proc\n end",
"def add_vertex(payload)\n @v << Vertex.new(payload)\n end",
"def addVertex (name)\n @vertices[name] ||= Array.new\n end",
"def a... | [
"0.67135084",
"0.6301361",
"0.6287294",
"0.62451816",
"0.62451816",
"0.6215039",
"0.60944945",
"0.58971936",
"0.5771614",
"0.5733075",
"0.5731432",
"0.56968904",
"0.56653625",
"0.56089574",
"0.5583161",
"0.558129",
"0.5525235",
"0.5520997",
"0.5514782",
"0.55093634",
"0.54973... | 0.5860922 | 8 |
Returns the dependencies of `specification`. | def dependencies_for(specification)
[]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dependencies_for(specification)\n specification.dependencies\n end",
"def dependencies_for(specification)\n specification.dependencies(@cache, @resolver_ui)\n end",
"def dependencies_for(specification)\n root_name = Specification.root_name(specification.name)\n specification.all_d... | [
"0.92022014",
"0.8804303",
"0.8097862",
"0.70305365",
"0.70305365",
"0.6650432",
"0.6590984",
"0.6539288",
"0.6533773",
"0.65143514",
"0.6476026",
"0.6466631",
"0.6419187",
"0.63950557",
"0.6388886",
"0.63754445",
"0.6350521",
"0.6323854",
"0.6316552",
"0.6316552",
"0.6316552... | 0.8985889 | 1 |
Determines whether the given `requirement` is satisfied by the given `spec`, in the context of the current `activated` dependency graph. | def requirement_satisfied_by?(requirement, activated, spec)
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def requirement_satisfied_by?(requirement, _activated, spec)\n requirement.satisified_by?(spec)\n end",
"def requirement_satisfied_by?(requirement, activated, spec)\n requirement.constraint.satisfies?(spec.version)\n end",
"def requirement_satisfied_by?(requirement, activated, spec)\n vers... | [
"0.8339424",
"0.8250534",
"0.8025958",
"0.7276084",
"0.70866287",
"0.70830053",
"0.6899699",
"0.6633686",
"0.6633686",
"0.65874296",
"0.6543901",
"0.63784474",
"0.63328063",
"0.63120556",
"0.6253697",
"0.62318045",
"0.61595696",
"0.5924163",
"0.5924163",
"0.5897925",
"0.58801... | 0.82353467 | 2 |
Determines whether two arrays of dependencies are equal, and thus can be grouped. | def dependencies_equal?(dependencies, other_dependencies)
dependencies == other_dependencies
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def arrays_equivalent(array1, array2)\n return true if array1 == array2\n return false unless array1 && array2 # either one is nil\n\n array1.count == array2.count && (array1 - array2).empty? && (array2 - array1).empty?\n end",
"def array_equals(array1, array2)\n # raise NotImplementedError\n if !(ar... | [
"0.6864638",
"0.68460804",
"0.67737484",
"0.65879464",
"0.65716404",
"0.65708584",
"0.65411097",
"0.65391916",
"0.65391916",
"0.65391916",
"0.65391916",
"0.65391916",
"0.65391916",
"0.6521267",
"0.6520003",
"0.6498726",
"0.6484645",
"0.64839256",
"0.6450944",
"0.64284337",
"0... | 0.69599473 | 0 |
Returns the name for the given `dependency`. | def name_for(dependency)
dependency.to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name_for(dependency)\n dependency.name\n end",
"def name_for(dependency)\n dependency.name\n end",
"def name_for(dependency)\n dependency.name\n end",
"def name\n @dependency.name\n end",
"def name\n @dependency.name\n end",
"def cookbook_name(dependency)\n depe... | [
"0.91362613",
"0.91362613",
"0.91362613",
"0.7950592",
"0.7950592",
"0.73745424",
"0.7170516",
"0.6694366",
"0.6136064",
"0.5974646",
"0.58466744",
"0.5759857",
"0.5670737",
"0.56246865",
"0.56231046",
"0.5619737",
"0.5615148",
"0.559105",
"0.5569194",
"0.55385697",
"0.552499... | 0.8965837 | 3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.