content_type stringclasses 8 values | main_lang stringclasses 7 values | message stringlengths 1 50 | sha stringlengths 40 40 | patch stringlengths 52 962k | file_count int64 1 300 |
|---|---|---|---|---|---|
Python | Python | fix tests for missing example and system tests | 8a8f54ffec71e4c992c6f078d0ff24ec5ed5dd45 | <ide><path>tests/always/test_project_structure.py
<ide> def has_example_dag(operator_set):
<ide> def test_missing_example_for_operator(self):
<ide> missing_operators = []
<ide>
<del> for resource_type in ["operators", "sensors", "tranfers"]:
<add> for resource_type in ["operators", "sensors", "transfers"]:
<ide> operator_files = set(
<ide> self.find_resource_files(top_level_directory="airflow", resource_type=resource_type)
<ide> )
<ide> def test_missing_example_for_operator(self):
<ide> self.assertEqual(set(missing_operators), self.MISSING_EXAMPLES_FOR_OPERATORS)
<ide>
<ide> @parameterized.expand(
<del> itertools.product(["_system.py", "_system_helper.py"], ["operators", "sensors", "tranfers"])
<add> itertools.product(["_system.py", "_system_helper.py"], ["operators", "sensors", "transfers"])
<ide> )
<ide> def test_detect_invalid_system_tests(self, resource_type, filename_suffix):
<ide> operators_tests = self.find_resource_files(top_level_directory="tests", resource_type=resource_type) | 1 |
Python | Python | remove redundant code in maskedarray.__new__ | 7078ec63b55088d353b148f9c2d062ea879af2db | <ide><path>numpy/ma/core.py
<ide> def __new__(cls, data=None, mask=nomask, dtype=None, copy=False,
<ide> # FIXME _sharedmask is never used.
<ide> _sharedmask = True
<ide> # Process mask.
<del> # Number of named fields (or zero if none)
<del> names_ = _data.dtype.names or ()
<ide> # Type of the mask
<del> if names_:
<del> mdtype = make_mask_descr(_data.dtype)
<del> else:
<del> mdtype = MaskType
<add> mdtype = make_mask_descr(_data.dtype)
<ide>
<ide> if mask is nomask:
<ide> # Case 1. : no mask in input.
<ide> def __new__(cls, data=None, mask=nomask, dtype=None, copy=False,
<ide> _data._mask = mask
<ide> _data._sharedmask = False
<ide> else:
<add> _data._sharedmask = not copy
<ide> if copy:
<ide> _data._mask = _data._mask.copy()
<del> _data._sharedmask = False
<ide> # Reset the shape of the original mask
<ide> if getmask(data) is not nomask:
<ide> data._mask.shape = data.shape
<del> else:
<del> _data._sharedmask = True
<ide> else:
<ide> # Case 2. : With a mask in input.
<ide> # If mask is boolean, create an array of True or False
<ide> def __new__(cls, data=None, mask=nomask, dtype=None, copy=False,
<ide> _data._mask = mask
<ide> _data._sharedmask = not copy
<ide> else:
<del> if names_:
<add> if _data.dtype.names:
<ide> def _recursive_or(a, b):
<ide> "do a|=b on each field of a, recursively"
<ide> for name in a.dtype.names:
<ide> def _recursive_or(a, b):
<ide> _recursive_or(af, bf)
<ide> else:
<ide> af |= bf
<del> return
<ide> _recursive_or(_data._mask, mask)
<ide> else:
<ide> _data._mask = np.logical_or(mask, _data._mask) | 1 |
Ruby | Ruby | avoid the need to compact the expanded deps array | 71586d09aa42a5a6f67fb7006e1cbe178ec27f52 | <ide><path>Library/Homebrew/dependency.rb
<ide> def expand(dependent, &block)
<ide> deps = dependent.deps.map do |dep|
<ide> case action(dependent, dep, &block)
<ide> when :prune
<del> next
<add> next []
<ide> when :skip
<ide> expand(dep.to_formula, &block)
<ide> else
<ide> expand(dep.to_formula, &block) << dep
<ide> end
<del> end.flatten.compact
<add> end.flatten
<ide>
<ide> merge_repeats(deps)
<ide> end | 1 |
PHP | PHP | fix missing base directories in redirect routes | 292a924da20ea724331d9b73b36e5b261638b31c | <ide><path>src/Routing/Middleware/RoutingMiddleware.php
<ide> class RoutingMiddleware
<ide> public function __invoke(ServerRequestInterface $request, ResponseInterface $response, $next)
<ide> {
<ide> try {
<add> Router::setRequestContext($request);
<ide> $params = (array)$request->getAttribute('params', []);
<ide> if (empty($params['controller'])) {
<ide> $path = $request->getUri()->getPath();
<ide><path>src/Routing/Router.php
<ide> use Cake\Core\Configure;
<ide> use Cake\Network\Request;
<ide> use Cake\Utility\Inflector;
<add>use InvalidArgumentException;
<add>use Psr\Http\Message\ServerRequestInterface;
<ide>
<ide> /**
<ide> * Parses the request URL into controller, action, and parameters. Uses the connected routes
<ide> public static function setRequestInfo($request)
<ide> public static function pushRequest(Request $request)
<ide> {
<ide> static::$_requests[] = $request;
<del> static::_setContext($request);
<add> static::setRequestContext($request);
<ide> }
<ide>
<ide> /**
<ide> * Store the request context for a given request.
<ide> *
<del> * @param \Cake\Network\Request $request The request instance.
<add> * @param \Cake\Network\Request|\Psr\Http\Message\ServerRequestInterface $request The request instance.
<ide> * @return void
<add> * @throws InvalidArgumentException When parameter is an incorrect type.
<ide> */
<del> protected static function _setContext($request)
<add> public static function setRequestContext($request)
<ide> {
<del> static::$_requestContext = [
<del> '_base' => $request->base,
<del> '_port' => $request->port(),
<del> '_scheme' => $request->scheme(),
<del> '_host' => $request->host()
<del> ];
<add> if ($request instanceof Request) {
<add> static::$_requestContext = [
<add> '_base' => $request->base,
<add> '_port' => $request->port(),
<add> '_scheme' => $request->scheme(),
<add> '_host' => $request->host()
<add> ];
<add> return;
<add> }
<add> if ($request instanceof ServerRequestInterface) {
<add> $uri = $request->getUri();
<add> static::$_requestContext = [
<add> '_base' => $request->getAttribute('base'),
<add> '_port' => $uri->getPort(),
<add> '_scheme' => $uri->getScheme(),
<add> '_host' => $uri->getHost(),
<add> ];
<add> return;
<add> }
<add> throw new InvalidArgumentException('Unknown request type received.');
<ide> }
<ide>
<add>
<ide> /**
<ide> * Pops a request off of the request stack. Used when doing requestAction
<ide> *
<ide> public static function popRequest()
<ide> $removed = array_pop(static::$_requests);
<ide> $last = end(static::$_requests);
<ide> if ($last) {
<del> static::_setContext($last);
<add> static::setRequestContext($last);
<ide> reset(static::$_requests);
<ide> }
<ide>
<ide> public static function url($url = null, $full = false)
<ide> ];
<ide> $here = $base = $output = $frag = null;
<ide>
<add> // In 4.x this should be replaced with state injected via setRequestContext
<ide> $request = static::getRequest(true);
<ide> if ($request) {
<ide> $params = $request->params;
<ide> $here = $request->here;
<ide> $base = $request->base;
<del> }
<del> if (!isset($base)) {
<add> } else {
<ide> $base = Configure::read('App.base');
<add> if (isset(static::$_requestContext['_base'])) {
<add> $base = static::$_requestContext['_base'];
<add> }
<ide> }
<ide>
<ide> if (empty($url)) {
<ide><path>tests/TestCase/Routing/Middleware/RoutingMiddlewareTest.php
<ide> public function testRedirectResponse()
<ide> {
<ide> Router::redirect('/testpath', '/pages');
<ide> $request = ServerRequestFactory::fromGlobals(['REQUEST_URI' => '/testpath']);
<add> $request = $request->withAttribute('base', '/subdir');
<add>
<ide> $response = new Response();
<ide> $next = function ($req, $res) {
<ide> };
<ide> $middleware = new RoutingMiddleware();
<ide> $response = $middleware($request, $response, $next);
<ide>
<ide> $this->assertEquals(301, $response->getStatusCode());
<del> $this->assertEquals('http://localhost/pages', $response->getHeaderLine('Location'));
<add> $this->assertEquals('http://localhost/subdir/pages', $response->getHeaderLine('Location'));
<ide> }
<ide>
<ide> /**
<ide><path>tests/TestCase/Routing/RouterTest.php
<ide>
<ide> use Cake\Core\Configure;
<ide> use Cake\Core\Plugin;
<add>use Cake\Http\ServerRequestFactory;
<ide> use Cake\Network\Request;
<ide> use Cake\Routing\Router;
<ide> use Cake\Routing\Route\Route;
<ide> public function testUrlWithCollidingQueryString()
<ide> $this->assertEquals('/posts/view/1?_host=foo.bar&_ssl=0&_scheme=ftp%3A%2F%2F&_base=baz&_port=15', $result);
<ide> }
<ide>
<add> /**
<add> * Test setting the request context.
<add> *
<add> * @return void
<add> */
<add> public function testSetRequestContextCakePHP()
<add> {
<add> Router::connect('/:controller/:action/*');
<add> $request = new Request([
<add> 'base' => '/subdir',
<add> 'url' => 'articles/view/1'
<add> ]);
<add> Router::setRequestContext($request);
<add> $result = Router::url(['controller' => 'things', 'action' => 'add']);
<add> $this->assertEquals('/subdir/things/add', $result);
<add>
<add> $result = Router::url(['controller' => 'things', 'action' => 'add'], true);
<add> $this->assertEquals('http://localhost/subdir/things/add', $result);
<add>
<add> $result = Router::url('/pages/home');
<add> $this->assertEquals('/subdir/pages/home', $result);
<add> }
<add>
<add> /**
<add> * Test setting the request context.
<add> *
<add> * @return void
<add> */
<add> public function testSetRequestContextPsr()
<add> {
<add> $server = [
<add> 'DOCUMENT_ROOT' => '/Users/markstory/Sites',
<add> 'SCRIPT_FILENAME' => '/Users/markstory/Sites/subdir/webroot/index.php',
<add> 'PHP_SELF' => '/subdir/webroot/index.php/articles/view/1',
<add> 'REQUEST_URI' => '/subdir/articles/view/1',
<add> 'QUERY_STRING' => '',
<add> 'SERVER_PORT' => 80,
<add> ];
<add>
<add> Router::connect('/:controller/:action/*');
<add> $request = ServerRequestFactory::fromGlobals($server);
<add> Router::setRequestContext($request);
<add>
<add> $result = Router::url(['controller' => 'things', 'action' => 'add']);
<add> $this->assertEquals('/subdir/things/add', $result);
<add>
<add> $result = Router::url(['controller' => 'things', 'action' => 'add'], true);
<add> $this->assertEquals('http://localhost/subdir/things/add', $result);
<add>
<add> $result = Router::url('/pages/home');
<add> $this->assertEquals('/subdir/pages/home', $result);
<add> }
<add>
<add> /**
<add> * Test setting the request context.
<add> *
<add> * @expectedException InvalidArgumentException
<add> * @return void
<add> */
<add> public function testSetRequestContextInvalid()
<add> {
<add> Router::setRequestContext(new \stdClass);
<add> }
<add>
<ide> /**
<ide> * Connect some fallback routes for testing router behavior.
<ide> * | 4 |
Javascript | Javascript | remove unused import | 5669af58bf0fd1514bea9bfd58924eac0c9e12aa | <ide><path>packages/ember-htmlbars/tests/helpers/unbound_test.js
<ide> import { get } from 'ember-metal/property_get';
<ide> import { set } from 'ember-metal/property_set';
<ide> import run from 'ember-metal/run_loop';
<ide> import compile from "ember-template-compiler/system/compile";
<del>import EmberError from 'ember-metal/error';
<ide> import helpers from "ember-htmlbars/helpers";
<ide> import registerBoundHelper from "ember-htmlbars/compat/register-bound-helper";
<ide> import makeBoundHelper from "ember-htmlbars/compat/make-bound-helper"; | 1 |
Javascript | Javascript | add jack in showcase | 82853dcce38b8d395f03d6368dbb281630d984ef | <ide><path>website/src/react-native/showcase.js
<ide> var featured = [
<ide> infoLink: 'https://www.techatbloomberg.com/blog/bloomberg-used-react-native-develop-new-consumer-app/',
<ide> infoTitle: 'How Bloomberg Used React Native to Develop its new Consumer App',
<ide> },
<del> {
<del> name: 'Blink',
<del> icon: 'https://lh3.googleusercontent.com/QaId7rFtOjAT-2tHVkKB4lebX_w4ujWiO7ZIDe3Hd99TfBmPmiZySbLbVJV65qs0ViM=w300-rw',
<del> linkPlayStore: 'https://play.google.com/store/apps/details?id=com.witapp',
<del> infoLink: 'https://hashnode.com/post/what-we-learned-after-using-react-native-for-a-year-civdr8zv6058l3853wqud7hqp',
<del> infoTitle: 'What we learned after using React Native for a year',
<del> },
<add> {
<add> name: 'Blink',
<add> icon: 'https://lh3.googleusercontent.com/QaId7rFtOjAT-2tHVkKB4lebX_w4ujWiO7ZIDe3Hd99TfBmPmiZySbLbVJV65qs0ViM=w300-rw',
<add> linkPlayStore: 'https://play.google.com/store/apps/details?id=com.witapp',
<add> infoLink: 'https://hashnode.com/post/what-we-learned-after-using-react-native-for-a-year-civdr8zv6058l3853wqud7hqp',
<add> infoTitle: 'What we learned after using React Native for a year',
<add> },
<ide> {
<ide> name: 'Delivery.com',
<ide> icon: 'https://lh3.googleusercontent.com/ZwwQHQns9Ut2-LqbMqPcmQrsWBh3YbmbIzeDthfdavw99Ziq0unJ6EHUw8bstXUIpg=w300-rw',
<ide> var featured = [
<ide> infoLink: 'https://medium.com/@jesusdario/developing-beyond-the-screen-9af812b96724#.ozx0xy4lv',
<ide> infoTitle: 'How React Native is helping us to reinvent the wheel',
<ide> },
<add> {
<add> name: 'Jack',
<add> icon: 'https://s3-eu-west-1.amazonaws.com/jack-public/react-native-showcase/jack-raw-icon.png',
<add> linkAppStore: 'https://itunes.apple.com/us/app/you-have-a-jack/id1019167559?ls=1&mt=8',
<add> linkPlayStore: 'https://play.google.com/store/apps/details?id=com.jack45.jack',
<add> infoLink: 'https://medium.com/@herdani/our-switch-to-react-native-f4ada19f0f3d#.ogwjzf2tw',
<add> infoTitle: 'Our switch to React Native',
<add> },
<ide> ];
<ide>
<ide> /*
<ide> var pinned = [
<ide> defaultLink: 'https://www.airbnb.com/mobile',
<ide> },
<ide> {
<del> name: 'Baidu(手机百度)',
<add> name: 'Baidu (手机百度)',
<ide> icon: 'http://a3.mzstatic.com/us/r30/Purple62/v4/90/7c/9b/907c9b4e-556d-1a45-45d4-0ea801719abd/icon175x175.png',
<ide> linkPlayStore: 'http://shouji.baidu.com/software/9896302.html',
<ide> linkAppStore: 'https://itunes.apple.com/en/app/shou-ji-bai-du-hai-liang-xin/id382201985?l=en&mt=8', | 1 |
Python | Python | fix piecewise to handle 0-d inputs | 660dacef79bf3e78502309f791b3195b14fa63df | <ide><path>numpy/lib/function_base.py
<ide> def piecewise(x, condlist, funclist, *args, **kw):
<ide> n += 1
<ide> if (n != n2):
<ide> raise ValueError, "function list and condition list must be the same"
<add> zerod = False
<add> # This is a hack to work around problems with NumPy's
<add> # handling of 0-d arrays and boolean indexing with
<add> # numpy.bool_ scalars
<add> if x.ndim == 0:
<add> x = x[None]
<add> zerod = True
<add> newcondlist = []
<add> for k in range(n):
<add> if condlist[k].ndim == 0:
<add> condition = condlist[k][None]
<add> else:
<add> condition = condlist[k]
<add> newcondlist.append(condition)
<add> condlist = newcondlist
<ide> y = empty(x.shape, x.dtype)
<ide> for k in range(n):
<ide> item = funclist[k]
<ide> if not callable(item):
<ide> y[condlist[k]] = item
<ide> else:
<del> y[condlist[k]] = item(x[condlist[k]], *args, **kw)
<add> vals = x[condlist[k]]
<add> if vals.size > 0:
<add> y[condlist[k]] = item(vals, *args, **kw)
<add> if zerod:
<add> y = y.squeeze()
<ide> return y
<ide>
<ide> def select(condlist, choicelist, default=0):
<ide><path>numpy/lib/tests/test_function_base.py
<ide> def compare_results(res,desired):
<ide> for i in range(len(desired)):
<ide> assert_array_equal(res[i],desired[i])
<ide>
<add>class TestPiecewise(TestCase):
<add> def test_0d(self):
<add> x = array(3)
<add> y = piecewise(x, x>3, [4, 0])
<add> assert y.ndim == 0
<add> assert y == 0
<add>
<ide> if __name__ == "__main__":
<ide> nose.run(argv=['', __file__]) | 2 |
Javascript | Javascript | add url to eslint globals. | ff9def41ff3e7760d076bf1b899583d4b36cba0d | <ide><path>packages/eslint-config-react-native-community/index.js
<ide> module.exports = {
<ide> setImmediate: true,
<ide> setInterval: false,
<ide> setTimeout: false,
<add> URL: false,
<ide> WebSocket: true,
<ide> window: false,
<ide> XMLHttpRequest: false, | 1 |
Ruby | Ruby | remove options audit check | ac9bc89bb38fc07205b34fdbb7f3c34b81e7464e | <ide><path>Library/Homebrew/cmd/audit.rb
<ide> def audit_formula_text name, text
<ide> --verbose
<ide> ].freeze
<ide>
<del>def audit_formula_options f, text
<del> problems = []
<del>
<del> # Textually find options checked for in the formula
<del> options = []
<del> text.scan(/ARGV\.include\?[ ]*\(?(['"])(.+?)\1/) { |m| options << m[1] }
<del> options.reject! {|o| o.include? "#"}
<del> options.uniq! # May be checked more than once
<del>
<del> # Find declared options
<del> begin
<del> opts = f.options
<del> documented_options = []
<del> opts.each{ |o| documented_options << o[0] }
<del> documented_options.reject! {|o| o.include? "="}
<del> rescue
<del> documented_options = []
<del> end
<del>
<del> if options.length > 0
<del> options.each do |o|
<del> next if o == '--HEAD' || o == '--devel'
<del> problems << " * Option #{o} is not documented" unless documented_options.include? o
<del> end
<del> end
<del>
<del> if documented_options.length > 0
<del> documented_options.each do |o|
<del> next if o == '--universal' and text =~ /ARGV\.build_universal\?/
<del> next if o == '--32-bit' and text =~ /ARGV\.build_32_bit\?/
<del> problems << " * Option #{o} is unused" unless options.include? o
<del> if INSTALL_OPTIONS.include? o
<del> problems << " * Option #{o} shadows an install option; should be renamed"
<del> end
<del> end
<del> end
<del>
<del> return problems
<del>end
<del>
<ide> def audit_formula_patches f
<ide> problems = []
<ide> patches = Patches.new(f.patches)
<ide> def audit
<ide> text_without_patch = (text.split("__END__")[0]).strip()
<ide>
<ide> problems += audit_formula_text(f.name, text_without_patch)
<del> problems += audit_formula_options(f, text_without_patch)
<ide> problems += audit_formula_specs(f)
<ide>
<ide> unless problems.empty? | 1 |
Javascript | Javascript | insert the core css styles without using innerhtml | 25189661534502d578d27ea02bee17c29df1a882 | <ide><path>lib/grunt/utils.js
<ide> module.exports = {
<ide> .replace(/\\/g, '\\\\')
<ide> .replace(/'/g, '\\\'')
<ide> .replace(/\r?\n/g, '\\n');
<del> js = '!window.angular.$$csp().noInlineStyle && window.angular.element(document.head).prepend(\'<style type="text/css">' + css + '</style>\');';
<add> js = '!window.angular.$$csp().noInlineStyle && window.angular.element(document.head).prepend(window.angular.element(\'<style>\').text(\'' + css + '\'));';
<ide> state.js.push(js);
<ide>
<ide> return state;
<ide><path>test/e2e/tests/sample.spec.js
<ide> describe('Sample', function() {
<ide> it('should have the interpolated text', function() {
<ide> expect(element(by.binding('text')).getText()).toBe('Hello, world!');
<ide> });
<add>
<add> it('should insert the ng-cloak styles', function() {
<add> browser.executeScript(`
<add> var span = document.createElement('span');
<add> span.className = 'ng-cloak foo';
<add> document.body.appendChild(span);
<add> `);
<add> expect(element(by.className('foo')).isDisplayed()).toBe(false);
<add> });
<ide> }); | 2 |
Python | Python | fix test_ssh_client on big-endian architectures | df060de6ea325cba2b6411780728705252543bc3 | <ide><path>libcloud/test/compute/test_ssh_client.py
<ide> def test_consume_stdout_chunk_contains_non_utf8_character(self):
<ide> chan.recv.side_effect = ["🤦".encode("utf-32"), "a", "b"]
<ide>
<ide> stdout = client._consume_stdout(chan).getvalue()
<del> self.assertEqual("\x00\x00&\x01\x00ab", stdout)
<add> if sys.byteorder == "little":
<add> self.assertEqual("\x00\x00&\x01\x00ab", stdout)
<add> else:
<add> self.assertEqual("\x00\x00\x00\x01&ab", stdout)
<ide> self.assertEqual(len(stdout), 7)
<ide>
<ide> def test_consume_stderr_chunk_contains_non_utf8_character(self):
<ide> def test_consume_stderr_chunk_contains_non_utf8_character(self):
<ide> chan.recv_stderr.side_effect = ["🤦".encode("utf-32"), "a", "b"]
<ide>
<ide> stderr = client._consume_stderr(chan).getvalue()
<del> self.assertEqual("\x00\x00&\x01\x00ab", stderr)
<add> if sys.byteorder == "little":
<add> self.assertEqual("\x00\x00&\x01\x00ab", stderr)
<add> else:
<add> self.assertEqual("\x00\x00\x00\x01&ab", stderr)
<ide> self.assertEqual(len(stderr), 7)
<ide>
<ide> def test_keep_alive_and_compression(self): | 1 |
PHP | PHP | remove blank line | 18cbc9d197dbc27ee1e502b93dcf03cf02e347fa | <ide><path>src/Illuminate/Database/Query/Builder.php
<ide> public function forPageAfterId($perPage = 15, $lastId = 0, $column = 'id')
<ide> }
<ide> }
<ide> }
<del>
<ide> return $this->where($column, '>', $lastId)
<ide> ->orderBy($column, 'asc')
<ide> ->take($perPage); | 1 |
Javascript | Javascript | set the owner during traverseallchildren | cd1ab32d2f0f814c4cdf7293d81566dfab1e740d | <ide><path>src/addons/__tests__/ReactFragment-test.js
<ide> describe('ReactFragment', function() {
<ide> );
<ide> });
<ide>
<add> it('should warn if a plain object even if it is in an owner', function() {
<add> spyOn(console, 'error');
<add> class Foo {
<add> render() {
<add> var children = {
<add> a: <span />,
<add> b: <span />,
<add> c: <span />,
<add> };
<add> return <div>{[children]}</div>;
<add> }
<add> }
<add> expect(console.error.calls.length).toBe(0);
<add> var container = document.createElement('div');
<add> React.render(<Foo />, container);
<add> expect(console.error.calls.length).toBe(1);
<add> expect(console.error.calls[0].args[0]).toContain(
<add> 'Any use of a keyed object'
<add> );
<add> });
<add>
<ide> it('should warn if accessing any property on a fragment', function() {
<ide> spyOn(console, 'error');
<ide> var children = {
<ide><path>src/renderers/shared/reconciler/ReactMultiChild.js
<ide> var ReactComponentEnvironment = require('ReactComponentEnvironment');
<ide> var ReactMultiChildUpdateTypes = require('ReactMultiChildUpdateTypes');
<ide>
<add>var ReactCurrentOwner = require('ReactCurrentOwner');
<ide> var ReactReconciler = require('ReactReconciler');
<ide> var ReactChildReconciler = require('ReactChildReconciler');
<ide>
<ide> var ReactMultiChild = {
<ide> */
<ide> Mixin: {
<ide>
<add> _reconcilerInstantiateChildren: function(nestedChildren, transaction, context) {
<add> if (__DEV__) {
<add> if (this._currentElement) {
<add> try {
<add> ReactCurrentOwner.current = this._currentElement._owner;
<add> return ReactChildReconciler.instantiateChildren(
<add> nestedChildren, transaction, context
<add> );
<add> } finally {
<add> ReactCurrentOwner.current = null;
<add> }
<add> }
<add> }
<add> return ReactChildReconciler.instantiateChildren(
<add> nestedChildren, transaction, context
<add> );
<add> },
<add>
<add> _reconcilerUpdateChildren: function(prevChildren, nextNestedChildrenElements, transaction, context) {
<add> if (__DEV__) {
<add> if (this._currentElement) {
<add> try {
<add> ReactCurrentOwner.current = this._currentElement._owner;
<add> return ReactChildReconciler.updateChildren(
<add> prevChildren, nextNestedChildrenElements, transaction, context
<add> );
<add> } finally {
<add> ReactCurrentOwner.current = null;
<add> }
<add> }
<add> }
<add> return ReactChildReconciler.updateChildren(
<add> prevChildren, nextNestedChildrenElements, transaction, context
<add> );
<add> },
<add>
<ide> /**
<ide> * Generates a "mount image" for each of the supplied children. In the case
<ide> * of `ReactDOMComponent`, a mount image is a string of markup.
<ide> var ReactMultiChild = {
<ide> * @internal
<ide> */
<ide> mountChildren: function(nestedChildren, transaction, context) {
<del> var children = ReactChildReconciler.instantiateChildren(
<add> var children = this._reconcilerInstantiateChildren(
<ide> nestedChildren, transaction, context
<ide> );
<ide> this._renderedChildren = children;
<ide> var ReactMultiChild = {
<ide> */
<ide> _updateChildren: function(nextNestedChildrenElements, transaction, context) {
<ide> var prevChildren = this._renderedChildren;
<del> var nextChildren = ReactChildReconciler.updateChildren(
<add> var nextChildren = this._reconcilerUpdateChildren(
<ide> prevChildren, nextNestedChildrenElements, transaction, context
<ide> );
<ide> this._renderedChildren = nextChildren; | 2 |
Javascript | Javascript | remove usage of require('util') | 25b78c0940c1033131840e7a812225d7ef31635b | <ide><path>lib/internal/modules/esm/module_map.js
<ide> const ModuleJob = require('internal/modules/esm/module_job');
<ide> const {
<ide> SafeMap
<ide> } = primordials;
<del>const debug = require('util').debuglog('esm');
<add>const debug = require('internal/util/debuglog').debuglog('esm');
<ide> const { ERR_INVALID_ARG_TYPE } = require('internal/errors').codes;
<ide> const { validateString } = require('internal/validators');
<ide> | 1 |
Text | Text | remove superfluous reptition from usingdocker.md | 748aaf3530b943449d61952e06eb9aeab4a455ac | <ide><path>docs/sources/userguide/dockerlinks.md
<ide> command to list the container's environment variables.
<ide> > will scrub them when spawning shells for connection.
<ide>
<ide> We can see that Docker has created a series of environment variables with
<del>useful information about our `db` container. Each variables is prefixed with
<add>useful information about our `db` container. Each variable is prefixed with
<ide> `DB_` which is populated from the `alias` we specified above. If our `alias`
<ide> were `db1` the variables would be prefixed with `DB1_`. You can use these
<ide> environment variables to configure your applications to connect to the database
<ide><path>docs/sources/userguide/usingdocker.md
<ide> This will display the help text and all available flags:
<ide> --no-stdin=false: Do not attach stdin
<ide> --sig-proxy=true: Proxify all received signal to the process (even in non-tty mode)
<ide>
<del>
<del>None of the containers we've run did anything particularly useful
<del>though. So let's build on that experience by running an example web
<del>application in Docker.
<del>
<ide> > **Note:**
<ide> > You can see a full list of Docker's commands
<ide> > [here](/reference/commandline/cli/).
<ide> command. This tells the `docker ps` command to return the details of the
<ide> *last* container started.
<ide>
<ide> > **Note:**
<del>> The `docker ps` command only shows running containers. If you want to
<del>> see stopped containers too use the `-a` flag.
<add>> By default, the `docker ps` command only shows information about running
<add>> containers. If you want to see stopped containers too use the `-a` flag.
<ide>
<ide> We can see the same details we saw [when we first Dockerized a
<ide> container](/userguide/dockerizing) with one important addition in the `PORTS` | 2 |
Python | Python | expand cases in test_issctype() | 181cc0fb2bd6c4755904e924940c10c387c9f301 | <ide><path>numpy/core/tests/test_numerictypes.py
<ide> def test_non_type(self):
<ide> (list, False),
<ide> (1.1, False),
<ide> (str, True),
<add> (np.dtype(np.float64), True),
<add> (np.dtype((np.int16, (3, 4))), True),
<add> (np.dtype([('a', np.int8)]), True),
<ide> ])
<ide> def test_issctype(rep, expected):
<ide> # ensure proper identification of scalar | 1 |
Text | Text | remind backporter about v8_embedder_string | a9cb6723b5f3e626d0bcec3645831a9c2b3e21ba | <ide><path>doc/contributing/maintaining-V8.md
<ide> Refs: https://github.com/v8/v8/commit/a51f429772d1e796744244128c9feeab4c26a854
<ide> PR-URL: https://github.com/nodejs/node/pull/7833
<ide> ```
<ide>
<add>* Increase the `v8_embedder_string` number in `common.gypi`.
<ide> * Open a PR against the `v6.x-staging` branch in the Node.js repository. Launch
<ide> the normal and [V8 CI][] using the Node.js CI system. We only needed to
<ide> backport to `v6.x` as the other LTS branches weren't affected by this bug. | 1 |
PHP | PHP | fix doc string | 4e913bc8684872dfe9108f5c64a665584376c085 | <ide><path>src/Http/ServerRequest.php
<ide> class ServerRequest implements ServerRequestInterface
<ide> * requests with put, patch or delete data.
<ide> * - `session` An instance of a Session object
<ide> *
<del> * @param string|array $config An array of request data to create a request with.
<del> * The string version of this argument is *deprecated* and will be removed in 4.0.0
<add> * @param array $config An array of request data to create a request with.
<ide> */
<ide> public function __construct($config = [])
<ide> { | 1 |
Mixed | Javascript | remove max limit of crlfdelay | b8e0a5ea23e536fe24e94f1d460aaeadb8839e76 | <ide><path>doc/api/readline.md
<ide> changes:
<ide> * `crlfDelay` {number} If the delay between `\r` and `\n` exceeds
<ide> `crlfDelay` milliseconds, both `\r` and `\n` will be treated as separate
<ide> end-of-line input. Default to `100` milliseconds.
<del> `crlfDelay` will be coerced to `[100, 2000]` range.
<add> `crlfDelay` will be coerced to a number no less than `100`. It can be set to
<add> `Infinity`, in which case `\r` followed by `\n` will always be considered a
<add> single newline.
<ide> * `removeHistoryDuplicates` {boolean} If `true`, when a new input line added
<ide> to the history list duplicates an older one, this removes the older line
<ide> from the list. Defaults to `false`.
<ide><path>lib/readline.js
<ide> const {
<ide>
<ide> const kHistorySize = 30;
<ide> const kMincrlfDelay = 100;
<del>const kMaxcrlfDelay = 2000;
<ide> // \r\n, \n, or \r followed by something other than \n
<ide> const lineEnding = /\r?\n|\r(?!\n)/;
<ide>
<ide> function Interface(input, output, completer, terminal) {
<ide> this.input = input;
<ide> this.historySize = historySize;
<ide> this.removeHistoryDuplicates = !!removeHistoryDuplicates;
<del> this.crlfDelay = Math.max(kMincrlfDelay,
<del> Math.min(kMaxcrlfDelay, crlfDelay >>> 0));
<add> this.crlfDelay = crlfDelay ?
<add> Math.max(kMincrlfDelay, crlfDelay) : kMincrlfDelay;
<ide>
<ide> // Check arity, 2 - for async, 1 for sync
<ide> if (typeof completer === 'function') {
<ide><path>test/parallel/test-readline-interface.js
<ide> function isWarned(emitter) {
<ide> }
<ide>
<ide> {
<del> // Maximum crlfDelay is 2000ms
<add> // set crlfDelay to float 100.5ms
<ide> const fi = new FakeInput();
<ide> const rli = new readline.Interface({
<ide> input: fi,
<ide> output: fi,
<del> crlfDelay: 1 << 30
<add> crlfDelay: 100.5
<ide> });
<del> assert.strictEqual(rli.crlfDelay, 2000);
<add> assert.strictEqual(rli.crlfDelay, 100.5);
<add> rli.close();
<add>}
<add>
<add>{
<add> // set crlfDelay to 5000ms
<add> const fi = new FakeInput();
<add> const rli = new readline.Interface({
<add> input: fi,
<add> output: fi,
<add> crlfDelay: 5000
<add> });
<add> assert.strictEqual(rli.crlfDelay, 5000);
<ide> rli.close();
<ide> }
<ide>
<ide> function isWarned(emitter) {
<ide> rli.close();
<ide>
<ide> // Emit two line events when the delay
<del> // between \r and \n exceeds crlfDelay
<add> // between \r and \n exceeds crlfDelay
<ide> {
<ide> const fi = new FakeInput();
<ide> const delay = 200;
<ide> function isWarned(emitter) {
<ide> }), delay * 2);
<ide> }
<ide>
<add> // Emit one line events when the delay between \r and \n is
<add> // over the default crlfDelay but within the setting value
<add> {
<add> const fi = new FakeInput();
<add> const delay = 200;
<add> const crlfDelay = 500;
<add> const rli = new readline.Interface({
<add> input: fi,
<add> output: fi,
<add> terminal: terminal,
<add> crlfDelay
<add> });
<add> let callCount = 0;
<add> rli.on('line', function(line) {
<add> callCount++;
<add> });
<add> fi.emit('data', '\r');
<add> setTimeout(common.mustCall(() => {
<add> fi.emit('data', '\n');
<add> assert.strictEqual(callCount, 1);
<add> rli.close();
<add> }), delay);
<add> }
<add>
<add> // set crlfDelay to `Infinity` is allowed
<add> {
<add> const fi = new FakeInput();
<add> const delay = 200;
<add> const crlfDelay = Infinity;
<add> const rli = new readline.Interface({
<add> input: fi,
<add> output: fi,
<add> terminal: terminal,
<add> crlfDelay
<add> });
<add> let callCount = 0;
<add> rli.on('line', function(line) {
<add> callCount++;
<add> });
<add> fi.emit('data', '\r');
<add> setTimeout(common.mustCall(() => {
<add> fi.emit('data', '\n');
<add> assert.strictEqual(callCount, 1);
<add> rli.close();
<add> }), delay);
<add> }
<add>
<ide> // \t when there is no completer function should behave like an ordinary
<del> // character
<add> // character
<ide> fi = new FakeInput();
<ide> rli = new readline.Interface({ input: fi, output: fi, terminal: true });
<ide> called = false;
<ide> function isWarned(emitter) {
<ide> assert.strictEqual(isWarned(process.stdout._events), false);
<ide> }
<ide>
<del> //can create a new readline Interface with a null output arugument
<add> // can create a new readline Interface with a null output arugument
<ide> fi = new FakeInput();
<ide> rli = new readline.Interface({ input: fi, output: null, terminal: terminal });
<ide> | 3 |
Text | Text | update description of build a city skyline step 71 | b068a6eb0ae089df50162a2ae2489b1450bb0a6c | <ide><path>curriculum/challenges/english/14-responsive-web-design-22/learn-css-variables-by-building-a-city-skyline/5d822fd413a79914d39e990f.md
<ide> dashedName: step-71
<ide>
<ide> # --description--
<ide>
<del>The windows are stacked on top of each other at the left of the section, behind the purple building. Add a new class below `.building-wrap` called `window-wrap`, and add these properties to it:
<ide>
<del>```css
<del>display: flex;
<del>align-items: center;
<del>justify-content: space-evenly;
<del>```
<del>
<del>This will be used in a few places to center window elements vertically, and evenly space them in their parent.
<add>The windows are stacked on top of each other at the left of the section, behind the purple building. Add a new class below `.building-wrap` called `window-wrap`. Make `.window-wrap` a flexbox container, and use the `align-items` and `justify-content` properties to center its child elements vertically and evenly space them in their parent, respectively.
<ide>
<ide> # --hints--
<ide> | 1 |
Java | Java | fix refcount issue in leakawaredatabuffer | 3ebbfa2191376d9920c57b545fbd3c07167b4c1e | <ide><path>spring-core/src/test/java/org/springframework/core/io/buffer/LeakAwareDataBuffer.java
<ide> class LeakAwareDataBuffer implements PooledDataBuffer {
<ide>
<ide> private final LeakAwareDataBufferFactory dataBufferFactory;
<ide>
<del> private int refCount = 1;
<del>
<ide>
<ide> LeakAwareDataBuffer(DataBuffer delegate, LeakAwareDataBufferFactory dataBufferFactory) {
<ide> Assert.notNull(delegate, "Delegate must not be null");
<ide> AssertionError leakError() {
<ide>
<ide> @Override
<ide> public boolean isAllocated() {
<del> return this.refCount > 0;
<add> return this.delegate instanceof PooledDataBuffer &&
<add> ((PooledDataBuffer) this.delegate).isAllocated();
<ide> }
<ide>
<ide> @Override
<ide> public PooledDataBuffer retain() {
<del> this.refCount++;
<add> if (this.delegate instanceof PooledDataBuffer) {
<add> ((PooledDataBuffer) this.delegate).retain();
<add> }
<ide> return this;
<ide> }
<ide>
<ide> @Override
<ide> public boolean release() {
<del> this.refCount--;
<del> return this.refCount == 0;
<add> if (this.delegate instanceof PooledDataBuffer) {
<add> ((PooledDataBuffer) this.delegate).release();
<add> }
<add> return isAllocated();
<ide> }
<ide>
<ide> // delegation
<ide><path>spring-core/src/test/java/org/springframework/core/io/buffer/LeakAwareDataBufferFactory.java
<ide> public void checkForLeaks() {
<ide>
<ide> @Override
<ide> public DataBuffer allocateBuffer() {
<del> return allocateBufferInternal(this.delegate.allocateBuffer());
<add> return createLeakAwareDataBuffer(this.delegate.allocateBuffer());
<ide> }
<ide>
<ide> @Override
<ide> public DataBuffer allocateBuffer(int initialCapacity) {
<del> return allocateBufferInternal(this.delegate.allocateBuffer(initialCapacity));
<add> return createLeakAwareDataBuffer(this.delegate.allocateBuffer(initialCapacity));
<ide> }
<ide>
<ide> @NotNull
<del> private DataBuffer allocateBufferInternal(DataBuffer delegateBuffer) {
<add> private DataBuffer createLeakAwareDataBuffer(DataBuffer delegateBuffer) {
<ide> LeakAwareDataBuffer dataBuffer = new LeakAwareDataBuffer(delegateBuffer, this);
<ide> this.created.add(dataBuffer);
<ide> return dataBuffer; | 2 |
PHP | PHP | add docs for events | 01f89f8c3e9c7b567320d8fe61f6a182e7fca467 | <ide><path>Cake/ORM/Table.php
<ide> * Table objects provide a few callbacks/events you can hook into to augment/replace
<ide> * find operations. Each event uses the standard event subsystem in CakePHP
<ide> *
<del> * - beforeFind($event, $query, $options) - Fired before each find operation. By stopping
<add> * - `beforeFind($event, $query, $options)` - Fired before each find operation. By stopping
<ide> * the event and supplying a return value you can bypass the find operation entirely. Any
<ide> * changes done to the $query instance will be retained for the rest of the find.
<add> * - `beforeValidate($event, $entity, $options, $validator)` - Fired before an entity is validated.
<add> * By stopping this event, you can abort the validate + save operations.
<add> * - `afterValidate($event, $entity, $options, $validator)` - Fired after an entity is validated.
<add> * - `beforeSave($event, $entity, $options)` - Fired before each entity is saved. Stopping this
<add> * event will abort the save operation. When the event is stopped the result of the event will
<add> * be returned.
<add> * - `afterSave($event, $entity, $options)` - Fired after an entity is saved.
<add> * - `beforeDelete($event, $entity, $options)` - Fired before an entity is deleted.
<add> * By stopping this event you will abort the delete operation.
<add> * - `afterDelete($event, $entity, $options)` - Fired after an entity has been deleted.
<ide> *
<ide> * @see Cake\Event\EventManager for reference on the events system.
<ide> */ | 1 |
Javascript | Javascript | ignore an empty port component when parsing urls | 677c2c112c8f92910b85e14575c9c941799f5916 | <ide><path>lib/url.js
<ide> exports.format = urlFormat;
<ide> // define these here so at least they only have to be
<ide> // compiled once on the first module load.
<ide> var protocolPattern = /^([a-z0-9.+-]+:)/i,
<del> portPattern = /:[0-9]+$/,
<add> portPattern = /:[0-9]*$/,
<ide> // RFC 2396: characters reserved for delimiting URLs.
<ide> delims = ['<', '>', '"', '`', ' ', '\r', '\n', '\t'],
<ide> // RFC 2396: characters not allowed for various reasons.
<ide> function parseHost(host) {
<ide> var port = portPattern.exec(host);
<ide> if (port) {
<ide> port = port[0];
<del> out.port = port.substr(1);
<add> if (port !== ':') {
<add> out.port = port.substr(1);
<add> }
<ide> host = host.substr(0, host.length - port.length);
<ide> }
<ide> if (host) out.hostname = host;
<ide><path>test/simple/test-url.js
<ide> var parseTests = {
<ide> 'query': 'n=Temperature',
<ide> 'pathname': '/.well-known/r',
<ide> 'path': '/.well-known/r?n=Temperature'
<add> },
<add> // empty port
<add> 'http://example.com:': {
<add> 'protocol': 'http:',
<add> 'slashes': true,
<add> 'host': 'example.com',
<add> 'hostname': 'example.com',
<add> 'href': 'http://example.com/',
<add> 'pathname': '/',
<add> 'path': '/'
<add> },
<add> 'http://example.com:/a/b.html': {
<add> 'protocol': 'http:',
<add> 'slashes': true,
<add> 'host': 'example.com',
<add> 'hostname': 'example.com',
<add> 'href': 'http://example.com/a/b.html',
<add> 'pathname': '/a/b.html',
<add> 'path': '/a/b.html'
<add> },
<add> 'http://example.com:?a=b': {
<add> 'protocol': 'http:',
<add> 'slashes': true,
<add> 'host': 'example.com',
<add> 'hostname': 'example.com',
<add> 'href': 'http://example.com/?a=b',
<add> 'search': '?a=b',
<add> 'query': 'a=b',
<add> 'pathname': '/',
<add> 'path': '/?a=b'
<add> },
<add> 'http://example.com:#abc': {
<add> 'protocol': 'http:',
<add> 'slashes': true,
<add> 'host': 'example.com',
<add> 'hostname': 'example.com',
<add> 'href': 'http://example.com/#abc',
<add> 'hash': '#abc',
<add> 'pathname': '/',
<add> 'path': '/'
<add> },
<add> 'http://[fe80::1]:/a/b?a=b#abc': {
<add> 'protocol': 'http:',
<add> 'slashes': true,
<add> 'host': '[fe80::1]',
<add> 'hostname': 'fe80::1',
<add> 'href': 'http://[fe80::1]/a/b?a=b#abc',
<add> 'search': '?a=b',
<add> 'query': 'a=b',
<add> 'hash': '#abc',
<add> 'pathname': '/a/b',
<add> 'path': '/a/b?a=b'
<ide> }
<ide> };
<ide> | 2 |
Text | Text | update more information with link to sciencing | 6c7ea37f82a9ba808b3dee4f9142ef1d322f2aa2 | <ide><path>guide/english/mathematics/congruent/index.md
<ide> Interestingly, dilating a shape by a certain scale figure will not produce congr
<ide> <!-- The article goes here, in GitHub-flavored Markdown. Feel free to add YouTube videos, images, and CodePen/JSBin embeds -->
<ide>
<ide> #### More Information:
<del>[Here's a guide](https://www.mathsisfun.com/geometry/congruent.html) to information about producing congruent shapes
<add>- [Here's a guide](https://www.mathsisfun.com/geometry/congruent.html) to information about producing congruent shapes
<add>- [Congruent Shapes](https://sciencing.com/congruent-shapes-8503883.html)
<ide>
<ide> | 1 |
Text | Text | fix broken documentation link | 4349ce1a542a1b83f7e19979831bbc427f92ad55 | <ide><path>docs/api-guide/testing.md
<ide> If you're using `RequestsClient` you'll want to ensure that test setup, and resu
<ide> ## Headers & Authentication
<ide>
<ide> Custom headers and authentication credentials can be provided in the same way
<del>as [when using a standard `requests.Session` instance](http://docs.python-requests.org/en/master/user/advanced/#session-objects).
<add>as [when using a standard `requests.Session` instance][session_objects].
<ide>
<ide> from requests.auth import HTTPBasicAuth
<ide>
<ide> For example, to add support for using `format='html'` in test requests, you migh
<ide> [requestfactory]: https://docs.djangoproject.com/en/stable/topics/testing/advanced/#django.test.client.RequestFactory
<ide> [configuration]: #configuration
<ide> [refresh_from_db_docs]: https://docs.djangoproject.com/en/1.11/ref/models/instances/#django.db.models.Model.refresh_from_db
<add>[session_objects]: https://requests.readthedocs.io/en/master/user/advanced/#session-objects | 1 |
Text | Text | add mdn links for security headers [ci-skip] | 7bcee1906038a52601a944398cb9a01578da37f5 | <ide><path>guides/source/security.md
<ide> application returns these headers for every HTTP response.
<ide>
<ide> #### `X-Frame-Options`
<ide>
<del>This header indicates if a browser can render the page in a `<frame>`,
<add>The [`X-Frame-Options`][] header indicates if a browser can render the page in a `<frame>`,
<ide> `<iframe>`, `<embed>` or `<object>` tag. This header is set to `SAMEORIGIN` by
<ide> default to allow framing on the same domain only. Set it to `DENY` to deny
<ide> framing at all, or remove this header completely if you want to allow framing on
<ide> all domains.
<ide>
<add>[`X-Frame-Options`]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options
<add>
<ide> #### `X-XSS-Protection`
<ide>
<ide> A [deprecated legacy
<ide> header](https://owasp.org/www-project-secure-headers/#x-xss-protection), set to
<ide>
<ide> #### `X-Content-Type-Options`
<ide>
<del>This header is set to `nosniff` in Rails by default. It stops the browser from
<del>guessing the MIME type of a file.
<add>The [`X-Content-Type-Options`][] header is set to `nosniff` in Rails by default.
<add>It stops the browser from guessing the MIME type of a file.
<add>
<add>[`X-Content-Type-Options`]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Content-Type-Options
<ide>
<ide> #### `X-Permitted-Cross-Domain-Policies`
<ide>
<ide> PDF clients from embedding your page on other domains.
<ide>
<ide> #### `Referrer-Policy`
<ide>
<del>This header is set to `strict-origin-when-cross-origin` in Rails by default.
<add>The [`Referrer-Policy`][] header is set to `strict-origin-when-cross-origin` in Rails by default.
<ide> For cross-origin requests, this only sends the origin in the Referer header. This
<ide> prevents leaks of private data that may be accessible from other parts of the
<ide> full URL, such as the path and query string.
<ide>
<add>[`Referrer-Policy`]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy
<add>
<ide> #### Configuring the Default Headers
<ide>
<ide> These headers are configured by default as follows:
<ide> config.action_dispatch.default_headers.clear
<ide>
<ide> ### `Strict-Transport-Security` Header
<ide>
<del>The HTTP
<del>[`Strict-Transport-Security`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Strict-Transport-Security)
<del>(HTST) response header makes sure the browser automatically upgrades to HTTPS
<del>for current and future connections.
<add>The HTTP [`Strict-Transport-Security`][] (HTST) response header makes sure the
<add>browser automatically upgrades to HTTPS for current and future connections.
<ide>
<ide> The header is added to the response when enabling the `force_ssl` option:
<ide>
<ide> ```ruby
<ide> config.force_ssl = true
<ide> ```
<ide>
<add>[`Strict-Transport-Security`]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Strict-Transport-Security
<add>
<ide> ### `Content-Security-Policy` Header
<ide>
<ide> To help protect against XSS and injection attacks, it is recommended to define a
<del>[`Content-Security-Policy`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy)
<del>response header for your application. Rails provides a DSL that allows you to
<del>configure the header.
<add>[`Content-Security-Policy`][] response header for your application. Rails
<add>provides a DSL that allows you to configure the header.
<ide>
<ide> Define the security policy in the appropriate initializer:
<ide>
<ide> class PostsController < ApplicationController
<ide> end
<ide> ```
<ide>
<add>[`Content-Security-Policy`]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
<add>
<ide> #### Reporting Violations
<ide>
<del>Enable the
<del>[`report-uri`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/report-uri)
<del>directive to report violations to the specified URI:
<add>Enable the [`report-uri`][] directive to report violations to the specified URI:
<ide>
<ide> ```ruby
<ide> Rails.application.config.content_security_policy do |policy|
<ide> end
<ide> ```
<ide>
<ide> When migrating legacy content, you might want to report violations without
<del>enforcing the policy. Set the
<del>[`Content-Security-Policy-Report-Only`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only)
<add>enforcing the policy. Set the [`Content-Security-Policy-Report-Only`][]
<ide> response header to only report violations:
<ide>
<ide> ```ruby
<ide> class PostsController < ApplicationController
<ide> end
<ide> ```
<ide>
<add>[`Content-Security-Policy-Report-Only`]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
<add>[`report-uri`]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/report-uri
<add>
<ide> #### Adding a Nonce
<ide>
<ide> If you are considering `'unsafe-inline'`, consider using nonces instead. [Nonces
<ide> yet supported by all browsers. To avoid having to rename this
<ide> middleware in the future, we use the new name for the middleware but
<ide> keep the old header name and implementation for now.
<ide>
<del>To allow or block the use of browser features, you can define a
<del>[`Feature-Policy`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Feature-Policy)
<add>To allow or block the use of browser features, you can define a [`Feature-Policy`][]
<ide> response header for your application. Rails provides a DSL that allows you to
<ide> configure the header.
<ide>
<ide> class PagesController < ApplicationController
<ide> end
<ide> ```
<ide>
<add>[`Feature-Policy`]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Feature-Policy
<add>
<ide> Environmental Security
<ide> ----------------------
<ide> | 1 |
Ruby | Ruby | add extra hash conditions tests for named_scope | 9a25315076bf90c39ab5471fa8d81736a3b2478e | <ide><path>activerecord/test/cases/named_scope_test.rb
<ide> def test_scopes_with_string_name_can_be_composed
<ide> assert_equal Topic.replied.approved, Topic.replied.approved_as_string
<ide> end
<ide>
<add> def test_scopes_can_be_specified_with_deep_hash_conditions
<add> assert_equal Topic.replied.approved, Topic.replied.approved_as_hash_condition
<add> end
<add>
<ide> def test_scopes_are_composable
<ide> assert_equal (approved = Topic.find(:all, :conditions => {:approved => true})), Topic.approved
<ide> assert_equal (replied = Topic.find(:all, :conditions => 'replies_count > 0')), Topic.replied
<ide><path>activerecord/test/models/topic.rb
<ide> class Topic < ActiveRecord::Base
<ide> { :conditions => ['written_on < ?', time] }
<ide> }
<ide> named_scope :approved, :conditions => {:approved => true}
<add> named_scope :approved_as_hash_condition, :conditions => {:topics => {:approved => true}}
<ide> named_scope 'approved_as_string', :conditions => {:approved => true}
<ide> named_scope :replied, :conditions => ['replies_count > 0']
<ide> named_scope :anonymous_extension do | 2 |
Javascript | Javascript | add shim files for rn in npm package | c29642d6edbc80188d2f21d3395276e1c1989d0a | <ide><path>packages/react/lib/React.native.js
<add>'use strict';
<add>
<add>// TODO: Once we remove the DOM bits from React, this shim can go away.
<add>
<add>module.exports = require('./ReactIsomorphic');
<ide><path>packages/react/lib/ReactDOM.native.js
<add>'use strict';
<add>
<add>var ReactUpdates = require('./ReactUpdates');
<add>
<add>// TODO: In React Native, ReactTestUtils depends on ./ReactDOM (for
<add>// renderIntoDocument, which should never be called) and Relay depends on
<add>// react-dom (for batching). Once those are fixed, nothing in RN should import
<add>// this module and this file can go away.
<add>
<add>module.exports = {
<add> unstable_batchedUpdates: ReactUpdates.batchedUpdates,
<add>}; | 2 |
Go | Go | remove message during tests | f159f4710b0c5dac8b71246dddbaee667dd6a702 | <ide><path>runtime.go
<ide> func (runtime *Runtime) Destroy(container *Container) error {
<ide>
<ide> func (runtime *Runtime) restore() error {
<ide> wheel := "-\\|/"
<del> if os.Getenv("DEBUG") == "" {
<add> if os.Getenv("DEBUG") == "" && os.Getenv("TEST") == "" {
<ide> fmt.Printf("Loading containers: ")
<ide> }
<ide> dir, err := ioutil.ReadDir(runtime.repository)
<ide> func (runtime *Runtime) restore() error {
<ide> for i, v := range dir {
<ide> id := v.Name()
<ide> container, err := runtime.Load(id)
<del> if i%21 == 0 && os.Getenv("DEBUG") == "" {
<add> if i%21 == 0 && os.Getenv("DEBUG") == "" && os.Getenv("TEST") == "" {
<ide> fmt.Printf("\b%c", wheel[i%4])
<ide> }
<ide> if err != nil {
<ide> func (runtime *Runtime) restore() error {
<ide> }
<ide> utils.Debugf("Loaded container %v", container.ID)
<ide> }
<del> if os.Getenv("DEBUG") == "" {
<add> if os.Getenv("DEBUG") == "" && os.Getenv("TEST") == "" {
<ide> fmt.Printf("\bdone.\n")
<ide> }
<ide> return nil | 1 |
Text | Text | fix labels on github issue templates. | 606307d34adb0a42782605012dd82cdff8371647 | <ide><path>.github/ISSUE_TEMPLATE/Bug-Report.md
<ide> ---
<ide> name: Bug Report
<ide> about: Is something wrong with Celery?
<del>labels: Issue Type: Bug Report
<add>labels: "Issue Type: Bug Report"
<ide> ---
<ide> <!--
<ide> Please fill this template entirely and do not erase parts of it.
<ide><path>.github/ISSUE_TEMPLATE/Documentation-Bug-Report.md
<ide> ---
<ide> name: Documentation Bug Report
<ide> about: Is something wrong with our documentation?
<del>labels: Issue Type: Bug Report, Category: Documentation
<add>labels: "Issue Type: Bug Report, Category: Documentation"
<ide> ---
<ide> <!--
<ide> Please fill this template entirely and do not erase parts of it.
<ide><path>.github/ISSUE_TEMPLATE/Enhancement.md
<ide> ---
<ide> name: Enhancement
<ide> about: Do you want to improve an existing feature?
<del>labels: Issue Type: Enhancement
<add>labels: "Issue Type: Enhancement"
<ide> ---
<ide> <!--
<ide> Please fill this template entirely and do not erase parts of it.
<ide><path>.github/ISSUE_TEMPLATE/Feature-Request.md
<ide> ---
<ide> name: Feature Request
<ide> about: Do you need a new feature?
<del>labels: Issue Type: Feature Request
<add>labels: "Issue Type: Feature Request"
<ide> ---
<ide> <!--
<ide> Please fill this template entirely and do not erase parts of it. | 4 |
Text | Text | use csshelper for grid-template-columns | a961b2c0323e61119fdb3f748215926a8cf19caa | <ide><path>curriculum/challenges/english/01-responsive-web-design/css-grid/add-columns-with-grid-template-columns.md
<ide> Give the grid container three columns that are each `100px` wide.
<ide> `container` class should have a `grid-template-columns` property with three units of `100px`.
<ide>
<ide> ```js
<del>assert(
<del> code.match(
<del> /.container\s*?{[\s\S]*grid-template-columns\s*?:\s*?100px\s*?100px\s*?100px\s*?;[\s\S]*}/gi
<del> )
<del>);
<add>assert(new __helpers.CSSHelp(document).getStyle('.container')?.gridTemplateColumns === '100px 100px 100px');
<ide> ```
<ide>
<ide> # --seed-- | 1 |
Go | Go | improve partial message support in logger | 0b4b0a7b5d5de8cb575b666312fceaa2cd58e658 | <ide><path>api/types/backend/backend.go
<ide> type ContainerAttachConfig struct {
<ide> MuxStreams bool
<ide> }
<ide>
<add>// PartialLogMetaData provides meta data for a partial log message. Messages
<add>// exceeding a predefined size are split into chunks with this metadata. The
<add>// expectation is for the logger endpoints to assemble the chunks using this
<add>// metadata.
<add>type PartialLogMetaData struct {
<add> Last bool //true if this message is last of a partial
<add> ID string // identifies group of messages comprising a single record
<add> Ordinal int // ordering of message in partial group
<add>}
<add>
<ide> // LogMessage is datastructure that represents piece of output produced by some
<ide> // container. The Line member is a slice of an array whose contents can be
<ide> // changed after a log driver's Log() method returns.
<ide> // changes to this struct need to be reflect in the reset method in
<ide> // daemon/logger/logger.go
<ide> type LogMessage struct {
<del> Line []byte
<del> Source string
<del> Timestamp time.Time
<del> Attrs []LogAttr
<del> Partial bool
<add> Line []byte
<add> Source string
<add> Timestamp time.Time
<add> Attrs []LogAttr
<add> PLogMetaData *PartialLogMetaData
<ide>
<ide> // Err is an error associated with a message. Completeness of a message
<ide> // with Err is not expected, tho it may be partially complete (fields may
<ide><path>daemon/logger/adapter.go
<ide> func (a *pluginAdapter) Log(msg *Message) error {
<ide>
<ide> a.buf.Line = msg.Line
<ide> a.buf.TimeNano = msg.Timestamp.UnixNano()
<del> a.buf.Partial = msg.Partial
<add> a.buf.Partial = (msg.PLogMetaData != nil)
<ide> a.buf.Source = msg.Source
<ide>
<ide> err := a.enc.Encode(&a.buf)
<ide><path>daemon/logger/copier.go
<ide> import (
<ide> "sync"
<ide> "time"
<ide>
<add> types "github.com/docker/docker/api/types/backend"
<add> "github.com/docker/docker/pkg/stringid"
<ide> "github.com/sirupsen/logrus"
<ide> )
<ide>
<ide> func (c *Copier) copySrc(name string, src io.Reader) {
<ide>
<ide> n := 0
<ide> eof := false
<add> var partialid string
<add> var partialTS time.Time
<add> var ordinal int
<add> firstPartial := true
<add> hasMorePartial := false
<ide>
<ide> for {
<ide> select {
<ide> func (c *Copier) copySrc(name string, src io.Reader) {
<ide> }
<ide> // Break up the data that we've buffered up into lines, and log each in turn.
<ide> p := 0
<add>
<ide> for q := bytes.IndexByte(buf[p:n], '\n'); q >= 0; q = bytes.IndexByte(buf[p:n], '\n') {
<ide> select {
<ide> case <-c.closed:
<ide> return
<ide> default:
<ide> msg := NewMessage()
<ide> msg.Source = name
<del> msg.Timestamp = time.Now().UTC()
<ide> msg.Line = append(msg.Line, buf[p:p+q]...)
<ide>
<add> if hasMorePartial {
<add> msg.PLogMetaData = &types.PartialLogMetaData{ID: partialid, Ordinal: ordinal, Last: true}
<add>
<add> // reset
<add> partialid = ""
<add> ordinal = 0
<add> firstPartial = true
<add> hasMorePartial = false
<add> }
<add> if msg.PLogMetaData == nil {
<add> msg.Timestamp = time.Now().UTC()
<add> } else {
<add> msg.Timestamp = partialTS
<add> }
<add>
<ide> if logErr := c.dst.Log(msg); logErr != nil {
<ide> logrus.Errorf("Failed to log msg %q for logger %s: %s", msg.Line, c.dst.Name(), logErr)
<ide> }
<ide> func (c *Copier) copySrc(name string, src io.Reader) {
<ide> if p < n {
<ide> msg := NewMessage()
<ide> msg.Source = name
<del> msg.Timestamp = time.Now().UTC()
<ide> msg.Line = append(msg.Line, buf[p:n]...)
<del> msg.Partial = true
<add>
<add> // Generate unique partialID for first partial. Use it across partials.
<add> // Record timestamp for first partial. Use it across partials.
<add> // Initialize Ordinal for first partial. Increment it across partials.
<add> if firstPartial {
<add> msg.Timestamp = time.Now().UTC()
<add> partialTS = msg.Timestamp
<add> partialid = stringid.GenerateRandomID()
<add> ordinal = 1
<add> firstPartial = false
<add> } else {
<add> msg.Timestamp = partialTS
<add> }
<add> msg.PLogMetaData = &types.PartialLogMetaData{ID: partialid, Ordinal: ordinal, Last: false}
<add> ordinal++
<add> hasMorePartial = true
<ide>
<ide> if logErr := c.dst.Log(msg); logErr != nil {
<ide> logrus.Errorf("Failed to log msg %q for logger %s: %s", msg.Line, c.dst.Name(), logErr)
<ide><path>daemon/logger/copier_test.go
<ide> func TestCopierWithSized(t *testing.T) {
<ide> }
<ide> }
<ide>
<add>func checkIdentical(t *testing.T, msg Message, expectedID string, expectedTS time.Time) {
<add> if msg.PLogMetaData.ID != expectedID {
<add> t.Fatalf("IDs are not he same across partials. Expected: %s Received: %s",
<add> expectedID, msg.PLogMetaData.ID)
<add> }
<add> if msg.Timestamp != expectedTS {
<add> t.Fatalf("Timestamps are not the same across partials. Expected: %v Received: %v",
<add> expectedTS.Format(time.UnixDate), msg.Timestamp.Format(time.UnixDate))
<add> }
<add>}
<add>
<add>// Have long lines and make sure that it comes out with PartialMetaData
<add>func TestCopierWithPartial(t *testing.T) {
<add> stdoutLongLine := strings.Repeat("a", defaultBufSize)
<add> stderrLongLine := strings.Repeat("b", defaultBufSize)
<add> stdoutTrailingLine := "stdout trailing line"
<add> stderrTrailingLine := "stderr trailing line"
<add> normalStr := "This is an impartial message :)"
<add>
<add> var stdout bytes.Buffer
<add> var stderr bytes.Buffer
<add> var normalMsg bytes.Buffer
<add>
<add> for i := 0; i < 3; i++ {
<add> if _, err := stdout.WriteString(stdoutLongLine); err != nil {
<add> t.Fatal(err)
<add> }
<add> if _, err := stderr.WriteString(stderrLongLine); err != nil {
<add> t.Fatal(err)
<add> }
<add> }
<add>
<add> if _, err := stdout.WriteString(stdoutTrailingLine + "\n"); err != nil {
<add> t.Fatal(err)
<add> }
<add> if _, err := stderr.WriteString(stderrTrailingLine + "\n"); err != nil {
<add> t.Fatal(err)
<add> }
<add> if _, err := normalMsg.WriteString(normalStr + "\n"); err != nil {
<add> t.Fatal(err)
<add> }
<add>
<add> var jsonBuf bytes.Buffer
<add>
<add> jsonLog := &TestLoggerJSON{Encoder: json.NewEncoder(&jsonBuf)}
<add>
<add> c := NewCopier(
<add> map[string]io.Reader{
<add> "stdout": &stdout,
<add> "normal": &normalMsg,
<add> "stderr": &stderr,
<add> },
<add> jsonLog)
<add> c.Run()
<add> wait := make(chan struct{})
<add> go func() {
<add> c.Wait()
<add> close(wait)
<add> }()
<add> select {
<add> case <-time.After(1 * time.Second):
<add> t.Fatal("Copier failed to do its work in 1 second")
<add> case <-wait:
<add> }
<add>
<add> dec := json.NewDecoder(&jsonBuf)
<add> expectedMsgs := 9
<add> recvMsgs := 0
<add> var expectedPartID1, expectedPartID2 string
<add> var expectedTS1, expectedTS2 time.Time
<add>
<add> for {
<add> var msg Message
<add>
<add> if err := dec.Decode(&msg); err != nil {
<add> if err == io.EOF {
<add> break
<add> }
<add> t.Fatal(err)
<add> }
<add> if msg.Source != "stdout" && msg.Source != "stderr" && msg.Source != "normal" {
<add> t.Fatalf("Wrong Source: %q, should be %q or %q or %q", msg.Source, "stdout", "stderr", "normal")
<add> }
<add>
<add> if msg.Source == "stdout" {
<add> if string(msg.Line) != stdoutLongLine && string(msg.Line) != stdoutTrailingLine {
<add> t.Fatalf("Wrong Line: %q, expected 'stdoutLongLine' or 'stdoutTrailingLine'", msg.Line)
<add> }
<add>
<add> if msg.PLogMetaData.ID == "" {
<add> t.Fatalf("Expected partial metadata. Got nothing")
<add> }
<add>
<add> if msg.PLogMetaData.Ordinal == 1 {
<add> expectedPartID1 = msg.PLogMetaData.ID
<add> expectedTS1 = msg.Timestamp
<add> } else {
<add> checkIdentical(t, msg, expectedPartID1, expectedTS1)
<add> }
<add> if msg.PLogMetaData.Ordinal == 4 && !msg.PLogMetaData.Last {
<add> t.Fatalf("Last is not set for last chunk")
<add> }
<add> }
<add>
<add> if msg.Source == "stderr" {
<add> if string(msg.Line) != stderrLongLine && string(msg.Line) != stderrTrailingLine {
<add> t.Fatalf("Wrong Line: %q, expected 'stderrLongLine' or 'stderrTrailingLine'", msg.Line)
<add> }
<add>
<add> if msg.PLogMetaData.ID == "" {
<add> t.Fatalf("Expected partial metadata. Got nothing")
<add> }
<add>
<add> if msg.PLogMetaData.Ordinal == 1 {
<add> expectedPartID2 = msg.PLogMetaData.ID
<add> expectedTS2 = msg.Timestamp
<add> } else {
<add> checkIdentical(t, msg, expectedPartID2, expectedTS2)
<add> }
<add> if msg.PLogMetaData.Ordinal == 4 && !msg.PLogMetaData.Last {
<add> t.Fatalf("Last is not set for last chunk")
<add> }
<add> }
<add>
<add> if msg.Source == "normal" && msg.PLogMetaData != nil {
<add> t.Fatalf("Normal messages should not have PartialLogMetaData")
<add> }
<add> recvMsgs++
<add> }
<add>
<add> if expectedMsgs != recvMsgs {
<add> t.Fatalf("Expected msgs: %d Recv msgs: %d", expectedMsgs, recvMsgs)
<add> }
<add>}
<add>
<ide> type BenchmarkLoggerDummy struct {
<ide> }
<ide>
<ide><path>daemon/logger/journald/journald.go
<ide> func (s *journald) Log(msg *logger.Message) error {
<ide> for k, v := range s.vars {
<ide> vars[k] = v
<ide> }
<del> if msg.Partial {
<add> if msg.PLogMetaData != nil {
<ide> vars["CONTAINER_PARTIAL_MESSAGE"] = "true"
<ide> }
<ide>
<ide><path>daemon/logger/jsonfilelog/jsonfilelog.go
<ide> func (l *JSONFileLogger) Log(msg *logger.Message) error {
<ide>
<ide> func marshalMessage(msg *logger.Message, extra json.RawMessage, buf *bytes.Buffer) error {
<ide> logLine := msg.Line
<del> if !msg.Partial {
<add> if msg.PLogMetaData == nil || (msg.PLogMetaData != nil && msg.PLogMetaData.Last) {
<ide> logLine = append(msg.Line, '\n')
<ide> }
<ide> err := (&jsonlog.JSONLogs{
<ide><path>daemon/logger/logger.go
<ide> func (m *Message) reset() {
<ide> m.Line = m.Line[:0]
<ide> m.Source = ""
<ide> m.Attrs = nil
<del> m.Partial = false
<add> m.PLogMetaData = nil
<ide>
<ide> m.Err = nil
<ide> }
<ide><path>daemon/logger/logger_test.go
<ide> import (
<ide>
<ide> func (m *Message) copy() *Message {
<ide> msg := &Message{
<del> Source: m.Source,
<del> Partial: m.Partial,
<del> Timestamp: m.Timestamp,
<add> Source: m.Source,
<add> PLogMetaData: m.PLogMetaData,
<add> Timestamp: m.Timestamp,
<ide> }
<ide>
<ide> if m.Attrs != nil { | 8 |
Text | Text | rewrite contributing guide | 30aa5397f364dc817c5bd1a8fb9573f251ad48af | <ide><path>CONTRIBUTING.md
<ide>
<ide> # Contribute to spaCy
<ide>
<del>Following the v1.0 release, it's time to welcome more contributors into the spaCy project and code base 🎉 This page will give you a quick overview of how things are organised and most importantly, how to get involved.
<add>Thanks for your interest in contributing to spaCy 🎉 The project is maintained
<add>by [@honnibal](https://github.com/honnibal) and [@ines](https://github.com/ines),
<add>and we'll do our best to help you get started. This page will give you a quick
<add>overview of how things are organised and most importantly, how to get involved.
<ide>
<ide> ## Table of contents
<ide> 1. [Issues and bug reports](#issues-and-bug-reports)
<ide> 2. [Contributing to the code base](#contributing-to-the-code-base)
<ide> 3. [Code conventions](#code-conventions)
<ide> 4. [Adding tests](#adding-tests)
<ide> 5. [Updating the website](#updating-the-website)
<del>6. [Submitting a tutorial](#submitting-a-tutorial)
<del>7. [Submitting a project to the showcase](#submitting-a-project-to-the-showcase)
<del>8. [Code of conduct](#code-of-conduct)
<add>6. [Publishing extensions and plugins](#publishing-spacy-extensions-and-plugins)
<add>7. [Code of conduct](#code-of-conduct)
<ide>
<ide> ## Issues and bug reports
<ide>
<del>First, [do a quick search](https://github.com/issues?q=+is%3Aissue+user%3Aexplosion) to see if the issue has already been reported. If so, it's often better to just leave a comment on an existing issue, rather than creating a new one.
<del>
<del>If you're looking for help with your code, consider posting a question on [StackOverflow](http://stackoverflow.com/questions/tagged/spacy) instead. If you tag it `spacy` and `python`, more people will see it and hopefully be able to help.
<del>
<del>When opening an issue, use a descriptive title and include your environment (operating system, Python version, spaCy version). Our [issue template](https://github.com/explosion/spaCy/issues/new) helps you remember the most important details to include. If you've discovered a bug, you can also submit a [regression test](#fixing-bugs) straight away. When you're opening an issue to report the bug, simply refer to your pull request in the issue body.
<del>
<del>### Tips
<del>
<del>* **Getting info about your spaCy installation and environment**: If you're using spaCy v1.7+, you can use the command line interface to print details and even format them as Markdown to copy-paste into GitHub issues: `python -m spacy info --markdown`.
<del>
<del>* **Sharing long blocks of code or logs**: If you need to include long code, logs or tracebacks, you can wrap them in `<details>` and `</details>`. This [collapses the content](https://developer.mozilla.org/en/docs/Web/HTML/Element/details) so it only becomes visible on click, making the issue easier to read and follow.
<add>First, [do a quick search](https://github.com/issues?q=+is%3Aissue+user%3Aexplosion)
<add>to see if the issue has already been reported. If so, it's often better to just
<add>leave a comment on an existing issue, rather than creating a new one. Old issues
<add>also often include helpful tips and solutions to common problems. You should
<add>also check the [troubleshooting guide](https://alpha.spacy.io/usage/#troubleshooting)
<add>to see if your problem is already listed there.
<add>
<add>If you're looking for help with your code, consider posting a question on
<add>[StackOverflow](http://stackoverflow.com/questions/tagged/spacy) instead. If you
<add>tag it `spacy` and `python`, more people will see it and hopefully be able to
<add>help. Please understand that we won't be able to provide individual support via
<add>email. We also believe that help is much more valuable if it's **shared publicly**,
<add>so that more people can benefit from it.
<add>
<add>### Submitting issues
<add>
<add>When opening an issue, use a **descriptive title** and include your
<add>**environment** (operating system, Python version, spaCy version). Our
<add>[issue template](https://github.com/explosion/spaCy/issues/new) helps you
<add>remember the most important details to include. If you've discovered a bug, you
<add>can also submit a [regression test](#fixing-bugs) straight away. When you're
<add>opening an issue to report the bug, simply refer to your pull request in the
<add>issue body. A few more tips:
<add>
<add>* **Describing your issue:** Try to provide as many details as possible. What
<add>exactly goes wrong? *How* is is failing? Is there an error?
<add>"XY doesn't work" usually isn't that helpful for tracking down problems. Always
<add>remember to include the code you ran and if possible, extract only the relevant
<add>parts and don't just dump your entire script. This will make it easier for us to
<add>reproduce the error.
<add>
<add>* **Getting info about your spaCy installation and environment:** If you're
<add>using spaCy v1.7+, you can use the command line interface to print details and
<add>even format them as Markdown to copy-paste into GitHub issues:
<add>`python -m spacy info --markdown`.
<add>
<add>* **Checking the model compatibility:** If you're having problems with a
<add>[statistical model](https://alpha.spacy.io/models), it may be because to the
<add>model is incompatible with your spaCy installation. In spaCy v2.0+, you can check
<add>this on the command line by running `spacy validate`.
<add>
<add>* **Sharing a model's output, like dependencies and entities:** spaCy v2.0+
<add>comes with [built-in visualizers](https://alpha.spacy.io/usage/visualizers) that
<add>you can run from within your script or a Jupyter notebook. For some issues, it's
<add>helpful to **include a screenshot** of the visualization. You can simply drag and
<add>drop the image into GitHub's editor and it will be uploaded and included.
<add>
<add>* **Sharing long blocks of code or logs:** If you need to include long code,
<add>logs or tracebacks, you can wrap them in `<details>` and `</details>`. This
<add>[collapses the content](https://developer.mozilla.org/en/docs/Web/HTML/Element/details)
<add>so it only becomes visible on click, making the issue easier to read and follow.
<ide>
<ide> ### Issue labels
<ide>
<del>To distinguish issues that are opened by us, the maintainers, we usually add a 💫 to the title. We also use the following system to tag our issues:
<add>To distinguish issues that are opened by us, the maintainers, we usually add a
<add>💫 to the title. We also use the following system to tag our issues and pull
<add>requests:
<ide>
<ide> | Issue label | Description |
<ide> | --- | --- |
<ide> To distinguish issues that are opened by us, the maintainers, we usually add a
<ide> | [`performance`](https://github.com/explosion/spaCy/labels/performance) | Accuracy, speed and memory use problems |
<ide> | [`tests`](https://github.com/explosion/spaCy/labels/tests) | Missing or incorrect [tests](spacy/tests) |
<ide> | [`docs`](https://github.com/explosion/spaCy/labels/docs), [`examples`](https://github.com/explosion/spaCy/labels/examples) | Issues related to the [documentation](https://spacy.io/docs) and [examples](spacy/examples) |
<add>| [`training`](https://github.com/explosion/spaCy/labels/training) | Issues related to training and updating models |
<ide> | [`models`](https://github.com/explosion/spaCy/labels/models), `language / [name]` | Issues related to the specific [models](https://github.com/explosion/spacy-models), languages and data |
<ide> | [`linux`](https://github.com/explosion/spaCy/labels/linux), [`osx`](https://github.com/explosion/spaCy/labels/osx), [`windows`](https://github.com/explosion/spaCy/labels/windows) | Issues related to the specific operating systems |
<ide> | [`pip`](https://github.com/explosion/spaCy/labels/pip), [`conda`](https://github.com/explosion/spaCy/labels/conda) | Issues related to the specific package managers |
<del>| [`wip`](https://github.com/explosion/spaCy/labels/wip) | Work in progress |
<add>| [`wip`](https://github.com/explosion/spaCy/labels/wip) | Work in progress, mostly used for pull requests. |
<ide> | [`duplicate`](https://github.com/explosion/spaCy/labels/duplicate) | Duplicates, i.e. issues that have been reported before |
<ide> | [`meta`](https://github.com/explosion/spaCy/labels/meta) | Meta topics, e.g. repo organisation and issue management |
<ide> | [`help wanted`](https://github.com/explosion/spaCy/labels/help%20wanted), [`help wanted (easy)`](https://github.com/explosion/spaCy/labels/help%20wanted%20%28easy%29) | Requests for contributions |
<ide>
<ide> ## Contributing to the code base
<ide>
<del>You don't have to be an NLP expert or Python pro to contribute, and we're happy to help you get started. If you're new to spaCy, a good place to start is the [`help wanted (easy)`](https://github.com/explosion/spaCy/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted+%28easy%29%22) label, which we use to tag bugs and feature requests that are easy and self-contained. If you've decided to take on one of these problems and you're making good progress, don't forget to add a quick comment to the issue. You can also use the issue to ask questions, or share your work in progress.
<add>You don't have to be an NLP expert or Python pro to contribute, and we're happy
<add>to help you get started. If you're new to spaCy, a good place to start is the
<add>[spaCy 101 guide](https://alpha.spacy.io/usage/spacy-101) and the
<add>[`help wanted (easy)`](https://github.com/explosion/spaCy/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted+%28easy%29%22)
<add>label, which we use to tag bugs and feature requests that are easy and
<add>self-contained. If you've decided to take on one of these problems and you're
<add>making good progress, don't forget to add a quick comment to the issue. You can
<add>also use the issue to ask questions, or share your work in progress.
<ide>
<ide> ### What belongs in spaCy?
<ide>
<del>Every library has a different inclusion philosophy — a policy of what should be shipped in the core library, and what could be provided in other packages. Our philosophy is to prefer a smaller core library. We generally ask the following questions:
<del>
<del>* **What would this feature look like if implemented in a separate package?** Some features would be very difficult to implement externally. For instance, anything that requires a change to the `Token` class really needs to be implemented within spaCy, because there's no convenient way to make spaCy return custom `Token` objects. In contrast, a library of word alignment functions could easily live as a separate package that depended on spaCy — there's little difference between writing `import word_aligner` and `import spacy.word_aligner`.
<add>Every library has a different inclusion philosophy — a policy of what should be
<add>shipped in the core library, and what could be provided in other packages. Our
<add>philosophy is to prefer a smaller core library. We generally ask the following
<add>questions:
<add>
<add>* **What would this feature look like if implemented in a separate package?**
<add>Some features would be very difficult to implement externally – for example,
<add>changes to spaCy's built-in methods. In contrast, a library of word
<add>alignment functions could easily live as a separate package that depended on
<add>spaCy — there's little difference between writing `import word_aligner` and
<add>`import spacy.word_aligner`. spaCy v2.0+ makes it easy to implement
<add>[custom pipeline components](https://alpha.spacy.io/usage/processing-pipelines#custom-components),
<add>and add your own attributes, properties and methods to the `Doc`, `Token` and
<add>`Span`. If you're looking to implement a new spaCy feature, starting with a
<add>custom component package is usually the best strategy. You won't have to worry
<add>about spaCy's internals and you can test your module in an isolated
<add>environment. And if it works well, we can always integrate it into the core
<add>library later.
<add>
<add>* **Would the feature be easier to implement if it relied on "heavy" dependencies spaCy doesn't currently require?**
<add>Python has a very rich ecosystem. Libraries like scikit-learn, SciPy, Gensim or
<add>TensorFlow/Keras do lots of useful things — but we don't want to have them as
<add>dependencies. If the feature requires functionality in one of these libraries,
<add>it's probably better to break it out into a different package.
<add>
<add>* **Is the feature orthogonal to the current spaCy functionality, or overlapping?**
<add>spaCy strongly prefers to avoid having 6 different ways of doing the same thing.
<add>As better techniques are developed, we prefer to drop support for "the old way".
<add>However, it's rare that one approach *entirely* dominates another. It's very
<add>common that there's still a use-case for the "obsolete" approach. For instance,
<add>[WordNet](https://wordnet.princeton.edu/) is still very useful — but word
<add>vectors are better for most use-cases, and the two approaches to lexical
<add>semantics do a lot of the same things. spaCy therefore only supports word
<add>vectors, and support for WordNet is currently left for other packages.
<add>
<add>* **Do you need the feature to get basic things done?** We do want spaCy to be
<add>at least somewhat self-contained. If we keep needing some feature in our
<add>recipes, that does provide some argument for bringing it "in house".
<add>
<add>### Getting started
<add>
<add>To make changes to spaCy's code base, you need to clone the GitHub repository
<add>and build spaCy from source. You'll need to make sure that you have a
<add>development environment consisting of a Python distribution including header
<add>files, a compiler, [pip](https://pip.pypa.io/en/latest/installing/),
<add>[virtualenv](https://virtualenv.pypa.io/en/stable/) and
<add>[git](https://git-scm.com) installed. The compiler is usually the trickiest part.
<ide>
<del>* **Would the feature be easier to implement if it relied on "heavy" dependencies spaCy doesn't currently require?** Python has a very rich ecosystem. Libraries like Sci-Kit Learn, Scipy, Gensim, Keras etc. do lots of useful things — but we don't want to have them as dependencies. If the feature requires functionality in one of these libraries, it's probably better to break it out into a different package.
<add>```
<add>python -m pip install -U pip venv
<add>git clone https://github.com/explosion/spaCy
<add>cd spaCy
<ide>
<del>* **Is the feature orthogonal to the current spaCy functionality, or overlapping?** spaCy strongly prefers to avoid having 6 different ways of doing the same thing. As better techniques are developed, we prefer to drop support for "the old way". However, it's rare that one approach *entirely* dominates another. It's very common that there's still a use-case for the "obsolete" approach. For instance, [WordNet](https://wordnet.princeton.edu/) is still very useful — but word vectors are better for most use-cases, and the two approaches to lexical semantics do a lot of the same things. spaCy therefore only supports word vectors, and support for WordNet is currently left for other packages.
<add>venv .env
<add>source .env/bin/activate
<add>export PYTHONPATH=`pwd`
<add>pip install -r requirements.txt
<add>python setup.py build_ext --inplace
<add>```
<ide>
<del>* **Do you need the feature to get basic things done?** We do want spaCy to be at least somewhat self-contained. If we keep needing some feature in our recipes, that does provide some argument for bringing it "in house".
<add>If you've made changes to `.pyx` files, you need to recompile spaCy before you
<add>can test your changes by re-running `python setup.py build_ext --inplace`.
<add>Changes to `.py` files will be effective immediately.
<ide>
<del>### Developer resources
<add>📖 **For more details and instructions, see the documentation on [compiling spaCy from source](https://spacy.io/usage/#source) and the [quickstart widget](https://alpha.spacy.io/usage/#section-quickstart) to get the right commands for your platform and Python version.**
<ide>
<del>The [spaCy developer resources](https://github.com/explosion/spacy-dev-resources) repo contains useful scripts, tools and templates for developing spaCy, adding new languages and training new models. If you've written a script that might help others, feel free to contribute it to that repository.
<ide>
<ide> ### Contributor agreement
<ide>
<del>If you've made a substantial contribution to spaCy, you should fill in the [spaCy contributor agreement](.github/CONTRIBUTOR_AGREEMENT.md) to ensure that your contribution can be used across the project. If you agree to be bound by the terms of the agreement, fill in the [template]((.github/CONTRIBUTOR_AGREEMENT.md)) and include it with your pull request, or sumit it separately to [`.github/contributors/`](/.github/contributors). The name of the file should be your GitHub username, with the extension `.md`. For example, the user
<add>If you've made a contribution to spaCy, you should fill in the
<add>[spaCy contributor agreement](.github/CONTRIBUTOR_AGREEMENT.md) to ensure that
<add>your contribution can be used across the project. If you agree to be bound by
<add>the terms of the agreement, fill in the [template]((.github/CONTRIBUTOR_AGREEMENT.md))
<add>and include it with your pull request, or sumit it separately to
<add>[`.github/contributors/`](/.github/contributors). The name of the file should be
<add>your GitHub username, with the extension `.md`. For example, the user
<ide> example_user would create the file `.github/contributors/example_user.md`.
<ide>
<ide>
<ide> ### Fixing bugs
<ide>
<del>When fixing a bug, first create an [issue](https://github.com/explosion/spaCy/issues) if one does not already exist. The description text can be very short – we don't want to make this too bureaucratic.
<add>When fixing a bug, first create an
<add>[issue](https://github.com/explosion/spaCy/issues) if one does not already exist.
<add>The description text can be very short – we don't want to make this too
<add>bureaucratic.
<ide>
<del>Next, create a test file named `test_issue[ISSUE NUMBER].py` in the [`spacy/tests/regression`](spacy/tests/regression) folder. Test for the bug you're fixing, and make sure the test fails. Next, add and commit your test file referencing the issue number in the commit message. Finally, fix the bug, make sure your test passes and reference the issue in your commit message.
<add>Next, create a test file named `test_issue[ISSUE NUMBER].py` in the
<add>[`spacy/tests/regression`](spacy/tests/regression) folder. Test for the bug
<add>you're fixing, and make sure the test fails. Next, add and commit your test file
<add>referencing the issue number in the commit message. Finally, fix the bug, make
<add>sure your test passes and reference the issue in your commit message.
<ide>
<ide> 📖 **For more information on how to add tests, check out the [tests README](spacy/tests/README.md).**
<ide>
<ide> ## Code conventions
<ide>
<del>Code should loosely follow [pep8](https://www.python.org/dev/peps/pep-0008/). Regular line length is **80 characters**, with some tolerance for lines up to 90 characters if the alternative would be worse — for instance, if your list comprehension comes to 82 characters, it's better not to split it over two lines.
<add>Code should loosely follow [pep8](https://www.python.org/dev/peps/pep-0008/).
<add>Regular line length is **80 characters**, with some tolerance for lines up to
<add>90 characters if the alternative would be worse — for instance, if your list
<add>comprehension comes to 82 characters, it's better not to split it over two lines.
<add>You can also use a linter like [`flake8`](https://pypi.python.org/pypi/flake8)
<add>or [`frosted`](https://pypi.python.org/pypi/frosted) – just keep in mind that
<add>it won't work very well for `.pyx` files and will complain about Cython syntax
<add>like `<int*>` or `cimport`.
<ide>
<ide> ### Python conventions
<ide>
<del>All Python code must be written in an **intersection of Python 2 and Python 3**. This is easy in Cython, but somewhat ugly in Python. Logic that deals with Python or platform compatibility should only live in [`spacy.compat`](spacy/compat.py). To distinguish them from the builtin functions, replacement functions are suffixed with an undersocre, for example `unicode_`. If you need to access the user's version or platform information, for example to show more specific error messages, you can use the `is_config()` helper function.
<add>All Python code must be written in an **intersection of Python 2 and Python 3**.
<add>This is easy in Cython, but somewhat ugly in Python. Logic that deals with
<add>Python or platform compatibility should only live in
<add>[`spacy.compat`](spacy/compat.py). To distinguish them from the builtin
<add>functions, replacement functions are suffixed with an undersocre, for example
<add>`unicode_`. If you need to access the user's version or platform information,
<add>for example to show more specific error messages, you can use the `is_config()`
<add>helper function.
<ide>
<ide> ```python
<ide> from .compat import unicode_, json_dumps, is_config
<ide> if is_config(windows=True, python2=True):
<ide> print("You are using Python 2 on Windows.")
<ide> ```
<ide>
<del>Code that interacts with the file-system should accept objects that follow the `pathlib.Path` API, without assuming that the object inherits from `pathlib.Path`. If the function is user-facing and takes a path as an argument, it should check whether the path is provided as a string. Strings should be converted to `pathlib.Path` objects.
<del>
<del>At the time of writing (v1.7), spaCy's serialization and deserialization functions are inconsistent about accepting paths vs accepting file-like objects. The correct answer is "file-like objects" — that's what we want going forward, as it makes the library io-agnostic. Working on buffers makes the code more general, easier to test, and compatible with Python 3's asynchronous IO.
<del>
<del>Although spaCy uses a lot of classes, inheritance is viewed with some suspicion — it's seen as a mechanism of last resort. You should discuss plans to extend the class hierarchy before implementing.
<del>
<del>We have a number of conventions around variable naming that are still being documented, and aren't 100% strict. A general policy is that instances of the class `Doc` should by default be called `doc`, `Token` `token`, `Lexeme` `lex`, `Vocab` `vocab` and `Language` `nlp`. You should avoid naming variables that are of other types these names. For instance, don't name a text string `doc` — you should usually call this `text`. Two general code style preferences further help with naming. First, lean away from introducing temporary variables, as these clutter your namespace. This is one reason why comprehension expressions are often preferred. Second, keep your functions shortish, so that can work in a smaller scope. Of course, this is a question of trade-offs.
<add>Code that interacts with the file-system should accept objects that follow the
<add>`pathlib.Path` API, without assuming that the object inherits from `pathlib.Path`.
<add>If the function is user-facing and takes a path as an argument, it should check
<add>whether the path is provided as a string. Strings should be converted to
<add>`pathlib.Path` objects. Serialization and deserialization functions should always
<add>accept **file-like objects**, as it makes the library io-agnostic. Working on
<add>buffers makes the code more general, easier to test, and compatible with Python
<add>3's asynchronous IO.
<add>
<add>Although spaCy uses a lot of classes, **inheritance is viewed with some suspicion**
<add>— it's seen as a mechanism of last resort. You should discuss plans to extend
<add>the class hierarchy before implementing.
<add>
<add>We have a number of conventions around variable naming that are still being
<add>documented, and aren't 100% strict. A general policy is that instances of the
<add>class `Doc` should by default be called `doc`, `Token` `token`, `Lexeme` `lex`,
<add>`Vocab` `vocab` and `Language` `nlp`. You should avoid naming variables that are
<add>of other types these names. For instance, don't name a text string `doc` — you
<add>should usually call this `text`. Two general code style preferences further help
<add>with naming. First, **lean away from introducing temporary variables**, as these
<add>clutter your namespace. This is one reason why comprehension expressions are
<add>often preferred. Second, **keep your functions shortish**, so that can work in a
<add>smaller scope. Of course, this is a question of trade-offs.
<ide>
<ide> ### Cython conventions
<ide>
<del>spaCy's core data structures are implemented as [Cython](http://cython.org/) `cdef` classes. Memory is managed through the `cymem.cymem.Pool` class, which allows you to allocate memory which will be freed when the `Pool` object is garbage collected. This means you usually don't have to worry about freeing memory. You just have to decide which Python object owns the memory, and make it own the `Pool`. When that object goes out of scope, the memory will be freed. You do have to take care that no pointers outlive the object that owns them — but this is generally quite easy.
<del>
<del>All Cython modules should have the `# cython: infer_types=True` compiler directive at the top of the file. This makes the code much cleaner, as it avoids the need for many type declarations. If possible, you should prefer to declare your functions `nogil`, even if you don't especially care about multi-threading. The reason is that `nogil` functions help the Cython compiler reason about your code quite a lot — you're telling the compiler that no Python dynamics are possible. This lets many errors be raised, and ensures your function will run at C speed.
<del>
<del>Cython gives you many choices of sequences: you could have a Python list, a numpy array, a memory view, a C++ vector, or a pointer. Pointers are preferred, because they are fastest, have the most explicit semantics, and let the compiler check your code more strictly. C++ vectors are also great — but you should only use them internally in functions. It's less friendly to accept a vector as an argument, because that asks the user to do much more work.
<add>spaCy's core data structures are implemented as [Cython](http://cython.org/) `cdef`
<add>classes. Memory is managed through the `cymem.cymem.Pool` class, which allows
<add>you to allocate memory which will be freed when the `Pool` object is garbage
<add>collected. This means you usually don't have to worry about freeing memory. You
<add>just have to decide which Python object owns the memory, and make it own the
<add>`Pool`. When that object goes out of scope, the memory will be freed. You do
<add>have to take care that no pointers outlive the object that owns them — but this
<add>is generally quite easy.
<add>
<add>All Cython modules should have the `# cython: infer_types=True` compiler
<add>directive at the top of the file. This makes the code much cleaner, as it avoids
<add>the need for many type declarations. If possible, you should prefer to declare
<add>your functions `nogil`, even if you don't especially care about multi-threading.
<add>The reason is that `nogil` functions help the Cython compiler reason about your
<add>code quite a lot — you're telling the compiler that no Python dynamics are
<add>possible. This lets many errors be raised, and ensures your function will run
<add>at C speed.
<add>
<add>Cython gives you many choices of sequences: you could have a Python list, a
<add>numpy array, a memory view, a C++ vector, or a pointer. Pointers are preferred,
<add>because they are fastest, have the most explicit semantics, and let the compiler
<add>check your code more strictly. C++ vectors are also great — but you should only
<add>use them internally in functions. It's less friendly to accept a vector as an
<add>argument, because that asks the user to do much more work.
<ide>
<ide> Here's how to get a pointer from a numpy array, memory view or vector:
<ide>
<ide> cdef void get_pointers(np.ndarray[int, mode='c'] numpy_array, vector[int] cpp_ve
<ide> pointer3 = &memory_view[0]
<ide> ```
<ide>
<del>Both C arrays and C++ vectors reassure the compiler that no Python operations are possible on your variable. This is a big advantage: it lets the Cython compiler raise many more errors for you.
<add>Both C arrays and C++ vectors reassure the compiler that no Python operations
<add>are possible on your variable. This is a big advantage: it lets the Cython
<add>compiler raise many more errors for you.
<ide>
<del>When getting a pointer from a numpy array or memoryview, take care that the data is actually stored in C-contiguous order — otherwise you'll get a pointer to nonsense. The type-declarations in the code above should generate runtime errors if buffers with incorrect memory layouts are passed in.
<add>When getting a pointer from a numpy array or memoryview, take care that the data
<add>is actually stored in C-contiguous order — otherwise you'll get a pointer to
<add>nonsense. The type-declarations in the code above should generate runtime errors
<add>if buffers with incorrect memory layouts are passed in.
<ide>
<ide> To iterate over the array, the following style is preferred:
<ide>
<ide> cdef int c_total(const int* int_array, int length) nogil:
<ide> return total
<ide> ```
<ide>
<del>If this is confusing, consider that the compiler couldn't deal with `for item in int_array:` — there's no length attached to a raw pointer, so how could we figure out where to stop? The length is provided in the slice notation as a solution to this. Note that we don't have to declare the type of `item` in the code above — the compiler can easily infer it. This gives us tidy code that looks quite like Python, but is exactly as fast as C — because we've made sure the compilation to C is trivial.
<del>
<del>Your functions cannot be declared `nogil` if they need to create Python objects or call Python functions. This is perfectly okay — you shouldn't torture your code just to get `nogil` functions. However, if your function isn't `nogil`, you should compile your module with `cython -a --cplus my_module.pyx` and open the resulting `my_module.html` file in a browser. This will let you see how Cython is compiling your code. Calls into the Python run-time will be in bright yellow. This lets you easily see whether Cython is able to correctly type your code, or whether there are unexpected problems.
<del>
<del>Finally, if you're new to Cython, you should expect to find the first steps a bit frustrating. It's a very large language, since it's essentially a superset of Python and C++, with additional complexity and syntax from numpy. The [documentation](http://docs.cython.org/en/latest/) isn't great, and there are many "traps for new players". Help is available on [Gitter](https://gitter.im/explosion/spaCy).
<del>
<del>Working in Cython is very rewarding once you're over the initial learning curve. As with C and C++, the first way you write something in Cython will often be the performance-optimal approach. In contrast, Python optimisation generally requires a lot of experimentation. Is it faster to have an `if item in my_dict` check, or to use `.get()`? What about `try`/`except`? Does this numpy operation create a copy? There's no way to guess the answers to these questions, and you'll usually be dissatisfied with your results — so there's no way to know when to stop this process. In the worst case, you'll make a mess that invites the next reader to try their luck too. This is like one of those [volcanic gas-traps](http://www.wemjournal.org/article/S1080-6032%2809%2970088-2/abstract), where the rescuers keep passing out from low oxygen, causing another rescuer to follow — only to succumb themselves. In short, just say no to optimizing your Python. If it's not fast enough the first time, just switch to Cython.
<add>If this is confusing, consider that the compiler couldn't deal with
<add>`for item in int_array:` — there's no length attached to a raw pointer, so how
<add>could we figure out where to stop? The length is provided in the slice notation
<add>as a solution to this. Note that we don't have to declare the type of `item` in
<add>the code above — the compiler can easily infer it. This gives us tidy code that
<add>looks quite like Python, but is exactly as fast as C — because we've made sure
<add>the compilation to C is trivial.
<add>
<add>Your functions cannot be declared `nogil` if they need to create Python objects
<add>or call Python functions. This is perfectly okay — you shouldn't torture your
<add>code just to get `nogil` functions. However, if your function isn't `nogil`, you
<add>should compile your module with `cython -a --cplus my_module.pyx` and open the
<add>resulting `my_module.html` file in a browser. This will let you see how Cython
<add>is compiling your code. Calls into the Python run-time will be in bright yellow.
<add>This lets you easily see whether Cython is able to correctly type your code, or
<add>whether there are unexpected problems.
<add>
<add>Finally, if you're new to Cython, you should expect to find the first steps a
<add>bit frustrating. It's a very large language, since it's essentially a superset
<add>of Python and C++, with additional complexity and syntax from numpy. The
<add>[documentation](http://docs.cython.org/en/latest/) isn't great, and there are
<add>many "traps for new players". Working in Cython is very rewarding once you're
<add>over the initial learning curve. As with C and C++, the first way you write
<add>something in Cython will often be the performance-optimal approach. In contrast,
<add>Python optimisation generally requires a lot of experimentation. Is it faster to
<add>have an `if item in my_dict` check, or to use `.get()`? What about `try`/`except`?
<add>Does this numpy operation create a copy? There's no way to guess the answers to
<add>these questions, and you'll usually be dissatisfied with your results — so
<add>there's no way to know when to stop this process. In the worst case, you'll make
<add>a mess that invites the next reader to try their luck too. This is like one of
<add>those [volcanic gas-traps](http://www.wemjournal.org/article/S1080-6032%2809%2970088-2/abstract),
<add>where the rescuers keep passing out from low oxygen, causing another rescuer to
<add>follow — only to succumb themselves. In short, just say no to optimizing your
<add>Python. If it's not fast enough the first time, just switch to Cython.
<ide>
<ide> ### Resources to get you started
<ide>
<ide> Working in Cython is very rewarding once you're over the initial learning curve.
<ide>
<ide> ## Adding tests
<ide>
<del>spaCy uses the [pytest](http://doc.pytest.org/) framework for testing. For more info on this, see the [pytest documentation](http://docs.pytest.org/en/latest/contents.html). Tests for spaCy modules and classes live in their own directories of the same name. For example, tests for the `Tokenizer` can be found in [`/spacy/tests/tokenizer`](spacy/tests/tokenizer). To be interpreted and run, all test files and test functions need to be prefixed with `test_`.
<del>
<del>When adding tests, make sure to use descriptive names, keep the code short and concise and only test for one behaviour at a time. Try to `parametrize` test cases wherever possible, use our pre-defined fixtures for spaCy components and avoid unnecessary imports.
<del>
<del>Extensive tests that take a long time should be marked with `@pytest.mark.slow`. Tests that require the model to be loaded should be marked with `@pytest.mark.models`. Loading the models is expensive and not necessary if you're not actually testing the model performance. If all you needs ia a `Doc` object with annotations like heads, POS tags or the dependency parse, you can use the `get_doc()` utility function to construct it manually.
<add>spaCy uses the [pytest](http://doc.pytest.org/) framework for testing. For more
<add>info on this, see the [pytest documentation](http://docs.pytest.org/en/latest/contents.html).
<add>Tests for spaCy modules and classes live in their own directories of the same
<add>name. For example, tests for the `Tokenizer` can be found in
<add>[`/spacy/tests/tokenizer`](spacy/tests/tokenizer). To be interpreted and run,
<add>all test files and test functions need to be prefixed with `test_`.
<add>
<add>When adding tests, make sure to use descriptive names, keep the code short and
<add>concise and only test for one behaviour at a time. Try to `parametrize` test
<add>cases wherever possible, use our pre-defined fixtures for spaCy components and
<add>avoid unnecessary imports.
<add>
<add>Extensive tests that take a long time should be marked with `@pytest.mark.slow`.
<add>Tests that require the model to be loaded should be marked with
<add>`@pytest.mark.models`. Loading the models is expensive and not necessary if
<add>you're not actually testing the model performance. If all you needs ia a `Doc`
<add>object with annotations like heads, POS tags or the dependency parse, you can
<add>use the `get_doc()` utility function to construct it manually.
<ide>
<ide> 📖 **For more guidelines and information on how to add tests, check out the [tests README](spacy/tests/README.md).**
<ide>
<ide>
<ide> ## Updating the website
<ide>
<del>Our [website and docs](https://spacy.io) are implemented in [Jade/Pug](https://www.jade-lang.org), and built or served by [Harp](https://harpjs.com). Jade/Pug is an extensible templating language with a readable syntax, that compiles to HTML. Here's how to view the site locally:
<add>Our [website and docs](https://spacy.io) are implemented in
<add>[Jade/Pug](https://www.jade-lang.org), and built or served by
<add>[Harp](https://harpjs.com). Jade/Pug is an extensible templating language with a
<add>readable syntax, that compiles to HTML. Here's how to view the site locally:
<ide>
<ide> ```bash
<ide> sudo npm install --global harp
<ide> cd spaCy/website
<ide> harp server
<ide> ```
<ide>
<del>The docs can always use another example or more detail, and they should always be up to date and not misleading. To quickly find the correct file to edit, simply click on the "Suggest edits" button at the bottom of a page.
<add>The docs can always use another example or more detail, and they should always
<add>be up to date and not misleading. To quickly find the correct file to edit,
<add>simply click on the "Suggest edits" button at the bottom of a page. To keep
<add>long pages maintainable, and allow including content in several places without
<add>doubling it, sections often consist of partials. Partials and partial directories
<add>are prefixed by an underscore `_` so they're not compiled with the site. For
<add>example:
<add>
<add>```pug
<add>+section("tokenization")
<add> +h(2, "tokenization") Tokenization
<add> include _spacy-101/_tokenization
<add>```
<ide>
<del>To make it easy to add content components, we use a [collection of custom mixins](_includes/_mixins.jade), like `+table`, `+list` or `+code`.
<add>So if you're looking to edit the content of the tokenization section, you can
<add>find it in `_spacy-101/_tokenization.jade`. To make it easy to add content
<add>components, we use a [collection of custom mixins](_includes/_mixins.jade),
<add>like `+table`, `+list` or `+code`. For an overview of the available mixins and
<add>components, see the [styleguide](https://alpha.spacy.io/styleguide).
<ide>
<ide> 📖 **For more info and troubleshooting guides, check out the [website README](website).**
<ide>
<ide> ### Resources to get you started
<ide>
<ide> * [Guide to static websites with Harp and Jade](https://ines.io/blog/the-ultimate-guide-static-websites-harp-jade) (ines.io)
<ide> * [Building a website with modular markup components (mixins)](https://explosion.ai/blog/modular-markup) (explosion.ai)
<add>* [spacy.io Styleguide](https://alpha.spacy.io/styleguide) (spacy.io)
<ide> * [Jade/Pug documentation](https://pugjs.org) (pugjs.org)
<ide> * [Harp documentation](https://harpjs.com/) (harpjs.com)
<ide>
<ide>
<del>## Submitting a tutorial
<add>## Publishing spaCy extensions and plugins
<ide>
<del>Did you write a [tutorial](https://spacy.io/docs/usage/tutorials) to help others use spaCy, or did you come across one that should be added to our directory? You can submit it by making a pull request to [`website/docs/usage/_data.json`](website/docs/usage/_data.json):
<add>We're very excited about all the new possibilities for **community extensions**
<add>and plugins in spaCy v2.0, and we can't wait to see what you build with it!
<ide>
<del>```json
<del>{
<del> "tutorials": {
<del> "deep_dives": {
<del> "Deep Learning with custom pipelines and Keras": {
<del> "url": "https://explosion.ai/blog/spacy-deep-learning-keras",
<del> "author": "Matthew Honnibal",
<del> "tags": [ "keras", "sentiment" ]
<del> }
<del> }
<del> }
<del>}
<del>```
<add>* An extension or plugin should add substantial functionality, be
<add>**well-documented** and **open-source**. It should be available for users to download
<add>and install as a Python package – for example via [PyPi](http://pypi.python.org).
<ide>
<del>### A few tips
<del>
<del>* A suitable tutorial should provide additional content and practical examples that are not covered as such in the docs.
<del>* Make sure to choose the right category – `first_steps`, `deep_dives` (tutorials that take a deeper look at specific features) or `code` (programs and scripts on GitHub etc.).
<del>* Don't go overboard with the tags. Take inspirations from the existing ones and only add tags for features (`"sentiment"`, `"pos"`) or integrations (`"jupyter"`, `"keras"`).
<del>* Double-check the JSON markup and/or use a linter. A wrong or missing comma will (unfortunately) break the site rendering.
<del>
<del>## Submitting a project to the showcase
<del>
<del>Have you built a library, visualizer, demo or product with spaCy, or did you come across one that should be featured in our [showcase](https://spacy.io/docs/usage/showcase)? You can submit it by making a pull request to [`website/docs/usage/_data.json`](website/docs/usage/_data.json):
<del>
<del>```json
<del>{
<del> "showcase": {
<del> "visualizations": {
<del> "displaCy": {
<del> "url": "https://demos.explosion.ai/displacy",
<del> "author": "Ines Montani",
<del> "description": "An open-source NLP visualiser for the modern web",
<del> "image": "displacy.jpg"
<del> }
<del> }
<del> }
<del>}
<del>```
<add>* Extensions that write to `Doc`, `Token` or `Span` attributes should be wrapped
<add>as [pipeline components](https://alpha.spacy.io/usage/processing-pipelines#custom-components)
<add>that users can **add to their processing pipeline** using `nlp.add_pipe()`.
<add>
<add>* When publishing your extension on GitHub, **tag it** with the topics
<add>[`spacy`](https://github.com/topics/spacy?o=desc&s=stars) and
<add>[`spacy-extensions`](https://github.com/topics/spacy-extension?o=desc&s=stars)
<add>to make it easier to find. Those are also the topics we're linking to from the
<add>spaCy website. If you're sharing your project on Twitter, feel free to tag
<add>[@spacy_io](https://twitter.com/spacy_io) so we can check it out.
<ide>
<del>### A few tips
<add>* Once your extension is published, you can open an issue on the
<add>[issue tracker](https://github.com/explosion/spacy/issues) to suggest it for the
<add>[resources directory](https://alpha.spacy.io/usage/resources#extensions) on the
<add>website.
<ide>
<del>* A suitable third-party library should add substantial functionality, be well-documented and open-source. If it's just a code snippet or script, consider submitting it to the `code` category of the tutorials section instead.
<del>* A suitable demo should be hosted and accessible online. Open-source code is always a plus.
<del>* For visualizations and products, add an image that clearly shows how it looks – screenshots are ideal.
<del>* The image should be resized to 300x188px, optimised using a tool like [ImageOptim](https://imageoptim.com/mac) and added to [`website/assets/img/showcase`](website/assets/img/showcase).
<del>* Double-check the JSON markup and/or use a linter. A wrong or missing comma will (unfortunately) break the site rendering.
<add>📖 **For more tips and best practices, see the [checklist for developing spaCy extensions](https://alpha.spacy.io/usage/processing-pipelines#extensions).**
<ide>
<ide> ## Code of conduct
<ide>
<del>spaCy adheres to the [Contributor Covenant Code of Conduct](http://contributor-covenant.org/version/1/4/). By participating, you are expected to uphold this code.
<add>spaCy adheres to the
<add>[Contributor Covenant Code of Conduct](http://contributor-covenant.org/version/1/4/).
<add>By participating, you are expected to uphold this code. | 1 |
Go | Go | remove redundant word | c6edecc2d67b8e4659873fe9a960d76f7b2f82f4 | <ide><path>vendor/src/github.com/docker/go-connections/sockets/tcp_socket.go
<ide> import (
<ide> )
<ide>
<ide> // NewTCPSocket creates a TCP socket listener with the specified address and
<del>// and the specified tls configuration. If TLSConfig is set, will encapsulate the
<add>// the specified tls configuration. If TLSConfig is set, will encapsulate the
<ide> // TCP listener inside a TLS one.
<ide> func NewTCPSocket(addr string, tlsConfig *tls.Config) (net.Listener, error) {
<ide> l, err := net.Listen("tcp", addr) | 1 |
Javascript | Javascript | add bionic estore application to the showcase | 8f889c942a579817b02b6f982aa9ad8d70c32cd1 | <ide><path>website/src/react-native/showcase.js
<ide> var apps = [
<ide> link: 'https://itunes.apple.com/us/app/beetroot/id1016159001?ls=1&mt=8',
<ide> author: 'Alex Duckmanton',
<ide> },
<add> {
<add> name: 'Bionic eStore',
<add> icon: 'http://a5.mzstatic.com/us/r30/Purple7/v4/c1/9a/3f/c19a3f82-ecc3-d60b-f983-04acc203705f/icon175x175.jpeg',
<add> link: 'https://itunes.apple.com/us/app/bionic-estore/id994537615?mt=8',
<add> author: 'Digidemon',
<add> },
<ide> {
<ide> name: 'CANDDi',
<ide> icon: 'http://a5.mzstatic.com/eu/r30/Purple7/v4/c4/e4/85/c4e48546-7127-a133-29f2-3e2e1aa0f9af/icon175x175.png', | 1 |
Javascript | Javascript | fix lint error | 3fb9d61eb91d6fdb0e541061aede623c9b067f3a | <ide><path>examples/js/renderers/CSS2DRenderer.js
<ide> THREE.CSS2DRenderer = function () {
<ide>
<ide> return result;
<ide>
<del> }
<add> };
<ide>
<ide> var zOrder = function ( scene ) {
<ide> | 1 |
Ruby | Ruby | fix backtrace cleaner example | 8df6b6464f36910680eef7016d31e968c1d9419c | <ide><path>activesupport/lib/active_support/backtrace_cleaner.rb
<ide> def clean(backtrace, kind = :silent)
<ide> # mapped against this filter.
<ide> #
<ide> # # Will turn "/my/rails/root/app/models/person.rb" into "/app/models/person.rb"
<del> # backtrace_cleaner.add_filter { |line| line.gsub(Rails.root, '') }
<add> # backtrace_cleaner.add_filter { |line| line.gsub(Rails.root.to_s, '') }
<ide> def add_filter(&block)
<ide> @filters << block
<ide> end | 1 |
Javascript | Javascript | fix typo and rephrase for simplicity | 7dd42d31a7b9d6c2b1c8f7ea6636e8b70288a3c2 | <ide><path>src/ng/directive/ngModel.js
<ide> NgModelController.prototype = {
<ide> *
<ide> * @description
<ide> * Cancel an update and reset the input element's value to prevent an update to the `$modelValue`,
<del> * which may be caused by a pending debounced event or because the input is waiting for a some
<add> * which may be caused by a pending debounced event or because the input is waiting for some
<ide> * future event.
<ide> *
<ide> * If you have an input that uses `ng-model-options` to set up debounced updates or updates that
<del> * depend on special events such as blur, you can have a situation where there is a period when
<del> * the `$viewValue` is out of sync with the ngModel's `$modelValue`.
<add> * depend on special events such as `blur`, there can be a period when the `$viewValue` is out of
<add> * sync with the ngModel's `$modelValue`.
<ide> *
<ide> * In this case, you can use `$rollbackViewValue()` to manually cancel the debounced / future update
<ide> * and reset the input to the last committed view value. | 1 |
Ruby | Ruby | simplify filter normalization | 5966b801ced62bdfcf1c8189bc068911db90ac13 | <ide><path>actionpack/lib/action_dispatch/routing/inspector.rb
<ide> def format(formatter, filter = nil)
<ide>
<ide> def normalize_filter(filter)
<ide> if filter.is_a?(Hash) && filter[:controller]
<del> {controller: /#{filter[:controller].downcase.sub(/_?controller\z/, '').sub('::', '/')}/}
<del> elsif filter.is_a?(String)
<del> {controller: /#{filter}/, action: /#{filter}/}
<del> else
<del> nil
<add> { controller: /#{filter[:controller].downcase.sub(/_?controller\z/, '').sub('::', '/')}/ }
<add> elsif filter
<add> { controller: /#{filter}/, action: /#{filter}/ }
<ide> end
<ide> end
<ide> | 1 |
Python | Python | fix info text on pipeline in package cli | 7e04b7f89c9245388cbd3bf6c75b957bc0822048 | <ide><path>spacy/cli/package.py
<ide> def generate_meta():
<ide> def generate_pipeline():
<ide> prints("If set to 'True', the default pipeline is used. If set to 'False', "
<ide> "the pipeline will be disabled. Components should be specified as a "
<del> "comma-separated list of component names, e.g. vectorizer, tagger, "
<add> "comma-separated list of component names, e.g. tensorizer, tagger, "
<ide> "parser, ner. For more information, see the docs on processing pipelines.",
<ide> title="Enter your model's pipeline components")
<ide> pipeline = util.get_raw_input("Pipeline components", True) | 1 |
Javascript | Javascript | remove legacypromise in src/core/chunked_stream.js | 89c11ca9a21ccce56410ece90acd9eb9c4cd2725 | <ide><path>src/core/chunked_stream.js
<ide> * limitations under the License.
<ide> */
<ide> /* globals assert, MissingDataException, isInt, NetworkManager, Promise,
<del> isEmptyObj, LegacyPromise */
<add> isEmptyObj, createPromiseCapability */
<ide>
<ide> 'use strict';
<ide>
<ide> var ChunkedStreamManager = (function ChunkedStreamManagerClosure() {
<ide> this.requestsByChunk = {};
<ide> this.callbacksByRequest = {};
<ide>
<del> this.loadedStream = new LegacyPromise();
<add> this._loadedStreamCapability = createPromiseCapability();
<add>
<ide> if (args.initialData) {
<ide> this.setInitialData(args.initialData);
<ide> }
<ide> var ChunkedStreamManager = (function ChunkedStreamManagerClosure() {
<ide> setInitialData: function ChunkedStreamManager_setInitialData(data) {
<ide> this.stream.onReceiveInitialData(data);
<ide> if (this.stream.allChunksLoaded()) {
<del> this.loadedStream.resolve(this.stream);
<add> this._loadedStreamCapability.resolve(this.stream);
<ide> } else if (this.msgHandler) {
<ide> this.msgHandler.send('DocProgress', {
<ide> loaded: data.length,
<ide> var ChunkedStreamManager = (function ChunkedStreamManagerClosure() {
<ide> },
<ide>
<ide> onLoadedStream: function ChunkedStreamManager_getLoadedStream() {
<del> return this.loadedStream;
<add> return this._loadedStreamCapability.promise;
<ide> },
<ide>
<ide> // Get all the chunks that are not yet loaded and groups them into
<ide> // contiguous ranges to load in as few requests as possible
<ide> requestAllChunks: function ChunkedStreamManager_requestAllChunks() {
<ide> var missingChunks = this.stream.getMissingChunks();
<ide> this.requestChunks(missingChunks);
<del> return this.loadedStream;
<add> return this._loadedStreamCapability.promise;
<ide> },
<ide>
<ide> requestChunks: function ChunkedStreamManager_requestChunks(chunks,
<ide> var ChunkedStreamManager = (function ChunkedStreamManagerClosure() {
<ide>
<ide> this.stream.onReceiveData(begin, chunk);
<ide> if (this.stream.allChunksLoaded()) {
<del> this.loadedStream.resolve(this.stream);
<add> this._loadedStreamCapability.resolve(this.stream);
<ide> }
<ide>
<ide> var loadedRequests = []; | 1 |
Python | Python | set the correct variable | 4eeb9a8e8dc401db4c715f772a22fe18e464702a | <ide><path>setup.py
<ide> except ImportError:
<ide> has_epydoc = False
<ide>
<del>import libcloud.utils.misc
<add>import libcloud.utils
<ide> from libcloud.utils.dist import get_packages, get_data_files
<ide>
<del>libcloud.utils.misc.SHOW_DEPRECATION_WARNING = False
<add>libcloud.utils.SHOW_DEPRECATION_WARNING = False
<ide>
<ide> # Different versions of python have different requirements. We can't use
<ide> # libcloud.utils.py3 here because it relies on backports dependency being | 1 |
Javascript | Javascript | skip some pummel tests on slower machines | 4dc8e769a5e6b4bbfeb684de7f3ce15a6dae76d3 | <ide><path>test/pummel/test-crypto-dh-hash-modp18.js
<ide>
<ide> 'use strict';
<ide> const common = require('../common');
<del>if (!common.hasCrypto)
<add>
<add>if (!common.hasCrypto) {
<ide> common.skip('node compiled without OpenSSL.');
<add>}
<add>
<add>if ((process.config.variables.arm_version === '6') ||
<add> (process.config.variables.arm_version === '7')) {
<add> common.skip('Too slow for armv6 and armv7 bots');
<add>}
<ide>
<ide> const assert = require('assert');
<ide> const crypto = require('crypto');
<ide><path>test/pummel/test-crypto-dh-hash.js
<ide>
<ide> 'use strict';
<ide> const common = require('../common');
<del>if (!common.hasCrypto)
<add>
<add>if (!common.hasCrypto) {
<ide> common.skip('node compiled without OpenSSL.');
<add>}
<add>
<add>if ((process.config.variables.arm_version === '6') ||
<add> (process.config.variables.arm_version === '7')) {
<add> common.skip('Too slow for armv6 and armv7 bots');
<add>}
<ide>
<ide> const assert = require('assert');
<ide> const crypto = require('crypto');
<ide><path>test/pummel/test-crypto-dh-keys.js
<ide>
<ide> 'use strict';
<ide> const common = require('../common');
<add>
<ide> if (!common.hasCrypto) {
<ide> common.skip('node compiled without OpenSSL.');
<ide> }
<ide><path>test/pummel/test-dh-regr.js
<ide>
<ide> 'use strict';
<ide> const common = require('../common');
<del>if (!common.hasCrypto)
<add>
<add>if (!common.hasCrypto) {
<ide> common.skip('missing crypto');
<add>}
<add>
<add>if ((process.config.variables.arm_version === '6') ||
<add> (process.config.variables.arm_version === '7')) {
<add> common.skip('Too slow for armv6 and armv7 bots');
<add>}
<ide>
<ide> const assert = require('assert');
<ide> const crypto = require('crypto');
<ide><path>test/pummel/test-next-tick-infinite-calls.js
<ide> // USE OR OTHER DEALINGS IN THE SOFTWARE.
<ide>
<ide> 'use strict';
<del>require('../common');
<add>const common = require('../common');
<add>
<add>if ((process.config.variables.arm_version === '6') ||
<add> (process.config.variables.arm_version === '7')) {
<add> common.skip('Too slow for armv6 and armv7 bots');
<add>}
<ide>
<ide> let complete = 0;
<ide>
<ide><path>test/pummel/test-policy-integrity.js
<ide> 'use strict';
<ide>
<ide> const common = require('../common');
<del>if (!common.hasCrypto) common.skip('missing crypto');
<add>
<add>if (!common.hasCrypto) {
<add> common.skip('missing crypto');
<add>}
<add>
<add>if ((process.config.variables.arm_version === '6') ||
<add> (process.config.variables.arm_version === '7')) {
<add> common.skip('Too slow for armv6 and armv7 bots');
<add>}
<add>
<ide> common.requireNoPackageJSONAbove();
<ide>
<ide> const { debuglog } = require('util'); | 6 |
Text | Text | remove rackt style paragraph from contributing.md | b04e7e4ea719db518faaab09e36d20112241fedd | <ide><path>CONTRIBUTING.md
<ide> Not all examples have tests. If you see an example project without tests, you ar
<ide>
<ide> Please visit the [Examples page](http://redux.js.org/docs/introduction/Examples.html) for information on running individual examples.
<ide>
<del>### Style
<del>
<del>The [reactjs](https://github.com/reactjs) GitHub org is trying to keep a standard style across its various projects, which can be found over in [eslint-config-reactjs](https://github.com/reactjs/eslint-config-reactjs). If you have a style change proposal, it should first be proposed there. If accepted, we will be happy to accept a PR to implement it here.
<del>
<ide> ### Sending a Pull Request
<ide>
<ide> For non-trivial changes, please open an issue with a proposal for a new feature or refactoring before starting on the work. We don’t want you to waste your efforts on a pull request that we won’t want to accept. | 1 |
Ruby | Ruby | remove useless assertions | d7d379967a7bc6b2e562d271c673c3e142294224 | <ide><path>activerecord/test/cases/base_test.rb
<ide> def test_primary_key_with_no_id
<ide>
<ide> unless current_adapter?(:PostgreSQLAdapter,:OracleAdapter,:SQLServerAdapter)
<ide> def test_limit_with_comma
<del> assert_nothing_raised do
<del> Topic.limit("1,2").all
<del> end
<add> assert Topic.limit("1,2").all
<ide> end
<ide> end
<ide>
<ide> def test_limit_without_comma
<del> assert_nothing_raised do
<del> assert_equal 1, Topic.limit("1").all.length
<del> end
<del>
<del> assert_nothing_raised do
<del> assert_equal 1, Topic.limit(1).all.length
<del> end
<add> assert_equal 1, Topic.limit("1").all.length
<add> assert_equal 1, Topic.limit(1).all.length
<ide> end
<ide>
<ide> def test_invalid_limit | 1 |
PHP | PHP | add test for size inline messages | 90ef1d31b22a042233adb6bfbc1e7f162bb96b73 | <ide><path>tests/Validation/ValidationValidatorTest.php
<ide> public function testInlineValidationMessagesAreRespected()
<ide> $this->assertFalse($v->passes());
<ide> $v->messages()->setFormat(':message');
<ide> $this->assertEquals('require it please!', $v->messages()->first('name'));
<add>
<add> $trans = $this->getIlluminateArrayTranslator();
<add> $v = new Validator($trans, ['name' => 'foobarba'], ['name' => 'size:9'], ['size' => ['string' => ':attribute should be of length :size']]);
<add> $this->assertFalse($v->passes());
<add> $v->messages()->setFormat(':message');
<add> $this->assertEquals('name should be of length 9', $v->messages()->first('name'));
<ide> }
<ide>
<ide> public function testInlineValidationMessagesAreRespectedWithAsterisks() | 1 |
Ruby | Ruby | remove missing integration points of av extraction | d6eda3ef3c59e377670442cd7f36460dbdf389f5 | <ide><path>actionpack/test/abstract_unit.rb
<ide> def assert_header(name, value)
<ide> end
<ide> end
<ide>
<del>ActionController::Base.superclass.send(:include, ActionView::Layouts)
<del>
<ide> module ActionController
<ide> class Base
<ide> include ActionController::Testing
<ide><path>actionpack/test/controller/render_test.rb
<ide> def test_head_with_status_code_first
<ide> assert_equal "something", @response.headers["X-Custom-Header"]
<ide> assert_response :forbidden
<ide> end
<del>end
<ide>\ No newline at end of file
<add>end
<ide><path>railties/test/rails_info_controller_test.rb
<ide> require 'abstract_unit'
<ide>
<del>ActionController::Base.superclass.send(:include, ActionView::Layouts)
<del>
<ide> module ActionController
<ide> class Base
<ide> include ActionController::Testing | 3 |
Mixed | Go | make discovery ttl and heartbeat configurable | 2efdb8cbf519f55836b0703e47c907e24a20eff6 | <ide><path>daemon/discovery.go
<ide> package daemon
<ide>
<ide> import (
<add> "fmt"
<add> "strconv"
<ide> "time"
<ide>
<ide> log "github.com/Sirupsen/logrus"
<ide> import (
<ide> const (
<ide> // defaultDiscoveryHeartbeat is the default value for discovery heartbeat interval.
<ide> defaultDiscoveryHeartbeat = 20 * time.Second
<del>
<del> // defaultDiscoveryTTL is the default TTL interface for discovery.
<del> defaultDiscoveryTTL = 60 * time.Second
<add> // defaultDiscoveryTTLFactor is the default TTL factor for discovery
<add> defaultDiscoveryTTLFactor = 3
<ide> )
<ide>
<add>func discoveryOpts(clusterOpts map[string]string) (time.Duration, time.Duration, error) {
<add> var (
<add> heartbeat = defaultDiscoveryHeartbeat
<add> ttl = defaultDiscoveryTTLFactor * defaultDiscoveryHeartbeat
<add> )
<add>
<add> if hb, ok := clusterOpts["discovery.heartbeat"]; ok {
<add> h, err := strconv.Atoi(hb)
<add> if err != nil {
<add> return time.Duration(0), time.Duration(0), err
<add> }
<add> heartbeat = time.Duration(h) * time.Second
<add> ttl = defaultDiscoveryTTLFactor * heartbeat
<add> }
<add>
<add> if tstr, ok := clusterOpts["discovery.ttl"]; ok {
<add> t, err := strconv.Atoi(tstr)
<add> if err != nil {
<add> return time.Duration(0), time.Duration(0), err
<add> }
<add> ttl = time.Duration(t) * time.Second
<add>
<add> if _, ok := clusterOpts["discovery.heartbeat"]; !ok {
<add> h := int(t / defaultDiscoveryTTLFactor)
<add> heartbeat = time.Duration(h) * time.Second
<add> }
<add>
<add> if ttl <= heartbeat {
<add> return time.Duration(0), time.Duration(0),
<add> fmt.Errorf("discovery.ttl timer must be greater than discovery.heartbeat")
<add> }
<add> }
<add>
<add> return heartbeat, ttl, nil
<add>}
<add>
<ide> // initDiscovery initialized the nodes discovery subsystem by connecting to the specified backend
<ide> // and start a registration loop to advertise the current node under the specified address.
<ide> func initDiscovery(backend, address string, clusterOpts map[string]string) (discovery.Backend, error) {
<del> discoveryBackend, err := discovery.New(backend, defaultDiscoveryHeartbeat, defaultDiscoveryTTL, clusterOpts)
<add>
<add> heartbeat, ttl, err := discoveryOpts(clusterOpts)
<add> if err != nil {
<add> return nil, err
<add> }
<add>
<add> discoveryBackend, err := discovery.New(backend, heartbeat, ttl, clusterOpts)
<ide> if err != nil {
<ide> return nil, err
<ide> }
<ide>
<ide> // We call Register() on the discovery backend in a loop for the whole lifetime of the daemon,
<ide> // but we never actually Watch() for nodes appearing and disappearing for the moment.
<del> go registrationLoop(discoveryBackend, address)
<add> go registrationLoop(discoveryBackend, address, heartbeat)
<ide> return discoveryBackend, nil
<ide> }
<ide>
<ide> func registerAddr(backend discovery.Backend, addr string) {
<ide> // registrationLoop registers the current node against the discovery backend using the specified
<ide> // address. The function never returns, as registration against the backend comes with a TTL and
<ide> // requires regular heartbeats.
<del>func registrationLoop(discoveryBackend discovery.Backend, address string) {
<add>func registrationLoop(discoveryBackend discovery.Backend, address string, heartbeat time.Duration) {
<ide> registerAddr(discoveryBackend, address)
<del> for range time.Tick(defaultDiscoveryHeartbeat) {
<add> for range time.Tick(heartbeat) {
<ide> registerAddr(discoveryBackend, address)
<ide> }
<ide> }
<ide><path>daemon/discovery_test.go
<add>package daemon
<add>
<add>import (
<add> "testing"
<add> "time"
<add>)
<add>
<add>func TestDiscoveryOpts(t *testing.T) {
<add> clusterOpts := map[string]string{"discovery.heartbeat": "10", "discovery.ttl": "5"}
<add> heartbeat, ttl, err := discoveryOpts(clusterOpts)
<add> if err == nil {
<add> t.Fatalf("discovery.ttl < discovery.heartbeat must fail")
<add> }
<add>
<add> clusterOpts = map[string]string{"discovery.heartbeat": "10", "discovery.ttl": "10"}
<add> heartbeat, ttl, err = discoveryOpts(clusterOpts)
<add> if err == nil {
<add> t.Fatalf("discovery.ttl == discovery.heartbeat must fail")
<add> }
<add>
<add> clusterOpts = map[string]string{"discovery.heartbeat": "invalid"}
<add> heartbeat, ttl, err = discoveryOpts(clusterOpts)
<add> if err == nil {
<add> t.Fatalf("invalid discovery.heartbeat must fail")
<add> }
<add>
<add> clusterOpts = map[string]string{"discovery.ttl": "invalid"}
<add> heartbeat, ttl, err = discoveryOpts(clusterOpts)
<add> if err == nil {
<add> t.Fatalf("invalid discovery.ttl must fail")
<add> }
<add>
<add> clusterOpts = map[string]string{"discovery.heartbeat": "10", "discovery.ttl": "20"}
<add> heartbeat, ttl, err = discoveryOpts(clusterOpts)
<add> if err != nil {
<add> t.Fatal(err)
<add> }
<add>
<add> if heartbeat != 10*time.Second {
<add> t.Fatalf("Heatbeat - Expected : %v, Actual : %v", 10*time.Second, heartbeat)
<add> }
<add>
<add> if ttl != 20*time.Second {
<add> t.Fatalf("TTL - Expected : %v, Actual : %v", 20*time.Second, ttl)
<add> }
<add>
<add> clusterOpts = map[string]string{"discovery.heartbeat": "10"}
<add> heartbeat, ttl, err = discoveryOpts(clusterOpts)
<add> if err != nil {
<add> t.Fatal(err)
<add> }
<add>
<add> if heartbeat != 10*time.Second {
<add> t.Fatalf("Heatbeat - Expected : %v, Actual : %v", 10*time.Second, heartbeat)
<add> }
<add>
<add> expected := 10 * defaultDiscoveryTTLFactor * time.Second
<add> if ttl != expected {
<add> t.Fatalf("TTL - Expected : %v, Actual : %v", expected, ttl)
<add> }
<add>
<add> clusterOpts = map[string]string{"discovery.ttl": "30"}
<add> heartbeat, ttl, err = discoveryOpts(clusterOpts)
<add> if err != nil {
<add> t.Fatal(err)
<add> }
<add>
<add> if ttl != 30*time.Second {
<add> t.Fatalf("TTL - Expected : %v, Actual : %v", 30*time.Second, ttl)
<add> }
<add>
<add> expected = 30 * time.Second / defaultDiscoveryTTLFactor
<add> if heartbeat != expected {
<add> t.Fatalf("Heatbeat - Expected : %v, Actual : %v", expected, heartbeat)
<add> }
<add>
<add> clusterOpts = map[string]string{}
<add> heartbeat, ttl, err = discoveryOpts(clusterOpts)
<add> if err != nil {
<add> t.Fatal(err)
<add> }
<add>
<add> if heartbeat != defaultDiscoveryHeartbeat {
<add> t.Fatalf("Heatbeat - Expected : %v, Actual : %v", defaultDiscoveryHeartbeat, heartbeat)
<add> }
<add>
<add> expected = defaultDiscoveryHeartbeat * defaultDiscoveryTTLFactor
<add> if ttl != expected {
<add> t.Fatalf("TTL - Expected : %v, Actual : %v", expected, ttl)
<add> }
<add>}
<ide><path>docs/reference/commandline/daemon.md
<ide> docker daemon \
<ide>
<ide> The currently supported cluster store options are:
<ide>
<add>* `discovery.heartbeat`
<add>
<add> Specifies the heartbeat timer in seconds which is used by the daemon as a
<add> keepalive mechanism to make sure discovery module treats the node as alive
<add> in the cluster. If not configured, the default value is 20 seconds.
<add>
<add>* `discovery.ttl`
<add>
<add> Specifies the ttl (time-to-live) in seconds which is used by the discovery
<add> module to timeout a node if a valid heartbeat is not received within the
<add> configured ttl value. If not configured, the default value is 60 seconds.
<add>
<ide> * `kv.cacertfile`
<ide>
<ide> Specifies the path to a local file with PEM encoded CA certificates to trust | 3 |
Ruby | Ruby | update formula tests for #outdated_kegs | 7b85934f502cd6adf4696cf63cd3cd0c4449d40f | <ide><path>Library/Homebrew/test/test_formula.rb
<ide> def setup_tab_for_prefix(prefix, options = {})
<ide> tab
<ide> end
<ide>
<del> def reset_outdated_versions
<del> f.instance_variable_set(:@outdated_versions, nil)
<add> def reset_outdated_kegs
<add> f.instance_variable_set(:@outdated_kegs, nil)
<ide> end
<ide>
<ide> def test_greater_different_tap_installed
<ide> setup_tab_for_prefix(greater_prefix, tap: "user/repo")
<del> assert_predicate f.outdated_versions, :empty?
<add> assert_predicate f.outdated_kegs, :empty?
<ide> end
<ide>
<ide> def test_greater_same_tap_installed
<ide> f.instance_variable_set(:@tap, CoreTap.instance)
<ide> setup_tab_for_prefix(greater_prefix, tap: "homebrew/core")
<del> assert_predicate f.outdated_versions, :empty?
<add> assert_predicate f.outdated_kegs, :empty?
<ide> end
<ide>
<ide> def test_outdated_different_tap_installed
<ide> setup_tab_for_prefix(outdated_prefix, tap: "user/repo")
<del> refute_predicate f.outdated_versions, :empty?
<add> refute_predicate f.outdated_kegs, :empty?
<ide> end
<ide>
<ide> def test_outdated_same_tap_installed
<ide> f.instance_variable_set(:@tap, CoreTap.instance)
<ide> setup_tab_for_prefix(outdated_prefix, tap: "homebrew/core")
<del> refute_predicate f.outdated_versions, :empty?
<add> refute_predicate f.outdated_kegs, :empty?
<ide> end
<ide>
<ide> def test_same_head_installed
<ide> f.instance_variable_set(:@tap, CoreTap.instance)
<ide> setup_tab_for_prefix(head_prefix, tap: "homebrew/core")
<del> assert_predicate f.outdated_versions, :empty?
<add> assert_predicate f.outdated_kegs, :empty?
<ide> end
<ide>
<ide> def test_different_head_installed
<ide> f.instance_variable_set(:@tap, CoreTap.instance)
<ide> setup_tab_for_prefix(head_prefix, tap: "user/repo")
<del> assert_predicate f.outdated_versions, :empty?
<add> assert_predicate f.outdated_kegs, :empty?
<ide> end
<ide>
<ide> def test_mixed_taps_greater_version_installed
<ide> f.instance_variable_set(:@tap, CoreTap.instance)
<ide> setup_tab_for_prefix(outdated_prefix, tap: "homebrew/core")
<ide> setup_tab_for_prefix(greater_prefix, tap: "user/repo")
<ide>
<del> assert_predicate f.outdated_versions, :empty?
<add> assert_predicate f.outdated_kegs, :empty?
<ide>
<ide> setup_tab_for_prefix(greater_prefix, tap: "homebrew/core")
<del> reset_outdated_versions
<add> reset_outdated_kegs
<ide>
<del> assert_predicate f.outdated_versions, :empty?
<add> assert_predicate f.outdated_kegs, :empty?
<ide> end
<ide>
<ide> def test_mixed_taps_outdated_version_installed
<ide> def test_mixed_taps_outdated_version_installed
<ide>
<ide> setup_tab_for_prefix(outdated_prefix)
<ide> setup_tab_for_prefix(extra_outdated_prefix, tap: "homebrew/core")
<del> reset_outdated_versions
<add> reset_outdated_kegs
<ide>
<del> refute_predicate f.outdated_versions, :empty?
<add> refute_predicate f.outdated_kegs, :empty?
<ide>
<ide> setup_tab_for_prefix(outdated_prefix, tap: "user/repo")
<del> reset_outdated_versions
<add> reset_outdated_kegs
<ide>
<del> refute_predicate f.outdated_versions, :empty?
<add> refute_predicate f.outdated_kegs, :empty?
<ide> end
<ide>
<ide> def test_same_version_tap_installed
<ide> f.instance_variable_set(:@tap, CoreTap.instance)
<ide> setup_tab_for_prefix(same_prefix, tap: "homebrew/core")
<ide>
<del> assert_predicate f.outdated_versions, :empty?
<add> assert_predicate f.outdated_kegs, :empty?
<ide>
<ide> setup_tab_for_prefix(same_prefix, tap: "user/repo")
<del> reset_outdated_versions
<add> reset_outdated_kegs
<ide>
<del> assert_predicate f.outdated_versions, :empty?
<add> assert_predicate f.outdated_kegs, :empty?
<ide> end
<ide>
<ide> def test_outdated_installed_head_less_than_stable
<ide> tab = setup_tab_for_prefix(head_prefix, versions: { "stable" => "1.0" })
<del> refute_predicate f.outdated_versions, :empty?
<add> refute_predicate f.outdated_kegs, :empty?
<ide>
<ide> # Tab.for_keg(head_prefix) will be fetched from CACHE but we write it anyway
<ide> tab.source["versions"] = { "stable" => f.version.to_s }
<ide> tab.write
<del> reset_outdated_versions
<add> reset_outdated_kegs
<ide>
<del> assert_predicate f.outdated_versions, :empty?
<add> assert_predicate f.outdated_kegs, :empty?
<ide> end
<ide>
<ide> def test_outdated_fetch_head
<ide> def test_outdated_fetch_head
<ide> end
<ide> end
<ide>
<del> refute_predicate f.outdated_versions(fetch_head: true), :empty?
<add> refute_predicate f.outdated_kegs(fetch_head: true), :empty?
<ide>
<ide> tab_a.source["versions"] = { "stable" => f.version.to_s }
<ide> tab_a.write
<del> reset_outdated_versions
<del> refute_predicate f.outdated_versions(fetch_head: true), :empty?
<add> reset_outdated_kegs
<add> refute_predicate f.outdated_kegs(fetch_head: true), :empty?
<ide>
<ide> head_prefix_a.rmtree
<del> reset_outdated_versions
<del> refute_predicate f.outdated_versions(fetch_head: true), :empty?
<add> reset_outdated_kegs
<add> refute_predicate f.outdated_kegs(fetch_head: true), :empty?
<ide>
<ide> setup_tab_for_prefix(head_prefix_c, source_modified_time: 1)
<del> reset_outdated_versions
<del> assert_predicate f.outdated_versions(fetch_head: true), :empty?
<add> reset_outdated_kegs
<add> assert_predicate f.outdated_kegs(fetch_head: true), :empty?
<ide> ensure
<ide> ENV.replace(initial_env)
<ide> testball_repo.rmtree if testball_repo.exist?
<ide> def test_outdated_fetch_head
<ide> FileUtils.rm_rf HOMEBREW_CELLAR/"testball"
<ide> end
<ide>
<del> def test_outdated_versions_version_scheme_changed
<add> def test_outdated_kegs_version_scheme_changed
<ide> @f = formula("testball") do
<ide> url "foo"
<ide> version "20141010"
<ide> def test_outdated_versions_version_scheme_changed
<ide> prefix = HOMEBREW_CELLAR.join("testball/0.1")
<ide> setup_tab_for_prefix(prefix, versions: { "stable" => "0.1" })
<ide>
<del> refute_predicate f.outdated_versions, :empty?
<add> refute_predicate f.outdated_kegs, :empty?
<ide> ensure
<ide> prefix.rmtree
<ide> end
<ide>
<del> def test_outdated_versions_mixed_version_schemes
<add> def test_outdated_kegs_mixed_version_schemes
<ide> @f = formula("testball") do
<ide> url "foo"
<ide> version "20141010"
<ide> def test_outdated_versions_mixed_version_schemes
<ide> prefix_b = HOMEBREW_CELLAR.join("testball/2.14")
<ide> setup_tab_for_prefix(prefix_b, versions: { "stable" => "2.14", "version_scheme" => 2 })
<ide>
<del> refute_predicate f.outdated_versions, :empty?
<del> reset_outdated_versions
<add> refute_predicate f.outdated_kegs, :empty?
<add> reset_outdated_kegs
<ide>
<ide> prefix_c = HOMEBREW_CELLAR.join("testball/20141009")
<ide> setup_tab_for_prefix(prefix_c, versions: { "stable" => "20141009", "version_scheme" => 3 })
<ide>
<del> refute_predicate f.outdated_versions, :empty?
<del> reset_outdated_versions
<add> refute_predicate f.outdated_kegs, :empty?
<add> reset_outdated_kegs
<ide>
<ide> prefix_d = HOMEBREW_CELLAR.join("testball/20141011")
<ide> setup_tab_for_prefix(prefix_d, versions: { "stable" => "20141009", "version_scheme" => 3 })
<del> assert_predicate f.outdated_versions, :empty?
<add> assert_predicate f.outdated_kegs, :empty?
<ide> ensure
<ide> f.rack.rmtree
<ide> end
<ide>
<del> def test_outdated_versions_head_with_version_scheme
<add> def test_outdated_kegs_head_with_version_scheme
<ide> @f = formula("testball") do
<ide> url "foo"
<ide> version "1.0"
<ide> def test_outdated_versions_head_with_version_scheme
<ide> head_prefix = HOMEBREW_CELLAR.join("testball/HEAD")
<ide>
<ide> setup_tab_for_prefix(head_prefix, versions: { "stable" => "1.0", "version_scheme" => 1 })
<del> refute_predicate f.outdated_versions, :empty?
<add> refute_predicate f.outdated_kegs, :empty?
<ide>
<del> reset_outdated_versions
<add> reset_outdated_kegs
<ide> head_prefix.rmtree
<ide>
<ide> setup_tab_for_prefix(head_prefix, versions: { "stable" => "1.0", "version_scheme" => 2 })
<del> assert_predicate f.outdated_versions, :empty?
<add> assert_predicate f.outdated_kegs, :empty?
<ide> ensure
<ide> head_prefix.rmtree
<ide> end | 1 |
Go | Go | convert err description to lower | 47637b49a0fbd62a25702859f0993666c63ff562 | <ide><path>daemon/start.go
<ide> func (daemon *Daemon) containerStart(container *container.Container, checkpoint
<ide>
<ide> if err := daemon.containerd.Create(container.ID, checkpoint, checkpointDir, *spec, container.InitializeStdio, createOptions...); err != nil {
<ide> errDesc := grpc.ErrorDesc(err)
<add> contains := func(s1, s2 string) bool {
<add> return strings.Contains(strings.ToLower(s1), s2)
<add> }
<ide> logrus.Errorf("Create container failed with error: %s", errDesc)
<ide> // if we receive an internal error from the initial start of a container then lets
<ide> // return it instead of entering the restart loop
<ide> // set to 127 for container cmd not found/does not exist)
<del> if strings.Contains(errDesc, container.Path) &&
<del> (strings.Contains(errDesc, "executable file not found") ||
<del> strings.Contains(errDesc, "no such file or directory") ||
<del> strings.Contains(errDesc, "system cannot find the file specified")) {
<add> if contains(errDesc, container.Path) &&
<add> (contains(errDesc, "executable file not found") ||
<add> contains(errDesc, "no such file or directory") ||
<add> contains(errDesc, "system cannot find the file specified")) {
<ide> container.SetExitCode(127)
<ide> }
<ide> // set to 126 for container cmd can't be invoked errors
<del> if strings.Contains(errDesc, syscall.EACCES.Error()) {
<add> if contains(errDesc, syscall.EACCES.Error()) {
<ide> container.SetExitCode(126)
<ide> }
<ide>
<ide> // attempted to mount a file onto a directory, or a directory onto a file, maybe from user specified bind mounts
<del> if strings.Contains(errDesc, syscall.ENOTDIR.Error()) {
<add> if contains(errDesc, syscall.ENOTDIR.Error()) {
<ide> errDesc += ": Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type"
<ide> container.SetExitCode(127)
<ide> }
<ide><path>integration-cli/docker_cli_daemon_test.go
<ide> func (s *DockerDaemonSuite) TestDaemonRestartSaveContainerExitCode(c *check.C) {
<ide> c.Assert(err, checker.IsNil)
<ide>
<ide> containerName := "error-values"
<del> runError := `exec: \"toto\": executable file not found in $PATH`
<ide> // Make a container with both a non 0 exit code and an error message
<ide> out, err := s.d.Cmd("run", "--name", containerName, "busybox", "toto")
<ide> c.Assert(err, checker.NotNil)
<del> c.Assert(out, checker.Contains, runError)
<ide>
<ide> // Check that those values were saved on disk
<ide> out, err = s.d.Cmd("inspect", "-f", "{{.State.ExitCode}}", containerName)
<ide> func (s *DockerDaemonSuite) TestDaemonRestartSaveContainerExitCode(c *check.C) {
<ide> out, err = s.d.Cmd("inspect", "-f", "{{.State.Error}}", containerName)
<ide> out = strings.TrimSpace(out)
<ide> c.Assert(err, checker.IsNil)
<del> c.Assert(out, checker.Contains, runError)
<ide>
<ide> // now restart daemon
<ide> err = s.d.Restart()
<ide> func (s *DockerDaemonSuite) TestDaemonRestartSaveContainerExitCode(c *check.C) {
<ide> out, err = s.d.Cmd("inspect", "-f", "{{.State.Error}}", containerName)
<ide> out = strings.TrimSpace(out)
<ide> c.Assert(err, checker.IsNil)
<del> c.Assert(out, checker.Contains, runError)
<ide> }
<ide>
<ide> func (s *DockerDaemonSuite) TestDaemonBackcompatPre17Volumes(c *check.C) { | 2 |
Go | Go | implement lxc driver | 203b69c8c907b9cf57c887774b6f492d405a0621 | <ide><path>execdriver/driver.go
<ide> package execdriver
<ide>
<ide> import (
<add> "errors"
<ide> "io"
<ide> "net"
<add> "os/exec"
<add> "sync"
<add> "syscall"
<add> "time"
<ide> )
<ide>
<add>var (
<add> ErrCommandIsNil = errors.New("Process's cmd is nil")
<add>)
<add>
<add>type Driver interface {
<add> Start(c *Process) error
<add> Stop(c *Process) error
<add> Kill(c *Process, sig int) error
<add> Wait(c *Process, duration time.Duration) error
<add>}
<add>
<ide> // Network settings of the container
<ide> type Network struct {
<ide> Gateway string
<ide> type Network struct {
<ide> Mtu int
<ide> }
<ide>
<add>type State struct {
<add> sync.RWMutex
<add> running bool
<add> pid int
<add> exitCode int
<add> startedAt time.Time
<add> finishedAt time.Time
<add>}
<add>
<add>func (s *State) IsRunning() bool {
<add> s.RLock()
<add> defer s.RUnlock()
<add> return s.running
<add>}
<add>
<add>func (s *State) SetRunning() error {
<add> s.Lock()
<add> defer s.Unlock()
<add> s.running = true
<add> return nil
<add>}
<add>
<add>func (s *State) SetStopped(exitCode int) error {
<add> s.Lock()
<add> defer s.Unlock()
<add> s.exitCode = exitCode
<add> s.running = false
<add> return nil
<add>}
<add>
<ide> // Container / Process / Whatever, we can redefine the conatiner here
<ide> // to be what it should be and not have to carry the baggage of the
<ide> // container type in the core with backward compat. This is what a
<ide> // driver needs to execute a process inside of a conatiner. This is what
<ide> // a container is at it's core.
<del>type Container struct {
<add>type Process struct {
<add> State State
<add>
<ide> Name string // unique name for the conatienr
<ide> Privileged bool
<ide> User string
<ide> type Container struct {
<ide> Args []string
<ide> Environment map[string]string
<ide> WorkingDir string
<add> ConfigPath string
<ide> Network *Network // if network is nil then networking is disabled
<ide> Stdin io.Reader
<ide> Stdout io.Writer
<ide> Stderr io.Writer
<ide>
<del> Context interface{}
<add> cmd *exec.Cmd
<ide> }
<ide>
<del>// State can be handled internally in the drivers
<del>type Driver interface {
<del> Start(c *Container) error
<del> Stop(c *Container) error
<del> Kill(c *Container, sig int) error
<del> Running(c *Container) (bool, error)
<del> Wait(c *Container, seconds int) error
<add>func (c *Process) SetCmd(cmd *exec.Cmd) error {
<add> c.cmd = cmd
<add> cmd.Stdout = c.Stdout
<add> cmd.Stderr = c.Stderr
<add> cmd.Stdin = c.Stdin
<add> return nil
<add>}
<add>
<add>func (c *Process) StdinPipe() (io.WriteCloser, error) {
<add> return c.cmd.StdinPipe()
<add>}
<add>
<add>func (c *Process) StderrPipe() (io.ReadCloser, error) {
<add> return c.cmd.StderrPipe()
<add>}
<add>
<add>func (c *Process) StdoutPipe() (io.ReadCloser, error) {
<add> return c.cmd.StdoutPipe()
<add>}
<add>
<add>func (c *Process) GetExitCode() int {
<add> if c.cmd != nil {
<add> return c.cmd.ProcessState.Sys().(syscall.WaitStatus).ExitStatus()
<add> }
<add> return -1
<add>}
<add>
<add>func (c *Process) Wait() error {
<add> if c.cmd != nil {
<add> return c.cmd.Wait()
<add> }
<add> return ErrCommandIsNil
<ide> }
<ide><path>execdriver/lxc/driver.go
<ide> package lxc
<ide>
<ide> import (
<add> "errors"
<add> "fmt"
<ide> "github.com/dotcloud/docker/execdriver"
<ide> "os/exec"
<ide> "strconv"
<del> "sync"
<add> "strings"
<ide> "syscall"
<add> "time"
<ide> )
<ide>
<ide> const (
<ide> startPath = "lxc-start"
<ide> )
<ide>
<add>var (
<add> ErrNotRunning = errors.New("Process could not be started")
<add> ErrWaitTimeoutReached = errors.New("Wait timeout reached")
<add>)
<add>
<add>func init() {
<add> // Register driver
<add>}
<add>
<ide> type driver struct {
<del> containerLock map[string]*sync.Mutex
<add> root string // root path for the driver to use
<add> containers map[string]*execdriver.Process
<ide> }
<ide>
<del>func NewDriver() (execdriver.Driver, error) {
<add>func NewDriver(root string) (execdriver.Driver, error) {
<ide> // setup unconfined symlink
<add> return &driver{
<add> root: root,
<add> containers: make(map[string]*execdriver.Process),
<add> }, nil
<ide> }
<ide>
<del>func (d *driver) Start(c *execdriver.Container) error {
<del> l := d.getLock(c)
<del> l.Lock()
<del> defer l.Unlock()
<del>
<del> running, err := d.running(c)
<del> if err != nil {
<del> return err
<del> }
<del> if running {
<add>func (d *driver) Start(c *execdriver.Process) error {
<add> if c.State.IsRunning() {
<ide> return nil
<ide> }
<ide>
<del> configPath, err := d.generateConfig(c)
<del> if err != nil {
<del> return err
<del> }
<add> /*
<add> configPath, err := d.generateConfig(c)
<add> if err != nil {
<add> return err
<add> }
<add> */
<ide>
<ide> params := []string{
<ide> startPath,
<ide> "-n", c.Name,
<del> "-f", configPath,
<add> "-f", c.ConfigPath,
<ide> "--",
<ide> c.InitPath,
<ide> }
<ide>
<ide> if c.Network != nil {
<ide> params = append(params,
<ide> "-g", c.Network.Gateway,
<del> "-i", fmt.Sprintf("%s/%d", c.Network.IPAddress, c.Network, IPPrefixLen),
<del> "-mtu", c.Network.Mtu,
<add> "-i", fmt.Sprintf("%s/%d", c.Network.IPAddress, c.Network.IPPrefixLen),
<add> "-mtu", strconv.Itoa(c.Network.Mtu),
<ide> )
<ide> }
<ide>
<ide> func (d *driver) Start(c *execdriver.Container) error {
<ide> cmd := exec.Command(params[0], params[1:]...)
<ide> cmd.SysProcAttr = &syscall.SysProcAttr{Setsid: true}
<ide>
<del> cmd.Stdout = c.Stdout
<del> cmd.Stderr = c.Stderr
<del> cmd.Stdin = c.Stdin
<add> if err := c.SetCmd(cmd); err != nil {
<add> return err
<add> }
<ide>
<ide> if err := cmd.Start(); err != nil {
<ide> return err
<ide> func (d *driver) Start(c *execdriver.Container) error {
<ide> return nil
<ide> }
<ide>
<del>func (d *driver) Stop(c *execdriver.Container) error {
<del> l := d.getLock(c)
<del> l.Lock()
<del> defer l.Unlock()
<del>
<add>func (d *driver) Stop(c *execdriver.Process) error {
<ide> if err := d.kill(c, 15); err != nil {
<ide> if err := d.kill(c, 9); err != nil {
<ide> return err
<ide> }
<ide> }
<ide>
<del> if err := d.wait(c, 10); err != nil {
<del> return d.kill(c, 9)
<add> if err := d.wait(c, 10*time.Second); err != nil {
<add> if err := d.kill(c, 9); err != nil {
<add> return err
<add> }
<add> }
<add> exitCode := c.GetExitCode()
<add> if err := c.State.SetStopped(exitCode); err != nil {
<add> return err
<ide> }
<ide> return nil
<ide> }
<ide>
<del>func (d *driver) Wait(c *execdriver.Container, seconds int) error {
<del> l := d.getLock(c)
<del> l.Lock()
<del> defer l.Unlock()
<add>func (d *driver) Kill(c *execdriver.Process, sig int) error {
<add> c.State.Lock()
<add> defer c.State.Unlock()
<add> return d.kill(c, sig)
<add>}
<ide>
<del> return d.wait(c, seconds)
<add>func (d *driver) Wait(c *execdriver.Process, duration time.Duration) error {
<add> return d.wait(c, duration)
<ide> }
<ide>
<ide> // If seconds < 0 then wait forever
<del>func (d *driver) wait(c *execdriver.Container, seconds int) error {
<del>
<add>func (d *driver) wait(c *execdriver.Process, duration time.Duration) error {
<add>begin:
<add> var (
<add> killer bool
<add> done = d.waitCmd(c)
<add> )
<add> if duration > 0 {
<add> select {
<add> case err := <-done:
<add> if err != nil && err == execdriver.ErrCommandIsNil {
<add> done = d.waitLxc(c, &killer)
<add> goto begin
<add> }
<add> return err
<add> case <-time.After(duration):
<add> killer = true
<add> return ErrWaitTimeoutReached
<add> }
<add> } else {
<add> if err := <-done; err != nil {
<add> if err == execdriver.ErrCommandIsNil {
<add> done = d.waitLxc(c, &killer)
<add> goto begin
<add> }
<add> return err
<add> }
<add> }
<add> return nil
<ide> }
<ide>
<del>func (d *driver) kill(c *execdriver.Container, sig int) error {
<add>func (d *driver) kill(c *execdriver.Process, sig int) error {
<ide> return exec.Command("lxc-kill", "-n", c.Name, strconv.Itoa(sig)).Run()
<ide> }
<ide>
<del>func (d *driver) running(c *execdriver.Container) (bool, error) {
<add>/* Generate the lxc configuration and return the path to the file
<add>func (d *driver) generateConfig(c *execdriver.Process) (string, error) {
<add> p := path.Join(d.root, c.Name)
<add> f, err := os.Create(p)
<add> if err != nil {
<add> return "", nil
<add> }
<add> defer f.Close()
<ide>
<add> if err := LxcTemplateCompiled.Execute(f, c.Context); err != nil {
<add> return "", err
<add> }
<add> return p, nil
<ide> }
<add>*/
<add>
<add>func (d *driver) waitForStart(cmd *exec.Cmd, c *execdriver.Process) error {
<add> // We wait for the container to be fully running.
<add> // Timeout after 5 seconds. In case of broken pipe, just retry.
<add> // Note: The container can run and finish correctly before
<add> // the end of this loop
<add> for now := time.Now(); time.Since(now) < 5*time.Second; {
<add> // If the container dies while waiting for it, just return
<add> if !c.State.IsRunning() {
<add> return nil
<add> }
<add> output, err := exec.Command("lxc-info", "-s", "-n", c.Name).CombinedOutput()
<add> if err != nil {
<add> output, err = exec.Command("lxc-info", "-s", "-n", c.Name).CombinedOutput()
<add> if err != nil {
<add> return err
<add> }
<ide>
<del>// Generate the lxc configuration and return the path to the file
<del>func (d *driver) generateConfig(c *execdriver.Container) (string, error) {
<del>
<add> }
<add> if strings.Contains(string(output), "RUNNING") {
<add> return nil
<add> }
<add> time.Sleep(50 * time.Millisecond)
<add> }
<add> return ErrNotRunning
<ide> }
<ide>
<del>func (d *driver) waitForStart(cmd *exec.Cmd, c *execdriver.Container) error {
<del>
<add>func (d *driver) waitCmd(c *execdriver.Process) <-chan error {
<add> done := make(chan error)
<add> go func() {
<add> done <- c.Wait()
<add> }()
<add> return done
<ide> }
<ide>
<del>func (d *driver) getLock(c *execdriver.Container) *sync.Mutex {
<del> l, ok := d.containerLock[c.Name]
<del> if !ok {
<del> l = &sync.Mutex{}
<del> d.containerLock[c.Name] = l
<del> }
<del> return l
<add>func (d *driver) waitLxc(c *execdriver.Process, kill *bool) <-chan error {
<add> done := make(chan error)
<add> go func() {
<add> for *kill {
<add> output, err := exec.Command("lxc-info", "-n", c.Name).CombinedOutput()
<add> if err != nil {
<add> done <- err
<add> return
<add> }
<add> if !strings.Contains(string(output), "RUNNING") {
<add> done <- err
<add> return
<add> }
<add> time.Sleep(500 * time.Millisecond)
<add> }
<add> }()
<add> return done
<ide> } | 2 |
Java | Java | fix checkstyle violation | 82a211fa966767bc1ac78fbaa79f210a5a99f5b1 | <ide><path>spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassParser.java
<ide> public void process() {
<ide> this.deferredImportSelectors = new ArrayList<>();
<ide> }
<ide> }
<del>
<add>
<ide> }
<ide>
<ide> | 1 |
PHP | PHP | move the timezone setting into the core file | 1867f28ad6210b58729b8402393c030731f87501 | <ide><path>laravel/laravel.php
<ide> */
<ide> require 'core.php';
<ide>
<del>/**
<del> * Register the default timezone for the application. This will be
<del> * the default timezone used by all date / timezone functions in
<del> * the entire application.
<del> */
<del>date_default_timezone_set(Config::$items['application']['timezone']);
<del>
<ide> /**
<ide> * Create the exception logging function. All of the error logging
<ide> * is routed through here to avoid duplicate code. This Closure | 1 |
Text | Text | remove stale deprecation note from unmounting docs | 6ee9aa773d1fe67cad0fde078314fb1658e684c1 | <ide><path>docs/docs/ref-01-top-level-api.md
<ide> boolean unmountComponentAtNode(DOMElement container)
<ide>
<ide> Remove a mounted React component from the DOM and clean up its event handlers and state. If no component was mounted in the container, calling this function does nothing. Returns `true` if a component was unmounted and `false` if there was no component to unmount.
<ide>
<del>> Note:
<del>>
<del>> This method was called `React.unmountAndReleaseReactRootNode` until v0.5. It still works in v0.5 but will be removed in future versions.
<del>
<ide>
<ide> ### React.renderComponentToString
<ide> | 1 |
Ruby | Ruby | silence some ruby 2.1 warnings | 109e9dc58bb71d9b17c10c28d434556b56c08b1c | <ide><path>Library/Contributions/cmd/brew-test-bot.rb
<ide> def run
<ide> @status = success ? :passed : :failed
<ide> puts_result
<ide>
<del> return unless File.exists?(log_file_path)
<add> return unless File.exist?(log_file_path)
<ide> @output = IO.read(log_file_path)
<ide> if has_output? and (not success or @puts_output_on_success)
<ide> puts @output
<ide><path>Library/Homebrew/cmd/doctor.rb
<ide> def check_user_path_3
<ide> end
<ide>
<ide> def check_user_curlrc
<del> if %w[CURL_HOME HOME].any?{|key| ENV[key] and File.exists? "#{ENV[key]}/.curlrc" } then <<-EOS.undent
<add> if %w[CURL_HOME HOME].any?{|key| ENV[key] and File.exist? "#{ENV[key]}/.curlrc" } then <<-EOS.undent
<ide> You have a curlrc file
<ide> If you have trouble downloading packages with Homebrew, then maybe this
<ide> is the problem? If the following command doesn't work, then try removing | 2 |
Ruby | Ruby | remove python 3.9 from unstable allowlist | ea57ef794e90ed2e94cb4aba6d136e155264429c | <ide><path>Library/Homebrew/dev-cmd/audit.rb
<ide> def get_repo_data(regex)
<ide>
<ide> # used for formulae that are unstable but need CI run without being in homebrew/core
<ide> UNSTABLE_DEVEL_ALLOWLIST = {
<del> "python@3.9" => "3.9.0rc",
<ide> }.freeze
<ide>
<ide> GNOME_DEVEL_ALLOWLIST = { | 1 |
Javascript | Javascript | use https for baseurl | 2ffa100f9a36924d721c8b8095b0a1b6c622b79b | <ide><path>Gruntfile.js
<ide> module.exports = function(grunt) {
<ide>
<ide> const buildSettings = {
<ide> outDir: 'out',
<del> baseUrl: 'http://threejsfundamentals.org',
<add> baseUrl: 'https://threejsfundamentals.org',
<ide> rootFolder: 'threejs',
<ide> lessonGrep: 'threejs*.md',
<ide> siteName: 'ThreeJSFundamentals', | 1 |
Ruby | Ruby | remove unneeded mercurial check | 7f54c83911a494b592e412d2f99119530cebf458 | <ide><path>Library/Homebrew/dev-cmd/audit.rb
<ide> def audit_deps
<ide> case dep.name
<ide> when "git"
<ide> problem "Don't use git as a dependency"
<del> when "mercurial"
<del> problem "Use `depends_on :hg` instead of `depends_on 'mercurial'`"
<ide> when "gfortran"
<ide> problem "Use `depends_on :fortran` instead of `depends_on 'gfortran'`"
<ide> when "ruby" | 1 |
Ruby | Ruby | fix broken mysql test | 66982772b7b019505870a65b38af076d509ffd53 | <ide><path>activerecord/test/cases/adapters/mysql/active_schema_test.rb
<ide>
<ide> class ActiveSchemaTest < ActiveRecord::TestCase
<ide> def setup
<del> ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter.class_eval do
<add> @connection = ActiveRecord::Base.remove_connection
<add> ActiveRecord::Base.establish_connection(@connection)
<add>
<add> ActiveRecord::Base.connection.singleton_class.class_eval do
<ide> alias_method :execute_without_stub, :execute
<del> remove_method :execute
<ide> def execute(sql, name = nil) return sql end
<ide> end
<ide> end
<ide>
<ide> def teardown
<del> ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter.class_eval do
<del> remove_method :execute
<del> alias_method :execute, :execute_without_stub
<del> end
<add> ActiveRecord::Base.remove_connection
<add> ActiveRecord::Base.establish_connection(@connection)
<ide> end
<ide>
<ide> def test_add_index
<ide> # add_index calls index_name_exists? which can't work since execute is stubbed
<del> ActiveRecord::ConnectionAdapters::MysqlAdapter.send(:define_method, :index_name_exists?) do |*|
<del> false
<del> end
<add> def (ActiveRecord::Base.connection).index_name_exists?(*); false; end
<add>
<ide> expected = "CREATE INDEX `index_people_on_last_name` ON `people` (`last_name`) "
<ide> assert_equal expected, add_index(:people, :last_name, :length => nil)
<ide>
<ide> def test_add_index
<ide>
<ide> expected = "CREATE INDEX `index_people_on_last_name_and_first_name` USING btree ON `people` (`last_name`(15), `first_name`(15)) "
<ide> assert_equal expected, add_index(:people, [:last_name, :first_name], :length => 15, :using => :btree)
<del>
<del> ActiveRecord::ConnectionAdapters::MysqlAdapter.send(:remove_method, :index_name_exists?)
<ide> end
<ide>
<ide> def test_drop_table
<ide> def test_remove_timestamps
<ide>
<ide> private
<ide> def with_real_execute
<del> #we need to actually modify some data, so we make execute point to the original method
<del> ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter.class_eval do
<add> ActiveRecord::Base.connection.singleton_class.class_eval do
<ide> alias_method :execute_with_stub, :execute
<ide> remove_method :execute
<ide> alias_method :execute, :execute_without_stub
<ide> end
<add>
<ide> yield
<ide> ensure
<del> #before finishing, we restore the alias to the mock-up method
<del> ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter.class_eval do
<add> ActiveRecord::Base.connection.singleton_class.class_eval do
<ide> remove_method :execute
<ide> alias_method :execute, :execute_with_stub
<ide> end
<ide> end
<ide>
<del>
<ide> def method_missing(method_symbol, *arguments)
<ide> ActiveRecord::Base.connection.send(method_symbol, *arguments)
<ide> end
<ide><path>activerecord/test/cases/adapters/mysql2/active_schema_test.rb
<ide>
<ide> class ActiveSchemaTest < ActiveRecord::TestCase
<ide> def setup
<del> ActiveRecord::ConnectionAdapters::Mysql2Adapter.class_eval do
<add> @connection = ActiveRecord::Base.remove_connection
<add> ActiveRecord::Base.establish_connection(@connection)
<add>
<add> ActiveRecord::Base.connection.singleton_class.class_eval do
<ide> alias_method :execute_without_stub, :execute
<del> remove_method :execute
<ide> def execute(sql, name = nil) return sql end
<ide> end
<ide> end
<ide>
<ide> def teardown
<del> ActiveRecord::ConnectionAdapters::Mysql2Adapter.class_eval do
<del> remove_method :execute
<del> alias_method :execute, :execute_without_stub
<del> end
<add> ActiveRecord::Base.remove_connection
<add> ActiveRecord::Base.establish_connection(@connection)
<ide> end
<ide>
<ide> def test_add_index
<ide> # add_index calls index_name_exists? which can't work since execute is stubbed
<del> ActiveRecord::ConnectionAdapters::Mysql2Adapter.send(:define_method, :index_name_exists?) do |*|
<del> false
<del> end
<add> def (ActiveRecord::Base.connection).index_name_exists?(*); false; end
<add>
<ide> expected = "CREATE INDEX `index_people_on_last_name` ON `people` (`last_name`) "
<ide> assert_equal expected, add_index(:people, :last_name, :length => nil)
<ide>
<ide> def test_add_index
<ide>
<ide> expected = "CREATE INDEX `index_people_on_last_name_and_first_name` USING btree ON `people` (`last_name`(15), `first_name`(15)) "
<ide> assert_equal expected, add_index(:people, [:last_name, :first_name], :length => 15, :using => :btree)
<del>
<del> ActiveRecord::ConnectionAdapters::Mysql2Adapter.send(:remove_method, :index_name_exists?)
<ide> end
<ide>
<ide> def test_drop_table
<ide> def test_remove_timestamps
<ide>
<ide> private
<ide> def with_real_execute
<del> #we need to actually modify some data, so we make execute point to the original method
<del> ActiveRecord::ConnectionAdapters::Mysql2Adapter.class_eval do
<add> ActiveRecord::Base.connection.singleton_class.class_eval do
<ide> alias_method :execute_with_stub, :execute
<ide> remove_method :execute
<ide> alias_method :execute, :execute_without_stub
<ide> end
<add>
<ide> yield
<ide> ensure
<del> #before finishing, we restore the alias to the mock-up method
<del> ActiveRecord::ConnectionAdapters::Mysql2Adapter.class_eval do
<add> ActiveRecord::Base.connection.singleton_class.class_eval do
<ide> remove_method :execute
<ide> alias_method :execute, :execute_with_stub
<ide> end
<ide> end
<ide>
<del>
<ide> def method_missing(method_symbol, *arguments)
<ide> ActiveRecord::Base.connection.send(method_symbol, *arguments)
<ide> end | 2 |
PHP | PHP | add getmessages to messagebag interface. | c20de0861c2bbf8c894d510aca29d62220c18cf6 | <ide><path>src/Illuminate/Contracts/Support/MessageBag.php
<ide> public function get($key, $format = null);
<ide> */
<ide> public function all($format = null);
<ide>
<add> /**
<add> * Get the raw messages in the container.
<add> *
<add> * @return array
<add> */
<add> public function getMessages();
<add>
<ide> /**
<ide> * Get the default message format.
<ide> * | 1 |
Text | Text | add documentation for plists | 402600a94fa9eb3dd9ade82f5edf64a890f159d6 | <ide><path>docs/Formula-Cookbook.md
<ide> Homebrew provides two formula DSL methods for launchd plist files:
<ide> * [`plist_name`](https://rubydoc.brew.sh/Formula#plist_name-instance_method) will return e.g. `homebrew.mxcl.<formula>`
<ide> * [`plist_path`](https://rubydoc.brew.sh/Formula#plist_path-instance_method) will return e.g. `/usr/local/Cellar/foo/0.1/homebrew.mxcl.foo.plist`
<ide>
<add>There is two ways to add plists to a formula, so that [`brew services`](https://github.com/Homebrew/homebrew-services) can pick it up:
<add>1. If the formula already provides a plist file the formula can install it into the prefix like so.
<add>
<add>```ruby
<add>prefix.install_symlink "file.plist" => "#{plist_name}.plist"
<add>```
<add>
<add>1. If the formula does not provide a plist you can add a plist using the following stanzas.
<add>This will define what the user can run manually instead of the launchd service.
<add>```ruby
<add> plist_options manual: "#{HOMEBREW_PREFIX}/var/some/bin/stuff run"
<add>```
<add>
<add>This provides the actual plist file, see [Apple's plist(5) man page](https://www.unix.com/man-page/mojave/5/plist/) for more information.
<add>```ruby
<add> def plist
<add> <<~EOS
<add> <?xml version="1.0" encoding="UTF-8"?>
<add> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<add> <plist version="1.0">
<add> <dict>
<add> <key>Label</key>
<add> <string>#{plist_name}</string>
<add> <key>ProgramArguments</key>
<add> <array>
<add> <string>#{var}/some/bin/stuff</string>
<add> <string>run</string>
<add> </array>
<add> </dict>
<add> </plist>
<add> EOS
<add> end
<add>```
<add>
<ide> ### Using environment variables
<ide>
<ide> Homebrew has multiple levels of environment variable filtering which affects variables available to formulae. | 1 |
Java | Java | drop getaotinitializers method | 86ad29a7d6bc3e57fe19276ae9f18222cfb4dbd7 | <ide><path>spring-context/src/main/java/org/springframework/context/aot/AotApplicationContextInitializer.java
<ide>
<ide> package org.springframework.context.aot;
<ide>
<del>import java.util.ArrayList;
<del>import java.util.Collection;
<del>import java.util.List;
<del>
<ide> import org.apache.commons.logging.Log;
<ide> import org.apache.commons.logging.LogFactory;
<ide>
<ide> static <C extends ConfigurableApplicationContext> ApplicationContextInitializer<
<ide> }
<ide> }
<ide>
<del> /**
<del> * Return a new {@link List} containing only {@link AotApplicationContextInitializer} instances.
<del> * @param <C> the application context type
<del> * @param initializers the source initializers
<del> * @return a list of the {@link AotApplicationContextInitializer} instances
<del> */
<del> @SuppressWarnings("unchecked")
<del> public static <C extends ConfigurableApplicationContext> List<AotApplicationContextInitializer<C>> getAotInitializers(
<del> Collection<? extends ApplicationContextInitializer<? extends C>> initializers) {
<del>
<del> Assert.notNull(initializers, "'initializers' must not be null");
<del> List<AotApplicationContextInitializer<C>> aotInitializers = new ArrayList<>();
<del> for (ApplicationContextInitializer<?> candidate : initializers) {
<del> if (candidate instanceof AotApplicationContextInitializer<?> aotInitializer) {
<del> aotInitializers.add((AotApplicationContextInitializer<C>) aotInitializer);
<del> }
<del> }
<del> return aotInitializers;
<del> }
<del>
<ide> }
<ide><path>spring-context/src/test/java/org/springframework/context/aot/AotApplicationContextInitializerTests.java
<ide> void initializeWhenInitializerHasNoDefaultConstructorThrowsException() {
<ide> .withMessageContaining(ConfigurableApplicationContextInitializer.class.getName());
<ide> }
<ide>
<del> @Test
<del> void getAotInitializersReturnsOnlyAotInitializers() {
<del> ApplicationContextInitializer<GenericApplicationContext> l1 = context -> { };
<del> ApplicationContextInitializer<GenericApplicationContext> l2 = context -> { };
<del> AotApplicationContextInitializer<GenericApplicationContext> a1 = context -> { };
<del> AotApplicationContextInitializer<GenericApplicationContext> a2 = l2::initialize;
<del> List<ApplicationContextInitializer<GenericApplicationContext>> initializers = List.of(l1, l2, a1, a2);
<del> List<AotApplicationContextInitializer<GenericApplicationContext>> aotInitializers = AotApplicationContextInitializer
<del> .getAotInitializers(initializers);
<del> assertThat(aotInitializers).containsExactly(a1, a2);
<del> }
<del>
<ide>
<ide> static class TestApplicationContextInitializer implements ApplicationContextInitializer<GenericApplicationContext> {
<ide> | 2 |
PHP | PHP | delay creation of error logger | aa3066cba9985d54bd085d40d4952ec794fd4ac7 | <ide><path>src/Error/ExceptionTrap.php
<ide> public function handleFatalError(int $code, string $description, string $file, i
<ide> */
<ide> public function logException(Throwable $exception, ?ServerRequestInterface $request = null): void
<ide> {
<del> $logger = $this->logger();
<ide> $shouldLog = true;
<ide> foreach ($this->_config['skipLog'] as $class) {
<ide> if ($exception instanceof $class) {
<ide> public function logException(Throwable $exception, ?ServerRequestInterface $requ
<ide> }
<ide> }
<ide> if ($shouldLog) {
<del> $logger->log($exception, $request);
<add> $this->logger()->log($exception, $request);
<ide> }
<ide> $this->dispatchEvent('Exception.beforeRender', ['exception' => $exception]);
<ide> } | 1 |
Javascript | Javascript | indent the comment | f267dd02d19c2ede88e37b8a73cc0b0b63413be2 | <ide><path>src/index.js
<ide> import compose from './compose'
<ide> import warning from './utils/warning'
<ide>
<ide> /*
<del>* This is a dummy function to check if the function name has been altered by minification.
<del>* If the function has been minified and NODE_ENV !== 'production', warn the user.
<del>*/
<add> * This is a dummy function to check if the function name has been altered by minification.
<add> * If the function has been minified and NODE_ENV !== 'production', warn the user.
<add> */
<ide> function isCrushed() {}
<ide>
<ide> if ( | 1 |
Text | Text | clarify stream errors while reading and writing | 7223ce2a9c0fe250e199327ece14d2fcaea34bb1 | <ide><path>doc/api/stream.md
<ide> or write buffered data before a stream ends.
<ide>
<ide> #### Errors While Writing
<ide>
<del>It is recommended that errors occurring during the processing of the
<del>`writable._write()` and `writable._writev()` methods are reported by invoking
<del>the callback and passing the error as the first argument. This will cause an
<del>`'error'` event to be emitted by the `Writable`. Throwing an `Error` from within
<del>`writable._write()` can result in unexpected and inconsistent behavior depending
<del>on how the stream is being used. Using the callback ensures consistent and
<del>predictable handling of errors.
<add>Errors occurring during the processing of the [`writable._write()`][],
<add>[`writable._writev()`][] and [`writable._final()`] methods must be propagated
<add>by invoking the callback and passing the error as the first argument.
<add>Throwing an `Error` from within these methods or manually emitting an `'error'`
<add>event results in undefined behavior.
<ide>
<ide> If a `Readable` stream pipes into a `Writable` stream when `Writable` emits an
<ide> error, the `Readable` stream will be unpiped.
<ide> buffer. See [`readable.push('')`][] for more information.
<ide>
<ide> #### Errors While Reading
<ide>
<del>It is recommended that errors occurring during the processing of the
<del>`readable._read()` method are emitted using the `'error'` event rather than
<del>being thrown. Throwing an `Error` from within `readable._read()` can result in
<del>unexpected and inconsistent behavior depending on whether the stream is
<del>operating in flowing or paused mode. Using the `'error'` event ensures
<del>consistent and predictable handling of errors.
<add>Errors occurring during processing of the [`readable._read()`][] must be
<add>propagated through the [`readable.destroy(err)`][readable-_destroy] method.
<add>Throwing an `Error` from within [`readable._read()`][] or manually emitting an
<add>`'error'` event results in undefined behavior.
<ide>
<del><!-- eslint-disable no-useless-return -->
<ide> ```js
<ide> const { Readable } = require('stream');
<ide>
<ide> const myReadable = new Readable({
<ide> read(size) {
<del> if (checkSomeErrorCondition()) {
<del> process.nextTick(() => this.emit('error', err));
<del> return;
<add> const err = checkSomeErrorCondition();
<add> if (err) {
<add> this.destroy(err);
<add> } else {
<add> // Do some work.
<ide> }
<del> // Do some work.
<ide> }
<ide> });
<ide> ```
<ide> contain multi-byte characters.
<ide> [`process.stderr`]: process.html#process_process_stderr
<ide> [`process.stdin`]: process.html#process_process_stdin
<ide> [`process.stdout`]: process.html#process_process_stdout
<add>[`readable._read()`]: #stream_readable_read_size_1
<ide> [`readable.push('')`]: #stream_readable_push
<ide> [`readable.setEncoding()`]: #stream_readable_setencoding_encoding
<ide> [`stream.Readable.from()`]: #stream_stream_readable_from_iterable_options
<ide> contain multi-byte characters.
<ide> [`stream.uncork()`]: #stream_writable_uncork
<ide> [`stream.unpipe()`]: #stream_readable_unpipe_destination
<ide> [`stream.wrap()`]: #stream_readable_wrap_stream
<add>[`writable._final()`]: #stream_writable_final_callback
<add>[`writable._write()`]: #stream_writable_write_chunk_encoding_callback_1
<add>[`writable._writev()`]: #stream_writable_writev_chunks_callback
<ide> [`writable.cork()`]: #stream_writable_cork
<ide> [`writable.end()`]: #stream_writable_end_chunk_encoding_callback
<ide> [`writable.uncork()`]: #stream_writable_uncork | 1 |
PHP | PHP | add lazy reading of cookie data | 849a04f8970f176e2d3ca12266df19df313e4d46 | <ide><path>src/Controller/Component/CookieComponent.php
<ide> class CookieComponent extends Component {
<ide> */
<ide> protected $_values = [];
<ide>
<add>/**
<add> * A map of keys that have been loaded.
<add> *
<add> * Since CookieComponent lazily reads cookie data,
<add> * we need to track which cookies have been read to account for
<add> * read, delete, read patterns.
<add> *
<add> * @var array
<add> */
<add> protected $_loaded = [];
<add>
<ide> /**
<ide> * A reference to the Controller's Cake\Network\Response object
<ide> *
<ide> public function implementedEvents() {
<ide> * @link http://book.cakephp.org/2.0/en/core-libraries/components/cookie.html#CookieComponent::write
<ide> */
<ide> public function write($key, $value = null) {
<del> if (empty($this->_values)) {
<del> $this->_load();
<del> }
<del>
<ide> if (!is_array($key)) {
<ide> $key = array($key => $value);
<ide> }
<ide>
<ide> $keys = [];
<ide> foreach ($key as $name => $value) {
<add> $this->_load($name);
<add>
<ide> $this->_values = Hash::insert($this->_values, $name, $value);
<ide> $parts = explode('.', $name);
<ide> $keys[] = $parts[0];
<ide> public function write($key, $value = null) {
<ide> * This method will also allow you to read cookies that have been written in this
<ide> * request, but not yet sent to the client.
<ide> *
<del> * @param string $key Key of the value to be obtained. If none specified, obtain map key => values
<add> * @param string $key Key of the value to be obtained.
<ide> * @return string or null, value for specified key
<ide> * @link http://book.cakephp.org/2.0/en/core-libraries/components/cookie.html#CookieComponent::read
<ide> */
<ide> public function read($key = null) {
<del> if (empty($this->_values)) {
<del> $this->_load();
<del> }
<del> if ($key === null) {
<del> return $this->_values;
<del> }
<add> $this->_load($key);
<ide> return Hash::get($this->_values, $key);
<ide> }
<ide>
<ide> public function read($key = null) {
<ide> * Based on the configuration data, cookies will be decrypted. When cookies
<ide> * contain array data, that data will be expanded.
<ide> *
<add> * @param string|array $key The key to load.
<ide> * @return void
<ide> */
<del> protected function _load() {
<del> foreach ($this->_request->cookies as $name => $value) {
<del> $config = $this->configKey($name);
<del> $this->_values[$name] = $this->_decrypt($value, $config['encryption']);
<add> protected function _load($key) {
<add> $parts = explode('.', $key);
<add> $first = array_shift($parts);
<add> if (isset($this->_loaded[$first])) {
<add> return;
<add> }
<add> if (!isset($this->_request->cookies[$first])) {
<add> return;
<ide> }
<add> $cookie = $this->_request->cookies[$first];
<add> $config = $this->configKey($first);
<add> $this->_loaded[$first] = true;
<add> $this->_values[$first] = $this->_decrypt($cookie, $config['encryption']);
<ide> }
<ide>
<ide> /**
<ide> public function check($key = null) {
<ide> * @link http://book.cakephp.org/2.0/en/core-libraries/components/cookie.html#CookieComponent::delete
<ide> */
<ide> public function delete($key) {
<del> if (empty($this->_values)) {
<del> $this->_load();
<del> }
<add> $this->_load($key);
<ide>
<ide> $this->_values = Hash::remove($this->_values, $key);
<ide> $parts = explode('.', $key);
<ide><path>tests/TestCase/Controller/Component/CookieComponentTest.php
<ide> public function testWriteMixedArray() {
<ide> $this->assertEquals($expected, $result);
<ide> }
<ide>
<del>/**
<del> * test reading all values at once.
<del> *
<del> * @return void
<del> */
<del> public function testReadingAllValues() {
<del> $this->_setCookieData();
<del> $data = $this->Cookie->read();
<del> $expected = array(
<del> 'Encrytped_array' => array(
<del> 'name' => 'CakePHP',
<del> 'version' => '1.2.0.x',
<del> 'tag' => 'CakePHP Rocks!'),
<del> 'Encrypted_multi_cookies' => array(
<del> 'name' => 'CakePHP',
<del> 'version' => '1.2.0.x',
<del> 'tag' => 'CakePHP Rocks!'),
<del> 'Plain_array' => array(
<del> 'name' => 'CakePHP',
<del> 'version' => '1.2.0.x',
<del> 'tag' => 'CakePHP Rocks!'),
<del> 'Plain_multi_cookies' => array(
<del> 'name' => 'CakePHP',
<del> 'version' => '1.2.0.x',
<del> 'tag' => 'CakePHP Rocks!'));
<del> $this->assertEquals($expected, $data);
<del> }
<del>
<ide> /**
<ide> * testDeleteCookieValue
<ide> * | 2 |
Javascript | Javascript | remove unnecessary object call to kformat | d2b16553f9a5415aebdf8f681d0e68c0c794240b | <ide><path>lib/internal/url.js
<ide> class URL {
<ide> toString() {
<ide> if (!isURLThis(this))
<ide> throw new ERR_INVALID_THIS('URL');
<del> return this[kFormat]({});
<add> return this[kFormat]();
<ide> }
<ide>
<ide> get href() {
<ide> if (!isURLThis(this))
<ide> throw new ERR_INVALID_THIS('URL');
<del> return this[kFormat]({});
<add> return this[kFormat]();
<ide> }
<ide>
<ide> set href(input) {
<ide> class URL {
<ide> toJSON() {
<ide> if (!isURLThis(this))
<ide> throw new ERR_INVALID_THIS('URL');
<del> return this[kFormat]({});
<add> return this[kFormat]();
<ide> }
<ide>
<ide> static createObjectURL(obj) { | 1 |
Text | Text | fix #187 by updating reference to trello board | b6fd96902e0582f6076a5f250b565cdb889d3999 | <ide><path>README.md
<ide> Contributing
<ide>
<ide> We welcome pull requests from Free Code Camp "campers" (our students) and seasoned JavaScript developers alike!
<ide> 1) Check our [public Waffle Board](https://waffle.io/freecodecamp/freecodecamp)
<del>2) If your issue or feature isn't on the board, either open an issue on this GitHub repo or message Quincy Larson to request to be added to the Trello board.
<add>2) If your issue or feature isn't on the board, open an issue and if you think you can fix it yourself, start working on it.
<ide> 3) Once your code is ready, submit the pull request. We'll do a quick code review and give you feedback, and iterate from there.
<ide>
<del>This project uses [Airbnb JavaScript Style Guide](https://github.com/airbnb/javascript) with a
<del>few minor exceptions. If you are submitting a pull request that involves
<del>Jade templates, please make sure you are using *spaces*, not tabs.
<del>
<ide> License
<ide> -------
<ide> | 1 |
Python | Python | add documentation for amin/amax | 9064d4b2a46fc8b725314e5fae191b8497fef5f6 | <ide><path>numpy/core/fromnumeric.py
<ide> def amax(a, axis=None, out=None):
<ide> >>> np.amax(a, axis=1)
<ide> array([1, 3])
<ide>
<add> Note
<add> ----
<add> NaN values are propagated, that is if at least one item is nan, the
<add> corresponding max value will be nan as well. To ignore NaN values (matlab
<add> behavior), please use nanmax.
<add>
<add> See Also
<add> --------
<add> nanmax: nan values are ignored instead of being propagated
<add> fmax: same behavior as the C99 fmax function
<add>
<ide> """
<ide> try:
<ide> amax = a.max
<ide> def amin(a, axis=None, out=None):
<ide> >>> np.amin(a, axis=1) # Minima along the second axis
<ide> array([0, 2])
<ide>
<add> Note
<add> ----
<add> NaN values are propagated, that is if at least one item is nan, the
<add> corresponding min value will be nan as well. To ignore NaN values (matlab
<add> behavior), please use nanmin.
<add>
<add> See Also
<add> --------
<add> nanmin: nan values are ignored instead of being propagated
<add> fmin: same behavior as the C99 fmin function
<ide> """
<ide> try:
<ide> amin = a.min | 1 |
Ruby | Ruby | use respond_to_missing? for chars | 9bda37474e2cd3db63102f6b63246ebc54011ad2 | <ide><path>activesupport/lib/active_support/multibyte/chars.rb
<ide> def method_missing(method, *args, &block)
<ide>
<ide> # Returns +true+ if _obj_ responds to the given method. Private methods are included in the search
<ide> # only if the optional second parameter evaluates to +true+.
<del> def respond_to?(method, include_private=false)
<del> super || @wrapped_string.respond_to?(method, include_private)
<add> def respond_to_missing?(method, include_private)
<add> @wrapped_string.respond_to?(method, include_private)
<ide> end
<ide>
<ide> # Returns +true+ when the proxy class can handle the string. Returns +false+ otherwise.
<ide><path>activesupport/test/multibyte_chars_test.rb
<ide> def test_respond_to_knows_which_methods_the_proxy_responds_to
<ide> assert !''.mb_chars.respond_to?(:undefined_method) # Not defined
<ide> end
<ide>
<add> def test_method_works_for_proxyed_methods
<add> assert_equal 'll', 'hello'.mb_chars.method(:slice).call(2..3) # Defined on Chars
<add> chars = 'hello'.mb_chars
<add> assert_equal 'Hello', chars.method(:capitalize!).call # Defined on Chars
<add> assert_equal 'Hello', chars
<add> assert_equal 'jello', 'hello'.mb_chars.method(:gsub).call(/h/, 'j') # Defined on String
<add> assert_raise(NameError){ ''.mb_chars.method(:undefined_method) } # Not defined
<add> end
<add>
<ide> def test_acts_like_string
<ide> assert 'Bambi'.mb_chars.acts_like_string?
<ide> end | 2 |
Mixed | Javascript | support rfc 2818 compatible checkhost | da1b59fc1388f8bffab870d80efa96db49439b6e | <ide><path>doc/api/crypto.md
<ide> added: v15.6.0
<ide>
<ide> <!-- YAML
<ide> added: v15.6.0
<add>changes:
<add> - version: REPLACEME
<add> pr-url: https://github.com/nodejs/node/pull/41569
<add> description: The subject option can now be set to `'default'`.
<ide> -->
<ide>
<ide> * `email` {string}
<ide> * `options` {Object}
<del> * `subject` {string} `'always'` or `'never'`. **Default:** `'always'`.
<add> * `subject` {string} `'default'`, `'always'`, or `'never'`.
<add> **Default:** `'always'`.
<ide> * `wildcards` {boolean} **Default:** `true`.
<ide> * `partialWildcards` {boolean} **Default:** `true`.
<ide> * `multiLabelWildcards` {boolean} **Default:** `false`.
<ide> added: v15.6.0
<ide>
<ide> Checks whether the certificate matches the given email address.
<ide>
<add>If the `'subject'` option is set to `'always'` and if the subject alternative
<add>name extension either does not exist or does not contain a matching email
<add>address, the certificate subject is considered.
<add>
<add>If the `'subject'` option is set to `'default`', the certificate subject is only
<add>considered if the subject alternative name extension either does not exist or
<add>does not contain any email addresses.
<add>
<add>If the `'subject'` option is set to `'never'`, the certificate subject is never
<add>considered, even if the certificate contains no subject alternative names.
<add>
<ide> ### `x509.checkHost(name[, options])`
<ide>
<ide> <!-- YAML
<ide> added: v15.6.0
<add>changes:
<add> - version: REPLACEME
<add> pr-url: https://github.com/nodejs/node/pull/41569
<add> description: The subject option can now be set to `'default'`.
<ide> -->
<ide>
<ide> * `name` {string}
<ide> * `options` {Object}
<del> * `subject` {string} `'always'` or `'never'`. **Default:** `'always'`.
<add> * `subject` {string} `'default'`, `'always'`, or `'never'`.
<add> **Default:** `'always'`.
<ide> * `wildcards` {boolean} **Default:** `true`.
<ide> * `partialWildcards` {boolean} **Default:** `true`.
<ide> * `multiLabelWildcards` {boolean} **Default:** `false`.
<ide> or it might contain wildcards (e.g., `*.example.com`). Because host name
<ide> comparisons are case-insensitive, the returned subject name might also differ
<ide> from the given `name` in capitalization.
<ide>
<add>If the `'subject'` option is set to `'always'` and if the subject alternative
<add>name extension either does not exist or does not contain a matching DNS name,
<add>the certificate subject is considered.
<add>
<add>If the `'subject'` option is set to `'default'`, the certificate subject is only
<add>considered if the subject alternative name extension either does not exist or
<add>does not contain any DNS names. This behavior is consistent with [RFC 2818][]
<add>("HTTP Over TLS").
<add>
<add>If the `'subject'` option is set to `'never'`, the certificate subject is never
<add>considered, even if the certificate contains no subject alternative names.
<add>
<ide> ### `x509.checkIP(ip[, options])`
<ide>
<ide> <!-- YAML
<ide> See the [list of SSL OP Flags][] for details.
<ide> [OpenSSL's SPKAC implementation]: https://www.openssl.org/docs/man1.1.0/apps/openssl-spkac.html
<ide> [RFC 1421]: https://www.rfc-editor.org/rfc/rfc1421.txt
<ide> [RFC 2412]: https://www.rfc-editor.org/rfc/rfc2412.txt
<add>[RFC 2818]: https://www.rfc-editor.org/rfc/rfc2818.txt
<ide> [RFC 3526]: https://www.rfc-editor.org/rfc/rfc3526.txt
<ide> [RFC 3610]: https://www.rfc-editor.org/rfc/rfc3610.txt
<ide> [RFC 4055]: https://www.rfc-editor.org/rfc/rfc4055.txt
<ide><path>lib/internal/crypto/x509.js
<ide> function isX509Certificate(value) {
<ide> function getFlags(options = {}) {
<ide> validateObject(options, 'options');
<ide> const {
<del> subject = 'always', // Can be 'always' or 'never'
<add> // TODO(tniessen): change the default to 'default'
<add> subject = 'always', // Can be 'default', 'always', or 'never'
<ide> wildcards = true,
<ide> partialWildcards = true,
<ide> multiLabelWildcards = false,
<ide> function getFlags(options = {}) {
<ide> validateBoolean(multiLabelWildcards, 'options.multiLabelWildcards');
<ide> validateBoolean(singleLabelSubdomains, 'options.singleLabelSubdomains');
<ide> switch (subject) {
<add> case 'default': /* Matches OpenSSL's default, no flags. */ break;
<ide> case 'always': flags |= X509_CHECK_FLAG_ALWAYS_CHECK_SUBJECT; break;
<ide> case 'never': flags |= X509_CHECK_FLAG_NEVER_CHECK_SUBJECT; break;
<ide> default:
<ide><path>test/parallel/test-x509-escaping.js
<ide> const { hasOpenSSL3 } = common;
<ide> assert.strictEqual(certX509.subject, `CN=${servername}`);
<ide> assert.strictEqual(certX509.subjectAltName, 'DNS:evil.example.com');
<ide>
<add> // The newer X509Certificate API allows customizing this behavior:
<add> assert.strictEqual(certX509.checkHost(servername), servername);
<add> assert.strictEqual(certX509.checkHost(servername, { subject: 'default' }),
<add> undefined);
<add> assert.strictEqual(certX509.checkHost(servername, { subject: 'always' }),
<add> servername);
<add> assert.strictEqual(certX509.checkHost(servername, { subject: 'never' }),
<add> undefined);
<add>
<ide> // Try connecting to a server that uses the self-signed certificate.
<ide> const server = tls.createServer({ key, cert }, common.mustNotCall());
<ide> server.listen(common.mustCall(() => {
<ide> const { hasOpenSSL3 } = common;
<ide> assert.strictEqual(certX509.subject, `CN=${servername}`);
<ide> assert.strictEqual(certX509.subjectAltName, 'IP Address:1.2.3.4');
<ide>
<add> // The newer X509Certificate API allows customizing this behavior:
<add> assert.strictEqual(certX509.checkHost(servername), servername);
<add> assert.strictEqual(certX509.checkHost(servername, { subject: 'default' }),
<add> servername);
<add> assert.strictEqual(certX509.checkHost(servername, { subject: 'always' }),
<add> servername);
<add> assert.strictEqual(certX509.checkHost(servername, { subject: 'never' }),
<add> undefined);
<add>
<ide> // Connect to a server that uses the self-signed certificate.
<ide> const server = tls.createServer({ key, cert }, common.mustCall((socket) => {
<ide> socket.destroy(); | 3 |
Python | Python | add a comment | 7a4164612c8112bdc1d952d5766c817cd6af3b0b | <ide><path>libcloud/compute/ssh.py
<ide> def run(self, cmd, timeout=None):
<ide> exit_status_ready = chan.exit_status_ready()
<ide>
<ide> if exit_status_ready:
<add> # It's possible that some data is already available when exit
<add> # status is ready
<ide> stdout.write(self._consume_stdout(chan).getvalue())
<ide> stderr.write(self._consume_stderr(chan).getvalue())
<ide> | 1 |
Go | Go | add tests for parsejob() | d985fd49843b31b227b46d5ed71914002e2e0de9 | <ide><path>engine/engine_test.go
<ide> import (
<ide> "os"
<ide> "path"
<ide> "path/filepath"
<add> "strings"
<ide> "testing"
<ide> )
<ide>
<ide> func TestEngineLogf(t *testing.T) {
<ide> t.Fatalf("Test: Logf() should print at least as much as the input\ninput=%d\nprinted=%d", len(input), n)
<ide> }
<ide> }
<add>
<add>func TestParseJob(t *testing.T) {
<add> eng := newTestEngine(t)
<add> defer os.RemoveAll(eng.Root())
<add> // Verify that the resulting job calls to the right place
<add> var called bool
<add> eng.Register("echo", func(job *Job) Status {
<add> called = true
<add> return StatusOK
<add> })
<add> input := "echo DEBUG=1 hello world VERBOSITY=42"
<add> job, err := eng.ParseJob(input)
<add> if err != nil {
<add> t.Fatal(err)
<add> }
<add> if job.Name != "echo" {
<add> t.Fatalf("Invalid job name: %v", job.Name)
<add> }
<add> if strings.Join(job.Args, ":::") != "hello:::world" {
<add> t.Fatalf("Invalid job args: %v", job.Args)
<add> }
<add> if job.Env().Get("DEBUG") != "1" {
<add> t.Fatalf("Invalid job env: %v", job.Env)
<add> }
<add> if job.Env().Get("VERBOSITY") != "42" {
<add> t.Fatalf("Invalid job env: %v", job.Env)
<add> }
<add> if len(job.Env().Map()) != 2 {
<add> t.Fatalf("Invalid job env: %v", job.Env)
<add> }
<add> if err := job.Run(); err != nil {
<add> t.Fatal(err)
<add> }
<add> if !called {
<add> t.Fatalf("Job was not called")
<add> }
<add>} | 1 |
PHP | PHP | apply fixes from styleci | c7a46f0c13b7f6b764c55bb741672bc557eada80 | <ide><path>tests/Queue/QueueWorkerTest.php
<ide> public function test_job_based_max_retries()
<ide> $this->assertNull($job->failedWith);
<ide> }
<ide>
<del>
<ide> public function test_job_based_failed_delay()
<ide> {
<ide> $job = new WorkerFakeJob(function ($job) {
<ide> public function test_job_based_failed_delay()
<ide> $this->assertEquals(10, $job->releaseAfter);
<ide> }
<ide>
<del>
<ide> /**
<ide> * Helpers...
<ide> */ | 1 |
Ruby | Ruby | use gem versions of sass-rails and coffee-rails | 8de96949e9d3d8f0902486df343ad88401c028fd | <ide><path>railties/lib/rails/generators/app_base.rb
<ide> def ruby_debugger_gemfile_entry
<ide>
<ide> def assets_gemfile_entry
<ide> return if options[:skip_sprockets]
<del> <<-GEMFILE.strip_heredoc.gsub(/^[ \t]*$/, '')
<del> # Gems used only for assets and not required
<del> # in production environments by default.
<del> group :assets do
<del> gem 'sass-rails', :git => 'git://github.com/rails/sass-rails.git'
<del> gem 'coffee-rails', :git => 'git://github.com/rails/coffee-rails.git'
<del> #{"gem 'therubyrhino'\n" if defined?(JRUBY_VERSION)}
<del> gem 'uglifier', '>= 1.0.3'
<del> end
<del> GEMFILE
<add>
<add> gemfile = if options.dev? || options.edge?
<add> <<-GEMFILE
<add> # Gems used only for assets and not required
<add> # in production environments by default.
<add> group :assets do
<add> gem 'sass-rails', :git => 'git://github.com/rails/sass-rails.git'
<add> gem 'coffee-rails', :git => 'git://github.com/rails/coffee-rails.git'
<add> #{"gem 'therubyrhino'\n" if defined?(JRUBY_VERSION)}
<add> gem 'uglifier', '>= 1.0.3'
<add> end
<add> GEMFILE
<add> else
<add> <<-GEMFILE
<add> # Gems used only for assets and not required
<add> # in production environments by default.
<add> group :assets do
<add> gem 'sass-rails', '~> 3.2.0'
<add> gem 'coffee-rails', '~> 3.2.0'
<add> #{"gem 'therubyrhino'\n" if defined?(JRUBY_VERSION)}
<add> gem 'uglifier', '>= 1.0.3'
<add> end
<add> GEMFILE
<add> end
<add>
<add> gemfile.strip_heredoc.gsub(/^[ \t]*$/, '')
<ide> end
<ide>
<ide> def javascript_gemfile_entry | 1 |
Ruby | Ruby | let build_bottle? check bottle_disabled? | 975771ab358ca582f6d5119c63bf32792735ac60 | <ide><path>Library/Homebrew/formula_installer.rb
<ide> def self.mode_attr_accessor(*names)
<ide> end
<ide>
<ide> attr_reader :formula
<del> attr_accessor :options
<add> attr_accessor :options, :build_bottle
<ide> mode_attr_accessor :show_summary_heading, :show_header
<del> mode_attr_accessor :build_from_source, :build_bottle, :force_bottle
<add> mode_attr_accessor :build_from_source, :force_bottle
<ide> mode_attr_accessor :ignore_deps, :only_deps, :interactive, :git
<ide> mode_attr_accessor :verbose, :debug, :quieter
<ide>
<ide> def self.prevent_build_flags
<ide> raise BuildFlagsError.new(build_flags) unless build_flags.empty?
<ide> end
<ide>
<add> def build_bottle?
<add> !!@build_bottle && !formula.bottle_disabled?
<add> end
<add>
<ide> def pour_bottle?(install_bottle_options = { :warn=>false })
<ide> return true if Homebrew::Hooks::Bottles.formula_has_bottle?(formula)
<ide>
<ide> def pour_bottle?(install_bottle_options = { :warn=>false })
<ide> return true if force_bottle? && bottle
<ide> return false if build_from_source? || build_bottle? || interactive?
<ide> return false unless options.empty?
<add> return false if formula.bottle_disabled?
<ide> return true if formula.local_bottle_path
<ide> return false unless bottle && formula.pour_bottle?
<ide> | 1 |
Go | Go | fix formatting of "nolint" tags for go1.19 | 4f0834668696c981ef56ee77dc7af05bf3d0dbf9 | <ide><path>libcontainerd/remote/client.go
<ide> func (c *client) CreateCheckpoint(ctx context.Context, containerID, checkpointDi
<ide> for _, m := range index.Manifests {
<ide> m := m
<ide> if m.MediaType == images.MediaTypeContainerd1Checkpoint {
<del> cpDesc = &m // nolint:gosec
<add> cpDesc = &m //nolint:gosec
<ide> break
<ide> }
<ide> }
<ide><path>libnetwork/cmd/networkdb-test/dummyclient/dummyClient.go
<ide> type tableHandler struct {
<ide> var clientWatchTable = map[string]tableHandler{}
<ide>
<ide> func watchTable(ctx interface{}, w http.ResponseWriter, r *http.Request) {
<del> r.ParseForm() // nolint:errcheck
<add> r.ParseForm() //nolint:errcheck
<ide> diagnostic.DebugHTTPForm(r)
<ide> if len(r.Form["tname"]) < 1 {
<ide> rsp := diagnostic.WrongCommand(missingParameter, fmt.Sprintf("%s?tname=table_name", r.URL.Path))
<del> diagnostic.HTTPReply(w, rsp, &diagnostic.JSONOutput{}) // nolint:errcheck
<add> diagnostic.HTTPReply(w, rsp, &diagnostic.JSONOutput{}) //nolint:errcheck
<ide> return
<ide> }
<ide>
<ide> func watchTable(ctx interface{}, w http.ResponseWriter, r *http.Request) {
<ide> }
<ide>
<ide> func watchTableEntries(ctx interface{}, w http.ResponseWriter, r *http.Request) {
<del> r.ParseForm() // nolint:errcheck
<add> r.ParseForm() //nolint:errcheck
<ide> diagnostic.DebugHTTPForm(r)
<ide> if len(r.Form["tname"]) < 1 {
<ide> rsp := diagnostic.WrongCommand(missingParameter, fmt.Sprintf("%s?tname=table_name", r.URL.Path))
<del> diagnostic.HTTPReply(w, rsp, &diagnostic.JSONOutput{}) // nolint:errcheck
<add> diagnostic.HTTPReply(w, rsp, &diagnostic.JSONOutput{}) //nolint:errcheck
<ide> return
<ide> }
<ide>
<ide><path>libnetwork/controller.go
<ide> func (c *controller) NewNetwork(networkType, name string, id string, options ...
<ide>
<ide> if id != "" {
<ide> c.networkLocker.Lock(id)
<del> defer c.networkLocker.Unlock(id) // nolint:errcheck
<add> defer c.networkLocker.Unlock(id) //nolint:errcheck
<ide>
<ide> if _, err = c.NetworkByID(id); err == nil {
<ide> return nil, NetworkNameError(id)
<ide> func (c *controller) NewNetwork(networkType, name string, id string, options ...
<ide>
<ide> err = c.addNetwork(network)
<ide> if err != nil {
<del> if _, ok := err.(types.MaskableError); ok { // nolint:gosimple
<add> if _, ok := err.(types.MaskableError); ok { //nolint:gosimple
<ide> // This error can be ignored and set this boolean
<ide> // value to skip a refcount increment for configOnly networks
<ide> skipCfgEpCount = true
<ide><path>libnetwork/diagnostic/server.go
<ide> func (s *Server) DisableDiagnostic() {
<ide> s.Lock()
<ide> defer s.Unlock()
<ide>
<del> s.srv.Shutdown(context.Background()) // nolint:errcheck
<add> s.srv.Shutdown(context.Background()) //nolint:errcheck
<ide> s.srv = nil
<ide> s.enable = 0
<ide> logrus.Info("Disabling the diagnostic server")
<ide> func (s *Server) IsDiagnosticEnabled() bool {
<ide> }
<ide>
<ide> func notImplemented(ctx interface{}, w http.ResponseWriter, r *http.Request) {
<del> r.ParseForm() // nolint:errcheck
<add> r.ParseForm() //nolint:errcheck
<ide> _, json := ParseHTTPFormOptions(r)
<ide> rsp := WrongCommand("not implemented", fmt.Sprintf("URL path: %s no method implemented check /help\n", r.URL.Path))
<ide>
<ide> // audit logs
<ide> log := logrus.WithFields(logrus.Fields{"component": "diagnostic", "remoteIP": r.RemoteAddr, "method": caller.Name(0), "url": r.URL.String()})
<ide> log.Info("command not implemented done")
<ide>
<del> HTTPReply(w, rsp, json) // nolint:errcheck
<add> HTTPReply(w, rsp, json) //nolint:errcheck
<ide> }
<ide>
<ide> func help(ctx interface{}, w http.ResponseWriter, r *http.Request) {
<del> r.ParseForm() // nolint:errcheck
<add> r.ParseForm() //nolint:errcheck
<ide> _, json := ParseHTTPFormOptions(r)
<ide>
<ide> // audit logs
<ide> func help(ctx interface{}, w http.ResponseWriter, r *http.Request) {
<ide> for path := range n.registeredHanders {
<ide> result += fmt.Sprintf("%s\n", path)
<ide> }
<del> HTTPReply(w, CommandSucceed(&StringCmd{Info: result}), json) // nolint:errcheck
<add> HTTPReply(w, CommandSucceed(&StringCmd{Info: result}), json) //nolint:errcheck
<ide> }
<ide> }
<ide>
<ide> func ready(ctx interface{}, w http.ResponseWriter, r *http.Request) {
<del> r.ParseForm() // nolint:errcheck
<add> r.ParseForm() //nolint:errcheck
<ide> _, json := ParseHTTPFormOptions(r)
<ide>
<ide> // audit logs
<ide> log := logrus.WithFields(logrus.Fields{"component": "diagnostic", "remoteIP": r.RemoteAddr, "method": caller.Name(0), "url": r.URL.String()})
<ide> log.Info("ready done")
<del> HTTPReply(w, CommandSucceed(&StringCmd{Info: "OK"}), json) // nolint:errcheck
<add> HTTPReply(w, CommandSucceed(&StringCmd{Info: "OK"}), json) //nolint:errcheck
<ide> }
<ide>
<ide> func stackTrace(ctx interface{}, w http.ResponseWriter, r *http.Request) {
<del> r.ParseForm() // nolint:errcheck
<add> r.ParseForm() //nolint:errcheck
<ide> _, json := ParseHTTPFormOptions(r)
<ide>
<ide> // audit logs
<ide> func stackTrace(ctx interface{}, w http.ResponseWriter, r *http.Request) {
<ide> path, err := stack.DumpToFile("/tmp/")
<ide> if err != nil {
<ide> log.WithError(err).Error("failed to write goroutines dump")
<del> HTTPReply(w, FailCommand(err), json) // nolint:errcheck
<add> HTTPReply(w, FailCommand(err), json) //nolint:errcheck
<ide> } else {
<ide> log.Info("stack trace done")
<del> HTTPReply(w, CommandSucceed(&StringCmd{Info: fmt.Sprintf("goroutine stacks written to %s", path)}), json) // nolint:errcheck
<add> HTTPReply(w, CommandSucceed(&StringCmd{Info: fmt.Sprintf("goroutine stacks written to %s", path)}), json) //nolint:errcheck
<ide> }
<ide> }
<ide>
<ide><path>libnetwork/endpoint.go
<ide> func (ep *endpoint) UnmarshalJSON(b []byte) (err error) {
<ide> // If anyone ever comes here and figures out one way or another if we can/should be checking these errors and it turns out we can't... then please document *why*
<ide>
<ide> ib, _ := json.Marshal(epMap["ep_iface"])
<del> json.Unmarshal(ib, &ep.iface) // nolint:errcheck
<add> json.Unmarshal(ib, &ep.iface) //nolint:errcheck
<ide>
<ide> jb, _ := json.Marshal(epMap["joinInfo"])
<del> json.Unmarshal(jb, &ep.joinInfo) // nolint:errcheck
<add> json.Unmarshal(jb, &ep.joinInfo) //nolint:errcheck
<ide>
<ide> tb, _ := json.Marshal(epMap["exposed_ports"])
<ide> var tPorts []types.TransportPort
<del> json.Unmarshal(tb, &tPorts) // nolint:errcheck
<add> json.Unmarshal(tb, &tPorts) //nolint:errcheck
<ide> ep.exposedPorts = tPorts
<ide>
<ide> cb, _ := json.Marshal(epMap["sandbox"])
<del> json.Unmarshal(cb, &ep.sandboxID) // nolint:errcheck
<add> json.Unmarshal(cb, &ep.sandboxID) //nolint:errcheck
<ide>
<ide> if v, ok := epMap["generic"]; ok {
<ide> ep.generic = v.(map[string]interface{})
<ide> func (ep *endpoint) UnmarshalJSON(b []byte) (err error) {
<ide>
<ide> sal, _ := json.Marshal(epMap["svcAliases"])
<ide> var svcAliases []string
<del> json.Unmarshal(sal, &svcAliases) // nolint:errcheck
<add> json.Unmarshal(sal, &svcAliases) //nolint:errcheck
<ide> ep.svcAliases = svcAliases
<ide>
<ide> pc, _ := json.Marshal(epMap["ingressPorts"])
<ide> var ingressPorts []*PortConfig
<del> json.Unmarshal(pc, &ingressPorts) // nolint:errcheck
<add> json.Unmarshal(pc, &ingressPorts) //nolint:errcheck
<ide> ep.ingressPorts = ingressPorts
<ide>
<ide> ma, _ := json.Marshal(epMap["myAliases"])
<ide> var myAliases []string
<del> json.Unmarshal(ma, &myAliases) // nolint:errcheck
<add> json.Unmarshal(ma, &myAliases) //nolint:errcheck
<ide> ep.myAliases = myAliases
<ide> return nil
<ide> }
<ide><path>libnetwork/endpoint_info.go
<ide> func (epi *endpointInterface) UnmarshalJSON(b []byte) error {
<ide> var routes []string
<ide>
<ide> // TODO(cpuguy83): linter noticed we don't check the error here... no idea why but it seems like it could introduce problems if we start checking
<del> json.Unmarshal(rb, &routes) // nolint:errcheck
<add> json.Unmarshal(rb, &routes) //nolint:errcheck
<ide>
<ide> epi.routes = make([]*net.IPNet, 0)
<ide> for _, route := range routes {
<ide> func (epj *endpointJoinInfo) UnmarshalJSON(b []byte) error {
<ide> // This is why I'm not adding the error check.
<ide> //
<ide> // In any case for posterity please if you figure this out document it or check the error
<del> json.Unmarshal(tb, &tStaticRoute) // nolint:errcheck
<add> json.Unmarshal(tb, &tStaticRoute) //nolint:errcheck
<ide> }
<ide> var StaticRoutes []*types.StaticRoute
<ide> for _, r := range tStaticRoute {
<ide><path>libnetwork/libnetwork_internal_test.go
<ide> func TestIpamReleaseOnNetDriverFailures(t *testing.T) {
<ide> if err != nil {
<ide> t.Fatal(err)
<ide> }
<del> defer ep.Delete(false) // nolint:errcheck
<add> defer ep.Delete(false) //nolint:errcheck
<ide>
<ide> expectedIP, _ := types.ParseCIDR("10.35.0.1/16")
<ide> if !types.CompareIPNet(ep.Info().Iface().Address(), expectedIP) {
<ide><path>libnetwork/network.go
<ide> func (n *network) delete(force bool, rmLBEndpoint bool) error {
<ide> n.Unlock()
<ide>
<ide> c.networkLocker.Lock(id)
<del> defer c.networkLocker.Unlock(id) // nolint:errcheck
<add> defer c.networkLocker.Unlock(id) //nolint:errcheck
<ide>
<ide> n, err := c.getNetworkFromStore(id)
<ide> if err != nil {
<ide> func (n *network) delete(force bool, rmLBEndpoint bool) error {
<ide> // continue deletion when force is true even on error
<ide> logrus.Warnf("Error deleting load balancer sandbox: %v", err)
<ide> }
<del> //Reload the network from the store to update the epcnt.
<add> // Reload the network from the store to update the epcnt.
<ide> n, err = c.getNetworkFromStore(id)
<ide> if err != nil {
<ide> return &UnknownNetworkError{name: name, id: id}
<ide> func (n *network) CreateEndpoint(name string, options ...EndpointOption) (Endpoi
<ide> }
<ide>
<ide> n.ctrlr.networkLocker.Lock(n.id)
<del> defer n.ctrlr.networkLocker.Unlock(n.id) // nolint:errcheck
<add> defer n.ctrlr.networkLocker.Unlock(n.id) //nolint:errcheck
<ide>
<ide> return n.createEndpoint(name, options...)
<ide>
<ide><path>libnetwork/options/options_test.go
<ide> func TestGenerateMissingField(t *testing.T) {
<ide> }
<ide>
<ide> func TestFieldCannotBeSet(t *testing.T) {
<del> type Model struct{ foo int } // nolint:structcheck
<add> type Model struct{ foo int } //nolint:structcheck
<ide> _, err := GenerateFromModel(Generic{"foo": "bar"}, Model{})
<ide>
<ide> if _, ok := err.(CannotSetFieldError); !ok {
<ide><path>libnetwork/resolver.go
<ide> const (
<ide> ptrIPv4domain = ".in-addr.arpa."
<ide> ptrIPv6domain = ".ip6.arpa."
<ide> respTTL = 600
<del> maxExtDNS = 3 //max number of external servers to try
<add> maxExtDNS = 3 // max number of external servers to try
<ide> extIOTimeout = 4 * time.Second
<ide> defaultRespSize = 512
<ide> maxConcurrent = 1024
<ide> func (r *resolver) Stop() {
<ide> defer func() { <-r.startCh }()
<ide>
<ide> if r.server != nil {
<del> r.server.Shutdown() // nolint:errcheck
<add> r.server.Shutdown() //nolint:errcheck
<ide> }
<ide> if r.tcpServer != nil {
<del> r.tcpServer.Shutdown() // nolint:errcheck
<add> r.tcpServer.Shutdown() //nolint:errcheck
<ide> }
<ide> r.conn = nil
<ide> r.tcpServer = nil
<ide> func setCommonFlags(msg *dns.Msg) {
<ide>
<ide> func shuffleAddr(addr []net.IP) []net.IP {
<ide> for i := len(addr) - 1; i > 0; i-- {
<del> r := rand.Intn(i + 1) // nolint:gosec // gosec complains about the use of rand here. It should be fine.
<add> r := rand.Intn(i + 1) //nolint:gosec // gosec complains about the use of rand here. It should be fine.
<ide> addr[i], addr[r] = addr[r], addr[i]
<ide> }
<ide> return addr
<ide><path>libnetwork/resolver_test.go
<ide> func TestDNSProxyServFail(t *testing.T) {
<ide> srvErrCh <- server.ListenAndServe()
<ide> }()
<ide> defer func() {
<del> server.Shutdown() // nolint:errcheck
<add> server.Shutdown() //nolint:errcheck
<ide> if err := <-srvErrCh; err != nil {
<ide> t.Error(err)
<ide> }
<ide><path>libnetwork/sandbox.go
<ide> type sandbox struct {
<ide> // These are the container configs used to customize container /etc/hosts file.
<ide> type hostsPathConfig struct {
<ide> // Note(cpuguy83): The linter is drunk and says none of these fields are used while they are
<del> hostName string // nolint:structcheck
<del> domainName string // nolint:structcheck
<del> hostsPath string // nolint:structcheck
<del> originHostsPath string // nolint:structcheck
<del> extraHosts []extraHost // nolint:structcheck
<del> parentUpdates []parentUpdate // nolint:structcheck
<add> hostName string //nolint:structcheck
<add> domainName string //nolint:structcheck
<add> hostsPath string //nolint:structcheck
<add> originHostsPath string //nolint:structcheck
<add> extraHosts []extraHost //nolint:structcheck
<add> parentUpdates []parentUpdate //nolint:structcheck
<ide> }
<ide>
<ide> type parentUpdate struct {
<ide> type extraHost struct {
<ide> // These are the container configs used to customize container /etc/resolv.conf file.
<ide> type resolvConfPathConfig struct {
<ide> // Note(cpuguy83): The linter is drunk and says none of these fields are used while they are
<del> resolvConfPath string // nolint:structcheck
<del> originResolvConfPath string // nolint:structcheck
<del> resolvConfHashFile string // nolint:structcheck
<del> dnsList []string // nolint:structcheck
<del> dnsSearchList []string // nolint:structcheck
<del> dnsOptionsList []string // nolint:structcheck
<add> resolvConfPath string //nolint:structcheck
<add> originResolvConfPath string //nolint:structcheck
<add> resolvConfHashFile string //nolint:structcheck
<add> dnsList []string //nolint:structcheck
<add> dnsSearchList []string //nolint:structcheck
<add> dnsOptionsList []string //nolint:structcheck
<ide> }
<ide>
<ide> type containerConfig struct {
<ide> func (sb *sandbox) updateGateway(ep *endpoint) error {
<ide> if osSbox == nil {
<ide> return nil
<ide> }
<del> osSbox.UnsetGateway() // nolint:errcheck
<del> osSbox.UnsetGatewayIPv6() // nolint:errcheck
<add> osSbox.UnsetGateway() //nolint:errcheck
<add> osSbox.UnsetGatewayIPv6() //nolint:errcheck
<ide>
<ide> if ep == nil {
<ide> return nil
<ide><path>libnetwork/service_common.go
<ide> func (c *controller) addServiceBinding(svcName, svcID, nID, eID, containerName s
<ide> // state in the c.serviceBindings map and it's sub-maps. Also,
<ide> // always lock network ID before services to avoid deadlock.
<ide> c.networkLocker.Lock(nID)
<del> defer c.networkLocker.Unlock(nID) // nolint:errcheck
<add> defer c.networkLocker.Unlock(nID) //nolint:errcheck
<ide>
<ide> n, err := c.NetworkByID(nID)
<ide> if err != nil {
<ide><path>pkg/devicemapper/devmapper.go
<ide> import (
<ide> )
<ide>
<ide> // Same as DM_DEVICE_* enum values from libdevmapper.h
<del>// nolint: deadcode,unused,varcheck
<add>//
<add>//nolint:deadcode,unused,varcheck
<ide> const (
<ide> deviceCreate TaskType = iota
<ide> deviceReload
<ide><path>volume/drivers/extpoint.go
<ide> const extName = "VolumeDriver"
<ide> // volumeDriver defines the available functions that volume plugins must implement.
<ide> // This interface is only defined to generate the proxy objects.
<ide> // It's not intended to be public or reused.
<del>// nolint: deadcode,unused,varcheck
<add>//
<add>//nolint:deadcode,unused,varcheck
<ide> type volumeDriver interface {
<ide> // Create a volume with the given name
<ide> Create(name string, opts map[string]string) (err error) | 15 |
Python | Python | shorten error message for clarity | 2cafba5f50d83a93582bddea6bd1f569f98207f7 | <ide><path>spacy/errors.py
<ide> class Errors:
<ide>
<ide> # TODO: fix numbering after merging develop into master
<ide> E900 = ("Could not run the full 'nlp' pipeline for evaluation. If you specified "
<del> "frozen components, make sure they were already trained and initialized. "
<del> "You can also consider moving them to the 'disabled' list instead.")
<add> "frozen components, make sure they were already trained and initialized. ")
<ide> E901 = ("Failed to remove existing output directory: {path}. If your "
<ide> "config and the components you train change between runs, a "
<ide> "non-empty output directory can lead to stale pipeline data. To " | 1 |
Ruby | Ruby | avoid dummy_time_value to add "2000-01-01" twice | 589cef086fd06df80bcf988a014c7b6628013039 | <ide><path>activemodel/lib/active_model/type/time.rb
<ide> def cast_value(value)
<ide> return value unless value.is_a?(::String)
<ide> return if value.empty?
<ide>
<del> dummy_time_value = "2000-01-01 #{value}"
<add> if value =~ /^2000-01-01/
<add> dummy_time_value = value
<add> else
<add> dummy_time_value = "2000-01-01 #{value}"
<add> end
<ide>
<ide> fast_string_to_time(dummy_time_value) || begin
<ide> time_hash = ::Date._parse(dummy_time_value) | 1 |
Python | Python | add test for ticket #372. whitespace cleanup | a15d0d96c00f8ae86e5302024c4a940c266d5288 | <ide><path>numpy/core/tests/test_regression.py
<ide> def check_char_dump(self,level=rlevel):
<ide> def check_noncontiguous_fill(self,level=rlevel):
<ide> """Ticket #58."""
<ide> a = N.zeros((5,3))
<del> b = a[:,:2,]
<add> b = a[:,:2,]
<ide> def rs():
<ide> b.shape = (10,)
<ide> self.failUnlessRaises(AttributeError,rs)
<del>
<add>
<ide> def check_bool(self,level=rlevel):
<ide> """Ticket #60"""
<ide> x = N.bool_(1)
<ide> def check_round(self,level=rlevel):
<ide> def check_kron_matrix(self,level=rlevel):
<ide> """Ticket #71"""
<ide> x = N.matrix('[1 0; 1 0]')
<del> assert_equal(type(N.kron(x,x)),type(x))
<add> assert_equal(type(N.kron(x,x)),type(x))
<ide>
<ide> def check_scalar_compare(self,level=rlevel):
<ide> """Ticket #72"""
<ide> def index_tmp(): tmp[N.array(10)]
<ide> def check_unique_zero_sized(self,level=rlevel):
<ide> """Ticket #205"""
<ide> assert_array_equal([], N.unique(N.array([])))
<del>
<add>
<ide> def check_chararray_rstrip(self,level=rlevel):
<ide> """Ticket #222"""
<ide> x = N.chararray((1,),5)
<ide> x[0] = 'a '
<ide> x = x.rstrip()
<ide> assert_equal(x[0], 'a')
<del>
<add>
<ide> def check_object_array_shape(self,level=rlevel):
<ide> """Ticket #239"""
<ide> assert_equal(N.array([[1,2],3,4],dtype=object).shape, (3,))
<ide> def check_object_array_shape(self,level=rlevel):
<ide> assert_equal(N.array([],dtype=object).shape, (0,))
<ide> assert_equal(N.array([[],[],[]],dtype=object).shape, (3,0))
<ide> assert_equal(N.array([[3,4],[5,6],None],dtype=object).shape, (3,))
<del>
<add>
<ide> def check_mem_around(self,level=rlevel):
<ide> """Ticket #243"""
<ide> x = N.zeros((1,))
<ide> y = [0]
<ide> decimal = 6
<ide> N.around(abs(x-y),decimal) <= 10.0**(-decimal)
<del>
<add>
<ide> def check_character_array_strip(self,level=rlevel):
<ide> """Ticket #246"""
<ide> x = N.char.array(("x","x ","x "))
<ide> def check_lexsort(self,level=rlevel):
<ide> """Lexsort memory error"""
<ide> v = N.array([1,2,3,4,5,6,7,8,9,10])
<ide> assert_equal(N.lexsort(v),0)
<del>
<add>
<ide> def check_pickle_dtype(self,level=rlevel):
<ide> """Ticket #251"""
<ide> import pickle
<ide> pickle.dumps(N.float)
<del>
<add>
<ide> def check_masked_array_multiply(self,level=rlevel):
<ide> """Ticket #254"""
<ide> a = N.ma.zeros((4,1))
<ide> def check_swap_real(self, level=rlevel):
<ide> def check_object_array_from_list(self, level=rlevel):
<ide> """Ticket #270"""
<ide> a = N.array([1,'A',None])
<del>
<add>
<ide> def check_masked_array_repeat(self, level=rlevel):
<ide> """Ticket #271"""
<ide> N.ma.array([1],mask=False).repeat(10)
<del>
<add>
<ide> def check_multiple_assign(self, level=rlevel):
<ide> """Ticket #273"""
<ide> a = N.zeros((3,1),int)
<ide> a[[1,2]] = 1
<del>
<add>
<ide> def check_empty_array_type(self, level=rlevel):
<ide> assert_equal(N.array([]).dtype, N.zeros(0).dtype)
<ide>
<ide> def check_method_args(self, level=rlevel):
<ide> 'ptp', 'cumprod', 'prod', 'std', 'var', 'mean',
<ide> 'round', 'min', 'max', 'argsort', 'sort']
<ide> funcs2 = ['compress', 'take', 'repeat']
<del>
<add>
<ide> for func in funcs1:
<ide> arr = N.random.rand(8,7)
<ide> arr2 = arr.copy()
<ide> def check_method_args(self, level=rlevel):
<ide> res1 = getattr(arr1, func)(arr2)
<ide> res2 = getattr(N, func)(arr1, arr2)
<ide> assert abs(res1-res2).max() < 1e-8, func
<del>
<add>
<ide> def check_mem_lexsort_strings(self, level=rlevel):
<ide> """Ticket #298"""
<ide> lst = ['abc','cde','fgh']
<ide> N.lexsort((lst,))
<del>
<add>
<ide> def check_fancy_index(self, level=rlevel):
<ide> """Ticket #302"""
<ide> x = N.array([1,2])[N.array([0])]
<ide> assert_equal(x.shape,(1,))
<del>
<add>
<ide> def check_recarray_copy(self, level=rlevel):
<ide> """Ticket #312"""
<ide> dt = [('x',N.int16),('y',N.float64)]
<ide> ra = N.array([(1,2.3)], dtype=dt)
<ide> rb = N.rec.array(ra, dtype=dt)
<ide> rb['x'] = 2.
<ide> assert ra['x'] != rb['x']
<del>
<add>
<ide> def check_rec_fromarray(self, level=rlevel):
<ide> """Ticket #322"""
<ide> x1 = N.array([[1,2],[3,4],[5,6]])
<ide> x2 = N.array(['a','dd','xyz'])
<ide> x3 = N.array([1.1,2,3])
<ide> N.rec.fromarrays([x1,x2,x3], formats="(2,)i4,a3,f8")
<del>
<add>
<ide> def check_object_array_assign(self, level=rlevel):
<ide> x = N.empty((2,2),object)
<ide> x.flat[2] = (1,2,3)
<ide> assert_equal(x.flat[2],(1,2,3))
<del>
<add>
<ide> def check_ndmin_float64(self, level=rlevel):
<ide> """Ticket #324"""
<del> x = N.array([1,2,3],dtype=N.float64)
<del> assert_equal(N.array(x,dtype=N.float32,ndmin=2).ndim,2)
<add> x = N.array([1,2,3],dtype=N.float64)
<add> assert_equal(N.array(x,dtype=N.float32,ndmin=2).ndim,2)
<ide> assert_equal(N.array(x,dtype=N.float64,ndmin=2).ndim,2)
<del>
<add>
<ide> def check_mem_vectorise(self, level=rlevel):
<ide> """Ticket #325"""
<ide> vt = N.vectorize(lambda *args: args)
<ide> vt(N.zeros((1,2,1)), N.zeros((2,1,1)), N.zeros((1,1,2)))
<del> vt(N.zeros((1,2,1)), N.zeros((2,1,1)), N.zeros((1,1,2)), N.zeros((2,2)))
<del>
<add> vt(N.zeros((1,2,1)), N.zeros((2,1,1)), N.zeros((1,1,2)), N.zeros((2,2)))
<add>
<ide> def check_mem_axis_minimization(self, level=rlevel):
<ide> """Ticket #327"""
<ide> data = N.arange(5)
<ide> data = N.add.outer(data,data)
<del>
<add>
<ide> def check_mem_float_imag(self, level=rlevel):
<ide> """Ticket #330"""
<ide> N.float64(1.0).imag
<del>
<add>
<ide> def check_dtype_tuple(self, level=rlevel):
<ide> """Ticket #334"""
<ide> assert N.dtype('i4') == N.dtype(('i4',()))
<del>
<add>
<ide> def check_dtype_posttuple(self, level=rlevel):
<ide> """Ticket #335"""
<ide> N.dtype([('col1', '()i4')])
<del>
<add>
<ide> def check_mgrid_single_element(self, level=rlevel):
<ide> """Ticket #339"""
<ide> assert_array_equal(N.mgrid[0:0:1j],[0])
<ide> assert_array_equal(N.mgrid[0:0],[])
<del>
<add>
<ide> def check_numeric_carray_compare(self, level=rlevel):
<ide> """Ticket #341"""
<del> assert_equal(N.array([ 'X' ], 'c'),'X')
<del>
<add> assert_equal(N.array([ 'X' ], 'c'),'X')
<add>
<ide> def check_string_array_size(self, level=rlevel):
<ide> """Ticket #342"""
<ide> self.failUnlessRaises(ValueError,
<ide> N.array,[['X'],['X','X','X']],'|S1')
<del>
<add>
<ide> def check_dtype_repr(self, level=rlevel):
<ide> """Ticket #344"""
<ide> dt1=N.dtype(('uint32', 2))
<del> dt2=N.dtype(('uint32', (2,)))
<add> dt2=N.dtype(('uint32', (2,)))
<ide> assert_equal(dt1.__repr__(), dt2.__repr__())
<ide>
<ide> def check_reshape_order(self, level=rlevel):
<ide> def check_array_index(self, level=rlevel):
<ide> def check_object_argmax(self, level=rlevel):
<ide> a = N.array([1,2,3],dtype=object)
<ide> assert a.argmax() == 2
<del>
<add>
<add> def check_recarray_fields(self, level=rlevel):
<add> """Ticket #372"""
<add> dt = N.dtype([('f0',"i4"),('f1',"i4")])
<add> for a in [N.array([(1,2),(3,4)],"i4,i4"),
<add> N.rec.array([(1,2),(3,4)],"i4,i4"),
<add> N.rec.array([(1,2),(3,4)]),
<add> N.rec.fromarrays([(1,2),(3,4)],"i4,i4"),
<add> N.rec.fromarrays([(1,2),(3,4)])]:
<add> assert_equal(a.dtype,dt)
<add>
<ide> if __name__ == "__main__":
<ide> NumpyTest().run() | 1 |
Javascript | Javascript | remove debug comment | 63414e3323ee994ca410bf629d5303f3dd3d2846 | <ide><path>examples/js/BlendCharacter.js
<ide> THREE.BlendCharacter = function () {
<ide>
<ide> scope.mixer = new THREE.AnimationMixer( scope );
<ide>
<del> // Create the animations
<del> console.log( geometry );
<del>
<add> // Create the animations
<ide> for ( var i = 0; i < geometry.clips.length; ++ i ) {
<ide>
<ide> var animName = geometry.clips[ i ].name; | 1 |
Javascript | Javascript | fix d3.svg.axis path for explicit ordinal range | 1a98398be0954bc4240f848baf7c33f92d4b4702 | <ide><path>d3.js
<ide> d3.svg.axis = function() {
<ide> subtickUpdate.attr("x2", 0).attr("y2", tickMinorSize);
<ide> tickUpdate.select("line").attr("x2", 0).attr("y2", tickMajorSize);
<ide> tickUpdate.select("text").attr("x", 0).attr("y", Math.max(tickMajorSize, 0) + tickPadding).attr("dy", ".71em").attr("text-anchor", "middle");
<del> pathUpdate.attr("d", "M" + range[0] + "," + tickEndSize + "V0H" + range[1] + "V" + tickEndSize);
<add> pathUpdate.attr("d", "M" + range[0] + "," + tickEndSize + "V0H" + range[range.length - 1] + "V" + tickEndSize);
<ide> break;
<ide> }
<ide> case "top": {
<ide> tickTransform = d3_svg_axisX;
<ide> subtickUpdate.attr("x2", 0).attr("y2", -tickMinorSize);
<ide> tickUpdate.select("line").attr("x2", 0).attr("y2", -tickMajorSize);
<ide> tickUpdate.select("text").attr("x", 0).attr("y", -(Math.max(tickMajorSize, 0) + tickPadding)).attr("dy", "0em").attr("text-anchor", "middle");
<del> pathUpdate.attr("d", "M" + range[0] + "," + -tickEndSize + "V0H" + range[1] + "V" + -tickEndSize);
<add> pathUpdate.attr("d", "M" + range[0] + "," + -tickEndSize + "V0H" + range[range.length - 1] + "V" + -tickEndSize);
<ide> break;
<ide> }
<ide> case "left": {
<ide> tickTransform = d3_svg_axisY;
<ide> subtickUpdate.attr("x2", -tickMinorSize).attr("y2", 0);
<ide> tickUpdate.select("line").attr("x2", -tickMajorSize).attr("y2", 0);
<ide> tickUpdate.select("text").attr("x", -(Math.max(tickMajorSize, 0) + tickPadding)).attr("y", 0).attr("dy", ".32em").attr("text-anchor", "end");
<del> pathUpdate.attr("d", "M" + -tickEndSize + "," + range[0] + "H0V" + range[1] + "H" + -tickEndSize);
<add> pathUpdate.attr("d", "M" + -tickEndSize + "," + range[0] + "H0V" + range[range.length - 1] + "H" + -tickEndSize);
<ide> break;
<ide> }
<ide> case "right": {
<ide> tickTransform = d3_svg_axisY;
<ide> subtickUpdate.attr("x2", tickMinorSize).attr("y2", 0);
<ide> tickUpdate.select("line").attr("x2", tickMajorSize).attr("y2", 0);
<ide> tickUpdate.select("text").attr("x", Math.max(tickMajorSize, 0) + tickPadding).attr("y", 0).attr("dy", ".32em").attr("text-anchor", "start");
<del> pathUpdate.attr("d", "M" + tickEndSize + "," + range[0] + "H0V" + range[1] + "H" + tickEndSize);
<add> pathUpdate.attr("d", "M" + tickEndSize + "," + range[0] + "H0V" + range[range.length - 1] + "H" + tickEndSize);
<ide> break;
<ide> }
<ide> }
<ide><path>d3.min.js
<ide> (function(){function e(a){var b=-1,c=a.length,d=[];while(++b<c)d.push(a[b]);return d}function f(a){return Array.prototype.slice.call(a)}function i(){return this}function j(a,b,c){return function(){var d=c.apply(b,arguments);return arguments.length?a:d}}function k(a){return a!=null&&!isNaN(a)}function l(a){return a.length}function m(a){return a==null}function n(a){return a.replace(/(^\s+)|(\s+$)/g,"").replace(/\s+/g," ")}function q(){}function r(){function c(){var b=a,c=-1,d=b.length,e;while(++c<d)(e=b[c].on)&&e.apply(this,arguments)}var a=[],b={};return c.on=function(d,e){var f,g;if(arguments.length<2)return(f=b[d])&&f.on;if(f=b[d])f.on=null,a=a.slice(0,g=a.indexOf(f)).concat(a.slice(g+1)),delete b[d];return e&&a.push(b[d]={on:e}),c},c}function u(a,b){return b-(a?1+Math.floor(Math.log(a+Math.pow(10,1+Math.floor(Math.log(a)/Math.LN10)-b))/Math.LN10):1)}function v(a){return a+""}function w(a){var b=a.lastIndexOf("."),c=b>=0?a.substring(b):(b=a.length,""),d=[];while(b>0)d.push(a.substring(b-=3,b+3));return d.reverse().join(",")+c}function y(a,b){return{scale:Math.pow(10,(8-b)*3),symbol:a}}function D(a){return function(b){return b<=0?0:b>=1?1:a(b)}}function E(a){return function(b){return 1-a(1-b)}}function F(a){return function(b){return.5*(b<.5?a(2*b):2-a(2-2*b))}}function G(a){return a}function H(a){return function(b){return Math.pow(b,a)}}function I(a){return 1-Math.cos(a*Math.PI/2)}function J(a){return Math.pow(2,10*(a-1))}function K(a){return 1-Math.sqrt(1-a*a)}function L(a,b){var c;return arguments.length<2&&(b=.45),arguments.length<1?(a=1,c=b/4):c=b/(2*Math.PI)*Math.asin(1/a),function(d){return 1+a*Math.pow(2,10*-d)*Math.sin((d-c)*2*Math.PI/b)}}function M(a){return a||(a=1.70158),function(b){return b*b*((a+1)*b-a)}}function N(a){return a<1/2.75?7.5625*a*a:a<2/2.75?7.5625*(a-=1.5/2.75)*a+.75:a<2.5/2.75?7.5625*(a-=2.25/2.75)*a+.9375:7.5625*(a-=2.625/2.75)*a+.984375}function O(){d3.event.stopPropagation(),d3.event.preventDefault()}function Q(a){return a=="transform"?d3.interpolateTransform:d3.interpolate}function R(a,b){return b=b-(a=+a)?1/(b-a):0,function(c){return(c-a)*b}}function S(a,b){return b=b-(a=+a)?1/(b-a):0,function(c){return Math.max(0,Math.min(1,(c-a)*b))}}function T(a,b,c){return new U(a,b,c)}function U(a,b,c){this.r=a,this.g=b,this.b=c}function V(a){return a<16?"0"+Math.max(0,a).toString(16):Math.min(255,a).toString(16)}function W(a,b,c){var d=0,e=0,f=0,g,h,i;g=/([a-z]+)\((.*)\)/i.exec(a);if(g){h=g[2].split(",");switch(g[1]){case"hsl":return c(parseFloat(h[0]),parseFloat(h[1])/100,parseFloat(h[2])/100);case"rgb":return b(Y(h[0]),Y(h[1]),Y(h[2]))}}return(i=Z[a])?b(i.r,i.g,i.b):(a!=null&&a.charAt(0)==="#"&&(a.length===4?(d=a.charAt(1),d+=d,e=a.charAt(2),e+=e,f=a.charAt(3),f+=f):a.length===7&&(d=a.substring(1,3),e=a.substring(3,5),f=a.substring(5,7)),d=parseInt(d,16),e=parseInt(e,16),f=parseInt(f,16)),b(d,e,f))}function X(a,b,c){var d=Math.min(a/=255,b/=255,c/=255),e=Math.max(a,b,c),f=e-d,g,h,i=(e+d)/2;return f?(h=i<.5?f/(e+d):f/(2-e-d),a==e?g=(b-c)/f+(b<c?6:0):b==e?g=(c-a)/f+2:g=(a-b)/f+4,g*=60):h=g=0,_(g,h,i)}function Y(a){var b=parseFloat(a);return a.charAt(a.length-1)==="%"?Math.round(b*2.55):b}function _(a,b,c){return new ba(a,b,c)}function ba(a,b,c){this.h=a,this.s=b,this.l=c}function bb(a,b,c){function f(a){return a>360?a-=360:a<0&&(a+=360),a<60?d+(e-d)*a/60:a<180?e:a<240?d+(e-d)*(240-a)/60:d}function g(a){return Math.round(f(a)*255)}var d,e;return a%=360,a<0&&(a+=360),b=b<0?0:b>1?1:b,c=c<0?0:c>1?1:c,e=c<=.5?c*(1+b):c+b-c*b,d=2*c-e,T(g(a+120),g(a),g(a-120))}function bc(a){return h(a,bi),a}function bj(a){return function(){return bd(a,this)}}function bk(a){return function(){return be(a,this)}}function bm(a,b){function f(){if(b=this.classList)return b.add(a);var b=this.className,d=b.baseVal!=null,e=d?b.baseVal:b;c.lastIndex=0,c.test(e)||(e=n(e+" "+a),d?b.baseVal=e:this.className=e)}function g(){if(b=this.classList)return b.remove(a);var b=this.className,d=b.baseVal!=null,e=d?b.baseVal:b;e=n(e.replace(c," ")),d?b.baseVal=e:this.className=e}function h(){(b.apply(this,arguments)?f:g).call(this)}var c=new RegExp("(^|\\s+)"+d3.requote(a)+"(\\s+|$)","g");if(arguments.length<2){var d=this.node();if(e=d.classList)return e.contains(a);var e=d.className;return c.lastIndex=0,c.test(e.baseVal!=null?e.baseVal:e)}return this.each(typeof b=="function"?h:b?f:g)}function bn(a){return{__data__:a}}function bo(a){return function(){return bh(this,a)}}function bp(a){return arguments.length||(a=d3.ascending),function(b,c){return a(b&&b.__data__,c&&c.__data__)}}function br(a){return h(a,bs),a}function bt(a,b,c){h(a,bx);var d={},e=d3.dispatch("start","end"),f=bA;return a.id=b,a.time=c,a.tween=function(b,c){return arguments.length<2?d[b]:(c==null?delete d[b]:d[b]=c,a)},a.ease=function(b){return arguments.length?(f=typeof b=="function"?b:d3.ease.apply(d3,arguments),a):f},a.each=function(b,c){return arguments.length<2?bB.call(a,b):(e.on(b,c),a)},d3.timer(function(g){return a.each(function(h,i,j){function p(a){if(o.active>b)return r();o.active=b;for(var f in d)(f=d[f].call(l,h,i))&&k.push(f);return e.start.call(l,h,i),q(a)||d3.timer(q,0,c),1}function q(a){if(o.active!==b)return r();var c=(a-m)/n,d=f(c),g=k.length;while(g>0)k[--g].call(l,d);if(c>=1)return r(),bz=b,e.end.call(l,h,i),bz=0,1}function r(){return--o.count||delete l.__transition__,1}var k=[],l=this,m=a[j][i].delay,n=a[j][i].duration,o=l.__transition__||(l.__transition__={active:0,count:0});++o.count,m<=g?p(g):d3.timer(p,m,c)}),1},0,c),a}function bv(a,b,c){return c!=""&&bu}function bw(a,b){function d(a,d,e){var f=b.call(this,a,d);return f==null?e!=""&&bu:e!=f&&c(e,f)}function e(a,d,e){return e!=b&&c(e,b)}var c=Q(a);return typeof b=="function"?d:b==null?bv:(b+="",e)}function bB(a){for(var b=0,c=this.length;b<c;b++)for(var d=this[b],e=0,f=d.length;e<f;e++){var g=d[e];g&&a.call(g=g.node,g.__data__,e,b)}return this}function bF(){var a,b=Date.now(),c=bC;while(c)a=b-c.then,a>=c.delay&&(c.flush=c.callback(a)),c=c.next;var d=bG()-b;d>24?(isFinite(d)&&(clearTimeout(bE),bE=setTimeout(bF,d)),bD=0):(bD=1,bH(bF))}function bG(){var a=null,b=bC,c=Infinity;while(b)b.flush?b=a?a.next=b.next:bC=b.next:(c=Math.min(c,b.then+b.delay),b=(a=b).next);return c}function bI(a){var b=[a.a,a.b],c=[a.c,a.d],d=bK(b),e=bJ(b,c),f=bK(bL(c,b,-e))||0;b[0]*c[1]<c[0]*b[1]&&(b[0]*=-1,b[1]*=-1,d*=-1,e*=-1),this.rotate=(d?Math.atan2(b[1],b[0]):Math.atan2(-c[0],c[1]))*bO,this.translate=[a.e,a.f],this.scale=[d,f],this.skew=f?Math.atan2(e,f)*bO:0}function bJ(a,b){return a[0]*b[0]+a[1]*b[1]}function bK(a){var b=Math.sqrt(bJ(a,a));return b&&(a[0]/=b,a[1]/=b),b}function bL(a,b,c){return a[0]+=c*b[0],a[1]+=c*b[1],a}function bP(){}function bQ(a){var b=a[0],c=a[a.length-1];return b<c?[b,c]:[c,b]}function bR(a){return a.rangeExtent?a.rangeExtent():bQ(a.range())}function bS(a,b){var c=0,d=a.length-1,e=a[c],f=a[d],g;f<e&&(g=c,c=d,d=g,g=e,e=f,f=g);if(g=f-e)b=b(g),a[c]=b.floor(e),a[d]=b.ceil(f);return a}function bT(){return Math}function bU(a,b,c,d){function g(){var g=a.length==2?b$:b_,i=d?S:R;return e=g(a,b,i,c),f=g(b,a,i,d3.interpolate),h}function h(a){return e(a)}var e,f;return h.invert=function(a){return f(a)},h.domain=function(b){return arguments.length?(a=b.map(Number),g()):a},h.range=function(a){return arguments.length?(b=a,g()):b},h.rangeRound=function(a){return h.range(a).interpolate(d3.interpolateRound)},h.clamp=function(a){return arguments.length?(d=a,g()):d},h.interpolate=function(a){return arguments.length?(c=a,g()):c},h.ticks=function(b){return bY(a,b)},h.tickFormat=function(b){return bZ(a,b)},h.nice=function(){return bS(a,bW),g()},h.copy=function(){return bU(a,b,c,d)},g()}function bV(a,b){return d3.rebind(a,b,"range","rangeRound","interpolate","clamp")}function bW(a){return a=Math.pow(10,Math.round(Math.log(a)/Math.LN10)-1),{floor:function(b){return Math.floor(b/a)*a},ceil:function(b){return Math.ceil(b/a)*a}}}function bX(a,b){var c=bQ(a),d=c[1]-c[0],e=Math.pow(10,Math.floor(Math.log(d/b)/Math.LN10)),f=b/d*e;return f<=.15?e*=10:f<=.35?e*=5:f<=.75&&(e*=2),c[0]=Math.ceil(c[0]/e)*e,c[1]=Math.floor(c[1]/e)*e+e*.5,c[2]=e,c}function bY(a,b){return d3.range.apply(d3,bX(a,b))}function bZ(a,b){return d3.format(",."+Math.max(0,-Math.floor(Math.log(bX(a,b)[2])/Math.LN10+.01))+"f")}function b$(a,b,c,d){var e=c(a[0],a[1]),f=d(b[0],b[1]);return function(a){return f(e(a))}}function b_(a,b,c,d){var e=[],f=[],g=0,h=a.length;while(++g<h)e.push(c(a[g-1],a[g])),f.push(d(b[g-1],b[g]));return function(b){var c=d3.bisect(a,b,1,a.length-1)-1;return f[c](e[c](b))}}function ca(a,b){function d(c){return a(b(c))}var c=b.pow;return d.invert=function(b){return c(a.invert(b))},d.domain=function(e){return arguments.length?(b=e[0]<0?cd:cc,c=b.pow,a.domain(e.map(b)),d):a.domain().map(c)},d.nice=function(){return a.domain(bS(a.domain(),bT)),d},d.ticks=function(){var d=bQ(a.domain()),e=[];if(d.every(isFinite)){var f=Math.floor(d[0]),g=Math.ceil(d[1]),h=c(d[0]),i=c(d[1]);if(b===cd){e.push(c(f));for(;f++<g;)for(var j=9;j>0;j--)e.push(c(f)*j)}else{for(;f<g;f++)for(var j=1;j<10;j++)e.push(c(f)*j);e.push(c(f))}for(f=0;e[f]<h;f++);for(g=e.length;e[g-1]>i;g--);e=e.slice(f,g)}return e},d.tickFormat=function(a,e){arguments.length<2&&(e=cb);if(arguments.length<1)return e;var f=a/d.ticks().length,g=b===cd?(h=-1e-12,Math.floor):(h=1e-12,Math.ceil),h;return function(a){return a/c(g(b(a)+h))<f?e(a):""}},d.copy=function(){return ca(a.copy(),b)},bV(d,a)}function cc(a){return Math.log(a)/Math.LN10}function cd(a){return-Math.log(-a)/Math.LN10}function ce(a,b){function e(b){return a(c(b))}var c=cf(b),d=cf(1/b);return e.invert=function(b){return d(a.invert(b))},e.domain=function(b){return arguments.length?(a.domain(b.map(c)),e):a.domain().map(d)},e.ticks=function(a){return bY(e.domain(),a)},e.tickFormat=function(a){return bZ(e.domain(),a)},e.nice=function(){return e.domain(bS(e.domain(),bW))},e.exponent=function(a){if(!arguments.length)return b;var f=e.domain();return c=cf(b=a),d=cf(1/b),e.domain(f)},e.copy=function(){return ce(a.copy(),b)},bV(e,a)}function cf(a){return function(b){return b<0?-Math.pow(-b,a):Math.pow(b,a)}}function cg(a,b){function f(b){return d[((c[b]||(c[b]=a.push(b)))-1)%d.length]}function g(b,c){return d3.range(a.length).map(function(a){return b+c*a})}var c,d,e;return f.domain=function(d){if(!arguments.length)return a;a=[],c={};var e=-1,g=d.length,h;while(++e<g)c[h=d[e]]||(c[h]=a.push(h));return f[b.t](b.x,b.p)},f.range=function(a){return arguments.length?(d=a,e=0,b={t:"range",x:a},f):d},f.rangePoints=function(c,h){arguments.length<2&&(h=0);var i=c[0],j=c[1],k=(j-i)/(a.length-1+h);return d=g(a.length<2?(i+j)/2:i+k*h/2,k),e=0,b={t:"rangePoints",x:c,p:h},f},f.rangeBands=function(c,h){arguments.length<2&&(h=0);var i=c[0],j=c[1],k=(j-i)/(a.length+h);return d=g(i+k*h,k),e=k*(1-h),b={t:"rangeBands",x:c,p:h},f},f.rangeRoundBands=function(c,h){arguments.length<2&&(h=0);var i=c[0],j=c[1],k=Math.floor((j-i)/(a.length+h));return d=g(i+Math.round((j-i-(a.length-h)*k)/2),k),e=Math.round(k*(1-h)),b={t:"rangeRoundBands",x:c,p:h},f},f.rangeBand=function(){return e},f.rangeExtent=function(){return b.x},f.copy=function(){return cg(a,b)},f.domain(a)}function cl(a,b){function d(){var d=0,f=a.length,g=b.length;c=[];while(++d<g)c[d-1]=d3.quantile(a,d/g);return e}function e(a){return isNaN(a=+a)?NaN:b[d3.bisect(c,a)]}var c;return e.domain=function(b){return arguments.length?(a=b.filter(function(a){return!isNaN(a)}).sort(d3.ascending),d()):a},e.range=function(a){return arguments.length?(b=a,d()):b},e.quantiles=function(){return c},e.copy=function(){return cl(a,b)},d()}function cm(a,b,c){function f(b){return c[Math.max(0,Math.min(e,Math.floor(d*(b-a))))]}function g(){return d=c.length/(b-a),e=c.length-1,f}var d,e;return f.domain=function(c){return arguments.length?(a=+c[0],b=+c[c.length-1],g()):[a,b]},f.range=function(a){return arguments.length?(c=a,g()):c},f.copy=function(){return cm(a,b,c)},g()}function cp(a){return a.innerRadius}function cq(a){return a.outerRadius}function cr(a){return a.startAngle}function cs(a){return a.endAngle}function ct(a){function g(d){return d.length<1?null:"M"+e(a(cu(this,d,b,c)),f)}var b=cv,c=cw,d="linear",e=cx[d],f=.7;return g.x=function(a){return arguments.length?(b=a,g):b},g.y=function(a){return arguments.length?(c=a,g):c},g.interpolate=function(a){return arguments.length?(e=cx[d=a],g):d},g.tension=function(a){return arguments.length?(f=a,g):f},g}function cu(a,b,c,d){var e=[],f=-1,g=b.length,h=typeof c=="function",i=typeof d=="function",j;if(h&&i)while(++f<g)e.push([c.call(a,j=b[f],f),d.call(a,j,f)]);else if(h)while(++f<g)e.push([c.call(a,b[f],f),d]);else if(i)while(++f<g)e.push([c,d.call(a,b[f],f)]);else while(++f<g)e.push([c,d]);return e}function cv(a){return a[0]}function cw(a){return a[1]}function cy(a){var b=0,c=a.length,d=a[0],e=[d[0],",",d[1]];while(++b<c)e.push("L",(d=a[b])[0],",",d[1]);return e.join("")}function cz(a){var b=0,c=a.length,d=a[0],e=[d[0],",",d[1]];while(++b<c)e.push("V",(d=a[b])[1],"H",d[0]);return e.join("")}function cA(a){var b=0,c=a.length,d=a[0],e=[d[0],",",d[1]];while(++b<c)e.push("H",(d=a[b])[0],"V",d[1]);return e.join("")}function cB(a,b){return a.length<4?cy(a):a[1]+cE(a.slice(1,a.length-1),cF(a,b))}function cC(a,b){return a.length<3?cy(a):a[0]+cE((a.push(a[0]),a),cF([a[a.length-2]].concat(a,[a[1]]),b))}function cD(a,b,c){return a.length<3?cy(a):a[0]+cE(a,cF(a,b))}function cE(a,b){if(b.length<1||a.length!=b.length&&a.length!=b.length+2)return cy(a);var c=a.length!=b.length,d="",e=a[0],f=a[1],g=b[0],h=g,i=1;c&&(d+="Q"+(f[0]-g[0]*2/3)+","+(f[1]-g[1]*2/3)+","+f[0]+","+f[1],e=a[1],i=2);if(b.length>1){h=b[1],f=a[i],i++,d+="C"+(e[0]+g[0])+","+(e[1]+g[1])+","+(f[0]-h[0])+","+(f[1]-h[1])+","+f[0]+","+f[1];for(var j=2;j<b.length;j++,i++)f=a[i],h=b[j],d+="S"+(f[0]-h[0])+","+(f[1]-h[1])+","+f[0]+","+f[1]}if(c){var k=a[i];d+="Q"+(f[0]+h[0]*2/3)+","+(f[1]+h[1]*2/3)+","+k[0]+","+k[1]}return d}function cF(a,b){var c=[],d=(1-b)/2,e,f=a[0],g=a[1],h=1,i=a.length;while(++h<i)e=f,f=g,g=a[h],c.push([d*(g[0]-e[0]),d*(g[1]-e[1])]);return c}function cG(a){if(a.length<3)return cy(a);var b=1,c=a.length,d=a[0],e=d[0],f=d[1],g=[e,e,e,(d=a[1])[0]],h=[f,f,f,d[1]],i=[e,",",f];cO(i,g,h);while(++b<c)d=a[b],g.shift(),g.push(d[0]),h.shift(),h.push(d[1]),cO(i,g,h);b=-1;while(++b<2)g.shift(),g.push(d[0]),h.shift(),h.push(d[1]),cO(i,g,h);return i.join("")}function cH(a){if(a.length<4)return cy(a);var b=[],c=-1,d=a.length,e,f=[0],g=[0];while(++c<3)e=a[c],f.push(e[0]),g.push(e[1]);b.push(cK(cN,f)+","+cK(cN,g)),--c;while(++c<d)e=a[c],f.shift(),f.push(e[0]),g.shift(),g.push(e[1]),cO(b,f,g);return b.join("")}function cI(a){var b,c=-1,d=a.length,e=d+4,f,g=[],h=[];while(++c<4)f=a[c%d],g.push(f[0]),h.push(f[1]);b=[cK(cN,g),",",cK(cN,h)],--c;while(++c<e)f=a[c%d],g.shift(),g.push(f[0]),h.shift(),h.push(f[1]),cO(b,g,h);return b.join("")}function cJ(a,b){var c=a.length-1,d=a[0][0],e=a[0][1],f=a[c][0]-d,g=a[c][1]-e,h=-1,i,j;while(++h<=c)i=a[h],j=h/c,i[0]=b*i[0]+(1-b)*(d+j*f),i[1]=b*i[1]+(1-b)*(e+j*g);return cG(a)}function cK(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3]}function cO(a,b,c){a.push("C",cK(cL,b),",",cK(cL,c),",",cK(cM,b),",",cK(cM,c),",",cK(cN,b),",",cK(cN,c))}function cP(a,b){return(b[1]-a[1])/(b[0]-a[0])}function cQ(a){var b=0,c=a.length-1,d=[],e=a[0],f=a[1],g=d[0]=cP(e,f);while(++b<c)d[b]=g+(g=cP(e=f,f=a[b+1]));return d[b]=g,d}function cR(a){var b=[],c,d,e,f,g=cQ(a),h=-1,i=a.length-1;while(++h<i)c=cP(a[h],a[h+1]),Math.abs(c)<1e-6?g[h]=g[h+1]=0:(d=g[h]/c,e=g[h+1]/c,f=d*d+e*e,f>9&&(f=c*3/Math.sqrt(f),g[h]=f*d,g[h+1]=f*e));h=-1;while(++h<=i)f=(a[Math.min(i,h+1)][0]-a[Math.max(0,h-1)][0])/(6*(1+g[h]*g[h])),b.push([f||0,g[h]*f||0]);return b}function cS(a){return a.length<3?cy(a):a[0]+cE(a,cR(a))}function cT(a){var b,c=-1,d=a.length,e,f;while(++c<d)b=a[c],e=b[0],f=b[1]+cn,b[0]=e*Math.cos(f),b[1]=e*Math.sin(f);return a}function cU(a){function j(f){if(f.length<1)return null;var j=cu(this,f,b,d),k=cu(this,f,b===c?cV(j):c,d===e?cW(j):e);return"M"+g(a(k),i)+"L"+h(a(j.reverse()),i)+"Z"}var b=cv,c=cv,d=0,e=cw,f,g,h,i=.7;return j.x=function(a){return arguments.length?(b=c=a,j):c},j.x0=function(a){return arguments.length?(b=a,j):b},j.x1=function(a){return arguments.length?(c=a,j):c},j.y=function(a){return arguments.length?(d=e=a,j):e},j.y0=function(a){return arguments.length?(d=a,j):d},j.y1=function(a){return arguments.length?(e=a,j):e},j.interpolate=function(a){return arguments.length?(g=cx[f=a],h=g.reverse||g,j):f},j.tension=function(a){return arguments.length?(i=a,j):i},j.interpolate("linear")}function cV(a){return function(b,c){return a[c][0]}}function cW(a){return function(b,c){return a[c][1]}}function cX(a){return a.source}function cY(a){return a.target}function cZ(a){return a.radius}function c$(a){return a.startAngle}function c_(a){return a.endAngle}function da(a){return[a.x,a.y]}function db(a){return function(){var b=a.apply(this,arguments),c=b[0],d=b[1]+cn;return[c*Math.cos(d),c*Math.sin(d)]}}function dd(a,b){var c=(a.ownerSVGElement||a).createSVGPoint();if(dc<0&&(window.scrollX||window.scrollY)){var d=d3.select(document.body).append("svg").style("position","absolute").style("top",0).style("left",0),e=d[0][0].getScreenCTM();dc=!e.f&&!e.e,d.remove()}return dc?(c.x=b.pageX,c.y=b.pageY):(c.x=b.clientX,c.y=b.clientY),c=c.matrixTransform(a.getScreenCTM().inverse()),[c.x,c.y]}function de(){return 64}function df(){return"circle"}function dj(a,b){a.attr("transform",function(a){return"translate("+b(a)+",0)"})}function dk(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function dl(a,b,c){e=[];if(c&&b.length>1){var d=bQ(a.domain()),e,f=-1,g=b.length,h=(b[1]-b[0])/++c,i,j;while(++f<g)for(i=c;--i>0;)(j=+b[f]-i*h)>=d[0]&&e.push(j);for(--f,i=0;++i<c&&(j=+b[f]+i*h)<d[1];)e.push(j)}return e}function dx(a,b){a.select(".extent").attr("x",b[0][0]),a.selectAll(".n,.s,.w,.nw,.sw").attr("x",b[0][0]-2),a.selectAll(".e,.ne,.se").attr("x",b[1][0]-3),a.selectAll(".extent,.n,.s").attr("width",b[1][0]-b[0][0])}function dy(a,b){a.select(".extent").attr("y",b[0][1]),a.selectAll(".n,.e,.w,.nw,.ne").attr("y",b[0][1]-3),a.selectAll(".s,.se,.sw").attr("y",b[1][1]-4),a.selectAll(".extent,.e,.w").attr("height",b[1][1]-b[0][1])}function dz(){d3.event.keyCode==32&&dp&&!dt&&(dv=null,dw[0]-=ds[1][0],dw[1]-=ds[1][1],dt=2,O())}function dA(){d3.event.keyCode==32&&dt==2&&(dw[0]+=ds[1][0],dw[1]+=ds[1][1],dt=0,O())}function dB(){if(dw){var a=d3.svg.mouse(dp),b=d3.select(dp);dt||(d3.event.altKey?(dv||(dv=[(ds[0][0]+ds[1][0])/2,(ds[0][1]+ds[1][1])/2]),dw[0]=ds[+(a[0]<dv[0])][0],dw[1]=ds[+(a[1]<dv[1])][1]):dv=null),dq&&(dC(a,dq,0),dx(b,ds)),dr&&(dC(a,dr,1),dy(b,ds)),dn("brush")}}function dC(a,b,c){var d=bR(b),e=d[0],f=d[1],g=dw[c],h=ds[1][c]-ds[0][c],i,j;dt&&(e-=g,f-=h+g),i=Math.max(e,Math.min(f,a[c])),dt?j=(i+=g)+h:(dv&&(g=Math.max(e,Math.min(f,2*dv[c]-i))),g<i?(j=i,i=g):j=g),ds[0][c]=i,ds[1][c]=j}function dD(){dw&&(dB(),d3.select(dp).selectAll(".resize").style("pointer-events",dm.empty()?"none":"all"),dn("brushend"),dm=dn=dp=dq=dr=ds=dt=du=dv=dw=null,O())}function dM(a){var b=dN(),c=d3.event,d=d3.event={type:a};b&&(d.x=b[0]+dJ[0],d.y=b[1]+dJ[1],d.dx=b[0]-dK[0],d.dy=b[1]-dK[1],dL|=d.dx|d.dy,dK=b);try{dF[a].apply(dH,dI)}finally{d3.event=c}c.stopPropagation(),c.preventDefault()}function dN(){var a=dH.parentNode,b=d3.event.changedTouches;return a&&(b?d3.svg.touches(a,b)[0]:d3.svg.mouse(a))}function dO(){if(!dH)return;var a=dH.parentNode;if(!a)return dP();dM("drag"),O()}function dP(){if(!dH)return;dM("dragend"),dL&&(O(),dL=d3.event.target===dG),dF=dG=dH=dI=dJ=dK=null}function dQ(){dL&&(O(),dL=0)}function eb(a){return[a[0]-dW[0],a[1]-dW[1],dW[2]]}function ec(){dR||(dR=d3.select("body").append("div").style("visibility","hidden").style("top",0).style("height",0).style("width",0).style("overflow-y","scroll").append("div").style("height","2000px").node().parentNode);var a=d3.event,b;try{dR.scrollTop=1e3,dR.dispatchEvent(a),b=1e3-dR.scrollTop}catch(c){b=a.wheelDelta||-a.detail*5}return b*.005}function ed(){var a=d3.svg.touches(d$),b=-1,c=a.length,d;while(++b<c)dU[(d=a[b]).identifier]=eb(d);return a}function ee(){var a=d3.svg.touches(d$);switch(a.length){case 1:var b=a[0];ei(dW[2],b,dU[b.identifier]);break;case 2:var c=a[0],d=a[1],e=[(c[0]+d[0])/2,(c[1]+d[1])/2],f=dU[c.identifier],g=dU[d.identifier],h=[(f[0]+g[0])/2,(f[1]+g[1])/2,f[2]];ei(Math.log(d3.event.scale)/Math.LN2+f[2],e,h)}}function ef(){dT=null,dS&&(ea=1,ei(dW[2],d3.svg.mouse(d$),dS))}function eg(){dS&&(ea&&(O(),ea=dZ===d3.event.target),dW=dX=dY=dZ=d$=d_=dS=null)}function eh(){ea&&(O(),ea=0)}function ei(a,b,c){function l(a,b,c){a.domain(a.range().map(function(f){return a.invert((f-c)*d/e+b)}))}a=ek(a,2);var d=Math.pow(2,dW[2]),e=Math.pow(2,a),f=Math.pow(2,(dW[2]=a)-c[2]),g=dW[0],h=dW[1],i=dW[0]=ek(b[0]-c[0]*f,0,e),j=dW[1]=ek(b[1]-c[1]*f,1,e),k=d3.event;d3.event={scale:e,translate:[i,j],transform:function(a,b){a&&l(a,g,i),b&&l(b,h,j)}};try{dY.apply(d$,d_)}finally{d3.event=k}k.preventDefault()}function ek(a,b,c){var d=dX[b],e=d[0],f=d[1];return arguments.length===3?Math.max(f*(f===Infinity?-Infinity:1/c-1),Math.min(e===-Infinity?Infinity:e,a/c))*c:Math.max(e,Math.min(f,a))}Date.now||(Date.now=function(){return+(new Date)});try{document.createElement("div").style.setProperty("opacity",0,"")}catch(a){var b=CSSStyleDeclaration.prototype,c=b.setProperty;b.setProperty=function(a,b,d){c.call(this,a,b+"",d)}}d3={version:"2.7.0"};var d=f;try{d(document.documentElement.childNodes)[0].nodeType}catch(g){d=e}var h=[].__proto__?function(a,b){a.__proto__=b}:function(a,b){for(var c in b)a[c]=b[c]};d3.functor=function(a){return typeof a=="function"?a:function(){return a}},d3.rebind=function(a,b){var c=1,d=arguments.length,e;while(++c<d)a[e=arguments[c]]=j(a,b,b[e]);return a},d3.ascending=function(a,b){return a<b?-1:a>b?1:a>=b?0:NaN},d3.descending=function(a,b){return b<a?-1:b>a?1:b>=a?0:NaN},d3.mean=function(a,b){var c=a.length,d,e=0,f=-1,g=0;if(arguments.length===1)while(++f<c)k(d=a[f])&&(e+=(d-e)/++g);else while(++f<c)k(d=b.call(a,a[f],f))&&(e+=(d-e)/++g);return g?e:undefined},d3.median=function(a,b){return arguments.length>1&&(a=a.map(b)),a=a.filter(k),a.length?d3.quantile(a.sort(d3.ascending),.5):undefined},d3.min=function(a,b){var c=-1,d=a.length,e,f;if(arguments.length===1){while(++c<d&&((e=a[c])==null||e!=e))e=undefined;while(++c<d)(f=a[c])!=null&&e>f&&(e=f)}else{while(++c<d&&((e=b.call(a,a[c],c))==null||e!=e))e=undefined;while(++c<d)(f=b.call(a,a[c],c))!=null&&e>f&&(e=f)}return e},d3.max=function(a,b){var c=-1,d=a.length,e,f;if(arguments.length===1){while(++c<d&&((e=a[c])==null||e!=e))e=undefined;while(++c<d)(f=a[c])!=null&&f>e&&(e=f)}else{while(++c<d&&((e=b.call(a,a[c],c))==null||e!=e))e=undefined;while(++c<d)(f=b.call(a,a[c],c))!=null&&f>e&&(e=f)}return e},d3.extent=function(a,b){var c=-1,d=a.length,e,f,g;if(arguments.length===1){while(++c<d&&((e=g=a[c])==null||e!=e))e=g=undefined;while(++c<d)(f=a[c])!=null&&(e>f&&(e=f),g<f&&(g=f))}else{while(++c<d&&((e=g=b.call(a,a[c],c))==null||e!=e))e=undefined;while(++c<d)(f=b.call(a,a[c],c))!=null&&(e>f&&(e=f),g<f&&(g=f))}return[e,g]},d3.random={normal:function(a,b){return arguments.length<2&&(b=1),arguments.length<1&&(a=0),function(){var c,d,e;do c=Math.random()*2-1,d=Math.random()*2-1,e=c*c+d*d;while(!e||e>1);return a+b*c*Math.sqrt(-2*Math.log(e)/e)}}},d3.sum=function(a,b){var c=0,d=a.length,e,f=-1;if(arguments.length===1)while(++f<d)isNaN(e=+a[f])||(c+=e);else while(++f<d)isNaN(e=+b.call(a,a[f],f))||(c+=e);return c},d3.quantile=function(a,b){var c=(a.length-1)*b+1,d=Math.floor(c),e=a[d-1],f=c-d;return f?e+f*(a[d]-e):e},d3.transpose=function(a){return d3.zip.apply(d3,a)},d3.zip=function(){if(!(e=arguments.length))return[];for(var a=-1,b=d3.min(arguments,l),c=new Array(b);++a<b;)for(var d=-1,e,f=c[a]=new Array(e);++d<e;)f[d]=arguments[d][a];return c},d3.bisectLeft=function(a,b,c,d){arguments.length<3&&(c=0),arguments.length<4&&(d=a.length);while(c<d){var e=c+d>>1;a[e]<b?c=e+1:d=e}return c},d3.bisect=d3.bisectRight=function(a,b,c,d){arguments.length<3&&(c=0),arguments.length<4&&(d=a.length);while(c<d){var e=c+d>>1;b<a[e]?d=e:c=e+1}return c},d3.first=function(a,b){var c=0,d=a.length,e=a[0],f;arguments.length===1&&(b=d3.ascending);while(++c<d)b.call(a,e,f=a[c])>0&&(e=f);return e},d3.last=function(a,b){var c=0,d=a.length,e=a[0],f;arguments.length===1&&(b=d3.ascending);while(++c<d)b.call(a,e,f=a[c])<=0&&(e=f);return e},d3.nest=function(){function f(c,g){if(g>=b.length)return e?e.call(a,c):d?c.sort(d):c;var h=-1,i=c.length,j=b[g++],k,l,m={};while(++h<i)(k=j(l=c[h]))in m?m[k].push(l):m[k]=[l];for(k in m)m[k]=f(m[k],g);return m}function g(a,d){if(d>=b.length)return a;var e=[],f=c[d++],h;for(h in a)e.push({key:h,values:g(a[h],d)});return f&&e.sort(function(a,b){return f(a.key,b.key)}),e}var a={},b=[],c=[],d,e;return a.map=function(a){return f(a,0)},a.entries=function(a){return g(f(a,0),0)},a.key=function(c){return b.push(c),a},a.sortKeys=function(d){return c[b.length-1]=d,a},a.sortValues=function(b){return d=b,a},a.rollup=function(b){return e=b,a},a},d3.keys=function(a){var b=[];for(var c in a)b.push(c);return b},d3.values=function(a){var b=[];for(var c in a)b.push(a[c]);return b},d3.entries=function(a){var b=[];for(var c in a)b.push({key:c,value:a[c]});return b},d3.permute=function(a,b){var c=[],d=-1,e=b.length;while(++d<e)c[d]=a[b[d]];return c},d3.merge=function(a){return Array.prototype.concat.apply([],a)},d3.split=function(a,b){var c=[],d=[],e,f=-1,g=a.length;arguments.length<2&&(b=m);while(++f<g)b.call(d,e=a[f],f)?d=[]:(d.length||c.push(d),d.push(e));return c},d3.range=function(a,b,c){arguments.length<3&&(c=1,arguments.length<2&&(b=a,a=0));if((b-a)/c==Infinity)throw new Error("infinite range");var d=[],e=-1,f;if(c<0)while((f=a+c*++e)>b)d.push(f);else while((f=a+c*++e)<b)d.push(f);return d},d3.requote=function(a){return a.replace(o,"\\$&")};var o=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;d3.round=function(a,b){return b?Math.round(a*Math.pow(10,b))*Math.pow(10,-b):Math.round(a)},d3.xhr=function(a,b,c){var d=new XMLHttpRequest;arguments.length<3?c=b:b&&d.overrideMimeType&&d.overrideMimeType(b),d.open("GET",a,!0),d.onreadystatechange=function(){d.readyState===4&&c(d.status<300?d:null)},d.send(null)},d3.text=function(a,b,c){function d(a){c(a&&a.responseText)}arguments.length<3&&(c=b,b=null),d3.xhr(a,b,d)},d3.json=function(a,b){d3.text(a,"application/json",function(a){b(a?JSON.parse(a):null)})},d3.html=function(a,b){d3.text(a,"text/html",function(a){if(a!=null){var c=document.createRange();c.selectNode(document.body),a=c.createContextualFragment(a)}b(a)})},d3.xml=function(a,b,c){function d(a){c(a&&a.responseXML)}arguments.length<3&&(c=b,b=null),d3.xhr(a,b,d)};var p={svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};d3.ns={prefix:p,qualify:function(a){var b=a.indexOf(":");return b<0?a in p?{space:p[a],local:a}:a:{space:p[a.substring(0,b)],local:a.substring(b+1)}}},d3.dispatch=function(){var a=new q,b=-1,c=arguments.length;while(++b<c)a[arguments[b]]=r();return a},q.prototype.on=function(a,b){var c=a.indexOf("."),d="";return c>0&&(d=a.substring(c+1),a=a.substring(0,c)),arguments.length<2?this[a].on(d):(this[a].on(d,b),this)},d3.format=function(a){var b=s.exec(a),c=b[1]||" ",d=b[3]||"",e=b[5],f=+b[6],g=b[7],h=b[8],i=b[9],j=1,k="",l=!1;h&&(h=+h.substring(1)),e&&(c="0",g&&(f-=Math.floor((f-1)/4)));switch(i){case"n":g=!0,i="g";break;case"%":j=100,k="%",i="f";break;case"p":j=100,k="%",i="r";break;case"d":l=!0,h=0;break;case"s":j=-1,i="r"}return i=="r"&&!h&&(i="g"),i=t[i]||v,function(a){if(l&&a%1)return"";var b=a<0&&(a=-a)?"−":d;if(j<0){var m=d3.formatPrefix(a,h);a*=m.scale,k=m.symbol}else a*=j;a=i(a,h);if(e){var n=a.length+b.length;n<f&&(a=(new Array(f-n+1)).join(c)+a),g&&(a=w(a)),a=b+a}else{g&&(a=w(a)),a=b+a;var n=a.length;n<f&&(a=(new Array(f-n+1)).join(c)+a)}return a+k}};var s=/(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/,t={g:function(a,b){return a.toPrecision(b)},e:function(a,b){return a.toExponential(b)},f:function(a,b){return a.toFixed(b)},r:function(a,b){return d3.round(a,b=u(a,b)).toFixed(Math.max(0,Math.min(20,b)))}},x=["y","z","a","f","p","n","μ","m","","k","M","G","T","P","E","Z","Y"].map(y);d3.formatPrefix=function(a,b){var c=0;return a&&(a<0&&(a*=-1),b&&(a=d3.round(a,u(a,b))),c=1+Math.floor(1e-12+Math.log(a)/Math.LN10),c=Math.max(-24,Math.min(24,Math.floor((c<=0?c+1:c-1)/3)*3))),x[8+c/3]};var z=H(2),A=H(3),B={linear:function(){return G},poly:H,quad:function(){return z},cubic:function(){return A},sin:function(){return I},exp:function(){return J},circle:function(){return K},elastic:L,back:M,bounce:function(){return N}},C={"in":function(a){return a},out:E,"in-out":F,"out-in":function(a){return F(E(a))}};d3.ease=function(a){var b=a.indexOf("-"),c=b>=0?a.substring(0,b):a,d=b>=0?a.substring(b+1):"in";return D(C[d](B[c].apply(null,Array.prototype.slice.call(arguments,1))))},d3.event=null,d3.interpolate=function(a,b){var c=d3.interpolators.length,d;while(--c>=0&&!(d=d3.interpolators[c](a,b)));return d},d3.interpolateNumber=function(a,b){return b-=a,function(c){return a+b*c}},d3.interpolateRound=function(a,b){return b-=a,function(c){return Math.round(a+b*c)}},d3.interpolateString=function(a,b){var c,d,e,f=0,g=0,h=[],i=[],j,k;P.lastIndex=0;for(d=0;c=P.exec(b);++d)c.index&&h.push(b.substring(f,g=c.index)),i.push({i:h.length,x:c[0]}),h.push(null),f=P.lastIndex;f<b.length&&h.push(b.substring(f));for(d=0,j=i.length;(c=P.exec(a))&&d<j;++d){k=i[d];if(k.x==c[0]){if(k.i)if(h[k.i+1]==null){h[k.i-1]+=k.x,h.splice(k.i,1);for(e=d+1;e<j;++e)i[e].i--}else{h[k.i-1]+=k.x+h[k.i+1],h.splice(k.i,2);for(e=d+1;e<j;++e)i[e].i-=2}else if(h[k.i+1]==null)h[k.i]=k.x;else{h[k.i]=k.x+h[k.i+1],h.splice(k.i+1,1);for(e=d+1;e<j;++e)i[e].i--}i.splice(d,1),j--,d--}else k.x=d3.interpolateNumber(parseFloat(c[0]),parseFloat(k.x))}while(d<j)k=i.pop(),h[k.i+1]==null?h[k.i]=k.x:(h[k.i]=k.x+h[k.i+1],h.splice(k.i+1,1)),j--;return h.length===1?h[0]==null?i[0].x:function(){return b}:function(a){for(d=0;d<j;++d)h[(k=i[d]).i]=k.x(a);return h.join("")}},d3.interpolateTransform=function(a,b){return d3.interpolateString(d3.transform(a)+"",d3.transform(b)+"")},d3.interpolateRgb=function(a,b){a=d3.rgb(a),b=d3.rgb(b);var c=a.r,d=a.g,e=a.b,f=b.r-c,g=b.g-d,h=b.b-e;return function(a){return"#"+V(Math.round(c+f*a))+V(Math.round(d+g*a))+V(Math.round(e+h*a))}},d3.interpolateHsl=function(a,b){a=d3.hsl(a),b=d3.hsl(b);var c=a.h,d=a.s,e=a.l,f=b.h-c,g=b.s-d,h=b.l-e;return function(a){return bb(c+f*a,d+g*a,e+h*a).toString()}},d3.interpolateArray=function(a,b){var c=[],d=[],e=a.length,f=b.length,g=Math.min(a.length,b.length),h;for(h=0;h<g;++h)c.push(d3.interpolate(a[h],b[h]));for(;h<e;++h)d[h]=a[h];for(;h<f;++h)d[h]=b[h];return function(a){for(h=0;h<g;++h)d[h]=c[h](a);return d}},d3.interpolateObject=function(a,b){var c={},d={},e;for(e in a)e in b?c[e]=Q(e)(a[e],b[e]):d[e]=a[e];for(e in b)e in a||(d[e]=b[e]);return function(a){for(e in c)d[e]=c[e](a);return d}};var P=/[-+]?(?:\d*\.?\d+)(?:[eE][-+]?\d+)?/g;d3.interpolators=[d3.interpolateObject,function(a,b){return b instanceof Array&&d3.interpolateArray(a,b)},function(a,b){return(typeof a=="string"||typeof b=="string")&&d3.interpolateString(a+"",b+"")},function(a,b){return(typeof b=="string"?b in Z||/^(#|rgb\(|hsl\()/.test(b):b instanceof U||b instanceof ba)&&d3.interpolateRgb(a,b)},function(a,b){return!isNaN(a=+a)&&!isNaN(b=+b)&&d3.interpolateNumber(a,b)}],d3.rgb=function(a,b,c){return arguments.length===1?a instanceof U?T(a.r,a.g,a.b):W(""+a,T,bb):T(~~a,~~b,~~c)},U.prototype.brighter=function(a){a=Math.pow(.7,arguments.length?a:1);var b=this.r,c=this.g,d=this.b,e=30;return!b&&!c&&!d?T(e,e,e):(b&&b<e&&(b=e),c&&c<e&&(c=e),d&&d<e&&(d=e),T(Math.min(255,Math.floor(b/a)),Math.min(255,Math.floor(c/a)),Math.min(255,Math.floor(d/a))))},U.prototype.darker=function(a){return a=Math.pow(.7,arguments.length?a:1),T(Math.floor(a*this.r),Math.floor(a*this.g),Math.floor(a*this.b))},U.prototype.hsl=function(){return X(this.r,this.g,this.b)},U.prototype.toString=function(){return"#"+V(this.r)+V(this.g)+V(this.b)};var Z={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f"
<del>,darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};for(var $ in Z)Z[$]=W(Z[$],T,bb);d3.hsl=function(a,b,c){return arguments.length===1?a instanceof ba?_(a.h,a.s,a.l):W(""+a,X,_):_(+a,+b,+c)},ba.prototype.brighter=function(a){return a=Math.pow(.7,arguments.length?a:1),_(this.h,this.s,this.l/a)},ba.prototype.darker=function(a){return a=Math.pow(.7,arguments.length?a:1),_(this.h,this.s,a*this.l)},ba.prototype.rgb=function(){return bb(this.h,this.s,this.l)},ba.prototype.toString=function(){return this.rgb().toString()};var bd=function(a,b){return b.querySelector(a)},be=function(a,b){return b.querySelectorAll(a)},bf=document.documentElement,bg=bf.matchesSelector||bf.webkitMatchesSelector||bf.mozMatchesSelector||bf.msMatchesSelector||bf.oMatchesSelector,bh=function(a,b){return bg.call(a,b)};typeof Sizzle=="function"&&(bd=function(a,b){return Sizzle(a,b)[0]},be=function(a,b){return Sizzle.uniqueSort(Sizzle(a,b))},bh=Sizzle.matchesSelector);var bi=[];d3.selection=function(){return bq},d3.selection.prototype=bi,bi.select=function(a){var b=[],c,d,e,f;typeof a!="function"&&(a=bj(a));for(var g=-1,h=this.length;++g<h;){b.push(c=[]),c.parentNode=(e=this[g]).parentNode;for(var i=-1,j=e.length;++i<j;)(f=e[i])?(c.push(d=a.call(f,f.__data__,i)),d&&"__data__"in f&&(d.__data__=f.__data__)):c.push(null)}return bc(b)},bi.selectAll=function(a){var b=[],c,e;typeof a!="function"&&(a=bk(a));for(var f=-1,g=this.length;++f<g;)for(var h=this[f],i=-1,j=h.length;++i<j;)if(e=h[i])b.push(c=d(a.call(e,e.__data__,i))),c.parentNode=e;return bc(b)},bi.attr=function(a,b){function d(){this.removeAttribute(a)}function e(){this.removeAttributeNS(a.space,a.local)}function f(){this.setAttribute(a,b)}function g(){this.setAttributeNS(a.space,a.local,b)}function h(){var c=b.apply(this,arguments);c==null?this.removeAttribute(a):this.setAttribute(a,c)}function i(){var c=b.apply(this,arguments);c==null?this.removeAttributeNS(a.space,a.local):this.setAttributeNS(a.space,a.local,c)}a=d3.ns.qualify(a);if(arguments.length<2){var c=this.node();return a.local?c.getAttributeNS(a.space,a.local):c.getAttribute(a)}return this.each(b==null?a.local?e:d:typeof b=="function"?a.local?i:h:a.local?g:f)},bi.classed=function(a,b){var c=a.split(bl),d=c.length,e=-1;if(arguments.length>1){while(++e<d)bm.call(this,c[e],b);return this}while(++e<d)if(!bm.call(this,c[e]))return!1;return!0};var bl=/\s+/g;bi.style=function(a,b,c){function d(){this.style.removeProperty(a)}function e(){this.style.setProperty(a,b,c)}function f(){var d=b.apply(this,arguments);d==null?this.style.removeProperty(a):this.style.setProperty(a,d,c)}return arguments.length<3&&(c=""),arguments.length<2?window.getComputedStyle(this.node(),null).getPropertyValue(a):this.each(b==null?d:typeof b=="function"?f:e)},bi.property=function(a,b){function c(){delete this[a]}function d(){this[a]=b}function e(){var c=b.apply(this,arguments);c==null?delete this[a]:this[a]=c}return arguments.length<2?this.node()[a]:this.each(b==null?c:typeof b=="function"?e:d)},bi.text=function(a){return arguments.length<1?this.node().textContent:this.each(typeof a=="function"?function(){this.textContent=a.apply(this,arguments)}:function(){this.textContent=a})},bi.html=function(a){return arguments.length<1?this.node().innerHTML:this.each(typeof a=="function"?function(){this.innerHTML=a.apply(this,arguments)}:function(){this.innerHTML=a})},bi.append=function(a){function b(){return this.appendChild(document.createElementNS(this.namespaceURI,a))}function c(){return this.appendChild(document.createElementNS(a.space,a.local))}return a=d3.ns.qualify(a),this.select(a.local?c:b)},bi.insert=function(a,b){function c(){return this.insertBefore(document.createElementNS(this.namespaceURI,a),bd(b,this))}function d(){return this.insertBefore(document.createElementNS(a.space,a.local),bd(b,this))}return a=d3.ns.qualify(a),this.select(a.local?d:c)},bi.remove=function(){return this.each(function(){var a=this.parentNode;a&&a.removeChild(this)})},bi.data=function(a,b){function f(a,f){var g,h=a.length,i=f.length,j=Math.min(h,i),k=Math.max(h,i),l=[],m=[],n=[],o,p;if(b){var q={},r=[],s,t=f.length;for(g=-1;++g<h;)s=b.call(o=a[g],o.__data__,g),s in q?n[t++]=o:q[s]=o,r.push(s);for(g=-1;++g<i;)o=q[s=b.call(f,p=f[g],g)],o?(o.__data__=p,l[g]=o,m[g]=n[g]=null):(m[g]=bn(p),l[g]=n[g]=null),delete q[s];for(g=-1;++g<h;)r[g]in q&&(n[g]=a[g])}else{for(g=-1;++g<j;)o=a[g],p=f[g],o?(o.__data__=p,l[g]=o,m[g]=n[g]=null):(m[g]=bn(p),l[g]=n[g]=null);for(;g<i;++g)m[g]=bn(f[g]),l[g]=n[g]=null;for(;g<k;++g)n[g]=a[g],m[g]=l[g]=null}m.update=l,m.parentNode=l.parentNode=n.parentNode=a.parentNode,c.push(m),d.push(l),e.push(n)}var c=[],d=[],e=[],g=-1,h=this.length,i;if(typeof a=="function")while(++g<h)f(i=this[g],a.call(i,i.parentNode.__data__,g));else while(++g<h)f(i=this[g],a);var j=bc(d);return j.enter=function(){return br(c)},j.exit=function(){return bc(e)},j},bi.filter=function(a){var b=[],c,d,e;typeof a!="function"&&(a=bo(a));for(var f=0,g=this.length;f<g;f++){b.push(c=[]),c.parentNode=(d=this[f]).parentNode;for(var h=0,i=d.length;h<i;h++)(e=d[h])&&a.call(e,e.__data__,h)&&c.push(e)}return bc(b)},bi.map=function(a){return this.each(function(){this.__data__=a.apply(this,arguments)})},bi.order=function(){for(var a=-1,b=this.length;++a<b;)for(var c=this[a],d=c.length-1,e=c[d],f;--d>=0;)if(f=c[d])e&&e.parentNode.insertBefore(f,e),e=f;return this},bi.sort=function(a){a=bp.apply(this,arguments);for(var b=-1,c=this.length;++b<c;)this[b].sort(a);return this.order()},bi.on=function(a,b,c){arguments.length<3&&(c=!1);var d="__on"+a,e=a.indexOf(".");return e>0&&(a=a.substring(0,e)),arguments.length<2?(e=this.node()[d])&&e._:this.each(function(e,f){function h(a){var c=d3.event;d3.event=a;try{b.call(g,g.__data__,f)}finally{d3.event=c}}var g=this;g[d]&&g.removeEventListener(a,g[d],c),b&&g.addEventListener(a,g[d]=h,c),h._=b})},bi.each=function(a){for(var b=-1,c=this.length;++b<c;)for(var d=this[b],e=-1,f=d.length;++e<f;){var g=d[e];g&&a.call(g,g.__data__,e,b)}return this},bi.call=function(a){return a.apply(this,(arguments[0]=this,arguments)),this},bi.empty=function(){return!this.node()},bi.node=function(a){for(var b=0,c=this.length;b<c;b++)for(var d=this[b],e=0,f=d.length;e<f;e++){var g=d[e];if(g)return g}return null},bi.transition=function(){var a=[],b,c;for(var d=-1,e=this.length;++d<e;){a.push(b=[]);for(var f=this[d],g=-1,h=f.length;++g<h;)b.push((c=f[g])?{node:c,delay:0,duration:250}:null)}return bt(a,bz||++by,Date.now())};var bq=bc([[document]]);bq[0].parentNode=bf,d3.select=function(a){return typeof a=="string"?bq.select(a):bc([[a]])},d3.selectAll=function(a){return typeof a=="string"?bq.selectAll(a):bc([d(a)])};var bs=[];bs.append=bi.append,bs.insert=bi.insert,bs.empty=bi.empty,bs.node=bi.node,bs.select=function(a){var b=[],c,d,e,f,g;for(var h=-1,i=this.length;++h<i;){e=(f=this[h]).update,b.push(c=[]),c.parentNode=f.parentNode;for(var j=-1,k=f.length;++j<k;)(g=f[j])?(c.push(e[j]=d=a.call(f.parentNode,g.__data__,j)),d.__data__=g.__data__):c.push(null)}return bc(b)};var bu={},bx=[],by=0,bz=0,bA=d3.ease("cubic-in-out");bx.call=bi.call,d3.transition=function(){return bq.transition()},d3.transition.prototype=bx,bx.select=function(a){var b=[],c,d,e;typeof a!="function"&&(a=bj(a));for(var f=-1,g=this.length;++f<g;){b.push(c=[]);for(var h=this[f],i=-1,j=h.length;++i<j;)(e=h[i])&&(d=a.call(e.node,e.node.__data__,i))?("__data__"in e.node&&(d.__data__=e.node.__data__),c.push({node:d,delay:e.delay,duration:e.duration})):c.push(null)}return bt(b,this.id,this.time).ease(this.ease())},bx.selectAll=function(a){var b=[],c,d,e;typeof a!="function"&&(a=bk(a));for(var f=-1,g=this.length;++f<g;)for(var h=this[f],i=-1,j=h.length;++i<j;)if(e=h[i]){d=a.call(e.node,e.node.__data__,i),b.push(c=[]);for(var k=-1,l=d.length;++k<l;)c.push({node:d[k],delay:e.delay,duration:e.duration})}return bt(b,this.id,this.time).ease(this.ease())},bx.attr=function(a,b){return this.attrTween(a,bw(a,b))},bx.attrTween=function(a,b){function d(a,d){var e=b.call(this,a,d,this.getAttribute(c));return e===bu?(this.removeAttribute(c),null):e&&function(a){this.setAttribute(c,e(a))}}function e(a,d){var e=b.call(this,a,d,this.getAttributeNS(c.space,c.local));return e===bu?(this.removeAttributeNS(c.space,c.local),null):e&&function(a){this.setAttributeNS(c.space,c.local,e(a))}}var c=d3.ns.qualify(a);return this.tween("attr."+a,c.local?e:d)},bx.style=function(a,b,c){return arguments.length<3&&(c=""),this.styleTween(a,bw(a,b),c)},bx.styleTween=function(a,b,c){return arguments.length<3&&(c=""),this.tween("style."+a,function(d,e){var f=b.call(this,d,e,window.getComputedStyle(this,null).getPropertyValue(a));return f===bu?(this.style.removeProperty(a),null):f&&function(b){this.style.setProperty(a,f(b),c)}})},bx.text=function(a){return this.tween("text",function(b,c){this.textContent=typeof a=="function"?a.call(this,b,c):a})},bx.remove=function(){return this.each("end",function(){var a;!this.__transition__&&(a=this.parentNode)&&a.removeChild(this)})},bx.delay=function(a){var b=this;return b.each(typeof a=="function"?function(c,d,e){b[e][d].delay=+a.apply(this,arguments)}:(a=+a,function(c,d,e){b[e][d].delay=a}))},bx.duration=function(a){var b=this;return b.each(typeof a=="function"?function(c,d,e){b[e][d].duration=+a.apply(this,arguments)}:(a=+a,function(c,d,e){b[e][d].duration=a}))},bx.transition=function(){return this.select(i)};var bC=null,bD,bE;d3.timer=function(a,b,c){var d=!1,e,f=bC;if(arguments.length<3){if(arguments.length<2)b=0;else if(!isFinite(b))return;c=Date.now()}while(f){if(f.callback===a){f.then=c,f.delay=b,d=!0;break}e=f,f=f.next}d||(bC={callback:a,then:c,delay:b,next:bC}),bD||(bE=clearTimeout(bE),bD=1,bH(bF))},d3.timer.flush=function(){var a,b=Date.now(),c=bC;while(c)a=b-c.then,c.delay||(c.flush=c.callback(a)),c=c.next;bG()};var bH=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){setTimeout(a,17)};d3.transform=function(a){bM.setAttribute("transform",a);var b=bM.transform.baseVal.consolidate();return new bI(b?b.matrix:bN)},bI.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var bM=document.createElementNS(d3.ns.prefix.svg,"g"),bN={a:1,b:0,c:0,d:1,e:0,f:0},bO=180/Math.PI;d3.scale={},d3.scale.linear=function(){return bU([0,1],[0,1],d3.interpolate,!1)},d3.scale.log=function(){return ca(d3.scale.linear(),cc)};var cb=d3.format(".0e");cc.pow=function(a){return Math.pow(10,a)},cd.pow=function(a){return-Math.pow(10,-a)},d3.scale.pow=function(){return ce(d3.scale.linear(),1)},d3.scale.sqrt=function(){return d3.scale.pow().exponent(.5)},d3.scale.ordinal=function(){return cg([],{t:"range",x:[]})},d3.scale.category10=function(){return d3.scale.ordinal().range(ch)},d3.scale.category20=function(){return d3.scale.ordinal().range(ci)},d3.scale.category20b=function(){return d3.scale.ordinal().range(cj)},d3.scale.category20c=function(){return d3.scale.ordinal().range(ck)};var ch=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ci=["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"],cj=["#393b79","#5254a3","#6b6ecf","#9c9ede","#637939","#8ca252","#b5cf6b","#cedb9c","#8c6d31","#bd9e39","#e7ba52","#e7cb94","#843c39","#ad494a","#d6616b","#e7969c","#7b4173","#a55194","#ce6dbd","#de9ed6"],ck=["#3182bd","#6baed6","#9ecae1","#c6dbef","#e6550d","#fd8d3c","#fdae6b","#fdd0a2","#31a354","#74c476","#a1d99b","#c7e9c0","#756bb1","#9e9ac8","#bcbddc","#dadaeb","#636363","#969696","#bdbdbd","#d9d9d9"];d3.scale.quantile=function(){return cl([],[])},d3.scale.quantize=function(){return cm(0,1,[0,1])},d3.svg={},d3.svg.arc=function(){function e(){var e=a.apply(this,arguments),f=b.apply(this,arguments),g=c.apply(this,arguments)+cn,h=d.apply(this,arguments)+cn,i=(h<g&&(i=g,g=h,h=i),h-g),j=i<Math.PI?"0":"1",k=Math.cos(g),l=Math.sin(g),m=Math.cos(h),n=Math.sin(h);return i>=co?e?"M0,"+f+"A"+f+","+f+" 0 1,1 0,"+ -f+"A"+f+","+f+" 0 1,1 0,"+f+"M0,"+e+"A"+e+","+e+" 0 1,0 0,"+ -e+"A"+e+","+e+" 0 1,0 0,"+e+"Z":"M0,"+f+"A"+f+","+f+" 0 1,1 0,"+ -f+"A"+f+","+f+" 0 1,1 0,"+f+"Z":e?"M"+f*k+","+f*l+"A"+f+","+f+" 0 "+j+",1 "+f*m+","+f*n+"L"+e*m+","+e*n+"A"+e+","+e+" 0 "+j+",0 "+e*k+","+e*l+"Z":"M"+f*k+","+f*l+"A"+f+","+f+" 0 "+j+",1 "+f*m+","+f*n+"L0,0"+"Z"}var a=cp,b=cq,c=cr,d=cs;return e.innerRadius=function(b){return arguments.length?(a=d3.functor(b),e):a},e.outerRadius=function(a){return arguments.length?(b=d3.functor(a),e):b},e.startAngle=function(a){return arguments.length?(c=d3.functor(a),e):c},e.endAngle=function(a){return arguments.length?(d=d3.functor(a),e):d},e.centroid=function(){var e=(a.apply(this,arguments)+b.apply(this,arguments))/2,f=(c.apply(this,arguments)+d.apply(this,arguments))/2+cn;return[Math.cos(f)*e,Math.sin(f)*e]},e};var cn=-Math.PI/2,co=2*Math.PI-1e-6;d3.svg.line=function(){return ct(Object)};var cx={linear:cy,"step-before":cz,"step-after":cA,basis:cG,"basis-open":cH,"basis-closed":cI,bundle:cJ,cardinal:cD,"cardinal-open":cB,"cardinal-closed":cC,monotone:cS},cL=[0,2/3,1/3,0],cM=[0,1/3,2/3,0],cN=[0,1/6,2/3,1/6];d3.svg.line.radial=function(){var a=ct(cT);return a.radius=a.x,delete a.x,a.angle=a.y,delete a.y,a},cz.reverse=cA,cA.reverse=cz,d3.svg.area=function(){return cU(Object)},d3.svg.area.radial=function(){var a=cU(cT);return a.radius=a.x,delete a.x,a.innerRadius=a.x0,delete a.x0,a.outerRadius=a.x1,delete a.x1,a.angle=a.y,delete a.y,a.startAngle=a.y0,delete a.y0,a.endAngle=a.y1,delete a.y1,a},d3.svg.chord=function(){function f(c,d){var e=g(this,a,c,d),f=g(this,b,c,d);return"M"+e.p0+i(e.r,e.p1)+(h(e,f)?j(e.r,e.p1,e.r,e.p0):j(e.r,e.p1,f.r,f.p0)+i(f.r,f.p1)+j(f.r,f.p1,e.r,e.p0))+"Z"}function g(a,b,f,g){var h=b.call(a,f,g),i=c.call(a,h,g),j=d.call(a,h,g)+cn,k=e.call(a,h,g)+cn;return{r:i,a0:j,a1:k,p0:[i*Math.cos(j),i*Math.sin(j)],p1:[i*Math.cos(k),i*Math.sin(k)]}}function h(a,b){return a.a0==b.a0&&a.a1==b.a1}function i(a,b){return"A"+a+","+a+" 0 0,1 "+b}function j(a,b,c,d){return"Q 0,0 "+d}var a=cX,b=cY,c=cZ,d=cr,e=cs;return f.radius=function(a){return arguments.length?(c=d3.functor(a),f):c},f.source=function(b){return arguments.length?(a=d3.functor(b),f):a},f.target=function(a){return arguments.length?(b=d3.functor(a),f):b},f.startAngle=function(a){return arguments.length?(d=d3.functor(a),f):d},f.endAngle=function(a){return arguments.length?(e=d3.functor(a),f):e},f},d3.svg.diagonal=function(){function d(d,e){var f=a.call(this,d,e),g=b.call(this,d,e),h=(f.y+g.y)/2,i=[f,{x:f.x,y:h},{x:g.x,y:h},g];return i=i.map(c),"M"+i[0]+"C"+i[1]+" "+i[2]+" "+i[3]}var a=cX,b=cY,c=da;return d.source=function(b){return arguments.length?(a=d3.functor(b),d):a},d.target=function(a){return arguments.length?(b=d3.functor(a),d):b},d.projection=function(a){return arguments.length?(c=a,d):c},d},d3.svg.diagonal.radial=function(){var a=d3.svg.diagonal(),b=da,c=a.projection;return a.projection=function(a){return arguments.length?c(db(b=a)):b},a},d3.svg.mouse=function(a){return dd(a,d3.event)};var dc=/WebKit/.test(navigator.userAgent)?-1:0;d3.svg.touches=function(a,b){return arguments.length<2&&(b=d3.event.touches),b?d(b).map(function(b){var c=dd(a,b);return c.identifier=b.identifier,c}):[]},d3.svg.symbol=function(){function c(c,d){return(dg[a.call(this,c,d)]||dg.circle)(b.call(this,c,d))}var a=df,b=de;return c.type=function(b){return arguments.length?(a=d3.functor(b),c):a},c.size=function(a){return arguments.length?(b=d3.functor(a),c):b},c};var dg={circle:function(a){var b=Math.sqrt(a/Math.PI);return"M0,"+b+"A"+b+","+b+" 0 1,1 0,"+ -b+"A"+b+","+b+" 0 1,1 0,"+b+"Z"},cross:function(a){var b=Math.sqrt(a/5)/2;return"M"+ -3*b+","+ -b+"H"+ -b+"V"+ -3*b+"H"+b+"V"+ -b+"H"+3*b+"V"+b+"H"+b+"V"+3*b+"H"+ -b+"V"+b+"H"+ -3*b+"Z"},diamond:function(a){var b=Math.sqrt(a/(2*di)),c=b*di;return"M0,"+ -b+"L"+c+",0"+" 0,"+b+" "+ -c+",0"+"Z"},square:function(a){var b=Math.sqrt(a)/2;return"M"+ -b+","+ -b+"L"+b+","+ -b+" "+b+","+b+" "+ -b+","+b+"Z"},"triangle-down":function(a){var b=Math.sqrt(a/dh),c=b*dh/2;return"M0,"+c+"L"+b+","+ -c+" "+ -b+","+ -c+"Z"},"triangle-up":function(a){var b=Math.sqrt(a/dh),c=b*dh/2;return"M0,"+ -c+"L"+b+","+c+" "+ -b+","+c+"Z"}};d3.svg.symbolTypes=d3.keys(dg);var dh=Math.sqrt(3),di=Math.tan(30*Math.PI/180);d3.svg.axis=function(){function j(j){j.each(function(k,l,m){var n=d3.select(this),o=j.delay?function(a){var b=bz;try{return bz=j.id,a.transition().delay(j[m][l].delay).duration(j[m][l].duration).ease(j.ease())}finally{bz=b}}:Object,p=a.ticks?a.ticks.apply(a,g):a.domain(),q=h==null?a.tickFormat?a.tickFormat.apply(a,g):String:h,r=dl(a,p,i),s=n.selectAll(".minor").data(r,String),t=s.enter().insert("line","g").attr("class","tick minor").style("opacity",1e-6),u=o(s.exit()).style("opacity",1e-6).remove(),v=o(s).style("opacity",1),w=n.selectAll("g").data(p,String),x=w.enter().insert("g","path").style("opacity",1e-6),y=o(w.exit()).style("opacity",1e-6).remove(),z=o(w).style("opacity",1),A,B=bR(a),C=n.selectAll(".domain").data([0]),D=C.enter().append("path").attr("class","domain"),E=o(C),F=a.copy(),G=this.__chart__||F;this.__chart__=F,x.append("line").attr("class","tick"),x.append("text"),z.select("text").text(q);switch(b){case"bottom":A=dj,v.attr("x2",0).attr("y2",d),z.select("line").attr("x2",0).attr("y2",c),z.select("text").attr("x",0).attr("y",Math.max(c,0)+f).attr("dy",".71em").attr("text-anchor","middle"),E.attr("d","M"+B[0]+","+e+"V0H"+B[1]+"V"+e);break;case"top":A=dj,v.attr("x2",0).attr("y2",-d),z.select("line").attr("x2",0).attr("y2",-c),z.select("text").attr("x",0).attr("y",-(Math.max(c,0)+f)).attr("dy","0em").attr("text-anchor","middle"),E.attr("d","M"+B[0]+","+ -e+"V0H"+B[1]+"V"+ -e);break;case"left":A=dk,v.attr("x2",-d).attr("y2",0),z.select("line").attr("x2",-c).attr("y2",0),z.select("text").attr("x",-(Math.max(c,0)+f)).attr("y",0).attr("dy",".32em").attr("text-anchor","end"),E.attr("d","M"+ -e+","+B[0]+"H0V"+B[1]+"H"+ -e);break;case"right":A=dk,v.attr("x2",d).attr("y2",0),z.select("line").attr("x2",c).attr("y2",0),z.select("text").attr("x",Math.max(c,0)+f).attr("y",0).attr("dy",".32em").attr("text-anchor","start"),E.attr("d","M"+e+","+B[0]+"H0V"+B[1]+"H"+e)}if(a.ticks)x.call(A,G),z.call(A,F),y.call(A,F),t.call(A,G),v.call(A,F),u.call(A,F);else{var H=F.rangeBand()/2,I=function(a){return F(a)+H};x.call(A,I),z.call(A,I)}})}var a=d3.scale.linear(),b="bottom",c=6,d=6,e=6,f=3,g=[10],h,i=0;return j.scale=function(b){return arguments.length?(a=b,j):a},j.orient=function(a){return arguments.length?(b=a,j):b},j.ticks=function(){return arguments.length?(g=arguments,j):g},j.tickFormat=function(a){return arguments.length?(h=a,j):h},j.tickSize=function(a,b,f){if(!arguments.length)return c;var g=arguments.length-1;return c=+a,d=g>1?+b:c,e=g>0?+arguments[g]:c,j},j.tickPadding=function(a){return arguments.length?(f=+a,j):f},j.tickSubdivide=function(a){return arguments.length?(i=+a,j):i},j},d3.svg.brush=function(){function e(a){var g=b&&c?["n","e","s","w","nw","ne","se","sw"]:b?["e","w"]:c?["n","s"]:[];a.each(function(){var a=d3.select(this).on("mousedown.brush",f),h=a.selectAll(".background").data([,]),i=a.selectAll(".extent").data([,]),j=a.selectAll(".resize").data(g,String),k;h.enter().append("rect").attr("class","background").style("visibility","hidden").style("pointer-events","all").style("cursor","crosshair"),i.enter().append("rect").attr("class","extent").style("cursor","move"),j.enter().append("rect").attr("class",function(a){return"resize "+a}).attr("width",6).attr("height",6).style("visibility","hidden").style("pointer-events",e.empty()?"none":"all").style("cursor",function(a){return dE[a]}),j.exit().remove(),b&&(k=bR(b),h.attr("x",k[0]).attr("width",k[1]-k[0]),dx(a,d)),c&&(k=bR(c),h.attr("y",k[0]).attr("height",k[1]-k[0]),dy(a,d))})}function f(){var a=d3.select(d3.event.target);dm=e,dp=this,ds=d,dw=d3.svg.mouse(dp),(dt=a.classed("extent"))?(dw[0]=d[0][0]-dw[0],dw[1]=d[0][1]-dw[1]):a.classed("resize")?(du=d3.event.target.__data__,dw[0]=d[+/w$/.test(du)][0],dw[1]=d[+/^n/.test(du)][1]):d3.event.altKey&&(dv=dw.slice()),dq=!/^(n|s)$/.test(du)&&b,dr=!/^(e|w)$/.test(du)&&c,dn=g(this,arguments),dn("brushstart"),dB(),O()}function g(b,c){return function(d){var f=d3.event;try{d3.event={type:d,target:e},a[d].apply(b,c)}finally{d3.event=f}}}var a=d3.dispatch("brushstart","brush","brushend"),b,c,d=[[0,0],[0,0]];return e.x=function(a){return arguments.length?(b=a,e):b},e.y=function(a){return arguments.length?(c=a,e):c},e.extent=function(a){var f,g,h,i,j;return arguments.length?(b&&(f=a[0],g=a[1],c&&(f=f[0],g=g[0]),b.invert&&(f=b(f),g=b(g)),g<f&&(j=f,f=g,g=j),d[0][0]=f,d[1][0]=g),c&&(h=a[0],i=a[1],b&&(h=h[1],i=i[1]),c.invert&&(h=c(h),i=c(i)),i<h&&(j=h,h=i,i=j),d[0][1]=h,d[1][1]=i),e):(b&&(f=d[0][0],g=d[1][0],b.invert&&(f=b.invert(f),g=b.invert(g)),g<f&&(j=f,f=g,g=j)),c&&(h=d[0][1],i=d[1][1],c.invert&&(h=c.invert(h),i=c.invert(i)),i<h&&(j=h,h=i,i=j)),b&&c?[[f,h],[g,i]]:b?[f,g]:c&&[h,i])},e.clear=function(){return d[0][0]=d[0][1]=d[1][0]=d[1][1]=0,e},e.empty=function(){return b&&d[0][0]===d[1][0]||c&&d[0][1]===d[1][1]},d3.select(window).on("mousemove.brush",dB).on("mouseup.brush",dD).on("keydown.brush",dz).on("keyup.brush",dA),d3.rebind(e,a,"on")};var dm,dn,dp,dq,dr,ds,dt,du,dv,dw,dE={n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"};d3.behavior={},d3.behavior.drag=function(){function c(){this.on("mousedown.drag",e).on("touchstart.drag",e),d3.select(window).on("mousemove.drag",dO).on("touchmove.drag",dO).on("mouseup.drag",dP,!0).on("touchend.drag",dP,!0).on("click.drag",dQ,!0)}function d(){dF=a,dG=d3.event.target,dH=this,dI=arguments,dK=dN(),b?(dJ=b.apply(dH,dI),dJ=[dJ.x-dK[0],dJ.y-dK[1]]):dJ=[0,0],dL=0}function e(){d.apply(this,arguments),dM("dragstart")}var a=d3.dispatch("drag","dragstart","dragend"),b=null;return c.origin=function(a){return arguments.length?(b=a,c):b},d3.rebind(c,a,"on")};var dF,dG,dH,dI,dJ,dK,dL;d3.behavior.zoom=function(){function d(){this.on("mousedown.zoom",f).on("mousewheel.zoom",g).on("DOMMouseScroll.zoom",g).on("dblclick.zoom",h).on("touchstart.zoom",i),d3.select(window).on("mousemove.zoom",ef).on("mouseup.zoom",eg).on("touchmove.zoom",ee).on("touchend.zoom",ed).on("click.zoom",eh,!0)}function e(){dW=a,dX=c,dY=b.zoom,dZ=d3.event.target,d$=this,d_=arguments}function f(){e.apply(this,arguments),dS=eb(d3.svg.mouse(d$)),ea=0,d3.event.preventDefault(),window.focus()}function g(){e.apply(this,arguments),dT||(dT=eb(d3.svg.mouse(d$))),ei(ec()+a[2],d3.svg.mouse(d$),dT)}function h(){e.apply(this,arguments);var b=d3.svg.mouse(d$);ei(d3.event.shiftKey?Math.ceil(a[2]-1):Math.floor(a[2]+1),b,eb(b))}function i(){e.apply(this,arguments);var b=ed(),c,d=Date.now();b.length===1&&d-dV<300&&ei(1+Math.floor(a[2]),c=b[0],dU[c.identifier]),dV=d}var a=[0,0,0],b=d3.dispatch("zoom"),c=ej;return d.extent=function(a){return arguments.length?(c=a==null?ej:a,d):c},d3.rebind(d,b,"on")};var dR,dS,dT,dU={},dV=0,dW,dX,dY,dZ,d$,d_,ea,ej=[[-Infinity,Infinity],[-Infinity,Infinity],[-Infinity,Infinity]]})();
<ide>\ No newline at end of file
<add>,darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};for(var $ in Z)Z[$]=W(Z[$],T,bb);d3.hsl=function(a,b,c){return arguments.length===1?a instanceof ba?_(a.h,a.s,a.l):W(""+a,X,_):_(+a,+b,+c)},ba.prototype.brighter=function(a){return a=Math.pow(.7,arguments.length?a:1),_(this.h,this.s,this.l/a)},ba.prototype.darker=function(a){return a=Math.pow(.7,arguments.length?a:1),_(this.h,this.s,a*this.l)},ba.prototype.rgb=function(){return bb(this.h,this.s,this.l)},ba.prototype.toString=function(){return this.rgb().toString()};var bd=function(a,b){return b.querySelector(a)},be=function(a,b){return b.querySelectorAll(a)},bf=document.documentElement,bg=bf.matchesSelector||bf.webkitMatchesSelector||bf.mozMatchesSelector||bf.msMatchesSelector||bf.oMatchesSelector,bh=function(a,b){return bg.call(a,b)};typeof Sizzle=="function"&&(bd=function(a,b){return Sizzle(a,b)[0]},be=function(a,b){return Sizzle.uniqueSort(Sizzle(a,b))},bh=Sizzle.matchesSelector);var bi=[];d3.selection=function(){return bq},d3.selection.prototype=bi,bi.select=function(a){var b=[],c,d,e,f;typeof a!="function"&&(a=bj(a));for(var g=-1,h=this.length;++g<h;){b.push(c=[]),c.parentNode=(e=this[g]).parentNode;for(var i=-1,j=e.length;++i<j;)(f=e[i])?(c.push(d=a.call(f,f.__data__,i)),d&&"__data__"in f&&(d.__data__=f.__data__)):c.push(null)}return bc(b)},bi.selectAll=function(a){var b=[],c,e;typeof a!="function"&&(a=bk(a));for(var f=-1,g=this.length;++f<g;)for(var h=this[f],i=-1,j=h.length;++i<j;)if(e=h[i])b.push(c=d(a.call(e,e.__data__,i))),c.parentNode=e;return bc(b)},bi.attr=function(a,b){function d(){this.removeAttribute(a)}function e(){this.removeAttributeNS(a.space,a.local)}function f(){this.setAttribute(a,b)}function g(){this.setAttributeNS(a.space,a.local,b)}function h(){var c=b.apply(this,arguments);c==null?this.removeAttribute(a):this.setAttribute(a,c)}function i(){var c=b.apply(this,arguments);c==null?this.removeAttributeNS(a.space,a.local):this.setAttributeNS(a.space,a.local,c)}a=d3.ns.qualify(a);if(arguments.length<2){var c=this.node();return a.local?c.getAttributeNS(a.space,a.local):c.getAttribute(a)}return this.each(b==null?a.local?e:d:typeof b=="function"?a.local?i:h:a.local?g:f)},bi.classed=function(a,b){var c=a.split(bl),d=c.length,e=-1;if(arguments.length>1){while(++e<d)bm.call(this,c[e],b);return this}while(++e<d)if(!bm.call(this,c[e]))return!1;return!0};var bl=/\s+/g;bi.style=function(a,b,c){function d(){this.style.removeProperty(a)}function e(){this.style.setProperty(a,b,c)}function f(){var d=b.apply(this,arguments);d==null?this.style.removeProperty(a):this.style.setProperty(a,d,c)}return arguments.length<3&&(c=""),arguments.length<2?window.getComputedStyle(this.node(),null).getPropertyValue(a):this.each(b==null?d:typeof b=="function"?f:e)},bi.property=function(a,b){function c(){delete this[a]}function d(){this[a]=b}function e(){var c=b.apply(this,arguments);c==null?delete this[a]:this[a]=c}return arguments.length<2?this.node()[a]:this.each(b==null?c:typeof b=="function"?e:d)},bi.text=function(a){return arguments.length<1?this.node().textContent:this.each(typeof a=="function"?function(){this.textContent=a.apply(this,arguments)}:function(){this.textContent=a})},bi.html=function(a){return arguments.length<1?this.node().innerHTML:this.each(typeof a=="function"?function(){this.innerHTML=a.apply(this,arguments)}:function(){this.innerHTML=a})},bi.append=function(a){function b(){return this.appendChild(document.createElementNS(this.namespaceURI,a))}function c(){return this.appendChild(document.createElementNS(a.space,a.local))}return a=d3.ns.qualify(a),this.select(a.local?c:b)},bi.insert=function(a,b){function c(){return this.insertBefore(document.createElementNS(this.namespaceURI,a),bd(b,this))}function d(){return this.insertBefore(document.createElementNS(a.space,a.local),bd(b,this))}return a=d3.ns.qualify(a),this.select(a.local?d:c)},bi.remove=function(){return this.each(function(){var a=this.parentNode;a&&a.removeChild(this)})},bi.data=function(a,b){function f(a,f){var g,h=a.length,i=f.length,j=Math.min(h,i),k=Math.max(h,i),l=[],m=[],n=[],o,p;if(b){var q={},r=[],s,t=f.length;for(g=-1;++g<h;)s=b.call(o=a[g],o.__data__,g),s in q?n[t++]=o:q[s]=o,r.push(s);for(g=-1;++g<i;)o=q[s=b.call(f,p=f[g],g)],o?(o.__data__=p,l[g]=o,m[g]=n[g]=null):(m[g]=bn(p),l[g]=n[g]=null),delete q[s];for(g=-1;++g<h;)r[g]in q&&(n[g]=a[g])}else{for(g=-1;++g<j;)o=a[g],p=f[g],o?(o.__data__=p,l[g]=o,m[g]=n[g]=null):(m[g]=bn(p),l[g]=n[g]=null);for(;g<i;++g)m[g]=bn(f[g]),l[g]=n[g]=null;for(;g<k;++g)n[g]=a[g],m[g]=l[g]=null}m.update=l,m.parentNode=l.parentNode=n.parentNode=a.parentNode,c.push(m),d.push(l),e.push(n)}var c=[],d=[],e=[],g=-1,h=this.length,i;if(typeof a=="function")while(++g<h)f(i=this[g],a.call(i,i.parentNode.__data__,g));else while(++g<h)f(i=this[g],a);var j=bc(d);return j.enter=function(){return br(c)},j.exit=function(){return bc(e)},j},bi.filter=function(a){var b=[],c,d,e;typeof a!="function"&&(a=bo(a));for(var f=0,g=this.length;f<g;f++){b.push(c=[]),c.parentNode=(d=this[f]).parentNode;for(var h=0,i=d.length;h<i;h++)(e=d[h])&&a.call(e,e.__data__,h)&&c.push(e)}return bc(b)},bi.map=function(a){return this.each(function(){this.__data__=a.apply(this,arguments)})},bi.order=function(){for(var a=-1,b=this.length;++a<b;)for(var c=this[a],d=c.length-1,e=c[d],f;--d>=0;)if(f=c[d])e&&e.parentNode.insertBefore(f,e),e=f;return this},bi.sort=function(a){a=bp.apply(this,arguments);for(var b=-1,c=this.length;++b<c;)this[b].sort(a);return this.order()},bi.on=function(a,b,c){arguments.length<3&&(c=!1);var d="__on"+a,e=a.indexOf(".");return e>0&&(a=a.substring(0,e)),arguments.length<2?(e=this.node()[d])&&e._:this.each(function(e,f){function h(a){var c=d3.event;d3.event=a;try{b.call(g,g.__data__,f)}finally{d3.event=c}}var g=this;g[d]&&g.removeEventListener(a,g[d],c),b&&g.addEventListener(a,g[d]=h,c),h._=b})},bi.each=function(a){for(var b=-1,c=this.length;++b<c;)for(var d=this[b],e=-1,f=d.length;++e<f;){var g=d[e];g&&a.call(g,g.__data__,e,b)}return this},bi.call=function(a){return a.apply(this,(arguments[0]=this,arguments)),this},bi.empty=function(){return!this.node()},bi.node=function(a){for(var b=0,c=this.length;b<c;b++)for(var d=this[b],e=0,f=d.length;e<f;e++){var g=d[e];if(g)return g}return null},bi.transition=function(){var a=[],b,c;for(var d=-1,e=this.length;++d<e;){a.push(b=[]);for(var f=this[d],g=-1,h=f.length;++g<h;)b.push((c=f[g])?{node:c,delay:0,duration:250}:null)}return bt(a,bz||++by,Date.now())};var bq=bc([[document]]);bq[0].parentNode=bf,d3.select=function(a){return typeof a=="string"?bq.select(a):bc([[a]])},d3.selectAll=function(a){return typeof a=="string"?bq.selectAll(a):bc([d(a)])};var bs=[];bs.append=bi.append,bs.insert=bi.insert,bs.empty=bi.empty,bs.node=bi.node,bs.select=function(a){var b=[],c,d,e,f,g;for(var h=-1,i=this.length;++h<i;){e=(f=this[h]).update,b.push(c=[]),c.parentNode=f.parentNode;for(var j=-1,k=f.length;++j<k;)(g=f[j])?(c.push(e[j]=d=a.call(f.parentNode,g.__data__,j)),d.__data__=g.__data__):c.push(null)}return bc(b)};var bu={},bx=[],by=0,bz=0,bA=d3.ease("cubic-in-out");bx.call=bi.call,d3.transition=function(){return bq.transition()},d3.transition.prototype=bx,bx.select=function(a){var b=[],c,d,e;typeof a!="function"&&(a=bj(a));for(var f=-1,g=this.length;++f<g;){b.push(c=[]);for(var h=this[f],i=-1,j=h.length;++i<j;)(e=h[i])&&(d=a.call(e.node,e.node.__data__,i))?("__data__"in e.node&&(d.__data__=e.node.__data__),c.push({node:d,delay:e.delay,duration:e.duration})):c.push(null)}return bt(b,this.id,this.time).ease(this.ease())},bx.selectAll=function(a){var b=[],c,d,e;typeof a!="function"&&(a=bk(a));for(var f=-1,g=this.length;++f<g;)for(var h=this[f],i=-1,j=h.length;++i<j;)if(e=h[i]){d=a.call(e.node,e.node.__data__,i),b.push(c=[]);for(var k=-1,l=d.length;++k<l;)c.push({node:d[k],delay:e.delay,duration:e.duration})}return bt(b,this.id,this.time).ease(this.ease())},bx.attr=function(a,b){return this.attrTween(a,bw(a,b))},bx.attrTween=function(a,b){function d(a,d){var e=b.call(this,a,d,this.getAttribute(c));return e===bu?(this.removeAttribute(c),null):e&&function(a){this.setAttribute(c,e(a))}}function e(a,d){var e=b.call(this,a,d,this.getAttributeNS(c.space,c.local));return e===bu?(this.removeAttributeNS(c.space,c.local),null):e&&function(a){this.setAttributeNS(c.space,c.local,e(a))}}var c=d3.ns.qualify(a);return this.tween("attr."+a,c.local?e:d)},bx.style=function(a,b,c){return arguments.length<3&&(c=""),this.styleTween(a,bw(a,b),c)},bx.styleTween=function(a,b,c){return arguments.length<3&&(c=""),this.tween("style."+a,function(d,e){var f=b.call(this,d,e,window.getComputedStyle(this,null).getPropertyValue(a));return f===bu?(this.style.removeProperty(a),null):f&&function(b){this.style.setProperty(a,f(b),c)}})},bx.text=function(a){return this.tween("text",function(b,c){this.textContent=typeof a=="function"?a.call(this,b,c):a})},bx.remove=function(){return this.each("end",function(){var a;!this.__transition__&&(a=this.parentNode)&&a.removeChild(this)})},bx.delay=function(a){var b=this;return b.each(typeof a=="function"?function(c,d,e){b[e][d].delay=+a.apply(this,arguments)}:(a=+a,function(c,d,e){b[e][d].delay=a}))},bx.duration=function(a){var b=this;return b.each(typeof a=="function"?function(c,d,e){b[e][d].duration=+a.apply(this,arguments)}:(a=+a,function(c,d,e){b[e][d].duration=a}))},bx.transition=function(){return this.select(i)};var bC=null,bD,bE;d3.timer=function(a,b,c){var d=!1,e,f=bC;if(arguments.length<3){if(arguments.length<2)b=0;else if(!isFinite(b))return;c=Date.now()}while(f){if(f.callback===a){f.then=c,f.delay=b,d=!0;break}e=f,f=f.next}d||(bC={callback:a,then:c,delay:b,next:bC}),bD||(bE=clearTimeout(bE),bD=1,bH(bF))},d3.timer.flush=function(){var a,b=Date.now(),c=bC;while(c)a=b-c.then,c.delay||(c.flush=c.callback(a)),c=c.next;bG()};var bH=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){setTimeout(a,17)};d3.transform=function(a){bM.setAttribute("transform",a);var b=bM.transform.baseVal.consolidate();return new bI(b?b.matrix:bN)},bI.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var bM=document.createElementNS(d3.ns.prefix.svg,"g"),bN={a:1,b:0,c:0,d:1,e:0,f:0},bO=180/Math.PI;d3.scale={},d3.scale.linear=function(){return bU([0,1],[0,1],d3.interpolate,!1)},d3.scale.log=function(){return ca(d3.scale.linear(),cc)};var cb=d3.format(".0e");cc.pow=function(a){return Math.pow(10,a)},cd.pow=function(a){return-Math.pow(10,-a)},d3.scale.pow=function(){return ce(d3.scale.linear(),1)},d3.scale.sqrt=function(){return d3.scale.pow().exponent(.5)},d3.scale.ordinal=function(){return cg([],{t:"range",x:[]})},d3.scale.category10=function(){return d3.scale.ordinal().range(ch)},d3.scale.category20=function(){return d3.scale.ordinal().range(ci)},d3.scale.category20b=function(){return d3.scale.ordinal().range(cj)},d3.scale.category20c=function(){return d3.scale.ordinal().range(ck)};var ch=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ci=["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"],cj=["#393b79","#5254a3","#6b6ecf","#9c9ede","#637939","#8ca252","#b5cf6b","#cedb9c","#8c6d31","#bd9e39","#e7ba52","#e7cb94","#843c39","#ad494a","#d6616b","#e7969c","#7b4173","#a55194","#ce6dbd","#de9ed6"],ck=["#3182bd","#6baed6","#9ecae1","#c6dbef","#e6550d","#fd8d3c","#fdae6b","#fdd0a2","#31a354","#74c476","#a1d99b","#c7e9c0","#756bb1","#9e9ac8","#bcbddc","#dadaeb","#636363","#969696","#bdbdbd","#d9d9d9"];d3.scale.quantile=function(){return cl([],[])},d3.scale.quantize=function(){return cm(0,1,[0,1])},d3.svg={},d3.svg.arc=function(){function e(){var e=a.apply(this,arguments),f=b.apply(this,arguments),g=c.apply(this,arguments)+cn,h=d.apply(this,arguments)+cn,i=(h<g&&(i=g,g=h,h=i),h-g),j=i<Math.PI?"0":"1",k=Math.cos(g),l=Math.sin(g),m=Math.cos(h),n=Math.sin(h);return i>=co?e?"M0,"+f+"A"+f+","+f+" 0 1,1 0,"+ -f+"A"+f+","+f+" 0 1,1 0,"+f+"M0,"+e+"A"+e+","+e+" 0 1,0 0,"+ -e+"A"+e+","+e+" 0 1,0 0,"+e+"Z":"M0,"+f+"A"+f+","+f+" 0 1,1 0,"+ -f+"A"+f+","+f+" 0 1,1 0,"+f+"Z":e?"M"+f*k+","+f*l+"A"+f+","+f+" 0 "+j+",1 "+f*m+","+f*n+"L"+e*m+","+e*n+"A"+e+","+e+" 0 "+j+",0 "+e*k+","+e*l+"Z":"M"+f*k+","+f*l+"A"+f+","+f+" 0 "+j+",1 "+f*m+","+f*n+"L0,0"+"Z"}var a=cp,b=cq,c=cr,d=cs;return e.innerRadius=function(b){return arguments.length?(a=d3.functor(b),e):a},e.outerRadius=function(a){return arguments.length?(b=d3.functor(a),e):b},e.startAngle=function(a){return arguments.length?(c=d3.functor(a),e):c},e.endAngle=function(a){return arguments.length?(d=d3.functor(a),e):d},e.centroid=function(){var e=(a.apply(this,arguments)+b.apply(this,arguments))/2,f=(c.apply(this,arguments)+d.apply(this,arguments))/2+cn;return[Math.cos(f)*e,Math.sin(f)*e]},e};var cn=-Math.PI/2,co=2*Math.PI-1e-6;d3.svg.line=function(){return ct(Object)};var cx={linear:cy,"step-before":cz,"step-after":cA,basis:cG,"basis-open":cH,"basis-closed":cI,bundle:cJ,cardinal:cD,"cardinal-open":cB,"cardinal-closed":cC,monotone:cS},cL=[0,2/3,1/3,0],cM=[0,1/3,2/3,0],cN=[0,1/6,2/3,1/6];d3.svg.line.radial=function(){var a=ct(cT);return a.radius=a.x,delete a.x,a.angle=a.y,delete a.y,a},cz.reverse=cA,cA.reverse=cz,d3.svg.area=function(){return cU(Object)},d3.svg.area.radial=function(){var a=cU(cT);return a.radius=a.x,delete a.x,a.innerRadius=a.x0,delete a.x0,a.outerRadius=a.x1,delete a.x1,a.angle=a.y,delete a.y,a.startAngle=a.y0,delete a.y0,a.endAngle=a.y1,delete a.y1,a},d3.svg.chord=function(){function f(c,d){var e=g(this,a,c,d),f=g(this,b,c,d);return"M"+e.p0+i(e.r,e.p1)+(h(e,f)?j(e.r,e.p1,e.r,e.p0):j(e.r,e.p1,f.r,f.p0)+i(f.r,f.p1)+j(f.r,f.p1,e.r,e.p0))+"Z"}function g(a,b,f,g){var h=b.call(a,f,g),i=c.call(a,h,g),j=d.call(a,h,g)+cn,k=e.call(a,h,g)+cn;return{r:i,a0:j,a1:k,p0:[i*Math.cos(j),i*Math.sin(j)],p1:[i*Math.cos(k),i*Math.sin(k)]}}function h(a,b){return a.a0==b.a0&&a.a1==b.a1}function i(a,b){return"A"+a+","+a+" 0 0,1 "+b}function j(a,b,c,d){return"Q 0,0 "+d}var a=cX,b=cY,c=cZ,d=cr,e=cs;return f.radius=function(a){return arguments.length?(c=d3.functor(a),f):c},f.source=function(b){return arguments.length?(a=d3.functor(b),f):a},f.target=function(a){return arguments.length?(b=d3.functor(a),f):b},f.startAngle=function(a){return arguments.length?(d=d3.functor(a),f):d},f.endAngle=function(a){return arguments.length?(e=d3.functor(a),f):e},f},d3.svg.diagonal=function(){function d(d,e){var f=a.call(this,d,e),g=b.call(this,d,e),h=(f.y+g.y)/2,i=[f,{x:f.x,y:h},{x:g.x,y:h},g];return i=i.map(c),"M"+i[0]+"C"+i[1]+" "+i[2]+" "+i[3]}var a=cX,b=cY,c=da;return d.source=function(b){return arguments.length?(a=d3.functor(b),d):a},d.target=function(a){return arguments.length?(b=d3.functor(a),d):b},d.projection=function(a){return arguments.length?(c=a,d):c},d},d3.svg.diagonal.radial=function(){var a=d3.svg.diagonal(),b=da,c=a.projection;return a.projection=function(a){return arguments.length?c(db(b=a)):b},a},d3.svg.mouse=function(a){return dd(a,d3.event)};var dc=/WebKit/.test(navigator.userAgent)?-1:0;d3.svg.touches=function(a,b){return arguments.length<2&&(b=d3.event.touches),b?d(b).map(function(b){var c=dd(a,b);return c.identifier=b.identifier,c}):[]},d3.svg.symbol=function(){function c(c,d){return(dg[a.call(this,c,d)]||dg.circle)(b.call(this,c,d))}var a=df,b=de;return c.type=function(b){return arguments.length?(a=d3.functor(b),c):a},c.size=function(a){return arguments.length?(b=d3.functor(a),c):b},c};var dg={circle:function(a){var b=Math.sqrt(a/Math.PI);return"M0,"+b+"A"+b+","+b+" 0 1,1 0,"+ -b+"A"+b+","+b+" 0 1,1 0,"+b+"Z"},cross:function(a){var b=Math.sqrt(a/5)/2;return"M"+ -3*b+","+ -b+"H"+ -b+"V"+ -3*b+"H"+b+"V"+ -b+"H"+3*b+"V"+b+"H"+b+"V"+3*b+"H"+ -b+"V"+b+"H"+ -3*b+"Z"},diamond:function(a){var b=Math.sqrt(a/(2*di)),c=b*di;return"M0,"+ -b+"L"+c+",0"+" 0,"+b+" "+ -c+",0"+"Z"},square:function(a){var b=Math.sqrt(a)/2;return"M"+ -b+","+ -b+"L"+b+","+ -b+" "+b+","+b+" "+ -b+","+b+"Z"},"triangle-down":function(a){var b=Math.sqrt(a/dh),c=b*dh/2;return"M0,"+c+"L"+b+","+ -c+" "+ -b+","+ -c+"Z"},"triangle-up":function(a){var b=Math.sqrt(a/dh),c=b*dh/2;return"M0,"+ -c+"L"+b+","+c+" "+ -b+","+c+"Z"}};d3.svg.symbolTypes=d3.keys(dg);var dh=Math.sqrt(3),di=Math.tan(30*Math.PI/180);d3.svg.axis=function(){function j(j){j.each(function(k,l,m){var n=d3.select(this),o=j.delay?function(a){var b=bz;try{return bz=j.id,a.transition().delay(j[m][l].delay).duration(j[m][l].duration).ease(j.ease())}finally{bz=b}}:Object,p=a.ticks?a.ticks.apply(a,g):a.domain(),q=h==null?a.tickFormat?a.tickFormat.apply(a,g):String:h,r=dl(a,p,i),s=n.selectAll(".minor").data(r,String),t=s.enter().insert("line","g").attr("class","tick minor").style("opacity",1e-6),u=o(s.exit()).style("opacity",1e-6).remove(),v=o(s).style("opacity",1),w=n.selectAll("g").data(p,String),x=w.enter().insert("g","path").style("opacity",1e-6),y=o(w.exit()).style("opacity",1e-6).remove(),z=o(w).style("opacity",1),A,B=bR(a),C=n.selectAll(".domain").data([0]),D=C.enter().append("path").attr("class","domain"),E=o(C),F=a.copy(),G=this.__chart__||F;this.__chart__=F,x.append("line").attr("class","tick"),x.append("text"),z.select("text").text(q);switch(b){case"bottom":A=dj,v.attr("x2",0).attr("y2",d),z.select("line").attr("x2",0).attr("y2",c),z.select("text").attr("x",0).attr("y",Math.max(c,0)+f).attr("dy",".71em").attr("text-anchor","middle"),E.attr("d","M"+B[0]+","+e+"V0H"+B[B.length-1]+"V"+e);break;case"top":A=dj,v.attr("x2",0).attr("y2",-d),z.select("line").attr("x2",0).attr("y2",-c),z.select("text").attr("x",0).attr("y",-(Math.max(c,0)+f)).attr("dy","0em").attr("text-anchor","middle"),E.attr("d","M"+B[0]+","+ -e+"V0H"+B[B.length-1]+"V"+ -e);break;case"left":A=dk,v.attr("x2",-d).attr("y2",0),z.select("line").attr("x2",-c).attr("y2",0),z.select("text").attr("x",-(Math.max(c,0)+f)).attr("y",0).attr("dy",".32em").attr("text-anchor","end"),E.attr("d","M"+ -e+","+B[0]+"H0V"+B[B.length-1]+"H"+ -e);break;case"right":A=dk,v.attr("x2",d).attr("y2",0),z.select("line").attr("x2",c).attr("y2",0),z.select("text").attr("x",Math.max(c,0)+f).attr("y",0).attr("dy",".32em").attr("text-anchor","start"),E.attr("d","M"+e+","+B[0]+"H0V"+B[B.length-1]+"H"+e)}if(a.ticks)x.call(A,G),z.call(A,F),y.call(A,F),t.call(A,G),v.call(A,F),u.call(A,F);else{var H=F.rangeBand()/2,I=function(a){return F(a)+H};x.call(A,I),z.call(A,I)}})}var a=d3.scale.linear(),b="bottom",c=6,d=6,e=6,f=3,g=[10],h,i=0;return j.scale=function(b){return arguments.length?(a=b,j):a},j.orient=function(a){return arguments.length?(b=a,j):b},j.ticks=function(){return arguments.length?(g=arguments,j):g},j.tickFormat=function(a){return arguments.length?(h=a,j):h},j.tickSize=function(a,b,f){if(!arguments.length)return c;var g=arguments.length-1;return c=+a,d=g>1?+b:c,e=g>0?+arguments[g]:c,j},j.tickPadding=function(a){return arguments.length?(f=+a,j):f},j.tickSubdivide=function(a){return arguments.length?(i=+a,j):i},j},d3.svg.brush=function(){function e(a){var g=b&&c?["n","e","s","w","nw","ne","se","sw"]:b?["e","w"]:c?["n","s"]:[];a.each(function(){var a=d3.select(this).on("mousedown.brush",f),h=a.selectAll(".background").data([,]),i=a.selectAll(".extent").data([,]),j=a.selectAll(".resize").data(g,String),k;h.enter().append("rect").attr("class","background").style("visibility","hidden").style("pointer-events","all").style("cursor","crosshair"),i.enter().append("rect").attr("class","extent").style("cursor","move"),j.enter().append("rect").attr("class",function(a){return"resize "+a}).attr("width",6).attr("height",6).style("visibility","hidden").style("pointer-events",e.empty()?"none":"all").style("cursor",function(a){return dE[a]}),j.exit().remove(),b&&(k=bR(b),h.attr("x",k[0]).attr("width",k[1]-k[0]),dx(a,d)),c&&(k=bR(c),h.attr("y",k[0]).attr("height",k[1]-k[0]),dy(a,d))})}function f(){var a=d3.select(d3.event.target);dm=e,dp=this,ds=d,dw=d3.svg.mouse(dp),(dt=a.classed("extent"))?(dw[0]=d[0][0]-dw[0],dw[1]=d[0][1]-dw[1]):a.classed("resize")?(du=d3.event.target.__data__,dw[0]=d[+/w$/.test(du)][0],dw[1]=d[+/^n/.test(du)][1]):d3.event.altKey&&(dv=dw.slice()),dq=!/^(n|s)$/.test(du)&&b,dr=!/^(e|w)$/.test(du)&&c,dn=g(this,arguments),dn("brushstart"),dB(),O()}function g(b,c){return function(d){var f=d3.event;try{d3.event={type:d,target:e},a[d].apply(b,c)}finally{d3.event=f}}}var a=d3.dispatch("brushstart","brush","brushend"),b,c,d=[[0,0],[0,0]];return e.x=function(a){return arguments.length?(b=a,e):b},e.y=function(a){return arguments.length?(c=a,e):c},e.extent=function(a){var f,g,h,i,j;return arguments.length?(b&&(f=a[0],g=a[1],c&&(f=f[0],g=g[0]),b.invert&&(f=b(f),g=b(g)),g<f&&(j=f,f=g,g=j),d[0][0]=f,d[1][0]=g),c&&(h=a[0],i=a[1],b&&(h=h[1],i=i[1]),c.invert&&(h=c(h),i=c(i)),i<h&&(j=h,h=i,i=j),d[0][1]=h,d[1][1]=i),e):(b&&(f=d[0][0],g=d[1][0],b.invert&&(f=b.invert(f),g=b.invert(g)),g<f&&(j=f,f=g,g=j)),c&&(h=d[0][1],i=d[1][1],c.invert&&(h=c.invert(h),i=c.invert(i)),i<h&&(j=h,h=i,i=j)),b&&c?[[f,h],[g,i]]:b?[f,g]:c&&[h,i])},e.clear=function(){return d[0][0]=d[0][1]=d[1][0]=d[1][1]=0,e},e.empty=function(){return b&&d[0][0]===d[1][0]||c&&d[0][1]===d[1][1]},d3.select(window).on("mousemove.brush",dB).on("mouseup.brush",dD).on("keydown.brush",dz).on("keyup.brush",dA),d3.rebind(e,a,"on")};var dm,dn,dp,dq,dr,ds,dt,du,dv,dw,dE={n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"};d3.behavior={},d3.behavior.drag=function(){function c(){this.on("mousedown.drag",e).on("touchstart.drag",e),d3.select(window).on("mousemove.drag",dO).on("touchmove.drag",dO).on("mouseup.drag",dP,!0).on("touchend.drag",dP,!0).on("click.drag",dQ,!0)}function d(){dF=a,dG=d3.event.target,dH=this,dI=arguments,dK=dN(),b?(dJ=b.apply(dH,dI),dJ=[dJ.x-dK[0],dJ.y-dK[1]]):dJ=[0,0],dL=0}function e(){d.apply(this,arguments),dM("dragstart")}var a=d3.dispatch("drag","dragstart","dragend"),b=null;return c.origin=function(a){return arguments.length?(b=a,c):b},d3.rebind(c,a,"on")};var dF,dG,dH,dI,dJ,dK,dL;d3.behavior.zoom=function(){function d(){this.on("mousedown.zoom",f).on("mousewheel.zoom",g).on("DOMMouseScroll.zoom",g).on("dblclick.zoom",h).on("touchstart.zoom",i),d3.select(window).on("mousemove.zoom",ef).on("mouseup.zoom",eg).on("touchmove.zoom",ee).on("touchend.zoom",ed).on("click.zoom",eh,!0)}function e(){dW=a,dX=c,dY=b.zoom,dZ=d3.event.target,d$=this,d_=arguments}function f(){e.apply(this,arguments),dS=eb(d3.svg.mouse(d$)),ea=0,d3.event.preventDefault(),window.focus()}function g(){e.apply(this,arguments),dT||(dT=eb(d3.svg.mouse(d$))),ei(ec()+a[2],d3.svg.mouse(d$),dT)}function h(){e.apply(this,arguments);var b=d3.svg.mouse(d$);ei(d3.event.shiftKey?Math.ceil(a[2]-1):Math.floor(a[2]+1),b,eb(b))}function i(){e.apply(this,arguments);var b=ed(),c,d=Date.now();b.length===1&&d-dV<300&&ei(1+Math.floor(a[2]),c=b[0],dU[c.identifier]),dV=d}var a=[0,0,0],b=d3.dispatch("zoom"),c=ej;return d.extent=function(a){return arguments.length?(c=a==null?ej:a,d):c},d3.rebind(d,b,"on")};var dR,dS,dT,dU={},dV=0,dW,dX,dY,dZ,d$,d_,ea,ej=[[-Infinity,Infinity],[-Infinity,Infinity],[-Infinity,Infinity]]})();
<ide>\ No newline at end of file
<ide><path>src/svg/axis.js
<ide> d3.svg.axis = function() {
<ide> subtickUpdate.attr("x2", 0).attr("y2", tickMinorSize);
<ide> tickUpdate.select("line").attr("x2", 0).attr("y2", tickMajorSize);
<ide> tickUpdate.select("text").attr("x", 0).attr("y", Math.max(tickMajorSize, 0) + tickPadding).attr("dy", ".71em").attr("text-anchor", "middle");
<del> pathUpdate.attr("d", "M" + range[0] + "," + tickEndSize + "V0H" + range[1] + "V" + tickEndSize);
<add> pathUpdate.attr("d", "M" + range[0] + "," + tickEndSize + "V0H" + range[range.length - 1] + "V" + tickEndSize);
<ide> break;
<ide> }
<ide> case "top": {
<ide> tickTransform = d3_svg_axisX;
<ide> subtickUpdate.attr("x2", 0).attr("y2", -tickMinorSize);
<ide> tickUpdate.select("line").attr("x2", 0).attr("y2", -tickMajorSize);
<ide> tickUpdate.select("text").attr("x", 0).attr("y", -(Math.max(tickMajorSize, 0) + tickPadding)).attr("dy", "0em").attr("text-anchor", "middle");
<del> pathUpdate.attr("d", "M" + range[0] + "," + -tickEndSize + "V0H" + range[1] + "V" + -tickEndSize);
<add> pathUpdate.attr("d", "M" + range[0] + "," + -tickEndSize + "V0H" + range[range.length - 1] + "V" + -tickEndSize);
<ide> break;
<ide> }
<ide> case "left": {
<ide> tickTransform = d3_svg_axisY;
<ide> subtickUpdate.attr("x2", -tickMinorSize).attr("y2", 0);
<ide> tickUpdate.select("line").attr("x2", -tickMajorSize).attr("y2", 0);
<ide> tickUpdate.select("text").attr("x", -(Math.max(tickMajorSize, 0) + tickPadding)).attr("y", 0).attr("dy", ".32em").attr("text-anchor", "end");
<del> pathUpdate.attr("d", "M" + -tickEndSize + "," + range[0] + "H0V" + range[1] + "H" + -tickEndSize);
<add> pathUpdate.attr("d", "M" + -tickEndSize + "," + range[0] + "H0V" + range[range.length - 1] + "H" + -tickEndSize);
<ide> break;
<ide> }
<ide> case "right": {
<ide> tickTransform = d3_svg_axisY;
<ide> subtickUpdate.attr("x2", tickMinorSize).attr("y2", 0);
<ide> tickUpdate.select("line").attr("x2", tickMajorSize).attr("y2", 0);
<ide> tickUpdate.select("text").attr("x", Math.max(tickMajorSize, 0) + tickPadding).attr("y", 0).attr("dy", ".32em").attr("text-anchor", "start");
<del> pathUpdate.attr("d", "M" + tickEndSize + "," + range[0] + "H0V" + range[1] + "H" + tickEndSize);
<add> pathUpdate.attr("d", "M" + tickEndSize + "," + range[0] + "H0V" + range[range.length - 1] + "H" + tickEndSize);
<ide> break;
<ide> }
<ide> }
<ide><path>test/svg/axis-test.js
<ide> suite.addBatch({
<ide> g = d3.select("body").html("").append("svg:g").call(a),
<ide> path = g.selectAll("path");
<ide> assert.equal(path.attr("d"), "M10,6V0H90V6");
<add> },
<add> "can be an ordinal scale with explicit range": function(axis) {
<add> var a = axis().scale(d3.scale.ordinal().domain(["A", "B", "C"]).range([10, 50, 90])),
<add> g = d3.select("body").html("").append("svg:g").call(a),
<add> path = g.selectAll("path");
<add> assert.equal(path.attr("d"), "M10,6V0H90V6");
<ide> }
<ide> },
<ide> | 4 |
Javascript | Javascript | fix minor typo in comment | c38c1c503074af1b0aae7498b9381cb90cd63958 | <ide><path>src/ngMock/angular-mocks.js
<ide> angular.mock.$LogProvider = function() {
<ide> *
<ide> * *NOTE*: this is not an injectable instance, just a globally available mock class of `Date`.
<ide> *
<del> * Mock of the Date type which has its timezone specified via constroctor arg.
<add> * Mock of the Date type which has its timezone specified via constructor arg.
<ide> *
<ide> * The main purpose is to create Date-like instances with timezone fixed to the specified timezone
<ide> * offset, so that we can test code that depends on local timezone settings without dependency on | 1 |
PHP | PHP | fix remaining failing tests in exceptionrenderer | 4ed00b511fdefa79c584e76a59c11830b9925d31 | <ide><path>lib/Cake/Test/TestApp/View/Helper/BananaHelper.php
<ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
<ide> */
<ide> namespace TestApp\View\Helper;
<add>
<ide> use Cake\View\Helper;
<ide>
<ide> class BananaHelper extends Helper {
<ide><path>lib/Cake/Test/TestCase/Error/ExceptionRendererTest.php
<ide> public function testErrorMethodCoercion() {
<ide> * test that helpers in custom CakeErrorController are not lost
<ide> */
<ide> public function testCakeErrorHelpersNotLost() {
<add> Configure::write('App.namespace', 'TestApp');
<ide> $testApp = CAKE . 'Test/TestApp/';
<ide> App::build(array(
<ide> 'Controller' => array( | 2 |
Mixed | PHP | add some events to eloquent models | ca065823699720db2913254831d4ac3788c3e836 | <ide><path>laravel/database/eloquent/model.php
<ide> <?php namespace Laravel\Database\Eloquent;
<ide>
<ide> use Laravel\Str;
<add>use Laravel\Event;
<ide> use Laravel\Database;
<ide> use Laravel\Database\Eloquent\Relationships\Has_Many_And_Belongs_To;
<ide>
<ide> public function __construct($attributes = array(), $exists = false)
<ide> * Hydrate the model with an array of attributes.
<ide> *
<ide> * @param array $attributes
<add> * @param bool $raw
<ide> * @return Model
<ide> */
<del> public function fill($attributes)
<add> public function fill(array $attributes, $raw = false)
<ide> {
<del> $attributes = (array) $attributes;
<del>
<ide> foreach ($attributes as $key => $value)
<ide> {
<add> // If the "raw" flag is set, it means that we'll just load every value from
<add> // the array directly into the attributes, without any accessibility or
<add> // mutators being accounted for. What you pass in is what you get.
<add> if ($raw)
<add> {
<add> $this->set_attribute($key, $value);
<add>
<add> continue;
<add> }
<add>
<ide> // If the "accessible" property is an array, the developer is limiting the
<ide> // attributes that may be mass assigned, and we need to verify that the
<ide> // current attribute is included in that list of allowed attributes.
<ide> public function fill($attributes)
<ide> return $this;
<ide> }
<ide>
<add> /**
<add> * Fill the model with the contents of the array.
<add> *
<add> * No mutators or accessibility checks will be accounted for.
<add> *
<add> * @param array $attributes
<add> * @return Model
<add> */
<add> public function fill_raw(array $attributes)
<add> {
<add> return $this->fill($attributes, true);
<add> }
<add>
<ide> /**
<ide> * Set the accessible attributes for the given model.
<ide> *
<ide> * @param array $attributes
<ide> * @return void
<ide> */
<del> public static function accessible($attributes)
<add> public static function accessible($attributes = null)
<ide> {
<add> if (is_null($attributes)) return static::$accessible;
<add>
<ide> static::$accessible = $attributes;
<ide> }
<ide>
<ide> public function save()
<ide> $this->timestamp();
<ide> }
<ide>
<add> $this->fire_event('saving');
<add>
<ide> // If the model exists, we only need to update it in the database, and the update
<ide> // will be considered successful if there is one affected row returned from the
<ide> // fluent query instance. We'll set the where condition automatically.
<ide> public function save()
<ide> // dirty and subsequent calls won't hit the database.
<ide> $this->original = $this->attributes;
<ide>
<add> if ($result)
<add> {
<add> $this->fire_event('saved');
<add> }
<add>
<ide> return $result;
<ide> }
<ide>
<ide> public function delete()
<ide> {
<ide> if ($this->exists)
<ide> {
<del> return $this->query()->where(static::$key, '=', $this->get_key())->delete();
<add> $this->fire_event('deleting');
<add>
<add> $result = $this->query()->where(static::$key, '=', $this->get_key())->delete();
<add>
<add> $this->fire_event('deleted');
<add>
<add> return $result;
<ide> }
<ide> }
<ide>
<ide> public function to_array()
<ide> return $attributes;
<ide> }
<ide>
<add> /**
<add> * Fire a given event for the model.
<add> *
<add> * @param string $event
<add> * @return array
<add> */
<add> protected function fire_event($event)
<add> {
<add> $events = array("eloquent.{$event}", "eloquent.{$event}: ".get_class($this));
<add>
<add> Event::fire($events, array($this));
<add> }
<add>
<ide> /**
<ide> * Handle the dynamic retrieval of attributes and associations.
<ide> *
<ide><path>laravel/database/eloquent/query.php
<ide> <?php namespace Laravel\Database\Eloquent;
<ide>
<add>use Laravel\Event;
<ide> use Laravel\Database;
<ide> use Laravel\Database\Eloquent\Relationships\Has_Many_And_Belongs_To;
<ide>
<ide> public function hydrate($model, $results)
<ide> // We need to set the attributes manually in case the accessible property is
<ide> // set on the array which will prevent the mass assignemnt of attributes if
<ide> // we were to pass them in using the constructor or fill methods.
<del> foreach ($result as $key => $value)
<del> {
<del> $new->set_attribute($key, $value);
<del> }
<del>
<del> $new->original = $new->attributes;
<add> $new->fill_raw($result);
<ide>
<ide> $models[] = $new;
<ide> }
<ide><path>laravel/documentation/changes.md
<ide> - `Schema::drop` now accepts `$connection` as second parameter.
<ide> - Added `Input::merge` method.
<ide> - Added `Input::replace` method.
<add>- Added `eloquent.saved`, `eloquent.saving`, `eloquent.deleting`, and `eloquent.deleted` events to Eloquent models.
<ide>
<ide> <a name="upgrade-3.2"></a>
<ide> ## Upgrading From 3.1
<ide><path>laravel/event.php
<ide> public static function until($event, $parameters = array())
<ide> *
<ide> * // Fire the "start" event passing an array of parameters
<ide> * $responses = Event::fire('start', array('Laravel', 'Framework'));
<add> *
<add> * // Fire multiple events with the same parameters
<add> * $responses = Event::fire(array('start', 'loading'), $parameters);
<ide> * </code>
<ide> *
<del> * @param string $event
<del> * @param array $parameters
<del> * @param bool $halt
<add> * @param string|array $event
<add> * @param array $parameters
<add> * @param bool $halt
<ide> * @return array
<ide> */
<del> public static function fire($event, $parameters = array(), $halt = false)
<add> public static function fire($events, $parameters = array(), $halt = false)
<ide> {
<ide> $responses = array();
<ide>
<ide> public static function fire($event, $parameters = array(), $halt = false)
<ide> // If the event has listeners, we will simply iterate through them and call
<ide> // each listener, passing in the parameters. We will add the responses to
<ide> // an array of event responses and return the array.
<del> if (static::listeners($event))
<add> foreach ((array) $events as $event)
<ide> {
<del> foreach (static::$events[$event] as $callback)
<add> if (static::listeners($event))
<ide> {
<del> $response = call_user_func_array($callback, $parameters);
<del>
<del> // If the event is set to halt, we will return the first response
<del> // that is not null. This allows the developer to easily stack
<del> // events but still get the first valid response.
<del> if ($halt and ! is_null($response))
<add> foreach (static::$events[$event] as $callback)
<ide> {
<del> return $response;
<add> $response = call_user_func_array($callback, $parameters);
<add>
<add> // If the event is set to halt, we will return the first response
<add> // that is not null. This allows the developer to easily stack
<add> // events but still get the first valid response.
<add> if ($halt and ! is_null($response))
<add> {
<add> return $response;
<add> }
<add>
<add> // After the handler has been called, we'll add the response to
<add> // an array of responses and return the array to the caller so
<add> // all of the responses can be easily examined.
<add> $responses[] = $response;
<ide> }
<del>
<del> // After the handler has been called, we'll add the response to
<del> // an array of responses and return the array to the caller so
<del> // all of the responses can be easily examined.
<del> $responses[] = $response;
<ide> }
<ide> }
<ide> | 4 |
Java | Java | fix typereference#getname for cglib proxies | f2e9d112b1f2ce036f59746515595b47bc5613d0 | <ide><path>spring-core/src/main/java/org/springframework/aot/hint/SimpleTypeReference.java
<ide> static SimpleTypeReference of(String className) {
<ide> if (!className.contains("$")) {
<ide> return createTypeReference(className);
<ide> }
<del> String[] elements = className.split("\\$");
<add> String[] elements = className.split("(?<!\\$)\\$(?!\\$)");
<ide> SimpleTypeReference typeReference = createTypeReference(elements[0]);
<ide> for (int i = 1; i < elements.length; i++) {
<ide> typeReference = new SimpleTypeReference(typeReference.getPackageName(), elements[i], typeReference);
<ide><path>spring-core/src/test/java/org/springframework/aot/generate/GeneratedTypeReferenceTests.java
<ide> void createWithClassNameAndParent() {
<ide> });
<ide> }
<ide>
<add> @Test
<add> void nameOfCglibProxy() {
<add> TypeReference reference = GeneratedTypeReference.of(
<add> ClassName.get("com.example", "Test$$SpringCGLIB$$0"));
<add> assertThat(reference.getSimpleName()).isEqualTo("Test$$SpringCGLIB$$0");
<add> assertThat(reference.getEnclosingType()).isNull();
<add> }
<add>
<add> @Test
<add> void nameOfNestedCglibProxy() {
<add> TypeReference reference = GeneratedTypeReference.of(
<add> ClassName.get("com.example", "Test").nestedClass("Another$$SpringCGLIB$$0"));
<add> assertThat(reference.getSimpleName()).isEqualTo("Another$$SpringCGLIB$$0");
<add> assertThat(reference.getEnclosingType()).isNotNull();
<add> assertThat(reference.getEnclosingType().getSimpleName()).isEqualTo("Test");
<add> }
<add>
<ide> @Test
<ide> void equalsWithIdenticalCanonicalNameIsTrue() {
<ide> assertThat(GeneratedTypeReference.of(ClassName.get("java.lang", "String")))
<ide><path>spring-core/src/test/java/org/springframework/aot/hint/SimpleTypeReferenceTests.java
<ide> static Stream<Arguments> arrays() {
<ide> Arguments.of(SimpleTypeReference.of("com.example.Test[]"), "com.example.Test[]"));
<ide> }
<ide>
<add> @Test
<add> void nameOfCglibProxy() {
<add> TypeReference reference = TypeReference.of("com.example.Test$$SpringCGLIB$$0");
<add> assertThat(reference.getSimpleName()).isEqualTo("Test$$SpringCGLIB$$0");
<add> assertThat(reference.getEnclosingType()).isNull();
<add> }
<add>
<add> @Test
<add> void nameOfNestedCglibProxy() {
<add> TypeReference reference = TypeReference.of("com.example.Test$Another$$SpringCGLIB$$0");
<add> assertThat(reference.getSimpleName()).isEqualTo("Another$$SpringCGLIB$$0");
<add> assertThat(reference.getEnclosingType()).isNotNull();
<add> assertThat(reference.getEnclosingType().getSimpleName()).isEqualTo("Test");
<add> }
<add>
<ide> @Test
<ide> void typeReferenceInRootPackage() {
<ide> TypeReference type = SimpleTypeReference.of("MyRootClass"); | 3 |
Javascript | Javascript | fix $orderby example and e2e test | c02ef92630308cda6148de74e5561aeecff5f24d | <ide><path>src/apis.js
<ide> var angularArray = {
<ide> {name:'Adam', phone:'555-5678', age:35},
<ide> {name:'Julie', phone:'555-8765', age:29}]"></div>
<ide>
<del> <pre>Sorting predicate = {{predicate}} reverse = {{reverse}}</pre>
<add> <pre>Sorting predicate = {{predicate}}; reverse = {{reverse}}</pre>
<ide> <hr/>
<ide> [ <a href="" ng:click="predicate=''">unsorted</a> ]
<ide> <table ng:init="predicate='-age'">
<ide> <tr>
<ide> <th><a href="" ng:click="predicate = 'name'; reverse=false">Name</a>
<ide> (<a href ng:click="predicate = '-name'; reverse=false">^</a>)</th>
<del> <th><a href="" ng:click="predicate = 'phone'; reverse=!reverse">Phone</a></th>
<add> <th><a href="" ng:click="predicate = 'phone'; reverse=!reverse">Phone Number</a></th>
<ide> <th><a href="" ng:click="predicate = 'age'; reverse=!reverse">Age</a></th>
<ide> <tr>
<ide> <tr ng:repeat="friend in friends.$orderBy(predicate, reverse)">
<ide> var angularArray = {
<ide> </doc:source>
<ide> <doc:scenario>
<ide> it('should be reverse ordered by aged', function() {
<del> expect(binding('predicate')).toBe('Sorting predicate = -age');
<add> expect(binding('predicate')).toBe('Sorting predicate = -age; reverse = ');
<ide> expect(repeater('.doc-example-live table', 'friend in friends').column('friend.age')).
<ide> toEqual(['35', '29', '21', '19', '10']);
<ide> expect(repeater('.doc-example-live table', 'friend in friends').column('friend.name')). | 1 |
Javascript | Javascript | remove an unnecessary assignment | 88de88b5a6289ff4f56d13b6b4e11759945f2177 | <ide><path>lib/_http_outgoing.js
<ide> OutgoingMessage.prototype.end = function(data, encoding, callback) {
<ide> var ret;
<ide> if (data) {
<ide> // Normal body write.
<del> ret = this.write(data, encoding);
<add> this.write(data, encoding);
<ide> }
<ide>
<ide> if (this._hasBody && this.chunkedEncoding) { | 1 |
Text | Text | add changelog entry | 3699ec9d1bd48332d1aef7def38f913c4773257c | <ide><path>activesupport/CHANGELOG.md
<add>* Add "event object" support to the notification system.
<add> Before this change, end users were forced to create hand made arsenal
<add> event objects on their own, like this:
<add>
<add> ActiveSupport::Notifications.subscribe('wait') do |*args|
<add> @event = ActiveSupport::Notifications::Event.new(*args)
<add> end
<add>
<add> ActiveSupport::Notifications.instrument('wait') do
<add> sleep 1
<add> end
<add>
<add> @event.duration # => 1000.138
<add>
<add> After this change, if the block passed to `subscribe` only takes one
<add> parameter, the framework will yield an event object to the block. Now
<add> end users are no longer required to make their own:
<add>
<add> ActiveSupport::Notifications.subscribe('wait') do |event|
<add> @event = event
<add> end
<add>
<add> ActiveSupport::Notifications.instrument('wait') do
<add> sleep 1
<add> end
<add>
<add> p @event.allocations # => 7
<add> p @event.cpu_time # => 0.256
<add> p @event.idle_time # => 1003.2399
<add>
<add> Now you can enjoy event objects without making them yourself. Neat!
<add>
<add> *Aaron "t.lo" Patterson*
<add>
<ide> * Add cpu_time, idle_time, and allocations to Event
<ide>
<ide> *Eileen M. Uchitelle*, *Aaron Patterson* | 1 |
PHP | PHP | fix typo on docblock | 2e10175326bbdaeca2fdc9ad1b49dda62031bb65 | <ide><path>src/Illuminate/Cache/Console/CacheTableCommand.php
<ide> class CacheTableCommand extends Command
<ide> protected $composer;
<ide>
<ide> /**
<del> * Create a new session table command instance.
<add> * Create a new cache table command instance.
<ide> *
<ide> * @param \Illuminate\Filesystem\Filesystem $files
<ide> * @param \Illuminate\Foundation\Composer $composer | 1 |
PHP | PHP | fix parse error | 2f826088f5e78ab4a75614e39bc62085d64f081d | <ide><path>src/Http/ControllerFactory.php
<ide>
<ide> class_alias(
<ide> 'Cake\Controller\ControllerFactory',
<del> 'Cake\Http\ControllerFactory',
<add> 'Cake\Http\ControllerFactory'
<ide> );
<ide> deprecationWarning(
<ide> 'Use Cake\Controller\ControllerFactory instead of Cake\Http\ControllerFactory.'
<ide><path>src/Routing/Exception/MissingControllerException.php
<ide>
<ide> class_alias(
<ide> 'Cake\Http\Exception\MissingControllerException',
<del> 'Cake\Routing\Exception\MissingControllerException',
<add> 'Cake\Routing\Exception\MissingControllerException'
<ide> );
<ide> deprecationWarning(
<ide> 'Use Cake\Http\Exception\MissingControllerException instead of Cake\Routing\Exception\MissingControllerException.' | 2 |
Javascript | Javascript | add disable_minification environment variable. | 847877e737a328ae45e731b03dccf33bc0b58471 | <ide><path>ember-cli-build.js
<ide> function buildBundles(packagesES, dependenciesES, templateCompilerDependenciesES
<ide> return new MergeTrees(
<ide> [
<ide> emberProdBundle,
<del> emberMinBundle,
<add> process.env.DISABLE_MINIFICATION !== '1' && emberMinBundle,
<ide> emberProdTestsBundle,
<ide> buildBundle('ember.debug.js', emberDebugFiles, vendor),
<ide> buildBundle('ember-tests.js', emberTestsFiles, vendor), | 1 |
PHP | PHP | update typhints for database/ | 1f46639b4bdcf5ae0855e8fcefbe78acae10a189 | <ide><path>src/Database/Connection.php
<ide> public function isQueryLoggingEnabled(): bool
<ide> * @param \Cake\Database\Log\QueryLogger|null $logger Logger object
<ide> * @return $this
<ide> */
<del> public function setLogger($logger)
<add> public function setLogger(?QueryLogger $logger)
<ide> {
<ide> $this->_logger = $logger;
<ide>
<ide> public function setLogger($logger)
<ide> *
<ide> * @return \Cake\Database\Log\QueryLogger logger instance
<ide> */
<del> public function getLogger()
<add> public function getLogger(): QueryLogger
<ide> {
<ide> if ($this->_logger === null) {
<ide> $this->_logger = new QueryLogger();
<ide><path>src/Database/Dialect/PostgresDialectTrait.php
<ide> namespace Cake\Database\Dialect;
<ide>
<ide> use Cake\Database\Expression\FunctionExpression;
<add>use Cake\Database\Query;
<ide> use Cake\Database\Schema\BaseSchema;
<ide> use Cake\Database\Schema\PostgresSchema;
<ide> use Cake\Database\SqlDialectTrait;
<ide> trait PostgresDialectTrait
<ide> * @param \Cake\Database\Query $query The query to be transformed
<ide> * @return \Cake\Database\Query
<ide> */
<del> protected function _transformDistinct($query)
<add> protected function _transformDistinct(Query $query): Query
<ide> {
<ide> return $query;
<ide> }
<ide> protected function _transformDistinct($query)
<ide> * @param \Cake\Database\Query $query The query to translate.
<ide> * @return \Cake\Database\Query
<ide> */
<del> protected function _insertQueryTranslator($query)
<add> protected function _insertQueryTranslator(Query $query): Query
<ide> {
<ide> if (!$query->clause('epilog')) {
<ide> $query->epilog('RETURNING *');
<ide> protected function _insertQueryTranslator($query)
<ide> *
<ide> * @return array
<ide> */
<del> protected function _expressionTranslators()
<add> protected function _expressionTranslators(): array
<ide> {
<ide> $namespace = 'Cake\Database\Expression';
<ide>
<ide> protected function _expressionTranslators()
<ide> * to postgres SQL.
<ide> * @return void
<ide> */
<del> protected function _transformFunctionExpression(FunctionExpression $expression)
<add> protected function _transformFunctionExpression(FunctionExpression $expression): void
<ide> {
<ide> switch ($expression->getName()) {
<ide> case 'CONCAT':
<ide><path>src/Database/Dialect/SqliteDialectTrait.php
<ide> trait SqliteDialectTrait
<ide> *
<ide> * @return array
<ide> */
<del> protected function _expressionTranslators()
<add> protected function _expressionTranslators(): array
<ide> {
<ide> $namespace = 'Cake\Database\Expression';
<ide>
<ide> protected function _expressionTranslators()
<ide> * to translate for SQLite.
<ide> * @return void
<ide> */
<del> protected function _transformFunctionExpression(FunctionExpression $expression)
<add> protected function _transformFunctionExpression(FunctionExpression $expression): void
<ide> {
<ide> switch ($expression->getName()) {
<ide> case 'CONCAT':
<ide><path>src/Database/Dialect/SqlserverDialectTrait.php
<ide> trait SqlserverDialectTrait
<ide> * @param \Cake\Database\Query $query The query to translate
<ide> * @return \Cake\Database\Query The modified query
<ide> */
<del> protected function _selectQueryTranslator($query)
<add> protected function _selectQueryTranslator(Query $query): Query
<ide> {
<ide> $limit = $query->clause('limit');
<ide> $offset = $query->clause('offset');
<ide> protected function _selectQueryTranslator($query)
<ide> *
<ide> * @return int
<ide> */
<del> protected function version()
<add> protected function version(): int
<ide> {
<ide> $this->connect();
<ide>
<ide> protected function version()
<ide> * be used.
<ide> *
<ide> * @param \Cake\Database\Query $original The query to wrap in a subquery.
<del> * @param int $limit The number of rows to fetch.
<del> * @param int $offset The number of rows to offset.
<add> * @param int|null $limit The number of rows to fetch.
<add> * @param int|null $offset The number of rows to offset.
<ide> * @return \Cake\Database\Query Modified query object.
<ide> */
<del> protected function _pagingSubquery($original, $limit, $offset)
<add> protected function _pagingSubquery(Query $original, ?int $limit, ?int $offset): Query
<ide> {
<ide> $field = '_cake_paging_._cake_page_rownum_';
<ide>
<ide> protected function _pagingSubquery($original, $limit, $offset)
<ide> * @param \Cake\Database\Query $original The query to be transformed
<ide> * @return \Cake\Database\Query
<ide> */
<del> protected function _transformDistinct($original)
<add> protected function _transformDistinct(Query $original): Query
<ide> {
<ide> if (!is_array($original->clause('distinct'))) {
<ide> return $original;
<ide> protected function _transformDistinct($original)
<ide> *
<ide> * @return array
<ide> */
<del> protected function _expressionTranslators()
<add> protected function _expressionTranslators(): array
<ide> {
<ide> $namespace = 'Cake\Database\Expression';
<ide>
<ide> protected function _expressionTranslators()
<ide> * @param \Cake\Database\Expression\FunctionExpression $expression The function expression to convert to TSQL.
<ide> * @return void
<ide> */
<del> protected function _transformFunctionExpression(FunctionExpression $expression)
<add> protected function _transformFunctionExpression(FunctionExpression $expression): void
<ide> {
<ide> switch ($expression->getName()) {
<ide> case 'CONCAT':
<ide><path>src/Database/Dialect/TupleComparisonTranslatorTrait.php
<ide> trait TupleComparisonTranslatorTrait
<ide> * @param \Cake\Database\Query $query The query to update.
<ide> * @return void
<ide> */
<del> protected function _transformTupleComparison(TupleComparison $expression, $query)
<add> protected function _transformTupleComparison(TupleComparison $expression, Query $query): void
<ide> {
<ide> $fields = $expression->getField();
<ide>
<ide><path>src/Database/Expression/Comparison.php
<ide> protected function _bindValue($value, ValueBinder $generator, $type): string
<ide> * @param string|array|null $type the type to cast values to
<ide> * @return string
<ide> */
<del> protected function _flattenValue(iterable $value, $generator, $type = 'string'): string
<add> protected function _flattenValue(iterable $value, ValueBinder $generator, $type = 'string'): string
<ide> {
<ide> $parts = [];
<ide> if (is_array($value)) {
<ide><path>src/Database/Expression/FunctionExpression.php
<ide> public function getName(): string
<ide> * @see \Cake\Database\Expression\FunctionExpression::__construct() for more details.
<ide> * @return $this
<ide> */
<del> public function add($params, $types = [], bool $prepend = false)
<add> public function add($params, array $types = [], bool $prepend = false)
<ide> {
<ide> $put = $prepend ? 'array_unshift' : 'array_push';
<ide> $typeMap = $this->getTypeMap()->setTypes($types);
<ide><path>src/Database/Expression/QueryExpression.php
<ide> public function getConjunction(): string
<ide> * @see \Cake\Database\Query::where() for examples on conditions
<ide> * @return $this
<ide> */
<del> public function add($conditions, $types = [])
<add> public function add($conditions, array $types = [])
<ide> {
<ide> if (is_string($conditions)) {
<ide> $this->_conditions[] = $conditions;
<ide><path>src/Database/Query.php
<ide> public function __clone()
<ide> *
<ide> * @return string
<ide> */
<del> public function __toString()
<add> public function __toString(): string
<ide> {
<ide> return $this->sql();
<ide> }
<ide> public function __toString()
<ide> *
<ide> * @return array
<ide> */
<del> public function __debugInfo()
<add> public function __debugInfo(): array
<ide> {
<ide> try {
<ide> set_error_handler(function ($errno, $errstr): void {
<ide><path>src/Database/QueryCompiler.php
<ide> public function compile(Query $query, ValueBinder $generator): string
<ide> */
<ide> protected function _sqlCompiler(string &$sql, Query $query, ValueBinder $generator): Closure
<ide> {
<del> return function ($parts, $name) use (&$sql, $query, $generator) {
<add> return function ($parts, $name) use (&$sql, $query, $generator): ?string {
<ide> if (!isset($parts) ||
<ide> ((is_array($parts) || $parts instanceof Countable) && !count($parts))
<ide> ) {
<del> return;
<add> return null;
<ide> }
<ide> if ($parts instanceof ExpressionInterface) {
<ide> $parts = [$parts->sql($generator)];
<ide><path>src/Database/Schema/TableSchema.php
<ide> public function addConstraint(string $name, $attrs): TableSchemaInterface
<ide> /**
<ide> * @inheritDoc
<ide> */
<del> public function dropConstraint(string $name)
<add> public function dropConstraint(string $name): TableSchemaInterface
<ide> {
<ide> if (isset($this->_constraints[$name])) {
<ide> unset($this->_constraints[$name]);
<ide><path>src/Database/Schema/TableSchemaInterface.php
<ide> public function primaryKey(): array;
<ide> * @param string $name The name of the index.
<ide> * @param array|string $attrs The attributes for the index.
<ide> * If string it will be used as `type`.
<del> * @return \Cake\Database\Schema\TableSchemaInterface
<add> * @return self
<ide> */
<del> public function addIndex(string $name, $attrs);
<add> public function addIndex(string $name, $attrs): self;
<ide>
<ide> /**
<ide> * Read information about an index based on name.
<ide> public function indexes(): array;
<ide> * @param string $name The name of the constraint.
<ide> * @param array|string $attrs The attributes for the constraint.
<ide> * If string it will be used as `type`.
<del> * @return \Cake\Database\Schema\TableSchemaInterface
<add> * @return self
<ide> */
<del> public function addConstraint(string $name, $attrs);
<add> public function addConstraint(string $name, $attrs): self;
<ide>
<ide> /**
<ide> * Read information about a constraint based on name.
<ide> public function getConstraint(string $name): ?array;
<ide> * Remove a constraint.
<ide> *
<ide> * @param string $name Name of the constraint to remove
<del> * @return \Cake\Database\Schema\TableSchemaInterface
<add> * @return self
<ide> */
<del> public function dropConstraint(string $name);
<add> public function dropConstraint(string $name): self;
<ide>
<ide> /**
<ide> * Get the names of all the constraints in the table.
<ide><path>src/Database/SchemaCache.php
<ide> namespace Cake\Database;
<ide>
<ide> use Cake\Cache\Cache;
<add>use Cake\Database\Schema\CachedCollection;
<ide>
<ide> /**
<ide> * Schema Cache.
<ide> public function clear(?string $name = null): array
<ide> * @return \Cake\Database\Schema\CachedCollection
<ide> * @throws \RuntimeException If given connection object is not compatible with schema caching
<ide> */
<del> public function getSchema(Connection $connection)
<add> public function getSchema(Connection $connection): CachedCollection
<ide> {
<ide> $config = $connection->config();
<ide> if (empty($config['cacheMetadata'])) {
<ide><path>src/Database/SqlDialectTrait.php
<ide> public function queryTranslator(string $type): callable
<ide> return $query;
<ide> }
<ide>
<del> $query->traverseExpressions(function ($expression) use ($translators, $query) {
<add> $query->traverseExpressions(function ($expression) use ($translators, $query): void {
<ide> foreach ($translators as $class => $method) {
<ide> if ($expression instanceof $class) {
<ide> $this->{$method}($expression, $query);
<ide><path>src/Database/Type/IntegerType.php
<ide> class IntegerType extends BaseType implements BatchCastingInterface
<ide> * @param mixed $value Value to check
<ide> * @return void
<ide> */
<del> protected function checkNumeric($value)
<add> protected function checkNumeric($value): void
<ide> {
<ide> if (!is_numeric($value)) {
<ide> throw new InvalidArgumentException(sprintf(
<ide><path>src/Database/TypedResultInterface.php
<ide> public function getReturnType(): string;
<ide> * Set the return type of the expression
<ide> *
<ide> * @param string $type The type name to use.
<del> * @return void
<add> * @return $this
<ide> */
<ide> public function setReturnType(string $type);
<ide> }
<ide><path>src/Datasource/ConnectionInterface.php
<ide> */
<ide> namespace Cake\Datasource;
<ide>
<add>use Cake\Database\Log\QueryLogger;
<add>
<ide> /**
<ide> * This interface defines the methods you can depend on in
<ide> * a connection.
<ide> interface ConnectionInterface
<ide> * @param \Cake\Database\Log\QueryLogger|null $logger Logger object
<ide> * @return $this
<ide> */
<del> public function setLogger($logger);
<add> public function setLogger(?QueryLogger $logger);
<ide>
<ide> /**
<ide> * Gets the current logger object.
<ide> *
<ide> * @return \Cake\Database\Log\QueryLogger logger instance
<ide> */
<del> public function getLogger();
<add> public function getLogger(): QueryLogger;
<ide>
<ide> /**
<ide> * Get the configuration name for this connection. | 17 |
Python | Python | handle nan and inf in assert_almost_equal | f49d6d36b666eaff6a82614badf452df1844e33b | <ide><path>numpy/testing/tests/test_utils.py
<ide> def test_recarrays(self):
<ide> self._test_not_equal(c, b)
<ide>
<ide>
<del>class TestAlmostEqual(_GenericTest, unittest.TestCase):
<add>class TestArrayAlmostEqual(_GenericTest, unittest.TestCase):
<ide> def setUp(self):
<ide> self._assert_func = assert_array_almost_equal
<ide>
<add>class TestAlmostEqual(_GenericTest, unittest.TestCase):
<add> def setUp(self):
<add> self._assert_func = assert_almost_equal
<add>
<add> def test_nan_item(self):
<add> self._assert_func(np.nan, np.nan)
<add> self.failUnlessRaises(AssertionError,
<add> lambda : self._assert_func(np.nan, 1))
<add> self.failUnlessRaises(AssertionError,
<add> lambda : self._assert_func(np.nan, np.inf))
<add> self.failUnlessRaises(AssertionError,
<add> lambda : self._assert_func(np.inf, np.nan))
<add>
<add> def test_inf_item(self):
<add> self._assert_func(np.inf, np.inf)
<add> self._assert_func(-np.inf, -np.inf)
<add>
<add> def test_simple_item(self):
<add> self._test_not_equal(1, 2)
<ide>
<ide> class TestRaises(unittest.TestCase):
<ide> def setUp(self):
<ide><path>numpy/testing/utils.py
<ide> import sys
<ide> import re
<ide> import operator
<add>import types
<ide> from nosetester import import_nose
<ide>
<ide> __all__ = ['assert_equal', 'assert_almost_equal','assert_approx_equal',
<ide> def assert_(val, msg='') :
<ide> if not val :
<ide> raise AssertionError(msg)
<ide>
<add>def gisnan(x):
<add> """like isnan, but always raise an error if type not supported instead of
<add> returning a TypeError object.
<add>
<add> Notes
<add> -----
<add> isnan and other ufunc sometimes return a NotImplementedType object instead
<add> of raising any exception. This function is a wrapper to make sure an
<add> exception is always raised.
<add>
<add> This should be removed once this problem is solved at the Ufunc level."""
<add> from numpy.core import isnan
<add> st = isnan(x)
<add> if isinstance(st, types.NotImplementedType):
<add> raise TypeError("isnan not supported for this type")
<add> return st
<add>
<add>def gisfinite(x):
<add> """like isfinite, but always raise an error if type not supported instead of
<add> returning a TypeError object.
<add>
<add> Notes
<add> -----
<add> isfinite and other ufunc sometimes return a NotImplementedType object instead
<add> of raising any exception. This function is a wrapper to make sure an
<add> exception is always raised.
<add>
<add> This should be removed once this problem is solved at the Ufunc level."""
<add> from numpy.core import isfinite
<add> st = isfinite(x)
<add> if isinstance(st, types.NotImplementedType):
<add> raise TypeError("isfinite not supported for this type")
<add> return st
<ide>
<ide> def rand(*args):
<ide> """Returns an array of random numbers with the given shape.
<ide> def assert_almost_equal(actual,desired,decimal=7,err_msg='',verbose=True):
<ide> if isinstance(actual, ndarray) or isinstance(desired, ndarray):
<ide> return assert_array_almost_equal(actual, desired, decimal, err_msg)
<ide> msg = build_err_msg([actual, desired], err_msg, verbose=verbose)
<add>
<add> try:
<add> # If one of desired/actual is not finite, handle it specially here:
<add> # check that both are nan if any is a nan, and test for equality
<add> # otherwise
<add> if not (gisfinite(desired) and gisfinite(actual)):
<add> if gisnan(desired) or gisnan(actual):
<add> if not (gisnan(desired) and gisnan(actual)):
<add> raise AssertionError(msg)
<add> else:
<add> if not desired == actual:
<add> raise AssertionError(msg)
<add> return
<add> except TypeError:
<add> pass
<ide> if round(abs(desired - actual),decimal) != 0 :
<ide> raise AssertionError(msg)
<ide> | 2 |
Javascript | Javascript | simplify timeout handling | cad3a21c1d0d216ba0d0b4b8eaa7a468fab7c2a9 | <ide><path>lib/_http_client.js
<ide> function responseOnEnd() {
<ide> const res = this;
<ide> const req = this.req;
<ide>
<add> if (req.socket && req.timeoutCb) {
<add> req.socket.removeListener('timeout', emitRequestTimeout);
<add> }
<add>
<ide> req._ended = true;
<ide> if (!req.shouldKeepAlive || req.finished)
<ide> responseKeepAlive(res, req);
<ide> function tickOnSocket(req, socket) {
<ide> req.emit('socket', socket);
<ide> }
<ide>
<add>function emitRequestTimeout() {
<add> const req = this._httpMessage;
<add> if (req) {
<add> req.emit('timeout');
<add> }
<add>}
<add>
<ide> function listenSocketTimeout(req) {
<ide> if (req.timeoutCb) {
<ide> return;
<ide> }
<del> const emitRequestTimeout = () => req.emit('timeout');
<ide> // Set timeoutCb so it will get cleaned up on request end.
<ide> req.timeoutCb = emitRequestTimeout;
<ide> // Delegate socket timeout event.
<ide> function listenSocketTimeout(req) {
<ide> socket.once('timeout', emitRequestTimeout);
<ide> });
<ide> }
<del> // Remove socket timeout listener after response end.
<del> req.once('response', (res) => {
<del> res.once('end', () => {
<del> req.socket.removeListener('timeout', emitRequestTimeout);
<del> });
<del> });
<ide> }
<ide>
<ide> ClientRequest.prototype.onSocket = function onSocket(socket) { | 1 |
PHP | PHP | add explode test | 2e077822e304a1d6bc4cb7681a960dfdd2b71393 | <ide><path>tests/Support/SupportStringableTest.php
<ide> public function testPadRight()
<ide> $this->assertSame('❤MultiByte☆ ', (string) $this->stringable('❤MultiByte☆')->padRight(16));
<ide> }
<ide>
<add> public function testExplode()
<add> {
<add> $this->assertInstanceOf(Collection::class, $this->stringable("Foo Bar Baz")->explode(" "));
<add>
<add> $this->assertSame('["Foo","Bar","Baz"]', (string) $this->stringable("Foo Bar Baz")->explode(" "));
<add>
<add> // with limit
<add> $this->assertSame('["Foo","Bar Baz"]', (string) $this->stringable("Foo Bar Baz")->explode(" ", 2));
<add> $this->assertSame('["Foo","Bar"]', (string) $this->stringable("Foo Bar Baz")->explode(" ", -1));
<add>
<add> }
<add>
<ide> public function testChunk()
<ide> {
<ide> $chunks = $this->stringable('foobarbaz')->split(3); | 1 |
Python | Python | add test for too-deep non-object deprecation | 4ac514f8e710d75b06ac9916874c5137a27196d1 | <ide><path>numpy/core/tests/test_deprecations.py
<ide> def test_deprecate_ragged_arrays():
<ide> np.array(arg)
<ide>
<ide>
<add>class TestTooDeepDeprecation(_VisibleDeprecationTestCase):
<add> # NumPy 1.20, 2020-05-08
<add> # This is a bit similar to the above ragged array deprecation case.
<add> message = re.escape("Creating an ndarray from nested sequences exceeding")
<add>
<add> def test_deprecation(self):
<add> nested = [1]
<add> for i in range(np.MAXDIMS - 1):
<add> nested = [nested]
<add> self.assert_not_deprecated(np.array, args=(nested,))
<add> self.assert_not_deprecated(np.array,
<add> args=(nested,), kwargs=dict(dtype=object))
<add>
<add> self.assert_deprecated(np.array, args=([nested],))
<add>
<add>
<ide> class TestToString(_DeprecationTestCase):
<ide> # 2020-03-06 1.19.0
<ide> message = re.escape("tostring() is deprecated. Use tobytes() instead.") | 1 |
Text | Text | add v3.17.2 to changelog.md | 1370ef5ebea1511b3e225b5704c41edde6caa7eb | <ide><path>CHANGELOG.md
<ide> - [#18774](https://github.com/emberjs/ember.js/pull/18774) [BUGFIX] Suspend observer deactivation during property changes
<ide> - [#18785](https://github.com/emberjs/ember.js/pull/18785) Drop Node 8 support.
<ide>
<add>### v3.17.2 (March 26, 2020)
<add>
<add>- [#18837](https://github.com/emberjs/ember.js/pull/18837) [BUGFIX] Fix `willDestroy` on class based helpers.
<add>- [#18838](https://github.com/emberjs/ember.js/pull/18838) [BUGFIX] Ensure destructors (e.g. `will-destroy` modifier, `@ember/component`s with `willDestroyElement`, etc) fire when used within an `{{#each}}` block.
<add>
<ide> ### v3.17.1 (March 22, 2020)
<ide>
<ide> - [#18809](https://github.com/emberjs/ember.js/pull/18809) [BUGFIX] Do not error (RE: `elementId` changing) if `elementId` is not changed | 1 |
Ruby | Ruby | make files in paths consistent | fe6573e7184cb7e55b4045d2b61696315e13a201 | <ide><path>railties/lib/rails/engine/configuration.rb
<ide> def paths
<ide> paths.add "config/routes", :glob => "**/*.rb"
<ide> paths.add "db"
<ide> paths.add "db/migrate"
<del> paths.add "db/seeds", :with => "db/seeds.rb"
<add> paths.add "db/seeds.rb"
<ide> paths.add "vendor", :load_path => true
<ide> paths.add "vendor/assets", :glob => "*"
<ide> paths | 1 |
Javascript | Javascript | convert functions filter name to camelcase | 22d855a182be5ee9938bba871d43311bac4643b0 | <ide><path>glances/outputs/static/js/filters.js
<ide> import angular from "angular";
<ide> import _ from "lodash";
<ide>
<del>function min_size_filter() {
<add>function minSizeFilter() {
<ide> return function (input, max) {
<ide> var max = max || 8;
<ide> if (input.length > max) {
<ide> function min_size_filter() {
<ide> };
<ide> }
<ide>
<del>function exclamation_filter() {
<add>function exclamationFilter() {
<ide> return function (input) {
<ide> if (input === undefined || input === '') {
<ide> return '?';
<ide> function exclamation_filter() {
<ide> };
<ide> }
<ide>
<del>function bytes_filter() {
<add>function bytesFilter() {
<ide> return function (bytes, low_precision) {
<ide> low_precision = low_precision || false;
<ide> if (isNaN(parseFloat(bytes)) || !isFinite(bytes) || bytes == 0) {
<ide> function bytes_filter() {
<ide> }
<ide> }
<ide>
<del>function bits_filter($filter) {
<add>function bitsFilter($filter) {
<ide> return function (bits, low_precision) {
<ide> bits = Math.round(bits) * 8;
<ide> return $filter('bytes')(bits, low_precision) + 'b';
<ide> }
<ide> }
<ide>
<del>function leftPad_filter() {
<add>function leftPadFilter() {
<ide> return function (value, length, chars) {
<ide> length = length || 0;
<ide> chars = chars || ' ';
<ide> return _.padStart(value, length, chars);
<ide> }
<ide> }
<ide>
<del>function timemillis_filter() {
<add>function timemillisFilter() {
<ide> return function (array) {
<ide> var sum = 0.0;
<ide> for (var i = 0; i < array.length; i++) {
<ide> function timemillis_filter() {
<ide> }
<ide> }
<ide>
<del>function timedelta_filter($filter) {
<add>function timedeltaFilter($filter) {
<ide> return function (value) {
<ide> var sum = $filter('timemillis')(value);
<ide> var d = new Date(sum);
<ide> function timedelta_filter($filter) {
<ide> }
<ide>
<ide> export default angular.module("glancesApp")
<del> .filter("min_size", min_size_filter)
<del> .filter("exclamation", exclamation_filter)
<del> .filter("bytes", bytes_filter)
<del> .filter("bits", bits_filter)
<del> .filter("leftPad", leftPad_filter)
<del> .filter("timemillis", timemillis_filter)
<del> .filter("timedelta", timedelta_filter);
<add> .filter("min_size", minSizeFilter)
<add> .filter("exclamation", exclamationFilter)
<add> .filter("bytes", bytesFilter)
<add> .filter("bits", bitsFilter)
<add> .filter("leftPad", leftPadFilter)
<add> .filter("timemillis", timemillisFilter)
<add> .filter("timedelta", timedeltaFilter); | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.