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
|
|---|---|---|---|---|---|
Javascript
|
Javascript
|
improve existing test to test and
|
857f980883ab2a7b5cddac7468cd730d3a9c4afe
|
<ide><path>test/binCases/stats/single-config/test.js
<ide> module.exports = function testAssertions(code, stdout, stderr) {
<ide> stdout[0].should.containEql("Hash: ");
<ide> stdout[1].should.containEql("Version: ");
<ide> stdout[2].should.containEql("Time: ");
<del> stdout[4].should.containEql("null.js");
<del> stdout[5].should.containEql("./index.js");
<del> stdout[5].should.containEql("[built]");
<add> stdout[4].should.containEql("\u001b[1m\u001b[32mnull.js\u001b[39m\u001b[22m");
<add> stdout[5].should.not.containEql("./index.js");
<add> stdout[5].should.not.containEql("[built]");
<add> stdout[5].should.containEql("1 hidden module");
<ide>
<ide> stderr.should.be.empty();
<ide> };
<ide><path>test/binCases/stats/single-config/webpack.config.js
<ide> module.exports = {
<ide> stats: {
<ide> assets: true,
<ide> colors: true,
<del> chunks: true
<add> chunks: true,
<add> maxModules: 0
<ide> }
<ide> };
| 2
|
Javascript
|
Javascript
|
remove preassignbindingsenabled leftovers
|
42e622b751d1ad1520b824473f9ad31e7efb75b3
|
<ide><path>src/auto/injector.js
<ide> var FN_ARG = /^\s*(_?)(\S+?)\1\s*$/;
<ide> var STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg;
<ide> var $injectorMinErr = minErr('$injector');
<ide>
<add>function stringifyFn(fn) {
<add> return Function.prototype.toString.call(fn);
<add>}
<add>
<ide> function extractArgs(fn) {
<del> var fnText = Function.prototype.toString.call(fn).replace(STRIP_COMMENTS, ''),
<add> var fnText = stringifyFn(fn).replace(STRIP_COMMENTS, ''),
<ide> args = fnText.match(ARROW_ARG) || fnText.match(FN_ARGS);
<ide> return args;
<ide> }
<ide> function createInjector(modulesToLoad, strictDi) {
<ide> return args;
<ide> }
<ide>
<add> function isClass(func) {
<add> // Support: IE 9-11 only
<add> // IE 9-11 do not support classes and IE9 leaks with the code below.
<add> if (msie || typeof func !== 'function') {
<add> return false;
<add> }
<add> var result = func.$$ngIsClass;
<add> if (!isBoolean(result)) {
<add> result = func.$$ngIsClass = /^class\b/.test(stringifyFn(func));
<add> }
<add> return result;
<add> }
<add>
<ide> function invoke(fn, self, locals, serviceName) {
<ide> if (typeof locals === 'string') {
<ide> serviceName = locals;
<ide> function createInjector(modulesToLoad, strictDi) {
<ide> fn = fn[fn.length - 1];
<ide> }
<ide>
<del> // http://jsperf.com/angularjs-invoke-apply-vs-switch
<del> // #5388
<del> return fn.apply(self, args);
<add> if (!isClass(fn)) {
<add> // http://jsperf.com/angularjs-invoke-apply-vs-switch
<add> // #5388
<add> return fn.apply(self, args);
<add> } else {
<add> args.unshift(null);
<add> return new (Function.prototype.bind.apply(fn, args))();
<add> }
<ide> }
<ide>
<ide>
<ide><path>src/ng/compile.js
<ide> function $CompileProvider($provide, $$sanitizeUriProvider) {
<ide> };
<ide> }
<ide>
<add> if (controllerDirectives) {
<add> elementControllers = setupControllers($element, attrs, transcludeFn, controllerDirectives, isolateScope, scope, newIsolateScopeDirective);
<add> }
<add>
<ide> if (newIsolateScopeDirective) {
<ide> // Initialize isolate scope bindings for new isolate scope directive.
<ide> compile.$$addScopeInfo($element, isolateScope, true, !(templateDirective && (templateDirective === newIsolateScopeDirective ||
<ide> function $CompileProvider($provide, $$sanitizeUriProvider) {
<ide> }
<ide> }
<ide>
<del> if (controllerDirectives) {
<del> elementControllers = createMap();
<del> for (var name in controllerDirectives) {
<del> var directive = controllerDirectives[name];
<del> var locals = {
<del> $scope: directive === newIsolateScopeDirective || directive.$$isolateScope ? isolateScope : scope,
<del> $element: $element,
<del> $attrs: attrs,
<del> $transclude: transcludeFn
<del> };
<del>
<del> var controllerConstructor = directive.controller;
<del> if (controllerConstructor === '@') {
<del> controllerConstructor = attrs[name];
<del> }
<add> // Initialize bindToController bindings
<add> for (var name in elementControllers) {
<add> var controllerDirective = controllerDirectives[name];
<add> var controller = elementControllers[name];
<add> var bindings = controllerDirective.$$bindings.bindToController;
<ide>
<del> var instance = $controller(controllerConstructor, locals, directive.controllerAs);
<del>
<del> $element.data('$' + name + 'Controller', instance);
<del>
<del> // Initialize bindToController bindings
<del> var bindings = directive.$$bindings.bindToController;
<del> var bindingInfo = initializeDirectiveBindings(controllerScope, attrs, instance, bindings, directive);
<del>
<del> elementControllers[name] = { instance: instance, bindingInfo: bindingInfo };
<add> controller.instance = controller();
<add> $element.data('$' + controllerDirective.name + 'Controller', controller.instance);
<add> controller.bindingInfo =
<add> initializeDirectiveBindings(controllerScope, attrs, controller.instance, bindings, controllerDirective);
<ide> }
<ide>
<del> // Bind the required controllers to the controller, if `require` is an object and `bindToController` is truthy
<del> forEach(controllerDirectives, function(controllerDirective, name) {
<del> var require = controllerDirective.require;
<del> if (controllerDirective.bindToController && !isArray(require) && isObject(require)) {
<del> extend(elementControllers[name].instance, getControllers(name, require, $element, elementControllers));
<del> }
<del> });
<add> // Bind the required controllers to the controller, if `require` is an object and `bindToController` is truthy
<add> forEach(controllerDirectives, function(controllerDirective, name) {
<add> var require = controllerDirective.require;
<add> if (controllerDirective.bindToController && !isArray(require) && isObject(require)) {
<add> extend(elementControllers[name].instance, getControllers(name, require, $element, elementControllers));
<add> }
<add> });
<ide>
<del> // Handle the init and destroy lifecycle hooks on all controllers that have them
<del> forEach(elementControllers, function(controller) {
<del> var controllerInstance = controller.instance;
<del> if (isFunction(controllerInstance.$onChanges)) {
<del> try {
<del> controllerInstance.$onChanges(controller.bindingInfo.initialChanges);
<del> } catch (e) {
<del> $exceptionHandler(e);
<del> }
<del> }
<del> if (isFunction(controllerInstance.$onInit)) {
<del> try {
<del> controllerInstance.$onInit();
<del> } catch (e) {
<del> $exceptionHandler(e);
<del> }
<del> }
<del> if (isFunction(controllerInstance.$doCheck)) {
<del> controllerScope.$watch(function() { controllerInstance.$doCheck(); });
<del> controllerInstance.$doCheck();
<add> // Handle the init and destroy lifecycle hooks on all controllers that have them
<add> forEach(elementControllers, function(controller) {
<add> var controllerInstance = controller.instance;
<add> if (isFunction(controllerInstance.$onChanges)) {
<add> try {
<add> controllerInstance.$onChanges(controller.bindingInfo.initialChanges);
<add> } catch (e) {
<add> $exceptionHandler(e);
<ide> }
<del> if (isFunction(controllerInstance.$onDestroy)) {
<del> controllerScope.$on('$destroy', function callOnDestroyHook() {
<del> controllerInstance.$onDestroy();
<del> });
<add> }
<add> if (isFunction(controllerInstance.$onInit)) {
<add> try {
<add> controllerInstance.$onInit();
<add> } catch (e) {
<add> $exceptionHandler(e);
<ide> }
<del> });
<del> }
<add> }
<add> if (isFunction(controllerInstance.$doCheck)) {
<add> controllerScope.$watch(function() { controllerInstance.$doCheck(); });
<add> controllerInstance.$doCheck();
<add> }
<add> if (isFunction(controllerInstance.$onDestroy)) {
<add> controllerScope.$on('$destroy', function callOnDestroyHook() {
<add> controllerInstance.$onDestroy();
<add> });
<add> }
<add> });
<ide>
<ide> // PRELINKING
<ide> for (i = 0, ii = preLinkFns.length; i < ii; i++) {
<ide> function $CompileProvider($provide, $$sanitizeUriProvider) {
<ide> return value || null;
<ide> }
<ide>
<add> function setupControllers($element, attrs, transcludeFn, controllerDirectives, isolateScope, scope, newIsolateScopeDirective) {
<add> var elementControllers = createMap();
<add> for (var controllerKey in controllerDirectives) {
<add> var directive = controllerDirectives[controllerKey];
<add> var locals = {
<add> $scope: directive === newIsolateScopeDirective || directive.$$isolateScope ? isolateScope : scope,
<add> $element: $element,
<add> $attrs: attrs,
<add> $transclude: transcludeFn
<add> };
<add>
<add> var controller = directive.controller;
<add> if (controller === '@') {
<add> controller = attrs[directive.name];
<add> }
<add>
<add> var controllerInstance = $controller(controller, locals, true, directive.controllerAs);
<add>
<add> // For directives with element transclusion the element is a comment.
<add> // In this case .data will not attach any data.
<add> // Instead, we save the controllers for the element in a local hash and attach to .data
<add> // later, once we have the actual element.
<add> elementControllers[directive.name] = controllerInstance;
<add> $element.data('$' + directive.name + 'Controller', controllerInstance.instance);
<add> }
<add> return elementControllers;
<add> }
<add>
<ide> // Depending upon the context in which a directive finds itself it might need to have a new isolated
<ide> // or child scope created. For instance:
<ide> // * if the directive has been pulled into a template because another directive with a higher priority
<ide><path>src/ng/controller.js
<ide> function $ControllerProvider() {
<ide> * It's just a simple call to {@link auto.$injector $injector}, but extracted into
<ide> * a service, so that one can override this service with [BC version](https://gist.github.com/1649788).
<ide> */
<del> return function $controller(expression, locals, ident) {
<add> return function $controller(expression, locals, later, ident) {
<ide> // PRIVATE API:
<add> // param `later` --- indicates that the controller's constructor is invoked at a later time.
<add> // If true, $controller will allocate the object with the correct
<add> // prototype chain, but will not invoke the controller until a returned
<add> // callback is invoked.
<ide> // param `ident` --- An optional label which overrides the label parsed from the controller
<ide> // expression, if any.
<ide> var instance, match, constructor, identifier;
<add> later = later === true;
<ide> if (ident && isString(ident)) {
<ide> identifier = ident;
<ide> }
<ide> function $ControllerProvider() {
<ide> assertArgFn(expression, constructor, true);
<ide> }
<ide>
<add> if (later) {
<add> // Instantiate controller later:
<add> // This machinery is used to create an instance of the object before calling the
<add> // controller's constructor itself.
<add> //
<add> // This allows properties to be added to the controller before the constructor is
<add> // invoked. Primarily, this is used for isolate scope bindings in $compile.
<add> //
<add> // This feature is not intended for use by applications, and is thus not documented
<add> // publicly.
<add> // Object creation: http://jsperf.com/create-constructor/2
<add> var controllerPrototype = (isArray(expression) ?
<add> expression[expression.length - 1] : expression).prototype;
<add> instance = Object.create(controllerPrototype || null);
<add>
<add> if (identifier) {
<add> addIdentifier(locals, identifier, instance, constructor || expression.name);
<add> }
<add>
<add> return extend(function $controllerInit() {
<add> var result = $injector.invoke(expression, instance, locals, constructor);
<add> if (result !== instance && (isObject(result) || isFunction(result))) {
<add> instance = result;
<add> if (identifier) {
<add> // If result changed, re-assign controllerAs value to scope.
<add> addIdentifier(locals, identifier, instance, constructor || expression.name);
<add> }
<add> }
<add> return instance;
<add> }, {
<add> instance: instance,
<add> identifier: identifier
<add> });
<add> }
<add>
<ide> instance = $injector.instantiate(expression, locals, constructor);
<ide>
<ide> if (identifier) {
<ide><path>src/ngMock/angular-mocks.js
<ide> angular.mock.$RootElementProvider = function() {
<ide> */
<ide> function createControllerDecorator() {
<ide> angular.mock.$ControllerDecorator = ['$delegate', function($delegate) {
<del> return function(expression, locals, bindings, ident) {
<del> if (angular.isString(bindings)) ident = bindings;
<del> var instance = $delegate(expression, locals, ident);
<del> angular.extend(instance, bindings);
<del> return instance;
<add> return function(expression, locals, later, ident) {
<add> if (later && typeof later === 'object') {
<add> var instantiate = $delegate(expression, locals, true, ident);
<add> var instance = instantiate();
<add> angular.extend(instance, later);
<add> return instance;
<add> }
<add> return $delegate(expression, locals, later, ident);
<ide> };
<ide> }];
<ide>
<ide><path>test/auto/injectorSpec.js
<ide> describe('injector', function() {
<ide> expect(instance).toEqual(new Clazz('a-value'));
<ide> expect(instance.aVal()).toEqual('a-value');
<ide> });
<add>
<add> they('should detect ES6 classes regardless of whitespace/comments ($prop)', [
<add> 'class Test {}',
<add> 'class Test{}',
<add> 'class //<--ES6 stuff\nTest {}',
<add> 'class//<--ES6 stuff\nTest {}',
<add> 'class {}',
<add> 'class{}',
<add> 'class //<--ES6 stuff\n {}',
<add> 'class//<--ES6 stuff\n {}',
<add> 'class/* Test */{}',
<add> 'class /* Test */ {}'
<add> ], function(classDefinition) {
<add> // eslint-disable-next-line no-eval
<add> var Clazz = eval('(' + classDefinition + ')');
<add> var instance = injector.invoke(Clazz);
<add>
<add> expect(instance).toEqual(jasmine.any(Clazz));
<add> });
<ide> }
<ide> });
<ide>
| 5
|
Java
|
Java
|
remove jetbrains annotations
|
f2b926467491098b09b38296b95d9543c97e22ad
|
<ide><path>spring-core/src/test/java/org/springframework/core/io/buffer/LeakAwareDataBufferFactory.java
<ide> import io.netty.buffer.PooledByteBufAllocator;
<ide> import org.apache.commons.logging.Log;
<ide> import org.apache.commons.logging.LogFactory;
<del>import org.jetbrains.annotations.NotNull;
<ide>
<ide> import org.springframework.util.Assert;
<ide>
<ide> public DataBuffer allocateBuffer(int initialCapacity) {
<ide> return createLeakAwareDataBuffer(this.delegate.allocateBuffer(initialCapacity));
<ide> }
<ide>
<del> @NotNull
<ide> private DataBuffer createLeakAwareDataBuffer(DataBuffer delegateBuffer) {
<ide> LeakAwareDataBuffer dataBuffer = new LeakAwareDataBuffer(delegateBuffer, this);
<ide> if (this.trackCreated.get()) {
<ide><path>spring-webmvc/src/main/java/org/springframework/web/servlet/function/DefaultServerRequest.java
<ide> import javax.servlet.http.HttpServletRequest;
<ide> import javax.servlet.http.HttpSession;
<ide>
<del>import org.jetbrains.annotations.NotNull;
<del>
<ide> import org.springframework.core.ParameterizedTypeReference;
<ide> import org.springframework.http.HttpHeaders;
<ide> import org.springframework.http.HttpRange;
<ide> private ServletParametersMap(HttpServletRequest servletRequest) {
<ide> this.servletRequest = servletRequest;
<ide> }
<ide>
<del> @NotNull
<ide> @Override
<ide> public Set<Entry<String, List<String>>> entrySet() {
<ide> return this.servletRequest.getParameterMap().entrySet().stream()
<ide> public void clear() {
<ide> attributeNames.forEach(this.servletRequest::removeAttribute);
<ide> }
<ide>
<del> @NotNull
<ide> @Override
<ide> public Set<Entry<String, Object>> entrySet() {
<ide> return Collections.list(this.servletRequest.getAttributeNames()).stream()
<ide><path>spring-webmvc/src/main/java/org/springframework/web/servlet/function/DefaultServerRequestBuilder.java
<ide> import javax.servlet.http.HttpServletRequest;
<ide> import javax.servlet.http.HttpSession;
<ide>
<del>import org.jetbrains.annotations.NotNull;
<del>
<ide> import org.springframework.core.ParameterizedTypeReference;
<ide> import org.springframework.http.HttpHeaders;
<ide> import org.springframework.http.HttpInputMessage;
<ide> public int read() throws IOException {
<ide> }
<ide>
<ide> @Override
<del> public int read(@NotNull byte[] b, int off, int len) throws IOException {
<add> public int read(byte[] b, int off, int len) throws IOException {
<ide> return this.delegate.read(b, off, len);
<ide> }
<ide>
<ide> @Override
<del> public int read(@NotNull byte[] b) throws IOException {
<add> public int read(byte[] b) throws IOException {
<ide> return this.delegate.read(b);
<ide> }
<ide>
<ide><path>spring-webmvc/src/main/java/org/springframework/web/servlet/function/support/RouterFunctionMapping.java
<ide>
<ide> import javax.servlet.http.HttpServletRequest;
<ide>
<del>import org.jetbrains.annotations.NotNull;
<del>
<ide> import org.springframework.beans.factory.BeanFactoryUtils;
<ide> import org.springframework.beans.factory.InitializingBean;
<ide> import org.springframework.context.ApplicationContext;
<ide> private void initMessageConverters() {
<ide>
<ide> @Nullable
<ide> @Override
<del> protected Object getHandlerInternal(@NotNull HttpServletRequest servletRequest) throws Exception {
<add> protected Object getHandlerInternal(HttpServletRequest servletRequest) throws Exception {
<ide> String lookupPath = getUrlPathHelper().getLookupPathForRequest(servletRequest);
<ide> servletRequest.setAttribute(LOOKUP_PATH, lookupPath);
<ide> if (this.routerFunction != null) {
| 4
|
Ruby
|
Ruby
|
fix textarea with nil content
|
d8d38bedfd5716d55e50e85dc6c9a938b1848e66
|
<ide><path>actionpack/lib/action_view/helpers/form_tag_helper.rb
<ide> def text_area_tag(name, content = nil, options = {})
<ide> escape = options.key?("escape") ? options.delete("escape") : true
<ide> content = html_escape(content) if escape
<ide>
<del> content_tag :textarea, content.html_safe, { "name" => name, "id" => sanitize_to_id(name) }.update(options)
<add> content_tag :textarea, content.to_s.html_safe, { "name" => name, "id" => sanitize_to_id(name) }.update(options)
<ide> end
<ide>
<ide> # Creates a check box form input tag.
<ide><path>actionpack/test/template/form_tag_helper_test.rb
<ide> def test_text_area_tag_unescaped_content
<ide> assert_dom_equal expected, actual
<ide> end
<ide>
<add> def test_text_area_tag_unescaped_nil_content
<add> actual = text_area_tag "body", nil, :escape => false
<add> expected = %(<textarea id="body" name="body"></textarea>)
<add> assert_dom_equal expected, actual
<add> end
<add>
<ide> def test_text_field_tag
<ide> actual = text_field_tag "title", "Hello!"
<ide> expected = %(<input id="title" name="title" type="text" value="Hello!" />)
| 2
|
Python
|
Python
|
fix missing dagruns when ``catchup=true``
|
2bd4b55c53b593f2747a88f4c018d7e420460d9a
|
<ide><path>airflow/jobs/scheduler_job.py
<ide> def _create_dag_runs(self, dag_models: Collection[DagModel], session: Session) -
<ide> creating_job_id=self.id,
<ide> )
<ide> active_runs_of_dags[dag.dag_id] += 1
<del> self._update_dag_next_dagruns(dag, dag_model, active_runs_of_dags[dag.dag_id])
<add> if self._should_update_dag_next_dagruns(dag, dag_model, active_runs_of_dags[dag.dag_id]):
<add> dag_model.calculate_dagrun_date_fields(dag, data_interval)
<ide> # TODO[HA]: Should we do a session.flush() so we don't have to keep lots of state/object in
<ide> # memory for larger dags? or expunge_all()
<ide>
<del> def _update_dag_next_dagruns(self, dag, dag_model: DagModel, total_active_runs) -> None:
<del> """
<del> Update the next_dagrun, next_dagrun_data_interval_start/end
<del> and next_dagrun_create_after for this dag.
<del> """
<del> if total_active_runs >= dag_model.max_active_runs:
<add> def _should_update_dag_next_dagruns(self, dag, dag_model: DagModel, total_active_runs) -> bool:
<add> """Check if the dag's next_dagruns_create_after should be updated."""
<add> if total_active_runs >= dag.max_active_runs:
<ide> self.log.info(
<ide> "DAG %s is at (or above) max_active_runs (%d of %d), not creating any more runs",
<ide> dag_model.dag_id,
<ide> total_active_runs,
<del> dag_model.max_active_runs,
<add> dag.max_active_runs,
<ide> )
<ide> dag_model.next_dagrun_create_after = None
<del> else:
<del> data_interval = dag.get_next_data_interval(dag_model)
<del> dag_model.calculate_dagrun_date_fields(dag, data_interval)
<add> return False
<add> return True
<ide>
<ide> def _start_queued_dagruns(
<ide> self,
<ide> def _schedule_dag_run(
<ide> self.log.info("Run %s of %s has timed-out", dag_run.run_id, dag_run.dag_id)
<ide> active_runs = dag.get_num_active_runs(only_running=False, session=session)
<ide> # Work out if we should allow creating a new DagRun now?
<del> self._update_dag_next_dagruns(dag, dag_model, active_runs)
<add> if self._should_update_dag_next_dagruns(dag, dag_model, active_runs):
<add> dag_model.calculate_dagrun_date_fields(dag, dag.get_run_data_interval(dag_run))
<ide>
<ide> callback_to_execute = DagCallbackRequest(
<ide> full_filepath=dag.fileloc,
<ide> def _schedule_dag_run(
<ide> if dag_run.state in State.finished:
<ide> active_runs = dag.get_num_active_runs(only_running=False, session=session)
<ide> # Work out if we should allow creating a new DagRun now?
<del> self._update_dag_next_dagruns(dag, dag_model, active_runs)
<add> if self._should_update_dag_next_dagruns(dag, dag_model, active_runs):
<add> dag_model.calculate_dagrun_date_fields(dag, dag.get_run_data_interval(dag_run))
<ide>
<ide> # This will do one query per dag run. We "could" build up a complex
<ide> # query to update all the TIs across all the execution dates and dag
<ide><path>airflow/models/dag.py
<ide> def get_next_data_interval(self, dag_model: "DagModel") -> Optional[DataInterval
<ide> data_interval = dag_model.next_dagrun_data_interval
<ide> if data_interval is not None:
<ide> return data_interval
<add>
<ide> # Compatibility: A run was scheduled without an explicit data interval.
<ide> # This means the run was scheduled before AIP-39 implementation. Try to
<ide> # infer from the logical date.
<ide><path>tests/jobs/test_scheduler_job.py
<ide> def test_dagrun_timeout_fails_run_and_update_next_dagrun(self, dag_maker):
<ide> session.flush()
<ide> session.refresh(dr)
<ide> assert dr.state == State.FAILED
<del> # check that next_dagrun has been updated by Schedulerjob._update_dag_next_dagruns
<del> assert dag_maker.dag_model.next_dagrun == dr.execution_date + timedelta(days=1)
<add> # check that next_dagrun_create_after has been updated by calculate_dagrun_date_fields
<add> assert dag_maker.dag_model.next_dagrun_create_after == dr.execution_date + timedelta(days=1)
<ide> # check that no running/queued runs yet
<ide> assert (
<ide> session.query(DagRun).filter(DagRun.state.in_([DagRunState.RUNNING, DagRunState.QUEUED])).count()
<ide> def test_more_runs_are_not_created_when_max_active_runs_is_reached(self, dag_mak
<ide> == 0
<ide> )
<ide>
<add> def test_max_active_runs_creation_phasing(self, dag_maker, session):
<add> """
<add> Test that when creating runs once max_active_runs is reached that the runs come in the right order
<add> without gaps
<add> """
<add>
<add> def complete_one_dagrun():
<add> ti = (
<add> session.query(TaskInstance)
<add> .join(TaskInstance.dag_run)
<add> .filter(TaskInstance.state != State.SUCCESS)
<add> .order_by(DagRun.execution_date)
<add> .first()
<add> )
<add> if ti:
<add> ti.state = State.SUCCESS
<add> session.flush()
<add>
<add> with dag_maker(max_active_runs=3, session=session) as dag:
<add> # Need to use something that doesn't immediately get marked as success by the scheduler
<add> BashOperator(task_id='task', bash_command='true')
<add>
<add> self.scheduler_job = SchedulerJob(subdir=os.devnull)
<add> self.scheduler_job.executor = MockExecutor(do_update=True)
<add> self.scheduler_job.processor_agent = mock.MagicMock(spec=DagFileProcessorAgent)
<add>
<add> DagModel.dags_needing_dagruns(session).all()
<add> for _ in range(3):
<add> self.scheduler_job._do_scheduling(session)
<add>
<add> model: DagModel = session.query(DagModel).get(dag.dag_id)
<add>
<add> # Pre-condition
<add> assert DagRun.active_runs_of_dags(session=session) == {'test_dag': 3}
<add>
<add> assert model.next_dagrun == timezone.convert_to_utc(
<add> timezone.DateTime(
<add> 2016,
<add> 1,
<add> 3,
<add> )
<add> )
<add> assert model.next_dagrun_create_after is None
<add>
<add> complete_one_dagrun()
<add>
<add> assert DagRun.active_runs_of_dags(session=session) == {'test_dag': 3}
<add>
<add> for _ in range(5):
<add> self.scheduler_job._do_scheduling(session)
<add> complete_one_dagrun()
<add> model: DagModel = session.query(DagModel).get(dag.dag_id)
<add>
<add> expected_execution_dates = [datetime.datetime(2016, 1, d, tzinfo=timezone.utc) for d in range(1, 6)]
<add> dagrun_execution_dates = [
<add> dr.execution_date for dr in session.query(DagRun).order_by(DagRun.execution_date).all()
<add> ]
<add> assert dagrun_execution_dates == expected_execution_dates
<add>
<ide> def test_do_schedule_max_active_runs_and_manual_trigger(self, dag_maker):
<ide> """
<ide> Make sure that when a DAG is already at max_active_runs, that manually triggered
| 3
|
PHP
|
PHP
|
pull pretend value from config
|
eb600f8533df3b4611c1fa60a1661f2c1d0369e6
|
<ide><path>src/Illuminate/Mail/MailServiceProvider.php
<ide> public function register()
<ide>
<ide> $mailer->setContainer($app);
<ide>
<del> $from = $app['config']['mail.from'];
<del>
<ide> // If a "from" address is set, we will set it on the mailer so that all mail
<ide> // messages sent by the applications will utilize the same "from" address
<ide> // on each one, which makes the developer's life a lot more convenient.
<add> $from = $app['config']['mail.from'];
<add>
<ide> if (is_array($from) and isset($from['address']))
<ide> {
<ide> $mailer->alwaysFrom($from['address'], $from['name']);
<ide> }
<ide>
<add> // Here we will determine if the mailer should be in "pretend" mode for this
<add> // environment, which will simply write out e-mail to the logs instead of
<add> // sending it over the web, which is useful for local dev enviornments.
<add> $pretend = $app['config']->get('mail.pretend', false);
<add>
<add> $mailer->pretend($pretend);
<add>
<ide> return $mailer;
<ide> });
<ide> }
| 1
|
Go
|
Go
|
add ipamutils package
|
fd00a5301962e1aeaf33b0ce77912e52e764fe5e
|
<ide><path>libnetwork/ipamutils/utils.go
<add>// Package ipamutils provides utililty functions for ipam management
<add>package ipamutils
<add>
<add>import (
<add> "fmt"
<add> "net"
<add>
<add> "github.com/docker/libnetwork/netutils"
<add> "github.com/docker/libnetwork/resolvconf"
<add> "github.com/vishvananda/netlink"
<add>)
<add>
<add>var (
<add> // PredefinedBroadNetworks contains a list of 31 IPv4 private networks with host size 16 and 12
<add> // (172.17-31.x.x/16, 192.168.x.x/20) which do not overlap with the networks in `PredefinedGranularNetworks`
<add> PredefinedBroadNetworks []*net.IPNet
<add> // PredefinedGranularNetworks contains a list of 64K IPv4 private networks with host size 8
<add> // (10.x.x.x/24) which do not overlap with the networks in `PredefinedBroadNetworks`
<add> PredefinedGranularNetworks []*net.IPNet
<add>)
<add>
<add>func init() {
<add> PredefinedBroadNetworks = initBroadPredefinedNetworks()
<add> PredefinedGranularNetworks = initGranularPredefinedNetworks()
<add>}
<add>
<add>// ElectInterfaceAddresses looks for an interface on the OS with the specified name
<add>// and returns its IPv4 and IPv6 addresses in CIDR form. If the interface does not exist,
<add>// it chooses from a predifined list the first IPv4 address which does not conflict
<add>// with other interfaces on the system.
<add>func ElectInterfaceAddresses(name string) ([]*net.IPNet, []*net.IPNet, error) {
<add> var v4Nets, v6Nets []*net.IPNet
<add>
<add> link, _ := netlink.LinkByName(name)
<add> if link != nil {
<add> v4addr, err := netlink.AddrList(link, netlink.FAMILY_V4)
<add> if err != nil {
<add> return nil, nil, err
<add> }
<add> v6addr, err := netlink.AddrList(link, netlink.FAMILY_V6)
<add> if err != nil {
<add> return nil, nil, err
<add> }
<add> for _, nlAddr := range v4addr {
<add> v4Nets = append(v4Nets, nlAddr.IPNet)
<add> }
<add> for _, nlAddr := range v6addr {
<add> v6Nets = append(v6Nets, nlAddr.IPNet)
<add> }
<add> }
<add>
<add> if link == nil || len(v4Nets) == 0 {
<add> // Choose from predifined broad networks
<add> v4Net, err := FindAvailableNetwork(PredefinedBroadNetworks)
<add> if err != nil {
<add> return nil, nil, err
<add> }
<add> v4Nets = append(v4Nets, v4Net)
<add> }
<add>
<add> return v4Nets, v6Nets, nil
<add>}
<add>
<add>// FindAvailableNetwork returns a network from the passed list which does not
<add>// overlap with existing interfaces in the system
<add>func FindAvailableNetwork(list []*net.IPNet) (*net.IPNet, error) {
<add> // We don't check for an error here, because we don't really care if we
<add> // can't read /etc/resolv.conf. So instead we skip the append if resolvConf
<add> // is nil. It either doesn't exist, or we can't read it for some reason.
<add> var nameservers []string
<add> if rc, err := resolvconf.Get(); err == nil {
<add> nameservers = resolvconf.GetNameserversAsCIDR(rc.Content)
<add> }
<add> for _, nw := range list {
<add> if err := netutils.CheckNameserverOverlaps(nameservers, nw); err == nil {
<add> if err := netutils.CheckRouteOverlaps(nw); err == nil {
<add> return nw, nil
<add> }
<add> }
<add> }
<add> return nil, fmt.Errorf("no available network")
<add>}
<add>
<add>func initBroadPredefinedNetworks() []*net.IPNet {
<add> pl := make([]*net.IPNet, 0, 31)
<add> mask := []byte{255, 255, 0, 0}
<add> for i := 17; i < 32; i++ {
<add> pl = append(pl, &net.IPNet{IP: []byte{172, byte(i), 0, 0}, Mask: mask})
<add> }
<add> mask20 := []byte{255, 255, 240, 0}
<add> for i := 0; i < 16; i++ {
<add> pl = append(pl, &net.IPNet{IP: []byte{192, 168, byte(i << 4), 0}, Mask: mask20})
<add> }
<add> return pl
<add>}
<add>
<add>func initGranularPredefinedNetworks() []*net.IPNet {
<add> pl := make([]*net.IPNet, 0, 256*256)
<add> mask := []byte{255, 255, 255, 0}
<add> for i := 0; i < 256; i++ {
<add> for j := 0; j < 256; j++ {
<add> pl = append(pl, &net.IPNet{IP: []byte{10, byte(i), byte(j), 0}, Mask: mask})
<add> }
<add> }
<add> return pl
<add>}
<ide><path>libnetwork/ipamutils/utils_test.go
<add>package ipamutils
<add>
<add>import (
<add> "net"
<add> "testing"
<add>
<add> "github.com/docker/libnetwork/testutils"
<add> "github.com/docker/libnetwork/types"
<add> "github.com/vishvananda/netlink"
<add>)
<add>
<add>func TestGranularPredefined(t *testing.T) {
<add> for _, nw := range PredefinedGranularNetworks {
<add> if ones, bits := nw.Mask.Size(); bits != 32 || ones != 24 {
<add> t.Fatalf("Unexpected size for network in granular list: %v", nw)
<add> }
<add> }
<add>
<add> for _, nw := range PredefinedBroadNetworks {
<add> if ones, bits := nw.Mask.Size(); bits != 32 || (ones != 20 && ones != 16) {
<add> t.Fatalf("Unexpected size for network in broad list: %v", nw)
<add> }
<add> }
<add>
<add>}
<add>
<add>func TestNetworkRequest(t *testing.T) {
<add> defer testutils.SetupTestOSContext(t)()
<add> _, exp, err := net.ParseCIDR("172.17.0.0/16")
<add> if err != nil {
<add> t.Fatal(err)
<add> }
<add>
<add> nw, err := FindAvailableNetwork(PredefinedBroadNetworks)
<add> if err != nil {
<add> t.Fatal(err)
<add> }
<add> if !types.CompareIPNet(exp, nw) {
<add> t.Fatalf("exected %s. got %s", exp, nw)
<add> }
<add>
<add> _, exp, err = net.ParseCIDR("10.0.0.0/24")
<add> if err != nil {
<add> t.Fatal(err)
<add> }
<add> nw, err = FindAvailableNetwork(PredefinedGranularNetworks)
<add> if err != nil {
<add> t.Fatal(err)
<add> }
<add> if !types.CompareIPNet(exp, nw) {
<add> t.Fatalf("exected %s. got %s", exp, nw)
<add> }
<add>
<add> // Add iface and ssert returned address on request
<add> createInterface(t, "test", "172.17.42.1/16")
<add>
<add> _, exp, err = net.ParseCIDR("172.18.0.0/16")
<add> if err != nil {
<add> t.Fatal(err)
<add> }
<add> nw, err = FindAvailableNetwork(PredefinedBroadNetworks)
<add> if err != nil {
<add> t.Fatal(err)
<add> }
<add> if !types.CompareIPNet(exp, nw) {
<add> t.Fatalf("exected %s. got %s", exp, nw)
<add> }
<add>}
<add>
<add>func TestElectInterfaceAddress(t *testing.T) {
<add> defer testutils.SetupTestOSContext(t)()
<add> nws := "172.101.202.254/16"
<add> createInterface(t, "test", nws)
<add>
<add> ipv4Nw, ipv6Nw, err := ElectInterfaceAddresses("test")
<add> if err != nil {
<add> t.Fatal(err)
<add> }
<add>
<add> if len(ipv4Nw) == 0 {
<add> t.Fatalf("unexpected empty ipv4 network addresses")
<add> }
<add>
<add> if len(ipv6Nw) == 0 {
<add> t.Fatalf("unexpected empty ipv4 network addresses")
<add> }
<add>
<add> if nws != ipv4Nw[0].String() {
<add> t.Fatalf("expected %s. got %s", nws, ipv4Nw[0])
<add> }
<add>}
<add>
<add>func createInterface(t *testing.T, name, nw string) {
<add> // Add interface
<add> link := &netlink.Bridge{
<add> LinkAttrs: netlink.LinkAttrs{
<add> Name: "test",
<add> },
<add> }
<add> bip, err := types.ParseCIDR(nw)
<add> if err != nil {
<add> t.Fatal(err)
<add> }
<add> if err = netlink.LinkAdd(link); err != nil {
<add> t.Fatalf("Failed to create interface via netlink: %v", err)
<add> }
<add> if err := netlink.AddrAdd(link, &netlink.Addr{IPNet: bip}); err != nil {
<add> t.Fatal(err)
<add> }
<add> if err = netlink.LinkSetUp(link); err != nil {
<add> t.Fatal(err)
<add> }
<add>}
| 2
|
Text
|
Text
|
fix the link code
|
8c214ed16ddb2ad70d697d6f116c36114e37fe3f
|
<ide><path>docs/Manpage.md
<ide> With `--verbose` or `-v`, many commands print extra debugging information. Note
<ide> Upload logs for a failed build of `formula` to a new Gist.
<ide>
<ide> `formula` is usually the name of the formula to install, but it can be specified
<del> in several different ways. See [SPECIFYING FORMULAE][#specifying-formulae].
<add> in several different ways. See [SPECIFYING FORMULAE](#specifying-formulae).
<ide>
<ide> If `--new-issue` is passed, automatically create a new issue in the appropriate
<ide> GitHub repository as well as creating the Gist.
<ide> With `--verbose` or `-v`, many commands print extra debugging information. Note
<ide> Install `formula`.
<ide>
<ide> `formula` is usually the name of the formula to install, but it can be specified
<del> in several different ways. See [SPECIFYING FORMULAE][#specifying-formulae].
<add> in several different ways. See [SPECIFYING FORMULAE](#specifying-formulae).
<ide>
<ide> If `--debug` (or `-d`) is passed and brewing fails, open an interactive debugging
<ide> session with access to IRB or a shell inside the temporary build directory.
| 1
|
PHP
|
PHP
|
add test for
|
9a26183eccaa59a0fdef4c00ce698df184032c35
|
<ide><path>tests/TestCase/ORM/QueryRegressionTest.php
<ide> public function testSelectNoFieldsOnPrimaryAlias()
<ide> $this->assertCount(3, $results);
<ide> }
<ide>
<add> /**
<add> * Test selecting with aliased aggregates and identifier quoting
<add> * does not emit notice errors.
<add> *
<add> * @see https://github.com/cakephp/cakephp/issues/12766
<add> * @return void
<add> */
<add> public function testAliasedAggregateFieldTypeConversionSafe()
<add> {
<add> $this->loadFixtures('Articles');
<add> $articles = $this->getTableLocator()->get('Articles');
<add>
<add> $driver = $articles->getConnection()->getDriver();
<add> $restore = $driver->isAutoQuotingEnabled();
<add>
<add> $driver->enableAutoQuoting(true);
<add> $query = $articles->find();
<add> $query->select([
<add> 'sumUsers' => $articles->find()->func()->sum('author_id')
<add> ]);
<add> $driver->enableAutoQuoting($restore);
<add>
<add> $result = $query->execute()->fetchAll('assoc');
<add> $this->assertArrayHasKey('sumUsers', $result[0]);
<add> }
<add>
<ide> /**
<ide> * Tests that calling first on the query results will not remove all other results
<ide> * from the set.
| 1
|
Text
|
Text
|
fix whatwg url url.protocol example
|
bb5c84a1a7e29f6e5bca619dc73c78348326c1b7
|
<ide><path>doc/api/url.md
<ide> Gets and sets the protocol portion of the URL.
<ide> ```js
<ide> const myURL = new URL('https://example.org');
<ide> console.log(myURL.protocol);
<del> // Prints http:
<add> // Prints https:
<ide>
<ide> myURL.protocol = 'ftp';
<ide> console.log(myURL.href);
| 1
|
Text
|
Text
|
add v3.21.0-beta.1 to changelog
|
b6166734043bdea11622675bd96d4c5e4ebee7db
|
<ide><path>CHANGELOG.md
<ide> # Ember Changelog
<ide>
<add>### v3.21.0-beta.1 (July 13, 2020)
<add>
<add>- [#18993](https://github.com/emberjs/ember.js/pull/18993) [DEPRECATION] Deprecate `getWithDefault` per [RFC #554](https://github.com/emberjs/rfcs/blob/master/text/0554-deprecate-getwithdefault.md).
<add>- [#17571](https://github.com/emberjs/ember.js/pull/17571) [BUGFIX] Avoid tampering `queryParam` argument in RouterService#isActive
<add>
<ide> ### v3.20.0 (July 13, 2020)
<ide>
<ide> - [#18867](https://github.com/emberjs/ember.js/pull/18867) / [#18927](https://github.com/emberjs/ember.js/pull/18927) / [#18928](https://github.com/emberjs/ember.js/pull/18928) [FEATURE] [Promote `{{in-element}}` to public API](https://github.com/emberjs/rfcs/blob/master/text/0287-promote-in-element-to-public-api.md) RFC.
| 1
|
Javascript
|
Javascript
|
improve arguments check in container#reset
|
310cec8dcf5ce3bc124817fbe10345882a11b759
|
<ide><path>packages/container/lib/container.js
<ide> Container.prototype = {
<ide> },
<ide>
<ide> /**
<add> Clear either the entire cache or just the cache for a particular key.
<add>
<ide> @method reset
<add> @param {String} fullName optional key to reset; if missing, resets everything
<ide> */
<ide> reset: function(fullName) {
<del> if (fullName) {
<add> if (arguments.length > 0) {
<ide> resetMember(this, this._registry.normalize(fullName));
<ide> } else {
<ide> resetCache(this);
| 1
|
Javascript
|
Javascript
|
add support for arrays, functions, errors
|
bf8e0540f8195edbaaa3d0138bd6a26e79e1ab58
|
<ide><path>src/angular-mocks.js
<ide> angular.module.ngMock.TzDate.prototype = Date.prototype;
<ide> * @return a serialized string of the argument
<ide> */
<ide> angular.module.ngMock.dump = function(object){
<del> var out;
<del> if (angular.isElement(object)) {
<del> object = angular.element(object);
<del> out = angular.element('<div></div>')
<del> angular.forEach(object, function(element){
<del> out.append(angular.element(element).clone());
<del> });
<del> out = out.html();
<del> } else if (angular.isObject(object)) {
<del> if (angular.isFunction(object.$eval) && angular.isFunction(object.$apply)) {
<del> out = serializeScope(object);
<add> return serialize(object);
<add>
<add> function serialize(object) {
<add> var out;
<add>
<add> if (angular.isElement(object)) {
<add> object = angular.element(object);
<add> out = angular.element('<div></div>')
<add> angular.forEach(object, function(element){
<add> out.append(angular.element(element).clone());
<add> });
<add> out = out.html();
<add> } else if (angular.isArray(object)) {
<add> out = [];
<add> angular.forEach(object, function(o) {
<add> out.push(serialize(o));
<add> });
<add> out = '[ ' + out.join(', ') + ' ]';
<add> } else if (angular.isObject(object)) {
<add> if (angular.isFunction(object.$eval) && angular.isFunction(object.$apply)) {
<add> out = serializeScope(object);
<add> } else if (object instanceof Error) {
<add> out = object.stack || ('' + object.name + ': ' + object.message);
<add> } else {
<add> out = angular.toJson(object, true);
<add> }
<ide> } else {
<del> out = angular.toJson(object, true);
<add> out = String(object);
<ide> }
<del> } else {
<del> out = String(object);
<add>
<add> return out;
<ide> }
<del> return out;
<ide>
<ide> function serializeScope(scope, offset) {
<ide> offset = offset || ' ';
<ide> angular.module.ngMock.$HttpBackendProvider = function() {
<ide> responses.shift()();
<ide> }
<ide> } else {
<del> while (responses.length)
<add> while (responses.length) {
<ide> responses.shift()();
<add> }
<ide> }
<ide> $httpBackend.verifyNoOutstandingExpectation();
<ide> };
| 1
|
Mixed
|
Go
|
move remote api config out of daemon/
|
1d10c55aec891df609d36c90ee6c30adb24c16c4
|
<ide><path>api/client/commands.go
<ide> func (cli *DockerCli) CmdInfo(args ...string) error {
<ide> if initPath := remoteInfo.Get("InitPath"); initPath != "" {
<ide> fmt.Fprintf(cli.out, "Init Path: %s\n", initPath)
<ide> }
<del> if len(remoteInfo.GetList("Sockets")) != 0 {
<del> fmt.Fprintf(cli.out, "Sockets: %v\n", remoteInfo.GetList("Sockets"))
<del> }
<ide> }
<ide>
<ide> if len(remoteInfo.GetList("IndexServerAddress")) != 0 {
<ide><path>daemon/config.go
<ide> type Config struct {
<ide> DisableNetwork bool
<ide> EnableSelinuxSupport bool
<ide> Context map[string][]string
<del> Sockets []string
<ide> }
<ide>
<ide> // InstallFlags adds command-line options to the top-level flag parser for
<ide> func (config *Config) InstallFlags() {
<ide> opts.IPVar(&config.DefaultIp, []string{"#ip", "-ip"}, "0.0.0.0", "Default IP address to use when binding container ports")
<ide> opts.ListVar(&config.GraphOptions, []string{"-storage-opt"}, "Set storage driver options")
<ide> // FIXME: why the inconsistency between "hosts" and "sockets"?
<del> opts.HostListVar(&config.Sockets, []string{"H", "-host"}, "The socket(s) to bind to in daemon mode\nspecified using one or more tcp://host:port, unix:///path/to/socket, fd://* or fd://socketfd.")
<ide> opts.IPListVar(&config.Dns, []string{"#dns", "-dns"}, "Force Docker to use specific DNS servers")
<ide> opts.DnsSearchListVar(&config.DnsSearch, []string{"-dns-search"}, "Force Docker to use specific DNS search domains")
<ide> }
<ide><path>daemon/daemon.go
<ide> type Daemon struct {
<ide> containerGraph *graphdb.Database
<ide> driver graphdriver.Driver
<ide> execDriver execdriver.Driver
<del> Sockets []string
<ide> }
<ide>
<ide> // Install installs daemon capabilities to eng.
<ide> func NewDaemonFromDirectory(config *Config, eng *engine.Engine) (*Daemon, error)
<ide> sysInitPath: sysInitPath,
<ide> execDriver: ed,
<ide> eng: eng,
<del> Sockets: config.Sockets,
<ide> }
<ide> if err := daemon.checkLocaldns(); err != nil {
<ide> return nil, err
<ide><path>daemon/info.go
<ide> func (daemon *Daemon) CmdInfo(job *engine.Job) engine.Status {
<ide> v.Set("IndexServerAddress", registry.IndexServerAddress())
<ide> v.Set("InitSha1", dockerversion.INITSHA1)
<ide> v.Set("InitPath", initPath)
<del> v.SetList("Sockets", daemon.Sockets)
<ide> if _, err := v.WriteTo(job.Stdout); err != nil {
<ide> return job.Error(err)
<ide> }
<ide><path>docker/daemon.go
<ide> func mainDaemon() {
<ide> )
<ide>
<ide> // Serve api
<del> // FIXME: 'Sockets' should not be part of daemon.Config
<del> job := eng.Job("serveapi", daemonCfg.Sockets...)
<add> job := eng.Job("serveapi", flHosts...)
<ide> job.SetenvBool("Logging", true)
<ide> job.SetenvBool("EnableCors", *flEnableCors)
<ide> job.Setenv("Version", dockerversion.VERSION)
<ide><path>docker/docker.go
<ide> func main() {
<ide> os.Setenv("DEBUG", "1")
<ide> }
<ide>
<del> if len(daemonCfg.Sockets) == 0 {
<add> if len(flHosts) == 0 {
<ide> defaultHost := os.Getenv("DOCKER_HOST")
<ide> if defaultHost == "" || *flDaemon {
<ide> // If we do not have a host, default to unix socket
<ide> func main() {
<ide> if _, err := api.ValidateHost(defaultHost); err != nil {
<ide> log.Fatal(err)
<ide> }
<del> daemonCfg.Sockets = append(daemonCfg.Sockets, defaultHost)
<add> flHosts = append(flHosts, defaultHost)
<ide> }
<ide>
<ide> if *flDaemon {
<ide> mainDaemon()
<ide> return
<ide> }
<ide>
<del> if len(daemonCfg.Sockets) > 1 {
<add> if len(flHosts) > 1 {
<ide> log.Fatal("Please specify only one -H")
<ide> }
<del> protoAddrParts := strings.SplitN(daemonCfg.Sockets[0], "://", 2)
<add> protoAddrParts := strings.SplitN(flHosts[0], "://", 2)
<ide>
<ide> var (
<ide> cli *client.DockerCli
<ide><path>docker/flags.go
<ide> import (
<ide> "os"
<ide> "path/filepath"
<ide>
<add> "github.com/docker/docker/opts"
<ide> flag "github.com/docker/docker/pkg/mflag"
<ide> )
<ide>
<ide> var (
<ide> flTlsVerify = flag.Bool([]string{"-tlsverify"}, false, "Use TLS and verify the remote (daemon: verify client, client: verify daemon)")
<ide>
<ide> // these are initialized in init() below since their default values depend on dockerCertPath which isn't fully initialized until init() runs
<del> flCa *string
<del> flCert *string
<del> flKey *string
<add> flCa *string
<add> flCert *string
<add> flKey *string
<add> flHosts []string
<ide> )
<ide>
<ide> func init() {
<ide> flCa = flag.String([]string{"-tlscacert"}, filepath.Join(dockerCertPath, defaultCaFile), "Trust only remotes providing a certificate signed by the CA given here")
<ide> flCert = flag.String([]string{"-tlscert"}, filepath.Join(dockerCertPath, defaultCertFile), "Path to TLS certificate file")
<ide> flKey = flag.String([]string{"-tlskey"}, filepath.Join(dockerCertPath, defaultKeyFile), "Path to TLS key file")
<add> opts.HostListVar(&flHosts, []string{"H", "-host"}, "The socket(s) to bind to in daemon mode\nspecified using one or more tcp://host:port, unix:///path/to/socket, fd://* or fd://socketfd.")
<ide> }
<ide><path>docs/sources/reference/api/docker_remote_api_v1.13.md
<ide> Display system-wide information
<ide> "NGoroutines":21,
<ide> "NEventsListener":0,
<ide> "InitPath":"/usr/bin/docker",
<del> "Sockets":["unix:///var/run/docker.sock"],
<ide> "IndexServerAddress":["https://index.docker.io/v1/"],
<ide> "MemoryLimit":true,
<ide> "SwapLimit":false,
<ide><path>docs/sources/reference/api/docker_remote_api_v1.14.md
<ide> Display system-wide information
<ide> "NGoroutines":21,
<ide> "NEventsListener":0,
<ide> "InitPath":"/usr/bin/docker",
<del> "Sockets":["unix:///var/run/docker.sock"],
<ide> "IndexServerAddress":["https://index.docker.io/v1/"],
<ide> "MemoryLimit":true,
<ide> "SwapLimit":false,
<ide><path>docs/sources/reference/commandline/cli.md
<ide> For example:
<ide> Goroutines: 9
<ide> EventsListeners: 0
<ide> Init Path: /usr/bin/docker
<del> Sockets: [unix:///var/run/docker.sock]
<ide> Username: svendowideit
<ide> Registry: [https://index.docker.io/v1/]
<ide>
| 10
|
Javascript
|
Javascript
|
move the `issameorigin` helper function
|
537ed37835a1df383153d16d5d267fa0f121cf1d
|
<ide><path>src/display/api.js
<ide> import {
<ide> info,
<ide> InvalidPDFException,
<ide> isArrayBuffer,
<del> isSameOrigin,
<ide> MissingPDFException,
<ide> PasswordException,
<ide> RenderingIntentFlag,
<ide> const PDFWorkerUtil = {
<ide> fallbackWorkerSrc: null,
<ide> fakeWorkerId: 0,
<ide> };
<del>if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("GENERIC")) {
<add>if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
<ide> // eslint-disable-next-line no-undef
<ide> if (isNodeJS && typeof __non_webpack_require__ === "function") {
<ide> // Workers aren't supported in Node.js, force-disabling them there.
<ide> if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("GENERIC")) {
<ide> }
<ide> }
<ide>
<add> // Check if URLs have the same origin. For non-HTTP based URLs, returns false.
<add> PDFWorkerUtil.isSameOrigin = function (baseUrl, otherUrl) {
<add> let base;
<add> try {
<add> base = new URL(baseUrl);
<add> if (!base.origin || base.origin === "null") {
<add> return false; // non-HTTP url
<add> }
<add> } catch (e) {
<add> return false;
<add> }
<add>
<add> const other = new URL(otherUrl, base);
<add> return base.origin === other.origin;
<add> };
<add>
<ide> PDFWorkerUtil.createCDNWrapper = function (url) {
<ide> // We will rely on blob URL's property to specify origin.
<ide> // We want this function to fail in case if createObjectURL or Blob do not
<ide> class PDFWorker {
<ide> if (
<ide> typeof PDFJSDev !== "undefined" &&
<ide> PDFJSDev.test("GENERIC") &&
<del> !isSameOrigin(window.location.href, workerSrc)
<add> !PDFWorkerUtil.isSameOrigin(window.location.href, workerSrc)
<ide> ) {
<ide> workerSrc = PDFWorkerUtil.createCDNWrapper(
<ide> new URL(workerSrc, window.location).href
<ide> export {
<ide> PDFDocumentProxy,
<ide> PDFPageProxy,
<ide> PDFWorker,
<add> PDFWorkerUtil,
<ide> RenderTask,
<ide> setPDFNetworkStreamFactory,
<ide> version,
<ide><path>src/shared/util.js
<ide> function assert(cond, msg) {
<ide> }
<ide> }
<ide>
<del>// Checks if URLs have the same origin. For non-HTTP based URLs, returns false.
<del>function isSameOrigin(baseUrl, otherUrl) {
<del> let base;
<del> try {
<del> base = new URL(baseUrl);
<del> if (!base.origin || base.origin === "null") {
<del> return false; // non-HTTP url
<del> }
<del> } catch (e) {
<del> return false;
<del> }
<del>
<del> const other = new URL(otherUrl, base);
<del> return base.origin === other.origin;
<del>}
<del>
<ide> // Checks if URLs use one of the allowed protocols, e.g. to avoid XSS.
<ide> function _isValidProtocol(url) {
<ide> if (!url) {
<ide> export {
<ide> isAscii,
<ide> IsEvalSupportedCached,
<ide> IsLittleEndianCached,
<del> isSameOrigin,
<ide> MissingPDFException,
<ide> objectFromMap,
<ide> objectSize,
<ide><path>test/unit/api_spec.js
<ide> import {
<ide> PDFDocumentProxy,
<ide> PDFPageProxy,
<ide> PDFWorker,
<add> PDFWorkerUtil,
<ide> RenderTask,
<ide> } from "../../src/display/api.js";
<ide> import {
<ide> Caron Broadcasting, Inc., an Ohio corporation (“Lessee”).`)
<ide> }
<ide> );
<ide> });
<add>
<add> describe("PDFWorkerUtil", function () {
<add> describe("isSameOrigin", function () {
<add> const { isSameOrigin } = PDFWorkerUtil;
<add>
<add> it("handles invalid base URLs", function () {
<add> // The base URL is not valid.
<add> expect(isSameOrigin("/foo", "/bar")).toEqual(false);
<add>
<add> // The base URL has no origin.
<add> expect(isSameOrigin("blob:foo", "/bar")).toEqual(false);
<add> });
<add>
<add> it("correctly checks if the origin of both URLs matches", function () {
<add> expect(
<add> isSameOrigin(
<add> "https://www.mozilla.org/foo",
<add> "https://www.mozilla.org/bar"
<add> )
<add> ).toEqual(true);
<add> expect(
<add> isSameOrigin(
<add> "https://www.mozilla.org/foo",
<add> "https://www.example.com/bar"
<add> )
<add> ).toEqual(false);
<add> });
<add> });
<add> });
<ide> });
<ide><path>test/unit/util_spec.js
<ide> import {
<ide> getModificationDate,
<ide> isArrayBuffer,
<ide> isAscii,
<del> isSameOrigin,
<ide> string32,
<ide> stringToBytes,
<ide> stringToPDFString,
<ide> describe("util", function () {
<ide> });
<ide> });
<ide>
<del> describe("isSameOrigin", function () {
<del> it("handles invalid base URLs", function () {
<del> // The base URL is not valid.
<del> expect(isSameOrigin("/foo", "/bar")).toEqual(false);
<del>
<del> // The base URL has no origin.
<del> expect(isSameOrigin("blob:foo", "/bar")).toEqual(false);
<del> });
<del>
<del> it("correctly checks if the origin of both URLs matches", function () {
<del> expect(
<del> isSameOrigin(
<del> "https://www.mozilla.org/foo",
<del> "https://www.mozilla.org/bar"
<del> )
<del> ).toEqual(true);
<del> expect(
<del> isSameOrigin(
<del> "https://www.mozilla.org/foo",
<del> "https://www.example.com/bar"
<del> )
<del> ).toEqual(false);
<del> });
<del> });
<del>
<ide> describe("createValidAbsoluteUrl", function () {
<ide> it("handles invalid URLs", function () {
<ide> expect(createValidAbsoluteUrl(undefined, undefined)).toEqual(null);
| 4
|
Python
|
Python
|
replace torch.triu with onnx compatible code
|
9fd11bf1a889d140d6c81435e2927a718ec52b0f
|
<ide><path>src/transformers/modeling_bart.py
<ide> def _prepare_bart_decoder_inputs(
<ide> if decoder_padding_mask is not None and decoder_padding_mask.shape[1] > 1:
<ide> # never mask leading token, even if it is pad
<ide> decoder_padding_mask[:, 0] = decoder_padding_mask[:, 1]
<del> causal_mask = torch.triu(fill_with_neg_inf(torch.zeros(tgt_len, tgt_len)), 1).to(
<del> dtype=causal_mask_dtype, device=decoder_input_ids.device
<del> )
<add> tmp = fill_with_neg_inf(torch.zeros(tgt_len, tgt_len))
<add> mask = torch.arange(tmp.size(-1))
<add> tmp.masked_fill_(mask < (mask + 1).view(tmp.size(-1), 1), 0)
<add> causal_mask = tmp.to(dtype=causal_mask_dtype, device=decoder_input_ids.device)
<ide> return decoder_input_ids, decoder_padding_mask, causal_mask
<ide>
<ide>
| 1
|
Python
|
Python
|
fix test_io.roundtriptest on python3 + windows
|
4f4558ae51354526b0a4c2d7bb1da8db040fb16c
|
<ide><path>numpy/lib/tests/test_io.py
<ide> def StringIO(s=""):
<ide> return BytesIO(asbytes(s))
<ide> else:
<ide> from StringIO import StringIO
<add> BytesIO = StringIO
<ide>
<ide> MAJVER, MINVER = sys.version_info[:2]
<ide>
<ide> def roundtrip(self, save_func, *args, **kwargs):
<ide> target_file.flush()
<ide> target_file.seek(0)
<ide>
<del> if sys.platform == 'win32' and not isinstance(target_file, StringIO):
<add> if sys.platform == 'win32' and not isinstance(target_file, BytesIO):
<ide> target_file.close()
<ide>
<ide> arr_reloaded = np.load(load_file, **load_kwds)
| 1
|
Go
|
Go
|
fix a race in mockcwlogsclient
|
c1ad02ccc8791b3c517aa37223d27792863cbf17
|
<ide><path>daemon/logger/awslogs/cwlogsiface_mock_test.go
<ide> func (m *mockcwlogsclient) CreateLogStream(input *cloudwatchlogs.CreateLogStream
<ide> }
<ide>
<ide> func (m *mockcwlogsclient) PutLogEvents(input *cloudwatchlogs.PutLogEventsInput) (*cloudwatchlogs.PutLogEventsOutput, error) {
<del> m.putLogEventsArgument <- input
<add> events := make([]*cloudwatchlogs.InputLogEvent, len(input.LogEvents))
<add> copy(events, input.LogEvents)
<add> m.putLogEventsArgument <- &cloudwatchlogs.PutLogEventsInput{
<add> LogEvents: events,
<add> SequenceToken: input.SequenceToken,
<add> LogGroupName: input.LogGroupName,
<add> LogStreamName: input.LogStreamName,
<add> }
<ide> output := <-m.putLogEventsResult
<ide> return output.successResult, output.errorResult
<ide> }
| 1
|
Java
|
Java
|
fix measurelayout function for virtual nodes
|
5c48c94f8c0441bc78a007f0ea0c5b2763ff6875
|
<ide><path>ReactAndroid/src/main/java/com/facebook/react/uimanager/UIImplementation.java
<ide> private void measureLayoutRelativeToVerifiedAncestor(
<ide> ReactShadowNode node, ReactShadowNode ancestor, int[] outputBuffer) {
<ide> int offsetX = 0;
<ide> int offsetY = 0;
<del> if (node != ancestor) {
<add> if (node != ancestor && !node.isVirtual()) {
<ide> offsetX = Math.round(node.getLayoutX());
<ide> offsetY = Math.round(node.getLayoutY());
<ide> ReactShadowNode current = node.getParent();
| 1
|
Javascript
|
Javascript
|
gjslint part of tests
|
c0d69a488380fb3cfc1fb257972730ad5c570ef9
|
<ide><path>test/fixtures/a.js
<del>var c = require("./b/c");
<add>var c = require('./b/c');
<ide>
<del>common.debug("load fixtures/a.js");
<add>common.debug('load fixtures/a.js');
<ide>
<del>var string = "A";
<add>var string = 'A';
<ide>
<ide> exports.SomeClass = c.SomeClass;
<ide>
<del>exports.A = function () {
<add>exports.A = function() {
<ide> return string;
<ide> };
<ide>
<del>exports.C = function () {
<add>exports.C = function() {
<ide> return c.C();
<ide> };
<ide>
<del>exports.D = function () {
<add>exports.D = function() {
<ide> return c.D();
<ide> };
<ide>
<ide> exports.number = 42;
<ide>
<del>process.addListener("exit", function () {
<del> string = "A done";
<add>process.addListener('exit', function() {
<add> string = 'A done';
<ide> });
<ide><path>test/fixtures/b/c.js
<del>var d = require("./d");
<add>var d = require('./d');
<ide>
<del>var assert = require("assert");
<add>var assert = require('assert');
<ide>
<del>var package = require("./package");
<add>var package = require('./package');
<ide>
<del>assert.equal("world", package.hello);
<add>assert.equal('world', package.hello);
<ide>
<del>common.debug("load fixtures/b/c.js");
<add>common.debug('load fixtures/b/c.js');
<ide>
<del>var string = "C";
<add>var string = 'C';
<ide>
<ide> exports.SomeClass = function() {
<ide>
<ide> };
<ide>
<del>exports.C = function () {
<add>exports.C = function() {
<ide> return string;
<ide> };
<ide>
<del>exports.D = function () {
<add>exports.D = function() {
<ide> return d.D();
<ide> };
<ide>
<del>process.addListener("exit", function () {
<del> string = "C done";
<del> console.log("b/c.js exit");
<add>process.addListener('exit', function() {
<add> string = 'C done';
<add> console.log('b/c.js exit');
<ide> });
<ide><path>test/fixtures/b/d.js
<del>common.debug("load fixtures/b/d.js");
<add>common.debug('load fixtures/b/d.js');
<ide>
<del>var string = "D";
<add>var string = 'D';
<ide>
<del>exports.D = function () {
<add>exports.D = function() {
<ide> return string;
<ide> };
<ide>
<del>process.addListener("exit", function () {
<del> string = "D done";
<add>process.addListener('exit', function() {
<add> string = 'D done';
<ide> });
<ide>
<ide><path>test/fixtures/b/package/index.js
<del>exports.hello = "world";
<del>common.debug("load package/index.js");
<add>exports.hello = 'world';
<add>common.debug('load package/index.js');
<ide><path>test/fixtures/child_process_should_emit_error.js
<ide> var exec = require('child_process').exec;
<ide>
<ide> [0, 1].forEach(function(i) {
<del> exec('ls', function(err, stdout, stderr) {
<del> console.log(i);
<del> throw new Error('hello world');
<del> });
<add> exec('ls', function(err, stdout, stderr) {
<add> console.log(i);
<add> throw new Error('hello world');
<add> });
<ide> });
<ide><path>test/fixtures/cycles/folder/foo.js
<ide>
<del>var root = require("./../root");
<add>var root = require('./../root');
<ide>
<del>exports.hello = function () {
<add>exports.hello = function() {
<ide> return root.calledFromFoo();
<ide> };
<ide><path>test/fixtures/cycles/root.js
<ide>
<del>var foo = exports.foo = require("./folder/foo");
<add>var foo = exports.foo = require('./folder/foo');
<ide>
<del>exports.hello = "hello";
<del>exports.sayHello = function () {
<add>exports.hello = 'hello';
<add>exports.sayHello = function() {
<ide> return foo.hello();
<ide> };
<del>exports.calledFromFoo = function () {
<add>exports.calledFromFoo = function() {
<ide> return exports.hello;
<ide> };
<ide><path>test/fixtures/echo.js
<del>common = require("../common");
<add>common = require('../common');
<ide> assert = common.assert;
<ide>
<del>common.print("hello world\r\n");
<add>common.print('hello world\r\n');
<ide>
<ide> var stdin = process.openStdin();
<ide>
<del>stdin.addListener("data", function (data) {
<add>stdin.addListener('data', function(data) {
<ide> process.stdout.write(data.toString());
<ide> });
<ide>
<del>stdin.addListener("end", function () {
<add>stdin.addListener('end', function() {
<ide> process.stdout.end();
<ide> });
<ide><path>test/fixtures/global/plain.js
<del>foo = "foo";
<del>global.bar = "bar";
<add>foo = 'foo';
<add>global.bar = 'bar';
<ide>
<del>exports.fooBar = {foo: global.foo, bar:bar};
<ide>\ No newline at end of file
<add>exports.fooBar = {foo: global.foo, bar: bar};
<ide><path>test/fixtures/nested-index/one/hello.js
<del>exports.hello = "hello from one!";
<add>exports.hello = 'hello from one!';
<ide>
<ide><path>test/fixtures/nested-index/two/hello.js
<del>exports.hello = "hello from two!";
<add>exports.hello = 'hello from two!';
<ide>
<ide><path>test/fixtures/net-fd-passing-receiver.js
<del>process.mixin(require("../common"));
<del>net = require("net");
<add>process.mixin(require('../common'));
<add>net = require('net');
<ide>
<ide> path = process.ARGV[2];
<ide> greeting = process.ARGV[3];
<ide>
<ide> receiver = net.createServer(function(socket) {
<del> socket.addListener("fd", function(fd) {
<add> socket.addListener('fd', function(fd) {
<ide> var peerInfo = process.getpeername(fd);
<ide> peerInfo.fd = fd;
<ide> var passedSocket = new net.Socket(peerInfo);
<ide>
<del> passedSocket.addListener("eof", function() {
<add> passedSocket.addListener('eof', function() {
<ide> passedSocket.close();
<ide> });
<ide>
<del> passedSocket.addListener("data", function(data) {
<del> passedSocket.send("[echo] " + data);
<add> passedSocket.addListener('data', function(data) {
<add> passedSocket.send('[echo] ' + data);
<ide> });
<del> passedSocket.addListener("close", function() {
<add> passedSocket.addListener('close', function() {
<ide> receiver.close();
<ide> });
<del> passedSocket.send("[greeting] " + greeting);
<add> passedSocket.send('[greeting] ' + greeting);
<ide> });
<ide> });
<ide>
<ide> /* To signal the test runne we're up and listening */
<del>receiver.addListener("listening", function() {
<del> common.print("ready");
<add>receiver.addListener('listening', function() {
<add> common.print('ready');
<ide> });
<ide>
<ide> receiver.listen(path);
<ide><path>test/fixtures/print-chars-from-buffer.js
<del>common = require("../common");
<del>assert = common.assert
<del>Buffer = require("buffer").Buffer;
<add>common = require('../common');
<add>assert = common.assert;
<add>Buffer = require('buffer').Buffer;
<ide>
<ide> var n = parseInt(process.argv[2]);
<ide>
<ide> b = new Buffer(n);
<del>for (var i = 0; i < n; i++) { b[i] = 100; }
<add>for (var i = 0; i < n; i++) {
<add> b[i] = 100;
<add>}
<ide>
<ide> process.stdout.write(b);
<ide><path>test/fixtures/print-chars.js
<del>common = require("../common");
<del>assert = common.assert
<add>common = require('../common');
<add>assert = common.assert;
<ide>
<ide> var n = parseInt(process.argv[2]);
<ide>
<del>var s = "";
<add>var s = '';
<ide> for (var i = 0; i < n; i++) {
<ide> s += 'c';
<ide> }
<ide><path>test/fixtures/recvfd.js
<ide> function processData(s) {
<ide> if (pipeStream.write(JSON.stringify(d) + '\n')) {
<ide> drainFunc();
<ide> }
<del>};
<add>}
<ide>
<ide> // Create a UNIX socket to the path defined by argv[2] and read a file
<ide> // descriptor and misc data from it.
<ide><path>test/fixtures/require-path/p1/bar.js
<del>var path = require("path");
<add>var path = require('path');
<ide>
<del>require.paths.unshift(path.join(__dirname,"../p2"));
<add>require.paths.unshift(path.join(__dirname, '../p2'));
<ide>
<del>exports.foo = require("foo");
<add>exports.foo = require('foo');
<ide>
<del>exports.expect = require(path.join(__dirname, "../p2/bar"));
<add>exports.expect = require(path.join(__dirname, '../p2/bar'));
<ide> exports.actual = exports.foo.bar;
<ide><path>test/fixtures/require-path/p1/foo.js
<ide> require.paths.unshift(__dirname);
<del>exports.bar = require("bar");
<add>exports.bar = require('bar');
<ide><path>test/fixtures/require-path/p2/foo.js
<ide> require.paths.unshift(__dirname);
<del>exports.bar = require("bar"); // surprise! this is not /p2/bar, this is /p1/bar
<add>exports.bar = require('bar'); // surprise! this is not /p2/bar, this is /p1/bar
<ide><path>test/fixtures/should_exit.js
<ide> function tmp() {}
<del>process.addListener("SIGINT", tmp);
<del>process.removeListener("SIGINT", tmp);
<del>setInterval(function () {
<add>process.addListener('SIGINT', tmp);
<add>process.removeListener('SIGINT', tmp);
<add>setInterval(function() {
<ide> process.stdout.write('keep alive\n');
<ide> }, 1000);
<ide><path>test/fixtures/stdio-filter.js
<ide> var replacement = process.argv[3];
<ide> var re = new RegExp(regexIn, 'g');
<ide> var stdin = process.openStdin();
<ide>
<del>stdin.addListener("data", function (data) {
<add>stdin.addListener('data', function(data) {
<ide> data = data.toString();
<ide> process.stdout.write(data.replace(re, replacement));
<ide> });
<ide><path>test/fixtures/throws_error.js
<del>throw new Error("blah");
<add>throw new Error('blah');
<ide><path>test/fixtures/throws_error1.js
<del>throw new Error("blah");
<add>throw new Error('blah');
<ide><path>test/fixtures/throws_error3.js
<del>process.nextTick(function () {
<add>process.nextTick(function() {
<ide> JSON.parse(undefined);
<ide> });
<ide><path>test/message/2100bytes.js
<del>common = require("../common");
<del>assert = common.assert
<add>common = require('../common');
<add>assert = common.assert;
<ide>
<ide> util = require('util');
<ide> console.log([
<del> '_______________________________________________50',
<del> '______________________________________________100',
<del> '______________________________________________150',
<del> '______________________________________________200',
<del> '______________________________________________250',
<del> '______________________________________________300',
<del> '______________________________________________350',
<del> '______________________________________________400',
<del> '______________________________________________450',
<del> '______________________________________________500',
<del> '______________________________________________550',
<del> '______________________________________________600',
<del> '______________________________________________650',
<del> '______________________________________________700',
<del> '______________________________________________750',
<del> '______________________________________________800',
<del> '______________________________________________850',
<del> '______________________________________________900',
<del> '______________________________________________950',
<del> '_____________________________________________1000',
<del> '_____________________________________________1050',
<del> '_____________________________________________1100',
<del> '_____________________________________________1150',
<del> '_____________________________________________1200',
<del> '_____________________________________________1250',
<del> '_____________________________________________1300',
<del> '_____________________________________________1350',
<del> '_____________________________________________1400',
<del> '_____________________________________________1450',
<del> '_____________________________________________1500',
<del> '_____________________________________________1550',
<del> '_____________________________________________1600',
<del> '_____________________________________________1650',
<del> '_____________________________________________1700',
<del> '_____________________________________________1750',
<del> '_____________________________________________1800',
<del> '_____________________________________________1850',
<del> '_____________________________________________1900',
<del> '_____________________________________________1950',
<del> '_____________________________________________2000',
<del> '_____________________________________________2050',
<del> '_____________________________________________2100',
<add> '_______________________________________________50',
<add> '______________________________________________100',
<add> '______________________________________________150',
<add> '______________________________________________200',
<add> '______________________________________________250',
<add> '______________________________________________300',
<add> '______________________________________________350',
<add> '______________________________________________400',
<add> '______________________________________________450',
<add> '______________________________________________500',
<add> '______________________________________________550',
<add> '______________________________________________600',
<add> '______________________________________________650',
<add> '______________________________________________700',
<add> '______________________________________________750',
<add> '______________________________________________800',
<add> '______________________________________________850',
<add> '______________________________________________900',
<add> '______________________________________________950',
<add> '_____________________________________________1000',
<add> '_____________________________________________1050',
<add> '_____________________________________________1100',
<add> '_____________________________________________1150',
<add> '_____________________________________________1200',
<add> '_____________________________________________1250',
<add> '_____________________________________________1300',
<add> '_____________________________________________1350',
<add> '_____________________________________________1400',
<add> '_____________________________________________1450',
<add> '_____________________________________________1500',
<add> '_____________________________________________1550',
<add> '_____________________________________________1600',
<add> '_____________________________________________1650',
<add> '_____________________________________________1700',
<add> '_____________________________________________1750',
<add> '_____________________________________________1800',
<add> '_____________________________________________1850',
<add> '_____________________________________________1900',
<add> '_____________________________________________1950',
<add> '_____________________________________________2000',
<add> '_____________________________________________2050',
<add> '_____________________________________________2100'
<ide> ].join('\n'));
<ide>
<ide><path>test/message/hello_world.js
<del>common = require("../common");
<del>assert = common.assert
<add>common = require('../common');
<add>assert = common.assert;
<ide>
<ide> console.log('hello world');
<ide><path>test/message/undefined_reference_in_new_context.js
<del>common = require("../common");
<del>assert = common.assert
<add>common = require('../common');
<add>assert = common.assert;
<ide>
<ide> common.error('before');
<ide>
<ide><path>test/pummel/test-child-process-spawn-loop.js
<del>common = require("../common");
<del>assert = common.assert
<add>common = require('../common');
<add>assert = common.assert;
<ide>
<ide> var spawn = require('child_process').spawn;
<ide>
<ide> var SIZE = 1000 * 1024;
<ide> var N = 40;
<ide> var finished = false;
<ide>
<del>function doSpawn (i) {
<del> var child = spawn( 'python', ['-c', 'print ' + SIZE + ' * "C"']);
<add>function doSpawn(i) {
<add> var child = spawn('python', ['-c', 'print ' + SIZE + ' * "C"']);
<ide> var count = 0;
<ide>
<ide> child.stdout.setEncoding('ascii');
<del> child.stdout.addListener("data", function (chunk) {
<add> child.stdout.addListener('data', function(chunk) {
<ide> count += chunk.length;
<ide> });
<ide>
<del> child.stderr.addListener("data", function (chunk) {
<add> child.stderr.addListener('data', function(chunk) {
<ide> console.log('stderr: ' + chunk);
<ide> });
<ide>
<del> child.addListener("exit", function () {
<add> child.addListener('exit', function() {
<ide> assert.equal(SIZE + 1, count); // + 1 for \n
<ide> if (i < N) {
<del> doSpawn(i+1);
<add> doSpawn(i + 1);
<ide> } else {
<ide> finished = true;
<ide> }
<ide> function doSpawn (i) {
<ide>
<ide> doSpawn(0);
<ide>
<del>process.addListener("exit", function () {
<add>process.addListener('exit', function() {
<ide> assert.ok(finished);
<ide> });
<ide><path>test/pummel/test-http-client-reconnect-bug.js
<del>common = require("../common");
<del>assert = common.assert
<add>common = require('../common');
<add>assert = common.assert;
<ide>
<del>var net = require("net"),
<del> util = require("util"),
<del> http = require("http");
<add>var net = require('net'),
<add> util = require('util'),
<add> http = require('http');
<ide>
<ide> var errorCount = 0;
<ide> var eofCount = 0;
<ide>
<ide> var server = net.createServer(function(socket) {
<ide> socket.end();
<ide> });
<del>server.on('listening', function(){
<add>server.on('listening', function() {
<ide> var client = http.createClient(common.PORT);
<ide>
<del> client.addListener("error", function(err) {
<del> console.log("ERROR! "+(err.stack||err));
<add> client.addListener('error', function(err) {
<add> console.log('ERROR! ' + (err.stack || err));
<ide> errorCount++;
<ide> });
<ide>
<del> client.addListener("end", function() {
<del> console.log("EOF!");
<add> client.addListener('end', function() {
<add> console.log('EOF!');
<ide> eofCount++;
<ide> });
<ide>
<del> var request = client.request("GET", "/", {"host": "localhost"});
<add> var request = client.request('GET', '/', {'host': 'localhost'});
<ide> request.end();
<ide> request.addListener('response', function(response) {
<del> console.log("STATUS: " + response.statusCode);
<add> console.log('STATUS: ' + response.statusCode);
<ide> });
<ide> });
<ide> server.listen(common.PORT);
<ide>
<del>setTimeout(function () {
<add>setTimeout(function() {
<ide> server.close();
<ide> }, 500);
<ide>
<ide>
<del>process.addListener('exit', function () {
<add>process.addListener('exit', function() {
<ide> assert.equal(0, errorCount);
<ide> assert.equal(1, eofCount);
<ide> });
<ide><path>test/pummel/test-http-upload-timeout.js
<ide> // This tests setTimeout() by having multiple clients connecting and sending
<ide> // data in random intervals. Clients are also randomly disconnecting until there
<ide> // are no more clients left. If no false timeout occurs, this test has passed.
<del>var common = require("../common"),
<del> assert = require("assert"),
<add>var common = require('../common'),
<add> assert = require('assert'),
<ide> http = require('http'),
<ide> server = http.createServer(),
<ide> connections = 0;
<ide><path>test/pummel/test-keep-alive.js
<del>// This test requires the program "ab"
<del>common = require("../common");
<del>assert = common.assert
<del>http = require("http");
<del>exec = require("child_process").exec;
<add>// This test requires the program 'ab'
<add>common = require('../common');
<add>assert = common.assert;
<add>http = require('http');
<add>exec = require('child_process').exec;
<ide>
<del>body = "hello world\n";
<del>server = http.createServer(function (req, res) {
<add>body = 'hello world\n';
<add>server = http.createServer(function(req, res) {
<ide> res.writeHead(200, {
<del> "Content-Length": body.length,
<del> "Content-Type": "text/plain"
<add> 'Content-Length': body.length,
<add> 'Content-Type': 'text/plain'
<ide> });
<ide> res.write(body);
<ide> res.end();
<ide> var normalReqSec = 0;
<ide>
<ide>
<ide> function runAb(opts, callback) {
<del> var command = "ab " + opts + " http://127.0.0.1:" + common.PORT + "/";
<del> exec(command, function (err, stdout, stderr) {
<add> var command = 'ab ' + opts + ' http://127.0.0.1:' + common.PORT + '/';
<add> exec(command, function(err, stdout, stderr) {
<ide> if (err) {
<del> if (stderr.indexOf("ab") >= 0) {
<del> console.log("ab not installed? skipping test.\n" + stderr);
<add> if (stderr.indexOf('ab') >= 0) {
<add> console.log('ab not installed? skipping test.\n' + stderr);
<ide> process.reallyExit(0);
<ide> }
<ide> return;
<ide> function runAb(opts, callback) {
<ide> });
<ide> }
<ide>
<del>server.listen(common.PORT, function () {
<del> runAb("-k -c 100 -t 2", function (reqSec, keepAliveRequests) {
<add>server.listen(common.PORT, function() {
<add> runAb('-k -c 100 -t 2', function(reqSec, keepAliveRequests) {
<ide> keepAliveReqSec = reqSec;
<ide> assert.equal(true, keepAliveRequests > 0);
<del> console.log("keep-alive: " + keepAliveReqSec + " req/sec");
<add> console.log('keep-alive: ' + keepAliveReqSec + ' req/sec');
<ide>
<del> runAb("-c 100 -t 2", function (reqSec, keepAliveRequests) {
<add> runAb('-c 100 -t 2', function(reqSec, keepAliveRequests) {
<ide> normalReqSec = reqSec;
<ide> assert.equal(0, keepAliveRequests);
<del> console.log("normal: " + normalReqSec + " req/sec");
<add> console.log('normal: ' + normalReqSec + ' req/sec');
<ide> server.close();
<ide> });
<ide> });
<ide> });
<ide>
<del>process.addListener("exit", function () {
<add>process.addListener('exit', function() {
<ide> assert.equal(true, normalReqSec > 50);
<ide> assert.equal(true, keepAliveReqSec > 50);
<ide> assert.equal(true, normalReqSec < keepAliveReqSec);
<ide><path>test/pummel/test-net-many-clients.js
<del>common = require("../common");
<del>assert = common.assert
<del>net = require("net");
<add>common = require('../common');
<add>assert = common.assert;
<add>net = require('net');
<ide> // settings
<del>var bytes = 1024*40;
<add>var bytes = 1024 * 40;
<ide> var concurrency = 100;
<ide> var connections_per_client = 5;
<ide>
<ide> // measured
<ide> var total_connections = 0;
<ide>
<del>var body = "";
<add>var body = '';
<ide> for (var i = 0; i < bytes; i++) {
<del> body += "C";
<add> body += 'C';
<ide> }
<ide>
<del>var server = net.createServer(function (c) {
<del> c.addListener("connect", function () {
<add>var server = net.createServer(function(c) {
<add> c.addListener('connect', function() {
<ide> total_connections++;
<del> common.print("#");
<add> common.print('#');
<ide> c.write(body);
<ide> c.end();
<ide> });
<ide> });
<ide>
<del>function runClient (callback) {
<add>function runClient(callback) {
<ide> var client = net.createConnection(common.PORT);
<ide>
<ide> client.connections = 0;
<ide>
<del> client.setEncoding("utf8");
<add> client.setEncoding('utf8');
<ide>
<del> client.addListener("connect", function () {
<del> common.print("c");
<del> client.recved = "";
<add> client.addListener('connect', function() {
<add> common.print('c');
<add> client.recved = '';
<ide> client.connections += 1;
<ide> });
<ide>
<del> client.addListener("data", function (chunk) {
<add> client.addListener('data', function(chunk) {
<ide> this.recved += chunk;
<ide> });
<ide>
<del> client.addListener("end", function () {
<add> client.addListener('end', function() {
<ide> client.end();
<ide> });
<ide>
<del> client.addListener("error", function (e) {
<del> console.log("\n\nERROOOOOr");
<add> client.addListener('error', function(e) {
<add> console.log('\n\nERROOOOOr');
<ide> throw e;
<ide> });
<ide>
<del> client.addListener("close", function (had_error) {
<del> common.print(".");
<add> client.addListener('close', function(had_error) {
<add> common.print('.');
<ide> assert.equal(false, had_error);
<ide> assert.equal(bytes, client.recved.length);
<ide>
<ide> function runClient (callback) {
<ide> });
<ide> }
<ide>
<del>server.listen(common.PORT, function () {
<add>server.listen(common.PORT, function() {
<ide> var finished_clients = 0;
<ide> for (var i = 0; i < concurrency; i++) {
<del> runClient(function () {
<add> runClient(function() {
<ide> if (++finished_clients == concurrency) server.close();
<ide> });
<ide> }
<ide> });
<ide>
<del>process.addListener("exit", function () {
<add>process.addListener('exit', function() {
<ide> assert.equal(connections_per_client * concurrency, total_connections);
<del> console.log("\nokay!");
<add> console.log('\nokay!');
<ide> });
<ide><path>test/pummel/test-net-pause.js
<del>var common = require("../common");
<add>var common = require('../common');
<ide> var assert = common.assert;
<del>var net = require("net");
<add>var net = require('net');
<ide> var N = 200;
<del>var recv = "", chars_recved = 0;
<add>var recv = '', chars_recved = 0;
<ide>
<del>server = net.createServer(function (connection) {
<del> function write (j) {
<add>server = net.createServer(function(connection) {
<add> function write(j) {
<ide> if (j >= N) {
<ide> connection.end();
<ide> return;
<ide> }
<del> setTimeout(function () {
<del> connection.write("C");
<del> write(j+1);
<add> setTimeout(function() {
<add> connection.write('C');
<add> write(j + 1);
<ide> }, 10);
<ide> }
<ide> write(0);
<ide> });
<del>server.on('listening', function(){
<add>server.on('listening', function() {
<ide> client = net.createConnection(common.PORT);
<del> client.setEncoding("ascii");
<del> client.addListener("data", function (d) {
<del> common.print(d);
<del> recv += d;
<add> client.setEncoding('ascii');
<add> client.addListener('data', function(d) {
<add> common.print(d);
<add> recv += d;
<ide> });
<ide>
<del> setTimeout(function () {
<add> setTimeout(function() {
<ide> chars_recved = recv.length;
<del> console.log("pause at: " + chars_recved);
<add> console.log('pause at: ' + chars_recved);
<ide> assert.equal(true, chars_recved > 1);
<ide> client.pause();
<del> setTimeout(function () {
<del> console.log("resume at: " + chars_recved);
<add> setTimeout(function() {
<add> console.log('resume at: ' + chars_recved);
<ide> assert.equal(chars_recved, recv.length);
<ide> client.resume();
<ide>
<del> setTimeout(function () {
<add> setTimeout(function() {
<ide> chars_recved = recv.length;
<del> console.log("pause at: " + chars_recved);
<add> console.log('pause at: ' + chars_recved);
<ide> client.pause();
<ide>
<del> setTimeout(function () {
<del> console.log("resume at: " + chars_recved);
<add> setTimeout(function() {
<add> console.log('resume at: ' + chars_recved);
<ide> assert.equal(chars_recved, recv.length);
<ide> client.resume();
<ide>
<ide> server.on('listening', function(){
<ide>
<ide> }, 500);
<ide>
<del> client.addListener("end", function () {
<add> client.addListener('end', function() {
<ide> server.close();
<ide> client.end();
<ide> });
<ide> });
<ide> server.listen(common.PORT);
<ide>
<del>process.addListener("exit", function () {
<add>process.addListener('exit', function() {
<ide> assert.equal(N, recv.length);
<del> common.debug("Exit");
<add> common.debug('Exit');
<ide> });
<ide><path>test/pummel/test-net-pingpong-delay.js
<del>common = require("../common");
<del>assert = common.assert
<del>net = require("net");
<add>common = require('../common');
<add>assert = common.assert;
<add>net = require('net');
<ide>
<ide>
<ide> var tests_run = 0;
<ide>
<del>function pingPongTest (port, host, on_complete) {
<add>function pingPongTest(port, host, on_complete) {
<ide> var N = 100;
<ide> var DELAY = 1;
<ide> var count = 0;
<ide> var client_ended = false;
<ide>
<del> var server = net.createServer({ allowHalfOpen: true }, function (socket) {
<del> socket.setEncoding("utf8");
<add> var server = net.createServer({ allowHalfOpen: true }, function(socket) {
<add> socket.setEncoding('utf8');
<ide>
<del> socket.addListener("data", function (data) {
<add> socket.addListener('data', function(data) {
<ide> console.log(data);
<del> assert.equal("PING", data);
<del> assert.equal("open", socket.readyState);
<add> assert.equal('PING', data);
<add> assert.equal('open', socket.readyState);
<ide> assert.equal(true, count <= N);
<del> setTimeout(function () {
<del> assert.equal("open", socket.readyState);
<del> socket.write("PONG");
<add> setTimeout(function() {
<add> assert.equal('open', socket.readyState);
<add> socket.write('PONG');
<ide> }, DELAY);
<ide> });
<ide>
<del> socket.addListener("timeout", function () {
<del> common.debug("server-side timeout!!");
<add> socket.addListener('timeout', function() {
<add> common.debug('server-side timeout!!');
<ide> assert.equal(false, true);
<ide> });
<ide>
<del> socket.addListener("end", function () {
<del> console.log("server-side socket EOF");
<del> assert.equal("writeOnly", socket.readyState);
<add> socket.addListener('end', function() {
<add> console.log('server-side socket EOF');
<add> assert.equal('writeOnly', socket.readyState);
<ide> socket.end();
<ide> });
<ide>
<del> socket.addListener("close", function (had_error) {
<del> console.log("server-side socket.end");
<add> socket.addListener('close', function(had_error) {
<add> console.log('server-side socket.end');
<ide> assert.equal(false, had_error);
<del> assert.equal("closed", socket.readyState);
<add> assert.equal('closed', socket.readyState);
<ide> socket.server.close();
<ide> });
<ide> });
<ide>
<del> server.listen(port, host, function () {
<add> server.listen(port, host, function() {
<ide> var client = net.createConnection(port, host);
<ide>
<del> client.setEncoding("utf8");
<add> client.setEncoding('utf8');
<ide>
<del> client.addListener("connect", function () {
<del> assert.equal("open", client.readyState);
<del> client.write("PING");
<add> client.addListener('connect', function() {
<add> assert.equal('open', client.readyState);
<add> client.write('PING');
<ide> });
<ide>
<del> client.addListener("data", function (data) {
<add> client.addListener('data', function(data) {
<ide> console.log(data);
<del> assert.equal("PONG", data);
<del> assert.equal("open", client.readyState);
<add> assert.equal('PONG', data);
<add> assert.equal('open', client.readyState);
<ide>
<del> setTimeout(function () {
<del> assert.equal("open", client.readyState);
<add> setTimeout(function() {
<add> assert.equal('open', client.readyState);
<ide> if (count++ < N) {
<del> client.write("PING");
<add> client.write('PING');
<ide> } else {
<del> console.log("closing client");
<add> console.log('closing client');
<ide> client.end();
<ide> client_ended = true;
<ide> }
<ide> }, DELAY);
<ide> });
<ide>
<del> client.addListener("timeout", function () {
<del> common.debug("client-side timeout!!");
<add> client.addListener('timeout', function() {
<add> common.debug('client-side timeout!!');
<ide> assert.equal(false, true);
<ide> });
<ide>
<del> client.addListener("close", function () {
<del> console.log("client.end");
<del> assert.equal(N+1, count);
<add> client.addListener('close', function() {
<add> console.log('client.end');
<add> assert.equal(N + 1, count);
<ide> assert.ok(client_ended);
<ide> if (on_complete) on_complete();
<ide> tests_run += 1;
<ide> function pingPongTest (port, host, on_complete) {
<ide>
<ide> pingPongTest(common.PORT);
<ide>
<del>process.addListener("exit", function () {
<add>process.addListener('exit', function() {
<ide> assert.equal(1, tests_run);
<ide> });
<ide><path>test/pummel/test-net-pingpong.js
<del>common = require("../common");
<del>assert = common.assert
<del>net = require("net");
<add>common = require('../common');
<add>assert = common.assert;
<add>net = require('net');
<ide>
<ide> var tests_run = 0;
<ide>
<del>function pingPongTest (port, host, on_complete) {
<add>function pingPongTest(port, host, on_complete) {
<ide> var N = 1000;
<ide> var count = 0;
<ide> var sent_final_ping = false;
<ide>
<del> var server = net.createServer({ allowHalfOpen: true }, function (socket) {
<add> var server = net.createServer({ allowHalfOpen: true }, function(socket) {
<ide> assert.equal(true, socket.remoteAddress !== null);
<ide> assert.equal(true, socket.remoteAddress !== undefined);
<del> if (host === "127.0.0.1" || host === "localhost" || !host) {
<del> assert.equal(socket.remoteAddress, "127.0.0.1");
<add> if (host === '127.0.0.1' || host === 'localhost' || !host) {
<add> assert.equal(socket.remoteAddress, '127.0.0.1');
<ide> } else {
<del> console.log('host = ' + host + ', remoteAddress = ' + socket.remoteAddress);
<del> assert.equal(socket.remoteAddress, "::1");
<add> console.log('host = ' + host +
<add> ', remoteAddress = ' + socket.remoteAddress);
<add> assert.equal(socket.remoteAddress, '::1');
<ide> }
<ide>
<del> socket.setEncoding("utf8");
<add> socket.setEncoding('utf8');
<ide> socket.setNoDelay();
<ide> socket.timeout = 0;
<ide>
<del> socket.addListener("data", function (data) {
<del> console.log("server got: " + JSON.stringify(data));
<del> assert.equal("open", socket.readyState);
<add> socket.addListener('data', function(data) {
<add> console.log('server got: ' + JSON.stringify(data));
<add> assert.equal('open', socket.readyState);
<ide> assert.equal(true, count <= N);
<ide> if (/PING/.exec(data)) {
<del> socket.write("PONG");
<add> socket.write('PONG');
<ide> }
<ide> });
<ide>
<del> socket.addListener("end", function () {
<del> assert.equal("writeOnly", socket.readyState);
<add> socket.addListener('end', function() {
<add> assert.equal('writeOnly', socket.readyState);
<ide> socket.end();
<ide> });
<ide>
<del> socket.addListener("close", function (had_error) {
<add> socket.addListener('close', function(had_error) {
<ide> assert.equal(false, had_error);
<del> assert.equal("closed", socket.readyState);
<add> assert.equal('closed', socket.readyState);
<ide> socket.server.close();
<ide> });
<ide> });
<ide>
<del> server.listen(port, host, function () {
<add> server.listen(port, host, function() {
<ide> var client = net.createConnection(port, host);
<ide>
<del> client.setEncoding("utf8");
<add> client.setEncoding('utf8');
<ide>
<del> client.addListener("connect", function () {
<del> assert.equal("open", client.readyState);
<del> client.write("PING");
<add> client.addListener('connect', function() {
<add> assert.equal('open', client.readyState);
<add> client.write('PING');
<ide> });
<ide>
<del> client.addListener("data", function (data) {
<add> client.addListener('data', function(data) {
<ide> console.log('client got: ' + data);
<ide>
<del> assert.equal("PONG", data);
<add> assert.equal('PONG', data);
<ide> count += 1;
<ide>
<ide> if (sent_final_ping) {
<del> assert.equal("readOnly", client.readyState);
<add> assert.equal('readOnly', client.readyState);
<ide> return;
<ide> } else {
<del> assert.equal("open", client.readyState);
<add> assert.equal('open', client.readyState);
<ide> }
<ide>
<ide> if (count < N) {
<del> client.write("PING");
<add> client.write('PING');
<ide> } else {
<ide> sent_final_ping = true;
<del> client.write("PING");
<add> client.write('PING');
<ide> client.end();
<ide> }
<ide> });
<ide>
<del> client.addListener("close", function () {
<del> assert.equal(N+1, count);
<add> client.addListener('close', function() {
<add> assert.equal(N + 1, count);
<ide> assert.equal(true, sent_final_ping);
<ide> if (on_complete) on_complete();
<ide> tests_run += 1;
<ide> function pingPongTest (port, host, on_complete) {
<ide> }
<ide>
<ide> /* All are run at once, so run on different ports */
<del>pingPongTest(common.PORT, "localhost");
<del>pingPongTest(common.PORT+1, null);
<add>pingPongTest(common.PORT, 'localhost');
<add>pingPongTest(common.PORT + 1, null);
<ide>
<ide> // This IPv6 isn't working on Solaris
<ide> var solaris = /sunos/i.test(process.platform);
<del>if (!solaris) pingPongTest(common.PORT+2, "::1");
<add>if (!solaris) pingPongTest(common.PORT + 2, '::1');
<ide>
<del>process.addListener("exit", function () {
<add>process.addListener('exit', function() {
<ide> assert.equal(solaris ? 2 : 3, tests_run);
<ide> });
<ide><path>test/pummel/test-net-throttle.js
<del>common = require("../common");
<del>assert = common.assert
<del>net = require("net");
<del>N = 160*1024; // 30kb
<add>common = require('../common');
<add>assert = common.assert;
<add>net = require('net');
<add>N = 160 * 1024; // 30kb
<ide>
<ide>
<ide> chars_recved = 0;
<ide> npauses = 0;
<ide>
<del>console.log("build big string");
<del>var body = "";
<add>console.log('build big string');
<add>var body = '';
<ide> for (var i = 0; i < N; i++) {
<del> body += "C";
<add> body += 'C';
<ide> }
<ide>
<del>console.log("start server on port " + common.PORT);
<add>console.log('start server on port ' + common.PORT);
<ide>
<del>server = net.createServer(function (connection) {
<del> connection.addListener("connect", function () {
<add>server = net.createServer(function(connection) {
<add> connection.addListener('connect', function() {
<ide> assert.equal(false, connection.write(body));
<ide> connection.end();
<ide> });
<ide> });
<del>server.listen(common.PORT, function () {
<add>server.listen(common.PORT, function() {
<ide> var paused = false;
<ide> client = net.createConnection(common.PORT);
<del> client.setEncoding("ascii");
<del> client.addListener("data", function (d) {
<add> client.setEncoding('ascii');
<add> client.addListener('data', function(d) {
<ide> chars_recved += d.length;
<del> console.log("got " + chars_recved);
<add> console.log('got ' + chars_recved);
<ide> if (!paused) {
<ide> client.pause();
<ide> npauses += 1;
<ide> paused = true;
<del> console.log("pause");
<add> console.log('pause');
<ide> x = chars_recved;
<del> setTimeout(function () {
<add> setTimeout(function() {
<ide> assert.equal(chars_recved, x);
<ide> client.resume();
<del> console.log("resume");
<add> console.log('resume');
<ide> paused = false;
<ide> }, 100);
<ide> }
<ide> });
<ide>
<del> client.addListener("end", function () {
<add> client.addListener('end', function() {
<ide> server.close();
<ide> client.end();
<ide> });
<ide> });
<ide>
<ide>
<ide>
<del>process.addListener("exit", function () {
<add>process.addListener('exit', function() {
<ide> assert.equal(N, chars_recved);
<ide> assert.equal(true, npauses > 2);
<ide> });
<ide><path>test/pummel/test-net-timeout.js
<del>common = require("../common");
<del>assert = common.assert
<del>net = require("net");
<add>common = require('../common');
<add>assert = common.assert;
<add>net = require('net');
<ide> exchanges = 0;
<ide> starttime = null;
<ide> timeouttime = null;
<ide> timeout = 1000;
<ide>
<del>var echo_server = net.createServer(function (socket) {
<add>var echo_server = net.createServer(function(socket) {
<ide> socket.setTimeout(timeout);
<ide>
<del> socket.addListener("timeout", function () {
<del> console.log("server timeout");
<add> socket.addListener('timeout', function() {
<add> console.log('server timeout');
<ide> timeouttime = new Date;
<ide> console.dir(timeouttime);
<ide> socket.destroy();
<ide> });
<ide>
<del> socket.addListener("error", function (e) {
<del> throw new Error("Server side socket should not get error. We disconnect willingly.");
<add> socket.addListener('error', function(e) {
<add> throw new Error('Server side socket should not get error. We disconnect willingly.');
<ide> })
<ide>
<del> socket.addListener("data", function (d) {
<add> socket.addListener('data', function(d) {
<ide> console.log(d);
<ide> socket.write(d);
<ide> });
<ide>
<del> socket.addListener("end", function () {
<add> socket.addListener('end', function() {
<ide> socket.end();
<ide> });
<ide> });
<ide>
<del>echo_server.listen(common.PORT, function () {
<del> console.log("server listening at " + common.PORT);
<add>echo_server.listen(common.PORT, function() {
<add> console.log('server listening at ' + common.PORT);
<ide>
<ide> var client = net.createConnection(common.PORT);
<del> client.setEncoding("UTF8");
<add> client.setEncoding('UTF8');
<ide> client.setTimeout(0); // disable the timeout for client
<del> client.addListener("connect", function () {
<del> console.log("client connected.");
<del> client.write("hello\r\n");
<add> client.addListener('connect', function() {
<add> console.log('client connected.');
<add> client.write('hello\r\n');
<ide> });
<ide>
<del> client.addListener("data", function (chunk) {
<del> assert.equal("hello\r\n", chunk);
<add> client.addListener('data', function(chunk) {
<add> assert.equal('hello\r\n', chunk);
<ide> if (exchanges++ < 5) {
<del> setTimeout(function () {
<del> console.log("client write 'hello'");
<del> client.write("hello\r\n");
<add> setTimeout(function() {
<add> console.log('client write "hello"');
<add> client.write('hello\r\n');
<ide> }, 500);
<ide>
<ide> if (exchanges == 5) {
<del> console.log("wait for timeout - should come in " + timeout + " ms");
<add> console.log('wait for timeout - should come in ' + timeout + ' ms');
<ide> starttime = new Date;
<ide> console.dir(starttime);
<ide> }
<ide> }
<ide> });
<ide>
<del> client.addListener("timeout", function () {
<add> client.addListener('timeout', function() {
<ide> throw new Error("client timeout - this shouldn't happen");
<ide> });
<ide>
<del> client.addListener("end", function () {
<del> console.log("client end");
<add> client.addListener('end', function() {
<add> console.log('client end');
<ide> client.end();
<ide> });
<ide>
<del> client.addListener("close", function () {
<del> console.log("client disconnect");
<add> client.addListener('close', function() {
<add> console.log('client disconnect');
<ide> echo_server.close();
<ide> });
<ide> });
<ide>
<del>process.addListener("exit", function () {
<add>process.addListener('exit', function() {
<ide> assert.ok(starttime != null);
<ide> assert.ok(timeouttime != null);
<ide>
<ide> diff = timeouttime - starttime;
<del> console.log("diff = " + diff);
<add> console.log('diff = ' + diff);
<ide>
<ide> assert.ok(timeout < diff);
<ide>
<ide><path>test/pummel/test-timers.js
<del>common = require("../common");
<add>common = require('../common');
<ide> assert = common.assert
<ide>
<ide> assert = require('assert');
<ide> clearInterval(null);
<ide>
<ide> assert.equal(true, setTimeout instanceof Function);
<ide> var starttime = new Date;
<del>setTimeout(function () {
<add>setTimeout(function() {
<ide> var endtime = new Date;
<ide>
<ide> var diff = endtime - starttime;
<ide> assert.ok(diff > 0);
<del> console.log("diff: " + diff);
<add> console.log('diff: ' + diff);
<ide>
<ide> assert.equal(true, 1000 - WINDOW < diff && diff < 1000 + WINDOW);
<ide> setTimeout_called = true;
<ide> }, 1000);
<ide>
<ide> // this timer shouldn't execute
<del>var id = setTimeout(function () { assert.equal(true, false); }, 500);
<add>var id = setTimeout(function() { assert.equal(true, false); }, 500);
<ide> clearTimeout(id);
<ide>
<del>setInterval(function () {
<add>setInterval(function() {
<ide> interval_count += 1;
<ide> var endtime = new Date;
<ide>
<ide> var diff = endtime - starttime;
<ide> assert.ok(diff > 0);
<del> console.log("diff: " + diff);
<add> console.log('diff: ' + diff);
<ide>
<ide> var t = interval_count * 1000;
<ide>
<ide> setInterval(function () {
<ide>
<ide> // Single param:
<ide> setTimeout(function(param){
<del> assert.equal("test param", param);
<del>}, 1000, "test param");
<add> assert.equal('test param', param);
<add>}, 1000, 'test param');
<ide>
<ide> var interval_count2 = 0;
<ide> setInterval(function(param){
<ide> ++interval_count2;
<del> assert.equal("test param", param);
<add> assert.equal('test param', param);
<ide>
<ide> if(interval_count2 == 3)
<ide> clearInterval(this);
<del>}, 1000, "test param");
<add>}, 1000, 'test param');
<ide>
<ide>
<ide> // Multiple param
<ide> setTimeout(function(param1, param2){
<del> assert.equal("param1", param1);
<del> assert.equal("param2", param2);
<del>}, 1000, "param1", "param2");
<add> assert.equal('param1', param1);
<add> assert.equal('param2', param2);
<add>}, 1000, 'param1', 'param2');
<ide>
<ide> var interval_count3 = 0;
<ide> setInterval(function(param1, param2){
<ide> ++interval_count3;
<del> assert.equal("param1", param1);
<del> assert.equal("param2", param2);
<add> assert.equal('param1', param1);
<add> assert.equal('param2', param2);
<ide>
<ide> if(interval_count3 == 3)
<ide> clearInterval(this);
<del>}, 1000, "param1", "param2");
<add>}, 1000, 'param1', 'param2');
<ide>
<ide> // setInterval(cb, 0) should be called multiple times.
<ide> count4 = 0;
<del>interval4 = setInterval(function () {
<add>interval4 = setInterval(function() {
<ide> if (++count4 > 10) clearInterval(interval4);
<ide> }, 0);
<ide>
<ide> z = setTimeout(t, 200);
<ide> clearTimeout(y);
<ide>
<ide>
<del>process.addListener("exit", function () {
<add>process.addListener('exit', function() {
<ide> assert.equal(true, setTimeout_called);
<ide> assert.equal(3, interval_count);
<ide> assert.equal(11, count4);
<del> assert.equal(0, expectedTimeouts, "clearTimeout cleared too many timeouts");
<add> assert.equal(0, expectedTimeouts, 'clearTimeout cleared too many timeouts');
<ide> });
<ide><path>test/pummel/test-watch-file.js
<del>common = require("../common");
<add>common = require('../common');
<ide> assert = common.assert
<ide>
<del>var fs = require("fs");
<del>var path = require("path");
<add>var fs = require('fs');
<add>var path = require('path');
<ide>
<del>var f = path.join(common.fixturesDir, "x.txt");
<del>var f2 = path.join(common.fixturesDir, "x2.txt");
<add>var f = path.join(common.fixturesDir, 'x.txt');
<add>var f2 = path.join(common.fixturesDir, 'x2.txt');
<ide>
<del>console.log("watching for changes of " + f);
<add>console.log('watching for changes of ' + f);
<ide>
<ide> var changes = 0;
<ide> function watchFile () {
<del> fs.watchFile(f, function (curr, prev) {
<del> console.log(f + " change");
<add> fs.watchFile(f, function(curr, prev) {
<add> console.log(f + ' change');
<ide> changes++;
<ide> assert.ok(curr.mtime != prev.mtime);
<ide> fs.unwatchFile(f);
<ide> function watchFile () {
<ide> watchFile();
<ide>
<ide>
<del>var fd = fs.openSync(f, "w+");
<add>var fd = fs.openSync(f, 'w+');
<ide> fs.writeSync(fd, 'xyz\n');
<ide> fs.closeSync(fd);
<ide>
<del>process.addListener("exit", function () {
<add>process.addListener('exit', function() {
<ide> assert.ok(changes > 0);
<ide> });
<ide><path>test/simple/test-next-tick-ordering.js
<del>common = require("../common");
<del>assert = common.assert
<add>common = require('../common');
<add>assert = common.assert;
<ide> var i;
<ide>
<ide> var N = 30;
<ide> var done = [];
<ide>
<ide> function get_printer(timeout) {
<del> return function () {
<del> console.log("Running from setTimeout " + timeout);
<add> return function() {
<add> console.log('Running from setTimeout ' + timeout);
<ide> done.push(timeout);
<ide> };
<ide> }
<ide>
<del>process.nextTick(function () {
<del> console.log("Running from nextTick");
<add>process.nextTick(function() {
<add> console.log('Running from nextTick');
<ide> done.push('nextTick');
<del>})
<add>});
<ide>
<ide> for (i = 0; i < N; i += 1) {
<ide> setTimeout(get_printer(i), i);
<ide> }
<ide>
<del>console.log("Running from main.");
<add>console.log('Running from main.');
<ide>
<ide>
<del>process.addListener('exit', function () {
<add>process.addListener('exit', function() {
<ide> assert.equal('nextTick', done[0]);
<ide> for (i = 0; i < N; i += 1) {
<del> assert.equal(i, done[i+1]);
<add> assert.equal(i, done[i + 1]);
<ide> }
<ide> });
<ide><path>test/simple/test-next-tick-ordering2.js
<del>common = require("../common");
<del>assert = common.assert
<add>common = require('../common');
<add>assert = common.assert;
<ide>
<ide> var order = [];
<del>process.nextTick(function () {
<add>process.nextTick(function() {
<ide> setTimeout(function() {
<ide> order.push('setTimeout');
<ide> }, 0);
<ide> process.nextTick(function () {
<ide> });
<ide> })
<ide>
<del>process.addListener('exit', function () {
<add>process.addListener('exit', function() {
<ide> assert.deepEqual(order, ['nextTick', 'setTimeout']);
<ide> });
<ide><path>test/simple/test-script-context.js
<del>common = require("../common");
<del>assert = common.assert
<add>common = require('../common');
<add>assert = common.assert;
<ide>
<ide> var Script = require('vm').Script;
<ide> var script = new Script('"passed";');
<ide><path>test/simple/test-script-static-context.js
<del>common = require("../common");
<del>assert = common.assert
<add>common = require('../common');
<add>assert = common.assert;
<ide>
<ide> var Script = require('vm').Script;
<ide>
<ide><path>test/simple/test-signal-unregister.js
<del>common = require("../common");
<del>assert = common.assert
<add>common = require('../common');
<add>assert = common.assert;
<ide>
<ide> var childKilled = false, done = false,
<ide> spawn = require('child_process').spawn,
<del> util = require("util"),
<add> util = require('util'),
<ide> child;
<ide>
<ide> var join = require('path').join;
<ide>
<ide> child = spawn(process.argv[0], [join(common.fixturesDir, 'should_exit.js')]);
<del>child.addListener('exit', function () {
<add>child.addListener('exit', function() {
<ide> if (!done) childKilled = true;
<ide> });
<ide>
<del>setTimeout(function () {
<del> console.log("Sending SIGINT");
<del> child.kill("SIGINT");
<del> setTimeout(function () {
<del> console.log("Chance has been given to die");
<add>setTimeout(function() {
<add> console.log('Sending SIGINT');
<add> child.kill('SIGINT');
<add> setTimeout(function() {
<add> console.log('Chance has been given to die');
<ide> done = true;
<ide> if (!childKilled) {
<ide> // Cleanup
<del> console.log("Child did not die on SIGINT, sending SIGTERM");
<del> child.kill("SIGTERM");
<add> console.log('Child did not die on SIGINT, sending SIGTERM');
<add> child.kill('SIGTERM');
<ide> }
<ide> }, 200);
<ide> }, 200);
<ide>
<del>process.addListener("exit", function () {
<add>process.addListener('exit', function() {
<ide> assert.ok(childKilled);
<ide> });
<ide><path>test/simple/test-string-decoder.js
<del>common = require("../common");
<del>assert = common.assert
<add>common = require('../common');
<add>assert = common.assert;
<ide>
<ide> Buffer = require('buffer').Buffer;
<ide> StringDecoder = require('string_decoder').StringDecoder;
<ide> assert.ok(s.length > 0);
<ide> // U+12E4 -> E1 8B A4
<ide> // U+0030 -> 30
<ide> // U+3045 -> E3 81 85
<del>expected = "\u02e4\u0064\u12e4\u0030\u3045";
<del>buffer = new Buffer([0xCB, 0xA4, 0x64, 0xE1, 0x8B, 0xA4, 0x30, 0xE3, 0x81, 0x85]);
<add>expected = '\u02e4\u0064\u12e4\u0030\u3045';
<add>buffer = new Buffer([0xCB, 0xA4, 0x64, 0xE1, 0x8B, 0xA4,
<add> 0x30, 0xE3, 0x81, 0x85]);
<ide> charLengths = [0, 0, 1, 2, 2, 2, 3, 4, 4, 4, 5, 5];
<ide>
<ide> // Split the buffer into 3 segments
<ide> for (var j = 2; j < buffer.length; j++) {
<ide> sum += decoder.write(buffer.slice(i, j));
<ide> sum += decoder.write(buffer.slice(j, buffer.length));
<ide> assert.equal(expected, sum);
<del> common.print(".");
<add> common.print('.');
<ide> }
<ide> }
<del>console.log(" crayon!");
<add>console.log(' crayon!');
<ide>
<ide><path>test/simple/test-sync-fileread.js
<del>common = require("../common");
<del>assert = common.assert
<add>common = require('../common');
<add>assert = common.assert;
<ide> var path = require('path');
<ide> var fs = require('fs');
<ide>
<del>var fixture = path.join(__dirname, "../fixtures/x.txt");
<add>var fixture = path.join(__dirname, '../fixtures/x.txt');
<ide>
<del>assert.equal("xyz\n", fs.readFileSync(fixture));
<add>assert.equal('xyz\n', fs.readFileSync(fixture));
<ide><path>test/simple/test-sys.js
<del>common = require("../common");
<del>assert = common.assert
<add>common = require('../common');
<add>assert = common.assert;
<ide>
<del>assert.equal("0", common.inspect(0));
<del>assert.equal("1", common.inspect(1));
<del>assert.equal("false", common.inspect(false));
<del>assert.equal("''", common.inspect(""));
<del>assert.equal("'hello'", common.inspect("hello"));
<del>assert.equal("[Function]", common.inspect(function() {}));
<add>assert.equal('0', common.inspect(0));
<add>assert.equal('1', common.inspect(1));
<add>assert.equal('false', common.inspect(false));
<add>assert.equal("''", common.inspect(''));
<add>assert.equal("'hello'", common.inspect('hello'));
<add>assert.equal('[Function]', common.inspect(function() {}));
<ide> assert.equal('undefined', common.inspect(undefined));
<ide> assert.equal('null', common.inspect(null));
<ide> assert.equal('/foo(bar\\n)?/gi', common.inspect(/foo(bar\n)?/gi));
<ide> assert.equal('Sun, 14 Feb 2010 11:48:40 GMT',
<del> common.inspect(new Date("Sun, 14 Feb 2010 11:48:40 GMT")));
<add> common.inspect(new Date('Sun, 14 Feb 2010 11:48:40 GMT')));
<ide>
<del>assert.equal("'\\n\\u0001'", common.inspect("\n\u0001"));
<add>assert.equal("'\\n\\u0001'", common.inspect('\n\u0001'));
<ide>
<ide> assert.equal('[]', common.inspect([]));
<ide> assert.equal('[]', common.inspect(Object.create([])));
<ide> assert.equal('{ a: [Function] }', common.inspect({a: function() {}}));
<ide> assert.equal('{ a: 1, b: 2 }', common.inspect({a: 1, b: 2}));
<ide> assert.equal('{ a: {} }', common.inspect({'a': {}}));
<ide> assert.equal('{ a: { b: 2 } }', common.inspect({'a': {'b': 2}}));
<del>assert.equal('{ a: { b: { c: [Object] } } }', common.inspect({'a': {'b': { 'c': { 'd': 2 }}}}));
<del>assert.equal('{ a: { b: { c: { d: 2 } } } }', common.inspect({'a': {'b': { 'c': { 'd': 2 }}}}, false, null));
<del>assert.equal('[ 1, 2, 3, [length]: 3 ]', common.inspect([1,2,3], true));
<del>assert.equal('{ a: [Object] }', common.inspect({'a': {'b': { 'c': 2}}},false,0));
<del>assert.equal('{ a: { b: [Object] } }', common.inspect({'a': {'b': { 'c': 2}}},false,1));
<del>assert.equal("{ visible: 1 }",
<del> common.inspect(Object.create({}, {visible:{value:1,enumerable:true},hidden:{value:2}}))
<add>assert.equal('{ a: { b: { c: [Object] } } }',
<add> common.inspect({'a': {'b': { 'c': { 'd': 2 }}}}));
<add>assert.equal('{ a: { b: { c: { d: 2 } } } }',
<add> common.inspect({'a': {'b': { 'c': { 'd': 2 }}}}, false, null));
<add>assert.equal('[ 1, 2, 3, [length]: 3 ]', common.inspect([1, 2, 3], true));
<add>assert.equal('{ a: [Object] }',
<add> common.inspect({'a': {'b': { 'c': 2}}}, false, 0));
<add>assert.equal('{ a: { b: [Object] } }',
<add> common.inspect({'a': {'b': { 'c': 2}}}, false, 1));
<add>assert.equal('{ visible: 1 }',
<add> common.inspect(Object.create({},
<add> {visible: {value: 1, enumerable: true}, hidden: {value: 2}}))
<ide> );
<del>assert.equal("{ [hidden]: 2, visible: 1 }",
<del> common.inspect(Object.create({}, {visible:{value:1,enumerable:true},hidden:{value:2}}), true)
<add>assert.equal('{ [hidden]: 2, visible: 1 }',
<add> common.inspect(Object.create({},
<add> {visible: {value: 1, enumerable: true}, hidden: {value: 2}}), true)
<ide> );
<ide>
<ide> // Objects without prototype
<del>assert.equal(
<del> "{ [hidden]: 'secret', name: 'Tim' }",
<del> common.inspect(Object.create(null, {name: {value: "Tim", enumerable: true}, hidden: {value: "secret"}}), true)
<add>assert.equal('{ [hidden]: \'secret\', name: \'Tim\' }',
<add> common.inspect(Object.create(null,
<add> {name: {value: 'Tim', enumerable: true},
<add> hidden: {value: 'secret'}}), true)
<ide> );
<del>assert.equal(
<del> "{ name: 'Tim' }",
<del> common.inspect(Object.create(null, {name: {value: "Tim", enumerable: true}, hidden: {value: "secret"}}))
<add>assert.equal('{ name: \'Tim\' }',
<add> common.inspect(Object.create(null,
<add> {name: {value: 'Tim', enumerable: true},
<add> hidden: {value: 'secret'}}))
<ide> );
<ide>
<ide>
<ide> // Dynamic properties
<del>assert.equal(
<del> "{ readonly: [Getter] }",
<del> common.inspect({get readonly(){}})
<del>);
<del>assert.equal(
<del> "{ readwrite: [Getter/Setter] }",
<del> common.inspect({get readwrite(){},set readwrite(val){}})
<del>);
<del>assert.equal(
<del> "{ writeonly: [Setter] }",
<del> common.inspect({set writeonly(val){}})
<del>);
<add>assert.equal('{ readonly: [Getter] }',
<add> common.inspect({get readonly() {}}));
<add>
<add>assert.equal('{ readwrite: [Getter/Setter] }',
<add> common.inspect({get readwrite() {},set readwrite(val) {}}));
<add>
<add>assert.equal('{ writeonly: [Setter] }',
<add> common.inspect({set writeonly(val) {}}));
<ide>
<ide> var value = {};
<ide> value['a'] = value;
<ide> assert.equal('{ a: [Circular] }', common.inspect(value));
<ide> value = Object.create([]);
<ide> value.push(1);
<del>assert.equal("[ 1, length: 1 ]", common.inspect(value));
<add>assert.equal('[ 1, length: 1 ]', common.inspect(value));
<ide>
<ide> // Array with dynamic properties
<del>value = [1,2,3];
<del>value.__defineGetter__('growingLength', function () { this.push(true); return this.length; });
<del>assert.equal(
<del> "[ 1, 2, 3, growingLength: [Getter] ]",
<del> common.inspect(value)
<del>);
<add>value = [1, 2, 3];
<add>value.__defineGetter__('growingLength', function() {
<add> this.push(true); return this.length;
<add>});
<add>assert.equal('[ 1, 2, 3, growingLength: [Getter] ]', common.inspect(value));
<ide>
<ide> // Function with properties
<del>value = function () {};
<add>value = function() {};
<ide> value.aprop = 42;
<del>assert.equal(
<del> "{ [Function] aprop: 42 }",
<del> common.inspect(value)
<del>);
<add>assert.equal('{ [Function] aprop: 42 }', common.inspect(value));
<ide>
<ide> // Regular expressions with properties
<ide> value = /123/ig;
<ide> value.aprop = 42;
<del>assert.equal(
<del> "{ /123/gi aprop: 42 }",
<del> common.inspect(value)
<del>);
<add>assert.equal('{ /123/gi aprop: 42 }', common.inspect(value));
<ide>
<ide> // Dates with properties
<del>value = new Date("Sun, 14 Feb 2010 11:48:40 GMT");
<add>value = new Date('Sun, 14 Feb 2010 11:48:40 GMT');
<ide> value.aprop = 42;
<del>assert.equal(
<del> "{ Sun, 14 Feb 2010 11:48:40 GMT aprop: 42 }",
<del> common.inspect(value)
<add>assert.equal('{ Sun, 14 Feb 2010 11:48:40 GMT aprop: 42 }',
<add> common.inspect(value)
<ide> );
<ide><path>test/simple/test-umask.js
<del>common = require("../common");
<del>assert = common.assert
<add>common = require('../common');
<add>assert = common.assert;
<ide>
<ide> var mask = 0664;
<ide> var old = process.umask(mask);
<ide><path>test/simple/test-url.js
<del>common = require("../common");
<del>assert = common.assert
<add>common = require('../common');
<add>assert = common.assert;
<ide>
<del>var url = require("url"),
<del> util = require("util");
<add>var url = require('url'),
<add> util = require('util');
<ide>
<ide> // URLs to parse, and expected data
<ide> // { url : parsed }
<ide><path>test/simple/test-utf8-scripts.js
<del>common = require("../common");
<del>assert = common.assert
<add>common = require('../common');
<add>assert = common.assert;
<ide>
<ide> // üäö
<ide>
<del>console.log("Σὲ γνωρίζω ἀπὸ τὴν κόψη");
<add>console.log('Σὲ γνωρίζω ἀπὸ τὴν κόψη');
<ide>
<del>assert.equal(true, /Hellö Wörld/.test("Hellö Wörld") );
<add>assert.equal(true, /Hellö Wörld/.test('Hellö Wörld'));
<ide>
<ide><path>test/simple/test-zerolengthbufferbug.js
<ide> // Serving up a zero-length buffer should work.
<ide>
<del>var common = require("../common");
<add>var common = require('../common');
<ide> var assert = common.assert;
<ide> var http = require('http');
<ide>
<del>var server = http.createServer(function (req, res) {
<add>var server = http.createServer(function(req, res) {
<ide> var buffer = new Buffer(0);
<add> // FIXME: WTF gjslint want this?
<ide> res.writeHead(200, {'Content-Type': 'text/html',
<del> 'Content-Length': buffer.length});
<add> 'Content-Length': buffer.length});
<ide> res.end(buffer);
<ide> });
<ide>
<ide> var gotResponse = false;
<ide> var resBodySize = 0;
<ide>
<del>server.listen(common.PORT, function () {
<add>server.listen(common.PORT, function() {
<ide> var client = http.createClient(common.PORT);
<del>
<add>
<ide> var req = client.request('GET', '/');
<ide> req.end();
<ide>
<del> req.on('response', function (res) {
<add> req.on('response', function(res) {
<ide> gotResponse = true;
<ide>
<del> res.on('data', function (d) {
<add> res.on('data', function(d) {
<ide> resBodySize += d.length;
<ide> });
<ide>
<del> res.on('end', function (d) {
<add> res.on('end', function(d) {
<ide> server.close();
<ide> });
<ide> });
<ide> });
<ide>
<del>process.on('exit', function () {
<add>process.on('exit', function() {
<ide> assert.ok(gotResponse);
<ide> assert.equal(0, resBodySize);
<ide> });
| 50
|
Python
|
Python
|
fix pypy tests
|
4eabd379dfba17d738887ff64c03fc4ee3ad380f
|
<ide><path>celery/tests/bin/test_celeryd.py
<ide> def start(self):
<ide> class Worker(cd.Worker):
<ide> WorkController = _WorkController
<ide>
<add> def __init__(self, *args, **kwargs):
<add> super(Worker, self).__init__(*args, **kwargs)
<add> self.redirect_stdouts = False
<add>
<ide>
<ide> class test_Worker(AppCase):
<add>
<ide> Worker = Worker
<ide>
<ide> def teardown(self):
<ide> def on_logging_setup(**kwargs):
<ide> @disable_stdouts
<ide> def test_platform_tweaks_osx(self):
<ide>
<del> class OSXWorker(self.Worker):
<add> class OSXWorker(Worker):
<ide> proxy_workaround_installed = False
<ide>
<ide> def osx_proxy_detection_workaround(self):
<ide> self.proxy_workaround_installed = True
<ide>
<del> worker = OSXWorker()
<add> worker = OSXWorker(redirect_stdouts=False)
<ide>
<ide> def install_HUP_nosupport(controller):
<ide> controller.hup_not_supported_installed = True
<ide> def on_worker_ready(**kwargs):
<ide> self.Worker().on_consumer_ready(object())
<ide> self.assertTrue(worker_ready_sent[0])
<ide>
<del>
<ide> class test_funs(AppCase):
<ide>
<ide> def test_active_thread_count(self):
| 1
|
Ruby
|
Ruby
|
kill special ssl3 support
|
dfbc2df09fc46c239fa099ef18507a498379c820
|
<ide><path>Library/Homebrew/download_strategy.rb
<ide> def _fetch
<ide> end
<ide> end
<ide>
<del># Download from an SSL3-only host.
<del>class CurlSSL3DownloadStrategy < CurlDownloadStrategy
<del> def _curl_opts
<del> super << '-3'
<del> end
<del>end
<add># @deprecated
<add>CurlSSL3DownloadStrategy = CurlDownloadStrategy
<ide>
<ide> # Use this strategy to download but not unzip a file.
<ide> # Useful for installing jars.
| 1
|
Javascript
|
Javascript
|
fix lint error
|
a46517f8ff4d5c925ef6672501b5a89186666825
|
<ide><path>lib/JavascriptParser.js
<ide> class JavascriptParser {
<ide> comments = source.comments;
<ide> } else {
<ide> comments = [];
<del> ast = Parser.parse(source, {
<add> ast = JavascriptParser.parse(source, {
<ide> sourceType: this.sourceType,
<ide> onComment: comments
<ide> });
<ide> class JavascriptParser {
<ide> }
<ide>
<ide> evaluate(source) {
<del> const ast = Parser.parse("(" + source + ")", {
<add> const ast = JavascriptParser.parse("(" + source + ")", {
<ide> sourceType: this.sourceType,
<ide> locations: false
<ide> });
<ide><path>lib/dependencies/CommonJsRequireDependencyParserPlugin.js
<ide> const RequireHeaderDependency = require("./RequireHeaderDependency");
<ide> const LocalModuleDependency = require("./LocalModuleDependency");
<ide> const ContextDependencyHelpers = require("./ContextDependencyHelpers");
<ide> const LocalModulesHelpers = require("./LocalModulesHelpers");
<del>const { toConstantDependencyWithWebpackRequire } = require("../JavascriptParserHelpers");
<add>const {
<add> toConstantDependencyWithWebpackRequire
<add>} = require("../JavascriptParserHelpers");
<ide>
<ide> class CommonJsRequireDependencyParserPlugin {
<ide> constructor(options) {
<ide><path>lib/dependencies/RequireEnsurePlugin.js
<ide> const NullFactory = require("../NullFactory");
<ide>
<ide> const RequireEnsureDependenciesBlockParserPlugin = require("./RequireEnsureDependenciesBlockParserPlugin");
<ide>
<del>const { evaluateToString, toConstantDependency } = require("../JavascriptParserHelpers");
<add>const {
<add> evaluateToString,
<add> toConstantDependency
<add>} = require("../JavascriptParserHelpers");
<ide>
<ide> class RequireEnsurePlugin {
<ide> apply(compiler) {
<ide><path>lib/dependencies/RequireIncludePlugin.js
<ide> const RequireIncludeDependency = require("./RequireIncludeDependency");
<ide> const RequireIncludeDependencyParserPlugin = require("./RequireIncludeDependencyParserPlugin");
<ide>
<del>const { evaluateToString, toConstantDependency } = require("../JavascriptParserHelpers");
<add>const {
<add> evaluateToString,
<add> toConstantDependency
<add>} = require("../JavascriptParserHelpers");
<ide>
<ide> class RequireIncludePlugin {
<ide> apply(compiler) {
| 4
|
Python
|
Python
|
check authentication after checking modelresource
|
b236241982b95a35cdb251e5020004050fb6567a
|
<ide><path>djangorestframework/permissions.py
<ide> def check_permission(self, user):
<ide> if self.view.request.method in ('GET', 'OPTIONS', 'HEAD',):
<ide> return
<ide>
<del> # User must be logged in to check permissions.
<del> if not hasattr(self.view.request, 'user') or not self.view.request.user.is_authenticated():
<del> raise _403_FORBIDDEN_RESPONSE
<del>
<ide> klass = self.view.resource.model
<ide>
<ide> # If it doesn't look like a model, we can't check permissions.
<ide> if not klass or not getattr(klass, '_meta', None):
<ide> return
<ide>
<add> # User must be logged in to check permissions.
<add> if not hasattr(self.view.request, 'user') or not self.view.request.user.is_authenticated():
<add> raise _403_FORBIDDEN_RESPONSE
<add>
<ide> permission_map = {
<ide> 'POST': ['%s.add_%s'],
<ide> 'PUT': ['%s.change_%s'],
| 1
|
Ruby
|
Ruby
|
add tests for patches.rb
|
975459a75cc371d97ec381ed3ffa2aa2733d9f1f
|
<ide><path>Library/Homebrew/test/test_patches.rb
<add>require 'testing_env'
<add>
<add>require 'extend/ARGV' # needs to be after test/unit to avoid conflict with OptionsParser
<add>ARGV.extend(HomebrewArgvExtension)
<add>
<add>require 'test/testball'
<add>require 'utils'
<add>require 'set'
<add>
<add># Expose some internals
<add>class Patches
<add> attr_reader :patches
<add>end
<add>
<add>class Patch
<add> attr_reader :patch_p
<add> attr_reader :patch_filename
<add>end
<add>
<add>
<add>class PatchingTests < Test::Unit::TestCase
<add> def test_patchSingleString
<add> patches = Patches.new("http://example.com/patch.diff")
<add> assert_equal 1, patches.patches.length
<add> p = patches.patches[0]
<add> assert_equal :p1, p.patch_p
<add> end
<add>
<add> def test_patchArray
<add> patches = Patches.new(["http://example.com/patch1.diff", "http://example.com/patch2.diff"])
<add> assert_equal 2, patches.patches.length
<add>
<add> p1 = patches.patches[0]
<add> assert_equal :p1, p1.patch_p
<add>
<add> p2 = patches.patches[0]
<add> assert_equal :p1, p2.patch_p
<add> end
<add>
<add> def test_p0_hash_to_string
<add> patches = Patches.new({
<add> :p0 => "http://example.com/patch.diff"
<add> })
<add> assert_equal 1, patches.patches.length
<add>
<add> p = patches.patches[0]
<add> assert_equal :p0, p.patch_p
<add> end
<add>
<add> def test_p1_hash_to_string
<add> patches = Patches.new({
<add> :p1 => "http://example.com/patch.diff"
<add> })
<add> assert_equal 1, patches.patches.length
<add>
<add> p = patches.patches[0]
<add> assert_equal :p1, p.patch_p
<add> end
<add>
<add> def test_mixed_hash_to_strings
<add> expected = {
<add> :p1 => "http://example.com/patch1.diff",
<add> :p0 => "http://example.com/patch0.diff"
<add> }
<add> patches = Patches.new(expected)
<add> assert_equal 2, patches.patches.length
<add>
<add> # Make sure unique filenames were assigned
<add> filenames = Set.new
<add> patches.each do |p|
<add> filenames << p.patch_filename
<add> end
<add>
<add> assert_equal 2, filenames.size
<add> end
<add>
<add> def test_mixed_hash_to_arrays
<add> expected = {
<add> :p1 => ["http://example.com/patch10.diff","http://example.com/patch11.diff"],
<add> :p0 => ["http://example.com/patch00.diff","http://example.com/patch01.diff"]
<add> }
<add> patches = Patches.new(expected)
<add> assert_equal 4, patches.patches.length
<add>
<add> # Make sure unique filenames were assigned
<add> filenames = Set.new
<add> patches.each do |p|
<add> filenames << p.patch_filename
<add> end
<add>
<add> assert_equal 4, filenames.size
<add> end
<add>end
| 1
|
Text
|
Text
|
rewrote the entrypoint section in builder
|
b2ba1a9ce5709ee6f143b79bd543f95a4aa03c14
|
<ide><path>docs/sources/reference/builder.md
<ide> The copy obeys the following rules:
<ide> ENTRYPOINT has two forms:
<ide>
<ide> - `ENTRYPOINT ["executable", "param1", "param2"]`
<del> (like an *exec*, preferred form)
<add> (like an *exec*, the preferred form)
<ide> - `ENTRYPOINT command param1 param2`
<ide> (as a *shell*)
<ide>
<del>There can only be one `ENTRYPOINT` in a Dockerfile. If you have more than one
<del>`ENTRYPOINT`, then only the last one in the Dockerfile will have an effect.
<add>There can only be one `ENTRYPOINT` in a `Dockerfile`. If you have more
<add>than one `ENTRYPOINT`, then only the last one in the `Dockerfile` will
<add>have an effect.
<ide>
<del>An `ENTRYPOINT` helps you to configure a container that you can run as an
<del>executable. That is, when you specify an `ENTRYPOINT`, then the whole container
<del>runs as if it was just that executable.
<add>An `ENTRYPOINT` helps you to configure a container that you can run as
<add>an executable. That is, when you specify an `ENTRYPOINT`, then the whole
<add>container runs as if it was just that executable.
<ide>
<del>The `ENTRYPOINT` instruction adds an entry command that will **not** be
<del>overwritten when arguments are passed to `docker run`, unlike the behavior
<del>of `CMD`. This allows arguments to be passed to the entrypoint. i.e.
<del>`docker run <image> -d` will pass the "-d" argument to the ENTRYPOINT.
<add>Unlike the behavior of the `CMD` instruction, The `ENTRYPOINT`
<add>instruction adds an entry command that will **not** be overwritten when
<add>arguments are passed to `docker run`. This allows arguments to be passed
<add>to the entry point, i.e. `docker run <image> -d` will pass the `-d`
<add>argument to the entry point.
<ide>
<del>You can specify parameters either in the ENTRYPOINT JSON array (as in
<del>"like an exec" above), or by using a CMD statement. Parameters in the
<del>ENTRYPOINT will not be overridden by the `docker run`
<del>arguments, but parameters specified via CMD will be overridden
<del>by `docker run` arguments.
<add>You can specify parameters either in the `ENTRYPOINT` JSON array (as in
<add>"like an exec" above), or by using a `CMD` instruction. Parameters in
<add>the `ENTRYPOINT` instruction will not be overridden by the `docker run`
<add>arguments, but parameters specified via a `CMD` instruction will be
<add>overridden by `docker run` arguments.
<ide>
<del>Like a `CMD`, you can specify a plain string for the `ENTRYPOINT` and it will
<del>execute in `/bin/sh -c`:
<add>Like a `CMD`, you can specify a plain string for the `ENTRYPOINT` and it
<add>will execute in `/bin/sh -c`:
<ide>
<ide> FROM ubuntu
<del> ENTRYPOINT wc -l -
<add> ENTRYPOINT ls -l
<ide>
<del>For example, that Dockerfile's image will *always* take STDIN as input
<del>("-") and print the number of lines ("-l"). If you wanted to make this
<del>optional but default, you could use a CMD:
<add>For example, that `Dockerfile`'s image will *always* take a directory as
<add>an input and return a directory listing. If you wanted to make this
<add>optional but default, you could use a `CMD` instruction:
<ide>
<ide> FROM ubuntu
<del> CMD ["-l", "-"]
<del> ENTRYPOINT ["/usr/bin/wc"]
<add> CMD ["-l"]
<add> ENTRYPOINT ["/usr/bin/ls"]
<add>
<add>> **Note**:
<add>> It is preferable to use the JSON array format for specifying
<add>> `ENTRYPOINT` instructions.
<ide>
<ide> ## VOLUME
<ide>
| 1
|
Javascript
|
Javascript
|
add 2fa otp code to npm dist-tag command too
|
8f45a685be1c2f2205684a301cfd23833ee9a478
|
<ide><path>scripts/release/publish-commands/publish-to-npm.js
<ide> const push = async ({cwd, dry, otp, packages, version, tag}) => {
<ide> // Update the @next tag to also point to it (so @next doesn't lag behind).
<ide> if (!isPrerelease) {
<ide> await execUnlessDry(
<del> `npm dist-tag add ${project}@${packageVersion} next`,
<add> `npm dist-tag add ${project}@${packageVersion} next ${twoFactorAuth}`,
<ide> {cwd: path, dry}
<ide> );
<ide> }
| 1
|
PHP
|
PHP
|
add tests for aliased behavior methods
|
be2d45635d46d0707f90df95d9992eb71705cc0e
|
<ide><path>Cake/Test/TestCase/ORM/TableTest.php
<ide> public function testCallBehaviorMethod() {
<ide> $this->assertEquals('some_value', $table->slugify('some value'));
<ide> }
<ide>
<add>/**
<add> * Test you can alias a behavior method
<add> *
<add> * @return void
<add> */
<add> public function testCallBehaviorAliasedMethod() {
<add> $table = TableRegistry::get('article');
<add> $table->addBehavior('Sluggable', ['implementedMethods' => ['wednesday' => 'slugify']]);
<add> $this->assertEquals('some_value', $table->wednesday('some value'));
<add> }
<add>
<ide> /**
<ide> * Test finder methods from behaviors.
<ide> *
<ide> public function testCallBehaviorFinder() {
<ide> $this->assertNotEmpty($query->clause('where'));
<ide> }
<ide>
<add>/**
<add> * testCallBehaviorAliasedFinder
<add> *
<add> * @return void
<add> */
<add> public function testCallBehaviorAliasedFinder() {
<add> $table = TableRegistry::get('article');
<add> $table->addBehavior('Sluggable', ['implementedFinders' => ['special' => 'findNoSlug']]);
<add>
<add> $query = $table->special();
<add> $this->assertInstanceOf('Cake\ORM\Query', $query);
<add> $this->assertNotEmpty($query->clause('where'));
<add>
<add> $query = $table->find('special');
<add> $this->assertInstanceOf('Cake\ORM\Query', $query);
<add> $this->assertNotEmpty($query->clause('where'));
<add> }
<add>
<ide> /**
<ide> * Tests that it is possible to insert a new row using the save method
<ide> *
| 1
|
Go
|
Go
|
add an op func to override client.scheme
|
be2f7ce3ca8a559b1996dcc91cdc4d1035a9cdcd
|
<ide><path>client/client.go
<ide> func WithHTTPHeaders(headers map[string]string) func(*Client) error {
<ide> }
<ide> }
<ide>
<add>// WithScheme overrides the client scheme with the specified one
<add>func WithScheme(scheme string) func(*Client) error {
<add> return func(c *Client) error {
<add> c.scheme = scheme
<add> return nil
<add> }
<add>}
<add>
<ide> // NewClientWithOpts initializes a new API client with default values. It takes functors
<ide> // to modify values when creating it, like `NewClientWithOpts(WithVersion(…))`
<ide> // It also initializes the custom http headers to add to each request.
<ide> func NewClientWithOpts(ops ...func(*Client) error) (*Client, error) {
<ide> c := &Client{
<ide> host: DefaultDockerHost,
<ide> version: api.DefaultVersion,
<del> scheme: "http",
<ide> client: client,
<ide> proto: defaultProto,
<ide> addr: defaultAddr,
<ide> func NewClientWithOpts(ops ...func(*Client) error) (*Client, error) {
<ide> if _, ok := c.client.Transport.(http.RoundTripper); !ok {
<ide> return nil, fmt.Errorf("unable to verify TLS configuration, invalid transport %v", c.client.Transport)
<ide> }
<del> tlsConfig := resolveTLSConfig(c.client.Transport)
<del> if tlsConfig != nil {
<del> // TODO(stevvooe): This isn't really the right way to write clients in Go.
<del> // `NewClient` should probably only take an `*http.Client` and work from there.
<del> // Unfortunately, the model of having a host-ish/url-thingy as the connection
<del> // string has us confusing protocol and transport layers. We continue doing
<del> // this to avoid breaking existing clients but this should be addressed.
<del> c.scheme = "https"
<add> if c.scheme == "" {
<add> c.scheme = "http"
<add>
<add> tlsConfig := resolveTLSConfig(c.client.Transport)
<add> if tlsConfig != nil {
<add> // TODO(stevvooe): This isn't really the right way to write clients in Go.
<add> // `NewClient` should probably only take an `*http.Client` and work from there.
<add> // Unfortunately, the model of having a host-ish/url-thingy as the connection
<add> // string has us confusing protocol and transport layers. We continue doing
<add> // this to avoid breaking existing clients but this should be addressed.
<add> c.scheme = "https"
<add> }
<ide> }
<ide>
<ide> return c, nil
| 1
|
Java
|
Java
|
improve javadoc for databasepopulator
|
fb312d0ed5d55752df5755be29833023e5a21258
|
<ide><path>spring-jdbc/src/main/java/org/springframework/jdbc/datasource/init/DatabasePopulator.java
<ide> /*
<del> * Copyright 2002-2016 the original author or authors.
<add> * Copyright 2002-2022 the original author or authors.
<ide> *
<ide> * Licensed under the Apache License, Version 2.0 (the "License");
<ide> * you may not use this file except in compliance with the License.
<ide> public interface DatabasePopulator {
<ide> /**
<ide> * Populate, initialize, or clean up the database using the provided JDBC
<ide> * connection.
<add> * <p><strong>Warning</strong>: Concrete implementations should not close
<add> * the provided {@link Connection}.
<ide> * <p>Concrete implementations <em>may</em> throw an {@link SQLException} if
<ide> * an error is encountered but are <em>strongly encouraged</em> to throw a
<ide> * specific {@link ScriptException} instead. For example, Spring's
<ide> * {@link ResourceDatabasePopulator} and {@link DatabasePopulatorUtils} wrap
<ide> * all {@code SQLExceptions} in {@code ScriptExceptions}.
<del> * @param connection the JDBC connection to use to populate the db; already
<del> * configured and ready to use; never {@code null}
<add> * @param connection the JDBC connection to use; already configured and
<add> * ready to use; never {@code null}
<ide> * @throws SQLException if an unrecoverable data access exception occurs
<del> * during database population
<add> * while interacting with the database
<ide> * @throws ScriptException in all other error cases
<ide> * @see DatabasePopulatorUtils#execute
<ide> */
| 1
|
Text
|
Text
|
add missing underscore for markdown italics
|
eb12f93b79ea76d5d34a635772ec9d2e44703544
|
<ide><path>doc/topics/the-event-loop-timers-and-nexttick.md
<ide> through its queue of callbacks executing them synchronously until
<ide> either the queue has been exhausted, or the system-dependent hard limit
<ide> is reached.
<ide>
<del>* _If the `poll` queue is **empty**, one of two more things will
<add>* _If the `poll` queue **is empty**_, one of two more things will
<ide> happen:
<ide> * If scripts have been scheduled by `setImmediate()`, the event loop
<ide> will end the `poll` phase and continue to the `check` phase to
| 1
|
Javascript
|
Javascript
|
fix $flowfixmes from tabbarios
|
cf8dc89ee84d8602305b4e3b7d777dc288ae61cf
|
<ide><path>Libraries/Components/TabBarIOS/TabBarIOS.ios.js
<ide> const ViewPropTypes = require('ViewPropTypes');
<ide>
<ide> var requireNativeComponent = require('requireNativeComponent');
<ide>
<del>class TabBarIOS extends React.Component<{
<del> style?: $FlowFixMe,
<del> unselectedTintColor?: $FlowFixMe,
<del> tintColor?: $FlowFixMe,
<del> unselectedItemTintColor?: $FlowFixMe,
<del> barTintColor?: $FlowFixMe,
<add>import type {StyleObj} from 'StyleSheetTypes';
<add>import type {ViewProps} from 'ViewPropTypes';
<add>
<add>class TabBarIOS extends React.Component<ViewProps & {
<add> style?: StyleObj,
<add> unselectedTintColor?: string,
<add> tintColor?: string,
<add> unselectedItemTintColor?: string,
<add> barTintColor?: string,
<ide> barStyle?: 'default' | 'black',
<ide> translucent?: boolean,
<ide> itemPositioning?: 'fill' | 'center' | 'auto',
<add> children: React.Node,
<ide> }> {
<ide> static Item = TabBarItemIOS;
<ide>
<del> // $FlowFixMe(>=0.41.0)
<ide> static propTypes = {
<ide> ...ViewPropTypes,
<ide> style: ViewPropTypes.style,
<ide> class TabBarIOS extends React.Component<{
<ide> barStyle={this.props.barStyle}
<ide> itemPositioning={this.props.itemPositioning}
<ide> translucent={this.props.translucent !== false}>
<del> {
<del> // $FlowFixMe found when converting React.createClass to ES6
<del> this.props.children}
<add> {this.props.children}
<ide> </RCTTabBar>
<ide> );
<ide> }
| 1
|
Text
|
Text
|
add iife example to jsx documentation
|
9a2e5f2cc5386219f629da3cce6b01aa84bb3158
|
<ide><path>docs/tips/03-if-else-in-JSX.md
<ide> That's not valid JS. You probably want to make use of a ternary expression:
<ide> React.render(<div id={condition ? 'msg' : ''}>Hello World!</div>, mountNode);
<ide> ```
<ide>
<del>If a ternary expression isn't robust enough, you can use `if` statements to determine which
<del>components should be used.
<add>If a ternary expression isn't robust enough, you can use `if` statements outside of your JSX to determine which components should be used:
<ide>
<ide> ```js
<ide> var loginButton;
<ide> return (
<ide> <Home />
<ide> {loginButton}
<ide> </nav>
<del>)
<add>);
<ide> ```
<ide>
<add>Or if you prefer a more "inline" aesthetic, define [immediately-invoked function expressions](https://en.wikipedia.org/wiki/Immediately-invoked_function_expression) _inside_ your JSX:
<add>
<add>```js
<add>return (
<add> <section>
<add> <h1>Color</h1>
<add> <h3>Name</h3>
<add> <p>{this.state.color || "white"}</p>
<add> <h3>Hex</h3>
<add> <p>
<add> {() => {
<add> switch (this.state.color) {
<add> case "red": return "#FF0000";
<add> case "green": return "#00FF00";
<add> case "blue": return "#0000FF";
<add> default: return "#FFFFFF";
<add> }
<add> }()}
<add> </p>
<add> </section>
<add>);
<add>```
<add>
<add>> Note:
<add>>
<add>> In the example above, an ES6 [arrow function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions) is utilized to lexically bind the value of `this`.
<add>
<ide> Try using it today with the [JSX compiler](/react/jsx-compiler.html).
| 1
|
Javascript
|
Javascript
|
update chrome to v34
|
6708feffdbe055e8b89737ea51f5c23376899e91
|
<ide><path>protractor-travis-conf.js
<ide> config.multiCapabilities = [{
<ide> 'browserName': 'chrome',
<ide> 'name': 'Angular E2E',
<ide> 'tunnel-identifier': process.env.TRAVIS_JOB_NUMBER,
<del> 'build': process.env.TRAVIS_BUILD_NUMBER
<add> 'build': process.env.TRAVIS_BUILD_NUMBER,
<add> 'version': '34'
<ide> }, {
<ide> 'browserName': 'firefox',
<ide> 'name': 'Angular E2E',
| 1
|
PHP
|
PHP
|
update wincache tests
|
3a11f979c825f7370bee43e4c7a9d92f0c47ccdf
|
<ide><path>lib/Cake/Cache/Engine/WincacheEngine.php
<ide> <?php
<ide> /**
<del> * Wincache storage engine for cache.
<del> *
<del> * Supports wincache 1.1.0 and higher.
<del> *
<del> * PHP 5
<del> *
<ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
<ide> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
<ide> *
<ide> *
<ide> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
<ide> * @link http://cakephp.org CakePHP(tm) Project
<del> * @package Cake.Cache.Engine
<del> * @since CakePHP(tm) v 1.2.0.4933
<add> * @since CakePHP(tm) v 2.0.0
<ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
<ide> */
<ide> namespace Cake\Cache\Engine;
<add>
<ide> use Cake\Cache\CacheEngine;
<ide>
<ide> /**
<ide> * Wincache storage engine for cache
<ide> *
<add> * Supports wincache 1.1.0 and higher.
<add> *
<ide> * @package Cake.Cache.Engine
<ide> */
<ide> class WincacheEngine extends CacheEngine {
<ide><path>lib/Cake/Test/TestCase/Cache/Engine/WincacheEngineTest.php
<ide> <?php
<ide> /**
<del> * WincacheEngineTest file
<del> *
<del> * PHP 5
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<add> * CakePHP(tm) <http://book.cakephp.org/2.0/en/development/testing.html>
<ide> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
<ide> *
<ide> * Licensed under The MIT License
<ide> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
<ide> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<ide> * @package Cake.Test.Case.Cache.Engine
<del> * @since CakePHP(tm) v 1.2.0.5434
<add> * @since CakePHP(tm) v 2.0.0
<ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
<ide> */
<ide> namespace Cake\Test\TestCase\Cache\Engine;
<ide> class WincacheEngineTest extends TestCase {
<ide> public function setUp() {
<ide> parent::setUp();
<ide> $this->skipIf(!function_exists('wincache_ucache_set'), 'Wincache is not installed or configured properly.');
<del> $this->_cacheDisable = Configure::read('Cache.disable');
<ide> Configure::write('Cache.disable', false);
<del> Cache::config('wincache', array('engine' => 'Wincache', 'prefix' => 'cake_'));
<add> Configure::write('Cache.wincache', ['engine' => 'Wincache', 'prefix' => 'cake_']);
<ide> }
<ide>
<ide> /**
<ide> public function setUp() {
<ide> */
<ide> public function tearDown() {
<ide> parent::tearDown();
<del> Configure::write('Cache.disable', $this->_cacheDisable);
<ide> Cache::drop('wincache');
<ide> Cache::drop('wincache_groups');
<del> Cache::config('default');
<ide> }
<ide>
<ide> /**
<ide> public function tearDown() {
<ide> * @return void
<ide> */
<ide> public function testReadAndWriteCache() {
<del> Cache::set(array('duration' => 1), 'wincache');
<add> Cache::set(['duration' => 1], 'wincache');
<ide>
<ide> $result = Cache::read('test', 'wincache');
<ide> $expecting = '';
<ide> public function testReadAndWriteCache() {
<ide> * @return void
<ide> */
<ide> public function testExpiry() {
<del> Cache::set(array('duration' => 1), 'wincache');
<add> Cache::set(['duration' => 1], 'wincache');
<ide>
<ide> $result = Cache::read('test', 'wincache');
<ide> $this->assertFalse($result);
<ide> public function testExpiry() {
<ide> $result = Cache::read('other_test', 'wincache');
<ide> $this->assertFalse($result);
<ide>
<del> Cache::set(array('duration' => 1), 'wincache');
<add> Cache::set(['duration' => 1], 'wincache');
<ide>
<ide> $data = 'this is a test of the emergency broadcasting system';
<ide> $result = Cache::write('other_test', $data, 'wincache');
<ide> public function testClear() {
<ide> * @return void
<ide> */
<ide> public function testGroupsReadWrite() {
<del> Cache::config('wincache_groups', array(
<add> Configure::write('Cache.wincache_groups', [
<ide> 'engine' => 'Wincache',
<ide> 'duration' => 0,
<del> 'groups' => array('group_a', 'group_b'),
<add> 'groups' => ['group_a', 'group_b'],
<ide> 'prefix' => 'test_'
<del> ));
<add> ]);
<ide> $this->assertTrue(Cache::write('test_groups', 'value', 'wincache_groups'));
<ide> $this->assertEquals('value', Cache::read('test_groups', 'wincache_groups'));
<ide>
<ide> public function testGroupsReadWrite() {
<ide> * @return void
<ide> */
<ide> public function testGroupDelete() {
<del> Cache::config('wincache_groups', array(
<add> Configure::write('Cache.wincache_groups', [
<ide> 'engine' => 'Wincache',
<ide> 'duration' => 0,
<del> 'groups' => array('group_a', 'group_b'),
<add> 'groups' => ['group_a', 'group_b'],
<ide> 'prefix' => 'test_'
<del> ));
<add> ]);
<ide> $this->assertTrue(Cache::write('test_groups', 'value', 'wincache_groups'));
<ide> $this->assertEquals('value', Cache::read('test_groups', 'wincache_groups'));
<ide> $this->assertTrue(Cache::delete('test_groups', 'wincache_groups'));
<ide> public function testGroupDelete() {
<ide> * @return void
<ide> **/
<ide> public function testGroupClear() {
<del> Cache::config('wincache_groups', array(
<add> Configure::write('Cache.wincache_groups', [
<ide> 'engine' => 'Wincache',
<ide> 'duration' => 0,
<del> 'groups' => array('group_a', 'group_b'),
<add> 'groups' => ['group_a', 'group_b'],
<ide> 'prefix' => 'test_'
<del> ));
<add> ]);
<ide>
<ide> $this->assertTrue(Cache::write('test_groups', 'value', 'wincache_groups'));
<ide> $this->assertTrue(Cache::clearGroup('group_a', 'wincache_groups'));
| 2
|
Go
|
Go
|
keep track of used device ids in a bitmap
|
4d39e056aac2fadffcb8560101f3c31a2b7db3ae
|
<ide><path>daemon/graphdriver/devmapper/deviceset.go
<ide> var (
<ide> DefaultDataLoopbackSize int64 = 100 * 1024 * 1024 * 1024
<ide> DefaultMetaDataLoopbackSize int64 = 2 * 1024 * 1024 * 1024
<ide> DefaultBaseFsSize uint64 = 10 * 1024 * 1024 * 1024
<del> DefaultThinpBlockSize uint32 = 128 // 64K = 128 512b sectors
<add> DefaultThinpBlockSize uint32 = 128 // 64K = 128 512b sectors
<add> MaxDeviceId int = 0xffffff // 24 bit, pool limit
<add> DeviceIdMapSz int = (MaxDeviceId + 1) / 8
<ide> )
<ide>
<ide> const deviceSetMetaFile string = "deviceset-metadata"
<ide> type DeviceSet struct {
<ide> devicePrefix string
<ide> TransactionId uint64 `json:"-"`
<ide> NextDeviceId int `json:"next_device_id"`
<add> deviceIdMap []byte
<ide>
<ide> // Options
<ide> dataLoopbackSize int64
<ide> func (devices *DeviceSet) saveMetadata(info *DevInfo) error {
<ide> return nil
<ide> }
<ide>
<add>func (devices *DeviceSet) markDeviceIdUsed(deviceId int) {
<add> var mask byte
<add> i := deviceId % 8
<add> mask = 1 << uint(i)
<add> devices.deviceIdMap[deviceId/8] = devices.deviceIdMap[deviceId/8] | mask
<add>}
<add>
<add>func (devices *DeviceSet) markDeviceIdFree(deviceId int) {
<add> var mask byte
<add> i := deviceId % 8
<add> mask = ^(1 << uint(i))
<add> devices.deviceIdMap[deviceId/8] = devices.deviceIdMap[deviceId/8] & mask
<add>}
<add>
<add>func (devices *DeviceSet) isDeviceIdFree(deviceId int) bool {
<add> var mask byte
<add> i := deviceId % 8
<add> mask = (1 << uint(i))
<add> if (devices.deviceIdMap[deviceId/8] & mask) != 0 {
<add> return false
<add> }
<add> return true
<add>}
<add>
<ide> func (devices *DeviceSet) lookupDevice(hash string) (*DevInfo, error) {
<ide> devices.devicesLock.Lock()
<ide> defer devices.devicesLock.Unlock()
<ide> func (devices *DeviceSet) initMetaData() error {
<ide>
<ide> func (devices *DeviceSet) incNextDeviceId() {
<ide> // Ids are 24bit, so wrap around
<del> devices.NextDeviceId = (devices.NextDeviceId + 1) & 0xffffff
<add> devices.NextDeviceId = (devices.NextDeviceId + 1) & MaxDeviceId
<ide> }
<ide>
<ide> func (devices *DeviceSet) createDevice(deviceId *int) error {
<ide> func NewDeviceSet(root string, doInit bool, options []string) (*DeviceSet, error
<ide> filesystem: "ext4",
<ide> doBlkDiscard: true,
<ide> thinpBlockSize: DefaultThinpBlockSize,
<add> deviceIdMap: make([]byte, DeviceIdMapSz),
<ide> }
<ide>
<ide> foundBlkDiscard := false
| 1
|
Text
|
Text
|
update error handling instruction in $.get
|
c6e4efc268f6b2efb5009418da2350fe6fa1a6c3
|
<ide><path>guide/english/jquery/jquery-ajax-get-method/index.md
<ide> $.get('http://example.com/resource.json', {category:'client', type:'premium'}, f
<ide> $("#mypar").html(response.amount);
<ide> });
<ide> ```
<add>However, `$.get` doesn't provide any way to handle error.
<ide>
<del>The above example can also be written as:
<add>The above example (with error handling) can also be written as:
<ide> ```javascript
<ide> $.get('http://example.com/resource.json', {category:'client', type:'premium'})
<ide> .done(function(response) {
<ide> alert("success");
<ide> $("#mypar").html(response.amount);
<add> })
<add> .fail(function(error) {
<add> alert("error");
<add> $("#mypar").html(error.statusText);
<ide> });
<ide> ```
<ide>
| 1
|
Text
|
Text
|
fix indentation issues in sample code
|
8969c1b76209e83f3fc3cb00a41421f7996e399b
|
<ide><path>doc/api/crypto.md
<ide> const aliceSecret = alice.computeSecret(bobKey);
<ide> const bobSecret = bob.computeSecret(aliceKey);
<ide>
<ide> assert.strictEqual(aliceSecret.toString('hex'), bobSecret.toString('hex'));
<del> // OK
<add>// OK
<ide> ```
<ide>
<ide> ### ecdh.computeSecret(otherPublicKey[, inputEncoding][, outputEncoding])
<ide> const hash = crypto.createHash('sha256');
<ide>
<ide> hash.on('readable', () => {
<ide> const data = hash.read();
<del> if (data)
<add> if (data) {
<ide> console.log(data.toString('hex'));
<ide> // Prints:
<ide> // 6a2da20943931e9834fc12cfe5bb47bbd9ae43489a30726962b576f4e3993e50
<add> }
<ide> });
<ide>
<ide> hash.write('some data to hash');
<ide> const hmac = crypto.createHmac('sha256', 'a secret');
<ide>
<ide> hmac.on('readable', () => {
<ide> const data = hmac.read();
<del> if (data)
<add> if (data) {
<ide> console.log(data.toString('hex'));
<ide> // Prints:
<ide> // 7fd04df92f636fd450bc841c9418e5825c17f33ad9c87c518115a45971f7f77e
<add> }
<ide> });
<ide>
<ide> hmac.write('some data to hash');
<ide><path>doc/api/errors.md
<ide> function makeFaster() {
<ide> });
<ide> }
<ide>
<del>makeFaster(); // will throw:
<del> // /home/gbusey/file.js:6
<del> // throw new Error('oh no!');
<del> // ^
<del> // Error: oh no!
<del> // at speedy (/home/gbusey/file.js:6:11)
<del> // at makeFaster (/home/gbusey/file.js:5:3)
<del> // at Object.<anonymous> (/home/gbusey/file.js:10:1)
<del> // at Module._compile (module.js:456:26)
<del> // at Object.Module._extensions..js (module.js:474:10)
<del> // at Module.load (module.js:356:32)
<del> // at Function.Module._load (module.js:312:12)
<del> // at Function.Module.runMain (module.js:497:10)
<del> // at startup (node.js:119:16)
<del> // at node.js:906:3
<add>makeFaster();
<add>// will throw:
<add>// /home/gbusey/file.js:6
<add>// throw new Error('oh no!');
<add>// ^
<add>// Error: oh no!
<add>// at speedy (/home/gbusey/file.js:6:11)
<add>// at makeFaster (/home/gbusey/file.js:5:3)
<add>// at Object.<anonymous> (/home/gbusey/file.js:10:1)
<add>// at Module._compile (module.js:456:26)
<add>// at Object.Module._extensions..js (module.js:474:10)
<add>// at Module.load (module.js:356:32)
<add>// at Function.Module._load (module.js:312:12)
<add>// at Function.Module.runMain (module.js:497:10)
<add>// at startup (node.js:119:16)
<add>// at node.js:906:3
<ide> ```
<ide>
<ide> The location information will be one of:
<ide> For example:
<ide>
<ide> ```js
<ide> require('net').connect(-1);
<del> // throws "RangeError: "port" option should be >= 0 and < 65536: -1"
<add>// throws "RangeError: "port" option should be >= 0 and < 65536: -1"
<ide> ```
<ide>
<ide> Node.js will generate and throw `RangeError` instances *immediately* as a form
<ide> will do so.
<ide>
<ide> ```js
<ide> doesNotExist;
<del> // throws ReferenceError, doesNotExist is not a variable in this program.
<add>// throws ReferenceError, doesNotExist is not a variable in this program.
<ide> ```
<ide>
<ide> Unless an application is dynamically generating and running code,
<ide> string would be considered a TypeError.
<ide>
<ide> ```js
<ide> require('url').parse(() => { });
<del> // throws TypeError, since it expected a string
<add>// throws TypeError, since it expected a string
<ide> ```
<ide>
<ide> Node.js will generate and throw `TypeError` instances *immediately* as a form
<ide> const urlSearchParams = new URLSearchParams('foo=bar&baz=new');
<ide>
<ide> const buf = Buffer.alloc(1);
<ide> urlSearchParams.has.call(buf, 'foo');
<del> // Throws a TypeError with code 'ERR_INVALID_THIS'
<add>// Throws a TypeError with code 'ERR_INVALID_THIS'
<ide> ```
<ide>
<ide> <a id="ERR_INVALID_TUPLE"></a>
<ide><path>doc/api/fs.md
<ide> support. If `filename` is provided, it will be provided as a `Buffer` if
<ide> ```js
<ide> // Example when handled through fs.watch listener
<ide> fs.watch('./tmp', { encoding: 'buffer' }, (eventType, filename) => {
<del> if (filename)
<add> if (filename) {
<ide> console.log(filename);
<ide> // Prints: <Buffer ...>
<add> }
<ide> });
<ide> ```
<ide>
<ide><path>doc/api/net.md
<ide> double-backslashes, such as:
<ide>
<ide> ```js
<ide> net.createServer().listen(
<del> path.join('\\\\?\\pipe', process.cwd(), 'myctl'));
<add> path.join('\\\\?\\pipe', process.cwd(), 'myctl'));
<ide> ```
<ide>
<ide> ## Class: net.Server
<ide><path>doc/api/querystring.md
<ide> in the following example:
<ide> // Assuming gbkDecodeURIComponent function already exists...
<ide>
<ide> querystring.parse('w=%D6%D0%CE%C4&foo=bar', null, null,
<del> { decodeURIComponent: gbkDecodeURIComponent });
<add> { decodeURIComponent: gbkDecodeURIComponent });
<ide> ```
<ide>
<ide> ## querystring.stringify(obj[, sep[, eq[, options]]])
<ide> following example:
<ide> // Assuming gbkEncodeURIComponent function already exists,
<ide>
<ide> querystring.stringify({ w: '中文', foo: 'bar' }, null, null,
<del> { encodeURIComponent: gbkEncodeURIComponent });
<add> { encodeURIComponent: gbkEncodeURIComponent });
<ide> ```
<ide>
<ide> ## querystring.unescape(str)
<ide><path>doc/api/url.md
<ide> Creates a new `URL` object by parsing the `input` relative to the `base`. If
<ide> ```js
<ide> const { URL } = require('url');
<ide> const myURL = new URL('/foo', 'https://example.org/');
<del> // https://example.org/foo
<add>// https://example.org/foo
<ide> ```
<ide>
<ide> A `TypeError` will be thrown if the `input` or `base` are not valid URLs. Note
<ide> instance:
<ide> ```js
<ide> const { URL } = require('url');
<ide> const myURL = new URL({ toString: () => 'https://example.org/' });
<del> // https://example.org/
<add>// https://example.org/
<ide> ```
<ide>
<ide> Unicode characters appearing within the hostname of `input` will be
<ide> automatically converted to ASCII using the [Punycode][] algorithm.
<ide> ```js
<ide> const { URL } = require('url');
<ide> const myURL = new URL('https://你好你好');
<del> // https://xn--6qqa088eba/
<add>// https://xn--6qqa088eba/
<ide> ```
<ide>
<ide> Additional [examples of parsed URLs][] may be found in the WHATWG URL Standard.
<ide> Gets and sets the fragment portion of the URL.
<ide> const { URL } = require('url');
<ide> const myURL = new URL('https://example.org/foo#bar');
<ide> console.log(myURL.hash);
<del> // Prints #bar
<add>// Prints #bar
<ide>
<ide> myURL.hash = 'baz';
<ide> console.log(myURL.href);
<del> // Prints https://example.org/foo#baz
<add>// Prints https://example.org/foo#baz
<ide> ```
<ide>
<ide> Invalid URL characters included in the value assigned to the `hash` property
<ide> Gets and sets the host portion of the URL.
<ide> const { URL } = require('url');
<ide> const myURL = new URL('https://example.org:81/foo');
<ide> console.log(myURL.host);
<del> // Prints example.org:81
<add>// Prints example.org:81
<ide>
<ide> myURL.host = 'example.com:82';
<ide> console.log(myURL.href);
<del> // Prints https://example.com:82/foo
<add>// Prints https://example.com:82/foo
<ide> ```
<ide>
<ide> Invalid host values assigned to the `host` property are ignored.
<ide> port.
<ide> const { URL } = require('url');
<ide> const myURL = new URL('https://example.org:81/foo');
<ide> console.log(myURL.hostname);
<del> // Prints example.org
<add>// Prints example.org
<ide>
<ide> myURL.hostname = 'example.com:82';
<ide> console.log(myURL.href);
<del> // Prints https://example.com:81/foo
<add>// Prints https://example.com:81/foo
<ide> ```
<ide>
<ide> Invalid hostname values assigned to the `hostname` property are ignored.
<ide> Gets and sets the serialized URL.
<ide> const { URL } = require('url');
<ide> const myURL = new URL('https://example.org/foo');
<ide> console.log(myURL.href);
<del> // Prints https://example.org/foo
<add>// Prints https://example.org/foo
<ide>
<ide> myURL.href = 'https://example.com/bar';
<ide> console.log(myURL.href);
<del> // Prints https://example.com/bar
<add>// Prints https://example.com/bar
<ide> ```
<ide>
<ide> Getting the value of the `href` property is equivalent to calling
<ide> encoding.
<ide> const { URL } = require('url');
<ide> const myURL = new URL('https://example.org/foo/bar?baz');
<ide> console.log(myURL.origin);
<del> // Prints https://example.org
<add>// Prints https://example.org
<ide> ```
<ide>
<ide> ```js
<ide> const { URL } = require('url');
<ide> const idnURL = new URL('https://你好你好');
<ide> console.log(idnURL.origin);
<del> // Prints https://你好你好
<add>// Prints https://你好你好
<ide>
<ide> console.log(idnURL.hostname);
<del> // Prints xn--6qqa088eba
<add>// Prints xn--6qqa088eba
<ide> ```
<ide>
<ide> #### url.password
<ide> Gets and sets the password portion of the URL.
<ide> const { URL } = require('url');
<ide> const myURL = new URL('https://abc:xyz@example.com');
<ide> console.log(myURL.password);
<del> // Prints xyz
<add>// Prints xyz
<ide>
<ide> myURL.password = '123';
<ide> console.log(myURL.href);
<del> // Prints https://abc:123@example.com
<add>// Prints https://abc:123@example.com
<ide> ```
<ide>
<ide> Invalid URL characters included in the value assigned to the `password` property
<ide> Gets and sets the path portion of the URL.
<ide> const { URL } = require('url');
<ide> const myURL = new URL('https://example.org/abc/xyz?123');
<ide> console.log(myURL.pathname);
<del> // Prints /abc/xyz
<add>// Prints /abc/xyz
<ide>
<ide> myURL.pathname = '/abcdef';
<ide> console.log(myURL.href);
<del> // Prints https://example.org/abcdef?123
<add>// Prints https://example.org/abcdef?123
<ide> ```
<ide>
<ide> Invalid URL characters included in the value assigned to the `pathname`
<ide> Gets and sets the port portion of the URL.
<ide> const { URL } = require('url');
<ide> const myURL = new URL('https://example.org:8888');
<ide> console.log(myURL.port);
<del> // Prints 8888
<add>// Prints 8888
<ide>
<ide> // Default ports are automatically transformed to the empty string
<ide> // (HTTPS protocol's default port is 443)
<ide> myURL.port = '443';
<ide> console.log(myURL.port);
<del> // Prints the empty string
<add>// Prints the empty string
<ide> console.log(myURL.href);
<del> // Prints https://example.org/
<add>// Prints https://example.org/
<ide>
<ide> myURL.port = 1234;
<ide> console.log(myURL.port);
<del> // Prints 1234
<add>// Prints 1234
<ide> console.log(myURL.href);
<del> // Prints https://example.org:1234/
<add>// Prints https://example.org:1234/
<ide>
<ide> // Completely invalid port strings are ignored
<ide> myURL.port = 'abcd';
<ide> console.log(myURL.port);
<del> // Prints 1234
<add>// Prints 1234
<ide>
<ide> // Leading numbers are treated as a port number
<ide> myURL.port = '5678abcd';
<ide> console.log(myURL.port);
<del> // Prints 5678
<add>// Prints 5678
<ide>
<ide> // Non-integers are truncated
<ide> myURL.port = 1234.5678;
<ide> console.log(myURL.port);
<del> // Prints 1234
<add>// Prints 1234
<ide>
<ide> // Out-of-range numbers are ignored
<ide> myURL.port = 1e10;
<ide> console.log(myURL.port);
<del> // Prints 1234
<add>// Prints 1234
<ide> ```
<ide>
<ide> The port value may be set as either a number or as a String containing a number
<ide> Gets and sets the protocol portion of the URL.
<ide> const { URL } = require('url');
<ide> const myURL = new URL('https://example.org');
<ide> console.log(myURL.protocol);
<del> // Prints https:
<add>// Prints https:
<ide>
<ide> myURL.protocol = 'ftp';
<ide> console.log(myURL.href);
<del> // Prints ftp://example.org/
<add>// Prints ftp://example.org/
<ide> ```
<ide>
<ide> Invalid URL protocol values assigned to the `protocol` property are ignored.
<ide> Gets and sets the serialized query portion of the URL.
<ide> const { URL } = require('url');
<ide> const myURL = new URL('https://example.org/abc?123');
<ide> console.log(myURL.search);
<del> // Prints ?123
<add>// Prints ?123
<ide>
<ide> myURL.search = 'abc=xyz';
<ide> console.log(myURL.href);
<del> // Prints https://example.org/abc?abc=xyz
<add>// Prints https://example.org/abc?abc=xyz
<ide> ```
<ide>
<ide> Any invalid URL characters appearing in the value assigned the `search`
<ide> Gets and sets the username portion of the URL.
<ide> const { URL } = require('url');
<ide> const myURL = new URL('https://abc:xyz@example.com');
<ide> console.log(myURL.username);
<del> // Prints abc
<add>// Prints abc
<ide>
<ide> myURL.username = '123';
<ide> console.log(myURL.href);
<del> // Prints https://123:xyz@example.com/
<add>// Prints https://123:xyz@example.com/
<ide> ```
<ide>
<ide> Any invalid URL characters appearing in the value assigned the `username`
<ide> const myURLs = [
<ide> new URL('https://test.example.org')
<ide> ];
<ide> console.log(JSON.stringify(myURLs));
<del> // Prints ["https://www.example.com/","https://test.example.org/"]
<add>// Prints ["https://www.example.com/","https://test.example.org/"]
<ide> ```
<ide>
<ide> ### Class: URLSearchParams
<ide> const { URL, URLSearchParams } = require('url');
<ide>
<ide> const myURL = new URL('https://example.org/?abc=123');
<ide> console.log(myURL.searchParams.get('abc'));
<del> // Prints 123
<add>// Prints 123
<ide>
<ide> myURL.searchParams.append('abc', 'xyz');
<ide> console.log(myURL.href);
<del> // Prints https://example.org/?abc=123&abc=xyz
<add>// Prints https://example.org/?abc=123&abc=xyz
<ide>
<ide> myURL.searchParams.delete('abc');
<ide> myURL.searchParams.set('a', 'b');
<ide> console.log(myURL.href);
<del> // Prints https://example.org/?a=b
<add>// Prints https://example.org/?a=b
<ide>
<ide> const newSearchParams = new URLSearchParams(myURL.searchParams);
<ide> // The above is equivalent to
<ide> // const newSearchParams = new URLSearchParams(myURL.search);
<ide>
<ide> newSearchParams.append('a', 'c');
<ide> console.log(myURL.href);
<del> // Prints https://example.org/?a=b
<add>// Prints https://example.org/?a=b
<ide> console.log(newSearchParams.toString());
<del> // Prints a=b&a=c
<add>// Prints a=b&a=c
<ide>
<ide> // newSearchParams.toString() is implicitly called
<ide> myURL.search = newSearchParams;
<ide> console.log(myURL.href);
<del> // Prints https://example.org/?a=b&a=c
<add>// Prints https://example.org/?a=b&a=c
<ide> newSearchParams.delete('a');
<ide> console.log(myURL.href);
<del> // Prints https://example.org/?a=b&a=c
<add>// Prints https://example.org/?a=b&a=c
<ide> ```
<ide>
<ide> #### Constructor: new URLSearchParams()
<ide> let params;
<ide>
<ide> params = new URLSearchParams('user=abc&query=xyz');
<ide> console.log(params.get('user'));
<del> // Prints 'abc'
<add>// Prints 'abc'
<ide> console.log(params.toString());
<del> // Prints 'user=abc&query=xyz'
<add>// Prints 'user=abc&query=xyz'
<ide>
<ide> params = new URLSearchParams('?user=abc&query=xyz');
<ide> console.log(params.toString());
<del> // Prints 'user=abc&query=xyz'
<add>// Prints 'user=abc&query=xyz'
<ide> ```
<ide>
<ide> #### Constructor: new URLSearchParams(obj)
<ide> const params = new URLSearchParams({
<ide> query: ['first', 'second']
<ide> });
<ide> console.log(params.getAll('query'));
<del> // Prints [ 'first,second' ]
<add>// Prints [ 'first,second' ]
<ide> console.log(params.toString());
<del> // Prints 'user=abc&query=first%2Csecond'
<add>// Prints 'user=abc&query=first%2Csecond'
<ide> ```
<ide>
<ide> #### Constructor: new URLSearchParams(iterable)
<ide> params = new URLSearchParams([
<ide> ['query', 'second']
<ide> ]);
<ide> console.log(params.toString());
<del> // Prints 'user=abc&query=first&query=second'
<add>// Prints 'user=abc&query=first&query=second'
<ide>
<ide> // Using a Map object
<ide> const map = new Map();
<ide> map.set('user', 'abc');
<ide> map.set('query', 'xyz');
<ide> params = new URLSearchParams(map);
<ide> console.log(params.toString());
<del> // Prints 'user=abc&query=xyz'
<add>// Prints 'user=abc&query=xyz'
<ide>
<ide> // Using a generator function
<ide> function* getQueryPairs() {
<ide> function* getQueryPairs() {
<ide> }
<ide> params = new URLSearchParams(getQueryPairs());
<ide> console.log(params.toString());
<del> // Prints 'user=abc&query=first&query=second'
<add>// Prints 'user=abc&query=first&query=second'
<ide>
<ide> // Each key-value pair must have exactly two elements
<ide> new URLSearchParams([
<ide> ['user', 'abc', 'error']
<ide> ]);
<del> // Throws TypeError [ERR_INVALID_TUPLE]:
<del> // Each query pair must be an iterable [name, value] tuple
<add>// Throws TypeError [ERR_INVALID_TUPLE]:
<add>// Each query pair must be an iterable [name, value] tuple
<ide> ```
<ide>
<ide> #### urlSearchParams.append(name, value)
<ide> const myURL = new URL('https://example.org/?a=b&c=d');
<ide> myURL.searchParams.forEach((value, name, searchParams) => {
<ide> console.log(name, value, myURL.searchParams === searchParams);
<ide> });
<del> // Prints:
<del> // a b true
<del> // c d true
<add>// Prints:
<add>// a b true
<add>// c d true
<ide> ```
<ide>
<ide> #### urlSearchParams.get(name)
<ide> const params = new URLSearchParams('foo=bar&foo=baz');
<ide> for (const name of params.keys()) {
<ide> console.log(name);
<ide> }
<del> // Prints:
<del> // foo
<del> // foo
<add>// Prints:
<add>// foo
<add>// foo
<ide> ```
<ide>
<ide> #### urlSearchParams.set(name, value)
<ide> params.append('foo', 'bar');
<ide> params.append('foo', 'baz');
<ide> params.append('abc', 'def');
<ide> console.log(params.toString());
<del> // Prints foo=bar&foo=baz&abc=def
<add>// Prints foo=bar&foo=baz&abc=def
<ide>
<ide> params.set('foo', 'def');
<ide> params.set('xyz', 'opq');
<ide> console.log(params.toString());
<del> // Prints foo=def&abc=def&xyz=opq
<add>// Prints foo=def&abc=def&xyz=opq
<ide> ```
<ide>
<ide> #### urlSearchParams.sort()
<ide> const { URLSearchParams } = require('url');
<ide> const params = new URLSearchParams('query[]=abc&type=search&query[]=123');
<ide> params.sort();
<ide> console.log(params.toString());
<del> // Prints query%5B%5D=abc&query%5B%5D=123&type=search
<add>// Prints query%5B%5D=abc&query%5B%5D=123&type=search
<ide> ```
<ide>
<ide> #### urlSearchParams.toString()
<ide> const params = new URLSearchParams('foo=bar&xyz=baz');
<ide> for (const [name, value] of params) {
<ide> console.log(name, value);
<ide> }
<del> // Prints:
<del> // foo bar
<del> // xyz baz
<add>// Prints:
<add>// foo bar
<add>// xyz baz
<ide> ```
<ide>
<ide> ### url.domainToASCII(domain)
<ide> It performs the inverse operation to [`url.domainToUnicode()`][].
<ide> ```js
<ide> const url = require('url');
<ide> console.log(url.domainToASCII('español.com'));
<del> // Prints xn--espaol-zwa.com
<add>// Prints xn--espaol-zwa.com
<ide> console.log(url.domainToASCII('中文.com'));
<del> // Prints xn--fiq228c.com
<add>// Prints xn--fiq228c.com
<ide> console.log(url.domainToASCII('xn--iñvalid.com'));
<del> // Prints an empty string
<add>// Prints an empty string
<ide> ```
<ide>
<ide> ### url.domainToUnicode(domain)
<ide> It performs the inverse operation to [`url.domainToASCII()`][].
<ide> ```js
<ide> const url = require('url');
<ide> console.log(url.domainToUnicode('xn--espaol-zwa.com'));
<del> // Prints español.com
<add>// Prints español.com
<ide> console.log(url.domainToUnicode('xn--fiq228c.com'));
<del> // Prints 中文.com
<add>// Prints 中文.com
<ide> console.log(url.domainToUnicode('xn--iñvalid.com'));
<del> // Prints an empty string
<add>// Prints an empty string
<ide> ```
<ide>
<ide> ### url.format(URL[, options])
<ide> const { URL } = require('url');
<ide> const myURL = new URL('https://a:b@你好你好?abc#foo');
<ide>
<ide> console.log(myURL.href);
<del> // Prints https://a:b@xn--6qqa088eba/?abc#foo
<add>// Prints https://a:b@xn--6qqa088eba/?abc#foo
<ide>
<ide> console.log(myURL.toString());
<del> // Prints https://a:b@xn--6qqa088eba/?abc#foo
<add>// Prints https://a:b@xn--6qqa088eba/?abc#foo
<ide>
<ide> console.log(url.format(myURL, { fragment: false, unicode: true, auth: false }));
<del> // Prints 'https://你好你好/?abc'
<add>// Prints 'https://你好你好/?abc'
<ide> ```
<ide>
<ide> ## Legacy URL API
<ide> using the [Punycode][] algorithm. Note, however, that a hostname *may* contain
<ide> const { URL } = require('url');
<ide> const myURL = new URL('https://%CF%80.com/foo');
<ide> console.log(myURL.href);
<del> // Prints https://xn--1xa.com/foo
<add>// Prints https://xn--1xa.com/foo
<ide> console.log(myURL.origin);
<del> // Prints https://π.com
<add>// Prints https://π.com
<ide> ```
<ide>
<ide> [`Error`]: errors.html#errors_class_error
<ide><path>doc/api/util.md
<ide> doSomething[util.promisify.custom] = function(foo) {
<ide>
<ide> const promisified = util.promisify(doSomething);
<ide> console.log(promisified === doSomething[util.promisify.custom]);
<del> // prints 'true'
<add>// prints 'true'
<ide> ```
<ide>
<ide> This can be useful for cases where the original function does not follow the
<ide><path>doc/guides/writing-tests.md
<ide> Let's analyze this basic test from the Node.js test suite:
<ide> ```javascript
<ide> 'use strict'; // 1
<ide> const common = require('../common'); // 2
<del> // 3
<add>
<ide> // This test ensures that the http-parser can handle UTF-8 characters // 4
<ide> // in the http header. // 5
<del> // 6
<add>
<ide> const assert = require('assert'); // 7
<ide> const http = require('http'); // 8
<del> // 9
<add>
<ide> const server = http.createServer(common.mustCall((req, res) => { // 10
<ide> res.end('ok'); // 11
<ide> })); // 12
| 8
|
Text
|
Text
|
add stackoverflow links
|
0ccc4530776cc18ecfa7a84b8bd6cd02c0c2f092
|
<ide><path>README.md
<ide> For further details, consult the [wiki](https://github.com/ReactiveX/RxJava/wiki
<ide> - Google Group: [RxJava](http://groups.google.com/d/forum/rxjava)
<ide> - Twitter: [@RxJava](http://twitter.com/RxJava)
<ide> - [GitHub Issues](https://github.com/ReactiveX/RxJava/issues)
<add>- StackOverflow: [rx-java](http://stackoverflow.com/questions/tagged/rx-java) and [rx-java2](http://stackoverflow.com/questions/tagged/rx-java2)
<ide>
<ide> ## Versioning
<ide>
| 1
|
Python
|
Python
|
use all() for subtask checks in canvas tests
|
89d50f5a34e3c9a16f6fd2cace4ac0dc214493dc
|
<ide><path>t/unit/tasks/test_canvas.py
<ide> def test_from_dict_no_tasks(self):
<ide>
<ide> def test_from_dict_full_subtasks(self):
<ide> c = chain(self.add.si(1, 2), self.add.si(3, 4), self.add.si(5, 6))
<del>
<ide> serialized = json.loads(json.dumps(c))
<del>
<ide> deserialized = chain.from_dict(serialized)
<del>
<del> for task in deserialized.tasks:
<del> assert isinstance(task, Signature)
<add> assert all(isinstance(task, Signature) for task in deserialized.tasks)
<ide>
<ide> @pytest.mark.usefixtures('depends_on_current_app')
<ide> def test_app_falls_back_to_default(self):
<ide> def test_handles_dicts(self):
<ide> )
<ide> c.freeze()
<ide> tasks, _ = c._frozen
<del> for task in tasks:
<del> assert isinstance(task, Signature)
<del> assert task.app is self.app
<add> assert all(isinstance(task, Signature) for task in tasks)
<add> assert all(task.app is self.app for task in tasks)
<ide>
<ide> def test_groups_in_chain_to_chord(self):
<ide> g1 = group([self.add.s(2, 2), self.add.s(4, 4)])
| 1
|
Python
|
Python
|
handle none in protect path
|
a3c5de2585b44b8b697161dfad2859dd2ffbb536
|
<ide><path>numpy/distutils/command/scons.py
<ide> def get_cxx_tool_path(compiler):
<ide> def protect_path(path):
<ide> """Convert path (given as a string) to something the shell will have no
<ide> problem to understand (space, etc... problems)."""
<del> # XXX: to this correctly, this is totally bogus for now (does not check for
<del> # already quoted path, for example).
<del> return '"' + path + '"'
<add> if path:
<add> # XXX: to this correctly, this is totally bogus for now (does not check for
<add> # already quoted path, for example).
<add> return '"' + path + '"'
<add> else:
<add> return '""'
<ide>
<ide> def parse_package_list(pkglist):
<ide> return pkglist.split(",")
| 1
|
Python
|
Python
|
add serialization tests for tagger
|
43b4d63f8587bcc7078635a099f1acf48264303c
|
<ide><path>spacy/tests/serialize/test_serialize_tagger.py
<add># coding: utf-8
<add>from __future__ import unicode_literals
<add>
<add>from ..util import make_tempdir
<add>from ...pipeline import NeuralTagger as Tagger
<add>
<add>import pytest
<add>
<add>
<add>@pytest.fixture
<add>def taggers(en_vocab):
<add> tagger1 = Tagger(en_vocab, True)
<add> tagger2 = Tagger(en_vocab, True)
<add> tagger1.model = tagger1.Model(None, None)
<add> tagger2.model = tagger2.Model(None, None)
<add> return (tagger1, tagger2)
<add>
<add>
<add>def test_serialize_tagger_roundtrip_bytes(en_vocab, taggers):
<add> tagger1, tagger2 = taggers
<add> tagger1_b = tagger1.to_bytes()
<add> tagger2_b = tagger2.to_bytes()
<add> assert tagger1_b == tagger2_b
<add> tagger1 = tagger1.from_bytes(tagger1_b)
<add> assert tagger1.to_bytes() == tagger1_b
<add> new_tagger1 = Tagger(en_vocab).from_bytes(tagger1_b)
<add> assert new_tagger1.to_bytes() == tagger1_b
<add>
<add>
<add>def test_serialize_tagger_roundtrip_disk(en_vocab, taggers):
<add> tagger1, tagger2 = taggers
<add> with make_tempdir() as d:
<add> file_path1 = d / 'tagger1'
<add> file_path2 = d / 'tagger2'
<add> tagger1.to_disk(file_path1)
<add> tagger2.to_disk(file_path2)
<add> tagger1_d = Tagger(en_vocab).from_disk(file_path1)
<add> tagger2_d = Tagger(en_vocab).from_disk(file_path2)
<add> assert tagger1_d.to_bytes() == tagger2_d.to_bytes()
| 1
|
Javascript
|
Javascript
|
fix children in ff3
|
304921128c1ff2ebd5c5905f7dae5f648d39a41c
|
<ide><path>src/player.js
<ide> _V_.Player = _V_.Component.extend({
<ide> options.loop = this.tag.getAttribute("loop") !== null;
<ide> options.muted = this.tag.getAttribute("muted") !== null;
<ide>
<del> for (var c,i=0,j=this.tag.children;i<j.length;i++) {
<del> c = j[i];
<del> if (c.nodeName == "SOURCE") {
<del> options.sources.push({
<del> src: c.src,
<del> type: c.type,
<del> media: c.media,
<del> title: c.title
<del> });
<del> }
<del> if (c.nodeName == "TRACK") {
<del> options.tracks.push(new _V_.Track({
<del> src: c.getAttribute("src"),
<del> kind: c.getAttribute("kind"),
<del> srclang: c.getAttribute("srclang"),
<del> label: c.getAttribute("label"),
<del> 'default': c.getAttribute("default") !== null,
<del> title: c.getAttribute("title")
<del> }, this));
<del>
<del> }
<add> if (this.tag.hasChildNodes()) {
<add> for (var c,i=0,j=this.tag.childNodes;i<j.length;i++) {
<add> c = j[i];
<add> if (c.nodeName == "SOURCE") {
<add> options.sources.push({
<add> src: c.src,
<add> type: c.type,
<add> media: c.media,
<add> title: c.title
<add> });
<add> }
<add> if (c.nodeName == "TRACK") {
<add> options.tracks.push(new _V_.Track({
<add> src: c.getAttribute("src"),
<add> kind: c.getAttribute("kind"),
<add> srclang: c.getAttribute("srclang"),
<add> label: c.getAttribute("label"),
<add> 'default': c.getAttribute("default") !== null,
<add> title: c.getAttribute("title")
<add> }, this));
<add>
<add> }
<add> }
<ide> }
<ide> return options;
<ide> },
| 1
|
Javascript
|
Javascript
|
remove workaround for chrome bug
|
87eff27e971414fb163e2b5a7cfe78cb097a1951
|
<ide><path>src/ng/directive/select.js
<ide>
<ide> var noopNgModelController = { $setViewValue: noop, $render: noop };
<ide>
<del>function chromeHack(optionElement) {
<del> // Workaround for https://code.google.com/p/chromium/issues/detail?id=381459
<del> // Adding an <option selected="selected"> element to a <select required="required"> should
<del> // automatically select the new element
<del> if (optionElement[0].hasAttribute('selected')) {
<del> optionElement[0].selected = true;
<del> }
<del>}
<del>
<ide> /**
<ide> * @ngdoc type
<ide> * @name select.SelectController
<ide> var SelectController =
<ide> var count = optionsMap.get(value) || 0;
<ide> optionsMap.put(value, count + 1);
<ide> self.ngModelCtrl.$render();
<del> chromeHack(element);
<ide> };
<ide>
<ide> // Tell the select control that an option, with the given value, has been removed
<ide><path>test/ng/directive/ngOptionsSpec.js
<ide> describe('ngOptions', function() {
<ide> });
<ide> });
<ide>
<add> describe('required and empty option', function() {
<add>
<add> it('should select the empty option after compilation', function() {
<add> createSelect({
<add> 'name': 'select',
<add> 'ng-model': 'value',
<add> 'ng-options': 'item for item in [\'first\', \'second\', \'third\']',
<add> 'required': 'required'
<add> }, true);
<add>
<add> expect(element.val()).toBe('');
<add> var emptyOption = element.find('option').eq(0);
<add> expect(emptyOption.prop('selected')).toBe(true);
<add> expect(emptyOption.val()).toBe('');
<add> });
<add> });
<add>
<ide> describe('ngModelCtrl', function() {
<ide> it('should prefix the model value with the word "the" using $parsers', function() {
<ide> createSelect({
| 2
|
Go
|
Go
|
fix race with testcontainerapicommit
|
563708d78d42afe89374d5819fdb671ed72c2dad
|
<ide><path>integration-cli/docker_api_containers_test.go
<ide> func (s *DockerSuite) TestContainerApiCommit(c *check.C) {
<ide> }
<ide> id := strings.TrimSpace(string(out))
<ide>
<del> name := "testcommit"
<add> name := "testcommit" + stringid.GenerateRandomID()
<ide> _, b, err := sockRequest("POST", "/commit?repo="+name+"&testtag=tag&container="+id, nil)
<ide> if err != nil && !strings.Contains(err.Error(), "200 OK: 201") {
<ide> c.Fatal(err)
<ide> func (s *DockerSuite) TestContainerApiCommit(c *check.C) {
<ide> // sanity check, make sure the image is what we think it is
<ide> out, err = exec.Command(dockerBinary, "run", img.Id, "ls", "/test").CombinedOutput()
<ide> if err != nil {
<del> c.Fatal(out, err)
<add> c.Fatalf("error checking commited image: %v - %q", err, string(out))
<ide> }
<ide> }
<ide>
<ide><path>integration-cli/docker_utils.go
<ide> func unpauseAllContainers() error {
<ide> }
<ide>
<ide> func deleteImages(images ...string) error {
<del> args := make([]string, 1, 2)
<del> args[0] = "rmi"
<add> args := []string{"rmi", "-f"}
<ide> args = append(args, images...)
<ide> rmiCmd := exec.Command(dockerBinary, args...)
<ide> exitCode, err := runCommand(rmiCmd)
<ide> // set error manually if not set
<ide> if exitCode != 0 && err == nil {
<ide> err = fmt.Errorf("failed to remove image: `docker rmi` exit is non-zero")
<ide> }
<del>
<ide> return err
<ide> }
<ide>
| 2
|
Go
|
Go
|
fix flaky testgetcontainersattachwebsocket
|
85354fb77c77aabe6ba1f53c90aa2395b4e81866
|
<ide><path>integration-cli/docker_api_attach_test.go
<ide> func (s *DockerSuite) TestGetContainersAttachWebsocket(c *check.C) {
<ide>
<ide> outChan := make(chan error)
<ide> go func() {
<del> _, err := ws.Read(actual)
<add> _, err := io.ReadFull(ws, actual)
<ide> outChan <- err
<ide> close(outChan)
<ide> }()
| 1
|
Javascript
|
Javascript
|
favor arrow functions in callbacks
|
6363f21faf3ca335814536c660058eacf8df5e70
|
<ide><path>test/parallel/test-https-agent-servername.js
<ide> 'use strict';
<ide> const common = require('../common');
<add>const assert = require('assert');
<ide>
<ide> if (!common.hasCrypto)
<ide> common.skip('missing crypto');
<ide> const options = {
<ide> };
<ide>
<ide>
<del>const server = https.Server(options, function(req, res) {
<add>const server = https.Server(options, (req, res) => {
<ide> res.writeHead(200);
<ide> res.end('hello world\n');
<ide> });
<ide> server.listen(0, function() {
<ide> rejectUnauthorized: true,
<ide> servername: 'agent1',
<ide> ca: options.ca
<del> }, function(res) {
<add> }, (res) => {
<ide> res.resume();
<del> console.log(res.statusCode);
<add> assert.strictEqual(res.statusCode, 200);
<ide> server.close();
<del> }).on('error', function(e) {
<add> }).on('error', (e) => {
<ide> console.log(e.message);
<ide> process.exit(1);
<ide> });
| 1
|
PHP
|
PHP
|
fix custom class cast with dates
|
2d52abc33865cc29b8e92a41ed7ad9a2b5383a11
|
<ide><path>src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php
<ide> protected function addCastAttributesToArray(array $attributes, array $mutatedAtt
<ide> $attributes[$key] = $attributes[$key]->format(explode(':', $value, 2)[1]);
<ide> }
<ide>
<add> if ($attributes[$key] && $attributes[$key] instanceof DateTimeInterface &&
<add> $this->isClassCastable($key)) {
<add> $attributes[$key] = $this->serializeDate($attributes[$key]);
<add> }
<add>
<ide> if ($attributes[$key] instanceof Arrayable) {
<ide> $attributes[$key] = $attributes[$key]->toArray();
<ide> }
| 1
|
Javascript
|
Javascript
|
support standalone blocks
|
a38d6ad4be02528c8975c1e6c796556531de68e1
|
<ide><path>lib/repl.js
<ide> function REPLServer(prompt,
<ide> eval_ = eval_ || defaultEval;
<ide>
<ide> function defaultEval(code, context, file, cb) {
<del> var err, result, retry = false;
<add> var err, result, retry = false, input = code, wrappedErr;
<ide> // first, create the Script object to check the syntax
<ide> while (true) {
<ide> try {
<ide> function REPLServer(prompt,
<ide> debug('parse error %j', code, e);
<ide> if (self.replMode === exports.REPL_MODE_MAGIC &&
<ide> e.message === BLOCK_SCOPED_ERROR &&
<del> !retry) {
<del> retry = true;
<add> !retry || self.wrappedCmd) {
<add> if (self.wrappedCmd) {
<add> self.wrappedCmd = false;
<add> // unwrap and try again
<add> code = `${input.substring(1, input.length - 2)}\n`;
<add> wrappedErr = e;
<add> } else {
<add> retry = true;
<add> }
<ide> continue;
<ide> }
<del> if (isRecoverableError(e, self))
<del> err = new Recoverable(e);
<add> // preserve original error for wrapped command
<add> const error = wrappedErr || e;
<add> if (isRecoverableError(error, self))
<add> err = new Recoverable(error);
<ide> else
<del> err = e;
<add> err = error;
<ide> }
<ide> break;
<ide> }
<ide> function REPLServer(prompt,
<ide> // to wrap it in parentheses, so that it will be interpreted as
<ide> // an expression.
<ide> evalCmd = '(' + evalCmd + ')\n';
<add> self.wrappedCmd = true;
<ide> } else {
<ide> // otherwise we just append a \n so that it will be either
<ide> // terminated, or continued onto the next expression if it's an
<ide> function REPLServer(prompt,
<ide> debug('finish', e, ret);
<ide> self.memory(cmd);
<ide>
<add> self.wrappedCmd = false;
<ide> if (e && !self.bufferedCommand && cmd.trim().match(/^npm /)) {
<ide> self.outputStream.write('npm should be run outside of the ' +
<ide> 'node repl, in your normal shell.\n' +
<ide><path>test/parallel/test-repl.js
<ide> function error_test() {
<ide> { client: client_unix, send: 'function x(s) {\nreturn s.replace(/.*/,"");\n}',
<ide> expect: prompt_multiline + prompt_multiline +
<ide> 'undefined\n' + prompt_unix },
<add> { client: client_unix, send: '{ var x = 4; }',
<add> expect: 'undefined\n' + prompt_unix },
<ide> ]);
<ide> }
<ide>
| 2
|
PHP
|
PHP
|
allow float 0 to be considered empty
|
7d398ee9891a6d9f1c7f0c252c26a3264addc8f3
|
<ide><path>src/Validation/Validator.php
<ide> protected function _canBeEmpty($field, $context) {
<ide> * @return bool
<ide> */
<ide> protected function _fieldIsEmpty($data) {
<del> if (empty($data) && $data !== '0' && $data !== false && $data !== 0) {
<add> if (empty($data) && $data !== '0' && $data !== false && $data !== 0 && $data !== 0.0) {
<ide> return true;
<ide> }
<ide> return false;
<ide><path>tests/TestCase/Validation/ValidatorTest.php
<ide> public function testErrorsWithEmptyAllowed() {
<ide> $errors = $validator->errors(['title' => 0]);
<ide> $this->assertEmpty($errors);
<ide>
<add> $errors = $validator->errors(['title' => 0.0]);
<add> $this->assertEmpty($errors);
<add>
<ide> $errors = $validator->errors(['title' => '0']);
<ide> $this->assertEmpty($errors);
<ide>
| 2
|
Text
|
Text
|
fix some typos in nativemodulesandroid.md
|
fa21822241ef1347ef0a932654569b1e544fd622
|
<ide><path>docs/NativeModulesAndroid.md
<ide> Read more about [ReadableMap](https://github.com/facebook/react-native/blob/mast
<ide> The last step within Java is to register the Module; this happens in the `createNativeModules` of your apps package. If a module is not registered it will not be available from JavaScript.
<ide>
<ide> ```java
<del>class AnExampleReactPackage implements ReactPackage {
<add>package com.facebook.react.modules.toast;
<add>
<add>import com.facebook.react.ReactPackage;
<add>import com.facebook.react.bridge.JavaScriptModule;
<add>import com.facebook.react.bridge.NativeModule;
<add>import com.facebook.react.bridge.ReactApplicationContext;
<add>import com.facebook.react.uimanager.ViewManager;
<add>
<add>import java.util.ArrayList;
<add>import java.util.Collections;
<add>import java.util.List;
<add>
<add>public class AnExampleReactPackage implements ReactPackage {
<ide>
<ide> @Override
<ide> public List<Class<? extends JavaScriptModule>> createJSModules() {
<ide> componentWillMount: function() {
<ide>
<ide> ### Getting activity result from `startActivityForResult`
<ide>
<del>You'll need to listen to `onActivityResult` if you want to get results from an activity you started with `startActivityForResult`. To do this, the you must extend `BaseActivityEventListener` or implement `ActivityEventListener`. The former is preferred as it is more resilient to API changes. Then, you need to register the listener in the module's constructor,
<add>You'll need to listen to `onActivityResult` if you want to get results from an activity you started with `startActivityForResult`. To do this, you must extend `BaseActivityEventListener` or implement `ActivityEventListener`. The former is preferred as it is more resilient to API changes. Then, you need to register the listener in the module's constructor,
<ide>
<ide> ```java
<ide> reactContext.addActivityEventListener(mActivityResultListener);
| 1
|
Text
|
Text
|
improve note about wordpress framework
|
dd5e398f9f98cdd7b46b922178e1e85649877580
|
<ide><path>README.md
<ide> # <a href='http://redux.js.org'><img src='https://camo.githubusercontent.com/f28b5bc7822f1b7bb28a96d8d09e7d79169248fc/687474703a2f2f692e696d6775722e636f6d2f4a65567164514d2e706e67' height='60'></a>
<ide>
<ide> Redux is a predictable state container for JavaScript apps.
<del>(If you're looking for a WordPress framework, check out [Redux Framework](https://reduxframework.com/).)
<add>(Not to be confused with a WordPress framework – [Redux Framework](https://reduxframework.com/).)
<ide>
<ide> It helps you write applications that behave consistently, run in different environments (client, server, and native), and are easy to test. On top of that, it provides a great developer experience, such as [live code editing combined with a time traveling debugger](https://github.com/gaearon/redux-devtools).
<ide>
| 1
|
Javascript
|
Javascript
|
add svgloader. see
|
6f01c2dc4b9c79a555de5e0cadb25f8bc825c7af
|
<ide><path>src/loaders/SVGLoader.js
<add>/**
<add> * @author mrdoob / http://mrdoob.com/
<add> * @author zz85 / http://joshuakoo.com/
<add> */
<add>
<add>THREE.SVGLoader = function ( manager ) {
<add>
<add> this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager;
<add>
<add>};
<add>
<add>THREE.SVGLoader.prototype = {
<add>
<add> constructor: THREE.MaterialLoader,
<add>
<add> load: function ( url, onLoad, onProgress, onError ) {
<add>
<add> var parser = new DOMParser();
<add>
<add> var loader = new THREE.XHRLoader();
<add> loader.setCrossOrigin( this.crossOrigin );
<add> loader.load( url, function ( svgString ) {
<add>
<add> var doc = parser.parseFromString( svgString, 'image/svg+xml' ); // application/xml
<add>
<add> onLoad( doc.firstChild );
<add>
<add> } );
<add>
<add> }
<add>};
<ide>\ No newline at end of file
| 1
|
Text
|
Text
|
standardize constructor doc header layout
|
0f9d474c524e5132423a96db05d2b2541fcda121
|
<ide><path>doc/api/crypto.md
<ide> the `crypto`, `tls`, and `https` modules and are generally specific to OpenSSL.
<ide> [`keyObject.export()`]: #crypto_keyobject_export_options
<ide> [`sign.sign()`]: #crypto_sign_sign_privatekey_outputencoding
<ide> [`sign.update()`]: #crypto_sign_update_data_inputencoding
<del>[`stream.Writable` options]: stream.html#stream_constructor_new_stream_writable_options
<add>[`stream.Writable` options]: stream.html#stream_new_stream_writable_options
<ide> [`stream.transform` options]: stream.html#stream_new_stream_transform_options
<ide> [`util.promisify()`]: util.html#util_util_promisify_original
<ide> [`verify.update()`]: #crypto_verify_update_data_inputencoding
<ide><path>doc/api/errors.md
<ide> such as `process.stdout.on('data')`.
<ide> [`https`]: https.html
<ide> [`libuv Error handling`]: http://docs.libuv.org/en/v1.x/errors.html
<ide> [`net`]: net.html
<del>[`new URL(input)`]: url.html#url_constructor_new_url_input_base
<del>[`new URLSearchParams(iterable)`]: url.html#url_constructor_new_urlsearchparams_iterable
<add>[`new URL(input)`]: url.html#url_new_url_input_base
<add>[`new URLSearchParams(iterable)`]: url.html#url_new_urlsearchparams_iterable
<ide> [`process.on('exit')`]: process.html#Event:-`'exit'`
<ide> [`process.send()`]: process.html#process_process_send_message_sendhandle_options_callback
<ide> [`process.setUncaughtExceptionCaptureCallback()`]: process.html#process_process_setuncaughtexceptioncapturecallback_fn
<ide><path>doc/api/http.md
<ide> try {
<ide> [`net.Server`]: net.html#net_class_net_server
<ide> [`net.Socket`]: net.html#net_class_net_socket
<ide> [`net.createConnection()`]: net.html#net_net_createconnection_options_connectlistener
<del>[`new URL()`]: url.html#url_constructor_new_url_input_base
<add>[`new URL()`]: url.html#url_new_url_input_base
<ide> [`removeHeader(name)`]: #http_request_removeheader_name
<ide> [`request.end()`]: #http_request_end_data_encoding_callback
<ide> [`request.destroy()`]: #http_request_destroy_error
<ide><path>doc/api/https.md
<ide> headers: max-age=0; pin-sha256="WoiWRyIOVNa9ihaBciRSC7XHjliYS9VwUGOIud4PB18="; p
<ide> [`https.Agent`]: #https_class_https_agent
<ide> [`https.request()`]: #https_https_request_options_callback
<ide> [`net.Server`]: net.html#net_class_net_server
<del>[`new URL()`]: url.html#url_constructor_new_url_input_base
<add>[`new URL()`]: url.html#url_new_url_input_base
<ide> [`server.listen()`]: net.html#net_server_listen
<ide> [`tls.connect()`]: tls.html#tls_tls_connect_options_callback
<ide> [`tls.createSecureContext()`]: tls.html#tls_tls_createsecurecontext_options
<ide><path>doc/api/inspector.md
<ide> An exception will be thrown if there is no active inspector.
<ide> The `inspector.Session` is used for dispatching messages to the V8 inspector
<ide> back-end and receiving message responses and notifications.
<ide>
<del>### Constructor: `new inspector.Session()`
<add>### `new inspector.Session()`
<ide> <!-- YAML
<ide> added: v8.0.0
<ide> -->
<ide><path>doc/api/stream.md
<ide> Custom `Writable` streams *must* call the `new stream.Writable([options])`
<ide> constructor and implement the `writable._write()` and/or `writable._writev()`
<ide> method.
<ide>
<del>#### Constructor: `new stream.Writable([options])`
<add>#### `new stream.Writable([options])`
<ide> <!-- YAML
<ide> changes:
<ide> - version: v14.0.0
<ide> contain multi-byte characters.
<ide> [writable-_construct]: #stream_writable_construct_callback
<ide> [writable-_destroy]: #stream_writable_destroy_err_callback
<ide> [writable-destroy]: #stream_writable_destroy_error
<del>[writable-new]: #stream_constructor_new_stream_writable_options
<add>[writable-new]: #stream_new_stream_writable_options
<ide> [zlib]: zlib.html
<ide><path>doc/api/url.md
<ide> using the `delete` keyword on any properties of `URL` objects (e.g. `delete
<ide> myURL.protocol`, `delete myURL.pathname`, etc) has no effect but will still
<ide> return `true`.
<ide>
<del>#### Constructor: `new URL(input[, base])`
<add>#### `new URL(input[, base])`
<ide>
<ide> * `input` {string} The absolute or relative input URL to parse. If `input`
<ide> is relative, then `base` is required. If `input` is absolute, the `base`
<ide> console.log(myURL.href);
<ide> // Prints https://example.org/?a=b&a=c
<ide> ```
<ide>
<del>#### Constructor: `new URLSearchParams()`
<add>#### `new URLSearchParams()`
<ide>
<ide> Instantiate a new empty `URLSearchParams` object.
<ide>
<del>#### Constructor: `new URLSearchParams(string)`
<add>#### `new URLSearchParams(string)`
<ide>
<ide> * `string` {string} A query string
<ide>
<ide> console.log(params.toString());
<ide> // Prints 'user=abc&query=xyz'
<ide> ```
<ide>
<del>#### Constructor: `new URLSearchParams(obj)`
<add>#### `new URLSearchParams(obj)`
<ide> <!-- YAML
<ide> added:
<ide> - v7.10.0
<ide> console.log(params.toString());
<ide> // Prints 'user=abc&query=first%2Csecond'
<ide> ```
<ide>
<del>#### Constructor: `new URLSearchParams(iterable)`
<add>#### `new URLSearchParams(iterable)`
<ide> <!-- YAML
<ide> added:
<ide> - v7.10.0
<ide> console.log(myURL.origin);
<ide> [`TypeError`]: errors.html#errors_class_typeerror
<ide> [`URLSearchParams`]: #url_class_urlsearchparams
<ide> [`array.toString()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/toString
<del>[`new URL()`]: #url_constructor_new_url_input_base
<add>[`new URL()`]: #url_new_url_input_base
<ide> [`querystring`]: querystring.html
<ide> [`require('url').format()`]: #url_url_format_url_options
<ide> [`url.domainToASCII()`]: #url_url_domaintoascii_domain
<ide><path>doc/api/v8.md
<ide> A subclass of [`Deserializer`][] corresponding to the format written by
<ide> [`serializer.releaseBuffer()`]: #v8_serializer_releasebuffer
<ide> [`serializer.transferArrayBuffer()`]: #v8_serializer_transferarraybuffer_id_arraybuffer
<ide> [`serializer.writeRawBytes()`]: #v8_serializer_writerawbytes_buffer
<del>[`vm.Script`]: vm.html#vm_constructor_new_vm_script_code_options
<add>[`vm.Script`]: vm.html#vm_new_vm_script_code_options
<ide> [HTML structured clone algorithm]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm
<ide> [V8]: https://developers.google.com/v8/
<ide> [Worker Threads]: worker_threads.html
<ide><path>doc/api/vm.md
<ide> added: v0.3.1
<ide> Instances of the `vm.Script` class contain precompiled scripts that can be
<ide> executed in specific contexts.
<ide>
<del>### Constructor: `new vm.Script(code[, options])`
<add>### `new vm.Script(code[, options])`
<ide> <!-- YAML
<ide> added: v0.3.1
<ide> changes:
<ide> flag enabled.*
<ide> The `vm.SourceTextModule` class provides the [Source Text Module Record][] as
<ide> defined in the ECMAScript specification.
<ide>
<del>### Constructor: `new vm.SourceTextModule(code[, options])`
<add>### `new vm.SourceTextModule(code[, options])`
<ide>
<ide> * `code` {string} JavaScript Module code to parse
<ide> * `options`
<ide> const module = new vm.SyntheticModule(['default'], function() {
<ide> // Use `module` in linking...
<ide> ```
<ide>
<del>### Constructor: `new vm.SyntheticModule(exportNames, evaluateCallback[, options])`
<add>### `new vm.SyntheticModule(exportNames, evaluateCallback[, options])`
<ide> <!-- YAML
<ide> added:
<ide> - v13.0.0
| 9
|
Javascript
|
Javascript
|
add test for selection.node
|
68e9f96f03b8f1a2593ac605fe226302282541e0
|
<ide><path>test/core/selection-node-test.js
<add>require("../env");
<add>require("../../d3");
<add>
<add>var vows = require("vows"),
<add> assert = require("assert");
<add>
<add>var suite = vows.describe("selection.node");
<add>
<add>suite.addBatch({
<add> "select(body)": {
<add> topic: function() {
<add> return d3.select("body").html("");
<add> },
<add> "returns null for empty selections": function(body) {
<add> assert.isNull(body.select("foo").node());
<add> },
<add> "returns the first element for non-empty selections": function(body) {
<add> assert.isTrue(body.node() === document.body);
<add> },
<add> "ignores null nodes": function(body) {
<add> var some = d3.select("body");
<add> some[0][0] = null;
<add> assert.isNull(some.node());
<add> }
<add> }
<add>});
<add>
<add>suite.addBatch({
<add> "selectAll(div)": {
<add> topic: function() {
<add> var body = d3.select("body").html("");
<add> body.append("div").append("span");
<add> body.append("div");
<add> return body.selectAll("div");
<add> },
<add> "returns null for empty selections": function(div) {
<add> assert.isNull(div.select("foo").node());
<add> },
<add> "returns the first element for non-empty selections": function(div) {
<add> assert.isTrue(div.node() === div[0][0]);
<add> },
<add> "ignores null nodes": function(div) {
<add> var some = d3.selectAll("div");
<add> some[0][0] = null;
<add> assert.isTrue(some.node() === div[0][1]);
<add> }
<add> }
<add>});
<add>
<add>suite.export(module);
| 1
|
Python
|
Python
|
add tests for some template tags
|
46210205a48efbd694f2beffb255d532184eeb70
|
<ide><path>tests/test_templatetags.py
<ide>
<ide> from rest_framework.relations import Hyperlink
<ide> from rest_framework.templatetags.rest_framework import (
<del> add_nested_class, add_query_param, format_value, urlize_quoted_links
<add> add_nested_class, add_query_param, as_string, break_long_headers,
<add> format_value, get_pagination_html, urlize_quoted_links
<ide> )
<ide> from rest_framework.test import APIRequestFactory
<ide>
<ide> def test_add_nested_class(self):
<ide> for case in negative_cases:
<ide> self.assertEqual(add_nested_class(case), '')
<ide>
<add> def test_as_string_with_none(self):
<add> result = as_string(None)
<add> assert result == ''
<add>
<add> def test_get_pagination_html(self):
<add> class MockPager(object):
<add> def __init__(self):
<add> self.called = False
<add>
<add> def to_html(self):
<add> self.called = True
<add>
<add> pager = MockPager()
<add> get_pagination_html(pager)
<add> assert pager.called is True
<add>
<add> def test_break_long_lines(self):
<add> header = 'long test header,' * 20
<add> expected_header = '<br> ' + ', <br>'.join(header.split(','))
<add> assert break_long_headers(header) == expected_header
<add>
<ide>
<ide> class Issue1386Tests(TestCase):
<ide> """
| 1
|
Javascript
|
Javascript
|
use safe methods from primordials
|
112cc7c27551254aa2b17098fb774867f05ed0d9
|
<ide><path>lib/_http_outgoing.js
<ide>
<ide> 'use strict';
<ide>
<add>const { ObjectPrototype } = primordials;
<add>
<ide> const assert = require('internal/assert');
<ide> const Stream = require('stream');
<ide> const internalUtil = require('internal/util');
<ide> const { CRLF, debug } = common;
<ide>
<ide> const kIsCorked = Symbol('isCorked');
<ide>
<del>const hasOwnProperty = Function.call.bind(Object.prototype.hasOwnProperty);
<del>
<ide> const RE_CONN_CLOSE = /(?:^|\W)close(?:$|\W)/i;
<ide> const RE_TE_CHUNKED = common.chunkExpression;
<ide>
<ide> function _storeHeader(firstLine, headers) {
<ide> }
<ide> } else {
<ide> for (const key in headers) {
<del> if (hasOwnProperty(headers, key)) {
<add> if (ObjectPrototype.hasOwnProperty(headers, key)) {
<ide> processHeader(this, state, key, headers[key], true);
<ide> }
<ide> }
<ide><path>lib/internal/async_hooks.js
<ide> 'use strict';
<ide>
<del>const { Reflect } = primordials;
<add>const { FunctionPrototype, Reflect } = primordials;
<ide>
<ide> const {
<ide> ERR_ASYNC_TYPE,
<ide> const { kInit, kBefore, kAfter, kDestroy, kTotals, kPromiseResolve,
<ide> kCheck, kExecutionAsyncId, kAsyncIdCounter, kTriggerAsyncId,
<ide> kDefaultTriggerAsyncId, kStackLength } = async_wrap.constants;
<ide>
<del>const FunctionBind = Function.call.bind(Function.prototype.bind);
<del>
<ide> // Used in AsyncHook and AsyncResource.
<ide> const async_id_symbol = Symbol('asyncId');
<ide> const trigger_async_id_symbol = Symbol('triggerAsyncId');
<ide> function emitHook(symbol, asyncId) {
<ide> }
<ide>
<ide> function emitHookFactory(symbol, name) {
<del> const fn = FunctionBind(emitHook, undefined, symbol);
<add> const fn = FunctionPrototype.bind(emitHook, undefined, symbol);
<ide>
<ide> // Set the name property of the function as it looks good in the stack trace.
<ide> Object.defineProperty(fn, 'name', {
<ide><path>lib/internal/bootstrap/loaders.js
<ide> NativeModule.prototype.compileForPublicLoader = function(needToProxify) {
<ide> };
<ide>
<ide> const getOwn = (target, property, receiver) => {
<del> return Reflect.apply(ObjectPrototype.hasOwnProperty, target, [property]) ?
<add> return ObjectPrototype.hasOwnProperty(target, property) ?
<ide> Reflect.get(target, property, receiver) :
<ide> undefined;
<ide> };
<ide> NativeModule.prototype.proxifyExports = function() {
<ide>
<ide> const update = (property, value) => {
<ide> if (this.reflect !== undefined &&
<del> Reflect.apply(ObjectPrototype.hasOwnProperty,
<del> this.reflect.exports, [property]))
<add> ObjectPrototype.hasOwnProperty(this.reflect.exports, property))
<ide> this.reflect.exports[property].set(value);
<ide> };
<ide>
<ide> NativeModule.prototype.proxifyExports = function() {
<ide> !Reflect.has(handler, 'get')) {
<ide> handler.get = (target, prop, receiver) => {
<ide> const value = Reflect.get(target, prop, receiver);
<del> if (Reflect.apply(ObjectPrototype.hasOwnProperty, target, [prop]))
<add> if (ObjectPrototype.hasOwnProperty(target, prop))
<ide> update(prop, value);
<ide> return value;
<ide> };
<ide><path>lib/internal/bootstrap/primordials.js
<ide> // `primordials.Object` where `primordials` is a lexical variable passed
<ide> // by the native module compiler.
<ide>
<add>const ReflectApply = Reflect.apply;
<add>
<add>// This function is borrowed from the function with the same name on V8 Extras'
<add>// `utils` object. V8 implements Reflect.apply very efficiently in conjunction
<add>// with the spread syntax, such that no additional special case is needed for
<add>// function calls w/o arguments.
<add>// Refs: https://github.com/v8/v8/blob/d6ead37d265d7215cf9c5f768f279e21bd170212/src/js/prologue.js#L152-L156
<add>function uncurryThis(func) {
<add> return (thisArg, ...args) => ReflectApply(func, thisArg, args);
<add>}
<add>
<add>primordials.uncurryThis = uncurryThis;
<add>
<ide> function copyProps(src, dest) {
<ide> for (const key of Reflect.ownKeys(src)) {
<ide> if (!Reflect.getOwnPropertyDescriptor(dest, key)) {
<ide> function copyProps(src, dest) {
<ide> }
<ide> }
<ide>
<add>function copyPrototype(src, dest) {
<add> for (const key of Reflect.ownKeys(src)) {
<add> if (!Reflect.getOwnPropertyDescriptor(dest, key)) {
<add> const desc = Reflect.getOwnPropertyDescriptor(src, key);
<add> if (typeof desc.value === 'function') {
<add> desc.value = uncurryThis(desc.value);
<add> }
<add> Reflect.defineProperty(dest, key, desc);
<add> }
<add> }
<add>}
<add>
<ide> function makeSafe(unsafe, safe) {
<ide> copyProps(unsafe.prototype, safe.prototype);
<ide> copyProps(unsafe, safe);
<ide> primordials.SafePromise = makeSafe(
<ide> // Create copies of intrinsic objects
<ide> [
<ide> 'Array',
<add> 'BigInt',
<add> 'Boolean',
<ide> 'Date',
<add> 'Error',
<ide> 'Function',
<add> 'Map',
<add> 'Number',
<ide> 'Object',
<ide> 'RegExp',
<add> 'Set',
<ide> 'String',
<ide> 'Symbol',
<ide> ].forEach((name) => {
<ide> const target = primordials[name] = Object.create(null);
<ide> copyProps(global[name], target);
<ide> const proto = primordials[name + 'Prototype'] = Object.create(null);
<del> copyProps(global[name].prototype, proto);
<add> copyPrototype(global[name].prototype, proto);
<ide> });
<ide>
<ide> Object.setPrototypeOf(primordials, null);
<ide><path>lib/internal/cli_table.js
<ide> 'use strict';
<ide>
<del>const { Math } = primordials;
<add>const { Math, ObjectPrototype } = primordials;
<ide>
<ide> const { Buffer } = require('buffer');
<ide> const { removeColors } = require('internal/util');
<del>const HasOwnProperty = Function.call.bind(Object.prototype.hasOwnProperty);
<ide>
<ide> // The use of Unicode characters below is the only non-comment use of non-ASCII
<ide> // Unicode characters in Node.js built-in modules. If they are ever removed or
<ide> const table = (head, columns) => {
<ide> for (var j = 0; j < longestColumn; j++) {
<ide> if (rows[j] === undefined)
<ide> rows[j] = [];
<del> const value = rows[j][i] = HasOwnProperty(column, j) ? column[j] : '';
<add> const value = rows[j][i] =
<add> ObjectPrototype.hasOwnProperty(column, j) ? column[j] : '';
<ide> const width = columnWidths[i] || 0;
<ide> const counted = countSymbols(value);
<ide> columnWidths[i] = Math.max(width, counted);
<ide><path>lib/internal/console/constructor.js
<ide> // The Console constructor is not actually used to construct the global
<ide> // console. It's exported for backwards compatibility.
<ide>
<del>const { Reflect } = primordials;
<add>const { ObjectPrototype, Reflect } = primordials;
<ide>
<ide> const { trace } = internalBinding('trace_events');
<ide> const {
<ide> const {
<ide> keys: ObjectKeys,
<ide> values: ObjectValues,
<ide> } = Object;
<del>const hasOwnProperty = Function.call.bind(Object.prototype.hasOwnProperty);
<ide>
<ide> const {
<ide> isArray: ArrayIsArray,
<ide> const consoleMethods = {
<ide> for (const key of keys) {
<ide> if (map[key] === undefined)
<ide> map[key] = [];
<del> if ((primitive && properties) || !hasOwnProperty(item, key))
<add> if ((primitive && properties) ||
<add> !ObjectPrototype.hasOwnProperty(item, key))
<ide> map[key][i] = '';
<ide> else
<ide> map[key][i] = _inspect(item[key]);
<ide><path>lib/internal/error-serdes.js
<ide>
<ide> const Buffer = require('buffer').Buffer;
<ide> const {
<del> SafeSet,
<add> ArrayPrototype,
<add> FunctionPrototype,
<ide> Object,
<ide> ObjectPrototype,
<del> FunctionPrototype,
<del> ArrayPrototype
<add> SafeSet,
<ide> } = primordials;
<ide>
<ide> const kSerializedError = 0;
<ide> const kSerializedObject = 1;
<ide> const kInspectedError = 2;
<ide>
<del>const GetPrototypeOf = Object.getPrototypeOf;
<del>const GetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
<del>const GetOwnPropertyNames = Object.getOwnPropertyNames;
<del>const DefineProperty = Object.defineProperty;
<del>const Assign = Object.assign;
<del>const ObjectPrototypeToString =
<del> FunctionPrototype.call.bind(ObjectPrototype.toString);
<del>const ForEach = FunctionPrototype.call.bind(ArrayPrototype.forEach);
<del>const Call = FunctionPrototype.call.bind(FunctionPrototype.call);
<del>
<ide> const errors = {
<ide> Error, TypeError, RangeError, URIError, SyntaxError, ReferenceError, EvalError
<ide> };
<ide> function TryGetAllProperties(object, target = object) {
<ide> const all = Object.create(null);
<ide> if (object === null)
<ide> return all;
<del> Assign(all, TryGetAllProperties(GetPrototypeOf(object), target));
<del> const keys = GetOwnPropertyNames(object);
<del> ForEach(keys, (key) => {
<add> Object.assign(all,
<add> TryGetAllProperties(Object.getPrototypeOf(object), target));
<add> const keys = Object.getOwnPropertyNames(object);
<add> ArrayPrototype.forEach(keys, (key) => {
<ide> let descriptor;
<ide> try {
<del> descriptor = GetOwnPropertyDescriptor(object, key);
<add> descriptor = Object.getOwnPropertyDescriptor(object, key);
<ide> } catch { return; }
<ide> const getter = descriptor.get;
<ide> if (getter && key !== '__proto__') {
<ide> try {
<del> descriptor.value = Call(getter, target);
<add> descriptor.value = FunctionPrototype.call(getter, target);
<ide> } catch {}
<ide> }
<ide> if ('value' in descriptor && typeof descriptor.value !== 'function') {
<ide> function GetConstructors(object) {
<ide>
<ide> for (var current = object;
<ide> current !== null;
<del> current = GetPrototypeOf(current)) {
<del> const desc = GetOwnPropertyDescriptor(current, 'constructor');
<add> current = Object.getPrototypeOf(current)) {
<add> const desc = Object.getOwnPropertyDescriptor(current, 'constructor');
<ide> if (desc && desc.value) {
<del> DefineProperty(constructors, constructors.length, {
<add> Object.defineProperty(constructors, constructors.length, {
<ide> value: desc.value, enumerable: true
<ide> });
<ide> }
<ide> function GetConstructors(object) {
<ide> }
<ide>
<ide> function GetName(object) {
<del> const desc = GetOwnPropertyDescriptor(object, 'name');
<add> const desc = Object.getOwnPropertyDescriptor(object, 'name');
<ide> return desc && desc.value;
<ide> }
<ide>
<ide> function serializeError(error) {
<ide> if (!serialize) serialize = require('v8').serialize;
<ide> try {
<ide> if (typeof error === 'object' &&
<del> ObjectPrototypeToString(error) === '[object Error]') {
<add> ObjectPrototype.toString(error) === '[object Error]') {
<ide> const constructors = GetConstructors(error);
<ide> for (var i = 0; i < constructors.length; i++) {
<ide> const name = GetName(constructors[i]);
<ide><path>lib/internal/modules/esm/create_dynamic_module.js
<ide> 'use strict';
<ide>
<add>const { ArrayPrototype } = primordials;
<add>
<ide> const { ModuleWrap, callbackMap } = internalBinding('module_wrap');
<ide> const debug = require('util').debuglog('esm');
<del>const ArrayJoin = Function.call.bind(Array.prototype.join);
<del>const ArrayMap = Function.call.bind(Array.prototype.map);
<ide>
<ide> const createDynamicModule = (exports, url = '', evaluate) => {
<ide> debug('creating ESM facade for %s with exports: %j', url, exports);
<del> const names = ArrayMap(exports, (name) => `${name}`);
<add> const names = ArrayPrototype.map(exports, (name) => `${name}`);
<ide>
<ide> const source = `
<del>${ArrayJoin(ArrayMap(names, (name) =>
<add>${ArrayPrototype.join(ArrayPrototype.map(names, (name) =>
<ide> `let $${name};
<ide> export { $${name} as ${name} };
<ide> import.meta.exports.${name} = {
<ide><path>lib/internal/modules/esm/loader.js
<ide> 'use strict';
<ide>
<add>const { FunctionPrototype } = primordials;
<add>
<ide> const {
<ide> ERR_INVALID_RETURN_PROPERTY,
<ide> ERR_INVALID_RETURN_PROPERTY_VALUE,
<ide> const createDynamicModule = require(
<ide> const { translators } = require('internal/modules/esm/translators');
<ide> const { ModuleWrap } = internalBinding('module_wrap');
<ide>
<del>const FunctionBind = Function.call.bind(Function.prototype.bind);
<del>
<ide> const debug = require('internal/util/debuglog').debuglog('esm');
<ide>
<ide> const {
<ide> class Loader {
<ide> hook({ resolve, dynamicInstantiate }) {
<ide> // Use .bind() to avoid giving access to the Loader instance when called.
<ide> if (resolve !== undefined)
<del> this._resolve = FunctionBind(resolve, null);
<del> if (dynamicInstantiate !== undefined)
<del> this._dynamicInstantiate = FunctionBind(dynamicInstantiate, null);
<add> this._resolve = FunctionPrototype.bind(resolve, null);
<add> if (dynamicInstantiate !== undefined) {
<add> this._dynamicInstantiate =
<add> FunctionPrototype.bind(dynamicInstantiate, null);
<add> }
<ide> }
<ide>
<ide> async getModuleJob(specifier, parentURL) {
<ide><path>lib/internal/modules/esm/translators.js
<ide> 'use strict';
<ide>
<add>const {
<add> SafeMap,
<add> StringPrototype,
<add> JSON
<add>} = primordials;
<add>
<ide> const { NativeModule } = require('internal/bootstrap/loaders');
<ide> const { ModuleWrap, callbackMap } = internalBinding('module_wrap');
<ide> const {
<ide> const internalURLModule = require('internal/url');
<ide> const createDynamicModule = require(
<ide> 'internal/modules/esm/create_dynamic_module');
<ide> const fs = require('fs');
<del>const {
<del> SafeMap,
<del> JSON
<del>} = primordials;
<ide> const { fileURLToPath, URL } = require('url');
<ide> const { debuglog } = require('internal/util/debuglog');
<ide> const { promisify } = require('internal/util');
<ide> const {
<ide> ERR_UNKNOWN_BUILTIN_MODULE
<ide> } = require('internal/errors').codes;
<ide> const readFileAsync = promisify(fs.readFile);
<del>const StringReplace = Function.call.bind(String.prototype.replace);
<ide> const JsonParse = JSON.parse;
<ide>
<ide> const debug = debuglog('esm');
<ide> translators.set('commonjs', async function commonjsStrategy(url, isMain) {
<ide> return cached;
<ide> }
<ide> const module = CJSModule._cache[
<del> isWindows ? StringReplace(pathname, winSepRegEx, '\\') : pathname];
<add> isWindows ? StringPrototype.replace(pathname, winSepRegEx, '\\') : pathname
<add> ];
<ide> if (module && module.loaded) {
<ide> const exports = module.exports;
<ide> return createDynamicModule(['default'], url, (reflect) => {
<ide> translators.set('json', async function jsonStrategy(url) {
<ide> debug(`Loading JSONModule ${url}`);
<ide> const pathname = fileURLToPath(url);
<ide> const modulePath = isWindows ?
<del> StringReplace(pathname, winSepRegEx, '\\') : pathname;
<add> StringPrototype.replace(pathname, winSepRegEx, '\\') : pathname;
<ide> let module = CJSModule._cache[modulePath];
<ide> if (module && module.loaded) {
<ide> const exports = module.exports;
<ide><path>lib/internal/policy/manifest.js
<ide> 'use strict';
<add>
<add>const {
<add> SafeWeakMap,
<add> Object,
<add> RegExpPrototype,
<add> uncurryThis
<add>} = primordials;
<add>
<ide> const {
<ide> ERR_MANIFEST_ASSERT_INTEGRITY,
<ide> ERR_MANIFEST_INTEGRITY_MISMATCH,
<ide> ERR_MANIFEST_UNKNOWN_ONERROR,
<ide> } = require('internal/errors').codes;
<ide> const debug = require('internal/util/debuglog').debuglog('policy');
<ide> const SRI = require('internal/policy/sri');
<del>const {
<del> SafeWeakMap,
<del> FunctionPrototype,
<del> Object,
<del> RegExpPrototype
<del>} = primordials;
<ide> const crypto = require('crypto');
<ide> const { Buffer } = require('buffer');
<ide> const { URL } = require('url');
<ide> const { createHash, timingSafeEqual } = crypto;
<del>const HashUpdate = FunctionPrototype.call.bind(crypto.Hash.prototype.update);
<del>const HashDigest = FunctionPrototype.call.bind(crypto.Hash.prototype.digest);
<del>const BufferEquals = FunctionPrototype.call.bind(Buffer.prototype.equals);
<del>const BufferToString = FunctionPrototype.call.bind(Buffer.prototype.toString);
<del>const RegExpTest = FunctionPrototype.call.bind(RegExpPrototype.test);
<add>const HashUpdate = uncurryThis(crypto.Hash.prototype.update);
<add>const HashDigest = uncurryThis(crypto.Hash.prototype.digest);
<add>const BufferEquals = uncurryThis(Buffer.prototype.equals);
<add>const BufferToString = uncurryThis(Buffer.prototype.toString);
<ide> const { entries } = Object;
<ide> const kIntegrities = new SafeWeakMap();
<ide> const kReactions = new SafeWeakMap();
<ide> class Manifest {
<ide> const integrity = manifestEntries[i][1].integrity;
<ide> if (integrity != null) {
<ide> debug(`Manifest contains integrity for url ${url}`);
<del> if (RegExpTest(kRelativeURLStringPattern, url)) {
<add> if (RegExpPrototype.test(kRelativeURLStringPattern, url)) {
<ide> url = new URL(url, manifestURL).href;
<ide> }
<ide>
<ide><path>lib/internal/policy/sri.js
<ide> 'use strict';
<ide> // Value of https://w3c.github.io/webappsec-subresource-integrity/#the-integrity-attribute
<ide>
<add>const {
<add> Object,
<add> RegExpPrototype,
<add> StringPrototype
<add>} = primordials;
<add>
<ide> // Returns [{algorithm, value (in base64 string), options,}]
<ide> const {
<ide> ERR_SRI_PARSE
<ide> Object.seal(kSRIPattern);
<ide> const kAllWSP = new RegExp(`^${kWSP}*$`);
<ide> Object.seal(kAllWSP);
<ide>
<del>const RegExpExec = Function.call.bind(RegExp.prototype.exec);
<del>const RegExpTest = Function.call.bind(RegExp.prototype.test);
<del>const StringSlice = Function.call.bind(String.prototype.slice);
<del>
<ide> const BufferFrom = require('buffer').Buffer.from;
<del>const { defineProperty } = Object;
<ide>
<ide> const parse = (str) => {
<ide> kSRIPattern.lastIndex = 0;
<ide> let prevIndex = 0;
<ide> let match;
<ide> const entries = [];
<del> while (match = RegExpExec(kSRIPattern, str)) {
<add> while (match = RegExpPrototype.exec(kSRIPattern, str)) {
<ide> if (match.index !== prevIndex) {
<ide> throw new ERR_SRI_PARSE(str, prevIndex);
<ide> }
<ide> const parse = (str) => {
<ide> }
<ide>
<ide> // Avoid setters being fired
<del> defineProperty(entries, entries.length, {
<add> Object.defineProperty(entries, entries.length, {
<ide> enumerable: true,
<ide> configurable: true,
<ide> value: freeze({
<ide> const parse = (str) => {
<ide> }
<ide>
<ide> if (prevIndex !== str.length) {
<del> if (!RegExpTest(kAllWSP, StringSlice(str, prevIndex))) {
<add> if (!RegExpPrototype.test(kAllWSP, StringPrototype.slice(str, prevIndex))) {
<ide> throw new ERR_SRI_PARSE(str, prevIndex);
<ide> }
<ide> }
<ide><path>lib/internal/process/per_thread.js
<ide> // run when setting up each thread, including the main
<ide> // thread and the worker threads.
<ide>
<add>const {
<add> RegExpPrototype,
<add> SetPrototype,
<add> StringPrototype
<add>} = primordials;
<add>
<ide> const {
<ide> errnoException,
<ide> codes: {
<ide> const replaceUnderscoresRegex = /_/g;
<ide> const leadingDashesRegex = /^--?/;
<ide> const trailingValuesRegex = /=.*$/;
<ide>
<del>// Save references so user code does not interfere
<del>const replace = Function.call.bind(String.prototype.replace);
<del>const has = Function.call.bind(Set.prototype.has);
<del>const test = Function.call.bind(RegExp.prototype.test);
<del>
<ide> // This builds the initial process.allowedNodeEnvironmentFlags
<ide> // from data in the config binding.
<ide> function buildAllowedFlags() {
<ide> function buildAllowedFlags() {
<ide> }
<ide> }
<ide>
<del> const trimLeadingDashes = (flag) => replace(flag, leadingDashesRegex, '');
<add> const trimLeadingDashes =
<add> (flag) => StringPrototype.replace(flag, leadingDashesRegex, '');
<ide>
<ide> // Save these for comparison against flags provided to
<ide> // process.allowedNodeEnvironmentFlags.has() which lack leading dashes.
<ide> function buildAllowedFlags() {
<ide> // on a dummy option set and see whether it rejects the argument or
<ide> // not.
<ide> if (typeof key === 'string') {
<del> key = replace(key, replaceUnderscoresRegex, '-');
<del> if (test(leadingDashesRegex, key)) {
<del> key = replace(key, trailingValuesRegex, '');
<del> return has(this, key);
<add> key = StringPrototype.replace(key, replaceUnderscoresRegex, '-');
<add> if (RegExpPrototype.test(leadingDashesRegex, key)) {
<add> key = StringPrototype.replace(key, trailingValuesRegex, '');
<add> return SetPrototype.has(this, key);
<ide> }
<del> return has(nodeFlags, key);
<add> return SetPrototype.has(nodeFlags, key);
<ide> }
<ide> return false;
<ide> }
<ide><path>lib/internal/process/task_queues.js
<ide> 'use strict';
<ide>
<del>const { Reflect } = primordials;
<add>const { FunctionPrototype, Reflect } = primordials;
<ide>
<ide> const {
<ide> // For easy access to the nextTick state in the C++ land,
<ide> const {
<ide> } = require('internal/errors').codes;
<ide> const FixedQueue = require('internal/fixed_queue');
<ide>
<del>const FunctionBind = Function.call.bind(Function.prototype.bind);
<del>
<ide> // *Must* match Environment::TickInfo::Fields in src/env.h.
<ide> const kHasTickScheduled = 0;
<ide>
<ide> function queueMicrotask(callback) {
<ide> const asyncResource = createMicrotaskResource();
<ide> asyncResource.callback = callback;
<ide>
<del> enqueueMicrotask(FunctionBind(runMicrotask, asyncResource));
<add> enqueueMicrotask(FunctionPrototype.bind(runMicrotask, asyncResource));
<ide> }
<ide>
<ide> module.exports = {
<ide><path>lib/internal/util.js
<ide> function once(callback) {
<ide> };
<ide> }
<ide>
<del>const ReflectApply = Reflect.apply;
<del>
<del>// This function is borrowed from the function with the same name on V8 Extras'
<del>// `utils` object. V8 implements Reflect.apply very efficiently in conjunction
<del>// with the spread syntax, such that no additional special case is needed for
<del>// function calls w/o arguments.
<del>// Refs: https://github.com/v8/v8/blob/d6ead37d265d7215cf9c5f768f279e21bd170212/src/js/prologue.js#L152-L156
<del>function uncurryThis(func) {
<del> return (thisArg, ...args) => ReflectApply(func, thisArg, args);
<del>}
<del>
<ide> module.exports = {
<ide> assertCrypto,
<ide> cachedResult,
<ide> module.exports = {
<ide> promisify,
<ide> spliceOne,
<ide> removeColors,
<del> uncurryThis,
<ide>
<ide> // Symbol used to customize promisify conversion
<ide> customPromisifyArgs: kCustomPromisifyArgsSymbol,
<ide><path>lib/internal/util/comparisons.js
<ide> 'use strict';
<ide>
<add>const {
<add> BigIntPrototype,
<add> BooleanPrototype,
<add> DatePrototype,
<add> Number,
<add> NumberPrototype,
<add> Object,
<add> ObjectPrototype: {
<add> hasOwnProperty,
<add> propertyIsEnumerable,
<add> toString: objectToString
<add> },
<add> StringPrototype,
<add> SymbolPrototype
<add>} = primordials;
<add>
<ide> const { compare } = internalBinding('buffer');
<ide> const {
<ide> isAnyArrayBuffer,
<ide> const {
<ide> ONLY_ENUMERABLE
<ide> }
<ide> } = internalBinding('util');
<del>const { uncurryThis } = require('internal/util');
<ide>
<ide> const kStrict = true;
<ide> const kLoose = false;
<ide> const kIsArray = 1;
<ide> const kIsSet = 2;
<ide> const kIsMap = 3;
<ide>
<del>const objectToString = uncurryThis(Object.prototype.toString);
<del>const hasOwnProperty = uncurryThis(Object.prototype.hasOwnProperty);
<del>const propertyIsEnumerable = uncurryThis(Object.prototype.propertyIsEnumerable);
<del>const dateGetTime = uncurryThis(Date.prototype.getTime);
<del>
<del>const bigIntValueOf = uncurryThis(BigInt.prototype.valueOf);
<del>const booleanValueOf = uncurryThis(Boolean.prototype.valueOf);
<del>const numberValueOf = uncurryThis(Number.prototype.valueOf);
<del>const symbolValueOf = uncurryThis(Symbol.prototype.valueOf);
<del>const stringValueOf = uncurryThis(String.prototype.valueOf);
<del>
<del>const objectKeys = Object.keys;
<del>const getPrototypeOf = Object.getPrototypeOf;
<del>const getOwnPropertySymbols = Object.getOwnPropertySymbols;
<del>const objectIs = Object.is;
<del>const numberIsNaN = Number.isNaN;
<del>
<ide> // Check if they have the same source and flags
<ide> function areSimilarRegExps(a, b) {
<ide> return a.source === b.source && a.flags === b.flags;
<ide> function areEqualArrayBuffers(buf1, buf2) {
<ide> function isEqualBoxedPrimitive(val1, val2) {
<ide> if (isNumberObject(val1)) {
<ide> return isNumberObject(val2) &&
<del> objectIs(numberValueOf(val1), numberValueOf(val2));
<add> Object.is(NumberPrototype.valueOf(val1),
<add> NumberPrototype.valueOf(val2));
<ide> }
<ide> if (isStringObject(val1)) {
<del> return isStringObject(val2) && stringValueOf(val1) === stringValueOf(val2);
<add> return isStringObject(val2) &&
<add> StringPrototype.valueOf(val1) === StringPrototype.valueOf(val2);
<ide> }
<ide> if (isBooleanObject(val1)) {
<ide> return isBooleanObject(val2) &&
<del> booleanValueOf(val1) === booleanValueOf(val2);
<add> BooleanPrototype.valueOf(val1) === BooleanPrototype.valueOf(val2);
<ide> }
<ide> if (isBigIntObject(val1)) {
<del> return isBigIntObject(val2) && bigIntValueOf(val1) === bigIntValueOf(val2);
<add> return isBigIntObject(val2) &&
<add> BigIntPrototype.valueOf(val1) === BigIntPrototype.valueOf(val2);
<ide> }
<del> return isSymbolObject(val2) && symbolValueOf(val1) === symbolValueOf(val2);
<add> return isSymbolObject(val2) &&
<add> SymbolPrototype.valueOf(val1) === SymbolPrototype.valueOf(val2);
<ide> }
<ide>
<ide> // Notes: Type tags are historical [[Class]] properties that can be set by
<ide> function innerDeepEqual(val1, val2, strict, memos) {
<ide> if (val1 === val2) {
<ide> if (val1 !== 0)
<ide> return true;
<del> return strict ? objectIs(val1, val2) : true;
<add> return strict ? Object.is(val1, val2) : true;
<ide> }
<ide>
<ide> // Check more closely if val1 and val2 are equal.
<ide> if (strict) {
<ide> if (typeof val1 !== 'object') {
<del> return typeof val1 === 'number' && numberIsNaN(val1) &&
<del> numberIsNaN(val2);
<add> return typeof val1 === 'number' && Number.isNaN(val1) &&
<add> Number.isNaN(val2);
<ide> }
<ide> if (typeof val2 !== 'object' || val1 === null || val2 === null) {
<ide> return false;
<ide> }
<del> if (getPrototypeOf(val1) !== getPrototypeOf(val2)) {
<add> if (Object.getPrototypeOf(val1) !== Object.getPrototypeOf(val2)) {
<ide> return false;
<ide> }
<ide> } else {
<ide> function innerDeepEqual(val1, val2, strict, memos) {
<ide> return keyCheck(val1, val2, strict, memos, kNoIterator);
<ide> }
<ide> if (isDate(val1)) {
<del> if (dateGetTime(val1) !== dateGetTime(val2)) {
<add> if (DatePrototype.getTime(val1) !== DatePrototype.getTime(val2)) {
<ide> return false;
<ide> }
<ide> } else if (isRegExp(val1)) {
<ide> function keyCheck(val1, val2, strict, memos, iterationType, aKeys) {
<ide> // d) For Sets and Maps, equal contents
<ide> // Note: this accounts for both named and indexed properties on Arrays.
<ide> if (arguments.length === 5) {
<del> aKeys = objectKeys(val1);
<del> const bKeys = objectKeys(val2);
<add> aKeys = Object.keys(val1);
<add> const bKeys = Object.keys(val2);
<ide>
<ide> // The pair must have the same number of owned properties.
<ide> if (aKeys.length !== bKeys.length) {
<ide> function keyCheck(val1, val2, strict, memos, iterationType, aKeys) {
<ide> }
<ide>
<ide> if (strict && arguments.length === 5) {
<del> const symbolKeysA = getOwnPropertySymbols(val1);
<add> const symbolKeysA = Object.getOwnPropertySymbols(val1);
<ide> if (symbolKeysA.length !== 0) {
<ide> let count = 0;
<ide> for (i = 0; i < symbolKeysA.length; i++) {
<ide> function keyCheck(val1, val2, strict, memos, iterationType, aKeys) {
<ide> return false;
<ide> }
<ide> }
<del> const symbolKeysB = getOwnPropertySymbols(val2);
<add> const symbolKeysB = Object.getOwnPropertySymbols(val2);
<ide> if (symbolKeysA.length !== symbolKeysB.length &&
<ide> getEnumerables(val2, symbolKeysB).length !== count) {
<ide> return false;
<ide> }
<ide> } else {
<del> const symbolKeysB = getOwnPropertySymbols(val2);
<add> const symbolKeysB = Object.getOwnPropertySymbols(val2);
<ide> if (symbolKeysB.length !== 0 &&
<ide> getEnumerables(val2, symbolKeysB).length !== 0) {
<ide> return false;
<ide> function objEquiv(a, b, strict, keys, memos, iterationType) {
<ide> return false;
<ide> } else {
<ide> // Array is sparse.
<del> const keysA = objectKeys(a);
<add> const keysA = Object.keys(a);
<ide> for (; i < keysA.length; i++) {
<ide> const key = keysA[i];
<ide> if (!hasOwnProperty(b, key) ||
<ide> !innerDeepEqual(a[key], b[key], strict, memos)) {
<ide> return false;
<ide> }
<ide> }
<del> if (keysA.length !== objectKeys(b).length) {
<add> if (keysA.length !== Object.keys(b).length) {
<ide> return false;
<ide> }
<ide> return true;
<ide><path>lib/internal/util/inspect.js
<ide> 'use strict';
<ide>
<del>const { JSON, Math } = primordials;
<add>const {
<add> BigIntPrototype,
<add> BooleanPrototype,
<add> DatePrototype,
<add> ErrorPrototype,
<add> JSON,
<add> MapPrototype,
<add> Math,
<add> NumberPrototype,
<add> Object,
<add> ObjectPrototype: {
<add> hasOwnProperty,
<add> propertyIsEnumerable
<add> },
<add> RegExpPrototype,
<add> SetPrototype,
<add> StringPrototype,
<add> SymbolPrototype,
<add> uncurryThis
<add>} = primordials;
<ide>
<ide> const {
<ide> getOwnNonIndexProperties,
<ide> const {
<ide> customInspectSymbol,
<ide> isError,
<ide> join,
<del> removeColors,
<del> uncurryThis
<add> removeColors
<ide> } = require('internal/util');
<ide>
<ide> const {
<ide> const {
<ide>
<ide> const assert = require('internal/assert');
<ide>
<del>// Avoid monkey-patched built-ins.
<del>const { Object } = primordials;
<del>
<del>const propertyIsEnumerable = uncurryThis(Object.prototype.propertyIsEnumerable);
<del>const regExpToString = uncurryThis(RegExp.prototype.toString);
<del>const dateToISOString = uncurryThis(Date.prototype.toISOString);
<del>const dateToString = uncurryThis(Date.prototype.toString);
<del>const errorToString = uncurryThis(Error.prototype.toString);
<del>
<del>const bigIntValueOf = uncurryThis(BigInt.prototype.valueOf);
<del>const booleanValueOf = uncurryThis(Boolean.prototype.valueOf);
<del>const numberValueOf = uncurryThis(Number.prototype.valueOf);
<del>const symbolValueOf = uncurryThis(Symbol.prototype.valueOf);
<del>const stringValueOf = uncurryThis(String.prototype.valueOf);
<del>
<del>const setValues = uncurryThis(Set.prototype.values);
<del>const mapEntries = uncurryThis(Map.prototype.entries);
<del>const dateGetTime = uncurryThis(Date.prototype.getTime);
<del>const hasOwnProperty = uncurryThis(Object.prototype.hasOwnProperty);
<ide> let hexSlice;
<ide>
<ide> const inspectDefaultOptions = Object.seal({
<ide> function noPrototypeIterator(ctx, value, recurseTimes) {
<ide> let newVal;
<ide> if (isSet(value)) {
<ide> const clazz = clazzWithNullPrototype(Set, 'Set');
<del> newVal = new clazz(setValues(value));
<add> newVal = new clazz(SetPrototype.values(value));
<ide> } else if (isMap(value)) {
<ide> const clazz = clazzWithNullPrototype(Map, 'Map');
<del> newVal = new clazz(mapEntries(value));
<add> newVal = new clazz(MapPrototype.entries(value));
<ide> } else if (Array.isArray(value)) {
<ide> const clazz = clazzWithNullPrototype(Array, 'Array');
<ide> newVal = new clazz(value.length);
<ide> function formatRaw(ctx, value, recurseTimes, typedArray) {
<ide> base = `[${name}]`;
<ide> } else if (isRegExp(value)) {
<ide> // Make RegExps say that they are RegExps
<del> base = regExpToString(constructor !== null ? value : new RegExp(value));
<add> base = RegExpPrototype.toString(
<add> constructor !== null ? value : new RegExp(value)
<add> );
<ide> const prefix = getPrefix(constructor, tag, 'RegExp');
<ide> if (prefix !== 'RegExp ')
<ide> base = `${prefix}${base}`;
<ide> if (keys.length === 0 || recurseTimes > ctx.depth && ctx.depth !== null)
<ide> return ctx.stylize(base, 'regexp');
<ide> } else if (isDate(value)) {
<ide> // Make dates with properties first say the date
<del> base = Number.isNaN(dateGetTime(value)) ?
<del> dateToString(value) :
<del> dateToISOString(value);
<add> base = Number.isNaN(DatePrototype.getTime(value)) ?
<add> DatePrototype.toString(value) :
<add> DatePrototype.toISOString(value);
<ide> const prefix = getPrefix(constructor, tag, 'Date');
<ide> if (prefix !== 'Date ')
<ide> base = `${prefix}${base}`;
<ide> function formatRaw(ctx, value, recurseTimes, typedArray) {
<ide> } else if (isBoxedPrimitive(value)) {
<ide> let type;
<ide> if (isNumberObject(value)) {
<del> base = `[Number: ${getBoxedValue(numberValueOf(value))}]`;
<add> base = `[Number: ${getBoxedValue(NumberPrototype.valueOf(value))}]`;
<ide> type = 'number';
<ide> } else if (isStringObject(value)) {
<del> base = `[String: ${getBoxedValue(stringValueOf(value), ctx)}]`;
<add> base = `[String: ${
<add> getBoxedValue(StringPrototype.valueOf(value), ctx)
<add> }]`;
<ide> type = 'string';
<ide> // For boxed Strings, we have to remove the 0-n indexed entries,
<ide> // since they just noisy up the output and are redundant
<ide> // Make boxed primitive Strings look like such
<ide> keys = keys.slice(value.length);
<ide> } else if (isBooleanObject(value)) {
<del> base = `[Boolean: ${getBoxedValue(booleanValueOf(value))}]`;
<add> base = `[Boolean: ${getBoxedValue(BooleanPrototype.valueOf(value))}]`;
<ide> type = 'boolean';
<ide> } else if (isBigIntObject(value)) {
<del> base = `[BigInt: ${getBoxedValue(bigIntValueOf(value))}]`;
<add> base = `[BigInt: ${getBoxedValue(BigIntPrototype.valueOf(value))}]`;
<ide> type = 'bigint';
<ide> } else {
<del> base = `[Symbol: ${getBoxedValue(symbolValueOf(value))}]`;
<add> base = `[Symbol: ${getBoxedValue(SymbolPrototype.valueOf(value))}]`;
<ide> type = 'symbol';
<ide> }
<ide> if (keys.length === 0) {
<ide> function formatRaw(ctx, value, recurseTimes, typedArray) {
<ide>
<ide> function formatError(err, constructor, tag, ctx) {
<ide> // TODO(BridgeAR): Always show the error code if present.
<del> let stack = err.stack || errorToString(err);
<add> let stack = err.stack || ErrorPrototype.toString(err);
<ide>
<ide> // A stack trace may contain arbitrary data. Only manipulate the output
<ide> // for "regular errors" (errors that "look normal") for now.
<ide><path>lib/internal/util/types.js
<ide> 'use strict';
<ide>
<del>const { uncurryThis } = require('internal/util');
<add>const { uncurryThis } = primordials;
<ide>
<ide> const TypedArrayPrototype = Object.getPrototypeOf(Uint8Array.prototype);
<ide>
<ide><path>lib/util.js
<ide>
<ide> 'use strict';
<ide>
<del>const { Reflect } = primordials;
<add>const { ObjectPrototype, Reflect } = primordials;
<ide>
<ide> const {
<ide> codes: {
<ide> const types = require('internal/util/types');
<ide> const {
<ide> deprecate,
<ide> getSystemErrorName: internalErrorName,
<del> promisify,
<del> uncurryThis
<add> promisify
<ide> } = require('internal/util');
<ide>
<del>const objectToString = uncurryThis(Object.prototype.toString);
<del>
<ide> let internalDeepEqual;
<ide>
<ide> function isBoolean(arg) {
<ide> function isObject(arg) {
<ide> return arg !== null && typeof arg === 'object';
<ide> }
<ide>
<add>function isError(e) {
<add> return ObjectPrototype.toString(e) === '[object Error]' || e instanceof Error;
<add>}
<add>
<ide> function isFunction(arg) {
<ide> return typeof arg === 'function';
<ide> }
<ide> module.exports = {
<ide> isRegExp: types.isRegExp,
<ide> isObject,
<ide> isDate: types.isDate,
<del> isError(e) {
<del> return objectToString(e) === '[object Error]' || e instanceof Error;
<del> },
<add> isError,
<ide> isFunction,
<ide> isPrimitive,
<ide> log,
<ide><path>lib/vm.js
<ide>
<ide> 'use strict';
<ide>
<add>const { Array, ArrayPrototype } = primordials;
<add>
<ide> const {
<ide> ContextifyScript,
<ide> makeContext,
<ide> const {
<ide> const { kVmBreakFirstLineSymbol } = require('internal/util');
<ide> const kParsingContext = Symbol('script parsing context');
<ide>
<del>const ArrayForEach = Function.call.bind(Array.prototype.forEach);
<del>const ArrayIsArray = Array.isArray;
<del>
<ide> class Script extends ContextifyScript {
<ide> constructor(code, options = {}) {
<ide> code = `${code}`;
<ide> function runInThisContext(code, options) {
<ide> function compileFunction(code, params, options = {}) {
<ide> validateString(code, 'code');
<ide> if (params !== undefined) {
<del> if (!ArrayIsArray(params)) {
<add> if (!Array.isArray(params)) {
<ide> throw new ERR_INVALID_ARG_TYPE('params', 'Array', params);
<ide> }
<del> ArrayForEach(params, (param, i) => validateString(param, `params[${i}]`));
<add> ArrayPrototype.forEach(params,
<add> (param, i) => validateString(param, `params[${i}]`));
<ide> }
<ide>
<ide> const {
<ide> function compileFunction(code, params, options = {}) {
<ide> );
<ide> }
<ide> }
<del> if (!ArrayIsArray(contextExtensions)) {
<add> if (!Array.isArray(contextExtensions)) {
<ide> throw new ERR_INVALID_ARG_TYPE(
<ide> 'options.contextExtensions',
<ide> 'Array',
<ide> contextExtensions
<ide> );
<ide> }
<del> ArrayForEach(contextExtensions, (extension, i) => {
<add> ArrayPrototype.forEach(contextExtensions, (extension, i) => {
<ide> if (typeof extension !== 'object') {
<ide> throw new ERR_INVALID_ARG_TYPE(
<ide> `options.contextExtensions[${i}]`,
| 20
|
Javascript
|
Javascript
|
remove some unused code
|
764dc949d0d65742606747ce75852d1b5dd59fcd
|
<ide><path>src/data/Data.js
<ide> Data.accepts = jQuery.acceptData;
<ide>
<ide> Data.prototype = {
<ide>
<del> register: function( owner, initial ) {
<del> var value = initial || {};
<add> register: function( owner ) {
<add> var value = {};
<ide>
<ide> // If it is a node unlikely to be stringify-ed or looped over
<ide> // use plain assignment
<ide> Data.prototype = {
<ide> }
<ide> return owner[ this.expando ];
<ide> },
<del> cache: function( owner, initial ) {
<add> cache: function( owner ) {
<ide>
<ide> // We can accept data for non-element nodes in modern browsers,
<ide> // but we should not, see #8335.
<ide> Data.prototype = {
<ide> }
<ide>
<ide> // If not, register one
<del> return this.register( owner, initial );
<add> return this.register( owner );
<ide> },
<ide> set: function( owner, data, value ) {
<ide> var prop,
<ide> Data.prototype = {
<ide> hasData: function( owner ) {
<ide> var cache = owner[ this.expando ];
<ide> return cache !== undefined && !jQuery.isEmptyObject( cache );
<del> },
<del> discard: function( owner ) {
<del> if ( owner[ this.expando ] ) {
<del> delete owner[ this.expando ];
<del> }
<ide> }
<ide> };
<ide>
| 1
|
Ruby
|
Ruby
|
add hack to deal with warnings
|
d8c0aa88e055c9f08a729827544b186561a6c203
|
<ide><path>actionpack/lib/action_dispatch/testing/assertions/routing.rb
<ide> module Assertions
<ide> # Suite of assertions to test routes generated by \Rails and the handling of requests made to them.
<ide> module RoutingAssertions
<ide> def setup # :nodoc:
<del> @routes = nil
<add> @routes ||= nil
<ide> super
<ide> end
<ide>
| 1
|
Ruby
|
Ruby
|
load the file rather than evaling
|
bc8eaf0f5b90d0af5fa996649a5133953dd45086
|
<ide><path>railties/lib/rails/commands/runner.rb
<ide> exit 1
<ide> elsif File.exist?(code_or_file)
<ide> $0 = code_or_file
<del> eval(File.read(code_or_file), nil, code_or_file)
<add> Kernel.load code_or_file
<ide> else
<ide> eval(code_or_file)
<ide> end
| 1
|
Text
|
Text
|
unify the name of github [ci skip]
|
53b43df3a40e77ceb64c1e3ee8e7190e1ac6d70e
|
<ide><path>guides/source/getting_started.md
<ide> of the files and folders that Rails created by default:
<ide> |test/|Unit tests, fixtures, and other test apparatus. These are covered in [Testing Rails Applications](testing.html).|
<ide> |tmp/|Temporary files (like cache and pid files).|
<ide> |vendor/|A place for all third-party code. In a typical Rails application this includes vendored gems.|
<del>|.gitignore|This file tells git which files (or patterns) it should ignore. See [Github - Ignoring files](https://help.github.com/articles/ignoring-files) for more info about ignoring files.
<add>|.gitignore|This file tells git which files (or patterns) it should ignore. See [GitHub - Ignoring files](https://help.github.com/articles/ignoring-files) for more info about ignoring files.
<ide>
<ide> Hello, Rails!
<ide> -------------
| 1
|
Text
|
Text
|
add markdown for man page of `docker plugin ls`
|
8ee9c635b245941f50f470e7b80f03fbcdf77ed7
|
<ide><path>man/src/plugin/ls.md
<add>Lists all the plugins that are currently installed. You can install plugins
<add>using the `docker plugin install` command.
<add>You can also filter using the `-f` or `--filter` flag.
<add>
<add>## Filters
<add>
<add>Filter output based on these conditions:
<add> - enabled=(true|false) - plugins that are enabled or not
<add> - capability=<string> - filters plugins based on capabilities (currently `volumedriver`, `networkdriver`, `ipamdriver`, or `authz`)
<add>
<add>## Format
<add>
<add> Pretty-print plugins using a Go template.
<add> Valid placeholders:
<add> .ID - Plugin ID.
<add> .Name - Plugin Name.
<add> .Description - Plugin description.
<add> .Enabled - Whether plugin is enabled or not.
<add>
<add># EXAMPLES
<add>## Display all plugins
<add>
<add> $ docker plugin ls
<add> ID NAME DESCRIPTION ENABLED
<add> 869080b57404 tiborvass/sample-volume-plugin:latest A sample volume plugin for Docker true
<add> 141bf6c02ddd vieux/sshfs:latest sshFS plugin for Docker false
<add>
<add>## Display plugins with their ID and names
<add>
<add> $ docker plugin ls --format "{{.ID}}: {{.Name}}"
<add> 869080b57404: tiborvass/sample-volume-plugin:latest
<add>
<add>## Display enabled plugins
<add>
<add> $ docker plugin ls --filter enabled=true
<add> ID NAME DESCRIPTION ENABLED
<add> 869080b57404 tiborvass/sample-volume-plugin:latest A sample volume plugin for Docker true
<add>
<add>## Display plguins with `volumedriver` capability
<add>
<add> $ docker plugin ls --filter capability=volumedriver --format "table {{.ID}}\t{{.Name}}"
<add> ID Name
<add> 869080b57404 tiborvass/sample-volume-plugin:latest
| 1
|
Python
|
Python
|
clarify the need to install an ssh key
|
b49ed7e953ecacc35d42953245e7a95ee72b374c
|
<ide><path>docs/examples/compute/gce/deploy_node.py
<ide> size = [s for s in sizes if s.name == 'e2-micro'][0]
<ide>
<ide> # NOTE: We specify which public key is installed on the instance using
<del># metadata functionality
<add># metadata functionality.
<add># Keep in mind that this step is only needed if you want to install a specific
<add># key which is used to run the deployment script.
<add># If you are using a VM image with a public SSH key already pre-baked in or if
<add># you use project wide ssh-keys GCP functionality, you can remove ex_metadata
<add># argument, but you still need to make sure the private key you use inside this
<add># script matches the one which is installed / available on the server.
<ide> ex_metadata = metadata = {
<ide> 'items': [
<ide> {
| 1
|
Python
|
Python
|
restore changes from nn-beam-parser to spacy/_ml
|
ce321b03225149aaa0d847e9ac4e00fac96ec801
|
<ide><path>spacy/_ml.py
<ide>
<ide> from thinc.neural._classes.convolution import ExtractWindow
<ide> from thinc.neural._classes.static_vectors import StaticVectors
<del>from thinc.neural._classes.batchnorm import BatchNorm as BN
<add>from thinc.neural._classes.batchnorm import BatchNorm
<ide> from thinc.neural._classes.layernorm import LayerNorm as LN
<ide> from thinc.neural._classes.resnet import Residual
<ide> from thinc.neural import ReLu
<ide> def Tok2Vec(width, embed_size, preprocess=None):
<ide> suffix = get_col(cols.index(SUFFIX)) >> HashEmbed(width, embed_size//2, name='embed_suffix')
<ide> shape = get_col(cols.index(SHAPE)) >> HashEmbed(width, embed_size//2, name='embed_shape')
<ide>
<del> embed = (norm | prefix | suffix | shape ) >> LN(Maxout(width, width*4, pieces=3))
<add> embed = (norm | prefix | suffix | shape ) >> Maxout(width, width*4, pieces=3)
<ide> tok2vec = (
<ide> with_flatten(
<ide> asarray(Model.ops, dtype='uint64')
<ide> >> uniqued(embed, column=5)
<ide> >> drop_layer(
<ide> Residual(
<del> (ExtractWindow(nW=1) >> BN(Maxout(width, width*3)))
<add> (ExtractWindow(nW=1) >> ReLu(width, width*3))
<ide> )
<ide> ) ** 4, pad=4
<ide> )
| 1
|
Python
|
Python
|
fix bug in wav2vec2's gpu tests
|
ea118ae2e1ef62e909626f1b5a4487f5d1cb4a55
|
<ide><path>tests/models/wav2vec2/test_modeling_flax_wav2vec2.py
<ide> import inspect
<ide> import math
<ide> import multiprocessing
<add>import os
<add>import traceback
<ide> import unittest
<ide>
<ide> import numpy as np
<ide> require_librosa,
<ide> require_pyctcdecode,
<ide> require_soundfile,
<add> run_test_in_subprocess,
<ide> slow,
<ide> )
<ide>
<ide>
<ide>
<ide> if is_pyctcdecode_available():
<add> import pyctcdecode.decoder
<ide> from transformers import Wav2Vec2ProcessorWithLM
<ide> from transformers.models.wav2vec2_with_lm import processing_wav2vec2_with_lm
<ide>
<ide> import librosa
<ide>
<ide>
<add>def _test_wav2vec2_with_lm_invalid_pool(in_queue, out_queue, timeout):
<add>
<add> error = None
<add> try:
<add> _ = in_queue.get(timeout=timeout)
<add>
<add> ds = load_dataset("common_voice", "es", split="test", streaming=True)
<add> sample = next(iter(ds))
<add>
<add> resampled_audio = librosa.resample(sample["audio"]["array"], 48_000, 16_000)
<add>
<add> model = FlaxWav2Vec2ForCTC.from_pretrained("patrickvonplaten/wav2vec2-large-xlsr-53-spanish-with-lm")
<add> processor = Wav2Vec2ProcessorWithLM.from_pretrained("patrickvonplaten/wav2vec2-large-xlsr-53-spanish-with-lm")
<add>
<add> input_values = processor(resampled_audio, return_tensors="np").input_values
<add>
<add> logits = model(input_values).logits
<add>
<add> # use a spawn pool, which should trigger a warning if different than fork
<add> with CaptureLogger(pyctcdecode.decoder.logger) as cl, multiprocessing.get_context("spawn").Pool(1) as pool:
<add> transcription = processor.batch_decode(np.array(logits), pool).text
<add>
<add> unittest.TestCase().assertIn("Falling back to sequential decoding.", cl.out)
<add> unittest.TestCase().assertEqual(transcription[0], "bien y qué regalo vas a abrir primero")
<add>
<add> # force batch_decode to internally create a spawn pool, which should trigger a warning if different than fork
<add> multiprocessing.set_start_method("spawn", force=True)
<add> with CaptureLogger(processing_wav2vec2_with_lm.logger) as cl:
<add> transcription = processor.batch_decode(np.array(logits)).text
<add>
<add> unittest.TestCase().assertIn("Falling back to sequential decoding.", cl.out)
<add> unittest.TestCase().assertEqual(transcription[0], "bien y qué regalo vas a abrir primero")
<add> except Exception:
<add> error = f"{traceback.format_exc()}"
<add>
<add> results = {"error": error}
<add> out_queue.put(results, timeout=timeout)
<add> out_queue.join()
<add>
<add>
<ide> class FlaxWav2Vec2ModelTester:
<ide> def __init__(
<ide> self,
<ide> def test_wav2vec2_with_lm_pool(self):
<ide>
<ide> # test user-managed pool
<ide> with multiprocessing.get_context("fork").Pool(2) as pool:
<del> transcription = processor.batch_decode(logits.numpy(), pool).text
<add> transcription = processor.batch_decode(np.array(logits), pool).text
<ide>
<ide> self.assertEqual(transcription[0], "bien y qué regalo vas a abrir primero")
<ide>
<ide> # user-managed pool + num_processes should trigger a warning
<ide> with CaptureLogger(processing_wav2vec2_with_lm.logger) as cl, multiprocessing.get_context("fork").Pool(
<ide> 2
<ide> ) as pool:
<del> transcription = processor.batch_decode(logits.numpy(), pool, num_processes=2).text
<add> transcription = processor.batch_decode(np.array(logits), pool, num_processes=2).text
<ide>
<ide> self.assertIn("num_process", cl.out)
<ide> self.assertIn("it will be ignored", cl.out)
<ide> def test_wav2vec2_with_lm_pool(self):
<ide> @require_pyctcdecode
<ide> @require_librosa
<ide> def test_wav2vec2_with_lm_invalid_pool(self):
<del> ds = load_dataset("common_voice", "es", split="test", streaming=True)
<del> sample = next(iter(ds))
<del>
<del> resampled_audio = librosa.resample(sample["audio"]["array"], 48_000, 16_000)
<del>
<del> model = FlaxWav2Vec2ForCTC.from_pretrained("patrickvonplaten/wav2vec2-large-xlsr-53-spanish-with-lm")
<del> processor = Wav2Vec2ProcessorWithLM.from_pretrained("patrickvonplaten/wav2vec2-large-xlsr-53-spanish-with-lm")
<del>
<del> input_values = processor(resampled_audio, return_tensors="np").input_values
<del>
<del> logits = model(input_values).logits
<del>
<del> # change default start method, which should trigger a warning if different than fork
<del> multiprocessing.set_start_method("spawn")
<del> with CaptureLogger(processing_wav2vec2_with_lm.logger) as cl:
<del> transcription = processor.batch_decode(logits.numpy()).text
<del>
<del> self.assertIn("Falling back to sequential decoding.", cl.out)
<del> self.assertEqual(transcription[0], "bien y qué regalo vas a abrir primero")
<add> timeout = os.environ.get("PYTEST_TIMEOUT", 600)
<add> run_test_in_subprocess(
<add> test_case=self, target_func=_test_wav2vec2_with_lm_invalid_pool, inputs=None, timeout=timeout
<add> )
<ide><path>tests/models/wav2vec2/test_modeling_tf_wav2vec2.py
<ide> import inspect
<ide> import math
<ide> import multiprocessing
<add>import os
<add>import traceback
<ide> import unittest
<ide>
<ide> import numpy as np
<ide>
<ide> from huggingface_hub import snapshot_download
<ide> from transformers import Wav2Vec2Config, is_tf_available
<del>from transformers.testing_utils import CaptureLogger, is_flaky, require_librosa, require_pyctcdecode, require_tf, slow
<add>from transformers.testing_utils import (
<add> CaptureLogger,
<add> is_flaky,
<add> require_librosa,
<add> require_pyctcdecode,
<add> require_tf,
<add> run_test_in_subprocess,
<add> slow,
<add>)
<ide> from transformers.utils import is_librosa_available, is_pyctcdecode_available
<ide>
<ide> from ...test_configuration_common import ConfigTester
<ide>
<ide>
<ide> if is_pyctcdecode_available():
<add> import pyctcdecode.decoder
<ide> from transformers import Wav2Vec2ProcessorWithLM
<ide> from transformers.models.wav2vec2_with_lm import processing_wav2vec2_with_lm
<ide>
<ide> import librosa
<ide>
<ide>
<add>def _test_wav2vec2_with_lm_invalid_pool(in_queue, out_queue, timeout):
<add>
<add> error = None
<add> try:
<add> _ = in_queue.get(timeout=timeout)
<add>
<add> downloaded_folder = snapshot_download("patrickvonplaten/common_voice_es_sample")
<add> file_path = glob.glob(downloaded_folder + "/*")[0]
<add> sample = librosa.load(file_path, sr=16_000)[0]
<add>
<add> model = TFWav2Vec2ForCTC.from_pretrained("patrickvonplaten/wav2vec2-large-xlsr-53-spanish-with-lm")
<add> processor = Wav2Vec2ProcessorWithLM.from_pretrained("patrickvonplaten/wav2vec2-large-xlsr-53-spanish-with-lm")
<add>
<add> input_values = processor(sample, return_tensors="tf").input_values
<add>
<add> logits = model(input_values).logits
<add>
<add> # use a spawn pool, which should trigger a warning if different than fork
<add> with CaptureLogger(pyctcdecode.decoder.logger) as cl, multiprocessing.get_context("spawn").Pool(1) as pool:
<add> transcription = processor.batch_decode(logits.numpy(), pool).text
<add>
<add> unittest.TestCase().assertIn("Falling back to sequential decoding.", cl.out)
<add> unittest.TestCase().assertEqual(transcription[0], "el libro ha sido escrito por cervantes")
<add>
<add> # force batch_decode to internally create a spawn pool, which should trigger a warning if different than fork
<add> multiprocessing.set_start_method("spawn", force=True)
<add> with CaptureLogger(processing_wav2vec2_with_lm.logger) as cl:
<add> transcription = processor.batch_decode(logits.numpy()).text
<add>
<add> unittest.TestCase().assertIn("Falling back to sequential decoding.", cl.out)
<add> unittest.TestCase().assertEqual(transcription[0], "el libro ha sido escrito por cervantes")
<add> except Exception:
<add> error = f"{traceback.format_exc()}"
<add>
<add> results = {"error": error}
<add> out_queue.put(results, timeout=timeout)
<add> out_queue.join()
<add>
<add>
<ide> @require_tf
<ide> class TFWav2Vec2ModelTester:
<ide> def __init__(
<ide> def test_wav2vec2_with_lm_pool(self):
<ide> @require_pyctcdecode
<ide> @require_librosa
<ide> def test_wav2vec2_with_lm_invalid_pool(self):
<del> downloaded_folder = snapshot_download("patrickvonplaten/common_voice_es_sample")
<del> file_path = glob.glob(downloaded_folder + "/*")[0]
<del> sample = librosa.load(file_path, sr=16_000)[0]
<del>
<del> model = TFWav2Vec2ForCTC.from_pretrained("patrickvonplaten/wav2vec2-large-xlsr-53-spanish-with-lm")
<del> processor = Wav2Vec2ProcessorWithLM.from_pretrained("patrickvonplaten/wav2vec2-large-xlsr-53-spanish-with-lm")
<del>
<del> input_values = processor(sample, return_tensors="tf").input_values
<del>
<del> logits = model(input_values).logits
<del>
<del> # change default start method, which should trigger a warning if different than fork
<del> multiprocessing.set_start_method("spawn")
<del> with CaptureLogger(processing_wav2vec2_with_lm.logger) as cl:
<del> transcription = processor.batch_decode(logits.numpy()).text
<del>
<del> self.assertIn("Falling back to sequential decoding.", cl.out)
<del> self.assertEqual(transcription[0], "el libro ha sido escrito por cervantes")
<add> timeout = os.environ.get("PYTEST_TIMEOUT", 600)
<add> run_test_in_subprocess(
<add> test_case=self, target_func=_test_wav2vec2_with_lm_invalid_pool, inputs=None, timeout=timeout
<add> )
<ide><path>tests/models/wav2vec2/test_modeling_wav2vec2.py
<ide> import os
<ide> import pickle
<ide> import tempfile
<add>import traceback
<ide> import unittest
<ide>
<ide> import numpy as np
<ide> require_soundfile,
<ide> require_torch,
<ide> require_torchaudio,
<add> run_test_in_subprocess,
<ide> slow,
<ide> torch_device,
<ide> )
<ide>
<ide>
<ide> if is_pyctcdecode_available():
<add> import pyctcdecode.decoder
<ide> from transformers import Wav2Vec2ProcessorWithLM
<ide> from transformers.models.wav2vec2_with_lm import processing_wav2vec2_with_lm
<ide>
<ide> from transformers.utils.fx import symbolic_trace
<ide>
<ide>
<add>def _test_wav2vec2_with_lm_invalid_pool(in_queue, out_queue, timeout):
<add>
<add> error = None
<add> try:
<add> _ = in_queue.get(timeout=timeout)
<add>
<add> ds = load_dataset("common_voice", "es", split="test", streaming=True)
<add> sample = next(iter(ds))
<add>
<add> resampled_audio = torchaudio.functional.resample(
<add> torch.tensor(sample["audio"]["array"]), 48_000, 16_000
<add> ).numpy()
<add>
<add> model = Wav2Vec2ForCTC.from_pretrained("patrickvonplaten/wav2vec2-large-xlsr-53-spanish-with-lm").to(
<add> torch_device
<add> )
<add> processor = Wav2Vec2ProcessorWithLM.from_pretrained("patrickvonplaten/wav2vec2-large-xlsr-53-spanish-with-lm")
<add>
<add> input_values = processor(resampled_audio, return_tensors="pt").input_values
<add>
<add> with torch.no_grad():
<add> logits = model(input_values.to(torch_device)).logits
<add>
<add> # use a spawn pool, which should trigger a warning if different than fork
<add> with CaptureLogger(pyctcdecode.decoder.logger) as cl, multiprocessing.get_context("spawn").Pool(1) as pool:
<add> transcription = processor.batch_decode(logits.cpu().numpy(), pool).text
<add>
<add> unittest.TestCase().assertIn("Falling back to sequential decoding.", cl.out)
<add> unittest.TestCase().assertEqual(transcription[0], "bien y qué regalo vas a abrir primero")
<add>
<add> # force batch_decode to internally create a spawn pool, which should trigger a warning if different than fork
<add> multiprocessing.set_start_method("spawn", force=True)
<add> with CaptureLogger(processing_wav2vec2_with_lm.logger) as cl:
<add> transcription = processor.batch_decode(logits.cpu().numpy()).text
<add>
<add> unittest.TestCase().assertIn("Falling back to sequential decoding.", cl.out)
<add> unittest.TestCase().assertEqual(transcription[0], "bien y qué regalo vas a abrir primero")
<add> except Exception:
<add> error = f"{traceback.format_exc()}"
<add>
<add> results = {"error": error}
<add> out_queue.put(results, timeout=timeout)
<add> out_queue.join()
<add>
<add>
<ide> class Wav2Vec2ModelTester:
<ide> def __init__(
<ide> self,
<ide> def test_wav2vec2_with_lm_pool(self):
<ide>
<ide> # test user-managed pool
<ide> with multiprocessing.get_context("fork").Pool(2) as pool:
<del> transcription = processor.batch_decode(logits.numpy(), pool).text
<add> transcription = processor.batch_decode(logits.cpu().numpy(), pool).text
<ide>
<ide> self.assertEqual(transcription[0], "bien y qué regalo vas a abrir primero")
<ide>
<ide> # user-managed pool + num_processes should trigger a warning
<ide> with CaptureLogger(processing_wav2vec2_with_lm.logger) as cl, multiprocessing.get_context("fork").Pool(
<ide> 2
<ide> ) as pool:
<del> transcription = processor.batch_decode(logits.numpy(), pool, num_processes=2).text
<add> transcription = processor.batch_decode(logits.cpu().numpy(), pool, num_processes=2).text
<ide>
<ide> self.assertIn("num_process", cl.out)
<ide> self.assertIn("it will be ignored", cl.out)
<ide> def test_wav2vec2_with_lm_pool(self):
<ide> @require_pyctcdecode
<ide> @require_torchaudio
<ide> def test_wav2vec2_with_lm_invalid_pool(self):
<del> ds = load_dataset("common_voice", "es", split="test", streaming=True)
<del> sample = next(iter(ds))
<del>
<del> resampled_audio = torchaudio.functional.resample(
<del> torch.tensor(sample["audio"]["array"]), 48_000, 16_000
<del> ).numpy()
<del>
<del> model = Wav2Vec2ForCTC.from_pretrained("patrickvonplaten/wav2vec2-large-xlsr-53-spanish-with-lm").to(
<del> torch_device
<add> timeout = os.environ.get("PYTEST_TIMEOUT", 600)
<add> run_test_in_subprocess(
<add> test_case=self, target_func=_test_wav2vec2_with_lm_invalid_pool, inputs=None, timeout=timeout
<ide> )
<del> processor = Wav2Vec2ProcessorWithLM.from_pretrained("patrickvonplaten/wav2vec2-large-xlsr-53-spanish-with-lm")
<del>
<del> input_values = processor(resampled_audio, return_tensors="pt").input_values
<del>
<del> with torch.no_grad():
<del> logits = model(input_values.to(torch_device)).logits
<del>
<del> # change default start method, which should trigger a warning if different than fork
<del> multiprocessing.set_start_method("spawn")
<del> with CaptureLogger(processing_wav2vec2_with_lm.logger) as cl:
<del> transcription = processor.batch_decode(logits.numpy()).text
<del>
<del> self.assertIn("Falling back to sequential decoding.", cl.out)
<del> self.assertEqual(transcription[0], "el libro ha sido escrito por cervantes")
<ide>
<ide> def test_inference_diarization(self):
<ide> model = Wav2Vec2ForAudioFrameClassification.from_pretrained("anton-l/wav2vec2-base-superb-sd").to(torch_device)
| 3
|
Javascript
|
Javascript
|
remove more attrfn vestiges from events
|
86b775d036627ebd7242fbb4eb9f24e4ba1fa9c5
|
<ide><path>src/event.js
<ide> jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblcl
<ide> this.trigger( name );
<ide> };
<ide>
<del> if ( jQuery.attrFn ) {
<del> jQuery.attrFn[ name ] = true;
<del> }
<del>
<ide> if ( rkeyEvent.test( name ) ) {
<ide> jQuery.event.fixHooks[ name ] = jQuery.event.keyHooks;
<ide> }
| 1
|
Ruby
|
Ruby
|
fix documentation markup [ci skip]
|
9e8b7d9d5bb3537f113fbda2a1720c5f412fbe62
|
<ide><path>actionpack/lib/action_controller/metal/strong_parameters.rb
<ide> def initialize(params) # :nodoc:
<ide> # ActionController::UnpermittedParameters exception. The default value is <tt>:log</tt>
<ide> # in test and development environments, +false+ otherwise.
<ide> #
<add> # Examples:
<add> #
<ide> # params = ActionController::Parameters.new
<ide> # params.permitted? # => false
<ide> #
| 1
|
Python
|
Python
|
add japanese lemmas
|
1987f3f784ca3f701868a402069a773dd7a4f352
|
<ide><path>spacy/lang/ja/__init__.py
<ide> def __call__(self, text):
<ide> for token, dtoken in zip(doc, dtokens):
<ide> token._.mecab_tag = dtoken.pos
<ide> token.tag_ = resolve_pos(dtoken)
<add> token.lemma_ = dtoken.lemma
<ide> return doc
<ide>
<ide> # add dummy methods for to_bytes, from_bytes, to_disk and from_disk to
<ide><path>spacy/tests/conftest.py
<ide> def RU(request):
<ide> pymorphy = pytest.importorskip('pymorphy2')
<ide> return util.get_lang_class('ru')()
<ide>
<add>@pytest.fixture()
<add>def JA(request):
<add> mecab = pytest.importorskip("MeCab")
<add> return util.get_lang_class('ja')()
<add>
<ide>
<ide> #@pytest.fixture(params=_languages)
<ide> #def tokenizer(request):
<ide> def da_tokenizer():
<ide>
<ide> @pytest.fixture
<ide> def ja_tokenizer():
<del> janome = pytest.importorskip("MeCab")
<add> mecab = pytest.importorskip("MeCab")
<ide> return util.get_lang_class('ja').Defaults.create_tokenizer()
<ide>
<ide> @pytest.fixture
<ide><path>spacy/tests/lang/ja/test_lemma.py
<add># coding: utf-8
<add>from __future__ import unicode_literals
<add>
<add>import pytest
<add>
<add>LEMMAS = (
<add> ('新しく', '新しい'),
<add> ('赤く', '赤い'),
<add> ('すごく', '凄い'),
<add> ('いただきました', '頂く'),
<add> ('なった', '成る'))
<add>
<add>@pytest.mark.parametrize('word,lemma', LEMMAS)
<add>def test_japanese_lemmas(JA, word, lemma):
<add> test_lemma = JA(word)[0].lemma_
<add> assert test_lemma == lemma
<add>
<add>
| 3
|
Ruby
|
Ruby
|
remove unused requires
|
d0bd3cdc06853be4de33dcf48c23730e25792f16
|
<ide><path>activesupport/lib/active_support/callbacks.rb
<ide> require "active_support/descendants_tracker"
<ide> require "active_support/core_ext/array/extract_options"
<ide> require "active_support/core_ext/class/attribute"
<del>require "active_support/core_ext/kernel/reporting"
<del>require "active_support/core_ext/kernel/singleton_class"
<ide> require "active_support/core_ext/string/filters"
<ide> require "thread"
<ide>
| 1
|
Text
|
Text
|
add v3.25.0-beta.2 to changelog
|
ce0b37a81fb7eb0b4f43f8728a8ea4288ff5be57
|
<ide><path>CHANGELOG.md
<ide> # Ember Changelog
<ide>
<add>### v3.25.0-beta.2 (January 19, 2020)
<add>
<add>- [#19339](https://github.com/emberjs/ember.js/pull/19339) [DEPRECATION] Deprecate importing `htmlSafe` and `isHTMLSafe` from `@ember/string` per the [Deprecate Ember String RFC](https://github.com/emberjs/rfcs/blob/master/text/0236-deprecation-ember-string.md).
<add>- [#19336](https://github.com/emberjs/ember.js/pull/19336) [BUGFIX] Ensure Component Lookup Is Well Formed
<add>- [#19337](https://github.com/emberjs/ember.js/pull/19337) [BUGFIX] Ensure query param only <LinkTo /> are properly scoped in engines.
<add>- [#19338](https://github.com/emberjs/ember.js/pull/19338) [BUGFIX] Add missing `deprecate` options (`for` + `since`)
<add>- [#19342](https://github.com/emberjs/ember.js/pull/19342) [BUGFIX] Fix misleading LinkTo error message
<add>
<ide> ### v3.25.0-beta.1 (December 28, 2020)
<ide>
<ide> - [#19302](https://github.com/emberjs/ember.js/pull/19302) / [#19306](https://github.com/emberjs/ember.js/pull/19306) / [#19319](https://github.com/emberjs/ember.js/pull/19319) [FEATURE] Implement the [Handlebars Strict Mode RFC](https://github.com/emberjs/rfcs/blob/master/text/0496-handlebars-strict-mode.md).
| 1
|
Python
|
Python
|
update ndarray.shape property documention
|
6a5e6188d938091ca1c335ae5f736b563bdca245
|
<ide><path>numpy/add_newdocs.py
<ide> def luf(lamdaexpr, *args, **kwargs):
<ide> """
<ide> Tuple of array dimensions.
<ide>
<del> As with `numpy.reshape`, one shape dimension can be -1. In this case, the value is
<del> inferred from the length of the array and remaining dimensions.
<del> Notes
<del> -----
<del> May be used to "reshape" the array, as long as this would not
<del> require a change in the total number of elements
<del> Using `numpy.reshape` or `ndarray.reshape` should always be preferred.
<del> Setting the shape directly is not really a safe thing to do.
<add> The shape property is usually used to get the current shape of an array,
<add> but may also be used to reshape the array in-place by assigning a tuple of
<add> array dimensions to it. As with `numpy.reshape`, one of the new shape
<add> dimensions can be -1, in which case its value is inferred from the size of
<add> the array and the remaining dimensions. Reshaping an array in-place will
<add> fail if a copy is required.
<add>
<ide> Examples
<ide> --------
<ide> >>> x = np.array([1, 2, 3, 4])
<ide> def luf(lamdaexpr, *args, **kwargs):
<ide> Traceback (most recent call last):
<ide> File "<stdin>", line 1, in <module>
<ide> ValueError: total size of new array must be unchanged
<add> >>> np.zeros((4,2))[::2].shape = (-1,)
<add> Traceback (most recent call last):
<add> File "<stdin>", line 1, in <module>
<add> AttributeError: incompatible shape for a non-contiguous array
<add>
<ide> See Also
<ide> --------
<del> numpy.reshape : equivalent function
<del> ndarray.reshape : equivalent function
<add> numpy.reshape : similar function
<add> ndarray.reshape : similar method
<ide>
<ide> """))
<ide>
| 1
|
PHP
|
PHP
|
fix failing tests
|
7db043385514043f77cf5b4875ee174e418616e3
|
<ide><path>tests/TestCase/Error/ExceptionRendererTest.php
<ide> public function testControllerInstanceForPrefixedRequest()
<ide> $request = new ServerRequest();
<ide> $request = $request
<ide> ->withParam('controller', 'Articles')
<del> ->withParam('prefix', 'admin');
<add> ->withParam('prefix', 'Admin');
<ide>
<ide> $ExceptionRenderer = new MyCustomExceptionRenderer($exception, $request);
<ide>
<ide> public function testTemplatePath()
<ide> $this->assertSame('error400', $controller->viewBuilder()->getTemplate());
<ide> $this->assertSame('Error', $controller->viewBuilder()->getTemplatePath());
<ide>
<del> $request = $request->withParam('prefix', 'admin');
<add> $request = $request->withParam('prefix', 'Admin');
<ide> $exception = new MissingActionException(['controller' => 'Foo', 'action' => 'bar']);
<ide>
<ide> $ExceptionRenderer = new ExceptionRenderer($exception, $request);
| 1
|
Ruby
|
Ruby
|
add test script to extract version from url/path
|
d2b2ecbd0b719e0839b51e3a83bedb5686faf84b
|
<ide><path>Library/Homebrew/test/get_version.rb
<add>#!/usr/bin/ruby
<add>$:.push(File.expand_path(__FILE__+'/../..'))
<add>require 'extend/pathname'
<add>
<add>p = Pathname.new(ARGV[0])
<add>v = p.version
<add>puts v
| 1
|
Text
|
Text
|
fix broken link on componentwillreceiveprops tip
|
4a9ed4a204524afd6c6bad0d1ff50b2d6464f065
|
<ide><path>docs/tips/09-componentWillReceiveProps-not-triggered-after-mounting.md
<ide> prev: controlled-input-null-value.html
<ide> next: props-in-getInitialState-as-anti-pattern.html
<ide> ---
<ide>
<del>`componentWillReceiveProps` isn't triggered after the node is put on scene. This is by design. Check out [other lifecycle methods](/react/docs/tips/component-specs.html) for the one that suits your needs.
<add>`componentWillReceiveProps` isn't triggered after the node is put on scene. This is by design. Check out [other lifecycle methods](/react/docs/component-specs.html) for the one that suits your needs.
<ide>
<ide> The reason for that is because `componentWillReceiveProps` often handles the logic of comparing with the old props and acting upon changes; not triggering it at mounting (where there are no old props) helps in defining what the method does.
| 1
|
Python
|
Python
|
fix import error in python 2.5
|
d1f88a739d1309ffc283db91a3f1e939f7882052
|
<ide><path>celery/app/__init__.py
<ide> from .. import registry
<ide> from ..utils import cached_property, instantiate
<ide>
<del>from . import annotations
<del>from . import base
<add>from .annotations import _first_match, _first_match_any
<add>from .base import BaseApp
<ide>
<ide>
<ide> class _TLS(threading.local):
<ide> def _unpickle_app(cls, pickler, *args):
<ide> return pickler()(cls, *args)
<ide>
<ide>
<del>class App(base.BaseApp):
<add>class App(BaseApp):
<ide> """Celery Application.
<ide>
<ide> :param main: Name of the main module if running as `__main__`.
<ide> def _create_task_cls(fun):
<ide>
<ide> def annotate_task(self, task):
<ide> if self.annotations:
<del> match = annotations._first_match(self.annotations, task)
<add> match = _first_match(self.annotations, task)
<ide> for attr, value in (match or {}).iteritems():
<ide> setattr(task, attr, value)
<del> match_any = annotations._first_match_any(self.annotations)
<add> match_any = _first_match_any(self.annotations)
<ide> for attr, value in (match_any or {}).iteritems():
<ide> setattr(task, attr, value)
<ide>
| 1
|
Text
|
Text
|
fix documentation link in basic api routes example
|
89b69865fb2a41d65a8e827ea829f2ff8ce83a1f
|
<ide><path>examples/api-routes/README.md
<ide> # Basic API routes example
<ide>
<del>Next.js ships with [API routes](https://github.com/zeit/next.js#api-routes) which provides an easy solution to build your own `API`. This example shows how to create multiple `API` endpoints with serverless functions, which can execute independently.
<add>Next.js ships with [API routes](https://nextjs.org/docs/api-routes/introduction) which provides an easy solution to build your own `API`. This example shows how to create multiple `API` endpoints with serverless functions, which can execute independently.
<ide>
<ide> ## Deploy your own
<ide>
| 1
|
Javascript
|
Javascript
|
use right require path
|
d877872c71cbb11fe9a13290d58858cf164902c8
|
<ide><path>static/index.js
<ide> window.onload = function() {
<ide> require('coffee-script').register();
<ide> require(path.resolve(__dirname, '..', 'src', 'coffee-cache')).register();
<ide>
<del> ModuleCache = require('./module-cache');
<add> ModuleCache = require(path.resolve(__dirname, '..', 'src', 'module-cache'));
<ide> ModuleCache.add(loadSettings.resourcePath);
<ide> ModuleCache.register();
<ide>
| 1
|
Text
|
Text
|
add @willkg for thanks!
|
0fa9866848238ed355461a619e5aa9a148403f5f
|
<ide><path>docs/topics/credits.md
<ide> The following people have helped make REST framework great.
<ide> * Gertjan Oude Lohuis - [gertjanol]
<ide> * Matthias Jacob - [cyroxx]
<ide> * Pavel Zinovkin - [pzinovkin]
<add>* Will Kahn-Greene - [willkg]
<ide>
<ide> Many thanks to everyone who's contributed to the project.
<ide>
<ide> You can also contact [@_tomchristie][twitter] directly on twitter.
<ide> [gertjanol]: https://github.com/gertjanol
<ide> [cyroxx]: https://github.com/cyroxx
<ide> [pzinovkin]: https://github.com/pzinovkin
<add>[willkg]: https://github.com/willkg
| 1
|
Text
|
Text
|
add talkdesk as a user of airflow 😁
|
f2bd15da534c8a6ff802fe87992d1603737948e2
|
<ide><path>INTHEWILD.md
<ide> Currently, **officially** using Airflow:
<ide> 1. [Syapse](https://www.syapse.com/) [[@zedmor](https://github.com/zedmor)]
<ide> 1. [T2 Systems](http://t2systems.com) [[@unclaimedpants](https://github.com/unclaimedpants)]
<ide> 1. [Tails.com](https://tails.com/) [[@alanmcruickshank](https://github.com/alanmcruickshank)]
<add>1. [Talkdesk](https://www.talkdesk.com)
<ide> 1. [TEK](https://www.tek.fi/en) [[@telac](https://github.com/telac)]
<ide> 1. [Telefonica Innovation Alpha](https://www.alpha.company/) [[@Alpha-Health](https://github.com/Alpha-health)]
<ide> 1. [Telia Company](https://www.teliacompany.com/en)
| 1
|
Text
|
Text
|
add v4.0.0 to changelog
|
c4dd6eeb191d94c53a27a77b8f3eb841d604c2f0
|
<ide><path>CHANGELOG.md
<ide> # Ember Changelog
<ide>
<del>### v4.0.0-beta.10 (November 15, 2021)
<del>
<del>- [#19833](https://github.com/emberjs/ember.js/pull/19833) [CLEANUP] Remove deprecated array observers
<del>- [#19836](https://github.com/emberjs/ember.js/pull/19836) [CLEANUP] Turn `template-only-glimmer-components` deprecation into an error
<del>- [#19843](https://github.com/emberjs/ember.js/pull/19843) [CLEANUP] Turn `argument-less-helper-paren-less-invocation` deprecation into an error
<del>
<del>### v4.0.0-beta.9 (November 10, 2021)
<del>
<del>- [#19749](https://github.com/emberjs/ember.js/pull/19749) [CLEANUP] Remove `deprecate-router-events` support code
<del>- [#19762](https://github.com/emberjs/ember.js/pull/19762) [CLEANUP] Update GlimmerVM to 0.81
<del> - removes deprecation of mutations during helper compute
<del> - removes deprecation of mutations during unknownProperty
<del> - `@glimmer/integration-tests`, `@glimmer/manager`, `@glimmer/validator`
<del> * [#1330](https://github.com/glimmerjs/glimmer-vm/pull/1330) Remove deprecated support for mutation after consumption during certain manager hooks ([@snewcomer](https://github.com/snewcomer))
<del> - `@glimmer/manager`
<del> * [#1328](https://github.com/glimmerjs/glimmer-vm/pull/1328) Remove deprecated Component Manager version 3.4 ([@nlfurniss](https://github.com/nlfurniss))
<del> - `@glimmer/integration-tests`, `@glimmer/manager`
<del> * [#1329](https://github.com/glimmerjs/glimmer-vm/pull/1329) Remove deprecated Modifier Manager version 3.13 ([@nlfurniss](https://github.com/nlfurniss))
<del>- [#19806](https://github.com/emberjs/ember.js/pull/19806) [CLEANUP] Drop export of built-ins, remove legacy components
<del>
<del>### v4.0.0-beta.8 (November 5, 2021)
<del>
<del>- [#19823](https://github.com/emberjs/ember.js/pull/19823) / [#19828](https://github.com/emberjs/ember.js/pull/19828) [BUGFIX] Fix deprecation `until` and link for Component.reopenClass and Component.reopen
<del>- [#19825](https://github.com/emberjs/ember.js/pull/19825) [BUGFIX] Replace `assert.equal` in blueprints with `assert.strictEqual` to pass eslint-plugin-qunit v7 on generation
<del>- [#19808](https://github.com/emberjs/ember.js/pull/19808) [CLEANUP] Remove the `--test-type` option from the helper blueprint
<del>- [#19820](https://github.com/emberjs/ember.js/pull/19820) Fix memory leak when looking up non-instantiable objects from the owner
<del>
<del>### v4.0.0-beta.7 (November 1, 2021)
<del>
<del>- [#19677](https://github.com/emberjs/ember.js/pull/19677) [CLEANUP] Remove jQuery from build
<del>
<del>### v4.0.0-beta.6 (October 26, 2021)
<del>
<del>- [#19799](https://github.com/emberjs/ember.js/pull/19799) / [glimmerjs/glimmer-vm#1354](https://github.com/glimmerjs/glimmer-vm/pull/1354) Fixes for errors while precompiling inline templates (introduced in 3.28.2)
<del>
<del>### v4.0.0-beta.5 (October 11, 2021)
<add>### v4.0.0 (November 15, 2021)
<ide>
<ide> - [#19761](https://github.com/emberjs/ember.js/pull/19761) [BREAKING] Require ember-auto-import >= 2 or higher to enable ember-source to become a v2 addon in the 4.x cycle
<del>
<del>### v4.0.0-beta.4 (September 13, 2021)
<del>
<del>- [#19733](https://github.com/emberjs/ember.js/pull/19733) [BUGFIX] Ensure that using `routerService.urlFor(...)` and `routerService.recognize(...)` does not error if the router is not fully initialized
<del>
<del>### v4.0.0-beta.3 (August 30, 2021)
<del>
<del>- [#19708](https://github.com/emberjs/ember.js/pull/19708) [CLEANUP] Remove class-binding-and-class-name-bindings-in-templates
<del>
<del>### v4.0.0-beta.2 (August 23, 2021)
<del>
<add>- [#19706](https://github.com/emberjs/ember.js/pull/19706) [BREAKING] Explicitly drop Node 10 support to match support policy.
<add>- [BREAKING] Remove deprecated features
<add> - [#19838](https://github.com/emberjs/ember.js/pull/19838) [CLEANUP] Remove check to see if `ember` is defined as a Bower dependency
<add> - [#19846](https://github.com/emberjs/ember.js/pull/19846) [CLEANUP] Make using the "classic" edition of Ember throw
<add> - [#19833](https://github.com/emberjs/ember.js/pull/19833) [CLEANUP] Remove deprecated array observers
<add> - [#19836](https://github.com/emberjs/ember.js/pull/19836) [CLEANUP] Turn `template-only-glimmer-components` deprecation into an error
<add> - [#19843](https://github.com/emberjs/ember.js/pull/19843) [CLEANUP] Turn `argument-less-helper-paren-less-invocation` deprecation into an error
<add> - [#19749](https://github.com/emberjs/ember.js/pull/19749) [CLEANUP] Remove `deprecate-router-events` support code
<add> - [#19762](https://github.com/emberjs/ember.js/pull/19762) [CLEANUP] Update GlimmerVM to 0.81
<add> - removes deprecation of mutations during helper compute
<add> - removes deprecation of mutations during unknownProperty
<add> - `@glimmer/integration-tests`, `@glimmer/manager`, `@glimmer/validator`
<add> * [#1330](https://github.com/glimmerjs/glimmer-vm/pull/1330) Remove deprecated support for mutation after consumption during certain manager hooks ([@snewcomer](https://github.com/snewcomer))
<add> - `@glimmer/manager`
<add> * [#1328](https://github.com/glimmerjs/glimmer-vm/pull/1328) Remove deprecated Component Manager version 3.4 ([@nlfurniss](https://github.com/nlfurniss))
<add> - `@glimmer/integration-tests`, `@glimmer/manager`
<add> * [#1329](https://github.com/glimmerjs/glimmer-vm/pull/1329) Remove deprecated Modifier Manager version 3.13 ([@nlfurniss](https://github.com/nlfurniss))
<add> - [#19806](https://github.com/emberjs/ember.js/pull/19806) [CLEANUP] Drop export of built-ins, remove legacy components
<add> - [#19808](https://github.com/emberjs/ember.js/pull/19808) [CLEANUP] Remove the `--test-type` option from the helper blueprint
<add> - [#19677](https://github.com/emberjs/ember.js/pull/19677) [CLEANUP] Remove jQuery from build
<add> - [#19708](https://github.com/emberjs/ember.js/pull/19708) [CLEANUP] Remove class-binding-and-class-name-bindings-in-templates
<add> - [#19650](https://github.com/emberjs/ember.js/pull/19650) [CLEANUP] Remove deprecated mouse events
<add> - [#19675](https://github.com/emberjs/ember.js/pull/19675) [CLEANUP] Remove jQuery usage from ember-testing
<add> - [#19704](https://github.com/emberjs/ember.js/pull/19704) [CLEANUP] Remove template-compiler.registerPlugin
<add> - [#19707](https://github.com/emberjs/ember.js/pull/19707) [CLEANUP] Remove Application Controller Router Properties
<add> - [#19528](https://github.com/emberjs/ember.js/pull/19528) [CLEANUP] Remove Logger
<add> - [#19558](https://github.com/emberjs/ember.js/pull/19558) [CLEANUP] Remove IE11 support
<add> - [#19563](https://github.com/emberjs/ember.js/pull/19563) [CLEANUP] Remove internal Ember.assign usage
<add> - [#19636](https://github.com/emberjs/ember.js/pull/19636) [CLEANUP] Remove copy & Copyable
<add> - [#19638](https://github.com/emberjs/ember.js/pull/19638) [CLEANUP] Remove deprecated with
<add> - [#19639](https://github.com/emberjs/ember.js/pull/19639) [CLEANUP] Removes deprecated Private INVOKE API
<add> - [#19640](https://github.com/emberjs/ember.js/pull/19640) [CLEANUP] Remove old deprecations import path
<add> - [#19641](https://github.com/emberjs/ember.js/pull/19641) [CLEANUP] Remove isVisible
<add> - [#19642](https://github.com/emberjs/ember.js/pull/19642) [CLEANUP] Remove aliasMethod
<add> - [#19643](https://github.com/emberjs/ember.js/pull/19643) [CLEANUP] Remove deprecate without for and since
<add> - [#19644](https://github.com/emberjs/ember.js/pull/19644) [CLEANUP] Remove -in-element
<add> - [#19645](https://github.com/emberjs/ember.js/pull/19645) [CLEANUP] Remove tryInvoke
<add> - [#19646](https://github.com/emberjs/ember.js/pull/19646) [CLEANUP] Remove loc
<add> - [#19647](https://github.com/emberjs/ember.js/pull/19647) [CLEANUP] Remove Ember.merge
<add> - [#19648](https://github.com/emberjs/ember.js/pull/19648) [CLEANUP] Remove getWithDefault
<add> - [#19651](https://github.com/emberjs/ember.js/pull/19651) [CLEANUP] Remove LEGACY_OWNER
<add> - [#19652](https://github.com/emberjs/ember.js/pull/19652) [CLEANUP] Remove Globals Resolver
<add> - [#19653](https://github.com/emberjs/ember.js/pull/19653) [CLEANUP] Remove run and computed dot access
<add> - [#19654](https://github.com/emberjs/ember.js/pull/19654) [CLEANUP] Remove @ember/string methods from native prototype
<add> - [#19655](https://github.com/emberjs/ember.js/pull/19655) [CLEANUP] Remove meta-destruction-apis
<add> - [#19656](https://github.com/emberjs/ember.js/pull/19656) [CLEANUP] Remove string-based setComponentManager
<add> - [#19657](https://github.com/emberjs/ember.js/pull/19657) [CLEANUP] Remove hasBlock and hasBlockParams
<add> - [#19658](https://github.com/emberjs/ember.js/pull/19658) [CLEANUP] Remove sendAction and string action passing
<add> - [#19659](https://github.com/emberjs/ember.js/pull/19659) [CLEANUP] Remove renderTemplate, disconnectOutlet, render
<add> - [#19660](https://github.com/emberjs/ember.js/pull/19660) [CLEANUP] Remove attrs/attrs-arg-access
<add> - [#19661](https://github.com/emberjs/ember.js/pull/19661) [CLEANUP] Remove EMBER_EXTEND_PROTOTYPES
<add> - [#19663](https://github.com/emberjs/ember.js/pull/19663) [CLEANUP] Remove function prototype extensions
<add> - [#19665](https://github.com/emberjs/ember.js/pull/19665) [CLEANUP] Remove deprecated jQuery integration
<add> - [#19666](https://github.com/emberjs/ember.js/pull/19666) [CLEANUP] Remove jQuery integration in EventDispatcher
<add> - [#19667](https://github.com/emberjs/ember.js/pull/19667) [CLEANUP] Cleanup IE11 leftovers
<add> - [#19670](https://github.com/emberjs/ember.js/pull/19670) [CLEANUP] Remove .volatile()
<add> - [#19671](https://github.com/emberjs/ember.js/pull/19671) [CLEANUP] Remove .property()
<add> - [#19673](https://github.com/emberjs/ember.js/pull/19673) [CLEANUP] Remove computed deep each
<add> - [#19674](https://github.com/emberjs/ember.js/pull/19674) [CLEANUP] Remove ability to override computed property
<add> - [#19678](https://github.com/emberjs/ember.js/pull/19678) [CLEANUP] Remove window.Ember global
<add> - [#19695](https://github.com/emberjs/ember.js/pull/19695) [CLEANUP] Remove {{partial}}
<add> - [#19691](https://github.com/emberjs/ember.js/pull/19691) Add build assertion against `{{outlet named}}`
<ide> - [#19680](https://github.com/emberjs/ember.js/pull/19680) [DEPRECATION] Deprecate owner.inject per [RFC #680](https://github.com/emberjs/rfcs/blob/sn/owner-inject-deprecation/text/0680-implicit-injection-deprecation.md#1-deprecate-implicit-injection-on-target-object) and cleanup related deprecations that are `until: 4.0.0`.
<del>- [#19706](https://github.com/emberjs/ember.js/pull/19706) [BUGFIX] Explicitly drop Node 10 support to match support policy.
<del>- [#19650](https://github.com/emberjs/ember.js/pull/19650) [CLEANUP] Remove deprecated mouse events
<del>- [#19675](https://github.com/emberjs/ember.js/pull/19675) [CLEANUP] Remove jQuery usage from ember-testing
<del>- [#19704](https://github.com/emberjs/ember.js/pull/19704) [CLEANUP] Remove template-compiler.registerPlugin
<del>- [#19707](https://github.com/emberjs/ember.js/pull/19707) [CLEANUP] Remove Application Controller Router Properties
<del>
<del>### v4.0.0-beta.1 (August 17, 2021)
<del>
<ide> - [#19649](https://github.com/emberjs/ember.js/pull/19649) / [#19692](https://github.com/emberjs/ember.js/pull/19692) [DEPRECATION] Add deprecation warning to Ember.assign implementing [RFC #750](https://github.com/emberjs/rfcs/blob/master/text/0750-deprecate-ember-assign.md).
<add>- [#19825](https://github.com/emberjs/ember.js/pull/19825) [BUGFIX] Replace `assert.equal` in blueprints with `assert.strictEqual` to pass eslint-plugin-qunit v7 on generation
<ide> - [#19227](https://github.com/emberjs/ember.js/pull/19227) [BUGFIX] Enable global event dispatcher listeners to be lazily created fixing Passive Listener Violation in Chrome
<ide> - [#19542](https://github.com/emberjs/ember.js/pull/19542) [BUGFIX] Fix initializer test blueprints
<ide> - [#19589](https://github.com/emberjs/ember.js/pull/19589) [BUGFIX] Don’t include type-tests in build output
<del>- [#19528](https://github.com/emberjs/ember.js/pull/19528) [CLEANUP] Remove Logger
<del>- [#19558](https://github.com/emberjs/ember.js/pull/19558) [CLEANUP] Remove IE11 support
<del>- [#19563](https://github.com/emberjs/ember.js/pull/19563) [CLEANUP] Remove internal Ember.assign usage
<del>- [#19636](https://github.com/emberjs/ember.js/pull/19636) [CLEANUP] Remove copy & Copyable
<del>- [#19638](https://github.com/emberjs/ember.js/pull/19638) [CLEANUP] Remove deprecated with
<del>- [#19639](https://github.com/emberjs/ember.js/pull/19639) [CLEANUP] Removes deprecated Private INVOKE API
<del>- [#19640](https://github.com/emberjs/ember.js/pull/19640) [CLEANUP] Remove old deprecations import path
<del>- [#19641](https://github.com/emberjs/ember.js/pull/19641) [CLEANUP] Remove isVisible
<del>- [#19642](https://github.com/emberjs/ember.js/pull/19642) [CLEANUP] Remove aliasMethod
<del>- [#19643](https://github.com/emberjs/ember.js/pull/19643) [CLEANUP] Remove deprecate without for and since
<del>- [#19644](https://github.com/emberjs/ember.js/pull/19644) [CLEANUP] Remove -in-element
<del>- [#19645](https://github.com/emberjs/ember.js/pull/19645) [CLEANUP] Remove tryInvoke
<del>- [#19646](https://github.com/emberjs/ember.js/pull/19646) [CLEANUP] Remove loc
<del>- [#19647](https://github.com/emberjs/ember.js/pull/19647) [CLEANUP] Remove Ember.merge
<del>- [#19648](https://github.com/emberjs/ember.js/pull/19648) [CLEANUP] Remove getWithDefault
<del>- [#19651](https://github.com/emberjs/ember.js/pull/19651) [CLEANUP] Remove LEGACY_OWNER
<del>- [#19652](https://github.com/emberjs/ember.js/pull/19652) [CLEANUP] Remove Globals Resolver
<del>- [#19653](https://github.com/emberjs/ember.js/pull/19653) [CLEANUP] Remove run and computed dot access
<del>- [#19654](https://github.com/emberjs/ember.js/pull/19654) [CLEANUP] Remove @ember/string methods from native prototype
<del>- [#19655](https://github.com/emberjs/ember.js/pull/19655) [CLEANUP] Remove meta-destruction-apis
<del>- [#19656](https://github.com/emberjs/ember.js/pull/19656) [CLEANUP] Remove string-based setComponentManager
<del>- [#19657](https://github.com/emberjs/ember.js/pull/19657) [CLEANUP] Remove hasBlock and hasBlockParams
<del>- [#19658](https://github.com/emberjs/ember.js/pull/19658) [CLEANUP] Remove sendAction and string action passing
<del>- [#19659](https://github.com/emberjs/ember.js/pull/19659) [CLEANUP] Remove renderTemplate, disconnectOutlet, render
<del>- [#19660](https://github.com/emberjs/ember.js/pull/19660) [CLEANUP] Remove attrs/attrs-arg-access
<del>- [#19661](https://github.com/emberjs/ember.js/pull/19661) [CLEANUP] Remove EMBER_EXTEND_PROTOTYPES
<del>- [#19663](https://github.com/emberjs/ember.js/pull/19663) [CLEANUP] Remove function prototype extensions
<del>- [#19665](https://github.com/emberjs/ember.js/pull/19665) [CLEANUP] Remove deprecated jQuery integration
<del>- [#19666](https://github.com/emberjs/ember.js/pull/19666) [CLEANUP] Remove jQuery integration in EventDispatcher
<del>- [#19667](https://github.com/emberjs/ember.js/pull/19667) [CLEANUP] Cleanup IE11 leftovers
<del>- [#19670](https://github.com/emberjs/ember.js/pull/19670) [CLEANUP] Remove .volatile()
<del>- [#19671](https://github.com/emberjs/ember.js/pull/19671) [CLEANUP] Remove .property()
<del>- [#19673](https://github.com/emberjs/ember.js/pull/19673) [CLEANUP] Remove computed deep each
<del>- [#19674](https://github.com/emberjs/ember.js/pull/19674) [CLEANUP] Remove ability to override computed property
<del>- [#19678](https://github.com/emberjs/ember.js/pull/19678) [CLEANUP] Remove window.Ember global
<del>- [#19695](https://github.com/emberjs/ember.js/pull/19695) [CLEANUP] Remove {{partial}}
<del>- [#19691](https://github.com/emberjs/ember.js/pull/19691) Add build assertion against `{{outlet named}}`
<ide>
<ide> ## v3.28.6 (November 4, 2021)
<ide>
| 1
|
Javascript
|
Javascript
|
fix dead link in comment
|
b4b8b73a9b548caa51163412cbd6834269df98a9
|
<ide><path>Libraries/Blob/URL.js
<ide> if (
<ide> * ```
<ide> */
<ide>
<del>// Small subset from whatwg-url: https://github.com/jsdom/whatwg-url/tree/master/lib
<add>// Small subset from whatwg-url: https://github.com/jsdom/whatwg-url/tree/master/src
<ide> // The reference code bloat comes from Unicode issues with URLs, so those won't work here.
<ide> export class URLSearchParams {
<ide> _searchParams = [];
| 1
|
Python
|
Python
|
add 'steps' into template_fields in emraddsteps
|
0e7d8aae9767c3e924a84c3cdbb88d3c459a2a83
|
<ide><path>airflow/contrib/operators/emr_add_steps_operator.py
<ide> class EmrAddStepsOperator(BaseOperator):
<ide> :param steps: boto3 style steps to be added to the jobflow
<ide> :type steps: list
<ide> """
<del> template_fields = ['job_flow_id']
<add> template_fields = ['job_flow_id', 'steps']
<ide> template_ext = ()
<ide> ui_color = '#f9c915'
<ide>
| 1
|
PHP
|
PHP
|
fix typo in manager.php
|
06c897cc683495cab67a81d4bdd180d9f554dd85
|
<ide><path>src/Illuminate/Support/Manager.php
<ide> public function driver($driver = null)
<ide> $driver = $driver ?: $this->getDefaultDriver();
<ide>
<ide> // If the given driver has not been created before, we will create the instances
<del> // here and cache it so we can return it next time very quickly. If their is
<add> // here and cache it so we can return it next time very quickly. If there is
<ide> // already a driver created by this name, we'll just return that instance.
<ide> if ( ! isset($this->drivers[$driver]))
<ide> {
| 1
|
Text
|
Text
|
add redirects for old docker cloud tutorial
|
94336cb5dd7bce9f34901a86000a124a6d6c68ef
|
<ide><path>docs/userguide/eng-image/dockerfile_best-practices.md
<ide> <!--[metadata]>
<ide> +++
<del>aliases = ["/engine/articles/dockerfile_best-practices/"]
<add>aliases = ["/engine/articles/dockerfile_best-practices/", "/docker-cloud/getting-started/intermediate/optimize-dockerfiles/", "/docker-cloud/tutorials/optimize-dockerfiles/"]
<ide> title = "Best practices for writing Dockerfiles"
<ide> description = "Hints, tips and guidelines for writing clean, reliable Dockerfiles"
<ide> keywords = ["Examples, Usage, base image, docker, documentation, dockerfile, best practices, hub, official repo"]
| 1
|
Java
|
Java
|
fix javadoc references to incorrect xml
|
838ba79f558c0d8fca84c2b8bd6d98c0e72dee0f
|
<ide><path>spring-context/src/main/java/org/springframework/scheduling/annotation/EnableAsync.java
<ide> * <pre class="code">
<ide> * {@code
<ide> * <beans>
<del> * <task:annotation-config executor="myExecutor"/>
<add> * <task:annotation-driven executor="myExecutor"/>
<ide> * <task:executor id="myExecutor" pool-size="7-42" queue-capacity="11"/>
<ide> * <bean id="asyncBean" class="com.foo.MyAsyncBean"/>
<ide> * </beans>
<ide><path>spring-context/src/main/java/org/springframework/scheduling/annotation/EnableScheduling.java
<ide> * <pre class="code">
<ide> * {@code
<ide> * <beans>
<del> * <task:annotation-config scheduler="taskScheduler"/>
<add> * <task:annotation-driven scheduler="taskScheduler"/>
<ide> * <task:scheduler id="taskScheduler" pool-size="42"/>
<ide> * <task:scheduled ref="myTask" method="work" fixed-rate="1000"/>
<ide> * <bean id="myTask" class="com.foo.MyTask"/>
| 2
|
PHP
|
PHP
|
implement remindable interface on default user
|
af4381f7de05b21246b1ba1466afa1bb6561be28
|
<ide><path>app/models/User.php
<ide> <?php
<ide>
<ide> use Illuminate\Auth\UserInterface;
<add>use Illuminate\Auth\RemindableInterface;
<ide>
<del>class User extends Eloquent implements UserInterface {
<add>class User extends Eloquent implements UserInterface, RemindableInterface {
<ide>
<ide> /**
<ide> * The database table used by the model.
<ide> public function getAuthPassword()
<ide> return $this->password;
<ide> }
<ide>
<add> /**
<add> * Get the e-mail address where password reminders are sent.
<add> *
<add> * @return string
<add> */
<add> public function getReminderEmail()
<add> {
<add> return $this->email;
<add> }
<add>
<ide> }
<ide>\ No newline at end of file
| 1
|
Javascript
|
Javascript
|
get promise a+ tests to run on windows
|
265f0b52253ffe63715e69b5ba0b0092a8b1fb0f
|
<ide><path>Gruntfile.js
<ide> var files = require('./angularFiles').files;
<ide> var util = require('./lib/grunt/utils.js');
<add>var path = require('path');
<ide>
<ide> module.exports = function(grunt) {
<ide> //grunt plugins
<ide> module.exports = function(grunt) {
<ide> stderr:true,
<ide> failOnError:true
<ide> },
<del> command:'./node_modules/.bin/promises-aplus-tests tmp/promises-aplus-adapter++.js'
<add> command:path.normalize('./node_modules/.bin/promises-aplus-tests tmp/promises-aplus-adapter++.js')
<ide> }
<ide> },
<ide>
| 1
|
Python
|
Python
|
fix unexpected commit error in schedulerjob
|
cdbb481338f8a93290e9ca308bf111c3a30fa6ce
|
<ide><path>airflow/jobs/scheduler_job.py
<ide> def _executable_task_instances_to_queued(self, max_tis: int, session: Session =
<ide> make_transient(ti)
<ide> return executable_tis
<ide>
<del> def _enqueue_task_instances_with_queued_state(self, task_instances: List[TI]) -> None:
<add> @provide_session
<add> def _enqueue_task_instances_with_queued_state(
<add> self, task_instances: List[TI], session: Session = None
<add> ) -> None:
<ide> """
<ide> Takes task_instances, which should have been set to queued, and enqueues them
<ide> with the executor.
<ide>
<ide> :param task_instances: TaskInstances to enqueue
<ide> :type task_instances: list[TaskInstance]
<add> :param session: The session object
<add> :type session: Session
<ide> """
<ide> # actually enqueue them
<ide> for ti in task_instances:
<ide> if ti.dag_run.state in State.finished:
<del> ti.set_state(State.NONE)
<add> ti.set_state(State.NONE, session=session)
<ide> continue
<ide> command = ti.command_as_list(
<ide> local=True,
<ide> def _critical_section_execute_task_instances(self, session: Session) -> int:
<ide> max_tis = min(self.max_tis_per_query, self.executor.slots_available)
<ide> queued_tis = self._executable_task_instances_to_queued(max_tis, session=session)
<ide>
<del> self._enqueue_task_instances_with_queued_state(queued_tis)
<add> self._enqueue_task_instances_with_queued_state(queued_tis, session=session)
<ide> return len(queued_tis)
<ide>
<ide> @provide_session
| 1
|
Javascript
|
Javascript
|
use transform module hash instead of mtime
|
e485f6997defaaf15105f85769118b234ea0d156
|
<ide><path>packager/react-packager/src/Bundler/index.js
<ide> 'use strict';
<ide>
<ide> const assert = require('assert');
<add>const crypto = require('crypto');
<ide> const fs = require('fs');
<ide> const Cache = require('../node-haste').Cache;
<ide> const Transformer = require('../JSTransformer');
<ide> class Bundler {
<ide>
<ide> opts.projectRoots.forEach(verifyRootExists);
<ide>
<del> let mtime;
<add> let transformModuleHash;
<ide> try {
<del> ({mtime} = fs.statSync(opts.transformModulePath));
<del> mtime = String(mtime.getTime());
<add> const transformModuleStr = fs.readFileSync(opts.transformModulePath);
<add> transformModuleHash =
<add> crypto.createHash('sha1').update(transformModuleStr).digest('hex');
<ide> } catch (error) {
<del> mtime = '';
<add> transformModuleHash = '';
<ide> }
<ide>
<ide> const cacheKeyParts = [
<ide> 'react-packager-cache',
<ide> version,
<ide> opts.cacheVersion,
<ide> opts.projectRoots.join(',').split(pathSeparator).join('-'),
<del> mtime,
<add> transformModuleHash,
<ide> ];
<ide>
<ide> this._getModuleId = createModuleIdFactory();
| 1
|
Python
|
Python
|
use double quotes in user messages
|
9a4267049ba37883e3e0c21b5d453b9551343b8d
|
<ide><path>rest_framework/exceptions.py
<ide> class NotFound(APIException):
<ide>
<ide> class MethodNotAllowed(APIException):
<ide> status_code = status.HTTP_405_METHOD_NOT_ALLOWED
<del> default_detail = _("Method '{method}' not allowed.")
<add> default_detail = _("Method \"{method}\" not allowed.")
<ide>
<ide> def __init__(self, method, detail=None):
<ide> if detail is not None:
<ide> def __init__(self, detail=None, available_renderers=None):
<ide>
<ide> class UnsupportedMediaType(APIException):
<ide> status_code = status.HTTP_415_UNSUPPORTED_MEDIA_TYPE
<del> default_detail = _("Unsupported media type '{media_type}' in request.")
<add> default_detail = _("Unsupported media type \"{media_type}\" in request.")
<ide>
<ide> def __init__(self, media_type, detail=None):
<ide> if detail is not None:
<ide><path>rest_framework/fields.py
<ide> def __init__(self, regex, **kwargs):
<ide>
<ide> class SlugField(CharField):
<ide> default_error_messages = {
<del> 'invalid': _("Enter a valid 'slug' consisting of letters, numbers, underscores or hyphens.")
<add> 'invalid': _("Enter a valid \"slug\" consisting of letters, numbers, underscores or hyphens.")
<ide> }
<ide>
<ide> def __init__(self, **kwargs):
<ide><path>rest_framework/generics.py
<ide> def paginate_queryset(self, queryset):
<ide> if page == 'last':
<ide> page_number = paginator.num_pages
<ide> else:
<del> raise NotFound(_("Choose a valid page number. Page numbers must be a whole number, or must be the string 'last'."))
<add> raise NotFound(_("Choose a valid page number. Page numbers must be a whole number, or must be the string \"last\"."))
<ide>
<ide> try:
<ide> page = paginator.page(page_number)
<ide> except InvalidPage as exc:
<del> error_format = _("Invalid page ({page_number}): {message}.")
<add> error_format = _("Invalid page \"{page_number}\": {message}.")
<ide> raise NotFound(error_format.format(
<ide> page_number=page_number, message=six.text_type(exc)
<ide> ))
<ide><path>rest_framework/relations.py
<ide> def to_representation(self, value):
<ide> class PrimaryKeyRelatedField(RelatedField):
<ide> default_error_messages = {
<ide> 'required': _("This field is required."),
<del> 'does_not_exist': _("Invalid pk '{pk_value}' - object does not exist."),
<add> 'does_not_exist': _("Invalid pk \"{pk_value}\" - object does not exist."),
<ide> 'incorrect_type': _("Incorrect type. Expected pk value, received {data_type}."),
<ide> }
<ide>
<ide><path>rest_framework/versioning.py
<ide> class AcceptHeaderVersioning(BaseVersioning):
<ide> Host: example.com
<ide> Accept: application/json; version=1.0
<ide> """
<del> invalid_version_message = _("Invalid version in 'Accept' header.")
<add> invalid_version_message = _("Invalid version in \"Accept\" header.")
<ide>
<ide> def determine_version(self, request, *args, **kwargs):
<ide> media_type = _MediaType(request.accepted_media_type)
| 5
|
PHP
|
PHP
|
add autocomplete support for fakequeue
|
34179347ef23507f0a7ab1f6dcab371dc4b9d641
|
<ide><path>src/Illuminate/Support/Facades/Queue.php
<ide> * @method static \Illuminate\Contracts\Queue\Job|null pop(string $queue = null)
<ide> * @method static string getConnectionName()
<ide> * @method static \Illuminate\Contracts\Queue\Queue setConnectionName(string $name)
<add> * @method static void assertNothingPushed()
<add> * @method static void assertNotPushed(string $job, \Closure $callback = null)
<add> * @method static void assertPushed(string $job, \Closure|int $callback = null)
<add> * @method static void assertPushedOn(string $job, int $times = 1)
<add> * @method static void assertPushedWithChain(string $queue, string $job, \Closure $callback = null)
<ide> *
<ide> * @see \Illuminate\Queue\QueueManager
<ide> * @see \Illuminate\Queue\Queue
| 1
|
Python
|
Python
|
fix activity regularization
|
fcb6ae8eed5058d7759d2db8bdfbf59e1033b1d9
|
<ide><path>keras/regularizers.py
<ide> def set_layer(self, layer):
<ide>
<ide> def __call__(self, loss):
<ide> output = self.layer.output
<del> regularized_loss = self.l1 * K.sum(K.mean(K.abs(output), axis=0))
<add> regularized_loss = loss + self.l1 * K.sum(K.mean(K.abs(output), axis=0))
<ide> regularized_loss += self.l2 * K.sum(K.mean(K.square(output), axis=0))
<ide> return K.in_train_phase(regularized_loss, loss)
<ide>
| 1
|
Ruby
|
Ruby
|
add more tests and fix docs
|
18f83faf711a4a89b0eef482c775129751d91644
|
<ide><path>activerecord/lib/active_record/relation.rb
<ide> def find_or_create_by!(attributes, &block)
<ide> # Attempts to create a record with the given attributes in a table that has a unique constraint
<ide> # on one or several of its columns. If a row already exists with one or several of these
<ide> # unique constraints, the exception such an insertion would normally raise is caught,
<del> # and the existing record with those attributes is found using #find_by.
<add> # and the existing record with those attributes is found using #find_by!.
<ide> #
<ide> # This is similar to #find_or_create_by, but avoids the problem of stale reads between the SELECT
<ide> # and the INSERT, as that method needs to first query the table, then attempt to insert a row
<ide> def find_or_create_by!(attributes, &block)
<ide> #
<ide> # * The underlying table must have the relevant columns defined with unique constraints.
<ide> # * A unique constraint violation may be triggered by only one, or at least less than all,
<del> # of the given attributes. This means that the subsequent #find_by may fail to find a
<add> # of the given attributes. This means that the subsequent #find_by! may fail to find a
<ide> # matching record, which will then raise an <tt>ActiveRecord::RecordNotFound</tt> exception,
<ide> # rather than a record with the given attributes.
<ide> # * While we avoid the race condition between SELECT -> INSERT from #find_or_create_by,
<ide><path>activerecord/test/cases/relations_test.rb
<ide> def test_create_or_find_by
<ide> assert_not_equal subscriber, Subscriber.create_or_find_by(nick: "cat")
<ide> end
<ide>
<add> def test_create_or_find_by_should_not_raise_due_to_validation_errors
<add> assert_nothing_raised do
<add> bird = Bird.create_or_find_by(color: "green")
<add> assert_predicate bird, :invalid?
<add> end
<add> end
<add>
<ide> def test_create_or_find_by_with_non_unique_attributes
<ide> Subscriber.create!(nick: "bob", name: "the builder")
<ide>
<ide> def test_create_or_find_by_within_transaction
<ide> end
<ide> end
<ide>
<add> def test_create_or_find_by_with_bang
<add> assert_nil Subscriber.find_by(nick: "bob")
<add>
<add> subscriber = Subscriber.create!(nick: "bob")
<add>
<add> assert_equal subscriber, Subscriber.create_or_find_by!(nick: "bob")
<add> assert_not_equal subscriber, Subscriber.create_or_find_by!(nick: "cat")
<add> end
<add>
<add> def test_create_or_find_by_with_bang_should_raise_due_to_validation_errors
<add> assert_raises(ActiveRecord::RecordInvalid) { Bird.create_or_find_by!(color: "green") }
<add> end
<add>
<add> def test_create_or_find_by_with_bang_with_non_unique_attributes
<add> Subscriber.create!(nick: "bob", name: "the builder")
<add>
<add> assert_raises(ActiveRecord::RecordNotFound) do
<add> Subscriber.create_or_find_by!(nick: "bob", name: "the cat")
<add> end
<add> end
<add>
<add> def test_create_or_find_by_with_bang_within_transaction
<add> assert_nil Subscriber.find_by(nick: "bob")
<add>
<add> subscriber = Subscriber.create!(nick: "bob")
<add>
<add> Subscriber.transaction do
<add> assert_equal subscriber, Subscriber.create_or_find_by!(nick: "bob")
<add> assert_not_equal subscriber, Subscriber.create_or_find_by!(nick: "cat")
<add> end
<add> end
<add>
<ide> def test_find_or_initialize_by
<ide> assert_nil Bird.find_by(name: "bob")
<ide>
| 2
|
Python
|
Python
|
fix typo in arxiv.org url
|
c57f8b79f19df9c3066e0ecc66b01d675bca05b5
|
<ide><path>research/deeplab/model.py
<ide> "Encoder-Decoder with Atrous Separable Convolution for Semantic Image
<ide> Segmentation"
<ide> Liang-Chieh Chen, Yukun Zhu, George Papandreou, Florian Schroff, Hartwig Adam.
<del>(https://arxiv.org/abs1802.02611)
<add>(https://arxiv.org/abs/1802.02611)
<ide>
<ide> "Rethinking Atrous Convolution for Semantic Image Segmentation,"
<ide> Liang-Chieh Chen, George Papandreou, Florian Schroff, Hartwig Adam
| 1
|
Go
|
Go
|
remove unused key handling functions
|
ab02b015efb79d3b572c0e7ae8ad6229603d75dc
|
<ide><path>libnetwork/agent.go
<ide> func (c *controller) handleKeyChange(keys []*types.EncryptionKey) error {
<ide> return nil
<ide> }
<ide>
<del>func (c *controller) handleKeyChangeV1(keys []*types.EncryptionKey) error {
<del> drvEnc := discoverapi.DriverEncryptionUpdate{}
<del>
<del> // Find the new key and add it to the key ring
<del> a := c.agent
<del> for _, key := range keys {
<del> same := false
<del> for _, cKey := range c.keys {
<del> if same = cKey.LamportTime == key.LamportTime; same {
<del> break
<del> }
<del> }
<del> if !same {
<del> c.keys = append(c.keys, key)
<del> if key.Subsystem == subsysGossip {
<del> a.networkDB.SetKey(key.Key)
<del> }
<del> if key.Subsystem == subsysGossip /*subsysIPSec*/ {
<del> drvEnc.Key = key.Key
<del> drvEnc.Tag = key.LamportTime
<del> }
<del> break
<del> }
<del> }
<del> // Find the deleted key. If the deleted key was the primary key,
<del> // a new primary key should be set before removing if from keyring.
<del> deleted := []byte{}
<del> for i, cKey := range c.keys {
<del> same := false
<del> for _, key := range keys {
<del> if same = key.LamportTime == cKey.LamportTime; same {
<del> break
<del> }
<del> }
<del> if !same {
<del> if cKey.Subsystem == subsysGossip {
<del> deleted = cKey.Key
<del> }
<del> if cKey.Subsystem == subsysGossip /*subsysIPSec*/ {
<del> drvEnc.Prune = cKey.Key
<del> drvEnc.PruneTag = cKey.LamportTime
<del> }
<del> c.keys = append(c.keys[:i], c.keys[i+1:]...)
<del> break
<del> }
<del> }
<del>
<del> sort.Sort(ByTime(c.keys))
<del> for _, key := range c.keys {
<del> if key.Subsystem == subsysGossip {
<del> a.networkDB.SetPrimaryKey(key.Key)
<del> break
<del> }
<del> }
<del> for _, key := range c.keys {
<del> if key.Subsystem == subsysGossip /*subsysIPSec*/ {
<del> drvEnc.Primary = key.Key
<del> drvEnc.PrimaryTag = key.LamportTime
<del> break
<del> }
<del> }
<del> if len(deleted) > 0 {
<del> a.networkDB.RemoveKey(deleted)
<del> }
<del>
<del> c.drvRegistry.WalkDrivers(func(name string, driver driverapi.Driver, capability driverapi.Capability) bool {
<del> err := driver.DiscoverNew(discoverapi.EncryptionKeysUpdate, drvEnc)
<del> if err != nil {
<del> logrus.Warnf("Failed to update datapath keys in driver %s: %v", name, err)
<del> }
<del> return false
<del> })
<del>
<del> return nil
<del>}
<del>
<ide> func (c *controller) agentSetup() error {
<ide> clusterProvider := c.cfg.Daemon.ClusterProvider
<ide>
<ide> func (c *controller) getKeys(subsys string) ([][]byte, []uint64) {
<ide> }
<ide> }
<ide>
<del> if len(keys) < keyringSize {
<del> return keys, tags
<del> }
<ide> keys[0], keys[1] = keys[1], keys[0]
<ide> tags[0], tags[1] = tags[1], tags[0]
<ide> return keys, tags
<ide> func (c *controller) getPrimaryKeyTag(subsys string) ([]byte, uint64, error) {
<ide> keys = append(keys, key)
<ide> }
<ide> }
<del> if len(keys) < 2 {
<del> return nil, 0, fmt.Errorf("primary key for subsystem %s not found", subsys)
<del> }
<ide> return keys[1].Key, keys[1].LamportTime, nil
<ide> }
<ide>
<ide><path>libnetwork/controller.go
<ide> func (c *controller) SetKeys(keys []*types.EncryptionKey) error {
<ide> clusterConfigAvailable := c.clusterConfigAvailable
<ide> agent := c.agent
<ide> c.Unlock()
<add>
<add> subsysKeys := make(map[string]int)
<add> for _, key := range keys {
<add> if key.Subsystem != subsysGossip &&
<add> key.Subsystem != subsysIPSec {
<add> return fmt.Errorf("key received for unrecognized subsystem")
<add> }
<add> subsysKeys[key.Subsystem]++
<add> }
<add> for s, count := range subsysKeys {
<add> if count != keyringSize {
<add> return fmt.Errorf("incorrect number of keys for susbsystem %v", s)
<add> }
<add> }
<add>
<ide> if len(existingKeys) == 0 {
<ide> c.Lock()
<ide> c.keys = keys
<ide> func (c *controller) SetKeys(keys []*types.EncryptionKey) error {
<ide> c.Unlock()
<ide> return nil
<ide> }
<del> if len(keys) < keyringSize {
<del> return c.handleKeyChangeV1(keys)
<del> }
<ide> return c.handleKeyChange(keys)
<ide> }
<ide>
| 2
|
Mixed
|
Go
|
add linked containers to hosts file
|
53f38a14cd6b61a6b5df68cc3694dcba2b0c1eb7
|
<ide><path>daemon/container.go
<ide> func (container *Container) buildHostnameAndHostsFiles(IP string) error {
<ide> }
<ide>
<ide> container.HostsPath = path.Join(container.root, "hosts")
<del> return etchosts.Build(container.HostsPath, IP, container.Config.Hostname, container.Config.Domainname)
<add>
<add> extraContent := make(map[string]string)
<add>
<add> children, err := container.daemon.Children(container.Name)
<add> if err != nil {
<add> return err
<add> }
<add>
<add> for linkAlias, child := range children {
<add> _, alias := path.Split(linkAlias)
<add> extraContent[alias] = child.NetworkSettings.IPAddress
<add> }
<add>
<add> return etchosts.Build(container.HostsPath, IP, container.Config.Hostname, container.Config.Domainname, &extraContent)
<ide> }
<ide>
<ide> func (container *Container) allocateNetwork() error {
<ide><path>docs/sources/reference/run.md
<del>page_title: Docker Run Reference
<add>page_title: Docker Run Reference
<ide> page_description: Configure containers at runtime
<ide> page_keywords: docker, run, configure, runtime
<ide>
<ide> And we can use that information to connect from another container as a client:
<ide> $ docker run -i -t --rm --link redis-name:redis_alias --entrypoint /bin/bash dockerfiles/redis -c '/redis-stable/src/redis-cli -h $REDIS_ALIAS_PORT_6379_TCP_ADDR -p $REDIS_ALIAS_PORT_6379_TCP_PORT'
<ide> 172.17.0.32:6379>
<ide>
<add>Docker will also map the private IP address to the alias of a linked
<add>container by inserting an entry into `/etc/hosts`. You can use this
<add>mechanism to communicate with a linked container by its alias:
<add>
<add> $ docker run -d --name servicename busybox sleep 30
<add> $ docker run -i -t --link servicename:servicealias busybox ping -c 1 servicealias
<add>
<ide> ## VOLUME (Shared Filesystems)
<ide>
<ide> -v=[]: Create a bind mount with: [host-dir]:[container-dir]:[rw|ro].
<ide><path>docs/sources/use/working_with_links_names.md
<ide> the Redis container.
<ide> CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
<ide> 4c01db0b339c ubuntu:12.04 bash 17 seconds ago Up 16 seconds webapp
<ide> d7886598dbe2 crosbymichael/redis:latest /redis-server --dir 33 minutes ago Up 33 minutes 6379/tcp redis,webapp/db
<add>
<add>## Resolving Links by Name
<add>
<add>New in version v0.11.
<add>
<add>Linked containers can be accessed by hostname. Hostnames are mapped by
<add>appending entries to '/etc/hosts' using the linked container's alias.
<add>
<add>For example, linking a container using '--link redis:db' will generate the
<add>following '/etc/hosts' file:
<add>
<add> root@6541a75d44a0:/# cat /etc/hosts
<add> 172.17.0.3 6541a75d44a0
<add> 172.17.0.2 db
<add>
<add> 127.0.0.1 localhost
<add> ::1 localhost ip6-localhost ip6-loopback
<add> fe00::0 ip6-localnet
<add> ff00::0 ip6-mcastprefix
<add> ff02::1 ip6-allnodes
<add> ff02::2 ip6-allrouters
<add> root@6541a75d44a0:/#
<add>
<add>Using this mechanism, you can communicate with the linked container by
<add>name:
<add>
<add> root@6541a75d44a0:/# echo PING | redis-cli -h db
<add> PONG
<add> root@6541a75d44a0:/#
<ide><path>integration-cli/docker_cli_links_test.go
<add>package main
<add>
<add>import (
<add> "fmt"
<add> "os/exec"
<add> "testing"
<add>)
<add>
<add>func TestPingUnlinkedContainers(t *testing.T) {
<add> runCmd := exec.Command(dockerBinary, "run", "--rm", "busybox", "sh", "-c", "ping -c 1 alias1 -W 1 && ping -c 1 alias2 -W 1")
<add> exitCode, err := runCommand(runCmd)
<add>
<add> if exitCode == 0 {
<add> t.Fatal("run ping did not fail")
<add> } else if exitCode != 1 {
<add> errorOut(err, t, fmt.Sprintf("run ping failed with errors: %v", err))
<add> }
<add>}
<add>
<add>func TestPingLinkedContainers(t *testing.T) {
<add> cmd := exec.Command(dockerBinary, "run", "-d", "--name", "container1", "busybox", "sleep", "10")
<add> out, _, err := runCommandWithOutput(cmd)
<add> errorOut(err, t, fmt.Sprintf("run container1 failed with errors: %v", err))
<add> idA := stripTrailingCharacters(out)
<add>
<add> cmd = exec.Command(dockerBinary, "run", "-d", "--name", "container2", "busybox", "sleep", "10")
<add> out, _, err = runCommandWithOutput(cmd)
<add> errorOut(err, t, fmt.Sprintf("run container2 failed with errors: %v", err))
<add> idB := stripTrailingCharacters(out)
<add>
<add> cmd = exec.Command(dockerBinary, "run", "--rm", "--link", "container1:alias1", "--link", "container2:alias2", "busybox", "sh", "-c", "ping -c 1 alias1 -W 1 && ping -c 1 alias2 -W 1")
<add> out, _, err = runCommandWithOutput(cmd)
<add> fmt.Printf("OUT: %s", out)
<add> errorOut(err, t, fmt.Sprintf("run ping failed with errors: %v", err))
<add>
<add> cmd = exec.Command(dockerBinary, "kill", idA)
<add> _, err = runCommand(cmd)
<add> errorOut(err, t, fmt.Sprintf("failed to kill container1: %v", err))
<add>
<add> cmd = exec.Command(dockerBinary, "kill", idB)
<add> _, err = runCommand(cmd)
<add> errorOut(err, t, fmt.Sprintf("failed to kill container2: %v", err))
<add>
<add> deleteAllContainers()
<add>}
<ide><path>pkg/networkfs/etchosts/etchosts.go
<ide> var defaultContent = map[string]string{
<ide> "ip6-allrouters": "ff02::2",
<ide> }
<ide>
<del>func Build(path, IP, hostname, domainname string) error {
<add>func Build(path, IP, hostname, domainname string, extraContent *map[string]string) error {
<ide> content := bytes.NewBuffer(nil)
<ide> if IP != "" {
<ide> if domainname != "" {
<ide> func Build(path, IP, hostname, domainname string) error {
<ide> return err
<ide> }
<ide> }
<add>
<add> if extraContent != nil {
<add> for hosts, ip := range *extraContent {
<add> if _, err := content.WriteString(fmt.Sprintf("%s\t%s\n", ip, hosts)); err != nil {
<add> return err
<add> }
<add> }
<add> }
<add>
<ide> return ioutil.WriteFile(path, content.Bytes(), 0644)
<ide> }
| 5
|
Text
|
Text
|
add autoencoder to docs
|
f851229ade806e02e68ceb018b0ebf7c8ee85ffc
|
<ide><path>docs/sources/layers/core.md
<ide> model.add(TimeDistributedDense(5, 10)) # output shape: (nb_samples, nb_timesteps
<ide> ```
<ide>
<ide>
<add>---
<add>
<add>## AutoEncoder
<add>```python
<add>keras.layers.core.AutoEncoder(encoders=[], decoders=[], output_reconstruction=True, tie_weights=False, weights=None):
<add>```
<add>
<add>A customizable autoencoder model. It supports deep architectures by passing appropriate encoders/decoders list. If `output_reconstruction = True` then dim(input) = dim(output) else dim(output) = dim(hidden)
<add>
<add>
<add>- __Input shape__: The layer shape is defined by the encoder definitions
<add>
<add>- __Output shape__: The layer shape is defined by the decoder definitions
<add>
<add>- __Arguments__:
<add>
<add> - __encoders__: A list of encoder which can be defined by any existing layer. See [layers](./) for more information on layer types.
<add>
<add> - __decoders__: A list of decoders which can be defined by any exisitng layer. See [layers](./) for more information on layer types.
<add>
<add> - __output_reconstruction__: If this is False the when .predict() is called the output is the deepest hidden layer's activation. Otherwise the output of the final decoder layer is presented. Be sure your validation data confirms to this logic if you decide to use any.
<add>
<add> - __tie_weights__: If True then the encoder bias is tied to the decoder bias. **Note**: This required the encoder layer corresponding to this decoder layer to be of the same time, eg: Dense:Dense
<add>
<add> - __weights__: list of numpy arrays to set as initial weights. The list should have 1 element, of shape `(input_dim, output_dim)`.
<add>
<add>- __Example__:
<add>```python
<add># input shape: (nb_samples, 32)
<add>encoders = [Dense(32, 16, activation='tanh'), Dense(16, 8, activation='tanh')]
<add>decoders = [Dense(8, 16, activation='tanh'), Dense(16, 32, activation='tanh')]
<add>autoencoder.add(AutoEncoder(encoders=encoders, decoders=decoders, output_reconstruction=False, tie_weights=True))
<add>```
<add>
<add>
<add>---
<add>
<add>## DenoisingAutoEncoder
<add>```python
<add>keras.layers.core.AutoEncoder(encoders=[], decoders=[], output_reconstruction=True, tie_weights=False, weights=None, corruption_level=0.3):
<add>```
<add>
<add>A denoising autoencoder model that inherits the base features from autoencoder.
<add>Since this model uses similar logic to Dropout it cannot be the first layer in a pipeline.
<add>
<add>- __Input shape__: The layer shape is defined by the encoder definitions
<add>
<add>- __Output shape__: The layer shape is defined by the decoder definitions
<add>
<add>- __Arguments__:
<add>
<add> - __encoders__: A list of encoder which can be defined by any existing layer. See [layers](./) for more information
<add>
<add> - __decoders__: A list of decoders which can be defined by any exisitng layer. See [layers](./) for more information
<add>
<add> - __output_reconstruction__: If this is False the when .predict() is called the output is the deepest hidden layer's activation. Otherwise the output of the final decoder layer is presented. Be sure your validation data confirms to this logic if you decide to use any.
<add>
<add> - __tie_weights__: If True then the encoder bias is tied to the decoder bias. **Note**: This required the encoder layer corresponding to this decoder layer to be of the same time, eg: Dense:Dense
<add>
<add> - __weights__: list of numpy arrays to set as initial weights. The list should have 1 element, of shape `(input_dim, output_dim)`.
<add>
<add> - __corruption_level__: the amount of binomial noise added to the input layer of the model.
<add>
<add>- __Example__:
<add>```python
<add># input shape: (nb_samples, 32)
<add>autoencoder.add(Dense(32, 32))
<add>autoencoder.add(DenoisingAutoEncoder(encoders=[Dense(32, 16, activation='tanh')],
<add> decoders=[Dense(16, 32, activation='tanh')],
<add> output_reconstruction=False, tie_weights=True,
<add> corruption_level=0.3))
<add>```
<add>
<add>
<ide> ---
<ide>
<ide> ## Activation
| 1
|
Javascript
|
Javascript
|
remove code that is no longer in use
|
c2a7766a05c1c0cf402262d75fbd9b4d1abeb811
|
<ide><path>server/index.js
<ide> export default class Server {
<ide> return buildId.trim()
<ide> }
<ide>
<del> handleBuildId (buildId, res) {
<del> if (this.dev) {
<del> res.setHeader('Cache-Control', 'no-store, must-revalidate')
<del> return true
<del> }
<del>
<del> if (buildId !== this.renderOpts.buildId) {
<del> return false
<del> }
<del>
<del> res.setHeader('Cache-Control', 'public, max-age=31536000, immutable')
<del> return true
<del> }
<del>
<ide> async getCompilationError (page) {
<ide> if (!this.hotReloader) return
<ide>
<ide> export default class Server {
<ide> // Return the very first error we found.
<ide> return errors[0]
<ide> }
<del>
<del> send404 (res) {
<del> res.statusCode = 404
<del> res.end('404 - Not Found')
<del> }
<ide> }
| 1
|
Javascript
|
Javascript
|
add comment and fix euler ordering
|
9eafb9e9e83ede23c6aa3eff8354a908cdc18e14
|
<ide><path>examples/js/loaders/FBXLoader.js
<ide>
<ide> }
<ide>
<add> // Returns the three.js intrinsic Euler order corresponding to FBX extrinsic Euler order
<ide> // ref: http://help.autodesk.com/view/FBX/2017/ENU/?guid=__cpp_ref_class_fbx_euler_html
<ide> function getEulerOrder( order ) {
<ide>
<ide> var enums = [
<del> 'ZYX', // -> XYZ in FBX
<del> 'YXZ',
<del> 'ZXY',
<del> 'YZX',
<del> 'XZY',
<del> 'XYZ',
<add> 'ZYX', // -> XYZ extrinsic
<add> 'YZX', // -> XZY extrinsic
<add> 'XZY', // -> YZX extrinsic
<add> 'ZXY', // -> YXZ extrinsic
<add> 'YXZ', // -> ZXY extrinsic
<add> 'XYZ', // -> ZYX extrinsic
<ide> //'SphericXYZ', // not possible to support
<ide> ];
<ide>
| 1
|
Ruby
|
Ruby
|
autocorrect some offenses
|
d68452f2320c726c3bf602318dc85c3230d6f00e
|
<ide><path>Library/Homebrew/rubocops/patches.rb
<ide> module FormulaAudit
<ide> # TODO: Many of these could be auto-corrected.
<ide> class Patches < FormulaCop
<ide> extend T::Sig
<add> extend AutoCorrector
<ide>
<ide> def audit_formula(node, _class_node, _parent_class_node, body)
<ide> @full_source_content = source_buffer(node).source
<ide> def audit_formula(node, _class_node, _parent_class_node, body)
<ide>
<ide> private
<ide>
<del> def patch_problems(patch)
<del> patch_url = string_content(patch)
<add> def patch_problems(patch_url_node)
<add> patch_url = string_content(patch_url_node)
<ide>
<del> if regex_match_group(patch, %r{https://github.com/[^/]*/[^/]*/pull})
<add> if regex_match_group(patch_url_node, %r{https://github.com/[^/]*/[^/]*/pull})
<ide> problem "Use a commit hash URL rather than an unstable pull request URL: #{patch_url}"
<ide> end
<ide>
<del> if regex_match_group(patch, %r{.*gitlab.*/merge_request.*})
<add> if regex_match_group(patch_url_node, %r{.*gitlab.*/merge_request.*})
<ide> problem "Use a commit hash URL rather than an unstable merge request URL: #{patch_url}"
<ide> end
<ide>
<del> if regex_match_group(patch, %r{https://github.com/[^/]*/[^/]*/commit/[a-fA-F0-9]*\.diff})
<del> problem <<~EOS.chomp
<del> GitHub patches should end with .patch, not .diff:
<del> #{patch_url}
<del> EOS
<add> if regex_match_group(patch_url_node, %r{https://github.com/[^/]*/[^/]*/commit/[a-fA-F0-9]*\.diff})
<add> problem "GitHub patches should end with .patch, not .diff: #{patch_url}" do |corrector|
<add> correct = patch_url_node.source.gsub(/\.diff/, ".patch")
<add> corrector.replace(patch_url_node.source_range, correct)
<add> end
<ide> end
<ide>
<del> if regex_match_group(patch, %r{.*gitlab.*/commit/[a-fA-F0-9]*\.diff})
<del> problem <<~EOS.chomp
<del> GitLab patches should end with .patch, not .diff:
<del> #{patch_url}
<del> EOS
<add> if regex_match_group(patch_url_node, %r{.*gitlab.*/commit/[a-fA-F0-9]*\.diff})
<add> problem "GitLab patches should end with .patch, not .diff: #{patch_url}" do |corrector|
<add> correct = patch_url_node.source.gsub(/\.diff/, ".patch")
<add> corrector.replace(patch_url_node.source_range, correct)
<add> end
<ide> end
<ide>
<ide> gh_patch_param_pattern = %r{https?://github\.com/.+/.+/(?:commit|pull)/[a-fA-F0-9]*.(?:patch|diff)}
<del> if regex_match_group(patch, gh_patch_param_pattern) && !patch_url.match?(/\?full_index=\w+$/)
<del> problem <<~EOS
<del> GitHub patches should use the full_index parameter:
<del> #{patch_url}?full_index=1
<del> EOS
<add> if regex_match_group(patch_url_node, gh_patch_param_pattern) && !patch_url.match?(/\?full_index=\w+$/)
<add> problem "GitHub patches should use the full_index parameter: #{patch_url}?full_index=1" do |corrector|
<add> corrector.replace(patch_url_node.source_range, "#{patch_url}?full_index=1")
<add> end
<ide> end
<ide>
<ide> gh_patch_patterns = Regexp.union([%r{/raw\.github\.com/},
<ide> %r{/raw\.githubusercontent\.com/},
<ide> %r{gist\.github\.com/raw},
<ide> %r{gist\.github\.com/.+/raw},
<ide> %r{gist\.githubusercontent\.com/.+/raw}])
<del> if regex_match_group(patch, gh_patch_patterns) && !patch_url.match?(%r{/[a-fA-F0-9]{6,40}/})
<del> problem <<~EOS.chomp
<del> GitHub/Gist patches should specify a revision:
<del> #{patch_url}
<del> EOS
<add> if regex_match_group(patch_url_node, gh_patch_patterns) && !patch_url.match?(%r{/[a-fA-F0-9]{6,40}/})
<add> problem "GitHub/Gist patches should specify a revision: #{patch_url}"
<ide> end
<ide>
<ide> gh_patch_diff_pattern =
<ide> %r{https?://patch-diff\.githubusercontent\.com/raw/(.+)/(.+)/pull/(.+)\.(?:diff|patch)}
<del> if regex_match_group(patch, gh_patch_diff_pattern)
<add> if regex_match_group(patch_url_node, gh_patch_diff_pattern)
<ide> problem "Use a commit hash URL rather than patch-diff: #{patch_url}"
<ide> end
<ide>
<del> if regex_match_group(patch, %r{macports/trunk})
<del> problem <<~EOS.chomp
<del> MacPorts patches should specify a revision instead of trunk:
<del> #{patch_url}
<del> EOS
<add> if regex_match_group(patch_url_node, %r{macports/trunk})
<add> problem "MacPorts patches should specify a revision instead of trunk: #{patch_url}"
<ide> end
<ide>
<del> if regex_match_group(patch, %r{^http://trac\.macports\.org})
<del> problem <<~EOS.chomp
<del> Patches from MacPorts Trac should be https://, not http:
<del> #{patch_url}
<del> EOS
<add> if regex_match_group(patch_url_node, %r{^http://trac\.macports\.org})
<add> problem "Patches from MacPorts Trac should be https://, not http: #{patch_url}" do |corrector|
<add> correct = patch_url_node.source.gsub(%r{^http://}, "https://")
<add> corrector.replace(patch_url_node.source_range, correct)
<add> end
<ide> end
<ide>
<del> return unless regex_match_group(patch, %r{^http://bugs\.debian\.org})
<add> return unless regex_match_group(patch_url_node, %r{^http://bugs\.debian\.org})
<ide>
<del> problem <<~EOS.chomp
<del> Patches from Debian should be https://, not http:
<del> #{patch_url}
<del> EOS
<add> problem "Patches from Debian should be https://, not http: #{patch_url}" do |corrector|
<add> correct = patch_url_node.source.gsub(%r{^http://}, "https://")
<add> corrector.replace(patch_url_node.source_range, correct)
<add> end
<ide> end
<ide>
<ide> def inline_patch_problems(patch)
<ide><path>Library/Homebrew/test/rubocops/patches_spec.rb
<ide> def patches
<ide>
<ide> expected_offense = if patch_url.include?("/raw.github.com/")
<ide> expect_offense_hash message: <<~EOS.chomp, severity: :convention, line: 5, column: 4, source: source
<del> GitHub/Gist patches should specify a revision:
<del> #{patch_url}
<add> GitHub/Gist patches should specify a revision: #{patch_url}
<ide> EOS
<ide> elsif patch_url.include?("macports/trunk")
<ide> expect_offense_hash message: <<~EOS.chomp, severity: :convention, line: 5, column: 4, source: source
<del> MacPorts patches should specify a revision instead of trunk:
<del> #{patch_url}
<add> MacPorts patches should specify a revision instead of trunk: #{patch_url}
<ide> EOS
<ide> elsif patch_url.start_with?("http://trac.macports.org")
<ide> expect_offense_hash message: <<~EOS.chomp, severity: :convention, line: 5, column: 4, source: source
<del> Patches from MacPorts Trac should be https://, not http:
<del> #{patch_url}
<add> Patches from MacPorts Trac should be https://, not http: #{patch_url}
<ide> EOS
<ide> elsif patch_url.start_with?("http://bugs.debian.org")
<ide> expect_offense_hash message: <<~EOS.chomp, severity: :convention, line: 5, column: 4, source: source
<del> Patches from Debian should be https://, not http:
<del> #{patch_url}
<add> Patches from Debian should be https://, not http: #{patch_url}
<ide> EOS
<ide> # rubocop:disable Layout/LineLength
<ide> elsif patch_url.match?(%r{https?://patch-diff\.githubusercontent\.com/raw/(.+)/(.+)/pull/(.+)\.(?:diff|patch)})
<ide> # rubocop:enable Layout/LineLength
<ide> expect_offense_hash message: "Use a commit hash URL rather than patch-diff: #{patch_url}",
<ide> severity: :convention, line: 5, column: 4, source: source
<ide> elsif patch_url.match?(%r{https?://github\.com/.+/.+/(?:commit|pull)/[a-fA-F0-9]*.(?:patch|diff)})
<del> expect_offense_hash message: <<~EOS, severity: :convention, line: 5, column: 4, source: source
<del> GitHub patches should use the full_index parameter:
<del> #{patch_url}?full_index=1
<add> expect_offense_hash message: <<~EOS.chomp, severity: :convention, line: 5, column: 4, source: source
<add> GitHub patches should use the full_index parameter: #{patch_url}?full_index=1
<ide> EOS
<ide> end
<ide> expected_offense.zip([inspect_source(source).last]).each do |expected, actual|
<ide> def patches
<ide> line: 4,
<ide> column: 2,
<ide> source: source },
<del> { message:
<del> <<~EOS.chomp,
<del> Patches from MacPorts Trac should be https://, not http:
<del> http://trac.macports.org/export/68507/trunk/dports/net/trafshow/files/
<del> EOS
<add> { message: "Patches from MacPorts Trac should be https://, not http: " \
<add> "http://trac.macports.org/export/68507/trunk/dports/net/trafshow/files/",
<ide> severity: :convention,
<ide> line: 8,
<ide> column: 25,
<ide> class Foo < Formula
<ide>
<ide> expected_offense = if patch_url.include?("/raw.github.com/")
<ide> expect_offense_hash message: <<~EOS.chomp, severity: :convention, line: 5, column: 8, source: source
<del> GitHub/Gist patches should specify a revision:
<del> #{patch_url}
<add> GitHub/Gist patches should specify a revision: #{patch_url}
<ide> EOS
<ide> elsif patch_url.include?("macports/trunk")
<ide> expect_offense_hash message: <<~EOS.chomp, severity: :convention, line: 5, column: 8, source: source
<del> MacPorts patches should specify a revision instead of trunk:
<del> #{patch_url}
<add> MacPorts patches should specify a revision instead of trunk: #{patch_url}
<ide> EOS
<ide> elsif patch_url.start_with?("http://trac.macports.org")
<ide> expect_offense_hash message: <<~EOS.chomp, severity: :convention, line: 5, column: 8, source: source
<del> Patches from MacPorts Trac should be https://, not http:
<del> #{patch_url}
<add> Patches from MacPorts Trac should be https://, not http: #{patch_url}
<ide> EOS
<ide> elsif patch_url.start_with?("http://bugs.debian.org")
<ide> expect_offense_hash message: <<~EOS.chomp, severity: :convention, line: 5, column: 8, source: source
<del> Patches from Debian should be https://, not http:
<del> #{patch_url}
<add> Patches from Debian should be https://, not http: #{patch_url}
<ide> EOS
<ide> elsif patch_url.match?(%r{https://github.com/[^/]*/[^/]*/pull})
<ide> expect_offense_hash message: <<~EOS.chomp, severity: :convention, line: 5, column: 8, source: source
<ide> class Foo < Formula
<ide> EOS
<ide> elsif patch_url.match?(%r{https://github.com/[^/]*/[^/]*/commit/})
<ide> expect_offense_hash message: <<~EOS.chomp, severity: :convention, line: 5, column: 8, source: source
<del> GitHub patches should end with .patch, not .diff:
<del> #{patch_url}
<add> GitHub patches should end with .patch, not .diff: #{patch_url}
<ide> EOS
<ide> elsif patch_url.match?(%r{.*gitlab.*/commit/})
<ide> expect_offense_hash message: <<~EOS.chomp, severity: :convention, line: 5, column: 8, source: source
<del> GitLab patches should end with .patch, not .diff:
<del> #{patch_url}
<add> GitLab patches should end with .patch, not .diff: #{patch_url}
<ide> EOS
<ide> # rubocop:disable Layout/LineLength
<ide> elsif patch_url.match?(%r{https?://patch-diff\.githubusercontent\.com/raw/(.+)/(.+)/pull/(.+)\.(?:diff|patch)})
| 2
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.