content_type
stringclasses
8 values
main_lang
stringclasses
7 values
message
stringlengths
1
50
sha
stringlengths
40
40
patch
stringlengths
52
962k
file_count
int64
1
300
Javascript
Javascript
fix unintentional deprecation warning
2243d79f74a0b9b4c2711fcf6ab47a747e737812
<ide><path>lib/internal/async_hooks.js <ide> function useDomainTrampoline(fn) { <ide> } <ide> <ide> function callbackTrampoline(asyncId, cb, ...args) { <del> if (asyncId && hasHooks(kBefore)) <add> if (asyncId !== 0 && hasHooks(kBefore)) <ide> emitBeforeNative(asyncId); <ide> <ide> let result; <del> if (typeof domain_cb === 'function') { <add> if (asyncId === 0 && typeof domain_cb === 'function') { <ide> ArrayPrototypeUnshift(args, cb); <ide> result = ReflectApply(domain_cb, this, args); <ide> } else { <ide> result = ReflectApply(cb, this, args); <ide> } <ide> <del> if (asyncId && hasHooks(kAfter)) <add> if (asyncId !== 0 && hasHooks(kAfter)) <ide> emitAfterNative(asyncId); <ide> <ide> return result; <ide><path>test/parallel/test-domain-http-server.js <ide> // USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> <ide> 'use strict'; <del>require('../common'); <add>const common = require('../common'); <ide> const domain = require('domain'); <ide> const http = require('http'); <ide> const assert = require('assert'); <ide> const debug = require('util').debuglog('test'); <ide> <add>process.on('warning', common.mustNotCall()); <add> <ide> const objects = { foo: 'bar', baz: {}, num: 42, arr: [1, 2, 3] }; <ide> objects.baz.asdf = objects; <ide> <ide><path>test/parallel/test-domain-implicit-binding.js <ide> const domain = require('domain'); <ide> const fs = require('fs'); <ide> const isEnumerable = Function.call.bind(Object.prototype.propertyIsEnumerable); <ide> <add>process.on('warning', common.mustNotCall()); <add> <ide> { <ide> const d = new domain.Domain(); <ide> <ide><path>test/parallel/test-domain-implicit-fs.js <ide> const common = require('../common'); <ide> const assert = require('assert'); <ide> const domain = require('domain'); <ide> <add>process.on('warning', common.mustNotCall()); <add> <ide> const d = new domain.Domain(); <ide> <ide> d.on('error', common.mustCall(function(er) { <ide><path>test/parallel/test-domain-multi.js <ide> const common = require('../common'); <ide> const domain = require('domain'); <ide> const http = require('http'); <ide> <add>process.on('warning', common.mustNotCall()); <add> <ide> const a = domain.create(); <ide> a.enter(); // This will be our "root" domain <ide> <ide><path>test/parallel/test-domain-promise.js <ide> const domain = require('domain'); <ide> const fs = require('fs'); <ide> const vm = require('vm'); <ide> <add>process.on('warning', common.mustNotCall()); <add> <ide> { <ide> const d = domain.create(); <ide>
6
Text
Text
use short links
e63a2ee8de12f0f938f6a95cdb9763dbe0187b4a
<ide><path>docs/Acceptable-Formulae.md <ide> <ide> Some formulae should not go in <ide> [homebrew/core](https://github.com/Homebrew/homebrew-core). But there are <del>additional [Interesting Taps and Forks](Interesting-Taps-and-Forks.md) and anyone can start their <add>additional [Interesting Taps and Forks](Interesting-Taps-and-Forks) and anyone can start their <ide> own! <ide> <ide> ### Dupes in `homebrew/core` <ide> We now accept stuff that comes with macOS as long as it uses `keg_only :provided_by_macos` to be keg-only by default. <ide> <ide> ### Versioned formulae in `homebrew/core` <del>We now accept versioned formulae as long as they [meet the requirements](Versions.md). <add>We now accept versioned formulae as long as they [meet the requirements](Versions). <ide> <ide> ### We don’t like tools that upgrade themselves <ide> Software that can upgrade itself does not integrate well with Homebrew's own <ide> the upstream project. Tarballs are preferred to Git checkouts, and <ide> tarballs should include the version in the filename whenever possible. <ide> <ide> We don’t accept software without a tagged version because they regularly break <del>due to upstream changes and we can’t provide [bottles](Bottles.md) for them. <add>due to upstream changes and we can’t provide [bottles](Bottles) for them. <ide> <ide> ### Bindings <ide> First check that there is not already a binding available via <ide> get maintained and partly because we have to draw the line somewhere. <ide> We frown on authors submitting their own work unless it is very popular. <ide> <ide> Don’t forget Homebrew is all Git underneath! <del>[Maintain your own tap](How-to-Create-and-Maintain-a-Tap.md) if you have to! <add>[Maintain your own tap](How-to-Create-and-Maintain-a-Tap) if you have to! <ide> <ide> There may be exceptions to these rules in the main repository; we may <ide> include things that don't meet these criteria or reject things that do. <ide><path>docs/Bottles.md <ide> If a bottle is available and usable it will be downloaded and poured automatical <ide> Bottles will not be used if the user requests it (see above), if the formula requests it (with `pour_bottle?`), if any options are specified during installation (bottles are all compiled with default options), if the bottle is not up to date (e.g. lacking a checksum) or if the bottle's `cellar` is not `:any` nor equal to the current `HOMEBREW_CELLAR`. <ide> <ide> ## Creation <del>Bottles are created using the [Brew Test Bot](Brew-Test-Bot.md). This happens mostly when people submit pull requests to Homebrew and the `bottle do` block is updated by maintainers when they `brew pull --bottle` the contents of a pull request. For the Homebrew organisations' taps they are uploaded to and downloaded from [Bintray](https://bintray.com/homebrew). <add>Bottles are created using the [Brew Test Bot](Brew-Test-Bot). This happens mostly when people submit pull requests to Homebrew and the `bottle do` block is updated by maintainers when they `brew pull --bottle` the contents of a pull request. For the Homebrew organisations' taps they are uploaded to and downloaded from [Bintray](https://bintray.com/homebrew). <ide> <ide> By default, bottles will be built for the oldest CPU supported by the OS/architecture you're building for. (That's Core 2 for 64-bit OSs, Core for 32-bit.) This ensures that bottles are compatible with all computers you might distribute them to. If you *really* want your bottles to be optimized for something else, you can pass the `--bottle-arch=` option to build for another architecture - for example, `brew install foo --bottle-arch=penryn`. Just remember that if you build for a newer architecture some of your users might get binaries they can't run and that would be sad! <ide> <ide><path>docs/Brew-Test-Bot-For-Core-Contributors.md <ide> If a build has run and passed on `brew test-bot` then it can be used to quickly <ide> There are two types of Jenkins jobs you will interact with: <ide> <ide> ## [Homebrew Core Pull Requests](https://jenkins.brew.sh/job/Homebrew%20Core/) <del>This job automatically builds any pull requests submitted to Homebrew/homebrew-core. On success or failure it updates the pull request status (see more details on the [main Brew Test Bot documentation page](Brew-Test-Bot.md)). On a successful build it automatically uploads bottles. <add>This job automatically builds any pull requests submitted to Homebrew/homebrew-core. On success or failure it updates the pull request status (see more details on the [main Brew Test Bot documentation page](Brew-Test-Bot)). On a successful build it automatically uploads bottles. <ide> <ide> ## [Homebrew Testing](https://jenkins.brew.sh/job/Homebrew%20Testing/) <ide> This job is manually triggered to run [`brew test-bot`](https://github.com/Homebrew/homebrew-test-bot/blob/master/cmd/brew-test-bot.rb) with user-specified parameters. On a successful build it automatically uploads bottles. <ide><path>docs/Building-Against-Non-Homebrew-Dependencies.md <ide> As Homebrew became primarily a binary package manager, most users were fulfillin <ide> <ide> ## Today <ide> <del>If you wish to build against custom non-Homebrew dependencies that are provided by Homebrew (e.g. a non-Homebrew, non-macOS `ruby`) then you must [create and maintain your own tap](How-to-Create-and-Maintain-a-Tap.md) as these formulae will not be accepted in Homebrew/homebrew-core. Once you have done that you can specify `env :std` in the formula which will allow a e.g. `which ruby` to access your existing `PATH` variable and allow compilation to link against this Ruby. <add>If you wish to build against custom non-Homebrew dependencies that are provided by Homebrew (e.g. a non-Homebrew, non-macOS `ruby`) then you must [create and maintain your own tap](How-to-Create-and-Maintain-a-Tap) as these formulae will not be accepted in Homebrew/homebrew-core. Once you have done that you can specify `env :std` in the formula which will allow a e.g. `which ruby` to access your existing `PATH` variable and allow compilation to link against this Ruby. <ide><path>docs/Common-Issues.md <ide> To list all files that would be deleted: <ide> <ide> Don't follow the advice here but fix by using <ide> `Language::Python.setup_install_args` in the formula as described in <del>[Python for Formula Authors](Python-for-Formula-Authors.md). <add>[Python for Formula Authors](Python-for-Formula-Authors). <ide> <ide> ### Upgrading macOS <ide> <ide><path>docs/External-Commands.md <ide> Note they are largely untested, and as always, be careful about running untested <ide> <ide> ### brew-livecheck <ide> Check if there is a new upstream version of a formula. <del>See the [`README`](https://github.com/Homebrew/homebrew-livecheck/blob/master/README.md) for more info and usage. <add>See the [`README`](https://github.com/Homebrew/homebrew-livecheck/blob/master/README) for more info and usage. <ide> <ide> Install using: <ide> <ide><path>docs/FAQ.md <ide> the launchctl PATH for _all users_. For earlier versions of macOS, see <ide> [this page](https://developer.apple.com/legacy/library/qa/qa1067/_index.html). <ide> <ide> ## How do I contribute to Homebrew? <del>Read [CONTRIBUTING.md](https://github.com/Homebrew/brew/blob/master/CONTRIBUTING.md). <add>Read [CONTRIBUTING.md](https://github.com/Homebrew/brew/blob/master/CONTRIBUTING). <ide> <ide> ## Why do you compile everything? <ide> Homebrew provides pre-compiled versions for many formulae. These <del>pre-compiled versions are referred to as [bottles](Bottles.md) and are available <add>pre-compiled versions are referred to as [bottles](Bottles) and are available <ide> at <https://bintray.com/homebrew/bottles>. <ide> <ide> If available, bottled binaries will be used by default except under the <ide> creating a separate user account especially for use of Homebrew. <ide> <ide> ## Why isn’t a particular command documented? <ide> <del>If it’s not in `man brew`, it’s probably an external command. These are documented [here](External-Commands.md). <add>If it’s not in `man brew`, it’s probably an external command. These are documented [here](External-Commands). <ide> <ide> ## Why haven’t you pulled my pull request? <ide> If it’s been a while, bump it with a “bump” comment. Sometimes we miss requests and there are plenty of them. Maybe we were thinking on something. It will encourage consideration. In the meantime if you could rebase the pull request so that it can be cherry-picked more easily we will love you for a long time. <ide> install <formula>`. If you encounter any issues, run the command with the <ide> into a debugging shell. <ide> <ide> If you want your new formula to be part of `homebrew/core` or want <del>to learn more about writing formulae, then please read the [Formula Cookbook](Formula-Cookbook.md). <add>to learn more about writing formulae, then please read the [Formula Cookbook](Formula-Cookbook). <ide> <ide> ## Can I install my own stuff to `/usr/local`? <ide> Yes, `brew` is designed to not get in your way so you can use it how you <ide><path>docs/Formula-Cookbook.md <ide> Make sure you run `brew update` before you start. This turns your Homebrew insta <ide> <ide> Before submitting a new formula make sure your package: <ide> <del>* meets all our [Acceptable Formulae](Acceptable-Formulae.md) requirements <add>* meets all our [Acceptable Formulae](Acceptable-Formulae) requirements <ide> * isn't already in Homebrew (check `brew search <formula>`) <ide> * isn't in another official [Homebrew tap](https://github.com/Homebrew) <ide> * isn't already waiting to be merged (check the [issue tracker](https://github.com/Homebrew/homebrew-core/pulls)) <ide> * is still supported by upstream (i.e. doesn't require extensive patching) <ide> * has a stable, tagged version (i.e. not just a GitHub repository with no versions) <ide> * passes all `brew audit --new-formula <formula>` tests. <ide> <del>Before submitting a new formula make sure you read over our [contribution guidelines](https://github.com/Homebrew/brew/blob/master/CONTRIBUTING.md). <add>Before submitting a new formula make sure you read over our [contribution guidelines](https://github.com/Homebrew/brew/blob/master/CONTRIBUTING). <ide> <ide> ### Grab the URL <ide> <ide> Check the top of the e.g. `./configure` output. Some configure scripts do not re <ide> <ide> ### Add a test to the formula <ide> <del>Add a valid test to the [`test do`](http://www.rubydoc.info/github/Homebrew/brew/master/Formula&num;test-class_method) block of the formula. This will be run by `brew test foo` and the [Brew Test Bot](Brew-Test-Bot.md). <add>Add a valid test to the [`test do`](http://www.rubydoc.info/github/Homebrew/brew/master/Formula&num;test-class_method) block of the formula. This will be run by `brew test foo` and the [Brew Test Bot](Brew-Test-Bot). <ide> <ide> The <ide> [`test do`](http://www.rubydoc.info/github/Homebrew/brew/master/Formula#test-class_method) <ide> end <ide> <ide> ### Compiler selection <ide> <del>Sometimes a package fails to build when using a certain compiler. Since recent [Xcode versions](Xcode.md) no longer include a GCC compiler we cannot simply force the use of GCC. Instead, the correct way to declare this is the [`fails_with` DSL method](http://www.rubydoc.info/github/Homebrew/brew/master/Formula#fails_with-class_method). A properly constructed [`fails_with`](http://www.rubydoc.info/github/Homebrew/brew/master/Formula#fails_with-class_method) block documents the latest compiler build version known to cause compilation to fail, and the cause of the failure. For example: <add>Sometimes a package fails to build when using a certain compiler. Since recent [Xcode versions](Xcode) no longer include a GCC compiler we cannot simply force the use of GCC. Instead, the correct way to declare this is the [`fails_with` DSL method](http://www.rubydoc.info/github/Homebrew/brew/master/Formula#fails_with-class_method). A properly constructed [`fails_with`](http://www.rubydoc.info/github/Homebrew/brew/master/Formula#fails_with-class_method) block documents the latest compiler build version known to cause compilation to fail, and the cause of the failure. For example: <ide> <ide> ```ruby <ide> fails_with :clang do <ide><path>docs/Homebrew-and-Python.md <ide> # Python <ide> <del>This page describes how Python is handled in Homebrew for users. See [Python for Formula Authors](Python-for-Formula-Authors.md) for advice on writing formulae to install packages written in Python. <add>This page describes how Python is handled in Homebrew for users. See [Python for Formula Authors](Python-for-Formula-Authors) for advice on writing formulae to install packages written in Python. <ide> <ide> Homebrew should work with any [CPython](https://stackoverflow.com/questions/2324208/is-there-any-difference-between-cpython-and-python) and defaults to the macOS system Python. <ide> <ide> Some formulae provide Python bindings. Sometimes a `--with-python` or `--with-py <ide> <ide> Homebrew builds bindings against the first `python` (and `python-config`) in your `PATH`. (Check with `which python`). <ide> <del>**Warning!** Python may crash (see [Common Issues](Common-Issues.md)) if you `import <module>` from a brewed Python if you ran `brew install <formula_with_python_bindings>` against the system Python. If you decide to switch to the brewed Python, then reinstall all formulae with Python bindings (e.g. `pyside`, `wxwidgets`, `pygtk`, `pygobject`, `opencv`, `vtk` and `boost-python`). <add>**Warning!** Python may crash (see [Common Issues](Common-Issues)) if you `import <module>` from a brewed Python if you ran `brew install <formula_with_python_bindings>` against the system Python. If you decide to switch to the brewed Python, then reinstall all formulae with Python bindings (e.g. `pyside`, `wxwidgets`, `pygtk`, `pygobject`, `opencv`, `vtk` and `boost-python`). <ide> <ide> ## Policy for non-brewed Python bindings <ide> These should be installed via `pip install <package>`. To discover, you can use `pip search` or <https://pypi.python.org/pypi>. (**Note:** System Python does not provide `pip`. Follow the [pip documentation](https://pip.readthedocs.io/en/stable/installing/#install-pip) to install it for your system Python if you would like it.) <ide><path>docs/How-To-Open-a-Homebrew-Pull-Request.md <ide> To make a new branch and submit it for review, create a GitHub pull request with <ide> 1. Check out the `master` branch with `git checkout master`. <ide> 2. Retrieve new changes to the `master` branch with `brew update`. <ide> 3. Create a new branch from the latest `master` branch with `git checkout -b <YOUR_BRANCH_NAME> origin/master`. <del>4. Make your changes. For formulae, use `brew edit` or your favorite text editor, following all the guidelines in the [Formula Cookbook](Formula-Cookbook.md). <add>4. Make your changes. For formulae, use `brew edit` or your favorite text editor, following all the guidelines in the [Formula Cookbook](Formula-Cookbook). <ide> * If there's a `bottle do` block in the formula, don't remove or change it; we'll update it when we pull your PR. <ide> 5. Test your changes by doing the following, and ensure they all pass without issue. For changed formulae, make sure you do the `brew audit` step while your changed formula is installed. <ide> * `brew tests` <ide><path>docs/How-to-Create-and-Maintain-a-Tap.md <ide> If it’s on GitHub, users can install any of your formulae with <ide> file here. <ide> <ide> If they want to get your tap without installing any formula at the same time, <del>users can add it with the [`brew tap` command](Taps.md). <add>users can add it with the [`brew tap` command](Taps). <ide> <ide> If it’s on GitHub, they can use `brew tap user/repo`, where `user` is your <ide> GitHub username and `homebrew-repo` your repository. <ide> Once your tap is installed, Homebrew will update it each time a user runs <ide> <ide> ## External commands <ide> You can provide your tap users with custom `brew` commands by adding them in a <del>`cmd` subdirectory. [Read more on external commands](External-Commands.md). <add>`cmd` subdirectory. [Read more on external commands](External-Commands). <ide> <ide> See [homebrew/aliases](https://github.com/Homebrew/homebrew-aliases) for an <ide> example of a tap with external commands. <ide><path>docs/How-to-build-software-outside-Homebrew-with-Homebrew-keg-only-dependencies.md <ide> <ide> ## What does "keg-only" mean? <ide> <del>The [FAQ](FAQ.md) briefly explains this. <add>The [FAQ](FAQ) briefly explains this. <ide> <ide> As an example: <ide> <ide><path>docs/Installation.md <ide> The suggested and easiest way to install Homebrew is on the <ide> [homepage](https://brew.sh). <ide> <ide> The standard script installs Homebrew to `/usr/local` so that <del>[you don’t need sudo](FAQ.md) when you <add>[you don’t need sudo](FAQ) when you <ide> `brew install`. It is a careful script; it can be run even if you have stuff <ide> installed to `/usr/local` already. It tells you exactly what it will do before <ide> it does it too. And you have to confirm everything it will do before it starts. <ide> mkdir homebrew && curl -L https://github.com/Homebrew/brew/tarball/master | tar <ide> Create a Homebrew installation wherever you extract the tarball. Whichever `brew` command is called is where the packages will be installed. You can use this as you see fit, e.g. a system set of libs in `/usr/local` and tweaked formulae for development in `~/homebrew`. <ide> <ide> ## Uninstallation <del>Uninstallation is documented in the [FAQ](FAQ.md). <add>Uninstallation is documented in the [FAQ](FAQ). <ide> <ide> <a name="1"><sup>1</sup></a> Not all formulae have CPU or OS requirements, but <ide> you can assume you will have trouble if you don’t conform. Also, you can find <ide> PowerPC and Tiger branches from other users in the fork network. See <del>[Interesting Taps and Forks](Interesting-Taps-and-Forks.md). <add>[Interesting Taps and Forks](Interesting-Taps-and-Forks). <ide> <ide> <a name="2"><sup>2</sup></a> 10.10 or higher is recommended. 10.5–10.9 are <ide> supported on a best-effort basis. For 10.4 see <ide><path>docs/Maintainer-Guidelines.md <ide> access** to Homebrew’s repository and help merge the contributions of <ide> others. You may find what is written here interesting, but it’s <ide> definitely not a beginner’s guide. <ide> <del>Maybe you were looking for the [Formula Cookbook](Formula-Cookbook.md)? <add>Maybe you were looking for the [Formula Cookbook](Formula-Cookbook)? <ide> <ide> ## Quick checklist <ide> <ide> Add other names as aliases as symlinks in `Aliases` in the tap root. Ensure the <ide> name referenced on the homepage is one of these, as it may be different and have <ide> underscores and hyphens and so on. <ide> <del>We now accept versioned formulae as long as they [meet the requirements](Versions.md). <add>We now accept versioned formulae as long as they [meet the requirements](Versions). <ide> <ide> ### Merging, rebasing, cherry-picking <ide> Merging should be done in the `Homebrew/brew` repository to preserve history & GPG commit signing, <ide> the commits. Our main branch history should be useful to other people, <ide> not confusing. <ide> <ide> ### Testing <del>We need to at least check that it builds. Use the [Brew Test Bot](Brew-Test-Bot.md) for this. <add>We need to at least check that it builds. Use the [Brew Test Bot](Brew-Test-Bot) for this. <ide> <ide> Verify the formula works if possible. If you can’t tell (e.g. if it’s a <ide> library) trust the original contributor, it worked for them, so chances are it <ide><path>docs/New-Maintainer-Checklist.md <ide> If they accept, follow a few steps to get them set up: <ide> - Invite them to the [`homebrew` private maintainers 1Password](https://homebrew.1password.com/signin) <ide> - Invite them to [Google Analytics](https://analytics.google.com/analytics/web/?authuser=1#management/Settings/a76679469w115400090p120682403/%3Fm.page%3DAccountUsers/) <ide> <del>After a month-long trial period with no problems make them [owners on the Homebrew GitHub organisation](https://github.com/orgs/Homebrew/people) and add them to [Homebrew's README](https://github.com/Homebrew/brew/edit/master/README.md). If there are problems, ask them to step down as a maintainer and revoke their access to the above. <add>After a month-long trial period with no problems make them [owners on the Homebrew GitHub organisation](https://github.com/orgs/Homebrew/people) and add them to [Homebrew's README](https://github.com/Homebrew/brew/edit/master/README). If there are problems, ask them to step down as a maintainer and revoke their access to the above. <ide> <ide> Now sit back, relax and let the new maintainers handle more of our contributions. <ide><path>docs/Node-for-Formula-Authors.md <ide> In your formula's `install` method, do any installation steps which need to be d <ide> system "npm", "install", *Language::Node.local_npm_install_args <ide> ``` <ide> <del>This will install all of your Node modules dependencies to your local build path. You can now continue with your build steps and take care of the installation into the Homebrew `prefix` on your own, following the [general Homebrew formula instructions](Formula-Cookbook.md). <add>This will install all of your Node modules dependencies to your local build path. You can now continue with your build steps and take care of the installation into the Homebrew `prefix` on your own, following the [general Homebrew formula instructions](Formula-Cookbook). <ide> <ide> ## Example <ide> <ide><path>docs/README.md <ide> # Documentation <ide> <ide> ## Users <del>- [`brew` man-page (command documentation)](Manpage.md) <del>- [Troubleshooting](Troubleshooting.md) <del>- [Installation](Installation.md) <del>- [Frequently Asked Questions](FAQ.md) <del>- [Common Issues](Common-Issues.md) <add>- [`brew` man-page (command documentation)](Manpage) <add>- [Troubleshooting](Troubleshooting) <add>- [Installation](Installation) <add>- [Frequently Asked Questions](FAQ) <add>- [Common Issues](Common-Issues) <ide> <del>- [Tips and Tricks](Tips-N'-Tricks.md) <del>- [Bottles (binary packages)](Bottles.md) <del>- [Taps (third-party repositories)](Taps.md) <del>- [Interesting Taps and Forks](Interesting-Taps-and-Forks.md) <del>- [Anonymous Aggregate User Behaviour Analytics](Analytics.md) <add>- [Tips and Tricks](Tips-N'-Tricks) <add>- [Bottles (binary packages)](Bottles) <add>- [Taps (third-party repositories)](Taps) <add>- [Interesting Taps and Forks](Interesting-Taps-and-Forks) <add>- [Anonymous Aggregate User Behaviour Analytics](Analytics) <ide> <del>- [Querying `brew`](Querying-Brew.md) <del>- [C++ Standard Libraries](C++-Standard-Libraries.md) <del>- [MD5 and SHA-1 Deprecation](Checksum_Deprecation.md) <del>- [Custom GCC and Cross Compilers](Custom-GCC-and-cross-compilers.md) <del>- [External Commands](External-Commands.md) <del>- [Ruby Gems, Python Eggs and Perl Modules](Gems,-Eggs-and-Perl-Modules.md) <del>- [Python](Homebrew-and-Python.md) <del>- [How To Build Software Outside Homebrew With Homebrew `keg_only` dependencies](How-to-build-software-outside-Homebrew-with-Homebrew-keg-only-dependencies.md) <del>- [Xcode](Xcode.md) <del>- [Kickstarter Supporters](Kickstarter-Supporters.md) <add>- [Querying `brew`](Querying-Brew) <add>- [C++ Standard Libraries](C++-Standard-Libraries) <add>- [MD5 and SHA-1 Deprecation](Checksum_Deprecation) <add>- [Custom GCC and Cross Compilers](Custom-GCC-and-cross-compilers) <add>- [External Commands](External-Commands) <add>- [Ruby Gems, Python Eggs and Perl Modules](Gems,-Eggs-and-Perl-Modules) <add>- [Python](Homebrew-and-Python) <add>- [How To Build Software Outside Homebrew With Homebrew `keg_only` dependencies](How-to-build-software-outside-Homebrew-with-Homebrew-keg-only-dependencies) <add>- [Xcode](Xcode) <add>- [Kickstarter Supporters](Kickstarter-Supporters) <ide> <ide> ## Contributors <del>- [How To Open A Pull Request (and get it merged)](How-To-Open-a-Homebrew-Pull-Request.md) <del>- [Formula Cookbook](Formula-Cookbook.md) <del>- [Acceptable Formulae](Acceptable-Formulae.md) <del>- [Formulae Versions](Versions.md) <del>- [Node for Formula Authors](Node-for-Formula-Authors.md) <del>- [Python for Formula Authors](Python-for-Formula-Authors.md) <del>- [Migrating A Formula To A Tap](Migrating-A-Formula-To-A-Tap.md) <del>- [Rename A Formula](Rename-A-Formula.md) <del>- [Building Against Non-Homebrew Dependencies](Building-Against-Non-Homebrew-Dependencies.md) <del>- [How To Create (And Maintain) A Tap](How-to-Create-and-Maintain-a-Tap.md) <del>- [Brew Test Bot](Brew-Test-Bot.md) <del>- [Prose Style Guidelines](Prose-Style-Guidelines.md) <add>- [How To Open A Pull Request (and get it merged)](How-To-Open-a-Homebrew-Pull-Request) <add>- [Formula Cookbook](Formula-Cookbook) <add>- [Acceptable Formulae](Acceptable-Formulae) <add>- [Formulae Versions](Versions) <add>- [Node for Formula Authors](Node-for-Formula-Authors) <add>- [Python for Formula Authors](Python-for-Formula-Authors) <add>- [Migrating A Formula To A Tap](Migrating-A-Formula-To-A-Tap) <add>- [Rename A Formula](Rename-A-Formula) <add>- [Building Against Non-Homebrew Dependencies](Building-Against-Non-Homebrew-Dependencies) <add>- [How To Create (And Maintain) A Tap](How-to-Create-and-Maintain-a-Tap) <add>- [Brew Test Bot](Brew-Test-Bot) <add>- [Prose Style Guidelines](Prose-Style-Guidelines) <ide> <ide> ## Maintainers <del>- [New Maintainer Checklist](New-Maintainer-Checklist.md) <del>- [Maintainers: Avoiding Burnout](Maintainers-Avoiding-Burnout.md) <del>- [Maintainer Guidelines](Maintainer-Guidelines.md) <del>- [Brew Test Bot For Maintainers](Brew-Test-Bot-For-Core-Contributors.md) <del>- [Common Issues for Maintainers](Common-Issues-for-Core-Contributors.md) <add>- [New Maintainer Checklist](New-Maintainer-Checklist) <add>- [Maintainers: Avoiding Burnout](Maintainers-Avoiding-Burnout) <add>- [Maintainer Guidelines](Maintainer-Guidelines) <add>- [Brew Test Bot For Maintainers](Brew-Test-Bot-For-Core-Contributors) <add>- [Common Issues for Maintainers](Common-Issues-for-Core-Contributors) <ide><path>docs/Tips-N'-Tricks.md <ide> ## Installing previous versions of formulae <ide> <ide> The supported method of installing specific versions of <del>some formulae is to see if there is a versioned formula (e.g. `gcc@6`) available. If the version you’re looking for isn’t available, consider [opening a pull request](How-To-Open-a-Homebrew-Pull-Request.md)! <add>some formulae is to see if there is a versioned formula (e.g. `gcc@6`) available. If the version you’re looking for isn’t available, consider [opening a pull request](How-To-Open-a-Homebrew-Pull-Request)! <ide> <ide> ### Installing directly from pull requests <ide> You can [browse pull requests](https://github.com/Homebrew/homebrew-core/pulls) <ide><path>docs/Troubleshooting.md <ide> Follow these steps to fix common problems: <ide> * Run `brew doctor` and fix all the warnings (**outdated Xcode/CLT and unbrewed dylibs are very likely to cause problems**). <ide> * Check that **Command Line Tools for Xcode (CLT)** and **Xcode** are up to date. <ide> * If commands fail with permissions errors, check the permissions of `/usr/local`'s subdirectories. If you’re unsure what to do, you can run `cd /usr/local && sudo chown -R $(whoami) bin etc include lib sbin share var Frameworks`. <del>* Read through the [Common Issues](Common-Issues.md). <add>* Read through the [Common Issues](Common-Issues). <ide> <ide> ## Check to see if the issue has been reported <ide> <ide><path>docs/Versions.md <ide> Versioned formulae we include in [homebrew/core](https://github.com/homebrew/hom <ide> * Versioned formulae should be as similar as possible and sensible to the unversioned formulae. Creating or updating a versioned formula should be a chance to ask questions of the unversioned formula e.g. can some unused or useless options be removed or made default? <ide> * No more than five versions of a formula (including the non-versioned one) will be supported at any given time, regardless of usage. When removing formulae that violate this we will aim to do so based on usage and support status rather than age. <ide> <del>Homebrew's versions are not intended to be used for any old versions you personally require for your project. You should create your own [tap](How-to-Create-and-Maintain-a-Tap.md) for formulae you or your organisation wish to control the versioning of or those that do not meet the above standards. Software that has regular API or ABI breaking releases still needs to meet all the above requirements; that a `brew upgrade` has broken something for you is not an argument for us to add and maintain a formula for you. <add>Homebrew's versions are not intended to be used for any old versions you personally require for your project. You should create your own [tap](How-to-Create-and-Maintain-a-Tap) for formulae you or your organisation wish to control the versioning of or those that do not meet the above standards. Software that has regular API or ABI breaking releases still needs to meet all the above requirements; that a `brew upgrade` has broken something for you is not an argument for us to add and maintain a formula for you. <ide> <ide> We may temporarily add versioned formulae for our own needs that do not meet these standards in [homebrew/core](https://github.com/homebrew/homebrew-core). The presence of a versioned formula there does not imply it will be maintained indefinitely or that we are willing to accept any more versions that do not meet the requirements above.
20
Python
Python
update document for valueerror
b7f930f81bcc363eac8fc91d4bc390f2974e76f6
<ide><path>keras/models.py <ide> def compile(self, optimizer, loss, <ide> <ide> # Raises <ide> ValueError: In case of invalid arguments for <add> `optimizer`, `loss`, `metrics` or `sample_weight_mode`. <ide> <ide> # Example <ide> ```python
1
Javascript
Javascript
use serialization api instead of objectmiddleware
f05af4a4a718c7fa7f0709c6464ede2b49990bfe
<ide><path>lib/ContextModule.js <ide> const { <ide> keepOriginalOrder <ide> } = require("./util/comparators"); <ide> const { compareModulesById } = require("./util/comparators"); <del>const contextify = require("./util/identifier").contextify; <del>const makeUnserializable = require("./util/makeUnserializable"); <add>const { contextify } = require("./util/identifier"); <add>const { registerNotSerializable } = require("./util/serialization"); <ide> <ide> /** @typedef {import("webpack-sources").Source} Source */ <ide> /** @typedef {import("./ChunkGraph")} ChunkGraph */ <ide> webpackEmptyAsyncContext.id = ${JSON.stringify(id)};`; <ide> } <ide> } <ide> <del>makeUnserializable(ContextModule); <add>registerNotSerializable(ContextModule); <ide> <ide> module.exports = ContextModule; <ide><path>lib/util/makeSerializable.js <ide> <ide> "use strict"; <ide> <del>const ObjectMiddleware = require("../serialization/ObjectMiddleware"); <ide> const createHash = require("./createHash"); <add>const { register } = require("./serialization"); <ide> <ide> const getPrototypeChain = C => { <ide> const chain = []; <ide> class ClassSerializer { <ide> } <ide> <ide> module.exports = (Constructor, request, name = null) => { <del> ObjectMiddleware.register( <del> Constructor, <del> request, <del> name, <del> new ClassSerializer(Constructor) <del> ); <add> register(Constructor, request, name, new ClassSerializer(Constructor)); <ide> }; <ide><path>lib/util/makeUnserializable.js <del>/* <del> MIT License http://www.opensource.org/licenses/mit-license.php <del>*/ <del> <del>"use strict"; <del> <del>const ObjectMiddleware = require("../serialization/ObjectMiddleware"); <del> <del>module.exports = Constructor => { <del> ObjectMiddleware.registerNotSerializable(Constructor); <del>}; <ide><path>lib/util/registerExternalSerializer.js <ide> <ide> "use strict"; <ide> <del>const ObjectMiddleware = require("../serialization/ObjectMiddleware"); <add>const { register } = require("./serialization"); <ide> <ide> const Position = /** @type {TODO} */ (require("acorn")).Position; <ide> const SourceLocation = require("acorn").SourceLocation; <del>const CachedSource = require("webpack-sources").CachedSource; <del>const ConcatSource = require("webpack-sources").ConcatSource; <del>const OriginalSource = require("webpack-sources").OriginalSource; <del>const PrefixSource = require("webpack-sources").PrefixSource; <del>const RawSource = require("webpack-sources").RawSource; <del>const ReplaceSource = require("webpack-sources").ReplaceSource; <del>const SourceMapSource = require("webpack-sources").SourceMapSource; <add>const { <add> CachedSource, <add> ConcatSource, <add> OriginalSource, <add> PrefixSource, <add> RawSource, <add> ReplaceSource, <add> SourceMapSource <add>} = require("webpack-sources"); <ide> <ide> /** @typedef {import("../Dependency").RealDependencyLocation} RealDependencyLocation */ <ide> /** @typedef {import("../Dependency").SourcePosition} SourcePosition */ <add>/** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */ <add>/** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */ <ide> <ide> const CURRENT_MODULE = "webpack/lib/util/registerExternalSerializer"; <ide> <del>ObjectMiddleware.register( <add>register( <ide> CachedSource, <ide> CURRENT_MODULE, <ide> "webpack-sources/CachedSource", <ide> new class CachedSourceSerializer { <ide> /** <ide> * @param {CachedSource} source the cached source to be serialized <del> * @param {ObjectMiddleware.ObjectSerializerContext} context context <add> * @param {ObjectSerializerContext} context context <ide> * @returns {void} <ide> */ <ide> serialize(source, { write }) { <ide> ObjectMiddleware.register( <ide> } <ide> <ide> /** <del> * @param {ObjectMiddleware.ObjectDeserializerContext} context context <add> * @param {ObjectDeserializerContext} context context <ide> * @returns {CachedSource} cached source <ide> */ <ide> deserialize({ read }) { <ide> ObjectMiddleware.register( <ide> }() <ide> ); <ide> <del>ObjectMiddleware.register( <add>register( <ide> RawSource, <ide> CURRENT_MODULE, <ide> "webpack-sources/RawSource", <ide> new class RawSourceSerializer { <ide> /** <ide> * @param {RawSource} source the raw source to be serialized <del> * @param {ObjectMiddleware.ObjectSerializerContext} context context <add> * @param {ObjectSerializerContext} context context <ide> * @returns {void} <ide> */ <ide> serialize(source, { write }) { <ide> ObjectMiddleware.register( <ide> } <ide> <ide> /** <del> * @param {ObjectMiddleware.ObjectDeserializerContext} context context <add> * @param {ObjectDeserializerContext} context context <ide> * @returns {RawSource} raw source <ide> */ <ide> deserialize({ read }) { <ide> ObjectMiddleware.register( <ide> }() <ide> ); <ide> <del>ObjectMiddleware.register( <add>register( <ide> ConcatSource, <ide> CURRENT_MODULE, <ide> "webpack-sources/ConcatSource", <ide> new class ConcatSourceSerializer { <ide> /** <ide> * @param {ConcatSource} source the concat source to be serialized <del> * @param {ObjectMiddleware.ObjectSerializerContext} context context <add> * @param {ObjectSerializerContext} context context <ide> * @returns {void} <ide> */ <ide> serialize(source, { write }) { <ide> write(source.children); <ide> } <ide> <ide> /** <del> * @param {ObjectMiddleware.ObjectDeserializerContext} context context <add> * @param {ObjectDeserializerContext} context context <ide> * @returns {ConcatSource} concat source <ide> */ <ide> deserialize({ read }) { <ide> ObjectMiddleware.register( <ide> }() <ide> ); <ide> <del>ObjectMiddleware.register( <add>register( <ide> PrefixSource, <ide> CURRENT_MODULE, <ide> "webpack-sources/PrefixSource", <ide> new class PrefixSourceSerializer { <ide> /** <ide> * @param {PrefixSource} source the prefix source to be serialized <del> * @param {ObjectMiddleware.ObjectSerializerContext} context context <add> * @param {ObjectSerializerContext} context context <ide> * @returns {void} <ide> */ <ide> serialize(source, { write }) { <ide> ObjectMiddleware.register( <ide> } <ide> <ide> /** <del> * @param {ObjectMiddleware.ObjectDeserializerContext} context context <add> * @param {ObjectDeserializerContext} context context <ide> * @returns {PrefixSource} prefix source <ide> */ <ide> deserialize({ read }) { <ide> ObjectMiddleware.register( <ide> }() <ide> ); <ide> <del>ObjectMiddleware.register( <add>register( <ide> ReplaceSource, <ide> CURRENT_MODULE, <ide> "webpack-sources/ReplaceSource", <ide> new class ReplaceSourceSerializer { <ide> /** <ide> * @param {ReplaceSource} source the replace source to be serialized <del> * @param {ObjectMiddleware.ObjectSerializerContext} context context <add> * @param {ObjectSerializerContext} context context <ide> * @returns {void} <ide> */ <ide> serialize(source, { write }) { <ide> ObjectMiddleware.register( <ide> } <ide> <ide> /** <del> * @param {ObjectMiddleware.ObjectDeserializerContext} context context <add> * @param {ObjectDeserializerContext} context context <ide> * @returns {ReplaceSource} replace source <ide> */ <ide> deserialize({ read }) { <ide> ObjectMiddleware.register( <ide> }() <ide> ); <ide> <del>ObjectMiddleware.register( <add>register( <ide> OriginalSource, <ide> CURRENT_MODULE, <ide> "webpack-sources/OriginalSource", <ide> new class OriginalSourceSerializer { <ide> /** <ide> * @param {OriginalSource} source the original source to be serialized <del> * @param {ObjectMiddleware.ObjectSerializerContext} context context <add> * @param {ObjectSerializerContext} context context <ide> * @returns {void} <ide> */ <ide> serialize(source, { write }) { <ide> ObjectMiddleware.register( <ide> } <ide> <ide> /** <del> * @param {ObjectMiddleware.ObjectDeserializerContext} context context <add> * @param {ObjectDeserializerContext} context context <ide> * @returns {OriginalSource} original source <ide> */ <ide> deserialize({ read }) { <ide> ObjectMiddleware.register( <ide> }() <ide> ); <ide> <del>ObjectMiddleware.register( <add>register( <ide> SourceLocation, <ide> CURRENT_MODULE, <ide> "acorn/SourceLocation", <ide> new class SourceLocationSerializer { <ide> /** <ide> * @param {SourceLocation} loc the location to be serialized <del> * @param {ObjectMiddleware.ObjectSerializerContext} context context <add> * @param {ObjectSerializerContext} context context <ide> * @returns {void} <ide> */ <ide> serialize(loc, { write }) { <ide> ObjectMiddleware.register( <ide> } <ide> <ide> /** <del> * @param {ObjectMiddleware.ObjectDeserializerContext} context context <add> * @param {ObjectDeserializerContext} context context <ide> * @returns {RealDependencyLocation} location <ide> */ <ide> deserialize({ read }) { <ide> ObjectMiddleware.register( <ide> }() <ide> ); <ide> <del>ObjectMiddleware.register( <add>register( <ide> Position, <ide> CURRENT_MODULE, <ide> "acorn/Position", <ide> new class PositionSerializer { <ide> /** <ide> * @param {Position} pos the position to be serialized <del> * @param {ObjectMiddleware.ObjectSerializerContext} context context <add> * @param {ObjectSerializerContext} context context <ide> * @returns {void} <ide> */ <ide> serialize(pos, { write }) { <ide> ObjectMiddleware.register( <ide> } <ide> <ide> /** <del> * @param {ObjectMiddleware.ObjectDeserializerContext} context context <add> * @param {ObjectDeserializerContext} context context <ide> * @returns {SourcePosition} position <ide> */ <ide> deserialize({ read }) { <ide> ObjectMiddleware.register( <ide> }() <ide> ); <ide> <del>ObjectMiddleware.register( <add>register( <ide> SourceMapSource, <ide> CURRENT_MODULE, <ide> "webpack-sources/SourceMapSource", <ide> new class SourceMapSourceSerializer { <ide> /** <ide> * @param {SourceMapSource} source the source map source to be serialized <del> * @param {ObjectMiddleware.ObjectSerializerContext} context context <add> * @param {ObjectSerializerContext} context context <ide> * @returns {void} <ide> */ <ide> serialize(source, { write }) { <ide> ObjectMiddleware.register( <ide> } <ide> <ide> /** <del> * @param {ObjectMiddleware.ObjectDeserializerContext} context context <add> * @param {ObjectDeserializerContext} context context <ide> * @returns {SourceMapSource} source source map source <ide> */ <ide> deserialize({ read }) { <ide><path>lib/util/serialization.js <ide> <ide> "use strict"; <ide> <add>const BinaryMiddleware = require("../serialization/BinaryMiddleware"); <add>const FileMiddleware = require("../serialization/FileMiddleware"); <ide> const ObjectMiddleware = require("../serialization/ObjectMiddleware"); <add>const Serializer = require("../serialization/Serializer"); <ide> <del>exports.serializer = require("./serializer"); <add>const { register, registerLoader, registerNotSerializable } = ObjectMiddleware; <ide> <del>exports.register = ObjectMiddleware.register; <del>exports.registerLoader = ObjectMiddleware.registerLoader; <del>exports.registerNotSerializable = ObjectMiddleware.registerNotSerializable; <add>// Expose serialization API <add>exports.register = register; <add>exports.registerLoader = registerLoader; <add>exports.registerNotSerializable = registerNotSerializable; <add>exports.serializer = new Serializer( <add> [new ObjectMiddleware(), new BinaryMiddleware(), new FileMiddleware()], <add> { <add> singleItem: true <add> } <add>); <add> <add>require("./registerExternalSerializer"); <add> <add>// Load internal paths with a relative require <add>// This allows bundling all internal serializers <add>registerLoader(/^webpack\/lib\//, req => <add> require("../" + req.slice("webpack/lib/".length)) <add>); <ide><path>lib/util/serializer.js <del>/* <del> MIT License http://www.opensource.org/licenses/mit-license.php <del> Author Tobias Koppers @sokra <del>*/ <del> <del>"use strict"; <del> <del>const BinaryMiddleware = require("../serialization/BinaryMiddleware"); <del>const FileMiddleware = require("../serialization/FileMiddleware"); <del>const ObjectMiddleware = require("../serialization/ObjectMiddleware"); <del>const Serializer = require("../serialization/Serializer"); <del> <del>const serializer = new Serializer( <del> [new ObjectMiddleware(), new BinaryMiddleware(), new FileMiddleware()], <del> { <del> singleItem: true <del> } <del>); <del> <del>require("./registerExternalSerializer"); <del> <del>// Load internal paths with a relative require <del>// This allows bundling all internal serializers <del>ObjectMiddleware.registerLoader(/^webpack\/lib\//, req => <del> require("../" + req.slice("webpack/lib/".length)) <del>); <del> <del>module.exports = serializer;
6
Ruby
Ruby
add a regression test for scoped `format` params
d61e3c79dc85a5ae86ed00fc9352a5d1d84c0f3f
<ide><path>actionpack/test/dispatch/mapper_test.rb <ide> def test_blows_up_without_via <ide> end <ide> end <ide> <add> def test_scoped_formatted <add> fakeset = FakeSet.new <add> mapper = Mapper.new fakeset <add> mapper.scope(format: true) do <add> mapper.get '/foo', :to => 'posts#index', :as => :main <add> end <add> assert_equal({:controller=>"posts", :action=>"index"}, <add> fakeset.defaults.first) <add> assert_equal "/foo.:format", fakeset.conditions.first[:path_info] <add> end <add> <ide> def test_random_keys <ide> fakeset = FakeSet.new <ide> mapper = Mapper.new fakeset
1
Javascript
Javascript
minimize glactivetexture calls
fa6899ae485cda3f5fceef325acf8bb2d9fc592f
<ide><path>src/renderers/webgl/WebGLState.js <ide> function WebGLState( gl, extensions, capabilities ) { <ide> <ide> } <ide> <del> function bindTexture( webglType, webglTexture ) { <add> function bindTexture( webglType, webglTexture, webglSlot ) { <ide> <del> if ( currentTextureSlot === null ) { <add> if ( webglSlot === undefined ) { <ide> <del> activeTexture(); <add> if ( currentTextureSlot === null ) { <add> <add> webglSlot = gl.TEXTURE0 + maxTextures - 1; <add> <add> } else { <add> <add> webglSlot = currentTextureSlot; <add> <add> } <ide> <ide> } <ide> <del> let boundTexture = currentBoundTextures[ currentTextureSlot ]; <add> let boundTexture = currentBoundTextures[ webglSlot ]; <ide> <ide> if ( boundTexture === undefined ) { <ide> <ide> boundTexture = { type: undefined, texture: undefined }; <del> currentBoundTextures[ currentTextureSlot ] = boundTexture; <add> currentBoundTextures[ webglSlot ] = boundTexture; <ide> <ide> } <ide> <ide> if ( boundTexture.type !== webglType || boundTexture.texture !== webglTexture ) { <ide> <add> if ( currentTextureSlot !== webglSlot ) { <add> <add> gl.activeTexture( webglSlot ); <add> currentTextureSlot = webglSlot; <add> <add> } <add> <ide> gl.bindTexture( webglType, webglTexture || emptyTextures[ webglType ] ); <ide> <ide> boundTexture.type = webglType; <ide><path>src/renderers/webgl/WebGLTextures.js <ide> function WebGLTextures( _gl, extensions, state, properties, capabilities, utils, <ide> <ide> } <ide> <del> state.activeTexture( _gl.TEXTURE0 + slot ); <del> state.bindTexture( _gl.TEXTURE_2D, textureProperties.__webglTexture ); <add> state.bindTexture( _gl.TEXTURE_2D, textureProperties.__webglTexture, _gl.TEXTURE0 + slot ); <ide> <ide> } <ide> <ide> function WebGLTextures( _gl, extensions, state, properties, capabilities, utils, <ide> <ide> } <ide> <del> state.activeTexture( _gl.TEXTURE0 + slot ); <del> state.bindTexture( _gl.TEXTURE_2D_ARRAY, textureProperties.__webglTexture ); <add> state.bindTexture( _gl.TEXTURE_2D_ARRAY, textureProperties.__webglTexture, _gl.TEXTURE0 + slot ); <ide> <ide> } <ide> <ide> function WebGLTextures( _gl, extensions, state, properties, capabilities, utils, <ide> <ide> } <ide> <del> state.activeTexture( _gl.TEXTURE0 + slot ); <del> state.bindTexture( _gl.TEXTURE_3D, textureProperties.__webglTexture ); <add> state.bindTexture( _gl.TEXTURE_3D, textureProperties.__webglTexture, _gl.TEXTURE0 + slot ); <ide> <ide> } <ide> <ide> function WebGLTextures( _gl, extensions, state, properties, capabilities, utils, <ide> <ide> } <ide> <del> state.activeTexture( _gl.TEXTURE0 + slot ); <del> state.bindTexture( _gl.TEXTURE_CUBE_MAP, textureProperties.__webglTexture ); <add> state.bindTexture( _gl.TEXTURE_CUBE_MAP, textureProperties.__webglTexture, _gl.TEXTURE0 + slot ); <ide> <ide> } <ide> <ide> function WebGLTextures( _gl, extensions, state, properties, capabilities, utils, <ide> const forceUpload = initTexture( textureProperties, texture ); <ide> const source = texture.source; <ide> <del> state.activeTexture( _gl.TEXTURE0 + slot ); <del> state.bindTexture( textureType, textureProperties.__webglTexture ); <add> state.bindTexture( textureType, textureProperties.__webglTexture, _gl.TEXTURE0 + slot ); <ide> <ide> const sourceProperties = properties.get( source ); <ide> <ide> if ( source.version !== sourceProperties.__version || forceUpload === true ) { <ide> <add> state.activeTexture( _gl.TEXTURE0 + slot ); <add> <ide> _gl.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, texture.flipY ); <ide> _gl.pixelStorei( _gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha ); <ide> _gl.pixelStorei( _gl.UNPACK_ALIGNMENT, texture.unpackAlignment ); <ide> function WebGLTextures( _gl, extensions, state, properties, capabilities, utils, <ide> const forceUpload = initTexture( textureProperties, texture ); <ide> const source = texture.source; <ide> <del> state.activeTexture( _gl.TEXTURE0 + slot ); <del> state.bindTexture( _gl.TEXTURE_CUBE_MAP, textureProperties.__webglTexture ); <add> state.bindTexture( _gl.TEXTURE_CUBE_MAP, textureProperties.__webglTexture, _gl.TEXTURE0 + slot ); <ide> <ide> const sourceProperties = properties.get( source ); <ide> <ide> if ( source.version !== sourceProperties.__version || forceUpload === true ) { <ide> <add> state.activeTexture( _gl.TEXTURE0 + slot ); <add> <ide> _gl.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, texture.flipY ); <ide> _gl.pixelStorei( _gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha ); <ide> _gl.pixelStorei( _gl.UNPACK_ALIGNMENT, texture.unpackAlignment );
2
Text
Text
add redux-logger to recommended middleware
0bbad0937977e04751535bac6493d8776c73a799
<ide><path>docs/introduction/Ecosystem.md <ide> On this page we will only feature a few of them that the Redux maintainers have <ide> * [redux-promise](https://github.com/acdlite/redux-promise) — [FSA](https://github.com/acdlite/flux-standard-action)-compliant promise middleware <ide> * [redux-rx](https://github.com/acdlite/redux-rx) — RxJS utilities for Redux, including a middleware for Observable <ide> * [redux-batched-updates](https://github.com/acdlite/redux-batched-updates) — Batch React updates that occur as a result of Redux dispatches <add>* [redux-logger](https://github.com/fcomb/redux-logger) — Log every Redux action and the next state <ide> <ide> ## Utilities <ide> <ide> On this page we will only feature a few of them that the Redux maintainers have <ide> <ide> ## More <ide> <del>[Awesome Redux](https://github.com/xgrommx/awesome-redux) is an extensive list of Redux-related repositories. <ide>\ No newline at end of file <add>[Awesome Redux](https://github.com/xgrommx/awesome-redux) is an extensive list of Redux-related repositories.
1
Ruby
Ruby
move bottle.rb logic from test-bot to brew bottle
5d0f868f060c086cc53c81ef6a63ac93e24ae1b4
<ide><path>Library/Contributions/cmd/brew-test-bot.rb <ide> def status_upcase <ide> end <ide> <ide> def command_short <del> @command.gsub(/(brew|--force|--verbose|--build-bottle) /, '').strip.squeeze ' ' <add> @command.gsub(/(brew|--force|--verbose|--build-bottle|--rb) /, '').strip.squeeze ' ' <ide> end <ide> <ide> def passed? <ide> def formula formula <ide> test "brew audit #{formula}" <ide> return unless install_passed <ide> unless ARGV.include? '--no-bottle' <del> test "brew bottle #{formula}", :puts_output_on_success => true <add> test "brew bottle --rb #{formula}", :puts_output_on_success => true <ide> bottle_step = steps.last <ide> if bottle_step.passed? and bottle_step.has_output? <del> bottle_revision = bottle_new_revision(formula_object) <del> bottle_filename = bottle_filename(formula_object, bottle_revision) <del> bottle_base = bottle_filename.gsub(bottle_suffix(bottle_revision), '') <del> bottle_output = bottle_step.output.gsub /.*(bottle do.*end)/m, '\1' <del> File.open "#{bottle_base}.bottle.rb", 'w' do |file| <del> file.write bottle_output <del> end <add> bottle_filename = <add> bottle_step.output.gsub(/.*(\.\/\S+#{bottle_native_regex}).*/m, '\1') <ide> test "brew uninstall --force #{formula}" <ide> test "brew install #{bottle_filename}" <ide> end <ide><path>Library/Homebrew/bottles.rb <ide> def bottle_file_outdated? f, file <ide> bottle_ext && bottle_url_ext && bottle_ext != bottle_url_ext <ide> end <ide> <del>def bottle_new_revision f <del> return 0 unless bottle_current? f <del> f.bottle.revision + 1 <del>end <del> <ide> def bottle_native_suffix revision=nil <ide> ".#{bottle_tag}#{bottle_suffix(revision)}" <ide> end <ide><path>Library/Homebrew/cmd/bottle.rb <ide> def bottle_formula f <ide> output = bottle_output bottle <ide> puts output <ide> end <add> <add> if ARGV.include? '--rb' <add> bottle_base = filename.gsub(bottle_suffix(bottle_revision), '') <add> File.open "#{bottle_base}.bottle.rb", 'w' do |file| <add> file.write output <add> end <add> end <ide> end <ide> <ide> def merge
3
Ruby
Ruby
move default middleware stack into initializer
1f7270057596592946a877cd029d95760ba3e5ee
<ide><path>actionpack/lib/action_controller/dispatch/dispatcher.rb <ide> class Dispatcher <ide> self.router = Routing::Routes <ide> <ide> cattr_accessor :middleware <del> self.middleware = ActionDispatch::MiddlewareStack.new do |middleware| <del> middlewares = File.join(File.dirname(__FILE__), "middlewares.rb") <del> middleware.instance_eval(File.read(middlewares), middlewares, 1) <del> end <add> self.middleware = ActionDispatch::MiddlewareStack.new <ide> <ide> class << self <ide> def define_dispatcher_callbacks(cache_classes) <ide><path>actionpack/lib/action_controller/dispatch/middlewares.rb <del>use "Rack::Lock", :if => lambda { <del> !ActionController::Base.allow_concurrency <del>} <del> <del>use "ActionDispatch::ShowExceptions", lambda { ActionController::Base.consider_all_requests_local } <del>use "ActionDispatch::Callbacks", lambda { ActionController::Dispatcher.prepare_each_request } <del> <del># TODO: Redirect global exceptions somewhere? <del># use "ActionDispatch::Rescue" <del> <del>use lambda { ActionController::Base.session_store }, <del> lambda { ActionController::Base.session_options } <del> <del>use "ActionDispatch::ParamsParser" <del>use "Rack::MethodOverride" <del>use "Rack::Head" <ide><path>actionpack/test/abstract_unit.rb <ide> <ide> FIXTURE_LOAD_PATH = File.join(File.dirname(__FILE__), 'fixtures') <ide> <add>ActionController::Dispatcher.middleware = ActionDispatch::MiddlewareStack.new do |middleware| <add> middleware.use "ActionDispatch::ShowExceptions" <add> middleware.use "ActionDispatch::Callbacks" <add> middleware.use "ActionDispatch::ParamsParser" <add> middleware.use "Rack::Head" <add>end <add> <ide> module ActionView <ide> class TestCase <ide> setup do <ide> class ::ApplicationController < ActionController::Base <ide> end <ide> <ide> module ActionController <del> Base.session = { <del> :key => '_testing_session', <del> :secret => '8273f16463985e2b3747dc25e30f2528' <del> } <del> Base.session_store = nil <del> <ide> class << Routing <ide> def possible_controllers <ide> @@possible_controllers ||= [] <ide><path>actionpack/test/controller/dispatcher_test.rb <ide> def test_to_prepare_with_identifier_replaces <ide> def dispatch(cache_classes = true) <ide> ActionController::Dispatcher.prepare_each_request = false <ide> Dispatcher.define_dispatcher_callbacks(cache_classes) <del> Dispatcher.middleware = ActionDispatch::MiddlewareStack.new do |middleware| <del> middlewares = File.expand_path(File.join(File.dirname(__FILE__), "../../lib/action_controller/dispatch/middlewares.rb")) <del> middleware.instance_eval(File.read(middlewares)) <del> end <ide> <ide> @dispatcher ||= Dispatcher.new <ide> @dispatcher.call({'rack.input' => StringIO.new(''), 'action_dispatch.show_exceptions' => false}) <ide><path>actionpack/test/dispatch/session/cookie_store_test.rb <ide> class CookieStoreTest < ActionController::IntegrationTest <ide> SessionKey = '_myapp_session' <ide> SessionSecret = 'b3c631c314c0bbca50c1b2843150fe33' <ide> <del> # Make sure Session middleware doesnt get included in the middleware stack <del> ActionController::Base.session_store = nil <del> <ide> Verifier = ActiveSupport::MessageVerifier.new(SessionSecret, 'SHA1') <ide> SignedBar = Verifier.generate(:foo => "bar", :session_id => ActiveSupport::SecureRandom.hex(16)) <ide> <ide><path>railties/lib/rails/console_app.rb <ide> def new_session <ide> #reloads the environment <ide> def reload! <ide> puts "Reloading..." <del> ActionController::Dispatcher.new <add> ActionDispatch::Callbacks.new(lambda {}, true) <ide> ActionController::Dispatcher.router.reload <ide> true <ide> end <ide><path>railties/lib/rails/initializer.rb <ide> def self.run(initializer = nil, config = nil) <ide> # Include middleware to serve up static assets <ide> Initializer.default.add :initialize_static_server do <ide> if configuration.frameworks.include?(:action_controller) && configuration.serve_static_assets <del> configuration.middleware.insert(0, ActionDispatch::Static, Rails.public_path) <add> configuration.middleware.use(ActionDispatch::Static, Rails.public_path) <add> end <add> end <add> <add> Initializer.default.add :initialize_middleware_stack do <add> if configuration.frameworks.include?(:action_controller) <add> configuration.middleware.use(::Rack::Lock) unless ActionController::Base.allow_concurrency <add> configuration.middleware.use(ActionDispatch::ShowExceptions, ActionController::Base.consider_all_requests_local) <add> configuration.middleware.use(ActionDispatch::Callbacks, ActionController::Dispatcher.prepare_each_request) <add> configuration.middleware.use(lambda { ActionController::Base.session_store }, lambda { ActionController::Base.session_options }) <add> configuration.middleware.use(ActionDispatch::ParamsParser) <add> configuration.middleware.use(::Rack::MethodOverride) <add> configuration.middleware.use(::Rack::Head) <ide> end <ide> end <ide> <ide><path>railties/test/console_app_test.rb <ide> <ide> require 'action_controller' # console_app uses 'action_controller/integration' <ide> <del>unless defined? ApplicationController <del> class ApplicationController < ActionController::Base; end <del> ActionController::Base.session_store = nil <del>end <del> <ide> require 'rails/dispatcher' <ide> require 'rails/console_app' <ide>
8
Python
Python
fix the wrong docstring for adamw
727f1f3106312ca53b5c09f77087dafaaa25da0a
<ide><path>keras/optimizers/optimizer_experimental/adamw.py <ide> class AdamW(optimizer.Optimizer): <ide> <ide> Notes: <ide> <del> The default value of 1e-7 for epsilon might not be a good default in <del> general. For example, when training an Inception network on ImageNet a <del> current good choice is 1.0 or 0.1. Note that since Adam uses the <del> formulation just before Section 2.1 of the Kingma and Ba paper rather than <del> the formulation in Algorithm 1, the "epsilon" referred to here is "epsilon <del> hat" in the paper. <del> <ide> The sparse implementation of this algorithm (used when the gradient is an <ide> IndexedSlices object, typically because of `tf.gather` or an embedding <ide> lookup in the forward pass) does apply momentum to variable slices even if
1
Text
Text
add compatibility/interop technical value
700612fdb4e1bbd2241aece8bd7c1f49a077dde7
<ide><path>doc/guides/technical-values.md <ide> collaboration. <ide> * Priority 2 - Stability <ide> * Priority 3 - Operational qualities <ide> * Priority 4 - Node.js maintainer experience <del>* Priority 5 - Up to date Technology and APIs <add>* Priority 5 - Up to date technology and APIs <ide> <ide> ## Value descriptions <ide> <ide> with Node.js. Some key elements of this include: <ide> * Great documentation <ide> * Bundling friction-reducing APIs and components, even though <ide> they could be provided externally <add>* Compatibility and interoperability with browsers and other JavaScript <add> environments so that as much code as possible runs as is both in Node.js and <add> in the other environments <ide> * Enabling/supporting external packages to ensure overall developer experience <ide> <ide> ### 2 - Stability
1
Ruby
Ruby
extract annotations using a parser for ruby files
514ef0b8a5d929f2389fe75ae9ec928ec9644360
<ide><path>railties/lib/rails/source_annotation_extractor.rb <ide> # frozen_string_literal: true <ide> <add>require "ripper" <add> <ide> module Rails <ide> # Implements the logic behind <tt>Rails::Command::NotesCommand</tt>. See <tt>rails notes --help</tt> for usage information. <ide> # <ide> module Rails <ide> # start with the tag optionally followed by a colon. Everything up to the end <ide> # of the line (or closing ERB comment tag) is considered to be their text. <ide> class SourceAnnotationExtractor <add> # Wraps a regular expression that will be tested against each of the source <add> # file's comments. <add> class ParserExtractor < Struct.new(:pattern) <add> class Parser < Ripper <add> attr_reader :comments, :pattern <add> <add> def initialize(source, pattern:) <add> super(source) <add> @pattern = pattern <add> @comments = [] <add> end <add> <add> def on_comment(value) <add> @comments << Annotation.new(lineno, $1, $2) if value =~ pattern <add> end <add> end <add> <add> def annotations(file) <add> contents = File.read(file, encoding: Encoding::BINARY) <add> parser = Parser.new(contents, pattern: pattern).tap(&:parse) <add> parser.error? ? [] : parser.comments <add> end <add> end <add> <add> # Wraps a regular expression that will iterate through a file's lines and <add> # test each one for the given pattern. <add> class PatternExtractor < Struct.new(:pattern) <add> def annotations(file) <add> lineno = 0 <add> <add> File.readlines(file, encoding: Encoding::BINARY).inject([]) do |list, line| <add> lineno += 1 <add> next list unless line =~ pattern <add> list << Annotation.new(lineno, $1, $2) <add> end <add> end <add> end <add> <ide> class Annotation < Struct.new(:line, :tag, :text) <ide> def self.directories <ide> @@directories ||= %w(app config db lib test) <ide> def self.register_extensions(*exts, &block) <ide> extensions[/\.(#{exts.join("|")})$/] = block <ide> end <ide> <del> register_extensions("builder", "rb", "rake", "yml", "yaml", "ruby") { |tag| /#\s*(#{tag}):?\s*(.*)$/ } <del> register_extensions("css", "js") { |tag| /\/\/\s*(#{tag}):?\s*(.*)$/ } <del> register_extensions("erb") { |tag| /<%\s*#\s*(#{tag}):?\s*(.*?)\s*%>/ } <add> register_extensions("builder", "rb", "rake", "ruby") do |tag| <add> ParserExtractor.new(/#\s*(#{tag}):?\s*(.*)$/) <add> end <add> <add> register_extensions("yml", "yaml") do |tag| <add> PatternExtractor.new(/#\s*(#{tag}):?\s*(.*)$/) <add> end <add> <add> register_extensions("css", "js") do |tag| <add> PatternExtractor.new(/\/\/\s*(#{tag}):?\s*(.*)$/) <add> end <add> <add> register_extensions("erb") do |tag| <add> PatternExtractor.new(/<%\s*#\s*(#{tag}):?\s*(.*?)\s*%>/) <add> end <ide> <ide> # Returns a representation of the annotation that looks like this: <ide> # <ide> def find_in(dir) <ide> <ide> if extension <ide> pattern = extension.last.call(tag) <del> results.update(extract_annotations_from(item, pattern)) if pattern <add> <add> # In case a user-defined pattern returns nothing for the given set <add> # of tags, we exit early. <add> next unless pattern <add> <add> # If a user-defined pattern returns a regular expression, we will <add> # wrap it in a PatternExtractor to keep the same API. <add> pattern = PatternExtractor.new(pattern) if pattern.is_a?(Regexp) <add> <add> annotations = pattern.annotations(item) <add> results.update(item => annotations) if annotations.any? <ide> end <ide> end <ide> end <ide> <ide> results <ide> end <ide> <del> # If +file+ is the filename of a file that contains annotations this method returns <del> # a hash with a single entry that maps +file+ to an array of its annotations. <del> # Otherwise it returns an empty hash. <del> def extract_annotations_from(file, pattern) <del> lineno = 0 <del> result = File.readlines(file, encoding: Encoding::BINARY).inject([]) do |list, line| <del> lineno += 1 <del> next list unless line =~ pattern <del> list << Annotation.new(lineno, $1, $2) <del> end <del> result.empty? ? {} : { file => result } <del> end <del> <ide> # Prints the mapping from filenames to annotations in +results+ ordered by filename. <ide> # The +options+ hash is passed to each annotation's +to_s+. <ide> def display(results, options = {}) <ide><path>railties/test/commands/notes_test.rb <ide> class Rails::Command::NotesTest < ActiveSupport::TestCase <ide> OUTPUT <ide> end <ide> <add> test "does not pick up notes inside string literals" do <add> app_file "app/models/profile.rb", '"# TODO: do something"' <add> <add> assert_empty run_notes_command <add> end <add> <ide> private <ide> def run_notes_command(args = []) <ide> rails "notes", args
2
Ruby
Ruby
enable sandbox on test-bot
a380ec636eb02e1412ee6657449b9a159182c9da
<ide><path>Library/Homebrew/cmd/test-bot.rb <ide> def test_bot <ide> end <ide> <ide> ENV["HOMEBREW_DEVELOPER"] = "1" <add> ENV["HOMEBREW_SANDBOX"] = "1" <ide> ENV["HOMEBREW_NO_EMOJI"] = "1" <ide> if ARGV.include?("--ci-master") || ARGV.include?("--ci-pr") \ <ide> || ARGV.include?("--ci-testing")
1
Python
Python
add batch normalization to the generator, etc
97acd91baf198d059628b22d172e9078dcde8831
<ide><path>examples/mnist_acgan.py <ide> from keras.datasets import mnist <ide> from keras import layers <ide> from keras.layers import Input, Dense, Reshape, Flatten, Embedding, Dropout <add>from keras.layers import BatchNormalization <ide> from keras.layers.advanced_activations import LeakyReLU <ide> from keras.layers.convolutional import Conv2DTranspose, Conv2D <ide> from keras.models import Sequential, Model <ide> def build_generator(latent_size): <ide> cnn.add(Conv2DTranspose(192, 5, strides=1, padding='valid', <ide> activation='relu', <ide> kernel_initializer='glorot_normal')) <add> cnn.add(BatchNormalization()) <ide> <ide> # upsample to (14, 14, ...) <ide> cnn.add(Conv2DTranspose(96, 5, strides=2, padding='same', <ide> activation='relu', <ide> kernel_initializer='glorot_normal')) <add> cnn.add(BatchNormalization()) <ide> <ide> # upsample to (28, 28, ...) <ide> cnn.add(Conv2DTranspose(1, 5, strides=2, padding='same', <ide> def build_discriminator(): <ide> if __name__ == '__main__': <ide> <ide> # batch and latent size taken from the paper <del> epochs = 50 <add> epochs = 100 <ide> batch_size = 100 <ide> latent_size = 100 <ide> <ide> def build_discriminator(): <ide> <ide> x = np.concatenate((image_batch, generated_images)) <ide> <del> # use soft real/fake labels <del> soft_zero, soft_one = 0.1, 0.9 <add> # use one-sided soft real/fake labels <add> # Salimans et al., 2016 <add> # https://arxiv.org/pdf/1606.03498.pdf (Section 3.4) <add> soft_zero, soft_one = 0, 0.95 <ide> y = np.array([soft_one] * batch_size + [soft_zero] * batch_size) <ide> aux_y = np.concatenate((label_batch, sampled_labels), axis=0) <ide> <ide> def build_discriminator(): <ide> 'component', *discriminator.metrics_names)) <ide> print('-' * 65) <ide> <del> ROW_FMT = '{0:<22s} | {1:<4.2f} | {2:<15.2f} | {3:<5.2f}' <add> ROW_FMT = '{0:<22s} | {1:<4.2f} | {2:<15.4f} | {3:<5.4f}' <ide> print(ROW_FMT.format('generator (train)', <ide> *train_history['generator'][-1])) <ide> print(ROW_FMT.format('generator (test)',
1
PHP
PHP
fix failing test in app
1bc4562f3a52c8241c0921c9af3cedb530c159ec
<ide><path>lib/Cake/Config/config.php <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide> */ <ide> $versionFile = file(CAKE . 'VERSION.txt'); <del>return $config['Cake.version'] = trim(array_pop($versionFile)); <add>$config['Cake.version'] = trim(array_pop($versionFile)); <add>return $config;
1
Javascript
Javascript
update factory in bootstrap.js
72e6dbebaa5a794651feffa2727a13bd4961ef8c
<ide><path>extensions/firefox/bootstrap.js <ide> let Ci = Components.interfaces; <ide> let Cm = Components.manager; <ide> let Cu = Components.utils; <ide> <add>Cu.import('resource://gre/modules/XPCOMUtils.jsm'); <ide> Cu.import('resource://gre/modules/Services.jsm'); <ide> <ide> function getBoolPref(pref, def) { <ide> function log(str) { <ide> dump(str + '\n'); <ide> } <ide> <del>// Register/unregister a class as a component. <add>// Register/unregister a constructor as a component. <ide> let Factory = { <del> registrar: null, <del> aClass: null, <del> register: function(aClass) { <del> if (this.aClass) { <del> log('Cannot register more than one class'); <del> return; <del> } <del> this.registrar = Cm.QueryInterface(Ci.nsIComponentRegistrar); <del> this.aClass = aClass; <del> var proto = aClass.prototype; <del> this.registrar.registerFactory(proto.classID, proto.classDescription, <del> proto.contractID, this); <add> QueryInterface: XPCOMUtils.generateQI([Ci.nsIFactory]), <add> _targetConstructor: null, <add> <add> register: function register(targetConstructor) { <add> this._targetConstructor = targetConstructor; <add> var proto = targetConstructor.prototype; <add> var registrar = Cm.QueryInterface(Ci.nsIComponentRegistrar); <add> registrar.registerFactory(proto.classID, proto.classDescription, <add> proto.contractID, this); <ide> }, <del> unregister: function() { <del> if (!this.aClass) { <del> log('Class was never registered.'); <del> return; <del> } <del> var proto = this.aClass.prototype; <del> this.registrar.unregisterFactory(proto.classID, this); <del> this.aClass = null; <add> <add> unregister: function unregister() { <add> var proto = this._targetConstructor.prototype; <add> var registrar = Cm.QueryInterface(Ci.nsIComponentRegistrar); <add> registrar.unregisterFactory(proto.classID, this); <add> this._targetConstructor = null; <ide> }, <del> // nsIFactory::createInstance <del> createInstance: function(outer, iid) { <del> if (outer !== null) <add> <add> // nsIFactory <add> createInstance: function createInstance(aOuter, iid) { <add> if (aOuter !== null) <ide> throw Cr.NS_ERROR_NO_AGGREGATION; <del> return (new (this.aClass)).QueryInterface(iid); <add> return (new (this._targetConstructor)).QueryInterface(iid); <add> }, <add> <add> // nsIFactory <add> lockFactory: function lockFactory(lock) { <add> // No longer used as of gecko 1.7. <add> throw Cr.NS_ERROR_NOT_IMPLEMENTED; <ide> } <ide> }; <ide>
1
Ruby
Ruby
create extended os formula specs
01c5bc48d250025241ccbbbb476a50df2856ca8e
<ide><path>Library/Homebrew/test/formula_spec.rb <ide> def reset_outdated_kegs <ide> end <ide> end <ide> end <del> <del> describe "#uses_from_macos" do <del> context 'on Linux' do <del> before do <del> allow(OS).to receive(:mac?).and_return(false) <del> end <del> <del> it "acts like #depends_on" do <del> f = formula "foo" do <del> url "foo-1.0" <del> <del> uses_from_macos("foo") <del> end <del> <del> expect(f.class.stable.deps.first.name).to eq("foo") <del> expect(f.class.devel.deps.first.name).to eq("foo") <del> expect(f.class.head.deps.first.name).to eq("foo") <del> end <del> <del> it "ignores MacOS specifications" do <del> f = formula "foo" do <del> url "foo-1.0" <del> <del> uses_from_macos("foo", after: :mojave) <del> end <del> <del> expect(f.class.stable.deps.first.name).to eq("foo") <del> expect(f.class.devel.deps.first.name).to eq("foo") <del> expect(f.class.head.deps.first.name).to eq("foo") <del> end <del> end <del> <del> context 'on MacOS' do <del> before do <del> sierra_os_version = OS::Mac::Version.from_symbol(:sierra) <del> <del> allow(OS).to receive(:mac?).and_return(true) <del> allow(OS::Mac).to receive(:version).and_return(OS::Mac::Version.new(sierra_os_version)) <del> end <del> <del> it "doesn't adds a dependency if it doesn't meet OS version requirements" do <del> f = formula 'foo' do <del> url 'foo-1.0' <del> <del> uses_from_macos('foo', after: :high_sierra) <del> uses_from_macos('bar', before: :el_capitan) <del> end <del> <del> expect(f.class.stable.deps).to be_empty <del> expect(f.class.devel.deps).to be_empty <del> expect(f.class.head.deps).to be_empty <del> end <del> <del> it 'allows specifying dependencies after certain version' do <del> f = formula 'foo' do <del> url 'foo-1.0' <del> <del> uses_from_macos('foo', after: :el_capitan) <del> end <del> <del> expect(f.class.stable.deps.first.name).to eq('foo') <del> expect(f.class.devel.deps.first.name).to eq('foo') <del> expect(f.class.head.deps.first.name).to eq('foo') <del> end <del> <del> it 'allows specifying dependencies before certain version' do <del> f = formula 'foo' do <del> url 'foo-1.0' <del> <del> uses_from_macos('foo', before: :high_sierra) <del> end <del> <del> expect(f.class.stable.deps.first.name).to eq('foo') <del> expect(f.class.devel.deps.first.name).to eq('foo') <del> expect(f.class.head.deps.first.name).to eq('foo') <del> end <del> <del> it 'raises an error if passing invalid OS versions' do <del> expect { <del> formula 'foo' do <del> url 'foo-1.0' <del> <del> uses_from_macos('foo', after: 'bar', before: :mojave) <del> end <del> }.to raise_error(ArgumentError, 'unknown version "bar"') <del> end <del> end <del> end <ide> end <ide><path>Library/Homebrew/test/os/linux/formula_spec.rb <add># frozen_string_literal: true <add> <add>require "formula" <add> <add>describe Formula do <add> describe "#uses_from_macos" do <add> before do <add> allow(OS).to receive(:mac?).and_return(false) <add> end <add> <add> it "acts like #depends_on" do <add> f = formula "foo" do <add> url "foo-1.0" <add> <add> uses_from_macos("foo") <add> end <add> <add> expect(f.class.stable.deps.first.name).to eq("foo") <add> expect(f.class.devel.deps.first.name).to eq("foo") <add> expect(f.class.head.deps.first.name).to eq("foo") <add> end <add> <add> it "ignores OS version specifications" do <add> f = formula "foo" do <add> url "foo-1.0" <add> <add> uses_from_macos("foo", after: :mojave) <add> end <add> <add> expect(f.class.stable.deps.first.name).to eq("foo") <add> expect(f.class.devel.deps.first.name).to eq("foo") <add> expect(f.class.head.deps.first.name).to eq("foo") <add> end <add> end <add>end <ide><path>Library/Homebrew/test/os/mac/formula_spec.rb <add># frozen_string_literal: true <add> <add>require "formula" <add> <add>describe Formula do <add> describe "#uses_from_macos" do <add> before do <add> sierra_os_version = OS::Mac::Version.from_symbol(:sierra) <add> <add> allow(OS).to receive(:mac?).and_return(true) <add> allow(OS::Mac).to receive(:version).and_return(OS::Mac::Version.new(sierra_os_version)) <add> end <add> <add> it "doesn't adds a dependency if it doesn't meet OS version requirements" do <add> f = formula "foo" do <add> url "foo-1.0" <add> <add> uses_from_macos("foo", after: :high_sierra) <add> uses_from_macos("bar", before: :el_capitan) <add> end <add> <add> expect(f.class.stable.deps).to be_empty <add> expect(f.class.devel.deps).to be_empty <add> expect(f.class.head.deps).to be_empty <add> end <add> <add> it "allows specifying dependencies after certain version" do <add> f = formula "foo" do <add> url "foo-1.0" <add> <add> uses_from_macos("foo", after: :el_capitan) <add> end <add> <add> expect(f.class.stable.deps.first.name).to eq("foo") <add> expect(f.class.devel.deps.first.name).to eq("foo") <add> expect(f.class.head.deps.first.name).to eq("foo") <add> end <add> <add> it "allows specifying dependencies before certain version" do <add> f = formula "foo" do <add> url "foo-1.0" <add> <add> uses_from_macos("foo", before: :high_sierra) <add> end <add> <add> expect(f.class.stable.deps.first.name).to eq("foo") <add> expect(f.class.devel.deps.first.name).to eq("foo") <add> expect(f.class.head.deps.first.name).to eq("foo") <add> end <add> <add> it "raises an error if passing invalid OS versions" do <add> expect { <add> formula "foo" do <add> url "foo-1.0" <add> <add> uses_from_macos("foo", after: "bar", before: :mojave) <add> end <add> }.to raise_error(ArgumentError, 'unknown version "bar"') <add> end <add> end <add>end
3
PHP
PHP
remove unused import
4ef784d9d1f025e7c0417e9c02057c6e972c9b76
<ide><path>src/Console/CommandCollection.php <ide> use ArrayIterator; <ide> use Cake\Console\CommandScanner; <ide> use Cake\Console\Shell; <del>use Cake\Log\Log; <ide> use Countable; <ide> use InvalidArgumentException; <ide> use IteratorAggregate;
1
PHP
PHP
remove duplicate test
65ac8132b3a6518ec267d29312a36d25961d7b6d
<ide><path>tests/TestCase/Routing/Route/RouteTest.php <ide> public function testMatchWithPatterns() <ide> $result = $route->match(['plugin' => null, 'controller' => 'posts', 'action' => 'view', 'id' => 9]); <ide> $this->assertSame('/posts/view/9', $result); <ide> <del> $result = $route->match(['plugin' => null, 'controller' => 'posts', 'action' => 'view', 'id' => 9]); <del> $this->assertSame('/posts/view/9', $result); <del> <ide> $result = $route->match(['plugin' => null, 'controller' => 'posts', 'action' => 'view', 'id' => '9']); <ide> $this->assertSame('/posts/view/9', $result); <ide>
1
Javascript
Javascript
add inspector to builtinlibs
71578198e30344140c237ec36fb706419c398440
<ide><path>lib/internal/module.js <ide> const builtinLibs = [ <ide> 'stream', 'string_decoder', 'tls', 'tty', 'url', 'util', 'v8', 'vm', 'zlib' <ide> ]; <ide> <add>if (typeof process.binding('inspector').connect === 'function') { <add> builtinLibs.push('inspector'); <add> builtinLibs.sort(); <add>} <add> <ide> function addBuiltinLibsToObject(object) { <ide> // Make built-in modules available directly (loaded lazily). <ide> builtinLibs.forEach((name) => {
1
Javascript
Javascript
fix referenceerror in check-coverage.js
a3e1703aebcbf1b8d7618ada1d69c18c9fafe1a0
<ide><path>test/e2e/check-coverage.js <ide> const S = fs.readdirSync( './examples/screenshots' ) <ide> <ide> // files.js <ide> const F = []; <del>eval( fs.readFileSync( './examples/files.js' ).toString() ); <del>for ( var key in files ) { <add>// To expose files variable to out of eval scope, we need var statement, not const. <add>eval( fs.readFileSync( './examples/files.js' ) <add> .toString().replace( 'const files', 'var files' ) ); <add>for ( const key in files ) { <ide> <del> var section = files[ key ]; <del> for ( var i = 0, len = section.length; i < len; i ++ ) { <add> const section = files[ key ]; <add> for ( let i = 0, len = section.length; i < len; i ++ ) { <ide> <ide> F.push( section[ i ] ); <ide>
1
Python
Python
improve initialization for hidden layers
6ef72864fa23199a837e9197db8005f059255cce
<ide><path>spacy/_ml.py <ide> def init_weights(model): <ide> size=tokvecs.size).reshape(tokvecs.shape) <ide> <ide> def predict(ids, tokvecs): <del> hiddens = model(tokvecs) # (b, f, o, p) <del> vector = model.ops.allocate((hiddens.shape[0], model.nO, model.nP)) <del> model.ops.xp.add.at(vector, ids, hiddens) <del> vector += model.b <add> # nS ids. nW tokvecs <add> hiddens = model(tokvecs) # (nW, f, o, p) <add> # need nS vectors <add> vectors = model.ops.allocate((ids.shape[0], model.nO, model.nP)) <add> for i, feats in enumerate(ids): <add> for j, id_ in enumerate(feats): <add> vectors[i] += hiddens[id_, j] <add> vectors += model.b <ide> if model.nP >= 2: <del> return model.ops.maxout(vector)[0] <add> return model.ops.maxout(vectors)[0] <ide> else: <del> return vector * (vector >= 0) <add> return vectors * (vectors >= 0) <ide> <ide> tol_var = 0.01 <ide> tol_mean = 0.01
1
Javascript
Javascript
add deprecation warning for viewpagerandroid
77300ca91c17d371f6ba04230b8c2e8f5cd99ab8
<ide><path>Libraries/react-native/react-native-implementation.js <ide> module.exports = { <ide> return require('View'); <ide> }, <ide> get ViewPagerAndroid() { <add> warnOnce( <add> 'viewpager-moved', <add> 'ViewPagerAndroid has been extracted from react-native core and will be removed in a future release. ' + <add> "It can now be installed and imported from '@react-native-community/viewpager' instead of 'react-native'. " + <add> 'See https://github.com/react-native-community/react-native-viewpager', <add> ); <ide> return require('ViewPagerAndroid'); <ide> }, <ide> get VirtualizedList() {
1
Ruby
Ruby
remove debug code
f636ab75f15c2013373131f3d50e1aa26930b2cb
<ide><path>activerecord/test/cases/schema_dumper_test.rb <ide> def test_types_line_up <ide> end <ide> end.compact <ide> <del> if lengths.uniq.length != 1 <del> p lengths.uniq.length <del> puts column_set <del> end <del> <ide> assert_equal 1, lengths.uniq.length <ide> end <ide> end
1
PHP
PHP
add tests for singletoninstance
c655e6fc7dd07805b1f7cc3a95c53fcc2bbfb40b
<ide><path>tests/Foundation/Testing/Concerns/InteractsWithContainerTest.php <ide> public function testWithMixRestoresOriginalHandlerAndReturnsInstance() <ide> $this->assertSame($handler, resolve(Mix::class)); <ide> $this->assertSame($this, $instance); <ide> } <add> <add> public function testSingletonBoundInstancesCanBeResolved() <add> { <add> $this->singletonInstance('foo', 'bar'); <add> <add> $this->assertEquals('bar', $this->app->make('foo')); <add> $this->assertEquals('bar', $this->app->make('foo', ['with' => 'params'])); <add> } <ide> }
1
Ruby
Ruby
add test for legacy prefix quoting
6e7731aeff1195a55a88ce88dc44d0ac870f31aa
<ide><path>Library/Homebrew/test/formula_test.rb <ide> def test_formula_names <ide> end <ide> end <ide> <del>class CommentedTemplateCode <Test::Unit::TestCase <add>class WellKnownCodeIssues <Test::Unit::TestCase <ide> def test_for_commented_out_cmake <ide> Dir["#{HOMEBREW_PREFIX}/Library/Formula/*.rb"].each do |f| <ide> result = `grep "# depends_on 'cmake'" "#{f}"`.strip <ide> assert_equal('', result, "Commented template code still in #{f}") <ide> end <ide> end <del>end <ide>\ No newline at end of file <add> <add> def test_for_misquoted_prefix <add> # Prefix should not have single quotes if the system args are already separated <add> target_string = "[\\\"]--prefix=[\\']" <add> <add> Dir["#{HOMEBREW_PREFIX}/Library/Formula/*.rb"].each do |f| <add> result = `grep -e "#{target_string}" "#{f}"`.strip <add> assert_equal('', result, "--prefix is incorrectly single-quoted in #{f}") <add> end <add> end <add> <add>end
1
Javascript
Javascript
fix doc api
d1848b4f26766701693fcfd1a1e1e85341d53e97
<ide><path>packages/ember-runtime/lib/system/array_proxy.js <ide> var get = Ember.get, set = Ember.set; <ide> A simple example of usage: <ide> <ide> var pets = ['dog', 'cat', 'fish']; <del> var arrayProxy = Ember.ArrayProxy.create({ content: Ember.A(pets) }); <add> var ap = Ember.ArrayProxy.create({ content: Ember.A(pets) }); <ide> ap.get('firstObject'); // => 'dog' <ide> ap.set('content', ['amoeba', 'paramecium']); <ide> ap.get('firstObject'); // => 'amoeba'
1
Text
Text
fix json format of plugin
2d24dbe896b33ab2b450ace457b0e266b27dfd74
<ide><path>docs/extend/plugin_api.md <ide> This is the JSON format for a plugin: <ide> "InsecureSkipVerify": false, <ide> "CAFile": "/usr/shared/docker/certs/example-ca.pem", <ide> "CertFile": "/usr/shared/docker/certs/example-cert.pem", <del> "KeyFile": "/usr/shared/docker/certs/example-key.pem", <add> "KeyFile": "/usr/shared/docker/certs/example-key.pem" <ide> } <ide> } <ide> ```
1
PHP
PHP
implement mulitple paginators
ed233e7167f2b693c90fa30fbba0d1ba58d3ec6d
<ide><path>src/Controller/Component/PaginatorComponent.php <ide> use Cake\Datasource\QueryInterface; <ide> use Cake\Datasource\RepositoryInterface; <ide> use Cake\Network\Exception\NotFoundException; <add>use Cake\Utility\Hash; <ide> <ide> /** <ide> * This component is used to handle automatic model data pagination. The primary way to use this <ide> public function paginate($object, array $settings = []) <ide> 'direction' => current($order), <ide> 'limit' => $defaults['limit'] != $limit ? $limit : null, <ide> 'sortDefault' => $sortDefault, <del> 'directionDefault' => $directionDefault <add> 'directionDefault' => $directionDefault, <add> 'prefix' => Hash::get($options, 'prefix', null), <ide> ]; <ide> <ide> if (!isset($request['paging'])) { <ide> public function mergeOptions($alias, $settings) <ide> { <ide> $defaults = $this->getDefaults($alias, $settings); <ide> $request = $this->_registry->getController()->request; <del> $request = array_intersect_key($request->query, array_flip($this->_config['whitelist'])); <add> $prefix = Hash::get($settings, 'prefix', null); <add> $query = $request->query; <add> if ($prefix) { <add> $query = Hash::get($request->query, $prefix, []); <add> } <add> $request = array_intersect_key($query, array_flip($this->_config['whitelist'])); <ide> return array_merge($defaults, $request); <ide> } <ide> <ide><path>src/Controller/Controller.php <ide> public function referer($default = null, $local = false) <ide> * <ide> * @param \Cake\ORM\Table|string|\Cake\ORM\Query|null $object Table to paginate <ide> * (e.g: Table instance, 'TableName' or a Query object) <add> * @param array $settings The settings/configuration used for pagination. <ide> * @return \Cake\ORM\ResultSet Query results <ide> * @link http://book.cakephp.org/3.0/en/controllers.html#paginating-a-model <ide> * @throws \RuntimeException When no compatible table object can be found. <ide> */ <del> public function paginate($object = null) <add> public function paginate($object = null, array $settings = []) <ide> { <ide> if (is_object($object)) { <ide> $table = $object; <ide> public function paginate($object = null) <ide> if (empty($table)) { <ide> throw new RuntimeException('Unable to locate an object compatible with paginate.'); <ide> } <del> return $this->Paginator->paginate($table, $this->paginate); <add> $settings = $settings + $this->paginate; <add> return $this->Paginator->paginate($table, $settings); <ide> } <ide> <ide> /** <ide><path>src/View/Helper/PaginatorHelper.php <ide> */ <ide> namespace Cake\View\Helper; <ide> <add>use Cake\Utility\Hash; <ide> use Cake\Utility\Inflector; <ide> use Cake\View\Helper; <ide> use Cake\View\StringTemplateTrait; <ide> public function options(array $options = []) <ide> unset($options[$model]); <ide> } <ide> $this->_config['options'] = array_filter($options + $this->_config['options']); <add> if (empty($this->_config['options']['url'])) { <add> $this->_config['options']['url'] = []; <add> } <add> if (!empty($this->_config['options']['model'])) { <add> $this->defaultModel($this->_config['options']['model']); <add> } <ide> } <ide> <ide> /** <ide> public function sort($key, $title = null, array $options = []) <ide> <ide> $sortKey = $this->sortKey($options['model']); <ide> $defaultModel = $this->defaultModel(); <add> $model = Hash::get($options, 'model', $defaultModel); <add> list($table, $field) = explode('.', $key . '.'); <add> if (!$field) { <add> $field = $table; <add> $table = $model; <add> } <ide> $isSorted = ( <del> $sortKey === $key || <add> $sortKey === $table . '.' . $field || <ide> $sortKey === $defaultModel . '.' . $key || <del> $key === $defaultModel . '.' . $sortKey <add> $table . '.' . $field === $defaultModel . '.' . $sortKey <ide> ); <ide> <ide> $template = 'sort'; <ide> public function generateUrl(array $options = [], $model = null, $full = false) <ide> ]; <ide> <ide> if (!empty($this->_config['options']['url'])) { <del> $url = array_merge($url, $this->_config['options']['url']); <add> $key = implode('.', array_filter(['options.url', Hash::get($paging, 'prefix', null)])); <add> $url = array_merge($url, Hash::get($this->_config, $key, [])); <ide> } <ide> <ide> $url = array_filter($url, function ($value) { <ide> public function generateUrl(array $options = [], $model = null, $full = false) <ide> ) { <ide> $url['sort'] = $url['direction'] = null; <ide> } <add> if (!empty($paging['prefix'])) { <add> $url = [$paging['prefix'] => $url] + $this->_config['options']['url']; <add> if (empty($url[$paging['prefix']]['page'])) { <add> unset($url[$paging['prefix']]['page']); <add> } <add> } <ide> return $this->Url->build($url, $full); <ide> } <ide> <ide> protected function _hasPage($model, $page) <ide> } <ide> <ide> /** <del> * Gets the default model of the paged sets <add> * Gets or sets the default model of the paged sets <ide> * <add> * @param string|null $model Model name to set <ide> * @return string|null Model name or null if the pagination isn't initialized. <ide> */ <del> public function defaultModel() <add> public function defaultModel($model = null) <ide> { <add> if ($model !== null) { <add> $this->_defaultModel = $model; <add> } <ide> if ($this->_defaultModel) { <ide> return $this->_defaultModel; <ide> }
3
Java
Java
fix bug in compositeexception.getrootcause
621b8cda977605f91b8620a6e4e34f6c1cc89455
<ide><path>src/main/java/io/reactivex/exceptions/CompositeException.java <ide> public int size() { <ide> */ <ide> /*private */Throwable getRootCause(Throwable e) { <ide> Throwable root = e.getCause(); <del> if (root == null || cause == root) { <add> if (root == null || e == root) { <ide> return e; <ide> } <ide> while (true) { <ide><path>src/test/java/io/reactivex/exceptions/CompositeExceptionTest.java <ide> public synchronized Throwable getCause() { <ide> } <ide> }; <ide> CompositeException ex = new CompositeException(throwable); <del> assertSame(ex, ex.getRootCause(ex)); <add> assertSame(ex0, ex.getRootCause(ex)); <add> } <add> <add> @Test <add> public void rootCauseSelf() { <add> Throwable throwable = new Throwable() { <add> <add> private static final long serialVersionUID = -4398003222998914415L; <add> <add> @Override <add> public synchronized Throwable getCause() { <add> return this; <add> } <add> }; <add> CompositeException tmp = new CompositeException(new TestException()); <add> assertSame(throwable, tmp.getRootCause(throwable)); <ide> } <ide> } <ide>
2
Python
Python
add option to change default username and realm
f60c8b7d24c84cbaa2f13e3e7bd631530da83c91
<ide><path>glances/main.py <ide> def init_args(self): <ide> help='define a client/server username') <ide> parser.add_argument('--password', action='store_true', default=False, dest='password_prompt', <ide> help='define a client/server password') <add> parser.add_argument('--username-default', default=self.username, dest='username_default', <add> help='this option will be ignored if --username is specified') <add> parser.add_argument('--realm', default='glances', dest='realm', <add> help='used by Glances in web server mode when authentication is enabled') <ide> parser.add_argument('--snmp-community', default='public', dest='snmp_community', <ide> help='SNMP community') <ide> parser.add_argument('--snmp-port', default=161, type=int, <ide> def parse_args(self): <ide> description='Enter the Glances server username: ') <ide> else: <ide> # Default user name is 'glances' <del> args.username = self.username <add> args.username = args.username_default <ide> <ide> if args.password_prompt: <ide> # Interactive or file password <ide><path>glances/outputs/glances_bottle.py <ide> def __init__(self, config=None, args=None): <ide> self._app.install(EnableCors()) <ide> # Password <ide> if args.password != '': <del> self._app.install(auth_basic(self.check_auth)) <add> self._app.install(auth_basic(self.check_auth, realm=args.realm)) <ide> # Define routes <ide> self._route() <ide>
2
Python
Python
add parseerror (removing immediateresponse)
26831df88e80feb815aeb3a2b8a7c275a71732e4
<ide><path>djangorestframework/exceptions.py <add>class ParseError(Exception): <add> def __init__(self, detail): <add> self.detail = detail <ide><path>djangorestframework/parsers.py <ide> from django.http.multipartparser import MultiPartParser as DjangoMultiPartParser <ide> from django.http.multipartparser import MultiPartParserError <ide> from django.utils import simplejson as json <del>from djangorestframework import status <ide> from djangorestframework.compat import yaml <del>from djangorestframework.response import ImmediateResponse <add>from djangorestframework.exceptions import ParseError <ide> from djangorestframework.utils.mediatypes import media_type_matches <ide> from xml.etree import ElementTree as ET <ide> from djangorestframework.compat import ETParseError <ide> def parse(self, stream, meta, upload_handlers): <ide> try: <ide> return (json.load(stream), None) <ide> except ValueError, exc: <del> raise ImmediateResponse( <del> {'detail': 'JSON parse error - %s' % unicode(exc)}, <del> status=status.HTTP_400_BAD_REQUEST) <add> raise ParseError('JSON parse error - %s' % unicode(exc)) <ide> <ide> <ide> class YAMLParser(BaseParser): <ide> def parse(self, stream, meta, upload_handlers): <ide> try: <ide> return (yaml.safe_load(stream), None) <ide> except (ValueError, yaml.parser.ParserError), exc: <del> raise ImmediateResponse( <del> {'detail': 'YAML parse error - %s' % unicode(exc)}, <del> status=status.HTTP_400_BAD_REQUEST) <add> raise ParseError('YAML parse error - %s' % unicode(exc)) <ide> <ide> <ide> class PlainTextParser(BaseParser): <ide> def parse(self, stream, meta, upload_handlers): <ide> parser = DjangoMultiPartParser(meta, stream, upload_handlers) <ide> return parser.parse() <ide> except MultiPartParserError, exc: <del> raise ImmediateResponse( <del> {'detail': 'multipart parse error - %s' % unicode(exc)}, <del> status=status.HTTP_400_BAD_REQUEST) <add> raise ParseError('Multipart form parse error - %s' % unicode(exc)) <ide> <ide> <ide> class XMLParser(BaseParser): <ide> def parse(self, stream, meta, upload_handlers): <ide> try: <ide> tree = ET.parse(stream) <ide> except (ExpatError, ETParseError, ValueError), exc: <del> content = {'detail': 'XML parse error - %s' % unicode(exc)} <del> raise ImmediateResponse(content, status=status.HTTP_400_BAD_REQUEST) <add> raise ParseError('XML parse error - %s' % unicode(exc)) <ide> data = self._xml_convert(tree.getroot()) <ide> <ide> return (data, None) <ide><path>djangorestframework/views.py <ide> from djangorestframework.compat import View as DjangoView, apply_markdown <ide> from djangorestframework.response import Response, ImmediateResponse <ide> from djangorestframework.request import Request <del>from djangorestframework import renderers, parsers, authentication, permissions, status <add>from djangorestframework import renderers, parsers, authentication, permissions, status, exceptions <ide> <ide> <ide> __all__ = ( <ide> def dispatch(self, request, *args, **kwargs): <ide> <ide> except ImmediateResponse, exc: <ide> response = exc.response <add> except exceptions.ParseError as exc: <add> response = Response({'detail': exc.detail}, status=status.HTTP_400_BAD_REQUEST) <ide> <ide> self.response = self.final(request, response, *args, **kwargs) <ide> return self.response
3
Ruby
Ruby
remove more delegate methods
7d897abeccb8533d770ac1d0768eca20ec2f3971
<ide><path>activerecord/lib/active_record/associations/association_scope.rb <ide> module Associations <ide> class AssociationScope #:nodoc: <ide> attr_reader :association, :alias_tracker <ide> <del> delegate :klass, :owner, :reflection, :to => :association <del> delegate :chain, :scope_chain, :options, :to => :reflection <add> delegate :klass, :reflection, :to => :association <add> delegate :chain, :scope_chain, :to => :reflection <ide> <ide> def initialize(association) <ide> @association = association <ide> def initialize(association) <ide> <ide> def scope <ide> scope = klass.unscoped <del> scope.extending! Array(options[:extend]) <del> add_constraints(scope) <add> scope.extending! Array(reflection.options[:extend]) <add> <add> owner = association.owner <add> add_constraints(scope, owner) <ide> end <ide> <ide> def join_type <ide> def bind(scope, table_name, column_name, value) <ide> bind_value scope, column, value <ide> end <ide> <del> def add_constraints(scope) <add> def add_constraints(scope, owner) <ide> tables = construct_tables <ide> <ide> chain.each_with_index do |reflection, i| <ide> def add_constraints(scope) <ide> # Exclude the scope of the association itself, because that <ide> # was already merged in the #scope method. <ide> scope_chain[i].each do |scope_chain_item| <del> item = eval_scope(klass, scope_chain_item) <add> item = eval_scope(klass, scope_chain_item, owner) <ide> <ide> if scope_chain_item == self.reflection.scope <ide> scope.merge! item.except(:where, :includes, :bind) <ide> def table_name_for(reflection) <ide> end <ide> end <ide> <del> def eval_scope(klass, scope) <add> def eval_scope(klass, scope, owner) <ide> if scope.is_a?(Relation) <ide> scope <ide> else
1
Text
Text
use consistent term
14ffde2d8c67065a24930e0ac0844099cbc2cfa8
<ide><path>docs/sources/introduction/understanding-docker.md <ide> Docker uses a client-server architecture. The Docker *client* talks to the <ide> Docker *daemon*, which does the heavy lifting of building, running, and <ide> distributing your Docker containers. Both the Docker client and the daemon *can* <ide> run on the same system, or you can connect a Docker client to a remote Docker <del>daemon. The Docker client and service communicate via sockets or through a <add>daemon. The Docker client and daemon communicate via sockets or through a <ide> RESTful API. <ide> <ide> ![Docker Architecture Diagram](/article-img/architecture.svg)
1
Ruby
Ruby
fix default headers in test responses
f6e293ec54f02f83cdb37502bea117f66f87bcae
<ide><path>actionpack/lib/action_dispatch/http/response.rb <ide> def closed? <ide> # The underlying body, as a streamable object. <ide> attr_reader :stream <ide> <del> def initialize(status = 200, header = {}, body = []) <add> def initialize(status = 200, header = {}, body = [], default_headers: self.class.default_headers) <ide> super() <ide> <del> header = merge_default_headers(header, self.class.default_headers) <add> header = merge_default_headers(header, default_headers) <ide> <ide> self.body, self.header, self.status = body, header, status <ide> <ide> def before_sending <ide> end <ide> <ide> def merge_default_headers(original, default) <del> return original unless default.respond_to?(:merge) <del> <del> default.merge(original) <add> default.respond_to?(:merge) ? default.merge(original) : original <ide> end <ide> <ide> def build_buffer(response, body) <ide><path>actionpack/lib/action_dispatch/testing/integration.rb <ide> def process(method, path, params: nil, headers: nil, env: nil, xhr: false) <ide> @request_count += 1 <ide> @request = ActionDispatch::Request.new(session.last_request.env) <ide> response = _mock_session.last_response <del> @response = ActionDispatch::TestResponse.new(response.status, response.headers, response.body) <add> @response = ActionDispatch::TestResponse.from_response(response) <ide> @html_document = nil <ide> @url_options = nil <ide> <ide><path>actionpack/lib/action_dispatch/testing/test_response.rb <ide> module ActionDispatch <ide> # See Response for more information on controller response objects. <ide> class TestResponse < Response <ide> def self.from_response(response) <del> new.tap do |resp| <del> resp.status = response.status <del> resp.headers = response.headers <del> resp.body = response.body <del> end <add> new response.status, response.headers, response.body, default_headers: nil <ide> end <ide> <ide> # Was the response successful? <ide> def self.from_response(response) <ide> <ide> # Was there a server-side error? <ide> alias_method :error?, :server_error? <del> <del> def merge_default_headers(original, *args) <del> # Default headers are already applied, no need to merge them a second time. <del> # This makes sure that default headers, removed in controller actions, will <del> # not be reapplied to the test response. <del> original <del> end <ide> end <ide> end <ide><path>actionpack/test/controller/integration_test.rb <ide> def redirect <ide> redirect_to action_url('get') <ide> end <ide> <del> def remove_default_header <del> response.headers.except! 'X-Frame-Options' <del> head :ok <add> def remove_header <add> response.headers.delete params[:header] <add> head :ok, 'c' => '3' <ide> end <ide> end <ide> <ide> def test_https_and_port_via_process <ide> end <ide> end <ide> <del> def test_removed_default_headers_on_test_response_are_not_reapplied <add> def test_respect_removal_of_default_headers_by_a_controller_action <ide> with_test_route_set do <del> begin <del> header_to_remove = 'X-Frame-Options' <del> original_default_headers = ActionDispatch::Response.default_headers <del> ActionDispatch::Response.default_headers = { <del> 'X-Content-Type-Options' => 'nosniff', <del> header_to_remove => 'SAMEORIGIN', <del> } <del> get '/remove_default_header' <del> assert_includes headers, 'X-Content-Type-Options' <del> assert_not_includes headers, header_to_remove, "Should not contain removed default header" <del> ensure <del> ActionDispatch::Response.default_headers = original_default_headers <add> with_default_headers 'a' => '1', 'b' => '2' do <add> get '/remove_header', params: { header: 'a' } <ide> end <ide> end <add> <add> assert_not_includes @response.headers, 'a', 'Response should not include default header removed by the controller action' <add> assert_includes @response.headers, 'b' <add> assert_includes @response.headers, 'c' <ide> end <ide> <ide> private <add> def with_default_headers(headers) <add> original = ActionDispatch::Response.default_headers <add> ActionDispatch::Response.default_headers = headers <add> yield <add> ensure <add> ActionDispatch::Response.default_headers = original <add> end <add> <ide> def with_test_route_set <ide> with_routing do |set| <ide> controller = ::IntegrationProcessTest::IntegrationController.clone <ide><path>actionpack/test/controller/test_case_test.rb <ide> def test_redirect_url_only_cares_about_location_header <ide> end <ide> end <ide> <add>class ResponseDefaultHeadersTest < ActionController::TestCase <add> class TestController < ActionController::Base <add> def remove_header <add> headers.delete params[:header] <add> head :ok, 'C' => '3' <add> end <add> end <add> <add> setup do <add> @original = ActionDispatch::Response.default_headers <add> @defaults = { 'A' => '1', 'B' => '2' } <add> ActionDispatch::Response.default_headers = @defaults <add> end <add> <add> teardown do <add> ActionDispatch::Response.default_headers = @original <add> end <add> <add> def setup <add> super <add> @controller = TestController.new <add> @request = ActionController::TestRequest.new <add> @response = ActionController::TestResponse.new <add> @request.env['PATH_INFO'] = nil <add> @routes = ActionDispatch::Routing::RouteSet.new.tap do |r| <add> r.draw do <add> get ':controller(/:action(/:id))' <add> end <add> end <add> end <add> <add> test "response contains default headers" do <add> # Response headers start out with the defaults <add> assert_equal @defaults, response.headers <add> <add> get :remove_header, params: { header: 'A' } <add> assert_response :ok <add> <add> # After a request, the response in the test case doesn't have the <add> # defaults merged on top again. <add> assert_not_includes response.headers, 'A' <add> assert_includes response.headers, 'B' <add> assert_includes response.headers, 'C' <add> end <add>end <add> <ide> module EngineControllerTests <ide> class Engine < ::Rails::Engine <ide> isolate_namespace EngineControllerTests
5
Python
Python
reflect asanyarray behaviour in block
e787a9fe538156308430e0fc4692fa3bc8ff5f92
<ide><path>numpy/core/shape_base.py <ide> def _block(arrays, depth=0): <ide> list_ndim = list_ndims[0] <ide> arr_ndim = max(arr.ndim for arr in arrs) <ide> ndim = max(list_ndim, arr_ndim) <del> arrs = [_nx.array(a, ndmin=ndim) for a in arrs] <add> arrs = [array(a, ndmin=ndim, copy=False, subok=True) for a in arrs] <ide> return _nx.concatenate(arrs, axis=depth+ndim-list_ndim), list_ndim <ide> else: <ide> # We've 'bottomed out' <del> return _nx.array(arrays, ndmin=depth), depth <add> return array(arrays, ndmin=depth, copy=False, subok=True), depth <ide> <ide> <ide> def block(arrays):
1
Python
Python
remove unused var
eb9fdd04fceac322af92bd196293390270653ccd
<ide><path>rest_framework/tests/serializer.py <ide> class Meta: <ide> model = AMOAFModel <ide> <ide> self.serializer_class = AMOAFSerializer <del> self.objects = AMOAFModel.objects <ide> self.fields_attributes = { <ide> 'char_field': [ <ide> ('max_length', 1024),
1
Python
Python
optimize 2.3.0 pre-upgrade check queries
8e3d6c30e2409f56f9e4a55fe16769d23f5e3012
<ide><path>airflow/utils/db.py <ide> def _task_instance_exists(session, source_table, dag_run, task_instance): <ide> """ <ide> if 'run_id' not in task_instance.c: <ide> # db is < 2.2.0 <del> source_to_ti_join_cond = and_( <add> where_clause = and_( <ide> source_table.c.dag_id == task_instance.c.dag_id, <ide> source_table.c.task_id == task_instance.c.task_id, <ide> source_table.c.execution_date == task_instance.c.execution_date, <ide> ) <ide> ti_to_dr_join_cond = and_( <del> source_table.c.dag_id == task_instance.c.dag_id, <del> source_table.c.execution_date == task_instance.c.execution_date, <add> dag_run.c.dag_id == task_instance.c.dag_id, <add> dag_run.c.execution_date == task_instance.c.execution_date, <ide> ) <ide> else: <ide> # db is 2.2.0 <= version < 2.3.0 <del> source_to_ti_join_cond = and_( <add> where_clause = and_( <ide> source_table.c.dag_id == task_instance.c.dag_id, <ide> source_table.c.task_id == task_instance.c.task_id, <add> source_table.c.execution_date == dag_run.c.execution_date, <ide> ) <ide> ti_to_dr_join_cond = and_( <del> source_table.c.dag_id == task_instance.c.dag_id, <add> dag_run.c.dag_id == task_instance.c.dag_id, <ide> dag_run.c.run_id == task_instance.c.run_id, <del> source_table.c.execution_date == dag_run.c.execution_date, <ide> ) <ide> exists_subquery = ( <ide> session.query(text('1')) <ide> .select_from(task_instance.join(dag_run, onclause=ti_to_dr_join_cond)) <del> .filter(source_to_ti_join_cond) <add> .filter(where_clause) <ide> ) <ide> return exists_subquery <ide>
1
Ruby
Ruby
reset schema cache after test
cf0fcbe7f6fd52b3455af99b61ef2c40e6a0062e
<ide><path>activerecord/test/cases/primary_keys_test.rb <ide> def test_any_type_primary_key <ide> assert_not column.null <ide> assert_equal :string, column.type <ide> assert_equal 42, column.limit <add> ensure <add> Barcode.reset_column_information <ide> end <ide> <ide> test "schema dump primary key includes type and options" do
1
Javascript
Javascript
move module.index and index2 into modulegraph
42167db4affe764aa0d9a0e6c19e46bd4e24ca8b
<ide><path>lib/Compilation.js <ide> class Compilation { <ide> for (const module of this.modules) { <ide> module.unseal(); <ide> } <add> this.moduleGraph.removeAllModuleAttributes(); <ide> } <ide> <ide> /** <ide> class Compilation { <ide> // eachother and Blocks with Chunks. It stops traversing when all modules <ide> // for a chunk are already available. So it doesn't connect unneeded chunks. <ide> <add> const moduleGraph = this.moduleGraph; <add> <ide> /** @type {Map<ChunkGroup, {block: AsyncDependenciesBlock, chunkGroup: ChunkGroup}[]>} */ <ide> const chunkDependencies = new Map(); <ide> /** @type {Set<ChunkGroup>} */ <ide> class Compilation { <ide> chunkGroupCounters.set(chunkGroup, { index: 0, index2: 0 }); <ide> } <ide> <del> let nextFreeModuleIndex = 0; <del> let nextFreeModuleIndex2 = 0; <add> let nextFreeModulePreOrderIndex = 0; <add> let nextFreeModulePostOrderIndex = 0; <ide> <ide> /** @type {Map<DependenciesBlock, ChunkGroup>} */ <ide> const blockChunkGroups = new Map(); <ide> class Compilation { <ide> } <ide> } <ide> <del> if (module.index === null) { <del> module.index = nextFreeModuleIndex++; <add> if ( <add> moduleGraph.setPreOrderIndexIfUnset( <add> module, <add> nextFreeModulePreOrderIndex <add> ) <add> ) { <add> nextFreeModulePreOrderIndex++; <ide> } <ide> <ide> queue.push({ <ide> class Compilation { <ide> } <ide> } <ide> <del> if (module.index2 === null) { <del> module.index2 = nextFreeModuleIndex2++; <add> if ( <add> moduleGraph.setPostOrderIndexIfUnset( <add> module, <add> nextFreeModulePostOrderIndex <add> ) <add> ) { <add> nextFreeModulePostOrderIndex++; <ide> } <ide> break; <ide> } <ide><path>lib/Module.js <ide> class Module extends DependenciesBlock { <ide> /** @type {number|string} */ <ide> this.id = null; <ide> /** @type {number} */ <del> this.index = null; <del> /** @type {number} */ <del> this.index2 = null; <del> /** @type {number} */ <ide> this.depth = null; <ide> /** @type {undefined | object} */ <ide> this.profile = undefined; <ide> class Module extends DependenciesBlock { <ide> this.useSourceMap = false; <ide> } <ide> <add> get index() { <add> throw new Error(); <add> } <add> <add> get index2() { <add> throw new Error(); <add> } <add> <ide> /** <ide> * @deprecated moved to .buildInfo.exportsArgument <ide> * @returns {string} name of the exports argument <ide> class Module extends DependenciesBlock { <ide> this.renderedHash = undefined; <ide> <ide> this.id = null; <del> this.index = null; <del> this.index2 = null; <ide> this.depth = null; <ide> this.profile = undefined; <ide> this.prefetched = false; <ide> class Module extends DependenciesBlock { <ide> */ <ide> unseal() { <ide> this.id = null; <del> this.index = null; <del> this.index2 = null; <ide> this.depth = null; <ide> super.unseal(); <ide> } <ide><path>lib/ModuleGraph.js <ide> class ModuleGraphModule { <ide> this.optimizationBailout = []; <ide> /** @type {false | true | SortableSet<string> | null} */ <ide> this.usedExports = null; <add> /** @type {number} */ <add> this.preOrderIndex = null; <add> /** @type {number} */ <add> this.postOrderIndex = null; <ide> } <ide> } <ide> <ide> class ModuleGraph { <ide> connection.addExplanation(explanation); <ide> } <ide> <add> /** <add> * @param {Module} oldModule the old module <add> * @param {Module} newModule the new module <add> * @returns {void} <add> */ <add> moveModuleAttributes(oldModule, newModule) { <add> const oldMgm = this._getModuleGraphModule(oldModule); <add> const newMgm = this._getModuleGraphModule(newModule); <add> newMgm.postOrderIndex = oldMgm.postOrderIndex; <add> newMgm.preOrderIndex = oldMgm.preOrderIndex; <add> oldMgm.postOrderIndex = null; <add> oldMgm.preOrderIndex = null; <add> } <add> <add> /** <add> * @param {Module} module the module <add> * @returns {void} <add> */ <add> removeModuleAttributes(module) { <add> const mgm = this._getModuleGraphModule(module); <add> mgm.postOrderIndex = null; <add> mgm.preOrderIndex = null; <add> } <add> <add> /** <add> * @returns {void} <add> */ <add> removeAllModuleAttributes() { <add> for (const mgm of this._moduleMap.values()) { <add> mgm.postOrderIndex = null; <add> mgm.preOrderIndex = null; <add> } <add> } <add> <ide> /** <ide> * @param {Module} oldModule the old referencing module <ide> * @param {Module} newModule the new referencing module <ide> * @param {function(ModuleGraphConnection): boolean} filterConnection filter predicate for replacement <ide> * @returns {void} <ide> */ <del> replaceModule(oldModule, newModule, filterConnection) { <add> moveModuleConnections(oldModule, newModule, filterConnection) { <ide> if (oldModule === newModule) return; <ide> const oldMgm = this._getModuleGraphModule(oldModule); <ide> const newMgm = this._getModuleGraphModule(newModule); <add> // Outgoing connections <ide> const oldConnections = oldMgm.outgoingConnections; <ide> const newConnections = newMgm.outgoingConnections; <ide> for (const connection of oldConnections) { <ide> class ModuleGraph { <ide> oldConnections.delete(connection); <ide> } <ide> } <add> // Incoming connections <ide> const oldConnections2 = oldMgm.incomingConnections; <ide> const newConnections2 = newMgm.incomingConnections; <ide> for (const connection of oldConnections2) { <ide> class ModuleGraph { <ide> mgm.usedExports = usedExports; <ide> } <ide> <add> /** <add> * @param {Module} module the module <add> * @returns {number} the index of the module <add> */ <add> getPreOrderIndex(module) { <add> const mgm = this._getModuleGraphModule(module); <add> return mgm.preOrderIndex; <add> } <add> <add> /** <add> * @param {Module} module the module <add> * @returns {number} the index of the module <add> */ <add> getPostOrderIndex(module) { <add> const mgm = this._getModuleGraphModule(module); <add> return mgm.postOrderIndex; <add> } <add> <add> /** <add> * @param {Module} module the module <add> * @param {number} index the index of the module <add> * @returns {void} <add> */ <add> setPreOrderIndex(module, index) { <add> const mgm = this._getModuleGraphModule(module); <add> mgm.preOrderIndex = index; <add> } <add> <add> /** <add> * @param {Module} module the module <add> * @param {number} index the index of the module <add> * @returns {boolean} true, if the index was set <add> */ <add> setPreOrderIndexIfUnset(module, index) { <add> const mgm = this._getModuleGraphModule(module); <add> if (mgm.preOrderIndex === null) { <add> mgm.preOrderIndex = index; <add> return true; <add> } <add> return false; <add> } <add> <add> /** <add> * @param {Module} module the module <add> * @param {number} index the index of the module <add> * @returns {void} <add> */ <add> setPostOrderIndex(module, index) { <add> const mgm = this._getModuleGraphModule(module); <add> mgm.postOrderIndex = index; <add> } <add> <add> /** <add> * @param {Module} module the module <add> * @param {number} index the index of the module <add> * @returns {boolean} true, if the index was set <add> */ <add> setPostOrderIndexIfUnset(module, index) { <add> const mgm = this._getModuleGraphModule(module); <add> if (mgm.postOrderIndex === null) { <add> mgm.postOrderIndex = index; <add> return true; <add> } <add> return false; <add> } <add> <ide> /** <ide> * @param {any} thing any thing <ide> * @returns {Object} metadata <ide><path>lib/Stats.js <ide> class Stats { <ide> id: module.id, <ide> identifier: module.identifier(), <ide> name: module.readableIdentifier(requestShortener), <del> index: module.index, <del> index2: module.index2, <add> index: moduleGraph.getPreOrderIndex(module), <add> preOrderIndex: moduleGraph.getPreOrderIndex(module), <add> index2: moduleGraph.getPostOrderIndex(module), <add> postOrderIndex: moduleGraph.getPostOrderIndex(module), <ide> size: module.size(), <ide> cacheable: module.buildInfo.cacheable, <ide> built: !!module.built, <ide><path>lib/optimize/ConcatenatedModule.js <ide> class ConcatenatedModule extends Module { <ide> this.factoryMeta = rootModule.factoryMeta; <ide> <ide> // Info from Compilation <del> this.index = rootModule.index; <del> this.index2 = rootModule.index2; <ide> this.depth = rootModule.depth; <ide> <ide> // Info from Optimization <ide><path>lib/optimize/ModuleConcatenationPlugin.js <ide> class ModuleConcatenationPlugin { <ide> .getOptimizationBailout(newModule) <ide> .push(formatBailoutWarning(warning[0], warning[1])); <ide> } <add> moduleGraph.moveModuleAttributes(rootModule, newModule); <ide> for (const m of modules) { <ide> usedModules.add(m); <add> // remove attributes from module <add> moduleGraph.removeModuleAttributes(m); <ide> // remove module from chunk <ide> chunkGraph.replaceModule(m, newModule); <ide> // replace module references with the concatenated module <del> moduleGraph.replaceModule(m, newModule, c => { <add> moduleGraph.moveModuleConnections(m, newModule, c => { <ide> return !( <ide> c.dependency instanceof HarmonyImportDependency && <ide> modules.has(c.originModule) && <ide><path>lib/util/comparators.js <ide> const compareNumbers = (a, b) => { <ide> * @returns {-1|0|1} compare result <ide> */ <ide> const compareModulesByIndex = (moduleGraph, a, b) => { <del> return compareNumbers(a.index, b.index); <add> return compareNumbers( <add> moduleGraph.getPreOrderIndex(a), <add> moduleGraph.getPreOrderIndex(b) <add> ); <ide> }; <ide> /** @type {ParamizedComparator<ModuleGraph, Module>} */ <ide> exports.compareModulesByIndex = createCachedParamizedComparator( <ide> exports.compareModulesByIndex = createCachedParamizedComparator( <ide> * @returns {-1|0|1} compare result <ide> */ <ide> const compareModulesByIndex2 = (moduleGraph, a, b) => { <del> return compareNumbers(a.index2, b.index2); <add> return compareNumbers( <add> moduleGraph.getPostOrderIndex(a), <add> moduleGraph.getPostOrderIndex(b) <add> ); <ide> }; <ide> /** @type {ParamizedComparator<ModuleGraph, Module>} */ <ide> exports.compareModulesByIndex2 = createCachedParamizedComparator( <ide> exports.compareModulesByIndex2 = createCachedParamizedComparator( <ide> * @returns {-1|0|1} compare result <ide> */ <ide> const compareModulesByIndexOrIdentifier = (moduleGraph, a, b) => { <del> if (a.index < b.index) return -1; <del> if (a.index > b.index) return 1; <del> const identA = a.identifier(); <del> const identB = b.identifier(); <del> if (identA < identB) return -1; <del> if (identA > identB) return 1; <del> return 0; <add> const cmp1 = compareNumbers( <add> moduleGraph.getPreOrderIndex(a), <add> moduleGraph.getPreOrderIndex(b) <add> ); <add> if (cmp1 !== 0) return cmp1; <add> const cmp2 = compareIds(a.identifier(), b.identifier()); <add> return cmp2; <ide> }; <ide> /** @type {ParamizedComparator<ModuleGraph, Module>} */ <ide> exports.compareModulesByIndexOrIdentifier = createCachedParamizedComparator( <ide><path>test/configCases/chunk-index/order-multiple-entries/webpack.config.js <ide> module.exports = { <ide> * @returns {void} <ide> */ <ide> const handler = compilation => { <add> const moduleGraph = compilation.moduleGraph; <ide> compilation.hooks.afterSeal.tap("testcase", () => { <ide> const data = {}; <ide> for (const [name, group] of compilation.namedChunkGroups) { <ide> module.exports = { <ide> }); <ide> const indicies = compilation.modules <ide> .slice() <del> .sort((a, b) => a.index - b.index) <add> .sort( <add> (a, b) => <add> moduleGraph.getPreOrderIndex(a) - <add> moduleGraph.getPreOrderIndex(b) <add> ) <ide> .map( <ide> m => <del> `${m.index}: ${m.readableIdentifier( <add> `${moduleGraph.getPreOrderIndex(m)}: ${m.readableIdentifier( <ide> compilation.requestShortener <ide> )}` <ide> ) <ide> .join(", "); <ide> const indicies2 = compilation.modules <ide> .slice() <del> .sort((a, b) => a.index2 - b.index2) <add> .sort( <add> (a, b) => <add> moduleGraph.getPostOrderIndex(a) - <add> moduleGraph.getPostOrderIndex(b) <add> ) <ide> .map( <ide> m => <del> `${m.index2}: ${m.readableIdentifier( <add> `${moduleGraph.getPostOrderIndex(m)}: ${m.readableIdentifier( <ide> compilation.requestShortener <ide> )}` <ide> )
8
Javascript
Javascript
udpate scrollto example
e974798656eb811036970b72f064dc8a9d10b229
<ide><path>Libraries/Components/ScrollView/ScrollView.js <ide> const ScrollView = React.createClass({ <ide> * <ide> * Example: <ide> * <del> * `scrollTo({x: 0; y: 0; animated: true})` <add> * `scrollTo({x: 0, y: 0, animated: true})` <ide> * <ide> * Note: The weird function signature is due to the fact that, for historical reasons, <ide> * the function also accepts separate arguments as an alternative to the options object.
1
PHP
PHP
change redirect when authenticated
223191a9b01d779d238e2cca5e49a83c2cb550ef
<ide><path>app/Http/Middleware/RedirectIfAuthenticated.php <ide> public function __construct(Guard $auth) <ide> public function handle($request, Closure $next) <ide> { <ide> if ($this->auth->check()) { <del> return redirect('/home'); <add> return redirect('/'); <ide> } <ide> <ide> return $next($request);
1
Python
Python
update ibm sbc driver create_node docstring
b3df3c37ad6aad4807d62977c4f5154787389415
<ide><path>libcloud/compute/drivers/ibm_sbc.py <ide> def create_node(self, **kwargs): <ide> <ide> See L{NodeDriver.create_node} for more keyword args. <ide> <add> @keyword auth Name of the pubkey to use. When constructing <add> C{NodeAuthSSHKey} instance, 'pubkey' argument must be <add> the name of the public key to use. <add> You chose this name when creating a new public key on <add> the IBM server. <add> @type auth C{NodeAuthSSHKey} <add> <ide> @keyword ex_configurationData: Image-specific configuration parameters. <ide> Configuration parameters are defined in <ide> the parameters.xml file. The URL to <ide> this file is defined in the NodeImage <ide> at extra[parametersURL]. <add> <add> Note: This argument must be specified <add> when launching a Windows instance. It <add> must contain 'UserName' and 'Password' <add> keys. <ide> @type ex_configurationData: C{dict} <ide> """ <ide>
1
Python
Python
fix small pep8 problem
e295f616ec2cfee9c24b22d4be1a605a93d9544d
<ide><path>rest_framework/tests/pagination.py <ide> def test_get_paginated_root_view(self): <ide> self.assertEquals(response.data['next'], None) <ide> self.assertNotEquals(response.data['previous'], None) <ide> <add> <ide> class IntegrationTestPaginationAndFiltering(TestCase): <ide> <ide> def setUp(self):
1
Python
Python
fix example_datasets dag names
e6838c92df6904e8f8f33951108f09ed5c590c72
<ide><path>airflow/example_dags/example_datasets.py <ide> <ide> Turn on all the dags. <ide> <del>DAG example_dataset_dag1 should run because it's on a schedule. <add>DAG dataset_produces_1 should run because it's on a schedule. <ide> <del>After example_dataset_dag1 runs, example_dataset_dag3_req_dag1 should be triggered immediately <del>because its only dataset dependency is managed by example_dataset_dag1. <add>After dataset_produces_1 runs, dataset_consumes_1 should be triggered immediately <add>because its only dataset dependency is managed by dataset_produces_1. <ide> <del>No other dags should be triggered. Note that even though example_dataset_dag4_req_dag1_dag2 depends on <del>the dataset in example_dataset_dag1, it will not be triggered until example_dataset_dag2 runs <del>(and example_dataset_dag2 is left with no schedule so that we can trigger it manually). <add>No other dags should be triggered. Note that even though dataset_consumes_1_and_2 depends on <add>the dataset in dataset_produces_1, it will not be triggered until dataset_produces_2 runs <add>(and dataset_produces_2 is left with no schedule so that we can trigger it manually). <ide> <del>Next, trigger example_dataset_dag2. After example_dataset_dag2 finishes, <del>example_dataset_dag4_req_dag1_dag2 should run. <add>Next, trigger dataset_produces_2. After dataset_produces_2 finishes, <add>dataset_consumes_1_and_2 should run. <ide> <del>Dags example_dataset_dag5_req_dag1_D and example_dataset_dag6_req_DD should not run because they depend on <del>datasets that never get updated. <add>Dags dataset_consumes_1_never_scheduled and dataset_consumes_unknown_never_scheduled should not run because <add>they depend on datasets that never get updated. <ide> """ <ide> from __future__ import annotations <ide>
1
Text
Text
fix a tiny typo [ci skip]
de0c705516cf8f15f70b47e35e4117bb9d4d537c
<ide><path>guides/source/configuring.md <ide> Using Initializer Files <ide> <ide> After loading the framework and any gems in your application, Rails turns to loading initializers. An initializer is any Ruby file stored under `config/initializers` in your application. You can use initializers to hold configuration settings that should be made after all of the frameworks and gems are loaded, such as options to configure settings for these parts. <ide> <del>NOTE: There is no guarantee that your initializers will run after all the gem initilizers, so any initialization code that depends on a given gem having been initialized should go into a `config.after_initilize` block. <add>NOTE: There is no guarantee that your initializers will run after all the gem initializers, so any initialization code that depends on a given gem having been initialized should go into a `config.after_initialize` block. <ide> <ide> NOTE: You can use subfolders to organize your initializers if you like, because Rails will look into the whole file hierarchy from the initializers folder on down. <ide>
1
Ruby
Ruby
add new cpus to test
48f772c58527b13a09fd790eceb472513363542e
<ide><path>Library/Homebrew/test/hardware/cpu_spec.rb <ide> :amd_k10, <ide> :amd_k12, <ide> :arm, <add> :arm_blizzard_avalanche, <ide> :arm_firestorm_icestorm, <ide> :arm_hurricane_zephyr, <ide> :arm_lightning_thunder, <ide> :broadwell, <ide> :bulldozer, <ide> :cannonlake, <add> :cometlake, <ide> :core, <ide> :core2, <ide> :dothan,
1
Javascript
Javascript
add plane unittests
97951a622ae7931728775f6fc5f9c29c2bf5b89c
<ide><path>src/math/Plane.js <ide> function Plane( normal, constant ) { <ide> <ide> Object.assign( Plane.prototype, { <ide> <add> isPlane: true, <add> <ide> set: function ( normal, constant ) { <ide> <ide> this.normal.copy( normal ); <ide><path>test/unit/src/math/Plane.tests.js <ide> import { Plane } from '../../../../src/math/Plane'; <ide> import { Vector3 } from '../../../../src/math/Vector3'; <ide> import { Line3 } from '../../../../src/math/Line3'; <ide> import { Sphere } from '../../../../src/math/Sphere'; <add>import { Box3 } from '../../../../src/math/Box3'; <ide> import { Matrix4 } from '../../../../src/math/Matrix4'; <ide> import { <ide> x, <ide> import { <ide> zero3, <ide> one3 <ide> } from './Constants.tests'; <add>import { Cache } from '../../../../build/three'; <ide> <ide> function comparePlane( a, b, threshold ) { <ide> <ide> export default QUnit.module( 'Maths', () => { <ide> } ); <ide> <ide> // PUBLIC STUFF <del> QUnit.todo( "isPlane", ( assert ) => { <add> QUnit.test( "isPlane", ( assert ) => { <add> <add> var a = new Plane(); <add> assert.ok( a.isPlane === true, "Passed!" ); <add> <add> var b = new Vector3(); <add> assert.ok( ! b.isPlane, "Passed!" ); <ide> <del> assert.ok( false, "everything's gonna be alright" ); <ide> <ide> } ); <ide> <ide> export default QUnit.module( 'Maths', () => { <ide> <ide> } ); <ide> <del> QUnit.todo( "clone", ( assert ) => { <add> QUnit.test( "clone", ( assert ) => { <add> <add> var a = new Plane( 2.0, 0.5, 0.25 ); <add> var b = a.clone(); <add> <add> assert.ok( a.equals( b ), "clones are equal" ); <ide> <del> assert.ok( false, "everything's gonna be alright" ); <ide> <ide> } ); <ide> <ide> export default QUnit.module( 'Maths', () => { <ide> <ide> } ); <ide> <del> QUnit.todo( "intersectsBox", ( assert ) => { <del> <del> assert.ok( false, "everything's gonna be alright" ); <add> QUnit.test( "intersectsBox", ( assert ) => { <add> <add> var a = new Box3( zero3.clone(), one3.clone() ); <add> var b = new Plane( new Vector3( 0, 1, 0 ), 1 ); <add> var c = new Plane( new Vector3( 0, 1, 0 ), 1.25 ); <add> var d = new Plane( new Vector3( 0, - 1, 0 ), 1.25 ); <add> var e = new Plane( new Vector3( 0, 1, 0 ), 0.25 ); <add> var f = new Plane( new Vector3( 0, 1, 0 ), - 0.25 ); <add> var g = new Plane( new Vector3( 0, 1, 0 ), - 0.75 ); <add> var h = new Plane( new Vector3( 0, 1, 0 ), - 1 ); <add> var i = new Plane( new Vector3( 1, 1, 1 ).normalize(), - 1.732 ); <add> var j = new Plane( new Vector3( 1, 1, 1 ).normalize(), - 1.733 ); <add> <add> assert.ok( ! b.intersectsBox( a ), "Passed!" ); <add> assert.ok( ! c.intersectsBox( a ), "Passed!" ); <add> assert.ok( ! d.intersectsBox( a ), "Passed!" ); <add> assert.ok( ! e.intersectsBox( a ), "Passed!" ); <add> assert.ok( f.intersectsBox( a ), "Passed!" ); <add> assert.ok( g.intersectsBox( a ), "Passed!" ); <add> assert.ok( h.intersectsBox( a ), "Passed!" ); <add> assert.ok( i.intersectsBox( a ), "Passed!" ); <add> assert.ok( ! j.intersectsBox( a ), "Passed!" ); <ide> <ide> } ); <ide> <del> QUnit.todo( "intersectsSphere", ( assert ) => { <add> QUnit.test( "intersectsSphere", ( assert ) => { <add> <add> var a = new Sphere( zero3.clone(), 1 ); <add> var b = new Plane( new Vector3( 0, 1, 0 ), 1 ); <add> var c = new Plane( new Vector3( 0, 1, 0 ), 1.25 ); <add> var d = new Plane( new Vector3( 0, - 1, 0 ), 1.25 ); <ide> <del> assert.ok( false, "everything's gonna be alright" ); <add> assert.ok( b.intersectsSphere( a ), "Passed!" ); <add> assert.ok( ! c.intersectsSphere( a ), "Passed!" ); <add> assert.ok( ! d.intersectsSphere( a ), "Passed!" ); <ide> <ide> } ); <ide>
2
Text
Text
fix broken contributing link in line 16
fec32bbbaced5ef109916d2965f003a61f169aad
<ide><path>docs/i18n-languages/portuguese/how-to-work-on-coding-challenges.md <ide> Você pode fazer mudanças sem ter nada rodando em seu sistema local. <ide> <ide> Depois que encontrar o arquivo que deseja modificar pela interface do GitHub, clique no ícone de lápis para começar a editar. Isto ira criar um fork do projeto automaticamente, se você já não tem um. <ide> <del>Você também pode clonar o projeto e editar localmente no seu computador. Para ajuda com isso, leia o artigo [Orientações de Contribuição](/docs/portuguese/CONTRIBUTING.md). <add>Você também pode clonar o projeto e editar localmente no seu computador. Para ajuda com isso, leia o artigo [Orientações de Contribuição](/docs/i18n-languages/portuguese/CONTRIBUTING.md). <ide> <ide> ### Modelo de Desafio <ide>
1
Python
Python
add s3 links for dilbert (+fix small typo)
906581ae3c29939d62c23be43b280a24f0381898
<ide><path>pytorch_transformers/modeling_dilbert.py <ide> <ide> <ide> DILBERT_PRETRAINED_MODEL_ARCHIVE_MAP = { <del> 'dilbert-base-uncased': None, # TODO(Victor) <add> 'dilbert-base-uncased': "https://s3.amazonaws.com/models.huggingface.co/bert/dilbert-base-uncased-pytorch_model.bin" <ide> } <ide> <ide> DILBERT_PRETRAINED_CONFIG_ARCHIVE_MAP = { <del> 'dilbert-base-uncased': None, #TODO(Victor) <add> 'dilbert-base-uncased': "https://s3.amazonaws.com/models.huggingface.co/bert/dilbert-base-uncased-config.json" <ide> } <ide> <ide> <ide> def __init__(self, <ide> self.tie_weights_ = tie_weights_ <ide> else: <ide> raise ValueError("First argument must be either a vocabulary size (int)" <del> "or the path to a pretrained model config file (str)") <add> " or the path to a pretrained model config file (str)") <ide> <ide> <ide> ### UTILS AND BUILDING BLOCKS OF THE ARCHITECTURE ###
1
Python
Python
fix regression in sqlthresholdcheckoperator
87d83a1ae334951c6958689f3bb0cc09f6fc647b
<ide><path>airflow/operators/sql.py <ide> def __init__( <ide> <ide> def execute(self, context=None): <ide> hook = self.get_db_hook() <del> result = hook.get_first(self.sql)[0][0] <add> result = hook.get_first(self.sql)[0] <ide> <ide> if isinstance(self.min_threshold, float): <ide> lower_bound = self.min_threshold <ide> else: <del> lower_bound = hook.get_first(self.min_threshold)[0][0] <add> lower_bound = hook.get_first(self.min_threshold)[0] <ide> <ide> if isinstance(self.max_threshold, float): <ide> upper_bound = self.max_threshold <ide> else: <del> upper_bound = hook.get_first(self.max_threshold)[0][0] <add> upper_bound = hook.get_first(self.max_threshold)[0] <ide> <ide> meta_data = { <ide> "result": result, <ide><path>tests/operators/test_sql.py <ide> def _construct_operator(self, sql, min_threshold, max_threshold): <ide> @mock.patch.object(ThresholdCheckOperator, "get_db_hook") <ide> def test_pass_min_value_max_value(self, mock_get_db_hook): <ide> mock_hook = mock.Mock() <del> mock_hook.get_first.return_value = [(10,)] <add> mock_hook.get_first.return_value = (10,) <ide> mock_get_db_hook.return_value = mock_hook <ide> <ide> operator = self._construct_operator( <ide> def test_pass_min_value_max_value(self, mock_get_db_hook): <ide> @mock.patch.object(ThresholdCheckOperator, "get_db_hook") <ide> def test_fail_min_value_max_value(self, mock_get_db_hook): <ide> mock_hook = mock.Mock() <del> mock_hook.get_first.return_value = [(10,)] <add> mock_hook.get_first.return_value = (10,) <ide> mock_get_db_hook.return_value = mock_hook <ide> <ide> operator = self._construct_operator( <ide> def test_fail_min_value_max_value(self, mock_get_db_hook): <ide> @mock.patch.object(ThresholdCheckOperator, "get_db_hook") <ide> def test_pass_min_sql_max_sql(self, mock_get_db_hook): <ide> mock_hook = mock.Mock() <del> mock_hook.get_first.side_effect = lambda x: [(int(x.split()[1]),)] <add> mock_hook.get_first.side_effect = lambda x: (int(x.split()[1]),) <ide> mock_get_db_hook.return_value = mock_hook <ide> <ide> operator = self._construct_operator( <ide> def test_pass_min_sql_max_sql(self, mock_get_db_hook): <ide> @mock.patch.object(ThresholdCheckOperator, "get_db_hook") <ide> def test_fail_min_sql_max_sql(self, mock_get_db_hook): <ide> mock_hook = mock.Mock() <del> mock_hook.get_first.side_effect = lambda x: [(int(x.split()[1]),)] <add> mock_hook.get_first.side_effect = lambda x: (int(x.split()[1]),) <ide> mock_get_db_hook.return_value = mock_hook <ide> <ide> operator = self._construct_operator( <ide> def test_fail_min_sql_max_sql(self, mock_get_db_hook): <ide> @mock.patch.object(ThresholdCheckOperator, "get_db_hook") <ide> def test_pass_min_value_max_sql(self, mock_get_db_hook): <ide> mock_hook = mock.Mock() <del> mock_hook.get_first.side_effect = lambda x: [(int(x.split()[1]),)] <add> mock_hook.get_first.side_effect = lambda x: (int(x.split()[1]),) <ide> mock_get_db_hook.return_value = mock_hook <ide> <ide> operator = self._construct_operator("Select 75", 45, "Select 100") <ide> def test_pass_min_value_max_sql(self, mock_get_db_hook): <ide> @mock.patch.object(ThresholdCheckOperator, "get_db_hook") <ide> def test_fail_min_sql_max_value(self, mock_get_db_hook): <ide> mock_hook = mock.Mock() <del> mock_hook.get_first.side_effect = lambda x: [(int(x.split()[1]),)] <add> mock_hook.get_first.side_effect = lambda x: (int(x.split()[1]),) <ide> mock_get_db_hook.return_value = mock_hook <ide> <ide> operator = self._construct_operator("Select 155", "Select 45", 100)
2
Text
Text
add theme frameworks to wp guide
42c0da6090c6cc8e5fade3fdf21f11eeb8447a3f
<ide><path>guide/english/wordpress/theme-frameworks/index.md <add>--- <add>title: WordPress Theme Frameworks <add>--- <add> <add># WordPress Theme Frameworks <add> <add>Starting a WordPress theme from scratch and be a time consuming and intimidating process for newer developers. Ensuring that you have covered every aspect of developing a good theme can be daunting. Luckily, there is a way to jump-start your theme development and still cover your bases; theme frameworks. <add> <add>Here are a few of the more popular theme frameworks available currently. <add> <add>## Premium Frameworks <add> <add>### Genesis Framework <add> <add>Genesis Framework by StudioPress is one of the longest standing and most robust WordPress theme frameworks. This framework comes out of the box with tons of functionality build in, good SEO in mind and is very extensible. In addition to having the functionality needed to build your custom themes, there are many child themes that can be purchased to get you closer to your end result with less design and development time. <add> <add>Official Site: [https://www.studiopress.com/](https://www.studiopress.com/) <add>Cost: $59.95 <add> <add>### Thesis Framework <add> <add>The Thesis Framework by DIY Themes has been around a very long time and is one of the more well known WordPress theme frameworks. The newest version of the Thesis Framework, Thesis 2.0 brings a few new concepts including boxes, skins and site tools. <add> <add>Official Site: [http://diythemes.com/](http://diythemes.com/) <add>Cost: $87 <add> <add>## Free & Open Source Frameworks <add> <add>### Cherry Framework <add> <add>The Cherry Framework has gone through a ver revisions, but remains on of the top free WordPress theme frameworks available. It contains a robust feature set that rivals some of the other premium frameworks on the market. <add> <add>Official Site: [http://www.cherryframework.com/](http://www.cherryframework.com/) <add>Cost: FREE <add> <add>### Gantry Framework <add> <add>The Gantry Framework hails itself as the "Next Generation Theme Framework". This framework contains a large feature set that touts "no experience required" to work with. Solid concepts and a clean interface will make this framework one you should check out. <add> <add>Official Site: [http://gantry.org/](http://gantry.org/) <add>Cost: FREE
1
Javascript
Javascript
improve vm test coverage
82f6b0c25baaf581abbc30ceb9bb39da21b06a5a
<ide><path>test/parallel/test-vm-basic.js <ide> const vm = require('vm'); <ide> global <ide> ); <ide> <add> // Test compileFunction produceCachedData option <add> const result = vm.compileFunction('console.log("Hello, World!")', [], { <add> produceCachedData: true, <add> }); <add> <add> assert.ok(result.cachedDataProduced); <add> assert.ok(result.cachedData.length > 0); <add> <ide> // Resetting value <ide> Error.stackTraceLimit = oldLimit; <ide> }
1
PHP
PHP
add patterns to routeis method
315f43b55c3f9cb7f33e0b421493b519e117fc8b
<ide><path>src/Illuminate/Http/Request.php <ide> public function is() <ide> } <ide> <ide> /** <del> * Check if the route name matches the given string. <add> * Determine if the route name matches a pattern. <ide> * <del> * @param string $name <ide> * @return bool <ide> */ <del> public function routeIs($name) <add> public function routeIs() <ide> { <del> return $this->route() && $this->route()->named($name); <add> if ((! $route = $this->route()) || ! $routeName = $route->getName()) { <add> return false; <add> } <add> <add> foreach (func_get_args() as $pattern) { <add> if (Str::is($pattern, $routeName)) { <add> return true; <add> } <add> } <add> <add> return false; <ide> } <ide> <ide> /** <ide><path>tests/Http/HttpRequestTest.php <ide> public function testRouteIsMethod() <ide> }); <ide> <ide> $this->assertTrue($request->routeIs('foo.bar')); <add> $this->assertTrue($request->routeIs('foo*', '*bar')); <ide> $this->assertFalse($request->routeIs('foo.foo')); <ide> } <ide>
2
Python
Python
set version to 2.0.17.dev0
d4fa9af56f78315295a2bc265120146b2bc0b3bf
<ide><path>spacy/about.py <ide> # https://github.com/pypa/warehouse/blob/master/warehouse/__about__.py <ide> <ide> __title__ = 'spacy' <del>__version__ = '2.0.16' <add>__version__ = '2.0.17.dev0' <ide> __summary__ = 'Industrial-strength Natural Language Processing (NLP) with Python and Cython' <ide> __uri__ = 'https://spacy.io' <ide> __author__ = 'Explosion AI' <ide> __email__ = 'contact@explosion.ai' <ide> __license__ = 'MIT' <del>__release__ = True <add>__release__ = False <ide> <ide> __download_url__ = 'https://github.com/explosion/spacy-models/releases/download' <ide> __compatibility__ = 'https://raw.githubusercontent.com/explosion/spacy-models/master/compatibility.json'
1
Ruby
Ruby
remove duplicate checks
30fd4f3fe5d13f4fce9ba273580073327e17cf35
<ide><path>Library/Homebrew/diagnostic.rb <ide> def check_for_broken_symlinks <ide> EOS <ide> end <ide> <del> def __check_subdir_access(base) <del> target = HOMEBREW_PREFIX+base <del> return unless target.exist? <del> <del> cant_read = [] <del> target.find do |d| <del> next unless d.directory? <del> cant_read << d unless d.writable_real? <del> end <del> return if cant_read.empty? <del> <del> inject_file_list cant_read.sort, <<-EOS.undent <del> Some directories in #{target} aren't writable. <del> This can happen if you "sudo make install" software that isn't managed <del> by Homebrew. If a brew tries to add locale information to one of these <del> directories, then the install will fail during the link step. <add> def check_tmpdir_sticky_bit <add> world_writable = HOMEBREW_TEMP.stat.mode & 0777 == 0777 <add> return if !world_writable || HOMEBREW_TEMP.sticky? <ide> <del> You should `sudo chown -R $(whoami)` them: <add> <<-EOS.undent <add> #{HOMEBREW_TEMP} is world-writable but does not have the sticky bit set. <add> Please execute `sudo chmod +t #{HOMEBREW_TEMP}` in your Terminal. <ide> EOS <ide> end <ide> <del> def check_access_share_locale <del> __check_subdir_access "share/locale" <del> end <del> <del> def check_access_share_man <del> __check_subdir_access "share/man" <del> end <del> <ide> def check_access_homebrew_repository <ide> return if HOMEBREW_REPOSITORY.writable_real? <ide> <ide> def check_access_homebrew_repository <ide> EOS <ide> end <ide> <del> def check_access_homebrew_cellar <del> return if HOMEBREW_CELLAR.writable_real? <del> <del> <<-EOS.undent <del> #{HOMEBREW_CELLAR} is not writable. <del> <del> You should change the ownership and permissions of #{HOMEBREW_CELLAR} <del> back to your user account. <del> sudo chown -R $(whoami) #{HOMEBREW_CELLAR} <del> EOS <del> end <del> <del> def check_access_top_level_directories <add> def check_access_prefix_directories <ide> not_writable_dirs = [] <ide> <del> (Keg::TOP_LEVEL_DIRECTORIES + ["opt"]).each do |dir| <add> extra_dirs = ["lib/pkgconfig", "share/locale", "share/man", "opt"] <add> (Keg::TOP_LEVEL_DIRECTORIES + extra_dirs).each do |dir| <ide> path = HOMEBREW_PREFIX/dir <ide> next unless path.exist? <ide> next if path.writable_real? <ide> def check_access_top_level_directories <ide> The following directories are not writable: <ide> #{not_writable_dirs.join("\n")} <ide> <add> This can happen if you "sudo make install" software that isn't managed <add> by Homebrew. If a formula tries to write a file to this directory, the <add> install will fail during the link step. <add> <ide> You should change the ownership and permissions of these directories. <ide> back to your user account. <ide> sudo chown -R $(whoami) #{not_writable_dirs.join(" ")} <ide> EOS <ide> end <ide> <del> def check_tmpdir_sticky_bit <del> world_writable = HOMEBREW_TEMP.stat.mode & 0777 == 0777 <del> return if !world_writable || HOMEBREW_TEMP.sticky? <del> <del> <<-EOS.undent <del> #{HOMEBREW_TEMP} is world-writable but does not have the sticky bit set. <del> Please execute `sudo chmod +t #{HOMEBREW_TEMP}` in your Terminal. <del> EOS <del> end <del> <del> (Keg::TOP_LEVEL_DIRECTORIES + ["lib/pkgconfig"]).each do |d| <del> define_method("check_access_#{d.sub("/", "_")}") do <del> dir = HOMEBREW_PREFIX.join(d) <del> return unless dir.exist? <del> return if dir.writable_real? <del> <del> <<-EOS.undent <del> #{dir} isn't writable. <del> <del> This can happen if you "sudo make install" software that isn't managed <del> by Homebrew. If a formula tries to write a file to this directory, the <del> install will fail during the link step. <del> <del> You should change the ownership and permissions of #{dir} back to <del> your user account. <del> sudo chown -R $(whoami) #{dir} <del> EOS <del> end <del> end <del> <ide> def check_access_site_packages <ide> return unless Language::Python.homebrew_site_packages.exist? <ide> return if Language::Python.homebrew_site_packages.writable_real? <ide> def check_access_cellar <ide> EOS <ide> end <ide> <del> def check_access_prefix_opt <del> opt = HOMEBREW_PREFIX.join("opt") <del> return unless opt.exist? <del> return if opt.writable_real? <del> <del> <<-EOS.undent <del> #{opt} isn't writable. <del> <del> You should change the ownership and permissions of #{opt} <del> back to your user account. <del> sudo chown -R $(whoami) #{opt} <del> EOS <del> end <del> <ide> def check_homebrew_prefix <ide> return if HOMEBREW_PREFIX.to_s == "/usr/local" <ide> <ide><path>Library/Homebrew/test/test_diagnostic.rb <ide> def test_check_access_cellar <ide> HOMEBREW_CELLAR.chmod mod <ide> end <ide> <del> def test_check_access_prefix_opt <del> opt = HOMEBREW_PREFIX.join("opt") <del> opt.mkpath <del> opt.chmod 0555 <del> <del> assert_match "#{opt} isn't writable.", <del> @checks.check_access_prefix_opt <del> ensure <del> opt.unlink <del> end <del> <ide> def test_check_homebrew_prefix <ide> # the integration tests are run in a special prefix <ide> assert_match "Your Homebrew is not installed to /usr/local",
2
Go
Go
use object literal for stats
115b37b8f7fc5d4b674fdf76eea5790f0e4a64b7
<ide><path>daemon/daemon_unix.go <ide> func (daemon *Daemon) statsV1(s *types.StatsJSON, stats *statsV1.Metrics) (*type <ide> } <ide> <ide> if stats.Memory != nil { <del> raw := make(map[string]uint64) <del> raw["cache"] = stats.Memory.Cache <del> raw["rss"] = stats.Memory.RSS <del> raw["rss_huge"] = stats.Memory.RSSHuge <del> raw["mapped_file"] = stats.Memory.MappedFile <del> raw["dirty"] = stats.Memory.Dirty <del> raw["writeback"] = stats.Memory.Writeback <del> raw["pgpgin"] = stats.Memory.PgPgIn <del> raw["pgpgout"] = stats.Memory.PgPgOut <del> raw["pgfault"] = stats.Memory.PgFault <del> raw["pgmajfault"] = stats.Memory.PgMajFault <del> raw["inactive_anon"] = stats.Memory.InactiveAnon <del> raw["active_anon"] = stats.Memory.ActiveAnon <del> raw["inactive_file"] = stats.Memory.InactiveFile <del> raw["active_file"] = stats.Memory.ActiveFile <del> raw["unevictable"] = stats.Memory.Unevictable <del> raw["hierarchical_memory_limit"] = stats.Memory.HierarchicalMemoryLimit <del> raw["hierarchical_memsw_limit"] = stats.Memory.HierarchicalSwapLimit <del> raw["total_cache"] = stats.Memory.TotalCache <del> raw["total_rss"] = stats.Memory.TotalRSS <del> raw["total_rss_huge"] = stats.Memory.TotalRSSHuge <del> raw["total_mapped_file"] = stats.Memory.TotalMappedFile <del> raw["total_dirty"] = stats.Memory.TotalDirty <del> raw["total_writeback"] = stats.Memory.TotalWriteback <del> raw["total_pgpgin"] = stats.Memory.TotalPgPgIn <del> raw["total_pgpgout"] = stats.Memory.TotalPgPgOut <del> raw["total_pgfault"] = stats.Memory.TotalPgFault <del> raw["total_pgmajfault"] = stats.Memory.TotalPgMajFault <del> raw["total_inactive_anon"] = stats.Memory.TotalInactiveAnon <del> raw["total_active_anon"] = stats.Memory.TotalActiveAnon <del> raw["total_inactive_file"] = stats.Memory.TotalInactiveFile <del> raw["total_active_file"] = stats.Memory.TotalActiveFile <del> raw["total_unevictable"] = stats.Memory.TotalUnevictable <del> <add> raw := map[string]uint64{ <add> "cache": stats.Memory.Cache, <add> "rss": stats.Memory.RSS, <add> "rss_huge": stats.Memory.RSSHuge, <add> "mapped_file": stats.Memory.MappedFile, <add> "dirty": stats.Memory.Dirty, <add> "writeback": stats.Memory.Writeback, <add> "pgpgin": stats.Memory.PgPgIn, <add> "pgpgout": stats.Memory.PgPgOut, <add> "pgfault": stats.Memory.PgFault, <add> "pgmajfault": stats.Memory.PgMajFault, <add> "inactive_anon": stats.Memory.InactiveAnon, <add> "active_anon": stats.Memory.ActiveAnon, <add> "inactive_file": stats.Memory.InactiveFile, <add> "active_file": stats.Memory.ActiveFile, <add> "unevictable": stats.Memory.Unevictable, <add> "hierarchical_memory_limit": stats.Memory.HierarchicalMemoryLimit, <add> "hierarchical_memsw_limit": stats.Memory.HierarchicalSwapLimit, <add> "total_cache": stats.Memory.TotalCache, <add> "total_rss": stats.Memory.TotalRSS, <add> "total_rss_huge": stats.Memory.TotalRSSHuge, <add> "total_mapped_file": stats.Memory.TotalMappedFile, <add> "total_dirty": stats.Memory.TotalDirty, <add> "total_writeback": stats.Memory.TotalWriteback, <add> "total_pgpgin": stats.Memory.TotalPgPgIn, <add> "total_pgpgout": stats.Memory.TotalPgPgOut, <add> "total_pgfault": stats.Memory.TotalPgFault, <add> "total_pgmajfault": stats.Memory.TotalPgMajFault, <add> "total_inactive_anon": stats.Memory.TotalInactiveAnon, <add> "total_active_anon": stats.Memory.TotalActiveAnon, <add> "total_inactive_file": stats.Memory.TotalInactiveFile, <add> "total_active_file": stats.Memory.TotalActiveFile, <add> "total_unevictable": stats.Memory.TotalUnevictable, <add> } <ide> if stats.Memory.Usage != nil { <ide> s.MemoryStats = types.MemoryStats{ <ide> Stats: raw, <ide> func (daemon *Daemon) statsV2(s *types.StatsJSON, stats *statsV2.Metrics) (*type <ide> } <ide> <ide> if stats.Memory != nil { <del> raw := make(map[string]uint64) <del> raw["anon"] = stats.Memory.Anon <del> raw["file"] = stats.Memory.File <del> raw["kernel_stack"] = stats.Memory.KernelStack <del> raw["slab"] = stats.Memory.Slab <del> raw["sock"] = stats.Memory.Sock <del> raw["shmem"] = stats.Memory.Shmem <del> raw["file_mapped"] = stats.Memory.FileMapped <del> raw["file_dirty"] = stats.Memory.FileDirty <del> raw["file_writeback"] = stats.Memory.FileWriteback <del> raw["anon_thp"] = stats.Memory.AnonThp <del> raw["inactive_anon"] = stats.Memory.InactiveAnon <del> raw["active_anon"] = stats.Memory.ActiveAnon <del> raw["inactive_file"] = stats.Memory.InactiveFile <del> raw["active_file"] = stats.Memory.ActiveFile <del> raw["unevictable"] = stats.Memory.Unevictable <del> raw["slab_reclaimable"] = stats.Memory.SlabReclaimable <del> raw["slab_unreclaimable"] = stats.Memory.SlabUnreclaimable <del> raw["pgfault"] = stats.Memory.Pgfault <del> raw["pgmajfault"] = stats.Memory.Pgmajfault <del> raw["workingset_refault"] = stats.Memory.WorkingsetRefault <del> raw["workingset_activate"] = stats.Memory.WorkingsetActivate <del> raw["workingset_nodereclaim"] = stats.Memory.WorkingsetNodereclaim <del> raw["pgrefill"] = stats.Memory.Pgrefill <del> raw["pgscan"] = stats.Memory.Pgscan <del> raw["pgsteal"] = stats.Memory.Pgsteal <del> raw["pgactivate"] = stats.Memory.Pgactivate <del> raw["pgdeactivate"] = stats.Memory.Pgdeactivate <del> raw["pglazyfree"] = stats.Memory.Pglazyfree <del> raw["pglazyfreed"] = stats.Memory.Pglazyfreed <del> raw["thp_fault_alloc"] = stats.Memory.ThpFaultAlloc <del> raw["thp_collapse_alloc"] = stats.Memory.ThpCollapseAlloc <ide> s.MemoryStats = types.MemoryStats{ <ide> // Stats is not compatible with v1 <del> Stats: raw, <add> Stats: map[string]uint64{ <add> "anon": stats.Memory.Anon, <add> "file": stats.Memory.File, <add> "kernel_stack": stats.Memory.KernelStack, <add> "slab": stats.Memory.Slab, <add> "sock": stats.Memory.Sock, <add> "shmem": stats.Memory.Shmem, <add> "file_mapped": stats.Memory.FileMapped, <add> "file_dirty": stats.Memory.FileDirty, <add> "file_writeback": stats.Memory.FileWriteback, <add> "anon_thp": stats.Memory.AnonThp, <add> "inactive_anon": stats.Memory.InactiveAnon, <add> "active_anon": stats.Memory.ActiveAnon, <add> "inactive_file": stats.Memory.InactiveFile, <add> "active_file": stats.Memory.ActiveFile, <add> "unevictable": stats.Memory.Unevictable, <add> "slab_reclaimable": stats.Memory.SlabReclaimable, <add> "slab_unreclaimable": stats.Memory.SlabUnreclaimable, <add> "pgfault": stats.Memory.Pgfault, <add> "pgmajfault": stats.Memory.Pgmajfault, <add> "workingset_refault": stats.Memory.WorkingsetRefault, <add> "workingset_activate": stats.Memory.WorkingsetActivate, <add> "workingset_nodereclaim": stats.Memory.WorkingsetNodereclaim, <add> "pgrefill": stats.Memory.Pgrefill, <add> "pgscan": stats.Memory.Pgscan, <add> "pgsteal": stats.Memory.Pgsteal, <add> "pgactivate": stats.Memory.Pgactivate, <add> "pgdeactivate": stats.Memory.Pgdeactivate, <add> "pglazyfree": stats.Memory.Pglazyfree, <add> "pglazyfreed": stats.Memory.Pglazyfreed, <add> "thp_fault_alloc": stats.Memory.ThpFaultAlloc, <add> "thp_collapse_alloc": stats.Memory.ThpCollapseAlloc, <add> }, <ide> Usage: stats.Memory.Usage, <ide> // MaxUsage is not supported <ide> Limit: stats.Memory.UsageLimit,
1
Javascript
Javascript
use marker id as highlight key
927648d318b17d6aa0e163be289d59968805df73
<ide><path>src/text-editor-component.js <ide> class TextEditorComponent { <ide> this.addLineDecorationToRender(type, decoration, screenRange, reversed) <ide> break <ide> case 'highlight': <del> this.addHighlightDecorationToMeasure(decoration, screenRange) <add> this.addHighlightDecorationToMeasure(decoration, screenRange, marker.id) <ide> break <ide> case 'cursor': <ide> this.addCursorDecorationToMeasure(marker, screenRange, reversed) <ide> class TextEditorComponent { <ide> } <ide> } <ide> <del> addHighlightDecorationToMeasure(decoration, screenRange) { <add> addHighlightDecorationToMeasure(decoration, screenRange, key) { <ide> screenRange = constrainRangeToRows(screenRange, this.getRenderedStartRow(), this.getRenderedEndRow()) <ide> if (screenRange.isEmpty()) return <ide> <ide> class TextEditorComponent { <ide> <ide> tileHighlights.push({ <ide> screenRange: screenRangeInTile, <del> className, flashRequested, flashClass, flashDuration <add> key, className, flashRequested, flashClass, flashDuration <ide> }) <ide> <ide> this.requestHorizontalMeasurement(screenRangeInTile.start.row, screenRangeInTile.start.column) <ide> class LinesTileComponent { <ide> height: height + 'px', <ide> width: width + 'px' <ide> }, <del> }, children <add> }, children <ide> ) <ide> } <ide>
1
Javascript
Javascript
fix documentation in sproutcore-views
dc09141f4bb0c5f81774b142efacb46162b82ca1
<ide><path>lib/sproutcore-views/lib/system/application.js <ide> require("sproutcore-views/system/event_dispatcher"); <ide> <ide> /** <add> @class <add> <ide> An SC.Application instance serves as the namespace in which you define your <ide> application's classes. You can also override the configuration of your <ide> application. <ide> require("sproutcore-views/system/event_dispatcher"); <ide> <ide> You only need to specify the root if your page contains multiple instances of <ide> SC.Application. <add> <add> @since SproutCore 2.0 <add> @extends SC.Object <ide> */ <add>SC.Application = SC.Object.extend( <add>/** @scope SC.Application.prototype */{ <ide> <del>SC.Application = SC.Object.extend({ <ide> /** <ide> @type DOMElement <ide> @default document <ide> SC.Application = SC.Object.extend({ <ide> <ide> /** <ide> @type SC.EventDispatcher <add> @default null <ide> */ <ide> eventDispatcher: null, <ide> <add> /** @private */ <ide> init: function() { <ide> var eventDispatcher, <ide> rootElement = this.get('rootElement'); <ide> SC.Application = SC.Object.extend({ <ide> }); <ide> }, <ide> <add> /** @private */ <ide> destroy: function() { <ide> sc_super(); <ide> <ide><path>lib/sproutcore-views/lib/system/event_dispatcher.js <ide> // ========================================================================== <ide> <ide> /** <del> @private <add> @ignore <ide> <ide> SC.EventDispatcher handles delegating browser events to their corresponding <ide> SC.Views. For example, when you click on a view, SC.EventDispatcher ensures <ide> that that view's `mouseDown` method gets called. <ide> */ <del> <del>SC.EventDispatcher = SC.Object.extend({ <add>SC.EventDispatcher = SC.Object.extend( <add>/** @scope SC.EventDispatcher.prototype */{ <ide> <ide> /** <add> @private <add> <ide> The root DOM element to which event listeners should be attached. Event <ide> listeners will be attached to the document unless this is overridden. <ide> <ide> SC.EventDispatcher = SC.Object.extend({ <ide> rootElement: document, <ide> <ide> /** <add> @private <add> <ide> Sets up event listeners for standard browser events. <ide> <ide> This will be called after the browser sends a DOMContentReady event. By <ide> SC.EventDispatcher = SC.Object.extend({ <ide> }); <ide> }, <ide> <add> /** @private */ <ide> destroy: function() { <ide> var rootElement = this.get('rootElement'); <ide> <ide><path>lib/sproutcore-views/lib/system/render_buffer.js <ide> // License: Licensed under MIT license (see license.js) <ide> // ========================================================================== <ide> <add>/* <add> TODO Document SC.RenderBuffer class itself <add>*/ <add> <add>/** <add> @class <add> @extends SC.Object <add>*/ <ide> SC.RenderBuffer = function(tagName) { <ide> return SC._RenderBuffer.create({ elementTag: tagName }); <ide> }; <ide> <ide> SC._RenderBuffer = SC.Object.extend( <ide> /** @scope SC.RenderBuffer.prototype */ { <ide> <add> /** <add> @type Array <add> @default [] <add> */ <ide> elementClasses: null, <add> <add> /** <add> @type String <add> @default null <add> */ <ide> elementId: null, <add> <add> /** <add> @type Hash <add> @default {} <add> */ <ide> elementAttributes: null, <add> <add> /** <add> @type Array <add> @default [] <add> */ <ide> elementContent: null, <add> <add> /** <add> @type String <add> @default null <add> */ <ide> elementTag: null, <add> <add> /** <add> @type Hash <add> @default {} <add> */ <ide> elementStyle: null, <ide> <add> /** <add> @type SC.RenderBuffer <add> @default null <add> */ <ide> parentBuffer: null, <ide> <add> /** @private */ <ide> init: function() { <ide> sc_super(); <ide> <ide> SC._RenderBuffer = SC.Object.extend( <ide> this.set('elementContent', []); <ide> }, <ide> <add> /** <add> Adds a string of HTML to the RenderBuffer. <add> <add> @param {String} string HTML to push into the buffer <add> @returns {SC.RenderBuffer} this <add> */ <ide> push: function(string) { <ide> this.get('elementContent').push(string); <ide> return this; <ide> }, <ide> <add> /** <add> Adds a class to the buffer, which will be rendered to the class attribute. <add> <add> @param {String} className Class name to add to the buffer <add> @returns {SC.RenderBuffer} this <add> */ <ide> addClass: function(className) { <ide> this.get('elementClasses').pushObject(className); <ide> return this; <ide> }, <ide> <add> /** <add> Sets the elementID to be used for the element. <add> <add> @param {Strign} id <add> @returns {SC.RenderBuffer} this <add> */ <ide> id: function(id) { <ide> this.set('elementId', id); <ide> return this; <ide> }, <ide> <add> /** <add> Adds an attribute which will be rendered to the element. <add> <add> @param {String} name The name of the attribute <add> @param {String} value The value to add to the attribute <add> @returns {SC.RenderBuffer} this <add> */ <ide> attr: function(name, value) { <ide> this.get('elementAttributes')[name] = value; <ide> return this; <ide> }, <ide> <add> /** <add> Adds a style to the style attribute which will be rendered to the element. <add> <add> @param {String} name Name of the style <add> @param {String} value <add> @returns {SC.RenderBuffer} this <add> */ <ide> style: function(name, value) { <ide> this.get('elementStyle')[name] = value; <ide> return this; <ide> }, <ide> <add> /** <add> Creates a new SC.RenderBuffer object with the provided tagName as <add> the element tag and with its parentBuffer property set to the current <add> SC.RenderBuffer. <add> <add> @param {String} tagName Tag name to use for the child buffer's element <add> @returns {SC.RenderBuffer} A new RenderBuffer object <add> */ <ide> begin: function(tagName) { <ide> return SC._RenderBuffer.create({ <ide> parentBuffer: this, <ide> elementTag: tagName <ide> }); <ide> }, <ide> <add> /** <add> Closes the current buffer and adds its content to the parentBuffer. <add> <add> @returns {SC.RenderBuffer} The parentBuffer, if one exists. Otherwise, this <add> */ <ide> end: function() { <ide> var parent = this.get('parentBuffer'); <ide> <ide> SC._RenderBuffer = SC.Object.extend( <ide> } <ide> }, <ide> <add> /** <add> @returns {DOMElement} The element corresponding to the generated HTML <add> of this buffer <add> */ <ide> element: function() { <ide> return SC.$(this.string())[0]; <ide> }, <ide> <add> /** <add> Generates the HTML content for this buffer. <add> <add> @returns {String} The generated HTMl <add> */ <ide> string: function() { <ide> var id = this.get('elementId'), <ide> classes = this.get('elementClasses'), <ide> SC._RenderBuffer = SC.Object.extend( <ide> <ide> return openTag + content.join() + "</" + tag + ">"; <ide> } <add> <ide> }); <ide><path>lib/sproutcore-views/lib/views/collection_view.js <add>// ========================================================================== <add>// Project: SproutCore - JavaScript Application Framework <add>// Copyright: ©2006-2011 Strobe Inc. and contributors. <add>// Portions ©2008-2011 Apple Inc. All rights reserved. <add>// License: Licensed under MIT license (see license.js) <add>// ========================================================================== <add> <ide> require('sproutcore-views/views/view'); <ide> <del>SC.CollectionView = SC.View.extend({ <add>/** <add> @class <add> @since SproutCore 2.0 <add> @extends SC.View <add>*/ <add>SC.CollectionView = SC.View.extend( <add>/** @scope SC.CollectionView.prototype */ { <add> <ide> /** <ide> A list of items to be displayed by the SC.CollectionView. <ide> <del> @type {SC.Array} <add> @type SC.Array <add> @default null <ide> */ <ide> content: null, <ide> <ide> /** <ide> An optional view to display if content is set to an empty array. <ide> <del> @type {SC.View} <add> @type SC.View <add> @default null <ide> */ <ide> emptyView: null, <ide> <add> /** <add> @type SC.View <add> @default SC.View <add> */ <add> itemViewClass: SC.View, <add> <ide> /** <ide> @private <ide> When the view is initialized, set up array observers on the content array. <ide> <del> @returns SC.TemplateCollectionView <add> @returns {SC.TemplateCollectionView} <ide> */ <ide> init: function() { <ide> var collectionView = sc_super(); <ide> this._sctcv_contentDidChange(); <ide> return collectionView; <ide> }, <ide> <del> // In case a default content was set, trigger the child view creation <del> // as soon as the empty layer was created <add> /** <add> @private <add> <add> In case a default content was set, trigger the child view creation <add> as soon as the empty layer was created <add> */ <ide> didCreateElement: function() { <ide> var content = this.get('content'); <ide> if(content) { <ide> this.arrayContentDidChange(0, 0, content.get('length')); <ide> } <ide> }, <ide> <del> itemViewClass: SC.View, <del> <ide> /** <ide> @private <ide> <ide> SC.CollectionView = SC.View.extend({ <ide> this.arrayContentDidChange(0, oldLen, newLen); <ide> }.observes('content'), <ide> <add> /** @private */ <ide> arrayContentWillChange: function(start, removedCount, addedCount) { <ide> // If the contents were empty before and this template collection has an empty view <ide> // remove it now. <ide><path>lib/sproutcore-views/lib/views/view.js <ide> <ide> require("sproutcore-views/system/render_buffer"); <ide> <del>// Global hash of shared templates. This will automatically be populated <del>// by the build tools so that you can store your Handlebars templates in <del>// separate files that get loaded into JavaScript at buildtime. <add>/** <add> @static <add> <add> Global hash of shared templates. This will automatically be populated <add> by the build tools so that you can store your Handlebars templates in <add> separate files that get loaded into JavaScript at buildtime. <add> <add> @type SC.Object <add>*/ <ide> SC.TEMPLATES = SC.Object.create(); <ide> <add>/** <add> @class <add> @since SproutCore 2.0 <add> @extends SC.Object <add>*/ <ide> SC.View = SC.Object.extend( <ide> /** @scope SC.View.prototype */ { <ide> <ide> concatenatedProperties: ['classNames', 'classNameBindings'], <ide> <del> /** walk like a duck */ <add> /** <add> @type Boolean <add> @default YES <add> @constant <add> */ <ide> isView: YES, <ide> <ide> // .......................................................... <ide> SC.View = SC.Object.extend( <ide> shared in SC.TEMPLATES. <ide> <ide> @type String <add> @default null <ide> */ <ide> templateName: null, <ide> <ide> /** <del> The hash in which to look for +templateName+. Defaults to SC.TEMPLATES. <add> The hash in which to look for +templateName. <ide> <ide> @type SC.Object <add> @default SC.TEMPLATES <ide> */ <ide> templates: SC.TEMPLATES, <ide> <ide> SC.View = SC.Object.extend( <ide> property will point to the parent of the view. <ide> <ide> @type SC.View <add> @default null <ide> */ <ide> parentView: null, <ide> <ide> /** <ide> If false, the view will appear hidden in DOM. <ide> <ide> @type Boolean <add> @default true <ide> */ <ide> isVisible: true, <ide> <ide> /** <del> Array of child views. You should never edit this array directly unless <del> you are implementing createChildViews(). Most of the time, you should <add> Array of child views. You should never edit this array directly unless <add> you are implementing createChildViews(). Most of the time, you should <ide> use the accessor methods such as appendChild(), insertBefore() and <ide> removeChild(). <ide> <del> @property {Array} <add> @type Array <add> @default [] <ide> */ <ide> childViews: [], <ide> <ide> SC.View = SC.Object.extend( <ide> property and invoke it with the value of `templateContext`. By default, <ide> `templateContext` will be the view itself. <ide> <del> @param {SC.RenderBuffer} buffer the render buffer <add> @param {SC.RenderBuffer} buffer The render buffer <ide> */ <ide> render: function(buffer) { <ide> var template = this.get('template'); <ide> SC.View = SC.Object.extend( <ide> buffer.push(output); <ide> }, <ide> <del> /** @property <add> /** <add> @private <add> <ide> Iterates over the view's `classNameBindings` array, inserts the value <ide> of the specified property into the `classNames` array, then creates an <ide> observer to update the view's element if the bound property ever changes <ide> SC.View = SC.Object.extend( <ide> }, this); <ide> }, <ide> <del> /** @private <add> /** <add> @private <add> <ide> Given a property name, returns a dasherized version of that <ide> property name if the property evaluates to a non-falsy value. <ide> <ide> SC.View = SC.Object.extend( <ide> /** <ide> Returns the current DOM element for the view. <ide> <del> @property {DOMElement} the element <add> @field <add> @type DOMElement <ide> */ <ide> element: function(key, value) { <ide> // If the value of element is being set, just return it. SproutCore <ide> SC.View = SC.Object.extend( <ide> } <ide> }, <ide> <add> /** @private */ <ide> mutateChildViews: function(callback) { <ide> var childViews = this.get('childViews'); <ide> var idx = childViews.get('length'); <ide> SC.View = SC.Object.extend( <ide> return this; <ide> }, <ide> <add> /** @private */ <ide> forEachChildView: function(callback) { <ide> var childViews = this.get('childViews'); <ide> var len = childViews.get('length'); <ide> SC.View = SC.Object.extend( <ide> }, <ide> <ide> /** <del> The ID to use when trying to locate the layer in the DOM. If you do not <add> The ID to use when trying to locate the layer in the DOM. If you do not <ide> set the layerId explicitly, then the view's GUID will be used instead. <ide> This ID must be set at the time the view is created. <ide> <del> @property {String} <add> @type String <ide> @readOnly <ide> */ <ide> elementId: function(key, value) { <ide> SC.View = SC.Object.extend( <ide> }.property().cacheable(), <ide> <ide> /** <del> Attempts to discover the layer in the parent layer. The default <add> Attempts to discover the layer in the parent layer. The default <ide> implementation looks for an element with an ID of layerId (or the view's <del> guid if layerId is null). You can override this method to provide your <del> own form of lookup. For example, if you want to discover your layer using <add> guid if layerId is null). You can override this method to provide your <add> own form of lookup. For example, if you want to discover your layer using <ide> a CSS class name instead of an ID. <ide> <del> @param {DOMElement} parentLayer the parent's DOM layer <del> @returns {DOMElement} the discovered layer <add> @param {DOMElement} parentElement The parent's DOM layer <add> @returns {DOMElement} The discovered layer <ide> */ <ide> findElementInParentElement: function(parentElem) { <ide> var id = "#" + this.get('elementId'); <ide> return jQuery(id)[0] || jQuery(id, parentElem)[0] ; <ide> }, <ide> <ide> /** <del> Creates a new renderBuffer with the passed tagName. You can override this <del> method to provide further customization to the buffer if needed. Normally you <add> Creates a new renderBuffer with the passed tagName. You can override this <add> method to provide further customization to the buffer if needed. Normally you <ide> will not need to call or override this method. <ide> <ide> @returns {SC.RenderBuffer} <ide> SC.View = SC.Object.extend( <ide> return this ; <ide> }, <ide> <add> /** <add> Called when the element of the view is created. Override this function <add> to do any set up that requires an element. <add> */ <ide> didCreateElement: function() {}, <ide> <del> /** @private - <del> Invokes the receivers didCreateLayer() method if it exists and then <add> /** <add> @private <add> <add> Invokes the receivers didCreateElement() method if it exists and then <ide> invokes the same on all child views. <ide> */ <ide> _notifyDidCreateElement: function() { <ide> SC.View = SC.Object.extend( <ide> <ide> /** <ide> Destroys any existing layer along with the layer for any child views as <del> well. If the view does not currently have a layer, then this method will <add> well. If the view does not currently have a layer, then this method will <ide> do nothing. <ide> <del> If you implement willDestroyLayer() on your view or if any mixins <del> implement willDestroLayerMixin(), then this method will be invoked on your <add> If you implement willDestroyElement() on your view or if any mixins <add> implement willDestroElementMixin(), then this method will be invoked on your <ide> view before your layer is destroyed to give you a chance to clean up any <ide> event handlers, etc. <ide> <del> If you write a willDestroyLayer() handler, you can assume that your <del> didCreateLayer() handler was called earlier for the same layer. <add> If you write a willDestroyElement() handler, you can assume that your <add> didCreateElement() handler was called earlier for the same layer. <ide> <ide> Normally you will not call or override this method yourself, but you may <ide> want to implement the above callbacks when it is run. <ide> SC.View = SC.Object.extend( <ide> return this ; <ide> }, <ide> <add> /** <add> Called when the element of the view is going to be destroyed. Override this <add> function to do any teardown that requires an element, like removing event <add> listeners. <add> */ <ide> willDestroyElement: function() { }, <ide> <del> /** @private - <add> /** <add> @private <add> <ide> Invokes the `willDestroyElement` callback on the view and child views. <ide> */ <ide> _notifyWillDestroyElement: function() { <ide> SC.View = SC.Object.extend( <ide> }); <ide> }, <ide> <del> /** @private <add> /** <add> @private <add> <ide> If this view's element changes, we need to invalidate the caches of our <ide> child views so that we do not retain references to DOM elements that are no <ide> longer needed. <ide> SC.View = SC.Object.extend( <ide> }); <ide> }.observes('element'), <ide> <add> /** <add> Called when the parentView property has changed. <add> */ <ide> parentViewDidChange: function() { }, <ide> <ide> /** <ide> @private <ide> <ide> Renders to a buffer. <del> Rendering only happens for the initial rendering. Further updates happen in updateLayer, <add> Rendering only happens for the initial rendering. Further updates happen in updateElement, <ide> and are not done to buffers, but to elements. <ide> Note: You should not generally override nor directly call this method. This method is only <del> called by createLayer to set up the layer initially, and by renderChildViews, to write to <add> called by createElement to set up the layer initially, and by renderChildViews, to write to <ide> a buffer. <ide> <ide> @param {SC.RenderBuffer} buffer the render buffer. <ide> SC.View = SC.Object.extend( <ide> this.endPropertyChanges(); <ide> }, <ide> <add> /** <add> @private <add> */ <ide> applyAttributesToBuffer: function(buffer) { <ide> // Creates observers for all registered class name bindings, <ide> // then adds them to the classNames array. <ide> SC.View = SC.Object.extend( <ide> <ide> /** <ide> Your render method should invoke this method to render any child views, <del> especially if this is the first time the view will be rendered. This will <add> especially if this is the first time the view will be rendered. This will <ide> walk down the childView chain, rendering all of the children in a nested <ide> way. <ide> <ide> SC.View = SC.Object.extend( <ide> // <ide> <ide> /** <del> Tag name for the view's outer element. The tag name is only used when <del> a layer is first created. If you change the tagName for an element, you <del> must destroy and recreate the view layer. <add> Tag name for the view's outer element. The tag name is only used when <add> an element is first created. If you change the tagName for an element, you <add> must destroy and recreate the view element. <ide> <del> @property {String} <add> @type String <add> @default 'div' <ide> */ <ide> tagName: 'div', <ide> <ide> SC.View = SC.Object.extend( <ide> The full list of valid WAI-ARIA roles is available at: <ide> http://www.w3.org/TR/wai-aria/roles#roles_categorization <ide> <del> @property {String} <add> @type String <add> @default null <ide> */ <ide> ariaRole: null, <ide> <ide> /** <del> Standard CSS class names to apply to the view's outer element. This <add> Standard CSS class names to apply to the view's outer element. This <ide> property automatically inherits any class names defined by the view's <ide> superclasses as well. <ide> <del> @property {Array} <add> @type Array <add> @default ['sc-view'] <ide> */ <ide> classNames: ['sc-view'], <ide> <ide> SC.View = SC.Object.extend( <ide> This list of properties is inherited from the view's superclasses as well. <ide> <ide> @type Array <add> @default [] <ide> */ <ide> <ide> classNameBindings: [], <ide> SC.View = SC.Object.extend( <ide> // CORE DISPLAY METHODS <ide> // <ide> <del> /** @private <add> /** <add> @private <add> <ide> Setup a view, but do not finish waking it up. <ide> - configure childViews <ide> - Determine the view's theme <ide> SC.View = SC.Object.extend( <ide> // SC.RootResponder to dispatch incoming events. <ide> SC.View.views[this.get('elementId')] = this; <ide> <del> // setup child views. be sure to clone the child views array first <add> // setup child views. be sure to clone the child views array first <ide> this.childViews = this.get('childViews').slice(); <ide> this.classNameBindings = this.get('classNameBindings').slice(); <ide> this.classNames = this.get('classNames').slice(); <ide> SC.View = SC.Object.extend( <ide> }, <ide> <ide> /** <del> Removes the view from its parentView, if one is found. Otherwise <add> Removes the view from its parentView, if one is found. Otherwise <ide> does nothing. <ide> <ide> @returns {SC.View} receiver <ide> SC.View = SC.Object.extend( <ide> <ide> /** <ide> This method is called when your view is first created to setup any child <del> views that are already defined on your class. If any are found, it will <add> views that are already defined on your class. If any are found, it will <ide> instantiate them for you. <ide> <ide> The default implementation of this method simply steps through your <ide> SC.View = SC.Object.extend( <ide> a childViews array yourself. <ide> <ide> Note that when you implement this method yourself, you should never <del> instantiate views directly. Instead, you should use <del> this.createChildView() method instead. This method can be much faster in <add> instantiate views directly. Instead, you should use <add> this.createChildView() method instead. This method can be much faster in <ide> a production environment than creating views yourself. <ide> <ide> @returns {SC.View} receiver <ide> SC.View = SC.Object.extend( <ide> act as a child of the parent. <ide> <ide> @param {Class} viewClass <del> @param {Hash} attrs optional attributes to add <add> @param {Hash} [attrs] Attributes to add <ide> @returns {SC.View} new instance <ide> @test in createChildViews <ide> */ <ide> SC.View = SC.Object.extend( <ide> return view ; <ide> }, <ide> <del> /** @private <del> When the view's `isVisible` property changes, toggle the visibility element <del> of the actual DOM element. <add> /** <add> @private <add> <add> When the view's `isVisible` property changes, toggle the visibility element <add> of the actual DOM element. <ide> */ <ide> _isVisibleDidChange: function() { <ide> this.$().toggle(this.get('isVisible')); <ide> }.observes('isVisible') <add> <ide> }); <ide> <ide> // Create a global view hash.
5
Go
Go
protect cap access in driver()
b82101c4cc1615ae355a3e5c5383c7b2042e5be8
<ide><path>libnetwork/network.go <ide> func (n *network) driver(load bool) (driverapi.Driver, error) { <ide> <ide> c := n.getController() <ide> n.Lock() <del> n.scope = cap.DataScope <add> // If load is not required, driver, cap and err may all be nil <add> if cap != nil { <add> n.scope = cap.DataScope <add> } <ide> if c.cfg.Daemon.IsAgent { <ide> // If we are running in agent mode then all networks <ide> // in libnetwork are local scope regardless of the
1
Text
Text
fix typo in usagewithreact docs
72c11c97552581c8c0ff041a1c52d37735fe2641
<ide><path>docs/basics/UsageWithReact.md <ide> Finished reading the article? Let's recount their differences: <ide> </tbody> <ide> </table> <ide> <del>Most of the components we'll write will be presentational, but we'll need to generate a few container components to connect them to the Redux store. This and the design brief below do not imply container components must to be near the top of the component tree. If a container component becomes too complex (i.e. it has heavily nested presentional components with countless callbacks being passed down), introduce another container within the component tree as noted in the [FAQ](../faq/ReactRedux.md#react-multiple-components). <add>Most of the components we'll write will be presentational, but we'll need to generate a few container components to connect them to the Redux store. This and the design brief below do not imply container components must be near the top of the component tree. If a container component becomes too complex (i.e. it has heavily nested presentional components with countless callbacks being passed down), introduce another container within the component tree as noted in the [FAQ](../faq/ReactRedux.md#react-multiple-components). <ide> <ide> Technically you could write the container components by hand using [`store.subscribe()`](../api/Store.md#subscribe). We don't advise you to do this because React Redux makes many performance optimizations that are hard to do by hand. For this reason, rather than write container components, we will generate them using the [`connect()`](https://github.com/reactjs/react-redux/blob/master/docs/api.md#connectmapstatetoprops-mapdispatchtoprops-mergeprops-options) function provided by React Redux, as you will see below. <ide>
1
Javascript
Javascript
add a test to check typeof transformation
0d89a4540378808391cbb9f530e5b5656c3ed302
<ide><path>test/cases/parsing/issue-7318/index.js <add>const type = require("./typeof"); <add> <add>it("should not output invalid code", () => { <add> expect(type).toBe("number"); <add>}); <ide><path>test/cases/parsing/issue-7318/typeof.js <add>typeof 1 <add>module.exports = "number"
2
PHP
PHP
expand unit tests and fix issue with notempty()
1d5220916ef71f26c0d5be3af4892752ec3118f6
<ide><path>src/Validation/Validator.php <ide> public function allowEmpty($field, $mode = true) { <ide> * @return Validator this instance <ide> */ <ide> public function notEmpty($field, $message = null, $mode = false) { <add> if ($mode === 'create' || $mode === 'update') { <add> $mode = $mode === 'create' ? 'update': 'create'; <add> } <ide> $this->field($field)->isEmptyAllowed($mode); <ide> if ($message) { <ide> $this->_allowEmptyMessages[$field] = $message; <ide><path>tests/TestCase/Validation/ValidatorTest.php <ide> public function testAllowEmpty() { <ide> $this->assertSame($validator, $validator->allowEmpty('title')); <ide> $this->assertTrue($validator->field('title')->isEmptyAllowed()); <ide> <del> $validator->allowEmpty('title', 'created'); <del> $this->assertEquals('created', $validator->field('title')->isEmptyAllowed()); <add> $validator->allowEmpty('title', 'create'); <add> $this->assertEquals('create', $validator->field('title')->isEmptyAllowed()); <ide> <del> $validator->allowEmpty('title', 'updated'); <del> $this->assertEquals('updated', $validator->field('title')->isEmptyAllowed()); <add> $validator->allowEmpty('title', 'update'); <add> $this->assertEquals('update', $validator->field('title')->isEmptyAllowed()); <ide> } <ide> <ide> /** <ide> public function testNotEmpty() { <ide> $this->assertTrue($validator->field('title')->isEmptyAllowed()); <ide> } <ide> <add>/** <add> * Test the notEmpty() method. <add> * <add> * @return void <add> */ <add> public function testNotEmptyModes() { <add> $validator = new Validator; <add> $validator->notEmpty('title', 'Need a title', 'create'); <add> $this->assertFalse($validator->isEmptyAllowed('title', true)); <add> $this->assertTrue($validator->isEmptyAllowed('title', false)); <add> <add> $validator->notEmpty('title', 'Need a title', 'update'); <add> $this->assertTrue($validator->isEmptyAllowed('title', true)); <add> $this->assertFalse($validator->isEmptyAllowed('title', false)); <add> <add> $validator->notEmpty('title', 'Need a title'); <add> $this->assertFalse($validator->isEmptyAllowed('title', true)); <add> $this->assertFalse($validator->isEmptyAllowed('title', false)); <add> <add> $validator->notEmpty('title'); <add> $this->assertFalse($validator->isEmptyAllowed('title', true)); <add> $this->assertFalse($validator->isEmptyAllowed('title', false)); <add> } <add> <ide> /** <ide> * Tests the isEmptyAllowed method <ide> *
2
Python
Python
fix batchnorm momentum in resnetrs
738faf7537f35fd169c7c3aa974d7251cce35adf
<ide><path>keras/applications/resnet_rs.py <ide> def apply(inputs): <ide> <ide> <ide> def STEM( <del> bn_momentum: float = 0.0, <add> bn_momentum: float = 0.99, <ide> bn_epsilon: float = 1e-5, <ide> activation: str = "relu", <ide> name=None, <ide> def BottleneckBlock( <ide> filters: int, <ide> strides: int, <ide> use_projection: bool, <del> bn_momentum: float = 0.0, <add> bn_momentum: float = 0.99, <ide> bn_epsilon: float = 1e-5, <ide> activation: str = "relu", <ide> se_ratio: float = 0.25, <ide> def BlockGroup( <ide> num_repeats, <ide> se_ratio: float = 0.25, <ide> bn_epsilon: float = 1e-5, <del> bn_momentum: float = 0.0, <add> bn_momentum: float = 0.99, <ide> activation: str = "relu", <ide> survival_probability: float = 0.8, <ide> name=None, <ide> def fixed_padding(inputs, kernel_size): <ide> def ResNetRS( <ide> depth: int, <ide> input_shape=None, <del> bn_momentum=0.0, <add> bn_momentum=0.99, <ide> bn_epsilon=1e-5, <ide> activation: str = "relu", <ide> se_ratio=0.25,
1
PHP
PHP
add update + join support
d31a75055c6ff7b5633af2a9971cc47ae4f9067e
<ide><path>lib/Cake/Database/Query.php <ide> protected function _traverseDelete(callable $visitor) { <ide> * @return void <ide> */ <ide> protected function _traverseUpdate(callable $visitor) { <del> $parts = ['update', 'set', 'where']; <add> $parts = ['update', 'join', 'set', 'where']; <ide> foreach ($parts as $name) { <ide> call_user_func($visitor, $this->_parts[$name], $name); <ide> } <ide><path>lib/Cake/Test/TestCase/Database/QueryTest.php <ide> public function testUpdateWithExpression() { <ide> $this->assertCount(1, $result); <ide> } <ide> <add>/** <add> * Test updates with joins. <add> * <add> * @return void <add> */ <add> public function testUpdateWithJoins() { <add> $query = new Query($this->connection); <add> <add> $query->update('articles') <add> ->set('title', 'New title') <add> ->join([ <add> 'table' => 'authors', <add> 'alias' => 'a', <add> 'conditions' => 'author_id = a.id' <add> ]) <add> ->where(['articles.id' => 1]); <add> $result = $query->sql(false); <add> <add> $this->assertContains('UPDATE articles INNER JOIN authors a ON author_id = a.id', $result); <add> $this->assertContains('SET title = :', $result); <add> $this->assertContains('WHERE articles.id = :', $result); <add> <add> $result = $query->execute(); <add> $this->assertCount(1, $result); <add> } <add> <ide> /** <ide> * You cannot call values() before insert() it causes all sorts of pain. <ide> *
2
Text
Text
add link to thunk page in info boxes
c0991c60a51927e73d73ff03b40c9fd3a56d9890
<ide><path>docs/tutorials/essentials/part-5-async-logic.md <ide> store.dispatch(logAndAdd(5)) <ide> <ide> Thunks are typically written in "slice" files. `createSlice` itself does not have any special support for defining thunks, so you should write them as separate functions in the same slice file. That way, they have access to the plain action creators for that slice, and it's easy to find where the thunk lives. <ide> <add>:::info <add> <add>The word "thunk" is a programming term that means ["a piece of code that does some delayed work"](https://en.wikipedia.org/wiki/Thunk). For more details on how to use thunks, see the thunk usage guide page: <add> <add>- [Using Redux: Writing Logic with Thunks](../../usage/writing-logic-thunks.mdx) <add> <add>as well as these posts: <add> <add>- [What the heck is a thunk?](https://daveceddia.com/what-is-a-thunk/) <add>- [Thunks in Redux: the basics](https://medium.com/fullstack-academy/thunks-in-redux-the-basics-85e538a3fe60) <add> <add>::: <add> <ide> ### Writing Async Thunks <ide> <ide> Thunks may have async logic inside of them, such as `setTimeout`, `Promise`s, and `async/await`. This makes them a good place to put AJAX calls to a server API. <ide><path>docs/tutorials/fundamentals/part-6-async-logic.md <ide> As it turns out, Redux already has an official version of that "async function m <ide> <ide> :::info <ide> <del>The word "thunk" is a programming term that means ["a piece of code that does some delayed work"](https://en.wikipedia.org/wiki/Thunk). For more details, see these posts: <add>The word "thunk" is a programming term that means ["a piece of code that does some delayed work"](https://en.wikipedia.org/wiki/Thunk). For more details on how to use thunks, see the thunk usage guide page: <add> <add>- [Using Redux: Writing Logic with Thunks](../../usage/writing-logic-thunks.mdx) <add> <add>as well as these posts: <ide> <ide> - [What the heck is a thunk?](https://daveceddia.com/what-is-a-thunk/) <ide> - [Thunks in Redux: the basics](https://medium.com/fullstack-academy/thunks-in-redux-the-basics-85e538a3fe60)
2
Ruby
Ruby
use kwargs instead of xhr method. refs
37b36a48b9956afebb030bdffdf42e0e20f92aff
<ide><path>actionview/test/actionpack/controller/render_test.rb <ide> def test_accessing_local_assigns_in_inline_template <ide> end <ide> <ide> def test_should_implicitly_render_html_template_from_xhr_request <del> xhr :get, :render_implicit_html_template_from_xhr_request <add> get :render_implicit_html_template_from_xhr_request, xhr: true <ide> assert_equal "XHR!\nHello HTML!", @response.body <ide> end <ide> <ide> def test_should_implicitly_render_js_template_without_layout <del> xhr :get, :render_implicit_js_template_without_layout, :format => :js <add> get :render_implicit_js_template_without_layout, format: :js, xhr: true <ide> assert_no_match %r{<html>}, @response.body <ide> end <ide>
1
Javascript
Javascript
call setnativeview anytime node changes
1b1b26a099cc2f213bb270bfc0e56a202e618638
<ide><path>Libraries/Animated/useAnimatedProps.js <ide> export default function useAnimatedProps<TProps: {...}, TInstance>( <ide> ): [ReducedProps<TProps>, CallbackRef<TInstance | null>] { <ide> const [, scheduleUpdate] = useReducer<number, void>(count => count + 1, 0); <ide> const onUpdateRef = useRef<?() => void>(null); <add> const cachedRef = useRef<TInstance | null>(null); <ide> <ide> // TODO: Only invalidate `node` if animated props or `style` change. In the <ide> // previous implementation, we permitted `style` to override props with the <ide> export default function useAnimatedProps<TProps: {...}, TInstance>( <ide> // NOTE: This may be called more often than necessary (e.g. when `props` <ide> // changes), but `setNativeView` already optimizes for that. <ide> node.setNativeView(instance); <add> cachedRef.current = instance; <ide> <ide> // NOTE: This callback is only used by the JavaScript animation driver. <ide> onUpdateRef.current = () => { <ide> export default function useAnimatedProps<TProps: {...}, TInstance>( <ide> ); <ide> const callbackRef = useRefEffect<TInstance>(refEffect); <ide> <add> useEffect(() => { <add> // Call `setNativeView` any time `node` changes to make sure <add> // `AnimatedProps._animatedView` is up to date. <add> // This would not be necessary in an ideal world. <add> // In React, anytime identity of function passed to `ref` changes, <add> // the old function is called with null and the new function is called with value. <add> // ScrollView does not behave like this and this workaround is necessary. <add> node.setNativeView(cachedRef.current); <add> }, [node]); <add> <ide> return [reduceAnimatedProps<TProps>(node), callbackRef]; <ide> } <ide>
1
Ruby
Ruby
handle more exceptions
f9fda0ffcccccd40dce72f01be8239e2b66266c4
<ide><path>Library/Homebrew/formula.rb <ide> def self.installed <ide> @installed ||= racks.flat_map do |rack| <ide> begin <ide> Formulary.from_rack(rack) <del> rescue FormulaUnavailableError, TapFormulaAmbiguityError, TapFormulaWithOldnameAmbiguityError <add> rescue <ide> [] <ide> end <ide> end.uniq(&:name)
1
Text
Text
add nodejitsu deployment instructions
0494710b52e2048adda0f4558cc206b29c8c2fd4
<ide><path>README.md <ide> Add this to `package.json`, after *name* and *version*. This is necessary becaus <ide> - And you are done! (Not quite as simple as Heroku, huh?) <ide> <ide> <img src="https://www.nodejitsu.com/img/media/nodejitsu-transparent.png" width="200"> <add>- To install **jitsu**, open a terminal and type: `sudo npm install -g jitsu` <add>- Run `jitsu login` and enter your login credentials <add>- From your app directory, run `jitsu deploy` <add> - This will create a new application snapshot, generate and/or update project metadata <add>- Done! <ide> <ide> TODO: Will be added soon. <ide>
1
Java
Java
fix visibility of defaultsockjsschedulercontainer
67b7c16bc0b5e9f21d38173676d52db4541a997f
<ide><path>spring-websocket/src/main/java/org/springframework/web/socket/config/annotation/WebSocketConfigurationSupport.java <ide> private ThreadPoolTaskScheduler initDefaultSockJsScheduler() { <ide> } <ide> <ide> <del> private static class DefaultSockJsSchedulerContainer implements InitializingBean, DisposableBean { <add> static class DefaultSockJsSchedulerContainer implements InitializingBean, DisposableBean { <ide> <ide> @Nullable <ide> private final ThreadPoolTaskScheduler scheduler;
1
PHP
PHP
fix bug in redirect
b625ebdcf316bbae9eb752246a066693ba00490f
<ide><path>laravel/redirect.php <ide> public function with($key, $value) <ide> */ <ide> public static function __callStatic($method, $parameters) <ide> { <del> $parameters = (isset($parameters[0])) ? $parameters[0] : array(); <del> <ide> $status = (isset($parameters[1])) ? $parameters[1] : 302; <add> <add> $parameters = (isset($parameters[0])) ? $parameters[0] : array(); <ide> <ide> if (strpos($method, 'to_secure_') === 0) <ide> {
1
Javascript
Javascript
remove extra quotes in example
00815db8ef1a54e331b301ee3604d47e75c49d46
<ide><path>src/ng/directive/ngModelOptions.js <ide> defaultModelOptions = new ModelOptions({ <ide> * <ide> * The `ngModelOptions` settings are found by evaluating the value of the attribute directive as <ide> * an AngularJS expression. This expression should evaluate to an object, whose properties contain <del> * the settings. For example: `<div "ng-model-options"="{ debounce: 100 }"`. <add> * the settings. For example: `<div ng-model-options="{ debounce: 100 }"`. <ide> * <ide> * ## Inheriting Options <ide> *
1
Text
Text
add example to apparmor docs
80d63e2e112c75b1cc492ce52bdc0c61ef3c234c
<ide><path>docs/security/apparmor.md <ide> Docker automatically loads container profiles. The Docker binary installs <ide> a `docker-default` profile in the `/etc/apparmor.d/docker` file. This profile <ide> is used on containers, _not_ on the Docker Daemon. <ide> <del>A profile for the Docker Engine Daemon exists but it is not currently installed <del>with the deb packages. If you are interested in the source for the Daemon <add>A profile for the Docker Engine daemon exists but it is not currently installed <add>with the `deb` packages. If you are interested in the source for the daemon <ide> profile, it is located in <ide> [contrib/apparmor](https://github.com/docker/docker/tree/master/contrib/apparmor) <ide> in the Docker Engine source repository. <ide> explicitly specifies the default policy: <ide> $ docker run --rm -it --security-opt apparmor=docker-default hello-world <ide> ``` <ide> <del>## Loading and Unloading Profiles <add>## Load and unload profiles <ide> <del>To load a new profile into AppArmor, for use with containers: <add>To load a new profile into AppArmor for use with containers: <ide> <del>``` <add>```bash <ide> $ apparmor_parser -r -W /path/to/your_profile <ide> ``` <ide> <del>Then you can run the custom profile with `--security-opt` like so: <add>Then, run the custom profile with `--security-opt` like so: <ide> <ide> ```bash <ide> $ docker run --rm -it --security-opt apparmor=your_profile hello-world <ide> $ apparmor_parser -R /path/to/profile <ide> $ /etc/init.d/apparmor start <ide> ``` <ide> <del>## Debugging AppArmor <add>### Resources for writing profiles <add> <add>The syntax for file globbing in AppArmor is a bit different than some other <add>globbing implementations. It is highly suggested you take a look at some of the <add>below resources with regard to AppArmor profile syntax. <add> <add>- [Quick Profile Language](http://wiki.apparmor.net/index.php/QuickProfileLanguage) <add>- [Globbing Syntax](http://wiki.apparmor.net/index.php/AppArmor_Core_Policy_Reference#AppArmor_globbing_syntax) <add> <add>## Nginx example profile <add> <add>In this example, you create a custom AppArmor profile for Nginx. Below is the <add>custom profile. <add> <add>``` <add>#include <tunables/global> <add> <add> <add>profile docker-nginx flags=(attach_disconnected,mediate_deleted) { <add> #include <abstractions/base> <add> <add> network inet tcp, <add> network inet udp, <add> network inet icmp, <add> <add> deny network raw, <add> <add> deny network packet, <add> <add> file, <add> umount, <add> <add> deny /bin/** wl, <add> deny /boot/** wl, <add> deny /dev/** wl, <add> deny /etc/** wl, <add> deny /home/** wl, <add> deny /lib/** wl, <add> deny /lib64/** wl, <add> deny /media/** wl, <add> deny /mnt/** wl, <add> deny /opt/** wl, <add> deny /proc/** wl, <add> deny /root/** wl, <add> deny /sbin/** wl, <add> deny /srv/** wl, <add> deny /tmp/** wl, <add> deny /sys/** wl, <add> deny /usr/** wl, <add> <add> audit /** w, <add> <add> /var/run/nginx.pid w, <add> <add> /usr/sbin/nginx ix, <add> <add> deny /bin/dash mrwklx, <add> deny /bin/sh mrwklx, <add> deny /usr/bin/top mrwklx, <add> <add> <add> capability chown, <add> capability dac_override, <add> capability setuid, <add> capability setgid, <add> capability net_bind_service, <add> <add> deny @{PROC}/{*,**^[0-9*],sys/kernel/shm*} wkx, <add> deny @{PROC}/sysrq-trigger rwklx, <add> deny @{PROC}/mem rwklx, <add> deny @{PROC}/kmem rwklx, <add> deny @{PROC}/kcore rwklx, <add> deny mount, <add> deny /sys/[^f]*/** wklx, <add> deny /sys/f[^s]*/** wklx, <add> deny /sys/fs/[^c]*/** wklx, <add> deny /sys/fs/c[^g]*/** wklx, <add> deny /sys/fs/cg[^r]*/** wklx, <add> deny /sys/firmware/efi/efivars/** rwklx, <add> deny /sys/kernel/security/** rwklx, <add>} <add>``` <add> <add>1. Save the custom profile to disk in the <add>`/etc/apparmor.d/containers/docker-nginx` file. <add> <add> The file path in this example is not a requirement. In production, you could <add> use another. <add> <add>2. Load the profile. <add> <add> ```bash <add> $ sudo apparmor_parser -r -W /etc/apparmor.d/containers/docker-nginx <add> ``` <add> <add>3. Run a container with the profile. <add> <add> To run nginx in detached mode: <add> <add> ```bash <add> $ docker run --security-opt "apparmor=docker-nginx" \ <add> -p 80:80 -d --name apparmor-nginx nginx <add> ``` <add> <add>4. Exec into the running container <add> <add> ```bash <add> $ docker exec -it apparmor-nginx bash <add> ``` <add> <add>5. Try some operations to test the profile. <add> <add> ```bash <add> root@6da5a2a930b9:~# ping 8.8.8.8 <add> ping: Lacking privilege for raw socket. <add> <add> root@6da5a2a930b9:/# top <add> bash: /usr/bin/top: Permission denied <add> <add> root@6da5a2a930b9:~# touch ~/thing <add> touch: cannot touch 'thing': Permission denied <add> <add> root@6da5a2a930b9:/# sh <add> bash: /bin/sh: Permission denied <add> <add> root@6da5a2a930b9:/# dash <add> bash: /bin/dash: Permission denied <add> ``` <add> <add> <add>Congrats! You just deployed a container secured with a custom apparmor profile! <add> <add> <add>## Debug AppArmor <add> <add>You can use `demsg` to debug problems and `aa-status` check the loaded profiles. <ide> <del>### Using `dmesg` <add>### Use dmesg <ide> <ide> Here are some helpful tips for debugging any problems you might be facing with <ide> regard to AppArmor. <ide> <ide> AppArmor sends quite verbose messaging to `dmesg`. Usually an AppArmor line <del>will look like the following: <add>looks like the following: <ide> <ide> ``` <ide> [ 5442.864673] audit: type=1400 audit(1453830992.845:37): apparmor="ALLOWED" operation="open" profile="/usr/bin/docker" name="/home/jessie/docker/man/man1/docker-attach.1" pid=10923 comm="docker" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0 <ide> ``` <ide> <del>In the above example, the you can see `profile=/usr/bin/docker`. This means the <add>In the above example, you can see `profile=/usr/bin/docker`. This means the <ide> user has the `docker-engine` (Docker Engine Daemon) profile loaded. <ide> <ide> > **Note:** On version of Ubuntu > 14.04 this is all fine and well, but Trusty <ide> > users might run into some issues when trying to `docker exec`. <ide> <del>Let's look at another log line: <add>Look at another log line: <ide> <ide> ``` <ide> [ 3256.689120] type=1400 audit(1405454041.341:73): apparmor="DENIED" operation="ptrace" profile="docker-default" pid=17651 comm="docker" requested_mask="receive" denied_mask="receive" <ide> ``` <ide> <ide> This time the profile is `docker-default`, which is run on containers by <del>default unless in `privileged` mode. It is telling us, that apparmor has denied <del>`ptrace` in the container. This is great. <add>default unless in `privileged` mode. This line shows that apparmor has denied <add>`ptrace` in the container. This is exactly as expected. <ide> <del>### Using `aa-status` <add>### Use aa-status <ide> <del>If you need to check which profiles are loaded you can use `aa-status`. The <add>If you need to check which profiles are loaded, you can use `aa-status`. The <ide> output looks like: <ide> <ide> ```bash <ide> apparmor module is loaded. <ide> 0 processes are unconfined but have a profile defined. <ide> ``` <ide> <del>In the above output you can tell that the `docker-default` profile running on <del>various container PIDs is in `enforce` mode. This means AppArmor will actively <del>block and audit in `dmesg` anything outside the bounds of the `docker-default` <add>The above output shows that the `docker-default` profile running on various <add>container PIDs is in `enforce` mode. This means AppArmor is actively blocking <add>and auditing in `dmesg` anything outside the bounds of the `docker-default` <ide> profile. <ide> <del>The output above also shows the `/usr/bin/docker` (Docker Engine Daemon) <del>profile is running in `complain` mode. This means AppArmor will _only_ log to <del>`dmesg` activity outside the bounds of the profile. (Except in the case of <del>Ubuntu Trusty, where we have seen some interesting behaviors being enforced.) <add>The output above also shows the `/usr/bin/docker` (Docker Engine daemon) profile <add>is running in `complain` mode. This means AppArmor _only_ logs to `dmesg` <add>activity outside the bounds of the profile. (Except in the case of Ubuntu <add>Trusty, where some interesting behaviors are enforced.) <ide> <del>## Contributing to AppArmor code in Docker <add>## Contribute Docker's AppArmor code <ide> <ide> Advanced users and package managers can find a profile for `/usr/bin/docker` <ide> (Docker Engine Daemon) underneath
1
Java
Java
prevent instantiation of annotatedelementutils
28e402bc762369cdbea7accf0eb2c5e16818fe14
<ide><path>spring-core/src/main/java/org/springframework/core/annotation/AnnotatedElementUtils.java <ide> * @see AnnotationUtils <ide> * @see BridgeMethodResolver <ide> */ <del>public class AnnotatedElementUtils { <add>public abstract class AnnotatedElementUtils { <ide> <ide> /** <ide> * {@code null} constant used to denote that the search algorithm should continue.
1
Javascript
Javascript
remove extraneous "dx" attribute
e5ae048b613f98b96ae8e6c7493516c6d1d07512
<ide><path>examples/tree/tree-radial.js <ide> d3.json("../data/flare.json", function(json) { <ide> .attr("r", 4.5); <ide> <ide> node.append("text") <del> .attr("dx", function(d) { return d.x < 180 ? 8 : -8; }) <ide> .attr("dy", ".31em") <ide> .attr("text-anchor", function(d) { return d.x < 180 ? "start" : "end"; }) <ide> .attr("transform", function(d) { return d.x < 180 ? "translate(8)" : "rotate(180)translate(-8)"; })
1
Javascript
Javascript
replace smart-quotes with regular quotes
fd6e5e3f31f374de7be7c80acaa766a14cb753db
<ide><path>gdocs.js <ide> function download(name, url) { <ide> // strip out all text annotations <ide> data = data.replace(/\[\w{1,3}\]/mg, ''); <ide> <add> // fix smart-quotes <add> data = data.replace(/[“”]/g, '"'); <add> data = data.replace(/[‘’]/g, "'"); <add> <add> <ide> data = data + '\n'; <ide> fs.writeFileSync('docs/' + name, reflow(data, 100)); <ide> } <ide><path>src/Injector.js <ide> function angularServiceInject(name, fn, inject, eager) { <ide> * extracting all arguments which start with $ or end with _ as the <ide> * injection names. <ide> */ <del>var FN_ARGS = /^function [^\(]*\(([^\)]*)\)/; <add>var FN_ARGS = /^function\s*[^\(]*\(([^\)]*)\)/; <ide> var FN_ARG_SPLIT = /,/; <ide> var FN_ARG = /^\s*(((\$?).+?)(_?))\s*$/; <ide> var STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg; <ide><path>test/InjectorSpec.js <ide> describe('injector', function(){ <ide> fn.$inject = ['a']; <ide> expect(injectionArgs(fn)).toBe(fn.$inject); <ide> expect(injectionArgs(function(){})).toEqual([]); <add> expect(injectionArgs(function (){})).toEqual([]); <add> expect(injectionArgs(function (){})).toEqual([]); <add> expect(injectionArgs(function /* */ (){})).toEqual([]); <ide> }); <ide> <ide> it('should create $inject', function(){ <ide> // keep the multi-line to make sure we can handle it <del> function $f_n0( <add> function $f_n0 /* <add> */( <ide> $a, // x, <-- looks like an arg but it is a comment <ide> b_, /* z, <-- looks like an arg but it is a <ide> multi-line comment
3
PHP
PHP
use strict types for helperregistry
8aa666d89f2896e56ac1edec153d455211195fae
<ide><path>src/View/HelperRegistry.php <ide> <?php <add>declare(strict_types=1); <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <ide> public function __construct(View $view) <ide> * @throws \Cake\View\Exception\MissingHelperException When a helper could not be found. <ide> * App helpers are searched, and then plugin helpers. <ide> */ <del> public function __isset(string $helper): bool <add> public function __isset(string $helper) <ide> { <ide> if (isset($this->_loaded[$helper])) { <ide> return true;
1
PHP
PHP
add an authorizable contract
b1c79a9a8478b8950d1d23ffbea7eaba3dfc1d2e
<ide><path>src/Illuminate/Contracts/Auth/Access/Authorizable.php <add><?php <add> <add>namespace Illuminate\Contracts\Auth\Access; <add> <add>interface Authorizable <add>{ <add> /** <add> * Determine if the entity has a given ability. <add> * <add> * @param string $ability <add> * @param array|mixed $arguments <add> * @return bool <add> */ <add> public function can($ability, $arguments = []); <add>}
1
Text
Text
add missing introduced_in comments
97ba69f91543f89d389a4f3fef57c5c6c734df34
<ide><path>doc/api/async_hooks.md <ide> # Async Hooks <ide> <add><!--introduced_in=v8.1.0--> <add> <ide> > Stability: 1 - Experimental <ide> <ide> The `async_hooks` module provides an API to register callbacks tracking the <ide><path>doc/api/deprecations.md <ide> # Deprecated APIs <ide> <add><!--introduced_in=v7.7.0--> <add> <ide> Node.js may deprecate APIs when either: (a) use of the API is considered to be <ide> unsafe, (b) an improved alternative API has been made available, or (c) <ide> breaking changes to the API are expected in a future major release. <ide><path>doc/api/esm.md <ide> # ECMAScript Modules <ide> <del><!--introduced_in=v9.x.x--> <add><!--introduced_in=v8.5.0--> <ide> <ide> > Stability: 1 - Experimental <ide> <ide><path>doc/api/http2.md <ide> # HTTP2 <ide> <add><!--introduced_in=v8.4.0--> <add> <ide> > Stability: 1 - Experimental <ide> <ide> The `http2` module provides an implementation of the [HTTP/2][] protocol. It <ide><path>doc/api/inspector.md <ide> # Inspector <ide> <add><!--introduced_in=v8.0.0--> <add> <ide> > Stability: 1 - Experimental <ide> <ide> The `inspector` module provides an API for interacting with the V8 inspector. <ide><path>doc/api/intl.md <ide> # Internationalization Support <ide> <add><!--introduced_in=v8.2.0--> <add> <ide> Node.js has many features that make it easier to write internationalized <ide> programs. Some of them are: <ide> <ide><path>doc/api/n-api.md <ide> # N-API <ide> <add><!--introduced_in=v7.10.0--> <add> <ide> > Stability: 1 - Experimental <ide> <ide> N-API (pronounced N as in the letter, followed by API) <ide><path>doc/api/perf_hooks.md <ide> # Performance Timing API <del><!-- YAML <del>added: v8.5.0 <del>--> <add> <add><!--introduced_in=v8.5.0--> <ide> <ide> > Stability: 1 - Experimental <ide> <ide><path>doc/api/tracing.md <ide> # Tracing <ide> <add><!--introduced_in=v7.7.0--> <add> <ide> Trace Event provides a mechanism to centralize tracing information generated by <ide> V8, Node core, and userspace code. <ide>
9
Python
Python
add regression test for ticket #608
5db434d7e1bb1ed11a505c5e7ce8ee7392704211
<ide><path>numpy/core/tests/test_regression.py <ide> def check_flat_byteorder(self, level=rlevel): <ide> def check_uint64_from_negative(self, level=rlevel) : <ide> assert_equal(np.uint64(-2), np.uint64(18446744073709551614)) <ide> <add> def check_sign_bit(self, level=rlevel): <add> x = np.array([0,-0.0,0]) <add> assert_equal(str(np.abs(x)),'[ 0. 0. 0.]') <add> <ide> if __name__ == "__main__": <ide> NumpyTest().run()
1
Javascript
Javascript
assign external user points when validated
238657d3560d411b80b470f255e54ea3421ec73e
<ide><path>server/middlewares/jwt-authorization.js <ide> export default () => function authorizeByJWT(req, res, next) { <ide> return User.findById(userId) <ide> .then(user => { <ide> if (user) { <add> user.points = user.progressTimestamps.length; <ide> req.user = user; <ide> } <ide> return;
1
PHP
PHP
remove a param
4ed0f54e3eb01cc8fa17ec74711154e440b01e29
<ide><path>lib/Cake/Routing/Route/Route.php <ide> public function match($url, $context = array()) { <ide> } <ide> } <ide> } <del> return $this->_writeUrl($url, $pass, $hostOptions, $query); <add> $url += $hostOptions; <add> return $this->_writeUrl($url, $pass, $query); <ide> } <ide> <ide> /** <ide> public function match($url, $context = array()) { <ide> * @param array $pass The additional passed arguments. <ide> * @return string Composed route string. <ide> */ <del> protected function _writeUrl($params, $pass = array(), $hostOptions = array(), $query = array()) { <add> protected function _writeUrl($params, $pass = array(), $query = array()) { <ide> if (isset($params['prefix'], $params['action'])) { <ide> $params['action'] = str_replace($params['prefix'] . '_', '', $params['action']); <ide> unset($params['prefix']); <ide> protected function _writeUrl($params, $pass = array(), $hostOptions = array(), $ <ide> } <ide> <ide> // add base url if applicable. <del> if (isset($hostOptions['_base'])) { <del> $out = $hostOptions['_base'] . $out; <del> unset($hostOptions['_base']); <add> if (isset($params['_base'])) { <add> $out = $params['_base'] . $out; <add> unset($params['_base']); <ide> } <ide> <ide> $out = str_replace('//', '/', $out); <ide> <del> if (!empty($hostOptions)) { <del> $host = $hostOptions['_host']; <add> if ( <add> isset($params['_scheme']) || <add> isset($params['_host']) || <add> isset($params['_port']) <add> ) { <add> $host = $params['_host']; <ide> <ide> // append the port if it exists. <del> if (isset($hostOptions['_port'])) { <del> $host .= ':' . $hostOptions['_port']; <add> if (isset($params['_port'])) { <add> $host .= ':' . $params['_port']; <ide> } <ide> $out = sprintf( <ide> '%s://%s%s', <del> $hostOptions['_scheme'], <add> $params['_scheme'], <ide> $host, <ide> $out <ide> );
1
PHP
PHP
disable the cache when running schema commands
f1da6b4cbc9f918a9a94147518db25908399a130
<ide><path>lib/Cake/Console/Command/SchemaShell.php <ide> public function startup() { <ide> $this->out('Cake Schema Shell'); <ide> $this->hr(); <ide> <add> Configure::write('Cache.disable', 1); <add> <ide> $name = $path = $connection = $plugin = null; <ide> if (!empty($this->params['name'])) { <ide> $name = $this->params['name'];
1
Python
Python
add `output` property to mappedoperator
1ed014647e7293d342d9d1c2706343a68f003655
<ide><path>airflow/example_dags/example_xcom.py <ide> """Example DAG demonstrating the usage of XComs.""" <ide> import pendulum <ide> <del>from airflow import DAG <add>from airflow import DAG, XComArg <ide> from airflow.decorators import task <ide> from airflow.operators.bash import BashOperator <ide> <ide> def pull_value_from_bash_push(ti=None): <ide> bash_pull = BashOperator( <ide> task_id='bash_pull', <ide> bash_command='echo "bash pull demo" && ' <del> f'echo "The xcom pushed manually is {bash_push.output["manually_pushed_value"]}" && ' <del> f'echo "The returned_value xcom is {bash_push.output}" && ' <add> f'echo "The xcom pushed manually is {XComArg(bash_push, key="manually_pushed_value")}" && ' <add> f'echo "The returned_value xcom is {XComArg(bash_push)}" && ' <ide> 'echo "finished"', <ide> do_xcom_push=False, <ide> ) <ide> def pull_value_from_bash_push(ti=None): <ide> [bash_pull, python_pull_from_bash] << bash_push <ide> <ide> puller(push_by_returning()) << push() <del> <del> # Task dependencies created via `XComArgs`: <del> # pull << push2 <ide><path>airflow/models/baseoperator.py <ide> <ide> from airflow.models.dag import DAG <ide> from airflow.models.taskinstance import TaskInstanceKey <add> from airflow.models.xcom_arg import XComArg <ide> from airflow.utils.task_group import TaskGroup <ide> <ide> ScheduleInterval = Union[str, timedelta, relativedelta] <ide> def leaves(self) -> List["BaseOperator"]: <ide> return [self] <ide> <ide> @property <del> def output(self): <add> def output(self) -> "XComArg": <ide> """Returns reference to XCom pushed by current operator""" <ide> from airflow.models.xcom_arg import XComArg <ide> <ide><path>airflow/models/mappedoperator.py <ide> def get_dag(self) -> Optional["DAG"]: <ide> """Implementing Operator.""" <ide> return self.dag <ide> <add> @property <add> def output(self) -> "XComArg": <add> """Returns reference to XCom pushed by current operator""" <add> from airflow.models.xcom_arg import XComArg <add> <add> return XComArg(operator=self) <add> <ide> def serialize_for_task_group(self) -> Tuple[DagAttributeTypes, Any]: <ide> """Implementing DAGNode.""" <ide> return DagAttributeTypes.OP, self.task_id <ide><path>airflow/providers/amazon/aws/example_dags/example_dms.py <ide> import json <ide> import os <ide> from datetime import datetime <add>from typing import cast <ide> <ide> import boto3 <ide> from sqlalchemy import Column, MetaData, String, Table, create_engine <ide> def delete_dms_assets(): <ide> ) <ide> # [END howto_operator_dms_create_task] <ide> <add> task_arn = cast(str, create_task.output) <add> <ide> # [START howto_operator_dms_start_task] <ide> start_task = DmsStartTaskOperator( <ide> task_id='start_task', <del> replication_task_arn=create_task.output, <add> replication_task_arn=task_arn, <ide> ) <ide> # [END howto_operator_dms_start_task] <ide> <ide> def delete_dms_assets(): <ide> <ide> await_task_start = DmsTaskBaseSensor( <ide> task_id='await_task_start', <del> replication_task_arn=create_task.output, <add> replication_task_arn=task_arn, <ide> target_statuses=['running'], <ide> termination_statuses=['stopped', 'deleting', 'failed'], <ide> ) <ide> <ide> # [START howto_operator_dms_stop_task] <ide> stop_task = DmsStopTaskOperator( <ide> task_id='stop_task', <del> replication_task_arn=create_task.output, <add> replication_task_arn=task_arn, <ide> ) <ide> # [END howto_operator_dms_stop_task] <ide> <ide> # TaskCompletedSensor actually waits until task reaches the "Stopped" state, so it will work here. <ide> # [START howto_sensor_dms_task_completed] <ide> await_task_stop = DmsTaskCompletedSensor( <ide> task_id='await_task_stop', <del> replication_task_arn=create_task.output, <add> replication_task_arn=task_arn, <ide> ) <ide> # [END howto_sensor_dms_task_completed] <ide> <ide> # [START howto_operator_dms_delete_task] <ide> delete_task = DmsDeleteTaskOperator( <ide> task_id='delete_task', <del> replication_task_arn=create_task.output, <add> replication_task_arn=task_arn, <ide> trigger_rule='all_done', <ide> ) <ide> # [END howto_operator_dms_delete_task] <ide><path>airflow/providers/amazon/aws/example_dags/example_ecs.py <ide> # under the License. <ide> <ide> from datetime import datetime <add>from typing import cast <ide> <ide> from airflow import DAG <ide> from airflow.models.baseoperator import chain <ide> ) <ide> # [END howto_operator_ecs_register_task_definition] <ide> <add> registered_task_definition = cast(str, register_task.output) <add> <ide> # [START howto_sensor_ecs_task_definition_state] <ide> await_task_definition = EcsTaskDefinitionStateSensor( <ide> task_id='await_task_definition', <del> task_definition=register_task.output, <add> task_definition=registered_task_definition, <ide> ) <ide> # [END howto_sensor_ecs_task_definition_state] <ide> <ide> # [START howto_operator_ecs_run_task] <ide> run_task = EcsRunTaskOperator( <ide> task_id="run_task", <ide> cluster=EXISTING_CLUSTER_NAME, <del> task_definition=register_task.output, <add> task_definition=registered_task_definition, <ide> launch_type="EC2", <ide> overrides={ <ide> "containerOverrides": [ <ide> deregister_task = EcsDeregisterTaskDefinitionOperator( <ide> task_id='deregister_task', <ide> trigger_rule=TriggerRule.ALL_DONE, <del> task_definition=register_task.output, <add> task_definition=registered_task_definition, <ide> ) <ide> # [END howto_operator_ecs_deregister_task_definition] <ide> <ide><path>airflow/providers/amazon/aws/example_dags/example_emr.py <ide> # under the License. <ide> import os <ide> from datetime import datetime <add>from typing import cast <ide> <ide> from airflow import DAG <ide> from airflow.models.baseoperator import chain <ide> ) <ide> # [END howto_operator_emr_create_job_flow] <ide> <add> job_flow_id = cast(str, job_flow_creator.output) <add> <ide> # [START howto_sensor_emr_job_flow] <del> job_sensor = EmrJobFlowSensor( <del> task_id='check_job_flow', <del> job_flow_id=job_flow_creator.output, <del> ) <add> job_sensor = EmrJobFlowSensor(task_id='check_job_flow', job_flow_id=job_flow_id) <ide> # [END howto_sensor_emr_job_flow] <ide> <ide> # [START howto_operator_emr_modify_cluster] <ide> cluster_modifier = EmrModifyClusterOperator( <del> task_id='modify_cluster', cluster_id=job_flow_creator.output, step_concurrency_level=1 <add> task_id='modify_cluster', cluster_id=job_flow_id, step_concurrency_level=1 <ide> ) <ide> # [END howto_operator_emr_modify_cluster] <ide> <ide> # [START howto_operator_emr_add_steps] <ide> step_adder = EmrAddStepsOperator( <ide> task_id='add_steps', <del> job_flow_id=job_flow_creator.output, <add> job_flow_id=job_flow_id, <ide> steps=SPARK_STEPS, <ide> ) <ide> # [END howto_operator_emr_add_steps] <ide> <ide> # [START howto_sensor_emr_step] <ide> step_checker = EmrStepSensor( <ide> task_id='watch_step', <del> job_flow_id=job_flow_creator.output, <add> job_flow_id=job_flow_id, <ide> step_id="{{ task_instance.xcom_pull(task_ids='add_steps', key='return_value')[0] }}", <ide> ) <ide> # [END howto_sensor_emr_step] <ide> <ide> # [START howto_operator_emr_terminate_job_flow] <ide> cluster_remover = EmrTerminateJobFlowOperator( <ide> task_id='remove_cluster', <del> job_flow_id=job_flow_creator.output, <add> job_flow_id=job_flow_id, <ide> ) <ide> # [END howto_operator_emr_terminate_job_flow] <ide> <ide><path>airflow/providers/google/cloud/example_dags/example_automl_nl_text_classification.py <ide> """ <ide> import os <ide> from datetime import datetime <add>from typing import cast <ide> <ide> from airflow import models <add>from airflow.models.xcom_arg import XComArg <ide> from airflow.providers.google.cloud.hooks.automl import CloudAutoMLHook <ide> from airflow.providers.google.cloud.operators.automl import ( <ide> AutoMLCreateDatasetOperator, <ide> task_id="create_dataset_task", dataset=DATASET, location=GCP_AUTOML_LOCATION <ide> ) <ide> <del> dataset_id = create_dataset_task.output['dataset_id'] <add> dataset_id = cast(str, XComArg(create_dataset_task, key='dataset_id')) <ide> <ide> import_dataset_task = AutoMLImportDataOperator( <ide> task_id="import_dataset_task", <ide> <ide> create_model = AutoMLTrainModelOperator(task_id="create_model", model=MODEL, location=GCP_AUTOML_LOCATION) <ide> <del> model_id = create_model.output['model_id'] <add> model_id = cast(str, XComArg(create_model, key='model_id')) <ide> <ide> delete_model_task = AutoMLDeleteModelOperator( <ide> task_id="delete_model_task", <ide><path>airflow/providers/google/cloud/example_dags/example_automl_nl_text_sentiment.py <ide> """ <ide> import os <ide> from datetime import datetime <add>from typing import cast <ide> <ide> from airflow import models <add>from airflow.models.xcom_arg import XComArg <ide> from airflow.providers.google.cloud.hooks.automl import CloudAutoMLHook <ide> from airflow.providers.google.cloud.operators.automl import ( <ide> AutoMLCreateDatasetOperator, <ide> task_id="create_dataset_task", dataset=DATASET, location=GCP_AUTOML_LOCATION <ide> ) <ide> <del> dataset_id = create_dataset_task.output['dataset_id'] <add> dataset_id = cast(str, XComArg(create_dataset_task, key='dataset_id')) <ide> <ide> import_dataset_task = AutoMLImportDataOperator( <ide> task_id="import_dataset_task", <ide> <ide> create_model = AutoMLTrainModelOperator(task_id="create_model", model=MODEL, location=GCP_AUTOML_LOCATION) <ide> <del> model_id = create_model.output['model_id'] <add> model_id = cast(str, XComArg(create_model, key='model_id')) <ide> <ide> delete_model_task = AutoMLDeleteModelOperator( <ide> task_id="delete_model_task", <ide><path>airflow/providers/google/cloud/example_dags/example_automl_tables.py <ide> import os <ide> from copy import deepcopy <ide> from datetime import datetime <del>from typing import Dict, List <add>from typing import Dict, List, cast <ide> <ide> from airflow import models <add>from airflow.models.xcom_arg import XComArg <ide> from airflow.providers.google.cloud.hooks.automl import CloudAutoMLHook <ide> from airflow.providers.google.cloud.operators.automl import ( <ide> AutoMLBatchPredictOperator, <ide> def get_target_column_spec(columns_specs: List[Dict], column_name: str) -> str: <ide> project_id=GCP_PROJECT_ID, <ide> ) <ide> <del> dataset_id = create_dataset_task.output['dataset_id'] <add> dataset_id = cast(str, XComArg(create_dataset_task, key='dataset_id')) <ide> # [END howto_operator_automl_create_dataset] <ide> <ide> MODEL["dataset_id"] = dataset_id <ide> def get_target_column_spec(columns_specs: List[Dict], column_name: str) -> str: <ide> project_id=GCP_PROJECT_ID, <ide> ) <ide> <del> model_id = create_model_task.output['model_id'] <add> model_id = cast(str, XComArg(create_model_task, key='model_id')) <ide> # [END howto_operator_automl_create_model] <ide> <ide> # [START howto_operator_automl_delete_model] <ide> def get_target_column_spec(columns_specs: List[Dict], column_name: str) -> str: <ide> project_id=GCP_PROJECT_ID, <ide> ) <ide> <del> dataset_id = create_dataset_task2.output['dataset_id'] <add> dataset_id = cast(str, XComArg(create_dataset_task2, key='dataset_id')) <ide> <ide> import_dataset_task = AutoMLImportDataOperator( <ide> task_id="import_dataset_task", <ide><path>airflow/providers/google/cloud/example_dags/example_automl_translation.py <ide> """ <ide> import os <ide> from datetime import datetime <add>from typing import cast <ide> <ide> from airflow import models <add>from airflow.models.xcom_arg import XComArg <ide> from airflow.providers.google.cloud.hooks.automl import CloudAutoMLHook <ide> from airflow.providers.google.cloud.operators.automl import ( <ide> AutoMLCreateDatasetOperator, <ide> task_id="create_dataset_task", dataset=DATASET, location=GCP_AUTOML_LOCATION <ide> ) <ide> <del> dataset_id = create_dataset_task.output["dataset_id"] <add> dataset_id = cast(str, XComArg(create_dataset_task, key="dataset_id")) <ide> <ide> import_dataset_task = AutoMLImportDataOperator( <ide> task_id="import_dataset_task", <ide> <ide> create_model = AutoMLTrainModelOperator(task_id="create_model", model=MODEL, location=GCP_AUTOML_LOCATION) <ide> <del> model_id = create_model.output["model_id"] <add> model_id = cast(str, XComArg(create_model, key="model_id")) <ide> <ide> delete_model_task = AutoMLDeleteModelOperator( <ide> task_id="delete_model_task", <ide><path>airflow/providers/google/cloud/example_dags/example_automl_video_intelligence_classification.py <ide> """ <ide> import os <ide> from datetime import datetime <add>from typing import cast <ide> <ide> from airflow import models <add>from airflow.models.xcom_arg import XComArg <ide> from airflow.providers.google.cloud.hooks.automl import CloudAutoMLHook <ide> from airflow.providers.google.cloud.operators.automl import ( <ide> AutoMLCreateDatasetOperator, <ide> task_id="create_dataset_task", dataset=DATASET, location=GCP_AUTOML_LOCATION <ide> ) <ide> <del> dataset_id = create_dataset_task.output["dataset_id"] <add> dataset_id = cast(str, XComArg(create_dataset_task, key="dataset_id")) <ide> <ide> import_dataset_task = AutoMLImportDataOperator( <ide> task_id="import_dataset_task", <ide> <ide> create_model = AutoMLTrainModelOperator(task_id="create_model", model=MODEL, location=GCP_AUTOML_LOCATION) <ide> <del> model_id = create_model.output["model_id"] <add> model_id = cast(str, XComArg(create_model, key="model_id")) <ide> <ide> delete_model_task = AutoMLDeleteModelOperator( <ide> task_id="delete_model_task", <ide><path>airflow/providers/google/cloud/example_dags/example_automl_video_intelligence_tracking.py <ide> """ <ide> import os <ide> from datetime import datetime <add>from typing import cast <ide> <ide> from airflow import models <add>from airflow.models.xcom_arg import XComArg <ide> from airflow.providers.google.cloud.hooks.automl import CloudAutoMLHook <ide> from airflow.providers.google.cloud.operators.automl import ( <ide> AutoMLCreateDatasetOperator, <ide> task_id="create_dataset_task", dataset=DATASET, location=GCP_AUTOML_LOCATION <ide> ) <ide> <del> dataset_id = create_dataset_task.output["dataset_id"] <add> dataset_id = cast(str, XComArg(create_dataset_task, key="dataset_id")) <ide> <ide> import_dataset_task = AutoMLImportDataOperator( <ide> task_id="import_dataset_task", <ide> <ide> create_model = AutoMLTrainModelOperator(task_id="create_model", model=MODEL, location=GCP_AUTOML_LOCATION) <ide> <del> model_id = create_model.output["model_id"] <add> model_id = cast(str, XComArg(create_model, key="model_id")) <ide> <ide> delete_model_task = AutoMLDeleteModelOperator( <ide> task_id="delete_model_task", <ide><path>airflow/providers/google/cloud/example_dags/example_automl_vision_object_detection.py <ide> """ <ide> import os <ide> from datetime import datetime <add>from typing import cast <ide> <ide> from airflow import models <add>from airflow.models.xcom_arg import XComArg <ide> from airflow.providers.google.cloud.hooks.automl import CloudAutoMLHook <ide> from airflow.providers.google.cloud.operators.automl import ( <ide> AutoMLCreateDatasetOperator, <ide> task_id="create_dataset_task", dataset=DATASET, location=GCP_AUTOML_LOCATION <ide> ) <ide> <del> dataset_id = create_dataset_task.output["dataset_id"] <add> dataset_id = cast(str, XComArg(create_dataset_task, key="dataset_id")) <ide> <ide> import_dataset_task = AutoMLImportDataOperator( <ide> task_id="import_dataset_task", <ide> <ide> create_model = AutoMLTrainModelOperator(task_id="create_model", model=MODEL, location=GCP_AUTOML_LOCATION) <ide> <del> model_id = create_model.output["model_id"] <add> model_id = cast(str, XComArg(create_model, key="model_id")) <ide> <ide> delete_model_task = AutoMLDeleteModelOperator( <ide> task_id="delete_model_task", <ide><path>airflow/providers/google/cloud/example_dags/example_bigquery_dts.py <ide> import os <ide> import time <ide> from datetime import datetime <add>from typing import cast <ide> <ide> from airflow import models <add>from airflow.models.xcom_arg import XComArg <ide> from airflow.providers.google.cloud.operators.bigquery_dts import ( <ide> BigQueryCreateDataTransferOperator, <ide> BigQueryDataTransferServiceStartTransferRunsOperator, <ide> task_id="gcp_bigquery_create_transfer", <ide> ) <ide> <del> transfer_config_id = gcp_bigquery_create_transfer.output["transfer_config_id"] <add> transfer_config_id = cast(str, XComArg(gcp_bigquery_create_transfer, key="transfer_config_id")) <ide> # [END howto_bigquery_create_data_transfer] <ide> <ide> # [START howto_bigquery_start_transfer] <ide> gcp_run_sensor = BigQueryDataTransferServiceTransferRunSensor( <ide> task_id="gcp_run_sensor", <ide> transfer_config_id=transfer_config_id, <del> run_id=gcp_bigquery_start_transfer.output["run_id"], <add> run_id=cast(str, XComArg(gcp_bigquery_start_transfer, key="run_id")), <ide> expected_statuses={"SUCCEEDED"}, <ide> ) <ide> # [END howto_bigquery_dts_sensor] <ide><path>airflow/providers/google/cloud/example_dags/example_datafusion.py <ide> """ <ide> import os <ide> from datetime import datetime <add>from typing import cast <ide> <ide> from airflow import models <ide> from airflow.operators.bash import BashOperator <ide> start_pipeline_sensor = CloudDataFusionPipelineStateSensor( <ide> task_id="pipeline_state_sensor", <ide> pipeline_name=PIPELINE_NAME, <del> pipeline_id=start_pipeline_async.output, <add> pipeline_id=cast(str, start_pipeline_async.output), <ide> expected_statuses=["COMPLETED"], <ide> failure_statuses=["FAILED"], <ide> instance_name=INSTANCE_NAME, <ide><path>airflow/providers/google/cloud/example_dags/example_looker.py <ide> """ <ide> <ide> from datetime import datetime <add>from typing import cast <ide> <ide> from airflow import models <ide> from airflow.providers.google.cloud.operators.looker import LookerStartPdtBuildOperator <ide> check_pdt_task_async_sensor = LookerCheckPdtBuildSensor( <ide> task_id='check_pdt_task_async_sensor', <ide> looker_conn_id='your_airflow_connection_for_looker', <del> materialization_id=start_pdt_task_async.output, <add> materialization_id=cast(str, start_pdt_task_async.output), <ide> poke_interval=10, <ide> ) <ide> # [END cloud_looker_async_start_pdt_sensor] <ide><path>airflow/providers/google/cloud/example_dags/example_vision.py <ide> <ide> import os <ide> from datetime import datetime <add>from typing import cast <ide> <ide> from airflow import models <ide> from airflow.operators.bash import BashOperator <ide> ) <ide> # [END howto_operator_vision_product_set_create] <ide> <del> product_set_create_output = product_set_create.output <add> product_set_create_output = cast(str, product_set_create.output) <ide> <ide> # [START howto_operator_vision_product_set_get] <ide> product_set_get = CloudVisionGetProductSetOperator( <ide> ) <ide> # [END howto_operator_vision_product_create] <ide> <del> product_create_output = product_create.output <add> product_create_output = cast(str, product_create.output) <ide> <ide> # [START howto_operator_vision_product_get] <ide> product_get = CloudVisionGetProductOperator( <ide><path>airflow/providers/google/marketing_platform/example_dags/example_display_video.py <ide> """ <ide> import os <ide> from datetime import datetime <del>from typing import Dict <add>from typing import Dict, cast <ide> <ide> from airflow import models <add>from airflow.models.xcom_arg import XComArg <ide> from airflow.providers.google.cloud.transfers.gcs_to_bigquery import GCSToBigQueryOperator <ide> from airflow.providers.google.marketing_platform.hooks.display_video import GoogleDisplayVideo360Hook <ide> from airflow.providers.google.marketing_platform.operators.display_video import ( <ide> ) as dag1: <ide> # [START howto_google_display_video_createquery_report_operator] <ide> create_report = GoogleDisplayVideo360CreateReportOperator(body=REPORT, task_id="create_report") <del> report_id = create_report.output["report_id"] <add> report_id = cast(str, XComArg(create_report, key="report_id")) <ide> # [END howto_google_display_video_createquery_report_operator] <ide> <ide> # [START howto_google_display_video_runquery_report_operator] <ide><path>tests/models/test_mappedoperator.py <ide> def test_expand_kwargs_render_template_fields_validating_operator(dag_maker, ses <ide> assert isinstance(op, MockOperator) <ide> assert op.arg1 == expected <ide> assert op.arg2 == "a" <add> <add> <add>def test_xcomarg_property_of_mapped_operator(dag_maker): <add> with dag_maker("test_xcomarg_property_of_mapped_operator"): <add> op_a = MockOperator.partial(task_id="a").expand(arg1=["x", "y", "z"]) <add> dag_maker.create_dagrun() <add> <add> assert op_a.output == XComArg(op_a) <add> <add> <add>def test_set_xcomarg_dependencies_with_mapped_operator(dag_maker): <add> with dag_maker("test_set_xcomargs_dependencies_with_mapped_operator"): <add> op1 = MockOperator.partial(task_id="op1").expand(arg1=[1, 2, 3]) <add> op2 = MockOperator.partial(task_id="op2").expand(arg2=["a", "b", "c"]) <add> op3 = MockOperator(task_id="op3", arg1=op1.output) <add> op4 = MockOperator(task_id="op4", arg1=[op1.output, op2.output]) <add> op5 = MockOperator(task_id="op5", arg1={"op1": op1.output, "op2": op2.output}) <add> <add> assert op1 in op3.upstream_list <add> assert op1 in op4.upstream_list <add> assert op2 in op4.upstream_list <add> assert op1 in op5.upstream_list <add> assert op2 in op5.upstream_list <add> <add> <add>def test_all_xcomargs_from_mapped_tasks_are_consumable(dag_maker, session): <add> class PushXcomOperator(MockOperator): <add> def __init__(self, arg1, **kwargs): <add> super().__init__(arg1=arg1, **kwargs) <add> <add> def execute(self, context): <add> return self.arg1 <add> <add> class ConsumeXcomOperator(PushXcomOperator): <add> def execute(self, context): <add> assert {i for i in self.arg1} == {1, 2, 3} <add> <add> with dag_maker("test_all_xcomargs_from_mapped_tasks_are_consumable"): <add> op1 = PushXcomOperator.partial(task_id="op1").expand(arg1=[1, 2, 3]) <add> ConsumeXcomOperator(task_id="op2", arg1=op1.output) <add> <add> dr = dag_maker.create_dagrun() <add> tis = dr.get_task_instances(session=session) <add> for ti in tis: <add> ti.run() <ide><path>tests/system/providers/airbyte/example_airbyte_trigger_job.py <ide> <ide> import os <ide> from datetime import datetime, timedelta <add>from typing import cast <ide> <ide> from airflow import DAG <ide> from airflow.providers.airbyte.operators.airbyte import AirbyteTriggerSyncOperator <ide> <ide> airbyte_sensor = AirbyteJobSensor( <ide> task_id='airbyte_sensor_source_dest_example', <del> airbyte_job_id=async_source_destination.output, <add> airbyte_job_id=cast(int, async_source_destination.output), <ide> ) <ide> # [END howto_operator_airbyte_asynchronous] <ide> <ide><path>tests/system/providers/amazon/aws/example_athena.py <ide> # specific language governing permissions and limitations <ide> # under the License. <ide> from datetime import datetime <add>from typing import cast <ide> <ide> import boto3 <ide> <ide> def read_results_from_s3(bucket_name, query_execution_id): <ide> # [START howto_sensor_athena] <ide> await_query = AthenaSensor( <ide> task_id='await_query', <del> query_execution_id=read_table.output, <add> query_execution_id=cast(str, read_table.output), <ide> ) <ide> # [END howto_sensor_athena] <ide> <ide><path>tests/system/providers/amazon/aws/example_batch.py <ide> # specific language governing permissions and limitations <ide> # under the License. <ide> from datetime import datetime <add>from typing import cast <ide> <ide> import boto3 <ide> <ide> def delete_job_queue(job_queue_name): <ide> # [START howto_sensor_batch] <ide> wait_for_batch_job = BatchSensor( <ide> task_id='wait_for_batch_job', <del> job_id=submit_batch_job.output, <add> job_id=cast(str, submit_batch_job.output), <ide> ) <ide> # [END howto_sensor_batch] <ide> <ide><path>tests/system/providers/amazon/aws/example_emr_serverless.py <ide> <ide> <ide> from datetime import datetime <add>from typing import cast <ide> <ide> from airflow.models.baseoperator import chain <ide> from airflow.models.dag import DAG <ide> ) <ide> # [END howto_operator_emr_serverless_create_application] <ide> <add> emr_serverless_app_id = cast(str, emr_serverless_app.output) <add> <ide> # [START howto_sensor_emr_serverless_application] <ide> wait_for_app_creation = EmrServerlessApplicationSensor( <ide> task_id='wait_for_app_creation', <del> application_id=emr_serverless_app.output, <add> application_id=emr_serverless_app_id, <ide> ) <ide> # [END howto_sensor_emr_serverless_application] <ide> <ide> # [START howto_operator_emr_serverless_start_job] <ide> start_job = EmrServerlessStartJobOperator( <ide> task_id='start_emr_serverless_job', <del> application_id=emr_serverless_app.output, <add> application_id=emr_serverless_app_id, <ide> execution_role_arn=role_arn, <ide> job_driver=SPARK_JOB_DRIVER, <ide> configuration_overrides=SPARK_CONFIGURATION_OVERRIDES, <ide> <ide> # [START howto_sensor_emr_serverless_job] <ide> wait_for_job = EmrServerlessJobSensor( <del> task_id='wait_for_job', application_id=emr_serverless_app.output, job_run_id=start_job.output <add> task_id='wait_for_job', application_id=emr_serverless_app_id, job_run_id=cast(str, start_job.output) <ide> ) <ide> # [END howto_sensor_emr_serverless_job] <ide> <ide> # [START howto_operator_emr_serverless_delete_application] <ide> delete_app = EmrServerlessDeleteApplicationOperator( <ide> task_id='delete_application', <del> application_id=emr_serverless_app.output, <add> application_id=emr_serverless_app_id, <ide> trigger_rule=TriggerRule.ALL_DONE, <ide> ) <ide> # [END howto_operator_emr_serverless_delete_application] <ide><path>tests/system/providers/amazon/aws/example_glue.py <ide> # specific language governing permissions and limitations <ide> # under the License. <ide> from datetime import datetime <del>from typing import List, Optional, Tuple <add>from typing import List, Optional, Tuple, cast <ide> <ide> import boto3 <ide> from botocore.client import BaseClient <ide> def glue_cleanup(crawler_name: str, job_name: str, db_name: str) -> None: <ide> job_name=glue_job_name, <ide> script_location=f's3://{bucket_name}/etl_script.py', <ide> s3_bucket=bucket_name, <del> iam_role_name=role_name, <add> iam_role_name=cast(str, role_name), <ide> create_job_kwargs={'GlueVersion': '3.0', 'NumberOfWorkers': 2, 'WorkerType': 'G.1X'}, <ide> # Waits by default, set False to test the Sensor below <ide> wait_for_completion=False, <ide> def glue_cleanup(crawler_name: str, job_name: str, db_name: str) -> None: <ide> task_id='wait_for_job', <ide> job_name=glue_job_name, <ide> # Job ID extracted from previous Glue Job Operator task <del> run_id=submit_glue_job.output, <add> run_id=cast(str, submit_glue_job.output), <ide> ) <ide> # [END howto_sensor_glue] <ide> <ide> def glue_cleanup(crawler_name: str, job_name: str, db_name: str) -> None: <ide> # TEST TEARDOWN <ide> glue_cleanup(glue_crawler_name, glue_job_name, glue_db_name), <ide> delete_bucket, <del> delete_logs(submit_glue_job.output, glue_crawler_name), <add> delete_logs(cast(str, submit_glue_job.output), glue_crawler_name), <ide> ) <ide> <ide> from tests.system.utils.watcher import watcher <ide><path>tests/system/providers/amazon/aws/example_step_functions.py <ide> # under the License. <ide> import json <ide> from datetime import datetime <add>from typing import cast <ide> <ide> from airflow import DAG <ide> from airflow.decorators import task <ide> def delete_state_machine(state_machine_arn): <ide> <ide> # [START howto_operator_step_function_start_execution] <ide> start_execution = StepFunctionStartExecutionOperator( <del> task_id='start_execution', state_machine_arn=state_machine_arn <add> task_id='start_execution', state_machine_arn=cast(str, state_machine_arn) <ide> ) <ide> # [END howto_operator_step_function_start_execution] <ide> <add> execution_arn = cast(str, start_execution.output) <add> <ide> # [START howto_sensor_step_function_execution] <ide> wait_for_execution = StepFunctionExecutionSensor( <del> task_id='wait_for_execution', execution_arn=start_execution.output <add> task_id='wait_for_execution', execution_arn=execution_arn <ide> ) <ide> # [END howto_sensor_step_function_execution] <ide> <ide> # [START howto_operator_step_function_get_execution_output] <ide> get_execution_output = StepFunctionGetExecutionOutputOperator( <del> task_id='get_execution_output', execution_arn=start_execution.output <add> task_id='get_execution_output', execution_arn=execution_arn <ide> ) <ide> # [END howto_operator_step_function_get_execution_output] <ide> <ide><path>tests/system/providers/dbt/cloud/example_dbt_cloud.py <ide> # under the License. <ide> <ide> from datetime import datetime <add>from typing import cast <ide> <ide> from airflow.models import DAG <ide> <ide> <ide> # [START howto_operator_dbt_cloud_get_artifact] <ide> get_run_results_artifact = DbtCloudGetJobRunArtifactOperator( <del> task_id="get_run_results_artifact", run_id=trigger_job_run1.output, path="run_results.json" <add> task_id="get_run_results_artifact", run_id=cast(int, trigger_job_run1.output), path="run_results.json" <ide> ) <ide> # [END howto_operator_dbt_cloud_get_artifact] <ide> <ide> <ide> # [START howto_operator_dbt_cloud_run_job_sensor] <ide> job_run_sensor = DbtCloudJobRunSensor( <del> task_id="job_run_sensor", run_id=trigger_job_run2.output, timeout=20 <add> task_id="job_run_sensor", run_id=cast(int, trigger_job_run2.output), timeout=20 <ide> ) <ide> # [END howto_operator_dbt_cloud_run_job_sensor] <ide> <ide><path>tests/system/providers/google/cloud/automl/example_automl_nl_text_extraction.py <ide> """ <ide> import os <ide> from datetime import datetime <add>from typing import cast <ide> <ide> from airflow import models <add>from airflow.models.xcom_arg import XComArg <ide> from airflow.providers.google.cloud.hooks.automl import CloudAutoMLHook <ide> from airflow.providers.google.cloud.operators.automl import ( <ide> AutoMLCreateDatasetOperator, <ide> task_id="create_dataset_task", dataset=DATASET, location=GCP_AUTOML_LOCATION <ide> ) <ide> <del> dataset_id = create_dataset_task.output['dataset_id'] <add> dataset_id = cast(str, XComArg(create_dataset_task, key='dataset_id')) <ide> <ide> import_dataset_task = AutoMLImportDataOperator( <ide> task_id="import_dataset_task", <ide> <ide> create_model = AutoMLTrainModelOperator(task_id="create_model", model=MODEL, location=GCP_AUTOML_LOCATION) <ide> <del> model_id = create_model.output['model_id'] <add> model_id = cast(str, XComArg(create_model, key='model_id')) <ide> <ide> delete_model_task = AutoMLDeleteModelOperator( <ide> task_id="delete_model_task", <ide><path>tests/system/providers/google/cloud/automl/example_automl_vision_classification.py <ide> """ <ide> import os <ide> from datetime import datetime <add>from typing import cast <ide> <ide> from airflow import models <add>from airflow.models.xcom_arg import XComArg <ide> from airflow.providers.google.cloud.hooks.automl import CloudAutoMLHook <ide> from airflow.providers.google.cloud.operators.automl import ( <ide> AutoMLCreateDatasetOperator, <ide> task_id="create_dataset_task", dataset=DATASET, location=GCP_AUTOML_LOCATION <ide> ) <ide> <del> dataset_id = create_dataset_task.output["dataset_id"] <add> dataset_id = cast(str, XComArg(create_dataset_task, key="dataset_id")) <ide> <ide> import_dataset_task = AutoMLImportDataOperator( <ide> task_id="import_dataset_task", <ide> <ide> create_model = AutoMLTrainModelOperator(task_id="create_model", model=MODEL, location=GCP_AUTOML_LOCATION) <ide> <del> model_id = create_model.output["model_id"] <add> model_id = cast(str, XComArg(create_model, key="model_id")) <ide> <ide> delete_model_task = AutoMLDeleteModelOperator( <ide> task_id="delete_model_task", <ide><path>tests/system/providers/google/cloud/cloud_build/example_cloud_build.py <ide> import os <ide> from datetime import datetime <ide> from pathlib import Path <del>from typing import Any, Dict <add>from typing import Any, Dict, cast <ide> <ide> import yaml <ide> from future.backports.urllib.parse import urlparse <ide> <ide> from airflow import models <ide> from airflow.models.baseoperator import chain <add>from airflow.models.xcom_arg import XComArg <ide> from airflow.operators.bash import BashOperator <ide> from airflow.providers.google.cloud.operators.cloud_build import ( <ide> CloudBuildCancelBuildOperator, <ide> <ide> # [START howto_operator_create_build_from_storage_result] <ide> create_build_from_storage_result = BashOperator( <del> bash_command=f"echo { create_build_from_storage.output['results'] }", <add> bash_command=f"echo {cast(str, XComArg(create_build_from_storage, key='results'))}", <ide> task_id="create_build_from_storage_result", <ide> ) <ide> # [END howto_operator_create_build_from_storage_result] <ide> <ide> # [START howto_operator_create_build_from_repo_result] <ide> create_build_from_repo_result = BashOperator( <del> bash_command=f"echo { create_build_from_repo.output['results'] }", <add> bash_command=f"echo {cast(str, XComArg(create_build_from_repo, key='results'))}", <ide> task_id="create_build_from_repo_result", <ide> ) <ide> # [END howto_operator_create_build_from_repo_result] <ide> # [START howto_operator_cancel_build] <ide> cancel_build = CloudBuildCancelBuildOperator( <ide> task_id="cancel_build", <del> id_=create_build_without_wait.output['id'], <add> id_=cast(str, XComArg(create_build_without_wait, key='id')), <ide> project_id=PROJECT_ID, <ide> ) <ide> # [END howto_operator_cancel_build] <ide> <ide> # [START howto_operator_retry_build] <ide> retry_build = CloudBuildRetryBuildOperator( <ide> task_id="retry_build", <del> id_=cancel_build.output['id'], <add> id_=cast(str, XComArg(cancel_build, key='id')), <ide> project_id=PROJECT_ID, <ide> ) <ide> # [END howto_operator_retry_build] <ide> <ide> # [START howto_operator_get_build] <ide> get_build = CloudBuildGetBuildOperator( <ide> task_id="get_build", <del> id_=retry_build.output['id'], <add> id_=cast(str, XComArg(retry_build, key='id')), <ide> project_id=PROJECT_ID, <ide> ) <ide> # [END howto_operator_get_build] <ide><path>tests/system/providers/google/cloud/cloud_build/example_cloud_build_trigger.py <ide> <ide> import os <ide> from datetime import datetime <del>from typing import Any, Dict <add>from typing import Any, Dict, cast <ide> <ide> from airflow import models <ide> from airflow.models.baseoperator import chain <add>from airflow.models.xcom_arg import XComArg <ide> from airflow.providers.google.cloud.operators.cloud_build import ( <ide> CloudBuildCreateBuildTriggerOperator, <ide> CloudBuildDeleteBuildTriggerOperator, <ide> ) <ide> # [END howto_operator_create_build_trigger] <ide> <add> build_trigger_id = cast(str, XComArg(create_build_trigger, key="id")) <add> <ide> # [START howto_operator_run_build_trigger] <ide> run_build_trigger = CloudBuildRunBuildTriggerOperator( <ide> task_id="run_build_trigger", <ide> project_id=PROJECT_ID, <del> trigger_id=create_build_trigger.output['id'], <add> trigger_id=build_trigger_id, <ide> source=create_build_from_repo_body['source']['repo_source'], <ide> ) <ide> # [END howto_operator_run_build_trigger] <ide> update_build_trigger = CloudBuildUpdateBuildTriggerOperator( <ide> task_id="update_build_trigger", <ide> project_id=PROJECT_ID, <del> trigger_id=create_build_trigger.output['id'], <add> trigger_id=build_trigger_id, <ide> trigger=update_build_trigger_body, <ide> ) <ide> # [END howto_operator_update_build_trigger] <ide> get_build_trigger = CloudBuildGetBuildTriggerOperator( <ide> task_id="get_build_trigger", <ide> project_id=PROJECT_ID, <del> trigger_id=create_build_trigger.output['id'], <add> trigger_id=build_trigger_id, <ide> ) <ide> # [END howto_operator_get_build_trigger] <ide> <ide> # [START howto_operator_delete_build_trigger] <ide> delete_build_trigger = CloudBuildDeleteBuildTriggerOperator( <ide> task_id="delete_build_trigger", <ide> project_id=PROJECT_ID, <del> trigger_id=create_build_trigger.output['id'], <add> trigger_id=build_trigger_id, <ide> ) <ide> # [END howto_operator_delete_build_trigger] <ide> <ide><path>tests/system/providers/google/cloud/cloud_sql/example_cloud_sql.py <ide> from urllib.parse import urlsplit <ide> <ide> from airflow import models <add>from airflow.models.xcom_arg import XComArg <ide> from airflow.providers.google.cloud.operators.cloud_sql import ( <ide> CloudSQLCreateInstanceDatabaseOperator, <ide> CloudSQLCreateInstanceOperator, <ide> <ide> # For export & import to work we need to add the Cloud SQL instance's Service Account <ide> # write access to the destination GCS bucket. <add> service_account_email = XComArg(sql_instance_create_task, key='service_account_email') <add> <ide> # [START howto_operator_cloudsql_export_gcs_permissions] <ide> sql_gcp_add_bucket_permission_task = GCSBucketCreateAclEntryOperator( <del> entity=f"user-{sql_instance_create_task.output['service_account_email']}", <add> entity=f"user-{service_account_email}", <ide> role="WRITER", <ide> bucket=file_url_split[1], # netloc (bucket) <ide> task_id='sql_gcp_add_bucket_permission_task', <ide> # read access to the target GCS object. <ide> # [START howto_operator_cloudsql_import_gcs_permissions] <ide> sql_gcp_add_object_permission_task = GCSObjectCreateAclEntryOperator( <del> entity=f"user-{sql_instance_create_task.output['service_account_email']}", <add> entity=f"user-{service_account_email}", <ide> role="READER", <ide> bucket=file_url_split[1], # netloc (bucket) <ide> object_name=file_url_split[2][1:], # path (strip first '/') <ide><path>tests/system/providers/google/cloud/dataproc/example_dataproc_spark_async.py <ide> <ide> import os <ide> from datetime import datetime <add>from typing import cast <ide> <ide> from airflow import models <ide> from airflow.providers.google.cloud.operators.dataproc import ( <ide> task_id='spark_task_async_sensor_task', <ide> region=REGION, <ide> project_id=PROJECT_ID, <del> dataproc_job_id=spark_task_async.output, <add> dataproc_job_id=cast(str, spark_task_async.output), <ide> poke_interval=10, <ide> ) <ide> # [END cloud_dataproc_async_submit_sensor] <ide><path>tests/system/providers/google/cloud/datastore/example_datastore_rollback.py <ide> <ide> import os <ide> from datetime import datetime <del>from typing import Any, Dict <add>from typing import Any, Dict, cast <ide> <ide> from airflow import models <ide> from airflow.providers.google.cloud.operators.datastore import ( <ide> # [START how_to_rollback_transaction] <ide> rollback_transaction = CloudDatastoreRollbackOperator( <ide> task_id="rollback_transaction", <del> transaction=begin_transaction_to_rollback.output, <add> transaction=cast(str, begin_transaction_to_rollback.output), <ide> ) <ide> # [END how_to_rollback_transaction] <ide> <ide><path>tests/system/providers/google/cloud/gcs/example_sheets.py <ide> from datetime import datetime <ide> <ide> from airflow import models <add>from airflow.models.xcom_arg import XComArg <ide> from airflow.operators.bash import BashOperator <ide> from airflow.providers.google.cloud.operators.gcs import GCSCreateBucketOperator, GCSDeleteBucketOperator <ide> from airflow.providers.google.cloud.transfers.sheets_to_gcs import GoogleSheetsToGCSOperator <ide> # [START print_spreadsheet_url] <ide> print_spreadsheet_url = BashOperator( <ide> task_id="print_spreadsheet_url", <del> bash_command=f"echo {create_spreadsheet.output['spreadsheet_url']}", <add> bash_command=f"echo {XComArg(create_spreadsheet, key='spreadsheet_url')}", <ide> ) <ide> # [END print_spreadsheet_url] <ide> <ide><path>tests/system/providers/google/cloud/pubsub/example_pubsub.py <ide> """ <ide> import os <ide> from datetime import datetime <add>from typing import cast <ide> <ide> from airflow import models <ide> from airflow.operators.bash import BashOperator <ide> # [END howto_operator_gcp_pubsub_create_subscription] <ide> <ide> # [START howto_operator_gcp_pubsub_pull_message_with_sensor] <del> subscription = subscribe_task.output <add> subscription = cast(str, subscribe_task.output) <ide> <ide> pull_messages = PubSubPullSensor( <ide> task_id="pull_messages", <ide><path>tests/system/providers/google/cloud/workflows/example_workflows.py <ide> <ide> import os <ide> from datetime import datetime <add>from typing import cast <ide> <ide> from google.protobuf.field_mask_pb2 import FieldMask <ide> <ide> from airflow import DAG <add>from airflow.models.xcom_arg import XComArg <ide> from airflow.providers.google.cloud.operators.workflows import ( <ide> WorkflowsCancelExecutionOperator, <ide> WorkflowsCreateExecutionOperator, <ide> ) <ide> # [END how_to_create_execution] <ide> <del> create_execution_id = create_execution.output["execution_id"] <add> create_execution_id = cast(str, XComArg(create_execution, key="execution_id")) <ide> <ide> # [START how_to_wait_for_execution] <ide> wait_for_execution = WorkflowExecutionSensor( <ide> workflow_id=SLEEP_WORKFLOW_ID, <ide> ) <ide> <del> cancel_execution_id = create_execution_for_cancel.output["execution_id"] <add> cancel_execution_id = cast(str, XComArg(create_execution_for_cancel, key="execution_id")) <ide> <ide> # [START how_to_cancel_execution] <ide> cancel_execution = WorkflowsCancelExecutionOperator( <ide><path>tests/system/providers/google/datacatalog/example_datacatalog_entries.py <ide> from google.protobuf.field_mask_pb2 import FieldMask <ide> <ide> from airflow import models <add>from airflow.models.xcom_arg import XComArg <ide> from airflow.operators.bash import BashOperator <ide> from airflow.providers.google.cloud.operators.datacatalog import ( <ide> CloudDataCatalogCreateEntryGroupOperator, <ide> # [START howto_operator_gcp_datacatalog_create_entry_group_result] <ide> create_entry_group_result = BashOperator( <ide> task_id="create_entry_group_result", <del> bash_command=f"echo {create_entry_group.output['entry_group_id']}", <add> bash_command=f"echo {XComArg(create_entry_group, key='entry_group_id')}", <ide> ) <ide> # [END howto_operator_gcp_datacatalog_create_entry_group_result] <ide> <ide> # [START howto_operator_gcp_datacatalog_create_entry_gcs_result] <ide> create_entry_gcs_result = BashOperator( <ide> task_id="create_entry_gcs_result", <del> bash_command=f"echo {create_entry_gcs.output['entry_id']}", <add> bash_command=f"echo {XComArg(create_entry_gcs, key='entry_id')}", <ide> ) <ide> # [END howto_operator_gcp_datacatalog_create_entry_gcs_result] <ide> <ide><path>tests/system/providers/google/datacatalog/example_datacatalog_search_catalog.py <ide> <ide> import os <ide> from datetime import datetime <add>from typing import cast <ide> <ide> from google.cloud.datacatalog import TagField, TagTemplateField <ide> <ide> from airflow import models <add>from airflow.models.xcom_arg import XComArg <ide> from airflow.operators.bash import BashOperator <ide> from airflow.providers.google.cloud.operators.datacatalog import ( <ide> CloudDataCatalogCreateEntryGroupOperator, <ide> # [START howto_operator_gcp_datacatalog_create_entry_group_result] <ide> create_entry_group_result = BashOperator( <ide> task_id="create_entry_group_result", <del> bash_command=f"echo {create_entry_group.output['entry_group_id']}", <add> bash_command=f"echo {XComArg(create_entry_group, key='entry_group_id')}", <ide> ) <ide> # [END howto_operator_gcp_datacatalog_create_entry_group_result] <ide> <ide> # [START howto_operator_gcp_datacatalog_create_entry_gcs_result] <ide> create_entry_gcs_result = BashOperator( <ide> task_id="create_entry_gcs_result", <del> bash_command=f"echo {create_entry_gcs.output['entry_id']}", <add> bash_command=f"echo {XComArg(create_entry_gcs, key='entry_id')}", <ide> ) <ide> # [END howto_operator_gcp_datacatalog_create_entry_gcs_result] <ide> <ide> ) <ide> # [END howto_operator_gcp_datacatalog_create_tag] <ide> <add> tag_id = cast(str, XComArg(create_tag, key='tag_id')) <add> <ide> # [START howto_operator_gcp_datacatalog_create_tag_result] <ide> create_tag_result = BashOperator( <ide> task_id="create_tag_result", <del> bash_command=f"echo {create_tag.output['tag_id']}", <add> bash_command=f"echo {tag_id}", <ide> ) <ide> # [END howto_operator_gcp_datacatalog_create_tag_result] <ide> <ide> # [START howto_operator_gcp_datacatalog_create_tag_template_result] <ide> create_tag_template_result = BashOperator( <ide> task_id="create_tag_template_result", <del> bash_command=f"echo {create_tag_template.output['tag_template_id']}", <add> bash_command=f"echo {XComArg(create_tag_template, key='tag_template_id')}", <ide> ) <ide> # [END howto_operator_gcp_datacatalog_create_tag_template_result] <ide> <ide> location=LOCATION, <ide> entry_group=ENTRY_GROUP_ID, <ide> entry=ENTRY_ID, <del> tag=create_tag.output["tag_id"], <add> tag=tag_id, <ide> ) <ide> # [END howto_operator_gcp_datacatalog_delete_tag] <ide> delete_tag.trigger_rule = TriggerRule.ALL_DONE <ide><path>tests/system/providers/google/datacatalog/example_datacatalog_tag_templates.py <ide> from google.cloud.datacatalog import FieldType, TagTemplateField <ide> <ide> from airflow import models <add>from airflow.models.xcom_arg import XComArg <ide> from airflow.operators.bash import BashOperator <ide> from airflow.providers.google.cloud.operators.datacatalog import ( <ide> CloudDataCatalogCreateTagTemplateFieldOperator, <ide> # [START howto_operator_gcp_datacatalog_create_tag_template_result] <ide> create_tag_template_result = BashOperator( <ide> task_id="create_tag_template_result", <del> bash_command=f"echo {create_tag_template.output['tag_template_id']}", <add> bash_command=f"echo {XComArg(create_tag_template, key='tag_template_id')}", <ide> ) <ide> # [END howto_operator_gcp_datacatalog_create_tag_template_result] <ide> <ide> # [START howto_operator_gcp_datacatalog_create_tag_template_field_result] <ide> create_tag_template_field_result = BashOperator( <ide> task_id="create_tag_template_field_result", <del> bash_command=f"echo {create_tag_template_field.output['tag_template_field_id']}", <add> bash_command=f"echo {XComArg(create_tag_template_field, key='tag_template_field_id')}", <ide> ) <ide> # [END howto_operator_gcp_datacatalog_create_tag_template_field_result] <ide> <ide><path>tests/system/providers/google/datacatalog/example_datacatalog_tags.py <ide> <ide> import os <ide> from datetime import datetime <add>from typing import cast <ide> <ide> from google.cloud.datacatalog import TagField, TagTemplateField <ide> <ide> from airflow import models <add>from airflow.models.xcom_arg import XComArg <ide> from airflow.operators.bash import BashOperator <ide> from airflow.providers.google.cloud.operators.datacatalog import ( <ide> CloudDataCatalogCreateEntryGroupOperator, <ide> # [START howto_operator_gcp_datacatalog_create_entry_group_result] <ide> create_entry_group_result = BashOperator( <ide> task_id="create_entry_group_result", <del> bash_command=f"echo {create_entry_group.output['entry_group_id']}", <add> bash_command=f"echo {XComArg(create_entry_group, key='entry_group_id')}", <ide> ) <ide> # [END howto_operator_gcp_datacatalog_create_entry_group_result] <ide> <ide> # [START howto_operator_gcp_datacatalog_create_entry_gcs_result] <ide> create_entry_gcs_result = BashOperator( <ide> task_id="create_entry_gcs_result", <del> bash_command=f"echo {create_entry_gcs.output['entry_id']}", <add> bash_command=f"echo {XComArg(create_entry_gcs, key='entry_id')}", <ide> ) <ide> # [END howto_operator_gcp_datacatalog_create_entry_gcs_result] <ide> <ide> ) <ide> # [END howto_operator_gcp_datacatalog_create_tag] <ide> <add> tag_id = cast(str, XComArg(create_tag, key='tag_id')) <add> <ide> # [START howto_operator_gcp_datacatalog_create_tag_result] <ide> create_tag_result = BashOperator( <ide> task_id="create_tag_result", <del> bash_command=f"echo {create_tag.output['tag_id']}", <add> bash_command=f"echo {tag_id}", <ide> ) <ide> # [END howto_operator_gcp_datacatalog_create_tag_result] <ide> <ide> # [START howto_operator_gcp_datacatalog_create_tag_template_result] <ide> create_tag_template_result = BashOperator( <ide> task_id="create_tag_template_result", <del> bash_command=f"echo {create_tag_template.output['tag_template_id']}", <add> bash_command=f"echo {XComArg(create_tag_template, key='tag_template_id')}", <ide> ) <ide> # [END howto_operator_gcp_datacatalog_create_tag_template_result] <ide> <ide> location=LOCATION, <ide> entry_group=ENTRY_GROUP_ID, <ide> entry=ENTRY_ID, <del> tag_id=f"{create_tag.output['tag_id']}", <add> tag_id=tag_id, <ide> ) <ide> # [END howto_operator_gcp_datacatalog_update_tag] <ide> <ide> location=LOCATION, <ide> entry_group=ENTRY_GROUP_ID, <ide> entry=ENTRY_ID, <del> tag=create_tag.output["tag_id"], <add> tag=tag_id, <ide> ) <ide> # [END howto_operator_gcp_datacatalog_delete_tag] <ide> delete_tag.trigger_rule = TriggerRule.ALL_DONE <ide><path>tests/system/providers/google/marketing_platform/example_campaign_manager.py <ide> import os <ide> import time <ide> from datetime import datetime <add>from typing import cast <ide> <ide> from airflow import models <add>from airflow.models.xcom_arg import XComArg <ide> from airflow.providers.google.cloud.operators.gcs import GCSCreateBucketOperator, GCSDeleteBucketOperator <ide> from airflow.providers.google.marketing_platform.operators.campaign_manager import ( <ide> GoogleCampaignManagerBatchInsertConversionsOperator, <ide> create_report = GoogleCampaignManagerInsertReportOperator( <ide> profile_id=PROFILE_ID, report=REPORT, task_id="create_report" <ide> ) <del> report_id = create_report.output["report_id"] <add> report_id = cast(str, XComArg(create_report, key="report_id")) <ide> # [END howto_campaign_manager_insert_report_operator] <ide> <ide> # [START howto_campaign_manager_run_report_operator] <ide> run_report = GoogleCampaignManagerRunReportOperator( <ide> profile_id=PROFILE_ID, report_id=report_id, task_id="run_report" <ide> ) <del> file_id = run_report.output["file_id"] <add> file_id = cast(str, XComArg(run_report, key="file_id")) <ide> # [END howto_campaign_manager_run_report_operator] <ide> <ide> # [START howto_campaign_manager_wait_for_operation] <ide><path>tests/system/providers/google/marketing_platform/example_search_ads.py <ide> """ <ide> import os <ide> from datetime import datetime <add>from typing import cast <ide> <ide> from airflow import models <add>from airflow.models.xcom_arg import XComArg <ide> from airflow.providers.google.marketing_platform.operators.search_ads import ( <ide> GoogleSearchAdsDownloadReportOperator, <ide> GoogleSearchAdsInsertReportOperator, <ide> # [END howto_search_ads_generate_report_operator] <ide> <ide> # [START howto_search_ads_get_report_id] <del> report_id = generate_report.output["report_id"] <add> report_id = cast(str, XComArg(generate_report, key="report_id")) <ide> # [END howto_search_ads_get_report_id] <ide> <ide> # [START howto_search_ads_get_report_operator] <ide><path>tests/system/providers/microsoft/azure/example_adf_run_pipeline.py <ide> # under the License. <ide> import os <ide> from datetime import datetime, timedelta <add>from typing import cast <ide> <ide> from airflow.models import DAG <add>from airflow.models.xcom_arg import XComArg <ide> <ide> try: <ide> from airflow.operators.empty import EmptyOperator <ide> <ide> pipeline_run_sensor = AzureDataFactoryPipelineRunStatusSensor( <ide> task_id="pipeline_run_sensor", <del> run_id=run_pipeline2.output["run_id"], <add> run_id=cast(str, XComArg(run_pipeline2, key="run_id")), <ide> ) <ide> # [END howto_operator_adf_run_pipeline_async] <ide> <ide><path>tests/system/providers/tableau/example_tableau.py <ide> """ <ide> import os <ide> from datetime import datetime, timedelta <add>from typing import cast <ide> <ide> from airflow import DAG <ide> from airflow.providers.tableau.operators.tableau import TableauOperator <ide> ) <ide> # The following task queries the status of the workbook refresh job until it succeeds. <ide> task_check_job_status = TableauJobStatusSensor( <del> job_id=task_refresh_workbook_non_blocking.output, <add> job_id=cast(str, task_refresh_workbook_non_blocking.output), <ide> task_id='check_tableau_job_status', <ide> ) <ide> <ide><path>tests/system/providers/tableau/example_tableau_refresh_workbook.py <ide> """ <ide> import os <ide> from datetime import datetime, timedelta <add>from typing import cast <ide> <ide> from airflow import DAG <ide> from airflow.providers.tableau.operators.tableau import TableauOperator <ide> ) <ide> # The following task queries the status of the workbook refresh job until it succeeds. <ide> task_check_job_status = TableauJobStatusSensor( <del> job_id=task_refresh_workbook_non_blocking.output, <add> job_id=cast(str, task_refresh_workbook_non_blocking.output), <ide> task_id='check_tableau_job_status', <ide> ) <ide>
45
Python
Python
update error messages in keras/utils/vis_utils.py
fdadb494d5a22e3e6d9caf82e4e337e6c7d7aada
<ide><path>keras/utils/vis_utils.py <ide> def get_layer_index_bound_by_layer_name(model, layer_names): <ide> lower_index.append(idx) <ide> if re.match(layer_names[1], layer.name): <ide> upper_index.append(idx) <del> if len(lower_index) == 0 or len(upper_index) == 0: <del> raise ValueError('Passed layer_range does not match to model layers') <add> if not lower_index or not upper_index: <add> raise ValueError( <add> 'Passed layer_names does not match to layers in the model. ' <add> f'Recieved: {layer_names}') <ide> if min(lower_index) > max(upper_index): <ide> return [min(upper_index), max(lower_index)] <ide> return [min(lower_index), max(upper_index)] <ide> def model_to_dot(model, <ide> <ide> if layer_range: <ide> if len(layer_range) != 2: <del> raise ValueError('layer_range must be of shape (2,)') <add> raise ValueError( <add> 'layer_range must be of shape (2,). Received: ' <add> f'layer_range = {layer_range} of length {len(layer_range)}') <ide> if (not isinstance(layer_range[0], str) or <ide> not isinstance(layer_range[1], str)): <del> raise ValueError('layer_range should contain string type only') <add> raise ValueError( <add> 'layer_range should contain string type only. ' <add> f'Received: {layer_range}') <ide> layer_range = get_layer_index_bound_by_layer_name(model, layer_range) <ide> if layer_range[0] < 0 or layer_range[1] > len(model.layers): <del> raise ValueError('Both values in layer_range should be in', <del> 'range (%d, %d)' % (0, len(model.layers))) <add> raise ValueError('Both values in layer_range should be in range (0, ' <add> f'{len(model.layers)}. Recieved: {layer_range}') <ide> <ide> sub_n_first_node = {} <ide> sub_n_last_node = {}
1
Javascript
Javascript
use iso weekyear for html5_fmt.week
3147fbc486209f0b479dc0b29672d4c2ef39cf43
<ide><path>src/moment.js <ide> moment.HTML5_FMT = { <ide> TIME: 'HH:mm', // <input type="time" /> <ide> TIME_SECONDS: 'HH:mm:ss', // <input type="time" step="1" /> <ide> TIME_MS: 'HH:mm:ss.SSS', // <input type="time" step="0.001" /> <del> WEEK: 'YYYY-[W]WW', // <input type="week" /> <add> WEEK: 'GGGG-[W]WW', // <input type="week" /> <ide> MONTH: 'YYYY-MM' // <input type="month" /> <ide> }; <ide> <ide><path>src/test/moment/format.js <ide> import moment from '../../moment'; <ide> module('format'); <ide> <ide> test('format using constants', function (assert) { <del> var m = moment('2017-09-01T23:40:40.678'); <del> assert.equal(m.format(moment.HTML5_FMT.DATETIME_LOCAL), '2017-09-01T23:40', 'datetime local format constant'); <del> assert.equal(m.format(moment.HTML5_FMT.DATETIME_LOCAL_SECONDS), '2017-09-01T23:40:40', 'datetime local format constant'); <del> assert.equal(m.format(moment.HTML5_FMT.DATETIME_LOCAL_MS), '2017-09-01T23:40:40.678', 'datetime local format constant with seconds and millis'); <del> assert.equal(m.format(moment.HTML5_FMT.DATE), '2017-09-01', 'date format constant'); <add> var m = moment('2016-01-02T23:40:40.678'); <add> assert.equal(m.format(moment.HTML5_FMT.DATETIME_LOCAL), '2016-01-02T23:40', 'datetime local format constant'); <add> assert.equal(m.format(moment.HTML5_FMT.DATETIME_LOCAL_SECONDS), '2016-01-02T23:40:40', 'datetime local format constant'); <add> assert.equal(m.format(moment.HTML5_FMT.DATETIME_LOCAL_MS), '2016-01-02T23:40:40.678', 'datetime local format constant with seconds and millis'); <add> assert.equal(m.format(moment.HTML5_FMT.DATE), '2016-01-02', 'date format constant'); <ide> assert.equal(m.format(moment.HTML5_FMT.TIME), '23:40', 'time format constant'); <ide> assert.equal(m.format(moment.HTML5_FMT.TIME_SECONDS), '23:40:40', 'time format constant with seconds'); <ide> assert.equal(m.format(moment.HTML5_FMT.TIME_MS), '23:40:40.678', 'time format constant with seconds and millis'); <del> assert.equal(m.format(moment.HTML5_FMT.WEEK), '2017-W35', 'week format constant'); <del> assert.equal(m.format(moment.HTML5_FMT.MONTH), '2017-09', 'month format constant'); <add> assert.equal(m.format(moment.HTML5_FMT.WEEK), '2015-W53', 'week format constant'); <add> assert.equal(m.format(moment.HTML5_FMT.MONTH), '2016-01', 'month format constant'); <ide> }); <ide> <ide> test('format YY', function (assert) { <ide> test('Y token', function (assert) { <ide> assert.equal(moment('9999-01-01', 'Y-MM-DD', true).format('Y'), '9999', 'format 9999 with Y'); <ide> assert.equal(moment('10000-01-01', 'Y-MM-DD', true).format('Y'), '+10000', 'format 10000 with Y'); <ide> }); <add> <add>test('HTML5_FMT.WEEK', function (assert) { <add> assert.equal(moment('2004-W01', moment.HTML5_FMT.WEEK).format(moment.HTML5_FMT.WEEK), '2004-W01', 'issue #4698 regression'); <add> assert.equal(moment('2019-W01').format(moment.HTML5_FMT.WEEK), '2019-W01', 'issue #4833 regression'); <add>});
2
Python
Python
update version for paver script
71c4ff95ca381756cda98bcbb0ac7f11c212d600
<ide><path>pavement.py <ide> DOC_BLD_LATEX = DOC_BLD / "latex" <ide> <ide> # Source of the release notes <del>RELEASE = 'doc/release/1.3.0-notes.rst' <add>RELEASE = 'doc/release/1.4.0-notes.rst' <ide> <ide> # Start/end of the log (from git) <del>LOG_START = 'tags/1.2.0' <add>LOG_START = 'svn/tags/1.3.0' <ide> LOG_END = 'master' <ide> <ide> # Virtualenv bootstrap stuff
1
Mixed
Text
fix comment about swap limit of docker update
603bc69b2c3c00714c18e6ddc65bf53c2f1a079d
<ide><path>api/client/update.go <ide> func (cli *DockerCli) CmdUpdate(args ...string) error { <ide> flCPUShares := cmd.Int64([]string{"#c", "-cpu-shares"}, 0, "CPU shares (relative weight)") <ide> flMemoryString := cmd.String([]string{"m", "-memory"}, "", "Memory limit") <ide> flMemoryReservation := cmd.String([]string{"-memory-reservation"}, "", "Memory soft limit") <del> flMemorySwap := cmd.String([]string{"-memory-swap"}, "", "Total memory (memory + swap), '-1' to disable swap") <add> flMemorySwap := cmd.String([]string{"-memory-swap"}, "", "Swap limit equal to memory plus swap: '-1' to enable unlimited swap") <ide> flKernelMemory := cmd.String([]string{"-kernel-memory"}, "", "Kernel memory limit") <ide> <ide> cmd.Require(flag.Min, 1) <ide><path>docs/reference/api/docker_remote_api_v1.23.md <ide> Json Parameters: <ide> for the container. <ide> - **User** - A string value specifying the user inside the container. <ide> - **Memory** - Memory limit in bytes. <del>- **MemorySwap** - Total memory limit (memory + swap); set `-1` to disable swap <add>- **MemorySwap** - Total memory limit (memory + swap); set `-1` to enable unlimited swap. <ide> You must use this with `memory` and make the swap value larger than `memory`. <ide> - **MemoryReservation** - Memory soft limit in bytes. <ide> - **KernelMemory** - Kernel memory limit in bytes. <ide> Query Parameters: <ide> - **rm** - Remove intermediate containers after a successful build (default behavior). <ide> - **forcerm** - Always remove intermediate containers (includes `rm`). <ide> - **memory** - Set memory limit for build. <del>- **memswap** - Total memory (memory + swap), `-1` to disable swap. <add>- **memswap** - Total memory (memory + swap), `-1` to enable unlimited swap. <ide> - **cpushares** - CPU shares (relative weight). <ide> - **cpusetcpus** - CPUs in which to allow execution (e.g., `0-3`, `0,1`). <ide> - **cpuperiod** - The length of a CPU period in microseconds. <ide><path>docs/reference/commandline/update.md <ide> parent = "smn_cli" <ide> --cpuset-mems="" Memory nodes (MEMs) in which to allow execution (0-3, 0,1) <ide> -m, --memory="" Memory limit <ide> --memory-reservation="" Memory soft limit <del> --memory-swap="" Total memory (memory + swap), '-1' to disable swap <add> --memory-swap="" A positive integer equal to memory plus swap. Specify -1 to enable unlimited swap <ide> --kernel-memory="" Kernel memory limit: container must be stopped <ide> <ide> The `docker update` command dynamically updates container resources. Use this
3
Javascript
Javascript
fix typos in tests
6f3e26c40436f69e9d4bfb4ea518c89bf3b7219a
<ide><path>test/ngResource/resourceSpec.js <ide> describe("resource", function() { <ide> }); <ide> <ide> <del> it('should ignore slashes of undefinend parameters', function() { <add> it('should ignore slashes of undefined parameters', function() { <ide> var R = $resource('/Path/:a/:b/:c'); <ide> <ide> $httpBackend.when('GET', '/Path').respond('{}'); <ide> describe("resource", function() { <ide> R.get({a:6, b:7, c:8}); <ide> }); <ide> <del> it('should not ignore leading slashes of undefinend parameters that have non-slash trailing sequence', function() { <add> it('should not ignore leading slashes of undefined parameters that have non-slash trailing sequence', function() { <ide> var R = $resource('/Path/:a.foo/:b.bar/:c.baz'); <ide> <ide> $httpBackend.when('GET', '/Path/.foo/.bar.baz').respond('{}'); <ide> describe("resource", function() { <ide> }); <ide> <ide> it('should not encode @ in url params', function() { <del> //encodeURIComponent is too agressive and doesn't follow http://www.ietf.org/rfc/rfc3986.txt <add> //encodeURIComponent is too aggressive and doesn't follow http://www.ietf.org/rfc/rfc3986.txt <ide> //with regards to the character set (pchar) allowed in path segments <ide> //so we need this test to make sure that we don't over-encode the params and break stuff like <ide> //buzz api which uses @self
1
Javascript
Javascript
create mock doc objects correctly
d4493fda2c4c2ff1fdfc264bfb479741abc781c7
<ide><path>docs/spec/ngdocSpec.js <ide> describe('ngdoc', function() { <ide> function property(name) { <ide> return function(obj) {return obj[name];}; <ide> } <del> function noop() {} <del> function doc(type, name){ <del> return { <del> id: name, <del> ngdoc: type, <del> keywords: noop <del> }; <del> } <del> <del> var dev_guide_overview = doc('overview', 'dev_guide.overview'); <del> var dev_guide_bootstrap = doc('function', 'dev_guide.bootstrap'); <add> var dev_guide_overview = new Doc({ngdoc:'overview', id:'dev_guide.overview', text: ''}); <add> var dev_guide_bootstrap = new Doc({ngdoc:'function', id:'dev_guide.bootstrap', text: ''}); <ide> <ide> it('should put angular.fn() in front of dev_guide.overview, etc', function() { <ide> expect(ngdoc.metadata([dev_guide_overview, dev_guide_bootstrap]).map(property('id')))
1
Ruby
Ruby
fix indentation in code example of delegation
665322eaab7246a961ff6a90cdceaf63c277d8d1
<ide><path>activesupport/lib/active_support/core_ext/module/delegation.rb <ide> class Module <ide> # no matter whether +nil+ responds to the delegated method. You can get a <ide> # +nil+ instead with the +:allow_nil+ option. <ide> # <del> # class Foo <del> # attr_accessor :bar <del> # def initialize(bar = nil) <del> # @bar = bar <del> # end <del> # delegate :zoo, :to => :bar <del> # end <del> # <del> # Foo.new.zoo # raises NoMethodError exception (you called nil.zoo) <del> # <del> # class Foo <del> # attr_accessor :bar <del> # def initialize(bar = nil) <del> # @bar = bar <del> # end <del> # delegate :zoo, :to => :bar, :allow_nil => true <del> # end <del> # <del> # Foo.new.zoo # returns nil <add> # class Foo <add> # attr_accessor :bar <add> # def initialize(bar = nil) <add> # @bar = bar <add> # end <add> # delegate :zoo, :to => :bar <add> # end <add> # <add> # Foo.new.zoo # raises NoMethodError exception (you called nil.zoo) <add> # <add> # class Foo <add> # attr_accessor :bar <add> # def initialize(bar = nil) <add> # @bar = bar <add> # end <add> # delegate :zoo, :to => :bar, :allow_nil => true <add> # end <add> # <add> # Foo.new.zoo # returns nil <ide> # <ide> def delegate(*methods) <ide> options = methods.pop
1
Java
Java
fix scan/reduce/collect factory ambiguity
c63c76b5df000686be73d8fd0bbde210c85bee9b
<ide><path>src/main/java/rx/Observable.java <ide> public final <R> Observable<R> cast(final Class<R> klass) { <ide> * <dd>{@code collect} does not operate by default on a particular {@link Scheduler}.</dd> <ide> * </dl> <ide> * <del> * @param state <add> * @param stateFactory <ide> * the mutable data structure that will collect the items <ide> * @param collector <ide> * a function that accepts the {@code state} and an emitted item, and modifies {@code state} <ide> public final <R> Observable<R> cast(final Class<R> klass) { <ide> * into a single mutable data structure <ide> * @see <a href="https://github.com/ReactiveX/RxJava/wiki/Mathematical-and-Aggregate-Operators#collect">RxJava wiki: collect</a> <ide> */ <del> public final <R> Observable<R> collect(R state, final Action2<R, ? super T> collector) { <add> public final <R> Observable<R> collect(Func0<R> stateFactory, final Action2<R, ? super T> collector) { <ide> Func2<R, T, R> accumulator = new Func2<R, T, R>() { <ide> <ide> @Override <ide> public final R call(R state, T value) { <ide> } <ide> <ide> }; <del> return reduce(state, accumulator); <add> <add> /* <add> * Discussion and confirmation of implementation at <add> * https://github.com/ReactiveX/RxJava/issues/423#issuecomment-27642532 <add> * <add> * It should use last() not takeLast(1) since it needs to emit an error if the sequence is empty. <add> */ <add> return lift(new OperatorScan<R, T>(stateFactory, accumulator)).last(); <ide> } <ide> <ide> /** <ide> public final <R> Observable<R> reduce(R initialValue, Func2<R, ? super T, R> acc <ide> return scan(initialValue, accumulator).takeLast(1); <ide> } <ide> <del> /** <del> * Returns an Observable that applies a specified accumulator function to the first item emitted by a source <del> * Observable and a specified seed value, then feeds the result of that function along with the second item <del> * emitted by an Observable into the same function, and so on until all items have been emitted by the <del> * source Observable, emitting the final result from the final call to your function as its sole item. <del> * <p> <del> * <img width="640" height="325" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/reduceSeed.png" alt=""> <del> * <p> <del> * This technique, which is called "reduce" here, is sometimec called "aggregate," "fold," "accumulate," <del> * "compress," or "inject" in other programming contexts. Groovy, for instance, has an {@code inject} method <del> * that does a similar operation on lists. <del> * <dl> <del> * <dt><b>Backpressure Support:</b></dt> <del> * <dd>This operator does not support backpressure because by intent it will receive all values and reduce <del> * them to a single {@code onNext}.</dd> <del> * <dt><b>Scheduler:</b></dt> <del> * <dd>{@code reduce} does not operate by default on a particular {@link Scheduler}.</dd> <del> * </dl> <del> * <del> * @param initialValueFactory <del> * factory to produce the initial (seed) accumulator item each time the Observable is subscribed to <del> * @param accumulator <del> * an accumulator function to be invoked on each item emitted by the source Observable, the <del> * result of which will be used in the next accumulator call <del> * @return an Observable that emits a single item that is the result of accumulating the output from the <del> * items emitted by the source Observable <del> * @see <a href="https://github.com/ReactiveX/RxJava/wiki/Mathematical-and-Aggregate-Operators#reduce">RxJava wiki: reduce</a> <del> * @see <a href="http://en.wikipedia.org/wiki/Fold_(higher-order_function)">Wikipedia: Fold (higher-order function)</a> <del> */ <del> public final <R> Observable<R> reduce(Func0<R> initialValueFactory, Func2<R, ? super T, R> accumulator) { <del> return scan(initialValueFactory, accumulator).takeLast(1); <del> } <del> <del> <ide> /** <ide> * Returns an Observable that repeats the sequence of items emitted by the source Observable indefinitely. <ide> * <p> <ide> public final Observable<T> scan(Func2<T, T, T> accumulator) { <ide> public final <R> Observable<R> scan(R initialValue, Func2<R, ? super T, R> accumulator) { <ide> return lift(new OperatorScan<R, T>(initialValue, accumulator)); <ide> } <del> <del> /** <del> * Returns an Observable that applies a specified accumulator function to the first item emitted by a source <del> * Observable and a seed value, then feeds the result of that function along with the second item emitted by <del> * the source Observable into the same function, and so on until all items have been emitted by the source <del> * Observable, emitting the result of each of these iterations. <del> * <p> <del> * <img width="640" height="320" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/scanSeed.png" alt=""> <del> * <p> <del> * This sort of function is sometimes called an accumulator. <del> * <p> <del> * Note that the Observable that results from this method will emit the item returned from <del> * {@code initialValueFactory} as its first emitted item. <del> * <dl> <del> * <dt><b>Scheduler:</b></dt> <del> * <dd>{@code scan} does not operate by default on a particular {@link Scheduler}.</dd> <del> * </dl> <del> * <del> * @param initialValueFactory <del> * factory to produce the initial (seed) accumulator item each time the Observable is subscribed to <del> * @param accumulator <del> * an accumulator function to be invoked on each item emitted by the source Observable, whose <del> * result will be emitted to {@link Observer}s via {@link Observer#onNext onNext} and used in the <del> * next accumulator call <del> * @return an Observable that emits the item returned from {@code initialValueFactory} followed by the <del> * results of each call to the accumulator function <del> * @see <a href="https://github.com/ReactiveX/RxJava/wiki/Transforming-Observables#scan">RxJava wiki: scan</a> <del> */ <del> public final <R> Observable<R> scan(Func0<R> initialValueFactory, Func2<R, ? super T, R> accumulator) { <del> return lift(new OperatorScan<R, T>(initialValueFactory, accumulator)); <del> } <ide> <ide> /** <ide> * Forces an Observable's emissions and notifications to be serialized and for it to obey the Rx contract <ide><path>src/test/java/rx/ObservableTests.java <ide> import rx.exceptions.OnErrorNotImplementedException; <ide> import rx.functions.Action1; <ide> import rx.functions.Action2; <add>import rx.functions.Func0; <ide> import rx.functions.Func1; <ide> import rx.functions.Func2; <ide> import rx.observables.ConnectableObservable; <ide> public void testRangeWithScheduler() { <ide> <ide> @Test <ide> public void testCollectToList() { <del> List<Integer> list = Observable.just(1, 2, 3).collect(new ArrayList<Integer>(), new Action2<List<Integer>, Integer>() { <add> Observable<List<Integer>> o = Observable.just(1, 2, 3).collect(new Func0<List<Integer>>() { <add> <add> @Override <add> public List<Integer> call() { <add> return new ArrayList<Integer>(); <add> } <add> <add> }, new Action2<List<Integer>, Integer>() { <ide> <ide> @Override <ide> public void call(List<Integer> list, Integer v) { <ide> list.add(v); <ide> } <del> }).toBlocking().last(); <add> }); <add> <add> List<Integer> list = o.toBlocking().last(); <ide> <ide> assertEquals(3, list.size()); <ide> assertEquals(1, list.get(0).intValue()); <ide> assertEquals(2, list.get(1).intValue()); <ide> assertEquals(3, list.get(2).intValue()); <add> <add> // test multiple subscribe <add> List<Integer> list2 = o.toBlocking().last(); <add> <add> assertEquals(3, list2.size()); <add> assertEquals(1, list2.get(0).intValue()); <add> assertEquals(2, list2.get(1).intValue()); <add> assertEquals(3, list2.get(2).intValue()); <ide> } <ide> <ide> @Test <ide> public void testCollectToString() { <del> String value = Observable.just(1, 2, 3).collect(new StringBuilder(), new Action2<StringBuilder, Integer>() { <add> String value = Observable.just(1, 2, 3).collect(new Func0<StringBuilder>() { <add> <add> @Override <add> public StringBuilder call() { <add> return new StringBuilder(); <add> } <add> <add> }, new Action2<StringBuilder, Integer>() { <ide> <ide> @Override <ide> public void call(StringBuilder sb, Integer v) { <ide><path>src/test/java/rx/internal/operators/OperatorScanTest.java <ide> import rx.Observable; <ide> import rx.Observer; <ide> import rx.Subscriber; <add>import rx.functions.Action2; <ide> import rx.functions.Func0; <ide> import rx.functions.Func1; <ide> import rx.functions.Func2; <ide> public void onNext(Integer t) { <ide> assertEquals(101, count.get()); <ide> } <ide> <add> /** <add> * This uses the public API collect which uses scan under the covers. <add> */ <ide> @Test <ide> public void testSeedFactory() { <ide> Observable<List<Integer>> o = Observable.range(1, 10) <del> .scan(new Func0<List<Integer>>() { <add> .collect(new Func0<List<Integer>>() { <ide> <ide> @Override <ide> public List<Integer> call() { <ide> return new ArrayList<Integer>(); <ide> } <ide> <del> }, new Func2<List<Integer>, Integer, List<Integer>>() { <add> }, new Action2<List<Integer>, Integer>() { <ide> <ide> @Override <del> public List<Integer> call(List<Integer> list, Integer t2) { <add> public void call(List<Integer> list, Integer t2) { <ide> list.add(t2); <del> return list; <ide> } <ide> <ide> }).takeLast(1);
3
Javascript
Javascript
fix legend and title layout options update
f0c6b3f8342e2406c250329336037a7f7004284e
<ide><path>src/core/core.layoutService.js <ide> module.exports = function(Chart) { <ide> * Register a box to a chart. <ide> * A box is simply a reference to an object that requires layout. eg. Scales, Legend, Title. <ide> * @param {Chart} chart - the chart to use <del> * @param {ILayoutItem} layoutItem - the item to add to be layed out <add> * @param {ILayoutItem} item - the item to add to be layed out <ide> */ <del> addBox: function(chart, layoutItem) { <add> addBox: function(chart, item) { <ide> if (!chart.boxes) { <ide> chart.boxes = []; <ide> } <ide> <del> // Ensure that all layout items have a weight <del> if (!layoutItem.weight) { <del> layoutItem.weight = 0; <del> } <del> chart.boxes.push(layoutItem); <add> // initialize item with default values <add> item.fullWidth = item.fullWidth || false; <add> item.position = item.position || 'top'; <add> item.weight = item.weight || 0; <add> <add> chart.boxes.push(item); <ide> }, <ide> <ide> /** <ide> module.exports = function(Chart) { <ide> } <ide> }, <ide> <add> /** <add> * Sets (or updates) options on the given `item`. <add> * @param {Chart} chart - the chart in which the item lives (or will be added to) <add> * @param {Object} item - the item to configure with the given options <add> * @param {Object} options - the new item options. <add> */ <add> configure: function(chart, item, options) { <add> var props = ['fullWidth', 'position', 'weight']; <add> var ilen = props.length; <add> var i = 0; <add> var prop; <add> <add> for (; i<ilen; ++i) { <add> prop = props[i]; <add> if (options.hasOwnProperty(prop)) { <add> item[prop] = options[prop]; <add> } <add> } <add> }, <add> <ide> /** <ide> * Fits boxes of the given chart into the given size by having each box measure itself <ide> * then running a fitting algorithm <ide><path>src/plugins/plugin.legend.js <ide> module.exports = function(Chart) { <ide> <ide> var helpers = Chart.helpers; <add> var layout = Chart.layoutService; <ide> var noop = helpers.noop; <ide> <ide> Chart.defaults.global.legend = { <del> <ide> display: true, <ide> position: 'top', <del> fullWidth: true, // marks that this box should take the full width of the canvas (pushing down other boxes) <add> fullWidth: true, <ide> reverse: false, <add> weight: 1000, <ide> <ide> // a callback that will handle <ide> onClick: function(e, legendItem) { <ide> module.exports = function(Chart) { <ide> var legend = new Chart.Legend({ <ide> ctx: chart.ctx, <ide> options: legendOpts, <del> chart: chart, <del> <del> // ILayoutItem parameters for layout service <del> // pick a large number to ensure we are on the outside after any axes <del> weight: 1000, <del> position: legendOpts.position, <del> fullWidth: legendOpts.fullWidth, <add> chart: chart <ide> }); <add> <add> layout.configure(chart, legend, legendOpts); <add> layout.addBox(chart, legend); <ide> chart.legend = legend; <del> Chart.layoutService.addBox(chart, legend); <ide> } <ide> <ide> return { <ide> module.exports = function(Chart) { <ide> createNewLegendAndAttach(chart, legendOpts); <ide> } <ide> }, <add> <ide> beforeUpdate: function(chart) { <ide> var legendOpts = chart.options.legend; <ide> var legend = chart.legend; <ide> module.exports = function(Chart) { <ide> legendOpts = helpers.configMerge(Chart.defaults.global.legend, legendOpts); <ide> <ide> if (legend) { <add> layout.configure(chart, legend, legendOpts); <ide> legend.options = legendOpts; <ide> } else { <ide> createNewLegendAndAttach(chart, legendOpts); <ide> } <ide> } else if (legend) { <del> Chart.layoutService.removeBox(chart, legend); <add> layout.removeBox(chart, legend); <ide> delete chart.legend; <ide> } <ide> }, <add> <ide> afterEvent: function(chart, e) { <ide> var legend = chart.legend; <ide> if (legend) { <ide><path>src/plugins/plugin.title.js <ide> module.exports = function(Chart) { <ide> <ide> var helpers = Chart.helpers; <add> var layout = Chart.layoutService; <ide> var noop = helpers.noop; <ide> <ide> Chart.defaults.global.title = { <ide> display: false, <ide> position: 'top', <del> fullWidth: true, // marks that this box should take the full width of the canvas (pushing down other boxes) <del> <add> fullWidth: true, <add> weight: 2000, // by default greater than legend (1000) to be above <ide> fontStyle: 'bold', <ide> padding: 10, <ide> <ide> module.exports = function(Chart) { <ide> var title = new Chart.Title({ <ide> ctx: chart.ctx, <ide> options: titleOpts, <del> chart: chart, <del> <del> // ILayoutItem parameters <del> weight: 2000, // greater than legend to be above <del> position: titleOpts.position, <del> fullWidth: titleOpts.fullWidth, <add> chart: chart <ide> }); <add> <add> layout.configure(chart, title, titleOpts); <add> layout.addBox(chart, title); <ide> chart.titleBlock = title; <del> Chart.layoutService.addBox(chart, title); <ide> } <ide> <ide> return { <ide> module.exports = function(Chart) { <ide> createNewTitleBlockAndAttach(chart, titleOpts); <ide> } <ide> }, <add> <ide> beforeUpdate: function(chart) { <ide> var titleOpts = chart.options.title; <ide> var titleBlock = chart.titleBlock; <ide> module.exports = function(Chart) { <ide> titleOpts = helpers.configMerge(Chart.defaults.global.title, titleOpts); <ide> <ide> if (titleBlock) { <add> layout.configure(chart, titleBlock, titleOpts); <ide> titleBlock.options = titleOpts; <ide> } else { <ide> createNewTitleBlockAndAttach(chart, titleOpts); <ide><path>test/specs/plugin.legend.tests.js <ide> describe('Legend block tests', function() { <ide> position: 'top', <ide> fullWidth: true, // marks that this box should take the full width of the canvas (pushing down other boxes) <ide> reverse: false, <add> weight: 1000, <ide> <ide> // a callback that will handle <ide> onClick: jasmine.any(Function), <ide> describe('Legend block tests', function() { <ide> expect(chart.legend.options.display).toBe(false); <ide> }); <ide> <add> it ('should update the associated layout item', function() { <add> var chart = acquireChart({ <add> type: 'line', <add> data: {}, <add> options: { <add> legend: { <add> fullWidth: true, <add> position: 'top', <add> weight: 150 <add> } <add> } <add> }); <add> <add> expect(chart.legend.fullWidth).toBe(true); <add> expect(chart.legend.position).toBe('top'); <add> expect(chart.legend.weight).toBe(150); <add> <add> chart.options.legend.fullWidth = false; <add> chart.options.legend.position = 'left'; <add> chart.options.legend.weight = 42; <add> chart.update(); <add> <add> expect(chart.legend.fullWidth).toBe(false); <add> expect(chart.legend.position).toBe('left'); <add> expect(chart.legend.weight).toBe(42); <add> }); <add> <ide> it ('should remove the legend if the new options are false', function() { <ide> var chart = acquireChart({ <ide> type: 'line', <ide><path>test/specs/plugin.title.tests.js <ide> describe('Title block tests', function() { <ide> display: false, <ide> position: 'top', <ide> fullWidth: true, <add> weight: 2000, <ide> fontStyle: 'bold', <ide> padding: 10, <ide> text: '' <ide> describe('Title block tests', function() { <ide> expect(chart.titleBlock.options.display).toBe(false); <ide> }); <ide> <add> it ('should update the associated layout item', function() { <add> var chart = acquireChart({ <add> type: 'line', <add> data: {}, <add> options: { <add> title: { <add> fullWidth: true, <add> position: 'top', <add> weight: 150 <add> } <add> } <add> }); <add> <add> expect(chart.titleBlock.fullWidth).toBe(true); <add> expect(chart.titleBlock.position).toBe('top'); <add> expect(chart.titleBlock.weight).toBe(150); <add> <add> chart.options.title.fullWidth = false; <add> chart.options.title.position = 'left'; <add> chart.options.title.weight = 42; <add> chart.update(); <add> <add> expect(chart.titleBlock.fullWidth).toBe(false); <add> expect(chart.titleBlock.position).toBe('left'); <add> expect(chart.titleBlock.weight).toBe(42); <add> }); <add> <ide> it ('should remove the title if the new options are false', function() { <ide> var chart = acquireChart({ <ide> type: 'line',
5
Ruby
Ruby
make consistent code style
fc062f6601f6dba5a449d2e7008840bba6cb02e6
<ide><path>lib/active_job/queue_adapters/sneakers_adapter.rb <ide> class JobWrapper <ide> <ide> self.from_queue("queue", {}) <ide> <del> def work(*args) <del> job_name = args.shift <del> job_name.new.perform *Parameters.deserialize(args) <add> def work(job, *args) <add> job.new.perform *Parameters.deserialize(args) <ide> end <ide> end <ide> end <ide><path>lib/active_job/queue_adapters/sucker_punch_adapter.rb <ide> def queue(job, *args) <ide> class JobWrapper <ide> include SuckerPunch::Job <ide> <del> def perform(job_name, *args) <del> job_name.new.perform *Parameters.deserialize(args) <add> def perform(job, *args) <add> job.new.perform *Parameters.deserialize(args) <ide> end <ide> end <ide> end
2
Python
Python
fix flake8 errors
580d83ff127f330470867c009c7c6b17847f4287
<ide><path>numpy/core/tests/test_casting_unittests.py <ide> def test_object_casts_NULL_None_equivalence(self, dtype): <ide> else: <ide> assert_array_equal(expected, arr_NULLs.astype(dtype)) <ide> <del> <ide> def test_float_to_bool(self): <ide> # test case corresponding to gh-19514 <ide> # simple test for casting bool_ to float16 <ide> res = np.array([0, 3, -7], dtype=np.int8).view(bool) <ide> expected = [0, 1, 1] <del> assert_array_equal(res, expected) <ide>\ No newline at end of file <add> assert_array_equal(res, expected)
1
Javascript
Javascript
remove redundant icon assets and links
784de367a1815860f1ce025bb375142e881c4435
<ide><path>client/src/head/favicons.js <del>import React from 'react'; <del> <del>const favicons = [ <del> <link <del> href='/assets/apple-touch-icon.png' <del> key='/assets/apple-touch-icon.png' <del> rel='apple-touch-icon' <del> sizes='180x180' <del> />, <del> <link <del> href='/assets/favicon-32x32.png' <del> key='/assets/favicon-32x32.png' <del> rel='icon' <del> sizes='32x32' <del> type='image/png' <del> />, <del> <link <del> href='/assets/android-chrome-192x192.png' <del> key='/assets/android-chrome-192x192.png' <del> rel='icon' <del> sizes='192x192' <del> type='image/png' <del> />, <del> <link <del> href='/assets/favicon-16x16.png' <del> key='/assets/favicon-16x16.png' <del> rel='icon' <del> sizes='16x16' <del> type='image/png' <del> />, <del> <link <del> href='/assets/site.webmanifest' <del> key='/assets/site.webmanifest' <del> rel='manifest' <del> />, <del> <link <del> color='#006400' <del> href='/assets/safari-pinned-tab.svg' <del> key='/assets/safari-pinned-tab.svg' <del> rel='mask-icon' <del> />, <del> <meta <del> content='#006400' <del> key='msapplication-TileColor' <del> name='msapplication-TileColor' <del> />, <del> <meta <del> content='/assets/mstile-144x144.png' <del> key='msapplication-TileImage' <del> name='msapplication-TileImage' <del> />, <del> <meta content='#006400' key='theme-color' name='theme-color' /> <del>]; <del> <del>export default favicons; <ide><path>client/src/head/index.js <del>import favicons from './favicons'; <ide> import meta from './meta'; <ide> import mathjax from './mathjax'; <ide> import scripts from './scripts'; <ide> <del>const metaAndStyleSheets = meta <del> .concat(favicons, mathjax, scripts) <del> .map((element, i) => ({ <del> ...element, <del> key: `meta-stylesheet-${i}`, <del> props: { ...element.props, key: `meta-stylesheet-${i}` } <del> })); <add>const metaAndStyleSheets = meta.concat(mathjax, scripts).map((element, i) => ({ <add> ...element, <add> key: `meta-stylesheet-${i}`, <add> props: { ...element.props, key: `meta-stylesheet-${i}` } <add>})); <ide> <ide> export default metaAndStyleSheets;
2
Ruby
Ruby
find vim on the path
98e5bd8198cc3ac42173eb755b0780e477e36a1c
<ide><path>Library/Homebrew/utils.rb <ide> def which_editor <ide> return 'mate' if which "mate" <ide> # Find BBEdit / TextWrangler <ide> return 'edit' if which "edit" <del> # Default to vim <add> # Find vim <add> return 'vim' if which "vim" <add> # Default to standard vim <ide> return '/usr/bin/vim' <ide> end <ide>
1
Javascript
Javascript
hoist regexp literal
a19ceb5a4706daef5792d08a076d3bb8fc27258a
<ide><path>lib/ExternalModuleFactoryPlugin.js <ide> "use strict"; <ide> <ide> const ExternalModule = require("./ExternalModule"); <add>const UNSPECIFIED_EXTERNAL_TYPE_REGEXP = /^[a-z0-9]+ /; <ide> <ide> class ExternalModuleFactoryPlugin { <ide> constructor(type, externals) { <ide> class ExternalModuleFactoryPlugin { <ide> externalConfig = value; <ide> } <ide> // When no explicit type is specified, extract it from the externalConfig <del> if (type === undefined && /^[a-z0-9]+ /.test(externalConfig)) { <add> if ( <add> type === undefined && <add> UNSPECIFIED_EXTERNAL_TYPE_REGEXP.test(externalConfig) <add> ) { <ide> const idx = externalConfig.indexOf(" "); <ide> type = externalConfig.substr(0, idx); <ide> externalConfig = externalConfig.substr(idx + 1);
1
Javascript
Javascript
use data directly in pdfdoc
2094c291698b2745ddab06dc627bb99d05b8ed0e
<ide><path>pdf.js <ide> var Catalog = (function catalogCatalog() { <ide> })(); <ide> <ide> var PDFDoc = (function pdfDoc() { <del> function constructor(stream) { <add> function constructor(data) { <add> var stream = new Stream(data); <ide> assertWellFormed(stream.length > 0, 'stream must have data'); <ide> this.stream = stream; <ide> this.setup(); <ide><path>test/driver.js <ide> function nextTask() { <ide> r.responseArrayBuffer || r.response; <ide> <ide> try { <del> task.pdfDoc = new PDFDoc(new Stream(data)); <add> task.pdfDoc = new PDFDoc(data); <ide> } catch (e) { <ide> failure = 'load PDF doc : ' + e.toString(); <ide> } <ide><path>web/viewer.js <ide> var PDFView = { <ide> while (container.hasChildNodes()) <ide> container.removeChild(container.lastChild); <ide> <del> var pdf = new PDFDoc(new Stream(data)); <add> var pdf = new PDFDoc(data); <ide> var pagesCount = pdf.numPages; <ide> document.getElementById('numPages').innerHTML = pagesCount; <ide> <ide><path>worker/pdf.js <ide> addEventListener('message', function(event) { <ide> var data = event.data; <ide> // If there is no pdfDocument yet, then the sent data is the PDFDocument. <ide> if (!pdfDocument) { <del> pdfDocument = new PDFDoc(new Stream(data)); <add> pdfDocument = new PDFDoc(data); <ide> postMessage({ <ide> action: 'pdf_num_pages', <ide> data: pdfDocument.numPages
4