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
|
---|---|---|---|---|---|
Java | Java | collect more diagnostics when `addviewat` crashes | 7bf61964084648bbde603c95f7c4734d30387a10 | <ide><path>ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/MountingManager.java
<ide> public void addViewAt(int parentTag, int tag, int index) {
<ide> logViewHierarchy(parentView);
<ide> }
<ide>
<del> getViewGroupManager(parentViewState).addView(parentView, view, index);
<add> try {
<add> getViewGroupManager(parentViewState).addView(parentView, view, index);
<add> } catch (IllegalStateException e) {
<add> // Wrap error with more context for debugging
<add> throw new IllegalStateException(
<add> "addViewAt: failed to insert view ["
<add> + tag
<add> + "] into parent ["
<add> + parentTag
<add> + "] at index "
<add> + index,
<add> e);
<add> }
<ide>
<ide> // Display children after inserting
<ide> if (SHOW_CHANGED_VIEW_HIERARCHIES) { | 1 |
Python | Python | fix example for recurrent layer | b235f91cc74b8e4f76d81378ab546a762449f13c | <ide><path>keras/layers/recurrent.py
<ide> class Recurrent(Layer):
<ide> # as the first layer in a Sequential model
<ide> model = Sequential()
<ide> model.add(LSTM(32, input_shape=(10, 64)))
<del> # now model.output_shape == (None, 10, 32)
<add> # now model.output_shape == (None, 32)
<ide> # note: `None` is the batch dimension.
<ide>
<ide> # the following is identical: | 1 |
Javascript | Javascript | remove unnecessary yuidoc markup | 3173a49a82a7d80d189c03a257196c834959d0e5 | <ide><path>packages/ember-routing/lib/system/transition_event.js
<ide> */
<ide>
<ide>
<del>/**
<add>/*
<ide> A TransitionEvent is passed as the argument for `transitionTo`
<ide> events and contains information about an attempted transition
<ide> that can be modified or decorated by leafier `transitionTo` event
<ide> */
<ide> Ember.TransitionEvent = Ember.Object.extend({
<ide>
<del> /**
<add> /*
<ide> The Ember.Route method used to perform the transition. Presently,
<ide> the only valid values are 'transitionTo' and 'replaceWith'.
<ide> */
<ide> Ember.TransitionEvent = Ember.Object.extend({
<ide> this.contexts = this.contexts || [];
<ide> },
<ide>
<del> /**
<add> /*
<ide> Convenience method that returns an array that can be used for
<ide> legacy `transitionTo` and `replaceWith`.
<ide> */
<ide> Ember.TransitionEvent = Ember.Object.extend({
<ide>
<ide>
<ide> Ember.TransitionEvent.reopenClass({
<del> /**
<add> /*
<ide> This is the default transition event handler that will be injected
<ide> into ApplicationRoute. The context, like all route event handlers in
<ide> the events hash, will be an `Ember.Route`.
<ide><path>packages/ember-views/lib/system/utils.js
<ide> @submodule ember-views
<ide> */
<ide>
<del>/*** BEGIN METAMORPH HELPERS ***/
<add>/* BEGIN METAMORPH HELPERS */
<ide>
<ide> // Internet Explorer prior to 9 does not allow setting innerHTML if the first element
<ide> // is a "zero-scope" element. This problem can be worked around by making
<ide> var setInnerHTMLWithoutFix = function(element, html) {
<ide> }
<ide> };
<ide>
<del>/*** END METAMORPH HELPERS */
<add>/* END METAMORPH HELPERS */
<ide>
<ide>
<ide> var innerHTMLTags = {}; | 2 |
Ruby | Ruby | move some constants from env to compiler constants | 09f8c54f8388412250a6e847989992a78953b63f | <ide><path>Library/Homebrew/compilers.rb
<ide> module CompilerConstants
<ide> GNU_GCC_VERSIONS = %w[4.3 4.4 4.5 4.6 4.7 4.8 4.9 5]
<ide> GNU_GCC_REGEXP = /^gcc-(4\.[3-9]|5)$/
<add> COMPILER_SYMBOL_MAP = {
<add> "gcc-4.0" => :gcc_4_0,
<add> "gcc-4.2" => :gcc,
<add> "llvm-gcc" => :llvm,
<add> "clang" => :clang,
<add> }
<add>
<add> COMPILERS = COMPILER_SYMBOL_MAP.values +
<add> GNU_GCC_VERSIONS.map { |n| "gcc-#{n}" }
<ide> end
<ide>
<ide> class CompilerFailure
<ide><path>Library/Homebrew/extend/ENV/shared.rb
<ide> module SharedEnvExtension
<ide> CC_FLAG_VARS = %w{CFLAGS CXXFLAGS OBJCFLAGS OBJCXXFLAGS}
<ide> FC_FLAG_VARS = %w{FCFLAGS FFLAGS}
<ide>
<del> COMPILER_SYMBOL_MAP = {
<del> "gcc-4.0" => :gcc_4_0,
<del> "gcc-4.2" => :gcc,
<del> "llvm-gcc" => :llvm,
<del> "clang" => :clang,
<del> }
<del>
<del> COMPILERS = COMPILER_SYMBOL_MAP.values +
<del> GNU_GCC_VERSIONS.map { |n| "gcc-#{n}" }
<del>
<ide> SANITIZED_VARS = %w[
<ide> CDPATH GREP_OPTIONS CLICOLOR_FORCE
<ide> CPATH C_INCLUDE_PATH CPLUS_INCLUDE_PATH OBJC_INCLUDE_PATH | 2 |
Python | Python | fix conllu script | 97164b17637cb0e91bfefe4fbe4051ead2994feb | <ide><path>examples/training/conllu.py
<ide> def parse_dev_data(nlp, text_loc, conllu_loc):
<ide> return docs, scorer
<ide>
<ide>
<del>def print_progress(itn, losses, scores):
<add>def print_progress(itn, losses, scorer):
<ide> scores = {}
<ide> for col in ['dep_loss', 'tag_loss', 'uas', 'tags_acc', 'token_acc',
<ide> 'ents_p', 'ents_r', 'ents_f', 'cpu_wps', 'gpu_wps']:
<ide> def main(spacy_model, conllu_train_loc, text_train_loc, conllu_dev_loc, text_dev
<ide>
<ide> with nlp.use_params(optimizer.averages):
<ide> dev_docs, scorer = parse_dev_data(nlp, text_dev_loc, conllu_dev_loc)
<del> print_progress(i, losses, scorer.scores)
<add> print_progress(i, losses, scorer)
<ide> with open(output_loc, 'w') as file_:
<ide> print_conllu(dev_docs, file_)
<ide> | 1 |
Javascript | Javascript | simplify asset resolution | 76f74a55c2d359bdf8a24eb98317a7dc9a47333e | <ide><path>packager/src/node-haste/DependencyGraph/ResolutionRequest.js
<ide> class ResolutionRequest<TModule: Moduleish, TPackage: Packageish> {
<ide>
<ide> _loadAsFile(potentialModulePath: string, fromModule: TModule, toModule: string): TModule {
<ide> if (this._options.helpers.isAssetFile(potentialModulePath)) {
<del> const dirname = path.dirname(potentialModulePath);
<del> if (!this._options.dirExists(dirname)) {
<del> throw new UnableToResolveError(
<del> fromModule,
<del> toModule,
<del> `Directory ${dirname} doesn't exist`,
<del> );
<del> }
<del>
<del> const {name, type} = getAssetDataFromName(potentialModulePath, this._options.platforms);
<del>
<del> let pattern = '^' + name + '(@[\\d\\.]+x)?';
<del> if (this._options.platform != null) {
<del> pattern += '(\\.' + this._options.platform + ')?';
<del> }
<del> pattern += '\\.' + type + '$';
<del>
<del> const assetFiles = this._options.matchFiles(dirname, new RegExp(pattern));
<del> // We arbitrarly grab the lowest, because scale selection will happen
<del> // somewhere else. Always the lowest so that it's stable between builds.
<del> const assetFile = getArrayLowestItem(assetFiles);
<del> if (assetFile) {
<del> return this._options.moduleCache.getAssetModule(assetFile);
<del> }
<add> return this._loadAsAssetFile(potentialModulePath, fromModule, toModule);
<ide> }
<ide>
<ide> let file;
<ide> class ResolutionRequest<TModule: Moduleish, TPackage: Packageish> {
<ide> return this._options.moduleCache.getModule(file);
<ide> }
<ide>
<add> _loadAsAssetFile(potentialModulePath: string, fromModule: TModule, toModule: string): TModule {
<add> const {name, type} = getAssetDataFromName(potentialModulePath, this._options.platforms);
<add>
<add> let pattern = '^' + name + '(@[\\d\\.]+x)?';
<add> if (this._options.platform != null) {
<add> pattern += '(\\.' + this._options.platform + ')?';
<add> }
<add> pattern += '\\.' + type + '$';
<add>
<add> const dirname = path.dirname(potentialModulePath);
<add> const assetFiles = this._options.matchFiles(dirname, new RegExp(pattern));
<add> // We arbitrarly grab the lowest, because scale selection will happen
<add> // somewhere else. Always the lowest so that it's stable between builds.
<add> const assetFile = getArrayLowestItem(assetFiles);
<add> if (assetFile) {
<add> return this._options.moduleCache.getAssetModule(assetFile);
<add> }
<add> throw new UnableToResolveError(
<add> fromModule,
<add> toModule,
<add> `Directory \`${dirname}' doesn't contain asset \`${name}'`,
<add> );
<add> }
<add>
<ide> _loadAsDir(potentialDirPath: string, fromModule: TModule, toModule: string): TModule {
<ide> if (!this._options.dirExists(potentialDirPath)) {
<ide> throw new UnableToResolveError( | 1 |
Python | Python | add conf parameter to cli for airflow dags test | bcc2fe26f6e0b7204bdf73f57d25b4e6c7a69548 | <ide><path>airflow/cli/cli_parser.py
<ide> class GroupCommand(NamedTuple):
<ide> args=(
<ide> ARG_DAG_ID,
<ide> ARG_EXECUTION_DATE,
<add> ARG_CONF,
<ide> ARG_SUBDIR,
<ide> ARG_SHOW_DAGRUN,
<ide> ARG_IMGCAT_DAGRUN,
<ide><path>airflow/cli/commands/dag_command.py
<ide> def dag_list_dag_runs(args, dag=None, session=NEW_SESSION):
<ide> @cli_utils.action_cli
<ide> def dag_test(args, session=None):
<ide> """Execute one single DagRun for a given DAG and execution date, using the DebugExecutor."""
<add> run_conf = None
<add> if args.conf:
<add> try:
<add> run_conf = json.loads(args.conf)
<add> except ValueError as e:
<add> raise SystemExit(f"Configuration {args.conf!r} is not valid JSON. Error: {e}")
<add>
<ide> dag = get_dag(subdir=args.subdir, dag_id=args.dag_id)
<ide> dag.clear(start_date=args.execution_date, end_date=args.execution_date, dag_run_state=False)
<ide> try:
<ide> dag.run(
<ide> executor=DebugExecutor(),
<ide> start_date=args.execution_date,
<ide> end_date=args.execution_date,
<add> conf=run_conf,
<ide> # Always run the DAG at least once even if no logical runs are
<ide> # available. This does not make a lot of sense, but Airflow has
<ide> # been doing this prior to 2.2 so we keep compatibility.
<ide><path>tests/cli/commands/test_dag_command.py
<ide> # under the License.
<ide> import contextlib
<ide> import io
<add>import json
<ide> import os
<ide> import tempfile
<ide> import unittest
<ide> def test_dag_test(self, mock_get_dag, mock_executor):
<ide> executor=mock_executor.return_value,
<ide> start_date=cli_args.execution_date,
<ide> end_date=cli_args.execution_date,
<add> conf=None,
<add> run_at_least_once=True,
<add> ),
<add> ]
<add> )
<add>
<add> @mock.patch("airflow.cli.commands.dag_command.DebugExecutor")
<add> @mock.patch("airflow.cli.commands.dag_command.get_dag")
<add> def test_dag_test_conf(self, mock_get_dag, mock_executor):
<add> cli_args = self.parser.parse_args(
<add> [
<add> 'dags',
<add> 'test',
<add> 'example_bash_operator',
<add> DEFAULT_DATE.isoformat(),
<add> "-c",
<add> "{\"dag_run_conf_param\": \"param_value\"}",
<add> ]
<add> )
<add> dag_command.dag_test(cli_args)
<add>
<add> mock_get_dag.assert_has_calls(
<add> [
<add> mock.call(subdir=cli_args.subdir, dag_id='example_bash_operator'),
<add> mock.call().clear(
<add> start_date=cli_args.execution_date,
<add> end_date=cli_args.execution_date,
<add> dag_run_state=False,
<add> ),
<add> mock.call().run(
<add> executor=mock_executor.return_value,
<add> start_date=cli_args.execution_date,
<add> end_date=cli_args.execution_date,
<add> conf=json.loads(cli_args.conf),
<ide> run_at_least_once=True,
<ide> ),
<ide> ]
<ide> def test_dag_test_show_dag(self, mock_get_dag, mock_executor, mock_render_dag):
<ide> executor=mock_executor.return_value,
<ide> start_date=cli_args.execution_date,
<ide> end_date=cli_args.execution_date,
<add> conf=None,
<ide> run_at_least_once=True,
<ide> ),
<ide> ] | 3 |
Ruby | Ruby | add xcode 4.5.2 to standard compilers map | fa6cf55f588dafa731f170a1c818972ab766120f | <ide><path>Library/Homebrew/macos.rb
<ide> def prefer_64_bit?
<ide> "4.4" => { :llvm_build => 2336, :clang => "4.0", :clang_build => 421 },
<ide> "4.4.1" => { :llvm_build => 2336, :clang => "4.0", :clang_build => 421 },
<ide> "4.5" => { :llvm_build => 2336, :clang => "4.1", :clang_build => 421 },
<del> "4.5.1" => { :llvm_build => 2336, :clang => "4.1", :clang_build => 421 }
<add> "4.5.1" => { :llvm_build => 2336, :clang => "4.1", :clang_build => 421 },
<add> "4.5.2" => { :llvm_build => 2336, :clang => "4.1", :clang_build => 421 }
<ide> }
<ide>
<ide> def compilers_standard? | 1 |
PHP | PHP | apply fixes from styleci | 4ce641d5713738d58032fa3fb407b4c37115ebde | <ide><path>database/migrations/2014_10_12_000000_create_users_table.php
<ide> use Illuminate\Database\Schema\Blueprint;
<ide> use Illuminate\Support\Facades\Schema;
<ide>
<del>return new class extends Migration {
<add>return new class extends Migration
<add>{
<ide> /**
<ide> * Run the migrations.
<ide> *
<ide><path>database/migrations/2014_10_12_100000_create_password_resets_table.php
<ide> use Illuminate\Database\Schema\Blueprint;
<ide> use Illuminate\Support\Facades\Schema;
<ide>
<del>return new class extends Migration {
<add>return new class extends Migration
<add>{
<ide> /**
<ide> * Run the migrations.
<ide> *
<ide><path>database/migrations/2019_08_19_000000_create_failed_jobs_table.php
<ide> use Illuminate\Database\Schema\Blueprint;
<ide> use Illuminate\Support\Facades\Schema;
<ide>
<del>return new class extends Migration {
<add>return new class extends Migration
<add>{
<ide> /**
<ide> * Run the migrations.
<ide> * | 3 |
Ruby | Ruby | add needs_python method | 70a1ef5bdf113c18792197f361bf18c587ae7a9f | <ide><path>Library/Homebrew/test/testing_env.rb
<ide> def needs_compat
<ide> skip "Requires compat/ code" if ENV["HOMEBREW_NO_COMPAT"]
<ide> end
<ide>
<add> def needs_python
<add> skip "Requires Python" unless which("python")
<add> end
<add>
<ide> def assert_nothing_raised
<ide> yield
<ide> end | 1 |
Ruby | Ruby | add binary column default value support to sqlite | e1bf63fca94470b5cca4143b6f86e250fe5f66a4 | <ide><path>activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb
<ide> def extract_value_from_default(default)
<ide> # Numeric types
<ide> when /\A-?\d+(\.\d*)?\z/
<ide> $&
<add> # Binary columns
<add> when /x'(.*)'/
<add> [ $1 ].pack("H*")
<ide> else
<ide> # Anything else is blank or some function
<ide> # and we can't know the value of that, so return nil.
<ide><path>activerecord/test/cases/defaults_test.rb
<ide> def test_default_strings_containing_single_quotes
<ide> end
<ide> end
<ide>
<add>if current_adapter?(:SQLite3Adapter, :PostgreSQLAdapter)
<add> class DefaultBinaryTest < ActiveRecord::TestCase
<add> class DefaultBinary < ActiveRecord::Base; end
<add>
<add> setup do
<add> @connection = ActiveRecord::Base.connection
<add> @connection.create_table :default_binaries do |t|
<add> t.binary :varbinary_col, null: false, limit: 64, default: "varbinary_default"
<add> t.binary :varbinary_col_hex_looking, null: false, limit: 64, default: "0xDEADBEEF"
<add> end
<add> DefaultBinary.reset_column_information
<add> end
<add>
<add> def test_default_varbinary_string
<add> assert_equal "varbinary_default", DefaultBinary.new.varbinary_col
<add> end
<add>
<add> if current_adapter?(:Mysql2Adapter) && !ActiveRecord::Base.connection.mariadb?
<add> def test_default_binary_string
<add> assert_equal "binary_default", DefaultBinary.new.binary_col
<add> end
<add> end
<add>
<add> def test_default_varbinary_string_that_looks_like_hex
<add> assert_equal "0xDEADBEEF", DefaultBinary.new.varbinary_col_hex_looking
<add> end
<add>
<add> teardown do
<add> @connection.drop_table :default_binaries
<add> end
<add> end
<add>end
<add>
<ide> if supports_text_column_with_default?
<ide> class DefaultTextTest < ActiveRecord::TestCase
<ide> class DefaultText < ActiveRecord::Base; end | 2 |
Javascript | Javascript | use full height for fullwidth box when left/right | 2ac0436bd497e7b660f5d2ff7104d1f6a4331358 | <ide><path>src/core/core.layouts.js
<ide> function setLayoutDims(layouts, params) {
<ide> let i, ilen, layout;
<ide> for (i = 0, ilen = layouts.length; i < ilen; ++i) {
<ide> layout = layouts[i];
<del> // store width used instead of chartArea.w in fitBoxes
<del> layout.width = layout.horizontal
<del> ? layout.box.fullWidth && params.availableWidth
<del> : params.vBoxMaxWidth;
<del> // store height used instead of chartArea.h in fitBoxes
<del> layout.height = layout.horizontal && params.hBoxMaxHeight;
<add> // store dimensions used instead of available chartArea in fitBoxes
<add> if (layout.horizontal) {
<add> layout.width = layout.box.fullWidth && params.availableWidth;
<add> layout.height = params.hBoxMaxHeight;
<add> } else {
<add> layout.width = params.vBoxMaxWidth;
<add> layout.height = layout.box.fullWidth && params.availableHeight;
<add> }
<ide> }
<ide> }
<ide>
<ide> function placeBoxes(boxes, chartArea, params) {
<ide> } else {
<ide> box.left = x;
<ide> box.right = x + box.width;
<del> box.top = chartArea.top;
<del> box.bottom = chartArea.top + chartArea.h;
<add> box.top = box.fullWidth ? userPadding.top : chartArea.top;
<add> box.bottom = box.fullWidth ? params.outerHeight - userPadding.right : chartArea.top + chartArea.h;
<ide> box.height = box.bottom - box.top;
<ide> x = box.right;
<ide> }
<ide> export default {
<ide> outerHeight: height,
<ide> padding,
<ide> availableWidth,
<add> availableHeight,
<ide> vBoxMaxWidth: availableWidth / 2 / verticalBoxes.length,
<ide> hBoxMaxHeight: availableHeight / 2
<ide> }); | 1 |
PHP | PHP | remove unused code and restore changes | fcd2c9890c50535712a4541867b0c81341c20da2 | <ide><path>src/TestSuite/IntegrationTestCase.php
<ide> class_alias('PHPUnit_Exception', 'PHPUnit\Exception');
<ide> use Exception;
<ide> use LogicException;
<ide> use PHPUnit\Exception as PhpunitException;
<del>use Zend\Diactoros\Stream;
<ide>
<ide> /**
<ide> * A test case class intended to make integration tests of
<ide> protected function _sendRequest($url, $method, $data = [])
<ide> $psrRequest = null;
<ide> try {
<ide> $request = $this->_buildRequest($url, $method, $data);
<del> $psrRequest = $this->_createRequest($request);
<del> if ($dispatcher instanceof LegacyRequestDispatcher) {
<del> //The legacy dispatcher expects an array...
<del> $response = $dispatcher->execute($request);
<del> } else {
<del> $response = $dispatcher->execute($psrRequest);
<del> }
<add> $response = $dispatcher->execute($request);
<ide> $this->_requestSession = $request['session'];
<ide> if ($this->_retainFlashMessages && $this->_flashMessages) {
<ide> $this->_requestSession->write('Flash', $this->_flashMessages);
<ide> protected function _sendRequest($url, $method, $data = [])
<ide> throw $e;
<ide> } catch (Exception $e) {
<ide> $this->_exception = $e;
<del> //not passing the request it more accurately reflects what would happen if the global default
<del> //exception handler was invoked
<del> $this->_handleError($e, null);
<del> }
<del> }
<del>
<del> /**
<del> * Create a PSR7 request from the request spec.
<del> *
<del> * @param array $spec The request spec.
<del> * @return \Psr\Http\Message\ServerRequestInterface
<del> */
<del> protected function _createRequest($spec)
<del> {
<del> if (isset($spec['input'])) {
<del> $spec['post'] = [];
<del> }
<del> $request = ServerRequestFactory::fromGlobals(
<del> array_merge($_SERVER, $spec['environment'], ['REQUEST_URI' => $spec['url']]),
<del> $spec['query'],
<del> $spec['post'],
<del> $spec['cookies']
<del> );
<del> $request = $request->withAttribute('session', $spec['session']);
<del>
<del> if (isset($spec['input'])) {
<del> $stream = new Stream('php://memory', 'rw');
<del> $stream->write($spec['input']);
<del> $stream->rewind();
<del> $request = $request->withBody($stream);
<add> // Simulate the global exception handler being invoked.
<add> $this->_handleError($e);
<ide> }
<del>
<del> return $request;
<ide> }
<ide>
<ide> /**
<ide> public function controllerSpy($event, $controller = null)
<ide> * If that class does not exist, the built-in renderer will be used.
<ide> *
<ide> * @param \Exception $exception Exception to handle.
<del> * @param \Psr\Http\Message\RequestInterface $request The request.
<ide> * @return void
<ide> * @throws \Exception
<ide> */
<del> protected function _handleError($exception, $request)
<add> protected function _handleError($exception)
<ide> {
<ide> $class = Configure::read('Error.exceptionRenderer');
<ide> if (empty($class) || !class_exists($class)) {
<ide> $class = 'Cake\Error\ExceptionRenderer';
<ide> }
<ide> /** @var \Cake\Error\ExceptionRenderer $instance */
<del> $instance = new $class($exception, $request);
<add> $instance = new $class($exception);
<ide> $this->_response = $instance->render();
<ide> }
<ide>
<ide><path>src/TestSuite/MiddlewareDispatcher.php
<ide> use LogicException;
<ide> use ReflectionClass;
<ide> use ReflectionException;
<add>use Zend\Diactoros\Stream;
<ide>
<ide> /**
<ide> * Dispatches a request capturing the response for integration
<ide> public function __construct($test, $class = null, $constructorArgs = null)
<ide> $this->_constructorArgs = $constructorArgs ?: [CONFIG];
<ide> }
<ide>
<add> /**
<add> * Create a PSR7 request from the request spec.
<add> *
<add> * @param array $spec The request spec.
<add> * @return \Psr\Http\Message\ServerRequestInterface
<add> */
<add> protected function _createRequest($spec)
<add> {
<add> if (isset($spec['input'])) {
<add> $spec['post'] = [];
<add> }
<add> $request = ServerRequestFactory::fromGlobals(
<add> array_merge($_SERVER, $spec['environment'], ['REQUEST_URI' => $spec['url']]),
<add> $spec['query'],
<add> $spec['post'],
<add> $spec['cookies']
<add> );
<add> $request = $request->withAttribute('session', $spec['session']);
<add>
<add> if (isset($spec['input'])) {
<add> $stream = new Stream('php://memory', 'rw');
<add> $stream->write($spec['input']);
<add> $stream->rewind();
<add> $request = $request->withBody($stream);
<add> }
<add>
<add> return $request;
<add> }
<add>
<ide> /**
<ide> * Run a request and get the response.
<ide> *
<del> * @param \Psr\Http\Message\ServerRequestInterface $request The request to execute.
<add> * @param array $requestSpec The request spec to execute.
<ide> * @return \Psr\Http\Message\ResponseInterface The generated response.
<ide> */
<del> public function execute($request)
<add> public function execute($requestSpec)
<ide> {
<ide> try {
<ide> $reflect = new ReflectionClass($this->_class);
<ide> public function execute($request)
<ide>
<ide> $server = new Server($app);
<ide>
<del> return $server->run($request);
<add> return $server->run($this->_createRequest($requestSpec));
<ide> }
<ide> }
<ide><path>tests/test_app/TestApp/ApplicationWithExceptionsInMiddleware.php
<ide> *
<ide> * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide> * @link https://cakephp.org CakePHP(tm) Project
<del> * @since 3.5.2
<add> * @since 3.6.2
<ide> * @license https://opensource.org/licenses/mit-license.php MIT License
<ide> */
<ide> namespace TestApp;
<ide> public function middleware($middlewareQueue)
<ide> // and make an error page/response
<ide> ->add(ErrorHandlerMiddleware::class)
<ide>
<del> // Handle plugin/theme assets like CakePHP normally does.
<add> // Throw an error
<ide> ->add(ThrowsExceptionMiddleware::class)
<ide>
<ide> // Add routing middleware.
<ide><path>tests/test_app/TestApp/Controller/JsonResponseController.php
<del><?php
<del>/**
<del> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<del> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice.
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<del> * @link https://cakephp.org CakePHP(tm) Project
<del> * @since 3.0.0
<del> * @license https://opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace TestApp\Controller;
<del>
<del>use Cake\Http\Exception\InternalErrorException;
<del>
<del>/**
<del> * PostsController class
<del> */
<del>class JsonResponseController extends AppController
<del>{
<del> /**
<del> * Components array
<del> *
<del> * @var array
<del> */
<del> public $components = [
<del> 'Flash',
<del> 'RequestHandler' => [
<del> 'enableBeforeRedirect' => false
<del> ],
<del> ];
<del>
<del> public function apiGetData()
<del> {
<del> if (!$this->getRequest()->accepts('application/json')) {
<del> throw new InternalErrorException("Client MUST sent the Accept: application/json header");
<del> }
<del>
<del> $data = ['a', 'b', 'c', 'd'];
<del> $this->set(compact('data'));
<del> $this->set('_serialize', ['data']);
<del> $this->RequestHandler->renderAs($this, 'json');
<del> }
<del>}
<ide><path>tests/test_app/TestApp/Middleware/ThrowsExceptionMiddleware.php
<ide> *
<ide> * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide> * @link https://cakephp.org CakePHP(tm) Project
<del> * @since 3.3.0
<add> * @since 3.6.2
<ide> * @license https://opensource.org/licenses/mit-license.php MIT License
<ide> */
<ide> namespace TestApp\Middleware; | 5 |
Java | Java | add principal in glassfishrequestupgradestrategy | 14468e80f36f25761a85c678789fefedf4c60f6f | <ide><path>spring-websocket/src/main/java/org/springframework/web/socket/server/standard/GlassFishRequestUpgradeStrategy.java
<ide> private boolean performUpgrade(HttpServletRequest request, HttpServletResponse r
<ide>
<ide> RequestContext wsRequest = RequestContext.Builder.create().
<ide> requestURI(URI.create(wsApp.getPath())).requestPath(wsApp.getPath()).
<add> userPrincipal(request.getUserPrincipal()).
<ide> connection(connection).secure(request.isSecure()).build();
<ide>
<ide> for (String header : headers.keySet()) { | 1 |
Javascript | Javascript | move credential update to an else statement | 8c01f4a08f41dfeb80c12b5b52d2d4966a696bc5 | <ide><path>common/models/User-Credential.js
<ide> module.exports = function(UserCredential) {
<ide> created: modified,
<ide> modified
<ide> });
<del> }
<del> _credentials.credentials = credentials;
<del> updateCredentials = observeQuery(
<add> } else {
<add> _credentials.credentials = credentials;
<add> updateCredentials = observeQuery(
<ide> _credentials,
<del> 'updateAttributes',
<del> {
<del> profile: null,
<del> credentials,
<del> modified
<del> }
<del> );
<add> 'updateAttributes',
<add> {
<add> profile: null,
<add> credentials,
<add> modified
<add> }
<add> );
<add> }
<ide> return Observable.combineLatest(
<ide> updateUser,
<ide> updateCredentials, | 1 |
Ruby | Ruby | improve poor security recommendation in docs | 9ec0cf8581ef83bb1512293750aa0a7b32e2f4dd | <ide><path>activesupport/lib/active_support/message_encryptor.rb
<ide> module ActiveSupport
<ide> # This can be used in situations similar to the <tt>MessageVerifier</tt>, but
<ide> # where you don't want users to be able to determine the value of the payload.
<ide> #
<del> # key = OpenSSL::Digest::SHA256.new('password').digest # => "\x89\xE0\x156\xAC..."
<del> # crypt = ActiveSupport::MessageEncryptor.new(key) # => #<ActiveSupport::MessageEncryptor ...>
<del> # encrypted_data = crypt.encrypt_and_sign('my secret data') # => "NlFBTTMwOUV5UlA1QlNEN2xkY2d6eThYWWh..."
<del> # crypt.decrypt_and_verify(encrypted_data) # => "my secret data"
<add> # salt = SecureRandom.random_bytes(64)
<add> # key = ActiveSupport::KeyGenerator.new('password').generate_key(salt) # => "\x89\xE0\x156\xAC..."
<add> # crypt = ActiveSupport::MessageEncryptor.new(key) # => #<ActiveSupport::MessageEncryptor ...>
<add> # encrypted_data = crypt.encrypt_and_sign('my secret data') # => "NlFBTTMwOUV5UlA1QlNEN2xkY2d6eThYWWh..."
<add> # crypt.decrypt_and_verify(encrypted_data) # => "my secret data"
<ide> class MessageEncryptor
<ide> module NullSerializer #:nodoc:
<ide> def self.load(value) | 1 |
Javascript | Javascript | use tabs instead of spaces for whitespace | f491e4b956716d6275c12ac7083eea4dd963b2f7 | <ide><path>src/loaders/JSONLoader.js
<ide> THREE.JSONLoader.prototype.parse = function ( json, texturePath ) {
<ide>
<ide> geometry.bones = json.bones;
<ide>
<del> if ( (geometry.bones.length > 0) && (
<del> (geometry.skinWeights.length != geometry.skinIndices.length) ||
<del> (geometry.skinWeights.length != geometry.vertices.length) ) ) {
<del> console.warn('When skinning, number of vertices (' + geometry.vertices.length + '), skinIndices (' +
<del> geometry.skinIndices.length + '), and skinWeights (' + geometry.skinWeights.length + ') should match.');
<del> }
<add> if ( (geometry.bones.length > 0) && (
<add> (geometry.skinWeights.length != geometry.skinIndices.length) ||
<add> (geometry.skinIndices.length != geometry.vertices.length) ) ) {
<add> console.warn('When skinning, number of vertices (' + geometry.vertices.length + '), skinIndices (' +
<add> geometry.skinIndices.length + '), and skinWeights (' + geometry.skinWeights.length + ') should match.');
<add> }
<add>
<ide>
<ide> // could change this to json.animations[0] or remove completely
<ide> geometry.animation = json.animation; | 1 |
PHP | PHP | resolve route model binding through ioc | 3f951978a53c965698cfced90ee201156b1697bf | <ide><path>src/Illuminate/Routing/Router.php
<ide> public function model($key, $class, Closure $callback = null)
<ide> // For model binders, we will attempt to retrieve the models using the first
<ide> // method on the model instance. If we cannot retrieve the models we'll
<ide> // throw a not found exception otherwise we will return the instance.
<del> $instance = new $class;
<add> $instance = $this->container->make($class);
<ide>
<ide> if ($model = $instance->where($instance->getRouteKeyName(), $value)->first()) {
<ide> return $model;
<ide><path>tests/Routing/RoutingRouteTest.php
<ide> use Illuminate\Http\Request;
<ide> use Illuminate\Routing\Route;
<ide> use Illuminate\Routing\Router;
<add>use Illuminate\Events\Dispatcher;
<add>use Illuminate\Container\Container;
<ide> use Symfony\Component\HttpFoundation\Response;
<ide>
<ide> class RoutingRouteTest extends PHPUnit_Framework_TestCase
<ide> public function testModelBindingWithBindingClosure()
<ide> $this->assertEquals('tayloralt', $router->dispatch(Request::create('foo/TAYLOR', 'GET'))->getContent());
<ide> }
<ide>
<add> public function testModelBindingThroughIOC()
<add> {
<add> $router = new Router(new Dispatcher, $container = new Container);
<add>
<add> $container->bind('RouteModelInterface', 'RouteModelBindingStub');
<add> $router->get('foo/{bar}', function ($name) { return $name; });
<add> $router->model('bar', 'RouteModelInterface');
<add> $this->assertEquals('TAYLOR', $router->dispatch(Request::create('foo/taylor', 'GET'))->getContent());
<add> }
<add>
<ide> public function testGroupMerging()
<ide> {
<ide> $old = ['prefix' => 'foo/bar/']; | 2 |
Python | Python | add comment for the docker network stats issue | 3717c2fcf97308a9b84d55a620f8fc8fed6225b4 | <ide><path>glances/plugins/glances_docker.py
<ide> def update(self):
<ide> # Create a dict with all the containers' stats instance
<ide> self.docker_stats = {}
<ide>
<add> # TODO: Find a way to correct this
<add> # The following optimization is not compatible with the network stats
<add> # The self.docker_client.stats method should be call every time in order to have network stats refreshed
<add> # Nevertheless, if we call it every time, Glances is slow...
<ide> if c['Id'] not in self.docker_stats:
<ide> # Create the stats instance for the current container
<ide> try:
<ide> def update(self):
<ide>
<ide> # Get the docker stats
<ide> try:
<add> # self.docker_stats[c['Id']] = self.docker_client.stats(c['Id'], decode=True)
<ide> all_stats = self.docker_stats[c['Id']].next()
<ide> except:
<ide> all_stats = {}
<ide> def msg_curse(self, args=None):
<ide> # for r in ['rx', 'tx']:
<ide> # try:
<ide> # value = self.auto_unit(int(container['network'][r] // container['network']['time_since_update'] * 8)) + "b"
<del> # #value = self.auto_unit(int(container['network']['cumulative_' + r])) + 'b'
<ide> # msg = '{0:>6}'.format(value)
<ide> # except KeyError:
<ide> # msg = '{0:>6}'.format('?') | 1 |
Java | Java | introduce importaware interface | cdb01cbd3795f273b751d0f0a45caa22d07c62da | <ide><path>org.springframework.context/src/main/java/org/springframework/context/annotation/ConfigurationClassParser.java
<ide> import java.io.IOException;
<ide> import java.util.Collections;
<ide> import java.util.Comparator;
<add>import java.util.HashMap;
<ide> import java.util.Iterator;
<ide> import java.util.LinkedHashSet;
<ide> import java.util.List;
<ide> class ConfigurationClassParser {
<ide>
<ide> private final ProblemReporter problemReporter;
<ide>
<del> private final Stack<ConfigurationClass> importStack = new ImportStack();
<add> private final ImportStack importStack = new ImportStack();
<ide>
<ide> private final Set<ConfigurationClass> configurationClasses =
<ide> new LinkedHashSet<ConfigurationClass>();
<ide> private void processImport(ConfigurationClass configClass, String[] classesToImp
<ide> else {
<ide> this.importStack.push(configClass);
<ide> for (String classToImport : classesToImport) {
<add> this.importStack.registerImport(configClass.getMetadata().getClassName(), classToImport);
<ide> MetadataReader reader = this.metadataReaderFactory.getMetadataReader(classToImport);
<ide> processConfigurationClass(new ConfigurationClass(reader, null));
<ide> }
<ide> public Set<ConfigurationClass> getConfigurationClasses() {
<ide> return this.configurationClasses;
<ide> }
<ide>
<add> public ImportRegistry getImportRegistry() {
<add> return this.importStack;
<add> }
<add>
<add>
<add> interface ImportRegistry {
<add> String getImportingClassFor(String importedClass);
<add> }
<add>
<ide>
<ide> @SuppressWarnings("serial")
<del> private static class ImportStack extends Stack<ConfigurationClass> {
<add> private static class ImportStack extends Stack<ConfigurationClass> implements ImportRegistry {
<add>
<add> private Map<String, String> imports = new HashMap<String, String>();
<add>
<add> public String getImportingClassFor(String importedClass) {
<add> return imports.get(importedClass);
<add> }
<add>
<add> public void registerImport(String importingClass, String importedClass) {
<add> imports.put(importedClass, importingClass);
<add> }
<ide>
<ide> /**
<ide> * Simplified contains() implementation that tests to see if any {@link ConfigurationClass}
<ide><path>org.springframework.context/src/main/java/org/springframework/context/annotation/ConfigurationClassPostProcessor.java
<ide>
<ide> import org.apache.commons.logging.Log;
<ide> import org.apache.commons.logging.LogFactory;
<add>import org.springframework.beans.BeansException;
<ide> import org.springframework.beans.factory.BeanClassLoaderAware;
<ide> import org.springframework.beans.factory.BeanDefinitionStoreException;
<add>import org.springframework.beans.factory.BeanFactory;
<add>import org.springframework.beans.factory.BeanFactoryAware;
<ide> import org.springframework.beans.factory.config.BeanDefinition;
<ide> import org.springframework.beans.factory.config.BeanDefinitionHolder;
<ide> import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
<add>import org.springframework.beans.factory.config.BeanPostProcessor;
<ide> import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
<add>import org.springframework.beans.factory.config.SingletonBeanRegistry;
<ide> import org.springframework.beans.factory.parsing.FailFastProblemReporter;
<ide> import org.springframework.beans.factory.parsing.PassThroughSourceExtractor;
<ide> import org.springframework.beans.factory.parsing.ProblemReporter;
<ide> import org.springframework.beans.factory.parsing.SourceExtractor;
<ide> import org.springframework.beans.factory.support.AbstractBeanDefinition;
<add>import org.springframework.beans.factory.support.BeanDefinitionReaderUtils;
<ide> import org.springframework.beans.factory.support.BeanDefinitionRegistry;
<ide> import org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor;
<add>import org.springframework.beans.factory.support.RootBeanDefinition;
<ide> import org.springframework.context.EnvironmentAware;
<ide> import org.springframework.context.ResourceLoaderAware;
<add>import org.springframework.context.annotation.ConfigurationClassParser.ImportRegistry;
<ide> import org.springframework.core.Ordered;
<add>import org.springframework.core.PriorityOrdered;
<ide> import org.springframework.core.env.Environment;
<ide> import org.springframework.core.io.DefaultResourceLoader;
<ide> import org.springframework.core.io.ResourceLoader;
<add>import org.springframework.core.type.AnnotationMetadata;
<ide> import org.springframework.core.type.classreading.CachingMetadataReaderFactory;
<ide> import org.springframework.core.type.classreading.MetadataReaderFactory;
<add>import org.springframework.core.type.classreading.SimpleMetadataReaderFactory;
<ide> import org.springframework.util.Assert;
<ide> import org.springframework.util.ClassUtils;
<ide>
<ide> public void setEnvironment(Environment environment) {
<ide> * Derive further bean definitions from the configuration classes in the registry.
<ide> */
<ide> public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) {
<add> BeanDefinitionReaderUtils.registerWithGeneratedName(new RootBeanDefinition(ImportAwareBeanPostProcessor.class), registry);
<ide> if (this.postProcessBeanDefinitionRegistryCalled) {
<ide> throw new IllegalStateException(
<ide> "postProcessBeanDefinitionRegistry already called for this post-processor");
<ide> public void processConfigBeanDefinitions(ConfigurationClassParser parser, Config
<ide>
<ide> // Read the model and create bean definitions based on its content
<ide> reader.loadBeanDefinitions(parser.getConfigurationClasses());
<add>
<add> // Register the ImportRegistry as a bean in order to support ImportAware @Configuration classes
<add> if (registry instanceof SingletonBeanRegistry) {
<add> if (!((SingletonBeanRegistry) registry).containsSingleton("importRegistry")) {
<add> ((SingletonBeanRegistry) registry).registerSingleton("importRegistry", parser.getImportRegistry());
<add> }
<add> }
<ide> }
<ide>
<ide> /**
<ide> public void enhanceConfigurationClasses(ConfigurableListableBeanFactory beanFact
<ide> }
<ide> }
<ide>
<add>
<add> private static class ImportAwareBeanPostProcessor implements PriorityOrdered, BeanFactoryAware, BeanPostProcessor {
<add>
<add> private BeanFactory beanFactory;
<add>
<add> public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
<add> this.beanFactory = beanFactory;
<add> }
<add>
<add> public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
<add> if (bean instanceof ImportAware) {
<add> ImportRegistry importRegistry = beanFactory.getBean(ImportRegistry.class);
<add> String importingClass = importRegistry.getImportingClassFor(bean.getClass().getSuperclass().getName());
<add> if (importingClass != null) {
<add> try {
<add> AnnotationMetadata metadata = new SimpleMetadataReaderFactory().getMetadataReader(importingClass).getAnnotationMetadata();
<add> ((ImportAware) bean).setImportMetadata(metadata);
<add> } catch (IOException ex) {
<add> // should never occur -> at this point we know the class is present anyway
<add> throw new IllegalStateException(ex);
<add> }
<add> }
<add> else {
<add> // no importing class was found
<add> }
<add> }
<add> return bean;
<add> }
<add>
<add> public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
<add> return bean;
<add> }
<add>
<add> public int getOrder() {
<add> return Ordered.HIGHEST_PRECEDENCE;
<add> }
<add> }
<ide> }
<ide><path>org.springframework.context/src/main/java/org/springframework/context/annotation/ImportAware.java
<add>/*
<add> * Copyright 2002-2011 the original author or authors.
<add> *
<add> * Licensed under the Apache License, Version 2.0 (the "License");
<add> * you may not use this file except in compliance with the License.
<add> * You may obtain a copy of the License at
<add> *
<add> * http://www.apache.org/licenses/LICENSE-2.0
<add> *
<add> * Unless required by applicable law or agreed to in writing, software
<add> * distributed under the License is distributed on an "AS IS" BASIS,
<add> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<add> * See the License for the specific language governing permissions and
<add> * limitations under the License.
<add> */
<add>
<add>package org.springframework.context.annotation;
<add>
<add>import org.springframework.beans.factory.Aware;
<add>import org.springframework.core.type.AnnotationMetadata;
<add>
<add>/**
<add> * Interface to be implemented by any @{@link Configuration} class that wishes
<add> * to be injected with the {@link AnnotationMetadata} of the @{@code Configuration}
<add> * class that imported it. Useful in conjunction with annotations that
<add> * use @{@link Import} as a meta-annotation.
<add> *
<add> * @author Chris Beams
<add> * @since 3.1
<add> */
<add>public interface ImportAware extends Aware {
<add>
<add> /**
<add> * Set the annotation metadata of the importing @{@code Configuration} class.
<add> */
<add> void setImportMetadata(AnnotationMetadata importMetadata);
<add>
<add>}
<ide><path>org.springframework.context/src/test/java/org/springframework/context/annotation/ImportAwareTests.java
<add>/*
<add> * Copyright 2002-2011 the original author or authors.
<add> *
<add> * Licensed under the Apache License, Version 2.0 (the "License");
<add> * you may not use this file except in compliance with the License.
<add> * You may obtain a copy of the License at
<add> *
<add> * http://www.apache.org/licenses/LICENSE-2.0
<add> *
<add> * Unless required by applicable law or agreed to in writing, software
<add> * distributed under the License is distributed on an "AS IS" BASIS,
<add> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<add> * See the License for the specific language governing permissions and
<add> * limitations under the License.
<add> */
<add>
<add>package org.springframework.context.annotation;
<add>
<add>import static org.hamcrest.CoreMatchers.is;
<add>import static org.hamcrest.CoreMatchers.notNullValue;
<add>import static org.junit.Assert.assertThat;
<add>
<add>import java.lang.annotation.ElementType;
<add>import java.lang.annotation.Retention;
<add>import java.lang.annotation.RetentionPolicy;
<add>import java.lang.annotation.Target;
<add>import java.util.Map;
<add>
<add>import org.junit.Test;
<add>import org.springframework.beans.BeansException;
<add>import org.springframework.beans.factory.BeanFactory;
<add>import org.springframework.beans.factory.BeanFactoryAware;
<add>import org.springframework.beans.factory.config.BeanPostProcessor;
<add>import org.springframework.core.type.AnnotationMetadata;
<add>import org.springframework.scheduling.annotation.AsyncAnnotationBeanPostProcessor;
<add>
<add>/**
<add> * Tests that an ImportAware @Configuration classes gets injected with the
<add> * annotation metadata of the @Configuration class that imported it.
<add> *
<add> * @author Chris Beams
<add> * @since 3.1
<add> */
<add>public class ImportAwareTests {
<add>
<add> @Test
<add> public void directlyAnnotatedWithImport() {
<add> AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
<add> ctx.register(ImportingConfig.class);
<add> ctx.refresh();
<add>
<add> ctx.getBean("importedConfigBean");
<add>
<add> ImportedConfig importAwareConfig = ctx.getBean(ImportedConfig.class);
<add> AnnotationMetadata importMetadata = importAwareConfig.importMetadata;
<add> assertThat("import metadata was not injected", importMetadata, notNullValue());
<add> assertThat(importMetadata.getClassName(), is(ImportingConfig.class.getName()));
<add> Map<String, Object> importAttribs = importMetadata.getAnnotationAttributes(Import.class.getName());
<add> Class<?>[] importedClasses = (Class<?>[])importAttribs.get("value");
<add> assertThat(importedClasses[0].getName(), is(ImportedConfig.class.getName()));
<add> }
<add>
<add> @Test
<add> public void indirectlyAnnotatedWithImport() {
<add> AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
<add> ctx.register(IndirectlyImportingConfig.class);
<add> ctx.refresh();
<add>
<add> ctx.getBean("importedConfigBean");
<add>
<add> ImportedConfig importAwareConfig = ctx.getBean(ImportedConfig.class);
<add> AnnotationMetadata importMetadata = importAwareConfig.importMetadata;
<add> assertThat("import metadata was not injected", importMetadata, notNullValue());
<add> assertThat(importMetadata.getClassName(), is(IndirectlyImportingConfig.class.getName()));
<add> Map<String, Object> enableAttribs = importMetadata.getAnnotationAttributes(EnableImportedConfig.class.getName());
<add> String foo = (String)enableAttribs.get("foo");
<add> assertThat(foo, is("xyz"));
<add> }
<add>
<add>
<add> @Configuration
<add> @Import(ImportedConfig.class)
<add> static class ImportingConfig {
<add> }
<add>
<add> @Configuration
<add> @EnableImportedConfig(foo="xyz")
<add> static class IndirectlyImportingConfig {
<add> }
<add>
<add>
<add> @Target(ElementType.TYPE)
<add> @Retention(RetentionPolicy.RUNTIME)
<add> @Import(ImportedConfig.class)
<add> public @interface EnableImportedConfig {
<add> String foo() default "";
<add> }
<add>
<add>
<add> @Configuration
<add> static class ImportedConfig implements ImportAware {
<add>
<add> AnnotationMetadata importMetadata;
<add>
<add> public void setImportMetadata(AnnotationMetadata importMetadata) {
<add> this.importMetadata = importMetadata;
<add> }
<add>
<add> @Bean
<add> public BPP importedConfigBean() {
<add> return new BPP();
<add> }
<add>
<add> @Bean
<add> public AsyncAnnotationBeanPostProcessor asyncBPP() {
<add> return new AsyncAnnotationBeanPostProcessor();
<add> }
<add> }
<add>
<add>
<add> static class BPP implements BeanFactoryAware, BeanPostProcessor {
<add>
<add> public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
<add> // TODO Auto-generated method stub
<add> return bean;
<add> }
<add>
<add> public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
<add> // TODO Auto-generated method stub
<add> return bean;
<add> }
<add>
<add> public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
<add> System.out.println("ImportAwareTests.BPP.setBeanFactory()");
<add> }
<add> }
<add>}
<ide><path>org.springframework.context/src/test/java/org/springframework/context/annotation/configuration/ScopingTests.java
<ide> public void testScopedProxyConfigurationWithClasses() throws Exception {
<ide> @Test
<ide> public void testScopedConfigurationBeanDefinitionCount() throws Exception {
<ide> // count the beans
<del> // 6 @Beans + 1 Configuration + 2 scoped proxy
<del> assertEquals(9, ctx.getBeanDefinitionCount());
<add> // 6 @Beans + 1 Configuration + 2 scoped proxy + 1 importRegistry
<add> assertEquals(10, ctx.getBeanDefinitionCount());
<ide> }
<ide>
<ide> // /** | 5 |
Python | Python | add tests for the extended-precision plugin | 3164ad145d51210f669fdddceb72a5f8317b5bd6 | <ide><path>numpy/typing/tests/data/misc/extended_precision.py
<add>import numpy as np
<add>
<add>reveal_type(np.uint128())
<add>reveal_type(np.uint256())
<add>
<add>reveal_type(np.int128())
<add>reveal_type(np.int256())
<add>
<add>reveal_type(np.float80())
<add>reveal_type(np.float96())
<add>reveal_type(np.float128())
<add>reveal_type(np.float256())
<add>
<add>reveal_type(np.complex160())
<add>reveal_type(np.complex192())
<add>reveal_type(np.complex256())
<add>reveal_type(np.complex512())
<ide><path>numpy/typing/tests/test_typing.py
<ide>
<ide> import pytest
<ide> import numpy as np
<del>from numpy.typing.mypy_plugin import _PRECISION_DICT
<add>from numpy.typing.mypy_plugin import _PRECISION_DICT, _EXTENDED_PRECISION_LIST
<ide>
<ide> try:
<ide> from mypy import api
<ide> PASS_DIR = os.path.join(DATA_DIR, "pass")
<ide> FAIL_DIR = os.path.join(DATA_DIR, "fail")
<ide> REVEAL_DIR = os.path.join(DATA_DIR, "reveal")
<add>MISC_DIR = os.path.join(DATA_DIR, "misc")
<ide> MYPY_INI = os.path.join(DATA_DIR, "mypy.ini")
<ide> CACHE_DIR = os.path.join(DATA_DIR, ".mypy_cache")
<ide>
<ide> def run_mypy() -> None:
<ide> if os.path.isdir(CACHE_DIR):
<ide> shutil.rmtree(CACHE_DIR)
<ide>
<del> for directory in (PASS_DIR, REVEAL_DIR, FAIL_DIR):
<add> for directory in (PASS_DIR, REVEAL_DIR, FAIL_DIR, MISC_DIR):
<ide> # Run mypy
<ide> stdout, stderr, _ = api.run([
<ide> "--config-file",
<ide> def _construct_format_dict():
<ide> "uint16": "numpy.unsignedinteger[numpy.typing._16Bit]",
<ide> "uint32": "numpy.unsignedinteger[numpy.typing._32Bit]",
<ide> "uint64": "numpy.unsignedinteger[numpy.typing._64Bit]",
<add> "uint128": "numpy.unsignedinteger[numpy.typing._128Bit]",
<add> "uint256": "numpy.unsignedinteger[numpy.typing._256Bit]",
<ide> "int8": "numpy.signedinteger[numpy.typing._8Bit]",
<ide> "int16": "numpy.signedinteger[numpy.typing._16Bit]",
<ide> "int32": "numpy.signedinteger[numpy.typing._32Bit]",
<ide> "int64": "numpy.signedinteger[numpy.typing._64Bit]",
<add> "int128": "numpy.signedinteger[numpy.typing._128Bit]",
<add> "int256": "numpy.signedinteger[numpy.typing._256Bit]",
<ide> "float16": "numpy.floating[numpy.typing._16Bit]",
<ide> "float32": "numpy.floating[numpy.typing._32Bit]",
<ide> "float64": "numpy.floating[numpy.typing._64Bit]",
<add> "float80": "numpy.floating[numpy.typing._80Bit]",
<add> "float96": "numpy.floating[numpy.typing._96Bit]",
<add> "float128": "numpy.floating[numpy.typing._128Bit]",
<add> "float256": "numpy.floating[numpy.typing._256Bit]",
<ide> "complex64": "numpy.complexfloating[numpy.typing._32Bit, numpy.typing._32Bit]",
<ide> "complex128": "numpy.complexfloating[numpy.typing._64Bit, numpy.typing._64Bit]",
<add> "complex160": "numpy.complexfloating[numpy.typing._80Bit, numpy.typing._80Bit]",
<add> "complex192": "numpy.complexfloating[numpy.typing._96Bit, numpy.typing._96Bit]",
<add> "complex256": "numpy.complexfloating[numpy.typing._128Bit, numpy.typing._128Bit]",
<add> "complex512": "numpy.complexfloating[numpy.typing._256Bit, numpy.typing._256Bit]",
<ide>
<ide> "ubyte": f"numpy.unsignedinteger[{dct['_NBitByte']}]",
<ide> "ushort": f"numpy.unsignedinteger[{dct['_NBitShort']}]",
<ide> def test_code_runs(path):
<ide> spec = importlib.util.spec_from_file_location(f"{dirname}.{filename}", path)
<ide> test_module = importlib.util.module_from_spec(spec)
<ide> spec.loader.exec_module(test_module)
<add>
<add>
<add>LINENO_MAPPING = {
<add> 3: "uint128",
<add> 4: "uint256",
<add> 6: "int128",
<add> 7: "int256",
<add> 9: "float80",
<add> 10: "float96",
<add> 11: "float128",
<add> 12: "float256",
<add> 14: "complex160",
<add> 15: "complex192",
<add> 16: "complex256",
<add> 17: "complex512",
<add>}
<add>
<add>
<add>@pytest.mark.slow
<add>@pytest.mark.skipif(NO_MYPY, reason="Mypy is not installed")
<add>def test_extended_precision() -> None:
<add> path = os.path.join(MISC_DIR, "extended_precision.py")
<add> output_mypy = OUTPUT_MYPY
<add> assert path in output_mypy
<add>
<add> for _msg in output_mypy[path]:
<add> *_, _lineno, msg_typ, msg = _msg.split(":")
<add> lineno = int(_lineno)
<add> msg_typ = msg_typ.strip()
<add> assert msg_typ in {"error", "note"}
<add>
<add> if LINENO_MAPPING[lineno] in _EXTENDED_PRECISION_LIST:
<add> if msg_typ == "error":
<add> raise ValueError(f"Unexpected reveal line format: {lineno}")
<add> else:
<add> marker = FORMAT_DICT[LINENO_MAPPING[lineno]]
<add> _test_reveal(path, marker, msg, lineno)
<add> else:
<add> if msg_typ == "error":
<add> marker = "Module has no attribute"
<add> _test_fail(path, marker, msg, lineno) | 2 |
Javascript | Javascript | fix error reporting for module errors | af0e6cdae5762346a013a60e9b3f095204292550 | <ide><path>Libraries/Core/InitializeCore.js
<ide> if (__DEV__) {
<ide> require('../LogBox/LogBox').install();
<ide> }
<ide>
<add>require('../ReactNative/AppRegistry');
<add>
<ide> const GlobalPerformanceLogger = require('../Utilities/GlobalPerformanceLogger');
<ide> // We could just call GlobalPerformanceLogger.markPoint at the top of the file,
<ide> // but then we'd be excluding the time it took to require the logger. | 1 |
Python | Python | expose sql to gcs metadata | 94257f48f4a3f123918b0d55c34753c7c413eb74 | <ide><path>airflow/providers/google/cloud/transfers/sql_to_gcs.py
<ide> class BaseSQLToGCSOperator(BaseOperator):
<ide> If set as a sequence, the identities from the list must grant
<ide> Service Account Token Creator IAM role to the directly preceding identity, with first
<ide> account from the list granting this role to the originating account (templated).
<add> :param upload_metadata: whether to upload the row count metadata as blob metadata
<ide> :param exclude_columns: set of columns to exclude from transmission
<ide> """
<ide>
<ide> def __init__(
<ide> gcp_conn_id: str = 'google_cloud_default',
<ide> delegate_to: Optional[str] = None,
<ide> impersonation_chain: Optional[Union[str, Sequence[str]]] = None,
<add> upload_metadata: bool = False,
<ide> exclude_columns=None,
<ide> **kwargs,
<ide> ) -> None:
<ide> def __init__(
<ide> self.gcp_conn_id = gcp_conn_id
<ide> self.delegate_to = delegate_to
<ide> self.impersonation_chain = impersonation_chain
<add> self.upload_metadata = upload_metadata
<ide> self.exclude_columns = exclude_columns
<ide>
<ide> def execute(self, context: 'Context'):
<ide> def execute(self, context: 'Context'):
<ide> schema_file['file_handle'].close()
<ide>
<ide> counter = 0
<add> files = []
<add> total_row_count = 0
<add> total_files = 0
<ide> self.log.info('Writing local data files')
<ide> for file_to_upload in self._write_local_data_files(cursor):
<ide> # Flush file before uploading
<ide> def execute(self, context: 'Context'):
<ide>
<ide> self.log.info('Removing local file')
<ide> file_to_upload['file_handle'].close()
<add>
<add> # Metadata to be outputted to Xcom
<add> total_row_count += file_to_upload['file_row_count']
<add> total_files += 1
<add> files.append(
<add> {
<add> 'file_name': file_to_upload['file_name'],
<add> 'file_mime_type': file_to_upload['file_mime_type'],
<add> 'file_row_count': file_to_upload['file_row_count'],
<add> }
<add> )
<add>
<ide> counter += 1
<ide>
<add> file_meta = {
<add> 'bucket': self.bucket,
<add> 'total_row_count': total_row_count,
<add> 'total_files': total_files,
<add> 'files': files,
<add> }
<add>
<add> return file_meta
<add>
<ide> def convert_types(self, schema, col_type_dict, row, stringify_dict=False) -> list:
<ide> """Convert values from DBAPI to output-friendly formats."""
<ide> return [
<ide> def _write_local_data_files(self, cursor):
<ide> 'file_name': self.filename.format(file_no),
<ide> 'file_handle': tmp_file_handle,
<ide> 'file_mime_type': file_mime_type,
<add> 'file_row_count': 0,
<ide> }
<ide>
<ide> if self.export_format == 'csv':
<ide> def _write_local_data_files(self, cursor):
<ide> parquet_writer = self._configure_parquet_file(tmp_file_handle, parquet_schema)
<ide>
<ide> for row in cursor:
<add> file_to_upload['file_row_count'] += 1
<ide> if self.export_format == 'csv':
<ide> row = self.convert_types(schema, col_type_dict, row)
<ide> if self.null_marker is not None:
<ide> def _write_local_data_files(self, cursor):
<ide> 'file_name': self.filename.format(file_no),
<ide> 'file_handle': tmp_file_handle,
<ide> 'file_mime_type': file_mime_type,
<add> 'file_row_count': 0,
<ide> }
<ide> if self.export_format == 'csv':
<ide> csv_writer = self._configure_csv_file(tmp_file_handle, schema)
<ide> if self.export_format == 'parquet':
<ide> parquet_writer = self._configure_parquet_file(tmp_file_handle, parquet_schema)
<ide> if self.export_format == 'parquet':
<ide> parquet_writer.close()
<del> yield file_to_upload
<add> # Last file may have 0 rows, don't yield if empty
<add> if file_to_upload['file_row_count'] > 0:
<add> yield file_to_upload
<ide>
<ide> def _configure_csv_file(self, file_handle, schema):
<ide> """Configure a csv writer with the file_handle and write schema
<ide> def _upload_to_gcs(self, file_to_upload):
<ide> delegate_to=self.delegate_to,
<ide> impersonation_chain=self.impersonation_chain,
<ide> )
<add> is_data_file = file_to_upload.get('file_name') != self.schema_filename
<add> metadata = None
<add> if is_data_file and self.upload_metadata:
<add> metadata = {'row_count': file_to_upload['file_row_count']}
<add>
<ide> hook.upload(
<ide> self.bucket,
<ide> file_to_upload.get('file_name'),
<ide> file_to_upload.get('file_handle').name,
<ide> mime_type=file_to_upload.get('file_mime_type'),
<del> gzip=self.gzip if file_to_upload.get('file_name') != self.schema_filename else False,
<add> gzip=self.gzip if is_data_file else False,
<add> metadata=metadata,
<ide> )
<ide><path>tests/providers/google/cloud/transfers/test_mssql_to_gcs.py
<ide> def test_exec_success_json(self, gcs_hook_mock_class, mssql_hook_mock_class):
<ide>
<ide> gcs_hook_mock = gcs_hook_mock_class.return_value
<ide>
<del> def _assert_upload(bucket, obj, tmp_filename, mime_type=None, gzip=False):
<add> def _assert_upload(bucket, obj, tmp_filename, mime_type=None, gzip=False, metadata=None):
<ide> assert BUCKET == bucket
<ide> assert JSON_FILENAME.format(0) == obj
<ide> assert 'application/json' == mime_type
<ide> def test_file_splitting(self, gcs_hook_mock_class, mssql_hook_mock_class):
<ide> JSON_FILENAME.format(1): NDJSON_LINES[2],
<ide> }
<ide>
<del> def _assert_upload(bucket, obj, tmp_filename, mime_type=None, gzip=False):
<add> def _assert_upload(bucket, obj, tmp_filename, mime_type=None, gzip=False, metadata=None):
<ide> assert BUCKET == bucket
<ide> assert 'application/json' == mime_type
<ide> assert GZIP == gzip
<ide> def test_schema_file(self, gcs_hook_mock_class, mssql_hook_mock_class):
<ide>
<ide> gcs_hook_mock = gcs_hook_mock_class.return_value
<ide>
<del> def _assert_upload(bucket, obj, tmp_filename, mime_type, gzip):
<add> def _assert_upload(bucket, obj, tmp_filename, mime_type, gzip, metadata=None):
<ide> if obj == SCHEMA_FILENAME:
<ide> with open(tmp_filename, 'rb') as file:
<ide> assert b''.join(SCHEMA_JSON) == file.read()
<ide><path>tests/providers/google/cloud/transfers/test_mysql_to_gcs.py
<ide> def test_exec_success_json(self, gcs_hook_mock_class, mysql_hook_mock_class):
<ide>
<ide> gcs_hook_mock = gcs_hook_mock_class.return_value
<ide>
<del> def _assert_upload(bucket, obj, tmp_filename, mime_type=None, gzip=False):
<add> def _assert_upload(bucket, obj, tmp_filename, mime_type=None, gzip=False, metadata=None):
<ide> assert BUCKET == bucket
<ide> assert JSON_FILENAME.format(0) == obj
<ide> assert 'application/json' == mime_type
<ide> def test_exec_success_csv(self, gcs_hook_mock_class, mysql_hook_mock_class):
<ide>
<ide> gcs_hook_mock = gcs_hook_mock_class.return_value
<ide>
<del> def _assert_upload(bucket, obj, tmp_filename, mime_type=None, gzip=False):
<add> def _assert_upload(bucket, obj, tmp_filename, mime_type=None, gzip=False, metadata=None):
<ide> assert BUCKET == bucket
<ide> assert CSV_FILENAME.format(0) == obj
<ide> assert 'text/csv' == mime_type
<ide> def test_exec_success_csv_ensure_utc(self, gcs_hook_mock_class, mysql_hook_mock_
<ide>
<ide> gcs_hook_mock = gcs_hook_mock_class.return_value
<ide>
<del> def _assert_upload(bucket, obj, tmp_filename, mime_type=None, gzip=False):
<add> def _assert_upload(bucket, obj, tmp_filename, mime_type=None, gzip=False, metadata=None):
<ide> assert BUCKET == bucket
<ide> assert CSV_FILENAME.format(0) == obj
<ide> assert 'text/csv' == mime_type
<ide> def test_exec_success_csv_with_delimiter(self, gcs_hook_mock_class, mysql_hook_m
<ide>
<ide> gcs_hook_mock = gcs_hook_mock_class.return_value
<ide>
<del> def _assert_upload(bucket, obj, tmp_filename, mime_type=None, gzip=False):
<add> def _assert_upload(bucket, obj, tmp_filename, mime_type=None, gzip=False, metadata=None):
<ide> assert BUCKET == bucket
<ide> assert CSV_FILENAME.format(0) == obj
<ide> assert 'text/csv' == mime_type
<ide> def test_file_splitting(self, gcs_hook_mock_class, mysql_hook_mock_class):
<ide> JSON_FILENAME.format(1): NDJSON_LINES[2],
<ide> }
<ide>
<del> def _assert_upload(bucket, obj, tmp_filename, mime_type=None, gzip=False):
<add> def _assert_upload(bucket, obj, tmp_filename, mime_type=None, gzip=False, metadata=None):
<ide> assert BUCKET == bucket
<ide> assert 'application/json' == mime_type
<ide> assert not gzip
<ide> def test_schema_file(self, gcs_hook_mock_class, mysql_hook_mock_class):
<ide>
<ide> gcs_hook_mock = gcs_hook_mock_class.return_value
<ide>
<del> def _assert_upload(bucket, obj, tmp_filename, mime_type, gzip):
<add> def _assert_upload(bucket, obj, tmp_filename, mime_type, gzip, metadata=None):
<ide> if obj == SCHEMA_FILENAME:
<ide> assert not gzip
<ide> with open(tmp_filename, 'rb') as file:
<ide> def test_schema_file_with_custom_schema(self, gcs_hook_mock_class, mysql_hook_mo
<ide>
<ide> gcs_hook_mock = gcs_hook_mock_class.return_value
<ide>
<del> def _assert_upload(bucket, obj, tmp_filename, mime_type, gzip):
<add> def _assert_upload(bucket, obj, tmp_filename, mime_type, gzip, metadata=None):
<ide> if obj == SCHEMA_FILENAME:
<ide> assert not gzip
<ide> with open(tmp_filename, 'rb') as file:
<ide><path>tests/providers/google/cloud/transfers/test_oracle_to_gcs.py
<ide> def test_exec_success_json(self, gcs_hook_mock_class, oracle_hook_mock_class):
<ide>
<ide> gcs_hook_mock = gcs_hook_mock_class.return_value
<ide>
<del> def _assert_upload(bucket, obj, tmp_filename, mime_type=None, gzip=False):
<add> def _assert_upload(bucket, obj, tmp_filename, mime_type=None, gzip=False, metadata=None):
<ide> assert BUCKET == bucket
<ide> assert JSON_FILENAME.format(0) == obj
<ide> assert 'application/json' == mime_type
<ide> def test_file_splitting(self, gcs_hook_mock_class, oracle_hook_mock_class):
<ide> JSON_FILENAME.format(1): NDJSON_LINES[2],
<ide> }
<ide>
<del> def _assert_upload(bucket, obj, tmp_filename, mime_type=None, gzip=False):
<add> def _assert_upload(bucket, obj, tmp_filename, mime_type=None, gzip=False, metadata=None):
<ide> assert BUCKET == bucket
<ide> assert 'application/json' == mime_type
<ide> assert GZIP == gzip
<ide> def test_schema_file(self, gcs_hook_mock_class, oracle_hook_mock_class):
<ide>
<ide> gcs_hook_mock = gcs_hook_mock_class.return_value
<ide>
<del> def _assert_upload(bucket, obj, tmp_filename, mime_type, gzip):
<add> def _assert_upload(bucket, obj, tmp_filename, mime_type, gzip, metadata=None):
<ide> if obj == SCHEMA_FILENAME:
<ide> with open(tmp_filename, 'rb') as file:
<ide> assert b''.join(SCHEMA_JSON) == file.read()
<ide><path>tests/providers/google/cloud/transfers/test_postgres_to_gcs.py
<ide> def test_init(self):
<ide> assert op.bucket == BUCKET
<ide> assert op.filename == FILENAME
<ide>
<del> def _assert_uploaded_file_content(self, bucket, obj, tmp_filename, mime_type, gzip):
<add> def _assert_uploaded_file_content(self, bucket, obj, tmp_filename, mime_type, gzip, metadata=None):
<ide> assert BUCKET == bucket
<ide> assert FILENAME.format(0) == obj
<ide> assert 'application/json' == mime_type
<ide> def test_file_splitting(self, gcs_hook_mock_class):
<ide> FILENAME.format(1): NDJSON_LINES[2],
<ide> }
<ide>
<del> def _assert_upload(bucket, obj, tmp_filename, mime_type, gzip):
<add> def _assert_upload(bucket, obj, tmp_filename, mime_type, gzip, metadata=None):
<ide> assert BUCKET == bucket
<ide> assert 'application/json' == mime_type
<ide> assert not gzip
<ide> def test_schema_file(self, gcs_hook_mock_class):
<ide>
<ide> gcs_hook_mock = gcs_hook_mock_class.return_value
<ide>
<del> def _assert_upload(bucket, obj, tmp_filename, mime_type, gzip):
<add> def _assert_upload(bucket, obj, tmp_filename, mime_type, gzip, metadata=None):
<ide> if obj == SCHEMA_FILENAME:
<ide> with open(tmp_filename, 'rb') as file:
<ide> assert SCHEMA_JSON == file.read()
<ide><path>tests/providers/google/cloud/transfers/test_presto_to_gcs.py
<ide> def test_init(self):
<ide> @patch("airflow.providers.google.cloud.transfers.presto_to_gcs.PrestoHook")
<ide> @patch("airflow.providers.google.cloud.transfers.sql_to_gcs.GCSHook")
<ide> def test_save_as_json(self, mock_gcs_hook, mock_presto_hook):
<del> def _assert_upload(bucket, obj, tmp_filename, mime_type, gzip):
<add> def _assert_upload(bucket, obj, tmp_filename, mime_type, gzip, metadata=None):
<ide> assert BUCKET == bucket
<ide> assert FILENAME.format(0) == obj
<ide> assert "application/json" == mime_type
<ide> def test_save_as_json_with_file_splitting(self, mock_gcs_hook, mock_presto_hook)
<ide> FILENAME.format(1): NDJSON_LINES[2],
<ide> }
<ide>
<del> def _assert_upload(bucket, obj, tmp_filename, mime_type, gzip):
<add> def _assert_upload(bucket, obj, tmp_filename, mime_type, gzip, metadata=None):
<ide> assert BUCKET == bucket
<ide> assert "application/json" == mime_type
<ide> assert not gzip
<ide> def _assert_upload(bucket, obj, tmp_filename, mime_type, gzip):
<ide> def test_save_as_json_with_schema_file(self, mock_gcs_hook, mock_presto_hook):
<ide> """Test writing schema files."""
<ide>
<del> def _assert_upload(bucket, obj, tmp_filename, mime_type, gzip):
<add> def _assert_upload(bucket, obj, tmp_filename, mime_type, gzip, metadata=None):
<ide> if obj == SCHEMA_FILENAME:
<ide> with open(tmp_filename, "rb") as file:
<ide> assert SCHEMA_JSON == file.read()
<ide> def _assert_upload(bucket, obj, tmp_filename, mime_type, gzip):
<ide> @patch("airflow.providers.google.cloud.transfers.sql_to_gcs.GCSHook")
<ide> @patch("airflow.providers.google.cloud.transfers.presto_to_gcs.PrestoHook")
<ide> def test_save_as_csv(self, mock_presto_hook, mock_gcs_hook):
<del> def _assert_upload(bucket, obj, tmp_filename, mime_type, gzip):
<add> def _assert_upload(bucket, obj, tmp_filename, mime_type, gzip, metadata=None):
<ide> assert BUCKET == bucket
<ide> assert FILENAME.format(0) == obj
<ide> assert "text/csv" == mime_type
<ide> def test_save_as_csv_with_file_splitting(self, mock_gcs_hook, mock_presto_hook):
<ide> FILENAME.format(1): b"".join([CSV_LINES[0], CSV_LINES[3]]),
<ide> }
<ide>
<del> def _assert_upload(bucket, obj, tmp_filename, mime_type, gzip):
<add> def _assert_upload(bucket, obj, tmp_filename, mime_type, gzip, metadata=None):
<ide> assert BUCKET == bucket
<ide> assert "text/csv" == mime_type
<ide> assert not gzip
<ide> def _assert_upload(bucket, obj, tmp_filename, mime_type, gzip):
<ide> def test_save_as_csv_with_schema_file(self, mock_gcs_hook, mock_presto_hook):
<ide> """Test writing schema files."""
<ide>
<del> def _assert_upload(bucket, obj, tmp_filename, mime_type, gzip):
<add> def _assert_upload(bucket, obj, tmp_filename, mime_type, gzip, metadata=None):
<ide> if obj == SCHEMA_FILENAME:
<ide> with open(tmp_filename, "rb") as file:
<ide> assert SCHEMA_JSON == file.read()
<ide><path>tests/providers/google/cloud/transfers/test_sql_to_gcs.py
<ide> def test_exec(self, mock_convert_type, mock_query, mock_upload, mock_writerow, m
<ide> gzip=True,
<ide> schema=SCHEMA,
<ide> gcp_conn_id='google_cloud_default',
<add> upload_metadata=True,
<ide> )
<del> operator.execute(context=dict())
<add> result = operator.execute(context=dict())
<add>
<add> assert result == {
<add> 'bucket': 'TEST-BUCKET-1',
<add> 'total_row_count': 3,
<add> 'total_files': 3,
<add> 'files': [
<add> {'file_name': 'test_results_0.csv', 'file_mime_type': 'text/csv', 'file_row_count': 1},
<add> {'file_name': 'test_results_1.csv', 'file_mime_type': 'text/csv', 'file_row_count': 1},
<add> {'file_name': 'test_results_2.csv', 'file_mime_type': 'text/csv', 'file_row_count': 1},
<add> ],
<add> }
<ide>
<ide> mock_query.assert_called_once()
<ide> mock_writerow.assert_has_calls(
<ide> def test_exec(self, mock_convert_type, mock_query, mock_upload, mock_writerow, m
<ide> mock.call(COLUMNS),
<ide> ]
<ide> )
<del> mock_flush.assert_has_calls([mock.call(), mock.call(), mock.call(), mock.call(), mock.call()])
<add> mock_flush.assert_has_calls([mock.call(), mock.call(), mock.call(), mock.call()])
<ide> csv_calls = []
<ide> for i in range(0, 3):
<ide> csv_calls.append(
<del> mock.call(BUCKET, FILENAME.format(i), TMP_FILE_NAME, mime_type='text/csv', gzip=True)
<add> mock.call(
<add> BUCKET,
<add> FILENAME.format(i),
<add> TMP_FILE_NAME,
<add> mime_type='text/csv',
<add> gzip=True,
<add> metadata={'row_count': 1},
<add> )
<ide> )
<del> json_call = mock.call(BUCKET, SCHEMA_FILE, TMP_FILE_NAME, mime_type=APP_JSON, gzip=False)
<add> json_call = mock.call(
<add> BUCKET, SCHEMA_FILE, TMP_FILE_NAME, mime_type=APP_JSON, gzip=False, metadata=None
<add> )
<ide> upload_calls = [json_call, csv_calls[0], csv_calls[1], csv_calls[2]]
<ide> mock_upload.assert_has_calls(upload_calls)
<del> mock_close.assert_has_calls([mock.call(), mock.call(), mock.call(), mock.call(), mock.call()])
<add> mock_close.assert_has_calls([mock.call(), mock.call(), mock.call(), mock.call()])
<ide>
<ide> mock_query.reset_mock()
<ide> mock_flush.reset_mock()
<ide> def test_exec(self, mock_convert_type, mock_query, mock_upload, mock_writerow, m
<ide> operator = DummySQLToGCSOperator(
<ide> sql=SQL, bucket=BUCKET, filename=FILENAME, task_id=TASK_ID, export_format="json", schema=SCHEMA
<ide> )
<del> operator.execute(context=dict())
<add> result = operator.execute(context=dict())
<add>
<add> assert result == {
<add> 'bucket': 'TEST-BUCKET-1',
<add> 'total_row_count': 3,
<add> 'total_files': 1,
<add> 'files': [
<add> {'file_name': 'test_results_0.csv', 'file_mime_type': 'application/json', 'file_row_count': 3}
<add> ],
<add> }
<ide>
<ide> mock_query.assert_called_once()
<ide> mock_write.assert_has_calls(
<ide> def test_exec(self, mock_convert_type, mock_query, mock_upload, mock_writerow, m
<ide> )
<ide> mock_flush.assert_called_once()
<ide> mock_upload.assert_called_once_with(
<del> BUCKET, FILENAME.format(0), TMP_FILE_NAME, mime_type=APP_JSON, gzip=False
<add> BUCKET, FILENAME.format(0), TMP_FILE_NAME, mime_type=APP_JSON, gzip=False, metadata=None
<add> )
<add> mock_close.assert_called_once()
<add>
<add> mock_query.reset_mock()
<add> mock_flush.reset_mock()
<add> mock_upload.reset_mock()
<add> mock_close.reset_mock()
<add> cursor_mock.reset_mock()
<add>
<add> cursor_mock.__iter__ = Mock(return_value=iter(INPUT_DATA))
<add>
<add> # Test Metadata Upload
<add> operator = DummySQLToGCSOperator(
<add> sql=SQL,
<add> bucket=BUCKET,
<add> filename=FILENAME,
<add> task_id=TASK_ID,
<add> export_format="json",
<add> schema=SCHEMA,
<add> upload_metadata=True,
<add> )
<add> result = operator.execute(context=dict())
<add>
<add> assert result == {
<add> 'bucket': 'TEST-BUCKET-1',
<add> 'total_row_count': 3,
<add> 'total_files': 1,
<add> 'files': [
<add> {'file_name': 'test_results_0.csv', 'file_mime_type': 'application/json', 'file_row_count': 3}
<add> ],
<add> }
<add>
<add> mock_query.assert_called_once()
<add> mock_write.assert_has_calls(
<add> [
<add> mock.call(OUTPUT_DATA),
<add> mock.call(b"\n"),
<add> mock.call(OUTPUT_DATA),
<add> mock.call(b"\n"),
<add> mock.call(OUTPUT_DATA),
<add> mock.call(b"\n"),
<add> ]
<add> )
<add>
<add> mock_flush.assert_called_once()
<add> mock_upload.assert_called_once_with(
<add> BUCKET,
<add> FILENAME.format(0),
<add> TMP_FILE_NAME,
<add> mime_type=APP_JSON,
<add> gzip=False,
<add> metadata={'row_count': 3},
<ide> )
<ide> mock_close.assert_called_once()
<ide>
<ide> def test_exec(self, mock_convert_type, mock_query, mock_upload, mock_writerow, m
<ide> operator = DummySQLToGCSOperator(
<ide> sql=SQL, bucket=BUCKET, filename=FILENAME, task_id=TASK_ID, export_format="parquet", schema=SCHEMA
<ide> )
<del> operator.execute(context=dict())
<add> result = operator.execute(context=dict())
<add>
<add> assert result == {
<add> 'bucket': 'TEST-BUCKET-1',
<add> 'total_row_count': 3,
<add> 'total_files': 1,
<add> 'files': [
<add> {
<add> 'file_name': 'test_results_0.csv',
<add> 'file_mime_type': 'application/octet-stream',
<add> 'file_row_count': 3,
<add> }
<add> ],
<add> }
<ide>
<ide> mock_query.assert_called_once()
<ide> mock_flush.assert_called_once()
<ide> mock_upload.assert_called_once_with(
<del> BUCKET, FILENAME.format(0), TMP_FILE_NAME, mime_type='application/octet-stream', gzip=False
<add> BUCKET,
<add> FILENAME.format(0),
<add> TMP_FILE_NAME,
<add> mime_type='application/octet-stream',
<add> gzip=False,
<add> metadata=None,
<ide> )
<ide> mock_close.assert_called_once()
<ide>
<ide> def test_exec(self, mock_convert_type, mock_query, mock_upload, mock_writerow, m
<ide> export_format="csv",
<ide> null_marker="NULL",
<ide> )
<del> operator.execute(context=dict())
<add> result = operator.execute(context=dict())
<add>
<add> assert result == {
<add> 'bucket': 'TEST-BUCKET-1',
<add> 'total_row_count': 3,
<add> 'total_files': 1,
<add> 'files': [{'file_name': 'test_results_0.csv', 'file_mime_type': 'text/csv', 'file_row_count': 3}],
<add> }
<ide>
<ide> mock_writerow.assert_has_calls(
<ide> [
<ide><path>tests/providers/google/cloud/transfers/test_trino_to_gcs.py
<ide> def test_init(self):
<ide> @patch("airflow.providers.google.cloud.transfers.trino_to_gcs.TrinoHook")
<ide> @patch("airflow.providers.google.cloud.transfers.sql_to_gcs.GCSHook")
<ide> def test_save_as_json(self, mock_gcs_hook, mock_trino_hook):
<del> def _assert_upload(bucket, obj, tmp_filename, mime_type, gzip):
<add> def _assert_upload(bucket, obj, tmp_filename, mime_type, gzip, metadata=None):
<ide> assert BUCKET == bucket
<ide> assert FILENAME.format(0) == obj
<ide> assert "application/json" == mime_type
<ide> def test_save_as_json_with_file_splitting(self, mock_gcs_hook, mock_trino_hook):
<ide> FILENAME.format(1): NDJSON_LINES[2],
<ide> }
<ide>
<del> def _assert_upload(bucket, obj, tmp_filename, mime_type, gzip):
<add> def _assert_upload(bucket, obj, tmp_filename, mime_type, gzip, metadata=None):
<ide> assert BUCKET == bucket
<ide> assert "application/json" == mime_type
<ide> assert not gzip
<ide> def _assert_upload(bucket, obj, tmp_filename, mime_type, gzip):
<ide> def test_save_as_json_with_schema_file(self, mock_gcs_hook, mock_trino_hook):
<ide> """Test writing schema files."""
<ide>
<del> def _assert_upload(bucket, obj, tmp_filename, mime_type, gzip):
<add> def _assert_upload(bucket, obj, tmp_filename, mime_type, gzip, metadata=None):
<ide> if obj == SCHEMA_FILENAME:
<ide> with open(tmp_filename, "rb") as file:
<ide> assert SCHEMA_JSON == file.read()
<ide> def _assert_upload(bucket, obj, tmp_filename, mime_type, gzip):
<ide> @patch("airflow.providers.google.cloud.transfers.sql_to_gcs.GCSHook")
<ide> @patch("airflow.providers.google.cloud.transfers.trino_to_gcs.TrinoHook")
<ide> def test_save_as_csv(self, mock_trino_hook, mock_gcs_hook):
<del> def _assert_upload(bucket, obj, tmp_filename, mime_type, gzip):
<add> def _assert_upload(bucket, obj, tmp_filename, mime_type, gzip, metadata=None):
<ide> assert BUCKET == bucket
<ide> assert FILENAME.format(0) == obj
<ide> assert "text/csv" == mime_type
<ide> def test_save_as_csv_with_file_splitting(self, mock_gcs_hook, mock_trino_hook):
<ide> FILENAME.format(1): b"".join([CSV_LINES[0], CSV_LINES[3]]),
<ide> }
<ide>
<del> def _assert_upload(bucket, obj, tmp_filename, mime_type, gzip):
<add> def _assert_upload(bucket, obj, tmp_filename, mime_type, gzip, metadata=None):
<ide> assert BUCKET == bucket
<ide> assert "text/csv" == mime_type
<ide> assert not gzip
<ide> def _assert_upload(bucket, obj, tmp_filename, mime_type, gzip):
<ide> def test_save_as_csv_with_schema_file(self, mock_gcs_hook, mock_trino_hook):
<ide> """Test writing schema files."""
<ide>
<del> def _assert_upload(bucket, obj, tmp_filename, mime_type, gzip):
<add> def _assert_upload(bucket, obj, tmp_filename, mime_type, gzip, metadata=None):
<ide> if obj == SCHEMA_FILENAME:
<ide> with open(tmp_filename, "rb") as file:
<ide> assert SCHEMA_JSON == file.read() | 8 |
Javascript | Javascript | use new .applymatrix4() method | d8d0bdd512bb642b2118784375b38b2c1c9ee8d8 | <ide><path>src/core/BufferGeometry.js
<ide> BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy
<ide>
<ide> if ( position !== undefined ) {
<ide>
<del> matrix.applyToBufferAttribute( position );
<add> position.applyMatrix4( matrix );
<add>
<ide> position.needsUpdate = true;
<ide>
<ide> } | 1 |
Text | Text | update the link for understand data volumes | b1c2d425e167e6f939a192c87a7a40f449f07e32 | <ide><path>docs/reference/commandline/system_prune.md
<ide> Total reclaimed space: 13.5 MB
<ide> * [volume inspect](volume_inspect.md)
<ide> * [volume rm](volume_rm.md)
<ide> * [volume prune](volume_prune.md)
<del>* [Understand Data Volumes](../../tutorials/dockervolumes.md)
<add>* [Understand Data Volumes](https://docs.docker.com/engine/tutorials/dockervolumes/)
<ide> * [system df](system_df.md)
<ide> * [container prune](container_prune.md)
<ide> * [image prune](image_prune.md)
<ide><path>docs/reference/commandline/volume_create.md
<ide> $ docker volume create --driver local --opt type=nfs --opt o=addr=192.168.1.1,rw
<ide> * [volume ls](volume_ls.md)
<ide> * [volume rm](volume_rm.md)
<ide> * [volume prune](volume_prune.md)
<del>* [Understand Data Volumes](../../tutorials/dockervolumes.md)
<add>* [Understand Data Volumes](https://docs.docker.com/engine/tutorials/dockervolumes/)
<ide><path>docs/reference/commandline/volume_inspect.md
<ide> Example output:
<ide> * [volume ls](volume_ls.md)
<ide> * [volume rm](volume_rm.md)
<ide> * [volume prune](volume_prune.md)
<del>* [Understand Data Volumes](../../tutorials/dockervolumes.md)
<add>* [Understand Data Volumes](https://docs.docker.com/engine/tutorials/dockervolumes/)
<ide><path>docs/reference/commandline/volume_ls.md
<ide> vol3: local
<ide> * [volume inspect](volume_inspect.md)
<ide> * [volume rm](volume_rm.md)
<ide> * [volume prune](volume_prune.md)
<del>* [Understand Data Volumes](../../tutorials/dockervolumes.md)
<add>* [Understand Data Volumes](https://docs.docker.com/engine/tutorials/dockervolumes/)
<ide><path>docs/reference/commandline/volume_prune.md
<ide> Total reclaimed space: 36 B
<ide> * [volume ls](volume_ls.md)
<ide> * [volume inspect](volume_inspect.md)
<ide> * [volume rm](volume_rm.md)
<del>* [Understand Data Volumes](../../tutorials/dockervolumes.md)
<add>* [Understand Data Volumes](https://docs.docker.com/engine/tutorials/dockervolumes/)
<ide> * [system df](system_df.md)
<ide> * [container prune](container_prune.md)
<ide> * [image prune](image_prune.md)
<ide><path>docs/reference/commandline/volume_rm.md
<ide> Remove one or more volumes. You cannot remove a volume that is in use by a conta
<ide> * [volume inspect](volume_inspect.md)
<ide> * [volume ls](volume_ls.md)
<ide> * [volume prune](volume_prune.md)
<del>* [Understand Data Volumes](../../tutorials/dockervolumes.md)
<add>* [Understand Data Volumes](https://docs.docker.com/engine/tutorials/dockervolumes/) | 6 |
Python | Python | restore app.start() and app.worker_main() | 28ebcce5d277839011f7782755ac8452b37d6afe | <ide><path>celery/app/base.py
<ide> """Actual App instance implementation."""
<ide> import inspect
<ide> import os
<add>import sys
<ide> import threading
<ide> import warnings
<ide> from collections import UserDict, defaultdict, deque
<ide> from datetime import datetime
<ide> from operator import attrgetter
<ide>
<add>from click.exceptions import Exit
<ide> from kombu import pools
<ide> from kombu.clocks import LamportClock
<ide> from kombu.common import oid_from
<ide> def close(self):
<ide> self._pool = None
<ide> _deregister_app(self)
<ide>
<add> def start(self, argv=None):
<add> from celery.bin.celery import celery
<add>
<add> celery.params[0].default = self
<add>
<add> try:
<add> celery.main(args=argv, standalone_mode=False)
<add> except Exit as e:
<add> return e.exit_code
<add> finally:
<add> celery.params[0].default = None
<add>
<add> def worker_main(self, argv=None):
<add> if argv is None:
<add> argv = sys.argv
<add>
<add> if 'worker' not in argv:
<add> raise ValueError(
<add> "The worker sub-command must be specified in argv.\n"
<add> "Use app.start() to programmatically start other commands."
<add> )
<add>
<add> self.start(argv=argv)
<add>
<ide> def task(self, *args, **opts):
<ide> """Decorator to create a task class out of any callable.
<ide> | 1 |
PHP | PHP | fix coding style | 9b464ea677b583752b32ba52dada2a31db8522f6 | <ide><path>src/Illuminate/Foundation/Testing/Concerns/InteractsWithPages.php
<ide> protected function getSelectedValue($selector)
<ide>
<ide> if ($element == 'input') {
<ide> $value = $this->getCheckedValueFromRadioGroup($field);
<add>
<ide> return $value ? [$value] : [];
<ide> }
<ide> | 1 |
Python | Python | remove support for markdown<2.1 | 29dfbabaf54d75801b404e253a2d7574fa415564 | <ide><path>djangorestframework/compat.py
<ide> def process_view(self, request, callback, callback_args, callback_kwargs):
<ide> try:
<ide> import markdown
<ide>
<del> class CustomSetextHeaderProcessor(markdown.blockprocessors.BlockProcessor):
<del> """
<del> Class for markdown < 2.1
<del>
<del> Override `markdown`'s :class:`SetextHeaderProcessor`, so that ==== headers are <h2> and ---- heade
<del>
<del> We use <h1> for the resource name.
<del> """
<del> import re
<del> # Detect Setext-style header. Must be first 2 lines of block.
<del> RE = re.compile(r'^.*?\n[=-]{3,}', re.MULTILINE)
<del>
<del> def test(self, parent, block):
<del> return bool(self.RE.match(block))
<del>
<del> def run(self, parent, blocks):
<del> lines = blocks.pop(0).split('\n')
<del> # Determine level. ``=`` is 1 and ``-`` is 2.
<del> if lines[1].startswith('='):
<del> level = 2
<del> else:
<del> level = 3
<del> h = markdown.etree.SubElement(parent, 'h%d' % level)
<del> h.text = lines[0].strip()
<del> if len(lines) > 2:
<del> # Block contains additional lines. Add to master blocks for later.
<del> blocks.insert(0, '\n'.join(lines[2:]))
<del>
<ide> def apply_markdown(text):
<ide> """
<ide> Simple wrapper around :func:`markdown.markdown` to set the base level
<ide> def apply_markdown(text):
<ide>
<ide> extensions = ['headerid(level=2)']
<ide> safe_mode = False,
<del>
<del> if markdown.version_info < (2, 1):
<del> output_format = markdown.DEFAULT_OUTPUT_FORMAT
<del>
<del> md = markdown.Markdown(extensions=markdown.load_extensions(extensions),
<del> safe_mode=safe_mode,
<del> output_format=output_format)
<del> md.parser.blockprocessors['setextheader'] = CustomSetextHeaderProcessor(md.parser)
<del> else:
<del> md = markdown.Markdown(extensions=extensions, safe_mode=safe_mode)
<add> md = markdown.Markdown(extensions=extensions, safe_mode=safe_mode)
<ide> return md.convert(text)
<ide>
<ide> except ImportError:
<ide> apply_markdown = None
<ide>
<add>
<ide> # Yaml is optional
<ide> try:
<ide> import yaml | 1 |
Ruby | Ruby | refactor some code in multiparameter assignment | 2a700a03cee5366ad4a9af5b5f3a9c31a7e991fd | <ide><path>activerecord/lib/active_record/attribute_assignment.rb
<ide> def assign_multiparameter_attributes(pairs)
<ide> )
<ide> end
<ide>
<del> def instantiate_time_object(name, values)
<del> if self.class.send(:create_time_zone_conversion_attribute?, name, column_for_attribute(name))
<del> Time.zone.local(*values)
<del> else
<del> Time.time_with_datetime_fallback(self.class.default_timezone, *values)
<del> end
<del> end
<del>
<ide> def execute_callstack_for_multiparameter_attributes(callstack)
<ide> errors = []
<ide> callstack.each do |name, values_with_empty_parameters|
<ide> def execute_callstack_for_multiparameter_attributes(callstack)
<ide> end
<ide> end
<ide>
<add> def extract_callstack_for_multiparameter_attributes(pairs)
<add> attributes = { }
<add>
<add> pairs.each do |(multiparameter_name, value)|
<add> attribute_name = multiparameter_name.split("(").first
<add> attributes[attribute_name] ||= {}
<add>
<add> parameter_value = value.empty? ? nil : type_cast_attribute_value(multiparameter_name, value)
<add> attributes[attribute_name][find_parameter_position(multiparameter_name)] ||= parameter_value
<add> end
<add>
<add> attributes
<add> end
<add>
<add> def instantiate_time_object(name, values)
<add> if self.class.send(:create_time_zone_conversion_attribute?, name, column_for_attribute(name))
<add> Time.zone.local(*values)
<add> else
<add> Time.time_with_datetime_fallback(self.class.default_timezone, *values)
<add> end
<add> end
<add>
<ide> def read_value_from_parameter(name, values_hash_from_param)
<add> return if values_hash_from_param.values.compact.empty?
<add>
<ide> klass = (self.class.reflect_on_aggregation(name.to_sym) || column_for_attribute(name)).klass
<del> if values_hash_from_param.values.all?{|v|v.nil?}
<del> nil
<del> elsif klass == Time
<add> if klass == Time
<ide> read_time_parameter_value(name, values_hash_from_param)
<ide> elsif klass == Date
<ide> read_date_parameter_value(name, values_hash_from_param)
<ide> def extract_max_param_for_multiparameter_attributes(values_hash_from_param, uppe
<ide> [values_hash_from_param.keys.max,upper_cap].min
<ide> end
<ide>
<del> def extract_callstack_for_multiparameter_attributes(pairs)
<del> attributes = { }
<del>
<del> pairs.each do |pair|
<del> multiparameter_name, value = pair
<del> attribute_name = multiparameter_name.split("(").first
<del> attributes[attribute_name] = {} unless attributes.include?(attribute_name)
<del>
<del> parameter_value = value.empty? ? nil : type_cast_attribute_value(multiparameter_name, value)
<del> attributes[attribute_name][find_parameter_position(multiparameter_name)] ||= parameter_value
<del> end
<del>
<del> attributes
<del> end
<del>
<ide> def type_cast_attribute_value(multiparameter_name, value)
<ide> multiparameter_name =~ /\([0-9]*([if])\)/ ? value.send("to_" + $1) : value
<ide> end | 1 |
Javascript | Javascript | add jest entry file for external-server-runtime | 4e27881cfe8cb00a645134f1b4710b648a59bcd9 | <ide><path>packages/react-dom/unstable_server-external-runtime.js
<add>/**
<add> * Copyright (c) Facebook, Inc. and its affiliates.
<add> *
<add> * This source code is licensed under the MIT license found in the
<add> * LICENSE file in the root directory of this source tree.
<add> *
<add> * @flow
<add> */
<add>
<add>export * from 'react-dom/src/server/ReactDOMServerExternalRuntime'; | 1 |
Javascript | Javascript | move pipe/tcpconnectwrap to obj destructuring | e88cd882f5646539a9eef1f8a717a0f0a39c1781 | <ide><path>lib/net.js
<ide> const {
<ide>
<ide> const { Buffer } = require('buffer');
<ide> const TTYWrap = process.binding('tty_wrap');
<del>const { TCP, constants: TCPConstants } = process.binding('tcp_wrap');
<del>const { Pipe, constants: PipeConstants } = process.binding('pipe_wrap');
<del>const { TCPConnectWrap } = process.binding('tcp_wrap');
<del>const { PipeConnectWrap } = process.binding('pipe_wrap');
<ide> const { ShutdownWrap } = process.binding('stream_wrap');
<add>const {
<add> TCP,
<add> TCPConnectWrap,
<add> constants: TCPConstants
<add>} = process.binding('tcp_wrap');
<add>const {
<add> Pipe,
<add> PipeConnectWrap,
<add> constants: PipeConstants
<add>} = process.binding('pipe_wrap');
<ide> const {
<ide> newAsyncId,
<ide> defaultTriggerAsyncIdScope, | 1 |
Text | Text | add a simple documentation index | c38eccf39d2cccd57b8c9ae6c40874270578603e | <ide><path>docs/index.md
<add>## Atom Reference
<add>
<add>* [API](api/index.html)
<add>
<add>## Atom Guides
<add>
<add>* [Getting Started](getting-started.html)
<add>* [Configuring Atom](configuring-atom.html)
<add>* Builtin Packages
<add> * [Introduction](built-in-packages/intro.html)
<add> * [Command Panel](built-in-packages/command-panel.html)
<add> * [Markdown Preview](built-in-packages/markdown-preview.html)
<add> * [Wrap Guide](built-in-packages/wrap-guide.html)
<add>* Packages
<add> * [Authoring Packages](packages/authoring-packages.html)
<add> * [Creating a Package](packages/creating_a_package.html)
<add> * [Included Libraries](packages/included_libraries.html)
<add> * [package.json](packages/package_json.html)
<add>* Themes
<add> * [Authoring Themes](themes/authoring-themes.html)
<add>
<add> | 1 |
Javascript | Javascript | use extend to avoid overwriting prototype | 3abb3fefe653df2a4cb730cface0049939c18efd | <ide><path>lib/promises-aplus/promises-aplus-test-adapter.js
<ide> var minErr = function minErr (module, constructor) {
<ide> };
<ide> };
<ide>
<add>var extend = function extend(dst) {
<add> for (var i = 1, ii = arguments.length; i < ii; i++) {
<add> var obj = arguments[i];
<add> if (obj) {
<add> var keys = Object.keys(obj);
<add> for (var j = 0, jj = keys.length; j < jj; j++) {
<add> var key = keys[j];
<add> dst[key] = obj[key];
<add> }
<add> }
<add> }
<add> return dst;
<add>};
<add>
<ide> var $q = qFactory(process.nextTick, function noopExceptionHandler() {});
<ide>
<ide> exports.resolved = $q.resolve;
<ide><path>src/ng/q.js
<ide> function qFactory(nextTick, exceptionHandler) {
<ide> this.$$state = { status: 0 };
<ide> }
<ide>
<del> Promise.prototype = {
<add> extend(Promise.prototype, {
<ide> then: function(onFulfilled, onRejected, progressBack) {
<ide> var result = new Deferred();
<ide>
<ide> function qFactory(nextTick, exceptionHandler) {
<ide> return handleCallback(error, false, callback);
<ide> }, progressBack);
<ide> }
<del> };
<add> });
<ide>
<ide> //Faster, more basic than angular.bind http://jsperf.com/angular-bind-vs-custom-vs-native
<ide> function simpleBind(context, fn) {
<ide> function qFactory(nextTick, exceptionHandler) {
<ide> this.notify = simpleBind(this, this.notify);
<ide> }
<ide>
<del> Deferred.prototype = {
<add> extend(Deferred.prototype, {
<ide> resolve: function(val) {
<ide> if (this.promise.$$state.status) return;
<ide> if (val === this.promise) {
<ide> function qFactory(nextTick, exceptionHandler) {
<ide> });
<ide> }
<ide> }
<del> };
<add> });
<ide>
<ide> /**
<ide> * @ngdoc method | 2 |
PHP | PHP | remove duplicate method | c1df61673157c3f4dec400d0d2e5bee43d3f4e2c | <ide><path>src/View/Helper/PaginatorHelper.php
<ide> public function __construct(View $View, $settings = []) {
<ide> $this->initStringTemplates($this->_defaultTemplates);
<ide> }
<ide>
<del>/**
<del> * Get/set templates to use.
<del> *
<del> * @param string|null|array $templates null or string allow reading templates. An array
<del> * allows templates to be added.
<del> * @return void|string|array
<del> */
<del> public function templates($templates = null) {
<del> if ($templates === null || is_string($templates)) {
<del> return $this->_templater->get($templates);
<del> }
<del> return $this->_templater->add($templates);
<del> }
<del>
<ide> /**
<ide> * Before render callback. Overridden to merge passed args with URL options.
<ide> * | 1 |
Ruby | Ruby | update ar integration tests for testcase changes | 4af46c4ba1c87333b24d820150f3ecc59165d92a | <ide><path>actionpack/test/active_record_unit.rb
<ide> def require_fixture_models
<ide> end
<ide>
<ide> class ActiveRecordTestCase < ActionController::TestCase
<add> include ActiveRecord::TestFixtures
<add>
<ide> # Set our fixture path
<ide> if ActiveRecordTestConnector.able_to_connect
<ide> self.fixture_path = [FIXTURE_LOAD_PATH]
<ide><path>actionpack/test/activerecord/render_partial_with_record_identification_test.rb
<ide> def render_with_record_collection_and_spacer_template
<ide> end
<ide>
<ide> class RenderPartialWithRecordIdentificationTest < ActiveRecordTestCase
<add> tests RenderPartialWithRecordIdentificationController
<ide> fixtures :developers, :projects, :developers_projects, :topics, :replies, :companies, :mascots
<ide>
<ide> def test_rendering_partial_with_has_many_and_belongs_to_association
<ide> def render_with_record_collection_in_deeper_nested_controller
<ide> end
<ide>
<ide> class RenderPartialWithRecordIdentificationAndNestedControllersTest < ActiveRecordTestCase
<del> def setup
<del> @controller = Fun::NestedController.new
<del> @request = ActionController::TestRequest.new
<del> @response = ActionController::TestResponse.new
<del> super
<del> end
<add> tests Fun::NestedController
<ide>
<ide> def test_render_with_record_in_nested_controller
<ide> get :render_with_record_in_nested_controller
<ide> def test_render_with_record_collection_in_nested_controller
<ide> end
<ide>
<ide> class RenderPartialWithRecordIdentificationAndNestedDeeperControllersTest < ActiveRecordTestCase
<del> def setup
<del> @controller = Fun::Serious::NestedDeeperController.new
<del> @request = ActionController::TestRequest.new
<del> @response = ActionController::TestResponse.new
<del> super
<del> end
<add> tests Fun::Serious::NestedDeeperController
<ide>
<ide> def test_render_with_record_in_deeper_nested_controller
<ide> get :render_with_record_in_deeper_nested_controller | 2 |
Text | Text | fix typoes in docker-run.1.md | a44451d40eb3e1b3d19a0525f70736406c66d2d1 | <ide><path>docs/man/docker-run.1.md
<ide> the number of containers running on the system.
<ide> For example, consider three containers, one has a cpu-share of 1024 and
<ide> two others have a cpu-share setting of 512. When processes in all three
<ide> containers attempt to use 100% of CPU, the first container would receive
<del>50% of the total CPU time. If you add a fouth container with a cpu-share
<add>50% of the total CPU time. If you add a fourth container with a cpu-share
<ide> of 1024, the first container only gets 33% of the CPU. The remaining containers
<ide> receive 16.5%, 16.5% and 33% of the CPU.
<ide>
<ide> system's page size (the value would be very large, that's millions of trillions)
<ide> Total memory limit (memory + swap)
<ide>
<ide> Set `-1` to disable swap (format: <number><optional unit>, where unit = b, k, m or g).
<del>This value should always larger than **-m**, so you should alway use this with **-m**.
<add>This value should always larger than **-m**, so you should always use this with **-m**.
<ide>
<ide> **--mac-address**=""
<ide> Container MAC address (e.g. 92:d0:c6:0a:29:33) | 1 |
Go | Go | remove custom matcher code | 951faaed664dd51d2aacfdb782534f4c46bd9e23 | <ide><path>distribution/pull_v2_unix.go
<ide> func (ld *v2LayerDescriptor) open(ctx context.Context) (distribution.ReadSeekClo
<ide> }
<ide>
<ide> func filterManifests(manifests []manifestlist.ManifestDescriptor, p specs.Platform) []manifestlist.ManifestDescriptor {
<del> p = withDefault(p)
<add> p = platforms.Normalize(withDefault(p))
<add> m := platforms.NewMatcher(p)
<ide> var matches []manifestlist.ManifestDescriptor
<ide> for _, desc := range manifests {
<del> if compareNormalized(toOCIPlatform(desc.Platform), p) {
<add> if m.Match(toOCIPlatform(desc.Platform)) {
<ide> matches = append(matches, desc)
<ide> logrus.Debugf("found match for %s with media type %s, digest %s", platforms.Format(p), desc.MediaType, desc.Digest.String())
<ide> }
<ide> }
<ide>
<ide> // deprecated: backwards compatibility with older versions that didn't compare variant
<ide> if len(matches) == 0 && p.Architecture == "arm" {
<del> p = normalize(p)
<add> p = platforms.Normalize(p)
<ide> for _, desc := range manifests {
<ide> if desc.Platform.OS == p.OS && desc.Platform.Architecture == p.Architecture {
<ide> matches = append(matches, desc)
<ide> func withDefault(p specs.Platform) specs.Platform {
<ide> }
<ide> return p
<ide> }
<del>
<del>func compareNormalized(p1, p2 specs.Platform) bool {
<del> // remove after https://github.com/containerd/containerd/pull/2414
<del> return p1.OS == p2.OS &&
<del> p1.Architecture == p2.Architecture &&
<del> p1.Variant == p2.Variant
<del>}
<del>
<del>func normalize(p specs.Platform) specs.Platform {
<del> p = platforms.Normalize(p)
<del> // remove after https://github.com/containerd/containerd/pull/2414
<del> if p.Architecture == "arm" {
<del> if p.Variant == "" {
<del> p.Variant = "v7"
<del> }
<del> }
<del> if p.Architecture == "arm64" {
<del> if p.Variant == "" {
<del> p.Variant = "v8"
<del> }
<del> }
<del> return p
<del>} | 1 |
Java | Java | update stomp decoder to handle incomplete frames | e84885c65508a6182dd8ed204afebe45503898cf | <ide><path>spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompCodec.java
<ide> public Message<byte[]> apply(Buffer buffer) {
<ide> Message<byte[]> message = DECODER.decode(buffer.byteBuffer());
<ide> if (message != null) {
<ide> next.accept(message);
<add> } else {
<add> break;
<ide> }
<ide> }
<ide> return null;
<ide><path>spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompDecoder.java
<ide> public class StompDecoder {
<ide> public Message<byte[]> decode(ByteBuffer buffer) {
<ide> skipLeadingEol(buffer);
<ide>
<del> Message<byte[]> decodedMessage;
<add> Message<byte[]> decodedMessage = null;
<add>
<add> buffer.mark();
<ide>
<ide> String command = readCommand(buffer);
<ide>
<ide> if (command.length() > 0) {
<ide> MultiValueMap<String, String> headers = readHeaders(buffer);
<ide> byte[] payload = readPayload(buffer, headers);
<ide>
<del> StompCommand stompCommand = StompCommand.valueOf(command);
<del> if ((payload.length > 0) && (!stompCommand.isBodyAllowed())) {
<del> throw new StompConversionException(stompCommand +
<del> " isn't allowed to have a body but has payload length=" + payload.length +
<del> ", headers=" + headers);
<del> }
<add> if (payload != null) {
<add> StompCommand stompCommand = StompCommand.valueOf(command);
<add> if ((payload.length > 0) && (!stompCommand.isBodyAllowed())) {
<add> throw new StompConversionException(stompCommand +
<add> " isn't allowed to have a body but has payload length=" + payload.length +
<add> ", headers=" + headers);
<add> }
<ide>
<del> decodedMessage = MessageBuilder.withPayload(payload)
<del> .setHeaders(StompHeaderAccessor.create(stompCommand, headers)).build();
<add> decodedMessage = MessageBuilder.withPayload(payload)
<add> .setHeaders(StompHeaderAccessor.create(stompCommand, headers)).build();
<ide>
<del> if (logger.isDebugEnabled()) {
<del> logger.debug("Decoded " + decodedMessage);
<add> if (logger.isDebugEnabled()) {
<add> logger.debug("Decoded " + decodedMessage);
<add> }
<add> } else {
<add> if (logger.isDebugEnabled()) {
<add> logger.debug("Received incomplete frame. Resetting buffer");
<add> }
<add> buffer.reset();
<ide> }
<ide> }
<ide> else {
<ide> private MultiValueMap<String, String> readHeaders(ByteBuffer buffer) {
<ide> String header = new String(headerStream.toByteArray(), UTF8_CHARSET);
<ide> int colonIndex = header.indexOf(':');
<ide> if ((colonIndex <= 0) || (colonIndex == header.length() - 1)) {
<del> throw new StompConversionException(
<del> "Illegal header: '" + header + "'. A header must be of the form <name>:<value");
<add> if (buffer.remaining() > 0) {
<add> throw new StompConversionException(
<add> "Illegal header: '" + header + "'. A header must be of the form <name>:<value>");
<add> }
<ide> }
<ide> else {
<ide> String headerName = unescape(header.substring(0, colonIndex));
<ide> private byte[] readPayload(ByteBuffer buffer, MultiValueMap<String, String> head
<ide> if (contentLengthString != null) {
<ide> int contentLength = Integer.valueOf(contentLengthString);
<ide> byte[] payload = new byte[contentLength];
<del> buffer.get(payload);
<del> if (buffer.remaining() < 1 || buffer.get() != 0) {
<del> throw new StompConversionException("Frame must be terminated with a null octect");
<add> if (buffer.remaining() > contentLength) {
<add> buffer.get(payload);
<add> if (buffer.get() != 0) {
<add> throw new StompConversionException("Frame must be terminated with a null octet");
<add> }
<add> } else {
<add> return null;
<ide> }
<add>
<ide> return payload;
<ide> }
<ide> else {
<ide> private byte[] readPayload(ByteBuffer buffer, MultiValueMap<String, String> head
<ide> }
<ide> }
<ide> }
<del> throw new StompConversionException("Frame must be terminated with a null octect");
<add> return null;
<ide> }
<ide>
<ide> private void skipLeadingEol(ByteBuffer buffer) {
<ide><path>spring-messaging/src/test/java/org/springframework/messaging/simp/stomp/StompCodecTests.java
<ide> public void accept(Message<byte[]> message) {
<ide> assertEquals(StompCommand.DISCONNECT, StompHeaderAccessor.wrap(messages.get(1)).getCommand());
<ide> }
<ide>
<add> @Test
<add> public void decodeFrameWithIncompleteHeader() {
<add> assertIncompleteDecode("SEND\ndestination");
<add> assertIncompleteDecode("SEND\ndestination:");
<add> assertIncompleteDecode("SEND\ndestination:test");
<add> }
<add>
<add> @Test
<add> public void decodeFrameWithoutNullOctetTerminator() {
<add> assertIncompleteDecode("SEND\ndestination:test\n");
<add> assertIncompleteDecode("SEND\ndestination:test\n\n");
<add> assertIncompleteDecode("SEND\ndestination:test\n\nThe body");
<add> }
<add>
<add> @Test
<add> public void decodeFrameWithInsufficientContent() {
<add> assertIncompleteDecode("SEND\ncontent-length:23\n\nThe body of the mess");
<add> }
<add>
<add> @Test(expected=StompConversionException.class)
<add> public void decodeFrameWithIncorrectTerminator() {
<add> decode("SEND\ncontent-length:23\n\nThe body of the message*");
<add> }
<add>
<ide> @Test
<ide> public void decodeHeartbeat() {
<ide> String frame = "\n";
<ide> public void encodeFrameWithHeadersBody() {
<ide> assertEquals("SEND\na:alpha\ncontent-length:12\n\nMessage body\0", new StompCodec().encoder().apply(frame).asString());
<ide> }
<ide>
<add> private void assertIncompleteDecode(String partialFrame) {
<add> Buffer buffer = Buffer.wrap(partialFrame);
<add> assertNull(decode(buffer));
<add> assertEquals(0, buffer.position());
<add> }
<add>
<ide> private Message<byte[]> decode(String stompFrame) {
<del> this.decoder.apply(Buffer.wrap(stompFrame));
<del> return consumer.arguments.get(0);
<add> Buffer buffer = Buffer.wrap(stompFrame);
<add> return decode(buffer);
<ide> }
<ide>
<add> private Message<byte[]> decode(Buffer buffer) {
<add> this.decoder.apply(buffer);
<add> if (consumer.arguments.isEmpty()) {
<add> return null;
<add> } else {
<add> return consumer.arguments.get(0);
<add> }
<add> }
<add>
<add>
<add>
<ide> private static final class ArgumentCapturingConsumer<T> implements Consumer<T> {
<ide>
<ide> private final List<T> arguments = new ArrayList<T>(); | 3 |
Ruby | Ruby | remove `sort` from `each_artifact` | e1670a9210d461184708217285975a0023afc20b | <ide><path>Library/Homebrew/cask/lib/hbc/artifact/relocated.rb
<ide> def add_altname_metadata(file, altname)
<ide> end
<ide>
<ide> def each_artifact
<del> # the sort is for predictability between Ruby versions
<del> @cask.artifacts[self.class.artifact_dsl_key].sort.each do |artifact|
<add> @cask.artifacts[self.class.artifact_dsl_key].each do |artifact|
<ide> load_specification(artifact)
<ide> yield
<ide> end | 1 |
Javascript | Javascript | use common.fixtures in checkserveridentity | 41b65b9fa36aef1fb40b408ee7586da5dd1c5d90 | <ide><path>test/parallel/test-https-client-checkServerIdentity.js
<ide> if (!common.hasCrypto)
<ide> common.skip('missing crypto');
<ide>
<ide> const assert = require('assert');
<add>const fixtures = require('../common/fixtures');
<ide> const https = require('https');
<del>const fs = require('fs');
<del>const path = require('path');
<ide>
<ide> const options = {
<del> key: fs.readFileSync(path.join(common.fixturesDir, 'keys/agent3-key.pem')),
<del> cert: fs.readFileSync(path.join(common.fixturesDir, 'keys/agent3-cert.pem'))
<add> key: fixtures.readKey('agent3-key.pem'),
<add> cert: fixtures.readKey('agent3-cert.pem')
<ide> };
<ide>
<ide> const server = https.createServer(options, common.mustCall(function(req, res) {
<ide> function authorized() {
<ide> const req = https.request({
<ide> port: server.address().port,
<ide> rejectUnauthorized: true,
<del> ca: [fs.readFileSync(path.join(common.fixturesDir, 'keys/ca2-cert.pem'))]
<add> ca: [fixtures.readKey('ca2-cert.pem')]
<ide> }, common.mustNotCall());
<ide> req.on('error', function(err) {
<ide> override();
<ide> function override() {
<ide> const options = {
<ide> port: server.address().port,
<ide> rejectUnauthorized: true,
<del> ca: [fs.readFileSync(path.join(common.fixturesDir, 'keys/ca2-cert.pem'))],
<add> ca: [fixtures.readKey('ca2-cert.pem')],
<ide> checkServerIdentity: function(host, cert) {
<ide> return false;
<ide> } | 1 |
Text | Text | fix typo in readme file | 865777da92a986df28d6fb40674f66198aa30cc8 | <ide><path>README.md
<ide> and may also be used independently outside Rails.
<ide> We encourage you to contribute to Ruby on Rails! Please check out the
<ide> [Contributing to Ruby on Rails guide](http://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html) for guidelines about how to proceed. [Join us!](http://contributors.rubyonrails.org)
<ide>
<del>Everyone interacting in Rails and its sub-project’s codebases, issue trackers, chat rooms, and mailing lists is expected to follow the Rails [code of conduct](http://rubyonrails.org/conduct/).
<add>Everyone interacting in Rails and its sub-projects' codebases, issue trackers, chat rooms, and mailing lists is expected to follow the Rails [code of conduct](http://rubyonrails.org/conduct/).
<ide>
<ide> ## Code Status
<ide> | 1 |
Ruby | Ruby | document the sprockets compressors | 725617a6475703270a9afd59f1cf91ac3297720a | <ide><path>actionpack/lib/sprockets/compressors.rb
<ide> module Sprockets
<del> class NullCompressor
<add> # An asset compressor which does nothing.
<add> #
<add> # This compressor simply returns the asset as-is, without any compression
<add> # whatsoever. It is useful in development mode, when compression isn't
<add> # needed but using the same asset pipeline as production is desired.
<add> class NullCompressor #:nodoc:
<ide> def compress(content)
<ide> content
<ide> end
<ide> end
<ide>
<del> class LazyCompressor
<add> # An asset compressor which only initializes the underlying compression
<add> # engine when needed.
<add> #
<add> # This postpones the initialization of the compressor until
<add> # <code>#compress</code> is called the first time.
<add> class LazyCompressor #:nodoc:
<add> # Initializes a new LazyCompressor.
<add> #
<add> # The block should return a compressor when called, i.e. an object
<add> # which responds to <code>#compress</code>.
<ide> def initialize(&block)
<ide> @block = block
<ide> end
<ide>
<del> def compressor
<del> @compressor ||= @block.call || NullCompressor.new
<del> end
<del>
<ide> def compress(content)
<ide> compressor.compress(content)
<ide> end
<add>
<add> private
<add>
<add> def compressor
<add> @compressor ||= (@block.call || NullCompressor.new)
<add> end
<ide> end
<del>end
<ide>\ No newline at end of file
<add>end | 1 |
Javascript | Javascript | redirect /challenges to /map | caa992ecff69cbf00f64baade758aea5a371eb9a | <ide><path>common/app/routes/challenges/index.js
<ide> import Challenges from './components/Challenges.jsx';
<ide>
<ide> export default {
<del> path: 'challenges',
<del> component: Challenges
<add> path: 'challenges(/:dashedName)',
<add> component: Challenges,
<add> onEnter(nextState, replace) {
<add> // redirect /challenges to /map
<add> if (nextState.location.pathname === '/challenges') {
<add> replace('/map');
<add> }
<add> }
<ide> };
<ide><path>server/boot/a-react.js
<ide> const routes = [
<ide> '/videos',
<ide> '/videos/*',
<ide> '/challenges',
<add> '/challenges/*',
<ide> '/map'
<ide> ];
<ide>
<ide> export default function reactSubRouter(app) {
<ide> // if react-router does not find a route send down the chain
<ide> .filter(({ redirect, props }) => {
<ide> if (!props && redirect) {
<del> res.redirect(redirect.pathname + redirect.search);
<add> log('react router found a redirect');
<add> return res.redirect(redirect.pathname + redirect.search);
<ide> }
<ide> if (!props) {
<ide> log(`react tried to find ${req.path} but got 404`); | 2 |
Python | Python | remove hashlib fallback for python < 2.5 | 38e152a4272f79772b48f7232fc7f3a8ebbf61a6 | <ide><path>numpy/core/code_generators/genapi.py
<ide> from __future__ import division, absolute_import, print_function
<ide>
<ide> import sys, os, re
<del>try:
<del> import hashlib
<del> md5new = hashlib.md5
<del>except ImportError:
<del> import md5
<del> md5new = md5.new
<add>import hashlib
<ide>
<ide> import textwrap
<ide>
<ide> def to_ReST(self):
<ide> return '\n'.join(lines)
<ide>
<ide> def api_hash(self):
<del> m = md5new()
<add> m = hashlib.md5()
<ide> m.update(remove_whitespace(self.return_type))
<ide> m.update('\000')
<ide> m.update(self.name)
<ide> def fullapi_hash(api_dicts):
<ide> a.extend(name)
<ide> a.extend(','.join(map(str, data)))
<ide>
<del> return md5new(''.join(a).encode('ascii')).hexdigest()
<add> return hashlib.md5(''.join(a).encode('ascii')).hexdigest()
<ide>
<ide> # To parse strings like 'hex = checksum' where hex is e.g. 0x1234567F and
<ide> # checksum a 128 bits md5 checksum (hex format as well)
<ide> def main():
<ide> tagname = sys.argv[1]
<ide> order_file = sys.argv[2]
<ide> functions = get_api_functions(tagname, order_file)
<del> m = md5new(tagname)
<add> m = hashlib.md5(tagname)
<ide> for func in functions:
<ide> print(func)
<ide> ah = func.api_hash() | 1 |
Javascript | Javascript | remove mongoose reference | f3bcafb42f58f589d85eca690b79e29236630bf1 | <ide><path>controllers/user.js
<del>var mongoose = require('mongoose');
<ide> var passport = require('passport');
<ide> var _ = require('underscore');
<ide> var User = require('../models/User'); | 1 |
Python | Python | remove "arr" from keepdims docstrings | b076bfb4804db8a6c38260cee56d03f99d860739 | <ide><path>numpy/core/fromnumeric.py
<ide> def sum(a, axis=None, dtype=None, out=None, keepdims=np._NoValue):
<ide> keepdims : bool, optional
<ide> If this is set to True, the axes which are reduced are left
<ide> in the result as dimensions with size one. With this option,
<del> the result will broadcast correctly against the original `arr`.
<add> the result will broadcast correctly against the input array.
<ide>
<ide> If the default value is passed, then `keepdims` will not be
<ide> passed through to the `sum` method of sub-classes of
<ide> def any(a, axis=None, out=None, keepdims=np._NoValue):
<ide> keepdims : bool, optional
<ide> If this is set to True, the axes which are reduced are left
<ide> in the result as dimensions with size one. With this option,
<del> the result will broadcast correctly against the original `arr`.
<add> the result will broadcast correctly against the input array.
<ide>
<ide> If the default value is passed, then `keepdims` will not be
<ide> passed through to the `any` method of sub-classes of
<ide> def all(a, axis=None, out=None, keepdims=np._NoValue):
<ide> keepdims : bool, optional
<ide> If this is set to True, the axes which are reduced are left
<ide> in the result as dimensions with size one. With this option,
<del> the result will broadcast correctly against the original `arr`.
<add> the result will broadcast correctly against the input array.
<ide>
<ide> If the default value is passed, then `keepdims` will not be
<ide> passed through to the `all` method of sub-classes of
<ide> def amax(a, axis=None, out=None, keepdims=np._NoValue):
<ide> keepdims : bool, optional
<ide> If this is set to True, the axes which are reduced are left
<ide> in the result as dimensions with size one. With this option,
<del> the result will broadcast correctly against the original `arr`.
<add> the result will broadcast correctly against the input array.
<ide>
<ide> If the default value is passed, then `keepdims` will not be
<ide> passed through to the `amax` method of sub-classes of
<ide> def amin(a, axis=None, out=None, keepdims=np._NoValue):
<ide> keepdims : bool, optional
<ide> If this is set to True, the axes which are reduced are left
<ide> in the result as dimensions with size one. With this option,
<del> the result will broadcast correctly against the original `arr`.
<add> the result will broadcast correctly against the input array.
<ide>
<ide> If the default value is passed, then `keepdims` will not be
<ide> passed through to the `amin` method of sub-classes of
<ide> def mean(a, axis=None, dtype=None, out=None, keepdims=np._NoValue):
<ide> keepdims : bool, optional
<ide> If this is set to True, the axes which are reduced are left
<ide> in the result as dimensions with size one. With this option,
<del> the result will broadcast correctly against the original `arr`.
<add> the result will broadcast correctly against the input array.
<ide>
<ide> If the default value is passed, then `keepdims` will not be
<ide> passed through to the `mean` method of sub-classes of
<ide> def std(a, axis=None, dtype=None, out=None, ddof=0, keepdims=np._NoValue):
<ide> keepdims : bool, optional
<ide> If this is set to True, the axes which are reduced are left
<ide> in the result as dimensions with size one. With this option,
<del> the result will broadcast correctly against the original `arr`.
<add> the result will broadcast correctly against the input array.
<ide>
<ide> If the default value is passed, then `keepdims` will not be
<ide> passed through to the `std` method of sub-classes of
<ide> def var(a, axis=None, dtype=None, out=None, ddof=0, keepdims=np._NoValue):
<ide> keepdims : bool, optional
<ide> If this is set to True, the axes which are reduced are left
<ide> in the result as dimensions with size one. With this option,
<del> the result will broadcast correctly against the original `arr`.
<add> the result will broadcast correctly against the input array.
<ide>
<ide> If the default value is passed, then `keepdims` will not be
<ide> passed through to the `var` method of sub-classes of | 1 |
Javascript | Javascript | fix drawerlayoutandroid not able to set opacity | 7851572b405d22dd885c291de21d5b1a30d7c92c | <ide><path>Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js
<ide> var DrawerLayoutAndroid = React.createClass({
<ide> 'none', // default
<ide> 'on-drag',
<ide> ]),
<add> /**
<add> * Specifies the background color of the drawer. The default value is white.
<add> * If you want to set the opacity of the drawer, use rgba. Example:
<add> *
<add> * ```
<add> * return (
<add> * <DrawerLayoutAndroid drawerBackgroundColor="rgba(0,0,0,0.5)">
<add> * </DrawerLayoutAndroid>
<add> * );
<add> * ```
<add> */
<add> drawerBackgroundColor: ColorPropType,
<ide> /**
<ide> * Specifies the side of the screen from which the drawer will slide in.
<ide> */
<ide> var DrawerLayoutAndroid = React.createClass({
<ide>
<ide> mixins: [NativeMethodsMixin],
<ide>
<add> getDefaultProps: function(): Object {
<add> return {
<add> drawerBackgroundColor: 'white',
<add> };
<add> },
<add>
<ide> getInitialState: function() {
<ide> return {statusBarBackgroundColor: undefined};
<ide> },
<ide> var DrawerLayoutAndroid = React.createClass({
<ide> render: function() {
<ide> var drawStatusBar = Platform.Version >= 21 && this.props.statusBarBackgroundColor;
<ide> var drawerViewWrapper =
<del> <View style={[styles.drawerSubview, {width: this.props.drawerWidth}]} collapsable={false}>
<add> <View
<add> style={[
<add> styles.drawerSubview,
<add> {width: this.props.drawerWidth, backgroundColor: this.props.drawerBackgroundColor}
<add> ]}
<add> collapsable={false}>
<ide> {this.props.renderNavigationView()}
<ide> {drawStatusBar && <View style={styles.drawerStatusBar} />}
<ide> </View>;
<ide> var styles = StyleSheet.create({
<ide> position: 'absolute',
<ide> top: 0,
<ide> bottom: 0,
<del> backgroundColor: 'white',
<ide> },
<ide> statusBar: {
<ide> height: StatusBar.currentHeight, | 1 |
Javascript | Javascript | pass additional arguments to the callback | 4f1f9cfdb721cf308ca1162b2227836dc1d28388 | <ide><path>src/ng/interval.js
<ide> function $IntervalProvider() {
<ide> * indefinitely.
<ide> * @param {boolean=} [invokeApply=true] If set to `false` skips model dirty checking, otherwise
<ide> * will invoke `fn` within the {@link ng.$rootScope.Scope#$apply $apply} block.
<add> * @param {...*=} Pass additional parameters to the executed function.
<ide> * @returns {promise} A promise which will be notified on each iteration.
<ide> *
<ide> * @example
<ide> function $IntervalProvider() {
<ide> * </example>
<ide> */
<ide> function interval(fn, delay, count, invokeApply) {
<del> var setInterval = $window.setInterval,
<add> var hasParams = arguments.length > 4,
<add> args = hasParams ? sliceArgs(arguments, 4) : [],
<add> setInterval = $window.setInterval,
<ide> clearInterval = $window.clearInterval,
<ide> iteration = 0,
<ide> skipApply = (isDefined(invokeApply) && !invokeApply),
<ide> function $IntervalProvider() {
<ide>
<ide> count = isDefined(count) ? count : 0;
<ide>
<del> promise.then(null, null, fn);
<add> promise.then(null, null, (!hasParams) ? fn : function() {
<add> fn.apply(null, args);
<add> });
<ide>
<ide> promise.$$intervalId = setInterval(function tick() {
<ide> deferred.notify(iteration++);
<ide><path>src/ngMock/angular-mocks.js
<ide> angular.mock.$LogProvider = function() {
<ide> * indefinitely.
<ide> * @param {boolean=} [invokeApply=true] If set to `false` skips model dirty checking, otherwise
<ide> * will invoke `fn` within the {@link ng.$rootScope.Scope#$apply $apply} block.
<add> * @param {...*=} Pass additional parameters to the executed function.
<ide> * @returns {promise} A promise which will be notified on each iteration.
<ide> */
<ide> angular.mock.$IntervalProvider = function() {
<ide> angular.mock.$IntervalProvider = function() {
<ide> now = 0;
<ide>
<ide> var $interval = function(fn, delay, count, invokeApply) {
<del> var iteration = 0,
<add> var hasParams = arguments.length > 4,
<add> args = hasParams ? Array.prototype.slice.call(arguments, 4) : [],
<add> iteration = 0,
<ide> skipApply = (angular.isDefined(invokeApply) && !invokeApply),
<ide> deferred = (skipApply ? $$q : $q).defer(),
<ide> promise = deferred.promise;
<ide>
<ide> count = (angular.isDefined(count)) ? count : 0;
<del> promise.then(null, null, fn);
<add> promise.then(null, null, (!hasParams) ? fn : function() {
<add> fn.apply(null, args);
<add> });
<ide>
<ide> promise.$$intervalId = nextRepeatId;
<ide>
<ide><path>test/ng/intervalSpec.js
<ide> describe('$interval', function() {
<ide> }));
<ide>
<ide>
<add> it('should allow you to specify a number of arguments', inject(function($interval, $window) {
<add> var task1 = jasmine.createSpy('task1'),
<add> task2 = jasmine.createSpy('task2'),
<add> task3 = jasmine.createSpy('task3');
<add> $interval(task1, 1000, 2, true, 'Task1');
<add> $interval(task2, 1000, 2, true, 'Task2');
<add> $interval(task3, 1000, 2, true, 'I', 'am', 'a', 'Task3', 'spy');
<add>
<add> $window.flush(1000);
<add> expect(task1).toHaveBeenCalledWith('Task1');
<add> expect(task2).toHaveBeenCalledWith('Task2');
<add> expect(task3).toHaveBeenCalledWith('I', 'am', 'a', 'Task3', 'spy');
<add>
<add> task1.reset();
<add> task2.reset();
<add> task3.reset();
<add>
<add> $window.flush(1000);
<add> expect(task1).toHaveBeenCalledWith('Task1');
<add> expect(task2).toHaveBeenCalledWith('Task2');
<add> expect(task3).toHaveBeenCalledWith('I', 'am', 'a', 'Task3', 'spy');
<add>
<add> }));
<add>
<add>
<ide> it('should return a promise which will be updated with the count on each iteration',
<ide> inject(function($interval, $window) {
<ide> var log = [], | 3 |
Ruby | Ruby | use parsed_body to auto parse the response as json | 4efbeaeaab72be070e203f39726b37703c1db1fa | <ide><path>test/controllers/direct_uploads_controller_test.rb
<ide> class ActiveStorage::S3DirectUploadsControllerTest < ActionController::TestCase
<ide> post :create, params: { blob: {
<ide> filename: "hello.txt", byte_size: 6, checksum: Digest::MD5.base64digest("Hello"), content_type: "text/plain" } }
<ide>
<del> details = JSON.parse(@response.body)
<del>
<del> assert_match /#{SERVICE_CONFIGURATIONS[:s3][:bucket]}\.s3.(\S+)?amazonaws\.com/, details["upload_to_url"]
<del> assert_equal "hello.txt", ActiveStorage::Blob.find_signed(details["signed_blob_id"]).filename.to_s
<add> @response.parsed_body.tap do |details|
<add> assert_match(/#{SERVICE_CONFIGURATIONS[:s3][:bucket]}\.s3.(\S+)?amazonaws\.com/, details["upload_to_url"])
<add> assert_equal "hello.txt", ActiveStorage::Blob.find_signed(details["signed_blob_id"]).filename.to_s
<add> end
<ide> end
<ide> end
<ide> else
<ide> class ActiveStorage::GCSDirectUploadsControllerTest < ActionController::TestCase
<ide> post :create, params: { blob: {
<ide> filename: "hello.txt", byte_size: 6, checksum: Digest::MD5.base64digest("Hello"), content_type: "text/plain" } }
<ide>
<del> details = JSON.parse(@response.body)
<del>
<del> assert_match %r{storage\.googleapis\.com/#{@config[:bucket]}}, details["upload_to_url"]
<del> assert_equal "hello.txt", ActiveStorage::Blob.find_signed(details["signed_blob_id"]).filename.to_s
<add> @response.parsed_body.tap do |details|
<add> assert_match %r{storage\.googleapis\.com/#{@config[:bucket]}}, details["upload_to_url"]
<add> assert_equal "hello.txt", ActiveStorage::Blob.find_signed(details["signed_blob_id"]).filename.to_s
<add> end
<ide> end
<ide> end
<ide> else | 1 |
Python | Python | remove duplicate methods | 41cbb25a9ae59d17990e49ca6e4e33f6ef4041c7 | <ide><path>test/test_ec2.py
<ide> def test_list_location(self):
<ide> self.assertTrue(len(locations) > 0)
<ide> self.assertTrue(locations[0].availability_zone != None)
<ide>
<del> def test_list_location(self):
<del> locations = self.driver.list_locations()
<del> self.assertTrue(len(locations) > 0)
<del> self.assertTrue(locations[0].availability_zone != None)
<del>
<ide> def test_reboot_node(self):
<ide> node = Node('i-4382922a', None, None, None, None, self.driver)
<ide> ret = self.driver.reboot_node(node)
<ide> def test_ex_list_availability_zones(self):
<ide> self.assertEqual(availability_zone.zone_state, 'available')
<ide> self.assertEqual(availability_zone.region_name, 'eu-west-1')
<ide>
<del> def test_ex_list_availability_zones(self):
<del> availability_zones = self.driver.ex_list_availability_zones()
<del> availability_zone = availability_zones[0]
<del> self.assertTrue(len(availability_zones) > 0)
<del> self.assertEqual(availability_zone.name, 'eu-west-1a')
<del> self.assertEqual(availability_zone.zone_state, 'available')
<del> self.assertEqual(availability_zone.region_name, 'eu-west-1')
<del>
<ide> def test_ex_describe_tags(self):
<ide> node = Node('i-4382922a', None, None, None, None, self.driver)
<ide> tags = self.driver.ex_describe_tags(node)
<ide> def _DescribeAvailabilityZones(self, method, url, body, headers):
<ide> body = self.fixtures.load('describe_availability_zones.xml')
<ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK])
<ide>
<del> def _DescribeAvailabilityZones(self, method, url, body, headers):
<del> body = self.fixtures.load('describe_availability_zones.xml')
<del> return (httplib.OK, body, {}, httplib.responses[httplib.OK])
<del>
<ide> def _RebootInstances(self, method, url, body, headers):
<ide> body = self.fixtures.load('reboot_instances.xml')
<ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) | 1 |
Python | Python | fix schema typo | 48c327c681da481b7c36c674307bd58adfa4286c | <ide><path>rest_framework/schemas/openapi.py
<ide> def check_duplicate_operation_id(self, paths):
<ide> 'You have a duplicated operationId in your OpenAPI schema: {operation_id}\n'
<ide> '\tRoute: {route1}, Method: {method1}\n'
<ide> '\tRoute: {route2}, Method: {method2}\n'
<del> '\tAn operationId has to be unique accros your schema. Your schema may not work in other tools.'
<add> '\tAn operationId has to be unique across your schema. Your schema may not work in other tools.'
<ide> .format(
<ide> route1=ids[operation_id]['route'],
<ide> method1=ids[operation_id]['method'], | 1 |
Java | Java | add functionalinterface annotations. | 0fba7c5530b092d13d29681298545ad98d22249a | <ide><path>src/main/java/io/reactivex/rxjava3/core/CompletableConverter.java
<ide> * @param <R> the output type
<ide> * @since 2.2
<ide> */
<add>@FunctionalInterface
<ide> public interface CompletableConverter<R> {
<ide> /**
<ide> * Applies a function to the upstream Completable and returns a converted value of type {@code R}.
<ide><path>src/main/java/io/reactivex/rxjava3/core/CompletableOnSubscribe.java
<ide> * an instance of a {@link CompletableEmitter} instance that allows pushing
<ide> * an event in a cancellation-safe manner.
<ide> */
<add>@FunctionalInterface
<ide> public interface CompletableOnSubscribe {
<ide>
<ide> /**
<ide><path>src/main/java/io/reactivex/rxjava3/core/CompletableOperator.java
<ide> /**
<ide> * Interface to map/wrap a downstream observer to an upstream observer.
<ide> */
<add>@FunctionalInterface
<ide> public interface CompletableOperator {
<ide> /**
<ide> * Applies a function to the child CompletableObserver and returns a new parent CompletableObserver.
<ide><path>src/main/java/io/reactivex/rxjava3/core/CompletableSource.java
<ide> *
<ide> * @since 2.0
<ide> */
<add>@FunctionalInterface
<ide> public interface CompletableSource {
<ide>
<ide> /**
<ide><path>src/main/java/io/reactivex/rxjava3/core/CompletableTransformer.java
<ide> * Convenience interface and callback used by the compose operator to turn a Completable into another
<ide> * Completable fluently.
<ide> */
<add>@FunctionalInterface
<ide> public interface CompletableTransformer {
<ide> /**
<ide> * Applies a function to the upstream Completable and returns a CompletableSource.
<ide><path>src/main/java/io/reactivex/rxjava3/core/FlowableConverter.java
<ide> * @param <R> the output type
<ide> * @since 2.2
<ide> */
<add>@FunctionalInterface
<ide> public interface FlowableConverter<T, R> {
<ide> /**
<ide> * Applies a function to the upstream Flowable and returns a converted value of type {@code R}.
<ide><path>src/main/java/io/reactivex/rxjava3/core/FlowableOnSubscribe.java
<ide> *
<ide> * @param <T> the value type pushed
<ide> */
<add>@FunctionalInterface
<ide> public interface FlowableOnSubscribe<T> {
<ide>
<ide> /**
<ide><path>src/main/java/io/reactivex/rxjava3/core/FlowableOperator.java
<ide> * @param <Downstream> the value type of the downstream
<ide> * @param <Upstream> the value type of the upstream
<ide> */
<add>@FunctionalInterface
<ide> public interface FlowableOperator<Downstream, Upstream> {
<ide> /**
<ide> * Applies a function to the child Subscriber and returns a new parent Subscriber.
<ide><path>src/main/java/io/reactivex/rxjava3/core/FlowableTransformer.java
<ide> * @param <Upstream> the upstream value type
<ide> * @param <Downstream> the downstream value type
<ide> */
<add>@FunctionalInterface
<ide> public interface FlowableTransformer<Upstream, Downstream> {
<ide> /**
<ide> * Applies a function to the upstream Flowable and returns a Publisher with
<ide><path>src/main/java/io/reactivex/rxjava3/core/MaybeConverter.java
<ide> * @param <R> the output type
<ide> * @since 2.2
<ide> */
<add>@FunctionalInterface
<ide> public interface MaybeConverter<T, R> {
<ide> /**
<ide> * Applies a function to the upstream Maybe and returns a converted value of type {@code R}.
<ide><path>src/main/java/io/reactivex/rxjava3/core/MaybeOnSubscribe.java
<ide> *
<ide> * @param <T> the value type pushed
<ide> */
<add>@FunctionalInterface
<ide> public interface MaybeOnSubscribe<T> {
<ide>
<ide> /**
<ide><path>src/main/java/io/reactivex/rxjava3/core/MaybeOperator.java
<ide> * @param <Downstream> the value type of the downstream
<ide> * @param <Upstream> the value type of the upstream
<ide> */
<add>@FunctionalInterface
<ide> public interface MaybeOperator<Downstream, Upstream> {
<ide> /**
<ide> * Applies a function to the child MaybeObserver and returns a new parent MaybeObserver.
<ide><path>src/main/java/io/reactivex/rxjava3/core/MaybeSource.java
<ide> * @param <T> the element type
<ide> * @since 2.0
<ide> */
<add>@FunctionalInterface
<ide> public interface MaybeSource<T> {
<ide>
<ide> /**
<ide><path>src/main/java/io/reactivex/rxjava3/core/MaybeTransformer.java
<ide> * @param <Upstream> the upstream value type
<ide> * @param <Downstream> the downstream value type
<ide> */
<add>@FunctionalInterface
<ide> public interface MaybeTransformer<Upstream, Downstream> {
<ide> /**
<ide> * Applies a function to the upstream Maybe and returns a MaybeSource with
<ide><path>src/main/java/io/reactivex/rxjava3/core/ObservableConverter.java
<ide> * @param <R> the output type
<ide> * @since 2.2
<ide> */
<add>@FunctionalInterface
<ide> public interface ObservableConverter<T, R> {
<ide> /**
<ide> * Applies a function to the upstream Observable and returns a converted value of type {@code R}.
<ide><path>src/main/java/io/reactivex/rxjava3/core/ObservableOnSubscribe.java
<ide> *
<ide> * @param <T> the value type pushed
<ide> */
<add>@FunctionalInterface
<ide> public interface ObservableOnSubscribe<T> {
<ide>
<ide> /**
<ide><path>src/main/java/io/reactivex/rxjava3/core/ObservableOperator.java
<ide> * @param <Downstream> the value type of the downstream
<ide> * @param <Upstream> the value type of the upstream
<ide> */
<add>@FunctionalInterface
<ide> public interface ObservableOperator<Downstream, Upstream> {
<ide> /**
<ide> * Applies a function to the child Observer and returns a new parent Observer.
<ide><path>src/main/java/io/reactivex/rxjava3/core/ObservableSource.java
<ide> * @param <T> the element type
<ide> * @since 2.0
<ide> */
<add>@FunctionalInterface
<ide> public interface ObservableSource<T> {
<ide>
<ide> /**
<ide><path>src/main/java/io/reactivex/rxjava3/core/ObservableTransformer.java
<ide> * @param <Upstream> the upstream value type
<ide> * @param <Downstream> the downstream value type
<ide> */
<add>@FunctionalInterface
<ide> public interface ObservableTransformer<Upstream, Downstream> {
<ide> /**
<ide> * Applies a function to the upstream Observable and returns an ObservableSource with
<ide><path>src/main/java/io/reactivex/rxjava3/core/SingleConverter.java
<ide> * @param <R> the output type
<ide> * @since 2.2
<ide> */
<add>@FunctionalInterface
<ide> public interface SingleConverter<T, R> {
<ide> /**
<ide> * Applies a function to the upstream Single and returns a converted value of type {@code R}.
<ide><path>src/main/java/io/reactivex/rxjava3/core/SingleOnSubscribe.java
<ide> *
<ide> * @param <T> the value type pushed
<ide> */
<add>@FunctionalInterface
<ide> public interface SingleOnSubscribe<T> {
<ide>
<ide> /**
<ide><path>src/main/java/io/reactivex/rxjava3/core/SingleOperator.java
<ide> * @param <Downstream> the value type of the downstream
<ide> * @param <Upstream> the value type of the upstream
<ide> */
<add>@FunctionalInterface
<ide> public interface SingleOperator<Downstream, Upstream> {
<ide> /**
<ide> * Applies a function to the child SingleObserver and returns a new parent SingleObserver.
<ide><path>src/main/java/io/reactivex/rxjava3/core/SingleSource.java
<ide> * @param <T> the element type
<ide> * @since 2.0
<ide> */
<add>@FunctionalInterface
<ide> public interface SingleSource<T> {
<ide>
<ide> /**
<ide><path>src/main/java/io/reactivex/rxjava3/core/SingleTransformer.java
<ide> * @param <Upstream> the upstream value type
<ide> * @param <Downstream> the downstream value type
<ide> */
<add>@FunctionalInterface
<ide> public interface SingleTransformer<Upstream, Downstream> {
<ide> /**
<ide> * Applies a function to the upstream Single and returns a SingleSource with
<ide><path>src/main/java/io/reactivex/rxjava3/functions/Action.java
<ide> /**
<ide> * A functional interface similar to Runnable but allows throwing a checked exception.
<ide> */
<add>@FunctionalInterface
<ide> public interface Action {
<ide> /**
<ide> * Runs the action and optionally throws a checked exception.
<ide><path>src/main/java/io/reactivex/rxjava3/functions/BiConsumer.java
<ide> * @param <T1> the first value type
<ide> * @param <T2> the second value type
<ide> */
<add>@FunctionalInterface
<ide> public interface BiConsumer<T1, T2> {
<ide>
<ide> /**
<ide><path>src/main/java/io/reactivex/rxjava3/functions/BiFunction.java
<ide> * @param <T2> the second value type
<ide> * @param <R> the result type
<ide> */
<add>@FunctionalInterface
<ide> public interface BiFunction<T1, T2, R> {
<ide>
<ide> /**
<ide><path>src/main/java/io/reactivex/rxjava3/functions/BiPredicate.java
<ide> * @param <T1> the first value
<ide> * @param <T2> the second value
<ide> */
<add>@FunctionalInterface
<ide> public interface BiPredicate<T1, T2> {
<ide>
<ide> /**
<ide><path>src/main/java/io/reactivex/rxjava3/functions/BooleanSupplier.java
<ide> /**
<ide> * A functional interface (callback) that returns a boolean value.
<ide> */
<add>@FunctionalInterface
<ide> public interface BooleanSupplier {
<ide> /**
<ide> * Returns a boolean value.
<ide><path>src/main/java/io/reactivex/rxjava3/functions/Cancellable.java
<ide> * A functional interface that has a single cancel method
<ide> * that can throw.
<ide> */
<add>@FunctionalInterface
<ide> public interface Cancellable {
<ide>
<ide> /**
<ide><path>src/main/java/io/reactivex/rxjava3/functions/Consumer.java
<ide> * A functional interface (callback) that accepts a single value.
<ide> * @param <T> the value type
<ide> */
<add>@FunctionalInterface
<ide> public interface Consumer<T> {
<ide> /**
<ide> * Consume the given value.
<ide><path>src/main/java/io/reactivex/rxjava3/functions/Function.java
<ide> * @param <T> the input value type
<ide> * @param <R> the output value type
<ide> */
<add>@FunctionalInterface
<ide> public interface Function<T, R> {
<ide> /**
<ide> * Apply some calculation to the input value and return some other value.
<ide><path>src/main/java/io/reactivex/rxjava3/functions/Function3.java
<ide> * @param <T3> the third value type
<ide> * @param <R> the result type
<ide> */
<add>@FunctionalInterface
<ide> public interface Function3<T1, T2, T3, R> {
<ide> /**
<ide> * Calculate a value based on the input values.
<ide><path>src/main/java/io/reactivex/rxjava3/functions/Function4.java
<ide> * @param <T4> the fourth value type
<ide> * @param <R> the result type
<ide> */
<add>@FunctionalInterface
<ide> public interface Function4<T1, T2, T3, T4, R> {
<ide> /**
<ide> * Calculate a value based on the input values.
<ide><path>src/main/java/io/reactivex/rxjava3/functions/Function5.java
<ide> * @param <T5> the fifth value type
<ide> * @param <R> the result type
<ide> */
<add>@FunctionalInterface
<ide> public interface Function5<T1, T2, T3, T4, T5, R> {
<ide> /**
<ide> * Calculate a value based on the input values.
<ide><path>src/main/java/io/reactivex/rxjava3/functions/Function6.java
<ide> * @param <T6> the sixth value type
<ide> * @param <R> the result type
<ide> */
<add>@FunctionalInterface
<ide> public interface Function6<T1, T2, T3, T4, T5, T6, R> {
<ide> /**
<ide> * Calculate a value based on the input values.
<ide><path>src/main/java/io/reactivex/rxjava3/functions/Function7.java
<ide> * @param <T7> the seventh value type
<ide> * @param <R> the result type
<ide> */
<add>@FunctionalInterface
<ide> public interface Function7<T1, T2, T3, T4, T5, T6, T7, R> {
<ide> /**
<ide> * Calculate a value based on the input values.
<ide><path>src/main/java/io/reactivex/rxjava3/functions/Function8.java
<ide> * @param <T8> the eighth value type
<ide> * @param <R> the result type
<ide> */
<add>@FunctionalInterface
<ide> public interface Function8<T1, T2, T3, T4, T5, T6, T7, T8, R> {
<ide> /**
<ide> * Calculate a value based on the input values.
<ide><path>src/main/java/io/reactivex/rxjava3/functions/Function9.java
<ide> * @param <T9> the ninth value type
<ide> * @param <R> the result type
<ide> */
<add>@FunctionalInterface
<ide> public interface Function9<T1, T2, T3, T4, T5, T6, T7, T8, T9, R> {
<ide> /**
<ide> * Calculate a value based on the input values.
<ide><path>src/main/java/io/reactivex/rxjava3/functions/IntFunction.java
<ide> * A functional interface (callback) that takes a primitive value and return value of type T.
<ide> * @param <T> the returned value type
<ide> */
<add>@FunctionalInterface
<ide> public interface IntFunction<T> {
<ide> /**
<ide> * Calculates a value based on a primitive integer input.
<ide><path>src/main/java/io/reactivex/rxjava3/functions/LongConsumer.java
<ide> /**
<ide> * A functional interface (callback) that consumes a primitive long value.
<ide> */
<add>@FunctionalInterface
<ide> public interface LongConsumer {
<ide> /**
<ide> * Consume a primitive long input.
<ide><path>src/main/java/io/reactivex/rxjava3/functions/Predicate.java
<ide> * A functional interface (callback) that returns true or false for the given input value.
<ide> * @param <T> the first value
<ide> */
<add>@FunctionalInterface
<ide> public interface Predicate<T> {
<ide> /**
<ide> * Test the given input value and return a boolean.
<ide><path>src/main/java/io/reactivex/rxjava3/functions/Supplier.java
<ide> * @param <T> the value type returned
<ide> * @since 3.0.0
<ide> */
<add>@FunctionalInterface
<ide> public interface Supplier<T> {
<ide>
<ide> /**
<ide><path>src/main/java/io/reactivex/rxjava3/internal/fuseable/ScalarSupplier.java
<ide> * <p>
<ide> * @param <T> the scalar value type held by the implementing reactive type
<ide> */
<add>@FunctionalInterface
<ide> public interface ScalarSupplier<T> extends Supplier<T> {
<ide>
<ide> // overridden to remove the throws Throwable
<ide><path>src/main/java/io/reactivex/rxjava3/parallel/ParallelFlowableConverter.java
<ide> * @param <R> the output type
<ide> * @since 2.2
<ide> */
<add>@FunctionalInterface
<ide> public interface ParallelFlowableConverter<T, R> {
<ide> /**
<ide> * Applies a function to the upstream ParallelFlowable and returns a converted value of type {@code R}.
<ide><path>src/main/java/io/reactivex/rxjava3/parallel/ParallelTransformer.java
<ide> * @param <Downstream> the downstream value type
<ide> * @since 2.2
<ide> */
<add>@FunctionalInterface
<ide> public interface ParallelTransformer<Upstream, Downstream> {
<ide> /**
<ide> * Applies a function to the upstream ParallelFlowable and returns a ParallelFlowable with | 46 |
Ruby | Ruby | raise an exception when double loading a formula | 4760f4e8032694d37f934257f6a58f0164438151 | <ide><path>Library/Homebrew/formulary.rb
<ide> def self.load_formula(name, path, contents, namespace)
<ide> raise "Formula loading disabled by HOMEBREW_DISABLE_LOAD_FORMULA!"
<ide> end
<ide>
<add> raise "Formula #{name} has already been loaded" if const_defined?(namespace)
<add>
<ide> mod = Module.new
<ide> const_set(namespace, mod)
<ide> begin
<ide><path>Library/Homebrew/test/formulary_spec.rb
<ide> def install
<ide> let(:bottle_dir) { Pathname.new("#{TEST_FIXTURE_DIR}/bottles") }
<ide> let(:bottle) { bottle_dir/"testball_bottle-0.1.#{Utils::Bottles.tag}.bottle.tar.gz" }
<ide>
<add> describe "::load_formula" do
<add> it "does not allow namespace repetition" do |example|
<add> definition = "Foo = Class.new(Formula)"
<add> namespace = "Test#{example.description.hash.abs}"
<add> subject.load_formula("foo", "bar", definition, namespace)
<add> expect { subject.load_formula("foo", "bar", definition, namespace) }
<add> .to raise_error RuntimeError, /already.* loaded/
<add> end
<add> end
<add>
<ide> describe "::class_s" do
<ide> it "replaces '+' with 'x'" do
<ide> expect(subject.class_s("foo++")).to eq("Fooxx") | 2 |
Go | Go | use trimspace to instead of trim | e9602f3561b78313c4d474a8d950f7cc562637e8 | <ide><path>api/client/login.go
<ide> func (cli *DockerCli) CmdLogin(args ...string) error {
<ide> if username == "" {
<ide> promptDefault("Username", authconfig.Username)
<ide> username = readInput(cli.in, cli.out)
<del> username = strings.Trim(username, " ")
<add> username = strings.TrimSpace(username)
<ide> if username == "" {
<ide> username = authconfig.Username
<ide> } | 1 |
Python | Python | pass the real version and not a default one | 03f5d80393b3a005514d06be7fc50a2683923a4e | <ide><path>libcloud/container/drivers/docker.py
<ide> def __init__(self, key='', secret='', secure=False, host='localhost',
<ide> self.connection.secure = secure
<ide> self.connection.host = host
<ide> self.connection.port = port
<add> # set API version
<add> self.version = self._get_api_version()
<ide>
<ide> def _ex_connection_class_kwargs(self):
<ide> kwargs = {} | 1 |
Python | Python | fix exception handling | 245fbe3cad7c60246be30a8d9ec2e7257da7bbac | <ide><path>libcloud/container/drivers/lxd.py
<ide> def destroy_container(self, container, ex_timeout=default_time_out):
<ide>
<ide> # Return: background operation or standard error
<ide> req = '/%s/containers/%s' % (self.version, container.name)
<del> response = self.connection.request(req, method='DELETE')
<ide>
<del> response_dict = response.parse_body()
<del> assert_response(response_dict=response_dict, status_code=100)
<add> try:
<add> response = self.connection.request(req, method='DELETE')
<add>
<add> response_dict = response.parse_body()
<add> assert_response(response_dict=response_dict, status_code=100)
<add> except BaseHTTPError as e:
<add> # handle the case where the container is running
<add> message_list = e.message.split(",")
<add> message = message_list[0].split(":")[-1]
<add> raise LXDAPIException(message=message)
<ide>
<ide> try:
<ide>
<ide> def destroy_container(self, container, ex_timeout=default_time_out):
<ide> # something is wrong
<ide> raise LXDAPIException(message=e.message)
<ide>
<add>
<ide> response_dict = response.parse_body()
<ide> assert_response(response_dict=response_dict, status_code=200)
<ide> | 1 |
Text | Text | add springboot overview under java frameworks | e7593617169e0346e24ba80935cf5fb80b35f697 | <ide><path>guide/english/java/frameworks/springboot/index.md
<add>---
<add>title: springboot
<add>---
<add>
<add>## SpringBoot
<add>- Spring Boot makes it easy to create stand-alone, production-grade Spring based Applications that you can “just run”.
<add>- Provide a radically faster and widely accessible getting started experience for all Spring development.
<add>- Be opinionated out of the box, but get out of the way quickly as requirements start to diverge from the defaults.
<add>- No requirement for XML configuration.
<add>
<add>## Why SpringBoot?
<add>- Spring framework has been around for over a decade (de facto standard framework for developing java applications)
<add>- Spring was light weight in terms of component code but heavy weight in terms of configuration
<add>- Anytime spent on writing configuration is time spent not writing application logic.
<add>- Project dependency is a thankless job.
<add>- Working with traditional spring configuration is much like ordering a pizza and explicitly specifying all of the toppings.
<add>- Reduce boilerplate coding (if 80% of projects use this, why not automate it?)
<add>
<add>### Additional Info
<add>- [About SpringBoot](https://spring.io/projects/spring-boot)
<add>- [Create a SpringBoot Application](https://start.spring.io)
<add>- [Getting Started](https://spring.io/guides/gs/spring-boot/) | 1 |
Javascript | Javascript | move ember.engine to @ember/engine | e5d33f60b33d48eecc19e04c2d84b39701604add | <ide><path>packages/@ember/application/lib/application.js
<ide> import {
<ide> BucketCache,
<ide> } from 'ember-routing';
<ide> import ApplicationInstance from '@ember/application/instance';
<del>import { Engine } from 'ember-application';
<add>import Engine from '@ember/engine';
<ide> import { privatize as P } from 'container';
<ide> import { setupApplicationRegistry } from 'ember-glimmer';
<ide> import { RouterService } from 'ember-routing';
<ide><path>packages/@ember/application/tests/application_instance_test.js
<del>import { Engine } from 'ember-application';
<add>import Engine from '@ember/engine';
<ide> import Application from '@ember/application';
<ide> import ApplicationInstance from '@ember/application/instance';
<ide> import { run } from '@ember/runloop';
<ide><path>packages/@ember/application/tests/visit_test.js
<ide> import { Object as EmberObject, inject, RSVP, onerrorDefault } from 'ember-runti
<ide> import { later } from '@ember/runloop';
<ide> import Application from '@ember/application';
<ide> import ApplicationInstance from '@ember/application/instance';
<del>import { Engine } from 'ember-application';
<add>import Engine from '@ember/engine';
<ide> import { Route } from 'ember-routing';
<ide> import { Component, helper, isSerializationFirstNode } from 'ember-glimmer';
<ide> import { compile } from 'ember-template-compiler';
<add><path>packages/@ember/engine/index.js
<del><path>packages/ember-application/lib/system/engine.js
<ide> import DAG from 'dag-map';
<ide> import { assert } from 'ember-debug';
<ide> import { get, set } from 'ember-metal';
<ide> import DefaultResolver from '@ember/application/globals-resolver';
<del>import EngineInstance from './engine-instance';
<add>import { EngineInstance } from 'ember-application';
<ide> import { RoutingService } from 'ember-routing';
<ide> import { ContainerDebugAdapter } from 'ember-extension-support';
<ide> import { ComponentLookup } from 'ember-views';
<add><path>packages/@ember/engine/tests/engine_initializers_test.js
<del><path>packages/ember-application/tests/system/engine_initializers_test.js
<ide> import { run } from '@ember/runloop';
<del>import Engine from '../../lib/system/engine';
<add>import Engine from '@ember/engine';
<ide> import { moduleFor, AbstractTestCase as TestCase } from 'internal-test-helpers';
<ide>
<ide> let MyEngine, myEngine, myEngineInstance;
<add><path>packages/@ember/engine/tests/engine_test.js
<del><path>packages/ember-application/tests/system/engine_test.js
<ide> import { context } from 'ember-environment';
<ide> import { run } from '@ember/runloop';
<del>import Engine from '../../lib/system/engine';
<add>import Engine from '@ember/engine';
<ide> import { Object as EmberObject } from 'ember-runtime';
<ide> import { privatize as P } from 'container';
<del>import { verifyInjection, verifyRegistration } from '../test-helpers/registry-check';
<add>import {
<add> verifyInjection,
<add> verifyRegistration,
<add>} from 'ember-application/tests/test-helpers/registry-check';
<ide> import { moduleFor, AbstractTestCase as TestCase } from 'internal-test-helpers';
<ide>
<ide> let engine;
<ide><path>packages/ember-application/index.js
<del>export { default as Engine } from './lib/system/engine';
<ide> export { default as EngineInstance } from './lib/system/engine-instance';
<ide> export { getEngineParent, setEngineParent } from './lib/system/engine-parent';
<ide><path>packages/ember-application/tests/system/engine_instance_initializers_test.js
<ide> import { run } from '@ember/runloop';
<del>import Engine from '../../lib/system/engine';
<add>import Engine from '@ember/engine';
<ide> import EngineInstance from '../../lib/system/engine-instance';
<ide> import { setEngineParent } from '../../lib/system/engine-parent';
<ide> import { moduleFor, AbstractTestCase as TestCase } from 'internal-test-helpers';
<ide><path>packages/ember-application/tests/system/engine_instance_test.js
<del>import Engine from '../../lib/system/engine';
<add>import Engine from '@ember/engine';
<ide> import EngineInstance from '../../lib/system/engine-instance';
<ide> import { getEngineParent, setEngineParent } from '../../lib/system/engine-parent';
<ide> import { run } from '@ember/runloop';
<ide><path>packages/ember-glimmer/tests/integration/application/engine-test.js
<ide> import { strip } from '../../utils/abstract-test-case';
<ide> import { compile } from '../../utils/helpers';
<ide> import { Controller, RSVP } from 'ember-runtime';
<ide> import { Component } from 'ember-glimmer';
<del>import { Engine } from 'ember-application';
<add>import Engine from '@ember/engine';
<ide> import { Route } from 'ember-routing';
<ide> import { next } from '@ember/runloop';
<ide>
<ide><path>packages/ember-glimmer/tests/integration/mount-test.js
<ide> import { moduleFor, ApplicationTest, RenderingTest } from '../utils/test-case';
<ide> import { compile, Component } from '../utils/helpers';
<ide> import { Controller } from 'ember-runtime';
<ide> import { set } from 'ember-metal';
<del>import { Engine, getEngineParent } from 'ember-application';
<add>import Engine from '@ember/engine';
<add>import { getEngineParent } from 'ember-application';
<ide> import { EMBER_ENGINES_MOUNT_PARAMS } from 'ember/features';
<ide>
<ide> if (EMBER_ENGINES_MOUNT_PARAMS) {
<ide><path>packages/ember/index.js
<ide> import { getOwner, setOwner } from 'ember-owner';
<ide> import Application, { onLoad, runLoadHooks } from '@ember/application';
<ide> import Resolver from '@ember/application/globals-resolver';
<ide> import ApplicationInstance from '@ember/application/instance';
<add>import Engine from '@ember/engine';
<ide>
<ide> // ****ember-environment****
<ide>
<ide> Ember.Application = Application;
<ide> Ember.DefaultResolver = Ember.Resolver = Resolver;
<ide> Ember.ApplicationInstance = ApplicationInstance;
<ide>
<add>// ****@ember/engine****
<add>Ember.Engine = Engine;
<add>
<ide> // ****ember-utils****
<ide> Ember.generateGuid = utils.generateGuid;
<ide> Ember.GUID_KEY = utils.GUID_KEY;
<ide> Ember.Router = routing.Router;
<ide> Ember.Route = routing.Route;
<ide>
<ide> // ****ember-application****
<del>Ember.Engine = application.Engine;
<ide> Ember.EngineInstance = application.EngineInstance;
<ide>
<ide> runLoadHooks('Ember.Application', Application);
<ide><path>packages/ember/tests/reexports_test.js
<ide> let allExports = [
<ide> // ember-application
<ide> ['Application', '@ember/application', 'default'],
<ide> ['ApplicationInstance', '@ember/application/instance', 'default'],
<del> ['Engine', 'ember-application'],
<add> ['Engine', '@ember/engine', 'default'],
<ide> ['EngineInstance', 'ember-application'],
<ide> ['Resolver', '@ember/application/globals-resolver', 'default'],
<ide> ['DefaultResolver', '@ember/application/globals-resolver', 'default'],
<ide><path>packages/ember/tests/routing/decoupled_basic_test.js
<ide> import { run } from '@ember/runloop';
<ide> import { Mixin, computed, set, addObserver, observer } from 'ember-metal';
<ide> import { getTextOf } from 'internal-test-helpers';
<ide> import { Component } from 'ember-glimmer';
<del>import { Engine } from 'ember-application';
<add>import Engine from '@ember/engine';
<ide> import { Transition } from 'router';
<ide>
<ide> let originalRenderSupport; | 14 |
Python | Python | refactor the main() function | 65121f7796c1577863cf59b96e46c75fef544e83 | <ide><path>glances/__init__.py
<ide> def end():
<ide> sys.exit(0)
<ide>
<ide>
<del>def main():
<del> """Main entry point for Glances.
<add>def start_standalone(config, args):
<add> """Start the standalone mode"""
<add> logger.info("Start standalone mode")
<ide>
<del> Select the mode (standalone, client or server)
<del> Run it...
<del> """
<del> # Log Glances and PSutil version
<del> logger.info('Start Glances {}'.format(__version__))
<del> logger.info('{} {} and PSutil {} detected'.format(
<del> platform.python_implementation(),
<del> platform.python_version(),
<del> psutil_version))
<add> # Share global var
<add> global standalone
<add>
<add> # Import the Glances standalone module
<add> from glances.standalone import GlancesStandalone
<add>
<add> # Init the standalone mode
<add> standalone = GlancesStandalone(config=config, args=args)
<add>
<add> # Start the standalone (CLI) loop
<add> standalone.serve_forever()
<add>
<add>
<add>def start_clientbrowser(config, args):
<add> """Start the browser client mode"""
<add> logger.info("Start client mode (browser)")
<ide>
<ide> # Share global var
<del> global core, standalone, client, server, webserver
<add> global client
<ide>
<del> # Create the Glances main instance
<del> core = GlancesMain()
<add> # Import the Glances client browser module
<add> from glances.client_browser import GlancesClientBrowser
<ide>
<del> # Catch the CTRL-C signal
<del> signal.signal(signal.SIGINT, __signal_handler)
<add> # Init the client
<add> client = GlancesClientBrowser(config=config, args=args)
<ide>
<del> # Glances can be ran in standalone, client or server mode
<del> if core.is_standalone() and not WINDOWS:
<del> logger.info("Start standalone mode")
<add> # Start the client loop
<add> client.serve_forever()
<ide>
<del> # Import the Glances standalone module
<del> from glances.standalone import GlancesStandalone
<add> # Shutdown the client
<add> client.end()
<ide>
<del> # Init the standalone mode
<del> standalone = GlancesStandalone(config=core.get_config(),
<del> args=core.get_args())
<ide>
<del> # Start the standalone (CLI) loop
<del> standalone.serve_forever()
<add>def start_client(config, args):
<add> """Start the client mode"""
<add> logger.info("Start client mode")
<ide>
<del> elif core.is_client() and not WINDOWS:
<del> if core.is_client_browser():
<del> logger.info("Start client mode (browser)")
<add> # Share global var
<add> global client
<ide>
<del> # Import the Glances client browser module
<del> from glances.client_browser import GlancesClientBrowser
<add> # Import the Glances client browser module
<add> from glances.client import GlancesClient
<ide>
<del> # Init the client
<del> client = GlancesClientBrowser(config=core.get_config(),
<del> args=core.get_args())
<add> # Init the client
<add> client = GlancesClient(config=config, args=args)
<ide>
<del> else:
<del> logger.info("Start client mode")
<add> # Test if client and server are in the same major version
<add> if not client.login():
<add> logger.critical("The server version is not compatible with the client")
<add> sys.exit(2)
<ide>
<del> # Import the Glances client module
<del> from glances.client import GlancesClient
<add> # Start the client loop
<add> client.serve_forever()
<ide>
<del> # Init the client
<del> client = GlancesClient(config=core.get_config(),
<del> args=core.get_args())
<add> # Shutdown the client
<add> client.end()
<ide>
<del> # Test if client and server are in the same major version
<del> if not client.login():
<del> logger.critical("The server version is not compatible with the client")
<del> sys.exit(2)
<ide>
<del> # Start the client loop
<del> client.serve_forever()
<add>def start_server(config, args):
<add> """Start the server mode"""
<add> logger.info("Start server mode")
<ide>
<del> # Shutdown the client
<del> client.end()
<add> # Share global var
<add> global server
<ide>
<del> elif core.is_server():
<del> logger.info("Start server mode")
<add> # Import the Glances server module
<add> from glances.server import GlancesServer
<ide>
<del> # Import the Glances server module
<del> from glances.server import GlancesServer
<add> server = GlancesServer(cached_time=args.cached_time,
<add> config=config,
<add> args=args)
<add> print('Glances server is running on {}:{}'.format(args.bind_address, args.port))
<ide>
<del> args = core.get_args()
<add> # Set the server login/password (if -P/--password tag)
<add> if args.password != "":
<add> server.add_user(args.username, args.password)
<ide>
<del> server = GlancesServer(cached_time=args.cached_time,
<del> config=core.get_config(),
<del> args=args)
<del> print('Glances server is running on {}:{}'.format(args.bind_address, args.port))
<del> # Set the server login/password (if -P/--password tag)
<del> if args.password != "":
<del> server.add_user(args.username, args.password)
<add> # Start the server loop
<add> server.serve_forever()
<ide>
<del> # Start the server loop
<del> server.serve_forever()
<add> # Shutdown the server?
<add> server.server_close()
<ide>
<del> # Shutdown the server?
<del> server.server_close()
<ide>
<del> elif core.is_webserver() or (core.is_standalone() and WINDOWS):
<del> logger.info("Start web server mode")
<add>def start_webserver(config, args):
<add> """Start the Web server mode"""
<add> logger.info("Start web server mode")
<add>
<add> # Share global var
<add> global webserver
<ide>
<del> # Import the Glances web server module
<del> from glances.webserver import GlancesWebServer
<add> # Import the Glances web server module
<add> from glances.webserver import GlancesWebServer
<ide>
<del> args = core.get_args()
<add> # Init the web server mode
<add> webserver = GlancesWebServer(config=config, args=args)
<ide>
<add> # Start the web server loop
<add> webserver.serve_forever()
<add>
<add>
<add>def main():
<add> """Main entry point for Glances.
<add>
<add> Select the mode (standalone, client or server)
<add> Run it...
<add> """
<add> # Log Glances and PSutil version
<add> logger.info('Start Glances {}'.format(__version__))
<add> logger.info('{} {} and PSutil {} detected'.format(
<add> platform.python_implementation(),
<add> platform.python_version(),
<add> psutil_version))
<add>
<add> # Share global var
<add> global core
<add>
<add> # Create the Glances main instance
<add> core = GlancesMain()
<add> config = core.get_config()
<add> args = core.get_args()
<add>
<add> # Catch the CTRL-C signal
<add> signal.signal(signal.SIGINT, __signal_handler)
<add>
<add> # Glances can be ran in standalone, client or server mode
<add> if core.is_standalone() and not WINDOWS:
<add> start_standalone(config=config, args=args)
<add> elif core.is_client() and not WINDOWS:
<add> if core.is_client_browser():
<add> start_clientbrowser(config=config, args=args)
<add> else:
<add> start_client(config=config, args=args)
<add> elif core.is_server():
<add> start_server(config=config, args=args)
<add> elif core.is_webserver() or (core.is_standalone() and WINDOWS):
<ide> # Web server mode replace the standalone mode on Windows OS
<ide> # In this case, try to start the web browser mode automaticaly
<ide> if core.is_standalone() and WINDOWS:
<ide> args.open_web_browser = True
<del>
<del> # Init the web server mode
<del> webserver = GlancesWebServer(config=core.get_config(),
<del> args=args)
<del>
<del> # Start the web server loop
<del> webserver.serve_forever()
<add> start_webserver(config=config, args=args) | 1 |
Ruby | Ruby | remove to_sql from tabledefinition | 1c9f7fa6e17d3b026ad6e0bc1f07a9dd47d8a360 | <ide><path>activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb
<ide> def references(*args)
<ide> end
<ide> alias :belongs_to :references
<ide>
<del> # Returns a String whose contents are the column definitions
<del> # concatenated together. This string can then be prepended and appended to
<del> # to generate the final SQL to create the table.
<del> def to_sql
<del> viz = @base.schema_creation
<del> columns.map { |c| viz.accept c }.join ', '
<del> end
<del>
<ide> private
<ide> def create_column_definition(name, type)
<ide> ColumnDefinition.new name, type
<ide><path>activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
<ide> def create_table(table_name, options = {})
<ide>
<ide> create_sql = "CREATE#{' TEMPORARY' if options[:temporary]} TABLE "
<ide> create_sql << "#{quote_table_name(table_name)} ("
<del> create_sql << td.to_sql
<add> create_sql << schema_creation.accept(td)
<ide> create_sql << ") #{options[:options]}"
<ide> execute create_sql
<ide> td.indexes.each_pair { |c,o| add_index table_name, c, o }
<ide><path>activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
<ide> def visit_ColumnDefinition(o)
<ide> column_sql
<ide> end
<ide>
<add> def visit_TableDefinition(o)
<add> o.columns.map { |c| accept c }.join ', '
<add> end
<add>
<ide> def quote_column_name(name)
<ide> @conn.quote_column_name name
<ide> end | 3 |
Javascript | Javascript | fix url for thumbnail. (still not working 100) | 337806deed4f75ba7d93bd14963264588c11b72e | <ide><path>web/viewer.js
<ide> var PageView = function pageView(container, content, id, pageWidth, pageHeight,
<ide>
<ide> var ThumbnailView = function thumbnailView(container, page, id, pageRatio) {
<ide> var anchor = document.createElement('a');
<del> anchor.href = '#' + id;
<add> anchor.href = PDFView.getAnchorUrl('#page=' + id);
<ide> anchor.onclick = function stopNivigation() {
<ide> PDFView.page = id;
<ide> return false; | 1 |
Javascript | Javascript | fix syntax error in fixture | 64d63b9d4ab3c6f6d1f48c4e9f06010913f7970c | <ide><path>packages/go-to-line/spec/fixtures/sample.js
<ide> var quicksort = function () {
<ide>
<ide> // adapted from:
<ide> // https://github.com/nzakas/computer-science-in-javascript/tree/master/algorithms/sorting/merge-sort-recursive
<del>var mergeSort function (items){
<add>var mergeSort = function (items){
<ide> var merge = function (left, right){
<ide> var result = [];
<ide> var il = 0; | 1 |
Java | Java | give more time to certain concurrency tests | 285ed87f177a9006330c59461ae962f811aae613 | <ide><path>src/test/java/rx/internal/operators/OperatorRetryTest.java
<ide> public void testTimeoutWithRetry() {
<ide> assertEquals("Start 6 threads, retry 5 then fail on 6", 6, so.efforts.get());
<ide> }
<ide>
<del> @Test(timeout = 10000)
<add> @Test(timeout = 15000)
<ide> public void testRetryWithBackpressure() throws InterruptedException {
<ide> final int NUM_RETRIES = RxRingBuffer.SIZE * 2;
<ide> for (int i = 0; i < 400; i++) {
<ide> public void testRetryWithBackpressure() throws InterruptedException {
<ide> inOrder.verifyNoMoreInteractions();
<ide> }
<ide> }
<del> @Test(timeout = 10000)
<add> @Test(timeout = 15000)
<ide> public void testRetryWithBackpressureParallel() throws InterruptedException {
<ide> final int NUM_RETRIES = RxRingBuffer.SIZE * 2;
<ide> int ncpu = Runtime.getRuntime().availableProcessors();
<ide><path>src/test/java/rx/subjects/ReplaySubjectBoundedConcurrencyTest.java
<ide> public void run() {
<ide>
<ide> t.join();
<ide> }
<del> @Test(timeout = 5000)
<add> @Test(timeout = 10000)
<ide> public void testConcurrentSizeAndHasAnyValueTimeBounded() throws InterruptedException {
<ide> final ReplaySubject<Object> rs = ReplaySubject.createWithTime(1, TimeUnit.MILLISECONDS, Schedulers.computation());
<ide> final CyclicBarrier cb = new CyclicBarrier(2);
<ide><path>src/test/java/rx/subjects/ReplaySubjectConcurrencyTest.java
<ide> public void call() {
<ide> worker.unsubscribe();
<ide> }
<ide> }
<del> @Test(timeout = 5000)
<add> @Test(timeout = 10000)
<ide> public void testConcurrentSizeAndHasAnyValue() throws InterruptedException {
<ide> final ReplaySubject<Object> rs = ReplaySubject.create();
<ide> final CyclicBarrier cb = new CyclicBarrier(2); | 3 |
Javascript | Javascript | allow multiple classes per stream | b8aef4dce60e65c8044f4dae5f13e4b62b72efa1 | <ide><path>packages/ember-htmlbars/lib/attr_nodes/quoted_class.js
<ide> QuotedClassAttrNode.prototype.scheduledRenderIfNeeded = function scheduledRender
<ide> }
<ide> };
<ide>
<add>function pushString(list, string) {
<add> var parts = string.split(' ');
<add> var length = parts.length;
<add> if (length === 1 && parts[0].length > 0) {
<add> list.push(parts[0]);
<add> } else {
<add> for (var i=0;i<length;i++) {
<add> if (parts[i].length > 0) {
<add> list.push(parts[i]);
<add> }
<add> }
<add> }
<add>}
<add>
<ide> QuotedClassAttrNode.prototype.render = function render(){
<ide>
<ide> var removeList = [];
<ide> QuotedClassAttrNode.prototype.render = function render(){
<ide> if (this.classNodes[i].isDirty) {
<ide> this.classNodes[i].isDirty = false;
<ide> if (this.classNodes[i].lastValue) {
<del> removeList.push(this.classNodes[i].lastValue);
<add> pushString(removeList, this.classNodes[i].lastValue);
<ide> }
<ide> if (this.classNodes[i].currentValue) {
<del> addList.push(this.classNodes[i].currentValue);
<add> pushString(addList, this.classNodes[i].currentValue);
<ide> }
<ide> }
<ide> }
<ide><path>packages/ember-htmlbars/tests/attr_nodes/class_test.js
<ide> test("attribute can use multiple props with subxpression", function() {
<ide> ok(view.$('.round')[0], 'third class found after change');
<ide> });
<ide>
<add>test("multiple classed can yield from a single id", function() {
<add> view = EmberView.create({
<add> context: {
<add> size: 'large small'
<add> },
<add> template: compile("<div class='{{size}}'></div>")
<add> });
<add> appendView(view);
<add>
<add> ok(view.$('.large')[0], 'first class found');
<add> ok(view.$('.small')[0], 'second class found');
<add>
<add> run(view, view.set, 'context.size', 'medium');
<add>
<add> ok(view.$('.large').length === 0, 'old class not found');
<add> ok(view.$('.small').length === 0, 'old class not found');
<add> ok(view.$('.medium')[0], 'new class found');
<add>});
<add>
<ide> } | 2 |
Python | Python | use s3 location for xlm-roberta model | fe9aab1055604e772be05a1cbbb36a207c177055 | <ide><path>transformers/tokenization_xlm_roberta.py
<ide> PRETRAINED_VOCAB_FILES_MAP = {
<ide> 'vocab_file':
<ide> {
<del> 'xlm-roberta-base': "https://schweter.eu/cloud/transformers/xlm-roberta-base-sentencepiece.bpe.model",
<del> 'xlm-roberta-large': "https://schweter.eu/cloud/transformers/xlm-roberta-large-sentencepiece.bpe.model",
<add> 'xlm-roberta-base': "https://s3.amazonaws.com/models.huggingface.co/bert/xlm-roberta-base-sentencepiece.bpe.model",
<add> 'xlm-roberta-large': "https://s3.amazonaws.com/models.huggingface.co/bert/xlm-roberta-large-sentencepiece.bpe.model",
<ide> }
<ide> }
<ide> | 1 |
Ruby | Ruby | use the appropriate rdoc code markup | bae07dcce2f6821e202e1e0b544421d6851e8ecf | <ide><path>railties/lib/rails/console/helpers.rb
<ide> module Rails
<ide> module ConsoleMethods
<ide> # Gets the helper methods available to the controller.
<ide> #
<del> # This method assumes an `ApplicationController` exists, and it extends `ActionController::Base`
<add> # This method assumes an +ApplicationController+ exists, and it extends +ActionController::Base+
<ide> def helper
<ide> @helper ||= ApplicationController.helpers
<ide> end
<ide>
<ide> # Gets a new instance of a controller object.
<ide> #
<del> # This method assumes an `ApplicationController` exists, and it extends `ActionController::Base`
<add> # This method assumes an +ApplicationController+ exists, and it extends +ActionController::Base+
<ide> def controller
<ide> @controller ||= ApplicationController.new
<ide> end | 1 |
Javascript | Javascript | reduce the handletoplevel() event code indirection | 808f31af5cc571880058281c3ba1e1c69ce8aa5c | <ide><path>packages/events/EventPluginHub.js
<ide> export function getListener(inst: Fiber, registrationName: string) {
<ide> * @return {*} An accumulation of synthetic events.
<ide> * @internal
<ide> */
<del>export function extractEvents(
<add>function extractEvents(
<ide> topLevelType: string,
<ide> targetInst: Fiber,
<ide> nativeEvent: AnyNativeEvent,
<ide> nativeEventTarget: EventTarget,
<del>) {
<del> let events;
<add>): Array<ReactSyntheticEvent> | ReactSyntheticEvent | null {
<add> let events = null;
<ide> for (let i = 0; i < plugins.length; i++) {
<ide> // Not every plugin in the ordering may be loaded at runtime.
<ide> const possiblePlugin: PluginModule<AnyNativeEvent> = plugins[i];
<ide> export function extractEvents(
<ide> return events;
<ide> }
<ide>
<del>/**
<del> * Enqueues a synthetic event that should be dispatched when
<del> * `processEventQueue` is invoked.
<del> *
<del> * @param {*} events An accumulation of synthetic events.
<del> * @internal
<del> */
<del>export function enqueueEvents(
<del> events: Array<ReactSyntheticEvent> | ReactSyntheticEvent,
<add>export function runEventsInBatch(
<add> events: Array<ReactSyntheticEvent> | ReactSyntheticEvent | null,
<add> simulated: boolean,
<ide> ) {
<del> if (events) {
<add> if (events !== null) {
<ide> eventQueue = accumulateInto(eventQueue, events);
<ide> }
<del>}
<ide>
<del>/**
<del> * Dispatches all synthetic events on the event queue.
<del> *
<del> * @internal
<del> */
<del>export function processEventQueue(simulated: boolean) {
<ide> // Set `eventQueue` to null before processing it so that we can tell if more
<ide> // events get enqueued while processing.
<ide> const processingEventQueue = eventQueue;
<ide> export function processEventQueue(simulated: boolean) {
<ide> // This would be a good time to rethrow if any of the event handlers threw.
<ide> ReactErrorUtils.rethrowCaughtError();
<ide> }
<add>
<add>export function runExtractedEventsInBatch(
<add> topLevelType: string,
<add> targetInst: Fiber,
<add> nativeEvent: AnyNativeEvent,
<add> nativeEventTarget: EventTarget,
<add>) {
<add> const events = extractEvents(
<add> topLevelType,
<add> targetInst,
<add> nativeEvent,
<add> nativeEventTarget,
<add> );
<add> runEventsInBatch(events, false);
<add>}
<ide><path>packages/events/ReactEventEmitterMixin.js
<del>/**
<del> * Copyright (c) 2013-present, Facebook, Inc.
<del> *
<del> * This source code is licensed under the MIT license found in the
<del> * LICENSE file in the root directory of this source tree.
<del> */
<del>
<del>import {
<del> enqueueEvents,
<del> processEventQueue,
<del> extractEvents,
<del>} from './EventPluginHub';
<del>
<del>function runEventQueueInBatch(events) {
<del> enqueueEvents(events);
<del> processEventQueue(false);
<del>}
<del>
<del>/**
<del> * Streams a fired top-level event to `EventPluginHub` where plugins have the
<del> * opportunity to create `ReactEvent`s to be dispatched.
<del> */
<del>export function handleTopLevel(
<del> topLevelType,
<del> targetInst,
<del> nativeEvent,
<del> nativeEventTarget,
<del>) {
<del> const events = extractEvents(
<del> topLevelType,
<del> targetInst,
<del> nativeEvent,
<del> nativeEventTarget,
<del> );
<del> runEventQueueInBatch(events);
<del>}
<ide><path>packages/events/__tests__/ResponderEventPlugin-test.internal.js
<ide> const run = function(config, hierarchyConfig, nativeEventConfig) {
<ide> // At this point the negotiation events have been dispatched as part of the
<ide> // extraction process, but not the side effectful events. Below, we dispatch
<ide> // side effectful events.
<del> EventPluginHub.enqueueEvents(extractedEvents);
<del> EventPluginHub.processEventQueue(true);
<add> EventPluginHub.runEventsInBatch(extractedEvents, true);
<ide>
<ide> // Ensure that every event that declared an `order`, was actually dispatched.
<ide> expect('number of events dispatched:' + runData.dispatchCount).toBe(
<ide><path>packages/react-dom/src/client/ReactDOMClientInjection.js
<ide> import BeforeInputEventPlugin from '../events/BeforeInputEventPlugin';
<ide> import ChangeEventPlugin from '../events/ChangeEventPlugin';
<ide> import DOMEventPluginOrder from '../events/DOMEventPluginOrder';
<ide> import EnterLeaveEventPlugin from '../events/EnterLeaveEventPlugin';
<del>import {handleTopLevel} from '../events/ReactBrowserEventEmitter';
<del>import {setHandleTopLevel} from '../events/ReactDOMEventListener';
<ide> import SelectEventPlugin from '../events/SelectEventPlugin';
<ide> import SimpleEventPlugin from '../events/SimpleEventPlugin';
<ide>
<del>setHandleTopLevel(handleTopLevel);
<del>
<ide> /**
<ide> * Inject modules for resolving DOM hierarchy and plugin ordering.
<ide> */
<ide><path>packages/react-dom/src/events/ChangeEventPlugin.js
<ide> * LICENSE file in the root directory of this source tree.
<ide> */
<ide>
<del>import {enqueueEvents, processEventQueue} from 'events/EventPluginHub';
<add>import * as EventPluginHub from 'events/EventPluginHub';
<ide> import {accumulateTwoPhaseDispatches} from 'events/EventPropagators';
<ide> import {enqueueStateRestore} from 'events/ReactControlledComponent';
<ide> import {batchedUpdates} from 'events/ReactGenericBatching';
<ide> function manualDispatchChangeEvent(nativeEvent) {
<ide> }
<ide>
<ide> function runEventInBatch(event) {
<del> enqueueEvents(event);
<del> processEventQueue(false);
<add> EventPluginHub.runEventsInBatch(event, false);
<ide> }
<ide>
<ide> function getInstIfValueChanged(targetInst) {
<ide><path>packages/react-dom/src/events/ReactBrowserEventEmitter.js
<ide> */
<ide>
<ide> import {registrationNameDependencies} from 'events/EventPluginRegistry';
<del>
<ide> import {
<ide> setEnabled,
<ide> isEnabled,
<ide> import {
<ide> import isEventSupported from './isEventSupported';
<ide> import BrowserEventConstants from './BrowserEventConstants';
<ide>
<del>export * from 'events/ReactEventEmitterMixin';
<del>
<ide> const {topLevelTypes} = BrowserEventConstants;
<ide>
<ide> /**
<ide><path>packages/react-dom/src/events/ReactDOMEventListener.js
<ide> */
<ide>
<ide> import {batchedUpdates} from 'events/ReactGenericBatching';
<add>import {runExtractedEventsInBatch} from 'events/EventPluginHub';
<ide> import {isFiberMounted} from 'react-reconciler/reflection';
<ide> import {HostRoot} from 'shared/ReactTypeOfWork';
<ide>
<ide> function releaseTopLevelCallbackBookKeeping(instance) {
<ide> }
<ide> }
<ide>
<del>function handleTopLevelImpl(bookKeeping) {
<add>function handleTopLevel(bookKeeping) {
<ide> let targetInst = bookKeeping.targetInst;
<ide>
<ide> // Loop through the hierarchy, in case there's any nested components.
<ide> function handleTopLevelImpl(bookKeeping) {
<ide>
<ide> for (let i = 0; i < bookKeeping.ancestors.length; i++) {
<ide> targetInst = bookKeeping.ancestors[i];
<del> _handleTopLevel(
<add> runExtractedEventsInBatch(
<ide> bookKeeping.topLevelType,
<ide> targetInst,
<ide> bookKeeping.nativeEvent,
<ide> function handleTopLevelImpl(bookKeeping) {
<ide>
<ide> // TODO: can we stop exporting these?
<ide> export let _enabled = true;
<del>export let _handleTopLevel: null;
<del>
<del>export function setHandleTopLevel(handleTopLevel) {
<del> _handleTopLevel = handleTopLevel;
<del>}
<ide>
<ide> export function setEnabled(enabled) {
<ide> _enabled = !!enabled;
<ide> export function dispatchEvent(topLevelType, nativeEvent) {
<ide> try {
<ide> // Event queue being processed in the same cycle allows
<ide> // `preventDefault`.
<del> batchedUpdates(handleTopLevelImpl, bookKeeping);
<add> batchedUpdates(handleTopLevel, bookKeeping);
<ide> } finally {
<ide> releaseTopLevelCallbackBookKeeping(bookKeeping);
<ide> }
<ide><path>packages/react-dom/src/test-utils/ReactTestUtils.js
<ide> function makeSimulator(eventType) {
<ide> // Normally extractEvent enqueues a state restore, but we'll just always
<ide> // do that since we we're by-passing it here.
<ide> ReactControlledComponent.enqueueStateRestore(domNode);
<del>
<del> EventPluginHub.enqueueEvents(event);
<del> EventPluginHub.processEventQueue(true);
<add> EventPluginHub.runEventsInBatch(event, true);
<ide> });
<ide> };
<ide> }
<ide><path>packages/react-native-renderer/src/ReactNativeEventEmitter.js
<ide> * @flow
<ide> */
<ide>
<del>import {getListener} from 'events/EventPluginHub';
<add>import {getListener, runExtractedEventsInBatch} from 'events/EventPluginHub';
<ide> import {registrationNameModules} from 'events/EventPluginRegistry';
<ide> import {batchedUpdates} from 'events/ReactGenericBatching';
<del>import {handleTopLevel} from 'events/ReactEventEmitterMixin';
<ide> import warning from 'fbjs/lib/warning';
<ide>
<ide> import {getInstanceFromNode} from './ReactNativeComponentTree';
<ide> import ReactNativeTagHandles from './ReactNativeTagHandles';
<ide>
<del>export * from 'events/ReactEventEmitterMixin';
<add>import type {AnyNativeEvent} from 'events/PluginModuleType';
<add>
<ide> export {getListener, registrationNameModules as registrationNames};
<ide>
<ide> /**
<ide> export {getListener, registrationNameModules as registrationNames};
<ide> */
<ide>
<ide> // Shared default empty native event - conserve memory.
<del>const EMPTY_NATIVE_EVENT = {};
<add>const EMPTY_NATIVE_EVENT = (({}: any): AnyNativeEvent);
<ide>
<ide> /**
<ide> * Selects a subsequence of `Touch`es, without destroying `touches`.
<ide> const removeTouchesAtIndices = function(
<ide> export function _receiveRootNodeIDEvent(
<ide> rootNodeID: number,
<ide> topLevelType: string,
<del> nativeEventParam: ?Object,
<add> nativeEventParam: ?AnyNativeEvent,
<ide> ) {
<ide> const nativeEvent = nativeEventParam || EMPTY_NATIVE_EVENT;
<ide> const inst = getInstanceFromNode(rootNodeID);
<ide> batchedUpdates(function() {
<del> handleTopLevel(topLevelType, inst, nativeEvent, nativeEvent.target);
<add> runExtractedEventsInBatch(
<add> topLevelType,
<add> inst,
<add> nativeEvent,
<add> nativeEvent.target,
<add> );
<ide> });
<ide> // React Native doesn't use ReactControlledComponent but if it did, here's
<ide> // where it would do it.
<ide> export function _receiveRootNodeIDEvent(
<ide> export function receiveEvent(
<ide> rootNodeID: number,
<ide> topLevelType: string,
<del> nativeEventParam: Object,
<add> nativeEventParam: AnyNativeEvent,
<ide> ) {
<ide> _receiveRootNodeIDEvent(rootNodeID, topLevelType, nativeEventParam);
<ide> } | 9 |
Python | Python | implement option to reset user token | d2459710cae9e17b785e1d67b11d7bc9aa39678a | <ide><path>rest_framework/authtoken/management/commands/drf_create_token.py
<ide> class Command(BaseCommand):
<ide> help = 'Create DRF Token for a given user'
<ide>
<del> def create_user_token(self, username):
<add> def create_user_token(self, username, reset_token):
<ide> user = UserModel._default_manager.get_by_natural_key(username)
<add>
<add> if reset_token:
<add> Token.objects.filter(user=user).delete()
<add>
<ide> token = Token.objects.get_or_create(user=user)
<ide> return token[0]
<ide>
<ide> def add_arguments(self, parser):
<ide> parser.add_argument('username', type=str, nargs='+')
<ide>
<add> parser.add_argument(
<add> '-r',
<add> '--reset',
<add> action='store_true',
<add> dest='reset_token',
<add> default=False,
<add> help='Reset existing User token and create a new one',
<add> )
<add>
<ide> def handle(self, *args, **options):
<ide> username = options['username']
<add> reset_token = options['reset_token']
<ide>
<ide> try:
<del> token = self.create_user_token(username)
<add> token = self.create_user_token(username, reset_token)
<ide> except UserModel.DoesNotExist:
<ide> raise CommandError(
<ide> 'Cannot create the Token: user {0} does not exist'.format(
<ide><path>tests/test_authtoken.py
<ide> def setUp(self):
<ide> self.user = User.objects.create_user(username='test_user')
<ide>
<ide> def test_command_create_user_token(self):
<del> token = AuthTokenCommand().create_user_token(self.user.username)
<add> token = AuthTokenCommand().create_user_token(self.user.username, False)
<ide> assert token is not None
<ide> token_saved = Token.objects.first()
<ide> assert token.key == token_saved.key
<ide>
<ide> def test_command_create_user_token_invalid_user(self):
<ide> with pytest.raises(User.DoesNotExist):
<del> AuthTokenCommand().create_user_token('not_existing_user')
<add> AuthTokenCommand().create_user_token('not_existing_user', False)
<add>
<add> def test_command_reset_user_token(self):
<add> AuthTokenCommand().create_user_token(self.user.username, False)
<add> first_token_key = Token.objects.first().key
<add> AuthTokenCommand().create_user_token(self.user.username, True)
<add> second_token_key = Token.objects.first().key
<add>
<add> assert first_token_key != second_token_key
<add>
<add> def test_command_do_not_reset_user_token(self):
<add> AuthTokenCommand().create_user_token(self.user.username, False)
<add> first_token_key = Token.objects.first().key
<add> AuthTokenCommand().create_user_token(self.user.username, False)
<add> second_token_key = Token.objects.first().key
<add>
<add> assert first_token_key == second_token_key | 2 |
PHP | PHP | update error message | c0f6375d7de86db7cdf1aeae6f026421cf9df741 | <ide><path>src/View/Exception/MissingCellException.php
<ide> */
<ide> class MissingCellException extends Exception {
<ide>
<del> protected $_messageTemplate = 'Cell class "%s" is missing.';
<add> protected $_messageTemplate = 'Cell class %s is missing.';
<ide>
<ide> } | 1 |
Ruby | Ruby | fix crash when using --github with a formula | 24260e7d82f446976ff63de03cf262eb0df6258b | <ide><path>Library/Homebrew/cask/cmd/info.rb
<ide> def github_remote_path(remote, path)
<ide>
<ide> def run
<ide> if args.json == "v1"
<del> puts JSON.generate(casks.map(&:to_h))
<add> puts JSON.generate(args.named.to_casks.map(&:to_h))
<ide> elsif args.github?
<ide> raise CaskUnspecifiedError if args.no_named?
<ide>
<del> args.named.to_formulae_and_casks.map do |cask|
<add> args.named.to_casks.map do |cask|
<ide> exec_browser(github_info(cask))
<ide> end
<ide> else
<del> casks.each_with_index do |cask, i|
<add> args.named.to_casks.each_with_index do |cask, i|
<ide> puts unless i.zero?
<ide> odebug "Getting info for Cask #{cask}"
<ide> self.class.info(cask) | 1 |
Text | Text | fix minor typo on pagination documentation | ffc10edd7e79ce7aa77defd642c03974580feeb5 | <ide><path>docs/api-guide/pagination.md
<ide> Proper usage of cursor pagination should have an ordering field that satisfies t
<ide> * Should be a non-nullable value that can be coerced to a string.
<ide> * The field should have a database index.
<ide>
<del>Using an ordering field that does not satisfy these constraints will generally still work, but you'll be loosing some of the benefits of cursor pagination.
<add>Using an ordering field that does not satisfy these constraints will generally still work, but you'll be losing some of the benefits of cursor pagination.
<ide>
<ide> For more technical details on the implementation we use for cursor pagination, the ["Building cursors for the Disqus API"][disqus-cursor-api] blog post gives a good overview of the basic approach.
<ide> | 1 |
PHP | PHP | add rescue helper | 931bc761ea9d6dba79bdedd444820f3e79c07b95 | <ide><path>src/Illuminate/Support/helpers.php
<ide> function preg_replace_array($pattern, array $replacements, $subject)
<ide> }
<ide> }
<ide>
<add>if (! function_exists('rescue')) {
<add> function rescue(callable $rescuee, $rescuer)
<add> {
<add> try {
<add> return $rescuee();
<add> } catch (Exception $e) {
<add> if (is_callable($rescuer)) {
<add> return $rescuer();
<add> }
<add>
<add> return $rescuer;
<add> }
<add> }
<add>}
<add>
<ide> if (! function_exists('retry')) {
<ide> /**
<ide> * Retry an operation a given number of times.
<ide><path>tests/Support/SupportHelpersTest.php
<ide> namespace Illuminate\Tests\Support;
<ide>
<ide> use stdClass;
<add>use Exception;
<ide> use ArrayAccess;
<ide> use Mockery as m;
<ide> use RuntimeException;
<ide> public function something()
<ide> })->present()->something());
<ide> }
<ide>
<add> public function testRescue()
<add> {
<add> $this->assertEquals(rescue(function () {
<add> throw new Exception;
<add> }, 'rescued!'), 'rescued!');
<add>
<add> $this->assertEquals(rescue(function () {
<add> throw new Exception;
<add> }, function () {
<add> return 'rescued!';
<add> }), 'rescued!');
<add>
<add> $this->assertEquals(rescue(function () {
<add> return 'no need to rescue';
<add> }, 'rescued!'), 'no need to rescue');
<add> }
<add>
<ide> public function testTransform()
<ide> {
<ide> $this->assertEquals(10, transform(5, function ($value) { | 2 |
Text | Text | add microsoft azure | 98f60aef130a40be260c490273d10504a7d2623c | <ide><path>docs/misc/faq.md
<ide> Cloud:
<ide>
<ide> - Amazon EC2
<ide> - Google Compute Engine
<add> - Microsoft Azure
<ide> - Rackspace
<ide>
<ide> ### How do I report a security issue with Docker? | 1 |
PHP | PHP | fix docblock typo of objectcollection class | 70d9ae9a031145cf5540004c96839a0abba7a88b | <ide><path>lib/Cake/Utility/ObjectCollection.php
<ide> * to implement its own load() functionality.
<ide> *
<ide> * All core subclasses of ObjectCollection by convention loaded objects are stored
<del> * in `$this->_loaded`. Enabled objects are stored in `$this->_enabled`. In addition
<del> * the all support an `enabled` option that controls the enabled/disabled state of the object
<add> * in `$this->_loaded`. Enabled objects are stored in `$this->_enabled`. In addition,
<add> * they all support an `enabled` option that controls the enabled/disabled state of the object
<ide> * when loaded.
<ide> *
<ide> * @package Cake.Utility | 1 |
Text | Text | remove cifar-10 from readme | 23aaaad47b8a04d3c9aed78db592b04dd8611d00 | <ide><path>privacy/README.md
<ide> respective documentations.
<ide>
<ide> ## How to run
<ide>
<del>This repository supports the MNIST, CIFAR10, and SVHN datasets. The following
<add>This repository supports the MNIST and SVHN datasets. The following
<ide> instructions are given for MNIST but can easily be adapted by replacing the
<del>flag `--dataset=mnist` by `--dataset=cifar10` or `--dataset=svhn`.
<add>flag `--dataset=mnist` by `--dataset=svhn`.
<ide> There are 2 steps: teacher training and student training. Data will be
<ide> automatically downloaded when you start the teacher training.
<ide> | 1 |
Javascript | Javascript | return the query with the findcontrols | 72f48ee089c57a8c19a17834f24cc73f23ea2ff4 | <ide><path>web/app.js
<ide> function webViewerUpdateFindMatchesCount({ matchesCount }) {
<ide> }
<ide> }
<ide>
<del>function webViewerUpdateFindControlState({ state, previous, matchesCount }) {
<add>function webViewerUpdateFindControlState({
<add> state,
<add> previous,
<add> matchesCount,
<add> rawQuery,
<add>}) {
<ide> if (PDFViewerApplication.supportsIntegratedFind) {
<ide> PDFViewerApplication.externalServices.updateFindControlState({
<ide> result: state,
<ide> findPrevious: previous,
<ide> matchesCount,
<add> rawQuery,
<ide> });
<ide> } else {
<ide> PDFViewerApplication.findBar.updateUIState(state, previous, matchesCount);
<ide><path>web/pdf_find_controller.js
<ide> class PDFFindController {
<ide> state,
<ide> previous,
<ide> matchesCount: this._requestMatchesCount(),
<add> rawQuery: this._state ? this._state.query : null,
<ide> });
<ide> }
<ide> } | 2 |
Ruby | Ruby | add check for broken taps | c7bbb904e8f83b08fe8d10913e37298fa7a03386 | <ide><path>Library/Homebrew/diagnostic.rb
<ide> def examine_git_origin(repository_path, desired_origin)
<ide> end
<ide> end
<ide>
<add> def broken_tap_msg(tap)
<add> <<~EOS
<add> #{tap.full_name} was not tapped properly.
<add> To fix:
<add> rm -rf "#{tap.path}"
<add> brew tap #{tap.name}
<add> EOS
<add> end
<add>
<add> def broken_tap(tap)
<add> return unless Utils::Git.available?
<add> return unless HOMEBREW_REPOSITORY.git?
<add>
<add> return broken_tap_msg(tap) if tap.remote.blank?
<add>
<add> tap_head = tap.git_head
<add> return broken_tap_msg(tap) if tap_head.blank?
<add>
<add> return broken_tap_msg(tap) if tap_head == HOMEBREW_REPOSITORY.git_head
<add> end
<add>
<ide> def check_for_installed_developer_tools
<ide> return if DevelopmentTools.installed?
<ide>
<ide> def check_brew_git_origin
<ide> examine_git_origin(HOMEBREW_REPOSITORY, Homebrew::EnvConfig.brew_git_remote)
<ide> end
<ide>
<del> def check_coretap_git_origin
<del> examine_git_origin(CoreTap.instance.path, Homebrew::EnvConfig.core_git_remote)
<add> def check_coretap_integrity
<add> coretap = CoreTap.instance
<add> broken_tap(coretap) || examine_git_origin(coretap.path, Homebrew::EnvConfig.core_git_remote)
<ide> end
<ide>
<del> def check_casktap_git_origin
<add> def check_casktap_integrity
<ide> default_cask_tap = Tap.default_cask_tap
<ide> return unless default_cask_tap.installed?
<ide>
<del> examine_git_origin(default_cask_tap.path, default_cask_tap.remote)
<add> broken_tap(default_cask_tap) || examine_git_origin(default_cask_tap.path, default_cask_tap.remote)
<ide> end
<ide>
<ide> sig { returns(T.nilable(String)) } | 1 |
Javascript | Javascript | hide stack trace in export warnings | 76efbcf801c5cb7de3b73025081e4a4ea4e63f9b | <ide><path>lib/dependencies/HarmonyImportSpecifierDependency.js
<ide> HarmonyImportSpecifierDependency.prototype.getWarnings = function() {
<ide> var importedModule = this.importDependency.module;
<ide> if(importedModule && importedModule.meta && importedModule.meta.harmonyModule) {
<ide> if(this.id && importedModule.isProvided(this.id) === false) {
<add> var err = new Error("export '" + this.id + "'" +
<add> (this.id !== this.name ? " (imported as '" + this.name + "')" : "") +
<add> " was not found in '" + this.importDependency.userRequest + "'");
<add> err.hideStack = true;
<ide> return [
<del> new Error("export '" + this.id + "'" +
<del> (this.id !== this.name ? " (imported as '" + this.name + "')" : "") +
<del> " was not found in '" + this.importDependency.userRequest + "'")
<add> err
<ide> ];
<ide> }
<ide> } | 1 |
Ruby | Ruby | remove redundant use of nostdout | 3f0a409ec5dff27e516faf0a282f76be99187b99 | <ide><path>Library/Homebrew/download_strategy.rb
<ide> def checkout_args
<ide> end
<ide>
<ide> def checkout
<del> nostdout { quiet_safe_system 'git', *checkout_args }
<add> quiet_safe_system 'git', *checkout_args
<ide> end
<ide>
<ide> def reset_args | 1 |
PHP | PHP | remove $name where unnecessary - unifies code base | 8d80522c5ea80c88945c842a911e359870d69df7 | <ide><path>Cake/Test/TestApp/Controller/AjaxAuthController.php
<ide> */
<ide> class AjaxAuthController extends Controller {
<ide>
<del>/**
<del> * name property
<del> *
<del> * @var string 'AjaxAuth'
<del> */
<del> public $name = 'AjaxAuth';
<del>
<ide> /**
<ide> * components property
<ide> *
<ide><path>Cake/Test/TestApp/Controller/AuthTestController.php
<ide> */
<ide> class AuthTestController extends Controller {
<ide>
<del>/**
<del> * name property
<del> *
<del> * @var string 'AuthTest'
<del> */
<del> public $name = 'AuthTest';
<del>
<ide> /**
<ide> * uses property
<ide> *
<ide><path>Cake/Test/TestApp/Controller/Component/ParamTestComponent.php
<ide> */
<ide> class ParamTestComponent extends Component {
<ide>
<del>/**
<del> * name property
<del> *
<del> * @var string 'ParamTest'
<del> */
<del> public $name = 'ParamTest';
<del>
<ide> /**
<ide> * components property
<ide> *
<ide><path>Cake/Test/TestApp/Controller/ComponentTestController.php
<ide> */
<ide> class ComponentTestController extends Controller {
<ide>
<del>/**
<del> * name property
<del> *
<del> * @var string 'ComponentTest'
<del> */
<del> public $name = 'ComponentTest';
<del>
<ide> /**
<ide> * uses property
<ide> *
<ide><path>Cake/Test/TestApp/Controller/PostsController.php
<ide> */
<ide> class PostsController extends AppController {
<ide>
<del> public $name = 'Posts';
<del>
<ide> /**
<ide> * Components array
<ide> *
<ide><path>Cake/Test/TestApp/Controller/ScaffoldArticlesController.php
<ide> */
<ide> class ScaffoldArticlesController extends Controller {
<ide>
<del>/**
<del> * name property
<del> *
<del> * @var string
<del> */
<del> public $name = 'Articles';
<del>
<ide> /**
<ide> * scaffold property
<ide> *
<ide> * @var mixed
<ide> */
<ide> public $scaffold;
<add>
<ide> }
<ide><path>Cake/Test/TestApp/Controller/SomePagesController.php
<ide> */
<ide> class SomePagesController extends Controller {
<ide>
<del>/**
<del> * name property
<del> *
<del> * @var string 'SomePages'
<del> */
<del> public $name = 'SomePages';
<del>
<ide> /**
<ide> * uses property
<ide> *
<ide><path>Cake/Test/TestApp/Controller/SomePostsController.php
<ide> */
<ide> class SomePostsController extends Controller {
<ide>
<del>/**
<del> * name property
<del> *
<del> * @var string 'SomePosts'
<del> */
<del> public $name = 'SomePosts';
<del>
<ide> /**
<ide> * uses property
<ide> *
<ide><path>Cake/Test/TestApp/Controller/TestCachedPagesController.php
<ide> */
<ide> class TestCachedPagesController extends Controller {
<ide>
<del>/**
<del> * name property
<del> *
<del> * @var string 'TestCachedPages'
<del> */
<del> public $name = 'TestCachedPages';
<del>
<ide> /**
<ide> * uses property
<ide> *
<ide><path>Cake/Test/TestApp/Controller/TestDispatchPagesController.php
<ide> */
<ide> class TestDispatchPagesController extends Controller {
<ide>
<del>/**
<del> * name property
<del> *
<del> * @var string 'TestDispatchPages'
<del> */
<del> public $name = 'TestDispatchPages';
<del>
<ide> /**
<ide> * uses property
<ide> *
<ide><path>Cake/Test/TestApp/Model/Article.php
<ide> */
<ide> class Article extends TestModel {
<ide>
<del>/**
<del> * name property
<del> *
<del> * @var string 'Article'
<del> */
<del> public $name = 'Article';
<del>
<ide> /**
<ide> * belongsTo property
<ide> *
<ide><path>Cake/Test/TestApp/Model/AuthUser.php
<ide> */
<ide> class AuthUser extends TestModel {
<ide>
<del>/**
<del> * name property
<del> *
<del> * @var string 'AuthUser'
<del> */
<del> public $name = 'AuthUser';
<del>
<ide> /**
<ide> * useDbConfig property
<ide> *
<ide><path>Cake/Test/TestApp/Model/ControllerPaginateModel.php
<ide> */
<ide> class ControllerPaginateModel extends TestModel {
<ide>
<del>/**
<del> * name property
<del> *
<del> * @var string 'ControllerPaginateModel'
<del> */
<del> public $name = 'ControllerPaginateModel';
<del>
<ide> /**
<ide> * useTable property
<ide> *
<ide><path>Cake/Test/TestApp/Model/ControllerPaginatorModel.php
<ide> */
<ide> class ControllerPaginatorModel extends TestModel {
<ide>
<del>/**
<del> * name property
<del> *
<del> * @var string 'ControllerPaginateModel'
<del> */
<del> public $name = 'ControllerPaginatorModel';
<del>
<ide> /**
<ide> * useTable property
<ide> *
<ide><path>Cake/Test/TestApp/Model/PaginatorAuthor.php
<ide> */
<ide> class PaginatorAuthor extends TestModel {
<ide>
<del>/**
<del> * name property
<del> *
<del> * @var string 'PaginatorAuthor'
<del> */
<del> public $name = 'PaginatorAuthor';
<del>
<ide> /**
<ide> * useTable property
<ide> *
<ide> * @var string 'authors'
<ide> */
<ide> public $useTable = 'authors';
<ide>
<del>/**
<del> * alias property
<del> *
<del> * @var string 'PaginatorAuthor'
<del> */
<del> public $alias = 'PaginatorAuthor';
<del>
<ide> /**
<ide> * alias property
<ide> *
<ide><path>Cake/Test/TestApp/Model/Post.php
<ide> class Post extends AppModel {
<ide>
<ide> public $useTable = 'posts';
<ide>
<del> public $name = 'Post';
<del>
<ide> /**
<ide> * find method
<ide> *
<ide><path>Cake/Test/TestApp/Model/RequestActionPost.php
<ide> *
<ide> */
<ide> class RequestActionPost extends AppModel {
<del>
<del>/**
<del> * name property
<del> *
<del> * @var string
<del> */
<del> public $name = 'RequestActionPost';
<del>
<ide> }
<ide><path>Cake/Test/TestApp/Plugin/TestPlugin/Config/Schema/schema.php
<ide>
<ide> class TestPluginAppSchema extends Schema {
<ide>
<del> public $name = 'TestPluginApp';
<del>
<ide> public $test_plugin_acos = array(
<ide> 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'key' => 'primary'),
<ide> 'parent_id' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10),
<ide><path>Cake/Test/TestApp/Plugin/TestPlugin/Model/TestPluginAuthUser.php
<ide>
<ide> class TestPluginAuthUser extends TestPluginAppModel {
<ide>
<del>/**
<del> * Name property
<del> *
<del> * @var string
<del> */
<del> public $name = 'TestPluginAuthUser';
<del>
<ide> /**
<ide> * useTable property
<ide> *
<ide><path>Cake/Test/TestApp/Plugin/TestPlugin/Model/TestPluginAuthors.php
<ide> class TestPluginAuthors extends TestPluginAppModel {
<ide>
<ide> public $useTable = 'authors';
<ide>
<del> public $name = 'TestPluginAuthors';
<del>
<ide> public $validate = array(
<ide> 'field' => array(
<ide> 'notEmpty' => array(
<ide><path>Cake/Test/TestApp/Plugin/TestPlugin/Model/TestPluginComment.php
<ide> class TestPluginComment extends TestPluginAppModel {
<ide>
<ide> public $useTable = 'test_plugin_comments';
<ide>
<del> public $name = 'TestPluginComment';
<del>
<ide> } | 21 |
Text | Text | change "virtualization" to "containerization" | 0d1c5193b389052f11d77ca576f7dbb49b601135 | <ide><path>docs/examples/mongodb.md
<ide> +++
<ide> title = "Dockerizing MongoDB"
<ide> description = "Creating a Docker image with MongoDB pre-installed using a Dockerfile and sharing the image on Docker Hub"
<del>keywords = ["docker, dockerize, dockerizing, article, example, docker.io, platform, package, installation, networking, mongodb, containers, images, image, sharing, dockerfile, build, auto-building, virtualization, framework"]
<add>keywords = ["docker, dockerize, dockerizing, article, example, docker.io, platform, package, installation, networking, mongodb, containers, images, image, sharing, dockerfile, build, auto-building, framework"]
<ide> [menu.main]
<ide> parent = "smn_applied"
<ide> +++
<ide><path>docs/installation/amazon.md
<ide> +++
<ide> title = "Amazon EC2 Installation"
<ide> description = "Installation instructions for Docker on Amazon EC2."
<del>keywords = ["amazon ec2, virtualization, cloud, docker, documentation, installation"]
<add>keywords = ["amazon ec2, cloud, docker, documentation, installation"]
<ide> [menu.main]
<ide> parent = "smn_cloud"
<ide> +++
<ide><path>docs/installation/archlinux.md
<ide> +++
<ide> title = "Installation on Arch Linux"
<ide> description = "Installation instructions for Docker on ArchLinux."
<del>keywords = ["arch linux, virtualization, docker, documentation, installation"]
<add>keywords = ["arch linux, docker, documentation, installation"]
<ide> [menu.main]
<ide> parent = "smn_linux"
<ide> +++
<ide><path>docs/installation/cruxlinux.md
<ide> +++
<ide> title = "Installation on CRUX Linux"
<ide> description = "Docker installation on CRUX Linux."
<del>keywords = ["crux linux, virtualization, Docker, documentation, installation"]
<add>keywords = ["crux linux, Docker, documentation, installation"]
<ide> [menu.main]
<ide> parent = "smn_linux"
<ide> +++
<ide><path>docs/installation/frugalware.md
<ide> +++
<ide> title = "Installation on FrugalWare"
<ide> description = "Installation instructions for Docker on FrugalWare."
<del>keywords = ["frugalware linux, virtualization, docker, documentation, installation"]
<add>keywords = ["frugalware linux, docker, documentation, installation"]
<ide> [menu.main]
<ide> parent = "smn_linux"
<ide> +++
<ide><path>docs/installation/gentoolinux.md
<ide> +++
<ide> title = "Installation on Gentoo"
<ide> description = "Installation instructions for Docker on Gentoo."
<del>keywords = ["gentoo linux, virtualization, docker, documentation, installation"]
<add>keywords = ["gentoo linux, docker, documentation, installation"]
<ide> [menu.main]
<ide> parent = "smn_linux"
<ide> +++
<ide><path>docs/installation/mac.md
<ide> and choosing "Open" from the pop-up menu.
<ide>
<ide> To run a Docker container, you:
<ide>
<del>* create a new (or start an existing) Docker virtual machine
<add>* create a new (or start an existing) virtual machine that runs Docker.
<ide> * switch your environment to your new VM
<ide> * use the `docker` client to create, load, and manage containers
<ide>
<ide><path>docs/installation/softlayer.md
<ide> +++
<ide> title = "Installation on IBM SoftLayer "
<ide> description = "Installation instructions for Docker on IBM Softlayer."
<del>keywords = ["IBM SoftLayer, virtualization, cloud, docker, documentation, installation"]
<add>keywords = ["IBM SoftLayer, cloud, docker, documentation, installation"]
<ide> [menu.main]
<ide> parent = "smn_cloud"
<ide> +++
<ide><path>docs/installation/windows.md
<ide> You install Docker using Docker Toolbox. Docker Toolbox includes the following D
<ide> Because the Docker daemon uses Linux-specific kernel features, you can't run
<ide> Docker natively in Windows. Instead, you must use `docker-machine` to create and attach to a Docker VM on your machine. This VM hosts Docker for you on your Windows system.
<ide>
<del>The Docker VM is lightweight Linux virtual machine made specifically to run the
<del>Docker daemon on Windows. The VirtualBox VM runs completely from RAM, is a
<del>small ~24MB download, and boots in approximately 5s.
<add>The virtual machine runs a lightweight Linux distribution made specifically to
<add>run the Docker daemon. The VirtualBox VM runs completely from RAM, is a small
<add>~24MB download, and boots in approximately 5s.
<ide>
<ide> ## Requirements
<ide>
<ide><path>docs/introduction/understanding-docker.md
<ide> infrastructure like a managed application. Docker helps you ship code faster,
<ide> test faster, deploy faster, and shorten the cycle between writing code and
<ide> running code.
<ide>
<del>Docker does this by combining a lightweight container virtualization platform
<del>with workflows and tooling that help you manage and deploy your applications.
<add>Docker does this by combining kernel containerization features with workflows
<add>and tooling that help you manage and deploy your applications.
<ide>
<ide> At its core, Docker provides a way to run almost any application securely
<ide> isolated in a container. The isolation and security allow you to run many
<ide> containers simultaneously on your host. The lightweight nature of containers,
<ide> which run without the extra load of a hypervisor, means you can get more out of
<ide> your hardware.
<ide>
<del>Surrounding the container virtualization are tooling and a platform which can
<del>help you in several ways:
<add>Surrounding the container is tooling and a platform which can help you in
<add>several ways:
<ide>
<ide> * getting your applications (and supporting components) into Docker containers
<ide> * distributing and shipping those containers to your teams for further development
<ide> out of the resources you have.
<ide> Docker has two major components:
<ide>
<ide>
<del>* Docker: the open source container virtualization platform.
<add>* Docker: the open source containerization platform.
<ide> * [Docker Hub](https://hub.docker.com): our Software-as-a-Service
<ide> platform for sharing and managing Docker containers.
<ide>
<ide><path>docs/misc/faq.md
<ide> https://github.com/docker/docker/blob/master/LICENSE)
<ide>
<ide> ### Does Docker run on Mac OS X or Windows?
<ide>
<del>Docker currently runs only on Linux, but you can use VirtualBox to run Docker in
<del>a virtual machine on your box, and get the best of both worlds. Check out the
<del>[*Mac OS X*](../installation/mac.md) and [*Microsoft
<add>Docker currently runs only on Linux, but you can use VirtualBox to run Docker
<add>in a virtual machine on your box, and get the best of both worlds. Check out
<add>the [*Mac OS X*](../installation/mac.md) and [*Microsoft
<ide> Windows*](../installation/windows.md) installation guides. The small Linux
<del>distribution Docker Machine can be run inside virtual machines on these two
<del>operating systems.
<add>distribution boot2docker can be set up using the Docker Machine tool to be run
<add>inside virtual machines on these two operating systems.
<ide>
<ide> >**Note:** if you are using a remote Docker daemon on a VM through Docker
<ide> >Machine, then _do not_ type the `sudo` before the `docker` commands shown in
<ide><path>docs/misc/index.md
<ide> as fast as possible.
<ide>
<ide> Docker consists of:
<ide>
<del>* The Docker Engine - our lightweight and powerful open source container
<del> virtualization technology combined with a work flow for building
<del> and containerizing your applications.
<add>* The Docker Engine - our lightweight and powerful open source containerization
<add> technology combined with a work flow for building and containerizing your
<add> applications.
<ide> * [Docker Hub](https://hub.docker.com) - our SaaS service for
<ide> sharing and managing your application stacks.
<ide>
<ide><path>docs/userguide/dockerimages.md
<ide> +++
<ide> title = "Build your own images"
<ide> description = "How to work with Docker images."
<del>keywords = ["documentation, docs, the docker guide, docker guide, docker, docker platform, virtualization framework, docker.io, Docker images, Docker image, image management, Docker repos, Docker repositories, docker, docker tag, docker tags, Docker Hub, collaboration"]
<add>keywords = ["documentation, docs, the docker guide, docker guide, docker, docker platform, docker.io, Docker images, Docker image, image management, Docker repos, Docker repositories, docker, docker tag, docker tags, Docker Hub, collaboration"]
<ide> [menu.main]
<ide> parent = "smn_containers"
<ide> weight = -4
<ide><path>docs/userguide/dockerizing.md
<ide> +++
<ide> title = "Hello world in a container"
<ide> description = "A simple 'Hello world' exercise that introduced you to Docker."
<del>keywords = ["docker guide, docker, docker platform, virtualization framework, how to, dockerize, dockerizing apps, dockerizing applications, container, containers"]
<add>keywords = ["docker guide, docker, docker platform, how to, dockerize, dockerizing apps, dockerizing applications, container, containers"]
<ide> [menu.main]
<ide> parent="smn_containers"
<ide> weight=-6
<ide><path>docs/userguide/index.md
<ide> +++
<ide> title = "The Docker user guide"
<ide> description = "The Docker user guide home page"
<del>keywords = ["docker, introduction, documentation, about, technology, docker.io, user, guide, user's, manual, platform, framework, virtualization, home, intro"]
<add>keywords = ["docker, introduction, documentation, about, technology, docker.io, user, guide, user's, manual, platform, framework, home, intro"]
<ide> [menu.main]
<ide> parent = "mn_fun_docker"
<ide> +++
<ide> Go to [Using Docker Hub](https://docs.docker.com/docker-hub).
<ide>
<ide> *How do I run applications inside containers?*
<ide>
<del>Docker offers a *container-based* virtualization platform to power your
<del>applications. To learn how to Dockerize applications and run them:
<add>Docker offers a containerization platform to power your applications. To learn
<add>how to Dockerize applications and run them:
<ide>
<ide> Go to [Dockerizing Applications](dockerizing.md).
<ide> | 15 |
Java | Java | reset bytesmessage after payload extraction | 8346eeda276907aaac0dc9393f1e5558b2ace021 | <ide><path>spring-jms/src/main/java/org/springframework/jms/listener/adapter/AbstractAdaptableMessageListener.java
<ide>
<ide> package org.springframework.jms.listener.adapter;
<ide>
<add>import javax.jms.BytesMessage;
<ide> import javax.jms.Destination;
<ide> import javax.jms.InvalidDestinationException;
<ide> import javax.jms.JMSException;
<ide> protected void handleListenerException(Throwable ex) {
<ide> /**
<ide> * Extract the message body from the given JMS message.
<ide> * @param message the JMS {@code Message}
<del> * @return the content of the message, to be passed into the
<del> * listener method as argument
<del> * @throws MessageConversionException if the message could not be unmarshaled
<add> * @return the content of the message, to be passed into the listener method
<add> * as an argument
<add> * @throws MessageConversionException if the message could not be extracted
<ide> */
<ide> protected Object extractMessage(Message message) {
<ide> try {
<ide> private class MessagingMessageConverterAdapter extends MessagingMessageConverter
<ide>
<ide> @Override
<ide> protected Object extractPayload(Message message) throws JMSException {
<del> return extractMessage(message);
<add> Object payload = extractMessage(message);
<add> if (message instanceof BytesMessage) {
<add> try {
<add> // In case the BytesMessage is going to be received as a user argument:
<add> // reset it, otherwise it would appear empty to such processing code...
<add> ((BytesMessage) message).reset();
<add> }
<add> catch (JMSException ex) {
<add> // Continue since the BytesMessage typically won't be used any further.
<add> logger.debug("Failed to reset BytesMessage after payload extraction", ex);
<add> }
<add> }
<add> return payload;
<ide> }
<ide>
<ide> @Override | 1 |
Javascript | Javascript | return 410 for api/github | ce23dcb32c9a6053aba215a0f47c5e1bc307817a | <ide><path>api-server/src/server/boot/randomAPIs.js
<del>import request from 'request';
<del>
<del>import { gitHubUserAgent } from '../../../../config/misc';
<ide> import { getRedirectParams } from '../utils/redirection';
<ide>
<del>const githubClient = process.env.GITHUB_ID;
<del>const githubSecret = process.env.GITHUB_SECRET;
<del>
<ide> module.exports = function (app) {
<ide> const router = app.loopback.Router();
<ide> const User = app.models.User;
<ide>
<del> router.get('/api/github', githubCalls);
<add> router.get('/api/github', gone);
<ide> router.get('/u/:email', unsubscribeDeprecated);
<ide> router.get('/unsubscribe/:email', unsubscribeDeprecated);
<ide> router.get('/ue/:unsubscribeId', unsubscribeById);
<ide> router.get('/resubscribe/:unsubscribeId', resubscribe);
<ide>
<ide> app.use(router);
<ide>
<add> function gone(_, res) {
<add> return res.status(410).json({
<add> message: {
<add> type: 'info',
<add> message: 'Please reload the app, this feature is no longer available.'
<add> }
<add> });
<add> }
<add>
<ide> function unsubscribeDeprecated(req, res) {
<ide> req.flash(
<ide> 'info',
<ide> module.exports = function (app) {
<ide> .catch(next);
<ide> });
<ide> }
<del>
<del> function githubCalls(req, res, next) {
<del> var githubHeaders = {
<del> headers: {
<del> 'User-Agent': gitHubUserAgent
<del> },
<del> port: 80
<del> };
<del> request(
<del> [
<del> 'https://api.github.com/repos/freecodecamp/',
<del> 'freecodecamp/pulls?client_id=',
<del> githubClient,
<del> '&client_secret=',
<del> githubSecret
<del> ].join(''),
<del> githubHeaders,
<del> function (err, status1, pulls) {
<del> if (err) {
<del> return next(err);
<del> }
<del> pulls = pulls
<del> ? Object.keys(JSON.parse(pulls)).length
<del> : "Can't connect to github";
<del>
<del> return request(
<del> [
<del> 'https://api.github.com/repos/freecodecamp/',
<del> 'freecodecamp/issues?client_id=',
<del> githubClient,
<del> '&client_secret=',
<del> githubSecret
<del> ].join(''),
<del> githubHeaders,
<del> function (err, status2, issues) {
<del> if (err) {
<del> return next(err);
<del> }
<del> issues =
<del> pulls === parseInt(pulls, 10) && issues
<del> ? Object.keys(JSON.parse(issues)).length - pulls
<del> : "Can't connect to GitHub";
<del> return res.json({
<del> issues: issues,
<del> pulls: pulls
<del> });
<del> }
<del> );
<del> }
<del> );
<del> }
<ide> };
<ide><path>config/misc.js
<ide> exports.defaultUserImage = 'https://freecodecamp.com/sample-image.png';
<del>exports.gitHubUserAgent =
<del> 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1521.3 Safari/537.36'; | 2 |
Python | Python | fix introspection of list field in schema | 32a0b62508fc6a83bc7fd80d362d67ca35b603f9 | <ide><path>rest_framework/schemas.py
<ide> def field_to_schema(field):
<ide> title = force_text(field.label) if field.label else ''
<ide> description = force_text(field.help_text) if field.help_text else ''
<ide>
<del> if isinstance(field, serializers.ListSerializer):
<add> if isinstance(field, (serializers.ListSerializer, serializers.ListField)):
<ide> child_schema = field_to_schema(field.child)
<ide> return coreschema.Array(
<ide> items=child_schema, | 1 |
Javascript | Javascript | add attribute bindings to sc.view | b058cafaac2b2bff3451073ceee232887f862b5e | <ide><path>packages/sproutcore-views/lib/views/view.js
<ide> /*globals sc_assert */
<ide>
<ide> require("sproutcore-views/system/render_buffer");
<del>var get = SC.get, set = SC.set;
<add>var get = SC.get, set = SC.set, addObserver = SC.addObserver;
<ide>
<ide> /**
<ide> @static
<ide> SC.View = SC.Object.extend(
<ide> /** @scope SC.View.prototype */ {
<ide>
<ide> /** @private */
<del> concatenatedProperties: ['classNames', 'classNameBindings'],
<add> concatenatedProperties: ['classNames', 'classNameBindings', 'attributeBindings'],
<ide>
<ide> /**
<ide> @type Boolean
<ide> SC.View = SC.Object.extend(
<ide> }
<ide> };
<ide>
<del> SC.addObserver(this, property, observer);
<add> addObserver(this, property, observer);
<ide>
<ide> // Get the class name for the property at its current value
<ide> dasherizedClass = this._classStringForProperty(property);
<ide> SC.View = SC.Object.extend(
<ide> }, this);
<ide> },
<ide>
<add> /**
<add> Iterates through the view's attribute bindings, sets up observers for each,
<add> then applies the current value of the attributes to the passed render buffer.
<add>
<add> @param {SC.RenderBuffer} buffer
<add> */
<add> _applyAttributeBindings: function(buffer) {
<add> var attributeBindings = get(this, 'attributeBindings'),
<add> attributeValue, elem;
<add>
<add> if (!attributeBindings) { return; }
<add>
<add> attributeBindings.forEach(function(attribute) {
<add> // Create an observer to add/remove/change the attribute if the
<add> // JavaScript property changes.
<add> var observer = function() {
<add> elem = this.$();
<add> attributeValue = get(this, attribute);
<add>
<add> if (typeof attributeValue === 'string') {
<add> elem.attr(attribute, attributeValue);
<add> } else if (attributeValue && typeof attributeValue === 'boolean') {
<add> elem.attr(attribute, attribute);
<add> } else {
<add> elem.removeAttr(attribute);
<add> }
<add> };
<add>
<add> addObserver(this, attribute, observer);
<add>
<add> // Determine the current value and add it to the render buffer
<add> // if necessary.
<add> attributeValue = get(this, attribute);
<add> if (typeof attributeValue === 'string') {
<add> buffer.attr(attribute, attributeValue);
<add> } else if (attributeValue && typeof attributeValue === 'boolean') {
<add> // Apply boolean attributes in the form attribute="attribute"
<add> buffer.attr(attribute, attribute);
<add> }
<add> }, this);
<add> },
<add>
<ide> /**
<ide> @private
<ide>
<ide> SC.View = SC.Object.extend(
<ide> @private
<ide> */
<ide> applyAttributesToBuffer: function(buffer) {
<del> // Creates observers for all registered class name bindings,
<del> // then adds them to the classNames array.
<add> // Creates observers for all registered class name and attribute bindings,
<add> // then adds them to the element.
<ide> this._applyClassNameBindings();
<ide>
<add> // Pass the render buffer so the method can apply attributes directly.
<add> // This isn't needed for class name bindings because they use the
<add> // existing classNames infrastructure.
<add> this._applyAttributeBindings(buffer);
<add>
<add>
<ide> buffer.addClass(get(this, 'classNames').join(' '));
<ide> buffer.id(get(this, 'elementId'));
<ide>
<ide> SC.View = SC.Object.extend(
<ide> */
<ide> classNameBindings: [],
<ide>
<add> /**
<add> A list of properties of the view to apply as attributes. If the property is
<add> a string value, the value of that string will be applied as the attribute.
<add>
<add> // Applies the type attribute to the element
<add> // with the value "button", like <div type="button">
<add> SC.View.create({
<add> attributeBindings: ['type'],
<add> type: 'button'
<add> });
<add>
<add> If the value of the property is a Boolean, the name of that property is
<add> added as an attribute.
<add>
<add> // Renders something like <div enabled="enabled">
<add> SC.View.create({
<add> attributeBindings: ['enabled'],
<add> enabled: true
<add> });
<add> */
<add> attributeBindings: [],
<add>
<ide> // .......................................................
<ide> // CORE DISPLAY METHODS
<ide> //
<ide><path>packages/sproutcore-views/tests/views/view/attribute_bindings_test.js
<add>// ==========================================================================
<add>// Project: SproutCore Views
<add>// Copyright: ©2006-2011 Strobe Inc. and contributors.
<add>// License: Licensed under MIT license (see license.js)
<add>// ==========================================================================
<add>
<add>var set = SC.set, get = SC.get;
<add>
<add>require('sproutcore-views/views/view');
<add>
<add>module("SC.View - Attribute Bindings");
<add>
<add>test("should render and update attribute bindings", function() {
<add> var view = SC.View.create({
<add> classNameBindings: ['priority', 'isUrgent', 'isClassified:classified', 'canIgnore'],
<add> attributeBindings: ['type', 'exploded', 'destroyed', 'exists'],
<add>
<add> type: 'reset',
<add> exploded: true,
<add> destroyed: true,
<add> exists: false
<add> });
<add>
<add> view.createElement();
<add> equals(view.$().attr('type'), 'reset', "adds type attribute");
<add> ok(view.$().attr('exploded'), "adds exploded attribute when true");
<add> ok(view.$().attr('destroyed'), "adds destroyed attribute when true");
<add> ok(!view.$().attr('exists'), "does not add exists attribute when false");
<add>
<add> view.set('type', 'submit');
<add> view.set('exploded', false);
<add> view.set('destroyed', false);
<add> view.set('exists', true);
<add>
<add> equals(view.$().attr('type'), 'submit', "updates type attribute");
<add> ok(!view.$().attr('exploded'), "removes exploded attribute when false");
<add> ok(!view.$().attr('destroyed'), "removes destroyed attribute when false");
<add> ok(view.$().attr('exists'), "adds exists attribute when true");
<add>});
<add>
<ide><path>packages/sproutcore-views/tests/views/view/class_name_bindings_test.js
<ide> var set = SC.set, get = SC.get;
<ide>
<ide> require('sproutcore-views/views/view');
<ide>
<del>module("SC.View - Bound Class Names");
<add>module("SC.View - Class Name Bindings");
<ide>
<ide> test("should apply bound class names to the element", function() {
<ide> var view = SC.View.create({ | 3 |
Python | Python | remove redundant sorting of eigenvalues | 26c0fcbd8ab32d3d5f4657890c5da114168cfb6d | <ide><path>numpy/polynomial/hermite.py
<ide> def hermgauss(deg):
<ide> c = np.array([0]*deg + [1], dtype=np.float64)
<ide> m = hermcompanion(c)
<ide> x = la.eigvalsh(m)
<del> x.sort()
<ide>
<ide> # improve roots by one application of Newton
<ide> dy = _normed_hermite_n(x, ideg)
<ide><path>numpy/polynomial/hermite_e.py
<ide> def hermegauss(deg):
<ide> c = np.array([0]*deg + [1])
<ide> m = hermecompanion(c)
<ide> x = la.eigvalsh(m)
<del> x.sort()
<ide>
<ide> # improve roots by one application of Newton
<ide> dy = _normed_hermite_e_n(x, ideg) | 2 |
Text | Text | fix typo in textencoding section | 98f744cbc9a6cb844595e028a23a925b7f7edfe1 | <ide><path>doc/api/util.md
<ide> const uint8array = encoder.encode('this is some data');
<ide> UTF-8 encodes the `input` string and returns a `Uint8Array` containing the
<ide> encoded bytes.
<ide>
<del>### textDecoder.encoding
<add>### textEncoder.encoding
<ide>
<ide> * {string}
<ide> | 1 |
Python | Python | test all dtypes for sort | 7f586789e4b4e84f8f947e6d61c8718b453632af | <ide><path>numpy/core/tests/test_multiarray.py
<ide> def test_sort(self):
<ide> # of sorted items must be greater than ~50 to check the actual
<ide> # algorithm because quick and merge sort fall over to insertion
<ide> # sort for small arrays.
<del> for dtype in [np.int32, np.uint32, np.float32]:
<add> # Test unsigned dtypes and nonnegative numbers
<add> for dtype in [np.uint8, np.uint16, np.uint32, np.uint64, np.float16, np.float32, np.float64, np.longdouble]:
<ide> a = np.arange(101, dtype=dtype)
<ide> b = a[::-1].copy()
<ide> for kind in self.sort_kinds:
<ide> def test_sort(self):
<ide> c.sort(kind=kind)
<ide> assert_equal(c, a, msg)
<ide>
<add> # Test signed dtypes and negative numbers as well
<add> for dtype in [np.int8, np.int16, np.int32, np.int64, np.float16, np.float32, np.float64, np.longdouble]:
<add> a = np.arange(-50, 51, dtype=dtype)
<add> b = a[::-1].copy()
<add> for kind in self.sort_kinds:
<add> msg = "scalar sort, kind=%s, dtype=%s" % (kind, dtype)
<add> c = a.copy()
<add> c.sort(kind=kind)
<add> assert_equal(c, a, msg)
<add> c = b.copy()
<add> c.sort(kind=kind)
<add> assert_equal(c, a, msg)
<add>
<ide> # test complex sorts. These use the same code as the scalars
<ide> # but the compare function differs.
<ide> ai = a*1j + 1 | 1 |
Ruby | Ruby | remove redundant `travel_back` | 12fadea8aee3981654149d6e8ff5099bca31c679 | <ide><path>activerecord/test/cases/dirty_test.rb
<ide> def test_previous_changes
<ide> assert_not_nil pirate.previous_changes["updated_on"][1]
<ide> assert_not pirate.previous_changes.key?("parrot_id")
<ide> assert_not pirate.previous_changes.key?("created_on")
<del> ensure
<del> travel_back
<ide> end
<ide>
<ide> class Testings < ActiveRecord::Base; end
<ide><path>activesupport/test/metadata/shared_metadata_tests.rb
<ide> # frozen_string_literal: true
<ide>
<ide> module SharedMessageMetadataTests
<del> def teardown
<del> travel_back
<del> super
<del> end
<del>
<ide> def null_serializing?
<ide> false
<ide> end | 2 |
Javascript | Javascript | return null error on readfile() success | 1594198600f5349d4500e4d5c3b5aa0c1192ed4e | <ide><path>lib/fs.js
<ide> function readFileAfterClose(err) {
<ide> }
<ide>
<ide> function tryToString(buf, encoding, callback) {
<del> var e;
<add> var e = null;
<ide> try {
<ide> buf = buf.toString(encoding);
<ide> } catch (err) { | 1 |
PHP | PHP | remove comment bloat from dynamic query builder | a5af988d53764d39bf1f59a6fb93baee1c4d6e85 | <ide><path>system/db/query/dynamic.php
<ide> class Dynamic {
<ide> */
<ide> public static function build($method, $parameters, $query)
<ide> {
<del> // ---------------------------------------------------------
<ide> // Strip the "where_" off of the method.
<del> // ---------------------------------------------------------
<ide> $finder = substr($method, 6);
<ide>
<del> // ---------------------------------------------------------
<ide> // Split the column names from the connectors.
<del> // ---------------------------------------------------------
<ide> $segments = preg_split('/(_and_|_or_)/i', $finder, -1, PREG_SPLIT_DELIM_CAPTURE);
<ide>
<del> // ---------------------------------------------------------
<del> // The connector variable will determine which connector
<del> // will be used for the condition. We'll change it as we
<del> // come across new connectors in the dynamic method string.
<add> // The connector variable will determine which connector will be used for the condition.
<add> // We'll change it as we come across new connectors in the dynamic method string.
<ide> //
<del> // The index variable helps us get the correct parameter
<del> // value for the where condition. We increment it each time
<del> // we add a condition.
<del> // ---------------------------------------------------------
<add> // The index variable helps us get the correct parameter value for the where condition.
<add> // We increment it each time we add a condition.
<ide> $connector = 'AND';
<ide>
<ide> $index = 0;
<ide>
<del> // ---------------------------------------------------------
<del> // Iterate through each segment and add the conditions.
<del> // ---------------------------------------------------------
<ide> foreach ($segments as $segment)
<ide> {
<ide> if ($segment != '_and_' and $segment != '_or_') | 1 |
Python | Python | remove unused is_base_form for mk lemmatizer | 185fc62f4d717aed488d34d323f4eedbf7f729ae | <ide><path>spacy/lang/mk/lemmatizer.py
<ide> def rule_lemmatize(self, token: Token) -> List[str]:
<ide> string = string[:-3]
<ide> univ_pos = "verb"
<ide>
<del> if callable(self.is_base_form) and self.is_base_form(univ_pos, morphology):
<del> return [string.lower()]
<ide> index_table = self.lookups.get_table("lemma_index", {})
<ide> exc_table = self.lookups.get_table("lemma_exc", {})
<ide> rules_table = self.lookups.get_table("lemma_rules", {}) | 1 |
Python | Python | fix provider constant in the example | 12525b5e58752df67fc5bc063aaf4a5996c2bf21 | <ide><path>example_storage.py
<ide> from libcloud.storage.types import Provider
<ide> from libcloud.storage.providers import get_driver
<ide>
<del>CloudFiles = get_driver(Provider.CloudFiles)
<add>CloudFiles = get_driver(Provider.CLOUDFILES)
<ide>
<ide> driver = CloudFiles('access key id', 'secret key')
<ide> | 1 |
Text | Text | remove missing setdatavisibility for documentation | 7752566a482f71f9905e794f9ef962bb8634127a | <ide><path>docs/docs/developers/api.md
<ide> chart.setDatasetVisibility(1, false); // hides dataset at index 1
<ide> chart.update(); // chart now renders with dataset hidden
<ide> ```
<ide>
<del>## setDataVisibility(datasetIndex, index, visibility)
<del>
<del>Like [setDatasetVisibility](#setdatasetvisibility) except that it hides only a single item in the dataset. **Note** this only applies to polar area and doughnut charts at the moment. It will have no affect on line, bar, radar, or scatter charts.
<del>
<del>```javascript
<del>chart.setDataVisibility(0, 2, false); // hides the item in dataset 0, at index 2
<del>chart.update(); // chart now renders with item hidden
<del>```
<del>
<ide> ## toggleDataVisibility(index)
<ide>
<ide> Toggles the visibility of an item in all datasets. A dataset needs to explicitly support this feature for it to have an effect. From internal chart types, doughnut / pie and polar area use this. | 1 |
Text | Text | fix broken urls in docs | c688c2f5430de350f27fda0081c6f1d83c0055b8 | <ide><path>docs/docs/axes/radial/linear.md
<ide> The following options are used to configure the point labels that are shown on t
<ide> | ---- | ---- | ------- | ------- | -----------
<ide> | `display` | `boolean` | | `true` | if true, point labels are shown.
<ide> | `callback` | `function` | | | Callback function to transform data labels to point labels. The default implementation simply returns the current string.
<del>| `font` | `Font` | Yes | `defaults.font` | See [Fonts](../general/fonts.md)
<add>| `font` | `Font` | Yes | `defaults.font` | See [Fonts](./general/fonts.md)
<ide>
<ide> The scriptable context is the same as for the [Angle Line Options](#angle-line-options).
<ide>
<ide><path>docs/docs/developers/updates.md
<ide> function updateScale(chart) {
<ide> }
<ide> ```
<ide>
<del>Code sample for updating options can be found in [toggle-scale-type.html](../../samples/scales/toggle-scale-type.html).
<add>Code sample for updating options can be found in [toggle-scale-type.html](./../../samples/latest/scales/toggle-scale-type.html).
<ide>
<ide> ## Preventing Animations
<ide>
<ide><path>docs/docs/general/performance.md
<ide> Line charts are able to do [automatic data decimation during draw](#automatic-da
<ide>
<ide> ### Rotation
<ide>
<del>[Specify a rotation value](../axes/cartesian/index.md#tick-configuration) by setting `minRotation` and `maxRotation` to the same value, which avoids the chart from having to automatically determine a value to use.
<add>[Specify a rotation value](./axes/cartesian/index.mdx#tick-configuration) by setting `minRotation` and `maxRotation` to the same value, which avoids the chart from having to automatically determine a value to use.
<ide>
<ide> ### Sampling
<ide>
<del>Set the [`ticks.sampleSize`](../axes/cartesian/index.md#tick-configuration) option. This will determine how large your labels are by looking at only a subset of them in order to render axes more quickly. This works best if there is not a large variance in the size of your labels.
<add>Set the [`ticks.sampleSize`](./axes/cartesian/index.mdx#tick-configuration) option. This will determine how large your labels are by looking at only a subset of them in order to render axes more quickly. This works best if there is not a large variance in the size of your labels.
<ide>
<ide> ## Disable Animations
<ide>
<ide><path>docs/docs/getting-started/v3-migration.md
<ide> const chart = new Chart(ctx, {
<ide>
<ide> ### Chart types
<ide>
<del>* `horizontalBar` chart type was removed. Horizontal bar charts can be configured using the new [`indexAxis`](../charts/bar.md#general) option
<add>* `horizontalBar` chart type was removed. Horizontal bar charts can be configured using the new [`indexAxis`](./charts/bar.mdx#general) option
<ide>
<ide> ### Options
<ide> | 4 |
Text | Text | add react rally to conferences list | 7253e6544b4409841c1527c744f2f08c9ab867ba | <ide><path>docs/community/conferences.md
<ide> July 10-11 in Portland, Oregon USA
<ide>
<ide> [Website](https://infinite.red/ChainReactConf) - [Twitter](https://twitter.com/chainreactconf)
<ide>
<add>### React Rally
<add>August 24-25 in Salt Lake City, Utah USA
<add>[Website](http://www.reactrally.com) - [Twitter](https://twitter.com/reactrally)
<add>
<ide> ### ReactJS Day 2017
<ide> October 6th in Verona, Italy
<ide> | 1 |
Text | Text | fix some version information | aa26364ce1de66b23e51864682cbdadb4a272fa4 | <ide><path>docs/deprecated.md
<ide> To learn more about Docker Engine's deprecation policy,
<ide> see [Feature Deprecation Policy](https://docs.docker.com/engine/#feature-deprecation-policy).
<ide>
<ide> ## `filter` param for `/images/json` endpoint
<del>**Deprecated In Release: [v1.13](https://github.com/docker/docker/releases/tag/v1.13.0)**
<add>**Deprecated In Release: [v1.13.0](https://github.com/docker/docker/releases/tag/v1.13.0)**
<ide>
<ide> **Target For Removal In Release: v1.16**
<ide>
<ide> The `filter` param to filter the list of image by reference (name or name:tag) is now implemented as a regular filter, named `reference`.
<ide>
<ide> ### `repository:shortid` image references
<del>**Deprecated In Release: [v1.13](https://github.com/docker/docker/releases/tag/v1.13.0)**
<add>**Deprecated In Release: [v1.13.0](https://github.com/docker/docker/releases/tag/v1.13.0)**
<ide>
<ide> **Target For Removal In Release: v1.16**
<ide>
<ide> `repository:shortid` syntax for referencing images is very little used, collides with tag references can be confused with digest references.
<ide>
<ide> ### `docker daemon` subcommand
<del>**Deprecated In Release: [v1.13](https://github.com/docker/docker/releases/tag/v1.13.0)**
<add>**Deprecated In Release: [v1.13.0](https://github.com/docker/docker/releases/tag/v1.13.0)**
<ide>
<ide> **Target For Removal In Release: v1.16**
<ide>
<ide> The daemon is moved to a separate binary (`dockerd`), and should be used instead.
<ide>
<ide> ### Duplicate keys with conflicting values in engine labels
<del>**Deprecated In Release: [v1.13](https://github.com/docker/docker/releases/tag/v1.13.0)**
<add>**Deprecated In Release: [v1.13.0](https://github.com/docker/docker/releases/tag/v1.13.0)**
<ide>
<ide> **Target For Removal In Release: v1.16**
<ide>
<ide> Duplicate keys with conflicting values have been deprecated. A warning is displayed
<ide> in the output, and an error will be returned in the future.
<ide>
<ide> ### `MAINTAINER` in Dockerfile
<del>**Deprecated In Release: v1.13.0**
<add>**Deprecated In Release: [v1.13.0](https://github.com/docker/docker/releases/tag/v1.13.0)**
<ide>
<ide> `MAINTAINER` was an early very limited form of `LABEL` which should be used instead.
<ide>
<ide> ### API calls without a version
<del>**Deprecated In Release: [v1.13](https://github.com/docker/docker/releases/)**
<add>**Deprecated In Release: [v1.13.0](https://github.com/docker/docker/releases/tag/v1.13.0)**
<ide>
<ide> **Target For Removal In Release: v1.16**
<ide>
<ide> future Engine versions. Instead of just requesting, for example, the URL
<ide> `/containers/json`, you must now request `/v1.25/containers/json`.
<ide>
<ide> ### Backing filesystem without `d_type` support for overlay/overlay2
<del>**Deprecated In Release: v1.13.0**
<add>**Deprecated In Release: [v1.13.0](https://github.com/docker/docker/releases/tag/v1.13.0)**
<ide>
<ide> **Target For Removal In Release: v1.16**
<ide>
<ide> if it is formatted with the `ftype=0` option.
<ide> Please also refer to [#27358](https://github.com/docker/docker/issues/27358) for
<ide> further information.
<ide>
<del>### Three argument form in `docker import`
<add>### Three arguments form in `docker import`
<ide> **Deprecated In Release: [v0.6.7](https://github.com/docker/docker/releases/tag/v0.6.7)**
<ide>
<ide> **Removed In Release: [v1.12.0](https://github.com/docker/docker/releases/tag/v1.12.0)**
<ide>
<del>The `docker import` command format 'file|URL|- [REPOSITORY [TAG]]' is deprecated since November 2013. It's no more supported.
<add>The `docker import` command format `file|URL|- [REPOSITORY [TAG]]` is deprecated since November 2013. It's no more supported.
<ide>
<ide> ### `-h` shorthand for `--help`
<ide>
<ide> on all subcommands (due to it conflicting with, e.g. `-h` / `--hostname` on
<ide> ### `-e` and `--email` flags on `docker login`
<ide> **Deprecated In Release: [v1.11.0](https://github.com/docker/docker/releases/tag/v1.11.0)**
<ide>
<del>**Removed In Release: [v1.14.0](https://github.com/docker/docker/releases/)**
<add>**Target For Removal In Release: v1.14**
<ide>
<ide> The docker login command is removing the ability to automatically register for an account with the target registry if the given username doesn't exist. Due to this change, the email flag is no longer required, and will be deprecated.
<ide>
<ide> To make tagging consistent across the various `docker` commands, the `-f` flag o
<ide> Passing an `HostConfig` to `POST /containers/{name}/start` is deprecated in favor of
<ide> defining it at container creation (`POST /containers/create`).
<ide>
<del>### Docker ps 'before' and 'since' options
<add>### `--before` and `--since` flags on `docker ps`
<ide>
<ide> **Deprecated In Release: [v1.10.0](https://github.com/docker/docker/releases/tag/v1.10.0)**
<ide>
<ide> defining it at container creation (`POST /containers/create`).
<ide> The `docker ps --before` and `docker ps --since` options are deprecated.
<ide> Use `docker ps --filter=before=...` and `docker ps --filter=since=...` instead.
<ide>
<del>### Docker search 'automated' and 'stars' options
<add>### `--automated` and `--stars` flags on `docker search`
<ide>
<ide> **Deprecated in Release: [v1.12.0](https://github.com/docker/docker/releases/tag/v1.12.0)**
<ide>
<ide> The single-dash (`-help`) was removed, in favor of the double-dash `--help`
<ide>
<ide> **Deprecated In Release: [v0.10.0](https://github.com/docker/docker/releases/tag/v0.10.0)**
<ide>
<del>**Removed In Release: [v1.13.0](https://github.com/docker/docker/releases/)**
<add>**Removed In Release: [v1.13.0](https://github.com/docker/docker/releases/tag/v1.13.0)**
<ide>
<ide> The flag `--run` of the docker commit (and its short version `-run`) were deprecated in favor
<ide> of the `--changes` flag that allows to pass `Dockerfile` commands. | 1 |
Text | Text | add more examples of code-smells | 76388feedbe80e8def695732975e15db8da77c24 | <ide><path>guide/english/agile/code-smells/index.md
<ide> It is important to understand that smelly code works, but is not of good quality
<ide> #### Examples
<ide> 1. Duplicated code - Blocks of code that have been replicated across the code base. This may indicate that you need to generalize the code into a function and call it in two places, or it may be that the way the code works in one place is completely unrelated to the way it works in another place, despite having been copied.
<ide> 2. Large classes - Classes having too many lines of code. This may indicate that the class is trying to do too many things, and needs to be broken up into smaller classes.
<add>3. [Magic numbers](https://en.wikipedia.org/wiki/Magic_number_(programming)) - Variables (or `if` statements) scattered in the code that hold numeric values with no apparent meaning.
<add>4. Many-parameter methods - Methods that take more that 2 or 3 parameters usually indicate that the method does more than one thing and should be broken down to multiple methods.
<add>5. Unclear method or variable naming - A programmer should be able to understand what a method does without looking at the method's body. If the name or the parameter naming is vague, it is an indicator that the method should be refactored to reveal its purpose in the code.
<ide>
<ide> #### More Information:
<ide> * _Refactoring: Improving the Design of Existing Code - Kent Beck, Martin Fowler_ | 1 |
PHP | PHP | make $callback optional for helper functions too | cd0af1093647b6447475f3b0c858cf10d3b9f48c | <ide><path>src/Illuminate/Support/helpers.php
<ide> function array_except($array, $keys)
<ide> * @param mixed $default
<ide> * @return mixed
<ide> */
<del> function array_first($array, callable $callback, $default = null)
<add> function array_first($array, callable $callback = null, $default = null)
<ide> {
<ide> return Arr::first($array, $callback, $default);
<ide> }
<ide> function array_has($array, $key)
<ide> * @param mixed $default
<ide> * @return mixed
<ide> */
<del> function array_last($array, $callback, $default = null)
<add> function array_last($array, $callback = null, $default = null)
<ide> {
<ide> return Arr::last($array, $callback, $default);
<ide> } | 1 |
Python | Python | fix lint error | dc6d836bd51cd04a7be8dc3d4d0bf4ac0314e7f5 | <ide><path>contrib/generate_provider_feature_matrix_table.py
<ide> def is_function_or_method(*args, **kwargs):
<ide> for method_name in base_api_methods:
<ide> base_method = base_methods[method_name]
<ide>
<del>
<ide> if method_name == 'deploy_node':
<ide> features = getattr(cls, 'features', {}).get('create_node', [])
<ide> is_implemented = len(features) >= 1 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.