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
escape commands and paths
ef07687262716984db51c173a0378d1eb0664289
<ide><path>README.md <ide> end <ide> ## Installation <ide> <ide> 1. Add `require "active_storage"` to config/application.rb. <del>2. Run rails activestorage:install to create needed directories, migrations, and configuration. <del>3. Configure the storage service in config/environments/* with `config.active_storage.service = :local` <del> that references the services configured in config/storage_services.yml. <add>2. Run `rails activestorage:install` to create needed directories, migrations, and configuration. <add>3. Configure the storage service in `config/environments/*` with `config.active_storage.service = :local` <add> that references the services configured in `config/storage_services.yml`. <ide> <ide> ## Todos <ide>
1
Text
Text
fix imports in the lstm example
f8d8def510659a161da0bc8dffd2e5154e2baf6f
<ide><path>README.md <ide> model.fit(X_train, Y_train, batch_size=32, nb_epoch=1) <ide> <ide> ```python <ide> from keras.models import Sequential <del>from keras.layers.core import Dense, Dropout, Activation, Embedding <add>from keras.layers.core import Dense, Dropout, Activation <add>from keras.layers.embeddings import Embedding <ide> from keras.layers.recurrent import LSTM <ide> <ide> model = Sequential()
1
Javascript
Javascript
remove legacypromise in src/core/worker.js
87d38b0692489a2122cd744b4460c427abc51f5c
<ide><path>src/core/pdf_manager.js <ide> var BasePdfManager = (function BasePdfManagerClosure() { <ide> <ide> updatePassword: function BasePdfManager_updatePassword(password) { <ide> this.pdfDocument.xref.password = this.password = password; <del> if (this.passwordChangedPromise) { <del> this.passwordChangedPromise.resolve(); <add> if (this._passwordChangedCapability) { <add> this._passwordChangedCapability.resolve(); <ide> } <ide> }, <ide> <add> passwordChanged: function BasePdfManager_passwordChanged() { <add> this._passwordChangedCapability = createPromiseCapability(); <add> return this._passwordChangedCapability.promise; <add> }, <add> <ide> terminate: function BasePdfManager_terminate() { <ide> return new NotImplementedException(); <ide> } <ide><path>src/core/worker.js <ide> /* globals error, globalScope, InvalidPDFException, info, <ide> MissingPDFException, PasswordException, PDFJS, Promise, <ide> UnknownErrorException, NetworkManager, LocalPdfManager, <del> NetworkPdfManager, XRefParseException, LegacyPromise, <add> NetworkPdfManager, XRefParseException, createPromiseCapability, <ide> isInt, PasswordResponses, MessageHandler, Ref, RANGE_CHUNK_SIZE */ <ide> <ide> 'use strict'; <ide> var WorkerMessageHandler = PDFJS.WorkerMessageHandler = { <ide> var pdfManager; <ide> <ide> function loadDocument(recoveryMode) { <del> var loadDocumentPromise = new LegacyPromise(); <add> var loadDocumentCapability = createPromiseCapability(); <ide> <ide> var parseSuccess = function parseSuccess() { <ide> var numPagesPromise = pdfManager.ensureDoc('numPages'); <ide> var WorkerMessageHandler = PDFJS.WorkerMessageHandler = { <ide> encrypted: !!results[5], <ide> javaScript: results[6] <ide> }; <del> loadDocumentPromise.resolve(doc); <add> loadDocumentCapability.resolve(doc); <ide> }, <ide> parseFailure); <ide> }; <ide> <ide> var parseFailure = function parseFailure(e) { <del> loadDocumentPromise.reject(e); <add> loadDocumentCapability.reject(e); <ide> }; <ide> <ide> pdfManager.ensureDoc('checkHeader', []).then(function() { <ide> var WorkerMessageHandler = PDFJS.WorkerMessageHandler = { <ide> }, parseFailure); <ide> }, parseFailure); <ide> <del> return loadDocumentPromise; <add> return loadDocumentCapability.promise; <ide> } <ide> <ide> function getPdfManager(data) { <del> var pdfManagerPromise = new LegacyPromise(); <add> var pdfManagerCapability = createPromiseCapability(); <ide> <ide> var source = data.source; <ide> var disableRange = data.disableRange; <ide> if (source.data) { <ide> try { <ide> pdfManager = new LocalPdfManager(source.data, source.password); <del> pdfManagerPromise.resolve(); <add> pdfManagerCapability.resolve(); <ide> } catch (ex) { <del> pdfManagerPromise.reject(ex); <add> pdfManagerCapability.reject(ex); <ide> } <del> return pdfManagerPromise; <add> return pdfManagerCapability.promise; <ide> } else if (source.chunkedViewerLoading) { <ide> try { <ide> pdfManager = new NetworkPdfManager(source, handler); <del> pdfManagerPromise.resolve(); <add> pdfManagerCapability.resolve(); <ide> } catch (ex) { <del> pdfManagerPromise.reject(ex); <add> pdfManagerCapability.reject(ex); <ide> } <del> return pdfManagerPromise; <add> return pdfManagerCapability.promise; <ide> } <ide> <ide> var networkManager = new NetworkManager(source.url, { <ide> var WorkerMessageHandler = PDFJS.WorkerMessageHandler = { <ide> <ide> try { <ide> pdfManager = new NetworkPdfManager(source, handler); <del> pdfManagerPromise.resolve(pdfManager); <add> pdfManagerCapability.resolve(pdfManager); <ide> } catch (ex) { <del> pdfManagerPromise.reject(ex); <add> pdfManagerCapability.reject(ex); <ide> } <ide> }, <ide> <ide> onDone: function onDone(args) { <ide> // the data is array, instantiating directly from it <ide> try { <ide> pdfManager = new LocalPdfManager(args.chunk, source.password); <del> pdfManagerPromise.resolve(); <add> pdfManagerCapability.resolve(); <ide> } catch (ex) { <del> pdfManagerPromise.reject(ex); <add> pdfManagerCapability.reject(ex); <ide> } <ide> }, <ide> <ide> var WorkerMessageHandler = PDFJS.WorkerMessageHandler = { <ide> } <ide> }); <ide> <del> return pdfManagerPromise; <add> return pdfManagerCapability.promise; <ide> } <ide> <ide> handler.on('test', function wphSetupTest(data) { <ide> var WorkerMessageHandler = PDFJS.WorkerMessageHandler = { <ide> if (ex instanceof PasswordException) { <ide> // after password exception prepare to receive a new password <ide> // to repeat loading <del> pdfManager.passwordChangedPromise = new LegacyPromise(); <del> pdfManager.passwordChangedPromise.then(pdfManagerReady); <add> pdfManager.passwordChanged().then(pdfManagerReady); <ide> } <ide> <ide> onFailure(ex);
2
Python
Python
handle unset fields with 'many=true'
5185cc934862a5ab13316c85402c12a6d744f94c
<ide><path>rest_framework/relations.py <ide> from django.utils.translation import gettext_lazy as _ <ide> <ide> from rest_framework.fields import ( <del> Field, empty, get_attribute, is_simple_callable, iter_options <add> Field, SkipField, empty, get_attribute, is_simple_callable, iter_options <ide> ) <ide> from rest_framework.reverse import reverse <ide> from rest_framework.settings import api_settings <ide> def get_attribute(self, instance): <ide> if hasattr(instance, 'pk') and instance.pk is None: <ide> return [] <ide> <del> relationship = get_attribute(instance, self.source_attrs) <add> try: <add> relationship = get_attribute(instance, self.source_attrs) <add> except (KeyError, AttributeError) as exc: <add> if self.default is not empty: <add> return self.get_default() <add> if self.allow_null: <add> return None <add> if not self.required: <add> raise SkipField() <add> msg = ( <add> 'Got {exc_type} when attempting to get a value for field ' <add> '`{field}` on serializer `{serializer}`.\nThe serializer ' <add> 'field might be named incorrectly and not match ' <add> 'any attribute or key on the `{instance}` instance.\n' <add> 'Original exception text was: {exc}.'.format( <add> exc_type=type(exc).__name__, <add> field=self.field_name, <add> serializer=self.parent.__class__.__name__, <add> instance=instance.__class__.__name__, <add> exc=exc <add> ) <add> ) <add> raise type(exc)(msg) <add> <ide> return relationship.all() if hasattr(relationship, 'all') else relationship <ide> <ide> def to_representation(self, iterable): <ide><path>tests/test_model_serializer.py <ide> class Meta: <ide> assert serializer.data == expected <ide> <ide> <add>class Issue7550FooModel(models.Model): <add> text = models.CharField(max_length=100) <add> bar = models.ForeignKey( <add> 'Issue7550BarModel', null=True, blank=True, on_delete=models.SET_NULL, <add> related_name='foos', related_query_name='foo') <add> <add> <add>class Issue7550BarModel(models.Model): <add> pass <add> <add> <add>class Issue7550TestCase(TestCase): <add> <add> def test_dotted_source(self): <add> <add> class _FooSerializer(serializers.ModelSerializer): <add> class Meta: <add> model = Issue7550FooModel <add> fields = ('id', 'text') <add> <add> class FooSerializer(serializers.ModelSerializer): <add> other_foos = _FooSerializer(source='bar.foos', many=True) <add> <add> class Meta: <add> model = Issue7550BarModel <add> fields = ('id', 'other_foos') <add> <add> bar = Issue7550BarModel.objects.create() <add> foo_a = Issue7550FooModel.objects.create(bar=bar, text='abc') <add> foo_b = Issue7550FooModel.objects.create(bar=bar, text='123') <add> <add> assert FooSerializer(foo_a).data == { <add> 'id': foo_a.id, <add> 'other_foos': [ <add> { <add> 'id': foo_a.id, <add> 'text': foo_a.text, <add> }, <add> { <add> 'id': foo_b.id, <add> 'text': foo_b.text, <add> }, <add> ], <add> } <add> <add> def test_dotted_source_with_default(self): <add> <add> class _FooSerializer(serializers.ModelSerializer): <add> class Meta: <add> model = Issue7550FooModel <add> fields = ('id', 'text') <add> <add> class FooSerializer(serializers.ModelSerializer): <add> other_foos = _FooSerializer(source='bar.foos', default=[], many=True) <add> <add> class Meta: <add> model = Issue7550FooModel <add> fields = ('id', 'other_foos') <add> <add> foo = Issue7550FooModel.objects.create(bar=None, text='abc') <add> <add> assert FooSerializer(foo).data == { <add> 'id': foo.id, <add> 'other_foos': [], <add> } <add> <add> <ide> class DecimalFieldModel(models.Model): <ide> decimal_field = models.DecimalField( <ide> max_digits=3,
2
Ruby
Ruby
add homebrew_temp to testing environment
3656f595089d9c6c5f0ece8e5a1cee59667d79d8
<ide><path>Library/Homebrew/test/testing_env.rb <ide> HOMEBREW_CACHE_FORMULA = HOMEBREW_PREFIX.parent+'formula_cache' <ide> HOMEBREW_CELLAR = HOMEBREW_PREFIX.parent+'cellar' <ide> HOMEBREW_LOGS = HOMEBREW_PREFIX.parent+'logs' <add>HOMEBREW_TEMP = Pathname.new(ENV.fetch('HOMEBREW_TEMP', '/tmp')) <ide> HOMEBREW_USER_AGENT = 'Homebrew' <ide> HOMEBREW_WWW = 'http://example.com' <ide> HOMEBREW_CURL_ARGS = '-fsLA'
1
Go
Go
make list of commands for help less static
4f00b1020e8bf28d5d3dfb88730894888666fd9a
<ide><path>docker/flags.go <ide> import ( <ide> "os" <ide> "path/filepath" <ide> "runtime" <add> "sort" <ide> <ide> "github.com/docker/docker/opts" <ide> "github.com/docker/docker/pkg/homedir" <ide> flag "github.com/docker/docker/pkg/mflag" <ide> ) <ide> <add>type command struct { <add> name string <add> description string <add>} <add> <add>type byName []command <add> <add>func (a byName) Len() int { return len(a) } <add>func (a byName) Swap(i, j int) { a[i], a[j] = a[j], a[i] } <add>func (a byName) Less(i, j int) bool { return a[i].name < a[j].name } <add> <ide> var ( <ide> dockerCertPath = os.Getenv("DOCKER_CERT_PATH") <ide> dockerTlsVerify = os.Getenv("DOCKER_TLS_VERIFY") != "" <add> <add> dockerCommands = []command{ <add> {"attach", "Attach to a running container"}, <add> {"build", "Build an image from a Dockerfile"}, <add> {"commit", "Create a new image from a container's changes"}, <add> {"cp", "Copy files/folders from a container's filesystem to the host path"}, <add> {"create", "Create a new container"}, <add> {"diff", "Inspect changes on a container's filesystem"}, <add> {"events", "Get real time events from the server"}, <add> {"exec", "Run a command in a running container"}, <add> {"export", "Stream the contents of a container as a tar archive"}, <add> {"history", "Show the history of an image"}, <add> {"images", "List images"}, <add> {"import", "Create a new filesystem image from the contents of a tarball"}, <add> {"info", "Display system-wide information"}, <add> {"inspect", "Return low-level information on a container or image"}, <add> {"kill", "Kill a running container"}, <add> {"load", "Load an image from a tar archive"}, <add> {"login", "Register or log in to a Docker registry server"}, <add> {"logout", "Log out from a Docker registry server"}, <add> {"logs", "Fetch the logs of a container"}, <add> {"port", "Lookup the public-facing port that is NAT-ed to PRIVATE_PORT"}, <add> {"pause", "Pause all processes within a container"}, <add> {"ps", "List containers"}, <add> {"pull", "Pull an image or a repository from a Docker registry server"}, <add> {"push", "Push an image or a repository to a Docker registry server"}, <add> {"rename", "Rename an existing container"}, <add> {"restart", "Restart a running container"}, <add> {"rm", "Remove one or more containers"}, <add> {"rmi", "Remove one or more images"}, <add> {"run", "Run a command in a new container"}, <add> {"save", "Save an image to a tar archive"}, <add> {"search", "Search for an image on the Docker Hub"}, <add> {"start", "Start a stopped container"}, <add> {"stats", "Display a stream of a containers' resource usage statistics"}, <add> {"stop", "Stop a running container"}, <add> {"tag", "Tag an image into a repository"}, <add> {"top", "Lookup the running processes of a container"}, <add> {"unpause", "Unpause a paused container"}, <add> {"version", "Show the Docker version information"}, <add> {"wait", "Block until a container stops, then print its exit code"}, <add> } <ide> ) <ide> <ide> func init() { <ide> func init() { <ide> <ide> help := "\nCommands:\n" <ide> <del> for _, command := range [][]string{ <del> {"attach", "Attach to a running container"}, <del> {"build", "Build an image from a Dockerfile"}, <del> {"commit", "Create a new image from a container's changes"}, <del> {"cp", "Copy files/folders from a container's filesystem to the host path"}, <del> {"create", "Create a new container"}, <del> {"diff", "Inspect changes on a container's filesystem"}, <del> {"events", "Get real time events from the server"}, <del> {"exec", "Run a command in a running container"}, <del> {"export", "Stream the contents of a container as a tar archive"}, <del> {"history", "Show the history of an image"}, <del> {"images", "List images"}, <del> {"import", "Create a new filesystem image from the contents of a tarball"}, <del> {"info", "Display system-wide information"}, <del> {"inspect", "Return low-level information on a container or image"}, <del> {"kill", "Kill a running container"}, <del> {"load", "Load an image from a tar archive"}, <del> {"login", "Register or log in to a Docker registry server"}, <del> {"logout", "Log out from a Docker registry server"}, <del> {"logs", "Fetch the logs of a container"}, <del> {"port", "Lookup the public-facing port that is NAT-ed to PRIVATE_PORT"}, <del> {"pause", "Pause all processes within a container"}, <del> {"ps", "List containers"}, <del> {"pull", "Pull an image or a repository from a Docker registry server"}, <del> {"push", "Push an image or a repository to a Docker registry server"}, <del> {"rename", "Rename an existing container"}, <del> {"restart", "Restart a running container"}, <del> {"rm", "Remove one or more containers"}, <del> {"rmi", "Remove one or more images"}, <del> {"run", "Run a command in a new container"}, <del> {"save", "Save an image to a tar archive"}, <del> {"search", "Search for an image on the Docker Hub"}, <del> {"start", "Start a stopped container"}, <del> {"stats", "Display a stream of a containers' resource usage statistics"}, <del> {"stop", "Stop a running container"}, <del> {"tag", "Tag an image into a repository"}, <del> {"top", "Lookup the running processes of a container"}, <del> {"unpause", "Unpause a paused container"}, <del> {"version", "Show the Docker version information"}, <del> {"wait", "Block until a container stops, then print its exit code"}, <del> } { <del> help += fmt.Sprintf(" %-10.10s%s\n", command[0], command[1]) <add> sort.Sort(byName(dockerCommands)) <add> <add> for _, cmd := range dockerCommands { <add> help += fmt.Sprintf(" %-10.10s%s\n", cmd.name, cmd.description) <ide> } <add> <ide> help += "\nRun 'docker COMMAND --help' for more information on a command." <ide> fmt.Fprintf(os.Stdout, "%s\n", help) <ide> }
1
Javascript
Javascript
add warnings for common root api mistakes
8c4cd65cfaa4614bac7fd7783b4ec502a337eba3
<ide><path>packages/react-dom/src/__tests__/ReactDOMRoot-test.js <ide> describe('ReactDOMRoot', () => { <ide> // Still works in the legacy API <ide> ReactDOM.render(<div />, commentNode); <ide> }); <add> <add> it('warn if no children passed to hydrateRoot', async () => { <add> expect(() => <add> ReactDOM.hydrateRoot(container), <add> ).toErrorDev( <add> 'Must provide initial children as second argument to hydrateRoot.', <add> {withoutStack: true}, <add> ); <add> }); <add> <add> it('warn if JSX passed to createRoot', async () => { <add> function App() { <add> return 'Child'; <add> } <add> <add> expect(() => ReactDOM.createRoot(container, <App />)).toErrorDev( <add> 'You passed a JSX element to createRoot. You probably meant to call ' + <add> 'root.render instead', <add> { <add> withoutStack: true, <add> }, <add> ); <add> }); <ide> }); <ide><path>packages/react-dom/src/client/ReactDOMRoot.js <ide> import type { <ide> } from 'react-reconciler/src/ReactInternalTypes'; <ide> <ide> import {queueExplicitHydrationTarget} from '../events/ReactDOMEventReplaying'; <add>import {REACT_ELEMENT_TYPE} from 'shared/ReactSymbols'; <ide> <ide> export type RootType = { <ide> render(children: ReactNodeList): void, <ide> export function createRoot( <ide> console.warn( <ide> 'hydrate through createRoot is deprecated. Use ReactDOM.hydrateRoot(container, <App />) instead.', <ide> ); <add> } else { <add> if ( <add> typeof options === 'object' && <add> options !== null && <add> (options: any).$$typeof === REACT_ELEMENT_TYPE <add> ) { <add> console.error( <add> 'You passed a JSX element to createRoot. You probably meant to ' + <add> 'call root.render instead. ' + <add> 'Example usage:\n\n' + <add> ' let root = createRoot(domContainer);\n' + <add> ' root.render(<App />);', <add> ); <add> } <ide> } <ide> } <ide> if (options.unstable_strictMode === true) { <ide> export function hydrateRoot( <ide> <ide> warnIfReactDOMContainerInDEV(container); <ide> <add> if (__DEV__) { <add> if (initialChildren === undefined) { <add> console.error( <add> 'Must provide initial children as second argument to hydrateRoot. ' + <add> 'Example usage: hydrateRoot(domContainer, <App />)', <add> ); <add> } <add> } <add> <ide> // For now we reuse the whole bag of options since they contain <ide> // the hydration callbacks. <ide> const hydrationCallbacks = options != null ? options : null;
2
Javascript
Javascript
remove ie8 specific branch
4ebbd7e210a45619a953b5e4b0ceba0e2ece59e2
<ide><path>src/Angular.js <ide> function makeMap(str) { <ide> } <ide> <ide> <del>if (msie < 9) { <del> nodeName_ = function(element) { <del> element = element.nodeName ? element : element[0]; <del> return lowercase( <del> (element.scopeName && element.scopeName != 'HTML') <del> ? element.scopeName + ':' + element.nodeName : element.nodeName <del> ); <del> }; <del>} else { <del> nodeName_ = function(element) { <del> return lowercase(element.nodeName ? element.nodeName : element[0].nodeName); <del> }; <add>function nodeName_(element) { <add> return lowercase(element.nodeName ? element.nodeName : element[0].nodeName); <ide> } <ide> <ide>
1
Text
Text
add some kindness
ade701045f0f80399d99151e5583d4f86c68678e
<ide><path>CONTRIBUTING.md <ide> Ruby on Rails is a volunteer effort. We encourage you to pitch in. [Join the team](http://contributors.rubyonrails.org)! <ide> <del>Read the [Contributing to Ruby on Rails](http://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html) guide before submitting any code, it is a comprehensive introduction. <add>Please read the [Contributing to Ruby on Rails](http://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html) guide before submitting any code. <ide> <del>Please note that *we only accept bug reports and pull requests in GitHub*. <add>*We only accept bug reports and pull requests in GitHub*. <ide> <ide> If you have a question about how to use Ruby on Rails, please [ask the rubyonrails-talk mailing list](https://groups.google.com/forum/?fromgroups#!forum/rubyonrails-talk). <ide>
1
Javascript
Javascript
add missing spaces in concatenations
c9da05d37b6ed6beed5b4c5ecf7e72f556169e5a
<ide><path>test/parallel/test-child-process-default-options.js <ide> child.stdout.on('data', function(chunk) { <ide> <ide> process.on('exit', function() { <ide> assert.ok(response.includes('HELLO=WORLD'), <del> 'spawn did not use process.env as default' + <add> 'spawn did not use process.env as default ' + <ide> `(process.env.HELLO = ${process.env.HELLO})`); <ide> }); <ide><path>test/parallel/test-cluster-basic.js <ide> const assert = require('assert'); <ide> const cluster = require('cluster'); <ide> <ide> assert.strictEqual('NODE_UNIQUE_ID' in process.env, false, <del> `NODE_UNIQUE_ID (${process.env.NODE_UNIQUE_ID})` + <add> `NODE_UNIQUE_ID (${process.env.NODE_UNIQUE_ID}) ` + <ide> 'should be removed on startup'); <ide> <ide> function forEach(obj, fn) { <ide><path>test/parallel/test-promises-unhandled-rejections.js <ide> asyncTest('When re-throwing new errors in a promise catch, only the' + <ide> }); <ide> }); <ide> <del>asyncTest('Test params of unhandledRejection for a synchronously-rejected' + <add>asyncTest('Test params of unhandledRejection for a synchronously-rejected ' + <ide> 'promise', function(done) { <ide> const e = new Error(); <ide> onUnhandledSucceed(done, function(reason, promise) { <ide> asyncTest('While inside setImmediate, catching a rejected promise derived ' + <ide> }); <ide> <ide> // State adapation tests <del>asyncTest('catching a promise which is asynchronously rejected (via' + <add>asyncTest('catching a promise which is asynchronously rejected (via ' + <ide> 'resolution to an asynchronously-rejected promise) prevents' + <ide> ' unhandledRejection', function(done) { <ide> const e = new Error(); <ide> asyncTest( <ide> ); <ide> <ide> // Combinations with Promise.all <del>asyncTest('Catching the Promise.all() of a collection that includes a' + <add>asyncTest('Catching the Promise.all() of a collection that includes a ' + <ide> 'rejected promise prevents unhandledRejection', function(done) { <ide> const e = new Error(); <ide> onUnhandledFail(done); <ide> asyncTest('nextTick is immediately scheduled when called inside an event' + <ide> }); <ide> <ide> asyncTest('Throwing an error inside a rejectionHandled handler goes to' + <del> ' unhandledException, and does not cause .catch() to throw an' + <add> ' unhandledException, and does not cause .catch() to throw an ' + <ide> 'exception', function(done) { <ide> clean(); <ide> const e = new Error();
3
Mixed
Go
allow git@ prefixes for any hosted git service
c7e4cc4a531b5337d64bda22df8553e646a96fe7
<ide><path>docs/sources/reference/commandline/cli.md <ide> Supported formats are: bzip2, gzip and xz. <ide> This will clone the GitHub repository and use the cloned repository as <ide> context. The Dockerfile at the root of the <ide> repository is used as Dockerfile. Note that you <del>can specify an arbitrary Git repository by using the `git://` <add>can specify an arbitrary Git repository by using the `git://` or `git@` <ide> schema. <ide> <ide> > **Note:** `docker build` will return a `no such file or directory` error <ide><path>utils/utils.go <ide> func IsURL(str string) bool { <ide> } <ide> <ide> func IsGIT(str string) bool { <del> return strings.HasPrefix(str, "git://") || strings.HasPrefix(str, "github.com/") || strings.HasPrefix(str, "git@github.com:") || (strings.HasSuffix(str, ".git") && IsURL(str)) <add> return strings.HasPrefix(str, "git://") || strings.HasPrefix(str, "github.com/") || strings.HasPrefix(str, "git@") || (strings.HasSuffix(str, ".git") && IsURL(str)) <ide> } <ide> <ide> func ValidGitTransport(str string) bool { <ide><path>utils/utils_test.go <ide> func TestReadSymlinkedDirectoryToFile(t *testing.T) { <ide> } <ide> } <ide> <del>func TestValidGitTransport(t *testing.T) { <del> for _, url := range []string{ <add>var ( <add> gitUrls = []string{ <ide> "git://github.com/docker/docker", <ide> "git@github.com:docker/docker.git", <add> "git@bitbucket.org:atlassianlabs/atlassian-docker.git", <ide> "https://github.com/docker/docker.git", <ide> "http://github.com/docker/docker.git", <del> } { <add> } <add> incompleteGitUrls = []string{ <add> "github.com/docker/docker", <add> } <add>) <add> <add>func TestValidGitTransport(t *testing.T) { <add> for _, url := range gitUrls { <ide> if ValidGitTransport(url) == false { <ide> t.Fatalf("%q should be detected as valid Git prefix", url) <ide> } <ide> } <ide> <del> for _, url := range []string{ <del> "github.com/docker/docker", <del> } { <add> for _, url := range incompleteGitUrls { <ide> if ValidGitTransport(url) == true { <ide> t.Fatalf("%q should not be detected as valid Git prefix", url) <ide> } <ide> } <ide> } <add> <add>func TestIsGIT(t *testing.T) { <add> for _, url := range gitUrls { <add> if IsGIT(url) == false { <add> t.Fatalf("%q should be detected as valid Git url", url) <add> } <add> } <add> for _, url := range incompleteGitUrls { <add> if IsGIT(url) == false { <add> t.Fatalf("%q should be detected as valid Git url", url) <add> } <add> } <add>}
3
Javascript
Javascript
add @providesmodule annotations
a23a3c319c7452e5f58d38f067c22dae65d5b84b
<ide><path>Examples/Movies/MovieCell.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule MovieCell <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/Movies/MovieScreen.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule MovieScreen <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/Movies/SearchScreen.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule SearchScreen <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/Movies/getImageSource.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule getImageSource <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/Movies/getStyleFromScore.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule getStyleFromScore <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/Movies/getTextFromScore.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule getTextFromScore <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/AccessibilityAndroidExample.android.js <ide> * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <add> * @providesModule AccessibilityAndroidExample <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/AccessibilityIOSExample.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule AccessibilityIOSExample <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/ActionSheetIOSExample.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule ActionSheetIOSExample <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/ActivityIndicatorExample.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule ActivityIndicatorExample <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/AdSupportIOSExample.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule AdSupportIOSExample <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/AlertExample.js <ide> * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <add> * @providesModule AlertExample <ide> */ <ide> <ide> 'use strict'; <ide><path>Examples/UIExplorer/js/AlertIOSExample.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule AlertIOSExample <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/AnimatedExample.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule AnimatedExample <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/AssetScaledImageExample.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule AssetScaledImageExample <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/AsyncStorageExample.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule AsyncStorageExample <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/BorderExample.js <ide> * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN <ide> * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <add> * @providesModule BorderExample <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/BoxShadowExample.js <ide> * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN <ide> * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <add> * @providesModule BoxShadowExample <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/ButtonExample.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule ButtonExample <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/CameraRollExample.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule CameraRollExample <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/ClipboardExample.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule ClipboardExample <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/DatePickerAndroidExample.js <ide> * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN <ide> * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <add> * @providesModule DatePickerAndroidExample <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/DatePickerIOSExample.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule DatePickerIOSExample <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/FlatListExample.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule FlatListExample <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/GeolocationExample.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule GeolocationExample <ide> */ <ide> /* eslint no-console: 0 */ <ide> 'use strict'; <ide><path>Examples/UIExplorer/js/ImageEditingExample.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule ImageEditingExample <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/ImageExample.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule ImageExample <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/LayoutAnimationExample.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule LayoutAnimationExample <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/LayoutEventsExample.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule LayoutEventsExample <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/LayoutExample.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule LayoutExample <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/LinkingExample.js <ide> * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN <ide> * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <add> * @providesModule LinkingExample <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/ListExampleShared.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule ListExampleShared <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/ListViewExample.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule ListViewExample <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/ListViewGridLayoutExample.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule ListViewGridLayoutExample <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/MapViewExample.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule MapViewExample <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/ModalExample.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule ModalExample <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/MultiColumnExample.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule MultiColumnExample <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/NativeAnimationsExample.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule NativeAnimationsExample <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/NavigationExperimental/NavigationCardStack-NavigationHeader-Tabs-example.js <ide> const ReactNative = require('react-native'); <ide> /** <ide> * Basic example that shows how to use <NavigationCardStack /> to build <ide> * an app with composite navigation system. <add> * @providesModule NavigationCardStack-NavigationHeader-Tabs-example <ide> */ <ide> <ide> const { <ide><path>Examples/UIExplorer/js/NavigationExperimental/NavigationCardStack-NoGesture-example.js <ide> * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN <ide> * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <del>*/ <add> * <add> * @providesModule NavigationCardStack-NoGesture-example <add> */ <ide> 'use strict'; <ide> <ide> const NavigationExampleRow = require('./NavigationExampleRow'); <ide><path>Examples/UIExplorer/js/NavigationExperimental/NavigationCardStack-example.js <ide> * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN <ide> * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <del>*/ <add> * @providesModule NavigationCardStack-example <add> */ <ide> 'use strict'; <ide> <ide> const NavigationExampleRow = require('./NavigationExampleRow'); <ide><path>Examples/UIExplorer/js/NavigationExperimental/NavigationExampleRow.js <ide> * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN <ide> * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <del>*/ <add> * @providesModule NavigationExampleRow <add> */ <ide> 'use strict'; <ide> <ide> var React = require('react'); <ide><path>Examples/UIExplorer/js/NavigationExperimental/NavigationExperimentalExample.js <ide> * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN <ide> * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <del>*/ <add> * @providesModule NavigationExperimentalExample <add> */ <ide> 'use strict'; <ide> <ide> const AsyncStorage = require('AsyncStorage'); <ide><path>Examples/UIExplorer/js/NavigationExperimental/NavigationTransitioner-AnimatedView-example.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule NavigationTransitioner-AnimatedView-example <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/NavigationExperimental/NavigationTransitioner-AnimatedView-pager-example.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule NavigationTransitioner-AnimatedView-pager-example <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/Navigator/BreadcrumbNavSample.js <ide> * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN <ide> * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <del>*/ <add> * @providesModule BreadcrumbNavSample <add> */ <ide> 'use strict'; <ide> <ide> var React = require('react'); <ide><path>Examples/UIExplorer/js/Navigator/JumpingNavSample.js <ide> * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN <ide> * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <del>*/ <add> * @providesModule JumpingNavSample <add> */ <ide> 'use strict'; <ide> <ide> var React = require('react'); <ide><path>Examples/UIExplorer/js/Navigator/NavigationBarSample.js <ide> * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN <ide> * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <del>*/ <add> * @providesModule NavigationBarSample <add> */ <ide> 'use strict'; <ide> <ide> <ide><path>Examples/UIExplorer/js/NavigatorIOSColorsExample.js <ide> * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN <ide> * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <del>*/ <add> * @providesModule NavigatorIOSColorsExample <add> */ <ide> 'use strict'; <ide> <ide> var React = require('react'); <ide><path>Examples/UIExplorer/js/NavigatorIOSExample.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule NavigatorIOSExample <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/NetInfoExample.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule NetInfoExample <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/PanResponderExample.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow weak <add> * @providesModule PanResponderExample <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/PickerExample.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule PickerExample <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/PickerIOSExample.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule PickerIOSExample <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/PointerEventsExample.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule PointerEventsExample <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/ProgressBarAndroidExample.android.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule ProgressBarAndroidExample <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/ProgressViewIOSExample.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule ProgressViewIOSExample <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/PushNotificationIOSExample.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule PushNotificationIOSExample <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/RCTRootViewIOSExample.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule RCTRootViewIOSExample <ide> */ <ide> <ide> 'use strict'; <ide><path>Examples/UIExplorer/js/RTLExample.js <ide> * - two custom examples for RTL design <ide> * <ide> * @flow <add> * @providesModule RTLExample <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/RefreshControlExample.js <ide> * LICENSE file in the root directory of this source tree. An additional grant <ide> * of patent rights can be found in the PATENTS file in the same directory. <ide> * <del>* The examples provided by Facebook are for non-commercial testing and <del>* evaluation purposes only. <del>* <del>* Facebook reserves all rights not expressly granted. <del>* <del>* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS <del>* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, <del>* FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL <del>* FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN <del>* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN <del>* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <del>* <del>*/ <add> * The examples provided by Facebook are for non-commercial testing and <add> * evaluation purposes only. <add> * <add> * Facebook reserves all rights not expressly granted. <add> * <add> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS <add> * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, <add> * FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL <add> * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN <add> * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN <add> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <add> * <add> * @providesModule RefreshControlExample <add> */ <ide> 'use strict'; <ide> <ide> const React = require('react'); <ide><path>Examples/UIExplorer/js/RootViewSizeFlexibilityExampleApp.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule RootViewSizeFlexibilityExampleApp <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/ScrollViewExample.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule ScrollViewExample <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/ScrollViewSimpleExample.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule ScrollViewSimpleExample <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/SectionListExample.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule SectionListExample <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/SegmentedControlIOSExample.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule SegmentedControlIOSExample <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/SetPropertiesExampleApp.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule SetPropertiesExampleApp <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/ShareExample.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule ShareExample <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/SliderExample.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule SliderExample <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/SnapshotExample.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule SnapshotExample <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/StatusBarExample.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule StatusBarExample <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/SwipeableListViewExample.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule SwipeableListViewExample <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/SwitchExample.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule SwitchExample <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/TabBarIOSExample.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule TabBarIOSExample <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/TextExample.android.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule TextExample <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/TextExample.ios.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule TextExample <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/TextInputExample.android.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule TextInputExample <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/TextInputExample.ios.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule TextInputExample <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/TimePickerAndroidExample.js <ide> * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN <ide> * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <add> * @providesModule TimePickerAndroidExample <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/TimerExample.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule TimerExample <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/ToastAndroidExample.android.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule ToastAndroidExample <ide> */ <ide> <ide> 'use strict'; <ide><path>Examples/UIExplorer/js/ToolbarAndroidExample.android.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule ToolbarAndroidExample <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/TouchableExample.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule TouchableExample <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/TransformExample.js <ide> * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * @flow <add> * @providesModule TransformExample <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/TransparentHitTestExample.js <ide> * of patent rights can be found in the PATENTS file in the same directory. <ide> * <ide> * @flow <add> * @providesModule TransparentHitTestExample <ide> */ <ide> <ide> 'use strict'; <ide><path>Examples/UIExplorer/js/UIExplorerActions.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule UIExplorerActions <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/UIExplorerButton.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule UIExplorerButton <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/UIExplorerExampleList.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule UIExplorerExampleList <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/UIExplorerList.android.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule UIExplorerList <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/UIExplorerList.ios.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule UIExplorerList <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/UIExplorerNavigationReducer.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule UIExplorerNavigationReducer <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/UIExplorerStatePersister.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule UIExplorerStatePersister <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/UIExplorerStateTitleMap.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule UIExplorerStateTitleMap <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/URIActionMap.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule URIActionMap <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/VibrationExample.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule VibrationExample <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/VibrationIOSExample.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule VibrationIOSExample <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/ViewExample.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule ViewExample <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/ViewPagerAndroidExample.android.js <ide> * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <add> * @providesModule ViewPagerAndroidExample <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/WebSocketExample.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule WebSocketExample <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/WebViewExample.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule WebViewExample <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/XHRExample.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule XHRExample <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/XHRExampleBinaryUpload.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule XHRExampleBinaryUpload <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/XHRExampleCookies.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule XHRExampleCookies <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/XHRExampleDownload.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule XHRExampleDownload <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/XHRExampleFetch.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule XHRExampleFetch <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/XHRExampleFormData.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule XHRExampleFormData <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/XHRExampleHeaders.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @noflow <add> * @providesModule XHRExampleHeaders <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/XHRExampleOnTimeOut.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule XHRExampleOnTimeOut <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/http_test_server.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule http_test_server <ide> */ <ide> 'use strict'; <ide> <ide><path>Examples/UIExplorer/js/websocket_test_server.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule websocket_test_server <ide> */ <ide> 'use strict'; <ide> <ide><path>IntegrationTests/AsyncStorageTest.js <ide> * of patent rights can be found in the PATENTS file in the same directory. <ide> * <ide> * @flow <add> * @providesModule AsyncStorageTest <ide> */ <ide> 'use strict'; <ide> <ide><path>IntegrationTests/ImageCachePolicyTest.js <ide> * of patent rights can be found in the PATENTS file in the same directory. <ide> * <ide> * @flow <add> * @providesModule ImageCachePolicyTest <ide> */ <ide> 'use strict'; <ide> <ide><path>IntegrationTests/ImageSnapshotTest.js <ide> * of patent rights can be found in the PATENTS file in the same directory. <ide> * <ide> * @flow <add> * @providesModule ImageSnapshotTest <ide> */ <ide> 'use strict'; <ide> <ide><path>IntegrationTests/IntegrationTestHarnessTest.js <ide> * of patent rights can be found in the PATENTS file in the same directory. <ide> * <ide> * @flow <add> * @providesModule IntegrationTestHarnessTest <ide> */ <ide> 'use strict'; <ide> <ide><path>IntegrationTests/IntegrationTestsApp.js <ide> * of patent rights can be found in the PATENTS file in the same directory. <ide> * <ide> * @flow <add> * @providesModule IntegrationTestsApp <ide> */ <ide> 'use strict'; <ide> <ide><path>IntegrationTests/PromiseTest.js <ide> * of patent rights can be found in the PATENTS file in the same directory. <ide> * <ide> * @flow <add> * @providesModule PromiseTest <ide> */ <ide> 'use strict'; <ide> <ide><path>IntegrationTests/PropertiesUpdateTest.js <ide> * This source code is licensed under the BSD-style license found in the <ide> * LICENSE file in the root directory of this source tree. An additional grant <ide> * of patent rights can be found in the PATENTS file in the same directory. <add> * @providesModule PropertiesUpdateTest <ide> */ <ide> 'use strict'; <ide> <ide><path>IntegrationTests/ReactContentSizeUpdateTest.js <ide> * This source code is licensed under the BSD-style license found in the <ide> * LICENSE file in the root directory of this source tree. An additional grant <ide> * of patent rights can be found in the PATENTS file in the same directory. <add> * @providesModule ReactContentSizeUpdateTest <ide> */ <ide> 'use strict'; <ide> <ide><path>IntegrationTests/SimpleSnapshotTest.js <ide> * of patent rights can be found in the PATENTS file in the same directory. <ide> * <ide> * @flow <add> * @providesModule SimpleSnapshotTest <ide> */ <ide> 'use strict'; <ide> <ide><path>IntegrationTests/SizeFlexibilityUpdateTest.js <ide> * This source code is licensed under the BSD-style license found in the <ide> * LICENSE file in the root directory of this source tree. An additional grant <ide> * of patent rights can be found in the PATENTS file in the same directory. <add> * @providesModule SizeFlexibilityUpdateTest <ide> */ <ide> 'use strict'; <ide> <ide><path>IntegrationTests/TimersTest.js <ide> * of patent rights can be found in the PATENTS file in the same directory. <ide> * <ide> * @flow <add> * @providesModule TimersTest <ide> */ <ide> 'use strict'; <ide> <ide><path>IntegrationTests/WebSocketTest.js <ide> * of patent rights can be found in the PATENTS file in the same directory. <ide> * <ide> * @flow <add> * @providesModule WebSocketTest <ide> */ <ide> 'use strict'; <ide> <ide><path>IntegrationTests/websocket_integration_test_server.js <ide> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> * <ide> * @flow <add> * @providesModule websocket_integration_test_server <ide> */ <ide> 'use strict'; <ide> <ide><path>Libraries/Animated/release/gulpfile.js <ide> * This source code is licensed under the BSD-style license found in the <ide> * LICENSE file in the root directory of this source tree. An additional grant <ide> * of patent rights can be found in the PATENTS file in the same directory. <add> * @providesModule gulpfile <ide> */ <ide> <ide> 'use strict'; <ide><path>Libraries/Animated/src/AnimatedWeb.js <ide> * of patent rights can be found in the PATENTS file in the same directory. <ide> * <ide> * @flow <add> * @providesModule AnimatedWeb <ide> */ <ide> 'use strict'; <ide> <ide><path>Libraries/react-native/react-native-interface.js <ide> * of patent rights can be found in the PATENTS file in the same directory. <ide> * <ide> * @flow <add> * @providesModule react-native-interface <ide> */ <ide> 'use strict'; <ide> <ide><path>ReactAndroid/src/androidTest/js/TestBundle.js <ide> * LICENSE file in the root directory of this source tree. An additional grant <ide> * of patent rights can be found in the PATENTS file in the same directory. <ide> * <add> * @providesModule TestBundle <ide> */ <ide> 'use strict'; <ide>
127
Ruby
Ruby
support mailer tests using spec dsl
58434e05fe828a89ac11dd4aa051bd1d5d1cfb09
<ide><path>actionmailer/lib/action_mailer/test_case.rb <ide> def mailer_class <ide> end <ide> <ide> def determine_default_mailer(name) <del> name.sub(/Test$/, '').constantize <del> rescue NameError <del> raise NonInferrableMailerError.new(name) <add> mailer = determine_constant_from_test_name(name) do |constant| <add> Class === constant && constant < ActionMailer::Base <add> end <add> raise NonInferrableMailerError.new(name) if mailer.nil? <add> mailer <ide> end <ide> end <ide> <ide><path>actionmailer/test/test_test.rb <ide> def test_set_mailer_class_manual_using_string <ide> assert_equal TestTestMailer, self.class.mailer_class <ide> end <ide> end <add> <add>describe TestTestMailer do <add> it "gets the mailer from the test name" do <add> assert_equal TestTestMailer, self.class.mailer_class <add> end <add>end <add> <add>describe TestTestMailer, :action do <add> it "gets the mailer from the test name" do <add> assert_equal TestTestMailer, self.class.mailer_class <add> end <add>end <add> <add>describe TestTestMailer do <add> describe "nested" do <add> it "gets the mailer from the test name" do <add> assert_equal TestTestMailer, self.class.mailer_class <add> end <add> end <add>end <add> <add>describe TestTestMailer, :action do <add> describe "nested" do <add> it "gets the mailer from the test name" do <add> assert_equal TestTestMailer, self.class.mailer_class <add> end <add> end <add>end <add> <add>describe "TestTestMailer" do <add> it "gets the mailer from the test name" do <add> assert_equal TestTestMailer, self.class.mailer_class <add> end <add>end <add> <add>describe "TestTestMailerTest" do <add> it "gets the mailer from the test name" do <add> assert_equal TestTestMailer, self.class.mailer_class <add> end <add>end <add> <add>describe "TestTestMailer" do <add> describe "nested" do <add> it "gets the mailer from the test name" do <add> assert_equal TestTestMailer, self.class.mailer_class <add> end <add> end <add>end <add> <add>describe "TestTestMailerTest" do <add> describe "nested" do <add> it "gets the mailer from the test name" do <add> assert_equal TestTestMailer, self.class.mailer_class <add> end <add> end <add>end <add> <add>describe "AnotherCrazySymbolNameMailerTest" do <add> tests :test_test_mailer <add> <add> it "gets the mailer after setting it with a symbol" do <add> assert_equal TestTestMailer, self.class.mailer_class <add> end <add>end <add> <add>describe "AnotherCrazyStringNameMailerTest" do <add> tests 'test_test_mailer' <add> <add> it "gets the mailer after setting it with a string" do <add> assert_equal TestTestMailer, self.class.mailer_class <add> end <add>end <add> <add>describe "Another Crazy Name Mailer Test" do <add> tests TestTestMailer <add> <add> it "gets the mailer after setting it manually" do <add> assert_equal TestTestMailer, self.class.mailer_class <add> end <add>end <add> <add>describe "Another Crazy Symbol Name Mailer Test" do <add> tests :test_test_mailer <add> <add> it "gets the mailer after setting it with a symbol" do <add> assert_equal TestTestMailer, self.class.mailer_class <add> end <add>end <add> <add>describe "Another Crazy String Name Mailer Test" do <add> tests 'test_test_mailer' <add> <add> it "gets the mailer after setting it with a string" do <add> assert_equal TestTestMailer, self.class.mailer_class <add> end <add>end <add> <add>describe "AnotherCrazySymbolNameMailerTest" do <add> tests :test_test_mailer <add> <add> describe "nested" do <add> it "gets the mailer after setting it with a symbol" do <add> assert_equal TestTestMailer, self.class.mailer_class <add> end <add> end <add>end <add> <add>describe "AnotherCrazyStringNameMailerTest" do <add> tests 'test_test_mailer' <add> <add> describe "nested" do <add> it "gets the mailer after setting it with a string" do <add> assert_equal TestTestMailer, self.class.mailer_class <add> end <add> end <add>end <add> <add>describe "Another Crazy Name Mailer Test" do <add> tests TestTestMailer <add> <add> describe "nested" do <add> it "gets the mailer after setting it manually" do <add> assert_equal TestTestMailer, self.class.mailer_class <add> end <add> end <add>end <add> <add>describe "Another Crazy Symbol Name Mailer Test" do <add> tests :test_test_mailer <add> <add> describe "nested" do <add> it "gets the mailer after setting it with a symbol" do <add> assert_equal TestTestMailer, self.class.mailer_class <add> end <add> end <add>end <add> <add>describe "Another Crazy String Name Mailer Test" do <add> tests 'test_test_mailer' <add> <add> it "gets the mailer after setting it with a string" do <add> assert_equal TestTestMailer, self.class.mailer_class <add> end <add>end
2
PHP
PHP
remove unneeded tests
6bae9b5b2c60767d91ed18f198859998af4d81f4
<ide><path>tests/Database/DatabaseMigrationMakeCommandTest.php <ide> public function testBasicCreateGivesCreatorProperArgumentsWhenTableIsSet() <ide> } <ide> <ide> <del> public function testPackagePathsMayBeUsed() <del> { <del> $command = new DatabaseMigrationMakeCommandTestStub($creator = m::mock('Illuminate\Database\Migrations\MigrationCreator'), __DIR__.'/vendor'); <del> $app = new Illuminate\Container\Container; <del> $app['path.database'] = __DIR__; <del> $command->setLaravel($app); <del> $creator->shouldReceive('create')->once()->with('create_foo', __DIR__.'/vendor/bar/src/migrations', null, false); <del> <del> $this->runCommand($command, array('name' => 'create_foo', '--package' => 'bar')); <del> } <del> <del> <del> public function testPackageFallsBackToVendorDirWhenNotExplicit() <del> { <del> $command = new DatabaseMigrationMakeCommandTestStub($creator = m::mock('Illuminate\Database\Migrations\MigrationCreator'), __DIR__.'/vendor'); <del> $command->setLaravel(new Illuminate\Container\Container); <del> $creator->shouldReceive('create')->once()->with('create_foo', __DIR__.'/vendor/foo/bar/src/migrations', null, false); <del> <del> $this->runCommand($command, array('name' => 'create_foo', '--package' => 'foo/bar')); <del> } <del> <del> <ide> protected function runCommand($command, $input = array()) <ide> { <ide> return $command->run(new Symfony\Component\Console\Input\ArrayInput($input), new Symfony\Component\Console\Output\NullOutput); <ide><path>tests/Database/DatabaseMigrationMigrateCommandTest.php <ide> public function testMigrationRepositoryCreatedWhenNecessary() <ide> } <ide> <ide> <del> public function testPackageIsRespectedWhenMigrating() <del> { <del> $command = new MigrateCommand($migrator = m::mock('Illuminate\Database\Migrations\Migrator'), __DIR__.'/vendor'); <del> $command->setLaravel(new ApplicationDatabaseMigrationStub()); <del> $migrator->shouldReceive('setConnection')->once()->with(null); <del> $migrator->shouldReceive('run')->once()->with(__DIR__.'/vendor/bar/src/migrations', false); <del> $migrator->shouldReceive('getNotes')->andReturn(array()); <del> $migrator->shouldReceive('repositoryExists')->once()->andReturn(true); <del> <del> $this->runCommand($command, array('--package' => 'bar')); <del> } <del> <del> <del> public function testVendorPackageIsRespectedWhenMigrating() <del> { <del> $command = new MigrateCommand($migrator = m::mock('Illuminate\Database\Migrations\Migrator'), __DIR__.'/vendor'); <del> $command->setLaravel(new ApplicationDatabaseMigrationStub()); <del> $migrator->shouldReceive('setConnection')->once()->with(null); <del> $migrator->shouldReceive('run')->once()->with(__DIR__.'/vendor/foo/bar/src/migrations', false); <del> $migrator->shouldReceive('getNotes')->andReturn(array()); <del> $migrator->shouldReceive('repositoryExists')->once()->andReturn(true); <del> <del> $this->runCommand($command, array('--package' => 'foo/bar')); <del> } <del> <del> <ide> public function testTheCommandMayBePretended() <ide> { <ide> $command = new MigrateCommand($migrator = m::mock('Illuminate\Database\Migrations\Migrator'), __DIR__.'/vendor'); <ide><path>tests/Support/SupportServiceProviderTest.php <del><?php <del> <del>class SupportServiceProviderTest extends PHPUnit_Framework_TestCase { <del> <del> public static function setUpBeforeClass() <del> { <del> require_once __DIR__.'/stubs/providers/SuperProvider.php'; <del> require_once __DIR__.'/stubs/providers/SuperSuperProvider.php'; <del> } <del> <del> <del> public function testPackageNameCanBeGuessed() <del> { <del> $superProvider = new SuperProvider(null); <del> $this->assertEquals(realpath(__DIR__.'/'), $superProvider->guessPackagePath()); <del> <del> $superSuperProvider = new SuperSuperProvider(null); <del> $this->assertEquals(realpath(__DIR__.'/'), $superSuperProvider->guessPackagePath()); <del> } <del> <del>}
3
Text
Text
add v3.7.2 to changelog.md
45b1f2e0c40a563471f9b13bdb4c0f73fcd2639c
<ide><path>CHANGELOG.md <ide> - [#17357](https://github.com/emberjs/ember.js/pull/17357) Allow notifyPropertyChange to be imported from @ember/object <ide> - [#17413](https://github.com/emberjs/ember.js/pull/17413) Fix missing import in instance-initializer blueprint for ember-mocha <ide> <add>### v3.7.2 (January 22, 2019) <add> <add>* Upgrade @glimmer/* packages to 0.35.10. Fixes a few issues: <add> * Usage of positional arguments with custom components. <add> * Forwarding attributes via `...attributes` to a dynamic component. <add> * Prevent errors when rendering many template blocks (`Error: Operand over 16-bits. Got 65536`). <add> <ide> ### v3.7.1 (January 21, 2019) <ide> <ide> - [#17461](https://github.com/emberjs/ember.js/pull/17461) [BUGFIX] Fix substate interactions with aborts
1
Go
Go
update push to use mount blob endpoint
e9b590d85e9c622316b8be71004737f63e6b9503
<ide><path>graph/push.go <ide> func (s *TagStore) CmdPush(job *engine.Job) engine.Status { <ide> return job.Errorf("Could not get tar layer: %s", err) <ide> } <ide> <del> _, err = r.PutV2ImageBlob(remoteName, sumParts[0], manifestSum, utils.ProgressReader(arch, int(img.Size), job.Stdout, sf, false, utils.TruncateID(img.ID), "Pushing"), repoData.Tokens) <add> // Call mount blob <add> exists, err := r.PostV2ImageMountBlob(remoteName, sumParts[0], manifestSum, repoData.Tokens) <ide> if err != nil { <ide> job.Stdout.Write(sf.FormatProgress(utils.TruncateID(img.ID), "Image push failed", nil)) <ide> return job.Error(err) <ide> } <del> job.Stdout.Write(sf.FormatProgress(utils.TruncateID(img.ID), "Image successfully pushed", nil)) <add> if !exists { <add> _, err = r.PutV2ImageBlob(remoteName, sumParts[0], manifestSum, utils.ProgressReader(arch, int(img.Size), job.Stdout, sf, false, utils.TruncateID(img.ID), "Pushing"), repoData.Tokens) <add> if err != nil { <add> job.Stdout.Write(sf.FormatProgress(utils.TruncateID(img.ID), "Image push failed", nil)) <add> return job.Error(err) <add> } <add> job.Stdout.Write(sf.FormatProgress(utils.TruncateID(img.ID), "Image successfully pushed", nil)) <add> } else { <add> job.Stdout.Write(sf.FormatProgress(utils.TruncateID(img.ID), "Image already exists", nil)) <add> } <ide> } <ide> <ide> // push the manifest <ide><path>registry/session_v2.go <ide> func newV2RegistryRouter() *mux.Router { <ide> v2Router.Path("/blob/{imagename:[a-z0-9-._/]+}/{sumtype:[a-z0-9._+-]+}").Name("uploadBlob") <ide> <ide> // Mounting a blob in an image <del> v2Router.Path("/mountblob/{imagename:[a-z0-9-._/]+}/{sumtype:[a-z0-9._+-]+}/{sum:[a-fA-F0-9]{4,}}").Name("mountBlob") <add> v2Router.Path("/blob/{imagename:[a-z0-9-._/]+}/{sumtype:[a-z0-9._+-]+}/{sum:[a-fA-F0-9]{4,}}").Name("mountBlob") <ide> <ide> return router <ide> } <ide> func (r *Session) PostV2ImageMountBlob(imageName, sumType, sum string, token []s <ide> case 200: <ide> // return something indicating no push needed <ide> return true, nil <del> case 300: <add> case 404: <ide> // return something indicating blob push needed <ide> return false, nil <ide> }
2
Text
Text
pass the resource to the url helper [ci skip]
538bd3633bd4dc1a32eabdc71d8d2a3ed7b72812
<ide><path>guides/source/getting_started.md <ide> it look as follows: <ide> ```html+erb <ide> <h1>Editing post</h1> <ide> <del><%= form_for :post, url: post_path(@post.id), method: :patch do |f| %> <add><%= form_for :post, url: post_path(@post), method: :patch do |f| %> <ide> <% if @post.errors.any? %> <ide> <div id="error_explanation"> <ide> <h2><%= pluralize(@post.errors.count, "error") %> prohibited
1
Javascript
Javascript
fix large file downloads failing
0f0af55a0aadf3ca1a960de1b6072f6f4175434e
<ide><path>lib/net.js <ide> function afterWrite(status, handle, req, buffer) { <ide> return; <ide> } <ide> <del> timers.active(this); <add> timers.active(self); <ide> <ide> self._pendingWriteReqs--; <ide> <ide><path>test/simple/test-net-write-slow.js <add>// Copyright Joyent, Inc. and other Node contributors. <add>// <add>// Permission is hereby granted, free of charge, to any person obtaining a <add>// copy of this software and associated documentation files (the <add>// "Software"), to deal in the Software without restriction, including <add>// without limitation the rights to use, copy, modify, merge, publish, <add>// distribute, sublicense, and/or sell copies of the Software, and to permit <add>// persons to whom the Software is furnished to do so, subject to the <add>// following conditions: <add>// <add>// The above copyright notice and this permission notice shall be included <add>// in all copies or substantial portions of the Software. <add>// <add>// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS <add>// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF <add>// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN <add>// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, <add>// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR <add>// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE <add>// USE OR OTHER DEALINGS IN THE SOFTWARE. <add> <add>var common = require('../common'); <add>var assert = require('assert'); <add>var net = require('net'); <add> <add>var SIZE = 1E5; <add>var N = 10; <add>var received = 0; <add>var buf = new Buffer(SIZE); <add>buf.fill(0x61); // 'a' <add> <add>var server = net.createServer(function(socket) { <add> socket.setNoDelay(); <add> socket.setTimeout(500); <add> socket.on('timeout', function() { <add> assert.fail(); <add> }); <add> <add> for (var i = 0; i < N; ++i) { <add> socket.write(buf); <add> } <add> socket.end(); <add> <add>}).listen(common.PORT, function() { <add> var conn = net.connect(common.PORT); <add> conn.on('data', function(buf) { <add> received += buf.length; <add> conn.pause(); <add> setTimeout(function() { <add> conn.resume(); <add> }, 50); <add> }); <add> conn.on('end', function() { <add> server.close(); <add> }); <add>}); <add> <add>process.on('exit', function() { <add> assert.equal(received, SIZE * N); <add>});
2
Javascript
Javascript
add types to stats
f89b59919710252f1746606530ac3568c15daf6b
<ide><path>lib/Compilation.js <ide> class Compilation { <ide> this.contextTimestamps = undefined; <ide> /** @type {Set<string>=} */ <ide> this.compilationDependencies = undefined; <add> /** @type {boolean} */ <add> this.needAdditionalPass = false; <ide> /** @private @type {Map<Module, Callback[]>} */ <ide> this._buildingModules = new Map(); <ide> /** @private @type {Map<Module, Callback[]>} */ <ide><path>lib/Stats.js <ide> const RequestShortener = require("./RequestShortener"); <ide> const { formatSize } = require("./SizeFormatHelpers"); <ide> const compareLocations = require("./compareLocations"); <ide> const formatLocation = require("./formatLocation"); <add>const AggressiveSplittingPlugin = require("./optimize/AggressiveSplittingPlugin"); <ide> const identifierUtils = require("./util/identifier"); <ide> <add>/** @typedef {import("./Compilation")} Compilation */ <add> <ide> const optionsOrFallback = (...args) => { <ide> let optionValues = []; <ide> optionValues.push(...args); <ide> const compareId = (a, b) => { <ide> }; <ide> <ide> class Stats { <add> /** <add> * @param {Compilation} compilation webpack compilation <add> */ <ide> constructor(compilation) { <ide> this.compilation = compilation; <ide> this.hash = compilation.hash; <ide> class Stats { <ide> rendered: chunk.rendered, <ide> initial: chunk.canBeInitial(), <ide> entry: chunk.hasRuntime(), <del> recorded: chunk.recorded, <add> recorded: AggressiveSplittingPlugin.wasChunkRecorded(chunk), <ide> reason: chunk.chunkReason, <ide> size: chunk.modulesSize(), <ide> names: chunk.name ? [chunk.name] : [], <ide> class Stats { <ide> ? origin.module.readableIdentifier(requestShortener) <ide> : "", <ide> loc: formatLocation(origin.loc), <del> request: origin.request, <del> reasons: origin.reasons || [] <add> request: origin.request <ide> })) <ide> .sort((a, b) => { <ide> if ( <ide><path>lib/optimize/AggressiveSplittingPlugin.js <ide> const schema = require("../../schemas/plugins/optimize/AggressiveSplittingPlugin <ide> const { intersect } = require("../util/SetHelpers"); <ide> const identifierUtils = require("../util/identifier"); <ide> <add>/** @typedef {import("../Chunk")} Chunk */ <add> <ide> const moveModuleBetween = (oldChunk, newChunk) => { <ide> return module => { <ide> oldChunk.moveModule(module, newChunk); <ide> const isNotAEntryModule = entryModule => { <ide> }; <ide> }; <ide> <add>/** @type {WeakSet<Chunk>} */ <add>const recordedChunks = new WeakSet(); <add> <ide> class AggressiveSplittingPlugin { <ide> constructor(options) { <ide> validateOptions(schema, options || {}, "Aggressive Splitting Plugin"); <ide> class AggressiveSplittingPlugin { <ide> this.options.entryChunkMultiplicator = 1; <ide> } <ide> } <add> <add> /** <add> * @param {Chunk} chunk the chunk to test <add> * @returns {boolean} true if the chunk was recorded <add> */ <add> static wasChunkRecorded(chunk) { <add> return recordedChunks.has(chunk); <add> } <add> <ide> apply(compiler) { <ide> compiler.hooks.thisCompilation.tap( <ide> "AggressiveSplittingPlugin", <ide> class AggressiveSplittingPlugin { <ide> splitData.id = chunk.id; <ide> allSplits.add(splitData); <ide> // set flag for stats <del> chunk.recorded = true; <add> recordedChunks.add(chunk); <ide> } <ide> } <ide>
3
Text
Text
fix typo in saving and loading usage docs
cc71ec901f26ae1c3bfb62b6bd776295200f418e
<ide><path>website/docs/usage/saving-loading.md <ide> installed in the same environment – that's it. <ide> <ide> When you load a pipeline, spaCy will generally use its `config.cfg` to set up <ide> the language class and construct the pipeline. The pipeline is specified as a <del>list of strings, e.g. `pipeline = ["tagger", "paser", "ner"]`. For each of those <del>strings, spaCy will call `nlp.add_pipe` and look up the name in all factories <del>defined by the decorators [`@Language.component`](/api/language#component) and <add>list of strings, e.g. `pipeline = ["tagger", "parser", "ner"]`. For each of <add>those strings, spaCy will call `nlp.add_pipe` and look up the name in all <add>factories defined by the decorators <add>[`@Language.component`](/api/language#component) and <ide> [`@Language.factory`](/api/language#factory). This means that you have to import <ide> your custom components _before_ loading the pipeline. <ide>
1
Python
Python
fix long lines
510e383a1e9332fa8e1c74847c8ee3948131c568
<ide><path>numpy/core/tests/test_umath.py <ide> def test_lower_align(self): <ide> <ide> @pytest.mark.parametrize("dtype", ['d', 'f', 'int32', 'int64']) <ide> def test_noncontiguous(self, dtype): <del> data = np.array([-1.0, 1.0, -0.0, 0.0, 2.2251e-308, -2.5, 2.5, -6, 6, <del> -2.2251e-308, -8, 10], dtype=dtype) <del> expect = np.array([1.0, -1.0, 0.0, -0.0, -2.2251e-308, 2.5, -2.5, 6, -6, <del> 2.2251e-308, 8, -10], dtype=dtype) <add> data = np.array([-1.0, 1.0, -0.0, 0.0, 2.2251e-308, -2.5, 2.5, -6, <add> 6, -2.2251e-308, -8, 10], dtype=dtype) <add> expect = np.array([1.0, -1.0, 0.0, -0.0, -2.2251e-308, 2.5, -2.5, 6, <add> -6, 2.2251e-308, 8, -10], dtype=dtype) <ide> out = np.ndarray(data.shape, dtype=dtype) <ide> ncontig_in = data[1::2] <ide> ncontig_out = out[1::2] <ide> contig_in = np.array(ncontig_in) <ide> # contig in, contig out <ide> assert_array_equal(np.negative(contig_in), expect[1::2]) <ide> # contig in, ncontig out <del> assert_array_equal(np.negative(contig_in, out=ncontig_out), expect[1::2]) <add> assert_array_equal(np.negative(contig_in, out=ncontig_out), <add> expect[1::2]) <ide> # ncontig in, contig out <ide> assert_array_equal(np.negative(ncontig_in), expect[1::2]) <ide> # ncontig in, ncontig out <del> assert_array_equal(np.negative(ncontig_in, out=ncontig_out), expect[1::2]) <add> assert_array_equal(np.negative(ncontig_in, out=ncontig_out), <add> expect[1::2]) <ide> # contig in, contig out, nd stride <ide> data_split = np.array(np.array_split(data, 2)) <ide> expect_split = np.array(np.array_split(expect, 2))
1
PHP
PHP
remove extra single quote
5ab11510c4a2d03d41b97670595613722911c376
<ide><path>src/Cache/Cache.php <ide> public static function remember($key, $callable, $config = 'default') { <ide> * Parses a DSN into a valid connection configuration <ide> * <ide> * This method allows setting a DSN using PEAR::DB formatting, with added support for drivers <del> * in the SQLAlchemy format. The following is an example of it's usage: <add> * in the SQLAlchemy format. The following is an example of its usage: <ide> * <ide> * {{{ <ide> * $dsn = 'File:///'; <ide><path>src/Core/StaticConfigTrait.php <ide> public static function configured() { <ide> * Parses a DSN into a valid connection configuration <ide> * <ide> * This method allows setting a DSN using PEAR::DB formatting, with added support for drivers <del> * in the SQLAlchemy format. The following is an example of it's usage: <add> * in the SQLAlchemy format. The following is an example of its usage: <ide> * <ide> * {{{ <ide> * $dsn = 'mysql+Cake\Database\Driver\Mysql://user:password@localhost:3306/database_name'; <ide><path>src/Datasource/ConnectionManager.php <ide> public static function config($key, $config = null) { <ide> * Parses a DSN into a valid connection configuration <ide> * <ide> * This method allows setting a DSN using PEAR::DB formatting, with added support for drivers <del> * in the SQLAlchemy format. The following is an example of it's usage: <add> * in the SQLAlchemy format. The following is an example of its usage: <ide> * <ide> * {{{ <ide> * $dsn = 'mysql+Cake\Database\Driver\Mysql://user:password@localhost:3306/database_name'; <ide><path>src/Log/Log.php <ide> public static function config($key, $config = null) { <ide> * Parses a DSN into a valid connection configuration <ide> * <ide> * This method allows setting a DSN using PEAR::DB formatting, with added support for drivers <del> * in the SQLAlchemy format. The following is an example of it's usage: <add> * in the SQLAlchemy format. The following is an example of its usage: <ide> * <ide> * {{{ <ide> * $dsn = 'Cake\Log\Engine\FileLog://?types=notice,info,debug&file=debug&path=LOGS'; <ide><path>src/Network/Email/Email.php <ide> public static function dropTransport($key) { <ide> * Parses a DSN into a valid connection configuration <ide> * <ide> * This method allows setting a DSN using PEAR::DB formatting, with added support for drivers <del> * in the SQLAlchemy format. The following is an example of it's usage: <add> * in the SQLAlchemy format. The following is an example of its usage: <ide> * <ide> * {{{ <ide> * $dsn = 'mail://user:secret@localhost:25?timeout=30&client=null&tls=null';
5
Javascript
Javascript
use prettier config api
052a5f27f35f453ee33a075df81bddf9ced7300a
<ide><path>.prettierrc.js <add>const {esNextPaths} = require('./scripts/shared/pathsByLanguageVersion'); <add> <add>module.exports = { <add> bracketSpacing: false, <add> singleQuote: true, <add> jsxBracketSameLine: true, <add> trailingComma: 'es5', <add> printWidth: 80, <add> <add> overrides: [ <add> { <add> files: esNextPaths, <add> options: { <add> trailingComma: 'all', <add> }, <add> }, <add> ], <add>}; <ide><path>scripts/prettier/index.js <ide> 'use strict'; <ide> <ide> // Based on similar script in Jest <del>// https://github.com/facebook/jest/blob/master/scripts/prettier.js <add>// https://github.com/facebook/jest/blob/a7acc5ae519613647ff2c253dd21933d6f94b47f/scripts/prettier.js <ide> <ide> const chalk = require('chalk'); <ide> const glob = require('glob'); <ide> const prettier = require('prettier'); <ide> const fs = require('fs'); <ide> const listChangedFiles = require('../shared/listChangedFiles'); <del>const {esNextPaths} = require('../shared/pathsByLanguageVersion'); <add>const prettierConfigPath = require.resolve('../../.prettierrc'); <ide> <ide> const mode = process.argv[2] || 'check'; <ide> const shouldWrite = mode === 'write' || mode === 'write-changed'; <ide> const onlyChanged = mode === 'check-changed' || mode === 'write-changed'; <ide> <del>const defaultOptions = { <del> bracketSpacing: false, <del> singleQuote: true, <del> jsxBracketSameLine: true, <del> trailingComma: 'all', <del> printWidth: 80, <del>}; <del>const config = { <del> default: { <del> patterns: ['**/*.js'], <del> ignore: [ <del> '**/node_modules/**', <del> // ESNext paths can have trailing commas. <del> // We'll handle them separately below. <del> ...esNextPaths, <del> ], <del> options: { <del> trailingComma: 'es5', <del> }, <del> }, <del> esNext: { <del> patterns: [...esNextPaths], <del> ignore: ['**/node_modules/**'], <del> }, <del>}; <del> <ide> const changedFiles = onlyChanged ? listChangedFiles() : null; <ide> let didWarn = false; <ide> let didError = false; <del>Object.keys(config).forEach(key => { <del> const patterns = config[key].patterns; <del> const options = config[key].options; <del> const ignore = config[key].ignore; <ide> <del> const globPattern = <del> patterns.length > 1 ? `{${patterns.join(',')}}` : `${patterns.join(',')}`; <del> const files = glob <del> .sync(globPattern, {ignore}) <del> .filter(f => !onlyChanged || changedFiles.has(f)); <add>const files = glob <add> .sync('**/*.js', {ignore: '**/node_modules/**'}) <add> .filter(f => !onlyChanged || changedFiles.has(f)); <ide> <del> if (!files.length) { <del> return; <del> } <add>if (!files.length) { <add> return; <add>} <ide> <del> const args = Object.assign({}, defaultOptions, options); <del> files.forEach(file => { <del> try { <del> const input = fs.readFileSync(file, 'utf8'); <del> if (shouldWrite) { <del> const output = prettier.format(input, args); <del> if (output !== input) { <del> fs.writeFileSync(file, output, 'utf8'); <del> } <del> } else { <del> if (!prettier.check(input, args)) { <del> if (!didWarn) { <del> console.log( <del> '\n' + <del> chalk.red( <del> ` This project uses prettier to format all JavaScript code.\n` <del> ) + <del> chalk.dim(` Please run `) + <del> chalk.reset('yarn prettier-all') + <del> chalk.dim( <del> ` and add changes to files listed below to your commit:` <del> ) + <del> `\n\n` <del> ); <del> didWarn = true; <del> } <del> console.log(file); <add>files.forEach(file => { <add> const options = prettier.resolveConfig.sync(file, { <add> config: prettierConfigPath, <add> }); <add> try { <add> const input = fs.readFileSync(file, 'utf8'); <add> if (shouldWrite) { <add> const output = prettier.format(input, options); <add> if (output !== input) { <add> fs.writeFileSync(file, output, 'utf8'); <add> } <add> } else { <add> if (!prettier.check(input, options)) { <add> if (!didWarn) { <add> console.log( <add> '\n' + <add> chalk.red( <add> ` This project uses prettier to format all JavaScript code.\n` <add> ) + <add> chalk.dim(` Please run `) + <add> chalk.reset('yarn prettier-all') + <add> chalk.dim( <add> ` and add changes to files listed below to your commit:` <add> ) + <add> `\n\n` <add> ); <add> didWarn = true; <ide> } <add> console.log(file); <ide> } <del> } catch (error) { <del> didError = true; <del> console.log('\n\n' + error.message); <del> console.log(file); <ide> } <del> }); <add> } catch (error) { <add> didError = true; <add> console.log('\n\n' + error.message); <add> console.log(file); <add> } <ide> }); <ide> <ide> if (didWarn || didError) {
2
Text
Text
add license report and scan status
5acc5c53a2d35b2a7bec12b919fd2d27522bd5f6
<ide><path>README.md <ide> <ide> [![NPM version][npm-version-image]][npm-url] [![NPM downloads][npm-downloads-image]][npm-url] [![MIT License][license-image]][license-url] [![Build Status][travis-image]][travis-url] <ide> [![Coverage Status](https://coveralls.io/repos/moment/moment/badge.svg?branch=develop)](https://coveralls.io/r/moment/moment?branch=develop) <add>[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fmoment%2Fmoment.svg?type=shield)](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fmoment%2Fmoment?ref=badge_shield) <ide> <ide> A lightweight JavaScript date library for parsing, validating, manipulating, and formatting dates. <ide> <ide> write to [ichernev](https://github.com/ichernev). <ide> <ide> Moment.js is freely distributable under the terms of the [MIT license](https://github.com/moment/moment/blob/develop/LICENSE). <ide> <add>[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fmoment%2Fmoment.svg?type=large)](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fmoment%2Fmoment?ref=badge_large) <add> <ide> [license-image]: http://img.shields.io/badge/license-MIT-blue.svg?style=flat <ide> [license-url]: LICENSE <ide>
1
Ruby
Ruby
remove redundant check for frozen keys on deep dup
96c52a9d3c170b0bebdacba6e295153bc753afce
<ide><path>activesupport/lib/active_support/core_ext/object/deep_dup.rb <ide> class Hash <ide> def deep_dup <ide> hash = dup <ide> each_pair do |key, value| <del> if (::String === key && key.frozen?) || ::Symbol === key <add> if ::String === key || ::Symbol === key <ide> hash[key] = value.deep_dup <ide> else <ide> hash.delete(key)
1
Javascript
Javascript
expand selections on mouse drag
5594c9d82f26f024895181ddc88d0dd0d396297f
<ide><path>spec/text-editor-component-spec.js <ide> describe('TextEditorComponent', () => { <ide> }, clientPositionForCharacter(component, 3, 11))) <ide> expect(editor.getSelectedScreenRange()).toEqual([[2, 0], [4, 0]]) <ide> }) <add> <add> it('expands the last selection on drag', () => { <add> const {component, editor} = buildComponent() <add> spyOn(component, 'handleMouseDragUntilMouseUp') <add> <add> component.didMouseDownOnContent(Object.assign({ <add> detail: 1, <add> }, clientPositionForCharacter(component, 1, 4))) <add> <add> { <add> const [didDrag, didStopDragging] = component.handleMouseDragUntilMouseUp.argsForCall[0] <add> didDrag(clientPositionForCharacter(component, 8, 8)) <add> expect(editor.getSelectedScreenRange()).toEqual([[1, 4], [8, 8]]) <add> didDrag(clientPositionForCharacter(component, 4, 8)) <add> expect(editor.getSelectedScreenRange()).toEqual([[1, 4], [4, 8]]) <add> didStopDragging() <add> expect(editor.getSelectedScreenRange()).toEqual([[1, 4], [4, 8]]) <add> } <add> <add> // Click-drag a second selection... selections are not merged until the <add> // drag stops. <add> component.didMouseDownOnContent(Object.assign({ <add> detail: 1, <add> metaKey: 1, <add> }, clientPositionForCharacter(component, 8, 8))) <add> { <add> const [didDrag, didStopDragging] = component.handleMouseDragUntilMouseUp.argsForCall[1] <add> didDrag(clientPositionForCharacter(component, 2, 8)) <add> expect(editor.getSelectedScreenRanges()).toEqual([ <add> [[1, 4], [4, 8]], <add> [[2, 8], [8, 8]] <add> ]) <add> didDrag(clientPositionForCharacter(component, 6, 8)) <add> expect(editor.getSelectedScreenRanges()).toEqual([ <add> [[1, 4], [4, 8]], <add> [[6, 8], [8, 8]] <add> ]) <add> didDrag(clientPositionForCharacter(component, 2, 8)) <add> expect(editor.getSelectedScreenRanges()).toEqual([ <add> [[1, 4], [4, 8]], <add> [[2, 8], [8, 8]] <add> ]) <add> didStopDragging() <add> expect(editor.getSelectedScreenRanges()).toEqual([ <add> [[1, 4], [8, 8]] <add> ]) <add> } <add> }) <add> <add> it('expands the selection word-wise on double-click-drag', () => { <add> const {component, editor} = buildComponent() <add> spyOn(component, 'handleMouseDragUntilMouseUp') <add> <add> component.didMouseDownOnContent(Object.assign({ <add> detail: 1, <add> }, clientPositionForCharacter(component, 1, 4))) <add> component.didMouseDownOnContent(Object.assign({ <add> detail: 2, <add> }, clientPositionForCharacter(component, 1, 4))) <add> <add> const [didDrag, didStopDragging] = component.handleMouseDragUntilMouseUp.argsForCall[1] <add> didDrag(clientPositionForCharacter(component, 0, 8)) <add> expect(editor.getSelectedScreenRange()).toEqual([[0, 4], [1, 5]]) <add> didDrag(clientPositionForCharacter(component, 2, 10)) <add> expect(editor.getSelectedScreenRange()).toEqual([[1, 2], [2, 13]]) <add> }) <add> <add> it('expands the selection line-wise on triple-click-drag', () => { <add> const {component, editor} = buildComponent() <add> spyOn(component, 'handleMouseDragUntilMouseUp') <add> <add> const tripleClickPosition = clientPositionForCharacter(component, 2, 8) <add> component.didMouseDownOnContent(Object.assign({detail: 1}, tripleClickPosition)) <add> component.didMouseDownOnContent(Object.assign({detail: 2}, tripleClickPosition)) <add> component.didMouseDownOnContent(Object.assign({detail: 3}, tripleClickPosition)) <add> <add> const [didDrag, didStopDragging] = component.handleMouseDragUntilMouseUp.argsForCall[2] <add> didDrag(clientPositionForCharacter(component, 1, 8)) <add> expect(editor.getSelectedScreenRange()).toEqual([[1, 0], [3, 0]]) <add> didDrag(clientPositionForCharacter(component, 4, 10)) <add> expect(editor.getSelectedScreenRange()).toEqual([[2, 0], [5, 0]]) <add> }) <ide> }) <ide> }) <ide> <ide><path>src/text-editor-component.js <ide> class TextEditorComponent { <ide> model.getLastSelection().selectLine(null, {autoscroll: false}) <ide> break <ide> } <add> <add> this.handleMouseDragUntilMouseUp( <add> (event) => { <add> const screenPosition = this.screenPositionForMouseEvent(event) <add> model.selectToScreenPosition(screenPosition, {suppressSelectionMerge: true, autoscroll: false}) <add> this.updateSync() <add> }, <add> () => { <add> model.finalizeSelections() <add> model.mergeIntersectingSelections() <add> this.updateSync() <add> } <add> ) <add> } <add> <add> handleMouseDragUntilMouseUp (didDragCallback, didStopDragging) { <add> let dragging = false <add> let lastMousemoveEvent <add> <add> const animationFrameLoop = () => { <add> window.requestAnimationFrame(() => { <add> if (dragging && this.visible) { <add> didDragCallback(lastMousemoveEvent) <add> animationFrameLoop() <add> } <add> }) <add> } <add> <add> function didMouseMove (event) { <add> lastMousemoveEvent = event <add> if (!dragging) { <add> dragging = true <add> animationFrameLoop() <add> } <add> } <add> <add> function didMouseUp () { <add> window.removeEventListener('mousemove', didMouseMove) <add> window.removeEventListener('mouseup', didMouseUp) <add> if (dragging) { <add> dragging = false <add> didStopDragging() <add> } <add> } <add> <add> window.addEventListener('mousemove', didMouseMove) <add> window.addEventListener('mouseup', didMouseUp) <ide> } <ide> <ide> screenPositionForMouseEvent ({clientX, clientY}) {
2
PHP
PHP
add viewbuilder serializer
4eecd3a901ebd67d67a7a4f4b10cd640c762f67a
<ide><path>src/Mailer/Email.php <ide> protected function _getContentTypeCharset() <ide> public function jsonSerialize() <ide> { <ide> $properties = [ <del> '_to', '_from', '_sender', '_replyTo', '_cc', '_bcc', '_subject', '_returnPath', '_readReceipt', <del> '_template', '_layout', '_viewRender', '_viewVars', '_theme', '_helpers', '_emailFormat', <del> '_emailPattern', '_attachments', '_domain', '_messageId', '_headers', 'charset', 'headerCharset', <add> '_to', '_from', '_sender', '_replyTo', '_cc', '_bcc', '_subject', <add> '_returnPath', '_readReceipt', '_emailFormat', '_emailPattern', '_domain', <add> '_attachments', '_messageId', '_headers', 'viewVars', 'charset', 'headerCharset' <ide> ]; <ide> <del> $array = []; <add> $array = ['viewConfig' => $this->viewBuilder()->jsonSerialize()]; <ide> <ide> foreach ($properties as $property) { <ide> $array[$property] = $this->{$property}; <ide> public function jsonSerialize() <ide> } <ide> }); <ide> <del> array_walk_recursive($array['_viewVars'], [$this, '_checkViewVars']); <add> array_walk_recursive($array['viewVars'], [$this, '_checkViewVars']); <ide> <ide> return array_filter($array, function ($i) { <ide> return !is_array($i) && strlen($i) || !empty($i); <ide> protected function _checkViewVars(&$item, $key) <ide> */ <ide> public function createFromArray($config) <ide> { <add> if (isset($config['viewConfig'])) { <add> $this->viewBuilder()->createFromArray($config['viewConfig']); <add> unset($config['viewConfig']); <add> } <add> <ide> foreach ($config as $property => $value) { <ide> $this->{$property} = $value; <ide> } <ide><path>src/View/ViewBuilder.php <ide> use Cake\Network\Response; <ide> use Cake\View\Exception\MissingViewException; <ide> use Cake\View\View; <add>use JsonSerializable; <add>use Serializable; <ide> <ide> /** <ide> * Provides an API for iteratively building a view up. <ide> * <ide> * Once you have configured the view and established all the context <ide> * you can create a view instance with `build()`. <ide> */ <del>class ViewBuilder <add>class ViewBuilder implements JsonSerializable, Serializable <ide> { <ide> /** <ide> * The subdirectory to the template. <ide> public function build($vars = [], Request $request = null, Response $response = <ide> $data += $this->_options; <ide> return new $className($request, $response, $events, $data); <ide> } <add> <add> /** <add> * Serializes the view builder object to a value that can be natively <add> * serialized and re-used to clone this builder instance. <add> * <add> * @return array Serializable array of configuration properties. <add> */ <add> public function jsonSerialize() <add> { <add> $properties = [ <add> '_templatePath', '_template', '_plugin', '_theme', '_layout', '_autoLayout', <add> '_layoutPath', '_name', '_className', '_options', '_helpers' <add> ]; <add> <add> $array = []; <add> <add> foreach ($properties as $property) { <add> $array[$property] = $this->{$property}; <add> } <add> <add> return array_filter($array, function ($i) { <add> return !is_array($i) && strlen($i) || !empty($i); <add> }); <add> } <add> <add> /** <add> * Configures a view builder instance from serialized config. <add> * <add> * @param array $config View builder configuration array. <add> * @return $this Configured view builder instance. <add> */ <add> public function createFromArray($config) <add> { <add> foreach ($config as $property => $value) { <add> $this->{$property} = $value; <add> } <add> <add> return $this; <add> } <add> <add> /** <add> * Serializes the view builder object. <add> * <add> * @return void <add> */ <add> public function serialize() <add> { <add> $array = $this->jsonSerialize(); <add> return serialize($array); <add> } <add> <add> /** <add> * Unserializes the view builder object. <add> * <add> * @param string $data Serialized string. <add> * @return $this Configured view builder instance. <add> */ <add> public function unserialize($data) <add> { <add> return $this->createFromArray(unserialize($data)); <add> } <ide> } <ide><path>tests/TestCase/Mailer/EmailTest.php <ide> public function testJsonSerialize() <ide> ->cc(['mark@cakephp.org', 'juan@cakephp.org' => 'Juan Basso']) <ide> ->bcc('phpnut@cakephp.org') <ide> ->subject('Test Serialize') <del> ->template('default', 'test') <ide> ->messageId('<uuid@server.com>') <ide> ->domain('foo.bar') <ide> ->viewVars([ <ide> public function testJsonSerialize() <ide> ] <ide> ]); <ide> <add> $this->CakeEmail->viewBuilder() <add> ->template('default') <add> ->layout('test'); <add> <ide> $result = json_decode(json_encode($this->CakeEmail), true); <del> $this->assertContains('test', $result['_viewVars']['exception']); <del> unset($result['_viewVars']['exception']); <add> $this->assertContains('test', $result['viewVars']['exception']); <add> unset($result['viewVars']['exception']); <ide> <ide> $encode = function ($path) { <ide> return chunk_split(base64_encode(file_get_contents($path)), 76, "\r\n"); <ide> public function testJsonSerialize() <ide> '_cc' => ['mark@cakephp.org' => 'mark@cakephp.org', 'juan@cakephp.org' => 'Juan Basso'], <ide> '_bcc' => ['phpnut@cakephp.org' => 'phpnut@cakephp.org'], <ide> '_subject' => 'Test Serialize', <del> '_template' => 'default', <del> '_layout' => 'test', <del> '_viewRender' => 'Cake\View\View', <del> '_helpers' => ['Html'], <ide> '_emailFormat' => 'text', <ide> '_messageId' => '<uuid@server.com>', <ide> '_domain' => 'foo.bar', <ide> 'charset' => 'utf-8', <ide> 'headerCharset' => 'utf-8', <del> '_viewVars' => [ <add> 'viewConfig' => [ <add> '_template' => 'default', <add> '_layout' => 'test', <add> '_helpers' => ['Html'], <add> '_className' => 'Cake\View\View', <add> ], <add> 'viewVars' => [ <ide> 'users' => [ <ide> 'id' => 1, <ide> 'username' => 'mariano' <ide> public function testJsonSerialize() <ide> ]; <ide> $this->assertEquals($expected, $result); <ide> <del> debug(unserialize(serialize($this->CakeEmail))); <ide> $result = json_decode(json_encode(unserialize(serialize($this->CakeEmail))), true); <del> $this->assertContains('test', $result['_viewVars']['exception']); <del> unset($result['_viewVars']['exception']); <add> $this->assertContains('test', $result['viewVars']['exception']); <add> unset($result['viewVars']['exception']); <ide> $this->assertEquals($expected, $result); <ide> } <ide> <ide><path>tests/TestCase/View/ViewBuilderTest.php <ide> public function testBuildMissingViewClass() <ide> $builder->className('Foo'); <ide> $builder->build(); <ide> } <add> <add> /** <add> * testJsonSerialize() <add> * <add> * @return void <add> */ <add> public function testJsonSerialize() <add> { <add> $builder = new ViewBuilder(); <add> <add> $builder <add> ->template('default') <add> ->layout('test') <add> ->helpers(['Html']) <add> ->className('JsonView'); <add> <add> $result = json_decode(json_encode($builder), true); <add> <add> $expected = [ <add> '_template' => 'default', <add> '_layout' => 'test', <add> '_helpers' => ['Html'], <add> '_className' => 'JsonView', <add> ]; <add> $this->assertEquals($expected, $result); <add> <add> $result = json_decode(json_encode(unserialize(serialize($builder))), true); <add> $this->assertEquals($expected, $result); <add> } <ide> }
4
PHP
PHP
use identifierexpression for join on clause
bea0655dc2f0287a25bc9980c8709b15d533af8f
<ide><path>tests/TestCase/ORM/QueryTest.php <ide> public function testSubqueryJoinClause() <ide> $query = $this->getTableLocator()->get('Authors')->find(); <ide> $query <ide> ->select(['Authors.id', 'total_articles' => $query->func()->count('articles.author_id')]) <del> ->leftJoin(['articles' => $subquery], ['articles.author_id = Authors.id']) <add> ->leftJoin(['articles' => $subquery], ['articles.author_id' => new IdentifierExpression('Authors.id')]) <ide> ->group(['Authors.id']) <ide> ->order(['Authors.id' => 'ASC']); <ide>
1
Ruby
Ruby
add some tests for env.{append,prepend} behavior
870e47e68ca5d2f9b1ceb1ead9cddd5ffbd951a6
<ide><path>Library/Homebrew/test/test_ENV.rb <ide> def test_with_build_environment_does_not_mutate_interface <ide> assert_equal expected, @env.methods <ide> end <ide> <add> def test_append_existing_key <add> @env['foo'] = 'bar' <add> @env.append 'foo', '1' <add> assert_equal 'bar 1', @env['foo'] <add> end <add> <add> def test_append_existing_key_empty <add> @env['foo'] = '' <add> @env.append 'foo', '1' <add> assert_equal '1', @env['foo'] <add> end <add> <add> def test_append_missing_key <add> @env.append 'foo', '1' <add> assert_equal '1', @env['foo'] <add> end <add> <add> def test_prepend_existing_key <add> @env['foo'] = 'bar' <add> @env.prepend 'foo', '1' <add> assert_equal '1 bar', @env['foo'] <add> end <add> <add> def test_prepend_existing_key_empty <add> @env['foo'] = '' <add> @env.prepend 'foo', '1' <add> assert_equal '1', @env['foo'] <add> end <add> <add> def test_prepend_missing_key <add> @env.prepend 'foo', '1' <add> assert_equal '1', @env['foo'] <add> end <add> <add> # NOTE: this may be a wrong behavior; we should probably reject objects that <add> # do not respond to #to_str. For now this documents existing behavior. <add> def test_append_coerces_value_to_string <add> @env.append 'foo', 42 <add> assert_equal '42', @env['foo'] <add> end <add> <add> def test_prepend_coerces_value_to_string <add> @env.prepend 'foo', 42 <add> assert_equal '42', @env['foo'] <add> end <add> <ide> def test_append_path <ide> @env.append_path 'FOO', '/usr/bin' <ide> assert_equal '/usr/bin', @env['FOO']
1
Javascript
Javascript
add another test case
9598f6484e9b05a3010c1648b20c94c745e4efa0
<ide><path>test/Validation.test.js <ide> describe("Validation", function() { <ide> " })", <ide> " ]" <ide> ] <add> }, { <add> name: "enum", <add> config: { <add> entry: "a", <add> devtool: true <add> }, <add> message: [ <add> " - configuration.devtool should be one of these:", <add> " string | false", <add> " A developer tool to enhance debugging.", <add> " Details:", <add> " * configuration.devtool should be a string.", <add> " * configuration.devtool should be false" <add> ] <ide> }]; <ide> testCases.forEach(function(testCase) { <ide> it("should fail validation for " + testCase.name, function() {
1
Text
Text
add people to cc for async_wrap
62eee49d92c6856b3f75f07febc2028a315caef3
<ide><path>doc/onboarding-extras.md <ide> | `src/node_crypto.*` | @nodejs/crypto | <ide> | `test/*` | @nodejs/testing | <ide> | `tools/eslint`, `.eslintrc` | @silverwind, @trott | <add>| async_hooks | @nodejs/diagnostics | <ide> | upgrading V8 | @nodejs/v8, @nodejs/post-mortem | <ide> | upgrading npm | @fishrock123, @thealphanerd | <ide> | upgrading c-ares | @jbergstroem |
1
Javascript
Javascript
improve the description of err_invalid_arg_value
3ec79216f9d2300faac2a4fe07e0ca92afd9dcb9
<ide><path>lib/internal/errors.js <ide> const { kMaxLength } = process.binding('buffer'); <ide> const { defineProperty } = Object; <ide> <ide> // Lazily loaded <del>var util = null; <add>var util_ = null; <ide> var buffer; <ide> <add>function lazyUtil() { <add> if (!util_) { <add> util_ = require('util'); <add> } <add> return util_; <add>} <add> <ide> function makeNodeError(Base) { <ide> return class NodeError extends Base { <ide> constructor(key, ...args) { <ide> function createErrDiff(actual, expected, operator) { <ide> var lastPos = 0; <ide> var end = ''; <ide> var skipped = false; <add> const util = lazyUtil(); <ide> const actualLines = util <ide> .inspect(actual, { compact: false }).split('\n'); <ide> const expectedLines = util <ide> class AssertionError extends Error { <ide> if (message != null) { <ide> super(message); <ide> } else { <del> if (util === null) { <del> util = require('util'); <del> if (process.stdout.isTTY && process.stdout.getColorDepth() !== 1) { <del> green = '\u001b[32m'; <del> white = '\u001b[39m'; <del> red = '\u001b[31m'; <del> } <add> const util = lazyUtil(); <add> if (process.stdout.isTTY && process.stdout.getColorDepth() !== 1) { <add> green = '\u001b[32m'; <add> white = '\u001b[39m'; <add> red = '\u001b[31m'; <ide> } <ide> <ide> if (actual && actual.stack && actual instanceof Error) <ide> function message(key, args) { <ide> if (typeof msg === 'function') { <ide> fmt = msg; <ide> } else { <del> if (util === null) util = require('util'); <add> const util = lazyUtil(); <ide> fmt = util.format; <ide> if (args === undefined || args.length === 0) <ide> return msg; <ide> E('ERR_INSPECTOR_CLOSED', 'Session was closed'); <ide> E('ERR_INSPECTOR_NOT_AVAILABLE', 'Inspector is not available'); <ide> E('ERR_INSPECTOR_NOT_CONNECTED', 'Session is not connected'); <ide> E('ERR_INVALID_ARG_TYPE', invalidArgType); <del>E('ERR_INVALID_ARG_VALUE', (name, value) => <del> `The value "${String(value)}" is invalid for argument "${name}"`); <add>E('ERR_INVALID_ARG_VALUE', (name, value, reason = 'is invalid') => { <add> const util = lazyUtil(); <add> let inspected = util.inspect(value); <add> if (inspected.length > 128) { <add> inspected = inspected.slice(0, 128) + '...'; <add> } <add> return `The argument '${name}' ${reason}. Received ${inspected}`; <add>}), <ide> E('ERR_INVALID_ARRAY_LENGTH', <ide> (name, len, actual) => { <ide> internalAssert(typeof actual === 'number', 'actual must be a number'); <ide><path>test/parallel/test-internal-errors.js <ide> assert.strictEqual( <ide> } <ide> <ide> { <del> const error = new errors.Error('ERR_INVALID_ARG_VALUE', 'foo', 'bar'); <add> const error = new errors.Error('ERR_INVALID_ARG_VALUE', 'foo', '\u0000bar'); <ide> assert.strictEqual( <ide> error.message, <del> 'The value "bar" is invalid for argument "foo"' <add> 'The argument \'foo\' is invalid. Received \'\\u0000bar\'' <add> ); <add>} <add> <add>{ <add> const error = new errors.Error( <add> 'ERR_INVALID_ARG_VALUE', <add> 'foo', { a: 1 }, 'must have property \'b\''); <add> assert.strictEqual( <add> error.message, <add> 'The argument \'foo\' must have property \'b\'. Received { a: 1 }' <ide> ); <ide> } <ide>
2
Python
Python
fix owlvit torchscript tests
a64bcb564dbc2a6329235016613a888ca21d513b
<ide><path>src/transformers/models/owlvit/modeling_owlvit.py <ide> def forward( <ide> <ide> class OwlViTForObjectDetection(OwlViTPreTrainedModel): <ide> config_class = OwlViTConfig <del> main_input_name = "pixel_values" <ide> <ide> def __init__(self, config: OwlViTConfig): <ide> super().__init__(config) <ide> def class_predictor( <ide> <ide> def image_text_embedder( <ide> self, <del> pixel_values: torch.FloatTensor, <ide> input_ids: torch.Tensor, <add> pixel_values: torch.FloatTensor, <ide> attention_mask: torch.Tensor, <ide> output_attentions: Optional[bool] = None, <ide> ) -> torch.FloatTensor: <ide> def image_text_embedder( <ide> @replace_return_docstrings(output_type=OwlViTObjectDetectionOutput, config_class=OwlViTConfig) <ide> def forward( <ide> self, <del> pixel_values: torch.FloatTensor, <ide> input_ids: torch.Tensor, <add> pixel_values: torch.FloatTensor, <ide> attention_mask: Optional[torch.Tensor] = None, <ide> output_attentions: Optional[bool] = None, <ide> output_hidden_states: Optional[bool] = None, <ide> def forward( <ide> <ide> if output_hidden_states: <ide> outputs = self.owlvit( <del> pixel_values=pixel_values, <ide> input_ids=input_ids, <add> pixel_values=pixel_values, <ide> attention_mask=attention_mask, <ide> output_attentions=output_attentions, <ide> output_hidden_states=output_hidden_states, <ide> def forward( <ide> <ide> # Embed images and text queries <ide> feature_map, query_embeds = self.image_text_embedder( <del> pixel_values=pixel_values, <ide> input_ids=input_ids, <add> pixel_values=pixel_values, <ide> attention_mask=attention_mask, <ide> output_attentions=output_attentions, <ide> ) <ide> def forward( <ide> pred_boxes = self.box_predictor(image_feats, feature_map) <ide> <ide> if not return_dict: <del> return ( <add> output = ( <ide> pred_logits, <ide> pred_boxes, <ide> query_embeds, <ide> def forward( <ide> text_model_last_hidden_states, <ide> vision_model_last_hidden_states, <ide> ) <add> output = tuple(x for x in output if x is not None) <add> return output <ide> <ide> return OwlViTObjectDetectionOutput( <ide> image_embeds=feature_map,
1
PHP
PHP
remove unnecessary imports
8a6089af017c610e908885ed3f872945e76ae995
<ide><path>src/I18n/RelativeTimeFormatter.php <ide> */ <ide> namespace Cake\I18n; <ide> <del>use Cake\I18n\FrozenDate; <del>use Cake\I18n\FrozenTime; <del> <ide> /** <ide> * Helper class for formatting relative dates & times. <ide> *
1
Javascript
Javascript
remove lingering templatedata
800b09465da06f54996893ea8e744bc3d3569cf3
<ide><path>packages/ember-handlebars/lib/helpers/binding.js <ide> function bind(property, options, preserveContext, shouldDisplay, valueNormalizer <ide> lazyValue: lazyValue, <ide> previousContext: currentContext, <ide> isEscaped: !options.hash.unescaped, <del> templateData: options.data, <ide> templateHash: options.hash, <ide> helperName: options.helperName <ide> }; <ide><path>packages/ember-handlebars/lib/helpers/view.js <ide> export var ViewHelper = EmberObject.create({ <ide> <ide> var viewOptions = this.propertiesFromHTMLOptions(options, thisContext); <ide> var currentView = data.view; <del> viewOptions.templateData = data; <ide> var newViewProto = newView.proto(); <ide> <ide> if (fn) { <ide> export var ViewHelper = EmberObject.create({ <ide> <ide> var viewOptions = this.propertiesFromHTMLOptions(options, thisContext); <ide> var currentView = data.view; <del> viewOptions.templateData = data; <ide> <ide> if (fn) { <ide> Ember.assert("You cannot provide a template block if you also specified a templateName", <ide><path>packages/ember-htmlbars/lib/helpers/binding.js <ide> function bind(property, hash, options, env, preserveContext, shouldDisplay, valu <ide> lazyValue: lazyValue, <ide> previousContext: get(this, 'context'), <ide> isEscaped: !hash.unescaped, <del> templateData: env.data, <ide> templateHash: hash, <ide> helperName: options.helperName <ide> }; <ide><path>packages/ember-htmlbars/lib/helpers/view.js <ide> export var ViewHelper = EmberObject.create({ <ide> <ide> var viewOptions = this.propertiesFromHTMLOptions(hash, options, env); <ide> var currentView = data.view; <del> viewOptions.templateData = data; <ide> var newViewProto = newView.proto(); <ide> <ide> if (fn) { <ide> export var ViewHelper = EmberObject.create({ <ide> <ide> var viewOptions = this.propertiesFromHTMLOptions(hash, options, env); <ide> var currentView = data.view; <del> viewOptions.templateData = data; <ide> <ide> if (fn) { <ide> Ember.assert("You cannot provide a template block if you also specified a templateName", <ide><path>packages/ember-htmlbars/tests/helpers/with_test.js <ide> test("it should support #with this as qux", function() { <ide> }); <ide> }); <ide> <del>QUnit.module("Handlebars {{#with foo}} insideGroup"); <del> <del>test("it should render without fail [DEPRECATED]", function() { <del> var View = EmberView.extend({ <del> template: compile("{{#view view.childView}}{{#with person}}{{name}}{{/with}}{{/view}}"), <del> controller: EmberObject.create({ person: { name: "Ivan IV Vasilyevich" } }), <del> childView: EmberView.extend({ <del> render: function(){ <del> this.set('templateData.insideGroup', true); <del> return this._super.apply(this, arguments); <del> } <del> }) <del> }); <del> <del> var view = View.create(); <del> expectDeprecation(function(){ <del> appendView(view); <del> }, 'Using the context switching form of `{{with}}` is deprecated. Please use the keyword form (`{{with foo as bar}}`) instead. See http://emberjs.com/guides/deprecations/#toc_more-consistent-handlebars-scope for more details.'); <del> equal(view.$().text(), "Ivan IV Vasilyevich", "should be properly scoped"); <del> <del> run(function() { <del> set(view, 'controller.person.name', "Ivan the Terrible"); <del> }); <del> <del> equal(view.$().text(), "Ivan the Terrible", "should update"); <del> <del> run(function() { <del> view.destroy(); <del> }); <del>}); <del> <ide> QUnit.module("Handlebars {{#with foo}} with defined controller"); <ide> <ide> test("it should wrap context with object controller [DEPRECATED]", function() { <ide><path>packages/ember-htmlbars/tests/integration/group_test.js <del>/*jshint newcap:false*/ <del> <del>import run from "ember-metal/run_loop"; <del>import jQuery from "ember-views/system/jquery"; <del>import EmberView from "ember-views/views/view"; <del>import _MetamorphView from "ember-views/views/metamorph_view"; <del>import EmberHandlebars from "ember-handlebars-compiler"; <del>import ArrayProxy from "ember-runtime/system/array_proxy"; <del>import { A } from "ember-runtime/system/native_array"; <del>import Container from "ember-runtime/system/container"; <del>import { set } from "ember-metal/property_set"; <del>import Component from "ember-views/views/component"; <del>import htmlbarsCompile from "ember-htmlbars/system/compile"; <del> <del>var compile; <del>if (Ember.FEATURES.isEnabled('ember-htmlbars')) { <del> compile = htmlbarsCompile; <del>} else { <del> compile = EmberHandlebars.compile; <del>} <del> <del>var trim = jQuery.trim; <del>var container, view; <del> <del>function appendView() { <del> run(function() { view.appendTo('#qunit-fixture'); }); <del>} <del> <del>QUnit.module("ember-htmlbars: group flag", { <del> setup: function() { <del> container = new Container(); <del> container.register('view:default', _MetamorphView); <del> container.register('view:toplevel', EmberView.extend()); <del> }, <del> <del> teardown: function() { <del> run(function() { <del> if (view) { <del> view.destroy(); <del> } <del> if (container) { <del> container.destroy(); <del> } <del> container = view = null; <del> }); <del> run.cancelTimers(); <del> } <del>}); <del> <del>function createGroupedView(template, context) { <del> var options = { <del> container: container, <del> context: context, <del> template: compile(template), <del> templateData: {insideGroup: true, keywords: {}} <del> }; <del> run(function() { <del> view = EmberView.create(options); <del> }); <del>} <del> <del>test("should properly modify behavior inside the block", function() { <del> createGroupedView("{{msg}}", {msg: 'ohai'}); <del> appendView(); <del> <del> equal(view.$().text(), 'ohai', 'Original value was rendered'); <del> <del> run(function() { <del> view.set('context.msg', 'ohbai'); <del> }); <del> equal(view.$().text(), 'ohbai', 'Updated value was rendered'); <del> <del> run(function() { <del> view.set('context.msg', null); <del> }); <del> equal(view.$().text(), '', 'null value properly rendered as a blank'); <del> <del> run(function() { <del> view.set('context.msg', undefined); <del> }); <del> equal(view.$().text(), '', 'undefined value properly rendered as a blank'); <del>}); <del> <del>test("property changes inside views should only rerender their view", function() { <del> createGroupedView( <del> '{{#view}}{{msg}}{{/view}}', <del> {msg: 'ohai'} <del> ); <del> var rerenderWasCalled = false; <del> view.reopen({ <del> rerender: function() { rerenderWasCalled = true; this._super(); } <del> }); <del> appendView(); <del> equal(trim(view.$().text()), 'ohai', 'Original value was rendered'); <del> <del> run(function() { <del> view.set('context.msg', 'ohbai'); <del> }); <del> ok(!rerenderWasCalled, "The GroupView rerender method was not called"); <del> equal(trim(view.$().text()), 'ohbai', "The updated value was rendered"); <del>}); <del> <del>test("should work with bind-attr", function() { <del> createGroupedView( <del> '<button {{bind-attr class="innerClass"}}>ohai</button>', <del> {innerClass: 'magic'} <del> ); <del> appendView(); <del> equal(view.$('.magic').length, 1); <del> <del> run(function() { <del> view.set('context.innerClass', 'bindings'); <del> }); <del> equal(view.$('.bindings').length, 1); <del> <del> run(function() { <del> view.rerender(); <del> }); <del> equal(view.$('.bindings').length, 1); <del>}); <del> <del>test("should work with the #if helper", function() { <del> createGroupedView( <del> '{{#if something}}hooray{{else}}boo{{/if}}', <del> {something: true} <del> ); <del> appendView(); <del> <del> equal(trim(view.$().text()), 'hooray', 'Truthy text was rendered'); <del> <del> run(function() { <del> view.set('context.something', false); <del> }); <del> equal(trim(view.$().text()), 'boo', "The falsy value was rendered"); <del>}); <del> <del>test("#each with no content", function() { <del> expect(0); <del> createGroupedView( <del> "{{#each item in missing}}{{item}}{{/each}}" <del> ); <del> appendView(); <del>}); <del> <del>test("#each's content can be changed right before a destroy", function() { <del> expect(0); <del> <del> createGroupedView( <del> "{{#each number in numbers}}{{number}}{{/each}}", <del> {numbers: A([1,2,3])} <del> ); <del> appendView(); <del> <del> run(function() { <del> view.set('context.numbers', A([3,2,1])); <del> view.destroy(); <del> }); <del>}); <del> <del>test("#each can be nested", function() { <del> createGroupedView( <del> "{{#each number in numbers}}{{number}}{{/each}}", <del> {numbers: A([1, 2, 3])} <del> ); <del> appendView(); <del> equal(view.$().text(), '123', "The content was rendered"); <del> <del> run(function() { <del> view.get('context.numbers').pushObject(4); <del> }); <del> <del> equal(view.$().text(), '1234', "The array observer properly updated the rendered output"); <del> <del> run(function() { <del> view.set('context.numbers', A(['a', 'b', 'c'])); <del> }); <del> <del> equal(view.$().text(), 'abc', "Replacing the array properly updated the rendered output"); <del>}); <del> <del>test("#each can be used with an ArrayProxy", function() { <del> createGroupedView( <del> "{{#each number in numbers}}{{number}}{{/each}}", <del> {numbers: ArrayProxy.create({content: A([1, 2, 3])})} <del> ); <del> appendView(); <del> equal(view.$().text(), '123', "The content was rendered"); <del>}); <del> <del>test("should allow `#each item in array` format", function() { <del> var yehuda = {name: 'Yehuda'}; <del> createGroupedView( <del> '{{#each person in people}}{{person.name}}{{/each}}', <del> {people: A([yehuda, {name: 'Tom'}])} <del> ); <del> appendView(); <del> equal(view.$().text(), 'YehudaTom', "The content was rendered"); <del> <del> run(function() { <del> set(yehuda, 'name', 'Erik'); <del> }); <del> equal(view.$().text(), 'ErikTom', "The updated object value was rendered"); <del> <del> run(function() { <del> view.get('context.people').pushObject({name: 'Alex'}); <del> view.get('context.people').removeObject(yehuda); <del> }); <del> equal(view.$().text(), 'TomAlex', "The updated array content was rendered"); <del> <del> run(function() { <del> view.set('context.people', A([{name: 'Sarah'},{name: 'Gavin'}])); <del> }); <del> equal(view.$().text(), 'SarahGavin', "The replaced array content was rendered"); <del>}); <del> <del>test("an #each can be nested with a view inside", function() { <del> var yehuda = {name: 'Yehuda'}; <del> createGroupedView( <del> '{{#each person in people}}{{#view}}{{person.name}}{{/view}}{{/each}}', <del> {people: A([yehuda, {name: 'Tom'}])} <del> ); <del> appendView(); <del> equal(view.$().text(), 'YehudaTom', "The content was rendered"); <del> <del> run(function() { <del> set(yehuda, 'name', 'Erik'); <del> }); <del> <del> equal(view.$().text(), 'ErikTom', "The updated object's view was rerendered"); <del>}); <del> <del>test("an #each can be nested with a component inside", function() { <del> var yehuda = {name: 'Yehuda'}; <del> container.register('view:test', Component.extend()); <del> createGroupedView( <del> '{{#each person in people}}{{#view "test"}}{{person.name}}{{/view}}{{/each}}', <del> {people: A([yehuda, {name: 'Tom'}])} <del> ); <del> <del> appendView(); <del> equal(view.$().text(), 'YehudaTom', "The content was rendered"); <del> <del> run(function() { <del> set(yehuda, 'name', 'Erik'); <del> }); <del> <del> equal(view.$().text(), 'ErikTom', "The updated object's view was rerendered"); <del>}); <del> <del>test("#each with groupedRows=true behaves like a normal bound #each", function() { <del> createGroupedView( <del> '{{#each number in numbers groupedRows=true}}{{number}}{{/each}}', <del> {numbers: A([1, 2, 3])} <del> ); <del> appendView(); <del> equal(view.$().text(), '123'); <del> <del> run(function() { <del> view.get('context.numbers').pushObject(4); <del> }); <del> <del> equal(view.$().text(), '1234'); <del>}); <del> <del>test("#each with itemViewClass behaves like a normal bound #each", function() { <del> container.register('view:nothing-special-view', Ember.View); <del> createGroupedView( <del> '{{#each person in people itemViewClass="nothing-special-view"}}{{person.name}}{{/each}}', <del> {people: A([{name: 'Erik'}, {name: 'Peter'}])} <del> ); <del> appendView(); <del> equal(view.$('.ember-view').length, 2, "Correct number of views are output"); <del> equal(view.$().text(), 'ErikPeter'); <del> <del> run(function() { <del> view.get('context.people').pushObject({name: 'Tom'}); <del> }); <del> <del> equal(view.$('.ember-view').length, 3, "Correct number of views are output"); <del> // IE likes to add newlines <del> equal(trim(view.$().text()), 'ErikPeterTom'); <del>}); <del> <del>test("should escape HTML in normal mustaches", function() { <del> createGroupedView( <del> '{{msg}}', {msg: 'you need to be more <b>bold</b>'} <del> ); <del> appendView(); <del> equal(view.$('b').length, 0, "does not create an element"); <del> equal(view.$().text(), 'you need to be more <b>bold</b>', "inserts entities, not elements"); <del>}); <del> <del>test("should not escape HTML in triple mustaches", function() { <del> createGroupedView( <del> '{{{msg}}}', {msg: 'you need to be more <b>bold</b>'} <del> ); <del> appendView(); <del> equal(view.$('b').length, 1, "creates an element"); <del>}); <ide><path>packages/ember-views/lib/views/component.js <ide> var Component = View.extend(TargetActionSupport, ComponentTemplateDeprecation, { <ide> _contextView: parentView, <ide> _morph: morph, <ide> context: get(parentView, 'context'), <del> controller: get(parentView, 'controller'), <del> templateData: { keywords: {} } <add> controller: get(parentView, 'controller') <ide> }); <ide> } <ide> }, <ide><path>packages/ember-views/lib/views/container_view.js <ide> var ContainerView = View.extend(MutableArray, { <ide> childViewsDidChange: function(views, start, removed, added) { <ide> if (added > 0) { <ide> var changedViews = views.slice(start, start+added); <del> this.initializeViews(changedViews, this, get(this, 'templateData')); <add> this.initializeViews(changedViews, this); <ide> this.currentState.childViewsDidChange(this, views, start, added); <ide> } <ide> this.propertyDidChange('childViews'); <ide> }, <ide> <del> initializeViews: function(views, parentView, templateData) { <add> initializeViews: function(views, parentView) { <ide> forEach(views, function(view) { <ide> set(view, '_parentView', parentView); <ide> <ide> if (!view.container && parentView) { <ide> set(view, 'container', parentView.container); <ide> } <del> <del> if (!get(view, 'templateData')) { <del> set(view, 'templateData', templateData); <del> } <ide> }); <ide> }, <ide> <ide><path>packages/ember-views/lib/views/view.js <ide> var View = CoreView.extend({ <ide> attrs._parentView = this; <ide> <ide> if (CoreView.detect(view)) { <del> attrs.templateData = attrs.templateData || get(this, 'templateData'); <del> <ide> attrs.container = this.container; <ide> view = view.create(attrs); <ide> <ide> var View = CoreView.extend({ <ide> <ide> Ember.assert("Could not find view: '" + fullName + "'", !!ViewKlass); <ide> <del> attrs.templateData = get(this, 'templateData'); <ide> view = ViewKlass.create(attrs); <ide> } else { <ide> Ember.assert('You must pass instance or subclass of View', view.isView); <del> attrs.container = this.container; <del> <del> if (!get(view, 'templateData')) { <del> attrs.templateData = get(this, 'templateData'); <del> } <ide> <add> attrs.container = this.container; <ide> setProperties(view, attrs); <del> <ide> } <ide> <ide> return view; <ide><path>packages/ember-views/tests/views/view/template_test.js <ide> test("should provide a controller to the template if a controller is specified o <ide> template: function(buffer, options) { <ide> options.data.view.appendChild(EmberView.create({ <ide> controller: controller2, <del> templateData: options.data, <ide> template: function(context, options) { <ide> contextForView = context; <ide> optionsDataKeywordsControllerForChildView = options.data.view._keywords.controller.value(); <ide> test("should provide a controller to the template if a controller is specified o <ide> <ide> template: function(buffer, options) { <ide> options.data.view.appendChild(EmberView.create({ <del> templateData: options.data, <ide> template: function(context, options) { <ide> contextForControllerlessView = context; <ide> optionsDataKeywordsControllerForChildView = options.data.view._keywords.controller.value();
10
Ruby
Ruby
add include_hidden option to checkbox tag
9fbb1767b5b072007678b1df2bd59dce17c37dc8
<ide><path>actionpack/lib/action_view/helpers/tags/check_box.rb <ide> def render <ide> add_default_name_and_id(options) <ide> end <ide> <del> hidden = hidden_field_for_checkbox(options) <add> include_hidden = options.delete("include_hidden") { true } <ide> checkbox = tag("input", options) <del> hidden + checkbox <add> <add> if include_hidden <add> hidden = hidden_field_for_checkbox(options) <add> hidden + checkbox <add> else <add> checkbox <add> end <ide> end <ide> <ide> private <ide><path>actionpack/test/template/form_helper_test.rb <ide> def test_check_box <ide> ) <ide> end <ide> <add> def test_check_box_with_include_hidden_false <add> @post.secret = false <add> assert_dom_equal('<input id="post_secret" name="post[secret]" type="checkbox" value="1" />', check_box("post", "secret", :include_hidden => false)) <add> end <add> <ide> def test_check_box_with_explicit_checked_and_unchecked_values <ide> @post.secret = "on" <ide> assert_dom_equal(
2
Go
Go
move defaultshmsize in daemon pkg
2969abc6c55a9ab126b90d0af4b67860b4103f3f
<ide><path>api/server/router/local/image.go <ide> import ( <ide> "fmt" <ide> "io" <ide> "net/http" <add> "strconv" <ide> "strings" <ide> <ide> "github.com/Sirupsen/logrus" <ide> func (s *router) postBuild(ctx context.Context, w http.ResponseWriter, r *http.R <ide> buildConfig.ForceRemove = httputils.BoolValue(r, "forcerm") <ide> buildConfig.MemorySwap = httputils.Int64ValueOrZero(r, "memswap") <ide> buildConfig.Memory = httputils.Int64ValueOrZero(r, "memory") <del> shmSize, err := httputils.Int64ValueOrDefault(r, "shmsize", runconfig.DefaultSHMSize) <del> if err != nil { <del> return errf(err) <del> } <del> buildConfig.ShmSize = &shmSize <ide> buildConfig.CPUShares = httputils.Int64ValueOrZero(r, "cpushares") <ide> buildConfig.CPUPeriod = httputils.Int64ValueOrZero(r, "cpuperiod") <ide> buildConfig.CPUQuota = httputils.Int64ValueOrZero(r, "cpuquota") <ide> buildConfig.CPUSetCpus = r.FormValue("cpusetcpus") <ide> buildConfig.CPUSetMems = r.FormValue("cpusetmems") <ide> buildConfig.CgroupParent = r.FormValue("cgroupparent") <ide> <add> if r.Form.Get("shmsize") != "" { <add> shmSize, err := strconv.ParseInt(r.Form.Get("shmsize"), 10, 64) <add> if err != nil { <add> return errf(err) <add> } <add> buildConfig.ShmSize = &shmSize <add> } <add> <ide> if i := runconfig.IsolationLevel(r.FormValue("isolation")); i != "" { <ide> if !runconfig.IsolationLevel.IsValid(i) { <ide> return errf(fmt.Errorf("Unsupported isolation: %q", i)) <ide><path>daemon/container_unix.go <ide> import ( <ide> "github.com/opencontainers/runc/libcontainer/label" <ide> ) <ide> <del>// DefaultPathEnv is unix style list of directories to search for <del>// executables. Each directory is separated from the next by a colon <del>// ':' character . <del>const DefaultPathEnv = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" <add>const ( <add> // DefaultPathEnv is unix style list of directories to search for <add> // executables. Each directory is separated from the next by a colon <add> // ':' character . <add> DefaultPathEnv = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" <add> <add> // DefaultSHMSize is the default size (64MB) of the SHM which will be mounted in the container <add> DefaultSHMSize int64 = 67108864 <add>) <ide> <ide> // Container holds the fields specific to unixen implementations. See <ide> // CommonContainer for standard fields common to all containers. <ide> func (daemon *Daemon) setupIpcDirs(container *Container) error { <ide> return err <ide> } <ide> <del> shmSize := runconfig.DefaultSHMSize <add> shmSize := DefaultSHMSize <ide> if container.hostConfig.ShmSize != nil { <ide> shmSize = *container.hostConfig.ShmSize <ide> } <ide><path>daemon/daemon_unix.go <ide> func (daemon *Daemon) adaptContainerSettings(hostConfig *runconfig.HostConfig, a <ide> hostConfig.MemorySwap = hostConfig.Memory * 2 <ide> } <ide> if hostConfig.ShmSize == nil { <del> shmSize := runconfig.DefaultSHMSize <add> shmSize := DefaultSHMSize <ide> hostConfig.ShmSize = &shmSize <ide> } <ide> } <ide><path>integration-cli/docker_api_containers_test.go <ide> func (s *DockerSuite) TestPostContainersCreateShmSizeOmitted(c *check.C) { <ide> var containerJSON types.ContainerJSON <ide> c.Assert(json.Unmarshal(body, &containerJSON), check.IsNil) <ide> <del> c.Assert(*containerJSON.HostConfig.ShmSize, check.Equals, runconfig.DefaultSHMSize) <add> c.Assert(*containerJSON.HostConfig.ShmSize, check.Equals, int64(67108864)) <ide> <ide> out, _ := dockerCmd(c, "start", "-i", containerJSON.ID) <ide> shmRegexp := regexp.MustCompile(`shm on /dev/shm type tmpfs(.*)size=65536k`) <ide><path>runconfig/parse.go <ide> var ( <ide> ErrConflictNetworkExposePorts = fmt.Errorf("Conflicting options: --expose and the network mode (--net)") <ide> ) <ide> <del>// DefaultSHMSize is the default size (64MB) of the SHM which will be mounted in the container <del>const DefaultSHMSize int64 = 67108864 <del> <ide> // Parse parses the specified args for the specified command and generates a Config, <ide> // a HostConfig and returns them with the specified command. <ide> // If the specified args are not valid, it will return an error.
5
PHP
PHP
implement presence and equality attributes
6c87be97ef0900da27603c793f61e4ac0535143c
<ide><path>lib/Cake/Test/Case/Utility/Set2Test.php <ide> public static function articleData() { <ide> ), <ide> array( <ide> 'Article' => array( <del> 'id' => '3', <add> 'id' => '2', <ide> 'user_id' => '1', <ide> 'title' => 'Second Article', <ide> 'body' => 'Second Article Body', <ide> public function testExtractStringKey() { <ide> $this->assertEquals(array('foo'), $result); <ide> } <ide> <add>/** <add> * Test the attribute presense selector. <add> * <add> * @return void <add> */ <add> public function testExtractAttributePresence() { <add> $data = self::articleData(); <add> <add> $result = Set2::extract($data, '{n}.Article[published]'); <add> $expected = array($data['1']['Article']); <add> $this->assertEquals($expected, $result); <add> <add> $result = Set2::extract($data, '{n}.Article[id][published]'); <add> $expected = array($data['1']['Article']); <add> $this->assertEquals($expected, $result); <add> } <add> <add>/** <add> * Test = and != operators. <add> * <add> * @return void <add> */ <add> public function testExtractAttributeEquality() { <add> $data = self::articleData(); <add> <add> $result = Set2::extract($data, '{n}.Article[id=3]'); <add> $expected = array($data[2]['Article']); <add> $this->assertEquals($expected, $result); <add> <add> $result = Set2::extract($data, '{n}.Article[id = 3]'); <add> $expected = array($data[2]['Article']); <add> $this->assertEquals($expected, $result, 'Whitespace should not matter.'); <add> <add> $result = Set2::extract($data, '{n}.Article[id!=3]'); <add> $this->assertEquals(1, $result[0]['id']); <add> $this->assertEquals(2, $result[1]['id']); <add> $this->assertEquals(4, $result[2]['id']); <add> $this->assertEquals(5, $result[3]['id']); <add> } <add> <ide> } <ide><path>lib/Cake/Utility/Set2.php <ide> public static function get(array $data, $path) { <ide> * - `{n}` Matches any numeric key. <ide> * - `{s}` Matches any string key. <ide> * - `[id]` Matches elements with an `id` index. <del> * - `[id>2]` Matches elements that have an `id` index greater than 2. Other operators <del> * are `>`, `<`, `<=`, `>=`, `==`, and `=//` which allows you to use regular expression matching. <add> * - `[id>2]` Matches elements that have an `id` index greater than 2. <add> * <add> * There are a number of attribute operators: <add> * <add> * - `=`, `!=` Equality. <add> * - `>`, `<`, `>=`, `<=` Value comparison. <add> * - `=/.../` Regular expression pattern match. <ide> * <ide> * Given a set of User array data, from a `$User->find('all')` call: <ide> * <ide> * - `1.User.name` Get the name of the user at index 1. <ide> * - `{n}.User.name` Get the name of every user in the set of users. <ide> * - `{n}.User[id]` Get the name of every user with an id key. <ide> * - `{n}.User[id>=2]` Get the name of every user with an id key greater than or equal to 2. <del> * - `{n}.User[username=/^paul/]` Get User elements with username matching `^paul`. <add> * - `{n}.User[username=/^paul/]` Get User elements with username containing `^paul`. <ide> * <ide> * @param array $data The data to extract from. <ide> * @param string $path The path to extract. <ide> public static function extract(array $data, $path) { <ide> /** <ide> * Traverses $data for $path. $callback is called for each terminal element. <ide> * The results of all the callbacks are returned. <add> * <add> * @param array $data The data to traverse. <add> * @param string $path The set path to walk. <add> * @param callable $callback to call on the result set. <add> * @return array Results of the callback mapped over the leaf nodes of the path expression. <ide> */ <ide> protected static function _traverse(array &$data, $path, $callback) { <ide> $result = array(); <del> $tokens = String::tokenize($path, '.', '{', '}'); <add> <add> if (strpos('[', $path) === false) { <add> $tokens = explode('.', $path); <add> } else { <add> $tokens = String::tokenize($path, '.', '[', ']'); <add> } <ide> <ide> $_key = '__set_item__'; <ide> <ide> protected static function _traverse(array &$data, $path, $callback) { <ide> $next[] = $v; <ide> } <ide> } <del> } else { <add> } elseif (strpos($token, '[') === false) { <ide> // bare string key <ide> foreach ($item as $k => $v) { <ide> // index or key match. <ide> if ($k === $token) { <ide> $next[] = $v; <ide> } <ide> } <add> } else { <add> // attributes <add> foreach ($item as $k => $v) { <add> if (self::_matches(array($k => $v), $token)) { <add> $next[] = $v; <add> } <add> } <ide> } <ide> } <ide> $context = array($_key => $next); <ide> protected static function _traverse(array &$data, $path, $callback) { <ide> return array_map($callback, $context[$_key]); <ide> } <ide> <add>/** <add> * Checks whether or not $data matches the selector <add> * <add> * @param array $data Array of data to match. <add> * @param string $selector The selector to match. <add> * @return boolean Fitness of expression. <add> */ <add> protected static function _matches(array $data, $selector) { <add> preg_match_all( <add> '/(?<key>[^\[]+?)? (\[ (?<attr>.+?) (?: \s* (?<op>[><!]?[=]) \s* (?<val>.*) )? \])+/x', <add> $selector, <add> $conditions, <add> PREG_SET_ORDER <add> ); <add> <add> foreach ($conditions as $cond) { <add> $key = $cond['key']; <add> $attr = $cond['attr']; <add> $op = isset($cond['op']) ? $cond['op'] : null; <add> $val = isset($cond['val']) ? $cond['val'] : null; <add> <add> if ($key && !isset($data[$key])) { <add> return false; <add> } <add> <add> // Presence test. <add> if (empty($op) && empty($val)) { <add> return isset($data[$key][$attr]); <add> } <add> <add> // Empty attribute = fail. <add> if (!isset($data[$key][$attr])) { <add> return false; <add> } <add> $prop = $data[$key][$attr]; <add> <add> if ($op === '=') { <add> return $prop == $val; <add> } elseif ($op === '!=') { <add> return $prop != $val; <add> } <add> } <add> return false; <add> } <add> <ide> public static function insert(array $data, $path, $values = null) { <ide> <ide> }
2
Javascript
Javascript
remove variable redeclaration
ba81d152ec14c2cb190279be8d3a519e220e7872
<ide><path>lib/repl.js <ide> REPLServer.prototype.complete = function(line, callback) { <ide> // list of completion lists, one for each inheritance "level" <ide> var completionGroups = []; <ide> <del> var completeOn, match, filter, i, group, c; <add> var completeOn, i, group, c; <ide> <ide> // REPL commands (e.g. ".break"). <ide> var match = null;
1
Text
Text
fix typo in image-optimization.md
1231ddb001da4ca9b3377f3fc8b990a986bcff1f
<ide><path>docs/basic-features/image-optimization.md <ide> Instead of optimizing images at build time, Next.js optimizes images on-demand, <ide> <ide> Images are lazy loaded by default. That means your page speed isn't penalized for images outside the viewport. Images load as they are scrolled into viewport. <ide> <del>Images are always rendered in such a way as to avoid prevent [Cumulative Layout Shift](https://web.dev/cls/), a [Core Web Vital](https://web.dev/vitals/) that Google is going to [use in search ranking](https://webmasters.googleblog.com/2020/05/evaluating-page-experience.html). <add>Images are always rendered in such a way as to avoid [Cumulative Layout Shift](https://web.dev/cls/), a [Core Web Vital](https://web.dev/vitals/) that Google is going to [use in search ranking](https://webmasters.googleblog.com/2020/05/evaluating-page-experience.html). <ide> <ide> ## Image Component <ide>
1
Javascript
Javascript
add url validation for form
3fc42b1ea8b5ada252796e8ba43fc776b996347f
<ide><path>client/src/components/settings/Certification.js <ide> class CertificationSettings extends Component { <ide> ); <ide> <ide> renderProjectsFor = (certName, isCert) => { <del> console.log(isCert); <ide> const { username, isHonest, createFlashMessage, verifyCert } = this.props; <ide> const { superBlock } = first(projectMap[certName]); <ide> const certLocation = `/certification/${username}/${superBlock}`; <ide> class CertificationSettings extends Component { <ide> } <ide> }); <ide> <add> const options = challengeTitles.reduce( <add> (options, current) => { <add> options.types[current] = 'url'; <add> return options; <add> }, <add> { types: {} } <add> ); <add> <ide> const fullForm = filledforms === challengeTitles.length; <ide> <ide> const createClickHandler = superBlock => e => { <ide> class CertificationSettings extends Component { <ide> initialValues={{ <ide> ...initialObject <ide> }} <add> options={options} <ide> submit={this.handleSubmit} <ide> /> <ide> {isCertClaimed ? (
1
Mixed
Python
adjust more arguments [ci skip]
c53b1433b9f54192dedc41919877e9e672641e31
<ide><path>spacy/cli/convert.py <ide> def convert_cli( <ide> file_type: FileTypes = Opt("spacy", "--file-type", "-t", help="Type of data to produce"), <ide> n_sents: int = Opt(1, "--n-sents", "-n", help="Number of sentences per doc (0 to disable)"), <ide> seg_sents: bool = Opt(False, "--seg-sents", "-s", help="Segment sentences (for -c ner)"), <del> model: Optional[str] = Opt(None, "--model", "-b", help="Trained spaCy pipeline for sentence segmentation (for -s)"), <add> model: Optional[str] = Opt(None, "--model", "--base", "-b", help="Trained spaCy pipeline for sentence segmentation to use as base (for --seg-sents)"), <ide> morphology: bool = Opt(False, "--morphology", "-m", help="Enable appending morphology to tags"), <ide> merge_subtokens: bool = Opt(False, "--merge-subtokens", "-T", help="Merge CoNLL-U subtokens"), <ide> converter: str = Opt("auto", "--converter", "-c", help=f"Converter: {tuple(CONVERTERS.keys())}"), <ide><path>spacy/cli/init_model.py <ide> def init_model_cli( <ide> prune_vectors: int = Opt(-1, "--prune-vectors", "-V", help="Optional number of vectors to prune to"), <ide> truncate_vectors: int = Opt(0, "--truncate-vectors", "-t", help="Optional number of vectors to truncate to when reading in vectors file"), <ide> vectors_name: Optional[str] = Opt(None, "--vectors-name", "-vn", help="Optional name for the word vectors, e.g. en_core_web_lg.vectors"), <del> model_name: Optional[str] = Opt(None, "--model-name", "-mn", help="Optional name for the pipeline meta"), <del> base_model: Optional[str] = Opt(None, "--base-model", "-b", help="Base pipeline (for languages with custom tokenizers)") <add> model_name: Optional[str] = Opt(None, "--meta-name", "-mn", help="Optional name of the package for the pipeline meta"), <add> base_model: Optional[str] = Opt(None, "--base", "-b", help="Name of or path to base pipeline to start with (mostly relevant for pipelines with custom tokenizers)") <ide> # fmt: on <ide> ): <ide> """ <ide><path>website/docs/api/cli.md <ide> This command was previously called `init-model`. <ide> </Infobox> <ide> <ide> ```cli <del>$ python -m spacy init vocab [lang] [output_dir] [--jsonl-loc] [--vectors-loc] [--prune-vectors] <add>$ python -m spacy init vocab [lang] [output_dir] [--jsonl-loc] [--vectors-loc] [--prune-vectors] [--vectors-name] [--meta-name] [--base] <ide> ``` <ide> <ide> | Name | Description | <ide> $ python -m spacy init vocab [lang] [output_dir] [--jsonl-loc] [--vectors-loc] [ <ide> | `--vectors-loc`, `-v` | Optional location of vectors. Should be a file where the first row contains the dimensions of the vectors, followed by a space-separated Word2Vec table. File can be provided in `.txt` format or as a zipped text file in `.zip` or `.tar.gz` format. ~~Optional[Path] \(option)~~ | <ide> | `--truncate-vectors`, `-t` <Tag variant="new">2.3</Tag> | Number of vectors to truncate to when reading in vectors file. Defaults to `0` for no truncation. ~~int (option)~~ | <ide> | `--prune-vectors`, `-V` | Number of vectors to prune the vocabulary to. Defaults to `-1` for no pruning. ~~int (option)~~ | <del>| `--vectors-name`, `-vn` | Name to assign to the word vectors in the `meta.json`, e.g. `en_core_web_md.vectors`. ~~str (option)~~ | <add>| `--vectors-name`, `-vn` | Name to assign to the word vectors in the `meta.json`, e.g. `en_core_web_md.vectors`. ~~Optional[str] \(option)~~ | <add>| `--meta-name`, `-mn` | Optional name of the package for the pipeline meta. ~~Optional[str] \(option)~~ | <add>| `--base`, `-b` | Optional name of or path to base pipeline to start with (mostly relevant for pipelines with custom tokenizers). ~~Optional[str] \(option)~~ | <ide> | `--help`, `-h` | Show help message and available arguments. ~~bool (flag)~~ | <ide> | **CREATES** | A spaCy pipeline directory containing the vocab and vectors. | <ide> <ide> management functions. The converter can be specified on the command line, or <ide> chosen based on the file extension of the input file. <ide> <ide> ```cli <del>$ python -m spacy convert [input_file] [output_dir] [--converter] [--file-type] [--n-sents] [--seg-sents] [--model] [--morphology] [--merge-subtokens] [--ner-map] [--lang] <add>$ python -m spacy convert [input_file] [output_dir] [--converter] [--file-type] [--n-sents] [--seg-sents] [--base] [--morphology] [--merge-subtokens] [--ner-map] [--lang] <ide> ``` <ide> <ide> | Name | Description | <ide> $ python -m spacy convert [input_file] [output_dir] [--converter] [--file-type] <ide> | `--file-type`, `-t` <Tag variant="new">2.1</Tag> | Type of file to create. Either `spacy` (default) for binary [`DocBin`](/api/docbin) data or `json` for v2.x JSON format. ~~str (option)~~ | <ide> | `--n-sents`, `-n` | Number of sentences per document. ~~int (option)~~ | <ide> | `--seg-sents`, `-s` <Tag variant="new">2.2</Tag> | Segment sentences (for `--converter ner`). ~~bool (flag)~~ | <del>| `--model`, `-b` <Tag variant="new">2.2</Tag> | Model for parser-based sentence segmentation (for `--seg-sents`). ~~Optional[str](option)~~ | <add>| `--base`, `-b` | Trained spaCy pipeline for sentence segmentation to use as base (for `--seg-sents`). ~~Optional[str](option)~~ | <ide> | `--morphology`, `-m` | Enable appending morphology to tags. ~~bool (flag)~~ | <ide> | `--ner-map`, `-nm` | NER tag mapping (as JSON-encoded dict of entity types). ~~Optional[Path](option)~~ | <ide> | `--lang`, `-l` <Tag variant="new">2.1</Tag> | Language code (if tokenizer required). ~~Optional[str] \(option)~~ |
3
PHP
PHP
remove useless foreach
cb7efa7e1d265e2afc44ad375987ca093cea187a
<ide><path>src/Illuminate/Session/Store.php <ide> public function all() <ide> */ <ide> public function replace(array $attributes) <ide> { <del> foreach ($attributes as $key => $value) <del> { <del> $this->put($key, $value); <del> } <add> $this->put($attributes); <ide> } <ide> <ide> /**
1
Python
Python
use assertwarns and assertwarnsregex
2a82e8518b8ff1c59f4715a6890bd69928aabc12
<ide><path>celery/apps/worker.py <ide> def run(self): <ide> self.redirect_stdouts_to_logger() <ide> <ide> if getattr(os, "getuid", None) and os.getuid() == 0: <del> warnings.warn( <del> "Running celeryd with superuser privileges is discouraged!") <add> warnings.warn(RuntimeWarning( <add> "Running celeryd with superuser privileges is discouraged!")) <ide> <ide> if self.discard: <ide> self.purge_messages() <ide><path>celery/execute/trace.py <ide> import socket <ide> import sys <ide> import traceback <del>import warnings <add> <add>from warnings import warn <ide> <ide> from .. import current_app <ide> from .. import states, signals <ide> def report_internal_error(task, exc): <ide> _type, _value, _tb = sys.exc_info() <ide> _value = task.backend.prepare_exception(exc) <ide> exc_info = ExceptionInfo((_type, _value, _tb)) <del> warnings.warn("Exception outside body: %s: %s\n%s" % tuple( <del> map(str, (exc.__class__, exc, exc_info.traceback)))) <add> warn(RuntimeWarning( <add> "Exception raised outside body: %r:\n%s" % (exc, exc_info.traceback))) <ide> return exc_info <ide><path>celery/tests/test_app/test_loaders.py <ide> <ide> import os <ide> import sys <del>import warnings <ide> <ide> from celery import task <ide> from celery import loaders <ide> from celery.app import app_or_default <del>from celery.exceptions import CPendingDeprecationWarning, ImproperlyConfigured <add>from celery.exceptions import ( <add> CPendingDeprecationWarning, <add> ImproperlyConfigured) <ide> from celery.loaders import base <ide> from celery.loaders import default <ide> from celery.loaders.app import AppLoader <ide> <add>from celery.tests.utils import AppCase, Case <ide> from celery.tests.compat import catch_warnings <del>from celery.tests.utils import unittest, AppCase <ide> <ide> <ide> class ObjectConfig(object): <ide> def test_get_loader_cls(self): <ide> default.Loader) <ide> <ide> def test_current_loader(self): <del> warnings.resetwarnings() <del> with catch_warnings(record=True) as log: <add> with self.assertWarnsRegex(CPendingDeprecationWarning, <add> r'deprecation'): <ide> self.assertIs(loaders.current_loader(), self.app.loader) <del> warning = log[0].message <del> <del> self.assertIsInstance(warning, CPendingDeprecationWarning) <del> self.assertIn("deprecation", warning.args[0]) <ide> <ide> def test_load_settings(self): <del> warnings.resetwarnings() <del> with catch_warnings(record=True) as log: <add> with self.assertWarnsRegex(CPendingDeprecationWarning, <add> r'deprecation'): <ide> self.assertIs(loaders.load_settings(), self.app.conf) <del> warning = log[0].message <del> <del> self.assertIsInstance(warning, CPendingDeprecationWarning) <del> self.assertIn("deprecation", warning.args[0]) <ide> <ide> <del>class TestLoaderBase(unittest.TestCase): <add>class TestLoaderBase(Case): <ide> message_options = {"subject": "Subject", <ide> "body": "Body", <ide> "sender": "x@x.com", <ide> def test_mail_admins_errors(self): <ide> MockMail.Mailer.raise_on_send = True <ide> opts = dict(self.message_options, **self.server_options) <ide> <del> with catch_warnings(record=True) as log: <add> with self.assertWarnsRegex(MockMail.SendmailWarning, r'KeyError'): <ide> self.loader.mail_admins(fail_silently=True, **opts) <del> warning = log[0].message <del> <del> self.assertIsInstance(warning, MockMail.SendmailWarning) <del> self.assertIn("KeyError", warning.args[0]) <ide> <del> with self.assertRaises(KeyError): <del> self.loader.mail_admins(fail_silently=False, **opts) <add> with self.assertRaises(KeyError): <add> self.loader.mail_admins(fail_silently=False, **opts) <ide> <ide> def test_mail_admins(self): <ide> MockMail.Mailer.raise_on_send = False <ide> def test_cmdline_config_ValueError(self): <ide> self.loader.cmdline_config_parser(["broker.port=foobar"]) <ide> <ide> <del>class TestDefaultLoader(unittest.TestCase): <add>class TestDefaultLoader(Case): <ide> <ide> def test_wanted_module_item(self): <ide> l = default.Loader() <ide> def find_module(self, name): <ide> self.assertTrue(context_executed[0]) <ide> <ide> <del>class test_AppLoader(unittest.TestCase): <add>class test_AppLoader(Case): <ide> <ide> def setUp(self): <ide> self.app = app_or_default() <ide><path>celery/tests/test_bin/test_celeryd.py <ide> import logging <ide> import os <ide> import sys <del>import warnings <ide> <ide> from functools import wraps <ide> try: <ide> main as celeryd_main <ide> from celery.exceptions import ImproperlyConfigured <ide> <del>from celery.tests.compat import catch_warnings <ide> from celery.tests.utils import (AppCase, WhateverIO, mask_modules, <ide> reset_modules, skip_unless_module) <ide> <ide> def test_warns_if_running_as_privileged_user(self): <ide> app = current_app <ide> if app.IS_WINDOWS: <ide> raise SkipTest("Not applicable on Windows") <del> warnings.resetwarnings() <ide> <ide> def getuid(): <ide> return 0 <ide> <ide> prev, os.getuid = os.getuid, getuid <ide> try: <del> with catch_warnings(record=True) as log: <add> with self.assertWarnsRegex(RuntimeWarning, <add> r'superuser privileges is discouraged'): <ide> worker = self.Worker() <ide> worker.run() <del> self.assertTrue(log) <del> self.assertIn("superuser privileges is discouraged", <del> log[0].message.args[0]) <ide> finally: <ide> os.getuid = prev <ide> <ide><path>celery/tests/test_compat/test_decorators.py <ide> from __future__ import absolute_import <ide> from __future__ import with_statement <ide> <del>import warnings <del> <ide> from celery.task import base <ide> <ide> from celery.tests.compat import catch_warnings <del>from celery.tests.utils import unittest <add>from celery.tests.utils import Case <ide> <ide> <ide> def add(x, y): <ide> return x + y <ide> <ide> <del>class test_decorators(unittest.TestCase): <add>class test_decorators(Case): <ide> <ide> def setUp(self): <del> warnings.resetwarnings() <del> <ide> with catch_warnings(record=True): <ide> from celery import decorators <ide> self.decorators = decorators <ide><path>celery/tests/test_task/test_task_builtins.py <ide> from __future__ import absolute_import <ide> from __future__ import with_statement <ide> <del>import warnings <del> <ide> from celery.task import ping, PingTask, backend_cleanup <ide> from celery.exceptions import CDeprecationWarning <del>from celery.tests.compat import catch_warnings <del>from celery.tests.utils import unittest <add>from celery.tests.utils import Case <ide> <ide> <ide> def some_func(i): <ide> return i * i <ide> <ide> <del>class test_deprecated(unittest.TestCase): <add>class test_deprecated(Case): <ide> <ide> def test_ping(self): <del> warnings.resetwarnings() <del> <del> with catch_warnings(record=True) as log: <add> with self.assertWarnsRegex(CDeprecationWarning, <add> r'ping task has been deprecated'): <ide> prev = PingTask.app.conf.CELERY_ALWAYS_EAGER <ide> PingTask.app.conf.CELERY_ALWAYS_EAGER = True <ide> try: <del> pong = ping() <del> warning = log[0].message <del> self.assertEqual(pong, "pong") <del> self.assertIsInstance(warning, CDeprecationWarning) <del> self.assertIn("ping task has been deprecated", <del> warning.args[0]) <add> self.assertEqual(ping(), "pong") <ide> finally: <ide> PingTask.app.conf.CELERY_ALWAYS_EAGER = prev <ide> <ide> def test_TaskSet_import_from_task_base(self): <del> warnings.resetwarnings() <del> <del> with catch_warnings(record=True) as log: <add> with self.assertWarnsRegex(CDeprecationWarning, r'is deprecated'): <ide> from celery.task.base import TaskSet, subtask <ide> TaskSet() <ide> subtask(PingTask) <del> for w in (log[0].message, log[1].message): <del> self.assertIsInstance(w, CDeprecationWarning) <del> self.assertIn("is deprecated", w.args[0]) <ide> <ide> <del>class test_backend_cleanup(unittest.TestCase): <add>class test_backend_cleanup(Case): <ide> <ide> def test_run(self): <ide> backend_cleanup.apply() <ide><path>celery/tests/test_task/test_task_sets.py <ide> from __future__ import with_statement <ide> <ide> import anyjson <del>import warnings <ide> <ide> from celery import registry <ide> from celery.app import app_or_default <add>from celery.exceptions import CDeprecationWarning <ide> from celery.task import Task <ide> from celery.task.sets import subtask, TaskSet <ide> <del>from celery.tests.utils import unittest <del>from celery.tests.compat import catch_warnings <add>from celery.tests.utils import Case <ide> <ide> <ide> class MockTask(Task): <ide> def apply(cls, args, kwargs, **options): <ide> return (args, kwargs, options) <ide> <ide> <del>class test_subtask(unittest.TestCase): <add>class test_subtask(Case): <ide> <ide> def test_behaves_like_type(self): <ide> s = subtask("tasks.add", (2, 2), {"cache": True}, <ide> def test_reduce(self): <ide> self.assertDictEqual(dict(cls(*args)), dict(s)) <ide> <ide> <del>class test_TaskSet(unittest.TestCase): <add>class test_TaskSet(Case): <ide> <ide> def test_interface__compat(self): <del> warnings.resetwarnings() <del> with catch_warnings(record=True) as log: <add> with self.assertWarnsRegex(CDeprecationWarning, <add> r'Using this invocation of TaskSet is deprecated'): <ide> ts = TaskSet(MockTask, [[(2, 2)], [(4, 4)], [(8, 8)]]) <ide> self.assertListEqual(ts.tasks, <ide> [MockTask.subtask((i, i)) <ide> for i in (2, 4, 8)]) <del> self.assertIn("Using this invocation of TaskSet is deprecated", <del> log[0].message.args[0]) <del> log[:] = [] <add> with self.assertWarnsRegex(CDeprecationWarning, <add> r'TaskSet.task is deprecated'): <ide> self.assertEqual(ts.task, registry.tasks[MockTask.name]) <del> self.assertTrue(log) <del> self.assertIn("TaskSet.task is deprecated", <del> log[0].message.args[0]) <ide> <del> log[:] = [] <add> with self.assertWarnsRegex(CDeprecationWarning, <add> r'TaskSet.task_name is deprecated'): <ide> self.assertEqual(ts.task_name, MockTask.name) <del> self.assertTrue(log) <del> self.assertIn("TaskSet.task_name is deprecated", <del> log[0].message.args[0]) <ide> <ide> def test_task_arg_can_be_iterable__compat(self): <ide> ts = TaskSet([MockTask.subtask((i, i)) <ide><path>celery/tests/test_utils/test_timer2.py <ide> <ide> import sys <ide> import time <del>import warnings <ide> <ide> from kombu.tests.utils import redirect_stdouts <ide> from mock import Mock, patch <ide> <ide> import celery.utils.timer2 as timer2 <ide> <del>from celery.tests.utils import unittest, skip_if_quick <del>from celery.tests.compat import catch_warnings <add>from celery.tests.utils import Case, skip_if_quick <ide> <ide> <del>class test_Entry(unittest.TestCase): <add>class test_Entry(Case): <ide> <ide> def test_call(self): <ide> scratch = [None] <ide> def test_cancel(self): <ide> self.assertTrue(tref.cancelled) <ide> <ide> <del>class test_Schedule(unittest.TestCase): <add>class test_Schedule(Case): <ide> <ide> def test_handle_error(self): <ide> from datetime import datetime <ide> def on_error(exc_info): <ide> self.assertIsInstance(exc, OverflowError) <ide> <ide> <del>class test_Timer(unittest.TestCase): <add>class test_Timer(Case): <ide> <ide> @skip_if_quick <ide> def test_enter_after(self): <ide> def test_apply_entry_error_handled(self, stdout, stderr): <ide> <ide> fun = Mock() <ide> fun.side_effect = ValueError() <del> warnings.resetwarnings() <ide> <del> with catch_warnings(record=True) as log: <add> with self.assertWarns(timer2.TimedFunctionFailed): <ide> t.apply_entry(fun) <ide> fun.assert_called_with() <del> self.assertTrue(log) <del> self.assertTrue(stderr.getvalue()) <ide> <ide> @redirect_stdouts <ide> def test_apply_entry_error_not_handled(self, stdout, stderr): <ide> def test_apply_entry_error_not_handled(self, stdout, stderr): <ide> <ide> fun = Mock() <ide> fun.side_effect = ValueError() <del> warnings.resetwarnings() <del> <del> with catch_warnings(record=True) as log: <del> t.apply_entry(fun) <del> fun.assert_called_with() <del> self.assertFalse(log) <del> self.assertFalse(stderr.getvalue()) <add> t.apply_entry(fun) <add> fun.assert_called_with() <add> self.assertFalse(stderr.getvalue()) <ide> <ide> @patch("os._exit") <ide> def test_thread_crash(self, _exit): <ide><path>celery/tests/test_worker/__init__.py <ide> from celery.utils.serialization import pickle <ide> from celery.utils.timer2 import Timer <ide> <del>from celery.tests.compat import catch_warnings <del>from celery.tests.utils import unittest <del>from celery.tests.utils import AppCase <add>from celery.tests.utils import AppCase, Case <ide> <ide> <ide> class PlaceHolder(object): <ide> def create_message(channel, **data): <ide> delivery_info={"consumer_tag": "mock"}) <ide> <ide> <del>class test_QoS(unittest.TestCase): <add>class test_QoS(Case): <ide> <ide> class _QoS(QoS): <ide> def __init__(self, value): <ide> def test_set(self): <ide> qos.set(qos.prev) <ide> <ide> <del>class test_Consumer(unittest.TestCase): <add>class test_Consumer(Case): <ide> <ide> def setUp(self): <ide> self.ready_queue = FastQueue() <ide> def test_receive_message_unknown(self): <ide> l.event_dispatcher = Mock() <ide> l.pidbox_node = MockNode() <ide> <del> with catch_warnings(record=True) as log: <add> with self.assertWarnsRegex(RuntimeWarning, r'unknown message'): <ide> l.receive_message(m.decode(), m) <del> self.assertTrue(log) <del> self.assertIn("unknown message", log[0].message.args[0]) <ide> <ide> @patch("celery.utils.timer2.to_timestamp") <ide> def test_receive_message_eta_OverflowError(self, to_timestamp): <ide> def test_receieve_message_ack_raises(self): <ide> l.logger = Mock() <ide> m.ack = Mock() <ide> m.ack.side_effect = socket.error("foo") <del> with catch_warnings(record=True) as log: <add> with self.assertWarnsRegex(RuntimeWarning, r'unknown message'): <ide> self.assertFalse(l.receive_message(m.decode(), m)) <del> self.assertTrue(log) <del> self.assertIn("unknown message", log[0].message.args[0]) <ide> with self.assertRaises(Empty): <ide> self.ready_queue.get_nowait() <ide> self.assertTrue(self.eta_schedule.empty()) <ide><path>celery/tests/test_worker/test_worker_job.py <ide> from celery.worker.job import Request, TaskRequest, execute_and_trace <ide> from celery.worker.state import revoked <ide> <del>from celery.tests.compat import catch_warnings <del>from celery.tests.utils import unittest <del>from celery.tests.utils import WhateverIO, wrap_logger <add>from celery.tests.utils import Case, WhateverIO, wrap_logger <ide> <ide> <ide> scratch = {"ACK": False} <ide> def mytask_raising(i, **kwargs): <ide> raise KeyError(i) <ide> <ide> <del>class test_default_encode(unittest.TestCase): <add>class test_default_encode(Case): <ide> <ide> def setUp(self): <ide> if sys.version_info >= (3, 0): <ide> def test_cython(self): <ide> sys.getfilesystemencoding = gfe <ide> <ide> <del>class test_RetryTaskError(unittest.TestCase): <add>class test_RetryTaskError(Case): <ide> <ide> def test_retry_task_error(self): <ide> try: <ide> def test_retry_task_error(self): <ide> self.assertEqual(ret.exc, exc) <ide> <ide> <del>class test_trace_task(unittest.TestCase): <add>class test_trace_task(Case): <ide> <ide> def test_process_cleanup_fails(self): <ide> backend = mytask.backend <ide> def send(self, event, **fields): <ide> self.sent.append(event) <ide> <ide> <del>class test_TaskRequest(unittest.TestCase): <add>class test_TaskRequest(Case): <ide> <ide> def test_task_wrapper_repr(self): <ide> tw = TaskRequest(mytask.name, uuid(), [1], {"f": "x"}) <ide> def test_execute_and_trace(self): <ide> self.assertEqual(res, 4 ** 4) <ide> <ide> def test_execute_safe_catches_exception(self): <del> warnings.resetwarnings() <ide> <ide> def _error_exec(self, *args, **kwargs): <ide> raise KeyError("baz") <ide> def raising(): <ide> raise KeyError("baz") <ide> raising.request = None <ide> <del> with catch_warnings(record=True) as log: <add> with self.assertWarnsRegex(RuntimeWarning, r'Exception raised outside'): <ide> res = execute_and_trace(raising.name, uuid(), <ide> [], {}) <ide> self.assertIsInstance(res, ExceptionInfo) <del> self.assertTrue(log) <del> self.assertIn("Exception outside", log[0].message.args[0]) <del> self.assertIn("AttributeError", log[0].message.args[0]) <ide> <ide> def create_exception(self, exc): <ide> try: <ide><path>celery/tests/utils.py <ide> import importlib <ide> import logging <ide> import os <add>import re <ide> import sys <ide> import time <add>import warnings <ide> try: <ide> import __builtin__ as builtins <ide> except ImportError: # py3k <ide> from functools import wraps <ide> from contextlib import contextmanager <ide> <del> <ide> import mock <ide> from nose import SkipTest <ide> <ide> from ..app import app_or_default <ide> from ..utils import noop <ide> from ..utils.compat import WhateverIO, LoggerAdapter <ide> <add>from .compat import catch_warnings <add> <ide> <ide> class Mock(mock.Mock): <ide> <ide> def __inner(*args, **kwargs): <ide> return _inner <ide> <ide> <del>class AppCase(unittest.TestCase): <add># -- adds assertWarns from recent unittest2, not in Python 2.7. <add> <add>class _AssertRaisesBaseContext(object): <add> <add> def __init__(self, expected, test_case, callable_obj=None, <add> expected_regex=None): <add> self.expected = expected <add> self.failureException = test_case.failureException <add> self.obj_name = None <add> if isinstance(expected_regex, basestring): <add> expected_regex = re.compile(expected_regex) <add> self.expected_regex = expected_regex <add> <add> <add>class _AssertWarnsContext(_AssertRaisesBaseContext): <add> """A context manager used to implement TestCase.assertWarns* methods.""" <add> <add> def __enter__(self): <add> # The __warningregistry__'s need to be in a pristine state for tests <add> # to work properly. <add> warnings.resetwarnings() <add> for v in sys.modules.values(): <add> if getattr(v, '__warningregistry__', None): <add> v.__warningregistry__ = {} <add> self.warnings_manager = catch_warnings(record=True) <add> self.warnings = self.warnings_manager.__enter__() <add> warnings.simplefilter("always", self.expected) <add> return self <add> <add> def __exit__(self, exc_type, exc_value, tb): <add> self.warnings_manager.__exit__(exc_type, exc_value, tb) <add> if exc_type is not None: <add> # let unexpected exceptions pass through <add> return <add> try: <add> exc_name = self.expected.__name__ <add> except AttributeError: <add> exc_name = str(self.expected) <add> first_matching = None <add> for m in self.warnings: <add> w = m.message <add> if not isinstance(w, self.expected): <add> continue <add> if first_matching is None: <add> first_matching = w <add> if (self.expected_regex is not None and <add> not self.expected_regex.search(str(w))): <add> continue <add> # store warning for later retrieval <add> self.warning = w <add> self.filename = m.filename <add> self.lineno = m.lineno <add> return <add> # Now we simply try to choose a helpful failure message <add> if first_matching is not None: <add> raise self.failureException('%r does not match %r' % <add> (self.expected_regex.pattern, str(first_matching))) <add> if self.obj_name: <add> raise self.failureException("%s not triggered by %s" <add> % (exc_name, self.obj_name)) <add> else: <add> raise self.failureException("%s not triggered" <add> % exc_name ) <add> <add> <add>class Case(unittest.TestCase): <add> <add> def assertWarns(self, expected_warning): <add> return _AssertWarnsContext(expected_warning, self, None) <add> <add> def assertWarnsRegex(self, expected_warning, expected_regex): <add> return _AssertWarnsContext(expected_warning, self, <add> None, expected_regex) <add> <add>class AppCase(Case): <ide> <ide> def setUp(self): <ide> from ..app import current_app
11
Javascript
Javascript
fix grabquestion on mobile
835a47828229db7dd5d8d78642466389bcd8e546
<ide><path>common/app/routes/Hikes/flux/Actions.js <ide> export default Actions({ <ide> }, <ide> <ide> grabQuestion(e) { <del> const { pageX, pageY } = e; <add> let { pageX, pageY, touches } = e; <add> if (touches) { <add> e.preventDefault(); <add> // these re-assigns the values of pageX, pageY from touches <add> ({ pageX, pageY } = touches[0]); <add> } <ide> const delta = [pageX, pageY]; <del> const mouse = getMouse(e, delta); <add> const mouse = [0, 0]; <ide> <ide> return { <ide> transform(state) {
1
Ruby
Ruby
remove unused table
531063543b99c02e69470e39b3eee677aa85e66f
<ide><path>activerecord/test/schema/postgresql_specific_schema.rb <ide> end <ide> end <ide> <del> begin <del> execute <<_SQL <del> CREATE TABLE postgresql_xml_data_type ( <del> id SERIAL PRIMARY KEY, <del> data xml <del> ); <del>_SQL <del> rescue #This version of PostgreSQL either has no XML support or is was not compiled with XML support: skipping table <del> end <del> <ide> # This table is to verify if the :limit option is being ignored for text and binary columns <ide> create_table :limitless_fields, force: true do |t| <ide> t.binary :binary, limit: 100_000
1
Python
Python
add a comment, use a better variable name
e1c634d03eae0261b4a71cf5cb4693de13f9fdf4
<ide><path>libcloud/storage/drivers/cloudfiles.py <ide> <ide> CDN_HOST = 'cdn.clouddrive.com' <ide> API_VERSION = 'v1.0' <add> <add># Keys which are used to select a correct endpoint from the service catalog. <ide> INTERNAL_ENDPOINT_KEY = 'internalURL' <ide> PUBLIC_ENDPOINT_KEY = 'publicURL' <ide> <ide> def __init__(self, user_id, key, secure=True, <ide> <ide> def _get_endpoint_key(self): <ide> endpoint_key = INTERNAL_ENDPOINT_KEY if self.use_internal_url else PUBLIC_ENDPOINT_KEY <add> <ide> if self.cdn_request: <ide> endpoint_key = PUBLIC_ENDPOINT_KEY # cdn endpoints don't have internal urls <ide> return endpoint_key <ide> def get_endpoint(self): <ide> # if this is a CDN request, return the cdn url instead <ide> if self.cdn_request: <ide> ep = cdn_ep <del> endpoint_url = self._get_endpoint_key() <add> <add> endpoint_key = self._get_endpoint_key() <ide> <ide> if not ep: <ide> raise LibcloudError('Could not find specified endpoint') <ide> <del> if endpoint_url in ep: <del> return ep[endpoint_url] <add> if endpoint_key in ep: <add> return ep[endpoint_key] <ide> else: <ide> raise LibcloudError('Could not find specified endpoint') <ide>
1
PHP
PHP
add new error pages
2265a8c9a110679c041da2f9bbe407e732e49071
<ide><path>src/Illuminate/Foundation/Exceptions/views/403.blade.php <add>@extends('errors::layout') <add> <add>@section('code', '403') <add>@section('title', 'Unauthorized') <add> <add>@section('image') <add><div style="background-image: url('/svg/403.svg');" class="absolute pin bg-cover bg-no-repeat md:bg-left lg:bg-center"> <add></div> <add>@endsection <add> <add>@section('message', 'Sorry, you may not access this page.') <ide><path>src/Illuminate/Foundation/Exceptions/views/404.blade.php <ide> @extends('errors::layout') <ide> <add>@section('code', '404') <ide> @section('title', 'Page Not Found') <ide> <add>@section('image') <add><div style="background-image: url('/svg/404.svg');" class="absolute pin bg-cover bg-no-repeat md:bg-left lg:bg-center"> <add></div> <add>@endsection <add> <ide> @section('message', 'Sorry, the page you are looking for could not be found.') <ide><path>src/Illuminate/Foundation/Exceptions/views/419.blade.php <ide> @extends('errors::layout') <ide> <add>@section('code', '419') <ide> @section('title', 'Page Expired') <ide> <del>@section('message') <del> The page has expired due to inactivity. <del> <br/><br/> <del> Please refresh and try again. <del>@stop <add>@section('image') <add><div style="background-image: url('/svg/403.svg');" class="absolute pin bg-cover bg-no-repeat md:bg-left lg:bg-center"> <add></div> <add>@endsection <add> <add>@section('message', 'Sorry, your session has expired. Please refresh and try again.') <ide><path>src/Illuminate/Foundation/Exceptions/views/429.blade.php <ide> @extends('errors::layout') <ide> <del>@section('title', 'Error') <add>@section('code', '429') <add>@section('title', 'Too Many Requests') <ide> <del>@section('message', 'Too many requests.') <add>@section('image') <add><div style="background-image: url('/svg/403.svg');" class="absolute pin bg-cover bg-no-repeat md:bg-left lg:bg-center"> <add></div> <add>@endsection <add> <add>@section('message', 'Sorry, you are making too many requests to our servers.') <ide><path>src/Illuminate/Foundation/Exceptions/views/500.blade.php <ide> @extends('errors::layout') <ide> <add>@section('code', '500') <ide> @section('title', 'Error') <ide> <del>@section('message', 'Whoops, looks like something went wrong.') <add>@section('image') <add><div style="background-image: url('/svg/500.svg');" class="absolute pin bg-cover bg-no-repeat md:bg-left lg:bg-center"> <add></div> <add>@endsection <add> <add>@section('message', 'Whoops, something went wrong on our servers.') <ide><path>src/Illuminate/Foundation/Exceptions/views/503.blade.php <ide> @extends('errors::layout') <ide> <add>@section('code', '503') <ide> @section('title', 'Service Unavailable') <ide> <del>@section('message', 'Be right back.') <add>@section('image') <add><div style="background-image: url('/svg/503.svg');" class="absolute pin bg-cover bg-no-repeat md:bg-left lg:bg-center"> <add></div> <add>@endsection <add> <add>@section('message', 'Sorry, we are doing some maintenance. Please check back soon.') <ide><path>src/Illuminate/Foundation/Exceptions/views/layout.blade.php <del><!DOCTYPE html> <add><!doctype html> <ide> <html lang="en"> <del> <head> <del> <meta charset="utf-8"> <del> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <del> <meta name="viewport" content="width=device-width, initial-scale=1"> <del> <del> <title>@yield('title')</title> <del> <del> <!-- Fonts --> <del> <link href="https://fonts.googleapis.com/css?family=Nunito" rel="stylesheet" type="text/css"> <del> <del> <!-- Styles --> <del> <style> <del> html, body { <del> background-color: #fff; <del> color: #636b6f; <del> font-family: 'Nunito', sans-serif; <del> font-weight: 100; <del> height: 100vh; <del> margin: 0; <del> } <del> <del> .full-height { <del> height: 100vh; <del> } <del> <del> .flex-center { <add> <head> <add> <title>@yield('title')</title> <add> <add> <meta charset="utf-8"> <add> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <add> <add> <!-- Fonts --> <add> <link href="https://fonts.googleapis.com/css?family=Nunito" rel="stylesheet" type="text/css"> <add> <add> <!-- Styles --> <add> <style> <add> html { <add> line-height: 1.15; <add> -ms-text-size-adjust: 100%; <add> -webkit-text-size-adjust: 100%; <add> } <add> <add> body { <add> margin: 0; <add> } <add> <add> header, <add> nav, <add> section { <add> display: block; <add> } <add> <add> figcaption, <add> main { <add> display: block; <add> } <add> <add> a { <add> background-color: transparent; <add> -webkit-text-decoration-skip: objects; <add> } <add> <add> strong { <add> font-weight: inherit; <add> } <add> <add> strong { <add> font-weight: bolder; <add> } <add> <add> code { <add> font-family: monospace, monospace; <add> font-size: 1em; <add> } <add> <add> dfn { <add> font-style: italic; <add> } <add> <add> svg:not(:root) { <add> overflow: hidden; <add> } <add> <add> button, <add> input { <add> font-family: sans-serif; <add> font-size: 100%; <add> line-height: 1.15; <add> margin: 0; <add> } <add> <add> button, <add> input { <add> overflow: visible; <add> } <add> <add> button { <add> text-transform: none; <add> } <add> <add> button, <add> html [type="button"], <add> [type="reset"], <add> [type="submit"] { <add> -webkit-appearance: button; <add> } <add> <add> button::-moz-focus-inner, <add> [type="button"]::-moz-focus-inner, <add> [type="reset"]::-moz-focus-inner, <add> [type="submit"]::-moz-focus-inner { <add> border-style: none; <add> padding: 0; <add> } <add> <add> button:-moz-focusring, <add> [type="button"]:-moz-focusring, <add> [type="reset"]:-moz-focusring, <add> [type="submit"]:-moz-focusring { <add> outline: 1px dotted ButtonText; <add> } <add> <add> legend { <add> -webkit-box-sizing: border-box; <add> box-sizing: border-box; <add> color: inherit; <add> display: table; <add> max-width: 100%; <add> padding: 0; <add> white-space: normal; <add> } <add> <add> [type="checkbox"], <add> [type="radio"] { <add> -webkit-box-sizing: border-box; <add> box-sizing: border-box; <add> padding: 0; <add> } <add> <add> [type="number"]::-webkit-inner-spin-button, <add> [type="number"]::-webkit-outer-spin-button { <add> height: auto; <add> } <add> <add> [type="search"] { <add> -webkit-appearance: textfield; <add> outline-offset: -2px; <add> } <add> <add> [type="search"]::-webkit-search-cancel-button, <add> [type="search"]::-webkit-search-decoration { <add> -webkit-appearance: none; <add> } <add> <add> ::-webkit-file-upload-button { <add> -webkit-appearance: button; <add> font: inherit; <add> } <add> <add> menu { <add> display: block; <add> } <add> <add> canvas { <add> display: inline-block; <add> } <add> <add> template { <add> display: none; <add> } <add> <add> [hidden] { <add> display: none; <add> } <add> <add> html { <add> -webkit-box-sizing: border-box; <add> box-sizing: border-box; <add> font-family: sans-serif; <add> } <add> <add> *, <add> *::before, <add> *::after { <add> -webkit-box-sizing: inherit; <add> box-sizing: inherit; <add> } <add> <add> p { <add> margin: 0; <add> } <add> <add> button { <add> background: transparent; <add> padding: 0; <add> } <add> <add> button:focus { <add> outline: 1px dotted; <add> outline: 5px auto -webkit-focus-ring-color; <add> } <add> <add> *, <add> *::before, <add> *::after { <add> border-width: 0; <add> border-style: solid; <add> border-color: #dae1e7; <add> } <add> <add> button, <add> [type="button"], <add> [type="reset"], <add> [type="submit"] { <add> border-radius: 0; <add> } <add> <add> button, <add> input { <add> font-family: inherit; <add> } <add> <add> input::-webkit-input-placeholder { <add> color: inherit; <add> opacity: .5; <add> } <add> <add> input:-ms-input-placeholder { <add> color: inherit; <add> opacity: .5; <add> } <add> <add> input::-ms-input-placeholder { <add> color: inherit; <add> opacity: .5; <add> } <add> <add> input::placeholder { <add> color: inherit; <add> opacity: .5; <add> } <add> <add> button, <add> [role=button] { <add> cursor: pointer; <add> } <add> <add> .bg-transparent { <add> background-color: transparent; <add> } <add> <add> .bg-white { <add> background-color: #fff; <add> } <add> <add> .bg-teal-light { <add> background-color: #64d5ca; <add> } <add> <add> .bg-blue-dark { <add> background-color: #2779bd; <add> } <add> <add> .bg-indigo-light { <add> background-color: #7886d7; <add> } <add> <add> .bg-purple-light { <add> background-color: #a779e9; <add> } <add> <add> .bg-no-repeat { <add> background-repeat: no-repeat; <add> } <add> <add> .bg-cover { <add> background-size: cover; <add> } <add> <add> .border-grey-light { <add> border-color: #dae1e7; <add> } <add> <add> .hover\:border-grey:hover { <add> border-color: #b8c2cc; <add> } <add> <add> .rounded-lg { <add> border-radius: .5rem; <add> } <add> <add> .border-2 { <add> border-width: 2px; <add> } <add> <add> .hidden { <add> display: none; <add> } <add> <add> .flex { <add> display: -webkit-box; <add> display: -ms-flexbox; <add> display: flex; <add> } <add> <add> .items-center { <add> -webkit-box-align: center; <add> -ms-flex-align: center; <ide> align-items: center; <del> display: flex; <add> } <add> <add> .justify-center { <add> -webkit-box-pack: center; <add> -ms-flex-pack: center; <ide> justify-content: center; <del> } <del> <del> .position-ref { <del> position: relative; <del> } <del> <del> .content { <del> text-align: center; <del> } <del> <del> .title { <del> font-size: 36px; <del> padding: 20px; <del> } <del> </style> <del> </head> <del> <body> <del> <div class="flex-center position-ref full-height"> <del> <div class="content"> <del> <div class="title"> <del> @yield('message') <del> </div> <del> </div> <add> } <add> <add> .font-sans { <add> font-family: Nunito, sans-serif; <add> } <add> <add> .font-light { <add> font-weight: 300; <add> } <add> <add> .font-bold { <add> font-weight: 700; <add> } <add> <add> .font-black { <add> font-weight: 900; <add> } <add> <add> .h-1 { <add> height: .25rem; <add> } <add> <add> .leading-normal { <add> line-height: 1.5; <add> } <add> <add> .m-8 { <add> margin: 2rem; <add> } <add> <add> .my-3 { <add> margin-top: .75rem; <add> margin-bottom: .75rem; <add> } <add> <add> .mb-8 { <add> margin-bottom: 2rem; <add> } <add> <add> .max-w-sm { <add> max-width: 30rem; <add> } <add> <add> .min-h-screen { <add> min-height: 100vh; <add> } <add> <add> .py-3 { <add> padding-top: .75rem; <add> padding-bottom: .75rem; <add> } <add> <add> .px-6 { <add> padding-left: 1.5rem; <add> padding-right: 1.5rem; <add> } <add> <add> .pb-full { <add> padding-bottom: 100%; <add> } <add> <add> .absolute { <add> position: absolute; <add> } <add> <add> .relative { <add> position: relative; <add> } <add> <add> .pin { <add> top: 0; <add> right: 0; <add> bottom: 0; <add> left: 0; <add> } <add> <add> .text-black { <add> color: #22292f; <add> } <add> <add> .text-grey-darkest { <add> color: #3d4852; <add> } <add> <add> .text-grey-darker { <add> color: #606f7b; <add> } <add> <add> .text-2xl { <add> font-size: 1.5rem; <add> } <add> <add> .text-5xl { <add> font-size: 3rem; <add> } <add> <add> .uppercase { <add> text-transform: uppercase; <add> } <add> <add> .antialiased { <add> -webkit-font-smoothing: antialiased; <add> -moz-osx-font-smoothing: grayscale; <add> } <add> <add> .tracking-wide { <add> letter-spacing: .05em; <add> } <add> <add> .w-16 { <add> width: 4rem; <add> } <add> <add> .w-full { <add> width: 100%; <add> } <add> <add> @media (min-width: 768px) { <add> .md\:bg-left { <add> background-position: left; <add> } <add> <add> .md\:bg-right { <add> background-position: right; <add> } <add> <add> .md\:flex { <add> display: -webkit-box; <add> display: -ms-flexbox; <add> display: flex; <add> } <add> <add> .md\:my-6 { <add> margin-top: 1.5rem; <add> margin-bottom: 1.5rem; <add> } <add> <add> .md\:min-h-screen { <add> min-height: 100vh; <add> } <add> <add> .md\:pb-0 { <add> padding-bottom: 0; <add> } <add> <add> .md\:text-3xl { <add> font-size: 1.875rem; <add> } <add> <add> .md\:text-15xl { <add> font-size: 9rem; <add> } <add> <add> .md\:w-1\/2 { <add> width: 50%; <add> } <add> } <add> <add> @media (min-width: 992px) { <add> .lg\:bg-center { <add> background-position: center; <add> } <add> } <add> </style> <add> </head> <add> <body class="antialiased font-sans"> <add> <div class="md:flex min-h-screen"> <add> <div class="w-full md:w-1/2 bg-white flex items-center justify-center"> <add> <div class="max-w-sm m-8"> <add> <div class="text-black text-5xl md:text-15xl font-black"> <add> @yield('code', 'Oh no') <add> </div> <add> <add> <div class="w-16 h-1 bg-purple-light my-3 md:my-6"></div> <add> <add> <p class="text-grey-darker text-2xl md:text-3xl font-light mb-8 leading-normal"> <add> @yield('message') <add> </p> <add> <add> <button class="bg-transparent text-grey-darkest font-bold uppercase tracking-wide py-3 px-6 border-2 border-grey-light hover:border-grey rounded-lg"> <add> Go Home <add> </button> <ide> </div> <del> </body> <add> </div> <add> <add> <div class="relative pb-full md:flex md:pb-0 md:min-h-screen w-full md:w-1/2"> <add> @yield('image') <add> </div> <add> </div> <add> </body> <ide> </html> <ide><path>src/Illuminate/Foundation/Exceptions/views/legacy-layout.blade.php <add><!DOCTYPE html> <add><html lang="en"> <add> <head> <add> <meta charset="utf-8"> <add> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <add> <meta name="viewport" content="width=device-width, initial-scale=1"> <add> <add> <title>@yield('title')</title> <add> <add> <!-- Fonts --> <add> <link href="https://fonts.googleapis.com/css?family=Nunito" rel="stylesheet" type="text/css"> <add> <add> <!-- Styles --> <add> <style> <add> html, body { <add> background-color: #fff; <add> color: #636b6f; <add> font-family: 'Nunito', sans-serif; <add> font-weight: 100; <add> height: 100vh; <add> margin: 0; <add> } <add> <add> .full-height { <add> height: 100vh; <add> } <add> <add> .flex-center { <add> align-items: center; <add> display: flex; <add> justify-content: center; <add> } <add> <add> .position-ref { <add> position: relative; <add> } <add> <add> .content { <add> text-align: center; <add> } <add> <add> .title { <add> font-size: 36px; <add> padding: 20px; <add> } <add> </style> <add> </head> <add> <body> <add> <div class="flex-center position-ref full-height"> <add> <div class="content"> <add> <div class="title"> <add> @yield('message') <add> </div> <add> </div> <add> </div> <add> </body> <add></html>
8
PHP
PHP
deprecate $autorender property
c8f5aff1e42fc983a9c344fab7c0261c819ae938
<ide><path>src/Controller/Controller.php <ide> class Controller implements EventListenerInterface, EventDispatcherInterface <ide> * after action logic. <ide> * <ide> * @var bool <add> * @deprecated 3.5.0 Use enableAutoRender()/disableAutoRender() and isAutoRenderEnabled() instead. <ide> */ <ide> protected $autoRender = true; <ide>
1
Go
Go
improve testservicelogs for the goroutine issue
f8a93d0c9d157dddc4e4d4d9c43a6fe7c7c0c242
<ide><path>integration-cli/docker_cli_service_logs_experimental_test.go <ide> func (s *DockerSwarmSuite) TestServiceLogs(c *check.C) { <ide> <ide> d := s.AddDaemon(c, true, true) <ide> <del> name := "TestServiceLogs" <add> // we have multiple services here for detecting the goroutine issue #28915 <add> services := map[string]string{ <add> "TestServiceLogs1": "hello1", <add> "TestServiceLogs2": "hello2", <add> } <ide> <del> out, err := d.Cmd("service", "create", "--name", name, "--restart-condition", "none", "busybox", "sh", "-c", "echo hello world") <del> c.Assert(err, checker.IsNil) <del> c.Assert(strings.TrimSpace(out), checker.Not(checker.Equals), "") <add> for name, message := range services { <add> out, err := d.Cmd("service", "create", "--name", name, "busybox", <add> "sh", "-c", fmt.Sprintf("echo %s; tail -f /dev/null", message)) <add> c.Assert(err, checker.IsNil) <add> c.Assert(strings.TrimSpace(out), checker.Not(checker.Equals), "") <add> } <ide> <ide> // make sure task has been deployed. <del> waitAndAssert(c, defaultReconciliationTimeout, d.checkActiveContainerCount, checker.Equals, 1) <del> <del> out, err = d.Cmd("service", "logs", name) <del> fmt.Println(out) <del> c.Assert(err, checker.IsNil) <del> c.Assert(out, checker.Contains, "hello world") <add> waitAndAssert(c, defaultReconciliationTimeout, <add> d.checkActiveContainerCount, checker.Equals, len(services)) <add> <add> for name, message := range services { <add> out, err := d.Cmd("service", "logs", name) <add> c.Assert(err, checker.IsNil) <add> c.Logf("log for %q: %q", name, out) <add> c.Assert(out, checker.Contains, message) <add> } <ide> } <ide> <ide> func (s *DockerSwarmSuite) TestServiceLogsFollow(c *check.C) {
1
Ruby
Ruby
pass missing name attribute to execute_hook
e15583c32e292acdd595dbf137d1c7cb0ea73e58
<ide><path>activesupport/lib/active_support/lazy_load_hooks.rb <ide> def self.extended(base) # :nodoc: <ide> # * <tt>:run_once</tt> - Given +block+ will run only once. <ide> def on_load(name, options = {}, &block) <ide> @loaded[name].each do |base| <del> execute_hook(base, options, block) <add> execute_hook(name, base, options, block) <ide> end <ide> <ide> @load_hooks[name] << [block, options] <ide> def on_load(name, options = {}, &block) <ide> def run_load_hooks(name, base = Object) <ide> @loaded[name] << base <ide> @load_hooks[name].each do |hook, options| <del> execute_hook(base, options, hook) <add> execute_hook(name, base, options, hook) <ide> end <ide> end <ide> <ide> def with_execution_control(name, block, once) <ide> end <ide> end <ide> <del> def execute_hook(base, options, block) <add> def execute_hook(name, base, options, block) <ide> with_execution_control(name, block, options[:run_once]) do <ide> if options[:yield] <ide> block.call(base) <ide><path>activesupport/test/lazy_load_hooks_test.rb <ide> def test_basic_hook_with_two_registrations <ide> <ide> def test_basic_hook_with_two_registrations_only_once <ide> i = 0 <del> ActiveSupport.on_load(:basic_hook_with_two_once, run_once: true) do <add> block = proc { i += incr } <add> ActiveSupport.on_load(:basic_hook_with_two_once, run_once: true, &block) <add> ActiveSupport.on_load(:basic_hook_with_two_once) do <ide> i += incr <ide> end <del> assert_equal 0, i <del> ActiveSupport.run_load_hooks(:basic_hook_with_two_once, FakeContext.new(2)) <add> <add> ActiveSupport.on_load(:different_hook, run_once: true, &block) <add> ActiveSupport.run_load_hooks(:different_hook, FakeContext.new(2)) <ide> assert_equal 2, i <add> ActiveSupport.run_load_hooks(:basic_hook_with_two_once, FakeContext.new(2)) <add> assert_equal 6, i <ide> ActiveSupport.run_load_hooks(:basic_hook_with_two_once, FakeContext.new(5)) <del> assert_equal 2, i <add> assert_equal 11, i <ide> end <ide> <ide> def test_hook_registered_after_run
2
Javascript
Javascript
add position to picker onvaluechange's call
b454d31ab8d778c393a3a99869c50d1967baaaad
<ide><path>Libraries/Components/Picker/PickerAndroid.android.js <ide> var PickerAndroid = React.createClass({ <ide> var position = event.nativeEvent.position; <ide> if (position >= 0) { <ide> var value = this.props.children[position].props.value; <del> this.props.onValueChange(value); <add> this.props.onValueChange(value, position); <ide> } else { <del> this.props.onValueChange(null); <add> this.props.onValueChange(null, position); <ide> } <ide> } <ide> <ide><path>Libraries/Picker/PickerIOS.ios.js <ide> var PickerIOS = React.createClass({ <ide> }); <ide> return {selectedIndex, items}; <ide> }, <del> <add> <ide> render: function() { <ide> return ( <ide> <View style={this.props.style}> <ide> var PickerIOS = React.createClass({ <ide> this.props.onChange(event); <ide> } <ide> if (this.props.onValueChange) { <del> this.props.onValueChange(event.nativeEvent.newValue); <add> this.props.onValueChange(event.nativeEvent.newValue, event.nativeEvent.newIndex); <ide> } <ide> <ide> // The picker is a controlled component. This means we expect the
2
Javascript
Javascript
fix sky shader on android/s6
e62a212bcd32fa063bd6a03746ba9a3b7213a9a7
<ide><path>examples/js/SkyShader.js <ide> THREE.ShaderLib[ 'sky' ] = { <ide> <ide> "float sunIntensity(float zenithAngleCos)", <ide> "{", <del> "return EE * max(0.0, 1.0 - exp(-((cutoffAngle - acos(zenithAngleCos))/steepness)));", <add> // This function originally used `exp(n)`, but it returns an incorrect value <add> // on Samsung S6 phones. So it has been replaced with the equivalent `pow(e, n)`. <add> // See https://github.com/mrdoob/three.js/issues/8382 <add> "return EE * max(0.0, 1.0 - pow(e, -((cutoffAngle - acos(zenithAngleCos))/steepness)));", <ide> "}", <ide> <ide> "// float logLuminance(vec3 c)",
1
Ruby
Ruby
define the test_defined? method dynamically
281646b0895de6d1f8404730d1b94d4f90700161
<ide><path>Library/Homebrew/formula.rb <ide> def test <ide> end <ide> <ide> def test_defined? <del> not self.class.instance_variable_get(:@test_defined).nil? <add> false <ide> end <ide> <ide> protected <ide> def self.method_added method <ide> when :brew <ide> raise "You cannot override Formula#brew in class #{name}" <ide> when :test <del> @test_defined = true <add> define_method(:test_defined?) { true } <ide> when :options <ide> instance = allocate <ide> <ide> def needs *standards <ide> <ide> def test &block <ide> return @test unless block_given? <del> @test_defined = true <add> define_method(:test_defined?) { true } <ide> @test = block <ide> end <ide> end
1
Text
Text
fix the syntax error in doc tutorial
dde5e02c019ba75e7fd25a06ab449d4524f2f948
<ide><path>docs/Tutorial.md <ide> class AwesomeProject extends Component { <ide> </View> <ide> ); <ide> } <del>}); <add>} <ide> <ide> var styles = StyleSheet.create({ <ide> container: {
1
Mixed
Text
improve use_sha1_digests deprecation message
a03a2c4188bb7370fb24418488776157a59dfac7
<ide><path>activesupport/CHANGELOG.md <ide> <ide> *Adrianna Chang* <ide> <add>* Allow the digest class used to generate non-sensitive digests to be configured with `config.active_support.hash_digest_class`. <add> <add> `config.active_support.use_sha1_digests` is deprecated in favour of `config.active_support.hash_digest_class = ::Digest::SHA1`. <add> <add> *Dirkjan Bussink* <add> <ide> * Fix bug to make memcached write_entry expire correctly with unless_exist <ide> <ide> *Jye Lee* <ide><path>activesupport/lib/active_support/railtie.rb <ide> class Railtie < Rails::Railtie # :nodoc: <ide> if app.config.active_support.use_sha1_digests <ide> ActiveSupport::Deprecation.warn(<<-MSG.squish) <ide> config.active_support.use_sha1_digests is deprecated and will <del> be removed from Rails 6.2. Use config.active_support.hash_digest_class <del> instead. <add> be removed from Rails 6.2. Use <add> config.active_support.hash_digest_class = ::Digest::SHA1 instead. <ide> MSG <ide> ActiveSupport::Digest.hash_digest_class = ::Digest::SHA1 <ide> end <ide><path>guides/source/configuring.md <ide> text/javascript image/svg+xml application/postscript application/x-shockwave-fla <ide> - `config.active_record.collection_cache_versioning`: `false` <ide> - `config.active_record.has_many_inversing`: `false` <ide> - `config.active_support.use_authenticated_message_encryption`: `false` <del>- `config.active_support.use_sha1_digests`: `false` <add>- `config.active_support.hash_digest_class`: `::Digest::MD5` <ide> - `ActiveSupport.utc_to_local_returns_utc_offset_times`: `false` <ide> <ide> ### Configuring a Database <ide><path>railties/CHANGELOG.md <ide> <ide> *Nick Wolf* <ide> <del>* Deprecate `config.active_support.use_sha1_digests` <del> <del> `config.active_support.use_sha1_digests` is deprecated. It is replaced with `config.active_support.hash_digest_class` which allows setting the desired Digest instead. The Rails version defaults have been updated to use this new method as well so the behavior there is unchanged. <del> <del> *Dirkjan Bussink* <del> <ide> * Change the default logging level from :debug to :info to avoid inadvertent exposure of personally <ide> identifiable information (PII) in production environments. <ide>
4
Python
Python
fix model names in conftest (see )
b8ef9c1000696541df4366bfaacfdf71938595db
<ide><path>spacy/tests/conftest.py <ide> 'it', 'nb', 'nl', 'pl', 'pt', 'ro', 'ru', 'sv', 'tr', 'ar', 'xx'] <ide> <ide> _models = {'en': ['en_core_web_sm'], <del> 'de': ['de_core_news_md'], <add> 'de': ['de_core_news_sm'], <ide> 'fr': ['fr_core_news_sm'], <del> 'xx': ['xx_ent_web_md'], <add> 'xx': ['xx_ent_web_sm'], <ide> 'en_core_web_md': ['en_core_web_md'], <ide> 'es_core_news_md': ['es_core_news_md']} <ide>
1
Javascript
Javascript
make nested focus work as expected
c73ab39c1f5f466991b97c9e0c782910e3b1cf37
<ide><path>packages/react-events/src/Focus.js <ide> function createFocusEvent( <ide> } <ide> <ide> function dispatchFocusInEvents( <del> event: null | ReactResponderEvent, <ide> context: ReactResponderContext, <ide> props: FocusProps, <ide> state: FocusState, <ide> ) { <del> if (event != null) { <del> const {nativeEvent} = event; <del> if ( <del> context.isTargetWithinEventComponent((nativeEvent: any).relatedTarget) <del> ) { <del> return; <del> } <del> } <add> const target = ((state.focusTarget: any): Element | Document); <ide> if (props.onFocus) { <del> const syntheticEvent = createFocusEvent( <del> 'focus', <del> ((state.focusTarget: any): Element | Document), <del> ); <add> const syntheticEvent = createFocusEvent('focus', target); <ide> context.dispatchEvent(syntheticEvent, props.onFocus, {discrete: true}); <ide> } <ide> if (props.onFocusChange) { <ide> const listener = () => { <ide> props.onFocusChange(true); <ide> }; <del> const syntheticEvent = createFocusEvent( <del> 'focuschange', <del> ((state.focusTarget: any): Element | Document), <del> ); <add> const syntheticEvent = createFocusEvent('focuschange', target); <ide> context.dispatchEvent(syntheticEvent, listener, {discrete: true}); <ide> } <ide> } <ide> <ide> function dispatchFocusOutEvents( <del> event: null | ReactResponderEvent, <ide> context: ReactResponderContext, <ide> props: FocusProps, <ide> state: FocusState, <ide> ) { <del> if (event != null) { <del> const {nativeEvent} = event; <del> if ( <del> context.isTargetWithinEventComponent((nativeEvent: any).relatedTarget) <del> ) { <del> return; <del> } <del> } <add> const target = ((state.focusTarget: any): Element | Document); <ide> if (props.onBlur) { <del> const syntheticEvent = createFocusEvent( <del> 'blur', <del> ((state.focusTarget: any): Element | Document), <del> ); <add> const syntheticEvent = createFocusEvent('blur', target); <ide> context.dispatchEvent(syntheticEvent, props.onBlur, {discrete: true}); <ide> } <ide> if (props.onFocusChange) { <ide> const listener = () => { <ide> props.onFocusChange(false); <ide> }; <del> const syntheticEvent = createFocusEvent( <del> 'focuschange', <del> ((state.focusTarget: any): Element | Document), <del> ); <add> const syntheticEvent = createFocusEvent('focuschange', target); <ide> context.dispatchEvent(syntheticEvent, listener, {discrete: true}); <ide> } <ide> } <ide> function unmountResponder( <ide> state: FocusState, <ide> ): void { <ide> if (state.isFocused) { <del> dispatchFocusOutEvents(null, context, props, state); <add> dispatchFocusOutEvents(context, props, state); <ide> } <ide> } <ide> <ide> const FocusResponder = { <ide> state: FocusState, <ide> ): boolean { <ide> const {type, phase, target} = event; <add> const shouldStopPropagation = <add> props.stopPropagation === undefined ? true : props.stopPropagation; <ide> <ide> // Focus doesn't handle capture target events at this point <ide> if (phase === CAPTURE_PHASE) { <ide> const FocusResponder = { <ide> switch (type) { <ide> case 'focus': { <ide> if (!state.isFocused) { <del> state.focusTarget = target; <del> dispatchFocusInEvents(event, context, props, state); <add> // Limit focus events to the direct child of the event component. <add> // Browser focus is not expected to bubble. <add> let currentTarget = (target: any); <add> if ( <add> currentTarget.parentNode && <add> context.isTargetWithinEventComponent(currentTarget.parentNode) <add> ) { <add> break; <add> } <add> state.focusTarget = currentTarget; <add> dispatchFocusInEvents(context, props, state); <ide> state.isFocused = true; <ide> } <ide> break; <ide> } <ide> case 'blur': { <ide> if (state.isFocused) { <del> dispatchFocusOutEvents(event, context, props, state); <add> dispatchFocusOutEvents(context, props, state); <ide> state.isFocused = false; <ide> state.focusTarget = null; <ide> } <ide> break; <ide> } <ide> } <del> return false; <add> return shouldStopPropagation; <ide> }, <ide> onUnmount( <ide> context: ReactResponderContext, <ide><path>packages/react-events/src/__tests__/Focus-test.internal.js <ide> describe('Focus event responder', () => { <ide> }); <ide> }); <ide> <add> describe('nested Focus components', () => { <add> it('does not propagate events by default', () => { <add> const events = []; <add> const innerRef = React.createRef(); <add> const outerRef = React.createRef(); <add> const createEventHandler = msg => () => { <add> events.push(msg); <add> }; <add> <add> const element = ( <add> <Focus <add> onBlur={createEventHandler('outer: onBlur')} <add> onFocus={createEventHandler('outer: onFocus')} <add> onFocusChange={createEventHandler('outer: onFocusChange')}> <add> <div ref={outerRef}> <add> <Focus <add> onBlur={createEventHandler('inner: onBlur')} <add> onFocus={createEventHandler('inner: onFocus')} <add> onFocusChange={createEventHandler('inner: onFocusChange')}> <add> <div ref={innerRef} /> <add> </Focus> <add> </div> <add> </Focus> <add> ); <add> <add> ReactDOM.render(element, container); <add> <add> outerRef.current.dispatchEvent(createFocusEvent('focus')); <add> outerRef.current.dispatchEvent(createFocusEvent('blur')); <add> innerRef.current.dispatchEvent(createFocusEvent('focus')); <add> innerRef.current.dispatchEvent(createFocusEvent('blur')); <add> expect(events).toEqual([ <add> 'outer: onFocus', <add> 'outer: onFocusChange', <add> 'outer: onBlur', <add> 'outer: onFocusChange', <add> 'inner: onFocus', <add> 'inner: onFocusChange', <add> 'inner: onBlur', <add> 'inner: onFocusChange', <add> ]); <add> }); <add> }); <add> <ide> it('expect displayName to show up for event component', () => { <ide> expect(Focus.displayName).toBe('Focus'); <ide> });
2
PHP
PHP
put array helper tests in correct function
5493147220256090fd510cb424fb870911c28638
<ide><path>tests/Support/SupportHelpersTest.php <ide> public function testArrayPluck() <ide> public function testArrayExcept() <ide> { <ide> $array = array('name' => 'taylor', 'age' => 26); <del> $this->assertEquals(array('name' => 'taylor'), array_only($array, array('name'))); <add> $this->assertEquals(array('age' => 26), array_except($array, array('name'))); <ide> } <ide> <ide> <ide> public function testArrayOnly() <ide> { <ide> $array = array('name' => 'taylor', 'age' => 26); <del> $this->assertEquals(array('age' => 26), array_except($array, array('name'))); <add> $this->assertEquals(array('name' => 'taylor'), array_only($array, array('name'))); <ide> } <ide> <ide> <ide> public function testValue() <ide> $this->assertEquals('foo', value(function() { return 'foo'; })); <ide> } <ide> <del>} <ide>\ No newline at end of file <add>}
1
PHP
PHP
improve http\redirectresponse test coverage
663a586c79048051dcd394ceda9965dce60d3d99
<ide><path>tests/Http/HttpResponseTest.php <ide> public function testGetOriginalContent() <ide> $response->setContent($arr); <ide> $this->assertTrue($arr === $response->getOriginalContent()); <ide> } <add> <add> <add> public function testHeaderOnRedirect() <add> { <add> $response = new RedirectResponse('foo.bar'); <add> $this->assertNull($response->headers->get('foo')); <add> $response->header('foo', 'bar'); <add> $this->assertEquals('bar', $response->headers->get('foo')); <add> $response->header('foo', 'baz', false); <add> $this->assertEquals('bar', $response->headers->get('foo')); <add> $response->header('foo', 'baz'); <add> $this->assertEquals('baz', $response->headers->get('foo')); <add> } <add> <add> <add> public function testWithOnRedirect() <add>{ <add> $response = new RedirectResponse('foo.bar'); <add> $response->setRequest(Request::create('/', 'GET', array('name' => 'Taylor', 'age' => 26))); <add> $response->setSession($session = m::mock('Illuminate\Session\Store')); <add> $session->shouldReceive('flash')->twice(); <add> $response->with(array('name', 'age')); <add> } <add> <add> <add> public function testWithCookieOnRedirect() <add> { <add> $response = new RedirectResponse('foo.bar'); <add> $this->assertEquals(0, count($response->headers->getCookies())); <add> $this->assertEquals($response, $response->withCookie(new \Symfony\Component\HttpFoundation\Cookie('foo', 'bar'))); <add> $cookies = $response->headers->getCookies(); <add> $this->assertEquals(1, count($cookies)); <add> $this->assertEquals('foo', $cookies[0]->getName()); <add> $this->assertEquals('bar', $cookies[0]->getValue()); <add> } <ide> <ide> <ide> public function testInputOnRedirect() <ide> public function testFlashingErrorsOnRedirect() <ide> $provider->shouldReceive('getMessageBag')->once()->andReturn(array('foo' => 'bar')); <ide> $response->withErrors($provider); <ide> } <add> <add> <add> public function testSettersGettersOnRequest() <add> { <add> $response = new RedirectResponse('foo.bar'); <add> $this->assertNull($response->getRequest()); <add> $this->assertNull($response->getSession()); <add> <add> $request = Request::create('/', 'GET'); <add> $session = m::mock('Illuminate\Session\Store'); <add> $response->setRequest($request); <add> $response->setSession($session); <add> $this->assertTrue($request === $response->getRequest()); <add> $this->assertTrue($session === $response->getSession()); <add> } <ide> <add> <ide> public function testRedirectWithErrorsArrayConvertsToMessageBag() <ide> { <ide> $response = new RedirectResponse('foo.bar'); <ide> public function testRedirectWithErrorsArrayConvertsToMessageBag() <ide> $provider = array('foo' => 'bar'); <ide> $response->withErrors($provider); <ide> } <add> <add> <add> public function testMagicCall() <add> { <add> $response = new RedirectResponse('foo.bar'); <add> $response->setRequest(Request::create('/', 'GET', array('name' => 'Taylor', 'age' => 26))); <add> $response->setSession($session = m::mock('Illuminate\Session\Store')); <add> $session->shouldReceive('flash')->once()->with('foo', 'bar'); <add> $response->withFoo('bar'); <add> } <add> <add> <add> public function testMagicCallException() <add> { <add> $this->setExpectedException('BadMethodCallException'); <add> $response = new RedirectResponse('foo.bar'); <add> $response->doesNotExist('bar'); <add> } <ide> <ide> } <ide>
1
Ruby
Ruby
pass lookup context to the layout handlers
1cf3878927c086828d7a3010012334859c98d643
<ide><path>actionview/lib/action_view/layouts.rb <ide> def _write_layout_method # :nodoc: <ide> end <ide> <ide> class_eval <<-RUBY, __FILE__, __LINE__ + 1 <del> def _layout(formats) <add> def _layout(lookup_context, formats) <ide> if _conditional_layout? <ide> #{layout_definition} <ide> else <ide> def _layout_for_option(name) <ide> case name <ide> when String then _normalize_layout(name) <ide> when Proc then name <del> when true then Proc.new { |formats| _default_layout(formats, true) } <del> when :default then Proc.new { |formats| _default_layout(formats, false) } <add> when true then Proc.new { |lookup_context, formats| _default_layout(lookup_context, formats, true) } <add> when :default then Proc.new { |lookup_context, formats| _default_layout(lookup_context, formats, false) } <ide> when false, nil then nil <ide> else <ide> raise ArgumentError, <ide> def _normalize_layout(value) <ide> # <ide> # ==== Returns <ide> # * <tt>template</tt> - The template object for the default layout (or +nil+) <del> def _default_layout(formats, require_layout = false) <add> def _default_layout(lookup_context, formats, require_layout = false) <ide> begin <del> value = _layout(formats) if action_has_layout? <add> value = _layout(lookup_context, formats) if action_has_layout? <ide> rescue NameError => e <ide> raise e, "Could not render layout: #{e.message}" <ide> end <ide><path>actionview/lib/action_view/renderer/template_renderer.rb <ide> def resolve_layout(layout, keys, formats) <ide> raise unless template_exists?(layout, nil, false, [], all_details) <ide> end <ide> when Proc <del> resolve_layout(layout.call(formats), keys, formats) <add> resolve_layout(layout.call(@lookup_context, formats), keys, formats) <ide> else <ide> layout <ide> end
2
Javascript
Javascript
add expect to globalcontext
37e002cd38dda8ff47f58a87ba35c7a206819fbb
<ide><path>test/ConfigTestCases.test.js <ide> describe("ConfigTestCases", () => { <ide> } <ide> <ide> const globalContext = { <del> console: console <add> console: console, <add> expect: expect <ide> }; <ide> <ide> function _require(currentDirectory, module) {
1
Text
Text
fix minor text issues in stream.md
54e29221c35839cdd58cac3c05c73e9e9d8f4170
<ide><path>doc/api/stream.md <ide> There are four fundamental stream types within Node.js: <ide> * [`Transform`][] - `Duplex` streams that can modify or transform the data as it <ide> is written and read (for example, [`zlib.createDeflate()`][]). <ide> <del>Additionally this module includes the utility functions [pipeline][] and <add>Additionally, this module includes the utility functions [pipeline][] and <ide> [finished][]. <ide> <ide> ### Object Mode <ide> is to limit the buffering of data to acceptable levels such that sources and <ide> destinations of differing speeds will not overwhelm the available memory. <ide> <ide> Because [`Duplex`][] and [`Transform`][] streams are both `Readable` and <del>`Writable`, each maintain *two* separate internal buffers used for reading and <add>`Writable`, each maintains *two* separate internal buffers used for reading and <ide> writing, allowing each side to operate independently of the other while <ide> maintaining an appropriate and efficient flow of data. For example, <ide> [`net.Socket`][] instances are [`Duplex`][] streams whose `Readable` side allows <ide> changes: <ide> not operating in object mode, `chunk` must be a string, `Buffer` or <ide> `Uint8Array`. For object mode streams, `chunk` may be any JavaScript value <ide> other than `null`. <del>* `encoding` {string} The encoding, if `chunk` is a string <add>* `encoding` {string} The encoding if `chunk` is a string <ide> * `callback` {Function} Optional callback for when the stream is finished <ide> * Returns: {this} <ide> <ide> not draining may lead to a remotely exploitable vulnerability. <ide> <ide> Writing data while the stream is not draining is particularly <ide> problematic for a [`Transform`][], because the `Transform` streams are paused <del>by default until they are piped or an `'data'` or `'readable'` event handler <add>by default until they are piped or a `'data'` or `'readable'` event handler <ide> is added. <ide> <ide> If the data to be written can be generated or fetched on demand, it is <ide> until a mechanism for either consuming or ignoring that data is provided. If <ide> the consuming mechanism is disabled or taken away, the `Readable` will *attempt* <ide> to stop generating the data. <ide> <del>For backwards compatibility reasons, removing [`'data'`][] event handlers will <add>For backward compatibility reasons, removing [`'data'`][] event handlers will <ide> **not** automatically pause the stream. Also, if there are piped destinations, <ide> then calling [`stream.pause()`][stream-pause] will not guarantee that the <ide> stream will *remain* paused once those destinations drain and ask for more data. <ide> Especially useful in error handling scenarios where a stream is destroyed <ide> prematurely (like an aborted HTTP request), and will not emit `'end'` <ide> or `'finish'`. <ide> <del>The `finished` API is promisify'able as well; <add>The `finished` API is promisify-able as well; <ide> <ide> ```js <ide> const finished = util.promisify(stream.finished); <ide> pipeline( <ide> ); <ide> ``` <ide> <del>The `pipeline` API is promisify'able as well: <add>The `pipeline` API is promisify-able as well: <ide> <ide> ```js <ide> const pipeline = util.promisify(stream.pipeline); <ide> changes: <ide> any JavaScript value. <ide> * `encoding` {string} Encoding of string chunks. Must be a valid <ide> `Buffer` encoding, such as `'utf8'` or `'ascii'`. <del>* Returns: {boolean} `true` if additional chunks of data may continued to be <add>* Returns: {boolean} `true` if additional chunks of data may continue to be <ide> pushed; `false` otherwise. <ide> <ide> When `chunk` is a `Buffer`, `Uint8Array` or `string`, the `chunk` of data will <ide> The `callback` function must be called only when the current chunk is completely <ide> consumed. The first argument passed to the `callback` must be an `Error` object <ide> if an error occurred while processing the input or `null` otherwise. If a second <ide> argument is passed to the `callback`, it will be forwarded on to the <del>`readable.push()` method. In other words the following are equivalent: <add>`readable.push()` method. In other words, the following are equivalent: <ide> <ide> ```js <ide> transform.prototype._transform = function(data, encoding, callback) { <ide> less powerful and less useful. <ide> guaranteed. This meant that it was still necessary to be prepared to receive <ide> [`'data'`][] events *even when the stream was in a paused state*. <ide> <del>In Node.js 0.10, the [`Readable`][] class was added. For backwards <add>In Node.js 0.10, the [`Readable`][] class was added. For backward <ide> compatibility with older Node.js programs, `Readable` streams switch into <ide> "flowing mode" when a [`'data'`][] event handler is added, or when the <ide> [`stream.resume()`][stream-resume] method is called. The effect is that, even
1
Text
Text
fix syntax + link to community page
78528742f169fb9481865aa25726ceca5499e036
<ide><path>README.md <ide> At some point in the future, you'll be able to seamlessly move from pre-training <ide> 12. **[T5](https://github.com/google-research/text-to-text-transfer-transformer)** (from Google AI) released with the paper [Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformer](https://arxiv.org/abs/1910.10683) by Colin Raffel and Noam Shazeer and Adam Roberts and Katherine Lee and Sharan Narang and Michael Matena and Yanqi Zhou and Wei Li and Peter J. Liu. <ide> 13. **[XLM-RoBERTa](https://github.com/pytorch/fairseq/tree/master/examples/xlmr)** (from Facebook AI), released together with the paper [Unsupervised Cross-lingual Representation Learning at Scale](https://arxiv.org/abs/1911.02116) by Alexis Conneau*, Kartikay Khandelwal*, Naman Goyal, Vishrav Chaudhary, Guillaume Wenzek, Francisco Guzmán, Edouard Grave, Myle Ott, Luke Zettlemoyer and Veselin Stoyanov. <ide> 14. **[MMBT](https://github.com/facebookresearch/mmbt/)** (from Facebook), released together with the paper a [Supervised Multimodal Bitransformers for Classifying Images and Text](https://arxiv.org/pdf/1909.02950.pdf) by Douwe Kiela, Suvrat Bhooshan, Hamed Firooz, Davide Testuggine. <del>15 **[Other community models](https://huggingface.co/models)** (untested) <add>15. **[Other community models](https://huggingface.co/models)**, contributed by the [community](https://huggingface.co/users). <ide> 16. Want to contribute a new model? We have added a **detailed guide and templates** to guide you in the process of adding a new model. You can find them in the [`templates`](./templates) folder of the repository. Be sure to check the [contributing guidelines](./CONTRIBUTING.md) and contact the maintainers or open an issue to collect feedbacks before starting your PR. <ide> <ide> These implementations have been tested on several datasets (see the example scripts) and should match the performances of the original implementations (e.g. ~93 F1 on SQuAD for BERT Whole-Word-Masking, ~88 F1 on RocStories for OpenAI GPT, ~18.3 perplexity on WikiText 103 for Transformer-XL, ~0.916 Peason R coefficient on STS-B for XLNet). You can find more details on the performances in the Examples section of the [documentation](https://huggingface.co/transformers/examples.html).
1
Python
Python
fix gpu training for textcat. closes
f77bf2bdb1b62b97e9582fcc14d4550448a6340d
<ide><path>spacy/_ml.py <ide> def build_bow_text_classifier(nr_class, ngram_size=1, exclusive_classes=False, <ide> no_output_layer=False, **cfg): <ide> with Model.define_operators({">>": chain}): <ide> model = ( <del> extract_ngrams(ngram_size, attr=ORTH) <del> >> with_cpu(Model.ops, <del> LinearModel(nr_class) <add> with_cpu(Model.ops, <add> extract_ngrams(ngram_size, attr=ORTH) <add> >> LinearModel(nr_class) <ide> ) <ide> ) <ide> if not no_output_layer:
1
Python
Python
fix customdata on azure arm
c23bbba04310fac656a74f79fbf3be09eb7a86b8
<ide><path>libcloud/compute/drivers/azure_arm.py <ide> def create_node(self, <ide> <ide> if ex_customdata: <ide> data["properties"]["osProfile"]["customData"] = \ <del> base64.b64encode(ex_customdata) <add> base64.b64encode(ex_customdata.encode()).decode() <ide> <ide> data["properties"]["osProfile"]["adminUsername"] = ex_user_name <ide>
1
PHP
PHP
use $this instead of parent
50357d8bab3c43ac6b76a82038847c1061bf21c6
<ide><path>app/Providers/AuthServiceProvider.php <ide> class AuthServiceProvider extends ServiceProvider <ide> */ <ide> public function boot(GateContract $gate) <ide> { <del> parent::registerPolicies($gate); <add> $this->registerPolicies($gate); <ide> <ide> // <ide> }
1
Go
Go
remove deadlock in containerwait
4d2d2ea39336aade783c5c415b83d129bdd339bb
<ide><path>client/container_wait.go <ide> func (cli *Client) ContainerWait(ctx context.Context, containerID string, condit <ide> } <ide> <ide> resultC := make(chan container.ContainerWaitOKBody) <del> errC := make(chan error) <add> errC := make(chan error, 1) <ide> <ide> query := url.Values{} <ide> query.Set("condition", string(condition))
1
Text
Text
add program in c to show variable
8e843dc35207c598953d801713d96e3c3f3878a1
<ide><path>guide/english/c/variables/index.md <ide> We get `15.300000`. So, say we just want two places after the decimal to give us <ide> * Variables are created in the following format: `datatype variable_name = number`. <ide> * Format specifiers allow for variables to be printed. <ide> * The equals sign `=` allows for values to be assigned to variables. <add> <add> <add> <add>## Program to show variables <add> <add>```C <add>#include<stdio.h> <add> <add>int main() { <add> int i; <add> float f; <add> printf ("enter integer value\n"); <add> scanf ("%d", &i); <add> printf ("enter float value\n"); <add> scanf ("%f", &f); <add> printf ("integer value: %d \nfloat value: %f\n", i, f); <add> return 0; <add>} <add>``` <add> <add>#OUTPUT <add>```sh <add>enter integer value <add>1 <add>enter float value <add>2.2 <add>integer value: 1 <add>float value: 2.200000 <add>```
1
PHP
PHP
add outline of tests for encryptedcookiemiddleware
87271cf2472dc37b6c5f5bee66c44d68e2ed9405
<ide><path>src/Http/Middleware/EncryptedCookieMiddleware.php <ide> protected function encodeCookies(Response $response) <ide> $cookies = $response->getCookieCollection(); <ide> foreach ($cookies as $cookie) { <ide> if (in_array($cookie->getName(), $this->cookieNames, true)) { <del> $value = $this->_encrypt($cookie->getValue(), $this->cipherType, $this->key); <add> $value = $this->_encrypt($cookie->getValue(), $this->cipherType); <ide> $response = $response->withCookie($cookie->withValue($value)); <ide> } <ide> } <ide> protected function encodeSetCookieHeader(ResponseInterface $response) <ide> $header = []; <ide> foreach ($cookies as $cookie) { <ide> if (in_array($cookie->getName(), $this->cookieNames, true)) { <del> $value = $this->_encrypt($cookie->getValue(), $this->cipherType, $this->key); <add> $value = $this->_encrypt($cookie->getValue(), $this->cipherType); <ide> $cookie = $cookie->withValue($value); <ide> } <ide> $header[] = $cookie->toHeaderValue(); <ide> } <ide> <del> return $request->withHeader('Set-Cookie', $header); <add> return $response->withHeader('Set-Cookie', $header); <ide> } <ide> } <ide><path>tests/TestCase/Http/Middleware/EncryptedCookieMiddlewareTest.php <add><?php <add>/** <add> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * <add> * Licensed under The MIT License <add> * For full copyright and license information, please see the LICENSE.txt <add> * Redistributions of files must retain the above copyright notice. <add> * <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @link http://cakephp.org CakePHP(tm) Project <add> * @since 3.3.0 <add> * @license http://www.opensource.org/licenses/mit-license.php MIT License <add> */ <add>namespace Cake\Test\TestCase\Http\Middleware; <add> <add>use Cake\Http\Cookie\CookieCollection; <add>use Cake\Http\Middleware\EncryptedCookieMiddleware; <add>use Cake\Http\ServerRequest; <add>use Cake\Http\Response; <add>use Cake\TestSuite\TestCase; <add>use Cake\Utility\CookieCryptTrait; <add> <add>/** <add> * Test for EncryptedCookieMiddleware <add> */ <add>class EncryptedCookieMiddlewareTest extends TestCase <add>{ <add> use CookieCryptTrait; <add> <add> protected $middleware; <add> <add> protected function _getCookieEncryptionKey() <add> { <add> return 'super secret key that no one can guess'; <add> } <add> <add> /** <add> * Setup <add> */ <add> public function setUp() <add> { <add> $this->middleware = new EncryptedCookieMiddleware( <add> ['secret', 'ninja'], <add> $this->_getCookieEncryptionKey(), <add> 'aes' <add> ); <add> } <add> <add> /** <add> * Test decoding request cookies <add> * <add> * @return void <add> */ <add> public function testDecodeRequestCookies() <add> { <add> $request = new ServerRequest(['url' => '/cookies/nom']); <add> $request = $request->withCookieParams([ <add> 'plain' => 'always plain', <add> 'secret' => $this->_encrypt('decoded', 'aes') <add> ]); <add> $this->assertNotEquals('decoded', $request->getCookie('decoded')); <add> <add> $response = new Response(); <add> $next = function ($req, $res) { <add> $this->assertSame('decoded', $req->getCookie('secret')); <add> $this->assertSame('always plain', $req->getCookie('plain')); <add> <add> return $res->withHeader('called', 'yes'); <add> }; <add> $middleware = $this->middleware; <add> $response = $middleware($request, $response, $next); <add> $this->assertSame('yes', $response->getHeaderLine('called'), 'Inner middleware not invoked'); <add> } <add> <add> /** <add> * Test encoding cookies in the set-cookie header. <add> * <add> * @return void <add> */ <add> public function testEncodeResponseSetCookieHeader() <add> { <add> $request = new ServerRequest(['url' => '/cookies/nom']); <add> $response = new Response(); <add> $next = function ($req, $res) { <add> return $res->withAddedHeader('Set-Cookie', 'secret=be%20quiet') <add> ->withAddedHeader('Set-Cookie', 'plain=in%20clear') <add> ->withAddedHeader('Set-Cookie', 'ninja=shuriken'); <add> }; <add> $middleware = $this->middleware; <add> $response = $middleware($request, $response, $next); <add> $this->assertNotContains('ninja=shuriken', $response->getHeaderLine('Set-Cookie')); <add> $this->assertContains('plain=in%20clear', $response->getHeaderLine('Set-Cookie')); <add> <add> $cookies = CookieCollection::createFromHeader($response->getHeader('Set-Cookie')); <add> $this->assertTrue($cookies->has('ninja')); <add> $this->assertEquals( <add> 'shuriken', <add> $this->_decrypt($cookies->get('ninja')->getValue(), 'aes') <add> ); <add> } <add> <add> /** <add> * Test encoding cookies in the cookie collection. <add> * <add> * @return void <add> */ <add> public function testEncodeResponseCookieData() <add> { <add> $request = new ServerRequest(['url' => '/cookies/nom']); <add> $response = new Response(); <add> $next = function ($req, $res) { <add> return $res->withCookie('secret', 'be quiet') <add> ->withCookie('plain', 'in clear') <add> ->withCookie('ninja', 'shuriken'); <add> }; <add> $middleware = $this->middleware; <add> $response = $middleware($request, $response, $next); <add> $this->assertNotSame('shuriken', $response->getCookie('ninja')); <add> $this->assertEquals( <add> 'shuriken', <add> $this->_decrypt($response->getCookie('ninja')['value'], 'aes') <add> ); <add> } <add>}
2
PHP
PHP
close directory handle to prevent locking issues
f05e227cd8a93c907a26296a8a46a91c0817c676
<ide><path>src/Cache/Engine/FileEngine.php <ide> protected function _clearDirectory($path, $now, $threshold) <ide> //@codingStandardsIgnoreEnd <ide> } <ide> } <add> <add> $dir->close(); <ide> } <ide> <ide> /**
1
Javascript
Javascript
fix lint errors
3d40f55747fd905a61393d2630377e7eead4fd69
<ide><path>src/main-process/main.js <ide> if (typeof snapshotResult !== 'undefined') { <del> snapshotResult.setGlobals(global, process, global, {}, require) <add> snapshotResult.setGlobals(global, process, global, {}, require) // eslint-disable-line no-undef <ide> } <ide> <ide> const startTime = Date.now() <ide><path>src/native-compile-cache.js <ide> class NativeCompileCache { <ide> <ide> overrideModuleCompile () { <ide> let self = this <del> let resolvedArgv = null <ide> // Here we override Node's module.js <ide> // (https://github.com/atom/node/blob/atom/lib/module.js#L378), changing <ide> // only the bits that affect compilation in order to use the cached one. <ide><path>static/index.js <ide> Module.prototype.require = function (module) { <ide> const absoluteFilePath = Module._resolveFilename(module, this, false) <ide> const relativeFilePath = path.relative(entryPointDirPath, absoluteFilePath) <del> let cachedModule = snapshotResult.customRequire.cache[relativeFilePath] <add> let cachedModule = snapshotResult.customRequire.cache[relativeFilePath] // eslint-disable-line no-undef <ide> if (!cachedModule) { <ide> cachedModule = {exports: Module._load(module, this, false)} <del> snapshotResult.customRequire.cache[relativeFilePath] = cachedModule <add> snapshotResult.customRequire.cache[relativeFilePath] = cachedModule // eslint-disable-line no-undef <ide> } <ide> return cachedModule.exports <ide> } <ide> <del> snapshotResult.setGlobals(global, process, window, document, require) <add> snapshotResult.setGlobals(global, process, window, document, require) // eslint-disable-line no-undef <ide> } <ide> <del> const FileSystemBlobStore = useSnapshot ? snapshotResult.customRequire('../src/file-system-blob-store.js') : require('../src/file-system-blob-store') <add> const FileSystemBlobStore = useSnapshot ? snapshotResult.customRequire('../src/file-system-blob-store.js') : require('../src/file-system-blob-store') // eslint-disable-line no-undef <ide> blobStore = FileSystemBlobStore.load(path.join(process.env.ATOM_HOME, 'blob-store')) <ide> <del> const NativeCompileCache = useSnapshot ? snapshotResult.customRequire('../src/native-compile-cache.js') : require('../src/native-compile-cache') <add> const NativeCompileCache = useSnapshot ? snapshotResult.customRequire('../src/native-compile-cache.js') : require('../src/native-compile-cache') // eslint-disable-line no-undef <ide> NativeCompileCache.setCacheStore(blobStore) <ide> NativeCompileCache.setV8Version(process.versions.v8) <ide> NativeCompileCache.install() <ide> } <ide> <ide> function setupWindow () { <del> const CompileCache = useSnapshot ? snapshotResult.customRequire('../src/compile-cache.js') : require('../src/compile-cache') <add> const CompileCache = useSnapshot ? snapshotResult.customRequire('../src/compile-cache.js') : require('../src/compile-cache') // eslint-disable-line no-undef <ide> CompileCache.setAtomHomeDirectory(process.env.ATOM_HOME) <ide> CompileCache.install(require) <ide> <del> const ModuleCache = useSnapshot ? snapshotResult.customRequire('../src/module-cache.js') : require('../src/module-cache') <add> const ModuleCache = useSnapshot ? snapshotResult.customRequire('../src/module-cache.js') : require('../src/module-cache') // eslint-disable-line no-undef <ide> ModuleCache.register(getWindowLoadSettings()) <ide> <del> const startCrashReporter = useSnapshot ? snapshotResult.customRequire('../src/crash-reporter-start.js') : require('../src/crash-reporter-start') <add> const startCrashReporter = useSnapshot ? snapshotResult.customRequire('../src/crash-reporter-start.js') : require('../src/crash-reporter-start') // eslint-disable-line no-undef <ide> startCrashReporter({_version: getWindowLoadSettings().appVersion}) <ide> <del> const CSON = useSnapshot ? snapshotResult.customRequire('../node_modules/season/lib/cson.js') : require('season') <add> const CSON = useSnapshot ? snapshotResult.customRequire('../node_modules/season/lib/cson.js') : require('season') // eslint-disable-line no-undef <ide> CSON.setCacheDir(path.join(CompileCache.getCacheDirectory(), 'cson')) <ide> <ide> const initScriptPath = path.relative(entryPointDirPath, getWindowLoadSettings().windowInitializationScript) <del> const initialize = useSnapshot ? snapshotResult.customRequire(initScriptPath) : require(initScriptPath) <add> const initialize = useSnapshot ? snapshotResult.customRequire(initScriptPath) : require(initScriptPath) // eslint-disable-line no-undef <ide> return initialize({blobStore: blobStore}).then(function () { <ide> electron.ipcRenderer.send('window-command', 'window:loaded') <ide> })
3
Javascript
Javascript
upgrade importparserplugin to es6
ee24fb8ddd8282f98c6eaa19cdb46e4ba334dade
<ide><path>lib/dependencies/ImportParserPlugin.js <ide> MIT License http://www.opensource.org/licenses/mit-license.php <ide> Author Tobias Koppers @sokra <ide> */ <del>var ImportContextDependency = require("./ImportContextDependency"); <del>var ImportDependenciesBlock = require("./ImportDependenciesBlock"); <del>var ContextDependencyHelpers = require("./ContextDependencyHelpers"); <add>"use strict"; <ide> <del>function ImportParserPlugin(options) { <del> this.options = options; <del>} <add>const ImportContextDependency = require("./ImportContextDependency"); <add>const ImportDependenciesBlock = require("./ImportDependenciesBlock"); <add>const ContextDependencyHelpers = require("./ContextDependencyHelpers"); <ide> <del>module.exports = ImportParserPlugin; <add>class ImportParserPlugin { <add> constructor(options) { <add> this.options = options; <add> } <ide> <del>ImportParserPlugin.prototype.apply = function(parser) { <del> var options = this.options; <del> parser.plugin(["call System.import", "import-call"], function(expr) { <del> if(expr.arguments.length !== 1) <del> throw new Error("Incorrect number of arguments provided to 'import(module: string) -> Promise'."); <del> var dep; <del> var param = this.evaluateExpression(expr.arguments[0]); <del> if(param.isString()) { <del> var depBlock = new ImportDependenciesBlock(param.string, expr.range, this.state.module, expr.loc); <del> this.state.current.addBlock(depBlock); <del> return true; <del> } else { <del> dep = ContextDependencyHelpers.create(ImportContextDependency, expr.range, param, expr, options); <del> if(!dep) return; <del> dep.loc = expr.loc; <del> dep.optional = !!this.scope.inTry; <del> this.state.current.addDependency(dep); <del> return true; <del> } <del> }); <del>}; <add> apply(parser) { <add> const options = this.options; <add> parser.plugin(["call System.import", "import-call"], (expr) => { <add> if(expr.arguments.length !== 1) <add> throw new Error("Incorrect number of arguments provided to 'import(module: string) -> Promise'."); <add> let dep; <add> const param = parser.evaluateExpression(expr.arguments[0]); <add> if(param.isString()) { <add> const depBlock = new ImportDependenciesBlock(param.string, expr.range, parser.state.module, expr.loc); <add> parser.state.current.addBlock(depBlock); <add> return true; <add> } else { <add> dep = ContextDependencyHelpers.create(ImportContextDependency, expr.range, param, expr, options); <add> if(!dep) return; <add> dep.loc = expr.loc; <add> dep.optional = !!parser.scope.inTry; <add> parser.state.current.addDependency(dep); <add> return true; <add> } <add> }); <add> } <add>} <add>module.exports = ImportParserPlugin;
1
Javascript
Javascript
add protractor test to example
d18172625af3f8e02673b9e8bf6349052685681d
<ide><path>src/ng/directive/input.js <ide> var minlengthDirective = function() { <ide> * <textarea ng-model="list" ng-list="&#10;" ng-trim="false"></textarea> <ide> * <pre>{{ list | json }}</pre> <ide> * </file> <add> * <file name="protractor.js" type="protractor"> <add> * it("should split the text by newlines", function() { <add> * var listInput = element(by.model('list')); <add> * var output = element(by.binding('{{ list | json }}')); <add> * listInput.sendKeys('abc\ndef\nghi'); <add> * expect(output.getText()).toContain('[\n "abc",\n "def",\n "ghi"\n]'); <add> * }); <add> * </file> <ide> * </example> <ide> * <ide> * @element input
1
PHP
PHP
fix code style and annotations
cc187617026203eb59dbf4a9cbb86830f820f58a
<ide><path>src/Database/Connection.php <ide> use Cake\Database\Log\QueryLogger; <ide> use Cake\Database\Retry\ReconnectStrategy; <ide> use Cake\Database\Schema\CachedCollection; <del>use Cake\Database\Schema\Collection as SchemaCollection; <ide> use Cake\Database\Schema\CollectionInterface as SchemaCollectionInterface; <add>use Cake\Database\Schema\Collection as SchemaCollection; <ide> use Cake\Datasource\ConnectionInterface; <ide> use Cake\Log\Log; <ide> use Exception; <ide><path>src/Database/Schema/CollectionInterface.php <ide> interface CollectionInterface <ide> /** <ide> * Get the list of tables available in the current connection. <ide> * <del> * @return array The list of tables in the connected database/schema. <add> * @return string[] The list of tables in the connected database/schema. <ide> */ <ide> public function listTables(): array; <ide>
2
Text
Text
fix typo in http.md
e995a33c7661f0774f5f26234586d268b9d142af
<ide><path>doc/api/http.md <ide> There are a few special headers that should be noted. <ide> * Sending a 'Connection: keep-alive' will notify Node.js that the connection to <ide> the server should be persisted until the next request. <ide> <del>* Sending a 'Content-length' header will disable the default chunked encoding. <add>* Sending a 'Content-Length' header will disable the default chunked encoding. <ide> <ide> * Sending an 'Expect' header will immediately send the request headers. <ide> Usually, when sending 'Expect: 100-continue', you should both set a timeout
1
Text
Text
update tutorial to django 2.0 routing syntax
fc2143207b985e16cf408d214e1cc1cf2f4eff28
<ide><path>docs/tutorial/1-serialization.md <ide> We'll also need a view which corresponds to an individual snippet, and can be us <ide> <ide> Finally we need to wire these views up. Create the `snippets/urls.py` file: <ide> <del> from django.conf.urls import url <add> from django.urls import path <ide> from snippets import views <ide> <ide> urlpatterns = [ <del> url(r'^snippets/$', views.snippet_list), <del> url(r'^snippets/(?P<pk>[0-9]+)/$', views.snippet_detail), <add> path('snippets/', views.snippet_list), <add> path('snippets/<int:pk>/', views.snippet_detail), <ide> ] <ide> <ide> We also need to wire up the root urlconf, in the `tutorial/urls.py` file, to include our snippet app's URLs. <ide> <del> from django.conf.urls import url, include <add> from django.urls import path, include <ide> <ide> urlpatterns = [ <del> url(r'^', include('snippets.urls')), <add> path('', include('snippets.urls')), <ide> ] <ide> <ide> It's worth noting that there are a couple of edge cases we're not dealing with properly at the moment. If we send malformed `json`, or if a request is made with a method that the view doesn't handle, then we'll end up with a 500 "server error" response. Still, this'll do for now. <ide><path>docs/tutorial/2-requests-and-responses.md <ide> and <ide> <ide> Now update the `snippets/urls.py` file slightly, to append a set of `format_suffix_patterns` in addition to the existing URLs. <ide> <del> from django.conf.urls import url <add> from django.urls import path <ide> from rest_framework.urlpatterns import format_suffix_patterns <ide> from snippets import views <ide> <ide> urlpatterns = [ <del> url(r'^snippets/$', views.snippet_list), <del> url(r'^snippets/(?P<pk>[0-9]+)$', views.snippet_detail), <add> path('snippets/', views.snippet_list), <add> path('snippets/<int:pk>', views.snippet_detail), <ide> ] <ide> <ide> urlpatterns = format_suffix_patterns(urlpatterns) <ide><path>docs/tutorial/3-class-based-views.md <ide> That's looking good. Again, it's still pretty similar to the function based vie <ide> <ide> We'll also need to refactor our `snippets/urls.py` slightly now that we're using class-based views. <ide> <del> from django.conf.urls import url <add> from django.urls import path <ide> from rest_framework.urlpatterns import format_suffix_patterns <ide> from snippets import views <ide> <ide> urlpatterns = [ <del> url(r'^snippets/$', views.SnippetList.as_view()), <del> url(r'^snippets/(?P<pk>[0-9]+)/$', views.SnippetDetail.as_view()), <add> path('snippets/', views.SnippetList.as_view()), <add> path('snippets/<int:pk>/', views.SnippetDetail.as_view()), <ide> ] <ide> <ide> urlpatterns = format_suffix_patterns(urlpatterns) <ide><path>docs/tutorial/4-authentication-and-permissions.md <ide> Make sure to also import the `UserSerializer` class <ide> <ide> from snippets.serializers import UserSerializer <ide> <del>Finally we need to add those views into the API, by referencing them from the URL conf. Add the following to the patterns in `urls.py`. <add>Finally we need to add those views into the API, by referencing them from the URL conf. Add the following to the patterns in `snippets/urls.py`. <ide> <del> url(r'^users/$', views.UserList.as_view()), <del> url(r'^users/(?P<pk>[0-9]+)/$', views.UserDetail.as_view()), <add> path('users/', views.UserList.as_view()), <add> path('users/<int:pk>/', views.UserDetail.as_view()), <ide> <ide> ## Associating Snippets with Users <ide> <ide> Add the following import at the top of the file: <ide> And, at the end of the file, add a pattern to include the login and logout views for the browsable API. <ide> <ide> urlpatterns += [ <del> url(r'^api-auth/', include('rest_framework.urls')), <add> path('api-auth/', include('rest_framework.urls')), <ide> ] <ide> <del>The `r'^api-auth/'` part of pattern can actually be whatever URL you want to use. <add>The `'api-auth/'` part of pattern can actually be whatever URL you want to use. <ide> <ide> Now if you open up the browser again and refresh the page you'll see a 'Login' link in the top right of the page. If you log in as one of the users you created earlier, you'll be able to create code snippets again. <ide> <ide><path>docs/tutorial/5-relationships-and-hyperlinked-apis.md <ide> Instead of using a concrete generic view, we'll use the base class for represent <ide> As usual we need to add the new views that we've created in to our URLconf. <ide> We'll add a url pattern for our new API root in `snippets/urls.py`: <ide> <del> url(r'^$', views.api_root), <add> path('', views.api_root), <ide> <ide> And then add a url pattern for the snippet highlights: <ide> <del> url(r'^snippets/(?P<pk>[0-9]+)/highlight/$', views.SnippetHighlight.as_view()), <add> path('snippets/<int:pk>/highlight/', views.SnippetHighlight.as_view()), <ide> <ide> ## Hyperlinking our API <ide> <ide> After adding all those names into our URLconf, our final `snippets/urls.py` file <ide> <ide> # API endpoints <ide> urlpatterns = format_suffix_patterns([ <del> url(r'^$', views.api_root), <del> url(r'^snippets/$', <add> path('', views.api_root), <add> path('snippets/', <ide> views.SnippetList.as_view(), <ide> name='snippet-list'), <del> url(r'^snippets/(?P<pk>[0-9]+)/$', <add> path('snippets/<int:pk>/', <ide> views.SnippetDetail.as_view(), <ide> name='snippet-detail'), <del> url(r'^snippets/(?P<pk>[0-9]+)/highlight/$', <add> path('snippets/<int:pk>/highlight/', <ide> views.SnippetHighlight.as_view(), <ide> name='snippet-highlight'), <del> url(r'^users/$', <add> path('users/', <ide> views.UserList.as_view(), <ide> name='user-list'), <del> url(r'^users/(?P<pk>[0-9]+)/$', <add> path('users/<int:pk>/', <ide> views.UserDetail.as_view(), <ide> name='user-detail') <ide> ]) <ide><path>docs/tutorial/6-viewsets-and-routers.md <ide> Notice how we're creating multiple views from each `ViewSet` class, by binding t <ide> Now that we've bound our resources into concrete views, we can register the views with the URL conf as usual. <ide> <ide> urlpatterns = format_suffix_patterns([ <del> url(r'^$', api_root), <del> url(r'^snippets/$', snippet_list, name='snippet-list'), <del> url(r'^snippets/(?P<pk>[0-9]+)/$', snippet_detail, name='snippet-detail'), <del> url(r'^snippets/(?P<pk>[0-9]+)/highlight/$', snippet_highlight, name='snippet-highlight'), <del> url(r'^users/$', user_list, name='user-list'), <del> url(r'^users/(?P<pk>[0-9]+)/$', user_detail, name='user-detail') <add> path('', api_root), <add> path('snippets/', snippet_list, name='snippet-list'), <add> path('snippets/<int:pk>/', snippet_detail, name='snippet-detail'), <add> path('snippets/<int:pk>/highlight/', snippet_highlight, name='snippet-highlight'), <add> path('users/', user_list, name='user-list'), <add> path('users/<int:pk>/', user_detail, name='user-detail') <ide> ]) <ide> <ide> ## Using Routers <ide><path>docs/tutorial/7-schemas-and-client-libraries.md <ide> from rest_framework.schemas import get_schema_view <ide> schema_view = get_schema_view(title='Pastebin API') <ide> <ide> urlpatterns = [ <del>    url(r'^schema/$', schema_view), <add>    path('schema/', schema_view), <ide> ... <ide> ] <ide> ```
7
Go
Go
fix dead lock in volume store dereference
f5310652d30e72fe88a3edc70b2911397c28b7e4
<ide><path>volume/store/store.go <ide> func (s *VolumeStore) Dereference(v volume.Volume, ref string) { <ide> defer s.locks.Unlock(v.Name()) <ide> <ide> s.globalLock.Lock() <add> defer s.globalLock.Unlock() <ide> refs, exists := s.refs[v.Name()] <ide> if !exists { <ide> return <ide> func (s *VolumeStore) Dereference(v volume.Volume, ref string) { <ide> s.refs[v.Name()] = append(s.refs[v.Name()][:i], s.refs[v.Name()][i+1:]...) <ide> } <ide> } <del> s.globalLock.Unlock() <ide> } <ide> <ide> // Refs gets the current list of refs for the given volume
1
Python
Python
improve fabfile, removing fabtools dependency
74d5d398f881a9a8c91aa9e96ab913b36832d9dc
<ide><path>fabfile.py <ide> # coding: utf-8 <ide> from __future__ import unicode_literals, print_function <ide> <add>import contextlib <add>from pathlib import Path <ide> from fabric.api import local, lcd, env, settings, prefix <del>from fabtools.python import virtualenv <ide> from os import path, environ <ide> <ide> <ide> PWD = path.dirname(__file__) <ide> ENV = environ['VENV_DIR'] if 'VENV_DIR' in environ else '.env' <del>VENV_DIR = path.join(PWD, ENV) <add>VENV_DIR = Path(PWD) / ENV <add> <add> <add>@contextlib.contextmanager <add>def virtualenv(name, create=False, python='/usr/bin/python3.6'): <add> python = Path(python).resolve() <add> env_path = VENV_DIR <add> if create: <add> if env_path.exists(): <add> shutil.rmtree(str(env_path)) <add> local('{python} -m venv {env_path}'.format(python=python, <add> env_path=VENV_DIR)) <add> def wrapped_local(cmd, env_vars=[]): <add> env_py = env_path / 'bin' / 'python' <add> env_vars = ' '.join(env_vars) <add> if cmd.split()[0] == 'python': <add> cmd = cmd.replace('python', str(env_py)) <add> return local(env_vars + ' ' + cmd) <add> else: <add> return local('{env_vars} {env_py} -m {cmd}'.format( <add> env_py=env_py, cmd=cmd, env_vars=env_vars)) <add> yield wrapped_local <ide> <ide> <ide> def env(lang='python2.7'): <ide> def env(lang='python2.7'): <ide> <ide> <ide> def install(): <del> with virtualenv(VENV_DIR): <del> local('pip install --upgrade setuptools') <del> local('pip install dist/*.tar.gz') <del> local('pip install pytest') <add> with virtualenv(VENV_DIR) as venv_local: <add> venv_local('pip install --upgrade setuptools') <add> venv_local('pip install dist/*.tar.gz') <add> venv_local('pip install pytest') <ide> <ide> <ide> def make(): <del> with virtualenv(VENV_DIR): <del> with lcd(path.dirname(__file__)): <del> local('pip install cython') <del> local('pip install murmurhash') <del> local('pip install -r requirements.txt') <del> local('python setup.py build_ext --inplace') <add> with lcd(path.dirname(__file__)): <add> with virtualenv(VENV_DIR) as venv_local: <add> venv_local('pip install cython') <add> venv_local('pip install murmurhash') <add> venv_local('pip install -r requirements.txt') <add> venv_local('python setup.py build_ext --inplace') <ide> <ide> def sdist(): <del> with virtualenv(VENV_DIR): <del> with lcd(path.dirname(__file__)): <add> with lcd(path.dirname(__file__)): <add> with virtualenv(VENV_DIR) as venv_local: <ide> local('python setup.py sdist') <ide> <del>def clean(): <add>def wheel(): <ide> with lcd(path.dirname(__file__)): <del> local('python setup.py clean --all') <add> with virtualenv(VENV_DIR) as venv_local: <add> venv_local('pip install wheel') <add> venv_local('python setup.py bdist_wheel') <ide> <ide> <del>def test(): <del> with virtualenv(VENV_DIR): <add>def clean(): <add> with virtualenv(VENV_DIR) as venv_local: <ide> with lcd(path.dirname(__file__)): <add> local('python setup.py clean --all') <add> <add> <add>def test(): <add> with lcd(path.dirname(__file__)): <add> with virtualenv(VENV_DIR) as venv_local: <ide> local('py.test -x spacy/tests')
1
Javascript
Javascript
simplify "each" stylesheet iteration test
fcb6c4d1d6552c7e54df16a36b171858bdf0553f
<ide><path>test/unit/core.js <ide> test("jQuery.each(Object,Function)", function() { <ide> jQuery.each( document.styleSheets, function() { <ide> i++; <ide> }); <del> equal( i, 2, "Iteration over document.styleSheets" ); <add> equal( i, document.styleSheets.length, "Iteration over document.styleSheets" ); <ide> }); <ide> <ide> test("jQuery.makeArray", function(){
1
Java
Java
avoid mimetype garbage creation
ba8849dda3b22e33588734ec2aea9e4457070e94
<ide><path>spring-core/src/main/java/org/springframework/util/MimeType.java <ide> public class MimeType implements Comparable<MimeType>, Serializable { <ide> <ide> private final Map<String, String> parameters; <ide> <add> private String mimetype; <add> <ide> <ide> /** <ide> * Create a new {@code MimeType} for the given primary type. <ide> public int hashCode() { <ide> <ide> @Override <ide> public String toString() { <del> StringBuilder builder = new StringBuilder(); <del> appendTo(builder); <del> return builder.toString(); <add> if (this.mimetype == null) { <add> StringBuilder builder = new StringBuilder(); <add> appendTo(builder); <add> this.mimetype = builder.toString(); <add> } <add> return this.mimetype; <ide> } <ide> <ide> protected void appendTo(StringBuilder builder) { <ide><path>spring-core/src/main/java/org/springframework/util/MimeTypeUtils.java <ide> /* <del> * Copyright 2002-2018 the original author or authors. <add> * Copyright 2002-2019 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 java.util.List; <ide> import java.util.Map; <ide> import java.util.Random; <add>import java.util.concurrent.ConcurrentHashMap; <add>import java.util.concurrent.ConcurrentLinkedQueue; <add>import java.util.concurrent.locks.ReadWriteLock; <add>import java.util.concurrent.locks.ReentrantReadWriteLock; <add>import java.util.function.Function; <ide> import java.util.stream.Collectors; <ide> <ide> import org.springframework.lang.Nullable; <ide> * @author Arjen Poutsma <ide> * @author Rossen Stoyanchev <ide> * @author Dimitrios Liapis <add> * @author Brian Clozel <ide> * @since 4.0 <ide> */ <ide> public abstract class MimeTypeUtils { <ide> public abstract class MimeTypeUtils { <ide> 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', <ide> 'V', 'W', 'X', 'Y', 'Z'}; <ide> <add> private static final ConcurrentLRUCache<String, MimeType> CACHED_MIMETYPES = <add> new ConcurrentLRUCache<>(32, MimeTypeUtils::parseMimeTypeInternal); <add> <ide> /** <ide> * Comparator used by {@link #sortBySpecificity(List)}. <ide> */ <ide> public abstract class MimeTypeUtils { <ide> @Nullable <ide> private static volatile Random random; <ide> <del> <ide> static { <del> ALL = MimeType.valueOf(ALL_VALUE); <del> APPLICATION_JSON = MimeType.valueOf(APPLICATION_JSON_VALUE); <del> APPLICATION_OCTET_STREAM = MimeType.valueOf(APPLICATION_OCTET_STREAM_VALUE); <del> APPLICATION_XML = MimeType.valueOf(APPLICATION_XML_VALUE); <del> IMAGE_GIF = MimeType.valueOf(IMAGE_GIF_VALUE); <del> IMAGE_JPEG = MimeType.valueOf(IMAGE_JPEG_VALUE); <del> IMAGE_PNG = MimeType.valueOf(IMAGE_PNG_VALUE); <del> TEXT_HTML = MimeType.valueOf(TEXT_HTML_VALUE); <del> TEXT_PLAIN = MimeType.valueOf(TEXT_PLAIN_VALUE); <del> TEXT_XML = MimeType.valueOf(TEXT_XML_VALUE); <add> ALL = new MimeType("*", "*"); <add> APPLICATION_JSON = new MimeType("application", "json"); <add> APPLICATION_OCTET_STREAM = new MimeType("application", "octet-stream"); <add> APPLICATION_XML = new MimeType("application", "xml"); <add> IMAGE_GIF = new MimeType("image", "gif"); <add> IMAGE_JPEG = new MimeType("image", "jpeg"); <add> IMAGE_PNG = new MimeType("image", "png"); <add> TEXT_HTML = new MimeType("text", "html"); <add> TEXT_PLAIN = new MimeType("text", "plain"); <add> TEXT_XML = new MimeType("text", "xml"); <ide> } <ide> <del> <ide> /** <ide> * Parse the given String into a single {@code MimeType}. <add> * Recently parsed {@code MimeType} are cached for further retrieval. <ide> * @param mimeType the string to parse <ide> * @return the mime type <ide> * @throws InvalidMimeTypeException if the string cannot be parsed <ide> */ <ide> public static MimeType parseMimeType(String mimeType) { <add> return CACHED_MIMETYPES.get(mimeType); <add> } <add> <add> private static MimeType parseMimeTypeInternal(String mimeType) { <ide> if (!StringUtils.hasLength(mimeType)) { <ide> throw new InvalidMimeTypeException(mimeType, "'mimeType' must not be empty"); <ide> } <ide> public static String generateMultipartBoundaryString() { <ide> return new String(generateMultipartBoundary(), StandardCharsets.US_ASCII); <ide> } <ide> <add> static class ConcurrentLRUCache<K, V> { <add> <add> private final int maxSize; <add> <add> private final ConcurrentLinkedQueue<K> queue = new ConcurrentLinkedQueue<>(); <add> <add> private final ConcurrentHashMap<K, V> cache = new ConcurrentHashMap<>(); <add> <add> private final ReadWriteLock lock = new ReentrantReadWriteLock(); <add> <add> private final Function<K, V> generator; <add> <add> ConcurrentLRUCache(int maxSize, Function<K, V> generator) { <add> Assert.isTrue(maxSize > 0, "LRU max size should be positive"); <add> Assert.notNull(generator, "Generator function should not be null"); <add> this.maxSize = maxSize; <add> this.generator = generator; <add> } <add> <add> public V get(K key) { <add> this.lock.readLock().lock(); <add> try { <add> if (this.queue.remove(key)) { <add> this.queue.add(key); <add> return this.cache.get(key); <add> } <add> } <add> finally { <add> this.lock.readLock().unlock(); <add> } <add> this.lock.writeLock().lock(); <add> try { <add> if (this.queue.size() == this.maxSize) { <add> K leastUsed = this.queue.poll(); <add> this.cache.remove(leastUsed); <add> } <add> V value = this.generator.apply(key); <add> this.queue.add(key); <add> this.cache.put(key, value); <add> return value; <add> } <add> finally { <add> this.lock.writeLock().unlock(); <add> } <add> } <add> <add> } <add> <ide> } <ide><path>spring-web/src/main/java/org/springframework/http/MediaType.java <ide> /* <del> * Copyright 2002-2018 the original author or authors. <add> * Copyright 2002-2019 the original author or authors. <ide> * <ide> * Licensed under the Apache License, Version 2.0 (the "License"); <ide> * you may not use this file except in compliance with the License. <ide> <ide> import java.io.Serializable; <ide> import java.nio.charset.Charset; <add>import java.nio.charset.StandardCharsets; <ide> import java.util.ArrayList; <ide> import java.util.Collection; <ide> import java.util.Collections; <ide> import java.util.Comparator; <ide> import java.util.LinkedHashMap; <ide> import java.util.List; <ide> import java.util.Map; <del>import java.util.stream.Collectors; <ide> <ide> import org.springframework.lang.Nullable; <ide> import org.springframework.util.Assert; <ide> public class MediaType extends MimeType implements Serializable { <ide> <ide> <ide> static { <del> ALL = valueOf(ALL_VALUE); <del> APPLICATION_ATOM_XML = valueOf(APPLICATION_ATOM_XML_VALUE); <del> APPLICATION_FORM_URLENCODED = valueOf(APPLICATION_FORM_URLENCODED_VALUE); <del> APPLICATION_JSON = valueOf(APPLICATION_JSON_VALUE); <del> APPLICATION_JSON_UTF8 = valueOf(APPLICATION_JSON_UTF8_VALUE); <del> APPLICATION_OCTET_STREAM = valueOf(APPLICATION_OCTET_STREAM_VALUE); <del> APPLICATION_PDF = valueOf(APPLICATION_PDF_VALUE); <del> APPLICATION_PROBLEM_JSON = valueOf(APPLICATION_PROBLEM_JSON_VALUE); <del> APPLICATION_PROBLEM_JSON_UTF8 = valueOf(APPLICATION_PROBLEM_JSON_UTF8_VALUE); <del> APPLICATION_PROBLEM_XML = valueOf(APPLICATION_PROBLEM_XML_VALUE); <del> APPLICATION_RSS_XML = valueOf(APPLICATION_RSS_XML_VALUE); <del> APPLICATION_STREAM_JSON = valueOf(APPLICATION_STREAM_JSON_VALUE); <del> APPLICATION_XHTML_XML = valueOf(APPLICATION_XHTML_XML_VALUE); <del> APPLICATION_XML = valueOf(APPLICATION_XML_VALUE); <del> IMAGE_GIF = valueOf(IMAGE_GIF_VALUE); <del> IMAGE_JPEG = valueOf(IMAGE_JPEG_VALUE); <del> IMAGE_PNG = valueOf(IMAGE_PNG_VALUE); <del> MULTIPART_FORM_DATA = valueOf(MULTIPART_FORM_DATA_VALUE); <del> TEXT_EVENT_STREAM = valueOf(TEXT_EVENT_STREAM_VALUE); <del> TEXT_HTML = valueOf(TEXT_HTML_VALUE); <del> TEXT_MARKDOWN = valueOf(TEXT_MARKDOWN_VALUE); <del> TEXT_PLAIN = valueOf(TEXT_PLAIN_VALUE); <del> TEXT_XML = valueOf(TEXT_XML_VALUE); <add> ALL = new MediaType("*", "*"); <add> APPLICATION_ATOM_XML = new MediaType("application", "atom+xml"); <add> APPLICATION_FORM_URLENCODED = new MediaType("application", "x-www-form-urlencoded"); <add> APPLICATION_JSON = new MediaType("application", "json"); <add> APPLICATION_JSON_UTF8 = new MediaType("application", "json", StandardCharsets.UTF_8); <add> APPLICATION_OCTET_STREAM = new MediaType("application", "octet-stream");; <add> APPLICATION_PDF = new MediaType("application", "pdf"); <add> APPLICATION_PROBLEM_JSON = new MediaType("application", "problem+json"); <add> APPLICATION_PROBLEM_JSON_UTF8 = new MediaType("application", "problem", StandardCharsets.UTF_8); <add> APPLICATION_PROBLEM_XML = new MediaType("application", "problem+xml"); <add> APPLICATION_RSS_XML = new MediaType("application", "rss+xml"); <add> APPLICATION_STREAM_JSON = new MediaType("application", "stream+json"); <add> APPLICATION_XHTML_XML = new MediaType("application", "xhtml+xml"); <add> APPLICATION_XML = new MediaType("application", "xml"); <add> IMAGE_GIF = new MediaType("image", "gif"); <add> IMAGE_JPEG = new MediaType("image", "jpeg"); <add> IMAGE_PNG = new MediaType("image", "png"); <add> MULTIPART_FORM_DATA = new MediaType("multipart", "form-data"); <add> TEXT_EVENT_STREAM = new MediaType("text", "event-stream"); <add> TEXT_HTML = new MediaType("text", "html"); <add> TEXT_MARKDOWN = new MediaType("text", "markdown"); <add> TEXT_PLAIN = new MediaType("text", "plain"); <add> TEXT_XML = new MediaType("text", "xml"); <ide> } <ide> <ide> <ide> public static List<MediaType> parseMediaTypes(@Nullable String mediaTypes) { <ide> if (!StringUtils.hasLength(mediaTypes)) { <ide> return Collections.emptyList(); <ide> } <del> return MimeTypeUtils.tokenize(mediaTypes).stream() <del> .map(MediaType::parseMediaType).collect(Collectors.toList()); <add> List<String> tokenizedTypes = MimeTypeUtils.tokenize(mediaTypes); <add> List<MediaType> result = new ArrayList<>(tokenizedTypes.size()); <add> for (String type : tokenizedTypes) { <add> result.add(parseMediaType(type)); <add> } <add> return result; <ide> } <ide> <ide> /** <ide> else if (mediaTypes.size() == 1) { <ide> * @since 5.0 <ide> */ <ide> public static List<MediaType> asMediaTypes(List<MimeType> mimeTypes) { <del> return mimeTypes.stream().map(MediaType::asMediaType).collect(Collectors.toList()); <add> List<MediaType> mediaTypes = new ArrayList<>(mimeTypes.size()); <add> for(MimeType mimeType : mimeTypes) { <add> mediaTypes.add(MediaType.asMediaType(mimeType)); <add> } <add> return mediaTypes; <ide> } <ide> <ide> /**
3
Go
Go
fix containerd proto for connection
6889c3276c6895a8440dc8883b8cd608793199f3
<ide><path>integration-cli/docker_cli_daemon_experimental_test.go <ide> func (s *DockerDaemonSuite) TestDaemonRestartWithKilledRunningContainer(t *check <ide> } <ide> <ide> // kill the container <del> runCmd := exec.Command(ctrBinary, "--address", "/var/run/docker/libcontainerd/docker-containerd.sock", "containers", "kill", cid) <add> runCmd := exec.Command(ctrBinary, "--address", "unix:///var/run/docker/libcontainerd/docker-containerd.sock", "containers", "kill", cid) <ide> if out, ec, err := runCommandWithOutput(runCmd); err != nil { <ide> t.Fatalf("Failed to run ctr, ExitCode: %d, err: '%v' output: '%s' cid: '%s'\n", ec, err, out, cid) <ide> } <ide> func (s *DockerDaemonSuite) TestDaemonRestartWithPausedRunningContainer(t *check <ide> } <ide> <ide> // kill the container <del> runCmd := exec.Command(ctrBinary, "--address", "/var/run/docker/libcontainerd/docker-containerd.sock", "containers", "pause", cid) <add> runCmd := exec.Command(ctrBinary, "--address", "unix:///var/run/docker/libcontainerd/docker-containerd.sock", "containers", "pause", cid) <ide> if out, ec, err := runCommandWithOutput(runCmd); err != nil { <ide> t.Fatalf("Failed to run ctr, ExitCode: %d, err: '%v' output: '%s' cid: '%s'\n", ec, err, out, cid) <ide> } <ide> func (s *DockerDaemonSuite) TestDaemonRestartWithUnpausedRunningContainer(t *che <ide> } <ide> <ide> // resume the container <del> runCmd := exec.Command(ctrBinary, "--address", "/var/run/docker/libcontainerd/docker-containerd.sock", "containers", "resume", cid) <add> runCmd := exec.Command(ctrBinary, "--address", "unix:///var/run/docker/libcontainerd/docker-containerd.sock", "containers", "resume", cid) <ide> if out, ec, err := runCommandWithOutput(runCmd); err != nil { <ide> t.Fatalf("Failed to run ctr, ExitCode: %d, err: '%v' output: '%s' cid: '%s'\n", ec, err, out, cid) <ide> } <ide><path>integration-cli/docker_cli_daemon_test.go <ide> func (s *DockerDaemonSuite) TestCleanupMountsAfterDaemonAndContainerKill(c *chec <ide> c.Assert(strings.Contains(string(mountOut), id), check.Equals, true, comment) <ide> <ide> // kill the container <del> runCmd := exec.Command(ctrBinary, "--address", "/var/run/docker/libcontainerd/docker-containerd.sock", "containers", "kill", id) <add> runCmd := exec.Command(ctrBinary, "--address", "unix:///var/run/docker/libcontainerd/docker-containerd.sock", "containers", "kill", id) <ide> if out, ec, err := runCommandWithOutput(runCmd); err != nil { <ide> c.Fatalf("Failed to run ctr, ExitCode: %d, err: %v output: %s id: %s\n", ec, err, out, id) <ide> } <ide><path>libcontainerd/remote_linux.go <ide> func (r *remote) runContainerdDaemon() error { <ide> } <ide> <ide> // Start a new instance <del> args := []string{"-l", r.rpcAddr, "--runtime", "docker-runc", "--metrics-interval=0"} <add> args := []string{ <add> "-l", fmt.Sprintf("unix://%s", r.rpcAddr), <add> "--shim", "docker-containerd-shim", <add> "--runtime", "docker-runc", <add> "--metrics-interval=0", <add> } <ide> if r.debugLog { <ide> args = append(args, "--debug") <ide> }
3
Go
Go
use correct type for containerexecattach
5fee8bddfeb9b268f3e0b3c91e0932ee9a5eff83
<ide><path>client/container_exec.go <ide> func (cli *Client) ContainerExecStart(ctx context.Context, execID string, config <ide> // It returns a types.HijackedConnection with the hijacked connection <ide> // and the a reader to get output. It's up to the called to close <ide> // the hijacked connection by calling types.HijackedResponse.Close. <del>func (cli *Client) ContainerExecAttach(ctx context.Context, execID string, config types.ExecConfig) (types.HijackedResponse, error) { <add>func (cli *Client) ContainerExecAttach(ctx context.Context, execID string, config types.ExecStartCheck) (types.HijackedResponse, error) { <ide> headers := map[string][]string{"Content-Type": {"application/json"}} <ide> return cli.postHijacked(ctx, "/exec/"+execID+"/start", nil, config, headers) <ide> } <ide><path>client/interface.go <ide> type ContainerAPIClient interface { <ide> ContainerCommit(ctx context.Context, container string, options types.ContainerCommitOptions) (types.IDResponse, error) <ide> ContainerCreate(ctx context.Context, config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, containerName string) (container.ContainerCreateCreatedBody, error) <ide> ContainerDiff(ctx context.Context, container string) ([]container.ContainerChangeResponseItem, error) <del> ContainerExecAttach(ctx context.Context, execID string, config types.ExecConfig) (types.HijackedResponse, error) <add> ContainerExecAttach(ctx context.Context, execID string, config types.ExecStartCheck) (types.HijackedResponse, error) <ide> ContainerExecCreate(ctx context.Context, container string, config types.ExecConfig) (types.IDResponse, error) <ide> ContainerExecInspect(ctx context.Context, execID string) (types.ContainerExecInspect, error) <ide> ContainerExecResize(ctx context.Context, execID string, options types.ResizeOptions) error
2
PHP
PHP
update doc blocks for cakephp/cakephp
0da3c4c5f67ea5f1efa4b72e5590ec0e878ce8d6
<ide><path>src/Routing/DispatcherFilter.php <ide> * When the above filter is connected to a dispatcher it will only fire <ide> * its `beforeDispatch` and `afterDispatch` methods on requests that start with `/blog`. <ide> * <add> * The for condition can also be a regular expression by using the `preg:` prefix: <add> * <add> * {{{ <add> * $filter = new BlogFilter(['for' => 'preg:#^/blog/\d+$#']); <add> * }}} <add> * <ide> * ### Limiting filters based on conditions <ide> * <ide> * In addition to simple path based matching you can use a closure to match on arbitrary request
1
Python
Python
add field == value
2c92670771061f7eb63588494032cb34cf4958bb
<ide><path>glances/plugins/glances_plugin.py <ide> def get_stats_value(self, item, value): <ide> if not isinstance(self.stats, list): <ide> return None <ide> else: <del> if value.isdigit(): <add> if not isinstance(value, int) and value.isdigit(): <ide> value = int(value) <ide> try: <ide> return self._json_dumps({value: [i for i in self.stats if i[item] == value]})
1
Text
Text
move blur example from step 34 to step 35 rothko
c356ecfa29728686b6e959780461e73dd2a64148
<ide><path>curriculum/challenges/english/14-responsive-web-design-22/learn-the-css-box-model-by-building-a-rothko-painting/60a3e3396c7b40068ad6998c.md <ide> The colors and shapes of your painting are too sharp to pass as a Rothko. <ide> <ide> Use the `filter` property to `blur` the painting by `2px` in the `.canvas` element. <ide> <add>Here's an example of a rule that add a 3px `blur`: <add> <add>```css <add>p { <add> filter: blur(3px); <add>} <add>``` <add> <ide> # --hints-- <ide> <ide> You should set the `filter` property to `blur(2px)`. <ide><path>curriculum/challenges/english/14-responsive-web-design-22/learn-the-css-box-model-by-building-a-rothko-painting/60a3e3396c7b40068ad6998d.md <ide> dashedName: step-35 <ide> <ide> Create a rule that targets both `.one` and `.two` and increase their `blur` effect by 1 pixel. <ide> <del>Here's an example of a rule that increases the `blur` of two elements: <del> <del>```css <del>h1, p { <del> filter: blur(3px); <del>} <del>``` <del> <ide> # --hints-- <ide> <del>You should have a `.one, .two` selector. <add>You should have a `.one, .two` selector list. <ide> <ide> ```js <ide> const oneTwo = new __helpers.CSSHelp(document).getStyle('.one, .two');
2
Python
Python
fix lint issues
c4e0ba88dfdcbad4a8600ca227bb00ab00262bb0
<ide><path>numpy/distutils/ccompiler_opt.py <ide> class _Config: <ide> VSX3 = dict(interest=3, implies="VSX2", implies_detect=False), <ide> # IBM/Z <ide> ## VX(z13) support <del> VX = dict(interest=1, headers="vecintrin.h"), <add> VX = dict(interest=1, headers="vecintrin.h"), <ide> ## Vector-Enhancements Facility <del> VXE = dict(interest=2, implies="VX",implies_detect=False), <add> VXE = dict(interest=2, implies="VX", implies_detect=False), <ide> ## Vector-Enhancements Facility 2 <del> VXE2 = dict(interest=3, implies="VXE",implies_detect=False), <add> VXE2 = dict(interest=3, implies="VXE", implies_detect=False), <ide> # ARM <ide> NEON = dict(interest=1, headers="arm_neon.h"), <ide> NEON_FP16 = dict(interest=2, implies="NEON"), <ide> class attribute `conf_features`, also its override <ide> <ide> return partial <ide> <del> <ide> on_zarch = self.cc_on_s390x <ide> if on_zarch: <ide> partial = dict( <ide> class attribute `conf_features`, also its override <ide> ) <ide> ) <ide> if self.cc_is_clang: <del> partial["VX"]["flags"] = "-march=arch11 -mzvector" <del> partial["VXE"]["flags"] = "-march=arch12 -mzvector" <add> partial["VX"]["flags"] = "-march=arch11 -mzvector" <add> partial["VXE"]["flags"] = "-march=arch12 -mzvector" <ide> partial["VXE2"]["flags"] = "-march=arch13 -mzvector" <ide> <ide> return partial <ide> def __init__(self): <ide> self.cc_is_gcc = True <ide> <ide> self.cc_march = "unknown" <del> for arch in ("x86", "x64", "ppc64", "ppc64le", "armhf", "aarch64", "s390x"): <add> for arch in ("x86", "x64", "ppc64", "ppc64le", <add> "armhf", "aarch64", "s390x"): <ide> if getattr(self, "cc_on_" + arch): <ide> self.cc_march = arch <ide> break <ide><path>numpy/distutils/command/build.py <ide> def initialize_options(self): <ide> - not part of dispatch-able features(--cpu-dispatch) <ide> - not supported by compiler or platform <ide> """ <del> self.simd_test = "BASELINE SSE2 SSE42 XOP FMA4 (FMA3 AVX2) AVX512F AVX512_SKX VSX VSX2 VSX3 NEON ASIMD VX VXE VXE2" <add> self.simd_test = "BASELINE SSE2 SSE42 XOP FMA4 (FMA3 AVX2) AVX512F" \ <add> " AVX512_SKX VSX VSX2 VSX3 NEON ASIMD VX VXE VXE2" <ide> <ide> def finalize_options(self): <ide> build_scripts = self.build_scripts
2
Javascript
Javascript
make filerecoveryservice async
0390548e2c569277a5ed4590f9b4966e599967b2
<ide><path>spec/main-process/file-recovery-service.test.js <del>/** @babel */ <del> <del>import {dialog} from 'electron' <del>import FileRecoveryService from '../../src/main-process/file-recovery-service' <del>import fs from 'fs-plus' <del>import sinon from 'sinon' <del>import {escapeRegExp} from 'underscore-plus' <add>const {dialog} = require('electron') <add>const FileRecoveryService = require('../../src/main-process/file-recovery-service') <add>const fs = require('fs-plus') <add>const sinon = require('sinon') <add>const {escapeRegExp} = require('underscore-plus') <ide> const temp = require('temp').track() <ide> <ide> describe("FileRecoveryService", () => { <del> let recoveryService, recoveryDirectory <add> let recoveryService, recoveryDirectory, spies <ide> <ide> beforeEach(() => { <ide> recoveryDirectory = temp.mkdirSync('atom-spec-file-recovery') <ide> recoveryService = new FileRecoveryService(recoveryDirectory) <add> spies = sinon.sandbox.create() <ide> }) <ide> <ide> afterEach(() => { <add> spies.restore() <ide> try { <ide> temp.cleanupSync() <ide> } catch (e) { <ide> describe("FileRecoveryService", () => { <ide> }) <ide> <ide> describe("when no crash happens during a save", () => { <del> it("creates a recovery file and deletes it after saving", () => { <add> it("creates a recovery file and deletes it after saving", async () => { <ide> const mockWindow = {} <ide> const filePath = temp.path() <ide> <ide> fs.writeFileSync(filePath, "some content") <del> recoveryService.willSavePath(mockWindow, filePath) <add> await recoveryService.willSavePath(mockWindow, filePath) <ide> assert.equal(fs.listTreeSync(recoveryDirectory).length, 1) <ide> <ide> fs.writeFileSync(filePath, "changed") <del> recoveryService.didSavePath(mockWindow, filePath) <add> await recoveryService.didSavePath(mockWindow, filePath) <ide> assert.equal(fs.listTreeSync(recoveryDirectory).length, 0) <ide> assert.equal(fs.readFileSync(filePath, 'utf8'), "changed") <ide> <ide> fs.removeSync(filePath) <ide> }) <ide> <del> it("creates only one recovery file when many windows attempt to save the same file, deleting it when the last one finishes saving it", () => { <add> it("creates only one recovery file when many windows attempt to save the same file, deleting it when the last one finishes saving it", async () => { <ide> const mockWindow = {} <ide> const anotherMockWindow = {} <ide> const filePath = temp.path() <ide> <ide> fs.writeFileSync(filePath, "some content") <del> recoveryService.willSavePath(mockWindow, filePath) <del> recoveryService.willSavePath(anotherMockWindow, filePath) <add> await recoveryService.willSavePath(mockWindow, filePath) <add> await recoveryService.willSavePath(anotherMockWindow, filePath) <ide> assert.equal(fs.listTreeSync(recoveryDirectory).length, 1) <ide> <ide> fs.writeFileSync(filePath, "changed") <del> recoveryService.didSavePath(mockWindow, filePath) <add> await recoveryService.didSavePath(mockWindow, filePath) <ide> assert.equal(fs.listTreeSync(recoveryDirectory).length, 1) <ide> assert.equal(fs.readFileSync(filePath, 'utf8'), "changed") <ide> <del> recoveryService.didSavePath(anotherMockWindow, filePath) <add> await recoveryService.didSavePath(anotherMockWindow, filePath) <ide> assert.equal(fs.listTreeSync(recoveryDirectory).length, 0) <ide> assert.equal(fs.readFileSync(filePath, 'utf8'), "changed") <ide> <ide> describe("FileRecoveryService", () => { <ide> }) <ide> <ide> describe("when a crash happens during a save", () => { <del> it("restores the created recovery file and deletes it", () => { <add> it("restores the created recovery file and deletes it", async () => { <ide> const mockWindow = {} <ide> const filePath = temp.path() <ide> <ide> fs.writeFileSync(filePath, "some content") <del> recoveryService.willSavePath(mockWindow, filePath) <add> await recoveryService.willSavePath(mockWindow, filePath) <ide> assert.equal(fs.listTreeSync(recoveryDirectory).length, 1) <ide> <ide> fs.writeFileSync(filePath, "changed") <del> recoveryService.didCrashWindow(mockWindow) <add> await recoveryService.didCrashWindow(mockWindow) <ide> assert.equal(fs.listTreeSync(recoveryDirectory).length, 0) <ide> assert.equal(fs.readFileSync(filePath, 'utf8'), "some content") <ide> <ide> fs.removeSync(filePath) <ide> }) <ide> <del> it("restores the created recovery file when many windows attempt to save the same file and one of them crashes", () => { <add> it("restores the created recovery file when many windows attempt to save the same file and one of them crashes", async () => { <ide> const mockWindow = {} <ide> const anotherMockWindow = {} <ide> const filePath = temp.path() <ide> <ide> fs.writeFileSync(filePath, "A") <del> recoveryService.willSavePath(mockWindow, filePath) <add> await recoveryService.willSavePath(mockWindow, filePath) <ide> fs.writeFileSync(filePath, "B") <del> recoveryService.willSavePath(anotherMockWindow, filePath) <add> await recoveryService.willSavePath(anotherMockWindow, filePath) <ide> assert.equal(fs.listTreeSync(recoveryDirectory).length, 1) <ide> <ide> fs.writeFileSync(filePath, "C") <ide> <del> recoveryService.didCrashWindow(mockWindow) <add> await recoveryService.didCrashWindow(mockWindow) <ide> assert.equal(fs.readFileSync(filePath, 'utf8'), "A") <ide> assert.equal(fs.listTreeSync(recoveryDirectory).length, 0) <ide> <ide> fs.writeFileSync(filePath, "D") <del> recoveryService.willSavePath(mockWindow, filePath) <add> await recoveryService.willSavePath(mockWindow, filePath) <ide> fs.writeFileSync(filePath, "E") <del> recoveryService.willSavePath(anotherMockWindow, filePath) <add> await recoveryService.willSavePath(anotherMockWindow, filePath) <ide> assert.equal(fs.listTreeSync(recoveryDirectory).length, 1) <ide> <ide> fs.writeFileSync(filePath, "F") <ide> <del> recoveryService.didCrashWindow(anotherMockWindow) <add> await recoveryService.didCrashWindow(anotherMockWindow) <ide> assert.equal(fs.readFileSync(filePath, 'utf8'), "D") <ide> assert.equal(fs.listTreeSync(recoveryDirectory).length, 0) <ide> <ide> fs.removeSync(filePath) <ide> }) <ide> <del> it("emits a warning when a file can't be recovered", sinon.test(function () { <add> it("emits a warning when a file can't be recovered", async () => { <ide> const mockWindow = {} <ide> const filePath = temp.path() <ide> fs.writeFileSync(filePath, "content") <ide> fs.chmodSync(filePath, 0444) <ide> <ide> let logs = [] <del> this.stub(console, 'log', (message) => logs.push(message)) <del> this.stub(dialog, 'showMessageBox') <add> spies.stub(console, 'log', (message) => logs.push(message)) <add> spies.stub(dialog, 'showMessageBox') <ide> <del> recoveryService.willSavePath(mockWindow, filePath) <del> recoveryService.didCrashWindow(mockWindow) <add> await recoveryService.willSavePath(mockWindow, filePath) <add> await recoveryService.didCrashWindow(mockWindow) <ide> let recoveryFiles = fs.listTreeSync(recoveryDirectory) <ide> assert.equal(recoveryFiles.length, 1) <ide> assert.equal(logs.length, 1) <ide> assert.match(logs[0], new RegExp(escapeRegExp(filePath))) <ide> assert.match(logs[0], new RegExp(escapeRegExp(recoveryFiles[0]))) <ide> <ide> fs.removeSync(filePath) <del> })) <add> }) <ide> }) <ide> <del> it("doesn't create a recovery file when the file that's being saved doesn't exist yet", () => { <add> it("doesn't create a recovery file when the file that's being saved doesn't exist yet", async () => { <ide> const mockWindow = {} <ide> <del> recoveryService.willSavePath(mockWindow, "a-file-that-doesnt-exist") <add> await recoveryService.willSavePath(mockWindow, "a-file-that-doesnt-exist") <ide> assert.equal(fs.listTreeSync(recoveryDirectory).length, 0) <ide> <del> recoveryService.didSavePath(mockWindow, "a-file-that-doesnt-exist") <add> await recoveryService.didSavePath(mockWindow, "a-file-that-doesnt-exist") <ide> assert.equal(fs.listTreeSync(recoveryDirectory).length, 0) <ide> }) <ide> }) <ide><path>src/application-delegate.js <ide> class ApplicationDelegate { <ide> } <ide> <ide> emitWillSavePath (path) { <del> return ipcRenderer.sendSync('will-save-path', path) <add> return ipcHelpers.call('will-save-path', path) <ide> } <ide> <ide> emitDidSavePath (path) { <del> return ipcRenderer.sendSync('did-save-path', path) <add> return ipcHelpers.call('did-save-path', path) <ide> } <ide> <ide> resolveProxy (requestId, url) { <ide><path>src/ipc-helpers.js <del>'use strict' <del> <ide> const Disposable = require('event-kit').Disposable <ide> let ipcRenderer = null <ide> let ipcMain = null <ide> let BrowserWindow = null <ide> <ide> exports.on = function (emitter, eventName, callback) { <ide> emitter.on(eventName, callback) <del> return new Disposable(function () { <del> emitter.removeListener(eventName, callback) <del> }) <add> return new Disposable(() => emitter.removeListener(eventName, callback)) <ide> } <ide> <ide> exports.call = function (channel, ...args) { <ide> exports.call = function (channel, ...args) { <ide> ipcRenderer.setMaxListeners(20) <ide> } <ide> <del> var responseChannel = getResponseChannel(channel) <add> const responseChannel = getResponseChannel(channel) <ide> <del> return new Promise(function (resolve) { <del> ipcRenderer.on(responseChannel, function (event, result) { <add> return new Promise(resolve => { <add> ipcRenderer.on(responseChannel, (event, result) => { <ide> ipcRenderer.removeAllListeners(responseChannel) <ide> resolve(result) <ide> }) <ide> exports.call = function (channel, ...args) { <ide> <ide> exports.respondTo = function (channel, callback) { <ide> if (!ipcMain) { <del> var electron = require('electron') <add> const electron = require('electron') <ide> ipcMain = electron.ipcMain <ide> BrowserWindow = electron.BrowserWindow <ide> } <ide> <del> var responseChannel = getResponseChannel(channel) <add> const responseChannel = getResponseChannel(channel) <ide> <del> return exports.on(ipcMain, channel, function (event, ...args) { <del> var browserWindow = BrowserWindow.fromWebContents(event.sender) <del> var result = callback(browserWindow, ...args) <add> return exports.on(ipcMain, channel, async (event, ...args) => { <add> const browserWindow = BrowserWindow.fromWebContents(event.sender) <add> const result = await callback(browserWindow, ...args) <ide> event.sender.send(responseChannel, result) <ide> }) <ide> } <ide><path>src/main-process/atom-application.js <ide> class AtomApplication extends EventEmitter { <ide> event.returnValue = this.autoUpdateManager.getErrorMessage() <ide> })) <ide> <del> this.disposable.add(ipcHelpers.on(ipcMain, 'will-save-path', (event, path) => { <del> this.fileRecoveryService.willSavePath(this.atomWindowForEvent(event), path) <del> event.returnValue = true <del> })) <add> this.disposable.add(ipcHelpers.respondTo('will-save-path', (window, path) => <add> this.fileRecoveryService.willSavePath(window, path) <add> )) <ide> <del> this.disposable.add(ipcHelpers.on(ipcMain, 'did-save-path', (event, path) => { <del> this.fileRecoveryService.didSavePath(this.atomWindowForEvent(event), path) <del> event.returnValue = true <del> })) <add> this.disposable.add(ipcHelpers.respondTo('did-save-path', (window, path) => <add> this.fileRecoveryService.didSavePath(window, path) <add> )) <ide> <ide> this.disposable.add(ipcHelpers.on(ipcMain, 'did-change-paths', () => <ide> this.saveState(false) <ide><path>src/main-process/atom-window.js <ide> class AtomWindow extends EventEmitter { <ide> if (chosen === 0) this.browserWindow.destroy() <ide> }) <ide> <del> this.browserWindow.webContents.on('crashed', () => { <add> this.browserWindow.webContents.on('crashed', async () => { <ide> if (this.headless) { <ide> console.log('Renderer process crashed, exiting') <ide> this.atomApplication.exit(100) <ide> return <ide> } <ide> <del> this.fileRecoveryService.didCrashWindow(this) <add> await this.fileRecoveryService.didCrashWindow(this) <ide> const chosen = dialog.showMessageBox(this.browserWindow, { <ide> type: 'warning', <ide> buttons: ['Close Window', 'Reload', 'Keep It Open'], <ide><path>src/main-process/file-recovery-service.js <del>'use babel' <add>const {dialog} = require('electron') <add>const crypto = require('crypto') <add>const Path = require('path') <add>const fs = require('fs-plus') <ide> <del>import {dialog} from 'electron' <del>import crypto from 'crypto' <del>import Path from 'path' <del>import fs from 'fs-plus' <del> <del>export default class FileRecoveryService { <add>module.exports = <add>class FileRecoveryService { <ide> constructor (recoveryDirectory) { <ide> this.recoveryDirectory = recoveryDirectory <ide> this.recoveryFilesByFilePath = new Map() <ide> this.recoveryFilesByWindow = new WeakMap() <ide> this.windowsByRecoveryFile = new Map() <ide> } <ide> <del> willSavePath (window, path) { <del> if (!fs.existsSync(path)) return <add> async willSavePath (window, path) { <add> const stats = await tryStatFile(path) <add> if (!stats) return <ide> <ide> const recoveryPath = Path.join(this.recoveryDirectory, RecoveryFile.fileNameForPath(path)) <ide> const recoveryFile = <del> this.recoveryFilesByFilePath.get(path) || new RecoveryFile(path, recoveryPath) <add> this.recoveryFilesByFilePath.get(path) || new RecoveryFile(path, stats.mode, recoveryPath) <ide> <ide> try { <del> recoveryFile.retain() <add> await recoveryFile.retain() <ide> } catch (err) { <ide> console.log(`Couldn't retain ${recoveryFile.recoveryPath}. Code: ${err.code}. Message: ${err.message}`) <ide> return <ide> export default class FileRecoveryService { <ide> this.recoveryFilesByFilePath.set(path, recoveryFile) <ide> } <ide> <del> didSavePath (window, path) { <add> async didSavePath (window, path) { <ide> const recoveryFile = this.recoveryFilesByFilePath.get(path) <ide> if (recoveryFile != null) { <ide> try { <del> recoveryFile.release() <add> await recoveryFile.release() <ide> } catch (err) { <ide> console.log(`Couldn't release ${recoveryFile.recoveryPath}. Code: ${err.code}. Message: ${err.message}`) <ide> } <ide> export default class FileRecoveryService { <ide> } <ide> } <ide> <del> didCrashWindow (window) { <add> async didCrashWindow (window) { <ide> if (!this.recoveryFilesByWindow.has(window)) return <ide> <add> const promises = [] <ide> for (const recoveryFile of this.recoveryFilesByWindow.get(window)) { <del> try { <del> recoveryFile.recoverSync() <del> } catch (error) { <del> const message = 'A file that Atom was saving could be corrupted' <del> const detail = <del> `Error ${error.code}. There was a crash while saving "${recoveryFile.originalPath}", so this file might be blank or corrupted.\n` + <del> `Atom couldn't recover it automatically, but a recovery file has been saved at: "${recoveryFile.recoveryPath}".` <del> console.log(detail) <del> dialog.showMessageBox(window.browserWindow, {type: 'info', buttons: ['OK'], message, detail}) <del> } finally { <del> for (let window of this.windowsByRecoveryFile.get(recoveryFile)) { <del> this.recoveryFilesByWindow.get(window).delete(recoveryFile) <del> } <del> this.windowsByRecoveryFile.delete(recoveryFile) <del> this.recoveryFilesByFilePath.delete(recoveryFile.originalPath) <del> } <add> promises.push(recoveryFile.recover() <add> .catch(error => { <add> const message = 'A file that Atom was saving could be corrupted' <add> const detail = <add> `Error ${error.code}. There was a crash while saving "${recoveryFile.originalPath}", so this file might be blank or corrupted.\n` + <add> `Atom couldn't recover it automatically, but a recovery file has been saved at: "${recoveryFile.recoveryPath}".` <add> console.log(detail) <add> dialog.showMessageBox(window, {type: 'info', buttons: ['OK'], message, detail}) <add> }) <add> .then(() => { <add> for (let window of this.windowsByRecoveryFile.get(recoveryFile)) { <add> this.recoveryFilesByWindow.get(window).delete(recoveryFile) <add> } <add> this.windowsByRecoveryFile.delete(recoveryFile) <add> this.recoveryFilesByFilePath.delete(recoveryFile.originalPath) <add> }) <add> ) <ide> } <add> <add> await Promise.all(promises) <ide> } <ide> <ide> didCloseWindow (window) { <ide> class RecoveryFile { <ide> return `${basename}-${randomSuffix}${extension}` <ide> } <ide> <del> constructor (originalPath, recoveryPath) { <add> constructor (originalPath, fileMode, recoveryPath) { <ide> this.originalPath = originalPath <add> this.fileMode = fileMode <ide> this.recoveryPath = recoveryPath <ide> this.refCount = 0 <ide> } <ide> <del> storeSync () { <del> fs.copyFileSync(this.originalPath, this.recoveryPath) <add> async store () { <add> await copyFile(this.originalPath, this.recoveryPath, this.fileMode) <ide> } <ide> <del> recoverSync () { <del> fs.copyFileSync(this.recoveryPath, this.originalPath) <del> this.removeSync() <add> async recover () { <add> await copyFile(this.recoveryPath, this.originalPath, this.fileMode) <add> await this.remove() <ide> } <ide> <del> removeSync () { <del> fs.unlinkSync(this.recoveryPath) <add> async remove () { <add> return new Promise((resolve, reject) => <add> fs.unlink(this.recoveryPath, error => <add> error && error.code !== 'ENOENT' ? reject(error) : resolve() <add> ) <add> ) <ide> } <ide> <del> retain () { <del> if (this.isReleased()) this.storeSync() <add> async retain () { <add> if (this.isReleased()) await this.store() <ide> this.refCount++ <ide> } <ide> <del> release () { <add> async release () { <ide> this.refCount-- <del> if (this.isReleased()) this.removeSync() <add> if (this.isReleased()) await this.remove() <ide> } <ide> <ide> isReleased () { <ide> return this.refCount === 0 <ide> } <ide> } <add> <add>async function tryStatFile (path) { <add> return new Promise((resolve, reject) => <add> fs.stat(path, (error, result) => <add> resolve(error == null && result) <add> ) <add> ) <add>} <add> <add>async function copyFile (source, destination, mode) { <add> return new Promise((resolve, reject) => { <add> const readStream = fs.createReadStream(source) <add> readStream <add> .on('error', reject) <add> .once('open', () => { <add> const writeStream = fs.createWriteStream(destination, {mode}) <add> writeStream <add> .on('error', reject) <add> .on('open', () => readStream.pipe(writeStream)) <add> .once('close', () => resolve()) <add> }) <add> }) <add>} <ide><path>src/project.js <ide> class Project extends Model { <ide> } <ide> <ide> subscribeToBuffer (buffer) { <del> buffer.onWillSave(({path}) => this.applicationDelegate.emitWillSavePath(path)) <add> buffer.onWillSave(async ({path}) => this.applicationDelegate.emitWillSavePath(path)) <ide> buffer.onDidSave(({path}) => this.applicationDelegate.emitDidSavePath(path)) <ide> buffer.onDidDestroy(() => this.removeBuffer(buffer)) <ide> buffer.onDidChangePath(() => {
7
Javascript
Javascript
use slab allocator
7651228ab2149c252eaa3ed7ad3e050deb005d16
<ide><path>lib/tls.js <ide> function checkServerIdentity(host, cert) { <ide> exports.checkServerIdentity = checkServerIdentity; <ide> <ide> <add> <add>function SlabBuffer() { <add> this.create(); <add>}; <add> <add> <add>SlabBuffer.prototype.create = function create() { <add> this.isFull = false; <add> this.pool = new Buffer(10 * 1024 * 1024); <add> this.offset = 0; <add> this.remaining = this.pool.length; <add>}; <add> <add> <add>SlabBuffer.prototype.use = function use(context, fn) { <add> if (this.remaining === 0) { <add> this.isFull = true; <add> return 0; <add> } <add> <add> var bytes = fn.call(context, this.pool, this.offset, this.remaining); <add> <add> if (bytes > 0) { <add> this.offset += bytes; <add> this.remaining -= bytes; <add> } <add> <add> assert(this.remaining >= 0); <add> <add> return bytes; <add>}; <add> <add> <add>var slabBuffer = new SlabBuffer(); <add> <add> <ide> // Base class of both CleartextStream and EncryptedStream <ide> function CryptoStream(pair) { <ide> Stream.call(this); <ide> function CryptoStream(pair) { <ide> this._pending = []; <ide> this._pendingCallbacks = []; <ide> this._pendingBytes = 0; <add> this._buffer = slabBuffer; <ide> } <ide> util.inherits(CryptoStream, Stream); <ide> <ide> CryptoStream.prototype._push = function() { <ide> } <ide> <ide> while (!this._paused) { <del> var chunkBytes = 0; <del> if (!this._pool || (this._poolStart >= this._poolEnd)) { <del> this._pool = new Buffer(16 * 4096); <del> this._poolStart = 0; <del> this._poolEnd = this._pool.length; <del> } <del> var start = this._poolStart; <add> var chunkBytes = 0, <add> bytesRead = 0, <add> start = this._buffer.offset; <ide> <ide> do { <del> chunkBytes = this._pusher(this._pool, <del> this._poolStart, <del> this._poolEnd - this._poolStart); <add> chunkBytes = this._buffer.use(this, this._pusher); <add> if (chunkBytes > 0) bytesRead += chunkBytes; <ide> <ide> if (this.pair.ssl && this.pair.ssl.error) { <ide> this.pair.error(); <ide> CryptoStream.prototype._push = function() { <ide> <ide> this.pair.maybeInitFinished(); <ide> <del> if (chunkBytes >= 0) { <del> this._poolStart += chunkBytes; <del> } <add> } while (chunkBytes > 0 && !this._buffer.isFull); <ide> <del> } while (chunkBytes > 0 && this._poolStart < this._poolEnd); <add> var pool = this._buffer.pool; <ide> <del> var bytesRead = this._poolStart - start; <add> // Create new buffer if previous was filled up <add> if (this._buffer.isFull) this._buffer.create(); <ide> <ide> assert(bytesRead >= 0); <ide> <ide> CryptoStream.prototype._push = function() { <ide> return; <ide> } <ide> <del> var chunk = this._pool.slice(start, this._poolStart); <add> var chunk = pool.slice(start, start + bytesRead); <ide> <ide> if (this === this.pair.cleartext) { <ide> debug('cleartext emit "data" with ' + bytesRead + ' bytes'); <ide> CryptoStream.prototype._push = function() { <ide> } <ide> <ide> // Optimization: emit the original buffer with end points <del> if (this.ondata) this.ondata(this._pool, start, this._poolStart); <add> if (this.ondata) this.ondata(pool, start, start + bytesRead); <ide> } <ide> }; <ide>
1
Javascript
Javascript
convert `imageurisource` to interface
123d184944ae6c8255c5c615e062df3d39bf5a66
<ide><path>Libraries/Image/ImageSource.js <ide> * This type is intentinoally inexact in order to permit call sites that supply <ide> * extra properties. <ide> */ <del>export type ImageURISource = $ReadOnly<{ <add>export interface ImageURISource { <ide> /** <ide> * `uri` is a string representing the resource identifier for the image, which <ide> * could be an http address, a local file path, or the name of a static image <ide> * resource (which should be wrapped in the `require('./path/to/image.png')` <ide> * function). <ide> */ <del> uri?: ?string, <add> +uri?: ?string; <ide> <ide> /** <ide> * `bundle` is the iOS asset bundle which the image is included in. This <ide> * will default to [NSBundle mainBundle] if not set. <ide> * @platform ios <ide> */ <del> bundle?: ?string, <add> +bundle?: ?string; <ide> <ide> /** <ide> * `method` is the HTTP Method to use. Defaults to GET if not specified. <ide> */ <del> method?: ?string, <add> +method?: ?string; <ide> <ide> /** <ide> * `headers` is an object representing the HTTP headers to send along with the <ide> * request for a remote image. <ide> */ <del> headers?: ?{[string]: string}, <add> +headers?: ?{[string]: string}; <ide> <ide> /** <ide> * `body` is the HTTP body to send with the request. This must be a valid <ide> * UTF-8 string, and will be sent exactly as specified, with no <ide> * additional encoding (e.g. URL-escaping or base64) applied. <ide> */ <del> body?: ?string, <add> +body?: ?string; <ide> <ide> /** <ide> * `cache` determines how the requests handles potentially cached <ide> export type ImageURISource = $ReadOnly<{ <ide> * <ide> * @platform ios <ide> */ <del> cache?: ?('default' | 'reload' | 'force-cache' | 'only-if-cached'), <add> +cache?: ?('default' | 'reload' | 'force-cache' | 'only-if-cached'); <ide> <ide> /** <ide> * `width` and `height` can be specified if known at build time, in which case <ide> * these will be used to set the default `<Image/>` component dimensions. <ide> */ <del> width?: ?number, <del> height?: ?number, <add> +width?: ?number; <add> +height?: ?number; <ide> <ide> /** <ide> * `scale` is used to indicate the scale factor of the image. Defaults to 1.0 if <ide> * unspecified, meaning that one image pixel equates to one display point / DIP. <ide> */ <del> scale?: ?number, <del> <del> ... <del>}>; <add> +scale?: ?number; <add>} <ide> <ide> export type ImageSource = <ide> | number <ide> | ImageURISource <ide> | $ReadOnlyArray<ImageURISource>; <add> <add>export function getImageSourceProperties( <add> imageSource: ImageURISource, <add>): $ReadOnly<{ <add> body?: ?string, <add> bundle?: ?string, <add> cache?: ?('default' | 'reload' | 'force-cache' | 'only-if-cached'), <add> headers?: ?{[string]: string}, <add> height?: ?number, <add> method?: ?string, <add> scale?: ?number, <add> uri?: ?string, <add> width?: ?number, <add> ... <add>}> { <add> const object = {}; <add> if (imageSource.body != null) { <add> object.body = imageSource.body; <add> } <add> if (imageSource.bundle != null) { <add> object.bundle = imageSource.bundle; <add> } <add> if (imageSource.cache != null) { <add> object.cache = imageSource.cache; <add> } <add> if (imageSource.headers != null) { <add> object.headers = imageSource.headers; <add> } <add> if (imageSource.height != null) { <add> object.height = imageSource.height; <add> } <add> if (imageSource.method != null) { <add> object.method = imageSource.method; <add> } <add> if (imageSource.scale != null) { <add> object.scale = imageSource.scale; <add> } <add> if (imageSource.uri != null) { <add> object.uri = imageSource.uri; <add> } <add> if (imageSource.width != null) { <add> object.width = imageSource.width; <add> } <add> return object; <add>}
1
Ruby
Ruby
fix html sanitizer allowed_css_properties comment
74f9bdd215f59386ed89faf9d66b7018ce3381f0
<ide><path>actionpack/lib/action_controller/vendor/html-scanner/html/sanitizer.rb <ide> class WhiteListSanitizer < Sanitizer <ide> self.allowed_protocols = Set.new(%w(ed2k ftp http https irc mailto news gopher nntp telnet webcal xmpp callto <ide> feed svn urn aim rsync tag ssh sftp rtsp afs)) <ide> <del> # Specifies the default Set of acceptable css keywords that #sanitize and #sanitize_css will accept. <add> # Specifies the default Set of acceptable css properties that #sanitize and #sanitize_css will accept. <ide> self.allowed_css_properties = Set.new(%w(azimuth background-color border-bottom-color border-collapse <ide> border-color border-left-color border-right-color border-top-color clear color cursor direction display <ide> elevation float font font-family font-size font-style font-variant font-weight height letter-spacing line-height
1
Python
Python
remove deprecated function from app.log.logging
5a0c45857640f2415567736ad7ad2b7ae69e1304
<ide><path>celery/app/log.py <ide> def _is_configured(self, logger): <ide> return self._has_handler(logger) and not getattr( <ide> logger, '_rudimentary_setup', False) <ide> <del> def setup_logger(self, name='celery', *args, **kwargs): <del> """Deprecated: No longer used.""" <del> self.setup_logging_subsystem(*args, **kwargs) <del> return logging.root <del> <ide> def get_default_logger(self, name='celery', **kwargs): <ide> return get_logger(name) <ide> <ide><path>t/unit/app/test_log.py <ide> def getMessage(self): <ide> <ide> class test_default_logger: <ide> <add> def setup_logger(self, *args, **kwargs): <add> self.app.log.setup_logging_subsystem(*args, **kwargs) <add> <add> return logging.root <add> <ide> def setup(self): <del> self.setup_logger = self.app.log.setup_logger <ide> self.get_logger = lambda n=None: get_logger(n) if n else logging.root <ide> signals.setup_logging.receivers[:] = [] <ide> self.app.log.already_setup = False
2
Ruby
Ruby
add test_float_limits to mysql2
fde487328fff6e7157a50a0aa47898c2bc3b73b1
<ide><path>activerecord/test/cases/adapters/mysql/schema_test.rb <ide> def setup <ide> self.table_name = "#{db}.#{table}" <ide> def self.name; 'Post'; end <ide> end <del> <del> @connection.create_table "mysql_doubles" <del> end <del> <del> teardown do <del> @connection.drop_table "mysql_doubles", if_exists: true <ide> end <ide> <ide> class MysqlDouble < ActiveRecord::Base <ide> self.table_name = "mysql_doubles" <ide> end <ide> <ide> def test_float_limits <del> @connection.add_column :mysql_doubles, :float_no_limit, :float <del> @connection.add_column :mysql_doubles, :float_short, :float, limit: 5 <del> @connection.add_column :mysql_doubles, :float_long, :float, limit: 53 <add> @connection.create_table :mysql_doubles do |t| <add> t.float :float_no_limit <add> t.float :float_short, limit: 5 <add> t.float :float_long, limit: 53 <add> <add> t.float :float_23, limit: 23 <add> t.float :float_24, limit: 24 <add> t.float :float_25, limit: 25 <add> end <ide> <del> @connection.add_column :mysql_doubles, :float_23, :float, limit: 23 <del> @connection.add_column :mysql_doubles, :float_24, :float, limit: 24 <del> @connection.add_column :mysql_doubles, :float_25, :float, limit: 25 <ide> MysqlDouble.reset_column_information <ide> <ide> column_no_limit = MysqlDouble.columns.find { |c| c.name == 'float_no_limit' } <ide> def test_float_limits <ide> assert_equal 24, column_23.limit <ide> assert_equal 24, column_24.limit <ide> assert_equal 53, column_25.limit <add> ensure <add> @connection.drop_table "mysql_doubles", if_exists: true <ide> end <ide> <ide> def test_schema <ide><path>activerecord/test/cases/adapters/mysql2/schema_test.rb <ide> def self.name; 'Post'; end <ide> end <ide> end <ide> <add> class MysqlDouble < ActiveRecord::Base <add> self.table_name = "mysql_doubles" <add> end <add> <add> def test_float_limits <add> @connection.create_table :mysql_doubles do |t| <add> t.float :float_no_limit <add> t.float :float_short, limit: 5 <add> t.float :float_long, limit: 53 <add> <add> t.float :float_23, limit: 23 <add> t.float :float_24, limit: 24 <add> t.float :float_25, limit: 25 <add> end <add> <add> MysqlDouble.reset_column_information <add> <add> column_no_limit = MysqlDouble.columns.find { |c| c.name == 'float_no_limit' } <add> column_short = MysqlDouble.columns.find { |c| c.name == 'float_short' } <add> column_long = MysqlDouble.columns.find { |c| c.name == 'float_long' } <add> <add> column_23 = MysqlDouble.columns.find { |c| c.name == 'float_23' } <add> column_24 = MysqlDouble.columns.find { |c| c.name == 'float_24' } <add> column_25 = MysqlDouble.columns.find { |c| c.name == 'float_25' } <add> <add> # Mysql floats are precision 0..24, Mysql doubles are precision 25..53 <add> assert_equal 24, column_no_limit.limit <add> assert_equal 24, column_short.limit <add> assert_equal 53, column_long.limit <add> <add> assert_equal 24, column_23.limit <add> assert_equal 24, column_24.limit <add> assert_equal 53, column_25.limit <add> ensure <add> @connection.drop_table "mysql_doubles", if_exists: true <add> end <add> <ide> def test_schema <ide> assert @omgpost.first <ide> end
2
Go
Go
fix an issue with service logs hanging
80c3ec027d9fd4f7ea2080adc08fc741f8909b2e
<ide><path>daemon/cluster/executor/container/controller.go <ide> func (r *controller) Logs(ctx context.Context, publisher exec.LogPublisher, opti <ide> return err <ide> } <ide> <del> if err := r.waitReady(ctx); err != nil { <del> return errors.Wrap(err, "container not ready for logs") <del> } <add> // if we're following, wait for this container to be ready. there is a <add> // problem here: if the container will never be ready (for example, it has <add> // been totally deleted) then this will wait forever. however, this doesn't <add> // actually cause any UI issues, and shouldn't be a problem. the stuck wait <add> // will go away when the follow (context) is canceled. <add> if options.Follow { <add> if err := r.waitReady(ctx); err != nil { <add> return errors.Wrap(err, "container not ready for logs") <add> } <add> } <add> // if we're not following, we're not gonna wait for the container to be <add> // ready. just call logs. if the container isn't ready, the call will fail <add> // and return an error. no big deal, we don't care, we only want the logs <add> // we can get RIGHT NOW with no follow <ide> <ide> logsContext, cancel := context.WithCancel(ctx) <ide> msgs, err := r.adapter.logs(logsContext, options) <ide><path>integration-cli/docker_cli_service_logs_test.go <ide> func (s *DockerSwarmSuite) TestServiceLogsTTY(c *check.C) { <ide> // just expected. <ide> c.Assert(result, icmd.Matches, icmd.Expected{Out: "out\r\nerr\r\n"}) <ide> } <add> <add>func (s *DockerSwarmSuite) TestServiceLogsNoHangDeletedContainer(c *check.C) { <add> d := s.AddDaemon(c, true, true) <add> <add> name := "TestServiceLogsNoHangDeletedContainer" <add> <add> result := icmd.RunCmd(d.Command( <add> // create a service <add> "service", "create", <add> // name it $name <add> "--name", name, <add> // busybox image, shell string <add> "busybox", "sh", "-c", <add> // echo to stdout and stderr <add> "while true; do echo line; sleep 2; done", <add> )) <add> <add> // confirm that the command succeeded <add> c.Assert(result, icmd.Matches, icmd.Expected{}) <add> // get the service id <add> id := strings.TrimSpace(result.Stdout()) <add> c.Assert(id, checker.Not(checker.Equals), "") <add> <add> // make sure task has been deployed. <add> waitAndAssert(c, defaultReconciliationTimeout, d.CheckActiveContainerCount, checker.Equals, 1) <add> // and make sure we have all the log lines <add> waitAndAssert(c, defaultReconciliationTimeout, countLogLines(d, name), checker.Equals, 2) <add> <add> // now find and nuke the container <add> result = icmd.RunCmd(d.Command("ps", "-q")) <add> containerID := strings.TrimSpace(result.Stdout()) <add> c.Assert(containerID, checker.Not(checker.Equals), "") <add> result = icmd.RunCmd(d.Command("stop", containerID)) <add> c.Assert(result, icmd.Matches, icmd.Expected{Out: containerID}) <add> result = icmd.RunCmd(d.Command("rm", containerID)) <add> c.Assert(result, icmd.Matches, icmd.Expected{Out: containerID}) <add> <add> // run logs. use tail 2 to make sure we don't try to get a bunch of logs <add> // somehow and slow down execution time <add> cmd := d.Command("service", "logs", "--tail", "2", id) <add> // start the command and then wait for it to finish with a 3 second timeout <add> result = icmd.StartCmd(cmd) <add> result = icmd.WaitOnCmd(3*time.Second, result) <add> <add> // then, assert that the result matches expected. if the command timed out, <add> // if the command is timed out, result.Timeout will be true, but the <add> // Expected defaults to false <add> c.Assert(result, icmd.Matches, icmd.Expected{}) <add>}
2
Mixed
Go
add filter for events emitted by docker daemon
62014aaf9abeb4256cb66e7ae06bfdf5a77d1140
<ide><path>daemon/daemon.go <ide> func (daemon *Daemon) Reload(config *Config) error { <ide> } else { <ide> attributes["labels"] = "[]" <ide> } <add> attributes["max-concurrent-downloads"] = fmt.Sprintf("%d", *daemon.configStore.MaxConcurrentDownloads) <add> attributes["max-concurrent-uploads"] = fmt.Sprintf("%d", *daemon.configStore.MaxConcurrentUploads) <ide> daemon.LogDaemonEventWithAttributes("reload", attributes) <ide> <ide> return nil <ide><path>daemon/events.go <ide> func (daemon *Daemon) LogNetworkEventWithAttributes(nw libnetwork.Network, actio <ide> // LogDaemonEventWithAttributes generates an event related to the daemon itself with specific given attributes. <ide> func (daemon *Daemon) LogDaemonEventWithAttributes(action string, attributes map[string]string) { <ide> if daemon.EventsService != nil { <add> if info, err := daemon.SystemInfo(); err == nil && info.Name != "" { <add> attributes["name"] = info.Name <add> } <ide> actor := events.Actor{ <ide> ID: daemon.ID, <ide> Attributes: attributes, <ide><path>daemon/events/filter.go <ide> func NewFilter(filter filters.Args) *Filter { <ide> func (ef *Filter) Include(ev events.Message) bool { <ide> return ef.filter.ExactMatch("event", ev.Action) && <ide> ef.filter.ExactMatch("type", ev.Type) && <add> ef.matchDaemon(ev) && <ide> ef.matchContainer(ev) && <ide> ef.matchVolume(ev) && <ide> ef.matchNetwork(ev) && <ide> func (ef *Filter) matchLabels(attributes map[string]string) bool { <ide> return ef.filter.MatchKVList("label", attributes) <ide> } <ide> <add>func (ef *Filter) matchDaemon(ev events.Message) bool { <add> return ef.fuzzyMatchName(ev, events.DaemonEventType) <add>} <add> <ide> func (ef *Filter) matchContainer(ev events.Message) bool { <ide> return ef.fuzzyMatchName(ev, events.ContainerEventType) <ide> } <ide><path>docs/reference/api/docker_remote_api.md <ide> This section lists each version from latest to oldest. Each listing includes a <ide> * `POST /containers/create` now returns a HTTP 400 "bad parameter" message <ide> if no command is specified (instead of a HTTP 500 "server error") <ide> * `GET /images/search` now takes a `filters` query parameter. <del>* `GET /events` now supports daemon events of `reload`. <add>* `GET /events` now supports a `reload` event that is emitted when the daemon configuration is reloaded. <add>* `GET /events` now supports filtering by daemon name or ID. <ide> <ide> ### v1.23 API changes <ide> <ide><path>docs/reference/api/docker_remote_api_v1.24.md <ide> Query Parameters: <ide> - `event=<string>`; -- event to filter <ide> - `image=<string>`; -- image to filter <ide> - `label=<string>`; -- image and container label to filter <del> - `type=<string>`; -- either `container` or `image` or `volume` or `network` <add> - `type=<string>`; -- either `container` or `image` or `volume` or `network` or `daemon` <ide> - `volume=<string>`; -- volume to filter <ide> - `network=<string>`; -- network to filter <add> - `daemon=<string>`; -- daemon name or id to filter <ide> <ide> Status Codes: <ide> <ide><path>docs/reference/commandline/events.md <ide> The currently supported filters are: <ide> * event (`event=<event action>`) <ide> * image (`image=<tag or id>`) <ide> * label (`label=<key>` or `label=<key>=<value>`) <del>* type (`type=<container or image or volume or network>`) <add>* type (`type=<container or image or volume or network or daemon>`) <ide> * volume (`volume=<name or id>`) <ide> * network (`network=<name or id>`) <add>* daemon (`daemon=<name or id>`) <ide> <ide> ## Examples <ide> <ide><path>integration-cli/docker_cli_events_unix_test.go <ide> func (s *DockerDaemonSuite) TestDaemonEvents(c *check.C) { <ide> out, err := s.d.Cmd("info") <ide> c.Assert(err, checker.IsNil) <ide> daemonID := "" <add> daemonName := "" <ide> for _, line := range strings.Split(out, "\n") { <ide> if strings.HasPrefix(line, "ID: ") { <ide> daemonID = strings.TrimPrefix(line, "ID: ") <del> break <add> } else if strings.HasPrefix(line, "Name: ") { <add> daemonName = strings.TrimPrefix(line, "Name: ") <ide> } <ide> } <ide> c.Assert(daemonID, checker.Not(checker.Equals), "") <ide> <ide> configFile, err = os.Create(configFilePath) <ide> c.Assert(err, checker.IsNil) <del> daemonConfig = `{"labels":["bar=foo"]}` <add> daemonConfig = `{"max-concurrent-downloads":1,"labels":["bar=foo"]}` <ide> fmt.Fprintf(configFile, "%s", daemonConfig) <ide> configFile.Close() <ide> <ide> func (s *DockerDaemonSuite) TestDaemonEvents(c *check.C) { <ide> <ide> out, err = s.d.Cmd("events", "--since=0", "--until", daemonUnixTime(c)) <ide> c.Assert(err, checker.IsNil) <del> c.Assert(out, checker.Contains, fmt.Sprintf("daemon reload %s (cluster-advertise=, cluster-store=, cluster-store-opts={}, debug=true, labels=[\"bar=foo\"])", daemonID)) <add> c.Assert(out, checker.Contains, fmt.Sprintf("daemon reload %s (cluster-advertise=, cluster-store=, cluster-store-opts={}, debug=true, labels=[\"bar=foo\"], max-concurrent-downloads=1, max-concurrent-uploads=5, name=%s)", daemonID, daemonName)) <add>} <add> <add>func (s *DockerDaemonSuite) TestDaemonEventsWithFilters(c *check.C) { <add> testRequires(c, SameHostDaemon, DaemonIsLinux) <add> <add> // daemon config file <add> configFilePath := "test.json" <add> configFile, err := os.Create(configFilePath) <add> c.Assert(err, checker.IsNil) <add> defer os.Remove(configFilePath) <add> <add> daemonConfig := `{"labels":["foo=bar"]}` <add> fmt.Fprintf(configFile, "%s", daemonConfig) <add> configFile.Close() <add> c.Assert(s.d.Start(fmt.Sprintf("--config-file=%s", configFilePath)), check.IsNil) <add> <add> // Get daemon ID <add> out, err := s.d.Cmd("info") <add> c.Assert(err, checker.IsNil) <add> daemonID := "" <add> daemonName := "" <add> for _, line := range strings.Split(out, "\n") { <add> if strings.HasPrefix(line, "ID: ") { <add> daemonID = strings.TrimPrefix(line, "ID: ") <add> } else if strings.HasPrefix(line, "Name: ") { <add> daemonName = strings.TrimPrefix(line, "Name: ") <add> } <add> } <add> c.Assert(daemonID, checker.Not(checker.Equals), "") <add> <add> syscall.Kill(s.d.cmd.Process.Pid, syscall.SIGHUP) <add> <add> time.Sleep(3 * time.Second) <add> <add> out, err = s.d.Cmd("events", "--since=0", "--until", daemonUnixTime(c), "--filter", fmt.Sprintf("daemon=%s", daemonID)) <add> c.Assert(err, checker.IsNil) <add> c.Assert(out, checker.Contains, fmt.Sprintf("daemon reload %s", daemonID)) <add> <add> out, err = s.d.Cmd("events", "--since=0", "--until", daemonUnixTime(c), "--filter", fmt.Sprintf("daemon=%s", daemonName)) <add> c.Assert(err, checker.IsNil) <add> c.Assert(out, checker.Contains, fmt.Sprintf("daemon reload %s", daemonID)) <add> <add> out, err = s.d.Cmd("events", "--since=0", "--until", daemonUnixTime(c), "--filter", "daemon=foo") <add> c.Assert(err, checker.IsNil) <add> c.Assert(out, checker.Not(checker.Contains), fmt.Sprintf("daemon reload %s", daemonID)) <add> <add> out, err = s.d.Cmd("events", "--since=0", "--until", daemonUnixTime(c), "--filter", "type=daemon") <add> c.Assert(err, checker.IsNil) <add> c.Assert(out, checker.Contains, fmt.Sprintf("daemon reload %s", daemonID)) <add> <add> out, err = s.d.Cmd("events", "--since=0", "--until", daemonUnixTime(c), "--filter", "type=container") <add> c.Assert(err, checker.IsNil) <add> c.Assert(out, checker.Not(checker.Contains), fmt.Sprintf("daemon reload %s", daemonID)) <ide> }
7
Javascript
Javascript
move common boot concerns to engineinstance
e087ae693f690e9476156ce68ec09610edcb10b7
<ide><path>packages/ember-application/lib/system/application-instance.js <ide> const ApplicationInstance = EngineInstance.extend({ <ide> // appended to the rootElement, in the case of apps, to the fixture harness <ide> // in tests, or rendered to a string in the case of FastBoot. <ide> this.register('-application-instance:main', this, { instantiate: false }); <del> <del> this._booted = false; <ide> }, <ide> <ide> /** <del> Initialize the `Ember.ApplicationInstance` and return a promise that resolves <del> with the instance itself when the boot process is complete. <add> Overrides the base `EngineInstance._bootSync` method with concerns relevant <add> to booting application (instead of engine) instances. <ide> <del> The primary task here is to run any registered instance initializers. <add> This method should only contain synchronous boot concerns. Asynchronous <add> boot concerns should eventually be moved to the `boot` method, which <add> returns a promise. <ide> <del> See the documentation on `BootOptions` for the options it takes. <del> <del> @private <del> @method boot <del> @param options <del> @return {Promise<Ember.ApplicationInstance,Error>} <del> */ <del> boot(options = {}) { <del> if (this._bootPromise) { return this._bootPromise; } <del> <del> this._bootPromise = new RSVP.Promise(resolve => resolve(this._bootSync(options))); <del> <del> return this._bootPromise; <del> }, <del> <del> /** <del> Unfortunately, a lot of existing code assumes booting an instance is <del> synchronous – specifically, a lot of tests assumes the last call to <del> `app.advanceReadiness()` or `app.reset()` will result in a new instance <del> being fully-booted when the current runloop completes. <del> <del> We would like new code (like the `visit` API) to stop making this assumption, <del> so we created the asynchronous version above that returns a promise. But until <del> we have migrated all the code, we would have to expose this method for use <del> *internally* in places where we need to boot an instance synchronously. <add> Until all boot code has been made asynchronous, we need to continue to <add> expose this method for use *internally* in places where we need to boot an <add> instance synchronously. <ide> <ide> @private <ide> */ <ide> const ApplicationInstance = EngineInstance.extend({ <ide> <ide> options = new BootOptions(options); <ide> <del> let registry = this.__registry__; <del> <del> registry.register('-environment:main', options.toEnvironment(), { instantiate: false }); <del> registry.injection('view', '_environment', '-environment:main'); <del> registry.injection('route', '_environment', '-environment:main'); <del> <del> registry.register('service:-document', options.document, { instantiate: false }); <del> <del> if (options.isInteractive) { <del> registry.injection('view', 'renderer', 'renderer:-dom'); <del> registry.injection('component', 'renderer', 'renderer:-dom'); <del> } else { <del> registry.injection('view', 'renderer', 'renderer:-inert'); <del> registry.injection('component', 'renderer', 'renderer:-inert'); <del> } <add> this.setupRegistry(options); <ide> <ide> if (options.rootElement) { <ide> this.rootElement = options.rootElement; <ide> const ApplicationInstance = EngineInstance.extend({ <ide> return this; <ide> }, <ide> <add> setupRegistry(options) { <add> let registry = this.__registry__; <add> <add> registry.register('-environment:main', options.toEnvironment(), { instantiate: false }); <add> registry.injection('view', '_environment', '-environment:main'); <add> registry.injection('route', '_environment', '-environment:main'); <add> <add> registry.register('service:-document', options.document, { instantiate: false }); <add> <add> if (options.isInteractive) { <add> registry.injection('view', 'renderer', 'renderer:-dom'); <add> registry.injection('component', 'renderer', 'renderer:-dom'); <add> } else { <add> registry.injection('view', 'renderer', 'renderer:-inert'); <add> registry.injection('component', 'renderer', 'renderer:-inert'); <add> } <add> }, <add> <ide> router: computed(function() { <ide> return this.lookup('router:main'); <ide> }).readOnly(), <ide><path>packages/ember-application/lib/system/engine-instance.js <ide> import Registry from 'container/registry'; <ide> import ContainerProxy from 'ember-runtime/mixins/container_proxy'; <ide> import RegistryProxy from 'ember-runtime/mixins/registry_proxy'; <ide> import run from 'ember-metal/run_loop'; <add>import RSVP from 'ember-runtime/ext/rsvp'; <ide> <ide> /** <ide> The `EngineInstance` encapsulates all of the stateful aspects of a <ide> const EngineInstance = EmberObject.extend(RegistryProxy, ContainerProxy, { <ide> <ide> // Create a per-instance container from the instance's registry <ide> this.__container__ = registry.container({ owner: this }); <add> <add> this._booted = false; <add> }, <add> <add> /** <add> Initialize the `Ember.EngineInstance` and return a promise that resolves <add> with the instance itself when the boot process is complete. <add> <add> The primary task here is to run any registered instance initializers. <add> <add> See the documentation on `BootOptions` for the options it takes. <add> <add> @private <add> @method boot <add> @param options {Object} <add> @return {Promise<Ember.EngineInstance,Error>} <add> */ <add> boot(options = {}) { <add> if (this._bootPromise) { return this._bootPromise; } <add> <add> this._bootPromise = new RSVP.Promise(resolve => resolve(this._bootSync(options))); <add> <add> return this._bootPromise; <add> }, <add> <add> /** <add> Unfortunately, a lot of existing code assumes booting an instance is <add> synchronous – specifically, a lot of tests assume the last call to <add> `app.advanceReadiness()` or `app.reset()` will result in a new instance <add> being fully-booted when the current runloop completes. <add> <add> We would like new code (like the `visit` API) to stop making this <add> assumption, so we created the asynchronous version above that returns a <add> promise. But until we have migrated all the code, we would have to expose <add> this method for use *internally* in places where we need to boot an instance <add> synchronously. <add> <add> @private <add> */ <add> _bootSync(options) { <add> if (this._booted) { return this; } <add> <add> this.base.runInstanceInitializers(this); <add> <add> this._booted = true; <add> <add> return this; <ide> }, <ide> <ide> /**
2
Go
Go
add cap_kill to unprivileged containers
fa72eb3a58ebfec8ef1b27d8e7aa8cbdb41733a2
<ide><path>daemon/execdriver/native/template/default_template.go <ide> func New() *libcontainer.Container { <ide> "SETPCAP", <ide> "NET_BIND_SERVICE", <ide> "SYS_CHROOT", <add> "KILL", <ide> }, <ide> Namespaces: map[string]bool{ <ide> "NEWNS": true,
1
Text
Text
fix invalid link to list of free programming books
ac3d90968fcc8e23f572a0b6871e2969d08bfcaf
<ide><path>guides/source/getting_started.md <ide> curve diving straight into Rails. There are several curated lists of online reso <ide> for learning Ruby: <ide> <ide> * [Official Ruby Programming Language website](https://www.ruby-lang.org/en/documentation/) <del>* [List of Free Programming Books](https://github.com/EbookFoundation/free-programming-books/blob/master/books/free-programming-books.md#ruby) <add>* [List of Free Programming Books](https://github.com/EbookFoundation/free-programming-books/blob/master/books/free-programming-books-langs.md#ruby) <ide> <ide> Be aware that some resources, while still excellent, cover older versions of <ide> Ruby, and may not include some syntax that you will see in day-to-day
1
Ruby
Ruby
add hint to actionview's fields_for
c6cb78349a25b9326d5f39556a338627dfbc6716
<ide><path>actionview/lib/action_view/helpers/form_helper.rb <ide> def form_with(model: nil, scope: nil, url: nil, format: nil, **options, &block) <ide> # <% end %> <ide> # <ide> # Note that fields_for will automatically generate a hidden field <del> # to store the ID of the record. There are circumstances where this <del> # hidden field is not needed and you can pass <tt>include_id: false</tt> <del> # to prevent fields_for from rendering it automatically. <add> # to store the ID of the record if it responds to <tt>persisted?</tt>. <add> # There are circumstances where this hidden field is not needed and you <add> # can pass <tt>include_id: false</tt> to prevent fields_for from <add> # rendering it automatically. <ide> def fields_for(record_name, record_object = nil, options = {}, &block) <ide> options = { model: record_object, allow_method_names_outside_object: false, skip_default_ids: false }.merge!(options) <ide>
1
Javascript
Javascript
fix mistake in example
1296e7a72e3ff984dccf23e8de527daf7b3633f1
<ide><path>src/ng/directive/attrs.js <ide> * <ide> * The buggy way to write it: <ide> * ```html <del> * <img src="http://www.gravatar.com/avatar/{{hash}} 2x"/> <add> * <img srcset="http://www.gravatar.com/avatar/{{hash}} 2x"/> <ide> * ``` <ide> * <ide> * The correct way to write it:
1