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
|
---|---|---|---|---|---|
Text | Text | fix typo in animations guide | c748d692a456d6d5072d3e670b014518eb3dd854 | <ide><path>docs/Animations.md
<ide> manage frame updates for you.
<ide>
<ide> ### `setNativeProps`
<ide>
<del>As mentioned [in the Direction Manipulation section](docs/direct-manipulation.html),
<add>As mentioned [in the Direct Manipulation section](docs/direct-manipulation.html),
<ide> `setNativeProps` allows us to modify properties of native-backed
<ide> components (components that are actually backed by native views, unlike
<ide> composite components) directly, without having to `setState` and | 1 |
Ruby | Ruby | migrate everyone to new repository | 72d0154454a1d4fe4dd94d4a3abf94ad65d2b77b | <ide><path>Library/Homebrew/cmd/update-report.rb
<ide> def migrate_legacy_cache_if_necessary
<ide> def migrate_legacy_repository_if_necessary
<ide> return unless HOMEBREW_PREFIX.to_s == "/usr/local"
<ide> return unless HOMEBREW_REPOSITORY.to_s == "/usr/local"
<del> return unless ARGV.homebrew_developer?
<ide>
<ide> ohai "Migrating HOMEBREW_REPOSITORY (please wait)..."
<ide> | 1 |
Text | Text | add template titles | 57c02af359a948aef5e1bbf3d74b82395c0b7287 | <ide><path>.github/ISSUE_TEMPLATE/bug.md
<ide> about: "If you're sure it's reproducible and not just your machine: submit an is
<ide>
<ide> ---
<ide>
<add># Bug report
<add>
<ide> **Please note we will close your issue without comment if you delete, do not read or do not fill out the issue checklist below and provide ALL the requested information. If you repeatedly fail to use the issue template, we will block you from ever submitting issues to Homebrew again.**
<ide>
<ide> - [ ] ran `brew update` and can still reproduce the problem?
<ide><path>.github/ISSUE_TEMPLATE/feature.md
<ide> about: Request our thoughts on your suggestion for a new feature for Homebrew.
<ide>
<ide> ---
<ide>
<add># Feature suggestion
<add>
<ide> **Please note we will close your issue without comment if you delete, do not read or do not fill out the issue checklist below and provide ALL the requested information. If you repeatedly fail to use the issue template, we will block you from ever submitting issues to Homebrew again.**
<ide>
<ide> <!-- Please fill these sections with the relevant information: --> | 2 |
Javascript | Javascript | expose decoratedcomponent as static property | 464f30d60ffe8f934369e03ce548465996c4fb27 | <ide><path>src/components/createConnectDecorator.js
<ide> export default function createConnectDecorator(React, Connector) {
<ide> return function connect(select) {
<ide> return DecoratedComponent => class ConnectorDecorator extends Component {
<ide> static displayName = `Connector(${getDisplayName(DecoratedComponent)})`;
<add> static DecoratedComponent = DecoratedComponent;
<ide>
<ide> shouldComponentUpdate(nextProps) {
<ide> return !shallowEqualScalar(this.props, nextProps);
<ide><path>src/components/createProvideDecorator.js
<ide> export default function createProvideDecorator(React, Provider) {
<ide> return function provide(redux) {
<ide> return DecoratedComponent => class ProviderDecorator extends Component {
<ide> static displayName = `Provider(${getDisplayName(DecoratedComponent)})`;
<add> static DecoratedComponent = DecoratedComponent;
<ide>
<ide> render() {
<ide> return (
<ide><path>test/components/connect.spec.js
<ide> describe('React', () => {
<ide>
<ide> expect(Container.displayName).toBe('Connector(Container)');
<ide> });
<add>
<add> it('sets DecoratedComponent to wrapped component', () => {
<add> class Container extends Component {
<add> render() {
<add> return <div />;
<add> }
<add> }
<add>
<add> let decorator = connect(state => state);
<add> let ConnectorDecorator = decorator(Container);
<add>
<add> expect(ConnectorDecorator.DecoratedComponent).toBe(Container);
<add> });
<ide> });
<ide> });
<ide><path>test/components/provide.spec.js
<ide> describe('React', () => {
<ide>
<ide> expect(Container.displayName).toBe('Provider(Container)');
<ide> });
<add>
<add> it('sets DecoratedComponent to wrapped component', () => {
<add> class Container extends Component {
<add> render() {
<add> return <div />;
<add> }
<add> }
<add>
<add> let decorator = provide(state => state);
<add> let ProviderDecorator = decorator(Container);
<add>
<add> expect(ProviderDecorator.DecoratedComponent).toBe(Container);
<add> });
<ide> });
<ide> }); | 4 |
Text | Text | update tutorial for 3.0 | a58cfe167d837d34994b50f52098c552f6b0860e | <ide><path>docs/tutorial/1-serialization.md
<ide> Once that's done we can create an app that we'll use to create a simple Web API.
<ide>
<ide> python manage.py startapp snippets
<ide>
<del>The simplest way to get up and running will probably be to use an `sqlite3` database for the tutorial. Edit the `tutorial/settings.py` file, and set the default database `"ENGINE"` to `"sqlite3"`, and `"NAME"` to `"tmp.db"`.
<del>
<del> DATABASES = {
<del> 'default': {
<del> 'ENGINE': 'django.db.backends.sqlite3',
<del> 'NAME': 'tmp.db',
<del> 'USER': '',
<del> 'PASSWORD': '',
<del> 'HOST': '',
<del> 'PORT': '',
<del> }
<del> }
<del>
<del>We'll also need to add our new `snippets` app and the `rest_framework` app to `INSTALLED_APPS`.
<add>We'll need to add our new `snippets` app and the `rest_framework` app to `INSTALLED_APPS`. Let's edit the `tutorial/settings.py` file:
<ide>
<ide> INSTALLED_APPS = (
<ide> ...
<ide> Okay, we're ready to roll.
<ide>
<ide> ## Creating a model to work with
<ide>
<del>For the purposes of this tutorial we're going to start by creating a simple `Snippet` model that is used to store code snippets. Go ahead and edit the `snippets` app's `models.py` file. Note: Good programming practices include comments. Although you will find them in our repository version of this tutorial code, we have omitted them here to focus on the code itself.
<add>For the purposes of this tutorial we're going to start by creating a simple `Snippet` model that is used to store code snippets. Go ahead and edit the `snippets/models.py` file. Note: Good programming practices include comments. Although you will find them in our repository version of this tutorial code, we have omitted them here to focus on the code itself.
<ide>
<ide> from django.db import models
<ide> from pygments.lexers import get_all_lexers
<ide> For the purposes of this tutorial we're going to start by creating a simple `Sni
<ide> class Meta:
<ide> ordering = ('created',)
<ide>
<del>Don't forget to sync the database for the first time.
<add>We'll also need to create an initial migration for our snippet model, and sync the database for the first time.
<ide>
<del> python manage.py syncdb
<add> python manage.py makemigrations snippets
<add> python manage.py migrate
<ide>
<ide> ## Creating a Serializer class
<ide>
<ide> The first thing we need to get started on our Web API is to provide a way of ser
<ide>
<ide>
<ide> class SnippetSerializer(serializers.Serializer):
<del> pk = serializers.Field() # Note: `Field` is an untyped read-only field.
<add> pk = serializers.IntegerField(read_only=True)
<ide> title = serializers.CharField(required=False,
<ide> max_length=100)
<del> code = serializers.CharField(widget=widgets.Textarea,
<del> max_length=100000)
<add> code = serializers.CharField(style={'type': 'textarea'})
<ide> linenos = serializers.BooleanField(required=False)
<ide> language = serializers.ChoiceField(choices=LANGUAGE_CHOICES,
<ide> default='python')
<ide> style = serializers.ChoiceField(choices=STYLE_CHOICES,
<ide> default='friendly')
<ide>
<del> def restore_object(self, attrs, instance=None):
<add> def create(self, validated_attrs):
<ide> """
<del> Create or update a new snippet instance, given a dictionary
<del> of deserialized field values.
<add> Create and return a new `Snippet` instance, given the validated data.
<add> """
<add> return Snippet.objects.create(**validated_attrs)
<ide>
<del> Note that if we don't define this method, then deserializing
<del> data will simply return a dictionary of items.
<add> def update(self, instance, validated_attrs):
<add> """
<add> Update and return an existing `Snippet` instance, given the validated data.
<ide> """
<del> if instance:
<del> # Update existing instance
<del> instance.title = attrs.get('title', instance.title)
<del> instance.code = attrs.get('code', instance.code)
<del> instance.linenos = attrs.get('linenos', instance.linenos)
<del> instance.language = attrs.get('language', instance.language)
<del> instance.style = attrs.get('style', instance.style)
<del> return instance
<add> instance.title = validated_attrs.get('title', instance.title)
<add> instance.code = validated_attrs.get('code', instance.code)
<add> instance.linenos = validated_attrs.get('linenos', instance.linenos)
<add> instance.language = validated_attrs.get('language', instance.language)
<add> instance.style = validated_attrs.get('style', instance.style)
<add> instance.save()
<add> return instance
<ide>
<del> # Create new instance
<del> return Snippet(**attrs)
<add>The first part of the serializer class defines the fields that get serialized/deserialized. The `create()` and `update()` methods define how fully fledged instances are created or modified when calling `serializer.save()`
<ide>
<del>The first part of the serializer class defines the fields that get serialized/deserialized. The `restore_object` method defines how fully fledged instances get created when deserializing data.
<add>A serializer class is very similar to a Django `Form` class, and includes similar validation flags on the various fields, such as `required`, `max_length` and `default`.
<ide>
<del>Notice that we can also use various attributes that would typically be used on form fields, such as `widget=widgets.Textarea`. These can be used to control how the serializer should render when displayed as an HTML form. This is particularly useful for controlling how the browsable API should be displayed, as we'll see later in the tutorial.
<add>The field flags can also control how the serializer should be displayed in certain circumstances, such as when rendering to HTML. The `style={'type': 'textarea'}` flag above is equivelent to using `widget=widgets.Textarea` on a Django `Form` class. This is particularly useful for controlling how the browsable API should be displayed, as we'll see later in the tutorial.
<ide>
<ide> We can actually also save ourselves some time by using the `ModelSerializer` class, as we'll see later, but for now we'll keep our serializer definition explicit.
<ide>
<ide> Open the file `snippets/serializers.py` again, and edit the `SnippetSerializer`
<ide> model = Snippet
<ide> fields = ('id', 'title', 'code', 'linenos', 'language', 'style')
<ide>
<add>Once nice property that serializers have is that you can inspect all the fields an serializer instance, by printing it's representation. Open the Django shell with `python manange.py shell`, then try the following:
<add>
<add> >>> from snippets.serializers import SnippetSerializer
<add> >>> serializer = SnippetSerializer()
<add> >>> print repr(serializer) # In python 3 use `print(repr(serializer))`
<add> SnippetSerializer():
<add> id = IntegerField(label='ID', read_only=True)
<add> title = CharField(allow_blank=True, max_length=100, required=False)
<add> code = CharField(style={'type': 'textarea'})
<add> linenos = BooleanField(required=False)
<add> language = ChoiceField(choices=[('Clipper', 'FoxPro'), ('Cucumber', 'Gherkin'), ('RobotFramework', 'RobotFramework'), ('abap', 'ABAP'), ('ada', 'Ada')...
<add> style = ChoiceField(choices=[('autumn', 'autumn'), ('borland', 'borland'), ('bw', 'bw'), ('colorful', 'colorful')...
<add>
<add>It's important to remember that `ModelSerializer` classes don't do anything particularly magically, they are simply a shortcut to creating a serializer class with:
<add>
<add>* An automatically determined set of fields.
<add>* Simple default implementations for the `create()` and `update()` methods.
<add>
<ide> ## Writing regular Django views using our Serializer
<ide>
<ide> Let's see how we can write some API views using our new Serializer class.
<ide><path>docs/tutorial/4-authentication-and-permissions.md
<ide> Finally we need to add those views into the API, by referencing them from the UR
<ide>
<ide> Right now, if we created a code snippet, there'd be no way of associating the user that created the snippet, with the snippet instance. The user isn't sent as part of the serialized representation, but is instead a property of the incoming request.
<ide>
<del>The way we deal with that is by overriding a `.pre_save()` method on our snippet views, that allows us to handle any information that is implicit in the incoming request or requested URL.
<add>The way we deal with that is by overriding a `.perform_create()` method on our snippet views, that allows us to modify how the instance save is managed, and handle any information that is implicit in the incoming request or requested URL.
<ide>
<del>On **both** the `SnippetList` and `SnippetDetail` view classes, add the following method:
<add>On the `SnippetList` view class, add the following method:
<ide>
<del> def pre_save(self, obj):
<del> obj.owner = self.request.user
<add> def perform_create(self, serializer):
<add> serializer.save(owner=self.request.user)
<add>
<add>The `create()` method of our serializer will now be passed an additional `'owner'` field, along with the validated data from the request.
<ide>
<ide> ## Updating our serializer
<ide>
<ide> Now that snippets are associated with the user that created them, let's update our `SnippetSerializer` to reflect that. Add the following field to the serializer definition in `serializers.py`:
<ide>
<del> owner = serializers.Field(source='owner.username')
<add> owner = serializers.ReadOnlyField(source='owner.username')
<ide>
<ide> **Note**: Make sure you also add `'owner',` to the list of fields in the inner `Meta` class.
<ide>
<ide> This field is doing something quite interesting. The `source` argument controls which attribute is used to populate a field, and can point at any attribute on the serialized instance. It can also take the dotted notation shown above, in which case it will traverse the given attributes, in a similar way as it is used with Django's template language.
<ide>
<del>The field we've added is the untyped `Field` class, in contrast to the other typed fields, such as `CharField`, `BooleanField` etc... The untyped `Field` is always read-only, and will be used for serialized representations, but will not be used for updating model instances when they are deserialized.
<add>The field we've added is the untyped `ReadOnlyField` class, in contrast to the other typed fields, such as `CharField`, `BooleanField` etc... The untyped `ReadOnlyField` is always read-only, and will be used for serialized representations, but will not be used for updating model instances when they are deserialized. We could have also used `CharField(read_only=True)` here.
<ide>
<ide> ## Adding required permissions to views
<ide> | 2 |
Go | Go | add links to inspect for 'linking' containers | 55691e5fdc78b5c3015c7a481371e482878c14d2 | <ide><path>daemon/inspect.go
<ide> package daemon
<ide>
<ide> import (
<ide> "encoding/json"
<add> "fmt"
<ide>
<ide> "github.com/dotcloud/docker/engine"
<ide> "github.com/dotcloud/docker/runconfig"
<ide> func (daemon *Daemon) ContainerInspect(job *engine.Job) engine.Status {
<ide> out.Set("ProcessLabel", container.ProcessLabel)
<ide> out.SetJson("Volumes", container.Volumes)
<ide> out.SetJson("VolumesRW", container.VolumesRW)
<add>
<add> if children, err := daemon.Children(container.Name); err == nil {
<add> for linkAlias, child := range children {
<add> container.hostConfig.Links = append(container.hostConfig.Links, fmt.Sprintf("%s:%s", child.Name, linkAlias))
<add> }
<add> }
<add>
<ide> out.SetJson("HostConfig", container.hostConfig)
<add>
<add> container.hostConfig.Links = nil
<ide> if _, err := out.WriteTo(job.Stdout); err != nil {
<ide> return job.Error(err)
<ide> } | 1 |
Javascript | Javascript | prevent catch assertions | 91d4aa54506a68a99f99b8edcfea10a73bea2ec2 | <ide><path>test/integration/create-next-app/index.test.js
<ide> const cli = require.resolve('create-next-app/dist/index.js')
<ide>
<ide> jest.setTimeout(1000 * 60 * 5)
<ide>
<del>const run = (cwd, args, input) => {
<del> const options = input ? { cwd, input } : { cwd }
<del> return execa('node', [cli].concat(args), options)
<del>}
<add>const run = (args, options) => execa('node', [cli].concat(args), options)
<ide>
<ide> async function usingTempDir(fn, options) {
<ide> const folder = path.join(os.tmpdir(), Math.random().toString(36).substring(2))
<ide> describe('create next app', () => {
<ide> const pkg = path.join(cwd, projectName, 'package.json')
<ide> fs.writeFileSync(pkg, '{ "foo": "bar" }')
<ide>
<del> expect.assertions(1)
<del> try {
<del> await run(cwd, [projectName])
<del> } catch (e) {
<del> // eslint-disable-next-line jest/no-try-expect
<del> expect(e.stdout).toMatch(/contains files that could conflict/)
<del> }
<add> const res = await run([projectName], { cwd, reject: false })
<add> expect(res.exitCode).toBe(1)
<add> expect(res.stdout).toMatch(/contains files that could conflict/)
<ide> })
<ide> })
<ide>
<ide> describe('create next app', () => {
<ide> it('empty directory', async () => {
<ide> await usingTempDir(async (cwd) => {
<ide> const projectName = 'empty-directory'
<del> const res = await run(cwd, [projectName])
<add> const res = await run([projectName], { cwd })
<ide>
<ide> expect(res.exitCode).toBe(0)
<ide> expect(
<ide> describe('create next app', () => {
<ide> it('invalid example name', async () => {
<ide> await usingTempDir(async (cwd) => {
<ide> const projectName = 'invalid-example-name'
<del> expect.assertions(2)
<del> try {
<del> await run(cwd, [projectName, '--example', 'not a real example'])
<del> } catch (e) {
<del> // eslint-disable-next-line jest/no-try-expect
<del> expect(e.stderr).toMatch(/Could not locate an example named/i)
<del> }
<add> const res = await run([projectName, '--example', 'not a real example'], {
<add> cwd,
<add> reject: false,
<add> })
<add>
<add> expect(res.exitCode).toBe(1)
<add> expect(res.stderr).toMatch(/Could not locate an example named/i)
<ide> expect(
<ide> fs.existsSync(path.join(cwd, projectName, 'package.json'))
<ide> ).toBeFalsy()
<ide> describe('create next app', () => {
<ide> it('valid example', async () => {
<ide> await usingTempDir(async (cwd) => {
<ide> const projectName = 'valid-example'
<del> const res = await run(cwd, [projectName, '--example', 'basic-css'])
<add> const res = await run([projectName, '--example', 'basic-css'], { cwd })
<ide> expect(res.exitCode).toBe(0)
<ide>
<ide> expect(
<ide> describe('create next app', () => {
<ide> it('should allow example with GitHub URL', async () => {
<ide> await usingTempDir(async (cwd) => {
<ide> const projectName = 'github-app'
<del> const res = await run(cwd, [
<del> projectName,
<del> '--example',
<del> 'https://github.com/zeit/next-learn-demo/tree/master/1-navigate-between-pages',
<del> ])
<add> const res = await run(
<add> [
<add> projectName,
<add> '--example',
<add> 'https://github.com/zeit/next-learn-demo/tree/master/1-navigate-between-pages',
<add> ],
<add> {
<add> cwd,
<add> }
<add> )
<ide>
<ide> expect(res.exitCode).toBe(0)
<ide> expect(
<ide> describe('create next app', () => {
<ide> it('should allow example with GitHub URL and example-path', async () => {
<ide> await usingTempDir(async (cwd) => {
<ide> const projectName = 'github-example-path'
<del> const res = await run(cwd, [
<del> projectName,
<del> '--example',
<del> 'https://github.com/zeit/next-learn-demo/tree/master',
<del> '--example-path',
<del> '1-navigate-between-pages',
<del> ])
<add> const res = await run(
<add> [
<add> projectName,
<add> '--example',
<add> 'https://github.com/zeit/next-learn-demo/tree/master',
<add> '--example-path',
<add> '1-navigate-between-pages',
<add> ],
<add> {
<add> cwd,
<add> }
<add> )
<ide>
<ide> expect(res.exitCode).toBe(0)
<ide> expect(
<ide> describe('create next app', () => {
<ide> it('should use --example-path over the file path in the GitHub URL', async () => {
<ide> await usingTempDir(async (cwd) => {
<ide> const projectName = 'github-example-path-2'
<del> const res = await run(cwd, [
<del> projectName,
<del> '--example',
<del> 'https://github.com/zeit/next-learn-demo/tree/master/1-navigate-between-pages',
<del> '--example-path',
<del> '1-navigate-between-pages',
<del> ])
<add> const res = await run(
<add> [
<add> projectName,
<add> '--example',
<add> 'https://github.com/zeit/next-learn-demo/tree/master/1-navigate-between-pages',
<add> '--example-path',
<add> '1-navigate-between-pages',
<add> ],
<add> {
<add> cwd,
<add> }
<add> )
<ide>
<ide> expect(res.exitCode).toBe(0)
<ide> expect(
<ide> describe('create next app', () => {
<ide> it('should fall back to default template', async () => {
<ide> await usingTempDir(async (cwd) => {
<ide> const runExample = (...args) => {
<del> const res = run(cwd, args)
<add> const res = run(args, { cwd })
<ide>
<ide> function fallbackToTemplate(data) {
<ide> if (
<ide> describe('create next app', () => {
<ide> it('should allow an example named default', async () => {
<ide> await usingTempDir(async (cwd) => {
<ide> const projectName = 'default-example'
<del> const res = await run(cwd, [projectName, '--example', 'default'])
<add> const res = await run([projectName, '--example', 'default'], { cwd })
<ide> expect(res.exitCode).toBe(0)
<ide>
<ide> expect(
<ide> describe('create next app', () => {
<ide>
<ide> it('should exit if example flag is empty', async () => {
<ide> await usingTempDir(async (cwd) => {
<del> try {
<del> const projectName = 'no-example-provided'
<del> await run(cwd, [projectName, '--example'])
<del> } catch (e) {
<del> // eslint-disable-next-line jest/no-try-expect
<del> expect(e.exitCode).toBe(1)
<del> }
<add> const projectName = 'no-example-provided'
<add> const res = await run([projectName, '--example'], { cwd, reject: false })
<add> expect(res.exitCode).toBe(1)
<ide> })
<ide> })
<ide>
<ide> it('should exit if the folder is not writable', async () => {
<ide> await usingTempDir(async (cwd) => {
<ide> const projectName = 'not-writable'
<del> expect.assertions(2)
<del> try {
<del> const res = await run(cwd, [projectName])
<del>
<del> if (process.platform === 'win32') {
<del> expect(res.exitCode).toBe(0)
<del> expect(
<del> fs.existsSync(path.join(cwd, projectName, 'package.json'))
<del> ).toBeTruthy()
<del> }
<del> } catch (e) {
<del> // eslint-disable-next-line jest/no-try-expect
<del> expect(e.exitCode).toBe(1)
<del> // eslint-disable-next-line jest/no-try-expect
<del> expect(e.stderr).toMatch(
<del> /you do not have write permissions for this folder/
<del> )
<add> const res = await run([projectName], { cwd, reject: false })
<add>
<add> if (process.platform === 'win32') {
<add> expect(res.exitCode).toBe(0)
<add> expect(
<add> fs.existsSync(path.join(cwd, projectName, 'package.json'))
<add> ).toBeTruthy()
<add> return
<ide> }
<add> expect(res.exitCode).toBe(1)
<add> expect(res.stderr).toMatch(
<add> /you do not have write permissions for this folder/
<add> )
<ide> }, 0o500)
<ide> })
<ide>
<ide> it('should create a project in the current directory', async () => {
<ide> await usingTempDir(async (cwd) => {
<del> const res = await run(cwd, ['.'])
<add> const res = await run(['.'], { cwd })
<ide> expect(res.exitCode).toBe(0)
<ide>
<ide> const files = ['package.json', 'pages/index.js', '.gitignore']
<ide> describe('create next app', () => {
<ide> it('should ask the user for a name for the project if none supplied', async () => {
<ide> await usingTempDir(async (cwd) => {
<ide> const projectName = 'test-project'
<del> const res = await run(cwd, [], `${projectName}\n`)
<add> const res = await run([], { cwd, input: `${projectName}\n` })
<ide> expect(res.exitCode).toBe(0)
<ide>
<ide> const files = ['package.json', 'pages/index.js', '.gitignore'] | 1 |
Javascript | Javascript | remove ballshooter_multiview from examples list | 8d8204f26a36564ffec14dec0dbd1547fd4bfd60 | <ide><path>examples/files.js
<ide> var files = {
<ide> ],
<ide> "webvr": [
<ide> "webvr_ballshooter",
<del> "webvr_ballshooter_multiview",
<ide> "webvr_cubes",
<ide> "webvr_dragging",
<ide> "webvr_lorenzattractor", | 1 |
Text | Text | remove activation events comment | 386767868eaffec73986d5da4db11965259733ac | <ide><path>docs/your-first-package.md
<ide> its not there! To fix this open _package.json_ and find the property called
<ide> delay a package's activation until it's needed. So add the `ascii-art:convert`
<ide> to the activationEvents array:
<ide>
<del>IT SEEMS LIKE ACTIVATION EVENTS SHOULDN'T BE REQUIRED HERE. WHAT AM I MISSING?
<del>
<ide> ```coffeescript
<ide> "activationEvents": ["ascii-art:convert"],
<ide> ``` | 1 |
Java | Java | reduce code duplication in mergedsqlconfig | 682e8fb3ad5e66ae42995b999bec062eb76247c3 | <ide><path>spring-test/src/main/java/org/springframework/test/context/jdbc/MergedSqlConfig.java
<ide> class MergedSqlConfig {
<ide> private final ErrorMode errorMode;
<ide>
<ide>
<del> private static TransactionMode retrieveTransactionMode(AnnotationAttributes attributes) {
<del> TransactionMode transactionMode = attributes.getEnum("transactionMode");
<del> if (transactionMode == TransactionMode.DEFAULT) {
<del> transactionMode = TransactionMode.INFERRED;
<add> private static <E extends Enum<?>> E getEnum(AnnotationAttributes attributes, String attributeName,
<add> E inheritOrOverrideValue, E defaultValue) {
<add> E value = attributes.getEnum(attributeName);
<add> if (value == inheritOrOverrideValue) {
<add> value = defaultValue;
<ide> }
<del> return transactionMode;
<add> return value;
<ide> }
<ide>
<del> private static ErrorMode retrieveErrorMode(AnnotationAttributes attributes) {
<del> ErrorMode errorMode = attributes.getEnum("errorMode");
<del> if (errorMode == ErrorMode.DEFAULT) {
<del> errorMode = ErrorMode.FAIL_ON_ERROR;
<add> private static String getString(AnnotationAttributes attributes, String attributeName, String defaultValue) {
<add> String value = attributes.getString(attributeName);
<add> if ("".equals(value)) {
<add> value = defaultValue;
<ide> }
<del> return errorMode;
<del> }
<del>
<del> private static String retrieveSeparator(AnnotationAttributes attributes) {
<del> String separator = attributes.getString("separator");
<del> if ("".equals(separator)) {
<del> separator = ScriptUtils.DEFAULT_STATEMENT_SEPARATOR;
<del> }
<del> return separator;
<del> }
<del>
<del> private static String retrieveCommentPrefix(AnnotationAttributes attributes) {
<del> String commentPrefix = attributes.getString("commentPrefix");
<del> if ("".equals(commentPrefix)) {
<del> commentPrefix = ScriptUtils.DEFAULT_COMMENT_PREFIX;
<del> }
<del> return commentPrefix;
<del> }
<del>
<del> private static String retrieveBlockCommentStartDelimiter(AnnotationAttributes attributes) {
<del> String blockCommentStartDelimiter = attributes.getString("blockCommentStartDelimiter");
<del> if ("".equals(blockCommentStartDelimiter)) {
<del> blockCommentStartDelimiter = ScriptUtils.DEFAULT_BLOCK_COMMENT_START_DELIMITER;
<del> }
<del> return blockCommentStartDelimiter;
<del> }
<del>
<del> private static String retrieveBlockCommentEndDelimiter(AnnotationAttributes attributes) {
<del> String blockCommentEndDelimiter = attributes.getString("blockCommentEndDelimiter");
<del> if ("".equals(blockCommentEndDelimiter)) {
<del> blockCommentEndDelimiter = ScriptUtils.DEFAULT_BLOCK_COMMENT_END_DELIMITER;
<del> }
<del> return blockCommentEndDelimiter;
<add> return value;
<ide> }
<ide>
<ide> /**
<ide> private static String retrieveBlockCommentEndDelimiter(AnnotationAttributes attr
<ide>
<ide> this.dataSource = attributes.getString("dataSource");
<ide> this.transactionManager = attributes.getString("transactionManager");
<del> this.transactionMode = retrieveTransactionMode(attributes);
<add> this.transactionMode = getEnum(attributes, "transactionMode", TransactionMode.DEFAULT, TransactionMode.INFERRED);
<ide> this.encoding = attributes.getString("encoding");
<del> this.separator = retrieveSeparator(attributes);
<del> this.commentPrefix = retrieveCommentPrefix(attributes);
<del> this.blockCommentStartDelimiter = retrieveBlockCommentStartDelimiter(attributes);
<del> this.blockCommentEndDelimiter = retrieveBlockCommentEndDelimiter(attributes);
<del> this.errorMode = retrieveErrorMode(attributes);
<add> this.separator = getString(attributes, "separator", ScriptUtils.DEFAULT_STATEMENT_SEPARATOR);
<add> this.commentPrefix = getString(attributes, "commentPrefix", ScriptUtils.DEFAULT_COMMENT_PREFIX);
<add> this.blockCommentStartDelimiter = getString(attributes, "blockCommentStartDelimiter",
<add> ScriptUtils.DEFAULT_BLOCK_COMMENT_START_DELIMITER);
<add> this.blockCommentEndDelimiter = getString(attributes, "blockCommentEndDelimiter",
<add> ScriptUtils.DEFAULT_BLOCK_COMMENT_END_DELIMITER);
<add> this.errorMode = getEnum(attributes, "errorMode", ErrorMode.DEFAULT, ErrorMode.FAIL_ON_ERROR);
<ide> }
<ide>
<ide> /** | 1 |
Javascript | Javascript | move extension name to extensions dictionary | 5c81a64e0c48e40120dfcfa60ee3e51ea5da6bbc | <ide><path>examples/js/loaders/GLTFLoader.js
<ide> THREE.GLTFLoader = ( function () {
<ide> KHR_MATERIALS_CLEARCOAT: 'KHR_materials_clearcoat',
<ide> KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS: 'KHR_materials_pbrSpecularGlossiness',
<ide> KHR_MATERIALS_UNLIT: 'KHR_materials_unlit',
<add> KHR_TEXTURE_BASISU: 'KHR_texture_basisu',
<ide> KHR_TEXTURE_TRANSFORM: 'KHR_texture_transform',
<ide> KHR_MESH_QUANTIZATION: 'KHR_mesh_quantization',
<ide> MSFT_TEXTURE_DDS: 'MSFT_texture_dds'
<ide> THREE.GLTFLoader = ( function () {
<ide> function GLTFTextureBasisU( parser ) {
<ide>
<ide> this.parser = parser;
<del> this.name = "KHR_texture_basisu";
<add> this.name = EXTENSIONS.KHR_TEXTURE_BASISU;
<ide>
<ide> }
<ide>
<ide><path>examples/jsm/loaders/GLTFLoader.js
<ide> var GLTFLoader = ( function () {
<ide> KHR_MATERIALS_CLEARCOAT: 'KHR_materials_clearcoat',
<ide> KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS: 'KHR_materials_pbrSpecularGlossiness',
<ide> KHR_MATERIALS_UNLIT: 'KHR_materials_unlit',
<add> KHR_TEXTURE_BASISU: 'KHR_texture_basisu',
<ide> KHR_TEXTURE_TRANSFORM: 'KHR_texture_transform',
<ide> KHR_MESH_QUANTIZATION: 'KHR_mesh_quantization',
<ide> MSFT_TEXTURE_DDS: 'MSFT_texture_dds'
<ide> var GLTFLoader = ( function () {
<ide> function GLTFTextureBasisU( parser ) {
<ide>
<ide> this.parser = parser;
<del> this.name = "KHR_texture_basisu";
<add> this.name = EXTENSIONS.KHR_TEXTURE_BASISU;
<ide>
<ide> }
<ide> | 2 |
PHP | PHP | fix tiny integer docs | 1ffca77780e279b4160283dce7d88d203c4c8581 | <ide><path>src/Illuminate/Database/Schema/Blueprint.php
<ide> public function bigInteger($column, $autoIncrement = false, $unsigned = false)
<ide> }
<ide>
<ide> /**
<del> * Create a new unsigned small integer (2-byte) column on the table.
<add> * Create a new unsigned tiny integer (1-byte) column on the table.
<ide> *
<ide> * @param string $column
<ide> * @param bool $autoIncrement | 1 |
Javascript | Javascript | add montenegrin locale (me.js) (redo ) | a2efa84e68c5f80b3f9c0d52dcb5ccac2c93b239 | <ide><path>src/locale/me.js
<add>//! moment.js locale configuration
<add>//! locale : Montenegrin (me)
<add>//! author : Miodrag Nikač <[email protected]> : https://github.com/miodragnikac
<add>
<add>import moment from '../moment';
<add>
<add>var translator = {
<add> words: { //Different grammatical cases
<add> m: ['jedan minut', 'jednog minuta'],
<add> mm: ['minut', 'minuta', 'minuta'],
<add> h: ['jedan sat', 'jednog sata'],
<add> hh: ['sat', 'sata', 'sati'],
<add> dd: ['dan', 'dana', 'dana'],
<add> MM: ['mjesec', 'mjeseca', 'mjeseci'],
<add> yy: ['godina', 'godine', 'godina']
<add> },
<add> correctGrammaticalCase: function (number, wordKey) {
<add> return number === 1 ? wordKey[0] : (number >= 2 && number <= 4 ? wordKey[1] : wordKey[2]);
<add> },
<add> translate: function (number, withoutSuffix, key) {
<add> var wordKey = translator.words[key];
<add> if (key.length === 1) {
<add> return withoutSuffix ? wordKey[0] : wordKey[1];
<add> } else {
<add> return number + ' ' + translator.correctGrammaticalCase(number, wordKey);
<add> }
<add> }
<add>};
<add>
<add>export default moment.defineLocale('me', {
<add> months: ['januar', 'februar', 'mart', 'april', 'maj', 'jun', 'jul', 'avgust', 'septembar', 'oktobar', 'novembar', 'decembar'],
<add> monthsShort: ['jan.', 'feb.', 'mar.', 'apr.', 'maj', 'jun', 'jul', 'avg.', 'sep.', 'okt.', 'nov.', 'dec.'],
<add> weekdays: ['nedjelja', 'ponedjeljak', 'utorak', 'srijeda', 'četvrtak', 'petak', 'subota'],
<add> weekdaysShort: ['ned.', 'pon.', 'uto.', 'sri.', 'čet.', 'pet.', 'sub.'],
<add> weekdaysMin: ['ne', 'po', 'ut', 'sr', 'če', 'pe', 'su'],
<add> longDateFormat: {
<add> LT: 'H:mm',
<add> LTS : 'LT:ss',
<add> L: 'DD. MM. YYYY',
<add> LL: 'D. MMMM YYYY',
<add> LLL: 'D. MMMM YYYY LT',
<add> LLLL: 'dddd, D. MMMM YYYY LT'
<add> },
<add> calendar: {
<add> sameDay: '[danas u] LT',
<add> nextDay: '[sjutra u] LT',
<add>
<add> nextWeek: function () {
<add> switch (this.day()) {
<add> case 0:
<add> return '[u] [nedjelju] [u] LT';
<add> case 3:
<add> return '[u] [srijedu] [u] LT';
<add> case 6:
<add> return '[u] [subotu] [u] LT';
<add> case 1:
<add> case 2:
<add> case 4:
<add> case 5:
<add> return '[u] dddd [u] LT';
<add> }
<add> },
<add> lastDay : '[juče u] LT',
<add> lastWeek : function () {
<add> var lastWeekDays = [
<add> '[prošle] [nedjelje] [u] LT',
<add> '[prošlog] [ponedjeljka] [u] LT',
<add> '[prošlog] [utorka] [u] LT',
<add> '[prošle] [srijede] [u] LT',
<add> '[prošlog] [četvrtka] [u] LT',
<add> '[prošlog] [petka] [u] LT',
<add> '[prošle] [subote] [u] LT'
<add> ];
<add> return lastWeekDays[this.day()];
<add> },
<add> sameElse : 'L'
<add> },
<add> relativeTime : {
<add> future : 'za %s',
<add> past : 'prije %s',
<add> s : 'nekoliko sekundi',
<add> m : translator.translate,
<add> mm : translator.translate,
<add> h : translator.translate,
<add> hh : translator.translate,
<add> d : 'dan',
<add> dd : translator.translate,
<add> M : 'mjesec',
<add> MM : translator.translate,
<add> y : 'godinu',
<add> yy : translator.translate
<add> },
<add> ordinalParse: /\d{1,2}\./,
<add> ordinal : '%d.',
<add> week : {
<add> dow : 1, // Monday is the first day of the week.
<add> doy : 7 // The week that contains Jan 1st is the first week of the year.
<add> }
<add>});
<ide><path>src/test/locale/me.js
<add>import {localeModule, test} from '../qunit';
<add>import {moment} from '../../moment';
<add>localeModule('me');
<add>
<add>test('parse', function (assert) {
<add> var tests = 'januar jan._februar feb._mart mar._april apr._maj maj_jun jun_jul jul_avgust avg._septembar sep._oktobar okt._novembar nov._decembar dec.'.split('_'),
<add> i;
<add> function equalTest(input, mmm, i) {
<add> assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1));
<add> }
<add> for (i = 0; i < 12; i++) {
<add> tests[i] = tests[i].split(' ');
<add> equalTest(tests[i][0], 'MMM', i);
<add> equalTest(tests[i][1], 'MMM', i);
<add> equalTest(tests[i][0], 'MMMM', i);
<add> equalTest(tests[i][1], 'MMMM', i);
<add> equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i);
<add> equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i);
<add> equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i);
<add> equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i);
<add> }
<add>});
<add>
<add>test('format', function (assert) {
<add> var a = [
<add> ['dddd, Do MMMM YYYY, h:mm:ss a', 'nedjelja, 14. februar 2010, 3:25:50 pm'],
<add> ['ddd, hA', 'ned., 3PM'],
<add> ['M Mo MM MMMM MMM', '2 2. 02 februar feb.'],
<add> ['YYYY YY', '2010 10'],
<add> ['D Do DD', '14 14. 14'],
<add> ['d do dddd ddd dd', '0 0. nedjelja ned. ne'],
<add> ['DDD DDDo DDDD', '45 45. 045'],
<add> ['w wo ww', '7 7. 07'],
<add> ['h hh', '3 03'],
<add> ['H HH', '15 15'],
<add> ['m mm', '25 25'],
<add> ['s ss', '50 50'],
<add> ['a A', 'pm PM'],
<add> ['[the] DDDo [day of the year]', 'the 45. day of the year'],
<add> ['LTS', '15:25:50'],
<add> ['L', '14. 02. 2010'],
<add> ['LL', '14. februar 2010'],
<add> ['LLL', '14. februar 2010 15:25'],
<add> ['LLLL', 'nedjelja, 14. februar 2010 15:25'],
<add> ['l', '14. 2. 2010'],
<add> ['ll', '14. feb. 2010'],
<add> ['lll', '14. feb. 2010 15:25'],
<add> ['llll', 'ned., 14. feb. 2010 15:25']
<add> ],
<add> b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)),
<add> i;
<add> for (i = 0; i < a.length; i++) {
<add> assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]);
<add> }
<add>});
<add>
<add>test('format ordinal', function (assert) {
<add> assert.equal(moment([2011, 0, 1]).format('DDDo'), '1.', '1.');
<add> assert.equal(moment([2011, 0, 2]).format('DDDo'), '2.', '2.');
<add> assert.equal(moment([2011, 0, 3]).format('DDDo'), '3.', '3.');
<add> assert.equal(moment([2011, 0, 4]).format('DDDo'), '4.', '4.');
<add> assert.equal(moment([2011, 0, 5]).format('DDDo'), '5.', '5.');
<add> assert.equal(moment([2011, 0, 6]).format('DDDo'), '6.', '6.');
<add> assert.equal(moment([2011, 0, 7]).format('DDDo'), '7.', '7.');
<add> assert.equal(moment([2011, 0, 8]).format('DDDo'), '8.', '8.');
<add> assert.equal(moment([2011, 0, 9]).format('DDDo'), '9.', '9.');
<add> assert.equal(moment([2011, 0, 10]).format('DDDo'), '10.', '10.');
<add>
<add> assert.equal(moment([2011, 0, 11]).format('DDDo'), '11.', '11.');
<add> assert.equal(moment([2011, 0, 12]).format('DDDo'), '12.', '12.');
<add> assert.equal(moment([2011, 0, 13]).format('DDDo'), '13.', '13.');
<add> assert.equal(moment([2011, 0, 14]).format('DDDo'), '14.', '14.');
<add> assert.equal(moment([2011, 0, 15]).format('DDDo'), '15.', '15.');
<add> assert.equal(moment([2011, 0, 16]).format('DDDo'), '16.', '16.');
<add> assert.equal(moment([2011, 0, 17]).format('DDDo'), '17.', '17.');
<add> assert.equal(moment([2011, 0, 18]).format('DDDo'), '18.', '18.');
<add> assert.equal(moment([2011, 0, 19]).format('DDDo'), '19.', '19.');
<add> assert.equal(moment([2011, 0, 20]).format('DDDo'), '20.', '20.');
<add>
<add> assert.equal(moment([2011, 0, 21]).format('DDDo'), '21.', '21.');
<add> assert.equal(moment([2011, 0, 22]).format('DDDo'), '22.', '22.');
<add> assert.equal(moment([2011, 0, 23]).format('DDDo'), '23.', '23.');
<add> assert.equal(moment([2011, 0, 24]).format('DDDo'), '24.', '24.');
<add> assert.equal(moment([2011, 0, 25]).format('DDDo'), '25.', '25.');
<add> assert.equal(moment([2011, 0, 26]).format('DDDo'), '26.', '26.');
<add> assert.equal(moment([2011, 0, 27]).format('DDDo'), '27.', '27.');
<add> assert.equal(moment([2011, 0, 28]).format('DDDo'), '28.', '28.');
<add> assert.equal(moment([2011, 0, 29]).format('DDDo'), '29.', '29.');
<add> assert.equal(moment([2011, 0, 30]).format('DDDo'), '30.', '30.');
<add>
<add> assert.equal(moment([2011, 0, 31]).format('DDDo'), '31.', '31.');
<add>});
<add>
<add>test('format month', function (assert) {
<add> var expected = 'januar jan._februar feb._mart mar._april apr._maj maj_jun jun_jul jul_avgust avg._septembar sep._oktobar okt._novembar nov._decembar dec.'.split('_'),
<add> i;
<add> for (i = 0; i < expected.length; i++) {
<add> assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]);
<add> }
<add>});
<add>
<add>test('format week', function (assert) {
<add> var expected = 'nedjelja ned. ne_ponedjeljak pon. po_utorak uto. ut_srijeda sri. sr_četvrtak čet. če_petak pet. pe_subota sub. su'.split('_'),
<add> i;
<add> for (i = 0; i < expected.length; i++) {
<add> assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]);
<add> }
<add>});
<add>
<add>test('from', function (assert) {
<add> var start = moment([2007, 1, 28]);
<add> assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'nekoliko sekundi', '44 seconds = a few seconds');
<add> assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'jedan minut', '45 seconds = a minute');
<add> assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'jedan minut', '89 seconds = a minute');
<add> assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minuta', '90 seconds = 2 minutes');
<add> assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minuta', '44 minutes = 44 minutes');
<add> assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'jedan sat', '45 minutes = an hour');
<add> assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'jedan sat', '89 minutes = an hour');
<add> assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 sata', '90 minutes = 2 hours');
<add> assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 sati', '5 hours = 5 hours');
<add> assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 sati', '21 hours = 21 hours');
<add> assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'dan', '22 hours = a day');
<add> assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'dan', '35 hours = a day');
<add> assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 dana', '36 hours = 2 days');
<add> assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'dan', '1 day = a day');
<add> assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 dana', '5 days = 5 days');
<add> assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 dana', '25 days = 25 days');
<add> assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'mjesec', '26 days = a month');
<add> assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'mjesec', '30 days = a month');
<add> assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'mjesec', '43 days = a month');
<add> assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 mjeseca', '46 days = 2 months');
<add> assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 mjeseca', '75 days = 2 months');
<add> assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 mjeseca', '76 days = 3 months');
<add> assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'mjesec', '1 month = a month');
<add> assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 mjeseci', '5 months = 5 months');
<add> assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'godinu', '345 days = a year');
<add> assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 godine', '548 days = 2 years');
<add> assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'godinu', '1 year = a year');
<add> assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 godina', '5 years = 5 years');
<add>});
<add>
<add>test('suffix', function (assert) {
<add> assert.equal(moment(30000).from(0), 'za nekoliko sekundi', 'prefix');
<add> assert.equal(moment(0).from(30000), 'prije nekoliko sekundi', 'prefix');
<add>});
<add>
<add>test('now from now', function (assert) {
<add> assert.equal(moment().fromNow(), 'prije nekoliko sekundi', 'now from now should display as in the past');
<add>});
<add>
<add>test('fromNow', function (assert) {
<add> assert.equal(moment().add({s: 30}).fromNow(), 'za nekoliko sekundi', 'in a few seconds');
<add> assert.equal(moment().add({d: 5}).fromNow(), 'za 5 dana', 'in 5 days');
<add>});
<add>
<add>test('calendar day', function (assert) {
<add> var a = moment().hours(2).minutes(0).seconds(0);
<add>
<add> assert.equal(moment(a).calendar(), 'danas u 2:00', 'today at the same time');
<add> assert.equal(moment(a).add({m: 25}).calendar(), 'danas u 2:25', 'Now plus 25 min');
<add> assert.equal(moment(a).add({h: 1}).calendar(), 'danas u 3:00', 'Now plus 1 hour');
<add> assert.equal(moment(a).add({d: 1}).calendar(), 'sjutra u 2:00', 'tomorrow at the same time');
<add> assert.equal(moment(a).subtract({h: 1}).calendar(), 'danas u 1:00', 'Now minus 1 hour');
<add> assert.equal(moment(a).subtract({d: 1}).calendar(), 'juče u 2:00', 'yesterday at the same time');
<add>});
<add>
<add>test('calendar next week', function (assert) {
<add> var i, m;
<add>
<add> function makeFormat(d) {
<add> switch (d.day()) {
<add> case 0:
<add> return '[u] [nedjelju] [u] LT';
<add> case 3:
<add> return '[u] [srijedu] [u] LT';
<add> case 6:
<add> return '[u] [subotu] [u] LT';
<add> case 1:
<add> case 2:
<add> case 4:
<add> case 5:
<add> return '[u] dddd [u] LT';
<add> }
<add> }
<add>
<add> for (i = 2; i < 7; i++) {
<add> m = moment().add({d: i});
<add> assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today + ' + i + ' days current time');
<add> m.hours(0).minutes(0).seconds(0).milliseconds(0);
<add> assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today + ' + i + ' days beginning of day');
<add> m.hours(23).minutes(59).seconds(59).milliseconds(999);
<add> assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today + ' + i + ' days end of day');
<add> }
<add>});
<add>
<add>test('calendar last week', function (assert) {
<add> var i, m;
<add>
<add> function makeFormat(d) {
<add> var lastWeekDay = [
<add> '[prošle] [nedjelje] [u] LT',
<add> '[prošlog] [ponedjeljka] [u] LT',
<add> '[prošlog] [utorka] [u] LT',
<add> '[prošle] [srijede] [u] LT',
<add> '[prošlog] [četvrtka] [u] LT',
<add> '[prošlog] [petka] [u] LT',
<add> '[prošle] [subote] [u] LT'
<add> ];
<add>
<add> return lastWeekDay[d.day()];
<add> }
<add>
<add> for (i = 2; i < 7; i++) {
<add> m = moment().subtract({d: i});
<add> assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today - ' + i + ' days current time');
<add> m.hours(0).minutes(0).seconds(0).milliseconds(0);
<add> assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today - ' + i + ' days beginning of day');
<add> m.hours(23).minutes(59).seconds(59).milliseconds(999);
<add> assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today - ' + i + ' days end of day');
<add> }
<add>});
<add>
<add>test('calendar all else', function (assert) {
<add> var weeksAgo = moment().subtract({w: 1}),
<add> weeksFromNow = moment().add({w: 1});
<add>
<add> assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago');
<add> assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week');
<add>
<add> weeksAgo = moment().subtract({w: 2});
<add> weeksFromNow = moment().add({w: 2});
<add>
<add> assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago');
<add> assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks');
<add>});
<add>
<add>// Monday is the first day of the week.
<add>// The week that contains Jan 1st is the first week of the year.
<add>
<add>test('weeks year starting sunday', function (assert) {
<add> assert.equal(moment([2011, 11, 26]).week(), 1, 'Dec 26 2011 should be week 1');
<add> assert.equal(moment([2012, 0, 1]).week(), 1, 'Jan 1 2012 should be week 1');
<add> assert.equal(moment([2012, 0, 2]).week(), 2, 'Jan 2 2012 should be week 2');
<add> assert.equal(moment([2012, 0, 8]).week(), 2, 'Jan 8 2012 should be week 2');
<add> assert.equal(moment([2012, 0, 9]).week(), 3, 'Jan 9 2012 should be week 3');
<add>});
<add>
<add>test('weeks year starting monday', function (assert) {
<add> assert.equal(moment([2007, 0, 1]).week(), 1, 'Jan 1 2007 should be week 1');
<add> assert.equal(moment([2007, 0, 7]).week(), 1, 'Jan 7 2007 should be week 1');
<add> assert.equal(moment([2007, 0, 8]).week(), 2, 'Jan 8 2007 should be week 2');
<add> assert.equal(moment([2007, 0, 14]).week(), 2, 'Jan 14 2007 should be week 2');
<add> assert.equal(moment([2007, 0, 15]).week(), 3, 'Jan 15 2007 should be week 3');
<add>});
<add>
<add>test('weeks year starting tuesday', function (assert) {
<add> assert.equal(moment([2007, 11, 31]).week(), 1, 'Dec 31 2007 should be week 1');
<add> assert.equal(moment([2008, 0, 1]).week(), 1, 'Jan 1 2008 should be week 1');
<add> assert.equal(moment([2008, 0, 6]).week(), 1, 'Jan 6 2008 should be week 1');
<add> assert.equal(moment([2008, 0, 7]).week(), 2, 'Jan 7 2008 should be week 2');
<add> assert.equal(moment([2008, 0, 13]).week(), 2, 'Jan 13 2008 should be week 2');
<add> assert.equal(moment([2008, 0, 14]).week(), 3, 'Jan 14 2008 should be week 3');
<add>});
<add>
<add>test('weeks year starting wednesday', function (assert) {
<add> assert.equal(moment([2002, 11, 30]).week(), 1, 'Dec 30 2002 should be week 1');
<add> assert.equal(moment([2003, 0, 1]).week(), 1, 'Jan 1 2003 should be week 1');
<add> assert.equal(moment([2003, 0, 5]).week(), 1, 'Jan 5 2003 should be week 1');
<add> assert.equal(moment([2003, 0, 6]).week(), 2, 'Jan 6 2003 should be week 2');
<add> assert.equal(moment([2003, 0, 12]).week(), 2, 'Jan 12 2003 should be week 2');
<add> assert.equal(moment([2003, 0, 13]).week(), 3, 'Jan 13 2003 should be week 3');
<add>});
<add>
<add>test('weeks year starting thursday', function (assert) {
<add> assert.equal(moment([2008, 11, 29]).week(), 1, 'Dec 29 2008 should be week 1');
<add> assert.equal(moment([2009, 0, 1]).week(), 1, 'Jan 1 2009 should be week 1');
<add> assert.equal(moment([2009, 0, 4]).week(), 1, 'Jan 4 2009 should be week 1');
<add> assert.equal(moment([2009, 0, 5]).week(), 2, 'Jan 5 2009 should be week 2');
<add> assert.equal(moment([2009, 0, 11]).week(), 2, 'Jan 11 2009 should be week 2');
<add> assert.equal(moment([2009, 0, 12]).week(), 3, 'Jan 12 2009 should be week 3');
<add>});
<add>
<add>test('weeks year starting friday', function (assert) {
<add> assert.equal(moment([2009, 11, 28]).week(), 1, 'Dec 28 2009 should be week 1');
<add> assert.equal(moment([2010, 0, 1]).week(), 1, 'Jan 1 2010 should be week 1');
<add> assert.equal(moment([2010, 0, 3]).week(), 1, 'Jan 3 2010 should be week 1');
<add> assert.equal(moment([2010, 0, 4]).week(), 2, 'Jan 4 2010 should be week 2');
<add> assert.equal(moment([2010, 0, 10]).week(), 2, 'Jan 10 2010 should be week 2');
<add> assert.equal(moment([2010, 0, 11]).week(), 3, 'Jan 11 2010 should be week 3');
<add>});
<add>
<add>test('weeks year starting saturday', function (assert) {
<add> assert.equal(moment([2010, 11, 27]).week(), 1, 'Dec 27 2010 should be week 1');
<add> assert.equal(moment([2011, 0, 1]).week(), 1, 'Jan 1 2011 should be week 1');
<add> assert.equal(moment([2011, 0, 2]).week(), 1, 'Jan 2 2011 should be week 1');
<add> assert.equal(moment([2011, 0, 3]).week(), 2, 'Jan 3 2011 should be week 2');
<add> assert.equal(moment([2011, 0, 9]).week(), 2, 'Jan 9 2011 should be week 2');
<add> assert.equal(moment([2011, 0, 10]).week(), 3, 'Jan 10 2011 should be week 3');
<add>});
<add>
<add>test('weeks year starting sunday formatted', function (assert) {
<add> assert.equal(moment([2011, 11, 26]).format('w ww wo'), '1 01 1.', 'Dec 26 2011 should be week 1');
<add> assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1.', 'Jan 1 2012 should be week 1');
<add> assert.equal(moment([2012, 0, 2]).format('w ww wo'), '2 02 2.', 'Jan 2 2012 should be week 2');
<add> assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2.', 'Jan 8 2012 should be week 2');
<add> assert.equal(moment([2012, 0, 9]).format('w ww wo'), '3 03 3.', 'Jan 9 2012 should be week 3');
<add>});
<add>
<add>test('lenient ordinal parsing', function (assert) {
<add> var i, ordinalStr, testMoment;
<add> for (i = 1; i <= 31; ++i) {
<add> ordinalStr = moment([2014, 0, i]).format('YYYY MM Do');
<add> testMoment = moment(ordinalStr, 'YYYY MM Do');
<add> assert.equal(testMoment.year(), 2014,
<add> 'lenient ordinal parsing ' + i + ' year check');
<add> assert.equal(testMoment.month(), 0,
<add> 'lenient ordinal parsing ' + i + ' month check');
<add> assert.equal(testMoment.date(), i,
<add> 'lenient ordinal parsing ' + i + ' date check');
<add> }
<add>});
<add>
<add>test('lenient ordinal parsing of number', function (assert) {
<add> var i, testMoment;
<add> for (i = 1; i <= 31; ++i) {
<add> testMoment = moment('2014 01 ' + i, 'YYYY MM Do');
<add> assert.equal(testMoment.year(), 2014,
<add> 'lenient ordinal parsing of number ' + i + ' year check');
<add> assert.equal(testMoment.month(), 0,
<add> 'lenient ordinal parsing of number ' + i + ' month check');
<add> assert.equal(testMoment.date(), i,
<add> 'lenient ordinal parsing of number ' + i + ' date check');
<add> }
<add>});
<add>
<add>test('strict ordinal parsing', function (assert) {
<add> var i, ordinalStr, testMoment;
<add> for (i = 1; i <= 31; ++i) {
<add> ordinalStr = moment([2014, 0, i]).format('YYYY MM Do');
<add> testMoment = moment(ordinalStr, 'YYYY MM Do', true);
<add> assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i);
<add> }
<add>}); | 2 |
Text | Text | add 4.2.0 to changelog | ea486c5e693346373886dcd08496085268ad1e1d | <ide><path>CHANGELOG.md
<ide> # Ember Changelog
<ide>
<del>### v4.2.0-beta.1 (December 28, 2021)
<add>### v4.2.0 (February 7, 2022)
<ide>
<del>- [#19878](https://github.com/emberjs/ember.js/pull/19772) [BUGFIX] Allow class-based helpers to work in strict-mode.
<add>- [#19878](https://github.com/emberjs/ember.js/pull/19878) [BUGFIX] Allow class-based helpers to work in strict-mode.
<ide>
<ide> ### v4.1.0 (December 28, 2021)
<ide> | 1 |
Javascript | Javascript | add test for jquery.unique() alias | add85afed5944ec10d68ca10e91421e031fe0a5d | <ide><path>test/unit/selector.js
<ide> test( "jQuery.contains", function() {
<ide> });
<ide>
<ide> test("jQuery.uniqueSort", function() {
<del> expect( 14 );
<add> expect( 15 );
<ide>
<ide> function Arrayish( arr ) {
<ide> var i = this.length = arr.length;
<ide> test("jQuery.uniqueSort", function() {
<ide> deepEqual( jQuery.uniqueSort( test.input ).slice( 0, length ), test.expected, label + " (array)" );
<ide> deepEqual( jQuery.uniqueSort( new Arrayish(test.input) ).slice( 0, length ), test.expected, label + " (quasi-array)" );
<ide> });
<add>
<add> strictEqual( jQuery.unique, jQuery.uniqueSort, "jQuery.unique() is an alias for jQuery.uniqueSort()" );
<ide> });
<ide>
<ide> testIframe("selector/sizzle_cache", "Sizzle cache collides with multiple Sizzles on a page", function( jQuery, window, document ) { | 1 |
PHP | PHP | improve error messages when persistence fails | 73ee9ed8cd46eff16328d7ad4fc159501474c9db | <ide><path>src/ORM/Exception/PersistenceFailedException.php
<ide>
<ide> use Cake\Core\Exception\Exception;
<ide> use Cake\Datasource\EntityInterface;
<add>use Cake\Utility\Hash;
<ide>
<ide> /**
<ide> * Used when a strict save or delete fails
<ide> public function __construct(EntityInterface $entity, $message, $code = null, $pr
<ide> $this->_entity = $entity;
<ide> if (is_array($message)) {
<ide> $errors = [];
<del> foreach ($entity->getErrors() as $field => $error) {
<del> $errors[] = $field . ': "' . $this->buildError($error) . '"';
<add> foreach (Hash::flatten($entity->getErrors()) as $field => $error) {
<add> $errors[] = $field . ': "' . $error . '"';
<ide> }
<ide> if ($errors) {
<ide> $message[] = implode(', ', $errors);
<del> $this->_messageTemplate = 'Entity %s failure (%s).';
<add> $this->_messageTemplate = 'Entity %s failure. Found the following errors (%s).';
<ide> }
<ide> }
<ide> parent::__construct($message, $code, $previous);
<ide> }
<ide>
<del> /**
<del> * @param string|array $error Error message.
<del> * @return string
<del> */
<del> protected function buildError($error)
<del> {
<del> if (!is_array($error)) {
<del> return $error;
<del> }
<del>
<del> $errors = [];
<del> foreach ($error as $key => $message) {
<del> $errors[] = is_int($key) ? $message : $key;
<del> }
<del>
<del> return implode(', ', $errors);
<del> }
<del>
<ide> /**
<ide> * Get the passed in entity
<ide> *
<ide><path>tests/TestCase/ORM/TableTest.php
<ide> public function testSaveOrFail()
<ide> public function testSaveOrFailErrorDisplay()
<ide> {
<ide> $this->expectException(\Cake\ORM\Exception\PersistenceFailedException::class);
<del> $this->expectExceptionMessage('Entity save failure (field: "Some message", multiple: "one, two")');
<add> $this->expectExceptionMessage('Entity save failure. Found the following errors (field.0: "Some message", multiple.one: "One", multiple.two: "Two")');
<ide>
<ide> $entity = new Entity([
<ide> 'foo' => 'bar'
<ide> public function testSaveOrFailErrorDisplay()
<ide> $table->saveOrFail($entity);
<ide> }
<ide>
<add> /**
<add> * Tests that saveOrFail with nested errors
<add> *
<add> * @return void
<add> */
<add> public function testSaveOrFailNestedError()
<add> {
<add> $this->expectException(\Cake\ORM\Exception\PersistenceFailedException::class);
<add> $this->expectExceptionMessage('Entity save failure. Found the following errors (articles.0.title.0: "Bad value")');
<add>
<add> $entity = new Entity([
<add> 'username' => 'bad',
<add> 'articles' => [
<add> new Entity(['title' => 'not an entity'])
<add> ]
<add> ]);
<add> $entity->articles[0]->setError('title', 'Bad value');
<add>
<add> $table = $this->getTableLocator()->get('Users');
<add> $table->hasMany('Articles');
<add>
<add> $table->saveOrFail($entity);
<add> }
<add>
<ide> /**
<ide> * Tests that saveOrFail returns the right entity
<ide> * | 2 |
Text | Text | add contributor covenant code of conduct | 0fd48de10a7d6b9c35d9710fffa1d52166d96862 | <ide><path>CODE_OF_CONDUCT.md
<add># Contributor Covenant Code of Conduct
<add>
<add>## Our Pledge
<add>
<add>In the interest of fostering an open and welcoming environment, we as
<add>contributors and maintainers pledge to making participation in our project and
<add>our community a harassment-free experience for everyone, regardless of age, body
<add>size, disability, ethnicity, gender identity and expression, level of experience,
<add>nationality, personal appearance, race, religion, or sexual identity and
<add>orientation.
<add>
<add>## Our Standards
<add>
<add>Examples of behavior that contributes to creating a positive environment
<add>include:
<add>
<add>* Using welcoming and inclusive language
<add>* Being respectful of differing viewpoints and experiences
<add>* Gracefully accepting constructive criticism
<add>* Focusing on what is best for the community
<add>* Showing empathy towards other community members
<add>
<add>Examples of unacceptable behavior by participants include:
<add>
<add>* The use of sexualized language or imagery and unwelcome sexual attention or
<add>advances
<add>* Trolling, insulting/derogatory comments, and personal or political attacks
<add>* Public or private harassment
<add>* Publishing others' private information, such as a physical or electronic
<add> address, without explicit permission
<add>* Other conduct which could reasonably be considered inappropriate in a
<add> professional setting
<add>
<add>## Our Responsibilities
<add>
<add>Project maintainers are responsible for clarifying the standards of acceptable
<add>behavior and are expected to take appropriate and fair corrective action in
<add>response to any instances of unacceptable behavior.
<add>
<add>Project maintainers have the right and responsibility to remove, edit, or
<add>reject comments, commits, code, wiki edits, issues, and other contributions
<add>that are not aligned to this Code of Conduct, or to ban temporarily or
<add>permanently any contributor for other behaviors that they deem inappropriate,
<add>threatening, offensive, or harmful.
<add>
<add>## Scope
<add>
<add>This Code of Conduct applies both within project spaces and in public spaces
<add>when an individual is representing the project or its community. Examples of
<add>representing a project or community include using an official project e-mail
<add>address, posting via an official social media account, or acting as an appointed
<add>representative at an online or offline event. Representation of a project may be
<add>further defined and clarified by project maintainers.
<add>
<add>## Enforcement
<add>
<add>Instances of abusive, harassing, or otherwise unacceptable behavior may be
<add>reported by contacting the project team at [email protected]. All
<add>complaints will be reviewed and investigated and will result in a response that
<add>is deemed necessary and appropriate to the circumstances. The project team is
<add>obligated to maintain confidentiality with regard to the reporter of an incident.
<add>Further details of specific enforcement policies may be posted separately.
<add>
<add>Project maintainers who do not follow or enforce the Code of Conduct in good
<add>faith may face temporary or permanent repercussions as determined by other
<add>members of the project's leadership.
<add>
<add>## Attribution
<add>
<add>This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
<add>available at [http://contributor-covenant.org/version/1/4][version]
<add>
<add>[homepage]: http://contributor-covenant.org
<add>[version]: http://contributor-covenant.org/version/1/4/ | 1 |
Javascript | Javascript | add tzdate to angular-mocks.js | 4c61fc01f9c251c39f540316cc82332bc8b3f370 | <ide><path>test/FiltersSpec.js
<ide> describe('filter', function(){
<ide> });
<ide>
<ide> describe('date', function(){
<del> var morning = angular.String.toDate('2010-09-03T23:05:08Z');
<del> var midnight = angular.String.toDate('2010-09-03T23:05:08Z');
<del> var noon = angular.String.toDate('2010-09-03T23:05:08Z');
<del> morning.setHours(7);
<del> noon.setHours(12);
<del> midnight.setHours(0);
<del>
<del> //butt-ugly hack: force the date to be 2pm PDT for locale testing
<del> morning.getTimezoneOffset =
<del> noon.getTimezoneOffset =
<del> midnight.getTimezoneOffset =
<del> function() {return 7 * 60;};
<add>
<add> var morning = new TzDate(+5, '2010-09-03T12:05:08Z'); //7am
<add> var noon = new TzDate(+5, '2010-09-03T17:05:08Z'); //12pm
<add> var midnight = new TzDate(+5, '2010-09-03T05:05:08Z'); //12am
<add>
<ide>
<ide> it('should ignore falsy inputs', function() {
<ide> expect(filter.date(null)).toEqual(null);
<ide> describe('filter', function(){
<ide> });
<ide>
<ide> it('should accept format', function() {
<add> expect(filter.date(morning, "yy-MM-dd HH:mm:ss")).
<add> toEqual('10-09-03 07:05:08');
<add>
<ide> expect(filter.date(midnight, "yyyy-M-d h=H:m:saZ")).
<del> toEqual('2010-9-3 12=0:5:8am0700');
<add> toEqual('2010-9-3 12=0:5:8am0500');
<ide>
<ide> expect(filter.date(midnight, "yyyy-MM-dd hh=HH:mm:ssaZ")).
<del> toEqual('2010-09-03 12=00:05:08am0700');
<add> toEqual('2010-09-03 12=00:05:08am0500');
<ide>
<ide> expect(filter.date(noon, "yyyy-MM-dd hh=HH:mm:ssaZ")).
<del> toEqual('2010-09-03 12=12:05:08pm0700');
<del>
<add> toEqual('2010-09-03 12=12:05:08pm0500');
<ide> });
<ide> });
<ide> });
<del>
<ide><path>test/angular-mocks.js
<ide> MockBrowser.prototype = {
<ide> angular.service('$browser', function(){
<ide> return new MockBrowser();
<ide> });
<add>
<add>
<add>/**
<add> * Mock of the Date type which has its timezone specified via constroctor arg.
<add> *
<add> * The main purpose is to create Date-like instances with timezone fixed to the specified timezone
<add> * offset, so that we can test code that depends on local timezone settings without dependency on
<add> * the time zone settings of the machine where the code is running.
<add> *
<add> * @param {number} offset Offset of the *desired* timezone in hours (fractions will be honored)
<add> * @param {(number|string)} timestamp Timestamp representing the desired time in *UTC*
<add> *
<add> * @example
<add> * var newYearInBratislava = new TzDate(-1, '2009-12-31T23:00:00Z');
<add> * newYearInBratislava.getTimezoneOffset() => -60;
<add> * newYearInBratislava.getFullYear() => 2010;
<add> * newYearInBratislava.getMonth() => 0;
<add> * newYearInBratislava.getDate() => 1;
<add> * newYearInBratislava.getHours() => 0;
<add> * newYearInBratislava.getMinutes() => 0;
<add> *
<add> *
<add> * !!!! WARNING !!!!!
<add> * This is not a complete Date object so only methods that were implemented can be called safely.
<add> * To make matters worse, TzDate instances inherit stuff from Date via a prototype.
<add> *
<add> * We do our best to intercept calls to "unimplemented" methods, but since the list of methods is
<add> * incomplete we might be missing some non-standard methods. This can result in errors like:
<add> * "Date.prototype.foo called on incompatible Object".
<add> */
<add>function TzDate(offset, timestamp) {
<add> if (angular.isString(timestamp)) {
<add> var tsStr = timestamp;
<add> timestamp = new Date(timestamp).getTime();
<add> if (isNaN(timestamp))
<add> throw {
<add> name: "Illegal Argument",
<add> message: "Arg '" + tsStr + "' passed into TzDate constructor is not a valid date string"
<add> };
<add> }
<add>
<add> var localOffset = new Date(timestamp).getTimezoneOffset();
<add> this.offsetDiff = localOffset*60*1000 - offset*1000*60*60;
<add> this.date = new Date(timestamp + this.offsetDiff);
<add>
<add> this.getTime = function() {
<add> return this.date.getTime() - this.offsetDiff;
<add> };
<add>
<add> this.toLocaleDateString = function() {
<add> return this.date.toLocaleDateString();
<add> };
<add>
<add> this.getFullYear = function() {
<add> return this.date.getFullYear();
<add> };
<add>
<add> this.getMonth = function() {
<add> return this.date.getMonth();
<add> };
<add>
<add> this.getDate = function() {
<add> return this.date.getDate();
<add> };
<add>
<add> this.getHours = function() {
<add> return this.date.getHours();
<add> };
<add>
<add> this.getMinutes = function() {
<add> return this.date.getMinutes();
<add> };
<add>
<add> this.getSeconds = function() {
<add> return this.date.getSeconds();
<add> };
<add>
<add> this.getTimezoneOffset = function() {
<add> return offset * 60;
<add> };
<add>
<add> //hide all methods not implemented in this mock that the Date prototype exposes
<add> var unimplementedMethods = ['getDay', 'getMilliseconds', 'getTime', 'getUTCDate', 'getUTCDay',
<add> 'getUTCFullYear', 'getUTCHours', 'getUTCMilliseconds', 'getUTCMinutes', 'getUTCMonth',
<add> 'getUTCSeconds', 'getYear', 'setDate', 'setFullYear', 'setHours', 'setMilliseconds',
<add> 'setMinutes', 'setMonth', 'setSeconds', 'setTime', 'setUTCDate', 'setUTCFullYear',
<add> 'setUTCHours', 'setUTCMilliseconds', 'setUTCMinutes', 'setUTCMonth', 'setUTCSeconds',
<add> 'setYear', 'toDateString', 'toJSON', 'toGMTString', 'toLocaleFormat', 'toLocaleString',
<add> 'toLocaleTimeString', 'toSource', 'toString', 'toTimeString', 'toUTCString', 'valueOf'];
<add>
<add> angular.foreach(unimplementedMethods, function(methodName) {
<add> this[methodName] = function() {
<add> throw {
<add> name: "MethodNotImplemented",
<add> message: "Method '" + methodName + "' is not implemented in the TzDate mock"
<add> };
<add> };
<add> });
<add>}
<add>
<add>//make "tzDateInstance instanceof Date" return true
<add>TzDate.prototype = Date.prototype; | 2 |
Text | Text | fix the command python -m simplehttpserver | a893cb43c340b7b5ba12304b483319bf32eef2cb | <ide><path>guide/english/python/share-file-using-python-simple-http-server/index.md
<ide> title: Share File Using Python SimpleHTTPserver
<ide> 2. Open terminal in Ubuntu and make sure you have python installed in your PC.
<ide> 3. If not installed then install it by typing in terminal "sudo apt-get install python" without quotes.
<ide> 4. Goto the directory whose file you want to share by using cd(change directory) command.
<del>5. Type this command "python -m simpleHTTPserver" without quotes.
<add>5. Type this command "python -m SimpleHTTPServer" without quotes.
<ide> 6. Open new terminal and type ifconfig and find your IP address.
<ide>
<ide> ## Now in the second computer | 1 |
Javascript | Javascript | kill zombies when debugger-client fails on windows | 98c6a81771513622fbc21b01f623447ed38b70c4 | <ide><path>test/simple/test-debugger-client.js
<ide> function doTest(cb, done) {
<ide>
<ide> nodeProcess.stdout.once('data', function(c) {
<ide> console.log('>>> new node process: %d', nodeProcess.pid);
<del> process._debugProcess(nodeProcess.pid);
<add> var failed = true;
<add> try {
<add> process._debugProcess(nodeProcess.pid);
<add> failed = false;
<add> } finally {
<add> // At least TRY not to leave zombie procs if this fails.
<add> if (failed)
<add> nodeProcess.kill('SIGTERM');
<add> }
<ide> console.log('>>> starting debugger session');
<ide> });
<ide> | 1 |
PHP | PHP | add morphusingulids to schema facade | 7f71ec4b23f9e57baa0088ad16b78e7b33c1b34e | <ide><path>src/Illuminate/Support/Facades/Schema.php
<ide> * @method static array getColumnListing(string $table)
<ide> * @method static string getColumnType(string $table, string $column)
<ide> * @method static void morphUsingUuids()
<add> * @method static void morphUsingUlids()
<ide> * @method static \Illuminate\Database\Connection getConnection()
<ide> * @method static \Illuminate\Database\Schema\Builder setConnection(\Illuminate\Database\Connection $connection)
<ide> * | 1 |
PHP | PHP | consider tinytext as text | 723a352452a442befbccfefb8c9599834c227497 | <ide><path>src/Database/Schema/MysqlSchema.php
<ide> protected function _convertColumn($column) {
<ide> if ($col === 'char') {
<ide> return ['type' => 'string', 'fixed' => true, 'length' => $length];
<ide> }
<del> if (strpos($col, 'char') !== false || $col === 'tinytext') {
<add> if (strpos($col, 'char') !== false) {
<ide> return ['type' => 'string', 'length' => $length];
<ide> }
<ide> if (strpos($col, 'text') !== false) {
<ide><path>tests/TestCase/Database/Schema/MysqlSchemaTest.php
<ide> public static function convertColumnProvider() {
<ide> ],
<ide> [
<ide> 'TINYTEXT',
<del> ['type' => 'string', 'length' => null]
<add> ['type' => 'text', 'length' => null]
<ide> ],
<ide> [
<ide> 'BLOB', | 2 |
Python | Python | add call to super call in microsoft providers | a83eb335e58c6a15e96c517a1b492bc79c869ce8 | <ide><path>airflow/providers/microsoft/azure/hooks/adx.py
<ide> class AzureDataExplorerHook(BaseHook):
<ide> def __init__(
<ide> self,
<ide> azure_data_explorer_conn_id: str = 'azure_data_explorer_default'):
<add> super().__init__()
<ide> self.conn_id = azure_data_explorer_conn_id
<ide> self.connection = self.get_conn()
<ide>
<ide><path>airflow/providers/microsoft/azure/hooks/azure_container_instance.py
<ide> class AzureContainerInstanceHook(BaseHook):
<ide> """
<ide>
<ide> def __init__(self, conn_id='azure_default'):
<add> super().__init__()
<ide> self.conn_id = conn_id
<ide> self.connection = self.get_conn()
<ide>
<ide><path>airflow/providers/microsoft/azure/hooks/azure_container_registry.py
<ide> class AzureContainerRegistryHook(BaseHook):
<ide> """
<ide>
<ide> def __init__(self, conn_id='azure_registry'):
<add> super().__init__()
<ide> self.conn_id = conn_id
<ide> self.connection = self.get_conn()
<ide>
<ide><path>airflow/providers/microsoft/azure/hooks/azure_container_volume.py
<ide> class AzureContainerVolumeHook(BaseHook):
<ide> """
<ide>
<ide> def __init__(self, wasb_conn_id='wasb_default'):
<add> super().__init__()
<ide> self.conn_id = wasb_conn_id
<ide>
<ide> def get_storagekey(self):
<ide><path>airflow/providers/microsoft/azure/hooks/azure_cosmos.py
<ide> class AzureCosmosDBHook(BaseHook):
<ide> """
<ide>
<ide> def __init__(self, azure_cosmos_conn_id='azure_cosmos_default'):
<add> super().__init__()
<ide> self.conn_id = azure_cosmos_conn_id
<ide> self._conn = None
<ide>
<ide><path>airflow/providers/microsoft/azure/hooks/azure_data_lake.py
<ide> class AzureDataLakeHook(BaseHook):
<ide> """
<ide>
<ide> def __init__(self, azure_data_lake_conn_id='azure_data_lake_default'):
<add> super().__init__()
<ide> self.conn_id = azure_data_lake_conn_id
<ide> self._conn = None
<ide> self.account_name = None
<ide><path>airflow/providers/microsoft/azure/hooks/azure_fileshare.py
<ide> class AzureFileShareHook(BaseHook):
<ide> """
<ide>
<ide> def __init__(self, wasb_conn_id='wasb_default'):
<add> super().__init__()
<ide> self.conn_id = wasb_conn_id
<ide> self._conn = None
<ide>
<ide><path>airflow/providers/microsoft/azure/hooks/wasb.py
<ide> class WasbHook(BaseHook):
<ide> """
<ide>
<ide> def __init__(self, wasb_conn_id='wasb_default'):
<add> super().__init__()
<ide> self.conn_id = wasb_conn_id
<ide> self.connection = self.get_conn()
<ide>
<ide><path>airflow/providers/microsoft/winrm/hooks/winrm.py
<ide> def __init__(self,
<ide> message_encryption='auto',
<ide> credssp_disable_tlsv1_2=False,
<ide> send_cbt=True):
<add> super().__init__()
<ide> self.ssh_conn_id = ssh_conn_id
<ide> self.endpoint = endpoint
<ide> self.remote_host = remote_host | 9 |
Javascript | Javascript | reduce duplicated code for cleaning parser | d7f17b2a6107e25ac343cf11667b3f6b8d48f4a3 | <ide><path>lib/_http_common.js
<ide> function parserOnMessageComplete() {
<ide> const parsers = new FreeList('parsers', 1000, function parsersCb() {
<ide> const parser = new HTTPParser(HTTPParser.REQUEST);
<ide>
<del> parser._headers = [];
<del> parser._url = '';
<del> parser._consumed = false;
<del>
<del> parser.socket = null;
<del> parser.incoming = null;
<del> parser.outgoing = null;
<del>
<del> parser.maxHeaderPairs = MAX_HEADER_PAIRS;
<add> cleanParser(parser);
<ide>
<ide> parser.onIncoming = null;
<ide> parser[kOnHeaders] = parserOnHeaders;
<ide> parser[kOnHeadersComplete] = parserOnHeadersComplete;
<ide> parser[kOnBody] = parserOnBody;
<ide> parser[kOnMessageComplete] = parserOnMessageComplete;
<del> parser[kOnExecute] = null;
<ide>
<ide> return parser;
<ide> });
<ide> function closeParserInstance(parser) { parser.close(); }
<ide> // should be all that is needed.
<ide> function freeParser(parser, req, socket) {
<ide> if (parser) {
<del> parser._headers = [];
<del> parser._url = '';
<del> parser.maxHeaderPairs = MAX_HEADER_PAIRS;
<del> parser.onIncoming = null;
<ide> if (parser._consumed)
<ide> parser.unconsume();
<del> parser._consumed = false;
<del> parser.socket = null;
<del> parser.incoming = null;
<del> parser.outgoing = null;
<del> parser[kOnExecute] = null;
<add> cleanParser(parser);
<ide> if (parsers.free(parser) === false) {
<ide> // Make sure the parser's stack has unwound before deleting the
<ide> // corresponding C++ object through .close().
<ide> function checkInvalidHeaderChar(val) {
<ide> return headerCharRegex.test(val);
<ide> }
<ide>
<add>function cleanParser(parser) {
<add> parser._headers = [];
<add> parser._url = '';
<add> parser.socket = null;
<add> parser.incoming = null;
<add> parser.outgoing = null;
<add> parser.maxHeaderPairs = MAX_HEADER_PAIRS;
<add> parser[kOnExecute] = null;
<add> parser._consumed = false;
<add>}
<add>
<ide> module.exports = {
<ide> _checkInvalidHeaderChar: checkInvalidHeaderChar,
<ide> _checkIsHttpToken: checkIsHttpToken, | 1 |
Go | Go | set default mtu when initializing config | a0d0db126c5e2a846a61704e1a24ef4067644137 | <ide><path>cmd/dockerd/config.go
<ide> func installCommonConfigFlags(conf *config.Config, flags *pflag.FlagSet) error {
<ide> flags.StringVar(&conf.ContainerdAddr, "containerd", "", "containerd grpc address")
<ide> flags.BoolVar(&conf.CriContainerd, "cri-containerd", false, "start containerd with cri")
<ide>
<del> flags.IntVar(&conf.Mtu, "mtu", 0, "Set the containers network MTU")
<add> flags.IntVar(&conf.Mtu, "mtu", conf.Mtu, "Set the containers network MTU")
<ide> flags.IntVar(&conf.NetworkControlPlaneMTU, "network-control-plane-mtu", config.DefaultNetworkMtu, "Network Control plane MTU")
<ide> flags.IntVar(&conf.NetworkDiagnosticPort, "network-diagnostic-port", 0, "TCP port number of the network diagnostic server")
<ide> _ = flags.MarkHidden("network-diagnostic-port")
<ide><path>daemon/config/config.go
<ide> func New() *Config {
<ide> LogConfig: LogConfig{
<ide> Config: make(map[string]string),
<ide> },
<add> Mtu: DefaultNetworkMtu,
<ide> },
<ide> }
<ide> }
<ide><path>daemon/config/config_test.go
<ide> package config // import "github.com/docker/docker/daemon/config"
<ide>
<ide> import (
<ide> "os"
<add> "reflect"
<ide> "strings"
<ide> "testing"
<ide>
<ide> "github.com/docker/docker/libnetwork/ipamutils"
<ide> "github.com/docker/docker/opts"
<add> "github.com/google/go-cmp/cmp"
<add> "github.com/google/go-cmp/cmp/cmpopts"
<add> "github.com/imdario/mergo"
<ide> "github.com/spf13/pflag"
<ide> "gotest.tools/v3/assert"
<ide> is "gotest.tools/v3/assert/cmp"
<ide> func TestFindConfigurationConflictsWithMergedValues(t *testing.T) {
<ide> func TestValidateConfigurationErrors(t *testing.T) {
<ide> testCases := []struct {
<ide> name string
<add> field string
<ide> config *Config
<ide> expectedErr string
<ide> }{
<ide> func TestValidateConfigurationErrors(t *testing.T) {
<ide> // TODO(thaJeztah) temporarily excluding this test as it assumes defaults are set before validating and applying updated configs
<ide> /*
<ide> {
<del> name: "zero max-download-attempts",
<add> name: "zero max-download-attempts",
<add> field: "MaxDownloadAttempts",
<ide> config: &Config{
<ide> CommonConfig: CommonConfig{
<ide> MaxDownloadAttempts: 0,
<ide> func TestValidateConfigurationErrors(t *testing.T) {
<ide> }
<ide> for _, tc := range testCases {
<ide> t.Run(tc.name, func(t *testing.T) {
<del> err := Validate(tc.config)
<add> cfg := New()
<add> if tc.field != "" {
<add> assert.Check(t, mergo.Merge(cfg, tc.config, mergo.WithOverride, withForceOverwrite(tc.field)))
<add> } else {
<add> assert.Check(t, mergo.Merge(cfg, tc.config, mergo.WithOverride))
<add> }
<add> err := Validate(cfg)
<ide> assert.Error(t, err, tc.expectedErr)
<ide> })
<ide> }
<ide> }
<ide>
<add>func withForceOverwrite(fieldName string) func(config *mergo.Config) {
<add> return mergo.WithTransformers(overwriteTransformer{fieldName: fieldName})
<add>}
<add>
<add>type overwriteTransformer struct {
<add> fieldName string
<add>}
<add>
<add>func (tf overwriteTransformer) Transformer(typ reflect.Type) func(dst, src reflect.Value) error {
<add> if typ == reflect.TypeOf(CommonConfig{}) {
<add> return func(dst, src reflect.Value) error {
<add> dst.FieldByName(tf.fieldName).Set(src.FieldByName(tf.fieldName))
<add> return nil
<add> }
<add> }
<add> return nil
<add>}
<add>
<ide> func TestValidateConfiguration(t *testing.T) {
<ide> testCases := []struct {
<ide> name string
<add> field string
<ide> config *Config
<ide> }{
<ide> {
<del> name: "with label",
<add> name: "with label",
<add> field: "Labels",
<ide> config: &Config{
<ide> CommonConfig: CommonConfig{
<ide> Labels: []string{"one=two"},
<ide> },
<ide> },
<ide> },
<ide> {
<del> name: "with dns",
<add> name: "with dns",
<add> field: "DNSConfig",
<ide> config: &Config{
<ide> CommonConfig: CommonConfig{
<ide> DNSConfig: DNSConfig{
<ide> func TestValidateConfiguration(t *testing.T) {
<ide> },
<ide> },
<ide> {
<del> name: "with dns-search",
<add> name: "with dns-search",
<add> field: "DNSConfig",
<ide> config: &Config{
<ide> CommonConfig: CommonConfig{
<ide> DNSConfig: DNSConfig{
<ide> func TestValidateConfiguration(t *testing.T) {
<ide> },
<ide> },
<ide> {
<del> name: "with mtu",
<add> name: "with mtu",
<add> field: "Mtu",
<ide> config: &Config{
<ide> CommonConfig: CommonConfig{
<ide> Mtu: 1234,
<ide> },
<ide> },
<ide> },
<ide> {
<del> name: "with max-concurrent-downloads",
<add> name: "with max-concurrent-downloads",
<add> field: "MaxConcurrentDownloads",
<ide> config: &Config{
<ide> CommonConfig: CommonConfig{
<ide> MaxConcurrentDownloads: 4,
<ide> },
<ide> },
<ide> },
<ide> {
<del> name: "with max-concurrent-uploads",
<add> name: "with max-concurrent-uploads",
<add> field: "MaxConcurrentUploads",
<ide> config: &Config{
<ide> CommonConfig: CommonConfig{
<ide> MaxConcurrentUploads: 4,
<ide> },
<ide> },
<ide> },
<ide> {
<del> name: "with max-download-attempts",
<add> name: "with max-download-attempts",
<add> field: "MaxDownloadAttempts",
<ide> config: &Config{
<ide> CommonConfig: CommonConfig{
<ide> MaxDownloadAttempts: 4,
<ide> },
<ide> },
<ide> },
<ide> {
<del> name: "with multiple node generic resources",
<add> name: "with multiple node generic resources",
<add> field: "NodeGenericResources",
<ide> config: &Config{
<ide> CommonConfig: CommonConfig{
<ide> NodeGenericResources: []string{"foo=bar", "foo=baz"},
<ide> },
<ide> },
<ide> },
<ide> {
<del> name: "with node generic resources",
<add> name: "with node generic resources",
<add> field: "NodeGenericResources",
<ide> config: &Config{
<ide> CommonConfig: CommonConfig{
<ide> NodeGenericResources: []string{"foo=1"},
<ide> },
<ide> },
<ide> },
<ide> {
<del> name: "with hosts",
<add> name: "with hosts",
<add> field: "Hosts",
<ide> config: &Config{
<ide> CommonConfig: CommonConfig{
<ide> Hosts: []string{"tcp://127.0.0.1:2375"},
<ide> },
<ide> },
<ide> },
<ide> {
<del> name: "with log-level warn",
<add> name: "with log-level warn",
<add> field: "LogLevel",
<ide> config: &Config{
<ide> CommonConfig: CommonConfig{
<ide> LogLevel: "warn",
<ide> func TestValidateConfiguration(t *testing.T) {
<ide> }
<ide> for _, tc := range testCases {
<ide> t.Run(tc.name, func(t *testing.T) {
<del> err := Validate(tc.config)
<add> // Start with a config with all defaults set, so that we only
<add> cfg := New()
<add> assert.Check(t, mergo.Merge(cfg, tc.config, mergo.WithOverride))
<add>
<add> // Check that the override happened :)
<add> assert.Check(t, is.DeepEqual(cfg, tc.config, field(tc.field)))
<add> err := Validate(cfg)
<ide> assert.NilError(t, err)
<ide> })
<ide> }
<ide> }
<ide>
<add>func field(field string) cmp.Option {
<add> tmp := reflect.TypeOf(Config{})
<add> ignoreFields := make([]string, 0, tmp.NumField())
<add> for i := 0; i < tmp.NumField(); i++ {
<add> if tmp.Field(i).Name != field {
<add> ignoreFields = append(ignoreFields, tmp.Field(i).Name)
<add> }
<add> }
<add> return cmpopts.IgnoreFields(Config{}, ignoreFields...)
<add>}
<add>
<ide> // TestReloadSetConfigFileNotExist tests that when `--config-file` is set
<ide> // and it doesn't exist the `Reload` function returns an error.
<ide> func TestReloadSetConfigFileNotExist(t *testing.T) {
<ide><path>daemon/daemon.go
<ide> func (daemon *Daemon) IsSwarmCompatible() error {
<ide> // NewDaemon sets up everything for the daemon to be able to service
<ide> // requests from the webserver.
<ide> func NewDaemon(ctx context.Context, config *config.Config, pluginStore *plugin.Store) (daemon *Daemon, err error) {
<del> setDefaultMtu(config)
<del>
<ide> registryService, err := registry.NewService(config.ServiceOptions)
<ide> if err != nil {
<ide> return nil, err
<ide> func (daemon *Daemon) setGenericResources(conf *config.Config) error {
<ide> return nil
<ide> }
<ide>
<del>func setDefaultMtu(conf *config.Config) {
<del> // do nothing if the config does not have the default 0 value.
<del> if conf.Mtu != 0 {
<del> return
<del> }
<del> conf.Mtu = config.DefaultNetworkMtu
<del>}
<del>
<ide> // IsShuttingDown tells whether the daemon is shutting down or not
<ide> func (daemon *Daemon) IsShuttingDown() bool {
<ide> return daemon.shutdown | 4 |
PHP | PHP | use integers for integery things | cd9d04b1b7cc171e14f5270e80d0a6e872773358 | <ide><path>Cake/View/Helper/PaginatorHelper.php
<ide> public function numbers($options = array()) {
<ide>
<ide> $defaults = array(
<ide> 'before' => null, 'after' => null, 'model' => $this->defaultModel(),
<del> 'modulus' => '8', 'first' => null, 'last' => null,
<add> 'modulus' => 8, 'first' => null, 'last' => null,
<ide> );
<ide> $options += $defaults;
<ide> | 1 |
Python | Python | fix save when laod_best_model_at_end=true | 2024faf1713272464336ad97f371787b24cb3c53 | <ide><path>src/transformers/trainer_callback.py
<ide> def on_step_end(self, args: TrainingArguments, state: TrainerState, control: Tra
<ide> # Evaluate
<ide> if args.evaluation_strategy == IntervalStrategy.STEPS and state.global_step % args.eval_steps == 0:
<ide> control.should_evaluate = True
<del> if args.load_best_model_at_end:
<del> control.should_save = True
<ide>
<ide> # Save
<ide> if ( | 1 |
PHP | PHP | add callable typehint to `and_` query expression | 6d779debffcea5bfda48a265ed05533922a2c8be | <ide><path>src/Database/Expression/QueryExpression.php
<ide> public function between($field, $from, $to, $type = null)
<ide> * Returns a new QueryExpression object containing all the conditions passed
<ide> * and set up the conjunction to be "AND"
<ide> *
<del> * @param string|array|\Cake\Database\ExpressionInterface $conditions to be joined with AND
<add> * @param callable|string|array|\Cake\Database\ExpressionInterface $conditions to be joined with AND
<ide> * @param array $types associative array of fields pointing to the type of the
<ide> * values that are being passed. Used for correctly binding values to statements.
<ide> * @return \Cake\Database\Expression\QueryExpression | 1 |
Text | Text | use arrow function | 85aa53a1c9a5ff3362d6fb3b67776a63d4a88b8a | <ide><path>doc/api/v8.md
<ide> Usage:
<ide> // Print GC events to stdout for one minute.
<ide> const v8 = require('v8');
<ide> v8.setFlagsFromString('--trace_gc');
<del>setTimeout(function() { v8.setFlagsFromString('--notrace_gc'); }, 60e3);
<add>setTimeout(() => { v8.setFlagsFromString('--notrace_gc'); }, 60e3);
<ide> ```
<ide>
<ide> ## Serialization API | 1 |
Mixed | Ruby | allow filtering params based on parent keys | 33b93174f0db9783b3c6c906666923103569c6a3 | <ide><path>actionpack/CHANGELOG.md
<add>* Add ability to filter parameters based on parent keys.
<add>
<add> # matches {credit_card: {code: "xxxx"}}
<add> # doesn't match {file: { code: "xxxx"}}
<add> config.filter_parameters += [ "credit_card.code" ]
<add>
<add> See #13897.
<add>
<add> *Guillaume Malette*
<add>
<ide> * Deprecate passing first parameter as `Hash` and default status code for `head` method.
<ide>
<ide> *Mehmet Emin İNAÇ*
<ide><path>actionpack/lib/action_dispatch/http/parameter_filter.rb
<ide> def self.compile(filters)
<ide> when Regexp
<ide> regexps << item
<ide> else
<del> strings << item.to_s
<add> strings << Regexp.escape(item.to_s)
<ide> end
<ide> end
<ide>
<add> deep_regexps, regexps = regexps.partition { |r| r.to_s.include?("\\.") }
<add> deep_strings, strings = strings.partition { |s| s.include?("\\.") }
<add>
<ide> regexps << Regexp.new(strings.join('|'), true) unless strings.empty?
<del> new regexps, blocks
<add> deep_regexps << Regexp.new(deep_strings.join('|'), true) unless deep_strings.empty?
<add>
<add> new regexps, deep_regexps, blocks
<ide> end
<ide>
<del> attr_reader :regexps, :blocks
<add> attr_reader :regexps, :deep_regexps, :blocks
<ide>
<del> def initialize(regexps, blocks)
<add> def initialize(regexps, deep_regexps, blocks)
<ide> @regexps = regexps
<add> @deep_regexps = deep_regexps.any? ? deep_regexps : nil
<ide> @blocks = blocks
<ide> end
<ide>
<del> def call(original_params)
<add> def call(original_params, parents = [])
<ide> filtered_params = {}
<ide>
<ide> original_params.each do |key, value|
<add> parents.push(key) if deep_regexps
<ide> if regexps.any? { |r| key =~ r }
<ide> value = FILTERED
<add> elsif deep_regexps && (joined = parents.join('.')) && deep_regexps.any? { |r| joined =~ r }
<add> value = FILTERED
<ide> elsif value.is_a?(Hash)
<del> value = call(value)
<add> value = call(value, parents)
<ide> elsif value.is_a?(Array)
<del> value = value.map { |v| v.is_a?(Hash) ? call(v) : v }
<add> value = value.map { |v| v.is_a?(Hash) ? call(v, parents) : v }
<ide> elsif blocks.any?
<ide> key = key.dup if key.duplicable?
<ide> value = value.dup if value.duplicable?
<ide> blocks.each { |b| b.call(key, value) }
<ide> end
<add> parents.pop if deep_regexps
<ide>
<ide> filtered_params[key] = value
<ide> end
<ide><path>actionpack/test/dispatch/request_test.rb
<ide> class RequestParameterFilter < BaseRequestTest
<ide> [{'foo'=>'bar', 'baz'=>'foo'},{'foo'=>'[FILTERED]', 'baz'=>'[FILTERED]'},%w'foo baz'],
<ide> [{'bar'=>{'foo'=>'bar','bar'=>'foo'}},{'bar'=>{'foo'=>'[FILTERED]','bar'=>'foo'}},%w'fo'],
<ide> [{'foo'=>{'foo'=>'bar','bar'=>'foo'}},{'foo'=>'[FILTERED]'},%w'f banana'],
<add> [{'deep'=>{'cc'=>{'code'=>'bar','bar'=>'foo'},'ss'=>{'code'=>'bar'}}},{'deep'=>{'cc'=>{'code'=>'[FILTERED]','bar'=>'foo'},'ss'=>{'code'=>'bar'}}},%w'deep.cc.code'],
<ide> [{'baz'=>[{'foo'=>'baz'}, "1"]}, {'baz'=>[{'foo'=>'[FILTERED]'}, "1"]}, [/foo/]]]
<ide>
<ide> test_hashes.each do |before_filter, after_filter, filter_words| | 3 |
Go | Go | save the controller config on config reload | 47c071b654fc1513e76230b15c1140ab5307ab24 | <ide><path>libnetwork/controller.go
<ide> func (c *controller) ReloadConfiguration(cfgOptions ...config.Option) error {
<ide> return nil
<ide> }
<ide>
<add> c.Lock()
<add> c.cfg = cfg
<add> c.Unlock()
<add>
<ide> var dsConfig *discoverapi.DatastoreConfigData
<ide> for scope, sCfg := range cfg.Scopes {
<ide> if scope == datastore.LocalScope || !sCfg.IsValid() { | 1 |
PHP | PHP | add lazy() method to standard collection | 2bc42882d85787d1cbace7215c27dda138e67a10 | <ide><path>src/Illuminate/Support/Collection.php
<ide> public function all()
<ide> return $this->items;
<ide> }
<ide>
<add> /**
<add> * Get a lazy collection for the items in this collection.
<add> *
<add> * @return \Illuminate\Support\LazyCollection
<add> */
<add> public function lazy()
<add> {
<add> return new LazyCollection($this->items);
<add> }
<add>
<ide> /**
<ide> * Get the average value of a given key.
<ide> *
<ide><path>tests/Support/SupportCollectionTest.php
<ide> public function testToArrayCallsToArrayOnEachItemInCollection($collection)
<ide> $this->assertEquals(['foo.array', 'bar.array'], $results);
<ide> }
<ide>
<add> public function testLazyReturnsLazyCollection()
<add> {
<add> $data = new Collection([1, 2, 3, 4, 5]);
<add>
<add> $lazy = $data->lazy();
<add>
<add> $data->add(6);
<add>
<add> $this->assertInstanceOf(LazyCollection::class, $lazy);
<add> $this->assertSame([1, 2, 3, 4, 5], $lazy->all());
<add> }
<add>
<ide> /**
<ide> * @dataProvider collectionClassProvider
<ide> */ | 2 |
PHP | PHP | remove useless statement. | 6403bea2360361465726a1661a59241fd788176b | <ide><path>src/Illuminate/Http/Resources/Json/JsonResource.php
<ide> public function resolve($request = null)
<ide> $request = $request ?: Container::getInstance()->make('request')
<ide> );
<ide>
<del> if (is_array($data)) {
<del> $data = $data;
<del> } elseif ($data instanceof Arrayable) {
<add> if ($data instanceof Arrayable) {
<ide> $data = $data->toArray();
<ide> } elseif ($data instanceof JsonSerializable) {
<ide> $data = $data->jsonSerialize(); | 1 |
Text | Text | add example for buffer.isencoding() | c81062a908d00ae9ba62daa62e1a05798e93dcfb | <ide><path>doc/api/buffer.md
<ide> added: v0.9.1
<ide> Returns `true` if `encoding` contains a supported character encoding, or `false`
<ide> otherwise.
<ide>
<add>```js
<add>console.log(Buffer.isEncoding('utf-8'));
<add>// Prints: true
<add>
<add>console.log(Buffer.isEncoding('hex'));
<add>// Prints: true
<add>
<add>console.log(Buffer.isEncoding('utf/8'));
<add>// Prints: false
<add>
<add>console.log(Buffer.isEncoding(''));
<add>// Prints: false
<add>```
<add>
<ide> ### Class Property: Buffer.poolSize
<ide> <!-- YAML
<ide> added: v0.11.3 | 1 |
Ruby | Ruby | add problem counts | 0ae1772b89ec52faa77108a3008402f2a1328ef7 | <ide><path>Library/Homebrew/cmd/audit.rb
<ide> module Homebrew extend self
<ide> def audit
<ide> errors = false
<ide>
<add> brew_count = 0
<add> problem_count = 0
<add>
<ide> ff.each do |f|
<ide> problems = []
<ide>
<ide> def audit
<ide> puts "#{f.name}:"
<ide> puts problems * "\n"
<ide> puts
<add> brew_count += 1
<add> problem_count += problems.size
<ide> end
<ide> end
<ide>
<del> exit 1 if errors
<add> if errors
<add> puts "#{problem_count} problems in #{brew_count} brews"
<add> exit 1
<add> end
<ide> end
<ide> end | 1 |
PHP | PHP | remove a bunch of dead code | 0e009ab613a25ebd140a4f307aaa0b8ae8dd3eba | <ide><path>tests/TestCase/Controller/Component/RequestHandlerComponentTest.php
<ide> protected function _init() {
<ide> $this->Controller = new RequestHandlerTestController($request, $response);
<ide> $this->Controller->constructClasses();
<ide> $this->RequestHandler = new RequestHandlerComponent($this->Controller->components());
<del> $this->_extensions = Router::extensions();
<add>
<add> Router::scope('/', function($routes) {
<add> $routes->extensions('json');
<add> $routes->fallbacks();
<add> });
<ide> }
<ide>
<ide> /**
<ide> public function tearDown() {
<ide> DispatcherFactory::clear();
<ide> $this->_init();
<ide> unset($this->RequestHandler, $this->Controller);
<del> if (!headers_sent()) {
<del> header('Content-type: text/html'); //reset content type.
<del> }
<del> call_user_func_array('Cake\Routing\Router::parseExtensions', [$this->_extensions, false]);
<ide> }
<ide>
<ide> /** | 1 |
Javascript | Javascript | remove unused thing | 1e539dbc8c57a2a90d9db0c0ee703bb8572bfd17 | <ide><path>packages/ember-glimmer/tests/integration/custom-component-manager-test.js
<del>import {
<del> PrimitiveReference
<del>} from '@glimmer/runtime';
<ide> import { moduleFor, RenderingTest } from '../utils/test-case';
<ide> import {
<ide> GLIMMER_CUSTOM_COMPONENT_MANAGER
<ide> } from 'ember/features';
<ide> import { AbstractComponentManager } from 'ember-glimmer';
<ide>
<ide> if (GLIMMER_CUSTOM_COMPONENT_MANAGER) {
<del> /*
<del> Custom layout compiler. Exists mostly to inject
<del> class and attributes for testing purposes.
<del> */
<del> class TestLayoutCompiler {
<del> constructor(template) {
<del> this.template = template;
<del> }
<del>
<del> compile(builder) {
<del> builder.wrapLayout(this.template);
<del> builder.tag.dynamic(() => {
<del> return PrimitiveReference.create('p');
<del> });
<del> builder.attrs.static('class', 'hey-oh-lets-go');
<del> builder.attrs.static('manager-id', 'test');
<del> }
<del> }
<del>
<ide> /*
<ide> Implementation of custom component manager, `ComponentManager` interface
<ide> */ | 1 |
PHP | PHP | add getinstance method | 3a2c381d3f7bd8aea100b94f4b9abf7eb49dc308 | <ide><path>src/Illuminate/Queue/Jobs/Job.php
<ide> public function getQueue()
<ide> return $this->queue;
<ide> }
<ide>
<add> /**
<add> * Get the job handler instance.
<add> *
<add> * @return mixed
<add> */
<add> public function getInstance()
<add> {
<add> return $this->instance;
<add> }
<add>
<ide> /**
<ide> * Get the service container instance.
<ide> * | 1 |
Javascript | Javascript | remove unnec. empty line | 7dab8981f8868caaa350ea7029929e7e81662fd2 | <ide><path>src/event.js
<ide> jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblcl
<ide> jQuery.attrFn[ name ] = true;
<ide> }
<ide>
<del>
<ide> // Key Event property hooks
<ide> if ( rkeyEvent.test( name ) ) {
<ide> jQuery.event.propHooks[ name ] = function( event, original ) { | 1 |
Javascript | Javascript | add a simple abort check in windows | 642bd4dd6dd16221f910538b03046542711361c3 | <ide><path>test/parallel/test-windows-abort-exitcode.js
<add>'use strict';
<add>const common = require('../common');
<add>const assert = require('assert');
<add>
<add>// This test makes sure that an aborted node process
<add>// exits with code 3 on Windows.
<add>// Spawn a child, force an abort, and then check the
<add>// exit code in the parent.
<add>
<add>const spawn = require('child_process').spawn;
<add>if (!common.isWindows) {
<add> common.skip('test is windows specific');
<add> return;
<add>}
<add>if (process.argv[2] === 'child') {
<add> process.abort();
<add>} else {
<add> const child = spawn(process.execPath, [__filename, 'child']);
<add> child.on('exit', common.mustCall((code, signal) => {
<add> assert.strictEqual(code, 3);
<add> assert.strictEqual(signal, null);
<add> }));
<add>} | 1 |
PHP | PHP | fix phpstan and psalm | 05fd0a594e73660a59170a8e73127208742b83d1 | <ide><path>src/Http/Middleware/CspMiddleware.php
<ide> class CspMiddleware implements MiddlewareInterface
<ide> /**
<ide> * CSP Builder
<ide> *
<del> * @var \ParagonIE\CSPBuilder\CSPBuilder|array|null $csp CSP Builder or config array
<add> * @var \ParagonIE\CSPBuilder\CSPBuilder $csp CSP Builder or config array
<ide> */
<ide> protected $csp;
<ide>
<ide> public function process(ServerRequestInterface $request, RequestHandlerInterface
<ide> {
<ide> $response = $handler->handle($request);
<ide>
<del> return $this->csp->injectCSPHeader($response);
<add> /** @var \Psr\Http\Message\ResponseInterface $response */
<add> $response = $this->csp->injectCSPHeader($response);
<add>
<add> return $response;
<ide> }
<ide> } | 1 |
Python | Python | fix arch flags for ifort on machines in em64t mode | 2acb0e779d6d0a50288aed3c050fc1fbffaf692c | <ide><path>numpy/distutils/fcompiler/intel.py
<ide> class IntelEM64TFCompiler(IntelFCompiler):
<ide> 'ranlib' : ["ranlib"]
<ide> }
<ide>
<add> def get_flags_arch(self):
<add> opt = []
<add> if cpu.is_PentiumIV() or cpu.is_Xeon():
<add> opt.extend(['-tpp7', '-xW'])
<add> return opt
<add>
<ide> class IntelVisualFCompiler(FCompiler):
<ide>
<ide> compiler_type = 'intelv' | 1 |
Text | Text | fix command on index.md [ionic portuguese] | af7a71ee443066c059e2ef763fec87a0ba7e6d35 | <ide><path>guide/portuguese/ionic/index.md
<ide> A maior parte de um aplicativo iônico será escrita em HTML, Javascript e CSS.
<ide> ### Gerenciador de pacotes Node.js (npm)
<ide>
<ide> \`\` \`
<del>sudo apt-get instala npm
<add>sudo apt-get install npm
<ide> ```
<ide> ### Ionic 2 and cordova
<ide> ```
<ide> sudo npm install -g ionic cordova
<ide> Once that's done, Let's start off by generating a new project based on the “blank” template
<ide> ```
<ide>
<del>início iônico MyFirstApp em branco cd MyFirstApp saque iônico \`\` \`
<ide>\ No newline at end of file
<add>início iônico MyFirstApp em branco cd MyFirstApp saque iônico \`\` \` | 1 |
Text | Text | remove duplicate step to push docker image | 7c96800426946e563d12fdfeb80b20f4c0002aaf | <ide><path>dev/README_RELEASE_AIRFLOW.md
<ide> - [Selecting what to cherry-pick](#selecting-what-to-cherry-pick)
<ide> - [Prepare the Apache Airflow Package RC](#prepare-the-apache-airflow-package-rc)
<ide> - [Build RC artifacts](#build-rc-artifacts)
<del> - [Manually prepare production Docker Image](#manually-prepare-production-docker-image)
<ide> - [[\Optional\] Create new release branch](#%5Coptional%5C-create-new-release-branch)
<ide> - [Prepare PyPI convenience "snapshot" packages](#prepare-pypi-convenience-snapshot-packages)
<ide> - [Prepare production Docker Image](#prepare-production-docker-image)
<ide> - [Publish release to SVN](#publish-release-to-svn)
<ide> - [Prepare PyPI "release" packages](#prepare-pypi-release-packages)
<ide> - [Update CHANGELOG.md](#update-changelogmd)
<del> - [Manually prepare production Docker Image](#manually-prepare-production-docker-image-1)
<add> - [Manually prepare production Docker Image](#manually-prepare-production-docker-image)
<ide> - [Publish documentation](#publish-documentation)
<ide> - [Notify developers of release](#notify-developers-of-release)
<ide> - [Update Announcements page](#update-announcements-page)
<ide> The Release Candidate artifacts we vote upon should be the exact ones we vote ag
<ide> svn commit -m "Add artifacts for Airflow ${VERSION}"
<ide> ```
<ide>
<del>
<del>## Manually prepare production Docker Image
<del>
<del>
<del>```shell script
<del>./scripts/ci/tools/prepare_prod_docker_images.sh ${VERSION}
<del>```
<del>
<del>This will wipe Breeze cache and docker-context-files in order to make sure the build is "clean". It
<del>also performs image verification before pushing the images.
<del>
<del>
<ide> ## [\Optional\] Create new release branch
<ide>
<ide> When you just released the `X.Y.0` version (first release of new minor version) you need to create release | 1 |
Go | Go | remove firewalld running log | e5c1a4cabd2861494e58879d7507f0f581939f3d | <ide><path>libnetwork/iptables/firewalld.go
<ide> func checkRunning() bool {
<ide>
<ide> if connection != nil {
<ide> err = connection.sysobj.Call(dbusInterface+".getDefaultZone", 0).Store(&zone)
<del> logrus.Infof("Firewalld running: %t", err == nil)
<ide> return err == nil
<ide> }
<ide> return false | 1 |
Javascript | Javascript | adjust code style | da06eb3ad08d2c07274df00044879a311d5522af | <ide><path>examples/js/loaders/GLTFLoader.js
<ide> THREE.GLTFLoader = ( function () {
<ide> var extension = textureDef.extensions[ name ];
<ide> var source = json.images[ extension.source ];
<ide>
<del> var loader;
<add> var loader = parser.textureLoader;
<ide> if ( source.uri ) {
<ide>
<del> loader = parser.options.manager.getHandler( source.uri );
<del>
<del> }
<del>
<del> if ( ! loader ) {
<del>
<del> loader = parser.textureLoader;
<add> var handler = parser.options.manager.getHandler( source.uri );
<add> if ( handler !== null ) loader = handler;
<ide>
<ide> }
<ide>
<ide> THREE.GLTFLoader = ( function () {
<ide>
<ide> }
<ide>
<del> var loader;
<add> var loader = textureExtensions[ EXTENSIONS.MSFT_TEXTURE_DDS ]
<add> ? parser.extensions[ EXTENSIONS.MSFT_TEXTURE_DDS ].ddsLoader
<add> : this.textureLoader;
<ide>
<ide> if ( source.uri ) {
<ide>
<del> loader = options.manager.getHandler( source.uri );
<del>
<del> }
<del>
<del> if ( ! loader ) {
<del>
<del> loader = textureExtensions[ EXTENSIONS.MSFT_TEXTURE_DDS ]
<del> ? parser.extensions[ EXTENSIONS.MSFT_TEXTURE_DDS ].ddsLoader
<del> : this.textureLoader;
<add> var handler = options.manager.getHandler( source.uri );
<add> if ( handler !== null ) loader = handler;
<ide>
<ide> }
<ide>
<ide><path>examples/jsm/loaders/GLTFLoader.js
<ide> var GLTFLoader = ( function () {
<ide> var extension = textureDef.extensions[ name ];
<ide> var source = json.images[ extension.source ];
<ide>
<del> var loader;
<add> var loader = parser.textureLoader;
<ide> if ( source.uri ) {
<ide>
<del> loader = parser.options.manager.getHandler( source.uri );
<del>
<del> }
<del>
<del> if ( ! loader ) {
<del>
<del> loader = parser.textureLoader;
<add> var handler = parser.options.manager.getHandler( source.uri );
<add> if ( handler !== null ) loader = handler;
<ide>
<ide> }
<ide>
<ide> var GLTFLoader = ( function () {
<ide>
<ide> }
<ide>
<del> var loader;
<add> var loader = textureExtensions[ EXTENSIONS.MSFT_TEXTURE_DDS ]
<add> ? parser.extensions[ EXTENSIONS.MSFT_TEXTURE_DDS ].ddsLoader
<add> : this.textureLoader;
<ide>
<ide> if ( source.uri ) {
<ide>
<del> loader = options.manager.getHandler( source.uri );
<del>
<del> }
<del>
<del> if ( ! loader ) {
<del>
<del> loader = textureExtensions[ EXTENSIONS.MSFT_TEXTURE_DDS ]
<del> ? parser.extensions[ EXTENSIONS.MSFT_TEXTURE_DDS ].ddsLoader
<del> : this.textureLoader;
<add> var handler = options.manager.getHandler( source.uri );
<add> if ( handler !== null ) loader = handler;
<ide>
<ide> }
<ide> | 2 |
Javascript | Javascript | fix argument order in asserts | af68c554a5fd3b3595dedf64ed038fea2b761e66 | <ide><path>test/sequential/test-inspector-async-stack-traces-promise-then.js
<ide> async function runTests() {
<ide> 'break2', 'runTest:8');
<ide>
<ide> await session.runToCompletion();
<del> assert.strictEqual(0, (await instance.expectShutdown()).exitCode);
<add> assert.strictEqual((await instance.expectShutdown()).exitCode, 0);
<ide> }
<ide>
<ide> function debuggerPausedAt(msg, functionName, previousTickLocation) { | 1 |
Text | Text | fix typo in daemon storage-driver docs | c44a8d8d8c9eccb79b16c874f083cd9597c3f6ca | <ide><path>docs/reference/commandline/daemon.md
<ide> The `btrfs` driver is very fast for `docker build` - but like `devicemapper`
<ide> does not share executable memory between devices. Use
<ide> `docker daemon -s btrfs -g /mnt/btrfs_partition`.
<ide>
<del>The `zfs` driver is probably not fast as `btrfs` but has a longer track record
<add>The `zfs` driver is probably not as fast as `btrfs` but has a longer track record
<ide> on stability. Thanks to `Single Copy ARC` shared blocks between clones will be
<ide> cached only once. Use `docker daemon -s zfs`. To select a different zfs filesystem
<ide> set `zfs.fsname` option as described in [Storage driver options](#storage-driver-options). | 1 |
Javascript | Javascript | use lazy assert to avoid issues on startup | f0b702555aacc814da28a018277d56e5f79f10d1 | <ide><path>lib/internal/errors.js
<ide> // value statically and permanently identifies the error. While the error
<ide> // message may change, the code should not.
<ide>
<del>const assert = require('assert');
<ide> const kCode = Symbol('code');
<ide> const messages = new Map();
<ide>
<ide> function lazyUtil() {
<ide> return util;
<ide> }
<ide>
<add>var assert;
<add>function lazyAssert() {
<add> if (!assert)
<add> assert = require('assert');
<add> return assert;
<add>}
<add>
<ide> function makeNodeError(Base) {
<ide> return class NodeError extends Base {
<ide> constructor(key, ...args) {
<ide> function makeNodeError(Base) {
<ide> }
<ide>
<ide> function message(key, args) {
<add> const assert = lazyAssert();
<ide> assert.strictEqual(typeof key, 'string');
<ide> const util = lazyUtil();
<ide> const msg = messages.get(key);
<ide> function message(key, args) {
<ide> // Utility function for registering the error codes. Only used here. Exported
<ide> // *only* to allow for testing.
<ide> function E(sym, val) {
<del> assert(messages.has(sym) === false, `Error symbol: ${sym} was already used.`);
<ide> messages.set(sym, typeof val === 'function' ? val : String(val));
<ide> }
<ide>
<ide> E('ERR_UNKNOWN_BUILTIN_MODULE', (id) => `No such built-in module: ${id}`);
<ide> // Add new errors from here...
<ide>
<ide> function invalidArgType(name, expected, actual) {
<add> const assert = lazyAssert();
<ide> assert(name, 'name is required');
<ide> var msg = `The "${name}" argument must be ${oneOf(expected, 'type')}`;
<ide> if (arguments.length >= 3) {
<ide><path>test/parallel/test-internal-errors.js
<ide> assert.throws(() => {
<ide> message: /^Error for testing 2/ }));
<ide> }, /AssertionError: .+ does not match \S/);
<ide>
<del>assert.doesNotThrow(() => errors.E('TEST_ERROR_USED_SYMBOL'));
<del>assert.throws(
<del> () => errors.E('TEST_ERROR_USED_SYMBOL'),
<del> /^AssertionError: Error symbol: TEST_ERROR_USED_SYMBOL was already used\.$/
<del>);
<del>
<ide> // // Test ERR_INVALID_ARG_TYPE
<ide> assert.strictEqual(errors.message('ERR_INVALID_ARG_TYPE', ['a', 'b']),
<ide> 'The "a" argument must be of type b'); | 2 |
PHP | PHP | fix some of formhelper's tests | cedd563c575a8f757a4ad1dba2da7cf15f51c3d7 | <ide><path>tests/TestCase/View/Helper/FormHelperTest.php
<ide> public function testFileUploadField()
<ide> $result = $this->Form->file('Model.upload');
<ide> $this->assertHtml($expected, $result);
<ide>
<del> $this->Form->request->data['Model']['upload'] = [
<add> $this->Form->request = $this->Form->request->withData('Model.upload', [
<ide> 'name' => '', 'type' => '', 'tmp_name' => '',
<ide> 'error' => 4, 'size' => 0
<del> ];
<add> ]);
<ide> $result = $this->Form->file('Model.upload');
<ide> $this->assertHtml($expected, $result);
<ide>
<del> $this->Form->request->data['Model']['upload'] = 'no data should be set in value';
<add> $this->Form->request = $this->Form->request->withData('Model.upload', 'no data should be set in value');
<ide> $result = $this->Form->file('Model.upload');
<ide> $this->assertHtml($expected, $result);
<ide> }
<ide> public function testButton()
<ide> */
<ide> public function testButtonUnlockedByDefault()
<ide> {
<del> $this->Form->request->params['_csrfToken'] = 'secured';
<add> $this->Form->request = $this->Form->request->withParam('_csrfToken', 'secured');
<ide> $this->Form->button('Save', ['name' => 'save']);
<ide> $this->Form->button('Clear');
<ide>
<ide> public function testPostButtonNestedData()
<ide> */
<ide> public function testSecurePostButton()
<ide> {
<del> $this->Form->request->params['_csrfToken'] = 'testkey';
<del> $this->Form->request->params['_Token'] = ['unlockedFields' => []];
<add> $this->Form->request = $this->Form->request
<add> ->withParam('_csrfToken', 'testkey')
<add> ->withParam('_Token.unlockedFields', []);
<ide>
<ide> $result = $this->Form->postButton('Delete', '/posts/delete/1');
<ide> $tokenDebug = urlencode(json_encode([
<ide> public function testPostLinkSecurityHash()
<ide> {
<ide> $hash = hash_hmac('sha1', '/posts/delete/1' . serialize(['id' => '1']) . session_id(), Security::getSalt());
<ide> $hash .= '%3Aid';
<del> $this->Form->request->params['_Token']['key'] = 'test';
<add> $this->Form->request = $this->Form->request->withParam('_Token.key', 'test');
<ide>
<ide> $result = $this->Form->postLink(
<ide> 'Delete',
<ide> public function testPostLinkSecurityHashBlockMode()
<ide> {
<ide> $hash = hash_hmac('sha1', '/posts/delete/1' . serialize([]) . session_id(), Security::getSalt());
<ide> $hash .= '%3A';
<del> $this->Form->request->params['_Token']['key'] = 'test';
<add> $this->Form->request = $this->Form->request->withParam('_Token.key', 'test');
<ide>
<ide> $this->Form->create('Post', ['url' => ['action' => 'add']]);
<ide> $this->Form->control('title');
<ide> public function testPostLinkSecurityHashNoDebugMode()
<ide> Configure::write('debug', false);
<ide> $hash = hash_hmac('sha1', '/posts/delete/1' . serialize(['id' => '1']) . session_id(), Security::getSalt());
<ide> $hash .= '%3Aid';
<del> $this->Form->request->params['_Token']['key'] = 'test';
<add> $this->Form->request = $this->Form->request
<add> ->withParam('_Token.key', 'test');
<ide>
<ide> $result = $this->Form->postLink(
<ide> 'Delete',
<ide> public function testPostLinkNestedData()
<ide> 'two' => [
<ide> 3, 4, 5
<ide> ]
<del> ]
<add> ]
<ide> ];
<ide> $result = $this->Form->postLink('Send', '/', ['data' => $data]);
<ide> $this->assertContains('<input type="hidden" name="one[two][0]" value="3"', $result);
<ide> public function testPostLinkNestedData()
<ide> */
<ide> public function testPostLinkAfterGetForm()
<ide> {
<del> $this->Form->request->params['_csrfToken'] = 'testkey';
<del> $this->Form->request->params['_Token'] = 'val';
<add> $this->Form->request = $this->Form->request
<add> ->withParam('_csrfToken', 'testkey')
<add> ->withParam('_Token', 'val');
<ide>
<ide> $this->Form->create($this->article, ['type' => 'get']);
<ide> $this->Form->end();
<ide> public function testSubmitImage()
<ide> */
<ide> public function testSubmitUnlockedByDefault()
<ide> {
<del> $this->Form->request->params['_Token'] = 'secured';
<add> $this->Form->request = $this->Form->request->withParam('_Token', 'secured');
<ide> $this->Form->submit('Go go');
<ide> $this->Form->submit('Save', ['name' => 'save']);
<ide>
<ide> public function testForMagicControlNonExistingNorValidated()
<ide> ];
<ide> $this->assertHtml($expected, $result);
<ide>
<del> $this->Form->request->data = ['non_existing_nor_validated' => 'CakePHP magic'];
<add> $this->Form->request = $this->Form->request->withData('non_existing_nor_validated', 'CakePHP magic');
<add> $this->Form->create($this->article);
<ide> $result = $this->Form->control('non_existing_nor_validated');
<ide> $expected = [
<ide> 'label' => ['for' => 'non-existing-nor-validated'],
<ide> public function testAutoDomId()
<ide> */
<ide> public function testFormValueSourcesSettersGetters()
<ide> {
<add> $this->Form->request = $this->Form->request
<add> ->withData('id', '1')
<add> ->withQueryParams(['id' => '2']);
<add>
<ide> $expected = ['context'];
<ide> $result = $this->Form->getValueSources();
<ide> $this->assertEquals($expected, $result);
<ide>
<del> $expected = null;
<del> $result = $this->Form->getSourceValue('id');
<del> $this->assertEquals($expected, $result);
<del>
<ide> $expected = ['query', 'data', 'context'];
<ide> $this->Form->setValueSources(['query', 'data', 'invalid', 'context', 'foo']);
<ide> $result = $this->Form->getValueSources();
<ide> $this->assertEquals($expected, $result);
<ide>
<del> $this->Form->request->data['id'] = '1';
<del> $this->Form->request->query['id'] = '2';
<del>
<ide> $this->Form->setValueSources(['context']);
<ide> $expected = '1';
<ide> $result = $this->Form->getSourceValue('id');
<ide> public function testFormValueSourcesSingleSwitchRendering()
<ide> ];
<ide> $this->assertHtml($expected, $result);
<ide>
<del> $this->Form->request->query['id'] = '5';
<add> $this->Form->request = $this->Form->request->withQueryParams(['id' => 5]);
<ide> $this->Form->setValueSources(['query']);
<ide> $result = $this->Form->control('id');
<ide> $expected = [
<ide> ['input' => ['type' => 'hidden', 'name' => 'id', 'id' => 'id', 'value' => '5']],
<ide> ];
<ide> $this->assertHtml($expected, $result);
<ide>
<del> $this->Form->request->query['id'] = '5a';
<del> $this->Form->request->data['id'] = '5b';
<add> $this->Form->request = $this->Form->request
<add> ->withQueryParams(['id' => '5a'])
<add> ->withData('id', '5b');
<ide>
<ide> $this->Form->setValueSources(['context']);
<ide> $this->Form->create($article);
<ide> public function testFormValueSourcesSwitchViaOptionsRendering()
<ide> $articles = TableRegistry::get('Articles');
<ide> $article = new Article();
<ide> $articles->patchEntity($article, ['id' => '3']);
<del> $this->Form->request->data['id'] = '4';
<del> $this->Form->request->query['id'] = '5';
<add>
<add> $this->Form->request = $this->Form->request->withData('id', 4)->withQueryParams(['id' => 5]);
<ide>
<ide> $this->Form->create($article, ['valueSources' => 'query']);
<ide> $result = $this->Form->control('id');
<ide> public function testFormValueSourcesSwitchViaOptionsAndSetterRendering()
<ide> $article = new Article();
<ide> $articles->patchEntity($article, ['id' => '3']);
<ide>
<del> $this->Form->request->data['id'] = '10';
<del> $this->Form->request->query['id'] = '11';
<add> $this->Form->request = $this->Form->request->withData('id', 10)->withQueryParams(['id' => 11]);
<ide>
<ide> $this->Form->setValueSources(['context'])
<ide> ->create($article, ['valueSources' => ['query', 'data']]);
<ide> public function testFormValueSourcesSwitchViaOptionsAndSetterRendering()
<ide> $result = $this->Form->getSourceValue('id');
<ide> $this->assertEquals('11', $result);
<ide>
<del> unset($this->Form->request->query['id']);
<add> $this->Form->request = $this->Form->request->withQueryParams([]);
<ide> $this->Form->setValueSources(['context'])
<ide> ->create($article, ['valueSources' => ['query', 'data']]);
<ide> $result = $this->Form->control('id');
<ide> public function testFormValueSourcesResetViaEnd()
<ide> */
<ide> public function testFormValueSourcesDefaults()
<ide> {
<del> $this->Form->request->query['password'] = 'open Sesame';
<add> $this->Form->request = $this->Form->request->withQueryParams(['password' => 'open Sesame']);
<ide> $this->Form->create();
<ide>
<ide> $result = $this->Form->password('password'); | 1 |
Ruby | Ruby | improve tap building | 00f064410660463f00bcd58d1683e05ab9bfc83c | <ide><path>Library/Homebrew/cmd/test-bot.rb
<ide> def run
<ide> def test_bot
<ide> tap = ARGV.value('tap')
<ide>
<add> git_url = ENV['UPSTREAM_GIT_URL'] || ENV['GIT_URL']
<add> if !tap && git_url
<add> # Also can get tap from Jenkins GIT_URL.
<add> /([\w-]+\/homebrew-[\w-]+)/ =~ git_url
<add> tap = $1
<add> end
<add>
<ide> if Pathname.pwd == HOMEBREW_PREFIX and ARGV.include? "--cleanup"
<ide> odie 'cannot use --cleanup from HOMEBREW_PREFIX as it will delete all output.'
<ide> end
<ide> def test_bot
<ide> ENV["GIT_AUTHOR_EMAIL"] = ENV["GIT_COMMITTER_EMAIL"]
<ide> safe_system "brew", "bottle", "--merge", "--write", *Dir["*.bottle.rb"]
<ide>
<del> remote = "[email protected]:BrewTestBot/homebrew.git"
<add> remote_repo = tap ? tap.gsub("/", "-") : "homebrew"
<add>
<add> remote = "[email protected]:BrewTestBot/#{remote_repo}.git"
<ide> tag = pr ? "pr-#{pr}" : "testing-#{number}"
<ide> safe_system "git", "push", "--force", remote, "master:master", ":refs/tags/#{tag}"
<ide> | 1 |
Python | Python | add missing session.commit() at end of initdb | 43769bc4d658029b753ed5b87012b4855d5bca69 | <ide><path>airflow/utils/db.py
<ide> def initdb():
<ide> "GROUP BY state"),
<ide> )
<ide> session.add(chart)
<add> session.commit()
<ide>
<ide>
<ide> def upgradedb(): | 1 |
Python | Python | fix typo in training | 60e0c96f6c4ac60f174b733b94342939e086d214 | <ide><path>keras/engine/training.py
<ide> def standardize_input_data(data, names, shapes=None,
<ide> raise Exception('Error when checking ' + exception_prefix +
<ide> ': you are passing a list as '
<ide> 'input to your model, '
<del> 'but the model expects a '
<add> 'but the model expects '
<ide> 'a list of ' + str(len(names)) +
<ide> ' Numpy arrays instead. '
<ide> 'The list you passed was: ' + | 1 |
Python | Python | set dag schedule to @once in the system tests | 6504a3512a4ee9fc1af7e67006678a83a49d7773 | <ide><path>tests/system/providers/google/cloud/cloud_sql/example_cloud_sql.py
<ide>
<ide> with models.DAG(
<ide> DAG_ID,
<del> schedule=None,
<add> schedule="@once",
<ide> start_date=datetime(2021, 1, 1),
<ide> catchup=False,
<ide> tags=["example", "cloud_sql"],
<ide><path>tests/system/providers/google/cloud/speech_to_text/example_speech_to_text.py
<ide>
<ide> with models.DAG(
<ide> DAG_ID,
<del> schedule=None,
<add> schedule="@once",
<ide> start_date=datetime(2021, 1, 1),
<ide> catchup=False,
<ide> tags=["example", "speech_to_text"], | 2 |
Javascript | Javascript | add comment for rendertostringimpl parameter | f1d00156df5453bc62bd5668fefdcac4ca67e90e | <ide><path>src/renderers/dom/stack/server/ReactServerRendering.js
<ide> var pendingTransactions = 0;
<ide>
<ide> /**
<ide> * @param {ReactElement} element
<add> * @param {boolean} makeStaticMarkup
<ide> * @return {string} the HTML markup
<ide> */
<ide> function renderToStringImpl(element, makeStaticMarkup) { | 1 |
Javascript | Javascript | add more foreach tests | 98cbbbb9b02c3682fd5278641c5b6b23301afb16 | <ide><path>test/parallel/test-stream-forEach.js
<ide> const {
<ide> Readable,
<ide> } = require('stream');
<ide> const assert = require('assert');
<del>const { setTimeout } = require('timers/promises');
<add>const { once } = require('events');
<ide>
<ide> {
<ide> // forEach works on synchronous streams with a synchronous predicate
<ide> const { setTimeout } = require('timers/promises');
<ide> })().then(common.mustCall());
<ide> }
<ide>
<add>{
<add> // forEach works on an infinite stream
<add> const ac = new AbortController();
<add> const { signal } = ac;
<add> const stream = Readable.from(async function* () {
<add> while (true) yield 1;
<add> }(), { signal });
<add> let i = 0;
<add> assert.rejects(stream.forEach(common.mustCall((x) => {
<add> i++;
<add> if (i === 10) ac.abort();
<add> assert.strictEqual(x, 1);
<add> }, 10)), { name: 'AbortError' }).then(common.mustCall());
<add>}
<add>
<add>{
<add> // Emitting an error during `forEach`
<add> const stream = Readable.from([1, 2, 3, 4, 5]);
<add> assert.rejects(stream.forEach(async (x) => {
<add> if (x === 3) {
<add> stream.emit('error', new Error('boom'));
<add> }
<add> }), /boom/).then(common.mustCall());
<add>}
<add>
<add>{
<add> // Throwing an error during `forEach` (sync)
<add> const stream = Readable.from([1, 2, 3, 4, 5]);
<add> assert.rejects(stream.forEach((x) => {
<add> if (x === 3) {
<add> throw new Error('boom');
<add> }
<add> }), /boom/).then(common.mustCall());
<add>}
<add>
<add>{
<add> // Throwing an error during `forEach` (async)
<add> const stream = Readable.from([1, 2, 3, 4, 5]);
<add> assert.rejects(stream.forEach(async (x) => {
<add> if (x === 3) {
<add> return Promise.reject(new Error('boom'));
<add> }
<add> }), /boom/).then(common.mustCall());
<add>}
<add>
<ide> {
<ide> // Concurrency + AbortSignal
<ide> const ac = new AbortController();
<ide> let calls = 0;
<ide> const forEachPromise =
<ide> Readable.from([1, 2, 3, 4]).forEach(async (_, { signal }) => {
<ide> calls++;
<del> await setTimeout(100, { signal });
<add> await once(signal, 'abort');
<ide> }, { signal: ac.signal, concurrency: 2 });
<ide> // pump
<ide> assert.rejects(async () => { | 1 |
Text | Text | add more keys to vim navigation | 63c4f93fc3ca7d8ea47f9befed94a85e1071cf1a | <ide><path>guide/english/vim/navigation/index.md
<ide> key will move the cursor to the end of the current word.
<ide> * To move to the beginning of the current line, type `0`, and to move to the end
<ide> of the current line, type `$`.
<ide>
<add>* To make one navigation `x` number of times, type the `number`, then the `navigating key`.
<add>
<ide> * Finally, to move to the first line in the file, type `gg`, and to move to the
<ide> last line in the file, type `G`.
<ide>
<ide> h moves one character left
<ide> j moves one row down
<ide> k moves one row up
<ide> l moves one character right
<add>4h moves four characters left
<add>6j moves six rows down
<ide>
<ide> w moves to the beginning of the next word
<ide> b moves to the beginning of the previous word
<ide> e moves to the end of the current word
<add>5w moves to the beginning of the next five words
<ide>
<ide> 0 moves to the beginning of the current line
<ide> $ moves to the end of the current line | 1 |
Javascript | Javascript | convert textinput to hooks | dff490d140010913d3209a2f3e987914b9c4eee4 | <ide><path>Libraries/Components/TextInput/TextInput.js
<ide> import type {SyntheticEvent, ScrollEvent} from '../../Types/CoreEventTypes';
<ide> import type {PressEvent} from '../../Types/CoreEventTypes';
<ide> import type {HostComponent} from '../../Renderer/shims/ReactNativeTypes';
<ide>
<add>const {useEffect, useRef, useState} = React;
<add>
<ide> type ReactRefSetter<T> = {current: null | T, ...} | ((ref: null | T) => mixed);
<ide>
<ide> let AndroidTextInput;
<ide> export type Props = $ReadOnly<{|
<ide> >,
<ide> |}>;
<ide>
<del>type DefaultProps = $ReadOnly<{|
<del> allowFontScaling: boolean,
<del> rejectResponderTermination: boolean,
<del> underlineColorAndroid: 'transparent',
<del>|}>;
<del>
<ide> type ImperativeMethods = $ReadOnly<{|
<ide> clear: () => void,
<ide> isFocused: () => boolean,
<ide> type ImperativeMethods = $ReadOnly<{|
<ide>
<ide> const emptyFunctionThatReturnsTrue = () => true;
<ide>
<add>function useFocusOnMount(
<add> initialAutoFocus: ?boolean,
<add> inputRef: {|
<add> current: null | React.ElementRef<HostComponent<mixed>>,
<add> |},
<add>) {
<add> const initialAutoFocusValue = useRef<?boolean>(initialAutoFocus);
<add>
<add> useEffect(() => {
<add> // We only want to autofocus on initial mount.
<add> // Since initialAutoFocusValue and inputRef will never change
<add> // this should match the expected behavior
<add> if (initialAutoFocusValue.current) {
<add> const rafId = requestAnimationFrame(() => {
<add> if (inputRef.current != null) {
<add> inputRef.current.focus();
<add> }
<add> });
<add>
<add> return () => {
<add> cancelAnimationFrame(rafId);
<add> };
<add> }
<add> }, [initialAutoFocusValue, inputRef]);
<add>}
<ide> /**
<ide> * A foundational component for inputting text into the app via a
<ide> * keyboard. Props provide configurability for several features, such as
<ide> const emptyFunctionThatReturnsTrue = () => true;
<ide> * or control this param programmatically with native code.
<ide> *
<ide> */
<del>class InternalTextInput extends React.Component<Props> {
<del> static defaultProps: DefaultProps = {
<del> allowFontScaling: true,
<del> rejectResponderTermination: true,
<del> underlineColorAndroid: 'transparent',
<del> };
<del>
<del> _inputRef: null | React.ElementRef<HostComponent<mixed>> = null;
<del> _lastNativeText: ?Stringish = null;
<del> _lastNativeSelection: ?Selection = null;
<del> _rafId: ?AnimationFrameID = null;
<del>
<del> componentDidMount() {
<del> this._lastNativeText = this.props.value;
<del> const tag = ReactNative.findNodeHandle(this._inputRef);
<del> if (tag != null) {
<del> // tag is null only in unit tests
<del> TextInputState.registerInput(tag);
<del> }
<del>
<del> if (this.props.autoFocus) {
<del> this._rafId = requestAnimationFrame(() => {
<del> if (this._inputRef) {
<del> this._inputRef.focus();
<del> }
<del> });
<del> }
<del> }
<add>function InternalTextInput(props: Props): React.Node {
<add> const inputRef = useRef<null | React.ElementRef<HostComponent<mixed>>>(null);
<add>
<add> const selection: ?Selection =
<add> props.selection == null
<add> ? null
<add> : {
<add> start: props.selection.start,
<add> end: props.selection.end ?? props.selection.start,
<add> };
<add>
<add> const [lastNativeText, setLastNativeText] = useState<?Stringish>(props.value);
<add> const [lastNativeSelection, setLastNativeSelection] = useState<?Selection>(
<add> selection,
<add> );
<ide>
<del> componentDidUpdate() {
<del> // This is necessary in case native updates the text and JS decides
<del> // that the update should be ignored and we should stick with the value
<del> // that we have in JS.
<del> const nativeProps = {};
<add> // This is necessary in case native updates the text and JS decides
<add> // that the update should be ignored and we should stick with the value
<add> // that we have in JS.
<add> useEffect(() => {
<add> const nativeUpdate = {};
<ide>
<del> if (
<del> this._lastNativeText !== this.props.value &&
<del> typeof this.props.value === 'string'
<del> ) {
<del> nativeProps.text = this.props.value;
<add> if (lastNativeText !== props.value && typeof props.value === 'string') {
<add> nativeUpdate.text = props.value;
<add> setLastNativeText(props.value);
<ide> }
<ide>
<del> // Selection is also a controlled prop, if the native value doesn't match
<del> // JS, update to the JS value.
<del> const {selection} = this.props;
<ide> if (
<del> this._lastNativeSelection &&
<ide> selection &&
<del> (this._lastNativeSelection.start !== selection.start ||
<del> this._lastNativeSelection.end !== selection.end)
<add> lastNativeSelection &&
<add> (lastNativeSelection.start !== selection.start ||
<add> lastNativeSelection.end !== selection.end)
<ide> ) {
<del> nativeProps.selection = this.props.selection;
<add> nativeUpdate.selection = selection;
<add> setLastNativeSelection(selection);
<ide> }
<ide>
<del> if (
<del> Object.keys(nativeProps).length > 0 &&
<del> this._inputRef &&
<del> this._inputRef.setNativeProps
<del> ) {
<del> this._inputRef.setNativeProps(nativeProps);
<add> if (Object.keys(nativeUpdate).length > 0 && inputRef.current) {
<add> inputRef.current.setNativeProps(nativeUpdate);
<ide> }
<del> }
<add> }, [inputRef, props.value, lastNativeText, selection, lastNativeSelection]);
<ide>
<del> componentWillUnmount() {
<del> if (this.isFocused()) {
<del> nullthrows(this._inputRef).blur();
<del> }
<del> const tag = ReactNative.findNodeHandle(this._inputRef);
<add> useFocusOnMount(props.autoFocus, inputRef);
<add>
<add> useEffect(() => {
<add> const tag = ReactNative.findNodeHandle(inputRef.current);
<ide> if (tag != null) {
<del> TextInputState.unregisterInput(tag);
<del> }
<del> if (this._rafId != null) {
<del> cancelAnimationFrame(this._rafId);
<del> }
<del> }
<add> TextInputState.registerInput(tag);
<ide>
<del> /**
<del> * Removes all text from the `TextInput`.
<del> */
<del> clear: () => void = () => {
<del> if (this._inputRef != null) {
<del> this._inputRef.setNativeProps({text: ''});
<add> return () => {
<add> TextInputState.unregisterInput(tag);
<add> };
<ide> }
<del> };
<del>
<del> /**
<del> * Returns `true` if the input is currently focused; `false` otherwise.
<del> */
<del> isFocused: () => boolean = () => {
<del> return (
<del> TextInputState.currentlyFocusedField() ===
<del> ReactNative.findNodeHandle(this._inputRef)
<del> );
<del> };
<add> }, [inputRef]);
<ide>
<del> getNativeRef: () => ?React.ElementRef<HostComponent<mixed>> = () => {
<del> return this._inputRef;
<del> };
<del>
<del> render(): React.Node {
<del> let textInput = null;
<del> let additionalTouchableProps: {|
<del> rejectResponderTermination?: $PropertyType<
<del> Props,
<del> 'rejectResponderTermination',
<del> >,
<del> // This is a hack to let Flow know we want an exact object
<del> |} = {...null};
<del>
<del> const selection =
<del> this.props.selection && this.props.selection.end == null
<del> ? {
<del> start: this.props.selection.start,
<del> end: this.props.selection.start,
<del> }
<del> : null;
<del>
<del> if (Platform.OS === 'ios') {
<del> const RCTTextInputView = this.props.multiline
<del> ? RCTMultilineTextInputView
<del> : RCTSinglelineTextInputView;
<del>
<del> const style = this.props.multiline
<del> ? [styles.multilineInput, this.props.style]
<del> : this.props.style;
<del>
<del> additionalTouchableProps.rejectResponderTermination = this.props.rejectResponderTermination;
<del>
<del> textInput = (
<del> <RCTTextInputView
<del> ref={this._setNativeRef}
<del> {...this.props}
<del> dataDetectorTypes={this.props.dataDetectorTypes}
<del> onBlur={this._onBlur}
<del> onChange={this._onChange}
<del> onContentSizeChange={this.props.onContentSizeChange}
<del> onFocus={this._onFocus}
<del> onScroll={this._onScroll}
<del> onSelectionChange={this._onSelectionChange}
<del> onSelectionChangeShouldSetResponder={emptyFunctionThatReturnsTrue}
<del> selection={selection}
<del> style={style}
<del> text={this._getText()}
<del> />
<del> );
<del> } else if (Platform.OS === 'android') {
<del> const style = [this.props.style];
<del> const autoCapitalize = this.props.autoCapitalize || 'sentences';
<del> let children = this.props.children;
<del> let childCount = 0;
<del> React.Children.forEach(children, () => ++childCount);
<del> invariant(
<del> !(this.props.value && childCount),
<del> 'Cannot specify both value and children.',
<del> );
<del> if (childCount > 1) {
<del> children = <Text>{children}</Text>;
<add> useEffect(() => {
<add> // When unmounting we need to blur the input
<add> return () => {
<add> if (isFocused()) {
<add> nullthrows(inputRef.current).blur();
<ide> }
<add> };
<add> }, [inputRef]);
<ide>
<del> textInput = (
<del> /* $FlowFixMe the types for AndroidTextInput don't match up exactly with
<del> the props for TextInput. This will need to get fixed */
<del> <AndroidTextInput
<del> ref={this._setNativeRef}
<del> {...this.props}
<del> autoCapitalize={autoCapitalize}
<del> children={children}
<del> disableFullscreenUI={this.props.disableFullscreenUI}
<del> mostRecentEventCount={0}
<del> onBlur={this._onBlur}
<del> onChange={this._onChange}
<del> onFocus={this._onFocus}
<del> onScroll={this._onScroll}
<del> onSelectionChange={this._onSelectionChange}
<del> selection={selection}
<del> style={style}
<del> text={this._getText()}
<del> textBreakStrategy={this.props.textBreakStrategy}
<del> />
<del> );
<add> function clear(): void {
<add> if (inputRef.current != null) {
<add> inputRef.current.setNativeProps({text: ''});
<ide> }
<add> }
<add>
<add> // TODO: Fix this returning true on null === null, when no input is focused
<add> function isFocused(): boolean {
<ide> return (
<del> <TextAncestor.Provider value={true}>
<del> <TouchableWithoutFeedback
<del> onLayout={this.props.onLayout}
<del> onPress={this._onPress}
<del> accessible={this.props.accessible}
<del> accessibilityLabel={this.props.accessibilityLabel}
<del> accessibilityRole={this.props.accessibilityRole}
<del> accessibilityState={this.props.accessibilityState}
<del> nativeID={this.props.nativeID}
<del> testID={this.props.testID}
<del> {...additionalTouchableProps}>
<del> {textInput}
<del> </TouchableWithoutFeedback>
<del> </TextAncestor.Provider>
<add> TextInputState.currentlyFocusedField() ===
<add> ReactNative.findNodeHandle(inputRef.current)
<ide> );
<ide> }
<ide>
<del> _getText(): ?string {
<del> return typeof this.props.value === 'string'
<del> ? this.props.value
<del> : typeof this.props.defaultValue === 'string'
<del> ? this.props.defaultValue
<add> function getNativeRef(): ?React.ElementRef<HostComponent<mixed>> {
<add> return inputRef.current;
<add> }
<add>
<add> function _getText(): ?string {
<add> return typeof props.value === 'string'
<add> ? props.value
<add> : typeof props.defaultValue === 'string'
<add> ? props.defaultValue
<ide> : '';
<ide> }
<ide>
<del> _setNativeRef = setAndForwardRef({
<del> getForwardedRef: () => this.props.forwardedRef,
<add> const _setNativeRef = setAndForwardRef({
<add> getForwardedRef: () => props.forwardedRef,
<ide> setLocalRef: ref => {
<del> this._inputRef = ref;
<add> inputRef.current = ref;
<ide>
<ide> /*
<del> Hi reader from the future. I'm sorry for this.
<del>
<del> This is a hack. Ideally we would forwardRef to the underlying
<del> host component. However, since TextInput has it's own methods that can be
<del> called as well, if we used the standard forwardRef then these
<del> methods wouldn't be accessible and thus be a breaking change.
<del>
<del> We have a couple of options of how to handle this:
<del> - Return a new ref with everything we methods from both. This is problematic
<del> because we need React to also know it is a host component which requires
<del> internals of the class implementation of the ref.
<del> - Break the API and have some other way to call one set of the methods or
<del> the other. This is our long term approach as we want to eventually
<del> get the methods on host components off the ref. So instead of calling
<del> ref.measure() you might call ReactNative.measure(ref). This would hopefully
<del> let the ref for TextInput then have the methods like `.clear`. Or we do it
<del> the other way and make it TextInput.clear(textInputRef) which would be fine
<del> too. Either way though is a breaking change that is longer term.
<del> - Mutate this ref. :( Gross, but accomplishes what we need in the meantime
<del> before we can get to the long term breaking change.
<del> */
<add> Hi reader from the future. I'm sorry for this.
<add>
<add> This is a hack. Ideally we would forwardRef to the underlying
<add> host component. However, since TextInput has it's own methods that can be
<add> called as well, if we used the standard forwardRef then these
<add> methods wouldn't be accessible and thus be a breaking change.
<add>
<add> We have a couple of options of how to handle this:
<add> - Return a new ref with everything we methods from both. This is problematic
<add> because we need React to also know it is a host component which requires
<add> internals of the class implementation of the ref.
<add> - Break the API and have some other way to call one set of the methods or
<add> the other. This is our long term approach as we want to eventually
<add> get the methods on host components off the ref. So instead of calling
<add> ref.measure() you might call ReactNative.measure(ref). This would hopefully
<add> let the ref for TextInput then have the methods like `.clear`. Or we do it
<add> the other way and make it TextInput.clear(textInputRef) which would be fine
<add> too. Either way though is a breaking change that is longer term.
<add> - Mutate this ref. :( Gross, but accomplishes what we need in the meantime
<add> before we can get to the long term breaking change.
<add> */
<ide> if (ref) {
<del> ref.clear = this.clear;
<del> ref.isFocused = this.isFocused;
<del> ref.getNativeRef = this.getNativeRef;
<add> ref.clear = clear;
<add> ref.isFocused = isFocused;
<add> ref.getNativeRef = getNativeRef;
<ide> }
<ide> },
<ide> });
<ide>
<del> _onPress = (event: PressEvent) => {
<del> if (this.props.editable || this.props.editable === undefined) {
<del> nullthrows(this._inputRef).focus();
<add> const _onPress = (event: PressEvent) => {
<add> if (props.editable || props.editable === undefined) {
<add> nullthrows(inputRef.current).focus();
<ide> }
<ide> };
<ide>
<del> _onChange = (event: ChangeEvent) => {
<add> const _onChange = (event: ChangeEvent) => {
<ide> // Make sure to fire the mostRecentEventCount first so it is already set on
<ide> // native when the text value is set.
<del> if (this._inputRef && this._inputRef.setNativeProps) {
<del> this._inputRef.setNativeProps({
<add> if (inputRef.current) {
<add> inputRef.current.setNativeProps({
<ide> mostRecentEventCount: event.nativeEvent.eventCount,
<ide> });
<ide> }
<ide>
<ide> const text = event.nativeEvent.text;
<del> this.props.onChange && this.props.onChange(event);
<del> this.props.onChangeText && this.props.onChangeText(text);
<add> props.onChange && props.onChange(event);
<add> props.onChangeText && props.onChangeText(text);
<ide>
<del> if (!this._inputRef) {
<del> // calling `this.props.onChange` or `this.props.onChangeText`
<add> if (!inputRef.current) {
<add> // calling `props.onChange` or `props.onChangeText`
<ide> // may clean up the input itself. Exits here.
<ide> return;
<ide> }
<ide>
<del> this._lastNativeText = text;
<del> this.forceUpdate();
<add> setLastNativeText(text);
<ide> };
<ide>
<del> _onSelectionChange = (event: SelectionChangeEvent) => {
<del> this.props.onSelectionChange && this.props.onSelectionChange(event);
<add> const _onSelectionChange = (event: SelectionChangeEvent) => {
<add> props.onSelectionChange && props.onSelectionChange(event);
<ide>
<del> if (!this._inputRef) {
<del> // calling `this.props.onSelectionChange`
<add> if (!inputRef.current) {
<add> // calling `props.onSelectionChange`
<ide> // may clean up the input itself. Exits here.
<ide> return;
<ide> }
<ide>
<del> this._lastNativeSelection = event.nativeEvent.selection;
<del>
<del> if (this.props.selection) {
<del> this.forceUpdate();
<del> }
<add> setLastNativeSelection(event.nativeEvent.selection);
<ide> };
<ide>
<del> _onFocus = (event: FocusEvent) => {
<del> TextInputState.focusField(ReactNative.findNodeHandle(this._inputRef));
<del> if (this.props.onFocus) {
<del> this.props.onFocus(event);
<add> const _onFocus = (event: FocusEvent) => {
<add> TextInputState.focusField(ReactNative.findNodeHandle(inputRef.current));
<add> if (props.onFocus) {
<add> props.onFocus(event);
<ide> }
<ide> };
<ide>
<del> _onBlur = (event: BlurEvent) => {
<del> TextInputState.blurField(ReactNative.findNodeHandle(this._inputRef));
<del> if (this.props.onBlur) {
<del> this.props.onBlur(event);
<add> const _onBlur = (event: BlurEvent) => {
<add> TextInputState.blurField(ReactNative.findNodeHandle(inputRef.current));
<add> if (props.onBlur) {
<add> props.onBlur(event);
<ide> }
<ide> };
<ide>
<del> _onScroll = (event: ScrollEvent) => {
<del> this.props.onScroll && this.props.onScroll(event);
<add> const _onScroll = (event: ScrollEvent) => {
<add> props.onScroll && props.onScroll(event);
<ide> };
<add>
<add> let textInput = null;
<add> let additionalTouchableProps: {|
<add> rejectResponderTermination?: $PropertyType<
<add> Props,
<add> 'rejectResponderTermination',
<add> >,
<add> // This is a hack to let Flow know we want an exact object
<add> |} = {...null};
<add>
<add> if (Platform.OS === 'ios') {
<add> const RCTTextInputView = props.multiline
<add> ? RCTMultilineTextInputView
<add> : RCTSinglelineTextInputView;
<add>
<add> const style = props.multiline
<add> ? [styles.multilineInput, props.style]
<add> : props.style;
<add>
<add> additionalTouchableProps.rejectResponderTermination =
<add> props.rejectResponderTermination;
<add>
<add> textInput = (
<add> <RCTTextInputView
<add> ref={_setNativeRef}
<add> {...props}
<add> dataDetectorTypes={props.dataDetectorTypes}
<add> onBlur={_onBlur}
<add> onChange={_onChange}
<add> onContentSizeChange={props.onContentSizeChange}
<add> onFocus={_onFocus}
<add> onScroll={_onScroll}
<add> onSelectionChange={_onSelectionChange}
<add> onSelectionChangeShouldSetResponder={emptyFunctionThatReturnsTrue}
<add> selection={selection}
<add> style={style}
<add> text={_getText()}
<add> />
<add> );
<add> } else if (Platform.OS === 'android') {
<add> const style = [props.style];
<add> const autoCapitalize = props.autoCapitalize || 'sentences';
<add> let children = props.children;
<add> let childCount = 0;
<add> React.Children.forEach(children, () => ++childCount);
<add> invariant(
<add> !(props.value && childCount),
<add> 'Cannot specify both value and children.',
<add> );
<add> if (childCount > 1) {
<add> children = <Text>{children}</Text>;
<add> }
<add>
<add> textInput = (
<add> /* $FlowFixMe the types for AndroidTextInput don't match up exactly with
<add> the props for TextInput. This will need to get fixed */
<add> <AndroidTextInput
<add> ref={_setNativeRef}
<add> {...props}
<add> autoCapitalize={autoCapitalize}
<add> children={children}
<add> disableFullscreenUI={props.disableFullscreenUI}
<add> mostRecentEventCount={0}
<add> onBlur={_onBlur}
<add> onChange={_onChange}
<add> onFocus={_onFocus}
<add> onScroll={_onScroll}
<add> onSelectionChange={_onSelectionChange}
<add> selection={selection}
<add> style={style}
<add> text={_getText()}
<add> textBreakStrategy={props.textBreakStrategy}
<add> />
<add> );
<add> }
<add> return (
<add> <TextAncestor.Provider value={true}>
<add> <TouchableWithoutFeedback
<add> onLayout={props.onLayout}
<add> onPress={_onPress}
<add> accessible={props.accessible}
<add> accessibilityLabel={props.accessibilityLabel}
<add> accessibilityRole={props.accessibilityRole}
<add> accessibilityState={props.accessibilityState}
<add> nativeID={props.nativeID}
<add> testID={props.testID}
<add> {...additionalTouchableProps}>
<add> {textInput}
<add> </TouchableWithoutFeedback>
<add> </TextAncestor.Provider>
<add> );
<ide> }
<ide>
<ide> const ExportedForwardRef: React.AbstractComponent<
<ide><path>RNTester/js/examples/TextInput/TextInputExample.ios.js
<ide> class RewriteExampleInvalidCharacters extends React.Component<
<ide> }
<ide> }
<ide>
<add>class RewriteInvalidCharactersAndClearExample extends React.Component<
<add> $FlowFixMeProps,
<add> any,
<add>> {
<add> inputRef: ?React.ElementRef<typeof TextInput> = null;
<add>
<add> constructor(props) {
<add> super(props);
<add> this.state = {text: ''};
<add> }
<add> render() {
<add> return (
<add> <View style={styles.rewriteContainer}>
<add> <TextInput
<add> ref={ref => {
<add> this.inputRef = ref;
<add> }}
<add> multiline={false}
<add> onChangeText={text => {
<add> this.setState({text: text.replace(/\s/g, '')});
<add> }}
<add> style={styles.default}
<add> value={this.state.text}
<add> />
<add> <Button
<add> onPress={() => {
<add> if (this.inputRef != null) {
<add> this.inputRef.clear();
<add> }
<add> }}
<add> title="Clear"
<add> />
<add> </View>
<add> );
<add> }
<add>}
<add>
<ide> class RewriteExampleKana extends React.Component<$FlowFixMeProps, any> {
<ide> constructor(props) {
<ide> super(props);
<ide> exports.examples = [
<ide> return <RewriteExampleInvalidCharacters />;
<ide> },
<ide> },
<add> {
<add> title: 'Rewrite (no spaces allowed) and clear',
<add> render: function(): React.Node {
<add> return <RewriteInvalidCharactersAndClearExample />;
<add> },
<add> },
<ide> {
<ide> title: 'Live Re-Write (ひ -> 日)',
<ide> render: function(): React.Node { | 2 |
Javascript | Javascript | add more timing logs | 1ac7064cad8184546465d95f33b879849b1348f7 | <ide><path>worker/client.js
<ide> function WorkerPDFDoc(canvas) {
<ide>
<ide> var renderData = function() {
<ide> if (id == 0) {
<del> console.time("canvas rendering");
<add> console.time("main canvas rendering");
<ide> var ctx = this.ctx;
<ide> ctx.save();
<ide> ctx.fillStyle = "rgb(255, 255, 255)";
<ide> ctx.fillRect(0, 0, canvas.width, canvas.height);
<ide> ctx.restore();
<ide> }
<ide> renderProxyCanvas(canvasList[id], cmdQueue);
<del> if (id == 0) console.timeEnd("canvas rendering")
<add> if (id == 0) {
<add> console.timeEnd("main canvas rendering");
<add> console.timeEnd(">>> total page display time:");
<add> }
<ide> }.bind(this);
<ide>
<ide> if (this.waitingForFonts) {
<ide> WorkerPDFDoc.prototype.open = function(url, callback) {
<ide>
<ide> WorkerPDFDoc.prototype.showPage = function(numPage) {
<ide> this.numPage = parseInt(numPage);
<add> console.log("=== start rendering page " + numPage + " ===");
<add> console.time(">>> total page display time:");
<ide> this.worker.postMessage(numPage);
<ide> if (this.onChangePage) {
<ide> this.onChangePage(numPage); | 1 |
Java | Java | delete dead code in spring-webmvc | b0e07cc7e336062cb02673e5ab60b9b52d51b70e | <ide><path>spring-webmvc/src/main/java/org/springframework/web/servlet/function/DefaultEntityResponseBuilder.java
<ide> public DefaultEntityResponse(int statusCode, HttpHeaders headers,
<ide> this.entityType = entityType;
<ide> }
<ide>
<del> private static <T> boolean isResource(T entity) {
<del> return !(entity instanceof InputStreamResource) &&
<del> (entity instanceof Resource);
<del> }
<del>
<ide> @Override
<ide> public T entity() {
<ide> return this.entity;
<ide><path>spring-webmvc/src/main/java/org/springframework/web/servlet/handler/AbstractHandlerMethodMapping.java
<ide> import javax.servlet.ServletException;
<ide> import javax.servlet.http.HttpServletRequest;
<ide>
<del>import kotlin.reflect.KFunction;
<del>import kotlin.reflect.jvm.ReflectJvmMapping;
<del>
<ide> import org.springframework.aop.support.AopUtils;
<ide> import org.springframework.beans.factory.BeanFactoryUtils;
<ide> import org.springframework.beans.factory.InitializingBean;
<ide> public void handle() {
<ide> }
<ide> }
<ide>
<del> /**
<del> * Inner class to avoid a hard dependency on Kotlin at runtime.
<del> */
<del> private static class KotlinDelegate {
<del>
<del> static private boolean isSuspend(Method method) {
<del> KFunction<?> function = ReflectJvmMapping.getKotlinFunction(method);
<del> return function != null && function.isSuspend();
<del> }
<del> }
<del>
<ide> }
<ide><path>spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ResponseBodyEmitterReturnValueHandler.java
<ide> */
<ide> public class ResponseBodyEmitterReturnValueHandler implements HandlerMethodReturnValueHandler {
<ide>
<del> private final List<HttpMessageConverter<?>> messageConverters;
<del>
<ide> private final List<HttpMessageConverter<?>> sseMessageConverters;
<ide>
<ide> private final ReactiveTypeHandler reactiveHandler;
<ide> public class ResponseBodyEmitterReturnValueHandler implements HandlerMethodRetur
<ide> */
<ide> public ResponseBodyEmitterReturnValueHandler(List<HttpMessageConverter<?>> messageConverters) {
<ide> Assert.notEmpty(messageConverters, "HttpMessageConverter List must not be empty");
<del> this.messageConverters = messageConverters;
<ide> this.sseMessageConverters = initSseConverters(messageConverters);
<ide> this.reactiveHandler = new ReactiveTypeHandler();
<ide> }
<ide> public ResponseBodyEmitterReturnValueHandler(List<HttpMessageConverter<?>> messa
<ide> ReactiveAdapterRegistry registry, TaskExecutor executor, ContentNegotiationManager manager) {
<ide>
<ide> Assert.notEmpty(messageConverters, "HttpMessageConverter List must not be empty");
<del> this.messageConverters = messageConverters;
<ide> this.sseMessageConverters = initSseConverters(messageConverters);
<ide> this.reactiveHandler = new ReactiveTypeHandler(registry, executor, manager);
<ide> } | 3 |
Javascript | Javascript | remove undocumented testutils methods | 18d6cb5ebe56e96c293e82e0c861ed9f19765671 | <ide><path>src/renderers/dom/test/ReactTestUtilsEntry.js
<ide> var ReactTestUtils = {
<ide> return constructor === type;
<ide> },
<ide>
<del> // TODO: deprecate? It's undocumented and unused.
<del> isCompositeComponentElement: function(inst) {
<del> if (!React.isValidElement(inst)) {
<del> return false;
<del> }
<del> // We check the prototype of the type that will get mounted, not the
<del> // instance itself. This is a future proof way of duck typing.
<del> var prototype = inst.type.prototype;
<del> return (
<del> typeof prototype.render === 'function' &&
<del> typeof prototype.setState === 'function'
<del> );
<del> },
<del>
<del> // TODO: deprecate? It's undocumented and unused.
<del> isCompositeComponentElementWithType: function(inst, type) {
<del> var internalInstance = ReactInstanceMap.get(inst);
<del> var constructor = internalInstance._currentElement.type;
<del>
<del> return !!(ReactTestUtils.isCompositeComponentElement(inst) &&
<del> constructor === type);
<del> },
<del>
<del> // TODO: deprecate? It's undocumented and unused.
<del> getRenderedChildOfCompositeComponent: function(inst) {
<del> if (!ReactTestUtils.isCompositeComponent(inst)) {
<del> return null;
<del> }
<del> var internalInstance = ReactInstanceMap.get(inst);
<del> return internalInstance._renderedComponent.getPublicInstance();
<del> },
<del>
<ide> findAllInRenderedTree: function(inst, test) {
<ide> if (!inst) {
<ide> return []; | 1 |
PHP | PHP | link command | 7194f9c5ff6ea6b8f6e794a219ea5902d11f4411 | <ide><path>src/Illuminate/Foundation/Console/StorageLinkCommand.php
<ide> public function fire()
<ide> return $this->error('The "public/storage" directory already exists.');
<ide> }
<ide>
<del> symlink(storage_path('app/public'), public_path('storage'));
<add> $this->laravel->make('files')->link(storage_path('app/public'), public_path('storage'));
<ide>
<ide> $this->info('The [public/storage] directory has been linked.');
<ide> } | 1 |
Go | Go | fix a panic when the exec fails to start | fcf9daad91d9be24ceddbc4add4d3a8179c9b32c | <ide><path>api/server/exec.go
<ide> func (s *Server) postContainerExecStart(version version.Version, w http.Response
<ide> }
<ide> var (
<ide> execName = vars["name"]
<del> stdin io.ReadCloser
<add> stdin, inStream io.ReadCloser
<ide> stdout, stderr, outStream io.Writer
<ide> )
<ide>
<ide> func (s *Server) postContainerExecStart(version version.Version, w http.Response
<ide> if !execStartCheck.Detach {
<ide> var err error
<ide> // Setting up the streaming http interface.
<del> inStream, outStream, err := hijackServer(w)
<add> inStream, outStream, err = hijackServer(w)
<ide> if err != nil {
<ide> return err
<ide> }
<ide> func (s *Server) postContainerExecStart(version version.Version, w http.Response
<ide> stderr = stdcopy.NewStdWriter(outStream, stdcopy.Stderr)
<ide> stdout = stdcopy.NewStdWriter(outStream, stdcopy.Stdout)
<ide> }
<add> } else {
<add> outStream = w
<ide> }
<ide>
<ide> // Now run the user process in container.
<ide><path>integration-cli/docker_cli_exec_test.go
<ide> func (s *DockerSuite) TestExecOnReadonlyContainer(c *check.C) {
<ide> c.Fatalf("exec into a read-only container failed with exit status %d", status)
<ide> }
<ide> }
<add>
<add>// #15750
<add>func (s *DockerSuite) TestExecStartFails(c *check.C) {
<add> name := "exec-15750"
<add> dockerCmd(c, "run", "-d", "--name", name, "busybox", "top")
<add>
<add> _, errmsg, status := dockerCmdWithStdoutStderr(nil, "exec", name, "no-such-cmd")
<add> if status == 255 && !strings.Contains(errmsg, "executable file not found") {
<add> c.Fatal("exec error message not received. The daemon might had crashed")
<add> }
<add>}
<ide><path>integration-cli/docker_utils.go
<ide> func dockerCmdWithError(args ...string) (string, int, error) {
<ide>
<ide> func dockerCmdWithStdoutStderr(c *check.C, args ...string) (string, string, int) {
<ide> stdout, stderr, status, err := runCommandWithStdoutStderr(exec.Command(dockerBinary, args...))
<del> c.Assert(err, check.IsNil, check.Commentf("%q failed with errors: %s, %v", strings.Join(args, " "), stderr, err))
<add> if c != nil {
<add> c.Assert(err, check.IsNil, check.Commentf("%q failed with errors: %s, %v", strings.Join(args, " "), stderr, err))
<add> }
<ide> return stdout, stderr, status
<ide> }
<ide> | 3 |
Go | Go | remove container env var from libcontainer | 431d510cae85bc1265c861028dd9751ae95088b2 | <ide><path>execdriver/native/default_template.go
<ide> package native
<ide>
<ide> import (
<add> "fmt"
<add> "github.com/dotcloud/docker/execdriver"
<ide> "github.com/dotcloud/docker/pkg/cgroups"
<ide> "github.com/dotcloud/docker/pkg/libcontainer"
<ide> )
<ide>
<add>// createContainer populates and configrues the container type with the
<add>// data provided by the execdriver.Command
<add>func createContainer(c *execdriver.Command) *libcontainer.Container {
<add> container := getDefaultTemplate()
<add>
<add> container.Hostname = getEnv("HOSTNAME", c.Env)
<add> container.Tty = c.Tty
<add> container.User = c.User
<add> container.WorkingDir = c.WorkingDir
<add> container.Env = c.Env
<add>
<add> if c.Network != nil {
<add> container.Network = &libcontainer.Network{
<add> Mtu: c.Network.Mtu,
<add> Address: fmt.Sprintf("%s/%d", c.Network.IPAddress, c.Network.IPPrefixLen),
<add> Gateway: c.Network.Gateway,
<add> Type: "veth",
<add> Context: libcontainer.Context{
<add> "prefix": "dock",
<add> "bridge": c.Network.Bridge,
<add> },
<add> }
<add> }
<add> container.Cgroups.Name = c.ID
<add> if c.Privileged {
<add> container.Capabilities = nil
<add> container.Cgroups.DeviceAccess = true
<add> }
<add> if c.Resources != nil {
<add> container.Cgroups.CpuShares = c.Resources.CpuShares
<add> container.Cgroups.Memory = c.Resources.Memory
<add> container.Cgroups.MemorySwap = c.Resources.MemorySwap
<add> }
<add> return container
<add>}
<add>
<ide> // getDefaultTemplate returns the docker default for
<ide> // the libcontainer configuration file
<ide> func getDefaultTemplate() *libcontainer.Container {
<ide><path>execdriver/native/driver.go
<ide> func (d *dockerStateWriter) WritePid(pid int) error {
<ide> func (d *dockerStateWriter) DeletePid() error {
<ide> return d.dsw.DeletePid()
<ide> }
<del>
<del>func createContainer(c *execdriver.Command) *libcontainer.Container {
<del> container := getDefaultTemplate()
<del>
<del> container.Hostname = getEnv("HOSTNAME", c.Env)
<del> container.Tty = c.Tty
<del> container.User = c.User
<del> container.WorkingDir = c.WorkingDir
<del> container.Env = c.Env
<del>
<del> container.Env = append(container.Env, "container=docker")
<del>
<del> if c.Network != nil {
<del> container.Network = &libcontainer.Network{
<del> Mtu: c.Network.Mtu,
<del> Address: fmt.Sprintf("%s/%d", c.Network.IPAddress, c.Network.IPPrefixLen),
<del> Gateway: c.Network.Gateway,
<del> Type: "veth",
<del> Context: libcontainer.Context{
<del> "prefix": "dock",
<del> "bridge": c.Network.Bridge,
<del> },
<del> }
<del> }
<del> container.Cgroups.Name = c.ID
<del> if c.Privileged {
<del> container.Capabilities = nil
<del> container.Cgroups.DeviceAccess = true
<del> }
<del> if c.Resources != nil {
<del> container.Cgroups.CpuShares = c.Resources.CpuShares
<del> container.Cgroups.Memory = c.Resources.Memory
<del> container.Cgroups.MemorySwap = c.Resources.MemorySwap
<del> }
<del> return container
<del>}
<ide><path>integration/container_test.go
<ide> func TestEnv(t *testing.T) {
<ide> goodEnv := []string{
<ide> "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
<ide> "HOME=/",
<del> "container=docker",
<ide> "HOSTNAME=" + utils.TruncateID(container.ID),
<ide> "FALSE=true",
<ide> "TRUE=false",
<ide><path>integration/utils_test.go
<ide> func newTestEngine(t utils.Fataler, autorestart bool, root string) *engine.Engin
<ide> job := eng.Job("initserver")
<ide> job.Setenv("Root", root)
<ide> job.SetenvBool("AutoRestart", autorestart)
<add> job.Setenv("ExecDriver", "native")
<ide> // TestGetEnabledCors and TestOptionsRoute require EnableCors=true
<ide> job.SetenvBool("EnableCors", true)
<ide> if err := job.Run(); err != nil {
<ide><path>runtime.go
<ide> func NewRuntimeFromDirectory(config *DaemonConfig, eng *engine.Engine) (*Runtime
<ide> case "native":
<ide> ed, err = native.NewDriver(config.Root)
<ide> default:
<del> return nil, fmt.Errorf("unknow exec driver %s", config.ExecDriver)
<add> return nil, fmt.Errorf("unknown exec driver %s", config.ExecDriver)
<ide> }
<ide> if err != nil {
<ide> return nil, err | 5 |
PHP | PHP | fix imports and add coverage | 49a72131bd1385474421390031c2ba9c1c7a4b8e | <ide><path>tests/TestCase/Error/ErrorTrapTest.php
<ide> use Cake\Http\ServerRequest;
<ide> use Cake\Log\Log;
<ide> use Cake\Routing\Router;
<del>use Cake\TestSuite\TestCase;
<ide> use Cake\TestSuite\Stub\ConsoleOutput;
<add>use Cake\TestSuite\TestCase;
<ide> use InvalidArgumentException;
<ide> use stdClass;
<ide> use TestApp\Error\LegacyErrorLogger;
<ide> public function testHandleErrorLogDeprecatedLoggerMethods()
<ide> $this->assertStringContainsString('URL=http://localhost/articles/view/1', $logs[0]);
<ide> }
<ide>
<del> public function testTraceOptionConsoleRendering()
<add> public function testConsoleRenderingNoTrace()
<ide> {
<ide> $stub = new ConsoleOutput();
<ide> $trap = new ErrorTrap([
<ide> public function testTraceOptionConsoleRendering()
<ide> $this->assertStringNotContainsString('Trace', $out[0]);
<ide> }
<ide>
<add> public function testConsoleRenderingWithTrace()
<add> {
<add> $stub = new ConsoleOutput();
<add> $trap = new ErrorTrap([
<add> 'errorRenderer' => ConsoleErrorRenderer::class,
<add> 'trace' => true,
<add> 'stderr' => $stub,
<add> ]);
<add> $trap->register();
<add>
<add> ob_start();
<add> trigger_error('Oh no it was bad', E_USER_NOTICE);
<add> ob_get_clean();
<add> restore_error_handler();
<add>
<add> $out = $stub->messages();
<add> $this->assertStringContainsString('Oh no it was bad', $out[0]);
<add> $this->assertStringContainsString('Trace', $out[0]);
<add> $this->assertStringContainsString('ErrorTrapTest::testConsoleRenderingWithTrace', $out[0]);
<add> }
<add>
<ide> public function testRegisterNoOutputDebug()
<ide> {
<ide> Log::setConfig('test_error', [ | 1 |
Ruby | Ruby | specify `hosts` in bug report template | 6a8519ca899db1b107bc3be8310e49196f341372 | <ide><path>guides/bug_report_templates/action_controller_master.rb
<ide>
<ide> class TestApp < Rails::Application
<ide> config.root = __dir__
<add> config.hosts << "example.org"
<ide> secrets.secret_key_base = "secret_key_base"
<ide>
<ide> config.logger = Logger.new($stdout) | 1 |
Javascript | Javascript | fix template and replace properties' docs | d25975438ae085a526bde9ed2cecd52939f8a787 | <ide><path>src/ng/compile.js
<ide> * If no `type` is specified, then the type is considered to be html.
<ide> *
<ide> * #### `template`
<del> * replace the current element with the contents of the HTML. The replacement process
<del> * migrates all of the attributes / classes from the old element to the new one. See the
<del> * {@link guide/directive#creating-custom-directives_creating-directives_template-expanding-directive
<del> * Directives Guide} for an example.
<add> * HTML markup that may:
<add> * * Replace the contents of the directive's element (defualt).
<add> * * Replace the directive's element itself (if `replace` is true - DEPRECATED).
<add> * * Wrap the contents of the directive's element (if `transclude` is true).
<add> *
<add> * Value may be:
<ide> *
<del> * You can specify `template` as a string representing the template or as a function which takes
<del> * two arguments `tElement` and `tAttrs` (described in the `compile` function api below) and
<del> * returns a string value representing the template.
<add> * * A string. For example `<div red-on-hover>{{delete_str}}</div>`.
<add> * * A function which takes two arguments `tElement` and `tAttrs` (described in the `compile`
<add> * function api below) and returns a string value.
<ide> *
<ide> *
<ide> * #### `templateUrl`
<ide> *
<ide> *
<ide> * #### `replace` ([*DEPRECATED*!], will be removed in next major release)
<del> * specify where the template should be inserted. Defaults to `false`.
<add> * specify what the template should replace. Defaults to `false`.
<ide> *
<del> * * `true` - the template will replace the current element.
<del> * * `false` - the template will replace the contents of the current element.
<add> * * `true` - the template will replace the directive's element.
<add> * * `false` - the template will replace the contents of the directive's element.
<ide> *
<add> * The replacement process migrates all of the attributes / classes from the old element to the new
<add> * one. See the {@link guide/directive#creating-custom-directives_creating-directives_template-expanding-directive
<add> * Directives Guide} for an example.
<ide> *
<ide> * #### `transclude`
<ide> * compile the content of the element and make it available to the directive. | 1 |
Ruby | Ruby | fix typo on method name | 71a006df0eaff580bf0badfb88197d531177e5e8 | <ide><path>railties/test/application/configuration_test.rb
<ide> def index
<ide> assert_equal "XML", last_response.body
<ide> end
<ide>
<del> test "Rails.application#env_config exists and include some existing parameters" do
<add> test "Rails.application#env_config exists and includes some existing parameters" do
<ide> make_basic_app
<ide>
<ide> assert_equal app.env_config["action_dispatch.parameter_filter"], app.config.filter_parameters | 1 |
Javascript | Javascript | use minerr to throw exception | cd36cd86fcbb8fec873a1fe3e513965d4dc0b557 | <ide><path>src/ngSanitize/sanitize.js
<ide> 'use strict';
<ide>
<add>var ngSanitizeMinErr = minErr('ngSanitize');
<add>
<ide> /**
<ide> * @ngdoc overview
<ide> * @name ngSanitize
<ide> function htmlParser( html, handler ) {
<ide> }
<ide>
<ide> if ( html == last ) {
<del> throw "Parse Error: " + html;
<add> throw ngSanitizeMinErr('badparse', "The sanitizer was unable to parse the following block of html: {0}", html);
<ide> }
<ide> last = html;
<ide> } | 1 |
Python | Python | add test for issue #435 | 9c8ac91d72b1a38f1947d804669a8b5612e2034b | <ide><path>spacy/tests/tagger/test_lemmatizer.py
<ide> def test_noun_lemmas(lemmatizer):
<ide> assert do('axes') == set(['axis', 'axe', 'ax'])
<ide>
<ide>
<add>def test_base_form_dive(lemmatizer):
<add> do = lemmatizer.noun
<add> assert do('dive', number='sing') == set(['dive'])
<add> assert do('dive', number='plur') == set(['diva'])
<add>
<add>
<ide> def test_smart_quotes(lemmatizer):
<ide> do = lemmatizer.punct
<ide> assert do('“') == set(['"']) | 1 |
Ruby | Ruby | help autotools with 10.12 sdk on 10.11 | 1d7aa1fe0b430a4415cb976a2b2c3041f4269b55 | <ide><path>Library/Homebrew/extend/os/mac/extend/ENV/super.rb
<ide> def setup_build_environment(formula = nil)
<ide> self["SDKROOT"] = MacOS.sdk_path
<ide> end
<ide>
<add> # Filter out symbols known not to be defined on 10.11 since GNU Autotools
<add> # can't reliably figure this out with Xcode 8 on its own yet.
<add> if MacOS.version == "10.11" && MacOS::Xcode.installed? && MacOS::Xcode.version >= "8.0"
<add> %w[basename_r clock_getres clock_gettime clock_settime dirname_r
<add> getentropy mkostemp mkostemps].each do |s|
<add> ENV["ac_cv_func_#{s}"] = "no"
<add> end
<add> end
<add>
<ide> # On 10.9, the tools in /usr/bin proxy to the active developer directory.
<ide> # This means we can use them for any combination of CLT and Xcode.
<ide> self["HOMEBREW_PREFER_CLT_PROXIES"] = "1" if MacOS.version >= "10.9" | 1 |
Text | Text | allow new line in linear-gradient formatting | 25ea44edf525cf47d3fff76330741a0b083e5236 | <ide><path>curriculum/challenges/english/01-responsive-web-design/applied-visual-design/create-a-gradual-css-linear-gradient.english.md
<ide> Use a <code>linear-gradient()</code> for the <code>div</code> element's <code>ba
<ide> ```yml
<ide> tests:
<ide> - text: The <code>div</code> element should have a <code>linear-gradient</code> <code>background</code> with the specified direction and colors.
<del> testString: assert(code.match(/background:\s*?linear-gradient\(35deg,\s*?(#CCFFFF|#CFF),\s*?(#FFCCCC|#FCC)\);/gi), 'The <code>div</code> element should have a <code>linear-gradient</code> <code>background</code> with the specified direction and colors.');
<add> testString: assert($('div').css('background-image').match(/linear-gradient\(35deg, rgb\(204, 255, 255\), rgb\(255, 204, 204\)\)/gi));
<ide>
<ide> ```
<ide> | 1 |
Text | Text | simplify wording of github issue template | a1f2fc7c5c4aed2f195964f3857105f76929c5c6 | <ide><path>.github/ISSUE_TEMPLATE.md
<del><!-- freeCodeCamp Issue Template -->
<add><!-- NOTE: If you're reporting a security issue, don't create a GitHub issue. Instead, email [email protected]. We will look into it immediately. -->
<ide>
<del><!-- Please provide as much detail as possible for us to fix your issue -->
<del><!-- Remove any heading sections you did not fill out -->
<add>#### Describe your problem and - if possible - how to reproduce it
<ide>
<del><!-- NOTE: If your issue is CodePen Project / Test Suite related, please open it using the below URL instead -->
<del><!-- https://github.com/freeCodeCamp/testable-projects-fcc/issues/new -->
<ide>
<del>#### Security
<del>Trying to report a security issue?
<add>#### Add a Link to the page with the problem
<ide>
<del>👌 please report security issues to [email protected] instead of raising a Github issue. We look forward to working with you. If the issue is significant we'll work on resolving it as quickly as we can. We'll be happy to mention you in a published list of security researchers that found issues in our projects if you so desire.
<ide>
<add>#### Tell us about your browser and operating system
<ide>
<del>#### Challenge Name
<del><!-- Insert link to challenge below -->
<del>
<del>
<del>#### Issue Description
<del><!-- Describe below when the issue happens and how to reproduce it -->
<del>
<del>
<del>#### Browser Information
<del><!-- Describe your workspace in which you are having issues-->
<del>
<del>* Browser Name, Version:
<add>* Browser Name:
<add>* Browser Version:
<ide> * Operating System:
<del>* Mobile, Desktop, or Tablet:
<del>
<del>#### Your Code
<del><!-- If relevant, paste all of your challenge code in here -->
<del>```js
<del>
<ide>
<ide>
<del>```
<del>#### Screenshot
<del><!-- Add a screenshot of your issue -->
<add>#### If possible, add a screenshot here
<ide>
<ide> | 1 |
Ruby | Ruby | handle backslash in args for builderror | d47517f635001088fb1fb7bf43231b1fd5168d3b | <ide><path>Library/Homebrew/exceptions.rb
<ide> def initialize(formula, cmd, args, env)
<ide> @cmd = cmd
<ide> @args = args
<ide> @env = env
<del> pretty_args = Array(args).map { |arg| arg.to_s.gsub " ", "\\ " }.join(" ")
<add> pretty_args = Array(args).map { |arg| arg.to_s.gsub(/[\\ ]/, "\\\\\\0") }.join(" ")
<ide> super "Failed executing: #{cmd} #{pretty_args}".strip
<ide> end
<ide> | 1 |
Go | Go | enable multiple testinspect tests | 3ae6cd453ece9761a951efd839cf917078b03718 | <ide><path>integration-cli/docker_cli_inspect_test.go
<ide> func (s *DockerSuite) TestInspectImage(c *check.C) {
<ide> }
<ide>
<ide> func (s *DockerSuite) TestInspectInt64(c *check.C) {
<del> testRequires(c, DaemonIsLinux)
<del>
<ide> dockerCmd(c, "run", "-d", "-m=300M", "--name", "inspectTest", "busybox", "true")
<ide> inspectOut := inspectField(c, "inspectTest", "HostConfig.Memory")
<ide> c.Assert(inspectOut, checker.Equals, "314572800")
<ide> }
<ide>
<ide> func (s *DockerSuite) TestInspectDefault(c *check.C) {
<del> testRequires(c, DaemonIsLinux)
<ide> //Both the container and image are named busybox. docker inspect will fetch the container JSON.
<ide> //If the container JSON is not available, it will go for the image JSON.
<ide>
<ide> func (s *DockerSuite) TestInspectDefault(c *check.C) {
<ide> }
<ide>
<ide> func (s *DockerSuite) TestInspectStatus(c *check.C) {
<del> defer unpauseAllContainers()
<del> testRequires(c, DaemonIsLinux)
<del> out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
<add> if daemonPlatform != "windows" {
<add> defer unpauseAllContainers()
<add> }
<add> out, _ := runSleepingContainer(c, "-d")
<ide> out = strings.TrimSpace(out)
<ide>
<ide> inspectOut := inspectField(c, out, "State.Status")
<ide> c.Assert(inspectOut, checker.Equals, "running")
<ide>
<del> dockerCmd(c, "pause", out)
<del> inspectOut = inspectField(c, out, "State.Status")
<del> c.Assert(inspectOut, checker.Equals, "paused")
<add> // Windows does not support pause/unpause on Windows Server Containers.
<add> // (RS1 does for Hyper-V Containers, but production CI is not setup for that)
<add> if daemonPlatform != "windows" {
<add> dockerCmd(c, "pause", out)
<add> inspectOut = inspectField(c, out, "State.Status")
<add> c.Assert(inspectOut, checker.Equals, "paused")
<ide>
<del> dockerCmd(c, "unpause", out)
<del> inspectOut = inspectField(c, out, "State.Status")
<del> c.Assert(inspectOut, checker.Equals, "running")
<add> dockerCmd(c, "unpause", out)
<add> inspectOut = inspectField(c, out, "State.Status")
<add> c.Assert(inspectOut, checker.Equals, "running")
<add> }
<ide>
<ide> dockerCmd(c, "stop", out)
<ide> inspectOut = inspectField(c, out, "State.Status")
<ide> func (s *DockerSuite) TestInspectStatus(c *check.C) {
<ide> }
<ide>
<ide> func (s *DockerSuite) TestInspectTypeFlagContainer(c *check.C) {
<del> testRequires(c, DaemonIsLinux)
<ide> //Both the container and image are named busybox. docker inspect will fetch container
<ide> //JSON State.Running field. If the field is true, it's a container.
<del>
<del> dockerCmd(c, "run", "--name=busybox", "-d", "busybox", "top")
<add> runSleepingContainer(c, "--name=busybox", "-d")
<ide>
<ide> formatStr := "--format={{.State.Running}}"
<ide> out, _ := dockerCmd(c, "inspect", "--type=container", formatStr, "busybox")
<ide> c.Assert(out, checker.Equals, "true\n") // not a container JSON
<ide> }
<ide>
<ide> func (s *DockerSuite) TestInspectTypeFlagWithNoContainer(c *check.C) {
<del> testRequires(c, DaemonIsLinux)
<ide> //Run this test on an image named busybox. docker inspect will try to fetch container
<ide> //JSON. Since there is no container named busybox and --type=container, docker inspect will
<ide> //not try to get the image JSON. It will throw an error.
<ide> func (s *DockerSuite) TestInspectTypeFlagWithNoContainer(c *check.C) {
<ide> }
<ide>
<ide> func (s *DockerSuite) TestInspectTypeFlagWithImage(c *check.C) {
<del> testRequires(c, DaemonIsLinux)
<ide> //Both the container and image are named busybox. docker inspect will fetch image
<ide> //JSON as --type=image. if there is no image with name busybox, docker inspect
<ide> //will throw an error.
<ide> func (s *DockerSuite) TestInspectTypeFlagWithImage(c *check.C) {
<ide> }
<ide>
<ide> func (s *DockerSuite) TestInspectTypeFlagWithInvalidValue(c *check.C) {
<del> testRequires(c, DaemonIsLinux)
<ide> //Both the container and image are named busybox. docker inspect will fail
<ide> //as --type=foobar is not a valid value for the flag.
<ide>
<ide> func (s *DockerSuite) TestInspectImageFilterInt(c *check.C) {
<ide> }
<ide>
<ide> func (s *DockerSuite) TestInspectContainerFilterInt(c *check.C) {
<del> testRequires(c, DaemonIsLinux)
<ide> runCmd := exec.Command(dockerBinary, "run", "-i", "-a", "stdin", "busybox", "cat")
<ide> runCmd.Stdin = strings.NewReader("blahblah")
<ide> out, _, _, err := runCommandWithStdoutStderr(runCmd)
<ide> func (s *DockerSuite) TestInspectNamedMountPoint(c *check.C) {
<ide>
<ide> // #14947
<ide> func (s *DockerSuite) TestInspectTimesAsRFC3339Nano(c *check.C) {
<del> testRequires(c, DaemonIsLinux)
<ide> out, _ := dockerCmd(c, "run", "-d", "busybox", "true")
<ide> id := strings.TrimSpace(out)
<ide> startedAt := inspectField(c, id, "State.StartedAt")
<ide> func (s *DockerSuite) TestInspectTimesAsRFC3339Nano(c *check.C) {
<ide>
<ide> // #15633
<ide> func (s *DockerSuite) TestInspectLogConfigNoType(c *check.C) {
<del> testRequires(c, DaemonIsLinux)
<ide> dockerCmd(c, "create", "--name=test", "--log-opt", "max-file=42", "busybox")
<ide> var logConfig container.LogConfig
<ide>
<ide> func (s *DockerSuite) TestInspectStopWhenNotFound(c *check.C) {
<ide> }
<ide>
<ide> func (s *DockerSuite) TestInspectHistory(c *check.C) {
<del> testRequires(c, DaemonIsLinux)
<del> dockerCmd(c, "run", "--name=testcont", "-d", "busybox", "top")
<add> dockerCmd(c, "run", "--name=testcont", "busybox", "echo", "hello")
<ide> dockerCmd(c, "commit", "-m", "test comment", "testcont", "testimg")
<ide> out, _, err := dockerCmdWithError("inspect", "--format='{{.Comment}}'", "testimg")
<del>
<ide> c.Assert(err, check.IsNil)
<ide> c.Assert(out, checker.Contains, "test comment")
<ide> }
<ide> func (s *DockerSuite) TestInspectContainerNetworkCustom(c *check.C) {
<ide> }
<ide>
<ide> func (s *DockerSuite) TestInspectRootFS(c *check.C) {
<del> testRequires(c, DaemonIsLinux)
<ide> out, _, err := dockerCmdWithError("inspect", "busybox")
<ide> c.Assert(err, check.IsNil)
<ide> | 1 |
PHP | PHP | fix typo in the doc of belongstomany.php | 9e0e6df6dbc14290118c23733bbe85a1f0eb8ea3 | <ide><path>src/Illuminate/Database/Eloquent/Relations/BelongsToMany.php
<ide> public function match(array $models, Collection $results, $relation)
<ide>
<ide> // Once we have an array dictionary of child objects we can easily match the
<ide> // children back to their parent using the dictionary and the keys on the
<del> // the parent models. Then we will return the hydrated models back out.
<add> // parent models. Then we should return these hydrated models back out.
<ide> foreach ($models as $model) {
<ide> $key = $this->getDictionaryKey($model->{$this->parentKey});
<ide> | 1 |
Java | Java | fix license headers | 2cc1195035d3c90d6b7c58c0ecc2b529dafa59d8 | <ide><path>ReactAndroid/src/main/java/com/facebook/yoga/YogaAlign.java
<del>/**
<add>/*
<ide> * Copyright (c) 2014-present, Facebook, Inc.
<ide> * All rights reserved.
<ide> *
<ide><path>ReactAndroid/src/main/java/com/facebook/yoga/YogaBaselineFunction.java
<del>/**
<add>/*
<ide> * Copyright (c) 2014-present, Facebook, Inc.
<ide> * All rights reserved.
<ide> *
<ide><path>ReactAndroid/src/main/java/com/facebook/yoga/YogaConfig.java
<del>/**
<add>/*
<ide> * Copyright (c) 2014-present, Facebook, Inc.
<ide> * All rights reserved.
<ide> *
<ide><path>ReactAndroid/src/main/java/com/facebook/yoga/YogaConstants.java
<del>/**
<add>/*
<ide> * Copyright (c) 2014-present, Facebook, Inc.
<ide> * All rights reserved.
<ide> *
<ide><path>ReactAndroid/src/main/java/com/facebook/yoga/YogaDimension.java
<del>/**
<add>/*
<ide> * Copyright (c) 2014-present, Facebook, Inc.
<ide> * All rights reserved.
<ide> *
<ide><path>ReactAndroid/src/main/java/com/facebook/yoga/YogaDirection.java
<del>/**
<add>/*
<ide> * Copyright (c) 2014-present, Facebook, Inc.
<ide> * All rights reserved.
<ide> *
<ide><path>ReactAndroid/src/main/java/com/facebook/yoga/YogaDisplay.java
<del>/**
<add>/*
<ide> * Copyright (c) 2014-present, Facebook, Inc.
<ide> * All rights reserved.
<ide> *
<ide><path>ReactAndroid/src/main/java/com/facebook/yoga/YogaEdge.java
<del>/**
<add>/*
<ide> * Copyright (c) 2014-present, Facebook, Inc.
<ide> * All rights reserved.
<ide> *
<ide><path>ReactAndroid/src/main/java/com/facebook/yoga/YogaExperimentalFeature.java
<del>/**
<add>/*
<ide> * Copyright (c) 2014-present, Facebook, Inc.
<ide> * All rights reserved.
<ide> *
<ide><path>ReactAndroid/src/main/java/com/facebook/yoga/YogaFlexDirection.java
<del>/**
<add>/*
<ide> * Copyright (c) 2014-present, Facebook, Inc.
<ide> * All rights reserved.
<ide> *
<ide><path>ReactAndroid/src/main/java/com/facebook/yoga/YogaJustify.java
<del>/**
<add>/*
<ide> * Copyright (c) 2014-present, Facebook, Inc.
<ide> * All rights reserved.
<ide> *
<ide><path>ReactAndroid/src/main/java/com/facebook/yoga/YogaLogLevel.java
<del>/**
<add>/*
<ide> * Copyright (c) 2014-present, Facebook, Inc.
<ide> * All rights reserved.
<ide> *
<ide><path>ReactAndroid/src/main/java/com/facebook/yoga/YogaLogger.java
<del>/**
<add>/*
<ide> * Copyright (c) 2014-present, Facebook, Inc.
<ide> * All rights reserved.
<ide> *
<ide><path>ReactAndroid/src/main/java/com/facebook/yoga/YogaMeasureFunction.java
<del>/**
<add>/*
<ide> * Copyright (c) 2014-present, Facebook, Inc.
<ide> * All rights reserved.
<ide> *
<ide><path>ReactAndroid/src/main/java/com/facebook/yoga/YogaMeasureMode.java
<del>/**
<add>/*
<ide> * Copyright (c) 2014-present, Facebook, Inc.
<ide> * All rights reserved.
<ide> *
<ide><path>ReactAndroid/src/main/java/com/facebook/yoga/YogaMeasureOutput.java
<del>/**
<add>/*
<ide> * Copyright (c) 2014-present, Facebook, Inc.
<ide> * All rights reserved.
<ide> *
<ide><path>ReactAndroid/src/main/java/com/facebook/yoga/YogaNode.java
<del>/**
<add>/*
<ide> * Copyright (c) 2014-present, Facebook, Inc.
<ide> * All rights reserved.
<ide> *
<ide><path>ReactAndroid/src/main/java/com/facebook/yoga/YogaNodeType.java
<del>/**
<add>/*
<ide> * Copyright (c) 2014-present, Facebook, Inc.
<ide> * All rights reserved.
<ide> *
<ide><path>ReactAndroid/src/main/java/com/facebook/yoga/YogaOverflow.java
<del>/**
<add>/*
<ide> * Copyright (c) 2014-present, Facebook, Inc.
<ide> * All rights reserved.
<ide> *
<ide><path>ReactAndroid/src/main/java/com/facebook/yoga/YogaPositionType.java
<del>/**
<add>/*
<ide> * Copyright (c) 2014-present, Facebook, Inc.
<ide> * All rights reserved.
<ide> *
<ide><path>ReactAndroid/src/main/java/com/facebook/yoga/YogaPrintOptions.java
<del>/**
<add>/*
<ide> * Copyright (c) 2014-present, Facebook, Inc.
<ide> * All rights reserved.
<ide> *
<ide><path>ReactAndroid/src/main/java/com/facebook/yoga/YogaUnit.java
<del>/**
<add>/*
<ide> * Copyright (c) 2014-present, Facebook, Inc.
<ide> * All rights reserved.
<ide> *
<ide><path>ReactAndroid/src/main/java/com/facebook/yoga/YogaValue.java
<del>/**
<add>/*
<ide> * Copyright (c) 2014-present, Facebook, Inc.
<ide> * All rights reserved.
<ide> *
<ide><path>ReactAndroid/src/main/java/com/facebook/yoga/YogaWrap.java
<del>/**
<add>/*
<ide> * Copyright (c) 2014-present, Facebook, Inc.
<ide> * All rights reserved.
<ide> * | 24 |
Ruby | Ruby | add more test | a9e71ca9057798880fb6885e6de9db2b2b7cac34 | <ide><path>Library/Homebrew/test/test_formula.rb
<ide> def test_revised_prefix
<ide> assert_equal HOMEBREW_CELLAR/f.name/'0.1_1', f.prefix
<ide> end
<ide>
<add> def test_any_version_installed?
<add> f = formula do
<add> url 'foo'
<add> version '1.0'
<add> end
<add> refute_predicate f, :any_version_installed?
<add> prefix = HOMEBREW_CELLAR+f.name+"0.1"
<add> prefix.mkpath
<add> FileUtils.touch (prefix+Tab::FILENAME)
<add> assert_predicate f, :any_version_installed?
<add> ensure
<add> f.rack.rmtree
<add> end
<add>
<ide> def test_installed?
<ide> f = Testball.new
<ide> f.stubs(:installed_prefix).returns(stub(:directory? => false))
<ide> def test_formula_spec_integration
<ide> assert_version_equal "HEAD", f.head.version
<ide> end
<ide>
<add> def test_formula_set_active_spec
<add> f = formula do
<add> url 'foo'
<add> version '1.0'
<add> revision 1
<add>
<add> devel do
<add> url 'foo'
<add> version '1.0beta'
<add> end
<add> end
<add> assert_equal :stable, f.active_spec_sym
<add> assert_equal f.stable, f.send(:active_spec)
<add> assert_equal "1.0_1", f.pkg_version.to_s
<add> f.set_active_spec(:devel)
<add> assert_equal :devel, f.active_spec_sym
<add> assert_equal f.devel, f.send(:active_spec)
<add> assert_equal "1.0beta_1", f.pkg_version.to_s
<add> assert_raises(FormulaSpecificationError) { f.set_active_spec(:head) }
<add> end
<add>
<ide> def test_path
<ide> name = 'foo-bar'
<ide> assert_equal Pathname.new("#{HOMEBREW_LIBRARY}/Formula/#{name}.rb"), Formulary.core_path(name) | 1 |
Ruby | Ruby | remove outdated suggestions from formula#test doc | a721d7bc8f3012deff33ec1fb1e59e5574b52540 | <ide><path>Library/Homebrew/formula.rb
<ide> def needs(*standards)
<ide> #
<ide> # The block will create, run in and delete a temporary directory.
<ide> #
<del> # We are fine if the executable does not error out, so we know linking
<del> # and building the software was OK.
<del> # <pre>system bin/"foobar", "--version"</pre>
<add> # We want tests that don't require any user input
<add> # and test the basic functionality of the application.
<add> # For example foo build-foo input.foo is a good test
<add> # and foo --version and foo --help are bad tests.
<add> # However, a bad test is better than no test at all.
<add> #
<add> # See: https://docs.brew.sh/Formula-Cookbook#add-a-test-to-the-formula
<ide> #
<ide> # <pre>(testpath/"test.file").write <<~EOS
<ide> # writing some test file, if you need to | 1 |
PHP | PHP | remove unneeded code | 33bd01ffb4048e14bfdc8cc9441ff50891cf37de | <ide><path>src/View/Helper/FormHelper.php
<ide> protected function _magicOptions(string $fieldName, array $options, bool $allowO
<ide> }
<ide> }
<ide>
<del> if ($options['type'] === 'select') {
<del> $options += ['empty' => false];
<del> }
<del>
<ide> return $options;
<ide> }
<ide> | 1 |
Javascript | Javascript | add the possibility to collect javascript actions | 71ecc3129b1b3884be4752752a76451f49948e9b | <ide><path>src/core/annotation.js
<ide> */
<ide>
<ide> import {
<add> AnnotationActionEventType,
<ide> AnnotationBorderStyleType,
<ide> AnnotationFieldFlag,
<ide> AnnotationFlag,
<ide> AnnotationReplyType,
<ide> AnnotationType,
<ide> assert,
<add> bytesToString,
<ide> escapeString,
<ide> getModificationDate,
<ide> isString,
<ide> import {
<ide> warn,
<ide> } from "../shared/util.js";
<ide> import { Catalog, FileSpec, ObjectLoader } from "./obj.js";
<del>import { Dict, isDict, isName, isRef, isStream, Name } from "./primitives.js";
<add>import {
<add> Dict,
<add> isDict,
<add> isName,
<add> isRef,
<add> isStream,
<add> Name,
<add> RefSet,
<add>} from "./primitives.js";
<ide> import { ColorSpace } from "./colorspace.js";
<ide> import { getInheritableProperty } from "./core_utils.js";
<ide> import { OperatorList } from "./operator_list.js";
<ide> class Annotation {
<ide> return null;
<ide> }
<ide>
<add> /**
<add> * Get field data for usage in JS sandbox.
<add> *
<add> * Field object is defined here:
<add> * https://www.adobe.com/content/dam/acom/en/devnet/acrobat/pdfs/js_api_reference.pdf#page=16
<add> *
<add> * @public
<add> * @memberof Annotation
<add> * @returns {Object | null}
<add> */
<add> getFieldObject() {
<add> return null;
<add> }
<add>
<ide> /**
<ide> * Reset the annotation.
<ide> *
<ide> class WidgetAnnotation extends Annotation {
<ide>
<ide> data.annotationType = AnnotationType.WIDGET;
<ide> data.fieldName = this._constructFieldName(dict);
<add> data.actions = this._collectActions(params.xref, dict);
<ide>
<ide> const fieldValue = getInheritableProperty({
<ide> dict,
<ide> class WidgetAnnotation extends Annotation {
<ide> }
<ide>
<ide> data.readOnly = this.hasFieldFlag(AnnotationFieldFlag.READONLY);
<add> data.hidden = this.hasFieldFlag(AnnotationFieldFlag.HIDDEN);
<ide>
<ide> // Hide signatures because we cannot validate them, and unset the fieldValue
<ide> // since it's (most likely) a `Dict` which is non-serializable and will thus
<ide> // cause errors when sending annotations to the main-thread (issue 10347).
<ide> if (data.fieldType === "Sig") {
<ide> data.fieldValue = null;
<ide> this.setFlags(AnnotationFlag.HIDDEN);
<add> data.hidden = true;
<ide> }
<ide> }
<ide>
<ide> class WidgetAnnotation extends Annotation {
<ide> }
<ide> return localResources || Dict.empty;
<ide> }
<add>
<add> _collectJS(entry, xref, list, parents) {
<add> if (!entry) {
<add> return;
<add> }
<add>
<add> let parent = null;
<add> if (isRef(entry)) {
<add> if (parents.has(entry)) {
<add> // If we've already found entry then we've a cycle.
<add> return;
<add> }
<add> parent = entry;
<add> parents.put(parent);
<add> entry = xref.fetch(entry);
<add> }
<add> if (Array.isArray(entry)) {
<add> for (const element of entry) {
<add> this._collectJS(element, xref, list, parents);
<add> }
<add> } else if (entry instanceof Dict) {
<add> if (isName(entry.get("S"), "JavaScript") && entry.has("JS")) {
<add> const js = entry.get("JS");
<add> let code;
<add> if (isStream(js)) {
<add> code = bytesToString(js.getBytes());
<add> } else {
<add> code = js;
<add> }
<add> code = stringToPDFString(code);
<add> if (code) {
<add> list.push(code);
<add> }
<add> }
<add> this._collectJS(entry.getRaw("Next"), xref, list, parents);
<add> }
<add>
<add> if (parent) {
<add> parents.remove(parent);
<add> }
<add> }
<add>
<add> _collectActions(xref, dict) {
<add> const actions = Object.create(null);
<add> if (dict.has("AA")) {
<add> const additionalActions = dict.get("AA");
<add> for (const key of additionalActions.getKeys()) {
<add> if (key in AnnotationActionEventType) {
<add> const actionDict = additionalActions.getRaw(key);
<add> const parents = new RefSet();
<add> const list = [];
<add> this._collectJS(actionDict, xref, list, parents);
<add> if (list.length > 0) {
<add> actions[AnnotationActionEventType[key]] = list;
<add> }
<add> }
<add> }
<add> }
<add> // Collect the Action if any (we may have one on pushbutton)
<add> if (dict.has("A")) {
<add> const actionDict = dict.get("A");
<add> const parents = new RefSet();
<add> const list = [];
<add> this._collectJS(actionDict, xref, list, parents);
<add> if (list.length > 0) {
<add> actions.Action = list;
<add> }
<add> }
<add> return actions;
<add> }
<add>
<add> getFieldObject() {
<add> if (this.data.fieldType === "Sig") {
<add> return {
<add> id: this.data.id,
<add> value: null,
<add> type: "signature",
<add> };
<add> }
<add> return null;
<add> }
<ide> }
<ide>
<ide> class TextWidgetAnnotation extends WidgetAnnotation {
<ide> class TextWidgetAnnotation extends WidgetAnnotation {
<ide>
<ide> return chunks;
<ide> }
<add>
<add> getFieldObject() {
<add> return {
<add> id: this.data.id,
<add> value: this.data.fieldValue,
<add> multiline: this.data.multiLine,
<add> password: this.hasFieldFlag(AnnotationFieldFlag.PASSWORD),
<add> charLimit: this.data.maxLen,
<add> comb: this.data.comb,
<add> editable: !this.data.readOnly,
<add> hidden: this.data.hidden,
<add> name: this.data.fieldName,
<add> rect: this.data.rect,
<add> actions: this.data.actions,
<add> type: "text",
<add> };
<add> }
<ide> }
<ide>
<ide> class ButtonWidgetAnnotation extends WidgetAnnotation {
<ide> class ButtonWidgetAnnotation extends WidgetAnnotation {
<ide> docBaseUrl: params.pdfManager.docBaseUrl,
<ide> });
<ide> }
<add>
<add> getFieldObject() {
<add> let type = "button";
<add> let value = null;
<add> if (this.data.checkBox) {
<add> type = "checkbox";
<add> value = this.data.fieldValue && this.data.fieldValue !== "Off";
<add> } else if (this.data.radioButton) {
<add> type = "radiobutton";
<add> value = this.data.fieldValue === this.data.buttonValue;
<add> }
<add> return {
<add> id: this.data.id,
<add> value,
<add> editable: !this.data.readOnly,
<add> name: this.data.fieldName,
<add> rect: this.data.rect,
<add> hidden: this.data.hidden,
<add> actions: this.data.actions,
<add> type,
<add> };
<add> }
<ide> }
<ide>
<ide> class ChoiceWidgetAnnotation extends WidgetAnnotation {
<ide> class ChoiceWidgetAnnotation extends WidgetAnnotation {
<ide> this.data.multiSelect = this.hasFieldFlag(AnnotationFieldFlag.MULTISELECT);
<ide> this._hasText = true;
<ide> }
<add>
<add> getFieldObject() {
<add> const type = this.data.combo ? "combobox" : "listbox";
<add> const value =
<add> this.data.fieldValue.length > 0 ? this.data.fieldValue[0] : null;
<add> return {
<add> id: this.data.id,
<add> value,
<add> editable: !this.data.readOnly,
<add> name: this.data.fieldName,
<add> rect: this.data.rect,
<add> multipleSelection: this.data.multiSelect,
<add> hidden: this.data.hidden,
<add> actions: this.data.actions,
<add> type,
<add> };
<add> }
<ide> }
<ide>
<ide> class TextAnnotation extends MarkupAnnotation {
<ide><path>src/core/document.js
<ide> class PDFDocument {
<ide> }
<ide>
<ide> get formInfo() {
<del> const formInfo = { hasAcroForm: false, hasXfa: false };
<add> const formInfo = { hasAcroForm: false, hasXfa: false, fields: null };
<ide> const acroForm = this.catalog.acroForm;
<ide> if (!acroForm) {
<ide> return shadow(this, "formInfo", formInfo);
<ide> class PDFDocument {
<ide> const hasOnlyDocumentSignatures =
<ide> !!(sigFlags & 0x1) && this._hasOnlyDocumentSignatures(fields);
<ide> formInfo.hasAcroForm = hasFields && !hasOnlyDocumentSignatures;
<add> if (hasFields) {
<add> formInfo.fields = fields;
<add> }
<ide> } catch (ex) {
<ide> if (ex instanceof MissingDataException) {
<ide> throw ex;
<ide> class PDFDocument {
<ide> ? this.catalog.cleanup(manuallyTriggered)
<ide> : clearPrimitiveCaches();
<ide> }
<add>
<add> _collectFieldObjects(name, fieldRef, promises) {
<add> const field = this.xref.fetchIfRef(fieldRef);
<add> if (field.has("T")) {
<add> const partName = stringToPDFString(field.get("T"));
<add> if (name === "") {
<add> name = partName;
<add> } else {
<add> name = `${name}.${partName}`;
<add> }
<add> }
<add>
<add> if (!(name in promises)) {
<add> promises.set(name, []);
<add> }
<add> promises.get(name).push(
<add> AnnotationFactory.create(
<add> this.xref,
<add> fieldRef,
<add> this.pdfManager,
<add> this._localIdFactory
<add> )
<add> .then(annotation => annotation.getFieldObject())
<add> .catch(function (reason) {
<add> warn(`_collectFieldObjects: "${reason}".`);
<add> return null;
<add> })
<add> );
<add>
<add> if (field.has("Kids")) {
<add> const kids = field.get("Kids");
<add> for (const kid of kids) {
<add> this._collectFieldObjects(name, kid, promises);
<add> }
<add> }
<add> }
<add>
<add> get fieldObjects() {
<add> const formInfo = this.formInfo;
<add> if (!formInfo.fields) {
<add> return shadow(this, "fieldObjects", Promise.resolve(null));
<add> }
<add>
<add> const allFields = Object.create(null);
<add> const fieldPromises = new Map();
<add> for (const fieldRef of formInfo.fields) {
<add> this._collectFieldObjects("", fieldRef, fieldPromises);
<add> }
<add>
<add> const allPromises = [];
<add> for (const [name, promises] of fieldPromises.entries()) {
<add> allPromises.push(
<add> Promise.all(promises).then(fields => {
<add> fields = fields.filter(field => field !== null);
<add> if (fields.length > 0) {
<add> allFields[name] = fields;
<add> }
<add> })
<add> );
<add> }
<add>
<add> return shadow(
<add> this,
<add> "fieldObjects",
<add> Promise.all(allPromises).then(() => allFields)
<add> );
<add> }
<ide> }
<ide>
<ide> export { Page, PDFDocument };
<ide><path>src/core/worker.js
<ide> class WorkerMessageHandler {
<ide> });
<ide> });
<ide>
<add> handler.on("GetFieldObjects", function (data) {
<add> return pdfManager.ensureDoc("fieldObjects");
<add> });
<add>
<ide> handler.on("SaveDocument", function ({
<ide> numPages,
<ide> annotationStorage,
<ide><path>src/display/api.js
<ide> class PDFDocumentProxy {
<ide> saveDocument(annotationStorage) {
<ide> return this._transport.saveDocument(annotationStorage);
<ide> }
<add>
<add> /**
<add> * @returns {Promise<Array<Object>>} A promise that is resolved with an
<add> * {Array<Object>} containing field data for the JS sandbox.
<add> */
<add> getFieldObjects() {
<add> return this._transport.getFieldObjects();
<add> }
<ide> }
<ide>
<ide> /**
<ide> class WorkerTransport {
<ide> });
<ide> }
<ide>
<add> getFieldObjects() {
<add> return this.messageHandler.sendWithPromise("GetFieldObjects", null);
<add> }
<add>
<ide> getDestinations() {
<ide> return this.messageHandler.sendWithPromise("GetDestinations", null);
<ide> }
<ide><path>src/shared/util.js
<ide> const AnnotationBorderStyleType = {
<ide> UNDERLINE: 5,
<ide> };
<ide>
<add>const AnnotationActionEventType = {
<add> E: "MouseEnter",
<add> X: "MouseExit",
<add> D: "MouseDown",
<add> U: "MouseUp",
<add> Fo: "Focus",
<add> Bl: "Blur",
<add> PO: "PageOpen",
<add> PC: "PageClose",
<add> PV: "PageVisible",
<add> PI: "PageInvisible",
<add> K: "Keystroke",
<add> F: "Format",
<add> V: "Validate",
<add> C: "Calculate",
<add> WC: "WillClose",
<add> WS: "WillSave",
<add> DS: "DidSave",
<add> WP: "WillPrint",
<add> DP: "DidPrint",
<add>};
<add>
<ide> const StreamType = {
<ide> UNKNOWN: "UNKNOWN",
<ide> FLATE: "FLATE",
<ide> export {
<ide> OPS,
<ide> VerbosityLevel,
<ide> UNSUPPORTED_FEATURES,
<add> AnnotationActionEventType,
<ide> AnnotationBorderStyleType,
<ide> AnnotationFieldFlag,
<ide> AnnotationFlag,
<ide><path>test/unit/annotation_spec.js
<ide> describe("annotation", function () {
<ide> expect(annotation.hasFlag(AnnotationFlag.NOZOOM)).toEqual(true);
<ide> expect(annotation.hasFlag(AnnotationFlag.PRINT)).toEqual(true);
<ide> expect(annotation.hasFlag(AnnotationFlag.READONLY)).toEqual(false);
<add> expect(annotation.hasFlag(AnnotationFlag.HIDDEN)).toEqual(false);
<ide> });
<ide>
<ide> it("should be viewable and not printable by default", function () {
<ide> describe("annotation", function () {
<ide> expect(data.textAlignment).toEqual(null);
<ide> expect(data.maxLen).toEqual(null);
<ide> expect(data.readOnly).toEqual(false);
<add> expect(data.hidden).toEqual(false);
<ide> expect(data.multiLine).toEqual(false);
<ide> expect(data.comb).toEqual(false);
<ide> done();
<ide> describe("annotation", function () {
<ide> expect(data.textAlignment).toEqual(null);
<ide> expect(data.maxLen).toEqual(null);
<ide> expect(data.readOnly).toEqual(false);
<add> expect(data.hidden).toEqual(false);
<ide> expect(data.multiLine).toEqual(false);
<ide> expect(data.comb).toEqual(false);
<ide> done();
<ide> describe("annotation", function () {
<ide> expect(data.textAlignment).toEqual(1);
<ide> expect(data.maxLen).toEqual(20);
<ide> expect(data.readOnly).toEqual(true);
<add> expect(data.hidden).toEqual(false);
<ide> expect(data.multiLine).toEqual(true);
<ide> done();
<ide> }, done.fail);
<ide> describe("annotation", function () {
<ide> done();
<ide> }, done.fail);
<ide> });
<add>
<add> it("should get field object for usage in JS sandbox", function (done) {
<add> const textWidgetRef = Ref.get(123, 0);
<add> const xDictRef = Ref.get(141, 0);
<add> const dDictRef = Ref.get(262, 0);
<add> const next0Ref = Ref.get(314, 0);
<add> const next1Ref = Ref.get(271, 0);
<add> const next2Ref = Ref.get(577, 0);
<add> const next00Ref = Ref.get(413, 0);
<add> const xDict = new Dict();
<add> const dDict = new Dict();
<add> const next0Dict = new Dict();
<add> const next1Dict = new Dict();
<add> const next2Dict = new Dict();
<add> const next00Dict = new Dict();
<add>
<add> const xref = new XRefMock([
<add> { ref: textWidgetRef, data: textWidgetDict },
<add> { ref: xDictRef, data: xDict },
<add> { ref: dDictRef, data: dDict },
<add> { ref: next0Ref, data: next0Dict },
<add> { ref: next00Ref, data: next00Dict },
<add> { ref: next1Ref, data: next1Dict },
<add> { ref: next2Ref, data: next2Dict },
<add> ]);
<add>
<add> const JS = Name.get("JavaScript");
<add> const additionalActionsDict = new Dict();
<add> const eDict = new Dict();
<add> eDict.set("JS", "hello()");
<add> eDict.set("S", JS);
<add> additionalActionsDict.set("E", eDict);
<add>
<add> // Test the cycle detection here
<add> xDict.set("JS", "world()");
<add> xDict.set("S", JS);
<add> xDict.set("Next", [next0Ref, next1Ref, next2Ref, xDictRef]);
<add>
<add> next0Dict.set("JS", "olleh()");
<add> next0Dict.set("S", JS);
<add> next0Dict.set("Next", next00Ref);
<add>
<add> next00Dict.set("JS", "foo()");
<add> next00Dict.set("S", JS);
<add> next00Dict.set("Next", next0Ref);
<add>
<add> next1Dict.set("JS", "dlrow()");
<add> next1Dict.set("S", JS);
<add> next1Dict.set("Next", xDictRef);
<add>
<add> next2Dict.set("JS", "oof()");
<add> next2Dict.set("S", JS);
<add>
<add> dDict.set("JS", "bar()");
<add> dDict.set("S", JS);
<add> dDict.set("Next", dDictRef);
<add> additionalActionsDict.set("D", dDictRef);
<add>
<add> additionalActionsDict.set("X", xDictRef);
<add> textWidgetDict.set("AA", additionalActionsDict);
<add>
<add> partialEvaluator.xref = xref;
<add>
<add> AnnotationFactory.create(
<add> xref,
<add> textWidgetRef,
<add> pdfManagerMock,
<add> idFactoryMock
<add> )
<add> .then(annotation => {
<add> return annotation.getFieldObject();
<add> })
<add> .then(object => {
<add> const actions = object.actions;
<add> expect(actions.MouseEnter).toEqual(["hello()"]);
<add> expect(actions.MouseExit).toEqual([
<add> "world()",
<add> "olleh()",
<add> "foo()",
<add> "dlrow()",
<add> "oof()",
<add> ]);
<add> expect(actions.MouseDown).toEqual(["bar()"]);
<add> done();
<add> }, done.fail);
<add> });
<ide> });
<ide>
<ide> describe("ButtonWidgetAnnotation", function () {
<ide> describe("annotation", function () {
<ide> it("should handle push buttons", function (done) {
<ide> const buttonWidgetRef = Ref.get(124, 0);
<ide> buttonWidgetDict.set("Ff", AnnotationFieldFlag.PUSHBUTTON);
<del> buttonWidgetDict.set("A", "whatever");
<add>
<add> const actionDict = new Dict();
<add> actionDict.set("S", Name.get("JavaScript"));
<add> actionDict.set("JS", "do_something();");
<add> buttonWidgetDict.set("A", actionDict);
<ide>
<ide> const xref = new XRefMock([
<ide> { ref: buttonWidgetRef, data: buttonWidgetDict },
<ide> describe("annotation", function () {
<ide> ).then(({ data }) => {
<ide> expect(data.annotationType).toEqual(AnnotationType.WIDGET);
<ide> expect(data.pushButton).toEqual(true);
<add> expect(data.actions.Action).toEqual(["do_something();"]);
<ide> done();
<ide> }, done.fail);
<ide> });
<ide> describe("annotation", function () {
<ide> ).then(({ data }) => {
<ide> expect(data.annotationType).toEqual(AnnotationType.WIDGET);
<ide> expect(data.readOnly).toEqual(false);
<add> expect(data.hidden).toEqual(false);
<ide> expect(data.combo).toEqual(false);
<ide> expect(data.multiSelect).toEqual(false);
<ide> done();
<ide> describe("annotation", function () {
<ide> ).then(({ data }) => {
<ide> expect(data.annotationType).toEqual(AnnotationType.WIDGET);
<ide> expect(data.readOnly).toEqual(false);
<add> expect(data.hidden).toEqual(false);
<ide> expect(data.combo).toEqual(false);
<ide> expect(data.multiSelect).toEqual(false);
<ide> done();
<ide> describe("annotation", function () {
<ide> ).then(({ data }) => {
<ide> expect(data.annotationType).toEqual(AnnotationType.WIDGET);
<ide> expect(data.readOnly).toEqual(true);
<add> expect(data.hidden).toEqual(false);
<ide> expect(data.combo).toEqual(true);
<ide> expect(data.multiSelect).toEqual(true);
<ide> done();
<ide><path>test/unit/document_spec.js
<ide> describe("document", function () {
<ide> expect(pdfDocument.formInfo).toEqual({
<ide> hasAcroForm: false,
<ide> hasXfa: false,
<add> fields: null,
<ide> });
<ide> });
<ide>
<ide> describe("document", function () {
<ide> expect(pdfDocument.formInfo).toEqual({
<ide> hasAcroForm: false,
<ide> hasXfa: false,
<add> fields: null,
<ide> });
<ide>
<ide> acroForm.set("XFA", ["foo", "bar"]);
<ide> pdfDocument = getDocument(acroForm);
<ide> expect(pdfDocument.formInfo).toEqual({
<ide> hasAcroForm: false,
<ide> hasXfa: true,
<add> fields: null,
<ide> });
<ide>
<ide> acroForm.set("XFA", new StringStream(""));
<ide> pdfDocument = getDocument(acroForm);
<ide> expect(pdfDocument.formInfo).toEqual({
<ide> hasAcroForm: false,
<ide> hasXfa: false,
<add> fields: null,
<ide> });
<ide>
<ide> acroForm.set("XFA", new StringStream("non-empty"));
<ide> pdfDocument = getDocument(acroForm);
<ide> expect(pdfDocument.formInfo).toEqual({
<ide> hasAcroForm: false,
<ide> hasXfa: true,
<add> fields: null,
<ide> });
<ide> });
<ide>
<ide> describe("document", function () {
<ide> expect(pdfDocument.formInfo).toEqual({
<ide> hasAcroForm: false,
<ide> hasXfa: false,
<add> fields: null,
<ide> });
<ide>
<ide> acroForm.set("Fields", ["foo", "bar"]);
<ide> pdfDocument = getDocument(acroForm);
<ide> expect(pdfDocument.formInfo).toEqual({
<ide> hasAcroForm: true,
<ide> hasXfa: false,
<add> fields: ["foo", "bar"],
<ide> });
<ide>
<ide> // If the first bit of the `SigFlags` entry is set and the `Fields` array
<ide> describe("document", function () {
<ide> expect(pdfDocument.formInfo).toEqual({
<ide> hasAcroForm: true,
<ide> hasXfa: false,
<add> fields: ["foo", "bar"],
<ide> });
<ide>
<ide> const annotationDict = new Dict();
<ide> describe("document", function () {
<ide> expect(pdfDocument.formInfo).toEqual({
<ide> hasAcroForm: false,
<ide> hasXfa: false,
<add> fields: null,
<ide> });
<ide> });
<ide> }); | 7 |
Text | Text | add release notes for 1.8.1 | bb480064b98f8a725a546257b778b7c7569a7819 | <ide><path>CHANGELOG.md
<add><a name="1.8.1"></a>
<add># 1.8.1 mutually-supporting (2020-09-30)
<add>
<add>## Bug Fixes
<add>- **$sanitize:** do not trigger CSP alert/report in Firefox and Chrome
<add> ([2fab3d](https://github.com/angular/angular.js/commit/2fab3d4e00f4fe35bfa3cf255160cb97404baf24))
<add>
<add>## Refactorings
<add>
<add>- **SanitizeUriProvider:** remove usages of whitelist
<add> ([76738102](https:github.com/angular/angular.js/commit/767381020d88bda2855ac87ca6f00748907e14ff))
<add>- **httpProvider:** remove usages of whitelist and blacklist
<add> ([c953af6b](https:github.com/angular/angular.js/commit/c953af6b8cfeefe4acc0ca358550eed5da8cfe00))
<add>- **sceDelegateProvider:** remove usages of whitelist and blacklist
<add> ([a206e267](https:github.com/angular/angular.js/commit/a206e2675c351c3cdcde3402978126774c1c5df9))
<add>
<add>## Deprecation Notices
<add>
<add>- Deprecated ~~`aHrefSanitizationWhitelist`~~. It is now `aHrefSanitizationTrustedUri`
<add>- Deprecated ~~`imgSrcSanitizationWhitelist`~~. It is now `imgSrcSanitizationTrustedUri`
<add>- Deprecated ~~`xsrfWhitelistedOrigins`~~. It is now `xsrfTrustedOrigins`
<add>- Deprecated ~~`resourceUrlWhitelist`~~. It is now `trustedResourceUrlList`
<add>- Deprecated ~~`resourceUrlBlacklist`~~. It is now `bannedResourceUrlList`
<add>
<add>For the purposes of backward compatibility, the previous symbols are aliased to their new symbol.
<add>
<ide>
<ide> <a name="1.8.0"></a>
<ide> # 1.8.0 nested-vaccination (2020-06-01) | 1 |
PHP | PHP | pass status code to schedule finish | b815dc6c1b1c595f3241c493255f0fbfd67a6131 | <ide><path>src/Illuminate/Console/Scheduling/CommandBuilder.php
<ide> protected function buildBackgroundCommand(Event $event)
<ide> $finished = Application::formatCommandString('schedule:finish').' "'.$event->mutexName().'"';
<ide>
<ide> if (windows_os()) {
<del> return 'start /b cmd /c "('.$event->command.' & '.$finished.')'.$redirect.$output.' 2>&1"';
<add> return 'start /b cmd /c "('.$event->command.' & '.$finished.' "%errorlevel%")'.$redirect.$output.' 2>&1"';
<ide> }
<ide>
<ide> return $this->ensureCorrectUser($event,
<del> '('.$event->command.$redirect.$output.' 2>&1 ; '.$finished.') > '
<add> '('.$event->command.$redirect.$output.' 2>&1 ; '.$finished.' "$?") > '
<ide> .ProcessUtils::escapeArgument($event->getDefaultOutput()).' 2>&1 &'
<ide> );
<ide> }
<ide><path>src/Illuminate/Console/Scheduling/Event.php
<ide> public function callAfterCallbacks(Container $container)
<ide> }
<ide> }
<ide>
<add> /**
<add> * Call all of the "after" callbacks for the event.
<add> *
<add> * @param \Illuminate\Contracts\Container\Container $container
<add> * @param int $exitCode
<add> * @return void
<add> */
<add> public function callAfterCallbacksWithExitCode(Container $container, $exitCode)
<add> {
<add> $this->exitCode = (int) $exitCode;
<add>
<add> $this->callAfterCallbacks($container);
<add> }
<add>
<ide> /**
<ide> * Build the command string.
<ide> *
<ide><path>src/Illuminate/Console/Scheduling/ScheduleFinishCommand.php
<ide> class ScheduleFinishCommand extends Command
<ide> *
<ide> * @var string
<ide> */
<del> protected $signature = 'schedule:finish {id}';
<add> protected $signature = 'schedule:finish {id} {code=0}';
<ide>
<ide> /**
<ide> * The console command description.
<ide> public function handle(Schedule $schedule)
<ide> {
<ide> collect($schedule->events())->filter(function ($value) {
<ide> return $value->mutexName() == $this->argument('id');
<del> })->each->callAfterCallbacks($this->laravel);
<add> })->each->callAfterCallbacksWithExitCode($this->laravel, $this->argument('code'));
<ide> }
<ide> }
<ide><path>tests/Console/Scheduling/EventTest.php
<ide> public function testBuildCommand()
<ide>
<ide> $commandSeparator = ($isWindows ? '&' : ';');
<ide> $scheduleId = '"framework'.DIRECTORY_SEPARATOR.'schedule-eeb46c93d45e928d62aaf684d727e213b7094822"';
<del> $this->assertSame("(php -i > {$quote}{$defaultOutput}{$quote} 2>&1 {$commandSeparator} {$quote}".PHP_BINARY."{$quote} artisan schedule:finish {$scheduleId}) > {$quote}{$defaultOutput}{$quote} 2>&1 &", $event->buildCommand());
<add> $this->assertSame("(php -i > {$quote}{$defaultOutput}{$quote} 2>&1 {$commandSeparator} {$quote}".PHP_BINARY."{$quote} artisan schedule:finish {$scheduleId} \"$?\") > {$quote}{$defaultOutput}{$quote} 2>&1 &", $event->buildCommand());
<ide> }
<ide>
<ide> public function testBuildCommandSendOutputTo() | 4 |
Python | Python | avoid celery crashing for channel errors | fb4a3dd10bd490d7cffa22efb69d6fe5185c9b4d | <ide><path>celery/tests/test_worker/__init__.py
<ide> def consume_messages(self):
<ide> l.heart.stop()
<ide> l.priority_timer.stop()
<ide>
<add> def test_start_channel_error(self):
<add> # Regression test for AMQPChannelExceptions that can occur within the consumer. (i.e. 404 errors)
<add>
<add> class MockConsumer(MainConsumer):
<add> iterations = 0
<add>
<add> def consume_messages(self):
<add> if not self.iterations:
<add> self.iterations = 1
<add> raise KeyError("foo")
<add> raise SyntaxError("bar")
<add>
<add> l = MockConsumer(self.ready_queue, self.eta_schedule, self.logger,
<add> send_events=False, pool=BasePool())
<add>
<add> l.channel_errors = (KeyError, )
<add> self.assertRaises(SyntaxError, l.start)
<add> l.heart.stop()
<add> l.priority_timer.stop()
<add>
<ide> def test_consume_messages_ignores_socket_timeout(self):
<ide>
<ide> class Connection(current_app.broker_connection().__class__):
<ide><path>celery/worker/consumer.py
<ide> def start(self):
<ide> try:
<ide> self.reset_connection()
<ide> self.consume_messages()
<del> except self.connection_errors:
<add> except self.connection_errors + self.channel_errors:
<ide> self.logger.error("Consumer: Connection to broker lost."
<ide> + " Trying to re-establish the connection...",
<ide> exc_info=sys.exc_info()) | 2 |
PHP | PHP | add notification facade | e6cc60349df90190c5c5597e0980bb7f636a3866 | <ide><path>config/app.php
<ide> 'Lang' => Illuminate\Support\Facades\Lang::class,
<ide> 'Log' => Illuminate\Support\Facades\Log::class,
<ide> 'Mail' => Illuminate\Support\Facades\Mail::class,
<add> 'Notification' => Illuminate\Support\Facades\Notification::class,
<ide> 'Password' => Illuminate\Support\Facades\Password::class,
<ide> 'Queue' => Illuminate\Support\Facades\Queue::class,
<ide> 'Redirect' => Illuminate\Support\Facades\Redirect::class, | 1 |
Javascript | Javascript | add some docs for $cancelupdate | 66a132847dcad00a661836ebc84c99d4d2f45312 | <ide><path>src/ng/directive/input.js
<ide> var ngValueDirective = function() {
<ide> * events that will trigger a model update and/or a debouncing delay so that the actual update only
<ide> * takes place when a timer expires; this timer will be reset after another change takes place.
<ide> *
<add> * Given the nature of `ngModelOptions`, the value displayed inside input fields in the view might
<add> * be different then the value in the actual model. This means that if you update the model you
<add> * should also invoke `$cancelUpdate` on the relevant input field in order to make sure it is
<add> * synchronized with the model and that any debounced action is canceled.
<add> *
<add> * The easiest way to reference the control's `$cancelUpdate` method is by making sure the input
<add> * is placed inside a form that has a `name` attribute. This is important because form controllers
<add> * are published to the related scope under the name in their `name` attribute.
<add> *
<ide> * @param {Object} ngModelOptions options to apply to the current model. Valid keys are:
<ide> * - `updateOn`: string specifying which event should be the input bound to. You can set several
<ide> * events using an space delimited list. There is a special event called `default` that
<ide> var ngValueDirective = function() {
<ide> * @example
<ide>
<ide> The following example shows how to override immediate updates. Changes on the inputs within the
<del> form will update the model only when the control loses focus (blur event).
<add> form will update the model only when the control loses focus (blur event). If `escape` key is
<add> pressed while the input field is focused, the value is reset to the value in the current model.
<ide>
<ide> <example name="ngModelOptions-directive-blur">
<ide> <file name="index.html">
<ide> <div ng-controller="Ctrl">
<del> Name:
<del> <input type="text"
<del> ng-model="user.name"
<del> ng-model-options="{ updateOn: 'blur' }" /><br />
<del>
<del> Other data:
<del> <input type="text" ng-model="user.data" /><br />
<del>
<add> <form name="userForm">
<add> Name:
<add> <input type="text" name="userName"
<add> ng-model="user.name"
<add> ng-model-options="{ updateOn: 'blur' }"
<add> ng-keyup="cancel($event)" /><br />
<add>
<add> Other data:
<add> <input type="text" ng-model="user.data" /><br />
<add> </form>
<ide> <pre>user.name = <span ng-bind="user.name"></span></pre>
<ide> </div>
<ide> </file>
<ide> <file name="app.js">
<ide> function Ctrl($scope) {
<del> $scope.user = { name: 'say', data: '' };
<add> $scope.user = { name: 'say', data: '' };
<add>
<add> $scope.cancel = function (e) {
<add> if (e.keyCode == 27) {
<add> $scope.userForm.userName.$cancelUpdate();
<add> }
<add> };
<ide> }
<ide> </file>
<ide> <file name="protractor.js" type="protractor">
<ide> var model = element(by.binding('user.name'));
<ide> var input = element(by.model('user.name'));
<ide> var other = element(by.model('user.data'));
<add>
<ide> it('should allow custom events', function() {
<ide> input.sendKeys(' hello');
<ide> expect(model.getText()).toEqual('say');
<ide> other.click();
<ide> expect(model.getText()).toEqual('say hello');
<ide> });
<add>
<add> it('should $cancelUpdate when model changes', function() {
<add> input.sendKeys(' hello');
<add> expect(input.getAttribute('value')).toEqual('say hello');
<add> input.sendKeys(protractor.Key.ESCAPE);
<add> expect(input.getAttribute('value')).toEqual('say');
<add> other.click();
<add> expect(model.getText()).toEqual('say');
<add> });
<ide> </file>
<ide> </example>
<ide>
<del> This one shows how to debounce model changes. Model will be updated only 500 milliseconds after last change.
<add> This one shows how to debounce model changes. Model will be updated only 1 sec after last change.
<add> If the `Clear` button is pressed, any debounced action is canceled and the value becomes empty.
<ide>
<ide> <example name="ngModelOptions-directive-debounce">
<ide> <file name="index.html">
<ide> <div ng-controller="Ctrl">
<del> Name:
<del> <input type="text"
<del> ng-model="user.name"
<del> ng-model-options="{ debounce: 500 }" /><br />
<add> <form name="userForm">
<add> Name:
<add> <input type="text" name="userName"
<add> ng-model="user.name"
<add> ng-model-options="{ debounce: 1000 }" />
<add> <button ng-click="userForm.userName.$cancelUpdate(); user.name=''">Clear</button><br />
<add> </form>
<ide> <pre>user.name = <span ng-bind="user.name"></span></pre>
<ide> </div>
<ide> </file> | 1 |
Text | Text | update the bibtex with emnlp demo | 94caaa93c2988bf219cb7fc88991be2d92350c48 | <ide><path>README.md
<ide> These implementations have been tested on several datasets (see the example scri
<ide>
<ide> ## Citation
<ide>
<del>We now have a [paper](https://arxiv.org/abs/1910.03771) you can cite for the 🤗 Transformers library:
<add>We now have a [paper](https://www.aclweb.org/anthology/2020.emnlp-demos.6/) you can cite for the 🤗 Transformers library:
<ide> ```bibtex
<del>@article{Wolf2019HuggingFacesTS,
<del> title={HuggingFace's Transformers: State-of-the-art Natural Language Processing},
<del> author={Thomas Wolf and Lysandre Debut and Victor Sanh and Julien Chaumond and Clement Delangue and Anthony Moi and Pierric Cistac and Tim Rault and Rémi Louf and Morgan Funtowicz and Joe Davison and Sam Shleifer and Patrick von Platen and Clara Ma and Yacine Jernite and Julien Plu and Canwen Xu and Teven Le Scao and Sylvain Gugger and Mariama Drame and Quentin Lhoest and Alexander M. Rush},
<del> journal={ArXiv},
<del> year={2019},
<del> volume={abs/1910.03771}
<add>@inproceedings{wolf-etal-2020-transformers,
<add> title = "Transformers: State-of-the-Art Natural Language Processing",
<add> author = "Thomas Wolf and Lysandre Debut and Victor Sanh and Julien Chaumond and Clement Delangue and Anthony Moi and Pierric Cistac and Tim Rault and Rémi Louf and Morgan Funtowicz and Joe Davison and Sam Shleifer and Patrick von Platen and Clara Ma and Yacine Jernite and Julien Plu and Canwen Xu and Teven Le Scao and Sylvain Gugger and Mariama Drame and Quentin Lhoest and Alexander M. Rush",
<add> booktitle = "Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing: System Demonstrations",
<add> month = oct,
<add> year = "2020",
<add> address = "Online",
<add> publisher = "Association for Computational Linguistics",
<add> url = "https://www.aclweb.org/anthology/2020.emnlp-demos.6",
<add> pages = "38--45"
<ide> }
<ide> ``` | 1 |
Java | Java | use destinationusernameprovider with @sendto | ae06c3a6ab36785aa3fc69aa1672e3a7d621e4a0 | <ide><path>spring-messaging/src/main/java/org/springframework/messaging/simp/annotation/support/SendToMethodReturnValueHandler.java
<ide> /*
<del> * Copyright 2002-2013 the original author or authors.
<add> * Copyright 2002-2014 the original author or authors.
<ide> *
<ide> * Licensed under the Apache License, Version 2.0 (the "License");
<ide> * you may not use this file except in compliance with the License.
<ide> package org.springframework.messaging.simp.annotation.support;
<ide>
<ide> import java.lang.annotation.Annotation;
<add>import java.security.Principal;
<ide>
<ide> import org.springframework.core.MethodParameter;
<ide> import org.springframework.core.annotation.AnnotationUtils;
<ide> import org.springframework.messaging.simp.SimpMessageHeaderAccessor;
<ide> import org.springframework.messaging.simp.SimpMessageSendingOperations;
<ide> import org.springframework.messaging.simp.annotation.SendToUser;
<add>import org.springframework.messaging.simp.user.DestinationUserNameProvider;
<ide> import org.springframework.messaging.support.MessageBuilder;
<ide> import org.springframework.util.Assert;
<ide> import org.springframework.util.ObjectUtils;
<ide> public void handleReturnValue(Object returnValue, MethodParameter returnType, Me
<ide>
<ide> SendToUser sendToUser = returnType.getMethodAnnotation(SendToUser.class);
<ide> if (sendToUser != null) {
<del> if (inputHeaders.getUser() == null) {
<add> Principal principal = inputHeaders.getUser();
<add> if (principal == null) {
<ide> throw new MissingSessionUserException(inputMessage);
<ide> }
<del> String user = inputHeaders.getUser().getName();
<add> String userName = principal.getName();
<add> if (principal instanceof DestinationUserNameProvider) {
<add> userName = ((DestinationUserNameProvider) principal).getDestinationUserName();
<add> }
<ide> String[] destinations = getTargetDestinations(sendToUser, inputHeaders, this.defaultUserDestinationPrefix);
<ide> for (String destination : destinations) {
<del> this.messagingTemplate.convertAndSendToUser(user, destination, returnValue, postProcessor);
<add> this.messagingTemplate.convertAndSendToUser(userName, destination, returnValue, postProcessor);
<ide> }
<ide> return;
<ide> }
<ide><path>spring-messaging/src/test/java/org/springframework/messaging/simp/annotation/support/SendToMethodReturnValueHandlerTests.java
<ide> /*
<del> * Copyright 2002-2013 the original author or authors.
<add> * Copyright 2002-2014 the original author or authors.
<ide> *
<ide> * Licensed under the Apache License, Version 2.0 (the "License");
<ide> * you may not use this file except in compliance with the License.
<ide> import org.springframework.messaging.handler.annotation.SendTo;
<ide> import org.springframework.messaging.simp.SimpMessageHeaderAccessor;
<ide> import org.springframework.messaging.simp.SimpMessagingTemplate;
<add>import org.springframework.messaging.simp.TestPrincipal;
<ide> import org.springframework.messaging.simp.annotation.SendToUser;
<add>import org.springframework.messaging.simp.user.DestinationUserNameProvider;
<ide> import org.springframework.messaging.support.MessageBuilder;
<ide> import org.springframework.messaging.converter.MessageConverter;
<ide>
<ide> public void sendToNoAnnotations() throws Exception {
<ide> }
<ide>
<ide> @Test
<del> public void sendToMethod() throws Exception {
<add> public void sendTo() throws Exception {
<ide>
<ide> when(this.messageChannel.send(any(Message.class))).thenReturn(true);
<ide>
<ide> public void sendToMethod() throws Exception {
<ide> }
<ide>
<ide> @Test
<del> public void sendToDefaultDestinationMethod() throws Exception {
<add> public void sendToDefaultDestination() throws Exception {
<ide>
<ide> when(this.messageChannel.send(any(Message.class))).thenReturn(true);
<ide>
<ide> public void sendToDefaultDestinationMethod() throws Exception {
<ide> }
<ide>
<ide> @Test
<del> public void sendToUserMethod() throws Exception {
<add> public void sendToUser() throws Exception {
<ide>
<ide> when(this.messageChannel.send(any(Message.class))).thenReturn(true);
<ide>
<ide> public void sendToUserMethod() throws Exception {
<ide> }
<ide>
<ide> @Test
<del> public void sendToUserDefaultDestinationMethod() throws Exception {
<add> public void sendToUserWithUserNameProvider() throws Exception {
<add>
<add> when(this.messageChannel.send(any(Message.class))).thenReturn(true);
<add>
<add> String sessionId = "sess1";
<add> TestUser user = new UniqueUser();
<add> Message<?> inputMessage = createInputMessage(sessionId, "sub1", null, user);
<add> this.handler.handleReturnValue(payloadContent, this.sendToUserReturnType, inputMessage);
<add>
<add> verify(this.messageChannel, times(2)).send(this.messageCaptor.capture());
<add>
<add> SimpMessageHeaderAccessor headers = SimpMessageHeaderAccessor.wrap(this.messageCaptor.getAllValues().get(0));
<add> assertEquals("/user/Me myself and I/dest1", headers.getDestination());
<add>
<add> headers = SimpMessageHeaderAccessor.wrap(this.messageCaptor.getAllValues().get(1));
<add> assertEquals("/user/Me myself and I/dest2", headers.getDestination());
<add> }
<add>
<add> @Test
<add> public void sendToUserDefaultDestination() throws Exception {
<ide>
<ide> when(this.messageChannel.send(any(Message.class))).thenReturn(true);
<ide>
<ide> public boolean implies(Subject subject) {
<ide> }
<ide> }
<ide>
<add> private static class UniqueUser extends TestUser implements DestinationUserNameProvider {
<add>
<add> @Override
<add> public String getDestinationUserName() {
<add> return "Me myself and I";
<add> }
<add> }
<add>
<ide> public String handleNoAnnotations() {
<ide> return payloadContent;
<ide> }
<ide><path>spring-websocket/src/main/java/org/springframework/web/socket/messaging/StompSubProtocolHandler.java
<ide> private void afterStompSessionConnected(StompHeaderAccessor headers, WebSocketSe
<ide> if (principal != null) {
<ide> headers.setNativeHeader(CONNECTED_USER_HEADER, principal.getName());
<ide> if (this.userSessionRegistry != null) {
<del> String userName = getNameForUserSessionRegistry(principal);
<add> String userName = resolveNameForUserSessionRegistry(principal);
<ide> this.userSessionRegistry.registerSessionId(userName, session.getId());
<ide> }
<ide> }
<ide> }
<ide>
<del> private String getNameForUserSessionRegistry(Principal principal) {
<add> private String resolveNameForUserSessionRegistry(Principal principal) {
<ide> String userName = principal.getName();
<ide> if (principal instanceof DestinationUserNameProvider) {
<ide> userName = ((DestinationUserNameProvider) principal).getDestinationUserName();
<ide> public void afterSessionEnded(WebSocketSession session, CloseStatus closeStatus,
<ide>
<ide> Principal principal = session.getPrincipal();
<ide> if ((this.userSessionRegistry != null) && (principal != null)) {
<del> String userName = getNameForUserSessionRegistry(principal);
<add> String userName = resolveNameForUserSessionRegistry(principal);
<ide> this.userSessionRegistry.unregisterSessionId(userName, session.getId());
<ide> }
<ide> | 3 |
Javascript | Javascript | autofix imports when running replace-fork | 453df3ff72dae3ebd1e1dcd6f965c4f251b0553c | <ide><path>scripts/merge-fork/replace-fork.js
<ide>
<ide> const {promisify} = require('util');
<ide> const glob = promisify(require('glob'));
<add>const {spawnSync} = require('child_process');
<ide> const fs = require('fs');
<ide>
<ide> const stat = promisify(fs.stat);
<ide> const copyFile = promisify(fs.copyFile);
<ide> async function main() {
<ide> const oldFilenames = await glob('packages/react-reconciler/**/*.old.js');
<ide> await Promise.all(oldFilenames.map(unforkFile));
<add>
<add> // Use ESLint to autofix imports
<add> spawnSync('yarn', ['linc', '--fix']);
<ide> }
<ide>
<ide> async function unforkFile(oldFilename) { | 1 |
Ruby | Ruby | remove unused private classes | 3297909cdc4fb114df96b0e74ff5d55c210650cf | <ide><path>railties/lib/rails/test_unit/sub_test_task.rb
<del>require 'rake/testtask'
<del>
<del>module Rails
<del> class TestTask < Rake::TestTask # :nodoc: all
<del> # A utility class which is used primarily in "rails/test_unit/testing.rake"
<del> # to help define rake tasks corresponding to <tt>rake test</tt>.
<del> #
<del> # This class takes a TestInfo class and defines the appropriate rake task
<del> # based on the information, then invokes it.
<del> class TestCreator # :nodoc:
<del> def initialize(info)
<del> @info = info
<del> end
<del>
<del> def invoke_rake_task
<del> if @info.files.any?
<del> create_and_run_single_test
<del> reset_application_tasks
<del> else
<del> Rake::Task[ENV['TEST'] ? 'test:single' : 'test:run'].invoke
<del> end
<del> end
<del>
<del> private
<del>
<del> def create_and_run_single_test
<del> Rails::TestTask.new('test:single') { |t|
<del> t.test_files = @info.files
<del> }
<del> ENV['TESTOPTS'] ||= @info.opts
<del> Rake::Task['test:single'].invoke
<del> end
<del>
<del> def reset_application_tasks
<del> Rake.application.top_level_tasks.replace @info.tasks
<del> end
<del> end
<del>
<del> # This is a utility class used by the <tt>TestTask::TestCreator</tt> class.
<del> # This class takes a set of test tasks and checks to see if they correspond
<del> # to test files (or can be transformed into test files). Calling <tt>files</tt>
<del> # provides the set of test files and is used when initializing tests after
<del> # a call to <tt>rake test</tt>.
<del> class TestInfo # :nodoc:
<del> def initialize(tasks)
<del> @tasks = tasks
<del> @files = nil
<del> end
<del>
<del> def files
<del> @files ||= @tasks.map { |task|
<del> [task, translate(task)].find { |file| test_file?(file) }
<del> }.compact
<del> end
<del>
<del> def translate(file)
<del> if file =~ /^app\/(.*)$/
<del> "test/#{$1.sub(/\.rb$/, '')}_test.rb"
<del> else
<del> "test/#{file}_test.rb"
<del> end
<del> end
<del>
<del> def tasks
<del> @tasks - test_file_tasks - opt_names
<del> end
<del>
<del> def opts
<del> opts = opt_names
<del> if opts.any?
<del> "-n #{opts.join ' '}"
<del> end
<del> end
<del>
<del> private
<del>
<del> def test_file_tasks
<del> @tasks.find_all { |task|
<del> [task, translate(task)].any? { |file| test_file?(file) }
<del> }
<del> end
<del>
<del> def test_file?(file)
<del> file =~ /^test/ && File.file?(file) && !File.directory?(file)
<del> end
<del>
<del> def opt_names
<del> (@tasks - test_file_tasks).reject { |t| task_defined? t }
<del> end
<del>
<del> def task_defined?(task)
<del> Rake::Task.task_defined? task
<del> end
<del> end
<del>
<del> def self.test_creator(tasks)
<del> info = TestInfo.new(tasks)
<del> TestCreator.new(info)
<del> end
<del>
<del> def initialize(name = :test)
<del> super
<del> @libs << "test" # lib *and* test seem like a better default
<del> end
<del>
<del> def define
<del> task @name do
<del> if ENV['TESTOPTS']
<del> ARGV.replace Shellwords.split ENV['TESTOPTS']
<del> end
<del> libs = @libs - $LOAD_PATH
<del> $LOAD_PATH.unshift(*libs)
<del> file_list.each { |fl|
<del> FileList[fl].to_a.each { |f| require File.expand_path f }
<del> }
<del> end
<del> end
<del> end
<del>
<del> # Silence the default description to cut down on `rake -T` noise.
<del> class SubTestTask < Rake::TestTask # :nodoc:
<del> def desc(string)
<del> # Ignore the description.
<del> end
<del> end
<del>end
<ide><path>railties/test/test_info_test.rb
<del>require 'abstract_unit'
<del>require 'rails/test_unit/sub_test_task'
<del>
<del>module Rails
<del> class TestInfoTest < ActiveSupport::TestCase
<del> def test_test_files
<del> info = new_test_info ['test']
<del> assert_predicate info.files, :empty?
<del> assert_nil info.opts
<del> assert_equal ['test'], info.tasks
<del> end
<del>
<del> def test_with_file
<del> info = new_test_info ['test', __FILE__]
<del> assert_equal [__FILE__], info.files
<del> assert_nil info.opts
<del> assert_equal ['test'], info.tasks
<del> end
<del>
<del> def test_with_opts
<del> info = new_test_info ['test', __FILE__, '/foo/']
<del> assert_equal [__FILE__], info.files
<del> assert_equal '-n /foo/', info.opts
<del> assert_equal ['test'], info.tasks
<del> end
<del>
<del> def test_with_model_shorthand
<del> info = new_test_info ['test', 'models/foo', '/foo/']
<del>
<del> def info.test_file?(file)
<del> file == "test/models/foo_test.rb" || super
<del> end
<del>
<del> assert_equal ['test/models/foo_test.rb'], info.files
<del> assert_equal '-n /foo/', info.opts
<del> assert_equal ['test'], info.tasks
<del> end
<del>
<del> def test_with_model_path
<del> info = new_test_info ['test', 'app/models/foo.rb', '/foo/']
<del>
<del> def info.test_file?(file)
<del> file == "test/models/foo_test.rb" || super
<del> end
<del>
<del> assert_equal ['test/models/foo_test.rb'], info.files
<del> assert_equal '-n /foo/', info.opts
<del> assert_equal ['test'], info.tasks
<del> end
<del>
<del> private
<del> def new_test_info(tasks)
<del> Class.new(TestTask::TestInfo) {
<del> def task_defined?(task)
<del> task == "test"
<del> end
<del> }.new tasks
<del> end
<del> end
<del>end | 2 |
Java | Java | improve applicationcontextinitializer sorting | 2b4328023e5e96078f8b7fd6661cb325d34c8f21 | <ide><path>org.springframework.context/src/main/java/org/springframework/context/ApplicationContextInitializer.java
<ide> * for declaring a "contextInitializerClasses" context-param and init-param, respectively.
<ide> *
<ide> * <p>{@code ApplicationContextInitializer} processors are encouraged to detect
<del> * whether Spring's {@link org.springframework.core.Ordered Ordered} or
<del> * {@link org.springframework.core.PriorityOrdered PriorityOrdered} interfaces are also
<del> * implemented and sort instances accordingly if so prior to invocation.
<add> * whether Spring's {@link org.springframework.core.Ordered Ordered} interface has been
<add> * implemented or if the @{@link org.springframework.core.annotation.Order Order}
<add> * annotation is present and to sort instances accordingly if so prior to invocation.
<ide> *
<ide> * @author Chris Beams
<ide> * @since 3.1
<ide> * @see org.springframework.web.context.ContextLoader#customizeContext
<ide> * @see org.springframework.web.context.ContextLoader#CONTEXT_INITIALIZER_CLASSES_PARAM
<ide> * @see org.springframework.web.servlet.FrameworkServlet#setContextInitializerClasses
<del> * @see org.springframework.web.servlet.FrameworkServlet#initializeWebApplicationContext
<add> * @see org.springframework.web.servlet.FrameworkServlet#applyInitializers
<ide> */
<ide> public interface ApplicationContextInitializer<C extends ConfigurableApplicationContext> {
<ide>
<ide><path>org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/FrameworkServlet.java
<ide>
<ide> import java.io.IOException;
<ide> import java.security.Principal;
<del>import java.util.TreeSet;
<add>import java.util.ArrayList;
<add>import java.util.Collections;
<ide>
<ide> import javax.servlet.ServletContext;
<ide> import javax.servlet.ServletException;
<ide> public abstract class FrameworkServlet extends HttpServletBean {
<ide> private String contextInitializerClasses;
<ide>
<ide> /** Actual ApplicationContextInitializer instances to apply to the context */
<del> private TreeSet<ApplicationContextInitializer<ConfigurableApplicationContext>> contextInitializers =
<del> new TreeSet<ApplicationContextInitializer<ConfigurableApplicationContext>>(new AnnotationAwareOrderComparator());
<add> private ArrayList<ApplicationContextInitializer<ConfigurableApplicationContext>> contextInitializers =
<add> new ArrayList<ApplicationContextInitializer<ConfigurableApplicationContext>>();
<ide>
<ide>
<ide> /**
<ide> protected void applyInitializers(ConfigurableApplicationContext wac) {
<ide> }
<ide> }
<ide>
<add> Collections.sort(this.contextInitializers, new AnnotationAwareOrderComparator());
<add>
<ide> for (ApplicationContextInitializer<ConfigurableApplicationContext> initializer : this.contextInitializers) {
<ide> initializer.initialize(wac);
<ide> }
<ide><path>org.springframework.web/src/main/java/org/springframework/web/context/ContextLoader.java
<ide>
<ide> import java.io.IOException;
<ide> import java.util.ArrayList;
<add>import java.util.Collections;
<ide> import java.util.List;
<ide> import java.util.Map;
<ide> import java.util.Properties;
<ide> import org.springframework.context.ConfigurableApplicationContext;
<ide> import org.springframework.context.access.ContextSingletonBeanFactoryLocator;
<ide> import org.springframework.core.GenericTypeResolver;
<del>import org.springframework.core.OrderComparator;
<ide> import org.springframework.core.Ordered;
<add>import org.springframework.core.annotation.AnnotationAwareOrderComparator;
<ide> import org.springframework.core.io.ClassPathResource;
<ide> import org.springframework.core.io.support.PropertiesLoaderUtils;
<ide> import org.springframework.util.Assert;
<ide> protected Class<?> determineContextClass(ServletContext servletContext) {
<ide> }
<ide> catch (ClassNotFoundException ex) {
<ide> throw new ApplicationContextException(
<del> "Failed to load context configurer class [" + className + "]", ex);
<add> "Failed to load context initializer class [" + className + "]", ex);
<ide> }
<ide> }
<ide> }
<ide> protected Class<?> determineContextClass(ServletContext servletContext) {
<ide> * {@linkplain #CONTEXT_INITIALIZER_CLASSES_PARAM context init parameters} and
<ide> * {@linkplain ApplicationContextInitializer#initialize invokes each} with the
<ide> * given web application context.
<del> * <p>Any {@link Ordered} {@code ApplicationContextInitializer} will be sorted
<del> * appropriately.
<add> * <p>Any {@code ApplicationContextInitializers} implementing
<add> * {@link org.springframework.core.Ordered Ordered} or marked with @{@link
<add> * org.springframework.core.annotation.Order Order} will be sorted appropriately.
<ide> * @param servletContext the current servlet context
<ide> * @param applicationContext the newly created application context
<ide> * @see #createWebApplicationContext(ServletContext, ApplicationContext)
<ide> * @see #CONTEXT_INITIALIZER_CLASSES_PARAM
<ide> * @see ApplicationContextInitializer#initialize(ConfigurableApplicationContext)
<ide> */
<ide> protected void customizeContext(ServletContext servletContext, ConfigurableWebApplicationContext applicationContext) {
<del> List<ApplicationContextInitializer<ConfigurableApplicationContext>> initializerInstances =
<add> ArrayList<ApplicationContextInitializer<ConfigurableApplicationContext>> initializerInstances =
<ide> new ArrayList<ApplicationContextInitializer<ConfigurableApplicationContext>>();
<ide>
<ide> for (Class<ApplicationContextInitializer<ConfigurableApplicationContext>> initializerClass :
<ide> protected void customizeContext(ServletContext servletContext, ConfigurableWebAp
<ide> initializerInstances.add(BeanUtils.instantiateClass(initializerClass));
<ide> }
<ide>
<del> OrderComparator.sort(initializerInstances);
<add> Collections.sort(initializerInstances, new AnnotationAwareOrderComparator());
<ide>
<ide> for (ApplicationContextInitializer<ConfigurableApplicationContext> initializer : initializerInstances) {
<ide> initializer.initialize(applicationContext); | 3 |
Javascript | Javascript | fix floating point number parsing | 0459a230631f6ff44f63d46396c474c13e6c232c | <ide><path>lib/repl.js
<ide> function REPLServer(prompt, stream, eval_, useGlobal, ignoreUndefined) {
<ide>
<ide> // Check to see if a REPL keyword was used. If it returns true,
<ide> // display next prompt and return.
<del> if (cmd && cmd.charAt(0) === '.' && cmd != parseFloat(cmd)) {
<add> if (cmd && cmd.charAt(0) === '.' && isNaN(parseFloat(cmd))) {
<ide> var matches = cmd.match(/^(\.[^\s]+)\s*(.*)$/);
<ide> var keyword = matches && matches[1];
<ide> var rest = matches && matches[2];
<ide><path>test/simple/test-repl.js
<ide> function error_test() {
<ide> // Floating point numbers are not interpreted as REPL commands.
<ide> { client: client_unix, send: '.1234',
<ide> expect: '0.1234' },
<add> // Floating point expressions are not interpreted as REPL commands
<add> { client: client_unix, send: '.1+.1',
<add> expect: '0.2' },
<ide> // Can parse valid JSON
<ide> { client: client_unix, send: 'JSON.parse(\'{"valid": "json"}\');',
<ide> expect: '{ valid: \'json\' }'}, | 2 |
Text | Text | fix typo in 'maxheadersize' | 25ffd39f3326ddf713f21d7a6487b7f5ec9bb806 | <ide><path>doc/api/http.md
<ide> changes:
<ide> * `localPort` {number} Local port to connect from.
<ide> * `lookup` {Function} Custom lookup function. **Default:** [`dns.lookup()`][].
<ide> * `maxHeaderSize` {number} Optionally overrides the value of
<del> [`--max-http-header-size`][] for requests received from the server, i.e.
<add> [`--max-http-header-size`][] for responses received from the server, i.e.
<ide> the maximum length of response headers in bytes.
<ide> **Default:** 16384 (16 KB).
<ide> * `method` {string} A string specifying the HTTP request method. **Default:** | 1 |
Go | Go | fix typo in function declaration | d4a123b20b4f8fb1858f3cf411b3695353c0a973 | <ide><path>pkg/devicemapper/devmapper_wrapper_deferred_remove.go
<ide> import "C"
<ide> // LibraryDeferredRemovalsupport is supported when statically linked.
<ide> const LibraryDeferredRemovalSupport = true
<ide>
<del>func dmTaskDeferredRemoveFct(task *CDmTask) int {
<add>func dmTaskDeferredRemoveFct(task *cdmTask) int {
<ide> return int(C.dm_task_deferred_remove((*C.struct_dm_task)(task)))
<ide> }
<ide>
<del>func dmTaskGetInfoWithDeferredFct(task *CDmTask, info *Info) int {
<add>func dmTaskGetInfoWithDeferredFct(task *cdmTask, info *Info) int {
<ide> Cinfo := C.struct_dm_info{}
<ide> defer func() {
<ide> info.Exists = int(Cinfo.exists) | 1 |
Ruby | Ruby | add deprecation warning | 65a7a631ea32306cdc39a28fc30076395c183f25 | <ide><path>Library/Homebrew/language/python.rb
<ide> def self.in_sys_path? python, path
<ide>
<ide> # deprecated; use system "python", *setup_install_args(prefix) instead
<ide> def self.setup_install python, prefix, *args
<add> opoo <<-EOS.undent
<add> Language::Python.setup_install is deprecated.
<add> If you are a formula author, please use
<add> system "python", *Language::Python.setup_install_args(prefix)
<add> instead.
<add> EOS
<add>
<ide> # force-import setuptools, which monkey-patches distutils, to make
<ide> # sure that we always call a setuptools setup.py. trick borrowed from pip:
<ide> # https://github.com/pypa/pip/blob/043af83/pip/req/req_install.py#L743-L780 | 1 |
Java | Java | fix @since tags in scopedproxyutils[tests] | 1ec9721617a121bef1b19f104c3ace292800141c | <ide><path>spring-aop/src/main/java/org/springframework/aop/scope/ScopedProxyUtils.java
<ide> public static String getTargetBeanName(String originalBeanName) {
<ide> * @return the original bean name
<ide> * @throws IllegalArgumentException if the supplied bean name does not refer
<ide> * to the target of a scoped proxy
<del> * @since 5.2
<add> * @since 5.1.10
<ide> * @see #getTargetBeanName(String)
<ide> * @see #isScopedTarget(String)
<ide> */
<ide><path>spring-aop/src/test/java/org/springframework/aop/scope/ScopedProxyUtilsTests.java
<ide> * Unit tests for {@link ScopedProxyUtils}.
<ide> *
<ide> * @author Sam Brannen
<del> * @since 5.2
<add> * @since 5.1.10
<ide> */
<ide> class ScopedProxyUtilsTests {
<ide> | 2 |
Python | Python | improve indentation (bad levels and tabs/spaces) | f9368d8a016dc102f355ceaa3284bcbbd8e81019 | <ide><path>numpy/core/tests/test_arrayprint.py
<ide> def test_floatmode(self):
<ide> # unique mode
<ide> np.set_printoptions(floatmode='unique')
<ide> assert_equal(repr(x),
<del> "array([0.6104 , 0.922 , 0.457 , 0.0906 , 0.3733 , 0.007244,\n"
<del> " 0.5933 , 0.947 , 0.2383 , 0.4226 ], dtype=float16)")
<add> "array([0.6104 , 0.922 , 0.457 , 0.0906 , 0.3733 , 0.007244,\n"
<add> " 0.5933 , 0.947 , 0.2383 , 0.4226 ], dtype=float16)")
<ide> assert_equal(repr(y),
<del> "array([0.2918820979355541 , 0.5064172631089138 , 0.2848750619642916 ,\n"
<del> " 0.4342965294660567 , 0.7326538397312751 , 0.3459503329096204 ,\n"
<del> " 0.0862072768214508 , 0.39112753029631175])")
<add> "array([0.2918820979355541 , 0.5064172631089138 , 0.2848750619642916 ,\n"
<add> " 0.4342965294660567 , 0.7326538397312751 , 0.3459503329096204 ,\n"
<add> " 0.0862072768214508 , 0.39112753029631175])")
<ide> assert_equal(repr(z),
<del> "array([0. , 0.1, 0.2, 0.3, 0.4, 0.5], dtype=float16)")
<add> "array([0. , 0.1, 0.2, 0.3, 0.4, 0.5], dtype=float16)")
<ide> assert_equal(repr(w),
<del> "array([1.e+00, 1.e+01, 1.e+02, 1.e+03, 1.e+04, 1.e+05, 1.e+06, 1.e+07,\n"
<del> " 1.e+08, 1.e+09, 1.e+10, 1.e+11, 1.e+12, 1.e+13, 1.e+14, 1.e+15,\n"
<del> " 1.e+16, 1.e+17, 1.e+18, 1.e+19, 1.e+20, 1.e+21, 1.e+22, 1.e+23,\n"
<del> " 1.e+24])")
<add> "array([1.e+00, 1.e+01, 1.e+02, 1.e+03, 1.e+04, 1.e+05, 1.e+06, 1.e+07,\n"
<add> " 1.e+08, 1.e+09, 1.e+10, 1.e+11, 1.e+12, 1.e+13, 1.e+14, 1.e+15,\n"
<add> " 1.e+16, 1.e+17, 1.e+18, 1.e+19, 1.e+20, 1.e+21, 1.e+22, 1.e+23,\n"
<add> " 1.e+24])")
<ide> assert_equal(repr(wp), "array([1.234e+001, 1.000e+002, 1.000e+123])")
<ide>
<ide> # maxprec mode, precision=8
<ide> def test_floatmode(self):
<ide> # fixed mode, precision=4
<ide> np.set_printoptions(floatmode='fixed', precision=4)
<ide> assert_equal(repr(x),
<del> "array([0.6104, 0.9219, 0.4570, 0.0906, 0.3733, 0.0072, 0.5933, 0.9468,\n"
<del> " 0.2383, 0.4226], dtype=float16)")
<add> "array([0.6104, 0.9219, 0.4570, 0.0906, 0.3733, 0.0072, 0.5933, 0.9468,\n"
<add> " 0.2383, 0.4226], dtype=float16)")
<ide> assert_equal(repr(y),
<del> "array([0.2919, 0.5064, 0.2849, 0.4343, 0.7327, 0.3460, 0.0862, 0.3911])")
<add> "array([0.2919, 0.5064, 0.2849, 0.4343, 0.7327, 0.3460, 0.0862, 0.3911])")
<ide> assert_equal(repr(z),
<del> "array([0.0000, 0.1000, 0.2000, 0.3000, 0.3999, 0.5000], dtype=float16)")
<add> "array([0.0000, 0.1000, 0.2000, 0.3000, 0.3999, 0.5000], dtype=float16)")
<ide> assert_equal(repr(w[::5]),
<del> "array([1.0000e+00, 1.0000e+05, 1.0000e+10, 1.0000e+15, 1.0000e+20])")
<add> "array([1.0000e+00, 1.0000e+05, 1.0000e+10, 1.0000e+15, 1.0000e+20])")
<ide> assert_equal(repr(wp), "array([1.2340e+001, 1.0000e+002, 1.0000e+123])")
<ide> # for larger precision, representation error becomes more apparent:
<ide> np.set_printoptions(floatmode='fixed', precision=8)
<ide> assert_equal(repr(z),
<del> "array([0.00000000, 0.09997559, 0.19995117, 0.30004883, 0.39990234,\n"
<del> " 0.50000000], dtype=float16)")
<add> "array([0.00000000, 0.09997559, 0.19995117, 0.30004883, 0.39990234,\n"
<add> " 0.50000000], dtype=float16)")
<ide>
<ide> # maxprec_equal mode, precision=8
<ide> np.set_printoptions(floatmode='maxprec_equal', precision=8)
<ide> assert_equal(repr(x),
<del> "array([0.610352, 0.921875, 0.457031, 0.090576, 0.373291, 0.007244,\n"
<del> " 0.593262, 0.946777, 0.238281, 0.422607], dtype=float16)")
<add> "array([0.610352, 0.921875, 0.457031, 0.090576, 0.373291, 0.007244,\n"
<add> " 0.593262, 0.946777, 0.238281, 0.422607], dtype=float16)")
<ide> assert_equal(repr(y),
<del> "array([0.29188210, 0.50641726, 0.28487506, 0.43429653, 0.73265384,\n"
<del> " 0.34595033, 0.08620728, 0.39112753])")
<add> "array([0.29188210, 0.50641726, 0.28487506, 0.43429653, 0.73265384,\n"
<add> " 0.34595033, 0.08620728, 0.39112753])")
<ide> assert_equal(repr(z),
<ide> "array([0.0, 0.1, 0.2, 0.3, 0.4, 0.5], dtype=float16)")
<ide> assert_equal(repr(w[::5]),
<ide><path>numpy/core/tests/test_scalarprint.py
<ide> def test_dragon4(self):
<ide> '9.9999999999999694e-311')
<ide>
<ide>
<del> # test rounding
<add> # test rounding
<ide> # 3.1415927410 is closest float32 to np.pi
<ide> assert_equal(fpos32('3.14159265358979323846', **preckwd(10)),
<ide> "3.1415927410")
<ide> def test_dragon4(self):
<ide> assert_equal(fpos64('3.14159265358979323846'), "3.141592653589793")
<ide>
<ide>
<del> # smallest numbers
<add> # smallest numbers
<ide> assert_equal(fpos32(0.5**(126 + 23), unique=False, precision=149),
<ide> "0.00000000000000000000000000000000000000000000140129846432"
<ide> "4817070923729583289916131280261941876515771757068283889791"
<ide> def test_dragon4(self):
<ide> "8373897335989936648099411642057026370902792427675445652290"
<ide> "87538682506419718265533447265625")
<ide>
<del> # largest numbers
<add> # largest numbers
<ide> assert_equal(fpos32(np.finfo(np.float32).max, **preckwd(0)),
<del> "340282346638528859811704183484516925440.")
<add> "340282346638528859811704183484516925440.")
<ide> assert_equal(fpos64(np.finfo(np.float64).max, **preckwd(0)),
<ide> "1797693134862315708145274237317043567980705675258449965989"
<ide> "1747680315726078002853876058955863276687817154045895351438"
<ide> def test_dragon4(self):
<ide> # Warning: In unique mode only the integer digits necessary for
<ide> # uniqueness are computed, the rest are 0. Should we change this?
<ide> assert_equal(fpos32(np.finfo(np.float32).max, precision=0),
<del> "340282350000000000000000000000000000000.")
<add> "340282350000000000000000000000000000000.")
<ide>
<del> # test trailing zeros
<add> # test trailing zeros
<ide> assert_equal(fpos32('1.0', unique=False, precision=3), "1.000")
<ide> assert_equal(fpos64('1.0', unique=False, precision=3), "1.000")
<ide> assert_equal(fsci32('1.0', unique=False, precision=3), "1.000e+00") | 2 |
Text | Text | update architecture overview | 844db6ff12441f63f51d4d9921cdaf4e6af61a04 | <ide><path>website/docs/usage/101/_architecture.md
<ide> Matchers help you find and extract information from [`Doc`](/api/doc) objects
<ide> based on match patterns describing the sequences you're looking for. A matcher
<ide> operates on a `Doc` and gives you access to the matched tokens **in context**.
<ide>
<del>| Name | Description |
<del>| --------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
<del>| [`Matcher`](/api/matcher) | Match sequences of tokens, based on pattern rules, similar to regular expressions. |
<del>| [`PhraseMatcher`](/api/phrasematcher) | Match sequences of tokens based on phrases. |
<del>| [`DependencyMatcher`](/api/dependencymatcher) | Match sequences of tokens based on dependency trees using the [Semgrex syntax](https://nlp.stanford.edu/nlp/javadoc/javanlp/edu/stanford/nlp/semgraph/semgrex/SemgrexPattern.html). |
<add>| Name | Description |
<add>| --------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
<add>| [`Matcher`](/api/matcher) | Match sequences of tokens, based on pattern rules, similar to regular expressions. |
<add>| [`PhraseMatcher`](/api/phrasematcher) | Match sequences of tokens based on phrases. |
<add>| [`DependencyMatcher`](/api/dependencymatcher) | Match sequences of tokens based on dependency trees using [Semgrex operators](https://nlp.stanford.edu/nlp/javadoc/javanlp/edu/stanford/nlp/semgraph/semgrex/SemgrexPattern.html). |
<ide>
<ide> ### Other classes {#architecture-other}
<ide>
<del>| Name | Description |
<del>| ------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------- |
<del>| [`Vocab`](/api/vocab) | The shared vocabulary that stores strings and gives you access to [`Lexeme`](/api/lexeme) objects. |
<del>| [`StringStore`](/api/stringstore) | Map strings to and from hash values. |
<del>| [`Vectors`](/api/vectors) | Container class for vector data keyed by string. |
<del>| [`Lookups`](/api/lookups) | Container for convenient access to large lookup tables and dictionaries. |
<del>| [`Morphology`](/api/morphology) | Assign linguistic features like lemmas, noun case, verb tense etc. based on the word and its part-of-speech tag. |
<del>| [`MorphAnalysis`](/api/morphology#morphanalysis) | A morphological analysis. |
<del>| [`KnowledgeBase`](/api/kb) | Storage for entities and aliases of a knowledge base for entity linking. |
<del>| [`Scorer`](/api/scorer) | Compute evaluation scores. |
<del>| [`Corpus`](/api/corpus) | Class for managing annotated corpora for training and evaluation data. |
<add>| Name | Description |
<add>| ------------------------------------------------ | -------------------------------------------------------------------------------------------------- |
<add>| [`Vocab`](/api/vocab) | The shared vocabulary that stores strings and gives you access to [`Lexeme`](/api/lexeme) objects. |
<add>| [`StringStore`](/api/stringstore) | Map strings to and from hash values. |
<add>| [`Vectors`](/api/vectors) | Container class for vector data keyed by string. |
<add>| [`Lookups`](/api/lookups) | Container for convenient access to large lookup tables and dictionaries. |
<add>| [`Morphology`](/api/morphology) | Store morphological analyses and map them to and from hash values. |
<add>| [`MorphAnalysis`](/api/morphology#morphanalysis) | A morphological analysis. |
<add>| [`KnowledgeBase`](/api/kb) | Storage for entities and aliases of a knowledge base for entity linking. |
<add>| [`Scorer`](/api/scorer) | Compute evaluation scores. |
<add>| [`Corpus`](/api/corpus) | Class for managing annotated corpora for training and evaluation data. | | 1 |
Text | Text | add necessary imports to final urls.py example | d655a423fb06ec8b5880a1fb63ed6ad885753a94 | <ide><path>docs/tutorial/5-relationships-and-hyperlinked-apis.md
<ide> If we're going to have a hyperlinked API, we need to make sure we name our URL p
<ide> * Our user serializer includes a field that refers to `'snippet-detail'`.
<ide> * Our snippet and user serializers include `'url'` fields that by default will refer to `'{model_name}-detail'`, which in this case will be `'snippet-detail'` and `'user-detail'`.
<ide>
<del>After adding all those names into our URLconf, our final `snippets/urls.py` file should look something like this:
<add>After adding all those names into our URLconf, our final `snippets/urls.py` file should look like this:
<ide>
<ide> from django.conf.urls import url, include
<add> from rest_framework.urlpatterns import format_suffix_patterns
<add> from snippets import views
<ide>
<ide> # API endpoints
<ide> urlpatterns = format_suffix_patterns([ | 1 |
Java | Java | fix localization crash in devsettingsactivity | 427e464bb95e4e0ecc7455e71b5d477014618200 | <ide><path>ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSettingsActivity.java
<ide> public class DevSettingsActivity extends PreferenceActivity {
<ide> @Override
<ide> public void onCreate(Bundle savedInstanceState) {
<ide> super.onCreate(savedInstanceState);
<del> setTitle(R.string.catalyst_settings_title);
<add> setTitle(getApplication().getResources().getString(R.string.catalyst_settings_title));
<ide> addPreferencesFromResource(R.xml.preferences);
<ide> }
<ide> } | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.