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
PHP
PHP
use fqn in docblock, remove description
7aabd8f0a8f8e0a3420359f807f42ceacb5c4140
<ide><path>src/Illuminate/Auth/SessionGuard.php <ide> protected function cycleRememberToken(AuthenticatableContract $user) <ide> * @param string $attribute <ide> * @return bool|null <ide> * <del> * @throws AuthenticationException If the password is invalid. <add> * @throws \Illuminate\Auth\AuthenticationException <ide> */ <ide> protected function rehashUserPassword($password, $attribute) <ide> { <ide> protected function rehashUserPassword($password, $attribute) <ide> * @param string $attribute <ide> * @return bool|null <ide> * <del> * @throws AuthenticationException If the password is invalid. <add> * @throws \Illuminate\Auth\AuthenticationException <ide> */ <ide> public function logoutOtherDevices($password, $attribute = 'password') <ide> {
1
Ruby
Ruby
sinatra app for browsing formula
d2d5993f995138ab7a6e489e9d7e93c0ed999d26
<ide><path>website/formulas.rb <add>require 'rubygems' <add>require 'sinatra' <add> <add>$LOAD_PATH << File.join(File.dirname(__FILE__), "../Library/Homebrew") <add>$LOAD_PATH << File.join(File.dirname(__FILE__), "../Library/Formula") <add> <add>require 'global' <add>require 'formula' <add> <add>get '/' do <add> body = "<ul>" <add> Formulary.read_all do |name, klass| <add> body << "<li><a href=\"/formula/#{name}\">#{name}</a></li>" <add> end <add> body << "</ul>" <add>end <add> <add>get '/formula/:name' do <add> klass = Formulary.read params[:name] <add> body = "<h1>#{klass.to_s}</h1>" <add> body << "<dl>" <add> body << "<dt>Version</dt>" <add> body << "<dd>#{klass.version}</dd>" <add> body << "<dt>Homepage</dt>" <add> body << "<dd><a href=\"#{klass.homepage}\">#{klass.homepage}</a></dd>" <add> body << "<dt>Download</dt>" <add> body << "<dd><a href=\"#{klass.url}\">#{klass.url}</a></dd>" <add> body << "<dt>MD5</dt>" <add> body << "<dd>#{klass.md5}</dd>" <add> body << "</dl>" <add>end
1
Text
Text
add guidelines regarding email
64e8fa9199fb345e017c8ef5299ca69cee01ab4c
<ide><path>CONTRIBUTING.md <ide> guidelines for the community as a whole: <ide> to an email you are potentially sending to a large number of people. Please <ide> consider this before you update. Also remember that nobody likes spam. <ide> <add>* Don't send email to the maintainers: There's no need to send email to the <add> maintainers to ask them to investigate an issue or to take a look at a <add> pull request. Instead of sending an email, GitHub mentions should be <add> used to ping maintainers to review a pull request, a proposal or an <add> issue. <add> <ide> ### Guideline violations — 3 strikes method <ide> <ide> The point of this section is not to find opportunities to punish people, but we
1
Text
Text
add link to migration issue
6ab16392344509151eeb1bde8671668b3d96e241
<ide><path>packages/README.md <ide> See [RFC 003](https://github.com/atom/atom/blob/master/docs/rfcs/003-consolidate <ide> | **one-dark-syntax** | [`atom/one-dark-syntax`][one-dark-syntax] | [#17853](https://github.com/atom/atom/issues/17853) | <ide> | **one-dark-ui** | [`atom/one-dark-ui`][one-dark-ui] | [#17854](https://github.com/atom/atom/issues/17854) | <ide> | **one-light-syntax** | [`atom/one-light-syntax`][one-light-syntax] | [#17855](https://github.com/atom/atom/issues/17855) | <del>| **one-light-ui** | [`./packages/one-light-ui`](./one-light-ui) | | <add>| **one-light-ui** | [`./packages/one-light-ui`](./one-light-ui) | [#17856](https://github.com/atom/atom/issues/17856) | <ide> | **open-on-github** | [`atom/open-on-github`][open-on-github] | | <ide> | **package-generator** | [`atom/package-generator`][package-generator] | | <ide> | **settings-view** | [`atom/settings-view`][settings-view] | |
1
Text
Text
add links to jenkins jobs
0915f0c6681890e47f94aab523a796f7e835f9e4
<ide><path>share/doc/homebrew/Brew-Test-Bot-For-Core-Contributors.md <ide> If a build has run and passed on `brew test-bot` then it can be used to quickly <ide> <ide> There are three types of Jenkins jobs: <ide> <del>## Homebrew <add>## [Homebrew](http://bot.brew.sh/job/Homebrew/) <ide> This job automatically builds anything committed to the master branch. On failure it sends an email to `brew-test-bot@googlegroups.com`. It tests rather than builds bottles. <ide> <del>## Homebrew Pull Requests <add>## [Homebrew Pull Requests](http://bot.brew.sh/job/Homebrew%20Pull%20Requests/) <ide> This job automatically builds any pull requests submitted to Homebrew/homebrew. On success or failure it updates the pull request status (see more details on the [main Brew Test Bot wiki page](Brew-Test-Bot.md)). On a successful build it automatically uploads bottles. <ide> <del>## Homebrew Testing <add>## [Homebrew Testing](http://bot.brew.sh/job/Homebrew%20Testing/) <ide> This job is manually triggered to run [`brew test-bot`](https://github.com/Homebrew/homebrew/blob/master/Library/Homebrew/cmd/test-bot.rb) with user-specified parameters. On a successful build it automatically uploads bottles. <ide> <ide> You can manually start this job with parameters to run [`brew test-bot`](https://github.com/Homebrew/homebrew/blob/master/Library/Homebrew/cmd/test-bot.rb) with the same parameters. It's often useful to pass a pull request URL, a commit URL, a commit SHA-1 and/or formula names to have `brew-test-bot` test them, report the results and produce bottles.
1
Text
Text
fix typo in the legend documentation
a191921b1553d0af05dbb6ee621f171aeabf9baa
<ide><path>docs/configuration/legend.md <ide> # Legend Configuration <ide> <del>The chart legend displays data about the datasets that area appearing on the chart. <add>The chart legend displays data about the datasets that are appearing on the chart. <ide> <ide> ## Configuration options <ide> The legend configuration is passed into the `options.legend` namespace. The global options for the chart legend is defined in `Chart.defaults.global.legend`.
1
PHP
PHP
fix styleci issue
88a61f5fdb5a7c397b3fc06618f1f65992eb845d
<ide><path>src/Illuminate/Support/Arr.php <ide> public static function exists($array, $key) <ide> public static function first($array, callable $callback = null, $default = null) <ide> { <ide> if (is_null($callback)) { <del> return !empty($array) ? reset($array) : value($default); <add> return empty($array) ? value($default) : reset($array); <ide> } <ide> <ide> foreach ($array as $key => $value) { <ide> public static function first($array, callable $callback = null, $default = null) <ide> public static function last($array, callable $callback = null, $default = null) <ide> { <ide> if (is_null($callback)) { <del> return !empty($array) ? end($array) : value($default); <add> return empty($array) ? value($default) : end($array); <ide> } <ide> <ide> return static::first(array_reverse($array), $callback, $default);
1
Javascript
Javascript
make order of bundle transports deterministic
925e2eba32e3d926749f275c2c36472bc63811e6
<ide><path>packager/react-packager/src/Bundler/Bundle.js <ide> class Bundle extends BundleBase { <ide> } <ide> <ide> addModule(resolver, resolutionResponse, module, moduleTransport) { <add> const index = super.addModule(moduleTransport); <ide> return resolver.wrapModule({ <ide> resolutionResponse, <ide> module, <ide> class Bundle extends BundleBase { <ide> this._shouldCombineSourceMaps = true; <ide> } <ide> <del> super.addModule(new ModuleTransport({...moduleTransport, code, map})); <add> this.replaceModuleAt( <add> index, new ModuleTransport({...moduleTransport, code, map})); <ide> }); <ide> } <ide> <ide><path>packager/react-packager/src/Bundler/BundleBase.js <ide> class BundleBase { <ide> } <ide> <ide> addModule(module) { <del> if (!module instanceof ModuleTransport) { <add> if (!(module instanceof ModuleTransport)) { <ide> throw new Error('Expeceted a ModuleTransport object'); <ide> } <ide> <del> this._modules.push(module); <add> return this._modules.push(module) - 1; <add> } <add> <add> replaceModuleAt(index, module) { <add> if (!(module instanceof ModuleTransport)) { <add> throw new Error('Expeceted a ModuleTransport object'); <add> } <add> <add> this._modules[index] = module; <ide> } <ide> <ide> getModules() { <ide><path>packager/react-packager/src/Bundler/__tests__/Bundle-test.js <ide> jest.autoMockOff(); <ide> <ide> const Bundle = require('../Bundle'); <add>const ModuleTransport = require('../../lib/ModuleTransport'); <ide> const Promise = require('Promise'); <ide> const SourceMapGenerator = require('source-map').SourceMapGenerator; <ide> const crypto = require('crypto'); <ide> describe('Bundle', () => { <ide> ].join('\n')); <ide> }); <ide> }); <add> <add> fpit('should insert modules in a deterministic order, independent from timing of the wrapping process', () => { <add> const moduleTransports = [ <add> createModuleTransport({name: 'module1'}), <add> createModuleTransport({name: 'module2'}), <add> createModuleTransport({name: 'module3'}), <add> ]; <add> <add> const resolves = {}; <add> const resolver = { <add> wrapModule({name}) { <add> return new Promise(resolve => resolves[name] = resolve); <add> } <add> }; <add> <add> console.log(bundle.addModule+'') <add> const promise = Promise.all( <add> moduleTransports.map(m => bundle.addModule(resolver, null, null, m))) <add> .then(() => { <add> expect(bundle.getModules()) <add> .toEqual(moduleTransports); <add> }); <add> <add> resolves.module2({code: ''}); <add> resolves.module3({code: ''}); <add> resolves.module1({code: ''}); <add> <add> return promise; <add> }); <ide> }); <ide> <ide> describe('sourcemap bundle', () => { <ide> function addModule({bundle, code, sourceCode, sourcePath, map, virtual}) { <ide> resolverFor(code, map), <ide> null, <ide> null, <del> {code, sourceCode, sourcePath, map, virtual} <add> createModuleTransport({code, sourceCode, sourcePath, map, virtual}) <ide> ); <ide> } <add> <add>function createModuleTransport(data) { <add> return new ModuleTransport({ <add> code: '', <add> sourceCode: '', <add> sourcePath: '', <add> ...data, <add> }); <add>}
3
Ruby
Ruby
add mime.fetch so we can have default mime types
7ef6a27f89ee2cccc3a8f73123d2a7173c85f52f
<ide><path>actionpack/lib/action_controller/test_case.rb <ide> def build_request_uri(action, parameters) <ide> <ide> def html_format?(parameters) <ide> return true unless parameters.is_a?(Hash) <del> format = Mime[parameters[:format]] <del> format.nil? || format.html? <add> Mime.fetch(parameters[:format]) { Mime['html'] }.html? <ide> end <ide> end <ide> <ide><path>actionpack/lib/action_dispatch/http/mime_type.rb <ide> def self.[](type) <ide> Type.lookup_by_extension(type.to_s) <ide> end <ide> <add> def self.fetch(type) <add> return type if type.is_a?(Type) <add> EXTENSION_LOOKUP.fetch(type.to_s) { |k| yield k } <add> end <add> <ide> # Encapsulates the notion of a mime type. Can be used at render time, for example, with: <ide> # <ide> # class PostsController < ActionController::Base
2
Text
Text
add link to homebrew blog in changelog.md
95cef86f885cf40f791769ef903cc2b43d4941a1
<ide><path>CHANGELOG.md <ide> See Homebrew's [releases on GitHub](https://github.com/Homebrew/brew/releases) for the changelog. <add> <add>Release notes for major and minor releases can also be found in the [Homebrew blog](https://brew.sh/blog/).
1
Javascript
Javascript
add delays so firefox can catch up
b8d0d78f81fcf26f62b1a9f18a082fbd951b999a
<ide><path>client/commonFramework/update-preview.js <ide> window.common = (function(global) { <ide> .first() <ide> // the delay here is to give code within the iframe <ide> // control to run <del> .delay(100); <add> .delay(400); <ide> }) <ide> .map(() => code); <ide> }; <ide><path>client/iFrameScripts.js <ide> window.$(document).ready(function() { <ide> return Rx.Observable.throw(window.__err); <ide> } <ide> <del> return Rx.Observable.from(tests) <add> return Rx.Observable.from(tests, null, null, Rx.Scheduler.default) <add> .delay(100) <ide> .map(test => { <ide> const userTest = {}; <ide> common.appendToOutputDisplay('');
2
Javascript
Javascript
make test less flakey-prone
3983a66eda1bef8bcfe28ce7f85566b0c27df05e
<ide><path>test/e2e/fixtures/ng-route-promise/script.js <ide> angular. <ide> return { <ide> letters: function($q) { <ide> return $q(function(resolve) { <del> window.setTimeout(resolve, 1000, ['a', 'b', 'c', 'd', 'e']); <add> window.setTimeout(resolve, 2000, ['a', 'b', 'c', 'd', 'e']); <ide> }); <ide> } <ide> }; <ide><path>test/e2e/tests/ng-route-promise.spec.js <ide> describe('ngRoute promises', function() { <ide> <ide> it('should time out if the promise takes long enough', function() { <ide> // Don't try this at home kids, I'm a protractor dev <del> browser.manage().timeouts().setScriptTimeout(1500); <add> browser.manage().timeouts().setScriptTimeout(1000); <ide> browser.waitForAngular().then(function() { <ide> fail('waitForAngular() should have timed out, but didn\'t'); <ide> }, function(error) {
2
Text
Text
fix api_view decorator useage
ff4804a36079f9c1d480a788397af3a7f8391371
<ide><path>docs/api-guide/authentication.md <ide> You can also set the authentication policy on a per-view basis, using the `APIVi <ide> <ide> Or, if you're using the `@api_view` decorator with function based views. <ide> <del> @api_view(('GET',)), <add> @api_view(['GET']) <ide> @authentication_classes((SessionAuthentication, UserBasicAuthentication)) <ide> @permissions_classes((IsAuthenticated,)) <ide> def example_view(request, format=None):
1
Javascript
Javascript
add tests for warncasesensitivemodulesplugin
0542f4ae565491f4d17998890401fcb8dc8399eb
<ide><path>test/WarnCaseSensitiveModulesPlugin.test.js <add>var should = require("should"); <add>var sinon = require("sinon"); <add>var PluginEnvironment = require("./helpers/PluginEnvironment"); <add>var applyPluginWithOptions = require("./helpers/applyPluginWithOptions"); <add>var WarnCaseSensitiveModulesPlugin = require("../lib/WarnCaseSensitiveModulesPlugin"); <add> <add>describe("WarnCaseSensitiveModulesPlugin", function() { <add> var env; <add> <add> beforeEach(function() { <add> env = {}; <add> }); <add> <add> it("has apply function", function() { <add> (new WarnCaseSensitiveModulesPlugin()).apply.should.be.a.Function(); <add> }); <add> <add> describe("when applied", function() { <add> beforeEach(function() { <add> env.eventBindings = applyPluginWithOptions(WarnCaseSensitiveModulesPlugin); <add> }); <add> <add> it("binds one event handler", function() { <add> env.eventBindings.length.should.be.exactly(1); <add> }); <add> <add> describe("compilation handler", function() { <add> beforeEach(function() { <add> env.pluginEnvironment = new PluginEnvironment(); <add> env.eventBinding = env.eventBindings[0]; <add> env.eventBinding.handler(env.pluginEnvironment.getEnvironmentStub()); <add> env.compilationEventBindings = env.pluginEnvironment.getEventBindings(); <add> }); <add> <add> it("binds to compilation event", function() { <add> env.eventBinding.name.should.be.exactly("compilation"); <add> }); <add> <add> it("binds one compilation event handler", function() { <add> env.compilationEventBindings.length.should.be.exactly(1); <add> }); <add> <add> describe("seal handler", function() { <add> beforeEach(function() { <add> env.compilationEventContext = { <add> modules: [{ <add> identifier: () => "Foo", <add> reasons: [] <add> }, <add> { <add> identifier: () => "Bar", <add> reasons: [] <add> }, <add> { <add> identifier: () => "fOO", <add> reasons: [] <add> } <add> ], <add> warnings: [] <add> }; <add> env.compilationEventBinding = env.compilationEventBindings[0]; <add> env.compilationEventBinding.handler.call(env.compilationEventContext); <add> }); <add> <add> it("binds to seal event", function() { <add> env.compilationEventBinding.name.should.be.exactly("seal"); <add> }); <add> <add> it("adds warning for each plugin with case insensitive name", function() { <add> env.compilationEventContext.warnings.length.should.be.exactly(1); <add> env.compilationEventContext.warnings[0].message.should.be.exactly(` <add>There are multiple modules with names that only differ in casing. <add>This can lead to unexpected behavior when compiling on a filesystem with other case-semantic. <add>Use equal casing. Compare these module identifiers: <add>* Foo <add>* fOO <add>`.trim()); <add> }); <add> }); <add> }); <add> }); <add>});
1
Text
Text
update translation of titles
04062a98899e412a738c236e503d5714cf7e1b96
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/basic-css/add-borders-around-your-elements.portuguese.md <ide> videoUrl: '' <ide> localeTitle: Adicionar bordas ao redor de seus elementos <ide> --- <ide> <del>## Description <add>## Descrição <ide> <section id="description"> As bordas CSS têm propriedades como <code>style</code> , <code>color</code> e <code>width</code> Por exemplo, se quisermos criar uma borda vermelha de 5 pixels em torno de um elemento HTML, poderíamos usar essa classe: <blockquote> &lt;style&gt; <br> .thin-red-border { <br> border-color: vermelho; <br> largura da borda: 5 px; <br> estilo de borda: sólido; <br> } <br> &lt;/ style&gt; </blockquote></section> <ide> <del>## Instructions <add>## Instruções <ide> <section id="instructions"> Crie uma classe chamada <code>thick-green-border</code> . Essa classe deve adicionar uma borda verde sólida de 10 pixels em torno de um elemento HTML. Aplique a turma à sua foto de gato. Lembre-se de que você pode aplicar várias classes a um elemento usando seu atributo de <code>class</code> , separando cada nome de classe com um espaço. Por exemplo: <code>&lt;img class=&quot;class1 class2&quot;&gt;</code> </section> <ide> <del>## Tests <add>## Testes <ide> <section id='tests'> <ide> <ide> ```yml <ide> tests: <ide> <ide> </section> <ide> <del>## Challenge Seed <add>## Desafio <ide> <section id='challengeSeed'> <ide> <ide> <div id='html-seed'> <ide> tests: <ide> <ide> </section> <ide> <del>## Solution <add>## Solução <ide> <section id='solution'> <ide> <ide> ```js
1
Python
Python
remove masked_lm_labels from returned dictionary
c6e865ac2bdad9f65c5bc51561563c46c427b506
<ide><path>src/transformers/data/data_collator.py <ide> def __call__(self, examples: List[Dict[str, torch.Tensor]]) -> Dict[str, torch.T <ide> "labels": mlm_labels if self.mlm else None, <ide> "next_sentence_label": torch.tensor(nsp_labels), <ide> } <del> if self.mlm: <del> result["masked_lm_labels"] = mlm_labels <ide> return result <ide> <ide> def _tensorize_batch(self, examples: List[torch.Tensor]) -> torch.Tensor:
1
Javascript
Javascript
keep auth in `url.resolve()` if host matches
51f96dfcfc7e596866ac2a65f2984b55e760bff5
<ide><path>lib/url.js <ide> Url.prototype.resolveObject = function(relative) { <ide> if (isRelAbs) { <ide> // it's absolute. <ide> if (relative.host || relative.host === '') { <add> if (result.host !== relative.host) result.auth = null; <ide> result.host = relative.host; <ide> result.port = relative.port; <del> result.auth = null; <ide> } <ide> if (relative.hostname || relative.hostname === '') { <add> if (result.hostname !== relative.hostname) result.auth = null; <ide> result.hostname = relative.hostname; <del> result.auth = null; <ide> } <ide> result.search = relative.search; <ide> result.query = relative.query; <ide><path>test/parallel/test-url.js <ide> var relativeTests2 = [ <ide> ['mailto:another.host.com', <ide> 'mailto:user@example.org', <ide> 'mailto:another.host.com'], <add> ['https://example.com/foo', <add> 'https://user:password@example.com', <add> 'https://user:password@example.com/foo'], <ide> ]; <ide> relativeTests2.forEach(function(relativeTest) { <ide> const a = url.resolve(relativeTest[1], relativeTest[0]);
2
Ruby
Ruby
create symlinks in opt for formula aliases
14ef15f591795c517b7771c5eb01863b2b577a46
<ide><path>Library/Homebrew/keg.rb <ide> def optlinked? <ide> <ide> def remove_opt_record <ide> opt_record.unlink <add> unless aliases.empty? <add> aliases.each do |a| <add> (opt_record.parent/a).unlink <add> end <add> end <ide> opt_record.parent.rmdir_if_possible <ide> end <ide> <ide> def remove_oldname_opt_record <ide> @oldname_opt_record = nil <ide> end <ide> <add> def aliases <add> formula_name = rack.basename.to_s <add> aliases_path = Formula[formula_name].tap.path/"Aliases" <add> result = aliases_path.children.select do |c| <add> c.symlink? && c.readlink.basename(".rb").to_s == formula_name <add> end <add> result.map(&:basename).map(&:to_s) <add> end <add> <ide> def optlink(mode = OpenStruct.new) <ide> opt_record.delete if opt_record.symlink? || opt_record.exist? <ide> make_relative_symlink(opt_record, path, mode) <add> unless aliases.empty? <add> aliases.each do |a| <add> alias_opt_record = opt_record.parent/a <add> alias_opt_record.delete if alias_opt_record.symlink? || alias_opt_record.exist? <add> make_relative_symlink(alias_opt_record, opt_record, mode) <add> end <add> end <ide> <ide> return unless oldname_opt_record <ide> oldname_opt_record.delete
1
Javascript
Javascript
use common.buildtype in embedding test
c3204a8787452e3c3727353ab397de7ee407e5cb
<ide><path>test/embedding/test-embedding.js <ide> const child_process = require('child_process'); <ide> const path = require('path'); <ide> <ide> common.allowGlobals(global.require); <del>let binary = process.features.debug ? <del> 'out/Debug/embedtest' : 'out/Release/embedtest'; <add>let binary = `out/${common.buildType}/embedtest`; <ide> if (common.isWindows) { <ide> binary += '.exe'; <ide> }
1
Ruby
Ruby
remove args from `default_render`
63d96adb685ae3cf464327c59a090ede25c55414
<ide><path>actionpack/lib/action_controller/metal/basic_implicit_render.rb <ide> def send_action(method, *args) <ide> super.tap { default_render unless performed? } <ide> end <ide> <del> def default_render(*args) <add> def default_render <ide> head :no_content <ide> end <ide> end <ide><path>actionpack/lib/action_controller/metal/implicit_render.rb <ide> module ImplicitRender <ide> # :stopdoc: <ide> include BasicImplicitRender <ide> <del> def default_render(*args) <add> def default_render <ide> if template_exists?(action_name.to_s, _prefixes, variants: request.variant) <del> render(*args) <add> render <ide> elsif any_templates?(action_name.to_s, _prefixes) <ide> message = "#{self.class.name}\##{action_name} is missing a template " \ <ide> "for this request format and variant.\n" \
2
Go
Go
fix golint issues on the windows graph driver
1fffc7a89dd69800317e881009188871906cce6a
<ide><path>daemon/graphdriver/windows/windows.go <ide> import ( <ide> "github.com/microsoft/hcsshim" <ide> ) <ide> <add>// init registers the windows graph drivers to the register. <ide> func init() { <ide> graphdriver.Register("windowsfilter", InitFilter) <ide> graphdriver.Register("windowsdiff", InitDiff) <ide> } <ide> <ide> const ( <add> // diffDriver is an hcsshim driver type <ide> diffDriver = iota <add> // filterDriver is an hcsshim driver type <ide> filterDriver <ide> ) <ide> <add>// Driver represents a windows graph driver. <ide> type Driver struct { <del> info hcsshim.DriverInfo <del> sync.Mutex // Protects concurrent modification to active <del> active map[string]int <add> // info stores the shim driver information <add> info hcsshim.DriverInfo <add> // Mutex protects concurrent modification to active <add> sync.Mutex <add> // active stores references to the activated layers <add> active map[string]int <ide> } <ide> <del>// New returns a new Windows storage filter driver. <add>// InitFilter returns a new Windows storage filter driver. <ide> func InitFilter(home string, options []string) (graphdriver.Driver, error) { <ide> logrus.Debugf("WindowsGraphDriver InitFilter at %s", home) <ide> d := &Driver{ <ide> func InitFilter(home string, options []string) (graphdriver.Driver, error) { <ide> return d, nil <ide> } <ide> <del>// New returns a new Windows differencing disk driver. <add>// InitDiff returns a new Windows differencing disk driver. <ide> func InitDiff(home string, options []string) (graphdriver.Driver, error) { <ide> logrus.Debugf("WindowsGraphDriver InitDiff at %s", home) <ide> d := &Driver{ <ide> func InitDiff(home string, options []string) (graphdriver.Driver, error) { <ide> return d, nil <ide> } <ide> <add>// String returns the string representation of a driver. <ide> func (d *Driver) String() string { <ide> switch d.info.Flavour { <ide> case diffDriver: <ide> func (d *Driver) String() string { <ide> } <ide> } <ide> <add>// Status returns the status of the driver. <ide> func (d *Driver) Status() [][2]string { <ide> return [][2]string{ <ide> {"Windows", ""}, <ide> } <ide> } <ide> <del>// Exists returns true if the given id is registered with <del>// this driver <add>// Exists returns true if the given id is registered with this driver. <ide> func (d *Driver) Exists(id string) bool { <del> rId, err := d.resolveId(id) <add> rID, err := d.resolveID(id) <ide> if err != nil { <ide> return false <ide> } <del> result, err := hcsshim.LayerExists(d.info, rId) <add> result, err := hcsshim.LayerExists(d.info, rID) <ide> if err != nil { <ide> return false <ide> } <ide> return result <ide> } <ide> <add>// Create creates a new layer with the given id. <ide> func (d *Driver) Create(id, parent string) error { <del> rPId, err := d.resolveId(parent) <add> rPId, err := d.resolveID(parent) <ide> if err != nil { <ide> return err <ide> } <ide> func (d *Driver) Create(id, parent string) error { <ide> return nil <ide> } <ide> <add>// dir returns the absolute path to the layer. <ide> func (d *Driver) dir(id string) string { <ide> return filepath.Join(d.info.HomeDir, filepath.Base(id)) <ide> } <ide> <del>// Remove unmounts and removes the dir information <add>// Remove unmounts and removes the dir information. <ide> func (d *Driver) Remove(id string) error { <del> rId, err := d.resolveId(id) <add> rID, err := d.resolveID(id) <ide> if err != nil { <ide> return err <ide> } <ide> <del> return hcsshim.DestroyLayer(d.info, rId) <add> return hcsshim.DestroyLayer(d.info, rID) <ide> } <ide> <del>// Get returns the rootfs path for the id. This will mount the dir at it's given path <add>// Get returns the rootfs path for the id. This will mount the dir at it's given path. <ide> func (d *Driver) Get(id, mountLabel string) (string, error) { <ide> logrus.Debugf("WindowsGraphDriver Get() id %s mountLabel %s", id, mountLabel) <ide> var dir string <ide> <ide> d.Lock() <ide> defer d.Unlock() <ide> <del> rId, err := d.resolveId(id) <add> rID, err := d.resolveID(id) <ide> if err != nil { <ide> return "", err <ide> } <ide> <ide> // Getting the layer paths must be done outside of the lock. <del> layerChain, err := d.getLayerChain(rId) <add> layerChain, err := d.getLayerChain(rID) <ide> if err != nil { <ide> return "", err <ide> } <ide> <del> if d.active[rId] == 0 { <del> if err := hcsshim.ActivateLayer(d.info, rId); err != nil { <add> if d.active[rID] == 0 { <add> if err := hcsshim.ActivateLayer(d.info, rID); err != nil { <ide> return "", err <ide> } <del> if err := hcsshim.PrepareLayer(d.info, rId, layerChain); err != nil { <del> if err2 := hcsshim.DeactivateLayer(d.info, rId); err2 != nil { <add> if err := hcsshim.PrepareLayer(d.info, rID, layerChain); err != nil { <add> if err2 := hcsshim.DeactivateLayer(d.info, rID); err2 != nil { <ide> logrus.Warnf("Failed to Deactivate %s: %s", id, err) <ide> } <ide> return "", err <ide> } <ide> } <ide> <del> mountPath, err := hcsshim.GetLayerMountPath(d.info, rId) <add> mountPath, err := hcsshim.GetLayerMountPath(d.info, rID) <ide> if err != nil { <del> if err2 := hcsshim.DeactivateLayer(d.info, rId); err2 != nil { <add> if err2 := hcsshim.DeactivateLayer(d.info, rID); err2 != nil { <ide> logrus.Warnf("Failed to Deactivate %s: %s", id, err) <ide> } <ide> return "", err <ide> } <ide> <del> d.active[rId]++ <add> d.active[rID]++ <ide> <ide> // If the layer has a mount path, use that. Otherwise, use the <ide> // folder path. <ide> func (d *Driver) Get(id, mountLabel string) (string, error) { <ide> return dir, nil <ide> } <ide> <add>// Put adds a new layer to the driver. <ide> func (d *Driver) Put(id string) error { <ide> logrus.Debugf("WindowsGraphDriver Put() id %s", id) <ide> <del> rId, err := d.resolveId(id) <add> rID, err := d.resolveID(id) <ide> if err != nil { <ide> return err <ide> } <ide> <ide> d.Lock() <ide> defer d.Unlock() <ide> <del> if d.active[rId] > 1 { <del> d.active[rId]-- <del> } else if d.active[rId] == 1 { <del> if err := hcsshim.UnprepareLayer(d.info, rId); err != nil { <add> if d.active[rID] > 1 { <add> d.active[rID]-- <add> } else if d.active[rID] == 1 { <add> if err := hcsshim.UnprepareLayer(d.info, rID); err != nil { <ide> return err <ide> } <del> if err := hcsshim.DeactivateLayer(d.info, rId); err != nil { <add> if err := hcsshim.DeactivateLayer(d.info, rID); err != nil { <ide> return err <ide> } <del> delete(d.active, rId) <add> delete(d.active, rID) <ide> } <ide> <ide> return nil <ide> } <ide> <add>// Cleanup ensures the information the driver stores is properly removed. <ide> func (d *Driver) Cleanup() error { <ide> return nil <ide> } <ide> <ide> // Diff produces an archive of the changes between the specified <ide> // layer and its parent layer which may be "". <ide> func (d *Driver) Diff(id, parent string) (arch archive.Archive, err error) { <del> rId, err := d.resolveId(id) <add> rID, err := d.resolveID(id) <ide> if err != nil { <ide> return <ide> } <ide> <ide> // Getting the layer paths must be done outside of the lock. <del> layerChain, err := d.getLayerChain(rId) <add> layerChain, err := d.getLayerChain(rID) <ide> if err != nil { <ide> return <ide> } <ide> func (d *Driver) Diff(id, parent string) (arch archive.Archive, err error) { <ide> <ide> // To support export, a layer must be activated but not prepared. <ide> if d.info.Flavour == filterDriver { <del> if d.active[rId] == 0 { <del> if err = hcsshim.ActivateLayer(d.info, rId); err != nil { <add> if d.active[rID] == 0 { <add> if err = hcsshim.ActivateLayer(d.info, rID); err != nil { <ide> d.Unlock() <ide> return <ide> } <ide> defer func() { <del> if err := hcsshim.DeactivateLayer(d.info, rId); err != nil { <del> logrus.Warnf("Failed to Deactivate %s: %s", rId, err) <add> if err := hcsshim.DeactivateLayer(d.info, rID); err != nil { <add> logrus.Warnf("Failed to Deactivate %s: %s", rID, err) <ide> } <ide> }() <ide> } else { <del> if err = hcsshim.UnprepareLayer(d.info, rId); err != nil { <add> if err = hcsshim.UnprepareLayer(d.info, rID); err != nil { <ide> d.Unlock() <ide> return <ide> } <ide> defer func() { <del> if err := hcsshim.PrepareLayer(d.info, rId, layerChain); err != nil { <del> logrus.Warnf("Failed to re-PrepareLayer %s: %s", rId, err) <add> if err := hcsshim.PrepareLayer(d.info, rID, layerChain); err != nil { <add> logrus.Warnf("Failed to re-PrepareLayer %s: %s", rID, err) <ide> } <ide> }() <ide> } <ide> } <ide> <ide> d.Unlock() <ide> <del> return d.exportLayer(rId, layerChain) <add> return d.exportLayer(rID, layerChain) <ide> } <ide> <ide> // Changes produces a list of changes between the specified layer <ide> func (d *Driver) Changes(id, parent string) ([]archive.Change, error) { <ide> // layer with the specified id and parent, returning the size of the <ide> // new layer in bytes. <ide> func (d *Driver) ApplyDiff(id, parent string, diff archive.Reader) (size int64, err error) { <del> rPId, err := d.resolveId(parent) <add> rPId, err := d.resolveID(parent) <ide> if err != nil { <ide> return <ide> } <ide> func (d *Driver) ApplyDiff(id, parent string, diff archive.Reader) (size int64, <ide> // and its parent and returns the size in bytes of the changes <ide> // relative to its base filesystem directory. <ide> func (d *Driver) DiffSize(id, parent string) (size int64, err error) { <del> rPId, err := d.resolveId(parent) <add> rPId, err := d.resolveID(parent) <ide> if err != nil { <ide> return <ide> } <ide> func (d *Driver) DiffSize(id, parent string) (size int64, err error) { <ide> return archive.ChangesSize(layerFs, changes), nil <ide> } <ide> <add>// RestoreCustomImages adds any auto-detected OS specific images to the tag and graph store. <ide> func (d *Driver) RestoreCustomImages(tagger graphdriver.Tagger, recorder graphdriver.Recorder) (imageIDs []string, err error) { <ide> strData, err := hcsshim.GetSharedBaseImages() <ide> if err != nil { <ide> func (d *Driver) RestoreCustomImages(tagger graphdriver.Tagger, recorder graphdr <ide> } <ide> <ide> // Create the alternate ID file. <del> if err := d.setId(img.ID, folderName); err != nil { <add> if err := d.setID(img.ID, folderName); err != nil { <ide> return nil, err <ide> } <ide> <ide> func (d *Driver) RestoreCustomImages(tagger graphdriver.Tagger, recorder graphdr <ide> return imageIDs, nil <ide> } <ide> <add>// GetMetadata returns custom driver information. <ide> func (d *Driver) GetMetadata(id string) (map[string]string, error) { <ide> m := make(map[string]string) <ide> m["dir"] = d.dir(id) <ide> return m, nil <ide> } <ide> <add>// exportLayer generates an archive from a layer based on the given ID. <ide> func (d *Driver) exportLayer(id string, parentLayerPaths []string) (arch archive.Archive, err error) { <ide> layerFolder := d.dir(id) <ide> <ide> func (d *Driver) exportLayer(id string, parentLayerPaths []string) (arch archive <ide> <ide> } <ide> <add>// importLayer adds a new layer to the tag and graph store based on the given data. <ide> func (d *Driver) importLayer(id string, layerData archive.Reader, parentLayerPaths []string) (size int64, err error) { <ide> layerFolder := d.dir(id) <ide> <ide> func (d *Driver) importLayer(id string, layerData archive.Reader, parentLayerPat <ide> return <ide> } <ide> <del>func (d *Driver) resolveId(id string) (string, error) { <del> content, err := ioutil.ReadFile(filepath.Join(d.dir(id), "layerId")) <add>// resolveID computes the layerID information based on the given id. <add>func (d *Driver) resolveID(id string) (string, error) { <add> content, err := ioutil.ReadFile(filepath.Join(d.dir(id), "layerID")) <ide> if os.IsNotExist(err) { <ide> return id, nil <ide> } else if err != nil { <ide> func (d *Driver) resolveId(id string) (string, error) { <ide> return string(content), nil <ide> } <ide> <del>func (d *Driver) setId(id, altId string) error { <del> err := ioutil.WriteFile(filepath.Join(d.dir(id), "layerId"), []byte(altId), 0600) <add>// setID stores the layerId in disk. <add>func (d *Driver) setID(id, altID string) error { <add> err := ioutil.WriteFile(filepath.Join(d.dir(id), "layerId"), []byte(altID), 0600) <ide> if err != nil { <ide> return err <ide> } <ide> return nil <ide> } <ide> <add>// getLayerChain returns the layer chain information. <ide> func (d *Driver) getLayerChain(id string) ([]string, error) { <ide> jPath := filepath.Join(d.dir(id), "layerchain.json") <ide> content, err := ioutil.ReadFile(jPath) <ide> func (d *Driver) getLayerChain(id string) ([]string, error) { <ide> return layerChain, nil <ide> } <ide> <add>// setLayerChain stores the layer chain information in disk. <ide> func (d *Driver) setLayerChain(id string, chain []string) error { <ide> content, err := json.Marshal(&chain) <ide> if err != nil {
1
Python
Python
add docstrings to compat and compat._inspect
4fb4c64cae2ce1ba16082d918e94e845fa2c87f3
<ide><path>numpy/compat/__init__.py <add>"""Compatibility module. <add> <add>This module contains duplicated code from python itself or 3rd party <add>extensions, which may be included for the following reasons: <add> - compatibility <add> - we may only need a small subset of the copied library/module <add>""" <ide> import _inspect <ide> from _inspect import getargspec, formatargspec <ide> <ide><path>numpy/compat/_inspect.py <add>"""Subset of inspect module from upstream python <add> <add>We use this instead of upstream because upstream inspect is slow to import, and <add>significanly contributes to numpy import times. Importing this copy has almost <add>no overhead. <add>""" <add> <ide> import types <ide> <ide> __all__ = ['getarspec', 'formatargspec']
2
Text
Text
fix zh_cn links
a8be80b94fb5538c7107944fc44b97ec86cc4c27
<ide><path>threejs/lessons/zh_cn/threejs-fundamentals.md <ide> ES6的语法。[点击这里查看你需要提前掌握的东西](threejs-prereq <ide> <ide> 上图需要注意的事项: <ide> <del>* 首先有一个[渲染器](`Renderer`)。这可以说是three.js的主要对象。你传入一个[场景](`Scene`)和一个[摄像机](`Camera`)到[渲染器](`Renderer`)中,然后它会将摄像机视椎体中的三维场景渲染成一个二维图片显示在画布上。 <add>* 首先有一个[渲染器(`Renderer`)](Renderer)。这可以说是three.js的主要对象。你传入一个[场景(`Scene`)](Scene)和一个[摄像机(`Camera`)](Camera)到[渲染器(`Renderer`)](Renderer)中,然后它会将摄像机视椎体中的三维场景渲染成一个二维图片显示在画布上。 <ide> <del>* 其次有一个[场景图](threejs-scenegraph.html) 它是一个树状结构,由很多对象组成,比如图中包含了一个[场景](`Scene`)对象 ,多个[网格](`Mesh`)对象,[光源](`Light`)对象,[群组](`Group`),[三维物体](`Object3D`),和[摄像机](`Camera`)对象。一个[场景](`Scene`)对象定义了场景图最基本的要素,并包了含背景色和雾等属性。这些对象通过一个层级关系明确的树状结构来展示出各自的位置和方向。子对象的位置和方向总是相对于父对象而言的。比如说汽车的轮子是汽车的子对象,这样移动和定位汽车时就会自动移动轮子。你可以在[场景图](threejs-scenegraph.html)的这篇文章中了解更多内容。 <add>* 其次有一个[场景图](threejs-scenegraph.html) 它是一个树状结构,由很多对象组成,比如图中包含了一个[场景(`Scene`)](Scene)对象 ,多个[网格(`Mesh`)](Mesh)对象,[光源(`Light`)](Light)对象,[群组(`Group`)](Group),[三维物体(`Object3D`)](Object3D),和[摄像机(`Camera`)](Camera)对象。一个[场景(`Scene`)](Scene)对象定义了场景图最基本的要素,并包了含背景色和雾等属性。这些对象通过一个层级关系明确的树状结构来展示出各自的位置和方向。子对象的位置和方向总是相对于父对象而言的。比如说汽车的轮子是汽车的子对象,这样移动和定位汽车时就会自动移动轮子。你可以在[场景图](threejs-scenegraph.html)的这篇文章中了解更多内容。 <ide> <del> 注意图中[摄像机](`Camera`)是一半在场景图中,一半在场景图外的。这表示在three.js中,[摄像机](`Camera`)和其他对象不同的是,它不一定要在场景图中才能起作用。相同的是,[摄像机](`Camera`)作为其他对象的子对象,同样会继承它父对象的位置和朝向。在[场景图](threejs-scenegraph.html)这篇文章的结尾部分有放置多个[摄像机](`Camera`)在一个场景中的例子。 <add> 注意图中[摄像机(`Camera`)](Camera)是一半在场景图中,一半在场景图外的。这表示在three.js中,[摄像机(`Camera`)](Camera)和其他对象不同的是,它不一定要在场景图中才能起作用。相同的是,[摄像机(`Camera`)](Camera)作为其他对象的子对象,同样会继承它父对象的位置和朝向。在[场景图](threejs-scenegraph.html)这篇文章的结尾部分有放置多个[摄像机(`Camera`)](Camera)在一个场景中的例子。 <ide> <del>* [网格](`Mesh`)对象可以理解为用一种特定的[材质](`Material`)来绘制的一个特定的[几何体](`Geometry`)。[材质](`Material`)和[几何体](`Geometry`)可以被多个[网格](`Mesh`)对象使用。比如在不同的位置画两个蓝色立方体,我们会需要两个[网格](`Mesh`)对象来代表每一个立方体的位置和方向。但只需一个[几何体](`Geometry`)来存放立方体的顶点数据,和一种[材质](`Material`)来定义立方体的颜色为蓝色就可以了。两个[网格](`Mesh`)对象都引用了相同的[几何体](`Geometry`)和[材质](`Material`)。 <add>* [网格(`Mesh`)](Mesh)对象可以理解为用一种特定的[材质(`Material`)](Material)来绘制的一个特定的[几何体(`Geometry`)](Geometry)。[材质(`Material`)](Material)和[几何体(`Geometry`)](Geometry)可以被多个[网格(`Mesh`)](Mesh)对象使用。比如在不同的位置画两个蓝色立方体,我们会需要两个[网格(`Mesh`)](Mesh)对象来代表每一个立方体的位置和方向。但只需一个[几何体(`Geometry`)](Geometry)来存放立方体的顶点数据,和一种[材质(`Material`)](Material)来定义立方体的颜色为蓝色就可以了。两个[网格(`Mesh`)](Mesh)对象都引用了相同的[几何体(`Geometry`)](Geometry)和[材质(`Material`)](Material)。 <ide> <del>* [几何体](`Geometry`)对象顾名思义代表一些几何体,如球体、立方体、平面、狗、猫、人、树、建筑等物体的顶点信息。Three.js内置了许多[基本几何体](threejs-primitives.html) 。你也可以[创建自定义几何体](threejs-custom-geometry.html)或[从文件中加载几何体](threejs-load-obj.html)。 <add>* [几何体(`Geometry`)](Geometry)对象顾名思义代表一些几何体,如球体、立方体、平面、狗、猫、人、树、建筑等物体的顶点信息。Three.js内置了许多[基本几何体](threejs-primitives.html) 。你也可以[创建自定义几何体](threejs-custom-geometry.html)或[从文件中加载几何体](threejs-load-obj.html)。 <ide> <del>* [材质](`Material`)对象代表[绘制几何体的表面属性](threejs-materials.html),包括使用的颜色,和光亮程度。一个[材质](`Material`)可以引用一个或多个[纹理](`Texture`),这些纹理可以用来,打个比方,将图像包裹到几何体的表面。 <add>* [材质(`Material`)](Material)对象代表[绘制几何体的表面属性](threejs-materials.html),包括使用的颜色,和光亮程度。一个[材质(`Material`)](Material)可以引用一个或多个[纹理(`Texture`)](Texture),这些纹理可以用来,打个比方,将图像包裹到几何体的表面。 <ide> <del>* [纹理](`Texture`)对象通常表示一幅要么[从文件中加载](threejs-textures.html),要么[在画布上生成](threejs-canvas-textures.html),要么[由另一个场景渲染出](threejs-rendertargets.html)的图像。 <add>* [纹理(`Texture`)](Texture)对象通常表示一幅要么[从文件中加载](threejs-textures.html),要么[在画布上生成](threejs-canvas-textures.html),要么[由另一个场景渲染出](threejs-rendertargets.html)的图像。 <ide> <del>* [光源](`Light`)对象代表[不同种类的光](threejs-lights.html)。 <add>* [光源(`Light`)](Light)对象代表[不同种类的光](threejs-lights.html)。 <ide> <ide> 有了以上基本概念,我们接下来就来画个下图所示的*"Hello Cube"*吧。 <ide> <ide> import * as THREE from './resources/threejs/r122/build/three.module.js'; <ide> </script> <ide> ``` <ide> <del>拿到canvas后我们需要创建一个[WebGL渲染器](`WebGLRenderer`)。渲染器负责将你提供的所有数据渲染绘制到canvas上。之前还有其他渲染器,比如[CSS渲染器](`CSSRenderer`)、[Canvas渲染器](`CanvasRenderer`)。将来也可能会有[WebGL2渲染器](`WebGL2Renderer`)或[WebGPU渲染器](`WebGPURenderer`)。目前的话是[WebGL渲染器](`WebGLRenderer`),它通过WebGL将三维空间渲染到canvas上。 <add>拿到canvas后我们需要创建一个[WebGL渲染器(`WebGLRenderer`)](WebGLRenderer)。渲染器负责将你提供的所有数据渲染绘制到canvas上。之前还有其他渲染器,比如[CSS渲染器(`CSSRenderer`)](CSSRenderer)、[Canvas渲染器(`CanvasRenderer`)](CanvasRenderer)。将来也可能会有[WebGL2渲染器(`WebGL2Renderer`)](WebGL2Renderer)或[WebGPU渲染器(`WebGPURenderer`)](WebGPURenderer)。目前的话是[WebGL渲染器(`WebGLRenderer`)](WebGLRenderer),它通过WebGL将三维空间渲染到canvas上。 <ide> <ide> 注意这里有一些细节。如果你没有给three.js传canvas,three.js会自己创建一个 ,但是你必须手动把它添加到文档中。在哪里添加可能会不一样这取决你怎么使用, 我发现给three.js传一个canvas会更灵活一些。我可以将canvas放到任何地方, 代码都会找到它,假如我有一段代码是将canvas插入到文档中,那么当需求变化时, 我很可能必须去修改这段代码。 <ide> <del>接下来我们需要一个[透视摄像机](`PerspectiveCamera`)。 <add>接下来我们需要一个[透视摄像机(`PerspectiveCamera`)](PerspectiveCamera)。 <ide> <ide> ```js <ide> const fov = 75; <ide> camera.position.z = 2; <ide> <ide> 我们能看到摄像机的位置在`z = 2`。它朝向Z轴负方向。我们的视椎体范围从摄像机前方0.1到5。因为这张图是俯视图,视野范围会受到宽高比的影响。画布的宽度是高度的两倍,所以水平视角会比我们设置的垂直视角75度要大。 <ide> <del>然后我们创建一个[场景](`Scene`)。[场景](`Scene`)是three.js的基本的组成部分。需要three.js绘制的东西都需要加入到scene中。 我们将会在[场景是如何工作的](threejs-scenegraph.html)一文中详细讨论。 <add>然后我们创建一个[场景(`Scene`)](Scene)。[场景(`Scene`)](Scene)是three.js的基本的组成部分。需要three.js绘制的东西都需要加入到scene中。 我们将会在[场景是如何工作的](threejs-scenegraph.html)一文中详细讨论。 <ide> <ide> ```js <ide> const scene = new THREE.Scene(); <ide> ``` <ide> <del>然后创建一个包含盒子信息的[立方几何体](`BoxGeometry`)。几乎所有希望在three.js中显示的物体都需要一个包含了组成三维物体的顶点信息的几何体。 <add>然后创建一个包含盒子信息的[立方几何体(`BoxGeometry`)](BoxGeometry)。几乎所有希望在three.js中显示的物体都需要一个包含了组成三维物体的顶点信息的几何体。 <ide> <ide> ```js <ide> const boxWidth = 1; <ide> const geometry = new THREE.BoxGeometry(boxWidth, boxHeight, boxDepth); <ide> const material = new THREE.MeshBasicMaterial({color: 0x44aa88}); <ide> ``` <ide> <del>再创建一个[网格](`Mesh`)对象,它包含了: <add>再创建一个[网格(`Mesh`)](Mesh)对象,它包含了: <ide> <del>1. [几何体](`Geometry`)(物体的形状) <del>2. [材质](`Material`)(如何绘制物体,光滑还是平整,什么颜色,什么贴图等等) <add>1. [几何体(`Geometry`)](Geometry)(物体的形状) <add>2. [材质(`Material`)](Material)(如何绘制物体,光滑还是平整,什么颜色,什么贴图等等) <ide> 3. 对象在场景中相对于他父对象的位置、朝向、和缩放。下面的代码中父对象即为场景对象。 <ide> <ide> ```js <ide> function render(time) { <ide> <ide> <div class="threejs_center"><img src="resources/images/threejs-3cubes-scene.svg" style="width: 610px;"></div> <ide> <del>正如你看见的那样,我们有三个[网格](`Mesh`)引用了相同的[立方几何体](`BoxGeometry`)。每个[网格](`Mesh`)引用了一个单独的`MeshPhongMaterial`材质来显示不同的颜色。 <add>正如你看见的那样,我们有三个[网格(`Mesh`)](Mesh)引用了相同的[立方几何体(`BoxGeometry`)](BoxGeometry)。每个[网格(`Mesh`)](Mesh)引用了一个单独的`MeshPhongMaterial`材质来显示不同的颜色。 <ide> <ide> 希望这个简短的介绍能帮助你起步。[接下来我们将介绍如何使我们的代码具有响应性,从而使其能够适应多种情况](threejs-responsive.html). <ide>
1
Text
Text
add guide to using mailhog with docker
54df230b8e04b1ed1af6f1af4545e20ee07ff696
<ide><path>docs/how-to-catch-outgoing-emails-locally.md <ide> MailHog can be installed on macOS, Windows and Linux. <ide> <ide> - [Introduction](#introduction) <ide> - [Installing MailHog](#installing-mailhog) <add> - [Installing MailHog with Docker](#installing-mailhog-with-docker) <ide> - [Installing MailHog on macOS](#installing-mailhog-on-macos) <ide> - [Installing MailHog on Windows](#installing-mailhog-on-windows) <ide> - [Installing MailHog on Linux](#installing-mailhog-on-linux) <ide> - [Using MailHog](#using-mailhog) <ide> - [Useful Links](#useful-links) <ide> <add>### Installing MailHog with Docker <add> <add>If you have Docker installed then you can use <add> <add>```bash <add>docker run -d --name mailhog --rm mailhog/mailhog <add>``` <add> <add>to start MailHog in the background and <add> <add>```bash <add>docker stop mailhog <add>``` <add> <add>to stop it. <add> <add>When the installation completes, you can start [using MailHog](#using-mailhog). <add> <ide> ### Installing MailHog on macOS <ide> <ide> Install MailHog on macOS with [Homebrew](https://brew.sh/):
1
Javascript
Javascript
use highest priority lane to detect interruptions
4a99c5c3a780d8178d9278c29d0b7f44be6a0dce
<ide><path>packages/react-reconciler/src/ReactFiberLane.new.js <ide> export function getNextLanes(root: FiberRoot, wipLanes: Lanes): Lanes { <ide> // bother waiting until the root is complete. <ide> (wipLanes & suspendedLanes) === NoLanes <ide> ) { <del> getHighestPriorityLanes(wipLanes); <del> const wipLanePriority = return_highestLanePriority; <add> const nextLane = getHighestPriorityLane(nextLanes); <add> const wipLane = getHighestPriorityLane(wipLanes); <ide> if ( <del> nextLanePriority <= wipLanePriority || <add> // Tests whether the next lane is equal or lower priority than the wip <add> // one. This works because the bits decrease in priority as you go left. <add> nextLane >= wipLane || <ide> // Default priority updates should not interrupt transition updates. The <ide> // only difference between default updates and transition updates is that <ide> // default updates do not support refresh transitions. <del> (nextLanePriority === DefaultLanePriority && <del> wipLanePriority === TransitionPriority) <add> (nextLane === DefaultLane && (wipLane & TransitionLanes) !== NoLanes) <ide> ) { <ide> // Keep working on the existing in-progress tree. Do not interrupt. <ide> return wipLanes; <ide><path>packages/react-reconciler/src/ReactFiberLane.old.js <ide> export function getNextLanes(root: FiberRoot, wipLanes: Lanes): Lanes { <ide> // bother waiting until the root is complete. <ide> (wipLanes & suspendedLanes) === NoLanes <ide> ) { <del> getHighestPriorityLanes(wipLanes); <del> const wipLanePriority = return_highestLanePriority; <add> const nextLane = getHighestPriorityLane(nextLanes); <add> const wipLane = getHighestPriorityLane(wipLanes); <ide> if ( <del> nextLanePriority <= wipLanePriority || <add> // Tests whether the next lane is equal or lower priority than the wip <add> // one. This works because the bits decrease in priority as you go left. <add> nextLane >= wipLane || <ide> // Default priority updates should not interrupt transition updates. The <ide> // only difference between default updates and transition updates is that <ide> // default updates do not support refresh transitions. <del> (nextLanePriority === DefaultLanePriority && <del> wipLanePriority === TransitionPriority) <add> (nextLane === DefaultLane && (wipLane & TransitionLanes) !== NoLanes) <ide> ) { <ide> // Keep working on the existing in-progress tree. Do not interrupt. <ide> return wipLanes;
2
Javascript
Javascript
improve coverage for internal/readline
731c55a08e6f91ac44d860243ce52ebbc380cb62
<ide><path>test/parallel/test-readline-keys.js <ide> addTest('\x1b[31ma\x1b[39ma', [ <ide> { name: 'a', sequence: 'a' }, <ide> ]); <ide> <add>// rxvt keys with modifiers <add>addTest('\x1b[a\x1b[b\x1b[c\x1b[d\x1b[e', [ <add> { name: 'up', sequence: '\x1b[a', code: '[a', shift: true }, <add> { name: 'down', sequence: '\x1b[b', code: '[b', shift: true }, <add> { name: 'right', sequence: '\x1b[c', code: '[c', shift: true }, <add> { name: 'left', sequence: '\x1b[d', code: '[d', shift: true }, <add> { name: 'clear', sequence: '\x1b[e', code: '[e', shift: true }, <add>]); <add> <add>addTest('\x1bOa\x1bOb\x1bOc\x1bOd\x1bOe', [ <add> { name: 'up', sequence: '\x1bOa', code: 'Oa', ctrl: true }, <add> { name: 'down', sequence: '\x1bOb', code: 'Ob', ctrl: true }, <add> { name: 'right', sequence: '\x1bOc', code: 'Oc', ctrl: true }, <add> { name: 'left', sequence: '\x1bOd', code: 'Od', ctrl: true }, <add> { name: 'clear', sequence: '\x1bOe', code: 'Oe', ctrl: true }, <add>]); <add> <ide> // Reduce array of addKeyIntervalTest(..) right to left <ide> // with () => {} as initial function <ide> const runKeyIntervalTests = [
1
Javascript
Javascript
fix some missing braces in core.js
b7a3b220a8a2b5b0378c9f176ca5ae0f786a6fcf
<ide><path>src/core.js <ide> jQuery.fn = jQuery.prototype = { <ide> var match, elem, ret; <ide> <ide> // Handle $(""), $(null), or $(undefined) <del> if ( !selector ) return this; <add> if ( !selector ) { <add> return this; <add> } <ide> <ide> // Handle $(DOMElement) <ide> if ( selector.nodeType ) { <ide> jQuery.fn = jQuery.prototype = { <ide> if ( elem ) { <ide> // Handle the case where IE and Opera return items <ide> // by name instead of ID <del> if ( elem.id !== match[2] ) return rootjQuery.find( selector ); <add> if ( elem.id !== match[2] ) { <add> return rootjQuery.find( selector ); <add> } <ide> <ide> // Otherwise, we inject the element directly into the jQuery object <ide> this.length++;
1
Javascript
Javascript
remove timermixin from listview
8ceb1586ee596a1bdf44bbb8e4c6ab54cbaa7c8b
<ide><path>Libraries/Lists/ListView/ListView.js <ide> const RCTScrollViewManager = require('NativeModules').ScrollViewManager; <ide> const ScrollView = require('ScrollView'); <ide> const ScrollResponder = require('ScrollResponder'); <ide> const StaticRenderer = require('StaticRenderer'); <del>const TimerMixin = require('react-timer-mixin'); <ide> const View = require('View'); <ide> const cloneReferencedElement = require('react-clone-referenced-element'); <ide> const createReactClass = require('create-react-class'); <ide> type Props = $ReadOnly<{| <ide> <ide> const ListView = createReactClass({ <ide> displayName: 'ListView', <add> _rafIds: ([]: Array<AnimationFrameID>), <ide> _childFrames: ([]: Array<Object>), <ide> _sentEndForContentLength: (null: ?number), <ide> _scrollComponent: (null: ?React.ElementRef<typeof ScrollView>), <ide> _prevRenderedRowsCount: 0, <ide> _visibleRows: ({}: Object), <ide> scrollProperties: ({}: Object), <ide> <del> mixins: [ScrollResponder.Mixin, TimerMixin], <add> mixins: [ScrollResponder.Mixin], <ide> <ide> statics: { <ide> DataSource: ListViewDataSource, <ide> const ListView = createReactClass({ <ide> contentLength: null, <ide> offset: 0, <ide> }; <add> <add> this._rafIds = []; <ide> this._childFrames = []; <ide> this._visibleRows = {}; <ide> this._prevRenderedRowsCount = 0; <ide> this._sentEndForContentLength = null; <ide> }, <ide> <add> componentWillUnmount: function() { <add> this._rafIds.forEach(cancelAnimationFrame); <add> this._rafIds = []; <add> }, <add> <ide> componentDidMount: function() { <ide> // do this in animation frame until componentDidMount actually runs after <ide> // the component is laid out <del> this.requestAnimationFrame(() => { <add> this._requestAnimationFrame(() => { <ide> this._measureAndUpdateScrollProps(); <ide> }); <ide> }, <ide> const ListView = createReactClass({ <ide> }, <ide> <ide> componentDidUpdate: function() { <del> this.requestAnimationFrame(() => { <add> this._requestAnimationFrame(() => { <ide> this._measureAndUpdateScrollProps(); <ide> }); <ide> }, <ide> const ListView = createReactClass({ <ide> * Private methods <ide> */ <ide> <add> _requestAnimationFrame: function(fn: () => void): void { <add> const rafId = requestAnimationFrame(() => { <add> this._rafIds.splice(this._rafIds.indexOf(rafId)); <add> fn(); <add> }); <add> this._rafIds.push(rafId); <add> }, <add> <ide> _measureAndUpdateScrollProps: function() { <ide> const scrollComponent = this.getScrollResponder(); <ide> if (!scrollComponent || !scrollComponent.getInnerViewNode) {
1
PHP
PHP
update doc blocks
3b57704a279ec409417a251c5850938422176831
<ide><path>lib/Cake/View/View.php <ide> * but can also take the form of JSON, XML, PDF's or streaming files. <ide> * <ide> * CakePHP uses a two-step-view pattern. This means that the view content is rendered first, <del> * and then inserted into the selected layout. A special `$content_for_layout` variable is available <del> * in the layout, and it contains the rendered view. This also means you can pass data from the view to the <add> * and then inserted into the selected layout. This also means you can pass data from the view to the <ide> * layout using `$this->set()` <ide> * <ide> * @package Cake.View <ide> public function render($view = null, $layout = null) { <ide> * Use the block features instead. `meta`, `css` and `script` will be populated <ide> * by the matching methods on HtmlHelper. <ide> * - `$title_for_layout` is deprecated and will be removed in CakePHP 3.0 <del> * - `$content_for_layout` is deprecated and will be removed in CakePHP 3.0. <add> * - `$content_for_layout` is deprecated and will be removed in CakePHP 3.0. <ide> * Use the `content` block instead. <ide> * <ide> * @param string $content Content to render in a view, wrapped by the surrounding layout.
1
PHP
PHP
add table name quoting to update queries
e67599835044fb7d1b073ac5480b9f1987c2ea0d
<ide><path>src/Database/IdentifierQuoter.php <ide> public function quote(Query $query) <ide> <ide> if ($query->type() === 'insert') { <ide> $this->_quoteInsert($query); <add> } elseif ($query->type() === 'update') { <add> $this->_quoteUpdate($query); <ide> } else { <ide> $this->_quoteParts($query); <ide> } <ide> protected function _quoteInsert($query) <ide> $query->insert($columns)->into($table); <ide> } <ide> <add> /** <add> * Quotes the table name for an update query <add> * <add> * @param \Cake\Database\Query $query The update query to quote. <add> * @return void <add> */ <add> protected function _quoteUpdate($query) <add> { <add> $table = $query->clause('update')[0]; <add> $query->update($this->_driver->quoteIdentifier($table)); <add> } <add> <ide> /** <ide> * Quotes identifiers in expression objects implementing the field interface <ide> *
1
PHP
PHP
add sqlite query driver
295c3b80c26c4b55d13e03640f71c82bd14dbca1
<ide><path>laravel/database/connection.php <ide> protected function grammar() <ide> case 'mysql': <ide> return $this->grammar = new Query\Grammars\MySQL($this); <ide> <add> case 'sqlite': <add> return $this->grammar = new Query\Grammars\SQLite($this); <add> <ide> case 'sqlsrv': <ide> return $this->grammar = new Query\Grammars\SQLServer($this); <ide> <ide><path>laravel/database/query/grammars/sqlite.php <add><?php namespace Laravel\Database\Query\Grammars; <add> <add>use Laravel\Database\Query; <add> <add>class SQLite extends Grammar <add>{ <add> <add> /** <add> * Compile the ORDER BY clause for a query. <add> * <add> * @param Query $query <add> * @return string <add> */ <add> protected function orderings(Query $query) <add> { <add> foreach ($query->orderings as $ordering) <add> { <add> $sql[] = $this->wrap($ordering['column']).' COLLATE NOCASE '.strtoupper($ordering['direction']); <add> } <add> <add> return 'ORDER BY '.implode(', ', $sql); <add> } <add> <add>} <ide>\ No newline at end of file <ide><path>laravel/uri.php <ide> public static function current() <ide> <ide> // We'll simply get the path info from the Symfony Request instance and then <ide> // format to meet our needs in the router. If the URI is root, we'll give <del> // back a single slash, otherwise we'll strip the slashes. <add> // back a single slash, otherwise we'll strip all of the slashes off. <ide> $uri = static::format(Request::getPathInfo()); <ide> <ide> static::segments($uri);
3
Go
Go
use checker on integration test when possible
710817a71b40287acc546fe2e08367b2a02dae54
<ide><path>integration-cli/docker_api_resize_test.go <ide> import ( <ide> "net/http" <ide> "strings" <ide> <add> "github.com/docker/docker/pkg/integration/checker" <ide> "github.com/go-check/check" <ide> ) <ide> <ide> func (s *DockerSuite) TestResizeApiResponseWhenContainerNotStarted(c *check.C) { <ide> c.Assert(status, check.Equals, http.StatusInternalServerError) <ide> c.Assert(err, check.IsNil) <ide> <del> if !strings.Contains(string(body), "Cannot resize container") && !strings.Contains(string(body), cleanedContainerID) { <del> c.Fatalf("resize should fail with message 'Cannot resize container' but instead received %s", string(body)) <del> } <add> c.Assert(string(body), checker.Contains, "is not running", check.Commentf("resize should fail with message 'Container is not running'")) <ide> } <ide><path>integration-cli/docker_api_stats_test.go <ide> import ( <ide> "time" <ide> <ide> "github.com/docker/docker/api/types" <add> "github.com/docker/docker/pkg/integration/checker" <ide> "github.com/go-check/check" <ide> ) <ide> <ide> func (s *DockerSuite) TestApiStatsNoStreamGetCpu(c *check.C) { <ide> out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "while true;do echo 'Hello'; usleep 100000; done") <ide> <ide> id := strings.TrimSpace(out) <del> c.Assert(waitRun(id), check.IsNil) <add> c.Assert(waitRun(id), checker.IsNil) <ide> <ide> resp, body, err := sockRequestRaw("GET", fmt.Sprintf("/containers/%s/stats?stream=false", id), nil, "") <del> c.Assert(err, check.IsNil) <del> c.Assert(resp.ContentLength > 0, check.Equals, true, check.Commentf("should not use chunked encoding")) <del> c.Assert(resp.Header.Get("Content-Type"), check.Equals, "application/json") <add> c.Assert(err, checker.IsNil) <add> c.Assert(resp.ContentLength, checker.GreaterThan, int64(0), check.Commentf("should not use chunked encoding")) <add> c.Assert(resp.Header.Get("Content-Type"), checker.Equals, "application/json") <ide> <ide> var v *types.Stats <ide> err = json.NewDecoder(body).Decode(&v) <del> c.Assert(err, check.IsNil) <add> c.Assert(err, checker.IsNil) <ide> body.Close() <ide> <ide> var cpuPercent = 0.0 <ide> cpuDelta := float64(v.CPUStats.CPUUsage.TotalUsage - v.PreCPUStats.CPUUsage.TotalUsage) <ide> systemDelta := float64(v.CPUStats.SystemUsage - v.PreCPUStats.SystemUsage) <ide> cpuPercent = (cpuDelta / systemDelta) * float64(len(v.CPUStats.CPUUsage.PercpuUsage)) * 100.0 <del> if cpuPercent == 0 { <del> c.Fatalf("docker stats with no-stream get cpu usage failed: was %v", cpuPercent) <del> } <add> <add> c.Assert(cpuPercent, check.Not(checker.Equals), 0.0, check.Commentf("docker stats with no-stream get cpu usage failed: was %v", cpuPercent)) <ide> } <ide> <ide> func (s *DockerSuite) TestApiStatsStoppedContainerInGoroutines(c *check.C) { <ide> func (s *DockerSuite) TestApiStatsStoppedContainerInGoroutines(c *check.C) { <ide> <ide> getGoRoutines := func() int { <ide> _, body, err := sockRequestRaw("GET", fmt.Sprintf("/info"), nil, "") <del> c.Assert(err, check.IsNil) <add> c.Assert(err, checker.IsNil) <ide> info := types.Info{} <ide> err = json.NewDecoder(body).Decode(&info) <del> c.Assert(err, check.IsNil) <add> c.Assert(err, checker.IsNil) <ide> body.Close() <ide> return info.NGoroutines <ide> } <ide> <ide> // When the HTTP connection is closed, the number of goroutines should not increase. <ide> routines := getGoRoutines() <ide> _, body, err := sockRequestRaw("GET", fmt.Sprintf("/containers/%s/stats", id), nil, "") <del> c.Assert(err, check.IsNil) <add> c.Assert(err, checker.IsNil) <ide> body.Close() <ide> <ide> t := time.After(30 * time.Second) <ide> for { <ide> select { <ide> case <-t: <del> c.Assert(getGoRoutines() <= routines, check.Equals, true) <add> c.Assert(getGoRoutines(), checker.LessOrEqualThan, routines) <ide> return <ide> default: <ide> if n := getGoRoutines(); n <= routines { <ide> func (s *DockerSuite) TestApiStatsNetworkStats(c *check.C) { <ide> // Run container for 30 secs <ide> out, _ := dockerCmd(c, "run", "-d", "busybox", "top") <ide> id := strings.TrimSpace(out) <del> c.Assert(waitRun(id), check.IsNil) <add> c.Assert(waitRun(id), checker.IsNil) <ide> <ide> // Retrieve the container address <ide> contIP := findContainerIP(c, id) <ide> func (s *DockerSuite) TestApiStatsNetworkStats(c *check.C) { <ide> } <ide> pingout, err := exec.Command("ping", contIP, countParam, strconv.Itoa(numPings)).Output() <ide> pingouts := string(pingout[:]) <del> c.Assert(err, check.IsNil) <add> c.Assert(err, checker.IsNil) <ide> nwStatsPost := getNetworkStats(c, id) <ide> for _, v := range nwStatsPost { <ide> postRxPackets += v.RxPackets <ide> func (s *DockerSuite) TestApiStatsNetworkStats(c *check.C) { <ide> // Verify the stats contain at least the expected number of packets (account for ARP) <ide> expRxPkts := 1 + preRxPackets + uint64(numPings) <ide> expTxPkts := 1 + preTxPackets + uint64(numPings) <del> c.Assert(postTxPackets >= expTxPkts, check.Equals, true, <add> c.Assert(postTxPackets, checker.GreaterOrEqualThan, expTxPkts, <ide> check.Commentf("Reported less TxPackets than expected. Expected >= %d. Found %d. %s", expTxPkts, postTxPackets, pingouts)) <del> c.Assert(postRxPackets >= expRxPkts, check.Equals, true, <add> c.Assert(postRxPackets, checker.GreaterOrEqualThan, expRxPkts, <ide> check.Commentf("Reported less Txbytes than expected. Expected >= %d. Found %d. %s", expRxPkts, postRxPackets, pingouts)) <ide> } <ide> <ide> func getNetworkStats(c *check.C, id string) map[string]types.NetworkStats { <ide> var st *types.StatsJSON <ide> <ide> _, body, err := sockRequestRaw("GET", fmt.Sprintf("/containers/%s/stats?stream=false", id), nil, "") <del> c.Assert(err, check.IsNil) <add> c.Assert(err, checker.IsNil) <ide> <ide> err = json.NewDecoder(body).Decode(&st) <del> c.Assert(err, check.IsNil) <add> c.Assert(err, checker.IsNil) <ide> body.Close() <ide> <ide> return st.Networks <ide> func (s *DockerSuite) TestApiStatsContainerNotFound(c *check.C) { <ide> testRequires(c, DaemonIsLinux) <ide> <ide> status, _, err := sockRequest("GET", "/containers/nonexistent/stats", nil) <del> c.Assert(err, check.IsNil) <del> c.Assert(status, check.Equals, http.StatusNotFound) <add> c.Assert(err, checker.IsNil) <add> c.Assert(status, checker.Equals, http.StatusNotFound) <ide> <ide> status, _, err = sockRequest("GET", "/containers/nonexistent/stats?stream=0", nil) <del> c.Assert(err, check.IsNil) <del> c.Assert(status, check.Equals, http.StatusNotFound) <add> c.Assert(err, checker.IsNil) <add> c.Assert(status, checker.Equals, http.StatusNotFound) <ide> } <ide><path>integration-cli/docker_api_test.go <ide> import ( <ide> "time" <ide> <ide> "github.com/docker/docker/api" <add> "github.com/docker/docker/pkg/integration/checker" <ide> "github.com/go-check/check" <ide> ) <ide> <ide> func (s *DockerSuite) TestApiOptionsRoute(c *check.C) { <ide> status, _, err := sockRequest("OPTIONS", "/", nil) <del> c.Assert(err, check.IsNil) <del> c.Assert(status, check.Equals, http.StatusOK) <add> c.Assert(err, checker.IsNil) <add> c.Assert(status, checker.Equals, http.StatusOK) <ide> } <ide> <ide> func (s *DockerSuite) TestApiGetEnabledCors(c *check.C) { <ide> res, body, err := sockRequestRaw("GET", "/version", nil, "") <del> c.Assert(err, check.IsNil) <del> c.Assert(res.StatusCode, check.Equals, http.StatusOK) <add> c.Assert(err, checker.IsNil) <add> c.Assert(res.StatusCode, checker.Equals, http.StatusOK) <ide> body.Close() <ide> // TODO: @runcom incomplete tests, why old integration tests had this headers <ide> // and here none of the headers below are in the response? <ide> func (s *DockerSuite) TestApiGetEnabledCors(c *check.C) { <ide> <ide> func (s *DockerSuite) TestApiVersionStatusCode(c *check.C) { <ide> conn, err := sockConn(time.Duration(10 * time.Second)) <del> c.Assert(err, check.IsNil) <add> c.Assert(err, checker.IsNil) <ide> <ide> client := httputil.NewClientConn(conn, nil) <ide> defer client.Close() <ide> <ide> req, err := http.NewRequest("GET", "/v999.0/version", nil) <del> c.Assert(err, check.IsNil) <add> c.Assert(err, checker.IsNil) <ide> req.Header.Set("User-Agent", "Docker-Client/999.0 (os)") <ide> <ide> res, err := client.Do(req) <del> c.Assert(res.StatusCode, check.Equals, http.StatusBadRequest) <add> c.Assert(res.StatusCode, checker.Equals, http.StatusBadRequest) <ide> } <ide> <ide> func (s *DockerSuite) TestApiClientVersionNewerThanServer(c *check.C) { <ide> v := strings.Split(string(api.Version), ".") <ide> vMinInt, err := strconv.Atoi(v[1]) <del> c.Assert(err, check.IsNil) <add> c.Assert(err, checker.IsNil) <ide> vMinInt++ <ide> v[1] = strconv.Itoa(vMinInt) <ide> version := strings.Join(v, ".") <ide> <ide> status, body, err := sockRequest("GET", "/v"+version+"/version", nil) <del> c.Assert(err, check.IsNil) <del> c.Assert(status, check.Equals, http.StatusBadRequest) <del> c.Assert(len(string(body)), check.Not(check.Equals), 0) // Expected not empty body <add> c.Assert(err, checker.IsNil) <add> c.Assert(status, checker.Equals, http.StatusBadRequest) <add> c.Assert(len(string(body)), check.Not(checker.Equals), 0) // Expected not empty body <ide> } <ide> <ide> func (s *DockerSuite) TestApiClientVersionOldNotSupported(c *check.C) { <ide> v := strings.Split(string(api.MinVersion), ".") <ide> vMinInt, err := strconv.Atoi(v[1]) <del> c.Assert(err, check.IsNil) <add> c.Assert(err, checker.IsNil) <ide> vMinInt-- <ide> v[1] = strconv.Itoa(vMinInt) <ide> version := strings.Join(v, ".") <ide> <ide> status, body, err := sockRequest("GET", "/v"+version+"/version", nil) <del> c.Assert(err, check.IsNil) <del> c.Assert(status, check.Equals, http.StatusBadRequest) <del> c.Assert(len(string(body)), check.Not(check.Equals), 0) // Expected not empty body <add> c.Assert(err, checker.IsNil) <add> c.Assert(status, checker.Equals, http.StatusBadRequest) <add> c.Assert(len(string(body)), checker.Not(check.Equals), 0) // Expected not empty body <ide> } <ide><path>integration-cli/docker_api_volumes_test.go <ide> import ( <ide> "path" <ide> <ide> "github.com/docker/docker/api/types" <add> "github.com/docker/docker/pkg/integration/checker" <ide> "github.com/go-check/check" <ide> ) <ide> <ide> func (s *DockerSuite) TestVolumesApiList(c *check.C) { <ide> dockerCmd(c, "run", "-d", "-v", "/foo", "busybox") <ide> <ide> status, b, err := sockRequest("GET", "/volumes", nil) <del> c.Assert(err, check.IsNil) <del> c.Assert(status, check.Equals, http.StatusOK) <add> c.Assert(err, checker.IsNil) <add> c.Assert(status, checker.Equals, http.StatusOK) <ide> <ide> var volumes types.VolumesListResponse <del> c.Assert(json.Unmarshal(b, &volumes), check.IsNil) <add> c.Assert(json.Unmarshal(b, &volumes), checker.IsNil) <ide> <del> c.Assert(len(volumes.Volumes), check.Equals, 1, check.Commentf("\n%v", volumes.Volumes)) <add> c.Assert(len(volumes.Volumes), checker.Equals, 1, check.Commentf("\n%v", volumes.Volumes)) <ide> } <ide> <ide> func (s *DockerSuite) TestVolumesApiCreate(c *check.C) { <ide> func (s *DockerSuite) TestVolumesApiCreate(c *check.C) { <ide> <ide> var vol types.Volume <ide> err = json.Unmarshal(b, &vol) <del> c.Assert(err, check.IsNil) <add> c.Assert(err, checker.IsNil) <ide> <del> c.Assert(path.Base(path.Dir(vol.Mountpoint)), check.Equals, config.Name) <add> c.Assert(path.Base(path.Dir(vol.Mountpoint)), checker.Equals, config.Name) <ide> } <ide> <ide> func (s *DockerSuite) TestVolumesApiRemove(c *check.C) { <ide> testRequires(c, DaemonIsLinux) <ide> dockerCmd(c, "run", "-d", "-v", "/foo", "--name=test", "busybox") <ide> <ide> status, b, err := sockRequest("GET", "/volumes", nil) <del> c.Assert(err, check.IsNil) <del> c.Assert(status, check.Equals, http.StatusOK) <add> c.Assert(err, checker.IsNil) <add> c.Assert(status, checker.Equals, http.StatusOK) <ide> <ide> var volumes types.VolumesListResponse <del> c.Assert(json.Unmarshal(b, &volumes), check.IsNil) <del> c.Assert(len(volumes.Volumes), check.Equals, 1, check.Commentf("\n%v", volumes.Volumes)) <add> c.Assert(json.Unmarshal(b, &volumes), checker.IsNil) <add> c.Assert(len(volumes.Volumes), checker.Equals, 1, check.Commentf("\n%v", volumes.Volumes)) <ide> <ide> v := volumes.Volumes[0] <ide> status, _, err = sockRequest("DELETE", "/volumes/"+v.Name, nil) <del> c.Assert(err, check.IsNil) <del> c.Assert(status, check.Equals, http.StatusConflict, check.Commentf("Should not be able to remove a volume that is in use")) <add> c.Assert(err, checker.IsNil) <add> c.Assert(status, checker.Equals, http.StatusConflict, check.Commentf("Should not be able to remove a volume that is in use")) <ide> <ide> dockerCmd(c, "rm", "-f", "test") <ide> status, data, err := sockRequest("DELETE", "/volumes/"+v.Name, nil) <del> c.Assert(err, check.IsNil) <del> c.Assert(status, check.Equals, http.StatusNoContent, check.Commentf(string(data))) <add> c.Assert(err, checker.IsNil) <add> c.Assert(status, checker.Equals, http.StatusNoContent, check.Commentf(string(data))) <ide> <ide> } <ide> <ide> func (s *DockerSuite) TestVolumesApiInspect(c *check.C) { <ide> c.Assert(status, check.Equals, http.StatusCreated, check.Commentf(string(b))) <ide> <ide> status, b, err = sockRequest("GET", "/volumes", nil) <del> c.Assert(err, check.IsNil) <del> c.Assert(status, check.Equals, http.StatusOK, check.Commentf(string(b))) <add> c.Assert(err, checker.IsNil) <add> c.Assert(status, checker.Equals, http.StatusOK, check.Commentf(string(b))) <ide> <ide> var volumes types.VolumesListResponse <del> c.Assert(json.Unmarshal(b, &volumes), check.IsNil) <del> c.Assert(len(volumes.Volumes), check.Equals, 1, check.Commentf("\n%v", volumes.Volumes)) <add> c.Assert(json.Unmarshal(b, &volumes), checker.IsNil) <add> c.Assert(len(volumes.Volumes), checker.Equals, 1, check.Commentf("\n%v", volumes.Volumes)) <ide> <ide> var vol types.Volume <ide> status, b, err = sockRequest("GET", "/volumes/"+config.Name, nil) <del> c.Assert(err, check.IsNil) <del> c.Assert(status, check.Equals, http.StatusOK, check.Commentf(string(b))) <del> c.Assert(json.Unmarshal(b, &vol), check.IsNil) <del> c.Assert(vol.Name, check.Equals, config.Name) <add> c.Assert(err, checker.IsNil) <add> c.Assert(status, checker.Equals, http.StatusOK, check.Commentf(string(b))) <add> c.Assert(json.Unmarshal(b, &vol), checker.IsNil) <add> c.Assert(vol.Name, checker.Equals, config.Name) <ide> } <ide><path>integration-cli/docker_cli_push_test.go <ide> import ( <ide> "strings" <ide> "time" <ide> <add> "github.com/docker/docker/pkg/integration/checker" <ide> "github.com/go-check/check" <ide> ) <ide> <ide> func (s *DockerRegistrySuite) TestPushBusyboxImage(c *check.C) { <ide> <ide> // pushing an image without a prefix should throw an error <ide> func (s *DockerSuite) TestPushUnprefixedRepo(c *check.C) { <del> if out, _, err := dockerCmdWithError("push", "busybox"); err == nil { <del> c.Fatalf("pushing an unprefixed repo didn't result in a non-zero exit status: %s", out) <del> } <add> out, _, err := dockerCmdWithError("push", "busybox") <add> c.Assert(err, check.NotNil, check.Commentf("pushing an unprefixed repo didn't result in a non-zero exit status: %s", out)) <ide> } <ide> <ide> func (s *DockerRegistrySuite) TestPushUntagged(c *check.C) { <ide> repoName := fmt.Sprintf("%v/dockercli/busybox", privateRegistryURL) <del> <ide> expected := "Repository does not exist" <del> if out, _, err := dockerCmdWithError("push", repoName); err == nil { <del> c.Fatalf("pushing the image to the private registry should have failed: output %q", out) <del> } else if !strings.Contains(out, expected) { <del> c.Fatalf("pushing the image failed with an unexpected message: expected %q, got %q", expected, out) <del> } <add> <add> out, _, err := dockerCmdWithError("push", repoName) <add> c.Assert(err, check.NotNil, check.Commentf("pushing the image to the private registry should have failed: output %q", out)) <add> c.Assert(out, checker.Contains, expected, check.Commentf("pushing the image failed")) <ide> } <ide> <ide> func (s *DockerRegistrySuite) TestPushBadTag(c *check.C) { <ide> repoName := fmt.Sprintf("%v/dockercli/busybox:latest", privateRegistryURL) <del> <ide> expected := "does not exist" <ide> <del> if out, _, err := dockerCmdWithError("push", repoName); err == nil { <del> c.Fatalf("pushing the image to the private registry should have failed: output %q", out) <del> } else if !strings.Contains(out, expected) { <del> c.Fatalf("pushing the image failed with an unexpected message: expected %q, got %q", expected, out) <del> } <add> out, _, err := dockerCmdWithError("push", repoName) <add> c.Assert(err, check.NotNil, check.Commentf("pushing the image to the private registry should have failed: output %q", out)) <add> c.Assert(out, checker.Contains, expected, check.Commentf("pushing the image failed")) <ide> } <ide> <ide> func (s *DockerRegistrySuite) TestPushMultipleTags(c *check.C) { <ide> func (s *DockerRegistrySuite) TestPushMultipleTags(c *check.C) { <ide> <ide> // Ensure layer list is equivalent for repoTag1 and repoTag2 <ide> out1, _ := dockerCmd(c, "pull", repoTag1) <del> if strings.Contains(out1, "Tag t1 not found") { <del> c.Fatalf("Unable to pull pushed image: %s", out1) <del> } <add> <ide> imageAlreadyExists := ": Image already exists" <ide> var out1Lines []string <ide> for _, outputLine := range strings.Split(out1, "\n") { <ide> func (s *DockerRegistrySuite) TestPushMultipleTags(c *check.C) { <ide> } <ide> <ide> out2, _ := dockerCmd(c, "pull", repoTag2) <del> if strings.Contains(out2, "Tag t2 not found") { <del> c.Fatalf("Unable to pull pushed image: %s", out1) <del> } <add> <ide> var out2Lines []string <ide> for _, outputLine := range strings.Split(out2, "\n") { <ide> if strings.Contains(outputLine, imageAlreadyExists) { <ide> out1Lines = append(out1Lines, outputLine) <ide> } <ide> } <del> <del> if len(out1Lines) != len(out2Lines) { <del> c.Fatalf("Mismatched output length:\n%s\n%s", out1, out2) <del> } <add> c.Assert(out2Lines, checker.HasLen, len(out1Lines)) <ide> <ide> for i := range out1Lines { <del> if out1Lines[i] != out2Lines[i] { <del> c.Fatalf("Mismatched output line:\n%s\n%s", out1Lines[i], out2Lines[i]) <del> } <add> c.Assert(out1Lines[i], checker.Equals, out2Lines[i]) <ide> } <ide> } <ide> <ide> func (s *DockerRegistrySuite) TestPushEmptyLayer(c *check.C) { <ide> repoName := fmt.Sprintf("%v/dockercli/emptylayer", privateRegistryURL) <ide> emptyTarball, err := ioutil.TempFile("", "empty_tarball") <del> if err != nil { <del> c.Fatalf("Unable to create test file: %v", err) <del> } <add> c.Assert(err, check.IsNil, check.Commentf("Unable to create test file")) <add> <ide> tw := tar.NewWriter(emptyTarball) <ide> err = tw.Close() <del> if err != nil { <del> c.Fatalf("Error creating empty tarball: %v", err) <del> } <add> c.Assert(err, check.IsNil, check.Commentf("Error creating empty tarball")) <add> <ide> freader, err := os.Open(emptyTarball.Name()) <del> if err != nil { <del> c.Fatalf("Could not open test tarball: %v", err) <del> } <add> c.Assert(err, check.IsNil, check.Commentf("Could not open test tarball")) <ide> <ide> importCmd := exec.Command(dockerBinary, "import", "-", repoName) <ide> importCmd.Stdin = freader <ide> out, _, err := runCommandWithOutput(importCmd) <del> if err != nil { <del> c.Errorf("import failed with errors: %v, output: %q", err, out) <del> } <add> c.Assert(err, check.IsNil, check.Commentf("import failed: %q", out)) <ide> <ide> // Now verify we can push it <del> if out, _, err := dockerCmdWithError("push", repoName); err != nil { <del> c.Fatalf("pushing the image to the private registry has failed: %s, %v", out, err) <del> } <add> out, _, err = dockerCmdWithError("push", repoName) <add> c.Assert(err, check.IsNil, check.Commentf("pushing the image to the private registry has failed: %s", out)) <ide> } <ide> <ide> func (s *DockerTrustSuite) TestTrustedPush(c *check.C) { <ide> func (s *DockerTrustSuite) TestTrustedPush(c *check.C) { <ide> pushCmd := exec.Command(dockerBinary, "push", repoName) <ide> s.trustedCmd(pushCmd) <ide> out, _, err := runCommandWithOutput(pushCmd) <del> if err != nil { <del> c.Fatalf("Error running trusted push: %s\n%s", err, out) <del> } <del> if !strings.Contains(string(out), "Signing and pushing trust metadata") { <del> c.Fatalf("Missing expected output on trusted push:\n%s", out) <del> } <add> c.Assert(err, check.IsNil, check.Commentf("Error running trusted push: %s\n%s", err, out)) <add> c.Assert(out, checker.Contains, "Signing and pushing trust metadata", check.Commentf("Missing expected output on trusted push")) <ide> } <ide> <ide> func (s *DockerTrustSuite) TestTrustedPushWithEnvPasswords(c *check.C) { <ide> func (s *DockerTrustSuite) TestTrustedPushWithEnvPasswords(c *check.C) { <ide> pushCmd := exec.Command(dockerBinary, "push", repoName) <ide> s.trustedCmdWithPassphrases(pushCmd, "12345678", "12345678") <ide> out, _, err := runCommandWithOutput(pushCmd) <del> if err != nil { <del> c.Fatalf("Error running trusted push: %s\n%s", err, out) <del> } <del> if !strings.Contains(string(out), "Signing and pushing trust metadata") { <del> c.Fatalf("Missing expected output on trusted push:\n%s", out) <del> } <add> c.Assert(err, check.IsNil, check.Commentf("Error running trusted push: %s\n%s", err, out)) <add> c.Assert(out, checker.Contains, "Signing and pushing trust metadata", check.Commentf("Missing expected output on trusted push")) <ide> } <ide> <ide> // This test ensures backwards compatibility with old ENV variables. Should be <ide> func (s *DockerTrustSuite) TestTrustedPushWithDeprecatedEnvPasswords(c *check.C) <ide> pushCmd := exec.Command(dockerBinary, "push", repoName) <ide> s.trustedCmdWithDeprecatedEnvPassphrases(pushCmd, "12345678", "12345678") <ide> out, _, err := runCommandWithOutput(pushCmd) <del> if err != nil { <del> c.Fatalf("Error running trusted push: %s\n%s", err, out) <del> } <del> if !strings.Contains(string(out), "Signing and pushing trust metadata") { <del> c.Fatalf("Missing expected output on trusted push:\n%s", out) <del> } <add> c.Assert(err, check.IsNil, check.Commentf("Error running trusted push: %s\n%s", err, out)) <add> c.Assert(out, checker.Contains, "Signing and pushing trust metadata", check.Commentf("Missing expected output on trusted push")) <ide> } <ide> <ide> func (s *DockerTrustSuite) TestTrustedPushWithFaillingServer(c *check.C) { <ide> func (s *DockerTrustSuite) TestTrustedPushWithFaillingServer(c *check.C) { <ide> pushCmd := exec.Command(dockerBinary, "push", repoName) <ide> s.trustedCmdWithServer(pushCmd, "https://example.com:81/") <ide> out, _, err := runCommandWithOutput(pushCmd) <del> if err == nil { <del> c.Fatalf("Missing error while running trusted push w/ no server") <del> } <del> <del> if !strings.Contains(string(out), "error contacting notary server") { <del> c.Fatalf("Missing expected output on trusted push:\n%s", out) <del> } <add> c.Assert(err, check.NotNil, check.Commentf("Missing error while running trusted push w/ no server")) <add> c.Assert(out, checker.Contains, "error contacting notary server", check.Commentf("Missing expected output on trusted push")) <ide> } <ide> <ide> func (s *DockerTrustSuite) TestTrustedPushWithoutServerAndUntrusted(c *check.C) { <ide> func (s *DockerTrustSuite) TestTrustedPushWithoutServerAndUntrusted(c *check.C) <ide> pushCmd := exec.Command(dockerBinary, "push", "--disable-content-trust", repoName) <ide> s.trustedCmdWithServer(pushCmd, "https://example.com/") <ide> out, _, err := runCommandWithOutput(pushCmd) <del> if err != nil { <del> c.Fatalf("trusted push with no server and --disable-content-trust failed: %s\n%s", err, out) <del> } <del> <del> if strings.Contains(string(out), "Error establishing connection to notary repository") { <del> c.Fatalf("Missing expected output on trusted push with --disable-content-trust:\n%s", out) <del> } <add> c.Assert(err, check.IsNil, check.Commentf("trusted push with no server and --disable-content-trust failed: %s\n%s", err, out)) <add> c.Assert(out, check.Not(checker.Contains), "Error establishing connection to notary repository", check.Commentf("Missing expected output on trusted push with --disable-content-trust:")) <ide> } <ide> <ide> func (s *DockerTrustSuite) TestTrustedPushWithExistingTag(c *check.C) { <ide> func (s *DockerTrustSuite) TestTrustedPushWithExistingTag(c *check.C) { <ide> pushCmd := exec.Command(dockerBinary, "push", repoName) <ide> s.trustedCmd(pushCmd) <ide> out, _, err := runCommandWithOutput(pushCmd) <del> if err != nil { <del> c.Fatalf("trusted push failed: %s\n%s", err, out) <del> } <del> <del> if !strings.Contains(string(out), "Signing and pushing trust metadata") { <del> c.Fatalf("Missing expected output on trusted push with existing tag:\n%s", out) <del> } <add> c.Assert(err, check.IsNil, check.Commentf("trusted push failed: %s\n%s", err, out)) <add> c.Assert(out, checker.Contains, "Signing and pushing trust metadata", check.Commentf("Missing expected output on trusted push with existing tag")) <ide> } <ide> <ide> func (s *DockerTrustSuite) TestTrustedPushWithExistingSignedTag(c *check.C) { <ide> func (s *DockerTrustSuite) TestTrustedPushWithExistingSignedTag(c *check.C) { <ide> pushCmd := exec.Command(dockerBinary, "push", repoName) <ide> s.trustedCmd(pushCmd) <ide> out, _, err := runCommandWithOutput(pushCmd) <del> if err != nil { <del> c.Fatalf("trusted push failed: %s\n%s", err, out) <del> } <del> <del> if !strings.Contains(string(out), "Signing and pushing trust metadata") { <del> c.Fatalf("Missing expected output on trusted push with existing tag:\n%s", out) <del> } <add> c.Assert(err, check.IsNil, check.Commentf("trusted push failed: %s\n%s", err, out)) <add> c.Assert(out, checker.Contains, "Signing and pushing trust metadata", check.Commentf("Missing expected output on trusted push with existing tag")) <ide> <ide> // Do another trusted push <ide> pushCmd = exec.Command(dockerBinary, "push", repoName) <ide> s.trustedCmd(pushCmd) <ide> out, _, err = runCommandWithOutput(pushCmd) <del> if err != nil { <del> c.Fatalf("trusted push failed: %s\n%s", err, out) <del> } <del> <del> if !strings.Contains(string(out), "Signing and pushing trust metadata") { <del> c.Fatalf("Missing expected output on trusted push with existing tag:\n%s", out) <del> } <add> c.Assert(err, check.IsNil, check.Commentf("trusted push failed: %s\n%s", err, out)) <add> c.Assert(out, checker.Contains, "Signing and pushing trust metadata", check.Commentf("Missing expected output on trusted push with existing tag")) <ide> <ide> dockerCmd(c, "rmi", repoName) <ide> <ide> // Try pull to ensure the double push did not break our ability to pull <ide> pullCmd := exec.Command(dockerBinary, "pull", repoName) <ide> s.trustedCmd(pullCmd) <ide> out, _, err = runCommandWithOutput(pullCmd) <del> if err != nil { <del> c.Fatalf("Error running trusted pull: %s\n%s", err, out) <del> } <add> c.Assert(err, check.IsNil, check.Commentf("Error running trusted pull: %s\n%s", err, out)) <add> c.Assert(out, checker.Contains, "Status: Downloaded", check.Commentf("Missing expected output on trusted pull with --disable-content-trust")) <ide> <del> if !strings.Contains(string(out), "Status: Downloaded") { <del> c.Fatalf("Missing expected output on trusted pull with --disable-content-trust:\n%s", out) <del> } <ide> } <ide> <ide> func (s *DockerTrustSuite) TestTrustedPushWithIncorrectPassphraseForNonRoot(c *check.C) { <ide> func (s *DockerTrustSuite) TestTrustedPushWithIncorrectPassphraseForNonRoot(c *c <ide> pushCmd := exec.Command(dockerBinary, "push", repoName) <ide> s.trustedCmd(pushCmd) <ide> out, _, err := runCommandWithOutput(pushCmd) <del> if err != nil { <del> c.Fatalf("trusted push failed: %s\n%s", err, out) <del> } <del> <del> if !strings.Contains(string(out), "Signing and pushing trust metadata") { <del> c.Fatalf("Missing expected output on trusted push:\n%s", out) <del> } <add> c.Assert(err, check.IsNil, check.Commentf("trusted push failed: %s\n%s", err, out)) <add> c.Assert(out, checker.Contains, "Signing and pushing trust metadata", check.Commentf("Missing expected output on trusted push:\n%s", out)) <ide> <ide> // Push with wrong passphrases <ide> pushCmd = exec.Command(dockerBinary, "push", repoName) <ide> s.trustedCmdWithPassphrases(pushCmd, "12345678", "87654321") <ide> out, _, err = runCommandWithOutput(pushCmd) <del> if err == nil { <del> c.Fatalf("Error missing from trusted push with short targets passphrase: \n%s", out) <del> } <del> <del> if !strings.Contains(string(out), "password invalid, operation has failed") { <del> c.Fatalf("Missing expected output on trusted push with short targets/snapsnot passphrase:\n%s", out) <del> } <add> c.Assert(err, check.NotNil, check.Commentf("Error missing from trusted push with short targets passphrase: \n%s", out)) <add> c.Assert(out, checker.Contains, "password invalid, operation has failed", check.Commentf("Missing expected output on trusted push with short targets/snapsnot passphrase")) <ide> } <ide> <ide> // This test ensures backwards compatibility with old ENV variables. Should be <ide> func (s *DockerTrustSuite) TestTrustedPushWithIncorrectDeprecatedPassphraseForNo <ide> pushCmd := exec.Command(dockerBinary, "push", repoName) <ide> s.trustedCmd(pushCmd) <ide> out, _, err := runCommandWithOutput(pushCmd) <del> if err != nil { <del> c.Fatalf("trusted push failed: %s\n%s", err, out) <del> } <del> <del> if !strings.Contains(string(out), "Signing and pushing trust metadata") { <del> c.Fatalf("Missing expected output on trusted push:\n%s", out) <del> } <add> c.Assert(err, check.IsNil, check.Commentf("trusted push failed: %s\n%s", err, out)) <add> c.Assert(out, checker.Contains, "Signing and pushing trust metadata", check.Commentf("Missing expected output on trusted push")) <ide> <ide> // Push with wrong passphrases <ide> pushCmd = exec.Command(dockerBinary, "push", repoName) <ide> s.trustedCmdWithDeprecatedEnvPassphrases(pushCmd, "12345678", "87654321") <ide> out, _, err = runCommandWithOutput(pushCmd) <del> if err == nil { <del> c.Fatalf("Error missing from trusted push with short targets passphrase: \n%s", out) <del> } <del> <del> if !strings.Contains(string(out), "password invalid, operation has failed") { <del> c.Fatalf("Missing expected output on trusted push with short targets/snapsnot passphrase:\n%s", out) <del> } <add> c.Assert(err, check.NotNil, check.Commentf("Error missing from trusted push with short targets passphrase: \n%s", out)) <add> c.Assert(out, checker.Contains, "password invalid, operation has failed", check.Commentf("Missing expected output on trusted push with short targets/snapsnot passphrase")) <ide> } <ide> <ide> func (s *DockerTrustSuite) TestTrustedPushWithExpiredSnapshot(c *check.C) { <ide> func (s *DockerTrustSuite) TestTrustedPushWithExpiredSnapshot(c *check.C) { <ide> pushCmd := exec.Command(dockerBinary, "push", repoName) <ide> s.trustedCmd(pushCmd) <ide> out, _, err := runCommandWithOutput(pushCmd) <del> if err != nil { <del> c.Fatalf("trusted push failed: %s\n%s", err, out) <del> } <del> <del> if !strings.Contains(string(out), "Signing and pushing trust metadata") { <del> c.Fatalf("Missing expected output on trusted push:\n%s", out) <del> } <add> c.Assert(err, check.IsNil, check.Commentf("trusted push failed: %s\n%s", err, out)) <add> c.Assert(out, checker.Contains, "Signing and pushing trust metadata", check.Commentf("Missing expected output on trusted push")) <ide> <ide> // Snapshots last for three years. This should be expired <ide> fourYearsLater := time.Now().Add(time.Hour * 24 * 365 * 4) <ide> func (s *DockerTrustSuite) TestTrustedPushWithExpiredSnapshot(c *check.C) { <ide> pushCmd = exec.Command(dockerBinary, "push", repoName) <ide> s.trustedCmd(pushCmd) <ide> out, _, err = runCommandWithOutput(pushCmd) <del> if err == nil { <del> c.Fatalf("Error missing from trusted push with expired snapshot: \n%s", out) <del> } <del> <del> if !strings.Contains(string(out), "repository out-of-date") { <del> c.Fatalf("Missing expected output on trusted push with expired snapshot:\n%s", out) <del> } <add> c.Assert(err, check.NotNil, check.Commentf("Error missing from trusted push with expired snapshot: \n%s", out)) <add> c.Assert(out, checker.Contains, "repository out-of-date", check.Commentf("Missing expected output on trusted push with expired snapshot")) <ide> }) <ide> } <ide> <ide> func (s *DockerTrustSuite) TestTrustedPushWithExpiredTimestamp(c *check.C) { <ide> pushCmd := exec.Command(dockerBinary, "push", repoName) <ide> s.trustedCmd(pushCmd) <ide> out, _, err := runCommandWithOutput(pushCmd) <del> if err != nil { <del> c.Fatalf("trusted push failed: %s\n%s", err, out) <del> } <del> <del> if !strings.Contains(string(out), "Signing and pushing trust metadata") { <del> c.Fatalf("Missing expected output on trusted push:\n%s", out) <del> } <add> c.Assert(err, check.IsNil, check.Commentf("trusted push failed: %s\n%s", err, out)) <add> c.Assert(out, checker.Contains, "Signing and pushing trust metadata", check.Commentf("Missing expected output on trusted push")) <ide> <ide> // The timestamps expire in two weeks. Lets check three <ide> threeWeeksLater := time.Now().Add(time.Hour * 24 * 21) <ide> func (s *DockerTrustSuite) TestTrustedPushWithExpiredTimestamp(c *check.C) { <ide> pushCmd := exec.Command(dockerBinary, "push", repoName) <ide> s.trustedCmd(pushCmd) <ide> out, _, err := runCommandWithOutput(pushCmd) <del> if err != nil { <del> c.Fatalf("Error running trusted push: %s\n%s", err, out) <del> } <del> if !strings.Contains(string(out), "Signing and pushing trust metadata") { <del> c.Fatalf("Missing expected output on trusted push with expired timestamp:\n%s", out) <del> } <add> c.Assert(err, check.IsNil, check.Commentf("Error running trusted push: %s\n%s", err, out)) <add> c.Assert(out, checker.Contains, "Signing and pushing trust metadata", check.Commentf("Missing expected output on trusted push with expired timestamp")) <ide> }) <ide> }
5
PHP
PHP
use phpunit appropriate methods in getmockformodel
fb52be5d51fa6060b069525c5e9220d0dcb0ac75
<ide><path>src/TestSuite/TestCase.php <ide> public function getMockForModel(string $alias, array $methods = [], array $optio <ide> [, $baseClass] = pluginSplit($alias); <ide> $options += ['alias' => $baseClass, 'connection' => $connection]; <ide> $options += $locator->getConfig($alias); <add> $existingMethods = array_intersect(get_class_methods($className), $methods); <add> $nonExistingMethods = array_diff($methods, $existingMethods); <add> <add> $builder = $this->getMockBuilder($className) <add> ->onlyMethods($existingMethods) <add> ->setConstructorArgs([$options]); <add> <add> if ($nonExistingMethods) { <add> $builder->addMethods($nonExistingMethods); <add> } <ide> <ide> /** @var \Cake\ORM\Table $mock */ <del> $mock = $this->getMockBuilder($className) <del> ->onlyMethods($methods) <del> ->setConstructorArgs([$options]) <del> ->getMock(); <add> $mock = $builder->getMock(); <ide> <ide> if (empty($options['entityClass']) && $mock->getEntityClass() === Entity::class) { <ide> $parts = explode('\\', $className); <ide><path>tests/TestCase/TestSuite/TestCaseTest.php <ide> public function testGetMockForModel() <ide> <ide> $Tags = $this->getMockForModel('Tags', ['save']); <ide> $this->assertSame('TestApp\Model\Entity\Tag', $Tags->getEntityClass()); <add> <add> $SluggedPosts = $this->getMockForModel('SluggedPosts', ['save', 'slugify']); <add> $SluggedPosts->expects($this->at(0)) <add> ->method('slugify') <add> ->with('some value') <add> ->will($this->returnValue('mocked')); <add> $this->assertSame('mocked', $SluggedPosts->slugify('some value')); <ide> } <ide> <ide> /** <ide><path>tests/test_app/TestApp/Model/Table/SluggedPostsTable.php <add><?php <add>declare(strict_types=1); <add> <add>/** <add> * Test App SluggedPosts Model <add> * <add> * CakePHP : Rapid Development Framework (https://cakephp.org) <add> * Copyright 2005-2020, Cake Software Foundation, Inc. <add> * <add> * Licensed under The MIT License <add> * Redistributions of files must retain the above copyright notice. <add> * <add> * @copyright Copyright 2005-2020, Cake Software Foundation, Inc. <add> * @link https://cakephp.org CakePHP Project <add> * @since 4.1.0 <add> * @license https://opensource.org/licenses/mit-license.php MIT License <add> */ <add>namespace TestApp\Model\Table; <add> <add>use Cake\ORM\Table; <add> <add>class SluggedPostsTable extends Table <add>{ <add> public function initialize(array $config): void <add> { <add> $this->setTable('posts'); <add> $this->addBehavior('Sluggable'); <add> } <add>}
3
Python
Python
add more info about max pid in docstring
e1b2f7cbd3b1dd1a2fb031b41cf01fc5cdc82a88
<ide><path>glances/processes.py <ide> def disable_extended(self): <ide> <ide> @property <ide> def pid_max(self): <del> """Get the maximum number of PID <del> On a Linux operating system, the value is read from <del> the /proc/sys/kernel/pid_max file. <add> """ <add> Get the maximum PID value. <add> <add> On Linux, the value is read from the `/proc/sys/kernel/pid_max` file. <add> <add> From `man 5 proc`: <add> The default value for this file, 32768, results in the same range of <add> PIDs as on earlier kernels. On 32-bit platfroms, 32768 is the maximum <add> value for pid_max. On 64-bit systems, pid_max can be set to any value <add> up to 2^22 (PID_MAX_LIMIT, approximately 4 million). <add> <add> If the file is unreadable or not available for whatever reason, <add> returns None. <ide> <del> If the file is unreadable or not available (on others OS), <del> return None. <add> Some other OSes: <add> - On FreeBSD and macOS the maximum is 99999. <add> - On OpenBSD >= 6.0 the maximum is 99999 (was 32766). <add> - On NetBSD the maximum is 30000. <ide> <ide> :returns: int or None <ide> """ <ide> if LINUX: <del> # For the moment, only available on LINUX <del> # Waiting from https://github.com/giampaolo/psutil/issues/720 <add> # XXX: waiting for https://github.com/giampaolo/psutil/issues/720 <ide> try: <ide> with open('/proc/sys/kernel/pid_max', 'rb') as f: <ide> return int(f.read())
1
Mixed
Javascript
use secure links
3bcf17dca032d8c9cae9b35bd4dcd1c9464defa7
<ide><path>CONTRIBUTING.md <ide> that include your webpack.config.js and relevant files are more likely to receiv <ide> If you have created your own loader/plugin please include it on the relevant <ide> documentation pages: <ide> <del>[List of loaders](http://webpack.github.io/docs/list-of-loaders.html) <del>[List of plugins](http://webpack.github.io/docs/list-of-plugins.html) <add>[List of loaders](https://webpack.github.io/docs/list-of-loaders.html) <add>[List of plugins](https://webpack.github.io/docs/list-of-plugins.html) <ide> <ide> ### Documentation <ide> <ide> webpack is insanely feature rich and documentation is a huge time sink. We <ide> greatly appreciate any time spent fixing typos or clarifying sections in the <del>documentation. <add>documentation. <ide> <ide> <ide> ## Submitting Changes <ide><path>README.md <del>[![webpack](http://webpack.github.io/assets/logo.png)](http://webpack.github.io) <add>[![webpack](https://webpack.github.io/assets/logo.png)](https://webpack.github.io) <ide> <del> <del>[![NPM version][npm-image]][npm-url] [![Gitter chat][gitter-image]][gitter-url] [![Downloads][downloads-image]][downloads-url] <add> <add>[![NPM version][npm-image]][npm-url] [![Gitter chat][gitter-image]][gitter-url] [![Downloads][downloads-image]][downloads-url] <ide> [![NPM][nodei-image]][nodei-url] <ide> <del>build <del>[![Build Status][travis-image]][travis-url] [![Appveyor Status][appveyor-image]][appveyor-url] [![Coverage Status][coveralls-image]][coveralls-url] <add>build <add>[![Build Status][travis-image]][travis-url] [![Appveyor Status][appveyor-image]][appveyor-url] [![Coverage Status][coveralls-image]][coveralls-url] <ide> <del>dependencies <add>dependencies <ide> [![Dependency Status][david-image]][david-url] [![devDependency Status][david-dev-image]][david-dev-url] [![peerDependency Status][david-peer-image]][david-peer-url] <ide> <del>donation <add>donation <ide> [![Gittip donate button][gittip-image]][gittip-url] [![Donate to sokra][donate-image]][donate-url] <ide> <ide> <del> <del> <del> <del> <del>[documentation](http://webpack.github.io/docs/?utm_source=github&utm_medium=readme&utm_campaign=top) <add>[documentation](https://webpack.github.io/docs/?utm_source=github&utm_medium=readme&utm_campaign=top) <ide> <ide> # Introduction <ide> <ide> or packaging just about any resource or asset. <ide> <ide> # Getting Started <ide> <del>Check out webpack's [documentation](http://webpack.github.io/docs/?utm_source=github&utm_medium=readme&utm_campaign=trdr) for quick Getting Started guide, in-depth usage, <add>Check out webpack's [documentation](https://webpack.github.io/docs/?utm_source=github&utm_medium=readme&utm_campaign=trdr) for quick Getting Started guide, in-depth usage, <ide> tutorials and resources. <ide> <ide> # Installation <ide> project: <ide> global: <ide> `npm install webpack -g` <ide> Usage <del>http://webpack.github.io/docs/tutorials/getting-started/ <add>https://webpack.github.io/docs/tutorials/getting-started/ <ide> <ide> # Examples <ide> <ide> Take a look at the [`examples`](https://github.com/webpack/webpack/tree/master/e <ide> ## Plugins <ide> <ide> webpack has a [rich plugin <del>interface](http://webpack.github.io/docs/plugins.html). Most of the features <add>interface](https://webpack.github.io/docs/plugins.html). Most of the features <ide> within webpack itself use this plugin interface. This makes webpack very <ide> **flexible**. <ide> <ide> and incredibly **fast** on incremental compilations. <ide> <ide> webpack enables use of loaders to preprocess files. This allows you to bundle <ide> **any static resource** way beyond JavaScript. You can easily [write your own <del>loaders](http://webpack.github.io/docs/loaders.html) using node.js. <add>loaders](https://webpack.github.io/docs/loaders.html) using node.js. <ide> <ide> Loaders are activated by using `loadername!` prefixes in `require()` statements, <ide> or are automatically applied via regex from your webpack configuration. <ide> <del>Please see [Using Loaders](http://webpack.github.io/docs/using-loaders.html) for more information. <add>Please see [Using Loaders](https://webpack.github.io/docs/using-loaders.html) for more information. <ide> <ide> **basic** <ide> * [`json`](https://github.com/webpack/json-loader): Loads file as JSON <ide> Please see [Using Loaders](http://webpack.github.io/docs/using-loaders.html) for <ide> * [`coffee`](https://github.com/webpack/coffee-loader): Loads coffee-script like JavaScript <ide> * [`babel`](https://github.com/babel/babel-loader): Turn ES6 code into vanilla ES5 using [Babel](https://github.com/babel/babel). <ide> * [`livescript`](https://github.com/appedemic/livescript-loader): Loads LiveScript like JavaScript <del>* [`sweetjs`](https://github.com/jlongster/sweetjs-loader): Use sweetjs macros. <add>* [`sweetjs`](https://github.com/jlongster/sweetjs-loader): Use sweetjs macros. <ide> * [`traceur`](https://github.com/jupl/traceur-loader): Use future JavaScript features with [Traceur](https://github.com/google/traceur-compiler). <ide> * [`typescript`](https://github.com/andreypopp/typescript-loader): Loads TypeScript like JavaScript. <ide> <ide> Please see [Using Loaders](http://webpack.github.io/docs/using-loaders.html) for <ide> * [`injectable`](https://github.com/jauco/webpack-injectable): Allow to inject dependencies into modules <ide> * [`transform`](https://github.com/webpack/transform-loader): Use browserify transforms as loader. <ide> <del>For the full list of loaders, see [list of loaders](http://webpack.github.io/docs/list-of-loaders.html). <add>For the full list of loaders, see [list of loaders](https://webpack.github.io/docs/list-of-loaders.html). <ide> <ide> ## Module Format (AMD/CommonJS) <ide> <ide> simple expressions. This allows you to **support most existing libraries** out o <ide> webpack allows you to split your codebase into multiple chunks. Chunks are <ide> loaded asynchronously at runtime. This reduces the initial loading time. <ide> <del>[Code Splitting documentation](http://webpack.github.io/docs/code-splitting.html) <add>[Code Splitting documentation](https://webpack.github.io/docs/code-splitting.html) <ide> <ide> ## Optimizations <ide> <ide> webpack can do many optimizations to **reduce the output size of your <ide> JavaScript** by deduplicating frequently used modules, minifying, and giving <ide> you full control of what is loaded initially and what is loaded at runtime <ide> through code splitting. It can also can make your code chunks **cache <del>friendly** by using hashes. <add>friendly** by using hashes. <ide> <del>[Optimization documentation](http://webpack.github.io/docs/optimization.html) <add>[Optimization documentation](https://webpack.github.io/docs/optimization.html) <ide> <ide> webpack optimizes in several ways. It also makes your chunks **cache-friendly** by using hashes. <ide> <ide> webpack optimizes in several ways. It also makes your chunks **cache-friendly** <ide> // webpack is a module bundler. <ide> // This means webpack takes modules with dependencies <ide> // and emits static assets representing those modules. <del> <add> <ide> // Dependencies can be written in CommonJs <ide> var commonjs = require("./commonjs"); <ide> // or in AMD <ide> define(["amd-module", "../file"], function (amdModule, file) { <ide> // of the AMD require. <ide> }); <ide> }); <del> <del> <add> <add> <ide> require("coffee!./cup.coffee"); <ide> // "Loaders" are used to preprocess files. <ide> // They can be prefixed in the require call <ide> function loadTemplate (name) { <ide> <ide> // ...and you can combine everything. <ide> function loadTemplateAsync (name, callback) { <del> require(["bundle?lazy!./templates/" + name + ".jade"], <add> require(["bundle?lazy!./templates/" + name + ".jade"], <ide> function (templateBundle) { <ide> templateBundle(callback); <ide> }); <ide> function loadTemplateAsync (name, callback) { <ide> <ide> ## Documentation <ide> <del>[documentation](http://webpack.github.io/docs/?utm_source=github&utm_medium=readme&utm_campaign=documentation) <add>[documentation](https://webpack.github.io/docs/?utm_source=github&utm_medium=readme&utm_campaign=documentation) <ide> <ide> <ide> ## Changelog <ide> <del>[changelog](http://webpack.github.io/docs/changelog.html) <add>[changelog](https://webpack.github.io/docs/changelog.html) <ide> <ide> <ide> ## Tests <ide><path>bin/webpack.js <ide> try { <ide> } catch(e) {} <ide> var optimist = require("optimist") <ide> .usage("webpack " + require("../package.json").version + "\n" + <del> "Usage: http://webpack.github.io/docs/cli.html"); <add> "Usage: https://webpack.github.io/docs/cli.html"); <ide> <ide> require("./config-optimist")(optimist); <ide> <ide><path>lib/MovedToPluginWarningPlugin.js <ide> MovedToPluginWarningPlugin.prototype.apply = function(compiler) { <ide> var optionName = this.optionName; <ide> var pluginName = this.pluginName; <ide> compiler.plugin("compilation", function(compilation) { <del> compilation.warnings.push(new Error("webpack options:\nDEPRECATED option '" + optionName + "' will be moved to the " + pluginName + ". Use this instead.\nFor more info about the usage of the " + pluginName + " see http://webpack.github.io/docs/list-of-plugins.html")); <add> compilation.warnings.push(new Error("webpack options:\nDEPRECATED option '" + optionName + "' will be moved to the " + pluginName + ". Use this instead.\nFor more info about the usage of the " + pluginName + " see https://webpack.github.io/docs/list-of-plugins.html")); <ide> }); <ide> }; <ide><path>lib/optimize/AggressiveMergingPlugin.js <ide> */ <ide> function AggressiveMergingPlugin(options) { <ide> if(options !== undefined && typeof options !== "object" || Array.isArray(options)) { <del> throw new Error("Argument should be an options object. To use defaults, pass in nothing.\nFor more info on options, see http://webpack.github.io/docs/list-of-plugins.html"); <add> throw new Error("Argument should be an options object. To use defaults, pass in nothing.\nFor more info on options, see https://webpack.github.io/docs/list-of-plugins.html"); <ide> } <ide> this.options = options || {}; <ide> } <ide><path>lib/optimize/LimitChunkCountPlugin.js <ide> */ <ide> function LimitChunkCountPlugin(options) { <ide> if(options !== undefined && typeof options !== "object" || Array.isArray(options)) { <del> throw new Error("Argument should be an options object.\nFor more info on options, see http://webpack.github.io/docs/list-of-plugins.html"); <add> throw new Error("Argument should be an options object.\nFor more info on options, see https://webpack.github.io/docs/list-of-plugins.html"); <ide> } <ide> this.options = options || {}; <ide> } <ide><path>lib/optimize/MinChunkSizePlugin.js <ide> */ <ide> function MinChunkSizePlugin(options) { <ide> if(typeof options !== "object" || Array.isArray(options)) { <del> throw new Error("Argument should be an options object.\nFor more info on options, see http://webpack.github.io/docs/list-of-plugins.html"); <add> throw new Error("Argument should be an options object.\nFor more info on options, see https://webpack.github.io/docs/list-of-plugins.html"); <ide> } <ide> this.options = options; <ide> } <ide><path>lib/optimize/OccurrenceOrderPlugin.js <ide> */ <ide> function OccurrenceOrderPlugin(preferEntry) { <ide> if(preferEntry !== undefined && typeof preferEntry !== "boolean") { <del> throw new Error("Argument should be a boolean.\nFor more info on this plugin, see http://webpack.github.io/docs/list-of-plugins.html"); <add> throw new Error("Argument should be a boolean.\nFor more info on this plugin, see https://webpack.github.io/docs/list-of-plugins.html"); <ide> } <ide> this.preferEntry = preferEntry; <ide> }
8
Javascript
Javascript
add note about mistaken named / default export
5bfb87874391e635cb2458a29a7c878cb4dec89c
<ide><path>packages/react-dom/src/__tests__/ReactComponent-test.js <ide> describe('ReactComponent', () => { <ide> 'Element type is invalid: expected a string (for built-in components) ' + <ide> 'or a class/function (for composite components) but got: undefined. ' + <ide> "You likely forgot to export your component from the file it's " + <del> 'defined in.', <add> 'defined in, or you might have mixed up default and named imports.', <ide> ); <ide> <ide> var Y = null; <ide> describe('ReactComponent', () => { <ide> 'Element type is invalid: expected a string (for built-in components) ' + <ide> 'or a class/function (for composite components) but got: undefined. ' + <ide> "You likely forgot to export your component from the file it's " + <del> 'defined in.\n\nCheck the render method of `Bar`.', <add> 'defined in, or you might have mixed up default and named imports.' + <add> '\n\nCheck the render method of `Bar`.', <ide> ); <ide> <ide> // One warning for each element creation <ide><path>packages/react-reconciler/src/ReactFiber.js <ide> export function createFiberFromElement( <ide> ) { <ide> info += <ide> ' You likely forgot to export your component from the file ' + <del> "it's defined in."; <add> "it's defined in, or you might have mixed up default and named imports."; <ide> } <ide> const ownerName = owner ? getComponentName(owner) : null; <ide> if (ownerName) { <ide><path>packages/react-reconciler/src/__tests__/ReactIncrementalErrorHandling-test.js <ide> describe('ReactIncrementalErrorHandling', () => { <ide> 'Element type is invalid: expected a string (for built-in components) or ' + <ide> 'a class/function (for composite components) but got: undefined. ' + <ide> "You likely forgot to export your component from the file it's " + <del> 'defined in.\n\nCheck the render method of `BrokenRender`.', <add> 'defined in, or you might have mixed up default and named imports.' + <add> '\n\nCheck the render method of `BrokenRender`.', <ide> ), <ide> ]); <ide> expect(console.error.calls.count()).toBe(1); <ide> describe('ReactIncrementalErrorHandling', () => { <ide> 'Element type is invalid: expected a string (for built-in components) or ' + <ide> 'a class/function (for composite components) but got: undefined. ' + <ide> "You likely forgot to export your component from the file it's " + <del> 'defined in.\n\nCheck the render method of `BrokenRender`.', <add> 'defined in, or you might have mixed up default and named imports.' + <add> '\n\nCheck the render method of `BrokenRender`.', <ide> ), <ide> ]); <ide> expect(console.error.calls.count()).toBe(1); <ide> describe('ReactIncrementalErrorHandling', () => { <ide> 'Element type is invalid: expected a string (for built-in components) or ' + <ide> 'a class/function (for composite components) but got: undefined. ' + <ide> "You likely forgot to export your component from the file it's " + <del> 'defined in.', <add> 'defined in, or you might have mixed up default and named imports.', <ide> ); <ide> <ide> ReactNoop.render(<span prop="hi" />); <ide><path>packages/react/src/ReactElementValidator.js <ide> export function createElementWithValidation(type, props, children) { <ide> ) { <ide> info += <ide> ' You likely forgot to export your component from the file ' + <del> "it's defined in."; <add> "it's defined in, or you might have mixed up default and named imports."; <ide> } <ide> <ide> var sourceInfo = getSourceInfoErrorAddendum(props); <ide><path>packages/react/src/__tests__/ReactElementValidator-test.js <ide> describe('ReactElementValidator', () => { <ide> 'Warning: React.createElement: type is invalid -- expected a string ' + <ide> '(for built-in components) or a class/function (for composite ' + <ide> 'components) but got: undefined. You likely forgot to export your ' + <del> "component from the file it's defined in.", <add> "component from the file it's defined in, or you might have mixed up " + <add> 'default and named imports.', <ide> ); <ide> expectDev(console.error.calls.argsFor(1)[0]).toBe( <ide> 'Warning: React.createElement: type is invalid -- expected a string ' + <ide> describe('ReactElementValidator', () => { <ide> 'Warning: React.createElement: type is invalid -- expected a string ' + <ide> '(for built-in components) or a class/function (for composite ' + <ide> 'components) but got: object. You likely forgot to export your ' + <del> "component from the file it's defined in.", <add> "component from the file it's defined in, or you might have mixed up " + <add> 'default and named imports.', <ide> ); <ide> React.createElement('div'); <ide> expectDev(console.error.calls.count()).toBe(5); <ide> describe('ReactElementValidator', () => { <ide> 'Warning: React.createElement: type is invalid -- expected a string ' + <ide> '(for built-in components) or a class/function (for composite ' + <ide> 'components) but got: undefined. You likely forgot to export your ' + <del> "component from the file it's defined in.\n\nCheck your code at **.", <add> "component from the file it's defined in, or you might have mixed up " + <add> 'default and named imports.\n\nCheck your code at **.', <ide> ); <ide> }); <ide> }); <ide><path>packages/react/src/__tests__/ReactJSXElementValidator-test.js <ide> describe('ReactJSXElementValidator', () => { <ide> 'Warning: React.createElement: type is invalid -- expected a string ' + <ide> '(for built-in components) or a class/function (for composite ' + <ide> 'components) but got: undefined. You likely forgot to export your ' + <del> "component from the file it's defined in." + <add> "component from the file it's defined in, or you might have mixed up " + <add> 'default and named imports.' + <ide> '\n\nCheck your code at **.', <ide> ); <ide> expectDev(normalizeCodeLocInfo(console.error.calls.argsFor(1)[0])).toBe(
6
Python
Python
fix bug #738 and add corresponding tests
5fc5deb1d60e83c9d15fb2f8d623dbef52751e3b
<ide><path>numpy/lib/_datasource.py <ide> def abspath(self, path): <ide> if len(splitpath) > 1: <ide> path = splitpath[1] <ide> scheme, netloc, upath, uparams, uquery, ufrag = urlparse(path) <del> return os.path.join(self._destpath, netloc, upath.strip(os.sep)) <add> netloc = self._sanitize_relative_path(netloc) <add> upath = self._sanitize_relative_path(upath) <add> return os.path.join(self._destpath, netloc, upath) <add> <add> def _sanitize_relative_path(self, path): <add> """Return a sanitised relative path for which <add> os.path.abspath(os.path.join(base, path)).startswith(base) <add> """ <add> last = None <add> path = os.path.normpath(path) <add> while path != last: <add> last = path <add> # Note: os.path.join treats '/' as os.sep <add> path = path.lstrip(os.sep).lstrip('/') <add> path = path.lstrip(os.pardir).lstrip('..') <add> return path <ide> <ide> def exists(self, path): <ide> """Test if ``path`` exists. <ide><path>numpy/lib/tests/test__datasource.py <ide> def urlopen_stub(url, data=None): <ide> http_fakepath = 'http://fake.abc.web/site/' <ide> http_fakefile = 'fake.txt' <ide> <add>malicious_files = ['/etc/shadow', '../../shadow', <add> '..\\system.dat', 'c:\\windows\\system.dat'] <add> <ide> magic_line = 'three is the magic number' <ide> <ide> <ide> def tearDown(self): <ide> <ide> def test_ValidHTTP(self): <ide> scheme, netloc, upath, pms, qry, frg = urlparse(valid_httpurl()) <del> local_path = os.path.join(self.tmpdir, netloc, upath.strip(os.sep)) <add> local_path = os.path.join(self.tmpdir, netloc, <add> upath.strip(os.sep).strip('/')) <ide> self.assertEqual(local_path, self.ds.abspath(valid_httpurl())) <ide> <ide> def test_ValidFile(self): <ide> def test_ValidFile(self): <ide> <ide> def test_InvalidHTTP(self): <ide> scheme, netloc, upath, pms, qry, frg = urlparse(invalid_httpurl()) <del> invalidhttp = os.path.join(self.tmpdir, netloc, upath.strip(os.sep)) <add> invalidhttp = os.path.join(self.tmpdir, netloc, <add> upath.strip(os.sep).strip('/')) <ide> self.assertNotEqual(invalidhttp, self.ds.abspath(valid_httpurl())) <ide> <ide> def test_InvalidFile(self): <ide> def test_InvalidFile(self): <ide> # Test filename with complete path <ide> self.assertNotEqual(invalidfile, self.ds.abspath(tmpfile)) <ide> <add> def test_sandboxing(self): <add> tmpfile = valid_textfile(self.tmpdir) <add> tmpfilename = os.path.split(tmpfile)[-1] <add> <add> tmp_path = lambda x: os.path.abspath(self.ds.abspath(x)) <add> <add> assert tmp_path(valid_httpurl()).startswith(self.tmpdir) <add> assert tmp_path(invalid_httpurl()).startswith(self.tmpdir) <add> assert tmp_path(tmpfile).startswith(self.tmpdir) <add> assert tmp_path(tmpfilename).startswith(self.tmpdir) <add> for fn in malicious_files: <add> assert tmp_path(http_path+fn).startswith(self.tmpdir) <add> assert tmp_path(fn).startswith(self.tmpdir) <add> <add> def test_windows_os_sep(self): <add> orig_os_sep = os.sep <add> try: <add> os.sep = '\\' <add> self.test_ValidHTTP() <add> self.test_ValidFile() <add> self.test_InvalidHTTP() <add> self.test_InvalidFile() <add> self.test_sandboxing() <add> finally: <add> os.sep = orig_os_sep <add> <ide> <del>class TestRespositoryAbspath(NumpyTestCase): <add>class TestRepositoryAbspath(NumpyTestCase): <ide> def setUp(self): <ide> self.tmpdir = mkdtemp() <ide> self.repos = datasource.Repository(valid_baseurl(), self.tmpdir) <ide> def tearDown(self): <ide> def test_ValidHTTP(self): <ide> scheme, netloc, upath, pms, qry, frg = urlparse(valid_httpurl()) <ide> local_path = os.path.join(self.repos._destpath, netloc, \ <del> upath.strip(os.sep)) <add> upath.strip(os.sep).strip('/')) <ide> filepath = self.repos.abspath(valid_httpfile()) <ide> self.assertEqual(local_path, filepath) <ide> <add> def test_sandboxing(self): <add> tmp_path = lambda x: os.path.abspath(self.repos.abspath(x)) <add> assert tmp_path(valid_httpfile()).startswith(self.tmpdir) <add> for fn in malicious_files: <add> assert tmp_path(http_path+fn).startswith(self.tmpdir) <add> assert tmp_path(fn).startswith(self.tmpdir) <add> <add> def test_windows_os_sep(self): <add> orig_os_sep = os.sep <add> try: <add> os.sep = '\\' <add> self.test_ValidHTTP() <add> self.test_sandboxing() <add> finally: <add> os.sep = orig_os_sep <add> <ide> <ide> class TestRepositoryExists(NumpyTestCase): <ide> def setUp(self):
2
Go
Go
fix container cleanup on daemon restart
c0d56ab71701ba47ca6066c7952e724f4f5977c0
<ide><path>integration/container/daemon_linux_test.go <add>package container <add> <add>import ( <add> "context" <add> "fmt" <add> "io/ioutil" <add> "strconv" <add> "strings" <add> "testing" <add> <add> "github.com/docker/docker/api/types" <add> "github.com/docker/docker/api/types/container" <add> "github.com/docker/docker/integration-cli/daemon" <add> "github.com/stretchr/testify/assert" <add> "golang.org/x/sys/unix" <add>) <add> <add>// This is a regression test for #36145 <add>// It ensures that a container can be started when the daemon was improperly <add>// shutdown when the daemon is brought back up. <add>// <add>// The regression is due to improper error handling preventing a container from <add>// being restored and as such have the resources cleaned up. <add>// <add>// To test this, we need to kill dockerd, then kill both the containerd-shim and <add>// the container process, then start dockerd back up and attempt to start the <add>// container again. <add>func TestContainerStartOnDaemonRestart(t *testing.T) { <add> t.Parallel() <add> <add> d := daemon.New(t, "", "dockerd", daemon.Config{}) <add> d.StartWithBusybox(t, "--iptables=false") <add> defer d.Stop(t) <add> <add> client, err := d.NewClient() <add> assert.NoError(t, err, "error creating client") <add> <add> ctx := context.Background() <add> c, err := client.ContainerCreate(ctx, <add> &container.Config{ <add> Image: "busybox", <add> Cmd: []string{"top"}, <add> }, <add> nil, <add> nil, <add> "", <add> ) <add> assert.NoError(t, err, "error creating test container") <add> defer client.ContainerRemove(ctx, c.ID, types.ContainerRemoveOptions{Force: true}) <add> <add> err = client.ContainerStart(ctx, c.ID, types.ContainerStartOptions{}) <add> assert.NoError(t, err, "error starting test container") <add> <add> inspect, err := client.ContainerInspect(ctx, c.ID) <add> assert.NoError(t, err, "error getting inspect data") <add> <add> ppid := getContainerdShimPid(t, inspect) <add> <add> err = d.Kill() <add> assert.NoError(t, err, "failed to kill test daemon") <add> <add> err = unix.Kill(inspect.State.Pid, unix.SIGKILL) <add> assert.NoError(t, err, "failed to kill container process") <add> <add> err = unix.Kill(ppid, unix.SIGKILL) <add> assert.NoError(t, err, "failed to kill containerd-shim") <add> <add> d.Start(t, "--iptables=false") <add> <add> err = client.ContainerStart(ctx, c.ID, types.ContainerStartOptions{}) <add> assert.NoError(t, err, "failed to start test container") <add>} <add> <add>func getContainerdShimPid(t *testing.T, c types.ContainerJSON) int { <add> statB, err := ioutil.ReadFile(fmt.Sprintf("/proc/%d/stat", c.State.Pid)) <add> assert.NoError(t, err, "error looking up containerd-shim pid") <add> <add> // ppid is the 4th entry in `/proc/pid/stat` <add> ppid, err := strconv.Atoi(strings.Fields(string(statB))[3]) <add> assert.NoError(t, err, "error converting ppid field to int") <add> <add> assert.NotEqual(t, ppid, 1, "got unexpected ppid") <add> return ppid <add>} <ide><path>libcontainerd/client_daemon.go <ide> func (c *client) Restore(ctx context.Context, id string, attachStdio StdioCallba <ide> return attachStdio(dio) <ide> } <ide> t, err := ctr.Task(ctx, attachIO) <del> if err != nil && !errdefs.IsNotFound(errors.Cause(err)) { <add> if err != nil && !containerderrors.IsNotFound(err) { <ide> return false, -1, err <ide> } <ide>
2
Javascript
Javascript
update correct path to use when exporting 404 page
1496ad62993de66ea3fdd39cd4bfd099f0ce902a
<ide><path>packages/next/export/index.js <ide> export default async function (dir, options, configuration) { <ide> } <ide> <ide> if (page === '/_error') { <del> defaultPathMap['/404'] = { page } <add> defaultPathMap['/404.html'] = { page } <ide> continue <ide> } <ide> <ide><path>test/integration/export/test/ssr.js <ide> export default function (context) { <ide> const html = await renderViaHTTP(context.port, '/404') <ide> expect(html).toMatch(/404/) <ide> }) <add> <add> it('should export 404.html instead of 404/index.html', async () => { <add> const html = await renderViaHTTP(context.port, '/404.html') <add> expect(html).toMatch(/404/) <add> }) <ide> }) <ide> }
2
Ruby
Ruby
move os checks to extend/os
01b93117cddd2b90277bf1b8030675868328940b
<ide><path>Library/Homebrew/dependency_collector.rb <ide> require "requirements" <ide> require "set" <ide> <del>if OS.mac? <del> require "extend/os/mac/dependency_collector" <del>elsif OS.linux? <del> require "extend/os/linux/dependency_collector" <del>end <del> <ide> ## A dependency is a formula that another formula needs to install. <ide> ## A requirement is something other than a formula that another formula <ide> ## needs to be present. This includes external language modules, <ide> def parse_url_spec(url, tags) <ide> end <ide> end <ide> end <add> <add>require "extend/os/dependency_collector" <ide><path>Library/Homebrew/extend/os/dependency_collector.rb <add>if OS.mac? <add> require "extend/os/mac/dependency_collector" <add>elsif OS.linux? <add> require "extend/os/linux/dependency_collector" <add>end
2
Go
Go
fix testparallel "bad file descriptor"
f39b83e232e398d1c89b0484752e46168e486a5d
<ide><path>libnetwork/libnetwork_linux_test.go <ide> func runParallelTests(t *testing.T, thrNumber int) { <ide> <-thrdone <ide> } <ide> <del> testns.Close() <add> if testns != origins { <add> testns.Close() <add> } <ide> if err := net2.Delete(); err != nil { <ide> t.Fatal(err) <ide> }
1
Ruby
Ruby
ignore `info.plist` for nested apps
cb2facfec13f38ccd0926a35af4678b0ca6eb777
<ide><path>Library/Homebrew/unversioned_cask_checker.rb <ide> def guess_cask_version <ide> end <ide> <ide> info_plist_paths = apps.flat_map do |app| <del> Pathname.glob(dir/"**"/app.source.basename/"Contents"/"Info.plist") <add> Pathname.glob(dir/"**"/app.source.basename/"Contents"/"Info.plist").reject do |info_plist_path| <add> # Ignore nested apps. <add> info_plist_path.parent.parent.parent.ascend.any? { |p| p.extname == ".app" } <add> end.sort <ide> end <ide> <ide> info_plist_paths.each do |info_plist_path| <ide> def guess_cask_version <ide> end <ide> <ide> pkg_paths = pkgs.flat_map do |pkg| <del> Pathname.glob(dir/"**"/pkg.path.basename) <add> Pathname.glob(dir/"**"/pkg.path.basename).sort <ide> end <ide> <ide> pkg_paths.each do |pkg_path|
1
Ruby
Ruby
use an empty hash for magical speed
547881594b32a447178c3e90c88e1b6437ee51e0
<ide><path>actionview/lib/action_view/helpers/form_helper.rb <ide> def apply_form_for_options!(record, object, options) #:nodoc: <ide> method: method <ide> ) <ide> <del> options[:url] ||= polymorphic_path(record, format: options.delete(:format)) <add> options[:url] ||= if options.key?(:format) <add> polymorphic_path(record, format: options.delete(:format)) <add> else <add> polymorphic_path(record, {}) <add> end <ide> end <ide> private :apply_form_for_options! <ide>
1
Ruby
Ruby
replace use of missingsourcefile with loaderror
370bfda55ff11e289a8ff2464f4a6284e1f0977a
<ide><path>actionpack/lib/abstract_controller/helpers.rb <ide> def default_helper_module! <ide> module_name = name.sub(/Controller$/, '') <ide> module_path = module_name.underscore <ide> helper module_path <del> rescue MissingSourceFile => e <add> rescue LoadError => e <ide> raise e unless e.is_missing? "helpers/#{module_path}_helper" <ide> rescue NameError => e <ide> raise e unless e.missing_name? "#{module_name}Helper" <ide><path>activesupport/test/core_ext/load_error_test.rb <ide> require 'abstract_unit' <ide> require 'active_support/core_ext/load_error' <ide> <del>class TestMissingSourceFile < ActiveSupport::TestCase <del> def test_with_require <del> assert_raise(MissingSourceFile) { require 'no_this_file_don\'t_exist' } <del> end <del> def test_with_load <del> assert_raise(MissingSourceFile) { load 'nor_does_this_one' } <del> end <del> def test_path <del> begin load 'nor/this/one.rb' <del> rescue MissingSourceFile => e <del> assert_equal 'nor/this/one.rb', e.path <del> end <del> end <del>end <del> <ide> class TestLoadError < ActiveSupport::TestCase <ide> def test_with_require <ide> assert_raise(LoadError) { require 'no_this_file_don\'t_exist' } <ide> def test_path <ide> assert_equal 'nor/this/one.rb', e.path <ide> end <ide> end <del>end <ide>\ No newline at end of file <add>end <ide><path>activesupport/test/dependencies_test.rb <ide> def test_tracking_identical_loaded_files <ide> end <ide> <ide> def test_missing_dependency_raises_missing_source_file <del> assert_raise(MissingSourceFile) { require_dependency("missing_service") } <add> assert_raise(LoadError) { require_dependency("missing_service") } <ide> end <ide> <ide> def test_dependency_which_raises_exception_isnt_added_to_loaded_set <ide> def test_constantize_shortcut_for_cached_constant_lookups <ide> <ide> def test_nested_load_error_isnt_rescued <ide> with_loading 'dependencies' do <del> assert_raise(MissingSourceFile) do <add> assert_raise(LoadError) do <ide> RequiresNonexistent1 <ide> end <ide> end
3
PHP
PHP
allow specifying name for application rules
b625cb7b3bc47d6cf764f044ed0f72885289dc8a
<ide><path>src/ORM/RulesChecker.php <ide> public function __construct(array $options) <ide> * <ide> * @param callable $rule A callable function or object that will return whether <ide> * the entity is valid or not. <add> * @param string $name The alias for a rule. <ide> * @param array $options List of extra options to pass to the rule callable as <ide> * second argument. <ide> * @return $this <ide> */ <del> public function add(callable $rule, array $options = []) <add> public function add(callable $rule, $name = null, array $options = []) <ide> { <del> $this->_rules[] = $this->_addError($rule, $options); <add> $this->_rules[] = $this->_addError($rule, $name, $options); <ide> return $this; <ide> } <ide> <ide> public function add(callable $rule, array $options = []) <ide> * <ide> * @param callable $rule A callable function or object that will return whether <ide> * the entity is valid or not. <add> * @param string $name The alias for a rule. <ide> * @param array $options List of extra options to pass to the rule callable as <ide> * second argument. <ide> * @return $this <ide> */ <del> public function addCreate(callable $rule, array $options = []) <add> public function addCreate(callable $rule, $name = null, array $options = []) <ide> { <del> $this->_createRules[] = $this->_addError($rule, $options); <add> $this->_createRules[] = $this->_addError($rule, $name, $options); <ide> return $this; <ide> } <ide> <ide> public function addCreate(callable $rule, array $options = []) <ide> * <ide> * @param callable $rule A callable function or object that will return whether <ide> * the entity is valid or not. <add> * @param string $name The alias for a rule. <ide> * @param array $options List of extra options to pass to the rule callable as <ide> * second argument. <ide> * @return $this <ide> */ <del> public function addUpdate(callable $rule, array $options = []) <add> public function addUpdate(callable $rule, $name = null, array $options = []) <ide> { <del> $this->_updateRules[] = $this->_addError($rule, $options); <add> $this->_updateRules[] = $this->_addError($rule, $name, $options); <ide> return $this; <ide> } <ide> <ide> public function addUpdate(callable $rule, array $options = []) <ide> * <ide> * @param callable $rule A callable function or object that will return whether <ide> * the entity is valid or not. <add> * @param string $name The alias for a rule. <ide> * @param array $options List of extra options to pass to the rule callable as <ide> * second argument. <ide> * @return $this <ide> */ <del> public function addDelete(callable $rule, array $options = []) <add> public function addDelete(callable $rule, $name = null, array $options = []) <ide> { <del> $this->_deleteRules[] = $this->_addError($rule, $options); <add> $this->_deleteRules[] = $this->_addError($rule, $name, $options); <ide> return $this; <ide> } <ide> <ide> public function isUnique(array $fields, $message = null) <ide> } <ide> <ide> $errorField = current($fields); <del> return $this->_addError(new IsUnique($fields), compact('errorField', 'message')); <add> return $this->_addError(new IsUnique($fields), 'isUnique', compact('errorField', 'message')); <ide> } <ide> <ide> /** <ide> public function existsIn($field, $table, $message = null) <ide> } <ide> <ide> $errorField = $field; <del> return $this->_addError(new ExistsIn($field, $table), compact('errorField', 'message')); <add> return $this->_addError(new ExistsIn($field, $table), 'existsIn', compact('errorField', 'message')); <ide> } <ide> <ide> /** <ide> * Utility method for decorating any callable so that if it returns false, the correct <ide> * property in the entity is marked as invalid. <ide> * <ide> * @param callable $rule The rule to decorate <add> * @param string $name The alias for a rule. <ide> * @param array $options The options containing the error message and field <ide> * @return callable <ide> */ <del> protected function _addError($rule, $options) <add> protected function _addError($rule, $name, $options) <ide> { <del> return function ($entity, $scope) use ($rule, $options) { <add> if (is_array($name)) { <add> $options = $name; <add> $name = null; <add> } <add> <add> return function ($entity, $scope) use ($rule, $name, $options) { <ide> $pass = $rule($entity, $options + $scope); <ide> <ide> if ($pass || empty($options['errorField'])) { <ide> return $pass; <ide> } <ide> <ide> $message = isset($options['message']) ? $options['message'] : 'invalid'; <del> $entity->errors($options['errorField'], (array)$message); <add> if ($name) { <add> $message = [$name => $message]; <add> } else { <add> $message = (array)$message; <add> } <add> $entity->errors($options['errorField'], $message); <ide> return $pass; <ide> }; <ide> } <ide><path>tests/TestCase/ORM/RulesCheckerIntegrationTest.php <ide> public function testSaveBelongsToManyWithValidationErrorInJointEntityNonAtomic() <ide> $this->assertEquals(5, $entity->tags[1]->_joinData->tag_id); <ide> } <ide> <add> /** <add> * Test adding rule with name <add> * <add> * @group save <add> * @return void <add> */ <add> public function testAddingRuleWithName() <add> { <add> $entity = new Entity([ <add> 'name' => 'larry' <add> ]); <add> <add> $table = TableRegistry::get('Authors'); <add> $rules = $table->rulesChecker(); <add> $rules->add( <add> function () { <add> return false; <add> }, <add> 'ruleName', <add> ['errorField' => 'name'] <add> ); <add> <add> $this->assertFalse($table->save($entity)); <add> $this->assertEquals(['ruleName' => 'invalid'], $entity->errors('name')); <add> } <add> <ide> /** <ide> * Tests the isUnique domain rule <ide> * <ide> public function testIsUniqueDomainRule() <ide> $rules->add($rules->isUnique(['name'])); <ide> <ide> $this->assertFalse($table->save($entity)); <del> $this->assertEquals(['This value is already in use'], $entity->errors('name')); <add> $this->assertEquals(['isUnique' => 'This value is already in use'], $entity->errors('name')); <ide> <ide> $entity->name = 'jose'; <ide> $this->assertSame($entity, $table->save($entity)); <ide> public function testIsUniqueMultipleFields() <ide> $rules->add($rules->isUnique(['title', 'author_id'], 'Nope')); <ide> <ide> $this->assertFalse($table->save($entity)); <del> $this->assertEquals(['title' => ['Nope']], $entity->errors()); <add> $this->assertEquals(['title' => ['isUnique' => 'Nope']], $entity->errors()); <ide> <ide> $entity->clean(); <ide> $entity->author_id = 2; <ide> public function testExistsInDomainRule() <ide> $rules->add($rules->existsIn('author_id', 'Authors')); <ide> <ide> $this->assertFalse($table->save($entity)); <del> $this->assertEquals(['This value does not exist'], $entity->errors('author_id')); <add> $this->assertEquals(['existsIn' => 'This value does not exist'], $entity->errors('author_id')); <ide> } <ide> <ide> /** <ide> public function testExistsInDomainRuleWithObject() <ide> $rules->add($rules->existsIn('author_id', TableRegistry::get('Authors'), 'Nope')); <ide> <ide> $this->assertFalse($table->save($entity)); <del> $this->assertEquals(['Nope'], $entity->errors('author_id')); <add> $this->assertEquals(['existsIn' => 'Nope'], $entity->errors('author_id')); <ide> } <ide> <ide> /**
2
Text
Text
use code markup/markdown in headers
adc9fa240e31daf689c3b4b1d90b9e3221559a6d
<ide><path>doc/api/console.md <ide> myConsole.warn(`Danger ${name}! Danger!`); <ide> // Prints: Danger Will Robinson! Danger!, to err <ide> ``` <ide> <del>## Class: Console <add>## Class: `Console` <ide> <!-- YAML <ide> changes: <ide> - version: v8.0.0 <ide> const { Console } = require('console'); <ide> const { Console } = console; <ide> ``` <ide> <del>### new Console(stdout\[, stderr\]\[, ignoreErrors\]) <del>### new Console(options) <add>### `new Console(stdout[, stderr][, ignoreErrors])` <add>### `new Console(options)` <ide> <!-- YAML <ide> changes: <ide> - version: v8.0.0 <ide> The global `console` is a special `Console` whose output is sent to <ide> new Console({ stdout: process.stdout, stderr: process.stderr }); <ide> ``` <ide> <del>### console.assert(value\[, ...message\]) <add>### `console.assert(value[, ...message])` <ide> <!-- YAML <ide> added: v0.1.101 <ide> changes: <ide> console.assert(false, 'Whoops %s work', 'didn\'t'); <ide> Calling `console.assert()` with a falsy assertion will only cause the `message` <ide> to be printed to the console without interrupting execution of subsequent code. <ide> <del>### console.clear() <add>### `console.clear()` <ide> <!-- YAML <ide> added: v8.3.0 <ide> --> <ide> operates similarly to the `clear` shell command. On Windows, `console.clear()` <ide> will clear only the output in the current terminal viewport for the Node.js <ide> binary. <ide> <del>### console.count(\[label\]) <add>### `console.count([label])` <ide> <!-- YAML <ide> added: v8.3.0 <ide> --> <ide> undefined <ide> > <ide> ``` <ide> <del>### console.countReset(\[label\]) <add>### `console.countReset([label])` <ide> <!-- YAML <ide> added: v8.3.0 <ide> --> <ide> undefined <ide> > <ide> ``` <ide> <del>### console.debug(data\[, ...args\]) <add>### `console.debug(data[, ...args])` <ide> <!-- YAML <ide> added: v8.0.0 <ide> changes: <ide> changes: <ide> <ide> The `console.debug()` function is an alias for [`console.log()`][]. <ide> <del>### console.dir(obj\[, options\]) <add>### `console.dir(obj[, options])` <ide> <!-- YAML <ide> added: v0.1.101 <ide> --> <ide> added: v0.1.101 <ide> Uses [`util.inspect()`][] on `obj` and prints the resulting string to `stdout`. <ide> This function bypasses any custom `inspect()` function defined on `obj`. <ide> <del>### console.dirxml(...data) <add>### `console.dirxml(...data)` <ide> <!-- YAML <ide> added: v8.0.0 <ide> changes: <ide> changes: <ide> This method calls `console.log()` passing it the arguments received. <ide> This method does not produce any XML formatting. <ide> <del>### console.error(\[data\]\[, ...args\]) <add>### `console.error([data][, ...args])` <ide> <!-- YAML <ide> added: v0.1.100 <ide> --> <ide> If formatting elements (e.g. `%d`) are not found in the first string then <ide> [`util.inspect()`][] is called on each argument and the resulting string <ide> values are concatenated. See [`util.format()`][] for more information. <ide> <del>### console.group(\[...label\]) <add>### `console.group([...label])` <ide> <!-- YAML <ide> added: v8.5.0 <ide> --> <ide> Increases indentation of subsequent lines by two spaces. <ide> If one or more `label`s are provided, those are printed first without the <ide> additional indentation. <ide> <del>### console.groupCollapsed() <add>### `console.groupCollapsed()` <ide> <!-- YAML <ide> added: v8.5.0 <ide> --> <ide> <ide> An alias for [`console.group()`][]. <ide> <del>### console.groupEnd() <add>### `console.groupEnd()` <ide> <!-- YAML <ide> added: v8.5.0 <ide> --> <ide> <ide> Decreases indentation of subsequent lines by two spaces. <ide> <del>### console.info(\[data\]\[, ...args\]) <add>### `console.info([data][, ...args])` <ide> <!-- YAML <ide> added: v0.1.100 <ide> --> <ide> added: v0.1.100 <ide> <ide> The `console.info()` function is an alias for [`console.log()`][]. <ide> <del>### console.log(\[data\]\[, ...args\]) <add>### `console.log([data][, ...args])` <ide> <!-- YAML <ide> added: v0.1.100 <ide> --> <ide> console.log('count:', count); <ide> <ide> See [`util.format()`][] for more information. <ide> <del>### console.table(tabularData\[, properties\]) <add>### `console.table(tabularData[, properties])` <ide> <!-- YAML <ide> added: v10.0.0 <ide> --> <ide> console.table([{ a: 1, b: 'Y' }, { a: 'Z', b: 2 }], ['a']); <ide> // └─────────┴─────┘ <ide> ``` <ide> <del>### console.time(\[label\]) <add>### `console.time([label])` <ide> <!-- YAML <ide> added: v0.1.104 <ide> --> <ide> are identified by a unique `label`. Use the same `label` when calling <ide> [`console.timeEnd()`][] to stop the timer and output the elapsed time in <ide> milliseconds to `stdout`. Timer durations are accurate to the sub-millisecond. <ide> <del>### console.timeEnd(\[label\]) <add>### `console.timeEnd([label])` <ide> <!-- YAML <ide> added: v0.1.104 <ide> changes: <ide> console.timeEnd('100-elements'); <ide> // prints 100-elements: 225.438ms <ide> ``` <ide> <del>### console.timeLog(\[label\]\[, ...data\]) <add>### `console.timeLog([label][, ...data])` <ide> <!-- YAML <ide> added: v10.7.0 <ide> --> <ide> doExpensiveProcess2(value); <ide> console.timeEnd('process'); <ide> ``` <ide> <del>### console.trace(\[message\]\[, ...args\]) <add>### `console.trace([message][, ...args])` <ide> <!-- YAML <ide> added: v0.1.104 <ide> --> <ide> console.trace('Show me'); <ide> // at REPLServer.Interface._ttyWrite (readline.js:826:14) <ide> ``` <ide> <del>### console.warn(\[data\]\[, ...args\]) <add>### `console.warn([data][, ...args])` <ide> <!-- YAML <ide> added: v0.1.100 <ide> --> <ide> The following methods are exposed by the V8 engine in the general API but do <ide> not display anything unless used in conjunction with the [inspector][] <ide> (`--inspect` flag). <ide> <del>### console.profile(\[label\]) <add>### `console.profile([label])` <ide> <!-- YAML <ide> added: v8.0.0 <ide> --> <ide> console.profileEnd('MyLabel'); <ide> // Adds the profile 'MyLabel' to the Profiles panel of the inspector. <ide> ``` <ide> <del>### console.profileEnd(\[label\]) <add>### `console.profileEnd([label])` <ide> <!-- YAML <ide> added: v8.0.0 <ide> --> <ide> the report to the **Profiles** panel of the inspector. See <ide> If this method is called without a label, the most recently started profile is <ide> stopped. <ide> <del>### console.timeStamp(\[label\]) <add>### `console.timeStamp([label])` <ide> <!-- YAML <ide> added: v8.0.0 <ide> -->
1
Go
Go
remove defaultsleepimage constant
27f432ca57fb6d4d0409fc3c5358b74feae228cc
<ide><path>integration-cli/benchmark_test.go <ide> func (s *DockerSuite) BenchmarkConcurrentContainerActions(c *check.C) { <ide> go func() { <ide> defer innerGroup.Done() <ide> for i := 0; i < numIterations; i++ { <del> args := []string{"run", "-d", defaultSleepImage} <add> args := []string{"run", "-d", "busybox"} <ide> args = append(args, sleepCommandForDaemonPlatform()...) <ide> out, _, err := dockerCmdWithError(args...) <ide> if err != nil { <ide><path>integration-cli/docker_cli_service_scale_test.go <ide> func (s *DockerSwarmSuite) TestServiceScale(c *check.C) { <ide> d := s.AddDaemon(c, true, true) <ide> <ide> service1Name := "TestService1" <del> service1Args := append([]string{"service", "create", "--detach", "--no-resolve-image", "--name", service1Name, defaultSleepImage}, sleepCommandForDaemonPlatform()...) <add> service1Args := append([]string{"service", "create", "--detach", "--no-resolve-image", "--name", service1Name, "busybox"}, sleepCommandForDaemonPlatform()...) <ide> <ide> // global mode <ide> service2Name := "TestService2" <del> service2Args := append([]string{"service", "create", "--detach", "--no-resolve-image", "--name", service2Name, "--mode=global", defaultSleepImage}, sleepCommandForDaemonPlatform()...) <add> service2Args := append([]string{"service", "create", "--detach", "--no-resolve-image", "--name", service2Name, "--mode=global", "busybox"}, sleepCommandForDaemonPlatform()...) <ide> <ide> // Create services <ide> _, err := d.Cmd(service1Args...) <ide><path>integration-cli/docker_utils_test.go <ide> func getInspectBody(c *check.C, version, id string) []byte { <ide> // Run a long running idle task in a background container using the <ide> // system-specific default image and command. <ide> func runSleepingContainer(c *check.C, extraArgs ...string) string { <del> return runSleepingContainerInImage(c, defaultSleepImage, extraArgs...) <add> return runSleepingContainerInImage(c, "busybox", extraArgs...) <ide> } <ide> <ide> // Run a long running idle task in a background container using the specified <ide><path>integration-cli/test_vars_unix_test.go <ide> const ( <ide> isUnixCli = true <ide> <ide> expectedFileChmod = "-rw-r--r--" <del> <del> // On Unix variants, the busybox image comes with the `top` command which <del> // runs indefinitely while still being interruptible by a signal. <del> defaultSleepImage = "busybox" <ide> ) <ide><path>integration-cli/test_vars_windows_test.go <ide> const ( <ide> <ide> // this is the expected file permission set on windows: gh#11395 <ide> expectedFileChmod = "-rwxr-xr-x" <del> <del> // On Windows, the busybox image doesn't have the `top` command, so we rely <del> // on `sleep` with a high duration. <del> defaultSleepImage = "busybox" <ide> )
5
Go
Go
add secretupdate method to client
77b8465d7e68ca102d7aae839c7b3fe0ecd28398
<ide><path>cli/command/service/update_test.go <ide> func (s secretAPIClientMock) SecretRemove(ctx context.Context, id string) error <ide> func (s secretAPIClientMock) SecretInspectWithRaw(ctx context.Context, name string) (swarm.Secret, []byte, error) { <ide> return swarm.Secret{}, []byte{}, nil <ide> } <add>func (s secretAPIClientMock) SecretUpdate(ctx context.Context, id string, version swarm.Version, secret swarm.SecretSpec) error { <add> return nil <add>} <ide> <ide> // TestUpdateSecretUpdateInPlace tests the ability to update the "target" of an secret with "docker service update" <ide> // by combining "--secret-rm" and "--secret-add" for the same secret. <ide><path>client/interface.go <ide> type SecretAPIClient interface { <ide> SecretCreate(ctx context.Context, secret swarm.SecretSpec) (types.SecretCreateResponse, error) <ide> SecretRemove(ctx context.Context, id string) error <ide> SecretInspectWithRaw(ctx context.Context, name string) (swarm.Secret, []byte, error) <add> SecretUpdate(ctx context.Context, id string, version swarm.Version, secret swarm.SecretSpec) error <ide> } <ide><path>client/secret_update.go <add>package client <add> <add>import ( <add> "net/url" <add> "strconv" <add> <add> "github.com/docker/docker/api/types/swarm" <add> "golang.org/x/net/context" <add>) <add> <add>// SecretUpdate updates a Secret. Currently, the only part of a secret spec <add>// which can be updated is Labels. <add>func (cli *Client) SecretUpdate(ctx context.Context, id string, version swarm.Version, secret swarm.SecretSpec) error { <add> query := url.Values{} <add> query.Set("version", strconv.FormatUint(version.Index, 10)) <add> resp, err := cli.post(ctx, "/secrets/"+id+"/update", query, secret, nil) <add> ensureReaderClosed(resp) <add> return err <add>} <ide><path>client/secret_update_test.go <add>package client <add> <add>import ( <add> "bytes" <add> "fmt" <add> "io/ioutil" <add> "net/http" <add> "strings" <add> "testing" <add> <add> "golang.org/x/net/context" <add> <add> "github.com/docker/docker/api/types/swarm" <add>) <add> <add>func TestSecretUpdateError(t *testing.T) { <add> client := &Client{ <add> client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")), <add> } <add> <add> err := client.SecretUpdate(context.Background(), "secret_id", swarm.Version{}, swarm.SecretSpec{}) <add> if err == nil || err.Error() != "Error response from daemon: Server error" { <add> t.Fatalf("expected a Server Error, got %v", err) <add> } <add>} <add> <add>func TestSecretUpdate(t *testing.T) { <add> expectedURL := "/secrets/secret_id/update" <add> <add> client := &Client{ <add> client: newMockClient(func(req *http.Request) (*http.Response, error) { <add> if !strings.HasPrefix(req.URL.Path, expectedURL) { <add> return nil, fmt.Errorf("Expected URL '%s', got '%s'", expectedURL, req.URL) <add> } <add> if req.Method != "POST" { <add> return nil, fmt.Errorf("expected POST method, got %s", req.Method) <add> } <add> return &http.Response{ <add> StatusCode: http.StatusOK, <add> Body: ioutil.NopCloser(bytes.NewReader([]byte("body"))), <add> }, nil <add> }), <add> } <add> <add> err := client.SecretUpdate(context.Background(), "secret_id", swarm.Version{}, swarm.SecretSpec{}) <add> if err != nil { <add> t.Fatal(err) <add> } <add>}
4
Python
Python
add example to savez
f826c7b7f2719a95731da14102d28cc7f3147c01
<ide><path>numpy/lib/io.py <ide> def savez(file, *args, **kwds): <ide> The .npz file format is a zipped archive of files named after the variables <ide> they contain. Each file contains one variable in .npy format. <ide> <add> Examples <add> -------- <add> >>> x = np.random.random((3, 3)) <add> >>> y = np.zeros((3, 2)) <add> >>> np.savez('data', x=x, y=y) <add> <ide> """ <ide> <ide> # Import is postponed to here since zipfile depends on gzip, an optional
1
Ruby
Ruby
update small typo in documentation
20613519c25808cf5b6b405dd76eb6cea4ae8bd2
<ide><path>actionpack/lib/action_controller/metal/helpers.rb <ide> module ActionController <ide> # end <ide> # end <ide> # <del> # Then, in any view rendered by <tt>EventController</tt>, the <tt>format_time</tt> method can be called: <add> # Then, in any view rendered by <tt>EventsController</tt>, the <tt>format_time</tt> method can be called: <ide> # <ide> # <% @events.each do |event| -%> <ide> # <p>
1
Go
Go
use proper wait function for --pid=host
489ab77f4aea9bc3e7ada751cab5d827040b1e8b
<ide><path>daemon/execdriver/native/driver.go <ide> func (d *driver) Run(c *execdriver.Command, pipes *execdriver.Pipes, startCallba <ide> logrus.Warnf("Your kernel does not support OOM notifications: %s", err) <ide> } <ide> waitF := p.Wait <del> if nss := cont.Config().Namespaces; nss.Contains(configs.NEWPID) { <add> if nss := cont.Config().Namespaces; !nss.Contains(configs.NEWPID) { <ide> // we need such hack for tracking processes with inerited fds, <ide> // because cmd.Wait() waiting for all streams to be copied <ide> waitF = waitInPIDHost(p, cont)
1
Text
Text
fix code example for `generating reducers`
b8b596efc334982c470f449e06f80c34913fed22
<ide><path>docs/recipes/ReducingBoilerplate.md <ide> Let's write a function that lets us express reducers as an object mapping from a <ide> <ide> ```js <ide> export const todos = createReducer([], { <del> [ActionTypes.ADD_TODO](state, action) { <add> [ActionTypes.ADD_TODO]: (state, action) => { <ide> let text = action.text.trim() <ide> return [...state, text] <ide> }
1
PHP
PHP
remove methods that simply call parent
178ad5513cad4550771df5b815c6bebeda417446
<ide><path>src/I18n/FrozenTime.php <ide> public static function listTimezones($filter = null, $country = null, $options = <ide> <ide> return array_combine($identifiers, $identifiers); <ide> } <del> <del> /** <del> * Returns true this instance will happen within the specified interval <del> * <del> * @param string $timeInterval the numeric value with space then time type. <del> * Example of valid types: 6 hours, 2 days, 1 minute. <del> * @return bool <del> */ <del> public function wasWithinLast($timeInterval) <del> { <del> return parent::wasWithinLast($timeInterval); <del> } <del> <del> /** <del> * Returns true this instance happened within the specified interval <del> * <del> * @param string $timeInterval the numeric value with space then time type. <del> * Example of valid types: 6 hours, 2 days, 1 minute. <del> * @return bool <del> */ <del> public function isWithinNext($timeInterval) <del> { <del> return parent::isWithinNext($timeInterval); <del> } <ide> }
1
PHP
PHP
correct doc block
c321ee5fecfd1da30f1b30e0a73d48770d4a80d7
<ide><path>lib/Cake/Utility/String.php <ide> public static function wordWrap($text, $width = 72, $break = "\n", $cut = false) <ide> * - `html` If true, will ignore any HTML tags, ensuring that only the correct text is highlighted <ide> * - `regex` a custom regex rule that is used to match words, default is '|$tag|iu' <ide> * <del> * @param string $text Text to search the phrase in <del> * @param string $phrase The phrase that will be searched <add> * @param string $text Text to search the phrase in. <add> * @param string|array $phrase The phrase or phrases that will be searched. <ide> * @param array $options An array of html attributes and options. <ide> * @return string The highlighted text <ide> * @link http://book.cakephp.org/2.0/en/core-libraries/helpers/text.html#TextHelper::highlight <ide> public static function highlight($text, $phrase, $options = array()) { <ide> } <ide> <ide> /** <del> * Strips given text of all links (<a href=....) <add> * Strips given text of all links (<a href=....). <ide> * <ide> * @param string $text Text <ide> * @return string The text without links
1
Ruby
Ruby
add missing require
f249d07c44d2f18e508ac83153c9f9cb8bce340b
<ide><path>actionpack/lib/action_controller/caching/pages.rb <ide> require 'fileutils' <add>require 'active_support/concern' <ide> require 'active_support/core_ext/class/attribute_accessors' <ide> <ide> module ActionController #:nodoc:
1
PHP
PHP
fix parse errors in 7.2
2246029d7f4ba1ca1023cf20b5ee6e01826b2ae6
<ide><path>tests/TestCase/Console/ConsoleIoTest.php <ide> public function testVerboseOut() <ide> ->withConsecutive( <ide> ['Verbose', 1], <ide> ['Normal', 1], <del> ['Quiet', 1], <add> ['Quiet', 1] <ide> ); <ide> <ide> $this->io->level(ConsoleIo::VERBOSE); <ide> public function testVerboseOutput() <ide> ->withConsecutive( <ide> ['Verbose', 1], <ide> ['Normal', 1], <del> ['Quiet', 1], <add> ['Quiet', 1] <ide> ); <ide> <ide> $this->io->level(ConsoleIo::VERBOSE); <ide> public function testQuietOutput() <ide> ->method('write') <ide> ->withConsecutive( <ide> ['Quiet', 1], <del> ['Quiet', 1], <add> ['Quiet', 1] <ide> ); <ide> <ide> $this->io->level(ConsoleIo::QUIET); <ide> public function testHr() <ide> ['', 0], <ide> ['', true], <ide> [$bar, 1], <del> ['', true], <add> ['', true] <ide> ); <ide> <ide> $this->io->hr(); <ide> public function testOverwriteWithLongerContent() <ide> ['123', 0], <ide> // Backspaces <ide> [str_repeat("\x08", 3), 0], <del> ['12345', 0], <add> ['12345', 0] <ide> ) <ide> ->will($this->onConsecutiveCalls( <ide> 1,
1
Javascript
Javascript
fix reponder logic in text
e2ce22b823661a7dcf6b70a825921a2910383bd1
<ide><path>Libraries/Text/Text.js <ide> class TouchableText extends React.Component<Props, State> { <ide> onResponderGrant: (event: SyntheticEvent<>, dispatchID: string): void => { <ide> nullthrows(this.touchableHandleResponderGrant)(event, dispatchID); <ide> if (this.props.onResponderGrant != null) { <del> this.props.onResponderGrant.apply(this, arguments); <add> this.props.onResponderGrant.call(this, event, dispatchID); <ide> } <ide> }, <ide> onResponderMove: (event: SyntheticEvent<>): void => { <ide> nullthrows(this.touchableHandleResponderMove)(event); <ide> if (this.props.onResponderMove != null) { <del> this.props.onResponderMove.apply(this, arguments); <add> this.props.onResponderMove.call(this, event); <ide> } <ide> }, <ide> onResponderRelease: (event: SyntheticEvent<>): void => { <ide> nullthrows(this.touchableHandleResponderRelease)(event); <ide> if (this.props.onResponderRelease != null) { <del> this.props.onResponderRelease.apply(this, arguments); <add> this.props.onResponderRelease.call(this, event); <ide> } <ide> }, <ide> onResponderTerminate: (event: SyntheticEvent<>): void => { <ide> nullthrows(this.touchableHandleResponderTerminate)(event); <ide> if (this.props.onResponderTerminate != null) { <del> this.props.onResponderTerminate.apply(this, arguments); <add> this.props.onResponderTerminate.call(this, event); <ide> } <ide> }, <ide> onResponderTerminationRequest: (): boolean => {
1
Javascript
Javascript
make combined scripts
23d11dadc157377d984197590bfd42d43ac382ce
<ide><path>d3.layout.js <ide> d3.layout.partition = function() { <ide> n = children.length, <ide> c, <ide> d; <del> dx /= node.value; <add> dx = node.value === 0 <add> ? 0 : dx / node.value; <ide> while (++i < n) { <ide> position(c = children[i], x, d = c.value * dx, dy); <ide> x += d; <ide><path>d3.layout.min.js <del>(function(){function bj(a,b){var c=a.x+b[3],d=a.y+b[0],e=a.dx-b[1]-b[3],f=a.dy-b[0]-b[2];e<0&&(c+=e/2,e=0),f<0&&(d+=f/2,f=0);return{x:c,y:d,dx:e,dy:f}}function bi(a){return{x:a.x,y:a.y,dx:a.dx,dy:a.dy}}function bh(a,b,c){return a._tree.ancestor.parent==b.parent?a._tree.ancestor:c}function bg(a,b,c){a=a._tree,b=b._tree;var d=c/(b.number-a.number);a.change+=d,b.change-=d,b.shift+=c,b.prelim+=c,b.mod+=c}function bf(a){var b=0,c=0,d=a.children,e=d.length,f;while(--e>=0)f=d[e]._tree,f.prelim+=b,f.mod+=b,b+=f.shift+(c+=f.change)}function be(a,b){function c(a,d){var e=a.children;if(e){var f,g=null,h=-1,i=e.length;while(++h<i)f=e[h],c(f,g),g=f}b(a,d)}c(a,null)}function bd(a,b){return a.depth-b.depth}function bc(a,b){return b.x-a.x}function bb(a,b){return a.x-b.x}function ba(a,b){var c=a.children;if(c){var d,e=c.length,f=-1;while(++f<e)b(d=ba(c[f],b),a)>0&&(a=d)}return a}function _(a){return a.children?a.children[a.children.length-1]:a._tree.thread}function $(a){return a.children?a.children[0]:a._tree.thread}function Z(a,b){return a.parent==b.parent?1:2}function Y(a){var b=a.children;return b?Y(b[b.length-1]):a}function X(a){var b=a.children;return b?X(b[0]):a}function W(a){return a.reduce(function(a,b){return a+b.x},0)/a.length}function V(a){return 1+d3.max(a,function(a){return a.y})}function U(a,b,c){var d=b.r+c.r,e=a.r+c.r,f=b.x-a.x,g=b.y-a.y,h=Math.sqrt(f*f+g*g),i=(e*e+h*h-d*d)/(2*e*h),j=Math.acos(i),k=i*e,l=Math.sin(j)*e;f/=h,g/=h,c.x=a.x+k*f+l*g,c.y=a.y+k*g-l*f}function T(a,b,c,d){var e=a.children;a.x=b+=d*a.x,a.y=c+=d*a.y,a.r*=d;if(e){var f=-1,g=e.length;while(++f<g)T(e[f],b,c,d)}}function S(a){var b=a.children;b?(b.forEach(S),a.r=P(b)):a.r=Math.sqrt(a.value)}function R(a){delete a._pack_next,delete a._pack_prev}function Q(a){a._pack_next=a._pack_prev=a}function P(a){function l(a){b=Math.min(a.x-a.r,b),c=Math.max(a.x+a.r,c),d=Math.min(a.y-a.r,d),e=Math.max(a.y+a.r,e)}var b=Infinity,c=-Infinity,d=Infinity,e=-Infinity,f=a.length,g,h,i,j,k;a.forEach(Q),g=a[0],g.x=-g.r,g.y=0,l(g);if(f>1){h=a[1],h.x=h.r,h.y=0,l(h);if(f>2){i=a[2],U(g,h,i),l(i),M(g,i),g._pack_prev=i,M(i,h),h=g._pack_next;for(var m=3;m<f;m++){U(g,h,i=a[m]);var n=0,o=1,p=1;for(j=h._pack_next;j!==h;j=j._pack_next,o++)if(O(j,i)){n=1;break}if(n==1)for(k=g._pack_prev;k!==j._pack_prev;k=k._pack_prev,p++)if(O(k,i)){p<o&&(n=-1,j=k);break}n==0?(M(g,i),h=i,l(i)):n>0?(N(g,j),h=j,m--):(N(j,h),g=j,m--)}}}var q=(b+c)/2,r=(d+e)/2,s=0;for(var m=0;m<f;m++){var t=a[m];t.x-=q,t.y-=r,s=Math.max(s,t.r+Math.sqrt(t.x*t.x+t.y*t.y))}a.forEach(R);return s}function O(a,b){var c=b.x-a.x,d=b.y-a.y,e=a.r+b.r;return e*e-c*c-d*d>.001}function N(a,b){a._pack_next=b,b._pack_prev=a}function M(a,b){var c=a._pack_next;a._pack_next=b,b._pack_prev=a,b._pack_next=c,c._pack_prev=b}function L(a,b){return a.value-b.value}function J(a){return d3.merge(a.map(function(a){return(a.children||[]).map(function(b){return{source:a,target:b}})}))}function I(a,b){return b.value-a.value}function H(a){return a.value}function G(a){return a.children}function F(a,b){a.sort=d3.rebind(a,b.sort),a.children=d3.rebind(a,b.children),a.links=J,a.value=d3.rebind(a,b.value),a.nodes=function(b){K=!0;return(a.nodes=a)(b)};return a}function E(a){return[d3.min(a),d3.max(a)]}function D(a,b){var c=-1,d=+a[0],e=(a[1]-d)/b,f=[];while(++c<=b)f[c]=e*c+d;return f}function C(a,b){return D(a,Math.ceil(Math.log(b.length)/Math.LN2+1))}function B(a,b){return a+b[1]}function A(a){return a.reduce(B,0)}function z(a){var b=1,c=0,d=a[0][1],e,f=a.length;for(;b<f;++b)(e=a[b][1])>d&&(c=b,d=e);return c}function w(a,b,c){a.y0=b,a.y=c}function v(a){return a.y}function u(a){return a.x}function t(a){return 1}function s(a){return 20}function r(a){var b=0,c=0;a.count=0;if(!a.leaf){var d=a.nodes,e=d.length,f=-1,g;while(++f<e){g=d[f];if(g==null)continue;r(g),a.count+=g.count,b+=g.count*g.cx,c+=g.count*g.cy}}a.point&&(a.leaf||(a.point.x+=Math.random()-.5,a.point.y+=Math.random()-.5),a.count++,b+=a.point.x,c+=a.point.y),a.cx=b/a.count,a.cy=c/a.count}function q(){d3.event.stopPropagation(),d3.event.preventDefault()}function p(){i&&(q(),i=!1)}function o(){!f||(g&&(i=!0,q()),d3.event.type==="mouseup"&&n(),f.fixed=!1,e=h=f=j=null)}function n(){if(!!f){var a=j.parentNode;if(!a){f.fixed=!1,h=f=j=null;return}var b=m(a);g=!0,f.px=b[0]-h[0],f.py=b[1]-h[1],q(),e.resume()}}function m(a){return d3.event.touches?d3.svg.touches(a)[0]:d3.svg.mouse(a)}function l(a){a!==f&&(a.fixed=!1)}function k(a){a.fixed=!0}function c(a,c){if(a===c)return a;var d=b(a),e=b(c),f=d.pop(),g=e.pop(),h=null;while(f===g)h=f,f=d.pop(),g=e.pop();return h}function b(a){var b=[],c=a.parent;while(c!=null)b.push(a),a=c,c=c.parent;b.push(a);return b}function a(a){var b=a.source,d=a.target,e=c(b,d),f=[b];while(b!==e)b=b.parent,f.push(b);var g=f.length;while(d!==e)f.splice(g,0,d),d=d.parent;return f}d3.layout={},d3.layout.bundle=function(){return function(b){var c=[],d=-1,e=b.length;while(++d<e)c.push(a(b[d]));return c}},d3.layout.chord=function(){function k(){b.sort(function(a,b){return i(a.target.value,b.target.value)})}function j(){var a={},j=[],l=d3.range(e),m=[],n,o,p,q,r;b=[],c=[],n=0,q=-1;while(++q<e){o=0,r=-1;while(++r<e)o+=d[q][r];j.push(o),m.push(d3.range(e)),n+=o}g&&l.sort(function(a,b){return g(j[a],j[b])}),h&&m.forEach(function(a,b){a.sort(function(a,c){return h(d[b][a],d[b][c])})}),n=(2*Math.PI-f*e)/n,o=0,q=-1;while(++q<e){p=o,r=-1;while(++r<e){var s=l[q],t=m[q][r],u=d[s][t];a[s+"-"+t]={index:s,subindex:t,startAngle:o,endAngle:o+=u*n,value:u}}c.push({index:s,startAngle:p,endAngle:o,value:(o-p)/n}),o+=f}q=-1;while(++q<e){r=q-1;while(++r<e){var v=a[q+"-"+r],w=a[r+"-"+q];(v.value||w.value)&&b.push(v.value<w.value?{source:w,target:v}:{source:v,target:w})}}i&&k()}var a={},b,c,d,e,f=0,g,h,i;a.matrix=function(f){if(!arguments.length)return d;e=(d=f)&&d.length,b=c=null;return a},a.padding=function(d){if(!arguments.length)return f;f=d,b=c=null;return a},a.sortGroups=function(d){if(!arguments.length)return g;g=d,b=c=null;return a},a.sortSubgroups=function(c){if(!arguments.length)return h;h=c,b=null;return a},a.sortChords=function(c){if(!arguments.length)return i;i=c,b&&k();return a},a.chords=function(){b||j();return b},a.groups=function(){c||j();return c};return a},d3.layout.force=function(){function G(b,c){var d=m(this.parentNode);(f=b).fixed=!0,g=!1,j=this,e=a,h=[d[0]-b.x,d[1]-b.y],q()}function F(){var a=A.length,e=B.length,f=d3.geom.quadtree(A),g,h,j,k,l,m,n;for(g=0;g<e;++g){h=B[g],j=h.source,k=h.target,m=k.x-j.x,n=k.y-j.y;if(l=m*m+n*n)l=d*D[g]*((l=Math.sqrt(l))-C[g])/l,m*=l,n*=l,k.x-=m,k.y-=n,j.x+=m,j.y+=n}var o=d*x;m=c[0]/2,n=c[1]/2,g=-1;while(++g<a)h=A[g],h.x+=(m-h.x)*o,h.y+=(n-h.y)*o;r(f);var p=d*w;g=-1;while(++g<a)f.visit(E(A[g],p));g=-1;while(++g<a)h=A[g],h.fixed?(h.x=h.px,h.y=h.py):(h.x-=(h.px-(h.px=h.x))*i,h.y-=(h.py-(h.py=h.y))*i);b.tick.dispatch({type:"tick",alpha:d});return(d*=.99)<.005}function E(a,b){return function(c,d,e,f,g){if(c.point!==a){var h=c.cx-a.x,i=c.cy-a.y,j=1/Math.sqrt(h*h+i*i);if((f-d)*j<y){var k=b*c.count*j*j;a.x+=h*k,a.y+=i*k;return!0}if(c.point&&isFinite(j)){var k=b*j*j;a.x+=h*k,a.y+=i*k}}}}var a={},b=d3.dispatch("tick"),c=[1,1],d,i=.9,u=s,v=t,w=-30,x=.1,y=.8,z,A=[],B=[],C,D;a.on=function(c,d){b[c].add(d);return a},a.nodes=function(b){if(!arguments.length)return A;A=b;return a},a.links=function(b){if(!arguments.length)return B;B=b;return a},a.size=function(b){if(!arguments.length)return c;c=b;return a},a.linkDistance=function(b){if(!arguments.length)return u;u=d3.functor(b);return a},a.distance=a.linkDistance,a.linkStrength=function(b){if(!arguments.length)return v;v=d3.functor(b);return a},a.friction=function(b){if(!arguments.length)return i;i=b;return a},a.charge=function(b){if(!arguments.length)return w;w=b;return a},a.gravity=function(b){if(!arguments.length)return x;x=b;return a},a.theta=function(b){if(!arguments.length)return y;y=b;return a},a.start=function(){function l(){if(!i){i=[];for(d=0;d<e;++d)i[d]=[];for(d=0;d<f;++d){var a=B[d];i[a.source.index].push(a.target),i[a.target.index].push(a.source)}}return i[b]}function k(a,c){var d=l(b),e=-1,f=d.length,g;while(++e<f)if(!isNaN(g=d[e][a]))return g;return Math.random()*c}var b,d,e=A.length,f=B.length,g=c[0],h=c[1],i,j;for(b=0;b<e;++b)(j=A[b]).index=b;C=[],D=[];for(b=0;b<f;++b)j=B[b],typeof j.source=="number"&&(j.source=A[j.source]),typeof j.target=="number"&&(j.target=A[j.target]),C[b]=u.call(this,j,b),D[b]=v.call(this,j,b);for(b=0;b<e;++b)j=A[b],isNaN(j.x)&&(j.x=k("x",g)),isNaN(j.y)&&(j.y=k("y",h)),isNaN(j.px)&&(j.px=j.x),isNaN(j.py)&&(j.py=j.y);return a.resume()},a.resume=function(){d=.1,d3.timer(F);return a},a.stop=function(){d=0;return a},a.drag=function(){this.on("mouseover.force",k).on("mouseout.force",l).on("mousedown.force",G).on("touchstart.force",G),d3.select(window).on("mousemove.force",n).on("touchmove.force",n).on("mouseup.force",o,!0).on("touchend.force",o,!0).on("click.force",p,!0);return a};return a};var e,f,g,h,i,j;d3.layout.partition=function(){function e(e,f){var g=a.call(this,e,f);c(g[0],0,b[0],b[1]/d(g[0]));return g}function d(a){var b=a.children,c=0;if(b){var e=-1,f=b.length;while(++e<f)c=Math.max(c,d(b[e]))}return 1+c}function c(a,b,d,e){var f=a.children;a.x=b,a.y=a.depth*e,a.dx=d,a.dy=e;if(f){var g=-1,h=f.length,i,j;d/=a.value;while(++g<h)c(i=f[g],b,j=i.value*d,e),b+=j}}var a=d3.layout.hierarchy(),b=[1,1];e.size=function(a){if(!arguments.length)return b;b=a;return e};return F(e,a)},d3.layout.pie=function(){function f(f,g){var h=+(typeof c=="function"?c.apply(this,arguments):c),i=(typeof e=="function"?e.apply(this,arguments):e)-c,j=d3.range(f.length);b!=null&&j.sort(function(a,c){return b(f[a],f[c])});var k=f.map(a);i/=k.reduce(function(a,b){return a+b},0);var l=j.map(function(a){return{data:f[a],value:d=k[a],startAngle:h,endAngle:h+=d*i}});return f.map(function(a,b){return l[j[b]]})}var a=Number,b=null,c=0,e=2*Math.PI;f.value=function(b){if(!arguments.length)return a;a=b;return f},f.sort=function(a){if(!arguments.length)return b;b=a;return f},f.startAngle=function(a){if(!arguments.length)return c;c=a;return f},f.endAngle=function(a){if(!arguments.length)return e;e=a;return f};return f},d3.layout.stack=function(){function g(h,i){var j=h.map(function(b,c){return a.call(g,b,c)}),k=j.map(function(a,b){return a.map(function(a,b){return[e.call(g,a,b),f.call(g,a,b)]})}),l=b.call(g,k,i);j=d3.permute(j,l),k=d3.permute(k,l);var m=c.call(g,k,i),n=j.length,o=j[0].length,p,q,r;for(q=0;q<o;++q){d.call(g,j[0][q],r=m[q],k[0][q][1]);for(p=1;p<n;++p)d.call(g,j[p][q],r+=k[p-1][q][1],k[p][q][1])}return h}var a=Object,b=x["default"],c=y.zero,d=w,e=u,f=v;g.values=function(b){if(!arguments.length)return a;a=b;return g},g.order=function(a){if(!arguments.length)return b;b=typeof a=="function"?a:x[a];return g},g.offset=function(a){if(!arguments.length)return c;c=typeof a=="function"?a:y[a];return g},g.x=function(a){if(!arguments.length)return e;e=a;return g},g.y=function(a){if(!arguments.length)return f;f=a;return g},g.out=function(a){if(!arguments.length)return d;d=a;return g};return g};var x={"inside-out":function(a){var b=a.length,c,d,e=a.map(z),f=a.map(A),g=d3.range(b).sort(function(a,b){return e[a]-e[b]}),h=0,i=0,j=[],k=[];for(c=0;c<b;++c)d=g[c],h<i?(h+=f[d],j.push(d)):(i+=f[d],k.push(d));return k.reverse().concat(j)},reverse:function(a){return d3.range(a.length).reverse()},"default":function(a){return d3.range(a.length)}},y={silhouette:function(a){var b=a.length,c=a[0].length,d=[],e=0,f,g,h,i=[];for(g=0;g<c;++g){for(f=0,h=0;f<b;f++)h+=a[f][g][1];h>e&&(e=h),d.push(h)}for(g=0;g<c;++g)i[g]=(e-d[g])/2;return i},wiggle:function(a){var b=a.length,c=a[0],d=c.length,e=0,f,g,h,i,j,k,l,m,n,o=[];o[0]=m=n=0;for(g=1;g<d;++g){for(f=0,i=0;f<b;++f)i+=a[f][g][1];for(f=0,j=0,l=c[g][0]-c[g-1][0];f<b;++f){for(h=0,k=(a[f][g][1]-a[f][g-1][1])/(2*l);h<f;++h)k+=(a[h][g][1]-a[h][g-1][1])/l;j+=k*a[f][g][1]}o[g]=m-=i?j/i*l:0,m<n&&(n=m)}for(g=0;g<d;++g)o[g]-=n;return o},expand:function(a){var b=a.length,c=a[0].length,d=1/b,e,f,g,h=[];for(f=0;f<c;++f){for(e=0,g=0;e<b;e++)g+=a[e][f][1];if(g)for(e=0;e<b;e++)a[e][f][1]/=g;else for(e=0;e<b;e++)a[e][f][1]=d}for(f=0;f<c;++f)h[f]=0;return h},zero:function(a){var b=-1,c=a[0].length,d=[];while(++b<c)d[b]=0;return d}};d3.layout.histogram=function(){function e(e,f){var g=[],h=e.map(b,this),i=c.call(this,h,f),j=d.call(this,i,h,f),k,f=-1,l=h.length,m=j.length-1,n=a?1:1/l,o;while(++f<m)k=g[f]=[],k.dx=j[f+1]-(k.x=j[f]),k.y=0;f=-1;while(++f<l)o=h[f],o>=i[0]&&o<=i[1]&&(k=g[d3.bisect(j,o,1,m)-1],k.y+=n,k.push(e[f]));return g}var a=!0,b=Number,c=E,d=C;e.value=function(a){if(!arguments.length)return b;b=a;return e},e.range=function(a){if(!arguments.length)return c;c=d3.functor(a);return e},e.bins=function(a){if(!arguments.length)return d;d=typeof a=="number"?function(b){return D(b,a)}:d3.functor(a);return e},e.frequency=function(b){if(!arguments.length)return a;a=!!b;return e};return e},d3.layout.hierarchy=function(){function g(a){var b=[];e(a,0,b);return b}function f(a,b){var d=a.children,e=0;if(d){var h=-1,i=d.length,j=b+1;while(++h<i)e+=f(d[h],j)}else c&&(e=c.call(g,K?a:a.data,b));c&&(a.value=e);return e}function e(f,h,i){var j=b.call(g,f,h),k=K?f:{data:f};k.depth=h,i.push(k);if(j){var l=-1,m=j.length,n=k.children=[],o=0,p=h+1;while(++l<m)d=e(j[l],p,i),d.parent=k,n.push(d),o+=d.value;a&&n.sort(a),c&&(k.value=o)}else c&&(k.value=c.call(g,f,h));return k}var a=I,b=G,c=H;g.sort=function(b){if(!arguments.length)return a;a=b;return g},g.children=function(a){if(!arguments.length)return b;b=a;return g},g.value=function(a){if(!arguments.length)return c;c=a;return g},g.revalue=function(a){f(a,0);return a};return g};var K=!1;d3.layout.pack=function(){function c(c,d){var e=a.call(this,c,d),f=e[0];f.x=0,f.y=0,S(f);var g=b[0],h=b[1],i=1/Math.max(2*f.r/g,2*f.r/h);T(f,g/2,h/2,i);return e}var a=d3.layout.hierarchy().sort(L),b=[1,1];c.size=function(a){if(!arguments.length)return b;b=a;return c};return F(c,a)},d3.layout.cluster=function(){function d(d,e){var f=a.call(this,d,e),g=f[0],h,i=0,j,k;be(g,function(a){a.children?(a.x=W(a.children),a.y=V(a.children)):(a.x=h?i+=b(a,h):0,a.y=0,h=a)});var l=X(g),m=Y(g),n=l.x-b(l,m)/2,o=m.x+b(m,l)/2;be(g,function(a){a.x=(a.x-n)/(o-n)*c[0],a.y=(1-a.y/g.y)*c[1]});return f}var a=d3.layout.hierarchy().sort(null).value(null),b=Z,c=[1,1];d.separation=function(a){if(!arguments.length)return b;b=a;return d},d.size=function(a){if(!arguments.length)return c;c=a;return d};return F(d,a)},d3.layout.tree=function(){function d(d,e){function j(a,c,d){if(c){var e=a,f=a,g=c,h=a.parent.children[0],i=e._tree.mod,j=f._tree.mod,k=g._tree.mod,l=h._tree.mod,m;while(g=_(g),e=$(e),g&&e)h=$(h),f=_(f),f._tree.ancestor=a,m=g._tree.prelim+k-e._tree.prelim-i+b(g,e),m>0&&(bg(bh(g,a,d),a,m),i+=m,j+=m),k+=g._tree.mod,i+=e._tree.mod,l+=h._tree.mod,j+=f._tree.mod;g&&!_(f)&&(f._tree.thread=g,f._tree.mod+=k-j),e&&!$(h)&&(h._tree.thread=e,h._tree.mod+=i-l,d=a)}return d}function i(a,b){a.x=a._tree.prelim+b;var c=a.children;if(c){var d=-1,e=c.length;b+=a._tree.mod;while(++d<e)i(c[d],b)}}function h(a,c){var d=a.children,e=a._tree;if(d){var f=d.length,g=d[0],i,k=g,l,m=-1;while(++m<f)l=d[m],h(l,i),k=j(l,i,k),i=l;bf(a);var n=.5*(g._tree.prelim+l._tree.prelim);c?(e.prelim=c._tree.prelim+b(a,c),e.mod=e.prelim-n):e.prelim=n}else c&&(e.prelim=c._tree.prelim+b(a,c))}var f=a.call(this,d,e),g=f[0];be(g,function(a,b){a._tree={ancestor:a,prelim:0,mod:0,change:0,shift:0,number:b?b._tree.number+1:0}}),h(g),i(g,-g._tree.prelim);var k=ba(g,bc),l=ba(g,bb),m=ba(g,bd),n=k.x-b(k,l)/2,o=l.x+b(l,k)/2,p=m.depth||1;be(g,function(a){a.x=(a.x-n)/(o-n)*c[0],a.y=a.depth/p*c[1],delete a._tree});return f}var a=d3.layout.hierarchy().sort(null).value(null),b=Z,c=[1,1];d.separation=function(a){if(!arguments.length)return b;b=a;return d},d.size=function(a){if(!arguments.length)return c;c=a;return d};return F(d,a)},d3.layout.treemap=function(){function n(b){var d=g||a(b),e=d[0];e.x=0,e.y=0,e.dx=c[0],e.dy=c[1],g&&a.revalue(e),i([e],e.dx*e.dy/e.value),(g?k:j)(e),f&&(g=d);return d}function m(a,c,d,e){var f=-1,g=a.length,h=d.x,i=d.y,j=c?b(a.area/c):0,k;if(c==d.dx){if(e||j>d.dy)j=d.dy;while(++f<g)k=a[f],k.x=h,k.y=i,k.dy=j,h+=k.dx=j?b(k.area/j):0;k.z=!0,k.dx+=d.x+d.dx-h,d.y+=j,d.dy-=j}else{if(e||j>d.dx)j=d.dx;while(++f<g)k=a[f],k.x=h,k.y=i,k.dx=j,i+=k.dy=j?b(k.area/j):0;k.z=!1,k.dy+=d.y+d.dy-i,d.x+=j,d.dx-=j}}function l(a,b){var c=a.area,d,e=0,f=Infinity,g=-1,i=a.length;while(++g<i){if(!(d=a[g].area))continue;d<f&&(f=d),d>e&&(e=d)}c*=c,b*=b;return c?Math.max(b*e*h/c,c/(b*f*h)):Infinity}function k(a){if(!!a.children){var b=e(a),c=a.children.slice(),d,f=[];i(c,b.dx*b.dy/a.value),f.area=0;while(d=c.pop())f.push(d),f.area+=d.area,d.z!=null&&(m(f,d.z?b.dx:b.dy,b,!c.length),f.length=f.area=0);a.children.forEach(k)}}function j(a){if(!!a.children){var b=e(a),c=[],d=a.children.slice(),f,g=Infinity,h,k=Math.min(b.dx,b.dy),n;i(d,b.dx*b.dy/a.value),c.area=0;while((n=d.length)>0)c.push(f=d[n-1]),c.area+=f.area,(h=l(c,k))<=g?(d.pop(),g=h):(c.area-=c.pop().area,m(c,k,b,!1),k=Math.min(b.dx,b.dy),c.length=c.area=0,g=Infinity);c.length&&(m(c,k,b,!0),c.length=c.area=0),a.children.forEach(j)}}function i(a,b){var c=-1,d=a.length,e,f;while(++c<d)f=(e=a[c]).value*(b<0?0:b),e.area=isNaN(f)||f<=0?0:f}var a=d3.layout.hierarchy(),b=Math.round,c=[1,1],d=null,e=bi,f=!1,g,h=.5*(1+Math.sqrt(5));n.size=function(a){if(!arguments.length)return c;c=a;return n},n.padding=function(a){function c(b){return bj(b,a)}function b(b){var c=a.call(n,b,b.depth);return c==null?bi(b):bj(b,typeof c=="number"?[c,c,c,c]:c)}if(!arguments.length)return d;var f;e=(d=a)==null?bi:(f=typeof a)==="function"?b:f==="number"?(a=[a,a,a,a],c):c;return n},n.round=function(a){if(!arguments.length)return b!=Number;b=a?Math.round:Number;return n},n.sticky=function(a){if(!arguments.length)return f;f=a,g=null;return n},n.ratio=function(a){if(!arguments.length)return h;h=a;return n};return F(n,a)}})() <ide>\ No newline at end of file <add>(function(){function bj(a,b){var c=a.x+b[3],d=a.y+b[0],e=a.dx-b[1]-b[3],f=a.dy-b[0]-b[2];e<0&&(c+=e/2,e=0),f<0&&(d+=f/2,f=0);return{x:c,y:d,dx:e,dy:f}}function bi(a){return{x:a.x,y:a.y,dx:a.dx,dy:a.dy}}function bh(a,b,c){return a._tree.ancestor.parent==b.parent?a._tree.ancestor:c}function bg(a,b,c){a=a._tree,b=b._tree;var d=c/(b.number-a.number);a.change+=d,b.change-=d,b.shift+=c,b.prelim+=c,b.mod+=c}function bf(a){var b=0,c=0,d=a.children,e=d.length,f;while(--e>=0)f=d[e]._tree,f.prelim+=b,f.mod+=b,b+=f.shift+(c+=f.change)}function be(a,b){function c(a,d){var e=a.children;if(e){var f,g=null,h=-1,i=e.length;while(++h<i)f=e[h],c(f,g),g=f}b(a,d)}c(a,null)}function bd(a,b){return a.depth-b.depth}function bc(a,b){return b.x-a.x}function bb(a,b){return a.x-b.x}function ba(a,b){var c=a.children;if(c){var d,e=c.length,f=-1;while(++f<e)b(d=ba(c[f],b),a)>0&&(a=d)}return a}function _(a){return a.children?a.children[a.children.length-1]:a._tree.thread}function $(a){return a.children?a.children[0]:a._tree.thread}function Z(a,b){return a.parent==b.parent?1:2}function Y(a){var b=a.children;return b?Y(b[b.length-1]):a}function X(a){var b=a.children;return b?X(b[0]):a}function W(a){return a.reduce(function(a,b){return a+b.x},0)/a.length}function V(a){return 1+d3.max(a,function(a){return a.y})}function U(a,b,c){var d=b.r+c.r,e=a.r+c.r,f=b.x-a.x,g=b.y-a.y,h=Math.sqrt(f*f+g*g),i=(e*e+h*h-d*d)/(2*e*h),j=Math.acos(i),k=i*e,l=Math.sin(j)*e;f/=h,g/=h,c.x=a.x+k*f+l*g,c.y=a.y+k*g-l*f}function T(a,b,c,d){var e=a.children;a.x=b+=d*a.x,a.y=c+=d*a.y,a.r*=d;if(e){var f=-1,g=e.length;while(++f<g)T(e[f],b,c,d)}}function S(a){var b=a.children;b?(b.forEach(S),a.r=P(b)):a.r=Math.sqrt(a.value)}function R(a){delete a._pack_next,delete a._pack_prev}function Q(a){a._pack_next=a._pack_prev=a}function P(a){function l(a){b=Math.min(a.x-a.r,b),c=Math.max(a.x+a.r,c),d=Math.min(a.y-a.r,d),e=Math.max(a.y+a.r,e)}var b=Infinity,c=-Infinity,d=Infinity,e=-Infinity,f=a.length,g,h,i,j,k;a.forEach(Q),g=a[0],g.x=-g.r,g.y=0,l(g);if(f>1){h=a[1],h.x=h.r,h.y=0,l(h);if(f>2){i=a[2],U(g,h,i),l(i),M(g,i),g._pack_prev=i,M(i,h),h=g._pack_next;for(var m=3;m<f;m++){U(g,h,i=a[m]);var n=0,o=1,p=1;for(j=h._pack_next;j!==h;j=j._pack_next,o++)if(O(j,i)){n=1;break}if(n==1)for(k=g._pack_prev;k!==j._pack_prev;k=k._pack_prev,p++)if(O(k,i)){p<o&&(n=-1,j=k);break}n==0?(M(g,i),h=i,l(i)):n>0?(N(g,j),h=j,m--):(N(j,h),g=j,m--)}}}var q=(b+c)/2,r=(d+e)/2,s=0;for(var m=0;m<f;m++){var t=a[m];t.x-=q,t.y-=r,s=Math.max(s,t.r+Math.sqrt(t.x*t.x+t.y*t.y))}a.forEach(R);return s}function O(a,b){var c=b.x-a.x,d=b.y-a.y,e=a.r+b.r;return e*e-c*c-d*d>.001}function N(a,b){a._pack_next=b,b._pack_prev=a}function M(a,b){var c=a._pack_next;a._pack_next=b,b._pack_prev=a,b._pack_next=c,c._pack_prev=b}function L(a,b){return a.value-b.value}function J(a){return d3.merge(a.map(function(a){return(a.children||[]).map(function(b){return{source:a,target:b}})}))}function I(a,b){return b.value-a.value}function H(a){return a.value}function G(a){return a.children}function F(a,b){a.sort=d3.rebind(a,b.sort),a.children=d3.rebind(a,b.children),a.links=J,a.value=d3.rebind(a,b.value),a.nodes=function(b){K=!0;return(a.nodes=a)(b)};return a}function E(a){return[d3.min(a),d3.max(a)]}function D(a,b){var c=-1,d=+a[0],e=(a[1]-d)/b,f=[];while(++c<=b)f[c]=e*c+d;return f}function C(a,b){return D(a,Math.ceil(Math.log(b.length)/Math.LN2+1))}function B(a,b){return a+b[1]}function A(a){return a.reduce(B,0)}function z(a){var b=1,c=0,d=a[0][1],e,f=a.length;for(;b<f;++b)(e=a[b][1])>d&&(c=b,d=e);return c}function w(a,b,c){a.y0=b,a.y=c}function v(a){return a.y}function u(a){return a.x}function t(a){return 1}function s(a){return 20}function r(a){var b=0,c=0;a.count=0;if(!a.leaf){var d=a.nodes,e=d.length,f=-1,g;while(++f<e){g=d[f];if(g==null)continue;r(g),a.count+=g.count,b+=g.count*g.cx,c+=g.count*g.cy}}a.point&&(a.leaf||(a.point.x+=Math.random()-.5,a.point.y+=Math.random()-.5),a.count++,b+=a.point.x,c+=a.point.y),a.cx=b/a.count,a.cy=c/a.count}function q(){d3.event.stopPropagation(),d3.event.preventDefault()}function p(){i&&(q(),i=!1)}function o(){!f||(g&&(i=!0,q()),d3.event.type==="mouseup"&&n(),f.fixed=!1,e=h=f=j=null)}function n(){if(!!f){var a=j.parentNode;if(!a){f.fixed=!1,h=f=j=null;return}var b=m(a);g=!0,f.px=b[0]-h[0],f.py=b[1]-h[1],q(),e.resume()}}function m(a){return d3.event.touches?d3.svg.touches(a)[0]:d3.svg.mouse(a)}function l(a){a!==f&&(a.fixed=!1)}function k(a){a.fixed=!0}function c(a,c){if(a===c)return a;var d=b(a),e=b(c),f=d.pop(),g=e.pop(),h=null;while(f===g)h=f,f=d.pop(),g=e.pop();return h}function b(a){var b=[],c=a.parent;while(c!=null)b.push(a),a=c,c=c.parent;b.push(a);return b}function a(a){var b=a.source,d=a.target,e=c(b,d),f=[b];while(b!==e)b=b.parent,f.push(b);var g=f.length;while(d!==e)f.splice(g,0,d),d=d.parent;return f}d3.layout={},d3.layout.bundle=function(){return function(b){var c=[],d=-1,e=b.length;while(++d<e)c.push(a(b[d]));return c}},d3.layout.chord=function(){function k(){b.sort(function(a,b){return i(a.target.value,b.target.value)})}function j(){var a={},j=[],l=d3.range(e),m=[],n,o,p,q,r;b=[],c=[],n=0,q=-1;while(++q<e){o=0,r=-1;while(++r<e)o+=d[q][r];j.push(o),m.push(d3.range(e)),n+=o}g&&l.sort(function(a,b){return g(j[a],j[b])}),h&&m.forEach(function(a,b){a.sort(function(a,c){return h(d[b][a],d[b][c])})}),n=(2*Math.PI-f*e)/n,o=0,q=-1;while(++q<e){p=o,r=-1;while(++r<e){var s=l[q],t=m[q][r],u=d[s][t];a[s+"-"+t]={index:s,subindex:t,startAngle:o,endAngle:o+=u*n,value:u}}c.push({index:s,startAngle:p,endAngle:o,value:(o-p)/n}),o+=f}q=-1;while(++q<e){r=q-1;while(++r<e){var v=a[q+"-"+r],w=a[r+"-"+q];(v.value||w.value)&&b.push(v.value<w.value?{source:w,target:v}:{source:v,target:w})}}i&&k()}var a={},b,c,d,e,f=0,g,h,i;a.matrix=function(f){if(!arguments.length)return d;e=(d=f)&&d.length,b=c=null;return a},a.padding=function(d){if(!arguments.length)return f;f=d,b=c=null;return a},a.sortGroups=function(d){if(!arguments.length)return g;g=d,b=c=null;return a},a.sortSubgroups=function(c){if(!arguments.length)return h;h=c,b=null;return a},a.sortChords=function(c){if(!arguments.length)return i;i=c,b&&k();return a},a.chords=function(){b||j();return b},a.groups=function(){c||j();return c};return a},d3.layout.force=function(){function G(b,c){var d=m(this.parentNode);(f=b).fixed=!0,g=!1,j=this,e=a,h=[d[0]-b.x,d[1]-b.y],q()}function F(){var a=A.length,e=B.length,f=d3.geom.quadtree(A),g,h,j,k,l,m,n;for(g=0;g<e;++g){h=B[g],j=h.source,k=h.target,m=k.x-j.x,n=k.y-j.y;if(l=m*m+n*n)l=d*D[g]*((l=Math.sqrt(l))-C[g])/l,m*=l,n*=l,k.x-=m,k.y-=n,j.x+=m,j.y+=n}var o=d*x;m=c[0]/2,n=c[1]/2,g=-1;while(++g<a)h=A[g],h.x+=(m-h.x)*o,h.y+=(n-h.y)*o;r(f);var p=d*w;g=-1;while(++g<a)f.visit(E(A[g],p));g=-1;while(++g<a)h=A[g],h.fixed?(h.x=h.px,h.y=h.py):(h.x-=(h.px-(h.px=h.x))*i,h.y-=(h.py-(h.py=h.y))*i);b.tick.dispatch({type:"tick",alpha:d});return(d*=.99)<.005}function E(a,b){return function(c,d,e,f,g){if(c.point!==a){var h=c.cx-a.x,i=c.cy-a.y,j=1/Math.sqrt(h*h+i*i);if((f-d)*j<y){var k=b*c.count*j*j;a.x+=h*k,a.y+=i*k;return!0}if(c.point&&isFinite(j)){var k=b*j*j;a.x+=h*k,a.y+=i*k}}}}var a={},b=d3.dispatch("tick"),c=[1,1],d,i=.9,u=s,v=t,w=-30,x=.1,y=.8,z,A=[],B=[],C,D;a.on=function(c,d){b[c].add(d);return a},a.nodes=function(b){if(!arguments.length)return A;A=b;return a},a.links=function(b){if(!arguments.length)return B;B=b;return a},a.size=function(b){if(!arguments.length)return c;c=b;return a},a.linkDistance=function(b){if(!arguments.length)return u;u=d3.functor(b);return a},a.distance=a.linkDistance,a.linkStrength=function(b){if(!arguments.length)return v;v=d3.functor(b);return a},a.friction=function(b){if(!arguments.length)return i;i=b;return a},a.charge=function(b){if(!arguments.length)return w;w=b;return a},a.gravity=function(b){if(!arguments.length)return x;x=b;return a},a.theta=function(b){if(!arguments.length)return y;y=b;return a},a.start=function(){function l(){if(!i){i=[];for(d=0;d<e;++d)i[d]=[];for(d=0;d<f;++d){var a=B[d];i[a.source.index].push(a.target),i[a.target.index].push(a.source)}}return i[b]}function k(a,c){var d=l(b),e=-1,f=d.length,g;while(++e<f)if(!isNaN(g=d[e][a]))return g;return Math.random()*c}var b,d,e=A.length,f=B.length,g=c[0],h=c[1],i,j;for(b=0;b<e;++b)(j=A[b]).index=b;C=[],D=[];for(b=0;b<f;++b)j=B[b],typeof j.source=="number"&&(j.source=A[j.source]),typeof j.target=="number"&&(j.target=A[j.target]),C[b]=u.call(this,j,b),D[b]=v.call(this,j,b);for(b=0;b<e;++b)j=A[b],isNaN(j.x)&&(j.x=k("x",g)),isNaN(j.y)&&(j.y=k("y",h)),isNaN(j.px)&&(j.px=j.x),isNaN(j.py)&&(j.py=j.y);return a.resume()},a.resume=function(){d=.1,d3.timer(F);return a},a.stop=function(){d=0;return a},a.drag=function(){this.on("mouseover.force",k).on("mouseout.force",l).on("mousedown.force",G).on("touchstart.force",G),d3.select(window).on("mousemove.force",n).on("touchmove.force",n).on("mouseup.force",o,!0).on("touchend.force",o,!0).on("click.force",p,!0);return a};return a};var e,f,g,h,i,j;d3.layout.partition=function(){function e(e,f){var g=a.call(this,e,f);c(g[0],0,b[0],b[1]/d(g[0]));return g}function d(a){var b=a.children,c=0;if(b){var e=-1,f=b.length;while(++e<f)c=Math.max(c,d(b[e]))}return 1+c}function c(a,b,d,e){var f=a.children;a.x=b,a.y=a.depth*e,a.dx=d,a.dy=e;if(f){var g=-1,h=f.length,i,j;d=a.value===0?0:d/a.value;while(++g<h)c(i=f[g],b,j=i.value*d,e),b+=j}}var a=d3.layout.hierarchy(),b=[1,1];e.size=function(a){if(!arguments.length)return b;b=a;return e};return F(e,a)},d3.layout.pie=function(){function f(f,g){var h=+(typeof c=="function"?c.apply(this,arguments):c),i=(typeof e=="function"?e.apply(this,arguments):e)-c,j=d3.range(f.length);b!=null&&j.sort(function(a,c){return b(f[a],f[c])});var k=f.map(a);i/=k.reduce(function(a,b){return a+b},0);var l=j.map(function(a){return{data:f[a],value:d=k[a],startAngle:h,endAngle:h+=d*i}});return f.map(function(a,b){return l[j[b]]})}var a=Number,b=null,c=0,e=2*Math.PI;f.value=function(b){if(!arguments.length)return a;a=b;return f},f.sort=function(a){if(!arguments.length)return b;b=a;return f},f.startAngle=function(a){if(!arguments.length)return c;c=a;return f},f.endAngle=function(a){if(!arguments.length)return e;e=a;return f};return f},d3.layout.stack=function(){function g(h,i){var j=h.map(function(b,c){return a.call(g,b,c)}),k=j.map(function(a,b){return a.map(function(a,b){return[e.call(g,a,b),f.call(g,a,b)]})}),l=b.call(g,k,i);j=d3.permute(j,l),k=d3.permute(k,l);var m=c.call(g,k,i),n=j.length,o=j[0].length,p,q,r;for(q=0;q<o;++q){d.call(g,j[0][q],r=m[q],k[0][q][1]);for(p=1;p<n;++p)d.call(g,j[p][q],r+=k[p-1][q][1],k[p][q][1])}return h}var a=Object,b=x["default"],c=y.zero,d=w,e=u,f=v;g.values=function(b){if(!arguments.length)return a;a=b;return g},g.order=function(a){if(!arguments.length)return b;b=typeof a=="function"?a:x[a];return g},g.offset=function(a){if(!arguments.length)return c;c=typeof a=="function"?a:y[a];return g},g.x=function(a){if(!arguments.length)return e;e=a;return g},g.y=function(a){if(!arguments.length)return f;f=a;return g},g.out=function(a){if(!arguments.length)return d;d=a;return g};return g};var x={"inside-out":function(a){var b=a.length,c,d,e=a.map(z),f=a.map(A),g=d3.range(b).sort(function(a,b){return e[a]-e[b]}),h=0,i=0,j=[],k=[];for(c=0;c<b;++c)d=g[c],h<i?(h+=f[d],j.push(d)):(i+=f[d],k.push(d));return k.reverse().concat(j)},reverse:function(a){return d3.range(a.length).reverse()},"default":function(a){return d3.range(a.length)}},y={silhouette:function(a){var b=a.length,c=a[0].length,d=[],e=0,f,g,h,i=[];for(g=0;g<c;++g){for(f=0,h=0;f<b;f++)h+=a[f][g][1];h>e&&(e=h),d.push(h)}for(g=0;g<c;++g)i[g]=(e-d[g])/2;return i},wiggle:function(a){var b=a.length,c=a[0],d=c.length,e=0,f,g,h,i,j,k,l,m,n,o=[];o[0]=m=n=0;for(g=1;g<d;++g){for(f=0,i=0;f<b;++f)i+=a[f][g][1];for(f=0,j=0,l=c[g][0]-c[g-1][0];f<b;++f){for(h=0,k=(a[f][g][1]-a[f][g-1][1])/(2*l);h<f;++h)k+=(a[h][g][1]-a[h][g-1][1])/l;j+=k*a[f][g][1]}o[g]=m-=i?j/i*l:0,m<n&&(n=m)}for(g=0;g<d;++g)o[g]-=n;return o},expand:function(a){var b=a.length,c=a[0].length,d=1/b,e,f,g,h=[];for(f=0;f<c;++f){for(e=0,g=0;e<b;e++)g+=a[e][f][1];if(g)for(e=0;e<b;e++)a[e][f][1]/=g;else for(e=0;e<b;e++)a[e][f][1]=d}for(f=0;f<c;++f)h[f]=0;return h},zero:function(a){var b=-1,c=a[0].length,d=[];while(++b<c)d[b]=0;return d}};d3.layout.histogram=function(){function e(e,f){var g=[],h=e.map(b,this),i=c.call(this,h,f),j=d.call(this,i,h,f),k,f=-1,l=h.length,m=j.length-1,n=a?1:1/l,o;while(++f<m)k=g[f]=[],k.dx=j[f+1]-(k.x=j[f]),k.y=0;f=-1;while(++f<l)o=h[f],o>=i[0]&&o<=i[1]&&(k=g[d3.bisect(j,o,1,m)-1],k.y+=n,k.push(e[f]));return g}var a=!0,b=Number,c=E,d=C;e.value=function(a){if(!arguments.length)return b;b=a;return e},e.range=function(a){if(!arguments.length)return c;c=d3.functor(a);return e},e.bins=function(a){if(!arguments.length)return d;d=typeof a=="number"?function(b){return D(b,a)}:d3.functor(a);return e},e.frequency=function(b){if(!arguments.length)return a;a=!!b;return e};return e},d3.layout.hierarchy=function(){function g(a){var b=[];e(a,0,b);return b}function f(a,b){var d=a.children,e=0;if(d){var h=-1,i=d.length,j=b+1;while(++h<i)e+=f(d[h],j)}else c&&(e=c.call(g,K?a:a.data,b));c&&(a.value=e);return e}function e(f,h,i){var j=b.call(g,f,h),k=K?f:{data:f};k.depth=h,i.push(k);if(j){var l=-1,m=j.length,n=k.children=[],o=0,p=h+1;while(++l<m)d=e(j[l],p,i),d.parent=k,n.push(d),o+=d.value;a&&n.sort(a),c&&(k.value=o)}else c&&(k.value=c.call(g,f,h));return k}var a=I,b=G,c=H;g.sort=function(b){if(!arguments.length)return a;a=b;return g},g.children=function(a){if(!arguments.length)return b;b=a;return g},g.value=function(a){if(!arguments.length)return c;c=a;return g},g.revalue=function(a){f(a,0);return a};return g};var K=!1;d3.layout.pack=function(){function c(c,d){var e=a.call(this,c,d),f=e[0];f.x=0,f.y=0,S(f);var g=b[0],h=b[1],i=1/Math.max(2*f.r/g,2*f.r/h);T(f,g/2,h/2,i);return e}var a=d3.layout.hierarchy().sort(L),b=[1,1];c.size=function(a){if(!arguments.length)return b;b=a;return c};return F(c,a)},d3.layout.cluster=function(){function d(d,e){var f=a.call(this,d,e),g=f[0],h,i=0,j,k;be(g,function(a){a.children?(a.x=W(a.children),a.y=V(a.children)):(a.x=h?i+=b(a,h):0,a.y=0,h=a)});var l=X(g),m=Y(g),n=l.x-b(l,m)/2,o=m.x+b(m,l)/2;be(g,function(a){a.x=(a.x-n)/(o-n)*c[0],a.y=(1-a.y/g.y)*c[1]});return f}var a=d3.layout.hierarchy().sort(null).value(null),b=Z,c=[1,1];d.separation=function(a){if(!arguments.length)return b;b=a;return d},d.size=function(a){if(!arguments.length)return c;c=a;return d};return F(d,a)},d3.layout.tree=function(){function d(d,e){function j(a,c,d){if(c){var e=a,f=a,g=c,h=a.parent.children[0],i=e._tree.mod,j=f._tree.mod,k=g._tree.mod,l=h._tree.mod,m;while(g=_(g),e=$(e),g&&e)h=$(h),f=_(f),f._tree.ancestor=a,m=g._tree.prelim+k-e._tree.prelim-i+b(g,e),m>0&&(bg(bh(g,a,d),a,m),i+=m,j+=m),k+=g._tree.mod,i+=e._tree.mod,l+=h._tree.mod,j+=f._tree.mod;g&&!_(f)&&(f._tree.thread=g,f._tree.mod+=k-j),e&&!$(h)&&(h._tree.thread=e,h._tree.mod+=i-l,d=a)}return d}function i(a,b){a.x=a._tree.prelim+b;var c=a.children;if(c){var d=-1,e=c.length;b+=a._tree.mod;while(++d<e)i(c[d],b)}}function h(a,c){var d=a.children,e=a._tree;if(d){var f=d.length,g=d[0],i,k=g,l,m=-1;while(++m<f)l=d[m],h(l,i),k=j(l,i,k),i=l;bf(a);var n=.5*(g._tree.prelim+l._tree.prelim);c?(e.prelim=c._tree.prelim+b(a,c),e.mod=e.prelim-n):e.prelim=n}else c&&(e.prelim=c._tree.prelim+b(a,c))}var f=a.call(this,d,e),g=f[0];be(g,function(a,b){a._tree={ancestor:a,prelim:0,mod:0,change:0,shift:0,number:b?b._tree.number+1:0}}),h(g),i(g,-g._tree.prelim);var k=ba(g,bc),l=ba(g,bb),m=ba(g,bd),n=k.x-b(k,l)/2,o=l.x+b(l,k)/2,p=m.depth||1;be(g,function(a){a.x=(a.x-n)/(o-n)*c[0],a.y=a.depth/p*c[1],delete a._tree});return f}var a=d3.layout.hierarchy().sort(null).value(null),b=Z,c=[1,1];d.separation=function(a){if(!arguments.length)return b;b=a;return d},d.size=function(a){if(!arguments.length)return c;c=a;return d};return F(d,a)},d3.layout.treemap=function(){function n(b){var d=g||a(b),e=d[0];e.x=0,e.y=0,e.dx=c[0],e.dy=c[1],g&&a.revalue(e),i([e],e.dx*e.dy/e.value),(g?k:j)(e),f&&(g=d);return d}function m(a,c,d,e){var f=-1,g=a.length,h=d.x,i=d.y,j=c?b(a.area/c):0,k;if(c==d.dx){if(e||j>d.dy)j=d.dy;while(++f<g)k=a[f],k.x=h,k.y=i,k.dy=j,h+=k.dx=j?b(k.area/j):0;k.z=!0,k.dx+=d.x+d.dx-h,d.y+=j,d.dy-=j}else{if(e||j>d.dx)j=d.dx;while(++f<g)k=a[f],k.x=h,k.y=i,k.dx=j,i+=k.dy=j?b(k.area/j):0;k.z=!1,k.dy+=d.y+d.dy-i,d.x+=j,d.dx-=j}}function l(a,b){var c=a.area,d,e=0,f=Infinity,g=-1,i=a.length;while(++g<i){if(!(d=a[g].area))continue;d<f&&(f=d),d>e&&(e=d)}c*=c,b*=b;return c?Math.max(b*e*h/c,c/(b*f*h)):Infinity}function k(a){if(!!a.children){var b=e(a),c=a.children.slice(),d,f=[];i(c,b.dx*b.dy/a.value),f.area=0;while(d=c.pop())f.push(d),f.area+=d.area,d.z!=null&&(m(f,d.z?b.dx:b.dy,b,!c.length),f.length=f.area=0);a.children.forEach(k)}}function j(a){if(!!a.children){var b=e(a),c=[],d=a.children.slice(),f,g=Infinity,h,k=Math.min(b.dx,b.dy),n;i(d,b.dx*b.dy/a.value),c.area=0;while((n=d.length)>0)c.push(f=d[n-1]),c.area+=f.area,(h=l(c,k))<=g?(d.pop(),g=h):(c.area-=c.pop().area,m(c,k,b,!1),k=Math.min(b.dx,b.dy),c.length=c.area=0,g=Infinity);c.length&&(m(c,k,b,!0),c.length=c.area=0),a.children.forEach(j)}}function i(a,b){var c=-1,d=a.length,e,f;while(++c<d)f=(e=a[c]).value*(b<0?0:b),e.area=isNaN(f)||f<=0?0:f}var a=d3.layout.hierarchy(),b=Math.round,c=[1,1],d=null,e=bi,f=!1,g,h=.5*(1+Math.sqrt(5));n.size=function(a){if(!arguments.length)return c;c=a;return n},n.padding=function(a){function c(b){return bj(b,a)}function b(b){var c=a.call(n,b,b.depth);return c==null?bi(b):bj(b,typeof c=="number"?[c,c,c,c]:c)}if(!arguments.length)return d;var f;e=(d=a)==null?bi:(f=typeof a)==="function"?b:f==="number"?(a=[a,a,a,a],c):c;return n},n.round=function(a){if(!arguments.length)return b!=Number;b=a?Math.round:Number;return n},n.sticky=function(a){if(!arguments.length)return f;f=a,g=null;return n},n.ratio=function(a){if(!arguments.length)return h;h=a;return n};return F(n,a)}})() <ide>\ No newline at end of file
2
PHP
PHP
remove unused classes
bb9e851d19ac5c4a5bccabd0594405ae254e7b5e
<ide><path>tests/TestCase/TestSuite/ControllerTestCaseTest.php <ide> use Cake\TestSuite\Reporter\HtmlReporter; <ide> use Cake\TestSuite\TestCase; <ide> <del>/** <del> * AppController class <del> * <del> */ <del>class AppController extends Controller { <del> <del>/** <del> * helpers property <del> * <del> * @var array <del> */ <del> public $helpers = array('Html'); <del> <del>/** <del> * components property <del> * <del> * @var array <del> */ <del> public $components = array('Cookie'); <del>} <del> <del> <del>/** <del> * ControllerTestCaseTest controller <del> * <del> */ <del>class ControllerTestCaseTestController extends AppController { <del> <del>} <del> <ide> /** <ide> * ControllerTestCaseTest <ide> *
1
PHP
PHP
add implementation for path method
9582a6d4404c301230cb32462db66f56b7e0507d
<ide><path>src/Illuminate/Contracts/Pagination/Paginator.php <ide> public function hasPages(); <ide> */ <ide> public function hasMorePages(); <ide> <add> /** <add> * Get the base path <add> * <add> * @return string|null <add> */ <add> public function path(); <add> <ide> /** <ide> * Determine if the list of items is empty or not. <ide> * <ide><path>src/Illuminate/Pagination/AbstractPaginator.php <ide> public function url($page) <ide> $parameters = array_merge($this->query, $parameters); <ide> } <ide> <del> return $this->path <del> .(Str::contains($this->path, '?') ? '&' : '?') <add> return $this->path() <add> .(Str::contains($this->path(), '?') ? '&' : '?') <ide> .Arr::query($parameters) <ide> .$this->buildFragment(); <ide> } <ide> public function setPath($path) <ide> return $this; <ide> } <ide> <add> /** <add> * Get the base path. <add> * <add> * @return string|null <add> */ <add> public function path() <add> { <add> return $this->path; <add> } <add> <ide> /** <ide> * Set the number of links to display on each side of current page link. <ide> * <ide><path>src/Illuminate/Pagination/LengthAwarePaginator.php <ide> public function toArray() <ide> 'last_page' => $this->lastPage(), <ide> 'last_page_url' => $this->url($this->lastPage()), <ide> 'next_page_url' => $this->nextPageUrl(), <del> 'path' => $this->path, <add> 'path' => $this->path(), <ide> 'per_page' => $this->perPage(), <ide> 'prev_page_url' => $this->previousPageUrl(), <ide> 'to' => $this->lastItem(), <ide><path>src/Illuminate/Pagination/Paginator.php <ide> public function toArray() <ide> 'first_page_url' => $this->url(1), <ide> 'from' => $this->firstItem(), <ide> 'next_page_url' => $this->nextPageUrl(), <del> 'path' => $this->path, <add> 'path' => $this->path(), <ide> 'per_page' => $this->perPage(), <ide> 'prev_page_url' => $this->previousPageUrl(), <ide> 'to' => $this->lastItem(),
4
Text
Text
add upcoming breaking change
fb39e322ea49f31fab7f42e5dba9883fc68aa3ae
<ide><path>CHANGELOG.md <add># NOTICE: Pending Breaking Change <add> <add>The next 1.3.0 release candidate (1.3.0-rc.2) will contain a perf-related change that is likely to <add>introduce breakages in some applications. The change will affect filters and function call <add>expressions, and will not call the function if the variables passed to the function are primitive <add>values and have not changed since the last digest loop. <add> <add>Example: <add> <add>```html <add>//date filter would only be called if the 'timeCreated' property has changed <add><span ng-bind="timeCreated|date"></span> <add> <add>//custom filter would break if depends on data changed by user other than 'cost' <add><span ng-bind="cost|i18nLocalizer"> <add>``` <add> <add> <ide> <a name="1.3.0-rc.1"></a> <ide> # 1.3.0-rc.1 backyard-atomicity (2014-09-09) <ide>
1
PHP
PHP
fix timestamps in mysql
568104a51d4696ea50c5ce3623b2653c1e6566b2
<ide><path>src/Illuminate/Database/Schema/Grammars/MySqlGrammar.php <ide> protected function typeTime(Fluent $column) <ide> */ <ide> protected function typeTimestamp(Fluent $column) <ide> { <add> if ( ! $column->nullable) return 'timestamp default 0'; <add> <ide> return 'timestamp'; <ide> } <ide>
1
Javascript
Javascript
update the unsub route
e5de7d18376e6b10ed0b183e9477ac567b361def
<ide><path>server/boot/randomAPIs.js <ide> module.exports = function(app) { <ide> <ide> function unsubscribeById(req, res, next) { <ide> const { unsubscribeId } = req.params; <add> if (!unsubscribeId) { <add> req.flash('info', { <add> msg: 'We could not find an account to unsubscribe' <add> }); <add> return res.redirect('/'); <add> } <ide> return User.find({ where: { unsubscribeId } }, (err, users) => { <ide> if (err || !users.length) { <ide> req.flash('info', { <ide> msg: 'We could not find an account to unsubscribe' <ide> }); <ide> return res.redirect('/'); <ide> } <del> const [ user ] = users; <del> return new Promise((resolve, reject) => <del> user.updateAttributes({ <del> sendQuincyEmail: false <del> }, (err) => { <del> if (err) { <del> reject(err); <del> } else { <del> resolve(); <del> } <del> }) <del> ).then(() => { <del> req.flash('success', { <del> msg: 'We\'ve successfully updated your email preferences.' <del> }); <del> return res.redirect(`/unsubscribed/${unsubscribeId}`); <del> }) <del> .catch(next); <add> const updates = users.map(user => { <add> return new Promise((resolve, reject) => <add> user.updateAttributes({ <add> sendQuincyEmail: false <add> }, (err) => { <add> if (err) { <add> reject(err); <add> } else { <add> resolve(); <add> } <add> }) <add> ); <add> }); <add> return Promise.all(updates) <add> .then(() => { <add> req.flash('success', { <add> msg: 'We\'ve successfully updated your email preferences.' <add> }); <add> return res.redirect(`/unsubscribed/${unsubscribeId}`); <add> }) <add> .catch(next); <ide> }); <ide> } <ide>
1
Ruby
Ruby
add precision assignment back to timestamps method
a7703ce10b7ab0127d65fbbbbcc351163aac2ad1
<ide><path>activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb <ide> def check_constraint(expression, **options) <ide> def timestamps(**options) <ide> options[:null] = false if options[:null].nil? <ide> <add> if !options.key?(:precision) && @conn.supports_datetime_with_precision? <add> options[:precision] = 6 <add> end <add> <ide> column(:created_at, :datetime, **options) <ide> column(:updated_at, :datetime, **options) <ide> end <ide><path>activerecord/test/cases/migration/compatibility_test.rb <ide> def migrate(x) <ide> end <ide> end <ide> <add> def test_timestamps_sets_default_precision_on_create_table <add> migration = Class.new(ActiveRecord::Migration[6.1]) { <add> def migrate(x) <add> create_table :more_testings do |t| <add> t.timestamps <add> end <add> end <add> }.new <add> <add> ActiveRecord::Migrator.new(:up, [migration], @schema_migration, @internal_metadata).migrate <add> <add> assert connection.column_exists?(:more_testings, :created_at, **{ precision: 6 }) <add> assert connection.column_exists?(:more_testings, :updated_at, **{ precision: 6 }) <add> ensure <add> connection.drop_table :more_testings rescue nil <add> end <add> <ide> def test_datetime_doesnt_set_precision_on_create_table <ide> migration = Class.new(ActiveRecord::Migration[6.1]) { <ide> def migrate(x)
2
Javascript
Javascript
assert delegation type in delegatedmodule test
fcae4da622da251748d66ac4632b192723e0deb9
<ide><path>test/DelegatedModule.test.js <ide> describe("DelegatedModule", function() { <ide> const delegatedModule = new DelegatedModule(sourceRequest, data, type, userRequest); <ide> delegatedModule.updateHash(hash); <ide> }); <del> it("calls hash function with delegated module ID", function() { <add> it("updates hash with delegated module ID", function() { <ide> hashedText.should.containEql("/xg9"); <ide> }); <add> it("updates hash with delegation type", function() { <add> hashedText.should.containEql("require"); <add> }); <ide> }); <ide> });
1
Python
Python
fix subsequent pipe detection in entityruler
6c221d4841126ae6e923b02df28c303bba5d3bd6
<ide><path>spacy/pipeline/entityruler.py <ide> def add_patterns(self, patterns): <ide> <ide> # disable the nlp components after this one in case they hadn't been initialized / deserialised yet <ide> try: <del> current_index = self.nlp.pipe_names.index(self.name) <add> current_index = -1 <add> for i, (name, pipe) in enumerate(self.nlp.pipeline): <add> if self == pipe: <add> current_index = i <add> break <ide> subsequent_pipes = [ <ide> pipe for pipe in self.nlp.pipe_names[current_index + 1 :] <ide> ]
1
Python
Python
fix the other test for
4768f39c95ea702788eafe86c6206fb605773965
<ide><path>tests/regressiontests/comment_tests/tests/feed_tests.py <ide> class CommentFeedTests(CommentTestCase): <ide> def test_feed(self): <ide> response = self.client.get(self.feed_url) <ide> self.assertEqual(response.status_code, 200) <del> self.assertEqual(response['Content-Type'], 'application/rss+xml') <add> self.assertEqual(response['Content-Type'], 'application/rss+xml; charset=utf-8') <ide> self.assertContains(response, '<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">') <ide> self.assertContains(response, '<title>example.com comments</title>') <ide> self.assertContains(response, '<link>http://example.com/</link>')
1
Text
Text
add an example of an arg with the emitter
1bba80c2b22b8ce18a0963673cf87774186cb554
<ide><path>docs/upgrading/upgrading-your-package.md <ide> class Something <ide> @emitter.on 'did-change', callback <ide> <ide> methodThatFiresAChange: -> <del> @emitter.emit 'did-change' <add> @emitter.emit 'did-change', {data: 2} <add> <add>something = new Something <add>something.onDidChange (eventObject) -> <add> console.log eventObject.data # => 2 <add>something.methodThatFiresAChange() <ide> ``` <ide> <ide> ## Subscribing To Commands <ide> atom.workspaceView.command 'core:close core:cancel', -> <ide> 'core:close': -> <ide> 'core:cancel': -> <ide> <del># When in a View class, you should have a `@element` object available. `@element` is a raw HTML element <add># You can register commands directly on individual DOM elements in addition to <add># using selectors. When in a View class, you should have a `@element` object <add># available. `@element` is a plain HTMLElement object <ide> @disposables.add atom.commands.add @element, <ide> 'core:close': -> <ide> 'core:cancel': ->
1
Go
Go
change inode map to struct from bool
d072f316e300231b5d6dbfbaca348cdf65aad75d
<ide><path>utils/fs.go <ide> import ( <ide> <ide> // TreeSize walks a directory tree and returns its total size in bytes. <ide> func TreeSize(dir string) (size int64, err error) { <del> data := make(map[uint64]bool) <add> data := make(map[uint64]struct{}) <ide> err = filepath.Walk(dir, func(d string, fileInfo os.FileInfo, e error) error { <ide> // Ignore directory sizes <ide> if fileInfo == nil { <ide> func TreeSize(dir string) (size int64, err error) { <ide> return nil <ide> } <ide> // inode is not a uint64 on all platforms. Cast it to avoid issues. <del> data[uint64(inode)] = false <add> data[uint64(inode)] = struct{}{} <ide> <ide> size += s <ide>
1
Go
Go
fix race/deadlock in v1 plugin handlers
2938dce794be7559ba73b4e9630015020a7fa937
<ide><path>integration-cli/docker_cli_external_graphdriver_unix_test.go <ide> func (s *DockerExternalGraphdriverSuite) SetUpTest(c *check.C) { <ide> }) <ide> } <ide> <add>func (s *DockerExternalGraphdriverSuite) OnTimeout(c *check.C) { <add> s.d.DumpStackAndQuit() <add>} <add> <ide> func (s *DockerExternalGraphdriverSuite) TearDownTest(c *check.C) { <ide> if s.d != nil { <ide> s.d.Stop(c) <ide><path>pkg/plugins/plugin_test.go <add>package plugins <add> <add>import ( <add> "path/filepath" <add> "runtime" <add> "sync" <add> "testing" <add> "time" <add>) <add> <add>// regression test for deadlock in handlers <add>func TestPluginAddHandler(t *testing.T) { <add> // make a plugin which is pre-activated <add> p := &Plugin{activateWait: sync.NewCond(&sync.Mutex{})} <add> p.Manifest = &Manifest{Implements: []string{"bananas"}} <add> storage.plugins["qwerty"] = p <add> <add> testActive(t, p) <add> Handle("bananas", func(_ string, _ *Client) {}) <add> testActive(t, p) <add>} <add> <add>func testActive(t *testing.T, p *Plugin) { <add> done := make(chan struct{}) <add> go func() { <add> p.waitActive() <add> close(done) <add> }() <add> <add> select { <add> case <-time.After(100 * time.Millisecond): <add> _, f, l, _ := runtime.Caller(1) <add> t.Fatalf("%s:%d: deadlock in waitActive", filepath.Base(f), l) <add> case <-done: <add> } <add> <add>} <ide><path>pkg/plugins/plugins.go <ide> type Plugin struct { <ide> // Manifest of the plugin (see above) <ide> Manifest *Manifest `json:"-"` <ide> <del> // error produced by activation <del> activateErr error <del> // specifies if the activation sequence is completed (not if it is successful or not) <del> activated bool <ide> // wait for activation to finish <ide> activateWait *sync.Cond <add> // error produced by activation <add> activateErr error <add> // keeps track of callback handlers run against this plugin <add> handlersRun bool <ide> } <ide> <ide> // BasePath returns the path to which all paths returned by the plugin are relative to. <ide> func NewLocalPlugin(name, addr string) *Plugin { <ide> <ide> func (p *Plugin) activate() error { <ide> p.activateWait.L.Lock() <del> if p.activated { <add> <add> if p.activated() { <add> p.runHandlers() <ide> p.activateWait.L.Unlock() <ide> return p.activateErr <ide> } <ide> <ide> p.activateErr = p.activateWithLock() <del> p.activated = true <ide> <add> p.runHandlers() <ide> p.activateWait.L.Unlock() <ide> p.activateWait.Broadcast() <ide> return p.activateErr <ide> } <ide> <add>// runHandlers runs the registered handlers for the implemented plugin types <add>// This should only be run after activation, and while the activation lock is held. <add>func (p *Plugin) runHandlers() { <add> if !p.activated() { <add> return <add> } <add> <add> handlers.RLock() <add> if !p.handlersRun { <add> for _, iface := range p.Manifest.Implements { <add> hdlrs, handled := handlers.extpointHandlers[iface] <add> if !handled { <add> continue <add> } <add> for _, handler := range hdlrs { <add> handler(p.name, p.client) <add> } <add> } <add> p.handlersRun = true <add> } <add> handlers.RUnlock() <add> <add>} <add> <add>// activated returns if the plugin has already been activated. <add>// This should only be called with the activation lock held <add>func (p *Plugin) activated() bool { <add> return p.Manifest != nil <add>} <add> <ide> func (p *Plugin) activateWithLock() error { <ide> c, err := NewClient(p.Addr, p.TLSConfig) <ide> if err != nil { <ide> func (p *Plugin) activateWithLock() error { <ide> } <ide> <ide> p.Manifest = m <del> <del> handlers.RLock() <del> for _, iface := range m.Implements { <del> hdlrs, handled := handlers.extpointHandlers[iface] <del> if !handled { <del> continue <del> } <del> for _, handler := range hdlrs { <del> handler(p.name, p.client) <del> } <del> } <del> handlers.RUnlock() <ide> return nil <ide> } <ide> <ide> func (p *Plugin) waitActive() error { <ide> p.activateWait.L.Lock() <del> for !p.activated { <add> for !p.activated() { <ide> p.activateWait.Wait() <ide> } <ide> p.activateWait.L.Unlock() <ide> return p.activateErr <ide> } <ide> <ide> func (p *Plugin) implements(kind string) bool { <del> if err := p.waitActive(); err != nil { <add> if p.Manifest == nil { <ide> return false <ide> } <ide> for _, driver := range p.Manifest.Implements { <ide> func Get(name, imp string) (*Plugin, error) { <ide> if err != nil { <ide> return nil, err <ide> } <del> if pl.implements(imp) { <add> if err := pl.waitActive(); err == nil && pl.implements(imp) { <ide> logrus.Debugf("%s implements: %s", name, imp) <ide> return pl, nil <ide> } <ide> func Handle(iface string, fn func(string, *Client)) { <ide> <ide> hdlrs = append(hdlrs, fn) <ide> handlers.extpointHandlers[iface] = hdlrs <add> <add> storage.Lock() <ide> for _, p := range storage.plugins { <del> p.activated = false <add> p.activateWait.L.Lock() <add> if p.activated() && p.implements(iface) { <add> p.handlersRun = false <add> } <add> p.activateWait.L.Unlock() <ide> } <add> storage.Unlock() <add> <ide> handlers.Unlock() <ide> } <ide> <ide> func GetAll(imp string) ([]*Plugin, error) { <ide> logrus.Error(pl.err) <ide> continue <ide> } <del> if pl.pl.implements(imp) { <add> if err := pl.pl.waitActive(); err == nil && pl.pl.implements(imp) { <ide> out = append(out, pl.pl) <ide> } <ide> }
3
Go
Go
add missing error-check (errcheck)
6ff727b13c52658e20bb63494d595beeeb5407ea
<ide><path>api/types/filters/parse_test.go <ide> func TestWalkValues(t *testing.T) { <ide> f.Add("status", "running") <ide> f.Add("status", "paused") <ide> <del> f.WalkValues("status", func(value string) error { <add> err := f.WalkValues("status", func(value string) error { <ide> if value != "running" && value != "paused" { <ide> t.Fatalf("Unexpected value %s", value) <ide> } <ide> return nil <ide> }) <add> if err != nil { <add> t.Fatalf("Expected no error, got %v", err) <add> } <ide> <del> err := f.WalkValues("status", func(value string) error { <add> err = f.WalkValues("status", func(value string) error { <ide> return errors.New("return") <ide> }) <ide> if err == nil {
1
Javascript
Javascript
add quaternion tests
2a2cafcac2af98a008b3761d2bc4e63c905ef6a3
<ide><path>test/unit/src/math/Quaternion.tests.js <ide> export default QUnit.module( 'Maths', () => { <ide> <ide> } ); <ide> <del> QUnit.todo( "clone", ( assert ) => { <add> QUnit.test( "clone", ( assert ) => { <ide> <del> assert.ok( false, "everything's gonna be alright" ); <add> <add> var a = new Quaternion().clone(); <add> assert.ok( a.x == 0, "Passed!" ); <add> assert.ok( a.y == 0, "Passed!" ); <add> assert.ok( a.z == 0, "Passed!" ); <add> assert.ok( a.w == 1, "Passed!" ); <add> <add> var b = a.set( x, y, z, w ).clone(); <add> assert.ok( b.x == x, "Passed!" ); <add> assert.ok( b.y == y, "Passed!" ); <add> assert.ok( b.z === z, "Passed!" ); <add> assert.ok( b.w === w, "Passed!" ); <ide> <ide> } ); <ide> <ide> export default QUnit.module( 'Maths', () => { <ide> <ide> } ); <ide> <del> QUnit.todo( "slerp", ( assert ) => { <add> QUnit.test( "slerp", ( assert ) => { <add> <add> var a = new Quaternion( x, y, z, w ); <add> var b = new Quaternion( - x, - y, - z, - w ); <add> <add> var c = a.clone().slerp( b, 0 ); <add> var d = a.clone().slerp( b, 1 ); <add> <add> assert.ok( a.equals( c ), "Passed" ); <add> assert.ok( b.equals( d ), "Passed" ); <add> <ide> <del> assert.ok( false, "everything's gonna be alright" ); <add> var D = Math.SQRT1_2; <add> <add> var e = new Quaternion( 1, 0, 0, 0 ); <add> var f = new Quaternion( 0, 0, 1, 0 ); <add> var expected = new Quaternion( D, 0, D, 0 ); <add> var result = e.clone().slerp( f, 0.5 ); <add> assert.ok( Math.abs( result.x - expected.x ) <= eps, "Check x" ); <add> assert.ok( Math.abs( result.y - expected.y ) <= eps, "Check y" ); <add> assert.ok( Math.abs( result.z - expected.z ) <= eps, "Check z" ); <add> assert.ok( Math.abs( result.w - expected.w ) <= eps, "Check w" ); <add> <add> <add> var g = new Quaternion( 0, D, 0, D ); <add> var h = new Quaternion( 0, - D, 0, D ); <add> expected = new Quaternion( 0, 0, 0, 1 ); <add> result = g.clone().slerp( h, 0.5 ); <add> <add> assert.ok( Math.abs( result.x - expected.x ) <= eps, "Check x" ); <add> assert.ok( Math.abs( result.y - expected.y ) <= eps, "Check y" ); <add> assert.ok( Math.abs( result.z - expected.z ) <= eps, "Check z" ); <add> assert.ok( Math.abs( result.w - expected.w ) <= eps, "Check w" ); <ide> <ide> } ); <ide> <ide> export default QUnit.module( 'Maths', () => { <ide> <ide> } ); <ide> <del> QUnit.todo( "fromArray", ( assert ) => { <add> QUnit.test( "fromArray", ( assert ) => { <add> <add> var a = new Quaternion(); <add> a.fromArray( [ x, y, z, w ] ); <add> assert.ok( a.x == x, "Passed!" ); <add> assert.ok( a.y == y, "Passed!" ); <add> assert.ok( a.z === z, "Passed!" ); <add> assert.ok( a.w === w, "Passed!" ); <ide> <del> assert.ok( false, "everything's gonna be alright" ); <add> a.fromArray( [ undefined, x, y, z, w, undefined ], 1 ); <add> assert.ok( a.x == x, "Passed!" ); <add> assert.ok( a.y == y, "Passed!" ); <add> assert.ok( a.z === z, "Passed!" ); <add> assert.ok( a.w === w, "Passed!" ); <ide> <ide> } ); <ide>
1
Python
Python
allow input for tty tests
d0fc382c4b18a7021d0a93194bc4b304ed6f7d6f
<ide><path>test/pseudo-tty/testcfg.py <ide> <ide> class TTYTestCase(test.TestCase): <ide> <del> def __init__(self, path, file, expected, arch, mode, context, config): <add> def __init__(self, path, file, expected, input, arch, mode, context, config): <ide> super(TTYTestCase, self).__init__(context, path, arch, mode) <ide> self.file = file <ide> self.expected = expected <add> self.input = input <ide> self.config = config <ide> self.arch = arch <ide> self.mode = mode <ide> def GetSource(self): <ide> + open(self.expected).read()) <ide> <ide> def RunCommand(self, command, env): <add> input = None <add> if self.input is not None and exists(self.input): <add> input = open(self.input).read() <ide> full_command = self.context.processor(command) <ide> output = test.Execute(full_command, <ide> self.context, <ide> self.context.GetTimeout(self.mode), <ide> env, <del> True) <add> faketty=True, <add> input=input) <ide> return test.TestOutput(self, <ide> full_command, <ide> output, <ide> def ListTests(self, current_path, path, arch, mode): <ide> if self.Contains(path, test): <ide> file_prefix = join(self.root, reduce(join, test[1:], "")) <ide> file_path = file_prefix + ".js" <add> input_path = file_prefix + ".in" <ide> output_path = file_prefix + ".out" <ide> if not exists(output_path): <ide> raise Exception("Could not find %s" % output_path) <ide> result.append(TTYTestCase(test, file_path, output_path, <del> arch, mode, self.context, self)) <add> input_path, arch, mode, self.context, self)) <ide> return result <ide> <ide> def GetBuildRequirements(self): <ide><path>tools/test.py <ide> def CheckedUnlink(name): <ide> PrintError("os.unlink() " + str(e)) <ide> break <ide> <del>def Execute(args, context, timeout=None, env={}, faketty=False, disable_core_files=False): <add>def Execute(args, context, timeout=None, env={}, faketty=False, disable_core_files=False, input=None): <ide> if faketty: <ide> import pty <ide> (out_master, fd_out) = pty.openpty() <ide> fd_in = fd_err = fd_out <ide> pty_out = out_master <add> <add> if input is not None: <add> # Before writing input data, disable echo so the input doesn't show <add> # up as part of the output. <add> import termios <add> attr = termios.tcgetattr(fd_in) <add> attr[3] = attr[3] & ~termios.ECHO <add> termios.tcsetattr(fd_in, termios.TCSADRAIN, attr) <add> <add> os.write(pty_out, input) <add> os.write(pty_out, '\x04') # End-of-file marker (Ctrl+D) <ide> else: <ide> (fd_out, outname) = tempfile.mkstemp() <ide> (fd_err, errname) = tempfile.mkstemp()
2
Python
Python
make like= in python functions strict
adc261a50b11310c97ffbcf57d6e20a5980bfed9
<ide><path>numpy/core/_asarray.py <ide> """ <ide> from .overrides import ( <ide> array_function_dispatch, <add> array_function_dispatch_like, <ide> set_array_function_like_doc, <ide> set_module, <ide> ) <ide> def asarray(a, dtype=None, order=None, *, like=None): <ide> <ide> """ <ide> if like is not None: <del> return _asarray_with_like(a, dtype=dtype, order=order, like=like) <add> return array_function_dispatch_like( <add> _asarray_with_like, a, dtype=dtype, order=order, like=like <add> ) <ide> <ide> return array(a, dtype, copy=False, order=order) <ide> <ide> def asanyarray(a, dtype=None, order=None, *, like=None): <ide> <ide> """ <ide> if like is not None: <del> return _asanyarray_with_like(a, dtype=dtype, order=order, like=like) <add> return array_function_dispatch_like( <add> _asanyarray_with_like, a, dtype=dtype, order=order, like=like <add> ) <ide> <ide> return array(a, dtype, copy=False, order=order, subok=True) <ide> <ide> def ascontiguousarray(a, dtype=None, *, like=None): <ide> <ide> """ <ide> if like is not None: <del> return _ascontiguousarray_with_like(a, dtype=dtype, like=like) <add> return array_function_dispatch_like( <add> _ascontiguousarray_with_like, a, dtype=dtype, like=like <add> ) <ide> <ide> return array(a, dtype, copy=False, order='C', ndmin=1) <ide> <ide> def asfortranarray(a, dtype=None, *, like=None): <ide> <ide> """ <ide> if like is not None: <del> return _asfortranarray_with_like(a, dtype=dtype, like=like) <add> return array_function_dispatch_like( <add> _asfortranarray_with_like, a, dtype=dtype, like=like <add> ) <ide> <ide> return array(a, dtype, copy=False, order='F', ndmin=1) <ide> <ide> def require(a, dtype=None, requirements=None, *, like=None): <ide> <ide> """ <ide> if like is not None: <del> return _require_with_like( <add> return array_function_dispatch_like( <add> _require_with_like, <ide> a, <ide> dtype=dtype, <ide> requirements=requirements, <ide><path>numpy/core/numeric.py <ide> from . import overrides <ide> from . import umath <ide> from . import shape_base <del>from .overrides import set_array_function_like_doc, set_module <add>from .overrides import ( <add> array_function_dispatch_like, set_array_function_like_doc, set_module <add> ) <ide> from .umath import (multiply, invert, sin, PINF, NAN) <ide> from . import numerictypes <ide> from .numerictypes import longlong, intc, int_, float_, complex_, bool_ <ide> def ones(shape, dtype=None, order='C', *, like=None): <ide> <ide> """ <ide> if like is not None: <del> return _ones_with_like(shape, dtype=dtype, order=order, like=like) <add> return array_function_dispatch_like( <add> _ones_with_like, shape, dtype=dtype, order=order, like=like <add> ) <ide> <ide> a = empty(shape, dtype, order) <ide> multiarray.copyto(a, 1, casting='unsafe') <ide> def full(shape, fill_value, dtype=None, order='C', *, like=None): <ide> <ide> """ <ide> if like is not None: <del> return _full_with_like(shape, fill_value, dtype=dtype, order=order, like=like) <add> return array_function_dispatch_like( <add> _full_with_like, <add> shape, <add> fill_value, <add> dtype=dtype, <add> order=order, <add> like=like, <add> ) <ide> <ide> if dtype is None: <ide> fill_value = asarray(fill_value) <ide> def fromfunction(function, shape, *, dtype=float, like=None, **kwargs): <ide> <ide> """ <ide> if like is not None: <del> return _fromfunction_with_like(function, shape, dtype=dtype, like=like, **kwargs) <add> return array_function_dispatch_like( <add> _fromfunction_with_like, <add> function, <add> shape, <add> dtype=dtype, <add> like=like, <add> **kwargs, <add> ) <ide> <ide> args = indices(shape, dtype=dtype) <ide> return function(*args, **kwargs) <ide> def identity(n, dtype=None, *, like=None): <ide> <ide> """ <ide> if like is not None: <del> return _identity_with_like(n, dtype=dtype, like=like) <add> return array_function_dispatch_like( <add> _identity_with_like, n, dtype=dtype, like=like <add> ) <ide> <ide> from numpy import eye <ide> return eye(n, dtype=dtype, like=like) <ide><path>numpy/lib/npyio.py <ide> from ._datasource import DataSource <ide> from numpy.core import overrides <ide> from numpy.core.multiarray import packbits, unpackbits <del>from numpy.core.overrides import set_array_function_like_doc, set_module <add>from numpy.core.overrides import ( <add> array_function_dispatch_like, set_array_function_like_doc, set_module <add> ) <ide> from numpy.core._internal import recursive <ide> from ._iotools import ( <ide> LineSplitter, NameValidator, StringConverter, ConverterError, <ide> def loadtxt(fname, dtype=float, comments='#', delimiter=None, <ide> """ <ide> <ide> if like is not None: <del> return _loadtxt_with_like( <del> fname, dtype=dtype, comments=comments, delimiter=delimiter, <del> converters=converters, skiprows=skiprows, usecols=usecols, <del> unpack=unpack, ndmin=ndmin, encoding=encoding, <add> return array_function_dispatch_like( <add> _loadtxt_with_like, fname, dtype=dtype, comments=comments, <add> delimiter=delimiter, converters=converters, skiprows=skiprows, <add> usecols=usecols, unpack=unpack, ndmin=ndmin, encoding=encoding, <ide> max_rows=max_rows, like=like <ide> ) <ide> <ide> def genfromtxt(fname, dtype=float, comments='#', delimiter=None, <ide> """ <ide> <ide> if like is not None: <del> return _genfromtxt_with_like( <del> fname, dtype=dtype, comments=comments, delimiter=delimiter, <del> skip_header=skip_header, skip_footer=skip_footer, <del> converters=converters, missing_values=missing_values, <del> filling_values=filling_values, usecols=usecols, names=names, <del> excludelist=excludelist, deletechars=deletechars, <del> replace_space=replace_space, autostrip=autostrip, <del> case_sensitive=case_sensitive, defaultfmt=defaultfmt, <del> unpack=unpack, usemask=usemask, loose=loose, <add> return array_function_dispatch_like( <add> _genfromtxt_with_like, fname, dtype=dtype, comments=comments, <add> delimiter=delimiter, skip_header=skip_header, <add> skip_footer=skip_footer, converters=converters, <add> missing_values=missing_values, filling_values=filling_values, <add> usecols=usecols, names=names, excludelist=excludelist, <add> deletechars=deletechars, replace_space=replace_space, <add> autostrip=autostrip, case_sensitive=case_sensitive, <add> defaultfmt=defaultfmt, unpack=unpack, usemask=usemask, loose=loose, <ide> invalid_raise=invalid_raise, max_rows=max_rows, encoding=encoding, <ide> like=like <ide> ) <ide><path>numpy/lib/twodim_base.py <ide> asarray, where, int8, int16, int32, int64, empty, promote_types, diagonal, <ide> nonzero <ide> ) <del>from numpy.core.overrides import set_array_function_like_doc, set_module <add>from numpy.core.overrides import ( <add> array_function_dispatch_like, set_array_function_like_doc, set_module <add> ) <ide> from numpy.core import overrides <ide> from numpy.core import iinfo <ide> <ide> def eye(N, M=None, k=0, dtype=float, order='C', *, like=None): <ide> <ide> """ <ide> if like is not None: <del> return _eye_with_like(N, M=M, k=k, dtype=dtype, order=order, like=like) <add> return array_function_dispatch_like( <add> _eye_with_like, <add> N, <add> M=M, <add> k=k, <add> dtype=dtype, <add> order=order, <add> like=like <add> ) <ide> if M is None: <ide> M = N <ide> m = zeros((N, M), dtype=dtype, order=order) <ide> def tri(N, M=None, k=0, dtype=float, *, like=None): <ide> <ide> """ <ide> if like is not None: <del> return _tri_with_like(N, M=M, k=k, dtype=dtype, like=like) <add> return array_function_dispatch_like( <add> _tri_with_like, N, M=M, k=k, dtype=dtype, like=like <add> ) <ide> <ide> if M is None: <ide> M = N
4
Javascript
Javascript
use deepmerge in deepmerge
82030ae054ba10bbd25ef00b304990632780f11d
<ide><path>lib/utils.js <ide> function deepMerge(/* obj1, obj2, obj3, ... */) { <ide> var result = {}; <ide> function assignValue(val, key) { <ide> if (typeof result[key] === 'object' && typeof val === 'object') { <del> result[key] = merge(result[key], val); <add> result[key] = deepMerge(result[key], val); <ide> } else if (typeof val === 'object') { <del> result[key] = merge({}, val); <add> result[key] = deepMerge({}, val); <ide> } else { <ide> result[key] = val; <ide> }
1
Go
Go
fix network alias issue
d63a5a1ff593f14957f3e0a9678633e8237defc9
<ide><path>api/server/router/network/network_routes.go <ide> func (n *networkRouter) postNetworkConnect(ctx context.Context, w http.ResponseW <ide> return err <ide> } <ide> <del> // Always make sure there is no ambiguity with respect to the network ID/name <del> nw, err := n.backend.FindNetwork(vars["id"]) <del> if err != nil { <del> return err <del> } <del> return n.backend.ConnectContainerToNetwork(connect.Container, nw.ID(), connect.EndpointConfig) <add> // Unlike other operations, we does not check ambiguity of the name/ID here. <add> // The reason is that, In case of attachable network in swarm scope, the actual local network <add> // may not be available at the time. At the same time, inside daemon `ConnectContainerToNetwork` <add> // does the ambiguity check anyway. Therefore, passing the name to daemon would be enough. <add> return n.backend.ConnectContainerToNetwork(connect.Container, vars["id"], connect.EndpointConfig) <ide> } <ide> <ide> func (n *networkRouter) postNetworkDisconnect(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error { <ide><path>daemon/container_operations.go <ide> import ( <ide> "github.com/docker/docker/runconfig" <ide> "github.com/docker/go-connections/nat" <ide> "github.com/docker/libnetwork" <add> netconst "github.com/docker/libnetwork/datastore" <ide> "github.com/docker/libnetwork/netlabel" <ide> "github.com/docker/libnetwork/options" <ide> "github.com/docker/libnetwork/types" <ide> func (daemon *Daemon) updateNetworkSettings(container *container.Container, n li <ide> } <ide> <ide> if sn.Name() == n.Name() { <add> // If the network scope is swarm, then this <add> // is an attachable network, which may not <add> // be locally available previously. <add> // So always update. <add> if n.Info().Scope() == netconst.SwarmScope { <add> continue <add> } <ide> // Avoid duplicate config <ide> return nil <ide> } <ide> func (daemon *Daemon) updateNetworkSettings(container *container.Container, n li <ide> } <ide> } <ide> <del> if _, ok := container.NetworkSettings.Networks[n.Name()]; !ok { <del> container.NetworkSettings.Networks[n.Name()] = &network.EndpointSettings{ <del> EndpointSettings: endpointConfig, <del> } <add> container.NetworkSettings.Networks[n.Name()] = &network.EndpointSettings{ <add> EndpointSettings: endpointConfig, <ide> } <ide> <ide> return nil
2
Python
Python
remove unreachable code
d9aaa0147d13535ee137694765f61cc1d68371aa
<ide><path>glances/password_list.py <ide> def get_password(self, host=None): <ide> return self._password_dict['default'] <ide> except (KeyError, TypeError): <ide> return None <del> return None <ide> <ide> def set_password(self, host, password): <ide> """Set a password for a specific host."""
1
Python
Python
add roberta to doc
ae1d03fc51bb22ed59517ee6f92c560417fdb049
<ide><path>examples/run_ner.py <ide> # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <ide> # See the License for the specific language governing permissions and <ide> # limitations under the License. <del>""" Fine-tuning the library models for named entity recognition on CoNLL-2003 (Bert). """ <add>""" Fine-tuning the library models for named entity recognition on CoNLL-2003 (Bert or Roberta). """ <ide> <ide> from __future__ import absolute_import, division, print_function <ide>
1
Javascript
Javascript
update example to use a module
39c7c909fb3a6ec5f79d66227ea84b075159b888
<ide><path>src/ng/directive/input.js <ide> var minlengthDirective = function() { <ide> * specified in form `/something/` then the value will be converted into a regular expression. <ide> * <ide> * @example <del> <example name="ngList-directive"> <add> <example name="ngList-directive" module="listExample"> <ide> <file name="index.html"> <ide> <script> <del> function Ctrl($scope) { <del> $scope.names = ['igor', 'misko', 'vojta']; <del> } <add> angular.module('listExample', []) <add> .controller('ExampleController', ['$scope', function($scope) { <add> $scope.names = ['igor', 'misko', 'vojta']; <add> }]); <ide> </script> <del> <form name="myForm" ng-controller="Ctrl"> <add> <form name="myForm" ng-controller="ExampleController"> <ide> List: <input name="namesInput" ng-model="names" ng-list required> <ide> <span class="error" ng-show="myForm.namesInput.$error.required"> <ide> Required!</span>
1
Javascript
Javascript
fix regression from
24d660eebe1b38bf602ffaf21a25e8f757fb7f87
<ide><path>web/viewer.js <ide> var RenderingStates = { <ide> FINISHED: 3 <ide> }; <ide> <del>PDFJS.workerSrc = '../build/pdf.js'; <add>//#if (GENERIC || CHROME) <add>//PDFJS.workerSrc = '../build/pdf.js'; <add>//#endif <ide> <ide> var mozL10n = document.mozL10n || document.webL10n; <ide>
1
Python
Python
fix conv3d tests
8ad686595202c6aabc44af3d16c0440e016e3fae
<ide><path>keras/layers/convolutional.py <ide> def __init__(self, nb_filter, kernel_dim1, kernel_dim2, kernel_dim3, <ide> super(Convolution3D, self).__init__(**kwargs) <ide> <ide> def build(self, input_shape): <add> assert len(input_shape) == 5 <add> self.input_spec = [InputSpec(shape=input_shape)] <add> <ide> if self.dim_ordering == 'th': <ide> stack_size = input_shape[1] <ide> self.W_shape = (self.nb_filter, stack_size, <ide> def get_output_shape_for(self, input_shape): <ide> raise Exception('Invalid dim_ordering: ' + self.dim_ordering) <ide> <ide> def call(self, x, mask=None): <add> input_shape = self.input_spec[0].shape <ide> conv_out = K.conv3d(x, self.W, strides=self.subsample, <ide> border_mode=self.border_mode, <ide> dim_ordering=self.dim_ordering, <del> volume_shape=self.input_shape, <add> volume_shape=input_shape, <ide> filter_shape=self.W_shape) <ide> <ide> if self.dim_ordering == 'th': <ide><path>keras/layers/core.py <ide> def get_output_shape_for(self, input_shape): <ide> else: <ide> return K.int_shape(x) <ide> # otherwise, we default to the input shape <del> return self.input_shape <add> return input_shape <ide> elif type(self._output_shape) in {tuple, list}: <ide> nb_samples = input_shape[0] if input_shape else None <ide> return (nb_samples,) + tuple(self._output_shape) <ide><path>keras/utils/test_utils.py <ide> def layer_test(layer_cls, kwargs={}, input_shape=None, input_dtype=None, <ide> x = Input(shape=input_shape[1:], dtype=input_dtype) <ide> y = layer(x) <ide> model = Model(input=x, output=y) <del> model.compile('rmsprop', 'mse', mode='FAST_COMPILE') <add> model.compile('rmsprop', 'mse') <ide> <ide> expected_output_shape = layer.get_output_shape_for(input_shape) <ide> actual_output = model.predict(input_data) <ide><path>tests/keras/layers/test_convolutional.py <ide> def test_convolution_3d(): <ide> 'kernel_dim3': kernel_dim3, <ide> 'border_mode': border_mode, <ide> 'subsample': subsample}, <del> input_shape=(nb_samples, stack_size, nb_row, nb_col)) <add> input_shape=(nb_samples, stack_size, <add> input_len_dim1, input_len_dim2, input_len_dim3)) <ide> <ide> layer_test(convolutional.Convolution3D, <ide> kwargs={'nb_filter': nb_filter, <ide> def test_upsampling_3d(): <ide> <ide> if __name__ == '__main__': <ide> # pytest.main([__file__]) <del> test_convolution_1d() <add> test_convolution_3d()
4
Javascript
Javascript
introduce a supported way to slice children
d50148591b9a8bf7a49f873e1eaf5f8af364cb70
<ide><path>src/utils/__tests__/sliceChildren-test.js <add>/** <add> * Copyright 2013 Facebook, Inc. <add> * <add> * Licensed under the Apache License, Version 2.0 (the "License"); <add> * you may not use this file except in compliance with the License. <add> * You may obtain a copy of the License at <add> * <add> * http://www.apache.org/licenses/LICENSE-2.0 <add> * <add> * Unless required by applicable law or agreed to in writing, software <add> * distributed under the License is distributed on an "AS IS" BASIS, <add> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <add> * See the License for the specific language governing permissions and <add> * limitations under the License. <add> * <add> * @emails react-core <add> * @jsx React.DOM <add> */ <add> <add>"use strict"; <add> <add>describe('sliceChildren', function() { <add> <add> var React; <add> var ReactTestUtils; <add> <add> var sliceChildren; <add> var reactComponentExpect; <add> <add> var Partial; <add> <add> beforeEach(function() { <add> React = require('React'); <add> ReactTestUtils = require('ReactTestUtils'); <add> <add> sliceChildren = require('sliceChildren'); <add> reactComponentExpect = require('reactComponentExpect'); <add> <add> Partial = React.createClass({ <add> render: function() { <add> return ( <add> <div> <add> {sliceChildren( <add> this.props.children, <add> this.props.start, <add> this.props.end <add> )} <add> </div> <add> ); <add> } <add> }); <add> }); <add> <add> function renderAndSlice(set, start, end) { <add> var instance = <Partial start={start} end={end}>{set}</Partial>; <add> ReactTestUtils.renderIntoDocument(instance); <add> var rendered = reactComponentExpect(instance) <add> .expectRenderedChild() <add> .instance(); <add> return rendered.props.children; <add> } <add> <add> it('should render the whole set if start zero is supplied', function() { <add> var fullSet = [ <add> <div key="A" />, <add> <div key="B" />, <add> <div key="C" /> <add> ]; <add> var children = renderAndSlice(fullSet, 0); <add> expect(children).toEqual({ <add> '[A]': fullSet[0], <add> '[B]': fullSet[1], <add> '[C]': fullSet[2] <add> }); <add> }); <add> <add> it('should render the remaining set if no end index is supplied', function() { <add> var fullSet = [ <add> <div key="A" />, <add> <div key="B" />, <add> <div key="C" /> <add> ]; <add> var children = renderAndSlice(fullSet, 1); <add> expect(children).toEqual({ <add> '[B]': fullSet[1], <add> '[C]': fullSet[2] <add> }); <add> }); <add> <add> it('should exclude everything at or after the end index', function() { <add> var fullSet = [ <add> <div key="A" />, <add> <div key="B" />, <add> <div key="C" />, <add> <div key="D" /> <add> ]; <add> var children = renderAndSlice(fullSet, 1, 2); <add> expect(children).toEqual({ <add> '[B]': fullSet[1] <add> }); <add> }); <add> <add> it('should allow static children to be sliced', function() { <add> var a = <div />; <add> var b = <div />; <add> var c = <div />; <add> <add> var instance = <Partial start={1} end={2}>{a}{b}{c}</Partial>; <add> ReactTestUtils.renderIntoDocument(instance); <add> var rendered = reactComponentExpect(instance) <add> .expectRenderedChild() <add> .instance(); <add> <add> expect(rendered.props.children).toEqual({ <add> '[1]': b <add> }); <add> }); <add> <add>}); <ide><path>src/utils/sliceChildren.js <add>/** <add> * Copyright 2013 Facebook, Inc. <add> * <add> * Licensed under the Apache License, Version 2.0 (the "License"); <add> * you may not use this file except in compliance with the License. <add> * You may obtain a copy of the License at <add> * <add> * http://www.apache.org/licenses/LICENSE-2.0 <add> * <add> * Unless required by applicable law or agreed to in writing, software <add> * distributed under the License is distributed on an "AS IS" BASIS, <add> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <add> * See the License for the specific language governing permissions and <add> * limitations under the License. <add> * <add> * @providesModule sliceChildren <add> */ <add> <add>"use strict"; <add> <add>var flattenChildren = require('flattenChildren'); <add> <add>/** <add> * Slice children that are typically specified as `props.children`. This version <add> * of slice children ignores empty child components. <add> * <add> * @param {*} children The children set to filter. <add> * @param {number} start The first zero-based index to include in the subset. <add> * @param {?number} end The non-inclusive last index of the subset. <add> * @return {object} mirrored array with mapped children <add> */ <add>function sliceChildren(children, start, end) { <add> if (children == null) { <add> return children; <add> } <add> <add> var slicedChildren = {}; <add> var flattenedMap = flattenChildren(children); <add> var ii = 0; <add> for (var key in flattenedMap) { <add> if (!flattenedMap.hasOwnProperty(key)) { <add> continue; <add> } <add> var child = flattenedMap[key]; <add> // In this version of slice children we ignore empty children. <add> if (child !== null) { <add> if (ii >= start) { <add> slicedChildren[key] = child; <add> } <add> ii++; <add> if (end != null && ii >= end) { <add> break; <add> } <add> } <add> } <add> return slicedChildren; <add>} <add> <add>module.exports = sliceChildren;
2
Javascript
Javascript
fix resolve caching with different resolve options
da5ab282e6f929d9882edfdcffef4190dab93e2d
<ide><path>lib/ResolverFactory.js <ide> module.exports = class ResolverFactory { <ide> resolveOptions: new HookMap( <ide> () => new SyncWaterfallHook(["resolveOptions"]) <ide> ), <del> /** @type {HookMap<SyncHook<[Resolver, Object]>>} */ <del> resolver: new HookMap(() => new SyncHook(["resolver", "resolveOptions"])) <add> /** @type {HookMap<SyncHook<[Resolver, Object, Object]>>} */ <add> resolver: new HookMap( <add> () => new SyncHook(["resolver", "resolveOptions", "userResolveOptions"]) <add> ) <ide> }); <ide> /** @type {Map<string, ResolverCache>} */ <ide> this.cache = new Map(); <ide> module.exports = class ResolverFactory { <ide> childCache.set(options, resolver); <ide> return resolver; <ide> }; <del> this.hooks.resolver.for(type).call(resolver, resolveOptions); <add> this.hooks.resolver <add> .for(type) <add> .call(resolver, resolveOptions, originalResolveOptions); <ide> return resolver; <ide> } <ide> }; <ide><path>lib/cache/ResolverCachePlugin.js <ide> const addAllToSet = (set, otherSet) => { <ide> }; <ide> <ide> /** <del> * @param {Object} request a request <add> * @param {Object} object an object <ide> * @param {boolean} excludeContext if true, context is not included in string <ide> * @returns {string} stringified version <ide> */ <del>const requestToString = (request, excludeContext) => { <add>const objectToString = (object, excludeContext) => { <ide> let str = ""; <del> for (const key in request) { <add> for (const key in object) { <ide> if (excludeContext && key === "context") continue; <del> const value = request[key]; <add> const value = object[key]; <ide> if (typeof value === "object" && value !== null) { <del> str += `/${key}={${requestToString(value, false)}}`; <add> str += `/${key}=[${objectToString(value, false)}]`; <ide> } else { <ide> str += `/${key}=${value}`; <ide> } <ide> class ResolverCachePlugin { <ide> /** <ide> * @param {Resolver} resolver the resolver <ide> * @param {Object} options resolve options <add> * @param {Object} userOptions resolve options passed by the user <ide> * @returns {void} <ide> */ <del> (resolver, options) => { <add> (resolver, options, userOptions) => { <ide> if (options.cache !== true) return; <add> const optionsIdent = objectToString(userOptions, false); <ide> const cacheWithContext = <ide> options.cacheWithContext !== undefined <ide> ? options.cacheWithContext <ide> class ResolverCachePlugin { <ide> if (request._ResolverCachePluginCacheMiss || !fileSystemInfo) { <ide> return callback(); <ide> } <del> const identifier = `/resolve/${type}${requestToString( <add> const identifier = `/resolve/${type}${optionsIdent}${objectToString( <ide> request, <ide> cacheWithContext <ide> )}`;
2
Python
Python
remove skipping tests of mssql for python 3.8
d51957165b2836fe0006d318c299c149fb5d35b0
<ide><path>tests/always/test_deprecations.py <ide> # under the License. <ide> <ide> import importlib <del>import sys <ide> import warnings <ide> from inspect import isabstract <ide> from unittest import mock <ide> def assert_proper_import(self, old_resource, new_resource): <ide> importlib.reload(importlib.import_module(old_path)) <ide> self.assert_warning(new_path, warnings) <ide> <del> def skip_test_with_mssql_in_py38(self, path_a="", path_b=""): <del> py_38 = sys.version_info >= (3, 8) <del> if py_38: <del> if "mssql" in path_a or "mssql" in path_b: <del> raise pytest.skip("Mssql package not available when Python >= 3.8.") <del> <ide> @staticmethod <ide> def get_class_from_path(path_to_class, parent=False): <ide> """ <ide> def get_class_from_path(path_to_class, parent=False): <ide> <ide> @pytest.mark.parametrize("new_module, old_module", RENAMED_ALL) <ide> def test_is_class_deprecated(self, new_module, old_module): <del> self.skip_test_with_mssql_in_py38(new_module, old_module) <ide> deprecation_warning_msg = "This class is deprecated." <ide> with pytest.warns(DeprecationWarning, match=deprecation_warning_msg) as warnings: <ide> old_module_class = self.get_class_from_path(old_module) <ide> def test_is_class_deprecated(self, new_module, old_module): <ide> <ide> @pytest.mark.parametrize("parent_class_path, sub_class_path", ALL) <ide> def test_is_subclass(self, parent_class_path, sub_class_path): <del> self.skip_test_with_mssql_in_py38(parent_class_path, sub_class_path) <ide> with mock.patch(f"{parent_class_path}.__init__"), warnings.catch_warnings(record=True): <ide> parent_class_path = self.get_class_from_path(parent_class_path, parent=True) <ide> sub_class_path = self.get_class_from_path(sub_class_path) <ide> self.assert_is_subclass(sub_class_path, parent_class_path) <ide> <ide> @pytest.mark.parametrize("new_path, old_path", ALL) <ide> def test_warning_on_import(self, new_path, old_path): <del> self.skip_test_with_mssql_in_py38(new_path, old_path) <ide> self.assert_proper_import(old_path, new_path) <ide> <ide> def test_no_redirect_to_deprecated_classes(self):
1
Python
Python
improve memory usage in pep3118 format parsing
e0fb54f5751e93bcb36eccc00681a9afc35e1c37
<ide><path>numpy/core/_internal.py <ide> def _view_is_safe(oldtype, newtype): <ide> } <ide> _pep3118_standard_typechars = ''.join(_pep3118_standard_map.keys()) <ide> <del>def _dtype_from_pep3118(spec): <ide> <del> class Stream(object): <del> def __init__(self, s): <del> self.s = s <del> self.byteorder = '@' <add>class _Stream(object): <add> def __init__(self, s): <add> self.s = s <add> self.byteorder = '@' <ide> <del> def advance(self, n): <del> res = self.s[:n] <del> self.s = self.s[n:] <del> return res <add> def advance(self, n): <add> res = self.s[:n] <add> self.s = self.s[n:] <add> return res <ide> <del> def consume(self, c): <del> if self.s[:len(c)] == c: <del> self.advance(len(c)) <del> return True <del> return False <del> <del> def consume_until(self, c): <del> if callable(c): <del> i = 0 <del> while i < len(self.s) and not c(self.s[i]): <del> i = i + 1 <del> return self.advance(i) <del> else: <del> i = self.s.index(c) <del> res = self.advance(i) <del> self.advance(len(c)) <del> return res <add> def consume(self, c): <add> if self.s[:len(c)] == c: <add> self.advance(len(c)) <add> return True <add> return False <ide> <del> @property <del> def next(self): <del> return self.s[0] <add> def consume_until(self, c): <add> if callable(c): <add> i = 0 <add> while i < len(self.s) and not c(self.s[i]): <add> i = i + 1 <add> return self.advance(i) <add> else: <add> i = self.s.index(c) <add> res = self.advance(i) <add> self.advance(len(c)) <add> return res <ide> <del> def __bool__(self): <del> return bool(self.s) <del> __nonzero__ = __bool__ <add> @property <add> def next(self): <add> return self.s[0] <ide> <del> stream = Stream(spec) <add> def __bool__(self): <add> return bool(self.s) <add> __nonzero__ = __bool__ <ide> <add> <add>def _dtype_from_pep3118(spec): <add> stream = _Stream(spec) <ide> dtype, align = __dtype_from_pep3118(stream, is_subdtype=False) <ide> return dtype <ide> <ide><path>numpy/tests/test_ctypeslib.py <ide> def check(x): <ide> check(as_array(pointer(c_array), shape=())) <ide> check(as_array(pointer(c_array[0]), shape=(2,))) <ide> check(as_array(pointer(c_array[0][0]), shape=(2, 3))) <add> <add> def test_reference_cycles(self): <add> # related to gh-6511 <add> import ctypes <add> <add> # create array to work with <add> # don't use int/long to avoid running into bpo-10746 <add> N = 100 <add> a = np.arange(N, dtype=np.short) <add> <add> # get pointer to array <add> pnt = np.ctypeslib.as_ctypes(a) <add> <add> with np.testing.assert_no_gc_cycles(): <add> # decay the array above to a pointer to its first element <add> newpnt = ctypes.cast(pnt, ctypes.POINTER(ctypes.c_short)) <add> # and construct an array using this data <add> b = np.ctypeslib.as_array(newpnt, (N,)) <add> # now delete both, which should cleanup both objects <add> del newpnt, b
2
Go
Go
fix race on shutting down
ce9e9ff4a101eec5632704003fae772e8762eb15
<ide><path>server/server.go <ide> import ( <ide> "strconv" <ide> "strings" <ide> "sync" <add> "sync/atomic" <ide> "syscall" <ide> "time" <ide> <ide> func InitServer(job *engine.Job) engine.Status { <ide> c := make(chan os.Signal, 1) <ide> gosignal.Notify(c, os.Interrupt, syscall.SIGTERM, syscall.SIGQUIT) <ide> go func() { <del> interruptCount := 0 <add> interruptCount := uint32(0) <ide> for sig := range c { <del> go func() { <add> go func(sig os.Signal) { <ide> log.Printf("Received signal '%v', starting shutdown of docker...\n", sig) <ide> switch sig { <ide> case os.Interrupt, syscall.SIGTERM: <ide> // If the user really wants to interrupt, let him do so. <del> if interruptCount < 3 { <del> interruptCount++ <add> if atomic.LoadUint32(&interruptCount) < 3 { <add> atomic.AddUint32(&interruptCount, 1) <ide> // Initiate the cleanup only once <del> if interruptCount == 1 { <add> if atomic.LoadUint32(&interruptCount) == 1 { <ide> utils.RemovePidFile(srv.daemon.Config().Pidfile) <ide> srv.Close() <ide> } else { <ide> func InitServer(job *engine.Job) engine.Status { <ide> case syscall.SIGQUIT: <ide> } <ide> os.Exit(128 + int(sig.(syscall.Signal))) <del> }() <add> }(sig) <ide> } <ide> }() <ide> job.Eng.Hack_SetGlobalVar("httpapi.server", srv)
1
Python
Python
check response status in slack webhook hook.
4fb5c017fe5ca41ed95547a857c9c39efc4f1476
<ide><path>airflow/providers/slack/hooks/slack_webhook.py <ide> def execute(self) -> None: <ide> endpoint=self.webhook_token, <ide> data=slack_message, <ide> headers={'Content-type': 'application/json'}, <del> extra_options={'proxies': proxies}, <add> extra_options={'proxies': proxies, 'check_response': True}, <ide> )
1
Java
Java
move metadataextractor to the rsocket package
d33e4878a0dad8745925188c5334f45076a0ea3b
<add><path>spring-messaging/src/main/java/org/springframework/messaging/rsocket/DefaultMetadataExtractor.java <del><path>spring-messaging/src/main/java/org/springframework/messaging/rsocket/annotation/support/DefaultMetadataExtractor.java <ide> * See the License for the specific language governing permissions and <ide> * limitations under the License. <ide> */ <del>package org.springframework.messaging.rsocket.annotation.support; <add>package org.springframework.messaging.rsocket; <ide> <ide> import java.util.Collections; <ide> import java.util.HashMap; <ide> import org.springframework.core.io.buffer.DataBufferFactory; <ide> import org.springframework.core.io.buffer.NettyDataBufferFactory; <ide> import org.springframework.lang.Nullable; <del>import org.springframework.messaging.rsocket.RSocketStrategies; <ide> import org.springframework.util.Assert; <ide> import org.springframework.util.MimeType; <ide> <ide> public DefaultMetadataExtractor(RSocketStrategies strategies) { <ide> Assert.notNull(strategies, "RSocketStrategies is required"); <ide> this.rsocketStrategies = strategies; <ide> // TODO: remove when rsocket-core API available <del> metadataToExtract(MessagingRSocket.ROUTING, String.class, ROUTE_KEY); <add> metadataToExtract(MetadataExtractor.ROUTING, String.class, ROUTE_KEY); <ide> } <ide> <ide> <ide> public <T> void metadataToExtract( <ide> @Override <ide> public Map<String, Object> extract(Payload payload, MimeType metadataMimeType) { <ide> Map<String, Object> result = new HashMap<>(); <del> if (metadataMimeType.equals(MessagingRSocket.COMPOSITE_METADATA)) { <add> if (metadataMimeType.equals(COMPOSITE_METADATA)) { <ide> for (CompositeMetadata.Entry entry : new CompositeMetadata(payload.metadata(), false)) { <ide> processEntry(entry.getContent(), entry.getMimeType(), result); <ide> } <ide> private void processEntry(ByteBuf content, @Nullable String mimeType, Map<String <ide> entryProcessor.process(content, result); <ide> return; <ide> } <del> if (MessagingRSocket.ROUTING.toString().equals(mimeType)) { <add> if (MetadataExtractor.ROUTING.toString().equals(mimeType)) { <ide> // TODO: use rsocket-core API when available <ide> } <ide> } <add><path>spring-messaging/src/main/java/org/springframework/messaging/rsocket/MetadataExtractor.java <del><path>spring-messaging/src/main/java/org/springframework/messaging/rsocket/annotation/support/MetadataExtractor.java <ide> * See the License for the specific language governing permissions and <ide> * limitations under the License. <ide> */ <del>package org.springframework.messaging.rsocket.annotation.support; <add>package org.springframework.messaging.rsocket; <ide> <ide> import java.util.Map; <ide> <ide> public interface MetadataExtractor { <ide> */ <ide> String ROUTE_KEY = "route"; <ide> <add> /** <add> * Constant for mime type {@code message/x.rsocket.composite-metadata.v0}. <add> */ <add> MimeType COMPOSITE_METADATA = new MimeType("message", "x.rsocket.composite-metadata.v0"); <add> <add> /** <add> * Constant for mime type {@code message/x.rsocket.routing.v0}. <add> */ <add> MimeType ROUTING = new MimeType("message", "x.rsocket.routing.v0"); <add> <ide> <ide> /** <ide> * Extract a map of values from the given {@link Payload} metadata. <ide><path>spring-messaging/src/main/java/org/springframework/messaging/rsocket/annotation/support/ClientResponderFactory.java <ide> <ide> import org.springframework.messaging.handler.invocation.reactive.ArgumentResolverConfigurer; <ide> import org.springframework.messaging.handler.invocation.reactive.ReturnValueHandlerConfigurer; <add>import org.springframework.messaging.rsocket.MetadataExtractor; <ide> import org.springframework.messaging.rsocket.RSocketStrategies; <ide> import org.springframework.util.RouteMatcher; <ide> <ide><path>spring-messaging/src/main/java/org/springframework/messaging/rsocket/annotation/support/DefaultClientResponderFactory.java <ide> import org.springframework.lang.Nullable; <ide> import org.springframework.messaging.handler.invocation.reactive.ArgumentResolverConfigurer; <ide> import org.springframework.messaging.handler.invocation.reactive.ReturnValueHandlerConfigurer; <add>import org.springframework.messaging.rsocket.MetadataExtractor; <ide> import org.springframework.messaging.rsocket.RSocketStrategies; <ide> import org.springframework.util.Assert; <ide> import org.springframework.util.RouteMatcher; <ide><path>spring-messaging/src/main/java/org/springframework/messaging/rsocket/annotation/support/MessagingRSocket.java <ide> import org.springframework.messaging.ReactiveMessageHandler; <ide> import org.springframework.messaging.handler.DestinationPatternsMessageCondition; <ide> import org.springframework.messaging.handler.invocation.reactive.HandlerMethodReturnValueHandler; <add>import org.springframework.messaging.rsocket.MetadataExtractor; <ide> import org.springframework.messaging.rsocket.PayloadUtils; <ide> import org.springframework.messaging.rsocket.RSocketRequester; <ide> import org.springframework.messaging.support.MessageBuilder; <ide> */ <ide> class MessagingRSocket extends AbstractRSocket { <ide> <del> static final MimeType COMPOSITE_METADATA = new MimeType("message", "x.rsocket.composite-metadata.v0"); <del> <del> static final MimeType ROUTING = new MimeType("message", "x.rsocket.routing.v0"); <del> <del> <ide> private final MimeType dataMimeType; <ide> <ide> private final MimeType metadataMimeType; <ide><path>spring-messaging/src/main/java/org/springframework/messaging/rsocket/annotation/support/RSocketMessageHandler.java <ide> import org.springframework.messaging.handler.annotation.MessageMapping; <ide> import org.springframework.messaging.handler.annotation.reactive.MessageMappingMessageHandler; <ide> import org.springframework.messaging.handler.invocation.reactive.HandlerMethodReturnValueHandler; <add>import org.springframework.messaging.rsocket.DefaultMetadataExtractor; <add>import org.springframework.messaging.rsocket.MetadataExtractor; <ide> import org.springframework.messaging.rsocket.RSocketRequester; <ide> import org.springframework.messaging.rsocket.RSocketStrategies; <ide> import org.springframework.messaging.rsocket.annotation.ConnectMapping; <ide> public class RSocketMessageHandler extends MessageMappingMessageHandler { <ide> @Nullable <ide> private MimeType defaultDataMimeType; <ide> <del> private MimeType defaultMetadataMimeType = MessagingRSocket.COMPOSITE_METADATA; <add> private MimeType defaultMetadataMimeType = MetadataExtractor.COMPOSITE_METADATA; <ide> <ide> <ide> /** <add><path>spring-messaging/src/test/java/org/springframework/messaging/rsocket/DefaultMetadataExtractorTests.java <del><path>spring-messaging/src/test/java/org/springframework/messaging/rsocket/annotation/support/DefaultMetadataExtractorTests.java <ide> * See the License for the specific language governing permissions and <ide> * limitations under the License. <ide> */ <del>package org.springframework.messaging.rsocket.annotation.support; <add>package org.springframework.messaging.rsocket; <ide> <ide> import java.time.Duration; <ide> import java.util.Map; <ide> import org.springframework.core.codec.CharSequenceEncoder; <ide> import org.springframework.core.codec.StringDecoder; <ide> import org.springframework.core.io.buffer.DataBufferFactory; <del>import org.springframework.messaging.rsocket.LeakAwareNettyDataBufferFactory; <del>import org.springframework.messaging.rsocket.RSocketRequester; <del>import org.springframework.messaging.rsocket.RSocketStrategies; <ide> import org.springframework.util.Assert; <ide> import org.springframework.util.MimeType; <ide> <ide> import static org.assertj.core.api.Assertions.assertThat; <del>import static org.springframework.messaging.rsocket.annotation.support.MessagingRSocket.COMPOSITE_METADATA; <del>import static org.springframework.messaging.rsocket.annotation.support.MessagingRSocket.ROUTING; <del>import static org.springframework.messaging.rsocket.annotation.support.MetadataExtractor.ROUTE_KEY; <add>import static org.springframework.messaging.rsocket.MetadataExtractor.COMPOSITE_METADATA; <add>import static org.springframework.messaging.rsocket.MetadataExtractor.ROUTE_KEY; <add>import static org.springframework.messaging.rsocket.MetadataExtractor.ROUTING; <ide> import static org.springframework.util.MimeTypeUtils.TEXT_HTML; <ide> import static org.springframework.util.MimeTypeUtils.TEXT_PLAIN; <ide> import static org.springframework.util.MimeTypeUtils.TEXT_XML;
7
PHP
PHP
fix deprecation warning
d39d92df9b3c509d40b971207f03eb7f04087370
<ide><path>src/Illuminate/Collections/Arr.php <ide> public static function exists($array, $key) <ide> return $array->offsetExists($key); <ide> } <ide> <add> if (is_float($key)) { <add> $key = (string) $key; <add> } <add> <ide> return array_key_exists($key, $array); <ide> } <ide>
1
Javascript
Javascript
remove a duplicate test
33c3121f43bfbfa18d6ab0b98f3d447b713023a8
<ide><path>src/renderers/shared/shared/__tests__/ReactStatelessComponent-test.js <ide> describe('ReactStatelessComponent', () => { <ide> expect(() => ReactTestUtils.renderIntoDocument(<Child />)).not.toThrow(); <ide> }); <ide> <del> it('should warn when using non-React functions in JSX', () => { <del> spyOn(console, 'error'); <del> function NotAComponent() { <del> return [<div />, <div />]; <del> } <del> expect(function() { <del> ReactTestUtils.renderIntoDocument(<div><NotAComponent /></div>); <del> }).toThrow(); // has no method 'render' <del> expectDev(console.error.calls.count()).toBe(1); <del> expectDev(console.error.calls.argsFor(0)[0]).toContain( <del> 'NotAComponent(...): A valid React element (or null) must be returned. You may ' + <del> 'have returned undefined, an array or some other invalid object.' <del> ); <del> }); <ide> });
1
Javascript
Javascript
fix bugs related to paths with trailing slashes"
7be27240b5b4f9a362c63b854e5e55890b858912
<ide><path>lib/path.js <ide> if (isWindows) { <ide> // 'root' is just a slash, or nothing. <ide> var splitPathRe = <ide> /^(\/?)([\s\S]+\/(?!$)|\/)?((?:\.{1,2}$|[\s\S]+?)?(\.[^.\/]*)?)$/; <del> var trailingSlash = /\/+$/; <ide> var splitPath = function(filename) { <del> <del> // removes trailing slashes before spliting the path <del> var tail = trailingSlash.exec(filename); <del> if (tail) { <del> if (tail.index === 0) return ['/', '', '', '']; <del> <del> filename = filename.slice(0, tail.index); <del> } <del> <ide> var result = splitPathRe.exec(filename); <ide> return [result[1] || '', result[2] || '', result[3] || '', result[4] || '']; <ide> }; <ide><path>test/simple/test-path.js <ide> var f = __filename; <ide> <ide> assert.equal(path.basename(f), 'test-path.js'); <ide> assert.equal(path.basename(f, '.js'), 'test-path'); <del>assert.equal(path.basename('/dir/basename.ext'), 'basename.ext'); <del>assert.equal(path.basename('/basename.ext'), 'basename.ext'); <del>assert.equal(path.basename('basename.ext'), 'basename.ext'); <del>assert.equal(path.basename('basename.ext/'), 'basename.ext'); <del>assert.equal(path.basename('basename.ext//'), 'basename.ext'); <ide> <ide> // POSIX filenames may include control characters <ide> // c.f. http://www.dwheeler.com/essays/fixing-unix-linux-filenames.html <ide> assert.equal(path.dirname('/a/b/'), '/a'); <ide> assert.equal(path.dirname('/a/b'), '/a'); <ide> assert.equal(path.dirname('/a'), '/'); <ide> assert.equal(path.dirname('/'), '/'); <del>assert.equal(path.dirname('////'), '/'); <ide> <ide> if (isWindows) { <ide> assert.equal(path.dirname('c:\\'), 'c:\\'); <ide> assert.equal(path.extname('..file..'), '.'); <ide> assert.equal(path.extname('...'), '.'); <ide> assert.equal(path.extname('...ext'), '.ext'); <ide> assert.equal(path.extname('....'), '.'); <del>assert.equal(path.extname('file.ext/'), '.ext'); <del>assert.equal(path.extname('file.ext//'), '.ext'); <add>assert.equal(path.extname('file.ext/'), ''); <ide> <ide> if (isWindows) { <ide> // On windows, backspace is a path separator.
2
Text
Text
add my pronoun
e75163f73e6556d6b091167945ad1fa947f40be0
<ide><path>README.md <ide> For more information about the governance of the Node.js project, see <ide> * [brendanashworth](https://github.com/brendanashworth) - <ide> **Brendan Ashworth** &lt;brendan.ashworth@me.com&gt; <ide> * [BridgeAR](https://github.com/BridgeAR) - <del>**Ruben Bridgewater** &lt;ruben@bridgewater.de&gt; <add>**Ruben Bridgewater** &lt;ruben@bridgewater.de&gt; (he/him) <ide> * [bzoz](https://github.com/bzoz) - <ide> **Bartosz Sosnowski** &lt;bartosz@janeasystems.com&gt; <ide> * [calvinmetcalf](https://github.com/calvinmetcalf) -
1
PHP
PHP
update listenermakecommand.php
346d352d15802b4fdbd692595235e23e2e12ba6c
<ide><path>src/Illuminate/Foundation/Console/ListenerMakeCommand.php <ide> protected function buildClass($name) <ide> { <ide> $event = $this->option('event'); <ide> <del> if (! Str::startsWith($event, $this->laravel->getNamespace()) && <del> ! Str::startsWith($event, 'Illuminate')) { <add> if (! Str::startsWith($event, [ <add> $this->laravel->getNamespace(), <add> 'Illuminate', <add> '\\', <add> ])) { <ide> $event = $this->laravel->getNamespace().'Events\\'.$event; <ide> } <ide>
1
Java
Java
set event category for touch events on android
155a1a8ac94023e7b0c114f735a2dbd4ceab79e2
<ide><path>ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java <ide> import com.facebook.react.common.mapbuffer.ReadableMapBuffer; <ide> import com.facebook.react.config.ReactFeatureFlags; <ide> import com.facebook.react.fabric.events.EventBeatManager; <add>import com.facebook.react.fabric.events.EventCategoryDef; <ide> import com.facebook.react.fabric.events.EventEmitterWrapper; <ide> import com.facebook.react.fabric.events.FabricEventEmitter; <ide> import com.facebook.react.fabric.mounting.MountItemDispatcher; <ide> public void receiveEvent( <ide> receiveEvent(surfaceId, reactTag, eventName, false, 0, params); <ide> } <ide> <add> public void receiveEvent( <add> int surfaceId, <add> int reactTag, <add> String eventName, <add> boolean canCoalesceEvent, <add> int customCoalesceKey, <add> @Nullable WritableMap params) { <add> receiveEvent( <add> surfaceId, <add> reactTag, <add> eventName, <add> canCoalesceEvent, <add> customCoalesceKey, <add> params, <add> EventCategoryDef.UNSPECIFIED); <add> } <add> <ide> /** <ide> * receiveEvent API that emits an event to C++. If `canCoalesceEvent` is true, that signals that <ide> * C++ may coalesce the event optionally. Otherwise, coalescing can happen in Java before <ide> public void receiveEvent( <ide> * @param canCoalesceEvent <ide> * @param customCoalesceKey <ide> * @param params <add> * @param eventCategory <ide> */ <ide> public void receiveEvent( <ide> int surfaceId, <ide> int reactTag, <ide> String eventName, <ide> boolean canCoalesceEvent, <ide> int customCoalesceKey, <del> @Nullable WritableMap params) { <add> @Nullable WritableMap params, <add> @EventCategoryDef int eventCategory) { <ide> if (ReactBuildConfig.DEBUG && surfaceId == View.NO_ID) { <ide> FLog.d(TAG, "Emitted event without surfaceId: [%d] %s", reactTag, eventName); <ide> } <ide> public void receiveEvent( <ide> if (canCoalesceEvent) { <ide> eventEmitter.invokeUnique(eventName, params, customCoalesceKey); <ide> } else { <del> eventEmitter.invoke(eventName, params); <add> eventEmitter.invoke(eventName, params, eventCategory); <ide> } <ide> } <ide> <ide><path>ReactAndroid/src/main/java/com/facebook/react/fabric/events/EventEmitterWrapper.java <ide> private native void invokeUniqueEvent( <ide> * @param eventName {@link String} name of the event to execute. <ide> * @param params {@link WritableMap} payload of the event <ide> */ <del> public synchronized void invoke(@NonNull String eventName, @Nullable WritableMap params) { <add> public synchronized void invoke( <add> @NonNull String eventName, <add> @Nullable WritableMap params, <add> @EventCategoryDef int eventCategory) { <ide> if (!isValid()) { <ide> return; <ide> } <ide> NativeMap payload = params == null ? new WritableNativeMap() : (NativeMap) params; <del> invokeEvent(eventName, payload, EventCategoryDef.UNSPECIFIED); <add> invokeEvent(eventName, payload, eventCategory); <ide> } <ide> <ide> /** <ide><path>ReactAndroid/src/main/java/com/facebook/react/fabric/events/FabricEventEmitter.java <ide> import static com.facebook.react.uimanager.events.TouchesHelper.CHANGED_TOUCHES_KEY; <ide> import static com.facebook.react.uimanager.events.TouchesHelper.TARGET_KEY; <ide> import static com.facebook.react.uimanager.events.TouchesHelper.TARGET_SURFACE_KEY; <del>import static com.facebook.react.uimanager.events.TouchesHelper.TOP_TOUCH_CANCEL_KEY; <del>import static com.facebook.react.uimanager.events.TouchesHelper.TOP_TOUCH_END_KEY; <ide> import static com.facebook.react.uimanager.events.TouchesHelper.TOUCHES_KEY; <ide> <ide> import android.util.Pair; <ide> import com.facebook.react.bridge.WritableNativeMap; <ide> import com.facebook.react.fabric.FabricUIManager; <ide> import com.facebook.react.uimanager.events.RCTModernEventEmitter; <add>import com.facebook.react.uimanager.events.TouchEventType; <ide> import com.facebook.systrace.Systrace; <ide> import java.util.HashSet; <ide> import java.util.Set; <ide> public void receiveTouches( <ide> @NonNull String eventTopLevelType, <ide> @NonNull WritableArray touches, <ide> @NonNull WritableArray changedIndices) { <add> Systrace.beginSection( <add> Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, <add> "FabricEventEmitter.receiveTouches('" + eventTopLevelType + "')"); <add> <add> boolean isPointerEndEvent = <add> TouchEventType.END.getJsName().equalsIgnoreCase(eventTopLevelType) <add> || TouchEventType.CANCEL.getJsName().equalsIgnoreCase(eventTopLevelType); <add> <ide> Pair<WritableArray, WritableArray> result = <del> TOP_TOUCH_END_KEY.equalsIgnoreCase(eventTopLevelType) <del> || TOP_TOUCH_CANCEL_KEY.equalsIgnoreCase(eventTopLevelType) <add> isPointerEndEvent <ide> ? removeTouchesAtIndices(touches, changedIndices) <ide> : touchSubsequence(touches, changedIndices); <ide> <ide> WritableArray changedTouches = result.first; <ide> touches = result.second; <ide> <add> int eventCategory = getTouchCategory(eventTopLevelType); <ide> for (int jj = 0; jj < changedTouches.size(); jj++) { <ide> WritableMap touch = getWritableMap(changedTouches.getMap(jj)); <ide> // Touch objects can fulfill the role of `DOM` `Event` objects if we set <ide> public void receiveTouches( <ide> rootNodeID = targetReactTag; <ide> } <ide> <del> receiveEvent(targetSurfaceId, rootNodeID, eventTopLevelType, false, 0, touch); <add> mUIManager.receiveEvent( <add> targetSurfaceId, rootNodeID, eventTopLevelType, false, 0, touch, eventCategory); <ide> } <add> <add> Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE); <ide> } <ide> <ide> /** TODO T31905686 optimize this to avoid copying arrays */ <ide> private WritableArray copyWritableArray(@NonNull WritableArray array) { <ide> map.merge(readableMap); <ide> return map; <ide> } <add> <add> @EventCategoryDef <add> private static int getTouchCategory(String touchEventType) { <add> int category = EventCategoryDef.UNSPECIFIED; <add> if (TouchEventType.MOVE.getJsName().equals(touchEventType)) { <add> category = EventCategoryDef.CONTINUOUS; <add> } else if (TouchEventType.START.getJsName().equals(touchEventType)) { <add> category = EventCategoryDef.CONTINUOUS_START; <add> } else if (TouchEventType.END.getJsName().equals(touchEventType) <add> || TouchEventType.CANCEL.getJsName().equals(touchEventType)) { <add> category = EventCategoryDef.CONTINUOUS_END; <add> } <add> <add> return category; <add> } <ide> } <ide><path>ReactAndroid/src/main/java/com/facebook/react/uimanager/events/RCTEventEmitter.java <ide> public interface RCTEventEmitter extends JavaScriptModule { <ide> @Deprecated <ide> void receiveEvent(int targetTag, String eventName, @Nullable WritableMap event); <ide> <add> /** <add> * Receive and process touches <add> * <add> * @param eventName JS event name <add> * @param touches active pointers data <add> * @param changedIndices indices of changed pointers <add> */ <ide> void receiveTouches(String eventName, WritableArray touches, WritableArray changedIndices); <ide> } <ide><path>ReactAndroid/src/main/java/com/facebook/react/uimanager/events/TouchEventType.java <ide> <ide> /** Touch event types that JS module RCTEventEmitter can understand */ <ide> public enum TouchEventType { <del> START, <del> END, <del> MOVE, <del> CANCEL; <add> START("topTouchStart"), <add> END("topTouchEnd"), <add> MOVE("topTouchMove"), <add> CANCEL("topTouchCancel"); <add> <add> private final String mJsName; <add> <add> TouchEventType(String jsName) { <add> mJsName = jsName; <add> } <add> <add> public String getJsName() { <add> return mJsName; <add> } <ide> <ide> public static String getJSEventName(TouchEventType type) { <del> switch (type) { <del> case START: <del> return "topTouchStart"; <del> case END: <del> return "topTouchEnd"; <del> case MOVE: <del> return "topTouchMove"; <del> case CANCEL: <del> return "topTouchCancel"; <del> default: <del> throw new IllegalArgumentException("Unexpected type " + type); <del> } <add> return type.getJsName(); <ide> } <ide> } <ide><path>ReactAndroid/src/main/java/com/facebook/react/uimanager/events/TouchesHelper.java <ide> public class TouchesHelper { <ide> public static final String TARGET_KEY = "target"; <ide> public static final String CHANGED_TOUCHES_KEY = "changedTouches"; <ide> public static final String TOUCHES_KEY = "touches"; <del> public static final String TOP_TOUCH_END_KEY = "topTouchEnd"; <del> public static final String TOP_TOUCH_CANCEL_KEY = "topTouchCancel"; <ide> private static final String PAGE_X_KEY = "pageX"; <ide> private static final String PAGE_Y_KEY = "pageY"; <ide> private static final String TIMESTAMP_KEY = "timestamp";
6
Ruby
Ruby
reproduce the preloader regression in
c9a9dcd383de529cec6499677e3231265da00123
<ide><path>activerecord/test/cases/associations_test.rb <ide> require "models/bird" <ide> require "models/treasure" <ide> require "models/price_estimate" <add>require "models/invoice" <add>require "models/discount" <add>require "models/line_item" <add>require "models/shipping_line" <ide> <ide> class AssociationsTest < ActiveRecord::TestCase <ide> fixtures :accounts, :companies, :developers, :projects, :developers_projects, <ide> def test_preload_grouped_queries_of_through_records <ide> end <ide> end <ide> <add> def test_some_already_loaded_associations <add> item_discount = Discount.create(amount: 5) <add> shipping_discount = Discount.create(amount: 20) <add> <add> invoice = Invoice.new <add> line_item = LineItem.new(amount: 20) <add> line_item.discount_applications << LineItemDiscountApplication.new(discount: item_discount) <add> invoice.line_items << line_item <add> <add> shipping_line = ShippingLine.new(amount: 50) <add> shipping_line.discount_applications << ShippingLineDiscountApplication.new(discount: shipping_discount) <add> invoice.shipping_lines << shipping_line <add> <add> invoice.save! <add> invoice.reload <add> <add> # SELECT "line_items".* FROM "line_items" WHERE "line_items"."invoice_id" = ? <add> # SELECT "shipping_lines".* FROM shipping_lines WHERE "shipping_lines"."invoice_id" = ? <add> # SELECT "line_item_discount_applications".* FROM "line_item_discount_applications" WHERE "line_item_discount_applications"."line_item_id" = ? <add> # SELECT "shipping_line_discount_applications".* FROM "shipping_line_discount_applications" WHERE "shipping_line_discount_applications"."shipping_line_id" = ? <add> # SELECT "discounts".* FROM "discounts" WHERE "discounts"."id" IN (?, ?). <add> assert_queries(5) do <add> preloader = ActiveRecord::Associations::Preloader.new(records: [invoice], associations: [ <add> line_items: { discount_applications: :discount }, <add> shipping_lines: { discount_applications: :discount }, <add> ]) <add> preloader.call <add> end <add> <add> assert_no_queries do <add> assert_not_nil invoice.line_items.first.discount_applications.first.discount <add> assert_not_nil invoice.shipping_lines.first.discount_applications.first.discount <add> end <add> <add> invoice.reload <add> invoice.line_items.map { |i| i.discount_applications.to_a } <add> # `line_items` and `line_item_discount_applications` are already preloaded, so we expect: <add> # SELECT "shipping_lines".* FROM shipping_lines WHERE "shipping_lines"."invoice_id" = ? <add> # SELECT "shipping_line_discount_applications".* FROM "shipping_line_discount_applications" WHERE "shipping_line_discount_applications"."shipping_line_id" = ? <add> # SELECT "discounts".* FROM "discounts" WHERE "discounts"."id" = ?. <add> assert_queries(3) do <add> preloader = ActiveRecord::Associations::Preloader.new(records: [invoice], associations: [ <add> line_items: { discount_applications: :discount }, <add> shipping_lines: { discount_applications: :discount }, <add> ]) <add> preloader.call <add> end <add> <add> assert_no_queries do <add> assert_not_nil invoice.line_items.first.discount_applications.first.discount <add> assert_not_nil invoice.shipping_lines.first.discount_applications.first.discount <add> end <add> end <add> <ide> def test_preload_through <ide> comments = [ <ide> comments(:eager_sti_on_associations_s_comment1), <ide><path>activerecord/test/models/discount.rb <add># frozen_string_literal: true <add> <add>class Discount < ActiveRecord::Base <add>end <ide><path>activerecord/test/models/invoice.rb <ide> <ide> class Invoice < ActiveRecord::Base <ide> has_many :line_items, autosave: true <add> has_many :shipping_lines, -> { from("shipping_lines") }, autosave: true <ide> before_save { |record| record.balance = record.line_items.map(&:amount).sum } <ide> end <ide><path>activerecord/test/models/line_item.rb <ide> <ide> class LineItem < ActiveRecord::Base <ide> belongs_to :invoice, touch: true <add> has_many :discount_applications, class_name: "LineItemDiscountApplication" <add>end <add> <add>class LineItemDiscountApplication < ActiveRecord::Base <add> belongs_to :line_item <add> belongs_to :discount <ide> end <ide><path>activerecord/test/models/shipping_line.rb <add># frozen_string_literal: true <add> <add>class ShippingLine < ActiveRecord::Base <add> belongs_to :invoice, touch: true <add> has_many :discount_applications, class_name: "ShippingLineDiscountApplication" <add>end <add> <add>class ShippingLineDiscountApplication < ActiveRecord::Base <add> belongs_to :shipping_line <add> belongs_to :discount <add>end <ide><path>activerecord/test/schema/schema.rb <ide> t.boolean :deleted <ide> end <ide> <add> create_table :discounts, force: true do |t| <add> t.integer :amount <add> end <add> <ide> create_table :dl_keyed_belongs_tos, force: true, id: false do |t| <ide> t.primary_key :belongs_key <ide> t.references :destroy_async_parent <ide> t.integer :amount <ide> end <ide> <add> create_table :line_item_discount_applications, force: true do |t| <add> t.integer :line_item_id <add> t.integer :discount_id <add> end <add> <ide> create_table :lions, force: true do |t| <ide> t.integer :gender <ide> t.boolean :is_vegetarian, default: false <ide> t.integer :shape_id <ide> end <ide> <add> create_table :shipping_lines, force: true do |t| <add> t.integer :invoice_id <add> t.integer :amount <add> end <add> <add> create_table :shipping_line_discount_applications, force: true do |t| <add> t.integer :shipping_line_id <add> t.integer :discount_id <add> end <add> <ide> create_table :ships, force: true do |t| <ide> t.string :name <ide> t.integer :pirate_id
6
Javascript
Javascript
support texture format in gltfloader
cfacb47f9ab14e17d926a2cea888df4ab0f69a0e
<ide><path>examples/js/loaders/GLTFLoader.js <ide> THREE.GLTFLoader = ( function () { <ide> <ide> if ( texture.name !== undefined ) _texture.name = texture.name; <ide> <add> _texture.format = texture.format !== undefined ? WEBGL_TEXTURE_FORMATS[ texture.format ] : THREE.RGBAFormat; <add> <add> if ( texture.internalFormat !== undefined && _texture.format !== WEBGL_TEXTURE_FORMATS[ texture.internalFormat ] ) { <add> <add> console.warn( 'THREE.GLTFLoader: Three.js doesn\'t support texture internalFormat which is different from texture format. ' + <add> 'internalFormat will be forced to be the same value as format.' ); <add> <add> } <add> <ide> _texture.type = texture.type !== undefined ? WEBGL_TEXTURE_TYPES[ texture.type ] : THREE.UnsignedByteType; <ide> <ide> if ( texture.sampler ) {
1
PHP
PHP
add missing articles
6319d94ccaf8169b103813a82139814573ddef09
<ide><path>src/Illuminate/Auth/GuardHelpers.php <ide> trait GuardHelpers <ide> protected $provider; <ide> <ide> /** <del> * Determine if current user is authenticated. If not, throw an exception. <add> * Determine if the current user is authenticated. If not, throw an exception. <ide> * <ide> * @return \Illuminate\Contracts\Auth\Authenticatable <ide> * <ide><path>src/Illuminate/Broadcasting/Broadcasters/AblyBroadcaster.php <ide> public function broadcast(array $channels, $event, array $payload = []) <ide> } <ide> <ide> /** <del> * Return true if channel is protected by authentication. <add> * Return true if the channel is protected by authentication. <ide> * <ide> * @param string $channel <ide> * @return bool <ide><path>src/Illuminate/Broadcasting/Broadcasters/UsePusherChannelConventions.php <ide> trait UsePusherChannelConventions <ide> { <ide> /** <del> * Return true if channel is protected by authentication. <add> * Return true if the channel is protected by authentication. <ide> * <ide> * @param string $channel <ide> * @return bool <ide><path>src/Illuminate/Console/Scheduling/Event.php <ide> class Event <ide> public $expiresAt = 1440; <ide> <ide> /** <del> * Indicates if the command should run in background. <add> * Indicates if the command should run in the background. <ide> * <ide> * @var bool <ide> */ <ide> protected function pingCallback($url) <ide> } <ide> <ide> /** <del> * State that the command should run in background. <add> * State that the command should run in the background. <ide> * <ide> * @return $this <ide> */ <ide><path>src/Illuminate/Database/Eloquent/Concerns/GuardsAttributes.php <ide> public static function reguard() <ide> } <ide> <ide> /** <del> * Determine if current state is "unguarded". <add> * Determine if the current state is "unguarded". <ide> * <ide> * @return bool <ide> */ <ide><path>src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php <ide> protected function hasChanges($changes, $attributes = null) <ide> } <ide> <ide> /** <del> * Get the attributes that have been changed since last sync. <add> * Get the attributes that have been changed since the last sync. <ide> * <ide> * @return array <ide> */ <ide><path>src/Illuminate/Database/Eloquent/Model.php <ide> public function delete() <ide> /** <ide> * Force a hard delete on a soft deleted model. <ide> * <del> * This method protects developers from running forceDelete when trait is missing. <add> * This method protects developers from running forceDelete when the trait is missing. <ide> * <ide> * @return bool|null <ide> */ <ide><path>src/Illuminate/Database/Eloquent/Relations/BelongsToMany.php <ide> public function orderByPivot($column, $direction = 'asc') <ide> } <ide> <ide> /** <del> * Find a related model by its primary key or return new instance of the related model. <add> * Find a related model by its primary key or return a new instance of the related model. <ide> * <ide> * @param mixed $id <ide> * @param array $columns <ide><path>src/Illuminate/Database/Eloquent/Relations/HasOneOrMany.php <ide> protected function buildDictionary(Collection $results) <ide> } <ide> <ide> /** <del> * Find a model by its primary key or return new instance of the related model. <add> * Find a model by its primary key or return a new instance of the related model. <ide> * <ide> * @param mixed $id <ide> * @param array $columns <ide><path>src/Illuminate/Database/Eloquent/Relations/Relation.php <ide> abstract class Relation <ide> protected static $constraints = true; <ide> <ide> /** <del> * An array to map class names to their morph names in database. <add> * An array to map class names to their morph names in the database. <ide> * <ide> * @var array <ide> */ <ide><path>src/Illuminate/Database/Migrations/MigrationRepositoryInterface.php <ide> interface MigrationRepositoryInterface <ide> public function getRan(); <ide> <ide> /** <del> * Get list of migrations. <add> * Get the list of migrations. <ide> * <ide> * @param int $steps <ide> * @return array <ide><path>src/Illuminate/Events/Dispatcher.php <ide> protected function shouldBroadcast(array $payload) <ide> } <ide> <ide> /** <del> * Check if event should be broadcasted by condition. <add> * Check if the event should be broadcasted by the condition. <ide> * <ide> * @param mixed $event <ide> * @return bool <ide><path>src/Illuminate/Foundation/Application.php <ide> public function environment(...$environments) <ide> } <ide> <ide> /** <del> * Determine if application is in local environment. <add> * Determine if the application is in the local environment. <ide> * <ide> * @return bool <ide> */ <ide> public function isLocal() <ide> } <ide> <ide> /** <del> * Determine if application is in production environment. <add> * Determine if the application is in the production environment. <ide> * <ide> * @return bool <ide> */ <ide> public function setFallbackLocale($fallbackLocale) <ide> } <ide> <ide> /** <del> * Determine if application locale is the given locale. <add> * Determine if the application locale is the given locale. <ide> * <ide> * @param string $locale <ide> * @return bool <ide><path>src/Illuminate/Foundation/Console/ServeCommand.php <ide> protected function port() <ide> } <ide> <ide> /** <del> * Check if command has reached its max amount of port tries. <add> * Check if the command has reached its max amount of port tries. <ide> * <ide> * @return bool <ide> */ <ide><path>src/Illuminate/Foundation/Http/Kernel.php <ide> public function hasMiddleware($middleware) <ide> } <ide> <ide> /** <del> * Add a new middleware to beginning of the stack if it does not already exist. <add> * Add a new middleware to the beginning of the stack if it does not already exist. <ide> * <ide> * @param string $middleware <ide> * @return $this <ide><path>src/Illuminate/Http/Resources/Json/JsonResource.php <ide> public static function make(...$parameters) <ide> } <ide> <ide> /** <del> * Create new anonymous resource collection. <add> * Create a new anonymous resource collection. <ide> * <ide> * @param mixed $resource <ide> * @return \Illuminate\Http\Resources\Json\AnonymousResourceCollection <ide><path>src/Illuminate/Http/Resources/MergeValue.php <ide> class MergeValue <ide> public $data; <ide> <ide> /** <del> * Create new merge value instance. <add> * Create a new merge value instance. <ide> * <ide> * @param \Illuminate\Support\Collection|\JsonSerializable|array $data <ide> * @return void <ide><path>src/Illuminate/Mail/SendQueuedMailable.php <ide> public function failed($e) <ide> } <ide> <ide> /** <del> * Get number of seconds before a released mailable will be available. <add> * Get the number of seconds before a released mailable will be available. <ide> * <ide> * @return mixed <ide> */ <ide><path>src/Illuminate/Notifications/SendQueuedNotifications.php <ide> public function failed($e) <ide> } <ide> <ide> /** <del> * Get number of seconds before a released notification will be available. <add> * Get the number of seconds before a released notification will be available. <ide> * <ide> * @return mixed <ide> */ <ide><path>src/Illuminate/Pagination/AbstractPaginator.php <ide> public function __call($method, $parameters) <ide> } <ide> <ide> /** <del> * Render the contents of the paginator when casting to string. <add> * Render the contents of the paginator when casting to a string. <ide> * <ide> * @return string <ide> */ <ide><path>src/Illuminate/Queue/Middleware/RateLimited.php <ide> protected function handleJob($job, $next, array $limits) <ide> } <ide> <ide> /** <del> * Do not release the job back to the queue if limit is exceeded. <add> * Do not release the job back to the queue if the limit is exceeded. <ide> * <ide> * @return $this <ide> */ <ide><path>src/Illuminate/Queue/WorkerOptions.php <ide> class WorkerOptions <ide> public $force; <ide> <ide> /** <del> * Indicates if the worker should stop when queue is empty. <add> * Indicates if the worker should stop when the queue is empty. <ide> * <ide> * @var bool <ide> */ <ide><path>src/Illuminate/Redis/Connections/PhpRedisConnection.php <ide> public function mget(array $keys) <ide> } <ide> <ide> /** <del> * Set the string value in argument as value of the key. <add> * Set the string value in the argument as the value of the key. <ide> * <ide> * @param string $key <ide> * @param mixed $value <ide> public function disconnect() <ide> } <ide> <ide> /** <del> * Apply prefix to the given key if necessary. <add> * Apply a prefix to the given key if necessary. <ide> * <ide> * @param string $key <ide> * @return string <ide><path>src/Illuminate/Redis/Connectors/PhpRedisConnector.php <ide> public function connectToCluster(array $config, array $clusterOptions, array $op <ide> } <ide> <ide> /** <del> * Build a single cluster seed string from array. <add> * Build a single cluster seed string from an array. <ide> * <ide> * @param array $server <ide> * @return string <ide><path>src/Illuminate/Routing/Console/ControllerMakeCommand.php <ide> protected function getDefaultNamespace($rootNamespace) <ide> /** <ide> * Build the class with the given name. <ide> * <del> * Remove the base controller import if we are already in base namespace. <add> * Remove the base controller import if we are already in the base namespace. <ide> * <ide> * @param string $name <ide> * @return string <ide><path>src/Illuminate/Support/DateFactory.php <ide> public function __call($method, $parameters) <ide> return $dateClass::$method(...$parameters); <ide> } <ide> <del> // If that fails, create the date with the default class.. <add> // If that fails, create the date with the default class... <ide> $date = $defaultClassName::$method(...$parameters); <ide> <ide> // If the configured class has an "instance" method, we'll try to pass our date into there... <ide><path>src/Illuminate/Support/Str.php <ide> public static function studly($value) <ide> } <ide> <ide> /** <del> * Returns the portion of string specified by the start and length parameters. <add> * Returns the portion of the string specified by the start and length parameters. <ide> * <ide> * @param string $string <ide> * @param int $start <ide><path>src/Illuminate/Support/Stringable.php <ide> public function studly() <ide> } <ide> <ide> /** <del> * Returns the portion of string specified by the start and length parameters. <add> * Returns the portion of the string specified by the start and length parameters. <ide> * <ide> * @param int $start <ide> * @param int|null $length <ide><path>src/Illuminate/Testing/PendingCommand.php <ide> class PendingCommand <ide> protected $expectedExitCode; <ide> <ide> /** <del> * Determine if command has executed. <add> * Determine if the command has executed. <ide> * <ide> * @var bool <ide> */ <ide><path>src/Illuminate/Validation/Concerns/FormatsMessages.php <ide> protected function getFromLocalArray($attribute, $lowerRule, $source = null) <ide> } <ide> <ide> /** <del> * Get the custom error message from translator. <add> * Get the custom error message from the translator. <ide> * <ide> * @param string $key <ide> * @return string <ide><path>src/Illuminate/Validation/ValidationData.php <ide> class ValidationData <ide> { <ide> /** <del> * Initialize and gather data for given attribute. <add> * Initialize and gather data for the given attribute. <ide> * <ide> * @param string $attribute <ide> * @param array $masterData <ide><path>src/Illuminate/View/Compilers/BladeCompiler.php <ide> class BladeCompiler extends Compiler implements CompilerInterface <ide> protected $echoFormat = 'e(%s)'; <ide> <ide> /** <del> * Array of footer lines to be added to template. <add> * Array of footer lines to be added to the template. <ide> * <ide> * @var array <ide> */ <ide><path>src/Illuminate/View/Compilers/ComponentTagCompiler.php <ide> class ComponentTagCompiler <ide> protected $boundAttributes = []; <ide> <ide> /** <del> * Create new component tag compiler. <add> * Create a new component tag compiler. <ide> * <ide> * @param array $aliases <ide> * @param array $namespaces <ide><path>src/Illuminate/View/Compilers/Concerns/CompilesConditionals.php <ide> trait CompilesConditionals <ide> { <ide> /** <del> * Identifier for the first case in switch statement. <add> * Identifier for the first case in the switch statement. <ide> * <ide> * @var bool <ide> */ <ide><path>src/Illuminate/View/Concerns/ManagesLayouts.php <ide> public static function parentPlaceholder($section = '') <ide> } <ide> <ide> /** <del> * Check if section exists. <add> * Check if the section exists. <ide> * <ide> * @param string $name <ide> * @return bool <ide><path>tests/Foundation/Testing/WormholeTest.php <ide> class WormholeTest extends TestCase <ide> { <ide> public function testCanTravelBackToPresent() <ide> { <del> // Preserve the timelines we want to compare the reality with.. <add> // Preserve the timelines we want to compare the reality with... <ide> $present = now(); <ide> $future = now()->addDays(10); <ide> <del> // Travel in time.. <add> // Travel in time... <ide> (new Wormhole(10))->days(); <ide> <del> // Assert we are now in the future.. <add> // Assert we are now in the future... <ide> $this->assertEquals($future->format('Y-m-d'), now()->format('Y-m-d')); <ide> <del> // Assert we can go back to the present.. <add> // Assert we can go back to the present... <ide> $this->assertEquals($present->format('Y-m-d'), Wormhole::back()->format('Y-m-d')); <ide> } <ide>
36
Python
Python
add intel em64t fortran compiler support
50e69de29085387db2e0ab7768bc9b81c2712169
<ide><path>numpy/distutils/cpuinfo.py <ide> def _is_Itanium(self): <ide> <ide> def _is_XEON(self): <ide> return re.match(r'.*?XEON\b', <del> self.info[0]['model name']) is not None <add> self.info[0]['model name'],re.IGNORECASE) is not None <ide> <ide> _is_Xeon = _is_XEON <ide> <ide><path>numpy/distutils/fcompiler/__init__.py <ide> def __get_flags(self, command, envvar=None, confvar=None): <ide> "Intel Fortran Compiler for Itanium apps"), <ide> 'intelev':('intel','IntelItaniumVisualFCompiler', <ide> "Intel Visual Fortran Compiler for Itanium apps"), <add> 'intelem':('intel','IntelEM64TFCompiler', <add> "Intel Fortran Compiler for EM64T-based apps"), <ide> 'nag':('nag','NAGFCompiler', <ide> "NAGWare Fortran 95 Compiler"), <ide> 'compaq':('compaq','CompaqFCompiler', <ide> def __get_flags(self, command, envvar=None, confvar=None): <ide> ('win32',('gnu','intelv','absoft','compaqv','intelev','gnu95','g95')), <ide> ('cygwin.*',('gnu','intelv','absoft','compaqv','intelev','gnu95','g95')), <ide> ('linux.*',('gnu','intel','lahey','pg','absoft','nag','vast','compaq', <del> 'intele','gnu95','g95')), <add> 'intele','intelem','gnu95','g95')), <ide> ('darwin.*',('nag','absoft','ibm','gnu','gnu95','g95')), <ide> ('sunos.*',('sun','gnu','gnu95','g95')), <ide> ('irix.*',('mips','gnu','gnu95',)), <ide><path>numpy/distutils/fcompiler/intel.py <ide> def get_flags_arch(self): <ide> opt.extend(['-tpp7','-xB']) <ide> elif cpu.is_Pentium(): <ide> opt.append('-tpp5') <del> elif cpu.is_PentiumIV() or cpu.is_XEON(): <add> elif cpu.is_PentiumIV() or cpu.is_Xeon(): <ide> opt.extend(['-tpp7','-xW']) <del> if cpu.has_mmx(): <add> if cpu.has_mmx() and not cpu.is_Xeon(): <ide> opt.append('-xM') <ide> if cpu.has_sse2(): <ide> opt.append('-arch SSE2') <ide> class IntelItaniumFCompiler(IntelFCompiler): <ide> 'ranlib' : ["ranlib"] <ide> } <ide> <add>class IntelEM64TFCompiler(IntelFCompiler): <add> compiler_type = 'intelem' <add> <add> version_pattern = r'Intel\(R\) Fortran Compiler for Intel\(R\) EM64T-based '\ <add> 'applications, Version (?P<version>[^\s*]*)' <add> <add> for fc_exe in map(find_executable,['ifort','efort','efc']): <add> if os.path.isfile(fc_exe): <add> break <add> <add> executables = { <add> 'version_cmd' : [fc_exe, "-FI -V -c %(fname)s.f -o %(fname)s.o" \ <add> % {'fname':dummy_fortran_file()}], <add> 'compiler_f77' : [fc_exe,"-FI","-w90","-w95"], <add> 'compiler_fix' : [fc_exe,"-FI"], <add> 'compiler_f90' : [fc_exe], <add> 'linker_so' : [fc_exe,"-shared"], <add> 'archiver' : ["ar", "-cr"], <add> 'ranlib' : ["ranlib"] <add> } <add> <ide> class IntelVisualFCompiler(FCompiler): <ide> <ide> compiler_type = 'intelv' <ide><path>numpy/distutils/system_info.py <ide> def __init__(self): <ide> system_info.__init__(self) <ide> else: <ide> from cpuinfo import cpu <add> l = 'mkl' # use shared library <ide> if cpu.is_Itanium(): <ide> plt = '64' <del> l = 'mkl_ipf' <add> #l = 'mkl_ipf' <ide> elif cpu.is_Xeon(): <ide> plt = 'em64t' <del> l = 'mkl_em64t' <add> #l = 'mkl_em64t' <ide> else: <ide> plt = '32' <del> l = 'mkl_ia32' <add> #l = 'mkl_ia32' <ide> if l not in self._lib_mkl: <ide> self._lib_mkl.insert(0,l) <ide> system_info.__init__(self, <ide> def calc_info(self): <ide> mkl = get_info('mkl') <ide> if not mkl: <ide> return <del> lapack_libs = self.get_libs('lapack_libs',['mkl_lapack']) <add> lapack_libs = self.get_libs('lapack_libs',['mkl_lapack32','mkl_lapack64']) <ide> info = {'libraries': lapack_libs} <ide> dict_append(info,**mkl) <ide> self.set_info(**info)
4
Go
Go
remove some redundant formatting
838fc976c82c5d09e622cdf275ebd4032e06819c
<ide><path>integration-cli/docker_cli_inspect_test.go <ide> func (s *DockerCLIInspectSuite) TestInspectTypeFlagWithInvalidValue(c *testing.T <ide> <ide> out, exitCode, err := dockerCmdWithError("inspect", "--type=foobar", "busybox") <ide> assert.Assert(c, err != nil, "%d", exitCode) <del> assert.Equal(c, exitCode, 1, fmt.Sprintf("%s", err)) <add> assert.Equal(c, exitCode, 1, err) <ide> assert.Assert(c, strings.Contains(out, "not a valid value for --type")) <ide> } <ide> <ide><path>integration/container/checkpoint_test.go <ide> package container // import "github.com/docker/docker/integration/container" <ide> <ide> import ( <ide> "context" <del> "fmt" <ide> "os/exec" <ide> "regexp" <ide> "sort" <ide> func TestCheckpoint(t *testing.T) { <ide> err = client.CheckpointCreate(ctx, cID, cptOpt) <ide> if err != nil { <ide> // An error can contain a path to a dump file <del> t.Logf("%s", err) <add> t.Log(err) <ide> re := regexp.MustCompile("path= (.*): ") <del> m := re.FindStringSubmatch(fmt.Sprintf("%s", err)) <add> m := re.FindStringSubmatch(err.Error()) <ide> if len(m) >= 2 { <ide> dumpLog := m[1] <ide> t.Logf("%s", dumpLog)
2
Java
Java
remove todos (replaced with jira tickets)
1c47c8f35c91b1c77b27ab5092ff01b5733ec116
<ide><path>spring-messaging/src/main/java/org/springframework/messaging/MessageHandler.java <ide> public interface MessageHandler { <ide> */ <ide> void handleMessage(Message<?> message) throws MessagingException; <ide> <del> /* <del> * TODO: exceptions <del> * @throws org.springframework.integration.MessageRejectedException if the handler doesn't accept the message <del> * @throws org.springframework.integration.MessageHandlingException when something fails during the handling <del> * @throws org.springframework.integration.MessageDeliveryException when this handler failed to deliver the <del> */ <del> <ide> } <ide><path>spring-messaging/src/main/java/org/springframework/messaging/handler/annotation/support/MessageBodyMethodArgumentResolver.java <ide> <ide> <ide> /** <del> * TODO <add> * A resolver for extracting the body of a message. <ide> * <ide> * <p>This {@link HandlerMethodArgumentResolver} should be ordered last as it supports all <ide> * types and does not require the {@link MessageBody} annotation. <ide> public Object resolveArgument(MethodParameter parameter, Message<?> message) thr <ide> return message.getPayload(); <ide> } <ide> else { <del> // TODO: use content-type header <ide> return this.converter.fromMessage(message, targetClass); <ide> } <ide> } <ide><path>spring-messaging/src/main/java/org/springframework/messaging/handler/method/InvocableHandlerMethod.java <ide> public void setParameterNameDiscoverer(ParameterNameDiscoverer parameterNameDisc <ide> } <ide> <ide> /** <del> * TODO <add> * Invoke the method with the given message. <ide> * <ide> * @exception Exception raised if no suitable argument resolver can be found, or the <ide> * method raised an exception <ide><path>spring-messaging/src/main/java/org/springframework/messaging/simp/handler/AnnotationMethodMessageHandler.java <ide> private void handleMessageInternal(Message<?> message, Map<MappingInfo, HandlerM <ide> invokeExceptionHandler(message, handlerMethod, ex); <ide> } <ide> catch (Throwable ex) { <del> // TODO <del> ex.printStackTrace(); <add> logger.error("Error while processing message " + message, ex); <ide> } <ide> } <ide> <ide><path>spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompHeaderAccessor.java <ide> public long[] getHeartbeat() { <ide> return null; <ide> } <ide> String[] rawValues = StringUtils.commaDelimitedListToStringArray(rawValue); <del> // TODO assertions <ide> return new long[] { Long.valueOf(rawValues[0]), Long.valueOf(rawValues[1])}; <ide> } <ide> <ide><path>spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompMessageConverter.java <ide> else if (stompContent instanceof byte[]){ <ide> String headerContent = new String(byteContent, 0, payloadIndex, STOMP_CHARSET); <ide> Parser parser = new Parser(headerContent); <ide> <del> // TODO: validate command and whether a payload is allowed <ide> StompCommand command = StompCommand.valueOf(parser.nextToken(LF).trim()); <ide> Assert.notNull(command, "No command found"); <ide> <ide><path>spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompProtocolHandler.java <ide> public void handleMessageFromClient(WebSocketSession session, WebSocketMessage w <ide> String payload = ((TextMessage)webSocketMessage).getPayload(); <ide> Message<?> message = this.stompMessageConverter.toMessage(payload); <ide> <del> // TODO: validate size limits <del> // http://stomp.github.io/stomp-specification-1.2.html#Size_Limits <del> <ide> if (logger.isTraceEnabled()) { <ide> logger.trace("Message " + message); <ide> } <ide> public void handleMessageFromClient(WebSocketSession session, WebSocketMessage w <ide> logger.error("Terminating STOMP session due to failure to send message: ", t); <ide> sendErrorMessage(session, t); <ide> } <del> <del> // TODO: send RECEIPT message if incoming message has "receipt" header <del> // http://stomp.github.io/stomp-specification-1.2.html#Header_receipt <del> <ide> } <ide> catch (Throwable error) { <ide> sendErrorMessage(session, error); <ide> public void handleMessageToClient(WebSocketSession session, Message<?> message) <ide> } <ide> <ide> if (StompCommand.MESSAGE.equals(headers.getCommand()) && (headers.getSubscriptionId() == null)) { <del> // TODO: failed message delivery mechanism <ide> logger.error("Ignoring message, no subscriptionId header: " + message); <ide> return; <ide> } <ide> <ide> if (!(message.getPayload() instanceof byte[])) { <del> // TODO: failed message delivery mechanism <ide> logger.error("Ignoring message, expected byte[] content: " + message); <ide> return; <ide> } <ide> else if (acceptVersions.isEmpty()) { <ide> else { <ide> throw new StompConversionException("Unsupported version '" + acceptVersions + "'"); <ide> } <del> connectedHeaders.setHeartbeat(0,0); // TODO <add> connectedHeaders.setHeartbeat(0,0); <ide> <ide> Principal principal = session.getPrincipal(); <ide> if (principal != null) { <ide> else if (acceptVersions.isEmpty()) { <ide> } <ide> } <ide> <del> // TODO: security <del> <ide> Message<?> connectedMessage = MessageBuilder.withPayloadAndHeaders(new byte[0], connectedHeaders).build(); <ide> byte[] bytes = this.stompMessageConverter.fromMessage(connectedMessage); <ide> session.sendMessage(new TextMessage(new String(bytes, Charset.forName("UTF-8")))); <ide><path>spring-messaging/src/test/java/org/springframework/messaging/simp/stomp/StompBrokerRelayMessageHandlerIntegrationTests.java <ide> public void relayReconnectsIfBrokerComesBackUp() throws Exception { <ide> <ide> stopBrokerAndAwait(); <ide> <del> // TODO: <ide> // 1st message will see ERROR frame (broker shutdown is not but should be detected) <ide> // 2nd message will be queued (a side effect of CONNECT/CONNECTED-buffering, likely to be removed) <ide> // Finish this once the above changes are made. <ide><path>spring-websocket/src/main/java/org/springframework/web/socket/client/endpoint/StandardWebSocketClient.java <ide> protected WebSocketSession doHandshakeInternal(WebSocketHandler webSocketHandler <ide> configBuidler.preferredSubprotocols(protocols); <ide> <ide> try { <del> // TODO: do not block <ide> Endpoint endpoint = new StandardWebSocketHandlerAdapter(webSocketHandler, session); <ide> this.webSocketContainer.connectToServer(endpoint, configBuidler.build(), uri); <del> <ide> return session; <ide> } <ide> catch (Exception e) { <ide><path>spring-websocket/src/main/java/org/springframework/web/socket/client/jetty/JettyWebSocketClient.java <ide> import java.security.Principal; <ide> import java.util.List; <ide> import java.util.Map; <add>import java.util.concurrent.Future; <ide> <add>import org.eclipse.jetty.websocket.api.Session; <ide> import org.eclipse.jetty.websocket.client.ClientUpgradeRequest; <ide> import org.eclipse.jetty.websocket.client.WebSocketClient; <ide> import org.springframework.context.SmartLifecycle; <ide> public WebSocketSession doHandshakeInternal(WebSocketHandler wsHandler, HttpHead <ide> JettyWebSocketHandlerAdapter listener = new JettyWebSocketHandlerAdapter(wsHandler, wsSession); <ide> <ide> try { <del> // TODO: do not block <del> this.client.connect(listener, uri, request).get(); <add> Future<Session> future = this.client.connect(listener, uri, request); <add> future.get(); <ide> return wsSession; <ide> } <ide> catch (Exception e) { <ide><path>spring-websocket/src/main/java/org/springframework/web/socket/server/DefaultHandshakeHandler.java <ide> protected void handleWebSocketVersionNotSupported(ServerHttpRequest request, Ser <ide> } <ide> <ide> protected boolean isValidOrigin(ServerHttpRequest request) { <del> String origin = request.getHeaders().getOrigin(); <del> if (origin != null) { <del> // UriComponentsBuilder uriBuilder = UriComponentsBuilder.fromHttpUrl(origin); <del> // TODO <del> // A simple strategy checks against the current request's scheme/port/host <del> // Or match scheme, port, and host against configured allowed origins (wild cards for hosts?) <del> // return false; <del> } <ide> return true; <ide> } <ide> <ide><path>spring-websocket/src/main/java/org/springframework/web/socket/sockjs/transport/handler/AbstractHttpSendingTransportHandler.java <ide> public final void handleRequest(ServerHttpRequest request, ServerHttpResponse re <ide> <ide> AbstractHttpSockJsSession sockJsSession = (AbstractHttpSockJsSession) wsSession; <ide> <del> String protocol = null; // TODO: https://github.com/sockjs/sockjs-client/issues/130 <add> String protocol = null; // https://github.com/sockjs/sockjs-client/issues/130 <ide> sockJsSession.setAcceptedProtocol(protocol); <ide> <ide> // Set content type before writing <ide><path>spring-websocket/src/main/java/org/springframework/web/socket/sockjs/transport/session/AbstractSockJsSession.java <ide> public final void close(CloseStatus status) throws IOException { <ide> } <ide> try { <ide> if (isActive()) { <del> // TODO: deliver messages "in flight" before sending close frame <ide> try { <ide> // bypass writeFrame <ide> writeFrameInternal(SockJsFrame.closeFrame(status.getCode(), status.getReason()));
13