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
Ruby
Ruby
note the alias the other way
43ea6e6893f1f128fbd843094c2d00b2f6cf3556
<ide><path>activesupport/lib/active_support/core_ext/array/conversions.rb <ide> def to_sentence(options = {}) <ide> # Extends <tt>Array#to_s</tt> to convert a collection of elements into a <ide> # comma separated id list if <tt>:db</tt> argument is given as the format. <ide> # <del> # This method is aliased to <tt>to_fs</tt>. <add> # This method is aliased to <tt>to_formatted_s</tt>. <ide> # <ide> # Blog.all.to_fs(:db) # => "1,2,3" <ide> # Blog.none.to_fs(:db) # => "null" <ide><path>activesupport/lib/active_support/core_ext/date/conversions.rb <ide> class Date <ide> <ide> # Convert to a formatted string. See DATE_FORMATS for predefined formats. <ide> # <del> # This method is aliased to <tt>to_fs</tt>. <add> # This method is aliased to <tt>to_formatted_s</tt>. <ide> # <ide> # date = Date.new(2007, 11, 10) # => Sat, 10 Nov 2007 <ide> # <ide><path>activesupport/lib/active_support/core_ext/date_time/conversions.rb <ide> class DateTime <ide> # Convert to a formatted string. See Time::DATE_FORMATS for predefined formats. <ide> # <del> # This method is aliased to <tt>to_fs</tt>. <add> # This method is aliased to <tt>to_formatted_s</tt>. <ide> # <ide> # === Examples <ide> # datetime = DateTime.civil(2007, 12, 4, 0, 0, 0, 0) # => Tue, 04 Dec 2007 00:00:00 +0000 <ide><path>activesupport/lib/active_support/core_ext/numeric/conversions.rb <ide> module NumericWithFormat <ide> # Options are provided for phone numbers, currency, percentage, <ide> # precision, positional notation, file size and pretty printing. <ide> # <del> # This method is aliased to <tt>to_fs</tt>. <add> # This method is aliased to <tt>to_formatted_s</tt>. <ide> # <ide> # ==== Options <ide> # <ide><path>activesupport/lib/active_support/core_ext/range/conversions.rb <ide> module RangeWithFormat <ide> <ide> # Convert range to a formatted string. See RANGE_FORMATS for predefined formats. <ide> # <del> # This method is aliased to <tt>to_fs</tt>. <add> # This method is aliased to <tt>to_formatted_s</tt>. <ide> # <ide> # range = (1..100) # => 1..100 <ide> # <ide><path>activesupport/lib/active_support/core_ext/time/conversions.rb <ide> class Time <ide> <ide> # Converts to a formatted string. See DATE_FORMATS for built-in formats. <ide> # <del> # This method is aliased to <tt>to_fs</tt>. <add> # This method is aliased to <tt>to_formatted_s</tt>. <ide> # <ide> # time = Time.now # => 2007-01-18 06:10:17 -06:00 <ide> # <ide><path>activesupport/lib/active_support/time_with_zone.rb <ide> def to_s(format = NOT_SET) <ide> <ide> # Returns a string of the object's date and time. <ide> # <del> # This method is aliased to <tt>to_fs</tt>. <add> # This method is aliased to <tt>to_formatted_s</tt>. <ide> # <ide> # Accepts an optional <tt>format</tt>: <ide> # * <tt>:default</tt> - default value, mimics Ruby Time#to_s format.
7
Javascript
Javascript
add hike service sort by difficulty
02e4c66726f3dbac028d1f2179c744779b92cdf6
<ide><path>server/services/hikes.js <ide> export default function hikesService(app) { <ide> return { <ide> name: 'hikes', <ide> read: (req, resource, params, config, cb) => { <del> Challenge.find({ where: { challengeType: '6' } }, (err, hikes) => { <add> const query = { <add> where: { challengeType: '6' }, <add> order: 'difficulty ASC' <add> }; <add> Challenge.find(query, (err, hikes) => { <ide> if (err) { <ide> return cb(err); <ide> }
1
Ruby
Ruby
allow sparkle without a macos version
94c0d8917eb11f68313bb962b9a595c6bbbd4fd1
<ide><path>Library/Homebrew/cask/audit.rb <ide> def check_livecheck_min_os <ide> return unless cask.livecheckable? <ide> return unless cask.livecheck.strategy == :sparkle <ide> <del> out, _, status = curl_output(cask.livecheck.url) <add> out, _, status = curl_output("--fail", "--silent", "--location", cask.livecheck.url) <ide> return unless status.success? <ide> <ide> require "rexml/document" <ide> def check_livecheck_min_os <ide> <ide> return if xml.blank? <ide> <del> item = xml.get_elements("//rss//channel//item").first <add> item = xml.elements["//rss//channel//item"] <ide> return if item.blank? <ide> <del> min_os = item.elements["sparkle:minimumSystemVersion"].text <add> min_os = item.elements["sparkle:minimumSystemVersion"]&.text <ide> return if min_os.blank? <ide> <del> min_os_string = OS::Mac::Version.new(min_os).strip_patch <del> cask_min_os = cask.depends_on.macos.version <add> begin <add> min_os_string = OS::Mac::Version.new(min_os).strip_patch <add> rescue MacOSVersionError <add> return <add> end <add> <add> cask_min_os = cask.depends_on.macos&.version <ide> <ide> return if cask_min_os == min_os_string <ide> <ide><path>Library/Homebrew/cask/dsl/depends_on.rb <ide> class DSL <ide> # <ide> # @api private <ide> class DependsOn < SimpleDelegator <add> extend T::Sig <ide> VALID_KEYS = Set.new([ <ide> :formula, <ide> :cask, <ide> def cask=(*args) <ide> @cask.concat(args) <ide> end <ide> <add> sig { params(args: String).returns(T.nilable(MacOSRequirement)) } <ide> def macos=(*args) <ide> raise "Only a single 'depends_on macos' is allowed." if defined?(@macos) <ide>
2
Text
Text
add v3.15.0-beta.5 to changelog
f1cc1196e8c992eb0d1d6cd997e0e9cec454563e
<ide><path>CHANGELOG.md <ide> # Ember Changelog <ide> <add>### v3.15.0-beta.5 (December 4, 2019) <add> <add>- [#18582](https://github.com/emberjs/ember.js/pull/18582) [BUGFIX] Ensure `loader.js` is transpiled to the applications specified targets (from `config/targets.js`). <add> <ide> ### v3.15.0-beta.4 (November 25, 2019) <ide> <ide> - [#17834](https://github.com/emberjs/ember.js/pull/17834) [BUGFIX] Prevents autotracking ArrayProxy creation <ide> <ide> ### v3.14.3 (December 3, 2019) <ide> <del>- [#18582](https://github.com/emberjs/ember.js/pull/18582) [BUGFIX release] Ensure `loader.js` is transpiled to the applications specified targets (from `config/targets.js`). <add>- [#18582](https://github.com/emberjs/ember.js/pull/18582) [BUGFIX] Ensure `loader.js` is transpiled to the applications specified targets (from `config/targets.js`). <ide> <ide> ### v3.14.2 (November 20, 2019) <ide>
1
Text
Text
add collaborator guide
8d51235b306af831cca9b71832798e552542a212
<ide><path>COLLABORATOR_GUIDE.md <add># Collaborator Guide <add> <add><!-- START doctoc generated TOC please keep comment here to allow auto update --> <add><!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> <add>**Table of Contents** <add> <add>- [Issues and Pull Requests](#issues-and-pull-requests) <add>- [Accepting changes](#accepting-changes) <add> - [Involving the TSC](#involving-the-tsc) <add>- [Landing a PR](#landing-a-pr) <add> - [Landing a PR manually](#landing-a-pr-manually) <add> - [Landing a PR manually with several changes](#landing-a-pr-manually-with-several-changes) <add> - [I just made a mistake](#i-just-made-a-mistake) <add> - [I accidentally pushed a broken commit or incorrect commit to master](#i-accidentally-pushed-a-broken-commit-or-incorrect-commit-to-master) <add> - [I lost changes](#i-lost-changes) <add> - [I accidentally committed a broken change to master](#i-accidentally-committed-a-broken-change-to-master) <add>- [video.js releases](#videojs-releases) <add> - [Getting dependencies](#getting-dependencies) <add> - [Install contrib](#install-contrib) <add> - [npm access](#npm-access) <add> - [GitHub personal access token](#github-personal-access-token) <add> - [Doing a release](#doing-a-release) <add>- [Doc credit](#doc-credit) <add> <add><!-- END doctoc generated TOC please keep comment here to allow auto update --> <add> <add>## Issues and Pull Requests <add> <add>Full courtesey should always be shown in video.js projects. <add> <add>Collaborators may manage issues they feel qualified to handle, being mindful of our guidelines. <add> <add>Any issue and PR can be closed if they are not relevant, when in doubt leave it open for more discussion. Issues can always be re-opened if new information is made available. <add> <add>If issues or PRs are very short and don't contain much information, ask for more by linking to the [issue][issue template] or [PR][pr template] template. There is also a [response guide](https://github.com/videojs/video.js/wiki/New-Issue-Response-Guide) if you're unsure. <add> <add>## Accepting changes <add> <add>Any code change in video.js should be happening through Pull Requests on GitHub. This includes core committers. <add> <add>Before a PR is merged, it must be reviewed by at least two core committers, at least one if it comes from a core committer. <add> <add>Feel free to @-mention a particular core committer if you know they are experts in the area that is being changed. <add> <add>If you are unsure about the modification and cannot take responsibility for it, defer to another core committer. <add> <add>Before merging the change, it should be left open for other core committers to comment on. At least 24 hours during a weekday, and the 48 hours on a weekend. Trivial changes or bug fixes that have been reviewed by multiple committers may be merged without delay. <add> <add>For non-breaking changes, if there is no disagreeming between the collaborators, the PR may be landed assuming it was reviewed. If there is still disagreement, it may need to be [escalated to the TSC](#involving-the-tsc). <add> <add>Bug fixes require a test case that fails beforehand and succeeds after. All code changes should contain tests and pass on the CI. <add> <add>### Involving the TSC <add> <add>A change or issue can be elevated to the TSC by assing the `tsc-agent` label. This should be done in the following scenarios: <add> <add>* There will be a major impact on the codebase or project <add>* The change is inherently controversial <add>* No agreement was reached between collaborators participating in the discussion <add> <add>The TSC will be the final arbiter when required. <add> <add>## Landing a PR <add> <add>Landing a PR is fairly easy given that we can use the GitHub UI for it. <add> <add>When using the big green button on GitHub, make sure the "squash and merge" is selected -- it should be the only allowed option. If a PR has two features in it and should be merged as two separate commits, either ask the contributor to break it up into two, or follow the [manual steps](#landing-a-pr-manually). <add> <add>The commit message should follow our [conventional changelog conventions][conventions]. They are based on the angularjs changelog conventions. The changelog is then generated from these commit messages on release. <add> <add>The first line of the commit message -- the header and first text box on GitHub -- should be prefixed with a type and optional scope followed by a short description of the commit. <add>The type is required. Two common ones are `fix` and `feat` for bug fixes and new features. Scope is optional and can be anything. <add> <add>The body should contain extra information, potentially copied from the original comment of the PR. <add> <add>The footer should contain things like whether this is a breaking change or what issues were fixed by this PR. <add> <add>Here's an example: <add> <add>``` <add>fix(html5): a regression with html5 tech <add> <add>This is where you'd explain what the regression is. <add> <add>Fixes #123 <add>``` <add> <add>### Landing a PR manually <add> <add>_Optional:_ ensure you're not in a weird rebase or merge state: <add> <add>```sh <add>$ git am --abort <add>$ git rebase --abort <add>``` <add> <add>Checkout and update the master branch: <add> <add>```sh <add>$ git checkout master <add>$ git remote update <add>$ git rebase upstream/master <add>``` <add> <add>Check out the PR: <add> <add>```sh <add>$ git fetch upstream pull/{{PR Number}}/head:{{name of branch}} <add>$ git checkout -t {{name of branch}} <add>``` <add> <add>> For example: <add>> ```sh <add>> $ git fetch upstream pull/123/head:gkatsev-html5-fix <add>> $ git checkout -t gkatsev-html5-fix <add>> ``` <add> <add>_Optional:_ If necessary, rebase against master. If you have multiple features in the PR, [landing a PR manually with several changes](#landing-a-pr-manually-with-several-changes) <add> <add>```sh <add>$ git rebase master <add>``` <add> <add>Fix up any issues that arise from the rebase, change back to the master branch and squash merge: <add> <add>```sh <add>$ git checkout master <add>$ git merge --squash --no-commit gkatsev-html5-fix <add>``` <add> <add>The `--no-commit` tells git not to make a commit on your behalf. It does stage everything for you, so, you can instead it: <add> <add>```sh <add>$ git diff --cached <add>``` <add> <add>Now get the author from the original commit: <add> <add>```sh <add>$ git log -n 1 --pretty=short gkatsev-html5-fix <add>``` <add>Which shows: <add>``` <add>commit 433c58224f5be34480c8e067ca6c5406ba1c1e9c <add>Author: Gary Katsevman <git@gkatsev.com> <add> <add> Update TOC <add>``` <add> <add>Now you can commit the change the change with the author, following our commit guidelines <add> <add>```sh <add>$ git commit --author "Gary Katsevman <git@gkatsev.com>" <add>``` <add> <add>Now that it's committed, push to master <add> <add>```sh <add>$ git push upstream master <add>``` <add> <add>Congratulate yourself for a job well done and the contributor for having his change landed in master. <add> <add>#### Landing a PR manually with several changes <add>Follow the same steps as before but when you rebase against master, you want to do an interactive rebase and then squash the changes into just a few commits. <add> <add>```sh <add>$ git rebase -i master <add>``` <add> <add>This will give you an output like the following: <add> <add>``` <add>pick b4dc15d Update CONTRIBUTING.md with latest info <add>pick 8592149 Add Dev certificate of origin <add>pick 259dee6 Add grunt and doctoc npm scripts <add>pick f12af12 Add conventional-changelog-videojs link <add>pick ae4613a Update node's CONTRIBUTING.md url <add>pick 433c582 Update TOC <add> <add># Rebase f599ef4..433c582 onto f599ef4 (6 command(s)) <add># <add># Commands: <add># p, pick = use commit <add># r, reword = use commit, but edit the commit message <add># e, edit = use commit, but stop for amending <add># s, squash = use commit, but meld into previous commit <add># f, fixup = like "squash", but discard this commit's log message <add># x, exec = run command (the rest of the line) using shell <add># d, drop = remove commit <add># <add># These lines can be re-ordered; they are executed from top to bottom. <add># <add># If you remove a line here THAT COMMIT WILL BE LOST. <add># <add># However, if you remove everything, the rebase will be aborted. <add># <add># Note that empty commits are commented out <add>``` <add> <add>Replace `pick` to `fixup` or `edit` depending on how you want the output to look. You can also re-order the commits, if necessary. <add> <add>> `fixup` will squash the commit it's infront of up into the commit above it <add> <add>> `edit` will allow you to edit the commit message before continuing <add> <add>``` <add>edit b4dc15d Update CONTRIBUTING.md with latest info <add>fixup 8592149 Add Dev certificate of origin <add>fixup f12af12 Add conventional-changelog-videojs link <add>fixup ae4613a Update node's CONTRIBUTING.md url <add>fixup 433c582 Update TOC <add>edit 259dee6 Add grunt and doctoc npm scripts <add>``` <add> <add>When you get to the edit commits, git will give more information, but you'd want to run ammend the current commit while following our commit guidelines <add> <add>```sh <add>$ git commit --amend <add>``` <add> <add>After going through and making the commits you want, you want to change back to master and then rebase the branch onto master so we get a clean history <add> <add>```sh <add>$ git rebase gkatsev-html5-fix <add>``` <add> <add>This will put our two commits into master: <add>``` <add>b4dc15d chore(contributing.md): Update CONTRIBUTING.md with latest info <Gary Katsevman> <add>259dee6 chore(package.json): Add grunt and doctoc npm scripts <Gary Katsevman> <add>9e20386 v5.12.6 <Gary Katsevman> <add>``` <add> <add>Now you're ready to push to master as in the normal instructions. <add> <add>#### I just made a mistake <add> <add>While `git` allows you to update the remote branch with a force push (`git push -f`). This is generally frowned upon since you're rewriting public history. However, if you just pushed the change and it's been less than 10 minutes since you've done with, you may force push to update the commit, assuming no one else has already pushed after you. <add> <add>##### I accidentally pushed a broken commit or incorrect commit to master <add> <add>Assuming no more than 10 minutes have passed, you may force-push to update or remove the commit. If someone else has already pushed to master or 10 minutes have passed, you should instead use the revert command (`git revert`) to revert the commit and then commit the proper change, or just fix it forward with a followup commit that fixes things. <add> <add>##### I lost changes <add> <add>Assuming that the changes were committed, even if you lost the commit in your current history does not mean that it is lost. In a lot of cases you can still recover it from the PR branch or if all else fails look at [git's reflog](https://git-scm.com/docs/git-reflog). <add> <add>##### I accidentally committed a broken change to master <add> <add>This is a great time to discover that something is broken. Because it hasn't been pushed to GitHub yet, it's very easy to reset the change as if nothing has happened and try again. <add> <add>To do so, just reset the branch against master. <add> <add>```sh <add>$ git reset --hard upstream/master <add>``` <add> <add>## video.js releases <add> <add>Releasing video.js is partially automated through [`conrib.json`](/contrib.json) scripts. To do a release, you need a couple of things: npm access, GitHub personal access token. <add> <add>Releases in video.js are done on npm and bower and GitHub and eventually posted on the CDN. This is the instruction for the npm/bower/GitHub releases. <add> <add>When we do a release, we release it as a `next` tag on npm first and then at least a week later, we promote this release to `latest` on npm. <add> <add>### Getting dependencies <add> <add>#### Install contrib <add> <add>You can install it globally <add> <add>```sh <add>npm i -g contrib/contrib <add>``` <add> <add>#### npm access <add> <add>To see who currently has access run this: <add> <add>```sh <add>npm owner ls video.js <add>``` <add> <add>If you are a core committer, you can request access to npm from one of the current owners. <add> <add>#### GitHub personal access token <add> <add>This is used to make a GitHub release on videojs. You can get a token from the [personal access tokens](https://github.com/settings/tokens) page. <add> <add>After generating one, make sure to keep it safe because GitHub will not show the token for you again. A good place to save it is Lastpass Secure Notes. <add> <add>### Doing a release <add> <add>To do a release, check out the master branch <add> <add>```sh <add>$ git checkout master <add>``` <add> <add>Then run the contrib command to do the next release. Don't forget to provide your GitHub token so the GitHub release goes through. <add> <add>```sh <add>VJS_GITHUB_USER=gkatsev VJS_GITHUB_TOKEN=my-personal-access-token contrib release next patch <add>``` <add> <add>This makes a patch release, you can also do a `minor` and a `major` release. <add> <add>After it's done, verify that the GitHub release has the correct changelog output. <add> <add>## Doc credit <add> <add>This collaborator guide was heavily inspired by [node.js's guide](https://github.com/nodejs/node/blob/master/COLLABORATOR_GUIDE.md) <add> <add> <add>[issue template]: /.github/ISSUE_TEMPLATE.md <add>[pr template]: /.github/PULL_REQUEST_TEMPLATE.md <add>[conventions]: https://github.com/videojs/conventional-changelog-videojs/blob/master/convention.md
1
Text
Text
fix broken link to mappings-exceptions
5279c7c4baf5b9f26a364f07551acecf26a2d42f
<ide><path>website/docs/usage/linguistic-features.md <ide> coarse-grained part-of-speech tags and morphological features. <ide> that the verb is past tense (e.g. `VBD` for a past tense verb in the Penn <ide> Treebank) . <ide> 2. For words whose coarse-grained POS is not set by a prior process, a <del> [mapping table](#mapping-exceptions) maps the fine-grained tags to a <add> [mapping table](#mappings-exceptions) maps the fine-grained tags to a <ide> coarse-grained POS tags and morphological features. <ide> <ide> ```python
1
Ruby
Ruby
adjust `audit` spec
c07205caf2146dfd3d496a4b887befb83ae04455
<ide><path>Library/Homebrew/test/cask/audit_spec.rb <ide> def tmp_cask(name, text) <ide> end <ide> end <ide> <del> context "when doing the audit" do <add> context "when doing an offline audit" do <add> let(:online) { false } <add> <add> it "does not evaluate the block" do <add> expect(run).not_to pass <add> end <add> end <add> <add> context "when doing and online audit" do <add> let(:online) { true } <add> <ide> it "evaluates the block" do <ide> expect(run).to fail_with(/Boom/) <ide> end
1
Javascript
Javascript
use removeattribute when transitioning to null
db65a3849f198663e26dcd596b277e1405e8bfb3
<ide><path>d3.js <ide> d3_transitionPrototype.attrTween = function(name, tween) { <ide> function attrTween(d, i) { <ide> var f = tween.call(this, d, i, this.getAttribute(name)); <ide> return f && function(t) { <del> this.setAttribute(name, f(t)); <add> if ((t = f(t)) != null) this.setAttribute(name, t); <add> else this.removeAttribute(name); <ide> }; <ide> } <ide> <ide> d3_transitionPrototype.styleTween = function(name, tween, priority) { <ide> return this.tween("style." + name, function(d, i) { <ide> var f = tween.call(this, d, i, window.getComputedStyle(this, null).getPropertyValue(name)); <ide> return f && function(t) { <del> if ((t = f(t)) != null) { <del> this.style.setProperty(name, t, priority); <del> } else { <del> this.style.removeProperty(name); <del> } <add> if ((t = f(t)) != null) this.style.setProperty(name, t, priority); <add> else this.style.removeProperty(name); <ide> }; <ide> }); <ide> }; <ide><path>d3.min.js <ide> (function(){function dy(a,b,c){function i(a,b){var c=a.__domain||(a.__domain=a.domain()),d=a.range().map(function(a){return(a-b)/h});a.domain(c).domain(d.map(a.invert))}var d=Math.pow(2,(dj[2]=a)-c[2]),e=dj[0]=b[0]-d*c[0],f=dj[1]=b[1]-d*c[1],g=d3.event,h=Math.pow(2,a);d3.event={scale:h,translate:[e,f],transform:function(a,b){a&&i(a,e),b&&i(b,f)}};try{dk.apply(dm,dn)}finally{d3.event=g}g.preventDefault()}function dx(){dq&&dl===d3.event.target&&(d3.event.stopPropagation(),d3.event.preventDefault(),dq=!1,dl=null)}function dw(){df&&(dp&&dl===d3.event.target&&(dq=!0),dv(),df=null)}function dv(){dg=null,df&&(dp=!0,dy(dj[2],d3.svg.mouse(dm),df))}function du(){var a=d3.svg.touches(dm);switch(a.length){case 1:var b=a[0];dy(dj[2],b,dh[b.identifier]);break;case 2:var c=a[0],d=a[1],e=[(c[0]+d[0])/2,(c[1]+d[1])/2],f=dh[c.identifier],g=dh[d.identifier],h=[(f[0]+g[0])/2,(f[1]+g[1])/2,f[2]];dy(Math.log(d3.event.scale)/Math.LN2+f[2],e,h)}}function dt(){var a=d3.svg.touches(dm),b=-1,c=a.length,d;while(++b<c)dh[(d=a[b]).identifier]=dr(d);return a}function ds(){de||(de=d3.select("body").append("div").style("visibility","hidden").style("top",0).style("height",0).style("width",0).style("overflow-y","scroll").append("div").style("height","2000px").node().parentNode);var a=d3.event,b;try{de.scrollTop=1e3,de.dispatchEvent(a),b=1e3-de.scrollTop}catch(c){b=a.wheelDelta||-a.detail*5}return b*.005}function dr(a){return[a[0]-dj[0],a[1]-dj[1],dj[2]]}function dd(){d3.event.stopPropagation(),d3.event.preventDefault()}function dc(){cZ&&cU===d3.event.target&&(dd(),cZ=!1,cU=null)}function db(){!cV||(c$("dragend"),cV=null,cY&&cU===d3.event.target&&(cZ=!0,dd()))}function da(){if(!!cV){var a=cV.parentNode;if(!a)return db();c$("drag"),dd()}}function c_(a){return d3.event.touches?d3.svg.touches(a)[0]:d3.svg.mouse(a)}function c$(a){var b=d3.event,c=cV.parentNode,d=0,e=0;c&&(c=c_(c),d=c[0]-cX[0],e=c[1]-cX[1],cX=c,cY|=d|e);try{d3.event={dx:d,dy:e},cT[a].dispatch.apply(cV,cW)}finally{d3.event=b}b.preventDefault()}function cS(a,b,c){e=[];if(c&&b.length>1){var d=bw(a.domain()),e,f=-1,g=b.length,h=(b[1]-b[0])/++c,i,j;while(++f<g)for(i=c;--i>0;)(j=+b[f]-i*h)>=d[0]&&e.push(j);for(--f,i=0;++i<c&&(j=+b[f]+i*h)<d[1];)e.push(j)}return e}function cR(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function cQ(a,b){a.attr("transform",function(a){return"translate("+b(a)+",0)"})}function cM(){return"circle"}function cL(){return 64}function cK(a,b){var c=(a.ownerSVGElement||a).createSVGPoint();if(cJ<0&&(window.scrollX||window.scrollY)){var d=d3.select(document.body).append("svg:svg").style("position","absolute").style("top",0).style("left",0),e=d[0][0].getScreenCTM();cJ=!e.f&&!e.e,d.remove()}cJ?(c.x=b.pageX,c.y=b.pageY):(c.x=b.clientX,c.y=b.clientY),c=c.matrixTransform(a.getScreenCTM().inverse());return[c.x,c.y]}function cI(a){return function(){var b=a.apply(this,arguments),c=b[0],d=b[1]+bU;return[c*Math.cos(d),c*Math.sin(d)]}}function cH(a){return[a.x,a.y]}function cG(a){return a.endAngle}function cF(a){return a.startAngle}function cE(a){return a.radius}function cD(a){return a.target}function cC(a){return a.source}function cB(a){return function(b,c){return a[c][1]}}function cA(a){return function(b,c){return a[c][0]}}function cz(a){function i(f){if(f.length<1)return null;var i=b_(this,f,b,d),j=b_(this,f,b===c?cA(i):c,d===e?cB(i):e);return"M"+g(a(j),h)+"L"+g(a(i.reverse()),h)+"Z"}var b=ca,c=ca,d=0,e=cb,f="linear",g=cc[f],h=.7;i.x=function(a){if(!arguments.length)return c;b=c=a;return i},i.x0=function(a){if(!arguments.length)return b;b=a;return i},i.x1=function(a){if(!arguments.length)return c;c=a;return i},i.y=function(a){if(!arguments.length)return e;d=e=a;return i},i.y0=function(a){if(!arguments.length)return d;d=a;return i},i.y1=function(a){if(!arguments.length)return e;e=a;return i},i.interpolate=function(a){if(!arguments.length)return f;g=cc[f=a];return i},i.tension=function(a){if(!arguments.length)return h;h=a;return i};return i}function cy(a){var b,c=-1,d=a.length,e,f;while(++c<d)b=a[c],e=b[0],f=b[1]+bU,b[0]=e*Math.cos(f),b[1]=e*Math.sin(f);return a}function cx(a){return a.length<3?cd(a):a[0]+cj(a,cw(a))}function cw(a){var b=[],c,d,e,f,g=cv(a),h=-1,i=a.length-1;while(++h<i)c=cu(a[h],a[h+1]),Math.abs(c)<1e-6?g[h]=g[h+1]=0:(d=g[h]/c,e=g[h+1]/c,f=d*d+e*e,f>9&&(f=c*3/Math.sqrt(f),g[h]=f*d,g[h+1]=f*e));h=-1;while(++h<=i)f=(a[Math.min(i,h+1)][0]-a[Math.max(0,h-1)][0])/(6*(1+g[h]*g[h])),b.push([f||0,g[h]*f||0]);return b}function cv(a){var b=0,c=a.length-1,d=[],e=a[0],f=a[1],g=d[0]=cu(e,f);while(++b<c)d[b]=g+(g=cu(e=f,f=a[b+1]));d[b]=g;return d}function cu(a,b){return(b[1]-a[1])/(b[0]-a[0])}function ct(a,b,c){a.push("C",cp(cq,b),",",cp(cq,c),",",cp(cr,b),",",cp(cr,c),",",cp(cs,b),",",cp(cs,c))}function cp(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3]}function co(a,b){var c=a.length-1,d=a[0][0],e=a[0][1],f=a[c][0]-d,g=a[c][1]-e,h=-1,i,j;while(++h<=c)i=a[h],j=h/c,i[0]=b*i[0]+(1-b)*(d+j*f),i[1]=b*i[1]+(1-b)*(e+j*g);return cl(a)}function cn(a){var b,c=-1,d=a.length,e=d+4,f,g=[],h=[];while(++c<4)f=a[c%d],g.push(f[0]),h.push(f[1]);b=[cp(cs,g),",",cp(cs,h)],--c;while(++c<e)f=a[c%d],g.shift(),g.push(f[0]),h.shift(),h.push(f[1]),ct(b,g,h);return b.join("")}function cm(a){if(a.length<4)return cd(a);var b=[],c=-1,d=a.length,e,f=[0],g=[0];while(++c<3)e=a[c],f.push(e[0]),g.push(e[1]);b.push(cp(cs,f)+","+cp(cs,g)),--c;while(++c<d)e=a[c],f.shift(),f.push(e[0]),g.shift(),g.push(e[1]),ct(b,f,g);return b.join("")}function cl(a){if(a.length<3)return cd(a);var b=1,c=a.length,d=a[0],e=d[0],f=d[1],g=[e,e,e,(d=a[1])[0]],h=[f,f,f,d[1]],i=[e,",",f];ct(i,g,h);while(++b<c)d=a[b],g.shift(),g.push(d[0]),h.shift(),h.push(d[1]),ct(i,g,h);b=-1;while(++b<2)g.shift(),g.push(d[0]),h.shift(),h.push(d[1]),ct(i,g,h);return i.join("")}function ck(a,b){var c=[],d=(1-b)/2,e,f=a[0],g=a[1],h=1,i=a.length;while(++h<i)e=f,f=g,g=a[h],c.push([d*(g[0]-e[0]),d*(g[1]-e[1])]);return c}function cj(a,b){if(b.length<1||a.length!=b.length&&a.length!=b.length+2)return cd(a);var c=a.length!=b.length,d="",e=a[0],f=a[1],g=b[0],h=g,i=1;c&&(d+="Q"+(f[0]-g[0]*2/3)+","+(f[1]-g[1]*2/3)+","+f[0]+","+f[1],e=a[1],i=2);if(b.length>1){h=b[1],f=a[i],i++,d+="C"+(e[0]+g[0])+","+(e[1]+g[1])+","+(f[0]-h[0])+","+(f[1]-h[1])+","+f[0]+","+f[1];for(var j=2;j<b.length;j++,i++)f=a[i],h=b[j],d+="S"+(f[0]-h[0])+","+(f[1]-h[1])+","+f[0]+","+f[1]}if(c){var k=a[i];d+="Q"+(f[0]+h[0]*2/3)+","+(f[1]+h[1]*2/3)+","+k[0]+","+k[1]}return d}function ci(a,b,c){return a.length<3?cd(a):a[0]+cj(a,ck(a,b))}function ch(a,b){return a.length<3?cd(a):a[0]+cj((a.push(a[0]),a),ck([a[a.length-2]].concat(a,[a[1]]),b))}function cg(a,b){return a.length<4?cd(a):a[1]+cj(a.slice(1,a.length-1),ck(a,b))}function cf(a){var b=0,c=a.length,d=a[0],e=[d[0],",",d[1]];while(++b<c)e.push("H",(d=a[b])[0],"V",d[1]);return e.join("")}function ce(a){var b=0,c=a.length,d=a[0],e=[d[0],",",d[1]];while(++b<c)e.push("V",(d=a[b])[1],"H",d[0]);return e.join("")}function cd(a){var b=0,c=a.length,d=a[0],e=[d[0],",",d[1]];while(++b<c)e.push("L",(d=a[b])[0],",",d[1]);return e.join("")}function cb(a){return a[1]}function ca(a){return a[0]}function b_(a,b,c,d){var e=[],f=-1,g=b.length,h=typeof c=="function",i=typeof d=="function",j;if(h&&i)while(++f<g)e.push([c.call(a,j=b[f],f),d.call(a,j,f)]);else if(h)while(++f<g)e.push([c.call(a,b[f],f),d]);else if(i)while(++f<g)e.push([c,d.call(a,b[f],f)]);else while(++f<g)e.push([c,d]);return e}function b$(a){function g(d){return d.length<1?null:"M"+e(a(b_(this,d,b,c)),f)}var b=ca,c=cb,d="linear",e=cc[d],f=.7;g.x=function(a){if(!arguments.length)return b;b=a;return g},g.y=function(a){if(!arguments.length)return c;c=a;return g},g.interpolate=function(a){if(!arguments.length)return d;e=cc[d=a];return g},g.tension=function(a){if(!arguments.length)return f;f=a;return g};return g}function bZ(a){return a.endAngle}function bY(a){return a.startAngle}function bX(a){return a.outerRadius}function bW(a){return a.innerRadius}function bT(a,b,c){function g(){d=c.length/(b-a),e=c.length-1;return f}function f(b){return c[Math.max(0,Math.min(e,Math.floor(d*(b-a))))]}var d,e;f.domain=function(c){if(!arguments.length)return[a,b];a=+c[0],b=+c[c.length-1];return g()},f.range=function(a){if(!arguments.length)return c;c=a;return g()},f.copy=function(){return bT(a,b,c)};return g()}function bS(a,b){function e(a){return isNaN(a=+a)?NaN:b[d3.bisect(c,a)]}function d(){var d=0,f=a.length,g=b.length;c=[];while(++d<g)c[d-1]=d3.quantile(a,d/g);return e}var c;e.domain=function(b){if(!arguments.length)return a;a=b.filter(function(a){return!isNaN(a)}).sort(d3.ascending);return d()},e.range=function(a){if(!arguments.length)return b;b=a;return d()},e.quantiles=function(){return c},e.copy=function(){return bS(a,b)};return d()}function bN(a,b){function f(b){return d[((c[b]||(c[b]=a.push(b)))-1)%d.length]}var c,d,e;f.domain=function(d){if(!arguments.length)return a;a=[],c={};var e=-1,g=d.length,h;while(++e<g)c[h=d[e]]||(c[h]=a.push(h));return f[b.t](b.x,b.p)},f.range=function(a){if(!arguments.length)return d;d=a,e=0,b={t:"range",x:a};return f},f.rangePoints=function(c,g){arguments.length<2&&(g=0);var h=c[0],i=c[1],j=(i-h)/(a.length-1+g);d=a.length<2?[(h+i)/2]:d3.range(h+j*g/2,i+j/2,j),e=0,b={t:"rangePoints",x:c,p:g};return f},f.rangeBands=function(c,g){arguments.length<2&&(g=0);var h=c[0],i=c[1],j=(i-h)/(a.length+g);d=d3.range(h+j*g,i,j),e=j*(1-g),b={t:"rangeBands",x:c,p:g};return f},f.rangeRoundBands=function(c,g){arguments.length<2&&(g=0);var h=c[0],i=c[1],j=Math.floor((i-h)/(a.length+g)),k=i-h-(a.length-g)*j;d=d3.range(h+Math.round(k/2),i,j),e=Math.round(j*(1-g)),b={t:"rangeRoundBands",x:c,p:g};return f},f.rangeBand=function(){return e},f.copy=function(){return bN(a,b)};return f.domain(a)}function bM(a){return function(b){return b<0?-Math.pow(-b,a):Math.pow(b,a)}}function bL(a,b){function e(b){return a(c(b))}var c=bM(b),d=bM(1/b);e.invert=function(b){return d(a.invert(b))},e.domain=function(b){if(!arguments.length)return a.domain().map(d);a.domain(b.map(c));return e},e.ticks=function(a){return bD(e.domain(),a)},e.tickFormat=function(a){return bE(e.domain(),a)},e.nice=function(){return e.domain(bx(e.domain(),bB))},e.exponent=function(a){if(!arguments.length)return b;var f=e.domain();c=bM(b=a),d=bM(1/b);return e.domain(f)},e.copy=function(){return bL(a.copy(),b)};return bA(e,a)}function bK(a){return-Math.log(-a)/Math.LN10}function bJ(a){return Math.log(a)/Math.LN10}function bH(a,b){function d(c){return a(b(c))}var c=b.pow;d.invert=function(b){return c(a.invert(b))},d.domain=function(e){if(!arguments.length)return a.domain().map(c);b=e[0]<0?bK:bJ,c=b.pow,a.domain(e.map(b));return d},d.nice=function(){a.domain(bx(a.domain(),by));return d},d.ticks=function(){var d=bw(a.domain()),e=[];if(d.every(isFinite)){var f=Math.floor(d[0]),g=Math.ceil(d[1]),h=Math.round(c(d[0])),i=Math.round(c(d[1]));if(b===bK){e.push(c(f));for(;f++<g;)for(var j=9;j>0;j--)e.push(c(f)*j)}else{for(;f<g;f++)for(var j=1;j<10;j++)e.push(c(f)*j);e.push(c(f))}for(f=0;e[f]<h;f++);for(g=e.length;e[g-1]>i;g--);e=e.slice(f,g)}return e},d.tickFormat=function(a,e){arguments.length<2&&(e=bI);if(arguments.length<1)return e;var f=a/d.ticks().length,g=b===bK?(h=-1e-15,Math.floor):(h=1e-15,Math.ceil),h;return function(a){return a/c(g(b(a)+h))<f?e(a):""}},d.copy=function(){return bH(a.copy(),b)};return bA(d,a)}function bG(a,b,c,d){var e=[],f=[],g=0,h=a.length;while(++g<h)e.push(c(a[g-1],a[g])),f.push(d(b[g-1],b[g]));return function(b){var c=d3.bisect(a,b,1,a.length-1)-1;return f[c](e[c](b))}}function bF(a,b,c,d){var e=c(a[0],a[1]),f=d(b[0],b[1]);return function(a){return f(e(a))}}function bE(a,b){return d3.format(",."+Math.max(0,-Math.floor(Math.log(bC(a,b)[2])/Math.LN10+.01))+"f")}function bD(a,b){return d3.range.apply(d3,bC(a,b))}function bC(a,b){var c=bw(a),d=c[1]-c[0],e=Math.pow(10,Math.floor(Math.log(d/b)/Math.LN10)),f=b/d*e;f<=.15?e*=10:f<=.35?e*=5:f<=.75&&(e*=2),c[0]=Math.ceil(c[0]/e)*e,c[1]=Math.floor(c[1]/e)*e+e*.5,c[2]=e;return c}function bB(a){a=Math.pow(10,Math.round(Math.log(a)/Math.LN10)-1);return{floor:function(b){return Math.floor(b/a)*a},ceil:function(b){return Math.ceil(b/a)*a}}}function bA(a,b){a.range=d3.rebind(a,b.range),a.rangeRound=d3.rebind(a,b.rangeRound),a.interpolate=d3.rebind(a,b.interpolate),a.clamp=d3.rebind(a,b.clamp);return a}function bz(a,b,c,d){function h(a){return e(a)}function g(){var g=a.length==2?bF:bG,i=d?L:K;e=g(a,b,i,c),f=g(b,a,i,d3.interpolate);return h}var e,f;h.invert=function(a){return f(a)},h.domain=function(b){if(!arguments.length)return a;a=b.map(Number);return g()},h.range=function(a){if(!arguments.length)return b;b=a;return g()},h.rangeRound=function(a){return h.range(a).interpolate(d3.interpolateRound)},h.clamp=function(a){if(!arguments.length)return d;d=a;return g()},h.interpolate=function(a){if(!arguments.length)return c;c=a;return g()},h.ticks=function(b){return bD(a,b)},h.tickFormat=function(b){return bE(a,b)},h.nice=function(){bx(a,bB);return g()},h.copy=function(){return bz(a,b,c,d)};return g()}function by(){return Math}function bx(a,b){var c=0,d=a.length-1,e=a[c],f=a[d],g;f<e&&(g=c,c=d,d=g,g=e,e=f,f=g),b=b(f-e),a[c]=b.floor(e),a[d]=b.ceil(f);return a}function bw(a){var b=a[0],c=a[a.length-1];return b<c?[b,c]:[c,b]}function bv(){}function bt(){var a=null,b=bp,c=Infinity;while(b)b.flush?b=a?a.next=b.next:bp=b.next:(c=Math.min(c,b.then+b.delay),b=(a=b).next);return c}function bs(){var a,b=Date.now(),c=bp;while(c)a=b-c.then,a>=c.delay&&(c.flush=c.callback(a)),c=c.next;var d=bt()-b;d>24?(isFinite(d)&&(clearTimeout(br),br=setTimeout(bs,d)),bq=0):(bq=1,bu(bs))}function bo(a){for(var b=0,c=this.length;b<c;b++)for(var d=this[b],e=0,f=d.length;e<f;e++){var g=d[e];g&&a.call(g=g.node,g.__data__,e,b)}return this}function bj(a){return typeof a=="function"?function(b,c,d){var e=a.call(this,b,c)+"";return d!=e&&d3.interpolate(d,e)}:a==null?bh:(a=a+"",function(b,c,d){return d!=a&&d3.interpolate(d,a)})}function bi(){return null}function bh(){return bi}function bg(a,b){h(a,bk);var c={},d=d3.dispatch("start","end"),e=bn,f=Date.now();a.id=b,a.tween=function(b,d){if(arguments.length<2)return c[b];d==null?delete c[b]:c[b]=d;return a},a.ease=function(b){if(!arguments.length)return e;e=typeof b=="function"?b:d3.ease.apply(d3,arguments);return a},a.each=function(b,c){if(arguments.length<2)return bo.call(a,b);d[b].add(c);return a},d3.timer(function(g){a.each(function(h,i,j){function r(){--o.count||delete l.__transition__;return 1}function q(a){if(o.active!==b)return r();var c=(a-m)/n,f=e(c),g=k.length;while(g>0)k[--g].call(l,f);if(c>=1){r(),bm=b,d.end.dispatch.call(l,h,i),bm=0;return 1}}function p(a){if(o.active>b)return r();o.active=b;for(var e in c)(e=c[e].call(l,h,i))&&k.push(e);d.start.dispatch.call(l,h,i),q(a)||d3.timer(q,0,f);return 1}var k=[],l=this,m=a[j][i].delay,n=a[j][i].duration,o=l.__transition__||(l.__transition__={active:0,count:0});++o.count,m<=g?p(g):d3.timer(p,m,f)});return 1},0,f);return a}function be(a){arguments.length||(a=d3.ascending);return function(b,c){return a(b&&b.__data__,c&&c.__data__)}}function bc(a){h(a,bd);return a}function bb(a){return{__data__:a}}function ba(a){return function(){return Z(a,this)}}function _(a){return function(){return Y(a,this)}}function X(a){h(a,$);return a}function W(a,b,c){function g(a){return Math.round(f(a)*255)}function f(a){a>360?a-=360:a<0&&(a+=360);return a<60?d+(e-d)*a/60:a<180?e:a<240?d+(e-d)*(240-a)/60:d}var d,e;a=a%360,a<0&&(a+=360),b=b<0?0:b>1?1:b,c=c<0?0:c>1?1:c,e=c<=.5?c*(1+b):c+b-c*b,d=2*c-e;return M(g(a+120),g(a),g(a-120))}function V(a,b,c){this.h=a,this.s=b,this.l=c}function U(a,b,c){return new V(a,b,c)}function R(a){var b=parseFloat(a);return a.charAt(a.length-1)==="%"?Math.round(b*2.55):b}function Q(a,b,c){var d=Math.min(a/=255,b/=255,c/=255),e=Math.max(a,b,c),f=e-d,g,h,i=(e+d)/2;f?(h=i<.5?f/(e+d):f/(2-e-d),a==e?g=(b-c)/f+(b<c?6:0):b==e?g=(c-a)/f+2:g=(a-b)/f+4,g*=60):h=g=0;return U(g,h,i)}function P(a,b,c){var d=0,e=0,f=0,g,h,i;g=/([a-z]+)\((.*)\)/i.exec(a);if(g){h=g[2].split(",");switch(g[1]){case"hsl":return c(parseFloat(h[0]),parseFloat(h[1])/100,parseFloat(h[2])/100);case"rgb":return b(R(h[0]),R(h[1]),R(h[2]))}}if(i=S[a])return b(i.r,i.g,i.b);a!=null&&a.charAt(0)==="#"&&(a.length===4?(d=a.charAt(1),d+=d,e=a.charAt(2),e+=e,f=a.charAt(3),f+=f):a.length===7&&(d=a.substring(1,3),e=a.substring(3,5),f=a.substring(5,7)),d=parseInt(d,16),e=parseInt(e,16),f=parseInt(f,16));return b(d,e,f)}function O(a){return a<16?"0"+a.toString(16):a.toString(16)}function N(a,b,c){this.r=a,this.g=b,this.b=c}function M(a,b,c){return new N(a,b,c)}function L(a,b){b=b-(a=+a)?1/(b-a):0;return function(c){return Math.max(0,Math.min(1,(c-a)*b))}}function K(a,b){b=b-(a=+a)?1/(b-a):0;return function(c){return(c-a)*b}}function J(a){return a in I||/\bcolor\b/.test(a)?d3.interpolateRgb:d3.interpolate}function G(a){return a<1/2.75?7.5625*a*a:a<2/2.75?7.5625*(a-=1.5/2.75)*a+.75:a<2.5/2.75?7.5625*(a-=2.25/2.75)*a+.9375:7.5625*(a-=2.625/2.75)*a+.984375}function F(a){a||(a=1.70158);return function(b){return b*b*((a+1)*b-a)}}function E(a,b){var c;arguments.length<2&&(b=.45),arguments.length<1?(a=1,c=b/4):c=b/(2*Math.PI)*Math.asin(1/a);return function(d){return 1+a*Math.pow(2,10*-d)*Math.sin((d-c)*2*Math.PI/b)}}function D(a){return 1-Math.sqrt(1-a*a)}function C(a){return Math.pow(2,10*(a-1))}function B(a){return 1-Math.cos(a*Math.PI/2)}function A(a){return function(b){return Math.pow(b,a)}}function z(a){return a}function y(a){return function(b){return.5*(b<.5?a(2*b):2-a(2-2*b))}}function x(a){return function(b){return 1-a(1-b)}}function w(a){return function(b){return b<=0?0:b>=1?1:a(b)}}function r(a){var b=a.lastIndexOf("."),c=b>=0?a.substring(b):(b=a.length,""),d=[];while(b>0)d.push(a.substring(b-=3,b+3));return d.reverse().join(",")+c}function q(a){return a+""}function n(a){var b={},c=[];b.add=function(a){for(var d=0;d<c.length;d++)if(c[d].listener==a)return b;c.push({listener:a,on:!0});return b},b.remove=function(a){for(var d=0;d<c.length;d++){var e=c[d];if(e.listener==a){e.on=!1,c=c.slice(0,d).concat(c.slice(d+1));break}}return b},b.dispatch=function(){var a=c;for(var b=0,d=a.length;b<d;b++){var e=a[b];e.on&&e.listener.apply(this,arguments)}};return b}function l(a){return a.replace(/(^\s+)|(\s+$)/g,"").replace(/\s+/g," ")}function k(a){return a==null}function j(a){return a.length}function i(){return this}function f(a){return Array.prototype.slice.call(a)}function e(a){var b=-1,c=a.length,d=[];while(++b<c)d.push(a[b]);return d}Date.now||(Date.now=function(){return+(new Date)});try{document.createElement("div").style.setProperty("opacity",0,"")}catch(a){var b=CSSStyleDeclaration.prototype,c=b.setProperty;b.setProperty=function(a,b,d){c.call(this,a,b+"",d)}}d3={version:"2.3.2"};var d=f;try{d(document.documentElement.childNodes)[0].nodeType}catch(g){d=e}var h=[].__proto__?function(a,b){a.__proto__=b}:function(a,b){for(var c in b)a[c]=b[c]};d3.functor=function(a){return typeof a=="function"?a:function(){return a}},d3.rebind=function(a,b){return function(){var c=b.apply(a,arguments);return arguments.length?a:c}},d3.ascending=function(a,b){return a<b?-1:a>b?1:a>=b?0:NaN},d3.descending=function(a,b){return b<a?-1:b>a?1:b>=a?0:NaN},d3.min=function(a,b){var c=-1,d=a.length,e,f;if(arguments.length===1){while(++c<d&&((e=a[c])==null||e!=e))e=undefined;while(++c<d)(f=a[c])!=null&&e>f&&(e=f)}else{while(++c<d&&((e=b.call(a,a[c],c))==null||e!=e))e=undefined;while(++c<d)(f=b.call(a,a[c],c))!=null&&e>f&&(e=f)}return e},d3.max=function(a,b){var c=-1,d=a.length,e,f;if(arguments.length===1){while(++c<d&&((e=a[c])==null||e!=e))e=undefined;while(++c<d)(f=a[c])!=null&&f>e&&(e=f)}else{while(++c<d&&((e=b.call(a,a[c],c))==null||e!=e))e=undefined;while(++c<d)(f=b.call(a,a[c],c))!=null&&f>e&&(e=f)}return e},d3.sum=function(a,b){var c=0,d=a.length,e,f=-1;if(arguments.length===1)while(++f<d)isNaN(e=+a[f])||(c+=e);else while(++f<d)isNaN(e=+b.call(a,a[f],f))||(c+=e);return c},d3.quantile=function(a,b){var c=(a.length-1)*b+1,d=Math.floor(c),e=a[d-1],f=c-d;return f?e+f*(a[d]-e):e},d3.zip=function(){if(!(e=arguments.length))return[];for(var a=-1,b=d3.min(arguments,j),c=Array(b);++a<b;)for(var d=-1,e,f=c[a]=Array(e);++d<e;)f[d]=arguments[d][a];return c},d3.bisectLeft=function(a,b,c,d){arguments.length<3&&(c=0),arguments.length<4&&(d=a.length);while(c<d){var e=c+d>>1;a[e]<b?c=e+1:d=e}return c},d3.bisect=d3.bisectRight=function(a,b,c,d){arguments.length<3&&(c=0),arguments.length<4&&(d=a.length);while(c<d){var e=c+d>>1;b<a[e]?d=e:c=e+1}return c},d3.first=function(a,b){var c=0,d=a.length,e=a[0],f;arguments.length===1&&(b=d3.ascending);while(++c<d)b.call(a,e,f=a[c])>0&&(e=f);return e},d3.last=function(a,b){var c=0,d=a.length,e=a[0],f;arguments.length===1&&(b=d3.ascending);while(++c<d)b.call(a,e,f=a[c])<=0&&(e=f);return e},d3.nest=function(){function g(a,d){if(d>=b.length)return a;var e=[],f=c[d++],h;for(h in a)e.push({key:h,values:g(a[h],d)});f&&e.sort(function(a,b){return f(a.key,b.key)});return e}function f(c,g){if(g>=b.length)return e?e.call(a,c):d?c.sort(d):c;var h=-1,i=c.length,j=b[g++],k,l,m={};while(++h<i)(k=j(l=c[h]))in m?m[k].push(l):m[k]=[l];for(k in m)m[k]=f(m[k],g);return m}var a={},b=[],c=[],d,e;a.map=function(a){return f(a,0)},a.entries=function(a){return g(f(a,0),0)},a.key=function(c){b.push(c);return a},a.sortKeys=function(d){c[b.length-1]=d;return a},a.sortValues=function(b){d=b;return a},a.rollup=function(b){e=b;return a};return a},d3.keys=function(a){var b=[];for(var c in a)b.push(c);return b},d3.values=function(a){var b=[];for(var c in a)b.push(a[c]);return b},d3.entries=function(a){var b=[];for(var c in a)b.push({key:c,value:a[c]});return b},d3.permute=function(a,b){var c=[],d=-1,e=b.length;while(++d<e)c[d]=a[b[d]];return c},d3.merge=function(a){return Array.prototype.concat.apply([],a)},d3.split=function(a,b){var c=[],d=[],e,f=-1,g=a.length;arguments.length<2&&(b=k);while(++f<g)b.call(d,e=a[f],f)?d=[]:(d.length||c.push(d),d.push(e));return c},d3.range=function(a,b,c){arguments.length<3&&(c=1,arguments.length<2&&(b=a,a=0));if((b-a)/c==Infinity)throw new Error("infinite range");var d=[],e=-1,f;if(c<0)while((f=a+c*++e)>b)d.push(f);else while((f=a+c*++e)<b)d.push(f);return d},d3.requote=function(a){return a.replace(m,"\\$&")};var m=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;d3.round=function(a,b){return b?Math.round(a*Math.pow(10,b))*Math.pow(10,-b):Math.round(a)},d3.xhr=function(a,b,c){var d=new XMLHttpRequest;arguments.length<3?c=b:b&&d.overrideMimeType&&d.overrideMimeType(b),d.open("GET",a,!0),d.onreadystatechange=function(){d.readyState===4&&c(d.status<300?d:null)},d.send(null)},d3.text=function(a,b,c){function d(a){c(a&&a.responseText)}arguments.length<3&&(c=b,b=null),d3.xhr(a,b,d)},d3.json=function(a,b){d3.text(a,"application/json",function(a){b(a?JSON.parse(a):null)})},d3.html=function(a,b){d3.text(a,"text/html",function(a){if(a!=null){var c=document.createRange();c.selectNode(document.body),a=c.createContextualFragment(a)}b(a)})},d3.xml=function(a,b,c){function d(a){c(a&&a.responseXML)}arguments.length<3&&(c=b,b=null),d3.xhr(a,b,d)},d3.ns={prefix:{svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},qualify:function(a){var b=a.indexOf(":");return b<0?a:{space:d3.ns.prefix[a.substring(0,b)],local:a.substring(b+1)}}},d3.dispatch=function(a){var b={},c;for(var d=0,e=arguments.length;d<e;d++)c=arguments[d],b[c]=n(c);return b},d3.format=function(a){var b=o.exec(a),c=b[1]||" ",d=b[3]||"",e=b[5],f=+b[6],g=b[7],h=b[8],i=b[9],j=!1,k=!1;h&&(h=h.substring(1)),e&&(c="0",g&&(f-=Math.floor((f-1)/4)));switch(i){case"n":g=!0,i="g";break;case"%":j=!0,i="f";break;case"p":j=!0,i="r";break;case"d":k=!0,h="0"}i=p[i]||q;return function(a){var b=j?a*100:+a,l=b<0&&(b=-b)?"−":d;if(k&&b%1)return"";a=i(b,h);if(e){var m=a.length+l.length;m<f&&(a=Array(f-m+1).join(c)+a),g&&(a=r(a)),a=l+a}else{g&&(a=r(a)),a=l+a;var m=a.length;m<f&&(a=Array(f-m+1).join(c)+a)}j&&(a+="%");return a}};var o=/(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/,p={g:function(a,b){return a.toPrecision(b)},e:function(a,b){return a.toExponential(b)},f:function(a,b){return a.toFixed(b)},r:function(a,b){var c=a?1+Math.floor(1e-15+Math.log(a)/Math.LN10):1;return d3.round(a,b-c).toFixed(Math.max(0,Math.min(20,b-c)))}},s=A(2),t=A(3),u={linear:function(){return z},poly:A,quad:function(){return s},cubic:function(){return t},sin:function(){return B},exp:function(){return C},circle:function(){return D},elastic:E,back:F,bounce:function(){return G}},v={"in":function(a){return a},out:x,"in-out":y,"out-in":function(a){return y(x(a))}};d3.ease=function(a){var b=a.indexOf("-"),c=b>=0?a.substring(0,b):a,d=b>=0?a.substring(b+1):"in";return w(v[d](u[c].apply(null,Array.prototype.slice.call(arguments,1))))},d3.event=null,d3.interpolate=function(a,b){var c=d3.interpolators.length,d;while(--c>=0&&!(d=d3.interpolators[c](a,b)));return d},d3.interpolateNumber=function(a,b){b-=a;return function(c){return a+b*c}},d3.interpolateRound=function(a,b){b-=a;return function(c){return Math.round(a+b*c)}},d3.interpolateString=function(a,b){var c,d,e,f=0,g=0,h=[],i=[],j,k;H.lastIndex=0;for(d=0;c=H.exec(b);++d)c.index&&h.push(b.substring(f,g=c.index)),i.push({i:h.length,x:c[0]}),h.push(null),f=H.lastIndex;f<b.length&&h.push(b.substring(f));for(d=0,j=i.length;(c=H.exec(a))&&d<j;++d){k=i[d];if(k.x==c[0]){if(k.i)if(h[k.i+1]==null){h[k.i-1]+=k.x,h.splice(k.i,1);for(e=d+1;e<j;++e)i[e].i--}else{h[k.i-1]+=k.x+h[k.i+1],h.splice(k.i,2);for(e=d+1;e<j;++e)i[e].i-=2}else if(h[k.i+1]==null)h[k.i]=k.x;else{h[k.i]=k.x+h[k.i+1],h.splice(k.i+1,1);for(e=d+1;e<j;++e)i[e].i--}i.splice(d,1),j--,d--}else k.x=d3.interpolateNumber(parseFloat(c[0]),parseFloat(k.x))}while(d<j)k=i.pop(),h[k.i+1]==null?h[k.i]=k.x:(h[k.i]=k.x+h[k.i+1],h.splice(k.i+1,1)),j--;return h.length===1?h[0]==null?i[0].x:function(){return b}:function(a){for(d=0;d<j;++d)h[(k=i[d]).i]=k.x(a);return h.join("")}},d3.interpolateRgb=function(a,b){a=d3.rgb(a),b=d3.rgb(b);var c=a.r,d=a.g,e=a.b,f=b.r-c,g=b.g-d,h=b.b-e;return function(a){return"rgb("+Math.round(c+f*a)+","+Math.round(d+g*a)+","+Math.round(e+h*a)+")"}},d3.interpolateHsl=function(a,b){a=d3.hsl(a),b=d3.hsl(b);var c=a.h,d=a.s,e=a.l,f=b.h-c,g=b.s-d,h=b.l-e;return function(a){return W(c+f*a,d+g*a,e+h*a).toString()}},d3.interpolateArray=function(a,b){var c=[],d=[],e=a.length,f=b.length,g=Math.min(a.length,b.length),h;for(h=0;h<g;++h)c.push(d3.interpolate(a[h],b[h]));for(;h<e;++h)d[h]=a[h];for(;h<f;++h)d[h]=b[h];return function(a){for(h=0;h<g;++h)d[h]=c[h](a);return d}},d3.interpolateObject=function(a,b){var c={},d={},e;for(e in a)e in b?c[e]=J(e)(a[e],b[e]):d[e]=a[e];for(e in b)e in a||(d[e]=b[e]);return function(a){for(e in c)d[e]=c[e](a);return d}};var H=/[-+]?(?:\d+\.\d+|\d+\.|\.\d+|\d+)(?:[eE][-]?\d+)?/g,I={background:1,fill:1,stroke:1};d3.interpolators=[d3.interpolateObject,function(a,b){return b instanceof Array&&d3.interpolateArray(a,b)},function(a,b){return typeof b=="string"&&d3.interpolateString(String(a),b)},function(a,b){return(typeof b=="string"?b in S||/^(#|rgb\(|hsl\()/.test(b):b instanceof N||b instanceof V)&&d3.interpolateRgb(String(a),b)},function(a,b){return typeof b=="number"&&d3.interpolateNumber(+a,b)}],d3.rgb=function(a,b,c){return arguments.length===1?P(""+a,M,W):M(~~a,~~b,~~c)},N.prototype.brighter=function(a){a=Math.pow(.7,arguments.length?a:1);var b=this.r,c=this.g,d=this.b,e=30;if(!b&&!c&&!d)return M(e,e,e);b&&b<e&&(b=e),c&&c<e&&(c=e),d&&d<e&&(d=e);return M(Math.min(255,Math.floor(b/a)),Math.min(255,Math.floor(c/a)),Math.min(255,Math.floor(d/a)))},N.prototype.darker=function(a){a=Math.pow(.7,arguments.length?a:1);return M(Math.max(0,Math.floor(a*this.r)),Math.max(0,Math.floor(a*this.g)),Math.max(0,Math.floor(a*this.b)))},N.prototype.hsl=function(){return Q(this.r,this.g,this.b)},N.prototype.toString=function(){return"#"+O(this.r)+O(this.g)+O(this.b)};var S={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};for(var T in S)S[T]=P(S[T],M,W);d3.hsl=function(a,b,c){return arguments.length===1?P(""+a,Q,U):U(+a,+b,+c)},V.prototype.brighter=function(a){a=Math.pow(.7,arguments.length?a:1);return U(this.h,this.s,this.l/a)},V.prototype.darker=function(a){a=Math.pow(.7,arguments.length?a:1);return U(this.h,this.s,a*this.l)},V.prototype.rgb=function(){return W(this.h,this.s,this.l)},V.prototype.toString=function(){return"hsl("+this.h+","+this.s*100+"%,"+this.l*100+"%)"};var Y=function(a,b){return b.querySelector(a)},Z=function(a,b){return b.querySelectorAll(a)};typeof Sizzle=="function"&&(Y=function(a,b){return Sizzle(a,b)[0]},Z=function(a,b){return Sizzle.uniqueSort(Sizzle(a,b))});var $=[];d3.selection=function(){return bf},d3.selection.prototype=$,$.select=function(a){var b=[],c,d,e,f;typeof a!="function"&&(a=_(a));for(var g=-1,h=this.length;++g<h;){b.push(c=[]),c.parentNode=(e=this[g]).parentNode;for(var i=-1,j=e.length;++i<j;)(f=e[i])?(c.push(d=a.call(f,f.__data__,i)),d&&"__data__"in f&&(d.__data__=f.__data__)):c.push(null)}return X(b)},$.selectAll=function(a){var b=[],c,e;typeof a!="function"&&(a=ba(a));for(var f=-1,g=this.length;++f<g;)for(var h=this[f],i=-1,j=h.length;++i<j;)if(e=h[i])b.push(c=d(a.call(e,e.__data__,i))),c.parentNode=e;return X(b)},$.attr=function(a,b){function i(){var c=b.apply(this,arguments);c==null?this.removeAttributeNS(a.space,a.local):this.setAttributeNS(a.space,a.local,c)}function h(){var c=b.apply(this,arguments);c==null?this.removeAttribute(a):this.setAttribute(a,c)}function g(){this.setAttributeNS(a.space,a.local,b)}function f(){this.setAttribute(a,b)}function e(){this.removeAttributeNS(a.space,a.local)}function d(){this.removeAttribute(a)}a=d3.ns.qualify(a);if(arguments.length<2){var c=this.node();return a.local?c.getAttributeNS(a.space,a.local):c.getAttribute(a)}return this.each(b==null?a.local?e:d:typeof b=="function"?a.local?i:h:a.local?g:f)},$.classed=function(a,b){function h(){( <del>b.apply(this,arguments)?f:g).call(this)}function g(){if(b=this.classList)return b.remove(a);var b=this.className,d=b.baseVal!=null,e=d?b.baseVal:b;e=l(e.replace(c," ")),d?b.baseVal=e:this.className=e}function f(){if(b=this.classList)return b.add(a);var b=this.className,d=b.baseVal!=null,e=d?b.baseVal:b;c.lastIndex=0,c.test(e)||(e=l(e+" "+a),d?b.baseVal=e:this.className=e)}var c=new RegExp("(^|\\s+)"+d3.requote(a)+"(\\s+|$)","g");if(arguments.length<2){var d=this.node();if(e=d.classList)return e.contains(a);var e=d.className;c.lastIndex=0;return c.test(e.baseVal!=null?e.baseVal:e)}return this.each(typeof b=="function"?h:b?f:g)},$.style=function(a,b,c){function f(){var d=b.apply(this,arguments);d==null?this.style.removeProperty(a):this.style.setProperty(a,d,c)}function e(){this.style.setProperty(a,b,c)}function d(){this.style.removeProperty(a)}arguments.length<3&&(c="");return arguments.length<2?window.getComputedStyle(this.node(),null).getPropertyValue(a):this.each(b==null?d:typeof b=="function"?f:e)},$.property=function(a,b){function e(){var c=b.apply(this,arguments);c==null?delete this[a]:this[a]=c}function d(){this[a]=b}function c(){delete this[a]}return arguments.length<2?this.node()[a]:this.each(b==null?c:typeof b=="function"?e:d)},$.text=function(a){return arguments.length<1?this.node().textContent:this.each(typeof a=="function"?function(){this.textContent=a.apply(this,arguments)}:function(){this.textContent=a})},$.html=function(a){return arguments.length<1?this.node().innerHTML:this.each(typeof a=="function"?function(){this.innerHTML=a.apply(this,arguments)}:function(){this.innerHTML=a})},$.append=function(a){function c(){return this.appendChild(document.createElementNS(a.space,a.local))}function b(){return this.appendChild(document.createElement(a))}a=d3.ns.qualify(a);return this.select(a.local?c:b)},$.insert=function(a,b){function d(){return this.insertBefore(document.createElementNS(a.space,a.local),Y(b,this))}function c(){return this.insertBefore(document.createElement(a),Y(b,this))}a=d3.ns.qualify(a);return this.select(a.local?d:c)},$.remove=function(){return this.each(function(){var a=this.parentNode;a&&a.removeChild(this)})},$.data=function(a,b){function f(a,f){var g,h=a.length,i=f.length,j=Math.min(h,i),k=Math.max(h,i),l=[],m=[],n=[],o,p;if(b){var q={},r=[],s,t=f.length;for(g=-1;++g<h;)s=b.call(o=a[g],o.__data__,g),s in q?n[t++]=o:q[s]=o,r.push(s);for(g=-1;++g<i;)o=q[s=b.call(f,p=f[g],g)],o?(o.__data__=p,l[g]=o,m[g]=n[g]=null):(m[g]=bb(p),l[g]=n[g]=null),delete q[s];for(g=-1;++g<h;)r[g]in q&&(n[g]=a[g])}else{for(g=-1;++g<j;)o=a[g],p=f[g],o?(o.__data__=p,l[g]=o,m[g]=n[g]=null):(m[g]=bb(p),l[g]=n[g]=null);for(;g<i;++g)m[g]=bb(f[g]),l[g]=n[g]=null;for(;g<k;++g)n[g]=a[g],m[g]=l[g]=null}m.update=l,m.parentNode=l.parentNode=n.parentNode=a.parentNode,c.push(m),d.push(l),e.push(n)}var c=[],d=[],e=[],g=-1,h=this.length,i;if(typeof a=="function")while(++g<h)f(i=this[g],a.call(i,i.parentNode.__data__,g));else while(++g<h)f(i=this[g],a);var j=X(d);j.enter=function(){return bc(c)},j.exit=function(){return X(e)};return j};var bd=[];bd.append=$.append,bd.insert=$.insert,bd.empty=$.empty,bd.select=function(a){var b=[],c,d,e,f,g;for(var h=-1,i=this.length;++h<i;){e=(f=this[h]).update,b.push(c=[]),c.parentNode=f.parentNode;for(var j=-1,k=f.length;++j<k;)(g=f[j])?(c.push(e[j]=d=a.call(f.parentNode,g.__data__,j)),d.__data__=g.__data__):c.push(null)}return X(b)},$.filter=function(a){var b=[],c,d,e;for(var f=0,g=this.length;f<g;f++){b.push(c=[]),c.parentNode=(d=this[f]).parentNode;for(var h=0,i=d.length;h<i;h++)(e=d[h])&&a.call(e,e.__data__,h)&&c.push(e)}return X(b)},$.map=function(a){return this.each(function(){this.__data__=a.apply(this,arguments)})},$.sort=function(a){a=be.apply(this,arguments);for(var b=0,c=this.length;b<c;b++)for(var d=this[b].sort(a),e=1,f=d.length,g=d[0];e<f;e++){var h=d[e];h&&(g&&g.parentNode.insertBefore(h,g.nextSibling),g=h)}return this},$.on=function(a,b,c){arguments.length<3&&(c=!1);var d="__on"+a,e=a.indexOf(".");e>0&&(a=a.substring(0,e));return arguments.length<2?(e=this.node()[d])&&e._:this.each(function(e,f){function h(a){var c=d3.event;d3.event=a;try{b.call(g,g.__data__,f)}finally{d3.event=c}}var g=this;g[d]&&g.removeEventListener(a,g[d],c),b&&g.addEventListener(a,g[d]=h,c),h._=b})},$.each=function(a){for(var b=-1,c=this.length;++b<c;)for(var d=this[b],e=-1,f=d.length;++e<f;){var g=d[e];g&&a.call(g,g.__data__,e,b)}return this},$.call=function(a){a.apply(this,(arguments[0]=this,arguments));return this},$.empty=function(){return!this.node()},$.node=function(a){for(var b=0,c=this.length;b<c;b++)for(var d=this[b],e=0,f=d.length;e<f;e++){var g=d[e];if(g)return g}return null},$.transition=function(){var a=[],b,c;for(var d=-1,e=this.length;++d<e;){a.push(b=[]);for(var f=this[d],g=-1,h=f.length;++g<h;)b.push((c=f[g])?{node:c,delay:0,duration:250}:null)}return bg(a,bm||++bl)};var bf=X([[document]]);bf[0].parentNode=document.documentElement,d3.select=function(a){return typeof a=="string"?bf.select(a):X([[a]])},d3.selectAll=function(a){return typeof a=="string"?bf.selectAll(a):X([d(a)])};var bk=[],bl=0,bm=0,bn=d3.ease("cubic-in-out");bk.call=$.call,d3.transition=function(){return bf.transition()},d3.transition.prototype=bk,bk.select=function(a){var b=[],c,d,e;typeof a!="function"&&(a=_(a));for(var f=-1,g=this.length;++f<g;){b.push(c=[]);for(var h=this[f],i=-1,j=h.length;++i<j;)(e=h[i])&&(d=a.call(e.node,e.node.__data__,i))?("__data__"in e.node&&(d.__data__=e.node.__data__),c.push({node:d,delay:e.delay,duration:e.duration})):c.push(null)}return bg(b,this.id).ease(this.ease())},bk.selectAll=function(a){var b=[],c,d,e;typeof a!="function"&&(a=ba(a));for(var f=-1,g=this.length;++f<g;)for(var h=this[f],i=-1,j=h.length;++i<j;)if(e=h[i]){d=a.call(e.node,e.node.__data__,i),b.push(c=[]);for(var k=-1,l=d.length;++k<l;)c.push({node:d[k],delay:e.delay,duration:e.duration})}return bg(b,this.id).ease(this.ease())},bk.attr=function(a,b){return this.attrTween(a,bj(b))},bk.attrTween=function(a,b){function d(c,d){var e=b.call(this,c,d,this.getAttributeNS(a.space,a.local));return e&&function(b){this.setAttributeNS(a.space,a.local,e(b))}}function c(c,d){var e=b.call(this,c,d,this.getAttribute(a));return e&&function(b){this.setAttribute(a,e(b))}}a=d3.ns.qualify(a);return this.tween("attr."+a,a.local?d:c)},bk.style=function(a,b,c){arguments.length<3&&(c="");return this.styleTween(a,bj(b),c)},bk.styleTween=function(a,b,c){arguments.length<3&&(c="");return this.tween("style."+a,function(d,e){var f=b.call(this,d,e,window.getComputedStyle(this,null).getPropertyValue(a));return f&&function(b){(b=f(b))!=null?this.style.setProperty(a,b,c):this.style.removeProperty(a)}})},bk.text=function(a){return this.tween("text",function(b,c){this.textContent=typeof a=="function"?a.call(this,b,c):a})},bk.remove=function(){return this.each("end",function(){var a;!this.__transition__&&(a=this.parentNode)&&a.removeChild(this)})},bk.delay=function(a){var b=this;return b.each(typeof a=="function"?function(c,d,e){b[e][d].delay=+a.apply(this,arguments)}:(a=+a,function(c,d,e){b[e][d].delay=a}))},bk.duration=function(a){var b=this;return b.each(typeof a=="function"?function(c,d,e){b[e][d].duration=+a.apply(this,arguments)}:(a=+a,function(c,d,e){b[e][d].duration=a}))},bk.transition=function(){return this.select(i)};var bp=null,bq,br;d3.timer=function(a,b,c){var d=!1,e,f=bp;if(arguments.length<3){if(arguments.length<2)b=0;else if(!isFinite(b))return;c=Date.now()}while(f){if(f.callback===a){f.then=c,f.delay=b,d=!0;break}e=f,f=f.next}d||(bp={callback:a,then:c,delay:b,next:bp}),bq||(br=clearTimeout(br),bq=1,bu(bs))},d3.timer.flush=function(){var a,b=Date.now(),c=bp;while(c)a=b-c.then,c.delay||(c.flush=c.callback(a)),c=c.next;bt()};var bu=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){setTimeout(a,17)};d3.scale={},d3.scale.linear=function(){return bz([0,1],[0,1],d3.interpolate,!1)},d3.scale.log=function(){return bH(d3.scale.linear(),bJ)};var bI=d3.format("e");bJ.pow=function(a){return Math.pow(10,a)},bK.pow=function(a){return-Math.pow(10,-a)},d3.scale.pow=function(){return bL(d3.scale.linear(),1)},d3.scale.sqrt=function(){return d3.scale.pow().exponent(.5)},d3.scale.ordinal=function(){return bN([],{t:"range",x:[]})},d3.scale.category10=function(){return d3.scale.ordinal().range(bO)},d3.scale.category20=function(){return d3.scale.ordinal().range(bP)},d3.scale.category20b=function(){return d3.scale.ordinal().range(bQ)},d3.scale.category20c=function(){return d3.scale.ordinal().range(bR)};var bO=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],bP=["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"],bQ=["#393b79","#5254a3","#6b6ecf","#9c9ede","#637939","#8ca252","#b5cf6b","#cedb9c","#8c6d31","#bd9e39","#e7ba52","#e7cb94","#843c39","#ad494a","#d6616b","#e7969c","#7b4173","#a55194","#ce6dbd","#de9ed6"],bR=["#3182bd","#6baed6","#9ecae1","#c6dbef","#e6550d","#fd8d3c","#fdae6b","#fdd0a2","#31a354","#74c476","#a1d99b","#c7e9c0","#756bb1","#9e9ac8","#bcbddc","#dadaeb","#636363","#969696","#bdbdbd","#d9d9d9"];d3.scale.quantile=function(){return bS([],[])},d3.scale.quantize=function(){return bT(0,1,[0,1])},d3.svg={},d3.svg.arc=function(){function e(){var e=a.apply(this,arguments),f=b.apply(this,arguments),g=c.apply(this,arguments)+bU,h=d.apply(this,arguments)+bU,i=(h<g&&(i=g,g=h,h=i),h-g),j=i<Math.PI?"0":"1",k=Math.cos(g),l=Math.sin(g),m=Math.cos(h),n=Math.sin(h);return i>=bV?e?"M0,"+f+"A"+f+","+f+" 0 1,1 0,"+ -f+"A"+f+","+f+" 0 1,1 0,"+f+"M0,"+e+"A"+e+","+e+" 0 1,0 0,"+ -e+"A"+e+","+e+" 0 1,0 0,"+e+"Z":"M0,"+f+"A"+f+","+f+" 0 1,1 0,"+ -f+"A"+f+","+f+" 0 1,1 0,"+f+"Z":e?"M"+f*k+","+f*l+"A"+f+","+f+" 0 "+j+",1 "+f*m+","+f*n+"L"+e*m+","+e*n+"A"+e+","+e+" 0 "+j+",0 "+e*k+","+e*l+"Z":"M"+f*k+","+f*l+"A"+f+","+f+" 0 "+j+",1 "+f*m+","+f*n+"L0,0"+"Z"}var a=bW,b=bX,c=bY,d=bZ;e.innerRadius=function(b){if(!arguments.length)return a;a=d3.functor(b);return e},e.outerRadius=function(a){if(!arguments.length)return b;b=d3.functor(a);return e},e.startAngle=function(a){if(!arguments.length)return c;c=d3.functor(a);return e},e.endAngle=function(a){if(!arguments.length)return d;d=d3.functor(a);return e},e.centroid=function(){var e=(a.apply(this,arguments)+b.apply(this,arguments))/2,f=(c.apply(this,arguments)+d.apply(this,arguments))/2+bU;return[Math.cos(f)*e,Math.sin(f)*e]};return e};var bU=-Math.PI/2,bV=2*Math.PI-1e-6;d3.svg.line=function(){return b$(Object)};var cc={linear:cd,"step-before":ce,"step-after":cf,basis:cl,"basis-open":cm,"basis-closed":cn,bundle:co,cardinal:ci,"cardinal-open":cg,"cardinal-closed":ch,monotone:cx},cq=[0,2/3,1/3,0],cr=[0,1/3,2/3,0],cs=[0,1/6,2/3,1/6];d3.svg.line.radial=function(){var a=b$(cy);a.radius=a.x,delete a.x,a.angle=a.y,delete a.y;return a},d3.svg.area=function(){return cz(Object)},d3.svg.area.radial=function(){var a=cz(cy);a.radius=a.x,delete a.x,a.innerRadius=a.x0,delete a.x0,a.outerRadius=a.x1,delete a.x1,a.angle=a.y,delete a.y,a.startAngle=a.y0,delete a.y0,a.endAngle=a.y1,delete a.y1;return a},d3.svg.chord=function(){function j(a,b,c,d){return"Q 0,0 "+d}function i(a,b){return"A"+a+","+a+" 0 0,1 "+b}function h(a,b){return a.a0==b.a0&&a.a1==b.a1}function g(a,b,f,g){var h=b.call(a,f,g),i=c.call(a,h,g),j=d.call(a,h,g)+bU,k=e.call(a,h,g)+bU;return{r:i,a0:j,a1:k,p0:[i*Math.cos(j),i*Math.sin(j)],p1:[i*Math.cos(k),i*Math.sin(k)]}}function f(c,d){var e=g(this,a,c,d),f=g(this,b,c,d);return"M"+e.p0+i(e.r,e.p1)+(h(e,f)?j(e.r,e.p1,e.r,e.p0):j(e.r,e.p1,f.r,f.p0)+i(f.r,f.p1)+j(f.r,f.p1,e.r,e.p0))+"Z"}var a=cC,b=cD,c=cE,d=bY,e=bZ;f.radius=function(a){if(!arguments.length)return c;c=d3.functor(a);return f},f.source=function(b){if(!arguments.length)return a;a=d3.functor(b);return f},f.target=function(a){if(!arguments.length)return b;b=d3.functor(a);return f},f.startAngle=function(a){if(!arguments.length)return d;d=d3.functor(a);return f},f.endAngle=function(a){if(!arguments.length)return e;e=d3.functor(a);return f};return f},d3.svg.diagonal=function(){function d(d,e){var f=a.call(this,d,e),g=b.call(this,d,e),h=(f.y+g.y)/2,i=[f,{x:f.x,y:h},{x:g.x,y:h},g];i=i.map(c);return"M"+i[0]+"C"+i[1]+" "+i[2]+" "+i[3]}var a=cC,b=cD,c=cH;d.source=function(b){if(!arguments.length)return a;a=d3.functor(b);return d},d.target=function(a){if(!arguments.length)return b;b=d3.functor(a);return d},d.projection=function(a){if(!arguments.length)return c;c=a;return d};return d},d3.svg.diagonal.radial=function(){var a=d3.svg.diagonal(),b=cH,c=a.projection;a.projection=function(a){return arguments.length?c(cI(b=a)):b};return a},d3.svg.mouse=function(a){return cK(a,d3.event)};var cJ=/WebKit/.test(navigator.userAgent)?-1:0;d3.svg.touches=function(a){var b=d3.event.touches;return b?d(b).map(function(b){var c=cK(a,b);c.identifier=b.identifier;return c}):[]},d3.svg.symbol=function(){function c(c,d){return(cN[a.call(this,c,d)]||cN.circle)(b.call(this,c,d))}var a=cM,b=cL;c.type=function(b){if(!arguments.length)return a;a=d3.functor(b);return c},c.size=function(a){if(!arguments.length)return b;b=d3.functor(a);return c};return c};var cN={circle:function(a){var b=Math.sqrt(a/Math.PI);return"M0,"+b+"A"+b+","+b+" 0 1,1 0,"+ -b+"A"+b+","+b+" 0 1,1 0,"+b+"Z"},cross:function(a){var b=Math.sqrt(a/5)/2;return"M"+ -3*b+","+ -b+"H"+ -b+"V"+ -3*b+"H"+b+"V"+ -b+"H"+3*b+"V"+b+"H"+b+"V"+3*b+"H"+ -b+"V"+b+"H"+ -3*b+"Z"},diamond:function(a){var b=Math.sqrt(a/(2*cP)),c=b*cP;return"M0,"+ -b+"L"+c+",0"+" 0,"+b+" "+ -c+",0"+"Z"},square:function(a){var b=Math.sqrt(a)/2;return"M"+ -b+","+ -b+"L"+b+","+ -b+" "+b+","+b+" "+ -b+","+b+"Z"},"triangle-down":function(a){var b=Math.sqrt(a/cO),c=b*cO/2;return"M0,"+c+"L"+b+","+ -c+" "+ -b+","+ -c+"Z"},"triangle-up":function(a){var b=Math.sqrt(a/cO),c=b*cO/2;return"M0,"+ -c+"L"+b+","+c+" "+ -b+","+c+"Z"}};d3.svg.symbolTypes=d3.keys(cN);var cO=Math.sqrt(3),cP=Math.tan(30*Math.PI/180);d3.svg.axis=function(){function j(j){j.each(function(k,l,m){function F(a){return j.delay?a.transition().delay(j[m][l].delay).duration(j[m][l].duration).ease(j.ease()):a}var n=d3.select(this),o=a.ticks.apply(a,g),p=h==null?a.tickFormat.apply(a,g):h,q=cS(a,o,i),r=n.selectAll(".minor").data(q,String),s=r.enter().insert("svg:line","g").attr("class","tick minor").style("opacity",1e-6),t=F(r.exit()).style("opacity",1e-6).remove(),u=F(r).style("opacity",1),v=n.selectAll("g").data(o,String),w=v.enter().insert("svg:g","path").style("opacity",1e-6),x=F(v.exit()).style("opacity",1e-6).remove(),y=F(v).style("opacity",1),z,A=bw(a.range()),B=n.selectAll(".domain").data([0]),C=B.enter().append("svg:path").attr("class","domain"),D=F(B),E=this.__chart__||a;this.__chart__=a.copy(),w.append("svg:line").attr("class","tick"),w.append("svg:text"),y.select("text").text(p);switch(b){case"bottom":z=cQ,u.attr("y2",d),w.select("text").attr("dy",".71em").attr("text-anchor","middle"),y.select("line").attr("y2",c),y.select("text").attr("y",Math.max(c,0)+f),D.attr("d","M"+A[0]+","+e+"V0H"+A[1]+"V"+e);break;case"top":z=cQ,u.attr("y2",-d),w.select("text").attr("text-anchor","middle"),y.select("line").attr("y2",-c),y.select("text").attr("y",-(Math.max(c,0)+f)),D.attr("d","M"+A[0]+","+ -e+"V0H"+A[1]+"V"+ -e);break;case"left":z=cR,u.attr("x2",-d),w.select("text").attr("dy",".32em").attr("text-anchor","end"),y.select("line").attr("x2",-c),y.select("text").attr("x",-(Math.max(c,0)+f)),D.attr("d","M"+ -e+","+A[0]+"H0V"+A[1]+"H"+ -e);break;case"right":z=cR,u.attr("x2",d),w.select("text").attr("dy",".32em"),y.select("line").attr("x2",c),y.select("text").attr("x",Math.max(c,0)+f),D.attr("d","M"+e+","+A[0]+"H0V"+A[1]+"H"+e)}w.call(z,E),y.call(z,a),x.call(z,a),s.call(z,E),u.call(z,a),t.call(z,a)})}var a=d3.scale.linear(),b="bottom",c=6,d=6,e=6,f=3,g=[10],h,i=0;j.scale=function(b){if(!arguments.length)return a;a=b;return j},j.orient=function(a){if(!arguments.length)return b;b=a;return j},j.ticks=function(){if(!arguments.length)return g;g=arguments;return j},j.tickFormat=function(a){if(!arguments.length)return h;h=a;return j},j.tickSize=function(a,b,f){if(!arguments.length)return c;var g=arguments.length-1;c=+a,d=g>1?+b:c,e=g>0?+arguments[g]:c;return j},j.tickPadding=function(a){if(!arguments.length)return f;f=+a;return j},j.tickSubdivide=function(a){if(!arguments.length)return i;i=+a;return j};return j},d3.behavior={},d3.behavior.drag=function(){function d(){c.apply(this,arguments),c$("dragstart")}function c(){cT=a,cU=d3.event.target,cX=c_((cV=this).parentNode),cY=0,cW=arguments}function b(){this.on("mousedown.drag",d).on("touchstart.drag",d),d3.select(window).on("mousemove.drag",da).on("touchmove.drag",da).on("mouseup.drag",db,!0).on("touchend.drag",db,!0).on("click.drag",dc,!0)}var a=d3.dispatch("drag","dragstart","dragend");b.on=function(c,d){a[c].add(d);return b};return b};var cT,cU,cV,cW,cX,cY,cZ;d3.behavior.zoom=function(){function h(){d.apply(this,arguments);var b=dt(),c,e=Date.now();b.length===1&&e-di<300&&dy(1+Math.floor(a[2]),c=b[0],dh[c.identifier]),di=e}function g(){d.apply(this,arguments);var b=d3.svg.mouse(dm);dy(d3.event.shiftKey?Math.ceil(a[2]-1):Math.floor(a[2]+1),b,dr(b))}function f(){d.apply(this,arguments),dg||(dg=dr(d3.svg.mouse(dm))),dy(ds()+a[2],d3.svg.mouse(dm),dg)}function e(){d.apply(this,arguments),df=dr(d3.svg.mouse(dm)),dp=!1,d3.event.preventDefault(),window.focus()}function d(){dj=a,dk=b.zoom.dispatch,dl=d3.event.target,dm=this,dn=arguments}function c(){this.on("mousedown.zoom",e).on("mousewheel.zoom",f).on("DOMMouseScroll.zoom",f).on("dblclick.zoom",g).on("touchstart.zoom",h),d3.select(window).on("mousemove.zoom",dv).on("mouseup.zoom",dw).on("touchmove.zoom",du).on("touchend.zoom",dt).on("click.zoom",dx,!0)}var a=[0,0,0],b=d3.dispatch("zoom");c.on=function(a,d){b[a].add(d);return c};return c};var de,df,dg,dh={},di=0,dj,dk,dl,dm,dn,dp,dq})() <ide>\ No newline at end of file <add>b.apply(this,arguments)?f:g).call(this)}function g(){if(b=this.classList)return b.remove(a);var b=this.className,d=b.baseVal!=null,e=d?b.baseVal:b;e=l(e.replace(c," ")),d?b.baseVal=e:this.className=e}function f(){if(b=this.classList)return b.add(a);var b=this.className,d=b.baseVal!=null,e=d?b.baseVal:b;c.lastIndex=0,c.test(e)||(e=l(e+" "+a),d?b.baseVal=e:this.className=e)}var c=new RegExp("(^|\\s+)"+d3.requote(a)+"(\\s+|$)","g");if(arguments.length<2){var d=this.node();if(e=d.classList)return e.contains(a);var e=d.className;c.lastIndex=0;return c.test(e.baseVal!=null?e.baseVal:e)}return this.each(typeof b=="function"?h:b?f:g)},$.style=function(a,b,c){function f(){var d=b.apply(this,arguments);d==null?this.style.removeProperty(a):this.style.setProperty(a,d,c)}function e(){this.style.setProperty(a,b,c)}function d(){this.style.removeProperty(a)}arguments.length<3&&(c="");return arguments.length<2?window.getComputedStyle(this.node(),null).getPropertyValue(a):this.each(b==null?d:typeof b=="function"?f:e)},$.property=function(a,b){function e(){var c=b.apply(this,arguments);c==null?delete this[a]:this[a]=c}function d(){this[a]=b}function c(){delete this[a]}return arguments.length<2?this.node()[a]:this.each(b==null?c:typeof b=="function"?e:d)},$.text=function(a){return arguments.length<1?this.node().textContent:this.each(typeof a=="function"?function(){this.textContent=a.apply(this,arguments)}:function(){this.textContent=a})},$.html=function(a){return arguments.length<1?this.node().innerHTML:this.each(typeof a=="function"?function(){this.innerHTML=a.apply(this,arguments)}:function(){this.innerHTML=a})},$.append=function(a){function c(){return this.appendChild(document.createElementNS(a.space,a.local))}function b(){return this.appendChild(document.createElement(a))}a=d3.ns.qualify(a);return this.select(a.local?c:b)},$.insert=function(a,b){function d(){return this.insertBefore(document.createElementNS(a.space,a.local),Y(b,this))}function c(){return this.insertBefore(document.createElement(a),Y(b,this))}a=d3.ns.qualify(a);return this.select(a.local?d:c)},$.remove=function(){return this.each(function(){var a=this.parentNode;a&&a.removeChild(this)})},$.data=function(a,b){function f(a,f){var g,h=a.length,i=f.length,j=Math.min(h,i),k=Math.max(h,i),l=[],m=[],n=[],o,p;if(b){var q={},r=[],s,t=f.length;for(g=-1;++g<h;)s=b.call(o=a[g],o.__data__,g),s in q?n[t++]=o:q[s]=o,r.push(s);for(g=-1;++g<i;)o=q[s=b.call(f,p=f[g],g)],o?(o.__data__=p,l[g]=o,m[g]=n[g]=null):(m[g]=bb(p),l[g]=n[g]=null),delete q[s];for(g=-1;++g<h;)r[g]in q&&(n[g]=a[g])}else{for(g=-1;++g<j;)o=a[g],p=f[g],o?(o.__data__=p,l[g]=o,m[g]=n[g]=null):(m[g]=bb(p),l[g]=n[g]=null);for(;g<i;++g)m[g]=bb(f[g]),l[g]=n[g]=null;for(;g<k;++g)n[g]=a[g],m[g]=l[g]=null}m.update=l,m.parentNode=l.parentNode=n.parentNode=a.parentNode,c.push(m),d.push(l),e.push(n)}var c=[],d=[],e=[],g=-1,h=this.length,i;if(typeof a=="function")while(++g<h)f(i=this[g],a.call(i,i.parentNode.__data__,g));else while(++g<h)f(i=this[g],a);var j=X(d);j.enter=function(){return bc(c)},j.exit=function(){return X(e)};return j};var bd=[];bd.append=$.append,bd.insert=$.insert,bd.empty=$.empty,bd.select=function(a){var b=[],c,d,e,f,g;for(var h=-1,i=this.length;++h<i;){e=(f=this[h]).update,b.push(c=[]),c.parentNode=f.parentNode;for(var j=-1,k=f.length;++j<k;)(g=f[j])?(c.push(e[j]=d=a.call(f.parentNode,g.__data__,j)),d.__data__=g.__data__):c.push(null)}return X(b)},$.filter=function(a){var b=[],c,d,e;for(var f=0,g=this.length;f<g;f++){b.push(c=[]),c.parentNode=(d=this[f]).parentNode;for(var h=0,i=d.length;h<i;h++)(e=d[h])&&a.call(e,e.__data__,h)&&c.push(e)}return X(b)},$.map=function(a){return this.each(function(){this.__data__=a.apply(this,arguments)})},$.sort=function(a){a=be.apply(this,arguments);for(var b=0,c=this.length;b<c;b++)for(var d=this[b].sort(a),e=1,f=d.length,g=d[0];e<f;e++){var h=d[e];h&&(g&&g.parentNode.insertBefore(h,g.nextSibling),g=h)}return this},$.on=function(a,b,c){arguments.length<3&&(c=!1);var d="__on"+a,e=a.indexOf(".");e>0&&(a=a.substring(0,e));return arguments.length<2?(e=this.node()[d])&&e._:this.each(function(e,f){function h(a){var c=d3.event;d3.event=a;try{b.call(g,g.__data__,f)}finally{d3.event=c}}var g=this;g[d]&&g.removeEventListener(a,g[d],c),b&&g.addEventListener(a,g[d]=h,c),h._=b})},$.each=function(a){for(var b=-1,c=this.length;++b<c;)for(var d=this[b],e=-1,f=d.length;++e<f;){var g=d[e];g&&a.call(g,g.__data__,e,b)}return this},$.call=function(a){a.apply(this,(arguments[0]=this,arguments));return this},$.empty=function(){return!this.node()},$.node=function(a){for(var b=0,c=this.length;b<c;b++)for(var d=this[b],e=0,f=d.length;e<f;e++){var g=d[e];if(g)return g}return null},$.transition=function(){var a=[],b,c;for(var d=-1,e=this.length;++d<e;){a.push(b=[]);for(var f=this[d],g=-1,h=f.length;++g<h;)b.push((c=f[g])?{node:c,delay:0,duration:250}:null)}return bg(a,bm||++bl)};var bf=X([[document]]);bf[0].parentNode=document.documentElement,d3.select=function(a){return typeof a=="string"?bf.select(a):X([[a]])},d3.selectAll=function(a){return typeof a=="string"?bf.selectAll(a):X([d(a)])};var bk=[],bl=0,bm=0,bn=d3.ease("cubic-in-out");bk.call=$.call,d3.transition=function(){return bf.transition()},d3.transition.prototype=bk,bk.select=function(a){var b=[],c,d,e;typeof a!="function"&&(a=_(a));for(var f=-1,g=this.length;++f<g;){b.push(c=[]);for(var h=this[f],i=-1,j=h.length;++i<j;)(e=h[i])&&(d=a.call(e.node,e.node.__data__,i))?("__data__"in e.node&&(d.__data__=e.node.__data__),c.push({node:d,delay:e.delay,duration:e.duration})):c.push(null)}return bg(b,this.id).ease(this.ease())},bk.selectAll=function(a){var b=[],c,d,e;typeof a!="function"&&(a=ba(a));for(var f=-1,g=this.length;++f<g;)for(var h=this[f],i=-1,j=h.length;++i<j;)if(e=h[i]){d=a.call(e.node,e.node.__data__,i),b.push(c=[]);for(var k=-1,l=d.length;++k<l;)c.push({node:d[k],delay:e.delay,duration:e.duration})}return bg(b,this.id).ease(this.ease())},bk.attr=function(a,b){return this.attrTween(a,bj(b))},bk.attrTween=function(a,b){function d(c,d){var e=b.call(this,c,d,this.getAttributeNS(a.space,a.local));return e&&function(b){this.setAttributeNS(a.space,a.local,e(b))}}function c(c,d){var e=b.call(this,c,d,this.getAttribute(a));return e&&function(b){(b=e(b))!=null?this.setAttribute(a,b):this.removeAttribute(a)}}a=d3.ns.qualify(a);return this.tween("attr."+a,a.local?d:c)},bk.style=function(a,b,c){arguments.length<3&&(c="");return this.styleTween(a,bj(b),c)},bk.styleTween=function(a,b,c){arguments.length<3&&(c="");return this.tween("style."+a,function(d,e){var f=b.call(this,d,e,window.getComputedStyle(this,null).getPropertyValue(a));return f&&function(b){(b=f(b))!=null?this.style.setProperty(a,b,c):this.style.removeProperty(a)}})},bk.text=function(a){return this.tween("text",function(b,c){this.textContent=typeof a=="function"?a.call(this,b,c):a})},bk.remove=function(){return this.each("end",function(){var a;!this.__transition__&&(a=this.parentNode)&&a.removeChild(this)})},bk.delay=function(a){var b=this;return b.each(typeof a=="function"?function(c,d,e){b[e][d].delay=+a.apply(this,arguments)}:(a=+a,function(c,d,e){b[e][d].delay=a}))},bk.duration=function(a){var b=this;return b.each(typeof a=="function"?function(c,d,e){b[e][d].duration=+a.apply(this,arguments)}:(a=+a,function(c,d,e){b[e][d].duration=a}))},bk.transition=function(){return this.select(i)};var bp=null,bq,br;d3.timer=function(a,b,c){var d=!1,e,f=bp;if(arguments.length<3){if(arguments.length<2)b=0;else if(!isFinite(b))return;c=Date.now()}while(f){if(f.callback===a){f.then=c,f.delay=b,d=!0;break}e=f,f=f.next}d||(bp={callback:a,then:c,delay:b,next:bp}),bq||(br=clearTimeout(br),bq=1,bu(bs))},d3.timer.flush=function(){var a,b=Date.now(),c=bp;while(c)a=b-c.then,c.delay||(c.flush=c.callback(a)),c=c.next;bt()};var bu=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){setTimeout(a,17)};d3.scale={},d3.scale.linear=function(){return bz([0,1],[0,1],d3.interpolate,!1)},d3.scale.log=function(){return bH(d3.scale.linear(),bJ)};var bI=d3.format("e");bJ.pow=function(a){return Math.pow(10,a)},bK.pow=function(a){return-Math.pow(10,-a)},d3.scale.pow=function(){return bL(d3.scale.linear(),1)},d3.scale.sqrt=function(){return d3.scale.pow().exponent(.5)},d3.scale.ordinal=function(){return bN([],{t:"range",x:[]})},d3.scale.category10=function(){return d3.scale.ordinal().range(bO)},d3.scale.category20=function(){return d3.scale.ordinal().range(bP)},d3.scale.category20b=function(){return d3.scale.ordinal().range(bQ)},d3.scale.category20c=function(){return d3.scale.ordinal().range(bR)};var bO=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],bP=["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"],bQ=["#393b79","#5254a3","#6b6ecf","#9c9ede","#637939","#8ca252","#b5cf6b","#cedb9c","#8c6d31","#bd9e39","#e7ba52","#e7cb94","#843c39","#ad494a","#d6616b","#e7969c","#7b4173","#a55194","#ce6dbd","#de9ed6"],bR=["#3182bd","#6baed6","#9ecae1","#c6dbef","#e6550d","#fd8d3c","#fdae6b","#fdd0a2","#31a354","#74c476","#a1d99b","#c7e9c0","#756bb1","#9e9ac8","#bcbddc","#dadaeb","#636363","#969696","#bdbdbd","#d9d9d9"];d3.scale.quantile=function(){return bS([],[])},d3.scale.quantize=function(){return bT(0,1,[0,1])},d3.svg={},d3.svg.arc=function(){function e(){var e=a.apply(this,arguments),f=b.apply(this,arguments),g=c.apply(this,arguments)+bU,h=d.apply(this,arguments)+bU,i=(h<g&&(i=g,g=h,h=i),h-g),j=i<Math.PI?"0":"1",k=Math.cos(g),l=Math.sin(g),m=Math.cos(h),n=Math.sin(h);return i>=bV?e?"M0,"+f+"A"+f+","+f+" 0 1,1 0,"+ -f+"A"+f+","+f+" 0 1,1 0,"+f+"M0,"+e+"A"+e+","+e+" 0 1,0 0,"+ -e+"A"+e+","+e+" 0 1,0 0,"+e+"Z":"M0,"+f+"A"+f+","+f+" 0 1,1 0,"+ -f+"A"+f+","+f+" 0 1,1 0,"+f+"Z":e?"M"+f*k+","+f*l+"A"+f+","+f+" 0 "+j+",1 "+f*m+","+f*n+"L"+e*m+","+e*n+"A"+e+","+e+" 0 "+j+",0 "+e*k+","+e*l+"Z":"M"+f*k+","+f*l+"A"+f+","+f+" 0 "+j+",1 "+f*m+","+f*n+"L0,0"+"Z"}var a=bW,b=bX,c=bY,d=bZ;e.innerRadius=function(b){if(!arguments.length)return a;a=d3.functor(b);return e},e.outerRadius=function(a){if(!arguments.length)return b;b=d3.functor(a);return e},e.startAngle=function(a){if(!arguments.length)return c;c=d3.functor(a);return e},e.endAngle=function(a){if(!arguments.length)return d;d=d3.functor(a);return e},e.centroid=function(){var e=(a.apply(this,arguments)+b.apply(this,arguments))/2,f=(c.apply(this,arguments)+d.apply(this,arguments))/2+bU;return[Math.cos(f)*e,Math.sin(f)*e]};return e};var bU=-Math.PI/2,bV=2*Math.PI-1e-6;d3.svg.line=function(){return b$(Object)};var cc={linear:cd,"step-before":ce,"step-after":cf,basis:cl,"basis-open":cm,"basis-closed":cn,bundle:co,cardinal:ci,"cardinal-open":cg,"cardinal-closed":ch,monotone:cx},cq=[0,2/3,1/3,0],cr=[0,1/3,2/3,0],cs=[0,1/6,2/3,1/6];d3.svg.line.radial=function(){var a=b$(cy);a.radius=a.x,delete a.x,a.angle=a.y,delete a.y;return a},d3.svg.area=function(){return cz(Object)},d3.svg.area.radial=function(){var a=cz(cy);a.radius=a.x,delete a.x,a.innerRadius=a.x0,delete a.x0,a.outerRadius=a.x1,delete a.x1,a.angle=a.y,delete a.y,a.startAngle=a.y0,delete a.y0,a.endAngle=a.y1,delete a.y1;return a},d3.svg.chord=function(){function j(a,b,c,d){return"Q 0,0 "+d}function i(a,b){return"A"+a+","+a+" 0 0,1 "+b}function h(a,b){return a.a0==b.a0&&a.a1==b.a1}function g(a,b,f,g){var h=b.call(a,f,g),i=c.call(a,h,g),j=d.call(a,h,g)+bU,k=e.call(a,h,g)+bU;return{r:i,a0:j,a1:k,p0:[i*Math.cos(j),i*Math.sin(j)],p1:[i*Math.cos(k),i*Math.sin(k)]}}function f(c,d){var e=g(this,a,c,d),f=g(this,b,c,d);return"M"+e.p0+i(e.r,e.p1)+(h(e,f)?j(e.r,e.p1,e.r,e.p0):j(e.r,e.p1,f.r,f.p0)+i(f.r,f.p1)+j(f.r,f.p1,e.r,e.p0))+"Z"}var a=cC,b=cD,c=cE,d=bY,e=bZ;f.radius=function(a){if(!arguments.length)return c;c=d3.functor(a);return f},f.source=function(b){if(!arguments.length)return a;a=d3.functor(b);return f},f.target=function(a){if(!arguments.length)return b;b=d3.functor(a);return f},f.startAngle=function(a){if(!arguments.length)return d;d=d3.functor(a);return f},f.endAngle=function(a){if(!arguments.length)return e;e=d3.functor(a);return f};return f},d3.svg.diagonal=function(){function d(d,e){var f=a.call(this,d,e),g=b.call(this,d,e),h=(f.y+g.y)/2,i=[f,{x:f.x,y:h},{x:g.x,y:h},g];i=i.map(c);return"M"+i[0]+"C"+i[1]+" "+i[2]+" "+i[3]}var a=cC,b=cD,c=cH;d.source=function(b){if(!arguments.length)return a;a=d3.functor(b);return d},d.target=function(a){if(!arguments.length)return b;b=d3.functor(a);return d},d.projection=function(a){if(!arguments.length)return c;c=a;return d};return d},d3.svg.diagonal.radial=function(){var a=d3.svg.diagonal(),b=cH,c=a.projection;a.projection=function(a){return arguments.length?c(cI(b=a)):b};return a},d3.svg.mouse=function(a){return cK(a,d3.event)};var cJ=/WebKit/.test(navigator.userAgent)?-1:0;d3.svg.touches=function(a){var b=d3.event.touches;return b?d(b).map(function(b){var c=cK(a,b);c.identifier=b.identifier;return c}):[]},d3.svg.symbol=function(){function c(c,d){return(cN[a.call(this,c,d)]||cN.circle)(b.call(this,c,d))}var a=cM,b=cL;c.type=function(b){if(!arguments.length)return a;a=d3.functor(b);return c},c.size=function(a){if(!arguments.length)return b;b=d3.functor(a);return c};return c};var cN={circle:function(a){var b=Math.sqrt(a/Math.PI);return"M0,"+b+"A"+b+","+b+" 0 1,1 0,"+ -b+"A"+b+","+b+" 0 1,1 0,"+b+"Z"},cross:function(a){var b=Math.sqrt(a/5)/2;return"M"+ -3*b+","+ -b+"H"+ -b+"V"+ -3*b+"H"+b+"V"+ -b+"H"+3*b+"V"+b+"H"+b+"V"+3*b+"H"+ -b+"V"+b+"H"+ -3*b+"Z"},diamond:function(a){var b=Math.sqrt(a/(2*cP)),c=b*cP;return"M0,"+ -b+"L"+c+",0"+" 0,"+b+" "+ -c+",0"+"Z"},square:function(a){var b=Math.sqrt(a)/2;return"M"+ -b+","+ -b+"L"+b+","+ -b+" "+b+","+b+" "+ -b+","+b+"Z"},"triangle-down":function(a){var b=Math.sqrt(a/cO),c=b*cO/2;return"M0,"+c+"L"+b+","+ -c+" "+ -b+","+ -c+"Z"},"triangle-up":function(a){var b=Math.sqrt(a/cO),c=b*cO/2;return"M0,"+ -c+"L"+b+","+c+" "+ -b+","+c+"Z"}};d3.svg.symbolTypes=d3.keys(cN);var cO=Math.sqrt(3),cP=Math.tan(30*Math.PI/180);d3.svg.axis=function(){function j(j){j.each(function(k,l,m){function F(a){return j.delay?a.transition().delay(j[m][l].delay).duration(j[m][l].duration).ease(j.ease()):a}var n=d3.select(this),o=a.ticks.apply(a,g),p=h==null?a.tickFormat.apply(a,g):h,q=cS(a,o,i),r=n.selectAll(".minor").data(q,String),s=r.enter().insert("svg:line","g").attr("class","tick minor").style("opacity",1e-6),t=F(r.exit()).style("opacity",1e-6).remove(),u=F(r).style("opacity",1),v=n.selectAll("g").data(o,String),w=v.enter().insert("svg:g","path").style("opacity",1e-6),x=F(v.exit()).style("opacity",1e-6).remove(),y=F(v).style("opacity",1),z,A=bw(a.range()),B=n.selectAll(".domain").data([0]),C=B.enter().append("svg:path").attr("class","domain"),D=F(B),E=this.__chart__||a;this.__chart__=a.copy(),w.append("svg:line").attr("class","tick"),w.append("svg:text"),y.select("text").text(p);switch(b){case"bottom":z=cQ,u.attr("y2",d),w.select("text").attr("dy",".71em").attr("text-anchor","middle"),y.select("line").attr("y2",c),y.select("text").attr("y",Math.max(c,0)+f),D.attr("d","M"+A[0]+","+e+"V0H"+A[1]+"V"+e);break;case"top":z=cQ,u.attr("y2",-d),w.select("text").attr("text-anchor","middle"),y.select("line").attr("y2",-c),y.select("text").attr("y",-(Math.max(c,0)+f)),D.attr("d","M"+A[0]+","+ -e+"V0H"+A[1]+"V"+ -e);break;case"left":z=cR,u.attr("x2",-d),w.select("text").attr("dy",".32em").attr("text-anchor","end"),y.select("line").attr("x2",-c),y.select("text").attr("x",-(Math.max(c,0)+f)),D.attr("d","M"+ -e+","+A[0]+"H0V"+A[1]+"H"+ -e);break;case"right":z=cR,u.attr("x2",d),w.select("text").attr("dy",".32em"),y.select("line").attr("x2",c),y.select("text").attr("x",Math.max(c,0)+f),D.attr("d","M"+e+","+A[0]+"H0V"+A[1]+"H"+e)}w.call(z,E),y.call(z,a),x.call(z,a),s.call(z,E),u.call(z,a),t.call(z,a)})}var a=d3.scale.linear(),b="bottom",c=6,d=6,e=6,f=3,g=[10],h,i=0;j.scale=function(b){if(!arguments.length)return a;a=b;return j},j.orient=function(a){if(!arguments.length)return b;b=a;return j},j.ticks=function(){if(!arguments.length)return g;g=arguments;return j},j.tickFormat=function(a){if(!arguments.length)return h;h=a;return j},j.tickSize=function(a,b,f){if(!arguments.length)return c;var g=arguments.length-1;c=+a,d=g>1?+b:c,e=g>0?+arguments[g]:c;return j},j.tickPadding=function(a){if(!arguments.length)return f;f=+a;return j},j.tickSubdivide=function(a){if(!arguments.length)return i;i=+a;return j};return j},d3.behavior={},d3.behavior.drag=function(){function d(){c.apply(this,arguments),c$("dragstart")}function c(){cT=a,cU=d3.event.target,cX=c_((cV=this).parentNode),cY=0,cW=arguments}function b(){this.on("mousedown.drag",d).on("touchstart.drag",d),d3.select(window).on("mousemove.drag",da).on("touchmove.drag",da).on("mouseup.drag",db,!0).on("touchend.drag",db,!0).on("click.drag",dc,!0)}var a=d3.dispatch("drag","dragstart","dragend");b.on=function(c,d){a[c].add(d);return b};return b};var cT,cU,cV,cW,cX,cY,cZ;d3.behavior.zoom=function(){function h(){d.apply(this,arguments);var b=dt(),c,e=Date.now();b.length===1&&e-di<300&&dy(1+Math.floor(a[2]),c=b[0],dh[c.identifier]),di=e}function g(){d.apply(this,arguments);var b=d3.svg.mouse(dm);dy(d3.event.shiftKey?Math.ceil(a[2]-1):Math.floor(a[2]+1),b,dr(b))}function f(){d.apply(this,arguments),dg||(dg=dr(d3.svg.mouse(dm))),dy(ds()+a[2],d3.svg.mouse(dm),dg)}function e(){d.apply(this,arguments),df=dr(d3.svg.mouse(dm)),dp=!1,d3.event.preventDefault(),window.focus()}function d(){dj=a,dk=b.zoom.dispatch,dl=d3.event.target,dm=this,dn=arguments}function c(){this.on("mousedown.zoom",e).on("mousewheel.zoom",f).on("DOMMouseScroll.zoom",f).on("dblclick.zoom",g).on("touchstart.zoom",h),d3.select(window).on("mousemove.zoom",dv).on("mouseup.zoom",dw).on("touchmove.zoom",du).on("touchend.zoom",dt).on("click.zoom",dx,!0)}var a=[0,0,0],b=d3.dispatch("zoom");c.on=function(a,d){b[a].add(d);return c};return c};var de,df,dg,dh={},di=0,dj,dk,dl,dm,dn,dp,dq})() <ide>\ No newline at end of file <ide><path>src/core/transition-attr.js <ide> d3_transitionPrototype.attrTween = function(name, tween) { <ide> function attrTween(d, i) { <ide> var f = tween.call(this, d, i, this.getAttribute(name)); <ide> return f && function(t) { <del> this.setAttribute(name, f(t)); <add> if ((t = f(t)) != null) this.setAttribute(name, t); <add> else this.removeAttribute(name); <ide> }; <ide> } <ide> <ide><path>src/core/transition-style.js <ide> d3_transitionPrototype.styleTween = function(name, tween, priority) { <ide> return this.tween("style." + name, function(d, i) { <ide> var f = tween.call(this, d, i, window.getComputedStyle(this, null).getPropertyValue(name)); <ide> return f && function(t) { <del> if ((t = f(t)) != null) { <del> this.style.setProperty(name, t, priority); <del> } else { <del> this.style.removeProperty(name); <del> } <add> if ((t = f(t)) != null) this.style.setProperty(name, t, priority); <add> else this.style.removeProperty(name); <ide> }; <ide> }); <ide> }; <ide><path>test/core/transition-test-attr.js <ide> module.exports = { <ide> var cb = this.callback; <ide> <ide> var s = d3.select("body").append("div") <add> .attr("display", "none") <ide> .attr("width", 20) <ide> .attr("color", "red"); <ide> <ide> var t = s.transition() <add> .attr("display", null) <ide> .attr("width", 100) <ide> .attr("width", 200) <ide> .attr("color", function() { return "green"; }) <ide> module.exports = { <ide> }, <ide> "sets an attribute as a function": function(result) { <ide> assert.equal(result.selection.attr("color"), "rgb(0,128,0)"); <add> }, <add> "removes an attribute": function(result) { <add> assert.equal(result.selection.attr("display"), ""); <ide> } <ide> };
5
Python
Python
enable umath_test on all platforms
4b7c165bd0448c3ef891af124bc548a413d95c49
<ide><path>numpy/core/tests/test_ufunc.py <ide> <ide> import numpy as np <ide> from numpy.testing import * <del>if not sys.platform == 'win32': <del> import numpy.core.umath_tests as umt <del>else: <del> umt = None <add>import numpy.core.umath_tests as umt <ide> <ide> class TestUfunc(TestCase): <ide> def test_reduceat_shifting_sum(self) :
1
Ruby
Ruby
enable frozen string literals
81db0e9551f213b6ddc94d7bbad1128cc8591a51
<ide><path>Library/Homebrew/dev-cmd/bottle.rb <del># Uses ERB so can't use Frozen String Literals until >=Ruby 2.4: <del># https://bugs.ruby-lang.org/issues/12031 <del># frozen_string_literal: false <add># frozen_string_literal: true <ide> <ide> require "formula" <ide> require "utils/bottles" <ide> require "utils/inreplace" <ide> require "erb" <ide> <del>BOTTLE_ERB = <<-EOS.freeze <add>BOTTLE_ERB = <<-EOS <ide> bottle do <ide> <% if !root_url.start_with?(HOMEBREW_BOTTLE_DEFAULT_DOMAIN) %> <ide> root_url "<%= root_url %>" <ide> module Homebrew <ide> <ide> def bottle_args <ide> Homebrew::CLI::Parser.new do <del> usage_banner <<~EOS.freeze <add> usage_banner <<~EOS <ide> `bottle` [<options>] <formula> <ide> <ide> Generate a bottle (binary package) from a formula that was installed with <ide> def bottle_formula(f) <ide> "#{key}: old: #{old_value}, new: #{value}" <ide> end <ide> <del> odie <<~EOS.freeze <add> odie <<~EOS <ide> --keep-old was passed but there are changes in: <ide> #{mismatches.join("\n")} <ide> EOS <ide> def merge <ide> end <ide> <ide> unless mismatches.empty? <del> odie <<~EOS.freeze <add> odie <<~EOS <ide> --keep-old was passed but there are changes in: <ide> #{mismatches.join("\n")} <ide> EOS <ide><path>Library/Homebrew/dev-cmd/man.rb <del># Uses ERB so can't use Frozen String Literals until >=Ruby 2.4: <del># https://bugs.ruby-lang.org/issues/12031 <del># frozen_string_literal: false <add># frozen_string_literal: true <ide> <ide> require "formula" <ide> require "erb" <ide> module Homebrew <ide> <ide> def man_args <ide> Homebrew::CLI::Parser.new do <del> usage_banner <<~EOS.freeze <add> usage_banner <<~EOS <ide> `man` [<options>] <ide> <ide> Generate Homebrew's manpages.
2
PHP
PHP
fix dispatcher issue
7c75c1321bc4e29bf8c7b11fb2e3b83466549b96
<ide><path>src/Illuminate/Database/Migrations/Migrator.php <ide> <ide> use Illuminate\Support\Arr; <ide> use Illuminate\Support\Str; <add>use Illuminate\Events\Dispatcher; <ide> use Illuminate\Support\Collection; <ide> use Illuminate\Console\OutputStyle; <ide> use Illuminate\Filesystem\Filesystem; <ide> use Illuminate\Database\ConnectionResolverInterface as Resolver; <del>use Illuminate\Events\Dispatcher; <ide> <ide> class Migrator <ide> { <ide> protected function note($message) <ide> * @param \Illuminate\Contracts\Events\Dispatcher $dispatcher <ide> * @return void <ide> */ <del> public static function setEventDispatcher(Dispatcher $dispatcher) <add> public function setEventDispatcher(Dispatcher $dispatcher) <ide> { <ide> static::$dispatcher = $dispatcher; <add> <add> return $this; <ide> } <ide> <ide> /**
1
PHP
PHP
replace newquery() with newmodelquery()
5892daa6e97590ea9a05dfa23b81493c8eaadc1c
<ide><path>src/Illuminate/Database/Eloquent/Model.php <ide> protected function decrement($column, $amount = 1, array $extra = []) <ide> */ <ide> protected function incrementOrDecrement($column, $amount, $extra, $method) <ide> { <del> $query = $this->newQuery(); <add> $query = $this->newModelQuery(); <ide> <ide> if (! $this->exists) { <ide> return $query->{$method}($column, $amount, $extra); <ide><path>src/Illuminate/Database/Eloquent/Relations/BelongsToMany.php <ide> public function touch() <ide> // the related model's timestamps, to make sure these all reflect the changes <ide> // to the parent models. This will help us keep any caching synced up here. <ide> if (count($ids = $this->allRelatedIds()) > 0) { <del> $this->getRelated()->newQuery()->whereIn($key, $ids)->update($columns); <add> $this->getRelated()->newModelQuery()->whereIn($key, $ids)->update($columns); <ide> } <ide> } <ide> <ide><path>src/Illuminate/Database/Eloquent/Relations/Concerns/AsPivot.php <ide> public function delete() <ide> */ <ide> protected function getDeleteQuery() <ide> { <del> return $this->newQuery()->where([ <add> return $this->newModelQuery()->where([ <ide> $this->foreignKey => $this->getOriginal($this->foreignKey, $this->getAttribute($this->foreignKey)), <ide> $this->relatedKey => $this->getOriginal($this->relatedKey, $this->getAttribute($this->relatedKey)), <ide> ]); <ide><path>tests/Database/DatabaseEloquentModelTest.php <ide> public function testReplicateCreatesANewModelInstanceWithSameAttributeValues() <ide> <ide> public function testIncrementOnExistingModelCallsQueryAndSetsAttribute() <ide> { <del> $model = m::mock(EloquentModelStub::class.'[newQuery]'); <add> $model = m::mock(EloquentModelStub::class.'[newModelQuery]'); <ide> $model->exists = true; <ide> $model->id = 1; <ide> $model->syncOriginalAttribute('id'); <ide> $model->foo = 2; <ide> <del> $model->shouldReceive('newQuery')->andReturn($query = m::mock(stdClass::class)); <add> $model->shouldReceive('newModelQuery')->andReturn($query = m::mock(stdClass::class)); <ide> $query->shouldReceive('where')->andReturn($query); <ide> $query->shouldReceive('increment'); <ide> <ide><path>tests/Database/DatabaseEloquentPivotTest.php <ide> public function testKeysCanBeSetProperly() <ide> <ide> public function testDeleteMethodDeletesModelByKeys() <ide> { <del> $pivot = $this->getMockBuilder(Pivot::class)->setMethods(['newQuery'])->getMock(); <add> $pivot = $this->getMockBuilder(Pivot::class)->setMethods(['newModelQuery'])->getMock(); <ide> $pivot->setPivotKeys('foreign', 'other'); <ide> $pivot->foreign = 'foreign.value'; <ide> $pivot->other = 'other.value'; <ide> $query = m::mock(stdClass::class); <ide> $query->shouldReceive('where')->once()->with(['foreign' => 'foreign.value', 'other' => 'other.value'])->andReturn($query); <ide> $query->shouldReceive('delete')->once()->andReturn(true); <del> $pivot->expects($this->once())->method('newQuery')->will($this->returnValue($query)); <add> $pivot->expects($this->once())->method('newModelQuery')->will($this->returnValue($query)); <ide> <ide> $this->assertTrue($pivot->delete()); <ide> }
5
Javascript
Javascript
adjust lifecycle and event handling
88c585b11e82ab9fa8d83f1878543ab293c8f0fa
<ide><path>src/plugins/plugin.legend.js <ide> const getBoxSize = (labelOpts, fontSize) => { <ide> }; <ide> }; <ide> <add>const itemsEqual = (a, b) => a !== null && b !== null && a.datasetIndex === b.datasetIndex && a.index === b.index; <add> <ide> export class Legend extends Element { <ide> <ide> /** <ide> export class Legend extends Element { <ide> */ <ide> _fitRows(titleHeight, fontSize, boxWidth, itemHeight) { <ide> const me = this; <del> const {ctx, maxWidth} = me; <del> const padding = me.options.labels.padding; <add> const {ctx, maxWidth, options: {labels: {padding}}} = me; <ide> const hitboxes = me.legendHitBoxes = []; <ide> // Width of each line of legend boxes. Labels wrap onto multiple lines when there are too many to fit on one <ide> const lineWidths = me.lineWidths = [0]; <add> const lineHeight = itemHeight + padding; <ide> let totalHeight = titleHeight; <ide> <ide> ctx.textAlign = 'left'; <ide> ctx.textBaseline = 'middle'; <ide> <add> let row = -1; <add> let top = -lineHeight; <ide> me.legendItems.forEach((legendItem, i) => { <ide> const itemWidth = boxWidth + (fontSize / 2) + ctx.measureText(legendItem.text).width; <ide> <ide> if (i === 0 || lineWidths[lineWidths.length - 1] + itemWidth + 2 * padding > maxWidth) { <del> totalHeight += itemHeight + padding; <add> totalHeight += lineHeight; <ide> lineWidths[lineWidths.length - (i > 0 ? 0 : 1)] = 0; <add> top += lineHeight; <add> row++; <ide> } <ide> <del> // Store the hitbox width and height here. Final position will be updated in `draw` <del> hitboxes[i] = {left: 0, top: 0, width: itemWidth, height: itemHeight}; <add> hitboxes[i] = {left: 0, top, row, width: itemWidth, height: itemHeight}; <ide> <ide> lineWidths[lineWidths.length - 1] += itemWidth + padding; <del> <ide> }); <add> <ide> return totalHeight; <ide> } <ide> <ide> _fitCols(titleHeight, fontSize, boxWidth, itemHeight) { <ide> const me = this; <del> const {ctx, maxHeight} = me; <del> const padding = me.options.labels.padding; <add> const {ctx, maxHeight, options: {labels: {padding}}} = me; <ide> const hitboxes = me.legendHitBoxes = []; <ide> const columnSizes = me.columnSizes = []; <add> const heightLimit = maxHeight - titleHeight; <add> <ide> let totalWidth = padding; <ide> let currentColWidth = 0; <ide> let currentColHeight = 0; <ide> <del> const heightLimit = maxHeight - titleHeight; <add> let left = 0; <add> let top = 0; <add> let col = 0; <add> <ide> me.legendItems.forEach((legendItem, i) => { <ide> const itemWidth = boxWidth + (fontSize / 2) + ctx.measureText(legendItem.text).width; <ide> <ide> // If too tall, go to new column <ide> if (i > 0 && currentColHeight + fontSize + 2 * padding > heightLimit) { <ide> totalWidth += currentColWidth + padding; <ide> columnSizes.push({width: currentColWidth, height: currentColHeight}); // previous column size <add> left += currentColWidth + padding; <add> col++; <add> top = 0; <ide> currentColWidth = currentColHeight = 0; <ide> } <ide> <ide> export class Legend extends Element { <ide> currentColHeight += fontSize + padding; <ide> <ide> // Store the hitbox width and height here. Final position will be updated in `draw` <del> hitboxes[i] = {left: 0, top: 0, width: itemWidth, height: itemHeight}; <add> hitboxes[i] = {left, top, col, width: itemWidth, height: itemHeight}; <add> top += itemHeight + padding; <ide> }); <ide> <ide> totalWidth += currentColWidth; <ide> export class Legend extends Element { <ide> return totalWidth; <ide> } <ide> <add> adjustHitBoxes() { <add> const me = this; <add> if (!me.options.display) { <add> return; <add> } <add> const titleHeight = me._computeTitleHeight(); <add> const {legendHitBoxes: hitboxes, options: {align, labels: {padding}}} = me; <add> if (this.isHorizontal()) { <add> let row = 0; <add> let left = _alignStartEnd(align, me.left + padding, me.right - me.lineWidths[row]); <add> for (const hitbox of hitboxes) { <add> if (row !== hitbox.row) { <add> row = hitbox.row; <add> left = _alignStartEnd(align, me.left + padding, me.right - me.lineWidths[row]); <add> } <add> hitbox.top += me.top + titleHeight + padding; <add> hitbox.left = left; <add> left += hitbox.width + padding; <add> } <add> } else { <add> let col = 0; <add> let top = _alignStartEnd(align, me.top + titleHeight + padding, me.bottom - me.columnSizes[col].height); <add> for (const hitbox of hitboxes) { <add> if (hitbox.col !== col) { <add> col = hitbox.col; <add> top = _alignStartEnd(align, me.top + titleHeight + padding, me.bottom - me.columnSizes[col].height); <add> } <add> hitbox.top = top; <add> hitbox.left += me.left + padding; <add> top += hitbox.height + padding; <add> } <add> } <add> } <add> <ide> isHorizontal() { <ide> return this.options.position === 'top' || this.options.position === 'bottom'; <ide> } <ide> export class Legend extends Element { <ide> */ <ide> _draw() { <ide> const me = this; <del> const {options: opts, columnSizes, lineWidths, ctx, legendHitBoxes} = me; <add> const {options: opts, columnSizes, lineWidths, ctx} = me; <ide> const {align, labels: labelOpts} = opts; <ide> const defaultColor = defaults.color; <ide> const rtlHelper = getRtlAdapter(opts.rtl, me.left, me.width); <ide> export class Legend extends Element { <ide> <ide> drawLegendBox(realX, y, legendItem); <ide> <del> legendHitBoxes[i].left = rtlHelper.leftForLtr(realX, legendHitBoxes[i].width); <del> legendHitBoxes[i].top = y; <del> <ide> x = _textX(textAlign, x + boxWidth + halfFontSize, me.right); <ide> <ide> // Fill the actual label <ide> export class Legend extends Element { <ide> <ide> if (e.type === 'mousemove') { <ide> const previous = me._hoveredItem; <del> if (previous && previous !== hoveredItem) { <add> const sameItem = itemsEqual(previous, hoveredItem); <add> if (previous && !sameItem) { <ide> call(opts.onLeave, [e, previous, me], me); <ide> } <ide> <ide> me._hoveredItem = hoveredItem; <ide> <del> if (hoveredItem) { <add> if (hoveredItem && !sameItem) { <ide> call(opts.onHover, [e, hoveredItem, me], me); <ide> } <ide> } else if (hoveredItem) { <ide> export default { <ide> // The labels need to be built after datasets are updated to ensure that colors <ide> // and other styling are correct. See https://github.com/chartjs/Chart.js/issues/6968 <ide> afterUpdate(chart) { <del> chart.legend.buildLabels(); <add> const legend = chart.legend; <add> legend.buildLabels(); <add> legend.adjustHitBoxes(); <ide> }, <ide> <ide>
1
Ruby
Ruby
replace loop + delete with array difference
909c2bd59e5e8a99af320f828b2a67ab0ebfb5f7
<ide><path>Library/Homebrew/cmd/--env.rb <ide> def build_env_keys env <ide> <ide> def dump_build_env env <ide> keys = build_env_keys(env) <del> <del> if env["CC"] == env["HOMEBREW_CC"] <del> %w[CC CXX OBJC OBJCXX].each { |key| keys.delete(key) } <del> end <add> keys -= %w[CC CXX OBJC OBJCXX] if env["CC"] == env["HOMEBREW_CC"] <ide> <ide> keys.each do |key| <ide> value = env[key]
1
Text
Text
fix irc link
556dd3b7328afebc2591d49ef5dd54e39c05f23b
<ide><path>README.md <ide> If you need help using or installing Node.js, please use the <ide> * [Website](https://nodejs.org/en/) <ide> * [Contributing to the project](./CONTRIBUTING.md) <ide> * IRC (general questions): [#node.js on chat.freenode.net](https://webchat.freenode.net?channels=node.js&uio=d4) <del>* IRC (node core development): [#node-dev on chat.reenode.net](https://webchat.freenode.net?channels=node-dev&uio=d4) <add>* IRC (node core development): [#node-dev on chat.freenode.net](https://webchat.freenode.net?channels=node-dev&uio=d4) <ide> <ide> ## Release Types <ide>
1
Javascript
Javascript
add mustcall() to test-inspector-contexts
80c170e66fcdbb0ead33cee28129b16a30b33afd
<ide><path>test/sequential/test-inspector-contexts.js <ide> async function testBreakpointHit() { <ide> await pausedPromise; <ide> } <ide> <del>testContextCreatedAndDestroyed().then(testBreakpointHit); <add>testContextCreatedAndDestroyed().then(common.mustCall(testBreakpointHit));
1
Python
Python
pass additional options in task.retry
567e7ed3a785e2c71728daa87cfd5c6b7755026e
<ide><path>celery/app/task.py <ide> def retry(self, args=None, kwargs=None, exc=None, throw=True, <ide> S = self.subtask_from_request( <ide> request, args, kwargs, <ide> countdown=countdown, eta=eta, retries=retries, <add> **options <ide> ) <ide> <ide> if max_retries is not None and retries > max_retries:
1
Javascript
Javascript
fix failing linter tests
2c0ff4b92599e5dc93a50d010afbe8fdfbb59c46
<ide><path>examples/with-redux-code-splitting/containers/about.js <ide> const DEFAULT_STATE = {version: 1} <ide> <ide> const {actionCreator, getState: getAboutState} = namespaceConfig('about', DEFAULT_STATE) <ide> <del>const bumpVersion = actionCreator('bumpVersion', function(state, increment) { <add>const bumpVersion = actionCreator('bumpVersion', function (state, increment) { <ide> return {...state, version: state.version + increment} <ide> }) <ide>
1
Ruby
Ruby
fix shell quote on the release task
70c2bf9d21386731135b69125ef00c8810a22a1c
<ide><path>tasks/release.rb <ide> abort "[ABORTING] `git status` reports a dirty tree. Make sure all changes are committed" <ide> end <ide> <del> unless ENV['SKIP_TAG'] || `git tag | grep '^#{tag}$`.strip.empty? <add> unless ENV['SKIP_TAG'] || `git tag | grep '^#{tag}$'`.strip.empty? <ide> abort "[ABORTING] `git tag` shows that #{tag} already exists. Has this version already\n"\ <ide> " been released? Git tagging can be skipped by setting SKIP_TAG=1" <ide> end
1
PHP
PHP
improve routes command
7b957fb3db4eb4bd54570fd4f51275eddb0deb7c
<ide><path>src/Command/RoutesCommand.php <ide> public function execute(Arguments $args, ConsoleIo $io): ?int <ide> $header[] = 'Defaults'; <ide> } <ide> <add> $routeCollection = Router::routes(); <ide> $output = $duplicateRoutesCounter = []; <ide> <del> foreach (Router::routes() as $route) { <add> foreach ($routeCollection as $route) { <ide> $methods = $route->defaults['_method'] ?? ''; <ide> <ide> $item = [ <ide> public function execute(Arguments $args, ConsoleIo $io): ?int <ide> $duplicateRoutes = []; <ide> <ide> // Check duplicate routes <del> foreach (Router::routes() as $route) { <add> foreach ($routeCollection as $route) { <ide> if ($duplicateRoutesCounter[$route->template] > 1) { <ide> $methods = $route->defaults['_method'] ?? ''; <ide>
1
Python
Python
skip tensorboard test if py3
13df0bf32accd57a7288a29fa09e4badf1d0b780
<ide><path>tests/keras/test_callbacks.py <ide> import pytest <ide> import os <add>import sys <ide> import numpy as np <ide> np.random.seed(1337) <ide> <ide> def test_LearningRateScheduler(): <ide> assert (float(K.get_value(model.optimizer.lr)) - 0.2) < K.epsilon() <ide> <ide> <del>@pytest.mark.skipif(K._BACKEND != 'tensorflow', <add>@pytest.mark.skipif((K._BACKEND != 'tensorflow') or (sys.version_info[0] == 3), <ide> reason="Requires tensorflow backend") <ide> def test_TensorBoard(): <ide> import shutil
1
Javascript
Javascript
improve test case to check correct data
9fa7eba2934730243b27f2f9ef5cb0f1f6227ca1
<ide><path>test/cases/large/big-assets/generate-big-asset-loader.js <ide> /** @type {import("../../../../").RawLoaderDefinition<{ size: string }>} */ <ide> module.exports = function () { <ide> const options = this.getOptions(); <del> return Buffer.alloc(+options.size); <add> return Buffer.alloc(+options.size).fill(0xa5); <ide> }; <ide> module.exports.raw = true; <ide><path>test/cases/large/big-assets/index.js <add>const createHash = require("../../../../lib/util/hash/xxhash64"); <add>const fs = require("fs"); <add> <add>const h = url => { <add> const hash = createHash(); <add> hash.update(fs.readFileSync(url)); <add> return hash.digest("hex"); <add>}; <add> <ide> it("should compile fine", () => { <ide> const a = new URL( <ide> "./generate-big-asset-loader.js?size=100000000!", <ide> it("should compile fine", () => { <ide> "./generate-big-asset-loader.js?size=600000000!", <ide> import.meta.url <ide> ); <add> expect(h(a)).toBe("a7540f59366bb641"); <add> expect(h(b)).toBe("f642344242fa9de4"); <add> expect(h(c)).toBe("255d2b78f94dd585"); <add> expect(h(d)).toBe("c75503096358dd24"); <add> expect(h(e)).toBe("33ba203498301384"); <add> expect(h(f)).toBe("e71a39b9b1138c07"); <ide> });
2
Python
Python
initialize clearcenter connection and driver
0426fe776e9a4671c1d902d21646549f9826b4ac
<ide><path>libcloud/common/clearcenter.py <add>import json <add>import socket <add> <add>from libcloud.utils.py3 import b <add>from libcloud.utils.py3 import httplib <add>from libcloud.compute.base import (Node, NodeDriver, NodeState, <add> KeyPair, NodeLocation, NodeImage) <add>from libcloud.common.types import InvalidCredsError <add>from libcloud.common.base import JsonResponse <add>from libcloud.common.base import ConnectionKey <add> <add> <add> <add>class ClearCenterResponse(JsonResponse): <add> """ <add> ClearCenter response class <add> """ <add> <add> def success(self): <add> """ <add> Determine if our request was successful. <add> <add> The meaning of this can be arbitrary; did we receive OK status? Did <add> the node get created? Were we authenticated? <add> <add> :rtype: ``bool`` <add> :return: ``True`` or ``False`` <add> """ <add> <add> # ClearCenter returns 200 even on a false apikey <add> body = self.parse_body() <add> if "Authentication Required" in body: <add> raise InvalidCredsError("Provided apikey not valid") <add> <add> return self.status in [httplib.OK, httplib.CREATED, httplib.NO_CONTENT] <add> <add> def parse_error(self): <add> <add> if self.status == httplib.UNAUTHORIZED: <add> body = self.parse_body() <add> error = body.get('errors', {}).get('base') <add> if error and isinstance(error, list): <add> error = error[0] <add> raise InvalidCredsError(error) <add> else: <add> body = self.parse_body() <add> if 'message' in body: <add> error = '%s (code: %s)' % (body['message'], self.status) <add> else: <add> error = body <add> raise Exception(error) <add> <add> <add>class ClearCenterConnection(ConnectionKey): <add> """ <add> ClearCenter connection class <add> """ <add> <add> responseCls = ClearCenterResponse <add> <add> def add_default_headers(self, headers): <add> """ <add> Add headers that are necessary for every request <add> <add> This method adds ``apikey`` to the request. <add> """ <add> <add> headers['Authorization'] = 'Bearer %s' % (self.key) <add> return headers <add> <add> # def add_default_params(self, params): <add> # """ <add> # Add the limit param to 500 in order not to paginate <add> # """ <add> # params['limit'] = "500" <add> # return params <ide><path>libcloud/compute/drivers/clearcenter.py <add>import json <add>import socket <add> <add>from libcloud.compute.base import (Node, NodeDriver, NodeState, <add> KeyPair, NodeLocation, NodeImage) <add>from libcloud.common.clearcenter import ClearCenterConnection <add>from libcloud.compute.providers import Provider <add> <add>__all__ = [ <add> "ClearCenterNodeDriver" <add>] <add> <add>class ClearCenterNodeDriver(NodeDriver): <add> """ <add> Base ClearCenter node driver. <add> """ <add> <add> connectionCls = ClearCenterConnection <add> type = Provider.CLEARCENTER <add> name = 'ClearCenter' <add> website = 'https://www.clearcenter.com/' <add> <add> def __init__(self, key=None, host='', verify=True): <add> """ <add> :param key: apikey <add> :param url: api endpoint <add> """ <add> <add> if not key or not host: <add> raise Exception("Key and url not specified") <add> <add> secure = False if host.startswith('http://') else True <add> port = 80 if host.startswith('http://') else 443 <add> <add> # strip the prefix <add> prefixes = ['http://', 'https://'] <add> for prefix in prefixes: <add> if host.startswith(prefix): <add> host = host.replace(prefix, '') <add> import ipdb; ipdb.set_trace() <add> host = host.split('/')[0] <add> <add> super(ClearCenterNodeDriver, self).__init__( <add> key=key, <add> url=host, <add> secure=secure) <add> <add> self.connection.secure = secure <add> <add> self.connection.host = host <add> self.connection.port = port <add> <add> try: <add> socket.setdefaulttimeout(15) <add> so = socket.socket(socket.AF_INET, socket.SOCK_STREAM) <add> so.connect((host, int(port))) <add> so.close() <add> except: <add> raise Exception("Make sure clearcenter host is accessible and port " <add> "%s is open" % port) <add> # do not verify SSL certificate <add> if not verify: <add> self.connection.connection.ca_cert = False <add> <add> def list_nodes(self): <add> """ <add> List all clear center devices <add> <add> :rtype: ``list`` of :class:`ClearCenterNode` <add> """ <add> response = self.connection.request("/virtual_machines.json") <add> nodes = [self._to_node(vm["virtual_machine"]) <add> for vm in response.object] <add> return nodes <ide><path>libcloud/compute/drivers/solusvm.py <ide> def __init__(self, key=None, secret=None, <ide> if not verify: <ide> self.connection.connection.ca_cert = False <ide> <del> def create_node(self, vttype='openvz', user_id=31, nodegroup_id=1, <add> def create_node(self, vttype='op try: <add> response = self.connection.request( <add> "/api/virtual_machines", <add> data=data, <add> headers={ <add> "Content-type": "application/json"}, <add> method="POST") <add> except Exception as exc: <add> raise Exception("Failed to create node: %s" % exc) <add>envz', user_id=31, nodegroup_id=1, <ide> hostname='', vmos='', vmostpl='', diskspace=1, <ide> ram=128, burst=128, ipv4=1, ipv6=0, bandwidth=1, isos=""): <ide> """ <ide><path>libcloud/compute/providers.py <ide> ('libcloud.compute.drivers.oneandone', 'OneAndOneNodeDriver'), <ide> Provider.SOLUSVM: <ide> ('libcloud.compute.drivers.solusvm', 'SolusVMNodeDriver'), <add> Provider.CLEARCENTER: <add> ('libcloud.compute.drivers.clearcenter', 'ClearCenterNodeDriver') <ide> } <ide> <ide> <ide><path>libcloud/compute/types.py <ide> class Provider(Type): <ide> <ide> SOLUSVM = 'solusvm' <ide> <add> CLEARCENTER = "clearcenter" <add> <ide> DEPRECATED_RACKSPACE_PROVIDERS = [Provider.RACKSPACE_UK, <ide> Provider.RACKSPACE_NOVA_BETA, <ide> Provider.RACKSPACE_NOVA_DFW,
5
Python
Python
create keras directories if needed
d9357646e2c2da5c25f79a5850288bb07ec7b417
<ide><path>examples/skipgram_word_embeddings.py <ide> load_tokenizer = False <ide> train_model = True <ide> save_dir = os.path.expanduser("~/.keras/models") <add>if not os.path.exists(save_dir): <add> os.makedirs(save_dir) <ide> model_load_fname = "HN_skipgram_model.pkl" <ide> model_save_fname = "HN_skipgram_model.pkl" <ide> tokenizer_fname = "HN_tokenizer.pkl"
1
Ruby
Ruby
fix redundant version check
b8a62d98e114b1af6f1ce7878aa44fa60635870f
<ide><path>Library/Homebrew/cmd/audit.rb <ide> def audit_specs <ide> else <ide> version_text = s.version unless s.version.detected_from_url? <ide> version_url = Version.parse(s.url) <del> if version_url == version_text <add> if version_url.to_s == version_text.to_s <ide> problem "#{spec} version #{version_text} is redundant with version scanned from URL" <ide> end <ide> end
1
Python
Python
add pron_lemma and det_lemma to deprecated
f68e420bc0b27ddd74ea06a754db7fd8fc277bc3
<ide><path>spacy/deprecated.py <ide> def fix_glove_vectors_loading(overrides): <ide> def match_best_version(target_name, target_version, path): <ide> def split_data_name(name): <ide> return name.split('-', 1) if '-' in name else (name, '') <add>PRON_LEMMA = "-PRON-" <add>DET_LEMMA = "-DET-" <ide> <ide> path = util.ensure_path(path) <ide> if path is None or not path.exists(): <ide><path>spacy/language_data/entity_rules.py <ide> # coding: utf8 <ide> from __future__ import unicode_literals <ide> <del>from ..symbols import * <del>from .util import ENT_ID <add>from ..symbols import ORTH, ENT_TYPE, LOWER <add> <add>ENT_ID = "ent_id" <ide> <ide> <ide> ENTITY_RULES = [ <ide> [{ORTH: "Yea"}], <ide> [{ORTH: "Bah"}] <ide> ] <del> <del> <del>__all__ = ["ENTITY_RULES", "FALSE_POSITIVES"]
2
Text
Text
add toc to api.md
80a0cf85c82a7e28419051cb789c2299c420b8f9
<ide><path>docs/Reference/API.md <ide> var createStore = require('redux').createStore; <ide> var createStore = Redux.createStore; <ide> ``` <ide> <add>#### Table of Contents <add> <add>* [createStore(reducer: Reducer, initialState: any): Store](#createstorereducer-reducer-initialstate-any-store) <add>* [Store API](#store-api) <add> * [getState(): any](#getstate-any) <add> * [dispatch(action: Action | IntermediateAction): any](#dispatchaction-action--intermediateaction-any) <add> * [subscribe(listener: Function): Function](#subscribelistener-function-function) <add> * [getReducer(): Reducer](#getreducer-reducer) <add> * [replaceReducer(nextReducer: Reducer): void](#replacereducernextreducer-reducer-void) <add>* [combineReducers(reducers: Object): Reducer](#combinereducersreducers-object-reducer) <add>* [applyMiddleware(...middlewares: Array<Middleware>): StoreEnhancer](#applymiddlewaremiddlewares-arraymiddleware-storeenhancer) <add>* [bindActionCreators(actionCreators: Object, dispatch: Function): Object](#bindactioncreatorsactioncreators-object-dispatch-function-object) <add>* [compose(...funcs: Array<Function>): Function](#composefuncs-arrayfunction-function) <add> <ide> ===================== <ide> <ide> ### `createStore(reducer: Reducer, initialState: any): Store`
1
Javascript
Javascript
fix links in api docs for several player events.
cc6e82442fcefb3b62a6e33a588d7f0b7152fd3d
<ide><path>src/js/player.js <ide> const TECH_EVENTS_RETRIGGER = [ <ide> /** <ide> * Fires when the browser has loaded the current frame of the audio/video. <ide> * <del> * @event player#loadeddata <add> * @event Player#loadeddata <ide> * @type {event} <ide> */ <ide> /** <ide> const TECH_EVENTS_RETRIGGER = [ <ide> /** <ide> * Fires when the current playback position has changed. <ide> * <del> * @event player#timeupdate <add> * @event Player#timeupdate <ide> * @type {event} <ide> */ <ide> /** <ide> const TECH_EVENTS_RETRIGGER = [ <ide> /** <ide> * Fires when the playing speed of the audio/video is changed <ide> * <del> * @event player#ratechange <add> * @event Player#ratechange <ide> * @type {event} <ide> */ <ide> /** <ide> const TECH_EVENTS_RETRIGGER = [ <ide> /** <ide> * Fires when the volume has been changed <ide> * <del> * @event player#volumechange <add> * @event Player#volumechange <ide> * @type {event} <ide> */ <ide> /** <ide> const TECH_EVENTS_RETRIGGER = [ <ide> /** <ide> * Fires when the text track has been changed <ide> * <del> * @event player#texttrackchange <add> * @event Player#texttrackchange <ide> * @type {event} <ide> */ <ide> /**
1
PHP
PHP
simplify route target parsing
6429e121d85a483fb5ff38aab8c7aacbe96b884e
<ide><path>src/Routing/RouteBuilder.php <ide> protected static function parseDefaults($defaults) <ide> return $defaults; <ide> } <ide> <del> $regex = '/(?:([a-zA-Z0-9\/]*)\.)?([a-zA-Z0-9\/]*?)(?:\/)?([a-zA-Z0-9]*):{2}([a-zA-Z0-9_]*)/i'; <add> $regex = '/(?:(?<plugin>[a-zA-Z0-9\/]*)\.)?(?<prefix>[a-zA-Z0-9\/]*?)' . <add> '(?:\/)?(?<controller>[a-zA-Z0-9]*):{2}(?<action>[a-zA-Z0-9_]*)/i'; <add> <ide> if (preg_match($regex, $defaults, $matches)) { <del> unset($matches[0]); <del> $matches = array_filter($matches, function ($value) { <del> return $value !== '::'; <del> }); <del> // Intentionally incomplete switch <del> switch (count($matches)) { <del> case 2: <del> return [ <del> 'controller' => (isset($matches[3]) ? $matches[3] : null), <del> 'action' => (isset($matches[4]) ? $matches[4] : null) <del> ]; <del> case 3: <del> return [ <del> 'prefix' => (isset($matches[2]) ? strtolower($matches[2]) : null), <del> 'controller' => (isset($matches[3]) ? $matches[3] : null), <del> 'action' => (isset($matches[4]) ? $matches[4] : null) <del> ]; <del> case 4: <del> return [ <del> 'plugin' => (isset($matches[1]) ? $matches[1] : null), <del> 'prefix' => (isset($matches[2]) ? strtolower($matches[2]) : null), <del> 'controller' => (isset($matches[3]) ? $matches[3] : null), <del> 'action' => (isset($matches[4]) ? $matches[4] : null) <del> ]; <add> foreach ($matches as $key => $value) { <add> // Remove numeric keys and empty values. <add> if (is_int($key) || $value === '' || $value === '::') { <add> unset($matches[$key]); <add> } <add> } <add> $length = count($matches); <add> <add> if (isset($matches['prefix'])) { <add> $matches['prefix'] = strtolower($matches['prefix']); <add> } <add> <add> if ($length >= 2 || $length <= 4) { <add> return $matches; <ide> } <ide> } <ide> throw new RuntimeException("Could not parse `{$defaults}` route destination string."); <ide><path>tests/TestCase/Routing/RouteBuilderTest.php <ide> public function testConnectShortString() <ide> $this->assertEquals($url, '/' . $this->collection->match($expected, [])); <ide> } <ide> <add> /** <add> * Test connect() with short string syntax <add> * <add> * @return void <add> */ <add> public function testConnectShortStringPrefix() <add> { <add> $routes = new RouteBuilder($this->collection, '/'); <add> $routes->connect('/admin/bookmarks', 'Admin/Bookmarks::index'); <add> $expected = [ <add> 'pass' => [], <add> 'plugin' => null, <add> 'prefix' => 'admin', <add> 'controller' => 'Bookmarks', <add> 'action' => 'index', <add> '_matchedRoute' => '/admin/bookmarks' <add> ]; <add> $this->assertEquals($expected, $this->collection->parse('/admin/bookmarks')); <add> <add> $url = $expected['_matchedRoute']; <add> unset($expected['_matchedRoute']); <add> $this->assertEquals($url, '/' . $this->collection->match($expected, [])); <add> } <add> <add> /** <add> * Test connect() with short string syntax <add> * <add> * @return void <add> */ <add> public function testConnectShortStringPlugin() <add> { <add> $routes = new RouteBuilder($this->collection, '/'); <add> $routes->connect('/blog/articles/view', 'Blog.Articles::view'); <add> $expected = [ <add> 'pass' => [], <add> 'plugin' => 'Blog', <add> 'controller' => 'Articles', <add> 'action' => 'view', <add> '_matchedRoute' => '/blog/articles/view' <add> ]; <add> $this->assertEquals($expected, $this->collection->parse('/blog/articles/view')); <add> <add> $url = $expected['_matchedRoute']; <add> unset($expected['_matchedRoute']); <add> $this->assertEquals($url, '/' . $this->collection->match($expected, [])); <add> } <add> <ide> /** <ide> * Test connect() with short string syntax <ide> *
2
Javascript
Javascript
fix linting issues
c9cbaf04e796d4bb3152da8c9d123ea85cc276d5
<ide><path>lib/Stats.js <ide> class Stats { <ide> <ide> const optionOrLocalFallback = (v, def) => <ide> typeof v !== "undefined" ? v : <del> typeof options.all !== "undefined" ? options.all : def; <add> typeof options.all !== "undefined" ? options.all : def; <ide> <ide> const testAgainstGivenOption = (item) => { <ide> if(typeof item === "string") { <ide> class Stats { <ide> if(useColors) { <ide> buf.push( <ide> (useColors === true || useColors[color] === undefined) ? <del> defaultColors[color] : useColors[color] <add> defaultColors[color] : useColors[color] <ide> ); <ide> } <ide> buf.push(str); <ide> class Stats { <ide> }; <ide> return obj; <ide> }, { <del> normal: (str) => buf.push(str) <del> }); <add> normal: (str) => buf.push(str) <add> }); <ide> <ide> const coloredTime = (time) => { <ide> let times = [800, 400, 200, 100];
1
Text
Text
add missing newline in changelog
6433ad1eef0613754a97c16a866945b97801963d
<ide><path>CHANGELOG.md <ide> * [[`c380ac6e98`](https://github.com/iojs/io.js/commit/c380ac6e98)] - **doc**: suggest alternatives to deprecated APs (Benjamin Gruenbaum) [#1007](https://github.com/iojs/io.js/pull/1007) <ide> * [[`3d6440cf2a`](https://github.com/iojs/io.js/commit/3d6440cf2a)] - **src**: fix --without-ssl build (Ben Noordhuis) [#1027](https://github.com/iojs/io.js/pull/1027) <ide> * [[`2b47fd2eb6`](https://github.com/iojs/io.js/commit/2b47fd2eb6)] - **stream_base**: `.writev()` has limited support (Fedor Indutny) [#1008](https://github.com/iojs/io.js/pull/1008) <add> <ide> ## 2015-02-28, Version 1.4.2, @rvagg <ide> <ide> ### Notable changes
1
Javascript
Javascript
avoid extra copy for string stdio
ee695e935dfd31c6678ce4e9f2f472a33138530e
<ide><path>lib/child_process.js <ide> exports.execFile = function(file /* args, options, callback */) { <ide> windowsVerbatimArguments: !!options.windowsVerbatimArguments <ide> }); <ide> <del> var _stdout = []; <del> var _stderr = []; <add> var encoding; <add> var _stdout; <add> var _stderr; <add> if (options.encoding !== 'buffer' && Buffer.isEncoding(options.encoding)) { <add> encoding = options.encoding; <add> _stdout = ''; <add> _stderr = ''; <add> } else { <add> _stdout = []; <add> _stderr = []; <add> encoding = null; <add> } <ide> var stdoutLen = 0; <ide> var stderrLen = 0; <ide> var killed = false; <ide> exports.execFile = function(file /* args, options, callback */) { <ide> if (!callback) return; <ide> <ide> // merge chunks <del> var stdout = Buffer.concat(_stdout); <del> var stderr = Buffer.concat(_stderr); <del> <del> if (Buffer.isEncoding(options.encoding)) { <del> // convert to strings <del> stdout = stdout.toString(options.encoding); <del> stderr = stderr.toString(options.encoding); <add> var stdout; <add> var stderr; <add> if (!encoding) { <add> stdout = Buffer.concat(_stdout); <add> stderr = Buffer.concat(_stderr); <add> } else { <add> stdout = _stdout; <add> stderr = _stderr; <ide> } <ide> <ide> if (ex) { <ide> exports.execFile = function(file /* args, options, callback */) { <ide> } <ide> <ide> child.stdout.addListener('data', function(chunk) { <del> _stdout.push(chunk); <ide> stdoutLen += chunk.length; <ide> <ide> if (stdoutLen > options.maxBuffer) { <ide> ex = new Error('stdout maxBuffer exceeded.'); <ide> kill(); <add> } else { <add> if (!encoding) <add> _stdout.push(chunk); <add> else <add> _stdout += chunk; <ide> } <ide> }); <ide> <ide> child.stderr.addListener('data', function(chunk) { <del> _stderr.push(chunk); <ide> stderrLen += chunk.length; <ide> <ide> if (stderrLen > options.maxBuffer) { <ide> ex = new Error('stderr maxBuffer exceeded.'); <ide> kill(); <add> } else { <add> if (!encoding) <add> _stderr.push(chunk); <add> else <add> _stderr += chunk; <ide> } <ide> }); <ide> <add> if (encoding) { <add> child.stderr.setEncoding(encoding); <add> child.stdout.setEncoding(encoding); <add> } <add> <ide> child.addListener('close', exithandler); <ide> child.addListener('error', errorhandler); <ide>
1
Ruby
Ruby
improve style of rebuild fallback
acebeab9cb2f44658384f56ffea9c9dc6d945e90
<ide><path>Library/Homebrew/dev-cmd/bottle.rb <ide> def bottle_formula(f, args:) <ide> else <ide> 0 <ide> end <del> end <add> end || 0 <ide> end <del> # FormulaVersions#formula_at_revision returns nil for new formulae <del> rebuild ||= 0 <ide> <ide> filename = Bottle::Filename.create(f, bottle_tag.to_sym, rebuild) <ide> local_filename = filename.to_s
1
Python
Python
add newlines to long german text
8328925e1f5a976808175aa95ece0c2027cff62c
<ide><path>spacy/tests/de/tokenizer/test_text.py <ide> def test_tokenizer_handles_long_text(de_tokenizer): <ide> text = """Die Verwandlung <ide> <del>Als Gregor Samsa eines Morgens aus unruhigen Träumen erwachte, fand er sich in seinem Bett zu einem ungeheueren Ungeziefer verwandelt. <add>Als Gregor Samsa eines Morgens aus unruhigen Träumen erwachte, fand er sich in <add>seinem Bett zu einem ungeheueren Ungeziefer verwandelt. <ide> <del>Er lag auf seinem panzerartig harten Rücken und sah, wenn er den Kopf ein wenig hob, seinen gewölbten, braunen, von bogenförmigen Versteifungen geteilten Bauch, auf dessen Höhe sich die Bettdecke, zum gänzlichen Niedergleiten bereit, kaum noch erhalten konnte. Seine vielen, im Vergleich zu seinem sonstigen Umfang kläglich dünnen Beine flimmerten ihm hilflos vor den Augen. <add>Er lag auf seinem panzerartig harten Rücken und sah, wenn er den Kopf ein wenig <add>hob, seinen gewölbten, braunen, von bogenförmigen Versteifungen geteilten <add>Bauch, auf dessen Höhe sich die Bettdecke, zum gänzlichen Niedergleiten bereit, <add>kaum noch erhalten konnte. Seine vielen, im Vergleich zu seinem sonstigen <add>Umfang kläglich dünnen Beine flimmerten ihm hilflos vor den Augen. <ide> <ide> »Was ist mit mir geschehen?«, dachte er.""" <ide> <ide> tokens = de_tokenizer(text) <del> assert len(tokens) == 104 <add> assert len(tokens) == 109 <ide> <ide> <ide> @pytest.mark.parametrize('text,length', [
1
Javascript
Javascript
add options arg to environmentplugin, fixes
101ba648fffcbdd088ae97bb3018998cb8ff7f78
<ide><path>lib/EnvironmentPlugin.js <ide> const WebpackError = require("./WebpackError"); <ide> <ide> class EnvironmentPlugin { <ide> constructor(...keys) { <add> this.options = {}; <add> if (keys.length > 1) { <add> const options = keys[keys.length - 1]; <add> if (typeof options === "object") { <add> this.options = options; <add> // remove options object from env keys <add> keys.pop(); <add> } <add> } <add> <ide> if (keys.length === 1 && Array.isArray(keys[0])) { <ide> this.keys = keys[0]; <ide> this.defaultValues = {}; <ide> class EnvironmentPlugin { <ide> ); <ide> <ide> error.name = "EnvVariableNotDefinedError"; <del> compilation.warnings.push(error); <add> if (this.options["errorLevel"] === "error") { <add> compilation.errors.push(error); <add> } else { <add> compilation.warnings.push(error); <add> } <ide> }); <ide> } <ide>
1
Java
Java
make javadocs for reduce() more precise
7db813fad5a5dd9ff7fa73cc109b71fcde9a5890
<ide><path>src/main/java/rx/Observable.java <ide> public final <R> Observable<R> publish(Func1<? super Observable<T>, ? extends Ob <ide> } <ide> <ide> /** <del> * Returns an Observable that applies a function of your choosing to the first item emitted by a source <add> * Returns an Observable that applies a specified accumulator function to the first item emitted by a source <ide> * Observable, then feeds the result of that function along with the second item emitted by the source <ide> * Observable into the same function, and so on until all items have been emitted by the source Observable, <ide> * and emits the final result from the final call to your function as its sole item. <ide> public final Observable<T> reduce(Func2<T, T, T> accumulator) { <ide> } <ide> <ide> /** <del> * Returns an Observable that applies a function of your choosing to the first item emitted by a source <add> * Returns an Observable that applies a specified accumulator function to the first item emitted by a source <ide> * Observable and a specified seed value, then feeds the result of that function along with the second item <ide> * emitted by an Observable into the same function, and so on until all items have been emitted by the <ide> * source Observable, emitting the final result from the final call to your function as its sole item. <ide> public final <R> Observable<R> reduce(R initialValue, Func2<R, ? super T, R> acc <ide> } <ide> <ide> /** <del> * Returns an Observable that applies a function of your choosing to the first item emitted by a source <add> * Returns an Observable that applies a specified accumulator function to the first item emitted by a source <ide> * Observable and a specified seed value, then feeds the result of that function along with the second item <ide> * emitted by an Observable into the same function, and so on until all items have been emitted by the <ide> * source Observable, emitting the final result from the final call to your function as its sole item.
1
Text
Text
specify types of listener parameter
aaca38a26118c9d7d8409fa3a8643149f148641f
<ide><path>doc/api/process.md <ide> process.on('exit', (code) => { <ide> added: v0.5.10 <ide> --> <ide> <del>* `message` {Object} a parsed JSON object or primitive value. <add>* `message` { Object | boolean | number | string | null } a parsed JSON object <add> or a serializable primitive value. <ide> * `sendHandle` {net.Server|net.Socket} a [`net.Server`][] or [`net.Socket`][] <ide> object, or undefined. <ide>
1
Mixed
Ruby
fix acronym support in `humanize`
0ddde0a8fca6a0ca3158e3329713959acd65605d
<ide><path>activesupport/CHANGELOG.md <add>* Fix acronym support in `humanize` <add> <add> Acronym inflections are stored with lowercase keys in the hash but <add> the match wasn't being lowercased before being looked up in the hash. <add> This shouldn't have any performance impact because before it would <add> fail to find the acronym and perform the `downcase` operation anyway. <add> <add> Fixes #31052. <add> <add> *Andrew White* <add> <ide> * Add same method signature for `Time#prev_year` and `Time#next_year` <ide> in accordance with `Date#prev_year`, `Date#next_year`. <ide> <ide><path>activesupport/lib/active_support/inflector/methods.rb <ide> def humanize(lower_case_and_underscored_word, capitalize: true, keep_id_suffix: <ide> result.tr!("_".freeze, " ".freeze) <ide> <ide> result.gsub!(/([a-z\d]*)/i) do |match| <del> "#{inflections.acronyms[match] || match.downcase}" <add> "#{inflections.acronyms[match.downcase] || match.downcase}" <ide> end <ide> <ide> if capitalize <ide><path>activesupport/test/inflector_test.rb <ide> def test_humanize_by_string <ide> assert_equal("Col rpted bugs", ActiveSupport::Inflector.humanize("COL_rpted_bugs")) <ide> end <ide> <add> def test_humanize_with_acronyms <add> ActiveSupport::Inflector.inflections do |inflect| <add> inflect.acronym "LAX" <add> inflect.acronym "SFO" <add> end <add> assert_equal("LAX roundtrip to SFO", ActiveSupport::Inflector.humanize("LAX ROUNDTRIP TO SFO")) <add> assert_equal("LAX roundtrip to SFO", ActiveSupport::Inflector.humanize("LAX ROUNDTRIP TO SFO", capitalize: false)) <add> assert_equal("LAX roundtrip to SFO", ActiveSupport::Inflector.humanize("lax roundtrip to sfo")) <add> assert_equal("LAX roundtrip to SFO", ActiveSupport::Inflector.humanize("lax roundtrip to sfo", capitalize: false)) <add> assert_equal("LAX roundtrip to SFO", ActiveSupport::Inflector.humanize("Lax Roundtrip To Sfo")) <add> assert_equal("LAX roundtrip to SFO", ActiveSupport::Inflector.humanize("Lax Roundtrip To Sfo", capitalize: false)) <add> end <add> <ide> def test_constantize <ide> run_constantize_tests_on do |string| <ide> ActiveSupport::Inflector.constantize(string)
3
Javascript
Javascript
remove obsolete shiv code
53aacb35fa469496c88a04a70ffab875e8b35d86
<ide><path>src/Angular.js <ide> if ('i' !== 'I'.toLowerCase()) { <ide> <ide> function fromCharCode(code) {return String.fromCharCode(code);} <ide> <del>/** <del> * Creates the element for IE8 and below to allow styling of widgets <del> * (http://ejohn.org/blog/html5-shiv/). This hack works only if angular is <del> * included synchronously at the top of the document before IE sees any <del> * unknown elements. See regression/issue-584.html. <del> * <del> * @param {string} elementName Name of the widget. <del> * @returns {string} Lowercased string. <del> */ <del>function shivForIE(elementName) { <del> elementName = lowercase(elementName); <del> if (msie < 9 && elementName.charAt(0) != '@') { // ignore attr-widgets <del> document.createElement(elementName); <del> } <del> return elementName; <del>} <ide> <ide> var $boolean = 'boolean', <ide> $console = 'console',
1
Javascript
Javascript
log version in internal logger
a65ceef370f978e776c2f3356a8baae22369e698
<ide><path>packages/react-devtools-shared/src/registerDevToolsEventLogger.js <ide> export function registerDevToolsEventLogger(surface: string) { <ide> event: event, <ide> context: { <ide> surface, <add> version: process.env.DEVTOOLS_VERSION, <ide> }, <ide> }, <ide> '*',
1
Javascript
Javascript
add existence test for patch and unpatch methods
d21019ad785b49084bc99f1a97cf103f4d75384f
<ide><path>test/unit/media.html5.js <ide> test('should re-link the player if the tech is moved', function(){ <ide> strictEqual(player, tech.el()['player']); <ide> }); <ide> <add>test('patchCanPlayType and unpatchCanPlayType are available on Html5 object', function() { <add> ok(vjs.Html5.patchCanPlayType, 'patchCanPlayType is available'); <add> ok(vjs.Html5.unatchCanPlayType, 'unpatchCanPlayType is available'); <add>}); <add> <ide> test('patchCanPlayType patches canplaytype with our function, conditionally', function() { <ide> var oldAV = vjs.ANDROID_VERSION, <ide> video = document.createElement('video'),
1
Python
Python
remove oustcale_sdk implementation
fea49fe6ef58b62e79b2fa7b16f12f861f0f9957
<ide><path>libcloud/compute/drivers/outscale.py <ide> class OutscaleNodeDriver(NodeDriver): <ide> Outscale SDK node driver <ide> """ <ide> <del> type = Provider.OUTSCALE_SDK <add> type = Provider.OUTSCALE <ide> name = 'Outscale API' <ide> website = 'http://www.outscale.com' <ide> <ide><path>libcloud/compute/drivers/outscale_sdk.py <del># Licensed to the Apache Software Foundation (ASF) under one or more <del># contributor license agreements. See the NOTICE file distributed with <del># this work for additional information regarding copyright ownership. <del># The ASF licenses this file to You under the Apache License, Version 2.0 <del># (the "License"); you may not use this file except in compliance with <del># the License. You may obtain a copy of the License at <del># <del># http://www.apache.org/licenses/LICENSE-2.0 <del># <del># Unless required by applicable law or agreed to in writing, software <del># distributed under the License is distributed on an "AS IS" BASIS, <del># WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <del># See the License for the specific language governing permissions and <del># limitations under the License. <del>""" <del>Outscale SDK <del>""" <del>try: <del> from osc_python_sdk import Gateway <del>except ImportError as ie: <del> has_gateway = False <del>else: <del> has_gateway = True <del> <del>from libcloud.common.base import ConnectionUserAndKey <del>from libcloud.compute.base import NodeDriver <del>from libcloud.compute.types import Provider <del>from libcloud.compute.drivers.ec2 import OUTSCALE_INC_REGION_DETAILS <del> <del>SERVICE_TYPE = 'compute' <del> <del> <del>class OutscaleSDKConnection(ConnectionUserAndKey): <del> """ <del> Outscale SDK connection <del> """ <del> <del> @staticmethod <del> def gtw_connection(self, access_key, secret_key, region='eu-west-2'): <del> """ <del> Set the gateway connection. <del> <del> :param access_key: personnal access key (required) <del> :type access_key: ``str`` <del> <del> :param secret_key: personnal secret key (required) <del> :type secret_key: ``str`` <del> <del> :param region: region <del> :type region: ``str`` <del> <del> :return: request <del> :rtype: ``dict`` <del> """ <del> return Gateway(**{ <del> 'access_key': access_key, <del> 'secret_key': secret_key, <del> 'region': region <del> }) <del> <del> <del>class OutscaleSDKNodeDriver(NodeDriver): <del> """ <del> Outscale SDK node driver <del> """ <del> <del> type = Provider.OUTSCALE_SDK <del> connectionCls = OutscaleSDKConnection <del> name = 'Outscale SDK' <del> website = 'http://www.outscale.com' <del> <del> def __init__(self, key, secret, region='eu-west-2'): <del> global gtw <del> if has_gateway: <del> gtw = OutscaleSDKConnection.gtw_connection(key, secret, region) <del> <del> def list_locations(self): <del> """ <del> Lists available regions details. <del> <del> :return: regions details <del> :rtype: ``dict`` <del> """ <del> return OUTSCALE_INC_REGION_DETAILS <del> <del> def create_public_ip(self): <del> """ <del> Create a new public ip. <del> <del> :return: the created public ip <del> :rtype: ``dict`` <del> """ <del> return gtw.CreatePublicIp() <del> <del> def create_node(self, image_id): <del> """ <del> Create a new instance. <del> <del> :param image_id: the ID of the OMI <del> used to create the VM (required) <del> :type image_id: ``str`` <del> <del> :return: the created instance <del> :rtype: ``dict`` <del> """ <del> return gtw.CreateVms(ImageId=image_id) <del> <del> def reboot_node(self, node_ids): <del> """ <del> Reboot instances. <del> <del> :param node_ids: the ID(s) of the VM(s) <del> you want to reboot (required) <del> :type node_ids: ``list`` <del> <del> :return: the rebooted instances <del> :rtype: ``dict`` <del> """ <del> return gtw.RebootVms(VmIds=node_ids) <del> <del> def list_nodes(self): <del> """ <del> List all nodes. <del> <del> :return: nodes <del> :rtype: ``dict`` <del> """ <del> return gtw.ReadVms() <del> <del> def delete_node(self, node_ids): <del> """ <del> Delete instances. <del> <del> :param node_ids: one or more IDs of VMs (required) <del> :type node_ids: ``list`` <del> <del> :return: request <del> :rtype: ``dict`` <del> """ <del> return gtw.DeleteVms(VmIds=node_ids) <del> <del> def create_image(self, node_id, name, description=''): <del> """ <del> Create a new image. <del> <del> :param node_id: the ID of the VM from which <del> you want to create the OMI (required) <del> :type node_id: ``str`` <del> <del> :param name: a unique name for the new OMI (required) <del> :type name: ``str`` <del> <del> :param description: a description for the new OMI <del> :type description: ``str`` <del> <del> :return: the created image <del> :rtype: ``dict`` <del> """ <del> return gtw.CreateImage( <del> VmId=node_id, <del> ImageName=name, <del> Description=description <del> ) <del> <del> def list_images(self): <del> """ <del> List all images. <del> <del> :return: images <del> :rtype: ``dict`` <del> """ <del> return gtw.ReadImages() <del> <del> def get_image(self, image_id): <del> """ <del> Get a specific image. <del> <del> :param image_id: the ID of the image you want to select (required) <del> :type image_id: ``str`` <del> <del> :return: the selected image <del> :rtype: ``dict`` <del> """ <del> img = None <del> images = gtw.ReadImages() <del> for image in images.get('Images'): <del> if image.get('ImageId') == image_id: <del> img = image <del> return img <del> <del> def delete_image(self, image_id): <del> """ <del> Delete an image. <del> <del> :param image_id: the ID of the OMI you want to delete (required) <del> :type image_id: ``str`` <del> <del> :return: request <del> :rtype: ``dict`` <del> """ <del> return gtw.DeleteImage(ImageId=image_id) <del> <del> def create_key_pair(self, name): <del> """ <del> Create a new key pair. <del> <del> :param node_id: a unique name for the keypair, with a maximum <del> length of 255 ASCII printable characters (required) <del> :type node_id: ``str`` <del> <del> :return: the created key pair <del> :rtype: ``dict`` <del> """ <del> return gtw.CreateKeypair(KeypairName=name) <del> <del> def list_key_pairs(self): <del> """ <del> List all key pairs. <del> <del> :return: key pairs <del> :rtype: ``dict`` <del> """ <del> return gtw.ReadKeypairs() <del> <del> def get_key_pair(self, name): <del> """ <del> Get a specific key pair. <del> <del> :param name: the name of the key pair <del> you want to select (required) <del> :type name: ``str`` <del> <del> :return: the selected key pair <del> :rtype: ``dict`` <del> """ <del> kp = None <del> key_pairs = gtw.ReadKeypairs() <del> for key_pair in key_pairs.get('Keypairs'): <del> if key_pair.get('KeypairName') == name: <del> kp = key_pair <del> return kp <del> <del> def delete_key_pair(self, name): <del> """ <del> Delete an image. <del> <del> :param name: the name of the keypair you want to delete (required) <del> :type name: ``str`` <del> <del> :return: request <del> :rtype: ``dict`` <del> """ <del> return gtw.DeleteKeypair(KeypairName=name) <del> <del> def create_snapshot(self): <del> """ <del> Create a new snapshot. <del> <del> :return: the created snapshot <del> :rtype: ``dict`` <del> """ <del> return gtw.CreateSnapshot() <del> <del> def list_snapshots(self): <del> """ <del> List all snapshots. <del> <del> :return: snapshots <del> :rtype: ``dict`` <del> """ <del> return gtw.ReadSnapshots() <del> <del> def delete_snapshot(self, snapshot_id): <del> """ <del> Delete a snapshot. <del> <del> :param snapshot_id: the ID of the snapshot <del> you want to delete (required) <del> :type snapshot_id: ``str`` <del> <del> :return: request <del> :rtype: ``dict`` <del> """ <del> return gtw.DeleteSnapshot(SnapshotId=snapshot_id) <del> <del> def create_volume( <del> self, snapshot_id, <del> size=1, <del> location='eu-west-2a', <del> volume_type='standard' <del> ): <del> """ <del> Create a new volume. <del> <del> :param snapshot_id: the ID of the snapshot from which <del> you want to create the volume (required) <del> :type snapshot_id: ``str`` <del> <del> :param size: the size of the volume, in gibibytes (GiB), <del> the maximum allowed size for a volume is 14,901 GiB <del> :type size: ``int`` <del> <del> :param location: the Subregion in which <del> you want to create the volume <del> :type location: ``str`` <del> <del> :param volume_type: the type of volume <del> you want to create (io1 | gp2 | standard) <del> :type volume_type: ``str`` <del> <del> :return: the created volume <del> :rtype: ``dict`` <del> """ <del> return gtw.CreateVolume( <del> SnapshotId=snapshot_id, <del> Size=size, <del> SubregionName=location, <del> VolumeType=volume_type <del> ) <del> <del> def list_volumes(self): <del> """ <del> List all volumes. <del> <del> :return: volumes <del> :rtype: ``dict`` <del> """ <del> return gtw.ReadVolumes() <del> <del> def delete_volume(self, volume_id): <del> """ <del> Delete a volume. <del> <del> :param volume_id: the ID of the volume <del> you want to delete (required) <del> :type volume_id: ``str`` <del> <del> :return: request <del> :rtype: ``dict`` <del> """ <del> return gtw.DeleteVolume(VolumeId=volume_id) <del> <del> def attach_volume(self, node_id, volume_id, device): <del> """ <del> Attach a volume. <del> <del> :param node_id: the ID of the VM you want <del> to attach the volume to (required) <del> :type node_id: ``str`` <del> <del> :param volume_id: the ID of the volume <del> you want to attach (required) <del> :type volume_id: ``str`` <del> <del> :param device: the name of the device (required) <del> :type device: ``str`` <del> <del> :return: the attached volume <del> :rtype: ``dict`` <del> """ <del> return gtw.LinkVolume( <del> VmId=node_id, <del> VolumeId=volume_id, <del> DeviceName=device <del> ) <del> <del> def detach_volume(self, volume_id, force=False): <del> """ <del> Detach a volume. <del> <del> :param volume_id: the ID of the volume <del> you want to detach (required) <del> :type volume_id: ``str`` <del> <del> :param force: forces the detachment of <del> the volume in case of previous failure <del> :type force: ``str`` <del> <del> :return: the attached volume <del> :rtype: ``dict`` <del> """ <del> return gtw.UnlinkVolume(VolumeId=volume_id, ForceUnlink=force) <ide><path>libcloud/compute/providers.py <ide> ('libcloud.compute.drivers.ec2', 'OutscaleSASNodeDriver'), <ide> Provider.OUTSCALE_INC: <ide> ('libcloud.compute.drivers.ec2', 'OutscaleINCNodeDriver'), <del> Provider.OUTSCALE_SDK: <del> ('libcloud.compute.drivers.outscale_sdk', 'OutscaleSDKNodeDriver'), <ide> Provider.OUTSCALE: <ide> ('libcloud.compute.drivers.outscale', 'OutscaleNodeDriver'), <ide> Provider.PROFIT_BRICKS: <ide><path>libcloud/compute/types.py <ide> class Provider(Type): <ide> OPSOURCE = 'opsource' <ide> OUTSCALE_INC = 'outscale_inc' <ide> OUTSCALE_SAS = 'outscale_sas' <del> OUTSCALE_SDK = 'outscale_sdk' <ide> OUTSCALE = 'outscale' <ide> OVH = 'ovh' <ide> PACKET = 'packet' <ide><path>libcloud/test/common/test_osc.py <ide> from libcloud.compute.providers import Provider <ide> from libcloud.compute.providers import get_driver <ide> <del>import logging <del> <ide> <ide> class EC2MockDriver(object): <ide> region_name = 'eu-west-2' <ide> def test_public_ips(self): <ide> def test_images(self): <ide> response = self.driver.create_image(image_name="test_libcloud2", vm_id="i-dab9397e") <ide> self.assertEqual(response.status_code, 200) <del> logging.warning(response.json()) <ide> image_id = response.json()["Image"]["ImageId"] <ide> <ide> response = self.driver.get_image(image_id) <ide><path>libcloud/test/test_osc.py <del># Licensed to the Apache Software Foundation (ASF) under one or more <del># contributor license agreements. See the NOTICE file distributed with <del># this work for additional information regarding copyright ownership. <del># The ASF licenses this file to You under the Apache License, Version 2.0 <del># (the "License"); you may not use this file except in compliance with <del># the License. You may obtain a copy of the License at <del># <del># http://www.apache.org/licenses/LICENSE-2.0 <del># <del># Unless required by applicable law or agreed to in writing, software <del># distributed under the License is distributed on an "AS IS" BASIS, <del># WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <del># See the License for the specific language governing permissions and <del># limitations under the License. <del>""" <del>Outscale SDK <del>""" <del>try: <del> from libcloud.common.osc import <del>except ImportError as ie: <del> has_gateway = False <del>else: <del> has_gateway = True <del> <del>from libcloud.common.base import ConnectionUserAndKey <del>from libcloud.compute.base import NodeDriver <del>from libcloud.compute.types import Provider <del>from libcloud.compute.drivers.ec2 import OUTSCALE_INC_REGION_DETAILS <del> <del>SERVICE_TYPE = 'compute' <del> <del> <del>class OutscaleSDKConnection(ConnectionUserAndKey): <del> """ <del> Outscale SDK connection <del> """ <del> <del> @staticmethod <del> def gtw_connection(self, access_key, secret_key, region='eu-west-2'): <del> """ <del> Set the gateway connection. <del> <del> :param access_key: personnal access key (required) <del> :type access_key: ``str`` <del> <del> :param secret_key: personnal secret key (required) <del> :type secret_key: ``str`` <del> <del> :param region: region <del> :type region: ``str`` <del> <del> :return: request <del> :rtype: ``dict`` <del> """ <del> return Gateway(**{ <del> 'access_key': access_key, <del> 'secret_key': secret_key, <del> 'region': region <del> }) <del> <del> <del>class OutscaleSDKNodeDriver(NodeDriver): <del> """ <del> Outscale SDK node driver <del> """ <del> <del> type = Provider.OUTSCALE_SDK <del> connectionCls = OutscaleSDKConnection <del> name = 'Outscale SDK' <del> website = 'http://www.outscale.com' <del> <del> def __init__(self, key, secret, region='eu-west-2'): <del> global gtw <del> if has_gateway: <del> gtw = OutscaleSDKConnection.gtw_connection(key, secret, region) <del> <del> def list_locations(self): <del> """ <del> Lists available regions details. <del> <del> :return: regions details <del> :rtype: ``dict`` <del> """ <del> return OUTSCALE_INC_REGION_DETAILS <del> <del> def create_public_ip(self): <del> """ <del> Create a new public ip. <del> <del> :return: the created public ip <del> :rtype: ``dict`` <del> """ <del> return gtw.CreatePublicIp() <del> <del> def create_node(self, image_id): <del> """ <del> Create a new instance. <del> <del> :param image_id: the ID of the OMI <del> used to create the VM (required) <del> :type image_id: ``str`` <del> <del> :return: the created instance <del> :rtype: ``dict`` <del> """ <del> return gtw.CreateVms(ImageId=image_id) <del> <del> def reboot_node(self, node_ids): <del> """ <del> Reboot instances. <del> <del> :param node_ids: the ID(s) of the VM(s) <del> you want to reboot (required) <del> :type node_ids: ``list`` <del> <del> :return: the rebooted instances <del> :rtype: ``dict`` <del> """ <del> return gtw.RebootVms(VmIds=node_ids) <del> <del> def list_nodes(self): <del> """ <del> List all nodes. <del> <del> :return: nodes <del> :rtype: ``dict`` <del> """ <del> return gtw.ReadVms() <del> <del> def delete_node(self, node_ids): <del> """ <del> Delete instances. <del> <del> :param node_ids: one or more IDs of VMs (required) <del> :type node_ids: ``list`` <del> <del> :return: request <del> :rtype: ``dict`` <del> """ <del> return gtw.DeleteVms(VmIds=node_ids) <del> <del> def create_image(self, node_id, name, description=''): <del> """ <del> Create a new image. <del> <del> :param node_id: the ID of the VM from which <del> you want to create the OMI (required) <del> :type node_id: ``str`` <del> <del> :param name: a unique name for the new OMI (required) <del> :type name: ``str`` <del> <del> :param description: a description for the new OMI <del> :type description: ``str`` <del> <del> :return: the created image <del> :rtype: ``dict`` <del> """ <del> return gtw.CreateImage( <del> VmId=node_id, <del> ImageName=name, <del> Description=description <del> ) <del> <del> def list_images(self): <del> """ <del> List all images. <del> <del> :return: images <del> :rtype: ``dict`` <del> """ <del> return gtw.ReadImages() <del> <del> def get_image(self, image_id): <del> """ <del> Get a specific image. <del> <del> :param image_id: the ID of the image you want to select (required) <del> :type image_id: ``str`` <del> <del> :return: the selected image <del> :rtype: ``dict`` <del> """ <del> img = None <del> images = gtw.ReadImages() <del> for image in images.get('Images'): <del> if image.get('ImageId') == image_id: <del> img = image <del> return img <del> <del> def delete_image(self, image_id): <del> """ <del> Delete an image. <del> <del> :param image_id: the ID of the OMI you want to delete (required) <del> :type image_id: ``str`` <del> <del> :return: request <del> :rtype: ``dict`` <del> """ <del> return gtw.DeleteImage(ImageId=image_id) <del> <del> def create_key_pair(self, name): <del> """ <del> Create a new key pair. <del> <del> :param node_id: a unique name for the keypair, with a maximum <del> length of 255 ASCII printable characters (required) <del> :type node_id: ``str`` <del> <del> :return: the created key pair <del> :rtype: ``dict`` <del> """ <del> return gtw.CreateKeypair(KeypairName=name) <del> <del> def list_key_pairs(self): <del> """ <del> List all key pairs. <del> <del> :return: key pairs <del> :rtype: ``dict`` <del> """ <del> return gtw.ReadKeypairs() <del> <del> def get_key_pair(self, name): <del> """ <del> Get a specific key pair. <del> <del> :param name: the name of the key pair <del> you want to select (required) <del> :type name: ``str`` <del> <del> :return: the selected key pair <del> :rtype: ``dict`` <del> """ <del> kp = None <del> key_pairs = gtw.ReadKeypairs() <del> for key_pair in key_pairs.get('Keypairs'): <del> if key_pair.get('KeypairName') == name: <del> kp = key_pair <del> return kp <del> <del> def delete_key_pair(self, name): <del> """ <del> Delete an image. <del> <del> :param name: the name of the keypair you want to delete (required) <del> :type name: ``str`` <del> <del> :return: request <del> :rtype: ``dict`` <del> """ <del> return gtw.DeleteKeypair(KeypairName=name) <del> <del> def create_snapshot(self): <del> """ <del> Create a new snapshot. <del> <del> :return: the created snapshot <del> :rtype: ``dict`` <del> """ <del> return gtw.CreateSnapshot() <del> <del> def list_snapshots(self): <del> """ <del> List all snapshots. <del> <del> :return: snapshots <del> :rtype: ``dict`` <del> """ <del> return gtw.ReadSnapshots() <del> <del> def delete_snapshot(self, snapshot_id): <del> """ <del> Delete a snapshot. <del> <del> :param snapshot_id: the ID of the snapshot <del> you want to delete (required) <del> :type snapshot_id: ``str`` <del> <del> :return: request <del> :rtype: ``dict`` <del> """ <del> return gtw.DeleteSnapshot(SnapshotId=snapshot_id) <del> <del> def create_volume( <del> self, snapshot_id, <del> size=1, <del> location='eu-west-2a', <del> volume_type='standard' <del> ): <del> """ <del> Create a new volume. <del> <del> :param snapshot_id: the ID of the snapshot from which <del> you want to create the volume (required) <del> :type snapshot_id: ``str`` <del> <del> :param size: the size of the volume, in gibibytes (GiB), <del> the maximum allowed size for a volume is 14,901 GiB <del> :type size: ``int`` <del> <del> :param location: the Subregion in which <del> you want to create the volume <del> :type location: ``str`` <del> <del> :param volume_type: the type of volume <del> you want to create (io1 | gp2 | standard) <del> :type volume_type: ``str`` <del> <del> :return: the created volume <del> :rtype: ``dict`` <del> """ <del> return gtw.CreateVolume( <del> SnapshotId=snapshot_id, <del> Size=size, <del> SubregionName=location, <del> VolumeType=volume_type <del> ) <del> <del> def list_volumes(self): <del> """ <del> List all volumes. <del> <del> :return: volumes <del> :rtype: ``dict`` <del> """ <del> return gtw.ReadVolumes() <del> <del> def delete_volume(self, volume_id): <del> """ <del> Delete a volume. <del> <del> :param volume_id: the ID of the volume <del> you want to delete (required) <del> :type volume_id: ``str`` <del> <del> :return: request <del> :rtype: ``dict`` <del> """ <del> return gtw.DeleteVolume(VolumeId=volume_id) <del> <del> def attach_volume(self, node_id, volume_id, device): <del> """ <del> Attach a volume. <del> <del> :param node_id: the ID of the VM you want <del> to attach the volume to (required) <del> :type node_id: ``str`` <del> <del> :param volume_id: the ID of the volume <del> you want to attach (required) <del> :type volume_id: ``str`` <del> <del> :param device: the name of the device (required) <del> :type device: ``str`` <del> <del> :return: the attached volume <del> :rtype: ``dict`` <del> """ <del> return gtw.LinkVolume( <del> VmId=node_id, <del> VolumeId=volume_id, <del> DeviceName=device <del> ) <del> <del> def detach_volume(self, volume_id, force=False): <del> """ <del> Detach a volume. <del> <del> :param volume_id: the ID of the volume <del> you want to detach (required) <del> :type volume_id: ``str`` <del> <del> :param force: forces the detachment of <del> the volume in case of previous failure <del> :type force: ``str`` <del> <del> :return: the attached volume <del> :rtype: ``dict`` <del> """ <del> return gtw.UnlinkVolume(VolumeId=volume_id, ForceUnlink=force) <ide><path>libcloud/test/test_outscale_sdk.py <del># Licensed to the Apache Software Foundation (ASF) under one or more <del># contributor license agreements. See the NOTICE file distributed with <del># this work for additional information regarding copyright ownership. <del># The ASF licenses this file to You under the Apache License, Version 2.0 <del># (the "License"); you may not use this file except in compliance with <del># the License. You may obtain a copy of the License at <del># <del># http://www.apache.org/licenses/LICENSE-2.0 <del># <del># Unless required by applicable law or agreed to in writing, software <del># distributed under the License is distributed on an "AS IS" BASIS, <del># WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <del># See the License for the specific language governing permissions and <del># limitations under the License. <del>""" <del>Outscale SDK <del>""" <del>try: <del> from osc_python_sdk import Gateway <del>except ImportError as ie: <del> has_gateway = False <del>else: <del> has_gateway = True <del> <del>from libcloud.common.base import ConnectionUserAndKey <del>from libcloud.compute.base import NodeDriver <del>from libcloud.compute.types import Provider <del>from libcloud.compute.drivers.ec2 import OUTSCALE_INC_REGION_DETAILS <del> <del>SERVICE_TYPE = 'compute' <del> <del> <del>class OutscaleSDKConnection(ConnectionUserAndKey): <del> """ <del> Outscale SDK connection <del> """ <del> <del> @staticmethod <del> def gtw_connection(self, access_key, secret_key, region='eu-west-2'): <del> """ <del> Set the gateway connection. <del> <del> :param access_key: personnal access key (required) <del> :type access_key: ``str`` <del> <del> :param secret_key: personnal secret key (required) <del> :type secret_key: ``str`` <del> <del> :param region: region <del> :type region: ``str`` <del> <del> :return: request <del> :rtype: ``dict`` <del> """ <del> return Gateway(**{ <del> 'access_key': access_key, <del> 'secret_key': secret_key, <del> 'region': region <del> }) <del> <del> <del>class OutscaleSDKNodeDriver(NodeDriver): <del> """ <del> Outscale SDK node driver <del> """ <del> <del> type = Provider.OUTSCALE_SDK <del> connectionCls = OutscaleSDKConnection <del> name = 'Outscale SDK' <del> website = 'http://www.outscale.com' <del> <del> def __init__(self, key, secret, region='eu-west-2'): <del> global gtw <del> if has_gateway: <del> gtw = OutscaleSDKConnection.gtw_connection(key, secret, region) <del> <del> def list_locations(self): <del> """ <del> Lists available regions details. <del> <del> :return: regions details <del> :rtype: ``dict`` <del> """ <del> return OUTSCALE_INC_REGION_DETAILS <del> <del> def create_public_ip(self): <del> """ <del> Create a new public ip. <del> <del> :return: the created public ip <del> :rtype: ``dict`` <del> """ <del> return gtw.CreatePublicIp() <del> <del> def create_node(self, image_id): <del> """ <del> Create a new instance. <del> <del> :param image_id: the ID of the OMI <del> used to create the VM (required) <del> :type image_id: ``str`` <del> <del> :return: the created instance <del> :rtype: ``dict`` <del> """ <del> return gtw.CreateVms(ImageId=image_id) <del> <del> def reboot_node(self, node_ids): <del> """ <del> Reboot instances. <del> <del> :param node_ids: the ID(s) of the VM(s) <del> you want to reboot (required) <del> :type node_ids: ``list`` <del> <del> :return: the rebooted instances <del> :rtype: ``dict`` <del> """ <del> return gtw.RebootVms(VmIds=node_ids) <del> <del> def list_nodes(self): <del> """ <del> List all nodes. <del> <del> :return: nodes <del> :rtype: ``dict`` <del> """ <del> return gtw.ReadVms() <del> <del> def delete_node(self, node_ids): <del> """ <del> Delete instances. <del> <del> :param node_ids: one or more IDs of VMs (required) <del> :type node_ids: ``list`` <del> <del> :return: request <del> :rtype: ``dict`` <del> """ <del> return gtw.DeleteVms(VmIds=node_ids) <del> <del> def create_image(self, node_id, name, description=''): <del> """ <del> Create a new image. <del> <del> :param node_id: the ID of the VM from which <del> you want to create the OMI (required) <del> :type node_id: ``str`` <del> <del> :param name: a unique name for the new OMI (required) <del> :type name: ``str`` <del> <del> :param description: a description for the new OMI <del> :type description: ``str`` <del> <del> :return: the created image <del> :rtype: ``dict`` <del> """ <del> return gtw.CreateImage( <del> VmId=node_id, <del> ImageName=name, <del> Description=description <del> ) <del> <del> def list_images(self): <del> """ <del> List all images. <del> <del> :return: images <del> :rtype: ``dict`` <del> """ <del> return gtw.ReadImages() <del> <del> def get_image(self, image_id): <del> """ <del> Get a specific image. <del> <del> :param image_id: the ID of the image you want to select (required) <del> :type image_id: ``str`` <del> <del> :return: the selected image <del> :rtype: ``dict`` <del> """ <del> img = None <del> images = gtw.ReadImages() <del> for image in images.get('Images'): <del> if image.get('ImageId') == image_id: <del> img = image <del> return img <del> <del> def delete_image(self, image_id): <del> """ <del> Delete an image. <del> <del> :param image_id: the ID of the OMI you want to delete (required) <del> :type image_id: ``str`` <del> <del> :return: request <del> :rtype: ``dict`` <del> """ <del> return gtw.DeleteImage(ImageId=image_id) <del> <del> def create_key_pair(self, name): <del> """ <del> Create a new key pair. <del> <del> :param node_id: a unique name for the keypair, with a maximum <del> length of 255 ASCII printable characters (required) <del> :type node_id: ``str`` <del> <del> :return: the created key pair <del> :rtype: ``dict`` <del> """ <del> return gtw.CreateKeypair(KeypairName=name) <del> <del> def list_key_pairs(self): <del> """ <del> List all key pairs. <del> <del> :return: key pairs <del> :rtype: ``dict`` <del> """ <del> return gtw.ReadKeypairs() <del> <del> def get_key_pair(self, name): <del> """ <del> Get a specific key pair. <del> <del> :param name: the name of the key pair <del> you want to select (required) <del> :type name: ``str`` <del> <del> :return: the selected key pair <del> :rtype: ``dict`` <del> """ <del> kp = None <del> key_pairs = gtw.ReadKeypairs() <del> for key_pair in key_pairs.get('Keypairs'): <del> if key_pair.get('KeypairName') == name: <del> kp = key_pair <del> return kp <del> <del> def delete_key_pair(self, name): <del> """ <del> Delete an image. <del> <del> :param name: the name of the keypair you want to delete (required) <del> :type name: ``str`` <del> <del> :return: request <del> :rtype: ``dict`` <del> """ <del> return gtw.DeleteKeypair(KeypairName=name) <del> <del> def create_snapshot(self): <del> """ <del> Create a new snapshot. <del> <del> :return: the created snapshot <del> :rtype: ``dict`` <del> """ <del> return gtw.CreateSnapshot() <del> <del> def list_snapshots(self): <del> """ <del> List all snapshots. <del> <del> :return: snapshots <del> :rtype: ``dict`` <del> """ <del> return gtw.ReadSnapshots() <del> <del> def delete_snapshot(self, snapshot_id): <del> """ <del> Delete a snapshot. <del> <del> :param snapshot_id: the ID of the snapshot <del> you want to delete (required) <del> :type snapshot_id: ``str`` <del> <del> :return: request <del> :rtype: ``dict`` <del> """ <del> return gtw.DeleteSnapshot(SnapshotId=snapshot_id) <del> <del> def create_volume( <del> self, snapshot_id, <del> size=1, <del> location='eu-west-2a', <del> volume_type='standard' <del> ): <del> """ <del> Create a new volume. <del> <del> :param snapshot_id: the ID of the snapshot from which <del> you want to create the volume (required) <del> :type snapshot_id: ``str`` <del> <del> :param size: the size of the volume, in gibibytes (GiB), <del> the maximum allowed size for a volume is 14,901 GiB <del> :type size: ``int`` <del> <del> :param location: the Subregion in which <del> you want to create the volume <del> :type location: ``str`` <del> <del> :param volume_type: the type of volume <del> you want to create (io1 | gp2 | standard) <del> :type volume_type: ``str`` <del> <del> :return: the created volume <del> :rtype: ``dict`` <del> """ <del> return gtw.CreateVolume( <del> SnapshotId=snapshot_id, <del> Size=size, <del> SubregionName=location, <del> VolumeType=volume_type <del> ) <del> <del> def list_volumes(self): <del> """ <del> List all volumes. <del> <del> :return: volumes <del> :rtype: ``dict`` <del> """ <del> return gtw.ReadVolumes() <del> <del> def delete_volume(self, volume_id): <del> """ <del> Delete a volume. <del> <del> :param volume_id: the ID of the volume <del> you want to delete (required) <del> :type volume_id: ``str`` <del> <del> :return: request <del> :rtype: ``dict`` <del> """ <del> return gtw.DeleteVolume(VolumeId=volume_id) <del> <del> def attach_volume(self, node_id, volume_id, device): <del> """ <del> Attach a volume. <del> <del> :param node_id: the ID of the VM you want <del> to attach the volume to (required) <del> :type node_id: ``str`` <del> <del> :param volume_id: the ID of the volume <del> you want to attach (required) <del> :type volume_id: ``str`` <del> <del> :param device: the name of the device (required) <del> :type device: ``str`` <del> <del> :return: the attached volume <del> :rtype: ``dict`` <del> """ <del> return gtw.LinkVolume( <del> VmId=node_id, <del> VolumeId=volume_id, <del> DeviceName=device <del> ) <del> <del> def detach_volume(self, volume_id, force=False): <del> """ <del> Detach a volume. <del> <del> :param volume_id: the ID of the volume <del> you want to detach (required) <del> :type volume_id: ``str`` <del> <del> :param force: forces the detachment of <del> the volume in case of previous failure <del> :type force: ``str`` <del> <del> :return: the attached volume <del> :rtype: ``dict`` <del> """ <del> return gtw.UnlinkVolume(VolumeId=volume_id, ForceUnlink=force)
7
Javascript
Javascript
fail build on deep requires in npm packages
7b84dbd1697609d4df5931422c9591fe62022cb9
<ide><path>scripts/rollup/build.js <ide> async function createBundle(bundle, bundleType) { <ide> const containsThisModule = pkg => id === pkg || id.startsWith(pkg + '/'); <ide> const isProvidedByDependency = externals.some(containsThisModule); <ide> if (!shouldBundleDependencies && isProvidedByDependency) { <add> if (id.indexOf('/src/') !== -1) { <add> throw Error( <add> 'You are trying to import ' + <add> id + <add> ' but ' + <add> externals.find(containsThisModule) + <add> ' is one of npm dependencies, ' + <add> 'so it will not contain that source file. You probably want ' + <add> 'to create a new bundle entry point for it instead.' <add> ); <add> } <ide> return true; <ide> } <ide> return !!peerGlobals[id];
1
Text
Text
add devops guides
920209cb2323e0bb81c32a27fc0c0d5f0e252974
<ide><path>README.md <ide> Please don't create GitHub issues for security issues. Instead, please send an e <ide> <ide> > ### [Please follow these steps to contribute.](CONTRIBUTING.md) <ide> <del>#### Build Status: <add>### Platform, Build and Deployment Status <ide> <del>| Platform | Type | Status | <del>| :-------------- | :--------- | :---------: | <del>| Travis CI | Unit Tests | [![Travis CI Build Status](https://travis-ci.org/freeCodeCamp/freeCodeCamp.svg?branch=master)](https://travis-ci.org/freeCodeCamp/freeCodeCamp) | <del>| Azure Pipelines | Artifacts | [![Azure Pipelines Build Status](https://dev.azure.com/freeCodeCamp-org/freeCodeCamp/_apis/build/status/freeCodeCamp-CI)](https://dev.azure.com/freeCodeCamp-org/freeCodeCamp/_build) | <del> <del>#### Deployment Status: <del> <del>| Application | Version | Status | <del>| :----------- | :--------- | :---------: | <del>| Client | Beta/Next | [![Azure Pipelines Deployment Status](https://vsrm.dev.azure.com/freeCodeCamp-org/_apis/public/Release/badge/4b80aded-11d9-49ea-9b7d-596e98ff07c4/4/8)](https://dev.azure.com/freeCodeCamp-org/freeCodeCamp/_release) | <del>| API | Beta/Next | [![Azure Pipelines Deployment Status](https://vsrm.dev.azure.com/freeCodeCamp-org/_apis/public/Release/badge/4b80aded-11d9-49ea-9b7d-596e98ff07c4/4/9)](https://dev.azure.com/freeCodeCamp-org/freeCodeCamp/_release) | <del>| Client | Production | [![Azure Pipelines Deployment Status](https://vsrm.dev.azure.com/freeCodeCamp-org/_apis/public/Release/badge/4b80aded-11d9-49ea-9b7d-596e98ff07c4/4/12)](https://dev.azure.com/freeCodeCamp-org/freeCodeCamp/_release) | <del>| API | Production | [![Azure Pipelines Deployment Status](https://vsrm.dev.azure.com/freeCodeCamp-org/_apis/public/Release/badge/4b80aded-11d9-49ea-9b7d-596e98ff07c4/4/11)](https://dev.azure.com/freeCodeCamp-org/freeCodeCamp/_release) | <add>The build and deployment status for the code is available in [our DevOps Guide](/docs/devops.md). The general platform status for all our applications is available at [`status.freecodecamp.org`](https://status.freecodecamp.org) <ide> <ide> ### License <ide> <ide><path>docs/README.md <ide> Hello 👋! <ide> <ide> This directory contains all of the documentation on contributing to freeCodeCamp.org <ide> <del>## [If you are getting started, start by reading this first.](/CONTRIBUTING.md) <del> <del>--- <add>> ### [If you are getting started, start by reading this first.](/CONTRIBUTING.md) <ide> <ide> ## Quick references articles <ide> <ide> <a href="/docs/how-to-work-on-guide-articles.md">1. How to work on Guide articles.</a><br> <ide> <a href="/docs/how-to-work-on-coding-challenges.md">2. How to work on Coding Challenges.</a><br> <ide> <a href="/docs/how-to-setup-freecodecamp-locally.md">3. How to setup freeCodeCamp locally.</a><br> <ide> <a href="/docs/how-to-catch-outgoing-emails-locally.md">4. How to catch outgoing emails locally.</a> <add><a href="/docs/devops.md">5. DevOps Guide for Core Team.</a> <ide> <ide> ## Style guides <ide> <ide><path>docs/devops.md <add># DevOps Guide <add> <add>> ### :warning: THIS GUIDE IS NOT LIVE YET. :warning: <add>> The processes described here will come to effect in the upcoming version of freeCodeCamp.org. <add>> Some parts of the guide are applicable on the beta application. <add> <add>## Developer Operations at freeCodeCamp.org <add> <add>We continuously deploy our current `master`, the default development branch on a **separate isolated environment**. <add> <add>Typically, the `master` branch is merged into the `production-staging` branch once a day and released into an isolated infrastructure. This is known as our "staging / beta" application. It is identical to our live production environment at `freeCodeCamp.org`, other than it using a separate set of databases. This isolation lets us test ongoing development and features in a "production like" scenario, without affecting regular users of freeCodeCamp.org's platforms. Once the developer teams are satisified with the changes on the staging application, these changes are moved every few days to the `production-current` branch. This branch as the name suggests is what you would see live on `freeCodeCamp.org`. <add> <add>We welcome you to test these releases in a **"public beta testing"** mode and get early access to upcoming features to the platforms. Sometimes these features/changes are referred as **next, beta, staging,** etc. interchangeably. <add> <add>Your contributions via feedback and issue reports will help us in making the production platforms at `freeCodeCamp.org` more **resilient**, **consistent** and **stable** for everyone. <add> <add>We thank you for reporting bugs that you encounter and help in making freeCodeCamp.org better. You rock! <add> <add>## Identifying the upcoming version of freeCodeCamp <add> <add>The domain name will be different than **`freeCodeCamp.org`**. Currently this public beta testing version is available at: <add> <add><h3 align="center"><a href='https://www.freecodecamp.dev' _target='blank'><code>www.freecodecamp.dev</code></a></h4> <add> <add>## Build and Deployment Status <add> <add>Usually the dev team will merge the changes from the master branch to special branch called `production-staging` (`beta/staging site`) when they deploy. Usually the top commit should be what you see live on the site. <add> <add>We use Azure Pipelines and other CI software (Travis, GitHub Actions), to continiously test and deploy our applications. <add> <add>### Build Status <add> <add>| Platform | Type | Status | <add>| :-------------- | :--------- | :---------: | <add>| Travis CI | Unit Tests | [![Travis CI Build Status](https://travis-ci.org/freeCodeCamp/freeCodeCamp.svg?branch=master)](https://travis-ci.org/freeCodeCamp/freeCodeCamp) | <add>| Azure Pipelines | Artifacts | [![Azure Pipelines Build Status](https://dev.azure.com/freeCodeCamp-org/freeCodeCamp/_apis/build/status/freeCodeCamp-CI)](https://dev.azure.com/freeCodeCamp-org/freeCodeCamp/_build) | <add> <add>### Deployment Status <add> <add>| Application | Version | Status | <add>| :----------- | :--------- | :---------: | <add>| Client | Beta/Next | [![Azure Pipelines Deployment Status](https://vsrm.dev.azure.com/freeCodeCamp-org/_apis/public/Release/badge/4b80aded-11d9-49ea-9b7d-596e98ff07c4/4/8)](https://dev.azure.com/freeCodeCamp-org/freeCodeCamp/_release) | <add>| API | Beta/Next | [![Azure Pipelines Deployment Status](https://vsrm.dev.azure.com/freeCodeCamp-org/_apis/public/Release/badge/4b80aded-11d9-49ea-9b7d-596e98ff07c4/4/9)](https://dev.azure.com/freeCodeCamp-org/freeCodeCamp/_release) | <add>| Client | Production | [![Azure Pipelines Deployment Status](https://vsrm.dev.azure.com/freeCodeCamp-org/_apis/public/Release/badge/4b80aded-11d9-49ea-9b7d-596e98ff07c4/4/12)](https://dev.azure.com/freeCodeCamp-org/freeCodeCamp/_release) | <add>| API | Production | [![Azure Pipelines Deployment Status](https://vsrm.dev.azure.com/freeCodeCamp-org/_apis/public/Release/badge/4b80aded-11d9-49ea-9b7d-596e98ff07c4/4/11)](https://dev.azure.com/freeCodeCamp-org/freeCodeCamp/_release) | <add> <add>## Known Limitations <add> <add>There will be some known limitations and tradeoffs when using this beta version of freeCodeCamp. <add> <add>- #### All data / personal progress on these beta applications `will NOT be saved or carried over` to production. <add> **Users on the beta version will have a separate account from the production.** The beta version uses a physically separate database from production. This gives us the ability to prevent any accidental loss of data or modifications. The dev team may purge the database on this beta version as needed. <add> <add>- #### There are no guarantees on the uptime and reliability of the beta applications. <add> Deployment is expected to be frequent and in rapid iterations, sometimes multiple times a day. As a result there will be unexpected downtime at times or broken functionality on the beta version. The dev team will usually notify for updates in the [Contributors Chat room](https://gitter.im/FreeCodeCamp/Contributors). <add> <add>- #### Do not send regular users to this site as a measure of confirming a fix <add> <add> The beta site is and always has been to augment local development and testing, nothing else. It's not a promise of what’s coming, but a glimpse of what is being worked upon. <add> <add>- #### Sign in and authentication only available via email, not social. <add> Google, GitHub and Facebook logins will NOT be available in this beta mode. This is simply a technical limitation, because we are using a separate `test domain` for this version. **Email logins will work just as fine.** <add> <add> The sign page may look different than production (as a measure to isolate the development and the production databases.) <add> <add>## Reporting issues and leaving feedback <add> <add>Please open fresh issues for discussions and reporting bugs. You can label them as **[`release: next/beta`](https://github.com/freeCodeCamp/freeCodeCamp/labels/release%3A%20next%2Fbeta)** for triage. <add> <add>## ToDo: Add guidelines <add> <add>- [ ] Checking and getting access to development logs and other resources <add>- [ ] Merging master into production-staging via fast forward <add>- [ ] ...
3
Javascript
Javascript
correct variable reference in error message
935c1018da05dbf3124b2dd33619c4a3c82d7a2a
<ide><path>src/directive/ngRepeat.js <ide> var ngRepeatDirective = ngDirective({ <ide> } <ide> lhs = match[1]; <ide> rhs = match[2]; <del> match = lhs.match(/^([\$\w]+)|\(([\$\w]+)\s*,\s*([\$\w]+)\)$/); <add> match = lhs.match(/^(?:([\$\w]+)|\(([\$\w]+)\s*,\s*([\$\w]+)\))$/); <ide> if (!match) { <ide> throw Error("'item' in 'item in collection' should be identifier or (key, value) but got '" + <del> keyValue + "'."); <add> lhs + "'."); <ide> } <ide> valueIdent = match[3] || match[1]; <ide> keyIdent = match[2]; <ide><path>test/directive/ngRepeatSpec.js <ide> describe('ng-repeat', function() { <ide> })); <ide> <ide> <del> it('should error on wrong parsing of ng-repeat', inject(function($rootScope, $compile, $log) { <add> it('should error on wrong parsing of ng-repeat', inject(function($rootScope, $compile) { <ide> expect(function() { <ide> element = $compile('<ul><li ng-repeat="i dont parse"></li></ul>')($rootScope); <ide> }).toThrow("Expected ng-repeat in form of '_item_ in _collection_' but got 'i dont parse'."); <add> })); <add> <ide> <del> $log.error.logs.shift(); <add> it("should throw error when left-hand-side of ng-repeat can't be parsed", inject( <add> function($rootScope, $compile) { <add> expect(function() { <add> element = $compile('<ul><li ng-repeat="i dont parse in foo"></li></ul>')($rootScope); <add> }).toThrow("'item' in 'item in collection' should be identifier or (key, value) but got " + <add> "'i dont parse'."); <ide> })); <ide> <ide>
2
Javascript
Javascript
replace callback with arrow functions
c90b51427503fe409f38da18a4966926cbe62564
<ide><path>test/pummel/test-net-throttle.js <ide> const body = 'C'.repeat(N); <ide> <ide> console.log(`start server on port ${common.PORT}`); <ide> <del>const server = net.createServer(function(connection) { <add>const server = net.createServer((connection) => { <ide> connection.write(body.slice(0, part_N)); <ide> connection.write(body.slice(part_N, 2 * part_N)); <ide> assert.strictEqual(connection.write(body.slice(2 * part_N, N)), false); <ide> const server = net.createServer(function(connection) { <ide> connection.end(); <ide> }); <ide> <del>server.listen(common.PORT, function() { <add>server.listen(common.PORT, () => { <ide> let paused = false; <ide> const client = net.createConnection(common.PORT); <ide> client.setEncoding('ascii'); <del> client.on('data', function(d) { <add> client.on('data', (d) => { <ide> chars_recved += d.length; <ide> console.log(`got ${chars_recved}`); <ide> if (!paused) { <ide> server.listen(common.PORT, function() { <ide> paused = true; <ide> console.log('pause'); <ide> const x = chars_recved; <del> setTimeout(function() { <add> setTimeout(() => { <ide> assert.strictEqual(chars_recved, x); <ide> client.resume(); <ide> console.log('resume'); <ide> server.listen(common.PORT, function() { <ide> } <ide> }); <ide> <del> client.on('end', function() { <add> client.on('end', () => { <ide> server.close(); <ide> client.end(); <ide> }); <ide> }); <ide> <ide> <del>process.on('exit', function() { <add>process.on('exit', () => { <ide> assert.strictEqual(chars_recved, N); <ide> assert.strictEqual(npauses > 2, true); <ide> });
1
Python
Python
enforce field_name != source
fb1546ee50953faae8af505a0c90da00ac08ad92
<ide><path>rest_framework/fields.py <ide> def bind(self, field_name, parent, root): <ide> """ <ide> Setup the context for the field instance. <ide> """ <add> <add> # In order to enforce a consistent style, we error if a redundant <add> # 'source' argument has been used. For example: <add> # my_field = serializer.CharField(source='my_field') <add> assert self._kwargs.get('source') != field_name, ( <add> "It is redundant to specify `source='%s'` on field '%s' in " <add> "serializer '%s', as it is the same the field name. " <add> "Remove the `source` keyword argument." % <add> (field_name, self.__class__.__name__, parent.__class__.__name__) <add> ) <add> <ide> self.field_name = field_name <ide> self.parent = parent <ide> self.root = root <ide><path>tests/test_fields.py <ide> from decimal import Decimal <ide> from django.utils import timezone <del>from rest_framework import fields <add>from rest_framework import fields, serializers <ide> import datetime <ide> import django <ide> import pytest <ide> def test_default(self): <ide> output = field.run_validation() <ide> assert output is 123 <ide> <add> def test_redundant_source(self): <add> class ExampleSerializer(serializers.Serializer): <add> example_field = serializers.CharField(source='example_field') <add> with pytest.raises(AssertionError) as exc_info: <add> ExampleSerializer() <add> assert str(exc_info.value) == ( <add> "It is redundant to specify `source='example_field'` on field " <add> "'CharField' in serializer 'ExampleSerializer', as it is the " <add> "same the field name. Remove the `source` keyword argument." <add> ) <add> <ide> <ide> # Tests for field input and output values. <ide> # ----------------------------------------
2
Python
Python
fix systemsmanagerparameterstorebackend test
dc738cde04d91084bf79b1a601395b7abd41d8ca
<ide><path>tests/secrets/test_secrets.py <ide> def test_initialize_secrets_backends(self): <ide> ) <ide> def test_backends_kwargs(self): <ide> backends = initialize_secrets_backends() <del> systems_manager = [ <add> systems_manager = next( <ide> backend <ide> for backend in backends <ide> if backend.__class__.__name__ == 'SystemsManagerParameterStoreBackend' <del> ][0] <del> <del> assert systems_manager.kwargs == {'use_ssl': False} <add> ) <add> assert systems_manager.kwargs == {} <add> assert systems_manager.use_ssl is False <ide> <ide> @conf_vars( <ide> {
1
Ruby
Ruby
remove fileutils_methods constant
7fffccba05f8f31d86ae81ee14b81f8ff0c633b5
<ide><path>Library/Homebrew/dev-cmd/audit.rb <ide> class FormulaAuditor <ide> swig <ide> ].freeze <ide> <del> FILEUTILS_METHODS = FileUtils.singleton_methods(false).map { |m| Regexp.escape(m) }.join "|" <del> <ide> def initialize(formula, options = {}) <ide> @formula = formula <ide> @new_formula = options[:new_formula]
1
Go
Go
move serveapi to api/api.go
9eea7f28f0c64d43ef2a9987999a29774fa1476b
<ide><path>api/api.go <ide> const ( <ide> <ide> type HttpApiFunc func(eng *engine.Engine, version float64, w http.ResponseWriter, r *http.Request, vars map[string]string) error <ide> <add>func init() { <add> engine.Register("serveapi", ServeApi) <add>} <add> <ide> func hijackServer(w http.ResponseWriter) (io.ReadCloser, io.Writer, error) { <ide> conn, _, err := w.(http.Hijacker).Hijack() <ide> if err != nil { <ide> func ListenAndServe(proto, addr string, eng *engine.Engine, logging, enableCors <ide> httpSrv := http.Server{Addr: addr, Handler: r} <ide> return httpSrv.Serve(l) <ide> } <add> <add>// ServeApi loops through all of the protocols sent in to docker and spawns <add>// off a go routine to setup a serving http.Server for each. <add>func ServeApi(job *engine.Job) engine.Status { <add> protoAddrs := job.Args <add> chErrors := make(chan error, len(protoAddrs)) <add> <add> for _, protoAddr := range protoAddrs { <add> protoAddrParts := strings.SplitN(protoAddr, "://", 2) <add> go func() { <add> log.Printf("Listening for HTTP on %s (%s)\n", protoAddrParts[0], protoAddrParts[1]) <add> chErrors <- ListenAndServe(protoAddrParts[0], protoAddrParts[1], job.Eng, job.GetenvBool("Logging"), job.GetenvBool("EnableCors"), job.Getenv("Version")) <add> }() <add> } <add> <add> for i := 0; i < len(protoAddrs); i += 1 { <add> err := <-chErrors <add> if err != nil { <add> return job.Error(err) <add> } <add> } <add> <add> // Tell the init daemon we are accepting requests <add> go systemd.SdNotify("READY=1") <add> <add> return engine.StatusOK <add>} <ide><path>docker/docker.go <ide> func main() { <ide> log.Fatal(err) <ide> } <ide> // Load plugin: httpapi <del> job := eng.Job("initapi") <add> job := eng.Job("initserver") <ide> job.Setenv("Pidfile", *pidfile) <ide> job.Setenv("Root", *flRoot) <ide> job.SetenvBool("AutoRestart", *flAutoRestart) <ide> func main() { <ide> job = eng.Job("serveapi", flHosts.GetAll()...) <ide> job.SetenvBool("Logging", true) <ide> job.SetenvBool("EnableCors", *flEnableCors) <add> job.Setenv("Version", VERSION) <ide> if err := job.Run(); err != nil { <ide> log.Fatal(err) <ide> } <ide><path>integration/runtime_test.go <ide> func setupBaseImage() { <ide> if err != nil { <ide> log.Fatalf("Can't initialize engine at %s: %s", unitTestStoreBase, err) <ide> } <del> job := eng.Job("initapi") <add> job := eng.Job("initserver") <ide> job.Setenv("Root", unitTestStoreBase) <ide> job.SetenvBool("Autorestart", false) <ide> job.Setenv("BridgeIface", unitTestNetworkBridge) <ide> func TestRestore(t *testing.T) { <ide> if err != nil { <ide> t.Fatal(err) <ide> } <del> job := eng.Job("initapi") <add> job := eng.Job("initserver") <ide> job.Setenv("Root", eng.Root()) <ide> job.SetenvBool("Autorestart", false) <ide> if err := job.Run(); err != nil { <ide> func TestRestore(t *testing.T) { <ide> } <ide> <ide> func TestReloadContainerLinks(t *testing.T) { <del> // FIXME: here we don't use NewTestEngine because it calls initapi with Autorestart=false, <add> // FIXME: here we don't use NewTestEngine because it calls initserver with Autorestart=false, <ide> // and we want to set it to true. <ide> root, err := newTestDirectory(unitTestStoreBase) <ide> if err != nil { <ide> func TestReloadContainerLinks(t *testing.T) { <ide> if err != nil { <ide> t.Fatal(err) <ide> } <del> job := eng.Job("initapi") <add> job := eng.Job("initserver") <ide> job.Setenv("Root", eng.Root()) <ide> job.SetenvBool("Autorestart", true) <ide> if err := job.Run(); err != nil { <ide> func TestReloadContainerLinks(t *testing.T) { <ide> if err != nil { <ide> t.Fatal(err) <ide> } <del> job = eng.Job("initapi") <add> job = eng.Job("initserver") <ide> job.Setenv("Root", eng.Root()) <ide> job.SetenvBool("Autorestart", false) <ide> if err := job.Run(); err != nil { <ide><path>integration/server_test.go <ide> func TestRestartKillWait(t *testing.T) { <ide> t.Fatal(err) <ide> } <ide> <del> job = eng.Job("initapi") <add> job = eng.Job("initserver") <ide> job.Setenv("Root", eng.Root()) <ide> job.SetenvBool("AutoRestart", false) <ide> // TestGetEnabledCors and TestOptionsRoute require EnableCors=true <ide><path>integration/utils_test.go <ide> func NewTestEngine(t utils.Fataler) *engine.Engine { <ide> } <ide> // Load default plugins <ide> // (This is manually copied and modified from main() until we have a more generic plugin system) <del> job := eng.Job("initapi") <add> job := eng.Job("initserver") <ide> job.Setenv("Root", root) <ide> job.SetenvBool("AutoRestart", false) <ide> // TestGetEnabledCors and TestOptionsRoute require EnableCors=true <ide><path>server.go <ide> import ( <ide> "encoding/json" <ide> "errors" <ide> "fmt" <del> "github.com/dotcloud/docker/api" <ide> "github.com/dotcloud/docker/archive" <ide> "github.com/dotcloud/docker/auth" <ide> "github.com/dotcloud/docker/engine" <ide> "github.com/dotcloud/docker/pkg/graphdb" <del> "github.com/dotcloud/docker/pkg/systemd" <ide> "github.com/dotcloud/docker/registry" <ide> "github.com/dotcloud/docker/utils" <ide> "io" <ide> func (srv *Server) Close() error { <ide> } <ide> <ide> func init() { <del> engine.Register("initapi", jobInitApi) <add> engine.Register("initserver", jobInitServer) <ide> } <ide> <ide> // jobInitApi runs the remote api server `srv` as a daemon, <ide> // Only one api server can run at the same time - this is enforced by a pidfile. <ide> // The signals SIGINT, SIGQUIT and SIGTERM are intercepted for cleanup. <del>func jobInitApi(job *engine.Job) engine.Status { <add>func jobInitServer(job *engine.Job) engine.Status { <ide> job.Logf("Creating server") <ide> srv, err := NewServer(job.Eng, DaemonConfigFromJob(job)) <ide> if err != nil { <ide> func jobInitApi(job *engine.Job) engine.Status { <ide> "restart": srv.ContainerRestart, <ide> "start": srv.ContainerStart, <ide> "kill": srv.ContainerKill, <del> "serveapi": srv.ListenAndServe, <ide> "wait": srv.ContainerWait, <ide> "tag": srv.ImageTag, <ide> "resize": srv.ContainerResize, <ide> func jobInitApi(job *engine.Job) engine.Status { <ide> return engine.StatusOK <ide> } <ide> <del>// ListenAndServe loops through all of the protocols sent in to docker and spawns <del>// off a go routine to setup a serving http.Server for each. <del>func (srv *Server) ListenAndServe(job *engine.Job) engine.Status { <del> protoAddrs := job.Args <del> chErrors := make(chan error, len(protoAddrs)) <del> <del> for _, protoAddr := range protoAddrs { <del> protoAddrParts := strings.SplitN(protoAddr, "://", 2) <del> go func() { <del> log.Printf("Listening for HTTP on %s (%s)\n", protoAddrParts[0], protoAddrParts[1]) <del> chErrors <- api.ListenAndServe(protoAddrParts[0], protoAddrParts[1], srv.Eng, job.GetenvBool("Logging"), job.GetenvBool("EnableCors"), VERSION) <del> }() <del> } <del> <del> for i := 0; i < len(protoAddrs); i += 1 { <del> err := <-chErrors <del> if err != nil { <del> return job.Error(err) <del> } <del> } <del> <del> // Tell the init daemon we are accepting requests <del> go systemd.SdNotify("READY=1") <del> <del> return engine.StatusOK <del>} <del> <ide> // simpleVersionInfo is a simple implementation of <ide> // the interface VersionInfo, which is used <ide> // to provide version information for some product,
6
Text
Text
add build badge for azure pipelines
a71c4003c71059cbc500b7e90689f8264dce29c3
<ide><path>README.md <ide> [![deps][deps]][deps-url] <ide> [![tests][tests]][tests-url] <ide> [![builds][builds]][builds-url] <add>[![builds2][builds2]][builds2-url] <ide> [![coverage][cover]][cover-url] <ide> [![licenses][licenses]][licenses-url] <ide> <ide> src="https://static.monei.net/monei-logo.svg" height="30" alt="MONEI"></a> <ide> [builds-url]: https://ci.appveyor.com/project/sokra/webpack/branch/master <ide> [builds]: https://ci.appveyor.com/api/projects/status/github/webpack/webpack?svg=true <ide> <add>[builds2]: https://dev.azure.com/webpack/webpack/_apis/build/status/webpack.webpack <add>[builds2-url]: https://dev.azure.com/webpack/webpack/_build/latest?definitionId=3 <add> <ide> [licenses-url]: https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fwebpack%2Fwebpack?ref=badge_shield <ide> [licenses]: https://app.fossa.io/api/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fwebpack%2Fwebpack.svg?type=shield <ide>
1
Javascript
Javascript
fix flicker in animations
397be502f92abf14e97c247763d41d690561907a
<ide><path>src/fx/fx.js <ide> jQuery.extend({ <ide> // Store display property <ide> var oldDisplay = jQuery.css(elem, "display"); <ide> <del> // Set display property to block for animation <del> y.display = "block"; <del> <ide> // Make sure that nothing sneaks out <ide> y.overflow = "hidden"; <ide> <ide> jQuery.extend({ <ide> jQuery.attr(y, "opacity", z.now); // Let attr handle opacity <ide> else if ( parseInt(z.now) ) // My hate for IE will never die <ide> y[prop] = parseInt(z.now) + "px"; <add> <add> y.display = "block"; // Set display property to block for animation <ide> }; <ide> <ide> // Figure out the maximum number to run to
1
Python
Python
fix dict sorting in code generator
d3cf1d88350f2817b653df405e000eb7e4ee1b8b
<ide><path>numpy/core/code_generators/genapi.py <ide> md5new = md5.new <ide> if sys.version_info[:2] < (2, 6): <ide> from sets import Set as set <add>import textwrap <ide> <ide> from os.path import join <ide> <ide> def internal_define(self): <ide> def order_dict(d): <ide> """Order dict by its values.""" <ide> o = d.items() <del> def cmp(x, y): <del> return x[1] - y[1] <del> return sorted(o, cmp=cmp) <add> def _key(x): <add> return (x[1], x[0]) <add> return sorted(o, key=_key) <ide> <ide> def merge_api_dicts(dicts): <ide> ret = {} <ide><path>numpy/core/code_generators/generate_umath.py <ide> def make_arrays(funcdict): <ide> # <ide> code1list = [] <ide> code2list = [] <del> names = funcdict.keys() <add> names = list(funcdict.keys()) <ide> names.sort() <ide> for name in names: <ide> uf = funcdict[name] <ide> def make_arrays(funcdict): <ide> <ide> def make_ufuncs(funcdict): <ide> code3list = [] <del> names = funcdict.keys() <add> names = list(funcdict.keys()) <ide> names.sort() <ide> for name in names: <ide> uf = funcdict[name]
2
Ruby
Ruby
remove unused journey code
84826b4ea6cdb63f5e338aefd0574c048a35762d
<ide><path>actionpack/lib/action_dispatch/journey/backwards.rb <del>module Rack # :nodoc: <del> Mount = ActionDispatch::Journey::Router <del> Mount::RouteSet = ActionDispatch::Journey::Router <del> Mount::RegexpWithNamedGroups = ActionDispatch::Journey::Path::Pattern <del>end <ide><path>actionpack/lib/action_dispatch/journey/router.rb <ide> class Router # :nodoc: <ide> class RoutingError < ::StandardError # :nodoc: <ide> end <ide> <del> # :nodoc: <del> VERSION = '2.0.0' <del> <ide> attr_accessor :routes <ide> <ide> def initialize(routes)
2
Java
Java
replace indexed loop with for-each java5 syntax
5278124db4a93b8f59cee4e3baa9e864601637fd
<ide><path>src/main/java/io/reactivex/internal/operators/parallel/ParallelJoin.java <ide> public void cancel() { <ide> } <ide> <ide> void cancelAll() { <del> for (int i = 0; i < subscribers.length; i++) { <del> JoinInnerSubscriber<T> s = subscribers[i]; <add> for (JoinInnerSubscriber<T> s : subscribers) { <ide> s.cancel(); <ide> } <ide> } <ide> <ide> void cleanup() { <del> for (int i = 0; i < subscribers.length; i++) { <del> JoinInnerSubscriber<T> s = subscribers[i]; <add> for (JoinInnerSubscriber<T> s : subscribers) { <ide> s.queue = null; <ide> } <ide> }
1
Ruby
Ruby
remove duplicated class test. copy/paste fail?
c8db1adc0d33228882d8d35d706a3744f7c3d958
<ide><path>actionpack/test/activerecord/render_partial_with_record_identification_test.rb <ide> def test_rendering_partial_with_has_one_association <ide> end <ide> end <ide> <del>class RenderPartialWithRecordIdentificationController < ActionController::Base <del> def render_with_has_many_and_belongs_to_association <del> @developer = Developer.find(1) <del> render :partial => @developer.projects <del> end <del> <del> def render_with_has_many_association <del> @topic = Topic.find(1) <del> render :partial => @topic.replies <del> end <del> <del> def render_with_has_many_through_association <del> @developer = Developer.find(:first) <del> render :partial => @developer.topics <del> end <del> <del> def render_with_belongs_to_association <del> @reply = Reply.find(1) <del> render :partial => @reply.topic <del> end <del> <del> def render_with_record <del> @developer = Developer.find(:first) <del> render :partial => @developer <del> end <del> <del> def render_with_record_collection <del> @developers = Developer.find(:all) <del> render :partial => @developers <del> end <del>end <del> <ide> class Game < Struct.new(:name, :id) <ide> extend ActiveModel::Naming <ide> include ActiveModel::Conversion
1
Text
Text
remove stability from unreleased errors
21005c3b4402241166d4a0ae6a9cc1b26cbba480
<ide><path>doc/api/errors.md <ide> releases. <ide> <a id="ERR_ENTRY_TYPE_MISMATCH"></a> <ide> #### `ERR_ENTRY_TYPE_MISMATCH` <ide> <del>> Stability: 1 - Experimental <del> <ide> The `--entry-type=commonjs` flag was used to attempt to execute an `.mjs` file <ide> or a `.js` file where the nearest parent `package.json` contains <ide> `"type": "module"`; or <ide> while trying to read and parse it. <ide> <a id="ERR_INVALID_REPL_TYPE"></a> <ide> #### `ERR_INVALID_REPL_TYPE` <ide> <del>> Stability: 1 - Experimental <del> <ide> The `--entry-type=...` flag is not compatible with the Node.js REPL. <ide> <ide> <a id="ERR_FEATURE_UNAVAILABLE_ON_PLATFORM"></a>
1
Ruby
Ruby
replace middleware with executor callback
23b6a9c0fcb8992e18450d6fe0680bf09685b7db
<ide><path>actionview/lib/action_view/digestor.rb <ide> module ActionView <ide> class Digestor <ide> @@digest_mutex = Mutex.new <ide> <del> class PerRequestDigestCacheExpiry < Struct.new(:app) # :nodoc: <del> def call(env) <del> ActionView::LookupContext::DetailsKey.clear <del> app.call(env) <del> end <del> end <del> <ide> class << self <ide> # Supported options: <ide> # <ide><path>actionview/lib/action_view/railtie.rb <ide> class Railtie < Rails::Railtie # :nodoc: <ide> initializer "action_view.per_request_digest_cache" do |app| <ide> ActiveSupport.on_load(:action_view) do <ide> if app.config.consider_all_requests_local <del> app.middleware.use ActionView::Digestor::PerRequestDigestCacheExpiry <add> app.executor.to_run { ActionView::LookupContext::DetailsKey.clear } <ide> end <ide> end <ide> end
2
PHP
PHP
fix variable naming
57f81da98383f767268d5841e7c770ac8c2fb1b2
<ide><path>lib/Cake/Error/ExceptionRenderer.php <ide> public function __construct(Exception $exception) { <ide> } <ide> } <ide> <del> $isDebug = (Configure::read('debug') == 0); <del> if ($isDebug && $method == '_cakeError') { <add> $isNotDebug = (Configure::read('debug') == 0); <add> if ($isNotDebug && $method == '_cakeError') { <ide> $method = 'error400'; <ide> } <del> if ($isDebug && $code == 500) { <add> if ($isNotDebug && $code == 500) { <ide> $method = 'error500'; <ide> } <ide> $this->template = $template;
1
Javascript
Javascript
introduce routing service
7cff945c04bf66b0c621b6b70042c51d8a5b2cdf
<ide><path>packages/ember-routing-htmlbars/tests/helpers/link-to_test.js <ide> import EmberView from "ember-views/views/view"; <ide> import compile from "ember-template-compiler/system/compile"; <ide> import { set } from "ember-metal/property_set"; <ide> import Controller from "ember-runtime/controllers/controller"; <add>import { Registry } from "ember-runtime/system/container"; <ide> import { runAppend, runDestroy } from "ember-runtime/tests/utils"; <add>import EmberObject from "ember-runtime/system/object"; <ide> <ide> var view; <add>var container; <add>var registry = new Registry(); <add> <add>// These tests don't rely on the routing service, but LinkView makes <add>// some assumptions that it will exist. This small stub service ensures <add>// that the LinkView can render without raising an exception. <add>// <add>// TODO: Add tests that test actual behavior. Currently, all behavior <add>// is tested integration-style in the `ember` package. <add>registry.register('service:-routing', EmberObject.extend({ <add> availableRoutes: function() { return ['index']; }, <add> hasRoute: function(name) { return name === 'index'; }, <add> isActiveForRoute: function() { return true; }, <add> generateURL: function() { return "/"; } <add>})); <ide> <ide> QUnit.module("ember-routing-htmlbars: link-to helper", { <add> setup() { <add> container = registry.container(); <add> }, <add> <ide> teardown() { <ide> runDestroy(view); <ide> } <ide> QUnit.module("ember-routing-htmlbars: link-to helper", { <ide> QUnit.test("should be able to be inserted in DOM when the router is not present", function() { <ide> var template = "{{#link-to 'index'}}Go to Index{{/link-to}}"; <ide> view = EmberView.create({ <del> template: compile(template) <add> template: compile(template), <add> container: container <ide> }); <ide> <ide> runAppend(view); <ide> QUnit.test("re-renders when title changes", function() { <ide> title: 'foo', <ide> routeName: 'index' <ide> }, <del> template: compile(template) <add> template: compile(template), <add> container: container <ide> }); <ide> <ide> runAppend(view); <ide> QUnit.test("can read bound title", function() { <ide> title: 'foo', <ide> routeName: 'index' <ide> }, <del> template: compile(template) <add> template: compile(template), <add> container: container <ide> }); <ide> <ide> runAppend(view); <ide> QUnit.test("can read bound title", function() { <ide> QUnit.test("escaped inline form (double curlies) escapes link title", function() { <ide> view = EmberView.create({ <ide> title: "<b>blah</b>", <del> template: compile("{{link-to view.title}}") <add> template: compile("{{link-to view.title}}"), <add> container: container <ide> }); <ide> <ide> runAppend(view); <ide> QUnit.test("escaped inline form (double curlies) escapes link title", function() <ide> QUnit.test("unescaped inline form (triple curlies) does not escape link title", function() { <ide> view = EmberView.create({ <ide> title: "<b>blah</b>", <del> template: compile("{{{link-to view.title}}}") <add> template: compile("{{{link-to view.title}}}"), <add> container: container <ide> }); <ide> <ide> runAppend(view); <ide> QUnit.test("unwraps controllers", function() { <ide> model: 'foo' <ide> }), <ide> <del> template: compile(template) <add> template: compile(template), <add> container: container <ide> }); <ide> <ide> expectDeprecation(function() { <ide><path>packages/ember-routing-views/lib/views/link.js <ide> import Ember from "ember-metal/core"; // FEATURES, Logger, assert <ide> <ide> import { get } from "ember-metal/property_get"; <del>import merge from "ember-metal/merge"; <del>import run from "ember-metal/run_loop"; <ide> import { computed } from "ember-metal/computed"; <ide> import { fmt } from "ember-runtime/system/string"; <del>import keys from "ember-metal/keys"; <ide> import { isSimpleClick } from "ember-views/system/utils"; <ide> import EmberComponent from "ember-views/views/component"; <del>import { routeArgs } from "ember-routing/utils"; <ide> import { read, subscribe } from "ember-metal/streams/utils"; <del> <del>var numberOfContextsAcceptedByHandler = function(handler, handlerInfos) { <del> var req = 0; <del> for (var i = 0, l = handlerInfos.length; i < l; i++) { <del> req = req + handlerInfos[i].names.length; <del> if (handlerInfos[i].handler === handler) { <del> break; <del> } <del> } <del> <del> return req; <del>}; <add>import inject from "ember-runtime/inject"; <ide> <ide> var linkViewClassNameBindings = ['active', 'loading', 'disabled']; <ide> if (Ember.FEATURES.isEnabled('ember-routing-transitioning-classes')) { <ide> var LinkView = EmberComponent.extend({ <ide> this.on(eventName, this, this._invoke); <ide> }, <ide> <add> _routing: inject.service('-routing'), <add> <ide> /** <ide> This method is invoked by observers installed during `init` that fire <ide> whenever the params change <ide> var LinkView = EmberComponent.extend({ <ide> @property active <ide> **/ <ide> active: computed('loadedParams', function computeLinkViewActive() { <del> var router = get(this, 'router'); <del> if (!router) { return; } <del> return computeActive(this, router.currentState); <add> var currentState = get(this, '_routing.currentState'); <add> return computeActive(this, currentState); <ide> }), <ide> <del> willBeActive: computed('router.targetState', function() { <del> var router = get(this, 'router'); <del> if (!router) { return; } <del> var targetState = router.targetState; <del> if (router.currentState === targetState) { return; } <add> willBeActive: computed('_routing.targetState', function() { <add> var routing = get(this, '_routing'); <add> var targetState = get(routing, 'targetState'); <add> if (get(routing, 'currentState') === targetState) { return; } <ide> <ide> return !!computeActive(this, targetState); <ide> }), <ide> var LinkView = EmberComponent.extend({ <ide> if (!get(this, 'loadedParams')) { return get(this, 'loadingClass'); } <ide> }), <ide> <del> /** <del> Returns the application's main router from the container. <del> <del> @private <del> @property router <del> **/ <del> router: computed(function() { <del> var controller = get(this, 'controller'); <del> if (controller && controller.container) { <del> return controller.container.lookup('router:main'); <del> } <del> }), <del> <ide> /** <ide> Event handler that invokes the link, activating the associated route. <ide> <ide> var LinkView = EmberComponent.extend({ <ide> return false; <ide> } <ide> <del> var router = get(this, 'router'); <del> var loadedParams = get(this, 'loadedParams'); <del> <del> var transition = router._doTransition(loadedParams.targetRouteName, loadedParams.models, loadedParams.queryParams); <del> if (get(this, 'replace')) { <del> transition.method('replace'); <del> } <del> <del> if (Ember.FEATURES.isEnabled('ember-routing-transitioning-classes')) { <del> return; <del> } <del> <del> // Schedule eager URL update, but after we've given the transition <del> // a chance to synchronously redirect. <del> // We need to always generate the URL instead of using the href because <del> // the href will include any rootURL set, but the router expects a URL <del> // without it! Note that we don't use the first level router because it <del> // calls location.formatURL(), which also would add the rootURL! <del> var args = routeArgs(loadedParams.targetRouteName, loadedParams.models, transition.state.queryParams); <del> var url = router.router.generate.apply(router.router, args); <del> <del> run.scheduleOnce('routerTransitions', this, this._eagerUpdateUrl, transition, url); <del> }, <del> <del> /** <del> @private <del> @method _eagerUpdateUrl <del> @param transition <del> @param href <del> */ <del> _eagerUpdateUrl(transition, href) { <del> if (!transition.isActive || !transition.urlMethod) { <del> // transition was aborted, already ran to completion, <del> // or it has a null url-updated method. <del> return; <del> } <del> <del> if (href.indexOf('#') === 0) { <del> href = href.slice(1); <del> } <del> <del> // Re-use the routerjs hooks set up by the Ember router. <del> var routerjs = get(this, 'router.router'); <del> if (transition.urlMethod === 'update') { <del> routerjs.updateURL(href); <del> } else if (transition.urlMethod === 'replace') { <del> routerjs.replaceURL(href); <del> } <del> <del> // Prevent later update url refire. <del> transition.method(null); <add> var params = get(this, 'loadedParams'); <add> get(this, '_routing').transitionTo(params.targetRouteName, params.models, params.queryParams, get(this, 'replace')); <ide> }, <ide> <ide> /** <ide> var LinkView = EmberComponent.extend({ <ide> @property <ide> @return {Array} <ide> */ <del> resolvedParams: computed('router.url', function() { <add> resolvedParams: computed('_routing.currentState', function() { <ide> var params = this.params; <ide> var targetRouteName; <ide> var models = []; <ide> var onlyQueryParamsSupplied = (params.length === 0); <ide> <ide> if (onlyQueryParamsSupplied) { <del> var appController = this.container.lookup('controller:application'); <del> targetRouteName = get(appController, 'currentRouteName'); <add> targetRouteName = get(this, '_routing.currentRouteName'); <ide> } else { <ide> targetRouteName = read(params[0]); <ide> <ide> var LinkView = EmberComponent.extend({ <ide> @return {Array} An array with the route name and any dynamic segments <ide> **/ <ide> loadedParams: computed('resolvedParams', function computeLinkViewRouteArgs() { <del> var router = get(this, 'router'); <del> if (!router) { return; } <add> var routing = get(this, '_routing'); <add> if (!routing) { return; } <ide> <ide> var resolvedParams = get(this, 'resolvedParams'); <ide> var namedRoute = resolvedParams.targetRouteName; <ide> var LinkView = EmberComponent.extend({ <ide> <ide> Ember.assert(fmt("The attempt to link-to route '%@' failed. " + <ide> "The router did not find '%@' in its possible routes: '%@'", <del> [namedRoute, namedRoute, keys(router.router.recognizer.names).join("', '")]), <del> router.hasRoute(namedRoute)); <add> [namedRoute, namedRoute, routing.availableRoutes().join("', '")]), <add> routing.hasRoute(namedRoute)); <ide> <ide> if (!paramsAreLoaded(resolvedParams.models)) { return; } <ide> <ide> var LinkView = EmberComponent.extend({ <ide> href: computed('loadedParams', function computeLinkViewHref() { <ide> if (get(this, 'tagName') !== 'a') { return; } <ide> <del> var router = get(this, 'router'); <del> var loadedParams = get(this, 'loadedParams'); <add> var routing = get(this, '_routing'); <add> var params = get(this, 'loadedParams'); <ide> <del> if (!loadedParams) { <add> if (!params) { <ide> return get(this, 'loadingHref'); <ide> } <ide> <del> var visibleQueryParams = {}; <del> merge(visibleQueryParams, loadedParams.queryParams); <del> router._prepareQueryParams(loadedParams.targetRouteName, loadedParams.models, visibleQueryParams); <del> <del> var args = routeArgs(loadedParams.targetRouteName, loadedParams.models, visibleQueryParams); <del> var result = router.generate.apply(router, args); <del> return result; <add> return routing.generateURL(params.targetRouteName, params.models, params.queryParams); <ide> }), <ide> <ide> /** <ide> function paramsAreLoaded(params) { <ide> return true; <ide> } <ide> <del>function computeActive(route, routerState) { <del> if (get(route, 'loading')) { return false; } <add>function computeActive(view, routerState) { <add> if (get(view, 'loading')) { return false; } <ide> <del> var currentWhen = route['current-when'] || route.currentWhen; <add> var currentWhen = view['current-when'] || view.currentWhen; <ide> var isCurrentWhenSpecified = !!currentWhen; <del> currentWhen = currentWhen || get(route, 'loadedParams').targetRouteName; <add> currentWhen = currentWhen || get(view, 'loadedParams').targetRouteName; <ide> currentWhen = currentWhen.split(' '); <ide> for (var i = 0, len = currentWhen.length; i < len; i++) { <del> if (isActiveForRoute(route, currentWhen[i], isCurrentWhenSpecified, routerState)) { <del> return get(route, 'activeClass'); <add> if (isActiveForRoute(view, currentWhen[i], isCurrentWhenSpecified, routerState)) { <add> return get(view, 'activeClass'); <ide> } <ide> } <ide> <ide> return false; <ide> } <ide> <del>function isActiveForRoute(route, routeName, isCurrentWhenSpecified, routerState) { <del> var router = get(route, 'router'); <del> var loadedParams = get(route, 'loadedParams'); <del> var contexts = loadedParams.models; <del> <del> var handlers = router.router.recognizer.handlersFor(routeName); <del> var leafName = handlers[handlers.length-1].handler; <del> var maximumContexts = numberOfContextsAcceptedByHandler(routeName, handlers); <del> <del> // NOTE: any ugliness in the calculation of activeness is largely <del> // due to the fact that we support automatic normalizing of <del> // `resource` -> `resource.index`, even though there might be <del> // dynamic segments / query params defined on `resource.index` <del> // which complicates (and makes somewhat ambiguous) the calculation <del> // of activeness for links that link to `resource` instead of <del> // directly to `resource.index`. <del> <del> // if we don't have enough contexts revert back to full route name <del> // this is because the leaf route will use one of the contexts <del> if (contexts.length > maximumContexts) { <del> routeName = leafName; <del> } <del> <del> return routerState.isActiveIntent(routeName, contexts, loadedParams.queryParams, !isCurrentWhenSpecified); <add>function isActiveForRoute(view, routeName, isCurrentWhenSpecified, routerState) { <add> var params = get(view, 'loadedParams'); <add> var service = get(view, '_routing'); <add> return service.isActiveForRoute(params, routeName, routerState, isCurrentWhenSpecified); <ide> } <ide> <ide> export { <ide><path>packages/ember-routing/lib/initializers/routing-service.js <add>import { onLoad } from "ember-runtime/system/lazy_load"; <add>import RoutingService from "ember-routing/services/routing"; <add> <add>onLoad('Ember.Application', function(Application) { <add> Application.initializer({ <add> name: 'routing-service', <add> initialize: function(registry) { <add> // Register the routing service... <add> registry.register('service:-routing', RoutingService); <add> // Then inject the app router into it <add> registry.injection('service:-routing', 'router', 'router:main'); <add> } <add> }); <add>}); <ide><path>packages/ember-routing/lib/main.js <ide> import RouterDSL from "ember-routing/system/dsl"; <ide> import Router from "ember-routing/system/router"; <ide> import Route from "ember-routing/system/route"; <ide> <add>import "ember-routing/initializers/routing-service"; <add> <ide> Ember.Location = EmberLocation; <ide> Ember.AutoLocation = AutoLocation; <ide> Ember.HashLocation = HashLocation; <ide><path>packages/ember-routing/lib/services/routing.js <add>/** <add>@module ember <add>@submodule ember-routing <add>*/ <add> <add>import Service from "ember-runtime/system/service"; <add> <add>import { get } from "ember-metal/property_get"; <add>import { readOnly } from "ember-metal/computed_macros"; <add>import { routeArgs } from "ember-routing/utils"; <add>import keys from "ember-metal/keys"; <add>import merge from "ember-metal/merge"; <add> <add>/** @private <add> The Routing service is used by LinkView, and provides facilities for <add> the component/view layer to interact with the router. <add> <add> While still private, this service can eventually be opened up, and provides <add> the set of API needed for components to control routing without interacting <add> with router internals. <add>*/ <add> <add>var RoutingService = Service.extend({ <add> router: null, <add> <add> targetState: readOnly('router.targetState'), <add> currentState: readOnly('router.currentState'), <add> currentRouteName: readOnly('router.currentRouteName'), <add> <add> availableRoutes: function() { <add> return keys(get(this, 'router').router.recognizer.names); <add> }, <add> <add> hasRoute: function(routeName) { <add> return get(this, 'router').hasRoute(routeName); <add> }, <add> <add> transitionTo: function(routeName, models, queryParams, shouldReplace) { <add> var router = get(this, 'router'); <add> <add> var transition = router._doTransition(routeName, models, queryParams); <add> <add> if (shouldReplace) { <add> transition.method('replace'); <add> } <add> }, <add> <add> normalizeQueryParams: function(routeName, models, queryParams) { <add> get(this, 'router')._prepareQueryParams(routeName, models, queryParams); <add> }, <add> <add> generateURL: function(routeName, models, queryParams) { <add> var router = get(this, 'router'); <add> <add> var visibleQueryParams = {}; <add> merge(visibleQueryParams, queryParams); <add> <add> this.normalizeQueryParams(routeName, models, visibleQueryParams); <add> <add> var args = routeArgs(routeName, models, visibleQueryParams); <add> return router.generate.apply(router, args); <add> }, <add> <add> isActiveForRoute: function(params, routeName, routerState, isCurrentWhenSpecified) { <add> var router = get(this, 'router'); <add> var contexts = params.models; <add> <add> var handlers = router.router.recognizer.handlersFor(routeName); <add> var leafName = handlers[handlers.length-1].handler; <add> var maximumContexts = numberOfContextsAcceptedByHandler(routeName, handlers); <add> <add> // NOTE: any ugliness in the calculation of activeness is largely <add> // due to the fact that we support automatic normalizing of <add> // `resource` -> `resource.index`, even though there might be <add> // dynamic segments / query params defined on `resource.index` <add> // which complicates (and makes somewhat ambiguous) the calculation <add> // of activeness for links that link to `resource` instead of <add> // directly to `resource.index`. <add> <add> // if we don't have enough contexts revert back to full route name <add> // this is because the leaf route will use one of the contexts <add> if (contexts.length > maximumContexts) { <add> routeName = leafName; <add> } <add> <add> return routerState.isActiveIntent(routeName, contexts, params.queryParams, !isCurrentWhenSpecified); <add> } <add>}); <add> <add>var numberOfContextsAcceptedByHandler = function(handler, handlerInfos) { <add> var req = 0; <add> for (var i = 0, l = handlerInfos.length; i < l; i++) { <add> req = req + handlerInfos[i].names.length; <add> if (handlerInfos[i].handler === handler) { <add> break; <add> } <add> } <add> <add> return req; <add>}; <add> <add>export default RoutingService; <ide><path>packages/ember-routing/lib/system/router.js <ide> function updatePaths(router) { <ide> } <ide> <ide> set(appController, 'currentPath', path); <add> set(router, 'currentPath', path); <ide> <ide> if (!('currentRouteName' in appController)) { <ide> defineProperty(appController, 'currentRouteName'); <ide> } <ide> <ide> set(appController, 'currentRouteName', infos[infos.length - 1].name); <add> set(router, 'currentRouteName', infos[infos.length - 1].name); <ide> } <ide> <ide> EmberRouter.reopenClass({
6
Python
Python
use google style to document properties
8a8ae27617e3c4dafb34bcbbaadf4ceee28583bd
<ide><path>src/transformers/configuration_utils.py <ide> def __init__(self, **kwargs): <ide> raise err <ide> <ide> @property <del> def use_return_tuple(self): <add> def use_return_tuple(self) -> bool: <add> """ <add> :obj:`bool`: Whether or not the model should return a tuple. <add> """ <ide> # If torchscript is set, force return_tuple to avoid jit errors <ide> return self.return_tuple or self.torchscript <ide> <ide> @property <ide> def num_labels(self) -> int: <add> """ <add> :obj:`int`: The number of labels for classification models. <add> """ <ide> return len(self.id2label) <ide> <ide> @num_labels.setter <ide><path>src/transformers/modeling_tf_utils.py <ide> class TFPreTrainedModel(tf.keras.Model, TFModelUtilsMixin, TFGenerationMixin): <ide> @property <ide> def dummy_inputs(self) -> Dict[str, tf.Tensor]: <ide> """ <del> Dummy inputs to build the network. <del> <del> Returns: <del> :obj:`Dict[str, tf.Tensor]`: The dummy inputs. <add> :obj:`Dict[str, tf.Tensor]`: Dummy inputs to build the network. <ide> """ <ide> return {"input_ids": tf.constant(DUMMY_INPUTS)} <ide> <ide><path>src/transformers/modeling_utils.py <ide> def reset_memory_hooks_state(self): <ide> @property <ide> def device(self) -> device: <ide> """ <del> The device on which the module is (assuming that all the module parameters are on the same device). <del> <del> Returns: <del> :obj:`torch.device` The device of the module. <add> :obj:`torch.device`: The device on which the module is (assuming that all the module parameters are on the same <add> device). <ide> """ <ide> try: <ide> return next(self.parameters()).device <ide> def find_tensor_attributes(module: nn.Module) -> List[Tuple[str, Tensor]]: <ide> @property <ide> def dtype(self) -> dtype: <ide> """ <del> The dtype of the module (assuming that all the module parameters have the same dtype). <del> <del> Returns: <del> :obj:`torch.dtype` The dtype of the module. <add> :obj:`torch.dtype`: The dtype of the module (assuming that all the module parameters have the same dtype). <ide> """ <ide> try: <ide> return next(self.parameters()).dtype <ide> class PreTrainedModel(nn.Module, ModuleUtilsMixin, GenerationMixin): <ide> <ide> @property <ide> def dummy_inputs(self) -> Dict[str, torch.Tensor]: <del> """ Dummy inputs to do a forward pass in the network. <del> <del> Returns: <del> :obj:`Dict[str, torch.Tensor]`: The dummy inputs. <add> """ <add> :obj:`Dict[str, torch.Tensor]`: Dummy inputs to do a forward pass in the network. <ide> """ <ide> return {"input_ids": torch.tensor(DUMMY_INPUTS)} <ide> <ide> def __init__(self, config: PretrainedConfig, *inputs, **kwargs): <ide> self.config = config <ide> <ide> @property <del> def base_model(self): <add> def base_model(self) -> nn.Module: <add> """ <add> :obj:`torch.nn.Module`: The main body of the model. <add> """ <ide> return getattr(self, self.base_model_prefix, self) <ide> <ide> def get_input_embeddings(self) -> nn.Module:
3
Ruby
Ruby
silence some warnings
d2acf8b548b56966da49bd7f2f92dcfbd5410319
<ide><path>activesupport/lib/active_support/json/encoding.rb <ide> require 'active_support/json/variable' <ide> <del>require 'active_support/json/encoders/object' # Require this file explicitly for rdoc <del>Dir[File.dirname(__FILE__) + '/encoders/**/*.rb'].each { |file| require file[0..-4] } <add>require 'active_support/json/encoders/object' # Require explicitly for rdoc. <add>Dir["#{File.dirname(__FILE__)}/encoders/**/*.rb"].each do |file| <add> basename = File.basename(file, '.rb') <add> unless basename == 'object' <add> require "active_support/json/encoders/#{basename}" <add> end <add>end <ide> <ide> module ActiveSupport <ide> module JSON <ide><path>activesupport/test/test_test.rb <ide> def test_negative_differences <ide> <ide> def test_expression_is_evaluated_in_the_appropriate_scope <ide> local_scope = 'foo' <del> assert_difference 'local_scope; @object.num' do <del> @object.increment <add> silence_warnings do <add> assert_difference('local_scope; @object.num') { @object.increment } <ide> end <ide> end <ide> end
2
Go
Go
add documentation for exported functions and types
9a98556c2bc355170893568ca20e102cbda7d600
<ide><path>pkg/mount/flags_freebsd.go <ide> package mount <ide> import "C" <ide> <ide> const ( <del> RDONLY = C.MNT_RDONLY <del> NOSUID = C.MNT_NOSUID <del> NOEXEC = C.MNT_NOEXEC <add> // RDONLY will mount the filesystem as read-only. <add> RDONLY = C.MNT_RDONLY <add> <add> // NOSUID will not allow set-user-identifier or set-group-identifier bits to <add> // take effect. <add> NOSUID = C.MNT_NOSUID <add> <add> // NOEXEC will not allow execution of any binaries on the mounted file system. <add> NOEXEC = C.MNT_NOEXEC <add> <add> // SYNCHRONOUS will allow any I/O to the file system to be done synchronously. <ide> SYNCHRONOUS = C.MNT_SYNCHRONOUS <del> NOATIME = C.MNT_NOATIME <ide> <add> // NOATIME will not update the file access time when reading from a file. <add> NOATIME = C.MNT_NOATIME <add>) <add> <add>// These flags are unsupported. <add>const ( <ide> BIND = 0 <ide> DIRSYNC = 0 <ide> MANDLOCK = 0 <ide><path>pkg/mount/flags_linux.go <ide> import ( <ide> ) <ide> <ide> const ( <del> RDONLY = syscall.MS_RDONLY <del> NOSUID = syscall.MS_NOSUID <del> NODEV = syscall.MS_NODEV <del> NOEXEC = syscall.MS_NOEXEC <add> // RDONLY will mount the file system read-only. <add> RDONLY = syscall.MS_RDONLY <add> <add> // NOSUID will not allow set-user-identifier or set-group-identifier bits to <add> // take effect. <add> NOSUID = syscall.MS_NOSUID <add> <add> // NODEV will not interpret character or block special devices on the file <add> // system. <add> NODEV = syscall.MS_NODEV <add> <add> // NOEXEC will not allow execution of any binaries on the mounted file system. <add> NOEXEC = syscall.MS_NOEXEC <add> <add> // SYNCHRONOUS will allow I/O to the file system to be done synchronously. <ide> SYNCHRONOUS = syscall.MS_SYNCHRONOUS <del> DIRSYNC = syscall.MS_DIRSYNC <del> REMOUNT = syscall.MS_REMOUNT <del> MANDLOCK = syscall.MS_MANDLOCK <del> NOATIME = syscall.MS_NOATIME <del> NODIRATIME = syscall.MS_NODIRATIME <del> BIND = syscall.MS_BIND <del> RBIND = syscall.MS_BIND | syscall.MS_REC <del> UNBINDABLE = syscall.MS_UNBINDABLE <add> <add> // DIRSYNC will force all directory updates within the file system to be done <add> // synchronously. This affects the following system calls: creat, link, <add> // unlink, symlink, mkdir, rmdir, mknod and rename. <add> DIRSYNC = syscall.MS_DIRSYNC <add> <add> // REMOUNT will attempt to remount an already-mounted file system. This is <add> // commonly used to change the mount flags for a file system, especially to <add> // make a readonly file system writeable. It does not change device or mount <add> // point. <add> REMOUNT = syscall.MS_REMOUNT <add> <add> // MANDLOCK will force mandatory locks on a filesystem. <add> MANDLOCK = syscall.MS_MANDLOCK <add> <add> // NOATIME will not update the file access time when reading from a file. <add> NOATIME = syscall.MS_NOATIME <add> <add> // NODIRATIME will not update the directory access time. <add> NODIRATIME = syscall.MS_NODIRATIME <add> <add> // BIND remounts a subtree somewhere else. <add> BIND = syscall.MS_BIND <add> <add> // RBIND remounts a subtree and all possible submounts somewhere else. <add> RBIND = syscall.MS_BIND | syscall.MS_REC <add> <add> // UNBINDABLE creates a mount which cannot be cloned through a bind operation. <add> UNBINDABLE = syscall.MS_UNBINDABLE <add> <add> // RUNBINDABLE marks the entire mount tree as UNBINDABLE. <ide> RUNBINDABLE = syscall.MS_UNBINDABLE | syscall.MS_REC <del> PRIVATE = syscall.MS_PRIVATE <del> RPRIVATE = syscall.MS_PRIVATE | syscall.MS_REC <del> SLAVE = syscall.MS_SLAVE <del> RSLAVE = syscall.MS_SLAVE | syscall.MS_REC <del> SHARED = syscall.MS_SHARED <del> RSHARED = syscall.MS_SHARED | syscall.MS_REC <del> RELATIME = syscall.MS_RELATIME <add> <add> // PRIVATE creates a mount which carries no propagation abilities. <add> PRIVATE = syscall.MS_PRIVATE <add> <add> // RPRIVATE marks the entire mount tree as PRIVATE. <add> RPRIVATE = syscall.MS_PRIVATE | syscall.MS_REC <add> <add> // SLAVE creates a mount which receives propagation from its master, but not <add> // vice versa. <add> SLAVE = syscall.MS_SLAVE <add> <add> // RSLAVE marks the entire mount tree as SLAVE. <add> RSLAVE = syscall.MS_SLAVE | syscall.MS_REC <add> <add> // SHARED creates a mount which provides the ability to create mirrors of <add> // that mount such that mounts and unmounts within any of the mirrors <add> // propagate to the other mirrors. <add> SHARED = syscall.MS_SHARED <add> <add> // RSHARED marks the entire mount tree as SHARED. <add> RSHARED = syscall.MS_SHARED | syscall.MS_REC <add> <add> // RELATIME updates inode access times relative to modify or change time. <add> RELATIME = syscall.MS_RELATIME <add> <add> // STRICTATIME allows to explicitly request full atime updates. This makes <add> // it possible for the kernel to default to relatime or noatime but still <add> // allow userspace to override it. <ide> STRICTATIME = syscall.MS_STRICTATIME <ide> ) <ide><path>pkg/mount/flags_unsupported.go <ide> <ide> package mount <ide> <add>// These flags are unsupported. <ide> const ( <ide> BIND = 0 <ide> DIRSYNC = 0 <ide><path>pkg/mount/mount.go <ide> import ( <ide> "time" <ide> ) <ide> <add>// GetMounts retrieves a list of mounts for the current running process. <ide> func GetMounts() ([]*MountInfo, error) { <ide> return parseMountTable() <ide> } <ide> <del>// Looks at /proc/self/mountinfo to determine of the specified <add>// Mounted looks at /proc/self/mountinfo to determine of the specified <ide> // mountpoint has been mounted <ide> func Mounted(mountpoint string) (bool, error) { <ide> entries, err := parseMountTable() <ide> func Mounted(mountpoint string) (bool, error) { <ide> return false, nil <ide> } <ide> <del>// Mount the specified options at the target path only if <del>// the target is not mounted <del>// Options must be specified as fstab style <add>// Mount will mount filesystem according to the specified configuration, on the <add>// condition that the target path is *not* already mounted. Options must be <add>// specified like the mount or fstab unix commands: "opt1=val1,opt2=val2". See <add>// flags.go for supported option flags. <ide> func Mount(device, target, mType, options string) error { <ide> flag, _ := parseOptions(options) <ide> if flag&REMOUNT != REMOUNT { <ide> func Mount(device, target, mType, options string) error { <ide> return ForceMount(device, target, mType, options) <ide> } <ide> <del>// Mount the specified options at the target path <del>// reguardless if the target is mounted or not <del>// Options must be specified as fstab style <add>// ForceMount will mount a filesystem according to the specified configuration, <add>// *regardless* if the target path is not already mounted. Options must be <add>// specified like the mount or fstab unix commands: "opt1=val1,opt2=val2". See <add>// flags.go for supported option flags. <ide> func ForceMount(device, target, mType, options string) error { <ide> flag, data := parseOptions(options) <ide> if err := mount(device, target, mType, uintptr(flag), data); err != nil { <ide> func ForceMount(device, target, mType, options string) error { <ide> return nil <ide> } <ide> <del>// Unmount the target only if it is mounted <add>// Unmount will unmount the target filesystem, so long as it is mounted. <ide> func Unmount(target string) error { <ide> if mounted, err := Mounted(target); err != nil || !mounted { <ide> return err <ide> } <ide> return ForceUnmount(target) <ide> } <ide> <del>// Unmount the target reguardless if it is mounted or not <add>// ForceUnmount will force an unmount of the target filesystem, regardless if <add>// it is mounted or not. <ide> func ForceUnmount(target string) (err error) { <ide> // Simple retry logic for unmount <ide> for i := 0; i < 10; i++ { <ide><path>pkg/mount/mountinfo.go <ide> package mount <ide> <add>// MountInfo reveals information about a particular mounted filesystem. This <add>// struct is populated from the content in the /proc/<pid>/mountinfo file. <ide> type MountInfo struct { <del> Id, Parent, Major, Minor int <del> Root, Mountpoint, Opts, Optional string <del> Fstype, Source, VfsOpts string <add> // Id is a unique identifier of the mount (may be reused after umount). <add> Id int <add> <add> // Parent indicates the ID of the mount parent (or of self for the top of the <add> // mount tree). <add> Parent int <add> <add> // Major indicates one half of the device ID which identifies the device class. <add> Major int <add> <add> // Minor indicates one half of the device ID which identifies a specific <add> // instance of device. <add> Minor int <add> <add> // Root of the mount within the filesystem. <add> Root string <add> <add> // Mountpoint indicates the mount point relative to the process's root. <add> Mountpoint string <add> <add> // Opts represents mount-specific options. <add> Opts string <add> <add> // Optional represents optional fields. <add> Optional string <add> <add> // Fstype indicates the type of filesystem, such as EXT3. <add> Fstype string <add> <add> // Source indicates filesystem specific information or "none". <add> Source string <add> <add> // VfsOpts represents per super block options. <add> VfsOpts string <ide> } <ide><path>pkg/mount/mountinfo_freebsd.go <ide> import ( <ide> "unsafe" <ide> ) <ide> <del>// Parse /proc/self/mountinfo because comparing Dev and ino does not work from bind mounts <add>// Parse /proc/self/mountinfo because comparing Dev and ino does not work from <add>// bind mounts. <ide> func parseMountTable() ([]*MountInfo, error) { <ide> var rawEntries *C.struct_statfs <ide> <ide><path>pkg/mount/mountinfo_linux.go <ide> const ( <ide> mountinfoFormat = "%d %d %d:%d %s %s %s %s" <ide> ) <ide> <del>// Parse /proc/self/mountinfo because comparing Dev and ino does not work from bind mounts <add>// Parse /proc/self/mountinfo because comparing Dev and ino does not work from <add>// bind mounts <ide> func parseMountTable() ([]*MountInfo, error) { <ide> f, err := os.Open("/proc/self/mountinfo") <ide> if err != nil { <ide> func parseInfoFile(r io.Reader) ([]*MountInfo, error) { <ide> return out, nil <ide> } <ide> <del>// PidMountInfo collects the mounts for a specific Pid <add>// PidMountInfo collects the mounts for a specific process ID. If the process <add>// ID is unknown, it is better to use `GetMounts` which will inspect <add>// "/proc/self/mountinfo" instead. <ide> func PidMountInfo(pid int) ([]*MountInfo, error) { <ide> f, err := os.Open(fmt.Sprintf("/proc/%d/mountinfo", pid)) <ide> if err != nil { <ide><path>pkg/mount/sharedsubtree_linux.go <ide> <ide> package mount <ide> <add>// MakeShared ensures a mounted filesystem has the SHARED mount option enabled. <add>// See the supported options in flags.go for further reference. <ide> func MakeShared(mountPoint string) error { <ide> return ensureMountedAs(mountPoint, "shared") <ide> } <ide> <add>// MakeRShared ensures a mounted filesystem has the RSHARED mount option enabled. <add>// See the supported options in flags.go for further reference. <ide> func MakeRShared(mountPoint string) error { <ide> return ensureMountedAs(mountPoint, "rshared") <ide> } <ide> <add>// MakePrivate ensures a mounted filesystem has the PRIVATE mount option enabled. <add>// See the supported options in flags.go for further reference. <ide> func MakePrivate(mountPoint string) error { <ide> return ensureMountedAs(mountPoint, "private") <ide> } <ide> <add>// MakeRPrivate ensures a mounted filesystem has the RPRIVATE mount option <add>// enabled. See the supported options in flags.go for further reference. <ide> func MakeRPrivate(mountPoint string) error { <ide> return ensureMountedAs(mountPoint, "rprivate") <ide> } <ide> <add>// MakeSlave ensures a mounted filesystem has the SLAVE mount option enabled. <add>// See the supported options in flags.go for further reference. <ide> func MakeSlave(mountPoint string) error { <ide> return ensureMountedAs(mountPoint, "slave") <ide> } <ide> <add>// MakeRSlave ensures a mounted filesystem has the RSLAVE mount option enabled. <add>// See the supported options in flags.go for further reference. <ide> func MakeRSlave(mountPoint string) error { <ide> return ensureMountedAs(mountPoint, "rslave") <ide> } <ide> <add>// MakeUnbindable ensures a mounted filesystem has the UNBINDABLE mount option <add>// enabled. See the supported options in flags.go for further reference. <ide> func MakeUnbindable(mountPoint string) error { <ide> return ensureMountedAs(mountPoint, "unbindable") <ide> } <ide> <add>// MakeRUnbindable ensures a mounted filesystem has the RUNBINDABLE mount <add>// option enabled. See the supported options in flags.go for further reference. <ide> func MakeRUnbindable(mountPoint string) error { <ide> return ensureMountedAs(mountPoint, "runbindable") <ide> }
8
Javascript
Javascript
remove timeout in annotation integration test
9dc331ec621cad157a7a8046b3eb0bfce2412e08
<ide><path>test/integration/annotation_spec.js <ide> describe("Annotation highlight", () => { <ide> ); <ide> expect(hidden).withContext(`In ${browserName}`).toEqual(true); <ide> await page.hover("[data-annotation-id='19R']"); <del> await page.waitForTimeout(100); <add> await page.waitForSelector("[data-annotation-id='21R']", { <add> visible: true, <add> timeout: 0, <add> }); <ide> hidden = await page.$eval( <ide> "[data-annotation-id='21R']", <ide> el => el.hidden
1
Python
Python
remove stray print statement (closes )
48a2046d1c84fa0916ac55df4913ed88cd139e9b
<ide><path>spacy/lang/ta/lex_attrs.py <ide> def like_num(text): <ide> num, denom = text.split("/") <ide> if num.isdigit() and denom.isdigit(): <ide> return True <del> print(suffix_filter(text)) <ide> if text.lower() in _num_words: <ide> return True <ide> elif suffix_filter(text) in _num_words:
1
Go
Go
remove redunant debugf
526ddd351218798199b6221fad67e1c335ad8542
<ide><path>api/server/middleware/debug.go <ide> import ( <ide> // DebugRequestMiddleware dumps the request to logger <ide> func DebugRequestMiddleware(handler httputils.APIFunc) httputils.APIFunc { <ide> return func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error { <del> logrus.Debugf("%s %s", r.Method, r.RequestURI) <add> logrus.Debugf("Calling %s %s", r.Method, r.RequestURI) <ide> <ide> if r.Method != "POST" { <ide> return handler(ctx, w, r, vars) <ide><path>api/server/server.go <ide> func (s *HTTPServer) Close() error { <ide> <ide> func (s *Server) makeHTTPHandler(handler httputils.APIFunc) http.HandlerFunc { <ide> return func(w http.ResponseWriter, r *http.Request) { <del> // log the handler call <del> logrus.Debugf("Calling %s %s", r.Method, r.URL.Path) <del> <ide> // Define the context that we'll pass around to share info <ide> // like the docker-request-id. <ide> //
2
PHP
PHP
add helper method for using error_log
05c8aa20962f2c20f0b5013bac35f70ae6298f7e
<ide><path>src/Illuminate/Log/Writer.php <ide> use Monolog\Handler\StreamHandler; <ide> use Monolog\Logger as MonologLogger; <ide> use Monolog\Formatter\LineFormatter; <add>use Monolog\Handler\ErrorLogHandler; <ide> use Monolog\Handler\RotatingFileHandler; <ide> use Illuminate\Support\Contracts\JsonableInterface; <ide> use Illuminate\Support\Contracts\ArrayableInterface; <ide> public function useFiles($path, $level = 'debug') <ide> <ide> $this->monolog->pushHandler($handler = new StreamHandler($path, $level)); <ide> <del> $handler->setFormatter(new LineFormatter(null, null, true)); <add> $handler->setFormatter($this->getDefaultFormatter()); <ide> } <ide> <ide> /** <ide> public function useDailyFiles($path, $days = 0, $level = 'debug') <ide> <ide> $this->monolog->pushHandler($handler = new RotatingFileHandler($path, $days, $level)); <ide> <del> $handler->setFormatter(new LineFormatter(null, null, true)); <add> $handler->setFormatter($this->getDefaultFormatter()); <add> } <add> <add> /** <add> * Register an error_log handler. <add> * <add> * @param integer $messageType <add> * @param string $level <add> * @return void <add> */ <add> public function useErrorLog($level = 'debug', $messageType = ErrorLogHandler::OPERATING_SYSTEM) <add> { <add> $level = $this->parseLevel($level); <add> <add> $this->monolog->pushHandler($handler = new ErrorLogHandler($messageType, $level)); <add> <add> $handler->setFormatter($this->getDefaultFormatter()); <add> } <add> <add> /** <add> * Get a defaut Monolog formatter instance. <add> * <add> * @return \Monolog\Formatters\LineFormatter <add> */ <add> protected function getDefaultFormatter() <add> { <add> return new LineFormatter(null, null, true); <ide> } <ide> <ide> /** <ide><path>tests/Log/LogWriterTest.php <ide> public function testRotatingFileHandlerCanBeAdded() <ide> } <ide> <ide> <add> public function testErrorLogHandlerCanBeAdded() <add> { <add> $writer = new Writer($monolog = m::mock('Monolog\Logger')); <add> $monolog->shouldReceive('pushHandler')->once()->with(m::type('Monolog\Handler\ErrorLogHandler')); <add> $writer->useErrorLog(); <add> } <add> <add> <ide> public function testMagicMethodsPassErrorAdditionsToMonolog() <ide> { <ide> $writer = new Writer($monolog = m::mock('Monolog\Logger'));
2
Javascript
Javascript
add test for
b0f6afcdacc53fd91b37ad0c5d70544f7e37ebde
<ide><path>test/ng/compileSpec.js <ide> describe('$compile', function() { <ide> })); <ide> <ide> <add> // https://github.com/angular/angular.js/issues/15833 <add> it('should work with ng-model inputs', function() { <add> var componentScope; <add> <add> module(function($compileProvider) { <add> $compileProvider.directive('undi', function() { <add> return { <add> restrict: 'A', <add> scope: { <add> undi: '<' <add> }, <add> link: function($scope) { componentScope = $scope; } <add> }; <add> }); <add> }); <add> <add> inject(function($compile, $rootScope) { <add> element = $compile('<form name="f" undi="[f.i]"><input name="i" ng-model="a"/></form>')($rootScope); <add> $rootScope.$apply(); <add> expect(componentScope.undi).toBeDefined(); <add> }); <add> }); <add> <add> <ide> it('should not complain when the isolated scope changes', inject(function() { <ide> compile('<div><span my-component ow-ref="{name: name}">'); <ide>
1
Javascript
Javascript
remove `combineurl` and replace it with `new url`
a25c29d98d476c71a4d8bd7ed6cb0a7df0b9db65
<ide><path>src/display/api.js <ide> var UnexpectedResponseException = sharedUtil.UnexpectedResponseException; <ide> var UnknownErrorException = sharedUtil.UnknownErrorException; <ide> var Util = sharedUtil.Util; <ide> var createPromiseCapability = sharedUtil.createPromiseCapability; <del>var combineUrl = sharedUtil.combineUrl; <ide> var error = sharedUtil.error; <ide> var deprecated = sharedUtil.deprecated; <ide> var getVerbosityLevel = sharedUtil.getVerbosityLevel; <ide> function getDocument(src, pdfDataRangeTransport, <ide> for (var key in source) { <ide> if (key === 'url' && typeof window !== 'undefined') { <ide> // The full path is required in the 'url' field. <del> params[key] = combineUrl(window.location.href, source[key]); <add> params[key] = new URL(source[key], window.location).href; <ide> continue; <ide> } else if (key === 'range') { <ide> rangeTransport = source[key]; <ide> var PDFWorker = (function PDFWorkerClosure() { <ide> // // to the same origin. <ide> // if (!isSameOrigin(window.location.href, workerSrc)) { <ide> // workerSrc = createCDNWrapper( <del>// combineUrl(window.location.href, workerSrc)); <add>// new URL(workerSrc, window.location).href); <ide> // } <ide> //#endif <ide> // Some versions of FF can't create a worker on localhost, see: <ide><path>src/shared/util.js <ide> var UNSUPPORTED_FEATURES = { <ide> font: 'font' <ide> }; <ide> <del>// Combines two URLs. The baseUrl shall be absolute URL. If the url is an <del>// absolute URL, it will be returned as is. <del>function combineUrl(baseUrl, url) { <del> if (!url) { <del> return baseUrl; <del> } <del> return new URL(url, baseUrl).href; <del>} <del> <ide> // Checks if URLs have the same origin. For non-HTTP based URLs, returns false. <ide> function isSameOrigin(baseUrl, otherUrl) { <ide> try { <ide> exports.arrayByteLength = arrayByteLength; <ide> exports.arraysToBytes = arraysToBytes; <ide> exports.assert = assert; <ide> exports.bytesToString = bytesToString; <del>exports.combineUrl = combineUrl; <ide> exports.createBlob = createBlob; <ide> exports.createPromiseCapability = createPromiseCapability; <ide> exports.createObjectURL = createObjectURL; <ide><path>test/driver.js <ide> var Driver = (function DriverClosure() { <ide> <ide> this._log('Loading file "' + task.file + '"\n'); <ide> <del> var absoluteUrl = pdfjsSharedUtil.combineUrl(window.location.href, <del> task.file); <del> <add> var absoluteUrl = new URL(task.file, window.location).href; <ide> PDFJS.disableRange = task.disableRange; <ide> PDFJS.disableAutoFetch = !task.enableAutoFetch; <ide> try { <ide><path>test/unit/annotation_layer_spec.js <ide> /* globals expect, it, describe, Dict, Name, Annotation, AnnotationBorderStyle, <del> AnnotationBorderStyleType, AnnotationFlag, PDFJS, combineUrl, <add> AnnotationBorderStyleType, AnnotationFlag, PDFJS, <ide> beforeEach, afterEach, stringToBytes */ <ide> <ide> 'use strict'; <ide> describe('Annotation layer', function() { <ide> var annotations; <ide> <ide> beforeEach(function(done) { <del> var pdfUrl = combineUrl(window.location.href, <del> '../pdfs/annotation-fileattachment.pdf'); <add> var pdfUrl = new URL('../pdfs/annotation-fileattachment.pdf', <add> window.location).href; <ide> loadingTask = PDFJS.getDocument(pdfUrl); <ide> loadingTask.promise.then(function(pdfDocument) { <ide> return pdfDocument.getPage(1).then(function(pdfPage) { <ide><path>test/unit/util_spec.js <del>/* globals expect, it, describe, combineUrl, Dict, isDict, Name, PDFJS, <add>/* globals expect, it, describe, Dict, isDict, Name, PDFJS, <ide> stringToPDFString, removeNullCharacters */ <ide> <ide> 'use strict'; <ide> <ide> describe('util', function() { <del> describe('combineUrl', function() { <del> it('absolute url with protocol stays as is', function() { <del> var baseUrl = 'http://server/index.html'; <del> var url = 'http://server2/test2.html'; <del> var result = combineUrl(baseUrl, url); <del> var expected = 'http://server2/test2.html'; <del> expect(result).toEqual(expected); <del> }); <del> <del> it('absolute url without protocol uses prefix from base', function() { <del> var baseUrl = 'http://server/index.html'; <del> var url = '/test2.html'; <del> var result = combineUrl(baseUrl, url); <del> var expected = 'http://server/test2.html'; <del> expect(result).toEqual(expected); <del> }); <del> <del> it('combines relative url with base', function() { <del> var baseUrl = 'http://server/index.html'; <del> var url = 'test2.html'; <del> var result = combineUrl(baseUrl, url); <del> var expected = 'http://server/test2.html'; <del> expect(result).toEqual(expected); <del> }); <del> <del> it('combines relative url (w/hash) with base', function() { <del> var baseUrl = 'http://server/index.html#!/test'; <del> var url = 'test2.html'; <del> var result = combineUrl(baseUrl, url); <del> var expected = 'http://server/test2.html'; <del> expect(result).toEqual(expected); <del> }); <del> <del> it('combines relative url (w/query) with base', function() { <del> var baseUrl = 'http://server/index.html?search=/test'; <del> var url = 'test2.html'; <del> var result = combineUrl(baseUrl, url); <del> var expected = 'http://server/test2.html'; <del> expect(result).toEqual(expected); <del> }); <del> <del> it('returns base url when url is empty', function() { <del> var baseUrl = 'http://server/index.html'; <del> var url = ''; <del> var result = combineUrl(baseUrl, url); <del> var expected = 'http://server/index.html'; <del> expect(result).toEqual(expected); <del> }); <del> <del> it('returns base url when url is undefined', function() { <del> var baseUrl = 'http://server/index.html'; <del> var url; <del> var result = combineUrl(baseUrl, url); <del> var expected = 'http://server/index.html'; <del> expect(result).toEqual(expected); <del> }); <del> }); <del> <ide> describe('isDict', function() { <ide> it('handles empty dictionaries with type check', function() { <ide> var dict = new Dict();
5
Python
Python
fix missing regex requirement
a0b8a26655c9ea071f5ba4f5fa53ef953d775161
<ide><path>setup.py <ide> def setup_package(): <ide> 'plac<1.0.0,>=0.9.6', <ide> 'pathlib', <ide> 'ujson>=1.35', <add> 'regex==2017.4.5', <ide> 'dill>=0.2,<0.3'], <ide> setup_requires=['wheel'], <ide> classifiers=[
1
Go
Go
fix checksum computing
f10b0f75e02041db64176760a3be9639408ad923
<ide><path>image.go <ide> func (img *Image) Checksum() (string, error) { <ide> if err != nil { <ide> return "", err <ide> } <add> jsonData, err := ioutil.ReadFile(jsonPath(root)) <add> if err != nil { <add> return "", err <add> } <add> <ide> layerData, err := Tar(layer, Xz) <ide> if err != nil { <ide> return "", err <ide> } <add> <ide> h := sha256.New() <del> if _, err := io.Copy(h, layerData); err != nil { <add> if _, err := io.Copy(h, bytes.NewBuffer(jsonData)); err != nil { <ide> return "", err <ide> } <del> <del> jsonData, err := ioutil.ReadFile(jsonPath(root)) <del> if err != nil { <add> if _, err := io.Copy(h, strings.NewReader("\n")); err != nil { <ide> return "", err <ide> } <del> if _, err := io.Copy(h, bytes.NewBuffer(jsonData)); err != nil { <add> if _, err := io.Copy(h, layerData); err != nil { <ide> return "", err <ide> } <ide>
1
Go
Go
fix connection block when using docker stats api
d9bf8163ad8579cf2ab9f55925f9ea5037e5b525
<ide><path>api/client/stats.go <ide> func (s *containerStats) Collect(cli *DockerCli, streamStats bool) { <ide> u <- err <ide> return <ide> } <del> var ( <add> <add> var memPercent = 0.0 <add> var cpuPercent = 0.0 <add> <add> // MemoryStats.Limit will never be 0 unless the container is not running and we havn't <add> // got any data from cgroup <add> if v.MemoryStats.Limit != 0 { <ide> memPercent = float64(v.MemoryStats.Usage) / float64(v.MemoryStats.Limit) * 100.0 <del> cpuPercent = 0.0 <del> ) <add> } <add> <ide> previousCPU = v.PreCPUStats.CPUUsage.TotalUsage <ide> previousSystem = v.PreCPUStats.SystemUsage <ide> cpuPercent = calculateCPUPercent(previousCPU, previousSystem, v) <ide><path>api/server/container.go <ide> func (s *Server) getContainersStats(version version.Version, w http.ResponseWrit <ide> } <ide> <ide> stream := boolValueOrDefault(r, "stream", true) <add> <add> // If the container is not running and requires no stream, return an empty stats. <add> container, err := s.daemon.Get(vars["name"]) <add> if err != nil { <add> return err <add> } <add> if !container.IsRunning() && !stream { <add> return writeJSON(w, http.StatusOK, &types.Stats{}) <add> } <add> <ide> var out io.Writer <ide> if !stream { <ide> w.Header().Set("Content-Type", "application/json")
2
Text
Text
update api reference
cfabd5ca42da27289b6951ad82820e62ce349b29
<ide><path>README.md <ide> Human-readable reference marks for scales. <ide> * [d3.axisLeft](https://github.com/d3/d3-axis#axisTeft) - create a new left-oriented axis generator. <ide> * [*axis*](https://github.com/d3/d3-axis#_axis) - generate an axis for the given selection. <ide> * [*axis*.scale](https://github.com/d3/d3-axis#axis_scale) - set the scale. <del>* [*axis*.orient](https://github.com/d3/d3-axis#axis_orient) - set the axis orientation. <ide> * [*axis*.ticks](https://github.com/d3/d3-axis#axis_ticks) - customize how ticks are generated and formatted. <ide> * [*axis*.tickArguments](https://github.com/d3/d3-axis#axis_tickArguments) - customize how ticks are generated and formatted. <ide> * [*axis*.tickValues](https://github.com/d3/d3-axis#axis_tickValues) - set the tick values explicitly. <ide> Geometric operations for two-dimensional polygons. <ide> Two-dimensional recursive spatial subdivision. <ide> <ide> * [d3.quadtree](https://github.com/d3/d3-quadtree#quadtree) - create a new quadtree generator. <add>* [*quadtree*](https://github.com/d3/d3-quadtree#_quadtree) - generate a quadtree for the specified points. <add>* [*root*.add](https://github.com/d3/d3-quadtree#root_add) - add a point to a quadtree. <add>* [*root*.find](https://github.com/d3/d3-quadtree#root_find) - quickly find the closest point in a quadtree. <add>* [*root*.visit](https://github.com/d3/d3-quadtree#root_visit) - recursively visit all nodes in a quadtree. <add>* [*quadtree*.x](https://github.com/d3/d3-quadtree#quadtree_x) - set the *x* accessor. <add>* [*quadtree*.y](https://github.com/d3/d3-quadtree#quadtree_y) - set the *y* accessor. <add>* [*quadtree*.extent](https://github.com/d3/d3-quadtree#quadtree_extent) - set the observed extent of points. <add>* [*quadtree*.size](https://github.com/d3/d3-quadtree#quadtree_size) - set the observed extent of points. <ide> <ide> ## [Random Numbers](https://github.com/d3/d3-random) <ide> <ide> An efficient queue for managing thousands of concurrent animations. <ide> Compute the Voronoi diagram of a given set of points. <ide> <ide> * [d3.voronoi](https://github.com/d3/d3-voronoi#voronoi) - create a new Voronoi generator. <add>* [*voronoi*](https://github.com/d3/d3-voronoi#_voronoi) - generate a new Voronoi diagram for the given points. <add>* [*voronoi*.cells](https://github.com/d3/d3-voronoi#voronoi_cells) - compute the Voronoi polygons for the given points. <add>* [*voronoi*.links](https://github.com/d3/d3-voronoi#voronoi_links) - compute the Delaunay links for the given points. <add>* [*voronoi*.triangles](https://github.com/d3/d3-voronoi#voronoi_triangles) - compute the Delaunay triangles for the given points. <add>* [*voronoi*.x](https://github.com/d3/d3-voronoi#voronoi_x) - set the *x* accessor. <add>* [*voronoi*.y](https://github.com/d3/d3-voronoi#voronoi_y) - set the *y* accessor. <add>* [*voronoi*.extent](https://github.com/d3/d3-voronoi#voronoi_extent) - set the observed extent of points. <add>* [*voronoi*.size](https://github.com/d3/d3-voronoi#voronoi_size) - set the observed extent of points.
1
Java
Java
integrate stickerinputview into fabric on android
8d31e38966a18f66c9352c7f667a2d7818d6189b
<ide><path>ReactAndroid/src/main/java/com/facebook/react/fabric/FabricComponents.java <ide> public class FabricComponents { <ide> sComponentNames.put("TemplateView", "RCTTemplateView"); <ide> sComponentNames.put("AxialGradientView", "RCTAxialGradientView"); <ide> sComponentNames.put("Video", "RCTVideo"); <add> sComponentNames.put("StickerInputView", "RCTStickerInputView"); <ide> } <ide> <ide> /** @return the name of component in the Fabric environment */
1
Text
Text
remove the suffix number of the anchor link
872d803faf568ff71e8808cf9f469a38c67abf61
<ide><path>CONTRIBUTING.md <ide> * [Code of Conduct](#code-of-conduct) <ide> * [Issues](#issues) <ide> * [Pull Requests](#pull-requests) <del>* [Developer's Certificate of Origin 1.1](#developers-certificate-of-origin-11) <add>* [Developer's Certificate of Origin 1.1](#developers-certificate-of-origin) <ide> <ide> ## [Code of Conduct](./doc/guides/contributing/coc.md) <ide>
1
Text
Text
add aduh95 to collaborators
c208a20f9c4bdf4d8dc57d14629dd296b8681327
<ide><path>README.md <ide> For information about the governance of the Node.js project, see <ide> <ide> * [addaleax](https://github.com/addaleax) - <ide> **Anna Henningsen** &lt;anna@addaleax.net&gt; (she/her) <add>* [aduh95](https://github.com/aduh95) - <add>**Antoine du Hamel** &lt;duhamelantoine1995@gmail.com&gt; (he/him) <ide> * [ak239](https://github.com/ak239) - <ide> **Aleksei Koziatinskii** &lt;ak239spb@gmail.com&gt; <ide> * [AndreasMadsen](https://github.com/AndreasMadsen) -
1
Javascript
Javascript
output the event that is leaking
1c0ec7172534e0a1f64f388a0eeb08eb0ac333df
<ide><path>lib/events.js <ide> EventEmitter.prototype.addListener = function addListener(type, listener) { <ide> if (m && m > 0 && this._events[type].length > m) { <ide> this._events[type].warned = true; <ide> console.error('(node) warning: possible EventEmitter memory ' + <del> 'leak detected. %d listeners added. ' + <add> 'leak detected. %d %s listeners added. ' + <ide> 'Use emitter.setMaxListeners() to increase limit.', <del> this._events[type].length); <add> this._events[type].length, type); <ide> console.trace(); <ide> } <ide> }
1
Ruby
Ruby
allow livecheck method in on_system blocks
40199404cfe26492bc24577d73b893871644c8b2
<ide><path>Library/Homebrew/rubocops/components_order.rb <ide> def check_on_system_block_content(component_precedence_list, on_system_block) <ide> end <ide> end <ide> on_system_allowed_methods = %w[ <del> depends_on <del> patch <del> resource <del> deprecate! <add> livecheck <add> keg_only <ide> disable! <add> deprecate! <add> depends_on <ide> conflicts_with <ide> fails_with <del> keg_only <add> resource <add> patch <ide> ignore_missing_libraries <ide> ] <ide> on_system_allowed_methods += on_system_methods.map(&:to_s)
1
PHP
PHP
add ability to test blade components
e4dc43f772557c0ca1767d5070cf336006dfa4e0
<ide><path>src/Illuminate/Foundation/Testing/Concerns/InteractsWithViews.php <ide> protected function blade(string $template, array $data = []) <ide> <ide> return new TestView(view(Str::before(basename($tempFile), '.blade.php'), $data)); <ide> } <add> <add> /** <add> * Create a new TestView from the given view component. <add> * <add> * @param string $view <add> * @param \Illuminate\Contracts\Support\Arrayable|array $data <add> * @return \Illuminate\Testing\TestView <add> */ <add> protected function component(string $viewComponent, array $data = []) <add> { <add> $component = $this->app->make($viewComponent, $data); <add> $view = $component->resolveView(); <add> <add> if ($view instanceof \Illuminate\View\View) { <add> return new TestView($view->with($component->data())); <add> } <add> <add> return new TestView(view($view, $component->data())); <add> } <ide> }
1
Python
Python
add reattach flag to ecsoperator
0df60b773671ecf8d4e5f582ac2be200cf2a2edd
<ide><path>airflow/providers/amazon/aws/operators/ecs.py <ide> import re <ide> import sys <ide> from datetime import datetime <del>from typing import Optional <add>from typing import Optional, Dict <ide> <ide> from botocore.waiter import Waiter <ide> <ide> class ECSProtocol(Protocol): <ide> - https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ecs.html <ide> """ <ide> <del> def run_task(self, **kwargs) -> dict: <del> """https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ecs.html#ECS.Client.run_task""" # noqa: E501 # pylint: disable=line-too-long <add> # pylint: disable=C0103, line-too-long <add> def run_task(self, **kwargs) -> Dict: <add> """https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ecs.html#ECS.Client.run_task""" # noqa: E501 <ide> ... <ide> <ide> def get_waiter(self, x: str) -> Waiter: <del> """https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ecs.html#ECS.Client.get_waiter""" # noqa: E501 # pylint: disable=line-too-long <add> """https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ecs.html#ECS.Client.get_waiter""" # noqa: E501 <ide> ... <ide> <del> def describe_tasks(self, cluster: str, tasks) -> dict: <del> """https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ecs.html#ECS.Client.describe_tasks""" # noqa: E501 # pylint: disable=line-too-long <add> def describe_tasks(self, cluster: str, tasks) -> Dict: <add> """https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ecs.html#ECS.Client.describe_tasks""" # noqa: E501 <ide> ... <ide> <del> def stop_task(self, cluster, task, reason: str) -> dict: <del> """https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ecs.html#ECS.Client.stop_task""" # noqa: E501 # pylint: disable=line-too-long <add> def stop_task(self, cluster, task, reason: str) -> Dict: <add> """https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ecs.html#ECS.Client.stop_task""" # noqa: E501 <ide> ... <ide> <add> def describe_task_definition(self, taskDefinition: str) -> Dict: <add> """https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ecs.html#ECS.Client.describe_task_definition""" # noqa: E501 <add> ... <add> <add> def list_tasks(self, cluster: str, launchType: str, desiredStatus: str, family: str) -> Dict: <add> """https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ecs.html#ECS.Client.list_tasks""" # noqa: E501 <add> ... <add> <add> # pylint: enable=C0103, line-too-long <add> <ide> <ide> class ECSOperator(BaseOperator): # pylint: disable=too-many-instance-attributes <ide> """ <ide> class ECSOperator(BaseOperator): # pylint: disable=too-many-instance-attributes <ide> Only required if you want logs to be shown in the Airflow UI after your job has <ide> finished. <ide> :type awslogs_stream_prefix: str <add> :param reattach: If set to True, will check if a task from the same family is already running. <add> If so, the operator will attach to it instead of starting a new task. <add> :type reattach: bool <ide> """ <ide> <ide> ui_color = '#f0ede4' <ide> def __init__( <ide> awslogs_region: Optional[str] = None, <ide> awslogs_stream_prefix: Optional[str] = None, <ide> propagate_tags: Optional[str] = None, <add> reattach: bool = False, <ide> **kwargs, <ide> ): <ide> super().__init__(**kwargs) <ide> def __init__( <ide> self.awslogs_stream_prefix = awslogs_stream_prefix <ide> self.awslogs_region = awslogs_region <ide> self.propagate_tags = propagate_tags <add> self.reattach = reattach <ide> <ide> if self.awslogs_region is None: <ide> self.awslogs_region = region_name <ide> def execute(self, context): <ide> <ide> self.client = self.get_hook().get_conn() <ide> <add> if self.reattach: <add> self._try_reattach_task() <add> <add> if not self.arn: <add> self._start_task() <add> <add> self._wait_for_task_ended() <add> <add> self._check_success_task() <add> self.log.info('ECS Task has been successfully executed') <add> <add> def _start_task(self): <ide> run_opts = { <ide> 'cluster': self.cluster, <ide> 'taskDefinition': self.task_definition, <ide> def execute(self, context): <ide> self.log.info('ECS Task started: %s', response) <ide> <ide> self.arn = response['tasks'][0]['taskArn'] <del> self._wait_for_task_ended() <ide> <del> self._check_success_task() <del> self.log.info('ECS Task has been successfully executed: %s', response) <add> def _try_reattach_task(self): <add> task_def_resp = self.client.describe_task_definition(self.task_definition) <add> ecs_task_family = task_def_resp['taskDefinition']['family'] <add> <add> list_tasks_resp = self.client.list_tasks( <add> cluster=self.cluster, launchType=self.launch_type, desiredStatus='RUNNING', family=ecs_task_family <add> ) <add> running_tasks = list_tasks_resp['taskArns'] <add> <add> running_tasks_count = len(running_tasks) <add> if running_tasks_count > 1: <add> self.arn = running_tasks[0] <add> self.log.warning('More than 1 ECS Task found. Reattaching to %s', self.arn) <add> elif running_tasks_count == 1: <add> self.arn = running_tasks[0] <add> self.log.info('Reattaching task: %s', self.arn) <add> else: <add> self.log.info('No active tasks found to reattach') <ide> <ide> def _wait_for_task_ended(self) -> None: <ide> if not self.client or not self.arn: <ide><path>tests/providers/amazon/aws/operators/test_ecs.py <ide> def test_check_success_task_not_raises(self): <ide> } <ide> self.ecs._check_success_task() <ide> client_mock.describe_tasks.assert_called_once_with(cluster='c', tasks=['arn']) <add> <add> @parameterized.expand( <add> [ <add> ['EC2', None], <add> ['FARGATE', None], <add> ['EC2', {'testTagKey': 'testTagValue'}], <add> ['', {'testTagKey': 'testTagValue'}], <add> ] <add> ) <add> @mock.patch.object(ECSOperator, '_wait_for_task_ended') <add> @mock.patch.object(ECSOperator, '_check_success_task') <add> @mock.patch.object(ECSOperator, '_start_task') <add> def test_reattach_successful(self, launch_type, tags, start_mock, check_mock, wait_mock): <add> <add> self.set_up_operator(launch_type=launch_type, tags=tags) # pylint: disable=no-value-for-parameter <add> client_mock = self.aws_hook_mock.return_value.get_conn.return_value <add> client_mock.describe_task_definition.return_value = {'taskDefinition': {'family': 'f'}} <add> client_mock.list_tasks.return_value = { <add> 'taskArns': ['arn:aws:ecs:us-east-1:012345678910:task/d8c67b3c-ac87-4ffe-a847-4785bc3a8b55'] <add> } <add> <add> self.ecs.reattach = True <add> self.ecs.execute(None) <add> <add> self.aws_hook_mock.return_value.get_conn.assert_called_once() <add> extend_args = {} <add> if launch_type: <add> extend_args['launchType'] = launch_type <add> if launch_type == 'FARGATE': <add> extend_args['platformVersion'] = 'LATEST' <add> if tags: <add> extend_args['tags'] = [{'key': k, 'value': v} for (k, v) in tags.items()] <add> <add> client_mock.describe_task_definition.assert_called_once_with('t') <add> <add> client_mock.list_tasks.assert_called_once_with( <add> cluster='c', launchType=launch_type, desiredStatus='RUNNING', family='f' <add> ) <add> <add> start_mock.assert_not_called() <add> wait_mock.assert_called_once_with() <add> check_mock.assert_called_once_with() <add> self.assertEqual( <add> self.ecs.arn, 'arn:aws:ecs:us-east-1:012345678910:task/d8c67b3c-ac87-4ffe-a847-4785bc3a8b55' <add> )
2
Text
Text
update devops docs
3bbf96e49599d2a52210cc56228bd9fa73087beb
<ide><path>SECURITY.md <ide> This document outlines our security policy for the codebase, and how to report v <ide> <ide> ## Versions <ide> <del>| Version | Branch | Supported | Website active | <del>| ----------- | ------------------------ | ------------------ | ---------------- | <del>| production | `production-current` | :white_check_mark: | freecodecamp.org | <del>| beta | `production-staging` | :white_check_mark: | freecodecamp.dev | <del>| development | `master` | | | <add>| Version | Branch | Supported | Website active | <add>| ----------- | -------------- | ------------------ | ---------------- | <add>| production | `prod-current` | :white_check_mark: | freecodecamp.org | <add>| beta | `prod-staging` | :white_check_mark: | freecodecamp.dev | <add>| development | `main` | | | <ide> <ide> ## Reporting a Vulnerability <ide> <del>If you think you have found a vulnerability, *please report responsibly*. Don't create GitHub issues for security issues. Instead, please send an email to `security@freecodecamp.org` and we'll look into it immediately. <add>If you think you have found a vulnerability, _please report responsibly_. Don't create GitHub issues for security issues. Instead, please send an email to `security@freecodecamp.org` and we'll look into it immediately. <ide> <ide> We appreciate any responsible disclosure of vulnerabilities that might impact the integrity of our platforms and users. While we do not offer any bounties or swags at the moment, we'll be happy to list your name in our [Hall of Fame](HoF.md) list. <ide> <ide><path>docs/devops.md <ide> This involves three steps to be followed in sequence: <ide> <ide> #### Building the codebase - Mapping Git Branches to Deployments. <ide> <del>Typically, [`main`](https://github.com/freeCodeCamp/freeCodeCamp/tree/main) (the default development branch) is merged into the [`production-staging`](https://github.com/freeCodeCamp/freeCodeCamp/tree/production-staging) branch once a day and is released into an isolated infrastructure. <add>Typically, [`main`](https://github.com/freeCodeCamp/freeCodeCamp/tree/main) (the default development branch) is merged into the [`prod-staging`](https://github.com/freeCodeCamp/freeCodeCamp/tree/prod-staging) branch once a day and is released into an isolated infrastructure. <ide> <ide> This is an intermediate release for our developers and volunteer contributors. It is also known as our "staging" or "beta" release. <ide> <ide> It is identical to our live production environment at `freeCodeCamp.org`, other than it using a separate set of databases, servers, web-proxies, etc. This isolation lets us test ongoing development and features in a "production" like scenario, without affecting regular users of freeCodeCamp.org's main platforms. <ide> <del>Once the developer team [`@freeCodeCamp/dev-team`](https://github.com/orgs/freeCodeCamp/teams/dev-team/members) is happy with the changes on the staging platform, these changes are moved every few days to the [`production-current`](https://github.com/freeCodeCamp/freeCodeCamp/tree/production-current) branch. <add>Once the developer team [`@freeCodeCamp/dev-team`](https://github.com/orgs/freeCodeCamp/teams/dev-team/members) is happy with the changes on the staging platform, these changes are moved every few days to the [`prod-current`](https://github.com/freeCodeCamp/freeCodeCamp/tree/prod-current) branch. <ide> <ide> This is the final release that moves changes to our production platforms on freeCodeCamp.org. <ide> <ide> Currently, only members on the developer team can push to the production branche <ide> npm run clean-and-develop <ide> ``` <ide> <del>5. Move changes from `main` to `production-staging` via a fast-forward merge <add>5. Move changes from `main` to `prod-staging` via a fast-forward merge <ide> <ide> ``` <del> git checkout production-staging <add> git checkout prod-staging <ide> git merge main <ide> git push upstream <ide> ``` <ide> Currently, only members on the developer team can push to the production branche <ide> > <ide> > If they do, you may have done something incorrectly and you should just start over. <ide> <del>The above steps will automatically trigger a run on the build pipeline for the `production-staging` branch. Once the build is complete, the artifacts are saved as `.zip` files in a cold storage to be retrieved and used later. <add>The above steps will automatically trigger a run on the build pipeline for the `prod-staging` branch. Once the build is complete, the artifacts are saved as `.zip` files in a cold storage to be retrieved and used later. <ide> <ide> The release pipeline is triggered automatically when a fresh artifact is available from the connected build pipeline. For staging platforms, this process does not involve manual approval and the artifacts are pushed to the Client CDN and API servers. <ide> <del>> [!TIP|label:Estimates] <del>> Typically the build run takes ~20-25 minutes to complete followed by the release run which takes ~15-20 mins for the client, and ~5-10 mins for the API to be available live. From code push to being live on the staging platforms the whole process takes **~35-45 mins** in total. <del> <ide> ### Pushing changes to Production Applications. <ide> <ide> The process is mostly the same as the staging platforms, with a few extra checks in place. This is just to make sure, we do not break anything on freeCodeCamp.org which can see hundreds of users using it at any moment. <ide> The process is mostly the same as the staging platforms, with a few extra checks <ide> | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | <ide> <ide> <del>1. Make sure your `production-staging` branch is pristine and in sync with the upstream. <add>1. Make sure your `prod-staging` branch is pristine and in sync with the upstream. <ide> <ide> ```sh <del> git checkout production-staging <add> git checkout prod-staging <ide> git fetch --all --prune <del> git reset --hard upstream/production-staging <add> git reset --hard upstream/prod-staging <ide> ``` <ide> <del>2. Move changes from `production-staging` to `production-current` via a fast-forward merge <add>2. Move changes from `prod-staging` to `prod-current` via a fast-forward merge <ide> <ide> ``` <del> git checkout production-current <del> git merge production-staging <add> git checkout prod-current <add> git merge prod-staging <ide> git push upstream <ide> ``` <ide> <ide> The process is mostly the same as the staging platforms, with a few extra checks <ide> > <ide> > If they do, you may have done something incorrectly and you should just start over. <ide> <del>The above steps will automatically trigger a run on the build pipeline for the `production-current` branch. Once a build artifact is ready, it will trigger a run on the release pipeline. <del> <del>> [!TIP|label:Estimates] <del>> Typically the build run takes ~20-25 minutes to complete. <add>The above steps will automatically trigger a run on the build pipeline for the `prod-current` branch. Once a build artifact is ready, it will trigger a run on the release pipeline. <ide> <ide> **Additional Steps for Staff Action** <ide> <ide> For staff use: <ide> | :----------------------------------------------------------------------------------------------------------------------------------------------------------------- | <ide> <ide> <del>Once one of the staff members approves a release, the pipeline will push the changes live to freeCodeCamp.org's production CDN and API servers. They typically take ~15-20 mins for the client, and ~5 mins for the API servers to be available live. <del> <del>> [!TIP|label:Estimates] <del>> The release run typically takes ~15-20 mins for each client instance, and ~5-10 mins for each API instance to be available live. From code push to being live on the production platforms the whole process takes **~90-120 mins** in total (not counting the wait time for the staff approval). <add>Once one of the staff members approves a release, the pipeline will push the changes live to freeCodeCamp.org's production CDN and API servers. <ide> <ide> ## Build, Test and Deployment Status <ide> <ide> Here is the current test, build and deployment status of the codebase. <ide> <del>| Type | Branch | Status | Dashboard | <del>| :--------------- | :------------------------------------------------------------------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :---------------------------------------------------------------------------------------- | <del>| Build Pipeline | [`production-staging`](https://github.com/freeCodeCamp/freeCodeCamp/tree/production-staging) | [![Build Status](https://dev.azure.com/freeCodeCamp-org/freeCodeCamp/_apis/build/status/dot-dev-ci?branchName=production-staging)](https://dev.azure.com/freeCodeCamp-org/freeCodeCamp/_build/latest?definitionId=15&branchName=production-staging) | [Go to status dashboard](https://dev.azure.com/freeCodeCamp-org/freeCodeCamp/_build) | <del>| Release Pipeline | [`production-staging`](https://github.com/freeCodeCamp/freeCodeCamp/tree/production-staging) | | [Go to status dashboard](https://dev.azure.com/freeCodeCamp-org/freeCodeCamp/_release) | <del>| CI Tests | [`production-current`](https://github.com/freeCodeCamp/freeCodeCamp/tree/production-current) | ![Travis CI Build Status](https://travis-ci.com/freeCodeCamp/freeCodeCamp.svg?branch=production-current) | [Go to status dashboard](https://travis-ci.com/github/freeCodeCamp/freeCodeCamp/branches) | <del>| Build Pipeline | [`production-current`](https://github.com/freeCodeCamp/freeCodeCamp/tree/production-staging) | [![Build Status](https://dev.azure.com/freeCodeCamp-org/freeCodeCamp/_apis/build/status/dot-org-ci?branchName=production-current)](https://dev.azure.com/freeCodeCamp-org/freeCodeCamp/_build/latest?definitionId=17&branchName=production-current) | [Go to status dashboard](https://dev.azure.com/freeCodeCamp-org/freeCodeCamp/_build) | <del>| Release Pipeline | [`production-current`](https://github.com/freeCodeCamp/freeCodeCamp/tree/production-staging) | | [Go to status dashboard](https://dev.azure.com/freeCodeCamp-org/freeCodeCamp/_release) | <add>| Branch | Unit Tests | Integration Tests | Builds & Deployments | <add>| :------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------- | <add>| [`main`](https://github.com/freeCodeCamp/freeCodeCamp/tree/main) | [![Node.js CI](https://github.com/freeCodeCamp/freeCodeCamp/workflows/Node.js%20CI/badge.svg?branch=main)](https://github.com/freeCodeCamp/freeCodeCamp/actions?query=workflow%3A%22Node.js+CI%22) | [![Cypress E2E Tests](https://img.shields.io/endpoint?url=https://dashboard.cypress.io/badge/simple/ke77ns/main&style=flat&logo=cypress)](https://dashboard.cypress.io/projects/ke77ns/analytics/runs-over-time) | - | <add>| [`prod-staging`](https://github.com/freeCodeCamp/freeCodeCamp/tree/prod-staging) | [![Node.js CI](https://github.com/freeCodeCamp/freeCodeCamp/workflows/Node.js%20CI/badge.svg?branch=prod-staging)](https://github.com/freeCodeCamp/freeCodeCamp/actions?query=workflow%3A%22Node.js+CI%22+branch%3Aprod-staging) | [![Cypress E2E Tests](https://img.shields.io/endpoint?url=https://dashboard.cypress.io/badge/simple/ke77ns/prod-staging&style=flat&logo=cypress)](https://dashboard.cypress.io/projects/ke77ns/analytics/runs-over-time) | [Azure Pipelines](https://dev.azure.com/freeCodeCamp-org/freeCodeCamp/_dashboards/dashboard/d59f36b9-434a-482d-8dbd-d006b71713d4) | <add>| [`prod-current`](https://github.com/freeCodeCamp/freeCodeCamp/tree/prod-staging) | [![Node.js CI](https://github.com/freeCodeCamp/freeCodeCamp/workflows/Node.js%20CI/badge.svg?branch=prod-current)](https://github.com/freeCodeCamp/freeCodeCamp/actions?query=workflow%3A%22Node.js+CI%22+branch%3Aprod-current) | [![Cypress E2E Tests](https://img.shields.io/endpoint?url=https://dashboard.cypress.io/badge/simple/ke77ns/prod-current&style=flat&logo=cypress)](https://dashboard.cypress.io/projects/ke77ns/analytics/runs-over-time) | [Azure Pipelines](https://dev.azure.com/freeCodeCamp-org/freeCodeCamp/_dashboards/dashboard/d59f36b9-434a-482d-8dbd-d006b71713d4) | <add>| `prod-next` (experimental, upcoming) | - | - | - | <ide> <ide> ## Early access and beta testing <ide> <ide> We thank you for reporting bugs that you encounter and help in making freeCodeCa <ide> <ide> Currently a public beta testing version is available at: <ide> <del><h1 align="center"><a href='https://www.freecodecamp.dev' _target='blank'>freecodecamp.dev</a></h1> <add>| Application | Language | URL | <add>| :---------- | :------- | :--------------------------------------- | <add>| Learn | English | <https://www.freecodecamp.dev> | <add>| | Espanol | <https://www.freecodecamp.dev/espanol> | <add>| | Chinese | <https://chinese.freecodecamp.dev> | <add>| News | English | <https://www.freecodecamp.dev/news> | <add>| Forum | English | <https://forum.freecodecamp.dev> | <add>| | Chinese | <https://chinese.freecodecamp.dev/forum> | <add>| API | - | `https://api.freecodecamp.dev` | <ide> <ide> > [!NOTE] <ide> > The domain name is different than **`freeCodeCamp.org`**. This is intentional to prevent search engine indexing and avoid confusion for regular users of the platform. <add>> <add>> The above list not exhaustive of all the applications that we provision. Also not all language variants are deployed in staging to conserve resources. <ide> <ide> ### Identifying the current version of the platforms <ide> <ide> **The current version of the platform is always available at [`freeCodeCamp.org`](https://www.freecodecamp.org).** <ide> <del>The dev-team merges changes from the `production-staging` branch to `production-current` when they release changes. The top commit should be what you see live on the site. <add>The dev-team merges changes from the `prod-staging` branch to `prod-current` when they release changes. The top commit should be what you see live on the site. <ide> <ide> You can identify the exact version deployed by visiting the build and deployment logs available in the status section. Alternatively you can also ping us in the [contributors chat room](https://chat.freecodecamp.org/channel/contributors) for a confirmation. <ide> <ide> There are some known limitations and tradeoffs when using the beta version of th <ide> <ide> ## Reporting issues and leaving feedback <ide> <del>Please open fresh issues for discussions and reporting bugs. You can label them as **[`release: next/beta`](https://github.com/freeCodeCamp/freeCodeCamp/labels/release%3A%20next%2Fbeta)** for triage. <add>Please open fresh issues for discussions and reporting bugs. <ide> <ide> You may send an email to `dev[at]freecodecamp.org` if you have any queries. As always all security vulnerabilities should be reported to `security[at]freecodecamp.org` instead of the public tracker and forum. <ide> <ide> Provisioning VMs with the Code <ide> ```console <ide> git clone https://github.com/freeCodeCamp/freeCodeCamp.git <ide> cd freeCodeCamp <del> git checkout production-current # or any other branch to be deployed <add> git checkout prod-current # or any other branch to be deployed <ide> ``` <ide> <ide> 4. Create the `.env` from the secure credentials storage. <ide><path>docs/moderator-handbook.md <ide> Pull Requests (PRs) are how contributors submit changes to freeCodeCamp's reposi <ide> <ide> ```markdown <ide> Thank you for your pull request. <del> <add> <ide> We are closing this pull request. Please add links and other details to the challenge's corresponding guide article instead. <del> <add> <ide> If you think we're wrong in closing this issue, please request for it to be reopened and add further clarification. Thank you, and happy coding. <ide> ``` <ide> <ide> In both of these situations, you should go ahead and close their pull request an <ide> <ide> ```markdown <ide> Thank you for opening this pull request. <del> <add> <ide> This is a standard message notifying you that we've reviewed your pull request and have decided not to merge it. We would welcome future pull requests from you. <ide> <ide> Thank you and happy coding. <ide> Discord Bans are global - you cannot ban a user from a specific channel, only fr <ide> <ide> There may be situations where you need to address a concern with a camper privately. This should not be done through DMs, as this can lead to situations where you claim one thing and the camper claims another. Instead, use the bot's functionality to create a private discussion: <ide> <del>- Call the `!fCC moderate private @username` command, where `@username` is the *Discord mention* of the user. If you are calling this command from a private channel (such as #mod-chat), you will need to parse the mention manually: Ensure you have Developer Mode turned on in your Discord settings, then right-click on the user's avatar and select `Copy ID`. Replace the `@username` parameter with `<@!ID>`, where `ID` is the value you copied earlier. The result should look like: `!fCC moderate private <@!465650873650118659>`. <add>- Call the `!fCC moderate private @username` command, where `@username` is the _Discord mention_ of the user. If you are calling this command from a private channel (such as #mod-chat), you will need to parse the mention manually: Ensure you have Developer Mode turned on in your Discord settings, then right-click on the user's avatar and select `Copy ID`. Replace the `@username` parameter with `<@!ID>`, where `ID` is the value you copied earlier. The result should look like: `!fCC moderate private <@!465650873650118659>`. <ide> - The bot will create a new channel under the `private` category and add the `@username`-mentioned camper and all moderators with the `Your Friendly Moderator` role. While all moderators are added to the channel for transparency, the moderator who calls this command should be the only one to interact with the camper unless they request assistance. <del>- When the conversation is complete, call the `!fCC moderate close` command *in the private channel* to have the bot close and delete that channel. <add>- When the conversation is complete, call the `!fCC moderate close` command _in the private channel_ to have the bot close and delete that channel. <ide> <ide> 4. **Deleting messages** <ide> Moderators have the ability to delete messages on Discord. They should only exercise this ability in four very specific situations: <ide> In all other situations - even situations where the code of conduct is violated <ide> Moderating the chat server is very similar to moderating the Discord server, but there are a few key differences: <ide> <ide> 1. **No Ban functionality** <del> At this time, Rocket.Chat does not have a flow for banning users. Users can be muted (so they are prevented from chatting in a room) or kicked from a room. <add> At this time, Rocket.Chat does not have a flow for banning users. Users can be muted (so they are prevented from chatting in a room) or kicked from a room. <ide> 2. **Modified Bot Commands** <del> The moderation bot in the chat server was developed with a smoother UX in mind. Some of the commands have been modified. Use the `!fCC modHelp` command to view the available functionality. Bot commands in the chat server do NOT require a user mention as they do with Discord. <add> The moderation bot in the chat server was developed with a smoother UX in mind. Some of the commands have been modified. Use the `!fCC modHelp` command to view the available functionality. Bot commands in the chat server do NOT require a user mention as they do with Discord. <ide> 3. **No Role Mentions** <del> Unlike Discord, Rocket.Chat does not allow you to mention all users by a specific role - this means you cannot ping all moderators at once. <add> Unlike Discord, Rocket.Chat does not allow you to mention all users by a specific role - this means you cannot ping all moderators at once. <ide> <ide> ## How to become a moderator <ide> <ide> Feel free to reference the [contributing guidelines](https://contribute.freecode <ide> <ide> ### Syncing Fork <ide> <del>> When PR is not up to date with the `master` branch. <add>> When PR is not up to date with the `main` branch. <ide> <ide> ````markdown <ide> Hey @username <ide> <ide> We would love to be able to merge your changes but it looks like the branch is not up to date. ⚠️ <ide> <del>To resolve this error, you will have to sync the latest changes from the `master` branch of the `freeCodeCamp/freeCodeCamp` repo. <add>To resolve this error, you will have to sync the latest changes from the `main` branch of the `freeCodeCamp/freeCodeCamp` repo. <ide> <ide> Using the command line, you can do this in three easy steps: <ide>
3
PHP
PHP
add test for overwrite all
e4ceb0df9304e3855342d16b3d71e97de01828a6
<ide><path>tests/TestCase/Console/ShellTest.php <ide> public function testCreateFileOverwriteNonInteractive() <ide> $this->assertEquals(file_get_contents($file), 'My content'); <ide> } <ide> <add> /** <add> * Test that all files are changed with a 'a' reply. <add> * <add> * @return void <add> */ <add> public function testCreateFileOverwriteAll() <add> { <add> $eol = PHP_EOL; <add> $path = TMP . 'shell_test'; <add> $files = [ <add> $path . DS . 'file1.php' => 'My first content', <add> $path . DS . 'file2.php' => 'My second content', <add> $path . DS . 'file3.php' => 'My third content' <add> ]; <add> <add> new Folder($path, true); <add> <add> $this->io->expects($this->once()) <add> ->method('askChoice') <add> ->will($this->returnValue('a')); <add> <add> foreach ($files as $file => $content) { <add> touch($file); <add> $this->assertTrue(file_exists($file)); <add> <add> $contents = "My content"; <add> $result = $this->Shell->createFile($file, $contents); <add> $this->assertTrue(file_exists($file)); <add> $this->assertTextEquals($contents, file_get_contents($file)); <add> $this->assertTrue($result, 'Did create file.'); <add> } <add> } <add> <ide> /** <ide> * Test that you can't create files that aren't writable. <ide> *
1
Javascript
Javascript
fix a small broking mistake in fonts.js
e347ad03d97599588aa9be0f134f665f4b7b46de
<ide><path>fonts.js <ide> var Type2CFF = (function type2CFF() { <ide> var glyph = charsets[i]; <ide> var code = glyphMap[glyph] || 0; <ide> <del> var mapping = glyphs[code] || glyphs[glyph] || {}; <add> var mapping = glyphs[code] || glyphs[glyph] || { width: defaultWidth }; <ide> var unicode = mapping.unicode; <ide> <ide> if (unicode <= 0x1f || (unicode >= 127 && unicode <= 255)) <ide> unicode += kCmapGlyphOffset; <ide> <del> var width = ('width' in mapping) && isNum(mapping.width) ? mapping.width <del> : defaultWidth; <add> var width = isNum(mapping.width) ? mapping.width : defaultWidth; <ide> properties.encoding[code] = { <ide> unicode: unicode, <ide> width: width
1
Javascript
Javascript
allow automatic rewriting of links to be disabled
b3e09be58960b913fee3869bf36e7de3305bbe00
<ide><path>src/ng/location.js <ide> function $LocationProvider(){ <ide> var hashPrefix = '', <ide> html5Mode = { <ide> enabled: false, <del> requireBase: true <add> requireBase: true, <add> rewriteLinks: true <ide> }; <ide> <ide> /** <ide> function $LocationProvider(){ <ide> * @name $locationProvider#html5Mode <ide> * @description <ide> * @param {(boolean|Object)=} mode If boolean, sets `html5Mode.enabled` to value. <del> * If object, sets `enabled` and `requireBase` to respective values. <del> * - **enabled** – `{boolean}` – Sets `html5Mode.enabled`. If true, will rely on <del> * `history.pushState` to change urls where supported. Will fall back to hash-prefixed paths <del> * in browsers that do not support `pushState`. <del> * - **requireBase** - `{boolean}` - Sets `html5Mode.requireBase` (default: `true`). When <del> * html5Mode is enabled, specifies whether or not a <base> tag is required to be present. If <del> * `enabled` and `requireBase` are true, and a base tag is not present, an error will be <del> * thrown when `$location` is injected. See the <del> * {@link guide/$location $location guide for more information} <add> * If object, sets `enabled`, `requireBase` and `rewriteLinks` to respective values. Supported <add> * properties: <add> * - **enabled** – `{boolean}` – (default: false) If true, will rely on `history.pushState` to <add> * change urls where supported. Will fall back to hash-prefixed paths in browsers that do not <add> * support `pushState`. <add> * - **requireBase** - `{boolean}` - (default: `true`) When html5Mode is enabled, specifies <add> * whether or not a <base> tag is required to be present. If `enabled` and `requireBase` are <add> * true, and a base tag is not present, an error will be thrown when `$location` is injected. <add> * See the {@link guide/$location $location guide for more information} <add> * - **rewriteLinks** - `{boolean}` - (default: `false`) When html5Mode is enabled, disables <add> * url rewriting for relative linksTurns off url rewriting for relative links. <ide> * <ide> * @returns {Object} html5Mode object if used as getter or itself (chaining) if used as setter <ide> */ <ide> function $LocationProvider(){ <ide> html5Mode.enabled = mode; <ide> return this; <ide> } else if (isObject(mode)) { <del> html5Mode.enabled = isBoolean(mode.enabled) ? <del> mode.enabled : <del> html5Mode.enabled; <del> html5Mode.requireBase = isBoolean(mode.requireBase) ? <del> mode.requireBase : <del> html5Mode.requireBase; <add> <add> if (isBoolean(mode.enabled)) { <add> html5Mode.enabled = mode.enabled; <add> } <add> <add> if (isBoolean(mode.requireBase)) { <add> html5Mode.requireBase = mode.requireBase; <add> } <add> <add> if (isBoolean(mode.rewriteLinks)) { <add> html5Mode.rewriteLinks = mode.rewriteLinks; <add> } <add> <ide> return this; <ide> } else { <ide> return html5Mode; <ide> function $LocationProvider(){ <ide> // TODO(vojta): rewrite link when opening in new tab/window (in legacy browser) <ide> // currently we open nice url link and redirect then <ide> <del> if (event.ctrlKey || event.metaKey || event.which == 2) return; <add> if (!html5Mode.rewriteLinks || event.ctrlKey || event.metaKey || event.which == 2) return; <ide> <ide> var elm = jqLite(event.target); <ide> <ide><path>test/ng/locationSpec.js <ide> describe('$location', function() { <ide> }); <ide> <ide> <add> it ('should not rewrite links when rewriting links is disabled', function() { <add> configureService('/a?b=c', true, true, '', 'some content', false); <add> inject( <add> initBrowser(), <add> initLocation(), <add> function($browser) { <add> browserTrigger(link, 'click'); <add> expectNoRewrite($browser); <add> } <add> ); <add> }); <add> <add> <ide> it('should rewrite full url links to same domain and base path', function() { <ide> configureService({linkHref: 'http://host.com/base/new', html5Mode: true}); <ide> inject( <ide> describe('$location', function() { <ide> <ide> <ide> describe('html5Mode', function() { <del> it('should set enabled and requireBase when called with object', function() { <add> it('should set enabled, requireBase and rewriteLinks when called with object', function() { <ide> module(function($locationProvider) { <add> $locationProvider.html5Mode({enabled: true, requireBase: false, rewriteLinks: false}); <ide> expect($locationProvider.html5Mode()).toEqual({ <del> enabled: false, <del> requireBase: true <add> enabled: true, <add> requireBase: false, <add> rewriteLinks: false <ide> }); <ide> }); <ide> <ide> describe('$location', function() { <ide> module(function($locationProvider) { <ide> $locationProvider.html5Mode({ <ide> enabled: 'duh', <del> requireBase: 'probably' <add> requireBase: 'probably', <add> rewriteLinks: 'nope' <ide> }); <ide> <ide> expect($locationProvider.html5Mode()).toEqual({ <ide> enabled: false, <del> requireBase: true <add> requireBase: true, <add> rewriteLinks: true <ide> }); <ide> }); <ide> <ide> describe('$location', function() { <ide> <ide> expect($locationProvider.html5Mode()).toEqual({ <ide> enabled: false, <del> requireBase: true <del> }); <del> }); <del> <del> inject(function(){}); <del> }); <del> <del> <del> it('should default to enabled:false and requireBase:true', function() { <del> module(function($locationProvider) { <del> expect($locationProvider.html5Mode()).toEqual({ <del> enabled: false, <del> requireBase: true <add> requireBase: true, <add> rewriteLinks: true <ide> }); <ide> }); <ide> <ide> inject(function(){}); <ide> }); <ide> <ide> <del> it('should return html5Mode object when called without value', function() { <add> it('should default to enabled:false, requireBase:true and rewriteLinks:true', function() { <ide> module(function($locationProvider) { <ide> expect($locationProvider.html5Mode()).toEqual({ <ide> enabled: false, <del> requireBase: true <add> requireBase: true, <add> rewriteLinks: true <ide> }); <ide> }); <ide>
2
Ruby
Ruby
rescue more cask errors
95a1c8570a28ac98ff1266e45b00122a025b22cf
<ide><path>Library/Homebrew/cleanup.rb <ide> def stale_cask?(scrub) <ide> <ide> cask = begin <ide> Cask::CaskLoader.load(name) <del> rescue Cask::CaskUnavailableError <add> rescue Cask::CaskError <ide> return false <ide> end <ide> <ide> def clean!(quiet: false, periodic: false) <ide> <ide> cask = begin <ide> Cask::CaskLoader.load(arg) <del> rescue Cask::CaskUnavailableError <add> rescue Cask::CaskError <ide> nil <ide> end <ide>
1
Python
Python
simplify pickling tests
43b66da6b596000a52162f6fc9e58a46c880172c
<ide><path>tests/test_model_pickling.py <ide> import pytest <del>import os <ide> import sys <del>import tempfile <ide> import numpy as np <ide> from numpy.testing import assert_allclose <del>from numpy.testing import assert_raises <ide> <del>from keras import backend as K <ide> from keras.models import Model, Sequential <ide> from keras.layers import Dense, Lambda, RepeatVector, TimeDistributed <ide> from keras.layers import Input <ide> import cPickle as pickle <ide> <ide> <del>skipif_no_tf_gpu = pytest.mark.skipif( <del> (K.backend() != 'tensorflow') or <del> (not K.tensorflow_backend._get_available_gpus()), <del> reason='Requires TensorFlow backend and a GPU') <del> <del> <ide> def test_sequential_model_pickling(): <ide> model = Sequential() <ide> model.add(Dense(2, input_shape=(3,)))
1
Python
Python
set default task group in dag.add_task method
ce0a6e51c2d4ee87e008e28897b2450778b51003
<ide><path>airflow/models/dag.py <ide> def add_task(self, task: Operator) -> None: <ide> <ide> :param task: the task you want to add <ide> """ <add> from airflow.utils.task_group import TaskGroupContext <add> <ide> if not self.start_date and not task.start_date: <ide> raise AirflowException("DAG is missing the start_date parameter") <ide> # if the task has no start date, assign it the same as the DAG <ide> def add_task(self, task: Operator) -> None: <ide> elif task.end_date and self.end_date: <ide> task.end_date = min(task.end_date, self.end_date) <ide> <add> task_id = task.task_id <add> if not task.task_group: <add> task_group = TaskGroupContext.get_current_task_group(self) <add> if task_group: <add> task_id = task_group.child_id(task_id) <add> task_group.add(task) <add> <ide> if ( <del> task.task_id in self.task_dict and self.task_dict[task.task_id] is not task <del> ) or task.task_id in self._task_group.used_group_ids: <del> raise DuplicateTaskIdFound(f"Task id '{task.task_id}' has already been added to the DAG") <add> task_id in self.task_dict and self.task_dict[task_id] is not task <add> ) or task_id in self._task_group.used_group_ids: <add> raise DuplicateTaskIdFound(f"Task id '{task_id}' has already been added to the DAG") <ide> else: <del> self.task_dict[task.task_id] = task <add> self.task_dict[task_id] = task <ide> task.dag = self <ide> # Add task_id to used_group_ids to prevent group_id and task_id collisions. <del> self._task_group.used_group_ids.add(task.task_id) <add> self._task_group.used_group_ids.add(task_id) <ide> <ide> self.task_count = len(self.task_dict) <ide> <ide><path>airflow/models/taskmixin.py <ide> def _set_relatives( <ide> ) <ide> <ide> if not self.has_dag(): <del> # If this task does not yet have a dag, add it to the same dag as the other task and <del> # put it in the dag's root TaskGroup. <add> # If this task does not yet have a dag, add it to the same dag as the other task. <ide> self.dag = dag <del> self.dag.task_group.add(self) <ide> <ide> def add_only_new(obj, item_set: Set[str], item: str) -> None: <ide> """Adds only new items to item set""" <ide> def add_only_new(obj, item_set: Set[str], item: str) -> None: <ide> for task in task_list: <ide> if dag and not task.has_dag(): <ide> # If the other task does not yet have a dag, add it to the same dag as this task and <del> # put it in the dag's root TaskGroup. <ide> dag.add_task(task) <del> dag.task_group.add(task) <ide> if upstream: <ide> add_only_new(task, task.downstream_task_ids, self.node_id) <ide> add_only_new(self, self.upstream_task_ids, task.node_id) <ide><path>tests/models/test_dag.py <ide> from airflow.utils.file import list_py_file_paths <ide> from airflow.utils.session import create_session, provide_session <ide> from airflow.utils.state import DagRunState, State, TaskInstanceState <add>from airflow.utils.task_group import TaskGroup, TaskGroupContext <ide> from airflow.utils.timezone import datetime as datetime_tz <ide> from airflow.utils.types import DagRunType <ide> from airflow.utils.weight_rule import WeightRule <ide> def test_create_dagrun_job_id_is_set(self): <ide> ) <ide> assert dr.creating_job_id == job_id <ide> <add> def test_dag_add_task_sets_default_task_group(self): <add> dag = DAG(dag_id="test_dag_add_task_sets_default_task_group", start_date=DEFAULT_DATE) <add> task_without_task_group = EmptyOperator(task_id="task_without_group_id") <add> default_task_group = TaskGroupContext.get_current_task_group(dag) <add> dag.add_task(task_without_task_group) <add> assert default_task_group.get_child_by_label("task_without_group_id") == task_without_task_group <add> <add> task_group = TaskGroup(group_id="task_group", dag=dag) <add> task_with_task_group = EmptyOperator(task_id="task_with_task_group", task_group=task_group) <add> dag.add_task(task_with_task_group) <add> assert task_group.get_child_by_label("task_with_task_group") == task_with_task_group <add> assert dag.get_task("task_group.task_with_task_group") == task_with_task_group <add> <ide> @parameterized.expand( <ide> [ <ide> (State.QUEUED,),
3
Javascript
Javascript
add flag scenario in test-fs-write-file-sync
02cd7069a8631a324298be9f24771fb0faf23639
<ide><path>test/parallel/test-fs-write-file-sync.js <ide> function closeSync() { <ide> openCount--; <ide> return fs._closeSync.apply(fs, arguments); <ide> } <add> <add>// Test writeFileSync with flags <add>const file4 = path.join(tmpdir.path, 'testWriteFileSyncFlags.txt'); <add> <add>fs.writeFileSync(file4, 'hello ', { encoding: 'utf8', flag: 'a' }); <add>fs.writeFileSync(file4, 'world!', { encoding: 'utf8', flag: 'a' }); <add> <add>content = fs.readFileSync(file4, { encoding: 'utf8' }); <add>assert.strictEqual(content, 'hello world!');
1
Javascript
Javascript
add support for .get(-number) closes
e532dfe5228217f55a33122a4438fd70522dbb4b
<ide><path>src/core.js <ide> jQuery.fn = jQuery.prototype = { <ide> return num == null ? <ide> <ide> // Return a 'clean' array <del> Array.prototype.slice.call( this ) : <add> this.toArray() : <ide> <ide> // Return just the object <del> this[ num ]; <add> ( num < 0 ? this.toArray.call(this, num)[0] : this[ num ] ); <ide> }, <ide> <ide> // Take an array of elements and push it onto the stack <ide><path>test/unit/core.js <ide> test("get(Number)", function() { <ide> equals( jQuery("p").get(0), document.getElementById("firstp"), "Get A Single Element" ); <ide> }); <ide> <add>test("get(-Number)",function() { <add> expect(1); <add> equals( jQuery("p").get(-1), <add> document.getElementById("first"), <add> "Get a single element with negative index" ) <add>}) <add> <ide> test("add(String|Element|Array|undefined)", function() { <ide> expect(12); <ide> isSet( jQuery("#sndp").add("#en").add("#sap").get(), q("sndp", "en", "sap"), "Check elements from document" );
2
Python
Python
use norm attribute, not lower
8a17b99b1c1107a632729fccf8c558faf2f764b6
<ide><path>spacy/_ml.py <ide> from thinc.describe import Dimension, Synapses, Biases, Gradient <ide> from thinc.neural._classes.affine import _set_dimensions_if_needed <ide> <del>from .attrs import ID, LOWER, PREFIX, SUFFIX, SHAPE, TAG, DEP <add>from .attrs import ID, NORM, PREFIX, SUFFIX, SHAPE, TAG, DEP <ide> from .tokens.doc import Doc <ide> <ide> import numpy <ide> def backward(dYp_ids, sgd=None): <ide> return Yfp, backward <ide> <ide> def Tok2Vec(width, embed_size, preprocess=None): <del> cols = [ID, LOWER, PREFIX, SUFFIX, SHAPE] <add> cols = [ID, NORM, PREFIX, SUFFIX, SHAPE] <ide> with Model.define_operators({'>>': chain, '|': concatenate, '**': clone, '+': add}): <del> lower = get_col(cols.index(LOWER)) >> HashEmbed(width, embed_size, name='embed_lower') <add> norm = get_col(cols.index(NORM)) >> HashEmbed(width, embed_size, name='embed_lower') <ide> prefix = get_col(cols.index(PREFIX)) >> HashEmbed(width, embed_size//2, name='embed_prefix') <ide> suffix = get_col(cols.index(SUFFIX)) >> HashEmbed(width, embed_size//2, name='embed_suffix') <ide> shape = get_col(cols.index(SHAPE)) >> HashEmbed(width, embed_size//2, name='embed_shape') <ide> <del> embed = (lower | prefix | suffix | shape ) <add> embed = (norm | prefix | suffix | shape ) <ide> tok2vec = ( <ide> with_flatten( <ide> asarray(Model.ops, dtype='uint64') <ide> def Tok2Vec(width, embed_size, preprocess=None): <ide> >> Residual(ExtractWindow(nW=1) >> Maxout(width, width*3)) <ide> >> Residual(ExtractWindow(nW=1) >> Maxout(width, width*3)) <ide> >> Residual(ExtractWindow(nW=1) >> Maxout(width, width*3)), <del> pad=4, ndim=5) <add> pad=4) <ide> ) <ide> if preprocess not in (False, None): <ide> tok2vec = preprocess >> tok2vec <ide> def _hook(self, X, y=None): <ide> <ide> <ide> def doc2feats(cols=None): <del> cols = [ID, LOWER, PREFIX, SUFFIX, SHAPE] <add> cols = [ID, NORM, PREFIX, SUFFIX, SHAPE] <ide> def forward(docs, drop=0.): <ide> feats = [] <ide> for doc in docs:
1
Mixed
Text
log any errors originating from the socket
fc416d3721a019efbbd249abfb5ab7daf34c2a64
<ide><path>actioncable/CHANGELOG.md <add>* ActionCable socket errors are now logged to the console <add> <add> Previously any socket errors were ignored and this made it hard to diagnose socket issues (e.g. as discussed in #28362). <add> <add> *Edward Poot* <add> <ide> Please check [5-1-stable](https://github.com/rails/rails/blob/5-1-stable/actioncable/CHANGELOG.md) for previous changes. <ide><path>actioncable/lib/action_cable/connection/base.rb <ide> def on_message(message) # :nodoc: <ide> end <ide> <ide> def on_error(message) # :nodoc: <del> # ignore <add> # log errors to make diagnosing socket errors easier <add> logger.error "WebSocket error occurred: #{message}" <ide> end <ide> <ide> def on_close(reason, code) # :nodoc:
2
Javascript
Javascript
fix wrong error classes passed in as type
f26cabbe249ae6e095736ef65bd925fb82c4908c
<ide><path>test/parallel/test-crypto-sign-verify.js <ide> common.expectsError( <ide> }, ''), <ide> { <ide> code: 'ERR_INVALID_OPT_VALUE', <del> type: Error, <add> type: TypeError, <ide> message: 'The value "undefined" is invalid for option "padding"' <ide> }); <ide> <ide> common.expectsError( <ide> }, ''), <ide> { <ide> code: 'ERR_INVALID_OPT_VALUE', <del> type: Error, <add> type: TypeError, <ide> message: 'The value "undefined" is invalid for option "saltLength"' <ide> }); <ide> <ide><path>test/parallel/test-fs-timestamp-parsing-error.js <ide> const assert = require('assert'); <ide> }, <ide> { <ide> code: 'ERR_INVALID_ARG_TYPE', <del> type: Error <add> type: TypeError <ide> }); <ide> }); <ide> <ide> common.expectsError( <ide> }, <ide> { <ide> code: 'ERR_INVALID_ARG_TYPE', <del> type: Error <add> type: TypeError <ide> }); <ide> <ide> const okInputs = [1, -1, '1', '-1', Date.now()]; <ide><path>test/parallel/test-http2-client-http1-server.js <ide> 'use strict'; <add>// Flags: --expose-internals <ide> <ide> const common = require('../common'); <ide> if (!common.hasCrypto) <ide> common.skip('missing crypto'); <ide> <ide> const http = require('http'); <ide> const http2 = require('http2'); <add>const { NghttpError } = require('internal/http2/util'); <ide> <ide> // Creating an http1 server here... <ide> const server = http.createServer(common.mustNotCall()); <ide> server.listen(0, common.mustCall(() => { <ide> <ide> req.on('error', common.expectsError({ <ide> code: 'ERR_HTTP2_ERROR', <del> type: Error, <add> type: NghttpError, <ide> message: 'Protocol error' <ide> })); <ide> <ide> client.on('error', common.expectsError({ <ide> code: 'ERR_HTTP2_ERROR', <del> type: Error, <add> type: NghttpError, <add> name: 'Error [ERR_HTTP2_ERROR]', <ide> message: 'Protocol error' <ide> })); <ide> <ide><path>test/parallel/test-http2-client-onconnect-errors.js <ide> 'use strict'; <add>// Flags: --expose-internals <ide> <ide> const common = require('../common'); <ide> if (!common.hasCrypto) <ide> const { <ide> nghttp2ErrorString <ide> } = process.binding('http2'); <ide> const http2 = require('http2'); <add>const { NghttpError } = require('internal/http2/util'); <ide> <ide> // tests error handling within requestOnConnect <ide> // - NGHTTP2_ERR_STREAM_ID_NOT_AVAILABLE (should emit session error) <ide> const genericTests = Object.getOwnPropertyNames(constants) <ide> ngError: constants[key], <ide> error: { <ide> code: 'ERR_HTTP2_ERROR', <del> type: Error, <add> type: NghttpError, <add> name: 'Error [ERR_HTTP2_ERROR]', <ide> message: nghttp2ErrorString(constants[key]) <ide> }, <ide> type: 'session' <ide><path>test/parallel/test-http2-info-headers-errors.js <ide> 'use strict'; <add>// Flags: --expose-internals <ide> <ide> const common = require('../common'); <ide> if (!common.hasCrypto) <ide> const { <ide> Http2Stream, <ide> nghttp2ErrorString <ide> } = process.binding('http2'); <add>const { NghttpError } = require('internal/http2/util'); <ide> <ide> // tests error handling within additionalHeaders <ide> // - every other NGHTTP2 error from binding (should emit stream error) <ide> const genericTests = Object.getOwnPropertyNames(constants) <ide> ngError: constants[key], <ide> error: { <ide> code: 'ERR_HTTP2_ERROR', <del> type: Error, <add> type: NghttpError, <add> name: 'Error [ERR_HTTP2_ERROR]', <ide> message: nghttp2ErrorString(constants[key]) <ide> }, <ide> type: 'stream' <ide><path>test/parallel/test-http2-misbehaving-multiplex.js <ide> 'use strict'; <add>// Flags: --expose-internals <ide> <ide> const common = require('../common'); <ide> <ide> if (!common.hasCrypto) <ide> <ide> const h2 = require('http2'); <ide> const net = require('net'); <add>const { NghttpError } = require('internal/http2/util'); <ide> const h2test = require('../common/http2'); <ide> let client; <ide> <ide> server.on('stream', common.mustCall((stream) => { <ide> server.on('session', common.mustCall((session) => { <ide> session.on('error', common.expectsError({ <ide> code: 'ERR_HTTP2_ERROR', <del> type: Error, <add> type: NghttpError, <ide> message: 'Stream was already closed or invalid' <ide> })); <ide> })); <ide><path>test/parallel/test-http2-respond-errors.js <ide> 'use strict'; <add>// Flags: --expose-internals <ide> <ide> const common = require('../common'); <ide> if (!common.hasCrypto) <ide> const { <ide> Http2Stream, <ide> nghttp2ErrorString <ide> } = process.binding('http2'); <add>const { NghttpError } = require('internal/http2/util'); <ide> <ide> // tests error handling within respond <ide> // - every other NGHTTP2 error from binding (should emit stream error) <ide> const genericTests = Object.getOwnPropertyNames(constants) <ide> ngError: constants[key], <ide> error: { <ide> code: 'ERR_HTTP2_ERROR', <del> type: Error, <add> type: NghttpError, <add> name: 'Error [ERR_HTTP2_ERROR]', <ide> message: nghttp2ErrorString(constants[key]) <ide> }, <ide> type: 'stream' <ide><path>test/parallel/test-http2-respond-with-fd-errors.js <ide> 'use strict'; <add>// Flags: --expose-internals <ide> <ide> const common = require('../common'); <ide> <ide> const { <ide> Http2Stream, <ide> nghttp2ErrorString <ide> } = process.binding('http2'); <add>const { NghttpError } = require('internal/http2/util'); <ide> <ide> // tests error handling within processRespondWithFD <ide> // (called by respondWithFD & respondWithFile) <ide> const genericTests = Object.getOwnPropertyNames(constants) <ide> ngError: constants[key], <ide> error: { <ide> code: 'ERR_HTTP2_ERROR', <del> type: Error, <add> type: NghttpError, <add> name: 'Error [ERR_HTTP2_ERROR]', <ide> message: nghttp2ErrorString(constants[key]) <ide> }, <ide> type: 'stream' <ide><path>test/parallel/test-http2-server-http1-client.js <ide> 'use strict'; <add>// Flags: --expose-internals <ide> <ide> const common = require('../common'); <ide> <ide> if (!common.hasCrypto) <ide> <ide> const http = require('http'); <ide> const http2 = require('http2'); <add>const { NghttpError } = require('internal/http2/util'); <ide> <ide> const server = http2.createServer(); <ide> server.on('stream', common.mustNotCall()); <ide> server.on('session', common.mustCall((session) => { <ide> session.on('close', common.mustCall()); <ide> session.on('error', common.expectsError({ <ide> code: 'ERR_HTTP2_ERROR', <del> type: Error, <add> type: NghttpError, <ide> message: 'Received bad client magic byte string' <ide> })); <ide> })); <ide><path>test/parallel/test-http2-server-push-stream-errors.js <ide> 'use strict'; <add>// Flags: --expose-internals <ide> <ide> const common = require('../common'); <ide> if (!common.hasCrypto) <ide> const { <ide> Http2Stream, <ide> nghttp2ErrorString <ide> } = process.binding('http2'); <add>const { NghttpError } = require('internal/http2/util'); <ide> <ide> // tests error handling within pushStream <ide> // - NGHTTP2_ERR_STREAM_ID_NOT_AVAILABLE (should emit session error) <ide> const genericTests = Object.getOwnPropertyNames(constants) <ide> ngError: constants[key], <ide> error: { <ide> code: 'ERR_HTTP2_ERROR', <del> type: Error, <add> type: NghttpError, <add> name: 'Error [ERR_HTTP2_ERROR]', <ide> message: nghttp2ErrorString(constants[key]) <ide> }, <ide> type: 'stream' <ide><path>test/parallel/test-internal-errors.js <ide> assert.doesNotThrow(() => { <ide> assert.doesNotThrow(() => { <ide> common.expectsError(() => { <ide> throw new errors.TypeError('TEST_ERROR_1', 'a'); <del> }, { code: 'TEST_ERROR_1', type: Error }); <add> }, { <add> code: 'TEST_ERROR_1', <add> type: TypeError, <add> message: 'Error for testing purposes: a' <add> }); <ide> }); <ide> <ide> common.expectsError(() => { <ide><path>test/parallel/test-ttywrap-invalid-fd.js <ide> 'use strict'; <add>// Flags: --expose-internals <add> <ide> const common = require('../common'); <ide> const fs = require('fs'); <ide> const tty = require('tty'); <add>const { SystemError } = require('internal/errors'); <ide> <ide> common.expectsError( <ide> () => new tty.WriteStream(-1), <ide> common.expectsError( <ide> new tty.WriteStream(fd); <ide> }, { <ide> code: 'ERR_SYSTEM_ERROR', <del> type: Error, <add> type: SystemError, <ide> message <ide> } <ide> ); <ide> common.expectsError( <ide> new tty.ReadStream(fd); <ide> }, { <ide> code: 'ERR_SYSTEM_ERROR', <del> type: Error, <add> type: SystemError, <ide> message <ide> }); <ide> }
12
Ruby
Ruby
use `path` where possible
7cadff0a33d062b526d2ac246bd1d9e6cc689f53
<ide><path>Library/Homebrew/dev-cmd/update-test.rb <ide> def update_test <ide> safe_system "git", "reset", "--hard", start_commit <ide> <ide> # update ENV["PATH"] <del> ENV["PATH"] = "#{curdir}/bin:#{ENV["PATH"]}" <add> ENV["PATH"] = PATH.new(ENV["PATH"]).prepend(curdir/"bin") <ide> <ide> # run brew update <ide> oh1 "Running brew update..." <ide><path>Library/Homebrew/utils.rb <ide> def inject_dump_stats!(the_module, pattern) <ide> <ide> def with_system_path <ide> old_path = ENV["PATH"] <del> ENV["PATH"] = "/usr/bin:/bin" <add> ENV["PATH"] = PATH.new("/usr/bin", "/bin") <ide> yield <ide> ensure <ide> ENV["PATH"] = old_path
2
PHP
PHP
apply fixes from styleci
7801e2a6dc5a6fb8be2a11fa7226e2ad868a8d02
<ide><path>src/Illuminate/Support/Traits/ReflectsClosures.php <ide> <ide> use Closure; <ide> use ReflectionFunction; <del>use ReflectionParameter; <ide> use RuntimeException; <ide> <ide> trait ReflectsClosures
1
PHP
PHP
fix bug in url generation
59fca940a3e59d91461e3b4d5dbe809146f38e72
<ide><path>src/Illuminate/Routing/UrlGenerator.php <ide> public function route($name, $parameters = array(), $route = null) <ide> * Get the URL for a given route instance. <ide> * <ide> * @param \Illuminate\Routing\Route $route <del> * @param mixed $parameters <add> * @param array $parameters <ide> * @return string <ide> */ <del> protected function toRoute($route, $parameters) <add> protected function toRoute($route, array $parameters) <ide> { <ide> $domain = $this->getRouteDomain($route, $parameters); <ide> <del> $path = preg_replace_sub('/\{.*?\}/', $parameters, $route->uri()); <add> return $this->replaceRouteParameters( <add> <add> $this->trimUrl($this->getRouteRoot($route, $domain), $route->uri()), $parameters <add> <add> ); <add> } <add> <add> /** <add> * Replace all of the wildcard parameters for a route path. <add> * <add> * @param string $path <add> * @param array $parameters <add> * @return string <add> */ <add> protected function replaceRouteParameters($path, array $parameters) <add> { <add> foreach ($parameters as $key => $value) <add> { <add> $path = $this->replaceRouteParameter($path, $key, $value, $parameters); <add> } <add> <add> return $path.$this->getRouteQueryString($parameters); <add> } <add> <add> /** <add> * Replace a given route parameter for a route path. <add> * <add> * @param string $path <add> * @param string $key <add> * @param string $value <add> * @param array $parameters <add> * @return string <add> */ <add> protected function replaceRouteParameter($path, $key, $value, array &$parameters) <add> { <add> $pattern = is_string($key) ? '/\{'.$key.'[\?]?\}/' : '/\{.*?\}/'; <add> <add> $path = preg_replace($pattern, $value, $path, 1, $count); <add> <add> // If the parameter was actually replaced in the route path, we are going to remove <add> // it from the parameter array (by reference), which is so we can use any of the <add> // extra parameters as query string variables once we process all the matches. <add> if ($count > 0) unset($parameters[$key]); <add> <add> return $path; <add> } <add> <add> /** <add> * Get the query string for a given route. <add> * <add> * @param array $parameters <add> * @return string <add> */ <add> protected function getRouteQueryString(array $parameters) <add> { <add> if (count($parameters) == 0) return ''; <add> <add> $query = http_build_query($keyed = $this->getStringParameters($parameters)); <ide> <del> $query = count($parameters) > 0 ? '?'.http_build_query($parameters) : ''; <add> if (count($keyed) < count($parameters)) <add> { <add> $query .= '&'.implode('&', $this->getNumericParameters($parameters)); <add> } <ide> <del> return $this->trimUrl($this->getRouteRoot($route, $domain), $path.$query); <add> return '?'.trim($query, '&'); <add> } <add> <add> /** <add> * Get the string parameters from a given list. <add> * <add> * @param array $parameters <add> * @return array <add> */ <add> protected function getStringParameters(array $parameters) <add> { <add> return array_where($parameters, function($k, $v) { return is_string($k); }); <add> } <add> <add> /** <add> * Get the numeric parameters from a given list. <add> * <add> * @param array $parameters <add> * @return array <add> */ <add> protected function getNumericParameters(array $parameters) <add> { <add> return array_where($parameters, function($k, $v) { return is_numeric($k); }); <ide> } <ide> <ide> /** <ide> protected function getRouteDomain($route, &$parameters) <ide> */ <ide> protected function formatDomain($route, &$parameters) <ide> { <del> return $this->addPortToDomain(preg_replace_sub( <del> <del> '/\{.*?\}/', $parameters, $this->getDomainAndScheme($route) <del> <del> )); <add> return $this->addPortToDomain($this->getDomainAndScheme($route)); <ide> } <ide> <ide> /**
1
Text
Text
remove unnecessary # in changelog
ca4250a1e0bd10955ddfcd027dcc525d29f4c55a
<ide><path>CHANGELOG.md <ide> ## 15.5.4 (April 11, 2017) <ide> <ide> ### React Addons <del>* **Critical Bugfix:** Update the version of `prop-types` to fix critical bug. ([@gaearon](https://github.com/gaearon) in [#545c87f](https://github.com/facebook/react/commit/545c87fdc348f82eb0c3830bef715ed180785390)) <add>* **Critical Bugfix:** Update the version of `prop-types` to fix critical bug. ([@gaearon](https://github.com/gaearon) in [545c87f](https://github.com/facebook/react/commit/545c87fdc348f82eb0c3830bef715ed180785390)) <ide> <ide> ### React Test Renderer <ide> * Fix compatibility with Enzyme by exposing `batchedUpdates` on shallow renderer. ([@gaearon](https://github.com/gaearon) in [#9382](https://github.com/facebook/react/commit/69933e25c37cf5453a9ef132177241203ee8d2fd))
1
Javascript
Javascript
use proper window object for iframe in enter/leave
a2ecee5353d39be57ca49c6132eb0ca45d5be254
<ide><path>src/eventPlugins/EnterLeaveEventPlugin.js <ide> var EnterLeaveEventPlugin = { <ide> return null; <ide> } <ide> <add> var win; <add> if (topLevelTarget != null && topLevelTarget.window === topLevelTarget) { <add> // topLevelTarget probably is a window object <add> win = topLevelTarget; <add> } else { <add> var doc = topLevelTarget.ownerDocument; <add> win = doc.defaultView || doc.parentWindow; <add> } <add> <ide> var from, to; <ide> if (topLevelType === topLevelTypes.topMouseOut) { <ide> from = topLevelTarget; <ide> to = <ide> getFirstReactDOM(nativeEvent.relatedTarget || nativeEvent.toElement) || <del> window; <add> win; <ide> } else { <del> from = window; <add> from = win; <ide> to = topLevelTarget; <ide> } <ide> <ide><path>src/eventPlugins/__tests__/EnterLeaveEventPlugin-test.js <add>/** <add> * Copyright 2013 Facebook, Inc. <add> * <add> * Licensed under the Apache License, Version 2.0 (the "License"); <add> * you may not use this file except in compliance with the License. <add> * You may obtain a copy of the License at <add> * <add> * http://www.apache.org/licenses/LICENSE-2.0 <add> * <add> * Unless required by applicable law or agreed to in writing, software <add> * distributed under the License is distributed on an "AS IS" BASIS, <add> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <add> * See the License for the specific language governing permissions and <add> * limitations under the License. <add> * <add> * @jsx React.DOM <add> * @emails react-core <add> */ <add> <add>"use strict"; <add> <add>var EnterLeaveEventPlugin; <add>var EventConstants; <add>var React; <add>var ReactMount; <add> <add>var topLevelTypes; <add> <add>describe('EnterLeaveEventPlugin', function() { <add> beforeEach(function() { <add> require('mock-modules').dumpCache(); <add> <add> EnterLeaveEventPlugin = require('EnterLeaveEventPlugin'); <add> EventConstants = require('EventConstants'); <add> React = require('React'); <add> ReactMount = require('ReactMount'); <add> <add> topLevelTypes = EventConstants.topLevelTypes; <add> }); <add> <add> it('should set relatedTarget properly in iframe', function() { <add> var iframe = document.createElement('iframe'); <add> document.body.appendChild(iframe); <add> <add> var component = React.renderComponent(<div />, iframe.contentDocument.body); <add> var div = component.getDOMNode(); <add> <add> var extracted = EnterLeaveEventPlugin.extractEvents( <add> topLevelTypes.topMouseOver, <add> div, <add> ReactMount.getID(div), <add> {target: div} <add> ); <add> expect(extracted.length).toBe(2); <add> <add> var leave = extracted[0]; <add> var enter = extracted[1]; <add> <add> expect(leave.target).toBe(iframe.contentWindow); <add> expect(leave.relatedTarget).toBe(div); <add> expect(enter.target).toBe(div); <add> expect(enter.relatedTarget).toBe(iframe.contentWindow); <add> }); <add>});
2
Text
Text
add snake_case section for c-like structs
c8f88471204cb30b5a1b5ac72173be547654023a
<ide><path>CPP_STYLE_GUIDE.md <ide> * [CamelCase for methods, functions, and classes](#camelcase-for-methods-functions-and-classes) <ide> * [snake\_case for local variables and parameters](#snake_case-for-local-variables-and-parameters) <ide> * [snake\_case\_ for private class fields](#snake_case_-for-private-class-fields) <add> * [snake\_case\_ for C-like structs](#snake_case_-for-c-like-structs) <ide> * [Space after `template`](#space-after-template) <ide> * [Memory Management](#memory-management) <ide> * [Memory allocation](#memory-allocation) <ide> class Foo { <ide> }; <ide> ``` <ide> <add>## snake\_case\_ for C-like structs <add>For plain C-like structs snake_case can be used. <add> <add>```c++ <add>struct foo_bar { <add> int name; <add>} <add>``` <add> <ide> ## Space after `template` <ide> <ide> ```c++
1
Javascript
Javascript
preserve selection on exiting owner mode
f2951fb51fa338da7a651cf414a074f2acf8b4cb
<ide><path>src/devtools/views/Components/TreeContext.js <ide> function reduceOwnersState(store: Store, state: State, action: Action): State { <ide> case 'RESET_OWNER_STACK': <ide> ownerStack = []; <ide> ownerStackIndex = null; <del> selectedElementIndex = null; <add> selectedElementIndex = <add> selectedElementID !== null <add> ? store.getIndexOfElementID(selectedElementID) <add> : null; <ide> _ownerFlatTree = null; <ide> break; <ide> case 'SELECT_ELEMENT_AT_INDEX':
1
Text
Text
add basic embedding example documentation
e04f599258bb8e733a507867d42d5e46d35d7bca
<ide><path>doc/api/embedding.md <add># C++ Embedder API <add> <add><!--introduced_in=REPLACEME--> <add> <add>Node.js provides a number of C++ APIs that can be used to execute JavaScript <add>in a Node.js environment from other C++ software. <add> <add>The documentation for these APIs can be found in [src/node.h][] in the Node.js <add>source tree. In addition to the APIs exposed by Node.js, some required concepts <add>are provided by the V8 embedder API. <add> <add>Because using Node.js as an embedded library is different from writing code <add>that is executed by Node.js, breaking changes do not follow typical Node.js <add>[deprecation policy][] and may occur on each semver-major release without prior <add>warning. <add> <add>## Example embedding application <add> <add>The following sections will provide an overview over how to use these APIs <add>to create an application from scratch that will perform the equivalent of <add>`node -e <code>`, i.e. that will take a piece of JavaScript and run it in <add>a Node.js-specific environment. <add> <add>The full code can be found [in the Node.js source tree][embedtest.cc]. <add> <add>### Setting up per-process state <add> <add>Node.js requires some per-process state management in order to run: <add> <add>* Arguments parsing for Node.js [CLI options][], <add>* V8 per-process requirements, such as a `v8::Platform` instance. <add> <add>The following example shows how these can be set up. Some class names are from <add>the `node` and `v8` C++ namespaces, respectively. <add> <add>```c++ <add>int main(int argc, char** argv) { <add> std::vector<std::string> args(argv, argv + argc); <add> std::vector<std::string> exec_args; <add> std::vector<std::string> errors; <add> // Parse Node.js CLI options, and print any errors that have occurred while <add> // trying to parse them. <add> int exit_code = node::InitializeNodeWithArgs(&args, &exec_args, &errors); <add> for (const std::string& error : errors) <add> fprintf(stderr, "%s: %s\n", args[0].c_str(), error.c_str()); <add> if (exit_code != 0) { <add> return exit_code; <add> } <add> <add> // Create a v8::Platform instance. `MultiIsolatePlatform::Create()` is a way <add> // to create a v8::Platform instance that Node.js can use when creating <add> // Worker threads. When no `MultiIsolatePlatform` instance is present, <add> // Worker threads are disabled. <add> std::unique_ptr<MultiIsolatePlatform> platform = <add> MultiIsolatePlatform::Create(4); <add> V8::InitializePlatform(platform.get()); <add> V8::Initialize(); <add> <add> // See below for the contents of this function. <add> int ret = RunNodeInstance(platform.get(), args, exec_args); <add> <add> V8::Dispose(); <add> V8::ShutdownPlatform(); <add> return ret; <add>} <add>``` <add> <add>### Per-instance state <add> <add>Node.js has a concept of a “Node.js instance”, that is commonly being referred <add>to as `node::Environment`. Each `node::Environment` is associated with: <add> <add>* Exactly one `v8::Isolate`, i.e. one JS Engine instance, <add>* Exactly one `uv_loop_t`, i.e. one event loop, and <add>* A number of `v8::Context`s, but exactly one main `v8::Context`. <add>* One `node::IsolateData` instance that contains information that could be <add> shared by multiple `node::Environment`s that use the same `v8::Isolate`. <add> Currently, no testing if performed for this scenario. <add> <add>In order to set up a `v8::Isolate`, an `v8::ArrayBuffer::Allocator` needs <add>to be provided. One possible choice is the default Node.js allocator, which <add>can be created through `node::ArrayBufferAllocator::Create()`. Using the Node.js <add>allocator allows minor performance optimizations when addons use the Node.js <add>C++ `Buffer` API, and is required in order to track `ArrayBuffer` memory in <add>[`process.memoryUsage()`][]. <add> <add>Additionally, each `v8::Isolate` that is used for a Node.js instance needs to <add>be registered and unregistered with the `MultiIsolatePlatform` instance, if one <add>is being used, in order for the platform to know which event loop to use <add>for tasks scheduled by the `v8::Isolate`. <add> <add>The `node::NewIsolate()` helper function creates a `v8::Isolate`, <add>sets it up with some Node.js-specific hooks (e.g. the Node.js error handler), <add>and registers it with the platform automatically. <add> <add>```c++ <add>int RunNodeInstance(MultiIsolatePlatform* platform, <add> const std::vector<std::string>& args, <add> const std::vector<std::string>& exec_args) { <add> int exit_code = 0; <add> // Set up a libuv event loop. <add> uv_loop_t loop; <add> int ret = uv_loop_init(&loop); <add> if (ret != 0) { <add> fprintf(stderr, "%s: Failed to initialize loop: %s\n", <add> args[0].c_str(), <add> uv_err_name(ret)); <add> return 1; <add> } <add> <add> std::shared_ptr<ArrayBufferAllocator> allocator = <add> ArrayBufferAllocator::Create(); <add> <add> Isolate* isolate = NewIsolate(allocator, &loop, platform); <add> if (isolate == nullptr) { <add> fprintf(stderr, "%s: Failed to initialize V8 Isolate\n", args[0].c_str()); <add> return 1; <add> } <add> <add> { <add> Locker locker(isolate); <add> Isolate::Scope isolate_scope(isolate); <add> <add> // Create a node::IsolateData instance that will later be released using <add> // node::FreeIsolateData(). <add> std::unique_ptr<IsolateData, decltype(&node::FreeIsolateData)> isolate_data( <add> node::CreateIsolateData(isolate, &loop, platform, allocator.get()), <add> node::FreeIsolateData); <add> <add> // Set up a new v8::Context. <add> HandleScope handle_scope(isolate); <add> Local<Context> context = node::NewContext(isolate); <add> if (context.IsEmpty()) { <add> fprintf(stderr, "%s: Failed to initialize V8 Context\n", args[0].c_str()); <add> return 1; <add> } <add> <add> // The v8::Context needs to be entered when node::CreateEnvironment() and <add> // node::LoadEnvironment() are being called. <add> Context::Scope context_scope(context); <add> <add> // Create a node::Environment instance that will later be released using <add> // node::FreeEnvironment(). <add> std::unique_ptr<Environment, decltype(&node::FreeEnvironment)> env( <add> node::CreateEnvironment(isolate_data.get(), context, args, exec_args), <add> node::FreeEnvironment); <add> <add> // Set up the Node.js instance for execution, and run code inside of it. <add> // There is also a variant that takes a callback and provides it with <add> // the `require` and `process` objects, so that it can manually compile <add> // and run scripts as needed. <add> // The `require` function inside this script does *not* access the file <add> // system, and can only load built-in Node.js modules. <add> // `module.createRequire()` is being used to create one that is able to <add> // load files from the disk, and uses the standard CommonJS file loader <add> // instead of the internal-only `require` function. <add> MaybeLocal<Value> loadenv_ret = node::LoadEnvironment( <add> env.get(), <add> "const publicRequire =" <add> " require('module').createRequire(process.cwd() + '/');" <add> "globalThis.require = publicRequire;" <add> "require('vm').runInThisContext(process.argv[1]);"); <add> <add> if (loadenv_ret.IsEmpty()) // There has been a JS exception. <add> return 1; <add> <add> { <add> // SealHandleScope protects against handle leaks from callbacks. <add> SealHandleScope seal(isolate); <add> bool more; <add> do { <add> uv_run(&loop, UV_RUN_DEFAULT); <add> <add> // V8 tasks on background threads may end up scheduling new tasks in the <add> // foreground, which in turn can keep the event loop going. For example, <add> // WebAssembly.compile() may do so. <add> platform->DrainTasks(isolate); <add> <add> // If there are new tasks, continue. <add> more = uv_loop_alive(&loop); <add> if (more) continue; <add> <add> // node::EmitBeforeExit() is used to emit the 'beforeExit' event on <add> // the `process` object. <add> node::EmitBeforeExit(env.get()); <add> <add> // 'beforeExit' can also schedule new work that keeps the event loop <add> // running. <add> more = uv_loop_alive(&loop); <add> } while (more == true); <add> } <add> <add> // node::EmitExit() returns the current exit code. <add> exit_code = node::EmitExit(env.get()); <add> <add> // node::Stop() can be used to explicitly stop the event loop and keep <add> // further JavaScript from running. It can be called from any thread, <add> // and will act like worker.terminate() if called from another thread. <add> node::Stop(env.get()); <add> } <add> <add> // Unregister the Isolate with the platform and add a listener that is called <add> // when the Platform is done cleaning up any state it had associated with <add> // the Isolate. <add> bool platform_finished = false; <add> platform->AddIsolateFinishedCallback(isolate, [](void* data) { <add> *static_cast<bool*>(data) = true; <add> }, &platform_finished); <add> platform->UnregisterIsolate(isolate); <add> isolate->Dispose(); <add> <add> // Wait until the platform has cleaned up all relevant resources. <add> while (!platform_finished) <add> uv_run(&loop, UV_RUN_ONCE); <add> int err = uv_loop_close(&loop); <add> assert(err == 0); <add> <add> return exit_code; <add>} <add>``` <add> <add>[`process.memoryUsage()`]: process.html#process_process_memoryusage <add>[CLI options]: cli.html <add>[deprecation policy]: deprecations.html <add>[embedtest.cc]: https://github.com/nodejs/node/blob/master/test/embedding/embedtest.cc <add>[src/node.h]: https://github.com/nodejs/node/blob/master/src/node.h <ide><path>doc/api/index.md <ide> * [Buffer](buffer.html) <ide> * [C++ Addons](addons.html) <ide> * [C/C++ Addons with N-API](n-api.html) <add>* [C++ Embedder API](embedding.html) <ide> * [Child Processes](child_process.html) <ide> * [Cluster](cluster.html) <ide> * [Command Line Options](cli.html)
2