content_type
stringclasses
8 values
main_lang
stringclasses
7 values
message
stringlengths
1
50
sha
stringlengths
40
40
patch
stringlengths
52
962k
file_count
int64
1
300
Python
Python
improve sentence merging in iob2json
f942903429b33b920c18ed7f9c4fe4715733d55f
<ide><path>spacy/cli/converters/iob2json.py <ide> def iob2json(input_path, output_path, n_sents=10, *a, **k): <ide> Convert IOB files into JSON format for use with train cli. <ide> """ <ide> with input_path.open('r', encoding='utf8') as file_: <del> if n_sents: <del> lines = [' '.join(para) for para in partition_all(n_sents, file_)] <del> else: <del> lines = file_ <del> sentences = read_iob(lines) <del> <add> sentences = read_iob(file_) <add> docs = merge_sentences(sentences, n_sents) <ide> output_filename = input_path.parts[-1].replace(".iob", ".json") <ide> output_file = output_path / output_filename <ide> with output_file.open('w', encoding='utf-8') as f: <del> f.write(json_dumps(sentences)) <del> prints("Created %d documents" % len(sentences), <add> f.write(json_dumps(docs)) <add> prints("Created %d documents" % len(docs), <ide> title="Generated output file %s" % path2str(output_file)) <ide> <ide> <ide> def read_iob(raw_sents): <ide> paragraphs = [{'sentences': [sent]} for sent in sentences] <ide> docs = [{'id': 0, 'paragraphs': [para]} for para in paragraphs] <ide> return docs <add> <add>def merge_sentences(docs, n_sents): <add> counter = 0 <add> merged = [] <add> for group in partition_all(n_sents, docs): <add> group = list(group) <add> first = group.pop(0) <add> to_extend = first['paragraphs'][0]['sentences'] <add> for sent in group[1:]: <add> to_extend.extend(sent['paragraphs'][0]['sentences']) <add> merged.append(first) <add> return merged
1
Text
Text
add changelog entry for .reflections api change
5dc598814efa45a1019c262ee01e5cc2db864d26
<ide><path>activerecord/CHANGELOG.md <add>* Change `reflections` public api to return the keys as String objects. <add> <add> Fixes #16928. <add> <add> *arthurnn* <add> <ide> * Renaming a table in pg also renames the primary key index. <ide> <ide> Fixes #12856
1
Javascript
Javascript
add missing options flag to animation example
344dffbc54df221d03eaa6dbbb677b2cefd20a23
<ide><path>src/ngAnimate/module.js <ide> * enter: function(element, doneFn) { <ide> * var runner = $animateCss(element, { <ide> * event: 'enter', <add> * structural: true, <ide> * addClass: 'maroon-setting', <ide> * from: { height:0 }, <ide> * to: { height: 200 }
1
Javascript
Javascript
add checkernode
5b654654adc27595f917c07066cb4d5cfbd9de21
<ide><path>examples/jsm/renderers/nodes/Nodes.js <ide> import SplitNode from './utils/SplitNode.js'; <ide> import SpriteSheetUVNode from './utils/SpriteSheetUVNode.js'; <ide> import TimerNode from './utils/TimerNode.js'; <ide> <add>// procedural <add>import CheckerNode from './procedural/CheckerNode.js'; <add> <ide> // core <ide> export * from './core/constants.js'; <ide> <ide> export { <ide> JoinNode, <ide> SplitNode, <ide> SpriteSheetUVNode, <del> TimerNode <add> TimerNode, <add> <add> // procedural <add> CheckerNode <ide> }; <ide> <ide><path>examples/jsm/renderers/nodes/procedural/CheckerNode.js <add>import FunctionNode from '../core/FunctionNode.js'; <add>import Node from '../core/Node.js'; <add>import UVNode from '../accessors/UVNode.js'; <add> <add>const checker = new FunctionNode( ` <add>float ( vec2 uv ) { <add> <add> uv *= 2.0; <add> <add> float cx = floor( uv.x ); <add> float cy = floor( uv.y ); <add> float result = mod( cx + cy, 2.0 ); <add> <add> return sign( result ); <add> <add>}` ); <add> <add>class CheckerNode extends Node { <add> <add> constructor( uv = new UVNode() ) { <add> <add> super( 'float' ); <add> <add> this.uv = uv; <add> <add> } <add> <add> generate( builder, output ) { <add> <add> return checker.call( { uv: this.uv } ).build( builder, output ); <add> <add> } <add> <add>} <add> <add>export default CheckerNode;
2
Python
Python
update all models on each epoch
dbf2a4cf577f0e66bf1591289728ed4ec56d1c5c
<ide><path>spacy/language.py <ide> def get_grads(W, dW, key=None): <ide> tokvecses, bp_tokvecses = tok2vec.model.begin_update(feats, drop=drop) <ide> d_tokvecses = proc.update((docs, tokvecses), golds, <ide> drop=drop, sgd=get_grads, losses=losses) <del> bp_tokvecses(d_tokvecses, sgd=get_grads) <del> break <add> bp_tokvecses(d_tokvecses, sgd=sgd) <ide> for key, (W, dW) in grads.items(): <ide> sgd(W, dW, key=key) <ide> # Clear the tensor variable, to free GPU memory.
1
Javascript
Javascript
make non-existent routes under `/_next` return 404
8d304ed7ef312604bbc819fb73c5f01ee8a911e7
<ide><path>server/index.js <ide> export default class Server { <ide> } <ide> } <ide> <add> // This path is needed because `render()` does a check for `/_next` and the calls the routing again <add> routes['/_next/:path*'] = async (req, res, params, parsedUrl) => { <add> await this.render404(req, res, parsedUrl) <add> } <add> <ide> // It's very important keep this route's param optional. <ide> // (but it should support as many as params, seperated by '/') <ide> // Othewise this will lead to a pretty simple DOS attack. <ide><path>test/integration/basic/test/rendering.js <ide> <ide> import cheerio from 'cheerio' <ide> <del>export default function ({ app }, suiteName, render, fetch) { <add>export default function ({ app }, suiteName, render, fetch, appPort) { <ide> async function get$ (path, query) { <ide> const html = await render(path, query) <ide> return cheerio.load(html) <ide> export default function ({ app }, suiteName, render, fetch) { <ide> expect(res.headers.get('Content-Type')).toMatch('text/html; charset=iso-8859-2') <ide> }) <ide> <add> test('should render 404 for _next routes that do not exist', async () => { <add> const res = await fetch('/_next/abcdef') <add> expect(res.status).toBe(404) <add> }) <add> <ide> test('allows to import .json files', async () => { <ide> const html = await render('/json') <ide> expect(html.includes('Zeit')).toBeTruthy() <ide><path>test/integration/production/test/index.test.js <ide> describe('Production Usage', () => { <ide> expect(res2.status).toBe(304) <ide> }) <ide> <add> it('should render 404 for _next routes that do not exist', async () => { <add> const url = `http://localhost:${appPort}/_next/abcdef` <add> const res = await fetch(url) <add> expect(res.status).toBe(404) <add> }) <add> <ide> it('should set Cache-Control header', async () => { <ide> const buildId = readFileSync(join(__dirname, '../.next/BUILD_ID'), 'utf8') <ide> const buildManifest = require(join('../.next', BUILD_MANIFEST))
3
Text
Text
add additional step to security release process
961967c1ffcdf08855d05380f1e6b4b4d4e8cbac
<ide><path>doc/contributing/security-release-process.md <ide> out a better way, forward the email you receive to <ide> <ide> * [ ] Make sure the PRs for the vulnerabilities are closed. <ide> <add>* [ ] PR in that you stewarded the release in <add> [Security release stewards](https://github.com/nodejs/node/blob/HEAD/doc/contributing/security-release-process.md#security-release-stewards). <add> If necessary add the next rotation of the steward rotation. <add> <ide> [H1 CVE requests]: https://hackerone.com/nodejs/cve_requests <ide> [docker-node]: https://github.com/nodejs/docker-node/issues <ide> [email]: https://groups.google.com/forum/#!forum/nodejs-sec
1
Ruby
Ruby
add powerpc64 cpu
3df97b20d52ef76043fcc33cd5040886dc6da2b3
<ide><path>Library/Homebrew/extend/os/linux/hardware/cpu.rb <ide> module Hardware <ide> class CPU <ide> class << self <del> OPTIMIZATION_FLAGS_LINUX = { <del> native: "-march=#{Homebrew::EnvConfig.arch}", <del> nehalem: "-march=nehalem", <del> core2: "-march=core2", <del> core: "-march=prescott", <del> armv6: "-march=armv6", <del> armv8: "-march=armv8-a", <del> }.freeze <del> <ide> def optimization_flags <del> OPTIMIZATION_FLAGS_LINUX <add> @optimization_flags ||= begin <add> flags = generic_optimization_flags.dup <add> flags[:native] = arch_flag(Homebrew::EnvConfig.arch) <add> flags <add> end <ide> end <ide> <ide> def cpuinfo <ide><path>Library/Homebrew/extend/os/linux/install.rb <ide> module Install <ide> "/system/bin/linker", <ide> ].freeze <ide> <add> def check_cpu <add> return if (Hardware::CPU.intel? && Hardware::CPU.is_64_bit?) || Hardware::CPU.arm? <add> <add> message = "Sorry, Homebrew does not support your computer's CPU architecture!" <add> if Hardware::CPU.ppc64le? <add> message += <<~EOS <add> For OpenPOWER Linux (PPC64LE) support, see: <add> #{Formatter.url("https://github.com/homebrew-ppc64le/brew")} <add> EOS <add> end <add> abort message <add> end <add> <ide> def symlink_ld_so <ide> brew_ld_so = HOMEBREW_PREFIX/"lib/ld.so" <ide> return if brew_ld_so.readable? <ide><path>Library/Homebrew/hardware.rb <ide> class CPU <ide> INTEL_32BIT_ARCHS = [:i386].freeze <ide> INTEL_64BIT_ARCHS = [:x86_64].freeze <ide> PPC_32BIT_ARCHS = [:ppc, :ppc32, :ppc7400, :ppc7450, :ppc970].freeze <del> PPC_64BIT_ARCHS = [:ppc64].freeze <add> PPC_64BIT_ARCHS = [:ppc64, :ppc64le, :ppc970].freeze <ide> <ide> class << self <del> OPTIMIZATION_FLAGS = { <del> native: "-march=native", <del> nehalem: "-march=nehalem", <del> core2: "-march=core2", <del> core: "-march=prescott", <del> armv6: "-march=armv6", <del> armv8: "-march=armv8-a", <del> }.freeze <del> <ide> def optimization_flags <del> OPTIMIZATION_FLAGS <del> end <add> @optimization_flags ||= { <add> native: arch_flag("native"), <add> nehalem: "-march=nehalem", <add> core2: "-march=core2", <add> core: "-march=prescott", <add> armv6: "-march=armv6", <add> armv8: "-march=armv8-a", <add> ppc64: "-mcpu=powerpc64", <add> ppc64le: "-mcpu=powerpc64le", <add> }.freeze <add> end <add> alias generic_optimization_flags optimization_flags <ide> <ide> def arch_32_bit <ide> if arm? <ide> :arm <ide> elsif intel? <ide> :i386 <del> elsif ppc? <add> elsif ppc32? <ide> :ppc32 <ide> else <ide> :dunno <ide> def arch_64_bit <ide> :arm64 <ide> elsif intel? <ide> :x86_64 <del> elsif ppc? <add> elsif ppc64le? <add> :ppc64le <add> elsif ppc64? <ide> :ppc64 <ide> else <ide> :dunno <ide> def type <ide> case RUBY_PLATFORM <ide> when /x86_64/, /i\d86/ then :intel <ide> when /arm/, /aarch64/ then :arm <del> when /ppc\d+/ then :ppc <add> when /ppc|powerpc/ then :ppc <ide> else :dunno <ide> end <ide> end <ide> def cores <ide> <ide> def bits <ide> @bits ||= case RUBY_PLATFORM <del> when /x86_64/, /ppc64/, /aarch64|arm64/ then 64 <add> when /x86_64/, /ppc64|powerpc64/, /aarch64|arm64/ then 64 <ide> when /i\d86/, /ppc/, /arm/ then 32 <ide> end <ide> end <ide> def ppc? <ide> type == :ppc <ide> end <ide> <add> def ppc32? <add> ppc? && is_32_bit? <add> end <add> <add> def ppc64le? <add> ppc? && is_64_bit? && little_endian? <add> end <add> <add> def ppc64? <add> ppc? && is_64_bit? && big_endian? <add> end <add> <ide> def arm? <ide> type == :arm <ide> end <ide> <add> def little_endian? <add> !big_endian? <add> end <add> <add> def big_endian? <add> [1].pack("I") == [1].pack("N") <add> end <add> <ide> def features <ide> [] <ide> end <ide> <ide> def feature?(name) <ide> features.include?(name) <ide> end <add> <add> def arch_flag(arch) <add> return "-mcpu=#{arch}" if ppc? <add> <add> "-march=#{arch}" <add> end <ide> end <ide> end <ide> <ide><path>Library/Homebrew/install.rb <ide> module Install <ide> module_function <ide> <ide> def check_cpu <del> case Hardware::CPU.type <del> when :ppc <del> abort <<~EOS <del> Sorry, Homebrew does not support your computer's CPU architecture. <del> For PPC support, see: <add> return if Hardware::CPU.intel? && Hardware::CPU.is_64_bit? <add> <add> message = "Sorry, Homebrew does not support your computer's CPU architecture!" <add> if Hardware::CPU.ppc? <add> message += <<~EOS <add> For PowerPC Mac (PPC32/PPC64BE) support, see: <ide> #{Formatter.url("https://github.com/mistydemeo/tigerbrew")} <ide> EOS <ide> end <add> abort message <ide> end <ide> <ide> def attempt_directory_creation
4
Javascript
Javascript
refactor the build server to remove tie to fs
8d2bbf940d52c8f44709a62bcd6d46ca34171e2d
<ide><path>server/build/index.js <ide> import { tmpdir } from 'os' <ide> import { join } from 'path' <del>import getConfig from '../config' <ide> import fs from 'mz/fs' <ide> import uuid from 'uuid' <ide> import del from 'del' <ide> export default async function build (dir) { <ide> <ide> try { <ide> await runCompiler(compiler) <del> <del> // Pass in both the buildDir and the dir to retrieve config <del> await writeBuildStats(buildDir, dir) <del> await writeBuildId(buildDir, dir) <add> await writeBuildStats(buildDir) <add> await writeBuildId(buildDir) <ide> } catch (err) { <ide> console.error(`> Failed to build on ${buildDir}`) <ide> throw err <ide> function runCompiler (compiler) { <ide> }) <ide> } <ide> <del>async function writeBuildStats (buildDir, dir) { <del> const dist = getConfig(dir).distDir <add>async function writeBuildStats (dir) { <ide> // Here we can't use hashes in webpack chunks. <ide> // That's because the "app.js" is not tied to a chunk. <ide> // It's created by merging a few assets. (commons.js and main.js) <ide> // So, we need to generate the hash ourself. <ide> const assetHashMap = { <ide> 'app.js': { <del> hash: await md5File(join(buildDir, dist, 'app.js')) <add> hash: await md5File(join(dir, '.next', 'app.js')) <ide> } <ide> } <del> const buildStatsPath = join(buildDir, dist, 'build-stats.json') <add> const buildStatsPath = join(dir, '.next', 'build-stats.json') <ide> await fs.writeFile(buildStatsPath, JSON.stringify(assetHashMap), 'utf8') <ide> } <ide> <del>async function writeBuildId (buildDir, dir) { <del> const dist = getConfig(dir).distDir <del> const buildIdPath = join(buildDir, dist, 'BUILD_ID') <add>async function writeBuildId (dir) { <add> const buildIdPath = join(dir, '.next', 'BUILD_ID') <ide> const buildId = uuid.v4() <ide> await fs.writeFile(buildIdPath, buildId, 'utf8') <ide> } <ide><path>server/build/replace.js <ide> import getConfig from '../config' <ide> <ide> export default async function replaceCurrentBuild (dir, buildDir) { <ide> const dist = getConfig(dir).distDir <del> const buildDist = getConfig(buildDir).distDir <ide> const _dir = join(dir, dist) <del> const _buildDir = join(buildDir, dist) <del> const oldDir = join(buildDir, `${buildDist}.old`) <add> const _buildDir = join(buildDir, '.next') <add> const oldDir = join(buildDir, '.next.old') <ide> <ide> try { <ide> await move(_dir, oldDir) <ide><path>server/build/webpack.js <ide> export default async function createCompiler (dir, { dev = false, quiet = false, <ide> context: dir, <ide> entry, <ide> output: { <del> path: join(buildDir || dir, config.distDir), <add> path: buildDir ? join(buildDir, '.next') : join(dir, config.distDir), <ide> filename: '[name]', <ide> libraryTarget: 'commonjs2', <ide> publicPath: '/_webpack/',
3
Text
Text
add awesome list to handy links section
7ac465618c65ec69bffb0d65d00ebca77147b212
<ide><path>README.md <ide> tests for CakePHP by doing the following: <ide> * [CakePHP](http://www.cakephp.org) - The rapid development PHP framework. <ide> * [CookBook](http://book.cakephp.org) - The CakePHP user documentation; start learning here! <ide> * [API](http://api.cakephp.org) - A reference to CakePHP's classes. <add>* [Awesome CakePHP](https://github.com/FriendsOfCake/awesome-cakephp) - A list of featured resources around the framework. <ide> * [Plugins](http://plugins.cakephp.org) - A repository of extensions to the framework. <ide> * [The Bakery](http://bakery.cakephp.org) - Tips, tutorials and articles. <ide> * [Community Center](http://community.cakephp.org) - A source for everything community related.
1
Go
Go
add regression test
5fb28eab3e670f225019174987424be31a0d0527
<ide><path>integration-cli/docker_cli_logs_test.go <add>package main <add> <add>import ( <add> "fmt" <add> "os/exec" <add> "testing" <add>) <add> <add>// This used to work, it test a log of PageSize-1 (gh#4851) <add>func TestLogsContainerSmallerThanPage(t *testing.T) { <add> testLen := 32767 <add> runCmd := exec.Command(dockerBinary, "run", "-d", "busybox", "sh", "-c", fmt.Sprintf("for i in $(seq 1 %d); do echo -n =; done; echo", testLen)) <add> out, _, _, err := runCommandWithStdoutStderr(runCmd) <add> errorOut(err, t, fmt.Sprintf("run failed with errors: %v", err)) <add> <add> cleanedContainerID := stripTrailingCharacters(out) <add> exec.Command(dockerBinary, "wait", cleanedContainerID).Run() <add> <add> logsCmd := exec.Command(dockerBinary, "logs", cleanedContainerID) <add> out, _, _, err = runCommandWithStdoutStderr(logsCmd) <add> errorOut(err, t, fmt.Sprintf("failed to log container: %v %v", out, err)) <add> <add> if len(out) != testLen+1 { <add> t.Fatalf("Expected log length of %d, received %d\n", testLen+1, len(out)) <add> } <add> <add> go deleteContainer(cleanedContainerID) <add> <add> logDone("logs - logs container running echo smaller than page size") <add>} <add> <add>// Regression test: When going over the PageSize, it used to panic (gh#4851) <add>func TestLogsContainerBiggerThanPage(t *testing.T) { <add> testLen := 32768 <add> runCmd := exec.Command(dockerBinary, "run", "-d", "busybox", "sh", "-c", fmt.Sprintf("for i in $(seq 1 %d); do echo -n =; done; echo", testLen)) <add> out, _, _, err := runCommandWithStdoutStderr(runCmd) <add> errorOut(err, t, fmt.Sprintf("run failed with errors: %v", err)) <add> <add> cleanedContainerID := stripTrailingCharacters(out) <add> exec.Command(dockerBinary, "wait", cleanedContainerID).Run() <add> <add> logsCmd := exec.Command(dockerBinary, "logs", cleanedContainerID) <add> out, _, _, err = runCommandWithStdoutStderr(logsCmd) <add> errorOut(err, t, fmt.Sprintf("failed to log container: %v %v", out, err)) <add> <add> if len(out) != testLen+1 { <add> t.Fatalf("Expected log length of %d, received %d\n", testLen+1, len(out)) <add> } <add> <add> go deleteContainer(cleanedContainerID) <add> <add> logDone("logs - logs container running echo bigger than page size") <add>} <add> <add>// Regression test: When going much over the PageSize, it used to block (gh#4851) <add>func TestLogsContainerMuchBiggerThanPage(t *testing.T) { <add> testLen := 33000 <add> runCmd := exec.Command(dockerBinary, "run", "-d", "busybox", "sh", "-c", fmt.Sprintf("for i in $(seq 1 %d); do echo -n =; done; echo", testLen)) <add> out, _, _, err := runCommandWithStdoutStderr(runCmd) <add> errorOut(err, t, fmt.Sprintf("run failed with errors: %v", err)) <add> <add> cleanedContainerID := stripTrailingCharacters(out) <add> exec.Command(dockerBinary, "wait", cleanedContainerID).Run() <add> <add> logsCmd := exec.Command(dockerBinary, "logs", cleanedContainerID) <add> out, _, _, err = runCommandWithStdoutStderr(logsCmd) <add> errorOut(err, t, fmt.Sprintf("failed to log container: %v %v", out, err)) <add> <add> if len(out) != testLen+1 { <add> t.Fatalf("Expected log length of %d, received %d\n", testLen+1, len(out)) <add> } <add> <add> go deleteContainer(cleanedContainerID) <add> <add> logDone("logs - logs container running echo much bigger than page size") <add>}
1
Python
Python
add more trailing_punctuation to work with yaml
a23059b6f73aaff9709f611826bac892e56663dd
<ide><path>rest_framework/templatetags/rest_framework.py <ide> def add_class(value, css_class): <ide> <ide> <ide> # Bunch of stuff cloned from urlize <del>TRAILING_PUNCTUATION = ['.', ',', ':', ';', '.)', '"', "'"] <add>TRAILING_PUNCTUATION = ['.', ',', ':', ';', '.)', '"', "']", "'}", "'"] <ide> WRAPPING_PUNCTUATION = [('(', ')'), ('<', '>'), ('[', ']'), ('&lt;', '&gt;'), <ide> ('"', '"'), ("'", "'")] <ide> word_split_re = re.compile(r'(\s+)')
1
Javascript
Javascript
fix process.on edge case with signal event
a91b1409636db20e931e14e1be03261f57ab3f7c
<ide><path>src/node.js <ide> w.start(); <ide> <ide> } else if (this.listeners(type).length === 1) { <del> signalWatchers[event].start(); <add> signalWatchers[type].start(); <ide> } <ide> } <ide> <ide><path>test/simple/test-signal-handler.js <ide> console.log('process.pid: ' + process.pid); <ide> var first = 0, <ide> second = 0; <ide> <add>var sighup = false; <add> <ide> process.addListener('SIGUSR1', function() { <ide> console.log('Interrupted by SIGUSR1'); <ide> first += 1; <ide> setInterval(function() { <ide> } <ide> }, 1); <ide> <add>// Test addListener condition where a watcher for SIGNAL <add>// has been previously registered, and `process.listeners(SIGNAL).length === 1` <add>process.addListener('SIGHUP', function () {}); <add>process.removeAllListeners('SIGHUP'); <add>process.addListener('SIGHUP', function () { sighup = true }); <add>process.kill(process.pid, 'SIGHUP'); <ide> <ide> process.addListener('exit', function() { <ide> assert.equal(1, first); <ide> assert.equal(1, second); <add> assert.equal(true, sighup); <ide> });
2
Ruby
Ruby
move some logic to runner
739cfd5d90aff0d8eba3d3937df63afaa6ad106f
<ide><path>railties/lib/rails/commands/test.rb <ide> ENV["RAILS_ENV"] = "test" <ide> require "rails/test_unit/runner" <del>require "rails/test_unit/reporter" <ide> <ide> options = Rails::TestRunner::Options.parse(ARGV) <ide> $: << File.expand_path("../../test", APP_PATH) <ide> <del>$runner = Rails::TestRunner.new(options) <del> <del>def Minitest.plugin_rails_init(options) <del> self.reporter << Rails::TestUnitReporter.new(options[:io], options) <del> if method = $runner.find_method <del> options[:filter] = method <del> end <del>end <del>Minitest.extensions << 'rails' <del> <del># Config Rails backtrace in tests. <del>$runner.run <add>Rails::TestRunner.new(options).run <ide><path>railties/lib/rails/test_unit/runner.rb <ide> require "optparse" <ide> require "rake/file_list" <ide> require "method_source" <add>require "rails/test_unit/reporter" <ide> <ide> module Rails <ide> class TestRunner <ide> def initialize(options = {}) <ide> def run <ide> enable_backtrace if @options[:backtrace] <ide> <add> $rails_test_runner = self <add> def Minitest.plugin_rails_init(options) <add> self.reporter << Rails::TestUnitReporter.new(options[:io], options) <add> if method = $rails_test_runner.find_method <add> options[:filter] = method <add> end <add> end <add> Minitest.extensions << 'rails' <add> <ide> run_tests <ide> end <ide>
2
PHP
PHP
tests(add extra method deps check to test)
8855e86b6eb005d2c1cc35026360741b58b73081
<ide><path>tests/Container/ContainerCallTest.php <ide> public function testCallWithCallableClassString() <ide> $result = $container->call(ContainerCallCallableClassStringStub::class); <ide> $this->assertInstanceOf(ContainerCallConcreteStub::class, $result[0]); <ide> $this->assertSame('jeffrey', $result[1]); <add> $this->assertInstanceOf(ContainerTestCallStub::class, $result[2]); <ide> } <ide> <ide> public function testCallWithoutRequiredParamsThrowsException() <ide> public function __construct(ContainerCallConcreteStub $stub, $default = 'jeffrey <ide> $this->default = $default; <ide> } <ide> <del> public function __invoke() <add> public function __invoke(ContainerTestCallStub $dependency) <ide> { <del> return [$this->stub, $this->default]; <add> return [$this->stub, $this->default, $dependency]; <ide> } <ide> }
1
Go
Go
move env load to nsenter
8497d1274b046804999699ccb66b11a3249906a1
<ide><path>pkg/libcontainer/namespaces/execin.go <ide> import ( <ide> <ide> // ExecIn uses an existing pid and joins the pid's namespaces with the new command. <ide> func ExecIn(container *libcontainer.Container, nspid int, args []string) error { <del> // clear the current processes env and replace it with the environment <del> // defined on the container <del> if err := LoadContainerEnvironment(container); err != nil { <del> return err <del> } <del> <ide> // TODO(vmarmol): If this gets too long, send it over a pipe to the child. <ide> // Marshall the container into JSON since it won't be available in the namespace. <ide> containerJson, err := json.Marshal(container) <ide> func ExecIn(container *libcontainer.Container, nspid int, args []string) error { <ide> // Enter the namespace and then finish setup <ide> finalArgs := []string{os.Args[0], "nsenter", strconv.Itoa(nspid), processLabel, string(containerJson)} <ide> finalArgs = append(finalArgs, args...) <del> if err := system.Execv(finalArgs[0], finalArgs[0:], container.Env); err != nil { <add> if err := system.Execv(finalArgs[0], finalArgs[0:], os.Environ()); err != nil { <ide> return err <ide> } <ide> panic("unreachable") <ide> } <ide> <ide> // NsEnter is run after entering the namespace. <ide> func NsEnter(container *libcontainer.Container, processLabel string, nspid int, args []string) error { <add> // clear the current processes env and replace it with the environment <add> // defined on the container <add> if err := LoadContainerEnvironment(container); err != nil { <add> return err <add> } <ide> if err := FinalizeNamespace(container); err != nil { <ide> return err <ide> } <ide> if err := label.SetProcessLabel(processLabel); err != nil { <ide> return err <ide> } <del> if err := system.Execv(args[0], args[0:], os.Environ()); err != nil { <add> if err := system.Execv(args[0], args[0:], container.Env); err != nil { <ide> return err <ide> } <ide> panic("unreachable")
1
Javascript
Javascript
delay rewriting chunks
bb5eb9384229b8b5c455e941e44b18eb56daf5e5
<ide><path>lib/Module.js <ide> class Module extends DependenciesBlock { <ide> this.usedExports = null; <ide> this.providedExports = null; <ide> this.optimizationBailout = []; <add> <add> // delayed operations <add> this._rewriteChunkInReasons = undefined; <ide> } <ide> <ide> disconnect() { <ide> this.reasons.length = 0; <add> this._rewriteChunkInReasons = undefined; <ide> this._chunks.clear(); <ide> <ide> this.id = null; <ide> class Module extends DependenciesBlock { <ide> } <ide> <ide> hasReasonForChunk(chunk) { <add> if(this._rewriteChunkInReasons) { <add> for(const operation of this._rewriteChunkInReasons) <add> this._doRewriteChunkInReasons(operation.oldChunk, operation.newChunks); <add> this._rewriteChunkInReasons = undefined; <add> } <ide> for(let i = 0; i < this.reasons.length; i++) { <ide> if(this.reasons[i].hasChunk(chunk)) <ide> return true; <ide> class Module extends DependenciesBlock { <ide> } <ide> <ide> rewriteChunkInReasons(oldChunk, newChunks) { <add> // This is expensive. Delay operation until we really need the data <add> if(this._rewriteChunkInReasons === undefined) <add> this._rewriteChunkInReasons = []; <add> this._rewriteChunkInReasons.push({ <add> oldChunk, <add> newChunks <add> }); <add> } <add> <add> _doRewriteChunkInReasons(oldChunk, newChunks) { <ide> for(let i = 0; i < this.reasons.length; i++) { <ide> this.reasons[i].rewriteChunks(oldChunk, newChunks); <ide> }
1
Text
Text
add note about abi compatibility
97d9ccdeb842fa94b1544f83aff6b8bf23dc65d1
<ide><path>BUILDING.md <ide> To make `./myModule.js` available via `require('myModule')` and <ide> ```console <ide> > .\vcbuild link-module './myModule.js' link-module './myModule2.js' <ide> ``` <add> <add>## Note for downstream distributors of Node.js <add> <add>The Node.js ecosystem is reliant on ABI compatibility within a major <add>release. To maintain ABI compatibility it is required that production <add>builds of Node.js will be built against the same version of dependencies as the <add>project vendors. If Node.js is to be built against a different version of a <add>dependency please create a custom `NODE_MODULE_VERSION` to ensure ecosystem <add>compatibility. Please consult with the TSC by opening an issue at <add>https://github.com/nodejs/tsc/issues if you decide to create a custom <add>`NODE_MODULE_VERSION` so we can avoid duplication in the ecosystem.
1
Python
Python
use print() function in buildbot_run.py
2d8307e1996ee0c45d3630c1716b5fbfa08ac380
<ide><path>tools/gyp/buildbot/buildbot_run.py <ide> # found in the LICENSE file. <ide> <ide> """Argument-less script to select what to run on the buildbots.""" <add>from __future__ import print_function <ide> <ide> import os <ide> import shutil <ide> def CallSubProcess(*args, **kwargs): <ide> with open(os.devnull) as devnull_fd: <ide> retcode = subprocess.call(stdin=devnull_fd, *args, **kwargs) <ide> if retcode != 0: <del> print '@@' <add> print('@@') <ide> sys.exit(1) <ide> <ide> <ide> def PrepareCmake(): <ide> """Build CMake 2.8.8 since the version in Precise is 2.8.7.""" <ide> if os.environ['BUILDBOT_CLOBBER'] == '1': <del> print '@@' <add> print('@@') <ide> shutil.rmtree(CMAKE_DIR) <ide> <ide> # We always build CMake 2.8.8, so no need to do anything <ide> # if the directory already exists. <ide> if os.path.isdir(CMAKE_DIR): <ide> return <ide> <del> print '@@' <add> print('@@') <ide> os.mkdir(CMAKE_DIR) <ide> <del> print '@@' <add> print('@@') <ide> CallSubProcess( <ide> ['git', 'clone', <ide> '--depth', '1', <ide> def PrepareCmake(): <ide> CMAKE_DIR], <ide> cwd=CMAKE_DIR) <ide> <del> print '@@' <add> print('@@') <ide> CallSubProcess( <ide> ['/bin/bash', 'bootstrap', '--prefix=%s' % CMAKE_DIR], <ide> cwd=CMAKE_DIR) <ide> def GypTestFormat(title, format=None, msvs_version=None, tests=[]): <ide> if not format: <ide> format = title <ide> <del> print '@@' <add> print('@@') <ide> sys.stdout.flush() <ide> env = os.environ.copy() <ide> if msvs_version: <ide> def GypTestFormat(title, format=None, msvs_version=None, tests=[]): <ide> retcode = subprocess.call(command, cwd=ROOT_DIR, env=env, shell=True) <ide> if retcode: <ide> # Emit failure tag, and keep going. <del> print '@@' <add> print('@@') <ide> return 1 <ide> return 0 <ide> <ide> <ide> def GypBuild(): <ide> # Dump out/ directory. <del> print '@@' <del> print 'Removing %s...' % OUT_DIR <add> print('@@') <add> print('Removing %s...' % OUT_DIR) <ide> shutil.rmtree(OUT_DIR, ignore_errors=True) <del> print 'Done.' <add> print('Done.') <ide> <ide> retcode = 0 <ide> if sys.platform.startswith('linux'): <ide> def GypBuild(): <ide> # after the build proper that could be used for cumulative failures), <ide> # use that instead of this. This isolates the final return value so <ide> # that it isn't misattributed to the last stage. <del> print '@@' <add> print('@@') <ide> sys.exit(retcode) <ide> <ide>
1
Ruby
Ruby
add some documentation
27f87b68b26e4ac68fa9bf05e6003c61cdca854d
<ide><path>lib/active_storage/attached/macros.rb <ide> module ActiveStorage::Attached::Macros <add> # Specifies the relation between a single attachment and the model. <add> # <add> # class User < ActiveRecord::Base <add> # has_one_attached :avatar <add> # end <add> # <add> # There is no column defined on the model side, Active Storage takes <add> # care of the mapping between your records and the attachment. <add> # <add> # If the +:dependent+ option isn't set, the attachment will be purged <add> # (i.e. destroyed) whenever the record is destroyed. <ide> def has_one_attached(name, dependent: :purge_later) <ide> define_method(name) do <del> instance_variable_get("@active_storage_attached_#{name}") || <add> instance_variable_get("@active_storage_attached_#{name}") || <ide> instance_variable_set("@active_storage_attached_#{name}", ActiveStorage::Attached::One.new(name, self)) <ide> end <ide> <ide> def has_one_attached(name, dependent: :purge_later) <ide> end <ide> end <ide> <add> # Specifies the relation between multiple attachments and the model. <add> # <add> # class Gallery < ActiveRecord::Base <add> # has_many_attached :photos <add> # end <add> # <add> # There are no columns defined on the model side, Active Storage takes <add> # care of the mapping between your records and the attachments. <add> # <add> # If the +:dependent+ option isn't set, all the attachments will be purged <add> # (i.e. destroyed) whenever the record is destroyed. <ide> def has_many_attached(name, dependent: :purge_later) <ide> define_method(name) do <del> instance_variable_get("@active_storage_attached_#{name}") || <add> instance_variable_get("@active_storage_attached_#{name}") || <ide> instance_variable_set("@active_storage_attached_#{name}", ActiveStorage::Attached::Many.new(name, self)) <ide> end <ide> <ide><path>lib/active_storage/attached/many.rb <add># Representation of multiple attachments to a model. <ide> class ActiveStorage::Attached::Many < ActiveStorage::Attached <ide> delegate_missing_to :attachments <ide> <add> # Returns all the associated attachment records. <add> # <add> # You don't have to call this method to access the attachments' methods as <add> # they are all available at the model level. <ide> def attachments <ide> @attachments ||= ActiveStorage::Attachment.where(record_gid: record.to_gid.to_s, name: name) <ide> end <ide> <add> # Associates one or several attachments with the current record, saving <add> # them to the database. <ide> def attach(*attachables) <ide> @attachments = attachments | Array(attachables).flatten.collect do |attachable| <ide> ActiveStorage::Attachment.create!(record_gid: record.to_gid.to_s, name: name, blob: create_blob_from(attachable)) <ide> end <ide> end <ide> <add> # Checks the presence of attachments. <add> # <add> # class Gallery < ActiveRecord::Base <add> # has_many_attached :photos <add> # end <add> # <add> # Gallery.new.photos.attached? # => false <ide> def attached? <ide> attachments.any? <ide> end <ide> <add> # Directly purges each associated attachment (i.e. destroys the blobs and <add> # attachments and deletes the files on the service). <ide> def purge <ide> if attached? <ide> attachments.each(&:purge) <ide> @attachments = nil <ide> end <ide> end <ide> <add> # Purges each associated attachment through the queuing system. <ide> def purge_later <ide> if attached? <ide> attachments.each(&:purge_later) <ide><path>lib/active_storage/attached/one.rb <add># Representation of a single attachment to a model. <ide> class ActiveStorage::Attached::One < ActiveStorage::Attached <ide> delegate_missing_to :attachment <ide> <add> # Returns the associated attachment record. <add> # <add> # You don't have to call this method to access the attachment's methods as <add> # they are all available at the model level. <ide> def attachment <ide> @attachment ||= ActiveStorage::Attachment.find_by(record_gid: record.to_gid.to_s, name: name) <ide> end <ide> <add> # Associates a given attachment with the current record, saving it to the <add> # database. <ide> def attach(attachable) <ide> @attachment = ActiveStorage::Attachment.create!(record_gid: record.to_gid.to_s, name: name, blob: create_blob_from(attachable)) <ide> end <ide> <add> # Checks the presence of the attachment. <add> # <add> # class User < ActiveRecord::Base <add> # has_one_attached :avatar <add> # end <add> # <add> # User.new.avatar.attached? # => false <ide> def attached? <ide> attachment.present? <ide> end <ide> <add> # Directly purges the attachment (i.e. destroys the blob and <add> # attachment and deletes the file on the service). <ide> def purge <ide> if attached? <ide> attachment.purge <ide> @attachment = nil <ide> end <ide> end <ide> <add> # Purges the attachment through the queuing system. <ide> def purge_later <ide> if attached? <ide> attachment.purge_later <ide><path>lib/active_storage/disk_controller.rb <ide> <ide> require "active_support/core_ext/object/inclusion" <ide> <add># This controller is a wrapper around local file downloading. It allows you to <add># make abstraction of the URL generation logic and to serve files with expiry <add># if you are using the +Disk+ service. <add># <add># By default, mounting the Active Storage engine inside your application will <add># define a +/rails/blobs/:encoded_key+ route that will reference this controller's <add># +show+ action and will be used to serve local files. <add># <add># A URL for an attachment can be generated through its +#url+ method, that <add># will use the aforementioned route. <ide> class ActiveStorage::DiskController < ActionController::Base <ide> def show <ide> if key = decode_verified_key <ide> blob = ActiveStorage::Blob.find_by!(key: key) <del> <add> <ide> if stale?(etag: blob.checksum) <ide> send_data blob.download, filename: blob.filename, type: blob.content_type, disposition: disposition_param <ide> end <ide><path>lib/active_storage/migration.rb <del>class ActiveStorageCreateTables < ActiveRecord::Migration[5.1] <add>class ActiveStorageCreateTables < ActiveRecord::Migration[5.1] # :nodoc: <ide> def change <ide> create_table :active_storage_blobs do |t| <ide> t.string :key <ide><path>lib/active_storage/service.rb <ide> # Abstract class serving as an interface for concrete services. <add># <add># The available services are: <add># <add># * +Disk+, to manage attachments saved directly on the hard drive. <add># * +GCS+, to manage attachments through Google Cloud Storage. <add># * +S3+, to manage attachments through Amazon S3. <add># * +Mirror+, to be able to use several services to manage attachments. <add># <add># Inside a Rails application, you can set-up your services through the <add># generated <tt>config/storage_services.yml</tt> file and reference one <add># of the aforementioned constant under the +service+ key. For example: <add># <add># local: <add># service: Disk <add># root: <%= Rails.root.join("storage") %> <add># <add># You can checkout the service's constructor to know which keys are required. <add># <add># Then, in your application's configuration, you can specify the service to <add># use like this: <add># <add># config.active_storage.service = :local <add># <add># If you are using Active Storage outside of a Ruby on Rails application, you <add># can configure the service to use like this: <add># <add># ActiveStorage::Blob.service = ActiveStorage::Service.configure( <add># :Disk, <add># root: Pathname("/foo/bar/storage") <add># ) <ide> class ActiveStorage::Service <ide> class ActiveStorage::IntegrityError < StandardError; end <ide> <ide> def self.configure(service, **options) <ide> end <ide> end <ide> <del> <ide> def upload(key, io, checksum: nil) <ide> raise NotImplementedError <ide> end
6
Ruby
Ruby
move the require to the right place
649b9d93219b5b38bb2fccba5124c4e013726d9e
<ide><path>actioncable/lib/action_cable/engine.rb <ide> require "rails" <ide> require "action_cable" <ide> require "action_cable/helpers/action_cable_helper" <add>require "active_support/core_ext/hash/indifferent_access" <ide> <ide> module ActionCable <ide> class Railtie < Rails::Engine # :nodoc: <ide><path>actioncable/lib/action_cable/server/configuration.rb <del>require 'active_support/core_ext/hash/indifferent_access' <del> <ide> module ActionCable <ide> module Server <ide> # An instance of this configuration object is available via ActionCable.server.config, which allows you to tweak the configuration points
2
Javascript
Javascript
convert large file warning
8f81831ad4f8f5ef4aa5e8f79aa51eb67d41f56d
<ide><path>src/workspace.js <ide> module.exports = class Workspace extends Model { <ide> // * `uri` A {String} containing a URI. <ide> // <ide> // Returns a {Promise} that resolves to the {TextEditor} (or other item) for the given URI. <del> createItemForURI (uri, options) { <add> async createItemForURI (uri, options) { <ide> if (uri != null) { <del> for (let opener of this.getOpeners()) { <add> for (const opener of this.getOpeners()) { <ide> const item = opener(uri, options) <del> if (item != null) return Promise.resolve(item) <add> if (item != null) return item <ide> } <ide> } <ide> <ide> try { <del> return this.openTextFile(uri, options) <add> const item = await this.openTextFile(uri, options) <add> return item <ide> } catch (error) { <ide> switch (error.code) { <ide> case 'CANCELLED': <ide> module.exports = class Workspace extends Model { <ide> } <ide> } <ide> <del> openTextFile (uri, options) { <add> async openTextFile (uri, options) { <ide> const filePath = this.project.resolvePath(uri) <ide> <ide> if (filePath != null) { <ide> module.exports = class Workspace extends Model { <ide> const fileSize = fs.getSizeSync(filePath) <ide> <ide> const largeFileMode = fileSize >= (2 * 1048576) // 2MB <del> if (fileSize >= (this.config.get('core.warnOnLargeFileLimit') * 1048576)) { // 20MB by default <del> const choice = this.applicationDelegate.confirm({ <add> <add> let resolveConfirmFileOpenPromise, rejectConfirmFileOpenPromise = [] <add> const confirmFileOpenPromise = new Promise((resolve, reject) => { <add> resolveConfirmFileOpenPromise = resolve <add> rejectConfirmFileOpenPromise = reject <add> }) <add> if (fileSize >= (this.config.get('core.warnOnLargeFileLimit') * 1048576)) { // 40MB by default <add> this.applicationDelegate.confirm({ <ide> message: 'Atom will be unresponsive during the loading of very large files.', <ide> detailedMessage: 'Do you still want to load this file?', <ide> buttons: ['Proceed', 'Cancel'] <add> }, response => { <add> if (response === 1) { <add> rejectConfirmFileOpenPromise() <add> } else { <add> resolveConfirmFileOpenPromise() <add> } <ide> }) <del> if (choice === 1) { <del> const error = new Error() <del> error.code = 'CANCELLED' <del> throw error <del> } <add> } else { <add> resolveConfirmFileOpenPromise() <ide> } <ide> <del> return this.project.bufferForPath(filePath, options) <del> .then(buffer => { <del> return this.textEditorRegistry.build(Object.assign({buffer, largeFileMode, autoHeight: false}, options)) <del> }) <add> try { <add> await confirmFileOpenPromise <add> const buffer = await this.project.bufferForPath(filePath, options) <add> return this.textEditorRegistry.build(Object.assign({buffer, largeFileMode, autoHeight: false}, options)) <add> } catch (e) { <add> const error = new Error() <add> error.code = 'CANCELLED' <add> throw error <add> } <ide> } <ide> <ide> handleGrammarUsed (grammar) {
1
Javascript
Javascript
add a charset to the default content-type
732696e840eeaa32d83dc68adbe9ad075291d0e2
<ide><path>server/render.js <ide> export function sendHTML (req, res, html, method, { dev }) { <ide> <ide> res.setHeader('ETag', etag) <ide> if (!res.getHeader('Content-Type')) { <del> res.setHeader('Content-Type', 'text/html') <add> res.setHeader('Content-Type', 'text/html; charset=utf-8') <ide> } <ide> res.setHeader('Content-Length', Buffer.byteLength(html)) <ide> res.end(method === 'HEAD' ? null : html) <ide><path>test/integration/basic/pages/custom-encoding.js <ide> import React from 'react' <ide> export default class extends React.Component { <ide> static async getInitialProps ({res}) { <ide> if (res) { <del> res.setHeader('Content-Type', 'text/html; charset=utf-8') <add> res.setHeader('Content-Type', 'text/html; charset=iso-8859-2') <ide> } <ide> return {} <ide> } <ide><path>test/integration/basic/test/rendering.js <ide> export default function ({ app }, suiteName, render, fetch) { <ide> <ide> test('default Content-Type', async () => { <ide> const res = await fetch('/stateless') <del> expect(res.headers.get('Content-Type')).toMatch('text/html') <add> expect(res.headers.get('Content-Type')).toMatch('text/html; charset=utf-8') <ide> }) <ide> <ide> test('setting Content-Type in getInitialProps', async () => { <ide> const res = await fetch('/custom-encoding') <del> expect(res.headers.get('Content-Type')).toMatch('text/html; charset=utf-8') <add> expect(res.headers.get('Content-Type')).toMatch('text/html; charset=iso-8859-2') <ide> }) <ide> <ide> test('allows to import .json files', async () => {
3
Javascript
Javascript
prefer ember.merge over jquery.extend
10474ed87120abfc15e4767b2f4d5ef7aa72745d
<ide><path>packages/ember-handlebars/lib/helpers/view.js <ide> import { IS_BINDING } from "ember-metal/mixin"; <ide> import jQuery from "ember-views/system/jquery"; <ide> import View from "ember-views/views/view"; <ide> import { isGlobalPath } from "ember-metal/binding"; <add>import merge from "ember-metal/merge"; <ide> import { <ide> normalizePath, <ide> handlebarsGet <ide> export var ViewHelper = EmberObject.create({ <ide> } <ide> <ide> if (dup) { <del> hash = jQuery.extend({}, hash); <add> hash = merge({}, hash); <ide> delete hash.id; <ide> delete hash.tag; <ide> delete hash['class']; <ide> export var ViewHelper = EmberObject.create({ <ide> } <ide> } <ide> <del> return jQuery.extend(hash, extensions); <add> return merge(hash, extensions); <ide> }, <ide> <ide> // Transform bindings from the current context to a context that can be evaluated within the view. <ide><path>packages/ember-views/lib/system/event_dispatcher.js <ide> import { fmt } from "ember-runtime/system/string"; <ide> import EmberObject from "ember-runtime/system/object"; <ide> import jQuery from "ember-views/system/jquery"; <ide> import View from "ember-views/views/view"; <add>import merge from "ember-metal/merge"; <ide> <ide> var ActionHelper; <ide> <ide> export default EmberObject.extend({ <ide> setup: function(addedEvents, rootElement) { <ide> var event, events = get(this, 'events'); <ide> <del> jQuery.extend(events, addedEvents || {}); <add> merge(events, addedEvents || {}); <ide> <ide> if (!isNone(rootElement)) { <ide> set(this, 'rootElement', rootElement);
2
Javascript
Javascript
fix typos in click test descriptions [ci skip]
1be4edc76f5d773047141be702db35824d2c1602
<ide><path>actionview/test/ujs/public/test/data-disable-with.js <ide> asyncTest('form[data-remote] input|button|textarea[data-disable-with] does not d <ide> start() <ide> }) <ide> <del>asyncTest('ctrl-clicking on a link does not disables the link', 6, function() { <add>asyncTest('ctrl-clicking on a link does not disable the link', 6, function() { <ide> var link = $('a[data-disable-with]') <ide> <ide> App.checkEnabledState(link, 'Click me') <ide> asyncTest('ctrl-clicking on a link does not disables the link', 6, function() { <ide> start() <ide> }) <ide> <del>asyncTest('right/mouse-wheel-clicking on a link does not disables the link', 10, function() { <add>asyncTest('right/mouse-wheel-clicking on a link does not disable the link', 10, function() { <ide> var link = $('a[data-disable-with]') <ide> <ide> App.checkEnabledState(link, 'Click me')
1
Python
Python
update spacy to 2.2.4.dev0
18ff97589d3f1adccd9aa451959dbfe97f67e29a
<ide><path>spacy/about.py <ide> # fmt: off <ide> __title__ = "spacy" <del>__version__ = "2.2.3" <add>__version__ = "2.2.4.dev0" <ide> __release__ = True <ide> __download_url__ = "https://github.com/explosion/spacy-models/releases/download" <ide> __compatibility__ = "https://raw.githubusercontent.com/explosion/spacy-models/master/compatibility.json"
1
Text
Text
remove dead links from /examples readme.md
1e7b4e9a5e45bb752435bd9470a234542762656b
<ide><path>examples/README.md <ide> <ide> [code-splitting-specify-chunk-name](code-splitting-specify-chunk-name) <ide> <del>[move-to-parent](move-to-parent) <del> <del>[multiple-commons-chunks](multiple-commons-chunks) <del> <del>[multiple-entry-points-commons-chunk-css-bundle](multiple-entry-points-commons-chunk-css-bundle) <del> <ide> [named-chunks](named-chunks) example demonstrating merging of chunks with named chunks <ide> <ide> [two-explicit-vendor-chunks](two-explicit-vendor-chunks) <ide> ## CommonJS <ide> [commonjs](commonjs) example demonstrating a very simple program <ide> <del>## Css Bundle <del>[css-bundle](css-bundle) <del> <del>[multiple-entry-points-commons-chunk-css-bundle](multiple-entry-points-commons-chunk-css-bundle) <del> <ide> ## DLL <ide> [dll](dll) <ide>
1
PHP
PHP
fix method order
d020a40b977b49ce7adee04c6f520bb794804353
<ide><path>src/Illuminate/Foundation/Auth/AuthenticatesUsers.php <ide> public function postLogin(Request $request) <ide> return $this->login($request); <ide> } <ide> <del> /** <del> * Validate user login attributes. <del> * <del> * @param \Illuminate\Http\Request $request <del> * @return null <del> */ <del> protected function validateLogin($request) <del> { <del> $this->validate($request, [ <del> $this->loginUsername() => 'required', 'password' => 'required', <del> ]); <del> } <del> <ide> /** <ide> * Handle a login request to the application. <ide> * <ide> public function login(Request $request) <ide> return $this->sendFailedLoginResponse($request); <ide> } <ide> <add> /** <add> * Validate the user login request. <add> * <add> * @param \Illuminate\Http\Request $request <add> * @return void <add> */ <add> protected function validateLogin(Request $request) <add> { <add> $this->validate($request, [ <add> $this->loginUsername() => 'required', 'password' => 'required', <add> ]); <add> } <add> <ide> /** <ide> * Send the response after the user was authenticated. <ide> *
1
Text
Text
fix single vs plural
280bcfa9f596a6747bdb99c5e416e924bc400644
<ide><path>docs/docs/typechecking-with-proptypes.md <ide> MyComponent.propTypes = { <ide> }; <ide> ``` <ide> <del>### Requiring Single Children <add>### Requiring Single Child <ide> <ide> With `React.PropTypes.element` you can specify that only a single child can be passed to a component as children. <ide>
1
Ruby
Ruby
remove strange alias for javascripthelper
5501166dec84e1dd63800ea25eaf23290216cf80
<ide><path>actionpack/lib/action_view/helpers/javascript_helper.rb <ide> def array_or_string_for_javascript(option) <ide> end <ide> end <ide> end <del> <del> JavascriptHelper = JavaScriptHelper unless const_defined? :JavascriptHelper <ide> end <ide> end
1
PHP
PHP
update doc block for errorhandler
a59445356c1e6871a12d0697fa10a43bce413455
<ide><path>lib/Cake/Error/ErrorHandler.php <ide> <?php <ide> /** <del> * Error handler <del> * <del> * Provides Error Capturing for Framework errors. <del> * <ide> * PHP 5 <ide> * <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <ide> * <ide> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://cakephp.org CakePHP(tm) Project <del> * @package Cake.Error <ide> * @since CakePHP(tm) v 0.10.5.1732 <ide> * @license http://www.opensource.org/licenses/mit-license.php MIT License <ide> */ <ide> * You can implement application specific exception handling in one of a few ways. Each approach <ide> * gives you different amounts of control over the exception handling process. <ide> * <del> * - Set Configure::write('Exception.handler', 'YourClass::yourMethod'); <add> * - Modify App/Config/error.php and setup custom exception handling. <ide> * - Create AppController::appError(); <del> * - Set Configure::write('Exception.renderer', 'YourClass'); <add> * - Use the `exceptionRenderer` option to inject an Exception renderer. This will <add> * let you keep the existing handling logic but override the rendering logic. <ide> * <del> * #### Create your own Exception handler with `Exception.handler` <add> * #### Create your own Exception handler <ide> * <ide> * This gives you full control over the exception handling process. The class you choose should be <del> * loaded in your app/Config/bootstrap.php, so its available to handle any exceptions. You can <del> * define the handler as any callback type. Using Exception.handler overrides all other exception <del> * handling settings and logic. <add> * loaded in your app/Config/error.php and registered as the default exception handler. <ide> * <ide> * #### Using `AppController::appError();` <ide> * <ide> * This controller method is called instead of the default exception rendering. It receives the <ide> * thrown exception as its only argument. You should implement your error handling in that method. <del> * Using AppController::appError(), will supersede any configuration for Exception.renderer. <add> * Using AppController::appError(), will supersede any default exception handlers. <ide> * <del> * #### Using a custom renderer with `Exception.renderer` <add> * #### Using a custom renderer with `exceptionRenderer` <ide> * <ide> * If you don't want to take control of the exception handling, but want to change how exceptions are <del> * rendered you can use `Exception.renderer` to choose a class to render exception pages. By default <del> * `ExceptionRenderer` is used. Your custom exception renderer class should be placed in app/Lib/Error. <add> * rendered you can use `exceptionRenderer` option to choose a class to render exception pages. By default <add> * `Cake\Error\ExceptionRenderer` is used. Your custom exception renderer class should be placed in app/Error. <ide> * <ide> * Your custom renderer should expect an exception in its constructor, and implement a render method. <ide> * Failing to do so will cause additional errors. <ide> * <ide> * #### Logging exceptions <ide> * <ide> * Using the built-in exception handling, you can log all the exceptions <del> * that are dealt with by ErrorHandler by setting `Exception.log` to true in your App/Config/error.php. <add> * that are dealt with by ErrorHandler by setting `log` option to true in your App/Config/error.php. <ide> * Enabling this will log every exception to Log and the configured loggers. <ide> * <ide> * ### PHP errors <ide> * <ide> * Error handler also provides the built in features for handling php errors (trigger_error). <ide> * While in debug mode, errors will be output to the screen using debugger. While in production mode, <ide> * errors will be logged to Log. You can control which errors are logged by setting <del> * `Error.level` in your App/Config/error.php. <add> * `errorLevel` option in App/Config/error.php. <ide> * <ide> * #### Logging errors <ide> * <del> * When ErrorHandler is used for handling errors, you can enable error logging by setting `Error.log` to true. <del> * This will log all errors to the configured log handlers. <add> * When ErrorHandler is used for handling errors, you can enable error logging by setting the `log` <add> * option to true. This will log all errors to the configured log handlers. <ide> * <ide> * #### Controlling what errors are logged/displayed <ide> * <del> * You can control which errors are logged / displayed by ErrorHandler by setting `Error.level`. Setting this <add> * You can control which errors are logged / displayed by ErrorHandler by setting `errorLevel`. Setting this <ide> * to one or a combination of a few of the E_* constants will only enable the specified errors. <ide> * <del> * e.g. `Configure::write('Error.level', E_ALL & ~E_NOTICE);` <add> * $options['log'] = E_ALL & ~E_NOTICE; <ide> * <ide> * Would enable handling for all non Notice errors. <ide> *
1
Python
Python
prepare tools/install.py for python 3
b8fbe69db1292307adb2c2b2e0d5ef48c4ab2faf
<ide><path>tools/install.py <ide> #!/usr/bin/env python <ide> <add>from __future__ import print_function <ide> import ast <ide> import errno <ide> import os <ide> def load_config(): <ide> def try_unlink(path): <ide> try: <ide> os.unlink(path) <del> except OSError, e: <add> except OSError as e: <ide> if e.errno != errno.ENOENT: raise <ide> <ide> def try_symlink(source_path, link_path): <del> print 'symlinking %s -> %s' % (source_path, link_path) <add> print('symlinking %s -> %s' % (source_path, link_path)) <ide> try_unlink(link_path) <ide> try_mkdir_r(os.path.dirname(link_path)) <ide> os.symlink(source_path, link_path) <ide> <ide> def try_mkdir_r(path): <ide> try: <ide> os.makedirs(path) <del> except OSError, e: <add> except OSError as e: <ide> if e.errno != errno.EEXIST: raise <ide> <ide> def try_rmdir_r(path): <ide> path = abspath(path) <ide> while path.startswith(install_path): <ide> try: <ide> os.rmdir(path) <del> except OSError, e: <add> except OSError as e: <ide> if e.errno == errno.ENOTEMPTY: return <ide> if e.errno == errno.ENOENT: return <ide> raise <ide> def mkpaths(path, dst): <ide> <ide> def try_copy(path, dst): <ide> source_path, target_path = mkpaths(path, dst) <del> print 'installing %s' % target_path <add> print('installing %s' % target_path) <ide> try_mkdir_r(os.path.dirname(target_path)) <ide> try_unlink(target_path) # prevent ETXTBSY errors <ide> return shutil.copy2(source_path, target_path) <ide> <ide> def try_remove(path, dst): <ide> source_path, target_path = mkpaths(path, dst) <del> print 'removing %s' % target_path <add> print('removing %s' % target_path) <ide> try_unlink(target_path) <ide> try_rmdir_r(os.path.dirname(target_path)) <ide>
1
PHP
PHP
remove incorrect documentation
d75423b271d426e984c58547c6bd6161584ae8db
<ide><path>Cake/Controller/Component/SecurityComponent.php <ide> class SecurityComponent extends Component { <ide> <ide> /** <ide> * Actions to exclude from POST validation checks. <del> * Other checks like requireAuth(), requireSecure(), <del> * requirePost(), requireGet() etc. will still be applied. <add> * Other checks like requireAuth(), requireSecure() <add> * etc. will still be applied. <ide> * <ide> * @var array <ide> */
1
Javascript
Javascript
update imports in ember-runtime package tests
16c3c944a33a11f4bed4fd1f91bb47ce9d10897e
<ide><path>packages/ember-metal/lib/index.js <ide> export { <ide> } from './error_handler'; <ide> export { <ide> META_DESC, <del> meta <add> meta, <add> peekMeta <ide> } from './meta'; <ide> export { default as Error } from './error'; <ide> export { default as Cache } from './cache'; <ide> export { <ide> isWatching, <ide> rewatch, <ide> unwatch, <del> watch <add> watch, <add> watcherCount <ide> } from './watching'; <ide> export { default as libraries } from './libraries'; <ide> export { <ide><path>packages/ember-runtime/tests/computed/computed_macros_test.js <del>import { computed } from 'ember-metal/computed'; <add>import { <add> computed, <add> alias, <add> defineProperty, <add>} from 'ember-metal'; <ide> import { <ide> empty, <ide> notEmpty, <ide> import { <ide> deprecatingAlias, <ide> and, <ide> or, <del>} from 'ember-runtime/computed/computed_macros'; <add>} from '../../computed/computed_macros'; <add>import { testBoth } from 'internal-test-helpers'; <ide> <del>import alias from 'ember-metal/alias'; <del>import { defineProperty } from 'ember-metal/properties'; <del>import EmberObject from 'ember-runtime/system/object'; <del>import { testBoth } from 'ember-metal/tests/props_helper'; <del>import { A as emberA } from 'ember-runtime/system/native_array'; <add>import EmberObject from '../../system/object'; <add>import { A as emberA } from '../../system/native_array'; <ide> <ide> QUnit.module('CP macros'); <ide> <ide><path>packages/ember-runtime/tests/computed/reduce_computed_macros_test.js <del>import run from 'ember-metal/run_loop'; <del>import EmberObject from 'ember-runtime/system/object'; <del>import { defineProperty } from 'ember-metal/properties'; <del>import setProperties from 'ember-metal/set_properties'; <del>import ObjectProxy from 'ember-runtime/system/object_proxy'; <del>import isEnabled from 'ember-metal/features'; <del>import { get } from 'ember-metal/property_get'; <del>import { set } from 'ember-metal/property_set'; <del>import { addObserver } from 'ember-metal/observer'; <del>import { computed } from 'ember-metal/computed'; <del>import { observer } from 'ember-metal/mixin'; <add>import { <add> run, <add> defineProperty, <add> setProperties, <add> isFeatureEnabled, <add> get, <add> set, <add> addObserver, <add> computed, <add> observer <add>} from 'ember-metal'; <add>import { testBoth } from 'internal-test-helpers'; <add>import EmberObject from '../../system/object'; <add>import ObjectProxy from '../../system/object_proxy'; <ide> import { <ide> sum, <ide> min, <ide> import { <ide> union, <ide> intersect, <ide> collect <del>} from 'ember-runtime/computed/reduce_computed_macros'; <del>import { isArray } from 'ember-runtime/utils'; <del>import { testBoth } from 'ember-metal/tests/props_helper'; <del>import { A as emberA } from 'ember-runtime/system/native_array'; <del>import { removeAt } from 'ember-runtime/mixins/mutable_array'; <add>} from '../../computed/reduce_computed_macros'; <add>import { isArray } from '../../utils'; <add>import { A as emberA } from '../../system/native_array'; <add>import { removeAt } from '../../mixins/mutable_array'; <ide> <ide> let obj; <ide> QUnit.module('map', { <ide> QUnit.test('properties values can be replaced', function() { <ide> }); <ide> }); <ide> <del>if (isEnabled('ember-runtime-computed-uniq-by')) { <add>if (isFeatureEnabled('ember-runtime-computed-uniq-by')) { <ide> QUnit.module('computed.uniqBy', { <ide> setup() { <ide> obj = EmberObject.extend({ <ide><path>packages/ember-runtime/tests/controllers/controller_test.js <ide> /* global EmberDev */ <ide> <del>import Controller from 'ember-runtime/controllers/controller'; <del>import Service from 'ember-runtime/system/service'; <del>import Mixin from 'ember-metal/mixin'; <del>import EmberObject from 'ember-runtime/system/object'; <del>import inject from 'ember-runtime/inject'; <del>import { get } from 'ember-metal/property_get'; <del>import buildOwner from 'container/tests/test-helpers/build-owner'; <add>import Controller from '../../controllers/controller'; <add>import Service from '../../system/service'; <add>import { Mixin, get } from 'ember-metal'; <add>import EmberObject from '../../system/object'; <add>import inject from '../../inject'; <add>import { buildOwner } from 'internal-test-helpers'; <ide> <ide> QUnit.module('Controller event handling'); <ide> <ide><path>packages/ember-runtime/tests/core/compare_test.js <del>import {typeOf} from 'ember-runtime/utils'; <del>import EmberObject from 'ember-runtime/system/object'; <del>import compare from 'ember-runtime/compare'; <del>import Comparable from 'ember-runtime/mixins/comparable'; <add>import { typeOf } from '../../utils'; <add>import EmberObject from '../../system/object'; <add>import compare from '../../compare'; <add>import Comparable from '../../mixins/comparable'; <ide> <ide> let data = []; <ide> let Comp = EmberObject.extend(Comparable); <ide><path>packages/ember-runtime/tests/core/copy_test.js <del>import copy from 'ember-runtime/copy'; <add>import copy from '../../copy'; <ide> <ide> QUnit.module('Ember Copy Method'); <ide> <ide><path>packages/ember-runtime/tests/core/isEqual_test.js <del>import isEqual from 'ember-runtime/is-equal'; <add>import isEqual from '../../is-equal'; <ide> <ide> QUnit.module('isEqual'); <ide> <ide><path>packages/ember-runtime/tests/core/is_array_test.js <del>import { isArray } from 'ember-runtime/utils'; <del>import { A as emberA } from 'ember-runtime/system/native_array'; <del>import ArrayProxy from 'ember-runtime/system/array_proxy'; <add>import { isArray } from '../../utils'; <add>import { A as emberA } from '../../system/native_array'; <add>import ArrayProxy from '../../system/array_proxy'; <ide> <ide> QUnit.module('Ember Type Checking'); <ide> <ide><path>packages/ember-runtime/tests/core/is_empty_test.js <del>import isEmpty from 'ember-metal/is_empty'; <del>import ArrayProxy from 'ember-runtime/system/array_proxy'; <del>import { A as emberA } from 'ember-runtime/system/native_array'; <add>import { isEmpty } from 'ember-metal'; <add>import ArrayProxy from '../../system/array_proxy'; <add>import { A as emberA } from '../../system/native_array'; <ide> <ide> QUnit.module('Ember.isEmpty'); <ide> <ide><path>packages/ember-runtime/tests/core/type_of_test.js <del>import { typeOf } from 'ember-runtime/utils'; <del>import EmberObject from 'ember-runtime/system/object'; <add>import { typeOf } from '../../utils'; <add>import EmberObject from '../../system/object'; <ide> <ide> QUnit.module('Ember Type Checking'); <ide> <ide><path>packages/ember-runtime/tests/ext/function_test.js <ide> import { ENV } from 'ember-environment'; <del>import { Mixin, mixin } from 'ember-metal/mixin'; <del>import EmberObject from 'ember-runtime/system/object'; <del>import Evented from 'ember-runtime/mixins/evented'; <del>import { testBoth } from 'ember-metal/tests/props_helper'; <add>import { Mixin, mixin } from 'ember-metal'; <add>import { testBoth } from 'internal-test-helpers'; <add>import EmberObject from '../../system/object'; <add>import Evented from '../../mixins/evented'; <ide> <ide> QUnit.module('Function.prototype.observes() helper'); <ide> <ide><path>packages/ember-runtime/tests/ext/mixin_test.js <del>import {set} from 'ember-metal/property_set'; <del>import {get} from 'ember-metal/property_get'; <del>import {Mixin} from 'ember-metal/mixin'; <del>import { Binding } from 'ember-metal/binding'; <del>import run from 'ember-metal/run_loop'; <add>import { set, get, Mixin, Binding, run } from 'ember-metal'; <ide> <ide> QUnit.module('system/mixin/binding_test'); <ide> <ide><path>packages/ember-runtime/tests/ext/rsvp_test.js <del>import { isTesting, setTesting } from 'ember-metal/testing'; <del>import { setOnerror, getOnerror } from 'ember-metal/error_handler'; <del>import run from 'ember-metal/run_loop'; <del>import RSVP from 'ember-runtime/ext/rsvp'; <add>import { <add> isTesting, <add> setTesting, <add> setOnerror, <add> getOnerror, <add> run <add>} from 'ember-metal'; <add>import RSVP from '../../ext/rsvp'; <ide> <ide> const ORIGINAL_ONERROR = getOnerror(); <ide> <ide><path>packages/ember-runtime/tests/inject_test.js <ide> /* global EmberDev */ <ide> <del>import InjectedProperty from 'ember-metal/injected_property'; <del>import inject from 'ember-runtime/inject'; <add>import { InjectedProperty } from 'ember-metal'; <add>import inject from '../inject'; <ide> import { <ide> createInjectionHelper <del>} from 'ember-runtime/inject'; <del>import EmberObject from 'ember-runtime/system/object'; <del>import buildOwner from 'container/tests/test-helpers/build-owner'; <add>} from '../inject'; <add>import EmberObject from '../system/object'; <add>import { buildOwner } from 'internal-test-helpers'; <ide> <ide> QUnit.module('inject'); <ide> <ide><path>packages/ember-runtime/tests/legacy_1x/mixins/observable/chained_test.js <del>import { get } from 'ember-metal/property_get'; <del>import { set } from 'ember-metal/property_set'; <del>import run from 'ember-metal/run_loop'; <del>import EmberObject from 'ember-runtime/system/object'; <del>import { addObserver } from 'ember-metal/observer'; <del>import { A as emberA } from 'ember-runtime/system/native_array'; <add>import { get, set, run, addObserver } from 'ember-metal'; <add>import EmberObject from '../../../../system/object'; <add>import { A as emberA } from '../../../../system/native_array'; <ide> <ide> /* <ide> NOTE: This test is adapted from the 1.x series of unit tests. The tests <ide><path>packages/ember-runtime/tests/legacy_1x/mixins/observable/observable_test.js <ide> import { context } from 'ember-environment'; <del>import { get } from 'ember-metal/property_get'; <del>import { computed } from 'ember-metal/computed'; <del>import run from 'ember-metal/run_loop'; <del>import { observer } from 'ember-metal/mixin'; <del>import { w } from 'ember-runtime/system/string'; <del>import EmberObject from 'ember-runtime/system/object'; <del>import Observable from 'ember-runtime/mixins/observable'; <del>import { A as emberA } from 'ember-runtime/system/native_array'; <add>import { get, computed, run, observer } from 'ember-metal'; <add>import { w } from '../../../../system/string'; <add>import EmberObject from '../../../../system/object'; <add>import Observable from '../../../../mixins/observable'; <add>import { A as emberA } from '../../../../system/native_array'; <ide> <ide> /* <ide> NOTE: This test is adapted from the 1.x series of unit tests. The tests <ide><path>packages/ember-runtime/tests/legacy_1x/mixins/observable/observersForKey_test.js <ide> // Ember.Observable Tests <ide> // ======================================================================== <ide> <del>import {get} from 'ember-metal/property_get'; <del>import EmberObject from 'ember-runtime/system/object'; <del>import Observable from 'ember-runtime/mixins/observable'; <add>import { get } from 'ember-metal'; <add>import EmberObject from '../../../../system/object'; <add>import Observable from '../../../../mixins/observable'; <ide> <ide> var ObservableObject = EmberObject.extend(Observable); <ide> <ide><path>packages/ember-runtime/tests/legacy_1x/mixins/observable/propertyChanges_test.js <ide> // Ember.Observable Tests <ide> // ======================================================================== <ide> <del>import EmberObject from 'ember-runtime/system/object'; <del>import Observable from 'ember-runtime/mixins/observable'; <del>import {computed} from 'ember-metal/computed'; <del>import {observer} from 'ember-metal/mixin'; <add>import EmberObject from '../../../../system/object'; <add>import Observable from '../../../../mixins/observable'; <add>import { computed, observer } from 'ember-metal'; <ide> <ide> const ObservableObject = EmberObject.extend(Observable); <ide> <ide><path>packages/ember-runtime/tests/legacy_1x/system/binding_test.js <del>import {context} from 'ember-environment'; <del>import {get} from 'ember-metal/property_get'; <del>import {set} from 'ember-metal/property_set'; <del>import run from 'ember-metal/run_loop'; <del>import {Binding, bind } from 'ember-metal/binding'; <del>import {observer as emberObserver} from 'ember-metal/mixin'; <del>import EmberObject from 'ember-runtime/system/object'; <add>import { context } from 'ember-environment'; <add>import { <add> get, <add> set, <add> run, <add> Binding, <add> bind, <add> observer as emberObserver <add>} from 'ember-metal'; <add>import EmberObject from '../../../system/object'; <ide> <ide> <ide> /* <ide><path>packages/ember-runtime/tests/legacy_1x/system/object/base_test.js <del>import { get } from 'ember-metal/property_get'; <del>import { set } from 'ember-metal/property_set'; <del>import EmberObject from 'ember-runtime/system/object'; <add>import { get, set } from 'ember-metal'; <add>import EmberObject from '../../../../system/object'; <ide> <ide> /* <ide> NOTE: This test is adapted from the 1.x series of unit tests. The tests <ide><path>packages/ember-runtime/tests/legacy_1x/system/object/bindings_test.js <del>import {context} from 'ember-environment'; <del>import {get} from 'ember-metal/property_get'; <del>import {set} from 'ember-metal/property_set'; <del>import run from 'ember-metal/run_loop'; <del>import EmberObject from 'ember-runtime/system/object'; <add>import { context } from 'ember-environment'; <add>import { get, set, run } from 'ember-metal'; <add>import EmberObject from '../../../../system/object'; <ide> <ide> /* <ide> NOTE: This test is adapted from the 1.x series of unit tests. The tests <ide><path>packages/ember-runtime/tests/legacy_1x/system/object/concatenated_test.js <del>import {get} from 'ember-metal/property_get'; <del>import EmberObject from 'ember-runtime/system/object'; <add>import { get } from 'ember-metal'; <add>import EmberObject from '../../../../system/object'; <ide> <ide> /* <ide> NOTE: This test is adapted from the 1.x series of unit tests. The tests <ide><path>packages/ember-runtime/tests/legacy_1x/system/run_loop_test.js <del>import {observer as emberObserver} from 'ember-metal/mixin'; <del>import run from 'ember-metal/run_loop'; <del>import {Binding} from 'ember-metal/binding'; <del>import Observable from 'ember-runtime/mixins/observable'; <del>import EmberObject from 'ember-runtime/system/object'; <add>import { <add> observer as emberObserver, <add> run, <add> Binding <add>} from 'ember-metal'; <add>import Observable from '../../../mixins/observable'; <add>import EmberObject from '../../../system/object'; <ide> <ide> /* <ide> NOTE: This test is adapted from the 1.x series of unit tests. The tests <ide><path>packages/ember-runtime/tests/main_test.js <ide> import { <ide> collect, <ide> Object as EmberObject <del>} from 'ember-runtime'; <add>} from '../index'; <ide> <ide> QUnit.module('ember-runtime/main'); <ide> <ide><path>packages/ember-runtime/tests/mixins/array_test.js <del>import { get } from 'ember-metal/property_get'; <del>import { set } from 'ember-metal/property_set'; <del>import { addObserver } from 'ember-metal/observer'; <del>import { observer as emberObserver } from 'ember-metal/mixin'; <del>import { computed } from 'ember-metal/computed'; <del>import { testBoth } from 'ember-metal/tests/props_helper'; <del>import { ArrayTests } from 'ember-runtime/tests/suites/array'; <del>import EmberObject from 'ember-runtime/system/object'; <add>import { <add> get, <add> set, <add> addObserver, <add> observer as emberObserver, <add> computed <add>} from 'ember-metal'; <add>import { testBoth } from 'internal-test-helpers'; <add>import { ArrayTests } from '../suites/array'; <add>import EmberObject from '../../system/object'; <ide> import EmberArray, { <ide> addArrayObserver, <ide> removeArrayObserver, <ide> arrayContentDidChange, <ide> arrayContentWillChange, <ide> objectAt <del>} from 'ember-runtime/mixins/array'; <del>import { A as emberA } from 'ember-runtime/system/native_array'; <add>} from '../../mixins/array'; <add>import { A as emberA } from '../../system/native_array'; <ide> <ide> /* <ide> Implement a basic fake mutable array. This validates that any non-native <ide><path>packages/ember-runtime/tests/mixins/comparable_test.js <del>import {get} from 'ember-metal/property_get'; <del>import EmberObject from 'ember-runtime/system/object'; <del>import compare from 'ember-runtime/compare'; <del>import Comparable from 'ember-runtime/mixins/comparable'; <add>import { get } from 'ember-metal'; <add>import EmberObject from '../../system/object'; <add>import compare from '../../compare'; <add>import Comparable from '../../mixins/comparable'; <ide> <ide> const Rectangle = EmberObject.extend(Comparable, { <ide> length: 0, <ide><path>packages/ember-runtime/tests/mixins/container_proxy_test.js <ide> import { <ide> Registry, <ide> OWNER <ide> } from 'container'; <del>import ContainerProxy from 'ember-runtime/mixins/container_proxy'; <del>import EmberObject from 'ember-runtime/system/object'; <add>import ContainerProxy from '../../mixins/container_proxy'; <add>import EmberObject from '../../system/object'; <ide> <ide> QUnit.module('ember-runtime/mixins/container_proxy', { <ide> setup() { <ide><path>packages/ember-runtime/tests/mixins/copyable_test.js <del>import CopyableTests from 'ember-runtime/tests/suites/copyable'; <del>import Copyable from 'ember-runtime/mixins/copyable'; <del>import {Freezable} from 'ember-runtime/mixins/freezable'; <del>import EmberObject from 'ember-runtime/system/object'; <del>import {generateGuid} from 'ember-metal/utils'; <del>import {set} from 'ember-metal/property_set'; <del>import {get} from 'ember-metal/property_get'; <add>import CopyableTests from '../suites/copyable'; <add>import Copyable from '../../mixins/copyable'; <add>import { Freezable } from '../../mixins/freezable'; <add>import EmberObject from '../../system/object'; <add>import { generateGuid, set, get } from 'ember-metal'; <ide> <ide> QUnit.module('Ember.Copyable.frozenCopy'); <ide> <ide><path>packages/ember-runtime/tests/mixins/enumerable_test.js <del>import EnumerableTests from 'ember-runtime/tests/suites/enumerable'; <del>import EmberObject from 'ember-runtime/system/object'; <del>import Enumerable from 'ember-runtime/mixins/enumerable'; <del>import EmberArray from 'ember-runtime/mixins/array'; <del>import { A as emberA } from 'ember-runtime/system/native_array'; <del>import { get } from 'ember-metal/property_get'; <del>import { computed } from 'ember-metal/computed'; <del>import { observer as emberObserver } from 'ember-metal/mixin'; <del>import isEnabled from 'ember-metal/features'; <add>import EnumerableTests from '../suites/enumerable'; <add>import EmberObject from '../../system/object'; <add>import Enumerable from '../../mixins/enumerable'; <add>import EmberArray from '../../mixins/array'; <add>import { A as emberA } from '../../system/native_array'; <add>import { <add> get, <add> computed, <add> observer as emberObserver, <add> isFeatureEnabled <add>} from 'ember-metal'; <ide> <ide> function K() { return this; } <ide> <ide> QUnit.test('should apply Ember.Array to return value of without', function() { <ide> } <ide> }); <ide> <del> if (isEnabled('ember-runtime-enumerable-includes')) { <add> if (isFeatureEnabled('ember-runtime-enumerable-includes')) { <ide> X.reopen({ <ide> includes() { <ide> return true; <ide> QUnit.test('every', function() { <ide> equal(allWhite, true); <ide> }); <ide> <del>if (isEnabled('ember-runtime-enumerable-includes')) { <add>if (isFeatureEnabled('ember-runtime-enumerable-includes')) { <ide> QUnit.test('should throw an error passing a second argument to includes', function() { <ide> let x = EmberObject.extend(Enumerable).create(); <ide> <ide><path>packages/ember-runtime/tests/mixins/freezable_test.js <del>import EmberObject from 'ember-runtime/system/object'; <del>import {Freezable} from 'ember-runtime/mixins/freezable'; <add>import EmberObject from '../../system/object'; <add>import { Freezable } from '../../mixins/freezable'; <ide> <ide> QUnit.module('Ember.Freezable'); <ide> <ide><path>packages/ember-runtime/tests/mixins/mutable_array_test.js <del>import { computed } from 'ember-metal/computed'; <del>import MutableArrayTests from 'ember-runtime/tests/suites/mutable_array'; <del>import MutableArray from 'ember-runtime/mixins/mutable_array'; <del>import EmberObject from 'ember-runtime/system/object'; <del>import { A as emberA } from 'ember-runtime/system/native_array'; <add>import { computed } from 'ember-metal'; <add>import MutableArrayTests from '../suites/mutable_array'; <add>import MutableArray from '../../mixins/mutable_array'; <add>import EmberObject from '../../system/object'; <add>import { A as emberA } from '../../system/native_array'; <ide> import { <ide> arrayContentDidChange, <ide> arrayContentWillChange <del>} from 'ember-runtime/mixins/array'; <add>} from '../../mixins/array'; <ide> <ide> /* <ide> Implement a basic fake mutable array. This validates that any non-native <ide><path>packages/ember-runtime/tests/mixins/mutable_enumerable_test.js <del>import MutableEnumerableTests from 'ember-runtime/tests/suites/mutable_enumerable'; <del>import MutableEnumerable from 'ember-runtime/mixins/mutable_enumerable'; <del>import EmberObject from 'ember-runtime/system/object'; <del>import { computed } from 'ember-metal/computed'; <del>import { get } from 'ember-metal/property_get'; <add>import MutableEnumerableTests from '../suites/mutable_enumerable'; <add>import MutableEnumerable from '../../mixins/mutable_enumerable'; <add>import EmberObject from '../../system/object'; <add>import { computed, get } from 'ember-metal'; <ide> <ide> /* <ide> Implement a basic fake mutable array. This validates that any non-native <ide><path>packages/ember-runtime/tests/mixins/observable_test.js <del>import { computed } from 'ember-metal/computed'; <del>import { addObserver } from 'ember-metal/observer'; <del>import EmberObject from 'ember-runtime/system/object'; <del>import { testBoth } from 'ember-metal/tests/props_helper'; <add>import { computed, addObserver } from 'ember-metal'; <add>import { testBoth } from 'internal-test-helpers'; <add>import EmberObject from '../../system/object'; <ide> <ide> QUnit.module('mixins/observable'); <ide> <ide><path>packages/ember-runtime/tests/mixins/promise_proxy_test.js <del>import {get} from 'ember-metal/property_get'; <del>import run from 'ember-metal/run_loop'; <del>import ObjectProxy from 'ember-runtime/system/object_proxy'; <del>import PromiseProxyMixin from 'ember-runtime/mixins/promise_proxy'; <del>import EmberRSVP from 'ember-runtime/ext/rsvp'; <add>import { get, run } from 'ember-metal'; <add>import ObjectProxy from '../../system/object_proxy'; <add>import PromiseProxyMixin from '../../mixins/promise_proxy'; <add>import EmberRSVP from '../../ext/rsvp'; <ide> import { <ide> onerrorDefault <del>} from 'ember-runtime/ext/rsvp'; <add>} from '../../ext/rsvp'; <ide> import * as RSVP from 'rsvp'; <ide> <ide> let ObjectPromiseProxy; <ide><path>packages/ember-runtime/tests/mixins/target_action_support_test.js <ide> import { context } from 'ember-environment'; <del>import EmberObject from 'ember-runtime/system/object'; <del>import TargetActionSupport from 'ember-runtime/mixins/target_action_support'; <add>import EmberObject from '../../system/object'; <add>import TargetActionSupport from '../../mixins/target_action_support'; <ide> <ide> let originalLookup = context.lookup; <ide> let lookup; <ide><path>packages/ember-runtime/tests/suites/array.js <ide> import { <ide> EnumerableTests, <ide> ObserverClass as EnumerableTestsObserverClass <del>} from 'ember-runtime/tests/suites/enumerable'; <del>import indexOfTests from 'ember-runtime/tests/suites/array/indexOf'; <del>import lastIndexOfTests from 'ember-runtime/tests/suites/array/lastIndexOf'; <del>import objectAtTests from 'ember-runtime/tests/suites/array/objectAt'; <del>import includesTests from 'ember-runtime/tests/suites/array/includes'; <add>} from './enumerable'; <add>import indexOfTests from './array/indexOf'; <add>import lastIndexOfTests from './array/lastIndexOf'; <add>import objectAtTests from './array/objectAt'; <add>import includesTests from './array/includes'; <ide> import { <ide> addArrayObserver, <ide> removeArrayObserver <del>} from 'ember-runtime/mixins/array'; <del>import isEnabled from 'ember-metal/features'; <add>} from '../../mixins/array'; <add>import { isFeatureEnabled } from 'ember-metal'; <ide> <ide> const ObserverClass = EnumerableTestsObserverClass.extend({ <ide> observeArray(obj) { <ide> ArrayTests.importModuleTests(indexOfTests); <ide> ArrayTests.importModuleTests(lastIndexOfTests); <ide> ArrayTests.importModuleTests(objectAtTests); <ide> <del>if (isEnabled('ember-runtime-enumerable-includes')) { <add>if (isFeatureEnabled('ember-runtime-enumerable-includes')) { <ide> ArrayTests.importModuleTests(includesTests); <ide> } <ide> <ide><path>packages/ember-runtime/tests/suites/array/includes.js <del>import {SuiteModuleBuilder} from 'ember-runtime/tests/suites/suite'; <add>import { SuiteModuleBuilder } from '../suite'; <ide> <ide> const suite = SuiteModuleBuilder.create(); <ide> <ide><path>packages/ember-runtime/tests/suites/array/indexOf.js <del>import {SuiteModuleBuilder} from 'ember-runtime/tests/suites/suite'; <add>import { SuiteModuleBuilder } from '../suite'; <ide> <ide> const suite = SuiteModuleBuilder.create(); <ide> <ide><path>packages/ember-runtime/tests/suites/array/lastIndexOf.js <del>import {SuiteModuleBuilder} from 'ember-runtime/tests/suites/suite'; <add>import { SuiteModuleBuilder } from '../suite'; <ide> <ide> const suite = SuiteModuleBuilder.create(); <ide> <ide><path>packages/ember-runtime/tests/suites/array/objectAt.js <del>import {SuiteModuleBuilder} from 'ember-runtime/tests/suites/suite'; <del>import { objectAt } from 'ember-runtime/mixins/array'; <add>import { SuiteModuleBuilder } from '../suite'; <add>import { objectAt } from '../../../mixins/array'; <ide> <ide> const suite = SuiteModuleBuilder.create(); <ide> <ide><path>packages/ember-runtime/tests/suites/copyable.js <del>import { Suite } from 'ember-runtime/tests/suites/suite'; <add>import { Suite } from './suite'; <ide> <ide> const CopyableTests = Suite.extend({ <ide> <ide> const CopyableTests = Suite.extend({ <ide> <ide> }); <ide> <del>import copyTests from 'ember-runtime/tests/suites/copyable/copy'; <del>import frozenCopyTests from 'ember-runtime/tests/suites/copyable/frozenCopy'; <add>import copyTests from './copyable/copy'; <add>import frozenCopyTests from './copyable/frozenCopy'; <ide> <ide> CopyableTests.importModuleTests(copyTests); <ide> CopyableTests.importModuleTests(frozenCopyTests); <ide><path>packages/ember-runtime/tests/suites/copyable/copy.js <del>import {SuiteModuleBuilder} from 'ember-runtime/tests/suites/suite'; <add>import { SuiteModuleBuilder } from '../suite'; <ide> <ide> const suite = SuiteModuleBuilder.create(); <ide> <ide><path>packages/ember-runtime/tests/suites/copyable/frozenCopy.js <del>import {SuiteModuleBuilder} from 'ember-runtime/tests/suites/suite'; <del>import {Freezable} from 'ember-runtime/mixins/freezable'; <del>import {get} from 'ember-metal/property_get'; <add>import { SuiteModuleBuilder } from '../suite'; <add>import { Freezable } from '../../../mixins/freezable'; <add>import { get } from 'ember-metal'; <ide> <ide> const suite = SuiteModuleBuilder.create(); <ide> <ide><path>packages/ember-runtime/tests/suites/enumerable.js <del>import { Suite } from 'ember-runtime/tests/suites/suite'; <del>import EmberObject from 'ember-runtime/system/object'; <del>import {guidFor, generateGuid} from 'ember-metal/utils'; <del>import {computed} from 'ember-metal/computed'; <del>import {get} from 'ember-metal/property_get'; <del>import { _addBeforeObserver } from 'ember-metal/observer'; <del>import isEnabled from 'ember-metal/features'; <add>import { Suite } from './suite'; <add>import EmberObject from '../../system/object'; <add>import { <add> guidFor, <add> generateGuid, <add> computed, <add> get, <add> _addBeforeObserver, <add> isFeatureEnabled <add>} from 'ember-metal'; <ide> <ide> const ObserverClass = EmberObject.extend({ <ide> _keysBefore: null, <ide> const EnumerableTests = Suite.extend({ <ide> observerClass: ObserverClass <ide> }); <ide> <del>import anyTests from 'ember-runtime/tests/suites/enumerable/any'; <del>import isAnyTests from 'ember-runtime/tests/suites/enumerable/is_any'; <del>import compactTests from 'ember-runtime/tests/suites/enumerable/compact'; <del>import containsTests from 'ember-runtime/tests/suites/enumerable/contains'; <del>import includesTests from 'ember-runtime/tests/suites/enumerable/includes'; <del>import everyTests from 'ember-runtime/tests/suites/enumerable/every'; <del>import filterTests from 'ember-runtime/tests/suites/enumerable/filter'; <del>import findTests from 'ember-runtime/tests/suites/enumerable/find'; <del>import firstObjectTests from 'ember-runtime/tests/suites/enumerable/firstObject'; <del>import forEachTests from 'ember-runtime/tests/suites/enumerable/forEach'; <del>import mapByTests from 'ember-runtime/tests/suites/enumerable/mapBy'; <del>import invokeTests from 'ember-runtime/tests/suites/enumerable/invoke'; <del>import lastObjectTests from 'ember-runtime/tests/suites/enumerable/lastObject'; <del>import mapTests from 'ember-runtime/tests/suites/enumerable/map'; <del>import reduceTests from 'ember-runtime/tests/suites/enumerable/reduce'; <del>import rejectTests from 'ember-runtime/tests/suites/enumerable/reject'; <del>import sortByTests from 'ember-runtime/tests/suites/enumerable/sortBy'; <del>import toArrayTests from 'ember-runtime/tests/suites/enumerable/toArray'; <del>import uniqTests from 'ember-runtime/tests/suites/enumerable/uniq'; <del>import uniqByTests from 'ember-runtime/tests/suites/enumerable/uniqBy'; <del>import withoutTests from 'ember-runtime/tests/suites/enumerable/without'; <add>import anyTests from './enumerable/any'; <add>import isAnyTests from './enumerable/is_any'; <add>import compactTests from './enumerable/compact'; <add>import containsTests from './enumerable/contains'; <add>import includesTests from './enumerable/includes'; <add>import everyTests from './enumerable/every'; <add>import filterTests from './enumerable/filter'; <add>import findTests from './enumerable/find'; <add>import firstObjectTests from './enumerable/firstObject'; <add>import forEachTests from './enumerable/forEach'; <add>import mapByTests from './enumerable/mapBy'; <add>import invokeTests from './enumerable/invoke'; <add>import lastObjectTests from './enumerable/lastObject'; <add>import mapTests from './enumerable/map'; <add>import reduceTests from './enumerable/reduce'; <add>import rejectTests from './enumerable/reject'; <add>import sortByTests from './enumerable/sortBy'; <add>import toArrayTests from './enumerable/toArray'; <add>import uniqTests from './enumerable/uniq'; <add>import uniqByTests from './enumerable/uniqBy'; <add>import withoutTests from './enumerable/without'; <ide> <ide> EnumerableTests.importModuleTests(anyTests); <ide> EnumerableTests.importModuleTests(isAnyTests); <ide> EnumerableTests.importModuleTests(sortByTests); <ide> EnumerableTests.importModuleTests(toArrayTests); <ide> EnumerableTests.importModuleTests(uniqTests); <ide> <del>if (isEnabled('ember-runtime-computed-uniq-by')) { <add>if (isFeatureEnabled('ember-runtime-computed-uniq-by')) { <ide> EnumerableTests.importModuleTests(uniqByTests); <ide> } <ide> <del>if (isEnabled('ember-runtime-enumerable-includes')) { <add>if (isFeatureEnabled('ember-runtime-enumerable-includes')) { <ide> EnumerableTests.importModuleTests(includesTests); <ide> } <ide> <ide><path>packages/ember-runtime/tests/suites/enumerable/any.js <del>import { SuiteModuleBuilder } from 'ember-runtime/tests/suites/suite'; <del>import { A as emberA } from 'ember-runtime/system/native_array'; <add>import { SuiteModuleBuilder } from '../suite'; <add>import { A as emberA } from '../../../system/native_array'; <ide> <ide> const suite = SuiteModuleBuilder.create(); <ide> <ide><path>packages/ember-runtime/tests/suites/enumerable/compact.js <del>import {SuiteModuleBuilder} from 'ember-runtime/tests/suites/suite'; <add>import { SuiteModuleBuilder } from '../suite'; <ide> <ide> const suite = SuiteModuleBuilder.create(); <ide> <ide><path>packages/ember-runtime/tests/suites/enumerable/contains.js <del>import {SuiteModuleBuilder} from 'ember-runtime/tests/suites/suite'; <del>import isEnabled from 'ember-metal/features'; <add>import { SuiteModuleBuilder } from '../suite'; <add>import { isFeatureEnabled } from 'ember-metal'; <ide> <ide> const suite = SuiteModuleBuilder.create(); <ide> <ide> suite.test('contains returns true if item is in enumerable', function() { <ide> let data = this.newFixture(3); <ide> let obj = this.newObject(data); <ide> <del> if (isEnabled('ember-runtime-enumerable-includes')) { <add> if (isFeatureEnabled('ember-runtime-enumerable-includes')) { <ide> expectDeprecation('`Enumerable#contains` is deprecated, use `Enumerable#includes` instead.'); <ide> } <ide> equal(obj.contains(data[1]), true, 'should return true if contained'); <ide> suite.test('contains returns false if item is not in enumerable', function() { <ide> let data = this.newFixture(1); <ide> let obj = this.newObject(this.newFixture(3)); <ide> <del> if (isEnabled('ember-runtime-enumerable-includes')) { <add> if (isFeatureEnabled('ember-runtime-enumerable-includes')) { <ide> expectDeprecation('`Enumerable#contains` is deprecated, use `Enumerable#includes` instead.'); <ide> } <ide> equal(obj.contains(data[0]), false, 'should return false if not contained'); <ide><path>packages/ember-runtime/tests/suites/enumerable/every.js <del>import EmberObject from 'ember-runtime/system/object'; <del>import {SuiteModuleBuilder} from 'ember-runtime/tests/suites/suite'; <add>import EmberObject from '../../../system/object'; <add>import { SuiteModuleBuilder } from '../suite'; <ide> <ide> const suite = SuiteModuleBuilder.create(); <ide> <ide><path>packages/ember-runtime/tests/suites/enumerable/filter.js <del>import EmberObject from 'ember-runtime/system/object'; <del>import {SuiteModuleBuilder} from 'ember-runtime/tests/suites/suite'; <add>import EmberObject from '../../../system/object'; <add>import { SuiteModuleBuilder } from '../suite'; <ide> <ide> const suite = SuiteModuleBuilder.create(); <ide> <ide><path>packages/ember-runtime/tests/suites/enumerable/find.js <del>import EmberObject from 'ember-runtime/system/object'; <del>import {SuiteModuleBuilder} from 'ember-runtime/tests/suites/suite'; <add>import EmberObject from '../../../system/object'; <add>import { SuiteModuleBuilder } from '../suite'; <ide> <ide> const suite = SuiteModuleBuilder.create(); <ide> // .......................................................... <ide><path>packages/ember-runtime/tests/suites/enumerable/firstObject.js <del>import {SuiteModuleBuilder} from 'ember-runtime/tests/suites/suite'; <del>import {get} from 'ember-metal/property_get'; <del>import {set} from 'ember-metal/property_set'; <add>import { SuiteModuleBuilder } from '../suite'; <add>import { get, set } from 'ember-metal'; <ide> <ide> const suite = SuiteModuleBuilder.create(); <ide> <ide><path>packages/ember-runtime/tests/suites/enumerable/forEach.js <del>import {SuiteModuleBuilder} from 'ember-runtime/tests/suites/suite'; <del>import {get} from 'ember-metal/property_get'; <del>import {guidFor} from 'ember-metal/utils'; <add>import { SuiteModuleBuilder } from '../suite'; <add>import { get, guidFor } from 'ember-metal'; <ide> <ide> const suite = SuiteModuleBuilder.create(); <ide> <ide><path>packages/ember-runtime/tests/suites/enumerable/includes.js <del>import {SuiteModuleBuilder} from 'ember-runtime/tests/suites/suite'; <add>import { SuiteModuleBuilder } from '../suite'; <ide> <ide> const suite = SuiteModuleBuilder.create(); <ide> <ide><path>packages/ember-runtime/tests/suites/enumerable/invoke.js <del>import EmberObject from 'ember-runtime/system/object'; <del>import {SuiteModuleBuilder} from 'ember-runtime/tests/suites/suite'; <add>import EmberObject from '../../../system/object'; <add>import { SuiteModuleBuilder } from '../suite'; <ide> <ide> const suite = SuiteModuleBuilder.create(); <ide> <ide><path>packages/ember-runtime/tests/suites/enumerable/is_any.js <del>import EmberObject from 'ember-runtime/system/object'; <del>import {SuiteModuleBuilder} from 'ember-runtime/tests/suites/suite'; <add>import EmberObject from '../../../system/object'; <add>import { SuiteModuleBuilder } from '../suite'; <ide> <ide> const suite = SuiteModuleBuilder.create(); <ide> <ide><path>packages/ember-runtime/tests/suites/enumerable/lastObject.js <del>import {SuiteModuleBuilder} from 'ember-runtime/tests/suites/suite'; <del>import {get} from 'ember-metal/property_get'; <del>import {set} from 'ember-metal/property_set'; <add>import { SuiteModuleBuilder } from '../suite'; <add>import { get, set } from 'ember-metal'; <ide> <ide> const suite = SuiteModuleBuilder.create(); <ide> <ide><path>packages/ember-runtime/tests/suites/enumerable/map.js <del>import { SuiteModuleBuilder } from 'ember-runtime/tests/suites/suite'; <del>import { get } from 'ember-metal/property_get'; <del>import { guidFor } from 'ember-metal/utils'; <add>import { SuiteModuleBuilder } from '../suite'; <add>import { get, guidFor } from 'ember-metal'; <ide> <ide> const suite = SuiteModuleBuilder.create(); <ide> <ide><path>packages/ember-runtime/tests/suites/enumerable/mapBy.js <del>import {SuiteModuleBuilder} from 'ember-runtime/tests/suites/suite'; <add>import { SuiteModuleBuilder } from '../suite'; <ide> <ide> const suite = SuiteModuleBuilder.create(); <ide> <ide><path>packages/ember-runtime/tests/suites/enumerable/reduce.js <del>import {SuiteModuleBuilder} from 'ember-runtime/tests/suites/suite'; <add>import { SuiteModuleBuilder } from '../suite'; <ide> <ide> const suite = SuiteModuleBuilder.create(); <ide> <ide><path>packages/ember-runtime/tests/suites/enumerable/reject.js <del>import EmberObject from 'ember-runtime/system/object'; <del>import {SuiteModuleBuilder} from 'ember-runtime/tests/suites/suite'; <add>import EmberObject from '../../../system/object'; <add>import { SuiteModuleBuilder } from '../suite'; <ide> <ide> const suite = SuiteModuleBuilder.create(); <ide> <ide><path>packages/ember-runtime/tests/suites/enumerable/sortBy.js <del>import { SuiteModuleBuilder } from 'ember-runtime/tests/suites/suite'; <del>import { get } from 'ember-metal/property_get'; <add>import { SuiteModuleBuilder } from '../suite'; <add>import { get } from 'ember-metal'; <ide> <ide> const suite = SuiteModuleBuilder.create(); <ide> <ide><path>packages/ember-runtime/tests/suites/enumerable/toArray.js <del>import {SuiteModuleBuilder} from 'ember-runtime/tests/suites/suite'; <add>import { SuiteModuleBuilder } from '../suite'; <ide> <ide> const suite = SuiteModuleBuilder.create(); <ide> <ide><path>packages/ember-runtime/tests/suites/enumerable/uniq.js <del>import {SuiteModuleBuilder} from 'ember-runtime/tests/suites/suite'; <add>import { SuiteModuleBuilder } from '../suite'; <ide> <ide> const suite = SuiteModuleBuilder.create(); <ide> <ide><path>packages/ember-runtime/tests/suites/enumerable/uniqBy.js <del>import {SuiteModuleBuilder} from 'ember-runtime/tests/suites/suite'; <del>import isEnabled from 'ember-metal/features'; <add>import { SuiteModuleBuilder } from '../suite'; <add>import { isFeatureEnabled } from 'ember-metal'; <ide> <ide> const suite = SuiteModuleBuilder.create(); <ide> <ide> suite.module('uniqBy'); <ide> <del>if (isEnabled('ember-runtime-computed-uniq-by')) { <add>if (isFeatureEnabled('ember-runtime-computed-uniq-by')) { <ide> suite.test('should return new instance with duplicates removed', function() { <ide> let numbers = this.newObject([ <ide> { id: 1, value: 'one' }, <ide><path>packages/ember-runtime/tests/suites/enumerable/without.js <del>import {SuiteModuleBuilder} from 'ember-runtime/tests/suites/suite'; <del>import isEnabled from 'ember-metal/features'; <add>import { SuiteModuleBuilder } from '../suite'; <add>import { isFeatureEnabled } from 'ember-metal'; <ide> <ide> const suite = SuiteModuleBuilder.create(); <ide> <ide> suite.test('should return new instance with item removed', function() { <ide> deepEqual(this.toArray(obj), before, 'should not have changed original'); <ide> }); <ide> <del>if (isEnabled('ember-runtime-enumerable-includes')) { <add>if (isFeatureEnabled('ember-runtime-enumerable-includes')) { <ide> suite.test('should remove NaN value', function() { <ide> let before, after, obj, ret; <ide> <ide><path>packages/ember-runtime/tests/suites/mutable_array.js <del>import { ArrayTests } from 'ember-runtime/tests/suites/array'; <add>import { ArrayTests } from './array'; <ide> <del>import insertAtTests from 'ember-runtime/tests/suites/mutable_array/insertAt'; <del>import popObjectTests from 'ember-runtime/tests/suites/mutable_array/popObject'; <del>import pushObjectTests from 'ember-runtime/tests/suites/mutable_array/pushObject'; <del>import pushObjectsTest from 'ember-runtime/tests/suites/mutable_array/pushObjects'; <del>import removeAtTests from 'ember-runtime/tests/suites/mutable_array/removeAt'; <del>import replaceTests from 'ember-runtime/tests/suites/mutable_array/replace'; <del>import shiftObjectTests from 'ember-runtime/tests/suites/mutable_array/shiftObject'; <del>import unshiftObjectTests from 'ember-runtime/tests/suites/mutable_array/unshiftObject'; <del>import reverseObjectsTests from 'ember-runtime/tests/suites/mutable_array/reverseObjects'; <add>import insertAtTests from './mutable_array/insertAt'; <add>import popObjectTests from './mutable_array/popObject'; <add>import pushObjectTests from './mutable_array/pushObject'; <add>import pushObjectsTest from './mutable_array/pushObjects'; <add>import removeAtTests from './mutable_array/removeAt'; <add>import replaceTests from './mutable_array/replace'; <add>import shiftObjectTests from './mutable_array/shiftObject'; <add>import unshiftObjectTests from './mutable_array/unshiftObject'; <add>import reverseObjectsTests from './mutable_array/reverseObjects'; <ide> <ide> const MutableArrayTests = ArrayTests.extend(); <ide> MutableArrayTests.importModuleTests(insertAtTests); <ide><path>packages/ember-runtime/tests/suites/mutable_array/addObject.js <del>import get from 'ember-metal/property_get'; <del>import { SuiteModuleBuilder } from 'ember-runtime/tests/suites/suite'; <add>import { get } from 'ember-metal'; <add>import { SuiteModuleBuilder } from '../suite'; <ide> <ide> const suite = SuiteModuleBuilder.create(); <ide> <ide><path>packages/ember-runtime/tests/suites/mutable_array/clear.js <del>import get from 'ember-metal/property_get'; <del>import { SuiteModuleBuilder } from 'ember-runtime/tests/suites/suite'; <add>import { get } from 'ember-metal'; <add>import { SuiteModuleBuilder } from '../suite'; <ide> <ide> const suite = SuiteModuleBuilder.create(); <ide> <ide><path>packages/ember-runtime/tests/suites/mutable_array/insertAt.js <del>import {SuiteModuleBuilder} from 'ember-runtime/tests/suites/suite'; <del>import {get} from 'ember-metal/property_get'; <add>import { SuiteModuleBuilder } from '../suite'; <add>import { get } from 'ember-metal'; <ide> <ide> const suite = SuiteModuleBuilder.create(); <ide> <ide><path>packages/ember-runtime/tests/suites/mutable_array/popObject.js <del>import {SuiteModuleBuilder} from 'ember-runtime/tests/suites/suite'; <del>import {get} from 'ember-metal/property_get'; <add>import { SuiteModuleBuilder } from '../suite'; <add>import { get } from 'ember-metal'; <ide> <ide> const suite = SuiteModuleBuilder.create(); <ide> <ide><path>packages/ember-runtime/tests/suites/mutable_array/pushObject.js <del>import {SuiteModuleBuilder} from 'ember-runtime/tests/suites/suite'; <del>import {get} from 'ember-metal/property_get'; <add>import { SuiteModuleBuilder } from '../suite'; <add>import { get } from 'ember-metal'; <ide> <ide> const suite = SuiteModuleBuilder.create(); <ide> <ide><path>packages/ember-runtime/tests/suites/mutable_array/pushObjects.js <del>import {SuiteModuleBuilder} from 'ember-runtime/tests/suites/suite'; <add>import { SuiteModuleBuilder } from '../suite'; <ide> <ide> const suite = SuiteModuleBuilder.create(); <ide> <ide><path>packages/ember-runtime/tests/suites/mutable_array/removeAt.js <del>import {SuiteModuleBuilder} from 'ember-runtime/tests/suites/suite'; <del>import {get} from 'ember-metal/property_get'; <del>import { removeAt } from 'ember-runtime/mixins/mutable_array'; <add>import { SuiteModuleBuilder } from '../suite'; <add>import { get } from 'ember-metal'; <add>import { removeAt } from '../../../mixins/mutable_array'; <ide> <ide> const suite = SuiteModuleBuilder.create(); <ide> <ide><path>packages/ember-runtime/tests/suites/mutable_array/removeObject.js <del>import get from 'ember-metal/property_get'; <del>import { SuiteModuleBuilder } from 'ember-runtime/tests/suites/suite'; <add>import { get } from 'ember-metal'; <add>import { SuiteModuleBuilder } from '../suite'; <ide> <ide> const suite = SuiteModuleBuilder.create(); <ide> <ide><path>packages/ember-runtime/tests/suites/mutable_array/replace.js <del>import {SuiteModuleBuilder} from 'ember-runtime/tests/suites/suite'; <add>import { SuiteModuleBuilder } from '../suite'; <ide> <ide> const suite = SuiteModuleBuilder.create(); <ide> <ide><path>packages/ember-runtime/tests/suites/mutable_array/reverseObjects.js <del>import {SuiteModuleBuilder} from 'ember-runtime/tests/suites/suite'; <del>import {get} from 'ember-metal/property_get'; <add>import { SuiteModuleBuilder } from '../suite'; <add>import { get } from 'ember-metal'; <ide> <ide> const suite = SuiteModuleBuilder.create(); <ide> <ide><path>packages/ember-runtime/tests/suites/mutable_array/setObjects.js <del>import get from 'ember-metal/property_get'; <del>import { SuiteModuleBuilder } from 'ember-runtime/tests/suites/suite'; <add>import { get } from 'ember-metal'; <add>import { SuiteModuleBuilder } from '../suite'; <ide> <ide> const suite = SuiteModuleBuilder.create(); <ide> <ide><path>packages/ember-runtime/tests/suites/mutable_array/shiftObject.js <del>import {SuiteModuleBuilder} from 'ember-runtime/tests/suites/suite'; <del>import {get} from 'ember-metal/property_get'; <add>import { SuiteModuleBuilder } from '../suite'; <add>import { get } from 'ember-metal'; <ide> <ide> const suite = SuiteModuleBuilder.create(); <ide> <ide><path>packages/ember-runtime/tests/suites/mutable_array/unshiftObject.js <del>import {SuiteModuleBuilder} from 'ember-runtime/tests/suites/suite'; <del>import {get} from 'ember-metal/property_get'; <add>import { SuiteModuleBuilder } from '../suite'; <add>import { get } from 'ember-metal'; <ide> <ide> const suite = SuiteModuleBuilder.create(); <ide> <ide><path>packages/ember-runtime/tests/suites/mutable_array/unshiftObjects.js <del>import get from 'ember-metal/property_get'; <del>import { SuiteModuleBuilder } from 'ember-runtime/tests/suites/suite'; <add>import { get } from 'ember-metal'; <add>import { SuiteModuleBuilder } from '../suite'; <ide> <ide> const suite = SuiteModuleBuilder.create(); <ide> <ide><path>packages/ember-runtime/tests/suites/mutable_enumerable.js <del>import { EnumerableTests } from 'ember-runtime/tests/suites/enumerable'; <add>import { EnumerableTests } from './enumerable'; <ide> <del>import addObjectTests from 'ember-runtime/tests/suites/mutable_enumerable/addObject'; <del>import removeObjectTests from 'ember-runtime/tests/suites/mutable_enumerable/removeObject'; <del>import removeObjectsTests from 'ember-runtime/tests/suites/mutable_enumerable/removeObjects'; <add>import addObjectTests from './mutable_enumerable/addObject'; <add>import removeObjectTests from './mutable_enumerable/removeObject'; <add>import removeObjectsTests from './mutable_enumerable/removeObjects'; <ide> <ide> const MutableEnumerableTests = EnumerableTests.extend(); <ide> MutableEnumerableTests.importModuleTests(addObjectTests); <ide><path>packages/ember-runtime/tests/suites/mutable_enumerable/addObject.js <del>import {SuiteModuleBuilder} from 'ember-runtime/tests/suites/suite'; <del>import {get} from 'ember-metal/property_get'; <add>import { SuiteModuleBuilder } from '../suite'; <add>import { get } from 'ember-metal'; <ide> <ide> const suite = SuiteModuleBuilder.create(); <ide> <ide><path>packages/ember-runtime/tests/suites/mutable_enumerable/removeObject.js <del>import { get } from 'ember-metal/property_get'; <del>import { SuiteModuleBuilder } from 'ember-runtime/tests/suites/suite'; <del>import { A as emberA } from 'ember-runtime/system/native_array'; <add>import { get } from 'ember-metal'; <add>import { SuiteModuleBuilder } from '../suite'; <add>import { A as emberA } from '../../../system/native_array'; <ide> <ide> const suite = SuiteModuleBuilder.create(); <ide> <ide><path>packages/ember-runtime/tests/suites/mutable_enumerable/removeObjects.js <del>import { SuiteModuleBuilder } from 'ember-runtime/tests/suites/suite'; <del>import { get } from 'ember-metal/property_get'; <del>import { A as emberA } from 'ember-runtime/system/native_array'; <add>import { SuiteModuleBuilder } from '../suite'; <add>import { get } from 'ember-metal'; <add>import { A as emberA } from '../../../system/native_array'; <ide> <ide> const suite = SuiteModuleBuilder.create(); <ide> <ide><path>packages/ember-runtime/tests/suites/suite.js <del>import EmberObject from 'ember-runtime/system/object'; <del>import { <del> guidFor <del>} from 'ember-metal/utils'; <del>import { get } from 'ember-metal/property_get'; <add>import EmberObject from '../../system/object'; <add>import { guidFor, get } from 'ember-metal'; <ide> <ide> /* <ide> @class <ide><path>packages/ember-runtime/tests/system/application/base_test.js <del>import Namespace from 'ember-runtime/system/namespace'; <del>import Application from 'ember-runtime/system/application'; <add>import Namespace from '../../../system/namespace'; <add>import Application from '../../../system/application'; <ide> <ide> QUnit.module('Ember.Application'); <ide> <ide><path>packages/ember-runtime/tests/system/array_proxy/arranged_content_test.js <del>import run from 'ember-metal/run_loop'; <del>import { computed } from 'ember-metal/computed'; <del>import ArrayProxy from 'ember-runtime/system/array_proxy'; <del>import { A as emberA } from 'ember-runtime/system/native_array'; <del>import { objectAt } from 'ember-runtime/mixins/array'; <add>import { run, computed } from 'ember-metal'; <add>import ArrayProxy from '../../../system/array_proxy'; <add>import { A as emberA } from '../../../system/native_array'; <add>import { objectAt } from '../../../mixins/array'; <ide> <ide> let array; <ide> <ide><path>packages/ember-runtime/tests/system/array_proxy/content_change_test.js <del>import { set } from 'ember-metal/property_set'; <del>import { not } from 'ember-runtime/computed/computed_macros'; <del>import run from 'ember-metal/run_loop'; <del>import ArrayProxy from 'ember-runtime/system/array_proxy'; <del>import { A as emberA } from 'ember-runtime/system/native_array'; <add>import { set, run } from 'ember-metal'; <add>import { not } from '../../../computed/computed_macros'; <add>import ArrayProxy from '../../../system/array_proxy'; <add>import { A as emberA } from '../../../system/native_array'; <ide> <ide> QUnit.module('ArrayProxy - content change'); <ide> <ide><path>packages/ember-runtime/tests/system/array_proxy/content_update_test.js <del>import { computed } from 'ember-metal/computed'; <del>import ArrayProxy from 'ember-runtime/system/array_proxy'; <del>import { A as emberA } from 'ember-runtime/system/native_array'; <add>import { computed } from 'ember-metal'; <add>import ArrayProxy from '../../../system/array_proxy'; <add>import { A as emberA } from '../../../system/native_array'; <ide> <ide> QUnit.module('Ember.ArrayProxy - content update'); <ide> <ide><path>packages/ember-runtime/tests/system/array_proxy/length_test.js <del>import ArrayProxy from 'ember-runtime/system/array_proxy'; <del>import EmberObject from 'ember-runtime/system/object'; <del>import { observer } from 'ember-metal/mixin'; <del>import { computed } from 'ember-metal/computed'; <del>import { A as a } from 'ember-runtime/system/native_array'; <add>import ArrayProxy from '../../../system/array_proxy'; <add>import EmberObject from '../../../system/object'; <add>import { observer, computed } from 'ember-metal'; <add>import { A as a } from '../../../system/native_array'; <ide> <ide> QUnit.module('Ember.ArrayProxy - content change (length)'); <ide> <ide><path>packages/ember-runtime/tests/system/array_proxy/suite_test.js <del>import MutableArrayTests from 'ember-runtime/tests/suites/mutable_array'; <del>import ArrayProxy from 'ember-runtime/system/array_proxy'; <del>import { get } from 'ember-metal/property_get'; <del>import { A as emberA } from 'ember-runtime/system/native_array'; <add>import MutableArrayTests from '../../suites/mutable_array'; <add>import ArrayProxy from '../../../system/array_proxy'; <add>import { get } from 'ember-metal'; <add>import { A as emberA } from '../../../system/native_array'; <ide> <ide> MutableArrayTests.extend({ <ide> name: 'Ember.ArrayProxy', <ide><path>packages/ember-runtime/tests/system/array_proxy/watching_and_listening_test.js <del>import { get } from 'ember-metal/property_get'; <del>import { listenersFor } from 'ember-metal/events'; <del>import { addObserver } from 'ember-metal/observer'; <del>import { defineProperty } from 'ember-metal/properties'; <del>import { watcherCount } from 'ember-metal/watching'; <del>import computed from 'ember-metal/computed'; <del>import ArrayProxy from 'ember-runtime/system/array_proxy'; <del>import { A } from 'ember-runtime/system/native_array'; <add>import { <add> get, <add> listenersFor, <add> addObserver, <add> defineProperty, <add> watcherCount, <add> computed <add>} from 'ember-metal'; <add>import ArrayProxy from '../../../system/array_proxy'; <add>import { A } from '../../../system/native_array'; <ide> <ide> function sortedListenersFor(obj, eventName) { <ide> return listenersFor(obj, eventName).sort((listener1, listener2) => { <ide><path>packages/ember-runtime/tests/system/core_object_test.js <del>import CoreObject from 'ember-runtime/system/core_object'; <add>import CoreObject from '../../system/core_object'; <ide> <ide> <ide> QUnit.module('Ember.CoreObject'); <ide><path>packages/ember-runtime/tests/system/lazy_load_test.js <del>import run from 'ember-metal/run_loop'; <del>import {onLoad, runLoadHooks, _loaded } from 'ember-runtime/system/lazy_load'; <add>import { run } from 'ember-metal'; <add>import { onLoad, runLoadHooks, _loaded } from '../../system/lazy_load'; <ide> <ide> QUnit.module('Lazy Loading', { <ide> teardown() { <ide><path>packages/ember-runtime/tests/system/namespace/base_test.js <ide> import { context } from 'ember-environment'; <del>import run from 'ember-metal/run_loop'; <del>import {get} from 'ember-metal/property_get'; <del>import EmberObject from 'ember-runtime/system/object'; <add>import { run, get } from 'ember-metal'; <add>import EmberObject from '../../../system/object'; <ide> import Namespace, { <ide> setSearchDisabled as setNamespaceSearchDisabled <del>} from 'ember-runtime/system/namespace'; <add>} from '../../../system/namespace'; <ide> <ide> const originalLookup = context.lookup; <ide> let lookup; <ide><path>packages/ember-runtime/tests/system/native_array/a_test.js <del>import EmberArray from 'ember-runtime/mixins/array'; <del>import { A } from 'ember-runtime/system/native_array'; <add>import EmberArray from '../../../mixins/array'; <add>import { A } from '../../../system/native_array'; <ide> <ide> QUnit.module('Ember.A'); <ide> <ide><path>packages/ember-runtime/tests/system/native_array/copyable_suite_test.js <del>import { generateGuid } from 'ember-metal/utils'; <del>import { A as emberA } from 'ember-runtime/system/native_array'; <del>import CopyableTests from 'ember-runtime/tests/suites/copyable'; <add>import { generateGuid } from 'ember-metal'; <add>import { A as emberA } from '../../../system/native_array'; <add>import CopyableTests from '../../suites/copyable'; <ide> <ide> CopyableTests.extend({ <ide> name: 'NativeArray Copyable', <ide><path>packages/ember-runtime/tests/system/native_array/suite_test.js <del>import { A as emberA } from 'ember-runtime/system/native_array'; <del>import MutableArrayTests from 'ember-runtime/tests/suites/mutable_array'; <add>import { A as emberA } from '../../../system/native_array'; <add>import MutableArrayTests from '../../suites/mutable_array'; <ide> <ide> MutableArrayTests.extend({ <ide> name: 'Native Array', <ide><path>packages/ember-runtime/tests/system/object/computed_test.js <del>import alias from 'ember-metal/alias'; <del>import { computed } from 'ember-metal/computed'; <del>import { get as emberGet } from 'ember-metal/property_get'; <del>import { observer } from 'ember-metal/mixin'; <del>import { testWithDefault } from 'ember-metal/tests/props_helper'; <del>import EmberObject from 'ember-runtime/system/object'; <add>import { <add> alias, <add> computed, <add> get as emberGet, <add> observer <add>} from 'ember-metal'; <add>import { testWithDefault } from 'internal-test-helpers'; <add>import EmberObject from '../../../system/object'; <ide> <ide> function K() { return this; } <ide> <ide><path>packages/ember-runtime/tests/system/object/create_test.js <del>import isEnabled from 'ember-metal/features'; <del>import { meta } from 'ember-metal/meta'; <del>import { computed } from 'ember-metal/computed'; <del>import { Mixin, observer } from 'ember-metal/mixin'; <del>import EmberObject from 'ember-runtime/system/object'; <add>import { <add> isFeatureEnabled, <add> meta, <add> computed, <add> Mixin, <add> observer <add>} from 'ember-metal'; <add>import EmberObject from '../../../system/object'; <ide> <ide> QUnit.module('EmberObject.create', {}); <ide> <ide> QUnit.test('calls computed property setters', function() { <ide> equal(o.get('foo'), 'bar'); <ide> }); <ide> <del>if (isEnabled('mandatory-setter')) { <add>if (isFeatureEnabled('mandatory-setter')) { <ide> QUnit.test('sets up mandatory setters for watched simple properties', function() { <ide> let MyClass = EmberObject.extend({ <ide> foo: null, <ide><path>packages/ember-runtime/tests/system/object/destroy_test.js <del>import isEnabled from 'ember-metal/features'; <del>import run from 'ember-metal/run_loop'; <del>import { observer } from 'ember-metal/mixin'; <del>import { set } from 'ember-metal/property_set'; <del>import { bind } from 'ember-metal/binding'; <ide> import { <add> isFeatureEnabled, <add> run, <add> observer, <add> set, <add> bind, <ide> beginPropertyChanges, <del> endPropertyChanges <del>} from 'ember-metal/property_events'; <del>import { testBoth } from 'ember-metal/tests/props_helper'; <del>import EmberObject from 'ember-runtime/system/object'; <del>import { peekMeta } from 'ember-metal/meta'; <add> endPropertyChanges, <add> peekMeta <add>} from 'ember-metal'; <add>import { testBoth } from 'internal-test-helpers'; <add>import EmberObject from '../../../system/object'; <ide> QUnit.module('ember-runtime/system/object/destroy_test'); <ide> <ide> testBoth('should schedule objects to be destroyed at the end of the run loop', function(get, set) { <ide> testBoth('should schedule objects to be destroyed at the end of the run loop', f <ide> ok(get(obj, 'isDestroyed'), 'object is destroyed after run loop finishes'); <ide> }); <ide> <del>if (isEnabled('mandatory-setter')) { <add>if (isFeatureEnabled('mandatory-setter')) { <ide> // MANDATORY_SETTER moves value to meta.values <ide> // a destroyed object removes meta but leaves the accessor <ide> // that looks it up <ide><path>packages/ember-runtime/tests/system/object/detectInstance_test.js <del>import EmberObject from 'ember-runtime/system/object'; <add>import EmberObject from '../../../system/object'; <ide> <ide> QUnit.module('system/object/detectInstance'); <ide> <ide><path>packages/ember-runtime/tests/system/object/detect_test.js <del>import EmberObject from 'ember-runtime/system/object'; <add>import EmberObject from '../../../system/object'; <ide> <ide> QUnit.module('system/object/detect'); <ide> <ide><path>packages/ember-runtime/tests/system/object/events_test.js <del>import EmberObject from 'ember-runtime/system/object'; <del>import Evented from 'ember-runtime/mixins/evented'; <add>import EmberObject from '../../../system/object'; <add>import Evented from '../../../mixins/evented'; <ide> <ide> QUnit.module('Object events'); <ide> <ide><path>packages/ember-runtime/tests/system/object/extend_test.js <del>import {get} from 'ember-metal/property_get'; <del>import EmberObject from 'ember-runtime/system/object'; <add>import { get } from 'ember-metal'; <add>import EmberObject from '../../../system/object'; <ide> <ide> QUnit.module('EmberObject.extend'); <ide> <ide><path>packages/ember-runtime/tests/system/object/observer_test.js <del>import { observer } from 'ember-metal/mixin'; <del>import run from 'ember-metal/run_loop'; <del>import { testBoth } from 'ember-metal/tests/props_helper'; <del>import EmberObject from 'ember-runtime/system/object'; <add>import { observer, run } from 'ember-metal'; <add>import { testBoth } from 'internal-test-helpers'; <add>import EmberObject from '../../../system/object'; <ide> <ide> QUnit.module('EmberObject observer'); <ide> <ide><path>packages/ember-runtime/tests/system/object/reopenClass_test.js <del>import {get} from 'ember-metal/property_get'; <del>import EmberObject from 'ember-runtime/system/object'; <add>import { get } from 'ember-metal'; <add>import EmberObject from '../../../system/object'; <ide> <ide> QUnit.module('system/object/reopenClass'); <ide> <ide><path>packages/ember-runtime/tests/system/object/reopen_test.js <del>import {get} from 'ember-metal/property_get'; <del>import EmberObject from 'ember-runtime/system/object'; <add>import { get } from 'ember-metal'; <add>import EmberObject from '../../../system/object'; <ide> <ide> QUnit.module('system/core_object/reopen'); <ide> <ide><path>packages/ember-runtime/tests/system/object/strict-mode-test.js <del>import EmberObject from 'ember-runtime/system/object'; <add>import EmberObject from '../../../system/object'; <ide> <ide> QUnit.module('strict mode tests'); <ide> <ide><path>packages/ember-runtime/tests/system/object/subclasses_test.js <del>import run from 'ember-metal/run_loop'; <del>import {computed} from 'ember-metal/computed'; <del>import EmberObject from 'ember-runtime/system/object'; <add>import { run, computed } from 'ember-metal'; <add>import EmberObject from '../../../system/object'; <ide> <ide> QUnit.module('system/object/subclasses'); <ide> <ide><path>packages/ember-runtime/tests/system/object/toString_test.js <del>import {context} from 'ember-environment'; <del>import {guidFor, GUID_KEY} from 'ember-metal/utils'; <del>import EmberObject from 'ember-runtime/system/object'; <del>import Namespace from 'ember-runtime/system/namespace'; <add>import { context } from 'ember-environment'; <add>import { guidFor, GUID_KEY } from 'ember-metal'; <add>import EmberObject from '../../../system/object'; <add>import Namespace from '../../../system/namespace'; <ide> <ide> let originalLookup = context.lookup; <ide> let lookup; <ide><path>packages/ember-runtime/tests/system/object_proxy_test.js <del>import { addObserver, removeObserver } from 'ember-metal/observer'; <del>import { computed } from 'ember-metal/computed'; <del>import { isWatching } from 'ember-metal/watching'; <del>import { testBoth } from 'ember-metal/tests/props_helper'; <del>import ObjectProxy from 'ember-runtime/system/object_proxy'; <add>import { <add> addObserver, <add> removeObserver, <add> computed, <add> isWatching <add>} from 'ember-metal'; <add>import { testBoth } from 'internal-test-helpers'; <add>import ObjectProxy from '../../system/object_proxy'; <ide> <ide> QUnit.module('ObjectProxy'); <ide> <ide><path>packages/ember-runtime/tests/system/string/camelize_test.js <ide> import { ENV } from 'ember-environment'; <del>import { camelize } from 'ember-runtime/system/string'; <add>import { camelize } from '../../../system/string'; <ide> <ide> QUnit.module('EmberStringUtils.camelize'); <ide> <ide><path>packages/ember-runtime/tests/system/string/capitalize_test.js <ide> import { ENV } from 'ember-environment'; <del>import { capitalize } from 'ember-runtime/system/string'; <add>import { capitalize } from '../../../system/string'; <ide> <ide> QUnit.module('EmberStringUtils.capitalize'); <ide> <ide><path>packages/ember-runtime/tests/system/string/classify_test.js <ide> import { ENV } from 'ember-environment'; <del>import { classify } from 'ember-runtime/system/string'; <add>import { classify } from '../../../system/string'; <ide> <ide> QUnit.module('EmberStringUtils.classify'); <ide> <ide><path>packages/ember-runtime/tests/system/string/dasherize_test.js <ide> import { ENV } from 'ember-environment'; <del>import { dasherize } from 'ember-runtime/system/string'; <add>import { dasherize } from '../../../system/string'; <ide> <ide> QUnit.module('EmberStringUtils.dasherize'); <ide> <ide><path>packages/ember-runtime/tests/system/string/decamelize_test.js <ide> import { ENV } from 'ember-environment'; <del>import { decamelize } from 'ember-runtime/system/string'; <add>import { decamelize } from '../../../system/string'; <ide> <ide> QUnit.module('EmberStringUtils.decamelize'); <ide> <ide><path>packages/ember-runtime/tests/system/string/fmt_string_test.js <ide> import { ENV } from 'ember-environment'; <del>import { fmt } from 'ember-runtime/system/string'; <add>import { fmt } from '../../../system/string'; <ide> <ide> QUnit.module('EmberStringUtils.fmt'); <ide> <ide><path>packages/ember-runtime/tests/system/string/loc_test.js <del>import Ember from 'ember-metal/core'; // ES6TODO Ember.STRINGS <add>import Ember from 'ember-metal'; // ES6TODO Ember.STRINGS <ide> import { ENV } from 'ember-environment'; <del>import { loc } from 'ember-runtime/system/string'; <add>import { loc } from '../../../system/string'; <ide> <ide> let oldString; <ide> <ide><path>packages/ember-runtime/tests/system/string/underscore_test.js <ide> import { ENV } from 'ember-environment'; <del>import { underscore } from 'ember-runtime/system/string'; <add>import { underscore } from '../../../system/string'; <ide> <ide> QUnit.module('EmberStringUtils.underscore'); <ide> <ide><path>packages/ember-runtime/tests/system/string/w_test.js <ide> import { ENV } from 'ember-environment'; <del>import { w } from 'ember-runtime/system/string'; <add>import { w } from '../../../system/string'; <ide> <ide> QUnit.module('EmberStringUtils.w'); <ide> <ide><path>packages/ember-runtime/tests/utils.js <del>import run from 'ember-metal/run_loop'; <add>import { run } from 'ember-metal'; <ide> <ide> function runAppend(view) { <ide> run(view, 'appendTo', '#qunit-fixture');
122
PHP
PHP
remove redundant tests around debug()
9e227f5ba189ef1faff23b7bc614e109e1f76352
<ide><path>src/Error/Debug/ConsoleFormatter.php <ide> public static function environmentMatches(): bool <ide> } <ide> <ide> /** <del> * {@inheritDoc} <add> * @inheritDoc <ide> */ <del> public function formatWrapper(string $contents, array $location) <add> public function formatWrapper(string $contents, array $location): string <ide> { <ide> $lineInfo = ''; <ide> if (isset($location['file'], $location['file'])) { <ide><path>src/Error/Debug/FormatterInterface.php <ide> public function dump(NodeInterface $node): string; <ide> * @param array $location The file and line the contents came from. <ide> * @return string <ide> */ <del> public function formatWrapper(string $contents, array $location); <add> public function formatWrapper(string $contents, array $location): string; <ide> } <ide><path>src/Error/Debug/HtmlFormatter.php <ide> public static function environmentMatches(): bool <ide> } <ide> <ide> /** <del> * {@inheritDoc} <add> * @inheritDoc <ide> */ <del> public function formatWrapper(string $contents, array $location) <add> public function formatWrapper(string $contents, array $location): string <ide> { <ide> $lineInfo = ''; <ide> if (isset($location['file'], $location['file'])) { <ide><path>src/Error/Debug/TextFormatter.php <ide> class TextFormatter implements FormatterInterface <ide> { <ide> /** <del> * {@inheritDoc} <add> * @inheritDoc <ide> */ <del> public function formatWrapper(string $contents, array $location) <add> public function formatWrapper(string $contents, array $location): string <ide> { <ide> $template = <<<TEXT <ide> %s <ide><path>src/Error/Debugger.php <ide> public static function getType($var): string <ide> * @param array $location If contains keys "file" and "line" their values will <ide> * be used to show location info. <ide> * @param bool|null $showHtml If set to true, the method prints the debug <del> * data in a browser-friendly way. <add> * data encoded as HTML. If false, plain text formatting will be used. <add> * If null, the format will be chosen based on the configured exportFormatter, or <add> * environment conditions. <ide> * @return void <ide> */ <ide> public static function printVar($var, array $location = [], ?bool $showHtml = null): void <ide><path>tests/TestCase/BasicsTest.php <ide> namespace Cake\Test\TestCase; <ide> <ide> use Cake\Collection\Collection; <add>use Cake\Error\Debugger; <ide> use Cake\Event\EventManager; <ide> use Cake\Http\Response; <ide> use Cake\TestSuite\TestCase; <ide> public function testDebug() <ide> ########################### <ide> <ide> EXPECTED; <del> $expected = sprintf($expectedText, str_replace(CAKE_CORE_INCLUDE_PATH, '', __FILE__), __LINE__ - 9); <add> $expected = sprintf($expectedText, Debugger::trimPath(__FILE__), __LINE__ - 9); <ide> <ide> $this->assertSame($expected, $result); <ide> <ide> ob_start(); <ide> $value = '<div>this-is-a-test</div>'; <ide> $this->assertSame($value, debug($value, true)); <ide> $result = ob_get_clean(); <del> $expectedHtml = <<<EXPECTED <del><div class="cake-debug-output" style="direction:ltr"> <del><span><strong>%s</strong> (line <strong>%d</strong>)</span> <del><pre class="cake-debug"> <del>&#039;&lt;div&gt;this-is-a-test&lt;/div&gt;&#039; <del></pre> <del></div> <del>EXPECTED; <del> $expected = sprintf($expectedHtml, str_replace(CAKE_CORE_INCLUDE_PATH, '', __FILE__), __LINE__ - 10); <del> $this->assertSame($expected, $result); <add> $this->assertStringContainsString('<div class="cake-debug-output', $result); <add> $this->assertStringContainsString('this-is-a-test', $result); <ide> <ide> ob_start(); <ide> debug('<div>this-is-a-test</div>', true, true); <ide> $result = ob_get_clean(); <ide> $expected = <<<EXPECTED <del><div class="cake-debug-output" style="direction:ltr"> <add><div class="cake-debug-output cake-debug" style="direction:ltr"> <ide> <span><strong>%s</strong> (line <strong>%d</strong>)</span> <del><pre class="cake-debug"> <del>&#039;&lt;div&gt;this-is-a-test&lt;/div&gt;&#039; <del></pre> <del></div> <ide> EXPECTED; <del> $expected = sprintf($expected, str_replace(CAKE_CORE_INCLUDE_PATH, '', __FILE__), __LINE__ - 10); <del> $this->assertSame($expected, $result); <add> $expected = sprintf($expected, Debugger::trimPath(__FILE__), __LINE__ - 6); <add> $this->assertStringContainsString($expected, $result); <ide> <ide> ob_start(); <ide> debug('<div>this-is-a-test</div>', true, false); <ide> $result = ob_get_clean(); <del> $expected = <<<EXPECTED <del><div class="cake-debug-output" style="direction:ltr"> <del> <del><pre class="cake-debug"> <del>&#039;&lt;div&gt;this-is-a-test&lt;/div&gt;&#039; <del></pre> <del></div> <del>EXPECTED; <del> $expected = sprintf($expected, str_replace(CAKE_CORE_INCLUDE_PATH, '', __FILE__), __LINE__ - 10); <del> $this->assertSame($expected, $result); <del> <del> ob_start(); <del> debug('<div>this-is-a-test</div>', null); <del> $result = ob_get_clean(); <del> $expectedHtml = <<<EXPECTED <del><div class="cake-debug-output" style="direction:ltr"> <del><span><strong>%s</strong> (line <strong>%d</strong>)</span> <del><pre class="cake-debug"> <del>&#039;&lt;div&gt;this-is-a-test&lt;/div&gt;&#039; <del></pre> <del></div> <del>EXPECTED; <del> $expectedText = <<<EXPECTED <del>%s (line %d) <del>########## DEBUG ########## <del>'<div>this-is-a-test</div>' <del>########################### <del> <del>EXPECTED; <del> if ((PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg')) { <del> $expected = sprintf($expectedText, str_replace(CAKE_CORE_INCLUDE_PATH, '', __FILE__), __LINE__ - 18); <del> } else { <del> $expected = sprintf($expectedHtml, str_replace(CAKE_CORE_INCLUDE_PATH, '', __FILE__), __LINE__ - 19); <del> } <del> $this->assertSame($expected, $result); <del> <del> ob_start(); <del> debug('<div>this-is-a-test</div>', null, false); <del> $result = ob_get_clean(); <del> $expectedHtml = <<<EXPECTED <del><div class="cake-debug-output" style="direction:ltr"> <del> <del><pre class="cake-debug"> <del>&#039;&lt;div&gt;this-is-a-test&lt;/div&gt;&#039; <del></pre> <del></div> <del>EXPECTED; <del> $expectedText = <<<EXPECTED <del> <del>########## DEBUG ########## <del>'<div>this-is-a-test</div>' <del>########################### <del> <del>EXPECTED; <del> if ((PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg')) { <del> $expected = sprintf($expectedText, str_replace(CAKE_CORE_INCLUDE_PATH, '', __FILE__), __LINE__ - 18); <del> } else { <del> $expected = sprintf($expectedHtml, str_replace(CAKE_CORE_INCLUDE_PATH, '', __FILE__), __LINE__ - 19); <del> } <del> $this->assertSame($expected, $result); <del> <del> ob_start(); <del> debug('<div>this-is-a-test</div>', false); <del> $result = ob_get_clean(); <del> $expected = <<<EXPECTED <del>%s (line %d) <del>########## DEBUG ########## <del>'<div>this-is-a-test</div>' <del>########################### <del> <del>EXPECTED; <del> $expected = sprintf($expected, str_replace(CAKE_CORE_INCLUDE_PATH, '', __FILE__), __LINE__ - 9); <del> $this->assertSame($expected, $result); <del> <del> ob_start(); <del> debug('<div>this-is-a-test</div>', false, true); <del> $result = ob_get_clean(); <del> $expected = <<<EXPECTED <del>%s (line %d) <del>########## DEBUG ########## <del>'<div>this-is-a-test</div>' <del>########################### <del> <del>EXPECTED; <del> $expected = sprintf($expected, str_replace(CAKE_CORE_INCLUDE_PATH, '', __FILE__), __LINE__ - 9); <del> $this->assertSame($expected, $result); <del> <del> ob_start(); <del> debug('<div>this-is-a-test</div>', false, false); <del> $result = ob_get_clean(); <del> $expected = <<<EXPECTED <del> <del>########## DEBUG ########## <del>'<div>this-is-a-test</div>' <del>########################### <del> <del>EXPECTED; <del> $expected = sprintf($expected, str_replace(CAKE_CORE_INCLUDE_PATH, '', __FILE__), __LINE__ - 9); <del> $this->assertSame($expected, $result); <del> <del> ob_start(); <del> $this->assertFalse(debug(false, false, false)); <del> $result = ob_get_clean(); <del> $expected = <<<EXPECTED <del> <del>########## DEBUG ########## <del>false <del>########################### <del> <del>EXPECTED; <del> $expected = sprintf($expected, str_replace(CAKE_CORE_INCLUDE_PATH, '', __FILE__), __LINE__ - 9); <del> $this->assertSame($expected, $result); <add> $this->assertStringNotContainsString('(line', $result); <ide> } <ide> <ide> /**
6
Javascript
Javascript
remove support for a watch action to be a string
02c0ed27bc375d5352fefdd7e34aad9758621283
<ide><path>src/ng/rootScope.js <ide> function $RootScopeProvider(){ <ide> * <ide> * - `string`: Evaluated as {@link guide/expression expression} <ide> * - `function(scope)`: called with current `scope` as a parameter. <del> * @param {(function()|string)=} listener Callback called whenever the return value of <add> * @param {function()=} listener Callback called whenever the return value of <ide> * the `watchExpression` changes. <ide> * <ide> * - `string`: Evaluated as {@link guide/expression expression} <ide> function $RootScopeProvider(){ <ide> <ide> lastDirtyWatch = null; <ide> <del> // in the case user pass string, we need to compile it, do we really need this ? <ide> if (!isFunction(listener)) { <del> var listenFn = compileToFn(listener || noop, 'listener'); <del> watcher.fn = function(newVal, oldVal, scope) {listenFn(scope);}; <add> watcher.fn = noop; <ide> } <ide> <ide> if (!array) { <ide><path>test/BinderSpec.js <ide> describe('Binder', function() { <ide> it('ItShouldFireChangeListenersBeforeUpdate', inject(function($rootScope, $compile) { <ide> element = $compile('<div ng-bind="name"></div>')($rootScope); <ide> $rootScope.name = ''; <del> $rootScope.$watch('watched', 'name=123'); <add> $rootScope.$watch('watched', function () { <add> $rootScope.name = 123; <add> }); <ide> $rootScope.watched = 'change'; <ide> $rootScope.$apply(); <ide> expect($rootScope.name).toBe(123); <ide><path>test/ng/rootScopeSpec.js <ide> describe('Scope', function() { <ide> it('should cause a $digest rerun', inject(function($rootScope) { <ide> $rootScope.log = ''; <ide> $rootScope.value = 0; <del> $rootScope.$watch('value', 'log = log + ".";'); <add> $rootScope.$watch('value', function () { <add> $rootScope.log = $rootScope.log + "."; <add> }); <ide> $rootScope.$watch('init', function() { <ide> $rootScope.$evalAsync('value = 123; log = log + "=" '); <ide> expect($rootScope.value).toEqual(0);
3
Python
Python
allow default values in writable serializer fields
d6d5b1d82a4ccc1a2fe29ff18e9ecf7c196a07a5
<ide><path>rest_framework/serializers.py <ide> def field_from_native(self, data, files, field_name, into): <ide> except KeyError: <ide> if self.required: <ide> raise ValidationError(self.error_messages['required']) <del> return <add> if self.default is None: <add> return <add> value = copy.deepcopy(self.default) <ide> <ide> # Set the serializer object if it exists <ide> obj = getattr(self.parent.object, field_name) if self.parent.object else None
1
Ruby
Ruby
get all the callback tests to work on new base
196f780e30fcece25e4d09c12f9b9f7374ebed29
<ide><path>actionpack/lib/action_controller/abstract/callbacks.rb <ide> def _normalize_callback_options(options) <ide> end <ide> end <ide> <add> def skip_filter(*names, &blk) <add> skip_before_filter(*names, &blk) <add> skip_after_filter(*names, &blk) <add> skip_around_filter(*names, &blk) <add> end <add> <ide> [:before, :after, :around].each do |filter| <ide> class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1 <ide> def #{filter}_filter(*names, &blk) <ide><path>actionpack/test/controller/filters_test.rb <ide> def find_user <ide> end <ide> <ide> class ConditionalParentOfConditionalSkippingController < ConditionalFilterController <del> before_filter :conditional_in_parent, :only => [:show, :another_action] <del> after_filter :conditional_in_parent, :only => [:show, :another_action] <add> before_filter :conditional_in_parent_before, :only => [:show, :another_action] <add> after_filter :conditional_in_parent_after, :only => [:show, :another_action] <ide> <ide> private <ide> <del> def conditional_in_parent <add> def conditional_in_parent_before <ide> @ran_filter ||= [] <del> @ran_filter << 'conditional_in_parent' <add> @ran_filter << 'conditional_in_parent_before' <add> end <add> <add> def conditional_in_parent_after <add> @ran_filter ||= [] <add> @ran_filter << 'conditional_in_parent_after' <ide> end <ide> end <ide> <ide> class ChildOfConditionalParentController < ConditionalParentOfConditionalSkippingController <del> skip_before_filter :conditional_in_parent, :only => :another_action <del> skip_after_filter :conditional_in_parent, :only => :another_action <add> skip_before_filter :conditional_in_parent_before, :only => :another_action <add> skip_after_filter :conditional_in_parent_after, :only => :another_action <ide> end <ide> <ide> class AnotherChildOfConditionalParentController < ConditionalParentOfConditionalSkippingController <del> skip_before_filter :conditional_in_parent, :only => :show <add> skip_before_filter :conditional_in_parent_before, :only => :show <ide> end <ide> <ide> class ProcController < PrependingController <ide> def test_having_properties_in_around_filter <ide> assert_equal "before and after", assigns["execution_log"] <ide> end <ide> <del> def test_prepending_and_appending_around_filter <del> controller = test_process(MixedFilterController) <del> assert_equal " before aroundfilter before procfilter before appended aroundfilter " + <del> " after appended aroundfilter after aroundfilter after procfilter ", <del> MixedFilterController.execution_log <add> for_tag(:old_base) do <add> def test_prepending_and_appending_around_filter <add> controller = test_process(MixedFilterController) <add> assert_equal " before aroundfilter before procfilter before appended aroundfilter " + <add> " after appended aroundfilter after aroundfilter after procfilter ", <add> MixedFilterController.execution_log <add> end <add> end <add> <add> for_tag(:new_base) do <add> def test_prepending_and_appending_around_filter <add> controller = test_process(MixedFilterController) <add> assert_equal " before aroundfilter before procfilter before appended aroundfilter " + <add> " after appended aroundfilter after procfilter after aroundfilter ", <add> MixedFilterController.execution_log <add> end <ide> end <ide> <ide> def test_rendering_breaks_filtering_chain <ide> def test_conditional_skipping_of_filters <ide> <ide> def test_conditional_skipping_of_filters_when_parent_filter_is_also_conditional <ide> test_process(ChildOfConditionalParentController) <del> assert_equal %w( conditional_in_parent conditional_in_parent ), assigns['ran_filter'] <add> assert_equal %w( conditional_in_parent_before conditional_in_parent_after ), assigns['ran_filter'] <ide> test_process(ChildOfConditionalParentController, 'another_action') <ide> assert_nil assigns['ran_filter'] <ide> end <ide> <ide> def test_condition_skipping_of_filters_when_siblings_also_have_conditions <ide> test_process(ChildOfConditionalParentController) <del> assert_equal %w( conditional_in_parent conditional_in_parent ), assigns['ran_filter'], "1" <add> assert_equal %w( conditional_in_parent_before conditional_in_parent_after ), assigns['ran_filter'] <ide> test_process(AnotherChildOfConditionalParentController) <del> assert_equal nil, assigns['ran_filter'] <add> assert_equal %w( conditional_in_parent_after ), assigns['ran_filter'] <ide> test_process(ChildOfConditionalParentController) <del> assert_equal %w( conditional_in_parent conditional_in_parent ), assigns['ran_filter'] <add> assert_equal %w( conditional_in_parent_before conditional_in_parent_after ), assigns['ran_filter'] <ide> end <ide> <ide> def test_changing_the_requirements <ide> def around_again <ide> end <ide> <ide> class ControllerWithTwoLessFilters < ControllerWithAllTypesOfFilters <add> $vbf = true <ide> skip_filter :around_again <add> $vbf = false <ide> skip_filter :after <ide> end <ide> <ide> def test_nested_filters <ide> end <ide> end <ide> <del> def test_filter_order_with_all_filter_types <del> test_process(ControllerWithAllTypesOfFilters,'no_raise') <del> assert_equal 'before around (before yield) around_again (before yield) around_again (after yield) around (after yield) after', assigns['ran_filter'].join(' ') <add> for_tag(:old_base) do <add> def test_filter_order_with_all_filter_types <add> test_process(ControllerWithAllTypesOfFilters,'no_raise') <add> assert_equal 'before around (before yield) around_again (before yield) around_again (after yield) around (after yield) after', assigns['ran_filter'].join(' ') <add> end <add> end <add> <add> for_tag(:new_base) do <add> def test_filter_order_with_all_filter_types <add> test_process(ControllerWithAllTypesOfFilters,'no_raise') <add> assert_equal 'before around (before yield) around_again (before yield) around_again (after yield) after around (after yield)', assigns['ran_filter'].join(' ') <add> end <ide> end <ide> <ide> def test_filter_order_with_skip_filter_method <ide> def test_first_filter_in_multiple_before_filter_chain_halts <ide> response = test_process(controller, 'fail_1') <ide> assert_equal ' ', response.body <ide> assert_equal 1, controller.instance_variable_get(:@try) <del> assert controller.instance_variable_get(:@before_filter_chain_aborted) <ide> end <ide> <ide> def test_second_filter_in_multiple_before_filter_chain_halts <ide> controller = ::FilterTest::TestMultipleFiltersController.new <ide> response = test_process(controller, 'fail_2') <ide> assert_equal ' ', response.body <ide> assert_equal 2, controller.instance_variable_get(:@try) <del> assert controller.instance_variable_get(:@before_filter_chain_aborted) <ide> end <ide> <ide> def test_last_filter_in_multiple_before_filter_chain_halts <ide> controller = ::FilterTest::TestMultipleFiltersController.new <ide> response = test_process(controller, 'fail_3') <ide> assert_equal ' ', response.body <ide> assert_equal 3, controller.instance_variable_get(:@try) <del> assert controller.instance_variable_get(:@before_filter_chain_aborted) <ide> end <ide> <ide> protected <ide><path>activesupport/lib/active_support/new_callbacks.rb <ide> def _compile_filter(filter) <ide> filter <ide> when Proc <ide> @klass.send(:define_method, method_name, &filter) <del> method_name << (filter.arity == 1 ? "(self)" : "") <add> method_name << case filter.arity <add> when 1 <add> "(self)" <add> when 2 <add> " self, Proc.new " <add> else <add> "" <add> end <ide> when Method <ide> @klass.send(:define_method, "#{method_name}_method") { filter } <ide> @klass.class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1 <ide> module ClassMethods <ide> # The _run_save_callbacks method can optionally take a key, which <ide> # will be used to compile an optimized callback method for each <ide> # key. See #define_callbacks for more information. <del> def _define_runner(symbol, str, options) <add> def _define_runner(symbol, str, options) <ide> str = <<-RUBY_EVAL <ide> def _run_#{symbol}_callbacks(key = nil) <ide> if key <ide> def self.skip_#{symbol}_callback(*filters, &blk) <ide> <ide> filter = self._#{symbol}_callbacks.find {|c| c.matches?(type, :#{symbol}, filter) } <ide> per_key = options[:per_key] || {} <del> if filter <add> if filter && options.any? <ide> filter.recompile!(options, per_key) <ide> else <ide> self._#{symbol}_callbacks.delete(filter)
3
Python
Python
remove redundant parentheses from python files
75071831baa936d292354f98aac46cd808a4b2b8
<ide><path>airflow/providers/exasol/hooks/exasol.py <ide> def set_autocommit(self, conn, autocommit: bool) -> None: <ide> """ <ide> if not self.supports_autocommit and autocommit: <ide> self.log.warning( <del> "%s connection doesn't support " "autocommit but autocommit activated.", <add> "%s connection doesn't support autocommit but autocommit activated.", <ide> getattr(self, self.conn_name_attr), <ide> ) <ide> conn.set_autocommit(autocommit) <ide><path>airflow/providers/google/cloud/hooks/bigquery.py <ide> def var_print(var_name): <ide> <ide> if table_input.count('.') + table_input.count(':') > 3: <ide> raise Exception( <del> ('{var}Use either : or . to specify project ' 'got {input}').format( <del> var=var_print(var_name), input=table_input <del> ) <add> '{var}Use either : or . to specify project ' <add> 'got {input}'.format(var=var_print(var_name), input=table_input) <ide> ) <ide> cmpt = table_input.rsplit(':', 1) <ide> project_id = None <ide> def var_print(var_name): <ide> rest = cmpt[1] <ide> else: <ide> raise Exception( <del> ('{var}Expect format of (<project:)<dataset>.<table>, ' 'got {input}').format( <del> var=var_print(var_name), input=table_input <del> ) <add> '{var}Expect format of (<project:)<dataset>.<table>, ' <add> 'got {input}'.format(var=var_print(var_name), input=table_input) <ide> ) <ide> <ide> cmpt = rest.split('.') <ide> def var_print(var_name): <ide> table_id = cmpt[1] <ide> else: <ide> raise Exception( <del> ('{var}Expect format of (<project.|<project:)<dataset>.<table>, ' 'got {input}').format( <del> var=var_print(var_name), input=table_input <del> ) <add> '{var}Expect format of (<project.|<project:)<dataset>.<table>, ' <add> 'got {input}'.format(var=var_print(var_name), input=table_input) <ide> ) <ide> <ide> if project_id is None:
2
Text
Text
update readme to init the submodule
ceda6aada8b90d58a17c5d132ddd4885aecc6e62
<ide><path>README.md <ide> To get a local copy of the current code, clone it using git: <ide> <ide> $ git clone git://github.com/mozilla/pdf.js.git pdfjs <ide> $ cd pdfjs <add> $ git submodule init <add> $ git submodule update <ide> <ide> Next, you need to start a local web server as some browsers don't allow opening <ide> PDF files for a file:// url:
1
Javascript
Javascript
restore es5 compatibility
e8087eccdb65465d36bea483e208db526188e575
<ide><path>Libraries/YellowBox/YellowBox.js <ide> if (__DEV__) { <ide> } <ide> }; <ide> <del> function registerWarning(...args): void { <add> const registerWarning = (...args): void => { <ide> YellowBoxRegistry.add({args, framesToPop: 2}); <del> } <add> }; <ide> } else { <del> // eslint-disable-next-line no-shadow <del> YellowBox = class YellowBox extends React.Component<Props> { <add> YellowBox = class extends React.Component<Props> { <ide> static ignoreWarnings(patterns: $ReadOnlyArray<string>): void { <ide> // Do nothing. <ide> }
1
Python
Python
add test for require, stop making extra copies
e744b031c20a9ca8fd550f2c51637cdbc8a40307
<ide><path>numpy/core/numeric.py <ide> def require(a, dtype=None, requirements=None): <ide> a : array_like <ide> The object to be converted to a type-and-requirement-satisfying array. <ide> dtype : data-type <del> The required data-type, the default data-type is float64). <add> The required data-type. If None preserve the current dtype. If your <add> application requires the data to be in native byteorder, include <add> a byteorder specification as a part of the dtype specification. <ide> requirements : str or list of str <ide> The requirements list can be any of the following <ide> <ide> def require(a, dtype=None, requirements=None): <ide> * 'ALIGNED' ('A') - ensure a data-type aligned array <ide> * 'WRITEABLE' ('W') - ensure a writable array <ide> * 'OWNDATA' ('O') - ensure an array that owns its own data <add> * 'ENSUREARRAY', ('E') - ensure a base array, instead of a subclass <ide> <ide> See Also <ide> -------- <ide> def require(a, dtype=None, requirements=None): <ide> UPDATEIFCOPY : False <ide> <ide> """ <del> if requirements is None: <del> requirements = [] <del> else: <del> requirements = [x.upper() for x in requirements] <del> <add> possible_flags = {'C':'C', 'C_CONTIGUOUS':'C', 'CONTIGUOUS':'C', <add> 'F':'F', 'F_CONTIGUOUS':'F', 'FORTRAN':'F', <add> 'A':'A', 'ALIGNED':'A', <add> 'W':'W', 'WRITEABLE':'W', <add> 'O':'O', 'OWNDATA':'O', <add> 'E':'E', 'ENSUREARRAY':'E'} <ide> if not requirements: <ide> return asanyarray(a, dtype=dtype) <add> else: <add> requirements = set(possible_flags[x.upper()] for x in requirements) <ide> <del> if 'ENSUREARRAY' in requirements or 'E' in requirements: <add> if 'E' in requirements: <add> requirements.remove('E') <ide> subok = False <ide> else: <ide> subok = True <ide> <del> arr = array(a, dtype=dtype, copy=False, subok=subok) <add> order = 'A' <add> if requirements >= set(['C', 'F']): <add> raise ValueError('Cannot specify both "C" and "F" order') <add> elif 'F' in requirements: <add> order = 'F' <add> requirements.remove('F') <add> elif 'C' in requirements: <add> order = 'C' <add> requirements.remove('C') <ide> <del> copychar = 'A' <del> if 'FORTRAN' in requirements or \ <del> 'F_CONTIGUOUS' in requirements or \ <del> 'F' in requirements: <del> copychar = 'F' <del> elif 'CONTIGUOUS' in requirements or \ <del> 'C_CONTIGUOUS' in requirements or \ <del> 'C' in requirements: <del> copychar = 'C' <add> arr = array(a, dtype=dtype, order=order, copy=False, subok=subok) <ide> <ide> for prop in requirements: <ide> if not arr.flags[prop]: <del> arr = arr.copy(copychar) <add> arr = arr.copy(order) <ide> break <ide> return arr <ide> <ide><path>numpy/core/tests/test_numeric.py <ide> def test_outer_out_param(): <ide> assert_equal(res1, out1) <ide> assert_equal(np.outer(arr2, arr3, out2), out2) <ide> <add>class TestRequire(object): <add> flag_names = ['C', 'C_CONTIGUOUS', 'CONTIGUOUS', <add> 'F', 'F_CONTIGUOUS', 'FORTRAN', <add> 'A', 'ALIGNED', <add> 'W', 'WRITEABLE', <add> 'O', 'OWNDATA'] <add> <add> def generate_all_false(self, dtype): <add> arr = np.zeros((2, 2), [('junk', 'i1'), ('a', dtype)]) <add> arr.setflags(write=False) <add> a = arr['a'] <add> assert_(not a.flags['C']) <add> assert_(not a.flags['F']) <add> assert_(not a.flags['O']) <add> assert_(not a.flags['W']) <add> assert_(not a.flags['A']) <add> return a <add> <add> def set_and_check_flag(self, flag, dtype, arr): <add> if dtype is None: <add> dtype = arr.dtype <add> b = np.require(arr, dtype, [flag]) <add> assert_(b.flags[flag]) <add> assert_(b.dtype == dtype) <add> <add> # a further call to np.require ought to return the same array <add> # unless OWNDATA is specified. <add> c = np.require(b, None, [flag]) <add> if flag[0] != 'O': <add> assert_(c is b) <add> else: <add> assert_(c.flags[flag]) <add> <add> def test_require_each(self): <add> <add> id = ['f8', 'i4'] <add> fd = [None, 'f8', 'c16'] <add> for idtype, fdtype, flag in itertools.product(id, fd, self.flag_names): <add> a = self.generate_all_false(idtype) <add> yield self.set_and_check_flag, flag, fdtype, a <add> <add> def test_unknown_requirement(self): <add> a = self.generate_all_false('f8') <add> assert_raises(KeyError, np.require, a, None, 'Q') <add> <add> def test_non_array_input(self): <add> a = np.require([1, 2, 3, 4], 'i4', ['C', 'A', 'O']) <add> assert_(a.flags['O']) <add> assert_(a.flags['C']) <add> assert_(a.flags['A']) <add> assert_(a.dtype == 'i4') <add> assert_equal(a, [1, 2, 3, 4]) <add> <add> def test_C_and_F_simul(self): <add> a = self.generate_all_false('f8') <add> assert_raises(ValueError, np.require, a, None, ['C', 'F']) <add> <add> def test_ensure_array(self): <add> class ArraySubclass(ndarray): <add> pass <add> <add> a = ArraySubclass((2,2)) <add> b = np.require(a, None, ['E']) <add> assert_(type(b) is np.ndarray) <add> <add> def test_preserve_subtype(self): <add> class ArraySubclass(ndarray): <add> pass <add> <add> for flag in self.flag_names: <add> a = ArraySubclass((2,2)) <add> yield self.set_and_check_flag, flag, None, a <add> <add> <ide> if __name__ == "__main__": <ide> run_module_suite()
2
Python
Python
add randomized heap.
f0aa63f0f947180955ab3272dbd1e4ebf646032c
<ide><path>data_structures/heap/randomized_heap.py <add>#!/usr/bin/env python3 <add> <add>from __future__ import annotations <add> <add>import random <add>from typing import Generic, Iterable, List, Optional, TypeVar <add> <add>T = TypeVar("T") <add> <add> <add>class RandomizedHeapNode(Generic[T]): <add> """ <add> One node of the randomized heap. Contains the value and references to <add> two children. <add> """ <add> <add> def __init__(self, value: T) -> None: <add> self._value: T = value <add> self.left: Optional[RandomizedHeapNode[T]] = None <add> self.right: Optional[RandomizedHeapNode[T]] = None <add> <add> @property <add> def value(self) -> T: <add> """Return the value of the node.""" <add> return self._value <add> <add> @staticmethod <add> def merge( <add> root1: Optional[RandomizedHeapNode[T]], root2: Optional[RandomizedHeapNode[T]] <add> ) -> Optional[RandomizedHeapNode[T]]: <add> """Merge 2 nodes together.""" <add> if not root1: <add> return root2 <add> <add> if not root2: <add> return root1 <add> <add> if root1.value > root2.value: <add> root1, root2 = root2, root1 <add> <add> if random.choice([True, False]): <add> root1.left, root1.right = root1.right, root1.left <add> <add> root1.left = RandomizedHeapNode.merge(root1.left, root2) <add> <add> return root1 <add> <add> <add>class RandomizedHeap(Generic[T]): <add> """ <add> A data structure that allows inserting a new value and to pop the smallest <add> values. Both operations take O(logN) time where N is the size of the <add> structure. <add> Wiki: https://en.wikipedia.org/wiki/Randomized_meldable_heap <add> <add> >>> RandomizedHeap([2, 3, 1, 5, 1, 7]).to_sorted_list() <add> [1, 1, 2, 3, 5, 7] <add> <add> >>> rh = RandomizedHeap() <add> >>> rh.pop() <add> Traceback (most recent call last): <add> ... <add> IndexError: Can't get top element for the empty heap. <add> <add> >>> rh.insert(1) <add> >>> rh.insert(-1) <add> >>> rh.insert(0) <add> >>> rh.to_sorted_list() <add> [-1, 0, 1] <add> """ <add> <add> def __init__(self, data: Optional[Iterable[T]] = ()) -> None: <add> """ <add> >>> rh = RandomizedHeap([3, 1, 3, 7]) <add> >>> rh.to_sorted_list() <add> [1, 3, 3, 7] <add> """ <add> self._root: Optional[RandomizedHeapNode[T]] = None <add> for item in data: <add> self.insert(item) <add> <add> def insert(self, value: T) -> None: <add> """ <add> Insert the value into the heap. <add> <add> >>> rh = RandomizedHeap() <add> >>> rh.insert(3) <add> >>> rh.insert(1) <add> >>> rh.insert(3) <add> >>> rh.insert(7) <add> >>> rh.to_sorted_list() <add> [1, 3, 3, 7] <add> """ <add> self._root = RandomizedHeapNode.merge(self._root, RandomizedHeapNode(value)) <add> <add> def pop(self) -> T: <add> """ <add> Pop the smallest value from the heap and return it. <add> <add> >>> rh = RandomizedHeap([3, 1, 3, 7]) <add> >>> rh.pop() <add> 1 <add> >>> rh.pop() <add> 3 <add> >>> rh.pop() <add> 3 <add> >>> rh.pop() <add> 7 <add> >>> rh.pop() <add> Traceback (most recent call last): <add> ... <add> IndexError: Can't get top element for the empty heap. <add> """ <add> result = self.top() <add> self._root = RandomizedHeapNode.merge(self._root.left, self._root.right) <add> <add> return result <add> <add> def top(self) -> T: <add> """ <add> Return the smallest value from the heap. <add> <add> >>> rh = RandomizedHeap() <add> >>> rh.insert(3) <add> >>> rh.top() <add> 3 <add> >>> rh.insert(1) <add> >>> rh.top() <add> 1 <add> >>> rh.insert(3) <add> >>> rh.top() <add> 1 <add> >>> rh.insert(7) <add> >>> rh.top() <add> 1 <add> """ <add> if not self._root: <add> raise IndexError("Can't get top element for the empty heap.") <add> return self._root.value <add> <add> def clear(self): <add> """ <add> Clear the heap. <add> <add> >>> rh = RandomizedHeap([3, 1, 3, 7]) <add> >>> rh.clear() <add> >>> rh.pop() <add> Traceback (most recent call last): <add> ... <add> IndexError: Can't get top element for the empty heap. <add> """ <add> self._root = None <add> <add> def to_sorted_list(self) -> List[T]: <add> """ <add> Returns sorted list containing all the values in the heap. <add> <add> >>> rh = RandomizedHeap([3, 1, 3, 7]) <add> >>> rh.to_sorted_list() <add> [1, 3, 3, 7] <add> """ <add> result = [] <add> while self: <add> result.append(self.pop()) <add> <add> return result <add> <add> def __bool__(self) -> bool: <add> """ <add> Check if the heap is not empty. <add> <add> >>> rh = RandomizedHeap() <add> >>> bool(rh) <add> False <add> >>> rh.insert(1) <add> >>> bool(rh) <add> True <add> >>> rh.clear() <add> >>> bool(rh) <add> False <add> """ <add> return self._root is not None <add> <add> <add>if __name__ == "__main__": <add> import doctest <add> <add> doctest.testmod()
1
Python
Python
fix a comment
b83f1e88b8450a80995e6ce1164960166a8af477
<ide><path>official/resnet/keras/resnet_cifar_model.py <ide> # See the License for the specific language governing permissions and <ide> # limitations under the License. <ide> # ============================================================================== <del>"""ResNet50 model for Keras adapted from tf.keras.applications.ResNet50. <add>"""ResNet56 model for Keras adapted from tf.keras.applications.ResNet50. <ide> <ide> # Reference: <ide> - [Deep Residual Learning for Image Recognition](
1
Go
Go
add file path to errors loading the key file
a90e91b500bb1a39a7726025973b5748148768c1
<ide><path>api/common.go <ide> func LoadOrCreateTrustKey(trustKeyPath string) (libtrust.PrivateKey, error) { <ide> return nil, fmt.Errorf("Error saving key file: %s", err) <ide> } <ide> } else if err != nil { <del> return nil, fmt.Errorf("Error loading key file: %s", err) <add> return nil, fmt.Errorf("Error loading key file %s: %s", trustKeyPath, err) <ide> } <ide> return trustKey, nil <ide> }
1
Python
Python
remove unused imports
31cd05bd63850cbc969c0a5d5467073dbbec0ee9
<ide><path>libcloud/providers.py <ide> """ <ide> <ide> from libcloud.types import Provider <del>from libcloud.drivers.linode import LinodeNodeDriver as Linode <del>from libcloud.drivers.slicehost import SlicehostNodeDriver as Slicehost <del>from libcloud.drivers.rackspace import RackspaceNodeDriver as Rackspace <del> <ide> <ide> DRIVERS = { <ide> Provider.DUMMY:
1
Go
Go
fix issues with tailing rotated jsonlog file
84e60a7e10278e3acd2b783d0e6955dc5198b57c
<ide><path>daemon/logger/jsonfilelog/read.go <ide> package jsonfilelog <ide> import ( <ide> "bytes" <ide> "encoding/json" <add> "errors" <ide> "fmt" <ide> "io" <ide> "os" <ide> "time" <ide> <add> "gopkg.in/fsnotify.v1" <add> <ide> "github.com/Sirupsen/logrus" <ide> "github.com/docker/docker/daemon/logger" <ide> "github.com/docker/docker/pkg/filenotify" <ide> func (l *JSONFileLogger) ReadLogs(config logger.ReadConfig) *logger.LogWatcher { <ide> func (l *JSONFileLogger) readLogs(logWatcher *logger.LogWatcher, config logger.ReadConfig) { <ide> defer close(logWatcher.Msg) <ide> <add> // lock so the read stream doesn't get corrupted due to rotations or other log data written while we read <add> // This will block writes!!! <add> l.mu.Lock() <add> <ide> pth := l.writer.LogPath() <ide> var files []io.ReadSeeker <ide> for i := l.writer.MaxFiles(); i > 1; i-- { <ide> func (l *JSONFileLogger) readLogs(logWatcher *logger.LogWatcher, config logger.R <ide> latestFile, err := os.Open(pth) <ide> if err != nil { <ide> logWatcher.Err <- err <add> l.mu.Unlock() <ide> return <ide> } <ide> <ide> func (l *JSONFileLogger) readLogs(logWatcher *logger.LogWatcher, config logger.R <ide> if err := latestFile.Close(); err != nil { <ide> logrus.Errorf("Error closing file: %v", err) <ide> } <add> l.mu.Unlock() <ide> return <ide> } <ide> <ide> if config.Tail >= 0 { <ide> latestFile.Seek(0, os.SEEK_END) <ide> } <ide> <del> l.mu.Lock() <ide> l.readers[logWatcher] = struct{}{} <ide> l.mu.Unlock() <ide> <ide> func tailFile(f io.ReadSeeker, logWatcher *logger.LogWatcher, tail int, since ti <ide> } <ide> } <ide> <add>func watchFile(name string) (filenotify.FileWatcher, error) { <add> fileWatcher, err := filenotify.New() <add> if err != nil { <add> return nil, err <add> } <add> <add> if err := fileWatcher.Add(name); err != nil { <add> logrus.WithField("logger", "json-file").Warnf("falling back to file poller due to error: %v", err) <add> fileWatcher.Close() <add> fileWatcher = filenotify.NewPollingWatcher() <add> <add> if err := fileWatcher.Add(name); err != nil { <add> fileWatcher.Close() <add> logrus.Debugf("error watching log file for modifications: %v", err) <add> return nil, err <add> } <add> } <add> return fileWatcher, nil <add>} <add> <ide> func followLogs(f *os.File, logWatcher *logger.LogWatcher, notifyRotate chan interface{}, since time.Time) { <ide> dec := json.NewDecoder(f) <ide> l := &jsonlog.JSONLog{} <ide> <del> fileWatcher, err := filenotify.New() <add> name := f.Name() <add> fileWatcher, err := watchFile(name) <ide> if err != nil { <ide> logWatcher.Err <- err <add> return <ide> } <ide> defer func() { <ide> f.Close() <ide> fileWatcher.Close() <ide> }() <del> name := f.Name() <ide> <del> if err := fileWatcher.Add(name); err != nil { <del> logrus.WithField("logger", "json-file").Warnf("falling back to file poller due to error: %v", err) <del> fileWatcher.Close() <del> fileWatcher = filenotify.NewPollingWatcher() <add> var retries int <add> handleRotate := func() error { <add> f.Close() <add> fileWatcher.Remove(name) <ide> <add> // retry when the file doesn't exist <add> for retries := 0; retries <= 5; retries++ { <add> f, err = os.Open(name) <add> if err == nil || !os.IsNotExist(err) { <add> break <add> } <add> } <add> if err != nil { <add> return err <add> } <ide> if err := fileWatcher.Add(name); err != nil { <del> logrus.Debugf("error watching log file for modifications: %v", err) <del> logWatcher.Err <- err <del> return <add> return err <ide> } <add> dec = json.NewDecoder(f) <add> return nil <ide> } <ide> <del> var retries int <del> for { <del> msg, err := decodeLogLine(dec, l) <del> if err != nil { <del> if err != io.EOF { <del> // try again because this shouldn't happen <del> if _, ok := err.(*json.SyntaxError); ok && retries <= maxJSONDecodeRetry { <del> dec = json.NewDecoder(f) <del> retries++ <del> continue <add> errRetry := errors.New("retry") <add> errDone := errors.New("done") <add> waitRead := func() error { <add> select { <add> case e := <-fileWatcher.Events(): <add> switch e.Op { <add> case fsnotify.Write: <add> dec = json.NewDecoder(f) <add> return nil <add> case fsnotify.Rename, fsnotify.Remove: <add> select { <add> case <-notifyRotate: <add> case <-logWatcher.WatchClose(): <add> fileWatcher.Remove(name) <add> return errDone <ide> } <del> <del> // io.ErrUnexpectedEOF is returned from json.Decoder when there is <del> // remaining data in the parser's buffer while an io.EOF occurs. <del> // If the json logger writes a partial json log entry to the disk <del> // while at the same time the decoder tries to decode it, the race condition happens. <del> if err == io.ErrUnexpectedEOF && retries <= maxJSONDecodeRetry { <del> reader := io.MultiReader(dec.Buffered(), f) <del> dec = json.NewDecoder(reader) <del> retries++ <del> continue <add> if err := handleRotate(); err != nil { <add> return err <ide> } <del> <del> return <add> return nil <ide> } <del> <del> select { <del> case <-fileWatcher.Events(): <del> dec = json.NewDecoder(f) <del> continue <del> case <-fileWatcher.Errors(): <del> logWatcher.Err <- err <del> return <del> case <-logWatcher.WatchClose(): <del> fileWatcher.Remove(name) <del> return <del> case <-notifyRotate: <del> f.Close() <del> fileWatcher.Remove(name) <del> <del> // retry when the file doesn't exist <del> for retries := 0; retries <= 5; retries++ { <del> f, err = os.Open(name) <del> if err == nil || !os.IsNotExist(err) { <del> break <del> } <add> return errRetry <add> case err := <-fileWatcher.Errors(): <add> logrus.Debug("logger got error watching file: %v", err) <add> // Something happened, let's try and stay alive and create a new watcher <add> if retries <= 5 { <add> fileWatcher.Close() <add> fileWatcher, err = watchFile(name) <add> if err != nil { <add> return err <ide> } <add> retries++ <add> return errRetry <add> } <add> return err <add> case <-logWatcher.WatchClose(): <add> fileWatcher.Remove(name) <add> return errDone <add> } <add> } <ide> <del> if err = fileWatcher.Add(name); err != nil { <del> logWatcher.Err <- err <del> return <add> handleDecodeErr := func(err error) error { <add> if err == io.EOF { <add> for err := waitRead(); err != nil; { <add> if err == errRetry { <add> // retry the waitRead <add> continue <ide> } <del> if err != nil { <del> logWatcher.Err <- err <add> return err <add> } <add> return nil <add> } <add> // try again because this shouldn't happen <add> if _, ok := err.(*json.SyntaxError); ok && retries <= maxJSONDecodeRetry { <add> dec = json.NewDecoder(f) <add> retries++ <add> return nil <add> } <add> // io.ErrUnexpectedEOF is returned from json.Decoder when there is <add> // remaining data in the parser's buffer while an io.EOF occurs. <add> // If the json logger writes a partial json log entry to the disk <add> // while at the same time the decoder tries to decode it, the race condition happens. <add> if err == io.ErrUnexpectedEOF && retries <= maxJSONDecodeRetry { <add> reader := io.MultiReader(dec.Buffered(), f) <add> dec = json.NewDecoder(reader) <add> retries++ <add> return nil <add> } <add> return err <add> } <add> <add> // main loop <add> for { <add> msg, err := decodeLogLine(dec, l) <add> if err != nil { <add> if err := handleDecodeErr(err); err != nil { <add> if err == errDone { <ide> return <ide> } <del> <del> dec = json.NewDecoder(f) <del> continue <add> // we got an unrecoverable error, so return <add> logWatcher.Err <- err <add> return <ide> } <add> // ready to try again <add> continue <ide> } <ide> <ide> retries = 0 // reset retries since we've succeeded
1
Ruby
Ruby
introduce to_param to assert_redirected_to #880
409d56abda45ee380d6a903cbf835e7a770061d8
<ide><path>actionpack/lib/action_controller/assertions/action_pack_assertions.rb <ide> def assert_redirected_to(options = {}, message=nil) <ide> if options.is_a?(Symbol) <ide> response.redirected_to == options <ide> else <del> options.keys.all? { |k| options[k] == response.redirected_to[k] } <add> options.keys.all? { |k| options[k] == ( response.redirected_to[k].respond_to?(:to_param) ? response.redirected_to[k].to_param : response.redirected_to[k] if response.redirected_to[k] ) } <ide> end <ide> end <ide> end
1
PHP
PHP
remove unused var
8e7942b063d1bb0c8188f298177dcfb4e0141811
<ide><path>src/Illuminate/Cache/Repository.php <ide> protected function handleManyResult($keys, $key, $value) <ide> */ <ide> public function pull($key, $default = null) <ide> { <del> return tap($this->get($key, $default), function ($value) use ($key) { <add> return tap($this->get($key, $default), function () use ($key) { <ide> $this->forget($key); <ide> }); <ide> }
1
Python
Python
fix method typo in storagedriver (list_containers)
3c9b5e2517c111a62588cfa084af3807b97196a7
<ide><path>libcloud/storage/base.py <ide> def __init__(self, key, secret=None, secure=True, host=None, port=None, **kwargs <ide> super(StorageDriver, self).__init__(key=key, secret=secret, secure=secure, <ide> host=host, port=port, **kwargs) <ide> <del> def list_containters(self): <add> def list_containers(self): <ide> """ <ide> Return a list of containers. <ide>
1
Ruby
Ruby
use coreformularepository, avoid duplicated logic
871ec755242f0ab174c06f582e192b2a26d085a0
<ide><path>Library/Homebrew/formula.rb <ide> def std_cmake_args <ide> # an array of all core {Formula} names <ide> # @private <ide> def self.core_names <del> @core_names ||= core_files.map { |f| f.basename(".rb").to_s }.sort <add> CoreFormulaRepository.instance.formula_names <ide> end <ide> <ide> # an array of all core {Formula} files <ide> # @private <ide> def self.core_files <del> @core_files ||= Pathname.glob("#{HOMEBREW_LIBRARY}/Formula/*.rb") <add> CoreFormulaRepository.instance.formula_files <ide> end <ide> <ide> # an array of all tap {Formula} names <ide> def self.installed <ide> # an array of all alias files of core {Formula} <ide> # @private <ide> def self.core_alias_files <del> @core_alias_files ||= Pathname.glob("#{HOMEBREW_LIBRARY}/Aliases/*") <add> CoreFormulaRepository.instance.alias_files <ide> end <ide> <ide> # an array of all core aliases <ide> # @private <ide> def self.core_aliases <del> @core_aliases ||= core_alias_files.map { |f| f.basename.to_s }.sort <add> CoreFormulaRepository.instance.aliases <ide> end <ide> <ide> # an array of all tap aliases <ide> def self.alias_full_names <ide> # a table mapping core alias to formula name <ide> # @private <ide> def self.core_alias_table <del> return @core_alias_table if @core_alias_table <del> @core_alias_table = Hash.new <del> core_alias_files.each do |alias_file| <del> @core_alias_table[alias_file.basename.to_s] = alias_file.resolved_path.basename(".rb").to_s <del> end <del> @core_alias_table <add> CoreFormulaRepository.instance.alias_table <ide> end <ide> <ide> # a table mapping core formula name to aliases <ide> # @private <ide> def self.core_alias_reverse_table <del> return @core_alias_reverse_table if @core_alias_reverse_table <del> @core_alias_reverse_table = Hash.new <del> core_alias_table.each do |alias_name, formula_name| <del> @core_alias_reverse_table[formula_name] ||= [] <del> @core_alias_reverse_table[formula_name] << alias_name <del> end <del> @core_alias_reverse_table <add> CoreFormulaRepository.instance.alias_reverse_table <ide> end <ide> <ide> def self.[](name)
1
Ruby
Ruby
require used model to fix isolated tests
663e84638188421636232d7f7b762dc37a2609f1
<ide><path>activerecord/test/cases/relation/field_ordered_values_test.rb <ide> # frozen_string_literal: true <ide> <ide> require "cases/helper" <add>require "models/author" <ide> require "models/post" <ide> require "models/book" <ide>
1
Javascript
Javascript
add test for setinterval
3886e183fd5f2cf69f84f9829a39e96a905233ec
<ide><path>test/test-setTimeout.js <ide> function onLoad () { <ide> // this timer shouldn't execute <ide> var id = setTimeout(function () { assertTrue(false); }, 500); <ide> clearTimeout(id); <add> <add> var count = 0; <add> setInterval(function () { <add> count += 1; <add> var endtime = new Date; <add> var diff = endtime - starttime; <add> if (diff < 0) diff = -diff; <add> puts(diff); <add> var t = count * 1000; <add> assertTrue(t - 100 < diff || diff < t + 100); <add> assertTrue(count <= 3); <add> if (count == 3) <add> clearInterval(this); <add> }, 1000); <ide> }
1
Go
Go
add xfs fs magic to graphdriver/driver.go
dd56fa190695a969673f6f663cd5fe78b7c22787
<ide><path>daemon/graphdriver/driver.go <ide> const ( <ide> FsMagicSmbFs = FsMagic(0x0000517B) <ide> FsMagicJffs2Fs = FsMagic(0x000072b6) <ide> FsMagicZfs = FsMagic(0x2fc12fc1) <add> FsMagicXfs = FsMagic(0x58465342) <ide> FsMagicUnsupported = FsMagic(0x00000000) <ide> ) <ide> <ide> var ( <ide> FsMagicSmbFs: "smb", <ide> FsMagicJffs2Fs: "jffs2", <ide> FsMagicZfs: "zfs", <add> FsMagicXfs: "xfs", <ide> FsMagicUnsupported: "unsupported", <ide> } <ide> )
1
Javascript
Javascript
implement htmlbars `each` helper
932bab101f01d59b41706294ae3a11fe1b2f7fc0
<ide><path>packages/ember-htmlbars/lib/helpers/each.js <add> <add>/** <add>@module ember <add>@submodule ember-handlebars <add>*/ <add>import Ember from "ember-metal/core"; // Ember.assert; <add> <add> <add>import { fmt } from "ember-runtime/system/string"; <add>import { get } from "ember-metal/property_get"; <add>import { set } from "ember-metal/property_set"; <add>import CollectionView from "ember-views/views/collection_view"; <add>import { Binding } from "ember-metal/binding"; <add>import ControllerMixin from "ember-runtime/mixins/controller"; <add>import ArrayController from "ember-runtime/controllers/array_controller"; <add>import EmberArray from "ember-runtime/mixins/array"; <add>import { collectionHelper } from "ember-htmlbars/helpers/collection"; <add> <add>import { <add> addObserver, <add> removeObserver, <add> addBeforeObserver, <add> removeBeforeObserver <add>} from "ember-metal/observer"; <add> <add>import _MetamorphView from "ember-views/views/metamorph_view"; <add>import { _Metamorph } from "ember-views/views/metamorph_view"; <add> <add>var EachView = CollectionView.extend(_Metamorph, { <add> <add> init: function() { <add> var itemController = get(this, 'itemController'); <add> var binding; <add> <add> if (itemController) { <add> var controller = get(this, 'controller.container').lookupFactory('controller:array').create({ <add> _isVirtual: true, <add> parentController: get(this, 'controller'), <add> itemController: itemController, <add> target: get(this, 'controller'), <add> _eachView: this <add> }); <add> <add> this.disableContentObservers(function() { <add> set(this, 'content', controller); <add> binding = new Binding('content', '_eachView.dataSource').oneWay(); <add> binding.connect(controller); <add> }); <add> <add> set(this, '_arrayController', controller); <add> } else { <add> this.disableContentObservers(function() { <add> binding = new Binding('content', 'dataSource').oneWay(); <add> binding.connect(this); <add> }); <add> } <add> <add> return this._super(); <add> }, <add> <add> _assertArrayLike: function(content) { <add> Ember.assert(fmt("The value that #each loops over must be an Array. You " + <add> "passed %@, but it should have been an ArrayController", <add> [content.constructor]), <add> !ControllerMixin.detect(content) || <add> (content && content.isGenerated) || <add> content instanceof ArrayController); <add> Ember.assert(fmt("The value that #each loops over must be an Array. You passed %@", <add> [(ControllerMixin.detect(content) && <add> content.get('model') !== undefined) ? <add> fmt("'%@' (wrapped in %@)", [content.get('model'), content]) : content]), <add> EmberArray.detect(content)); <add> }, <add> <add> disableContentObservers: function(callback) { <add> removeBeforeObserver(this, 'content', null, '_contentWillChange'); <add> removeObserver(this, 'content', null, '_contentDidChange'); <add> <add> callback.call(this); <add> <add> addBeforeObserver(this, 'content', null, '_contentWillChange'); <add> addObserver(this, 'content', null, '_contentDidChange'); <add> }, <add> <add> itemViewClass: _MetamorphView, <add> emptyViewClass: _MetamorphView, <add> <add> createChildView: function(view, attrs) { <add> view = this._super(view, attrs); <add> <add> var content = get(view, 'content'); <add> var keyword = get(this, 'keyword'); <add> <add> if (keyword) { <add> view._keywords[keyword] = content; <add> } <add> <add> // If {{#each}} is looping over an array of controllers, <add> // point each child view at their respective controller. <add> if (content && content.isController) { <add> set(view, 'controller', content); <add> } <add> <add> return view; <add> }, <add> <add> destroy: function() { <add> if (!this._super()) { return; } <add> <add> var arrayController = get(this, '_arrayController'); <add> <add> if (arrayController) { <add> arrayController.destroy(); <add> } <add> <add> return this; <add> } <add>}); <add> <add>/** <add> The `{{#each}}` helper loops over elements in a collection. It is an extension <add> of the base Handlebars `{{#each}}` helper. <add> <add> The default behavior of `{{#each}}` is to yield its inner block once for every <add> item in an array. <add> <add> ```javascript <add> var developers = [{name: 'Yehuda'},{name: 'Tom'}, {name: 'Paul'}]; <add> ``` <add> <add> ```handlebars <add> {{#each person in developers}} <add> {{person.name}} <add> {{! `this` is whatever it was outside the #each }} <add> {{/each}} <add> ``` <add> <add> The same rules apply to arrays of primitives, but the items may need to be <add> references with `{{this}}`. <add> <add> ```javascript <add> var developerNames = ['Yehuda', 'Tom', 'Paul'] <add> ``` <add> <add> ```handlebars <add> {{#each name in developerNames}} <add> {{name}} <add> {{/each}} <add> ``` <add> <add> ### {{else}} condition <add> <add> `{{#each}}` can have a matching `{{else}}`. The contents of this block will render <add> if the collection is empty. <add> <add> ``` <add> {{#each person in developers}} <add> {{person.name}} <add> {{else}} <add> <p>Sorry, nobody is available for this task.</p> <add> {{/each}} <add> ``` <add> <add> ### Specifying an alternative view for each item <add> <add> `itemViewClass` can control which view will be used during the render of each <add> item's template. <add> <add> The following template: <add> <add> ```handlebars <add> <ul> <add> {{#each developer in developers itemViewClass="person"}} <add> {{developer.name}} <add> {{/each}} <add> </ul> <add> ``` <add> <add> Will use the following view for each item <add> <add> ```javascript <add> App.PersonView = Ember.View.extend({ <add> tagName: 'li' <add> }); <add> ``` <add> <add> Resulting in HTML output that looks like the following: <add> <add> ```html <add> <ul> <add> <li class="ember-view">Yehuda</li> <add> <li class="ember-view">Tom</li> <add> <li class="ember-view">Paul</li> <add> </ul> <add> ``` <add> <add> `itemViewClass` also enables a non-block form of `{{each}}`. The view <add> must {{#crossLink "Ember.View/toc_templates"}}provide its own template{{/crossLink}}, <add> and then the block should be dropped. An example that outputs the same HTML <add> as the previous one: <add> <add> ```javascript <add> App.PersonView = Ember.View.extend({ <add> tagName: 'li', <add> template: '{{developer.name}}' <add> }); <add> ``` <add> <add> ```handlebars <add> <ul> <add> {{each developer in developers itemViewClass="person"}} <add> </ul> <add> ``` <add> <add> ### Specifying an alternative view for no items (else) <add> <add> The `emptyViewClass` option provides the same flexibility to the `{{else}}` <add> case of the each helper. <add> <add> ```javascript <add> App.NoPeopleView = Ember.View.extend({ <add> tagName: 'li', <add> template: 'No person is available, sorry' <add> }); <add> ``` <add> <add> ```handlebars <add> <ul> <add> {{#each developer in developers emptyViewClass="no-people"}} <add> <li>{{developer.name}}</li> <add> {{/each}} <add> </ul> <add> ``` <add> <add> ### Wrapping each item in a controller <add> <add> Controllers in Ember manage state and decorate data. In many cases, <add> providing a controller for each item in a list can be useful. <add> Specifically, an {{#crossLink "Ember.ObjectController"}}Ember.ObjectController{{/crossLink}} <add> should probably be used. Item controllers are passed the item they <add> will present as a `model` property, and an object controller will <add> proxy property lookups to `model` for us. <add> <add> This allows state and decoration to be added to the controller <add> while any other property lookups are delegated to the model. An example: <add> <add> ```javascript <add> App.RecruitController = Ember.ObjectController.extend({ <add> isAvailableForHire: function() { <add> return !this.get('isEmployed') && this.get('isSeekingWork'); <add> }.property('isEmployed', 'isSeekingWork') <add> }) <add> ``` <add> <add> ```handlebars <add> {{#each person in developers itemController="recruit"}} <add> {{person.name}} {{#if person.isAvailableForHire}}Hire me!{{/if}} <add> {{/each}} <add> ``` <add> <add> @method each <add> @for Ember.Handlebars.helpers <add> @param [name] {String} name for item (used with `in`) <add> @param [path] {String} path <add> @param [options] {Object} Handlebars key/value pairs of options <add> @param [options.itemViewClass] {String} a path to a view class used for each item <add> @param [options.emptyViewClass] {String} a path to a view class used for each item <add> @param [options.itemController] {String} name of a controller to be created for each item <add>*/ <add>function eachHelper(params, hash, options, env) { <add> var helperName = 'each'; <add> var keywordName; <add> var path = params[0]; <add> <add> Ember.assert("If you pass more than one argument to the each helper," + <add> " it must be in the form #each foo in bar", params.length <= 1); <add> <add> if (options.types[0] === 'keyword') { <add> keywordName = path.to; <add> <add> helperName += ' ' + keywordName + ' in ' + path.from; <add> <add> hash.keyword = keywordName; <add> <add> path = path.stream; <add> } else { <add> helperName += ' ' + path; <add> } <add> <add> if (!path) { <add> path = env.data.view.getStream(''); <add> } <add> <add> Ember.deprecate('Using the context switching form of {{each}} is deprecated. Please use the keyword form (`{{#each foo in bar}}`) instead. See http://emberjs.com/guides/deprecations/#toc_more-consistent-handlebars-scope for more details.', keywordName); <add> <add> hash.emptyViewClass = Ember._MetamorphView; <add> hash.dataSourceBinding = path; <add> options.helperName = options.helperName || helperName; <add> <add> return collectionHelper.call(this, [EachView], hash, options, env); <add>} <add> <add>export { <add> EachView, <add> eachHelper <add>}; <ide>\ No newline at end of file <ide><path>packages/ember-htmlbars/lib/hooks.js <ide> function streamifyArgs(view, params, hash, options, env) { <ide> stream: view.getStream(params[0]) <ide> }); <ide> options.types.splice(0, 3, 'keyword'); <add> } else if (params.length === 3 && params[1] === "in") { <add> params.splice(0, 3, { <add> from: params[2], <add> to: params[0], <add> stream: view.getStream(params[2]) <add> }); <add> options.types.splice(0, 3, 'keyword'); <ide> } else { <ide> // Convert ID params to streams <ide> for (var i = 0, l = params.length; i < l; i++) { <ide><path>packages/ember-htmlbars/lib/main.js <ide> import { templateHelper } from "ember-htmlbars/helpers/template"; <ide> import { inputHelper } from "ember-htmlbars/helpers/input"; <ide> import { textareaHelper } from "ember-htmlbars/helpers/text_area"; <ide> import { collectionHelper } from "ember-htmlbars/helpers/collection"; <add>import { eachHelper } from "ember-htmlbars/helpers/each"; <ide> <ide> registerHelper('bindHelper', bindHelper); <ide> registerHelper('bind', bindHelper); <ide> registerHelper('bindAttr', bindAttrHelperDeprecated); <ide> registerHelper('input', inputHelper); <ide> registerHelper('textarea', textareaHelper); <ide> registerHelper('collection', collectionHelper); <add>registerHelper('each', eachHelper); <ide> <ide> if (Ember.FEATURES.isEnabled('ember-htmlbars')) { <ide> Ember.HTMLBars = { <ide><path>packages/ember-htmlbars/lib/system/lookup-helper.js <ide> export var ISNT_HELPER_CACHE = new Cache(1000, function(key) { <ide> return key.indexOf('-') === -1; <ide> }); <ide> <del>export function attribute(element, params, options, env) { <add>export function attribute(params, hash, options, env) { <ide> var dom = env.dom; <ide> var name = params[0]; <ide> var value = params[1]; <ide> <ide> value.subscribe(function(lazyValue) { <del> dom.setAttribute(element, name, lazyValue.value()); <add> dom.setAttribute(options.element, name, lazyValue.value()); <ide> }); <ide> <del> dom.setAttribute(element, name, value.value()); <add> dom.setAttribute(options.element, name, value.value()); <ide> } <ide> <del>export function concat(params, options) { <add>export function concat(params, hash, options, env) { <ide> var stream = new Stream(function() { <ide> return readArray(params).join(''); <ide> }); <add><path>packages/ember-htmlbars/tests/helpers/each_test.js <del><path>packages/ember-handlebars/tests/helpers/each_test.js <ide> import Container from "ember-runtime/system/container"; <ide> import { get } from "ember-metal/property_get"; <ide> import { set } from "ember-metal/property_set"; <ide> <add>import htmlbarsCompile from "ember-htmlbars/system/compile"; <add>var compile; <add>if (Ember.FEATURES.isEnabled('ember-htmlbars')) { <add> compile = htmlbarsCompile; <add>} else { <add> compile = EmberHandlebars.compile; <add>} <add> <ide> var people, view, container; <ide> var template, templateMyView, MyView; <ide> <ide> function templateFor(template) { <del> return EmberHandlebars.compile(template); <add> return compile(template); <ide> } <ide> <ide> var originalLookup = Ember.lookup; <ide> test("it supports {{itemViewClass=}} with global (DEPRECATED)", function() { <ide> people: people <ide> }); <ide> <add> var deprecation = /Resolved the view "MyView" on the global context/; <add> if (Ember.FEATURES.isEnabled('ember-htmlbars')) { <add> deprecation = /Global lookup of MyView from a Handlebars template is deprecated/; <add> } <ide> <ide> expectDeprecation(function(){ <ide> append(view); <del> }, /Resolved the view "MyView" on the global context/); <add> }, deprecation); <ide> <ide> assertText(view, "Steve HoltAnnabelle"); <ide> }); <ide> test("controller is assignable inside an #each", function() { <ide> test("it doesn't assert when the morph tags have the same parent", function() { <ide> view = EmberView.create({ <ide> controller: A(['Cyril', 'David']), <del> template: templateFor('<table><tbody>{{#each name in this}}<tr><td>{{name}}</td></tr>{{/each}}<tbody></table>') <add> template: templateFor('<table><tbody>{{#each name in this}}<tr><td>{{name}}</td></tr>{{/each}}</tbody></table>') <ide> }); <ide> <ide> append(view);
5
Ruby
Ruby
upload bottles to archive.org
b0bd15fb41b711782e04d24b307dc515ef65aaa2
<ide><path>Library/Homebrew/archive.rb <add># typed: false <add># frozen_string_literal: true <add> <add>require "digest/md5" <add>require "utils/curl" <add> <add># Archive API client. <add># <add># @api private <add>class Archive <add> extend T::Sig <add> <add> include Context <add> include Utils::Curl <add> <add> class Error < RuntimeError <add> end <add> <add> sig { returns(String) } <add> def inspect <add> "#<Archive: item=#{@archive_item}>" <add> end <add> <add> sig { params(item: T.nilable(String)).void } <add> def initialize(item: "homebrew") <add> @archive_item = item <add> <add> raise UsageError, "Must set the Archive item!" unless @archive_item <add> <add> ENV["HOMEBREW_FORCE_HOMEBREW_ON_LINUX"] = "1" if @archive_item == "homebrew" && !OS.mac? <add> end <add> <add> def open_api(url, *args, auth: true) <add> if auth <add> raise UsageError, "HOMEBREW_ARCHIVE_KEY is unset." unless (key = Homebrew::EnvConfig.archive_key) <add> <add> if key.exclude?(":") <add> raise UsageError, <add> "Use HOMEBREW_ARCHIVE_KEY=access:secret. See https://archive.org/account/s3.php" <add> end <add> <add> args += ["--header", "Authorization: AWS #{key}"] <add> end <add> <add> curl(*args, url, print_stdout: false, secrets: key) <add> end <add> <add> sig { <add> params(local_file: String, <add> dir: String, <add> remote_file: String, <add> warn_on_error: T.nilable(T::Boolean)).void <add> } <add> def upload(local_file, dir:, remote_file:, warn_on_error: false) <add> unless File.exist? local_file <add> msg = "#{local_file} for upload doesn't exist!" <add> raise Error, msg unless warn_on_error <add> <add> # Warn and return early here since we know this upload is going to fail. <add> opoo msg <add> return <add> end <add> <add> md5_base64 = Digest::MD5.base64digest(File.read(local_file)) <add> url = "https://#{@archive_item}.s3.us.archive.org/#{dir}/#{remote_file}" <add> args = ["--upload-file", local_file, "--header", "Content-MD5: #{md5_base64}"] <add> args << "--fail" unless warn_on_error <add> result = T.unsafe(self).open_api(url, *args) <add> return if result.success? && result.stdout.exclude?("Error") <add> <add> msg = "Bottle upload failed: #{result.stdout}" <add> raise msg unless warn_on_error <add> <add> opoo msg <add> end <add> <add> sig { params(url: String).returns(T::Boolean) } <add> def stable_mirrored?(url) <add> headers, = curl_output("--connect-timeout", "15", "--location", "--head", url) <add> status_code = headers.scan(%r{^HTTP/.* (\d+)}).last.first <add> status_code.start_with?("2") <add> end <add> <add> sig { <add> params(formula: Formula, <add> dir: String, <add> warn_on_error: T::Boolean).returns(String) <add> } <add> def mirror_formula(formula, dir: "mirror", warn_on_error: false) <add> formula.downloader.fetch <add> <add> filename = ERB::Util.url_encode(formula.downloader.basename) <add> destination_url = "https://archive.org/download/#{@archive_item}/#{dir}/#{filename}" <add> <add> odebug "Uploading to #{destination_url}" <add> <add> upload( <add> formula.downloader.cached_location, <add> dir: dir, <add> remote_file: filename, <add> warn_on_error: warn_on_error, <add> ) <add> <add> destination_url <add> end <add> <add> # Gets the MD5 hash of the specified remote file. <add> # <add> # @return the hash, the empty string (if the file doesn't have a hash), nil (if the file doesn't exist) <add> sig { params(dir: String, remote_file: String).returns(T.nilable(String)) } <add> def remote_md5(dir:, remote_file:) <add> url = "https://#{@archive_item}.s3.us.archive.org/#{dir}/#{remote_file}" <add> result = curl_output "--fail", "--silent", "--head", "--location", url <add> if result.success? <add> result.stdout.match(/^ETag: "(\h{32})"/)&.values_at(1)&.first || "" <add> else <add> raise Error if result.status.exitstatus != 22 && result.stderr.exclude?("404 Not Found") <add> <add> nil <add> end <add> end <add> <add> sig { params(directory: String, filename: String).returns(String) } <add> def file_delete_instructions(directory, filename) <add> <<~EOS <add> Run: <add> curl -X DELETE -H "Authorization: AWS $HOMEBREW_ARCHIVE_KEY" https://#{@archive_item}.s3.us.archive.org/#{directory}/#{filename} <add> Or run: <add> ia delete #{@archive_item} #{directory}/#{filename} <add> EOS <add> end <add> <add> sig { <add> params(bottles_hash: T::Hash[String, T.untyped], <add> warn_on_error: T.nilable(T::Boolean)).void <add> } <add> def upload_bottles(bottles_hash, warn_on_error: false) <add> bottles_hash.each do |_formula_name, bottle_hash| <add> directory = bottle_hash["bintray"]["repository"] <add> bottle_count = bottle_hash["bottle"]["tags"].length <add> <add> bottle_hash["bottle"]["tags"].each do |_tag, tag_hash| <add> filename = tag_hash["filename"] # URL encoded in Bottle::Filename#archive <add> delete_instructions = file_delete_instructions(directory, filename) <add> <add> local_filename = tag_hash["local_filename"] <add> md5 = Digest::MD5.hexdigest(File.read(local_filename)) <add> <add> odebug "Checking remote file #{@archive_item}/#{directory}/#{filename}" <add> result = remote_md5(dir: directory, remote_file: filename) <add> case result <add> when nil <add> # File doesn't exist. <add> odebug "Uploading #{@archive_item}/#{directory}/#{filename}" <add> upload(local_filename, <add> dir: directory, <add> remote_file: filename, <add> warn_on_error: warn_on_error) <add> when md5 <add> # File exists, hash matches. <add> odebug "#{filename} is already published with matching hash." <add> bottle_count -= 1 <add> when "" <add> # File exists, but can't find hash <add> failed_message = "#{filename} is already published!" <add> raise Error, "#{failed_message}\n#{delete_instructions}" unless warn_on_error <add> <add> opoo failed_message <add> else <add> # File exists, but hash either doesn't exist or is mismatched. <add> failed_message = <<~EOS <add> #{filename} is already published with a mismatched hash! <add> Expected: #{md5} <add> Actual: #{result} <add> EOS <add> raise Error, "#{failed_message}#{delete_instructions}" unless warn_on_error <add> <add> opoo failed_message <add> end <add> end <add> <add> odebug "Uploaded #{bottle_count} bottles" <add> end <add> end <add>end <ide><path>Library/Homebrew/dev-cmd/pr-upload.rb <ide> # frozen_string_literal: true <ide> <ide> require "cli/parser" <add>require "archive" <ide> require "bintray" <ide> <ide> module Homebrew <ide> def pr_upload_args <ide> switch "--warn-on-upload-failure", <ide> description: "Warn instead of raising an error if the bottle upload fails. "\ <ide> "Useful for repairing bottle uploads that previously failed." <add> flag "--archive-item=", <add> description: "Upload to the specified Archive item (default: `homebrew`)." <ide> flag "--bintray-org=", <ide> description: "Upload to the specified Bintray organisation (default: `homebrew`)." <ide> flag "--root-url=", <ide> def check_bottled_formulae(bottles_hash) <ide> end <ide> end <ide> <add> def archive?(bottles_hash) <add> @archive ||= bottles_hash.values.all? do |bottle_hash| <add> bottle_hash["bottle"]["root_url"].start_with? "https://archive.com/" <add> end <add> end <add> <add> def bintray?(bottles_hash) <add> @bintray ||= bottles_hash.values.all? do |bottle_hash| <add> bottle_hash["bottle"]["root_url"].match? %r{^https://[\w-]+\.bintray\.com/} <add> end <add> end <add> <ide> def github_releases?(bottles_hash) <ide> @github_releases ||= bottles_hash.values.all? do |bottle_hash| <ide> root_url = bottle_hash["bottle"]["root_url"] <ide> def pr_upload <ide> bottle_args += json_files <ide> <ide> if args.dry_run? <del> service = if github_releases?(bottles_hash) <del> "GitHub Releases" <del> else <del> "Bintray" <del> end <add> service = <add> if archive?(bottles_hash) <add> "Archive.org" <add> elsif bintray?(bottles_hash) <add> "Bintray" <add> elsif github_releases?(bottles_hash) <add> "GitHub Releases" <add> else <add> odie "Service specified by root_url is not recognized" <add> end <ide> puts <<~EOS <ide> brew #{bottle_args.join " "} <ide> Upload bottles described by these JSON files to #{service}: <ide> def pr_upload <ide> safe_system HOMEBREW_BREW_FILE, *audit_args <ide> end <ide> <del> if github_releases?(bottles_hash) <add> if archive?(bottles_hash) <add> # Handle uploading to Archive.org. <add> archive_item = args.archive_item || "homebrew" <add> archive = Archive.new(item: archive_item) <add> archive.upload_bottles(bottles_hash, <add> warn_on_error: args.warn_on_upload_failure?) <add> elsif bintray?(bottles_hash) <add> # Handle uploading to Bintray. <add> bintray_org = args.bintray_org || "homebrew" <add> bintray = Bintray.new(org: bintray_org) <add> bintray.upload_bottles(bottles_hash, <add> publish_package: !args.no_publish?, <add> warn_on_error: args.warn_on_upload_failure?) <add> elsif github_releases?(bottles_hash) <ide> # Handle uploading to GitHub Releases. <ide> bottles_hash.each_value do |bottle_hash| <ide> root_url = bottle_hash["bottle"]["root_url"] <ide> def pr_upload <ide> end <ide> end <ide> else <del> # Handle uploading to Bintray. <del> bintray_org = args.bintray_org || "homebrew" <del> bintray = Bintray.new(org: bintray_org) <del> bintray.upload_bottles(bottles_hash, <del> publish_package: !args.no_publish?, <del> warn_on_error: args.warn_on_upload_failure?) <add> odie "Service specified by root_url is not recognized" <ide> end <ide> end <ide> end <ide><path>Library/Homebrew/env_config.rb <ide> module EnvConfig <ide> description: "Linux only: Pass this value to a type name representing the compiler's `-march` option.", <ide> default: "native", <ide> }, <add> HOMEBREW_ARCHIVE_KEY: { <add> description: "Use this API key when accessing the Archive.org API (where bottles are stored). " \ <add> "The format is access:secret. See https://archive.org/account/s3.php", <add> }, <ide> HOMEBREW_ARTIFACT_DOMAIN: { <ide> description: "Prefix all download URLs, including those for bottles, with this value. " \ <ide> "For example, `HOMEBREW_ARTIFACT_DOMAIN=http://localhost:8080` will cause a " \
3
PHP
PHP
add dump method to collection class
bb5a955c2e146d8cf198ae5ac4c50bb28a194f58
<ide><path>src/Illuminate/Support/Collection.php <ide> use JsonSerializable; <ide> use IteratorAggregate; <ide> use InvalidArgumentException; <add>use Illuminate\Support\Debug\Dumper; <ide> use Illuminate\Support\Traits\Macroable; <ide> use Illuminate\Contracts\Support\Jsonable; <ide> use Illuminate\Contracts\Support\Arrayable; <ide> public function dd() <ide> dd($this->all()); <ide> } <ide> <add> /** <add> * Dump the collection. <add> * <add> * @return void <add> */ <add> public function dump() <add> { <add> (new static(func_get_args())) <add> ->push($this) <add> ->each(function ($item) { <add> (new Dumper)->dump($item); <add> }); <add> <add> return $this; <add> } <add> <ide> /** <ide> * Get the items in the collection that are not present in the given items. <ide> *
1
Python
Python
fix array dispatcher
9a037558d66f54b27acd133b8b8e92f76717a849
<ide><path>numpy/lib/arraypad.py <ide> def _as_pairs(x, ndim, as_index=False): <ide> # Public functions <ide> <ide> <del>def _pad_dispatcher(array, pad_width, mode, **kwargs): <add>def _pad_dispatcher(array, pad_width, mode=None, **kwargs): <ide> return (array,) <ide> <ide> <ide><path>numpy/lib/tests/test_arraypad.py <ide> def test_kwargs(mode): <ide> <ide> def test_constant_zero_default(): <ide> arr = np.array([1, 1]) <del> assert_array_equal(pad(arr, 2), [0, 0, 1, 1, 0, 0]) <add> assert_array_equal(np.pad(arr, 2), [0, 0, 1, 1, 0, 0]) <ide> <ide> <ide> @pytest.mark.parametrize("mode", _all_modes.keys())
2
Go
Go
write saved manifest.json in unix paths
0a49de4eb551510cf4aafa7d212ec2bb8041f642
<ide><path>image/tarexport/save.go <ide> import ( <ide> "io" <ide> "io/ioutil" <ide> "os" <add> "path" <ide> "path/filepath" <ide> "runtime" <ide> "time" <ide> func (s *saveSession) save(outStream io.Writer) error { <ide> } <ide> <ide> for _, l := range imageDescr.layers { <del> layers = append(layers, filepath.Join(l, legacyLayerFileName)) <add> // IMPORTANT: We use path, not filepath here to ensure the layers <add> // in the manifest use Unix-style forward-slashes. Otherwise, a <add> // Linux image saved from LCOW won't be able to be imported on <add> // LCOL. <add> layers = append(layers, path.Join(l, legacyLayerFileName)) <ide> } <ide> <ide> manifest = append(manifest, manifestItem{
1
PHP
PHP
avoid failing tests by 1 second off
f8fef907c88d7ce0bd67e2d69b89b013b09db758
<ide><path>lib/Cake/Test/Case/Controller/Component/SecurityComponentTest.php <ide> public function testValidateHasManyRecordsPass() { <ide> * @return void <ide> */ <ide> public function testValidateNestedNumericSets() { <del> <add> <ide> $this->Controller->Security->startup($this->Controller); <ide> $key = $this->Controller->request->params['_Token']['key']; <ide> $unlocked = ''; <ide> public function testCsrfSettingMultipleNonces() { <ide> $this->Security->validatePost = false; <ide> $this->Security->csrfCheck = true; <ide> $this->Security->csrfExpires = '+10 minutes'; <add> $csrfExpires = strtotime('+10 minutes'); <ide> $this->Security->startup($this->Controller); <ide> $this->Security->startup($this->Controller); <ide> <ide> $token = $this->Security->Session->read('_Token'); <ide> $this->assertEquals(count($token['csrfTokens']), 2, 'Missing the csrf token.'); <ide> foreach ($token['csrfTokens'] as $key => $expires) { <del> $this->assertEquals(strtotime('+10 minutes'), $expires, 'Token expiry does not match'); <add> $diff = $csrfExpires - $expires; <add> $this->assertTrue($diff === 0 || $diff === 1, 'Token expiry does not match'); <ide> } <ide> } <ide>
1
PHP
PHP
fix some docblocks and smaller things
5a6a46bcb8dfd556c1e84e47df77cee8fc108ad7
<ide><path>src/Illuminate/Cache/DynamoDbStore.php <ide> class DynamoDbStore implements Store <ide> /** <ide> * The name of the attribute that should hold the key. <ide> * <del> * @var string <add> * @var string <ide> */ <ide> protected $keyAttribute; <ide> <ide> /** <ide> * The name of the attribute that should hold the value. <ide> * <del> * @var string <add> * @var string <ide> */ <ide> protected $valueAttribute; <ide> <ide> /** <ide> * The name of the attribute that should hold the expiration timestamp. <ide> * <del> * @var string <add> * @var string <ide> */ <ide> protected $expirationAttribute; <ide> <ide> public function put($key, $value, $minutes) <ide> * <ide> * @param array $values <ide> * @param float|int $minutes <del> * @return void <add> * @return bool <ide> */ <ide> public function putMany(array $values, $minutes) <ide> { <ide> public function putMany(array $values, $minutes) <ide> public function add($key, $value, $minutes) <ide> { <ide> try { <del> $response = $this->dynamo->putItem([ <add> $this->dynamo->putItem([ <ide> 'TableName' => $this->table, <ide> 'Item' => [ <ide> $this->keyAttribute => [ <ide> public function add($key, $value, $minutes) <ide> * Increment the value of an item in the cache. <ide> * <ide> * @param string $key <del> * @param mixed $value <add> * @param mixed $value <ide> * @return int|bool <ide> */ <ide> public function increment($key, $value = 1) <ide> public function increment($key, $value = 1) <ide> * Decrement the value of an item in the cache. <ide> * <ide> * @param string $key <del> * @param mixed $value <add> * @param mixed $value <ide> * @return int|bool <ide> */ <ide> public function decrement($key, $value = 1) <ide> public function decrement($key, $value = 1) <ide> * Store an item in the cache indefinitely. <ide> * <ide> * @param string $key <del> * @param mixed $value <del> * @return void <add> * @param mixed $value <add> * @return bool <ide> */ <ide> public function forever($key, $value) <ide> {
1
Ruby
Ruby
avoid a new hash allocation
12815e0d44faf1154bebe5703577ff56c13688bc
<ide><path>activemodel/lib/active_model/validations/numericality.rb <ide> def validate_each(record, attr_name, value) <ide> option_value = record.send(option_value) if option_value.is_a?(Symbol) <ide> <ide> unless value.send(CHECKS[option], option_value) <del> record.errors.add(attr_name, option, filtered_options(value).merge(count: option_value)) <add> record.errors.add(attr_name, option, filtered_options(value).merge!(count: option_value)) <ide> end <ide> end <ide> end
1
Text
Text
fix minor issues reported in
e318c8a97a4adc2503d9c16a9af9f34df0e42d1b
<ide><path>doc/api/crypto.md <ide> console.log(encrypted); <ide> // Prints: ca981be48e90867604588e75d04feabb63cc007a8f8ad89b10616ed84d815504 <ide> ``` <ide> <del>### cipher.final([output_encoding]) <add>### cipher.final([outputEncoding]) <ide> <!-- YAML <ide> added: v0.1.94 <ide> --> <del>- `output_encoding` {string} <add>- `outputEncoding` {string} <ide> <del>Returns any remaining enciphered contents. If `output_encoding` <add>Returns any remaining enciphered contents. If `outputEncoding` <ide> parameter is one of `'latin1'`, `'base64'` or `'hex'`, a string is returned. <del>If an `output_encoding` is not provided, a [`Buffer`][] is returned. <add>If an `outputEncoding` is not provided, a [`Buffer`][] is returned. <ide> <ide> Once the `cipher.final()` method has been called, the `Cipher` object can no <ide> longer be used to encrypt data. Attempts to call `cipher.final()` more than <ide> the _authentication tag_ that has been computed from the given data. <ide> The `cipher.getAuthTag()` method should only be called after encryption has <ide> been completed using the [`cipher.final()`][] method. <ide> <del>### cipher.setAutoPadding([auto_padding]) <add>### cipher.setAutoPadding([autoPadding]) <ide> <!-- YAML <ide> added: v0.7.1 <ide> --> <del>- `auto_padding` {boolean} Defaults to `true`. <add>- `autoPadding` {boolean} Defaults to `true`. <ide> - Returns the {Cipher} for method chaining. <ide> <ide> When using block encryption algorithms, the `Cipher` class will automatically <ide> add padding to the input data to the appropriate block size. To disable the <ide> default padding call `cipher.setAutoPadding(false)`. <ide> <del>When `auto_padding` is `false`, the length of the entire input data must be a <add>When `autoPadding` is `false`, the length of the entire input data must be a <ide> multiple of the cipher's block size or [`cipher.final()`][] will throw an Error. <ide> Disabling automatic padding is useful for non-standard padding, for instance <ide> using `0x0` instead of PKCS padding. <ide> <ide> The `cipher.setAutoPadding()` method must be called before <ide> [`cipher.final()`][]. <ide> <del>### cipher.update(data[, input_encoding][, output_encoding]) <add>### cipher.update(data[, inputEncoding][, outputEncoding]) <ide> <!-- YAML <ide> added: v0.1.94 <ide> changes: <ide> - version: v6.0.0 <ide> pr-url: https://github.com/nodejs/node/pull/5522 <del> description: The default `input_encoding` changed from `binary` to `utf8`. <add> description: The default `inputEncoding` changed from `binary` to `utf8`. <ide> --> <ide> - `data` {string | Buffer | TypedArray | DataView} <del>- `input_encoding` {string} <del>- `output_encoding` {string} <add>- `inputEncoding` {string} <add>- `outputEncoding` {string} <ide> <del>Updates the cipher with `data`. If the `input_encoding` argument is given, <add>Updates the cipher with `data`. If the `inputEncoding` argument is given, <ide> its value must be one of `'utf8'`, `'ascii'`, or `'latin1'` and the `data` <del>argument is a string using the specified encoding. If the `input_encoding` <add>argument is a string using the specified encoding. If the `inputEncoding` <ide> argument is not given, `data` must be a [`Buffer`][], `TypedArray`, or <ide> `DataView`. If `data` is a [`Buffer`][], `TypedArray`, or `DataView`, then <del>`input_encoding` is ignored. <add>`inputEncoding` is ignored. <ide> <del>The `output_encoding` specifies the output format of the enciphered <del>data, and can be `'latin1'`, `'base64'` or `'hex'`. If the `output_encoding` <add>The `outputEncoding` specifies the output format of the enciphered <add>data, and can be `'latin1'`, `'base64'` or `'hex'`. If the `outputEncoding` <ide> is specified, a string using the specified encoding is returned. If no <del>`output_encoding` is provided, a [`Buffer`][] is returned. <add>`outputEncoding` is provided, a [`Buffer`][] is returned. <ide> <ide> The `cipher.update()` method can be called multiple times with new data until <ide> [`cipher.final()`][] is called. Calling `cipher.update()` after <ide> console.log(decrypted); <ide> // Prints: some clear text data <ide> ``` <ide> <del>### decipher.final([output_encoding]) <add>### decipher.final([outputEncoding]) <ide> <!-- YAML <ide> added: v0.1.94 <ide> --> <del>- `output_encoding` {string} <add>- `outputEncoding` {string} <ide> <del>Returns any remaining deciphered contents. If `output_encoding` <add>Returns any remaining deciphered contents. If `outputEncoding` <ide> parameter is one of `'latin1'`, `'ascii'` or `'utf8'`, a string is returned. <del>If an `output_encoding` is not provided, a [`Buffer`][] is returned. <add>If an `outputEncoding` is not provided, a [`Buffer`][] is returned. <ide> <ide> Once the `decipher.final()` method has been called, the `Decipher` object can <ide> no longer be used to decrypt data. Attempts to call `decipher.final()` more <ide> cipher text should be discarded due to failed authentication. <ide> The `decipher.setAuthTag()` method must be called before <ide> [`decipher.final()`][]. <ide> <del>### decipher.setAutoPadding([auto_padding]) <add>### decipher.setAutoPadding([autoPadding]) <ide> <!-- YAML <ide> added: v0.7.1 <ide> --> <del>- `auto_padding` {boolean} Defaults to `true`. <add>- `autoPadding` {boolean} Defaults to `true`. <ide> - Returns the {Cipher} for method chaining. <ide> <ide> When data has been encrypted without standard block padding, calling <ide> multiple of the ciphers block size. <ide> The `decipher.setAutoPadding()` method must be called before <ide> [`decipher.final()`][]. <ide> <del>### decipher.update(data[, input_encoding][, output_encoding]) <add>### decipher.update(data[, inputEncoding][, outputEncoding]) <ide> <!-- YAML <ide> added: v0.1.94 <ide> changes: <ide> - version: v6.0.0 <ide> pr-url: https://github.com/nodejs/node/pull/5522 <del> description: The default `input_encoding` changed from `binary` to `utf8`. <add> description: The default `inputEncoding` changed from `binary` to `utf8`. <ide> --> <ide> - `data` {string | Buffer | TypedArray | DataView} <del>- `input_encoding` {string} <del>- `output_encoding` {string} <add>- `inputEncoding` {string} <add>- `outputEncoding` {string} <ide> <del>Updates the decipher with `data`. If the `input_encoding` argument is given, <add>Updates the decipher with `data`. If the `inputEncoding` argument is given, <ide> its value must be one of `'latin1'`, `'base64'`, or `'hex'` and the `data` <del>argument is a string using the specified encoding. If the `input_encoding` <add>argument is a string using the specified encoding. If the `inputEncoding` <ide> argument is not given, `data` must be a [`Buffer`][]. If `data` is a <del>[`Buffer`][] then `input_encoding` is ignored. <add>[`Buffer`][] then `inputEncoding` is ignored. <ide> <del>The `output_encoding` specifies the output format of the enciphered <del>data, and can be `'latin1'`, `'ascii'` or `'utf8'`. If the `output_encoding` <add>The `outputEncoding` specifies the output format of the enciphered <add>data, and can be `'latin1'`, `'ascii'` or `'utf8'`. If the `outputEncoding` <ide> is specified, a string using the specified encoding is returned. If no <del>`output_encoding` is provided, a [`Buffer`][] is returned. <add>`outputEncoding` is provided, a [`Buffer`][] is returned. <ide> <ide> The `decipher.update()` method can be called multiple times with new data until <ide> [`decipher.final()`][] is called. Calling `decipher.update()` after <ide> const bobSecret = bob.computeSecret(aliceKey); <ide> assert.strictEqual(aliceSecret.toString('hex'), bobSecret.toString('hex')); <ide> ``` <ide> <del>### diffieHellman.computeSecret(other_public_key[, input_encoding][, output_encoding]) <add>### diffieHellman.computeSecret(otherPublicKey[, inputEncoding][, outputEncoding]) <ide> <!-- YAML <ide> added: v0.5.0 <ide> --> <del>- `other_public_key` {string | Buffer | TypedArray | DataView} <del>- `input_encoding` {string} <del>- `output_encoding` {string} <add>- `otherPublicKey` {string | Buffer | TypedArray | DataView} <add>- `inputEncoding` {string} <add>- `outputEncoding` {string} <ide> <del>Computes the shared secret using `other_public_key` as the other <add>Computes the shared secret using `otherPublicKey` as the other <ide> party's public key and returns the computed shared secret. The supplied <del>key is interpreted using the specified `input_encoding`, and secret is <del>encoded using specified `output_encoding`. Encodings can be <del>`'latin1'`, `'hex'`, or `'base64'`. If the `input_encoding` is not <del>provided, `other_public_key` is expected to be a [`Buffer`][], <add>key is interpreted using the specified `inputEncoding`, and secret is <add>encoded using specified `outputEncoding`. Encodings can be <add>`'latin1'`, `'hex'`, or `'base64'`. If the `inputEncoding` is not <add>provided, `otherPublicKey` is expected to be a [`Buffer`][], <ide> `TypedArray`, or `DataView`. <ide> <del>If `output_encoding` is given a string is returned; otherwise, a <add>If `outputEncoding` is given a string is returned; otherwise, a <ide> [`Buffer`][] is returned. <ide> <ide> ### diffieHellman.generateKeys([encoding]) <ide> Returns the Diffie-Hellman public key in the specified `encoding`, which <ide> can be `'latin1'`, `'hex'`, or `'base64'`. If `encoding` is provided a <ide> string is returned; otherwise a [`Buffer`][] is returned. <ide> <del>### diffieHellman.setPrivateKey(private_key[, encoding]) <add>### diffieHellman.setPrivateKey(privateKey[, encoding]) <ide> <!-- YAML <ide> added: v0.5.0 <ide> --> <del>- `private_key` {string | Buffer | TypedArray | DataView} <add>- `privateKey` {string | Buffer | TypedArray | DataView} <ide> - `encoding` {string} <ide> <ide> Sets the Diffie-Hellman private key. If the `encoding` argument is provided <del>and is either `'latin1'`, `'hex'`, or `'base64'`, `private_key` is expected <del>to be a string. If no `encoding` is provided, `private_key` is expected <add>and is either `'latin1'`, `'hex'`, or `'base64'`, `privateKey` is expected <add>to be a string. If no `encoding` is provided, `privateKey` is expected <ide> to be a [`Buffer`][], `TypedArray`, or `DataView`. <ide> <del>### diffieHellman.setPublicKey(public_key[, encoding]) <add>### diffieHellman.setPublicKey(publicKey[, encoding]) <ide> <!-- YAML <ide> added: v0.5.0 <ide> --> <del>- `public_key` {string | Buffer | TypedArray | DataView} <add>- `publicKey` {string | Buffer | TypedArray | DataView} <ide> - `encoding` {string} <ide> <ide> Sets the Diffie-Hellman public key. If the `encoding` argument is provided <del>and is either `'latin1'`, `'hex'` or `'base64'`, `public_key` is expected <del>to be a string. If no `encoding` is provided, `public_key` is expected <add>and is either `'latin1'`, `'hex'` or `'base64'`, `publicKey` is expected <add>to be a string. If no `encoding` is provided, `publicKey` is expected <ide> to be a [`Buffer`][], `TypedArray`, or `DataView`. <ide> <ide> ### diffieHellman.verifyError <ide> assert.strictEqual(aliceSecret.toString('hex'), bobSecret.toString('hex')); <ide> // OK <ide> ``` <ide> <del>### ecdh.computeSecret(other_public_key[, input_encoding][, output_encoding]) <add>### ecdh.computeSecret(otherPublicKey[, inputEncoding][, outputEncoding]) <ide> <!-- YAML <ide> added: v0.11.14 <ide> changes: <ide> - version: v6.0.0 <ide> pr-url: https://github.com/nodejs/node/pull/5522 <del> description: The default `input_encoding` changed from `binary` to `utf8`. <add> description: The default `inputEncoding` changed from `binary` to `utf8`. <ide> --> <del>- `other_public_key` {string | Buffer | TypedArray | DataView} <del>- `input_encoding` {string} <del>- `output_encoding` {string} <add>- `otherPublicKey` {string | Buffer | TypedArray | DataView} <add>- `inputEncoding` {string} <add>- `outputEncoding` {string} <ide> <del>Computes the shared secret using `other_public_key` as the other <add>Computes the shared secret using `otherPublicKey` as the other <ide> party's public key and returns the computed shared secret. The supplied <del>key is interpreted using specified `input_encoding`, and the returned secret <del>is encoded using the specified `output_encoding`. Encodings can be <del>`'latin1'`, `'hex'`, or `'base64'`. If the `input_encoding` is not <del>provided, `other_public_key` is expected to be a [`Buffer`][], `TypedArray`, or <add>key is interpreted using specified `inputEncoding`, and the returned secret <add>is encoded using the specified `outputEncoding`. Encodings can be <add>`'latin1'`, `'hex'`, or `'base64'`. If the `inputEncoding` is not <add>provided, `otherPublicKey` is expected to be a [`Buffer`][], `TypedArray`, or <ide> `DataView`. <ide> <del>If `output_encoding` is given a string will be returned; otherwise a <add>If `outputEncoding` is given a string will be returned; otherwise a <ide> [`Buffer`][] is returned. <ide> <ide> ### ecdh.generateKeys([encoding[, format]]) <ide> The `encoding` argument can be `'latin1'`, `'hex'`, or `'base64'`. If <ide> `encoding` is specified, a string is returned; otherwise a [`Buffer`][] is <ide> returned. <ide> <del>### ecdh.setPrivateKey(private_key[, encoding]) <add>### ecdh.setPrivateKey(privateKey[, encoding]) <ide> <!-- YAML <ide> added: v0.11.14 <ide> --> <del>- `private_key` {string | Buffer | TypedArray | DataView} <add>- `privateKey` {string | Buffer | TypedArray | DataView} <ide> - `encoding` {string} <ide> <ide> Sets the EC Diffie-Hellman private key. The `encoding` can be `'latin1'`, <del>`'hex'` or `'base64'`. If `encoding` is provided, `private_key` is expected <del>to be a string; otherwise `private_key` is expected to be a [`Buffer`][], <add>`'hex'` or `'base64'`. If `encoding` is provided, `privateKey` is expected <add>to be a string; otherwise `privateKey` is expected to be a [`Buffer`][], <ide> `TypedArray`, or `DataView`. <ide> <del>If `private_key` is not valid for the curve specified when the `ECDH` object was <add>If `privateKey` is not valid for the curve specified when the `ECDH` object was <ide> created, an error is thrown. Upon setting the private key, the associated <ide> public point (key) is also generated and set in the ECDH object. <ide> <del>### ecdh.setPublicKey(public_key[, encoding]) <add>### ecdh.setPublicKey(publicKey[, encoding]) <ide> <!-- YAML <ide> added: v0.11.14 <ide> deprecated: v5.2.0 <ide> --> <ide> <ide> > Stability: 0 - Deprecated <ide> <del>- `public_key` {string | Buffer | TypedArray | DataView} <add>- `publicKey` {string | Buffer | TypedArray | DataView} <ide> - `encoding` {string} <ide> <ide> Sets the EC Diffie-Hellman public key. Key encoding can be `'latin1'`, <del>`'hex'` or `'base64'`. If `encoding` is provided `public_key` is expected to <add>`'hex'` or `'base64'`. If `encoding` is provided `publicKey` is expected to <ide> be a string; otherwise a [`Buffer`][], `TypedArray`, or `DataView` is expected. <ide> <ide> Note that there is not normally a reason to call this method because `ECDH` <ide> a [`Buffer`][] is returned. <ide> The `Hash` object can not be used again after `hash.digest()` method has been <ide> called. Multiple calls will cause an error to be thrown. <ide> <del>### hash.update(data[, input_encoding]) <add>### hash.update(data[, inputEncoding]) <ide> <!-- YAML <ide> added: v0.1.92 <ide> changes: <ide> - version: v6.0.0 <ide> pr-url: https://github.com/nodejs/node/pull/5522 <del> description: The default `input_encoding` changed from `binary` to `utf8`. <add> description: The default `inputEncoding` changed from `binary` to `utf8`. <ide> --> <ide> - `data` {string | Buffer | TypedArray | DataView} <del>- `input_encoding` {string} <add>- `inputEncoding` {string} <ide> <ide> Updates the hash content with the given `data`, the encoding of which <del>is given in `input_encoding` and can be `'utf8'`, `'ascii'` or <add>is given in `inputEncoding` and can be `'utf8'`, `'ascii'` or <ide> `'latin1'`. If `encoding` is not provided, and the `data` is a string, an <ide> encoding of `'utf8'` is enforced. If `data` is a [`Buffer`][], `TypedArray`, or <del>`DataView`, then `input_encoding` is ignored. <add>`DataView`, then `inputEncoding` is ignored. <ide> <ide> This can be called many times with new data as it is streamed. <ide> <ide> provided a string is returned; otherwise a [`Buffer`][] is returned; <ide> The `Hmac` object can not be used again after `hmac.digest()` has been <ide> called. Multiple calls to `hmac.digest()` will result in an error being thrown. <ide> <del>### hmac.update(data[, input_encoding]) <add>### hmac.update(data[, inputEncoding]) <ide> <!-- YAML <ide> added: v0.1.94 <ide> changes: <ide> - version: v6.0.0 <ide> pr-url: https://github.com/nodejs/node/pull/5522 <del> description: The default `input_encoding` changed from `binary` to `utf8`. <add> description: The default `inputEncoding` changed from `binary` to `utf8`. <ide> --> <ide> - `data` {string | Buffer | TypedArray | DataView} <del>- `input_encoding` {string} <add>- `inputEncoding` {string} <ide> <ide> Updates the `Hmac` content with the given `data`, the encoding of which <del>is given in `input_encoding` and can be `'utf8'`, `'ascii'` or <add>is given in `inputEncoding` and can be `'utf8'`, `'ascii'` or <ide> `'latin1'`. If `encoding` is not provided, and the `data` is a string, an <ide> encoding of `'utf8'` is enforced. If `data` is a [`Buffer`][], `TypedArray`, or <del>`DataView`, then `input_encoding` is ignored. <add>`DataView`, then `inputEncoding` is ignored. <ide> <ide> This can be called many times with new data as it is streamed. <ide> <ide> pQhByd5eyj3lgZ7m7jbchtdgyOF8Io/1ng== <ide> console.log(sign.sign(privateKey).toString('hex')); <ide> ``` <ide> <del>### sign.sign(private_key[, output_format]) <add>### sign.sign(privateKey[, outputFormat]) <ide> <!-- YAML <ide> added: v0.1.92 <ide> changes: <ide> - version: v8.0.0 <ide> pr-url: https://github.com/nodejs/node/pull/11705 <ide> description: Support for RSASSA-PSS and additional options was added. <ide> --> <del>- `private_key` {string | Object} <add>- `privateKey` {string | Object} <ide> - `key` {string} <ide> - `passphrase` {string} <del>- `output_format` {string} <add>- `outputFormat` {string} <ide> <ide> Calculates the signature on all the data passed through using either <ide> [`sign.update()`][] or [`sign.write()`][stream-writable-write]. <ide> <del>The `private_key` argument can be an object or a string. If `private_key` is a <del>string, it is treated as a raw key with no passphrase. If `private_key` is an <add>The `privateKey` argument can be an object or a string. If `privateKey` is a <add>string, it is treated as a raw key with no passphrase. If `privateKey` is an <ide> object, it must contain one or more of the following properties: <ide> <ide> * `key`: {string} - PEM encoded private key (required) <ide> object, it must contain one or more of the following properties: <ide> size, `crypto.constants.RSA_PSS_SALTLEN_MAX_SIGN` (default) sets it to the <ide> maximum permissible value. <ide> <del>The `output_format` can specify one of `'latin1'`, `'hex'` or `'base64'`. If <del>`output_format` is provided a string is returned; otherwise a [`Buffer`][] is <add>The `outputFormat` can specify one of `'latin1'`, `'hex'` or `'base64'`. If <add>`outputFormat` is provided a string is returned; otherwise a [`Buffer`][] is <ide> returned. <ide> <ide> The `Sign` object can not be again used after `sign.sign()` method has been <ide> called. Multiple calls to `sign.sign()` will result in an error being thrown. <ide> <del>### sign.update(data[, input_encoding]) <add>### sign.update(data[, inputEncoding]) <ide> <!-- YAML <ide> added: v0.1.92 <ide> changes: <ide> - version: v6.0.0 <ide> pr-url: https://github.com/nodejs/node/pull/5522 <del> description: The default `input_encoding` changed from `binary` to `utf8`. <add> description: The default `inputEncoding` changed from `binary` to `utf8`. <ide> --> <ide> - `data` {string | Buffer | TypedArray | DataView} <del>- `input_encoding` {string} <add>- `inputEncoding` {string} <ide> <ide> Updates the `Sign` content with the given `data`, the encoding of which <del>is given in `input_encoding` and can be `'utf8'`, `'ascii'` or <add>is given in `inputEncoding` and can be `'utf8'`, `'ascii'` or <ide> `'latin1'`. If `encoding` is not provided, and the `data` is a string, an <ide> encoding of `'utf8'` is enforced. If `data` is a [`Buffer`][], `TypedArray`, or <del>`DataView`, then `input_encoding` is ignored. <add>`DataView`, then `inputEncoding` is ignored. <ide> <ide> This can be called many times with new data as it is streamed. <ide> <ide> console.log(verify.verify(publicKey, signature)); <ide> // Prints: true or false <ide> ``` <ide> <del>### verifier.update(data[, input_encoding]) <add>### verifier.update(data[, inputEncoding]) <ide> <!-- YAML <ide> added: v0.1.92 <ide> changes: <ide> - version: v6.0.0 <ide> pr-url: https://github.com/nodejs/node/pull/5522 <del> description: The default `input_encoding` changed from `binary` to `utf8`. <add> description: The default `inputEncoding` changed from `binary` to `utf8`. <ide> --> <ide> - `data` {string | Buffer | TypedArray | DataView} <del>- `input_encoding` {string} <add>- `inputEncoding` {string} <ide> <ide> Updates the `Verify` content with the given `data`, the encoding of which <del>is given in `input_encoding` and can be `'utf8'`, `'ascii'` or <add>is given in `inputEncoding` and can be `'utf8'`, `'ascii'` or <ide> `'latin1'`. If `encoding` is not provided, and the `data` is a string, an <ide> encoding of `'utf8'` is enforced. If `data` is a [`Buffer`][], `TypedArray`, or <del>`DataView`, then `input_encoding` is ignored. <add>`DataView`, then `inputEncoding` is ignored. <ide> <ide> This can be called many times with new data as it is streamed. <ide> <del>### verifier.verify(object, signature[, signature_format]) <add>### verifier.verify(object, signature[, signatureFormat]) <ide> <!-- YAML <ide> added: v0.1.92 <ide> changes: <ide> changes: <ide> --> <ide> - `object` {string | Object} <ide> - `signature` {string | Buffer | TypedArray | DataView} <del>- `signature_format` {string} <add>- `signatureFormat` {string} <ide> <ide> Verifies the provided data using the given `object` and `signature`. <ide> The `object` argument can be either a string containing a PEM encoded object, <ide> or an object with one or more of the following properties: <ide> determined automatically. <ide> <ide> The `signature` argument is the previously calculated signature for the data, in <del>the `signature_format` which can be `'latin1'`, `'hex'` or `'base64'`. <del>If a `signature_format` is specified, the `signature` is expected to be a <add>the `signatureFormat` which can be `'latin1'`, `'hex'` or `'base64'`. <add>If a `signatureFormat` is specified, the `signature` is expected to be a <ide> string; otherwise `signature` is expected to be a [`Buffer`][], <ide> `TypedArray`, or `DataView`. <ide> <ide> The `key` is the raw key used by the `algorithm` and `iv` is an <ide> [initialization vector][]. Both arguments must be `'utf8'` encoded strings or <ide> [buffers][`Buffer`]. <ide> <del>### crypto.createDiffieHellman(prime[, prime_encoding][, generator][, generator_encoding]) <add>### crypto.createDiffieHellman(prime[, primeEncoding][, generator][, generatorEncoding]) <ide> <!-- YAML <ide> added: v0.11.12 <ide> changes: <ide> changes: <ide> from `binary` to `utf8`. <ide> --> <ide> - `prime` {string | Buffer | TypedArray | DataView} <del>- `prime_encoding` {string} <add>- `primeEncoding` {string} <ide> - `generator` {number | string | Buffer | TypedArray | DataView} Defaults to `2`. <del>- `generator_encoding` {string} <add>- `generatorEncoding` {string} <ide> <ide> Creates a `DiffieHellman` key exchange object using the supplied `prime` and an <ide> optional specific `generator`. <ide> <ide> The `generator` argument can be a number, string, or [`Buffer`][]. If <ide> `generator` is not specified, the value `2` is used. <ide> <del>The `prime_encoding` and `generator_encoding` arguments can be `'latin1'`, <add>The `primeEncoding` and `generatorEncoding` arguments can be `'latin1'`, <ide> `'hex'`, or `'base64'`. <ide> <del>If `prime_encoding` is specified, `prime` is expected to be a string; otherwise <add>If `primeEncoding` is specified, `prime` is expected to be a string; otherwise <ide> a [`Buffer`][], `TypedArray`, or `DataView` is expected. <ide> <del>If `generator_encoding` is specified, `generator` is expected to be a string; <add>If `generatorEncoding` is specified, `generator` is expected to be a string; <ide> otherwise a number, [`Buffer`][], `TypedArray`, or `DataView` is expected. <ide> <del>### crypto.createDiffieHellman(prime_length[, generator]) <add>### crypto.createDiffieHellman(primeLength[, generator]) <ide> <!-- YAML <ide> added: v0.5.0 <ide> --> <del>- `prime_length` {number} <add>- `primeLength` {number} <ide> - `generator` {number | string | Buffer | TypedArray | DataView} Defaults to `2`. <ide> <ide> Creates a `DiffieHellman` key exchange object and generates a prime of <del>`prime_length` bits using an optional specific numeric `generator`. <add>`primeLength` bits using an optional specific numeric `generator`. <ide> If `generator` is not specified, the value `2` is used. <ide> <del>### crypto.createECDH(curve_name) <add>### crypto.createECDH(curveName) <ide> <!-- YAML <ide> added: v0.11.14 <ide> --> <del>- `curve_name` {string} <add>- `curveName` {string} <ide> <ide> Creates an Elliptic Curve Diffie-Hellman (`ECDH`) key exchange object using a <del>predefined curve specified by the `curve_name` string. Use <add>predefined curve specified by the `curveName` string. Use <ide> [`crypto.getCurves()`][] to obtain a list of available curve names. On recent <ide> OpenSSL releases, `openssl ecparam -list_curves` will also display the name <ide> and description of each available elliptic curve. <ide> const curves = crypto.getCurves(); <ide> console.log(curves); // ['Oakley-EC2N-3', 'Oakley-EC2N-4', ...] <ide> ``` <ide> <del>### crypto.getDiffieHellman(group_name) <add>### crypto.getDiffieHellman(groupName) <ide> <!-- YAML <ide> added: v0.7.5 <ide> --> <del>- `group_name` {string} <add>- `groupName` {string} <ide> <ide> Creates a predefined `DiffieHellman` key exchange object. The <ide> supported groups are: `'modp1'`, `'modp2'`, `'modp5'` (defined in <ide> console.log(key.toString('hex')); // '3745e48...aa39b34' <ide> An array of supported digest functions can be retrieved using <ide> [`crypto.getHashes()`][]. <ide> <del>### crypto.privateDecrypt(private_key, buffer) <add>### crypto.privateDecrypt(privateKey, buffer) <ide> <!-- YAML <ide> added: v0.11.14 <ide> --> <del>- `private_key` {Object | string} <add>- `privateKey` {Object | string} <ide> - `key` {string} A PEM encoded private key. <ide> - `passphrase` {string} An optional passphrase for the private key. <ide> - `padding` {crypto.constants} An optional padding value defined in <ide> `crypto.constants`, which may be: `crypto.constants.RSA_NO_PADDING`, <ide> `RSA_PKCS1_PADDING`, or `crypto.constants.RSA_PKCS1_OAEP_PADDING`. <ide> - `buffer` {Buffer | TypedArray | DataView} <ide> <del>Decrypts `buffer` with `private_key`. <add>Decrypts `buffer` with `privateKey`. <ide> <del>`private_key` can be an object or a string. If `private_key` is a string, it is <add>`privateKey` can be an object or a string. If `privateKey` is a string, it is <ide> treated as the key with no passphrase and will use `RSA_PKCS1_OAEP_PADDING`. <ide> <del>### crypto.privateEncrypt(private_key, buffer) <add>### crypto.privateEncrypt(privateKey, buffer) <ide> <!-- YAML <ide> added: v1.1.0 <ide> --> <del>- `private_key` {Object | string} <add>- `privateKey` {Object | string} <ide> - `key` {string} A PEM encoded private key. <ide> - `passphrase` {string} An optional passphrase for the private key. <ide> - `padding` {crypto.constants} An optional padding value defined in <ide> `crypto.constants`, which may be: `crypto.constants.RSA_NO_PADDING` or <ide> `RSA_PKCS1_PADDING`. <ide> - `buffer` {Buffer | TypedArray | DataView} <ide> <del>Encrypts `buffer` with `private_key`. <add>Encrypts `buffer` with `privateKey`. <ide> <del>`private_key` can be an object or a string. If `private_key` is a string, it is <add>`privateKey` can be an object or a string. If `privateKey` is a string, it is <ide> treated as the key with no passphrase and will use `RSA_PKCS1_PADDING`. <ide> <del>### crypto.publicDecrypt(public_key, buffer) <add>### crypto.publicDecrypt(publicKey, buffer) <ide> <!-- YAML <ide> added: v1.1.0 <ide> --> <del>- `public_key` {Object | string} <add>- `publicKey` {Object | string} <ide> - `key` {string} A PEM encoded private key. <ide> - `passphrase` {string} An optional passphrase for the private key. <ide> - `padding` {crypto.constants} An optional padding value defined in <ide> `crypto.constants`, which may be: `crypto.constants.RSA_NO_PADDING`, <ide> `RSA_PKCS1_PADDING`, or `crypto.constants.RSA_PKCS1_OAEP_PADDING`. <ide> - `buffer` {Buffer | TypedArray | DataView} <ide> <del>Decrypts `buffer` with `public_key`. <add>Decrypts `buffer` with `publicKey`. <ide> <del>`public_key` can be an object or a string. If `public_key` is a string, it is <add>`publicKey` can be an object or a string. If `publicKey` is a string, it is <ide> treated as the key with no passphrase and will use `RSA_PKCS1_PADDING`. <ide> <ide> Because RSA public keys can be derived from private keys, a private key may <ide> be passed instead of a public key. <ide> <del>### crypto.publicEncrypt(public_key, buffer) <add>### crypto.publicEncrypt(publicKey, buffer) <ide> <!-- YAML <ide> added: v0.11.14 <ide> --> <del>- `public_key` {Object | string} <add>- `publicKey` {Object | string} <ide> - `key` {string} A PEM encoded private key. <ide> - `passphrase` {string} An optional passphrase for the private key. <ide> - `padding` {crypto.constants} An optional padding value defined in <ide> `crypto.constants`, which may be: `crypto.constants.RSA_NO_PADDING`, <ide> `RSA_PKCS1_PADDING`, or `crypto.constants.RSA_PKCS1_OAEP_PADDING`. <ide> - `buffer` {Buffer | TypedArray | DataView} <ide> <del>Encrypts the content of `buffer` with `public_key` and returns a new <add>Encrypts the content of `buffer` with `publicKey` and returns a new <ide> [`Buffer`][] with encrypted content. <ide> <del>`public_key` can be an object or a string. If `public_key` is a string, it is <add>`publicKey` can be an object or a string. If `publicKey` is a string, it is <ide> treated as the key with no passphrase and will use `RSA_PKCS1_OAEP_PADDING`. <ide> <ide> Because RSA public keys can be derived from private keys, a private key may <ide> the `crypto`, `tls`, and `https` modules and are generally specific to OpenSSL. <ide> <ide> [`Buffer`]: buffer.html <ide> [`EVP_BytesToKey`]: https://www.openssl.org/docs/man1.0.2/crypto/EVP_BytesToKey.html <del>[`cipher.final()`]: #crypto_cipher_final_output_encoding <del>[`cipher.update()`]: #crypto_cipher_update_data_input_encoding_output_encoding <add>[`cipher.final()`]: #crypto_cipher_final_outputencoding <add>[`cipher.update()`]: #crypto_cipher_update_data_inputencoding_outputencoding <ide> [`crypto.createCipher()`]: #crypto_crypto_createcipher_algorithm_password <ide> [`crypto.createCipheriv()`]: #crypto_crypto_createcipheriv_algorithm_key_iv <ide> [`crypto.createDecipher()`]: #crypto_crypto_createdecipher_algorithm_password <ide> [`crypto.createDecipheriv()`]: #crypto_crypto_createdecipheriv_algorithm_key_iv <del>[`crypto.createDiffieHellman()`]: #crypto_crypto_creatediffiehellman_prime_prime_encoding_generator_generator_encoding <del>[`crypto.createECDH()`]: #crypto_crypto_createecdh_curve_name <add>[`crypto.createDiffieHellman()`]: #crypto_crypto_creatediffiehellman_prime_primeencoding_generator_generatorencoding <add>[`crypto.createECDH()`]: #crypto_crypto_createecdh_curvename <ide> [`crypto.createHash()`]: #crypto_crypto_createhash_algorithm <ide> [`crypto.createHmac()`]: #crypto_crypto_createhmac_algorithm_key <ide> [`crypto.createSign()`]: #crypto_crypto_createsign_algorithm <ide> the `crypto`, `tls`, and `https` modules and are generally specific to OpenSSL. <ide> [`crypto.pbkdf2()`]: #crypto_crypto_pbkdf2_password_salt_iterations_keylen_digest_callback <ide> [`crypto.randomBytes()`]: #crypto_crypto_randombytes_size_callback <ide> [`crypto.randomFill()`]: #crypto_crypto_randomfill_buffer_offset_size_callback <del>[`decipher.final()`]: #crypto_decipher_final_output_encoding <del>[`decipher.update()`]: #crypto_decipher_update_data_input_encoding_output_encoding <del>[`diffieHellman.setPublicKey()`]: #crypto_diffiehellman_setpublickey_public_key_encoding <add>[`decipher.final()`]: #crypto_decipher_final_outputencoding <add>[`decipher.update()`]: #crypto_decipher_update_data_inputencoding_outputencoding <add>[`diffieHellman.setPublicKey()`]: #crypto_diffiehellman_setpublickey_publickey_encoding <ide> [`ecdh.generateKeys()`]: #crypto_ecdh_generatekeys_encoding_format <del>[`ecdh.setPrivateKey()`]: #crypto_ecdh_setprivatekey_private_key_encoding <del>[`ecdh.setPublicKey()`]: #crypto_ecdh_setpublickey_public_key_encoding <add>[`ecdh.setPrivateKey()`]: #crypto_ecdh_setprivatekey_privatekey_encoding <add>[`ecdh.setPublicKey()`]: #crypto_ecdh_setpublickey_publickey_encoding <ide> [`hash.digest()`]: #crypto_hash_digest_encoding <del>[`hash.update()`]: #crypto_hash_update_data_input_encoding <add>[`hash.update()`]: #crypto_hash_update_data_inputencoding <ide> [`hmac.digest()`]: #crypto_hmac_digest_encoding <del>[`hmac.update()`]: #crypto_hmac_update_data_input_encoding <del>[`sign.sign()`]: #crypto_sign_sign_private_key_output_format <del>[`sign.update()`]: #crypto_sign_update_data_input_encoding <add>[`hmac.update()`]: #crypto_hmac_update_data_inputencoding <add>[`sign.sign()`]: #crypto_sign_sign_privatekey_outputformat <add>[`sign.update()`]: #crypto_sign_update_data_inputencoding <ide> [`tls.createSecureContext()`]: tls.html#tls_tls_createsecurecontext_options <del>[`verify.update()`]: #crypto_verifier_update_data_input_encoding <del>[`verify.verify()`]: #crypto_verifier_verify_object_signature_signature_format <add>[`verify.update()`]: #crypto_verifier_update_data_inputencoding <add>[`verify.verify()`]: #crypto_verifier_verify_object_signature_signatureformat <ide> [Caveats]: #crypto_support_for_weak_or_compromised_algorithms <ide> [Crypto Constants]: #crypto_crypto_constants_1 <ide> [HTML5's `keygen` element]: http://www.w3.org/TR/html5/forms.html#the-keygen-element <ide><path>doc/api/deprecations.md <ide> The DebugContext will be removed in V8 soon and will not be available in Node <ide> [`crypto.createCredentials()`]: crypto.html#crypto_crypto_createcredentials_details <ide> [`crypto.pbkdf2()`]: crypto.html#crypto_crypto_pbkdf2_password_salt_iterations_keylen_digest_callback <ide> [`domain`]: domain.html <del>[`ecdh.setPublicKey()`]: crypto.html#crypto_ecdh_setpublickey_public_key_encoding <add>[`ecdh.setPublicKey()`]: crypto.html#crypto_ecdh_setpublickey_publickey_encoding <ide> [`emitter.listenerCount(eventName)`]: events.html#events_emitter_listenercount_eventname <ide> [`fs.access()`]: fs.html#fs_fs_access_path_mode_callback <ide> [`fs.exists(path, callback)`]: fs.html#fs_fs_exists_path_callback <ide><path>doc/api/http.md <ide> added: v0.11.14 <ide> If a request has been aborted, this value is the time when the request was <ide> aborted, in milliseconds since 1 January 1970 00:00:00 UTC. <ide> <del>### request.end([data][, encoding][, callback]) <add>### request.end([data[, encoding]][, callback]) <ide> <!-- YAML <ide> added: v0.1.90 <ide> --> <ide><path>doc/api/path.md <ide> see [`path.sep`][]. <ide> <ide> The returned object will have the following properties: <ide> <del>* `root` {string} <ide> * `dir` {string} <add>* `root` {string} <ide> * `base` {string} <del>* `ext` {string} <ide> * `name` {string} <add>* `ext` {string} <ide> <ide> For example on POSIX: <ide> <ide><path>doc/api/tls.md <ide> when the server has no more open connections. <ide> ### server.connections <ide> <!-- YAML <ide> added: v0.3.2 <add>deprecated: v0.9.7 <ide> --> <ide> <add>> Stability: 0 - Deprecated: Use [`server.getConnections()`][] instead. <add> <ide> Returns the current number of concurrent connections on the server. <ide> <ide> ### server.getTicketKeys() <ide> if called on a server socket. The supported types are `'DH'` and `'ECDH'`. The <ide> <ide> For Example: `{ type: 'ECDH', name: 'prime256v1', size: 256 }` <ide> <del>### tlsSocket.getPeerCertificate([ detailed ]) <add>### tlsSocket.getPeerCertificate([detailed]) <ide> <!-- YAML <ide> added: v0.11.4 <ide> --> <ide> where `secure_socket` has the same API as `pair.cleartext`. <ide> [`net.Server.address()`]: net.html#net_server_address <ide> [`net.Server`]: net.html#net_class_net_server <ide> [`net.Socket`]: net.html#net_class_net_socket <add>[`server.getConnections()`]: net.html#net_server_getconnections_callback <ide> [`tls.DEFAULT_ECDH_CURVE`]: #tls_tls_default_ecdh_curve <ide> [`tls.TLSSocket.getPeerCertificate()`]: #tls_tlssocket_getpeercertificate_detailed <ide> [`tls.TLSSocket`]: #tls_class_tls_tlssocket <ide><path>doc/api/vm.md <ide> console.log(util.inspect(sandbox)); <ide> event loops and corresponding threads being started, which have a non-zero <ide> performance overhead. <ide> <del>### script.runInNewContext([sandbox][, options]) <add>### script.runInNewContext([sandbox[, options]]) <ide> <!-- YAML <ide> added: v0.3.1 <ide> --> <ide> According to the [V8 Embedder's Guide][]: <ide> When the method `vm.createContext()` is called, the `sandbox` object that is <ide> passed in (or a newly created object if `sandbox` is `undefined`) is associated <ide> internally with a new instance of a V8 Context. This V8 Context provides the <del>`code` run using the `vm` modules methods with an isolated global environment <add>`code` run using the `vm` module's methods with an isolated global environment <ide> within which it can operate. The process of creating the V8 Context and <ide> associating it with the `sandbox` object is what this document refers to as <ide> "contextifying" the `sandbox`. <ide><path>doc/api/zlib.md <ide> Provides an object enumerating Zlib-related constants. <ide> added: v0.5.8 <ide> --> <ide> <del>Returns a new [Deflate][] object with an [options][]. <add>Creates and returns a new [Deflate][] object with the given [options][]. <ide> <ide> ## zlib.createDeflateRaw([options]) <ide> <!-- YAML <ide> added: v0.5.8 <ide> --> <ide> <del>Returns a new [DeflateRaw][] object with an [options][]. <add>Creates and returns a new [DeflateRaw][] object with the given [options][]. <ide> <ide> *Note*: The zlib library rejects requests for 256-byte windows (i.e., <ide> `{ windowBits: 8 }` in `options`). An `Error` will be thrown when creating <ide> a [DeflateRaw][] object with this specific value of the `windowBits` option. <ide> added: v0.5.8 <ide> --> <ide> <del>Returns a new [Gunzip][] object with an [options][]. <add>Creates and returns a new [Gunzip][] object with the given [options][]. <ide> <ide> ## zlib.createGzip([options]) <ide> <!-- YAML <ide> added: v0.5.8 <ide> --> <ide> <del>Returns a new [Gzip][] object with an [options][]. <add>Creates and returns a new [Gzip][] object with the given [options][]. <ide> <ide> ## zlib.createInflate([options]) <ide> <!-- YAML <ide> added: v0.5.8 <ide> --> <ide> <del>Returns a new [Inflate][] object with an [options][]. <add>Creates and returns a new [Inflate][] object with the given [options][]. <ide> <ide> ## zlib.createInflateRaw([options]) <ide> <!-- YAML <ide> added: v0.5.8 <ide> --> <ide> <del>Returns a new [InflateRaw][] object with an [options][]. <add>Creates and returns a new [InflateRaw][] object with the given [options][]. <ide> <ide> ## zlib.createUnzip([options]) <ide> <!-- YAML <ide> added: v0.5.8 <ide> --> <ide> <del>Returns a new [Unzip][] object with an [options][]. <add>Creates and returns a new [Unzip][] object with the given [options][]. <ide> <ide> ## Convenience Methods <ide>
7
PHP
PHP
fix cache minutes
93baad51c57176d8363b3720b57415c3c4a669fe
<ide><path>src/Illuminate/Cache/Repository.php <ide> protected function getMinutes($duration) <ide> if ($duration instanceof DateTime) <ide> { <ide> $duration = Carbon::instance($duration); <del> } <ide> <del> if ($duration instanceof Carbon) <del> { <ide> return max(0, Carbon::now()->diffInMinutes($duration, false)); <ide> } <ide> else <ide> { <del> return intval($duration); <add> return is_string($duration) ? intval($duration) : $duration; <ide> } <ide> } <ide>
1
Javascript
Javascript
fix documentation on what ember.tryinvoke returns
b947b89ab37c3baabf8182f3592570a9da11f6d9
<ide><path>packages/ember-metal/lib/utils.js <ide> Ember.canInvoke = canInvoke; <ide> @param {String} methodName The method name to check for <ide> @param {Array} args The arguments to pass to the method <ide> <del> @returns {Boolean} true if the method does not return false <del> @returns {Boolean} false otherwise <add> @returns {*} whatever the invoked function returns if it can be invoked <ide> */ <ide> Ember.tryInvoke = function(obj, methodName, args) { <ide> if (canInvoke(obj, methodName)) {
1
Python
Python
expand japanese requirements warning
4724fa4cf4b24be92a15c39c564d571eeae1470a
<ide><path>spacy/lang/ja/__init__.py <ide> def try_sudachi_import(split_mode="A"): <ide> return tok <ide> except ImportError: <ide> raise ImportError( <del> "Japanese support requires SudachiPy: " "https://github.com/WorksApplications/SudachiPy" <add> "Japanese support requires SudachiPy and SudachiDict-core " <add> "(https://github.com/WorksApplications/SudachiPy). " <add> "Install with `pip install sudachipy sudachidict_core` or " <add> "install spaCy with `pip install spacy[ja]`." <ide> ) <ide> <ide>
1
Python
Python
fix qa example
fb6cccb86360f5d9ada2f177e914b28ff6bcaac7
<ide><path>src/transformers/modeling_electra.py <ide> def forward( <ide> model = ElectraForQuestionAnswering.from_pretrained('google/electra-base-discriminator') <ide> <ide> question, text = "Who was Jim Henson?", "Jim Henson was a nice puppet" <del> input_ids = tokenizer.encode(question, text) <del> start_scores, end_scores = model(torch.tensor([input_ids])) <add> encoding = tokenizer.encode_plus(question, text, return_tensors='pt') <add> input_ids, token_type_ids = encoding['input_ids'], encoding['token_type_ids'] <add> start_scores, end_scores = model(input_ids, token_type_ids=token_type_ids) <ide> <del> all_tokens = tokenizer.convert_ids_to_tokens(input_ids) <add> all_tokens = tokenizer.convert_ids_to_tokens(input_ids.squeeze(0)) <ide> answer = ' '.join(all_tokens[torch.argmax(start_scores) : torch.argmax(end_scores)+1]) <ide> <ide> """
1
Ruby
Ruby
pull regexpoffsets in to a method
56f734a3615ad522a1dbaafc7442f19e4651640b
<ide><path>actionpack/lib/action_dispatch/journey/path/pattern.rb <ide> def optional_names <ide> }.map(&:name).uniq <ide> end <ide> <del> class RegexpOffsets < Journey::Visitors::Visitor # :nodoc: <del> attr_reader :offsets <del> <del> def initialize(matchers) <del> @matchers = matchers <del> @capture_count = [0] <del> end <del> <del> def visit(node) <del> super <del> @capture_count <del> end <del> <del> def visit_SYMBOL(node) <del> node = node.to_sym <del> <del> if @matchers.key?(node) <del> re = /#{@matchers[node]}|/ <del> @capture_count.push((re.match('').length - 1) + (@capture_count.last || 0)) <del> else <del> @capture_count << (@capture_count.last || 0) <del> end <del> end <del> end <del> <ide> class AnchoredRegexp < Journey::Visitors::Visitor # :nodoc: <ide> def initialize(separator, matchers) <ide> @separator = separator <ide> def regexp_visitor <ide> def offsets <ide> return @offsets if @offsets <ide> <del> viz = RegexpOffsets.new(@requirements) <del> @offsets = viz.accept(spec) <add> @offsets = [0] <add> <add> spec.find_all(&:symbol?).each do |node| <add> node = node.to_sym <add> <add> if @requirements.key?(node) <add> re = /#{@requirements[node]}|/ <add> @offsets.push((re.match('').length - 1) + @offsets.last) <add> else <add> @offsets << @offsets.last <add> end <add> end <add> <add> @offsets <ide> end <ide> end <ide> end
1
Text
Text
fix nits in net.md
954bf56c1e9a4a1c195114f61d9b0fe39c80ca2e
<ide><path>doc/api/net.md <ide> as a string. <ide> const server = net.createServer((socket) => { <ide> socket.end('goodbye\n'); <ide> }).on('error', (err) => { <del> // handle errors here <add> // Handle errors here. <ide> throw err; <ide> }); <ide> <ide> Don't call `server.address()` until the `'listening'` event has been emitted. <ide> added: v0.1.90 <ide> --> <ide> <del>* `callback` {Function} Called when the server is closed <add>* `callback` {Function} Called when the server is closed. <ide> * Returns: {net.Server} <ide> <ide> Stops the server from accepting new connections and keeps existing <ide> deprecated: v0.9.7 <ide> <ide> > Stability: 0 - Deprecated: Use [`server.getConnections()`][] instead. <ide> <add>* {integer|null} <add> <ide> The number of concurrent connections on the server. <ide> <ide> This becomes `null` when sending a socket to a child with <ide> changes: <ide> functions. <ide> * `exclusive` {boolean} **Default:** `false` <ide> * `readableAll` {boolean} For IPC servers makes the pipe readable <del> for all users. **Default:** `false` <add> for all users. **Default:** `false`. <ide> * `writableAll` {boolean} For IPC servers makes the pipe writable <del> for all users. **Default:** `false` <add> for all users. **Default:** `false`. <ide> * `ipv6Only` {boolean} For TCP servers, setting `ipv6Only` to `true` will <ide> disable dual-stack support, i.e., binding to host `::` won't make <ide> `0.0.0.0` be bound. **Default:** `false`. <ide> added: v5.7.0 <ide> added: v0.2.0 <ide> --> <ide> <add>* {integer} <add> <ide> Set this property to reject connections when the server's connection count gets <ide> high. <ide> <ide> socket as reported by the operating system: <ide> added: v0.3.8 <ide> --> <ide> <add>* {integer} <add> <ide> `net.Socket` has the property that `socket.write()` always works. This is to <ide> help users get up and running quickly. The computer cannot always keep up <ide> with the amount of data that is written to a socket - the network connection <ide> Users who experience large or growing `bufferSize` should attempt to <ide> added: v0.5.3 <ide> --> <ide> <add>* {integer} <add> <ide> The amount of received bytes. <ide> <ide> ### socket.bytesWritten <ide> <!-- YAML <ide> added: v0.5.3 <ide> --> <ide> <add>* {integer} <add> <ide> The amount of bytes sent. <ide> <ide> ### socket.connect() <ide> const net = require('net'); <ide> net.connect({ <ide> port: 80, <ide> onread: { <del> // Reuses a 4KiB Buffer for every read from the socket <add> // Reuses a 4KiB Buffer for every read from the socket. <ide> buffer: Buffer.alloc(4 * 1024), <ide> callback: function(nread, buf) { <del> // Received data is available in `buf` from 0 to `nread` <add> // Received data is available in `buf` from 0 to `nread`. <ide> console.log(buf.toString('utf8', 0, nread)); <ide> } <ide> } <ide> called with `{port: port, host: host}` as `options`. <ide> added: v6.1.0 <ide> --> <ide> <add>* {boolean} <add> <ide> If `true`, <ide> [`socket.connect(options[, connectListener])`][`socket.connect(options)`] was <ide> called and has not yet finished. It will stay `true` until the socket becomes <ide> listeners for that event will receive `exception` as an argument. <ide> * {boolean} Indicates if the connection is destroyed or not. Once a <ide> connection is destroyed no further data can be transferred using it. <ide> <del>### socket.end([data][, encoding][, callback]) <add>### socket.end([data[, encoding]][, callback]) <ide> <!-- YAML <ide> added: v0.1.90 <ide> --> <ide> If `data` is specified, it is equivalent to calling <ide> added: v0.9.6 <ide> --> <ide> <add>* {string} <add> <ide> The string representation of the local IP address the remote client is <ide> connecting on. For example, in a server listening on `'0.0.0.0'`, if a client <ide> connects on `'192.168.1.1'`, the value of `socket.localAddress` would be <ide> connects on `'192.168.1.1'`, the value of `socket.localAddress` would be <ide> added: v0.9.6 <ide> --> <ide> <add>* {integer} <add> <ide> The numeric representation of the local port. For example, `80` or `21`. <ide> <ide> ### socket.pause() <ide> If the socket is `ref`ed calling `ref` again will have no effect. <ide> added: v0.5.10 <ide> --> <ide> <add>* {string} <add> <ide> The string representation of the remote IP address. For example, <ide> `'74.125.127.100'` or `'2001:4860:a005::68'`. Value may be `undefined` if <ide> the socket is destroyed (for example, if the client disconnected). <ide> the socket is destroyed (for example, if the client disconnected). <ide> added: v0.11.14 <ide> --> <ide> <add>* {string} <add> <ide> The string representation of the remote IP family. `'IPv4'` or `'IPv6'`. <ide> <ide> ### socket.remotePort <ide> <!-- YAML <ide> added: v0.5.10 <ide> --> <ide> <add>* {integer} <add> <ide> The numeric representation of the remote port. For example, `80` or `21`. <ide> <ide> ### socket.resume() <ide> added: v0.7.0 <ide> <ide> * `options` {Object} <ide> * `connectListener` {Function} <add>* Returns: {net.Socket} <ide> <ide> Alias to <ide> [`net.createConnection(options[, connectListener])`][`net.createConnection(options)`]. <ide> added: v0.1.90 <ide> <ide> * `path` {string} <ide> * `connectListener` {Function} <add>* Returns: {net.Socket} <ide> <ide> Alias to <ide> [`net.createConnection(path[, connectListener])`][`net.createConnection(path)`]. <ide> added: v0.1.90 <ide> * `port` {number} <ide> * `host` {string} <ide> * `connectListener` {Function} <add>* Returns: {net.Socket} <ide> <ide> Alias to <ide> [`net.createConnection(port[, host][, connectListener])`][`net.createConnection(port, host)`]. <ide> in the [`net.createServer()`][] section: <ide> ```js <ide> const net = require('net'); <ide> const client = net.createConnection({ port: 8124 }, () => { <del> // 'connect' listener <add> // 'connect' listener. <ide> console.log('connected to server!'); <ide> client.write('world!\r\n'); <ide> }); <ide> added: v0.1.90 <ide> * `connectListener` {Function} Common parameter of the <ide> [`net.createConnection()`][] functions, an "once" listener for the <ide> `'connect'` event on the initiating socket. Will be passed to <del> [`socket.connect(path[, connectListener])`][`socket.connect(port, host)`]. <add> [`socket.connect(port[, host][, connectListener])`][`socket.connect(port, host)`]. <ide> * Returns: {net.Socket} The newly created socket used to start the connection. <ide> <ide> Initiates a TCP connection. <ide> on port 8124: <ide> ```js <ide> const net = require('net'); <ide> const server = net.createServer((c) => { <del> // 'connection' listener <add> // 'connection' listener. <ide> console.log('client connected'); <ide> c.on('end', () => { <ide> console.log('client disconnected'); <ide> added: v0.3.0 <ide> <ide> Returns `true` if input is a version 6 IP address, otherwise returns `false`. <ide> <add>[IPC]: #net_ipc_support <add>[Identifying paths for IPC connections]: #net_identifying_paths_for_ipc_connections <add>[Readable Stream]: stream.html#stream_class_stream_readable <ide> [`'close'`]: #net_event_close <ide> [`'connect'`]: #net_event_connect <ide> [`'connection'`]: #net_event_connection <ide> Returns `true` if input is a version 6 IP address, otherwise returns `false`. <ide> [`socket.setEncoding()`]: #net_socket_setencoding_encoding <ide> [`socket.setTimeout()`]: #net_socket_settimeout_timeout_callback <ide> [`socket.setTimeout(timeout)`]: #net_socket_settimeout_timeout_callback <del>[IPC]: #net_ipc_support <del>[Identifying paths for IPC connections]: #net_identifying_paths_for_ipc_connections <del>[Readable Stream]: stream.html#stream_class_stream_readable <ide> [half-closed]: https://tools.ietf.org/html/rfc1122 <ide> [stream_writable_write]: stream.html#stream_writable_write_chunk_encoding_callback <ide> [unspecified IPv4 address]: https://en.wikipedia.org/wiki/0.0.0.0
1
Java
Java
add the necessary hints for use of cglib proxies
3086d90e7dc3bcff0cdd2e1c4c7eef401b0adc1e
<ide><path>spring-context/src/main/java/org/springframework/context/aot/GeneratedClassHandler.java <ide> class GeneratedClassHandler implements BiConsumer<String, byte[]> { <ide> <ide> private static final Consumer<Builder> asCglibProxy = hint -> <del> hint.withMembers(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS); <add> hint.withMembers(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, <add> MemberCategory.INVOKE_DECLARED_METHODS, <add> MemberCategory.DECLARED_FIELDS); <ide> <ide> private final RuntimeHints runtimeHints; <ide> <ide><path>spring-context/src/test/java/org/springframework/context/aot/GeneratedClassHandlerTests.java <ide> void handlerGenerateRuntimeHints() { <ide> String className = "com.example.Test$$Proxy$$1"; <ide> this.handler.accept(className, TEST_CONTENT); <ide> assertThat(RuntimeHintsPredicates.reflection().onType(TypeReference.of(className)) <del> .withMemberCategory(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS)) <add> .withMemberCategories(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, <add> MemberCategory.INVOKE_DECLARED_METHODS, MemberCategory.DECLARED_FIELDS)) <ide> .accepts(this.generationContext.getRuntimeHints()); <ide> } <ide>
2
Javascript
Javascript
propagate dirty state to parent forms
04329151d2df833f803629cefa781aa6409fe6a5
<ide><path>src/ng/directive/form.js <ide> function FormController(element, attrs) { <ide> element.removeClass(PRISTINE_CLASS).addClass(DIRTY_CLASS); <ide> form.$dirty = true; <ide> form.$pristine = false; <add> parentForm.$setDirty(); <ide> }; <ide> <ide> } <ide><path>test/ng/directive/formSpec.js <ide> describe('form', function() { <ide> inputB.$setValidity('MyError', true); <ide> expect(parent.$error.MyError).toBe(false); <ide> expect(child.$error.MyError).toBe(false); <add> <add> child.$setDirty(); <add> expect(parent.$dirty).toBeTruthy(); <ide> }); <ide> <ide>
2
Ruby
Ruby
fix handling of xquartz 2.8.0+
ab455d1f38220a358ec67b3bc32d5defa727ae80
<ide><path>Library/Homebrew/os/mac/xquartz.rb <ide> module XQuartz <ide> <ide> module_function <ide> <del> DEFAULT_BUNDLE_PATH = Pathname("Applications/Utilities/XQuartz.app").freeze <add> DEFAULT_BUNDLE_PATH = Pathname("/Applications/Utilities/XQuartz.app").freeze <add> NEW_BUNDLE_PKG_ID = "org.xquartz.X11" <ide> FORGE_BUNDLE_ID = "org.macosforge.xquartz.X11" <ide> FORGE_PKG_ID = "org.macosforge.xquartz.pkg" <ide> <ide> def bundle_path <ide> <ide> # Ask Spotlight where XQuartz is. If the user didn't install XQuartz <ide> # in the conventional place, this is our only option. <del> MacOS.app_with_bundle_id(FORGE_BUNDLE_ID) <add> MacOS.app_with_bundle_id(NEW_BUNDLE_PKG_ID, FORGE_BUNDLE_ID) <ide> end <ide> <ide> def version_from_mdls(path) <ide> def version_from_mdls(path) <ide> # Upstream XQuartz *does* have a pkg-info entry, so if we can't get it <ide> # from mdls, we can try pkgutil. This is very slow. <ide> def version_from_pkgutil <del> str = MacOS.pkgutil_info(FORGE_PKG_ID)[/version: (\d\.\d\.\d+)$/, 1] <del> PKGINFO_VERSION_MAP.fetch(str, str) <add> [NEW_BUNDLE_PKG_ID, FORGE_PKG_ID].each do |id| <add> str = MacOS.pkgutil_info(id)[/version: (\d\.\d\.\d+)$/, 1] <add> return PKGINFO_VERSION_MAP.fetch(str, str) if str <add> end <add> <add> nil <ide> end <ide> <ide> def prefix
1
Javascript
Javascript
evaluate new regexp
9d36bd46b35bae2824033c96a32c850188804533
<ide><path>lib/javascript/BasicEvaluatedExpression.js <ide> class BasicEvaluatedExpression { <ide> } <ide> } <ide> <add>/** <add> * @param {string} flags regexp flags <add> * @returns {boolean} is valid flags <add> */ <add>BasicEvaluatedExpression.isValidRegExpFlags = flags => { <add> const len = flags.length; <add> <add> if (len === 0) return true; <add> if (len > 4) return false; <add> <add> const remaining = new Set([ <add> 103 /* g */, <add> 105 /* i */, <add> 109 /* m */, <add> 121 /* y */ <add> ]); <add> <add> for (let i = 0; i < len; i++) <add> if (!remaining.delete(flags.charCodeAt(i))) return false; <add> <add> return true; <add>}; <add> <ide> module.exports = BasicEvaluatedExpression; <ide><path>lib/javascript/JavascriptParser.js <ide> const BasicEvaluatedExpression = require("./BasicEvaluatedExpression"); <ide> /** @typedef {import("estree").MetaProperty} MetaPropertyNode */ <ide> /** @typedef {import("estree").MethodDefinition} MethodDefinitionNode */ <ide> /** @typedef {import("estree").ModuleDeclaration} ModuleDeclarationNode */ <add>/** @typedef {import("estree").NewExpression} NewExpressionNode */ <ide> /** @typedef {import("estree").Node} AnyNode */ <ide> /** @typedef {import("estree").Program} ProgramNode */ <ide> /** @typedef {import("estree").Statement} StatementNode */ <ide> class JavascriptParser extends Parser { <ide> .setRange(expr.range); <ide> } <ide> }); <add> this.hooks.evaluate.for("NewExpression").tap("JavascriptParser", _expr => { <add> const expr = /** @type {NewExpressionNode} */ (_expr); <add> const callee = expr.callee; <add> if ( <add> callee.type !== "Identifier" || <add> callee.name !== "RegExp" || <add> expr.arguments.length > 2 <add> ) <add> return; <add> <add> let regExp, flags; <add> const arg1 = expr.arguments[0]; <add> <add> if (arg1) { <add> if (arg1.type === "SpreadElement") return; <add> <add> const evaluatedRegExp = this.evaluateExpression(arg1); <add> <add> if (!evaluatedRegExp) return; <add> <add> regExp = evaluatedRegExp.asString(); <add> <add> if (!regExp) return; <add> } else { <add> return new BasicEvaluatedExpression() <add> .setRegExp(new RegExp("")) <add> .setRange(expr.range); <add> } <add> <add> const arg2 = expr.arguments[1]; <add> <add> if (arg2) { <add> if (arg2.type === "SpreadElement") return; <add> <add> const evaluatedFlags = this.evaluateExpression(arg2); <add> <add> if (!evaluatedFlags) return; <add> <add> flags = evaluatedFlags.asString(); <add> <add> if ( <add> flags === undefined || <add> !BasicEvaluatedExpression.isValidRegExpFlags(flags) <add> ) <add> return; <add> } <add> <add> return new BasicEvaluatedExpression() <add> .setRegExp(flags ? new RegExp(regExp, flags) : new RegExp(regExp)) <add> .setRange(expr.range); <add> }); <ide> this.hooks.evaluate <ide> .for("LogicalExpression") <ide> .tap("JavascriptParser", _expr => { <ide><path>test/cases/parsing/evaluate/index.js <ide> it("should allow resourceFragment in context", function () { <ide> expect(fn("index")).toEqual("#resourceFragment"); <ide> expect(fn("returnRF")).toBe("#.."); <ide> }); <add> <add>it("should try to evaluate new RegExp()", function () { <add> function expectAOnly (r) { <add> r.keys().forEach(key => { <add> expect(r(key)).toBe(1); <add> }); <add> } <add> <add> expectAOnly( <add> require.context("./regexp", false, new RegExp('(?<!filtered)\\.js$', "")) <add> ); <add> expectAOnly( <add> require.context("./regexp", false, new RegExp(`(?<!${"filtered"})\\.js$`, "i")) <add> ); <add>}); <ide><path>test/cases/parsing/evaluate/regexp/a.filtered.js <add>module.exports = 2; <ide><path>test/cases/parsing/evaluate/regexp/a.js <add>module.exports = 1;
5
Ruby
Ruby
incorporate suggestions from feedback
63aa1920883841fb0d6eb0c5513de63406d91879
<ide><path>Library/Homebrew/formula_cellar_checks.rb <ide> def check_cpuid_instruction(formula) <ide> objdump ||= Formula["binutils"].opt_bin/"objdump" if Formula["binutils"].any_version_installed? <ide> objdump ||= which("objdump") <ide> objdump ||= which("objdump", ENV["HOMEBREW_PATH"]) <del> objdump ||= begin <del> # If the system provides no `objdump`, install binutils instead of llvm since <del> # binutils is smaller and has fewer dependencies. <del> ohai "Installing `binutils` for `cpuid` instruction check..." <del> safe_system HOMEBREW_BREW_FILE, "install", "binutils" <del> Formula["binutils"].opt_bin/"objdump" <add> <add> unless objdump <add> return <<~EOS <add> No `objdump` found, so cannot check for a `cpuid` instruction. Install `objdump` with <add> brew install binutils <add> EOS <ide> end <ide> <ide> keg = Keg.new(formula.prefix) <del> has_cpuid_instruction = false <del> keg.binary_executable_or_library_files.each do |file| <del> has_cpuid_instruction = cpuid_instruction?(file, objdump) <del> break if has_cpuid_instruction <add> has_cpuid_instruction = keg.binary_executable_or_library_files.any? do |file| <add> cpuid_instruction?(file, objdump) <ide> end <ide> return if has_cpuid_instruction <ide> <ide> def relative_glob(dir, pattern) <ide> end <ide> <ide> def cpuid_instruction?(file, objdump = "objdump") <add> @instruction_column_index ||= {} <add> @instruction_column_index[objdump] ||= if Utils.popen_read(objdump, "--version").include? "LLVM" <add> 1 # `llvm-objdump` or macOS `objdump` <add> else <add> 2 # GNU binutils `objdump` <add> end <add> <ide> has_cpuid_instruction = false <ide> Utils.popen_read(objdump, "--disassemble", file) do |io| <ide> until io.eof? <del> has_cpuid_instruction = io.readline.include? "cpuid" <add> instruction = io.readline.split("\t")[@instruction_column_index[objdump]]&.chomp <add> has_cpuid_instruction = instruction.match?(/^cpuid(\s+|$)/) if instruction <ide> break if has_cpuid_instruction <ide> end <ide> end
1
Javascript
Javascript
add missing tests for animated.forkevent
f0d35904c9a1454569bd4b797bec305c843f9bda
<ide><path>Libraries/Animated/src/__tests__/Animated-test.js <ide> describe('Animated tests', () => { <ide> expect(listener.mock.calls.length).toBe(1); <ide> expect(listener).toBeCalledWith({foo: 42}); <ide> }); <del> it('should call forked event listeners', () => { <add> it('should call forked event listeners, with Animated.event() listener', () => { <ide> const value = new Animated.Value(0); <ide> const listener = jest.fn(); <ide> const handler = Animated.event([{foo: value}], {listener}); <ide> describe('Animated tests', () => { <ide> expect(listener2.mock.calls.length).toBe(1); <ide> expect(listener2).toBeCalledWith({foo: 42}); <ide> }); <add> it('should call forked event listeners, with js listener', () => { <add> const listener = jest.fn(); <add> const listener2 = jest.fn(); <add> const forkedHandler = Animated.forkEvent(listener, listener2); <add> forkedHandler({foo: 42}); <add> expect(listener.mock.calls.length).toBe(1); <add> expect(listener).toBeCalledWith({foo: 42}); <add> expect(listener2.mock.calls.length).toBe(1); <add> expect(listener2).toBeCalledWith({foo: 42}); <add> }); <add> it('should call forked event listeners, with undefined listener', () => { <add> const listener = undefined; <add> const listener2 = jest.fn(); <add> const forkedHandler = Animated.forkEvent(listener, listener2); <add> forkedHandler({foo: 42}); <add> expect(listener2.mock.calls.length).toBe(1); <add> expect(listener2).toBeCalledWith({foo: 42}); <add> }); <ide> }); <ide> <ide> describe('Animated Interactions', () => {
1
Javascript
Javascript
use a for loop instead of foreach() in dispatch()
5b586080b43ca233f78d56cbadf706c933fefd19
<ide><path>src/createStore.js <ide> export default function createStore(reducer, initialState, enhancer) { <ide> isDispatching = false <ide> } <ide> <del> listeners.slice().forEach(listener => listener()) <add> var currentListeners = listeners.slice() <add> for (var i = 0; i < currentListeners.length; i++) { <add> currentListeners[i]() <add> } <add> <ide> return action <ide> } <ide>
1
Text
Text
release notes for 1.1.5 and 1.0.7 releases
5cc9837d931dfb2d374bef24688888e0c52c75d1
<ide><path>CHANGELOG.md <add><a name="1.1.5"></a> <add># 1.1.5 triangle-squarification (2013-05-22) <add> <add>_Note: 1.1.x releases are [considered unstable](http://blog.angularjs.org/2012/07/angularjs-10-12-roadmap.html). <add>They pass all tests but we reserve the right to change new features/apis in between minor releases. Check them <add>out and please give us feedback._ <add> <add>_Note: This release also contains all bug fixes available in [1.0.7](#1.0.7)._ <add> <add> <add>## Features <add> <add>- **$animator:** <add> - provide support for custom animation events <add> ([c53d4c94](https://github.com/angular/angular.js/commit/c53d4c94300c97dd005f9a0cbdbfa387294b9026)) <add> - allow to globally disable and enable animations <add> ([5476cb6e](https://github.com/angular/angular.js/commit/5476cb6e9b6d7a16e3a86585bc2db5e63b16cd4d)) <add>- **$http:** <add> - add support for aborting via timeout promises <add> ([9f4f5937](https://github.com/angular/angular.js/commit/9f4f5937112655a9881d3281da8e72035bc8b180), <add> [#1159](https://github.com/angular/angular.js/issues/1159)) <add> - add a default content type header for PATCH requests <add> ([f9b897de](https://github.com/angular/angular.js/commit/f9b897de4b5cc438515cbb54519fbdf6242f5858)) <add> - add timeout support for JSONP requests <add> ([cda7b711](https://github.com/angular/angular.js/commit/cda7b71146f6748116ad5bbc9050ee7e79a9ce2b)) <add> <add>- **$parse:** add support for ternary operators to parser <add> ([6798fec4](https://github.com/angular/angular.js/commit/6798fec4390a72b7943a49505f8a245b6016c84b)) <add> <add>- **$q:** add $q.always() method <add> ([6605adf6](https://github.com/angular/angular.js/commit/6605adf6d96cee2ef53dfad24e99d325df732cab)) <add> <add>- **$controller:** support "Controller as" syntax <add> ([cd38cbf9](https://github.com/angular/angular.js/commit/cd38cbf975b501d846e6149d1d993972a1af0053), <add> [400f9360](https://github.com/angular/angular.js/commit/400f9360bb2f7553c5bd3b1f256a5f3db175b7bc)) <add> <add>- **$injector:** add `has` method for querying <add> ([80341cb9](https://github.com/angular/angular.js/commit/80341cb9badd952fdc80094df4123629313b4cc4), <add> [#2556](https://github.com/angular/angular.js/issues/2556)) <add> <add>- **Directives:** <add> - **ngAnimate:** <add> - add support for CSS3 Animations with working delays and multiple durations <add> ([14757874](https://github.com/angular/angular.js/commit/14757874a7cea7961f31211b245c417bd4b20512)) <add> - cancel previous incomplete animations when new animations take place <add> ([4acc28a3](https://github.com/angular/angular.js/commit/4acc28a310d006c62afe0de8ec82fed21c98c2d6)) <add> - **ngSrcset:** add new ngSrcset directive <add> ([d551d729](https://github.com/angular/angular.js/commit/d551d72924f7c43a043e4760ff05d7389e310f99), <add> [#2601](https://github.com/angular/angular.js/issues/2601)) <add> - **ngIf:** add directive to remove and recreate DOM elements <add> ([2f96fbd1](https://github.com/angular/angular.js/commit/2f96fbd17577685bc013a4f7ced06664af253944)) <add> - **select:** match options by expression other than object identity <add> ([c32a859b](https://github.com/angular/angular.js/commit/c32a859bdb93699cc080f9affed4bcff63005a64)) <add> - **ngInclude:** $includeContentRequested event <add> ([af0eaa30](https://github.com/angular/angular.js/commit/af0eaa304748f330739a4b0aadb13201126c5407)) <add> <add>- **Mobile:** <add> - **ngClick:** Add a CSS class while the element is held down via a tap <add> ([52a55ec6](https://github.com/angular/angular.js/commit/52a55ec61895951999cb0d74e706725b965e9c9f)) <add> - **ngSwipe:** Add ngSwipeRight/Left directives to ngMobile <add> ([5e0f876c](https://github.com/angular/angular.js/commit/5e0f876c39099adb6a0300c429b8df1f6b544846)) <add> <add>- **docs:** <add> - Add FullText search to replace Google search in docs <add> ([3a49b7ee](https://github.com/angular/angular.js/commit/3a49b7eec4836ec9dc1588e6cedda942755dc7bf)) <add> - external links to github, plunkr and jsfiddle available for code examples <add> ([c8197b44](https://github.com/angular/angular.js/commit/c8197b44eb0b4d49acda142f4179876732e1c751)) <add> - add variable type hinting with colors <add> ([404c9a65](https://github.com/angular/angular.js/commit/404c9a653a1e28de1c6dda996875d6616812313a)) <add> - support for HTML table generation from docs code <add> ([b3a62b2e](https://github.com/angular/angular.js/commit/b3a62b2e19b1743df52034d4d7a0405e6a65f925)) <add> <add>- **scenario runner:** adds mousedown and mouseup event triggers to scenario <add> ([629fb373](https://github.com/angular/angular.js/commit/629fb37351ce5778a40a8bc8cd7c1385b382ce75)) <add> <add> <add> ## Bug Fixes <add> <add> - **$animator:** remove dependency on window.setTimeout <add> ([021bdf39](https://github.com/angular/angular.js/commit/021bdf3922b6525bd117e59fb4945b30a5a55341)) <add> <add> - **$controller:** allow dots in a controller name <add> ([de2cdb06](https://github.com/angular/angular.js/commit/de2cdb0658b8b8cff5a59e26c5ec1c9b470efb9b)) <add> <add> - **$location:** <add> - prevent navigation when event isDefaultPrevented <add> ([2c69a673](https://github.com/angular/angular.js/commit/2c69a6735e8af5d1b9b73fd221274d374e8efdea)) <add> - compare against actual instead of current URL <add> ([a348e90a](https://github.com/angular/angular.js/commit/a348e90aa141921b914f87ec930cd6ebf481a446)) <add> - prevent navigation if already on the URL <add> ([4bd7bedf](https://github.com/angular/angular.js/commit/4bd7bedf48c0c1ebb62f6bd8c85e8ea00f94502b)) <add> - fix URL interception in hash-bang mode <add> ([58ef3230](https://github.com/angular/angular.js/commit/58ef32308f45141c8f7f7cc32a6156cd328ba692), <add> [#1051](https://github.com/angular/angular.js/issues/1051)) <add> - correctly rewrite Html5 urls <add> ([77ff1085](https://github.com/angular/angular.js/commit/77ff1085554675f1a8375642996e5b1e51f9ed2d)) <add> <add> - **$resource:** <add> - null default param results in TypeError <add> ([cefbcd47](https://github.com/angular/angular.js/commit/cefbcd470d4c9020cc3487b2326d45058ef831e2)) <add> - collapse empty suffix parameters correctly <add> ([53061363](https://github.com/angular/angular.js/commit/53061363c7aa1ab9085273d269c6f04ac2162336)) <add> <add> - **$rootScope:** <add> - ensure $watchCollection correctly handles arrayLike objects <add> ([6452707d](https://github.com/angular/angular.js/commit/6452707d4098235bdbde34e790aee05a1b091218)) <add> <add> - **date filter:** correctly format dates with more than 3 sub-second digits <add> ([4f2e3606](https://github.com/angular/angular.js/commit/4f2e36068502f18814fee0abd26951124881f951)) <add> <add> - **jqLite:** <add> - pass a dummy event into triggerHandler <add> ([0401a7f5](https://github.com/angular/angular.js/commit/0401a7f598ef9a36ffe1f217e1a98961046fa551)) <add> <add> - **Directives:** <add> - **ngAnimate:** <add> - eval ng-animate expression on each animation <add> ([fd21c750](https://github.com/angular/angular.js/commit/fd21c7502f0a25364a810c26ebeecb678e5783c5)) <add> - prevent animation on initial page load <add> ([570463a4](https://github.com/angular/angular.js/commit/570463a465fae02efc33e5a1fa963437cdc275dd)) <add> - skip animation on first render <add> ([1351ba26](https://github.com/angular/angular.js/commit/1351ba2632b5011ad6eaddf004a7f0411bea8453)) <add> - **ngPattern:** allow modifiers on inline ng-pattern <add> ([12b6deb1](https://github.com/angular/angular.js/commit/12b6deb1ce99df64e2fc91a06bf05cd7f4a3a475), <add> [#1437](https://github.com/angular/angular.js/issues/1437)) <add> - **ngRepeat:** <add> - correctly iterate over array-like objects <add> ([1d8e11dd](https://github.com/angular/angular.js/commit/1d8e11ddfbd6b08ff02df4331f6df125f49da3dc), <add> [#2546](https://github.com/angular/angular.js/issues/2546)) <add> - prevent initial duplicates <add> ([a0bc71e2](https://github.com/angular/angular.js/commit/a0bc71e27107c58282e71415c4e8d89e916ae99c)) <add> - **ngView:** accidentally compiling leaving content <add> ([9956baed](https://github.com/angular/angular.js/commit/9956baedd73d5e8d0edd04c9eed368bd3988444b)) <add> <add> - **scenario runner:** correct bootstrap issue on IE <add> ([ab755a25](https://github.com/angular/angular.js/commit/ab755a25f9ca3f3f000623071d8de3ddc4b1d78e)) <add> <add> <add> <add>## Breaking Changes <add> <add>- **$animator/ngAnimate:** <add> <add> <add>- **$resource:** due to [53061363](https://github.com/angular/angular.js/commit/53061363c7aa1ab9085273d269c6f04ac2162336), <add> A `/` followed by a `.`, in the last segment of the URL template is now collapsed into a single `.` delimiter. <add> <add> For example: `users/.json` will become `users.json`. If your server relied upon this sequence then it will no longer <add> work. In this case you can now escape the `/.` sequence with `/\.` <add> <add> <add> <add> <add><a name="1.0.7"></a> <add># 1.0.7 monochromatic-rainbow (2013-05-22) <add> <add> <add>## Bug Fixes <add> <add>- **$browser:** should use first value for a cookie. <add> ([3952d35a](https://github.com/angular/angular.js/commit/3952d35abe334a0e6afd1f6e34a74d984d1e9d24), <add> [#2635](https://github.com/angular/angular.js/issues/2635)) <add> <add>- **$cookieStore:** $cookieStore.get now parses blank string as blank string <add> ([cf4729fa](https://github.com/angular/angular.js/commit/cf4729faa3e6e0a5178e2064a6f3cfd345686554)) <add> <add>- **$location:** back-button should fire $locationChangeStart <add> ([dc9a5806](https://github.com/angular/angular.js/commit/dc9a580617a838b63cbf5feae362b6f9cf5ed986), <add> [#2109](https://github.com/angular/angular.js/issues/2109)) <add> <add>- **$parse:** Fix context access and double function call <add> ([7812ae75](https://github.com/angular/angular.js/commit/7812ae75d578314c1a285e9644fc75812940eb1d), <add> [#2496](https://github.com/angular/angular.js/issues/2496)) <add> <add>- **dateFilter:** correctly format ISODates on Android<=2.1 <add> ([f046f6f7](https://github.com/angular/angular.js/commit/f046f6f73c910998a94f30a4cb4ed087b6325485), <add> [#2277](https://github.com/angular/angular.js/issues/2277)) <add> <add>- **jqLite:** correct implementation of mouseenter/mouseleave event <add> ([06f2b2a8](https://github.com/angular/angular.js/commit/06f2b2a8cf7e8216ad9ef05f73426271c2d97faa), <add> [#2131](https://github.com/angular/angular.js/issues/2131)) <add> <add>- **angular.copy/angular.extend:** do not copy $$hashKey in copy/extend functions. <add> ([6d0b325f](https://github.com/angular/angular.js/commit/6d0b325f7f5b9c1f3cfac9b73c6cd5fc3d1e2af0), <add> [#1875](https://github.com/angular/angular.js/issues/1875)) <add> <add>- **i18n:** escape all chars above \u007f in locale files <add> ([695c54c1](https://github.com/angular/angular.js/commit/695c54c17b3299cd6170c45878b41cb46a577cd2), <add> [#2417](https://github.com/angular/angular.js/issues/2417)) <add> <add>- **Directives:** <add> - **ngPluralize:** handle the empty string as a valid override <add> ([67a4a25b](https://github.com/angular/angular.js/commit/67a4a25b890fada0043c1ff98e5437d793f44d0c), <add> [#2575](https://github.com/angular/angular.js/issues/2575)) <add> - **select:** ensure empty option is not lost in IE9 <add> ([4622af3f](https://github.com/angular/angular.js/commit/4622af3f075204e2d5ab33d5bd002074f2d940c9), <add> [#2150](https://github.com/angular/angular.js/issues/2150)) <add> - **ngModel:** use paste/cut events in IE to support context menu <add> ([363e4cbf](https://github.com/angular/angular.js/commit/363e4cbf649de4c5206f1904ee76f89301ceaab0), <add> [#1462](https://github.com/angular/angular.js/issues/1462)) <add> - **ngClass:** should remove classes when object is the same but property has changed <add> ([0ac969a5](https://github.com/angular/angular.js/commit/0ac969a5ee1687cfd4517821943f34fe948bb3fc)) <add> <add>- **PhoneCat Tutorial:** renamed Testacular to Karma <add> ([angular-phonecat](https://github.com/angular/angular-phonecat)) <add> <add> <add> <ide> <a name="1.1.4"></a> <ide> # 1.1.4 quantum-manipulation (2013-04-03) <ide>
1
Javascript
Javascript
require extractdependencies only once
31b4648a8aa589b952351796ad6f15a43560120c
<ide><path>packager/react-packager/src/node-haste/__tests__/DependencyGraph-test.js <ide> jest.mock('jest-haste-map/build/crawlers/node', () => { <ide> <ide> const mocksPattern = /(?:[\\/]|^)__mocks__[\\/]([^\/]+)\.js$/; <ide> <add>// This doesn't have state, and it's huge (Babel) so it's much faster to <add>// require it only once. <add>const extractDependencies = require('../../JSTransformer/worker/extract-dependencies'); <add>jest.mock('../../JSTransformer/worker/extract-dependencies', () => extractDependencies); <add> <ide> jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000; <ide> <ide> const path = require('path'); <ide> beforeEach(() => { <ide> <ide> describe('DependencyGraph', function() { <ide> let Module; <del> let extractDependencies; <ide> let defaults; <ide> <ide> function getOrderedDependenciesAsJSON(dgraph, entryPath, platform, recursive = true) { <ide> describe('DependencyGraph', function() { <ide> Cache.prototype.end = jest.genMockFn(); <ide> <ide> const transformCacheKey = 'abcdef'; <del> extractDependencies = <del> require('../../JSTransformer/worker/extract-dependencies'); <ide> defaults = { <ide> assetExts: ['png', 'jpg'], <ide> cache: new Cache(), <ide> describe('DependencyGraph', function() { <ide> jest.resetModules(); <ide> jest.mock('path', () => path.win32); <ide> DependencyGraph = require('../index'); <del> extractDependencies = require('../../JSTransformer/worker/extract-dependencies'); <ide> }); <ide> <ide> afterEach(function() {
1
Text
Text
add text about error.code stability
1368eb893c4c6f282456210e9f8f54f53536d151
<ide><path>doc/api/errors.md <ide> not capture any frames. <ide> * {string} <ide> <ide> The `error.code` property is a string label that identifies the kind of error. <del>See [Node.js Error Codes][] for details about specific codes. <add>`error.code` is the most stable way to identify an error. It will only change between major versions of Node.js. In contrast, `error.message` strings may change between any versions of Node.js. See [Node.js Error Codes][] for details about specific codes. <ide> <ide> ### error.message <ide>
1
Ruby
Ruby
allow https on more download strategies
1a52c7f8644f0d6871c3c5fabd4bd7c124b3c9d3
<ide><path>Library/Homebrew/formula.rb <ide> def download_strategy <ide> when %r[^svn+http://] then SubversionDownloadStrategy <ide> when %r[^git://] then GitDownloadStrategy <ide> when %r[^https?://(.+?\.)?googlecode\.com/hg] then MercurialDownloadStrategy <del> when %r[^http://(.+?\.)?googlecode\.com/svn] then SubversionDownloadStrategy <del> when %r[^http://(.+?\.)?sourceforge\.net/svnroot/] then SubversionDownloadStrategy <add> when %r[^https?://(.+?\.)?googlecode\.com/svn] then SubversionDownloadStrategy <add> when %r[^https?://(.+?\.)?sourceforge\.net/svnroot/] then SubversionDownloadStrategy <ide> when %r[^http://svn.apache.org/repos/] then SubversionDownloadStrategy <ide> else CurlDownloadStrategy <ide> end
1
Python
Python
fix exception string of branchpythonoperator
abdede8eaf4c82555850067d9a327ab519ffe44a
<ide><path>airflow/operators/python.py <ide> def execute(self, context: Dict): <ide> invalid_task_ids = branches - valid_task_ids <ide> if invalid_task_ids: <ide> raise AirflowException( <del> f"Branch callable must valid task_ids. Invalid tasks found: {invalid_task_ids}" <add> f"Branch callable must return valid task_ids. Invalid tasks found: {invalid_task_ids}" <ide> ) <ide> self.skip_all_except(context['ti'], branch) <ide> return branch <ide><path>tests/operators/test_python.py <ide> def test_raise_exception_on_invalid_task_id(self): <ide> self.dag.clear() <ide> with pytest.raises(AirflowException) as ctx: <ide> branch_op.run(start_date=DEFAULT_DATE, end_date=DEFAULT_DATE) <del> assert """Branch callable must valid task_ids. Invalid tasks found: {'some_task_id'}""" == str( <add> assert """Branch callable must return valid task_ids. Invalid tasks found: {'some_task_id'}""" == str( <ide> ctx.value <ide> ) <ide>
2
Python
Python
update japanese tests
656574a01a2e2d12b26cfa63dea4076e3f93dc93
<ide><path>spacy/tests/lang/ja/test_tokenizer.py <ide> ] <ide> <ide> POS_TESTS = [ <del> ('日本語だよ', ['fish', 'NOUN', 'AUX', 'PART']), <del> ('東京タワーの近くに住んでいます。', ['PROPN', 'NOUN', 'ADP', 'NOUN', 'ADP', 'VERB', 'SCONJ', 'VERB', 'AUX', 'PUNCT']), <del> ('吾輩は猫である。', ['PRON', 'ADP', 'NOUN', 'AUX', 'VERB', 'PUNCT']), <add> ('日本語だよ', ['PROPN', 'NOUN', 'AUX', 'PART']), <add> ('東京タワーの近くに住んでいます。', ['PROPN', 'NOUN', 'ADP', 'NOUN', 'ADP', 'VERB', 'SCONJ', 'AUX', 'AUX', 'PUNCT']), <add> ('吾輩は猫である。', ['PRON', 'ADP', 'NOUN', 'AUX', 'AUX', 'PUNCT']), <ide> ('月に代わって、お仕置きよ!', ['NOUN', 'ADP', 'VERB', 'SCONJ', 'PUNCT', 'NOUN', 'NOUN', 'PART', 'PUNCT']), <ide> ('すもももももももものうち', ['NOUN', 'ADP', 'NOUN', 'ADP', 'NOUN', 'ADP', 'NOUN']) <ide> ] <ide> def test_ja_tokenizer_tags(ja_tokenizer, text, expected_tags): <ide> assert tags == expected_tags <ide> <ide> <del># XXX This isn't working? Always passes <ide> @pytest.mark.parametrize("text,expected_pos", POS_TESTS) <ide> def test_ja_tokenizer_pos(ja_tokenizer, text, expected_pos): <ide> pos = [token.pos_ for token in ja_tokenizer(text)] <ide> def test_ja_tokenizer_split_modes(ja_tokenizer, text, len_a, len_b, len_c): <ide> ] <ide> ) <ide> def test_ja_tokenizer_sub_tokens(ja_tokenizer, text, sub_tokens_list_a, sub_tokens_list_b, sub_tokens_list_c): <del> nlp_a = Japanese(meta={"tokenizer": {"config": {"split_mode": "A"}}}) <del> nlp_b = Japanese(meta={"tokenizer": {"config": {"split_mode": "B"}}}) <del> nlp_c = Japanese(meta={"tokenizer": {"config": {"split_mode": "C"}}}) <add> nlp_a = Japanese.from_config({"nlp": {"tokenizer": {"split_mode": "A"}}}) <add> nlp_b = Japanese.from_config({"nlp": {"tokenizer": {"split_mode": "B"}}}) <add> nlp_c = Japanese.from_config({"nlp": {"tokenizer": {"split_mode": "C"}}}) <ide> <ide> assert ja_tokenizer(text).user_data["sub_tokens"] == sub_tokens_list_a <ide> assert nlp_a(text).user_data["sub_tokens"] == sub_tokens_list_a
1
Javascript
Javascript
move duplicate spliceone into internal/util
7a71cd7d0c34b0de4d03cd931710aefdbc95c710
<ide><path>lib/events.js <ide> 'use strict'; <ide> <ide> var domain; <add>var spliceOne; <ide> <ide> function EventEmitter() { <ide> EventEmitter.init.call(this); <ide> EventEmitter.prototype.removeListener = <ide> <ide> if (position === 0) <ide> list.shift(); <del> else <add> else { <add> if (spliceOne === undefined) <add> spliceOne = require('internal/util').spliceOne; <ide> spliceOne(list, position); <add> } <ide> <ide> if (list.length === 1) <ide> events[type] = list[0]; <ide> EventEmitter.prototype.eventNames = function eventNames() { <ide> return this._eventsCount > 0 ? Reflect.ownKeys(this._events) : []; <ide> }; <ide> <del>// About 1.5x faster than the two-arg version of Array#splice(). <del>function spliceOne(list, index) { <del> for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) <del> list[i] = list[k]; <del> list.pop(); <del>} <del> <ide> function arrayClone(arr, n) { <ide> var copy = new Array(n); <ide> for (var i = 0; i < n; ++i) <ide><path>lib/internal/util.js <ide> function join(output, separator) { <ide> return str; <ide> } <ide> <add>// About 1.5x faster than the two-arg version of Array#splice(). <add>function spliceOne(list, index) { <add> for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) <add> list[i] = list[k]; <add> list.pop(); <add>} <add> <ide> module.exports = { <ide> assertCrypto, <ide> cachedResult, <ide> module.exports = { <ide> filterDuplicateStrings, <ide> getConstructorOf, <ide> isError, <add> join, <ide> normalizeEncoding, <ide> objectToString, <ide> promisify, <del> join, <add> spliceOne, <ide> <ide> // Symbol used to customize promisify conversion <ide> customPromisifyArgs: kCustomPromisifyArgsSymbol, <ide><path>lib/url.js <ide> const { hexTable } = require('internal/querystring'); <ide> <ide> const errors = require('internal/errors'); <ide> <add>const { spliceOne } = require('internal/util'); <add> <ide> // WHATWG URL implementation provided by internal/url <ide> const { <ide> URL, <ide> Url.prototype.parseHost = function parseHost() { <ide> if (host) this.hostname = host; <ide> }; <ide> <del>// About 1.5x faster than the two-arg version of Array#splice(). <del>function spliceOne(list, index) { <del> for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) <del> list[i] = list[k]; <del> list.pop(); <del>} <del> <ide> // These characters do not need escaping: <ide> // ! - . _ ~ <ide> // ' ( ) * :
3
Javascript
Javascript
prevent exception on empty em.select content
0e4873d1710a0546711c7b052027cbe417fd8ebb
<ide><path>packages/ember-handlebars/lib/controls/select.js <ide> Ember.Select = Ember.View.extend( <ide> content = get(this, 'content'), <ide> prompt = get(this, 'prompt'); <ide> <del> if (!get(content, 'length')) { return; } <add> if (!content || !get(content, 'length')) { return; } <ide> if (prompt && selectedIndex === 0) { set(this, 'selection', null); return; } <ide> <ide> if (prompt) { selectedIndex -= 1; }
1
Text
Text
add missing & in 'compare & pull request'
5dc3e31cba4d844d08126fd6d3379f5cd93eb689
<ide><path>docs/how-to-open-a-pull-request.md <ide> Some examples of good PRs titles would be: <ide> <ide> 1. Once the edits have been committed, you will be prompted to create a pull request on your fork's GitHub Page. <ide> <del> ![Image - Compare pull request prompt on GitHub](https://contribute.freecodecamp.org/images/github/compare-pull-request-prompt.png) <add> ![Image - Compare & pull request prompt on GitHub](https://contribute.freecodecamp.org/images/github/compare-pull-request-prompt.png) <ide> <ide> 2. By default, all pull requests should be against the freeCodeCamp main repo, `main` branch. <ide>
1
Ruby
Ruby
use better assertions
dd3d8a9060bc17377fcd8c79a8c3ba6019a34ea0
<ide><path>Library/Homebrew/test/test_language_module_dependency.rb <ide> def test_differing_module_and_import_name <ide> import_name = "bar" <ide> l = LanguageModuleDependency.new(:python, mod_name, import_name) <ide> assert_includes l.message, mod_name <del> assert l.the_test.one? { |c| c.include?(import_name) } <add> assert_includes l.the_test, "import #{import_name}" <ide> end <ide> <ide> def test_bad_perl_deps <ide><path>Library/Homebrew/test/test_software_spec.rb <ide> def test_option_description_defaults_to_empty_string <ide> <ide> def test_deprecated_option <ide> @spec.deprecated_option('foo' => 'bar') <del> assert @spec.deprecated_options.any? <add> refute_empty @spec.deprecated_options <ide> assert_equal "foo", @spec.deprecated_options.first.old <ide> assert_equal "bar", @spec.deprecated_options.first.current <ide> end
2
PHP
PHP
deprecate the rsshelper
2b5fa36a75b61ec30390142dddbe37c97ea98e90
<ide><path>src/View/Helper/RssHelper.php <ide> * @property \Cake\View\Helper\UrlHelper $Url <ide> * @property \Cake\View\Helper\TimeHelper $Time <ide> * @link http://book.cakephp.org/3.0/en/views/helpers/rss.html <add> * @deprecated 3.5.0 RssHelper is deprecated and will be removed in 4.0.0 <ide> */ <ide> class RssHelper extends Helper <ide> {
1
Go
Go
fix endpoint error
c679b071f01a9dac7cdc49f8eca5d9560f5b4f55
<ide><path>libnetwork/endpoint.go <ide> func (ep *endpoint) hasInterface(iName string) bool { <ide> <ide> func (ep *endpoint) Leave(sbox Sandbox, options ...EndpointOption) error { <ide> if sbox == nil || sbox.ID() == "" || sbox.Key() == "" { <del> return types.BadRequestErrorf("invalid Sandbox passed to enpoint leave: %v", sbox) <add> return types.BadRequestErrorf("invalid Sandbox passed to endpoint leave: %v", sbox) <ide> } <ide> <ide> sb, ok := sbox.(*sandbox)
1
PHP
PHP
fix doc block
819bc16ef50819793350199819daf232c0c9a8ff
<ide><path>src/Console/Shell.php <ide> public function dispatchShell() { <ide> * you must define all the subcommands your shell needs, whether they be methods on this class <ide> * or methods on tasks. <ide> * <del> * @param string $command The command name to run on this shell. If this argument is empty, <del> * and the shell has a `main()` method, that will be called instead. <ide> * @param array $argv Array of arguments to run the shell with. This array should be missing the shell name. <ide> * @param boolean $autoMethod Set to true to allow any public method to be called even if it <ide> * was not defined as a subcommand. This is used by ShellDispatcher to make building simple shells easy.
1
Python
Python
fix schema generation for obtainauthtoken view.
609f708a27bd38496b912c44742287c57e7af912
<ide><path>rest_framework/authtoken/serializers.py <ide> <ide> <ide> class AuthTokenSerializer(serializers.Serializer): <del> username = serializers.CharField(label=_("Username")) <add> username = serializers.CharField( <add> label=_("Username"), <add> write_only=True <add> ) <ide> password = serializers.CharField( <ide> label=_("Password"), <ide> style={'input_type': 'password'}, <del> trim_whitespace=False <add> trim_whitespace=False, <add> write_only=True <add> ) <add> token = serializers.CharField( <add> label=_("Token"), <add> read_only=True <ide> ) <ide> <ide> def validate(self, attrs): <ide><path>rest_framework/authtoken/views.py <ide> from rest_framework.compat import coreapi, coreschema <ide> from rest_framework.response import Response <ide> from rest_framework.schemas import ManualSchema <add>from rest_framework.schemas import coreapi as coreapi_schema <ide> from rest_framework.views import APIView <ide> <ide> <ide> class ObtainAuthToken(APIView): <ide> parser_classes = (parsers.FormParser, parsers.MultiPartParser, parsers.JSONParser,) <ide> renderer_classes = (renderers.JSONRenderer,) <ide> serializer_class = AuthTokenSerializer <del> if coreapi is not None and coreschema is not None: <add> <add> if coreapi_schema.is_enabled(): <ide> schema = ManualSchema( <ide> fields=[ <ide> coreapi.Field( <ide> class ObtainAuthToken(APIView): <ide> encoding="application/json", <ide> ) <ide> <add> def get_serializer_context(self): <add> return { <add> 'request': self.request, <add> 'format': self.format_kwarg, <add> 'view': self <add> } <add> <add> def get_serializer(self, *args, **kwargs): <add> kwargs['context'] = self.get_serializer_context() <add> return self.serializer_class(*args, **kwargs) <add> <ide> def post(self, request, *args, **kwargs): <del> serializer = self.serializer_class(data=request.data, <del> context={'request': request}) <add> serializer = self.get_serializer(data=request.data) <ide> serializer.is_valid(raise_exception=True) <ide> user = serializer.validated_data['user'] <ide> token, created = Token.objects.get_or_create(user=user) <ide><path>tests/schemas/test_openapi.py <ide> from django.utils.translation import gettext_lazy as _ <ide> <ide> from rest_framework import filters, generics, pagination, routers, serializers <add>from rest_framework.authtoken.views import obtain_auth_token <ide> from rest_framework.compat import uritemplate <ide> from rest_framework.parsers import JSONParser, MultiPartParser <ide> from rest_framework.renderers import JSONRenderer, OpenAPIRenderer <ide> def test_serializer_model(self): <ide> patterns = [ <ide> url(r'^example/?$', views.ExampleGenericAPIViewModel.as_view()), <ide> ] <add> <ide> generator = SchemaGenerator(patterns=patterns) <ide> <ide> request = create_request('/') <ide> schema = generator.get_schema(request=request) <ide> <ide> print(schema) <add> <ide> assert 'components' in schema <ide> assert 'schemas' in schema['components'] <ide> assert 'ExampleModel' in schema['components']['schemas'] <ide> <add> def test_authtoken_serializer(self): <add> patterns = [ <add> url(r'^api-token-auth/', obtain_auth_token) <add> ] <add> generator = SchemaGenerator(patterns=patterns) <add> <add> request = create_request('/') <add> schema = generator.get_schema(request=request) <add> <add> print(schema) <add> <add> route = schema['paths']['/api-token-auth/']['post'] <add> body_schema = route['requestBody']['content']['application/json']['schema'] <add> <add> assert body_schema == { <add> '$ref': '#/components/schemas/AuthToken' <add> } <add> assert schema['components']['schemas']['AuthToken'] == { <add> 'type': 'object', <add> 'properties': { <add> 'username': {'type': 'string', 'writeOnly': True}, <add> 'password': {'type': 'string', 'writeOnly': True}, <add> 'token': {'type': 'string', 'readOnly': True}, <add> }, <add> 'required': ['username', 'password'] <add> } <add> <ide> def test_component_name(self): <ide> patterns = [ <ide> url(r'^example/?$', views.ExampleAutoSchemaComponentName.as_view()),
3
Python
Python
improve validate_<fieldname> fix
69e62457ef80b40398a6b137f10d5a0e05c3f07f
<ide><path>rest_framework/serializers.py <ide> def perform_validation(self, attrs): <ide> Run `validate_<fieldname>()` and `validate()` methods on the serializer <ide> """ <ide> for field_name, field in self.fields.items(): <del> if field_name not in self._errors: <del> try: <del> validate_method = getattr(self, 'validate_%s' % field_name, None) <del> if validate_method: <del> source = field.source or field_name <del> attrs = validate_method(attrs, source) <del> except ValidationError as err: <del> self._errors[field_name] = self._errors.get(field_name, []) + list(err.messages) <add> if field_name in self._errors: <add> continue <add> try: <add> validate_method = getattr(self, 'validate_%s' % field_name, None) <add> if validate_method: <add> source = field.source or field_name <add> attrs = validate_method(attrs, source) <add> except ValidationError as err: <add> self._errors[field_name] = self._errors.get(field_name, []) + list(err.messages) <ide> <ide> # If there are already errors, we don't run .validate() because <ide> # field-validation failed and thus `attrs` may not be complete.
1
Go
Go
use cgo to get systems clock ticks for metrics
004cf556e86a03d8961416b3e8a0a476a424b10f
<ide><path>pkg/cgroups/fs/cpuacct.go <ide> import ( <ide> "github.com/dotcloud/docker/pkg/system" <ide> ) <ide> <del>var cpuCount = float64(runtime.NumCPU()) <add>var ( <add> cpuCount = float64(runtime.NumCPU()) <add> clockTicks = float64(system.GetClockTicks()) <add>) <ide> <ide> type cpuacctGroup struct { <ide> } <ide> func (s *cpuacctGroup) Stats(d *data) (map[string]float64, error) { <ide> deltaSystem = lastSystem - startSystem <ide> ) <ide> if deltaSystem > 0.0 { <del> percentage = ((deltaProc / deltaSystem) * 100.0) * cpuCount <add> percentage = ((deltaProc / deltaSystem) * clockTicks) * cpuCount <ide> } <ide> // NOTE: a percentage over 100% is valid for POSIX because that means the <ide> // processes is using multiple cores <ide><path>pkg/system/sysconfig.go <add>// +build linux,cgo <add> <add>package system <add> <add>/* <add>#include <unistd.h> <add>int get_hz(void) { return sysconf(_SC_CLK_TCK); } <add>*/ <add>import "C" <add> <add>func GetClockTicks() int { <add> return int(C.get_hz()) <add>} <ide><path>pkg/system/sysconfig_nocgo.go <add>// +build linux,!cgo <add> <add>package system <add> <add>func GetClockTicks() int { <add> // when we cannot call out to C to get the sysconf it is fairly safe to <add> // just return 100 <add> return 100 <add>} <ide><path>pkg/system/unsupported.go <ide> func UsetCloseOnExec(fd uintptr) error { <ide> func Gettid() int { <ide> return 0 <ide> } <add> <add>func GetClockTicks() int { <add> // when we cannot call out to C to get the sysconf it is fairly safe to <add> // just return 100 <add> return 100 <add>}
4
Java
Java
use unsubscribed check instead of a null check
14fcc22ec431e87b88f99a7d5498c321127dd48d
<ide><path>src/main/java/rx/subscriptions/CompositeSubscription.java <ide> /** <ide> * Copyright 2014 Netflix, Inc. <del> * <add> * <ide> * Licensed under the Apache License, Version 2.0 (the "License"); <ide> * you may not use this file except in compliance with the License. <ide> * You may obtain a copy of the License at <del> * <add> * <ide> * http://www.apache.org/licenses/LICENSE-2.0 <del> * <add> * <ide> * Unless required by applicable law or agreed to in writing, software <ide> * distributed under the License is distributed on an "AS IS" BASIS, <ide> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <ide> public synchronized boolean isUnsubscribed() { <ide> * the {@link Subscription} to add <ide> */ <ide> public void add(final Subscription s) { <del> if (s == null) { <del> throw new NullPointerException("Added Subscription cannot be null."); <add> if (s.isUnsubscribed()) { <add> return; <ide> } <ide> Subscription unsubscribe = null; <ide> synchronized (this) {
1
PHP
PHP
add support for jsonserializable
cd1278d535d0e4b7ae405b58ef688fb16b3296bd
<ide><path>lib/Cake/ORM/ResultSet.php <ide> <ide> use Cake\Database\Type; <ide> use \Iterator; <add>use \JsonSerializable; <ide> use \Serializable; <ide> <ide> /** <ide> * queries required for eager loading external associations. <ide> * <ide> */ <del>class ResultSet implements Iterator, Serializable { <add>class ResultSet implements Iterator, Serializable, JsonSerializable { <ide> <ide> /** <ide> * Original query from where results where generated <ide> protected function _calculateAssociationMap() { <ide> * @return void <ide> */ <ide> protected function _fetchResult() { <del> $advance = ($this->_lastIndex < $this->_index); <del> if (!$advance) { <del> return; <del> } <ide> if (isset($this->_results[$this->_index])) { <ide> $this->_current = $this->_results[$this->_index]; <add> $this->_lastIndex = $this->_index; <add> return; <add> } <add> if (!$this->_statement) { <add> $this->_current = false; <ide> return; <ide> } <ide> $row = $this->_statement->fetch('assoc'); <ide> if ($row !== false) { <ide> $row = $this->_groupResult($row); <add> $this->_results[] = $row; <ide> } <ide> $this->_current = $row; <del> $this->_results[] = $row; <ide> $this->_lastIndex = $this->_index; <ide> } <ide> <ide> protected function _castValues($table, $values) { <ide> /** <ide> * Serialize a resultset. <ide> * <del> * Part of Serializable Interface <add> * Part of Serializable interface. <ide> * <ide> * @return string Serialized object <ide> */ <ide> public function serialize() { <del> iterator_to_array($this); <add> $this->toArray(); <ide> return serialize($this->_results); <ide> } <ide> <ide> /** <ide> * Unserialize a resultset. <ide> * <del> * Part of Serializable Interface <add> * Part of Serializable interface. <ide> * <ide> * @param string Serialized object <ide> * @return ResultSet The hydrated result set. <ide> */ <ide> public function unserialize($serialized) { <ide> $this->_results = unserialize($serialized); <del> return $this; <add> } <add> <add>/** <add> * Convert a result set into JSON. <add> * <add> * Part of JsonSerializable interface. <add> * <add> * @return array The data to convert to JSON <add> */ <add> public function jsonSerialize() { <add> $this->toArray(); <add> return $this->_results; <ide> } <ide> <ide> } <ide><path>lib/Cake/Test/TestCase/ORM/ResultSetTest.php <ide> public function setUp() { <ide> parent::setUp(); <ide> $this->connection = ConnectionManager::getDataSource('test'); <ide> $this->table = new Table(['table' => 'articles', 'connection' => $this->connection]); <add> <add> $this->fixtureData = [ <add> ['id' => 1, 'author_id' => 1, 'title' => 'First Article', 'body' => 'First Article Body', 'published' => 'Y'], <add> ['id' => 2, 'author_id' => 3, 'title' => 'Second Article', 'body' => 'Second Article Body', 'published' => 'Y'], <add> ['id' => 3, 'author_id' => 1, 'title' => 'Third Article', 'body' => 'Third Article Body', 'published' => 'Y'] <add> ]; <ide> } <ide> <ide> /** <ide> public function testIteratorAfterSerialization() { <ide> $query = $this->table->find('all'); <ide> $results = unserialize(serialize($query->execute())); <ide> <del> $expected = [ <del> ['id' => 1, 'author_id' => 1, 'title' => 'First Article', 'body' => 'First Article Body', 'published' => 'Y'], <del> ['id' => 2, 'author_id' => 3, 'title' => 'Second Article', 'body' => 'Second Article Body', 'published' => 'Y'], <del> ['id' => 3, 'author_id' => 1, 'title' => 'Third Article', 'body' => 'Third Article Body', 'published' => 'Y'] <del> ]; <ide> // Use a loop to test Iterator implementation <ide> foreach ($results as $i => $row) { <del> $this->assertEquals($expected[$i], $row, "Row $i does not match"); <add> $this->assertEquals($this->fixtureData[$i], $row, "Row $i does not match"); <ide> } <ide> } <ide> <add>/** <add> * Test converting resultsets into json <add> * <add> * @return void <add> */ <add> public function testJsonSerialize() { <add> $query = $this->table->find('all'); <add> $results = $query->execute(); <add> <add> $expected = json_encode($this->fixtureData); <add> $this->assertEquals(json_encode($results), $expected); <add> } <add> <ide> }
2
Go
Go
fix usage of some variables
57e14714ee85e67f59d8c22aed23dc875cf2e58c
<ide><path>libcontainerd/client_windows.go <ide> func (clnt *client) Signal(containerID string, sig int) error { <ide> } else { <ide> // Terminate Process <ide> if err := cont.hcsProcess.Kill(); err != nil { <add> // ignore errors <ide> logrus.Warnf("Failed to terminate pid %d in %s: %q", cont.systemPid, containerID, err) <del> // Ignore errors <del> err = nil <ide> } <ide> } <ide> <ide><path>plugin/backend.go <ide> func (pm *Manager) Push(name string, metaHeader http.Header, authConfig *types.A <ide> _, err = distribution.Push(name, pm.registryService, metaHeader, authConfig, config, rootfs) <ide> // XXX: Ignore returning digest for now. <ide> // Since digest needs to be written to the ProgressWriter. <del> return nil <add> return err <ide> } <ide> <ide> // Remove deletes plugin's root directory.
2
PHP
PHP
fix bad tests
a38e4201e19b7e7e7ec7356031d3f12abb381e6f
<ide><path>tests/Database/DatabaseEloquentModelTest.php <ide> public function testModelAttributesAreCastedWhenPresentInCastsArray() <ide> { <ide> $model = new EloquentModelCastingStub; <ide> $model->setDateFormat('Y-m-d H:i:s'); <del> $model->first = '3'; <del> $model->second = '4.0'; <del> $model->third = 2.5; <del> $model->fourth = 1; <del> $model->fifth = 0; <del> $model->sixth = ['foo' => 'bar']; <add> $model->intAttribute = '3'; <add> $model->floatAttribute = '4.0'; <add> $model->stringAttribute = 2.5; <add> $model->boolAttribute = 1; <add> $model->booleanAttribute = 0; <add> $model->objectAttribute = ['foo' => 'bar']; <ide> $obj = new StdClass; <ide> $obj->foo = 'bar'; <del> $model->seventh = $obj; <del> $model->eighth = ['foo' => 'bar']; <del> $model->ninth = '1969-07-20'; <del> $model->tenth = '1969-07-20 22:56:00'; <del> $model->eleventh = '1969-07-20 22:56:00'; <del> <del> $this->assertInternalType('int', $model->first); <del> $this->assertInternalType('float', $model->second); <del> $this->assertInternalType('string', $model->third); <del> $this->assertInternalType('boolean', $model->fourth); <del> $this->assertInternalType('boolean', $model->fifth); <del> $this->assertInternalType('object', $model->sixth); <del> $this->assertInternalType('array', $model->seventh); <del> $this->assertInternalType('array', $model->eighth); <del> $this->assertTrue($model->fourth); <del> $this->assertFalse($model->fifth); <del> $this->assertEquals($obj, $model->sixth); <del> $this->assertEquals(['foo' => 'bar'], $model->seventh); <del> $this->assertEquals(['foo' => 'bar'], $model->eighth); <del> $this->assertEquals('{"foo":"bar"}', $model->eighthAttributeValue()); <del> $this->assertInstanceOf('Carbon\Carbon', $model->ninth); <del> $this->assertInstanceOf('Carbon\Carbon', $model->tenth); <del> $this->assertEquals('1969-07-20', $model->ninth->toDateString()); <del> $this->assertEquals('1969-07-20 22:56:00', $model->tenth->toDateTimeString()); <del> $this->assertEquals(-14173440, $model->eleventh); <add> $model->arrayAttribute = $obj; <add> $model->jsonAttribute = ['foo' => 'bar']; <add> $model->dateAttribute = '1969-07-20'; <add> $model->datetimeAttribute = '1969-07-20 22:56:00'; <add> $model->timestampAttribute = '1969-07-20 22:56:00'; <add> <add> $this->assertInternalType('int', $model->intAttribute); <add> $this->assertInternalType('float', $model->floatAttribute); <add> $this->assertInternalType('string', $model->stringAttribute); <add> $this->assertInternalType('boolean', $model->boolAttribute); <add> $this->assertInternalType('boolean', $model->booleanAttribute); <add> $this->assertInternalType('object', $model->objectAttribute); <add> $this->assertInternalType('array', $model->arrayAttribute); <add> $this->assertInternalType('array', $model->jsonAttribute); <add> $this->assertTrue($model->boolAttribute); <add> $this->assertFalse($model->booleanAttribute); <add> $this->assertEquals($obj, $model->objectAttribute); <add> $this->assertEquals(['foo' => 'bar'], $model->arrayAttribute); <add> $this->assertEquals(['foo' => 'bar'], $model->jsonAttribute); <add> $this->assertEquals('{"foo":"bar"}', $model->jsonAttributeValue()); <add> $this->assertInstanceOf('Carbon\Carbon', $model->dateAttribute); <add> $this->assertInstanceOf('Carbon\Carbon', $model->datetimeAttribute); <add> $this->assertEquals('1969-07-20', $model->dateAttribute->toDateString()); <add> $this->assertEquals('1969-07-20 22:56:00', $model->datetimeAttribute->toDateTimeString()); <add> $this->assertEquals(-14173440, $model->timestampAttribute); <ide> <ide> $arr = $model->toArray(); <del> $this->assertInternalType('int', $arr['first']); <del> $this->assertInternalType('float', $arr['second']); <del> $this->assertInternalType('string', $arr['third']); <del> $this->assertInternalType('boolean', $arr['fourth']); <del> $this->assertInternalType('boolean', $arr['fifth']); <del> $this->assertInternalType('object', $arr['sixth']); <del> $this->assertInternalType('array', $arr['seventh']); <del> $this->assertInternalType('array', $arr['eighth']); <del> $this->assertTrue($arr['fourth']); <del> $this->assertFalse($arr['fifth']); <del> $this->assertEquals($obj, $arr['sixth']); <del> $this->assertEquals(['foo' => 'bar'], $arr['seventh']); <del> $this->assertEquals(['foo' => 'bar'], $arr['eighth']); <del> $this->assertInstanceOf('Carbon\Carbon', $arr['ninth']); <del> $this->assertInstanceOf('Carbon\Carbon', $arr['tenth']); <del> $this->assertEquals('1969-07-20', $arr['ninth']->toDateString()); <del> $this->assertEquals('1969-07-20 22:56:00', $arr['tenth']->toDateTimeString()); <del> $this->assertEquals(-14173440, $arr['eleventh']); <add> $this->assertInternalType('int', $arr['intAttribute']); <add> $this->assertInternalType('float', $arr['floatAttribute']); <add> $this->assertInternalType('string', $arr['stringAttribute']); <add> $this->assertInternalType('boolean', $arr['boolAttribute']); <add> $this->assertInternalType('boolean', $arr['booleanAttribute']); <add> $this->assertInternalType('object', $arr['objectAttribute']); <add> $this->assertInternalType('array', $arr['arrayAttribute']); <add> $this->assertInternalType('array', $arr['jsonAttribute']); <add> $this->assertTrue($arr['boolAttribute']); <add> $this->assertFalse($arr['booleanAttribute']); <add> $this->assertEquals($obj, $arr['objectAttribute']); <add> $this->assertEquals(['foo' => 'bar'], $arr['arrayAttribute']); <add> $this->assertEquals(['foo' => 'bar'], $arr['jsonAttribute']); <add> $this->assertInstanceOf('Carbon\Carbon', $arr['dateAttribute']); <add> $this->assertInstanceOf('Carbon\Carbon', $arr['datetimeAttribute']); <add> $this->assertEquals('1969-07-20', $arr['dateAttribute']->toDateString()); <add> $this->assertEquals('1969-07-20 22:56:00', $arr['datetimeAttribute']->toDateTimeString()); <add> $this->assertEquals(-14173440, $arr['timestampAttribute']); <ide> } <ide> <ide> public function testModelAttributeCastingPreservesNull() <ide> { <ide> $model = new EloquentModelCastingStub; <del> $model->first = null; <del> $model->second = null; <del> $model->third = null; <del> $model->fourth = null; <del> $model->fifth = null; <del> $model->sixth = null; <del> $model->seventh = null; <del> $model->eighth = null; <del> $model->ninth = null; <del> $model->tenth = null; <del> $model->eleventh = null; <add> $model->intAttribute = null; <add> $model->floatAttribute = null; <add> $model->stringAttribute = null; <add> $model->boolAttribute = null; <add> $model->booleanAttribute = null; <add> $model->objectAttribute = null; <add> $model->arrayAttribute = null; <add> $model->jsonAttribute = null; <add> $model->dateAttribute = null; <add> $model->datetimeAttribute = null; <add> $model->timestampAttribute = null; <ide> <ide> $attributes = $model->getAttributes(); <ide> <del> $this->assertNull($attributes['first']); <del> $this->assertNull($attributes['second']); <del> $this->assertNull($attributes['third']); <del> $this->assertNull($attributes['fourth']); <del> $this->assertNull($attributes['fifth']); <del> $this->assertNull($attributes['sixth']); <del> $this->assertNull($attributes['seventh']); <del> $this->assertNull($attributes['eighth']); <del> $this->assertNull($attributes['ninth']); <del> $this->assertNull($attributes['tenth']); <del> $this->assertNull($attributes['eleventh']); <del> <del> $this->assertNull($model->first); <del> $this->assertNull($model->second); <del> $this->assertNull($model->third); <del> $this->assertNull($model->fourth); <del> $this->assertNull($model->fifth); <del> $this->assertNull($model->sixth); <del> $this->assertNull($model->seventh); <del> $this->assertNull($model->eighth); <del> $this->assertNull($model->ninth); <del> $this->assertNull($model->tenth); <del> $this->assertNull($model->eleventh); <add> $this->assertNull($attributes['intAttribute']); <add> $this->assertNull($attributes['floatAttribute']); <add> $this->assertNull($attributes['stringAttribute']); <add> $this->assertNull($attributes['boolAttribute']); <add> $this->assertNull($attributes['booleanAttribute']); <add> $this->assertNull($attributes['objectAttribute']); <add> $this->assertNull($attributes['arrayAttribute']); <add> $this->assertNull($attributes['jsonAttribute']); <add> $this->assertNull($attributes['dateAttribute']); <add> $this->assertNull($attributes['datetimeAttribute']); <add> $this->assertNull($attributes['timestampAttribute']); <add> <add> $this->assertNull($model->intAttribute); <add> $this->assertNull($model->floatAttribute); <add> $this->assertNull($model->stringAttribute); <add> $this->assertNull($model->boolAttribute); <add> $this->assertNull($model->booleanAttribute); <add> $this->assertNull($model->objectAttribute); <add> $this->assertNull($model->arrayAttribute); <add> $this->assertNull($model->jsonAttribute); <add> $this->assertNull($model->dateAttribute); <add> $this->assertNull($model->datetimeAttribute); <add> $this->assertNull($model->timestampAttribute); <ide> <ide> $array = $model->toArray(); <ide> <del> $this->assertNull($array['first']); <del> $this->assertNull($array['second']); <del> $this->assertNull($array['third']); <del> $this->assertNull($array['fourth']); <del> $this->assertNull($array['fifth']); <del> $this->assertNull($array['sixth']); <del> $this->assertNull($array['seventh']); <del> $this->assertNull($array['eighth']); <del> $this->assertNull($array['ninth']); <del> $this->assertNull($array['tenth']); <del> $this->assertNull($array['eleventh']); <add> $this->assertNull($array['intAttribute']); <add> $this->assertNull($array['floatAttribute']); <add> $this->assertNull($array['stringAttribute']); <add> $this->assertNull($array['boolAttribute']); <add> $this->assertNull($array['booleanAttribute']); <add> $this->assertNull($array['objectAttribute']); <add> $this->assertNull($array['arrayAttribute']); <add> $this->assertNull($array['jsonAttribute']); <add> $this->assertNull($array['dateAttribute']); <add> $this->assertNull($array['datetimeAttribute']); <add> $this->assertNull($array['timestampAttribute']); <ide> } <ide> <ide> protected function addMockConnection($model) <ide> public function doNotGetFourthInvalidAttributeEither() <ide> class EloquentModelCastingStub extends Model <ide> { <ide> protected $casts = [ <del> 'first' => 'int', <del> 'second' => 'float', <del> 'third' => 'string', <del> 'fourth' => 'bool', <del> 'fifth' => 'boolean', <del> 'sixth' => 'object', <del> 'seventh' => 'array', <del> 'eighth' => 'json', <del> 'ninth' => 'date', <del> 'tenth' => 'datetime', <del> 'eleventh' => 'timestamp', <add> 'intAttribute' => 'int', <add> 'floatAttribute' => 'float', <add> 'stringAttribute' => 'string', <add> 'boolAttribute' => 'bool', <add> 'booleanAttribute' => 'boolean', <add> 'objectAttribute' => 'object', <add> 'arrayAttribute' => 'array', <add> 'jsonAttribute' => 'json', <add> 'dateAttribute' => 'date', <add> 'datetimeAttribute' => 'datetime', <add> 'timestampAttribute' => 'timestamp', <ide> ]; <ide> <del> public function eighthAttributeValue() <add> public function jsonAttributeValue() <ide> { <del> return $this->attributes['eighth']; <add> return $this->attributes['jsonAttribute']; <ide> } <ide> } <ide>
1
Text
Text
improve contributing text
66d97744e9b9bd8b48058ae93b7f95889f307c85
<ide><path>CONTRIBUTING.md <ide> Our Commitment to Open Source can be found [here](https://zeit.co/blog/oss) <ide> 1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local device. <ide> 2. Install the dependencies: `npm install` <ide> 3. Run `npm link` to link the local repo to NPM <del>4. Run npm run build in a new terminal to build and watch for code changes <add>4. Run `npm run build` to build and watch for code changes <ide> 5. Then npm link this repo inside any example app with `npm link next` <ide> 6. Then you can run your example app with the local version of Next.js (You may need to re-run the example app as you change server side code in the Next.js repository)
1
PHP
PHP
convert test to an integration test
f2511cb98df28595ce08dfde9eed120ad93433de
<ide><path>tests/TestCase/Shell/CompletionShellTest.php <ide> */ <ide> namespace Cake\Test\TestCase\Shell; <ide> <del>use Cake\Console\ConsoleIo; <del>use Cake\TestSuite\Stub\ConsoleOutput as StubOutput; <del>use Cake\TestSuite\TestCase; <add>use Cake\Console\Shell; <add>use Cake\TestSuite\ConsoleIntegrationTestCase; <ide> <ide> /** <ide> * CompletionShellTest <ide> */ <del>class CompletionShellTest extends TestCase <add>class CompletionShellTest extends ConsoleIntegrationTestCase <ide> { <ide> /** <ide> * setUp method <ide> public function setUp(): void <ide> parent::setUp(); <ide> static::setAppNamespace(); <ide> $this->loadPlugins(['TestPlugin', 'TestPluginTwo']); <del> <del> $this->out = new StubOutput(); <del> $io = new ConsoleIo($this->out); <del> <del> $this->Shell = $this->getMockBuilder('Cake\Shell\CompletionShell') <del> ->setMethods(['in', '_stop', 'clear']) <del> ->setConstructorArgs([$io]) <del> ->getMock(); <del> <del> $this->Shell->Command = $this->getMockBuilder('Cake\Shell\Task\CommandTask') <del> ->setMethods(['in', '_stop', 'clear']) <del> ->setConstructorArgs([$io]) <del> ->getMock(); <ide> } <ide> <ide> /** <ide> public function setUp(): void <ide> public function tearDown(): void <ide> { <ide> parent::tearDown(); <del> unset($this->Shell); <ide> static::setAppNamespace('App'); <ide> $this->clearPlugins(); <ide> } <ide> public function tearDown(): void <ide> */ <ide> public function testStartup() <ide> { <del> $this->Shell->runCommand(['main']); <del> $output = $this->out->output(); <add> $this->exec('completion'); <add> $this->assertExitCode(Shell::CODE_SUCCESS); <ide> <del> $needle = 'Welcome to CakePHP'; <del> $this->assertTextNotContains($needle, $output); <add> $this->assertOutputNotContains('Welcome to CakePHP'); <ide> } <ide> <ide> /** <ide> public function testStartup() <ide> */ <ide> public function testMain() <ide> { <del> $this->Shell->runCommand(['main']); <del> $output = $this->out->output(); <add> $this->exec('completion'); <add> $this->assertExitCode(Shell::CODE_SUCCESS); <ide> <del> $expected = '/This command is not intended to be called manually/'; <del> $this->assertRegExp($expected, $output); <add> $expected = 'This command is not intended to be called manually'; <add> $this->assertOutputContains($expected); <ide> } <ide> <ide> /** <ide> public function testMain() <ide> */ <ide> public function testCommands() <ide> { <del> $this->markTestIncomplete('pending completion shell rebuild'); <del> $this->Shell->runCommand(['commands']); <del> $output = $this->out->output(); <add> $this->markTestIncomplete('pending rebuild'); <add> $this->exec('completion commands'); <add> $this->assertExitCode(Shell::CODE_SUCCESS); <ide> <ide> // This currently incorrectly shows `cache clearall` when it should only show `cache` <ide> // The subcommands method also needs rework to handle multi-word subcommands <ide> $expected = 'TestPlugin.example TestPlugin.sample TestPluginTwo.example unique welcome ' . <ide> 'cache help i18n plugin routes schema_cache server upgrade version ' . <ide> "abort auto_load_model demo i18m integration merge sample shell_test testing_dispatch"; <del> $this->assertTextEquals($expected, $output); <add> $this->assertOutputContains($expected); <ide> } <ide> <ide> /** <ide> public function testCommands() <ide> */ <ide> public function testOptionsNoArguments() <ide> { <del> $this->Shell->runCommand(['options']); <del> $output = $this->out->output(); <del> <del> $expected = ''; <del> $this->assertTextEquals($expected, $output); <add> $this->exec('completion options'); <add> $this->assertExitCode(Shell::CODE_SUCCESS); <add> $this->assertOutputEmpty(); <ide> } <ide> <ide> /** <ide> public function testOptionsNoArguments() <ide> */ <ide> public function testOptionsNonExistingCommand() <ide> { <del> $this->Shell->runCommand(['options', 'foo']); <del> $output = $this->out->output(); <del> $expected = ''; <del> $this->assertTextEquals($expected, $output); <add> $this->exec('completion options foo'); <add> $this->assertExitCode(Shell::CODE_SUCCESS); <add> $this->assertOutputEmpty(); <ide> } <ide> <ide> /** <ide> public function testOptionsNonExistingCommand() <ide> */ <ide> public function testOptions() <ide> { <del> $this->Shell->runCommand(['options', 'schema_cache']); <del> $output = $this->out->output(); <add> $this->exec('completion options schema_cache'); <add> $this->assertExitCode(Shell::CODE_SUCCESS); <ide> <ide> $expected = "--connection -c --help -h --quiet -q --verbose -v"; <del> $this->assertTextEquals($expected, $output); <add> $this->assertOutputContains($expected); <ide> } <ide> <ide> /** <ide> public function testOptions() <ide> */ <ide> public function testOptionsTask() <ide> { <del> $this->Shell->runCommand(['options', 'sample', 'sample']); <del> $output = $this->out->output(); <add> $this->exec('completion options sample sample'); <add> $this->assertExitCode(Shell::CODE_SUCCESS); <ide> <ide> $expected = "--help -h --quiet -q --sample -s --verbose -v"; <del> $this->assertTextEquals($expected, $output); <add> $this->assertOutputContains($expected); <ide> } <ide> <ide> /** <ide> public function testOptionsTask() <ide> */ <ide> public function testSubCommandsCorePlugin() <ide> { <del> $this->Shell->runCommand(['subcommands', 'CORE.schema_cache']); <del> $output = $this->out->output(); <add> $this->exec('completion subcommands CORE.schema_cache'); <add> $this->assertExitCode(Shell::CODE_SUCCESS); <ide> <ide> $expected = "build clear"; <del> $this->assertTextEquals($expected, $output); <add> $this->assertOutputContains($expected); <ide> } <ide> <ide> /** <ide> public function testSubCommandsCorePlugin() <ide> */ <ide> public function testSubCommandsAppPlugin() <ide> { <del> $this->Shell->runCommand(['subcommands', 'app.sample']); <del> $output = $this->out->output(); <add> $this->exec('completion subcommands app.sample'); <add> $this->assertExitCode(Shell::CODE_SUCCESS); <ide> <ide> $expected = "derp load returnValue sample withAbort"; <del> $this->assertTextEquals($expected, $output); <add> $this->assertOutputContains($expected); <ide> } <ide> <ide> /** <ide> public function testSubCommandsAppPlugin() <ide> */ <ide> public function testSubCommandsCoreMultiwordCommand() <ide> { <del> $this->markTestIncomplete('pending completion shell rebuild'); <del> <del> $this->Shell->runCommand(['subcommands', 'CORE.cache']); <del> $output = $this->out->output(); <add> $this->markTestIncomplete(); <add> $this->exec('completion subcommands CORE.cache'); <add> $this->assertExitCode(Shell::CODE_SUCCESS); <ide> <ide> $expected = "list clear clearall"; <del> $this->assertTextEquals($expected, $output); <add> $this->assertOutputContains($expected); <ide> } <ide> <ide> /** <ide> public function testSubCommandsCoreMultiwordCommand() <ide> */ <ide> public function testSubCommandsPlugin() <ide> { <del> $this->Shell->runCommand(['subcommands', 'welcome']); <del> $output = $this->out->output(); <add> $this->exec('completion subcommands welcome'); <add> $this->assertExitCode(Shell::CODE_SUCCESS); <ide> <ide> $expected = "say_hello"; <del> $this->assertTextEquals($expected, $output); <add> $this->assertOutputContains($expected); <ide> } <ide> <ide> /** <ide> public function testSubCommandsPlugin() <ide> */ <ide> public function testSubCommandsPluginDotNotationBackwardCompatibility() <ide> { <del> $this->Shell->runCommand(['subcommands', 'TestPluginTwo.welcome']); <del> $output = $this->out->output(); <add> $this->exec('completion subcommands TestPluginTwo.welcome'); <add> $this->assertExitCode(Shell::CODE_SUCCESS); <ide> <ide> $expected = "say_hello"; <del> $this->assertTextEquals($expected, $output); <add> $this->assertOutputContains($expected); <ide> } <ide> <ide> /** <ide> public function testSubCommandsPluginDotNotationBackwardCompatibility() <ide> */ <ide> public function testSubCommandsPluginDotNotation() <ide> { <del> $this->Shell->runCommand(['subcommands', 'TestPluginTwo.example']); <del> $output = $this->out->output(); <add> $this->exec('completion subcommands TestPluginTwo.example'); <add> $this->assertExitCode(Shell::CODE_SUCCESS); <ide> <ide> $expected = "say_hello"; <del> $this->assertTextEquals($expected, $output); <add> $this->assertOutputContains($expected); <ide> } <ide> <ide> /** <ide> public function testSubCommandsPluginDotNotation() <ide> */ <ide> public function testSubCommandsAppDuplicatePluginNoDot() <ide> { <del> $this->Shell->runCommand(['subcommands', 'sample']); <del> $output = $this->out->output(); <add> $this->exec('completion subcommands sample'); <add> $this->assertExitCode(Shell::CODE_SUCCESS); <ide> <ide> $expected = "derp load returnValue sample withAbort"; <del> $this->assertTextEquals($expected, $output); <add> $this->assertOutputContains($expected); <ide> } <ide> <ide> /** <ide> public function testSubCommandsAppDuplicatePluginNoDot() <ide> */ <ide> public function testSubCommandsPluginDuplicateApp() <ide> { <del> $this->Shell->runCommand(['subcommands', 'TestPlugin.sample']); <del> $output = $this->out->output(); <add> $this->exec('completion subcommands TestPlugin.sample'); <add> $this->assertExitCode(Shell::CODE_SUCCESS); <ide> <ide> $expected = "example"; <del> $this->assertTextEquals($expected, $output); <add> $this->assertOutputContains($expected); <ide> } <ide> <ide> /** <ide> public function testSubCommandsPluginDuplicateApp() <ide> */ <ide> public function testSubCommandsNoArguments() <ide> { <del> $this->Shell->runCommand(['subcommands']); <del> $output = $this->out->output(); <add> $this->exec('completion subcommands'); <add> $this->assertExitCode(Shell::CODE_SUCCESS); <ide> <del> $expected = ''; <del> $this->assertEquals($expected, $output); <add> $this->assertOutputEmpty(); <ide> } <ide> <ide> /** <ide> public function testSubCommandsNoArguments() <ide> */ <ide> public function testSubCommandsNonExistingCommand() <ide> { <del> $this->Shell->runCommand(['subcommands', 'foo']); <del> $output = $this->out->output(); <add> $this->exec('completion subcommands foo'); <add> $this->assertExitCode(Shell::CODE_SUCCESS); <ide> <del> $expected = ''; <del> $this->assertEquals($expected, $output); <add> $this->assertOutputEmpty(); <ide> } <ide> <ide> /** <ide> public function testSubCommandsNonExistingCommand() <ide> */ <ide> public function testSubCommands() <ide> { <del> $this->Shell->runCommand(['subcommands', 'schema_cache']); <del> $output = $this->out->output(); <add> $this->exec('completion subcommands schema_cache'); <add> $this->assertExitCode(Shell::CODE_SUCCESS); <ide> <ide> $expected = "build clear"; <del> $this->assertTextEquals($expected, $output); <add> $this->assertOutputContains($expected); <ide> } <ide> <ide> /** <ide> public function testSubCommands() <ide> */ <ide> public function testFuzzy() <ide> { <del> $this->Shell->runCommand(['fuzzy']); <del> $output = $this->out->output(); <del> <del> $expected = ''; <del> $this->assertEquals($expected, $output); <add> $this->exec('completion fuzzy'); <add> $this->assertOutputEmpty(); <ide> } <ide> }
1
Text
Text
add guide article and update its challenge
6078081a3feba4647beb67cb94c95f34cd214841
<ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.english.md <ide> videoUrl: 'https://www.freecodecamp.org/news/how-recursion-works-explained-with- <ide> <ide> ## Description <ide> <section id='description'> <del>Recursion is the concept that a function can be expressed in terms of itself. To help understand this, start by thinking about the following task: multiply the first <code>n</code> elements in an array to create the product of the elements. Using a <code>for</code> loop, you could do this: <add>Recursion is the concept that a function can be expressed in terms of itself. To help understand this, start by thinking about the following task: multiply the elements from <code>0</code> to <code>n</code> inclusive in an array to create the product of those elements. Using a <code>for</code> loop, you could do this: <ide> <ide> ```js <ide> function multiply(arr, n) { <ide> However, notice that <code>multiply(arr, n) == multiply(arr, n - 1) * arr[n]</co <ide> } <ide> ``` <ide> <del>The recursive version of <code>multiply</code> breaks down like this. In the <dfn>base case</dfn>, where <code>n <= 0</code>, it returns the result, <code>arr[0]</code>. For larger values of <code>n</code>, it calls itself, but with <code>n - 1</code>. That function call is evaluated in the same way, calling <code>multiply</code> again until <code>n = 0</code>. At this point, all the functions can return and the original <code>multiply</code> returns the answer. <add>The recursive version of <code>multiply</code> breaks down like this. In the <dfn>base case</dfn>, where <code>n <= 0</code>, it returns the result, <code>arr[0]</code>. For larger values of <code>n</code>, it calls itself, but with <code>n - 1</code>. That function call is evaluated in the same way, calling <code>multiply</code> again until <code>n = 0</code>. At this point, all the functions can return and the original <code>multiply</code> returns the answer. <ide> <ide> <strong>Note:</strong> Recursive functions must have a base case when they return without calling the function again (in this example, when <code>n <= 0</code>), otherwise they can never finish executing. <ide> <ide> The recursive version of <code>multiply</code> breaks down like this. In the <df <ide> ## Instructions <ide> <section id='instructions'> <ide> <del>Write a recursive function, <code>sum(arr, n)</code>, that creates the sum of the first <code>n</code> elements of an array <code>arr</code>. <add>Write a recursive function, <code>sum(arr, n)</code>, that returns the sum of the elements from <code>0</code> to <code>n</code> inclusive in an array <code>arr</code>. <ide> <ide> </section> <ide> <ide><path>guide/english/certifications/javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion/index.md <add>--- <add>title: Replace Loops using Recursion <add>--- <add> <add># Replace Loops using Recursion <add> <add>### Hint 1: <add> <add>When `n <= 0` `sum(arr, n)` returns `arr[0]`. <add> <add>### Hint 2: <add> <add>When `n` is larger than 0 `sum(arr, n)` returns `sum(arr, n - 1) + arr[n]` <add> <add>## Basic code solution: <add> <add><details><summary>(Click to reveal)</summary> <add> <add>```js <add>function sum(arr, n) { <add> if (n <= 0) { <add> return arr[0]; <add> } else { <add> return sum(arr, n - 1) + arr[n]; <add> } <add>} <add> <add>``` <add> <add></details> <add> <add>### Code explanation <add> <add>The `if` statement checks to see if `sum` is evaluating the base case, `n <= 0`, or not. If it is, then `sum` returns the answer, `arr[0]` - the sum of elements from 0 to 0 inclusive. Otherwise it recurses by evaluating a simpler function call, `sum(arr, n - 1)`. Once that returns it adds a single array element, `arr[n]`, to it and returns that sum. <add> <add>### Resources <add> <add>- [Recursive Functions - *MDN JavaScript reference*](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Functions#Recursion)
2
Javascript
Javascript
remove confusing abstraction
24d9c94fe5f12dfd1f2d9058a4d8b8fa0efe3230
<ide><path>client/utils/buildChallenges.js <ide> const _ = require('lodash'); <ide> <ide> const { <ide> getChallengesForLang, <del> createChallengeCreator, <add> createChallenge, <ide> challengesDir, <ide> getChallengesDirForLang <ide> } = require('../../curriculum/getChallenges'); <ide> const { curriculumLocale } = require('../config/env.json'); <ide> <ide> exports.localeChallengesRootDir = getChallengesDirForLang(curriculumLocale); <ide> <del>const createChallenge = createChallengeCreator(challengesDir, curriculumLocale); <del> <ide> exports.replaceChallengeNode = () => { <ide> return async function replaceChallengeNode(filePath) { <del> return await createChallenge(filePath); <add> return await createChallenge(challengesDir, filePath, curriculumLocale); <ide> }; <ide> }; <ide> <ide><path>curriculum/getChallenges.js <ide> async function buildSuperBlocks({ path, fullPath }, curriculum) { <ide> return walk(fullPath, curriculum, { depth: 1, type: 'directories' }, cb); <ide> } <ide> <del>async function buildChallenges({ path, filePath }, curriculum, lang) { <add>async function buildChallenges({ path }, curriculum, lang) { <ide> // path is relative to getChallengesDirForLang(lang) <del> const createChallenge = createChallengeCreator(challengesDir, lang); <ide> const block = getBlockNameFromPath(path); <ide> const { name: superBlock } = superBlockInfoFromPath(path); <ide> let challengeBlock; <ide> async function buildChallenges({ path, filePath }, curriculum, lang) { <ide> } <ide> const { meta } = challengeBlock; <ide> <del> const challenge = await createChallenge(filePath, meta); <add> const challenge = await createChallenge(challengesDir, path, lang, meta); <ide> <ide> challengeBlock.challenges = [...challengeBlock.challenges, challenge]; <ide> } <ide> async function parseTranslation(transPath, dict, lang, parse = parseMD) { <ide> : translatedChal; <ide> } <ide> <del>function createChallengeCreator(basePath, lang) { <del> const hasEnglishSource = hasEnglishSourceCreator(basePath); <del> return async function createChallenge(filePath, maybeMeta) { <del> function getFullPath(pathLang) { <del> return path.resolve(__dirname, basePath, pathLang, filePath); <del> } <del> let meta; <del> if (maybeMeta) { <del> meta = maybeMeta; <del> } else { <del> const metaPath = path.resolve( <del> metaDir, <del> `./${getBlockNameFromPath(filePath)}/meta.json` <del> ); <del> meta = require(metaPath); <del> } <del> const { name: superBlock } = superBlockInfoFromPath(filePath); <del> if (!curriculumLangs.includes(lang)) <del> throw Error(`${lang} is not a accepted language. <add>async function createChallenge(basePath, filePath, lang, maybeMeta) { <add> function getFullPath(pathLang) { <add> return path.resolve(__dirname, basePath, pathLang, filePath); <add> } <add> let meta; <add> if (maybeMeta) { <add> meta = maybeMeta; <add> } else { <add> const metaPath = path.resolve( <add> metaDir, <add> `./${getBlockNameFromPath(filePath)}/meta.json` <add> ); <add> meta = require(metaPath); <add> } <add> const { name: superBlock } = superBlockInfoFromPath(filePath); <add> if (!curriculumLangs.includes(lang)) <add> throw Error(`${lang} is not a accepted language. <ide> Trying to parse ${filePath}`); <del> if (lang !== 'english' && !(await hasEnglishSource(filePath))) <del> throw Error(`Missing English challenge for <add> if (lang !== 'english' && !(await hasEnglishSource(basePath, filePath))) <add> throw Error(`Missing English challenge for <ide> ${filePath} <ide> It should be in <ide> ${getFullPath('english')} <ide> `); <del> // assumes superblock names are unique <del> // while the auditing is ongoing, we default to English for un-audited certs <del> // once that's complete, we can revert to using isEnglishChallenge(fullPath) <del> const useEnglish = lang === 'english' || !isAuditedCert(lang, superBlock); <del> const isCert = path.extname(filePath) === '.markdown'; <del> let challenge; <del> <del> if (isCert) { <del> // TODO: this uses the old parser to handle certifcates, but Markdown is a <del> // clunky way to store data, consider converting to YAML and removing the <del> // old parser. <del> challenge = await (useEnglish <del> ? parseMarkdown(getFullPath('english')) <del> : parseTranslation( <del> getFullPath(lang), <del> COMMENT_TRANSLATIONS, <del> lang, <del> parseMarkdown <del> )); <del> } else { <del> challenge = await (useEnglish <del> ? parseMD(getFullPath('english')) <del> : parseTranslation(getFullPath(lang), COMMENT_TRANSLATIONS, lang)); <del> } <del> const challengeOrder = findIndex( <del> meta.challengeOrder, <del> ([id]) => id === challenge.id <del> ); <del> const { <del> name: blockName, <del> order, <del> superOrder, <del> isPrivate, <del> required = [], <del> template, <del> time <del> } = meta; <del> challenge.block = blockName; <del> challenge.order = order; <del> challenge.superOrder = superOrder; <del> challenge.superBlock = superBlock; <del> challenge.challengeOrder = challengeOrder; <del> challenge.isPrivate = challenge.isPrivate || isPrivate; <del> challenge.required = required.concat(challenge.required || []); <del> challenge.template = template; <del> challenge.time = time; <del> challenge.helpCategory = <del> challenge.helpCategory || helpCategoryMap[dasherize(blockName)]; <del> <del> return prepareChallenge(challenge); <del> }; <add> // assumes superblock names are unique <add> // while the auditing is ongoing, we default to English for un-audited certs <add> // once that's complete, we can revert to using isEnglishChallenge(fullPath) <add> const useEnglish = lang === 'english' || !isAuditedCert(lang, superBlock); <add> const isCert = path.extname(filePath) === '.markdown'; <add> let challenge; <add> <add> if (isCert) { <add> // TODO: this uses the old parser to handle certifcates, but Markdown is a <add> // clunky way to store data, consider converting to YAML and removing the <add> // old parser. <add> challenge = await (useEnglish <add> ? parseMarkdown(getFullPath('english')) <add> : parseTranslation( <add> getFullPath(lang), <add> COMMENT_TRANSLATIONS, <add> lang, <add> parseMarkdown <add> )); <add> } else { <add> challenge = await (useEnglish <add> ? parseMD(getFullPath('english')) <add> : parseTranslation(getFullPath(lang), COMMENT_TRANSLATIONS, lang)); <add> } <add> const challengeOrder = findIndex( <add> meta.challengeOrder, <add> ([id]) => id === challenge.id <add> ); <add> const { <add> name: blockName, <add> order, <add> superOrder, <add> isPrivate, <add> required = [], <add> template, <add> time <add> } = meta; <add> challenge.block = blockName; <add> challenge.order = order; <add> challenge.superOrder = superOrder; <add> challenge.superBlock = superBlock; <add> challenge.challengeOrder = challengeOrder; <add> challenge.isPrivate = challenge.isPrivate || isPrivate; <add> challenge.required = required.concat(challenge.required || []); <add> challenge.template = template; <add> challenge.time = time; <add> challenge.helpCategory = <add> challenge.helpCategory || helpCategoryMap[dasherize(blockName)]; <add> <add> return prepareChallenge(challenge); <ide> } <ide> <ide> // TODO: tests and more descriptive name. <ide> function prepareChallenge(challenge) { <ide> return challenge; <ide> } <ide> <del>function hasEnglishSourceCreator(basePath) { <add>async function hasEnglishSource(basePath, translationPath) { <ide> const englishRoot = path.resolve(__dirname, basePath, 'english'); <del> return async function(translationPath) { <del> return await access( <del> path.join(englishRoot, translationPath), <del> fs.constants.F_OK <del> ) <del> .then(() => true) <del> .catch(() => false); <del> }; <add> return await access( <add> path.join(englishRoot, translationPath), <add> fs.constants.F_OK <add> ) <add> .then(() => true) <add> .catch(() => false); <ide> } <ide> <ide> function superBlockInfoFromPath(filePath) { <ide> function arrToString(arr) { <ide> return Array.isArray(arr) ? arr.join('\n') : toString(arr); <ide> } <ide> <del>exports.hasEnglishSourceCreator = hasEnglishSourceCreator; <add>exports.hasEnglishSource = hasEnglishSource; <ide> exports.parseTranslation = parseTranslation; <del>exports.createChallengeCreator = createChallengeCreator; <add>exports.createChallenge = createChallenge; <ide><path>curriculum/getChallenges.test.js <del>/* global expect beforeAll */ <add>/* global expect */ <ide> const path = require('path'); <ide> <ide> const { <del> createChallengeCreator, <del> hasEnglishSourceCreator, <add> createChallenge, <add> hasEnglishSource, <ide> createCommentMap <ide> } = require('./getChallenges'); <ide> <ide> const EXISTING_CHALLENGE_PATH = 'challenge.md'; <ide> const MISSING_CHALLENGE_PATH = 'no/challenge.md'; <ide> <del>let hasEnglishSource; <del>let createChallenge; <ide> const basePath = '__fixtures__'; <ide> <ide> describe('create non-English challenge', () => { <ide> describe('createChallenge', () => { <ide> it('throws if lang is an invalid language', async () => { <del> createChallenge = createChallengeCreator(basePath, 'notlang'); <ide> await expect( <del> createChallenge(EXISTING_CHALLENGE_PATH, {}) <add> createChallenge(basePath, EXISTING_CHALLENGE_PATH, 'notlang', {}) <ide> ).rejects.toThrow('notlang is not a accepted language'); <ide> }); <ide> it('throws an error if the source challenge is missing', async () => { <del> createChallenge = createChallengeCreator(basePath, 'chinese'); <del> await expect(createChallenge(MISSING_CHALLENGE_PATH, {})).rejects.toThrow( <add> await expect( <add> createChallenge(basePath, MISSING_CHALLENGE_PATH, 'chinese', {}) <add> ).rejects.toThrow( <ide> `Missing English challenge for <ide> ${MISSING_CHALLENGE_PATH} <ide> It should be in <ide> It should be in <ide> }); <ide> }); <ide> describe('hasEnglishSource', () => { <del> beforeAll(() => { <del> hasEnglishSource = hasEnglishSourceCreator(basePath); <del> }); <ide> it('returns a boolean', async () => { <del> const sourceExists = await hasEnglishSource(EXISTING_CHALLENGE_PATH); <add> const sourceExists = await hasEnglishSource( <add> basePath, <add> EXISTING_CHALLENGE_PATH <add> ); <ide> expect(typeof sourceExists).toBe('boolean'); <ide> }); <ide> it('returns true if the English challenge exists', async () => { <del> const sourceExists = await hasEnglishSource(EXISTING_CHALLENGE_PATH); <add> const sourceExists = await hasEnglishSource( <add> basePath, <add> EXISTING_CHALLENGE_PATH <add> ); <ide> expect(sourceExists).toBe(true); <ide> }); <ide> it('returns false if the English challenge is missing', async () => { <del> const sourceExists = await hasEnglishSource(MISSING_CHALLENGE_PATH); <add> const sourceExists = await hasEnglishSource( <add> basePath, <add> MISSING_CHALLENGE_PATH <add> ); <ide> expect(sourceExists).toBe(false); <ide> }); <ide> });
3