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 | fix length of filter iterator | d33a573822a7e7427e0b338b09ccf50788c0f916 | <ide><path>dist/Immutable.js
<ide> function filterFactory(sequence, predicate, context, useKeys) {
<ide> var iterations = 0;
<ide> sequence.__iterate((function(v, k, c) {
<ide> if (predicate.call(context, v, k, c)) {
<del> if (fn(v, useKeys ? k : iterations, $__0) !== false) {
<del> iterations++;
<del> } else {
<del> return false;
<del> }
<add> iterations++;
<add> return fn(v, useKeys ? k : iterations - 1, $__0);
<ide> }
<ide> }), reverse);
<ide> return iterations;
<ide><path>dist/Immutable.min.js
<ide> * LICENSE file in the root directory of this source tree. An additional grant
<ide> * of patent rights can be found in the PATENTS file in the same directory.
<ide> */
<del>function t(){function t(t,e,n,r){var i;if(r){var u=r.prototype;i=de.create(u)}else i=t.prototype;return de.keys(e).forEach(function(t){i[t]=e[t]}),de.keys(n).forEach(function(e){t[e]=n[e]}),i.constructor=t,t.prototype=i,t}function e(t,e,n,r){return de.getPrototypeOf(e)[n].apply(t,r)}function n(t,n,r){e(t,n,"constructor",r)}function r(t){return t.value=!1,t}function i(t){t&&(t.value=!0)}function u(){}function s(t,e){e=e||0;for(var n=Math.max(0,t.length-e),r=Array(n),i=0;n>i;i++)r[i]=t[i+e];return r}function a(t){return qe.value=t,qe.done=!1,qe}function h(){return qe.value=void 0,qe.done=!0,qe}function o(t,e){if(!t)throw Error(e)}function c(t){if(!t)return 0;if(t===!0)return 1;var e=typeof t;if("number"===e){if((0|t)===t)return t&Ae;t=""+t,e="string"}return"string"===e?t.length>je?f(t):_(t):t.hashCode?c("function"==typeof t.hashCode?t.hashCode():t.hashCode):l(t)}function f(t){var e=We[t];return null==e&&(e=_(t),Re===Ue&&(Re=0,We={}),Re++,We[t]=e),e}function _(t){for(var e=0,n=0;t.length>n;n++)e=31*e+t.charCodeAt(n)&Ae;return e}function l(t){if(t[Ce])return t[Ce];var e=++xe&Ae;if(!Ee)try{return Object.defineProperty(t,Ce,{enumerable:!1,configurable:!1,writable:!1,value:e}),e}catch(n){Ee=!0}return t[Ce]=e,e}function v(){return Object.create(ze)}function g(t){var e=Object.create(Le);return e.__reversedIndices=t?t.__reversedIndices:!1,e}function p(t,e,n,r){var i=t.get?t.get(e[r],ke):ke;return i===ke?n:++r===e.length?i:p(i,e,n,r)}function m(t,e,n){return(0===t||null!=n&&-n>=t)&&(null==e||null!=n&&e>=n)}function d(t,e){return w(t,e,0)}function y(t,e){return w(t,e,e)}function w(t,e,n){return null==t?n:0>t?Math.max(0,e+t):e?Math.min(e,t):t}function S(t){return t}function I(t,e){return[e,t]}function k(){return!0}function M(){return this}function b(t){return(t||0)+1}function q(t,e,n,r){var i=t.__makeSequence();return i.__iterateUncached=function(i,u){var s=this,a=0;return t.__iterate(function(t,u,h){if(e.call(n,t,u,h)){if(i(t,r?u:a,s)===!1)return!1;a++}},u),a},i}function D(t,e,n,r){var i=In.empty().withMutations(function(i){t.forEach(function(u,s){var a=e.call(n,u,s,t),h=i.get(a);
<add>function t(){function t(t,e,n,r){var i;if(r){var u=r.prototype;i=de.create(u)}else i=t.prototype;return de.keys(e).forEach(function(t){i[t]=e[t]}),de.keys(n).forEach(function(e){t[e]=n[e]}),i.constructor=t,t.prototype=i,t}function e(t,e,n,r){return de.getPrototypeOf(e)[n].apply(t,r)}function n(t,n,r){e(t,n,"constructor",r)}function r(t){return t.value=!1,t}function i(t){t&&(t.value=!0)}function u(){}function s(t,e){e=e||0;for(var n=Math.max(0,t.length-e),r=Array(n),i=0;n>i;i++)r[i]=t[i+e];return r}function a(t){return qe.value=t,qe.done=!1,qe}function h(){return qe.value=void 0,qe.done=!0,qe}function o(t,e){if(!t)throw Error(e)}function c(t){if(!t)return 0;if(t===!0)return 1;var e=typeof t;if("number"===e){if((0|t)===t)return t&Ae;t=""+t,e="string"}return"string"===e?t.length>je?f(t):_(t):t.hashCode?c("function"==typeof t.hashCode?t.hashCode():t.hashCode):l(t)}function f(t){var e=We[t];return null==e&&(e=_(t),Re===Ue&&(Re=0,We={}),Re++,We[t]=e),e}function _(t){for(var e=0,n=0;t.length>n;n++)e=31*e+t.charCodeAt(n)&Ae;return e}function l(t){if(t[Ce])return t[Ce];var e=++xe&Ae;if(!Ee)try{return Object.defineProperty(t,Ce,{enumerable:!1,configurable:!1,writable:!1,value:e}),e}catch(n){Ee=!0}return t[Ce]=e,e}function v(){return Object.create(ze)}function g(t){var e=Object.create(Le);return e.__reversedIndices=t?t.__reversedIndices:!1,e}function p(t,e,n,r){var i=t.get?t.get(e[r],ke):ke;return i===ke?n:++r===e.length?i:p(i,e,n,r)}function m(t,e,n){return(0===t||null!=n&&-n>=t)&&(null==e||null!=n&&e>=n)}function d(t,e){return w(t,e,0)}function y(t,e){return w(t,e,e)}function w(t,e,n){return null==t?n:0>t?Math.max(0,e+t):e?Math.min(e,t):t}function S(t){return t}function I(t,e){return[e,t]}function k(){return!0}function M(){return this}function b(t){return(t||0)+1}function q(t,e,n,r){var i=t.__makeSequence();return i.__iterateUncached=function(i,u){var s=this,a=0;return t.__iterate(function(t,u,h){return e.call(n,t,u,h)?(a++,i(t,r?u:a-1,s)):void 0},u),a},i}function D(t,e,n,r){var i=In.empty().withMutations(function(i){t.forEach(function(u,s){var a=e.call(n,u,s,t),h=i.get(a);
<ide> h||(h=[],i.set(a,h)),h.push(r?[s,u]:u)})});return i.map(r?function(t){return Pe(t).fromEntrySeq()}:function(t){return Pe(t)})}function O(t){return function(){return!t.apply(this,arguments)}}function A(t){return"string"==typeof t?JSON.stringify(t):t}function x(t,e){return t>e?1:e>t?-1:0}function C(t,e){return 0>e?(null==t.length&&t.cacheResult(),t.length+e):e}function E(t){o(1/0!==t,"Cannot perform this action with an infinite sequence.")}function j(t,e){var n=new Ge;return n.next=function(){var n=t.next();return n.done?n:(n.value=e(n.value),n)},n}function U(t,e,n){return n instanceof Pe?R(t,e,n):n}function R(t,e,n){return new Qe(t._rootData,t._keyPath.concat(e),t._onChange,n)}function W(t,e,n){var r=t._rootData.updateIn(t._keyPath,n?Te.empty():void 0,e),i=t._keyPath||[];return t._onChange&&t._onChange.call(void 0,r,t._rootData,n?i.concat(n):i),new Qe(r,t._keyPath,t._onChange)}function P(t,e){return t instanceof Qe&&(t=t.deref()),e instanceof Qe&&(e=e.deref()),t===e?0!==t||0!==e||1/t===1/e:t!==t?e!==e:t instanceof Pe?t.equals(e):!1}function J(t,e){return a(0===t||1===t?e[t]:[e[0],e[1]])}function z(t,e){return{node:t,index:0,__prev:e}}function K(t,e,n,r){var i=Object.create(Ye);return i.length=t,i._root=e,i.__ownerID=n,i.__hash=r,i.__altered=!1,i}function B(t,e,n){var i=r(Me),u=r(be),s=L(t._root,t.__ownerID,0,c(e),e,n,i,u);if(!u.value)return t;var a=t.length+(i.value?n===ke?-1:1:0);return t.__ownerID?(t.length=a,t._root=s,t.__hash=void 0,t.__altered=!0,t):s?K(a,s):Te.empty()}function L(t,e,n,r,u,s,a,h){return t?t.update(e,n,r,u,s,a,h):s===ke?t:(i(h),i(a),new un(e,r,[u,s]))}function V(t){return t.constructor===un||t.constructor===nn}function N(t,e,n,r,i){if(t.hash===r)return new nn(e,r,[t.entry,i]);var u,s=(0===n?t.hash:t.hash>>>n)&Ie,a=(0===n?r:r>>>n)&Ie,h=s===a?[N(t,e,n+we,r,i)]:(u=new un(e,r,i),a>s?[t,u]:[u,t]);return new Ze(e,1<<s|1<<a,h)}function F(t,e,n,r){for(var i=0,u=0,s=Array(n),a=0,h=1,o=e.length;o>a;a++,h<<=1){var c=e[a];null!=c&&a!==r&&(i|=h,s[u++]=c)}return new Ze(t,i,s)}function G(t,e,n,r,i){for(var u=0,s=Array(Se),a=0;0!==n;a++,n>>>=1)s[a]=1&n?e[u++]:null;
<ide> return s[r]=i,new tn(t,u+1,s)}function H(t,e,n){for(var r=[],i=0;n.length>i;i++){var u=n[i];u&&r.push(Array.isArray(u)?Pe(u).fromEntrySeq():Pe(u))}return T(t,e,r)}function Q(t){return function(e,n){return e&&e.mergeDeepWith?e.mergeDeepWith(t,n):t?t(e,n):n}}function T(t,e,n){return 0===n.length?t:t.withMutations(function(t){for(var r=e?function(n,r){var i=t.get(r,ke);t.set(r,i===ke?n:e(i,n))}:function(e,n){t.set(n,e)},i=0;n.length>i;i++)n[i].forEach(r)})}function X(t,e,n,r,i){var u=e.length;if(i===u)return r(t);o(t.set,"updateIn with invalid keyPath");var s=i===u-1?n:Te.empty(),a=e[i],h=t.get(a,s),c=X(h,e,n,r,i+1);return c===h?t:t.set(a,c)}function Y(t){return t-=t>>1&1431655765,t=(858993459&t)+(t>>2&858993459),t=t+(t>>4)&252645135,t+=t>>8,t+=t>>16,127&t}function Z(t,e,n,r){var i=r?t:s(t);return i[e]=n,i}function $(t,e,n,r){var i=t.length+1;if(r&&e+1===i)return t[e]=n,t;for(var u=Array(i),s=0,a=0;i>a;a++)a===e?(u[a]=n,s=-1):u[a]=t[a+s];return u}function te(t,e,n){var r=t.length-1;if(n&&e===r)return t.pop(),t;for(var i=Array(r),u=0,s=0;r>s;s++)s===e&&(u=1),i[s]=t[s+u];return i}function ee(t,e,n,r,i,u){var s,a=t&&t.array;if(0===e){var h=0>n?0:n,o=n+Se;for(o>r&&(o=r),s=h;o>s;s++){var c=u?h+o-1-s:s;if(i(a&&a[c-n],c)===!1)return!1}}else{var f=1<<e,_=e-we;for(s=0;Ie>=s;s++){var l=u?Ie-s:s,v=n+(l<<e);if(r>v&&v+f>0){var g=a&&a[l];if(!ee(g,_,v,r,i,u))return!1}}}return!0}function ne(t,e,n,r,i){return{array:t,level:e,offset:n,max:r,rawMax:r-n>>e,index:0,__prev:i}}function re(t,e,n,r,i,u,s){var a=Object.create(ln);return a.length=e-t,a._origin=t,a._size=e,a._level=n,a._root=r,a._tail=i,a.__ownerID=u,a.__hash=s,a.__altered=!1,a}function ie(t,e,n){if(e=C(t,e),e>=t.length||0>e)return n===ke?t:t.withMutations(function(t){0>e?he(t,e).set(0,n):he(t,0,e+1).set(e,n)});e+=t._origin;var i=t._tail,u=t._root,s=r(be);return e>=ce(t._size)?i=ue(i,t.__ownerID,0,e,n,s):u=ue(u,t.__ownerID,t._level,e,n,s),s.value?t.__ownerID?(t._root=u,t._tail=i,t.__hash=void 0,t.__altered=!0,t):re(t._origin,t._size,t._level,u,i):t}function ue(t,e,n,r,u,s){var a,h=u===ke,o=r>>>n&Ie,c=t&&t.array.length>o;
<ide> if(h&&!c)return t;if(n>0){var f=t&&t.array[o],_=ue(f,e,n-we,r,u,s);return _===f?t:(a=se(t,e),a.array[o]=_,a)}return!h&&c&&t.array[o]===u?t:(i(s),a=se(t,e),h&&o===a.array.length-1?a.array.pop():a.array[o]=h?void 0:u,a)}function se(t,e){return e&&t&&e===t.ownerID?t:new vn(t?t.array.slice():[],e)}function ae(t,e){if(e>=ce(t._size))return t._tail;if(1<<t._level+we>e){for(var n=t._root,r=t._level;n&&r>0;)n=n.array[e>>>r&Ie],r-=we;return n}}function he(t,e,n){var r=t.__ownerID||new u,i=t._origin,s=t._size,a=i+e,h=null==n?s:0>n?s+n:i+n;if(a===i&&h===s)return t;if(a>=h)return t.clear();for(var o=t._level,c=t._root,f=0;0>a+f;)c=new vn(c&&c.array.length?[null,c]:[],r),o+=we,f+=1<<o;f&&(a+=f,i+=f,h+=f,s+=f);for(var _=ce(s),l=ce(h);l>=1<<o+we;)c=new vn(c&&c.array.length?[c]:[],r),o+=we;var v=t._tail,g=_>l?ae(t,h-1):l>_?new vn([],r):v;if(v&&l>_&&s>a&&v.array.length){c=se(c,r);for(var p=c,m=o;m>we;m-=we){var d=_>>>m&Ie;p=p.array[d]=se(p.array[d],r)}p.array[_>>>we&Ie]=v}if(s>h&&(g=g&&g.removeAfter(r,0,h)),a>=l)a-=l,h-=l,o=we,c=null,g=g&&g.removeBefore(r,0,a);else if(a>i||_>l){var y,w;f=0;do y=a>>>o&Ie,w=l-1>>>o&Ie,y===w&&(y&&(f+=(1<<o)*y),o-=we,c=c&&c.array[y]);while(c&&y===w);c&&a>i&&(c=c&&c.removeBefore(r,o,a-f)),c&&_>l&&(c=c&&c.removeAfter(r,o,l-f)),f&&(a-=f,h-=f)}return t.__ownerID?(t.length=h-a,t._origin=a,t._size=h,t._level=o,t._root=c,t._tail=g,t.__hash=void 0,t.__altered=!0,t):re(a,h,o,c,g)}function oe(t,e,n){for(var r=[],i=0;n.length>i;i++){var u=n[i];u&&r.push(Pe(u))}var s=Math.max.apply(null,r.map(function(t){return t.length||0}));return s>t.length&&(t=t.setLength(s)),T(t,e,r)}function ce(t){return Se>t?0:t-1>>>we<<we}function fe(t,e){var n=Object.create(wn);return n.length=t?t.length:0,n._map=t,n.__ownerID=e,n}function _e(t,e,n,r){var i=Object.create(In.prototype);return i.length=t?t.length:0,i._map=t,i._vector=e,i.__ownerID=n,i.__hash=r,i}function le(t,e,n){var r=t._map,i=t._vector,u=r.get(e),s=void 0!==u,a=n===ke;if(!s&&a||s&&n===i.get(u)[1])return t;s||(u=i.length);var h=a?r.remove(e):s?r:r.set(e,u),o=a?i.remove(u):i.set(u,[e,n]);
<ide><path>src/Sequence.js
<ide> function filterFactory(sequence, predicate, context, useKeys) {
<ide> var iterations = 0;
<ide> sequence.__iterate((v, k, c) => {
<ide> if (predicate.call(context, v, k, c)) {
<del> if (fn(v, useKeys ? k : iterations, this) !== false) {
<del> iterations++;
<del> } else {
<del> return false;
<del> }
<add> iterations++;
<add> return fn(v, useKeys ? k : iterations - 1, this);
<ide> }
<ide> }, reverse);
<ide> return iterations; | 3 |
Java | Java | fix checkstyle violation | a51dc84cb16f54c3bfd5780b1a0f90c22f140e9f | <ide><path>spring-beans/src/test/java/org/springframework/beans/factory/DefaultListableBeanFactoryTests.java
<ide>
<ide> import org.apache.commons.logging.Log;
<ide> import org.apache.commons.logging.LogFactory;
<del>import org.junit.jupiter.api.Disabled;
<ide> import org.junit.jupiter.api.Test;
<ide> import org.junit.jupiter.api.Timeout;
<ide> | 1 |
Javascript | Javascript | show changelog before minor/patch prompt | c9100d95b97913192397772ad81038ba322d068b | <ide><path>scripts/devtools/prepare-release.js
<ide> async function main() {
<ide>
<ide> await checkNPMPermissions();
<ide>
<add> const sha = await getPreviousCommitSha();
<add> const [shortCommitLog, formattedCommitLog] = await getCommitLog(sha);
<add>
<add> console.log('');
<add> console.log(
<add> 'This release includes the following commits:',
<add> chalk.gray(shortCommitLog)
<add> );
<add> console.log('');
<add>
<ide> const releaseType = await getReleaseType();
<ide>
<ide> const path = join(ROOT_PATH, PACKAGE_PATHS[0]);
<ide> async function main() {
<ide> ? `${major}.${minor + 1}.0`
<ide> : `${major}.${minor}.${patch + 1}`;
<ide>
<add> updateChangelog(nextVersion, formattedCommitLog);
<add>
<add> await reviewChangelogPrompt();
<add>
<ide> updatePackageVersions(previousVersion, nextVersion);
<ide> updateManifestVersions(previousVersion, nextVersion);
<ide>
<ide> async function main() {
<ide> );
<ide> console.log('');
<ide>
<del> const sha = await getPreviousCommitSha();
<del> const commitLog = await getCommitLog(sha);
<del>
<del> updateChangelog(nextVersion, commitLog);
<del>
<del> await reviewChangelogPrompt();
<del>
<ide> await commitPendingChanges(previousVersion, nextVersion);
<ide>
<ide> printFinalInstructions();
<ide> async function commitPendingChanges(previousVersion, nextVersion) {
<ide> }
<ide>
<ide> async function getCommitLog(sha) {
<add> let shortLog = '';
<ide> let formattedLog = '';
<ide>
<ide> const rawLog = await execRead(`
<ide> async function getCommitLog(sha) {
<ide> const pr = match[2];
<ide>
<ide> formattedLog += `\n* ${title} ([USERNAME](https://github.com/USERNAME) in [#${pr}](${PULL_REQUEST_BASE_URL}${pr}))`;
<add> shortLog += `\n* ${title}`;
<ide> } else {
<ide> formattedLog += `\n* ${line}`;
<add> shortLog += `\n* ${line}`;
<ide> }
<ide> });
<ide>
<del> return formattedLog;
<add> return [shortLog, formattedLog];
<ide> }
<ide>
<ide> async function getPreviousCommitSha() { | 1 |
Text | Text | fix indentation of sample code | 4a70f2873ef62257aa7634e731dd83343bad000a | <ide><path>guide/portuguese/javascript/es6/arrow-functions/index.md
<ide> localeTitle: Funções de seta
<ide> Funções no ES6 mudaram um pouco. Quero dizer a sintaxe.
<ide>
<ide> ```javascript
<del>// Old Syntax
<del> function oldOne() {
<add>// Old Syntax
<add>function oldOne() {
<ide> console.log("Hello World..!");
<del> }
<add>}
<ide>
<del> // New Syntax
<del> var newOne = () => {
<add>// New Syntax
<add>var newOne = () => {
<ide> console.log("Hello World..!");
<del> }
<add>}
<ide> ```
<ide>
<ide> A nova sintaxe pode ser um pouco confusa. Mas vou tentar explicar a sintaxe. Existem duas partes da sintaxe.
<ide> Outro exemplo com parâmetros:
<ide> ```javascript
<ide> let NewOneWithParameters = (a, b) => {
<ide> console.log(a+b); // 30
<del> }
<del> NewOneWithParameters(10, 20);
<add>}
<add>NewOneWithParameters(10, 20);
<ide> ```
<ide>
<ide> Parênteses são opcionais quando há apenas um nome de parâmetro:
<ide>
<ide> ```javascript
<ide> let newOneWithOneParam = a => {
<ide> console.log(a);
<del> }
<add>}
<ide> ```
<ide>
<ide> Uma vantagem incrível da função de setas é que você não pode religar uma função de seta. Sempre será chamado com o contexto em que foi definido. Apenas use uma função normal.
<ide> Uma vantagem incrível da função de setas é que você não pode religar uma f
<ide> });
<ide> ```
<ide>
<del>Eu não acho que eu precise dar uma explicação para isso. É simples.
<ide>\ No newline at end of file
<add>Eu não acho que eu precise dar uma explicação para isso. É simples. | 1 |
Python | Python | fix incorrect datetime details (dagrun views) | 7667d94091b663f9d9caecf7afe1b018bcad7eda | <ide><path>airflow/www/utils.py
<ide> def datetime_html(dttm: Optional[DateTime]) -> str:
<ide> as_iso = dttm.isoformat() if dttm else ''
<ide> if not as_iso:
<ide> return Markup('')
<add> as_iso_short = as_iso
<ide> if timezone.utcnow().isoformat()[:4] == as_iso[:4]:
<del> as_iso = as_iso[5:]
<add> as_iso_short = as_iso[5:]
<ide> # The empty title will be replaced in JS code when non-UTC dates are displayed
<del> return Markup('<nobr><time title="" datetime="{}">{}</time></nobr>').format(as_iso, as_iso)
<add> return Markup('<nobr><time title="" datetime="{}">{}</time></nobr>').format(as_iso, as_iso_short)
<ide>
<ide>
<ide> def json_f(attr_name): | 1 |
Python | Python | fix example usage for `azurecosmosdocumentsensor` | d3976d9b20163550dbfe8cf9b326260516fd9bb8 | <ide><path>airflow/providers/microsoft/azure/sensors/cosmos.py
<ide> class AzureCosmosDocumentSensor(BaseSensorOperator):
<ide>
<ide> .. code-block::
<ide>
<del> azure_cosmos_sensor = AzureCosmosDocumentSensor(
<del> database_name="somedatabase_name",
<del> collection_name="somecollection_name",
<del> document_id="unique-doc-id",
<del> azure_cosmos_conn_id="azure_cosmos_default",
<del> task_id="azure_cosmos_sensor")
<add> azure_cosmos_sensor = AzureCosmosDocumentSensor(
<add> database_name="somedatabase_name",
<add> collection_name="somecollection_name",
<add> document_id="unique-doc-id",
<add> azure_cosmos_conn_id="azure_cosmos_default",
<add> task_id="azure_cosmos_sensor",
<add> )
<ide>
<ide> :param database_name: Target CosmosDB database_name.
<ide> :param collection_name: Target CosmosDB collection_name. | 1 |
Python | Python | simplify gpu check | 7c6a97559d070f161131853dc03e600c6a0ca82d | <ide><path>spacy/cli/_util.py
<ide> from typer.main import get_command
<ide> from contextlib import contextmanager
<ide> from thinc.api import Config, ConfigValidationError, require_gpu
<del>from thinc.util import has_cupy, gpu_is_available
<add>from thinc.util import gpu_is_available
<ide> from configparser import InterpolationError
<ide> import os
<ide>
<ide> def setup_gpu(use_gpu: int, silent=None) -> None:
<ide> require_gpu(use_gpu)
<ide> else:
<ide> local_msg.info("Using CPU")
<del> if has_cupy and gpu_is_available():
<add> if gpu_is_available():
<ide> local_msg.info("To switch to GPU 0, use the option: --gpu-id 0") | 1 |
Javascript | Javascript | fix lint from 4fe02e2 | d3a75344f5d7580181e35394e052a1c13f0e1261 | <ide><path>lib/timers.js
<ide> function Timeout(after) {
<ide> this._idleStart = null;
<ide> this._onTimeout = null;
<ide> this._repeat = null;
<del>};
<add>}
<ide>
<ide>
<ide> function unrefdHandle() { | 1 |
Text | Text | add 15.6.2 blog post to master | 9f8387a15f20b78f29c360a8d75b6590f699bf98 | <ide><path>docs/_posts/2017-09-25-react-v15.6.2.md
<add>---
<add>title: "React v15.6.2"
<add>author: nhunzaker
<add>---
<add>
<add>Today we're sending out React 15.6.2. In 15.6.1, we shipped a few fixes for change events and inputs that had some unintended consequences. Those regressions have been ironed out, and we've also included a few more fixes to improve the stability of React across all browsers.
<add>
<add>Additionally, 15.6.2 adds support for the [`controlList`](https://developers.google.com/web/updates/2017/03/chrome-58-media-updates#controlslist) attribute, and CSS columns are no longer appended with a `px` suffix.
<add>
<add>## Installation
<add>
<add>We recommend using [Yarn](https://yarnpkg.com/) or [npm](https://www.npmjs.com/) for managing front-end dependencies. If you're new to package managers, the [Yarn documentation](https://yarnpkg.com/en/docs/getting-started) is a good place to get started.
<add>
<add>To install React with Yarn, run:
<add>
<add>```bash
<add>yarn add react@^15.6.2 react-dom@^15.6.2
<add>```
<add>
<add>To install React with npm, run:
<add>
<add>```bash
<add>npm install --save react@^15.6.2 react-dom@^15.6.2
<add>```
<add>
<add>We recommend using a bundler like [webpack](https://webpack.js.org/) or [Browserify](http://browserify.org/) so you can write modular code and bundle it together into small packages to optimize load time.
<add>
<add>Remember that by default, React runs extra checks and provides helpful warnings in development mode. When deploying your app, make sure to [use the production build](/react/docs/optimizing-performance.html#use-the-production-build).
<add>
<add>In case you don't use a bundler, we also provide pre-built bundles in the npm packages which you can [include as script tags](/react/docs/installation.html#using-a-cdn) on your page:
<add>
<add>* **React**<br/>
<add> Dev build with warnings: [react/dist/react.js](https://unpkg.com/[email protected]/dist/react.js)<br/>
<add> Minified build for production: [react/dist/react.min.js](https://unpkg.com/[email protected]/dist/react.min.js)<br/>
<add>* **React with Add-Ons**<br/>
<add> Dev build with warnings: [react/dist/react-with-addons.js](https://unpkg.com/[email protected]/dist/react-with-addons.js)<br/>
<add> Minified build for production: [react/dist/react-with-addons.min.js](https://unpkg.com/[email protected]/dist/react-with-addons.min.js)<br/>
<add>* **React DOM** (include React in the page before React DOM)<br/>
<add> Dev build with warnings: [react-dom/dist/react-dom.js](https://unpkg.com/[email protected]/dist/react-dom.js)<br/>
<add> Minified build for production: [react-dom/dist/react-dom.min.js](https://unpkg.com/[email protected]/dist/react-dom.min.js)<br/>
<add>* **React DOM Server** (include React in the page before React DOM Server)<br/>
<add> Dev build with warnings: [react-dom/dist/react-dom-server.js](https://unpkg.com/[email protected]/dist/react-dom-server.js)<br/>
<add> Minified build for production: [react-dom/dist/react-dom-server.min.js](https://unpkg.com/[email protected]/dist/react-dom-server.min.js)<br/>
<add>
<add>We've also published version `15.6.2` of `react` and `react-dom` on npm, and the `react` package on bower.
<add>
<add>---
<add>
<add>## Changelog
<add>
<add>## 15.6.2 (September 25, 2017)
<add>
<add>### All Packages
<add>* Switch from BSD + Patents to MIT license
<add>
<add>### React DOM
<add>
<add>* Fix a bug where modifying `document.documentMode` would trigger IE detection in other browsers, breaking change events. ([@aweary](https://github.com/aweary) in [#10032](https://github.com/facebook/react/pull/10032))
<add>* CSS Columns are treated as unitless numbers. ([@aweary](https://github.com/aweary) in [#10115](https://github.com/facebook/react/pull/10115))
<add>* Fix bug in QtWebKit when wrapping synthetic events in proxies. ([@walrusfruitcake](https://github.com/walrusfruitcake) in [#10115](https://github.com/facebook/react/pull/10011))
<add>* Prevent event handlers from receiving extra argument in development. ([@aweary](https://github.com/aweary) in [#10115](https://github.com/facebook/react/pull/8363))
<add>* Fix cases where `onChange` would not fire with `defaultChecked` on radio inputs. ([@jquense](https://github.com/jquense) in [#10156](https://github.com/facebook/react/pull/10156))
<add>* Add support for `controlList` attribute to DOM property whitelist ([@nhunzaker](https://github.com/nhunzaker) in [#9940](https://github.com/facebook/react/pull/9940))
<add>* Fix a bug where creating an element with a ref in a constructor did not throw an error in development. ([@iansu](https://github.com/iansu) in [#10025](https://github.com/facebook/react/pull/10025)) | 1 |
Java | Java | fix issue with sub-protocol negotiation and sockjs | 8751936b1219755f3c0f712f7b3597ea03e2e394 | <ide><path>spring-websocket/src/main/java/org/springframework/web/socket/sockjs/transport/handler/SockJsWebSocketHandler.java
<ide> /*
<del> * Copyright 2002-2013 the original author or authors.
<add> * Copyright 2002-2014 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>
<ide> package org.springframework.web.socket.sockjs.transport.handler;
<ide>
<add>import java.util.ArrayList;
<add>import java.util.Collections;
<add>import java.util.List;
<ide> import java.util.concurrent.atomic.AtomicInteger;
<ide>
<ide> import org.springframework.util.Assert;
<ide> import org.springframework.web.socket.CloseStatus;
<add>import org.springframework.web.socket.SubProtocolCapable;
<ide> import org.springframework.web.socket.TextMessage;
<ide> import org.springframework.web.socket.WebSocketHandler;
<ide> import org.springframework.web.socket.WebSocketSession;
<ide> import org.springframework.web.socket.handler.TextWebSocketHandler;
<add>import org.springframework.web.socket.handler.WebSocketHandlerDecorator;
<ide> import org.springframework.web.socket.sockjs.transport.SockJsServiceConfig;
<ide> import org.springframework.web.socket.sockjs.transport.session.WebSocketServerSockJsSession;
<ide>
<ide> * @author Rossen Stoyanchev
<ide> * @since 4.0
<ide> */
<del>public class SockJsWebSocketHandler extends TextWebSocketHandler {
<add>public class SockJsWebSocketHandler extends TextWebSocketHandler implements SubProtocolCapable {
<ide>
<ide> private final SockJsServiceConfig sockJsServiceConfig;
<ide>
<ide> private final WebSocketServerSockJsSession sockJsSession;
<ide>
<add> private final List<String> subProtocols;
<add>
<ide> private final AtomicInteger sessionCount = new AtomicInteger(0);
<ide>
<ide>
<del> public SockJsWebSocketHandler(SockJsServiceConfig serviceConfig,
<del> WebSocketHandler webSocketHandler, WebSocketServerSockJsSession sockJsSession) {
<add> public SockJsWebSocketHandler(SockJsServiceConfig serviceConfig, WebSocketHandler webSocketHandler,
<add> WebSocketServerSockJsSession sockJsSession) {
<ide>
<ide> Assert.notNull(serviceConfig, "serviceConfig must not be null");
<ide> Assert.notNull(webSocketHandler, "webSocketHandler must not be null");
<ide> Assert.notNull(sockJsSession, "session must not be null");
<ide>
<ide> this.sockJsServiceConfig = serviceConfig;
<ide> this.sockJsSession = sockJsSession;
<add>
<add> webSocketHandler = WebSocketHandlerDecorator.unwrap(webSocketHandler);
<add> this.subProtocols = ((webSocketHandler instanceof SubProtocolCapable) ?
<add> new ArrayList<String>(((SubProtocolCapable) webSocketHandler).getSubProtocols()) : null);
<add> }
<add>
<add> @Override
<add> public List<String> getSubProtocols() {
<add> return this.subProtocols;
<ide> }
<ide>
<ide> protected SockJsServiceConfig getSockJsConfig() {
<ide><path>spring-websocket/src/test/java/org/springframework/web/socket/sockjs/transport/handler/SockJsWebSocketHandlerTests.java
<add>/*
<add> * Copyright 2002-2014 the original author or authors.
<add> *
<add> * Licensed under the Apache License, Version 2.0 (the "License");
<add> * you may not use this file except in compliance with the License.
<add> * You may obtain a copy of the License at
<add> *
<add> * http://www.apache.org/licenses/LICENSE-2.0
<add> *
<add> * Unless required by applicable law or agreed to in writing, software
<add> * distributed under the License is distributed on an "AS IS" BASIS,
<add> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<add> * See the License for the specific language governing permissions and
<add> * limitations under the License.
<add> */
<add>
<add>package org.springframework.web.socket.sockjs.transport.handler;
<add>
<add>import org.junit.Test;
<add>import org.springframework.messaging.SubscribableChannel;
<add>import org.springframework.scheduling.TaskScheduler;
<add>import org.springframework.web.socket.WebSocketHandler;
<add>import org.springframework.web.socket.handler.TextWebSocketHandler;
<add>import org.springframework.web.socket.messaging.StompSubProtocolHandler;
<add>import org.springframework.web.socket.messaging.SubProtocolWebSocketHandler;
<add>import org.springframework.web.socket.sockjs.transport.session.WebSocketServerSockJsSession;
<add>
<add>import static org.junit.Assert.assertEquals;
<add>import static org.junit.Assert.assertNull;
<add>import static org.mockito.Mockito.mock;
<add>
<add>/**
<add> * Unit tests for {@link SockJsWebSocketHandler}.
<add> * @author Rossen Stoyanchev
<add> */
<add>public class SockJsWebSocketHandlerTests {
<add>
<add>
<add> @Test
<add> public void getSubProtocols() throws Exception {
<add> SubscribableChannel channel = mock(SubscribableChannel.class);
<add> SubProtocolWebSocketHandler handler = new SubProtocolWebSocketHandler(channel, channel);
<add> StompSubProtocolHandler stompHandler = new StompSubProtocolHandler();
<add> handler.addProtocolHandler(stompHandler);
<add>
<add> TaskScheduler scheduler = mock(TaskScheduler.class);
<add> DefaultSockJsService service = new DefaultSockJsService(scheduler);
<add> WebSocketServerSockJsSession session = new WebSocketServerSockJsSession("1", service, handler, null);
<add> SockJsWebSocketHandler sockJsHandler = new SockJsWebSocketHandler(service, handler, session);
<add>
<add> assertEquals(stompHandler.getSupportedProtocols(), sockJsHandler.getSubProtocols());
<add> }
<add>
<add> @Test
<add> public void getSubProtocolsNone() throws Exception {
<add> WebSocketHandler handler = new TextWebSocketHandler();
<add> TaskScheduler scheduler = mock(TaskScheduler.class);
<add> DefaultSockJsService service = new DefaultSockJsService(scheduler);
<add> WebSocketServerSockJsSession session = new WebSocketServerSockJsSession("1", service, handler, null);
<add> SockJsWebSocketHandler sockJsHandler = new SockJsWebSocketHandler(service, handler, session);
<add>
<add> assertNull(sockJsHandler.getSubProtocols());
<add> }
<add>
<add>} | 2 |
Python | Python | normalize signature of deletionmixin.post | 52f99b78bcc36c4dfdd2870ee139cd5461fb9e91 | <ide><path>django/views/generic/edit.py
<ide> def delete(self, request, *args, **kwargs):
<ide> return HttpResponseRedirect(success_url)
<ide>
<ide> # Add support for browsers which only accept GET and POST for now.
<del> def post(self, *args, **kwargs):
<del> return self.delete(*args, **kwargs)
<add> def post(self, request, *args, **kwargs):
<add> return self.delete(request, *args, **kwargs)
<ide>
<ide> def get_success_url(self):
<ide> if self.success_url: | 1 |
Text | Text | update systemd article to reference dropin file | 35e7a7c3e2f0e7329ef666b0e5078b39626befd2 | <ide><path>docs/articles/systemd.md
<ide> If you want Docker to start at boot, you should also:
<ide> There are a number of ways to configure the daemon flags and environment variables
<ide> for your Docker daemon.
<ide>
<del>If the `docker.service` file is set to use an `EnvironmentFile`
<del>(often pointing to `/etc/sysconfig/docker`) then you can modify the
<del>referenced file.
<add>The recommended way is to use a systemd drop-in file. These are local files in
<add>the `/etc/systemd/system/docker.service.d` directory. This could also be
<add>`/etc/systemd/system/docker.service`, which also works for overriding the
<add>defaults from `/lib/systemd/system/docker.service`.
<ide>
<del>Check if the `docker.service` uses an `EnvironmentFile`:
<add>However, if you had previously used a package which had an `EnvironmentFile`
<add>(often pointing to `/etc/sysconfig/docker`) then for backwards compatibility,
<add>you drop a file in the `/etc/systemd/system/docker.service.d`
<add>directory including the following:
<add>
<add> [Service]
<add> EnvironmentFile=-/etc/sysconfig/docker
<add> EnvironmentFile=-/etc/sysconfig/docker-storage
<add> EnvironmentFile=-/etc/sysconfig/docker-network
<add> ExecStart=
<add> ExecStart=/usr/bin/docker -d -H fd:// $OPTIONS \
<add> $DOCKER_STORAGE_OPTIONS \
<add> $DOCKER_NETWORK_OPTIONS \
<add> $BLOCK_REGISTRY \
<add> $INSECURE_REGISTRY
<add>
<add>To check if the `docker.service` uses an `EnvironmentFile`:
<ide>
<ide> $ sudo systemctl show docker | grep EnvironmentFile
<ide> EnvironmentFile=-/etc/sysconfig/docker (ignore_errors=yes)
<ide>
<del>Alternatively, find out where the service file is located, and look for the
<del>property:
<add>Alternatively, find out where the service file is located:
<ide>
<ide> $ sudo systemctl status docker | grep Loaded
<ide> Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled)
<ide> In this example, we'll assume that your `docker.service` file looks something li
<ide>
<ide> [Service]
<ide> Type=notify
<del> EnvironmentFile=-/etc/sysconfig/docker
<del> ExecStart=/usr/bin/docker daemon -H fd:// $OPTIONS
<add> ExecStart=/usr/bin/docker daemon -H fd://
<ide> LimitNOFILE=1048576
<ide> LimitNPROC=1048576
<ide>
<ide> [Install]
<ide> Also=docker.socket
<ide>
<del>This will allow us to add extra flags to the `/etc/sysconfig/docker` file by
<del>setting `OPTIONS`:
<add>This will allow us to add extra flags via a drop-in file (mentioned above) by
<add>placing a file containing the following in the `/etc/systemd/system/docker.service.d`
<add>directory:
<ide>
<del> OPTIONS="--graph /mnt/docker-data --storage-driver btrfs"
<add> [Service]
<add> ExecStart=
<add> ExecStart=/usr/bin/docker daemon -H fd:// --graph /mnt/docker-data --storage-driver btrfs
<ide>
<ide> You can also set other environment variables in this file, for example, the
<ide> `HTTP_PROXY` environment variables described below. | 1 |
Text | Text | improve fs doc intro | 010383a1745a989d27d3462a3beb9fc159000cb4 | <ide><path>doc/api/fs.md
<ide>
<ide> <!-- source_link=lib/fs.js -->
<ide>
<del>The `fs` module provides an API for interacting with the file system in a
<del>manner closely modeled around standard POSIX functions.
<add>The `fs` module enables interacting with the file system in a
<add>way modeled on standard POSIX functions.
<ide>
<ide> To use this module:
<ide>
<ide> ```js
<ide> const fs = require('fs');
<ide> ```
<ide>
<del>All file system operations have synchronous and asynchronous forms.
<add>All file system operations have synchronous, callback, and promise-based
<add>forms.
<ide>
<del>The asynchronous form always takes a completion callback as its last argument.
<del>The arguments passed to the completion callback depend on the method, but the
<del>first argument is always reserved for an exception. If the operation was
<del>completed successfully, then the first argument will be `null` or `undefined`.
<add>## Synchronous example
<add>
<add>The synchronous form blocks the Node.js event loop and further JavaScript
<add>execution until the operation is complete. Exceptions are thrown immediately
<add>and can be handled using `try…catch`, or can be allowed to bubble up.
<add>
<add>```js
<add>const fs = require('fs');
<add>
<add>try {
<add> fs.unlinkSync('/tmp/hello');
<add> console.log('successfully deleted /tmp/hello');
<add>} catch (err) {
<add> // handle the error
<add>}
<add>```
<add>
<add>## Callback example
<add>
<add>The callback form takes a completion callback function as its last
<add>argument and invokes the operation asynchronously. The arguments passed to
<add>the completion callback depend on the method, but the first argument is always
<add>reserved for an exception. If the operation is completed successfully, then
<add>the first argument is `null` or `undefined`.
<ide>
<ide> ```js
<ide> const fs = require('fs');
<ide> fs.unlink('/tmp/hello', (err) => {
<ide> });
<ide> ```
<ide>
<del>Exceptions that occur using synchronous operations are thrown immediately and
<del>may be handled using `try…catch`, or may be allowed to bubble up.
<add>## Promise example
<add>
<add>Promise-based operations return a `Promise` that is resolved when the
<add>asynchronous operation is complete.
<ide>
<ide> ```js
<del>const fs = require('fs');
<add>const fs = require('fs/promises');
<ide>
<del>try {
<del> fs.unlinkSync('/tmp/hello');
<del> console.log('successfully deleted /tmp/hello');
<del>} catch (err) {
<del> // handle the error
<del>}
<add>(async function(path) {
<add> try {
<add> await fs.unlink(path);
<add> console.log(`successfully deleted ${path}`);
<add> } catch (error) {
<add> console.error('there was an error:', error.message);
<add> }
<add>})('/tmp/hello');
<ide> ```
<ide>
<del>There is no guaranteed ordering when using asynchronous methods. So the
<del>following is prone to error because the `fs.stat()` operation may complete
<del>before the `fs.rename()` operation:
<add>## Ordering of callback and promise-based operations
<add>
<add>There is no guaranteed ordering when using either the callback or
<add>promise-based methods. For example, the following is prone to error
<add>because the `fs.stat()` operation might complete before the `fs.rename()`
<add>operation:
<ide>
<ide> ```js
<ide> fs.rename('/tmp/hello', '/tmp/world', (err) => {
<ide> fs.rename('/tmp/hello', '/tmp/world', (err) => {
<ide> });
<ide> ```
<ide>
<del>In busy processes, use the asynchronous versions of these calls. The synchronous
<del>versions will block the entire process until they complete, halting all
<del>connections.
<add>Or, use the promise-based API:
<ide>
<del>Most asynchronous `fs` functions allow the callback argument to be omitted.
<del>However, this usage is deprecated. When the callback is omitted, a default
<del>callback is used that rethrows errors. To get a trace to the original call site,
<del>set the `NODE_DEBUG` environment variable:
<add>```js
<add>const fs = require('fs/promises');
<ide>
<del>```console
<del>$ cat script.js
<del>function bad() {
<del> require('fs').readFile('/');
<del>}
<del>bad();
<del>
<del>$ env NODE_DEBUG=fs node script.js
<del>fs.js:88
<del> throw backtrace;
<del> ^
<del>Error: EISDIR: illegal operation on a directory, read
<del> <stack trace.>
<add>(async function(from, to) {
<add> try {
<add> await fs.rename(from, to);
<add> const stats = await fs.stat(to);
<add> console.log(`stats: ${JSON.stringify(stats)}`);
<add> } catch (error) {
<add> console.error('there was an error:', error.message);
<add> }
<add>})('/tmp/hello', '/tmp/world');
<ide> ```
<ide>
<ide> ## File paths
<ide> a string, a [`Buffer`][], or a [`URL`][] object using the `file:` protocol.
<ide>
<ide> String form paths are interpreted as UTF-8 character sequences identifying
<ide> the absolute or relative filename. Relative paths will be resolved relative
<del>to the current working directory as specified by `process.cwd()`.
<add>to the current working directory as determined by calling `process.cwd()`.
<ide>
<ide> Example using an absolute path on POSIX:
<ide> | 1 |
Python | Python | fix #849 - part 2 | b410a0c4ed36255d9d2a89bb924e710829b6043f | <ide><path>glances/plugins/glances_processlist.py
<ide> def add_tree_decoration(self, child_data, is_last_child, first_level):
<ide> child_data = new_child_data
<ide> pos = new_pos
<ide>
<del> # draw node prefix
<del> if is_last_child:
<del> prefix = "└─"
<del> else:
<del> prefix = "├─"
<del> child_data[pos[0]]["msg"] = prefix
<del>
<del> # add indentation
<del> for i in pos:
<del> spacing = 2
<del> if first_level:
<del> spacing = 1
<del> elif is_last_child and (i is not pos[0]):
<del> # compensate indentation for missing '│' char
<del> spacing = 3
<del> child_data[i]["msg"] = "%s%s" % (" " * spacing, child_data[i]["msg"])
<del>
<del> if not is_last_child:
<del> # add '│' tree decoration
<del> for i in pos[1:]:
<del> old_str = child_data[i]["msg"]
<add> if pos:
<add> # draw node prefix
<add> if is_last_child:
<add> prefix = "└─"
<add> else:
<add> prefix = "├─"
<add> child_data[pos[0]]["msg"] = prefix
<add>
<add> # add indentation
<add> for i in pos:
<add> spacing = 2
<ide> if first_level:
<del> child_data[i]["msg"] = " │" + old_str[2:]
<del> else:
<del> child_data[i]["msg"] = old_str[:2] + "│" + old_str[3:]
<add> spacing = 1
<add> elif is_last_child and (i is not pos[0]):
<add> # compensate indentation for missing '│' char
<add> spacing = 3
<add> child_data[i]["msg"] = "%s%s" % (" " * spacing, child_data[i]["msg"])
<add>
<add> if not is_last_child:
<add> # add '│' tree decoration
<add> for i in pos[1:]:
<add> old_str = child_data[i]["msg"]
<add> if first_level:
<add> child_data[i]["msg"] = " │" + old_str[2:]
<add> else:
<add> child_data[i]["msg"] = old_str[:2] + "│" + old_str[3:]
<add>
<ide> return child_data
<ide>
<ide> def get_process_curses_data(self, p, first, args): | 1 |
Ruby | Ruby | fix memcached shadowing | e370cd784bd678704046f3f508a016811ed8d725 | <ide><path>Library/Homebrew/formula_cellar_checks.rb
<ide> def check_shadowed_headers
<ide> return if formula.name == formula_name
<ide> end
<ide>
<del> if MacOS.version < :mavericks &&
<del> (formula.name.start_with?("postgresql") ||
<del> formula.name.start_with?("memcached"))
<del> return
<del> end
<add> return if MacOS.version < :mavericks && formula.name.start_with?("postgresql")
<add> return if MacOS.version < :yosemite && formula.name.start_with?("memcached")
<ide>
<ide> return if formula.keg_only? || !formula.include.directory?
<ide> | 1 |
Javascript | Javascript | treat empty string as null | c1220ebdde506de91c8b9693b5cb67ac710c8c89 | <ide><path>packages/react-dom/src/__tests__/ReactDOMServerIntegrationElements-test.js
<ide> describe('ReactDOMServerIntegration', () => {
<ide> {''}
<ide> </div>,
<ide> );
<del> if (render === serverRender || render === streamRender) {
<del> // For plain server markup result we should have no text nodes if
<del> // they're all empty.
<del> expect(e.childNodes.length).toBe(0);
<del> expect(e.textContent).toBe('');
<del> } else {
<del> expect(e.childNodes.length).toBe(3);
<del> expectTextNode(e.childNodes[0], '');
<del> expectTextNode(e.childNodes[1], '');
<del> expectTextNode(e.childNodes[2], '');
<del> }
<add> expect(e.childNodes.length).toBe(0);
<add> expect(e.textContent).toBe('');
<ide> });
<ide>
<ide> itRenders('a div with multiple whitespace children', async render => {
<ide> describe('ReactDOMServerIntegration', () => {
<ide>
<ide> itRenders('a leading blank child with a text sibling', async render => {
<ide> const e = await render(<div>{''}foo</div>);
<del> if (render === serverRender || render === streamRender) {
<del> expect(e.childNodes.length).toBe(1);
<del> expectTextNode(e.childNodes[0], 'foo');
<del> } else {
<del> expect(e.childNodes.length).toBe(2);
<del> expectTextNode(e.childNodes[0], '');
<del> expectTextNode(e.childNodes[1], 'foo');
<del> }
<add> expect(e.childNodes.length).toBe(1);
<add> expectTextNode(e.childNodes[0], 'foo');
<ide> });
<ide>
<ide> itRenders('a trailing blank child with a text sibling', async render => {
<ide> const e = await render(<div>foo{''}</div>);
<del> // with Fiber, there are just two text nodes.
<del> if (render === serverRender || render === streamRender) {
<del> expect(e.childNodes.length).toBe(1);
<del> expectTextNode(e.childNodes[0], 'foo');
<del> } else {
<del> expect(e.childNodes.length).toBe(2);
<del> expectTextNode(e.childNodes[0], 'foo');
<del> expectTextNode(e.childNodes[1], '');
<del> }
<add> expect(e.childNodes.length).toBe(1);
<add> expectTextNode(e.childNodes[0], 'foo');
<ide> });
<ide>
<ide> itRenders('an element with two text children', async render => {
<ide><path>packages/react-dom/src/__tests__/ReactDOMServerPartialHydration-test.internal.js
<ide>
<ide> 'use strict';
<ide>
<del>let React;
<add>let React = require('react');
<ide> let ReactDOM;
<ide> let ReactDOMServer;
<ide> let Scheduler;
<ide> function dispatchMouseEvent(to, from) {
<ide> }
<ide> }
<ide>
<add>class TestAppClass extends React.Component {
<add> render() {
<add> return (
<add> <div>
<add> <>{''}</>
<add> <>{'Hello'}</>
<add> </div>
<add> );
<add> }
<add>}
<add>
<ide> describe('ReactDOMServerPartialHydration', () => {
<ide> beforeEach(() => {
<ide> jest.resetModuleRegistry();
<ide> describe('ReactDOMServerPartialHydration', () => {
<ide> expect(ref.current).toBe(span);
<ide> expect(ref.current.innerHTML).toBe('Hidden child');
<ide> });
<add>
<add> function itHydratesWithoutMismatch(msg, App) {
<add> it('hydrates without mismatch ' + msg, () => {
<add> const container = document.createElement('div');
<add> document.body.appendChild(container);
<add> const finalHTML = ReactDOMServer.renderToString(<App />);
<add> container.innerHTML = finalHTML;
<add>
<add> ReactDOM.hydrateRoot(container, <App />);
<add> Scheduler.unstable_flushAll();
<add> });
<add> }
<add>
<add> itHydratesWithoutMismatch('an empty string with neighbors', function App() {
<add> return (
<add> <div>
<add> <div id="test">Test</div>
<add> {'' && <div>Test</div>}
<add> {'Test'}
<add> </div>
<add> );
<add> });
<add>
<add> itHydratesWithoutMismatch('an empty string', function App() {
<add> return '';
<add> });
<add> itHydratesWithoutMismatch(
<add> 'an empty string simple in fragment',
<add> function App() {
<add> return (
<add> <>
<add> {''}
<add> {'sup'}
<add> </>
<add> );
<add> },
<add> );
<add> itHydratesWithoutMismatch(
<add> 'an empty string simple in suspense',
<add> function App() {
<add> return <Suspense>{'' && false}</Suspense>;
<add> },
<add> );
<add>
<add> itHydratesWithoutMismatch('an empty string in class component', TestAppClass);
<ide> });
<ide><path>packages/react-dom/src/__tests__/ReactMultiChildText-test.js
<ide> const expectChildren = function(container, children) {
<ide> const child = children[i];
<ide>
<ide> if (typeof child === 'string') {
<add> if (child === '') {
<add> continue;
<add> }
<ide> textNode = outerNode.childNodes[mountIndex];
<ide> expect(textNode.nodeType).toBe(3);
<ide> expect(textNode.data).toBe(child);
<ide> describe('ReactMultiChildText', () => {
<ide> true, [],
<ide> 0, '0',
<ide> 1.2, '1.2',
<del> '', '',
<add> '', [],
<ide> 'foo', 'foo',
<ide>
<ide> [], [],
<ide> describe('ReactMultiChildText', () => {
<ide> [true], [],
<ide> [0], ['0'],
<ide> [1.2], ['1.2'],
<del> [''], [''],
<add> [''], [],
<ide> ['foo'], ['foo'],
<ide> [<div />], [<div />],
<ide>
<ide><path>packages/react-reconciler/src/ReactChildFiber.new.js
<ide> function ChildReconciler(shouldTrackSideEffects) {
<ide> newChild: any,
<ide> lanes: Lanes,
<ide> ): Fiber | null {
<del> if (typeof newChild === 'string' || typeof newChild === 'number') {
<add> if (
<add> (typeof newChild === 'string' && newChild !== '') ||
<add> typeof newChild === 'number'
<add> ) {
<ide> // Text nodes don't have keys. If the previous node is implicitly keyed
<ide> // we can continue to replace it without aborting even if it is not a text
<ide> // node.
<ide> function ChildReconciler(shouldTrackSideEffects) {
<ide>
<ide> const key = oldFiber !== null ? oldFiber.key : null;
<ide>
<del> if (typeof newChild === 'string' || typeof newChild === 'number') {
<add> if (
<add> (typeof newChild === 'string' && newChild !== '') ||
<add> typeof newChild === 'number'
<add> ) {
<ide> // Text nodes don't have keys. If the previous node is implicitly keyed
<ide> // we can continue to replace it without aborting even if it is not a text
<ide> // node.
<ide> function ChildReconciler(shouldTrackSideEffects) {
<ide> newChild: any,
<ide> lanes: Lanes,
<ide> ): Fiber | null {
<del> if (typeof newChild === 'string' || typeof newChild === 'number') {
<add> if (
<add> (typeof newChild === 'string' && newChild !== '') ||
<add> typeof newChild === 'number'
<add> ) {
<ide> // Text nodes don't have keys, so we neither have to check the old nor
<ide> // new node for the key. If both are text nodes, they match.
<ide> const matchedFiber = existingChildren.get(newIdx) || null;
<ide> function ChildReconciler(shouldTrackSideEffects) {
<ide> throwOnInvalidObjectType(returnFiber, newChild);
<ide> }
<ide>
<del> if (typeof newChild === 'string' || typeof newChild === 'number') {
<add> if (
<add> (typeof newChild === 'string' && newChild !== '') ||
<add> typeof newChild === 'number'
<add> ) {
<ide> return placeSingleChild(
<ide> reconcileSingleTextNode(
<ide> returnFiber,
<ide><path>packages/react-reconciler/src/ReactChildFiber.old.js
<ide> function ChildReconciler(shouldTrackSideEffects) {
<ide> newChild: any,
<ide> lanes: Lanes,
<ide> ): Fiber | null {
<del> if (typeof newChild === 'string' || typeof newChild === 'number') {
<add> if (
<add> (typeof newChild === 'string' && newChild !== '') ||
<add> typeof newChild === 'number'
<add> ) {
<ide> // Text nodes don't have keys. If the previous node is implicitly keyed
<ide> // we can continue to replace it without aborting even if it is not a text
<ide> // node.
<ide> function ChildReconciler(shouldTrackSideEffects) {
<ide>
<ide> const key = oldFiber !== null ? oldFiber.key : null;
<ide>
<del> if (typeof newChild === 'string' || typeof newChild === 'number') {
<add> if (
<add> (typeof newChild === 'string' && newChild !== '') ||
<add> typeof newChild === 'number'
<add> ) {
<ide> // Text nodes don't have keys. If the previous node is implicitly keyed
<ide> // we can continue to replace it without aborting even if it is not a text
<ide> // node.
<ide> function ChildReconciler(shouldTrackSideEffects) {
<ide> newChild: any,
<ide> lanes: Lanes,
<ide> ): Fiber | null {
<del> if (typeof newChild === 'string' || typeof newChild === 'number') {
<add> if (
<add> (typeof newChild === 'string' && newChild !== '') ||
<add> typeof newChild === 'number'
<add> ) {
<ide> // Text nodes don't have keys, so we neither have to check the old nor
<ide> // new node for the key. If both are text nodes, they match.
<ide> const matchedFiber = existingChildren.get(newIdx) || null;
<ide> function ChildReconciler(shouldTrackSideEffects) {
<ide> throwOnInvalidObjectType(returnFiber, newChild);
<ide> }
<ide>
<del> if (typeof newChild === 'string' || typeof newChild === 'number') {
<add> if (
<add> (typeof newChild === 'string' && newChild !== '') ||
<add> typeof newChild === 'number'
<add> ) {
<ide> return placeSingleChild(
<ide> reconcileSingleTextNode(
<ide> returnFiber,
<ide><path>packages/react-reconciler/src/__tests__/ReactIncrementalUpdates-test.js
<ide> describe('ReactIncrementalUpdates', () => {
<ide> root.render(<App />);
<ide> });
<ide> expect(Scheduler).toHaveYielded(['Committed: ']);
<del> expect(root).toMatchRenderedOutput('');
<add> expect(root).toMatchRenderedOutput(null);
<ide>
<ide> await act(async () => {
<ide> if (gate(flags => flags.enableSyncDefaultUpdates)) {
<ide> describe('ReactIncrementalUpdates', () => {
<ide> root.render(<App />);
<ide> });
<ide> expect(Scheduler).toHaveYielded([]);
<del> expect(root).toMatchRenderedOutput('');
<add> expect(root).toMatchRenderedOutput(null);
<ide>
<ide> await act(async () => {
<ide> if (gate(flags => flags.enableSyncDefaultUpdates)) { | 6 |
Javascript | Javascript | fix onkeypress documentation of textinput | 5df227f42c2291d49a6d0ebd93f92634199a55fd | <ide><path>Libraries/Components/TextInput/TextInput.js
<ide> const TextInput = React.createClass({
<ide> onSubmitEditing: PropTypes.func,
<ide> /**
<ide> * Callback that is called when a key is pressed.
<del> * Pressed key value is passed as an argument to the callback handler.
<add> * This will be called with `{ nativeEvent: { key: keyValue } }`
<add> * where `keyValue` is `'Enter'` or `'Backspace'` for respective keys and
<add> * the typed-in character otherwise including `' '` for space.
<ide> * Fires before `onChange` callbacks.
<ide> * @platform ios
<ide> */ | 1 |
Javascript | Javascript | normalize response status for http 204 in msie | d31ebc4c508a53facc62da00383a7e88082830c4 | <ide><path>lib/adapters/xhr.js
<ide> module.exports = function xhrAdapter(resolve, reject, config) {
<ide> responseHeaders,
<ide> config.transformResponse
<ide> ),
<del> status: request.status,
<del> statusText: request.statusText,
<add> // IE sends 1223 instead of 204 (https://github.com/mzabriskie/axios/issues/201)
<add> status: request.status === 1223 ? 204 : request.status,
<add> statusText: request.status === 1223 ? 'No Content' : request.statusText,
<ide> headers: responseHeaders,
<ide> config: config
<ide> };
<del> ((request.status >= 200 && request.status < 300) || (request.status === 1223) || (!('status' in request) && request.responseText) ?
<add>
<add> // Resolve or reject the Promise based on the status
<add> ((response.status >= 200 && response.status < 300) ||
<add> (!('status' in request) && response.responseText) ?
<ide> resolve :
<ide> reject)(response);
<ide>
<ide><path>test/specs/requests.spec.js
<ide> describe('requests', function () {
<ide> }, 0);
<ide> });
<ide>
<add> // https://github.com/mzabriskie/axios/issues/201
<add> it('should fix IE no content error', function (done) {
<add> var request, response;
<add>
<add> axios({
<add> url: '/foo'
<add> }).then(function (res) {
<add> response = res
<add> });
<add>
<add> setTimeout(function () {
<add> request = jasmine.Ajax.requests.mostRecent();
<add>
<add> request.respondWith({
<add> status: 1223,
<add> statusText: 'Unknown'
<add> });
<add>
<add> setTimeout(function () {
<add> expect(response.status).toEqual(204);
<add> expect(response.statusText).toEqual('No Content');
<add> done();
<add> }, 0);
<add> }, 0);
<add> });
<add>
<ide> it('should allow overriding Content-Type header case-insensitive', function (done) {
<ide> var request, response;
<ide> var contentType = 'application/vnd.myapp.type+json'; | 2 |
Ruby | Ruby | provide git_path and git_version | 324a34d8ea8f931dd336dd667bbcdd2531cd3c22 | <ide><path>Library/Homebrew/utils/git.rb
<ide> def self.git_available?
<ide> @git = quiet_system HOMEBREW_ENV_PATH/"scm/git", "--version"
<ide> end
<ide>
<add> def self.git_path
<add> return unless git_available?
<add> @git_path ||= Utils.popen_read(
<add> HOMEBREW_ENV_PATH/"scm/git", "--homebrew=print-path"
<add> ).chuzzle
<add> end
<add>
<add> def self.git_version
<add> return unless git_available?
<add> @git_version ||= Utils.popen_read(
<add> HOMEBREW_ENV_PATH/"scm/git", "--version"
<add> ).chomp[/git version (\d+(?:\.\d+)*)/, 1]
<add> end
<add>
<ide> def self.ensure_git_installed!
<ide> return if git_available?
<ide>
<ide> def self.ensure_git_installed!
<ide>
<ide> def self.clear_git_available_cache
<ide> remove_instance_variable(:@git) if instance_variable_defined?(:@git)
<add> @git_path = nil
<add> @git_version = nil
<ide> end
<ide> end | 1 |
Text | Text | add forms doc chinese translation | 60ffe1e22e97c94a15d5e8f5f531d56f16709c8f | <ide><path>docs/docs/07-forms.zh-CN.md
<add>---
<add>id: forms-zh-CN
<add>title: 表单组件
<add>permalink: forms-zh-CN.html
<add>prev: transferring-props-zh-CN.html
<add>next: working-with-the-browser-zh-CN.html
<add>---
<add>
<add>诸如 `<input>`、`<textarea>`、`<option>` 这样的表单组件不同于其他组件,因为他们可以通过用户交互发生变化。这些组件提供的界面使响应用户交互的表单数据处理更加容易。
<add>
<add>关于 `<form>` 事件详情请查看 [表单事件](/react/docs/events.html#form-events)。
<add>
<add>## 交互属性
<add>
<add>表单组件支持几个受用户交互影响的属性:
<add>
<add>* `value`,用于 `<input>`、`<textarea>` 组件。
<add>* `checked`,用于类型为 `checkbox` 或者 `radio` 的 `<input>` 组件。
<add>* `selected`,用于 `<option>` 组件。
<add>
<add>在 HTML 中,`<textarea>` 的值通过子节点设置;在 React 中则应该使用 `value` 代替。
<add>
<add>表单组件可以通过 `onChange` 回调函数来监听组件变化。当用户做出以下交互时,`onChange` 执行并通过浏览器做出响应:
<add>
<add>* `<input>` 或 `<textarea>` 的 `value` 发生变化时。
<add>* `<input>` 的 `checked` 状态改变时。
<add>* `<option>` 的 `selected` 状态改变时。
<add>
<add>和所有 DOM 事件一样,所有的 HTML 原生组件都支持 `onChange` 属性,而且可以用来监听冒泡的 `change` 事件。
<add>
<add>
<add>## 受限组件
<add>
<add>设置了 `value` 的 `<input>` 是一个*受限*组件。 对于受限的 `<input>`,渲染出来的 HTML 元素始终保持 `value` 属性的值。例如:
<add>
<add>```javascript
<add> render: function() {
<add> return <input type="text" value="Hello!" />;
<add> }
<add>```
<add>
<add>上面的代码将渲染出一个值为 `Hello!` 的 input 元素。用户在渲染出来的元素里输入任何值都不起作用,因为 React 已经赋值为 `Hello!`。如果想响应更新用户输入的值,就得使用 `onChange` 事件:
<add>
<add>```javascript
<add> getInitialState: function() {
<add> return {value: 'Hello!'};
<add> },
<add> handleChange: function(event) {
<add> this.setState({value: event.target.value});
<add> },
<add> render: function() {
<add> var value = this.state.value;
<add> return <input type="text" value={value} onChange={this.handleChange} />;
<add> }
<add>```
<add>
<add>上面的代码中,React 将用户输入的值更新到 `<input>` 组件的 `value` 属性。这样实现响应或者验证用户输入的界面就很容易了。例如:
<add>
<add>```javascript
<add> handleChange: function(event) {
<add> this.setState({value: event.target.value.substr(0, 140)});
<add> }
<add>```
<add>
<add>上面的代码接受用户输入,并截取前 140 个字符。
<add>
<add>
<add>## 不受限组件
<add>
<add>没有设置 `value`(或者设为 `null`) 的 `<input>` 组件是一个*不受限*组件。对于不受限的 `<input>` 组件,渲染出来的元素直接反应用户输入。例如:
<add>
<add>```javascript
<add> render: function() {
<add> return <input type="text" />;
<add> }
<add>```
<add>
<add>上面的代码将渲染出一个空值的输入框,用户输入将立即反应到元素上。和受限元素一样,使用 `onChange` 事件可以监听值的变化。
<add>
<add>如果想给组件设置一个非空的初始值,可以使用 `defaultValue` 属性。例如:
<add>
<add>```javascript
<add> render: function() {
<add> return <input type="text" defaultValue="Hello!" />;
<add> }
<add>```
<add>
<add>上面的代码渲染出来的元素和**受限组件**一样有一个初始值,但这个值用户可以改变并会反应到界面上。
<add>
<add>同样地, 类型为 `radio`、`checkbox` 的`<input>` 支持 `defaultChecked` 属性, `<select>` 支持 `defaultValue` 属性。
<add>
<add>```javascript
<add> render: function() {
<add> return (
<add> <div>
<add> <input type="radio" name="opt" defaultChecked /> Option 1
<add> <input type="radio" name="opt" /> Option 2
<add> <select defaultValue="C">
<add> <option value="A">Apple</option>
<add> <option value="B">Banana</option>
<add> <option value="C">Cranberry</option>
<add> </select>
<add> </div>
<add> );
<add> }
<add>```
<add>
<add>
<add>## 高级主题
<add>
<add>### 为什么使用受限组件?
<add>
<add>在 React 中使用诸如 `<input>` 的表单组件时,遇到了一个在传统 HTML 中没有的挑战。
<add>
<add>比如下面的代码:
<add>
<add>```html
<add> <input type="text" name="title" value="Untitled" />
<add>```
<add>
<add>在 HTML 中将渲染初始值为 `Untitled` 的输入框。用户改变输入框的值时,节点的 `value` 属性(*property*)将随之变化,但是 `node.getAttribute('value')` 还是会返回初始设置的值 `Untitled`.
<add>
<add>与 HTML 不同,React 组件必须在任何时间点描绘视图的状态,而不仅仅是在初始化时。比如在 React 中:
<add>
<add>```javascript
<add> render: function() {
<add> return <input type="text" name="title" value="Untitled" />;
<add> }
<add>```
<add>
<add>该方法在任何时间点渲染组件以后,输入框的值就应该*始终*为 `Untitled`。
<add>
<add>
<add>### 为什么 `<textarea>` 使用 `value` 属性?
<add>
<add>在 HTML 中, `<textarea>` 的值通常使用子节点设置:
<add>
<add>```html
<add> <!-- 反例:在 React 中不要这样使用! -->
<add> <textarea name="description">This is the description.</textarea>
<add>```
<add>
<add>对 HTML 而言,让开发者设置多行的值很容易。但是,React 是 JavaScript,没有字符限制,可以使用 `\n` 实现换行。简言之,React 已经有 `value`、`defaultValue` 属性,`</textarea>` 组件的子节点扮演什么角色就有点模棱两可了。基于此, 设置 `<textarea>` 值时不应该使用子节点:
<add>
<add>```javascript
<add> <textarea name="description" value="This is a description." />
<add>```
<add>
<add>如果*非要**使用子节点,效果和使用 `defaultValue` 一样。
<add>
<add>
<add>### 为什么 `<select>` 使用 `value` 属性
<add>
<add>HTML 中 `<select>` 通常使用 `<option>` 的 `selected` 属性设置选中状态;React 为了更方面的控制组件,采用以下方式代替:
<add>
<add>```javascript
<add> <select value="B">
<add> <option value="A">Apple</option>
<add> <option value="B">Banana</option>
<add> <option value="C">Cranberry</option>
<add> </select>
<add>```
<add>
<add>如果是不受限组件,则使用 `defaultValue`。
<add>
<add>> 注意:
<add>>
<add>> 给 `value` 属性传递一个数组,可以选中多个选项:`<select multiple={true} value={['B', 'C']}>`。 | 1 |
Javascript | Javascript | replace fixturesdir in test-tls-connect | a70ef362ef8de8505ac9f140a4e803af9d706b77 | <ide><path>test/parallel/test-tls-connect.js
<ide> const common = require('../common');
<ide> if (!common.hasCrypto)
<ide> common.skip('missing crypto');
<ide>
<add>const fixtures = require('../common/fixtures');
<add>
<ide> const assert = require('assert');
<del>const fs = require('fs');
<del>const path = require('path');
<ide> const tls = require('tls');
<ide>
<ide> // https://github.com/joyent/node/issues/1218
<ide> // uncatchable exception on TLS connection error
<ide> {
<del> const cert = fs.readFileSync(path.join(common.fixturesDir, 'test_cert.pem'));
<del> const key = fs.readFileSync(path.join(common.fixturesDir, 'test_key.pem'));
<add> const cert = fixtures.readSync('test_cert.pem');
<add> const key = fixtures.readSync('test_key.pem');
<ide>
<ide> const options = { cert: cert, key: key, port: common.PORT };
<ide> const conn = tls.connect(options, common.mustNotCall());
<ide> const tls = require('tls');
<ide>
<ide> // SSL_accept/SSL_connect error handling
<ide> {
<del> const cert = fs.readFileSync(path.join(common.fixturesDir, 'test_cert.pem'));
<del> const key = fs.readFileSync(path.join(common.fixturesDir, 'test_key.pem'));
<add> const cert = fixtures.readSync('test_cert.pem');
<add> const key = fixtures.readSync('test_key.pem');
<ide>
<ide> const conn = tls.connect({
<ide> cert: cert, | 1 |
PHP | PHP | fix return type | a075753ad0385d755140b8c748e17cc3f95a8914 | <ide><path>src/Illuminate/Routing/Route.php
<ide> public function excludedMiddleware()
<ide> /**
<ide> * Indicate that the route should enforce scoping of multiple implicit Eloquent bindings.
<ide> *
<del> * @return bool
<add> * @return $this
<ide> */
<ide> public function scopeBindings()
<ide> { | 1 |
PHP | PHP | integrate corsbuilder into response | 719e9da7cae0460a863bc4817825809a17ec5d11 | <ide><path>src/Network/CorsBuilder.php
<ide> public function allowOrigin($domain)
<ide> if (!preg_match($domain['preg'], $this->_origin)) {
<ide> continue;
<ide> }
<del> $this->_response->header('Access-Control-Allow-Origin', $this->_origin);
<add> $value = $domain['original'] === '*' ? '*' : $this->_origin;
<add> $this->_response->header('Access-Control-Allow-Origin', $value);
<ide> break;
<ide> }
<ide> return $this;
<ide><path>src/Network/Response.php
<ide> public function cookie($options = null)
<ide> * @param string|array $allowedDomains List of allowed domains, see method description for more details
<ide> * @param string|array $allowedMethods List of HTTP verbs allowed
<ide> * @param string|array $allowedHeaders List of HTTP headers allowed
<del> * @return void
<add> * @return \Cake\Network\CorsBuilder A builder object the provides a fluent interface for defining
<add> * additional CORS headers.
<ide> */
<ide> public function cors(Request $request, $allowedDomains, $allowedMethods = [], $allowedHeaders = [])
<ide> {
<ide> $origin = $request->header('Origin');
<add> $ssl = $request->is('ssl');
<add> $builder = new CorsBuilder($this, $origin, $ssl);
<ide> if (!$origin) {
<del> return;
<add> return $builder;
<ide> }
<del>
<del> $allowedDomains = $this->_normalizeCorsDomains((array)$allowedDomains, $request->is('ssl'));
<del> foreach ($allowedDomains as $domain) {
<del> if (!preg_match($domain['preg'], $origin)) {
<del> continue;
<del> }
<del> $this->header('Access-Control-Allow-Origin', $domain['original'] === '*' ? '*' : $origin);
<del> $allowedMethods && $this->header('Access-Control-Allow-Methods', implode(', ', (array)$allowedMethods));
<del> $allowedHeaders && $this->header('Access-Control-Allow-Headers', implode(', ', (array)$allowedHeaders));
<del> break;
<add> $builder->allowOrigin($allowedDomains);
<add> if ($allowedMethods) {
<add> $builder->allowMethods((array)$allowedMethods);
<ide> }
<del> }
<del>
<del> /**
<del> * Normalize the origin to regular expressions and put in an array format
<del> *
<del> * @param array $domains Domain names to normalize.
<del> * @param bool $requestIsSSL Whether it's a SSL request.
<del> * @return array
<del> */
<del> protected function _normalizeCorsDomains($domains, $requestIsSSL = false)
<del> {
<del> $result = [];
<del> foreach ($domains as $domain) {
<del> if ($domain === '*') {
<del> $result[] = ['preg' => '@.@', 'original' => '*'];
<del> continue;
<del> }
<del>
<del> $original = $preg = $domain;
<del> if (strpos($domain, '://') === false) {
<del> $preg = ($requestIsSSL ? 'https://' : 'http://') . $domain;
<del> }
<del> $preg = '@' . str_replace('*', '.*', $domain) . '@';
<del> $result[] = compact('original', 'preg');
<add> if ($allowedHeaders) {
<add> $builder->allowHeaders((array)$allowedHeaders);
<ide> }
<del> return $result;
<add> return $builder;
<ide> }
<ide>
<ide> /**
<ide><path>tests/TestCase/Network/CorsBuilderTest.php
<ide> public function testAllowOriginNoOrigin()
<ide> */
<ide> public function testAllowOrigin()
<ide> {
<add> $response = new Response();
<add> $builder = new CorsBuilder($response, 'http://www.example.com');
<add> $this->assertSame($builder, $builder->allowOrigin('*'));
<add> $this->assertHeader('*', $response, 'Access-Control-Allow-Origin');
<add>
<ide> $response = new Response();
<ide> $builder = new CorsBuilder($response, 'http://www.example.com');
<ide> $this->assertSame($builder, $builder->allowOrigin(['*.example.com', '*.foo.com'])); | 3 |
PHP | PHP | trim bloat from form class | 77c23c4665aa3723540e967476aac6d5b8f93d3e | <ide><path>system/form.php
<ide> public static function open($action = null, $method = 'POST', $attributes = arra
<ide> {
<ide> $attributes['action'] = HTML::entities(URL::to((is_null($action)) ? Request::uri() : $action));
<ide>
<del> // -------------------------------------------------------
<del> // If the request method is PUT or DELETE, we'll default
<del> // the request method to POST since the reqeust method
<del> // is being spoofed by the form.
<del> // -------------------------------------------------------
<add> // If the request method is PUT or DELETE, we'll default the request method to POST
<add> // since the request method is being spoofed by the form.
<ide> $attributes['method'] = ($method == 'PUT' or $method == 'DELETE') ? 'POST' : $method;
<ide>
<ide> if ( ! array_key_exists('accept-charset', $attributes))
<ide> public static function open($action = null, $method = 'POST', $attributes = arra
<ide>
<ide> $html = '<form'.HTML::attributes($attributes).'>';
<ide>
<del> // -------------------------------------------------------
<del> // If the method is PUT or DELETE, we'll need to spoof it
<del> // using a hidden input field.
<del> //
<del> // For more information, see the Input library.
<del> // -------------------------------------------------------
<add> // If the request method is PUT or DELETE, create a hidden input element with the
<add> // request method in it since HTML forms do not support these two methods.
<ide> if ($method == 'PUT' or $method == 'DELETE')
<ide> {
<ide> $html .= PHP_EOL.static::input('hidden', 'REQUEST_METHOD', $method);
<ide> public static function token()
<ide> */
<ide> public static function raw_token()
<ide> {
<del> // -------------------------------------------------------
<del> // CSRF tokens are stored in the session, so we need to
<del> // make sure a driver has been specified.
<del> // -------------------------------------------------------
<ide> if (Config::get('session.driver') == '')
<ide> {
<ide> throw new \Exception('Sessions must be enabled to retrieve a CSRF token.');
<ide> public static function password($name, $attributes = array())
<ide> return static::input('password', $name, null, $attributes);
<ide> }
<ide>
<del> /**
<del> * Create a HTML email input element.
<del> *
<del> * @param string $name
<del> * @param string $value
<del> * @param array $attributes
<del> * @return string
<del> */
<del> public static function email($name, $value = null, $attributes = array())
<del> {
<del> return static::input('email', $name, $value, $attributes);
<del> }
<del>
<del> /**
<del> * Create a HTML telephone input element.
<del> *
<del> * @param string $name
<del> * @param string $value
<del> * @param array $attributes
<del> * @return string
<del> */
<del> public static function telephone($name, $value = null, $attributes = array())
<del> {
<del> return static::input('tel', $name, $value, $attributes);
<del> }
<del>
<ide> /**
<ide> * Create a HTML search input element.
<ide> *
<ide> public static function search($name, $value = null, $attributes = array())
<ide> }
<ide>
<ide> /**
<del> * Create a HTML URL input element.
<add> * Create a HTML email input element.
<ide> *
<ide> * @param string $name
<ide> * @param string $value
<ide> * @param array $attributes
<ide> * @return string
<ide> */
<del> public static function url($name, $value = null, $attributes = array())
<add> public static function email($name, $value = null, $attributes = array())
<ide> {
<del> return static::input('url', $name, $value, $attributes);
<add> return static::input('email', $name, $value, $attributes);
<ide> }
<ide>
<ide> /**
<del> * Create a HTML color input element.
<add> * Create a HTML telephone input element.
<ide> *
<ide> * @param string $name
<ide> * @param string $value
<ide> * @param array $attributes
<ide> * @return string
<ide> */
<del> public static function color($name, $value = null, $attributes = array())
<add> public static function telephone($name, $value = null, $attributes = array())
<ide> {
<del> return static::input('color', $name, $value, $attributes);
<add> return static::input('tel', $name, $value, $attributes);
<ide> }
<ide>
<ide> /**
<del> * Create a HTML date input element.
<add> * Create a HTML URL input element.
<ide> *
<ide> * @param string $name
<ide> * @param string $value
<ide> * @param array $attributes
<ide> * @return string
<ide> */
<del> public static function date($name, $value = null, $attributes = array())
<add> public static function url($name, $value = null, $attributes = array())
<ide> {
<del> return static::input('date', $name, $value, $attributes);
<add> return static::input('url', $name, $value, $attributes);
<ide> }
<ide>
<ide> /**
<ide> public static function number($name, $value = null, $attributes = array())
<ide> return static::input('number', $name, $value, $attributes);
<ide> }
<ide>
<del> /**
<del> * Create a HTML range input element.
<del> *
<del> * @param string $name
<del> * @param string $value
<del> * @param array $attributes
<del> * @return string
<del> */
<del> public static function range($name, $value = null, $attributes = array())
<del> {
<del> return static::input('range', $name, $value, $attributes);
<del> }
<del>
<ide> /**
<ide> * Create a HTML file input element.
<ide> *
<ide> public static function button($value, $attributes = array())
<ide> /**
<ide> * Determine the ID attribute for a form element.
<ide> *
<add> * An explicitly specified ID in the attributes takes first precedence, then
<add> * the label names will be checked for a label matching the element name.
<add> *
<ide> * @param string $name
<ide> * @param array $attributes
<ide> * @return mixed
<ide> */
<ide> private static function id($name, $attributes)
<ide> {
<del> // -------------------------------------------------------
<del> // If an ID attribute was already explicitly specified
<del> // for the element in its attributes, use that ID.
<del> // -------------------------------------------------------
<ide> if (array_key_exists('id', $attributes))
<ide> {
<ide> return $attributes['id'];
<ide> }
<ide>
<del> // -------------------------------------------------------
<del> // If a label element was created with a value matching
<del> // the name of the form element, use the name as the ID.
<del> // -------------------------------------------------------
<ide> if (in_array($name, static::$labels))
<ide> {
<ide> return $name; | 1 |
Text | Text | update korean readme to master | 16d7b70b80ad20daf27b45f57b5d9b94f1688c8a | <ide><path>README_ko.md
<ide> Flax, PyTorch, TensorFlow 설치 페이지에서 이들을 conda로 설치하는
<ide> 1. **[ALBERT](https://huggingface.co/transformers/model_doc/albert.html)** (from Google Research and the Toyota Technological Institute at Chicago) released with the paper [ALBERT: A Lite BERT for Self-supervised Learning of Language Representations](https://arxiv.org/abs/1909.11942), by Zhenzhong Lan, Mingda Chen, Sebastian Goodman, Kevin Gimpel, Piyush Sharma, Radu Soricut.
<ide> 1. **[BART](https://huggingface.co/transformers/model_doc/bart.html)** (from Facebook) released with the paper [BART: Denoising Sequence-to-Sequence Pre-training for Natural Language Generation, Translation, and Comprehension](https://arxiv.org/pdf/1910.13461.pdf) by Mike Lewis, Yinhan Liu, Naman Goyal, Marjan Ghazvininejad, Abdelrahman Mohamed, Omer Levy, Ves Stoyanov and Luke Zettlemoyer.
<ide> 1. **[BARThez](https://huggingface.co/transformers/model_doc/barthez.html)** (from École polytechnique) released with the paper [BARThez: a Skilled Pretrained French Sequence-to-Sequence Model](https://arxiv.org/abs/2010.12321) by Moussa Kamal Eddine, Antoine J.-P. Tixier, Michalis Vazirgiannis.
<add>1. **[BARTpho](https://huggingface.co/transformers/master/model_doc/bartpho.html)** (from VinAI Research) released with the paper [BARTpho: Pre-trained Sequence-to-Sequence Models for Vietnamese](https://arxiv.org/abs/2109.09701) by Nguyen Luong Tran, Duong Minh Le and Dat Quoc Nguyen.
<ide> 1. **[BEiT](https://huggingface.co/transformers/model_doc/beit.html)** (from Microsoft) released with the paper [BEiT: BERT Pre-Training of Image Transformers](https://arxiv.org/abs/2106.08254) by Hangbo Bao, Li Dong, Furu Wei.
<ide> 1. **[BERT](https://huggingface.co/transformers/model_doc/bert.html)** (from Google) released with the paper [BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding](https://arxiv.org/abs/1810.04805) by Jacob Devlin, Ming-Wei Chang, Kenton Lee and Kristina Toutanova.
<ide> 1. **[BERT For Sequence Generation](https://huggingface.co/transformers/model_doc/bertgeneration.html)** (from Google) released with the paper [Leveraging Pre-trained Checkpoints for Sequence Generation Tasks](https://arxiv.org/abs/1907.12461) by Sascha Rothe, Shashi Narayan, Aliaksei Severyn.
<del>1. **[BigBird-RoBERTa](https://huggingface.co/transformers/model_doc/bigbird.html)** (from Google Research) released with the paper [Big Bird: Transformers for Longer Sequences](https://arxiv.org/abs/2007.14062) by Manzil Zaheer, Guru Guruganesh, Avinava Dubey, Joshua Ainslie, Chris Alberti, Santiago Ontanon, Philip Pham, Anirudh Ravula, Qifan Wang, Li Yang, Amr Ahmed.
<add>1. **[BERTweet](https://huggingface.co/transformers/master/model_doc/bertweet.html)** (from VinAI Research) released with the paper [BERTweet: A pre-trained language model for English Tweets](https://aclanthology.org/2020.emnlp-demos.2/) by Dat Quoc Nguyen, Thanh Vu and Anh Tuan Nguyen.
<ide> 1. **[BigBird-Pegasus](https://huggingface.co/transformers/model_doc/bigbird_pegasus.html)** (from Google Research) released with the paper [Big Bird: Transformers for Longer Sequences](https://arxiv.org/abs/2007.14062) by Manzil Zaheer, Guru Guruganesh, Avinava Dubey, Joshua Ainslie, Chris Alberti, Santiago Ontanon, Philip Pham, Anirudh Ravula, Qifan Wang, Li Yang, Amr Ahmed.
<add>1. **[BigBird-RoBERTa](https://huggingface.co/transformers/model_doc/bigbird.html)** (from Google Research) released with the paper [Big Bird: Transformers for Longer Sequences](https://arxiv.org/abs/2007.14062) by Manzil Zaheer, Guru Guruganesh, Avinava Dubey, Joshua Ainslie, Chris Alberti, Santiago Ontanon, Philip Pham, Anirudh Ravula, Qifan Wang, Li Yang, Amr Ahmed.
<ide> 1. **[Blenderbot](https://huggingface.co/transformers/model_doc/blenderbot.html)** (from Facebook) released with the paper [Recipes for building an open-domain chatbot](https://arxiv.org/abs/2004.13637) by Stephen Roller, Emily Dinan, Naman Goyal, Da Ju, Mary Williamson, Yinhan Liu, Jing Xu, Myle Ott, Kurt Shuster, Eric M. Smith, Y-Lan Boureau, Jason Weston.
<ide> 1. **[BlenderbotSmall](https://huggingface.co/transformers/model_doc/blenderbot_small.html)** (from Facebook) released with the paper [Recipes for building an open-domain chatbot](https://arxiv.org/abs/2004.13637) by Stephen Roller, Emily Dinan, Naman Goyal, Da Ju, Mary Williamson, Yinhan Liu, Jing Xu, Myle Ott, Kurt Shuster, Eric M. Smith, Y-Lan Boureau, Jason Weston.
<ide> 1. **[BORT](https://huggingface.co/transformers/model_doc/bort.html)** (from Alexa) released with the paper [Optimal Subarchitecture Extraction For BERT](https://arxiv.org/abs/2010.10499) by Adrian de Wynter and Daniel J. Perry.
<ide> Flax, PyTorch, TensorFlow 설치 페이지에서 이들을 conda로 설치하는
<ide> 1. **[DETR](https://huggingface.co/transformers/model_doc/detr.html)** (from Facebook) released with the paper [End-to-End Object Detection with Transformers](https://arxiv.org/abs/2005.12872) by Nicolas Carion, Francisco Massa, Gabriel Synnaeve, Nicolas Usunier, Alexander Kirillov, Sergey Zagoruyko.
<ide> 1. **[DialoGPT](https://huggingface.co/transformers/model_doc/dialogpt.html)** (from Microsoft Research) released with the paper [DialoGPT: Large-Scale Generative Pre-training for Conversational Response Generation](https://arxiv.org/abs/1911.00536) by Yizhe Zhang, Siqi Sun, Michel Galley, Yen-Chun Chen, Chris Brockett, Xiang Gao, Jianfeng Gao, Jingjing Liu, Bill Dolan.
<ide> 1. **[DistilBERT](https://huggingface.co/transformers/model_doc/distilbert.html)** (from HuggingFace), released together with the paper [DistilBERT, a distilled version of BERT: smaller, faster, cheaper and lighter](https://arxiv.org/abs/1910.01108) by Victor Sanh, Lysandre Debut and Thomas Wolf. The same method has been applied to compress GPT2 into [DistilGPT2](https://github.com/huggingface/transformers/tree/master/examples/distillation), RoBERTa into [DistilRoBERTa](https://github.com/huggingface/transformers/tree/master/examples/distillation), Multilingual BERT into [DistilmBERT](https://github.com/huggingface/transformers/tree/master/examples/distillation) and a German version of DistilBERT.
<del>1. **[DPR](https://huggingface.co/transformers/model_doc/dpr.html)** (from Facebook) released with the paper [Dense Passage Retrieval
<del>for Open-Domain Question Answering](https://arxiv.org/abs/2004.04906) by Vladimir Karpukhin, Barlas Oğuz, Sewon
<del>Min, Patrick Lewis, Ledell Wu, Sergey Edunov, Danqi Chen, and Wen-tau Yih.
<del>1. **[EncoderDecoder](https://huggingface.co/transformers/model_doc/encoderdecoder.html)** (from Google Research) released with the paper [Leveraging Pre-trained Checkpoints for Sequence Generation Tasks](https://arxiv.org/abs/1907.12461) by Sascha Rothe, Shashi Narayan, Aliaksei Severyn.
<add>1. **[DPR](https://huggingface.co/transformers/model_doc/dpr.html)** (from Facebook) released with the paper [Dense Passage Retrieval for Open-Domain Question Answering](https://arxiv.org/abs/2004.04906) by Vladimir Karpukhin, Barlas Oğuz, Sewon Min, Patrick Lewis, Ledell Wu, Sergey Edunov, Danqi Chen, and Wen-tau Yih.
<ide> 1. **[ELECTRA](https://huggingface.co/transformers/model_doc/electra.html)** (from Google Research/Stanford University) released with the paper [ELECTRA: Pre-training text encoders as discriminators rather than generators](https://arxiv.org/abs/2003.10555) by Kevin Clark, Minh-Thang Luong, Quoc V. Le, Christopher D. Manning.
<add>1. **[EncoderDecoder](https://huggingface.co/transformers/model_doc/encoderdecoder.html)** (from Google Research) released with the paper [Leveraging Pre-trained Checkpoints for Sequence Generation Tasks](https://arxiv.org/abs/1907.12461) by Sascha Rothe, Shashi Narayan, Aliaksei Severyn.
<ide> 1. **[FlauBERT](https://huggingface.co/transformers/model_doc/flaubert.html)** (from CNRS) released with the paper [FlauBERT: Unsupervised Language Model Pre-training for French](https://arxiv.org/abs/1912.05372) by Hang Le, Loïc Vial, Jibril Frej, Vincent Segonne, Maximin Coavoux, Benjamin Lecouteux, Alexandre Allauzen, Benoît Crabbé, Laurent Besacier, Didier Schwab.
<ide> 1. **[FNet](https://huggingface.co/transformers/model_doc/fnet.html)** (from Google Research) released with the paper [FNet: Mixing Tokens with Fourier Transforms](https://arxiv.org/abs/2105.03824) by James Lee-Thorp, Joshua Ainslie, Ilya Eckstein, Santiago Ontanon.
<ide> 1. **[Funnel Transformer](https://huggingface.co/transformers/model_doc/funnel.html)** (from CMU/Google Brain) released with the paper [Funnel-Transformer: Filtering out Sequential Redundancy for Efficient Language Processing](https://arxiv.org/abs/2006.03236) by Zihang Dai, Guokun Lai, Yiming Yang, Quoc V. Le.
<ide> 1. **[GPT](https://huggingface.co/transformers/model_doc/gpt.html)** (from OpenAI) released with the paper [Improving Language Understanding by Generative Pre-Training](https://blog.openai.com/language-unsupervised/) by Alec Radford, Karthik Narasimhan, Tim Salimans and Ilya Sutskever.
<add>1. **[GPT Neo](https://huggingface.co/transformers/model_doc/gpt_neo.html)** (from EleutherAI) released in the repository [EleutherAI/gpt-neo](https://github.com/EleutherAI/gpt-neo) by Sid Black, Stella Biderman, Leo Gao, Phil Wang and Connor Leahy.
<ide> 1. **[GPT-2](https://huggingface.co/transformers/model_doc/gpt2.html)** (from OpenAI) released with the paper [Language Models are Unsupervised Multitask Learners](https://blog.openai.com/better-language-models/) by Alec Radford*, Jeffrey Wu*, Rewon Child, David Luan, Dario Amodei** and Ilya Sutskever**.
<ide> 1. **[GPT-J](https://huggingface.co/transformers/model_doc/gptj.html)** (from EleutherAI) released in the repository [kingoflolz/mesh-transformer-jax](https://github.com/kingoflolz/mesh-transformer-jax/) by Ben Wang and Aran Komatsuzaki.
<del>1. **[GPT Neo](https://huggingface.co/transformers/model_doc/gpt_neo.html)** (from EleutherAI) released in the repository [EleutherAI/gpt-neo](https://github.com/EleutherAI/gpt-neo) by Sid Black, Stella Biderman, Leo Gao, Phil Wang and Connor Leahy.
<ide> 1. **[Hubert](https://huggingface.co/transformers/model_doc/hubert.html)** (from Facebook) released with the paper [HuBERT: Self-Supervised Speech Representation Learning by Masked Prediction of Hidden Units](https://arxiv.org/abs/2106.07447) by Wei-Ning Hsu, Benjamin Bolte, Yao-Hung Hubert Tsai, Kushal Lakhotia, Ruslan Salakhutdinov, Abdelrahman Mohamed.
<ide> 1. **[I-BERT](https://huggingface.co/transformers/model_doc/ibert.html)** (from Berkeley) released with the paper [I-BERT: Integer-only BERT Quantization](https://arxiv.org/abs/2101.01321) by Sehoon Kim, Amir Gholami, Zhewei Yao, Michael W. Mahoney, Kurt Keutzer.
<ide> 1. **[LayoutLM](https://huggingface.co/transformers/model_doc/layoutlm.html)** (from Microsoft Research Asia) released with the paper [LayoutLM: Pre-training of Text and Layout for Document Image Understanding](https://arxiv.org/abs/1912.13318) by Yiheng Xu, Minghao Li, Lei Cui, Shaohan Huang, Furu Wei, Ming Zhou.
<ide> Min, Patrick Lewis, Ledell Wu, Sergey Edunov, Danqi Chen, and Wen-tau Yih.
<ide> 1. **[MPNet](https://huggingface.co/transformers/model_doc/mpnet.html)** (from Microsoft Research) released with the paper [MPNet: Masked and Permuted Pre-training for Language Understanding](https://arxiv.org/abs/2004.09297) by Kaitao Song, Xu Tan, Tao Qin, Jianfeng Lu, Tie-Yan Liu.
<ide> 1. **[MT5](https://huggingface.co/transformers/model_doc/mt5.html)** (from Google AI) released with the paper [mT5: A massively multilingual pre-trained text-to-text transformer](https://arxiv.org/abs/2010.11934) by Linting Xue, Noah Constant, Adam Roberts, Mihir Kale, Rami Al-Rfou, Aditya Siddhant, Aditya Barua, Colin Raffel.
<ide> 1. **[Pegasus](https://huggingface.co/transformers/model_doc/pegasus.html)** (from Google) released with the paper [PEGASUS: Pre-training with Extracted Gap-sentences for Abstractive Summarization](https://arxiv.org/abs/1912.08777) by Jingqing Zhang, Yao Zhao, Mohammad Saleh and Peter J. Liu.
<add>1. **[PhoBERT](https://huggingface.co/transformers/master/model_doc/phobert.html)** (from VinAI Research) released with the paper [PhoBERT: Pre-trained language models for Vietnamese](https://www.aclweb.org/anthology/2020.findings-emnlp.92/) by Dat Quoc Nguyen and Anh Tuan Nguyen.
<ide> 1. **[ProphetNet](https://huggingface.co/transformers/model_doc/prophetnet.html)** (from Microsoft Research) released with the paper [ProphetNet: Predicting Future N-gram for Sequence-to-Sequence Pre-training](https://arxiv.org/abs/2001.04063) by Yu Yan, Weizhen Qi, Yeyun Gong, Dayiheng Liu, Nan Duan, Jiusheng Chen, Ruofei Zhang and Ming Zhou.
<ide> 1. **[Reformer](https://huggingface.co/transformers/model_doc/reformer.html)** (from Google Research) released with the paper [Reformer: The Efficient Transformer](https://arxiv.org/abs/2001.04451) by Nikita Kitaev, Łukasz Kaiser, Anselm Levskaya.
<ide> 1. **[RemBERT](https://huggingface.co/transformers/model_doc/rembert.html)** (from Google Research) released with the paper [Rethinking embedding coupling in pre-trained language models](https://arxiv.org/pdf/2010.12821.pdf) by Hyung Won Chung, Thibault Févry, Henry Tsai, M. Johnson, Sebastian Ruder.
<ide> 1. **[RoBERTa](https://huggingface.co/transformers/model_doc/roberta.html)** (from Facebook), released together with the paper a [Robustly Optimized BERT Pretraining Approach](https://arxiv.org/abs/1907.11692) by Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, Veselin Stoyanov.
<ide> 1. **[RoFormer](https://huggingface.co/transformers/model_doc/roformer.html)** (from ZhuiyiTechnology), released together with the paper a [RoFormer: Enhanced Transformer with Rotary Position Embedding](https://arxiv.org/pdf/2104.09864v1.pdf) by Jianlin Su and Yu Lu and Shengfeng Pan and Bo Wen and Yunfeng Liu.
<add>1. **[SEW](https://huggingface.co/transformers/model_doc/sew.html)** (from ASAPP) released with the paper [Performance-Efficiency Trade-offs in Unsupervised Pre-training for Speech Recognition](https://arxiv.org/abs/2109.06870) by Felix Wu, Kwangyoun Kim, Jing Pan, Kyu Han, Kilian Q. Weinberger, Yoav Artzi.
<add>1. **[SEW-D](https://huggingface.co/transformers/model_doc/sew_d.html)** (from ASAPP) released with the paper [Performance-Efficiency Trade-offs in Unsupervised Pre-training for Speech Recognition](https://arxiv.org/abs/2109.06870) by Felix Wu, Kwangyoun Kim, Jing Pan, Kyu Han, Kilian Q. Weinberger, Yoav Artzi.
<ide> 1. **[SpeechToTextTransformer](https://huggingface.co/transformers/model_doc/speech_to_text.html)** (from Facebook), released together with the paper [fairseq S2T: Fast Speech-to-Text Modeling with fairseq](https://arxiv.org/abs/2010.05171) by Changhan Wang, Yun Tang, Xutai Ma, Anne Wu, Dmytro Okhonko, Juan Pino.
<ide> 1. **[SpeechToTextTransformer2](https://huggingface.co/transformers/model_doc/speech_to_text_2.html)** (from Facebook), released together with the paper [Large-Scale Self- and Semi-Supervised Learning for Speech Translation](https://arxiv.org/abs/2104.06678) by Changhan Wang, Anne Wu, Juan Pino, Alexei Baevski, Michael Auli, Alexis Conneau.
<ide> 1. **[Splinter](https://huggingface.co/transformers/model_doc/splinter.html)** (from Tel Aviv University), released together with the paper [Few-Shot Question Answering by Pretraining Span Selection](https://arxiv.org/abs/2101.00438) by Ori Ram, Yuval Kirstain, Jonathan Berant, Amir Globerson, Omer Levy. | 1 |
Javascript | Javascript | improve splitchunksplugin performance | 05275e6e8e9cb6e149855bcb02a01cc0226f19cc | <ide><path>lib/optimize/RemoveEmptyChunksPlugin.js
<ide> class RemoveEmptyChunksPlugin {
<ide> "RemoveEmptyChunksPlugin",
<ide> handler
<ide> );
<add> compilation.hooks.optimizeChunksAdvanced.tap(
<add> "RemoveEmptyChunksPlugin",
<add> handler
<add> );
<ide> compilation.hooks.optimizeExtractedChunksBasic.tap(
<ide> "RemoveEmptyChunksPlugin",
<ide> handler
<ide> );
<add> compilation.hooks.optimizeExtractedChunksAdvanced.tap(
<add> "RemoveEmptyChunksPlugin",
<add> handler
<add> );
<ide> });
<ide> }
<ide> }
<ide><path>lib/optimize/SplitChunksPlugin.js
<ide> const SortableSet = require("../util/SortableSet");
<ide> const GraphHelpers = require("../GraphHelpers");
<ide> const { isSubset } = require("../util/SetHelpers");
<ide>
<add>/** @typedef {import("../Chunk")} Chunk */
<add>
<ide> const hashFilename = name => {
<ide> return crypto
<ide> .createHash("md4")
<ide> const compareEntries = (a, b) => {
<ide> }
<ide> };
<ide>
<add>const INITIAL_CHUNK_FILTER = chunk => chunk.canBeInitial();
<add>const ASYNC_CHUNK_FILTER = chunk => !chunk.canBeInitial();
<add>const ALL_CHUNK_FILTER = chunk => true;
<add>
<ide> module.exports = class SplitChunksPlugin {
<ide> constructor(options) {
<ide> this.options = SplitChunksPlugin.normalizeOptions(options);
<ide> module.exports = class SplitChunksPlugin {
<ide>
<ide> static normalizeName({ name, automaticNameDelimiter }) {
<ide> if (name === true) {
<add> const cache = new Map();
<ide> const fn = (module, chunks, cacheGroup) => {
<add> let cacheEntry = cache.get(chunks);
<add> if (cacheEntry === undefined) {
<add> cacheEntry = {};
<add> cache.set(chunks, cacheEntry);
<add> } else if (cacheGroup in cacheEntry) {
<add> return cacheEntry[cacheGroup];
<add> }
<ide> const names = chunks.map(c => c.name);
<del> if (!names.every(Boolean)) return;
<add> if (!names.every(Boolean)) {
<add> cacheEntry[cacheGroup] = undefined;
<add> return;
<add> }
<ide> names.sort();
<ide> let name =
<ide> (cacheGroup && cacheGroup !== "default"
<ide> module.exports = class SplitChunksPlugin {
<ide> name =
<ide> name.slice(0, 100) + automaticNameDelimiter + hashFilename(name);
<ide> }
<add> cacheEntry[cacheGroup] = name;
<ide> return name;
<ide> };
<ide> return fn;
<ide> module.exports = class SplitChunksPlugin {
<ide>
<ide> static normalizeChunksFilter(chunks) {
<ide> if (chunks === "initial") {
<del> return chunk => chunk.canBeInitial();
<add> return INITIAL_CHUNK_FILTER;
<ide> }
<ide> if (chunks === "async") {
<del> return chunk => !chunk.canBeInitial();
<add> return ASYNC_CHUNK_FILTER;
<ide> }
<ide> if (chunks === "all") {
<del> return () => true;
<add> return ALL_CHUNK_FILTER;
<ide> }
<ide> if (typeof chunks === "function") return chunks;
<ide> }
<ide>
<ide> static normalizeCacheGroups({ cacheGroups, automaticNameDelimiter }) {
<ide> if (typeof cacheGroups === "function") {
<add> // TODO webpack 5 remove this
<add> if (cacheGroups.length !== 1)
<add> return module => cacheGroups(module, module.getChunks());
<ide> return cacheGroups;
<ide> }
<ide> if (cacheGroups && typeof cacheGroups === "object") {
<del> const fn = (module, chunks) => {
<add> const fn = module => {
<ide> let results;
<ide> for (const key of Object.keys(cacheGroups)) {
<ide> let option = cacheGroups[key];
<ide> module.exports = class SplitChunksPlugin {
<ide> results.push(result);
<ide> }
<ide> }
<del> } else if (SplitChunksPlugin.checkTest(option.test, module, chunks)) {
<add> } else if (SplitChunksPlugin.checkTest(option.test, module)) {
<ide> if (results === undefined) results = [];
<ide> results.push({
<ide> key: key,
<ide> module.exports = class SplitChunksPlugin {
<ide> return fn;
<ide> }
<ide>
<del> static checkTest(test, module, chunks) {
<add> static checkTest(test, module) {
<ide> if (test === undefined) return true;
<del> if (typeof test === "function") return test(module, chunks);
<add> if (typeof test === "function") {
<add> if (test.length !== 1) return test(module, module.getChunks());
<add> return test(module);
<add> }
<ide> if (typeof test === "boolean") return test;
<del> const names = chunks
<del> .map(c => c.name)
<del> .concat(module.nameForCondition ? [module.nameForCondition()] : [])
<del> .filter(Boolean);
<ide> if (typeof test === "string") {
<del> for (const name of names) if (name.startsWith(test)) return true;
<add> if (module.nameForCondition && module.nameForCondition().startsWith(test))
<add> return true;
<add> for (const chunk of module.chunksIterable) {
<add> if (chunk.name && chunk.name.startsWith(test)) return true;
<add> }
<ide> return false;
<ide> }
<ide> if (test instanceof RegExp) {
<del> for (const name of names) if (test.test(name)) return true;
<add> if (module.nameForCondition && test.test(module.nameForCondition()))
<add> return true;
<add> for (const chunk of module.chunksIterable) {
<add> if (chunk.name && test.test(chunk.name)) return true;
<add> }
<ide> return false;
<ide> }
<ide> return false;
<ide> module.exports = class SplitChunksPlugin {
<ide> .sort()
<ide> .join();
<ide> };
<del> // Create a list of possible combinations
<del> const chunkSetsInGraph = new Map(); // Map<string, Set<Chunk>>
<add> /** @type {Map<string, Set<Chunk>>} */
<add> const chunkSetsInGraph = new Map();
<ide> for (const module of compilation.modules) {
<del> const chunkIndices = getKey(module.chunksIterable);
<del> chunkSetsInGraph.set(chunkIndices, new Set(module.chunksIterable));
<add> const chunksKey = getKey(module.chunksIterable);
<add> if (!chunkSetsInGraph.has(chunksKey)) {
<add> chunkSetsInGraph.set(chunksKey, new Set(module.chunksIterable));
<add> }
<ide> }
<del> const combinations = new Map(); // Map<string, Set<Chunk>[]>
<del> for (const [key, chunksSet] of chunkSetsInGraph) {
<del> var array = [];
<del> for (const set of chunkSetsInGraph.values()) {
<del> if (isSubset(chunksSet, set)) {
<del> array.push(set);
<del> }
<add>
<add> // group these set of chunks by count
<add> // to allow to check less sets via isSubset
<add> // (only smaller sets can be subset)
<add> /** @type {Map<number, Array<Set<Chunk>>>} */
<add> const chunkSetsByCount = new Map();
<add> for (const chunksSet of chunkSetsInGraph.values()) {
<add> const count = chunksSet.size;
<add> let array = chunkSetsByCount.get(count);
<add> if (array === undefined) {
<add> array = [];
<add> chunkSetsByCount.set(count, array);
<ide> }
<del> combinations.set(key, array);
<add> array.push(chunksSet);
<ide> }
<add>
<add> // Create a list of possible combinations
<add> const combinationsCache = new Map(); // Map<string, Set<Chunk>[]>
<add> const selectedChunksCacheByChunksSet = new WeakMap(); // WeakMap<Set<Chunk>, WeakMap<Function, {chunks: Chunk[], key: string}>>
<add>
<add> const getCombinations = key => {
<add> const chunksSet = chunkSetsInGraph.get(key);
<add> var array = [chunksSet];
<add> if (chunksSet.size > 1) {
<add> for (const [count, setArray] of chunkSetsByCount) {
<add> // "equal" is not needed because they would have been merge in the first step
<add> if (count < chunksSet.size) {
<add> for (const set of setArray) {
<add> if (isSubset(chunksSet, set)) {
<add> array.push(set);
<add> }
<add> }
<add> }
<add> }
<add> }
<add> return array;
<add> };
<add>
<add> const getSelectedChunks = (chunks, chunkFilter) => {
<add> let entry = selectedChunksCacheByChunksSet.get(chunks);
<add> if (entry === undefined) {
<add> entry = new Map();
<add> selectedChunksCacheByChunksSet.set(chunks, entry);
<add> }
<add> let entry2 = entry.get(chunkFilter);
<add> if (entry2 === undefined) {
<add> const selectedChunks = [];
<add> for (const chunk of chunks) {
<add> if (chunkFilter(chunk)) selectedChunks.push(chunk);
<add> }
<add> entry2 = {
<add> chunks: selectedChunks,
<add> key: getKey(selectedChunks)
<add> };
<add> entry.set(chunkFilter, entry2);
<add> }
<add> return entry2;
<add> };
<add>
<ide> // Map a list of chunks to a list of modules
<ide> // For the key the chunk "index" is used, the value is a SortableSet of modules
<ide> const chunksInfoMap = new Map();
<add>
<ide> // Walk through all modules
<ide> for (const module of compilation.modules) {
<del> // Get array of chunks
<del> const chunks = module.getChunks();
<ide> // Get cache group
<del> let cacheGroups = this.options.getCacheGroups(module, chunks);
<del> if (!Array.isArray(cacheGroups)) continue;
<add> let cacheGroups = this.options.getCacheGroups(module);
<add> if (!Array.isArray(cacheGroups) || cacheGroups.length === 0)
<add> continue;
<add>
<add> // Prepare some values
<add> const chunksKey = getKey(module.chunksIterable);
<add> let combs = combinationsCache.get(chunksKey);
<add> if (combs === undefined) {
<add> combs = getCombinations(chunksKey);
<add> combinationsCache.set(chunksKey, combs);
<add> }
<add>
<ide> for (const cacheGroupSource of cacheGroups) {
<ide> const cacheGroup = {
<ide> key: cacheGroupSource.key,
<ide> module.exports = class SplitChunksPlugin {
<ide> reuseExistingChunk: cacheGroupSource.reuseExistingChunk
<ide> };
<ide> // For all combination of chunk selection
<del> for (const chunkCombination of combinations.get(getKey(chunks))) {
<del> // Get indices of chunks in which this module occurs
<del> const chunkIndices = Array.from(chunkCombination, chunk =>
<del> indexMap.get(chunk)
<del> );
<add> for (const chunkCombination of combs) {
<ide> // Break if minimum number of chunks is not reached
<del> if (chunkIndices.length < cacheGroup.minChunks) continue;
<add> if (chunkCombination.size < cacheGroup.minChunks) continue;
<ide> // Select chunks by configuration
<del> const selectedChunks = Array.from(chunkCombination).filter(
<add> const {
<add> chunks: selectedChunks,
<add> key: selectedChunksKey
<add> } = getSelectedChunks(
<add> chunkCombination,
<ide> cacheGroup.chunksFilter
<ide> );
<ide> // Break if minimum number of chunks is not reached
<ide> module.exports = class SplitChunksPlugin {
<ide> // When it has a name we use the name as key
<ide> // Elsewise we create the key from chunks and cache group key
<ide> // This automatically merges equal names
<del> const chunksKey = getKey(selectedChunks);
<ide> const key =
<ide> (name && `name:${name}`) ||
<del> `chunks:${chunksKey} key:${cacheGroup.key}`;
<add> `chunks:${selectedChunksKey} key:${cacheGroup.key}`;
<ide> // Add module to maps
<ide> let info = chunksInfoMap.get(key);
<ide> if (info === undefined) {
<ide> module.exports = class SplitChunksPlugin {
<ide> modules: new SortableSet(undefined, sortByIdentifier),
<ide> cacheGroup,
<ide> name,
<add> size: 0,
<ide> chunks: new Map(),
<ide> reusedableChunks: new Set(),
<ide> chunksKeys: new Set()
<ide> })
<ide> );
<ide> }
<ide> info.modules.add(module);
<del> if (!info.chunksKeys.has(chunksKey)) {
<del> info.chunksKeys.add(chunksKey);
<add> info.size += module.size();
<add> if (!info.chunksKeys.has(selectedChunksKey)) {
<add> info.chunksKeys.add(selectedChunksKey);
<ide> for (const chunk of selectedChunks) {
<ide> info.chunks.set(chunk, chunk.getNumberOfModules());
<ide> }
<ide> }
<ide> }
<ide> }
<ide> }
<add>
<ide> for (const [key, info] of chunksInfoMap) {
<ide> // Get size of module lists
<del> info.size = getModulesSize(info.modules);
<ide> if (info.size < info.cacheGroup.minSize) {
<ide> chunksInfoMap.delete(key);
<ide> }
<ide> }
<del> let changed = false;
<ide> while (chunksInfoMap.size > 0) {
<ide> // Find best matching entry
<ide> let bestEntryKey;
<ide> module.exports = class SplitChunksPlugin {
<ide> }
<ide> }
<ide> }
<add> const usedChunks = [];
<ide> // Walk through all chunks
<ide> for (const chunk of item.chunks.keys()) {
<ide> // skip if we address ourself
<ide> module.exports = class SplitChunksPlugin {
<ide> }
<ide> // Add graph connections for splitted chunk
<ide> chunk.split(newChunk);
<del> // Remove all selected modules from the chunk
<del> for (const module of item.modules) {
<del> chunk.removeModule(module);
<del> module.rewriteChunkInReasons(chunk, [newChunk]);
<del> }
<add> usedChunks.push(chunk);
<ide> }
<add>
<ide> // If we successfully created a new chunk or reused one
<ide> if (newChunk) {
<ide> // Add a note to the chunk
<ide> module.exports = class SplitChunksPlugin {
<ide> if (!isReused) {
<ide> // Add all modules to the new chunk
<ide> for (const module of item.modules) {
<add> if (typeof module.chunkCondition === "function") {
<add> if (!module.chunkCondition(newChunk)) continue;
<add> }
<add> // Add module to new chunk
<ide> GraphHelpers.connectChunkAndModule(newChunk, module);
<add> // Remove module from used chunks
<add> for (const chunk of usedChunks) {
<add> chunk.removeModule(module);
<add> module.rewriteChunkInReasons(chunk, [newChunk]);
<add> }
<add> }
<add> } else {
<add> // Remove all modules from used chunks
<add> for (const module of item.modules) {
<add> for (const chunk of usedChunks) {
<add> chunk.removeModule(module);
<add> module.rewriteChunkInReasons(chunk, [newChunk]);
<add> }
<ide> }
<ide> }
<ide> // remove all modules from other entries and update size
<ide> module.exports = class SplitChunksPlugin {
<ide> }
<ide> }
<ide> }
<del> changed = true;
<ide> }
<ide> }
<del> if (changed) return true;
<ide> }
<ide> );
<ide> }); | 2 |
Javascript | Javascript | fix broken jsdoc references | 6f769aab58d9cad6195859d8ec1b6f66ab134fb3 | <ide><path>packages/ember-htmlbars/lib/compat/make-bound-helper.js
<ide> import {
<ide>
<ide> @method makeBoundHelper
<ide> @for Ember.Handlebars
<del> @param {Function} function
<add> @param {Function} fn
<ide> @param {String} dependentKeys*
<ide> @since 1.2.0
<ide> @deprecated
<ide><path>packages/ember-htmlbars/lib/compat/register-bound-helper.js
<ide> var slice = [].slice;
<ide> @method registerBoundHelper
<ide> @for Ember.Handlebars
<ide> @param {String} name
<del> @param {Function} function
<add> @param {Function} fn
<ide> @param {String} dependentKeys*
<ide> */
<ide> export default function registerBoundHelper(name, fn) {
<ide><path>packages/ember-htmlbars/lib/helpers/each.js
<ide> import shouldDisplay from "ember-views/streams/should_display";
<ide>
<ide> @method each
<ide> @for Ember.Handlebars.helpers
<del> @param [name] {String} name for item (used with `as`)
<del> @param [path] {String} path
<del> @param [options] {Object} Handlebars key/value pairs of options
<ide> */
<ide> export default function eachHelper(params, hash, blocks) {
<ide> var list = params[0];
<ide><path>packages/ember-htmlbars/lib/helpers/log.js
<ide> import Logger from "ember-metal/logger";
<ide> ```
<ide> @method log
<ide> @for Ember.Handlebars.helpers
<del> @param {String} property
<add> @param {*} values
<ide> */
<ide> export default function logHelper(values) {
<ide> Logger.log.apply(null, values);
<ide><path>packages/ember-htmlbars/lib/helpers/with.js
<ide> import shouldDisplay from "ember-views/streams/should_display";
<ide>
<ide> @method with
<ide> @for Ember.Handlebars.helpers
<del> @param {Function} context
<ide> @param {Hash} options
<ide> @return {String} HTML string
<ide> */
<ide><path>packages/ember-htmlbars/lib/keywords.js
<ide> var keywords = o_create(hooks.keywords);
<ide> @method _registerHelper
<ide> @for Ember.HTMLBars
<ide> @param {String} name
<del> @param {Object|Function} helperFunc the helper function to add
<add> @param {Object|Function} keyword the keyword to add
<ide> */
<ide> export function registerKeyword(name, keyword) {
<ide> keywords[name] = keyword;
<ide><path>packages/ember-htmlbars/lib/keywords/debugger.js
<ide> import Logger from "ember-metal/logger";
<ide> ```
<ide> @method debugger
<ide> @for Ember.Handlebars.helpers
<del> @param {String} property
<ide> */
<ide> export default function debuggerKeyword(morph, env, scope) {
<ide> /* jshint unused: false, debug: true */
<ide><path>packages/ember-htmlbars/lib/system/lookup-helper.js
<ide> export var ISNT_HELPER_CACHE = new Cache(1000, function(key) {
<ide>
<ide> @private
<ide> @method resolveHelper
<del> @param {Container} container
<ide> @param {String} name the name of the helper to lookup
<ide> @return {Handlebars Helper}
<ide> */
<ide><path>packages/ember-htmlbars/lib/system/make_bound_helper.js
<ide> import { readHash, readArray } from "ember-metal/streams/utils";
<ide> @private
<ide> @method makeBoundHelper
<ide> @for Ember.HTMLBars
<del> @param {Function} function
<add> @param {Function} fn
<ide> @since 1.10.0
<ide> */
<ide> export default function makeBoundHelper(fn) {
<ide><path>packages/ember-metal/lib/enumerable_utils.js
<ide> var deprecatedFilter = Ember.deprecateFunc('Ember.EnumberableUtils.filter is dep
<ide> * @method indexOf
<ide> * @deprecated Use ES5's Array.prototype.indexOf instead.
<ide> * @param {Object} obj The object to call indexOn on
<del> * @param {Function} callback The callback to execute
<ide> * @param {Object} index The index to start searching from
<ide> *
<ide> */
<ide><path>packages/ember-metal/lib/instrumentation.js
<ide> var time = (function() {
<ide> @namespace Ember.Instrumentation
<ide>
<ide> @param {String} [name] Namespaced event name.
<del> @param {Object} payload
<add> @param {Object} _payload
<ide> @param {Function} callback Function that you're instrumenting.
<ide> @param {Object} binding Context that instrument function is called with.
<ide> */
<ide><path>packages/ember-metal/lib/observer.js
<ide> function beforeEvent(keyName) {
<ide> @method addObserver
<ide> @for Ember
<ide> @param obj
<del> @param {String} path
<del> @param {Object|Function} targetOrMethod
<add> @param {String} _path
<add> @param {Object|Function} target
<ide> @param {Function|String} [method]
<ide> */
<ide> export function addObserver(obj, _path, target, method) {
<ide><path>packages/ember-metal/lib/property_set.js
<ide> function setPath(root, path, value, tolerant) {
<ide>
<ide> @method trySet
<ide> @for Ember
<del> @param {Object} obj The object to modify.
<add> @param {Object} root The object to modify.
<ide> @param {String} path The property path to set
<ide> @param {Object} value The value to set
<ide> */
<ide><path>packages/ember-metal/lib/utils.js
<ide> export function inspect(obj) {
<ide> // The following functions are intentionally minified to keep the functions
<ide> // below Chrome's function body size inlining limit of 600 chars.
<ide> /**
<del> @param {Object} target
<del> @param {Function} method
<del> @param {Array} args
<add> @param {Object} t target
<add> @param {Function} m method
<add> @param {Array} a args
<ide> */
<ide> export function apply(t, m, a) {
<ide> var l = a && a.length;
<ide> export function apply(t, m, a) {
<ide> }
<ide>
<ide> /**
<del> @param {Object} target
<del> @param {String} method
<del> @param {Array} args
<add> @param {Object} t target
<add> @param {String} m method
<add> @param {Array} a args
<ide> */
<ide> export function applyStr(t, m, a) {
<ide> var l = a && a.length;
<ide><path>packages/ember-metal/lib/watching.js
<ide> import {
<ide> @method watch
<ide> @for Ember
<ide> @param obj
<del> @param {String} keyName
<add> @param {String} _keyPath
<ide> */
<ide> function watch(obj, _keyPath, m) {
<ide> // can't watch length on Array - it is special...
<ide><path>packages/ember-routing-htmlbars/lib/keywords/action.js
<ide> import closureAction from "ember-routing-htmlbars/keywords/closure-action";
<ide>
<ide> @method action
<ide> @for Ember.Handlebars.helpers
<del> @param {String} actionName
<del> @param {Object} [context]*
<del> @param {Hash} options
<ide> */
<ide> export default function(morph, env, scope, params, hash, template, inverse, visitor) {
<ide> if (Ember.FEATURES.isEnabled("ember-routing-htmlbars-improved-actions")) {
<ide><path>packages/ember-runtime/lib/computed/reduce_computed_macros.js
<ide> function binarySearch(array, item, low, high) {
<ide>
<ide> @method sort
<ide> @for Ember.computed
<del> @param {String} dependentKey
<add> @param {String} itemsKey
<ide> @param {String or Function} sortDefinition a dependent key to an
<ide> array of sort properties (add `:desc` to the arrays sort properties to sort descending) or a function to use when sorting
<ide> @return {Ember.ComputedProperty} computes a new sorted array based
<ide><path>packages/ember-runtime/lib/system/tracked_array.js
<ide> TrackedArray.prototype = {
<ide>
<ide> @method ArrayOperation
<ide> @private
<del> @param {String} type The type of the operation. One of
<add> @param {String} operation The type of the operation. One of
<ide> `Ember.TrackedArray.{RETAIN, INSERT, DELETE}`
<ide> @param {Number} count The number of items in this operation.
<ide> @param {Array} items The items of the operation, if included. RETAIN and
<ide><path>packages/ember-template-compiler/lib/plugins/transform-angle-bracket-components.js
<ide> function TransformAngleBracketComponents() {
<ide> /**
<ide> @private
<ide> @method transform
<del> @param {AST} The AST to be transformed.
<add> @param {AST} ast The AST to be transformed.
<ide> */
<ide> TransformAngleBracketComponents.prototype.transform = function TransformBindAttrToAttributes_transform(ast) {
<ide> var walker = new this.syntax.Walker();
<ide><path>packages/ember-template-compiler/lib/plugins/transform-bind-attr-to-attributes.js
<ide> function TransformBindAttrToAttributes(options) {
<ide> /**
<ide> @private
<ide> @method transform
<del> @param {AST} The AST to be transformed.
<add> @param {AST} ast The AST to be transformed.
<ide> */
<ide> TransformBindAttrToAttributes.prototype.transform = function TransformBindAttrToAttributes_transform(ast) {
<ide> var plugin = this;
<ide><path>packages/ember-template-compiler/lib/plugins/transform-component-attrs-into-mut.js
<ide> function TransformComponentAttrsIntoMut() {
<ide> /**
<ide> @private
<ide> @method transform
<del> @param {AST} The AST to be transformed.
<add> @param {AST} ast The AST to be transformed.
<ide> */
<ide> TransformComponentAttrsIntoMut.prototype.transform = function TransformBindAttrToAttributes_transform(ast) {
<ide> var b = this.syntax.builders;
<ide><path>packages/ember-template-compiler/lib/plugins/transform-component-curly-to-readonly.js
<ide> function TransformComponentCurlyToReadonly() {
<ide> /**
<ide> @private
<ide> @method transform
<del> @param {AST} The AST to be transformed.
<add> @param {AST} ast The AST to be transformed.
<ide> */
<ide> TransformComponentCurlyToReadonly.prototype.transform = function TransformComponetnCurlyToReadonly_transform(ast) {
<ide> var b = this.syntax.builders;
<ide><path>packages/ember-template-compiler/lib/plugins/transform-each-in-to-block-params.js
<ide> function TransformEachInToBlockParams(options) {
<ide> /**
<ide> @private
<ide> @method transform
<del> @param {AST} The AST to be transformed.
<add> @param {AST} ast The AST to be transformed.
<ide> */
<ide> TransformEachInToBlockParams.prototype.transform = function TransformEachInToBlockParams_transform(ast) {
<ide> var b = this.syntax.builders;
<ide><path>packages/ember-template-compiler/lib/plugins/transform-each-in-to-hash.js
<ide> function TransformEachInToHash(options) {
<ide> /**
<ide> @private
<ide> @method transform
<del> @param {AST} The AST to be transformed.
<add> @param {AST} ast The AST to be transformed.
<ide> */
<ide> TransformEachInToHash.prototype.transform = function TransformEachInToHash_transform(ast) {
<ide> var pluginContext = this;
<ide><path>packages/ember-template-compiler/lib/plugins/transform-input-on-to-onEvent.js
<ide> function TransformInputOnToOnEvent(options) {
<ide> /**
<ide> @private
<ide> @method transform
<del> @param {AST} The AST to be transformed.
<add> @param {AST} ast The AST to be transformed.
<ide> */
<ide> TransformInputOnToOnEvent.prototype.transform = function TransformInputOnToOnEvent_transform(ast) {
<ide> const pluginContext = this;
<ide><path>packages/ember-template-compiler/lib/plugins/transform-with-as-to-hash.js
<ide> function TransformWithAsToHash(options) {
<ide> /**
<ide> @private
<ide> @method transform
<del> @param {AST} The AST to be transformed.
<add> @param {AST} ast The AST to be transformed.
<ide> */
<ide> TransformWithAsToHash.prototype.transform = function TransformWithAsToHash_transform(ast) {
<ide> var pluginContext = this;
<ide><path>packages/ember-views/lib/compat/render_buffer.js
<ide> export function renderComponentWithBuffer(component, contextualElement, dom) {
<ide>
<ide> @method renderBuffer
<ide> @namespace Ember
<del> @param {String} tagName tag name (such as 'div' or 'p') used for the buffer
<ide> */
<ide>
<ide> var RenderBuffer = function(domHelper) { | 27 |
Text | Text | add maxtotalsockets option to agent constructor | a7c6806adc5591ba782cb7c520fb983bc0e25ec1 | <ide><path>doc/api/http.md
<ide> http.get({
<ide> <!-- YAML
<ide> added: v0.3.4
<ide> changes:
<add> - version: v14.5.0
<add> pr-url: https://github.com/nodejs/node/pull/33617
<add> description: Add `maxTotalSockets` option to agent constructor.
<ide> - version: v14.5.0
<ide> pr-url: https://github.com/nodejs/node/pull/33278
<ide> description: Add `scheduling` option to specify the free socket
<ide> changes:
<ide> * `maxSockets` {number} Maximum number of sockets to allow per
<ide> host. Each request will use a new socket until the maximum is reached.
<ide> **Default:** `Infinity`.
<add> * `maxTotalSockets` {number} Maximum number of sockets allowed for
<add> all hosts in total. Each request will use a new socket
<add> until the maximum is reached.
<add> **Default:** `Infinity`.
<ide> * `maxFreeSockets` {number} Maximum number of sockets to leave open
<ide> in a free state. Only relevant if `keepAlive` is set to `true`.
<ide> **Default:** `256`. | 1 |
Javascript | Javascript | move texture images loading code to be static | e1179f0b9a01b9a019041fb2b6bce84f1f02f92a | <ide><path>examples/js/loaders/MTLLoader.js
<ide> THREE.MTLLoader.MaterialCreator.prototype = {
<ide> break;
<ide> case 'map_kd':
<ide> // Diffuse texture map
<del> params['map'] = this.loadTexture( this.baseUrl + value );
<add> params['map'] = THREE.MTLLoader.loadTexture( this.baseUrl + value );
<ide> params['map'].wrapS = this.wrap;
<ide> params['map'].wrapT = this.wrap;
<ide> break;
<ide> THREE.MTLLoader.MaterialCreator.prototype = {
<ide> }
<ide> this.materials[materialName] = new THREE.MeshPhongMaterial(params);
<ide> return this.materials[materialName];
<del> },
<add> }
<add>};
<ide>
<del> loadTexture: function ( url, mapping, onLoad, onError ) {
<add>THREE.MTLLoader.loadTexture = function ( url, mapping, onLoad, onError ) {
<ide> var image = new Image();
<ide> var texture = new THREE.Texture( image, mapping );
<ide>
<ide> var loader = new THREE.ImageLoader();
<ide>
<ide> loader.addEventListener( 'load', function ( event ) {
<del> texture.image = this.ensurePowerOfTwo(event.content);
<add> texture.image = THREE.MTLLoader.ensurePowerOfTwo_(event.content);
<ide> texture.needsUpdate = true;
<ide> if ( onLoad ) onLoad( texture );
<del> }.bind(this) );
<add> } );
<ide>
<ide> loader.addEventListener( 'error', function ( event ) {
<ide> if ( onError ) onError( event.message );
<ide> THREE.MTLLoader.MaterialCreator.prototype = {
<ide> loader.load( url, image );
<ide>
<ide> return texture;
<del> },
<add> };
<ide>
<del> ensurePowerOfTwo: function(image)
<add>THREE.MTLLoader.ensurePowerOfTwo_ = function (image)
<add>{
<add> if (!THREE.MTLLoader.isPowerOfTwo_(image.width) || !THREE.MTLLoader.isPowerOfTwo_(image.height))
<ide> {
<del> if (!this.isPowerOfTwo(image.width) || !this.isPowerOfTwo(image.height))
<del> {
<del> var canvas = document.createElement("canvas");
<del> canvas.width = this.nextHighestPowerOfTwo(image.width);
<del> canvas.height = this.nextHighestPowerOfTwo(image.height);
<del> var ctx = canvas.getContext("2d");
<del> ctx.drawImage(image, 0, 0, image.width, image.height, 0, 0, canvas.width, canvas.height);
<del> return canvas;
<del> }
<del> return image;
<del> },
<add> var canvas = document.createElement("canvas");
<add> canvas.width = THREE.MTLLoader.nextHighestPowerOfTwo_(image.width);
<add> canvas.height = THREE.MTLLoader.nextHighestPowerOfTwo_(image.height);
<add> var ctx = canvas.getContext("2d");
<add> ctx.drawImage(image, 0, 0, image.width, image.height, 0, 0, canvas.width, canvas.height);
<add> return canvas;
<add> }
<add> return image;
<add>};
<ide>
<del> isPowerOfTwo: function (x)
<del> {
<del> return (x & (x - 1)) == 0;
<del> },
<add>THREE.MTLLoader.isPowerOfTwo_ = function (x)
<add>{
<add> return (x & (x - 1)) == 0;
<add>};
<ide>
<del> nextHighestPowerOfTwo: function(x)
<del> {
<del> --x;
<del> for (var i = 1; i < 32; i <<= 1) {
<del> x = x | x >> i;
<del> }
<del> return x + 1;
<add>THREE.MTLLoader.nextHighestPowerOfTwo_ = function(x)
<add>{
<add> --x;
<add> for (var i = 1; i < 32; i <<= 1) {
<add> x = x | x >> i;
<ide> }
<add> return x + 1;
<ide> };
<ide> | 1 |
Text | Text | add changelog entry for inflection removal | 0423d9c6c57ffac7f0368460277f370b35c86d64 | <ide><path>activesupport/CHANGELOG.md
<add>* Remove 'cow' => 'kine' irregular inflection from default inflections.
<add>
<add> *Andrew White*
<add>
<ide> * Add `DateTime#to_s(:iso8601)` and `Date#to_s(:iso8601)` for consistency.
<ide>
<ide> *Andrew White* | 1 |
Javascript | Javascript | improve multiple zlib tests | 4e8bc7181c1f2491e187477798d433a4488f43d4 | <ide><path>test/parallel/test-zlib-from-gzip-with-trailing-garbage.js
<ide> assert.throws(
<ide> );
<ide>
<ide> zlib.gunzip(data, common.mustCall((err, result) => {
<del> assert(err instanceof Error);
<del> assert.strictEqual(err.code, 'Z_DATA_ERROR');
<del> assert.strictEqual(err.message, 'unknown compression method');
<add> common.expectsError({
<add> code: 'Z_DATA_ERROR',
<add> type: Error,
<add> message: 'unknown compression method'
<add> })(err);
<ide> assert.strictEqual(result, undefined);
<ide> }));
<ide>
<ide><path>test/parallel/test-zlib-from-gzip.js
<ide> const inp = fs.createReadStream(fixture);
<ide> const out = fs.createWriteStream(outputFile);
<ide>
<ide> inp.pipe(gunzip).pipe(out);
<del>out.on('close', function() {
<add>out.on('close', common.mustCall(() => {
<ide> const actual = fs.readFileSync(outputFile);
<ide> assert.strictEqual(actual.length, expect.length, 'length should match');
<ide> for (let i = 0, l = actual.length; i < l; i++) {
<ide> assert.strictEqual(actual[i], expect[i], `byte[${i}]`);
<ide> }
<del>});
<add>}));
<ide><path>test/parallel/test-zlib-from-string.js
<ide> 'use strict';
<ide> // test compressing and uncompressing a string with zlib
<ide>
<del>require('../common');
<add>const common = require('../common');
<ide> const assert = require('assert');
<ide> const zlib = require('zlib');
<ide>
<ide> const expectedBase64Gzip = 'H4sIAAAAAAAAA11RS05DMQy8yhzg6d2BPSAkJPZu4laWkjiN4' +
<ide> 'mHo33kJO8xfkckmLjE5XMKBQ4gxIsfvCZ44doUThF2mcZq8q2' +
<ide> 'sHnHNzRtagj5AQAA';
<ide>
<del>zlib.deflate(inputString, function(err, buffer) {
<add>zlib.deflate(inputString, common.mustCall((err, buffer) => {
<ide> assert.strictEqual(buffer.toString('base64'), expectedBase64Deflate,
<ide> 'deflate encoded string should match');
<del>});
<add>}));
<ide>
<del>zlib.gzip(inputString, function(err, buffer) {
<add>zlib.gzip(inputString, common.mustCall((err, buffer) => {
<ide> // Can't actually guarantee that we'll get exactly the same
<ide> // deflated bytes when we compress a string, since the header
<ide> // depends on stuff other than the input string itself.
<ide> // However, decrypting it should definitely yield the same
<ide> // result that we're expecting, and this should match what we get
<ide> // from inflating the known valid deflate data.
<del> zlib.gunzip(buffer, function(err, gunzipped) {
<add> zlib.gunzip(buffer, common.mustCall((err, gunzipped) => {
<ide> assert.strictEqual(gunzipped.toString(), inputString,
<ide> 'Should get original string after gzip/gunzip');
<del> });
<del>});
<add> }));
<add>}));
<ide>
<ide> let buffer = Buffer.from(expectedBase64Deflate, 'base64');
<del>zlib.unzip(buffer, function(err, buffer) {
<add>zlib.unzip(buffer, common.mustCall((err, buffer) => {
<ide> assert.strictEqual(buffer.toString(), inputString,
<ide> 'decoded inflated string should match');
<del>});
<add>}));
<ide>
<ide> buffer = Buffer.from(expectedBase64Gzip, 'base64');
<del>zlib.unzip(buffer, function(err, buffer) {
<add>zlib.unzip(buffer, common.mustCall((err, buffer) => {
<ide> assert.strictEqual(buffer.toString(), inputString,
<ide> 'decoded gunzipped string should match');
<del>});
<add>}));
<ide><path>test/parallel/test-zlib-invalid-input.js
<ide> 'use strict';
<ide> // test uncompressing invalid input
<ide>
<del>require('../common');
<add>const common = require('../common');
<ide> const assert = require('assert');
<ide> const zlib = require('zlib');
<ide>
<del>const nonStringInputs = [1, true, { a: 1 }, ['a']];
<add>const nonStringInputs = [
<add> 1,
<add> true,
<add> { a: 1 },
<add> ['a']
<add>];
<ide>
<del>console.error('Doing the non-strings');
<del>nonStringInputs.forEach(function(input) {
<add>// zlib.Unzip classes need to get valid data, or else they'll throw.
<add>const unzips = [
<add> zlib.Unzip(),
<add> zlib.Gunzip(),
<add> zlib.Inflate(),
<add> zlib.InflateRaw()
<add>];
<add>
<add>nonStringInputs.forEach(common.mustCall((input) => {
<ide> // zlib.gunzip should not throw an error when called with bad input.
<ide> assert.doesNotThrow(function() {
<ide> zlib.gunzip(input, function(err, buffer) {
<ide> // zlib.gunzip should pass the error to the callback.
<ide> assert.ok(err);
<ide> });
<ide> });
<del>});
<del>
<del>console.error('Doing the unzips');
<del>// zlib.Unzip classes need to get valid data, or else they'll throw.
<del>const unzips = [ zlib.Unzip(),
<del> zlib.Gunzip(),
<del> zlib.Inflate(),
<del> zlib.InflateRaw() ];
<del>const hadError = [];
<del>unzips.forEach(function(uz, i) {
<del> console.error(`Error for ${uz.constructor.name}`);
<del> uz.on('error', function(er) {
<del> console.error('Error event', er);
<del> hadError[i] = true;
<del> });
<add>}, nonStringInputs.length));
<ide>
<del> uz.on('end', function(er) {
<del> throw new Error(`end event should not be emitted ${uz.constructor.name}`);
<del> });
<add>unzips.forEach(common.mustCall((uz, i) => {
<add> uz.on('error', common.mustCall());
<add> uz.on('end', common.mustNotCall);
<ide>
<ide> // this will trigger error event
<ide> uz.write('this is not valid compressed data.');
<del>});
<del>
<del>process.on('exit', function() {
<del> assert.deepStrictEqual(hadError, [true, true, true, true], 'expect 4 errors');
<del>});
<add>}, unzips.length));
<ide><path>test/parallel/test-zlib-random-byte-pipes.js
<ide> if (!common.hasCrypto)
<ide> const assert = require('assert');
<ide> const crypto = require('crypto');
<ide> const stream = require('stream');
<del>const util = require('util');
<ide> const zlib = require('zlib');
<ide>
<ide> const Stream = stream.Stream;
<ide>
<ide> // emit random bytes, and keep a shasum
<del>function RandomReadStream(opt) {
<del> Stream.call(this);
<add>class RandomReadStream extends Stream {
<add> constructor(opt) {
<add> super();
<ide>
<del> this.readable = true;
<del> this._paused = false;
<del> this._processing = false;
<del>
<del> this._hasher = crypto.createHash('sha1');
<del> opt = opt || {};
<del>
<del> // base block size.
<del> opt.block = opt.block || 256 * 1024;
<add> this.readable = true;
<add> this._paused = false;
<add> this._processing = false;
<ide>
<del> // total number of bytes to emit
<del> opt.total = opt.total || 256 * 1024 * 1024;
<del> this._remaining = opt.total;
<add> this._hasher = crypto.createHash('sha1');
<add> opt = opt || {};
<ide>
<del> // how variable to make the block sizes
<del> opt.jitter = opt.jitter || 1024;
<add> // base block size.
<add> opt.block = opt.block || 256 * 1024;
<ide>
<del> this._opt = opt;
<add> // total number of bytes to emit
<add> opt.total = opt.total || 256 * 1024 * 1024;
<add> this._remaining = opt.total;
<ide>
<del> this._process = this._process.bind(this);
<add> // how variable to make the block sizes
<add> opt.jitter = opt.jitter || 1024;
<ide>
<del> process.nextTick(this._process);
<del>}
<add> this._opt = opt;
<ide>
<del>util.inherits(RandomReadStream, Stream);
<add> this._process = this._process.bind(this);
<ide>
<del>RandomReadStream.prototype.pause = function() {
<del> this._paused = true;
<del> this.emit('pause');
<del>};
<add> process.nextTick(this._process);
<add> }
<ide>
<del>RandomReadStream.prototype.resume = function() {
<del> // console.error("rrs resume");
<del> this._paused = false;
<del> this.emit('resume');
<del> this._process();
<del>};
<add> pause() {
<add> this._paused = true;
<add> this.emit('pause');
<add> }
<ide>
<del>RandomReadStream.prototype._process = function() {
<del> if (this._processing) return;
<del> if (this._paused) return;
<add> resume() {
<add> // console.error("rrs resume");
<add> this._paused = false;
<add> this.emit('resume');
<add> this._process();
<add> }
<ide>
<del> this._processing = true;
<add> _process() {
<add> if (this._processing) return;
<add> if (this._paused) return;
<ide>
<del> if (!this._remaining) {
<del> this._hash = this._hasher.digest('hex').toLowerCase().trim();
<del> this._processing = false;
<add> this._processing = true;
<ide>
<del> this.emit('end');
<del> return;
<del> }
<add> if (!this._remaining) {
<add> this._hash = this._hasher.digest('hex').toLowerCase().trim();
<add> this._processing = false;
<ide>
<del> // figure out how many bytes to output
<del> // if finished, then just emit end.
<del> let block = this._opt.block;
<del> const jitter = this._opt.jitter;
<del> if (jitter) {
<del> block += Math.ceil(Math.random() * jitter - (jitter / 2));
<del> }
<del> block = Math.min(block, this._remaining);
<del> const buf = Buffer.allocUnsafe(block);
<del> for (let i = 0; i < block; i++) {
<del> buf[i] = Math.random() * 256;
<del> }
<add> this.emit('end');
<add> return;
<add> }
<ide>
<del> this._hasher.update(buf);
<add> // figure out how many bytes to output
<add> // if finished, then just emit end.
<add> let block = this._opt.block;
<add> const jitter = this._opt.jitter;
<add> if (jitter) {
<add> block += Math.ceil(Math.random() * jitter - (jitter / 2));
<add> }
<add> block = Math.min(block, this._remaining);
<add> const buf = Buffer.allocUnsafe(block);
<add> for (let i = 0; i < block; i++) {
<add> buf[i] = Math.random() * 256;
<add> }
<ide>
<del> this._remaining -= block;
<add> this._hasher.update(buf);
<ide>
<del> console.error('block=%d\nremain=%d\n', block, this._remaining);
<del> this._processing = false;
<add> this._remaining -= block;
<ide>
<del> this.emit('data', buf);
<del> process.nextTick(this._process);
<del>};
<add> this._processing = false;
<ide>
<add> this.emit('data', buf);
<add> process.nextTick(this._process);
<add> }
<add>}
<ide>
<ide> // a filter that just verifies a shasum
<del>function HashStream() {
<del> Stream.call(this);
<add>class HashStream extends Stream {
<add> constructor() {
<add> super();
<add> this.readable = this.writable = true;
<add> this._hasher = crypto.createHash('sha1');
<add> }
<ide>
<del> this.readable = this.writable = true;
<del> this._hasher = crypto.createHash('sha1');
<del>}
<add> write(c) {
<add> // Simulate the way that an fs.ReadStream returns false
<add> // on *every* write, only to resume a moment later.
<add> this._hasher.update(c);
<add> process.nextTick(() => this.resume());
<add> return false;
<add> }
<add>
<add> resume() {
<add> this.emit('resume');
<add> process.nextTick(() => this.emit('drain'));
<add> }
<ide>
<del>util.inherits(HashStream, Stream);
<del>
<del>HashStream.prototype.write = function(c) {
<del> // Simulate the way that an fs.ReadStream returns false
<del> // on *every* write like a jerk, only to resume a
<del> // moment later.
<del> this._hasher.update(c);
<del> process.nextTick(this.resume.bind(this));
<del> return false;
<del>};
<del>
<del>HashStream.prototype.resume = function() {
<del> this.emit('resume');
<del> process.nextTick(this.emit.bind(this, 'drain'));
<del>};
<del>
<del>HashStream.prototype.end = function(c) {
<del> if (c) {
<del> this.write(c);
<add> end(c) {
<add> if (c) {
<add> this.write(c);
<add> }
<add> this._hash = this._hasher.digest('hex').toLowerCase().trim();
<add> this.emit('data', this._hash);
<add> this.emit('end');
<ide> }
<del> this._hash = this._hasher.digest('hex').toLowerCase().trim();
<del> this.emit('data', this._hash);
<del> this.emit('end');
<del>};
<add>}
<ide>
<ide>
<ide> const inp = new RandomReadStream({ total: 1024, block: 256, jitter: 16 });
<ide> const gunz = zlib.createGunzip();
<ide>
<ide> inp.pipe(gzip).pipe(gunz).pipe(out);
<ide>
<del>inp.on('data', function(c) {
<del> console.error('inp data', c.length);
<del>});
<del>
<del>gzip.on('data', function(c) {
<del> console.error('gzip data', c.length);
<del>});
<del>
<del>gunz.on('data', function(c) {
<del> console.error('gunz data', c.length);
<del>});
<del>
<del>out.on('data', function(c) {
<del> console.error('out data', c.length);
<del>});
<del>
<del>out.on('data', common.mustCall(function(c) {
<del> console.error('hash=%s', c);
<add>out.on('data', common.mustCall((c) => {
<ide> assert.strictEqual(c, inp._hash, 'hashes should match');
<ide> }));
<ide><path>test/parallel/test-zlib-sync-no-event.js
<ide> 'use strict';
<del>require('../common');
<add>const common = require('../common');
<ide> const zlib = require('zlib');
<ide> const assert = require('assert');
<ide>
<del>const shouldNotBeCalled = () => { throw new Error('unexpected event'); };
<del>
<ide> const message = 'Come on, Fhqwhgads.';
<add>const buffer = Buffer.from(message);
<ide>
<ide> const zipper = new zlib.Gzip();
<del>zipper.on('close', shouldNotBeCalled);
<add>zipper.on('close', common.mustNotCall);
<ide>
<del>const buffer = Buffer.from(message);
<ide> const zipped = zipper._processChunk(buffer, zlib.constants.Z_FINISH);
<ide>
<ide> const unzipper = new zlib.Gunzip();
<del>unzipper.on('close', shouldNotBeCalled);
<add>unzipper.on('close', common.mustNotCall);
<ide>
<ide> const unzipped = unzipper._processChunk(zipped, zlib.constants.Z_FINISH);
<ide> assert.notStrictEqual(zipped.toString(), message);
<ide><path>test/parallel/test-zlib-write-after-flush.js
<ide> // USE OR OTHER DEALINGS IN THE SOFTWARE.
<ide>
<ide> 'use strict';
<del>require('../common');
<add>const common = require('../common');
<ide> const assert = require('assert');
<ide> const zlib = require('zlib');
<ide>
<ide> gzip.pipe(gunz);
<ide> let output = '';
<ide> const input = 'A line of data\n';
<ide> gunz.setEncoding('utf8');
<del>gunz.on('data', function(c) {
<del> output += c;
<del>});
<del>
<del>process.on('exit', function() {
<add>gunz.on('data', (c) => output += c);
<add>gunz.on('end', common.mustCall(() => {
<ide> assert.strictEqual(output, input);
<del>
<del> // Make sure that the flush flag was set back to normal
<ide> assert.strictEqual(gzip._flushFlag, zlib.constants.Z_NO_FLUSH);
<del>
<del> console.log('ok');
<del>});
<add>}));
<ide>
<ide> // make sure that flush/write doesn't trigger an assert failure
<del>gzip.flush(); write();
<del>function write() {
<del> gzip.write(input);
<del> gzip.end();
<del> gunz.read(0);
<del>}
<add>gzip.flush();
<add>gzip.write(input);
<add>gzip.end();
<add>gunz.read(0);
<ide><path>test/parallel/test-zlib.js
<ide> const assert = require('assert');
<ide> const zlib = require('zlib');
<ide> const path = require('path');
<ide> const fs = require('fs');
<del>const util = require('util');
<ide> const stream = require('stream');
<ide>
<ide> let zlibPairs = [
<ide> if (process.env.FAST) {
<ide> }
<ide>
<ide> const tests = {};
<del>testFiles.forEach(function(file) {
<add>testFiles.forEach(common.mustCall((file) => {
<ide> tests[file] = fs.readFileSync(path.resolve(common.fixturesDir, file));
<del>});
<add>}, testFiles.length));
<ide>
<ide>
<ide> // stream that saves everything
<del>function BufferStream() {
<del> this.chunks = [];
<del> this.length = 0;
<del> this.writable = true;
<del> this.readable = true;
<add>class BufferStream extends stream.Stream {
<add> constructor() {
<add> super();
<add> this.chunks = [];
<add> this.length = 0;
<add> this.writable = true;
<add> this.readable = true;
<add> }
<add>
<add> write(c) {
<add> this.chunks.push(c);
<add> this.length += c.length;
<add> return true;
<add> }
<add>
<add> end(c) {
<add> if (c) this.write(c);
<add> // flatten
<add> const buf = Buffer.allocUnsafe(this.length);
<add> let i = 0;
<add> this.chunks.forEach((c) => {
<add> c.copy(buf, i);
<add> i += c.length;
<add> });
<add> this.emit('data', buf);
<add> this.emit('end');
<add> return true;
<add> }
<ide> }
<ide>
<del>util.inherits(BufferStream, stream.Stream);
<del>
<del>BufferStream.prototype.write = function(c) {
<del> this.chunks.push(c);
<del> this.length += c.length;
<del> return true;
<del>};
<del>
<del>BufferStream.prototype.end = function(c) {
<del> if (c) this.write(c);
<del> // flatten
<del> const buf = Buffer.allocUnsafe(this.length);
<del> let i = 0;
<del> this.chunks.forEach(function(c) {
<del> c.copy(buf, i);
<del> i += c.length;
<del> });
<del> this.emit('data', buf);
<del> this.emit('end');
<del> return true;
<del>};
<del>
<del>
<del>function SlowStream(trickle) {
<del> this.trickle = trickle;
<del> this.offset = 0;
<del> this.readable = this.writable = true;
<add>class SlowStream extends stream.Stream {
<add> constructor(trickle) {
<add> super();
<add> this.trickle = trickle;
<add> this.offset = 0;
<add> this.readable = this.writable = true;
<add> }
<add>
<add> write() {
<add> throw new Error('not implemented, just call ss.end(chunk)');
<add> }
<add>
<add> pause() {
<add> this.paused = true;
<add> this.emit('pause');
<add> }
<add>
<add> resume() {
<add> const emit = () => {
<add> if (this.paused) return;
<add> if (this.offset >= this.length) {
<add> this.ended = true;
<add> return this.emit('end');
<add> }
<add> const end = Math.min(this.offset + this.trickle, this.length);
<add> const c = this.chunk.slice(this.offset, end);
<add> this.offset += c.length;
<add> this.emit('data', c);
<add> process.nextTick(emit);
<add> };
<add>
<add> if (this.ended) return;
<add> this.emit('resume');
<add> if (!this.chunk) return;
<add> this.paused = false;
<add> emit();
<add> }
<add>
<add> end(chunk) {
<add> // walk over the chunk in blocks.
<add> this.chunk = chunk;
<add> this.length = chunk.length;
<add> this.resume();
<add> return this.ended;
<add> }
<ide> }
<ide>
<del>util.inherits(SlowStream, stream.Stream);
<del>
<del>SlowStream.prototype.write = function() {
<del> throw new Error('not implemented, just call ss.end(chunk)');
<del>};
<del>
<del>SlowStream.prototype.pause = function() {
<del> this.paused = true;
<del> this.emit('pause');
<del>};
<del>
<del>SlowStream.prototype.resume = function() {
<del> const emit = () => {
<del> if (this.paused) return;
<del> if (this.offset >= this.length) {
<del> this.ended = true;
<del> return this.emit('end');
<del> }
<del> const end = Math.min(this.offset + this.trickle, this.length);
<del> const c = this.chunk.slice(this.offset, end);
<del> this.offset += c.length;
<del> this.emit('data', c);
<del> process.nextTick(emit);
<del> };
<del>
<del> if (this.ended) return;
<del> this.emit('resume');
<del> if (!this.chunk) return;
<del> this.paused = false;
<del> emit();
<del>};
<del>
<del>SlowStream.prototype.end = function(chunk) {
<del> // walk over the chunk in blocks.
<del> this.chunk = chunk;
<del> this.length = chunk.length;
<del> this.resume();
<del> return this.ended;
<del>};
<del>
<ide>
<ide> // for each of the files, make sure that compressing and
<ide> // decompressing results in the same data, for every combination
<ide> // of the options set above.
<del>let failures = 0;
<del>let total = 0;
<del>let done = 0;
<ide>
<del>Object.keys(tests).forEach(function(file) {
<add>const testKeys = Object.keys(tests);
<add>testKeys.forEach(common.mustCall((file) => {
<ide> const test = tests[file];
<del> chunkSize.forEach(function(chunkSize) {
<del> trickle.forEach(function(trickle) {
<del> windowBits.forEach(function(windowBits) {
<del> level.forEach(function(level) {
<del> memLevel.forEach(function(memLevel) {
<del> strategy.forEach(function(strategy) {
<del> zlibPairs.forEach(function(pair) {
<add> chunkSize.forEach(common.mustCall((chunkSize) => {
<add> trickle.forEach(common.mustCall((trickle) => {
<add> windowBits.forEach(common.mustCall((windowBits) => {
<add> level.forEach(common.mustCall((level) => {
<add> memLevel.forEach(common.mustCall((memLevel) => {
<add> strategy.forEach(common.mustCall((strategy) => {
<add> zlibPairs.forEach(common.mustCall((pair) => {
<ide> const Def = pair[0];
<ide> const Inf = pair[1];
<ide> const opts = { level: level,
<ide> windowBits: windowBits,
<ide> memLevel: memLevel,
<ide> strategy: strategy };
<ide>
<del> total++;
<del>
<ide> const def = new Def(opts);
<ide> const inf = new Inf(opts);
<ide> const ss = new SlowStream(trickle);
<ide> const buf = new BufferStream();
<ide>
<ide> // verify that the same exact buffer comes out the other end.
<del> buf.on('data', function(c) {
<add> buf.on('data', common.mustCall((c) => {
<ide> const msg = `${file} ${chunkSize} ${
<ide> JSON.stringify(opts)} ${Def.name} -> ${Inf.name}`;
<del> let ok = true;
<del> const testNum = ++done;
<ide> let i;
<ide> for (i = 0; i < Math.max(c.length, test.length); i++) {
<ide> if (c[i] !== test[i]) {
<del> ok = false;
<del> failures++;
<add> assert.fail(msg);
<ide> break;
<ide> }
<ide> }
<del> if (ok) {
<del> console.log(`ok ${testNum} ${msg}`);
<del> } else {
<del> console.log(`not ok ${testNum} msg`);
<del> console.log(' ...');
<del> console.log(` testfile: ${file}`);
<del> console.log(` type: ${Def.name} -> ${Inf.name}`);
<del> console.log(` position: ${i}`);
<del> console.log(` options: ${JSON.stringify(opts)}`);
<del> console.log(` expect: ${test[i]}`);
<del> console.log(` actual: ${c[i]}`);
<del> console.log(` chunkSize: ${chunkSize}`);
<del> console.log(' ---');
<del> }
<del> });
<add> }));
<ide>
<ide> // the magic happens here.
<ide> ss.pipe(def).pipe(inf).pipe(buf);
<ide> ss.end(test);
<del> });
<del> });
<del> });
<del> });
<del> });
<del> });
<del> });
<del>});
<del>
<del>process.on('exit', function(code) {
<del> console.log(`1..${done}`);
<del> assert.strictEqual(done, total, `${total - done} tests left unfinished`);
<del> assert.strictEqual(failures, 0, 'some test failures');
<del>});
<add> }, zlibPairs.length));
<add> }, strategy.length));
<add> }, memLevel.length));
<add> }, level.length));
<add> }, windowBits.length));
<add> }, trickle.length));
<add> }, chunkSize.length));
<add>}, testKeys.length)); | 8 |
Text | Text | add docker daemon unavailable note | 83c1fd6f53d1b061fd71057210a6e317fcd56359 | <ide><path>docs/faq.md
<ide> dropped. To correct this problem, change the service's configuration on your
<ide> localhost so that the service accepts requests from all IPs. If you aren't sure
<ide> how to do this, check the documentation for your OS.
<ide>
<add>### Why do I get `Cannot connect to the Docker daemon. Is the docker daemon running on this host?` when using docker-machine?
<add>
<add>This error points out that the docker client cannot connect to the virtual machine.
<add>This means that either the virtual machine that works underneath `docker-machine`
<add>is not running or that the client doesn't correctly point at it.
<add>
<add>To verify that the docker machine is running you can use the `docker-machine ls`
<add>command and start it with `docker-machine start` if needed.
<add>
<add> $ docker-machine ls
<add> NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS
<add> default - virtualbox Stopped Unknown
<add>
<add> $ docker-machine start default
<add>
<add>You have to tell Docker to talk to that machine. You can do this with the
<add>`docker-machine env` command. For example,
<add>
<add> $ eval "$(docker-machine env default)"
<add> $ docker ps
<ide>
<ide> ### Where can I find more answers?
<ide> | 1 |
PHP | PHP | add assertion for float value | e39e85e3fc441e60bfe8f71d7a30794e9f053481 | <ide><path>tests/TestCase/Validation/ValidationTest.php
<ide> public function testIsInteger()
<ide> $this->assertTrue(Validation::isInteger('-012'));
<ide>
<ide> $this->assertFalse(Validation::isInteger('2.5'));
<add> $this->assertFalse(Validation::isInteger(2.5));
<ide> $this->assertFalse(Validation::isInteger([]));
<ide> $this->assertFalse(Validation::isInteger(new \StdClass));
<ide> $this->assertFalse(Validation::isInteger('2 bears')); | 1 |
PHP | PHP | add jobqueued event | 8eaec037421aa9f3860da9d339986448b4c884eb | <ide><path>src/Illuminate/Queue/Events/JobQueued.php
<add><?php
<add>
<add>namespace Illuminate\Queue\Events;
<add>
<add>class JobQueued
<add>{
<add> /**
<add> * @var string|int|null
<add> */
<add> public $jobId;
<add>
<add> /**
<add> * @var string|object
<add> */
<add> public $job;
<add>
<add> /**
<add> * JobQueued constructor.
<add> *
<add> * @param string|int|null $jobId
<add> * @param \Closure|string|object $job
<add> * @return void
<add> */
<add> public function __construct($jobId, $job)
<add> {
<add> $this->jobId = $jobId;
<add> $this->job = $job;
<add> }
<add>}
<ide><path>src/Illuminate/Queue/Queue.php
<ide> use Illuminate\Container\Container;
<ide> use Illuminate\Contracts\Encryption\Encrypter;
<ide> use Illuminate\Contracts\Queue\ShouldBeEncrypted;
<add>use Illuminate\Queue\Events\JobQueued;
<ide> use Illuminate\Support\Arr;
<ide> use Illuminate\Support\InteractsWithTime;
<ide> use Illuminate\Support\Str;
<ide> protected function enqueueUsing($job, $payload, $queue, $delay, $callback)
<ide> if ($this->shouldDispatchAfterCommit($job) &&
<ide> $this->container->bound('db.transactions')) {
<ide> return $this->container->make('db.transactions')->addCallback(
<del> function () use ($payload, $queue, $delay, $callback) {
<del> return $callback($payload, $queue, $delay);
<add> function () use ($payload, $queue, $delay, $callback, $job) {
<add> return tap($callback($payload, $queue, $delay), function ($jobId) use ($job) {
<add> $this->raiseJobQueuedEvent($jobId, $job);
<add> });
<ide> }
<ide> );
<ide> }
<ide>
<del> return $callback($payload, $queue, $delay);
<add> return tap($callback($payload, $queue, $delay), function ($jobId) use ($job) {
<add> $this->raiseJobQueuedEvent($jobId, $job);
<add> });
<ide> }
<ide>
<ide> /**
<ide> public function setContainer(Container $container)
<ide> {
<ide> $this->container = $container;
<ide> }
<add>
<add> /**
<add> * Raise the job queued event.
<add> *
<add> * @param string|int|null $jobId
<add> * @param \Closure|string|object $job
<add> * @return void
<add> */
<add> protected function raiseJobQueuedEvent($jobId, $job)
<add> {
<add> if ($this->container->bound('events')) {
<add> $this->container['events']->dispatch(new JobQueued($jobId, $job));
<add> }
<add> }
<ide> }
<ide><path>tests/Queue/QueueBeanstalkdQueueTest.php
<ide>
<ide> class QueueBeanstalkdQueueTest extends TestCase
<ide> {
<add> /**
<add> * @var BeanstalkdQueue
<add> */
<add> private $queue;
<add>
<add> /**
<add> * @var Container|m\LegacyMockInterface|m\MockInterface
<add> */
<add> private $container;
<add>
<ide> protected function tearDown(): void
<ide> {
<ide> m::close();
<ide> public function testPushProperlyPushesJobOntoBeanstalkd()
<ide> return $uuid;
<ide> });
<ide>
<del> $queue = new BeanstalkdQueue(m::mock(Pheanstalk::class), 'default', 60);
<del> $pheanstalk = $queue->getPheanstalk();
<add> $this->setQueue('default', 60);
<add> $pheanstalk = $this->queue->getPheanstalk();
<ide> $pheanstalk->shouldReceive('useTube')->once()->with('stack')->andReturn($pheanstalk);
<ide> $pheanstalk->shouldReceive('useTube')->once()->with('default')->andReturn($pheanstalk);
<ide> $pheanstalk->shouldReceive('put')->twice()->with(json_encode(['uuid' => $uuid, 'displayName' => 'foo', 'job' => 'foo', 'maxTries' => null, 'maxExceptions' => null, 'backoff' => null, 'timeout' => null, 'data' => ['data']]), 1024, 0, 60);
<ide>
<del> $queue->push('foo', ['data'], 'stack');
<del> $queue->push('foo', ['data']);
<add> $this->queue->push('foo', ['data'], 'stack');
<add> $this->queue->push('foo', ['data']);
<add>
<add> $this->container->shouldHaveReceived('bound')->with('events')->times(2);
<ide>
<ide> Str::createUuidsNormally();
<ide> }
<ide> public function testDelayedPushProperlyPushesJobOntoBeanstalkd()
<ide> return $uuid;
<ide> });
<ide>
<del> $queue = new BeanstalkdQueue(m::mock(Pheanstalk::class), 'default', 60);
<del> $pheanstalk = $queue->getPheanstalk();
<add> $this->setQueue('default', 60);
<add> $pheanstalk = $this->queue->getPheanstalk();
<ide> $pheanstalk->shouldReceive('useTube')->once()->with('stack')->andReturn($pheanstalk);
<ide> $pheanstalk->shouldReceive('useTube')->once()->with('default')->andReturn($pheanstalk);
<ide> $pheanstalk->shouldReceive('put')->twice()->with(json_encode(['uuid' => $uuid, 'displayName' => 'foo', 'job' => 'foo', 'maxTries' => null, 'maxExceptions' => null, 'backoff' => null, 'timeout' => null, 'data' => ['data']]), Pheanstalk::DEFAULT_PRIORITY, 5, Pheanstalk::DEFAULT_TTR);
<ide>
<del> $queue->later(5, 'foo', ['data'], 'stack');
<del> $queue->later(5, 'foo', ['data']);
<add> $this->queue->later(5, 'foo', ['data'], 'stack');
<add> $this->queue->later(5, 'foo', ['data']);
<add>
<add> $this->container->shouldHaveReceived('bound')->with('events')->times(2);
<ide>
<ide> Str::createUuidsNormally();
<ide> }
<ide>
<ide> public function testPopProperlyPopsJobOffOfBeanstalkd()
<ide> {
<del> $queue = new BeanstalkdQueue(m::mock(Pheanstalk::class), 'default', 60);
<del> $queue->setContainer(m::mock(Container::class));
<del> $pheanstalk = $queue->getPheanstalk();
<add> $this->setQueue('default', 60);
<add>
<add> $pheanstalk = $this->queue->getPheanstalk();
<ide> $pheanstalk->shouldReceive('watchOnly')->once()->with('default')->andReturn($pheanstalk);
<ide> $job = m::mock(Job::class);
<ide> $pheanstalk->shouldReceive('reserveWithTimeout')->once()->with(0)->andReturn($job);
<ide>
<del> $result = $queue->pop();
<add> $result = $this->queue->pop();
<ide>
<ide> $this->assertInstanceOf(BeanstalkdJob::class, $result);
<ide> }
<ide>
<ide> public function testBlockingPopProperlyPopsJobOffOfBeanstalkd()
<ide> {
<del> $queue = new BeanstalkdQueue(m::mock(Pheanstalk::class), 'default', 60, 60);
<del> $queue->setContainer(m::mock(Container::class));
<del> $pheanstalk = $queue->getPheanstalk();
<add> $this->setQueue('default', 60, 60);
<add>
<add> $pheanstalk = $this->queue->getPheanstalk();
<ide> $pheanstalk->shouldReceive('watchOnly')->once()->with('default')->andReturn($pheanstalk);
<ide> $job = m::mock(Job::class);
<ide> $pheanstalk->shouldReceive('reserveWithTimeout')->once()->with(60)->andReturn($job);
<ide>
<del> $result = $queue->pop();
<add> $result = $this->queue->pop();
<ide>
<ide> $this->assertInstanceOf(BeanstalkdJob::class, $result);
<ide> }
<ide>
<ide> public function testDeleteProperlyRemoveJobsOffBeanstalkd()
<ide> {
<del> $queue = new BeanstalkdQueue(m::mock(Pheanstalk::class), 'default', 60);
<del> $pheanstalk = $queue->getPheanstalk();
<add> $this->setQueue('default', 60);
<add>
<add> $pheanstalk = $this->queue->getPheanstalk();
<ide> $pheanstalk->shouldReceive('useTube')->once()->with('default')->andReturn($pheanstalk);
<ide> $pheanstalk->shouldReceive('delete')->once()->with(m::type(Job::class));
<ide>
<del> $queue->deleteMessage('default', 1);
<add> $this->queue->deleteMessage('default', 1);
<add> }
<add>
<add> /**
<add> * @param string $default
<add> * @param int $timeToRun
<add> * @param int $blockFor
<add> */
<add> private function setQueue($default, $timeToRun, $blockFor = 0)
<add> {
<add> $this->queue = new BeanstalkdQueue(m::mock(Pheanstalk::class), $default, $timeToRun, $blockFor);
<add> $this->container = m::spy(Container::class);
<add> $this->queue->setContainer($this->container);
<ide> }
<ide> }
<ide><path>tests/Queue/QueueDatabaseQueueUnitTest.php
<ide>
<ide> namespace Illuminate\Tests\Queue;
<ide>
<add>use Illuminate\Container\Container;
<ide> use Illuminate\Database\Connection;
<ide> use Illuminate\Queue\DatabaseQueue;
<ide> use Illuminate\Queue\Queue;
<ide> public function testPushProperlyPushesJobOntoDatabase()
<ide>
<ide> $queue = $this->getMockBuilder(DatabaseQueue::class)->onlyMethods(['currentTime'])->setConstructorArgs([$database = m::mock(Connection::class), 'table', 'default'])->getMock();
<ide> $queue->expects($this->any())->method('currentTime')->willReturn('time');
<add> $queue->setContainer($container = m::spy(Container::class));
<ide> $database->shouldReceive('table')->with('table')->andReturn($query = m::mock(stdClass::class));
<ide> $query->shouldReceive('insertGetId')->once()->andReturnUsing(function ($array) use ($uuid) {
<ide> $this->assertSame('default', $array['queue']);
<ide> public function testPushProperlyPushesJobOntoDatabase()
<ide>
<ide> $queue->push('foo', ['data']);
<ide>
<add> $container->shouldHaveReceived('bound')->with('events')->once();
<add>
<ide> Str::createUuidsNormally();
<ide> }
<ide>
<ide> public function testDelayedPushProperlyPushesJobOntoDatabase()
<ide> [$database = m::mock(Connection::class), 'table', 'default']
<ide> )->getMock();
<ide> $queue->expects($this->any())->method('currentTime')->willReturn('time');
<add> $queue->setContainer($container = m::spy(Container::class));
<ide> $database->shouldReceive('table')->with('table')->andReturn($query = m::mock(stdClass::class));
<ide> $query->shouldReceive('insertGetId')->once()->andReturnUsing(function ($array) use ($uuid) {
<ide> $this->assertSame('default', $array['queue']);
<ide> public function testDelayedPushProperlyPushesJobOntoDatabase()
<ide>
<ide> $queue->later(10, 'foo', ['data']);
<ide>
<add> $container->shouldHaveReceived('bound')->with('events')->once();
<add>
<ide> Str::createUuidsNormally();
<ide> }
<ide>
<ide><path>tests/Queue/QueueRedisQueueTest.php
<ide>
<ide> namespace Illuminate\Tests\Queue;
<ide>
<add>use Illuminate\Container\Container;
<ide> use Illuminate\Contracts\Redis\Factory;
<ide> use Illuminate\Queue\LuaScripts;
<ide> use Illuminate\Queue\Queue;
<ide> public function testPushProperlyPushesJobOntoRedis()
<ide>
<ide> $queue = $this->getMockBuilder(RedisQueue::class)->onlyMethods(['getRandomId'])->setConstructorArgs([$redis = m::mock(Factory::class), 'default'])->getMock();
<ide> $queue->expects($this->once())->method('getRandomId')->willReturn('foo');
<add> $queue->setContainer($container = m::spy(Container::class));
<ide> $redis->shouldReceive('connection')->once()->andReturn($redis);
<ide> $redis->shouldReceive('eval')->once()->with(LuaScripts::push(), 2, 'queues:default', 'queues:default:notify', json_encode(['uuid' => $uuid, 'displayName' => 'foo', 'job' => 'foo', 'maxTries' => null, 'maxExceptions' => null, 'backoff' => null, 'timeout' => null, 'data' => ['data'], 'id' => 'foo', 'attempts' => 0]));
<ide>
<ide> $id = $queue->push('foo', ['data']);
<ide> $this->assertSame('foo', $id);
<add> $container->shouldHaveReceived('bound')->with('events')->once();
<ide>
<ide> Str::createUuidsNormally();
<ide> }
<ide> public function testPushProperlyPushesJobOntoRedisWithCustomPayloadHook()
<ide>
<ide> $queue = $this->getMockBuilder(RedisQueue::class)->onlyMethods(['getRandomId'])->setConstructorArgs([$redis = m::mock(Factory::class), 'default'])->getMock();
<ide> $queue->expects($this->once())->method('getRandomId')->willReturn('foo');
<add> $queue->setContainer($container = m::spy(Container::class));
<ide> $redis->shouldReceive('connection')->once()->andReturn($redis);
<ide> $redis->shouldReceive('eval')->once()->with(LuaScripts::push(), 2, 'queues:default', 'queues:default:notify', json_encode(['uuid' => $uuid, 'displayName' => 'foo', 'job' => 'foo', 'maxTries' => null, 'maxExceptions' => null, 'backoff' => null, 'timeout' => null, 'data' => ['data'], 'custom' => 'taylor', 'id' => 'foo', 'attempts' => 0]));
<ide>
<ide> public function testPushProperlyPushesJobOntoRedisWithCustomPayloadHook()
<ide>
<ide> $id = $queue->push('foo', ['data']);
<ide> $this->assertSame('foo', $id);
<add> $container->shouldHaveReceived('bound')->with('events')->once();
<ide>
<ide> Queue::createPayloadUsing(null);
<ide>
<ide> public function testPushProperlyPushesJobOntoRedisWithTwoCustomPayloadHook()
<ide>
<ide> $queue = $this->getMockBuilder(RedisQueue::class)->onlyMethods(['getRandomId'])->setConstructorArgs([$redis = m::mock(Factory::class), 'default'])->getMock();
<ide> $queue->expects($this->once())->method('getRandomId')->willReturn('foo');
<add> $queue->setContainer($container = m::spy(Container::class));
<ide> $redis->shouldReceive('connection')->once()->andReturn($redis);
<ide> $redis->shouldReceive('eval')->once()->with(LuaScripts::push(), 2, 'queues:default', 'queues:default:notify', json_encode(['uuid' => $uuid, 'displayName' => 'foo', 'job' => 'foo', 'maxTries' => null, 'maxExceptions' => null, 'backoff' => null, 'timeout' => null, 'data' => ['data'], 'custom' => 'taylor', 'bar' => 'foo', 'id' => 'foo', 'attempts' => 0]));
<ide>
<ide> public function testPushProperlyPushesJobOntoRedisWithTwoCustomPayloadHook()
<ide>
<ide> $id = $queue->push('foo', ['data']);
<ide> $this->assertSame('foo', $id);
<add> $container->shouldHaveReceived('bound')->with('events')->once();
<ide>
<ide> Queue::createPayloadUsing(null);
<ide>
<ide> public function testDelayedPushProperlyPushesJobOntoRedis()
<ide> });
<ide>
<ide> $queue = $this->getMockBuilder(RedisQueue::class)->onlyMethods(['availableAt', 'getRandomId'])->setConstructorArgs([$redis = m::mock(Factory::class), 'default'])->getMock();
<add> $queue->setContainer($container = m::spy(Container::class));
<ide> $queue->expects($this->once())->method('getRandomId')->willReturn('foo');
<ide> $queue->expects($this->once())->method('availableAt')->with(1)->willReturn(2);
<ide>
<ide> public function testDelayedPushProperlyPushesJobOntoRedis()
<ide>
<ide> $id = $queue->later(1, 'foo', ['data']);
<ide> $this->assertSame('foo', $id);
<add> $container->shouldHaveReceived('bound')->with('events')->once();
<ide>
<ide> Str::createUuidsNormally();
<ide> }
<ide> public function testDelayedPushWithDateTimeProperlyPushesJobOntoRedis()
<ide>
<ide> $date = Carbon::now();
<ide> $queue = $this->getMockBuilder(RedisQueue::class)->onlyMethods(['availableAt', 'getRandomId'])->setConstructorArgs([$redis = m::mock(Factory::class), 'default'])->getMock();
<add> $queue->setContainer($container = m::spy(Container::class));
<ide> $queue->expects($this->once())->method('getRandomId')->willReturn('foo');
<ide> $queue->expects($this->once())->method('availableAt')->with($date)->willReturn(2);
<ide>
<ide> public function testDelayedPushWithDateTimeProperlyPushesJobOntoRedis()
<ide> );
<ide>
<ide> $queue->later($date, 'foo', ['data']);
<add> $container->shouldHaveReceived('bound')->with('events')->once();
<ide>
<ide> Str::createUuidsNormally();
<ide> }
<ide><path>tests/Queue/QueueSqsQueueTest.php
<ide> public function testDelayedPushWithDateTimeProperlyPushesJobOntoSqs()
<ide> {
<ide> $now = Carbon::now();
<ide> $queue = $this->getMockBuilder(SqsQueue::class)->onlyMethods(['createPayload', 'secondsUntil', 'getQueue'])->setConstructorArgs([$this->sqs, $this->queueName, $this->account])->getMock();
<add> $queue->setContainer($container = m::spy(Container::class));
<ide> $queue->expects($this->once())->method('createPayload')->with($this->mockedJob, $this->queueName, $this->mockedData)->willReturn($this->mockedPayload);
<ide> $queue->expects($this->once())->method('secondsUntil')->with($now)->willReturn(5);
<ide> $queue->expects($this->once())->method('getQueue')->with($this->queueName)->willReturn($this->queueUrl);
<ide> $this->sqs->shouldReceive('sendMessage')->once()->with(['QueueUrl' => $this->queueUrl, 'MessageBody' => $this->mockedPayload, 'DelaySeconds' => 5])->andReturn($this->mockedSendMessageResponseModel);
<ide> $id = $queue->later($now->addSeconds(5), $this->mockedJob, $this->mockedData, $this->queueName);
<ide> $this->assertEquals($this->mockedMessageId, $id);
<add> $container->shouldHaveReceived('bound')->with('events')->once();
<ide> }
<ide>
<ide> public function testDelayedPushProperlyPushesJobOntoSqs()
<ide> {
<ide> $queue = $this->getMockBuilder(SqsQueue::class)->onlyMethods(['createPayload', 'secondsUntil', 'getQueue'])->setConstructorArgs([$this->sqs, $this->queueName, $this->account])->getMock();
<add> $queue->setContainer($container = m::spy(Container::class));
<ide> $queue->expects($this->once())->method('createPayload')->with($this->mockedJob, $this->queueName, $this->mockedData)->willReturn($this->mockedPayload);
<ide> $queue->expects($this->once())->method('secondsUntil')->with($this->mockedDelay)->willReturn($this->mockedDelay);
<ide> $queue->expects($this->once())->method('getQueue')->with($this->queueName)->willReturn($this->queueUrl);
<ide> $this->sqs->shouldReceive('sendMessage')->once()->with(['QueueUrl' => $this->queueUrl, 'MessageBody' => $this->mockedPayload, 'DelaySeconds' => $this->mockedDelay])->andReturn($this->mockedSendMessageResponseModel);
<ide> $id = $queue->later($this->mockedDelay, $this->mockedJob, $this->mockedData, $this->queueName);
<ide> $this->assertEquals($this->mockedMessageId, $id);
<add> $container->shouldHaveReceived('bound')->with('events')->once();
<ide> }
<ide>
<ide> public function testPushProperlyPushesJobOntoSqs()
<ide> {
<ide> $queue = $this->getMockBuilder(SqsQueue::class)->onlyMethods(['createPayload', 'getQueue'])->setConstructorArgs([$this->sqs, $this->queueName, $this->account])->getMock();
<add> $queue->setContainer($container = m::spy(Container::class));
<ide> $queue->expects($this->once())->method('createPayload')->with($this->mockedJob, $this->queueName, $this->mockedData)->willReturn($this->mockedPayload);
<ide> $queue->expects($this->once())->method('getQueue')->with($this->queueName)->willReturn($this->queueUrl);
<ide> $this->sqs->shouldReceive('sendMessage')->once()->with(['QueueUrl' => $this->queueUrl, 'MessageBody' => $this->mockedPayload])->andReturn($this->mockedSendMessageResponseModel);
<ide> $id = $queue->push($this->mockedJob, $this->mockedData, $this->queueName);
<ide> $this->assertEquals($this->mockedMessageId, $id);
<add> $container->shouldHaveReceived('bound')->with('events')->once();
<ide> }
<ide>
<ide> public function testSizeProperlyReadsSqsQueueSize()
<ide><path>tests/Queue/RedisQueueIntegrationTest.php
<ide> namespace Illuminate\Tests\Queue;
<ide>
<ide> use Illuminate\Container\Container;
<add>use Illuminate\Contracts\Events\Dispatcher;
<ide> use Illuminate\Foundation\Testing\Concerns\InteractsWithRedis;
<add>use Illuminate\Queue\Events\JobQueued;
<ide> use Illuminate\Queue\Jobs\RedisJob;
<ide> use Illuminate\Queue\RedisQueue;
<ide> use Illuminate\Support\Carbon;
<ide> class RedisQueueIntegrationTest extends TestCase
<ide> */
<ide> private $queue;
<ide>
<add> /**
<add> * @var \Mockery\MockInterface|\Mockery\LegacyMockInterface
<add> */
<add> private $container;
<add>
<ide> protected function setUp(): void
<ide> {
<ide> Carbon::setTestNow(Carbon::now());
<ide> public function testExpiredJobsArePopped($driver)
<ide> $this->queue->later(-300, $jobs[2]);
<ide> $this->queue->later(-100, $jobs[3]);
<ide>
<add> $this->container->shouldHaveReceived('bound')->with('events')->times(4);
<add>
<ide> $this->assertEquals($jobs[2], unserialize(json_decode($this->queue->pop()->getRawBody())->data->command));
<ide> $this->assertEquals($jobs[1], unserialize(json_decode($this->queue->pop()->getRawBody())->data->command));
<ide> $this->assertEquals($jobs[3], unserialize(json_decode($this->queue->pop()->getRawBody())->data->command));
<ide> public function testPopProperlyPopsDelayedJobOffOfRedis($driver)
<ide> */
<ide> public function testPopPopsDelayedJobOffOfRedisWhenExpireNull($driver)
<ide> {
<del> $this->queue = new RedisQueue($this->redis[$driver], 'default', null, null);
<del> $this->queue->setContainer(m::mock(Container::class));
<add> $this->setQueue($driver, 'default', null, null);
<ide>
<ide> // Push an item into queue
<ide> $job = new RedisQueueIntegrationTestJob(10);
<ide> $this->queue->later(-10, $job);
<ide>
<add> $this->container->shouldHaveReceived('bound')->with('events')->once();
<add>
<ide> // Pop and check it is popped correctly
<ide> $before = $this->currentTime();
<ide> $this->assertEquals($job, unserialize(json_decode($this->queue->pop()->getRawBody())->data->command));
<ide> public function testBlockingPopProperlyPopsExpiredJobs($driver)
<ide> */
<ide> public function testNotExpireJobsWhenExpireNull($driver)
<ide> {
<del> $this->queue = new RedisQueue($this->redis[$driver], 'default', null, null);
<del> $this->queue->setContainer(m::mock(Container::class));
<add> $this->setQueue($driver, 'default', null, null);
<ide>
<ide> // Make an expired reserved job
<ide> $failed = new RedisQueueIntegrationTestJob(-20);
<ide> $this->queue->push($failed);
<add> $this->container->shouldHaveReceived('bound')->with('events')->once();
<add>
<ide> $beforeFailPop = $this->currentTime();
<ide> $this->queue->pop();
<ide> $afterFailPop = $this->currentTime();
<ide>
<ide> // Push an item into queue
<ide> $job = new RedisQueueIntegrationTestJob(10);
<ide> $this->queue->push($job);
<add> $this->container->shouldHaveReceived('bound')->with('events')->times(2);
<ide>
<ide> // Pop and check it is popped correctly
<ide> $before = $this->currentTime();
<ide> public function testNotExpireJobsWhenExpireNull($driver)
<ide> */
<ide> public function testExpireJobsWhenExpireSet($driver)
<ide> {
<del> $this->queue = new RedisQueue($this->redis[$driver], 'default', null, 30);
<del> $this->queue->setContainer(m::mock(Container::class));
<add> $this->setQueue($driver, 'default', null, 30);
<ide>
<ide> // Push an item into queue
<ide> $job = new RedisQueueIntegrationTestJob(10);
<ide> $this->queue->push($job);
<add> $this->container->shouldHaveReceived('bound')->with('events')->once();
<ide>
<ide> // Pop and check it is popped correctly
<ide> $before = $this->currentTime();
<ide> public function testSize($driver)
<ide> $this->assertEquals(2, $this->queue->size());
<ide> }
<ide>
<add> /**
<add> * @dataProvider redisDriverProvider
<add> *
<add> * @param string $driver
<add> */
<add> public function testPushJobQueuedEvent($driver)
<add> {
<add> $events = m::mock(Dispatcher::class);
<add> $events->shouldReceive('dispatch')->withArgs(function (JobQueued $jobQueued) {
<add> $this->assertInstanceOf(RedisQueueIntegrationTestJob::class, $jobQueued->job);
<add> $this->assertIsString(RedisQueueIntegrationTestJob::class, $jobQueued->jobId);
<add>
<add> return true;
<add> })->andReturnNull()->once();
<add>
<add> $container = m::mock(Container::class);
<add> $container->shouldReceive('bound')->with('events')->andReturn(true)->once();
<add> $container->shouldReceive('offsetGet')->with('events')->andReturn($events)->once();
<add>
<add> $queue = new RedisQueue($this->redis[$driver]);
<add> $queue->setContainer($container);
<add>
<add> $queue->push(new RedisQueueIntegrationTestJob(5));
<add> }
<add>
<add> /**
<add> * @dataProvider redisDriverProvider
<add> *
<add> * @param string $driver
<add> */
<add> public function testBulkJobQueuedEvent($driver)
<add> {
<add> $events = m::mock(Dispatcher::class);
<add> $events->shouldReceive('dispatch')->with(m::type(JobQueued::class))->andReturnNull()->times(3);
<add>
<add> $container = m::mock(Container::class);
<add> $container->shouldReceive('bound')->with('events')->andReturn(true)->times(3);
<add> $container->shouldReceive('offsetGet')->with('events')->andReturn($events)->times(3);
<add>
<add> $queue = new RedisQueue($this->redis[$driver]);
<add> $queue->setContainer($container);
<add>
<add> $queue->bulk([
<add> new RedisQueueIntegrationTestJob(5),
<add> new RedisQueueIntegrationTestJob(10),
<add> new RedisQueueIntegrationTestJob(15),
<add> ]);
<add> }
<add>
<ide> /**
<ide> * @param string $driver
<ide> * @param string $default
<del> * @param string $connection
<add> * @param string|null $connection
<ide> * @param int $retryAfter
<ide> * @param int|null $blockFor
<ide> */
<ide> private function setQueue($driver, $default = 'default', $connection = null, $retryAfter = 60, $blockFor = null)
<ide> {
<ide> $this->queue = new RedisQueue($this->redis[$driver], $default, $connection, $retryAfter, $blockFor);
<del> $this->queue->setContainer(m::mock(Container::class));
<add> $this->container = m::spy(Container::class);
<add> $this->queue->setContainer($this->container);
<ide> }
<ide> }
<ide> | 7 |
Javascript | Javascript | remove unused `var self = this` from old code | e6bfe044ff78d85541e4b85a3f1890e11d2e25c9 | <ide><path>lib/net.js
<ide> function writeAfterFIN(chunk, encoding, cb) {
<ide>
<ide> var er = new Error('This socket has been ended by the other party');
<ide> er.code = 'EPIPE';
<del> var self = this;
<ide> // TODO: defer error events consistently everywhere, not just the cb
<del> self.emit('error', er);
<add> this.emit('error', er);
<ide> if (typeof cb === 'function') {
<ide> process.nextTick(cb, er);
<ide> } | 1 |
Javascript | Javascript | use validatestring in modules/cjs | 4dc10ac7d7ddd2cc52e84d1394f7e863d576109f | <ide><path>lib/internal/modules/cjs/helpers.js
<ide> 'use strict';
<ide>
<del>const { ERR_INVALID_ARG_TYPE } = require('internal/errors').codes;
<add>const { validateString } = require('internal/validators');
<ide>
<ide> const {
<ide> CHAR_LINE_FEED,
<ide> function makeRequireFunction(mod) {
<ide> }
<ide>
<ide> function resolve(request, options) {
<del> if (typeof request !== 'string') {
<del> throw new ERR_INVALID_ARG_TYPE('request', 'string', request);
<del> }
<add> validateString(request, 'request');
<ide> return Module._resolveFilename(request, mod, false, options);
<ide> }
<ide>
<ide> require.resolve = resolve;
<ide>
<ide> function paths(request) {
<del> if (typeof request !== 'string') {
<del> throw new ERR_INVALID_ARG_TYPE('request', 'string', request);
<del> }
<add> validateString(request, 'request');
<ide> return Module._resolveLookupPaths(request, mod, true);
<ide> }
<ide>
<ide><path>lib/internal/modules/cjs/loader.js
<ide> const preserveSymlinksMain = getOptionValue('--preserve-symlinks-main');
<ide> const experimentalModules = getOptionValue('--experimental-modules');
<ide>
<ide> const {
<del> ERR_INVALID_ARG_TYPE,
<ide> ERR_INVALID_ARG_VALUE,
<ide> ERR_REQUIRE_ESM
<ide> } = require('internal/errors').codes;
<add>const { validateString } = require('internal/validators');
<ide>
<ide> module.exports = Module;
<ide>
<ide> Module.prototype.load = function(filename) {
<ide> // Loads a module at the given file path. Returns that module's
<ide> // `exports` property.
<ide> Module.prototype.require = function(id) {
<del> if (typeof id !== 'string') {
<del> throw new ERR_INVALID_ARG_TYPE('id', 'string', id);
<del> }
<add> validateString(id, 'id');
<ide> if (id === '') {
<ide> throw new ERR_INVALID_ARG_VALUE('id', id,
<ide> 'must be a non-empty string'); | 2 |
Javascript | Javascript | remove unneeded copy function | 9d018e0a463178fa28ac3043d666383c2493a788 | <ide><path>examples/js/lines/LineMaterial.js
<ide> THREE.LineMaterial.prototype.constructor = THREE.LineMaterial;
<ide>
<ide> THREE.LineMaterial.prototype.isLineMaterial = true;
<ide>
<del>THREE.LineMaterial.prototype.copy = function ( source ) {
<del>
<del> THREE.ShaderMaterial.prototype.copy.call( this, source );
<del>
<del> this.color.copy( source.color );
<del>
<del> this.linewidth = source.linewidth;
<del>
<del> this.dashScale = source.dashScale;
<del>
<del> this.dashSize = source.dashSize;
<del>
<del> this.gapSize = source.gapSize;
<del>
<del> this.resolution = source.resolution;
<del>
<del> return this;
<del>
<del>};
<del>
<ide><path>examples/jsm/lines/LineMaterial.js
<ide> LineMaterial.prototype.constructor = LineMaterial;
<ide>
<ide> LineMaterial.prototype.isLineMaterial = true;
<ide>
<del>LineMaterial.prototype.copy = function ( source ) {
<del>
<del> ShaderMaterial.prototype.copy.call( this, source );
<del>
<del> this.color.copy( source.color );
<del>
<del> this.linewidth = source.linewidth;
<del>
<del> this.dashScale = source.dashScale;
<del>
<del> this.dashSize = source.dashSize;
<del>
<del> this.gapSize = source.gapSize;
<del>
<del> this.resolution = source.resolution;
<del>
<del> return this;
<del>
<del>};
<del>
<ide>
<ide> export { LineMaterial }; | 2 |
Text | Text | fix math error in process.md | c5a0dcedd3eb0c4b1d8cead36a0a7d735d6f3f3e | <ide><path>doc/api/process.md
<ide> setTimeout(() => {
<ide> // [ 1, 552 ]
<ide>
<ide> console.log(`Benchmark took ${diff[0] * NS_PER_SEC + diff[1]} nanoseconds`);
<del> // benchmark took 1000000527 nanoseconds
<add> // benchmark took 1000000552 nanoseconds
<ide> }, 1000);
<ide> ```
<ide> | 1 |
Ruby | Ruby | pass the tab to formulainstaller | 1bc631369494433714c5174dcd51511078377980 | <ide><path>Library/Homebrew/cmd/upgrade.rb
<ide> def upgrade
<ide> end
<ide>
<ide> def upgrade_formula f
<add> tab = Tab.for_formula(f)
<ide> outdated_keg = Keg.new(f.linked_keg.realpath) rescue nil
<ide>
<del> installer = FormulaInstaller.new f
<add> installer = FormulaInstaller.new(f, tab)
<ide> installer.show_header = false
<ide>
<ide> oh1 "Upgrading #{f.name}"
<ide><path>Library/Homebrew/formula_installer.rb
<ide>
<ide> class FormulaInstaller
<ide> attr :f
<add> attr :tab
<ide> attr :show_summary_heading, true
<ide> attr :ignore_deps, true
<ide> attr :install_bottle, true
<ide> attr :show_header, true
<ide>
<del> def initialize ff
<add> def initialize ff, tab=nil
<ide> @f = ff
<add> @tab = tab
<ide> @show_header = true
<ide> @ignore_deps = ARGV.include? '--ignore-dependencies' || ARGV.interactive?
<ide> @install_bottle = install_bottle? ff
<ide> def install
<ide> end
<ide>
<ide> def install_dependency dep
<add> dep_tab = Tab.for_formula(dep)
<ide> outdated_keg = Keg.new(dep.linked_keg.realpath) rescue nil
<ide>
<del> fi = FormulaInstaller.new dep
<add> fi = FormulaInstaller.new(dep, dep_tab)
<ide> fi.ignore_deps = true
<ide> fi.show_header = false
<ide> oh1 "Installing #{f} dependency: #{dep}"
<ide> def build
<ide>
<ide> args = ARGV.clone
<ide> unless args.include? '--fresh'
<del> previous_install = Tab.for_formula f
<del> args.concat previous_install.used_options
<add> args.concat tab.used_options unless tab.nil?
<ide> args.uniq! # Just in case some dupes were added
<ide> end
<ide> | 2 |
Go | Go | fix some typos in runconfig\opts\envfile_test.go | 58da4c1bab83988486d31ad497a68abd77f05316 | <ide><path>runconfig/opts/envfile_test.go
<ide> and_underscore=working too
<ide> }
<ide>
<ide> if !reflect.DeepEqual(lines, expectedLines) {
<del> t.Fatal("lines not equal to expected_lines")
<add> t.Fatal("lines not equal to expectedLines")
<ide> }
<ide> }
<ide>
<ide> another invalid line`
<ide> defer os.Remove(tmpFile)
<ide>
<ide> _, err := ParseEnvFile(tmpFile)
<del>
<ide> if err == nil {
<ide> t.Fatalf("Expected an ErrBadEnvVariable, got nothing")
<ide> }
<ide> if _, ok := err.(ErrBadEnvVariable); !ok {
<del> t.Fatalf("Expected an ErrBadEnvvariable, got [%v]", err)
<add> t.Fatalf("Expected an ErrBadEnvVariable, got [%v]", err)
<ide> }
<ide> expectedMessage := "poorly formatted environment: variable 'first line' has white spaces"
<ide> if err.Error() != expectedMessage { | 1 |
Text | Text | add security notice to v0.8.17 post | 6d9ee4b1843868850d950c037bbf696f72170c0c | <ide><path>doc/blog/release/v0.8.17.md
<ide> slug: node-v0-8-17-stable
<ide> category: release
<ide> version: 0.8.17
<ide>
<add>This release addresses a potential security vulnerability.
<add>
<add>If you do not use TypedArrays, then you're fine (but should still
<add>upgrade for other reasons, like better performance and npm
<add>peerDependencies.)
<add>
<add>If you use TypedArrays, you should upgrade to v0.8.17 as soon as
<add>possible. If user input can affect the size parameter in a
<add>TypedArray, an integer overflow vulnerability could allow an attacker
<add>to write to areas of memory outside the intended buffer. Please
<add>upgrade ASAP.
<add>
<ide> 2012.01.09, Version 0.8.17 (Stable)
<ide>
<ide> * npm: Upgrade to v1.2.0 | 1 |
Ruby | Ruby | use ruby >= 1.9 hash syntax as is the preference | 578096b9712a018b0241cb051dc0051239f62193 | <ide><path>actionview/test/template/render_test.rb
<ide> def test_render_partial_collection_for_non_array
<ide> y.yield(Customer.new("david"))
<ide> y.yield(Customer.new("mary"))
<ide> end
<del> assert_equal "Hello: davidHello: mary", @view.render(:partial => "test/customer", collection: customers)
<add> assert_equal "Hello: davidHello: mary", @view.render(partial: "test/customer", collection: customers)
<ide> end
<ide>
<ide> def test_render_partial_without_object_does_not_put_partial_name_to_local_assigns | 1 |
Javascript | Javascript | add ios 10 support for terserplugin | aa474017d72279dd242f3986a33082a6e5f2a816 | <ide><path>packages/next/build/webpack-config.js
<ide> function optimizationConfig ({ dev, isServer, totalPages, target }) {
<ide>
<ide> // Terser is a better uglifier
<ide> config.minimizer = [
<del> new TerserPlugin(terserPluginConfig)
<add> new TerserPlugin({...terserPluginConfig,
<add> terserOptions: {
<add> safari10: true
<add> }
<add> })
<ide> ]
<ide>
<ide> // Only enabled in production | 1 |
Ruby | Ruby | fix tests across dst (closes ) [mpalmer] | 15467a43f5e0c107d5048950d1718ccccbbaf01e | <ide><path>activesupport/test/core_ext/time_ext_test.rb
<ide> def test_utc_plus
<ide> end
<ide>
<ide> def test_next_week
<del> assert_equal Time.local(2005,2,28), Time.local(2005,2,22,15,15,10).next_week
<del> assert_equal Time.local(2005,2,29), Time.local(2005,2,22,15,15,10).next_week(:tuesday)
<del> assert_equal Time.local(2005,3,4), Time.local(2005,2,22,15,15,10).next_week(:friday)
<del> assert_equal Time.local(2006,10,30), Time.local(2006,10,23,0,0,0).next_week
<del> assert_equal Time.local(2006,11,1), Time.local(2006,10,23,0,0,0).next_week(:wednesday)
<add> with_timezone 'US/Eastern' do
<add> assert_equal Time.local(2005,2,28), Time.local(2005,2,22,15,15,10).next_week
<add> assert_equal Time.local(2005,2,29), Time.local(2005,2,22,15,15,10).next_week(:tuesday)
<add> assert_equal Time.local(2005,3,4), Time.local(2005,2,22,15,15,10).next_week(:friday)
<add> assert_equal Time.local(2006,10,30), Time.local(2006,10,23,0,0,0).next_week
<add> assert_equal Time.local(2006,11,1), Time.local(2006,10,23,0,0,0).next_week(:wednesday)
<add> end
<ide> end
<ide>
<ide> def test_next_week_near_daylight_start | 1 |
Javascript | Javascript | fix broken image cropper - can not scroll | 13dfb6267a16f3430cf609d47b290ab977082300 | <ide><path>Libraries/Components/ScrollView/ScrollView.js
<ide> const ColorPropType = require('ColorPropType');
<ide> const EdgeInsetsPropType = require('EdgeInsetsPropType');
<ide> const Platform = require('Platform');
<ide> const PointPropType = require('PointPropType');
<del>const RCTScrollViewManager = require('NativeModules').ScrollViewManager;
<ide> const React = require('React');
<ide> const ReactNative = require('ReactNative');
<ide> const ScrollResponder = require('ScrollResponder');
<ide> const ScrollView = React.createClass({
<ide> !this.props.horizontal;
<ide>
<ide> const baseStyle = this.props.horizontal ? styles.baseHorizontal : styles.baseVertical;
<del>
<ide> const props = {
<ide> ...this.props,
<ide> alwaysBounceHorizontal,
<ide> const ScrollView = React.createClass({
<ide> const styles = StyleSheet.create({
<ide> baseVertical: {
<ide> flex: 1,
<add> flexDirection: 'column',
<ide> },
<ide> baseHorizontal: {
<ide> flex: 1, | 1 |
Ruby | Ruby | add test for php version in url middle | 4f55565677101a1a3b63567ce937b8cf72eae252 | <ide><path>Library/Homebrew/test/version_spec.rb
<ide> .to be_detected_from("ftp://gcc.gnu.org/pub/gcc/snapshots/6-20151227/gcc-6-20151227.tar.bz2")
<ide> end
<ide>
<add> specify "semver in middle of URL" do
<add> expect(Version.create("7.1.10"))
<add> .to be_detected_from("https://php.net/get/php-7.1.10.tar.gz/from/this/mirror")
<add> end
<add>
<ide> specify "from URL" do
<ide> expect(Version.create("1.2.3"))
<ide> .to be_detected_from("http://github.com/foo/bar.git", tag: "v1.2.3") | 1 |
Java | Java | remove consumes from @requestmapping | 945cf43e2db6fe2f02a3967397cc1e32f1c22876 | <ide><path>org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerMethodMapping.java
<ide> protected RequestMappingInfo getMappingForMethod(String beanName, Method method)
<ide> private static RequestMappingInfo createFromRequestMapping(RequestMapping annotation) {
<ide> return new RequestMappingInfo(Arrays.asList(annotation.value()), Arrays.asList(annotation.method()),
<ide> RequestConditionFactory.parseParams(annotation.params()),
<del> RequestConditionFactory.parseHeaders(annotation.headers()));
<add> RequestConditionFactory.parseHeaders(annotation.headers()),
<add> RequestConditionFactory.parseConsumes());
<ide> }
<ide>
<ide> @Override
<ide><path>org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingInfo.java
<ide> public final class RequestMappingInfo {
<ide>
<ide> private final RequestCondition headersCondition;
<ide>
<add> private final RequestCondition consumesCondition;
<add>
<ide> private int hash;
<ide>
<ide> /**
<ide> public final class RequestMappingInfo {
<ide> * <p>Package protected for testing purposes.
<ide> */
<ide> RequestMappingInfo(Collection<String> patterns, Collection<RequestMethod> methods) {
<del> this(patterns, methods, null, null);
<add> this(patterns, methods, null, null, null);
<ide> }
<ide>
<ide> /**
<ide> public final class RequestMappingInfo {
<ide> public RequestMappingInfo(Collection<String> patterns,
<ide> Collection<RequestMethod> methods,
<ide> RequestCondition paramsCondition,
<del> RequestCondition headersCondition) {
<add> RequestCondition headersCondition,
<add> RequestCondition consumesCondition) {
<ide> this.patterns = asUnmodifiableSet(prependLeadingSlash(patterns));
<ide> this.methods = asUnmodifiableSet(methods);
<ide> this.paramsCondition = paramsCondition != null ? paramsCondition : RequestConditionFactory.trueCondition();
<ide> this.headersCondition = headersCondition != null ? headersCondition : RequestConditionFactory.trueCondition();
<add> this.consumesCondition = consumesCondition != null ? consumesCondition : RequestConditionFactory.trueCondition();
<ide> }
<ide>
<ide> private static Set<String> prependLeadingSlash(Collection<String> patterns) {
<ide> public RequestCondition getHeaders() {
<ide> * <li>HTTP methods are combined as union of all HTTP methods listed in both keys.
<ide> * <li>Request parameter are combined into a logical AND.
<ide> * <li>Request header are combined into a logical AND.
<add> * <li>Consumes .. TODO
<ide> * </ul>
<ide> * @param methodKey the key to combine with
<ide> * @param pathMatcher to {@linkplain PathMatcher#combine(String, String) combine} the patterns
<ide> public RequestMappingInfo combine(RequestMappingInfo methodKey, PathMatcher path
<ide> Set<RequestMethod> methods = union(this.methods, methodKey.methods);
<ide> RequestCondition params = RequestConditionFactory.and(this.paramsCondition, methodKey.paramsCondition);
<ide> RequestCondition headers = RequestConditionFactory.and(this.headersCondition, methodKey.headersCondition);
<add> RequestCondition consumes = RequestConditionFactory.mostSpecific(methodKey.consumesCondition, this.consumesCondition);
<ide>
<del> return new RequestMappingInfo(patterns, methods, params, headers);
<add> return new RequestMappingInfo(patterns, methods, params, headers, consumes);
<ide> }
<ide>
<ide> private static Set<String> combinePatterns(Collection<String> typePatterns,
<ide> private static <T> Set<T> union(Collection<T> s1, Collection<T> s2) {
<ide> * @return a new request key that contains all matching attributes, or {@code null} if not all conditions match
<ide> */
<ide> public RequestMappingInfo getMatchingRequestMapping(String lookupPath, HttpServletRequest request, PathMatcher pathMatcher) {
<del> if (!checkMethod(request) || !paramsCondition.match(request) || !headersCondition.match(request)) {
<add> if (!checkMethod(request) || !paramsCondition.match(request) || !headersCondition.match(request) ||
<add> !consumesCondition.match(request)) {
<ide> return null;
<ide> }
<ide> else {
<ide> List<String> matchingPatterns = getMatchingPatterns(lookupPath, request, pathMatcher);
<ide> if (!matchingPatterns.isEmpty()) {
<ide> Set<RequestMethod> matchingMethods = getMatchingMethod(request);
<del> return new RequestMappingInfo(matchingPatterns, matchingMethods, this.paramsCondition, this.headersCondition);
<add> return new RequestMappingInfo(matchingPatterns, matchingMethods, this.paramsCondition, this.headersCondition,
<add> this.consumesCondition);
<ide> }
<ide> else {
<ide> return null;
<ide> public String toString() {
<ide> }
<ide> builder.append(",params=").append(paramsCondition.toString());
<ide> builder.append(",headers=").append(headersCondition.toString());
<add> builder.append(",consumes=").append(consumesCondition.toString());
<ide> builder.append('}');
<ide> return builder.toString();
<ide> }
<ide><path>org.springframework.web.servlet/src/test/java/org/springframework/web/servlet/mvc/method/annotation/RequestKeyComparatorTests.java
<ide> public void methodsAndParams() {
<ide> RequestMappingInfo empty = new RequestMappingInfo(null, null);
<ide> RequestMappingInfo oneMethod = new RequestMappingInfo(null, asList(RequestMethod.GET));
<ide> RequestMappingInfo oneMethodOneParam =
<del> new RequestMappingInfo(null, asList(RequestMethod.GET), RequestConditionFactory.parseParams("foo"), null);
<add> new RequestMappingInfo(null, asList(RequestMethod.GET), RequestConditionFactory.parseParams("foo"), null, null);
<ide> List<RequestMappingInfo> list = asList(empty, oneMethod, oneMethodOneParam);
<ide> Collections.shuffle(list);
<ide> Collections.sort(list, handlerMapping.getMappingComparator("", request));
<ide> public void methodsAndParams() {
<ide> @Test
<ide> @Ignore // TODO : remove ignore
<ide> public void acceptHeaders() {
<del> RequestMappingInfo html = new RequestMappingInfo(null, null, null, RequestConditionFactory.parseHeaders("accept=text/html"));
<del> RequestMappingInfo xml = new RequestMappingInfo(null, null, null, RequestConditionFactory.parseHeaders("accept=application/xml"));
<add> RequestMappingInfo html = new RequestMappingInfo(null, null, null, RequestConditionFactory.parseHeaders("accept=text/html"), null);
<add> RequestMappingInfo xml = new RequestMappingInfo(null, null, null, RequestConditionFactory.parseHeaders("accept=application/xml"), null);
<ide> RequestMappingInfo none = new RequestMappingInfo(null, null);
<ide>
<ide> request.addHeader("Accept", "application/xml, text/html");
<ide><path>org.springframework.web.servlet/src/test/java/org/springframework/web/servlet/mvc/method/annotation/RequestKeyTests.java
<ide> public void paramsCondition() {
<ide> request.setParameter("foo", "bar");
<ide> String lookupPath = new UrlPathHelper().getLookupPathForRequest(request);
<ide>
<del> RequestMappingInfo key = new RequestMappingInfo(asList("/foo"), null, RequestConditionFactory.parseParams("foo=bar"), null);
<add> RequestMappingInfo key = new RequestMappingInfo(asList("/foo"), null, RequestConditionFactory.parseParams("foo=bar"), null, null);
<ide> RequestMappingInfo match = key.getMatchingRequestMapping(lookupPath, request, pathMatcher);
<ide>
<ide> assertNotNull(match);
<ide>
<del> key = new RequestMappingInfo(singleton("/foo"), null, RequestConditionFactory.parseParams("foo!=bar"), null);
<add> key = new RequestMappingInfo(singleton("/foo"), null, RequestConditionFactory.parseParams("foo!=bar"), null, null);
<ide> match = key.getMatchingRequestMapping(lookupPath, request, pathMatcher);
<ide>
<ide> assertNull(match);
<ide> public void headersCondition() {
<ide> request.addHeader("foo", "bar");
<ide> String lookupPath = new UrlPathHelper().getLookupPathForRequest(request);
<ide>
<del> RequestMappingInfo key = new RequestMappingInfo(singleton("/foo"), null, null, RequestConditionFactory.parseHeaders("foo=bar"));
<add> RequestMappingInfo key = new RequestMappingInfo(singleton("/foo"), null, null, RequestConditionFactory.parseHeaders("foo=bar"), null);
<ide> RequestMappingInfo match = key.getMatchingRequestMapping(lookupPath, request, pathMatcher);
<ide>
<ide> assertNotNull(match);
<ide>
<del> key = new RequestMappingInfo(singleton("/foo"), null, null, RequestConditionFactory.parseHeaders("foo!=bar"));
<add> key = new RequestMappingInfo(singleton("/foo"), null, null, RequestConditionFactory.parseHeaders("foo!=bar"), null);
<ide> match = key.getMatchingRequestMapping(lookupPath, request, pathMatcher);
<ide>
<ide> assertNull(match);
<ide> }
<ide>
<del>// @Test
<del>// public void consumesCondition() {
<del>// PathMatcher pathMatcher = new AntPathMatcher();
<del>// MockHttpServletRequest request = new MockHttpServletRequest("GET", "/foo");
<del>// request.setContentType("text/plain");
<del>// String lookupPath = new UrlPathHelper().getLookupPathForRequest(request);
<del>//
<del>// RequestMappingInfo key = new RequestMappingInfo(singleton("/foo"), null, null, null, RequestConditionFactory.parseConsumes(
<del>// "text/plain"));
<del>// RequestMappingInfo match = key.getMatchingKey(lookupPath, request, pathMatcher);
<del>//
<del>// assertNotNull(match);
<del>//
<del>// key = new RequestMappingInfo(singleton("/foo"), null, null, null, RequestConditionFactory.parseConsumes(
<del>// "application/xml"));
<del>// match = key.getMatchingKey(lookupPath, request, pathMatcher);
<del>//
<del>// assertNull(match);
<del>// }
<add> @Test
<add> public void consumesCondition() {
<add> PathMatcher pathMatcher = new AntPathMatcher();
<add> MockHttpServletRequest request = new MockHttpServletRequest("GET", "/foo");
<add> request.setContentType("text/plain");
<add> String lookupPath = new UrlPathHelper().getLookupPathForRequest(request);
<add>
<add> RequestMappingInfo key = new RequestMappingInfo(singleton("/foo"), null, null, null, RequestConditionFactory.parseConsumes(
<add> "text/plain"));
<add> RequestMappingInfo match = key.getMatchingRequestMapping(lookupPath, request, pathMatcher);
<add>
<add> assertNotNull(match);
<add>
<add> key = new RequestMappingInfo(singleton("/foo"), null, null, null, RequestConditionFactory.parseConsumes(
<add> "application/xml"));
<add> match = key.getMatchingRequestMapping(lookupPath, request, pathMatcher);
<add>
<add> assertNull(match);
<add> }
<ide>
<ide> private RequestMappingInfo createKeyFromPatterns(String... patterns) {
<ide> return new RequestMappingInfo(asList(patterns), null);
<ide><path>org.springframework.web/src/main/java/org/springframework/web/bind/annotation/RequestMapping.java
<ide> * As a consequence, such an argument will never be <code>null</code>.
<ide> * <i>Note that session access may not be thread-safe, in particular in a
<ide> * Servlet environment: Consider switching the
<del> * {@link org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter#setSynchronizeOnSession "synchronizeOnSession"}
<add> * {@link org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMethodAdapter#setSynchronizeOnSession "synchronizeOnSession"}
<ide> * flag to "true" if multiple requests are allowed to access a session concurrently.</i>
<ide> * <li>{@link org.springframework.web.context.request.WebRequest} or
<ide> * {@link org.springframework.web.context.request.NativeWebRequest}.
<ide> * <li>Command/form objects to bind parameters to: as bean properties or fields,
<ide> * with customizable type conversion, depending on {@link InitBinder} methods
<ide> * and/or the HandlerAdapter configuration - see the "webBindingInitializer"
<del> * property on AnnotationMethodHandlerAdapter.
<add> * property on RequestMappingHandlerMethodAdapter.
<ide> * Such command objects along with their validation results will be exposed
<ide> * as model attributes, by default using the non-qualified command class name
<ide> * in property notation (e.g. "orderAddress" for type "mypackage.OrderAddress").
<ide> * <code>DispatcherServlet</code> and <code>DispatcherPortlet</code>.
<ide> * However, if you are defining custom <code>HandlerMappings</code> or
<ide> * <code>HandlerAdapters</code>, then you need to make sure that a
<del> * corresponding custom <code>DefaultAnnotationHandlerMapping</code>
<del> * and/or <code>AnnotationMethodHandlerAdapter</code> is defined as well
<add> * corresponding custom <code>RequestMappingHandlerMethodMapping</code>
<add> * and/or <code>RequestMappingHandlerMethodAdapter</code> is defined as well
<ide> * - provided that you intend to use <code>@RequestMapping</code>.
<ide> *
<ide> * <p><b>NOTE:</b> When using controller interfaces (e.g. for AOP proxying),
<ide> * @see SessionAttributes
<ide> * @see InitBinder
<ide> * @see org.springframework.web.context.request.WebRequest
<del> * @see org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping
<del> * @see org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter
<add> * @see org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMethodMapping
<add> * @see org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMethodAdapter
<ide> * @see org.springframework.web.portlet.mvc.annotation.DefaultAnnotationHandlerMapping
<ide> * @see org.springframework.web.portlet.mvc.annotation.AnnotationMethodHandlerAdapter
<ide> */
<ide> */
<ide> String[] headers() default {};
<ide>
<del> String[] consumes() default "*/*";
<del>
<ide> } | 5 |
Python | Python | add a specific error message for urlvalidator | 34d098665d9423c0b70add5b8c8231fff9d0f774 | <ide><path>django/core/validators.py
<ide> class URLValidator(RegexValidator):
<ide> r'\[?[A-F0-9]*:[A-F0-9:]+\]?)' # ...or ipv6
<ide> r'(?::\d+)?' # optional port
<ide> r'(?:/?|[/?]\S+)$', re.IGNORECASE)
<add> message = _('Enter a valid URL.')
<ide>
<ide> def __call__(self, value):
<ide> try:
<ide><path>tests/validation/tests.py
<ide> def test_correct_email_value_passes(self):
<ide>
<ide> def test_wrong_url_value_raises_error(self):
<ide> mtv = ModelToValidate(number=10, name='Some Name', url='not a url')
<del> self.assertFieldFailsValidationWithMessage(mtv.full_clean, 'url', ['Enter a valid value.'])
<add> self.assertFieldFailsValidationWithMessage(mtv.full_clean, 'url', ['Enter a valid URL.'])
<ide>
<ide> def test_text_greater_that_charfields_max_length_raises_erros(self):
<ide> mtv = ModelToValidate(number=10, name='Some Name'*100) | 2 |
Text | Text | add coffeescript link | 28b362f8ffa02aed58a8d07a7f27922a8c2fd4f9 | <ide><path>docs/customizing-atom.md
<ide> You can open this file in an editor from the _Atom > Open Your Config_ menu.
<ide> ### init.coffee
<ide>
<ide> When Atom finishes loading, it will evaluate _init.coffee_ in your _~/.atom_
<del>directory, giving you a chance to run arbitrary personal CoffeeScript code to
<add>directory, giving you a chance to run arbitrary personal [CoffeeScript][] code to
<ide> make customizations. You have full access to Atom's API from code in this file.
<ide> If customizations become extensive, consider [creating a package][creating-a-package].
<ide>
<ide> This file can also be named _styles.css_ and contain CSS.
<ide> [create-theme]: creating-a-theme.md
<ide> [LESS]: http://www.lesscss.org
<ide> [CSON]: https://github.com/bevry/cson
<add>[CoffeeScript]: http://coffeescript.org/ | 1 |
Text | Text | add the text for clarity to the article | 2d2c13f2ab6af0be28976975c6d1d22730aedc23 | <ide><path>guide/english/certifications/responsive-web-design/basic-css/import-a-google-font/index.md
<ide> title: Import a Google Font
<ide> ---
<ide> ## Import a Google Font
<add>The below example shows one of the ways in which you can import and use a Google Font.
<add>The example uses a link to the font's API, in the ```<head>``` of the HTML document rather than in the CSS.
<add>
<add>To browse through other fonts offered by Google, please check [Google Fonts](https://fonts.google.com "Google Fonts")
<ide>
<ide> ### Solution
<ide>
<ide> title: Import a Google Font
<ide> </form>
<ide> </main>
<ide> ```
<add>#### More on this
<add>To look at what is going on behind a font, you can open the URL for the font.
<add>We have used the _Lobster_ font, [click here](https://fonts.googleapis.com/css?family=Lobster) to have a look at what's going on under-the-hood for the _Lobster_ font
<add>
<add>[Another way of importing font: using @font-face](https://css-tricks.com/snippets/css/using-font-face/)
<add>
<add>[Don't just copy the fonts out of Google Fonts URLs](https://css-tricks.com/dont-just-copy-the-font-face-out-of-google-fonts-urls/) | 1 |
Python | Python | correct a typo in multi.py | 3111feb9e5b279ec066235b4a5225180aedb20d0 | <ide><path>celery/bin/multi.py
<ide> $ celery multi show 10 -l INFO -Q:1-3 images,video -Q:4,5 data
<ide> -Q default -L:4,5 DEBUG
<ide>
<del> $ # Additional options are added to each celery worker' comamnd,
<add> $ # Additional options are added to each celery worker's command,
<ide> $ # but you can also modify the options for ranges of, or specific workers
<ide>
<ide> $ # 3 workers: Two with 3 processes, and one with 10 processes. | 1 |
Javascript | Javascript | eliminate references to undefined watcher variable | cf053174a20a8e057aef6c9f49073d2feab5b404 | <ide><path>src/path-watcher.js
<ide> class PathWatcherManager {
<ide> return w
<ide> }
<ide>
<del> // Private: Directly access the {NativeWatcherRegistry}.
<del> getRegistry () {
<del> if (this.useExperimentalWatcher()) {
<del> return watcher.getRegistry()
<del> }
<del>
<del> return this.nativeRegistry
<del> }
<del>
<del> // Private: Sample watcher usage statistics. Only available for experimental watchers.
<del> status () {
<del> if (this.useExperimentalWatcher()) {
<del> return watcher.status()
<del> }
<del>
<del> return {}
<del> }
<del>
<del> // Private: Return a {String} depicting the currently active native watchers.
<del> print () {
<del> if (this.useExperimentalWatcher()) {
<del> return watcher.printWatchers()
<del> }
<del>
<del> return this.nativeRegistry.print()
<del> }
<add> // // Private: Directly access the {NativeWatcherRegistry}.
<add> // getRegistry () {
<add> // if (this.useExperimentalWatcher()) {
<add> // return watcher.getRegistry()
<add> // }
<add> //
<add> // return this.nativeRegistry
<add> // }
<add>
<add> // // Private: Sample watcher usage statistics. Only available for experimental watchers.
<add> // status () {
<add> // if (this.useExperimentalWatcher()) {
<add> // return watcher.status()
<add> // }
<add> //
<add> // return {}
<add> // }
<add>
<add> // // Private: Return a {String} depicting the currently active native watchers.
<add> // print () {
<add> // if (this.useExperimentalWatcher()) {
<add> // return watcher.printWatchers()
<add> // }
<add> //
<add> // return this.nativeRegistry.print()
<add> // }
<ide>
<ide> // Private: Stop all living watchers.
<ide> //
<ide> watchPath.status = function () {
<ide> return PathWatcherManager.active().status()
<ide> }
<ide>
<del>// Private: Configure @atom/watcher ("experimental") directly.
<del>watchPath.configure = function (...args) {
<del> return watcher.configure(...args)
<del>}
<add>// // Private: Configure @atom/watcher ("experimental") directly.
<add>// watchPath.configure = function (...args) {
<add>// return watcher.configure(...args)
<add>// }
<ide>
<ide> module.exports = {watchPath, stopAllWatchers} | 1 |
Ruby | Ruby | add sneakers test and inline setup/teardown | 2d19c711d041dd955d3fcaf952d101df9241a65e | <ide><path>test/cases/adapter_test.rb
<ide> require 'helper'
<ide>
<ide> class AdapterTest < ActiveSupport::TestCase
<del> def setup
<del> @old_adapter = ActiveJob::Base.queue_adapter
<del> end
<add> setup { @old_adapter = ActiveJob::Base.queue_adapter }
<add> teardown { ActiveJob::Base.queue_adapter = @old_adapter }
<ide>
<ide> test 'should load inline adapter' do
<ide> ActiveJob::Base.queue_adapter = :inline
<ide> def setup
<ide> assert_equal ActiveJob::QueueAdapters::SuckerPunchAdapter, ActiveJob::Base.queue_adapter
<ide> end
<ide>
<del> def teardown
<del> ActiveJob::Base.queue_adapter = @old_adapter
<add> test 'should load Sneakers adapter' do
<add> ActiveJob::Base.queue_adapter = :sneakers
<add> assert_equal ActiveJob::QueueAdapters::SneakersAdapter, ActiveJob::Base.queue_adapter
<ide> end
<ide> end | 1 |
Javascript | Javascript | add buffer_creation benchmark | 12a169e8ff4036e160dbdc605eb9f15eae933b47 | <ide><path>benchmark/buffer_creation.js
<add>
<add>
<add>for (var i = 0; i < 9000000; i++) {
<add> b = new Buffer(10);
<add> b[1] = 2
<add>}
<ide><path>benchmark/string_creation.js
<add>
<add>
<add>for (var i = 0; i < 9000000; i++) {
<add> s = '01234567890';
<add> s[1] = "a";
<add>} | 2 |
Javascript | Javascript | add the word "safely" to clarify | c82058ad57dfdab0e8e2505b6f44d7e33398ffb2 | <ide><path>src/ng/log.js
<ide> * @requires $window
<ide> *
<ide> * @description
<del> * Simple service for logging. Default implementation writes the message
<add> * Simple service for logging. Default implementation safely writes the message
<ide> * into the browser's console (if present).
<ide> *
<ide> * The main purpose of this service is to simplify debugging and troubleshooting. | 1 |
Python | Python | add autosummary of emath functions | 31fbcf5a3b094768a2f9d362ada8bc5df7b4754a | <ide><path>numpy/core/code_generators/ufunc_docstrings.py
<ide> def add_newdoc(place, name, doc):
<ide>
<ide> See Also
<ide> --------
<del> numpy.lib.scimath.sqrt
<add> lib.scimath.sqrt
<ide> A version which returns complex numbers when given negative reals.
<ide>
<ide> Notes
<ide><path>numpy/lib/scimath.py
<ide> Similarly, `sqrt`, other base logarithms, `power` and trig functions are
<ide> correctly handled. See their respective docstrings for specific examples.
<ide>
<add>Functions
<add>---------
<add>
<add>.. autosummary::
<add> :toctree: generated/
<add>
<add> sqrt
<add> log
<add> log2
<add> logn
<add> log10
<add> power
<add> arccos
<add> arcsin
<add> arctanh
<add>
<ide> """
<ide> import numpy.core.numeric as nx
<ide> import numpy.core.numerictypes as nt | 2 |
PHP | PHP | set time to midnight as described in | 1c2257ddc10acb829d450fe6d812101b6708af36 | <ide><path>src/Database/Type/DateType.php
<ide> */
<ide> namespace Cake\Database\Type;
<ide>
<add>use Cake\Database\Driver;
<add>
<ide> class DateType extends \Cake\Database\Type\DateTimeType {
<ide>
<ide> /**
<ide> public function marshal($value) {
<ide> }
<ide> return $date;
<ide> }
<del>
<add>
<add>/**
<add> * Convert strings into Date instances.
<add> *
<add> * @param string $value The value to convert.
<add> * @param Driver $driver The driver instance to convert with.
<add> * @return \Carbon\Carbon
<add> */
<add> public function toPHP($value, Driver $driver) {
<add> $date = parent::toPHP($value, $driver);
<add> if ($date instanceof \DateTime) {
<add> return $date->setTime(0, 0, 0);
<add> }
<add> }
<ide> } | 1 |
PHP | PHP | update doc blocks | 7be864873b89375895d3ea6dd0e93120097dd2cd | <ide><path>src/View/Input/Label.php
<ide> class Label {
<ide> /**
<ide> * Constructor.
<ide> *
<add> * This class uses the following template:
<add> *
<add> * - `label` Used to generate the label for a radio button.
<add> * Can use the following variables `attrs`, `text` and `input`.
<add> *
<ide> * @param Cake\View\StringTemplate $templates
<ide> */
<ide> public function __construct($templates) {
<ide><path>src/View/Input/Radio.php
<ide> class Radio {
<ide> *
<ide> * - `radio` Used to generate the input for a radio button.
<ide> * Can use the following variables `name`, `value`, `attrs`.
<del> * - `label` Used to generate the label for a radio button.
<del> * Can use the following variables `attrs`, `text` and `input`.
<ide> * - `radioContainer` Used to generate the container element for
<ide> * the radio + input element. Can use the `input` and `label`
<ide> * variables.
<ide> *
<ide> * @param Cake\View\StringTemplate $templates
<add> * @param Cake\View\Input\Label $label
<ide> */
<ide> public function __construct($templates, $label) {
<ide> $this->_templates = $templates; | 2 |
Javascript | Javascript | improve coverage for process.umask | d43e7f39929846f02dd74a827e4b2269f3e977d9 | <ide><path>test/parallel/test-umask.js
<ide> assert.strictEqual(parseInt(mask, 8), process.umask(old));
<ide> assert.strictEqual(old, process.umask());
<ide> // 2. If the test fails, process.umask() will return 0
<ide> assert.strictEqual(old, process.umask());
<add>
<add>assert.throws(() => {
<add> process.umask({});
<add>}, /argument must be an integer or octal string/);
<add>
<add>assert.throws(() => {
<add> process.umask('123x');
<add>}, /invalid octal string/); | 1 |
Text | Text | simplify format description of urlobject.auth | b002f6ec27a436c4d3580b953c5e8761f888a6a9 | <ide><path>doc/api/url.md
<ide> The legacy `urlObject` (`require('url').Url`) is created and returned by the
<ide>
<ide> The `auth` property is the username and password portion of the URL, also
<ide> referred to as _userinfo_. This string subset follows the `protocol` and
<del>double slashes (if present) and precedes the `host` component, delimited by an
<del>ASCII "at sign" (`@`). The string is either the username, or it is the username
<del>and password separated by `:`.
<add>double slashes (if present) and precedes the `host` component, delimited by `@`.
<add>The string is either the username, or it is the username and password separated
<add>by `:`.
<ide>
<ide> For example: `'user:pass'`.
<ide> | 1 |
Python | Python | run mlm pad to multiple for fp16 | 6c40e49712972141c3d7aeba4ed90bb79f2bb078 | <ide><path>examples/language-modeling/run_mlm.py
<ide> def group_texts(examples):
<ide>
<ide> # Data collator
<ide> # This one will take care of randomly masking the tokens.
<del> data_collator = DataCollatorForLanguageModeling(tokenizer=tokenizer, mlm_probability=data_args.mlm_probability)
<add> pad_to_multiple_of_8 = data_args.line_by_line and training_args.fp16 and not data_args.pad_to_max_length
<add> data_collator = DataCollatorForLanguageModeling(
<add> tokenizer=tokenizer,
<add> mlm_probability=data_args.mlm_probability,
<add> pad_to_multiple_of=8 if pad_to_multiple_of_8 else None,
<add> )
<ide>
<ide> # Initialize our Trainer
<ide> trainer = Trainer(
<ide><path>src/transformers/data/data_collator.py
<ide> def __call__(self, features):
<ide> return batch
<ide>
<ide>
<del>def _collate_batch(examples, tokenizer):
<add>def _collate_batch(examples, tokenizer, pad_to_multiple_of: Optional[int] = None):
<ide> """Collate `examples` into a batch, using the information in `tokenizer` for padding if necessary."""
<ide> # Tensorize if necessary.
<ide> if isinstance(examples[0], (list, tuple)):
<ide> def _collate_batch(examples, tokenizer):
<ide> # Check if padding is necessary.
<ide> length_of_first = examples[0].size(0)
<ide> are_tensors_same_length = all(x.size(0) == length_of_first for x in examples)
<del> if are_tensors_same_length:
<add> if are_tensors_same_length and (pad_to_multiple_of is None or length_of_first % pad_to_multiple_of == 0):
<ide> return torch.stack(examples, dim=0)
<ide>
<ide> # If yes, check if we have a `pad_token`.
<ide> def _collate_batch(examples, tokenizer):
<ide>
<ide> # Creating the full tensor and filling it with our data.
<ide> max_length = max(x.size(0) for x in examples)
<add> if pad_to_multiple_of is not None and (max_length % pad_to_multiple_of != 0):
<add> max_length = ((max_length // pad_to_multiple_of) + 1) * pad_to_multiple_of
<ide> result = examples[0].new_full([len(examples), max_length], tokenizer.pad_token_id)
<ide> for i, example in enumerate(examples):
<ide> if tokenizer.padding_side == "right":
<ide> class DataCollatorForLanguageModeling:
<ide> non-masked tokens and the value to predict for the masked token.
<ide> mlm_probability (:obj:`float`, `optional`, defaults to 0.15):
<ide> The probability with which to (randomly) mask tokens in the input, when :obj:`mlm` is set to :obj:`True`.
<add> pad_to_multiple_of (:obj:`int`, `optional`):
<add> If set will pad the sequence to a multiple of the provided value.
<ide>
<ide> .. note::
<ide>
<ide> class DataCollatorForLanguageModeling:
<ide> tokenizer: PreTrainedTokenizerBase
<ide> mlm: bool = True
<ide> mlm_probability: float = 0.15
<add> pad_to_multiple_of: Optional[int] = None
<ide>
<ide> def __post_init__(self):
<ide> if self.mlm and self.tokenizer.mask_token is None:
<ide> def __call__(
<ide> ) -> Dict[str, torch.Tensor]:
<ide> # Handle dict or lists with proper padding and conversion to tensor.
<ide> if isinstance(examples[0], (dict, BatchEncoding)):
<del> batch = self.tokenizer.pad(examples, return_tensors="pt")
<add> batch = self.tokenizer.pad(examples, return_tensors="pt", pad_to_multiple_of=self.pad_to_multiple_of)
<ide> else:
<del> batch = {"input_ids": _collate_batch(examples, self.tokenizer)}
<add> batch = {"input_ids": _collate_batch(examples, self.tokenizer, pad_to_multiple_of=self.pad_to_multiple_of)}
<ide>
<ide> # If special token mask has been preprocessed, pop it from the dict.
<ide> special_tokens_mask = batch.pop("special_tokens_mask", None)
<ide><path>tests/test_data_collator.py
<ide> def test_data_collator_for_token_classification(self):
<ide> self.assertEqual(batch["labels"].shape, torch.Size([2, 6]))
<ide> self.assertEqual(batch["labels"][0].tolist(), [0, 1, 2] + [-1] * 3)
<ide>
<del> def test_data_collator_for_language_modeling(self):
<add> def _test_no_pad_and_pad(self, no_pad_features, pad_features):
<ide> tokenizer = BertTokenizer(self.vocab_file)
<del> no_pad_features = [{"input_ids": list(range(10))}, {"input_ids": list(range(10))}]
<del> pad_features = [{"input_ids": list(range(5))}, {"input_ids": list(range(10))}]
<del>
<ide> data_collator = DataCollatorForLanguageModeling(tokenizer, mlm=False)
<ide> batch = data_collator(no_pad_features)
<ide> self.assertEqual(batch["input_ids"].shape, torch.Size((2, 10)))
<ide> def test_data_collator_for_language_modeling(self):
<ide> self.assertEqual(batch["input_ids"].shape, torch.Size((2, 10)))
<ide> self.assertEqual(batch["labels"].shape, torch.Size((2, 10)))
<ide>
<add> data_collator = DataCollatorForLanguageModeling(tokenizer, mlm=False, pad_to_multiple_of=8)
<add> batch = data_collator(no_pad_features)
<add> self.assertEqual(batch["input_ids"].shape, torch.Size((2, 16)))
<add> self.assertEqual(batch["labels"].shape, torch.Size((2, 16)))
<add>
<add> batch = data_collator(pad_features)
<add> self.assertEqual(batch["input_ids"].shape, torch.Size((2, 16)))
<add> self.assertEqual(batch["labels"].shape, torch.Size((2, 16)))
<add>
<ide> tokenizer._pad_token = None
<ide> data_collator = DataCollatorForLanguageModeling(tokenizer, mlm=False)
<ide> with self.assertRaises(ValueError):
<ide> def test_data_collator_for_language_modeling(self):
<ide> self.assertTrue(torch.any(masked_tokens))
<ide> self.assertTrue(all(x == -100 for x in batch["labels"][~masked_tokens].tolist()))
<ide>
<add> data_collator = DataCollatorForLanguageModeling(tokenizer, pad_to_multiple_of=8)
<add> batch = data_collator(no_pad_features)
<add> self.assertEqual(batch["input_ids"].shape, torch.Size((2, 16)))
<add> self.assertEqual(batch["labels"].shape, torch.Size((2, 16)))
<add>
<add> masked_tokens = batch["input_ids"] == tokenizer.mask_token_id
<add> self.assertTrue(torch.any(masked_tokens))
<add> self.assertTrue(all(x == -100 for x in batch["labels"][~masked_tokens].tolist()))
<add>
<add> batch = data_collator(pad_features)
<add> self.assertEqual(batch["input_ids"].shape, torch.Size((2, 16)))
<add> self.assertEqual(batch["labels"].shape, torch.Size((2, 16)))
<add>
<add> masked_tokens = batch["input_ids"] == tokenizer.mask_token_id
<add> self.assertTrue(torch.any(masked_tokens))
<add> self.assertTrue(all(x == -100 for x in batch["labels"][~masked_tokens].tolist()))
<add>
<add> def test_data_collator_for_language_modeling(self):
<add> no_pad_features = [{"input_ids": list(range(10))}, {"input_ids": list(range(10))}]
<add> pad_features = [{"input_ids": list(range(5))}, {"input_ids": list(range(10))}]
<add> self._test_no_pad_and_pad(no_pad_features, pad_features)
<add>
<add> no_pad_features = [list(range(10)), list(range(10))]
<add> pad_features = [list(range(5)), list(range(10))]
<add> self._test_no_pad_and_pad(no_pad_features, pad_features)
<add>
<ide> def test_plm(self):
<ide> tokenizer = BertTokenizer(self.vocab_file)
<ide> no_pad_features = [{"input_ids": list(range(10))}, {"input_ids": list(range(10))}]
<ide> def test_nsp(self):
<ide> self.assertEqual(batch["labels"].shape, torch.Size((2, 5)))
<ide> self.assertEqual(batch["next_sentence_label"].shape, torch.Size((2,)))
<ide>
<add> data_collator = DataCollatorForLanguageModeling(tokenizer, pad_to_multiple_of=8)
<add> batch = data_collator(features)
<add>
<add> self.assertEqual(batch["input_ids"].shape, torch.Size((2, 8)))
<add> self.assertEqual(batch["token_type_ids"].shape, torch.Size((2, 8)))
<add> self.assertEqual(batch["labels"].shape, torch.Size((2, 8)))
<add> self.assertEqual(batch["next_sentence_label"].shape, torch.Size((2,)))
<add>
<ide> def test_sop(self):
<ide> tokenizer = BertTokenizer(self.vocab_file)
<ide> features = [
<ide> def test_sop(self):
<ide> self.assertEqual(batch["token_type_ids"].shape, torch.Size((2, 5)))
<ide> self.assertEqual(batch["labels"].shape, torch.Size((2, 5)))
<ide> self.assertEqual(batch["sentence_order_label"].shape, torch.Size((2,)))
<add>
<add> data_collator = DataCollatorForLanguageModeling(tokenizer, pad_to_multiple_of=8)
<add> batch = data_collator(features)
<add>
<add> self.assertEqual(batch["input_ids"].shape, torch.Size((2, 8)))
<add> self.assertEqual(batch["token_type_ids"].shape, torch.Size((2, 8)))
<add> self.assertEqual(batch["labels"].shape, torch.Size((2, 8)))
<add> self.assertEqual(batch["sentence_order_label"].shape, torch.Size((2,))) | 3 |
Javascript | Javascript | fix typo and minor semantic error | 6295a0d9bd7f57b1c23d83bf6a74d1242c3e19b4 | <ide><path>src/loader.js
<ide> function setupModuleLoader(window) {
<ide> *
<ide> * # Module
<ide> *
<del> * A module is a collocation of services, directives, filters, and configuration information. Module
<del> * is used to configure the {@link AUTO.$injector $injector}.
<add> * A module is a collection of services, directives, filters, and configuration information.
<add> * `angular.module` is used to configure the {@link AUTO.$injector $injector}.
<ide> *
<ide> * <pre>
<ide> * // Create a new module | 1 |
Javascript | Javascript | hide error earlier | d0f88af5b620f25c17c369e7c0bd5ee1b79359fc | <ide><path>website/assets/js/models.js
<ide> export class ModelComparer {
<ide> this.fonts = CHART_FONTS;
<ide> this.defaultModels = defaultModels;
<ide> this.tpl.get('result').style.display = 'block';
<add> this.tpl.get('error').style.display = 'none';
<ide> this.fetchCompat()
<ide> .then(compat => this.init(compat))
<ide> .catch(this.showError.bind(this)) | 1 |
Text | Text | add @takkanm credits in the changelog [ci skip] | 744d388a90bed2958210b5779d3fc3f9ad0cf550 | <ide><path>actionpack/CHANGELOG.md
<ide> * Added `#reverse_merge` and `#reverse_merge!` methods to `ActionController::Parameters`
<ide>
<del> *Edouard Chin*
<add> *Edouard Chin & Mitsutaka Mimura*
<ide>
<ide> * Fix malformed URLS when using `ApplicationController.renderer`
<ide> | 1 |
Python | Python | reduce code complexity on logs.py | aaf1eebbcd797c8b05c09708cb5cc82012430857 | <ide><path>glances/logs.py
<ide> def add(self, item_state, item_type, item_value,
<ide> item_index = self.__itemexist__(item_type)
<ide> if item_index < 0:
<ide> # Item did not exist, add if WARNING or CRITICAL
<del> if item_state == "WARNING" or item_state == "CRITICAL":
<del> # Define the automatic process sort key
<del> self.set_process_sort(item_type)
<del>
<del> # Create the new log item
<del> # Time is stored in Epoch format
<del> # Epoch -> DMYHMS = datetime.fromtimestamp(epoch)
<del> item = [
<del> time.mktime(datetime.now().timetuple()), # START DATE
<del> -1, # END DATE
<del> item_state, # STATE: WARNING|CRITICAL
<del> item_type, # TYPE: CPU, LOAD, MEM...
<del> item_value, # MAX
<del> item_value, # AVG
<del> item_value, # MIN
<del> item_value, # SUM
<del> 1, # COUNT
<del> # Process list is sorted automatically
<del> # Overwrite the user choice
<del> # topprocess = sorted(proc_list, key=lambda process: process[process_auto_by],
<del> # reverse=True)
<del> # topprocess[0:3], # TOP 3 PROCESS LIST
<del> [], # TOP 3 PROCESS LIST
<del> proc_desc] # MONITORED PROCESSES DESC
<del>
<del> # Add the item to the list
<del> self.logs_list.insert(0, item)
<del> if self.len() > self.logs_max:
<del> self.logs_list.pop()
<add> self._create_item(item_state, item_type, item_value,
<add> proc_list, proc_desc, peak_time)
<ide> else:
<ide> # Item exist, update
<del> if item_state == "OK" or item_state == "CAREFUL":
<del> # Reset the automatic process sort key
<del> self.reset_process_sort()
<del>
<del> endtime = time.mktime(datetime.now().timetuple())
<del> if endtime - self.logs_list[item_index][0] > peak_time:
<del> # If event is > peak_time seconds
<del> self.logs_list[item_index][1] = endtime
<del> else:
<del> # If event <= peak_time seconds, ignore
<del> self.logs_list.remove(self.logs_list[item_index])
<del> else:
<del> # Update the item
<del> # State
<del> if item_state == "CRITICAL":
<del> self.logs_list[item_index][2] = item_state
<del> # Value
<del> if item_value > self.logs_list[item_index][4]:
<del> # MAX
<del> self.logs_list[item_index][4] = item_value
<del> elif item_value < self.logs_list[item_index][6]:
<del> # MIN
<del> self.logs_list[item_index][6] = item_value
<del> # AVG
<del> self.logs_list[item_index][7] += item_value
<del> self.logs_list[item_index][8] += 1
<del> self.logs_list[item_index][5] = (self.logs_list[item_index][7] /
<del> self.logs_list[item_index][8])
<del> # TOP PROCESS LIST
<del> # # Process list is sorted automaticaly
<del> # # Overwrite the user choise
<add> self._update_item(item_index, item_state, item_type, item_value,
<add> proc_list, proc_desc, peak_time)
<add>
<add> return self.len()
<add>
<add> def _create_item(self, item_state, item_type, item_value,
<add> proc_list, proc_desc, peak_time):
<add> """Create a new item in the log list"""
<add> if item_state == "WARNING" or item_state == "CRITICAL":
<add> # Define the automatic process sort key
<add> self.set_process_sort(item_type)
<add>
<add> # Create the new log item
<add> # Time is stored in Epoch format
<add> # Epoch -> DMYHMS = datetime.fromtimestamp(epoch)
<add> item = [
<add> time.mktime(datetime.now().timetuple()), # START DATE
<add> -1, # END DATE
<add> item_state, # STATE: WARNING|CRITICAL
<add> item_type, # TYPE: CPU, LOAD, MEM...
<add> item_value, # MAX
<add> item_value, # AVG
<add> item_value, # MIN
<add> item_value, # SUM
<add> 1, # COUNT
<add> # Process list is sorted automatically
<add> # Overwrite the user choice
<ide> # topprocess = sorted(proc_list, key=lambda process: process[process_auto_by],
<ide> # reverse=True)
<del> # # TOP PROCESS LIST
<del> # self.logs_list[item_index][9] = topprocess[0:3]
<del> self.logs_list[item_index][9] = []
<del> # MONITORED PROCESSES DESC
<del> self.logs_list[item_index][10] = proc_desc
<add> # topprocess[0:3], # TOP 3 PROCESS LIST
<add> [], # TOP 3 PROCESS LIST
<add> proc_desc] # MONITORED PROCESSES DESC
<ide>
<del> return self.len()
<add> # Add the item to the list
<add> self.logs_list.insert(0, item)
<add> if self.len() > self.logs_max:
<add> self.logs_list.pop()
<add>
<add> return True
<add> else:
<add> return False
<add>
<add> def _update_item(self, item_index, item_state, item_type, item_value,
<add> proc_list, proc_desc, peak_time):
<add> """Update a item in the log list"""
<add> if item_state == "OK" or item_state == "CAREFUL":
<add> # Reset the automatic process sort key
<add> self.reset_process_sort()
<add>
<add> endtime = time.mktime(datetime.now().timetuple())
<add> if endtime - self.logs_list[item_index][0] > peak_time:
<add> # If event is > peak_time seconds
<add> self.logs_list[item_index][1] = endtime
<add> else:
<add> # If event <= peak_time seconds, ignore
<add> self.logs_list.remove(self.logs_list[item_index])
<add> else:
<add> # Update the item
<add> # State
<add> if item_state == "CRITICAL":
<add> self.logs_list[item_index][2] = item_state
<add> # Value
<add> if item_value > self.logs_list[item_index][4]:
<add> # MAX
<add> self.logs_list[item_index][4] = item_value
<add> elif item_value < self.logs_list[item_index][6]:
<add> # MIN
<add> self.logs_list[item_index][6] = item_value
<add> # AVG
<add> self.logs_list[item_index][7] += item_value
<add> self.logs_list[item_index][8] += 1
<add> self.logs_list[item_index][5] = (self.logs_list[item_index][7] /
<add> self.logs_list[item_index][8])
<add> # TOP PROCESS LIST
<add> # # Process list is sorted automaticaly
<add> # # Overwrite the user choise
<add> # topprocess = sorted(proc_list, key=lambda process: process[process_auto_by],
<add> # reverse=True)
<add> # # TOP PROCESS LIST
<add> # self.logs_list[item_index][9] = topprocess[0:3]
<add> self.logs_list[item_index][9] = []
<add> # MONITORED PROCESSES DESC
<add> self.logs_list[item_index][10] = proc_desc
<add>
<add> return True
<ide>
<ide> def clean(self, critical=False):
<ide> """Clean the logs list by deleting finished items. | 1 |
Text | Text | make some adjustments | 086956b901b0b2031f0f63078ba14a6353a1a429 | <ide><path>curriculum/challenges/spanish/01-responsive-web-design/basic-html-and-html5/add-a-submit-button-to-a-form.spanish.md
<ide> localeTitle: Agregar un botón de envío a un formulario
<ide> ---
<ide>
<ide> ## Description
<del><section id="description"> Agreguemos un botón de <code>submit</code> a su formulario. Al hacer clic en este botón, los datos de su formulario se enviarán a la URL que especificó con el atributo de <code>action</code> su formulario. Aquí hay un ejemplo de botón de envío: <code><button type="submit">this button submits the form</button></code> </section>
<add><section id="description"> Agreguemos un botón <code>submit</code> a su formulario. Al hacer clic en este botón, los datos de su formulario se enviarán a la URL que especificó con el atributo <code>action</code> de su formulario. Aquí hay un ejemplo de botón <code>submit</code>: <code><button type="submit">this button submits the form</button></code> </section>
<ide>
<ide> ## Instructions
<del><section id="instructions"> Agregue un botón como el último elemento de su elemento de <code>form</code> con un tipo de <code>submit</code> y "Enviar" como texto. </section>
<add><section id="instructions"> Agregue un botón tipo <code>submit</code> con "Submit" como su texto, como el último elemento de su elemento <code>form</code>.</section>
<ide>
<ide> ## Tests
<ide> <section id='tests'>
<ide> localeTitle: Agregar un botón de envío a un formulario
<ide> tests:
<ide> - text: Su formulario debe tener un botón en su interior.
<ide> testString: 'assert($("form").children("button").length > 0, "Your form should have a button inside it.");'
<del> - text: Su botón de envío debe tener el <code>type</code> atributo establecido para <code>submit</code> .
<add> - text: Su botón de envío debe tener el atributo <code>type</code> establecido para <code>submit</code> .
<ide> testString: 'assert($("button").attr("type") === "submit", "Your submit button should have the attribute <code>type</code> set to <code>submit</code>.");'
<del> - text: Su botón de enviar solo debe tener el texto "Enviar".
<add> - text: Su botón de enviar solo debe tener el texto "Submit".
<ide> testString: 'assert($("button").text().match(/^\s*submit\s*$/gi), "Your submit button should only have the text "Submit".");'
<del> - text: Asegúrese de que el elemento de su <code>button</code> tenga una etiqueta de cierre.
<add> - text: Asegúrese de que su elemento <code>button</code> tenga una etiqueta de cierre.
<ide> testString: 'assert(code.match(/<\/button>/g) && code.match(/<button/g) && code.match(/<\/button>/g).length === code.match(/<button/g).length, "Make sure your <code>button</code> element has a closing tag.");'
<ide>
<ide> ``` | 1 |
Text | Text | release notes for 0.9.11 snow-maker | 1cdc050ce7b5ae37e27df064849384cf55938679 | <ide><path>CHANGELOG.md
<add><a name="0.9.11"><a/>
<ide> # <angular/> 0.9.11 snow-maker (in-progress) #
<ide>
<add>### Documentation
<add>- completed migration of docs from the wiki site to
<add> [http://docs.angularjs.org/](http://docs.angularjs.org/)
<add>- many, but by far not all, docs were updated, improved and cleaned up
<add>
<add>### Features
<add>- [`$route`](http://docs.angularjs.org/#!angular.service.$route) service now supports these
<add> features:
<add> - route not found handling via `#otherwise()`
<add> - redirection support via `#when('/foo', {redirectTo: '/bar'})` (including param interpolation)
<add> - setting the parent scope for scopes created by the service via `#parent()`
<add> - reloading the current route via `#reload()`
<add>
<ide> ### Bug Fixes
<ide> - <option> value attribute gets clobbered when the element contains new line character(s).
<add>- <ng:view> widget now works when nested inside an <ng:include> widget
<add>- other various small fixes
<add>
<add>### Breaking changes
<add>- mock [`$browser`](http://docs.angularjs.org/#!angular.mock.service.$browser) now throws an
<add> exception if the `flush()` method is called when there are no requests to be flushed. If you
<add> experience `No xhr requests to be flushed!` errors in your tests, it's because you called
<add> `$browser.xhr.flush()` unexpectedly. To make the error go away, either make sure your code makes a
<add> request via the `$xhr` service or remove all unneeded `flush()` calls.
<ide>
<ide>
<add><a name="0.9.10"><a/>
<ide> # <angular/> 0.9.10 flea-whisperer (2011-01-26) #
<ide>
<ide> ### Features
<ide> with the `$route` service
<ide> - lots of improvements related to formatting of the content of docs.anguarjs.org
<ide>
<ide>
<add><a name="0.9.9"><a/>
<ide> # <angular/> 0.9.9 time-shift (2011-01-13) #
<ide>
<ide> ### Security
<ide> with the `$route` service
<ide> - The `toString` method of the `angular.service.$location` service was removed. (commit 23875cb3)
<ide>
<ide>
<add><a name="0.9.8"><a/>
<ide> # <angular/> 0.9.8 astral-projection (2010-12-23) #
<ide>
<ide> ### Docs/Getting started
<ide> with the `$route` service
<ide> - Ignore input widgets which have no name (issue #153)
<ide>
<ide>
<add><a name="0.9.7"><a/>
<ide> # <angular/> 0.9.7 sonic-scream (2010-12-10) #
<ide>
<ide> ### Bug Fixes
<ide> with the `$route` service
<ide> your controllers. (commit e5e69d9b90850eb653883f52c76e28dd870ee067)
<ide>
<ide>
<add><a name="0.9.6"><a/>
<ide> # <angular/> 0.9.6 night-vision (2010-12-06) #
<ide>
<ide> ### Security
<ide> with the `$route` service
<ide> - The HTML sanitizer is slightly more strinct now. Please see info in the "Security" section above.
<ide>
<ide>
<add><a name="0.9.5"><a/>
<ide> # <angular/> 0.9.5 turkey-blast (2010-11-25) #
<ide>
<ide> ### Docs
<ide> with the `$route` service
<ide> - added `angular.Array.limitTo` to make it easy to select first or last few items of an array
<ide>
<ide>
<add><a name="0.9.4"><a/>
<ide> # <angular/> 0.9.4 total-recall (2010-11-18) #
<ide>
<ide> ### Docs
<ide> with the `$route` service
<ide> - Better error handling - compilation exception now contain stack trace (commit b2d63ac4)
<ide>
<ide>
<add><a name="0.9.3"><a/>
<ide> # <angular/> 0.9.3 cold-resistance (2010-11-10) #
<ide>
<ide> ### Docs
<ide> with the `$route` service
<ide> simple RegExp validator.
<ide>
<ide>
<add><a name="0.9.2"><a/>
<ide> # <angular/> 0.9.2 faunal-mimicry (2010-11-03) #
<ide>
<ide> ### Docs
<ide> with the `$route` service
<ide> implements HEAD
<ide>
<ide>
<add><a name="0.9.1"><a/>
<ide> # <angular/> 0.9.1 repulsion-field (2010-10-26) #
<ide>
<ide> ### Security
<ide> with the `$route` service
<ide> - html filter now sanitizes html content for XSS attacks which may result in different behavior
<ide>
<ide>
<add><a name="0.9.0"><a/>
<ide> # <angular/> 0.9.0 dragon-breath (2010-10-20) #
<ide>
<ide> ### Security | 1 |
Python | Python | fix syntax error for dimensiondatastatus object | 302b9bba33aeecbc2768c9d796845d31a2a1e9e4 | <ide><path>libcloud/common/dimensiondata.py
<ide> def __repr__(self):
<ide> return (('<DimensionDataStatus: action=%s, request_time=%s, '
<ide> 'user_name=%s, number_of_steps=%s, update_time=%s, '
<ide> 'step_name=%s, step_number=%s, '
<del> 'step_percent_complete=%s, failure_reason=%s')
<add> 'step_percent_complete=%s, failure_reason=%s>')
<ide> % (self.action, self.request_time, self.user_name,
<ide> self.number_of_steps, self.update_time, self.step_name,
<ide> self.step_number, self.step_percent_complete, | 1 |
Text | Text | correct typos in windows installation guide for go | 38294c5ce1f2f8c309deb1748016257fbf643c24 | <ide><path>guide/english/go/installing-go/windows-installer/index.md
<ide> title: Installing Go in Windows using the MSI Installer
<ide> ### Installing Go in Windows using the MSI Installer
<ide>
<ide> From the [golang's download page](https://golang.org/dl/), get the Windows MSI installer and run it. You'll have to pick between the 64bit and 32bit versions. If you don't know what architecture your Windows version is running, just do a quick Google search to find out.
<del>>Most current versions of Windows are 64bit, so you should be ok getting the 64bit version in the featured downloads section, but if your computer is quite old, the 32bit version should be the safest bet.
<add>>Most current versions of Windows are 64bit, so you should be okay getting the 64bit version in the featured downloads section, but if your computer is quite old, the 32bit version should be the safest bet.
<ide>
<del>##### 64-bit Windodows Installer
<add>##### 64-bit Windows Installer
<ide> 
<ide>
<del>##### 32-bit Windodows Installer
<add>##### 32-bit Windows Installer
<ide> 
<ide>
<ide> #### Check installation and version of go
<ide> To check if go was successfully installed, open your command prompt and use:
<ide> ```
<ide> > go version
<ide> ```
<del>This should print to the console the version of go, while at the same time making sure the installation went smoothly.
<add>This should print to the console the version of Go, while at the same time making sure the installation went smoothly. | 1 |
PHP | PHP | controllermiddleware` | 914582b4a6312a131db6935ef1939de3214fc7ca | <ide><path>src/Illuminate/Routing/Route.php
<ide> protected function controllerMiddleware()
<ide> $controller = $this->container->make($class);
<ide>
<ide> return (new ControllerDispatcher($this->router, $this->container))
<del> ->getMiddleware($controller, $method);
<add> ->getMiddleware($controller, $method);
<ide> }
<ide>
<ide> /** | 1 |
Javascript | Javascript | fix spurious autoscroll | 0a6d637619fe357ee44f43827487d2dbe6051486 | <ide><path>src/devtools/views/Components/Element.js
<ide> import React, {
<ide> Fragment,
<ide> useCallback,
<ide> useContext,
<del> useEffect,
<add> useLayoutEffect,
<ide> useMemo,
<ide> useRef,
<ide> } from 'react';
<ide> import styles from './Element.css';
<ide> type Props = {
<ide> index: number,
<ide> style: Object,
<add> // TODO: I can't get the correct type to work here:
<add> data: Object,
<ide> };
<ide>
<del>export default function ElementView({ index, style }: Props) {
<add>export default function ElementView({ index, style, data }: Props) {
<ide> const {
<ide> baseDepth,
<ide> getElementAtIndex,
<ide> selectOwner,
<ide> selectedElementID,
<ide> selectElementByID,
<ide> } = useContext(TreeContext);
<del>
<ide> const element = getElementAtIndex(index);
<ide>
<ide> const id = element === null ? null : element.id;
<ide> const isSelected = selectedElementID === id;
<add> const lastScrolledIDRef = data.lastScrolledIDRef;
<ide>
<ide> const handleDoubleClick = useCallback(() => {
<ide> if (id !== null) {
<ide> export default function ElementView({ index, style }: Props) {
<ide>
<ide> const ref = useRef<HTMLSpanElement | null>(null);
<ide>
<del> useEffect(() => {
<add> // The tree above has its own autoscrolling, but it only works for rows.
<add> // However, even when the row gets into the viewport, the component name
<add> // might be too far left or right on the screen. Adjust it in this case.
<add> useLayoutEffect(() => {
<ide> if (isSelected) {
<add> // Don't select the same item twice.
<add> // A row may appear and disappear just by scrolling:
<add> // https://github.com/bvaughn/react-devtools-experimental/issues/67
<add> // It doesn't necessarily indicate a user action.
<add> // TODO: we might want to revamp the autoscroll logic
<add> // to only happen explicitly for user-initiated events.
<add> if (lastScrolledIDRef.current === id) {
<add> return;
<add> }
<add> lastScrolledIDRef.current = id;
<add>
<ide> if (ref.current !== null) {
<ide> ref.current.scrollIntoView({
<ide> behavior: 'auto',
<ide> export default function ElementView({ index, style }: Props) {
<ide> });
<ide> }
<ide> }
<del> }, [isSelected]);
<add> }, [id, isSelected, lastScrolledIDRef]);
<ide>
<ide> // TODO Add click and key handlers for toggling element open/close state.
<ide>
<ide><path>src/devtools/views/Components/Tree.js
<ide> export default function Tree(props: Props) {
<ide> const { lineHeight } = useContext(SettingsContext);
<ide>
<ide> // Make sure a newly selected element is visible in the list.
<del> // This is helpful for things like the owners list.
<add> // This is helpful for things like the owners list and search.
<ide> useLayoutEffect(() => {
<ide> if (selectedElementIndex !== null && listRef.current != null) {
<ide> listRef.current.scrollToItem(selectedElementIndex);
<add> // Note this autoscroll only works for rows.
<add> // There's another autoscroll inside the elements
<add> // that ensures the component name is visible horizontally.
<add> // It's too early to do it now because the row might not exist yet.
<ide> }
<ide> }, [listRef, selectedElementIndex]);
<ide>
<add> // This ref is passed down the context to elements.
<add> // It lets them avoid autoscrolling to the same item many times
<add> // when a selected virtual row goes in and out of the viewport.
<add> const lastScrolledIDRef = useRef(null);
<add>
<ide> // Navigate the tree with up/down arrow keys.
<ide> useEffect(() => {
<ide> if (treeRef.current === null) {
<ide> export default function Tree(props: Props) {
<ide> baseDepth,
<ide> numElements,
<ide> getElementAtIndex,
<add> lastScrolledIDRef,
<ide> }),
<del> [baseDepth, numElements, getElementAtIndex]
<add> [baseDepth, numElements, getElementAtIndex, lastScrolledIDRef]
<ide> );
<ide>
<ide> return ( | 2 |
Text | Text | add installation help for ubuntu | 0b44bb7faefbaa48a06892e668b5211044c0fab8 | <ide><path>guide/english/r/index.md
<ide> Then install it on your computer. For help in installation refer to the [referen
<ide> * [Installing R on Windows](http://youtu.be/Ohnk9hcxf9M)
<ide> * [Installing R on Mac](https://youtu.be/uxuuWXU-7UQ)
<ide> * [Installing R on Unix-alikes](https://cran.r-project.org/doc/manuals/r-release/R-admin.html#Installing-R-under-Unix_002dalikes)
<add> * [Installing R on Ubuntu](https://cran.r-project.org/bin/linux/ubuntu/) | 1 |
Ruby | Ruby | remove unnecessary `connection_name` variable | f8b623919ad44d2f33ed6aeb5c57aa904d2fbe48 | <ide><path>activerecord/lib/active_record/migration/compatibility.rb
<ide> def index_name_for_remove(table_name, options = {})
<ide>
<ide> class V5_0 < V5_1
<ide> def create_table(table_name, options = {})
<del> connection_name = self.connection.adapter_name
<del> if connection_name == "PostgreSQL"
<add> if adapter_name == "PostgreSQL"
<ide> if options[:id] == :uuid && !options[:default]
<ide> options[:default] = "uuid_generate_v4()"
<ide> end | 1 |
Javascript | Javascript | add test for assert.notstrictequal() | 647826017edc27ac7e2b6677f50240279d5a5079 | <ide><path>test/parallel/test-assert.js
<ide> assert.throws(makeBlock(a.strictEqual, 2, '2'),
<ide> assert.throws(makeBlock(a.strictEqual, null, undefined),
<ide> a.AssertionError, 'strictEqual(null, undefined)');
<ide>
<add>assert.throws(makeBlock(a.notStrictEqual, 2, 2),
<add> a.AssertionError, 'notStrictEqual(2, 2)');
<add>
<ide> assert.doesNotThrow(makeBlock(a.notStrictEqual, 2, '2'),
<ide> 'notStrictEqual(2, \'2\')');
<ide> | 1 |
Javascript | Javascript | add color methods to prototype object | c8aacd8cdc98c69cf11281fbc86c18a9dd9c7113 | <ide><path>src/core/Color.js
<ide> THREE.Color = function ( hex ) {
<ide> this.hex;
<ide> this.__styleString = 'rgba(0, 0, 0, 1)';
<ide> */
<add>
<add> this.setHex( hex );
<add>
<add>}
<ide>
<del> this.setHex = function ( hex ) {
<add>THREE.Color.prototype = {
<add>
<add> setHex: function ( hex ) {
<ide>
<ide> this.hex = hex;
<ide> this.updateRGBA();
<ide> this.updateStyleString();
<ide>
<del> };
<add> },
<ide>
<del> this.setRGBA = function ( r, g, b, a ) {
<add> setRGBA: function ( r, g, b, a ) {
<ide>
<ide> this.r = r;
<ide> this.g = g;
<ide> THREE.Color = function ( hex ) {
<ide> this.updateHex();
<ide> this.updateStyleString();
<ide>
<del> };
<add> },
<ide>
<del> this.updateHex = function () {
<add> updateHex: function () {
<ide>
<ide> this.hex = Math.floor( this.a * 255 ) << 24 | Math.floor( this.r * 255 ) << 16 | Math.floor( this.g * 255 ) << 8 | Math.floor( this.b * 255 );
<ide>
<del> };
<add> },
<ide>
<del> this.updateRGBA = function () {
<add> updateRGBA: function () {
<ide>
<ide> this.a = ( this.hex >> 24 & 255 ) / 255;
<ide> this.r = ( this.hex >> 16 & 255 ) / 255;
<ide> this.g = ( this.hex >> 8 & 255 ) / 255;
<ide> this.b = ( this.hex & 255 ) / 255;
<ide>
<del> };
<add> },
<ide>
<del> this.updateStyleString = function () {
<add> updateStyleString: function () {
<ide>
<ide> this.__styleString = 'rgba(' + Math.floor( this.r * 255 ) + ',' + Math.floor( this.g * 255 ) + ',' + Math.floor( this.b * 255 ) + ',' + this.a + ')';
<ide>
<del> };
<add> },
<ide>
<del> this.toString = function () {
<add> toString: function () {
<ide>
<ide> return 'THREE.Color ( r: ' + this.r + ', g: ' + this.g + ', b: ' + this.b + ', a: ' + this.a + ', hex: ' + this.hex + ' )';
<ide>
<del> };
<del>
<del> this.setHex( hex );
<add> }
<ide>
<ide> }; | 1 |
PHP | PHP | add validator proxies for money() and multiple() | ebc9237795ae9d625aeb9622c18f7847f87ce4cd | <ide><path>src/Validation/Validator.php
<ide> public function integer($field, $message = null, $when = null)
<ide> ]);
<ide> }
<ide>
<add> /**
<add> * Add a validation rule to ensure a field is a money value.
<add> *
<add> * @param string $field The field you want to apply the rule to.
<add> * @param string $symbolPosition The position of the currency symbol
<add> * @param string|null $message The error message when the rule fails.
<add> * @param string|callable|null $when Either 'create' or 'update' or a callable that returns
<add> * true when the validation rule should be applied.
<add> * @see \Cake\Validation\Validation::money()
<add> * @return $this
<add> */
<add> public function money($field, $symbolPosition = 'left', $message = null, $when = null)
<add> {
<add> $extra = array_filter(['on' => $when, 'message' => $message]);
<add> return $this->add($field, 'money', $extra + [
<add> 'rule' => ['money', $symbolPosition]
<add> ]);
<add> }
<add>
<add> /**
<add> * Add a validation rule for a multiple select. Comparison is case sensitive by default.
<add> *
<add> * @param string $field The field you want to apply the rule to.
<add> * @param array $options The options for the validator. Includes the options defined in
<add> * \Cake\Validation\Validation::multiple() and the `caseInsensitive` parameter.
<add> * @param string|null $message The error message when the rule fails.
<add> * @param string|callable|null $when Either 'create' or 'update' or a callable that returns
<add> * true when the validation rule should be applied.
<add> * @see \Cake\Validation\Validation::multiple()
<add> * @return $this
<add> */
<add> public function multiple($field, array $options = [], $message = null, $when = null)
<add> {
<add> $extra = array_filter(['on' => $when, 'message' => $message]);
<add> $caseInsensitive = isset($options['caseInsenstive']) ? $options['caseInsensitive'] : false;
<add> unset($options['caseInsensitive']);
<add> return $this->add($field, 'multiple', $extra + [
<add> 'rule' => ['multiple', $options, $caseInsensitive]
<add> ]);
<add> }
<add>
<ide> /**
<ide> * Returns whether or not a field can be left empty for a new or already existing
<ide> * record.
<ide><path>tests/TestCase/Validation/ValidatorTest.php
<ide> public function testInteger()
<ide> $this->assertNotEmpty($validator->errors(['username' => 'not integer']));
<ide> }
<ide>
<add> /**
<add> * Tests the money proxy method
<add> *
<add> * @return void
<add> */
<add> public function testMoney()
<add> {
<add> $validator = new Validator();
<add> $this->assertProxyMethod($validator, 'money', 'left', ['left']);
<add> $this->assertNotEmpty($validator->errors(['username' => 'not money']));
<add> }
<add>
<add> /**
<add> * Tests the multiple proxy method
<add> *
<add> * @return void
<add> */
<add> public function testMultiple()
<add> {
<add> $validator = new Validator();
<add> $this->assertProxyMethod(
<add> $validator,
<add> 'multiple',
<add> ['min' => 1, 'caseInsensitive' => true],
<add> [['min' => 1], false]
<add> );
<add> $this->assertNotEmpty($validator->errors(['username' => '']));
<add> }
<add>
<ide> protected function assertProxyMethod($validator, $method, $extra = null, $pass = [], $name = null)
<ide> {
<ide> $name = $name ?: $method; | 2 |
Javascript | Javascript | move touchhistorymath to react native repo | cf649b40a56dc5c0ffe2595b963847f0ff8de245 | <ide><path>packages/events/TouchHistoryMath.js
<del>/**
<del> * Copyright (c) 2016-present, Facebook, Inc.
<del> *
<del> * This source code is licensed under the MIT license found in the
<del> * LICENSE file in the root directory of this source tree.
<del> */
<del>
<del>const TouchHistoryMath = {
<del> /**
<del> * This code is optimized and not intended to look beautiful. This allows
<del> * computing of touch centroids that have moved after `touchesChangedAfter`
<del> * timeStamp. You can compute the current centroid involving all touches
<del> * moves after `touchesChangedAfter`, or you can compute the previous
<del> * centroid of all touches that were moved after `touchesChangedAfter`.
<del> *
<del> * @param {TouchHistoryMath} touchHistory Standard Responder touch track
<del> * data.
<del> * @param {number} touchesChangedAfter timeStamp after which moved touches
<del> * are considered "actively moving" - not just "active".
<del> * @param {boolean} isXAxis Consider `x` dimension vs. `y` dimension.
<del> * @param {boolean} ofCurrent Compute current centroid for actively moving
<del> * touches vs. previous centroid of now actively moving touches.
<del> * @return {number} value of centroid in specified dimension.
<del> */
<del> centroidDimension: function(
<del> touchHistory,
<del> touchesChangedAfter,
<del> isXAxis,
<del> ofCurrent,
<del> ) {
<del> const touchBank = touchHistory.touchBank;
<del> let total = 0;
<del> let count = 0;
<del>
<del> const oneTouchData =
<del> touchHistory.numberActiveTouches === 1
<del> ? touchHistory.touchBank[touchHistory.indexOfSingleActiveTouch]
<del> : null;
<del>
<del> if (oneTouchData !== null) {
<del> if (
<del> oneTouchData.touchActive &&
<del> oneTouchData.currentTimeStamp > touchesChangedAfter
<del> ) {
<del> total +=
<del> ofCurrent && isXAxis
<del> ? oneTouchData.currentPageX
<del> : ofCurrent && !isXAxis
<del> ? oneTouchData.currentPageY
<del> : !ofCurrent && isXAxis
<del> ? oneTouchData.previousPageX
<del> : oneTouchData.previousPageY;
<del> count = 1;
<del> }
<del> } else {
<del> for (let i = 0; i < touchBank.length; i++) {
<del> const touchTrack = touchBank[i];
<del> if (
<del> touchTrack !== null &&
<del> touchTrack !== undefined &&
<del> touchTrack.touchActive &&
<del> touchTrack.currentTimeStamp >= touchesChangedAfter
<del> ) {
<del> let toAdd; // Yuck, program temporarily in invalid state.
<del> if (ofCurrent && isXAxis) {
<del> toAdd = touchTrack.currentPageX;
<del> } else if (ofCurrent && !isXAxis) {
<del> toAdd = touchTrack.currentPageY;
<del> } else if (!ofCurrent && isXAxis) {
<del> toAdd = touchTrack.previousPageX;
<del> } else {
<del> toAdd = touchTrack.previousPageY;
<del> }
<del> total += toAdd;
<del> count++;
<del> }
<del> }
<del> }
<del> return count > 0 ? total / count : TouchHistoryMath.noCentroid;
<del> },
<del>
<del> currentCentroidXOfTouchesChangedAfter: function(
<del> touchHistory,
<del> touchesChangedAfter,
<del> ) {
<del> return TouchHistoryMath.centroidDimension(
<del> touchHistory,
<del> touchesChangedAfter,
<del> true, // isXAxis
<del> true, // ofCurrent
<del> );
<del> },
<del>
<del> currentCentroidYOfTouchesChangedAfter: function(
<del> touchHistory,
<del> touchesChangedAfter,
<del> ) {
<del> return TouchHistoryMath.centroidDimension(
<del> touchHistory,
<del> touchesChangedAfter,
<del> false, // isXAxis
<del> true, // ofCurrent
<del> );
<del> },
<del>
<del> previousCentroidXOfTouchesChangedAfter: function(
<del> touchHistory,
<del> touchesChangedAfter,
<del> ) {
<del> return TouchHistoryMath.centroidDimension(
<del> touchHistory,
<del> touchesChangedAfter,
<del> true, // isXAxis
<del> false, // ofCurrent
<del> );
<del> },
<del>
<del> previousCentroidYOfTouchesChangedAfter: function(
<del> touchHistory,
<del> touchesChangedAfter,
<del> ) {
<del> return TouchHistoryMath.centroidDimension(
<del> touchHistory,
<del> touchesChangedAfter,
<del> false, // isXAxis
<del> false, // ofCurrent
<del> );
<del> },
<del>
<del> currentCentroidX: function(touchHistory) {
<del> return TouchHistoryMath.centroidDimension(
<del> touchHistory,
<del> 0, // touchesChangedAfter
<del> true, // isXAxis
<del> true, // ofCurrent
<del> );
<del> },
<del>
<del> currentCentroidY: function(touchHistory) {
<del> return TouchHistoryMath.centroidDimension(
<del> touchHistory,
<del> 0, // touchesChangedAfter
<del> false, // isXAxis
<del> true, // ofCurrent
<del> );
<del> },
<del>
<del> noCentroid: -1,
<del>};
<del>
<del>export default TouchHistoryMath;
<ide><path>packages/react-native-renderer/src/ReactFabric.js
<ide> import './ReactFabricInjection';
<ide>
<ide> import * as ReactPortal from 'shared/ReactPortal';
<ide> import * as ReactGenericBatching from 'events/ReactGenericBatching';
<del>import TouchHistoryMath from 'events/TouchHistoryMath';
<ide> import ReactVersion from 'shared/ReactVersion';
<ide>
<ide> import NativeMethodsMixin from './NativeMethodsMixin';
<ide> const ReactFabric: ReactNativeType = {
<ide> ReactNativeBridgeEventPlugin, // requireNativeComponent
<ide> ReactNativeComponentTree, // ScrollResponder
<ide> ReactNativePropRegistry, // flattenStyle, Stylesheet
<del> TouchHistoryMath, // PanResponder
<ide> createReactNativeComponentClass, // RCTText, RCTView, ReactNativeART
<ide> takeSnapshot, // react-native-implementation
<ide> },
<ide><path>packages/react-native-renderer/src/ReactNativeRenderer.js
<ide> import './ReactNativeInjection';
<ide>
<ide> import * as ReactPortal from 'shared/ReactPortal';
<ide> import * as ReactGenericBatching from 'events/ReactGenericBatching';
<del>import TouchHistoryMath from 'events/TouchHistoryMath';
<ide> import ReactVersion from 'shared/ReactVersion';
<ide> // Module provided by RN:
<ide> import UIManager from 'UIManager';
<ide> const ReactNativeRenderer: ReactNativeType = {
<ide> ReactNativeBridgeEventPlugin, // requireNativeComponent
<ide> ReactNativeComponentTree, // ScrollResponder
<ide> ReactNativePropRegistry, // flattenStyle, Stylesheet
<del> TouchHistoryMath, // PanResponder
<ide> createReactNativeComponentClass, // RCTText, RCTView, ReactNativeART
<ide> takeSnapshot, // react-native-implementation
<ide> computeComponentStackForErrorReporting,
<ide><path>scripts/rollup/shims/react-native/TouchHistoryMath.js
<del>/**
<del> * Copyright (c) 2013-present, Facebook, Inc.
<del> *
<del> * This source code is licensed under the MIT license found in the
<del> * LICENSE file in the root directory of this source tree.
<del> *
<del> * @providesModule TouchHistoryMath
<del> */
<del>
<del>'use strict';
<del>
<del>const {
<del> __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,
<del>} = require('ReactNative');
<del>
<del>module.exports =
<del> __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.TouchHistoryMath; | 4 |
Javascript | Javascript | fix the stepper beyond page 1 | 3a824f69d4395c50bbc8fdd0d5178a62c37a688c | <ide><path>web/debugger.js
<ide> var StepperManager = (function StepperManagerClosure() {
<ide> this.selectStepper(pageNumber, false);
<ide> return stepper;
<ide> },
<del> selectStepper: function selectStepper(pageNumber, selectPanel) {
<add> selectStepper: function selectStepper(pageNumber, selectPanel, change) {
<ide> if (selectPanel)
<ide> this.manager.selectPanel(1);
<ide> for (var i = 0; i < steppers.length; ++i) {
<ide> var StepperManager = (function StepperManagerClosure() {
<ide> else
<ide> stepper.panel.setAttribute('hidden', true);
<ide> }
<add> var options = stepperChooser.options;
<add> for (var i = 0; i < options.length; ++i) {
<add> var option = options[i];
<add> option.selected = option.value == pageNumber;
<add> }
<ide> },
<ide> saveBreakPoints: function saveBreakPoints(pageNumber, bps) {
<ide> breakPoints[pageNumber] = bps;
<ide> var Stepper = (function StepperClosure() {
<ide> for (var i = 0; i < IRQueue.fnArray.length; i++) {
<ide> var line = c('tr');
<ide> line.className = 'line';
<del> line.id = 'idx' + i;
<add> line.dataset.idx = i;
<ide> table.appendChild(line);
<ide> var checked = this.breakPoints.indexOf(i) != -1;
<ide> var args = IRQueue.argsArray[i] ? IRQueue.argsArray[i] : [];
<ide> var Stepper = (function StepperClosure() {
<ide> },
<ide> goTo: function goTo(idx) {
<ide> var allRows = this.panel.getElementsByClassName('line');
<del> for (var x = 0; x < allRows.length; x++) {
<del> allRows[x].style.backgroundColor = null;
<del> }
<del> var row = document.getElementById('idx' + idx);
<del> if (row) {
<del> row.style.backgroundColor = 'rgb(251,250,207)';
<del> row.scrollIntoView();
<add> for (var x = 0, xx = allRows.length; x < xx; ++x) {
<add> var row = allRows[x];
<add> if (row.dataset.idx == idx) {
<add> row.style.backgroundColor = 'rgb(251,250,207)';
<add> row.scrollIntoView();
<add> } else {
<add> row.style.backgroundColor = null;
<add> }
<ide> }
<ide> }
<ide> }; | 1 |
PHP | PHP | use assertsame in test case cakephp | 672760ca9d016b722709d6d234a10e0e2c7ffb42 | <ide><path>tests/TestCase/ORM/EntityTest.php
<ide> public function testSetMultiplePropertiesNoSetters()
<ide> $this->assertEquals(1, $entity->getOriginal('id'));
<ide>
<ide> $entity->set(['foo', 'bar']);
<del> $this->assertEquals('foo', $entity->get('0'));
<del> $this->assertEquals('bar', $entity->get('1'));
<add> $this->assertSame('foo', $entity->get('0'));
<add> $this->assertSame('bar', $entity->get('1'));
<ide>
<ide> $entity->set(['sample']);
<del> $this->assertEquals('sample', $entity->get('0'));
<add> $this->assertSame('sample', $entity->get('0'));
<ide> }
<ide>
<ide> /**
<ide><path>tests/TestCase/ORM/MarshallerTest.php
<ide> public function testOneWithNumericField()
<ide> ];
<ide> $marshall = new Marshaller($this->articles);
<ide> $result = $marshall->one($data, []);
<del> $this->assertEquals($data[0], $result->get('0'));
<del> $this->assertEquals($data[1], $result->get('1'));
<add> $this->assertSame($data[0], $result->get('0'));
<add> $this->assertSame($data[1], $result->get('1'));
<ide> }
<ide>
<ide> /** | 2 |
Java | Java | remove line break | 9520d6328687bb3ab259097c4b203bfc0ec262df | <ide><path>rxjava-core/src/main/java/rx/operators/OperatorSubscribeOn.java
<ide> public OperatorSubscribeOn(Scheduler scheduler) {
<ide> }
<ide>
<ide> @Override
<del> public Subscriber<? super Observable<T>> call(
<del> final Subscriber<? super T> subscriber) {
<add> public Subscriber<? super Observable<T>> call(final Subscriber<? super T> subscriber) {
<ide> return new Subscriber<Observable<T>>() {
<ide>
<ide> @Override | 1 |
Python | Python | add 0d structured indexing benchmark | 8cf5b506d2d3da833b09e8bbbe874db6f9c5e809 | <ide><path>benchmarks/benchmarks/bench_indexing.py
<ide> def time_mmap_slicing(self):
<ide> def time_mmap_fancy_indexing(self):
<ide> for i in range(1000):
<ide> self.fp[self.indexes]
<add>
<add>
<add>class IndexingStructured0D(Benchmark):
<add> def setup(self):
<add> self.dt = np.dtype([('a', 'f4', 256)])
<add>
<add> self.A = np.zeros((), self.dt)
<add> self.B = self.A.copy()
<add>
<add> self.a = np.zeros(1, self.dt)[0]
<add> self.b = self.a.copy()
<add>
<add> def time_array_slice(self):
<add> self.B['a'][:] = self.A['a']
<add>
<add> def time_array_all(self):
<add> self.B['a'] = self.A['a']
<add>
<add> def time_scalar_slice(self):
<add> self.b['a'][:] = self.a['a']
<add>
<add> def time_scalar_all(self):
<add> self.b['a'] = self.a['a'] | 1 |
Python | Python | add chinesedefaults class for pickling | f27859fa99b90f465d8b8b8c937d0a178e63fcb4 | <ide><path>spacy/lang/zh/__init__.py
<ide> # coding: utf8
<ide> from __future__ import unicode_literals
<ide>
<add>from ...attrs import LANG
<ide> from ...language import Language
<ide> from ...tokens import Doc
<ide>
<ide>
<add>class ChineseDefaults(Language.Defaults):
<add> lex_attr_getters = dict(Language.Defaults.lex_attr_getters)
<add> lex_attr_getters[LANG] = lambda text: 'zh' # for pickling
<add>
<add>
<ide> class Chinese(Language):
<ide> lang = 'zh'
<add> Defaults = ChineseDefaults # override defaults
<ide>
<ide> def make_doc(self, text):
<ide> try: | 1 |
Python | Python | improve output on trainer | 1224c4d3c6eaa6e94c6eea312289ebe1c6bedbc9 | <ide><path>spacy/train.py
<ide> from __future__ import unicode_literals
<ide>
<ide> import random
<add>import tqdm
<ide> from .gold import GoldParse
<ide> from .scorer import Scorer
<ide> from .gold import merge_sents
<ide> class Trainer(object):
<ide> def __init__(self, nlp, gold_tuples):
<ide> self.nlp = nlp
<ide> self.gold_tuples = gold_tuples
<add> self.nr_epoch = 0
<ide>
<ide> def epochs(self, nr_epoch, augment_data=None, gold_preproc=False):
<ide> cached_golds = {}
<ide> def _epoch(indices):
<del> for i in indices:
<add> for i in tqdm.tqdm(indices):
<ide> raw_text, paragraph_tuples = self.gold_tuples[i]
<ide> if gold_preproc:
<ide> raw_text = None
<ide> def _epoch(indices):
<ide> for itn in range(nr_epoch):
<ide> random.shuffle(indices)
<ide> yield _epoch(indices)
<del>
<add> self.nr_epoch += 1
<add>
<ide> def update(self, doc, gold):
<ide> for process in self.nlp.pipeline:
<ide> if hasattr(process, 'update'):
<del> process.update(doc, gold)
<add> loss = process.update(doc, gold, itn=self.nr_epoch)
<ide> process(doc)
<ide> return doc
<ide> | 1 |
Javascript | Javascript | return instance of ping, rather than constructor | e2173f9101545b60367fd95524232fb8cf2eabca | <ide><path>src/auto/injector.js
<ide> function annotate(fn) {
<ide> * Here is an example of registering a service using
<ide> * {@link AUTO.$provide#methods_service $provide.service(class)}.
<ide> * <pre>
<del> * $provide.service('ping', ['$http', function($http) {
<del> * var Ping = function() {
<del> * this.$http = $http;
<del> * };
<del> *
<del> * Ping.prototype.send = function() {
<del> * return this.$http.get('/ping');
<del> * };
<add> * var Ping = function($http) {
<add> * this.$http = $http;
<add> * };
<add> *
<add> * Ping.$inject = ['$http'];
<ide> *
<del> * return Ping;
<del> * }]);
<add> * Ping.prototype.send = function() {
<add> * return this.$http.get('/ping');
<add> * };
<add> * $provide.service('ping', Ping);
<ide> * </pre>
<ide> * You would then inject and use this service like this:
<ide> * <pre> | 1 |
Python | Python | add unit test for kwarg of np.einsum | ebd4a90b26086985cda65f79fbfeb6449cb5ba6b | <ide><path>numpy/core/tests/test_einsum.py
<ide> def test_einsum_misc(self):
<ide> [[[1, 3], [3, 9], [5, 15], [7, 21]],
<ide> [[8, 16], [16, 32], [24, 48], [32, 64]]])
<ide>
<add> # Ensure explicitly setting out=None does not cause an error
<add> # see issue gh-15776 and issue gh-15256
<add> assert_equal(np.einsum('i,j', [1], [2], out=None), [[2]])
<add>
<ide> def test_subscript_range(self):
<ide> # Issue #7741, make sure that all letters of Latin alphabet (both uppercase & lowercase) can be used
<ide> # when creating a subscript from arrays | 1 |
PHP | PHP | correct param order | 4d8090b332ec30c80c54eb16a61134cf09562c7f | <ide><path>src/Illuminate/Notifications/Events/NotificationFailed.php
<ide> class NotificationFailed
<ide> */
<ide> public function __construct($notifiable, $notification, $channel, $data = [])
<ide> {
<add> $this->data = $data;
<ide> $this->channel = $channel;
<ide> $this->notifiable = $notifiable;
<ide> $this->notification = $notification;
<del> $this->data = $data;
<ide> }
<ide> } | 1 |
Python | Python | add test_remove_unused_code to quarantined test | 6b451360c01df13259d4ee4bb1a4125a2c771654 | <ide><path>tests/models/test_dagcode.py
<ide> import unittest
<ide> from datetime import timedelta
<ide>
<add>import pytest
<ide> from mock import patch
<ide>
<ide> from airflow import AirflowException, example_dags as example_dags_module, models
<ide> def test_detecting_duplicate_key(self, mock_hash):
<ide> with self.assertRaises(AirflowException):
<ide> self._write_two_example_dags()
<ide>
<add> @pytest.mark.quarantined
<ide> def test_remove_unused_code(self):
<ide> example_dags = make_example_dags(example_dags_module)
<ide> self._write_example_dags() | 1 |
Javascript | Javascript | consolidate id attribute markup generation | 9d119577eaf659238811f0315a1c7a0cf3c7fb3f | <ide><path>src/core/ReactDOMComponent.js
<ide> ReactDOMComponent.Mixin = {
<ide> }
<ide> }
<ide>
<del> var escapedID = escapeTextForBrowser(this._rootNodeID);
<del> return ret + ' ' + ReactMount.ATTR_NAME + '="' + escapedID + '">';
<add> var idMarkup = DOMPropertyOperations.createMarkupForProperty(
<add> ReactMount.ATTR_NAME,
<add> this._rootNodeID
<add> );
<add> return ret + ' ' + idMarkup + '>';
<ide> },
<ide>
<ide> /**
<ide><path>src/core/ReactTextComponent.js
<ide>
<ide> "use strict";
<ide>
<add>var DOMPropertyOperations = require('DOMPropertyOperations');
<ide> var ReactComponent = require('ReactComponent');
<ide> var ReactMount = require('ReactMount');
<ide>
<ide> mixInto(ReactTextComponent, {
<ide> transaction,
<ide> mountDepth
<ide> );
<add> var idMarkup = DOMPropertyOperations.createMarkupForProperty(
<add> ReactMount.ATTR_NAME,
<add> rootID
<add> );
<ide> return (
<del> '<span ' + ReactMount.ATTR_NAME + '="' + escapeTextForBrowser(rootID) + '">' +
<add> '<span ' + idMarkup + '>' +
<ide> escapeTextForBrowser(this.props.text) +
<ide> '</span>'
<ide> );
<ide><path>src/core/__tests__/ReactEventTopLevelCallback-test.js
<ide> * limitations under the License.
<ide> *
<ide> * @emails react-core
<add> * @jsx React.DOM
<ide> */
<ide>
<ide> 'use strict';
<ide>
<ide> require('mock-modules')
<del> .dontMock('ReactEventTopLevelCallback')
<del> .dontMock('ReactMount')
<del> .dontMock('ReactInstanceHandles')
<del> .dontMock('ReactDOM')
<ide> .mock('ReactEventEmitter');
<ide>
<ide> var EVENT_TARGET_PARAM = 1;
<ide>
<ide> describe('ReactEventTopLevelCallback', function() {
<ide> var React;
<ide> var ReactEventTopLevelCallback;
<del> var ReactDOM;
<add> var ReactMount;
<ide> var ReactEventEmitter; // mocked
<ide>
<ide> beforeEach(function() {
<ide> require('mock-modules').dumpCache();
<ide> React = require('React');
<ide> ReactEventTopLevelCallback = require('ReactEventTopLevelCallback');
<del> ReactDOM = require('ReactDOM');
<add> ReactMount = require('ReactMount');
<ide> ReactEventEmitter = require('ReactEventEmitter'); // mocked
<ide> });
<ide>
<ide> describe('Propagation', function() {
<ide> it('should propagate events one level down', function() {
<ide> var childContainer = document.createElement('div');
<del> var childControl = ReactDOM.div({}, 'Child');
<add> var childControl = <div>Child</div>;
<ide> var parentContainer = document.createElement('div');
<del> var parentControl = ReactDOM.div({}, 'Parent');
<del> React.renderComponent(childControl, childContainer);
<del> React.renderComponent(parentControl, parentContainer);
<add> var parentControl = <div>Parent</div>;
<add> ReactMount.renderComponent(childControl, childContainer);
<add> ReactMount.renderComponent(parentControl, parentContainer);
<ide> parentControl.getDOMNode().appendChild(childContainer);
<ide>
<ide> var callback = ReactEventTopLevelCallback.createTopLevelCallback('test');
<ide> describe('ReactEventTopLevelCallback', function() {
<ide>
<ide> it('should propagate events two levels down', function() {
<ide> var childContainer = document.createElement('div');
<del> var childControl = ReactDOM.div({}, 'Child');
<add> var childControl = <div>Child</div>;
<ide> var parentContainer = document.createElement('div');
<del> var parentControl = ReactDOM.div({}, 'Parent');
<add> var parentControl = <div>Parent</div>;
<ide> var grandParentContainer = document.createElement('div');
<del> var grandParentControl = ReactDOM.div({}, 'Parent');
<del> React.renderComponent(childControl, childContainer);
<del> React.renderComponent(parentControl, parentContainer);
<del> React.renderComponent(grandParentControl, grandParentContainer);
<add> var grandParentControl = <div>Parent</div>;
<add> ReactMount.renderComponent(childControl, childContainer);
<add> ReactMount.renderComponent(parentControl, parentContainer);
<add> ReactMount.renderComponent(grandParentControl, grandParentContainer);
<ide> parentControl.getDOMNode().appendChild(childContainer);
<ide> grandParentControl.getDOMNode().appendChild(parentContainer);
<ide>
<ide> describe('ReactEventTopLevelCallback', function() {
<ide>
<ide> it('should not fire duplicate events for a React DOM tree', function() {
<ide> var container = document.createElement('div');
<del> var inner = ReactDOM.div({}, 'Inner');
<del> var control = ReactDOM.div({}, [
<del> ReactDOM.div({id: 'outer'}, inner)
<del> ]);
<del> React.renderComponent(control, container);
<add> var inner = <div>Inner</div>;
<add> var control = <div><div id="outer">{inner}</div></div>;
<add> ReactMount.renderComponent(control, container);
<ide>
<ide> var callback = ReactEventTopLevelCallback.createTopLevelCallback('test');
<ide> callback({ | 3 |
Javascript | Javascript | pass a valid socket on `tlsclienterror` | 7f7a899fa5f3b192d4f503f6602f24f7ff4ec57a | <ide><path>lib/_tls_wrap.js
<ide> function onerror(err) {
<ide> if (!owner._secureEstablished) {
<ide> // When handshake fails control is not yet released,
<ide> // so self._tlsError will return null instead of actual error
<add>
<add> // Set closing the socket after emitting an event since the socket needs to
<add> // be accessible when the `tlsClientError` event is emmited.
<add> owner._closeAfterHandlingError = true;
<ide> owner.destroy(err);
<ide> } else if (owner._tlsOptions?.isServer &&
<ide> owner._rejectUnauthorized &&
<ide><path>lib/net.js
<ide> const {
<ide> uvExceptionWithHostPort,
<ide> } = require('internal/errors');
<ide> const { isUint8Array } = require('internal/util/types');
<add>const { queueMicrotask } = require('internal/process/task_queues');
<ide> const {
<ide> validateAbortSignal,
<ide> validateFunction,
<ide> function initSocketHandle(self) {
<ide> }
<ide> }
<ide>
<add>function closeSocketHandle(self, isException, isCleanupPending = false) {
<add> if (self._handle) {
<add> self._handle.close(() => {
<add> debug('emit close');
<add> self.emit('close', isException);
<add> if (isCleanupPending) {
<add> self._handle.onread = noop;
<add> self._handle = null;
<add> self._sockname = null;
<add> }
<add> });
<add> }
<add>}
<ide>
<ide> const kBytesRead = Symbol('kBytesRead');
<ide> const kBytesWritten = Symbol('kBytesWritten');
<ide> function Socket(options) {
<ide> this[kBuffer] = null;
<ide> this[kBufferCb] = null;
<ide> this[kBufferGen] = null;
<add> this._closeAfterHandlingError = false;
<ide>
<ide> if (typeof options === 'number')
<ide> options = { fd: options }; // Legacy interface.
<ide> Socket.prototype._destroy = function(exception, cb) {
<ide> });
<ide> if (err)
<ide> this.emit('error', errnoException(err, 'reset'));
<add> } else if (this._closeAfterHandlingError) {
<add> // Enqueue closing the socket as a microtask, so that the socket can be
<add> // accessible when an `error` event is handled in the `next tick queue`.
<add> queueMicrotask(() => closeSocketHandle(this, isException, true));
<ide> } else {
<del> this._handle.close(() => {
<del> debug('emit close');
<del> this.emit('close', isException);
<del> });
<add> closeSocketHandle(this, isException);
<add> }
<add>
<add> if (!this._closeAfterHandlingError) {
<add> this._handle.onread = noop;
<add> this._handle = null;
<add> this._sockname = null;
<ide> }
<del> this._handle.onread = noop;
<del> this._handle = null;
<del> this._sockname = null;
<ide> cb(exception);
<ide> } else {
<ide> cb(exception);
<ide><path>test/internet/test-https-issue-43963.js
<add>'use strict';
<add>const common = require('../common');
<add>const https = require('node:https');
<add>const assert = require('node:assert');
<add>
<add>const server = https.createServer();
<add>
<add>server.on(
<add> 'tlsClientError',
<add> common.mustCall((exception, tlsSocket) => {
<add> assert.strictEqual(exception !== undefined, true);
<add> assert.strictEqual(Object.keys(tlsSocket.address()).length !== 0, true);
<add> assert.strictEqual(tlsSocket.localAddress !== undefined, true);
<add> assert.strictEqual(tlsSocket.localPort !== undefined, true);
<add> assert.strictEqual(tlsSocket.remoteAddress !== undefined, true);
<add> assert.strictEqual(tlsSocket.remoteFamily !== undefined, true);
<add> assert.strictEqual(tlsSocket.remotePort !== undefined, true);
<add> }),
<add>);
<add>
<add>server.listen(0, () => {
<add> const req = https.request({
<add> hostname: '127.0.0.1',
<add> port: server.address().port,
<add> });
<add> req.on(
<add> 'error',
<add> common.mustCall(() => server.close()),
<add> );
<add> req.end();
<add>}); | 3 |
Javascript | Javascript | fix endof handling of no-arg and ms | 9021abfc609ef8c774330fdfafab832270b1588b | <ide><path>moment.js
<ide>
<ide> endOf: function (units) {
<ide> units = normalizeUnits(units);
<add> if (units === undefined || units === 'millisecond') {
<add> return this;
<add> }
<ide> return this.startOf(units).add(1, (units === 'isoWeek' ? 'week' : units)).subtract(1, 'ms');
<ide> },
<ide>
<ide><path>test/moment/sod_eod.js
<ide> exports.endStartOf = {
<ide>
<ide> moment.updateOffset = oldUpdateOffset;
<ide>
<add> test.done();
<add> },
<add>
<add> 'endOf millisecond and no-arg' : function (test) {
<add> var m = moment();
<add> test.equal(+m, +m.clone().endOf(), 'endOf without argument should change time');
<add> test.equal(+m, +m.clone().endOf('ms'), 'endOf with ms argument should change time');
<add> test.equal(+m, +m.clone().endOf('millisecond'), 'endOf with millisecond argument should change time');
<add> test.equal(+m, +m.clone().endOf('milliseconds'), 'endOf with milliseconds argument should change time');
<ide> test.done();
<ide> }
<ide> }; | 2 |
Go | Go | move route type to common arch file | dadd54dba395f68c492a8ce5e2bf9488f9db0830 | <ide><path>pkg/netlink/netlink.go
<add>// Packet netlink provide access to low level Netlink sockets and messages.
<add>//
<add>// Actual implementations are in:
<add>// netlink_linux.go
<add>// netlink_darwin.go
<add>package netlink
<add>
<add>import "net"
<add>
<add>// A Route is a subnet associated with the interface to reach it.
<add>type Route struct {
<add> *net.IPNet
<add> Iface *net.Interface
<add> Default bool
<add>}
<ide><path>pkg/netlink/netlink_linux.go
<ide> func NetworkLinkAdd(name string, linkType string) error {
<ide> return s.HandleAck(wb.Seq)
<ide> }
<ide>
<del>// A Route is a subnet associated with the interface to reach it.
<del>type Route struct {
<del> *net.IPNet
<del> Iface *net.Interface
<del> Default bool
<del>}
<del>
<ide> // Returns an array of IPNet for all the currently routed subnets on ipv4
<ide> // This is similar to the first column of "ip route" output
<ide> func NetworkGetRoutes() ([]Route, error) { | 2 |
PHP | PHP | use double quotes; remove un-used fonts | 530c8187f556d1b39c3a33a403f077a030ac9905 | <ide><path>resources/views/welcome.blade.php
<ide> <title>Laravel</title>
<ide>
<ide> <!-- Fonts -->
<del> <link href='https://fonts.googleapis.com/css?family=Raleway:100,400,300,600' rel='stylesheet' type='text/css'>
<add> <link href="https://fonts.googleapis.com/css?family=Raleway:100,600" rel="stylesheet" type="text/css">
<ide>
<ide> <!-- Styles -->
<ide> <style> | 1 |
Java | Java | remove resourceservlet (deprecated in 4.3) | 9bcc7c3b06f0e693269cbd37726ea6b27af952ec | <ide><path>spring-webmvc/src/main/java/org/springframework/web/servlet/ResourceServlet.java
<del>/*
<del> * Copyright 2002-2016 the original author or authors.
<del> *
<del> * Licensed under the Apache License, Version 2.0 (the "License");
<del> * you may not use this file except in compliance with the License.
<del> * You may obtain a copy of the License at
<del> *
<del> * http://www.apache.org/licenses/LICENSE-2.0
<del> *
<del> * Unless required by applicable law or agreed to in writing, software
<del> * distributed under the License is distributed on an "AS IS" BASIS,
<del> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<del> * See the License for the specific language governing permissions and
<del> * limitations under the License.
<del> */
<del>
<del>package org.springframework.web.servlet;
<del>
<del>import java.io.IOException;
<del>import javax.servlet.RequestDispatcher;
<del>import javax.servlet.ServletException;
<del>import javax.servlet.http.HttpServletRequest;
<del>import javax.servlet.http.HttpServletResponse;
<del>
<del>import org.springframework.util.AntPathMatcher;
<del>import org.springframework.util.PathMatcher;
<del>import org.springframework.util.StringUtils;
<del>import org.springframework.web.context.support.ServletContextResource;
<del>
<del>/**
<del> * Simple servlet that can expose an internal resource, including a
<del> * default URL if the specified resource is not found. An alternative,
<del> * for example, to trying and catching exceptions when using JSP include.
<del> *
<del> * <p>A further usage of this servlet is the ability to apply last-modified
<del> * timestamps to quasi-static resources (typically JSPs). This can happen
<del> * as bridge to parameter-specified resources, or as proxy for a specific
<del> * target resource (or a list of specific target resources to combine).
<del> *
<del> * <p>A typical usage would map a URL like "/ResourceServlet" onto an instance
<del> * of this servlet, and use the "JSP include" action to include this URL,
<del> * with the "resource" parameter indicating the actual target path in the WAR.
<del> *
<del> * <p>The {@code defaultUrl} property can be set to the internal
<del> * resource path of a default URL, to be rendered when the target resource
<del> * is not found or not specified in the first place.
<del> *
<del> * <p>The "resource" parameter and the {@code defaultUrl} property can
<del> * also specify a list of target resources to combine. Those resources will be
<del> * included one by one to build the response. If last-modified determination
<del> * is active, the newest timestamp among those files will be used.
<del> *
<del> * <p>The {@code allowedResources} property can be set to a URL
<del> * pattern of resources that should be available via this servlet.
<del> * If not set, any target resource can be requested, including resources
<del> * in the WEB-INF directory!
<del> *
<del> * <p>If using this servlet for direct access rather than via includes,
<del> * the {@code contentType} property should be specified to apply a
<del> * proper content type. Note that a content type header in the target JSP will
<del> * be ignored when including the resource via a RequestDispatcher include.
<del> *
<del> * <p>To apply last-modified timestamps for the target resource, set the
<del> * {@code applyLastModified} property to true. This servlet will then
<del> * return the file timestamp of the target resource as last-modified value,
<del> * falling back to the startup time of this servlet if not retrievable.
<del> *
<del> * <p>Note that applying the last-modified timestamp in the above fashion
<del> * just makes sense if the target resource does not generate content that
<del> * depends on the HttpSession or cookies; it is just allowed to evaluate
<del> * request parameters.
<del> *
<del> * <p>A typical case for such last-modified usage is a JSP that just makes
<del> * minimal usage of basic means like includes or message resolution to
<del> * build quasi-static content. Regenerating such content on every request
<del> * is unnecessary; it can be cached as long as the file hasn't changed.
<del> *
<del> * <p>Note that this servlet will apply the last-modified timestamp if you
<del> * tell it to do so: It's your decision whether the content of the target
<del> * resource can be cached in such a fashion. Typical use cases are helper
<del> * resources that are not fronted by a controller, like JavaScript files
<del> * that are generated by a JSP (without depending on the HttpSession).
<del> *
<del> * @author Juergen Hoeller
<del> * @author Rod Johnson
<del> * @see #setDefaultUrl
<del> * @see #setAllowedResources
<del> * @see #setApplyLastModified
<del> */
<del>@SuppressWarnings("serial")
<del>public class ResourceServlet extends HttpServletBean {
<del>
<del> /**
<del> * Any number of these characters are considered delimiters
<del> * between multiple resource paths in a single String value.
<del> */
<del> public static final String RESOURCE_URL_DELIMITERS = ",; \t\n";
<del>
<del> /**
<del> * Name of the parameter that must contain the actual resource path.
<del> */
<del> public static final String RESOURCE_PARAM_NAME = "resource";
<del>
<del>
<del> private String defaultUrl;
<del>
<del> private String allowedResources;
<del>
<del> private String contentType;
<del>
<del> private boolean applyLastModified = false;
<del>
<del> private PathMatcher pathMatcher;
<del>
<del> private long startupTime;
<del>
<del>
<del> /**
<del> * Set the URL within the current web application from which to
<del> * include content if the requested path isn't found, or if none
<del> * is specified in the first place.
<del> * <p>If specifying multiple URLs, they will be included one by one
<del> * to build the response. If last-modified determination is active,
<del> * the newest timestamp among those files will be used.
<del> * @see #setApplyLastModified
<del> */
<del> public void setDefaultUrl(String defaultUrl) {
<del> this.defaultUrl = defaultUrl;
<del> }
<del>
<del> /**
<del> * Set allowed resources as URL pattern, e.g. "/WEB-INF/res/*.jsp",
<del> * The parameter can be any Ant-style pattern parsable by AntPathMatcher.
<del> * @see org.springframework.util.AntPathMatcher
<del> */
<del> public void setAllowedResources(String allowedResources) {
<del> this.allowedResources = allowedResources;
<del> }
<del>
<del> /**
<del> * Set the content type of the target resource (typically a JSP).
<del> * Default is none, which is appropriate when including resources.
<del> * <p>For directly accessing resources, for example to leverage this
<del> * servlet's last-modified support, specify a content type here.
<del> * Note that a content type header in the target JSP will be ignored
<del> * when including the resource via a RequestDispatcher include.
<del> */
<del> public void setContentType(String contentType) {
<del> this.contentType = contentType;
<del> }
<del>
<del> /**
<del> * Set whether to apply the file timestamp of the target resource
<del> * as last-modified value. Default is "false".
<del> * <p>This is mainly intended for JSP targets that don't generate
<del> * session-specific or database-driven content: Such files can be
<del> * cached by the browser as long as the last-modified timestamp
<del> * of the JSP file doesn't change.
<del> * <p>This will only work correctly with expanded WAR files that
<del> * allow access to the file timestamps. Else, the startup time
<del> * of this servlet is returned.
<del> */
<del> public void setApplyLastModified(boolean applyLastModified) {
<del> this.applyLastModified = applyLastModified;
<del> }
<del>
<del>
<del> /**
<del> * Remember the startup time, using no last-modified time before it.
<del> */
<del> @Override
<del> protected void initServletBean() {
<del> this.pathMatcher = getPathMatcher();
<del> this.startupTime = System.currentTimeMillis();
<del> }
<del>
<del> /**
<del> * Return a {@link PathMatcher} to use for matching the "allowedResources" URL pattern.
<del> * <p>The default is {@link AntPathMatcher}.
<del> * @see #setAllowedResources
<del> * @see org.springframework.util.AntPathMatcher
<del> */
<del> protected PathMatcher getPathMatcher() {
<del> return new AntPathMatcher();
<del> }
<del>
<del>
<del> /**
<del> * Determine the URL of the target resource and include it.
<del> * @see #determineResourceUrl
<del> */
<del> @Override
<del> protected final void doGet(HttpServletRequest request, HttpServletResponse response)
<del> throws ServletException, IOException {
<del>
<del> // Determine URL of resource to include...
<del> String resourceUrl = determineResourceUrl(request);
<del>
<del> if (resourceUrl != null) {
<del> try {
<del> doInclude(request, response, resourceUrl);
<del> }
<del> catch (ServletException ex) {
<del> if (logger.isWarnEnabled()) {
<del> logger.warn("Failed to include content of resource [" + resourceUrl + "]", ex);
<del> }
<del> // Try including default URL if appropriate.
<del> if (!includeDefaultUrl(request, response)) {
<del> throw ex;
<del> }
<del> }
<del> catch (IOException ex) {
<del> if (logger.isWarnEnabled()) {
<del> logger.warn("Failed to include content of resource [" + resourceUrl + "]", ex);
<del> }
<del> // Try including default URL if appropriate.
<del> if (!includeDefaultUrl(request, response)) {
<del> throw ex;
<del> }
<del> }
<del> }
<del>
<del> // No resource URL specified -> try to include default URL.
<del> else if (!includeDefaultUrl(request, response)) {
<del> throw new ServletException("No target resource URL found for request");
<del> }
<del> }
<del>
<del> /**
<del> * Determine the URL of the target resource of this request.
<del> * <p>Default implementation returns the value of the "resource" parameter.
<del> * Can be overridden in subclasses.
<del> * @param request current HTTP request
<del> * @return the URL of the target resource, or {@code null} if none found
<del> * @see #RESOURCE_PARAM_NAME
<del> */
<del> protected String determineResourceUrl(HttpServletRequest request) {
<del> return request.getParameter(RESOURCE_PARAM_NAME);
<del> }
<del>
<del> /**
<del> * Include the specified default URL, if appropriate.
<del> * @param request current HTTP request
<del> * @param response current HTTP response
<del> * @return whether a default URL was included
<del> * @throws ServletException if thrown by the RequestDispatcher
<del> * @throws IOException if thrown by the RequestDispatcher
<del> */
<del> private boolean includeDefaultUrl(HttpServletRequest request, HttpServletResponse response)
<del> throws ServletException, IOException {
<del>
<del> if (this.defaultUrl == null) {
<del> return false;
<del> }
<del> doInclude(request, response, this.defaultUrl);
<del> return true;
<del> }
<del>
<del> /**
<del> * Include the specified resource via the RequestDispatcher.
<del> * @param request current HTTP request
<del> * @param response current HTTP response
<del> * @param resourceUrl the URL of the target resource
<del> * @throws ServletException if thrown by the RequestDispatcher
<del> * @throws IOException if thrown by the RequestDispatcher
<del> */
<del> private void doInclude(HttpServletRequest request, HttpServletResponse response, String resourceUrl)
<del> throws ServletException, IOException {
<del>
<del> if (this.contentType != null) {
<del> response.setContentType(this.contentType);
<del> }
<del>
<del> String[] resourceUrls = StringUtils.tokenizeToStringArray(resourceUrl, RESOURCE_URL_DELIMITERS);
<del> for (String url : resourceUrls) {
<del> // check whether URL matches allowed resources
<del> if (this.allowedResources != null && !this.pathMatcher.match(this.allowedResources, url)) {
<del> throw new ServletException("Resource [" + url +
<del> "] does not match allowed pattern [" + this.allowedResources + "]");
<del> }
<del> if (logger.isDebugEnabled()) {
<del> logger.debug("Including resource [" + url + "]");
<del> }
<del> RequestDispatcher rd = request.getRequestDispatcher(url);
<del> rd.include(request, response);
<del> }
<del> }
<del>
<del> /**
<del> * Return the last-modified timestamp of the file that corresponds
<del> * to the target resource URL (i.e. typically the request ".jsp" file).
<del> * Will simply return -1 if "applyLastModified" is false (the default).
<del> * <p>Returns no last-modified date before the startup time of this servlet,
<del> * to allow for message resolution etc that influences JSP contents,
<del> * assuming that those background resources might have changed on restart.
<del> * <p>Returns the startup time of this servlet if the file that corresponds
<del> * to the target resource URL couldn't be resolved (for example, because
<del> * the WAR is not expanded).
<del> * @see #determineResourceUrl
<del> * @see #getFileTimestamp
<del> */
<del> @Override
<del> protected final long getLastModified(HttpServletRequest request) {
<del> if (this.applyLastModified) {
<del> String resourceUrl = determineResourceUrl(request);
<del> if (resourceUrl == null) {
<del> resourceUrl = this.defaultUrl;
<del> }
<del> if (resourceUrl != null) {
<del> String[] resourceUrls = StringUtils.tokenizeToStringArray(resourceUrl, RESOURCE_URL_DELIMITERS);
<del> long latestTimestamp = -1;
<del> for (String url : resourceUrls) {
<del> long timestamp = getFileTimestamp(url);
<del> if (timestamp > latestTimestamp) {
<del> latestTimestamp = timestamp;
<del> }
<del> }
<del> return (latestTimestamp > this.startupTime ? latestTimestamp : this.startupTime);
<del> }
<del> }
<del> return -1;
<del> }
<del>
<del> /**
<del> * Return the file timestamp for the given resource.
<del> * @param resourceUrl the URL of the resource
<del> * @return the file timestamp in milliseconds, or -1 if not determinable
<del> */
<del> protected long getFileTimestamp(String resourceUrl) {
<del> ServletContextResource resource = new ServletContextResource(getServletContext(), resourceUrl);
<del> try {
<del> long lastModifiedTime = resource.lastModified();
<del> if (logger.isDebugEnabled()) {
<del> logger.debug("Last-modified timestamp of " + resource + " is " + lastModifiedTime);
<del> }
<del> return lastModifiedTime;
<del> }
<del> catch (IOException ex) {
<del> if (logger.isWarnEnabled()) {
<del> logger.warn("Couldn't retrieve last-modified timestamp of " + resource +
<del> " - using ResourceServlet startup time");
<del> }
<del> return -1;
<del> }
<del> }
<del>
<del>} | 1 |
Text | Text | add changelog entry for | 55d943c5670997ce64744c1ae3cd0426f5517b10 | <ide><path>activerecord/CHANGELOG.md
<ide> ## Rails 4.0.0 (unreleased) ##
<ide>
<add>* Round usec when comparing timestamp attributes in the dirty tracking.
<add> Fixes #6975.
<add>
<add> *kennyj*
<add>
<ide> * Use inversed parent for first and last child of has_many association.
<ide>
<ide> *Ravil Bayramgalin* | 1 |
Go | Go | update init for new apparmor import path | fa5cabf9fe9e257d64638043ca2fd08a7bf96cb3 | <ide><path>pkg/libcontainer/nsinit/init.go
<ide> import (
<ide> "github.com/dotcloud/docker/pkg/libcontainer/console"
<ide> "github.com/dotcloud/docker/pkg/libcontainer/mount"
<ide> "github.com/dotcloud/docker/pkg/libcontainer/network"
<del> "github.com/dotcloud/docker/pkg/libcontainer/security/apparmor"
<ide> "github.com/dotcloud/docker/pkg/libcontainer/security/capabilities"
<ide> "github.com/dotcloud/docker/pkg/libcontainer/utils"
<ide> "github.com/dotcloud/docker/pkg/system" | 1 |
Python | Python | fix exception causes in build_clib.py | 69dff1a33babd996496213afbb8080823c8d5bdd | <ide><path>numpy/distutils/command/build_clib.py
<ide> def finalize_options(self):
<ide> if self.parallel:
<ide> try:
<ide> self.parallel = int(self.parallel)
<del> except ValueError:
<del> raise ValueError("--parallel/-j argument must be an integer")
<add> except ValueError as e:
<add> raise ValueError("--parallel/-j argument must be an integer") from e
<ide> old_build_clib.finalize_options(self)
<ide> self.set_undefined_options('build',
<ide> ('parallel', 'parallel'), | 1 |
Java | Java | ensure one time logging for request details | 1b3fd9edfffd78a90da820d04455acbdbc3d4661 | <ide><path>spring-test/src/main/java/org/springframework/test/web/reactive/server/ExchangeResult.java
<ide> public class ExchangeResult {
<ide> @Nullable
<ide> private final Object mockServerResult;
<ide>
<add> /** Ensure single logging, e.g. for expectAll. */
<add> private boolean diagnosticsLogged;
<add>
<ide>
<ide> /**
<ide> * Create an instance with an HTTP request and response along with promises
<ide> public class ExchangeResult {
<ide> this.timeout = other.timeout;
<ide> this.uriTemplate = other.uriTemplate;
<ide> this.mockServerResult = other.mockServerResult;
<add> this.diagnosticsLogged = other.diagnosticsLogged;
<ide> }
<ide>
<ide>
<ide> public void assertWithDiagnostics(Runnable assertion) {
<ide> assertion.run();
<ide> }
<ide> catch (AssertionError ex) {
<del> if (logger.isErrorEnabled()) {
<add> if (!this.diagnosticsLogged && logger.isErrorEnabled()) {
<add> this.diagnosticsLogged = true;
<ide> logger.error("Request details for assertion failure:\n" + this);
<ide> }
<ide> throw ex;
<ide><path>spring-test/src/test/java/org/springframework/test/web/reactive/server/samples/SoftAssertionTests.java
<ide> void expectAll() {
<ide> }
<ide>
<ide> @Test
<del> void expectAllWithMultipleFailures() throws Exception {
<del> assertThatExceptionOfType(AssertionError.class).isThrownBy(() ->
<del> this.webTestClient.get().uri("/test").exchange()
<del> .expectAll(
<del> responseSpec -> responseSpec.expectStatus().isBadRequest(),
<del> responseSpec -> responseSpec.expectStatus().isOk(),
<del> responseSpec -> responseSpec.expectBody(String.class).isEqualTo("bogus")
<add> void expectAllWithMultipleFailures() {
<add> assertThatExceptionOfType(AssertionError.class)
<add> .isThrownBy(() ->
<add> this.webTestClient.get().uri("/test").exchange()
<add> .expectAll(
<add> responseSpec -> responseSpec.expectStatus().isBadRequest(),
<add> responseSpec -> responseSpec.expectStatus().isOk(),
<add> responseSpec -> responseSpec.expectBody(String.class).isEqualTo("bogus")
<add> )
<ide> )
<del> ).withMessage("Multiple Exceptions (2):\nStatus expected:<400 BAD_REQUEST> but was:<200 OK>\nResponse body expected:<bogus> but was:<hello>");
<add> .withMessage("Multiple Exceptions (2):\n" +
<add> "Status expected:<400 BAD_REQUEST> but was:<200 OK>\n" +
<add> "Response body expected:<bogus> but was:<hello>");
<ide> }
<ide>
<ide> | 2 |
Javascript | Javascript | perform the latest run and cancel previous | 779d2034f357707f4f4af0cf6ed114f3a61dd915 | <ide><path>client/src/templates/Challenges/redux/execute-challenge-saga.js
<del>import { takeEvery, put, select, call } from 'redux-saga/effects';
<add>import { put, select, call, takeLatest } from 'redux-saga/effects';
<ide>
<ide> import {
<ide> challengeMetaSelector,
<ide> function* ExecuteChallengeSaga() {
<ide> switch (challengeType) {
<ide> case js:
<ide> case bonfire:
<del> yield ExecuteJSChallengeSaga();
<add> yield* ExecuteJSChallengeSaga();
<ide> break;
<ide> case backend:
<del> // yield ExecuteBackendChallengeSaga();
<add> // yield* ExecuteBackendChallengeSaga();
<ide> break;
<ide> default:
<del> // yield ExecuteDOMChallengeSaga();
<add> // yield* ExecuteDOMChallengeSaga();
<ide> }
<ide> }
<ide>
<ide> function* ExecuteJSChallengeSaga() {
<ide> }
<ide>
<ide> export function createExecuteChallengeSaga(types) {
<del> return [takeEvery(types.executeChallenge, ExecuteChallengeSaga)];
<add> return [takeLatest(types.executeChallenge, ExecuteChallengeSaga)];
<ide> } | 1 |
Javascript | Javascript | update title to example | cf2cc9e285b1196f2cc844857e909b4f9b614bb0 | <ide><path>packages/rn-tester/js/RNTesterAppShared.js
<ide> const RNTesterApp = (): React.Node => {
<ide>
<ide> const {
<ide> activeModuleKey,
<add> activeModuleTitle,
<ide> activeModuleExampleKey,
<ide> screen,
<ide> bookmarks,
<ide> const RNTesterApp = (): React.Node => {
<ide> }, [activeModuleKey, handleBackPress]);
<ide>
<ide> const handleModuleCardPress = React.useCallback(
<del> ({exampleType, key}) => {
<add> ({exampleType, key, title}) => {
<ide> dispatch({
<ide> type: RNTesterActionsType.MODULE_CARD_PRESS,
<del> data: {exampleType, key},
<add> data: {exampleType, key, title},
<ide> });
<ide> },
<ide> [dispatch],
<ide> const RNTesterApp = (): React.Node => {
<ide> activeModuleExampleKey != null
<ide> ? activeModule?.examples.find(e => e.name === activeModuleExampleKey)
<ide> : null;
<del> const title = Screens.COMPONENTS
<del> ? 'Components'
<del> : Screens.APIS
<del> ? 'APIs'
<del> : 'Bookmarks';
<add> const title =
<add> activeModuleTitle != null
<add> ? activeModuleTitle
<add> : screen === Screens.COMPONENTS
<add> ? 'Components'
<add> : screen === Screens.APIS
<add> ? 'APIs'
<add> : 'Bookmarks';
<ide>
<ide> const activeExampleList =
<ide> screen === Screens.COMPONENTS
<ide><path>packages/rn-tester/js/components/RNTesterModuleList.js
<ide> const ExampleModuleRow = ({
<ide> <TouchableHighlight
<ide> style={styles.imageViewStyle}
<ide> onPress={() =>
<del> toggleBookmark({exampleType: item.exampleType, key: item.key})
<add> toggleBookmark({
<add> exampleType: item.exampleType,
<add> key: item.key,
<add> })
<ide> }>
<ide> <Image
<ide> style={styles.imageStyle}
<ide> const ExampleModuleRow = ({
<ide> </View>
<ide> }
<ide> onPress={() =>
<del> handlePress({exampleType: item.exampleType, key: item.key})
<add> handlePress({
<add> exampleType: item.exampleType,
<add> key: item.key,
<add> title: item.module.title,
<add> })
<ide> }
<ide> />
<ide> );
<ide><path>packages/rn-tester/js/types/RNTesterTypes.js
<ide> export type ComponentList = null | {components: string[], apis: string[]};
<ide>
<ide> export type RNTesterState = {
<ide> activeModuleKey: null | string,
<add> activeModuleTitle: null | string,
<ide> activeModuleExampleKey: null | string,
<ide> screen: ScreenTypes,
<ide> bookmarks: ComponentList,
<ide><path>packages/rn-tester/js/utils/RNTesterReducer.js
<ide> export const RNTesterReducer = (
<ide> return {
<ide> ...state,
<ide> activeModuleKey: null,
<add> activeModuleTitle: null,
<ide> activeModuleExampleKey: null,
<ide> screen: action.data.screen,
<ide> };
<ide> case RNTesterActionsType.MODULE_CARD_PRESS:
<ide> return {
<ide> ...state,
<ide> activeModuleKey: action.data.key,
<add> activeModuleTitle: action.data.title,
<ide> activeModuleExampleKey: null,
<ide> recentlyUsed: getUpdatedRecentlyUsed({
<ide> exampleType: action.data.exampleType,
<ide> export const RNTesterReducer = (
<ide> activeModuleExampleKey: null,
<ide> activeModuleKey:
<ide> state.activeModuleExampleKey != null ? state.activeModuleKey : null,
<add> activeModuleTitle:
<add> state.activeModuleExampleKey != null ? state.activeModuleTitle : null,
<ide> };
<ide> default:
<ide> throw new Error(`Invalid action type ${action.type}`);
<ide><path>packages/rn-tester/js/utils/testerStateUtils.js
<ide> export const Screens = {
<ide>
<ide> export const initialState: RNTesterState = {
<ide> activeModuleKey: null,
<add> activeModuleTitle: null,
<ide> activeModuleExampleKey: null,
<ide> screen: null,
<ide> bookmarks: null,
<ide> export const getInitialStateFromAsyncStorage = async (
<ide> if (!initialStateString) {
<ide> return {
<ide> activeModuleKey: null,
<add> activeModuleTitle: null,
<ide> activeModuleExampleKey: null,
<ide> screen: Screens.COMPONENTS,
<ide> bookmarks: {components: [], apis: []}, | 5 |
Python | Python | add ex_ prefix to newly implemented methods | 122b3a07be01fec24ecfb353d8762f280ad232d8 | <ide><path>libcloud/container/drivers/kubernetes.py
<ide> class KubernetesContainerDriver(KubernetesDriverMixin, ContainerDriver):
<ide> connectionCls = KubernetesBasicAuthConnection
<ide> supports_clusters = True
<ide>
<del> def get_version(self):
<add> def ex_get_version(self):
<ide> """Get Kubernetes version"""
<ide> return self.connection.request("/version").object["gitVersion"]
<ide>
<ide> def create_namespace(self, name, location=None):
<ide> ).object
<ide> return self._to_namespace(result)
<ide>
<del> def list_nodes_metrics(self):
<add> def ex_list_nodes_metrics(self):
<ide> return self.connection.request(
<ide> "/apis/metrics.k8s.io/v1beta1/nodes", enforce_unicode_response=True
<ide> ).object["items"]
<ide>
<del> def list_pods_metrics(self):
<add> def ex_list_pods_metrics(self):
<ide> return self.connection.request(
<ide> "/apis/metrics.k8s.io/v1beta1/pods", enforce_unicode_response=True
<ide> ).object["items"]
<ide>
<del> def list_services(self):
<add> def ex_list_services(self):
<ide> return self.connection.request(
<ide> ROOT_URL + "v1/services", enforce_unicode_response=True
<ide> ).object["items"] | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.