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
title the pages
83b74d14f3db506b2271caf1cffadee394493c56
<ide><path>client/src/client-only-routes/ShowSettings.js <ide> import { bindActionCreators } from 'redux'; <ide> import { connect } from 'react-redux'; <ide> import { createSelector } from 'reselect'; <ide> import { Grid, Button } from '@freecodecamp/react-bootstrap'; <add>import Helmet from 'react-helmet'; <ide> <ide> import { signInLoadingSelector, userSelector } from '../redux'; <ide> import { submitNewAbout, updateUserFlag } from '../redux/settings'; <ide> function ShowSettings(props) { <ide> <ide> return ( <ide> <Layout> <add> <Helmet> <add> <title>Settings | freeCodeCamp.org</title> <add> </Helmet> <ide> <Grid> <ide> <Spacer size={2} /> <ide> <FullWidthRow> <ide><path>client/src/client-only-routes/ShowUnsubscribed.js <ide> import React from 'react'; <add>import PropTypes from 'prop-types'; <ide> import { Grid, Panel, Button } from '@freecodecamp/react-bootstrap'; <add>import Helmet from 'react-helmet'; <ide> <ide> import env from '../../config/env.json'; <ide> import Layout from '../components/Layout'; <ide> const { apiLocation } = env; <ide> function ShowUnsubscribed({ unsubscribeId }) { <ide> return ( <ide> <Layout> <add> <Helmet> <add> <title>You have been unsubscribed | freeCodeCamp.org</title> <add> </Helmet> <ide> <Grid> <ide> <FullWidthRow> <ide> <Spacer /> <ide> function ShowUnsubscribed({ unsubscribeId }) { <ide> } <ide> <ide> ShowUnsubscribed.displayName = 'ShowUnsubscribed'; <add>ShowUnsubscribed.propTypes = { <add> unsubscribeId: PropTypes.string <add>}; <ide> <ide> export default ShowUnsubscribed; <ide><path>client/src/client-only-routes/ShowUser.js <ide> import { <ide> Button, <ide> Col <ide> } from '@freecodecamp/react-bootstrap'; <add>import Helmet from 'react-helmet'; <ide> <ide> import { <ide> isSignedInSelector, <ide> class ShowUser extends Component { <ide> <ide> return ( <ide> <Layout> <add> <Helmet> <add> <title>Report a users profile | freeCodeCamp.org</title> <add> </Helmet> <ide> <FullWidthRow> <ide> <Spacer /> <ide> <Spacer /> <ide><path>client/src/pages/404.js <ide> import React from 'react'; <add>import Helmet from 'react-helmet'; <add> <ide> import Layout from '../components/Layout'; <ide> <ide> const NotFoundPage = () => ( <ide> <Layout> <add> <Helmet><title>404 Page not found | freeCodeCamp.org</title></Helmet> <ide> <h1>NOT FOUND</h1> <ide> <p>You just hit a route that doesn&#39;t exist... the sadness.</p> <ide> </Layout> <ide><path>client/src/pages/academic-honesty.js <ide> import React from 'react'; <ide> import { Grid } from '@freecodecamp/react-bootstrap'; <add>import Helmet from 'react-helmet'; <ide> <ide> import Layout from '../components/Layout'; <ide> import Spacer from '../components/helpers/Spacer'; <ide> import FullWidthRow from '../components/helpers/FullWidthRow'; <ide> function AcademicHonesty() { <ide> return ( <ide> <Layout> <add> <Helmet> <add> <title>Academic Honesty Policy | freeCodeCamp.org</title> <add> </Helmet> <ide> <Grid> <ide> <FullWidthRow> <ide> <Spacer /> <ide><path>client/src/pages/accept-privacy-terms.js <ide> class AcceptPrivacyTerms extends Component { <ide> return ( <ide> <Layout> <ide> <Helmet> <del> <title>Privacy Policy and Terms of Service</title> <add> <title>Privacy Policy and Terms of Service | freeCodeCamp.org</title> <ide> </Helmet> <ide> <Grid> <ide> <Row> <ide><path>client/src/pages/index.js <ide> import { <ide> faReact <ide> } from '@fortawesome/free-brands-svg-icons'; <ide> import { faDatabase } from '@fortawesome/free-solid-svg-icons'; <add>import Helmet from 'react-helmet'; <ide> <ide> import { Spacer } from '../components/helpers'; <ide> import Layout from '../components/Layout'; <ide> const BigCallToAction = () => ( <ide> <ide> const IndexPage = () => ( <ide> <Layout disableSettings={true} landingPage={true}> <add> <Helmet> <add> <title>Learn to code | freeCodeCamp.org</title> <add> </Helmet> <ide> <Spacer /> <ide> <Spacer /> <ide> <Grid className='text-center'> <ide><path>client/src/pages/software-resources-for-nonprofits.js <ide> import React from 'react'; <ide> import { Grid } from '@freecodecamp/react-bootstrap'; <add>import Helmet from 'react-helmet'; <ide> <ide> import Layout from '../components/Layout'; <ide> import FullWidthRow from '../components/helpers/FullWidthRow'; <ide> import { Spacer } from '../components/helpers'; <ide> function SoftwareResourcesForNonProfits() { <ide> return ( <ide> <Layout> <add> <Helmet> <add> <title>Software Resources for Nonprofits | freeCodeCamp.org</title> <add> </Helmet> <ide> <Spacer /> <ide> <Spacer /> <ide> <Grid> <ide> function SoftwareResourcesForNonProfits() { <ide> </li> <ide> <li> <ide> <a <del> href='https://www.blackbaud.com/fundraising-crm/etapestry-donor-management' <add> href={ <add> 'https://www.blackbaud.com/fundraising-crm/etapestry-donor' + <add> '-management' <add> } <ide> rel='noopener noreferrer' <ide> target='_blank' <ide> > <ide><path>client/src/pages/update-email.js <ide> import { <ide> Col, <ide> Button <ide> } from '@freecodecamp/react-bootstrap'; <add>import Helmet from 'react-helmet'; <ide> <ide> import Layout from '../components/Layout'; <ide> import { Spacer } from '../components/helpers'; <ide> class UpdateEmail extends Component { <ide> const { isNewEmail, updateMyEmail } = this.props; <ide> return ( <ide> <Layout> <add> <Helmet> <add> <title>Update your email address | freeCodeCamp.org</title> <add> </Helmet> <ide> <Spacer /> <ide> <h2 className='text-center'>Update your email address here:</h2> <ide> <Grid> <ide><path>client/src/pages/welcome.js <ide> import { bindActionCreators } from 'redux'; <ide> import { connect } from 'react-redux'; <ide> import { createSelector } from 'reselect'; <ide> import { Grid, Row, Col, Button } from '@freecodecamp/react-bootstrap'; <add>import Helmet from 'react-helmet'; <ide> <ide> import { Loader, Spacer } from '../components/helpers'; <ide> import Layout from '../components/Layout'; <ide> const mapDispatchToProps = dispatch => bindActionCreators({}, dispatch); <ide> <ide> function Welcome({ <ide> fetchState: { pending, complete }, <del> fetchState, <ide> user: { <ide> acceptedPrivacyTerms, <ide> name = '', <ide> function Welcome({ <ide> completedLegacyCertCount = 0 <ide> } <ide> }) { <del> console.log(fetchState); <ide> if (pending && !complete) { <ide> return ( <ide> <Layout> <ide> function Welcome({ <ide> const { quote, author } = randomQuote(); <ide> return ( <ide> <Layout> <add> <Helmet> <add> <title>Welcome {name ? name : 'Camper'} | freeCodeCamp.org</title> <add> </Helmet> <ide> <Grid className='text-center'> <ide> <Row> <ide> <Col xs={12}> <ide> function Welcome({ <ide> </Button> <ide> </Col> <ide> </Row> <del> <Spacer size={4}/> <add> <Spacer size={4} /> <ide> </Grid> <ide> </Layout> <ide> );
10
PHP
PHP
add tests for file permissions
aabd1a9edc36052fddb01931e9bfe09a0e260779
<ide><path>tests/Cache/CacheFileStoreTest.php <ide> use Illuminate\Contracts\Filesystem\FileNotFoundException; <ide> use Illuminate\Filesystem\Filesystem; <ide> use Illuminate\Support\Carbon; <add>use Mockery as m; <ide> use PHPUnit\Framework\TestCase; <ide> <ide> class CacheFileStoreTest extends TestCase <ide> public function testStoreItemProperlyStoresValues() <ide> $this->assertTrue($result); <ide> } <ide> <add> public function testStoreItemProperlySetsPermissions() <add> { <add> $files = m::mock(Filesystem::class); <add> $files->shouldIgnoreMissing(); <add> $store = $this->getMockBuilder(FileStore::class)->setMethods(['expiration'])->setConstructorArgs([$files, __DIR__, 0644])->getMock(); <add> $hash = sha1('foo'); <add> $cache_dir = substr($hash, 0, 2).'/'.substr($hash, 2, 2); <add> $files->shouldReceive('put')->withArgs([__DIR__.'/'.$cache_dir.'/'.$hash, m::any(), m::any()])->andReturnUsing(function ($name, $value) { <add> return strlen($value); <add> }); <add> $files->shouldReceive('chmod')->withArgs([__DIR__.'/'.$cache_dir.'/'.$hash])->andReturnValues(["0600", "0644"])->times(3); <add> $files->shouldReceive('chmod')->withArgs([__DIR__.'/'.$cache_dir.'/'.$hash, 0644])->andReturn([true])->once(); <add> $result = $store->put('foo', 'foo', 10); <add> $this->assertTrue($result); <add> $result = $store->put('foo', 'bar', 10); <add> $this->assertTrue($result); <add> $result = $store->put('foo', 'baz', 10); <add> $this->assertTrue($result); <add> m::close(); <add> } <add> <ide> public function testForeversAreStoredWithHighTimestamp() <ide> { <ide> $files = $this->mockFilesystem();
1
Python
Python
allow empty prefix and no lead slash in bp route
f13870731c100d3ed7daa5d96a75b697973def77
<ide><path>flask/blueprints.py <ide> def add_url_rule(self, rule, endpoint=None, view_func=None, **options): <ide> to the application. The endpoint is automatically prefixed with the <ide> blueprint's name. <ide> """ <del> if self.url_prefix: <add> if self.url_prefix is not None: <ide> rule = '/'.join((self.url_prefix, rule.lstrip('/'))) <ide> options.setdefault('subdomain', self.subdomain) <ide> if endpoint is None:
1
Ruby
Ruby
fix some unanchored patch urls
6675fd88fc3421711ea021287deb4aae8c6206f4
<ide><path>Library/Homebrew/cmd/audit.rb <ide> def audit_specs <ide> def audit_patches <ide> Patches.new(f.patches).select(&:external?).each do |p| <ide> case p.url <del> when %r[raw\.github\.com], %r[gist\.github\.com/raw] <add> when %r[raw\.github\.com], %r[gist\.github\.com/raw], %r[gist\.github\.com/.+/raw$] <ide> unless p.url =~ /[a-fA-F0-9]{40}/ <ide> problem "GitHub/Gist patches should specify a revision:\n#{p.url}" <ide> end
1
Javascript
Javascript
compile node material per object
59e8e47d2df52b9572b14e1bd7f616b1cb0809a7
<ide><path>examples/jsm/renderers/webgpu/WebGPUBindings.js <ide> class WebGPUBindings { <ide> if ( data === undefined ) { <ide> <ide> const pipeline = this.pipelines.get( object ); <del> const material = object.material; <del> <del> const nodeBuilder = this.nodes.get( material ); <ide> <ide> // each material defines an array of bindings (ubos, textures, samplers etc.) <ide> <add> const nodeBuilder = this.nodes.get( object ); <add> <ide> const bindings = nodeBuilder.getBindings(); <ide> <ide> // setup (static) binding layout and (dynamic) binding group <ide><path>examples/jsm/renderers/webgpu/WebGPURenderPipelines.js <ide> class WebGPURenderPipelines { <ide> <ide> // get shader <ide> <del> const nodeBuilder = this.nodes.get( material ); <add> const nodeBuilder = this.nodes.get( object ); <ide> <ide> // shader modules <ide> <ide> class WebGPURenderPipelines { <ide> function onMaterialDispose( event ) { <ide> <ide> const properties = this.properties; <del> const nodes = this.nodes; <del> const shaderModules = this.shaderModules; <ide> <ide> const material = event.target; <ide> const materialProperties = properties.get( material ); <del> const nodeBuilder = nodes.get( material ); <ide> <ide> material.removeEventListener( 'dispose', materialProperties.disposeCallback ); <ide> <ide> properties.remove( material ); <del> nodes.remove( material ); <ide> <del> shaderModules.vertex.delete( nodeBuilder.vertexShader ); <del> shaderModules.fragment.delete( nodeBuilder.fragmentShader ); <del> <del> // @TODO: still needed remove bindings and pipeline <add> // @TODO: still needed remove nodes, bindings and pipeline <ide> <ide> } <ide> <ide><path>examples/jsm/renderers/webgpu/nodes/WebGPUNodes.js <ide> class WebGPUNodes { <ide> <ide> } <ide> <del> get( material ) { <add> get( object ) { <ide> <del> let nodeBuilder = this.builders.get( material ); <add> let nodeBuilder = this.builders.get( object ); <ide> <ide> if ( nodeBuilder === undefined ) { <ide> <del> nodeBuilder = new WebGPUNodeBuilder( material, this.renderer ).build(); <add> nodeBuilder = new WebGPUNodeBuilder( object.material, this.renderer ).build(); <ide> <del> this.builders.set( material, nodeBuilder ); <add> this.builders.set( object, nodeBuilder ); <ide> <ide> } <ide> <ide> return nodeBuilder; <ide> <ide> } <ide> <del> remove( material ) { <add> remove( object ) { <ide> <del> this.builders.delete( material ); <add> this.builders.delete( object ); <ide> <ide> } <ide> <ide> class WebGPUNodes { <ide> <ide> const material = object.material; <ide> <del> const nodeBuilder = this.get( material ); <add> const nodeBuilder = this.get( object ); <ide> const nodeFrame = this.nodeFrame; <ide> <ide> nodeFrame.material = material;
3
Ruby
Ruby
allow instances to disable record_timestamps
0d0176c4ffe5c58fd1002efbd8f7bd45a8872e33
<ide><path>activerecord/lib/active_record/timestamp.rb <ide> module Timestamp <ide> extend ActiveSupport::Concern <ide> <ide> included do <del> class_attribute :record_timestamps, :instance_writer => false <add> class_attribute :record_timestamps <ide> self.record_timestamps = true <ide> end <ide> <ide><path>activerecord/test/cases/timestamp_test.rb <ide> def test_saving_when_record_timestamps_is_false_doesnt_update_its_timestamp <ide> Developer.record_timestamps = true <ide> end <ide> <add> def test_saving_when_instance_record_timestamps_is_false_doesnt_update_its_timestamp <add> @developer.record_timestamps = false <add> assert Developer.record_timestamps <add> <add> @developer.name = "John Smith" <add> @developer.save! <add> <add> assert_equal @previously_updated_at, @developer.updated_at <add> end <add> <ide> def test_touching_an_attribute_updates_timestamp <ide> previously_created_at = @developer.created_at <ide> @developer.touch(:created_at)
2
Go
Go
use empty string as cgroup path to grab first find
78045a5419718ba8884ed5afc0b41a3a80afc3b4
<ide><path>daemon/daemon_unix.go <ide> func (daemon *Daemon) initCgroupsPath(path string) error { <ide> // for the period and runtime as this limits what the children can be set to. <ide> daemon.initCgroupsPath(filepath.Dir(path)) <ide> <del> mnt, root, err := cgroups.FindCgroupMountpointAndRoot("cpu") <add> mnt, root, err := cgroups.FindCgroupMountpointAndRoot("", "cpu") <ide> if err != nil { <ide> return err <ide> } <ide><path>pkg/sysinfo/sysinfo_linux.go <ide> func checkCgroupCpusetInfo(cgMounts map[string]string, quiet bool) cgroupCpusetI <ide> <ide> // checkCgroupPids reads the pids information from the pids cgroup mount point. <ide> func checkCgroupPids(quiet bool) cgroupPids { <del> _, err := cgroups.FindCgroupMountpoint("pids") <add> _, err := cgroups.FindCgroupMountpoint("", "pids") <ide> if err != nil { <ide> if !quiet { <ide> logrus.Warn(err)
2
Mixed
Javascript
support export default in the class codemod
989caa870d614458aee2f40fb08b2c1229a04248
<ide><path>packages/react-codemod/README.md <ide> calls. <ide> * `jscodeshift -t react/packages/react-codemod/transforms/findDOMNode.js <file>` <ide> <ide> `pure-render-mixin` removes `PureRenderMixin` and inlines <del>`shouldComponentUpdate` so that the ES6 class transform can pick up the React <del>component and turn it into an ES6 class. NOTE: This currently only works if you <add>`shouldComponentUpdate` so that the ES2015 class transform can pick up the React <add>component and turn it into an ES2015 class. NOTE: This currently only works if you <ide> are using the master version (>0.13.1) of React as it is using <ide> `React.addons.shallowCompare` <ide> <ide> are using the master version (>0.13.1) of React as it is using <ide> namespaced name for the mixin. `mixins: [React.addons.PureRenderMixin]` will <ide> not currently work. <ide> <del>`class` transforms `React.createClass` calls into ES6 classes. <add>`class` transforms `React.createClass` calls into ES2015 classes. <ide> <ide> * `jscodeshift -t react/packages/react-codemod/transforms/class.js <file>` <ide> * If `--no-super-class=true` is specified it will not extend <ide> All scripts take an option `--no-explicit-require=true` if you don't have a <ide> `require('React')` statement in your code files and if you access React as a <ide> global. <ide> <del>### Explanation of the ES6 class transform <add>### Explanation of the ES2015 class transform <ide> <ide> * Ignore components with calls to deprecated APIs. This is very defensive, if <ide> the script finds any identifiers called `isMounted`, `getDOMNode`, <ide><path>packages/react-codemod/test/export-default-class-test.js <ide> export default React.createClass({ <ide> }; <ide> }, <ide> <add> propTypes: { <add> foo: React.PropTypes.string, <add> }, <add> <ide> render: function() { <ide> return <div />; <ide> } <ide><path>packages/react-codemod/test/export-default-class-test.output.js <ide> export default class extends React.Component { <ide> }; <ide> } <ide> <add> static propTypes = { <add> foo: React.PropTypes.string, <add> }; <add> <ide> render() { <ide> return <div />; <ide> } <del>}; <del> <add>} <ide><path>packages/react-codemod/transforms/class.js <ide> <ide> 'use strict'; <ide> <del>function updateReactCreateClassToES6(file, api, options) { <add>module.exports = (file, api, options) => { <ide> const j = api.jscodeshift; <ide> <ide> require('./utils/array-polyfills'); <ide> function updateReactCreateClassToES6(file, api, options) { <ide> ]; <ide> }; <ide> <del> const createES6Class = ( <add> const createESClass = ( <ide> name, <del> functions, <add> properties, <ide> getInitialState, <ide> autobindFunctions, <ide> comments, <ide> function updateReactCreateClassToES6(file, api, options) { <ide> autobindFunctions, <ide> shouldAddSuperClass <ide> ), <del> functions.map(createMethodDefinition) <add> properties <ide> ) <ide> ), <ide> shouldAddSuperClass ? j.memberExpression( <ide> function updateReactCreateClassToES6(file, api, options) { <ide> const createStaticAssignmentExpressions = (name, statics) => <ide> statics.map(staticProperty => createStaticAssignment(name, staticProperty)); <ide> <add> const createStaticClassProperty = staticProperty => <add> withComments(j.classProperty( <add> j.identifier(staticProperty.key.name), <add> staticProperty.value, <add> null, <add> true <add> ), staticProperty); <add> <add> const createStaticClassProperties = statics => <add> statics.map(createStaticClassProperty); <add> <ide> const hasSingleReturnStatement = value => ( <ide> value.type === 'FunctionExpression' && <ide> value.body && <ide> function updateReactCreateClassToES6(file, api, options) { <ide> false <ide> ); <ide> <del> const updateToES6Class = (classPath, shouldExtend, isModuleExports) => { <add> const updateToClass = (classPath, shouldExtend, type) => { <ide> const specPath = ReactUtils.getReactCreateClassSpec(classPath); <ide> const name = ReactUtils.getComponentName(classPath); <ide> const statics = collectStatics(specPath); <ide> function updateReactCreateClassToES6(file, api, options) { <ide> name ? j.identifier(name) : createModuleExportsMemberExpression(); <ide> <ide> var path; <del> if (isModuleExports) { <add> if (type == 'moduleExports' || type == 'exportDefault') { <ide> path = ReactUtils.findReactCreateClassCallExpression(classPath); <ide> } else { <ide> path = j(classPath).closest(j.VariableDeclaration); <ide> } <ide> <add> const properties = <add> (type == 'exportDefault') ? createStaticClassProperties(statics) : []; <add> <ide> path.replaceWith( <del> createES6Class( <add> createESClass( <ide> name, <del> functions, <add> properties.concat(functions.map(createMethodDefinition)), <ide> getInitialState, <ide> autobindFunctions, <ide> comments, <ide> shouldExtend || shouldExtendReactComponent(classPath) <ide> ) <ide> ); <ide> <del> const staticAssignments = <del> createStaticAssignmentExpressions(staticName, statics); <del> if (isModuleExports) { <del> const body = root.get().value.body; <del> body.push.apply(body, staticAssignments); <del> } else { <del> staticAssignments <del> .forEach(expression => path = path.insertAfter(expression)); <add> if (type == 'moduleExports' || type == 'var') { <add> const staticAssignments = createStaticAssignmentExpressions( <add> staticName, <add> statics <add> ); <add> if (type == 'moduleExports') { <add> root.get().value.program.body.push(...staticAssignments); <add> } else { <add> path.insertAfter(staticAssignments.reverse()); <add> } <ide> } <ide> }; <ide> <ide> if ( <ide> options['no-explicit-require'] || ReactUtils.hasReact(root) <ide> ) { <del> const apply = (path, isModuleExports) => <add> const apply = (path, type) => <ide> path <ide> .filter(hasMixins) <ide> .filter(callsDeprecatedAPIs) <del> .forEach(classPath => updateToES6Class( <add> .forEach(classPath => updateToClass( <ide> classPath, <ide> !options['no-super-class'], <del> isModuleExports <add> type <ide> )); <ide> <ide> const didTransform = ( <del> apply(ReactUtils.findReactCreateClass(root), false).size() + <del> apply(ReactUtils.findReactCreateClassModuleExports(root), true).size() + <del> apply(ReactUtils.findReactCreateClassExportDefault(root), false).size() <add> apply(ReactUtils.findReactCreateClass(root), 'var') <add> .size() + <add> apply(ReactUtils.findReactCreateClassModuleExports(root), 'moduleExports') <add> .size() + <add> apply(ReactUtils.findReactCreateClassExportDefault(root), 'exportDefault') <add> .size() <ide> ) > 0; <ide> <ide> if (didTransform) { <ide> return root.toSource(printOptions); <ide> } <del> <add> <ide> } <ide> <ide> return null; <ide> } <del> <del>module.exports = updateReactCreateClassToES6; <ide><path>packages/react-codemod/transforms/utils/ReactUtils.js <ide> module.exports = function(j) { <ide> source: { <ide> type: 'Literal', <ide> } <del> }).filter((importDeclarator) => { <del> return importDeclarator.value.source.value === module; <del> }).size() === 1 <add> }) <add> .filter(declarator => declarator.value.source.value === module) <add> .size() === 1 <ide> <ide> const hasReact = path => ( <ide> hasModule(path, 'React') || <ide> module.exports = function(j) { <ide> .findVariableDeclarators() <ide> .filter(decl => findReactCreateClassCallExpression(decl).size() > 0); <ide> <del> const findReactCreateClassExportDefault = path => { <del> var collection = []; <del> path <del> .find(j.ExportDefaultDeclaration, { <del> type: 'ExportDefaultDeclaration', <del> declaration: { <del> type: 'CallExpression', <del> callee: REACT_CREATE_CLASS_MEMBER_EXPRESSION <del> } <del> }) <del> .forEach((p) => collection.push(p.value.declaration)) <del> return j(collection); <del> } <add> const findReactCreateClassExportDefault = path => <add> path.find(j.ExportDefaultDeclaration, { <add> declaration: { <add> type: 'CallExpression', <add> callee: REACT_CREATE_CLASS_MEMBER_EXPRESSION <add> } <add> }); <ide> <ide> const findReactCreateClassModuleExports = path => <ide> path <ide> module.exports = function(j) { <ide> // --------------------------------------------------------------------------- <ide> // Others <ide> const getReactCreateClassSpec = classPath => { <del> const spec = (classPath.value.init || classPath.value.right || classPath.value).arguments[0] <add> var {value} = classPath; <add> const spec = (value.init || value.right || value.declaration).arguments[0]; <ide> if (spec.type === 'ObjectExpression' && Array.isArray(spec.properties)) { <ide> return spec; <ide> }
5
Javascript
Javascript
fix autoskip for first segment of chart
6c9f202c6835d60fbaa220cbfab99b9946aae999
<ide><path>src/core/core.scale.js <ide> function skip(ticks, spacing, majorStart, majorEnd) { <ide> } <ide> <ide> next = start; <add> <add> while (next < 0) { <add> count++; <add> next = Math.round(start + count * spacing); <add> } <add> <ide> for (i = Math.max(start, 0); i < end; i++) { <ide> tick = ticks[i]; <ide> if (i === next) {
1
Python
Python
fix bug with validation data in graph model
e94f29cac4151b1b52f3ee419bf7191018974308
<ide><path>keras/models.py <ide> def slice_X(X, start=None, stop=None): <ide> if hasattr(start, '__len__'): <ide> # hdf5 dataset only support list object as indices <ide> if hasattr(start, 'shape'): <del> start = start.tolist() <add> start = start.tolist() <ide> return [x[start] for x in X] <ide> else: <ide> return [x[start:stop] for x in X] <ide> else: <ide> if hasattr(start, '__len__'): <ide> if hasattr(start, 'shape'): <del> start = start.tolist() <add> start = start.tolist() <ide> return X[start] <ide> else: <ide> return X[start:stop] <ide> def standardize_weights(y, sample_weight=None, class_weight=None): <ide> if len(y.shape) > 3: <ide> raise Exception('class_weight not supported for 4+ dimensional targets.') <ide> yshape = y.shape <del> y = np.reshape(y, (-1, yshape[-1])) # for time-distributed data, collapse time and sample <add> # for time-distributed data, collapse time and sample <add> y = np.reshape(y, (-1, yshape[-1])) <ide> if y.shape[1] > 1: <ide> y_classes = y.argmax(axis=1) <ide> elif y.shape[1] == 1: <ide> def fit(self, data, batch_size=128, nb_epoch=100, verbose=1, callbacks=[], <ide> val_f = self._test <ide> if validation_data: <ide> # can't use sample weights with validation data at this point <del> sample_weight = [standardize_weights(validation_data[name]) for name in self.output_order] <add> y_val = [standardize_y(data[name]) for name in self.output_order] <add> sample_weight = [standardize_weights(y_val[i]) for i in range(len(y_val))] <ide> val_ins = [validation_data[name] for name in self.input_order] + [standardize_y(validation_data[name]) for name in self.output_order] + sample_weight <ide> <ide> elif 0 < validation_split < 1:
1
Javascript
Javascript
ensure mouseenter works with svg elements on ie
941c1c35f175c36171a8855323f086341ea55711
<ide><path>src/jqLite.js <ide> function jqLiteParseHTML(html, context) { <ide> return []; <ide> } <ide> <add> <add>// IE9-11 has no method "contains" in SVG element and in Node.prototype. Bug #10259. <add>var jqLiteContains = Node.prototype.contains || function(arg) { <add> // jshint bitwise: false <add> return !!(this.compareDocumentPosition(arg) & 16); <add> // jshint bitwise: true <add>}; <add> <ide> ///////////////////////////////////////////// <ide> function JQLite(element) { <ide> if (element instanceof JQLite) { <ide> forEach({ <ide> var target = this, related = event.relatedTarget; <ide> // For mousenter/leave call the handler if related is outside the target. <ide> // NB: No relatedTarget if the mouse left/entered the browser window <del> if (!related || (related !== target && !target.contains(related))) { <add> if (!related || (related !== target && !jqLiteContains.call(target, related))) { <ide> handle(event, type); <ide> } <ide> }); <ide><path>test/jqLiteSpec.js <ide> describe('jqLite', function() { <ide> }); <ide> <ide> describe('mouseenter-mouseleave', function() { <del> var root, parent, sibling, child, log; <add> var root, parent, child, log; <ide> <del> beforeEach(function() { <add> function setup(html, parentNode, childNode) { <ide> log = ''; <del> root = jqLite('<div>root<p>parent<span>child</span></p><ul></ul></div>'); <del> parent = root.find('p'); <del> sibling = root.find('ul'); <del> child = parent.find('span'); <add> root = jqLite(html); <add> parent = root.find(parentNode); <add> child = parent.find(childNode); <ide> <ide> parent.on('mouseenter', function() { log += 'parentEnter;'; }); <ide> parent.on('mouseleave', function() { log += 'parentLeave;'; }); <ide> <ide> child.on('mouseenter', function() { log += 'childEnter;'; }); <ide> child.on('mouseleave', function() { log += 'childLeave;'; }); <del> }); <add> } <add> <add> function browserMoveTrigger(from, to) { <add> var fireEvent = function(type, element, relatedTarget) { <add> var evnt; <add> evnt = document.createEvent('MouseEvents'); <add> <add> var originalPreventDefault = evnt.preventDefault, <add> appWindow = window, <add> fakeProcessDefault = true, <add> finalProcessDefault; <add> <add> evnt.preventDefault = function() { <add> fakeProcessDefault = false; <add> return originalPreventDefault.apply(evnt, arguments); <add> }; <add> <add> var x = 0, y = 0; <add> evnt.initMouseEvent(type, true, true, window, 0, x, y, x, y, false, false, <add> false, false, 0, relatedTarget); <add> <add> element.dispatchEvent(evnt); <add> }; <add> fireEvent('mouseout', from[0], to[0]); <add> fireEvent('mouseover', to[0], from[0]); <add> } <ide> <ide> afterEach(function() { <ide> dealoc(root); <ide> }); <ide> <ide> it('should fire mouseenter when coming from outside the browser window', function() { <ide> if (window.jQuery) return; <del> var browserMoveTrigger = function(from, to) { <del> var fireEvent = function(type, element, relatedTarget) { <del> var evnt; <del> evnt = document.createEvent('MouseEvents'); <del> <del> var originalPreventDefault = evnt.preventDefault, <del> appWindow = window, <del> fakeProcessDefault = true, <del> finalProcessDefault; <del> <del> evnt.preventDefault = function() { <del> fakeProcessDefault = false; <del> return originalPreventDefault.apply(evnt, arguments); <del> }; <del> <del> var x = 0, y = 0; <del> evnt.initMouseEvent(type, true, true, window, 0, x, y, x, y, false, false, <del> false, false, 0, relatedTarget); <del> <del> element.dispatchEvent(evnt); <del> }; <del> fireEvent('mouseout', from[0], to[0]); <del> fireEvent('mouseover', to[0], from[0]); <del> }; <add> <add> setup('<div>root<p>parent<span>child</span></p><ul></ul></div>', 'p', 'span'); <ide> <ide> browserMoveTrigger(root, parent); <ide> expect(log).toEqual('parentEnter;'); <ide> describe('jqLite', function() { <ide> expect(log).toEqual('parentEnter;childEnter;childLeave;parentLeave;'); <ide> <ide> }); <add> <add> it('should fire the mousenter on SVG elements', function() { <add> if (window.jQuery) return; <add> <add> setup( <add> '<div>' + <add> '<svg xmlns="http://www.w3.org/2000/svg"' + <add> ' viewBox="0 0 18.75 18.75"' + <add> ' width="18.75"' + <add> ' height="18.75"' + <add> ' version="1.1">' + <add> ' <path d="M0,0c0,4.142,3.358,7.5,7.5,7.5s7.5-3.358,7.5-7.5-3.358-7.5-7.5-7.5-7.5,3.358-7.5,7.5"' + <add> ' fill-rule="nonzero"' + <add> ' fill="#CCC"' + <add> ' ng-attr-fill="{{data.color || \'#CCC\'}}"/>' + <add> '</svg>' + <add> '</div>', <add> 'svg', 'path'); <add> <add> browserMoveTrigger(parent, child); <add> expect(log).toEqual('childEnter;'); <add> }); <ide> }); <ide> <ide> // Only run this test for jqLite and not normal jQuery
2
Javascript
Javascript
enable es7 async functions in jest
2263cddd027601a4cf1a5aa4a9a96b349354c251
<ide><path>jestSupport/env.js <ide> global.__fbBatchedBridgeConfig = { <ide> }; <ide> <ide> global.Promise = require('promise'); <add>global.regeneratorRuntime = require.requireActual('regenerator/runtime'); <ide> <ide> jest.setMock('ErrorUtils', require('ErrorUtils'));
1
Javascript
Javascript
add german locale
b99b2b80b01a4c972b7d9b855fff7d83eec9939b
<ide><path>src/locale/de.js <add>import "locale"; <add> <add>d3.locale.de = d3.locale({ <add> decimal: ",", <add> thousands: ".", <add> grouping: [3], <add> currency: ["", " €"], <add> dateTime: "%A der %e. %B %Y, %X", <add> date: "%e.%m.%Y", <add> time: "%H:%M:%S", <add> periods: ["AM", "PM"], // unused <add> days: ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"], <add> shortDays: ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"], <add> months: ["Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"], <add> shortMonths: ["Jan", "Feb", "Mrz", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dez"] <add>});
1
PHP
PHP
get default locale before setting a new locale
6e54d273c74e71d8c6150e2f6710d4e9f537c94c
<ide><path>src/I18n/I18n.php <ide> public static function locale($locale = null) <ide> */ <ide> public static function setLocale($locale) <ide> { <add> static::getDefaultLocale(); <ide> Locale::setDefault($locale); <ide> if (isset(static::$_collection)) { <ide> static::translators()->setLocale($locale);
1
Javascript
Javascript
remove build from mobile curriculum test
62957fd8752061723cac1277bbb80c96af14516b
<ide><path>tools/scripts/build/mobile-curriculum.test.js <ide> const path = require('path'); <ide> const fs = require('fs'); <ide> const { AssertionError } = require('chai'); <del>const { getChallengesForLang } = require('../../../curriculum/getChallenges'); <ide> const envData = require('../../../config/env.json'); <del>const { buildMobileCurriculum } = require('./build-mobile-curriculum'); <ide> const { mobileSchemaValidator } = require('./mobileSchema'); <ide> <ide> if (envData.clientLocale == 'english' && !envData.showUpcomingChanges) { <ide> if (envData.clientLocale == 'english' && !envData.showUpcomingChanges) { <ide> <ide> const validateMobileSuperBlock = mobileSchemaValidator(); <ide> <del> let curriculum; <del> <del> beforeAll(async () => { <del> curriculum = await getChallengesForLang('english'); <del> await buildMobileCurriculum(curriculum); <del> }, 20000); <del> <ide> test('the mobile curriculum should have a static folder with multiple files', () => { <ide> expect(fs.existsSync(`${mobileStaticPath}/mobile`)).toBe(true); <ide>
1
Ruby
Ruby
add sass-rails back to the default gemfile
692bb7cebc7df6494adf6b068321eb3fc29acaf9
<ide><path>railties/lib/rails/generators/app_base.rb <ide> def assets_gemfile_entry <ide> return [] if options[:skip_sprockets] <ide> <ide> gems = [] <add> gems << GemfileEntry.version('sass-rails', '~> 5.0', <add> 'Use SCSS for stylesheets') <ide> <ide> gems << GemfileEntry.version('uglifier', <ide> '>= 1.3.0', <ide><path>railties/test/generators/app_generator_test.rb <ide> def test_generator_if_skip_action_mailer_is_given <ide> end <ide> end <ide> <add> def test_generator_has_assets_gems <add> run_generator <add> <add> assert_gem 'sass-rails' <add> assert_gem 'uglifier' <add> end <add> <ide> def test_generator_if_skip_sprockets_is_given <ide> run_generator [destination_root, "--skip-sprockets"] <ide> assert_no_file "config/initializers/assets.rb"
2
PHP
PHP
add comment to boostrap
3780da4ad1c6644b73390b950d180f81a970cc1d
<ide><path>laravel/laravel.php <ide> } <ide> <ide> /** <del> * Route the request to the proper route in the application. If a <del> * route is found, the route will be called via the request class <del> * static property. If no route is found, the 404 response will <del> * be returned to the browser. <add> * If the requset URI has too many segments, we will bomb out of <add> * the request. This is too avoid potential DDoS attacks against <add> * the framework by overloading the controller lookup method <add> * with thousands of segments. <ide> */ <ide> $uri = URI::current(); <ide> <ide> throw new \Exception("Invalid request. Too many URI segments."); <ide> } <ide> <add>/** <add> * Route the request to the proper route in the application. If a <add> * route is found, the route will be called via the request class <add> * static property. If no route is found, the 404 response will <add> * be returned to the browser. <add> */ <ide> Request::$route = Routing\Router::route(Request::method(), $uri); <ide> <ide> if (is_null(Request::$route))
1
Python
Python
add test for long seeks in windows 64 bit systems
54b7a0d21de9cb31017d8e00de67f3207d7629a2
<ide><path>numpy/core/tests/test_multiarray.py <ide> def test_binary(self): <ide> array([1,2,3,4]), <ide> dtype='<f4') <ide> <add> @dec.slow # takes > 1 minute on mechanical hard drive <add> def test_big_binary(self): <add> """Test workarounds for 32-bit limited fwrite, fseek, and ftell <add> calls in windows. These normally would hang doing something like this. <add> See http://projects.scipy.org/numpy/ticket/1660""" <add> if sys.platform != 'win32': <add> return <add> try: <add> # before workarounds, only up to 2**32-1 worked <add> fourgbplus = 2**32 + 2**16 <add> testbytes = np.arange(8, dtype=np.int8) <add> n = len(testbytes) <add> flike = tempfile.NamedTemporaryFile() <add> f = flike.file <add> np.tile(testbytes, fourgbplus // testbytes.nbytes).tofile(f) <add> flike.seek(0) <add> a = np.fromfile(f, dtype=np.int8) <add> flike.close() <add> assert_(len(a) == fourgbplus) <add> # check only start and end for speed: <add> assert_((a[:n] == testbytes).all()) <add> assert_((a[-n:] == testbytes).all()) <add> except MemoryError: <add> pass <add> <ide> def test_string(self): <ide> self._check_from('1,2,3,4', [1., 2., 3., 4.], sep=',') <ide>
1
Text
Text
improve instructions on opening a terminal
28e8abfa59341377a6568413dfc207ce1e1c7909
<ide><path>guides/source/getting_started.md <ide> TIP: The examples below use # and $ to denote superuser and regular user termina <ide> <ide> ### Installing Rails <ide> <del>Open up a command line prompt. On a mac this is called terminal, on windows it is called command prompt. Any commands prefaced with a dollar sign `$` should be run in the command line. Verify sure you have a current version of Ruby installed: <add>Open up a command line prompt. On Mac OS X open Terminal.app, on Windows choose <add>"Run" from your Start menu and type 'cmd.exe'. Any commands prefaced with a <add>dollar sign `$` should be run in the command line. Verify sure you have a <add>current version of Ruby installed: <ide> <ide> ```bash <ide> $ ruby -v
1
Python
Python
use defaults for vdc and network
8c0b172efb0e3159d9debeeeff39cdd75048d917
<ide><path>libcloud/drivers/vcloud.py <ide> def vdcs(self): <ide> <ide> return self._vdcs <ide> <add> @property <add> def networks(self): <add> networks = [] <add> for vdc in self.vdcs: <add> res = self.connection.request(vdc).object <add> networks.extend( <add> [network for network in res.findall(fixxpath(res, "AvailableNetworks/Network"))] <add> ) <add> <add> return networks <add> <ide> def _to_image(self, image): <ide> image = NodeImage(id=image.get('href'), <ide> name=image.get('name'), <ide> def list_images(self): <ide> def create_node(self, name, image, size, **kwargs): <ide> """Creates and returns node. <ide> <del> Non-standard required keyword arguments: <add> Non-standard optional keyword arguments: <ide> network -- link to a "Network" e.g., "https://services.vcloudexpress.terremark.com/api/v0.8/network/7" <ide> vdc -- link to a "VDC" e.g., "https://services.vcloudexpress.terremark.com/api/v0.8/vdc/1" <del> <del> Non-standard optional keyword arguments: <ide> cpus -- number of virtual cpus (limit depends on provider) <ide> password <ide> row <ide> group <ide> """ <add> # Some providers don't require a network link <add> try: <add> network = kwargs.get('network', self.networks[0].get('href')) <add> except IndexError: <add> network = '' <ide> <ide> instantiate_xml = InstantiateVAppXML( <ide> name=name, <ide> template=image.id, <del> net_href=kwargs['network'], <add> net_href=network, <ide> cpus=str(kwargs.get('cpus', 1)), <ide> memory=str(size.ram), <ide> password=kwargs.get('password', None), <ide> def create_node(self, name, image, size, **kwargs): <ide> ) <ide> <ide> # Instantiate VM and get identifier. <del> res = self.connection.request('%s/action/instantiateVAppTemplate' % kwargs['vdc'], <add> res = self.connection.request('%s/action/instantiateVAppTemplate' % kwargs.get('vdc', self.vdcs[0]), <ide> data=instantiate_xml.tostring(), <ide> method='POST', <ide> headers={'Content-Type': 'application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml'}) <ide><path>test/test_vcloud.py <ide> def _api_v0_8_vdc_111111(self, method, url, body, headers): <ide> type="application/vnd.vmware.vcloud.vApp+xml" <ide> name="197833"/> <ide> </ResourceEntities> <add> <AvailableNetworks> <add> <Network href="https://services.vcloudexpress.terremark.com/api/v0.8/network/7" type="application/vnd.vmware.vcloud.network+xml" name="172.16.20.0/28"/> <add> </AvailableNetworks> <ide> </Vdc>""" <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK])
2
Javascript
Javascript
use createreadstream instead of readstream
aec019030d9a2dc0d108eb22995bc379a7d0da08
<ide><path>test/parallel/test-fs-read-stream.js <ide> const rangeFile = fixtures.path('x.txt'); <ide> let paused = false; <ide> let bytesRead = 0; <ide> <del> const file = fs.ReadStream(fn); <add> const file = fs.createReadStream(fn); <ide> const fileSize = fs.statSync(fn).size; <ide> <ide> assert.strictEqual(file.bytesRead, 0);
1
Ruby
Ruby
remove unused templaterunner attributes
2dc5d12c91d0c717f7bac6b544193e810ce4917a
<ide><path>railties/lib/rails_generator/generators/applications/app/template_runner.rb <ide> <ide> module Rails <ide> class TemplateRunner <del> attr_reader :behavior, :description, :root <add> attr_reader :root <ide> <ide> def initialize(root, template) # :nodoc: <ide> @root = Dir.pwd + "/" + root
1
Text
Text
fix typo in the api remote reference for links
72a0272a62f881fefb8dea5986b865fea36113ab
<ide><path>docs/sources/reference/api/docker_remote_api_v1.15.md <ide> Json Parameters: <ide> volume for the container), `host_path:container_path` (to bind-mount <ide> a host path into the container), or `host_path:container_path:ro` <ide> (to make the bind-mount read-only inside the container). <del> - **Links** - A list of links for the container. Each link entry should be of <del> of the form "container_name:alias". <add> - **Links** - A list of links for the container. Each link entry should be <add> in the form of "container_name:alias". <ide> - **LxcConf** - LXC specific configurations. These configurations will only <ide> work when using the `lxc` execution driver. <ide> - **PortBindings** - A map of exposed container ports and the host port they <ide><path>docs/sources/reference/api/docker_remote_api_v1.16.md <ide> Json Parameters: <ide> volume for the container), `host_path:container_path` (to bind-mount <ide> a host path into the container), or `host_path:container_path:ro` <ide> (to make the bind-mount read-only inside the container). <del> - **Links** - A list of links for the container. Each link entry should be of <del> of the form "container_name:alias". <add> - **Links** - A list of links for the container. Each link entry should be <add> in the form of "container_name:alias". <ide> - **LxcConf** - LXC specific configurations. These configurations will only <ide> work when using the `lxc` execution driver. <ide> - **PortBindings** - A map of exposed container ports and the host port they <ide><path>docs/sources/reference/api/docker_remote_api_v1.17.md <ide> Json Parameters: <ide> volume for the container), `host_path:container_path` (to bind-mount <ide> a host path into the container), or `host_path:container_path:ro` <ide> (to make the bind-mount read-only inside the container). <del> - **Links** - A list of links for the container. Each link entry should be of <del> of the form "container_name:alias". <add> - **Links** - A list of links for the container. Each link entry should be <add> in the form of "container_name:alias". <ide> - **LxcConf** - LXC specific configurations. These configurations will only <ide> work when using the `lxc` execution driver. <ide> - **PortBindings** - A map of exposed container ports and the host port they <ide><path>docs/sources/reference/api/docker_remote_api_v1.18.md <ide> Json Parameters: <ide> volume for the container), `host_path:container_path` (to bind-mount <ide> a host path into the container), or `host_path:container_path:ro` <ide> (to make the bind-mount read-only inside the container). <del> - **Links** - A list of links for the container. Each link entry should be of <del> of the form `container_name:alias`. <add> - **Links** - A list of links for the container. Each link entry should be <add> in the form of `container_name:alias`. <ide> - **LxcConf** - LXC specific configurations. These configurations will only <ide> work when using the `lxc` execution driver. <ide> - **PortBindings** - A map of exposed container ports and the host port they <ide><path>docs/sources/reference/api/docker_remote_api_v1.19.md <ide> Json Parameters: <ide> volume for the container), `host_path:container_path` (to bind-mount <ide> a host path into the container), or `host_path:container_path:ro` <ide> (to make the bind-mount read-only inside the container). <del> - **Links** - A list of links for the container. Each link entry should be of <del> of the form `container_name:alias`. <add> - **Links** - A list of links for the container. Each link entry should be <add> in the form of `container_name:alias`. <ide> - **LxcConf** - LXC specific configurations. These configurations will only <ide> work when using the `lxc` execution driver. <ide> - **PortBindings** - A map of exposed container ports and the host port they
5
PHP
PHP
add sponsor link
0e01834bedb0a360608e4eec6c71418454004ce6
<ide><path>resources/views/welcome.blade.php <ide> </div> <ide> </div> <ide> <del> <div class="mt-4 text-center text-sm text-gray-500 sm:text-right"> <del> Build v{{ Illuminate\Foundation\Application::VERSION }} <add> <div class="flex justify-center mt-4 sm:items-center sm:justify-between"> <add> <div class="text-center text-sm text-gray-500 sm:text-left"> <add> <div class="flex items-center"> <add> <svg fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" viewBox="0 0 24 24" class="-mt-px w-5 h-5 text-gray-400"> <add> <path d="M4.318 6.318a4.5 4.5 0 000 6.364L12 20.364l7.682-7.682a4.5 4.5 0 00-6.364-6.364L12 7.636l-1.318-1.318a4.5 4.5 0 00-6.364 0z"></path> <add> </svg> <add> <add> <a href="https://github.com/sponsors/taylorotwell" class="ml-1 underline"> <add> Sponsor <add> </a> <add> </div> <add> </div> <add> <add> <div class="ml-4 text-center text-sm text-gray-500 sm:text-right sm:ml-0"> <add> Build v{{ Illuminate\Foundation\Application::VERSION }} <add> </div> <ide> </div> <ide> </div> <ide> </div>
1
Javascript
Javascript
remove failing benchmark parameter
99f61677a99e115297953f236866149a11aa315b
<ide><path>benchmark/child_process/child-process-read-ipc.js <ide> if (process.argv[2] === 'child') { <ide> const bench = common.createBenchmark(main, { <ide> len: [ <ide> 64, 256, 1024, 4096, 16384, 65536, <del> 65536 << 4, 65536 << 8, <add> 65536 << 4, 65536 << 6 - 1, <ide> ], <ide> dur: [5] <ide> });
1
Text
Text
match characters th…
f2c3d635ef8af5874cfa9de5c0bc6c3ea824e75c
<ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/match-characters-that-occur-zero-or-more-times.english.md <ide> let result = chewieQuote.match(chewieRegex); <ide> <section id='solution'> <ide> <ide> ```js <del>// solution required <add> let chewieQuote = "Aaaaaaaaaaaaaaaarrrgh!"; <add> let chewieRegex = /Aa*/; <add> let result = chewieQuote.match(chewieRegex); <ide> ``` <ide> </section>
1
Javascript
Javascript
add test case for missing branch
254b5f04e7b309146cb8ade1d1fb0b804b964a51
<ide><path>test/parallel/test-crypto-engine.js <ide> if (!common.hasCrypto) <ide> common.skip('missing crypto'); <ide> <ide> const crypto = require('crypto'); <add>const invalidEngineName = 'xxx'; <ide> <ide> common.expectsError( <ide> () => crypto.setEngine(true), <ide> common.expectsError( <ide> type: TypeError, <ide> message: 'The "flags" argument must be of type number' <ide> }); <add> <add>common.expectsError( <add> () => crypto.setEngine(invalidEngineName), <add> { <add> code: 'ERR_CRYPTO_ENGINE_UNKNOWN', <add> type: Error, <add> message: `Engine "${invalidEngineName}" was not found` <add> }); <add> <add>common.expectsError( <add> () => crypto.setEngine(invalidEngineName, crypto.constants.ENGINE_METHOD_RSA), <add> { <add> code: 'ERR_CRYPTO_ENGINE_UNKNOWN', <add> type: Error, <add> message: `Engine "${invalidEngineName}" was not found` <add> });
1
Javascript
Javascript
add network agent
1709043a123823260b51174060fb8f4de8370dcb
<ide><path>Libraries/Core/InitializeCore.js <ide> navigator.product = 'ReactNative'; <ide> defineProperty(navigator, 'geolocation', () => require('Geolocation')); <ide> <ide> // Set up collections <del>// We can't make these lazy because `Map` checks for `global.Map` (which would <add>// We can't make these lazy because `Map` checks for `global.Map` (which wouldc <ide> // not exist if it were lazily defined). <ide> defineProperty(global, 'Map', () => require('Map'), true); <ide> defineProperty(global, 'Set', () => require('Set'), true); <ide> if (__DEV__) { <ide> require('react-transform-hmr'); <ide> } <ide> <add>// Set up inspector <add>if (__DEV__) { <add> const JSInspector = require('JSInspector'); <add> JSInspector.registerAgent(require('NetworkAgent')); <add>} <add> <ide> // Just to make sure the JS gets packaged up. Wait until the JS environment has <ide> // been initialized before requiring them. <ide> require('RCTDeviceEventEmitter'); <ide><path>Libraries/JSInspector/NetworkAgent.js <add>/** <add> * Copyright (c) 2015-present, Facebook, Inc. <add> * All rights reserved. <add> * <add> * This source code is licensed under the BSD-style license found in the <add> * LICENSE file in the root directory of this source tree. An additional grant <add> * of patent rights can be found in the PATENTS file in the same directory. <add> * <add> * @providesModule NetworkAgent <add> * @flow <add> */ <add>'use strict'; <add> <add>const InspectorAgent = require('InspectorAgent'); <add>const JSInspector = require('JSInspector'); <add>const Map = require('Map'); <add>const XMLHttpRequest = require('XMLHttpRequest'); <add> <add>import type EventSender from 'InspectorAgent'; <add> <add>type RequestId = string; <add> <add>type LoaderId = string; <add>type FrameId = string; <add>type Timestamp = number; <add> <add>type Headers = Object; <add> <add>// We don't currently care about this <add>type ResourceTiming = null; <add> <add>type ResourceType = <add> 'Document' | <add> 'Stylesheet' | <add> 'Image' | <add> 'Media' | <add> 'Font' | <add> 'Script' | <add> 'TextTrack' | <add> 'XHR' | <add> 'Fetch' | <add> 'EventSource' | <add> 'WebSocket' | <add> 'Manifest' | <add> 'Other'; <add> <add>type SecurityState = <add> 'unknown' | <add> 'neutral' | <add> 'insecure' | <add> 'warning' | <add> 'secure' | <add> 'info'; <add>type BlockedReason = <add> 'csp' | <add> 'mixed-content' | <add> 'origin' | <add> 'inspector' | <add> 'subresource-filter' | <add> 'other'; <add> <add>type StackTrace = null; <add> <add>type Initiator = { <add> type: 'script' | 'other', <add> stackTrace?: StackTrace, <add> url?: string, <add> lineNumber?: number <add>} <add> <add>type ResourcePriority = 'VeryLow' | 'Low' | 'Medium' | 'High' | 'VeryHigh'; <add> <add>type Request = { <add> url: string, <add> method: string, <add> headers: Headers, <add> postData?: string, <add> mixedContentType?: 'blockable' | 'optionally-blockable' | 'none', <add> initialPriority: ResourcePriority, <add>}; <add> <add>type Response = { <add> url: string, <add> status: number, <add> statusText: string, <add> headers: Headers, <add> headersText?: string, <add> mimeType: string, <add> requestHeaders?: Headers, <add> requestHeadersText?: string, <add> connectionReused: boolean, <add> connectionId: number, <add> fromDiskCache?: boolean, <add> encodedDataLength: number, <add> timing?: ResourceTiming, <add> securityState: SecurityState, <add>}; <add> <add>type RequestWillBeSentEvent = { <add> requestId: RequestId, <add> frameId: FrameId, <add> loaderId: LoaderId, <add> documentURL: string, <add> request: Request, <add> timestamp: Timestamp, <add> initiator: Initiator, <add> redirectResponse?: Response, <add> // This is supposed to be optional but the inspector crashes without it, <add> // see https://bugs.chromium.org/p/chromium/issues/detail?id=653138 <add> type: ResourceType, <add>}; <add> <add>type ResponseReceivedEvent = { <add> requestId: RequestId, <add> frameId: FrameId, <add> loaderId: LoaderId, <add> timestamp: Timestamp, <add> type: ResourceType, <add> response: Response, <add>}; <add> <add>type DataReceived = { <add> requestId: RequestId, <add> timestamp: Timestamp, <add> dataLength: number, <add> encodedDataLength: number, <add>}; <add> <add>type LoadingFinishedEvent = { <add> requestId: RequestId, <add> timestamp: Timestamp, <add> encodedDataLength: number, <add>}; <add> <add>type LoadingFailedEvent = { <add> requestId: RequestId, <add> timestamp: Timestamp, <add> type: ResourceType, <add> errorText: string, <add> canceled?: boolean, <add> blockedReason?: BlockedReason, <add>}; <add> <add>class Interceptor { <add> _agent: NetworkAgent; <add> _requests: Map<string, string>; <add> <add> constructor(agent: NetworkAgent) { <add> this._agent = agent; <add> this._requests = new Map(); <add> } <add> <add> getData(requestId: string): ?string { <add> return this._requests.get(requestId); <add> } <add> <add> requestSent( <add> id: number, <add> url: string, <add> method: string, <add> headers: Object) { <add> const requestId = String(id); <add> this._requests.set(requestId, ''); <add> <add> const request: Request = { <add> url, <add> method, <add> headers, <add> initialPriority: 'Medium', <add> }; <add> const event: RequestWillBeSentEvent = { <add> requestId, <add> documentURL: '', <add> frameId: '1', <add> loaderId: '1', <add> request, <add> timestamp: JSInspector.getTimestamp(), <add> initiator: { <add> // TODO(blom): Get stack trace <add> // If type is 'script' the inspector will try to execute <add> // `stack.callFrames[0]` <add> type: 'other', <add> }, <add> type: 'Other', <add> }; <add> this._agent.sendEvent('requestWillBeSent', event); <add> } <add> <add> responseReceived( <add> id: number, <add> url: string, <add> status: number, <add> headers: Object) { <add> const requestId = String(id); <add> const response: Response = { <add> url, <add> status, <add> statusText: String(status), <add> headers, <add> // TODO(blom) refined headers, can we get this? <add> requestHeaders: {}, <add> mimeType: this._getMimeType(headers), <add> connectionReused: false, <add> connectionId: -1, <add> encodedDataLength: 0, <add> securityState: 'unknown', <add> }; <add> <add> const event: ResponseReceivedEvent = { <add> requestId, <add> frameId: '1', <add> loaderId: '1', <add> timestamp: JSInspector.getTimestamp(), <add> type: 'Other', <add> response, <add> }; <add> this._agent.sendEvent('responseReceived', event); <add> } <add> <add> dataReceived( <add> id: number, <add> data: string) { <add> const requestId = String(id); <add> const existingData = this._requests.get(requestId) || ''; <add> this._requests.set(requestId, existingData.concat(data)); <add> const event: DataReceived = { <add> requestId, <add> timestamp: JSInspector.getTimestamp(), <add> dataLength: data.length, <add> encodedDataLength: data.length, <add> }; <add> this._agent.sendEvent('dataReceived', event); <add> } <add> <add> loadingFinished( <add> id: number, <add> encodedDataLength: number) { <add> const event: LoadingFinishedEvent = { <add> requestId: String(id), <add> timestamp: JSInspector.getTimestamp(), <add> encodedDataLength: encodedDataLength, <add> }; <add> this._agent.sendEvent('loadingFinished', event); <add> } <add> <add> loadingFailed( <add> id: number, <add> error: string) { <add> const event: LoadingFailedEvent = { <add> requestId: String(id), <add> timestamp: JSInspector.getTimestamp(), <add> type: 'Other', <add> errorText: error, <add> }; <add> this._agent.sendEvent('loadingFailed', event); <add> } <add> <add> _getMimeType(headers: Object): string { <add> const contentType = headers['Content-Type'] || ''; <add> return contentType.split(';')[0]; <add> } <add>} <add> <add>type EnableArgs = { <add> maxResourceBufferSize?: number, <add> maxTotalBufferSize?: number <add>}; <add> <add>class NetworkAgent extends InspectorAgent { <add> static DOMAIN = 'Network'; <add> <add> _sendEvent: EventSender; <add> _interceptor: ?Interceptor; <add> <add> enable({ maxResourceBufferSize, maxTotalBufferSize }: EnableArgs) { <add> this._interceptor = new Interceptor(this); <add> XMLHttpRequest.setInterceptor(this._interceptor); <add> } <add> <add> disable() { <add> XMLHttpRequest.setInterceptor(null); <add> this._interceptor = null; <add> } <add> <add> getResponseBody({requestId}: {requestId: RequestId}) <add> : {body: ?string, base64Encoded: boolean} { <add> return {body: this.interceptor().getData(requestId), base64Encoded: false}; <add> } <add> <add> interceptor(): Interceptor { <add> if (this._interceptor) { <add> return this._interceptor; <add> } else { <add> throw Error('_interceptor can not be null'); <add> } <add> <add> } <add>} <add> <add>module.exports = NetworkAgent; <ide><path>Libraries/Network/XMLHttpRequest.js <ide> */ <ide> 'use strict'; <ide> <add>const EventTarget = require('event-target-shim'); <ide> const RCTNetworking = require('RCTNetworking'); <ide> <del>const EventTarget = require('event-target-shim'); <ide> const base64 = require('base64-js'); <ide> const invariant = require('fbjs/lib/invariant'); <ide> const warning = require('fbjs/lib/warning'); <ide> <ide> type ResponseType = '' | 'arraybuffer' | 'blob' | 'document' | 'json' | 'text'; <ide> type Response = ?Object | string; <ide> <add>type XHRInterceptor = { <add> requestSent: ( <add> id: number, <add> url: string, <add> method: string, <add> headers: Object) => void, <add> responseReceived: ( <add> id: number, <add> url: string, <add> status: number, <add> headers: Object) => void, <add> dataReceived: ( <add> id: number, <add> data: string) => void, <add> loadingFinished: ( <add> id: number, <add> encodedDataLength: number) => void, <add> loadingFailed: ( <add> id: number, <add> error: string) => void, <add>}; <add> <ide> const UNSENT = 0; <ide> const OPENED = 1; <ide> const HEADERS_RECEIVED = 2; <ide> class XMLHttpRequest extends EventTarget(...XHR_EVENTS) { <ide> static LOADING: number = LOADING; <ide> static DONE: number = DONE; <ide> <add> static _interceptor: ?XHRInterceptor = null; <add> <ide> UNSENT: number = UNSENT; <ide> OPENED: number = OPENED; <ide> HEADERS_RECEIVED: number = HEADERS_RECEIVED; <ide> class XMLHttpRequest extends EventTarget(...XHR_EVENTS) { <ide> _trackingName: string = 'unknown'; <ide> _incrementalEvents: boolean = false; <ide> <add> static setInterceptor(interceptor: ?XHRInterceptor) { <add> XMLHttpRequest._interceptor = interceptor; <add> } <add> <ide> constructor() { <ide> super(); <ide> this._reset(); <ide> class XMLHttpRequest extends EventTarget(...XHR_EVENTS) { <ide> // exposed for testing <ide> __didCreateRequest(requestId: number): void { <ide> this._requestId = requestId; <add> <add> XMLHttpRequest._interceptor && XMLHttpRequest._interceptor.requestSent( <add> requestId, <add> this._url || '', <add> this._method || 'GET', <add> this._headers); <ide> } <ide> <ide> // exposed for testing <ide> class XMLHttpRequest extends EventTarget(...XHR_EVENTS) { <ide> } else { <ide> delete this.responseURL; <ide> } <add> <add> XMLHttpRequest._interceptor && XMLHttpRequest._interceptor.responseReceived( <add> requestId, <add> responseURL || this._url || '', <add> status, <add> responseHeaders || {}); <ide> } <ide> } <ide> <ide> class XMLHttpRequest extends EventTarget(...XHR_EVENTS) { <ide> this._response = response; <ide> this._cachedResponse = undefined; // force lazy recomputation <ide> this.setReadyState(this.LOADING); <add> <add> XMLHttpRequest._interceptor && XMLHttpRequest._interceptor.dataReceived( <add> requestId, <add> response); <ide> } <ide> <ide> __didReceiveIncrementalData( <ide> class XMLHttpRequest extends EventTarget(...XHR_EVENTS) { <ide> } else { <ide> this._response += responseText; <ide> } <add> <add> XMLHttpRequest._interceptor && XMLHttpRequest._interceptor.dataReceived( <add> requestId, <add> responseText); <add> <ide> this.setReadyState(this.LOADING); <ide> this.__didReceiveDataProgress(requestId, progress, total); <ide> } <ide> class XMLHttpRequest extends EventTarget(...XHR_EVENTS) { <ide> this._clearSubscriptions(); <ide> this._requestId = null; <ide> this.setReadyState(this.DONE); <add> <add> if (error) { <add> XMLHttpRequest._interceptor && XMLHttpRequest._interceptor.loadingFailed( <add> requestId, <add> error); <add> } else { <add> XMLHttpRequest._interceptor && XMLHttpRequest._interceptor.loadingFinished( <add> requestId, <add> this._response.length); <add> } <ide> } <ide> } <ide>
3
Python
Python
fix shlex.split for non-posix
3487214ba182572a8696152ec671f08078e0dc91
<ide><path>spacy/cli/project.py <ide> <ide> from ._app import app, Arg, Opt, COMMAND, NAME <ide> from .. import about <add>from ..compat import is_windows <ide> from ..schemas import ProjectConfigSchema, validate <ide> from ..util import ensure_path, run_command, make_tempdir, working_dir <ide> from ..util import get_hash, get_checksum <ide> def project_clone( <ide> # We're using Git and sparse checkout to only clone the files we need <ide> with make_tempdir() as tmp_dir: <ide> cmd = f"git clone {repo} {tmp_dir} --no-checkout --depth 1 --config core.sparseCheckout=true" <del> run_command(shlex.split(cmd)) <add> try: <add> run_command(shlex.split(cmd, posix=not is_windows)) <add> except: <add> raise RuntimeError(f"Could not clone the repo '{repo}' into the temp dir '{tmp_dir}'.") <ide> with (tmp_dir / ".git" / "info" / "sparse-checkout").open("w") as f: <ide> f.write(name) <ide> run_command(["git", "-C", tmp_dir, "fetch"])
1
Javascript
Javascript
fix array sorting bug
6514a4128c3e7aa6c1bb1c6f3f018412fa76e5d9
<ide><path>test/simple/test-crypto.js <ide> <ide> var common = require('../common'); <ide> var assert = require('assert'); <add>var util = require('util'); <ide> <ide> try { <ide> var crypto = require('crypto'); <ide> testPBKDF2('pass\0word', 'sa\0lt', 4096, 16, <ide> })(); <ide> <ide> function assertSorted(list) { <del> assert.deepEqual(list, list.sort()); <add> // Array#sort() modifies the list in place so make a copy. <add> var sorted = util._extend([], list).sort(); <add> assert.deepEqual(list, sorted); <ide> } <ide> <ide> // Assume that we have at least AES-128-CBC.
1
Text
Text
fix incorrect date in changelog
e2352e6071af9c1a0865478d24f8f2c44778ebc8
<ide><path>CHANGELOG.md <ide> # Ember Changelog <ide> <del>### v3.6.0-beta.2 (October 27, 2018) <add>### v3.6.0-beta.2 (October 29, 2018) <ide> <ide> - [#17130](https://github.com/emberjs/ember.js/pull/17130) [BUGFIX] Ensure that timers scheduled after a system sleep are fired properly. <ide> - [#17137](https://github.com/emberjs/ember.js/pull/17137) [BUGFIX] Assert when local variables shadow modifier invocations
1
Java
Java
remove unused glassfishloadtimeweavertests
c5779e2ed6b2235dfac8de20aa9a2faf22dfc317
<ide><path>spring-context/src/test/java/org/springframework/instrument/classloading/glassfish/GlassFishLoadTimeWeaverTests.java <del>/* <del> * Copyright 2002-2012 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.instrument.classloading.glassfish; <del> <del>import org.junit.Ignore; <del> <del>// converting away from old-style EasyMock APIs was problematic with this class <del>// glassfish dependencies no longer on classpath <del>@Ignore <del>public class GlassFishLoadTimeWeaverTests { <del> <del>// private MockControl loaderCtrl; <del>// private GlassFishClassLoaderAdapter loader; <del>// private LoadTimeWeaver ltw; <del>// <del>// private class DummyInstrumentableClassLoader extends SecureClassLoader { <del>// <del>// String INSTR_CL_NAME = GlassFishClassLoaderAdapter.INSTRUMENTABLE_CLASSLOADER_GLASSFISH_V2; <del>// <del>// public DummyInstrumentableClassLoader() { <del>// super(); <del>// } <del>// <del>// public DummyInstrumentableClassLoader(ClassLoader parent) { <del>// super(parent); <del>// } <del>// <del>// private List<ClassTransformer> v2Transformers = new ArrayList<ClassTransformer>(); <del>// private List<ClassFileTransformer> v3Transformers = new ArrayList<ClassFileTransformer>(); <del>// <del>// public void addTransformer(ClassTransformer transformer) { <del>// v2Transformers.add(transformer); <del>// } <del>// <del>// public void addTransformer(ClassFileTransformer transformer) { <del>// v3Transformers.add(transformer); <del>// } <del>// <del>// public ClassLoader copy() { <del>// return new DummyInstrumentableClassLoader(); <del>// } <del>// <del>// @Override <del>// public Class<?> loadClass(String name) throws ClassNotFoundException { <del>// if (INSTR_CL_NAME.equals(name)) { <del>// return this.getClass(); <del>// } <del>// <del>// return getClass().getClassLoader().loadClass(name); <del>// } <del>// } <del>// <del>// @Before <del>// public void setUp() throws Exception { <del>// ltw = new GlassFishLoadTimeWeaver(new DummyInstrumentableClassLoader()); <del>// } <del>// <del>// @After <del>// public void tearDown() throws Exception { <del>// loaderCtrl.verify(); <del>// ltw = null; <del>// } <del>// <del>// @Test <del>// public void testGlassFishLoadTimeWeaver() { <del>// try { <del>// ltw = new GlassFishLoadTimeWeaver(); <del>// fail("expected exception"); <del>// } catch (IllegalArgumentException ex) { <del>// // expected <del>// } <del>// <del>// } <del>// <del>// @Test <del>// public void testGlassFishLoadTimeWeaverClassLoader() { <del>// try { <del>// ltw = new GlassFishLoadTimeWeaver(null); <del>// fail("expected exception"); <del>// } catch (RuntimeException e) { <del>// // expected <del>// } <del>// <del>// ClassLoader cl1 = new URLClassLoader(new URL[0]); <del>// ClassLoader cl2 = new URLClassLoader(new URL[0], cl1); <del>// ClassLoader cl3 = new DummyInstrumentableClassLoader(cl2); <del>// ClassLoader cl4 = new URLClassLoader(new URL[0], cl3); <del>// <del>// ltw = new GlassFishLoadTimeWeaver(cl4); <del>// assertSame(cl3, ltw.getInstrumentableClassLoader()); <del>// <del>// cl1 = new URLClassLoader(new URL[0]); <del>// cl2 = new URLClassLoader(new URL[0], cl1); <del>// cl3 = new DummyInstrumentableClassLoader(cl2); <del>// cl4 = new DummyInstrumentableClassLoader(cl3); <del>// <del>// ltw = new GlassFishLoadTimeWeaver(cl4); <del>// assertSame(cl4, ltw.getInstrumentableClassLoader()); <del>// } <del>// <del>// @Test <del>// public void testAddTransformer() { <del>// ClassFileTransformer transformer = MockControl.createNiceControl(ClassFileTransformer.class).getMock(); <del>// loaderCtrl.reset(); <del>// loader.addTransformer(transformer); <del>// loaderCtrl.setMatcher(new ArgumentsMatcher() { <del>// <del>// public boolean matches(Object[] arg0, Object[] arg1) { <del>// for (int i = 0; i < arg0.length; i++) { <del>// if (arg0 != null && arg0.getClass() != arg1.getClass()) <del>// return false; <del>// } <del>// return true; <del>// } <del>// <del>// public String toString(Object[] arg0) { <del>// return Arrays.toString(arg0); <del>// } <del>// <del>// }); <del>// <del>// loaderCtrl.replay(); <del>// <del>// ltw.addTransformer(transformer); <del>// } <del>// <del>// @Test <del>// public void testGetThrowawayClassLoader() { <del>// loaderCtrl.reset(); <del>// ClassLoader cl = new URLClassLoader(new URL[0]); <del>// loaderCtrl.expectAndReturn(loader.getClassLoader(), cl); <del>// loaderCtrl.replay(); <del>// <del>// assertSame(ltw.getThrowawayClassLoader(), cl); <del>// } <del>}
1
Javascript
Javascript
improve socket.write() error message
ec49fc822901e1a0deb510a876485f5e94b72866
<ide><path>lib/net.js <ide> Socket.prototype.__defineGetter__('localPort', function() { <ide> <ide> <ide> Socket.prototype.write = function(chunk, encoding, cb) { <del> if (typeof chunk !== 'string' && !(chunk instanceof Buffer)) <del> throw new TypeError('Invalid data'); <add> if (typeof chunk !== 'string' && !(chunk instanceof Buffer)) { <add> throw new TypeError( <add> 'Invalid data, chunk must be a string or buffer, not ' + typeof chunk); <add> } <ide> return stream.Duplex.prototype.write.apply(this, arguments); <ide> }; <ide> <ide><path>test/parallel/test-net-socket-write-error.js <add>'use strict'; <add> <add>const common = require('../common'); <add>const assert = require('assert'); <add>const net = require('net'); <add> <add>const server = net.createServer().listen(common.PORT, connectToServer); <add> <add>function connectToServer() { <add> const client = net.createConnection(common.PORT, () => { <add> assert.throws(() => { <add> client.write(1337); <add> }, /Invalid data, chunk must be a string or buffer, not number/); <add> <add> client.end(); <add> }) <add> .on('end', () => server.close()); <add>}
2
PHP
PHP
remove php5 conditional statements
87db96638384dcf548aa589de731aa54c856deab
<ide><path>cake/libs/controller/controller.php <ide> public function loadModel($modelClass = null, $id = null) { <ide> if (($cached === false)) { <ide> $this->modelNames[] = $modelClass; <ide> <del> if (!PHP5) { <del> $this->{$modelClass} =& ClassRegistry::init(array( <del> 'class' => $plugin . $modelClass, 'alias' => $modelClass, 'id' => $id <del> )); <del> } else { <del> $this->{$modelClass} = ClassRegistry::init(array( <del> 'class' => $plugin . $modelClass, 'alias' => $modelClass, 'id' => $id <del> )); <del> } <add> $this->{$modelClass} = ClassRegistry::init(array( <add> 'class' => $plugin . $modelClass, 'alias' => $modelClass, 'id' => $id <add> )); <ide> <ide> if (!$this->{$modelClass}) { <ide> return $this->cakeError('missingModel', array(array(
1
PHP
PHP
use model instance instead of parent
df2f36c3e1b733eb006cd27b240d68e6fa8bcb3b
<ide><path>src/Illuminate/Database/Eloquent/Relations/MorphTo.php <ide> protected function getResultsByType($type) <ide> (array) ($this->morphableEagerLoads[get_class($instance)] ?? []) <ide> )); <ide> <del> $whereIn = $this->whereInMethod($this->parent, $ownerKey); <add> $whereIn = $this->whereInMethod($instance, $ownerKey); <ide> <ide> return $query->{$whereIn}( <ide> $instance->getTable().'.'.$ownerKey, $this->gatherKeysByType($type)
1
Javascript
Javascript
write config file atomically (write and replace)
f77391b158007c2ef32da5edb58fd23799ef2174
<ide><path>src/config-file.js <ide> const {watchPath} = require('./path-watcher') <ide> const CSON = require('season') <ide> const Path = require('path') <ide> const async = require('async') <add>const temp = require('temp') <ide> <ide> const EVENT_TYPES = new Set([ <ide> 'created', <ide> class ConfigFile { <ide> this.reloadCallbacks = [] <ide> <ide> // Use a queue to prevent multiple concurrent write to the same file. <del> const writeQueue = async.queue((data, callback) => <del> CSON.writeFile(this.path, data, error => { <del> if (error) { <add> const writeQueue = async.queue((data, callback) => { <add> (async () => { <add> try { <add> await writeCSONFileAtomically(this.path, data) <add> } catch (error) { <ide> this.emitter.emit('did-error', dedent ` <ide> Failed to write \`${Path.basename(this.path)}\`. <ide> <ide> ${error.message} <ide> `) <ide> } <ide> callback() <del> }) <del> ) <add> })() <add> }) <ide> <ide> this.requestLoad = _.debounce(() => this.reload(), 200) <ide> this.requestSave = _.debounce((data) => writeQueue.push(data), 200) <ide> class ConfigFile { <ide> }) <ide> } <ide> } <add> <add>function writeCSONFile (path, data) { <add> return new Promise((resolve, reject) => { <add> CSON.writeFile(path, data, error => { <add> if (error) reject(error) <add> else resolve() <add> }) <add> }) <add>} <add> <add>async function writeCSONFileAtomically (path, data) { <add> const tempPath = temp.path() <add> await writeCSONFile(tempPath, data) <add> await rename(tempPath, path) <add>} <add> <add>function rename (oldPath, newPath) { <add> return new Promise((resolve, reject) => { <add> fs.rename(oldPath, newPath, error => { <add> if (error) reject(error) <add> else resolve() <add> }) <add> }) <add>}
1
Javascript
Javascript
fix jpeg check in textureloader
356453504da0890af808f79092af5b2d63424395
<ide><path>src/loaders/TextureLoader.js <ide> Object.assign( TextureLoader.prototype, { <ide> texture.image = image; <ide> <ide> // JPEGs can't have an alpha channel, so memory can be saved by storing them as RGB. <del> var isJPEG = url.search( /\.jpe?g$/i ) > 0 || url.search( /^data\:image\/jpeg/ ) === 0; <add> var isJPEG = url.search( /\.jpe?g($|\?)/i ) > 0 || url.search( /^data\:image\/jpeg/ ) === 0; <ide> <ide> texture.format = isJPEG ? RGBFormat : RGBAFormat; <ide> texture.needsUpdate = true;
1
Javascript
Javascript
change usage uuid to id
f4884bac7a11d9dcef86921f1e54c99a24fd98e4
<ide><path>src/extras/renderers/plugins/DepthPassPlugin.js <ide> THREE.DepthPassPlugin = function () { <ide> <ide> if ( object.visible ) { <ide> <del> var webglObjects = scene.__webglObjects[object.uuid]; <add> var webglObjects = scene.__webglObjects[object.id]; <ide> <ide> if (webglObjects && (object.frustumCulled === false || _frustum.intersectsObject( object ) === true) ) { <ide> <ide><path>src/extras/renderers/plugins/ShadowMapPlugin.js <ide> THREE.ShadowMapPlugin = function () { <ide> <ide> if ( object.visible ) { <ide> <del> var webglObjects = scene.__webglObjects[object.uuid]; <add> var webglObjects = scene.__webglObjects[object.id]; <ide> <ide> if (webglObjects && object.castShadow && (object.frustumCulled === false || _frustum.intersectsObject( object ) === true) ) { <ide> <ide><path>src/renderers/WebGLRenderer.js <ide> THREE.WebGLRenderer = function ( parameters ) { <ide> <ide> if ( object.visible ) { <ide> <del> var webglObjects = scene.__webglObjects[object.uuid]; <add> var webglObjects = scene.__webglObjects[object.id]; <ide> <ide> if (webglObjects && (object.frustumCulled === false || _frustum.intersectsObject( object ) === true) ) { <ide> <ide> THREE.WebGLRenderer = function ( parameters ) { <ide> <ide> if ( geometry.geometryGroups === undefined ) { <ide> <del> delete scene.__webglObjects[object.uuid]; <add> delete scene.__webglObjects[object.id]; <ide> geometry.makeGroups( material instanceof THREE.MeshFaceMaterial, _glExtensionElementIndexUint ? 4294967296 : 65535 ); <ide> <ide> } <ide> THREE.WebGLRenderer = function ( parameters ) { <ide> } <ide> <ide> function addBuffer( objlist, buffer, object ) { <del> var uuid = object.uuid; <del> objlist[uuid] = objlist[uuid] || []; <del> objlist[uuid].push( <add> var id = object.id; <add> objlist[id] = objlist[id] || []; <add> objlist[id].push( <ide> { <ide> id: null, <ide> buffer: buffer,
3
Javascript
Javascript
assure a minimum pointcount of 2
6419e92e139861c0d8c1dc633003b226f96dd26a
<ide><path>examples/jsm/loaders/3DMLoader.js <ide> Rhino3dmLoader.Rhino3dmWorker = function () { <ide> if ( curve instanceof rhino.ArcCurve ) { <ide> <ide> pointCount = Math.floor( curve.angleDegrees / 5 ); <del> pointCount = pointCount < 1 ? 2 : pointCount; <add> pointCount = pointCount < 2 ? 2 : pointCount; <ide> // alternative to this hardcoded version: https://stackoverflow.com/a/18499923/2179399 <ide> <ide> }
1
Ruby
Ruby
fix incorrect comment
0bdce89d65dfe39abb851090b1224f1a810ea277
<ide><path>Library/Homebrew/cleaner.rb <ide> def clean_file_permissions path <ide> path.chmod perms <ide> end <ide> <del> # Clean a single folder (non-recursively) <add> # Removes .la files and fixes file permissions for a directory tree, keeping <add> # existing files and permissions if instructed to by the formula <ide> def clean_dir d <ide> d.find do |path| <ide> path.extend(ObserverPathnameExtension)
1
Text
Text
add changelog entry for
6e34601653614ca98f632d14662b4852bc351abe
<ide><path>activesupport/CHANGELOG.md <add>* `HashWithIndifferentAccess#select working as intended` now returns a `HashWithIndifferentAccess` <add> instance instead of a `Hash` instance. <add> <add> Fixes #10723 <add> <add> *Albert Llop* <add> <ide> * Add `DateTime#usec` and `DateTime#nsec` so that `ActiveSupport::TimeWithZone` keeps <ide> sub-second resolution when wrapping a `DateTime` value. <add> <ide> Fixes #10855 <ide> <ide> *Andrew White* <ide> <ide> * Prevent side effects to hashes inside arrays when <ide> `Hash#with_indifferent_access` is called. <add> <ide> Fixes #10526 <ide> <ide> *Yves Senn*
1
Ruby
Ruby
fix array routing constraints
94a27cb2b5c9b3db8e72d4cbef00ff040b30681d
<ide><path>actionpack/lib/action_dispatch/journey/path/pattern.rb <ide> def visit_SYMBOL(node) <ide> return @separator_re unless @matchers.key?(node) <ide> <ide> re = @matchers[node] <del> "(#{re})" <add> "(#{Regexp.union(re)})" <ide> end <ide> <ide> def visit_GROUP(node) <ide> def offsets <ide> node = node.to_sym <ide> <ide> if @requirements.key?(node) <del> re = /#{@requirements[node]}|/ <add> re = /#{Regexp.union(@requirements[node])}|/ <ide> @offsets.push((re.match("").length - 1) + @offsets.last) <ide> else <ide> @offsets << @offsets.last <ide><path>actionpack/test/dispatch/routing_test.rb <ide> class TestPortConstraints < ActionDispatch::IntegrationTest <ide> <ide> get "/integer", to: ok, constraints: { port: 8080 } <ide> get "/string", to: ok, constraints: { port: "8080" } <del> get "/array", to: ok, constraints: { port: [8080] } <add> get "/array/:idx", to: ok, constraints: { port: [8080], idx: %w[first last] } <ide> get "/regexp", to: ok, constraints: { port: /8080/ } <ide> end <ide> end <ide> def test_array_port_constraints <ide> get "http://www.example.com/array" <ide> assert_response :not_found <ide> <del> get "http://www.example.com:8080/array" <add> get "http://www.example.com:8080/array/middle" <add> assert_response :not_found <add> <add> get "http://www.example.com:8080/array/first" <ide> assert_response :success <ide> end <ide>
2
Java
Java
make parallel() a fusion-async-boundary
ddd9b67f7e4848a16c491f495876dfd2f890d499
<ide><path>src/main/java/io/reactivex/internal/operators/parallel/ParallelFromPublisher.java <ide> public void onSubscribe(Subscription s) { <ide> @SuppressWarnings("unchecked") <ide> QueueSubscription<T> qs = (QueueSubscription<T>) s; <ide> <del> int m = qs.requestFusion(QueueSubscription.ANY); <add> int m = qs.requestFusion(QueueSubscription.ANY | QueueSubscription.BOUNDARY); <ide> <ide> if (m == QueueSubscription.SYNC) { <ide> sourceMode = m; <ide><path>src/test/java/io/reactivex/parallel/ParallelFromPublisherTest.java <ide> package io.reactivex.parallel; <ide> <ide> import static org.junit.Assert.*; <add> <add>import java.util.*; <add>import java.util.concurrent.*; <add> <ide> import org.junit.Test; <del>import org.reactivestreams.Subscriber; <add>import org.reactivestreams.*; <ide> <del>import io.reactivex.Flowable; <add>import io.reactivex.*; <ide> import io.reactivex.exceptions.*; <del>import io.reactivex.functions.Function; <add>import io.reactivex.functions.*; <ide> import io.reactivex.internal.functions.Functions; <add>import io.reactivex.internal.fuseable.QueueSubscription; <add>import io.reactivex.internal.subscribers.BasicFuseableSubscriber; <ide> import io.reactivex.internal.subscriptions.BooleanSubscription; <ide> import io.reactivex.processors.UnicastProcessor; <add>import io.reactivex.schedulers.Schedulers; <ide> <ide> public class ParallelFromPublisherTest { <ide> <ide> public void fusedFilterBecomesEmpty() { <ide> .assertResult(); <ide> } <ide> <add> static final class StripBoundary<T> extends Flowable<T> implements FlowableTransformer<T, T> { <add> <add> final Flowable<T> source; <add> <add> StripBoundary(Flowable<T> source) { <add> this.source = source; <add> } <add> <add> @Override <add> public Publisher<T> apply(Flowable<T> upstream) { <add> return new StripBoundary<T>(upstream); <add> } <add> <add> @Override <add> protected void subscribeActual(Subscriber<? super T> s) { <add> source.subscribe(new StripBoundarySubscriber<T>(s)); <add> } <add> <add> static final class StripBoundarySubscriber<T> extends BasicFuseableSubscriber<T, T> { <add> <add> StripBoundarySubscriber(Subscriber<? super T> actual) { <add> super(actual); <add> } <add> <add> @Override <add> public void onNext(T t) { <add> actual.onNext(t); <add> } <add> <add> @Override <add> public int requestFusion(int mode) { <add> QueueSubscription<T> fs = qs; <add> if (fs != null) { <add> int m = fs.requestFusion(mode & ~QueueSubscription.BOUNDARY); <add> this.sourceMode = m; <add> return m; <add> } <add> return QueueSubscription.NONE; <add> } <add> <add> @Override <add> public T poll() throws Exception { <add> return qs.poll(); <add> } <add> } <add> } <add> <ide> @Test <ide> public void syncFusedMapCrash() { <ide> Flowable.just(1) <ide> public Object apply(Integer v) throws Exception { <ide> throw new TestException(); <ide> } <ide> }) <add> .compose(new StripBoundary<Object>(null)) <ide> .parallel() <ide> .sequential() <ide> .test() <ide> public Object apply(Integer v) throws Exception { <ide> throw new TestException(); <ide> } <ide> }) <add> .compose(new StripBoundary<Object>(null)) <ide> .parallel() <ide> .sequential() <ide> .test() <ide> .assertFailure(TestException.class); <ide> <ide> assertFalse(up.hasSubscribers()); <ide> } <add> <add> @Test <add> public void boundaryConfinement() { <add> final Set<String> between = new HashSet<String>(); <add> final ConcurrentHashMap<String, String> processing = new ConcurrentHashMap<String, String>(); <add> <add> Flowable.range(1, 10) <add> .observeOn(Schedulers.single(), false, 1) <add> .doOnNext(new Consumer<Integer>() { <add> @Override <add> public void accept(Integer v) throws Exception { <add> between.add(Thread.currentThread().getName()); <add> } <add> }) <add> .parallel(2, 1) <add> .runOn(Schedulers.computation(), 1) <add> .map(new Function<Integer, Object>() { <add> @Override <add> public Object apply(Integer v) throws Exception { <add> processing.putIfAbsent(Thread.currentThread().getName(), ""); <add> return v; <add> } <add> }) <add> .sequential() <add> .test() <add> .awaitDone(5, TimeUnit.SECONDS) <add> .assertSubscribed() <add> .assertValueSet(Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)) <add> .assertComplete() <add> .assertNoErrors() <add> ; <add> <add> assertEquals(between.toString(), 1, between.size()); <add> assertTrue(between.toString(), between.iterator().next().contains("RxSingleScheduler")); <add> <add> Map<String, String> map = processing; // AnimalSniffer: CHM.keySet() in Java 8 returns KeySetView <add> <add> for (String e : map.keySet()) { <add> assertTrue(map.toString(), e.contains("RxComputationThreadPool")); <add> } <add> } <ide> }
2
Text
Text
add info about fallback to prerender-error
997b37ace3bdab751a24ce65a841e743d5aa9b64
<ide><path>errors/prerender-error.md <ide> While prerendering a page an error occurred. This can occur for many reasons fro <ide> - Make sure to move any non-pages out of the `pages` folder <ide> - Check for any code that assumes a prop is available even when it might not be. e.g., have default data for all dynamic pages' props. <ide> - Check for any out of date modules that you might be relying on <add>- Make sure your component handles `fallback` if it is enabled in `getStaticPaths`. [Fallback docs](https://nextjs.org/docs/basic-features/data-fetching#the-fallback-key-required)
1
Javascript
Javascript
fix race condition during initialization
7a3ab96d94073b22853992b5e0b3f8e26b8cfd51
<ide><path>Libraries/WebSocket/WebSocket.js <ide> class WebSocket extends EventTarget(...WEBSOCKET_EVENTS) { <ide> <ide> this._eventEmitter = new NativeEventEmitter(RCTWebSocketModule); <ide> this._socketId = nextWebSocketId++; <del> RCTWebSocketModule.connect(url, protocols, options, this._socketId); <ide> this._registerEvents(); <add> RCTWebSocketModule.connect(url, protocols, options, this._socketId); <ide> } <ide> <ide> close(code?: number, reason?: string): void {
1
Python
Python
add extra test for multidimensional inserts
1e6f7a7db94afc69f88ebf0b0235888dc377ce25
<ide><path>numpy/lib/tests/test_function_base.py <ide> def test_basic(self): <ide> assert_equal(insert(a, [1, 1, 1], [1, 2, 3]), [1, 1, 2, 3, 2, 3]) <ide> assert_equal(insert(a, 1,[1,2,3]), [1, 1, 2, 3, 2, 3]) <ide> assert_equal(insert(a,[1,2,3],9),[1,9,2,9,3,9]) <add> def test_multidim(self): <add> a = [[1, 1, 1]] <add> r = [[2, 2, 2], <add> [1, 1, 1]] <add> assert_equal(insert(a, 0, [2, 2, 2], axis=0), r) <add> assert_equal(insert(a, 0, 2, axis=0), r) <add> assert_equal(insert(a, 2, 2, axis=1), [[1, 1, 2, 1]]) <ide> <ide> class TestAmax(TestCase): <ide> def test_basic(self):
1
Ruby
Ruby
use default use_cache parameter for callers
61617a257ec361b2c9701a42814f24415e2eddad
<ide><path>Library/Homebrew/extend/os/mac/formula_cellar_checks.rb <ide> def check_linkage <ide> keg = Keg.new(formula.prefix) <ide> <ide> CacheStoreDatabase.use(:linkage) do |db| <del> checker = LinkageChecker.new( <del> keg, formula, cache_db: db, use_cache: !ENV["HOMEBREW_LINKAGE_CACHE"].nil? <del> ) <add> checker = LinkageChecker.new(keg, formula, cache_db: db) <ide> next unless checker.broken_library_linkage? <ide> <ide> output = <<~EOS <ide><path>Library/Homebrew/formula.rb <ide> def undeclared_runtime_dependencies <ide> return [] unless keg <ide> <ide> undeclared_deps = CacheStoreDatabase.use(:linkage) do |db| <del> linkage_checker = LinkageChecker.new( <del> keg, self, cache_db: db, use_cache: !ENV["HOMEBREW_LINKAGE_CACHE"].nil? <del> ) <add> linkage_checker = LinkageChecker.new(keg, self, cache_db: db) <ide> linkage_checker.undeclared_deps.map { |n| Dependency.new(n) } <ide> end <ide>
2
Go
Go
add config support to executor backend
9e9fc7b57c1764c008e568ed52bcd1aade7eb40c
<ide><path>container/container.go <ide> type CommonContainer struct { <ide> MountPoints map[string]*volume.MountPoint <ide> HostConfig *containertypes.HostConfig `json:"-"` // do not serialize the host config in the json, otherwise we'll make the container unportable <ide> ExecCommands *exec.Store `json:"-"` <del> SecretStore agentexec.SecretGetter `json:"-"` <add> DependencyStore agentexec.DependencyGetter `json:"-"` <ide> SecretReferences []*swarmtypes.SecretReference <add> ConfigReferences []*swarmtypes.ConfigReference <ide> // logDriver for closing <ide> LogDriver logger.Logger `json:"-"` <ide> LogCopier *logger.Copier `json:"-"` <ide> func getSecretTargetPath(r *swarmtypes.SecretReference) string { <ide> <ide> return filepath.Join(containerSecretMountPath, r.File.Name) <ide> } <add> <add>// ConfigsDirPath returns the path to the directory where configs are stored on <add>// disk. <add>func (container *Container) ConfigsDirPath() string { <add> return filepath.Join(container.Root, "configs") <add>} <add> <add>// ConfigFilePath returns the path to the on-disk location of a config. <add>func (container *Container) ConfigFilePath(configRef swarmtypes.ConfigReference) string { <add> return filepath.Join(container.ConfigsDirPath(), configRef.ConfigID) <add>} <ide><path>container/container_unix.go <ide> func (container *Container) UnmountSecrets() error { <ide> return detachMounted(container.SecretMountPath()) <ide> } <ide> <add>// ConfigMounts returns the mounts for configs. <add>func (container *Container) ConfigMounts() []Mount { <add> var mounts []Mount <add> for _, configRef := range container.ConfigReferences { <add> if configRef.File == nil { <add> continue <add> } <add> mounts = append(mounts, Mount{ <add> Source: container.ConfigFilePath(*configRef), <add> Destination: configRef.File.Name, <add> Writable: false, <add> }) <add> } <add> <add> return mounts <add>} <add> <ide> // UpdateContainer updates configuration of a container. <ide> func (container *Container) UpdateContainer(hostConfig *containertypes.HostConfig) error { <ide> container.Lock() <ide><path>daemon/cluster/executor/backend.go <ide> type Backend interface { <ide> ContainerWaitWithContext(ctx context.Context, name string) error <ide> ContainerRm(name string, config *types.ContainerRmConfig) error <ide> ContainerKill(name string, sig uint64) error <del> SetContainerSecretStore(name string, store exec.SecretGetter) error <add> SetContainerDependencyStore(name string, store exec.DependencyGetter) error <ide> SetContainerSecretReferences(name string, refs []*swarmtypes.SecretReference) error <add> SetContainerConfigReferences(name string, refs []*swarmtypes.ConfigReference) error <ide> SystemInfo() (*types.Info, error) <ide> VolumeCreate(name, driverName string, opts, labels map[string]string) (*types.Volume, error) <ide> Containers(config *types.ContainerListOptions) ([]*types.Container, error) <ide><path>daemon/cluster/executor/container/adapter.go <ide> import ( <ide> // are mostly naked calls to the client API, seeded with information from <ide> // containerConfig. <ide> type containerAdapter struct { <del> backend executorpkg.Backend <del> container *containerConfig <del> secrets exec.SecretGetter <add> backend executorpkg.Backend <add> container *containerConfig <add> dependencies exec.DependencyGetter <ide> } <ide> <del>func newContainerAdapter(b executorpkg.Backend, task *api.Task, secrets exec.SecretGetter) (*containerAdapter, error) { <add>func newContainerAdapter(b executorpkg.Backend, task *api.Task, dependencies exec.DependencyGetter) (*containerAdapter, error) { <ide> ctnr, err := newContainerConfig(task) <ide> if err != nil { <ide> return nil, err <ide> } <ide> <ide> return &containerAdapter{ <del> container: ctnr, <del> backend: b, <del> secrets: secrets, <add> container: ctnr, <add> backend: b, <add> dependencies: dependencies, <ide> }, nil <ide> } <ide> <ide> func (c *containerAdapter) create(ctx context.Context) error { <ide> return errors.New("unable to get container from task spec") <ide> } <ide> <add> if err := c.backend.SetContainerDependencyStore(cr.ID, c.dependencies); err != nil { <add> return err <add> } <add> <ide> // configure secrets <del> if err := c.backend.SetContainerSecretStore(cr.ID, c.secrets); err != nil { <add> secretRefs := convert.SecretReferencesFromGRPC(container.Secrets) <add> if err := c.backend.SetContainerSecretReferences(cr.ID, secretRefs); err != nil { <ide> return err <ide> } <ide> <del> refs := convert.SecretReferencesFromGRPC(container.Secrets) <del> if err := c.backend.SetContainerSecretReferences(cr.ID, refs); err != nil { <add> configRefs := convert.ConfigReferencesFromGRPC(container.Configs) <add> if err := c.backend.SetContainerConfigReferences(cr.ID, configRefs); err != nil { <ide> return err <ide> } <ide> <ide><path>daemon/cluster/executor/container/attachment.go <ide> type networkAttacherController struct { <ide> closed chan struct{} <ide> } <ide> <del>func newNetworkAttacherController(b executorpkg.Backend, task *api.Task, secrets exec.SecretGetter) (*networkAttacherController, error) { <del> adapter, err := newContainerAdapter(b, task, secrets) <add>func newNetworkAttacherController(b executorpkg.Backend, task *api.Task, dependencies exec.DependencyGetter) (*networkAttacherController, error) { <add> adapter, err := newContainerAdapter(b, task, dependencies) <ide> if err != nil { <ide> return nil, err <ide> } <ide><path>daemon/cluster/executor/container/controller.go <ide> type controller struct { <ide> var _ exec.Controller = &controller{} <ide> <ide> // NewController returns a docker exec runner for the provided task. <del>func newController(b executorpkg.Backend, task *api.Task, secrets exec.SecretGetter) (*controller, error) { <del> adapter, err := newContainerAdapter(b, task, secrets) <add>func newController(b executorpkg.Backend, task *api.Task, dependencies exec.DependencyGetter) (*controller, error) { <add> adapter, err := newContainerAdapter(b, task, dependencies) <ide> if err != nil { <ide> return nil, err <ide> } <ide><path>daemon/cluster/executor/container/executor.go <ide> import ( <ide> executorpkg "github.com/docker/docker/daemon/cluster/executor" <ide> clustertypes "github.com/docker/docker/daemon/cluster/provider" <ide> networktypes "github.com/docker/libnetwork/types" <add> "github.com/docker/swarmkit/agent" <ide> "github.com/docker/swarmkit/agent/exec" <del> "github.com/docker/swarmkit/agent/secrets" <ide> "github.com/docker/swarmkit/api" <ide> "github.com/docker/swarmkit/api/naming" <ide> "golang.org/x/net/context" <ide> ) <ide> <ide> type executor struct { <del> backend executorpkg.Backend <del> secrets exec.SecretsManager <add> backend executorpkg.Backend <add> dependencies exec.DependencyManager <ide> } <ide> <ide> // NewExecutor returns an executor from the docker client. <ide> func NewExecutor(b executorpkg.Backend) exec.Executor { <ide> return &executor{ <del> backend: b, <del> secrets: secrets.NewManager(), <add> backend: b, <add> dependencies: agent.NewDependencyManager(), <ide> } <ide> } <ide> <ide> func (e *executor) Configure(ctx context.Context, node *api.Node) error { <ide> <ide> // Controller returns a docker container runner. <ide> func (e *executor) Controller(t *api.Task) (exec.Controller, error) { <add> dependencyGetter := agent.Restrict(e.dependencies, t) <add> <ide> if t.Spec.GetAttachment() != nil { <del> return newNetworkAttacherController(e.backend, t, e.secrets) <add> return newNetworkAttacherController(e.backend, t, dependencyGetter) <ide> } <ide> <ide> var ctlr exec.Controller <ide> func (e *executor) Controller(t *api.Task) (exec.Controller, error) { <ide> return ctlr, fmt.Errorf("unsupported runtime type: %q", r.Generic.Kind) <ide> } <ide> case *api.TaskSpec_Container: <del> c, err := newController(e.backend, t, secrets.Restrict(e.secrets, t)) <add> c, err := newController(e.backend, t, dependencyGetter) <ide> if err != nil { <ide> return ctlr, err <ide> } <ide> func (e *executor) SetNetworkBootstrapKeys(keys []*api.EncryptionKey) error { <ide> } <ide> <ide> func (e *executor) Secrets() exec.SecretsManager { <del> return e.secrets <add> return e.dependencies.Secrets() <add>} <add> <add>func (e *executor) Configs() exec.ConfigsManager { <add> return e.dependencies.Configs() <ide> } <ide> <ide> type sortedPlugins []api.PluginDescription <ide><path>daemon/configs.go <add>package daemon <add> <add>import ( <add> "github.com/Sirupsen/logrus" <add> swarmtypes "github.com/docker/docker/api/types/swarm" <add>) <add> <add>// SetContainerConfigReferences sets the container config references needed <add>func (daemon *Daemon) SetContainerConfigReferences(name string, refs []*swarmtypes.ConfigReference) error { <add> if !configsSupported() && len(refs) > 0 { <add> logrus.Warn("configs are not supported on this platform") <add> return nil <add> } <add> <add> c, err := daemon.GetContainer(name) <add> if err != nil { <add> return err <add> } <add> <add> c.ConfigReferences = refs <add> <add> return nil <add>} <ide><path>daemon/configs_linux.go <add>// +build linux <add> <add>package daemon <add> <add>func configsSupported() bool { <add> return true <add>} <ide><path>daemon/configs_unsupported.go <add>// +build !linux <add> <add>package daemon <add> <add>func configsSupported() bool { <add> return false <add>} <ide><path>daemon/container_operations_unix.go <ide> func (daemon *Daemon) setupSecretDir(c *container.Container) (setupErr error) { <ide> localMountPath := c.SecretMountPath() <ide> logrus.Debugf("secrets: setting up secret dir: %s", localMountPath) <ide> <add> // retrieve possible remapped range start for root UID, GID <add> rootUID, rootGID := daemon.GetRemappedUIDGID() <add> // create tmpfs <add> if err := idtools.MkdirAllAs(localMountPath, 0700, rootUID, rootGID); err != nil { <add> return errors.Wrap(err, "error creating secret local mount path") <add> } <add> <ide> defer func() { <ide> if setupErr != nil { <ide> // cleanup <ide> func (daemon *Daemon) setupSecretDir(c *container.Container) (setupErr error) { <ide> } <ide> }() <ide> <del> // retrieve possible remapped range start for root UID, GID <del> rootUID, rootGID := daemon.GetRemappedUIDGID() <del> // create tmpfs <del> if err := idtools.MkdirAllAs(localMountPath, 0700, rootUID, rootGID); err != nil { <del> return errors.Wrap(err, "error creating secret local mount path") <del> } <ide> tmpfsOwnership := fmt.Sprintf("uid=%d,gid=%d", rootUID, rootGID) <ide> if err := mount.Mount("tmpfs", localMountPath, "tmpfs", "nodev,nosuid,noexec,"+tmpfsOwnership); err != nil { <ide> return errors.Wrap(err, "unable to setup secret mount") <ide> } <ide> <del> for _, s := range c.SecretReferences { <del> if c.SecretStore == nil { <del> return fmt.Errorf("secret store is not initialized") <del> } <add> if c.DependencyStore == nil { <add> return fmt.Errorf("secret store is not initialized") <add> } <ide> <add> for _, s := range c.SecretReferences { <ide> // TODO (ehazlett): use type switch when more are supported <ide> if s.File == nil { <del> return fmt.Errorf("secret target type is not a file target") <add> logrus.Error("secret target type is not a file target") <add> continue <ide> } <ide> <ide> // secrets are created in the SecretMountPath on the host, at a <ide> func (daemon *Daemon) setupSecretDir(c *container.Container) (setupErr error) { <ide> "name": s.File.Name, <ide> "path": fPath, <ide> }).Debug("injecting secret") <del> secret := c.SecretStore.Get(s.SecretID) <add> secret := c.DependencyStore.Secrets().Get(s.SecretID) <ide> if secret == nil { <ide> return fmt.Errorf("unable to get secret from secret store") <ide> } <ide> func (daemon *Daemon) setupSecretDir(c *container.Container) (setupErr error) { <ide> return nil <ide> } <ide> <add>func (daemon *Daemon) setupConfigDir(c *container.Container) (setupErr error) { <add> if len(c.ConfigReferences) == 0 { <add> return nil <add> } <add> <add> localPath := c.ConfigsDirPath() <add> logrus.Debugf("configs: setting up config dir: %s", localPath) <add> <add> // retrieve possible remapped range start for root UID, GID <add> rootUID, rootGID := daemon.GetRemappedUIDGID() <add> // create tmpfs <add> if err := idtools.MkdirAllAs(localPath, 0700, rootUID, rootGID); err != nil { <add> return errors.Wrap(err, "error creating config dir") <add> } <add> <add> defer func() { <add> if setupErr != nil { <add> if err := os.RemoveAll(localPath); err != nil { <add> logrus.Errorf("error cleaning up config dir: %s", err) <add> } <add> } <add> }() <add> <add> if c.DependencyStore == nil { <add> return fmt.Errorf("config store is not initialized") <add> } <add> <add> for _, configRef := range c.ConfigReferences { <add> // TODO (ehazlett): use type switch when more are supported <add> if configRef.File == nil { <add> logrus.Error("config target type is not a file target") <add> continue <add> } <add> <add> fPath := c.ConfigFilePath(*configRef) <add> <add> log := logrus.WithFields(logrus.Fields{"name": configRef.File.Name, "path": fPath}) <add> <add> if err := idtools.MkdirAllAs(filepath.Dir(fPath), 0700, rootUID, rootGID); err != nil { <add> return errors.Wrap(err, "error creating config path") <add> } <add> <add> log.Debug("injecting config") <add> config := c.DependencyStore.Configs().Get(configRef.ConfigID) <add> if config == nil { <add> return fmt.Errorf("unable to get config from config store") <add> } <add> if err := ioutil.WriteFile(fPath, config.Spec.Data, configRef.File.Mode); err != nil { <add> return errors.Wrap(err, "error injecting config") <add> } <add> <add> uid, err := strconv.Atoi(configRef.File.UID) <add> if err != nil { <add> return err <add> } <add> gid, err := strconv.Atoi(configRef.File.GID) <add> if err != nil { <add> return err <add> } <add> <add> if err := os.Chown(fPath, rootUID+uid, rootGID+gid); err != nil { <add> return errors.Wrap(err, "error setting ownership for config") <add> } <add> } <add> <add> return nil <add>} <add> <ide> func killProcessDirectly(container *container.Container) error { <ide> if _, err := container.WaitStop(10 * time.Second); err != nil { <ide> // Ensure that we don't kill ourselves <ide><path>daemon/dependency.go <add>package daemon <add> <add>import ( <add> "github.com/docker/swarmkit/agent/exec" <add>) <add> <add>// SetContainerDependencyStore sets the dependency store backend for the container <add>func (daemon *Daemon) SetContainerDependencyStore(name string, store exec.DependencyGetter) error { <add> c, err := daemon.GetContainer(name) <add> if err != nil { <add> return err <add> } <add> <add> c.DependencyStore = store <add> <add> return nil <add>} <ide><path>daemon/oci_linux.go <ide> func (daemon *Daemon) createSpec(c *container.Container) (*specs.Spec, error) { <ide> return nil, err <ide> } <ide> <add> if err := daemon.setupConfigDir(c); err != nil { <add> return nil, err <add> } <add> <ide> ms, err := daemon.setupMounts(c) <ide> if err != nil { <ide> return nil, err <ide> func (daemon *Daemon) createSpec(c *container.Container) (*specs.Spec, error) { <ide> ms = append(ms, m...) <ide> } <ide> <add> ms = append(ms, c.ConfigMounts()...) <add> <ide> sort.Sort(mounts(ms)) <ide> if err := setMounts(daemon, &s, c, ms); err != nil { <ide> return nil, fmt.Errorf("linux mounts: %v", err) <ide><path>daemon/secrets.go <ide> package daemon <ide> import ( <ide> "github.com/Sirupsen/logrus" <ide> swarmtypes "github.com/docker/docker/api/types/swarm" <del> "github.com/docker/swarmkit/agent/exec" <ide> ) <ide> <del>// SetContainerSecretStore sets the secret store backend for the container <del>func (daemon *Daemon) SetContainerSecretStore(name string, store exec.SecretGetter) error { <del> c, err := daemon.GetContainer(name) <del> if err != nil { <del> return err <del> } <del> <del> c.SecretStore = store <del> <del> return nil <del>} <del> <ide> // SetContainerSecretReferences sets the container secret references needed <ide> func (daemon *Daemon) SetContainerSecretReferences(name string, refs []*swarmtypes.SecretReference) error { <ide> if !secretsSupported() && len(refs) > 0 {
14
Python
Python
add some clarification comments
c9fd2c8a8c2639fe8663f753e278a5948fc21f56
<ide><path>keras/layers/core.py <ide> def get_input(self, train): <ide> return self.input <ide> <ide> def supports_masked_input(self): <add> ''' Whether or not this layer respects the output mask of its previous layer in its calculations. If you try <add> to attach a layer that does *not* support masked_input to a layer that gives a non-None output_mask() that is <add> an error''' <ide> return False <ide> <ide> def get_output_mask(self, train=None): <add> ''' <add> For some models (such as RNNs) you want a way of being able to mark some output data-points as <add> "masked", so they are not used in future calculations. In such a model, get_output_mask() should return a mask <add> of one less dimension than get_output() (so if get_output is (nb_samples, nb_timesteps, nb_dimensions), then the mask <add> is (nb_samples, nb_timesteps), with a one for every unmasked datapoint, and a zero for every masked one. <add> <add> If there is *no* masking then it shall return None. For instance if you attach an Activation layer (they support masking) <add> to a layer with an output_mask, then that Activation shall also have an output_mask. If you attach it to a layer with no <add> such mask, then the Activation's get_output_mask shall return None. <add> <add> Some layers have an output_mask even if their input is unmasked, notably Embedding which can turn the entry "0" into <add> a mask. <add> ''' <ide> return None <ide> <ide> def set_weights(self, weights): <ide> def get_params(self): <ide> return self.params, regularizers, consts <ide> <ide> class MaskedLayer(Layer): <add> ''' <add> If your layer trivially supports masking (by simply copying the input mask to the output), then subclass MaskedLayer <add> instead of Layer, and make sure that you incorporate the input mask into your calculation of get_output() <add> ''' <ide> def supports_masked_input(self): <ide> return True <ide>
1
Javascript
Javascript
fix failing tests on ms edge
cb74999b1721aab4589e48bd708d008c9f5a6b22
<ide><path>test/helpers/privateMocks.js <ide> function browserSupportsCssAnimations() { <ide> return true; <ide> } <ide> <del>function createMockStyleSheet(doc) { <add>function createMockStyleSheet(doc, prefix) { <ide> doc = doc ? doc[0] : document; <ide> <ide> var node = doc.createElement('style'); <ide> function createMockStyleSheet(doc) { <ide> } <ide> }, <ide> <add> addPossiblyPrefixedRule: function(selector, styles) { <add> if (prefix) { <add> var prefixedStyles = styles.split(/\s*;\s*/g).map(function(style) { <add> return !style ? '' : prefix + style; <add> }).join('; '); <add> <add> this.addRule(selector, prefixedStyles); <add> } <add> <add> this.addRule(selector, styles); <add> }, <add> <ide> destroy: function() { <ide> head.removeChild(node); <ide> } <ide><path>test/ng/compileSpec.js <ide> describe('$compile', function() { <ide> <ide> <ide> describe('svg namespace transcludes', function() { <add> var ua = window.navigator.userAgent; <add> var isEdge = /Edge/.test(ua); <add> <ide> // this method assumes some sort of sized SVG element is being inspected. <ide> function assertIsValidSvgCircle(elem) { <ide> expect(isUnknownElement(elem)).toBe(false); <ide> describe('$compile', function() { <ide> })); <ide> <ide> // NOTE: This test may be redundant. <del> it('should handle custom svg containers that transclude to foreignObject' + <del> ' that transclude to custom svg containers that transclude to custom elements', inject(function() { <del> element = jqLite('<div><svg-container>' + <del> '<my-foreign-object><svg-container><svg-circle></svg-circle></svg-container></my-foreign-object>' + <del> '</svg-container></div>'); <del> $compile(element.contents())($rootScope); <del> document.body.appendChild(element[0]); <del> <del> var circle = element.find('circle'); <del> assertIsValidSvgCircle(circle[0]); <del> })); <add> if (!isEdge) { <add> it('should handle custom svg containers that transclude to foreignObject' + <add> ' that transclude to custom svg containers that transclude to custom elements', inject(function() { <add> element = jqLite('<div><svg-container>' + <add> '<my-foreign-object><svg-container><svg-circle></svg-circle></svg-container></my-foreign-object>' + <add> '</svg-container></div>'); <add> $compile(element.contents())($rootScope); <add> document.body.appendChild(element[0]); <add> <add> var circle = element.find('circle'); <add> assertIsValidSvgCircle(circle[0]); <add> })); <add> } <ide> } <ide> <ide> it('should handle directives with templates that manually add the transclude further down', inject(function() { <ide><path>test/ng/directive/inputSpec.js <ide> describe('input', function() { <ide> <ide> it('should validate if max is empty', function() { <ide> $rootScope.maxVal = undefined; <del> $rootScope.value = new Date(9999, 11, 31, 23, 59, 59); <add> $rootScope.value = new Date(3000, 11, 31, 23, 59, 59); <ide> $rootScope.$digest(); <ide> <ide> expect($rootScope.form.alias.$error.max).toBeFalsy(); <ide><path>test/ng/snifferSpec.js <ide> describe('$sniffer', function() { <ide> inject(function($sniffer, $window) { <ide> var expectedPrefix; <ide> var ua = $window.navigator.userAgent.toLowerCase(); <del> if (/chrome/i.test(ua) || /safari/i.test(ua) || /webkit/i.test(ua)) { <add> if (/edge/i.test(ua)) { <add> expectedPrefix = 'Ms'; <add> } else if (/chrome/i.test(ua) || /safari/i.test(ua) || /webkit/i.test(ua)) { <ide> expectedPrefix = 'Webkit'; <ide> } else if (/firefox/i.test(ua)) { <ide> expectedPrefix = 'Moz'; <ide><path>test/ngAnimate/animateCssSpec.js <ide> describe("ngAnimate $animateCss", function() { <ide> : expect(className).not.toMatch(regex); <ide> } <ide> <add> function getPossiblyPrefixedStyleValue(element, styleProp) { <add> var value = element.css(prefix + styleProp); <add> if (isUndefined(value)) value = element.css(styleProp); <add> <add> return value; <add> } <add> <ide> function keyframeProgress(element, duration, delay) { <ide> browserTrigger(element, 'animationend', <ide> { timeStamp: Date.now() + ((delay || 1) * 1000), elapsedTime: duration }); <ide> describe("ngAnimate $animateCss", function() { <ide> beforeEach(module(function() { <ide> return function($document, $sniffer, $$rAF, $animate) { <ide> prefix = '-' + $sniffer.vendorPrefix.toLowerCase() + '-'; <del> ss = createMockStyleSheet($document); <add> ss = createMockStyleSheet($document, prefix); <add> <ide> $animate.enabled(true); <ide> triggerAnimationStartFrame = function() { <ide> $$rAF.flush(); <ide> describe("ngAnimate $animateCss", function() { <ide> triggerAnimationStartFrame(); <ide> <ide> runner.pause(); <del> expect(element.css(prefix + 'animation-play-state')).toEqual('paused'); <add> expect(getPossiblyPrefixedStyleValue(element, 'animation-play-state')).toEqual('paused'); <ide> runner.resume(); <ide> expect(element.attr('style')).toBeFalsy(); <ide> })); <ide> describe("ngAnimate $animateCss", function() { <ide> triggerAnimationStartFrame(); <ide> <ide> runner.pause(); <del> expect(element.css(prefix + 'animation-play-state')).toEqual('paused'); <add> expect(getPossiblyPrefixedStyleValue(element, 'animation-play-state')).toEqual('paused'); <ide> runner.end(); <ide> expect(element.attr('style')).toBeFalsy(); <ide> })); <ide> describe("ngAnimate $animateCss", function() { <ide> <ide> jqLite($document[0].body).append($rootElement); <ide> <del> ss.addRule('.ng-enter-stagger', prefix + 'animation-delay:0.2s'); <del> ss.addRule('.ng-enter', prefix + 'animation:my_animation 2s;'); <add> ss.addPossiblyPrefixedRule('.ng-enter-stagger', 'animation-delay:0.2s'); <add> ss.addPossiblyPrefixedRule('.ng-enter', 'animation:my_animation 2s;'); <ide> <ide> var i, element, elements = []; <ide> for (i = 0; i < 5; i++) { <ide> describe("ngAnimate $animateCss", function() { <ide> if (i === 0) { // the first element is always run right away <ide> expect(element.attr('style')).toBeFalsy(); <ide> } else { <del> expect(element.css(prefix + 'animation-play-state')).toBe('paused'); <add> expect(getPossiblyPrefixedStyleValue(element, 'animation-play-state')).toBe('paused'); <ide> } <ide> } <ide> })); <ide> describe("ngAnimate $animateCss", function() { <ide> jqLite($document[0].body).append($rootElement); <ide> <ide> ss.addRule('.ng-enter-stagger', 'transition-delay:0.2s'); <del> ss.addRule('.transition-animation', prefix + 'animation:2s 5s my_animation;'); <add> ss.addPossiblyPrefixedRule('.transition-animation', 'animation: 2s 5s my_animation;'); <ide> <ide> for (var i = 0; i < 5; i++) { <ide> var elm = jqLite('<div class="transition-animation"></div>'); <ide> describe("ngAnimate $animateCss", function() { <ide> <ide> jqLite($document[0].body).append($rootElement); <ide> <del> ss.addRule('.ng-enter-stagger', 'transition-delay:0.5s;' + <del> prefix + 'animation-delay:1s'); <add> ss.addPossiblyPrefixedRule('.ng-enter-stagger', 'transition-delay: 0.5s; ' + <add> 'animation-delay: 1s'); <ide> <del> ss.addRule('.ng-enter', 'transition:10s linear all;' + <del> prefix + 'animation:my_animation 20s'); <add> ss.addPossiblyPrefixedRule('.ng-enter', 'transition: 10s linear all; ' + <add> 'animation: 20s my_animation'); <ide> <ide> var i, elm, elements = []; <ide> for (i = 0; i < 5; i++) { <ide> describe("ngAnimate $animateCss", function() { <ide> // At this point, the animation should still be running (closing timeout is 7500ms ... duration * 1.5 + delay => 7.5) <ide> $timeout.flush(7000); <ide> <del> expect(element.css(prefix + 'transition-delay')).toBe('3s'); <del> expect(element.css(prefix + 'transition-duration')).toBe('3s'); <add> expect(getPossiblyPrefixedStyleValue(element, 'transition-delay')).toBe('3s'); <add> expect(getPossiblyPrefixedStyleValue(element, 'transition-duration')).toBe('3s'); <ide> <ide> // Let's flush the remaining amount of time for the timeout timer to kick in <ide> $timeout.flush(500); <ide> <del> expect(element.css(prefix + 'transition-duration')).toBeOneOf('', '0s'); <del> expect(element.css(prefix + 'transition-delay')).toBeOneOf('', '0s'); <add> expect(getPossiblyPrefixedStyleValue(element, 'transition-duration')).toBeOneOf('', '0s'); <add> expect(getPossiblyPrefixedStyleValue(element, 'transition-delay')).toBeOneOf('', '0s'); <ide> })); <ide> <ide> it("should ignore a boolean options.delay value for the closing timeout", <ide> describe("ngAnimate $animateCss", function() { <ide> // At this point, the animation should still be running (closing timeout is 4500ms ... duration * 1.5 => 4.5) <ide> $timeout.flush(4000); <ide> <del> expect(element.css(prefix + 'transition-delay')).toBeOneOf('initial', '0s'); <del> expect(element.css(prefix + 'transition-duration')).toBe('3s'); <add> expect(getPossiblyPrefixedStyleValue(element, 'transition-delay')).toBeOneOf('initial', '0s'); <add> expect(getPossiblyPrefixedStyleValue(element, 'transition-duration')).toBe('3s'); <ide> <ide> // Let's flush the remaining amount of time for the timeout timer to kick in <ide> $timeout.flush(500); <ide> <del> expect(element.css(prefix + 'transition-duration')).toBeOneOf('', '0s'); <del> expect(element.css(prefix + 'transition-delay')).toBeOneOf('', '0s'); <add> expect(getPossiblyPrefixedStyleValue(element, 'transition-duration')).toBeOneOf('', '0s'); <add> expect(getPossiblyPrefixedStyleValue(element, 'transition-delay')).toBeOneOf('', '0s'); <ide> })); <ide> <ide> }); <ide> describe("ngAnimate $animateCss", function() { <ide> triggerAnimationStartFrame(); <ide> <ide> <del> expect(element.css(prefix + 'animation-duration')).toEqual('5s'); <add> expect(getPossiblyPrefixedStyleValue(element, 'animation-duration')).toEqual('5s'); <ide> })); <ide> <ide> it("should remove all inline keyframe styling when an animation completes if a custom duration was applied", <ide> describe("ngAnimate $animateCss", function() { <ide> triggerAnimationStartFrame(); <ide> <ide> <del> expect(element.css(prefix + 'animation-delay')).toEqual('5s'); <add> expect(getPossiblyPrefixedStyleValue(element, 'animation-delay')).toEqual('5s'); <ide> <ide> browserTrigger(element, 'animationend', <ide> { timeStamp: Date.now() + 5000, elapsedTime: 1.5 }); <ide> describe("ngAnimate $animateCss", function() { <ide> triggerAnimationStartFrame(); <ide> <ide> <del> expect(element.css(prefix + 'animation-delay')).toEqual('400s'); <add> expect(getPossiblyPrefixedStyleValue(element, 'animation-delay')).toEqual('400s'); <ide> expect(element.attr('style')).not.toContain('transition-delay'); <ide> })); <ide> <ide> describe("ngAnimate $animateCss", function() { <ide> triggerAnimationStartFrame(); <ide> <ide> <del> expect(element.css(prefix + 'animation-delay')).toEqual('10s'); <add> expect(getPossiblyPrefixedStyleValue(element, 'animation-delay')).toEqual('10s'); <ide> expect(element.css('transition-delay')).toEqual('10s'); <ide> })); <ide> <ide> describe("ngAnimate $animateCss", function() { <ide> var assertionsRun = false; <ide> classSpy = function() { <ide> assertionsRun = true; <del> expect(element.css(prefix + 'animation-delay')).toEqual('2s'); <add> expect(getPossiblyPrefixedStyleValue(element, 'animation-delay')).toEqual('2s'); <ide> expect(element.css('transition-delay')).toEqual('2s'); <ide> expect(element).not.toHaveClass('superman'); <ide> }; <ide> describe("ngAnimate $animateCss", function() { <ide> it("should consider a negative value when delay:true is used with a keyframe animation", <ide> inject(function($animateCss, $rootElement) { <ide> <del> ss.addRule('.ng-enter', prefix + 'animation:2s keyframe_animation; ' + <del> prefix + 'animation-delay: -1s;'); <add> ss.addPossiblyPrefixedRule('.ng-enter', 'animation: 2s keyframe_animation; ' + <add> 'animation-delay: -1s;'); <ide> <ide> var options = { <ide> delay: true, <ide> describe("ngAnimate $animateCss", function() { <ide> animator.start(); <ide> triggerAnimationStartFrame(); <ide> <del> expect(element.css(prefix + 'animation-delay')).toContain('-1s'); <add> expect(getPossiblyPrefixedStyleValue(element, 'animation-delay')).toContain('-1s'); <ide> })); <ide> <ide> they("should consider a negative value when a negative option delay is provided for a $prop animation", { <ide> describe("ngAnimate $animateCss", function() { <ide> css: 'transition:2s linear all' <ide> }; <ide> }, <del> 'keyframe': function(prefix) { <add> 'keyframe': function() { <ide> return { <del> prop: prefix + 'animation-delay', <del> css: prefix + 'animation:2s keyframe_animation' <add> prop: 'animation-delay', <add> css: 'animation: 2s keyframe_animation' <ide> }; <ide> } <ide> }, function(testDetailsFactory) { <ide> inject(function($animateCss, $rootElement) { <ide> var testDetails = testDetailsFactory(prefix); <ide> <del> ss.addRule('.ng-enter', testDetails.css); <add> ss.addPossiblyPrefixedRule('.ng-enter', testDetails.css); <ide> var options = { <ide> delay: -2, <ide> event: 'enter', <ide> describe("ngAnimate $animateCss", function() { <ide> animator.start(); <ide> triggerAnimationStartFrame(); <ide> <del> expect(element.css(testDetails.prop)).toContain('-2s'); <add> expect(getPossiblyPrefixedStyleValue(element, testDetails.prop)).toContain('-2s'); <ide> }); <ide> }); <ide> <ide> describe("ngAnimate $animateCss", function() { <ide> css: 'transition:5s linear all; transition-delay: -2s' <ide> }; <ide> }, <del> 'animation': function(prefix) { <add> 'animation': function() { <ide> return { <ide> event: 'animationend', <del> css: prefix + 'animation:5s keyframe_animation; ' + prefix + 'animation-delay: -2s;' <add> css: 'animation: 5s keyframe_animation; animation-delay: -2s;' <ide> }; <ide> } <ide> }, function(testDetailsFactory) { <ide> inject(function($animateCss, $rootElement) { <del> var testDetails = testDetailsFactory(prefix); <add> var testDetails = testDetailsFactory(); <ide> var event = testDetails.event; <ide> <del> ss.addRule('.ng-enter', testDetails.css); <add> ss.addPossiblyPrefixedRule('.ng-enter', testDetails.css); <ide> var options = { event: 'enter', structural: true }; <ide> <ide> var animator = $animateCss(element, options); <ide> describe("ngAnimate $animateCss", function() { <ide> $animateCss(element, options).start(); <ide> triggerAnimationStartFrame(); <ide> <del> expect(element.css(prefix + 'transition-delay')).not.toEqual('4s'); <del> expect(element.css(prefix + 'transition-duration')).not.toEqual('6s'); <add> expect(getPossiblyPrefixedStyleValue(element, 'transition-delay')).not.toEqual('4s'); <add> expect(getPossiblyPrefixedStyleValue(element, 'transition-duration')).not.toEqual('6s'); <ide> <ide> options.to = { color: 'brown' }; <ide> $animateCss(element, options).start(); <ide> triggerAnimationStartFrame(); <ide> <del> expect(element.css(prefix + 'transition-delay')).toEqual('4s'); <del> expect(element.css(prefix + 'transition-duration')).toEqual('6s'); <add> expect(getPossiblyPrefixedStyleValue(element, 'transition-delay')).toEqual('4s'); <add> expect(getPossiblyPrefixedStyleValue(element, 'transition-duration')).toEqual('6s'); <ide> })); <ide> }); <ide> <ide> describe("ngAnimate $animateCss", function() { <ide> triggerAnimationStartFrame(); <ide> <ide> <del> expect(element.css(prefix + 'animation-delay')).toEqual('50s'); <del> expect(element.css(prefix + 'animation-duration')).toEqual('5.5s'); <del> expect(element.css(prefix + 'animation-name')).toEqual('my_animation'); <add> expect(getPossiblyPrefixedStyleValue(element, 'animation-delay')).toEqual('50s'); <add> expect(getPossiblyPrefixedStyleValue(element, 'animation-duration')).toEqual('5.5s'); <add> expect(getPossiblyPrefixedStyleValue(element, 'animation-name')).toEqual('my_animation'); <ide> })); <ide> <ide> it("should be able to execute the animation if it is the only provided value", <ide> describe("ngAnimate $animateCss", function() { <ide> animator.start(); <ide> triggerAnimationStartFrame(); <ide> <del> expect(element.css(prefix + 'animation-delay')).toEqual('10s'); <del> expect(element.css(prefix + 'animation-duration')).toEqual('5.5s'); <del> expect(element.css(prefix + 'animation-name')).toEqual('my_animation'); <add> expect(getPossiblyPrefixedStyleValue(element, 'animation-delay')).toEqual('10s'); <add> expect(getPossiblyPrefixedStyleValue(element, 'animation-duration')).toEqual('5.5s'); <add> expect(getPossiblyPrefixedStyleValue(element, 'animation-name')).toEqual('my_animation'); <ide> })); <ide> }); <ide> <ide> describe("ngAnimate $animateCss", function() { <ide> <ide> <ide> expect(element.css('transition-duration')).toMatch('10s'); <del> expect(element.css(prefix + 'animation-duration')).toEqual('10s'); <add> expect(getPossiblyPrefixedStyleValue(element, 'animation-duration')).toEqual('10s'); <ide> })); <ide> }); <ide> <ide> describe("ngAnimate $animateCss", function() { <ide> inject(function($animateCss) { <ide> <ide> ss.addRule('.red', 'transition: 1s linear all;'); <del> ss.addRule('.blue', prefix + 'animation:my_keyframe 1s;'); <add> ss.addPossiblyPrefixedRule('.blue', 'animation: 1s my_keyframe;'); <ide> var easing = 'ease-out'; <ide> var animator = $animateCss(element, { addClass: 'red blue', easing: easing }); <ide> animator.start(); <ide><path>test/ngSanitize/sanitizeSpec.js <ide> 'use strict'; <ide> <ide> describe('HTML', function() { <add> var ua = window.navigator.userAgent; <add> var isChrome = /Chrome/.test(ua) && !/Edge/.test(ua); <ide> <ide> var expectHTML; <ide> <ide> describe('HTML', function() { <ide> .toEqual(''); <ide> }); <ide> <del> if (/Chrome/.test(window.navigator.userAgent)) { <add> if (isChrome) { <ide> it('should prevent mXSS attacks', function() { <ide> expectHTML('<a href="&#x3000;javascript:alert(1)">CLICKME</a>').toBe('<a>CLICKME</a>'); <ide> }); <ide> describe('HTML', function() { <ide> expectHTML('<svg width="400px" height="150px" xmlns="http://www.w3.org/2000/svg"><circle cx="50" cy="50" r="40" stroke="black" stroke-width="3" fill="red"></svg>') <ide> .toBeOneOf('<svg width="400px" height="150px" xmlns="http://www.w3.org/2000/svg"><circle cx="50" cy="50" r="40" stroke="black" stroke-width="3" fill="red"></circle></svg>', <ide> '<svg xmlns="http://www.w3.org/2000/svg" height="150px" width="400px"><circle fill="red" stroke-width="3" stroke="black" r="40" cy="50" cx="50"></circle></svg>', <del> '<svg width="400px" height="150px" xmlns="http://www.w3.org/2000/svg"><circle fill="red" stroke="black" stroke-width="3" cx="50" cy="50" r="40"></circle></svg>'); <add> '<svg width="400px" height="150px" xmlns="http://www.w3.org/2000/svg"><circle fill="red" stroke="black" stroke-width="3" cx="50" cy="50" r="40"></circle></svg>', <add> '<svg width="400px" height="150px" xmlns="http://www.w3.org/2000/svg"><circle FILL="red" STROKE="black" STROKE-WIDTH="3" cx="50" cy="50" r="40"></circle></svg>'); <ide> }); <ide> <ide> it('should not ignore white-listed svg camelCased attributes', function() { <ide> describe('HTML', function() { <ide> it('should not accept SVG animation tags', function() { <ide> expectHTML('<svg xmlns:xlink="http://www.w3.org/1999/xlink"><a><text y="1em">Click me</text><animate attributeName="xlink:href" values="javascript:alert(1)"/></a></svg>') <ide> .toBeOneOf('<svg xmlns:xlink="http://www.w3.org/1999/xlink"><a><text y="1em">Click me</text></a></svg>', <add> '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><a><text y="1em">Click me</text></a></svg>', <ide> '<svg xmlns="http://www.w3.org/2000/svg"><a><text y="1em">Click me</text></a></svg>'); <ide> <ide> expectHTML('<svg><a xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="?"><circle r="400"></circle>' +
6
Java
Java
add header name to ex. msg in headerresultmatchers
d5a5a4894fe0f04caa0d934e9fffa2b44181903a
<ide><path>spring-test-mvc/src/main/java/org/springframework/test/web/servlet/result/HeaderResultMatchers.java <ide> /* <del> * Copyright 2002-2012 the original author or authors. <add> * Copyright 2002-2013 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> package org.springframework.test.web.servlet.result; <ide> <ide> import static org.springframework.test.util.AssertionErrors.assertEquals; <add>import static org.springframework.test.util.AssertionErrors.assertTrue; <ide> import static org.springframework.test.util.MatcherAssertionErrors.assertThat; <ide> <ide> import org.hamcrest.Matcher; <ide> * class is usually accessed via {@link MockMvcResultMatchers#header()}. <ide> * <ide> * @author Rossen Stoyanchev <add> * @author Sam Brannen <ide> * @since 3.2 <ide> */ <ide> public class HeaderResultMatchers { <ide> protected HeaderResultMatchers() { <ide> } <ide> <ide> /** <del> * Assert a response header with the given Hamcrest {@link Matcher}. <add> * Assert the primary value of the named response header with the given <add> * Hamcrest {@link Matcher}. <ide> */ <ide> public ResultMatcher string(final String name, final Matcher<? super String> matcher) { <ide> return new ResultMatcher() { <add> <ide> @Override <ide> public void match(MvcResult result) { <del> assertThat("Response header", result.getResponse().getHeader(name), matcher); <add> assertThat("Response header " + name, result.getResponse().getHeader(name), matcher); <ide> } <ide> }; <ide> } <ide> <ide> /** <del> * Assert the primary value of a response header as a {@link String}. <add> * Assert the primary value of the named response header as a {@link String}. <ide> */ <ide> public ResultMatcher string(final String name, final String value) { <ide> return new ResultMatcher() { <add> <ide> @Override <ide> public void match(MvcResult result) { <del> assertEquals("Response header", value, result.getResponse().getHeader(name)); <add> assertEquals("Response header " + name, value, result.getResponse().getHeader(name)); <ide> } <ide> }; <ide> } <ide> <ide> /** <del> * Assert the primary value of a response header as a {@link Long}. <add> * Assert the primary value of the named response header as a {@code long}. <add> * <add> * <p>The {@link ResultMatcher} returned by this method throws an {@link AssertionError} <add> * if the response does not contain the specified header, or if the supplied <add> * {@code value} does not match the primary value. <ide> */ <ide> public ResultMatcher longValue(final String name, final long value) { <ide> return new ResultMatcher() { <add> <ide> @Override <ide> public void match(MvcResult result) { <add> assertTrue("Response does not contain header " + name, result.getResponse().containsHeader(name)); <ide> assertEquals("Response header " + name, value, Long.parseLong(result.getResponse().getHeader(name))); <ide> } <ide> }; <ide><path>spring-test-mvc/src/test/java/org/springframework/test/web/servlet/samples/standalone/resultmatchers/HeaderAssertionTests.java <ide> /* <del> * Copyright 2002-2012 the original author or authors. <add> * Copyright 2002-2013 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.test.web.servlet.samples.standalone.resultmatchers; <ide> <del>import static org.hamcrest.Matchers.nullValue; <del>import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; <del>import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.header; <del>import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; <del>import static org.springframework.test.web.servlet.setup.MockMvcBuilders.standaloneSetup; <del> <del>import java.util.Date; <del> <ide> import org.junit.Before; <ide> import org.junit.Test; <ide> import org.springframework.stereotype.Controller; <ide> import org.springframework.test.web.Person; <ide> import org.springframework.test.web.servlet.MockMvc; <add>import org.springframework.test.web.servlet.ResultMatcher; <ide> import org.springframework.web.bind.annotation.PathVariable; <ide> import org.springframework.web.bind.annotation.RequestMapping; <ide> import org.springframework.web.bind.annotation.ResponseBody; <ide> import org.springframework.web.context.request.WebRequest; <ide> <add>import static org.hamcrest.CoreMatchers.*; <add>import static org.junit.Assert.*; <add>import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; <add>import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; <add>import static org.springframework.test.web.servlet.setup.MockMvcBuilders.*; <add> <ide> /** <ide> * Examples of expectations on response header values. <del> * <add> * <ide> * @author Rossen Stoyanchev <add> * @author Sam Brannen <ide> */ <ide> public class HeaderAssertionTests { <ide> <add> private static final String EXPECTED_ASSERTION_ERROR_MSG = "Should have thrown an AssertionError"; <add> <add> private static final String IF_MODIFIED_SINCE = "If-Modified-Since"; <add> <add> private static final String LAST_MODIFIED = "Last-Modified"; <add> <add> private final long currentTime = System.currentTimeMillis(); <add> <ide> private MockMvc mockMvc; <ide> <ide> private PersonController personController; <ide> <add> <ide> @Before <ide> public void setup() { <ide> this.personController = new PersonController(); <add> this.personController.setStubTimestamp(currentTime); <ide> this.mockMvc = standaloneSetup(this.personController).build(); <ide> } <ide> <ide> @Test <del> public void testValue() throws Exception { <del> long currentTime = new Date().getTime(); <del> this.personController.setStubTimestamp(currentTime); <del> this.mockMvc.perform(get("/persons/1").header("If-Modified-Since", currentTime - (1000 * 60))) <del> .andExpect(header().string("Last-Modified", String.valueOf(currentTime))); <add> public void stringWithCorrectResponseHeaderValue() throws Exception { <add> this.mockMvc.perform(get("/persons/1").header(IF_MODIFIED_SINCE, currentTime - (1000 * 60)))// <add> .andExpect(header().string(LAST_MODIFIED, String.valueOf(currentTime))); <ide> } <ide> <ide> @Test <del> public void testLongValue() throws Exception { <del> long currentTime = new Date().getTime(); <del> this.personController.setStubTimestamp(currentTime); <del> this.mockMvc.perform(get("/persons/1").header("If-Modified-Since", currentTime - (1000 * 60))) <del> .andExpect(header().longValue("Last-Modified", currentTime)); <add> public void stringWithMatcherAndCorrectResponseHeaderValue() throws Exception { <add> this.mockMvc.perform(get("/persons/1").header(IF_MODIFIED_SINCE, currentTime - (1000 * 60)))// <add> .andExpect(header().string(LAST_MODIFIED, equalTo(String.valueOf(currentTime)))); <ide> } <ide> <ide> @Test <del> public void testMatcher() throws Exception { <del> long currentTime = new Date().getTime(); <del> this.personController.setStubTimestamp(currentTime); <del> this.mockMvc.perform(get("/persons/1").header("If-Modified-Since", currentTime)) <del> .andExpect(status().isNotModified()) <del> .andExpect(header().string("Last-Modified", nullValue())); <add> public void longValueWithCorrectResponseHeaderValue() throws Exception { <add> this.mockMvc.perform(get("/persons/1").header(IF_MODIFIED_SINCE, currentTime - (1000 * 60)))// <add> .andExpect(header().longValue(LAST_MODIFIED, currentTime)); <add> } <add> <add> @Test <add> public void stringWithMissingResponseHeader() throws Exception { <add> this.mockMvc.perform(get("/persons/1").header(IF_MODIFIED_SINCE, currentTime))// <add> .andExpect(status().isNotModified())// <add> .andExpect(header().string(LAST_MODIFIED, (String) null)); <ide> } <ide> <add> @Test <add> public void stringWithMatcherAndMissingResponseHeader() throws Exception { <add> this.mockMvc.perform(get("/persons/1").header(IF_MODIFIED_SINCE, currentTime))// <add> .andExpect(status().isNotModified())// <add> .andExpect(header().string(LAST_MODIFIED, nullValue())); <add> } <add> <add> @Test <add> public void longValueWithMissingResponseHeader() throws Exception { <add> try { <add> this.mockMvc.perform(get("/persons/1").header(IF_MODIFIED_SINCE, currentTime))// <add> .andExpect(status().isNotModified())// <add> .andExpect(header().longValue(LAST_MODIFIED, 99L)); <add> <add> fail(EXPECTED_ASSERTION_ERROR_MSG); <add> } <add> catch (AssertionError e) { <add> if (EXPECTED_ASSERTION_ERROR_MSG.equals(e.getMessage())) { <add> throw e; <add> } <add> assertEquals("Response does not contain header " + LAST_MODIFIED, e.getMessage()); <add> } <add> } <add> <add> @Test <add> public void stringWithIncorrectResponseHeaderValue() throws Exception { <add> long unexpected = currentTime + 1; <add> assertIncorrectResponseHeaderValue(header().string(LAST_MODIFIED, String.valueOf(unexpected)), unexpected); <add> } <add> <add> @Test <add> public void stringWithMatcherAndIncorrectResponseHeaderValue() throws Exception { <add> long unexpected = currentTime + 1; <add> assertIncorrectResponseHeaderValue(header().string(LAST_MODIFIED, equalTo(String.valueOf(unexpected))), <add> unexpected); <add> } <add> <add> @Test <add> public void longValueWithIncorrectResponseHeaderValue() throws Exception { <add> long unexpected = currentTime + 1; <add> assertIncorrectResponseHeaderValue(header().longValue(LAST_MODIFIED, unexpected), unexpected); <add> } <add> <add> private void assertIncorrectResponseHeaderValue(ResultMatcher resultMatcher, long unexpected) throws Exception { <add> try { <add> this.mockMvc.perform(get("/persons/1").header(IF_MODIFIED_SINCE, currentTime - (1000 * 60)))// <add> .andExpect(resultMatcher); <add> <add> fail(EXPECTED_ASSERTION_ERROR_MSG); <add> } <add> catch (AssertionError e) { <add> if (EXPECTED_ASSERTION_ERROR_MSG.equals(e.getMessage())) { <add> throw e; <add> } <add> // [SPR-10659] Ensure that the header name is included in the message <add> // <add> // We don't use assertEquals() since we cannot control the formatting <add> // produced by JUnit or Hamcrest. <add> assertMessageContains(e, "Response header " + LAST_MODIFIED); <add> assertMessageContains(e, String.valueOf(unexpected)); <add> assertMessageContains(e, String.valueOf(currentTime)); <add> } <add> } <add> <add> private void assertMessageContains(AssertionError error, String expected) { <add> String message = error.getMessage(); <add> assertTrue("Failure message should contain: " + expected, message.contains(expected)); <add> } <add> <add> <add> // ------------------------------------------------------------------------- <ide> <ide> @Controller <ide> private static class PersonController { <ide> <ide> private long timestamp; <ide> <add> <ide> public void setStubTimestamp(long timestamp) { <ide> this.timestamp = timestamp; <ide> }
2
Python
Python
fix provider for airflow 2.2.x
4d32f61fd049889b49b4ce8b664d8e134aecb053
<ide><path>airflow/providers/databricks/hooks/databricks_base.py <ide> def user_agent_value(self) -> str: <ide> package_name = manager.hooks[BaseDatabricksHook.conn_type].package_name # type: ignore[union-attr] <ide> provider = manager.providers[package_name] <ide> version = provider.version <del> if provider.is_source: <del> version += "-source" <del> <ide> python_version = platform.python_version() <ide> system = platform.system().lower() <ide> ua_string = (
1
Java
Java
give a name to the reactcontext thread
bbc1af65366ebef5e055857a1d4eff56b86e6024
<ide><path>ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManager.java <ide> private void runCreateReactContextOnNewThread(final ReactContextInitParams initP <ide> <ide> mCreateReactContextThread = <ide> new Thread( <add> null, <ide> new Runnable() { <ide> @Override <ide> public void run() { <ide> public void run() { <ide> mDevSupportManager.handleException(e); <ide> } <ide> } <del> }); <add> }, <add> "create_react_context"); <ide> ReactMarker.logMarker(REACT_CONTEXT_THREAD_START); <ide> mCreateReactContextThread.start(); <ide> }
1
Javascript
Javascript
add a flag to disable module pattern components
562cf013dbd80cade517e25192ee19e958aef55b
<ide><path>packages/react-reconciler/src/ReactFiberBeginWork.js <ide> import ReactSharedInternals from 'shared/ReactSharedInternals'; <ide> import { <ide> debugRenderPhaseSideEffectsForStrictMode, <ide> disableLegacyContext, <add> disableModulePatternComponents, <ide> enableProfilerTimer, <ide> enableSchedulerTracing, <ide> enableSuspenseServerRenderer, <ide> function mountIndeterminateComponent( <ide> workInProgress.effectTag |= PerformedWork; <ide> <ide> if ( <add> !disableModulePatternComponents && <ide> typeof value === 'object' && <ide> value !== null && <ide> typeof value.render === 'function' && <ide><path>packages/shared/ReactFeatureFlags.js <ide> export const disableTextareaChildren = false; <ide> // Disables Maps as ReactElement children <ide> export const disableMapsAsChildren = false; <ide> <add>export const disableModulePatternComponents = false; <add> <ide> // We should remove this flag once the above flag becomes enabled <ide> export const warnUnstableRenderSubtreeIntoContainer = false; <ide> <ide><path>packages/shared/forks/ReactFeatureFlags.native-fb.js <ide> export const disableSchedulerTimeoutBasedOnReactExpirationTime = false; <ide> export const enableTrustedTypesIntegration = false; <ide> export const disableTextareaChildren = false; <ide> export const disableMapsAsChildren = false; <add>export const disableModulePatternComponents = false; <ide> export const warnUnstableRenderSubtreeIntoContainer = false; <ide> export const deferPassiveEffectCleanupDuringUnmount = false; <ide> export const runAllPassiveEffectDestroysBeforeCreates = false; <ide><path>packages/shared/forks/ReactFeatureFlags.native-oss.js <ide> export const disableSchedulerTimeoutBasedOnReactExpirationTime = false; <ide> export const enableTrustedTypesIntegration = false; <ide> export const disableTextareaChildren = false; <ide> export const disableMapsAsChildren = false; <add>export const disableModulePatternComponents = false; <ide> export const warnUnstableRenderSubtreeIntoContainer = false; <ide> export const deferPassiveEffectCleanupDuringUnmount = false; <ide> export const runAllPassiveEffectDestroysBeforeCreates = false; <ide><path>packages/shared/forks/ReactFeatureFlags.persistent.js <ide> export const disableSchedulerTimeoutBasedOnReactExpirationTime = false; <ide> export const enableTrustedTypesIntegration = false; <ide> export const disableTextareaChildren = false; <ide> export const disableMapsAsChildren = false; <add>export const disableModulePatternComponents = false; <ide> export const warnUnstableRenderSubtreeIntoContainer = false; <ide> export const deferPassiveEffectCleanupDuringUnmount = false; <ide> export const runAllPassiveEffectDestroysBeforeCreates = false; <ide><path>packages/shared/forks/ReactFeatureFlags.test-renderer.js <ide> export const disableSchedulerTimeoutBasedOnReactExpirationTime = false; <ide> export const enableTrustedTypesIntegration = false; <ide> export const disableTextareaChildren = false; <ide> export const disableMapsAsChildren = false; <add>export const disableModulePatternComponents = false; <ide> export const warnUnstableRenderSubtreeIntoContainer = false; <ide> export const deferPassiveEffectCleanupDuringUnmount = false; <ide> export const runAllPassiveEffectDestroysBeforeCreates = false; <ide><path>packages/shared/forks/ReactFeatureFlags.test-renderer.www.js <ide> export const disableSchedulerTimeoutBasedOnReactExpirationTime = false; <ide> export const enableTrustedTypesIntegration = false; <ide> export const disableTextareaChildren = false; <ide> export const disableMapsAsChildren = false; <add>export const disableModulePatternComponents = false; <ide> export const warnUnstableRenderSubtreeIntoContainer = false; <ide> export const deferPassiveEffectCleanupDuringUnmount = false; <ide> export const runAllPassiveEffectDestroysBeforeCreates = false; <ide><path>packages/shared/forks/ReactFeatureFlags.testing.js <ide> export const disableSchedulerTimeoutBasedOnReactExpirationTime = false; <ide> export const enableTrustedTypesIntegration = false; <ide> export const disableTextareaChildren = false; <ide> export const disableMapsAsChildren = false; <add>export const disableModulePatternComponents = false; <ide> export const warnUnstableRenderSubtreeIntoContainer = false; <ide> export const deferPassiveEffectCleanupDuringUnmount = false; <ide> export const runAllPassiveEffectDestroysBeforeCreates = false; <ide><path>packages/shared/forks/ReactFeatureFlags.testing.www.js <ide> export const disableSchedulerTimeoutBasedOnReactExpirationTime = false; <ide> export const enableTrustedTypesIntegration = false; <ide> export const disableTextareaChildren = __EXPERIMENTAL__; <ide> export const disableMapsAsChildren = __EXPERIMENTAL__; <add>export const disableModulePatternComponents = false; <ide> export const warnUnstableRenderSubtreeIntoContainer = false; <ide> export const deferPassiveEffectCleanupDuringUnmount = false; <ide> export const runAllPassiveEffectDestroysBeforeCreates = false; <ide><path>packages/shared/forks/ReactFeatureFlags.www.js <ide> export const disableTextareaChildren = __EXPERIMENTAL__; <ide> <ide> export const disableMapsAsChildren = __EXPERIMENTAL__; <ide> <add>export const disableModulePatternComponents = __EXPERIMENTAL__; <add> <ide> export const warnUnstableRenderSubtreeIntoContainer = false; <ide> <ide> export const enableLegacyFBPrimerSupport = !__EXPERIMENTAL__;
10
Python
Python
fix indent error
a3972dd9b4b0675d52cd1dcdf9fc2c92d677f0eb
<ide><path>data_structures/Binary Tree/binary_seach_tree.py <ide> def getLabel(self): <ide> return self.label <ide> <ide> def setLabel(self, label): <del> self.label = label <add> self.label = label <ide> <ide> def getLeft(self): <ide> return self.left
1
Ruby
Ruby
add tests for inheritableoptions
4db4f8c6244f017def5668d44a62bdad231f4c18
<ide><path>activesupport/test/ordered_options_test.rb <ide> def test_method_access <ide> assert_equal 2, a.size <ide> assert_equal 56, a.else_where <ide> end <add> <add> def test_inheritable_options_continues_lookup_in_parent <add> parent = ActiveSupport::OrderedOptions.new <add> parent[:foo] = true <add> <add> child = ActiveSupport::InheritableOptions.new(parent) <add> assert child.foo <add> end <add> <add> def test_inheritable_options_can_override_parent <add> parent = ActiveSupport::OrderedOptions.new <add> parent[:foo] = :bar <add> <add> child = ActiveSupport::InheritableOptions.new(parent) <add> child[:foo] = :baz <add> <add> assert_equal :baz, child.foo <add> end <add> <add> def test_inheritable_options_inheritable_copy <add> original = ActiveSupport::InheritableOptions.new <add> copy = original.inheritable_copy <add> <add> assert copy.kind_of?(original.class) <add> assert_not_equal copy.object_id, original.object_id <add> end <ide> end
1
Javascript
Javascript
implement getvalueforpixel for category scale
cb54f30c970672488a239a2d371d55dfe3fb8864
<ide><path>src/scales/scale.category.js <ide> module.exports = function(Chart) { <ide> }, <ide> getPixelForTick: function(index, includeOffset) { <ide> return this.getPixelForValue(this.ticks[index], index + this.minIndex, null, includeOffset); <add> }, <add> getValueForPixel: function(pixel) <add> { <add> var value <add>; var offsetAmt = Math.max((this.ticks.length - ((this.options.gridLines.offsetGridLines) ? 0 : 1)), 1); <add> var horz = this.isHorizontal(); <add> var innerDimension = horz ? this.width - (this.paddingLeft + this.paddingRight) : this.height - (this.paddingTop + this.paddingBottom); <add> var valueDimension = innerDimension / offsetAmt; <add> <add> if (this.options.gridLines.offsetGridLines) { <add> pixel -= (valueDimension / 2); <add> } <add> pixel -= horz ? this.paddingLeft : this.paddingTop; <add> <add> if (pixel <= 0) { <add> value = 0; <add> } else { <add> value = Math.round(pixel / valueDimension); <add> } <add> <add> return value; <ide> } <ide> }); <ide> <ide><path>test/scale.category.tests.js <ide> describe('Category scale tests', function() { <ide> <ide> expect(scale.getPixelForValue(0, 0, 0, false)).toBe(33); <ide> expect(scale.getPixelForValue(0, 0, 0, true)).toBe(85); <add> expect(scale.getValueForPixel(33)).toBe(0); <add> expect(scale.getValueForPixel(85)).toBe(0); <ide> <ide> expect(scale.getPixelForValue(0, 4, 0, false)).toBe(452); <ide> expect(scale.getPixelForValue(0, 4, 0, true)).toBe(505); <add> expect(scale.getValueForPixel(452)).toBe(4); <add> expect(scale.getValueForPixel(505)).toBe(4); <ide> <ide> config.gridLines.offsetGridLines = false; <ide> <ide> expect(scale.getPixelForValue(0, 0, 0, false)).toBe(33); <ide> expect(scale.getPixelForValue(0, 0, 0, true)).toBe(33); <add> expect(scale.getValueForPixel(33)).toBe(0); <ide> <ide> expect(scale.getPixelForValue(0, 4, 0, false)).toBe(557); <ide> expect(scale.getPixelForValue(0, 4, 0, true)).toBe(557); <add> expect(scale.getValueForPixel(557)).toBe(4); <ide> }); <ide> <ide> it ('Should get the correct pixel for a value when horizontal and zoomed', function() { <ide> describe('Category scale tests', function() { <ide> <ide> expect(scale.getPixelForValue(0, 0, 0, false)).toBe(11); <ide> expect(scale.getPixelForValue(0, 0, 0, true)).toBe(30); <add> expect(scale.getValueForPixel(11)).toBe(0); <add> expect(scale.getValueForPixel(30)).toBe(0); <ide> <ide> expect(scale.getPixelForValue(0, 4, 0, false)).toBe(161); <ide> expect(scale.getPixelForValue(0, 4, 0, true)).toBe(180); <add> expect(scale.getValueForPixel(161)).toBe(4); <ide> <ide> config.gridLines.offsetGridLines = false; <ide> <ide> expect(scale.getPixelForValue(0, 0, 0, false)).toBe(11); <ide> expect(scale.getPixelForValue(0, 0, 0, true)).toBe(11); <add> expect(scale.getValueForPixel(11)).toBe(0); <ide> <ide> expect(scale.getPixelForValue(0, 4, 0, false)).toBe(199); <ide> expect(scale.getPixelForValue(0, 4, 0, true)).toBe(199); <add> expect(scale.getValueForPixel(199)).toBe(4); <ide> }); <ide> <ide> it ('should get the correct pixel for a value when vertical and zoomed', function() {
2
Java
Java
avoid new assertj deprecations
aa8802a81d1312386b71786711dbef8639cd35f3
<ide><path>spring-context/src/test/java/org/springframework/format/datetime/DateFormattingTests.java <ide> /* <del> * Copyright 2002-2021 the original author or authors. <add> * Copyright 2002-2022 the original author or authors. <ide> * <ide> * Licensed under the Apache License, Version 2.0 (the "License"); <ide> * you may not use this file except in compliance with the License. <ide> void styleDateWithInvalidFormat() { <ide> TypeMismatchException exception = fieldError.unwrap(TypeMismatchException.class); <ide> assertThat(exception) <ide> .hasMessageContaining("for property 'styleDate'") <del> .hasCauseInstanceOf(ConversionFailedException.class).getCause() <add> .hasCauseInstanceOf(ConversionFailedException.class).cause() <ide> .hasMessageContaining("for value '99/01/01'") <del> .hasCauseInstanceOf(IllegalArgumentException.class).getCause() <add> .hasCauseInstanceOf(IllegalArgumentException.class).cause() <ide> .hasMessageContaining("Parse attempt failed for value [99/01/01]") <del> .hasCauseInstanceOf(ParseException.class).getCause() <add> .hasCauseInstanceOf(ParseException.class).cause() <ide> // Unable to parse date time value "99/01/01" using configuration from <ide> // @org.springframework.format.annotation.DateTimeFormat(pattern=, style=S-, iso=NONE, fallbackPatterns=[]) <ide> // We do not check "fallbackPatterns=[]", since the array representation in the toString() <ide> void styleDateWithInvalidFormat() { <ide> "Unable to parse date time value \"99/01/01\" using configuration from", <ide> "@org.springframework.format.annotation.DateTimeFormat", <ide> "style=", "S-", "iso=NONE") <del> .hasCauseInstanceOf(ParseException.class).getCause() <add> .hasCauseInstanceOf(ParseException.class).cause() <ide> .hasMessageStartingWith("Unparseable date: \"99/01/01\"") <ide> .hasNoCause(); <ide> } <ide> void patternDateWithUnsupportedPattern() { <ide> FieldError fieldError = bindingResult.getFieldError(propertyName); <ide> assertThat(fieldError.unwrap(TypeMismatchException.class)) <ide> .hasMessageContaining("for property 'patternDateWithFallbackPatterns'") <del> .hasCauseInstanceOf(ConversionFailedException.class).getCause() <add> .hasCauseInstanceOf(ConversionFailedException.class).cause() <ide> .hasMessageContaining("for value '210302'") <del> .hasCauseInstanceOf(IllegalArgumentException.class).getCause() <add> .hasCauseInstanceOf(IllegalArgumentException.class).cause() <ide> .hasMessageContaining("Parse attempt failed for value [210302]") <del> .hasCauseInstanceOf(ParseException.class).getCause() <add> .hasCauseInstanceOf(ParseException.class).cause() <ide> // Unable to parse date time value "210302" using configuration from <ide> // @org.springframework.format.annotation.DateTimeFormat( <ide> // pattern=yyyy-MM-dd, style=SS, iso=NONE, fallbackPatterns=[M/d/yy, yyyyMMdd, yyyy.MM.dd]) <ide> .hasMessageContainingAll( <ide> "Unable to parse date time value \"210302\" using configuration from", <ide> "@org.springframework.format.annotation.DateTimeFormat", <ide> "yyyy-MM-dd", "M/d/yy", "yyyyMMdd", "yyyy.MM.dd") <del> .hasCauseInstanceOf(ParseException.class).getCause() <add> .hasCauseInstanceOf(ParseException.class).cause() <ide> .hasMessageStartingWith("Unparseable date: \"210302\"") <ide> .hasNoCause(); <ide> } <ide><path>spring-context/src/test/java/org/springframework/format/datetime/standard/DateTimeFormattingTests.java <ide> /* <del> * Copyright 2002-2021 the original author or authors. <add> * Copyright 2002-2022 the original author or authors. <ide> * <ide> * Licensed under the Apache License, Version 2.0 (the "License"); <ide> * you may not use this file except in compliance with the License. <ide> void isoLocalDateWithInvalidFormat() { <ide> FieldError fieldError = bindingResult.getFieldError(propertyName); <ide> assertThat(fieldError.unwrap(TypeMismatchException.class)) <ide> .hasMessageContaining("for property 'isoLocalDate'") <del> .hasCauseInstanceOf(ConversionFailedException.class).getCause() <add> .hasCauseInstanceOf(ConversionFailedException.class).cause() <ide> .hasMessageContaining("for value '2009-31-10'") <del> .hasCauseInstanceOf(IllegalArgumentException.class).getCause() <add> .hasCauseInstanceOf(IllegalArgumentException.class).cause() <ide> .hasMessageContaining("Parse attempt failed for value [2009-31-10]") <del> .hasCauseInstanceOf(DateTimeParseException.class).getCause() <add> .hasCauseInstanceOf(DateTimeParseException.class).cause() <ide> // Unable to parse date time value "2009-31-10" using configuration from <ide> // @org.springframework.format.annotation.DateTimeFormat(pattern=, style=SS, iso=DATE, fallbackPatterns=[]) <ide> // We do not check "fallbackPatterns=[]", since the array representation in the toString() <ide> // implementation for annotations changed from [] to {} in Java 9. <ide> .hasMessageContainingAll( <ide> "Unable to parse date time value \"2009-31-10\" using configuration from", <ide> "@org.springframework.format.annotation.DateTimeFormat", "iso=DATE") <del> .hasCauseInstanceOf(DateTimeParseException.class).getCause() <add> .hasCauseInstanceOf(DateTimeParseException.class).cause() <ide> .hasMessageStartingWith("Text '2009-31-10'") <del> .hasCauseInstanceOf(DateTimeException.class).getCause() <add> .hasCauseInstanceOf(DateTimeException.class).cause() <ide> .hasMessageContaining("Invalid value for MonthOfYear (valid values 1 - 12): 31") <ide> .hasNoCause(); <ide> } <ide> void patternLocalDateWithUnsupportedPattern() { <ide> FieldError fieldError = bindingResult.getFieldError(propertyName); <ide> assertThat(fieldError.unwrap(TypeMismatchException.class)) <ide> .hasMessageContaining("for property 'patternLocalDateWithFallbackPatterns'") <del> .hasCauseInstanceOf(ConversionFailedException.class).getCause() <add> .hasCauseInstanceOf(ConversionFailedException.class).cause() <ide> .hasMessageContaining("for value '210302'") <del> .hasCauseInstanceOf(IllegalArgumentException.class).getCause() <add> .hasCauseInstanceOf(IllegalArgumentException.class).cause() <ide> .hasMessageContaining("Parse attempt failed for value [210302]") <del> .hasCauseInstanceOf(DateTimeParseException.class).getCause() <add> .hasCauseInstanceOf(DateTimeParseException.class).cause() <ide> // Unable to parse date time value "210302" using configuration from <ide> // @org.springframework.format.annotation.DateTimeFormat( <ide> // pattern=yyyy-MM-dd, style=SS, iso=NONE, fallbackPatterns=[M/d/yy, yyyyMMdd, yyyy.MM.dd]) <ide> .hasMessageContainingAll( <ide> "Unable to parse date time value \"210302\" using configuration from", <ide> "@org.springframework.format.annotation.DateTimeFormat", <ide> "yyyy-MM-dd", "M/d/yy", "yyyyMMdd", "yyyy.MM.dd") <del> .hasCauseInstanceOf(DateTimeParseException.class).getCause() <add> .hasCauseInstanceOf(DateTimeParseException.class).cause() <ide> .hasMessageStartingWith("Text '210302'") <ide> .hasNoCause(); <ide> }
2
Python
Python
add extra kwargs and update doc of many ma methods
36f76ea2e6e91062df12d3a46ccaed7822bc82f2
<ide><path>numpy/ma/core.py <ide> def _flatsequence(sequence): <ide> return np.array([_ for _ in flattened], dtype=bool) <ide> <ide> <del>def _check_mask_axis(mask, axis): <add>def _check_mask_axis(mask, axis, keepdims=np._NoValue): <ide> "Check whether there are masked values along the given axis" <add> kwargs = {} if keepdims is np._NoValue else {'keepdims': keepdims} <ide> if mask is not nomask: <del> return mask.all(axis=axis) <add> return mask.all(axis=axis, **kwargs) <ide> return nomask <ide> <ide> <ide> def get_real(self): <ide> return result <ide> real = property(fget=get_real, doc="Real part") <ide> <del> def count(self, axis=None): <add> def count(self, axis=None, keepdims=np._NoValue): <ide> """ <ide> Count the non-masked elements of the array along the given axis. <ide> <ide> Parameters <ide> ---------- <del> axis : int, optional <del> Axis along which to count the non-masked elements. If `axis` is <del> `None`, all non-masked elements are counted. <add> axis : None or int or tuple of ints, optional <add> Axis or axes along which the count is performed. <add> The default (`axis` = `None`) performs the count over all <add> the dimensions of the input array. `axis` may be negative, in <add> which case it counts from the last to the first axis. <add> <add> .. versionadded:: 1.10.0 <add> <add> If this is a tuple of ints, the count is performed on multiple <add> axes, instead of a single axis or all the axes as before. <add> keepdims : bool, optional <add> If this is set to True, the axes which are reduced are left <add> in the result as dimensions with size one. With this option, <add> the result will broadcast correctly against the array. <ide> <ide> Returns <ide> ------- <del> result : int or ndarray <del> If `axis` is `None`, an integer count is returned. When `axis` is <del> not `None`, an array with shape determined by the lengths of the <del> remaining axes, is returned. <add> result : ndarray or scalar <add> An array with the same shape as the input array, with the specified <add> axis removed. If the array is a 0-d array, or if `axis` is None, a <add> scalar is returned. <ide> <ide> See Also <ide> -------- <ide> def count(self, axis=None): <ide> array([3, 0]) <ide> <ide> """ <add> kwargs = {} if keepdims is np._NoValue else {'keepdims': keepdims} <add> <ide> m = self._mask <del> s = self.shape <add> # special case for matrices (we assume no other subclasses modify <add> # their dimensions) <add> if isinstance(self.data, np.matrix): <add> if m is nomask: <add> m = np.zeros(self.shape, dtype=np.bool_) <add> m = m.view(type(self.data)) <add> <ide> if m is nomask: <del> if axis is None: <add> # compare to _count_reduce_items in _methods.py <add> <add> if self.shape is (): <add> if axis not in (None, 0): <add> raise ValueError("'axis' entry is out of bounds") <add> return 1 <add> elif axis is None: <ide> return self.size <add> <add> axes = axis if isinstance(axis, tuple) else (axis,) <add> items = 1 <add> for ax in axes: <add> items *= self.shape[ax] <add> <add> if kwargs.get('keepdims', False): <add> out_dims = list(self.shape) <add> for a in axes: <add> out_dims[a] = 1 <ide> else: <del> n = s[axis] <del> t = list(s) <del> del t[axis] <del> return np.full(t, n, dtype=np.intp) <del> n1 = np.size(m, axis) <del> n2 = np.sum(m, axis=axis, dtype=np.intp) <del> if axis is None: <del> return (n1 - n2) <del> else: <del> return narray(n1 - n2) <add> out_dims = [d for n,d in enumerate(self.shape) if n not in axes] <add> # make sure to return a 0-d array if axis is supplied <add> return np.full(out_dims, items, dtype=np.intp) <add> <add> # take care of the masked singleton <add> if self is masked: <add> return 0 <add> <add> return (~m).sum(axis=axis, dtype=np.intp, **kwargs) <ide> <ide> flatten = _arraymethod('flatten') <ide> <ide> def iscontiguous(self): <ide> """ <ide> return self.flags['CONTIGUOUS'] <ide> <del> def all(self, axis=None, out=None): <add> def all(self, axis=None, out=None, keepdims=np._NoValue): <ide> """ <del> Check if all of the elements of `a` are true. <add> Returns True if all elements evaluate to True. <ide> <del> Performs a :func:`logical_and` over the given axis and returns the result. <del> Masked values are considered as True during computation. <del> For convenience, the output array is masked where ALL the values along the <del> current axis are masked: if the output would have been a scalar and that <del> all the values are masked, then the output is `masked`. <add> The output array is masked where all the values along the given axis <add> are masked: if the output would have been a scalar and that all the <add> values are masked, then the output is `masked`. <ide> <del> Parameters <del> ---------- <del> axis : {None, integer} <del> Axis to perform the operation over. <del> If None, perform over flattened array. <del> out : {None, array}, optional <del> Array into which the result can be placed. Its type is preserved <del> and it must be of the right shape to hold the output. <add> Refer to `numpy.all` for full documentation. <ide> <ide> See Also <ide> -------- <del> all : equivalent function <add> ndarray.all : corresponding function for ndarrays <add> numpy.all : equivalent function <ide> <ide> Examples <ide> -------- <ide> def all(self, axis=None, out=None): <ide> True <ide> <ide> """ <del> mask = _check_mask_axis(self._mask, axis) <add> kwargs = {} if keepdims is np._NoValue else {'keepdims': keepdims} <add> <add> mask = _check_mask_axis(self._mask, axis, **kwargs) <ide> if out is None: <del> d = self.filled(True).all(axis=axis).view(type(self)) <add> d = self.filled(True).all(axis=axis, **kwargs).view(type(self)) <ide> if d.ndim: <ide> d.__setmask__(mask) <ide> elif mask: <ide> return masked <ide> return d <del> self.filled(True).all(axis=axis, out=out) <add> self.filled(True).all(axis=axis, out=out, **kwargs) <ide> if isinstance(out, MaskedArray): <ide> if out.ndim or mask: <ide> out.__setmask__(mask) <ide> return out <ide> <del> def any(self, axis=None, out=None): <add> def any(self, axis=None, out=None, keepdims=np._NoValue): <ide> """ <del> Check if any of the elements of `a` are true. <add> Returns True if any of the elements of `a` evaluate to True. <ide> <del> Performs a logical_or over the given axis and returns the result. <ide> Masked values are considered as False during computation. <ide> <del> Parameters <del> ---------- <del> axis : {None, integer} <del> Axis to perform the operation over. <del> If None, perform over flattened array and return a scalar. <del> out : {None, array}, optional <del> Array into which the result can be placed. Its type is preserved <del> and it must be of the right shape to hold the output. <add> Refer to `numpy.any` for full documentation. <ide> <ide> See Also <ide> -------- <del> any : equivalent function <add> ndarray.any : corresponding function for ndarrays <add> numpy.any : equivalent function <ide> <ide> """ <del> mask = _check_mask_axis(self._mask, axis) <add> kwargs = {} if keepdims is np._NoValue else {'keepdims': keepdims} <add> <add> mask = _check_mask_axis(self._mask, axis, **kwargs) <ide> if out is None: <del> d = self.filled(False).any(axis=axis).view(type(self)) <add> d = self.filled(False).any(axis=axis, **kwargs).view(type(self)) <ide> if d.ndim: <ide> d.__setmask__(mask) <ide> elif mask: <ide> d = masked <ide> return d <del> self.filled(False).any(axis=axis, out=out) <add> self.filled(False).any(axis=axis, out=out, **kwargs) <ide> if isinstance(out, MaskedArray): <ide> if out.ndim or mask: <ide> out.__setmask__(mask) <ide> def dot(self, b, out=None, strict=False): <ide> """ <ide> return dot(self, b, out=out, strict=strict) <ide> <del> def sum(self, axis=None, dtype=None, out=None): <add> def sum(self, axis=None, dtype=None, out=None, keepdims=np._NoValue): <ide> """ <ide> Return the sum of the array elements over the given axis. <add> <ide> Masked elements are set to 0 internally. <ide> <del> Parameters <del> ---------- <del> axis : {None, -1, int}, optional <del> Axis along which the sum is computed. The default <del> (`axis` = None) is to compute over the flattened array. <del> dtype : {None, dtype}, optional <del> Determines the type of the returned array and of the accumulator <del> where the elements are summed. If dtype has the value None and <del> the type of a is an integer type of precision less than the default <del> platform integer, then the default platform integer precision is <del> used. Otherwise, the dtype is the same as that of a. <del> out : {None, ndarray}, optional <del> Alternative output array in which to place the result. It must <del> have the same shape and buffer length as the expected output <del> but the type will be cast if necessary. <add> Refer to `numpy.sum` for full documentation. <ide> <del> Returns <del> ------- <del> sum_along_axis : MaskedArray or scalar <del> An array with the same shape as self, with the specified <del> axis removed. If self is a 0-d array, or if `axis` is None, a scalar <del> is returned. If an output array is specified, a reference to <del> `out` is returned. <add> See Also <add> -------- <add> ndarray.sum : corresponding function for ndarrays <add> numpy.sum : equivalent function <ide> <ide> Examples <ide> -------- <ide> def sum(self, axis=None, dtype=None, out=None): <ide> <type 'numpy.int64'> <ide> <ide> """ <add> kwargs = {} if keepdims is np._NoValue else {'keepdims': keepdims} <add> <ide> _mask = self._mask <del> newmask = _check_mask_axis(_mask, axis) <add> newmask = _check_mask_axis(_mask, axis, **kwargs) <ide> # No explicit output <ide> if out is None: <del> result = self.filled(0).sum(axis, dtype=dtype) <add> result = self.filled(0).sum(axis, dtype=dtype, **kwargs) <ide> rndim = getattr(result, 'ndim', 0) <ide> if rndim: <ide> result = result.view(type(self)) <ide> def sum(self, axis=None, dtype=None, out=None): <ide> result = masked <ide> return result <ide> # Explicit output <del> result = self.filled(0).sum(axis, dtype=dtype, out=out) <add> result = self.filled(0).sum(axis, dtype=dtype, out=out, **kwargs) <ide> if isinstance(out, MaskedArray): <ide> outmask = getattr(out, '_mask', nomask) <ide> if (outmask is nomask): <ide> def sum(self, axis=None, dtype=None, out=None): <ide> <ide> def cumsum(self, axis=None, dtype=None, out=None): <ide> """ <del> Return the cumulative sum of the elements along the given axis. <del> The cumulative sum is calculated over the flattened array by <del> default, otherwise over the specified axis. <add> Return the cumulative sum of the array elements over the given axis. <ide> <ide> Masked values are set to 0 internally during the computation. <ide> However, their position is saved, and the result will be masked at <ide> the same locations. <ide> <del> Parameters <del> ---------- <del> axis : {None, -1, int}, optional <del> Axis along which the sum is computed. The default (`axis` = None) is to <del> compute over the flattened array. `axis` may be negative, in which case <del> it counts from the last to the first axis. <del> dtype : {None, dtype}, optional <del> Type of the returned array and of the accumulator in which the <del> elements are summed. If `dtype` is not specified, it defaults <del> to the dtype of `a`, unless `a` has an integer dtype with a <del> precision less than that of the default platform integer. In <del> that case, the default platform integer is used. <del> out : ndarray, optional <del> Alternative output array in which to place the result. It must <del> have the same shape and buffer length as the expected output <del> but the type will be cast if necessary. <del> <del> Returns <del> ------- <del> cumsum : ndarray. <del> A new array holding the result is returned unless ``out`` is <del> specified, in which case a reference to ``out`` is returned. <add> Refer to `numpy.cumsum` for full documentation. <ide> <ide> Notes <ide> ----- <ide> def cumsum(self, axis=None, dtype=None, out=None): <ide> Arithmetic is modular when using integer types, and no error is <ide> raised on overflow. <ide> <add> See Also <add> -------- <add> ndarray.cumsum : corresponding function for ndarrays <add> numpy.cumsum : equivalent function <add> <ide> Examples <ide> -------- <ide> >>> marr = np.ma.array(np.arange(10), mask=[0,0,0,1,1,1,0,0,0,0]) <ide> def cumsum(self, axis=None, dtype=None, out=None): <ide> result.__setmask__(self._mask) <ide> return result <ide> <del> def prod(self, axis=None, dtype=None, out=None): <add> def prod(self, axis=None, dtype=None, out=None, keepdims=np._NoValue): <ide> """ <ide> Return the product of the array elements over the given axis. <del> Masked elements are set to 1 internally for computation. <del> <del> Parameters <del> ---------- <del> axis : {None, int}, optional <del> Axis over which the product is taken. If None is used, then the <del> product is over all the array elements. <del> dtype : {None, dtype}, optional <del> Determines the type of the returned array and of the accumulator <del> where the elements are multiplied. If ``dtype`` has the value ``None`` <del> and the type of a is an integer type of precision less than the default <del> platform integer, then the default platform integer precision is <del> used. Otherwise, the dtype is the same as that of a. <del> out : {None, array}, optional <del> Alternative output array in which to place the result. It must have <del> the same shape as the expected output but the type will be cast if <del> necessary. <ide> <del> Returns <del> ------- <del> product_along_axis : {array, scalar}, see dtype parameter above. <del> Returns an array whose shape is the same as a with the specified <del> axis removed. Returns a 0d array when a is 1d or axis=None. <del> Returns a reference to the specified output array if specified. <add> Masked elements are set to 1 internally for computation. <ide> <del> See Also <del> -------- <del> prod : equivalent function <add> Refer to `numpy.prod` for full documentation. <ide> <ide> Notes <ide> ----- <ide> Arithmetic is modular when using integer types, and no error is raised <ide> on overflow. <ide> <del> Examples <add> See Also <ide> -------- <del> >>> np.prod([1.,2.]) <del> 2.0 <del> >>> np.prod([1.,2.], dtype=np.int32) <del> 2 <del> >>> np.prod([[1.,2.],[3.,4.]]) <del> 24.0 <del> >>> np.prod([[1.,2.],[3.,4.]], axis=1) <del> array([ 2., 12.]) <del> <add> ndarray.prod : corresponding function for ndarrays <add> numpy.prod : equivalent function <ide> """ <add> kwargs = {} if keepdims is np._NoValue else {'keepdims': keepdims} <add> <ide> _mask = self._mask <del> newmask = _check_mask_axis(_mask, axis) <add> newmask = _check_mask_axis(_mask, axis, **kwargs) <ide> # No explicit output <ide> if out is None: <del> result = self.filled(1).prod(axis, dtype=dtype) <add> result = self.filled(1).prod(axis, dtype=dtype, **kwargs) <ide> rndim = getattr(result, 'ndim', 0) <ide> if rndim: <ide> result = result.view(type(self)) <ide> def prod(self, axis=None, dtype=None, out=None): <ide> result = masked <ide> return result <ide> # Explicit output <del> result = self.filled(1).prod(axis, dtype=dtype, out=out) <add> result = self.filled(1).prod(axis, dtype=dtype, out=out, **kwargs) <ide> if isinstance(out, MaskedArray): <ide> outmask = getattr(out, '_mask', nomask) <ide> if (outmask is nomask): <ide> outmask = out._mask = make_mask_none(out.shape) <ide> outmask.flat = newmask <ide> return out <del> <ide> product = prod <ide> <ide> def cumprod(self, axis=None, dtype=None, out=None): <ide> """ <del> Return the cumulative product of the elements along the given axis. <del> The cumulative product is taken over the flattened array by <del> default, otherwise over the specified axis. <add> Return the cumulative product of the array elements over the given axis. <ide> <ide> Masked values are set to 1 internally during the computation. <ide> However, their position is saved, and the result will be masked at <ide> the same locations. <ide> <del> Parameters <del> ---------- <del> axis : {None, -1, int}, optional <del> Axis along which the product is computed. The default <del> (`axis` = None) is to compute over the flattened array. <del> dtype : {None, dtype}, optional <del> Determines the type of the returned array and of the accumulator <del> where the elements are multiplied. If ``dtype`` has the value ``None`` <del> and the type of ``a`` is an integer type of precision less than the <del> default platform integer, then the default platform integer precision <del> is used. Otherwise, the dtype is the same as that of ``a``. <del> out : ndarray, optional <del> Alternative output array in which to place the result. It must <del> have the same shape and buffer length as the expected output <del> but the type will be cast if necessary. <del> <del> Returns <del> ------- <del> cumprod : ndarray <del> A new array holding the result is returned unless out is specified, <del> in which case a reference to out is returned. <add> Refer to `numpy.cumprod` for full documentation. <ide> <ide> Notes <ide> ----- <ide> def cumprod(self, axis=None, dtype=None, out=None): <ide> Arithmetic is modular when using integer types, and no error is <ide> raised on overflow. <ide> <add> See Also <add> -------- <add> ndarray.cumprod : corresponding function for ndarrays <add> numpy.cumprod : equivalent function <ide> """ <ide> result = self.filled(1).cumprod(axis=axis, dtype=dtype, out=out) <ide> if out is not None: <ide> def cumprod(self, axis=None, dtype=None, out=None): <ide> result.__setmask__(self._mask) <ide> return result <ide> <del> def mean(self, axis=None, dtype=None, out=None): <add> def mean(self, axis=None, dtype=None, out=None, keepdims=np._NoValue): <ide> """ <del> Returns the average of the array elements. <add> Returns the average of the array elements along given axis. <ide> <del> Masked entries are ignored. <del> The average is taken over the flattened array by default, otherwise over <del> the specified axis. Refer to `numpy.mean` for the full documentation. <add> Masked entries are ignored, and result elements which are not <add> finite will be masked. <ide> <del> Parameters <del> ---------- <del> a : array_like <del> Array containing numbers whose mean is desired. If `a` is not an <del> array, a conversion is attempted. <del> axis : int, optional <del> Axis along which the means are computed. The default is to compute <del> the mean of the flattened array. <del> dtype : dtype, optional <del> Type to use in computing the mean. For integer inputs, the default <del> is float64; for floating point, inputs it is the same as the input <del> dtype. <del> out : ndarray, optional <del> Alternative output array in which to place the result. It must have <del> the same shape as the expected output but the type will be cast if <del> necessary. <del> <del> Returns <del> ------- <del> mean : ndarray, see dtype parameter above <del> If `out=None`, returns a new array containing the mean values, <del> otherwise a reference to the output array is returned. <add> Refer to `numpy.mean` for full documentation. <ide> <ide> See Also <ide> -------- <del> numpy.ma.mean : Equivalent function. <del> numpy.mean : Equivalent function on non-masked arrays. <add> ndarray.mean : corresponding function for ndarrays <add> numpy.mean : Equivalent function <ide> numpy.ma.average: Weighted average. <ide> <ide> Examples <ide> def mean(self, axis=None, dtype=None, out=None): <ide> 1.5 <ide> <ide> """ <add> kwargs = {} if keepdims is np._NoValue else {'keepdims': keepdims} <add> <ide> if self._mask is nomask: <del> result = super(MaskedArray, self).mean(axis=axis, dtype=dtype) <add> result = super(MaskedArray, self).mean(axis=axis, <add> dtype=dtype, **kwargs) <ide> else: <del> dsum = self.sum(axis=axis, dtype=dtype) <del> cnt = self.count(axis=axis) <add> dsum = self.sum(axis=axis, dtype=dtype, **kwargs) <add> cnt = self.count(axis=axis, **kwargs) <ide> if cnt.shape == () and (cnt == 0): <ide> result = masked <ide> else: <ide> def anom(self, axis=None, dtype=None): <ide> else: <ide> return (self - expand_dims(m, axis)) <ide> <del> def var(self, axis=None, dtype=None, out=None, ddof=0): <del> "" <add> def var(self, axis=None, dtype=None, out=None, ddof=0, <add> keepdims=np._NoValue): <add> """ <add> Returns the variance of the array elements along given axis. <add> <add> Masked entries are ignored, and result elements which are not <add> finite will be masked. <add> <add> Refer to `numpy.var` for full documentation. <add> <add> See Also <add> -------- <add> ndarray.var : corresponding function for ndarrays <add> numpy.var : Equivalent function <add> """ <add> kwargs = {} if keepdims is np._NoValue else {'keepdims': keepdims} <add> <ide> # Easy case: nomask, business as usual <ide> if self._mask is nomask: <del> return self._data.var(axis=axis, dtype=dtype, out=out, ddof=ddof) <add> return self._data.var(axis=axis, dtype=dtype, out=out, <add> ddof=ddof, **kwargs) <ide> # Some data are masked, yay! <del> cnt = self.count(axis=axis) - ddof <del> danom = self.anom(axis=axis, dtype=dtype) <add> cnt = self.count(axis=axis, **kwargs) - ddof <add> danom = self - self.mean(axis, dtype, keepdims=True) <ide> if iscomplexobj(self): <ide> danom = umath.absolute(danom) ** 2 <ide> else: <ide> danom *= danom <del> dvar = divide(danom.sum(axis), cnt).view(type(self)) <add> dvar = divide(danom.sum(axis, **kwargs), cnt).view(type(self)) <ide> # Apply the mask if it's not a scalar <ide> if dvar.ndim: <del> dvar._mask = mask_or(self._mask.all(axis), (cnt <= 0)) <add> dvar._mask = mask_or(self._mask.all(axis, **kwargs), (cnt <= 0)) <ide> dvar._update_from(self) <ide> elif getattr(dvar, '_mask', False): <ide> # Make sure that masked is returned when the scalar is masked. <ide> def var(self, axis=None, dtype=None, out=None, ddof=0): <ide> return dvar <ide> var.__doc__ = np.var.__doc__ <ide> <del> def std(self, axis=None, dtype=None, out=None, ddof=0): <del> "" <del> dvar = self.var(axis=axis, dtype=dtype, out=out, ddof=ddof) <add> def std(self, axis=None, dtype=None, out=None, ddof=0, <add> keepdims=np._NoValue): <add> """ <add> Returns the standard deviation of the array elements along given axis. <add> <add> Masked entries are ignored. <add> <add> Refer to `numpy.std` for full documentation. <add> <add> See Also <add> -------- <add> ndarray.std : corresponding function for ndarrays <add> numpy.std : Equivalent function <add> """ <add> kwargs = {} if keepdims is np._NoValue else {'keepdims': keepdims} <add> <add> dvar = self.var(axis, dtype, out, ddof, **kwargs) <ide> if dvar is not masked: <ide> if out is not None: <ide> np.power(out, 0.5, out=out, casting='unsafe') <ide> return out <ide> dvar = sqrt(dvar) <ide> return dvar <del> std.__doc__ = np.std.__doc__ <ide> <ide> def round(self, decimals=0, out=None): <ide> """ <del> Return an array rounded a to the given number of decimals. <add> Return each element rounded to the given number of decimals. <ide> <ide> Refer to `numpy.around` for full documentation. <ide> <ide> See Also <ide> -------- <add> ndarray.around : corresponding function for ndarrays <ide> numpy.around : equivalent function <del> <ide> """ <ide> result = self._data.round(decimals=decimals, out=out).view(type(self)) <ide> if result.ndim > 0: <ide> def round(self, decimals=0, out=None): <ide> if isinstance(out, MaskedArray): <ide> out.__setmask__(self._mask) <ide> return out <del> round.__doc__ = ndarray.round.__doc__ <ide> <ide> def argsort(self, axis=None, kind='quicksort', order=None, fill_value=None): <ide> """ <ide> def sort(self, axis=-1, kind='quicksort', order=None, <ide> self._mask.flat = tmp_mask <ide> return <ide> <del> def min(self, axis=None, out=None, fill_value=None): <add> def min(self, axis=None, out=None, fill_value=None, keepdims=np._NoValue): <ide> """ <ide> Return the minimum along a given axis. <ide> <ide> def min(self, axis=None, out=None, fill_value=None): <ide> Returns the minimum filling value for a given datatype. <ide> <ide> """ <add> kwargs = {} if keepdims is np._NoValue else {'keepdims': keepdims} <add> <ide> _mask = self._mask <del> newmask = _check_mask_axis(_mask, axis) <add> newmask = _check_mask_axis(_mask, axis, **kwargs) <ide> if fill_value is None: <ide> fill_value = minimum_fill_value(self) <ide> # No explicit output <ide> if out is None: <ide> result = self.filled(fill_value).min( <del> axis=axis, out=out).view(type(self)) <add> axis=axis, out=out, **kwargs).view(type(self)) <ide> if result.ndim: <ide> # Set the mask <ide> result.__setmask__(newmask) <ide> def min(self, axis=None, out=None, fill_value=None): <ide> result = masked <ide> return result <ide> # Explicit output <del> result = self.filled(fill_value).min(axis=axis, out=out) <add> result = self.filled(fill_value).min(axis=axis, out=out, **kwargs) <ide> if isinstance(out, MaskedArray): <ide> outmask = getattr(out, '_mask', nomask) <ide> if (outmask is nomask): <ide> def min(self, axis=None, out=None, fill_value=None): <ide> np.copyto(out, np.nan, where=newmask) <ide> return out <ide> <add> # unique to masked arrays <ide> def mini(self, axis=None): <ide> """ <ide> Return the array minimum along the specified axis. <ide> def mini(self, axis=None): <ide> else: <ide> return minimum.reduce(self, axis) <ide> <del> def max(self, axis=None, out=None, fill_value=None): <add> def max(self, axis=None, out=None, fill_value=None, keepdims=np._NoValue): <ide> """ <ide> Return the maximum along a given axis. <ide> <ide> def max(self, axis=None, out=None, fill_value=None): <ide> Returns the maximum filling value for a given datatype. <ide> <ide> """ <add> kwargs = {} if keepdims is np._NoValue else {'keepdims': keepdims} <add> <ide> _mask = self._mask <del> newmask = _check_mask_axis(_mask, axis) <add> newmask = _check_mask_axis(_mask, axis, **kwargs) <ide> if fill_value is None: <ide> fill_value = maximum_fill_value(self) <ide> # No explicit output <ide> if out is None: <ide> result = self.filled(fill_value).max( <del> axis=axis, out=out).view(type(self)) <add> axis=axis, out=out, **kwargs).view(type(self)) <ide> if result.ndim: <ide> # Set the mask <ide> result.__setmask__(newmask) <ide> def max(self, axis=None, out=None, fill_value=None): <ide> result = masked <ide> return result <ide> # Explicit output <del> result = self.filled(fill_value).max(axis=axis, out=out) <add> result = self.filled(fill_value).max(axis=axis, out=out, **kwargs) <ide> if isinstance(out, MaskedArray): <ide> outmask = getattr(out, '_mask', nomask) <ide> if (outmask is nomask): <ide> def __init__(self): <ide> self.compare = greater <ide> self.fill_value_func = maximum_fill_value <ide> <add>def min(obj, axis=None, out=None, fill_value=None, keepdims=np._NoValue): <add> kwargs = {} if keepdims is np._NoValue else {'keepdims': keepdims} <ide> <del>def min(obj, axis=None, out=None, fill_value=None): <ide> try: <del> return obj.min(axis=axis, fill_value=fill_value, out=out) <add> return obj.min(axis=axis, fill_value=fill_value, out=out, **kwargs) <ide> except (AttributeError, TypeError): <del> # If obj doesn't have a min method or if the method doesn't accept <del> # a fill_value argument <del> return asanyarray(obj).min(axis=axis, fill_value=fill_value, out=out) <add> # If obj doesn't have a min method, or if the method doesn't accept a <add> # fill_value argument <add> return asanyarray(obj).min(axis=axis, fill_value=fill_value, <add> out=out, **kwargs) <ide> min.__doc__ = MaskedArray.min.__doc__ <ide> <add>def max(obj, axis=None, out=None, fill_value=None, keepdims=np._NoValue): <add> kwargs = {} if keepdims is np._NoValue else {'keepdims': keepdims} <ide> <del>def max(obj, axis=None, out=None, fill_value=None): <ide> try: <del> return obj.max(axis=axis, fill_value=fill_value, out=out) <add> return obj.max(axis=axis, fill_value=fill_value, out=out, **kwargs) <ide> except (AttributeError, TypeError): <del> # If obj doesn't have a max method, or if the method doesn't accept <del> # a fill_value argument <del> return asanyarray(obj).max(axis=axis, fill_value=fill_value, out=out) <add> # If obj doesn't have a max method, or if the method doesn't accept a <add> # fill_value argument <add> return asanyarray(obj).max(axis=axis, fill_value=fill_value, <add> out=out, **kwargs) <ide> max.__doc__ = MaskedArray.max.__doc__ <ide> <ide> <ide> def __call__(self, a, *args, **params): <ide> trace = _frommethod('trace') <ide> var = _frommethod('var') <ide> <add>count = _frommethod('count') <ide> <ide> def take(a, indices, axis=None, out=None, mode='raise'): <ide> """ <ide> def argsort(a, axis=None, kind='quicksort', order=None, fill_value=None): <ide> return d.argsort(axis, kind=kind, order=order) <ide> argsort.__doc__ = MaskedArray.argsort.__doc__ <ide> <del> <del>def argmin(a, axis=None, fill_value=None): <del> "Function version of the eponymous method." <del> if fill_value is None: <del> fill_value = default_fill_value(a) <del> d = filled(a, fill_value) <del> return d.argmin(axis=axis) <del>argmin.__doc__ = MaskedArray.argmin.__doc__ <del> <del> <del>def argmax(a, axis=None, fill_value=None): <del> "Function version of the eponymous method." <del> if fill_value is None: <del> fill_value = default_fill_value(a) <del> try: <del> fill_value = -fill_value <del> except: <del> pass <del> d = filled(a, fill_value) <del> return d.argmax(axis=axis) <del>argmax.__doc__ = MaskedArray.argmax.__doc__ <add>argmin = _frommethod('argmin') <add>argmax = _frommethod('argmax') <ide> <ide> <ide> def sort(a, axis=-1, kind='quicksort', order=None, endwith=True, fill_value=None): <ide> def concatenate(arrays, axis=0): <ide> return data <ide> <ide> <del>def count(a, axis=None): <del> if isinstance(a, MaskedArray): <del> return a.count(axis) <del> return masked_array(a, copy=False).count(axis) <del>count.__doc__ = MaskedArray.count.__doc__ <del> <del> <ide> def diag(v, k=0): <ide> """ <ide> Extract a diagonal or construct a diagonal array.
1
Javascript
Javascript
remove error() and just throw
b348347dadfa0abe3442ff0bdbc52d8077621e95
<ide><path>src/Angular.js <ide> var $boolean = 'boolean', <ide> slice = [].slice, <ide> push = [].push, <ide> toString = Object.prototype.toString, <del> error = window[$console] <del> ? bind(window[$console], window[$console]['error'] || noop) <del> : noop, <ide> <ide> /** @name angular */ <ide> angular = window.angular || (window.angular = {}), <ide><path>src/JSON.js <ide> function fromJson(json, useNative) { <ide> <ide> var obj; <ide> <del> try { <del> if (useNative && window.JSON && window.JSON.parse) { <del> obj = JSON.parse(json); <del> } else { <del> obj = parseJson(json, true)(); <del> } <del> return transformDates(obj); <del> } catch (e) { <del> error("fromJson error: ", json, e); <del> throw e; <add> if (useNative && window.JSON && window.JSON.parse) { <add> obj = JSON.parse(json); <add> } else { <add> obj = parseJson(json, true)(); <ide> } <add> return transformDates(obj); <ide> <ide> // TODO make forEach optionally recursive and remove this function <ide> // TODO(misko): remove this once the $http service is checked in.
2
Javascript
Javascript
fix a typo
7917709782537a696b6bd36e72ee57318bd0edd3
<ide><path>src/renderers/testing/__tests__/ReactShallowRenderer-test.js <ide> let createRenderer; <ide> let PropTypes; <ide> let React; <ide> <del>describe('ReactTestUtils', () => { <add>describe('ReactShallowRenderer', () => { <ide> beforeEach(() => { <ide> createRenderer = require('react-test-renderer/shallow').createRenderer; <ide> PropTypes = require('prop-types');
1
Text
Text
add joyeecheung to collaborators
f44f509da42b2bbdb00910ac70721da80c083330
<ide><path>README.md <ide> more information about the governance of the Node.js project, see <ide> **João Reis** &lt;reis@janeasystems.com&gt; <ide> * [joshgav](https://github.com/joshgav) - <ide> **Josh Gavant** &lt;josh.gavant@outlook.com&gt; <add>* [joyeecheung](https://github.com/joyeecheung) - <add>**Joyee Cheung** &lt;joyeec9h3@gmail.com&gt; <ide> * [julianduque](https://github.com/julianduque) - <ide> **Julian Duque** &lt;julianduquej@gmail.com&gt; <ide> * [JungMinu](https://github.com/JungMinu) -
1
Ruby
Ruby
fix typo securetoken for schema sample [ci skip]
4bed3bc0871ae3f28270f171915544b768018776
<ide><path>activerecord/lib/active_record/secure_token.rb <ide> module SecureToken <ide> module ClassMethods <ide> # Example using has_secure_token <ide> # <del> # # Schema: User(toke:string, auth_token:string) <add> # # Schema: User(token:string, auth_token:string) <ide> # class User < ActiveRecord::Base <ide> # has_secure_token <ide> # has_secure_token :auth_token
1
Text
Text
add brewsci org taps
fa763216200a2ae1c36f5ec4cbf3d4f17d5053ff
<ide><path>docs/Interesting-Taps-and-Forks.md <ide> You can be added as a maintainer for one of the Homebrew organization taps and a <ide> <ide> * [osrf/simulation](https://github.com/osrf/homebrew-simulation): Tools for robotics simulation. <ide> <add>* [brewsci/bio](https://github.com/brewsci/homebrew-bio): Bioinformatics formulae. <add> <add>* [brewsci/science](https://github.com/brewsci/homebrew-science): Software tailored to scientific endeavours. <add> <ide> ## Interesting forks <ide> <ide> * [mistydemeo/tigerbrew](https://github.com/mistydemeo/tigerbrew): Experimental Tiger PowerPC version
1
Ruby
Ruby
use kwags to make the argument meaning explicit
003c0cda26e3fa9c3362ac7e5b5faa6236b44aad
<ide><path>actionview/lib/action_view/helpers/tags/label.rb <ide> def translation <ide> method_and_value = @tag_value.present? ? "#{@method_name}.#{@tag_value}" : @method_name <ide> <ide> content ||= Translator <del> .new(object, @object_name, method_and_value, "helpers.label") <add> .new(object, @object_name, method_and_value, scope: "helpers.label") <ide> .call <ide> content ||= @method_name.humanize <ide> <ide><path>actionview/lib/action_view/helpers/tags/placeholderable.rb <ide> def initialize(*) <ide> method_and_value = tag_value.is_a?(TrueClass) ? @method_name : "#{@method_name}.#{tag_value}" <ide> <ide> placeholder ||= Tags::Translator <del> .new(object, @object_name, method_and_value, "helpers.placeholder") <add> .new(object, @object_name, method_and_value, scope: "helpers.placeholder") <ide> .call <ide> placeholder ||= @method_name.humanize <ide> @options[:placeholder] = placeholder <ide><path>actionview/lib/action_view/helpers/tags/translator.rb <ide> module ActionView <ide> module Helpers <ide> module Tags # :nodoc: <ide> class Translator # :nodoc: <del> def initialize(object, object_name, method_and_value, i18n_scope) <add> def initialize(object, object_name, method_and_value, scope:) <ide> @object_name = object_name.gsub(/\[(.*)_attributes\]\[\d+\]/, '.\1') <ide> @method_and_value = method_and_value <del> @i18n_scope = i18n_scope <add> @scope = scope <ide> @model = object.respond_to?(:to_model) ? object.to_model : object <ide> end <ide> <ide> def call <del> translated_attribute = I18n.t("#{object_name}.#{method_and_value}", default: i18n_default, scope: i18n_scope).presence <add> translated_attribute = I18n.t("#{object_name}.#{method_and_value}", default: i18n_default, scope: scope).presence <ide> translated_attribute || human_attribute_name <ide> end <ide> <ide> private <ide> <del> attr_reader :object_name, :method_and_value, :i18n_scope, :model <add> attr_reader :object_name, :method_and_value, :scope, :model <ide> <ide> def i18n_default <ide> if model
3
Javascript
Javascript
stabilize tests on windows
372b85df4bc45cb4fb2dad0a5970204207ce1eb0
<ide><path>test/async-hooks/test-emit-before-after.js <ide> switch (process.argv[2]) { <ide> } <ide> <ide> const c1 = spawnSync(process.execPath, [__filename, 'test_invalid_async_id']); <del>assert.strictEqual(c1.stderr.toString().split('\n')[0], <add>assert.strictEqual(c1.stderr.toString().split(/[\r\n]+/g)[0], <ide> 'Error: before(): asyncId or triggerAsyncId is less than ' + <ide> 'zero (asyncId: -1, triggerAsyncId: -1)'); <ide> assert.strictEqual(c1.status, 1); <ide> <ide> const c2 = spawnSync(process.execPath, [__filename, 'test_invalid_trigger_id']); <del>assert.strictEqual(c2.stderr.toString().split('\n')[0], <add>assert.strictEqual(c2.stderr.toString().split(/[\r\n]+/g)[0], <ide> 'Error: before(): asyncId or triggerAsyncId is less than ' + <ide> 'zero (asyncId: 1, triggerAsyncId: -1)'); <ide> assert.strictEqual(c2.status, 1); <ide><path>test/async-hooks/test-graph.signal.js <ide> 'use strict'; <ide> <ide> const common = require('../common'); <add>if (common.isWindows) { <add> common.skip('no signals on Windows'); <add> return; <add>} <add> <ide> const initHooks = require('./init-hooks'); <ide> const verifyGraph = require('./verify-graph'); <ide> const exec = require('child_process').exec; <ide><path>test/async-hooks/test-signalwrap.js <ide> 'use strict'; <del> <ide> const common = require('../common'); <add> <add>if (common.isWindows) return common.skip('no signals in Windows'); <add> <ide> const assert = require('assert'); <ide> const initHooks = require('./init-hooks'); <ide> const { checkInvocations } = require('./hook-checks'); <ide><path>test/async-hooks/test-ttywrap.readstream.js <ide> 'use strict'; <del> <ide> const common = require('../common'); <ide> const assert = require('assert'); <add> <add>// general hook test setup <ide> const tick = require('./tick'); <ide> const initHooks = require('./init-hooks'); <ide> const { checkInvocations } = require('./hook-checks'); <ide> <ide> const hooks = initHooks(); <ide> hooks.enable(); <ide> <del>const ReadStream = require('tty').ReadStream; <del>const ttyStream = new ReadStream(0); <del> <del>const as = hooks.activitiesOfTypes('TTYWRAP'); <del>assert.strictEqual(as.length, 1); <del>const tty = as[0]; <add>// test specific setup <add>const { ReadStream } = require('tty'); <add>const checkInitOpts = { init: 1 }; <add>const checkEndedOpts = { init: 1, before: 1, after: 1, destroy: 1 }; <add> <add>// test code <add>// <add>// listen to stdin except on Windows <add>const targetFD = common.isWindows ? 1 : 0; <add>const ttyStream = new ReadStream(targetFD); <add>const activities = hooks.activitiesOfTypes('TTYWRAP'); <add>assert.strictEqual(activities.length, 1); <add>const tty = activities[0]; <ide> assert.strictEqual(tty.type, 'TTYWRAP'); <ide> assert.strictEqual(typeof tty.uid, 'number'); <ide> assert.strictEqual(typeof tty.triggerAsyncId, 'number'); <del>checkInvocations(tty, { init: 1 }, 'when tty created'); <del> <del>ttyStream.end(common.mustCall(onend)); <del> <del>checkInvocations(tty, { init: 1 }, 'when tty.end() was invoked '); <del> <del>function onend() { <del> tick(2, common.mustCall(() => <del> checkInvocations( <del> tty, { init: 1, before: 1, after: 1, destroy: 1 }, <del> 'when tty ended ') <del> )); <del>} <del> <del>process.on('exit', onexit); <del> <del>function onexit() { <add>checkInvocations(tty, checkInitOpts, 'when tty created'); <add>const delayedOnCloseHandler = common.mustCall(() => { <add> checkInvocations(tty, checkEndedOpts, 'when tty ended'); <add>}); <add>ttyStream.on('error', (err) => assert.fail(err)); <add>ttyStream.on('close', common.mustCall(() => <add> tick(2, delayedOnCloseHandler) <add>)); <add>ttyStream.destroy(); <add>checkInvocations(tty, checkInitOpts, 'when tty.end() was invoked'); <add> <add>process.on('exit', () => { <ide> hooks.disable(); <ide> hooks.sanityCheck('TTYWRAP'); <del> checkInvocations(tty, { init: 1, before: 1, after: 1, destroy: 1 }, <del> 'when process exits'); <del>} <add> checkInvocations(tty, checkEndedOpts, 'when process exits'); <add>});
4
Python
Python
remove hardcoded page number
fe5d93c8cbc5f3a9b1b6715208c70f485be68bdf
<ide><path>rest_framework/generics.py <ide> def paginate_queryset(self, queryset): <ide> else: <ide> raise NotFound(_("Choose a valid page number. Page numbers must be a whole number, or must be the string 'last'.")) <ide> <del> page_number = -1 <ide> try: <ide> page = paginator.page(page_number) <ide> except InvalidPage as exc:
1
Ruby
Ruby
use mt_cpu instead of n for parallel test runs`
1a41a741cf5bc1b5d4038f999bacaec2a7b297dc
<ide><path>actionpack/test/abstract_unit.rb <ide> if ENV["TRAVIS"] <ide> PROCESS_COUNT = 0 <ide> else <del> PROCESS_COUNT = (ENV["N"] || 4).to_i <add> PROCESS_COUNT = (ENV["MT_CPU"] || 4).to_i <ide> end <ide> <ide> require "active_support/testing/autorun"
1
Python
Python
add unit test
04edfab3381fdbf6ad3ccca928dd69e7523bec9c
<ide><path>libcloud/test/compute/test_ecs.py <ide> def _create_node_CreateInstance(self, method, url, body, headers): <ide> 'InternetMaxBandwidthIn': '200', <ide> 'HostName': 'hostname', <ide> 'Password': 'password', <del> 'IoOptimized': 'true', <add> 'IoOptimized': 'optimized', <ide> 'SystemDisk.Category': 'cloud', <ide> 'SystemDisk.DiskName': 'root', <ide> 'SystemDisk.Description': 'sys',
1
Ruby
Ruby
remove code for ruby < 1.8.7
b7ea64a86c03becdbdd417cc79cc1d2ad20a30bc
<ide><path>activesupport/lib/active_support/core_ext/benchmark.rb <ide> require 'benchmark' <ide> <ide> class << Benchmark <del> # Earlier Ruby had a slower implementation. <del> if RUBY_VERSION < '1.8.7' <del> remove_method :realtime <del> <del> def realtime <del> r0 = Time.now <del> yield <del> r1 = Time.now <del> r1.to_f - r0.to_f <del> end <del> end <del> <ide> def ms <ide> 1000 * realtime { yield } <ide> end
1
Python
Python
record extra info in rackspace
701316422a5965bfa2cf5e97942f3f50d6d601a9
<ide><path>libcloud/drivers/rackspace.py <ide> def request(self, action, params={}, data='', headers={}, method='GET'): <ide> <ide> <ide> class RackspaceNodeDriver(NodeDriver): <del> <add> """Rackspace node driver. <add> <add> Extra node attributes: <add> password: root password, available after create. <add> hostId: represents the host your cloud server runs on <add> imageId: id of image <add> flavorId: id of flavor <add> """ <ide> connectionCls = RackspaceConnection <ide> type = Provider.RACKSPACE <ide> name = 'Rackspace' <ide> def get_ips(el): <ide> state=el.get('status'), <ide> public_ip=public_ip, <ide> private_ip=private_ip, <del> driver=self.connection.driver) <add> driver=self.connection.driver, <add> extra={ <add> 'password': el.get('adminPass'), <add> 'hostId': el.get('hostId'), <add> 'imageId': el.get('imageId'), <add> 'flavorId': el.get('flavorId'), <add> }) <ide> return n <ide> <ide> def to_sizes(self, object): <ide><path>test/test_rackspace.py <ide> def test_list_nodes(self): <ide> node = ret[0] <ide> self.assertTrue(node.public_ip[0]) <ide> self.assertTrue(node.private_ip[0]) <add> self.assertEqual(node.extra.get('flavorId'), '1') <add> self.assertEqual(node.extra.get('imageId'), '11') <ide> <ide> def test_list_sizes(self): <ide> ret = self.driver.list_sizes() <ide> def test_create_node(self): <ide> size = NodeSize(1, '256 slice', None, None, None, None, driver=self.driver) <ide> node = self.driver.create_node('racktest', image, size) <ide> self.assertEqual(node.name, 'racktest') <add> self.assertEqual(node.extra.get('password'), 'racktestvJq7d3') <ide> <ide> def test_reboot_node(self): <ide> node = Node(id=72258, name=None, state=None, public_ip=None, private_ip=None,
2
Javascript
Javascript
add dependency for dependecies on sub getirqueue
0f6bf30228bd68c01a438a6997b9aecc9f24b067
<ide><path>pdf.js <ide> var PartialEvaluator = (function() { <ide> }; <ide> <ide> constructor.prototype = { <del> getIRQueue: function(stream, xref, resources, queue, handler, uniquePrefix) { <add> getIRQueue: function(stream, xref, resources, queue, handler, <add> uniquePrefix, dependency) { <ide> <ide> function insertDependency(depList) { <ide> fnArray.push("dependency"); <ide> argsArray.push(depList); <add> for (var i = 0; i < depList.length; i++) { <add> dependency.push(depList); <add> } <ide> } <ide> <ide> function buildPaintImageXObject(image, inline) { <ide> var PartialEvaluator = (function() { <ide> } <ide> <ide> var fnArray = queue.fnArray, argsArray = queue.argsArray; <add> var dependency = dependency || []; <ide> <ide> resources = xref.fetchIfRef(resources) || new Dict(); <ide> var xobjs = xref.fetchIfRef(resources.get('XObject')) || new Dict(); <ide> var PartialEvaluator = (function() { <ide> <ide> // Type1 is TilingPattern <ide> if (typeNum == 1) { <del> // TODO: Add dependency here. <ide> // Create an IR of the pattern code. <add> var depIdx = dependency.length; <ide> var codeIR = this.getIRQueue(pattern, xref, <del> dict.get('Resources'), {}, handler, uniquePrefix); <add> dict.get('Resources'), {}, handler, <add> uniquePrefix, dependency); <add> <add> // Add the dependencies that are required to execute the <add> // codeIR. <add> insertDependency(dependency.slice(depIdx)); <ide> <ide> args = TilingPattern.getIR(codeIR, dict, args); <ide> } <ide> var PartialEvaluator = (function() { <ide> argsArray.push([ matrix, bbox ]); <ide> <ide> // This adds the IRQueue of the xObj to the current queue. <add> var depIdx = dependency.length; <add> <ide> this.getIRQueue(xobj, xref, xobj.dict.get('Resources'), queue, <del> handler, uniquePrefix); <add> handler, uniquePrefix, dependency); <ide> <add> // Add the dependencies that are required to execute the <add> // codeIR. <add> insertDependency(dependency.slice(depIdx)); <ide> <ide> fn = "paintFormXObjectEnd"; <ide> args = []; <ide><path>worker.js <ide> var Promise = (function() { <ide> }, <ide> <ide> then: function(callback) { <add> if (!callback) { <add> throw "Requiring callback" + this.name; <add> } <add> <ide> // If the promise is already resolved, call the callback directly. <ide> if (this.isResolved) { <ide> var data = this.data;
2
Javascript
Javascript
add error listener to test-net-pingpong
462a8f8652dafaf01f05623dd311e57e226cead4
<ide><path>test/simple/test-net-pingpong.js <ide> function pingPongTest (port, host) { <ide> socket.close(); <ide> }); <ide> <add> socket.addListener("error", function (e) { <add> throw e; <add> }); <add> <ide> socket.addListener("close", function () { <add> puts('server socket closed'); <ide> assert.equal(false, socket.writable); <ide> assert.equal(false, socket.readable); <ide> socket.server.close(); <ide> function pingPongTest (port, host) { <ide> }); <ide> <ide> client.addListener("close", function () { <add> puts('client closed'); <ide> assert.equal(N+1, count); <ide> assert.equal(true, sent_final_ping); <ide> tests_run += 1; <ide> }); <add> <add> client.addListener("error", function (e) { <add> throw e; <add> }); <ide> }); <ide> <ide> server.listen(port, host);
1
Javascript
Javascript
ignore tests when built without openssl cli
442d2d0cdec2dba97341ffd7dff7f7673f3dc242
<ide><path>test/common.js <ide> // USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> <ide> var path = require('path'); <add>var fs = require('fs'); <ide> var assert = require('assert'); <ide> <ide> exports.testDir = path.dirname(__filename); <ide> if (process.platform === 'win32') { <ide> exports.PIPE = exports.tmpDir + '/test.sock'; <ide> exports.opensslCli = path.join(process.execPath, '..', 'openssl-cli'); <ide> } <add>if (!fs.existsSync(exports.opensslCli)) <add> exports.opensslCli = false; <ide> <ide> var util = require('util'); <ide> for (var i in util) exports[i] = util[i]; <ide><path>test/pummel/test-https-ci-reneg-attack.js <ide> var tls = require('tls'); <ide> var https = require('https'); <ide> var fs = require('fs'); <ide> <add>if (!common.opensslCli) { <add> console.error('Skipping because node compiled without OpenSSL CLI.'); <add> process.exit(0); <add>} <add> <ide> // renegotiation limits to test <ide> var LIMITS = [0, 1, 2, 3, 5, 10, 16]; <ide> <ide><path>test/pummel/test-tls-ci-reneg-attack.js <ide> var spawn = require('child_process').spawn; <ide> var tls = require('tls'); <ide> var fs = require('fs'); <ide> <add>if (!common.opensslCli) { <add> console.error('Skipping because node compiled without OpenSSL CLI.'); <add> process.exit(0); <add>} <add> <ide> // renegotiation limits to test <ide> var LIMITS = [0, 1, 2, 3, 5, 10, 16]; <ide> <ide><path>test/pummel/test-tls-securepair-client.js <ide> // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR <ide> // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE <ide> // USE OR OTHER DEALINGS IN THE SOFTWARE. <add>// <add> <add>var common = require('../common'); <ide> <del>if (!process.versions.openssl) { <del> console.error('Skipping because node compiled without OpenSSL.'); <add>if (!common.opensslCli) { <add> console.error('Skipping because node compiled without OpenSSL CLI.'); <ide> process.exit(0); <ide> } <ide> <del>var common = require('../common'); <ide> var join = require('path').join; <ide> var net = require('net'); <ide> var assert = require('assert'); <ide><path>test/pummel/test-tls-session-timeout.js <ide> // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE <ide> // USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> <del>if (!process.versions.openssl) { <del> console.error('Skipping because node compiled without OpenSSL.'); <add>var common = require('../common'); <add> <add>if (!common.opensslCli) { <add> console.error('Skipping because node compiled without OpenSSL CLI.'); <ide> process.exit(0); <ide> } <add> <ide> doTest(); <ide> <ide> // This test consists of three TLS requests -- <ide> doTest(); <ide> // that we used has expired by now. <ide> <ide> function doTest() { <del> var common = require('../common'); <ide> var assert = require('assert'); <ide> var tls = require('tls'); <ide> var fs = require('fs'); <ide><path>test/simple/test-https-foafssl.js <ide> // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE <ide> // USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> <del>if (!process.versions.openssl) { <del> console.error('Skipping because node compiled without OpenSSL.'); <add>var common = require('../common'); <add> <add>if (!common.opensslCli) { <add> console.error('Skipping because node compiled without OpenSSL CLI.'); <ide> process.exit(0); <ide> } <ide> <del>var common = require('../common'); <ide> var assert = require('assert'); <ide> var join = require('path').join; <ide> <ide><path>test/simple/test-tls-ecdh-disable.js <ide> // USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> <ide> var common = require('../common'); <add> <add>if (!common.opensslCli) { <add> console.error('Skipping because node compiled without OpenSSL CLI.'); <add> process.exit(0); <add>} <add> <ide> var assert = require('assert'); <ide> var exec = require('child_process').exec; <ide> var tls = require('tls'); <ide><path>test/simple/test-tls-ecdh.js <ide> // USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> <ide> var common = require('../common'); <add> <add>if (!common.opensslCli) { <add> console.error('Skipping because node compiled without OpenSSL CLI.'); <add> process.exit(0); <add>} <add> <ide> var assert = require('assert'); <ide> var exec = require('child_process').exec; <ide> var tls = require('tls'); <ide><path>test/simple/test-tls-securepair-server.js <ide> // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE <ide> // USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> <del>if (!process.versions.openssl) { <del> console.error('Skipping because node compiled without OpenSSL.'); <add>var common = require('../common'); <add> <add>if (!common.opensslCli) { <add> console.error('Skipping because node compiled without OpenSSL CLI.'); <ide> process.exit(0); <ide> } <ide> <del> <del>var common = require('../common'); <ide> var assert = require('assert'); <ide> <ide> var join = require('path').join; <ide><path>test/simple/test-tls-server-verify.js <ide> // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE <ide> // USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> <add>var common = require('../common'); <ide> <del> <del> <del>if (!process.versions.openssl) { <del> console.error('Skipping because node compiled without OpenSSL.'); <add>if (!common.opensslCli) { <add> console.error('Skipping because node compiled without OpenSSL CLI.'); <ide> process.exit(0); <ide> } <ide> <ide> var testCases = <ide> ]; <ide> <ide> <del>var common = require('../common'); <ide> var constants = require('constants'); <ide> var assert = require('assert'); <ide> var fs = require('fs'); <ide><path>test/simple/test-tls-session-cache.js <ide> // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE <ide> // USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> <del>if (!process.versions.openssl) { <del> console.error('Skipping because node compiled without OpenSSL.'); <add>var common = require('../common'); <add> <add>if (!common.opensslCli) { <add> console.error('Skipping because node compiled without OpenSSL CLI.'); <ide> process.exit(0); <ide> } <ide> <ide> doTest({ tickets: false } , function() { <ide> }); <ide> <ide> function doTest(testOptions, callback) { <del> var common = require('../common'); <ide> var assert = require('assert'); <ide> var tls = require('tls'); <ide> var fs = require('fs'); <ide><path>test/simple/test-tls-set-ciphers.js <ide> // USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> <ide> var common = require('../common'); <add> <add>if (!common.opensslCli) { <add> console.error('Skipping because node compiled without OpenSSL CLI.'); <add> process.exit(0); <add>} <add> <ide> var assert = require('assert'); <ide> var exec = require('child_process').exec; <ide> var tls = require('tls');
12
PHP
PHP
apply fixes from styleci
9ede7d34f97932c3f7f0c4dae21ddea16621aefc
<ide><path>tests/View/Blade/BladeComponentTagCompilerTest.php <ide> use Illuminate\Container\Container; <ide> use Illuminate\Contracts\Foundation\Application; <ide> use Illuminate\Contracts\View\Factory; <del>use Illuminate\Filesystem\Filesystem; <ide> use Illuminate\View\Compilers\BladeCompiler; <ide> use Illuminate\View\Compilers\ComponentTagCompiler; <ide> use Illuminate\View\Component;
1
Javascript
Javascript
add codeframe to each warning and error in logbox
fa4f23e4e8c45b6882a323caebef294ac69cfbf2
<ide><path>Libraries/Core/Devtools/symbolicateStackTrace.js <ide> let fetch; <ide> <ide> import type {StackFrame} from '../NativeExceptionsManager'; <ide> <add>export type CodeFrame = $ReadOnly<{| <add> content: string, <add> location: { <add> row: number, <add> column: number, <add> }, <add> fileName: string, <add>|}>; <add> <add>export type SymbolicatedStackTrace = $ReadOnly<{| <add> stack: Array<StackFrame>, <add> codeFrame: ?CodeFrame, <add>|}>; <add> <ide> function isSourcedFromDisk(sourcePath: string): boolean { <ide> return !/^http/.test(sourcePath) && /[\\/]/.test(sourcePath); <ide> } <ide> <ide> async function symbolicateStackTrace( <ide> stack: Array<StackFrame>, <del>): Promise<Array<StackFrame>> { <add>): Promise<SymbolicatedStackTrace> { <ide> // RN currently lazy loads whatwg-fetch using a custom fetch module, which, <ide> // when called for the first time, requires and re-exports 'whatwg-fetch'. <ide> // However, when a dependency of the project tries to require whatwg-fetch <ide> async function symbolicateStackTrace( <ide> method: 'POST', <ide> body: JSON.stringify({stack: stackCopy}), <ide> }); <del> const json = await response.json(); <del> return json.stack; <add> return await response.json(); <ide> } <ide> <ide> module.exports = symbolicateStackTrace; <ide><path>Libraries/Core/ExceptionsManager.js <ide> function reportException(e: ExtendedError, isFatal: boolean) { <ide> } <ide> const symbolicateStackTrace = require('./Devtools/symbolicateStackTrace'); <ide> symbolicateStackTrace(stack) <del> .then(prettyStack => { <add> .then(({stack: prettyStack}) => { <ide> if (prettyStack) { <ide> NativeExceptionsManager.updateExceptionMessage( <ide> data.message, <ide><path>Libraries/Core/__tests__/ExceptionsManager-test.js <ide> describe('ExceptionsManager', () => { <ide> }; <ide> }); <ide> // Make symbolication a no-op. <del> jest.mock('../Devtools/symbolicateStackTrace', () => { <del> return async function symbolicateStackTrace(stack) { <del> return stack; <del> }; <del> }); <add> jest.mock( <add> '../Devtools/symbolicateStackTrace', <add> () => <add> async function symbolicateStackTrace(stack) { <add> return {stack}; <add> }, <add> ); <ide> jest.spyOn(console, 'error').mockImplementation(() => {}); <ide> ReactFiberErrorDialog = require('../ReactFiberErrorDialog'); <ide> NativeExceptionsManager = require('../NativeExceptionsManager').default; <ide><path>Libraries/LogBox/Data/LogBoxLog.js <ide> class LogBoxLog { <ide> let aborted = false; <ide> <ide> if (this.symbolicated.status !== 'COMPLETE') { <del> const updateStatus = (error: ?Error, stack: ?Stack): void => { <add> const updateStatus = ( <add> error: ?Error, <add> stack: ?Stack, <add> codeFrame: ?CodeFrame, <add> ): void => { <ide> if (error != null) { <del> this.symbolicated = {error, stack: null, status: 'FAILED'}; <add> this.symbolicated = { <add> error, <add> stack: null, <add> status: 'FAILED', <add> }; <ide> } else if (stack != null) { <del> this.symbolicated = {error: null, stack, status: 'COMPLETE'}; <add> if (codeFrame) { <add> this.codeFrame = codeFrame; <add> } <add> <add> this.symbolicated = { <add> error: null, <add> stack, <add> status: 'COMPLETE', <add> }; <ide> } else { <del> this.symbolicated = {error: null, stack: null, status: 'PENDING'}; <add> this.symbolicated = { <add> error: null, <add> stack: null, <add> status: 'PENDING', <add> }; <ide> } <ide> if (!aborted) { <ide> if (callback != null) { <ide> class LogBoxLog { <ide> <ide> updateStatus(null, null); <ide> LogBoxSymbolication.symbolicate(this.stack).then( <del> stack => { <del> updateStatus(null, stack); <add> data => { <add> updateStatus(null, data?.stack, data?.codeFrame); <ide> }, <ide> error => { <ide> updateStatus(error, null); <ide><path>Libraries/LogBox/Data/LogBoxSymbolication.js <ide> import symbolicateStackTrace from '../../Core/Devtools/symbolicateStackTrace'; <ide> <ide> import type {StackFrame} from '../../Core/NativeExceptionsManager'; <add>import type {SymbolicatedStackTrace} from '../../Core/Devtools/symbolicateStackTrace'; <ide> <ide> export type Stack = Array<StackFrame>; <ide> <del>const cache: Map<Stack, Promise<Stack>> = new Map(); <add>const cache: Map<Stack, Promise<SymbolicatedStackTrace>> = new Map(); <ide> <ide> /** <ide> * Sanitize because sometimes, `symbolicateStackTrace` gives us invalid values. <ide> */ <del>const sanitize = (maybeStack: mixed): Stack => { <add>const sanitize = ({ <add> stack: maybeStack, <add> codeFrame, <add>}: SymbolicatedStackTrace): SymbolicatedStackTrace => { <ide> if (!Array.isArray(maybeStack)) { <ide> throw new Error('Expected stack to be an array.'); <ide> } <ide> const sanitize = (maybeStack: mixed): Stack => { <ide> collapse, <ide> }); <ide> } <del> return stack; <add> return {stack, codeFrame}; <ide> }; <ide> <ide> export function deleteStack(stack: Stack): void { <ide> cache.delete(stack); <ide> } <ide> <del>export function symbolicate(stack: Stack): Promise<Stack> { <add>export function symbolicate(stack: Stack): Promise<SymbolicatedStackTrace> { <ide> let promise = cache.get(stack); <ide> if (promise == null) { <ide> promise = symbolicateStackTrace(stack).then(sanitize); <ide><path>Libraries/LogBox/Data/__tests__/LogBoxLog-test.js <ide> 'use strict'; <ide> <ide> import type {StackFrame} from '../../../Core/NativeExceptionsManager'; <add>import type {SymbolicatedStackTrace} from '../../../Core/Devtools/symbolicateStackTrace'; <ide> <ide> jest.mock('../LogBoxSymbolication', () => { <ide> return {__esModule: true, symbolicate: jest.fn(), deleteStack: jest.fn()}; <ide> function getLogBoxLog() { <ide> function getLogBoxSymbolication(): {| <ide> symbolicate: JestMockFn< <ide> $ReadOnlyArray<Array<StackFrame>>, <del> Promise<Array<StackFrame>>, <add> Promise<SymbolicatedStackTrace>, <ide> >, <ide> |} { <ide> return (require('../LogBoxSymbolication'): any); <ide> describe('LogBoxLog', () => { <ide> beforeEach(() => { <ide> jest.resetModules(); <ide> <del> getLogBoxSymbolication().symbolicate.mockImplementation(async stack => <del> createStack(stack.map(frame => `S(${frame.methodName})`)), <del> ); <add> getLogBoxSymbolication().symbolicate.mockImplementation(async stack => ({ <add> stack: createStack(stack.map(frame => `S(${frame.methodName})`)), <add> codeFrame: null, <add> })); <ide> }); <ide> <ide> it('creates a LogBoxLog object', () => { <ide><path>Libraries/YellowBox/Data/YellowBoxSymbolication.js <ide> const symbolicateStackTrace = require('../../Core/Devtools/symbolicateStackTrace'); <ide> <ide> import type {StackFrame} from '../../Core/NativeExceptionsManager'; <add>import type {SymbolicatedStackTrace} from '../../Core/Devtools/symbolicateStackTrace'; <ide> <ide> type CacheKey = string; <ide> <ide> const getCacheKey = (stack: Stack): CacheKey => { <ide> /** <ide> * Sanitize because sometimes, `symbolicateStackTrace` gives us invalid values. <ide> */ <del>const sanitize = (maybeStack: mixed): Stack => { <add>const sanitize = (data: SymbolicatedStackTrace): Stack => { <add> const maybeStack = data?.stack; <ide> if (!Array.isArray(maybeStack)) { <ide> throw new Error('Expected stack to be an array.'); <ide> }
7
Mixed
Javascript
add support for appear and appear-active classes
f1e524b0b16b4645ae9e9d8bdfaee155f6d9ac66
<ide><path>docs/docs/10.1-animation.md <ide> You'll notice that when you try to remove an item `ReactCSSTransitionGroup` keep <ide> ``` <ide> <ide> ### Custom Classes ### <add> <ide> It is also possible to use custom class names for each of the steps in your transitions. Instead of passing a string into transitionName you can pass an object containing either the `enter` and `leave` class names, or an object containing the `enter`, `enter-active`, `leave-active`, and `leave` class names. If only the enter and leave classes are provided, the enter-active and leave-active classes will be determined by appending '-active' to the end of the class name. Here are two examples using custom classes: <ide> <ide> ```javascript <ide> It is also possible to use custom class names for each of the steps in your tran <ide> enter: 'enter', <ide> enterActive: 'enterActive', <ide> leave: 'leave', <del> leaveActive: 'leaveActive' <add> leaveActive: 'leaveActive', <add> appear: 'appear', <add> appearActive: 'appearActive' <ide> }> <ide> {item} <ide> </ReactCSSTransitionGroup> <ide> <ide> <ReactCSSTransitionGroup <ide> transitionName={ <ide> enter: 'enter', <del> leave: 'leave' <add> leave: 'leave', <add> appear: 'appear' <ide> }> <ide> {item2} <ide> </ReactCSSTransitionGroup> <ide><path>src/addons/transitions/ReactCSSTransitionGroup.js <ide> var ReactCSSTransitionGroup = React.createClass({ <ide> React.PropTypes.string, <ide> React.PropTypes.shape({ <ide> enter: React.PropTypes.string, <del> leave: React.PropTypes.string <add> leave: React.PropTypes.string, <add> active: React.PropTypes.string <ide> }), <ide> React.PropTypes.shape({ <ide> enter: React.PropTypes.string, <ide> enterActive: React.PropTypes.string, <ide> leave: React.PropTypes.string, <del> leaveActive: React.PropTypes.string <add> leaveActive: React.PropTypes.string, <add> appear: React.PropTypes.string, <add> appearActive: React.PropTypes.string <ide> }) <ide> ]).isRequired, <ide> transitionAppear: React.PropTypes.bool,
2
Python
Python
add some inline documentation
20921b7b131d640d5f70d97f61e95f63a191d706
<ide><path>tests/auto/keras/layers/test_recurrent.py <ide> <ide> <ide> def _runner(layer_class): <add> """ <add> All the recurrent layers share the same interface, so we can run through them with a single <add> function. <add> """ <ide> for weights in [None, [np.ones((input_dim, output_dim))]]: <ide> for ret_seq in [True, False]: <ide> layer = layer_class(input_dim, output_dim, return_sequences=ret_seq, weights=weights) <ide> def _runner(layer_class): <ide> <ide> for train in [True, False]: <ide> out = layer.get_output(train).eval() <add> # Make sure the output has the desired shape <ide> if ret_seq: <ide> assert(out.shape == (nb_samples, timesteps, output_dim)) <ide> else: <ide> def _runner(layer_class): <ide> <ide> <ide> class TestRNNS(unittest.TestCase): <add> """ <add> Test all the RNNs using a generic test runner function defined above. <add> """ <ide> def test_simple(self): <ide> _runner(recurrent.SimpleRNN) <ide>
1
Javascript
Javascript
promise late chain
1793ee1c80df5d76a660f4982aba01303410fdb7
<ide><path>src/node.js <ide> var eventsModule = createInternalModule('events', function (exports) { <ide> <ide> exports.Promise.prototype.addCallback = function (listener) { <ide> if (this.hasFired === 'success') { <del> return listener.apply(this, this._values); <add> listener.apply(this, this._values); <ide> } <ide> <ide> return this.addListener("success", listener); <ide><path>test/mjsunit/test-promise.js <ide> a.addErrback(function(error) { <ide> }); <ide> a.emitSuccess(TEST_VALUE); <ide> <del>a.addCallback(function(value) { <add>assert.ok(a.addCallback(function(value) { <ide> assert.equal(TEST_VALUE, value); <ide> expectedCallbacks.a2--; <del>}); <del>a.addErrback(function(error) { <add>})); <add>assert.ok(a.addErrback(function(error) { <ide> assert.notEqual(TEST_VALUE, error, 'late'); <del>}); <add>})); <ide> <ide> // Test regular & late errback binding <ide> var b = new Promise(); <ide> b.addErrback(function(value) { <ide> // Test late errback binding <ide> var c = new Promise(); <ide> c.emitError(TEST_VALUE); <del>c.addErrback(function(value) { <add>assert.ok(c.addErrback(function(value) { <ide> assert.equal(TEST_VALUE, value); <ide> expectedCallbacks.c1--; <del>}); <add>})); <ide> <ide> // Test errback exceptions <ide> var d = new Promise();
2
Text
Text
state the election types for plc and pl
ae7b547ab61768ed3e95d4c12272e034ce06afac
<ide><path>docs/Homebrew-Governance.md <ide> <ide> 1. The financial administration of Homebrew, organisation of the AGM, enforcement of the code of conduct and removal of members are performed by the PLC. The PLC will represent Homebrew in all dealings with OpenCollective. <ide> <del>2. The PLC consists of five members including the Project Leader. Committee members are elected by majority vote of Homebrew members. Each PLC member will serve a term of two years or until the member's successor is elected. Any sudden vacancy in the PLC will be filled by the usual procedure for electing PLC members at the next general meeting, typically the next AGM. <add>2. The PLC consists of five members including the Project Leader. Committee members are elected by Homebrew members in a [Meek Single Transferable Vote](https://en.wikipedia.org/wiki/Counting_single_transferable_votes#Meek) election using the Droop quota. Each PLC member will serve a term of two years or until the member's successor is elected. Any sudden vacancy in the PLC will be filled by the usual procedure for electing PLC members at the next general meeting, typically the next AGM. <ide> <ide> 3. Three weeks prior to the AGM, the PLC will nominate at least one candidate for each upcoming vacant seat. Any member may also nominate any other member as a candidate for the PLC at this time. <ide> <ide> <ide> 1. The Project Leader will represent Homebrew publicly, manage all day-to-day technical decisions, and resolve disputes related to the operation of Homebrew between maintainers, members, other contributors, and users. <ide> <del>2. The Project Leader will be elected annually by a majority vote of Homebrew members. The PLC will nominate at least one candidate for Project Leader. Any member may nominate a candidate, or self-nominate. Nominations must be announced to the membership three weeks before the AGM. <add>2. The Project Leader will be elected annually by Homebrew members in a [Schulze Condorcet method](https://en.wikipedia.org/wiki/Schulze_method) (aka 'beatpath') election. The PLC will nominate at least one candidate for Project Leader. Any member may nominate a candidate, or self-nominate. Nominations must be announced to the membership three weeks before the AGM. <ide> <ide> 3. Any vacancy of the Project Leader will be filled by appointment of the PLC. <ide>
1
Javascript
Javascript
accept truthy/falsy value for not
8e4c8423b5bb1ee477c2df9b34e86cef1d715754
<ide><path>lib/BasicEvaluatedExpression.js <ide> class BasicEvaluatedExpression { <ide> return Object.prototype.hasOwnProperty.call(this, "quasis"); <ide> } <ide> <add> isTruthy() { <add> return this.truthy; <add> } <add> <add> isFalsy() { <add> return this.falsy; <add> } <add> <ide> asBool() { <ide> if(this.truthy) return true; <ide> else if(this.falsy) return false; <ide><path>lib/Parser.js <ide> class Parser extends Tapable { <ide> if(!argument) return; <ide> if(argument.isBoolean()) { <ide> return new BasicEvaluatedExpression().setBoolean(!argument.bool).setRange(expr.range); <add> } else if(argument.isTruthy()) { <add> return new BasicEvaluatedExpression().setBoolean(false).setRange(expr.range); <add> } else if(argument.isFalsy()) { <add> return new BasicEvaluatedExpression().setBoolean(true).setRange(expr.range); <ide> } else if(argument.isString()) { <ide> return new BasicEvaluatedExpression().setBoolean(!argument.string).setRange(expr.range); <ide> } else if(argument.isNumber()) { <ide><path>test/configCases/plugins/define-plugin/index.js <ide> it("should not explode on recursive statements", function() { <ide> wurst; // <- is recursivly defined in config <ide> }).should.throw("suppe is not defined"); <ide> }); <add> <add>it("should evaluate composed expressions (issue 5100)", function() { <add> if(!module.hot && process.env.DEFINED_NESTED_KEY_STRING === "string") { <add> // ok <add> } else { <add> require("fail"); <add> } <add>})
3
Javascript
Javascript
fill domexception names
201460873d0709d16f4b37c32fa1b4ef505b999a
<ide><path>test/parallel/test-abortcontroller.js <ide> const { setTimeout: sleep } = require('timers/promises'); <ide> <ide> { <ide> // Test abortSignal.throwIfAborted() <del> throws(() => AbortSignal.abort().throwIfAborted(), { code: 20 }); <add> throws(() => AbortSignal.abort().throwIfAborted(), { <add> code: 20, <add> name: 'AbortError', <add> }); <ide> <ide> // Does not throw because it's not aborted. <ide> const ac = new AbortController(); <ide><path>test/parallel/test-filehandle-readablestream.js <ide> const check = readFileSync(__filename, { encoding: 'utf8' }); <ide> const mc = new MessageChannel(); <ide> mc.port1.onmessage = common.mustNotCall(); <ide> assert.throws(() => mc.port2.postMessage(file, [file]), { <del> code: 25 // DataCloneError <add> code: 25, <add> name: 'DataCloneError', <ide> }); <ide> mc.port1.close(); <ide> await file.close(); <ide><path>test/parallel/test-fs-promises-file-handle-read-worker.js <ide> if (isMainThread || !workerData) { <ide> }); <ide> }, { <ide> code: 25, <add> name: 'DataCloneError', <ide> }); <ide> } finally { <ide> await handle.close(); <ide><path>test/parallel/test-webcrypto-random.js <ide> for (const ctor of intTypedConstructors) { <ide> } <ide> <ide> if (kData !== undefined) { <del> assert.throws(() => webcrypto.getRandomValues(kData), { <del> code: 22 <del> }); <add> assert.throws( <add> () => webcrypto.getRandomValues(kData), <add> { name: 'QuotaExceededError', code: 22 }, <add> ); <ide> } <ide> } <ide><path>test/parallel/test-whatwg-webstreams-transfer.js <ide> const theData = 'hello'; <ide> start(c) { controller = c; }, <ide> <ide> cancel: common.mustCall((error) => { <del> assert.strictEqual(error.code, 25); // DataCloneError <add> assert.strictEqual(error.code, 25); <add> assert.strictEqual(error.name, 'DataCloneError'); <ide> }), <ide> }); <ide> <ide> port1.onmessage = ({ data }) => { <ide> const reader = data.getReader(); <ide> assert.rejects(reader.read(), { <del> code: 25, // DataCloneError <add> code: 25, <add> name: 'DataCloneError', <ide> }); <ide> port1.close(); <ide> }; <ide> const theData = 'hello'; <ide> <ide> const source = { <ide> abort: common.mustCall((error) => { <del> process.nextTick(() => assert.strictEqual(error.code, 25)); <add> process.nextTick(() => { <add> assert.strictEqual(error.code, 25); <add> assert.strictEqual(error.name, 'DataCloneError'); <add> }); <ide> }) <ide> }; <ide> <ide> const theData = 'hello'; <ide> const m = new WebAssembly.Memory({ initial: 1 }); <ide> <ide> assert.rejects(writer.abort(m), { <del> code: 25 <add> code: 25, <add> name: 'DataCloneError', <ide> }); <ide> port1.close(); <ide> }); <ide> const theData = 'hello'; <ide> { <ide> const source = { <ide> cancel: common.mustCall((error) => { <del> process.nextTick(() => assert(error.code, 25)); <add> process.nextTick(() => { <add> assert.strictEqual(error.code, 25); <add> assert.strictEqual(error.name, 'DataCloneError'); <add> }); <ide> }), <ide> }; <ide> <ide> const theData = 'hello'; <ide> reader.closed.then(common.mustCall()); <ide> <ide> assert.rejects(cancel, { <del> code: 25 <add> code: 25, <add> name: 'DataCloneError', <ide> }); <ide> <ide> port1.close(); <ide> const theData = 'hello'; <ide> abort: common.mustCall((error) => { <ide> process.nextTick(() => { <ide> assert.strictEqual(error.code, 25); <add> assert.strictEqual(error.name, 'DataCloneError'); <ide> }); <ide> }), <ide> }; <ide> const theData = 'hello'; <ide> const m = new WebAssembly.Memory({ initial: 1 }); <ide> const writer = data.getWriter(); <ide> const write = writer.write(m); <del> assert.rejects(write, { code: 25 }); <add> assert.rejects(write, { code: 25, name: 'DataCloneError' }); <ide> port1.close(); <ide> }); <ide> <ide> const theData = 'hello'; <ide> const readable = new ReadableStream(); <ide> readable.getReader(); <ide> assert.throws(() => readable[kTransfer](), { <del> code: 25 <add> code: 25, <add> name: 'DataCloneError', <ide> }); <ide> <ide> const writable = new WritableStream(); <ide> writable.getWriter(); <ide> assert.throws(() => writable[kTransfer](), { <del> code: 25 <add> code: 25, <add> name: 'DataCloneError', <ide> }); <ide> }
5
Python
Python
add support for escaping quotes
a7da273d6f91471d25c2ab524a92a88a052c39f9
<ide><path>libcloud/dns/drivers/route53.py <ide> def _ex_connection_class_kwargs(self): <ide> def _quote_data(self, data): <ide> if data[0] == '"' and data[-1] == '"': <ide> return data <del> return '"{0}"'.format(data) <add> return '"{0}"'.format(data.replace('"', '\"')) <ide><path>libcloud/test/dns/test_route53.py <ide> def test_create_SPF_record_quoted(self): <ide> self.assertEqual(record.type, RecordType.SPF) <ide> self.assertEqual(record.data, '"test"') <ide> <add> def test_create_TXT_record_escaped(self): <add> """ <add> Check that TXT record with quotes inside are escaped correctly <add> """ <add> zone = self.driver.list_zones()[0] <add> record = self.driver.create_record( <add> name='', zone=zone, <add> type=RecordType.TXT, data='test "with"' <add> ) <add> self.assertEqual(record.id, 'TXT:') <add> self.assertEqual(record.name, '') <add> self.assertEqual(record.zone, zone) <add> self.assertEqual(record.type, RecordType.TXT) <add> self.assertEqual(record.data, '"test \"with\""') <add> <ide> def test_create_multi_value_record(self): <ide> zone = self.driver.list_zones()[0] <ide> records = self.driver.ex_create_multi_value_record(
2
Python
Python
update language data for german
bfaa42636c204caac416d59402e87de0ba3561fd
<ide><path>spacy/de/language_data.py <ide> from __future__ import unicode_literals <ide> import re <ide> <add>from ..symbols import * <add>from ..language_data import EMOTICONS <add> <add> <add>PRON_LEMMA = "-PRON-" <add> <add> <add>TAG_MAP = { <add> "$(": {TAG: PUNCT, "PunctType": "brck"}, <add> "$,": {TAG: PUNCT, "PunctType": "comm"}, <add> "$.": {TAG: PUNCT, "PunctType": "peri"}, <add> "ADJA": {TAG: ADJ}, <add> "ADJD": {TAG: ADJ, "Variant": "short"}, <add> "ADV": {TAG: ADV}, <add> "APPO": {TAG: ADP, "AdpType": "post"}, <add> "APPR": {TAG: ADP, "AdpType": "prep"}, <add> "APPRART": {TAG: ADP, "AdpType": "prep", "PronType": "art"}, <add> "APZR": {TAG: ADP, "AdpType": "circ"}, <add> "ART": {TAG: DET, "PronType": "art"}, <add> "CARD": {TAG: NUM, "NumType": "card"}, <add> "FM": {TAG: X, "Foreign": "yes"}, <add> "ITJ": {TAG: "INTJ"}, <add> "KOKOM": {TAG: "CONJ", "ConjType": "comp"}, <add> "KON": {TAG: "CONJ"}, <add> "KOUI": {TAG: "SCONJ"}, <add> "KOUS": {TAG: "SCONJ"}, <add> "NE": {TAG: "PROPN"}, <add> "NNE": {TAG: "PROPN"}, <add> "NN": {TAG: "NOUN"}, <add> "PAV": {TAG: ADV, "PronType": "dem"}, <add> "PROAV": {TAG: ADV, "PronType": "dem"}, <add> "PDAT": {TAG: DET, "PronType": "dem"}, <add> "PDS": {TAG: PRON, "PronType": "dem"}, <add> "PIAT": {TAG: DET, "PronType": "ind|neg|tot"}, <add> "PIDAT": {TAG: DET, "AdjType": "pdt", "PronType": "ind|neg|tot"}, <add> "PIS": {TAG: PRON, "PronType": "ind|Neg|tot"}, <add> "PPER": {TAG: PRON, "PronType": "prs"}, <add> "PPOSAT": {TAG: DET, "Poss": "yes", "PronType": "prs"}, <add> "PPOSS": {TAG: PRON, "Poss": "yes", "PronType": "prs"}, <add> "PRELAT": {TAG: DET, "PronType": "rel"}, <add> "PRELS": {TAG: PRON, "PronType": "rel"}, <add> "PRF": {TAG: PRON, "PronType": "prs", "Reflex": "yes"}, <add> "PTKA": {TAG: PART}, <add> "PTKANT": {TAG: PART, "PartType": "res"}, <add> "PTKNEG": {TAG: PART, "Negative": "neg"}, <add> "PTKVZ": {TAG: PART, "PartType": "vbp"}, <add> "PTKZU": {TAG: PART, "PartType": "inf"}, <add> "PWAT": {TAG: DET, "PronType": "int"}, <add> "PWAV": {TAG: ADV, "PronType": "int"}, <add> "PWS": {TAG: PRON, "PronType": "int"}, <add> "TRUNC": {TAG: X, "Hyph": "yes"}, <add> "VAFIN": {TAG: AUX, "Mood": "ind", "VerbForm": "fin"}, <add> "VAIMP": {TAG: AUX, "Mood": "imp", "VerbForm": "fin"}, <add> "VAINF": {TAG: AUX, "VerbForm": "inf"}, <add> "VAPP": {TAG: AUX, "Aspect": "perf", "VerbForm": "part"}, <add> "VMFIN": {TAG: VERB, "Mood": "ind", "VerbForm": "fin", "VerbType": "mod"}, <add> "VMINF": {TAG: VERB, "VerbForm": "inf", "VerbType": "mod"}, <add> "VMPP": {TAG: VERB, "Aspect": "perf", "VerbForm": "part", "VerbType": "mod"}, <add> "VVFIN": {TAG: VERB, "Mood": "ind", "VerbForm": "fin"}, <add> "VVIMP": {TAG: VERB, "Mood": "imp", "VerbForm": "fin"}, <add> "VVINF": {TAG: VERB, "VerbForm": "inf"}, <add> "VVIZU": {TAG: VERB, "VerbForm": "inf"}, <add> "VVPP": {TAG: VERB, "Aspect": "perf", "VerbForm": "part"}, <add> "XY": {TAG: X}, <add> "SP": {TAG: SPACE} <add>} <add> <ide> <ide> STOP_WORDS = set(""" <ide> <ide> gewesen gewollt geworden gibt ging gleich gott gross groß grosse große grossen <ide> großen grosser großer grosses großes gut gute guter gutes <ide> <del>habe haben habt hast hat hatte hätte hatten hätten heisst heißt her heute hier hin hinter hoch <add>habe haben habt hast hat hatte hätte hatten hätten heisst heißt her heute hier <add>hin hinter hoch <ide> <ide> ich ihm ihn ihnen ihr ihre ihrem ihrer ihres im immer in indem infolgedessen <ide> ins irgend ist <ide> wahr während währenddem währenddessen wann war wäre waren wart warum was wegen <ide> weil weit weiter weitere weiteren weiteres welche welchem welchen welcher <ide> welches wem wen wenig wenige weniger weniges wenigstens wenn wer werde werden <del>werdet wessen wie wieder will willst wir wird wirklich wirst wo wohl wollen wollt wollte wollten worden wurde würde wurden würden <add>werdet wessen wie wieder will willst wir wird wirklich wirst wo wohl wollen <add>wollt wollte wollten worden wurde würde wurden würden <ide> <ide> zehn zehnte zehnten zehnter zehntes zeit zu zuerst zugleich zum zunächst zur <ide> zurück zusammen zwanzig zwar zwei zweite zweiten zweiter zweites zwischen <ide> <ide> """.split()) <ide> <ide> <del>TOKENIZER_PREFIXES = r''' <del>, <del>" <del>( <del>[ <del>{ <del>* <del>< <del>> <del>$ <del>£ <del>„ <del>“ <del>' <del>`` <del>` <del># <del>US$ <del>C$ <del>A$ <del>a- <del>‘ <del>.... <del>... <del>… <del>‚ <del>» <del>§ <del>'''.strip().split('\n') <del> <del> <del>TOKENIZER_SUFFIXES = r''' <del>, <del>\" <del>\) <del>\] <del>\} <del>\* <del>\! <del>\? <del>% <del>\$ <del>> <del>: <del>; <del>' <del>” <del>“ <del>« <del>_ <del>'' <del>'s <del>'S <del>’s <del>’S <del>’ <del>‘ <del>° <del>€ <del>… <del>\.\. <del>\.\.\. <del>\.\.\.\. <del>(?<=[a-zäöüßÖÄÜ)\]"'´«‘’%\)²“”])\. <del>\-\- <del>´ <del>(?<=[0-9])km² <del>(?<=[0-9])m² <del>(?<=[0-9])cm² <del>(?<=[0-9])mm² <del>(?<=[0-9])km³ <del>(?<=[0-9])m³ <del>(?<=[0-9])cm³ <del>(?<=[0-9])mm³ <del>(?<=[0-9])ha <del>(?<=[0-9])km <del>(?<=[0-9])m <del>(?<=[0-9])cm <del>(?<=[0-9])mm <del>(?<=[0-9])µm <del>(?<=[0-9])nm <del>(?<=[0-9])yd <del>(?<=[0-9])in <del>(?<=[0-9])ft <del>(?<=[0-9])kg <del>(?<=[0-9])g <del>(?<=[0-9])mg <del>(?<=[0-9])µg <del>(?<=[0-9])t <del>(?<=[0-9])lb <del>(?<=[0-9])oz <del>(?<=[0-9])m/s <del>(?<=[0-9])km/h <del>(?<=[0-9])mph <del>(?<=[0-9])°C <del>(?<=[0-9])°K <del>(?<=[0-9])°F <del>(?<=[0-9])hPa <del>(?<=[0-9])Pa <del>(?<=[0-9])mbar <del>(?<=[0-9])mb <del>(?<=[0-9])T <del>(?<=[0-9])G <del>(?<=[0-9])M <del>(?<=[0-9])K <del>(?<=[0-9])kb <del>'''.strip().split('\n') <del> <del> <del>TOKENIZER_INFIXES = r''' <del>… <del>\.\.\.+ <del>(?<=[a-z])\.(?=[A-Z]) <del>(?<=[a-zöäüßA-ZÖÄÜ"]):(?=[a-zöäüßA-ZÖÄÜ]) <del>(?<=[a-zöäüßA-ZÖÄÜ"])>(?=[a-zöäüßA-ZÖÄÜ]) <del>(?<=[a-zöäüßA-ZÖÄÜ"])<(?=[a-zöäüßA-ZÖÄÜ]) <del>(?<=[a-zöäüßA-ZÖÄÜ"])=(?=[a-zöäüßA-ZÖÄÜ]) <del>'''.strip().split('\n') <del> <del> <ide> TOKENIZER_EXCEPTIONS = { <del> "''": [ <del> { <del> "F": "''" <del> } <add> "\\n": [ <add> {ORTH: "\\n", LEMMA: "<nl>", TAG: "SP"} <ide> ], <add> <add> "\\t": [ <add> {ORTH: "\\t", LEMMA: "<tab>", TAG: "SP"} <add> ], <add> <ide> "'S": [ <del> { <del> "F": "'S", <del> "L": "es" <del> } <add> {ORTH: "'S", LEMMA: PRON_LEMMA} <ide> ], <add> <ide> "'n": [ <del> { <del> "F": "'n", <del> "L": "ein" <del> } <add> {ORTH: "'n", LEMMA: "ein"} <ide> ], <add> <ide> "'ne": [ <del> { <del> "F": "'ne", <del> "L": "eine" <del> } <add> {ORTH: "'ne", LEMMA: "eine"} <ide> ], <add> <ide> "'nen": [ <del> { <del> "F": "'nen", <del> "L": "einen" <del> } <add> {ORTH: "'nen", LEMMA: "einen"} <ide> ], <add> <ide> "'s": [ <del> { <del> "F": "'s", <del> "L": "es" <del> } <del> ], <del> "(:": [ <del> { <del> "F": "(:" <del> } <del> ], <del> "(=": [ <del> { <del> "F": "(=" <del> } <del> ], <del> "(^_^)": [ <del> { <del> "F": "(^_^)" <del> } <del> ], <del> "-_-": [ <del> { <del> "F": "-_-" <del> } <del> ], <del> "-__-": [ <del> { <del> "F": "-__-" <del> } <del> ], <del> ":')": [ <del> { <del> "F": ":')" <del> } <del> ], <del> ":(": [ <del> { <del> "F": ":(" <del> } <del> ], <del> ":((": [ <del> { <del> "F": ":((" <del> } <del> ], <del> ":(((": [ <del> { <del> "F": ":(((" <del> } <del> ], <del> ":)": [ <del> { <del> "F": ":)" <del> } <del> ], <del> ":))": [ <del> { <del> "F": ":))" <del> } <del> ], <del> ":-)": [ <del> { <del> "F": ":-)" <del> } <del> ], <del> ":-/": [ <del> { <del> "F": ":-/" <del> } <del> ], <del> ":-P": [ <del> { <del> "F": ":-P" <del> } <del> ], <del> ":/": [ <del> { <del> "F": ":/" <del> } <del> ], <del> ":0": [ <del> { <del> "F": ":0" <del> } <del> ], <del> ":3": [ <del> { <del> "F": ":3" <del> } <del> ], <del> ":>": [ <del> { <del> "F": ":>" <del> } <del> ], <del> ":O": [ <del> { <del> "F": ":O" <del> } <del> ], <del> ":P": [ <del> { <del> "F": ":P" <del> } <del> ], <del> ":Y": [ <del> { <del> "F": ":Y" <del> } <del> ], <del> ":]": [ <del> { <del> "F": ":]" <del> } <del> ], <del> ":p": [ <del> { <del> "F": ":p" <del> } <del> ], <del> ";(": [ <del> { <del> "F": ";(" <del> } <del> ], <del> ";)": [ <del> { <del> "F": ";)" <del> } <del> ], <del> ";-)": [ <del> { <del> "F": ";-)" <del> } <del> ], <del> ";-p": [ <del> { <del> "F": ";-p" <del> } <del> ], <del> ";D": [ <del> { <del> "F": ";D" <del> } <del> ], <del> ";p": [ <del> { <del> "F": ";p" <del> } <del> ], <del> "<3": [ <del> { <del> "F": "<3" <del> } <del> ], <del> "<33": [ <del> { <del> "F": "<33" <del> } <del> ], <del> "<333": [ <del> { <del> "F": "<333" <del> } <del> ], <del> "<space>": [ <del> { <del> "F": "SP" <del> } <del> ], <del> "=)": [ <del> { <del> "F": "=)" <del> } <del> ], <del> "=3": [ <del> { <del> "F": "=3" <del> } <del> ], <del> "=D": [ <del> { <del> "F": "=D" <del> } <del> ], <del> "=[[": [ <del> { <del> "F": "=[[" <del> } <del> ], <del> "=]": [ <del> { <del> "F": "=]" <del> } <del> ], <del> "A.C.": [ <del> { <del> "F": "A.C." <del> } <del> ], <del> "A.D.": [ <del> { <del> "F": "A.D." <del> } <del> ], <del> "A.G.": [ <del> { <del> "F": "A.G." <del> } <add> {ORTH: "'s", LEMMA: PRON_LEMMA} <ide> ], <add> <ide> "Abb.": [ <del> { <del> "F": "Abb." <del> } <add> {ORTH: "Abb.", LEMMA: "Abbildung"} <ide> ], <add> <ide> "Abk.": [ <del> { <del> "F": "Abk." <del> } <del> ], <del> "Abs.": [ <del> { <del> "F": "Abs." <del> } <add> {ORTH: "Abk.", LEMMA: "Abkürzung"} <ide> ], <add> <ide> "Abt.": [ <del> { <del> "F": "Abt." <del> } <add> {ORTH: "Abt.", LEMMA: "Abteilung"} <ide> ], <add> <ide> "Apr.": [ <del> { <del> "F": "Apr." <del> } <add> {ORTH: "Apr.", LEMMA: "April"} <ide> ], <add> <ide> "Aug.": [ <del> { <del> "F": "Aug." <del> } <del> ], <del> "B.A.": [ <del> { <del> "F": "B.A." <del> } <del> ], <del> "B.Sc.": [ <del> { <del> "F": "B.Sc." <del> } <add> {ORTH: "Aug.", LEMMA: "August"} <ide> ], <add> <ide> "Bd.": [ <del> { <del> "F": "Bd." <del> } <add> {ORTH: "Bd.", LEMMA: "Band"} <ide> ], <add> <ide> "Betr.": [ <del> { <del> "F": "Betr." <del> } <add> {ORTH: "Betr.", LEMMA: "Betreff"} <ide> ], <add> <ide> "Bf.": [ <del> { <del> "F": "Bf." <del> } <add> {ORTH: "Bf.", LEMMA: "Bahnhof"} <ide> ], <add> <ide> "Bhf.": [ <del> { <del> "F": "Bhf." <del> } <del> ], <del> "Biol.": [ <del> { <del> "F": "Biol." <del> } <add> {ORTH: "Bhf.", LEMMA: "Bahnhof"} <ide> ], <add> <ide> "Bsp.": [ <del> { <del> "F": "Bsp." <del> } <del> ], <del> "Chr.": [ <del> { <del> "F": "Chr." <del> } <del> ], <del> "Cie.": [ <del> { <del> "F": "Cie." <del> } <del> ], <del> "Co.": [ <del> { <del> "F": "Co." <del> } <del> ], <del> "D.C.": [ <del> { <del> "F": "D.C." <del> } <add> {ORTH: "Bsp.", LEMMA: "Beispiel"} <ide> ], <add> <ide> "Dez.": [ <del> { <del> "F": "Dez." <del> } <add> {ORTH: "Dez.", LEMMA: "Dezember"} <ide> ], <add> <ide> "Di.": [ <del> { <del> "F": "Di." <del> } <del> ], <del> "Dipl.": [ <del> { <del> "F": "Dipl." <del> } <del> ], <del> "Dipl.-Ing.": [ <del> { <del> "F": "Dipl.-Ing." <del> } <add> {ORTH: "Di.", LEMMA: "Dienstag"} <ide> ], <add> <ide> "Do.": [ <del> { <del> "F": "Do." <del> } <del> ], <del> "Dr.": [ <del> { <del> "F": "Dr." <del> } <add> {ORTH: "Do.", LEMMA: "Donnerstag"} <ide> ], <add> <ide> "Fa.": [ <del> { <del> "F": "Fa." <del> } <add> {ORTH: "Fa.", LEMMA: "Firma"} <ide> ], <add> <ide> "Fam.": [ <del> { <del> "F": "Fam." <del> } <add> {ORTH: "Fam.", LEMMA: "Familie"} <ide> ], <add> <ide> "Feb.": [ <del> { <del> "F": "Feb." <del> } <add> {ORTH: "Feb.", LEMMA: "Februar"} <ide> ], <add> <ide> "Fr.": [ <del> { <del> "F": "Fr." <del> } <add> {ORTH: "Fr.", LEMMA: "Frau"} <ide> ], <add> <ide> "Frl.": [ <del> { <del> "F": "Frl." <del> } <del> ], <del> "G.m.b.H.": [ <del> { <del> "F": "G.m.b.H." <del> } <del> ], <del> "Gebr.": [ <del> { <del> "F": "Gebr." <del> } <add> {ORTH: "Frl.", LEMMA: "Fräulein"} <ide> ], <add> <ide> "Hbf.": [ <del> { <del> "F": "Hbf." <del> } <del> ], <del> "Hg.": [ <del> { <del> "F": "Hg." <del> } <add> {ORTH: "Hbf.", LEMMA: "Hauptbahnhof"} <ide> ], <add> <ide> "Hr.": [ <del> { <del> "F": "Hr." <del> } <del> ], <del> "Hrgs.": [ <del> { <del> "F": "Hrgs." <del> } <add> {ORTH: "Hr.", LEMMA: "Herr"} <ide> ], <add> <ide> "Hrn.": [ <del> { <del> "F": "Hrn." <del> } <del> ], <del> "Hrsg.": [ <del> { <del> "F": "Hrsg." <del> } <del> ], <del> "Ing.": [ <del> { <del> "F": "Ing." <del> } <add> {ORTH: "Hrn.", LEMMA: "Herr"} <ide> ], <add> <ide> "Jan.": [ <del> { <del> "F": "Jan." <del> } <add> {ORTH: "Jan.", LEMMA: "Januar"} <ide> ], <add> <ide> "Jh.": [ <del> { <del> "F": "Jh." <del> } <add> {ORTH: "Jh.", LEMMA: "Jahrhundert"} <ide> ], <add> <ide> "Jhd.": [ <del> { <del> "F": "Jhd." <del> } <del> ], <del> "Jr.": [ <del> { <del> "F": "Jr." <del> } <add> {ORTH: "Jhd.", LEMMA: "Jahrhundert"} <ide> ], <add> <ide> "Jul.": [ <del> { <del> "F": "Jul." <del> } <add> {ORTH: "Jul.", LEMMA: "Juli"} <ide> ], <add> <ide> "Jun.": [ <del> { <del> "F": "Jun." <del> } <del> ], <del> "K.O.": [ <del> { <del> "F": "K.O." <del> } <del> ], <del> "L.A.": [ <del> { <del> "F": "L.A." <del> } <del> ], <del> "M.A.": [ <del> { <del> "F": "M.A." <del> } <del> ], <del> "M.Sc.": [ <del> { <del> "F": "M.Sc." <del> } <add> {ORTH: "Jun.", LEMMA: "Juni"} <ide> ], <add> <ide> "Mi.": [ <del> { <del> "F": "Mi." <del> } <add> {ORTH: "Mi.", LEMMA: "Mittwoch"} <ide> ], <add> <ide> "Mio.": [ <del> { <del> "F": "Mio." <del> } <add> {ORTH: "Mio.", LEMMA: "Million"} <ide> ], <add> <ide> "Mo.": [ <del> { <del> "F": "Mo." <del> } <del> ], <del> "Mr.": [ <del> { <del> "F": "Mr." <del> } <add> {ORTH: "Mo.", LEMMA: "Montag"} <ide> ], <add> <ide> "Mrd.": [ <del> { <del> "F": "Mrd." <del> } <add> {ORTH: "Mrd.", LEMMA: "Milliarde"} <ide> ], <add> <ide> "Mrz.": [ <del> { <del> "F": "Mrz." <del> } <add> {ORTH: "Mrz.", LEMMA: "März"} <ide> ], <add> <ide> "MwSt.": [ <del> { <del> "F": "MwSt." <del> } <del> ], <del> "M\u00e4r.": [ <del> { <del> "F": "M\u00e4r." <del> } <add> {ORTH: "MwSt.", LEMMA: "Mehrwertsteuer"} <ide> ], <del> "N.Y.": [ <del> { <del> "F": "N.Y." <del> } <del> ], <del> "N.Y.C.": [ <del> { <del> "F": "N.Y.C." <del> } <add> <add> "Mär.": [ <add> {ORTH: "Mär.", LEMMA: "März"} <ide> ], <add> <ide> "Nov.": [ <del> { <del> "F": "Nov." <del> } <add> {ORTH: "Nov.", LEMMA: "November"} <ide> ], <add> <ide> "Nr.": [ <del> { <del> "F": "Nr." <del> } <del> ], <del> "O.K.": [ <del> { <del> "F": "O.K." <del> } <add> {ORTH: "Nr.", LEMMA: "Nummer"} <ide> ], <add> <ide> "Okt.": [ <del> { <del> "F": "Okt." <del> } <add> {ORTH: "Okt.", LEMMA: "Oktober"} <ide> ], <add> <ide> "Orig.": [ <del> { <del> "F": "Orig." <del> } <del> ], <del> "P.S.": [ <del> { <del> "F": "P.S." <del> } <add> {ORTH: "Orig.", LEMMA: "Original"} <ide> ], <add> <ide> "Pkt.": [ <del> { <del> "F": "Pkt." <del> } <add> {ORTH: "Pkt.", LEMMA: "Punkt"} <ide> ], <add> <ide> "Prof.": [ <del> { <del> "F": "Prof." <del> } <del> ], <del> "R.I.P.": [ <del> { <del> "F": "R.I.P." <del> } <add> {ORTH: "Prof.", LEMMA: "Professor"} <ide> ], <add> <ide> "Red.": [ <del> { <del> "F": "Red." <del> } <add> {ORTH: "Red.", LEMMA: "Redaktion"} <ide> ], <add> <ide> "S'": [ <del> { <del> "F": "S'", <del> "L": "sie" <del> } <add> {ORTH: "S'", LEMMA: PRON_LEMMA} <ide> ], <add> <ide> "Sa.": [ <del> { <del> "F": "Sa." <del> } <add> {ORTH: "Sa.", LEMMA: "Samstag"} <ide> ], <add> <ide> "Sep.": [ <del> { <del> "F": "Sep." <del> } <add> {ORTH: "Sep.", LEMMA: "September"} <ide> ], <add> <ide> "Sept.": [ <del> { <del> "F": "Sept." <del> } <add> {ORTH: "Sept.", LEMMA: "September"} <ide> ], <add> <ide> "So.": [ <del> { <del> "F": "So." <del> } <del> ], <del> "St.": [ <del> { <del> "F": "St." <del> } <add> {ORTH: "So.", LEMMA: "Sonntag"} <ide> ], <add> <ide> "Std.": [ <del> { <del> "F": "Std." <del> } <add> {ORTH: "Std.", LEMMA: "Stunde"} <ide> ], <add> <ide> "Str.": [ <del> { <del> "F": "Str." <del> } <add> {ORTH: "Str.", LEMMA: "Straße"} <ide> ], <add> <ide> "Tel.": [ <del> { <del> "F": "Tel." <del> } <add> {ORTH: "Tel.", LEMMA: "Telefon"} <ide> ], <add> <ide> "Tsd.": [ <del> { <del> "F": "Tsd." <del> } <del> ], <del> "U.S.": [ <del> { <del> "F": "U.S." <del> } <del> ], <del> "U.S.A.": [ <del> { <del> "F": "U.S.A." <del> } <del> ], <del> "U.S.S.": [ <del> { <del> "F": "U.S.S." <del> } <add> {ORTH: "Tsd.", LEMMA: "Tausend"} <ide> ], <add> <ide> "Univ.": [ <del> { <del> "F": "Univ." <del> } <del> ], <del> "V_V": [ <del> { <del> "F": "V_V" <del> } <del> ], <del> "Vol.": [ <del> { <del> "F": "Vol." <del> } <del> ], <del> "\\\")": [ <del> { <del> "F": "\\\")" <del> } <del> ], <del> "\\n": [ <del> { <del> "F": "\\n", <del> "L": "<nl>", <del> "pos": "SP" <del> } <del> ], <del> "\\t": [ <del> { <del> "F": "\\t", <del> "L": "<tab>", <del> "pos": "SP" <del> } <del> ], <del> "^_^": [ <del> { <del> "F": "^_^" <del> } <del> ], <del> "a.": [ <del> { <del> "F": "a." <del> } <del> ], <del> "a.D.": [ <del> { <del> "F": "a.D." <del> } <del> ], <del> "a.M.": [ <del> { <del> "F": "a.M." <del> } <del> ], <del> "a.Z.": [ <del> { <del> "F": "a.Z." <del> } <add> {ORTH: "Univ.", LEMMA: "Universität"} <ide> ], <add> <ide> "abzgl.": [ <del> { <del> "F": "abzgl." <del> } <del> ], <del> "adv.": [ <del> { <del> "F": "adv." <del> } <del> ], <del> "al.": [ <del> { <del> "F": "al." <del> } <add> {ORTH: "abzgl.", LEMMA: "abzüglich"} <ide> ], <add> <ide> "allg.": [ <del> { <del> "F": "allg." <del> } <add> {ORTH: "allg.", LEMMA: "allgemein"} <ide> ], <add> <ide> "auf'm": [ <del> { <del> "F": "auf", <del> "L": "auf" <del> }, <del> { <del> "F": "'m", <del> "L": "dem" <del> } <del> ], <del> "b.": [ <del> { <del> "F": "b." <del> } <del> ], <del> "betr.": [ <del> { <del> "F": "betr." <del> } <del> ], <del> "biol.": [ <del> { <del> "F": "biol." <del> } <add> {ORTH: "auf", LEMMA: "auf"}, <add> {ORTH: "'m", LEMMA: PRON_LEMMA} <ide> ], <add> <ide> "bspw.": [ <del> { <del> "F": "bspw." <del> } <add> {ORTH: "bspw.", LEMMA: "beispielsweise"} <ide> ], <add> <ide> "bzgl.": [ <del> { <del> "F": "bzgl." <del> } <add> {ORTH: "bzgl.", LEMMA: "bezüglich"} <ide> ], <add> <ide> "bzw.": [ <del> { <del> "F": "bzw." <del> } <del> ], <del> "c.": [ <del> { <del> "F": "c." <del> } <del> ], <del> "ca.": [ <del> { <del> "F": "ca." <del> } <del> ], <del> "co.": [ <del> { <del> "F": "co." <del> } <del> ], <del> "d.": [ <del> { <del> "F": "d." <del> } <add> {ORTH: "bzw.", LEMMA: "beziehungsweise"} <ide> ], <add> <ide> "d.h.": [ <del> { <del> "F": "d.h." <del> } <add> {ORTH: "d.h.", LEMMA: "das heißt"} <ide> ], <add> <ide> "dgl.": [ <del> { <del> "F": "dgl." <del> } <add> {ORTH: "dgl.", LEMMA: "dergleichen"} <ide> ], <add> <ide> "du's": [ <del> { <del> "F": "du", <del> "L": "du" <del> }, <del> { <del> "F": "'s", <del> "L": "es" <del> } <del> ], <del> "e.": [ <del> { <del> "F": "e." <del> } <del> ], <del> "e.V.": [ <del> { <del> "F": "e.V." <del> } <del> ], <del> "e.g.": [ <del> { <del> "F": "e.g." <del> } <add> {ORTH: "du", LEMMA: PRON_LEMMA}, <add> {ORTH: "'s", LEMMA: PRON_LEMMA} <ide> ], <add> <ide> "ebd.": [ <del> { <del> "F": "ebd." <del> } <del> ], <del> "ehem.": [ <del> { <del> "F": "ehem." <del> } <add> {ORTH: "ebd.", LEMMA: "ebenda"} <ide> ], <add> <ide> "eigtl.": [ <del> { <del> "F": "eigtl." <del> } <add> {ORTH: "eigtl.", LEMMA: "eigentlich"} <ide> ], <add> <ide> "engl.": [ <del> { <del> "F": "engl." <del> } <del> ], <del> "entspr.": [ <del> { <del> "F": "entspr." <del> } <add> {ORTH: "engl.", LEMMA: "englisch"} <ide> ], <add> <ide> "er's": [ <del> { <del> "F": "er", <del> "L": "er" <del> }, <del> { <del> "F": "'s", <del> "L": "es" <del> } <del> ], <del> "erm.": [ <del> { <del> "F": "erm." <del> } <del> ], <del> "etc.": [ <del> { <del> "F": "etc." <del> } <del> ], <del> "ev.": [ <del> { <del> "F": "ev." <del> } <add> {ORTH: "er", LEMMA: PRON_LEMMA}, <add> {ORTH: "'s", LEMMA: PRON_LEMMA} <ide> ], <add> <ide> "evtl.": [ <del> { <del> "F": "evtl." <del> } <del> ], <del> "f.": [ <del> { <del> "F": "f." <del> } <add> {ORTH: "evtl.", LEMMA: "eventuell"} <ide> ], <add> <ide> "frz.": [ <del> { <del> "F": "frz." <del> } <del> ], <del> "g.": [ <del> { <del> "F": "g." <del> } <del> ], <del> "geb.": [ <del> { <del> "F": "geb." <del> } <add> {ORTH: "frz.", LEMMA: "französisch"} <ide> ], <add> <ide> "gegr.": [ <del> { <del> "F": "gegr." <del> } <del> ], <del> "gem.": [ <del> { <del> "F": "gem." <del> } <add> {ORTH: "gegr.", LEMMA: "gegründet"} <ide> ], <add> <ide> "ggf.": [ <del> { <del> "F": "ggf." <del> } <add> {ORTH: "ggf.", LEMMA: "gegebenenfalls"} <ide> ], <add> <ide> "ggfs.": [ <del> { <del> "F": "ggfs." <del> } <del> ], <del> "gg\u00fc.": [ <del> { <del> "F": "gg\u00fc." <del> } <del> ], <del> "h.": [ <del> { <del> "F": "h." <del> } <add> {ORTH: "ggfs.", LEMMA: "gegebenenfalls"} <ide> ], <del> "h.c.": [ <del> { <del> "F": "h.c." <del> } <add> <add> "ggü.": [ <add> {ORTH: "ggü.", LEMMA: "gegenüber"} <ide> ], <add> <ide> "hinter'm": [ <del> { <del> "F": "hinter", <del> "L": "hinter" <del> }, <del> { <del> "F": "'m", <del> "L": "dem" <del> } <del> ], <del> "hrsg.": [ <del> { <del> "F": "hrsg." <del> } <del> ], <del> "i.": [ <del> { <del> "F": "i." <del> } <del> ], <del> "i.A.": [ <del> { <del> "F": "i.A." <del> } <del> ], <del> "i.G.": [ <del> { <del> "F": "i.G." <del> } <add> {ORTH: "hinter", LEMMA: "hinter"}, <add> {ORTH: "'m", LEMMA: PRON_LEMMA} <ide> ], <add> <ide> "i.O.": [ <del> { <del> "F": "i.O." <del> } <del> ], <del> "i.Tr.": [ <del> { <del> "F": "i.Tr." <del> } <del> ], <del> "i.V.": [ <del> { <del> "F": "i.V." <del> } <add> {ORTH: "i.O.", LEMMA: "in Ordnung"} <ide> ], <add> <ide> "i.d.R.": [ <del> { <del> "F": "i.d.R." <del> } <del> ], <del> "i.e.": [ <del> { <del> "F": "i.e." <del> } <add> {ORTH: "i.d.R.", LEMMA: "in der Regel"} <ide> ], <add> <ide> "ich's": [ <del> { <del> "F": "ich", <del> "L": "ich" <del> }, <del> { <del> "F": "'s", <del> "L": "es" <del> } <add> {ORTH: "ich", LEMMA: PRON_LEMMA}, <add> {ORTH: "'s", LEMMA: PRON_LEMMA} <ide> ], <add> <ide> "ihr's": [ <del> { <del> "F": "ihr", <del> "L": "ihr" <del> }, <del> { <del> "F": "'s", <del> "L": "es" <del> } <add> {ORTH: "ihr", LEMMA: PRON_LEMMA}, <add> {ORTH: "'s", LEMMA: PRON_LEMMA} <ide> ], <add> <ide> "incl.": [ <del> { <del> "F": "incl." <del> } <add> {ORTH: "incl.", LEMMA: "inklusive"} <ide> ], <add> <ide> "inkl.": [ <del> { <del> "F": "inkl." <del> } <add> {ORTH: "inkl.", LEMMA: "inklusive"} <ide> ], <add> <ide> "insb.": [ <del> { <del> "F": "insb." <del> } <del> ], <del> "j.": [ <del> { <del> "F": "j." <del> } <del> ], <del> "jr.": [ <del> { <del> "F": "jr." <del> } <del> ], <del> "jun.": [ <del> { <del> "F": "jun." <del> } <del> ], <del> "jur.": [ <del> { <del> "F": "jur." <del> } <del> ], <del> "k.": [ <del> { <del> "F": "k." <del> } <add> {ORTH: "insb.", LEMMA: "insbesondere"} <ide> ], <add> <ide> "kath.": [ <del> { <del> "F": "kath." <del> } <del> ], <del> "l.": [ <del> { <del> "F": "l." <del> } <del> ], <del> "lat.": [ <del> { <del> "F": "lat." <del> } <add> {ORTH: "kath.", LEMMA: "katholisch"} <ide> ], <add> <ide> "lt.": [ <del> { <del> "F": "lt." <del> } <del> ], <del> "m.": [ <del> { <del> "F": "m." <del> } <del> ], <del> "m.E.": [ <del> { <del> "F": "m.E." <del> } <del> ], <del> "m.M.": [ <del> { <del> "F": "m.M." <del> } <add> {ORTH: "lt.", LEMMA: "laut"} <ide> ], <add> <ide> "max.": [ <del> { <del> "F": "max." <del> } <add> {ORTH: "max.", LEMMA: "maximal"} <ide> ], <add> <ide> "min.": [ <del> { <del> "F": "min." <del> } <add> {ORTH: "min.", LEMMA: "minimal"} <ide> ], <add> <ide> "mind.": [ <del> { <del> "F": "mind." <del> } <add> {ORTH: "mind.", LEMMA: "mindestens"} <ide> ], <add> <ide> "mtl.": [ <del> { <del> "F": "mtl." <del> } <del> ], <del> "n.": [ <del> { <del> "F": "n." <del> } <add> {ORTH: "mtl.", LEMMA: "monatlich"} <ide> ], <add> <ide> "n.Chr.": [ <del> { <del> "F": "n.Chr." <del> } <del> ], <del> "nat.": [ <del> { <del> "F": "nat." <del> } <del> ], <del> "o.": [ <del> { <del> "F": "o." <del> } <del> ], <del> "o.O": [ <del> { <del> "F": "o.O" <del> } <del> ], <del> "o.a.": [ <del> { <del> "F": "o.a." <del> } <del> ], <del> "o.g.": [ <del> { <del> "F": "o.g." <del> } <del> ], <del> "o.k.": [ <del> { <del> "F": "o.k." <del> } <del> ], <del> "o.\u00c4.": [ <del> { <del> "F": "o.\u00c4." <del> } <del> ], <del> "o.\u00e4.": [ <del> { <del> "F": "o.\u00e4." <del> } <del> ], <del> "o_O": [ <del> { <del> "F": "o_O" <del> } <del> ], <del> "o_o": [ <del> { <del> "F": "o_o" <del> } <add> {ORTH: "n.Chr.", LEMMA: "nach Christus"} <ide> ], <add> <ide> "orig.": [ <del> { <del> "F": "orig." <del> } <del> ], <del> "p.": [ <del> { <del> "F": "p." <del> } <del> ], <del> "p.a.": [ <del> { <del> "F": "p.a." <del> } <del> ], <del> "p.s.": [ <del> { <del> "F": "p.s." <del> } <del> ], <del> "pers.": [ <del> { <del> "F": "pers." <del> } <del> ], <del> "phil.": [ <del> { <del> "F": "phil." <del> } <del> ], <del> "q.": [ <del> { <del> "F": "q." <del> } <del> ], <del> "q.e.d.": [ <del> { <del> "F": "q.e.d." <del> } <del> ], <del> "r.": [ <del> { <del> "F": "r." <del> } <del> ], <del> "rer.": [ <del> { <del> "F": "rer." <del> } <del> ], <del> "r\u00f6m.": [ <del> { <del> "F": "r\u00f6m." <del> } <add> {ORTH: "orig.", LEMMA: "original"} <ide> ], <del> "s'": [ <del> { <del> "F": "s'", <del> "L": "sie" <del> } <add> <add> "röm.": [ <add> {ORTH: "röm.", LEMMA: "römisch"} <ide> ], <del> "s.": [ <del> { <del> "F": "s." <del> } <add> <add> "s'": [ <add> {ORTH: "s'", LEMMA: PRON_LEMMA} <ide> ], <add> <ide> "s.o.": [ <del> { <del> "F": "s.o." <del> } <del> ], <del> "sen.": [ <del> { <del> "F": "sen." <del> } <add> {ORTH: "s.o.", LEMMA: "siehe oben"} <ide> ], <add> <ide> "sie's": [ <del> { <del> "F": "sie", <del> "L": "sie" <del> }, <del> { <del> "F": "'s", <del> "L": "es" <del> } <add> {ORTH: "sie", LEMMA: PRON_LEMMA}, <add> {ORTH: "'s", LEMMA: PRON_LEMMA} <ide> ], <add> <ide> "sog.": [ <del> { <del> "F": "sog." <del> } <del> ], <del> "std.": [ <del> { <del> "F": "std." <del> } <add> {ORTH: "sog.", LEMMA: "so genannt"} <ide> ], <add> <ide> "stellv.": [ <del> { <del> "F": "stellv." <del> } <del> ], <del> "t.": [ <del> { <del> "F": "t." <del> } <del> ], <del> "t\u00e4gl.": [ <del> { <del> "F": "t\u00e4gl." <del> } <add> {ORTH: "stellv.", LEMMA: "stellvertretend"} <ide> ], <del> "u.": [ <del> { <del> "F": "u." <del> } <add> <add> "tägl.": [ <add> {ORTH: "tägl.", LEMMA: "täglich"} <ide> ], <add> <ide> "u.U.": [ <del> { <del> "F": "u.U." <del> } <del> ], <del> "u.a.": [ <del> { <del> "F": "u.a." <del> } <add> {ORTH: "u.U.", LEMMA: "unter Umständen"} <ide> ], <add> <ide> "u.s.w.": [ <del> { <del> "F": "u.s.w." <del> } <add> {ORTH: "u.s.w.", LEMMA: "und so weiter"} <ide> ], <add> <ide> "u.v.m.": [ <del> { <del> "F": "u.v.m." <del> } <add> {ORTH: "u.v.m.", LEMMA: "und vieles mehr"} <ide> ], <add> <ide> "unter'm": [ <del> { <del> "F": "unter", <del> "L": "unter" <del> }, <del> { <del> "F": "'m", <del> "L": "dem" <del> } <add> {ORTH: "unter", LEMMA: "unter"}, <add> {ORTH: "'m", LEMMA: PRON_LEMMA} <ide> ], <add> <ide> "usf.": [ <del> { <del> "F": "usf." <del> } <add> {ORTH: "usf.", LEMMA: "und so fort"} <ide> ], <add> <ide> "usw.": [ <del> { <del> "F": "usw." <del> } <add> {ORTH: "usw.", LEMMA: "und so weiter"} <ide> ], <add> <ide> "uvm.": [ <del> { <del> "F": "uvm." <del> } <del> ], <del> "v.": [ <del> { <del> "F": "v." <del> } <add> {ORTH: "uvm.", LEMMA: "und vieles mehr"} <ide> ], <add> <ide> "v.Chr.": [ <del> { <del> "F": "v.Chr." <del> } <add> {ORTH: "v.Chr.", LEMMA: "vor Christus"} <ide> ], <add> <ide> "v.a.": [ <del> { <del> "F": "v.a." <del> } <add> {ORTH: "v.a.", LEMMA: "vor allem"} <ide> ], <add> <ide> "v.l.n.r.": [ <del> { <del> "F": "v.l.n.r." <del> } <add> {ORTH: "v.l.n.r.", LEMMA: "von links nach rechts"} <ide> ], <add> <ide> "vgl.": [ <del> { <del> "F": "vgl." <del> } <add> {ORTH: "vgl.", LEMMA: "vergleiche"} <ide> ], <add> <ide> "vllt.": [ <del> { <del> "F": "vllt." <del> } <add> {ORTH: "vllt.", LEMMA: "vielleicht"} <ide> ], <add> <ide> "vlt.": [ <del> { <del> "F": "vlt." <del> } <add> {ORTH: "vlt.", LEMMA: "vielleicht"} <ide> ], <add> <ide> "vor'm": [ <del> { <del> "F": "vor", <del> "L": "vor" <del> }, <del> { <del> "F": "'m", <del> "L": "dem" <del> } <del> ], <del> "vs.": [ <del> { <del> "F": "vs." <del> } <del> ], <del> "w.": [ <del> { <del> "F": "w." <del> } <add> {ORTH: "vor", LEMMA: "vor"}, <add> {ORTH: "'m", LEMMA: PRON_LEMMA} <ide> ], <add> <ide> "wir's": [ <del> { <del> "F": "wir", <del> "L": "wir" <del> }, <del> { <del> "F": "'s", <del> "L": "es" <del> } <del> ], <del> "wiss.": [ <del> { <del> "F": "wiss." <del> } <del> ], <del> "x.": [ <del> { <del> "F": "x." <del> } <del> ], <del> "xD": [ <del> { <del> "F": "xD" <del> } <del> ], <del> "xDD": [ <del> { <del> "F": "xDD" <del> } <del> ], <del> "y.": [ <del> { <del> "F": "y." <del> } <del> ], <del> "z.": [ <del> { <del> "F": "z." <del> } <add> {ORTH: "wir", LEMMA: PRON_LEMMA}, <add> {ORTH: "'s", LEMMA: PRON_LEMMA} <ide> ], <add> <ide> "z.B.": [ <del> { <del> "F": "z.B." <del> } <add> {ORTH: "z.B.", LEMMA: "zum Beispiel"} <ide> ], <add> <ide> "z.Bsp.": [ <del> { <del> "F": "z.Bsp." <del> } <add> {ORTH: "z.Bsp.", LEMMA: "zum Beispiel"} <ide> ], <add> <ide> "z.T.": [ <del> { <del> "F": "z.T." <del> } <add> {ORTH: "z.T.", LEMMA: "zum Teil"} <ide> ], <add> <ide> "z.Z.": [ <del> { <del> "F": "z.Z." <del> } <add> {ORTH: "z.Z.", LEMMA: "zur Zeit"} <ide> ], <add> <ide> "z.Zt.": [ <del> { <del> "F": "z.Zt." <del> } <add> {ORTH: "z.Zt.", LEMMA: "zur Zeit"} <ide> ], <add> <ide> "z.b.": [ <del> { <del> "F": "z.b." <del> } <add> {ORTH: "z.b.", LEMMA: "zum Beispiel"} <ide> ], <add> <ide> "zzgl.": [ <del> { <del> "F": "zzgl." <del> } <del> ], <del> "\u00e4.": [ <del> { <del> "F": "\u00e4." <del> } <del> ], <del> "\u00f6.": [ <del> { <del> "F": "\u00f6." <del> } <del> ], <del> "\u00f6sterr.": [ <del> { <del> "F": "\u00f6sterr." <del> } <del> ], <del> "\u00fc.": [ <del> { <del> "F": "\u00fc." <del> } <del> ], <del> "\u00fcber'm": [ <del> { <del> "F": "\u00fcber", <del> "L": "\u00fcber" <del> }, <del> { <del> "F": "'m", <del> "L": "dem" <del> } <add> {ORTH: "zzgl.", LEMMA: "zuzüglich"} <add> ], <add> <add> "österr.": [ <add> {ORTH: "österr.", LEMMA: "österreichisch"} <add> ], <add> <add> "über'm": [ <add> {ORTH: "über", LEMMA: "über"}, <add> {ORTH: "'m", LEMMA: PRON_LEMMA} <ide> ] <ide> } <ide> <ide> <del>TAG_MAP = { <del>"$(": {"pos": "PUNCT", "PunctType": "Brck"}, <del>"$,": {"pos": "PUNCT", "PunctType": "Comm"}, <del>"$.": {"pos": "PUNCT", "PunctType": "Peri"}, <del>"ADJA": {"pos": "ADJ"}, <del>"ADJD": {"pos": "ADJ", "Variant": "Short"}, <del>"ADV": {"pos": "ADV"}, <del>"APPO": {"pos": "ADP", "AdpType": "Post"}, <del>"APPR": {"pos": "ADP", "AdpType": "Prep"}, <del>"APPRART": {"pos": "ADP", "AdpType": "Prep", "PronType": "Art"}, <del>"APZR": {"pos": "ADP", "AdpType": "Circ"}, <del>"ART": {"pos": "DET", "PronType": "Art"}, <del>"CARD": {"pos": "NUM", "NumType": "Card"}, <del>"FM": {"pos": "X", "Foreign": "Yes"}, <del>"ITJ": {"pos": "INTJ"}, <del>"KOKOM": {"pos": "CONJ", "ConjType": "Comp"}, <del>"KON": {"pos": "CONJ"}, <del>"KOUI": {"pos": "SCONJ"}, <del>"KOUS": {"pos": "SCONJ"}, <del>"NE": {"pos": "PROPN"}, <del>"NNE": {"pos": "PROPN"}, <del>"NN": {"pos": "NOUN"}, <del>"PAV": {"pos": "ADV", "PronType": "Dem"}, <del>"PROAV": {"pos": "ADV", "PronType": "Dem"}, <del>"PDAT": {"pos": "DET", "PronType": "Dem"}, <del>"PDS": {"pos": "PRON", "PronType": "Dem"}, <del>"PIAT": {"pos": "DET", "PronType": "Ind,Neg,Tot"}, <del>"PIDAT": {"pos": "DET", "AdjType": "Pdt", "PronType": "Ind,Neg,Tot"}, <del>"PIS": {"pos": "PRON", "PronType": "Ind,Neg,Tot"}, <del>"PPER": {"pos": "PRON", "PronType": "Prs"}, <del>"PPOSAT": {"pos": "DET", "Poss": "Yes", "PronType": "Prs"}, <del>"PPOSS": {"pos": "PRON", "Poss": "Yes", "PronType": "Prs"}, <del>"PRELAT": {"pos": "DET", "PronType": "Rel"}, <del>"PRELS": {"pos": "PRON", "PronType": "Rel"}, <del>"PRF": {"pos": "PRON", "PronType": "Prs", "Reflex": "Yes"}, <del>"PTKA": {"pos": "PART"}, <del>"PTKANT": {"pos": "PART", "PartType": "Res"}, <del>"PTKNEG": {"pos": "PART", "Negative": "Neg"}, <del>"PTKVZ": {"pos": "PART", "PartType": "Vbp"}, <del>"PTKZU": {"pos": "PART", "PartType": "Inf"}, <del>"PWAT": {"pos": "DET", "PronType": "Int"}, <del>"PWAV": {"pos": "ADV", "PronType": "Int"}, <del>"PWS": {"pos": "PRON", "PronType": "Int"}, <del>"TRUNC": {"pos": "X", "Hyph": "Yes"}, <del>"VAFIN": {"pos": "AUX", "Mood": "Ind", "VerbForm": "Fin"}, <del>"VAIMP": {"pos": "AUX", "Mood": "Imp", "VerbForm": "Fin"}, <del>"VAINF": {"pos": "AUX", "VerbForm": "Inf"}, <del>"VAPP": {"pos": "AUX", "Aspect": "Perf", "VerbForm": "Part"}, <del>"VMFIN": {"pos": "VERB", "Mood": "Ind", "VerbForm": "Fin", "VerbType": "Mod"}, <del>"VMINF": {"pos": "VERB", "VerbForm": "Inf", "VerbType": "Mod"}, <del>"VMPP": {"pos": "VERB", "Aspect": "Perf", "VerbForm": "Part", "VerbType": "Mod"}, <del>"VVFIN": {"pos": "VERB", "Mood": "Ind", "VerbForm": "Fin"}, <del>"VVIMP": {"pos": "VERB", "Mood": "Imp", "VerbForm": "Fin"}, <del>"VVINF": {"pos": "VERB", "VerbForm": "Inf"}, <del>"VVIZU": {"pos": "VERB", "VerbForm": "Inf"}, <del>"VVPP": {"pos": "VERB", "Aspect": "Perf", "VerbForm": "Part"}, <del>"XY": {"pos": "X"}, <del>"SP": {"pos": "SPACE"} <del>} <add>self_map = [ <add> "''", <add> "\\\")", <add> "<space>", <add> "a.", <add> "ä.", <add> "A.C.", <add> "a.D.", <add> "A.D.", <add> "A.G.", <add> "a.M.", <add> "a.Z.", <add> "Abs.", <add> "adv.", <add> "al.", <add> "b.", <add> "B.A.", <add> "B.Sc.", <add> "betr.", <add> "biol.", <add> "Biol.", <add> "c.", <add> "ca.", <add> "Chr.", <add> "Cie.", <add> "co.", <add> "Co.", <add> "d.", <add> "D.C.", <add> "Dipl.-Ing.", <add> "Dipl.", <add> "Dr.", <add> "e.", <add> "e.g.", <add> "e.V.", <add> "ehem.", <add> "entspr.", <add> "erm.", <add> "etc.", <add> "ev.", <add> "f.", <add> "g.", <add> "G.m.b.H.", <add> "geb.", <add> "Gebr.", <add> "gem.", <add> "h.", <add> "h.c.", <add> "Hg.", <add> "hrsg.", <add> "Hrsg.", <add> "i.", <add> "i.A.", <add> "i.e.", <add> "i.G.", <add> "i.Tr.", <add> "i.V.", <add> "Ing.", <add> "j.", <add> "jr.", <add> "Jr.", <add> "jun.", <add> "jur.", <add> "k.", <add> "K.O.", <add> "l.", <add> "L.A.", <add> "lat.", <add> "m.", <add> "M.A.", <add> "m.E.", <add> "m.M.", <add> "M.Sc.", <add> "Mr.", <add> "n.", <add> "N.Y.", <add> "N.Y.C.", <add> "nat.", <add> "ö." <add> "o.", <add> "o.a.", <add> "o.ä.", <add> "o.g.", <add> "o.k.", <add> "O.K.", <add> "p.", <add> "p.a.", <add> "p.s.", <add> "P.S.", <add> "pers.", <add> "phil.", <add> "q.", <add> "q.e.d.", <add> "r.", <add> "R.I.P.", <add> "rer.", <add> "s.", <add> "sen.", <add> "St.", <add> "std.", <add> "t.", <add> "u.", <add> "ü.", <add> "u.a.", <add> "U.S.", <add> "U.S.A.", <add> "U.S.S.", <add> "v.", <add> "Vol.", <add> "vs.", <add> "w.", <add> "wiss.", <add> "x.", <add> "y.", <add> "z.", <add>] <add> <add> <add>TOKENIZER_PREFIXES = r''' <add>, <add>" <add>( <add>[ <add>{ <add>* <add>< <add>> <add>$ <add>£ <add>„ <add>“ <add>' <add>`` <add>` <add># <add>US$ <add>C$ <add>A$ <add>a- <add>‘ <add>.... <add>... <add>… <add>‚ <add>» <add>§ <add>'''.strip().split('\n') <add> <add> <add>TOKENIZER_SUFFIXES = r''' <add>, <add>\" <add>\) <add>\] <add>\} <add>\* <add>\! <add>\? <add>% <add>\$ <add>> <add>: <add>; <add>' <add>” <add>“ <add>« <add>_ <add>'' <add>'s <add>'S <add>’s <add>’S <add>’ <add>‘ <add>° <add>€ <add>… <add>\.\. <add>\.\.\. <add>\.\.\.\. <add>(?<=[a-zäöüßÖÄÜ)\]"'´«‘’%\)²“”])\. <add>\-\- <add>´ <add>(?<=[0-9])km² <add>(?<=[0-9])m² <add>(?<=[0-9])cm² <add>(?<=[0-9])mm² <add>(?<=[0-9])km³ <add>(?<=[0-9])m³ <add>(?<=[0-9])cm³ <add>(?<=[0-9])mm³ <add>(?<=[0-9])ha <add>(?<=[0-9])km <add>(?<=[0-9])m <add>(?<=[0-9])cm <add>(?<=[0-9])mm <add>(?<=[0-9])µm <add>(?<=[0-9])nm <add>(?<=[0-9])yd <add>(?<=[0-9])in <add>(?<=[0-9])ft <add>(?<=[0-9])kg <add>(?<=[0-9])g <add>(?<=[0-9])mg <add>(?<=[0-9])µg <add>(?<=[0-9])t <add>(?<=[0-9])lb <add>(?<=[0-9])oz <add>(?<=[0-9])m/s <add>(?<=[0-9])km/h <add>(?<=[0-9])mph <add>(?<=[0-9])°C <add>(?<=[0-9])°K <add>(?<=[0-9])°F <add>(?<=[0-9])hPa <add>(?<=[0-9])Pa <add>(?<=[0-9])mbar <add>(?<=[0-9])mb <add>(?<=[0-9])T <add>(?<=[0-9])G <add>(?<=[0-9])M <add>(?<=[0-9])K <add>(?<=[0-9])kb <add>'''.strip().split('\n') <add> <add> <add>TOKENIZER_INFIXES = r''' <add>… <add>\.\.\.+ <add>(?<=[a-z])\.(?=[A-Z]) <add>(?<=[a-zöäüßA-ZÖÄÜ"]):(?=[a-zöäüßA-ZÖÄÜ]) <add>(?<=[a-zöäüßA-ZÖÄÜ"])>(?=[a-zöäüßA-ZÖÄÜ]) <add>(?<=[a-zöäüßA-ZÖÄÜ"])<(?=[a-zöäüßA-ZÖÄÜ]) <add>(?<=[a-zöäüßA-ZÖÄÜ"])=(?=[a-zöäüßA-ZÖÄÜ]) <add>'''.strip().split('\n')
1
Go
Go
kill containers after restart tests
e07d78d247c796236e92faed6cfbe05177691d95
<ide><path>integration-cli/docker_cli_daemon_experimental_test.go <ide> func (s *DockerDaemonSuite) TestCleanupMountsAfterDaemonCrash(c *check.C) { <ide> c.Assert(strings.Contains(string(mountOut), id), check.Equals, false, comment) <ide> } <ide> <del>// TestDaemonRestartWithPausedRunningContainer requires live restore of running containers <del>func (s *DockerDaemonSuite) TestDaemonRestartWithPausedRunningContainer(t *check.C) { <del> if err := s.d.StartWithBusybox("--live-restore"); err != nil { <del> t.Fatal(err) <del> } <del> <del> cid, err := s.d.Cmd("run", "-d", "--name", "test", "busybox", "top") <del> defer s.d.Stop() <del> if err != nil { <del> t.Fatal(cid, err) <del> } <del> cid = strings.TrimSpace(cid) <del> <del> // Kill the daemon <del> if err := s.d.Kill(); err != nil { <del> t.Fatal(err) <del> } <del> <del> // kill the container <del> runCmd := exec.Command(ctrBinary, "--address", "unix:///var/run/docker/libcontainerd/docker-containerd.sock", "containers", "pause", cid) <del> if out, ec, err := runCommandWithOutput(runCmd); err != nil { <del> t.Fatalf("Failed to run ctr, ExitCode: %d, err: '%v' output: '%s' cid: '%s'\n", ec, err, out, cid) <del> } <del> <del> // Give time to containerd to process the command if we don't <del> // the pause event might be received after we do the inspect <del> time.Sleep(3 * time.Second) <del> <del> // restart the daemon <del> if err := s.d.Start("--live-restore"); err != nil { <del> t.Fatal(err) <del> } <del> <del> // Check that we've got the correct status <del> out, err := s.d.Cmd("inspect", "-f", "{{.State.Status}}", cid) <del> t.Assert(err, check.IsNil) <del> <del> out = strings.TrimSpace(out) <del> if out != "paused" { <del> t.Fatalf("Expected exit code '%s' got '%s' for container '%s'\n", "paused", out, cid) <del> } <del>} <del> <ide> // TestDaemonRestartWithUnpausedRunningContainer requires live restore of running containers. <ide> func (s *DockerDaemonSuite) TestDaemonRestartWithUnpausedRunningContainer(t *check.C) { <ide> // TODO(mlaventure): Not sure what would the exit code be on windows <ide> func (s *DockerDaemonSuite) TestDaemonRestartWithUnpausedRunningContainer(t *che <ide> if out != "running" { <ide> t.Fatalf("Expected exit code '%s' got '%s' for container '%s'\n", "running", out, cid) <ide> } <add> if _, err := s.d.Cmd("kill", cid); err != nil { <add> t.Fatal(err) <add> } <ide> }
1
Javascript
Javascript
remove redundant check for !has_this
7f773de4af3f2613fa9ec86d1b0132c6bdd0fcda
<ide><path>packages/ember-metal/lib/accessors.js <ide> Ember.trySetPath = function(root, path, value) { <ide> @returns Boolean <ide> */ <ide> Ember.isGlobalPath = function(path) { <del> return !HAS_THIS.test(path) && IS_GLOBAL.test(path); <add> return IS_GLOBAL.test(path); <ide> };
1
PHP
PHP
use an abstract class instead of public properties
13f6feb5dff388b9298a4513f4f8bc0d2e85357f
<ide><path>src/Console/Command/Task/BehaviorTask.php <ide> class BehaviorTask extends SimpleBakeTask { <ide> public $pathFragment = 'Model/Behavior/'; <ide> <ide> /** <del> * The name of the task used in menus and output. <del> * <del> * @var string <add> * {@inheritDoc} <ide> */ <del> public $name = 'behavior'; <add> public function name() { <add> return 'behavior'; <add> } <ide> <ide> /** <del> * The suffix appended to generated class files. <del> * <del> * @var string <add> * {@inheritDoc} <ide> */ <del> public $suffix = 'Behavior'; <add> public function fileName($name) { <add> return $name . 'Behavior.php'; <add> } <ide> <ide> /** <del> * Template name to use. <del> * <del> * @var string <add> * {@inheritDoc} <ide> */ <del> public $template = 'behavior'; <add> public function template() { <add> return 'behavior'; <add> } <ide> <ide> } <ide><path>src/Console/Command/Task/ComponentTask.php <ide> class ComponentTask extends SimpleBakeTask { <ide> public $pathFragment = 'Controller/Component/'; <ide> <ide> /** <del> * The name of the task used in menus and output. <del> * <del> * @var string <add> * {@inheritDoc} <ide> */ <del> public $name = 'component'; <add> public function name() { <add> return 'component'; <add> } <ide> <ide> /** <del> * The suffix appended to generated class files. <del> * <del> * @var string <add> * {@inheritDoc} <ide> */ <del> public $suffix = 'Component'; <add> public function fileName($name) { <add> return $name . 'Component.php'; <add> } <ide> <ide> /** <del> * Template name to use. <del> * <del> * @var string <add> * {@inheritDoc} <ide> */ <del> public $template = 'component'; <add> public function template() { <add> return 'component'; <add> } <ide> <ide> } <ide><path>src/Console/Command/Task/HelperTask.php <ide> class HelperTask extends SimpleBakeTask { <ide> public $pathFragment = 'View/Helper/'; <ide> <ide> /** <del> * The name of the task used in menus and output. <del> * <del> * @var string <add> * {@inheritDoc} <ide> */ <del> public $name = 'helper'; <add> public function name() { <add> return 'helper'; <add> } <ide> <ide> /** <del> * The suffix appended to generated class files. <del> * <del> * @var string <add> * {@inheritDoc} <ide> */ <del> public $suffix = 'Helper'; <add> public function fileName($name) { <add> return $name . 'Helper.php'; <add> } <ide> <ide> /** <del> * Template name to use. <del> * <del> * @var string <add> * {@inheritDoc} <ide> */ <del> public $template = 'helper'; <add> public function template() { <add> return 'helper'; <add> } <ide> <ide> } <ide><path>src/Console/Command/Task/SimpleBakeTask.php <ide> /** <ide> * Base class for simple bake tasks code generator. <ide> */ <del>class SimpleBakeTask extends BakeTask { <add>abstract class SimpleBakeTask extends BakeTask { <ide> <ide> /** <ide> * Tasks to be loaded by this Task <ide> class SimpleBakeTask extends BakeTask { <ide> public $tasks = ['Test', 'Template']; <ide> <ide> /** <del> * Task name used in path generation. <add> * Get the generated object's name. <ide> * <del> * @var string <add> * @return string <ide> */ <del> public $pathFragment; <add> abstract public function name(); <ide> <ide> /** <del> * The name of the task used in menus and output. <add> * Get the generated object's filename without the leading path. <ide> * <del> * @var string <add> * @param string $name The name of the object being generated <add> * @return string <ide> */ <del> public $name; <add> abstract public function fileName($name); <ide> <ide> /** <del> * The suffix appended to generated class files. <add> * Get the template name. <ide> * <del> * @var string <add> * @return string <ide> */ <del> public $suffix; <add> abstract public function template(); <ide> <ide> /** <del> * Template name to use. <add> * Get template data. <ide> * <del> * @var string <add> * @return array <ide> */ <del> public $template; <add> public function templateData() { <add> $namespace = Configure::read('App.namespace'); <add> if ($this->plugin) { <add> $namespace = Plugin::getNamespace($this->plugin); <add> } <add> return ['namespace' => $namespace]; <add> } <ide> <ide> /** <ide> * Execute method <ide> public function execute() { <ide> * @return void <ide> */ <ide> public function bake($name) { <del> $namespace = Configure::read('App.namespace'); <del> if ($this->plugin) { <del> $namespace = Plugin::getNamespace($this->plugin); <del> } <del> $data = compact('name', 'namespace'); <del> $this->Template->set($data); <del> $contents = $this->Template->generate('classes', $this->template); <add> $this->Template->set('name', $name); <add> $this->Template->set($this->templateData()); <add> $contents = $this->Template->generate('classes', $this->template()); <ide> <del> $path = $this->getPath(); <del> $filename = $path . $name . $this->suffix . '.php'; <add> $filename = $this->getPath() . $this->fileName($name); <ide> $this->createFile($filename, $contents); <ide> return $contents; <ide> } <ide> public function bakeTest($className) { <ide> return; <ide> } <ide> $this->Test->plugin = $this->plugin; <del> return $this->Test->bake($this->name, $className); <add> return $this->Test->bake($this->name(), $className); <ide> } <ide> <ide> /** <ide> public function bakeTest($className) { <ide> */ <ide> public function getOptionParser() { <ide> $parser = parent::getOptionParser(); <add> $name = $this->name(); <ide> $parser->description( <del> __d('cake_console', 'Bake a %s class file.', $this->name) <add> __d('cake_console', 'Bake a %s class file.', $name) <ide> )->addArgument('name', [ <ide> 'help' => __d( <ide> 'cake_console', <ide> 'Name of the %s to bake. Can use Plugin.name to bake %s files into plugins.', <del> $this->name, <del> $this->name <add> $name, <add> $name <ide> ) <ide> ])->addOption('plugin', [ <ide> 'short' => 'p', <del> 'help' => __d('cake_console', 'Plugin to bake the %s into.', $this->name) <add> 'help' => __d('cake_console', 'Plugin to bake the %s into.', $name) <ide> ])->addOption('theme', [ <ide> 'short' => 't', <ide> 'help' => __d('cake_console', 'Theme to use when baking code.') <ide><path>tests/TestCase/Console/Command/Task/SimpleBakeTaskTest.php <ide> <ide> /** <ide> * SimpleBakeTaskTest class <del> * <ide> */ <ide> class SimpleBakeTaskTest extends TestCase { <ide> <ide> public function setUp() { <ide> $out = $this->getMock('Cake\Console\ConsoleOutput', [], [], '', false); <ide> $in = $this->getMock('Cake\Console\ConsoleInput', [], [], '', false); <ide> <del> $this->Task = $this->getMock('Cake\Console\Command\Task\SimpleBakeTask', <del> ['in', 'err', 'createFile', '_stop', 'clear'], <add> $this->Task = $this->getMock( <add> 'Cake\Console\Command\Task\SimpleBakeTask', <add> ['in', 'err', 'createFile', '_stop', 'name', 'template', 'fileName'], <ide> [$out, $out, $in] <ide> ); <ide> $this->Task->Test = $this->getMock('Cake\Console\Command\Task\TestTask', <ide> public function setUp() { <ide> $this->Task->Template->initialize(); <ide> <ide> $this->Task->pathFragment = 'Model/Behavior/'; <del> $this->Task->suffix = 'Behavior'; <del> $this->Task->template = 'behavior'; <del> $this->Task->name = 'behavior'; <add> <add> $this->Task->expects($this->any()) <add> ->method('name') <add> ->will($this->returnValue('behavior')); <add> <add> $this->Task->expects($this->any()) <add> ->method('template') <add> ->will($this->returnValue('behavior')); <add> <add> $this->Task->expects($this->any()) <add> ->method('fileName') <add> ->will($this->returnValue('ExampleBehavior.php')); <ide> } <ide> <ide> /** <ide> public function testBakePlugin() { <ide> $this->assertContains('class ExampleBehavior extends Behavior {', $result); <ide> } <ide> <add>/** <add> * Provider for subclasses. <add> * <add> * @return array <add> */ <add> public function subclassProvider() { <add> return [ <add> ['Cake\Console\Command\Task\BehaviorTask'], <add> ['Cake\Console\Command\Task\ComponentTask'], <add> ['Cake\Console\Command\Task\HelperTask'], <add> ]; <add> } <add> <add>/** <add> * Test that the various implementations are sane. <add> * <add> * @dataProvider subclassProvider <add> * @return void <add> */ <add> public function testImplementations($class) { <add> $out = $this->getMock('Cake\Console\ConsoleOutput', [], [], '', false); <add> $in = $this->getMock('Cake\Console\ConsoleInput', [], [], '', false); <add> $task = new $class($out, $out, $in); <add> $this->assertInternalType('string', $task->name()); <add> $this->assertInternalType('string', $task->fileName('Example')); <add> $this->assertInternalType('string', $task->template()); <add> } <add> <ide> }
5
Python
Python
add more information to podlauncher timeout error
c8b86e69e49e330ab2f551358a6998d5800adb9a
<ide><path>airflow/providers/cncf/kubernetes/utils/pod_launcher.py <ide> def start_pod(self, pod: V1Pod, startup_timeout: int = 120): <ide> Launches the pod synchronously and waits for completion. <ide> <ide> :param pod: <del> :param startup_timeout: Timeout for startup of the pod (if pod is pending for too long, fails task) <add> :param startup_timeout: Timeout (in seconds) for startup of the pod <add> (if pod is pending for too long, fails task) <ide> :return: <ide> """ <ide> resp = self.run_pod_async(pod) <ide> def start_pod(self, pod: V1Pod, startup_timeout: int = 120): <ide> self.log.warning("Pod not yet started: %s", pod.metadata.name) <ide> delta = dt.now() - curr_time <ide> if delta.total_seconds() >= startup_timeout: <del> raise AirflowException("Pod took too long to start") <add> msg = ( <add> f"Pod took longer than {startup_timeout} seconds to start. " <add> "Check the pod events in kubernetes to determine why." <add> ) <add> raise AirflowException(msg) <ide> time.sleep(1) <ide> <ide> def monitor_pod(self, pod: V1Pod, get_logs: bool) -> Tuple[State, V1Pod, Optional[str]]: <ide><path>tests/providers/cncf/kubernetes/utils/test_pod_launcher.py <ide> def test_start_pod_retries_three_times(self, mock_run_pod_async): <ide> self.pod_launcher.start_pod(mock.sentinel) <ide> <ide> assert mock_run_pod_async.call_count == 3 <add> <add> @mock.patch("airflow.providers.cncf.kubernetes.utils.pod_launcher.PodLauncher.pod_not_started") <add> @mock.patch("airflow.providers.cncf.kubernetes.utils.pod_launcher.PodLauncher.run_pod_async") <add> def test_start_pod_raises_informative_error_on_timeout(self, mock_run_pod_async, mock_pod_not_started): <add> pod_response = mock.MagicMock() <add> pod_response.status.start_time = None <add> mock_run_pod_async.return_value = pod_response <add> mock_pod_not_started.return_value = True <add> expected_msg = "Check the pod events in kubernetes" <add> with pytest.raises(AirflowException, match=expected_msg): <add> self.pod_launcher.start_pod( <add> pod=mock.sentinel, <add> startup_timeout=0, <add> )
2
Text
Text
add changelog for
32ff2c2bf3e0d55d58c919298ee0084fe394b939
<ide><path>activerecord/CHANGELOG.md <add>* Rails can now verify foreign keys after loading fixtures in tests. <add> <add> This will be the default for new apps in Rails 7. To opt in: <add> <add> ```ruby <add> config.active_record.verify_foreign_keys_for_fixtures = true <add> ``` <add> <add> Tests will not run if there is a foreign key constraint violation in your fixture data. <add> <add> The feature is supported by SQLite and PostgreSQL, other adapters can also add support for it. <add> <add> *Alex Ghiculescu* <add> <ide> * Clear cached `has_one` association after setting `belongs_to` association to `nil`. <ide> <ide> After setting a `belongs_to` relation to `nil` and updating an unrelated attribute on the owner,
1
PHP
PHP
fix language lines
0c2389ccb31cc888eb1dcb5f129e255a2a0574df
<ide><path>app/lang/en/validation.php <ide> "integer" => "The :attribute must be an integer.", <ide> "ip" => "The :attribute must be a valid IP address.", <ide> "max" => array( <del> "numeric" => "The :attribute must be less than :max.", <del> "file" => "The :attribute must be less than :max kilobytes.", <del> "string" => "The :attribute must be less than :max characters.", <add> "numeric" => "The :attribute may not be greater than :max.", <add> "file" => "The :attribute may not be greater than :max kilobytes.", <add> "string" => "The :attribute may not be greater than :max characters.", <ide> ), <ide> "mimes" => "The :attribute must be a file of type: :values.", <ide> "min" => array(
1
Text
Text
fix typo in getting_started [ci skip]
85b2a3ea2f4b614c1b7135e28b86e14fc109e8e5
<ide><path>guides/source/getting_started.md <ide> one here because the `ArticlesController` inherits from `ApplicationController`. <ide> The next part of the message contains `request.formats` which specifies <ide> the format of template to be served in response. It is set to `text/html` as we <ide> requested this page via browser, so Rails is looking for an HTML template. <del>`request.variants` specifies what kind of physical devices would be served by <add>`request.variant` specifies what kind of physical devices would be served by <ide> the response and helps Rails determine which template to use in the response. <ide> It is empty because no information has been provided. <ide>
1
Text
Text
add changes for 1.4.0-beta.5 and 1.3.14
57aa00e5dce758cfd32121728dcb82f091aa694e
<ide><path>CHANGELOG.md <add><a name="1.4.0-beta.5"></a> <add># 1.4.0-beta.5 karmic-stabilization (2015-02-24) <add> <add> <add>## Bug Fixes <add> <add>- **$http:** properly access request headers with mixed case <add> ([5da1256f](https://github.com/angular/angular.js/commit/5da1256fc2812d5b28fb0af0de81256054856369), <add> [#10881](https://github.com/angular/angular.js/issues/10881), [#10883](https://github.com/angular/angular.js/issues/10883)) <add>- **input:** create max and/or min validator regardless of initial value <add> ([c211e7a5](https://github.com/angular/angular.js/commit/c211e7a5ad5f1fb8748125f14912aa8715081925), <add> [#10307](https://github.com/angular/angular.js/issues/10307), [#10327](https://github.com/angular/angular.js/issues/10327)) <add>- **ngAria:** correctly set "checked" attr for checkboxes and radios <add> ([d6eba217](https://github.com/angular/angular.js/commit/d6eba21733c6e67e90e3a4763d8d41ad89a73a0c), <add> [#10389](https://github.com/angular/angular.js/issues/10389), [#10212](https://github.com/angular/angular.js/issues/10212)) <add>- **ngModel:** fix issues when parserName is same as validator key <add> ([056a3170](https://github.com/angular/angular.js/commit/056a31700803c0a6014b43cfcc36c5c500cc596e), <add> [#10698](https://github.com/angular/angular.js/issues/10698), [#10850](https://github.com/angular/angular.js/issues/10850), [#11046](https://github.com/angular/angular.js/issues/11046)) <add>- **ngOptions:** ngModel is optional <add> ([ef894c87](https://github.com/angular/angular.js/commit/ef894c87eaead76d90169113ab6acc9287654ea3)) <add>- **ngSanitize:** Do not ignore white-listed svg camelCased attributes <add> ([46b80654](https://github.com/angular/angular.js/commit/46b80654cae9105642909cd55f73f7c26d2fbd80), <add> [#10779](https://github.com/angular/angular.js/issues/10779), [#10990](https://github.com/angular/angular.js/issues/10990), [#11124](https://github.com/angular/angular.js/issues/11124)) <add>- **select:** remove unknown option when model is undefined and empty option is available <add> ([30b48132](https://github.com/angular/angular.js/commit/30b48132e0fb92ea8dd25a9794b4c41a3a81a951), <add> [#11078](https://github.com/angular/angular.js/issues/11078), [#11092](https://github.com/angular/angular.js/issues/11092)) <add>- **templateRequest:** avoid throwing syntax error in Android 2.3 <add> ([f6272333](https://github.com/angular/angular.js/commit/f6272333127d908b19da23f9cd8a74052711795b), <add> [#11089](https://github.com/angular/angular.js/issues/11089), [#11051](https://github.com/angular/angular.js/issues/11051), [#11088](https://github.com/angular/angular.js/issues/11088)) <add> <add> <add>## Features <add> <add>- **CommonJS:** - angular modules are now packaged for npm with helpful exports <add> <add>- **limitTo:** extend the filter to take a beginning index argument <add> ([aaae3cc4](https://github.com/angular/angular.js/commit/aaae3cc4160417e6dad802ed9d9f6d5471821a87), <add> [#5355](https://github.com/angular/angular.js/issues/5355), [#10899](https://github.com/angular/angular.js/issues/10899)) <add>- **ngMessages:** provide support for dynamic message resolution <add> ([c9a4421f](https://github.com/angular/angular.js/commit/c9a4421fc3c97448527eadef1f42eb2f487ec2e0), <add> [#10036](https://github.com/angular/angular.js/issues/10036), [#9338](https://github.com/angular/angular.js/issues/9338)) <add>- **ngOptions:** add support for disabling an option <add> ([da9eac86](https://github.com/angular/angular.js/commit/da9eac8660343b1cd9fdcf9d2d1bda06067142d7), <add> [#638](https://github.com/angular/angular.js/issues/638), [#11017](https://github.com/angular/angular.js/issues/11017)) <add> <add> <add>## Performance Improvements <add> <add>- **$compile:** <add> - replace forEach(controller) with plain loops <add> ([5b522867](https://github.com/angular/angular.js/commit/5b5228675f67c8f5e04c7183c3ef5e71cb2bf08b), <add> [#11084](https://github.com/angular/angular.js/issues/11084)) <add> - avoid .data when fetching required controllers <add> ([fa0aa839](https://github.com/angular/angular.js/commit/fa0aa83937378cf8fc720c38bcc5c78fc923624e)) <add>- **ngOptions:** only watch labels if a display expression is specified <add> ([51faaffd](https://github.com/angular/angular.js/commit/51faaffdbcc734c55d52ff6c42b386d5c90207ea)) <add> <add> <add>## Breaking Changes <add> <add>- **ngMessages:** due to [c9a4421f](https://github.com/angular/angular.js/commit/c9a4421fc3c97448527eadef1f42eb2f487ec2e0), <add> <add> <add>The `ngMessagesInclude` attribute is now its own directive and that must <add>be placed as a **child** element within the element with the ngMessages <add>directive. (Keep in mind that the former behaviour of the <add>ngMessageInclude attribute was that all **included** ngMessage template <add>code was placed at the **bottom** of the element containing the <add>ngMessages directive; therefore to make this behave in the same way, <add>place the element containing the ngMessagesInclude directive at the <add>end of the container containing the ngMessages directive). <add> <add>```html <add><!-- AngularJS 1.3.x --> <add><div ng-messages="model.$error" ng-messages-include="remote.html"> <add> <div ng-message="required">Your message is required</div> <add></div> <add> <add><!-- AngularJS 1.4.x --> <add><div ng-messages="model.$error"> <add> <div ng-message="required">Your message is required</div> <add> <div ng-messages-include="remote.html"></div> <add></div> <add>``` <add> <add> <add><a name="1.3.14"></a> <add># 1.3.14 instantaneous-browserification (2015-02-24) <add> <add> <add>## Features <add> <add>- **CommonJS:** - angular modules are now packaged for npm with helpful exports <add> <add>## Bug Fixes <add> <add>- **input:** create max and/or min validator regardless of initial value <add> ([abfce532](https://github.com/angular/angular.js/commit/abfce5327ce6fd29c33c62d2edf3600674a6b4c0), <add> [#10307](https://github.com/angular/angular.js/issues/10307), [#10327](https://github.com/angular/angular.js/issues/10327)) <add>- **ngAria:** correctly set "checked" attr for checkboxes and radios <add> ([944c150e](https://github.com/angular/angular.js/commit/944c150e6c3001e51d4bf5e2d8149ae4c565d1e3), <add> [#10389](https://github.com/angular/angular.js/issues/10389), [#10212](https://github.com/angular/angular.js/issues/10212)) <add>- **ngModel:** fix issues when parserName is same as validator key <add> ([6b7625a0](https://github.com/angular/angular.js/commit/6b7625a09508c4b5355121a9d4206a734b07b2e1), <add> [#10698](https://github.com/angular/angular.js/issues/10698), [#10850](https://github.com/angular/angular.js/issues/10850), [#11046](https://github.com/angular/angular.js/issues/11046)) <add> <add> <add> <ide> <a name="1.4.0-beta.4"></a> <ide> # 1.4.0-beta.4 overlyexplosive-poprocks (2015-02-09) <ide>
1
Javascript
Javascript
add route for lear redirects
d3567fbb9bc3171c7a98eb0b428468bc516d09e5
<ide><path>server/middlewares/email-not-verified-notice.js <ide> const EXCLUDED_PATHS = [ <ide> '/api/flyers/findOne', <ide> '/signout', <ide> '/update-email', <del> '/passwordless-change' <add> '/passwordless-change', <add> '/external/services/user' <ide> ]; <ide> <ide> export default function emailNotVerifiedNotice() {
1
PHP
PHP
change fromdata to new cspbuilder
74215789f44485bf6acf2baf7238185695e17d75
<ide><path>src/Http/Middleware/CspMiddleware.php <ide> public function __construct($csp = null) <ide> } <ide> <ide> if (!empty($cspConfig) && is_array($cspConfig)) { <del> $this->csp = CSPBuilder::fromData(json_encode($cspConfig)); <add> $this->csp = new CSPBuilder($cspConfig); <ide> <ide> return; <ide> }
1
Python
Python
show help on "spacy project"
c874dde66c84d9b162c87e09d7a84548c3c36f6e
<ide><path>spacy/cli/project.py <ide> re-run if their inputs change. <ide> """ <ide> <del>project_cli = typer.Typer(help=CLI_HELP) <add>project_cli = typer.Typer(help=CLI_HELP, no_args_is_help=True) <ide> <ide> <ide> @project_cli.callback(invoke_without_command=True)
1
Ruby
Ruby
remove special case for now-deprecated github urls
22038d5269d591ecc6646eba8b474d6320f7c476
<ide><path>Library/Homebrew/download_strategy.rb <ide> def basename_without_params <ide> end <ide> <ide> def ext <del> # GitHub uses odd URLs for zip files, so check for those <del> rx=%r[https?://(www\.)?github\.com/.*/(zip|tar)ball/] <del> if rx.match @url <del> if $2 == 'zip' <del> '.zip' <del> else <del> '.tgz' <del> end <del> else <del> # Strip any ?thing=wad out of .c?thing=wad style extensions <del> (Pathname.new(@url).extname)[/[^?]+/] <del> end <add> # We need a Pathname because we've monkeypatched extname to support double <add> # extensions (e.g. tar.gz). <add> # We can't use basename_without_params, because given a URL like <add> # http://example.com/download.php?file=foo-1.0.tar.gz <add> # the extension we want is ".tar.gz", not ".php". <add> Pathname.new(@url).extname[/[^?]+/] <ide> end <ide> end <ide>
1
Python
Python
fix typo and some grammar
eb4c08d6a4918b223009245027ad92f37c4e0655
<ide><path>numpy/doc/indexing.py <ide> <ide> That is, each index specified selects the array corresponding to the <ide> rest of the dimensions selected. In the above example, choosing 0 <del>means that remaining dimension of lenth 5 is being left unspecified, <add>means that the remaining dimension of length 5 is being left unspecified, <ide> and that what is returned is an array of that dimensionality and size. <ide> It must be noted that the returned array is not a copy of the original, <ide> but points to the same values in memory as does the original array. <ide> 2 <ide> <ide> So note that ``x[0,2] = x[0][2]`` though the second case is more <del>inefficient a new temporary array is created after the first index <add>inefficient as a new temporary array is created after the first index <ide> that is subsequently indexed by 2. <ide> <ide> Note to those used to IDL or Fortran memory order as it relates to
1
Ruby
Ruby
add missing nsec test for 17f5d8e
a272d0cbe22369948e4fedf66a5889240b5e7b25
<ide><path>activesupport/test/core_ext/time_with_zone_test.rb <ide> def test_usec_returns_sec_fraction_when_datetime_is_wrapped <ide> assert_equal 500000, twz.usec <ide> end <ide> <add> def test_nsec_returns_sec_fraction_when_datetime_is_wrapped <add> twz = ActiveSupport::TimeWithZone.new(DateTime.civil(2000, 1, 1, 0, 0, Rational(1,2)), @time_zone) <add> assert_equal 500000000, twz.nsec <add> end <add> <ide> def test_utc_to_local_conversion_saves_period_in_instance_variable <ide> assert_nil @twz.instance_variable_get('@period') <ide> @twz.time
1
Ruby
Ruby
fix relative dir call on test runner
de94929d70d94fd8bb20791bf544ee483db8ddc1
<ide><path>railties/lib/rails/test_unit/runner.rb <ide> def self.parse(args) <ide> <ide> options[:patterns] = [] <ide> while arg = args.shift <del> if Dir.exists?(arg) <del> options[:patterns] << "#{arg}/**/*_test.rb" <del> else <del> options[:filename], options[:line] = arg.split(':') <add> if (file_and_line = arg.split(':')).size > 1 <add> options[:filename], options[:line] = file_and_line <ide> options[:filename] = File.expand_path options[:filename] <ide> options[:line] &&= options[:line].to_i <add> else <add> arg = arg.gsub(':', '') <add> if Dir.exists?("test/#{arg}") <add> options[:patterns] << File.expand_path("test/#{arg}/**/*_test.rb") <add> elsif File.file?(arg) <add> options[:patterns] << File.expand_path(arg) <add> end <ide> end <ide> end <ide> options <ide> def show_backtrace? <ide> <ide> def test_files <ide> return [@options[:filename]] if @options[:filename] <del> if @options[:patterns] <add> if @options[:patterns] && @options[:patterns].count > 0 <ide> pattern = @options[:patterns] <ide> else <ide> pattern = "test/**/*_test.rb" <ide><path>railties/test/test_unit/runner_test.rb <ide> class TestUnitTestRunnerTest < ActiveSupport::TestCase <ide> end <ide> <ide> test "parse the filename and line" do <del> options = @options.parse(["foobar.rb:20"]) <del> assert_equal File.expand_path("foobar.rb"), options[:filename] <add> file = "test/test_unit/runner_test.rb" <add> absolute_file = __FILE__ <add> options = @options.parse(["#{file}:20"]) <add> assert_equal absolute_file, options[:filename] <ide> assert_equal 20, options[:line] <ide> <del> options = @options.parse(["foobar.rb:"]) <del> assert_equal File.expand_path("foobar.rb"), options[:filename] <add> options = @options.parse(["#{file}:"]) <add> assert_equal [absolute_file], options[:patterns] <ide> assert_nil options[:line] <ide> <del> options = @options.parse(["foobar.rb"]) <del> assert_equal File.expand_path("foobar.rb"), options[:filename] <add> options = @options.parse([file]) <add> assert_equal [absolute_file], options[:patterns] <ide> assert_nil options[:line] <ide> end <ide> <ide> class TestUnitTestRunnerTest < ActiveSupport::TestCase <ide> end <ide> <ide> test "run all tests in a directory" do <del> options = @options.parse([__dir__]) <add> dir = Pathname.new(__dir__).basename.to_s <add> options = @options.parse([dir]) <ide> <ide> assert_equal ["#{__dir__}/**/*_test.rb"], options[:patterns] <ide> assert_nil options[:filename] <ide> assert_nil options[:line] <ide> end <ide> <del> test "run multiple files" do <add> test "run multiple folders" do <ide> application_dir = File.expand_path("#{__dir__}/../application") <del> options = @options.parse([__dir__, application_dir]) <add> <add> options = @options.parse([Pathname.new(__dir__).basename.to_s, Pathname.new(application_dir).basename.to_s]) <ide> <ide> assert_equal ["#{__dir__}/**/*_test.rb", "#{application_dir}/**/*_test.rb"], options[:patterns] <ide> assert_nil options[:filename] <ide> class TestUnitTestRunnerTest < ActiveSupport::TestCase <ide> <ide> test "run multiple files and run one file by line" do <ide> line = __LINE__ <del> options = @options.parse([__dir__, "#{__FILE__}:#{line}"]) <add> options = @options.parse([Pathname.new(__dir__).basename.to_s, "#{__FILE__}:#{line}"]) <ide> <ide> assert_equal ["#{__dir__}/**/*_test.rb"], options[:patterns] <ide> assert_equal __FILE__, options[:filename]
2
Javascript
Javascript
make $q.reject support `finally` and `catch`
074b0675a1f97dce07f520f1ae6198ed3c604000
<ide><path>src/ng/q.js <ide> function qFactory(nextTick, exceptionHandler) { <ide> <ide> <ide> reject: function(reason) { <del> deferred.resolve(reject(reason)); <add> deferred.resolve(createInternalRejectedPromise(reason)); <ide> }, <ide> <ide> <ide> function qFactory(nextTick, exceptionHandler) { <ide> * @returns {Promise} Returns a promise that was already resolved as rejected with the `reason`. <ide> */ <ide> var reject = function(reason) { <add> var result = defer(); <add> result.reject(reason); <add> return result.promise; <add> }; <add> <add> var createInternalRejectedPromise = function(reason) { <ide> return { <ide> then: function(callback, errback) { <ide> var result = defer(); <ide><path>test/ng/qSpec.js <ide> describe('q', function() { <ide> mockNextTick.flush(); <ide> expect(log).toEqual(['errorBroken(rejected)->throw(catch me!)', 'errorAffected(catch me!)->reject(catch me!)']); <ide> }); <add> <add> <add> it('should have functions `finally` and `catch`', function() { <add> var rejectedPromise = q.reject('rejected'); <add> expect(rejectedPromise['finally']).not.toBeUndefined(); <add> expect(rejectedPromise['catch']).not.toBeUndefined(); <add> }); <ide> }); <ide> <ide>
2