content_type
stringclasses
8 values
main_lang
stringclasses
7 values
message
stringlengths
1
50
sha
stringlengths
40
40
patch
stringlengths
52
962k
file_count
int64
1
300
Javascript
Javascript
add plane.flip() plus unit test
911146dba1eb2e5e43eb838757ef27fe958407ca
<ide><path>src/math/Plane.js <ide> THREE.Plane.prototype = { <ide> <ide> }, <ide> <add> flip: function () { <add> <add> this.constant *= -1; <add> this.normal.negate(); <add> <add> return this; <add> <add> }, <add> <ide> distanceToPoint: function ( point ) { <ide> <ide> return this.normal.dot( point ) + this.constant; <ide><path>test/unit/math/Plane.js <ide> test( "normalize", function() { <ide> ok( a.constant == 1, "Passed!" ); <ide> }); <ide> <add>test( "flip/distanceToPoint", function() { <add> var a = new THREE.Plane( new THREE.Vector3( 2, 0, 0 ), -2 ); <add> <add> a.normalize(); <add> ok( a.distanceToPoint( new THREE.Vector3( 4, 0, 0 ) ) === 3, "Passed!" ); <add> ok( a.distanceToPoint( new THREE.Vector3( 1, 0, 0 ) ) === 0, "Passed!" ); <add> <add> a.flip(); <add> ok( a.distanceToPoint( new THREE.Vector3( 4, 0, 0 ) ) === -3, "Passed!" ); <add> ok( a.distanceToPoint( new THREE.Vector3( 1, 0, 0 ) ) === 0, "Passed!" ); <add>}); <add> <ide> test( "distanceToPoint", function() { <ide> var a = new THREE.Plane( new THREE.Vector3( 2, 0, 0 ), -2 ); <ide>
2
Text
Text
fix typo in doc
c5e2116ead1792a9e23d094b6793fad80a979746
<ide><path>docs/templates/index.md <ide> Keras is compatible with: __Python 2.7-3.5__. <ide> <ide> ## Getting started: 30 seconds to Keras <ide> <del>The core data structure of Keras is a __model__, a way to organize layers. The main type of model is the [`Sequential`](http://keras.io/getting-started/sequential-model-guide) model, a linear stack of layers. For more complex architectures, you should use the [Keras function API](http://keras.io/getting-started/functional-api-guide). <add>The core data structure of Keras is a __model__, a way to organize layers. The main type of model is the [`Sequential`](http://keras.io/getting-started/sequential-model-guide) model, a linear stack of layers. For more complex architectures, you should use the [Keras functional API](http://keras.io/getting-started/functional-api-guide). <ide> <ide> Here's the `Sequential` model: <ide>
1
Ruby
Ruby
echo any cookies received on a redirect
7d0a36752b6d9b0fee0b2ae650d9042335f99cd7
<ide><path>Library/Homebrew/utils/curl.rb <ide> def curl_args(*extra_args, **options) <ide> # do not load .curlrc unless requested (must be the first argument) <ide> args << "--disable" unless Homebrew::EnvConfig.curlrc? <ide> <add> # echo any cookies received on a redirect <add> args << "--cookie-jar" << "/dev/null" <add> <ide> args << "--globoff" <ide> <ide> args << "--show-error"
1
Python
Python
update queue implementation
e6cf13cc03475b3a5e7e3d3bf4723c37c3063dde
<ide><path>graphs/breadth_first_search.py <ide> """ Author: OMKAR PATHAK """ <ide> from __future__ import annotations <ide> <add>from queue import Queue <add> <ide> <ide> class Graph: <ide> def __init__(self) -> None: <ide> def bfs(self, start_vertex: int) -> set[int]: <ide> visited = set() <ide> <ide> # create a first in first out queue to store all the vertices for BFS <del> queue = [] <add> queue = Queue() <ide> <ide> # mark the source node as visited and enqueue it <ide> visited.add(start_vertex) <del> queue.append(start_vertex) <add> queue.put(start_vertex) <ide> <del> while queue: <del> vertex = queue.pop(0) <add> while not queue.empty(): <add> vertex = queue.get() <ide> <ide> # loop through all adjacent vertex and enqueue it if not yet visited <ide> for adjacent_vertex in self.vertices[vertex]: <ide> if adjacent_vertex not in visited: <del> queue.append(adjacent_vertex) <add> queue.put(adjacent_vertex) <ide> visited.add(adjacent_vertex) <ide> return visited <ide> <ide><path>graphs/breadth_first_search_2.py <ide> """ <ide> from __future__ import annotations <ide> <add>from queue import Queue <add> <ide> G = { <ide> "A": ["B", "C"], <ide> "B": ["A", "D", "E"], <ide> def breadth_first_search(graph: dict, start: str) -> set[str]: <ide> 'ABCDEF' <ide> """ <ide> explored = {start} <del> queue = [start] <del> while queue: <del> v = queue.pop(0) # queue.popleft() <add> queue = Queue() <add> queue.put(start) <add> while not queue.empty(): <add> v = queue.get() <ide> for w in graph[v]: <ide> if w not in explored: <ide> explored.add(w) <del> queue.append(w) <add> queue.put(w) <ide> return explored <ide> <ide> <ide><path>graphs/check_bipartite_graph_bfs.py <ide> # from V to U. In other words, for every edge (u, v), either u belongs to U and v to V, <ide> # or u belongs to V and v to U. We can also say that there is no edge that connects <ide> # vertices of same set. <add>from queue import Queue <add> <add> <ide> def checkBipartite(graph): <del> queue = [] <add> queue = Queue() <ide> visited = [False] * len(graph) <ide> color = [-1] * len(graph) <ide> <ide> def bfs(): <del> while queue: <del> u = queue.pop(0) <add> while not queue.empty(): <add> u = queue.get() <ide> visited[u] = True <ide> <ide> for neighbour in graph[u]: <ide> def bfs(): <ide> <ide> if color[neighbour] == -1: <ide> color[neighbour] = 1 - color[u] <del> queue.append(neighbour) <add> queue.put(neighbour) <ide> <ide> elif color[neighbour] == color[u]: <ide> return False <ide> def bfs(): <ide> <ide> for i in range(len(graph)): <ide> if not visited[i]: <del> queue.append(i) <add> queue.put(i) <ide> color[i] = 0 <ide> if bfs() is False: <ide> return False
3
Ruby
Ruby
use attr_accessor for checksum
7a49c143e4e44a280c7625404d8f84bab5677d88
<ide><path>Library/Homebrew/resource.rb <ide> class Resource <ide> include FileUtils <ide> <del> attr_reader :checksum, :mirrors, :specs, :using <del> attr_writer :checksum, :version <del> attr_accessor :download_strategy <add> attr_reader :mirrors, :specs, :using <add> attr_writer :version <add> attr_accessor :download_strategy, :checksum <ide> <ide> # Formula name must be set after the DSL, as we have no access to the <ide> # formula name before initialization of the formula
1
Text
Text
improve docs for select multiple
18d574a086f724f3437fd018d787a3110046a55c
<ide><path>docs/docs/forms.md <ide> class FlavorForm extends React.Component { <ide> <ide> Overall, this makes it so that `<input type="text">`, `<textarea>`, and `<select>` all work very similarly - they all accept a `value` attribute that you can use to implement a controlled component. <ide> <add>> Note <add>> <add>> You can pass an array into the `value` attribute, allowing you to select multiple options in a `select` tag: <add>> <add>>```js <add>><select multiple={true} value={['B', 'C']}> <add>>``` <add> <ide> ## Handling Multiple Inputs <ide> <ide> When you need to handle multiple controlled `input` elements, you can add a `name` attribute to each element and let the handler function choose what to do based on the value of `event.target.name`.
1
Javascript
Javascript
fix tests for git version of jquery
3097ea8f12b53f6e34d559d22f85d81d2f857b1b
<ide><path>packages/ember-handlebars/tests/views/collection_view_test.js <ide> test("a block passed to a collection helper defaults to the content property of <ide> view.appendTo('#qunit-fixture'); <ide> }); <ide> <del> equal(view.$('li:has(label:contains("foo")) + li:has(label:contains("bar")) + li:has(label:contains("baz"))').length, 1, 'one label element is created for each content item'); <add> equal(view.$('li:nth-child(1) label').length, 1); <add> equal(view.$('li:nth-child(1) label').text(), 'foo'); <add> equal(view.$('li:nth-child(2) label').length, 1); <add> equal(view.$('li:nth-child(2) label').text(), 'bar'); <add> equal(view.$('li:nth-child(3) label').length, 1); <add> equal(view.$('li:nth-child(3) label').text(), 'baz'); <ide> }); <ide> <ide> test("a block passed to a collection helper defaults to the view", function() { <ide> test("a block passed to a collection helper defaults to the view", function() { <ide> Ember.run(function() { <ide> view.appendTo('#qunit-fixture'); <ide> }); <del> equal(view.$('li:has(label:contains("foo")) + li:has(label:contains("bar")) + li:has(label:contains("baz"))').length, 1, 'precond - one aside element is created for each content item'); <add> <add> // Preconds <add> equal(view.$('li:nth-child(1) label').length, 1); <add> equal(view.$('li:nth-child(1) label').text(), 'foo'); <add> equal(view.$('li:nth-child(2) label').length, 1); <add> equal(view.$('li:nth-child(2) label').text(), 'bar'); <add> equal(view.$('li:nth-child(3) label').length, 1); <add> equal(view.$('li:nth-child(3) label').text(), 'baz'); <ide> <ide> Ember.run(function() { <ide> set(firstChild(view), 'content', Ember.A()); <ide><path>packages/ember-views/tests/views/view/view_lifecycle_test.js <ide> test("rerender should work inside a template", function() { <ide> } finally { <ide> Ember.TESTING_DEPRECATION = false; <ide> } <del> ok(view.$('div:contains(2), div:contains(Inside child2').length === 2, <del> "Rerendering a view causes it to rerender"); <add> <add> equal(view.$('div:nth-child(1)').length, 1); <add> equal(view.$('div:nth-child(1)').text(), '2'); <add> equal(view.$('div:nth-child(2)').length, 1); <add> equal(view.$('div:nth-child(2)').text(), 'Inside child2'); <ide> }); <ide> <ide> module("views/view/view_lifecycle_test - in DOM", {
2
Ruby
Ruby
initialize our instance variables
4e3b99dad53a25dd369bef9b19ae1cb794ab3e73
<ide><path>lib/arel/algebra/relations/utilities/compound.rb <ide> class Compound <ide> :to => :relation <ide> <ide> def initialize relation <del> @relation = relation <del> @attributes = nil <add> @relation = relation <add> @attributes = nil <add> @wheres = nil <add> @groupings = nil <add> @orders = nil <add> @havings = nil <add> @projections = nil <ide> end <ide> <ide> [:wheres, :groupings, :orders, :havings, :projections].each do |operation_name|
1
Python
Python
move optimizer closer to usage
d026991921fe4601f2d7149eda799c3c13cf9581
<ide><path>tutorials/image/cifar10_estimator/cifar10_main.py <ide> def _resnet_model_fn(features, labels, mode, params): <ide> boundaries, staged_lr) <ide> <ide> loss = tf.reduce_mean(tower_losses, name='loss') <del> optimizer = tf.train.MomentumOptimizer( <del> learning_rate=learning_rate, momentum=momentum) <del> <ide> <ide> examples_sec_hook = cifar10_utils.ExamplesPerSecondHook( <ide> params.train_batch_size, every_n_steps=10) <ide> def _resnet_model_fn(features, labels, mode, params): <ide> tensors=tensors_to_log, every_n_iter=100) <ide> <ide> train_hooks = [logging_hook, examples_sec_hook] <add> <add> optimizer = tf.train.MomentumOptimizer( <add> learning_rate=learning_rate, momentum=momentum) <add> <ide> if params.sync: <ide> optimizer = tf.train.SyncReplicasOptimizer( <ide> optimizer, replicas_to_aggregate=num_workers)
1
Javascript
Javascript
use inline source maps
81d1c2563999e97fb3d55cc63ccfa7ef561a8e03
<ide><path>webpack.config.js <ide> var path = require('path'); <ide> <ide> module.exports = { <del> devtool: 'sourcemap', <add> devtool: 'inline-source-map', <ide> entry: './client', <ide> output: { <ide> filename: 'bundle.js',
1
Javascript
Javascript
fix typo in commet
38c03ce00643c02f61bee69fec16459cea01af04
<ide><path>packages/react-reconciler/src/__tests__/ReactHooks-test.internal.js <ide> describe('ReactHooks', () => { <ide> expect(root).toMatchRenderedOutput('1'); <ide> <ide> // Update to the same state. React doesn't know if the queue is empty <del> // because the alterate fiber has pending update priority, so we have to <add> // because the alternate fiber has pending update priority, so we have to <ide> // enter the render phase before we can bail out. But we bail out before <ide> // rendering the child, and we don't fire any effects. <ide> act(() => setCounter(1));
1
Java
Java
add set/getacceptlanguage() to httpheaders
9764d5743384fea77e0894090b6e56418ae82457
<ide><path>spring-web/src/main/java/org/springframework/http/HttpHeaders.java <ide> import java.net.InetSocketAddress; <ide> import java.net.URI; <ide> import java.nio.charset.Charset; <add>import java.text.DecimalFormat; <add>import java.text.DecimalFormatSymbols; <ide> import java.text.ParseException; <ide> import java.text.SimpleDateFormat; <ide> import java.util.ArrayList; <ide> import java.util.TimeZone; <ide> import java.util.regex.Matcher; <ide> import java.util.regex.Pattern; <add>import java.util.stream.Collectors; <ide> <ide> import org.springframework.util.Assert; <ide> import org.springframework.util.LinkedCaseInsensitiveMap; <ide> public class HttpHeaders implements MultiValueMap<String, String>, Serializable <ide> */ <ide> private static final Pattern ETAG_HEADER_VALUE_PATTERN = Pattern.compile("\\*|\\s*((W\\/)?(\"[^\"]*\"))\\s*,?"); <ide> <add> private static final DecimalFormatSymbols DECIMAL_FORMAT_SYMBOLS = new DecimalFormatSymbols(Locale.ENGLISH); <add> <ide> private static TimeZone GMT = TimeZone.getTimeZone("GMT"); <ide> <ide> <ide> public List<MediaType> getAccept() { <ide> return MediaType.parseMediaTypes(get(ACCEPT)); <ide> } <ide> <add> /** <add> * Set the acceptable language ranges, <add> * as specified by the {@literal Accept-Language} header. <add> * @see Locale.LanguageRange <add> */ <add> public void setAcceptLanguage(List<Locale.LanguageRange> languages) { <add> Assert.notNull(languages, "'languages' must not be null"); <add> DecimalFormat df = new DecimalFormat("0.0", DECIMAL_FORMAT_SYMBOLS); <add> List<String> values = languages <add> .stream() <add> .map(r -> (r.getWeight() == Locale.LanguageRange.MAX_WEIGHT ? r.getRange() : r.getRange() + ";q=" + df.format(r.getWeight()))) <add> .collect(Collectors.toList()); <add> set(ACCEPT_LANGUAGE, toCommaDelimitedString(values)); <add> } <add> <add> /** <add> * Return the acceptable language ranges, <add> * as specified by the {@literal Accept-Language} header <add> * @see Locale.LanguageRange <add> */ <add> public List<Locale.LanguageRange> getAcceptLanguage() { <add> String value = getFirst(ACCEPT_LANGUAGE); <add> if (value != null) { <add> return Locale.LanguageRange.parse(value); <add> } <add> return Collections.emptyList(); <add> } <add> <ide> /** <ide> * Set the (new) value of the {@code Access-Control-Allow-Credentials} response header. <ide> */ <ide><path>spring-web/src/test/java/org/springframework/http/HttpHeadersTests.java <ide> public void accessControlRequestMethod() { <ide> assertEquals(HttpMethod.POST, headers.getAccessControlRequestMethod()); <ide> } <ide> <add> @Test <add> public void acceptLanguage() { <add> assertTrue(headers.getAcceptLanguage().isEmpty()); <add> String headerValue = "fr-ch, fr;q=0.9, en;q=0.8, de;q=0.7, *;q=0.5"; <add> headers.setAcceptLanguage(Locale.LanguageRange.parse(headerValue)); <add> assertEquals(headerValue, headers.getFirst(HttpHeaders.ACCEPT_LANGUAGE)); <add> List<Locale.LanguageRange> languages = headers.getAcceptLanguage(); <add> Locale.LanguageRange[] languageArray = new Locale.LanguageRange[]{ <add> new Locale.LanguageRange("fr-ch"), <add> new Locale.LanguageRange("fr", 0.9), <add> new Locale.LanguageRange("en", 0.8), <add> new Locale.LanguageRange("de", 0.7), <add> new Locale.LanguageRange("*", 0.5) <add> }; <add> assertArrayEquals(languageArray, languages.toArray()); <add> } <add> <ide> }
2
Ruby
Ruby
add method `ensure_formula_installed!`
3376479e955283c6b0bff6e64faf0e500714d733
<ide><path>Library/Homebrew/dev-cmd/bottle.rb <ide> def bottle <ide> <ide> def ensure_relocation_formulae_installed! <ide> Keg.relocation_formulae.each do |f| <del> next if Formula[f].latest_version_installed? <del> <del> ohai "Installing #{f}..." <del> safe_system HOMEBREW_BREW_FILE, "install", f <add> ensure_formula_installed!(f, latest: true) <ide> end <ide> end <ide> <ide> def setup_tar_and_args!(args) <ide> return default_tar_args <ide> end <ide> <del> unless gnu_tar.any_version_installed? <del> ohai "Installing `gnu-tar` for bottling..." <del> safe_system HOMEBREW_BREW_FILE, "install", "--formula", gnu_tar.full_name <del> end <add> ensure_formula_installed!(gnu_tar, "for bottling") <ide> <ide> ["#{gnu_tar.opt_bin}/gtar", gnutar_args].freeze <ide> end <ide><path>Library/Homebrew/dev-cmd/bump.rb <ide> def bump <ide> unless Utils::Curl.curl_supports_tls13? <ide> begin <ide> unless Pathname.new(ENV["HOMEBREW_BREWED_CURL_PATH"]).exist? <del> ohai "Installing `curl` for Repology queries..." <del> safe_system HOMEBREW_BREW_FILE, "install", "--formula", Formula["curl"].full_name <add> ensure_formula_installed!("curl", "for Repology queries") <ide> end <ide> rescue FormulaUnavailableError <ide> opoo "A `curl` with TLS 1.3 support is required for Repology queries." <ide><path>Library/Homebrew/dev-cmd/cat.rb <ide> def cat <ide> <ide> cd HOMEBREW_REPOSITORY <ide> pager = if Homebrew::EnvConfig.bat? <del> require "formula" <del> <del> unless Formula["bat"].any_version_installed? <add> ENV["BAT_CONFIG_PATH"] = Homebrew::EnvConfig.bat_config_path <add> ensure_formula_installed!( <add> "bat", <add> "for displaying <formula>/<cask> source", <ide> # The user might want to capture the output of `brew cat ...` <ide> # Redirect stdout to stderr <del> redirect_stdout($stderr) do <del> ohai "Installing `bat` for displaying <formula>/<cask> source..." <del> safe_system HOMEBREW_BREW_FILE, "install", "bat" <del> end <del> end <del> ENV["BAT_CONFIG_PATH"] = Homebrew::EnvConfig.bat_config_path <del> Formula["bat"].opt_bin/"bat" <add> output_to_stderr: true, <add> ).opt_bin/"bat" <ide> else <ide> "cat" <ide> end <ide><path>Library/Homebrew/dev-cmd/tests.rb <ide> def use_buildpulse? <ide> def run_buildpulse <ide> require "formula" <ide> <del> unless Formula["buildpulse-test-reporter"].any_version_installed? <del> ohai "Installing `buildpulse-test-reporter` for reporting test flakiness..." <del> with_env(HOMEBREW_NO_AUTO_UPDATE: "1", HOMEBREW_NO_BOOTSNAP: "1") do <del> safe_system HOMEBREW_BREW_FILE, "install", "buildpulse-test-reporter" <del> end <add> with_env(HOMEBREW_NO_AUTO_UPDATE: "1", HOMEBREW_NO_BOOTSNAP: "1") do <add> ensure_formula_installed!("buildpulse-test-reporter", <add> "for reporting test flakiness") <ide> end <ide> <ide> ENV["BUILDPULSE_ACCESS_KEY_ID"] = ENV["HOMEBREW_BUILDPULSE_ACCESS_KEY_ID"] <ide><path>Library/Homebrew/github_packages.rb <ide> def upload_bottles(bottles_hash, keep_old:, dry_run:, warn_on_error:) <ide> which("skopeo", ENV["HOMEBREW_PATH"]), <ide> HOMEBREW_PREFIX/"bin/skopeo", <ide> ].compact.first <del> unless skopeo.exist? <del> ohai "Installing `skopeo` for upload..." <del> safe_system HOMEBREW_BREW_FILE, "install", "--formula", "skopeo" <del> skopeo = Formula["skopeo"].opt_bin/"skopeo" <del> end <add> skopeo = ensure_formula_installed!("skopeo", "for upload").opt_bin/"skopeo" unless skopeo.exist? <ide> <ide> require "json_schemer" <ide> <ide><path>Library/Homebrew/style.rb <ide> def shell_scripts <ide> <ide> def shellcheck <ide> # Always use the latest brewed shellcheck <del> unless Formula["shellcheck"].latest_version_installed? <del> if Formula["shellcheck"].any_version_installed? <del> ohai "Upgrading `shellcheck` for shell style checks..." <del> safe_system HOMEBREW_BREW_FILE, "upgrade", "shellcheck" <del> else <del> ohai "Installing `shellcheck` for shell style checks..." <del> safe_system HOMEBREW_BREW_FILE, "install", "shellcheck" <del> end <del> end <del> <del> Formula["shellcheck"].opt_bin/"shellcheck" <add> ensure_formula_installed!("shellcheck", "for shell style checks", latest: true).opt_bin/"shellcheck" <ide> end <ide> <ide> def shfmt <ide> # Always use the latest brewed shfmt <del> unless Formula["shfmt"].latest_version_installed? <del> if Formula["shfmt"].any_version_installed? <del> ohai "Upgrading `shfmt` to format shell scripts..." <del> safe_system HOMEBREW_BREW_FILE, "upgrade", "shfmt" <del> else <del> ohai "Installing `shfmt` to format shell scripts..." <del> safe_system HOMEBREW_BREW_FILE, "install", "shfmt" <del> end <del> end <del> <add> ensure_formula_installed!("shfmt", "to format shell scripts", latest: true) <ide> HOMEBREW_LIBRARY/"Homebrew/utils/shfmt.sh" <ide> end <ide> <ide><path>Library/Homebrew/utils.rb <ide> def redirect_stdout(file) <ide> out.close <ide> end <ide> <add> # Ensure the given formula is installed <add> # This is useful for installing a utility formula (e.g. `shellcheck` for `brew style`) <add> def ensure_formula_installed!(formula_or_name, reason = "", latest: false, linked: false, <add> output_to_stderr: false, quiet: false) <add> if output_to_stderr || quiet <add> file = if quiet <add> File::NULL <add> else <add> $stderr <add> end <add> # Call this method itself with redirected stdout <add> redirect_stdout(file) do <add> return ensure_formula_installed!(formula_or_name, reason, latest: latest, linked: linked) <add> end <add> end <add> <add> require "formula" <add> <add> formula = if formula_or_name.is_a?(Formula) <add> formula_or_name <add> else <add> Formula[formula_or_name] <add> end <add> <add> reason = " #{reason}" if reason.present? # add a whitespace <add> <add> unless formula.any_version_installed? <add> ohai "Installing `#{formula.name}`#{reason}..." <add> safe_system HOMEBREW_BREW_FILE, "install", "--formula", formula.full_name <add> end <add> <add> if latest && !formula.latest_version_installed? <add> ohai "Upgrading `#{formula.name}`#{reason}..." <add> safe_system HOMEBREW_BREW_FILE, "upgrade", "--formula", formula.full_name <add> end <add> <add> safe_system HOMEBREW_BREW_FILE, "link", formula.full_name if linked && !formula.linked? <add> <add> formula <add> end <add> <ide> def paths <ide> @paths ||= PATH.new(ENV["HOMEBREW_PATH"]).map do |p| <ide> File.expand_path(p).chomp("/") <ide><path>Library/Homebrew/utils/git.rb <ide> def ensure_installed! <ide> # and will also likely fail due to `OS::Linux` and `OS::Mac` being undefined. <ide> raise "Refusing to install Git on a generic OS." if ENV["HOMEBREW_TEST_GENERIC_OS"] <ide> <del> safe_system HOMEBREW_BREW_FILE, "install", "git" <add> ensure_formula_installed!("git") <ide> clear_available_cache <ide> rescue <ide> raise "Git is unavailable"
8
Javascript
Javascript
remove unnecessary comma in unrealbloompass
31397f8bb8a2a614e88fdc589af30b5fadc9a43e
<ide><path>examples/js/postprocessing/UnrealBloomPass.js <ide> THREE.UnrealBloomPass.prototype = Object.assign( Object.create( THREE.Pass.proto <ide> uniforms: { <ide> "colorTexture": { value: null }, <ide> "texSize": { value: new THREE.Vector2( 0.5, 0.5 ) }, <del> "direction": { value: new THREE.Vector2( 0.5, 0.5 ) }, <add> "direction": { value: new THREE.Vector2( 0.5, 0.5 ) } <ide> }, <ide> <ide> vertexShader:
1
Ruby
Ruby
return multiple assingment and response variable
f3101fd0fcfc2b67478ca5c968d5d5394d13ff5f
<ide><path>actionpack/lib/action_dispatch/middleware/debug_exceptions.rb <ide> def initialize(app, routes_app = nil) <ide> <ide> def call(env) <ide> begin <del> status, headers, body = @app.call(env) <add> _, headers, body = response = @app.call(env) <ide> <ide> if headers['X-Cascade'] == 'pass' <ide> body.close if body.respond_to?(:close) <ide> def call(env) <ide> raise exception if env['action_dispatch.show_exceptions'] == false <ide> end <ide> <del> exception ? render_exception(env, exception) : [status, headers, body] <add> exception ? render_exception(env, exception) : response <ide> end <ide> <ide> private
1
Python
Python
fix syntax error
49b1e48bf556dc291c0144b6384e7b4c702a3072
<ide><path>spacy/cli/init_model.py <ide> def read_vectors(vectors_loc): <ide> pieces = line.rsplit(' ', vectors_data.shape[1]+1) <ide> word = pieces.pop(0) <ide> if len(pieces) != vectors_data.shape[1]: <del> raise ValueError(Errors.E094.format(line_num=i, loc=vectors_loc) <add> raise ValueError(Errors.E094.format(line_num=i, loc=vectors_loc)) <ide> vectors_data[i] = numpy.asarray(pieces, dtype='f') <ide> vectors_keys.append(word) <ide> return vectors_data, vectors_keys
1
Text
Text
update changelog 2.11.1
ac1a23823f0439fe7bd8bddbba53a9e899a652cf
<ide><path>CHANGELOG.md <ide> Changelog <ide> ========= <ide> <add>### 2.11.1 [See full changelog](https://gist.github.com/ichernev/8ec3ee25b749b4cff3c2) <add> <add>## Bugfixes: <add>* [#2881](https://github.com/moment/moment/pull/2881) Revert "Merge pull request #2746 from mbad0la:develop" Sep->Sept <add>* [#2868](https://github.com/moment/moment/pull/2868) Add format and parse token Y, so it actually works <add>* [#2865](https://github.com/moment/moment/pull/2865) Use typeof checks for undefined for global variables <add>* [#2858](https://github.com/moment/moment/pull/2858) Fix Date mocking regression introduced in 2.11.0 <add>* [#2864](https://github.com/moment/moment/pull/2864) Include changelog in npm release <add>* [#2830](https://github.com/moment/moment/pull/2830) dep: add grunt-cli <add>* [#2869](https://github.com/moment/moment/pull/2869) Fix months parsing for some locales <add> <ide> ### 2.11.0 [See full changelog](https://gist.github.com/ichernev/6594bc29719dde6b2f66) <ide> <ide> * [#2624](https://github.com/moment/moment/pull/2624) Proper handling of invalid moments
1
Javascript
Javascript
expose d3.timer, for requestanimationframe
166f8b5868beeae90966876a2a31bbe203cfb21f
<ide><path>d3.js <del>(function(){d3 = {version: "1.5.3"}; // semver <add>(function(){d3 = {version: "1.6.0"}; // semver <ide> if (!Date.now) Date.now = function() { <ide> return +new Date(); <ide> }; <ide> var d3_timer_queue = null, <ide> d3_timer_timeout = 0, <ide> d3_timer_interval; <ide> <add>// The timer will continue to fire until callback returns true. <add>d3.timer = function(callback) { <add> d3_timer(callback, 0); <add>}; <add> <ide> function d3_timer(callback, delay) { <ide> var now = Date.now(), <ide> found = false, <ide><path>d3.layout.js <ide> d3.layout.force = function() { <ide> l = alpha / (o.distance * o.distance) * (l - distance * o.distance) / l; <ide> x *= l; <ide> y *= l; <del> if (s.fixed) { <del> if (t.fixed) continue; <add> if (!t.fixed) { <ide> t.x -= x; <ide> t.y -= y; <del> } else if (t.fixed) { <del> s.x += x; <del> s.y += y; <del> } else { <add> } <add> if (!s.fixed) { <ide> s.x += x; <ide> s.y += y; <del> t.x -= x; <del> t.y -= y; <ide> } <ide> } <ide> } <ide> <del> // simulated annealing, basically <del> if ((alpha *= .99) < 1e-6) force.stop(); <del> <ide> event.tick.dispatch({type: "tick"}); <add> <add> // simulated annealing, basically <add> return (alpha *= .99) < .005; <ide> } <ide> <ide> force.on = function(type, listener) { <ide> d3.layout.force = function() { <ide> return a.distance - b.distance; <ide> }); <ide> <del> if (interval) clearInterval(interval); <del> interval = setInterval(tick, 24); <add> d3.timer(tick); <ide> return force; <ide> }; <ide> <ide> force.resume = function() { <ide> alpha = .1; <del> if (!interval) interval = setInterval(tick, 24); <add> d3.timer(tick); <ide> return force; <ide> }; <ide> <ide> force.stop = function() { <del> interval = clearInterval(interval); <add> alpha = 0; <ide> return force; <ide> }; <ide> <ide><path>d3.layout.min.js <del>(function(){function A(c){return c.reduce(B,0)}function C(c){for(var h=1,n=0,i=c[0].y,o,l=c.length;h<l;++h)if((o=c[h].y)>i){n=h;i=o}return n}function B(c,h){return c+h.y}function D(c){return c.children}function E(c){return c.value}function F(c,h){return h.area-c.area}d3.layout={};d3.layout.chord=function(){function c(){var a={},j=[],f=d3.range(g),s=[],t,k,q,r,u;i=[];o=[];t=0;for(r=-1;++r<g;){k=0;for(u=-1;++u<g;)k+=l[r][u];j.push(k);s.push(d3.range(g));t+=k}p&&f.sort(function(y,x){return p(j[y],j[x])}); <del>e&&s.forEach(function(y,x){y.sort(function(G,H){return e(l[x][G],l[x][H])})});t=(2*Math.PI-m*g)/t;k=0;for(r=-1;++r<g;){q=k;for(u=-1;++u<g;){var v=f[r],w=s[r][u],z=l[v][w];a[v+"-"+w]={index:v,subindex:w,startAngle:k,endAngle:k+=z*t,value:z}}o.push({index:v,startAngle:q,endAngle:k,value:(k-q)/t});k+=m}for(r=-1;++r<g;)for(u=r-1;++u<g;){f=a[r+"-"+u];s=a[u+"-"+r];if(f.value||s.value)i.push({source:f,target:s})}b&&h()}function h(){i.sort(function(a,j){a=Math.min(a.source.value,a.target.value);j=Math.min(j.source.value, <del>j.target.value);return b(a,j)})}var n={},i,o,l,g,m=0,p,e,b;n.matrix=function(a){if(!arguments.length)return l;g=(l=a)&&l.length;i=o=null;return n};n.padding=function(a){if(!arguments.length)return m;m=a;i=o=null;return n};n.sortGroups=function(a){if(!arguments.length)return p;p=a;i=o=null;return n};n.sortSubgroups=function(a){if(!arguments.length)return e;e=a;i=null;return n};n.sortChords=function(a){if(!arguments.length)return b;b=a;i&&h();return n};n.chords=function(){i||c();return i};n.groups= <del>function(){o||c();return o};return n};d3.layout.force=function(){function c(){var b=e.length,a,j,f,s,t,k,q;for(a=0;a<b;++a){j=e[a];f=j.source;s=j.target;k=s.x-f.x;q=s.y-f.y;if(t=Math.sqrt(k*k+q*q)){t=o/(j.distance*j.distance)*(t-l*j.distance)/t;k*=t;q*=t;if(f.fixed){if(!s.fixed){s.x-=k;s.y-=q}}else if(s.fixed){f.x+=k;f.y+=q}else{f.x+=k;f.y+=q;s.x-=k;s.y-=q}}}if((o*=0.99)<1.0E-6)h.stop();n.tick.dispatch({type:"tick"})}var h={},n=d3.dispatch("tick"),i=[1,1],o=0.5,l=30,g,m,p,e;h.on=function(b,a){n[b].add(a); <del>return h};h.nodes=function(b){if(!arguments.length)return m;m=b;return h};h.links=function(b){if(!arguments.length)return p;p=b;return h};h.size=function(b){if(!arguments.length)return i;i=b;return h};h.distance=function(b){if(!arguments.length)return l;l=b;return h};h.start=function(){var b,a,j,f=m.length;j=p.length;var s=i[0],t=i[1],k=[];for(b=0;b<f;++b){a=m[b];a.x=a.x||Math.random()*s;a.y=a.y||Math.random()*t;a.fixed=0;k[b]=[];for(a=0;a<f;++a)k[b][a]=Infinity;k[b][b]=0}for(b=0;b<j;++b){a=p[b]; <del>k[a.source][a.target]=1;k[a.target][a.source]=1;a.source=m[a.source];a.target=m[a.target]}for(j=0;j<f;++j)for(b=0;b<f;++b)for(a=0;a<f;++a)k[b][a]=Math.min(k[b][a],k[b][j]+k[j][a]);e=[];for(b=0;b<f;++b)for(a=b+1;a<f;++a)e.push({source:m[b],target:m[a],distance:k[b][a]*k[b][a]});e.sort(function(q,r){return q.distance-r.distance});g&&clearInterval(g);g=setInterval(c,24);return h};h.resume=function(){o=0.1;g||(g=setInterval(c,24));return h};h.stop=function(){g=clearInterval(g);return h};h.drag=function(){function b(){if(a){var f= <del>d3.svg.mouse(j);a.x=f[0];a.y=f[1];h.resume()}}var a,j;this.on("mouseover",function(f){f.fixed=true}).on("mouseout",function(f){if(f!=a)f.fixed=false}).on("mousedown",function(f){(a=f).fixed=true;j=this;d3.event.preventDefault()});d3.select(window).on("mousemove",b).on("mouseup",function(){if(a){b();a.fixed=false;a=j=null}});return h};return h};d3.layout.pie=function(){function c(l){var g=+(typeof i=="function"?i.apply(this,arguments):i),m=(typeof o=="function"?o.apply(this,arguments):o)-i,p=d3.range(l.length); <del>n!=null&&p.sort(function(a,j){return n(l[a],l[j])});var e=l.map(h);m/=e.reduce(function(a,j){return a+j},0);var b=p.map(function(a){return{value:d=e[a],startAngle:g,endAngle:g+=d*m}});return l.map(function(a,j){return b[p[j]]})}var h=Number,n=null,i=0,o=2*Math.PI;c.value=function(l){if(!arguments.length)return h;h=l;return c};c.sort=function(l){if(!arguments.length)return n;n=l;return c};c.startAngle=function(l){if(!arguments.length)return i;i=l;return c};c.endAngle=function(l){if(!arguments.length)return o; <del>o=l;return c};return c};d3.layout.stack=function(){function c(i){var o=i.length,l=i[0].length,g,m,p,e=I[h](i);J[n](i,e);for(m=0;m<l;++m){g=1;for(p=i[e[0]][m].y0;g<o;++g)i[e[g]][m].y0=p+=i[e[g-1]][m].y}return i}var h="default",n="zero";c.order=function(i){if(!arguments.length)return h;h=i;return c};c.offset=function(i){if(!arguments.length)return n;n=i;return c};return c};var I={"inside-out":function(c){var h=c.length,n,i=c.map(C),o=c.map(A),l=d3.range(h).sort(function(b,a){return i[b]-i[a]}),g=0, <del>m=0,p=[],e=[];for(c=0;c<h;c++){n=l[c];if(g<m){g+=o[n];p.push(n)}else{m+=o[n];e.push(n)}}return e.reverse().concat(p)},reverse:function(c){return d3.range(c.length).reverse()},"default":function(c){return d3.range(c.length)}},J={silhouette:function(c,h){var n=c.length,i=c[0].length,o=[],l=0,g,m,p;for(m=0;m<i;++m){for(p=g=0;g<n;g++)p+=c[g][m].y;if(p>l)l=p;o.push(p)}m=0;for(g=h[0];m<i;++m)c[g][m].y0=(l-o[m])/2},wiggle:function(c,h){var n=c.length,i=c[0],o=i.length,l,g,m,p,e,b=h[0],a,j,f,s,t,k;c[b][0].y0= <del>t=k=0;for(g=1;g<o;++g){for(a=l=0;l<n;++l)a+=c[l][g].y;j=l=0;for(s=i[g].x-i[g-1].x;l<n;++l){m=0;p=h[l];for(f=(c[p][g].y-c[p][g-1].y)/(2*s);m<l;++m)f+=(c[e=h[m]][g].y-c[e][g-1].y)/s;j+=f*c[p][g].y}c[b][g].y0=t-=a?j/a*s:0;if(t<k)k=t}for(g=0;g<o;++g)c[b][g].y0-=k},zero:function(c,h){for(var n=0,i=c[0].length,o=h[0];n<i;++n)c[o][n].y0=0}};d3.layout.treemap=function(){function c(e,b,a){var j=l.call(o,e,b),f={depth:b,data:e};a.push(f);if(j){e=-1;for(var s=j.length,t=f.children=[],k=0,q=b+1;++e<s;){d=c(j[e], <del>q,a);if(d.value>0){t.push(d);k+=d.value}}f.value=k}else f.value=g.call(o,e,b);b||h(f,p[0]*p[1]/f.value);return f}function h(e,b){var a=e.children;e.area=e.value*b;if(a)for(var j=-1,f=a.length;++j<f;)h(a[j],b)}function n(e){if(e.children){var b={x:e.x,y:e.y,dx:e.dx,dy:e.dy},a=[],j=e.children.slice().sort(F),f,s=Infinity,t=Math.min(b.dx,b.dy);for(a.area=0;(f=j.length)>0;){a.push(f=j[f-1]);a.area+=f.area;f=t;for(var k=a.area,q=void 0,r=0,u=Infinity,v=-1,w=a.length;++v<w;){q=a[v].area;if(q<u)u=q;if(q> <del>r)r=q}k*=k;f*=f;if((f=Math.max(f*r/k,k/(f*u)))<=s){j.pop();s=f}else{a.area-=a.pop().area;i(a,t,b,false);t=Math.min(b.dx,b.dy);a.length=a.area=0;s=Infinity}}if(a.length){i(a,t,b,true);a.length=a.area=0}e.children.forEach(n)}}function i(e,b,a,j){var f=-1,s=e.length,t=a.x,k=a.y,q=b?m(e.area/b):0,r;if(b==a.dx){if(j||q>a.dy)q=a.dy;for(;++f<s;){r=e[f];r.x=t;r.y=k;r.dy=q;t+=r.dx=m(r.area/q)}r.dx+=a.x+a.dx-t;a.y+=q;a.dy-=q}else{if(j||q>a.dx)q=a.dx;for(;++f<s;){r=e[f];r.x=t;r.y=k;r.dx=q;k+=r.dy=m(r.area/q)}r.dy+= <del>a.y+a.dy-k;a.x+=q;a.dx-=q}}function o(e){var b=[];e=c(e,0,b);e.x=0;e.y=0;e.dx=p[0];e.dy=p[1];n(e);return b}var l=D,g=E,m=Math.round,p=[1,1];o.children=function(e){if(!arguments.length)return l;l=e;return o};o.value=function(e){if(!arguments.length)return g;g=e;return o};o.size=function(e){if(!arguments.length)return p;p=e;return o};o.round=function(e){if(!arguments.length)return m!=Number;m=e?Math.round:Number;return o};return o}})(); <add>(function(){function A(e){return e.reduce(B,0)}function C(e){for(var h=1,k=0,i=e[0].y,l,j=e.length;h<j;++h)if((l=e[h].y)>i){k=h;i=l}return k}function B(e,h){return e+h.y}function D(e){return e.children}function E(e){return e.value}function F(e,h){return h.area-e.area}d3.layout={};d3.layout.chord=function(){function e(){var b={},g=[],m=d3.range(f),s=[],o,p,t,r,u;i=[];l=[];o=0;for(r=-1;++r<f;){p=0;for(u=-1;++u<f;)p+=j[r][u];g.push(p);s.push(d3.range(f));o+=p}q&&m.sort(function(y,x){return q(g[y],g[x])}); <add>a&&s.forEach(function(y,x){y.sort(function(G,H){return a(j[x][G],j[x][H])})});o=(2*Math.PI-n*f)/o;p=0;for(r=-1;++r<f;){t=p;for(u=-1;++u<f;){var v=m[r],w=s[r][u],z=j[v][w];b[v+"-"+w]={index:v,subindex:w,startAngle:p,endAngle:p+=z*o,value:z}}l.push({index:v,startAngle:t,endAngle:p,value:(p-t)/o});p+=n}for(r=-1;++r<f;)for(u=r-1;++u<f;){m=b[r+"-"+u];s=b[u+"-"+r];if(m.value||s.value)i.push({source:m,target:s})}c&&h()}function h(){i.sort(function(b,g){b=Math.min(b.source.value,b.target.value);g=Math.min(g.source.value, <add>g.target.value);return c(b,g)})}var k={},i,l,j,f,n=0,q,a,c;k.matrix=function(b){if(!arguments.length)return j;f=(j=b)&&j.length;i=l=null;return k};k.padding=function(b){if(!arguments.length)return n;n=b;i=l=null;return k};k.sortGroups=function(b){if(!arguments.length)return q;q=b;i=l=null;return k};k.sortSubgroups=function(b){if(!arguments.length)return a;a=b;i=null;return k};k.sortChords=function(b){if(!arguments.length)return c;c=b;i&&h();return k};k.chords=function(){i||e();return i};k.groups= <add>function(){l||e();return l};return k};d3.layout.force=function(){function e(){var a=q.length,c,b,g,m,s,o,p;for(c=0;c<a;++c){b=q[c];g=b.source;m=b.target;o=m.x-g.x;p=m.y-g.y;if(s=Math.sqrt(o*o+p*p)){s=l/(b.distance*b.distance)*(s-j*b.distance)/s;o*=s;p*=s;if(!m.fixed){m.x-=o;m.y-=p}if(!g.fixed){g.x+=o;g.y+=p}}}k.tick.dispatch({type:"tick"});return(l*=0.99)<0.0050}var h={},k=d3.dispatch("tick"),i=[1,1],l=0.5,j=30,f,n,q;h.on=function(a,c){k[a].add(c);return h};h.nodes=function(a){if(!arguments.length)return f; <add>f=a;return h};h.links=function(a){if(!arguments.length)return n;n=a;return h};h.size=function(a){if(!arguments.length)return i;i=a;return h};h.distance=function(a){if(!arguments.length)return j;j=a;return h};h.start=function(){var a,c,b,g=f.length;b=n.length;var m=i[0],s=i[1],o=[];for(a=0;a<g;++a){c=f[a];c.x=c.x||Math.random()*m;c.y=c.y||Math.random()*s;c.fixed=0;o[a]=[];for(c=0;c<g;++c)o[a][c]=Infinity;o[a][a]=0}for(a=0;a<b;++a){c=n[a];o[c.source][c.target]=1;o[c.target][c.source]=1;c.source=f[c.source]; <add>c.target=f[c.target]}for(b=0;b<g;++b)for(a=0;a<g;++a)for(c=0;c<g;++c)o[a][c]=Math.min(o[a][c],o[a][b]+o[b][c]);q=[];for(a=0;a<g;++a)for(c=a+1;c<g;++c)q.push({source:f[a],target:f[c],distance:o[a][c]*o[a][c]});q.sort(function(p,t){return p.distance-t.distance});d3.timer(e);return h};h.resume=function(){l=0.1;d3.timer(e);return h};h.stop=function(){l=0;return h};h.drag=function(){function a(){if(c){var g=d3.svg.mouse(b);c.x=g[0];c.y=g[1];h.resume()}}var c,b;this.on("mouseover",function(g){g.fixed=true}).on("mouseout", <add>function(g){if(g!=c)g.fixed=false}).on("mousedown",function(g){(c=g).fixed=true;b=this;d3.event.preventDefault()});d3.select(window).on("mousemove",a).on("mouseup",function(){if(c){a();c.fixed=false;c=b=null}});return h};return h};d3.layout.pie=function(){function e(j){var f=+(typeof i=="function"?i.apply(this,arguments):i),n=(typeof l=="function"?l.apply(this,arguments):l)-i,q=d3.range(j.length);k!=null&&q.sort(function(b,g){return k(j[b],j[g])});var a=j.map(h);n/=a.reduce(function(b,g){return b+ <add>g},0);var c=q.map(function(b){return{value:d=a[b],startAngle:f,endAngle:f+=d*n}});return j.map(function(b,g){return c[q[g]]})}var h=Number,k=null,i=0,l=2*Math.PI;e.value=function(j){if(!arguments.length)return h;h=j;return e};e.sort=function(j){if(!arguments.length)return k;k=j;return e};e.startAngle=function(j){if(!arguments.length)return i;i=j;return e};e.endAngle=function(j){if(!arguments.length)return l;l=j;return e};return e};d3.layout.stack=function(){function e(i){var l=i.length,j=i[0].length, <add>f,n,q,a=I[h](i);J[k](i,a);for(n=0;n<j;++n){f=1;for(q=i[a[0]][n].y0;f<l;++f)i[a[f]][n].y0=q+=i[a[f-1]][n].y}return i}var h="default",k="zero";e.order=function(i){if(!arguments.length)return h;h=i;return e};e.offset=function(i){if(!arguments.length)return k;k=i;return e};return e};var I={"inside-out":function(e){var h=e.length,k,i=e.map(C),l=e.map(A),j=d3.range(h).sort(function(c,b){return i[c]-i[b]}),f=0,n=0,q=[],a=[];for(e=0;e<h;e++){k=j[e];if(f<n){f+=l[k];q.push(k)}else{n+=l[k];a.push(k)}}return a.reverse().concat(q)}, <add>reverse:function(e){return d3.range(e.length).reverse()},"default":function(e){return d3.range(e.length)}},J={silhouette:function(e,h){var k=e.length,i=e[0].length,l=[],j=0,f,n,q;for(n=0;n<i;++n){for(q=f=0;f<k;f++)q+=e[f][n].y;if(q>j)j=q;l.push(q)}n=0;for(f=h[0];n<i;++n)e[f][n].y0=(j-l[n])/2},wiggle:function(e,h){var k=e.length,i=e[0],l=i.length,j,f,n,q,a,c=h[0],b,g,m,s,o,p;e[c][0].y0=o=p=0;for(f=1;f<l;++f){for(b=j=0;j<k;++j)b+=e[j][f].y;g=j=0;for(s=i[f].x-i[f-1].x;j<k;++j){n=0;q=h[j];for(m=(e[q][f].y- <add>e[q][f-1].y)/(2*s);n<j;++n)m+=(e[a=h[n]][f].y-e[a][f-1].y)/s;g+=m*e[q][f].y}e[c][f].y0=o-=b?g/b*s:0;if(o<p)p=o}for(f=0;f<l;++f)e[c][f].y0-=p},zero:function(e,h){for(var k=0,i=e[0].length,l=h[0];k<i;++k)e[l][k].y0=0}};d3.layout.treemap=function(){function e(a,c,b){var g=j.call(l,a,c),m={depth:c,data:a};b.push(m);if(g){a=-1;for(var s=g.length,o=m.children=[],p=0,t=c+1;++a<s;){d=e(g[a],t,b);if(d.value>0){o.push(d);p+=d.value}}m.value=p}else m.value=f.call(l,a,c);c||h(m,q[0]*q[1]/m.value);return m}function h(a, <add>c){var b=a.children;a.area=a.value*c;if(b)for(var g=-1,m=b.length;++g<m;)h(b[g],c)}function k(a){if(a.children){var c={x:a.x,y:a.y,dx:a.dx,dy:a.dy},b=[],g=a.children.slice().sort(F),m,s=Infinity,o=Math.min(c.dx,c.dy);for(b.area=0;(m=g.length)>0;){b.push(m=g[m-1]);b.area+=m.area;m=o;for(var p=b.area,t=void 0,r=0,u=Infinity,v=-1,w=b.length;++v<w;){t=b[v].area;if(t<u)u=t;if(t>r)r=t}p*=p;m*=m;if((m=Math.max(m*r/p,p/(m*u)))<=s){g.pop();s=m}else{b.area-=b.pop().area;i(b,o,c,false);o=Math.min(c.dx,c.dy); <add>b.length=b.area=0;s=Infinity}}if(b.length){i(b,o,c,true);b.length=b.area=0}a.children.forEach(k)}}function i(a,c,b,g){var m=-1,s=a.length,o=b.x,p=b.y,t=c?n(a.area/c):0,r;if(c==b.dx){if(g||t>b.dy)t=b.dy;for(;++m<s;){r=a[m];r.x=o;r.y=p;r.dy=t;o+=r.dx=n(r.area/t)}r.dx+=b.x+b.dx-o;b.y+=t;b.dy-=t}else{if(g||t>b.dx)t=b.dx;for(;++m<s;){r=a[m];r.x=o;r.y=p;r.dx=t;p+=r.dy=n(r.area/t)}r.dy+=b.y+b.dy-p;b.x+=t;b.dx-=t}}function l(a){var c=[];a=e(a,0,c);a.x=0;a.y=0;a.dx=q[0];a.dy=q[1];k(a);return c}var j=D,f=E, <add>n=Math.round,q=[1,1];l.children=function(a){if(!arguments.length)return j;j=a;return l};l.value=function(a){if(!arguments.length)return f;f=a;return l};l.size=function(a){if(!arguments.length)return q;q=a;return l};l.round=function(a){if(!arguments.length)return n!=Number;n=a?Math.round:Number;return l};return l}})(); <ide><path>d3.min.js <del>(function(){function wa(a){for(var b=-1,d=a.length,g=[];++b<d;)g.push(a[b]);return g}function v(a){return typeof a=="function"?a:function(){return a}}function C(a,b){return function(){var d=b.apply(a,arguments);return arguments.length?a:d}}function xa(a){return a==null}function da(a){return a.replace(/(^\s+)|(\s+$)/g,"").replace(/\s+/g," ")}function ea(a){arguments[0]=this;a.apply(this,arguments);return this}function ya(){var a={},b=[];a.add=function(d){for(var g=0;g<b.length;g++)if(b[g].listener== <add>(function(){function xa(a){for(var b=-1,d=a.length,g=[];++b<d;)g.push(a[b]);return g}function v(a){return typeof a=="function"?a:function(){return a}}function C(a,b){return function(){var d=b.apply(a,arguments);return arguments.length?a:d}}function ya(a){return a==null}function da(a){return a.replace(/(^\s+)|(\s+$)/g,"").replace(/\s+/g," ")}function ea(a){arguments[0]=this;a.apply(this,arguments);return this}function za(){var a={},b=[];a.add=function(d){for(var g=0;g<b.length;g++)if(b[g].listener== <ide> d)return a;b.push({listener:d,on:true});return a};a.remove=function(d){for(var g=0;g<b.length;g++){var e=b[g];if(e.listener==d){e.on=false;b=b.slice(0,g).concat(b.slice(g+1));break}}return a};a.dispatch=function(){for(var d=b,g=0,e=d.length;g<e;g++){var c=d[g];c.on&&c.listener.apply(this,arguments)}};return a}function fa(a){for(var b=a.lastIndexOf("."),d=b>=0?a.substring(b):(b=a.length,""),g=[];b>0;)g.push(a.substring(b-=3,b+3));return g.reverse().join(",")+d}function ga(a){return function(b){return 1- <del>a(1-b)}}function ha(a){return function(b){return 0.5*(b<0.5?a(2*b):2-a(2-2*b))}}function za(a){return a}function R(a){return function(b){return Math.pow(b,a)}}function Aa(a){return 1-Math.cos(a*Math.PI/2)}function Ba(a){return a?Math.pow(2,10*(a-1))-0.0010:0}function Ca(a){return 1-Math.sqrt(1-a*a)}function Da(a){return a<1/2.75?7.5625*a*a:a<2/2.75?7.5625*(a-=1.5/2.75)*a+0.75:a<2.5/2.75?7.5625*(a-=2.25/2.75)*a+0.9375:7.5625*(a-=2.625/2.75)*a+0.984375}function J(a,b,d){return{r:a,g:b,b:d,toString:Ea}} <del>function Ea(){return"#"+S(this.r)+S(this.g)+S(this.b)}function S(a){return a<16?"0"+a.toString(16):a.toString(16)}function T(a,b,d){var g=0,e=0,c=0,f,h;if(f=/([a-z]+)\((.*)\)/i.exec(a)){h=f[2].split(",");switch(f[1]){case "hsl":return d(parseFloat(h[0]),parseFloat(h[1])/100,parseFloat(h[2])/100);case "rgb":return b(U(h[0]),U(h[1]),U(h[2]))}}if(d=G[a])return b(d.r,d.g,d.b);if(a!=null&&a.charAt(0)=="#"){if(a.length==4){g=a.charAt(1);g+=g;e=a.charAt(2);e+=e;c=a.charAt(3);c+=c}else if(a.length==7){g= <del>a.substring(1,3);e=a.substring(3,5);c=a.substring(5,7)}g=parseInt(g,16);e=parseInt(e,16);c=parseInt(c,16)}return b(g,e,c)}function Fa(a,b,d){var g=Math.min(a/=255,b/=255,d/=255),e=Math.max(a,b,d),c=e-g,f=(e+g)/2;if(c){g=f<0.5?c/(e+g):c/(2-e-g);a=a==e?(b-d)/c+(b<d?6:0):b==e?(d-a)/c+2:(a-b)/c+4;a*=60}else g=a=0;return V(a,g,f)}function U(a){var b=parseFloat(a);return a.charAt(a.length-1)=="%"?Math.round(b*2.55):b}function V(a,b,d){return{h:a,s:b,l:d,toString:Ga}}function Ga(){return"hsl("+this.h+","+ <add>a(1-b)}}function ha(a){return function(b){return 0.5*(b<0.5?a(2*b):2-a(2-2*b))}}function Aa(a){return a}function R(a){return function(b){return Math.pow(b,a)}}function Ba(a){return 1-Math.cos(a*Math.PI/2)}function Ca(a){return a?Math.pow(2,10*(a-1))-0.0010:0}function Da(a){return 1-Math.sqrt(1-a*a)}function Ea(a){return a<1/2.75?7.5625*a*a:a<2/2.75?7.5625*(a-=1.5/2.75)*a+0.75:a<2.5/2.75?7.5625*(a-=2.25/2.75)*a+0.9375:7.5625*(a-=2.625/2.75)*a+0.984375}function J(a,b,d){return{r:a,g:b,b:d,toString:Fa}} <add>function Fa(){return"#"+S(this.r)+S(this.g)+S(this.b)}function S(a){return a<16?"0"+a.toString(16):a.toString(16)}function T(a,b,d){var g=0,e=0,c=0,f,h;if(f=/([a-z]+)\((.*)\)/i.exec(a)){h=f[2].split(",");switch(f[1]){case "hsl":return d(parseFloat(h[0]),parseFloat(h[1])/100,parseFloat(h[2])/100);case "rgb":return b(U(h[0]),U(h[1]),U(h[2]))}}if(d=G[a])return b(d.r,d.g,d.b);if(a!=null&&a.charAt(0)=="#"){if(a.length==4){g=a.charAt(1);g+=g;e=a.charAt(2);e+=e;c=a.charAt(3);c+=c}else if(a.length==7){g= <add>a.substring(1,3);e=a.substring(3,5);c=a.substring(5,7)}g=parseInt(g,16);e=parseInt(e,16);c=parseInt(c,16)}return b(g,e,c)}function Ga(a,b,d){var g=Math.min(a/=255,b/=255,d/=255),e=Math.max(a,b,d),c=e-g,f=(e+g)/2;if(c){g=f<0.5?c/(e+g):c/(2-e-g);a=a==e?(b-d)/c+(b<d?6:0):b==e?(d-a)/c+2:(a-b)/c+4;a*=60}else g=a=0;return V(a,g,f)}function U(a){var b=parseFloat(a);return a.charAt(a.length-1)=="%"?Math.round(b*2.55):b}function V(a,b,d){return{h:a,s:b,l:d,toString:Ha}}function Ha(){return"hsl("+this.h+","+ <ide> this.s*100+"%,"+this.l*100+"%)"}function W(a,b,d){function g(f){if(f>360)f-=360;else if(f<0)f+=360;if(f<60)return e+(c-e)*f/60;if(f<180)return c;if(f<240)return e+(c-e)*(240-f)/60;return e}var e,c;a%=360;if(a<0)a+=360;b=b<0?0:b>1?1:b;d=d<0?0:d>1?1:d;c=d<=0.5?d*(1+b):d+b-d*b;e=2*d-c;return J(Math.round(g(a+120)*255),Math.round(g(a)*255),Math.round(g(a-120)*255))}function y(a){function b(e){for(var c=[],f,h,i,k,j=0,o=a.length;j<o;j++){i=a[j];c.push(f=[]);f.parentNode=i.parentNode;f.parentData=i.parentData; <ide> for(var p=0,m=i.length;p<m;p++)if(k=i[p]){f.push(h=e(k));if(h&&"__data__"in k)h.__data__=k.__data__}else f.push(null)}return y(c)}function d(e){for(var c=[],f,h,i,k=0,j=a.length;k<j;k++){h=a[k];for(var o=0,p=h.length;o<p;o++)if(i=h[o]){c.push(f=e(i));f.parentNode=i;f.parentData=i.__data__}}return y(c)}function g(e){for(var c=0,f=a.length;c<f;c++)for(var h=a[c],i=0,k=h.length;i<k;i++){var j=h[i];if(j)return e.call(j,j.__data__,i)}return null}a.select=function(e){return b(function(c){return D(e,c)})}; <ide> a.selectAll=function(e){return d(function(c){return ia(e,c)})};a.filter=function(e){for(var c=[],f,h,i,k=0,j=a.length;k<j;k++){h=a[k];c.push(f=[]);f.parentNode=h.parentNode;f.parentData=h.parentData;for(var o=0,p=h.length;o<p;o++)if((i=h[o])&&e.call(i,i.__data__,o))f.push(i)}return y(c)};a.map=function(e){for(var c,f,h=0,i=a.length;h<i;h++){c=a[h];for(var k=0,j=c.length;k<j;k++)if(f=c[k])f.__data__=e.call(f,f.__data__,k)}return a};a.data=function(e,c){function f(m,n){var l=0,q=m.length,r=n.length, <ide> t=Math.min(q,r),u=Math.max(q,r),s=[],z=[],w=[],x,A;if(c){t={};u=[];var E;A=n.length;for(l=0;l<q;l++){E=c.call(x=m[l],x.__data__,l);if(E in t)w[A++]=m[l];else{t[E]=x;u.push(E)}}for(l=0;l<r;l++){if(x=t[E=c.call(n,A=n[l],l)]){x.__data__=A;s[l]=x;z[l]=w[l]=null}else{z[l]={__data__:A};s[l]=w[l]=null}delete t[E]}for(l=0;l<q;l++)if(u[l]in t)w[l]=m[l]}else{for(;l<t;l++){x=m[l];A=n[l];if(x){x.__data__=A;s[l]=x;z[l]=w[l]=null}else{z[l]={__data__:A};s[l]=w[l]=null}}for(;l<r;l++){z[l]={__data__:n[l]};s[l]=w[l]= <del>null}for(;l<u;l++){w[l]=m[l];z[l]=s[l]=null}}z.parentNode=s.parentNode=w.parentNode=m.parentNode;z.parentData=s.parentData=w.parentData=m.parentData;h.push(z);i.push(s);k.push(w)}var h=[],i=[],k=[],j=-1,o=a.length,p;if(typeof e=="function")for(;++j<o;)f(p=a[j],e.call(p,p.parentData,j));else for(;++j<o;)f(p=a[j],e);j=y(i);j.enter=function(){return Ha(h)};j.exit=function(){return y(k)};return j};a.each=function(e){for(var c=0,f=a.length;c<f;c++)for(var h=a[c],i=0,k=h.length;i<k;i++){var j=h[i];j&&e.call(j, <add>null}for(;l<u;l++){w[l]=m[l];z[l]=s[l]=null}}z.parentNode=s.parentNode=w.parentNode=m.parentNode;z.parentData=s.parentData=w.parentData=m.parentData;h.push(z);i.push(s);k.push(w)}var h=[],i=[],k=[],j=-1,o=a.length,p;if(typeof e=="function")for(;++j<o;)f(p=a[j],e.call(p,p.parentData,j));else for(;++j<o;)f(p=a[j],e);j=y(i);j.enter=function(){return Ia(h)};j.exit=function(){return y(k)};return j};a.each=function(e){for(var c=0,f=a.length;c<f;c++)for(var h=a[c],i=0,k=h.length;i<k;i++){var j=h[i];j&&e.call(j, <ide> j.__data__,i)}return a};a.empty=function(){return!g(function(){return true})};a.node=function(){return g(function(){return this})};a.attr=function(e,c){function f(){this.removeAttribute(e)}function h(){this.removeAttributeNS(e.space,e.local)}function i(){this.setAttribute(e,c)}function k(){this.setAttributeNS(e.space,e.local,c)}function j(){var p=c.apply(this,arguments);p==null?this.removeAttribute(e):this.setAttribute(e,p)}function o(){var p=c.apply(this,arguments);p==null?this.removeAttributeNS(e.space, <ide> e.local):this.setAttributeNS(e.space,e.local,p)}e=d3.ns.qualify(e);if(arguments.length<2)return g(e.local?function(){return this.getAttributeNS(e.space,e.local)}:function(){return this.getAttribute(e)});return a.each(c==null?e.local?h:f:typeof c=="function"?e.local?o:j:e.local?k:i)};a.classed=function(e,c){function f(){var j=this.className;k.lastIndex=0;if(!k.test(j))this.className=da(j+" "+e)}function h(){var j=da(this.className.replace(k," "));this.className=j.length?j:null}function i(){(c.apply(this, <ide> arguments)?f:h).call(this)}var k=RegExp("(^|\\s+)"+d3.requote(e)+"(\\s+|$)","g");if(arguments.length<2)return g(function(){k.lastIndex=0;return k.test(this.className)});return a.each(typeof c=="function"?i:c?f:h)};a.style=function(e,c,f){function h(){this.style.removeProperty(e)}function i(){this.style.setProperty(e,c,f)}function k(){var j=c.apply(this,arguments);j==null?this.style.removeProperty(e):this.style.setProperty(e,j,f)}if(arguments.length<3)f=null;if(arguments.length<2)return g(function(){return window.getComputedStyle(this, <ide> null).getPropertyValue(e)});return a.each(c==null?h:typeof c=="function"?k:i)};a.property=function(e,c){function f(){delete this[e]}function h(){this[e]=c}function i(){var k=c.apply(this,arguments);if(k==null)delete this[e];else this[e]=k}e=d3.ns.qualify(e);if(arguments.length<2)return g(function(){return this[e]});return a.each(c==null?f:typeof c=="function"?i:h)};a.text=function(e){function c(){this.appendChild(document.createTextNode(e))}function f(){var h=e.apply(this,arguments);h!=null&&this.appendChild(document.createTextNode(h))} <ide> if(arguments.length<1)return g(function(){return this.textContent});a.each(function(){for(;this.lastChild;)this.removeChild(this.lastChild)});return e==null?a:a.each(typeof e=="function"?f:c)};a.html=function(e){function c(){this.innerHTML=e}function f(){this.innerHTML=e.apply(this,arguments)}if(arguments.length<1)return g(function(){return this.innerHTML});return a.each(typeof e=="function"?f:c)};a.append=function(e){function c(h){return h.appendChild(document.createElement(e))}function f(h){return h.appendChild(document.createElementNS(e.space, <del>e.local))}e=d3.ns.qualify(e);return b(e.local?f:c)};a.insert=function(e,c){function f(i){return i.insertBefore(document.createElement(e),D(c,i))}function h(i){return i.insertBefore(document.createElementNS(e.space,e.local),D(c,i))}e=d3.ns.qualify(e);return b(e.local?h:f)};a.remove=function(){return b(function(e){var c=e.parentNode;c.removeChild(e);return c})};a.sort=function(e){e=Ia.apply(this,arguments);for(var c=0,f=a.length;c<f;c++){var h=a[c];h.sort(e);for(var i=1,k=h.length,j=h[0];i<k;i++){var o= <del>h[i];if(o){j&&j.parentNode.insertBefore(o,j.nextSibling);j=o}}}return a};a.on=function(e,c){var f=e.indexOf("."),h=f==-1?e:e.substring(0,f),i="__on"+e;return a.each(function(k,j){function o(p){var m=d3.event;d3.event=p;try{c.call(this,k,j)}finally{d3.event=m}}this[i]&&this.removeEventListener(h,this[i],false);if(c)this.addEventListener(h,this[i]=o,false)})};a.transition=function(){return X(a)};a.call=ea;return a}function Ha(a){function b(d){for(var g=[],e,c,f,h,i=0,k=a.length;i<k;i++){f=a[i];g.push(e= <add>e.local))}e=d3.ns.qualify(e);return b(e.local?f:c)};a.insert=function(e,c){function f(i){return i.insertBefore(document.createElement(e),D(c,i))}function h(i){return i.insertBefore(document.createElementNS(e.space,e.local),D(c,i))}e=d3.ns.qualify(e);return b(e.local?h:f)};a.remove=function(){return b(function(e){var c=e.parentNode;c.removeChild(e);return c})};a.sort=function(e){e=Ja.apply(this,arguments);for(var c=0,f=a.length;c<f;c++){var h=a[c];h.sort(e);for(var i=1,k=h.length,j=h[0];i<k;i++){var o= <add>h[i];if(o){j&&j.parentNode.insertBefore(o,j.nextSibling);j=o}}}return a};a.on=function(e,c){var f=e.indexOf("."),h=f==-1?e:e.substring(0,f),i="__on"+e;return a.each(function(k,j){function o(p){var m=d3.event;d3.event=p;try{c.call(this,k,j)}finally{d3.event=m}}this[i]&&this.removeEventListener(h,this[i],false);if(c)this.addEventListener(h,this[i]=o,false)})};a.transition=function(){return X(a)};a.call=ea;return a}function Ia(a){function b(d){for(var g=[],e,c,f,h,i=0,k=a.length;i<k;i++){f=a[i];g.push(e= <ide> []);e.parentNode=f.parentNode;e.parentData=f.parentData;for(var j=0,o=f.length;j<o;j++)if(h=f[j]){e.push(c=d(f.parentNode));c.__data__=h.__data__}else e.push(null)}return y(g)}a.append=function(d){function g(c){return c.appendChild(document.createElement(d))}function e(c){return c.appendChild(document.createElementNS(d.space,d.local))}d=d3.ns.qualify(d);return b(d.local?e:g)};a.insert=function(d,g){function e(f){return f.insertBefore(document.createElement(d),D(g,f))}function c(f){return f.insertBefore(document.createElementNS(d.space, <del>d.local),D(g,f))}d=d3.ns.qualify(d);return b(d.local?c:e)};return a}function Ia(a){if(!arguments.length)a=d3.ascending;return function(b,d){return a(b&&b.__data__,d&&d.__data__)}}function X(a){function b(m){var n=true,l=-1;a.each(function(){if(i[++l]!=2){var q=(m-k[l])/j[l],r=this.__transition__,t,u,s=c[l];if(q<1){n=false;if(q<0)return}else q=1;if(i[l]){if(!r||r.active!=g){i[l]=2;return}}else if(!r||r.active>g){i[l]=2;return}else{i[l]=1;h.start.dispatch.apply(this,arguments);s=c[l]={};r.active=g; <del>for(u in e)s[u]=e[u].apply(this,arguments)}t=p(q);for(u in e)s[u].call(this,t);if(q==1){i[l]=2;if(r.active==g){q=r.owner;if(q==g){delete this.__transition__;f&&this.parentNode.removeChild(this)}Y=g;h.end.dispatch.apply(this,arguments);Y=0;r.owner=q}}}});return n}var d={},g=Y||++Ja,e={},c=[],f=false,h=d3.dispatch("start","end"),i=[],k=[],j=[],o,p=d3.ease("cubic-in-out");a.each(function(){(this.__transition__||(this.__transition__={})).owner=g});d.delay=function(m){var n=Infinity,l=-1;if(typeof m== <del>"function")a.each(function(){var q=k[++l]=+m.apply(this,arguments);if(q<n)n=q});else{n=+m;a.each(function(){k[++l]=n})}Ka(b,n);return d};d.duration=function(m){var n=-1;if(typeof m=="function"){o=0;a.each(function(){var l=j[++n]=+m.apply(this,arguments);if(l>o)o=l})}else{o=+m;a.each(function(){j[++n]=o})}return d};d.ease=function(m){p=typeof m=="string"?d3.ease(m):m;return d};d.attrTween=function(m,n){function l(r,t){var u=n.call(this,r,t,this.getAttribute(m));return function(s){this.setAttribute(m, <del>u(s))}}function q(r,t){var u=n.call(this,r,t,this.getAttributeNS(m.space,m.local));return function(s){this.setAttributeNS(m.space,m.local,u(s))}}e["attr."+m]=m.local?q:l;return d};d.attr=function(m,n){return d.attrTween(m,ja(n))};d.styleTween=function(m,n,l){if(arguments.length<3)l=null;e["style."+m]=function(q,r){var t=n.call(this,q,r,window.getComputedStyle(this,null).getPropertyValue(m));return function(u){this.style.setProperty(m,t(u),l)}};return d};d.style=function(m,n,l){if(arguments.length< <del>3)l=null;return d.styleTween(m,ja(n),l)};d.select=function(m){var n;m=X(a.select(m)).ease(p);n=-1;m.delay(function(){return k[++n]});n=-1;m.duration(function(){return j[++n]});return m};d.selectAll=function(m){var n;m=X(a.selectAll(m)).ease(p);n=-1;m.delay(function(l,q){return k[q?n:++n]});n=-1;m.duration(function(l,q){return j[q?n:++n]});return m};d.remove=function(){f=true;return d};d.each=function(m,n){h[m].add(n);return d};d.call=ea;return d.delay(0).duration(250)}function ja(a){return typeof a== <del>"function"?function(b,d,g){return d3.interpolate(g,String(a.call(this,b,d)))}:(a=String(a),function(b,d,g){return d3.interpolate(g,a)})}function Ka(a,b){var d=Date.now(),g=false,e=d+b,c=F;if(isFinite(b)){for(;c;){if(c.callback==a){c.then=d;c.delay=b;g=true}else{var f=c.then+c.delay;if(f<e)e=f}c=c.next}g||(F={callback:a,then:d,delay:b,next:F});if(!K){clearTimeout(Z);Z=setTimeout(La,Math.max(24,e-d))}}}function La(){K=1;Z=0;ka(la)}function la(){for(var a,b=Date.now(),d=F;d;){a=b-d.then;if(a>d.delay)d.flush= <del>d.callback(a);d=d.next}a=null;for(b=F;b;)b=b.flush?a?a.next=b.next:F=b.next:(a=b).next;a||(K=0);K&&ka(la)}function Ma(a){return a.innerRadius}function Na(a){return a.outerRadius}function ma(a){return a.startAngle}function na(a){return a.endAngle}function $(a,b,d,g){var e=[],c=-1,f=b.length,h=typeof d=="function",i=typeof g=="function",k;if(h&&i)for(;++c<f;)e.push([d.call(a,k=b[c],c),g.call(a,k,c)]);else if(h)for(;++c<f;)e.push([d.call(a,b[c],c),g]);else if(i)for(;++c<f;)e.push([d,g.call(a,b[c],c)]); <del>else for(;++c<f;)e.push([d,g]);return e}function oa(a){return a[0]}function pa(a){return a[1]}function H(a){var b=[],d=0,g=a.length,e=a[0];for(b.push(e[0],",",e[1]);++d<g;)b.push("L",(e=a[d])[0],",",e[1]);return b.join("")}function qa(a,b){if(b.length<1||a.length!=b.length&&a.length!=b.length+2)return H(a);var d=a.length!=b.length,g="",e=a[0],c=a[1],f=b[0],h=f,i=1;if(d){g+="Q"+(c[0]-f[0]*2/3)+","+(c[1]-f[1]*2/3)+","+c[0]+","+c[1];e=a[1];i=2}if(b.length>1){h=b[1];c=a[i];i++;g+="C"+(e[0]+f[0])+","+ <del>(e[1]+f[1])+","+(c[0]-h[0])+","+(c[1]-h[1])+","+c[0]+","+c[1];for(e=2;e<b.length;e++,i++){c=a[i];h=b[e];g+="S"+(c[0]-h[0])+","+(c[1]-h[1])+","+c[0]+","+c[1]}}if(d){d=a[i];g+="Q"+(c[0]+h[0]*2/3)+","+(c[1]+h[1]*2/3)+","+d[0]+","+d[1]}return g}function ra(a,b){for(var d=[],g=(1-b)/2,e=a[0],c=a[1],f=a[2],h=2,i=a.length;++h<i;){d.push([g*(f[0]-e[0]),g*(f[1]-e[1])]);e=c;c=f;f=a[h]}d.push([g*(f[0]-e[0]),g*(f[1]-e[1])]);return d}function B(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3]}function L(a, <del>b,d){a.push("C",B(sa,b),",",B(sa,d),",",B(ta,b),",",B(ta,d),",",B(M,b),",",B(M,d))}function Oa(){return 0}function Pa(a){return a.source}function Qa(a){return a.target}function Ra(a){return a.radius}function Sa(){return 64}function Ta(){return"circle"}d3={version:"1.5.3"};if(!Date.now)Date.now=function(){return+new Date};if(!Object.create)Object.create=function(a){function b(){}b.prototype=a;return new b};var N=function(a){return Array.prototype.slice.call(a)};try{N(document.documentElement.childNodes)}catch(fb){N= <del>wa}d3.ascending=function(a,b){return a<b?-1:a>b?1:0};d3.descending=function(a,b){return b<a?-1:b>a?1:0};d3.min=function(a,b){var d=0,g=a.length,e=a[0],c;if(arguments.length==1)for(;++d<g;){if(e>(c=a[d]))e=c}else for(e=b(a[0]);++d<g;)if(e>(c=b(a[d])))e=c;return e};d3.max=function(a,b){var d=0,g=a.length,e=a[0],c;if(arguments.length==1)for(;++d<g;){if(e<(c=a[d]))e=c}else for(e=b(e);++d<g;)if(e<(c=b(a[d])))e=c;return e};d3.nest=function(){function a(h,i){if(i>=g.length)return f?f.call(d,h):c?h.sort(c): <add>d.local),D(g,f))}d=d3.ns.qualify(d);return b(d.local?c:e)};return a}function Ja(a){if(!arguments.length)a=d3.ascending;return function(b,d){return a(b&&b.__data__,d&&d.__data__)}}function X(a){function b(m){var n=true,l=-1;a.each(function(){if(i[++l]!=2){var q=(m-k[l])/j[l],r=this.__transition__,t,u,s=c[l];if(q<1){n=false;if(q<0)return}else q=1;if(i[l]){if(!r||r.active!=g){i[l]=2;return}}else if(!r||r.active>g){i[l]=2;return}else{i[l]=1;h.start.dispatch.apply(this,arguments);s=c[l]={};r.active=g; <add>for(u in e)s[u]=e[u].apply(this,arguments)}t=p(q);for(u in e)s[u].call(this,t);if(q==1){i[l]=2;if(r.active==g){q=r.owner;if(q==g){delete this.__transition__;f&&this.parentNode.removeChild(this)}Y=g;h.end.dispatch.apply(this,arguments);Y=0;r.owner=q}}}});return n}var d={},g=Y||++Ka,e={},c=[],f=false,h=d3.dispatch("start","end"),i=[],k=[],j=[],o,p=d3.ease("cubic-in-out");a.each(function(){(this.__transition__||(this.__transition__={})).owner=g});d.delay=function(m){var n=Infinity,l=-1;if(typeof m== <add>"function")a.each(function(){var q=k[++l]=+m.apply(this,arguments);if(q<n)n=q});else{n=+m;a.each(function(){k[++l]=n})}ja(b,n);return d};d.duration=function(m){var n=-1;if(typeof m=="function"){o=0;a.each(function(){var l=j[++n]=+m.apply(this,arguments);if(l>o)o=l})}else{o=+m;a.each(function(){j[++n]=o})}return d};d.ease=function(m){p=typeof m=="string"?d3.ease(m):m;return d};d.attrTween=function(m,n){function l(r,t){var u=n.call(this,r,t,this.getAttribute(m));return function(s){this.setAttribute(m, <add>u(s))}}function q(r,t){var u=n.call(this,r,t,this.getAttributeNS(m.space,m.local));return function(s){this.setAttributeNS(m.space,m.local,u(s))}}e["attr."+m]=m.local?q:l;return d};d.attr=function(m,n){return d.attrTween(m,ka(n))};d.styleTween=function(m,n,l){if(arguments.length<3)l=null;e["style."+m]=function(q,r){var t=n.call(this,q,r,window.getComputedStyle(this,null).getPropertyValue(m));return function(u){this.style.setProperty(m,t(u),l)}};return d};d.style=function(m,n,l){if(arguments.length< <add>3)l=null;return d.styleTween(m,ka(n),l)};d.select=function(m){var n;m=X(a.select(m)).ease(p);n=-1;m.delay(function(){return k[++n]});n=-1;m.duration(function(){return j[++n]});return m};d.selectAll=function(m){var n;m=X(a.selectAll(m)).ease(p);n=-1;m.delay(function(l,q){return k[q?n:++n]});n=-1;m.duration(function(l,q){return j[q?n:++n]});return m};d.remove=function(){f=true;return d};d.each=function(m,n){h[m].add(n);return d};d.call=ea;return d.delay(0).duration(250)}function ka(a){return typeof a== <add>"function"?function(b,d,g){return d3.interpolate(g,String(a.call(this,b,d)))}:(a=String(a),function(b,d,g){return d3.interpolate(g,a)})}function ja(a,b){var d=Date.now(),g=false,e=d+b,c=F;if(isFinite(b)){for(;c;){if(c.callback==a){c.then=d;c.delay=b;g=true}else{var f=c.then+c.delay;if(f<e)e=f}c=c.next}g||(F={callback:a,then:d,delay:b,next:F});if(!K){clearTimeout(Z);Z=setTimeout(La,Math.max(24,e-d))}}}function La(){K=1;Z=0;la(ma)}function ma(){for(var a,b=Date.now(),d=F;d;){a=b-d.then;if(a>d.delay)d.flush= <add>d.callback(a);d=d.next}a=null;for(b=F;b;)b=b.flush?a?a.next=b.next:F=b.next:(a=b).next;a||(K=0);K&&la(ma)}function Ma(a){return a.innerRadius}function Na(a){return a.outerRadius}function na(a){return a.startAngle}function oa(a){return a.endAngle}function $(a,b,d,g){var e=[],c=-1,f=b.length,h=typeof d=="function",i=typeof g=="function",k;if(h&&i)for(;++c<f;)e.push([d.call(a,k=b[c],c),g.call(a,k,c)]);else if(h)for(;++c<f;)e.push([d.call(a,b[c],c),g]);else if(i)for(;++c<f;)e.push([d,g.call(a,b[c],c)]); <add>else for(;++c<f;)e.push([d,g]);return e}function pa(a){return a[0]}function qa(a){return a[1]}function H(a){var b=[],d=0,g=a.length,e=a[0];for(b.push(e[0],",",e[1]);++d<g;)b.push("L",(e=a[d])[0],",",e[1]);return b.join("")}function ra(a,b){if(b.length<1||a.length!=b.length&&a.length!=b.length+2)return H(a);var d=a.length!=b.length,g="",e=a[0],c=a[1],f=b[0],h=f,i=1;if(d){g+="Q"+(c[0]-f[0]*2/3)+","+(c[1]-f[1]*2/3)+","+c[0]+","+c[1];e=a[1];i=2}if(b.length>1){h=b[1];c=a[i];i++;g+="C"+(e[0]+f[0])+","+ <add>(e[1]+f[1])+","+(c[0]-h[0])+","+(c[1]-h[1])+","+c[0]+","+c[1];for(e=2;e<b.length;e++,i++){c=a[i];h=b[e];g+="S"+(c[0]-h[0])+","+(c[1]-h[1])+","+c[0]+","+c[1]}}if(d){d=a[i];g+="Q"+(c[0]+h[0]*2/3)+","+(c[1]+h[1]*2/3)+","+d[0]+","+d[1]}return g}function sa(a,b){for(var d=[],g=(1-b)/2,e=a[0],c=a[1],f=a[2],h=2,i=a.length;++h<i;){d.push([g*(f[0]-e[0]),g*(f[1]-e[1])]);e=c;c=f;f=a[h]}d.push([g*(f[0]-e[0]),g*(f[1]-e[1])]);return d}function B(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3]}function L(a, <add>b,d){a.push("C",B(ta,b),",",B(ta,d),",",B(ua,b),",",B(ua,d),",",B(M,b),",",B(M,d))}function Oa(){return 0}function Pa(a){return a.source}function Qa(a){return a.target}function Ra(a){return a.radius}function Sa(){return 64}function Ta(){return"circle"}d3={version:"1.6.0"};if(!Date.now)Date.now=function(){return+new Date};if(!Object.create)Object.create=function(a){function b(){}b.prototype=a;return new b};var N=function(a){return Array.prototype.slice.call(a)};try{N(document.documentElement.childNodes)}catch(fb){N= <add>xa}d3.ascending=function(a,b){return a<b?-1:a>b?1:0};d3.descending=function(a,b){return b<a?-1:b>a?1:0};d3.min=function(a,b){var d=0,g=a.length,e=a[0],c;if(arguments.length==1)for(;++d<g;){if(e>(c=a[d]))e=c}else for(e=b(a[0]);++d<g;)if(e>(c=b(a[d])))e=c;return e};d3.max=function(a,b){var d=0,g=a.length,e=a[0],c;if(arguments.length==1)for(;++d<g;){if(e<(c=a[d]))e=c}else for(e=b(e);++d<g;)if(e<(c=b(a[d])))e=c;return e};d3.nest=function(){function a(h,i){if(i>=g.length)return f?f.call(d,h):c?h.sort(c): <ide> h;for(var k=-1,j=h.length,o=g[i++],p,m,n={};++k<j;)if((p=o(m=h[k]))in n)n[p].push(m);else n[p]=[m];for(p in n)n[p]=a(n[p],i);return n}function b(h,i){if(i>=g.length)return h;var k=[],j=e[i++],o;for(o in h)k.push({key:o,values:b(h[o],i)});j&&k.sort(function(p,m){return j(p.key,m.key)});return k}var d={},g=[],e=[],c,f;d.map=function(h){return a(h,0)};d.entries=function(h){return b(a(h,0),0)};d.key=function(h){g.push(h);return d};d.sortKeys=function(h){e[g.length-1]=h;return d};d.sortValues=function(h){c= <del>h;return d};d.rollup=function(h){f=h;return d};return d};d3.keys=function(a){var b=[],d;for(d in a)b.push(d);return b};d3.values=function(a){var b=[],d;for(d in a)b.push(a[d]);return b};d3.entries=function(a){var b=[],d;for(d in a)b.push({key:d,value:a[d]});return b};d3.merge=function(a){return Array.prototype.concat.apply([],a)};d3.split=function(a,b){var d=[],g=[],e,c=-1,f=a.length;if(arguments.length<2)b=xa;for(;++c<f;)if(b.call(g,e=a[c],c))g=[];else{g.length||d.push(g);g.push(e)}return d};d3.range= <add>h;return d};d.rollup=function(h){f=h;return d};return d};d3.keys=function(a){var b=[],d;for(d in a)b.push(d);return b};d3.values=function(a){var b=[],d;for(d in a)b.push(a[d]);return b};d3.entries=function(a){var b=[],d;for(d in a)b.push({key:d,value:a[d]});return b};d3.merge=function(a){return Array.prototype.concat.apply([],a)};d3.split=function(a,b){var d=[],g=[],e,c=-1,f=a.length;if(arguments.length<2)b=ya;for(;++c<f;)if(b.call(g,e=a[c],c))g=[];else{g.length||d.push(g);g.push(e)}return d};d3.range= <ide> function(a,b,d){if(arguments.length==1){b=a;a=0}if(d==null)d=1;if((b-a)/d==Infinity)throw Error("infinite range");var g=[],e=-1,c;if(d<0)for(;(c=a+d*++e)>b;)g.push(c);else for(;(c=a+d*++e)<b;)g.push(c);return g};d3.requote=function(a){return a.replace(Ua,"\\$&")};var Ua=/[\\\^\$\*\+\?\[\]\(\)\.\{\}]/g;d3.xhr=function(a,b,d){var g=new XMLHttpRequest;if(arguments.length<3)d=b;else b&&g.overrideMimeType(b);g.open("GET",a,true);g.onreadystatechange=function(){if(g.readyState==4)d(g.status<300?g:null)}; <ide> g.send(null)};d3.text=function(a,b,d){if(arguments.length<3){d=b;b=null}d3.xhr(a,b,function(g){d(g&&g.responseText)})};d3.json=function(a,b){d3.text(a,"application/json",function(d){b(d?JSON.parse(d):null)})};d3.html=function(a,b){d3.text(a,"text/html",function(d){if(d!=null){var g=document.createRange();g.selectNode(document.body);d=g.createContextualFragment(d)}b(d)})};d3.xml=function(a,b,d){if(arguments.length<3){d=b;b=null}d3.xhr(a,b,function(g){d(g&&g.responseXML)})};d3.ns={prefix:{svg:"http://www.w3.org/2000/svg", <del>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(){for(var a={},b,d=0,g=arguments.length;d<g;d++){b=arguments[d];a[b]=ya(b)}return a};d3.format=function(a){a=Va.exec(a);var b=a[1]||" ",d=a[3]||"",g=a[5],e=+a[6],c=a[7],f=a[8],h=a[9];if(f)f=f.substring(1);if(g){b= <del>"0";if(c)e-=Math.floor((e-1)/4)}if(h=="d")f="0";return function(i){i=+i;var k=i<0&&(i=-i)?"−":d;if(h=="d"&&i%1)return"";i=f?i.toFixed(f):""+i;if(g){var j=i.length+k.length;if(j<e)i=Array(e-j+1).join(b)+i;if(c)i=fa(i);i=k+i}else{if(c)i=fa(i);i=k+i;j=i.length;if(j<e)i=Array(e-j+1).join(b)+i}return i}};var Va=/(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/,Wa=R(2),Xa=R(3),Ya={linear:function(){return za},poly:R,quad:function(){return Wa},cubic:function(){return Xa},sin:function(){return Aa}, <del>exp:function(){return Ba},circle:function(){return Ca},elastic:function(a,b){var d;if(arguments.length<2)b=0.45;if(arguments.length<1){a=1;d=b/4}else d=b/(2*Math.PI)*Math.asin(1/a);return function(g){return 1+a*Math.pow(2,10*-g)*Math.sin((g-d)*2*Math.PI/b)}},back:function(a){a||(a=1.70158);return function(b){return b*b*((a+1)*b-a)}},bounce:function(){return Da}},Za={"in":function(a){return a},out:ga,"in-out":ha,"out-in":function(a){return ha(ga(a))}};d3.ease=function(a){var b=a.indexOf("-"),d=b>= <add>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(){for(var a={},b,d=0,g=arguments.length;d<g;d++){b=arguments[d];a[b]=za(b)}return a};d3.format=function(a){a=Va.exec(a);var b=a[1]||" ",d=a[3]||"",g=a[5],e=+a[6],c=a[7],f=a[8],h=a[9];if(f)f=f.substring(1);if(g){b= <add>"0";if(c)e-=Math.floor((e-1)/4)}if(h=="d")f="0";return function(i){i=+i;var k=i<0&&(i=-i)?"−":d;if(h=="d"&&i%1)return"";i=f?i.toFixed(f):""+i;if(g){var j=i.length+k.length;if(j<e)i=Array(e-j+1).join(b)+i;if(c)i=fa(i);i=k+i}else{if(c)i=fa(i);i=k+i;j=i.length;if(j<e)i=Array(e-j+1).join(b)+i}return i}};var Va=/(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/,Wa=R(2),Xa=R(3),Ya={linear:function(){return Aa},poly:R,quad:function(){return Wa},cubic:function(){return Xa},sin:function(){return Ba}, <add>exp:function(){return Ca},circle:function(){return Da},elastic:function(a,b){var d;if(arguments.length<2)b=0.45;if(arguments.length<1){a=1;d=b/4}else d=b/(2*Math.PI)*Math.asin(1/a);return function(g){return 1+a*Math.pow(2,10*-g)*Math.sin((g-d)*2*Math.PI/b)}},back:function(a){a||(a=1.70158);return function(b){return b*b*((a+1)*b-a)}},bounce:function(){return Ea}},Za={"in":function(a){return a},out:ga,"in-out":ha,"out-in":function(a){return ha(ga(a))}};d3.ease=function(a){var b=a.indexOf("-"),d=b>= <ide> 0?a.substring(0,b):a;b=b>=0?a.substring(b+1):"in";return Za[b](Ya[d].apply(null,Array.prototype.slice.call(arguments,1)))};d3.event=null;d3.interpolate=function(a,b){if(typeof b=="number")return d3.interpolateNumber(+a,b);if(typeof b=="string")return b in G||/^(#|rgb\(|hsl\()/.test(b)?d3.interpolateRgb(String(a),b):d3.interpolateString(String(a),b);if(b instanceof Array)return d3.interpolateArray(a,b);return d3.interpolateObject(a,b)};d3.interpolateNumber=function(a,b){b-=a;return function(d){return a+ <ide> b*d}};d3.interpolateRound=function(a,b){b-=a;return function(d){return Math.round(a+b*d)}};d3.interpolateString=function(a,b){var d,g,e=0,c=[],f=[],h,i;for(g=0;d=aa.exec(b);++g){d.index&&c.push(b.substring(e,d.index));f.push({i:c.length,x:d[0]});c.push(null);e=aa.lastIndex}e<b.length&&c.push(b.substring(e));g=0;for(h=f.length;(d=aa.exec(a))&&g<h;++g){i=f[g];if(i.x==d[0]){if(i.i)if(c[i.i+1]==null){c[i.i-1]+=i.x;c.splice(i.i,1);for(d=g+1;d<h;++d)f[d].i--}else{c[i.i-1]+=i.x+c[i.i+1];c.splice(i.i,2); <ide> for(d=g+1;d<h;++d)f[d].i-=2}else if(c[i.i+1]==null)c[i.i]=i.x;else{c[i.i]=i.x+c[i.i+1];c.splice(i.i+1,1);for(d=g+1;d<h;++d)f[d].i--}f.splice(g,1);h--;g--}else i.x=d3.interpolateNumber(parseFloat(d[0]),parseFloat(i.x))}for(;g<h;){i=f.pop();if(c[i.i+1]==null)c[i.i]=i.x;else{c[i.i]=i.x+c[i.i+1];c.splice(i.i+1,1)}h--}if(c.length==1)return c[0]==null?f[0].x:function(){return b};return function(k){for(g=0;g<h;++g)c[(i=f[g]).i]=i.x(k);return c.join("")}};d3.interpolateRgb=function(a,b){a=d3.rgb(a);b=d3.rgb(b); <ide> darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:" <ide> 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", <ide> 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", <ide> 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", <del>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"},ba;for(ba in G)G[ba]=T(G[ba],J,W);d3.hsl=function(a,b,d){return arguments.length==1?T(""+a,Fa,V):V(+a,+b,+d)};var D=function(a,b){return b.querySelector(a)}, <del>ia=function(a,b){return N(b.querySelectorAll(a))};if(typeof Sizzle=="function"){D=function(a,b){return Sizzle(a,b)[0]};ia=function(a,b){return Sizzle.uniqueSort(Sizzle(a,b))}}var O=y([[document]]);O[0].parentNode=document.documentElement;d3.select=function(a){return typeof a=="string"?O.select(a):y([[a]])};d3.selectAll=function(a){return typeof a=="string"?O.selectAll(a):y([N(a)])};d3.transition=O.transition;var Ja=0,Y=0,F=null,Z=0,K,ka=window.requestAnimationFrame||window.webkitRequestAnimationFrame|| <del>window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){setTimeout(a,17)};d3.scale={};d3.scale.linear=function(){function a(j){return k((j-d)*f)}function b(j){var o=Math.min(d,g),p=Math.max(d,g),m=p-o,n=Math.pow(10,Math.floor(Math.log(m/j)/Math.LN10));j=j/(m/n);if(j<=0.15)n*=10;else if(j<=0.35)n*=5;else if(j<=0.75)n*=2;return{start:Math.ceil(o/n)*n,stop:Math.floor(p/n)*n+n*0.5,step:n}}var d=0,g=1,e=0,c=1,f=1/(g-d),h=(g-d)/(c-e),i=d3.interpolate, <del>k=i(e,c);a.invert=function(j){return(j-e)*h+d};a.domain=function(j){if(!arguments.length)return[d,g];d=j[0];g=j[1];f=1/(g-d);h=(g-d)/(c-e);return a};a.range=function(j){if(!arguments.length)return[e,c];e=j[0];c=j[1];h=(g-d)/(c-e);k=i(e,c);return a};a.rangeRound=function(j){return a.range(j).interpolate(d3.interpolateRound)};a.interpolate=function(j){if(!arguments.length)return i;k=(i=j)(e,c);return a};a.ticks=function(j){j=b(j);return d3.range(j.start,j.stop,j.step)};a.tickFormat=function(j){j=Math.max(0, <del>-Math.floor(Math.log(b(j).step)/Math.LN10+0.01));return d3.format(",."+j+"f")};return a};d3.scale.log=function(){function a(c){return(e?-Math.log(-c):Math.log(c))/Math.LN10}function b(c){return e?-Math.pow(10,-c):Math.pow(10,c)}function d(c){return g(a(c))}var g=d3.scale.linear(),e=false;d.invert=function(c){return b(g.invert(c))};d.domain=function(c){if(!arguments.length)return g.domain().map(b);e=(c[0]||c[1])<0;g.domain(c.map(a));return d};d.range=C(d,g.range);d.rangeRound=C(d,g.rangeRound);d.interpolate= <del>C(d,g.interpolate);d.ticks=function(){var c=g.domain(),f=[];if(c.every(isFinite)){var h=Math.floor(c[0]),i=Math.ceil(c[1]),k=b(c[0]);c=b(c[1]);if(e)for(f.push(b(h));h++<i;)for(var j=9;j>0;j--)f.push(b(h)*j);else{for(;h<i;h++)for(j=1;j<10;j++)f.push(b(h)*j);f.push(b(h))}for(h=0;f[h]<k;h++);for(i=f.length;f[i-1]>c;i--);f=f.slice(h,i)}return f};d.tickFormat=function(){return function(c){return c.toPrecision(1)}};return d};d3.scale.pow=function(){function a(i){return h?-Math.pow(-i,c):Math.pow(i,c)}function b(i){return h? <del>-Math.pow(-i,f):Math.pow(i,f)}function d(i){return g(a(i))}var g=d3.scale.linear(),e=d3.scale.linear(),c=1,f=1/c,h=false;d.invert=function(i){return b(g.invert(i))};d.domain=function(i){if(!arguments.length)return g.domain().map(b);h=(i[0]||i[1])<0;g.domain(i.map(a));e.domain(i);return d};d.range=C(d,g.range);d.rangeRound=C(d,g.rangeRound);d.inteprolate=C(d,g.interpolate);d.ticks=e.ticks;d.tickFormat=e.tickFormat;d.exponent=function(i){if(!arguments.length)return c;var k=d.domain();c=i;f=1/i;return d.domain(k)}; <del>return d};d3.scale.sqrt=function(){return d3.scale.pow().exponent(0.5)};d3.scale.ordinal=function(){function a(c){c=c in d?d[c]:d[c]=b.push(c)-1;return g[c%g.length]}var b=[],d={},g=[],e=0;a.domain=function(c){if(!arguments.length)return b;b=c;d={};for(var f=-1,h=-1,i=b.length;++f<i;){c=b[f];c in d||(d[c]=++h)}return a};a.range=function(c){if(!arguments.length)return g;g=c;return a};a.rangePoints=function(c,f){if(arguments.length<2)f=0;var h=c[0],i=c[1],k=(i-h)/(b.length-1+f);g=b.length==1?[(h+i)/ <del>2]:d3.range(h+k*f/2,i+k/2,k);e=0;return a};a.rangeBands=function(c,f){if(arguments.length<2)f=0;var h=c[0],i=c[1],k=(i-h)/(b.length+f);g=d3.range(h+k*f,i,k);e=k*(1-f);return a};a.rangeRoundBands=function(c,f){if(arguments.length<2)f=0;var h=c[0],i=c[1],k=i-h,j=Math.floor(k/(b.length+f));g=d3.range(h+Math.round((k-(b.length-f)*j)/2),i,j);e=Math.round(j*(1-f));return a};a.rangeBand=function(){return e};return a};d3.scale.category10=function(){return d3.scale.ordinal().range(ab)};d3.scale.category20= <del>function(){return d3.scale.ordinal().range(bb)};d3.scale.category20b=function(){return d3.scale.ordinal().range(cb)};d3.scale.category20c=function(){return d3.scale.ordinal().range(db)};var ab=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],bb=["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"],cb= <del>["#393b79","#5254a3","#6b6ecf","#9c9ede","#637939","#8ca252","#b5cf6b","#cedb9c","#8c6d31","#bd9e39","#e7ba52","#e7cb94","#843c39","#ad494a","#d6616b","#e7969c","#7b4173","#a55194","#ce6dbd","#de9ed6"],db=["#3182bd","#6baed6","#9ecae1","#c6dbef","#e6550d","#fd8d3c","#fdae6b","#fdd0a2","#31a354","#74c476","#a1d99b","#c7e9c0","#756bb1","#9e9ac8","#bcbddc","#dadaeb","#636363","#969696","#bdbdbd","#d9d9d9"];d3.scale.quantile=function(){function a(){for(var f=-1,h=c.length=e.length,i=g.length/h;++f<h;)c[f]= <del>g[~~(f*i)]}function b(f){if(isNaN(f=+f))return NaN;for(var h=0,i=c.length-1;h<=i;){var k=h+i>>1,j=c[k];if(j<f)h=k+1;else if(j>f)i=k-1;else return k}return i<0?0:i}function d(f){return e[b(f)]}var g=[],e=[],c=[];d.domain=function(f){if(!arguments.length)return g;g=f.filter(function(h){return!isNaN(h)}).sort(d3.ascending);a();return d};d.range=function(f){if(!arguments.length)return e;e=f;a();return d};d.quantiles=function(){return c};return d};d3.scale.quantize=function(){function a(f){return c[Math.max(0, <add>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"},ba;for(ba in G)G[ba]=T(G[ba],J,W);d3.hsl=function(a,b,d){return arguments.length==1?T(""+a,Ga,V):V(+a,+b,+d)};var D=function(a,b){return b.querySelector(a)}, <add>ia=function(a,b){return N(b.querySelectorAll(a))};if(typeof Sizzle=="function"){D=function(a,b){return Sizzle(a,b)[0]};ia=function(a,b){return Sizzle.uniqueSort(Sizzle(a,b))}}var O=y([[document]]);O[0].parentNode=document.documentElement;d3.select=function(a){return typeof a=="string"?O.select(a):y([[a]])};d3.selectAll=function(a){return typeof a=="string"?O.selectAll(a):y([N(a)])};d3.transition=O.transition;var Ka=0,Y=0,F=null,Z=0,K;d3.timer=function(a){ja(a,0)};var la=window.requestAnimationFrame|| <add>window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){setTimeout(a,17)};d3.scale={};d3.scale.linear=function(){function a(j){return k((j-d)*f)}function b(j){var o=Math.min(d,g),p=Math.max(d,g),m=p-o,n=Math.pow(10,Math.floor(Math.log(m/j)/Math.LN10));j=j/(m/n);if(j<=0.15)n*=10;else if(j<=0.35)n*=5;else if(j<=0.75)n*=2;return{start:Math.ceil(o/n)*n,stop:Math.floor(p/n)*n+n*0.5,step:n}}var d=0,g=1,e=0,c=1,f=1/(g- <add>d),h=(g-d)/(c-e),i=d3.interpolate,k=i(e,c);a.invert=function(j){return(j-e)*h+d};a.domain=function(j){if(!arguments.length)return[d,g];d=j[0];g=j[1];f=1/(g-d);h=(g-d)/(c-e);return a};a.range=function(j){if(!arguments.length)return[e,c];e=j[0];c=j[1];h=(g-d)/(c-e);k=i(e,c);return a};a.rangeRound=function(j){return a.range(j).interpolate(d3.interpolateRound)};a.interpolate=function(j){if(!arguments.length)return i;k=(i=j)(e,c);return a};a.ticks=function(j){j=b(j);return d3.range(j.start,j.stop,j.step)}; <add>a.tickFormat=function(j){j=Math.max(0,-Math.floor(Math.log(b(j).step)/Math.LN10+0.01));return d3.format(",."+j+"f")};return a};d3.scale.log=function(){function a(c){return(e?-Math.log(-c):Math.log(c))/Math.LN10}function b(c){return e?-Math.pow(10,-c):Math.pow(10,c)}function d(c){return g(a(c))}var g=d3.scale.linear(),e=false;d.invert=function(c){return b(g.invert(c))};d.domain=function(c){if(!arguments.length)return g.domain().map(b);e=(c[0]||c[1])<0;g.domain(c.map(a));return d};d.range=C(d,g.range); <add>d.rangeRound=C(d,g.rangeRound);d.interpolate=C(d,g.interpolate);d.ticks=function(){var c=g.domain(),f=[];if(c.every(isFinite)){var h=Math.floor(c[0]),i=Math.ceil(c[1]),k=b(c[0]);c=b(c[1]);if(e)for(f.push(b(h));h++<i;)for(var j=9;j>0;j--)f.push(b(h)*j);else{for(;h<i;h++)for(j=1;j<10;j++)f.push(b(h)*j);f.push(b(h))}for(h=0;f[h]<k;h++);for(i=f.length;f[i-1]>c;i--);f=f.slice(h,i)}return f};d.tickFormat=function(){return function(c){return c.toPrecision(1)}};return d};d3.scale.pow=function(){function a(i){return h? <add>-Math.pow(-i,c):Math.pow(i,c)}function b(i){return h?-Math.pow(-i,f):Math.pow(i,f)}function d(i){return g(a(i))}var g=d3.scale.linear(),e=d3.scale.linear(),c=1,f=1/c,h=false;d.invert=function(i){return b(g.invert(i))};d.domain=function(i){if(!arguments.length)return g.domain().map(b);h=(i[0]||i[1])<0;g.domain(i.map(a));e.domain(i);return d};d.range=C(d,g.range);d.rangeRound=C(d,g.rangeRound);d.inteprolate=C(d,g.interpolate);d.ticks=e.ticks;d.tickFormat=e.tickFormat;d.exponent=function(i){if(!arguments.length)return c; <add>var k=d.domain();c=i;f=1/i;return d.domain(k)};return d};d3.scale.sqrt=function(){return d3.scale.pow().exponent(0.5)};d3.scale.ordinal=function(){function a(c){c=c in d?d[c]:d[c]=b.push(c)-1;return g[c%g.length]}var b=[],d={},g=[],e=0;a.domain=function(c){if(!arguments.length)return b;b=c;d={};for(var f=-1,h=-1,i=b.length;++f<i;){c=b[f];c in d||(d[c]=++h)}return a};a.range=function(c){if(!arguments.length)return g;g=c;return a};a.rangePoints=function(c,f){if(arguments.length<2)f=0;var h=c[0],i=c[1], <add>k=(i-h)/(b.length-1+f);g=b.length==1?[(h+i)/2]:d3.range(h+k*f/2,i+k/2,k);e=0;return a};a.rangeBands=function(c,f){if(arguments.length<2)f=0;var h=c[0],i=c[1],k=(i-h)/(b.length+f);g=d3.range(h+k*f,i,k);e=k*(1-f);return a};a.rangeRoundBands=function(c,f){if(arguments.length<2)f=0;var h=c[0],i=c[1],k=i-h,j=Math.floor(k/(b.length+f));g=d3.range(h+Math.round((k-(b.length-f)*j)/2),i,j);e=Math.round(j*(1-f));return a};a.rangeBand=function(){return e};return a};d3.scale.category10=function(){return d3.scale.ordinal().range(ab)}; <add>d3.scale.category20=function(){return d3.scale.ordinal().range(bb)};d3.scale.category20b=function(){return d3.scale.ordinal().range(cb)};d3.scale.category20c=function(){return d3.scale.ordinal().range(db)};var ab=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],bb=["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf", <add>"#9edae5"],cb=["#393b79","#5254a3","#6b6ecf","#9c9ede","#637939","#8ca252","#b5cf6b","#cedb9c","#8c6d31","#bd9e39","#e7ba52","#e7cb94","#843c39","#ad494a","#d6616b","#e7969c","#7b4173","#a55194","#ce6dbd","#de9ed6"],db=["#3182bd","#6baed6","#9ecae1","#c6dbef","#e6550d","#fd8d3c","#fdae6b","#fdd0a2","#31a354","#74c476","#a1d99b","#c7e9c0","#756bb1","#9e9ac8","#bcbddc","#dadaeb","#636363","#969696","#bdbdbd","#d9d9d9"];d3.scale.quantile=function(){function a(){for(var f=-1,h=c.length=e.length,i=g.length/ <add>h;++f<h;)c[f]=g[~~(f*i)]}function b(f){if(isNaN(f=+f))return NaN;for(var h=0,i=c.length-1;h<=i;){var k=h+i>>1,j=c[k];if(j<f)h=k+1;else if(j>f)i=k-1;else return k}return i<0?0:i}function d(f){return e[b(f)]}var g=[],e=[],c=[];d.domain=function(f){if(!arguments.length)return g;g=f.filter(function(h){return!isNaN(h)}).sort(d3.ascending);a();return d};d.range=function(f){if(!arguments.length)return e;e=f;a();return d};d.quantiles=function(){return c};return d};d3.scale.quantize=function(){function a(f){return c[Math.max(0, <ide> Math.min(e,Math.floor(g*(f-b))))]}var b=0,d=1,g=2,e=1,c=[0,1];a.domain=function(f){if(!arguments.length)return[b,d];b=f[0];d=f[1];g=c.length/(d-b);return a};a.range=function(f){if(!arguments.length)return c;c=f;g=c.length/(d-b);e=c.length-1;return a};return a};d3.svg={};d3.svg.arc=function(){function a(){var c=b.apply(this,arguments),f=d.apply(this,arguments),h=g.apply(this,arguments)+I,i=e.apply(this,arguments)+I,k=i-h,j=k<Math.PI?"0":"1",o=Math.cos(h);h=Math.sin(h);var p=Math.cos(i);i=Math.sin(i); <del>return k>=eb?c?"M0,"+f+"A"+f+","+f+" 0 1,1 0,"+-f+"A"+f+","+f+" 0 1,1 0,"+f+"M0,"+c+"A"+c+","+c+" 0 1,1 0,"+-c+"A"+c+","+c+" 0 1,1 0,"+c+"Z":"M0,"+f+"A"+f+","+f+" 0 1,1 0,"+-f+"A"+f+","+f+" 0 1,1 0,"+f+"Z":c?"M"+f*o+","+f*h+"A"+f+","+f+" 0 "+j+",1 "+f*p+","+f*i+"L"+c*p+","+c*i+"A"+c+","+c+" 0 "+j+",0 "+c*o+","+c*h+"Z":"M"+f*o+","+f*h+"A"+f+","+f+" 0 "+j+",1 "+f*p+","+f*i+"L0,0Z"}var b=Ma,d=Na,g=ma,e=na;a.innerRadius=function(c){if(!arguments.length)return b;b=v(c);return a};a.outerRadius=function(c){if(!arguments.length)return d; <del>d=v(c);return a};a.startAngle=function(c){if(!arguments.length)return g;g=v(c);return a};a.endAngle=function(c){if(!arguments.length)return e;e=v(c);return a};a.centroid=function(){var c=(b.apply(this,arguments)+d.apply(this,arguments))/2,f=(g.apply(this,arguments)+e.apply(this,arguments))/2+I;return[Math.cos(f)*c,Math.sin(f)*c]};return a};var I=-Math.PI/2,eb=2*Math.PI-1.0E-6;d3.svg.line=function(){function a(f){return f.length<1?null:"M"+e($(this,f,b,d),c)}var b=oa,d=pa,g="linear",e=P[g],c=0.7;a.x= <add>return k>=eb?c?"M0,"+f+"A"+f+","+f+" 0 1,1 0,"+-f+"A"+f+","+f+" 0 1,1 0,"+f+"M0,"+c+"A"+c+","+c+" 0 1,1 0,"+-c+"A"+c+","+c+" 0 1,1 0,"+c+"Z":"M0,"+f+"A"+f+","+f+" 0 1,1 0,"+-f+"A"+f+","+f+" 0 1,1 0,"+f+"Z":c?"M"+f*o+","+f*h+"A"+f+","+f+" 0 "+j+",1 "+f*p+","+f*i+"L"+c*p+","+c*i+"A"+c+","+c+" 0 "+j+",0 "+c*o+","+c*h+"Z":"M"+f*o+","+f*h+"A"+f+","+f+" 0 "+j+",1 "+f*p+","+f*i+"L0,0Z"}var b=Ma,d=Na,g=na,e=oa;a.innerRadius=function(c){if(!arguments.length)return b;b=v(c);return a};a.outerRadius=function(c){if(!arguments.length)return d; <add>d=v(c);return a};a.startAngle=function(c){if(!arguments.length)return g;g=v(c);return a};a.endAngle=function(c){if(!arguments.length)return e;e=v(c);return a};a.centroid=function(){var c=(b.apply(this,arguments)+d.apply(this,arguments))/2,f=(g.apply(this,arguments)+e.apply(this,arguments))/2+I;return[Math.cos(f)*c,Math.sin(f)*c]};return a};var I=-Math.PI/2,eb=2*Math.PI-1.0E-6;d3.svg.line=function(){function a(f){return f.length<1?null:"M"+e($(this,f,b,d),c)}var b=pa,d=qa,g="linear",e=P[g],c=0.7;a.x= <ide> function(f){if(!arguments.length)return b;b=f;return a};a.y=function(f){if(!arguments.length)return d;d=f;return a};a.interpolate=function(f){if(!arguments.length)return g;e=P[g=f];return a};a.tension=function(f){if(!arguments.length)return c;c=f;return a};return a};var P={linear:H,basis:function(a){if(a.length<3)return H(a);var b=[],d=1,g=a.length,e=a[0],c=e[0],f=e[1],h=[c,c,c,(e=a[1])[0]],i=[f,f,f,e[1]];b.push(c,",",f);for(L(b,h,i);++d<g;){e=a[d];h.shift();h.push(e[0]);i.shift();i.push(e[1]);L(b, <del>h,i)}for(d=-1;++d<2;){h.shift();h.push(e[0]);i.shift();i.push(e[1]);L(b,h,i)}return b.join("")},"basis-closed":function(a){for(var b,d=-1,g=a.length,e=g+4,c,f=[],h=[];++d<4;){c=a[d%g];f.push(c[0]);h.push(c[1])}b=[B(M,f),",",B(M,h)];for(--d;++d<e;){c=a[d%g];f.shift();f.push(c[0]);h.shift();h.push(c[1]);L(b,f,h)}return b.join("")},cardinal:function(a,b){if(a.length<3)return H(a);return a[0]+qa(a,ra(a,b))},"cardinal-closed":function(a,b){if(a.length<3)return H(a);return a[0]+qa(a,ra([a[a.length-2]].concat(a, <del>[a[1]]),b))}},sa=[0,2/3,1/3,0],ta=[0,1/3,2/3,0],M=[0,1/6,2/3,1/6];d3.svg.area=function(){function a(h){return h.length<1?null:"M"+c($(this,h,b,g),f)+"L"+c($(this,h,b,d).reverse(),f)+"Z"}var b=oa,d=Oa,g=pa,e="linear",c=P[e],f=0.7;a.x=function(h){if(!arguments.length)return b;b=h;return a};a.y0=function(h){if(!arguments.length)return d;d=h;return a};a.y1=function(h){if(!arguments.length)return g;g=h;return a};a.interpolate=function(h){if(!arguments.length)return e;c=P[e=h];return a};a.tension=function(h){if(!arguments.length)return f; <del>f=h;return a};return a};d3.svg.chord=function(){function a(h,i){var k=b(this,d,h,i),j=b(this,g,h,i);return"M"+k.p0+("A"+k.r+","+k.r+" 0 0,1 "+k.p1)+(k.a0==j.a0&&k.a1==j.a1?"Q 0,0 "+k.p0:"Q 0,0 "+j.p0+("A"+j.r+","+j.r+" 0 0,1 "+j.p1)+("Q 0,0 "+k.p0))+"Z"}function b(h,i,k,j){var o=i.call(h,k,j);i=e.call(h,o,j);k=c.call(h,o,j)+I;h=f.call(h,o,j)+I;return{r:i,a0:k,a1:h,p0:[i*Math.cos(k),i*Math.sin(k)],p1:[i*Math.cos(h),i*Math.sin(h)]}}var d=Pa,g=Qa,e=Ra,c=ma,f=na;a.radius=function(h){if(!arguments.length)return e; <add>h,i)}for(d=-1;++d<2;){h.shift();h.push(e[0]);i.shift();i.push(e[1]);L(b,h,i)}return b.join("")},"basis-closed":function(a){for(var b,d=-1,g=a.length,e=g+4,c,f=[],h=[];++d<4;){c=a[d%g];f.push(c[0]);h.push(c[1])}b=[B(M,f),",",B(M,h)];for(--d;++d<e;){c=a[d%g];f.shift();f.push(c[0]);h.shift();h.push(c[1]);L(b,f,h)}return b.join("")},cardinal:function(a,b){if(a.length<3)return H(a);return a[0]+ra(a,sa(a,b))},"cardinal-closed":function(a,b){if(a.length<3)return H(a);return a[0]+ra(a,sa([a[a.length-2]].concat(a, <add>[a[1]]),b))}},ta=[0,2/3,1/3,0],ua=[0,1/3,2/3,0],M=[0,1/6,2/3,1/6];d3.svg.area=function(){function a(h){return h.length<1?null:"M"+c($(this,h,b,g),f)+"L"+c($(this,h,b,d).reverse(),f)+"Z"}var b=pa,d=Oa,g=qa,e="linear",c=P[e],f=0.7;a.x=function(h){if(!arguments.length)return b;b=h;return a};a.y0=function(h){if(!arguments.length)return d;d=h;return a};a.y1=function(h){if(!arguments.length)return g;g=h;return a};a.interpolate=function(h){if(!arguments.length)return e;c=P[e=h];return a};a.tension=function(h){if(!arguments.length)return f; <add>f=h;return a};return a};d3.svg.chord=function(){function a(h,i){var k=b(this,d,h,i),j=b(this,g,h,i);return"M"+k.p0+("A"+k.r+","+k.r+" 0 0,1 "+k.p1)+(k.a0==j.a0&&k.a1==j.a1?"Q 0,0 "+k.p0:"Q 0,0 "+j.p0+("A"+j.r+","+j.r+" 0 0,1 "+j.p1)+("Q 0,0 "+k.p0))+"Z"}function b(h,i,k,j){var o=i.call(h,k,j);i=e.call(h,o,j);k=c.call(h,o,j)+I;h=f.call(h,o,j)+I;return{r:i,a0:k,a1:h,p0:[i*Math.cos(k),i*Math.sin(k)],p1:[i*Math.cos(h),i*Math.sin(h)]}}var d=Pa,g=Qa,e=Ra,c=na,f=oa;a.radius=function(h){if(!arguments.length)return e; <ide> e=v(h);return a};a.source=function(h){if(!arguments.length)return d;d=v(h);return a};a.target=function(h){if(!arguments.length)return g;g=v(h);return a};a.startAngle=function(h){if(!arguments.length)return c;c=v(h);return a};a.endAngle=function(h){if(!arguments.length)return f;f=v(h);return a};return a};d3.svg.mouse=function(a){var b=(a.ownerSVGElement||a).createSVGPoint();if(ca<0&&(window.scrollX||window.scrollY)){var d=d3.select(document.body).append("svg:svg").style("position","absolute").style("top", <del>0).style("left",0),g=d[0][0].getScreenCTM();ca=!(g.f||g.e);d.remove()}if(ca){b.x=d3.event.pageX;b.y=d3.event.pageY}else{b.x=d3.event.clientX;b.y=d3.event.clientY}b=b.matrixTransform(a.getScreenCTM().inverse());return[b.x,b.y]};var ca=/WebKit/.test(navigator.userAgent)?-1:0;d3.svg.symbol=function(){function a(g,e){return(ua[b.call(this,g,e)]||ua.circle)(d.call(this,g,e))}var b=Ta,d=Sa;a.type=function(g){if(!arguments.length)return b;b=v(g);return a};a.size=function(g){if(!arguments.length)return d; <del>d=v(g);return a};return a};d3.svg.symbolTypes=["circle","cross","diamond","square","triangle-down","triangle-up"];var ua={circle:function(a){a=Math.sqrt(a/Math.PI);return"M0,"+a+"A"+a+","+a+" 0 1,1 0,"+-a+"A"+a+","+a+" 0 1,1 0,"+a+"Z"},cross:function(a){a=Math.sqrt(a/5)/2;return"M"+-3*a+","+-a+"H"+-a+"V"+-3*a+"H"+a+"V"+-a+"H"+3*a+"V"+a+"H"+a+"V"+3*a+"H"+-a+"V"+a+"H"+-3*a+"Z"},diamond:function(a){a=Math.sqrt(a/(2*va));var b=a*va;return"M0,"+-a+"L"+b+",0 0,"+a+" "+-b+",0Z"},square:function(a){a=Math.sqrt(a)/ <del>2;return"M"+-a+","+-a+"L"+a+","+-a+" "+a+","+a+" "+-a+","+a+"Z"},"triangle-down":function(a){a=Math.sqrt(a/Q);var b=a*Q/2;return"M0,"+b+"L"+a+","+-b+" "+-a+","+-b+"Z"},"triangle-up":function(a){a=Math.sqrt(a/Q);var b=a*Q/2;return"M0,"+-b+"L"+a+","+b+" "+-a+","+b+"Z"}},Q=Math.sqrt(3),va=Math.tan(30*Math.PI/180)})(); <add>0).style("left",0),g=d[0][0].getScreenCTM();ca=!(g.f||g.e);d.remove()}if(ca){b.x=d3.event.pageX;b.y=d3.event.pageY}else{b.x=d3.event.clientX;b.y=d3.event.clientY}b=b.matrixTransform(a.getScreenCTM().inverse());return[b.x,b.y]};var ca=/WebKit/.test(navigator.userAgent)?-1:0;d3.svg.symbol=function(){function a(g,e){return(va[b.call(this,g,e)]||va.circle)(d.call(this,g,e))}var b=Ta,d=Sa;a.type=function(g){if(!arguments.length)return b;b=v(g);return a};a.size=function(g){if(!arguments.length)return d; <add>d=v(g);return a};return a};d3.svg.symbolTypes=["circle","cross","diamond","square","triangle-down","triangle-up"];var va={circle:function(a){a=Math.sqrt(a/Math.PI);return"M0,"+a+"A"+a+","+a+" 0 1,1 0,"+-a+"A"+a+","+a+" 0 1,1 0,"+a+"Z"},cross:function(a){a=Math.sqrt(a/5)/2;return"M"+-3*a+","+-a+"H"+-a+"V"+-3*a+"H"+a+"V"+-a+"H"+3*a+"V"+a+"H"+a+"V"+3*a+"H"+-a+"V"+a+"H"+-3*a+"Z"},diamond:function(a){a=Math.sqrt(a/(2*wa));var b=a*wa;return"M0,"+-a+"L"+b+",0 0,"+a+" "+-b+",0Z"},square:function(a){a=Math.sqrt(a)/ <add>2;return"M"+-a+","+-a+"L"+a+","+-a+" "+a+","+a+" "+-a+","+a+"Z"},"triangle-down":function(a){a=Math.sqrt(a/Q);var b=a*Q/2;return"M0,"+b+"L"+a+","+-b+" "+-a+","+-b+"Z"},"triangle-up":function(a){a=Math.sqrt(a/Q);var b=a*Q/2;return"M0,"+-b+"L"+a+","+b+" "+-a+","+b+"Z"}},Q=Math.sqrt(3),wa=Math.tan(30*Math.PI/180)})(); <ide><path>src/core/core.js <del>d3 = {version: "1.5.3"}; // semver <add>d3 = {version: "1.6.0"}; // semver <ide><path>src/core/timer.js <ide> var d3_timer_queue = null, <ide> d3_timer_timeout = 0, <ide> d3_timer_interval; <ide> <add>// The timer will continue to fire until callback returns true. <add>d3.timer = function(callback) { <add> d3_timer(callback, 0); <add>}; <add> <ide> function d3_timer(callback, delay) { <ide> var now = Date.now(), <ide> found = false, <ide><path>src/layout/force.js <ide> d3.layout.force = function() { <ide> l = alpha / (o.distance * o.distance) * (l - distance * o.distance) / l; <ide> x *= l; <ide> y *= l; <del> if (s.fixed) { <del> if (t.fixed) continue; <add> if (!t.fixed) { <ide> t.x -= x; <ide> t.y -= y; <del> } else if (t.fixed) { <del> s.x += x; <del> s.y += y; <del> } else { <add> } <add> if (!s.fixed) { <ide> s.x += x; <ide> s.y += y; <del> t.x -= x; <del> t.y -= y; <ide> } <ide> } <ide> } <ide> <del> // simulated annealing, basically <del> if ((alpha *= .99) < 1e-6) force.stop(); <del> <ide> event.tick.dispatch({type: "tick"}); <add> <add> // simulated annealing, basically <add> return (alpha *= .99) < .005; <ide> } <ide> <ide> force.on = function(type, listener) { <ide> d3.layout.force = function() { <ide> return a.distance - b.distance; <ide> }); <ide> <del> if (interval) clearInterval(interval); <del> interval = setInterval(tick, 24); <add> d3.timer(tick); <ide> return force; <ide> }; <ide> <ide> force.resume = function() { <ide> alpha = .1; <del> if (!interval) interval = setInterval(tick, 24); <add> d3.timer(tick); <ide> return force; <ide> }; <ide> <ide> force.stop = function() { <del> interval = clearInterval(interval); <add> alpha = 0; <ide> return force; <ide> }; <ide>
7
Python
Python
add quotechar to examples
e15d85324a1f5641aaccafbe3cc87556e88ff0a3
<ide><path>numpy/lib/npyio.py <ide> def loadtxt(fname, dtype=float, comments='#', delimiter=None, <ide> <ide> Note that with the default ``encoding="bytes"``, the inputs to the <ide> converter function are latin-1 encoded byte strings. To deactivate the <del> implicit encoding prior to conversion, behavior use ``encoding=None`` <add> implicit encoding prior to conversion, use ``encoding=None`` <ide> <ide> >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94') <ide> >>> conv = lambda x: -float(x[:-1]) if x.endswith('-') else float(x) <ide> >>> np.loadtxt(s, converters=conv, encoding=None) <add> array([[ 10.01, -31.25], <add> [ 19.22, 64.31], <add> [-17.57, 63.94]]) <add> <add> Support for quoted fields is enabled with the `quotechar` parameter. <add> Comment and delimiter characters are ignored when they appear within a <add> quoted item delineated by `quotechar`: <add> <add> >>> s = StringIO('"alpha, #42", 10.0\n"beta, #64", 2.0\n') <add> >>> dtype = np.dtype([("label", "U12"), ("value", float)]) <add> >>> np.loadtxt(s, dtype=dtype, delimiter=",", quotechar='"') <add> array([('alpha, #42', 10.), ('beta, #64', 2.)], <add> dtype=[('label', '<U12'), ('value', '<f8')]) <add> <add> Two consecutive quote characters within a quoted field are treated as a <add> single escaped character: <add> <add> >>> s = StringIO('"Hello, my name is ""Monty""!"') <add> >>> np.loadtxt(s, dtype="U", delimiter=",", quotechar='"') <add> array('Hello, my name is "Monty"!', dtype='<U26') <ide> <ide> """ <ide>
1
Ruby
Ruby
use a class for formula_meta_files
4b72e444613509b3102a94de1d1029a9318fcbad
<ide><path>Library/Homebrew/build.rb <ide> def install f <ide> end <ide> <ide> # Find and link metafiles <del> FORMULA_META_FILES.each do |filename| <del> next if File.directory? filename <del> target_file = filename <del> target_file = "#{filename}.txt" if File.exists? "#{filename}.txt" <del> # Some software symlinks these files (see help2man.rb) <del> target_file = Pathname.new(target_file).resolved_path <del> f.prefix.install target_file => filename rescue nil <del> (f.prefix/filename).chmod 0644 rescue nil <del> end <add> install_meta_files Pathname.pwd, f.prefix <ide> end <ide> end <ide> end <ide> <add>def install_meta_files src_path, dst_path <add> src_path.children.each do |p| <add> next if p.directory? <add> next unless FORMULA_META_FILES.should_copy? p <add> # Some software symlinks these files (see help2man.rb) <add> filename = p.resolved_path <add> filename.chmod 0644 <add> dst_path.install filename <add> end <add>end <add> <ide> def fixopt f <ide> path = if f.linked_keg.directory? and f.linked_keg.symlink? <ide> f.linked_keg.realpath <ide><path>Library/Homebrew/cmd/list.rb <ide> def initialize path <ide> else <ide> print_dir pn <ide> end <del> elsif not (FORMULA_META_FILES + %w[.DS_Store INSTALL_RECEIPT.json]).include? pn.basename.to_s <add> elsif FORMULA_META_FILES.should_list? pn.basename.to_s <ide> puts pn <ide> end <ide> end <ide><path>Library/Homebrew/global.rb <ide> module Homebrew extend self <ide> alias_method :failed?, :failed <ide> end <ide> <del>FORMULA_META_FILES = %w[README README.md ChangeLog CHANGES COPYING LICENSE LICENCE COPYRIGHT AUTHORS] <add>require 'metafiles' <add>FORMULA_META_FILES = Metafiles.new <ide> ISSUES_URL = "https://github.com/mxcl/homebrew/wiki/troubleshooting" <ide> <ide> unless ARGV.include? "--no-compat" or ENV['HOMEBREW_NO_COMPAT'] <ide><path>Library/Homebrew/metafiles.rb <add>class Metafiles <add> <add> def initialize <add> @exts = %w[.txt .md .html] <add> @metafiles = %w[readme changelog changes copying license licence copyright authors] <add> end <add> <add> def + other <add> @metafiles + other <add> end <add> <add> def should_copy? file <add> include? file <add> end <add> <add> def should_list? file <add> return false if %w[.DS_Store INSTALL_RECEIPT.json].include? file <add> not include? file <add> end <add> <add>private <add> <add> def include? p <add> p = p.to_s # Might be a pathname <add> p = p.downcase <add> path = Pathname.new(p) <add> if @exts.include? path.extname <add> p = path.basename(path.extname) <add> else <add> p = path.basename <add> end <add> p = p.to_s <add> return @metafiles.include? p <add> end <add> <add>end
4
Python
Python
replace assertions with valueerror exception
ebd48c6de544e22dd4c5743fb27039bf24b811e1
<ide><path>examples/pytorch/language-modeling/run_mlm.py <ide> def __post_init__(self): <ide> else: <ide> if self.train_file is not None: <ide> extension = self.train_file.split(".")[-1] <del> assert extension in ["csv", "json", "txt"], "`train_file` should be a csv, a json or a txt file." <add> if extension not in ["csv", "json", "txt"]: <add> raise ValueError("`train_file` should be a csv, a json or a txt file.") <ide> if self.validation_file is not None: <ide> extension = self.validation_file.split(".")[-1] <del> assert extension in ["csv", "json", "txt"], "`validation_file` should be a csv, a json or a txt file." <add> if extension not in ["csv", "json", "txt"]: <add> raise ValueError("`validation_file` should be a csv, a json or a txt file.") <ide> <ide> <ide> def main(): <ide><path>examples/pytorch/language-modeling/run_mlm_no_trainer.py <ide> def parse_args(): <ide> else: <ide> if args.train_file is not None: <ide> extension = args.train_file.split(".")[-1] <del> assert extension in ["csv", "json", "txt"], "`train_file` should be a csv, json or txt file." <add> if extension not in ["csv", "json", "txt"]: <add> raise ValueError("`train_file` should be a csv, json or txt file.") <ide> if args.validation_file is not None: <ide> extension = args.validation_file.split(".")[-1] <del> assert extension in ["csv", "json", "txt"], "`validation_file` should be a csv, json or txt file." <add> if extension not in ["csv", "json", "txt"]: <add> raise ValueError("`validation_file` should be a csv, json or txt file.") <ide> <ide> if args.push_to_hub: <ide> assert args.output_dir is not None, "Need an `output_dir` to create a repo when `--push_to_hub` is passed."
2
Python
Python
fix error in documentation
31e969b33a5e95f4c5248b725d7a5d3f8956f52b
<ide><path>numpy/lib/shape_base.py <ide> def column_stack(tup): <ide> -------- <ide> hstack, vstack, concatenate <ide> <del> Notes <del> ----- <del> This function is equivalent to ``np.vstack(tup).T``. <del> <ide> Examples <ide> -------- <ide> >>> a = np.array((1,2,3))
1
Javascript
Javascript
finish implementation of sortable mixin
136455596cd02a2b543732f620302cbfd7ee3117
<ide><path>packages/ember-runtime/lib/mixins/sortable.js <del>var get = Ember.get; <add>var get = Ember.get, set = Ember.set, forEach = Ember.ArrayUtils.forEach; <ide> <del>Ember.SortableMixin = Ember.Mixin.create({ <del> arrangedContent: Ember.computed('content', 'orderBy', function(key, value) { <add>Ember.SortableMixin = Ember.Mixin.create(Ember.MutableEnumerable, { <add> sortProperties: null, <add> sortAscending: true, <add> <add> addObject: function(obj) { <add> var content = get(this, 'content'); <add> content.pushObject(obj); <add> }, <add> <add> removeObject: function(obj) { <add> var content = get(this, 'content'); <add> content.removeObject(obj); <add> }, <add> <add> orderBy: function(item1, item2) { <add> var result = 0, <add> sortProperties = get(this, 'sortProperties'), <add> sortAscending = get(this, 'sortAscending'); <add> <add> Ember.assert("you need to define `sortProperties`", !!sortProperties); <add> <add> forEach(sortProperties, function(propertyName) { <add> if (result === 0) { <add> result = Ember.compare(get(item1, propertyName), get(item2, propertyName)); <add> if ((result !== 0) && !sortAscending) { <add> result = (-1) * result; <add> } <add> } <add> }); <add> <add> return result; <add> }, <add> <add> destroy: function() { <ide> var content = get(this, 'content'), <del> orderBy = get(this, 'orderBy'); <add> sortProperties = get(this, 'sortProperties'); <ide> <del> if (orderBy) { <del> content = content.slice(); <del> content.sort(function(a, b) { <del> var aValue, bValue; <add> if (content && sortProperties) { <add> forEach(content, function(item) { <add> forEach(sortProperties, function(sortProperty) { <add> Ember.removeObserver(item, sortProperty, this, 'contentItemSortPropertyDidChange'); <add> }, this); <add> }, this); <add> } <ide> <del> aValue = a ? get(a, orderBy) : undefined; <del> bValue = b ? get(b, orderBy) : undefined; <add> return this._super(); <add> }, <ide> <del> if (aValue < bValue) { return -1; } <del> if (aValue > bValue) { return 1; } <add> isSorted: Ember.computed('sortProperties', function() { <add> return !!get(this, 'sortProperties'); <add> }), <ide> <del> return 0; <del> }); <add> arrangedContent: Ember.computed('content', 'sortProperties.@each', function(key, value) { <add> var content = get(this, 'content'), <add> isSorted = get(this, 'isSorted'), <add> sortProperties = get(this, 'sortProperties'), <add> self = this; <ide> <add> if (content && isSorted) { <add> content = content.slice(); <add> content.sort(function(item1, item2) { <add> return self.orderBy(item1, item2); <add> }); <add> forEach(content, function(item) { <add> forEach(sortProperties, function(sortProperty) { <add> Ember.addObserver(item, sortProperty, this, 'contentItemSortPropertyDidChange'); <add> }, this); <add> }, this); <ide> return Ember.A(content); <ide> } <ide> <ide> return content; <ide> }).cacheable(), <ide> <add> _contentWillChange: Ember.beforeObserver(function() { <add> var content = get(this, 'content'), <add> sortProperties = get(this, 'sortProperties'); <add> <add> if (content && sortProperties) { <add> forEach(content, function(item) { <add> forEach(sortProperties, function(sortProperty) { <add> Ember.removeObserver(item, sortProperty, this, 'contentItemSortPropertyDidChange'); <add> }, this); <add> }, this); <add> } <add> <add> this._super(); <add> }, 'content'), <add> <add> sortAscendingWillChange: Ember.beforeObserver(function() { <add> this._lastSortAscending = get(this, 'sortAscending'); <add> }, 'sortAscending'), <add> <add> sortAscendingDidChange: Ember.observer(function() { <add> if (get(this, 'sortAscending') !== this._lastSortAscending) { <add> var arrangedContent = get(this, 'arrangedContent'); <add> arrangedContent.reverse(); <add> } <add> }, 'sortAscending'), <add> <ide> contentArrayWillChange: function(array, idx, removedCount, addedCount) { <del> var orderBy = get(this, 'orderBy'); <add> var isSorted = get(this, 'isSorted'); <ide> <del> if (orderBy) { <add> if (isSorted) { <ide> var arrangedContent = get(this, 'arrangedContent'); <ide> var removedObjects = array.slice(idx, idx+removedCount); <add> var sortProperties = get(this, 'sortProperties'); <ide> <ide> removedObjects.forEach(function(item) { <ide> arrangedContent.removeObject(item); <add> <add> forEach(sortProperties, function(sortProperty) { <add> Ember.removeObserver(item, sortProperty, this, 'contentItemSortPropertyDidChange'); <add> }, this); <ide> }); <ide> } <ide> <ide> return this._super(array, idx, removedCount, addedCount); <ide> }, <ide> <ide> contentArrayDidChange: function(array, idx, removedCount, addedCount) { <del> var orderBy = get(this, 'orderBy'); <add> var isSorted = get(this, 'isSorted'), <add> sortProperties = get(this, 'sortProperties'); <ide> <del> if (orderBy) { <add> if (isSorted) { <ide> var addedObjects = array.slice(idx, idx+addedCount); <ide> var arrangedContent = get(this, 'arrangedContent'); <del> var length = arrangedContent.get('length'); <ide> <del> addedObjects.forEach(function(object) { <del> idx = this._binarySearch(get(object, orderBy), orderBy, 0, length); <del> arrangedContent.insertAt(idx, object); <del> object.addObserver(orderBy, this, 'contentItemOrderByDidChange'); <del> length++; <add> addedObjects.forEach(function(item) { <add> this.insertItemSorted(item); <add> <add> forEach(sortProperties, function(sortProperty) { <add> Ember.addObserver(item, sortProperty, this, 'contentItemSortPropertyDidChange'); <add> }, this); <ide> this.arrayContentDidChange(idx, 0, 1); <ide> }, this); <ide> } <ide> <ide> return this._super(array, idx, removedCount, addedCount); <ide> }, <ide> <del> _binarySearch: function(value, orderBy, low, high) { <del> var mid, midValue; <add> insertItemSorted: function(item) { <add> var arrangedContent = get(this, 'arrangedContent'); <add> var length = get(arrangedContent, 'length'); <add> <add> var idx = this._binarySearch(item, 0, length); <add> arrangedContent.insertAt(idx, item); <add> }, <add> <add> contentItemSortPropertyDidChange: function(item) { <add> var arrangedContent = get(this, 'arrangedContent'), <add> index = arrangedContent.indexOf(item); <add> <add> arrangedContent.removeObject(item); <add> this.insertItemSorted(item); <add> }, <add> <add> _binarySearch: function(item, low, high) { <add> var mid, midItem, res, arrangedContent; <ide> <ide> if (low === high) { <ide> return low; <ide> } <ide> <add> arrangedContent = get(this, 'arrangedContent'); <add> <ide> mid = low + Math.floor((high - low) / 2); <del> midValue = get(this.objectAt(mid), orderBy); <add> midItem = arrangedContent.objectAt(mid); <add> <add> res = this.orderBy(midItem, item); <ide> <del> if (value > midValue) { <del> return this._binarySearch(value, orderBy, mid+1, high); <del> } else if (value < midValue) { <del> return this._binarySearch(value, orderBy, low, mid); <add> if (res < 0) { <add> return this._binarySearch(item, mid+1, high); <add> } else if (res > 0) { <add> return this._binarySearch(item, low, mid); <ide> } <ide> <ide> return mid;
1
Ruby
Ruby
fix code formatting [ci skip]
25c3eab0dcf09a45bcde905710da6a5f5e502c5c
<ide><path>activerecord/lib/active_record/signed_id.rb <ide> module ClassMethods <ide> # a certain time period. <ide> # <ide> # You set the time period that the signed id is valid for during generation, using the instance method <del> # +signed_id(expires_in: 15.minutes)+. If the time has elapsed before a signed find is attempted, <add> # <tt>signed_id(expires_in: 15.minutes)</tt>. If the time has elapsed before a signed find is attempted, <ide> # the signed id will no longer be valid, and nil is returned. <ide> # <ide> # It's possible to further restrict the use of a signed id with a purpose. This helps when you have a
1
Text
Text
clarify descriptions of _writev chunks argument
96c3498710f48f7f7882c19a4764ebd7cf6fc0d8
<ide><path>doc/api/stream.md <ide> user programs. <ide> <ide> #### `writable._writev(chunks, callback)` <ide> <del>* `chunks` {Object[]} The chunks to be written. Each chunk has following <del> format: `{ chunk: ..., encoding: ... }`. <add>* `chunks` {Object[]} The data to be written. The value is an array of {Object} <add> that each represent a discreet chunk of data to write. The properties of <add> these objects are: <add> * `chunk` {Buffer|string} A buffer instance or string containing the data to <add> be written. The `chunk` will be a string if the `Writable` was created with <add> the `decodeStrings` option set to `false` and a string was passed to `write()`. <add> * `encoding` {string} The character encoding of the `chunk`. If `chunk` is <add> a `Buffer`, the `encoding` will be `'buffer`. <ide> * `callback` {Function} A callback function (optionally with an error <ide> argument) to be invoked when processing is complete for the supplied chunks. <ide>
1
Ruby
Ruby
remove some unnecessary code etc
bd920eae82f83268b2a6ed31c0275255e01bad9f
<ide><path>activerecord/lib/active_record/attribute_methods/read.rb <ide> def undefine_attribute_methods <ide> # The second, slower, branch is necessary to support instances where the database <ide> # returns columns with extra stuff in (like 'my_column(omg)'). <ide> def define_method_attribute(attr_name) <del> internal = internal_attribute_access_code(attr_name) <del> external = external_attribute_access_code(attr_name) <add> cast_code = attribute_cast_code(attr_name) <add> internal = internal_attribute_access_code(attr_name, cast_code) <add> external = external_attribute_access_code(attr_name, cast_code) <ide> <ide> if attr_name =~ ActiveModel::AttributeMethods::NAME_COMPILABLE_REGEXP <ide> generated_attribute_methods.module_eval <<-STR, __FILE__, __LINE__ <ide> def cacheable_column?(column) <ide> attribute_types_cached_by_default.include?(column.type) <ide> end <ide> <del> def internal_attribute_access_code(attr_name) <del> access_code = "(v=@attributes['#{attr_name}']) && #{attribute_cast_code(attr_name)}" <add> def internal_attribute_access_code(attr_name, cast_code) <add> access_code = "(v=@attributes['#{attr_name}']) && #{cast_code}" <ide> <del> unless attr_name == self.primary_key <add> unless attr_name == primary_key <ide> access_code.insert(0, "missing_attribute('#{attr_name}', caller) unless @attributes.has_key?('#{attr_name}'); ") <ide> end <ide> <ide> def internal_attribute_access_code(attr_name) <ide> access_code <ide> end <ide> <del> def external_attribute_access_code(attr_name) <del> access_code = "v && #{attribute_cast_code(attr_name)}" <add> def external_attribute_access_code(attr_name, cast_code) <add> access_code = "v && #{cast_code}" <ide> <ide> if cache_attribute?(attr_name) <ide> access_code = "attributes_cache[attr_name] ||= (#{access_code})" <ide><path>activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb <ide> module ClassMethods <ide> # Defined for all +datetime+ and +timestamp+ attributes when +time_zone_aware_attributes+ are enabled. <ide> # This enhanced read method automatically converts the UTC time stored in the database to the time <ide> # zone stored in Time.zone. <del> def internal_attribute_access_code(attr_name) <add> def internal_attribute_access_code(attr_name, cast_code) <ide> column = columns_hash[attr_name] <ide> <ide> if create_time_zone_conversion_attribute?(attr_name, column) <del> <<-CODE <del> cached = @attributes_cache['#{attr_name}'] <del> return cached if cached <del> v = @attributes['#{attr_name}'] <del> time = #{column.type_cast_code('v')} <del> @attributes_cache['#{attr_name}'] = time.acts_like?(:time) ? time.in_time_zone : time <del> CODE <del> else <del> super <del> end <del> end <del> <del> def external_attribute_access_code(attr_name) <del> column = columns_hash[attr_name] <del> <del> if create_time_zone_conversion_attribute?(attr_name, column) <del> "attributes_cache[attr_name] ||= (#{attribute_cast_code(attr_name)})" <add> super(attr_name, "(v=#{column.type_cast_code('v')}) && #{cast_code}") <ide> else <ide> super <ide> end <ide> end <ide> <ide> def attribute_cast_code(attr_name) <ide> if create_time_zone_conversion_attribute?(attr_name, columns_hash[attr_name]) <del> "v.acts_like?(:time) ? v.in_time_zone : v" <add> "(v.acts_like?(:time) ? v.in_time_zone : v)" <ide> else <ide> super <ide> end
2
Javascript
Javascript
add ecosystem file for pm2
0e77b1523fe15a4bb3c76e57eef15b606adbab11
<ide><path>api-server/ecosystem.config.js <add>const fs = require('fs'); <add>const path = require('path'); <add> <add>const dotenv = require('dotenv'); <add> <add>const filePath = path.resolve('..', '.env'); <add>const env = dotenv.parse(fs.readFileSync(filePath)); <add> <add>module.exports = { <add> apps: [ <add> { <add> script: `./lib/production-start.js`, <add> env, <add> max_memory_restart: '600M', <add> instances: 'max', <add> exec_mode: 'cluster', <add> name: 'org' <add> } <add> ] <add>};
1
PHP
PHP
fix queue connection binding
c206fa0a7fe6be8087de5b042a8ad8d81885bb2b
<ide><path>src/Illuminate/Foundation/Application.php <ide> public function registerCoreContainerAliases() <ide> 'paginator' => 'Illuminate\Pagination\Factory', <ide> 'auth.reminder' => ['Illuminate\Auth\Reminders\PasswordBroker', 'Illuminate\Contracts\Auth\PasswordBroker'], <ide> 'queue' => 'Illuminate\Queue\QueueManager', <del> 'queue.store' => 'Illuminate\Contracts\Queue\Queue', <add> 'queue.connection' => 'Illuminate\Contracts\Queue\Queue', <ide> 'redirect' => 'Illuminate\Routing\Redirector', <ide> 'redis' => ['Illuminate\Redis\Database', 'Illuminate\Contracts\Redis\Database'], <ide> 'request' => 'Illuminate\Http\Request', <ide><path>src/Illuminate/Queue/QueueServiceProvider.php <ide> protected function registerManager() <ide> return $manager; <ide> }); <ide> <del> $this->app->bindShared('queue.driver', function($app) <add> $this->app->bindShared('queue.connection', function($app) <ide> { <ide> return $app['queue']->connection(); <ide> });
2
Go
Go
remove ghost state
cf997aa905c5c6f5a29fa3658d904ffc81a1a4a1
<ide><path>daemon/daemon.go <ide> func (daemon *Daemon) load(id string) (*Container, error) { <ide> if container.ID != id { <ide> return container, fmt.Errorf("Container %s is stored at %s", container.ID, id) <ide> } <del> if container.State.IsRunning() { <del> container.State.SetGhost(true) <del> } <ide> return container, nil <ide> } <ide> <ide> func (daemon *Daemon) Register(container *Container) error { <ide> // if so, then we need to restart monitor and init a new lock <ide> // If the container is supposed to be running, make sure of it <ide> if container.State.IsRunning() { <del> if container.State.IsGhost() { <del> utils.Debugf("killing ghost %s", container.ID) <add> utils.Debugf("killing old running container %s", container.ID) <ide> <del> existingPid := container.State.Pid <del> container.State.SetGhost(false) <del> container.State.SetStopped(0) <add> existingPid := container.State.Pid <add> container.State.SetStopped(0) <ide> <del> // We only have to handle this for lxc because the other drivers will ensure that <del> // no ghost processes are left when docker dies <del> if container.ExecDriver == "" || strings.Contains(container.ExecDriver, "lxc") { <del> lxc.KillLxc(container.ID, 9) <del> } else { <del> // use the current driver and ensure that the container is dead x.x <del> cmd := &execdriver.Command{ <del> ID: container.ID, <del> } <del> var err error <del> cmd.Process, err = os.FindProcess(existingPid) <del> if err != nil { <del> utils.Debugf("cannot find existing process for %d", existingPid) <del> } <del> daemon.execDriver.Terminate(cmd) <del> } <del> if err := container.Unmount(); err != nil { <del> utils.Debugf("ghost unmount error %s", err) <add> // We only have to handle this for lxc because the other drivers will ensure that <add> // no processes are left when docker dies <add> if container.ExecDriver == "" || strings.Contains(container.ExecDriver, "lxc") { <add> lxc.KillLxc(container.ID, 9) <add> } else { <add> // use the current driver and ensure that the container is dead x.x <add> cmd := &execdriver.Command{ <add> ID: container.ID, <ide> } <del> if err := container.ToDisk(); err != nil { <del> utils.Debugf("saving ghost state to disk %s", err) <add> var err error <add> cmd.Process, err = os.FindProcess(existingPid) <add> if err != nil { <add> utils.Debugf("cannot find existing process for %d", existingPid) <ide> } <add> daemon.execDriver.Terminate(cmd) <add> } <add> if err := container.Unmount(); err != nil { <add> utils.Debugf("unmount error %s", err) <add> } <add> if err := container.ToDisk(); err != nil { <add> utils.Debugf("saving stopped state to disk %s", err) <ide> } <ide> <ide> info := daemon.execDriver.Info(container.ID) <ide> func (daemon *Daemon) Register(container *Container) error { <ide> utils.Debugf("restart unmount error %s", err) <ide> } <ide> <del> container.State.SetGhost(false) <del> container.State.SetStopped(0) <ide> if err := container.Start(); err != nil { <ide> return err <ide> } <ide><path>daemon/state.go <ide> type State struct { <ide> ExitCode int <ide> StartedAt time.Time <ide> FinishedAt time.Time <del> Ghost bool <ide> } <ide> <ide> // String returns a human-readable description of the state <ide> func (s *State) String() string { <ide> defer s.RUnlock() <ide> <ide> if s.Running { <del> if s.Ghost { <del> return fmt.Sprintf("Ghost") <del> } <ide> return fmt.Sprintf("Up %s", utils.HumanDuration(time.Now().UTC().Sub(s.StartedAt))) <ide> } <ide> if s.FinishedAt.IsZero() { <ide> func (s *State) IsRunning() bool { <ide> return s.Running <ide> } <ide> <del>func (s *State) IsGhost() bool { <del> s.RLock() <del> defer s.RUnlock() <del> <del> return s.Ghost <del>} <del> <ide> func (s *State) GetExitCode() int { <ide> s.RLock() <ide> defer s.RUnlock() <ide> <ide> return s.ExitCode <ide> } <ide> <del>func (s *State) SetGhost(val bool) { <del> s.Lock() <del> defer s.Unlock() <del> <del> s.Ghost = val <del>} <del> <ide> func (s *State) SetRunning(pid int) { <ide> s.Lock() <ide> defer s.Unlock() <ide> <ide> s.Running = true <del> s.Ghost = false <ide> s.ExitCode = 0 <ide> s.Pid = pid <ide> s.StartedAt = time.Now().UTC()
2
Python
Python
add a test for ticket
103988055053f7a30083fd28c0887a5f2922a67c
<ide><path>numpy/core/tests/test_regression.py <ide> def test_unicode_alloc_dealloc_match(self): <ide> a = np.array(['abc'], dtype=np.unicode)[0] <ide> del a <ide> <add> def test_refcount_error_in_clip(self): <add> # Ticket #1588 <add> a = np.zeros((2,), dtype='>i2').clip(min=0) <add> x = a + a <add> # This used to segfault: <add> y = str(x) <add> # Check the final string: <add> assert_(y == "[0 0]") <add> <ide> if __name__ == "__main__": <ide> run_module_suite()
1
PHP
PHP
apply fixes from styleci
9c033c21f32ef6a545ed49ed939d4fbd4b950aab
<ide><path>src/Illuminate/Hashing/BcryptHasher.php <ide> public function check($value, $hashedValue, array $options = []) <ide> public function needsRehash($hashedValue, array $options = []) <ide> { <ide> return password_needs_rehash($hashedValue, PASSWORD_BCRYPT, [ <del> 'cost' => isset($options['rounds']) ? $options['rounds'] : $this->rounds <add> 'cost' => isset($options['rounds']) ? $options['rounds'] : $this->rounds, <ide> ]); <ide> } <ide>
1
Text
Text
fix minor typo in pixelratio.md
a1d77af07cd4fb230b838b6981d049c882421554
<ide><path>docs/PixelRatio.md <ide> ## Pixel Grid Snapping <ide> <del>In iOS, you can specify positions and dimensions for elements with arbitrary precision, for example 29.674825. But, ultimately the physical display only have a fixed number of pixels, for example 640×960 for iphone 4 or 750×1334 for iphone 6. iOS tries to be as faithful as possible to the user value by spreading one original pixel into multiple ones to trick the eye. The downside of this technique is that it makes the resulting element look blurry. <add>In iOS, you can specify positions and dimensions for elements with arbitrary precision, for example 29.674825. But, ultimately the physical display only have a fixed number of pixels, for example 640×960 for iPhone 4 or 750×1334 for iPhone 6. iOS tries to be as faithful as possible to the user value by spreading one original pixel into multiple ones to trick the eye. The downside of this technique is that it makes the resulting element look blurry. <ide> <ide> In practice, we found out that developers do not want this feature and they have to work around it by doing manual rounding in order to avoid having blurry elements. In React Native, we are rounding all the pixels automatically. <ide>
1
Python
Python
remove dag parsing from standardtaskrunner
ce071172e22fba018889db7dcfac4a4d0fc41cda
<ide><path>airflow/cli/commands/task_command.py <ide> from airflow.utils import cli as cli_utils <ide> from airflow.utils.cli import ( <ide> get_dag, <del> get_dag_by_deserialization, <ide> get_dag_by_file_location, <ide> get_dag_by_pickle, <ide> get_dags, <ide> def task_run(args, dag=None): <ide> print(f'Loading pickle id: {args.pickle}') <ide> dag = get_dag_by_pickle(args.pickle) <ide> elif not dag: <del> if args.local: <del> try: <del> dag = get_dag_by_deserialization(args.dag_id) <del> except AirflowException: <del> print(f'DAG {args.dag_id} does not exist in the database, trying to parse the dag_file') <del> dag = get_dag(args.subdir, args.dag_id) <del> else: <del> dag = get_dag(args.subdir, args.dag_id) <add> dag = get_dag(args.subdir, args.dag_id, include_examples=False) <ide> else: <ide> # Use DAG from parameter <ide> pass <ide><path>airflow/task/task_runner/standard_task_runner.py <ide> class StandardTaskRunner(BaseTaskRunner): <ide> def __init__(self, local_task_job): <ide> super().__init__(local_task_job) <ide> self._rc = None <add> self.dag = local_task_job.task_instance.task.dag <ide> <ide> def start(self): <ide> if CAN_FORK and not self.run_as_user: <ide> def _start_by_fork(self): <ide> from airflow import settings <ide> from airflow.cli.cli_parser import get_parser <ide> from airflow.sentry import Sentry <del> from airflow.utils.cli import get_dag <ide> <ide> # Force a new SQLAlchemy session. We can't share open DB handles <ide> # between process. The cli code will re-create this as part of its <ide> def _start_by_fork(self): <ide> dag_id=self._task_instance.dag_id, <ide> task_id=self._task_instance.task_id, <ide> ): <del> # parse dag file since `airflow tasks run --local` does not parse dag file <del> dag = get_dag(args.subdir, args.dag_id) <del> args.func(args, dag=dag) <del> return_code = 0 <add> args.func(args, dag=self.dag) <add> return_code = 0 <ide> except Exception as exc: <ide> return_code = 1 <ide> <ide><path>airflow/utils/cli.py <ide> from typing import TYPE_CHECKING, Callable, TypeVar, cast <ide> <ide> from airflow import settings <add>from airflow.configuration import conf <ide> from airflow.exceptions import AirflowException <ide> from airflow.utils import cli_action_loggers <ide> from airflow.utils.log.non_caching_file_handler import NonCachingFileHandler <ide> def _search_for_dag_file(val: str | None) -> str | None: <ide> return None <ide> <ide> <del>def get_dag(subdir: str | None, dag_id: str) -> DAG: <add>def get_dag( <add> subdir: str | None, dag_id: str, include_examples=conf.getboolean('core', 'LOAD_EXAMPLES') <add>) -> DAG: <ide> """ <ide> Returns DAG of a given dag_id <ide> <ide> def get_dag(subdir: str | None, dag_id: str) -> DAG: <ide> from airflow.models import DagBag <ide> <ide> first_path = process_subdir(subdir) <del> dagbag = DagBag(first_path) <add> dagbag = DagBag(first_path, include_examples=include_examples) <ide> if dag_id not in dagbag.dags: <ide> fallback_path = _search_for_dag_file(subdir) or settings.DAGS_FOLDER <ide> logger.warning("Dag %r not found in path %s; trying path %s", dag_id, first_path, fallback_path) <del> dagbag = DagBag(dag_folder=fallback_path) <add> dagbag = DagBag(dag_folder=fallback_path, include_examples=include_examples) <ide> if dag_id not in dagbag.dags: <ide> raise AirflowException( <ide> f"Dag {dag_id!r} could not be found; either it does not exist or it failed to parse." <ide> ) <ide> return dagbag.dags[dag_id] <ide> <ide> <del>def get_dag_by_deserialization(dag_id: str) -> DAG: <del> from airflow.models.serialized_dag import SerializedDagModel <del> <del> dag_model = SerializedDagModel.get(dag_id) <del> if dag_model is None: <del> raise AirflowException(f"Serialized DAG: {dag_id} could not be found") <del> <del> return dag_model.dag <del> <del> <ide> def get_dags(subdir: str | None, dag_id: str, use_regex: bool = False): <ide> """Returns DAG(s) matching a given regex or dag_id""" <ide> from airflow.models import DagBag <ide><path>tests/cli/commands/test_task_command.py <ide> def test_test_filters_secrets(self, capsys): <ide> task_command.task_test(args) <ide> assert capsys.readouterr().out.endswith(f"{not_password}\n") <ide> <del> @mock.patch("airflow.cli.commands.task_command.get_dag_by_deserialization") <del> @mock.patch("airflow.cli.commands.task_command.LocalTaskJob") <del> def test_run_get_serialized_dag(self, mock_local_job, mock_get_dag_by_deserialization): <del> """ <del> Test using serialized dag for local task_run <del> """ <del> task_id = self.dag.task_ids[0] <del> args = [ <del> 'tasks', <del> 'run', <del> '--ignore-all-dependencies', <del> '--local', <del> self.dag_id, <del> task_id, <del> self.run_id, <del> ] <del> mock_get_dag_by_deserialization.return_value = SerializedDagModel.get(self.dag_id).dag <del> <del> task_command.task_run(self.parser.parse_args(args)) <del> mock_local_job.assert_called_once_with( <del> task_instance=mock.ANY, <del> mark_success=False, <del> ignore_all_deps=True, <del> ignore_depends_on_past=False, <del> ignore_task_deps=False, <del> ignore_ti_state=False, <del> pickle_id=None, <del> pool=None, <del> external_executor_id=None, <del> ) <del> mock_get_dag_by_deserialization.assert_called_once_with(self.dag_id) <del> <ide> def test_cli_test_different_path(self, session): <ide> """ <ide> When thedag processor has a different dags folder <ide> def test_cli_test_different_path(self, session): <ide> # verify that the file was in different location when run <ide> assert ti.xcom_pull(ti.task_id) == new_file_path.as_posix() <ide> <del> @mock.patch("airflow.cli.commands.task_command.get_dag_by_deserialization") <del> @mock.patch("airflow.cli.commands.task_command.LocalTaskJob") <del> def test_run_get_serialized_dag_fallback(self, mock_local_job, mock_get_dag_by_deserialization): <del> """ <del> Fallback to parse dag_file when serialized dag does not exist in the db <del> """ <del> task_id = self.dag.task_ids[0] <del> args = [ <del> 'tasks', <del> 'run', <del> '--ignore-all-dependencies', <del> '--local', <del> self.dag_id, <del> task_id, <del> self.run_id, <del> ] <del> mock_get_dag_by_deserialization.side_effect = mock.Mock(side_effect=AirflowException('Not found')) <del> <del> task_command.task_run(self.parser.parse_args(args)) <del> mock_local_job.assert_called_once_with( <del> task_instance=mock.ANY, <del> mark_success=False, <del> ignore_all_deps=True, <del> ignore_depends_on_past=False, <del> ignore_task_deps=False, <del> ignore_ti_state=False, <del> pickle_id=None, <del> pool=None, <del> external_executor_id=None, <del> ) <del> mock_get_dag_by_deserialization.assert_called_once_with(self.dag_id) <del> <ide> @mock.patch("airflow.cli.commands.task_command.LocalTaskJob") <ide> def test_run_with_existing_dag_run_id(self, mock_local_job): <ide> """
4
PHP
PHP
add index reflection into describe()
25863adbfd27f7ad3028ef4b1a9749ad725f90ea
<ide><path>lib/Cake/Database/Schema/Collection.php <ide> public function describe($name) { <ide> <ide> $table = new Table($name); <ide> $fieldParams = []; <del> if (method_exists($this->_dialect, 'extraSchemaColumn')) { <add> if (method_exists($this->_dialect, 'extraSchemaColumns')) { <ide> $fieldParams = $this->_dialect->extraSchemaColumns(); <ide> } <ide> foreach ($statement->fetchAll('assoc') as $row) { <ide> $this->_dialect->convertFieldDescription($table, $row, $fieldParams); <ide> } <add> <add> list($sql, $params) = $this->_dialect->describeIndexSql( <add> $name, <add> $this->_connection->config() <add> ); <add> try { <add> $statement = $this->_connection->execute($sql, $params); <add> } catch (\PDOException $e) { <add> return null; <add> } <add> foreach ($statement->fetchAll('assoc') as $row) { <add> $this->_dialect->convertIndexDescription($table, $row); <add> } <ide> return $table; <ide> } <ide>
1
Python
Python
apply `execfile` fixer results
36e979c465150b1846f37f1811b86f63f9d1e085
<ide><path>setupegg.py <ide> setupfile = imp.load_source('setupfile', 'setup.py') <ide> setupfile.setup_package() <ide> else: <del> execfile('setup.py') <add> exec(compile(open('setup.py').read(), 'setup.py', 'exec'))
1
Text
Text
add @raisinten to the tsc
46f4d5e2a63977ad9823c3fbf4008212d5126a2e
<ide><path>README.md <ide> For information about the governance of the Node.js project, see <ide> **Mary Marchini** <<oss@mmarchini.me>> (she/her) <ide> * [MylesBorins](https://github.com/MylesBorins) - <ide> **Myles Borins** <<myles.borins@gmail.com>> (he/him) <add>* [RaisinTen](https://github.com/RaisinTen) - <add> **Darshan Sen** <<raisinten@gmail.com>> (he/him) <ide> * [richardlau](https://github.com/richardlau) - <ide> **Richard Lau** <<rlau@redhat.com>> <ide> * [ronag](https://github.com/ronag) -
1
Go
Go
improve performance/reduce allocs of bytespipe
9a25b1d942da88439ec04797ff6f1c33c3b5562d
<ide><path>pkg/ioutils/buffer.go <add>package ioutils <add> <add>import ( <add> "errors" <add> "io" <add>) <add> <add>var errBufferFull = errors.New("buffer is full") <add> <add>type fixedBuffer struct { <add> buf []byte <add> pos int <add> lastRead int <add>} <add> <add>func (b *fixedBuffer) Write(p []byte) (int, error) { <add> n := copy(b.buf[b.pos:cap(b.buf)], p) <add> b.pos += n <add> <add> if n < len(p) { <add> if b.pos == cap(b.buf) { <add> return n, errBufferFull <add> } <add> return n, io.ErrShortWrite <add> } <add> return n, nil <add>} <add> <add>func (b *fixedBuffer) Read(p []byte) (int, error) { <add> n := copy(p, b.buf[b.lastRead:b.pos]) <add> b.lastRead += n <add> return n, nil <add>} <add> <add>func (b *fixedBuffer) Len() int { <add> return b.pos - b.lastRead <add>} <add> <add>func (b *fixedBuffer) Cap() int { <add> return cap(b.buf) <add>} <add> <add>func (b *fixedBuffer) Reset() { <add> b.pos = 0 <add> b.lastRead = 0 <add> b.buf = b.buf[:0] <add>} <add> <add>func (b *fixedBuffer) String() string { <add> return string(b.buf[b.lastRead:b.pos]) <add>} <ide><path>pkg/ioutils/buffer_test.go <add>package ioutils <add> <add>import ( <add> "bytes" <add> "testing" <add>) <add> <add>func TestFixedBufferWrite(t *testing.T) { <add> buf := &fixedBuffer{buf: make([]byte, 0, 64)} <add> n, err := buf.Write([]byte("hello")) <add> if err != nil { <add> t.Fatal(err) <add> } <add> <add> if n != 5 { <add> t.Fatalf("expected 5 bytes written, got %d", n) <add> } <add> <add> if string(buf.buf[:5]) != "hello" { <add> t.Fatalf("expected \"hello\", got %q", string(buf.buf[:5])) <add> } <add> <add> n, err = buf.Write(bytes.Repeat([]byte{1}, 64)) <add> if err != errBufferFull { <add> t.Fatalf("expected errBufferFull, got %v - %v", err, buf.buf[:64]) <add> } <add>} <add> <add>func TestFixedBufferRead(t *testing.T) { <add> buf := &fixedBuffer{buf: make([]byte, 0, 64)} <add> if _, err := buf.Write([]byte("hello world")); err != nil { <add> t.Fatal(err) <add> } <add> <add> b := make([]byte, 5) <add> n, err := buf.Read(b) <add> if err != nil { <add> t.Fatal(err) <add> } <add> <add> if n != 5 { <add> t.Fatalf("expected 5 bytes read, got %d - %s", n, buf.String()) <add> } <add> <add> if string(b) != "hello" { <add> t.Fatalf("expected \"hello\", got %q", string(b)) <add> } <add> <add> n, err = buf.Read(b) <add> if err != nil { <add> t.Fatal(err) <add> } <add> <add> if n != 5 { <add> t.Fatalf("expected 5 bytes read, got %d", n) <add> } <add> <add> if string(b) != " worl" { <add> t.Fatalf("expected \" worl\", got %s", string(b)) <add> } <add> <add> b = b[:1] <add> n, err = buf.Read(b) <add> if err != nil { <add> t.Fatal(err) <add> } <add> <add> if n != 1 { <add> t.Fatalf("expected 1 byte read, got %d - %s", n, buf.String()) <add> } <add> <add> if string(b) != "d" { <add> t.Fatalf("expected \"d\", got %s", string(b)) <add> } <add>} <ide><path>pkg/ioutils/bytespipe.go <ide> import ( <ide> // maxCap is the highest capacity to use in byte slices that buffer data. <ide> const maxCap = 1e6 <ide> <add>// minCap is the lowest capacity to use in byte slices that buffer data <add>const minCap = 64 <add> <ide> // blockThreshold is the minimum number of bytes in the buffer which will cause <ide> // a write to BytesPipe to block when allocating a new slice. <ide> const blockThreshold = 1e6 <ide> <del>// ErrClosed is returned when Write is called on a closed BytesPipe. <del>var ErrClosed = errors.New("write to closed BytesPipe") <add>var ( <add> // ErrClosed is returned when Write is called on a closed BytesPipe. <add> ErrClosed = errors.New("write to closed BytesPipe") <add> <add> bufPools = make(map[int]*sync.Pool) <add>) <ide> <ide> // BytesPipe is io.ReadWriteCloser which works similarly to pipe(queue). <ide> // All written data may be read at most once. Also, BytesPipe allocates <ide> var ErrClosed = errors.New("write to closed BytesPipe") <ide> type BytesPipe struct { <ide> mu sync.Mutex <ide> wait *sync.Cond <del> buf [][]byte // slice of byte-slices of buffered data <del> lastRead int // index in the first slice to a read point <del> bufLen int // length of data buffered over the slices <del> closeErr error // error to return from next Read. set to nil if not closed. <add> buf []*fixedBuffer <add> bufLen int <add> closeErr error // error to return from next Read. set to nil if not closed. <ide> } <ide> <ide> // NewBytesPipe creates new BytesPipe, initialized by specified slice. <ide> // If buf is nil, then it will be initialized with slice which cap is 64. <ide> // buf will be adjusted in a way that len(buf) == 0, cap(buf) == cap(buf). <del>func NewBytesPipe(buf []byte) *BytesPipe { <del> if cap(buf) == 0 { <del> buf = make([]byte, 0, 64) <del> } <del> bp := &BytesPipe{ <del> buf: [][]byte{buf[:0]}, <del> } <add>func NewBytesPipe() *BytesPipe { <add> bp := &BytesPipe{} <add> bp.buf = append(bp.buf, getBuffer(minCap)) <ide> bp.wait = sync.NewCond(&bp.mu) <ide> return bp <ide> } <ide> func NewBytesPipe(buf []byte) *BytesPipe { <ide> // It can allocate new []byte slices in a process of writing. <ide> func (bp *BytesPipe) Write(p []byte) (int, error) { <ide> bp.mu.Lock() <del> defer bp.mu.Unlock() <add> <ide> written := 0 <ide> for { <ide> if bp.closeErr != nil { <add> bp.mu.Unlock() <ide> return written, ErrClosed <ide> } <del> // write data to the last buffer <add> <add> if len(bp.buf) == 0 { <add> bp.buf = append(bp.buf, getBuffer(64)) <add> } <add> // get the last buffer <ide> b := bp.buf[len(bp.buf)-1] <del> // copy data to the current empty allocated area <del> n := copy(b[len(b):cap(b)], p) <del> // increment buffered data length <del> bp.bufLen += n <del> // include written data in last buffer <del> bp.buf[len(bp.buf)-1] = b[:len(b)+n] <ide> <add> n, err := b.Write(p) <ide> written += n <add> bp.bufLen += n <add> <add> // errBufferFull is an error we expect to get if the buffer is full <add> if err != nil && err != errBufferFull { <add> bp.wait.Broadcast() <add> bp.mu.Unlock() <add> return written, err <add> } <ide> <ide> // if there was enough room to write all then break <ide> if len(p) == n { <ide> func (bp *BytesPipe) Write(p []byte) (int, error) { <ide> // more data: write to the next slice <ide> p = p[n:] <ide> <del> // block if too much data is still in the buffer <add> // make sure the buffer doesn't grow too big from this write <ide> for bp.bufLen >= blockThreshold { <ide> bp.wait.Wait() <ide> } <ide> <del> // allocate slice that has twice the size of the last unless maximum reached <del> nextCap := 2 * cap(bp.buf[len(bp.buf)-1]) <add> // add new byte slice to the buffers slice and continue writing <add> nextCap := b.Cap() * 2 <ide> if nextCap > maxCap { <ide> nextCap = maxCap <ide> } <del> // add new byte slice to the buffers slice and continue writing <del> bp.buf = append(bp.buf, make([]byte, 0, nextCap)) <add> bp.buf = append(bp.buf, getBuffer(nextCap)) <ide> } <ide> bp.wait.Broadcast() <add> bp.mu.Unlock() <ide> return written, nil <ide> } <ide> <ide> func (bp *BytesPipe) Close() error { <ide> return bp.CloseWithError(nil) <ide> } <ide> <del>func (bp *BytesPipe) len() int { <del> return bp.bufLen - bp.lastRead <del>} <del> <ide> // Read reads bytes from BytesPipe. <ide> // Data could be read only once. <ide> func (bp *BytesPipe) Read(p []byte) (n int, err error) { <ide> bp.mu.Lock() <del> defer bp.mu.Unlock() <del> if bp.len() == 0 { <add> if bp.bufLen == 0 { <ide> if bp.closeErr != nil { <add> bp.mu.Unlock() <ide> return 0, bp.closeErr <ide> } <ide> bp.wait.Wait() <del> if bp.len() == 0 && bp.closeErr != nil { <add> if bp.bufLen == 0 && bp.closeErr != nil { <add> bp.mu.Unlock() <ide> return 0, bp.closeErr <ide> } <ide> } <del> for { <del> read := copy(p, bp.buf[0][bp.lastRead:]) <add> <add> for bp.bufLen > 0 { <add> b := bp.buf[0] <add> read, _ := b.Read(p) // ignore error since fixedBuffer doesn't really return an error <ide> n += read <del> bp.lastRead += read <del> if bp.len() == 0 { <del> // we have read everything. reset to the beginning. <del> bp.lastRead = 0 <del> bp.bufLen -= len(bp.buf[0]) <del> bp.buf[0] = bp.buf[0][:0] <del> break <add> bp.bufLen -= read <add> <add> if b.Len() == 0 { <add> // it's empty so return it to the pool and move to the next one <add> returnBuffer(b) <add> bp.buf[0] = nil <add> bp.buf = bp.buf[1:] <ide> } <del> // break if everything was read <add> <ide> if len(p) == read { <ide> break <ide> } <del> // more buffered data and more asked. read from next slice. <add> <ide> p = p[read:] <del> bp.lastRead = 0 <del> bp.bufLen -= len(bp.buf[0]) <del> bp.buf[0] = nil // throw away old slice <del> bp.buf = bp.buf[1:] // switch to next <ide> } <add> <ide> bp.wait.Broadcast() <add> bp.mu.Unlock() <ide> return <ide> } <add> <add>func returnBuffer(b *fixedBuffer) { <add> b.Reset() <add> pool := bufPools[b.Cap()] <add> if pool != nil { <add> pool.Put(b) <add> } <add>} <add> <add>func getBuffer(size int) *fixedBuffer { <add> pool, ok := bufPools[size] <add> if !ok { <add> pool = &sync.Pool{New: func() interface{} { return &fixedBuffer{buf: make([]byte, 0, size)} }} <add> bufPools[size] = pool <add> } <add> return pool.Get().(*fixedBuffer) <add>} <ide><path>pkg/ioutils/bytespipe_test.go <ide> import ( <ide> ) <ide> <ide> func TestBytesPipeRead(t *testing.T) { <del> buf := NewBytesPipe(nil) <add> buf := NewBytesPipe() <ide> buf.Write([]byte("12")) <ide> buf.Write([]byte("34")) <ide> buf.Write([]byte("56")) <ide> func TestBytesPipeRead(t *testing.T) { <ide> } <ide> <ide> func TestBytesPipeWrite(t *testing.T) { <del> buf := NewBytesPipe(nil) <add> buf := NewBytesPipe() <ide> buf.Write([]byte("12")) <ide> buf.Write([]byte("34")) <ide> buf.Write([]byte("56")) <ide> buf.Write([]byte("78")) <ide> buf.Write([]byte("90")) <del> if string(buf.buf[0]) != "1234567890" { <del> t.Fatalf("Buffer %s, must be %s", buf.buf, "1234567890") <add> if buf.buf[0].String() != "1234567890" { <add> t.Fatalf("Buffer %q, must be %q", buf.buf[0].String(), "1234567890") <ide> } <ide> } <ide> <ide> func TestBytesPipeWriteRandomChunks(t *testing.T) { <ide> expected := hex.EncodeToString(hash.Sum(nil)) <ide> <ide> // write/read through buffer <del> buf := NewBytesPipe(nil) <add> buf := NewBytesPipe() <ide> hash.Reset() <ide> <ide> done := make(chan struct{}) <ide> func TestBytesPipeWriteRandomChunks(t *testing.T) { <ide> } <ide> <ide> func BenchmarkBytesPipeWrite(b *testing.B) { <add> testData := []byte("pretty short line, because why not?") <ide> for i := 0; i < b.N; i++ { <ide> readBuf := make([]byte, 1024) <del> buf := NewBytesPipe(nil) <add> buf := NewBytesPipe() <ide> go func() { <ide> var err error <ide> for err == nil { <ide> _, err = buf.Read(readBuf) <ide> } <ide> }() <ide> for j := 0; j < 1000; j++ { <del> buf.Write([]byte("pretty short line, because why not?")) <add> buf.Write(testData) <ide> } <ide> buf.Close() <ide> } <ide> func BenchmarkBytesPipeRead(b *testing.B) { <ide> rd := make([]byte, 512) <ide> for i := 0; i < b.N; i++ { <ide> b.StopTimer() <del> buf := NewBytesPipe(nil) <add> buf := NewBytesPipe() <ide> for j := 0; j < 500; j++ { <ide> buf.Write(make([]byte, 1024)) <ide> } <ide><path>runconfig/streams.go <ide> func (streamConfig *StreamConfig) StdinPipe() io.WriteCloser { <ide> // StdoutPipe creates a new io.ReadCloser with an empty bytes pipe. <ide> // It adds this new out pipe to the Stdout broadcaster. <ide> func (streamConfig *StreamConfig) StdoutPipe() io.ReadCloser { <del> bytesPipe := ioutils.NewBytesPipe(nil) <add> bytesPipe := ioutils.NewBytesPipe() <ide> streamConfig.stdout.Add(bytesPipe) <ide> return bytesPipe <ide> } <ide> <ide> // StderrPipe creates a new io.ReadCloser with an empty bytes pipe. <ide> // It adds this new err pipe to the Stderr broadcaster. <ide> func (streamConfig *StreamConfig) StderrPipe() io.ReadCloser { <del> bytesPipe := ioutils.NewBytesPipe(nil) <add> bytesPipe := ioutils.NewBytesPipe() <ide> streamConfig.stderr.Add(bytesPipe) <ide> return bytesPipe <ide> }
5
Javascript
Javascript
use fixture files
e8e4593bc06ac92081a1c68cafb14f5debbf4544
<ide><path>node-tests/blueprints/util-test-test.js <ide> const modifyPackages = blueprintHelpers.modifyPackages; <ide> const chai = require('ember-cli-blueprint-test-helpers/chai'); <ide> const expect = chai.expect; <ide> <add>const fixture = require('../helpers/fixture'); <add> <ide> describe('Blueprint: util-test', function() { <ide> setupTestHooks(this); <ide> <ide> describe('Blueprint: util-test', function() { <ide> it('util-test foo-bar', function() { <ide> return emberGenerateDestroy(['util-test', 'foo-bar'], _file => { <ide> expect(_file('tests/unit/utils/foo-bar-test.js')) <del> .to.contain("import fooBar from 'my-app/utils/foo-bar';"); <add> .to.equal(fixture('util-test/default.js')); <ide> }); <ide> }); <ide> <ide> describe('Blueprint: util-test', function() { <ide> it('util-test foo-bar', function() { <ide> return emberGenerateDestroy(['util-test', 'foo-bar'], _file => { <ide> expect(_file('tests/unit/utils/foo-bar-test.js')) <del> .to.contain("import { describe, it } from 'mocha';") <del> .to.contain("import fooBar from 'my-app/utils/foo-bar';") <del> .to.contain("describe('Unit | Utility | foo bar', function() {"); <add> .to.equal(fixture('util-test/mocha.js')); <ide> }); <ide> }); <ide> }); <ide> describe('Blueprint: util-test', function() { <ide> it('util-test foo-bar', function() { <ide> return emberGenerateDestroy(['util-test', 'foo-bar'], _file => { <ide> expect(_file('tests/unit/utils/foo-bar-test.js')) <del> .to.contain("import fooBar from 'dummy/utils/foo-bar';"); <add> .to.equal(fixture('util-test/dummy.js')); <ide> }); <ide> }); <ide> }); <ide><path>node-tests/fixtures/util-test/default.js <add>import fooBar from 'my-app/utils/foo-bar'; <add>import { module, test } from 'qunit'; <add> <add>module('Unit | Utility | foo bar'); <add> <add>// Replace this with your real tests. <add>test('it works', function(assert) { <add> let result = fooBar(); <add> assert.ok(result); <add>}); <ide><path>node-tests/fixtures/util-test/dummy.js <add>import fooBar from 'dummy/utils/foo-bar'; <add>import { module, test } from 'qunit'; <add> <add>module('Unit | Utility | foo bar'); <add> <add>// Replace this with your real tests. <add>test('it works', function(assert) { <add> let result = fooBar(); <add> assert.ok(result); <add>}); <ide><path>node-tests/fixtures/util-test/mocha.js <add>import { expect } from 'chai'; <add>import { describe, it } from 'mocha'; <add>import fooBar from 'my-app/utils/foo-bar'; <add> <add>describe('Unit | Utility | foo bar', function() { <add> // Replace this with your real tests. <add> it('works', function() { <add> let result = fooBar(); <add> expect(result).to.be.ok; <add> }); <add>});
4
Javascript
Javascript
enable more certs
b8b89ed549e6d453bd40d0eef49477c9de57ab58
<ide><path>config/i18n/all-langs.js <ide> const auditedCerts = { <ide> 'front-end-libraries', <ide> 'data-visualization', <ide> 'apis-and-microservices', <del> 'quality-assurance' <add> 'quality-assurance', <add> 'scientific-computing-with-python', <add> 'data-analysis-with-python', <add> 'information-security' <ide> ], <ide> 'chinese-traditional': [ <ide> 'responsive-web-design', <ide> 'javascript-algorithms-and-data-structures', <ide> 'front-end-libraries', <ide> 'data-visualization', <ide> 'apis-and-microservices', <del> 'quality-assurance' <add> 'quality-assurance', <add> 'scientific-computing-with-python', <add> 'data-analysis-with-python', <add> 'information-security' <ide> ], <ide> italian: [ <ide> 'responsive-web-design',
1
Ruby
Ruby
escape example interpolation
91dfb608054aeb373c47643eebfa60ba0058946f
<ide><path>Library/Homebrew/cmd/create.rb <ide> def install <ide> # were more thorough. Run the test with `brew test #{name}`. <ide> # <ide> # The installed folder is not in the path, so use the entire path to any <del> # executables being tested: `system "#{bin}/program", "--version"`. <add> # executables being tested: `system "\#{bin}/program", "--version"`. <ide> system "false" <ide> end <ide> end
1
PHP
PHP
fix doc block typo in entitytrait
9e9410c0f646d4cc93544f6b56672112ffda30ef
<ide><path>src/Datasource/EntityTrait.php <ide> public function accessible($property, $set = null) { <ide> } <ide> <ide> /** <del> * Returns the alias of the repository from wich this entity came from. <add> * Returns the alias of the repository from which this entity came from. <ide> * <ide> * If called with no arguments, it returns the alias of the repository <ide> * this entity came from if it is known.
1
Python
Python
fix version comparison when version is none
6603acb88bd9ebf3dbcdd0f85f555cfc6f952228
<ide><path>numpy/distutils/fcompiler/nag.py <ide> def get_flags_opt(self): <ide> return ['-O4'] <ide> def get_flags_arch(self): <ide> version = self.get_version() <del> if version < '5.1': <add> if version and version < '5.1': <ide> return ['-target=native'] <ide> else: <ide> return ['']
1
Ruby
Ruby
add missing require to fix the ci
69c52b0e9add98741b6c3dd4db26d14aecc9fdb7
<ide><path>activerecord/test/cases/adapters/postgresql/timestamp_test.rb <ide> require 'cases/helper' <add>require 'models/developer' <ide> <ide> class TimestampTest < ActiveRecord::TestCase <ide> def test_load_infinity_and_beyond
1
Python
Python
fix clone_model to consider input_tensors
304c2d06dc7ab25d7e9bb236e2f514f94bbeb4cb
<ide><path>keras/models.py <ide> def _clone_functional_model(model, input_tensors=None, layer_fn=_clone_layer): <ide> newly_created_input_layer = input_tensor._keras_history.layer <ide> new_input_layers[original_input_layer] = newly_created_input_layer <ide> else: <del> new_input_layers[original_input_layer] = original_input_layer <add> new_input_layers[original_input_layer] = input_tensor._keras_history.layer <ide> <ide> if not callable(layer_fn): <ide> raise ValueError('Expected `layer_fn` argument to be a callable.') <ide><path>keras/models_test.py <ide> def test_clone_sequential_model( <ide> self.assertGreaterEqual(len(new_model.updates), 2) <ide> <ide> # On top of new tensor -- clone model should always have an InputLayer. <del> input_a = keras.Input(shape=(4,)) <add> input_a = keras.Input(shape=(4,), name="a") <ide> new_model = clone_fn(model, input_tensors=input_a) <ide> self.assertIsInstance( <ide> list(new_model._flatten_layers(include_self=False, recursive=False))[0], <ide> keras.layers.InputLayer) <add> # The new models inputs should have the properties of the new input tensor <add> self.assertEqual(new_model.input_names[0], input_a.name) <add> self.assertEqual(new_model.inputs[0].shape, input_a.shape) <ide> self.assertTrue(new_model._is_graph_network) <ide> <ide> # On top of new, non-Keras tensor -- clone model should always have an <ide> def test_clone_functional_model(self, share_weights): <ide> # On top of new tensors <ide> input_a = keras.Input(shape=(4,), name='a') <ide> input_b = keras.Input(shape=(4,), name='b') <add> new_input_tensors = [input_a, input_b] <ide> new_model = keras.models.clone_model( <del> model, input_tensors=[input_a, input_b]) <add> model, input_tensors=new_input_tensors) <ide> if not tf.compat.v1.executing_eagerly_outside_functions(): <ide> self.assertLen(new_model.updates, 2) <ide> new_model.compile( <ide> def test_clone_functional_model(self, share_weights): <ide> run_eagerly=testing_utils.should_run_eagerly()) <ide> new_model.train_on_batch([val_a, val_b], val_out) <ide> <add> # New model should use provided input tensors <add> self.assertListEqual(new_model.inputs, new_input_tensors) <add> <ide> # On top of new, non-Keras tensors <ide> if not tf.executing_eagerly(): <ide> # TODO(b/121277734):Skip Eager contexts, as Input() layers raise an error
2
Ruby
Ruby
move condition to nested `if` statement
f762033a57be271b778be6e39fe7d5b9d068ec64
<ide><path>Library/Homebrew/cmd/search.rb <ide> def search <ide> puts Formatter.columns(all_casks) <ide> end <ide> <del> if $stdout.tty? && !local_casks.include?(query) <add> if $stdout.tty? <ide> count = all_formulae.count + all_casks.count <ide> <del> if reason = MissingFormula.reason(query, silent: true) <add> if reason = MissingFormula.reason(query, silent: true) && !local_casks.include?(query) <ide> if count.positive? <ide> puts <ide> puts "If you meant #{query.inspect} specifically:"
1
Text
Text
move inactive collaborators to emeriti
b6201abacf36cc49500647f25b604d2216c1d006
<ide><path>README.md <ide> For information about the governance of the Node.js project, see <ide> **Ben Noordhuis** &lt;info@bnoordhuis.nl&gt; <ide> * [boneskull](https://github.com/boneskull) - <ide> **Christopher Hiller** &lt;boneskull@boneskull.com&gt; (he/him) <del>* [brendanashworth](https://github.com/brendanashworth) - <del>**Brendan Ashworth** &lt;brendan.ashworth@me.com&gt; <ide> * [BridgeAR](https://github.com/BridgeAR) - <ide> **Ruben Bridgewater** &lt;ruben@bridgewater.de&gt; (he/him) <ide> * [bzoz](https://github.com/bzoz) - <ide> For information about the governance of the Node.js project, see <ide> **Shelley Vohr** &lt;codebytere@gmail.com&gt; (she/her) <ide> * [danbev](https://github.com/danbev) - <ide> **Daniel Bevenius** &lt;daniel.bevenius@gmail.com&gt; (he/him) <del>* [DavidCai1993](https://github.com/DavidCai1993) - <del>**David Cai** &lt;davidcai1993@yahoo.com&gt; (he/him) <ide> * [davisjam](https://github.com/davisjam) - <ide> **Jamie Davis** &lt;davisjam@vt.edu&gt; (he/him) <ide> * [devnexen](https://github.com/devnexen) - <ide> For information about the governance of the Node.js project, see <ide> **Yuta Hiroto** &lt;hello@hiroppy.me&gt; (he/him) <ide> * [iarna](https://github.com/iarna) - <ide> **Rebecca Turner** &lt;me@re-becca.org&gt; <del>* [imyller](https://github.com/imyller) - <del>**Ilkka Myller** &lt;ilkka.myller@nodefield.com&gt; <ide> * [indutny](https://github.com/indutny) - <ide> **Fedor Indutny** &lt;fedor.indutny@gmail.com&gt; <ide> * [italoacasas](https://github.com/italoacasas) - <ide> For information about the governance of the Node.js project, see <ide> **Jackson Tian** &lt;shyvo1987@gmail.com&gt; <ide> * [jasnell](https://github.com/jasnell) - <ide> **James M Snell** &lt;jasnell@gmail.com&gt; (he/him) <del>* [jasongin](https://github.com/jasongin) - <del>**Jason Ginchereau** &lt;jasongin@microsoft.com&gt; <ide> * [jbergstroem](https://github.com/jbergstroem) - <ide> **Johan Bergström** &lt;bugs@bergstroem.nu&gt; <ide> * [jdalton](https://github.com/jdalton) - <ide> For information about the governance of the Node.js project, see <ide> **Richard Lau** &lt;riclau@uk.ibm.com&gt; <ide> * [ronkorving](https://github.com/ronkorving) - <ide> **Ron Korving** &lt;ron@ronkorving.nl&gt; <del>* [RReverser](https://github.com/RReverser) - <del>**Ingvar Stepanyan** &lt;me@rreverser.com&gt; <ide> * [rubys](https://github.com/rubys) - <ide> **Sam Ruby** &lt;rubys@intertwingly.net&gt; <ide> * [rvagg](https://github.com/rvagg) - <ide> For information about the governance of the Node.js project, see <ide> **Andras** &lt;andras@kinvey.com&gt; <ide> * [AnnaMag](https://github.com/AnnaMag) - <ide> **Anna M. Kedzierska** &lt;anna.m.kedzierska@gmail.com&gt; <add>* [brendanashworth](https://github.com/brendanashworth) - <add>**Brendan Ashworth** &lt;brendan.ashworth@me.com&gt; <ide> * [estliberitas](https://github.com/estliberitas) - <ide> **Alexander Makarenko** &lt;estliberitas@gmail.com&gt; <ide> * [chrisdickinson](https://github.com/chrisdickinson) - <ide> **Chris Dickinson** &lt;christopher.s.dickinson@gmail.com&gt; <add>* [DavidCai1993](https://github.com/DavidCai1993) - <add>**David Cai** &lt;davidcai1993@yahoo.com&gt; (he/him) <ide> * [firedfox](https://github.com/firedfox) - <ide> **Daniel Wang** &lt;wangyang0123@gmail.com&gt; <ide> * [imran-iq](https://github.com/imran-iq) - <ide> **Imran Iqbal** &lt;imran@imraniqbal.org&gt; <add>* [imyller](https://github.com/imyller) - <add>**Ilkka Myller** &lt;ilkka.myller@nodefield.com&gt; <ide> * [isaacs](https://github.com/isaacs) - <ide> **Isaac Z. Schlueter** &lt;i@izs.me&gt; <add>* [jasongin](https://github.com/jasongin) - <add>**Jason Ginchereau** &lt;jasongin@microsoft.com&gt; <ide> * [jhamhader](https://github.com/jhamhader) - <ide> **Yuval Brik** &lt;yuval@brik.org.il&gt; <ide> * [joshgav](https://github.com/joshgav) - <ide> For information about the governance of the Node.js project, see <ide> **Robert Kowalski** &lt;rok@kowalski.gd&gt; <ide> * [romankl](https://github.com/romankl) - <ide> **Roman Klauke** &lt;romaaan.git@gmail.com&gt; <add>* [RReverser](https://github.com/RReverser) - <add>**Ingvar Stepanyan** &lt;me@rreverser.com&gt; <ide> * [stefanmb](https://github.com/stefanmb) - <ide> **Stefan Budeanu** &lt;stefan@budeanu.com&gt; <ide> * [tellnes](https://github.com/tellnes) -
1
Ruby
Ruby
remove more `env` access
f16a33b68efc3dc57cfafa27651b9a765e363fbf
<ide><path>actionpack/lib/action_controller/test_case.rb <ide> def initialize(env, session) <ide> end <ide> <ide> def query_string=(string) <del> @env[Rack::QUERY_STRING] = string <add> set_header Rack::QUERY_STRING, string <ide> end <ide> <ide> def request_parameters=(params) <del> @env["action_dispatch.request.request_parameters"] = params <add> set_header "action_dispatch.request.request_parameters", params <add> end <add> <add> def content_type=(type) <add> set_header 'CONTENT_TYPE', type <ide> end <ide> <ide> def assign_parameters(routes, controller_path, action, parameters, generated_path, query_string_keys) <ide> def assign_parameters(routes, controller_path, action, parameters, generated_pat <ide> end <ide> else <ide> if ENCODER.should_multipart?(non_path_parameters) <del> @env['CONTENT_TYPE'] = ENCODER.content_type <add> self.content_type = ENCODER.content_type <ide> data = ENCODER.build_multipart non_path_parameters <ide> else <del> @env['CONTENT_TYPE'] ||= 'application/x-www-form-urlencoded' <add> get_header('CONTENT_TYPE') do |k| <add> set_header k, 'application/x-www-form-urlencoded' <add> end <ide> <ide> # FIXME: setting `request_parametes` is normally handled by the <ide> # params parser middleware, and we should remove this roundtripping <ide> def assign_parameters(routes, controller_path, action, parameters, generated_pat <ide> end <ide> end <ide> <del> @env['CONTENT_LENGTH'] = data.length.to_s <del> @env['rack.input'] = StringIO.new(data) <add> set_header 'CONTENT_LENGTH', data.length.to_s <add> set_header 'rack.input', StringIO.new(data) <ide> end <ide> <ide> @env["PATH_INFO"] ||= generated_path <ide> def process(action, *args) <ide> end <ide> <ide> if body.present? <del> @request.env['RAW_POST_DATA'] = body <add> @request.set_header 'RAW_POST_DATA', body <ide> end <ide> <ide> if http_method.present? <ide> def process(action, *args) <ide> @controller.request = @request <ide> @controller.response = @response <ide> <del> @request.env["SCRIPT_NAME"] ||= @controller.config.relative_url_root <add> @request.get_header("SCRIPT_NAME") do |k| <add> @request.set_header k, @controller.config.relative_url_root <add> end <ide> <ide> @controller.recycle! <ide> @controller.process(action) <ide> <del> @request.env.delete 'HTTP_COOKIE' <add> @request.delete_header 'HTTP_COOKIE' <ide> <ide> if @request.have_cookie_jar? <ide> unless @response.committed? <ide> def process(action, *args) <ide> end <ide> <ide> if xhr <del> @request.env.delete 'HTTP_X_REQUESTED_WITH' <del> @request.env.delete 'HTTP_ACCEPT' <add> @request.delete_header 'HTTP_X_REQUESTED_WITH' <add> @request.delete_header 'HTTP_ACCEPT' <ide> end <ide> @request.query_string = '' <ide>
1
Python
Python
allow specification of terms to fit in hermefit
6411ec505ed7b36c9768accd338a96f5a64eba93
<ide><path>numpy/polynomial/hermite_e.py <ide> def hermefit(x, y, deg, rcond=None, full=False, w=None): <ide> y-coordinates of the sample points. Several data sets of sample <ide> points sharing the same x-coordinates can be fitted at once by <ide> passing in a 2D-array that contains one dataset per column. <del> deg : int <del> Degree of the fitting polynomial <add> deg : int or array_like <add> Degree of the fitting polynomial. If `deg` is a single integer <add> all terms up to and including the `deg`'th term are included. <add> `deg` may alternatively be a list or array specifying which <add> terms in the Legendre expansion to include in the fit. <add> <add> .. versionchanged:: 1.11.0 <add> `deg` may be a list specifying which terms to fit <ide> rcond : float, optional <ide> Relative condition number of the fit. Singular values smaller than <ide> this relative to the largest singular value will be ignored. The <ide> def hermefit(x, y, deg, rcond=None, full=False, w=None): <ide> array([ 1.01690445, 1.99951418, 2.99948696]) <ide> <ide> """ <del> order = int(deg) + 1 <ide> x = np.asarray(x) + 0.0 <ide> y = np.asarray(y) + 0.0 <add> deg = np.asarray([deg,], dtype=int).flatten() <ide> <ide> # check arguments. <del> if deg < 0: <add> if deg.size < 1: <add> raise TypeError("expected deg to be one or more integers") <add> if deg.min() < 0: <ide> raise ValueError("expected deg >= 0") <ide> if x.ndim != 1: <ide> raise TypeError("expected 1D vector for x") <ide> def hermefit(x, y, deg, rcond=None, full=False, w=None): <ide> if len(x) != len(y): <ide> raise TypeError("expected x and y to have same length") <ide> <add> if deg.size == 1: <add> restricted_fit = False <add> lmax = deg[0] <add> order = lmax + 1 <add> else: <add> restricted_fit = True <add> lmax = deg.max() <add> order = deg.size <add> <ide> # set up the least squares matrices in transposed form <del> lhs = hermevander(x, deg).T <add> van = hermevander(x, lmax) <add> if restricted_fit: <add> van = van[:, deg] <add> lhs = van.T <ide> rhs = y.T <ide> if w is not None: <ide> w = np.asarray(w) + 0.0 <ide> def hermefit(x, y, deg, rcond=None, full=False, w=None): <ide> c, resids, rank, s = la.lstsq(lhs.T/scl, rhs.T, rcond) <ide> c = (c.T/scl).T <ide> <add> # Expand c to include non-fitted coefficients which are set to zero <add> if restricted_fit: <add> if c.ndim == 2: <add> cc = np.zeros((lmax+1, c.shape[1]), dtype=c.dtype) <add> else: <add> cc = np.zeros(lmax+1, dtype=c.dtype) <add> cc[deg] = c <add> c = cc <add> <ide> # warn on rank reduction <ide> if rank != order and not full: <ide> msg = "The fit may be poorly conditioned"
1
Ruby
Ruby
fix use of `find` on ruby 1.8
482481d24c7d66cdc2a6fdfb9933cf6fb7b429c9
<ide><path>Library/Homebrew/extend/pathname.rb <ide> def abv <ide> def compute_disk_usage <ide> if self.directory? <ide> @file_count, @disk_usage = [0, 0] <del> self.find.each do |f| <add> self.find do |f| <ide> if !File.directory?(f) and !f.to_s.match(/\.DS_Store/) <ide> @file_count += 1 <ide> @disk_usage += File.size(f)
1
PHP
PHP
correct doc blocks
55cbcd567bd53a49d492e68e0930e741bf91f041
<ide><path>src/Utility/Inflector.php <ide> public static function dasherize($string) <ide> * (Underscores are replaced by spaces and capitalized following words.) <ide> * <ide> * @param string $string String to be made more readable <del> * @param string $replacement <add> * @param string $replacement the character to replace with a space <ide> * @return string Human-readable string <ide> * @link http://book.cakephp.org/3.0/en/core-libraries/inflector.html#creating-human-readable-forms <ide> */ <ide> public static function humanize($string, $replacement = '_') <ide> } <ide> <ide> /** <del> * Returns the given CamelCasedWordGroup as lower cased words, separated by the replacement <del> * character <add> * Takes the input string, and based on the replacement character converts to a normalized string <ide> * <del> * @param string $string <del> * @param string $replacement <del> * @return string normalized stringd <add> * @param string $string String to normalize <add> * @param string $replacement the character to use as a delimiter <add> * @return string normalized string <ide> */ <ide> public static function normalize($string, $replacement = '_') <ide> {
1
Javascript
Javascript
improve inspect for (async|generator)function
f65aa08b528a17e57471ffece5ee0946c1c72d1b
<ide><path>lib/util.js <ide> function formatValue(ctx, value, recurseTimes) { <ide> }); <ide> } <ide> <add> var constructor = getConstructorOf(value); <add> <ide> // Some type of object without properties can be shortcutted. <ide> if (keys.length === 0) { <ide> if (typeof value === 'function') { <del> return ctx.stylize(`[Function${value.name ? `: ${value.name}` : ''}]`, <del> 'special'); <add> const ctorName = constructor ? constructor.name : 'Function'; <add> return ctx.stylize( <add> `[${ctorName}${value.name ? `: ${value.name}` : ''}]`, 'special'); <ide> } <ide> if (isRegExp(value)) { <ide> return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); <ide> function formatValue(ctx, value, recurseTimes) { <ide> // Can't do the same for DataView because it has a non-primitive <ide> // .buffer property that we need to recurse for. <ide> if (binding.isArrayBuffer(value) || binding.isSharedArrayBuffer(value)) { <del> return `${getConstructorOf(value).name}` + <add> return `${constructor.name}` + <ide> ` { byteLength: ${formatNumber(ctx, value.byteLength)} }`; <ide> } <ide> } <ide> <del> var constructor = getConstructorOf(value); <ide> var base = '', empty = false, braces; <ide> var formatter = formatObject; <ide> <ide> function formatValue(ctx, value, recurseTimes) { <ide> <ide> // Make functions say that they are functions <ide> if (typeof value === 'function') { <del> base = ` [Function${value.name ? `: ${value.name}` : ''}]`; <add> const ctorName = constructor ? constructor.name : 'Function'; <add> base = ` [${ctorName}${value.name ? `: ${value.name}` : ''}]`; <ide> } <ide> <ide> // Make RegExps say that they are RegExps <ide><path>test/parallel/test-util-inspect.js <ide> assert.strictEqual(util.inspect(false), 'false'); <ide> assert.strictEqual(util.inspect(''), "''"); <ide> assert.strictEqual(util.inspect('hello'), "'hello'"); <ide> assert.strictEqual(util.inspect(function() {}), '[Function]'); <add>assert.strictEqual(util.inspect(async function() {}), '[AsyncFunction]'); <add>assert.strictEqual(util.inspect(function*() {}), '[GeneratorFunction]'); <ide> assert.strictEqual(util.inspect(undefined), 'undefined'); <ide> assert.strictEqual(util.inspect(null), 'null'); <ide> assert.strictEqual(util.inspect(/foo(bar\n)?/gi), '/foo(bar\\n)?/gi'); <ide> assert.strictEqual(util.inspect([1, [2, 3]]), '[ 1, [ 2, 3 ] ]'); <ide> assert.strictEqual(util.inspect({}), '{}'); <ide> assert.strictEqual(util.inspect({a: 1}), '{ a: 1 }'); <ide> assert.strictEqual(util.inspect({a: function() {}}), '{ a: [Function: a] }'); <add>assert.strictEqual(util.inspect({a: async function() {}}), <add> '{ a: [AsyncFunction: a] }'); <add>assert.strictEqual(util.inspect({a: function*() {}}), <add> '{ a: [GeneratorFunction: a] }'); <ide> assert.strictEqual(util.inspect({a: 1, b: 2}), '{ a: 1, b: 2 }'); <ide> assert.strictEqual(util.inspect({'a': {}}), '{ a: {} }'); <ide> assert.strictEqual(util.inspect({'a': {'b': 2}}), '{ a: { b: 2 } }');
2
Javascript
Javascript
fix crash with js-based sticky headers
94a333a2ead7ea632fe52f0439397c4f3ed11f2a
<ide><path>Libraries/Components/ScrollView/ScrollView.js <ide> const ScrollView = React.createClass({ <ide> ]; <ide> if (previousHeaderIndex != null) { <ide> const previousHeader = this._stickyHeaderRefs.get(previousHeaderIndex); <del> previousHeader && previousHeader.setNextHeaderY( <del> event.nativeEvent.layout.y - event.nativeEvent.layout.height, <del> ); <add> previousHeader && previousHeader.setNextHeaderY(event.nativeEvent.layout.y); <ide> } <ide> }, <ide> <ide><path>Libraries/Components/ScrollView/ScrollViewStickyHeader.js <ide> class ScrollViewStickyHeader extends React.Component { <ide> state = { <ide> measured: false, <ide> layoutY: 0, <add> layoutHeight: 0, <ide> nextHeaderLayoutY: (null: ?number), <ide> }; <ide> <ide> class ScrollViewStickyHeader extends React.Component { <ide> this.setState({ <ide> measured: true, <ide> layoutY: event.nativeEvent.layout.y, <add> layoutHeight: event.nativeEvent.layout.height, <ide> }); <ide> <ide> this.props.onLayout(event); <ide> }; <ide> <ide> render() { <del> const {measured, layoutY, nextHeaderLayoutY} = this.state; <add> const {measured, layoutHeight, layoutY, nextHeaderLayoutY} = this.state; <ide> <ide> let translateY; <ide> if (measured) { <ide> // The interpolation looks like: <ide> // - Negative scroll: no translation <ide> // - From 0 to the y of the header: no translation. This will cause the header <ide> // to scroll normally until it reaches the top of the scroll view. <del> // - From the header y to the next header y: translate equally to scroll. <del> // This will cause the header to stay at the top of the scroll view. <del> // - Past the the next header y: no more translation. This will cause the header <del> // to continue scrolling up and make room for the next sticky header. <add> // - From header y to when the next header y hits the bottom edge of the header: translate <add> // equally to scroll. This will cause the header to stay at the top of the scroll view. <add> // - Past the collision with the next header y: no more translation. This will cause the <add> // header to continue scrolling up and make room for the next sticky header. <ide> // In the case that there is no next header just translate equally to <ide> // scroll indefinetly. <ide> const inputRange = [-1, 0, layoutY]; <ide> const outputRange: Array<number> = [0, 0, 0]; <ide> if (nextHeaderLayoutY != null) { <del> inputRange.push(nextHeaderLayoutY, nextHeaderLayoutY + 1); <del> outputRange.push(nextHeaderLayoutY - layoutY, nextHeaderLayoutY - layoutY); <add> const collisionPoint = nextHeaderLayoutY - layoutHeight; <add> inputRange.push(collisionPoint, collisionPoint + 1); <add> outputRange.push(collisionPoint - layoutY, collisionPoint - layoutY); <ide> } else { <ide> inputRange.push(layoutY + 1); <ide> outputRange.push(1);
2
Python
Python
use self.sdtout and commanderror to print output
34c38e0cfe5e880e678704c4d473f082787fca64
<ide><path>rest_framework/authtoken/management/commands/drf_create_token.py <ide> from django.contrib.auth import get_user_model <del>from django.core.management.base import BaseCommand <add>from django.core.management.base import BaseCommand, CommandError <ide> from rest_framework.authtoken.models import Token <ide> <ide> <ide> def handle(self, *args, **options): <ide> try: <ide> token = self.create_user_token(username) <ide> except UserModel.DoesNotExist: <del> print('Cannot create the Token: user {0} does not exist'.format( <del> username <del> )) <del> print('Generated token {0} for user {1}'.format(token.key, username)) <add> raise CommandError( <add> 'Cannot create the Token: user {0} does not exist'.format( <add> username) <add> ) <add> self.stdout.write( <add> 'Generated token {0} for user {1}'.format(token.key, username))
1
Javascript
Javascript
improve path parsing on windows
8153a216137728bdb3942d70f4aa52d4644b2ad2
<ide><path>lib/path.js <ide> function normalizeArray(parts, allowAboveRoot) { <ide> <ide> <ide> if (isWindows) { <del> <del> // Regex to split a filename into [*, dir, basename, ext] <del> // windows version <del> var splitPathRe = /^(.+(?:[\\\/](?!$)|:)|[\\\/])?((?:.+?)?(\.[^.]*)?)$/; <del> <ide> // Regex to split a windows path into three parts: [*, device, slash, <ide> // tail] windows-only <ide> var splitDeviceRe = <del> /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?([\\\/])?(.*?)$/; <add> /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?([\\\/])?([\s\S]*?)$/; <add> <add> // Regex to split the tail part of the above into [*, dir, basename, ext] <add> var splitTailRe = /^([\s\S]+[\\\/](?!$)|[\\\/])?((?:[\s\S]+?)?(\.[^.]*)?)$/; <add> <add> // Function to split a filename into [root, dir, basename, ext] <add> // windows version <add> var splitPath = function(filename) { <add> // Separate device+slash from tail <add> var result = splitDeviceRe.exec(filename), <add> device = (result[1] || '') + (result[2] || ''), <add> tail = result[3] || ''; <add> // Split the tail into dir, basename and extension <add> var result2 = splitTailRe.exec(tail), <add> dir = result2[1] || '', <add> basename = result2[2] || '', <add> ext = result2[3] || ''; <add> return [device, dir, basename, ext]; <add> } <ide> <ide> // path.resolve([from ...], to) <ide> // windows version <ide> if (isWindows) { <ide> <ide> } else /* posix */ { <ide> <del> // Regex to split a filename into [*, dir, basename, ext] <del> // posix version <del> var splitPathRe = /^([\s\S]+\/(?!$)|\/)?((?:[\s\S]+?)?(\.[^.]*)?)$/; <add> // Split a filename into [root, dir, basename, ext], unix version <add> // 'root' is just a slash, or nothing. <add> var splitPathRe = /^(\/?)([\s\S]+\/(?!$)|\/)?((?:[\s\S]+?)?(\.[^.]*)?)$/; <add> var splitPath = function(filename) { <add> var result = splitPathRe.exec(filename); <add> return [result[1] || '', result[2] || '', result[3] || '', result[4] || '']; <add> }; <ide> <ide> // path.resolve([from ...], to) <ide> // posix version <ide> if (isWindows) { <ide> <ide> <ide> exports.dirname = function(path) { <del> var dir = splitPathRe.exec(path)[1] || ''; <del> if (!dir) { <del> // No dirname <add> var result = splitPath(path), <add> root = result[0], <add> dir = result[1]; <add> <add> if (!root && !dir) { <add> // No dirname whatsoever <ide> return '.'; <del> } else if (dir.length === 1 || <del> (isWindows && dir.length <= 3 && dir.charAt(1) === ':')) { <del> // It is just a slash or a drive letter with a slash <del> return dir; <del> } else { <del> // It is a full dirname, strip trailing slash <del> return dir.substring(0, dir.length - 1); <ide> } <add> <add> if (dir) { <add> // It has a dirname, strip trailing slash <add> dir = dir.substring(0, dir.length - 1); <add> } <add> <add> return root + dir; <ide> }; <ide> <ide> <ide> exports.basename = function(path, ext) { <del> var f = splitPathRe.exec(path)[2] || ''; <add> var f = splitPath(path)[2]; <ide> // TODO: make this comparison case-insensitive on windows? <ide> if (ext && f.substr(-1 * ext.length) === ext) { <ide> f = f.substr(0, f.length - ext.length); <ide> exports.basename = function(path, ext) { <ide> <ide> <ide> exports.extname = function(path) { <del> return splitPathRe.exec(path)[3] || ''; <add> return splitPath(path)[3]; <ide> }; <ide> <ide> <ide><path>test/simple/test-path.js <ide> if (!isWindows) { <ide> } <ide> <ide> assert.equal(path.extname(f), '.js'); <add> <ide> assert.equal(path.dirname(f).substr(-11), isWindows ? 'test\\simple' : 'test/simple'); <ide> assert.equal(path.dirname('/a/b/'), '/a'); <ide> assert.equal(path.dirname('/a/b'), '/a'); <ide> assert.equal(path.dirname('/a'), '/'); <ide> assert.equal(path.dirname('/'), '/'); <add> <add>if (isWindows) { <add> assert.equal(path.dirname('c:\\'), 'c:\\'); <add> assert.equal(path.dirname('c:\\foo'), 'c:\\'); <add> assert.equal(path.dirname('c:\\foo\\'), 'c:\\'); <add> assert.equal(path.dirname('c:\\foo\\bar'), 'c:\\foo'); <add> assert.equal(path.dirname('c:\\foo\\bar\\'), 'c:\\foo'); <add> assert.equal(path.dirname('c:\\foo\\bar\\baz'), 'c:\\foo\\bar'); <add> assert.equal(path.dirname('\\'), '\\'); <add> assert.equal(path.dirname('\\foo'), '\\'); <add> assert.equal(path.dirname('\\foo\\'), '\\'); <add> assert.equal(path.dirname('\\foo\\bar'), '\\foo'); <add> assert.equal(path.dirname('\\foo\\bar\\'), '\\foo'); <add> assert.equal(path.dirname('\\foo\\bar\\baz'), '\\foo\\bar'); <add> assert.equal(path.dirname('c:'), 'c:'); <add> assert.equal(path.dirname('c:foo'), 'c:'); <add> assert.equal(path.dirname('c:foo\\'), 'c:'); <add> assert.equal(path.dirname('c:foo\\bar'), 'c:foo'); <add> assert.equal(path.dirname('c:foo\\bar\\'), 'c:foo'); <add> assert.equal(path.dirname('c:foo\\bar\\baz'), 'c:foo\\bar'); <add> assert.equal(path.dirname('\\\\unc\\share'), '\\\\unc\\share'); <add> assert.equal(path.dirname('\\\\unc\\share\\foo'), '\\\\unc\\share\\'); <add> assert.equal(path.dirname('\\\\unc\\share\\foo\\'), '\\\\unc\\share\\'); <add> assert.equal(path.dirname('\\\\unc\\share\\foo\\bar'), <add> '\\\\unc\\share\\foo'); <add> assert.equal(path.dirname('\\\\unc\\share\\foo\\bar\\'), <add> '\\\\unc\\share\\foo'); <add> assert.equal(path.dirname('\\\\unc\\share\\foo\\bar\\baz'), <add> '\\\\unc\\share\\foo\\bar'); <add>} <add> <ide> path.exists(f, function(y) { assert.equal(y, true) }); <ide> <ide> assert.equal(path.existsSync(f), true);
2
Text
Text
fix typo in release notes
9edd5dfe5d65b99289b7a6d0d74deab89749a512
<ide><path>docs/community/release-notes.md <ide> You can determine your currently installed version using `pip show`: <ide> <ide> --- <ide> <del>## 3.11.x series <add>## 3.12.x series <ide> <ide> ### 3.12.1 <ide>
1
Javascript
Javascript
improve code in test-http-host-headers
f4fd073f0fc19da226de38eb595007bfee4c17d0
<ide><path>test/parallel/test-http-host-headers.js <ide> 'use strict'; <del>require('../common'); <add>const common = require('../common'); <ide> const http = require('http'); <ide> const assert = require('assert'); <ide> const httpServer = http.createServer(reqHandler); <ide> <ide> function reqHandler(req, res) { <del> console.log('Got request: ' + req.headers.host + ' ' + req.url); <ide> if (req.url === '/setHostFalse5') { <ide> assert.strictEqual(req.headers.host, undefined); <ide> } else { <ide> function reqHandler(req, res) { <ide> req.headers.host); <ide> } <ide> res.writeHead(200, {}); <del> //process.nextTick(function() { res.end('ok'); }); <ide> res.end('ok'); <ide> } <ide> <del>function thrower(er) { <del> throw er; <del>} <del> <ide> testHttp(); <ide> <ide> function testHttp() { <ide> function testHttp() { <ide> <ide> function cb(res) { <ide> counter--; <del> console.log('back from http request. counter = ' + counter); <ide> if (counter === 0) { <ide> httpServer.close(); <ide> } <ide> res.resume(); <ide> } <ide> <del> httpServer.listen(0, function(er) { <del> console.error(`test http server listening on ${this.address().port}`); <add> httpServer.listen(0, (er) => { <ide> assert.ifError(er); <ide> http.get({ <ide> method: 'GET', <ide> path: '/' + (counter++), <ide> host: 'localhost', <del> //agent: false, <del> port: this.address().port, <add> port: httpServer.address().port, <ide> rejectUnauthorized: false <del> }, cb).on('error', thrower); <add> }, cb).on('error', common.fail); <ide> <ide> http.request({ <ide> method: 'GET', <ide> path: '/' + (counter++), <ide> host: 'localhost', <del> //agent: false, <del> port: this.address().port, <add> port: httpServer.address().port, <ide> rejectUnauthorized: false <del> }, cb).on('error', thrower).end(); <add> }, cb).on('error', common.fail).end(); <ide> <ide> http.request({ <ide> method: 'POST', <ide> path: '/' + (counter++), <ide> host: 'localhost', <del> //agent: false, <del> port: this.address().port, <add> port: httpServer.address().port, <ide> rejectUnauthorized: false <del> }, cb).on('error', thrower).end(); <add> }, cb).on('error', common.fail).end(); <ide> <ide> http.request({ <ide> method: 'PUT', <ide> path: '/' + (counter++), <ide> host: 'localhost', <del> //agent: false, <del> port: this.address().port, <add> port: httpServer.address().port, <ide> rejectUnauthorized: false <del> }, cb).on('error', thrower).end(); <add> }, cb).on('error', common.fail).end(); <ide> <ide> http.request({ <ide> method: 'DELETE', <ide> path: '/' + (counter++), <ide> host: 'localhost', <del> //agent: false, <del> port: this.address().port, <add> port: httpServer.address().port, <ide> rejectUnauthorized: false <del> }, cb).on('error', thrower).end(); <add> }, cb).on('error', common.fail).end(); <ide> }); <ide> }
1
Python
Python
fix a typo
a0006d6410a586a45830586a0ef0e5bf17c84fee
<ide><path>libcloud/compute/providers.py <ide> Provider.RACKSPACE_NOVA_DFW: <ide> ('libcloud.compute.drivers.rackspacenova', 'RackspaceNovaDfwNodeDriver'), <ide> Provider.LIBVIRT: <del> ('libcloud.compute.drivers.libvirt_driver', 'LinodeNodeDriver') <add> ('libcloud.compute.drivers.libvirt_driver', 'LibvirtNodeDriver') <ide> } <ide> <ide>
1
Ruby
Ruby
add tests for path based url_for calls
ea58684b579beb8fbf87dde5dbf8694c453d10f9
<ide><path>actionview/test/activerecord/polymorphic_routes_test.rb <ide> def test_string_with_options <ide> <ide> def test_symbol <ide> with_test_routes do <del> assert_equal "http://example.com/projects", polymorphic_url(:projects) <del> assert_equal "http://example.com/projects", url_for(:projects) <add> assert_url "http://example.com/projects", :projects <ide> end <ide> end <ide> <ide> def test_new_record_arguments <ide> params = args <ide> super(*args) <ide> } <add> <add> define_method("projects_path") { |*args| <add> params = args <add> super(*args) <add> } <ide> } <ide> <ide> assert_url "http://example.com/projects", @project <ide> def with_admin_and_site_test_routes(options = {}) <ide> end <ide> end <ide> end <add> <add>class PolymorphicPathRoutesTest < PolymorphicRoutesTest <add> include ActionView::RoutingUrlFor <add> include ActionView::Context <add> <add> attr_accessor :controller <add> <add> def assert_url(url, args) <add> host = self.class.default_url_options[:host] <add> <add> assert_equal url.sub(/http:\/\/#{host}/, ''), url_for(args) <add> end <add>end
1
Ruby
Ruby
add missing requires
c59ab795eee288d0a8d6842d2115d14f58f7badd
<ide><path>activemodel/lib/active_model/attribute.rb <ide> # frozen_string_literal: true <ide> <add>require "active_support/core_ext/object/duplicable" <add> <ide> module ActiveModel <ide> class Attribute # :nodoc: <ide> class << self <ide><path>activemodel/test/cases/attribute_set_test.rb <ide> # frozen_string_literal: true <ide> <ide> require "cases/helper" <add>require "active_model/attribute_set" <add>require "active_model/type" <ide> <ide> module ActiveModel <ide> class AttributeSetTest < ActiveModel::TestCase
2
PHP
PHP
fix function call
92b3ac07c1b206f5ff0ddafcc20fa152dc3e8a5c
<ide><path>src/Illuminate/Foundation/Console/AppNameCommand.php <ide> protected function setPhpSpecNamespace() <ide> protected function setDatabaseFactoryNamespaces() <ide> { <ide> $this->replaceIn( <del> $this->laravel['database_path'].'/factories', $this->currentRoot, $this->argument('name') <add> $this->laravel->databasePath().'/factories', $this->currentRoot, $this->argument('name') <ide> ); <ide> } <ide>
1
Python
Python
add a docstring for getarrlen
48a9a519cc7a4d52ff85577efee0048350d07254
<ide><path>numpy/f2py/crackfortran.py <ide> def getlincoef(e, xset): # e = a*x+b ; x in xset <ide> <ide> <ide> def getarrlen(dl, args, star='*'): <add> """ <add> Parameters <add> ---------- <add> dl : sequence of two str objects <add> dimensions of the array <add> args : Iterable[str] <add> symbols used in the expression <add> star : Any <add> unused <add> <add> Returns <add> ------- <add> expr : str <add> Some numeric expression as a string <add> arg : Optional[str] <add> If understood, the argument from `args` present in `expr` <add> expr2 : Optional[str] <add> If understood, an expression fragment that should be used as <add> ``"(%s%s".format(something, expr2)``. <add> <add> Examples <add> -------- <add> >>> getarrlen(['10*x + 20', '40*x'], {'x'}) <add> ('30 * x - 19', 'x', '+19)/(30)') <add> >>> getarrlen(['1', '10*x + 20'], {'x'}) <add> ('10 * x + 20', 'x', '-20)/(10)') <add> >>> getarrlen(['10*x + 20', '1'], {'x'}) <add> ('-10 * x - 18', 'x', '+18)/(-10)') <add> >>> getarrlen(['20', '1'], {'x'}) <add> ('-18', None, None) <add> """ <ide> edl = [] <ide> try: <ide> edl.append(myeval(dl[0], {}, {}))
1
Ruby
Ruby
allow symbols for reason
4d0a1ff775baa02f66d61ce949d6fe32d776f2be
<ide><path>Library/Homebrew/formula.rb <ide> def link_overwrite?(path) <ide> # The reason this {Formula} is deprecated. <ide> # Returns `nil` if no reason is specified or the formula is not deprecated. <ide> # @method deprecation_reason <del> # @return [String] <add> # @return [String, Symbol] <ide> delegate deprecation_reason: :"self.class" <ide> <ide> # Whether this {Formula} is disabled (i.e. cannot be installed). <ide> def link_overwrite?(path) <ide> # The reason this {Formula} is disabled. <ide> # Returns `nil` if no reason is specified or the formula is not disabled. <ide> # @method disable_reason <del> # @return [String] <add> # @return [String, Symbol] <ide> delegate disable_reason: :"self.class" <ide> <ide> def skip_cxxstdlib_check? <ide> def pour_bottle?(&block) <ide> # Deprecates a {Formula} (on a given date, if provided) so a warning is <ide> # shown on each installation. If the date has not yet passed the formula <ide> # will not be deprecated. <del> # <pre>deprecate! date: "2020-08-27", because: "it is no longer maintained"</pre> <add> # <pre>deprecate! date: "2020-08-27", because: :unmaintained</pre> <add> # <pre>deprecate! date: "2020-08-27", because: "it has been replaced by"</pre> <ide> def deprecate!(date: nil, because: nil) <ide> # TODO: enable for next major/minor release <ide> # odeprecated "`deprecate!` without a reason", "`deprecate! because: \"reason\"`" if because.blank? <ide> def deprecated? <ide> <ide> # The reason for deprecation of a {Formula}. <ide> # Returns `nil` if no reason was provided or the formula is not deprecated. <del> # @return [String] <add> # @return [String, Symbol] <ide> attr_reader :deprecation_reason <ide> <ide> # Disables a {Formula} (on a given date, if provided) so it cannot be <ide> # installed. If the date has not yet passed the formula <ide> # will be deprecated instead of disabled. <del> # <pre>disable! date: "2020-08-27", because: "it no longer builds"</pre> <add> # <pre>disable! date: "2020-08-27", because: :does_not_build</pre> <add> # <pre>disable! date: "2020-08-27", because: "has been replaced by foo"</pre> <ide> def disable!(date: nil, because: nil) <ide> # TODO: enable for next major/minor release <ide> # odeprecated "`disable!` without a reason", "`disable! because: \"reason\"`" if because.blank? <ide> def disabled? <ide> <ide> # The reason for a {Formula} is disabled. <ide> # Returns `nil` if no reason was provided or the formula is not disabled. <del> # @return [String] <add> # @return [String, Symbol] <ide> attr_reader :disable_reason <ide> <ide> # @private <ide><path>Library/Homebrew/formula_installer.rb <ide> def verify_deps_exist <ide> def check_install_sanity <ide> raise FormulaInstallationAlreadyAttemptedError, formula if self.class.attempted.include?(formula) <ide> <add> deprecate_disable_reasons = { <add> does_not_build: "does not build", <add> no_license: "has no license", <add> repo_archived: "has an archived upstream repository", <add> repo_removed: "has a removed upstream repository", <add> unmaintained: "is not maintained upstream", <add> unsupported: "is not supported upstream", <add> deprecated_upstream: "is deprecated upstream", <add> versioned_formula: "is a versioned formula", <add> } <add> <ide> if formula.deprecated? <ide> if formula.deprecation_reason.present? <del> opoo "#{formula.full_name} has been deprecated because #{formula.deprecation_reason}!" <add> reason = if deprecate_disable_reasons.key? formula.deprecation_reason <add> deprecate_disable_reasons[formula.deprecation_reason] <add> else <add> deprecate_disable_reasons <add> end <add> <add> opoo "#{formula.full_name} has been deprecated because it #{reason}!" <ide> else <ide> opoo "#{formula.full_name} has been deprecated!" <ide> end <ide> elsif formula.disabled? <ide> if formula.disable_reason.present? <del> odie "#{formula.full_name} has been disabled because #{formula.disable_reason}!" <add> reason = if deprecate_disable_reasons.key? formula.disable_reason <add> deprecate_disable_reasons[formula.disable_reason] <add> else <add> deprecate_disable_reasons <add> end <add> <add> odie "#{formula.full_name} has been disabled because it #{reason}!" <ide> else <ide> odie "#{formula.full_name} has been disabled!" <ide> end <ide><path>Library/Homebrew/rubocops/deprecate_disable.rb <ide> def audit_formula(_node, _class_node, _parent_class_node, body_node) <ide> reason_found = false <ide> reason(node) do |reason_node| <ide> reason_found = true <add> next if reason_node.sym_type? <add> <ide> offending_node(reason_node) <ide> reason_string = string_content(reason_node) <ide> <ide> def autocorrect(node) <ide> end <ide> <ide> def_node_search :reason, <<~EOS <del> (pair (sym :because) $str) <add> (pair (sym :because) ${str sym}) <ide> EOS <ide> end <ide> end <ide><path>Library/Homebrew/test/rubocops/deprecate_disable_spec.rb <ide> class Foo < Formula <ide> RUBY <ide> end <ide> <add> it "deprecation reason is acceptable as a symbol" do <add> expect_no_offenses(<<~RUBY) <add> class Foo < Formula <add> url 'https://brew.sh/foo-1.0.tgz' <add> deprecate! because: :does_not_build <add> end <add> RUBY <add> end <add> <ide> it "deprecation reason is acceptable with date" do <ide> expect_no_offenses(<<~RUBY) <ide> class Foo < Formula <ide> class Foo < Formula <ide> RUBY <ide> end <ide> <add> it "deprecation reason is acceptable as a symbol with date" do <add> expect_no_offenses(<<~RUBY) <add> class Foo < Formula <add> url 'https://brew.sh/foo-1.0.tgz' <add> deprecate! date: "2020-08-28", because: :does_not_build <add> end <add> RUBY <add> end <add> <ide> it "deprecation reason is absent" do <ide> expect_offense(<<~RUBY) <ide> class Foo < Formula <ide> class Foo < Formula <ide> RUBY <ide> end <ide> <add> it "disable reason is acceptable as a symbol" do <add> expect_no_offenses(<<~RUBY) <add> class Foo < Formula <add> url 'https://brew.sh/foo-1.0.tgz' <add> disable! because: :does_not_build <add> end <add> RUBY <add> end <add> <ide> it "disable reason is acceptable with date" do <ide> expect_no_offenses(<<~RUBY) <ide> class Foo < Formula <ide> class Foo < Formula <ide> RUBY <ide> end <ide> <add> it "disable reason is acceptable as a symbol with date" do <add> expect_no_offenses(<<~RUBY) <add> class Foo < Formula <add> url 'https://brew.sh/foo-1.0.tgz' <add> disable! date: "2020-08-28", because: :does_not_build <add> end <add> RUBY <add> end <add> <ide> it "disable reason is absent" do <ide> expect_offense(<<~RUBY) <ide> class Foo < Formula
4
Ruby
Ruby
fix punctuation errors
6372d23616b13c62c7a12efa89f958b334dd66ae
<ide><path>activesupport/lib/active_support/core_ext/date_time/conversions.rb <ide> def formatted_offset(colon = true, alternate_utc_string = nil) <ide> utc? && alternate_utc_string || ActiveSupport::TimeZone.seconds_to_utc_offset(utc_offset, colon) <ide> end <ide> <del> # Overrides the default inspect method with a human readable one, e.g., "Mon, 21 Feb 2005 14:30:00 +0000" <add> # Overrides the default inspect method with a human readable one, e.g., "Mon, 21 Feb 2005 14:30:00 +0000". <ide> def readable_inspect <ide> to_s(:rfc822) <ide> end <ide> alias_method :default_inspect, :inspect <ide> alias_method :inspect, :readable_inspect <ide> <del> # Converts self to a Ruby Date object; time portion is discarded <add> # Converts self to a Ruby Date object; time portion is discarded. <ide> def to_date <ide> ::Date.new(year, month, day) <ide> end unless instance_methods(false).include?(:to_date) <ide> <del> # Attempts to convert self to a Ruby Time object; returns self if out of range of Ruby Time class <del> # If self has an offset other than 0, self will just be returned unaltered, since there's no clean way to map it to a Time <add> # Attempts to convert self to a Ruby Time object; returns self if out of range of Ruby Time class. <add> # If self has an offset other than 0, self will just be returned unaltered, since there's no clean way to map it to a Time. <ide> def to_time <ide> self.offset == 0 ? ::Time.utc_time(year, month, day, hour, min, sec, sec_fraction * (RUBY_VERSION < '1.9' ? 86400000000 : 1000000)) : self <ide> end <ide> <del> # To be able to keep Times, Dates and DateTimes interchangeable on conversions <add> # To be able to keep Times, Dates and DateTimes interchangeable on conversions. <ide> def to_datetime <ide> self <ide> end unless instance_methods(false).include?(:to_datetime) <ide> def self.civil_from_format(utc_or_local, year, month=1, day=1, hour=0, min=0, se <ide> civil(year, month, day, hour, min, sec, offset) <ide> end <ide> <del> # Converts datetime to an appropriate format for use in XML <add> # Converts datetime to an appropriate format for use in XML. <ide> def xmlschema <ide> strftime("%Y-%m-%dT%H:%M:%S%Z") <ide> end unless instance_methods(false).include?(:xmlschema) <ide> <del> # Converts self to a floating-point number of seconds since the Unix epoch <add> # Converts self to a floating-point number of seconds since the Unix epoch. <ide> def to_f <ide> seconds_since_unix_epoch.to_f <ide> end <ide> <del> # Converts self to an integer number of seconds since the Unix epoch <add> # Converts self to an integer number of seconds since the Unix epoch. <ide> def to_i <ide> seconds_since_unix_epoch.to_i <ide> end
1
Text
Text
remove resnet folder from github
aa031d9198b3795cffadddc75fc5782d041dafe2
<ide><path>official/resnet/README.md <del># ResNet in TensorFlow <del> <del>* For the Keras version of the ResNet model, see <del> [`official/vision/image_classification`](../vision/image_classification). <del>* For the Keras custom training loop version, also see <del> [`official/vision/image_classification`](../vision/image_classification). <del>* For the Estimator version, see [`official/r1/resnet`](../r1/resnet).
1
Python
Python
add key to the folders
262a3c72d40408727d220ce0b943ca9f03f06f9a
<ide><path>glances/plugins/glances_folders.py <ide> def __init__(self, args=None): <ide> <ide> # Init stats <ide> self.glances_folders = None <add> self.reset() <add> <add> def get_key(self): <add> """Return the key of the list.""" <add> return 'path' <add> <add> def reset(self): <add> """Reset/init the stats.""" <ide> self.stats = [] <ide> <ide> def load_limits(self, config): <ide> def load_limits(self, config): <ide> <ide> def update(self): <ide> """Update the foldered list.""" <add> # Reset the list <add> self.reset() <add> <ide> if self.input_method == 'local': <ide> # Folder list only available in a full Glances environment <ide> # Check if the glances_folder instance is init
1
Javascript
Javascript
expose tech but warn without safety var
8622b2648e6ad75b9d968e2f2027c6baab27d03f
<ide><path>src/js/player.js <ide> import Component from './component.js'; <ide> <ide> import document from 'global/document'; <ide> import window from 'global/window'; <add>import tsml from 'tsml'; <ide> import * as Events from './utils/events.js'; <ide> import * as Dom from './utils/dom.js'; <ide> import * as Fn from './utils/fn.js'; <ide> class Player extends Component { <ide> } <ide> <ide> /** <del> * Return a reference to the current {@link Tech}, but only if given an object with the <del> * `IWillNotUseThisInPlugins` property having a true value. This is try and prevent misuse <del> * of techs by plugins. <add> * Return a reference to the current {@link Tech}. <add> * It will print a warning by default about the danger of using the tech directly <add> * but any argument that is passed in will silence the warning. <ide> * <del> * @param {Object} safety <del> * An object that must contain `{IWillNotUseThisInPlugins: true}` <del> * <del> * @param {boolean} safety.IWillNotUseThisInPlugins <del> * Must be set to true or else this function will throw an error. <add> * @param {*} [safety] <add> * Anything passed in to silence the warning <ide> * <ide> * @return {Tech} <ide> * The Tech <ide> */ <ide> tech(safety) { <del> if (safety && safety.IWillNotUseThisInPlugins) { <del> return this.tech_; <del> } <del> const errorText = ` <del> Please make sure that you are not using this inside of a plugin. <del> To disable this alert and error, please pass in an object with <del> \`IWillNotUseThisInPlugins\` to the \`tech\` method. See <del> https://github.com/videojs/video.js/issues/2617 for more info. <del> `; <del> <del> window.alert(errorText); <del> throw new Error(errorText); <add> if (safety === undefined) { <add> log.warn(tsml` <add> Using the tech directly can be dangerous. I hope you know what you're doing. <add> See https://github.com/videojs/video.js/issues/2617 for more info. <add> `); <add> } <add> <add> return this.tech_; <ide> } <ide> <ide> /** <ide><path>test/unit/player.test.js <ide> QUnit.test('you can clear error in the error event', function(assert) { <ide> }); <ide> <ide> QUnit.test('Player#tech will return tech given the appropriate input', function(assert) { <add> const oldLogWarn = log.warn; <add> let warning; <add> <add> log.warn = function(_warning) { <add> warning = _warning; <add> }; <add> <ide> const tech_ = {}; <del> const returnedTech = Player.prototype.tech.call({tech_}, {IWillNotUseThisInPlugins: true}); <add> const returnedTech = Player.prototype.tech.call({tech_}, true); <ide> <ide> assert.equal(returnedTech, tech_, 'We got back the tech we wanted'); <add> assert.notOk(warning, 'no warning was logged'); <add> <add> log.warn = oldLogWarn; <ide> }); <ide> <del>QUnit.test('Player#tech alerts and throws without the appropriate input', function(assert) { <del> let alertCalled; <del> const oldAlert = window.alert; <add>QUnit.test('Player#tech logs a warning when called without a safety argument', function(assert) { <add> const oldLogWarn = log.warn; <add> const warningRegex = new RegExp('https://github.com/videojs/video.js/issues/2617'); <add> let warning; <ide> <del> window.alert = () => { <del> alertCalled = true; <add> log.warn = function(_warning) { <add> warning = _warning; <ide> }; <ide> <ide> const tech_ = {}; <ide> <del> assert.throws(function() { <del> Player.prototype.tech.call({tech_}); <del> }, new RegExp('https://github.com/videojs/video.js/issues/2617'), <del> 'we threw an error'); <add> Player.prototype.tech.call({tech_}); <add> <add> assert.ok(warningRegex.test(warning), 'we logged a warning'); <ide> <del> assert.ok(alertCalled, 'we called an alert'); <del> window.alert = oldAlert; <add> log.warn = oldLogWarn; <ide> }); <ide> <ide> QUnit.test('player#reset loads the Html5 tech and then techCalls reset', function(assert) {
2
Javascript
Javascript
add key modifiers to press events
91a044e31fc79e4ea6db97f97de4a9e3a5da8a43
<ide><path>packages/react-events/src/Press.js <ide> type PressEvent = {| <ide> pageY: null | number, <ide> screenX: null | number, <ide> screenY: null | number, <add> x: null | number, <add> y: null | number, <add> altKey: boolean, <add> ctrlKey: boolean, <add> metaKey: boolean, <add> shiftKey: boolean, <ide> |}; <ide> <ide> const DEFAULT_PRESS_END_DELAY_MS = 0; <ide> function createPressEvent( <ide> let pageY = null; <ide> let screenX = null; <ide> let screenY = null; <add> let altKey = false; <add> let ctrlKey = false; <add> let metaKey = false; <add> let shiftKey = false; <ide> <ide> if (event) { <ide> const nativeEvent = (event.nativeEvent: any); <add> ({altKey, ctrlKey, metaKey, shiftKey} = nativeEvent); <ide> // Only check for one property, checking for all of them is costly. We can assume <ide> // if clientX exists, so do the rest. <ide> let eventObject; <ide> function createPressEvent( <ide> pageY, <ide> screenX, <ide> screenY, <add> x: clientX, <add> y: clientY, <add> altKey, <add> ctrlKey, <add> metaKey, <add> shiftKey, <ide> }; <ide> } <ide> <ide> const PressResponder = { <ide> <ide> case 'click': { <ide> if (isAnchorTagElement(target)) { <del> const {ctrlKey, metaKey, shiftKey} = (nativeEvent: MouseEvent); <add> const { <add> altKey, <add> ctrlKey, <add> metaKey, <add> shiftKey, <add> } = (nativeEvent: MouseEvent); <ide> // Check "open in new window/tab" and "open context menu" key modifiers <ide> const preventDefault = props.preventDefault; <del> if (preventDefault !== false && !shiftKey && !metaKey && !ctrlKey) { <add> if ( <add> preventDefault !== false && <add> !shiftKey && <add> !metaKey && <add> !ctrlKey && <add> !altKey <add> ) { <ide> nativeEvent.preventDefault(); <ide> } <ide> } <ide><path>packages/react-events/src/__tests__/Press-test.internal.js <ide> describe('Event responder: Press', () => { <ide> expect(onPressEnd).not.toBeCalled(); <ide> }); <ide> <add> it('is called with keyboard modifiers', () => { <add> ref.current.dispatchEvent(createKeyboardEvent('keydown', {key: 'Enter'})); <add> ref.current.dispatchEvent( <add> createKeyboardEvent('keyup', { <add> key: 'Enter', <add> metaKey: true, <add> ctrlKey: true, <add> altKey: true, <add> shiftKey: true, <add> }), <add> ); <add> expect(onPressEnd).toHaveBeenCalledWith( <add> expect.objectContaining({ <add> pointerType: 'keyboard', <add> type: 'pressend', <add> metaKey: true, <add> ctrlKey: true, <add> altKey: true, <add> shiftKey: true, <add> }), <add> ); <add> }); <add> <ide> // No PointerEvent fallbacks <ide> it('is called after "mouseup" event', () => { <ide> ref.current.dispatchEvent(createEvent('mousedown'));
2
Javascript
Javascript
fix short name for august in id locale
6adc6eedd68b99ff28c790d875fc1b6bfb19c71e
<ide><path>src/locale/id.js <ide> import moment from '../moment'; <ide> <ide> export default moment.defineLocale('id', { <ide> months : 'Januari_Februari_Maret_April_Mei_Juni_Juli_Agustus_September_Oktober_November_Desember'.split('_'), <del> monthsShort : 'Jan_Feb_Mar_Apr_Mei_Jun_Jul_Ags_Sep_Okt_Nov_Des'.split('_'), <add> monthsShort : 'Jan_Feb_Mar_Apr_Mei_Jun_Jul_Agt_Sep_Okt_Nov_Des'.split('_'), <ide> weekdays : 'Minggu_Senin_Selasa_Rabu_Kamis_Jumat_Sabtu'.split('_'), <ide> weekdaysShort : 'Min_Sen_Sel_Rab_Kam_Jum_Sab'.split('_'), <ide> weekdaysMin : 'Mg_Sn_Sl_Rb_Km_Jm_Sb'.split('_'), <ide> export default moment.defineLocale('id', { <ide> doy : 7 // The week that contains Jan 1st is the first week of the year. <ide> } <ide> }); <del> <ide><path>src/test/locale/id.js <ide> import moment from '../../moment'; <ide> localeModule('id'); <ide> <ide> test('parse', function (assert) { <del> var tests = 'Januari Jan_Februari Feb_Maret Mar_April Apr_Mei Mei_Juni Jun_Juli Jul_Agustus Ags_September Sep_Oktober Okt_November Nov_Desember Des'.split('_'), i; <add> var tests = 'Januari Jan_Februari Feb_Maret Mar_April Apr_Mei Mei_Juni Jun_Juli Jul_Agustus Agt_September Sep_Oktober Okt_November Nov_Desember Des'.split('_'), i; <ide> function equalTest(input, mmm, i) { <ide> assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); <ide> } <ide> test('format', function (assert) { <ide> }); <ide> <ide> test('format month', function (assert) { <del> var expected = 'Januari Jan_Februari Feb_Maret Mar_April Apr_Mei Mei_Juni Jun_Juli Jul_Agustus Ags_September Sep_Oktober Okt_November Nov_Desember Des'.split('_'), i; <add> var expected = 'Januari Jan_Februari Feb_Maret Mar_April Apr_Mei Mei_Juni Jun_Juli Jul_Agustus Agt_September Sep_Oktober Okt_November Nov_Desember Des'.split('_'), i; <ide> for (i = 0; i < expected.length; i++) { <ide> assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); <ide> } <ide> test('weeks year starting sunday formatted', function (assert) { <ide> assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2', 'Jan 8 2012 should be week 2'); <ide> assert.equal(moment([2012, 0, 9]).format('w ww wo'), '3 03 3', 'Jan 9 2012 should be week 3'); <ide> }); <del> <del>
2
Python
Python
add tests for t and mt in array_api
18fe695dbc66df660039aca9f76a949de8b9348e
<ide><path>numpy/array_api/tests/test_array_object.py <ide> import numpy as np <ide> <ide> from .. import ones, asarray, result_type, all, equal <add>from .._array_object import Array <ide> from .._dtypes import ( <ide> _all_dtypes, <ide> _boolean_dtypes, <ide> def test_device_property(): <ide> <ide> assert all(equal(asarray(a, device='cpu'), a)) <ide> assert_raises(ValueError, lambda: asarray(a, device='gpu')) <add> <add>def test_array_properties(): <add> a = ones((1, 2, 3)) <add> b = ones((2, 3)) <add> assert_raises(ValueError, lambda: a.T) <add> <add> assert isinstance(b.T, Array) <add> assert b.T.shape == (3, 2) <add> <add> assert isinstance(a.mT, Array) <add> assert a.mT.shape == (1, 3, 2) <add> assert isinstance(b.mT, Array) <add> assert b.mT.shape == (3, 2)
1
Java
Java
change javadoc explanation for mutable list
ac3b5b195b8abf6086c21c7601ff5d054e0041d4
<ide><path>src/main/java/io/reactivex/Flowable.java <ide> public final <K> Flowable<T> distinct(Function<? super T, K> keySelector, <ide> * {@code CharSequence}s or {@code List}s where the objects will actually have the same <ide> * references when they are modified and {@code distinctUntilChanged} will evaluate subsequent items as same. <ide> * To avoid such situation, it is recommended that mutable data is converted to an immutable one, <del> * for example using `map(CharSequence::toString)` or `map(Collections::unmodifiableList)`. <add> * for example using `map(CharSequence::toString)` or `map(list -> Collections.unmodifiableList(new ArrayList<>(list)))`. <ide> * <dl> <ide> * <dt><b>Backpressure:</b></dt> <ide> * <dd>The operator doesn't interfere with backpressure which is determined by the source {@code Publisher}'s <ide> public final Flowable<T> distinctUntilChanged() { <ide> * {@code CharSequence}s or {@code List}s where the objects will actually have the same <ide> * references when they are modified and {@code distinctUntilChanged} will evaluate subsequent items as same. <ide> * To avoid such situation, it is recommended that mutable data is converted to an immutable one, <del> * for example using `map(CharSequence::toString)` or `map(Collections::unmodifiableList)`. <add> * for example using `map(CharSequence::toString)` or `map(list -> Collections.unmodifiableList(new ArrayList<>(list)))`. <ide> * <dl> <ide> * <dt><b>Backpressure:</b></dt> <ide> * <dd>The operator doesn't interfere with backpressure which is determined by the source {@code Publisher}'s <ide> public final <K> Flowable<T> distinctUntilChanged(Function<? super T, K> keySele <ide> * {@code CharSequence}s or {@code List}s where the objects will actually have the same <ide> * references when they are modified and {@code distinctUntilChanged} will evaluate subsequent items as same. <ide> * To avoid such situation, it is recommended that mutable data is converted to an immutable one, <del> * for example using `map(CharSequence::toString)` or `map(Collections::unmodifiableList)`. <add> * for example using `map(CharSequence::toString)` or `map(list -> Collections.unmodifiableList(new ArrayList<>(list)))`. <ide> * <dl> <ide> * <dt><b>Backpressure:</b></dt> <ide> * <dd>The operator doesn't interfere with backpressure which is determined by the source {@code Publisher}'s <ide><path>src/main/java/io/reactivex/Observable.java <ide> public final <K> Observable<T> distinct(Function<? super T, K> keySelector, Call <ide> * {@code CharSequence}s or {@code List}s where the objects will actually have the same <ide> * references when they are modified and {@code distinctUntilChanged} will evaluate subsequent items as same. <ide> * To avoid such situation, it is recommended that mutable data is converted to an immutable one, <del> * for example using `map(CharSequence::toString)` or `map(Collections::unmodifiableList)`. <add> * for example using `map(CharSequence::toString)` or `map(list -> Collections.unmodifiableList(new ArrayList<>(list)))`. <ide> * <dl> <ide> * <dt><b>Scheduler:</b></dt> <ide> * <dd>{@code distinctUntilChanged} does not operate by default on a particular {@link Scheduler}.</dd> <ide> public final Observable<T> distinctUntilChanged() { <ide> * {@code CharSequence}s or {@code List}s where the objects will actually have the same <ide> * references when they are modified and {@code distinctUntilChanged} will evaluate subsequent items as same. <ide> * To avoid such situation, it is recommended that mutable data is converted to an immutable one, <del> * for example using `map(CharSequence::toString)` or `map(Collections::unmodifiableList)`. <add> * for example using `map(CharSequence::toString)` or `map(list -> Collections.unmodifiableList(new ArrayList<>(list)))`. <ide> * <dl> <ide> * <dt><b>Scheduler:</b></dt> <ide> * <dd>{@code distinctUntilChanged} does not operate by default on a particular {@link Scheduler}.</dd> <ide> public final <K> Observable<T> distinctUntilChanged(Function<? super T, K> keySe <ide> * {@code CharSequence}s or {@code List}s where the objects will actually have the same <ide> * references when they are modified and {@code distinctUntilChanged} will evaluate subsequent items as same. <ide> * To avoid such situation, it is recommended that mutable data is converted to an immutable one, <del> * for example using `map(CharSequence::toString)` or `map(Collections::unmodifiableList)`. <add> * for example using `map(CharSequence::toString)` or `map(list -> Collections.unmodifiableList(new ArrayList<>(list)))`. <ide> * <dl> <ide> * <dt><b>Scheduler:</b></dt> <ide> * <dd>{@code distinctUntilChanged} does not operate by default on a particular {@link Scheduler}.</dd>
2
PHP
PHP
add test to check passing $columns in paginate
c158a2e80ed22740e7600e7cc2bd794d14ba886c
<ide><path>tests/Database/DatabaseEloquentBuilderTest.php <ide> public function testListsWithoutModelGetterJustReturnTheAttributesFoundInDatabas <ide> $this->assertEquals(['bar', 'baz'], $builder->lists('name')->all()); <ide> } <ide> <add> public function testPaginatePassesColumnsToGetCountForPaginationMethod() <add> { <add> $totalItems = 100; <add> $itemsPerPage = 50; <add> $page = 1; <add> $database = 'SQLite'; <add> $table = 'table'; <add> $columns = [$table . '.column']; <add> <add> $model = new EloquentBuilderTestNestedStub; <add> <add> $this->mockConnectionForModel($model, $database); <add> <add> $query = m::mock('Illuminate\Database\Query\Builder'); <add> $query->shouldReceive('from')->once()->with($table); <add> $query->shouldReceive('forPage')->once()->with($page, $itemsPerPage)->andReturn($query); <add> $query->shouldReceive('get')->once()->andReturn($columns); <add> <add> /** <add> * Add check that paginate method passes $columns param to getCountForPagination method <add> */ <add> $query->shouldReceive('getCountForPagination')->once()->with($columns)->andReturn($totalItems); <add> <add> $builder = new Builder($query); <add> <add> $builder->setModel($model); <add> <add> $builder->paginate($itemsPerPage, $columns); <add> } <add> <ide> public function testMacrosAreCalledOnBuilder() <ide> { <ide> unset($_SERVER['__test.builder']);
1
Python
Python
add unittest for wasbtaskhandler
0ee437547b6c412217ce646d9a831c244ebc4d94
<ide><path>tests/providers/microsoft/azure/log/__init__.py <add># Licensed to the Apache Software Foundation (ASF) under one <add># or more contributor license agreements. See the NOTICE file <add># distributed with this work for additional information <add># regarding copyright ownership. The ASF licenses this file <add># to you under the Apache License, Version 2.0 (the <add># "License"); you may not use this file except in compliance <add># with the License. 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, <add># software distributed under the License is distributed on an <add># "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY <add># KIND, either express or implied. See the License for the <add># specific language governing permissions and limitations <add># under the License. <ide><path>tests/providers/microsoft/azure/log/test_wasb_task_handler.py <add># Licensed to the Apache Software Foundation (ASF) under one <add># or more contributor license agreements. See the NOTICE file <add># distributed with this work for additional information <add># regarding copyright ownership. The ASF licenses this file <add># to you under the Apache License, Version 2.0 (the <add># "License"); you may not use this file except in compliance <add># with the License. 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, <add># software distributed under the License is distributed on an <add># "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY <add># KIND, either express or implied. See the License for the <add># specific language governing permissions and limitations <add># under the License. <add> <add>import unittest <add>from datetime import datetime <add>from unittest import mock <add> <add>from azure.common import AzureHttpError <add> <add>from airflow.models import DAG, TaskInstance <add>from airflow.operators.dummy_operator import DummyOperator <add>from airflow.providers.microsoft.azure.hooks.wasb import WasbHook <add>from airflow.providers.microsoft.azure.log.wasb_task_handler import WasbTaskHandler <add>from airflow.utils.state import State <add>from tests.test_utils.config import conf_vars <add> <add> <add>class TestWasbTaskHandler(unittest.TestCase): <add> <add> def setUp(self): <add> super().setUp() <add> self.wasb_log_folder = 'wasb://container/remote/log/location' <add> self.remote_log_location = 'remote/log/location/1.log' <add> self.local_log_location = 'local/log/location' <add> self.container_name = "wasb-container" <add> self.filename_template = '{try_number}.log' <add> self.wasb_task_handler = WasbTaskHandler( <add> base_log_folder=self.local_log_location, <add> wasb_log_folder=self.wasb_log_folder, <add> wasb_container=self.container_name, <add> filename_template=self.filename_template, <add> delete_local_copy=True <add> ) <add> <add> date = datetime(2020, 8, 10) <add> self.dag = DAG('dag_for_testing_file_task_handler', start_date=date) <add> task = DummyOperator(task_id='task_for_testing_file_log_handler', dag=self.dag) <add> self.ti = TaskInstance(task=task, execution_date=date) <add> self.ti.try_number = 1 <add> self.ti.state = State.RUNNING <add> self.addCleanup(self.dag.clear) <add> <add> @conf_vars({('logging', 'remote_log_conn_id'): 'wasb_default'}) <add> @mock.patch("airflow.providers.microsoft.azure.hooks.wasb.BlockBlobService") <add> def test_hook(self, mock_service): <add> self.assertIsInstance(self.wasb_task_handler.hook, WasbHook) <add> <add> @conf_vars({('logging', 'remote_log_conn_id'): 'wasb_default'}) <add> def test_hook_raises(self): <add> handler = WasbTaskHandler( <add> self.local_log_location, <add> self.wasb_log_folder, <add> self.container_name, <add> self.filename_template, <add> True <add> ) <add> with mock.patch.object(handler.log, 'error') as mock_error: <add> with mock.patch("airflow.providers.microsoft.azure.hooks.wasb.WasbHook") as mock_hook: <add> mock_hook.side_effect = AzureHttpError("failed to connect", 404) <add> # Initialize the hook <add> handler.hook <add> <add> mock_error.assert_called_once_with( <add> 'Could not create an WasbHook with connection id "%s". ' <add> 'Please make sure that airflow[azure] is installed and ' <add> 'the Wasb connection exists.', "wasb_default" <add> ) <add> <add> def test_set_context_raw(self): <add> self.ti.raw = True <add> self.wasb_task_handler.set_context(self.ti) <add> self.assertFalse(self.wasb_task_handler.upload_on_close) <add> <add> def test_set_context_not_raw(self): <add> self.wasb_task_handler.set_context(self.ti) <add> self.assertTrue(self.wasb_task_handler.upload_on_close) <add> <add> @mock.patch("airflow.providers.microsoft.azure.hooks.wasb.WasbHook") <add> def test_wasb_log_exists(self, mock_hook): <add> instance = mock_hook.return_value <add> instance.check_for_blob.return_value = True <add> self.wasb_task_handler.wasb_log_exists(self.remote_log_location) <add> mock_hook.return_value.check_for_blob.assert_called_once_with( <add> self.container_name, <add> self.remote_log_location <add> ) <add> <add> @mock.patch("airflow.providers.microsoft.azure.hooks.wasb.WasbHook") <add> def test_wasb_read(self, mock_hook): <add> mock_hook.return_value.read_file.return_value = 'Log line' <add> self.assertEqual( <add> self.wasb_task_handler.wasb_read(self.remote_log_location), <add> "Log line" <add> ) <add> self.assertEqual( <add> self.wasb_task_handler.read(self.ti), <add> (['*** Reading remote log from wasb://container/remote/log/location/1.log.\n' <add> 'Log line\n'], [{'end_of_log': True}]) <add> ) <add> <add> def test_wasb_read_raises(self): <add> handler = WasbTaskHandler( <add> self.local_log_location, <add> self.wasb_log_folder, <add> self.container_name, <add> self.filename_template, <add> True <add> ) <add> with mock.patch.object(handler.log, 'error') as mock_error: <add> with mock.patch("airflow.providers.microsoft.azure.hooks.wasb.WasbHook") as mock_hook: <add> mock_hook.return_value.read_file.side_effect = AzureHttpError("failed to connect", 404) <add> <add> handler.wasb_read(self.remote_log_location, return_error=True) <add> <add> mock_error.assert_called_once_with( <add> 'Could not read logs from remote/log/location/1.log', exc_info=True <add> ) <add> <add> @mock.patch("airflow.providers.microsoft.azure.hooks.wasb.WasbHook") <add> @mock.patch.object(WasbTaskHandler, "wasb_read") <add> @mock.patch.object(WasbTaskHandler, "wasb_log_exists") <add> def test_write_log(self, mock_log_exists, mock_wasb_read, mock_hook): <add> mock_log_exists.return_value = True <add> mock_wasb_read.return_value = "" <add> self.wasb_task_handler.wasb_write('text', self.remote_log_location) <add> mock_hook.return_value.load_string.assert_called_once_with( <add> "text", <add> self.container_name, <add> self.remote_log_location <add> ) <add> <add> @mock.patch("airflow.providers.microsoft.azure.hooks.wasb.WasbHook") <add> @mock.patch.object(WasbTaskHandler, "wasb_read") <add> @mock.patch.object(WasbTaskHandler, "wasb_log_exists") <add> def test_write_on_existing_log(self, mock_log_exists, mock_wasb_read, mock_hook): <add> mock_log_exists.return_value = True <add> mock_wasb_read.return_value = "old log" <add> self.wasb_task_handler.wasb_write('text', self.remote_log_location) <add> mock_hook.return_value.load_string.assert_called_once_with( <add> "old log\ntext", <add> self.container_name, <add> self.remote_log_location <add> ) <add> <add> @mock.patch("airflow.providers.microsoft.azure.hooks.wasb.WasbHook") <add> def test_write_when_append_is_false(self, mock_hook): <add> self.wasb_task_handler.wasb_write('text', self.remote_log_location, False) <add> mock_hook.return_value.load_string.assert_called_once_with( <add> "text", <add> self.container_name, <add> self.remote_log_location <add> ) <add> <add> def test_write_raises(self): <add> handler = WasbTaskHandler( <add> self.local_log_location, <add> self.wasb_log_folder, <add> self.container_name, <add> self.filename_template, <add> True <add> ) <add> with mock.patch.object(handler.log, 'error') as mock_error: <add> with mock.patch("airflow.providers.microsoft.azure.hooks.wasb.WasbHook") as mock_hook: <add> mock_hook.return_value.load_string.side_effect = AzureHttpError("failed to connect", 404) <add> <add> handler.wasb_write('text', self.remote_log_location, append=False) <add> <add> mock_error.assert_called_once_with( <add> 'Could not write logs to %s', 'remote/log/location/1.log', exc_info=True <add> ) <ide><path>tests/test_project_structure.py <ide> <ide> MISSING_TEST_FILES = { <ide> 'tests/providers/google/cloud/log/test_gcs_task_handler.py', <del> 'tests/providers/microsoft/azure/sensors/test_azure_cosmos.py', <del> 'tests/providers/microsoft/azure/log/test_wasb_task_handler.py', <add> 'tests/providers/microsoft/azure/sensors/test_azure_cosmos.py' <ide> } <ide> <ide>
3
Ruby
Ruby
remove mentions of nonexistent command `brew diy`
b886b2d1f71813700b1b84aa8a29a89a5c472808
<ide><path>Library/Homebrew/cmd/link.rb <ide> def link <ide> formula = begin <ide> keg.to_formula <ide> rescue FormulaUnavailableError <del> # Not all kegs may belong to formulae e.g. with `brew diy` <add> # Not all kegs may belong to formulae <ide> nil <ide> end <ide> <ide><path>Library/Homebrew/diagnostic.rb <ide> def check_deleted_formula <ide> <ide> <<~EOS <ide> Some installed kegs have no formulae! <del> This means they were either deleted or installed with `brew diy`. <add> This means they were either deleted or installed manually. <ide> You should find replacements for the following formulae: <ide> #{deleted_formulae.join("\n ")} <ide> EOS
2
Ruby
Ruby
fix false negatives in `audit_gcc_dependency`
1d7856c4f11f92f0e2c26fbf99f4ef26a56c80ee
<ide><path>Library/Homebrew/formula_auditor.rb <ide> def linux_only_gcc_dep?(formula) <ide> # This variation either: <ide> # 1. does not exist <ide> # 2. has no variation-specific dependencies <del> # In either case, it matches Linux. <del> return false if variation_dependencies.blank? <add> # In either case, it matches Linux. We must check for `nil` because an empty <add> # array indicates that this variation does not depend on GCC. <add> return false if variation_dependencies.nil? <ide> # We found a non-Linux variation that depends on GCC. <ide> return false if variation_dependencies.include?("gcc") <ide> end
1
Javascript
Javascript
add common.mustcall in test-http-abort-client.js
578b31e14b6f80e173c6b90b0a9e60b9a14dfca6
<ide><path>test/parallel/test-http-abort-client.js <ide> const common = require('../common'); <ide> const http = require('http'); <ide> <ide> let serverRes; <del>const server = http.Server((req, res) => { <add>const server = http.Server(common.mustCall((req, res) => { <ide> serverRes = res; <ide> res.writeHead(200); <ide> res.write('Part of my res.'); <del>}); <add>})); <ide> <ide> server.listen(0, common.mustCall(() => { <ide> http.get({
1
Javascript
Javascript
improve stability of oom test
7752eedcc7db586fb0a7c586908d4405c6408325
<ide><path>test/parallel/test-windows-failed-heap-allocation.js <ide> const tmpdir = require('../common/tmpdir'); <ide> tmpdir.refresh(); <ide> <ide> // --max-old-space-size=3 is the min 'old space' in V8, explodes fast <del>const cmd = `"${process.execPath}" --max-old-space-size=3 "${__filename}"`; <del>exec(`${cmd} heapBomb`, { cwd: tmpdir.path }, common.mustCall((err) => { <add>const cmd = `"${process.execPath}" --max-old-space-size=30 "${__filename}"`; <add>exec(`${cmd} heapBomb`, { cwd: tmpdir.path }, common.mustCall((err, stdout, stderr) => { <ide> const msg = `Wrong exit code of ${err.code}! Expected 134 for abort`; <ide> // Note: common.nodeProcessAborted() is not asserted here because it <ide> // returns true on 134 as well as 0x80000003 (V8's base::OS::Abort)
1
Ruby
Ruby
use map + flatten here
933adce8f45b41a5a6b6bb31ba9d6fb5188f4a35
<ide><path>activemodel/lib/active_model/validations.rb <ide> def validators <ide> <ide> # List all validators that being used to validate a specific attribute. <ide> def validators_on(*attributes) <del> attributes.inject([]) do |all, attribute| <del> all |= _validators[attribute.to_sym] || [] <del> end <add> attributes.map do |attribute| <add> _validators[attribute.to_sym] <add> end.flatten <ide> end <ide> <ide> # Check if method is an attribute method or not.
1
Text
Text
remove backticks around proejct names
b2d9c3f9ca3fb03ec93629c63de03d28457408a5
<ide><path>guides/source/active_storage_overview.md <ide> the box, Active Storage supports previewing videos and PDF documents. <ide> </ul> <ide> ``` <ide> <del>WARNING: Extracting previews requires third-party applications, `FFmpeg` for <del>video and `muPDF` for PDFs, and on macOS also `XQuartz` and `Poppler`. <add>WARNING: Extracting previews requires third-party applications, FFmpeg for <add>video and muPDF for PDFs, and on macOS also XQuartz and Poppler. <ide> These libraries are not provided by Rails. You must install them yourself to <ide> use the built-in previewers. Before you install and use third-party software, <ide> make sure you understand the licensing implications of doing so. <ide><path>guides/source/development_dependencies_install.md <ide> yarn install <ide> ``` <ide> <ide> Extracting previews, tested in ActiveStorage's test suite requires third-party <del>applications, `FFmpeg` for video and `muPDF` for PDFs, and on macOS also <del>`XQuartz` and `Poppler`.. Without these applications installed, ActiveStorage <del>tests will raise errors. <add>applications, FFmpeg for video and muPDF for PDFs, and on macOS also XQuartz <add>and Poppler. Without these applications installed, ActiveStorage tests will <add>raise errors. <ide> <ide> On macOS you can run: <ide>
2
PHP
PHP
add controller option
2b0f45b6abdaced7c96f80b68b6ae4ea81587c7c
<ide><path>src/Console/Command/Task/ViewTask.php <ide> class ViewTask extends BakeTask { <ide> */ <ide> public $controllerClass = null; <ide> <add>/** <add> * Name of the table views are being baked against. <add> * <add> * @var string <add> */ <add> public $tableName = null; <add> <ide> /** <ide> * The template file to use <ide> * <ide> public function execute() { <ide> return $this->all(); <ide> } <ide> <del> $this->controller($this->args[0]); <add> $controller = null; <add> if (!empty($this->params['controller'])) { <add> $controller = $this->params['controller']; <add> } <add> $this->controller($this->args[0], $controller); <ide> <ide> if (isset($this->args[1])) { <ide> $this->template = $this->args[1]; <ide> public function execute() { <ide> /** <ide> * Set the controller related properties. <ide> * <del> * @param string $name The controller name. <add> * @param string $table The table/model that is being baked. <add> * @param string $controller The controller name if specified. <ide> * @return void <ide> */ <del> public function controller($name) { <del> $name = $this->_controllerName($name); <del> $this->controllerName = $name; <add> public function controller($table, $controller = null) { <add> $this->tableName = $this->_controllerName($table); <add> if (empty($controller)) { <add> $controller = $this->tableName; <add> } <add> $this->controllerName = $controller; <ide> <ide> $plugin = $prefix = null; <ide> if (!empty($this->params['plugin'])) { <ide> public function controller($name) { <ide> if (!empty($this->params['prefix'])) { <ide> $prefix = $this->params['prefix'] . '/'; <ide> } <del> $this->controllerClass = App::className($plugin . $prefix . $name, 'Controller', 'Controller'); <add> $this->controllerClass = App::className($plugin . $prefix . $controller, 'Controller', 'Controller'); <ide> } <ide> <ide> /** <ide> public function all() { <ide> * @return array Returns an variables to be made available to a view template <ide> */ <ide> protected function _loadController() { <del> if (!$this->controllerName) { <del> $this->err(__d('cake_console', 'Controller not found')); <del> } <del> <ide> $plugin = null; <ide> if ($this->plugin) { <ide> $plugin = $this->plugin . '.'; <ide> } <ide> <del> if (class_exists($this->controllerClass)) { <del> $controllerObj = new $this->controllerClass(); <del> $controllerObj->plugin = $this->plugin; <del> $controllerObj->constructClasses(); <del> $modelClass = $controllerObj->modelClass; <del> $modelObj = $controllerObj->{$modelClass}; <del> } else { <del> $modelObj = TableRegistry::get($this->controllerName); <del> } <add> $modelObj = TableRegistry::get($this->tableName); <ide> <del> $primaryKey = []; <del> $displayField = null; <ide> $singularVar = Inflector::variable(Inflector::singularize($this->controllerName)); <ide> $singularHumanName = $this->_singularHumanName($this->controllerName); <del> $fields = $schema = $keyFields = $associations = []; <del> <del> if ($modelObj) { <del> $primaryKey = (array)$modelObj->primaryKey(); <del> $displayField = $modelObj->displayField(); <del> $singularVar = $this->_singularName($this->controllerName); <del> $singularHumanName = $this->_singularHumanName($this->controllerName); <del> $schema = $modelObj->schema(); <del> $fields = $schema->columns(); <del> $associations = $this->_associations($modelObj); <del> $keyFields = []; <del> if (!empty($associations['BelongsTo'])) { <del> foreach ($associations['BelongsTo'] as $assoc) { <del> $keyFields[$assoc['foreignKey']] = $assoc['variable']; <del> } <add> <add> $primaryKey = (array)$modelObj->primaryKey(); <add> $displayField = $modelObj->displayField(); <add> $singularVar = $this->_singularName($this->controllerName); <add> $singularHumanName = $this->_singularHumanName($this->controllerName); <add> $schema = $modelObj->schema(); <add> $fields = $schema->columns(); <add> $associations = $this->_associations($modelObj); <add> $keyFields = []; <add> if (!empty($associations['BelongsTo'])) { <add> foreach ($associations['BelongsTo'] as $assoc) { <add> $keyFields[$assoc['foreignKey']] = $assoc['variable']; <ide> } <ide> } <add> <ide> $pluralVar = Inflector::variable($this->controllerName); <ide> $pluralHumanName = $this->_pluralHumanName($this->controllerName); <ide> <ide> public function getOptionParser() { <ide> 'boolean' => true, <ide> 'short' => 'f', <ide> 'help' => __d('cake_console', 'Force overwriting existing files without prompting.') <add> ])->addOption('controller', [ <add> 'help' => __d('cake_console', 'The controller name if you have a controller that does not follow conventions.') <ide> ])->addOption('prefix', [ <ide> 'help' => __d('cake_console', 'The routing prefix to generate views for.'), <ide> ])->addSubcommand('all', [ <ide><path>tests/TestCase/Console/Command/Task/ViewTaskTest.php <ide> public function testController() { <ide> public function testControllerVariations($name) { <ide> $this->Task->controller($name); <ide> $this->assertEquals('ViewTaskComments', $this->Task->controllerName); <add> $this->assertEquals('ViewTaskComments', $this->Task->tableName); <ide> } <ide> <ide> /** <ide> public function testControllerPlugin() { <ide> $this->Task->params['plugin'] = 'TestPlugin'; <ide> $this->Task->controller('Tests'); <ide> $this->assertEquals('Tests', $this->Task->controllerName); <add> $this->assertEquals('Tests', $this->Task->tableName); <ide> $this->assertEquals( <ide> 'TestPlugin\Controller\TestsController', <ide> $this->Task->controllerClass <ide> public function testControllerPrefix() { <ide> $this->Task->params['prefix'] = 'Admin'; <ide> $this->Task->controller('Posts'); <ide> $this->assertEquals('Posts', $this->Task->controllerName); <add> $this->assertEquals('Posts', $this->Task->tableName); <ide> $this->assertEquals( <ide> 'TestApp\Controller\Admin\PostsController', <ide> $this->Task->controllerClass <ide> public function testControllerPrefix() { <ide> $this->Task->params['plugin'] = 'TestPlugin'; <ide> $this->Task->controller('Comments'); <ide> $this->assertEquals('Comments', $this->Task->controllerName); <add> $this->assertEquals('Comments', $this->Task->tableName); <ide> $this->assertEquals( <ide> 'TestPlugin\Controller\Admin\CommentsController', <ide> $this->Task->controllerClass <ide> ); <ide> } <ide> <add>/** <add> * test controller with a non-conventional controller name <add> * <add> * @return void <add> */ <add> public function testControllerWithOverride() { <add> $this->Task->controller('Comments', 'Posts'); <add> $this->assertEquals('Posts', $this->Task->controllerName); <add> $this->assertEquals('Comments', $this->Task->tableName); <add> $this->assertEquals( <add> 'TestApp\Controller\PostsController', <add> $this->Task->controllerClass <add> ); <add> } <add> <ide> /** <ide> * Test getPath() <ide> * <ide> public function testGetContentWithRoutingPrefix() { <ide> */ <ide> public function testBakeView() { <ide> $this->Task->controllerName = 'ViewTaskComments'; <add> $this->Task->tableName = 'ViewTaskComments'; <ide> $this->Task->controllerClass = __NAMESPACE__ . '\ViewTaskCommentsController'; <ide> <ide> $this->Task->expects($this->at(0)) <ide> public function testBakeView() { <ide> */ <ide> public function testBakeEdit() { <ide> $this->Task->controllerName = 'ViewTaskComments'; <add> $this->Task->tableName = 'ViewTaskComments'; <ide> $this->Task->controllerClass = __NAMESPACE__ . '\ViewTaskCommentsController'; <ide> <ide> $this->Task->expects($this->at(0))->method('createFile') <ide> public function testBakeEdit() { <ide> */ <ide> public function testBakeIndex() { <ide> $this->Task->controllerName = 'ViewTaskComments'; <add> $this->Task->tableName = 'ViewTaskComments'; <ide> $this->Task->controllerClass = __NAMESPACE__ . '\ViewTaskCommentsController'; <ide> <ide> $this->Task->expects($this->at(0))->method('createFile') <ide> public function testBakeIndex() { <ide> */ <ide> public function testBakeWithNoTemplate() { <ide> $this->Task->controllerName = 'ViewTaskComments'; <add> $this->Task->tableName = 'ViewTaskComments'; <ide> $this->Task->controllerClass = __NAMESPACE__ . '\ViewTaskCommentsController'; <ide> <ide> $this->Task->expects($this->never())->method('createFile'); <ide> public function testBakeWithNoTemplate() { <ide> */ <ide> public function testBakeActions() { <ide> $this->Task->controllerName = 'ViewTaskComments'; <add> $this->Task->tableName = 'ViewTaskComments'; <ide> $this->Task->controllerClass = __NAMESPACE__ . '\ViewTaskCommentsController'; <ide> <ide> $this->Task->expects($this->at(0)) <ide> public function testBakeActions() { <ide> */ <ide> public function testCustomAction() { <ide> $this->Task->controllerName = 'ViewTaskComments'; <add> $this->Task->tableName = 'ViewTaskComments'; <ide> $this->Task->controllerClass = __NAMESPACE__ . '\ViewTaskCommentsController'; <ide> <ide> $this->Task->expects($this->any())->method('in') <ide> public function testExecuteWithController() { <ide> * @return void <ide> */ <ide> public static function nameVariations() { <del> return array(array('ViewTaskComments'), array('ViewTaskComment'), array('view_task_comment')); <add> return [['ViewTaskComments'], ['ViewTaskComment'], ['view_task_comment']]; <add> } <add> <add>/** <add> * test `cake bake view $table --controller Blog` <add> * <add> * @return void <add> */ <add> public function testExecuteWithControllerFlag() { <add> $this->Task->args[0] = 'Posts'; <add> $this->Task->params['controller'] = 'Blog'; <add> <add> $this->Task->expects($this->exactly(4)) <add> ->method('createFile'); <add> <add> $views = array('index.ctp', 'view.ctp', 'add.ctp', 'edit.ctp'); <add> foreach ($views as $i => $view) { <add> $this->Task->expects($this->at($i))->method('createFile') <add> ->with( <add> TMP . 'Blog/' . $view, <add> $this->anything() <add> ); <add> } <add> $this->Task->execute(); <ide> } <ide> <ide> /** <del> * test `cake bake view $controller --admin` <del> * Which only bakes admin methods, not non-admin methods. <add> * test `cake bake view $controller --prefix Admin` <ide> * <ide> * @return void <ide> */
2
Ruby
Ruby
preserve some directories
876021a926f9ef1ba6c555353f7a43678e97fb8b
<ide><path>Library/Homebrew/cmd/prune.rb <ide> def prune <ide> path.unlink <ide> end <ide> end <del> elsif path.directory? && !Keg::PRUNEABLE_DIRECTORIES.include?(path) <add> elsif path.directory? && !Keg::PRUNEABLE_DIRECTORIES.include?(path) && <add> !Keg::MUST_BE_WRITABLE_DIRECTORIES.include?(path) <ide> dirs << path <ide> end <ide> end
1
Text
Text
remove old sections [ci skip] (closes )
9c08d9baa31622e9e9daff37a9774774e42d8778
<ide><path>website/docs/usage/facts-figures.md <ide> next: /usage/spacy-101 <ide> menu: <ide> - ['Feature Comparison', 'comparison'] <ide> - ['Benchmarks', 'benchmarks'] <del> - ['Powered by spaCy', 'powered-by'] <del> - ['Other Libraries', 'other-libraries'] <ide> --- <ide> <ide> ## Feature comparison {#comparison}
1
Go
Go
graphdriver dynamic sandbox management
8c279ef3ad8cd1f019789b8378d0394c80a1807f
<ide><path>daemon/graphdriver/lcow/lcow.go <ide> // <ide> // * lcow.vhdx - Specifies a custom vhdx file to boot (instead of a kernel+initrd) <ide> // -- Possible values: Any valid filename <del>// -- Default if ommitted: C:\Program Files\Linux Containers\uvm.vhdx <add>// -- Default if ommitted: uvm.vhdx under `lcow.kirdpath` <ide> // <ide> // * lcow.timeout - Specifies a timeout for utility VM operations in seconds <ide> // -- Possible values: >=0 <ide> type cacheItem struct { <ide> isMounted bool // True when mounted in a service VM <ide> } <ide> <add>// setIsMounted is a helper function for a cacheItem which does exactly what it says <add>func (ci *cacheItem) setIsMounted() { <add> logrus.Debugf("locking cache item for set isMounted") <add> ci.Lock() <add> defer ci.Unlock() <add> ci.isMounted = true <add> logrus.Debugf("set isMounted on cache item") <add>} <add> <add>// incrementRefCount is a helper function for a cacheItem which does exactly what it says <add>func (ci *cacheItem) incrementRefCount() { <add> logrus.Debugf("locking cache item for increment") <add> ci.Lock() <add> defer ci.Unlock() <add> ci.refCount++ <add> logrus.Debugf("incremented refcount on cache item %+v", ci) <add>} <add> <add>// decrementRefCount is a helper function for a cacheItem which does exactly what it says <add>func (ci *cacheItem) decrementRefCount() int { <add> logrus.Debugf("locking cache item for decrement") <add> ci.Lock() <add> defer ci.Unlock() <add> ci.refCount-- <add> logrus.Debugf("decremented refcount on cache item %+v", ci) <add> return ci.refCount <add>} <add> <ide> // serviceVMItem is our internal structure representing an item in our <ide> // map of service VMs we are maintaining. <ide> type serviceVMItem struct { <ide> type Driver struct { <ide> cache map[string]*cacheItem // Map holding a cache of all the IDs we've mounted/unmounted. <ide> } <ide> <add>// layerDetails is the structure returned by a helper function `getLayerDetails` <add>// for getting information about a layer folder <add>type layerDetails struct { <add> filename string // \path\to\sandbox.vhdx or \path\to\layer.vhd <add> size int64 // size of the above file <add> isSandbox bool // true if sandbox.vhdx <add>} <add> <ide> // deletefiles is a helper function for initialisation where we delete any <ide> // left-over scratch files in case we were previously forcibly terminated. <ide> func deletefiles(path string, f os.FileInfo, err error) error { <ide> func (d *Driver) startServiceVMIfNotRunning(id string, mvdToAdd *hcsshim.MappedV <ide> logrus.Debugf("%s locking serviceVmItem %s", title, svm.config.Name) <ide> svm.Lock() <ide> <del> if err := svm.config.HotAddVhd(mvdToAdd.HostPath, mvdToAdd.ContainerPath); err != nil { <add> if err := svm.config.HotAddVhd(mvdToAdd.HostPath, mvdToAdd.ContainerPath, false, true); err != nil { <ide> logrus.Debugf("%s releasing serviceVmItem %s on hot-add failure %s", title, svm.config.Name, err) <ide> svm.Unlock() <ide> return nil, fmt.Errorf("%s hot add %s to %s failed: %s", title, mvdToAdd.HostPath, mvdToAdd.ContainerPath, err) <ide> func (d *Driver) startServiceVMIfNotRunning(id string, mvdToAdd *hcsshim.MappedV <ide> <ide> // Start it. <ide> logrus.Debugf("lcowdriver: startServiceVmIfNotRunning: (%s) starting %s", context, svm.config.Name) <del> if err := svm.config.Create(); err != nil { <add> if err := svm.config.StartUtilityVM(); err != nil { <ide> return nil, fmt.Errorf("failed to start service utility VM (%s): %s", context, err) <ide> } <ide> <ide> func (d *Driver) startServiceVMIfNotRunning(id string, mvdToAdd *hcsshim.MappedV <ide> logrus.Debugf("%s locking cachedScratchMutex", title) <ide> d.cachedScratchMutex.Lock() <ide> if _, err := os.Stat(d.cachedScratchFile); err != nil { <del> // TODO: Not a typo, but needs fixing when the platform sandbox stuff has been sorted out. <ide> logrus.Debugf("%s (%s): creating an SVM scratch - locking serviceVM", title, context) <ide> svm.Lock() <del> if err := svm.config.CreateSandbox(d.cachedScratchFile, client.DefaultSandboxSizeMB, d.cachedSandboxFile); err != nil { <del> logrus.Debugf("%s (%s): releasing serviceVM on error path", title, context) <add> if err := svm.config.CreateExt4Vhdx(scratchTargetFile, client.DefaultVhdxSizeGB, d.cachedScratchFile); err != nil { <add> logrus.Debugf("%s (%s): releasing serviceVM on error path from CreateExt4Vhdx: %s", title, context, err) <ide> svm.Unlock() <ide> logrus.Debugf("%s (%s): releasing cachedScratchMutex on error path", title, context) <ide> d.cachedScratchMutex.Unlock() <del> // TODO: NEED TO REMOVE FROM MAP HERE AND STOP IT <add> <add> // Do a force terminate and remove it from the map on failure, ignoring any errors <add> if err2 := d.terminateServiceVM(id, "error path from CreateExt4Vhdx", true); err2 != nil { <add> logrus.Warnf("failed to terminate service VM on error path from CreateExt4Vhdx: %s", err2) <add> } <add> <ide> return nil, fmt.Errorf("failed to create SVM scratch VHDX (%s): %s", context, err) <ide> } <del> logrus.Debugf("%s (%s): releasing serviceVM on error path", title, context) <add> logrus.Debugf("%s (%s): releasing serviceVM after %s created and cached to %s", title, context, scratchTargetFile, d.cachedScratchFile) <ide> svm.Unlock() <ide> } <ide> logrus.Debugf("%s (%s): releasing cachedScratchMutex", title, context) <ide> d.cachedScratchMutex.Unlock() <ide> <ide> // Hot-add the scratch-space if not already attached <ide> if !svm.scratchAttached { <del> // Make a copy of it to the layer directory <del> logrus.Debugf("lcowdriver: startServiceVmIfNotRunning: (%s) cloning cached scratch for hot-add", context) <del> if err := client.CopyFile(d.cachedScratchFile, scratchTargetFile, true); err != nil { <del> // TODO: NEED TO REMOVE FROM MAP HERE AND STOP IT <del> return nil, err <del> } <del> <ide> logrus.Debugf("lcowdriver: startServiceVmIfNotRunning: (%s) hot-adding scratch %s - locking serviceVM", context, scratchTargetFile) <ide> svm.Lock() <del> if err := svm.config.HotAddVhd(scratchTargetFile, toolsScratchPath); err != nil { <del> logrus.Debugf("%s (%s): releasing serviceVM on error path", title, context) <add> if err := svm.config.HotAddVhd(scratchTargetFile, toolsScratchPath, false, true); err != nil { <add> logrus.Debugf("%s (%s): releasing serviceVM on error path of HotAddVhd: %s", title, context, err) <ide> svm.Unlock() <del> // TODOL NEED TO REMOVE FROM MAP HERE AND STOP IT <add> <add> // Do a force terminate and remove it from the map on failure, ignoring any errors <add> if err2 := d.terminateServiceVM(id, "error path from HotAddVhd", true); err2 != nil { <add> logrus.Warnf("failed to terminate service VM on error path from HotAddVhd: %s", err2) <add> } <add> <ide> return nil, fmt.Errorf("failed to hot-add %s failed: %s", scratchTargetFile, err) <ide> } <ide> logrus.Debugf("%s (%s): releasing serviceVM", title, context) <ide> func (d *Driver) CreateReadWrite(id, parent string, opts *graphdriver.CreateOpts <ide> return err <ide> } <ide> <add> // Look for an explicit sandbox size option. <add> sandboxSize := uint64(client.DefaultVhdxSizeGB) <add> for k, v := range opts.StorageOpt { <add> switch strings.ToLower(k) { <add> case "lcow.sandboxsize": <add> var err error <add> sandboxSize, err = strconv.ParseUint(v, 10, 32) <add> if err != nil { <add> return fmt.Errorf("%s failed to parse value '%s' for 'lcow.sandboxsize'", title, v) <add> } <add> if sandboxSize < client.DefaultVhdxSizeGB { <add> return fmt.Errorf("%s 'lcow.sandboxsize' option cannot be less than %d", title, client.DefaultVhdxSizeGB) <add> } <add> break <add> } <add> } <add> <ide> // Massive perf optimisation here. If we know that the RW layer is the default size, <ide> // and that the cached sandbox already exists, and we are running in safe mode, we <ide> // can just do a simple copy into the layers sandbox file without needing to start a <del> // unique service VM. For a global service VM, it doesn't really matter. <add> // unique service VM. For a global service VM, it doesn't really matter. Of course, <add> // this is only the case where the sandbox is the default size. <ide> // <del> // TODO: @jhowardmsft Where are we going to get the required size from? <del> // We need to look at the CreateOpts for that, I think.... <del> <ide> // Make sure we have the sandbox mutex taken while we are examining it. <del> logrus.Debugf("%s: locking cachedSandboxMutex", title) <del> d.cachedSandboxMutex.Lock() <del> _, err := os.Stat(d.cachedSandboxFile) <del> logrus.Debugf("%s: releasing cachedSandboxMutex", title) <del> d.cachedSandboxMutex.Unlock() <del> if err == nil { <del> logrus.Debugf("%s: using cached sandbox to populate", title) <del> if err := client.CopyFile(d.cachedSandboxFile, filepath.Join(d.dir(id), sandboxFilename), true); err != nil { <del> return err <add> if sandboxSize == client.DefaultVhdxSizeGB { <add> logrus.Debugf("%s: locking cachedSandboxMutex", title) <add> d.cachedSandboxMutex.Lock() <add> _, err := os.Stat(d.cachedSandboxFile) <add> logrus.Debugf("%s: releasing cachedSandboxMutex", title) <add> d.cachedSandboxMutex.Unlock() <add> if err == nil { <add> logrus.Debugf("%s: using cached sandbox to populate", title) <add> if err := client.CopyFile(d.cachedSandboxFile, filepath.Join(d.dir(id), sandboxFilename), true); err != nil { <add> return err <add> } <add> return nil <ide> } <del> return nil <ide> } <ide> <ide> logrus.Debugf("%s: creating SVM to create sandbox", title) <ide> func (d *Driver) CreateReadWrite(id, parent string, opts *graphdriver.CreateOpts <ide> } <ide> defer d.terminateServiceVM(id, "createreadwrite", false) <ide> <del> // So the cached sandbox needs creating. Ensure we are the only thread creating it. <del> logrus.Debugf("%s: locking cachedSandboxMutex for creation", title) <del> d.cachedSandboxMutex.Lock() <del> defer func() { <del> logrus.Debugf("%s: releasing cachedSandboxMutex for creation", title) <del> d.cachedSandboxMutex.Unlock() <del> }() <add> // So the sandbox needs creating. If default size ensure we are the only thread populating the cache. <add> // Non-default size we don't store, just create them one-off so no need to lock the cachedSandboxMutex. <add> if sandboxSize == client.DefaultVhdxSizeGB { <add> logrus.Debugf("%s: locking cachedSandboxMutex for creation", title) <add> d.cachedSandboxMutex.Lock() <add> defer func() { <add> logrus.Debugf("%s: releasing cachedSandboxMutex for creation", title) <add> d.cachedSandboxMutex.Unlock() <add> }() <add> } <ide> <ide> // Synchronise the operation in the service VM. <ide> logrus.Debugf("%s: locking svm for sandbox creation", title) <ide> func (d *Driver) CreateReadWrite(id, parent string, opts *graphdriver.CreateOpts <ide> logrus.Debugf("%s: releasing svm for sandbox creation", title) <ide> svm.Unlock() <ide> }() <del> if err := svm.config.CreateSandbox(filepath.Join(d.dir(id), sandboxFilename), client.DefaultSandboxSizeMB, d.cachedSandboxFile); err != nil { <add> <add> // Make sure we don't write to our local cached copy if this is for a non-default size request. <add> targetCacheFile := d.cachedSandboxFile <add> if sandboxSize != client.DefaultVhdxSizeGB { <add> targetCacheFile = "" <add> } <add> <add> // Actually do the creation. <add> if err := svm.config.CreateExt4Vhdx(filepath.Join(d.dir(id), sandboxFilename), uint32(sandboxSize), targetCacheFile); err != nil { <ide> return err <ide> } <ide> <ide> func (d *Driver) Get(id, mountLabel string) (string, error) { <ide> logrus.Debugf(title) <ide> <ide> // Work out what we are working on <del> vhdFilename, vhdSize, isSandbox, err := getLayerDetails(d.dir(id)) <add> ld, err := getLayerDetails(d.dir(id)) <ide> if err != nil { <ide> logrus.Debugf("%s failed to get layer details from %s: %s", title, d.dir(id), err) <ide> return "", fmt.Errorf("%s failed to open layer or sandbox VHD to open in %s: %s", title, d.dir(id), err) <ide> } <del> logrus.Debugf("%s %s, size %d, isSandbox %t", title, vhdFilename, vhdSize, isSandbox) <add> logrus.Debugf("%s %s, size %d, isSandbox %t", title, ld.filename, ld.size, ld.isSandbox) <ide> <ide> // Add item to cache, or update existing item, but ensure we have the <ide> // lock while updating items. <ide> logrus.Debugf("%s: locking cacheMutex", title) <ide> d.cacheMutex.Lock() <del> var cacheEntry *cacheItem <del> if entry, ok := d.cache[id]; !ok { <add> var ci *cacheItem <add> if item, ok := d.cache[id]; !ok { <ide> // The item is not currently in the cache. <del> cacheEntry = &cacheItem{ <add> ci = &cacheItem{ <ide> refCount: 1, <del> isSandbox: isSandbox, <del> hostPath: vhdFilename, <add> isSandbox: ld.isSandbox, <add> hostPath: ld.filename, <ide> uvmPath: fmt.Sprintf("/mnt/%s", id), <ide> isMounted: false, // we defer this as an optimisation <ide> } <del> d.cache[id] = cacheEntry <del> logrus.Debugf("%s: added cache entry %+v", title, cacheEntry) <add> d.cache[id] = ci <add> logrus.Debugf("%s: added cache item %+v", title, ci) <ide> } else { <ide> // Increment the reference counter in the cache. <del> logrus.Debugf("%s: locking cache item for increment", title) <del> entry.Lock() <del> entry.refCount++ <del> logrus.Debugf("%s: releasing cache item for increment", title) <del> entry.Unlock() <del> logrus.Debugf("%s: incremented refcount on cache entry %+v", title, cacheEntry) <add> item.incrementRefCount() <ide> } <ide> logrus.Debugf("%s: releasing cacheMutex", title) <ide> d.cacheMutex.Unlock() <ide> <del> logrus.Debugf("%s %s success. %s: %+v: size %d", title, id, d.dir(id), cacheEntry, vhdSize) <add> logrus.Debugf("%s %s success. %s: %+v: size %d", title, id, d.dir(id), ci, ld.size) <ide> return d.dir(id), nil <ide> } <ide> <ide> func (d *Driver) Put(id string) error { <ide> <ide> logrus.Debugf("%s: locking cacheMutex", title) <ide> d.cacheMutex.Lock() <del> entry, ok := d.cache[id] <add> item, ok := d.cache[id] <ide> if !ok { <ide> logrus.Debugf("%s: releasing cacheMutex on error path", title) <ide> d.cacheMutex.Unlock() <ide> return fmt.Errorf("%s possible ref-count error, or invalid id was passed to the graphdriver. Cannot handle id %s as it's not in the cache", title, id) <ide> } <ide> <del> // Are we just decrementing the reference count? <del> logrus.Debugf("%s: locking cache item for possible decrement", title) <del> entry.Lock() <del> if entry.refCount > 1 { <del> entry.refCount-- <del> logrus.Debugf("%s: releasing cache item for decrement and early get-out as refCount is now %d", title, entry.refCount) <del> entry.Unlock() <del> logrus.Debugf("%s: refCount decremented to %d. Releasing cacheMutex", title, entry.refCount) <add> // Decrement the ref-count, and nothing more to do if still in use. <add> if item.decrementRefCount() > 0 { <add> logrus.Debugf("%s: releasing cacheMutex. Cache item is still in use", title) <ide> d.cacheMutex.Unlock() <ide> return nil <ide> } <del> logrus.Debugf("%s: releasing cache item", title) <del> entry.Unlock() <del> logrus.Debugf("%s: releasing cacheMutex. Ref count has dropped to zero", title) <del> d.cacheMutex.Unlock() <ide> <del> // To reach this point, the reference count has dropped to zero. If we have <del> // done a mount and we are in global mode, then remove it. We don't <del> // need to remove in safe mode as the service VM is going to be torn down <del> // anyway. <add> // Remove from the cache map. <add> delete(d.cache, id) <add> logrus.Debugf("%s: releasing cacheMutex. Ref count on cache item has dropped to zero, removed from cache", title) <add> d.cacheMutex.Unlock() <ide> <add> // If we have done a mount and we are in global mode, then remove it. We don't <add> // need to remove in safe mode as the service VM is going to be torn down anyway. <ide> if d.globalMode { <ide> logrus.Debugf("%s: locking cache item at zero ref-count", title) <del> entry.Lock() <add> item.Lock() <ide> defer func() { <ide> logrus.Debugf("%s: releasing cache item at zero ref-count", title) <del> entry.Unlock() <add> item.Unlock() <ide> }() <del> if entry.isMounted { <add> if item.isMounted { <ide> svm, err := d.getServiceVM(id, false) <ide> if err != nil { <ide> return err <ide> } <ide> <del> logrus.Debugf("%s: Hot-Removing %s. Locking svm", title, entry.hostPath) <add> logrus.Debugf("%s: Hot-Removing %s. Locking svm", title, item.hostPath) <ide> svm.Lock() <del> if err := svm.config.HotRemoveVhd(entry.hostPath); err != nil { <add> if err := svm.config.HotRemoveVhd(item.hostPath); err != nil { <ide> logrus.Debugf("%s: releasing svm on error path", title) <ide> svm.Unlock() <del> return fmt.Errorf("%s failed to hot-remove %s from global service utility VM: %s", title, entry.hostPath, err) <add> return fmt.Errorf("%s failed to hot-remove %s from global service utility VM: %s", title, item.hostPath, err) <ide> } <ide> logrus.Debugf("%s: releasing svm", title) <ide> svm.Unlock() <ide> } <ide> } <ide> <del> // Remove from the cache map. <del> logrus.Debugf("%s: Locking cacheMutex to delete item from cache", title) <del> d.cacheMutex.Lock() <del> delete(d.cache, id) <del> logrus.Debugf("%s: releasing cacheMutex after item deleted from cache", title) <del> d.cacheMutex.Unlock() <del> <del> logrus.Debugf("%s %s: refCount 0. %s (%s) completed successfully", title, id, entry.hostPath, entry.uvmPath) <add> logrus.Debugf("%s %s: refCount 0. %s (%s) completed successfully", title, id, item.hostPath, item.uvmPath) <ide> return nil <ide> } <ide> <ide> func (d *Driver) Cleanup() error { <ide> <ide> d.cacheMutex.Lock() <ide> for k, v := range d.cache { <del> logrus.Debugf("%s cache entry: %s: %+v", title, k, v) <add> logrus.Debugf("%s cache item: %s: %+v", title, k, v) <ide> if v.refCount > 0 { <ide> logrus.Warnf("%s leaked %s: %+v", title, k, v) <ide> } <ide> func (d *Driver) Cleanup() error { <ide> // Cleanup any service VMs we have running, along with their scratch spaces. <ide> // We don't take the lock for this as it's taken in terminateServiceVm. <ide> for k, v := range d.serviceVms { <del> logrus.Debugf("%s svm entry: %s: %+v", title, k, v) <add> logrus.Debugf("%s svm: %s: %+v", title, k, v) <ide> d.terminateServiceVM(k, "cleanup", true) <ide> } <ide> <ide> func (d *Driver) Diff(id, parent string) (io.ReadCloser, error) { <ide> d.cacheMutex.Unlock() <ide> return nil, fmt.Errorf("%s fail as %s is not in the cache", title, id) <ide> } <del> cacheEntry := d.cache[id] <add> ci := d.cache[id] <ide> logrus.Debugf("%s: releasing cacheMutex", title) <ide> d.cacheMutex.Unlock() <ide> <ide> // Stat to get size <del> logrus.Debugf("%s: locking cacheEntry", title) <del> cacheEntry.Lock() <del> fileInfo, err := os.Stat(cacheEntry.hostPath) <add> logrus.Debugf("%s: locking cacheItem", title) <add> ci.Lock() <add> fileInfo, err := os.Stat(ci.hostPath) <ide> if err != nil { <del> logrus.Debugf("%s: releasing cacheEntry on error path", title) <del> cacheEntry.Unlock() <del> return nil, fmt.Errorf("%s failed to stat %s: %s", title, cacheEntry.hostPath, err) <add> logrus.Debugf("%s: releasing cacheItem on error path", title) <add> ci.Unlock() <add> return nil, fmt.Errorf("%s failed to stat %s: %s", title, ci.hostPath, err) <ide> } <del> logrus.Debugf("%s: releasing cacheEntry", title) <del> cacheEntry.Unlock() <add> logrus.Debugf("%s: releasing cacheItem", title) <add> ci.Unlock() <ide> <ide> // Start the SVM with a mapped virtual disk. Note that if the SVM is <ide> // already runing and we are in global mode, this will be <ide> // hot-added. <ide> mvd := &hcsshim.MappedVirtualDisk{ <del> HostPath: cacheEntry.hostPath, <del> ContainerPath: cacheEntry.uvmPath, <add> HostPath: ci.hostPath, <add> ContainerPath: ci.uvmPath, <ide> CreateInUtilityVM: true, <ide> ReadOnly: true, <ide> } <ide> func (d *Driver) Diff(id, parent string) (io.ReadCloser, error) { <ide> return nil, err <ide> } <ide> <del> // Set `isMounted` for the cache entry. Note that we re-scan the cache <del> // at this point as it's possible the cacheEntry changed during the long- <add> // Set `isMounted` for the cache item. Note that we re-scan the cache <add> // at this point as it's possible the cacheItem changed during the long- <ide> // running operation above when we weren't holding the cacheMutex lock. <ide> logrus.Debugf("%s: locking cacheMutex for updating isMounted", title) <ide> d.cacheMutex.Lock() <ide> func (d *Driver) Diff(id, parent string) (io.ReadCloser, error) { <ide> d.terminateServiceVM(id, fmt.Sprintf("diff %s", id), false) <ide> return nil, fmt.Errorf("%s fail as %s is not in the cache when updating isMounted", title, id) <ide> } <del> cacheEntry = d.cache[id] <del> logrus.Debugf("%s: locking cacheEntry for updating isMounted", title) <del> cacheEntry.Lock() <del> cacheEntry.isMounted = true <del> logrus.Debugf("%s: releasing cacheEntry for updating isMounted", title) <del> cacheEntry.Unlock() <add> ci = d.cache[id] <add> ci.setIsMounted() <ide> logrus.Debugf("%s: releasing cacheMutex for updating isMounted", title) <ide> d.cacheMutex.Unlock() <ide> <ide> // Obtain the tar stream for it <del> logrus.Debugf("%s %s, size %d, isSandbox %t", title, cacheEntry.hostPath, fileInfo.Size(), cacheEntry.isSandbox) <del> tarReadCloser, err := svm.config.VhdToTar(cacheEntry.hostPath, cacheEntry.uvmPath, cacheEntry.isSandbox, fileInfo.Size()) <add> logrus.Debugf("%s %s, size %d, isSandbox %t", title, ci.hostPath, fileInfo.Size(), ci.isSandbox) <add> tarReadCloser, err := svm.config.VhdToTar(ci.hostPath, ci.uvmPath, ci.isSandbox, fileInfo.Size()) <ide> if err != nil { <ide> d.terminateServiceVM(id, fmt.Sprintf("diff %s", id), false) <ide> return nil, fmt.Errorf("%s failed to export layer to tar stream for id: %s, parent: %s : %s", title, id, parent, err) <ide> func (d *Driver) setLayerChain(id string, chain []string) error { <ide> // getLayerDetails is a utility for getting a file name, size and indication of <ide> // sandbox for a VHD(x) in a folder. A read-only layer will be layer.vhd. A <ide> // read-write layer will be sandbox.vhdx. <del>func getLayerDetails(folder string) (string, int64, bool, error) { <add>func getLayerDetails(folder string) (*layerDetails, error) { <ide> var fileInfo os.FileInfo <del> isSandbox := false <del> filename := filepath.Join(folder, layerFilename) <del> var err error <del> <del> if fileInfo, err = os.Stat(filename); err != nil { <del> filename = filepath.Join(folder, sandboxFilename) <del> if fileInfo, err = os.Stat(filename); err != nil { <del> if os.IsNotExist(err) { <del> return "", 0, isSandbox, fmt.Errorf("could not find layer or sandbox in %s", folder) <del> } <del> return "", 0, isSandbox, fmt.Errorf("error locating layer or sandbox in %s: %s", folder, err) <add> ld := &layerDetails{ <add> isSandbox: false, <add> filename: filepath.Join(folder, layerFilename), <add> } <add> <add> fileInfo, err := os.Stat(ld.filename) <add> if err != nil { <add> ld.filename = filepath.Join(folder, sandboxFilename) <add> if fileInfo, err = os.Stat(ld.filename); err != nil { <add> return nil, fmt.Errorf("failed to locate layer or sandbox in %s", folder) <ide> } <del> isSandbox = true <add> ld.isSandbox = true <ide> } <del> return filename, fileInfo.Size(), isSandbox, nil <add> ld.size = fileInfo.Size() <add> <add> return ld, nil <ide> }
1
Go
Go
fix multi-remove during service update
3249c1d0e79f57642b96f6692ffa44f46f15b602
<ide><path>api/client/service/update.go <ide> func updateService(flags *pflag.FlagSet, spec *swarm.ServiceSpec) error { <ide> } <ide> } <ide> <del> updateListOpts := func(flag string, field *[]string) { <del> if flags.Changed(flag) { <del> value := flags.Lookup(flag).Value.(*opts.ListOpts) <del> *field = value.GetAll() <del> } <del> } <del> <ide> updateInt64Value := func(flag string, field *int64) { <ide> if flags.Changed(flag) { <ide> *field = flags.Lookup(flag).Value.(int64Value).Value() <ide> func anyChanged(flags *pflag.FlagSet, fields ...string) bool { <ide> <ide> func updatePlacement(flags *pflag.FlagSet, placement *swarm.Placement) { <ide> field, _ := flags.GetStringSlice(flagConstraintAdd) <del> constraints := &placement.Constraints <ide> placement.Constraints = append(placement.Constraints, field...) <ide> <ide> toRemove := buildToRemoveSet(flags, flagConstraintRemove) <del> for i, constraint := range placement.Constraints { <del> if _, exists := toRemove[constraint]; exists { <del> *constraints = append((*constraints)[:i], (*constraints)[i+1:]...) <del> } <del> } <add> placement.Constraints = removeItems(placement.Constraints, toRemove, itemKey) <ide> } <ide> <ide> func updateLabels(flags *pflag.FlagSet, field *map[string]string) { <ide> func updateEnvironment(flags *pflag.FlagSet, field *[]string) { <ide> *field = append(*field, value.GetAll()...) <ide> } <ide> toRemove := buildToRemoveSet(flags, flagEnvRemove) <del> for i, env := range *field { <del> key := envKey(env) <del> if _, exists := toRemove[key]; exists { <del> *field = append((*field)[:i], (*field)[i+1:]...) <del> } <del> } <add> *field = removeItems(*field, toRemove, envKey) <ide> } <ide> <ide> func envKey(value string) string { <ide> kv := strings.SplitN(value, "=", 2) <ide> return kv[0] <ide> } <ide> <add>func itemKey(value string) string { <add> return value <add>} <add> <ide> func buildToRemoveSet(flags *pflag.FlagSet, flag string) map[string]struct{} { <ide> var empty struct{} <ide> toRemove := make(map[string]struct{}) <ide> func buildToRemoveSet(flags *pflag.FlagSet, flag string) map[string]struct{} { <ide> return toRemove <ide> } <ide> <add>func removeItems( <add> seq []string, <add> toRemove map[string]struct{}, <add> keyFunc func(string) string, <add>) []string { <add> newSeq := []string{} <add> for _, item := range seq { <add> if _, exists := toRemove[keyFunc(item)]; !exists { <add> newSeq = append(newSeq, item) <add> } <add> } <add> return newSeq <add>} <add> <ide> func updateMounts(flags *pflag.FlagSet, mounts *[]swarm.Mount) { <ide> if flags.Changed(flagMountAdd) { <ide> values := flags.Lookup(flagMountAdd).Value.(*MountOpt).Value() <ide> *mounts = append(*mounts, values...) <ide> } <ide> toRemove := buildToRemoveSet(flags, flagMountRemove) <del> for i, mount := range *mounts { <del> if _, exists := toRemove[mount.Target]; exists { <del> *mounts = append((*mounts)[:i], (*mounts)[i+1:]...) <add> <add> newMounts := []swarm.Mount{} <add> for _, mount := range *mounts { <add> if _, exists := toRemove[mount.Target]; !exists { <add> newMounts = append(newMounts, mount) <ide> } <ide> } <add> *mounts = newMounts <ide> } <ide> <ide> func updatePorts(flags *pflag.FlagSet, portConfig *[]swarm.PortConfig) { <ide> func updatePorts(flags *pflag.FlagSet, portConfig *[]swarm.PortConfig) { <ide> } <ide> } <ide> <del> if flags.Changed(flagPublishRemove) { <del> toRemove := flags.Lookup(flagPublishRemove).Value.(*opts.ListOpts).GetAll() <add> if !flags.Changed(flagPublishRemove) { <add> return <add> } <add> toRemove := flags.Lookup(flagPublishRemove).Value.(*opts.ListOpts).GetAll() <add> newPorts := []swarm.PortConfig{} <add>portLoop: <add> for _, port := range *portConfig { <ide> for _, rawTargetPort := range toRemove { <ide> targetPort := nat.Port(rawTargetPort) <del> for i, port := range *portConfig { <del> if string(port.Protocol) == targetPort.Proto() && <del> port.TargetPort == uint32(targetPort.Int()) { <del> *portConfig = append((*portConfig)[:i], (*portConfig)[i+1:]...) <del> break <del> } <add> if equalPort(targetPort, port) { <add> continue portLoop <ide> } <ide> } <add> newPorts = append(newPorts, port) <ide> } <add> *portConfig = newPorts <add>} <add> <add>func equalPort(targetPort nat.Port, port swarm.PortConfig) bool { <add> return (string(port.Protocol) == targetPort.Proto() && <add> port.TargetPort == uint32(targetPort.Int())) <ide> } <ide> <ide> func updateNetworks(flags *pflag.FlagSet, attachments *[]swarm.NetworkAttachmentConfig) { <ide> func updateNetworks(flags *pflag.FlagSet, attachments *[]swarm.NetworkAttachment <ide> } <ide> } <ide> toRemove := buildToRemoveSet(flags, flagNetworkRemove) <del> for i, network := range *attachments { <del> if _, exists := toRemove[network.Target]; exists { <del> *attachments = append((*attachments)[:i], (*attachments)[i+1:]...) <add> newNetworks := []swarm.NetworkAttachmentConfig{} <add> for _, network := range *attachments { <add> if _, exists := toRemove[network.Target]; !exists { <add> newNetworks = append(newNetworks, network) <ide> } <ide> } <add> *attachments = newNetworks <ide> } <ide> <ide> func updateReplicas(flags *pflag.FlagSet, serviceMode *swarm.ServiceMode) error { <ide><path>api/client/service/update_test.go <ide> func TestUpdateLabels(t *testing.T) { <ide> assert.Equal(t, labels["toadd"], "newlabel") <ide> } <ide> <add>func TestUpdateLabelsRemoveALabelThatDoesNotExist(t *testing.T) { <add> flags := newUpdateCommand(nil).Flags() <add> flags.Set("label-rm", "dne") <add> <add> labels := map[string]string{"foo": "theoldlabel"} <add> updateLabels(flags, &labels) <add> assert.Equal(t, len(labels), 1) <add>} <add> <ide> func TestUpdatePlacement(t *testing.T) { <ide> flags := newUpdateCommand(nil).Flags() <ide> flags.Set("constraint-add", "node=toadd") <ide> func TestUpdateEnvironment(t *testing.T) { <ide> assert.Equal(t, envs[1], "toadd=newenv") <ide> } <ide> <add>func TestUpdateEnvironmentWithDuplicateValues(t *testing.T) { <add> flags := newUpdateCommand(nil).Flags() <add> flags.Set("env-add", "foo=newenv") <add> flags.Set("env-add", "foo=dupe") <add> flags.Set("env-rm", "foo") <add> <add> envs := []string{"foo=value"} <add> <add> updateEnvironment(flags, &envs) <add> assert.Equal(t, len(envs), 0) <add>} <add> <ide> func TestUpdateMounts(t *testing.T) { <ide> flags := newUpdateCommand(nil).Flags() <ide> flags.Set("mount-add", "type=volume,target=/toadd")
2
PHP
PHP
apply fixes from styleci
ea3f1e3e456843fb5b0c5cc67c86c2fe3d87b861
<ide><path>src/Illuminate/Pagination/AbstractPaginator.php <ide> public function through(callable $callback) <ide> $this->items->transform($callback); <ide> <ide> return $this; <del> } <add> } <ide> <ide> /** <ide> * Get the number of items shown per page.
1
Javascript
Javascript
fix proptypes.{oneof, oneoftype} validation
ac349cfbe520c95bd6ba2d31138569a6750b7ba8
<ide><path>src/isomorphic/classic/types/ReactPropTypes.js <ide> function createInstanceTypeChecker(expectedClass) { <ide> <ide> function createEnumTypeChecker(expectedValues) { <ide> if (!Array.isArray(expectedValues)) { <del> return new Error( <del> `Invalid argument supplied to oneOf, expected an instance of array.` <del> ); <add> return createChainableTypeChecker(function() { <add> return new Error( <add> `Invalid argument supplied to oneOf, expected an instance of array.` <add> ); <add> }); <ide> } <ide> <ide> function validate(props, propName, componentName, location, propFullName) { <ide> function createObjectOfTypeChecker(typeChecker) { <ide> <ide> function createUnionTypeChecker(arrayOfTypeCheckers) { <ide> if (!Array.isArray(arrayOfTypeCheckers)) { <del> return new Error( <del> `Invalid argument supplied to oneOfType, expected an instance of array.` <del> ); <add> return createChainableTypeChecker(function() { <add> return new Error( <add> `Invalid argument supplied to oneOfType, expected an instance of array.` <add> ); <add> }); <ide> } <ide> <ide> function validate(props, propName, componentName, location, propFullName) { <ide><path>src/isomorphic/classic/types/__tests__/ReactPropTypes-test.js <ide> describe('ReactPropTypes', function() { <ide> <ide> describe('OneOf Types', function() { <ide> it("should fail for invalid argument", function() { <del> var error = PropTypes.oneOf('red', 'blue'); <del> expect(error instanceof Error).toBe(true); <del> expect(error.message).toBe('Invalid argument supplied to ' + <del> 'oneOf, expected an instance of array.'); <add> typeCheckFail( <add> PropTypes.oneOf('red', 'blue'), <add> 'red', <add> 'Invalid argument supplied to oneOf, expected an instance of array.' <add> ); <ide> }); <ide> <ide> it("should warn for invalid strings", function() { <ide> describe('ReactPropTypes', function() { <ide> <ide> describe('Union Types', function() { <ide> it("should fail for invalid argument", function() { <del> var error = PropTypes.oneOfType('red', 'blue'); <del> expect(error instanceof Error).toBe(true); <del> expect(error.message).toBe('Invalid argument supplied to ' + <del> 'oneOfType, expected an instance of array.'); <add> typeCheckFail( <add> PropTypes.oneOfType(PropTypes.string, PropTypes.number), <add> 'red', <add> 'Invalid argument supplied to oneOfType, expected an instance of array.' <add> ); <ide> }); <ide> <ide> it('should warn if none of the types are valid', function() {
2
Javascript
Javascript
fix animation in fast navigation between scenes
df43cc7f6bf24802275e27a068a7f6a3169d538f
<ide><path>Libraries/NavigationExperimental/NavigationTransitioner.js <ide> class NavigationTransitioner extends React.Component<any, Props, State> { <ide> scenes: nextScenes, <ide> }; <ide> <del> this._prevTransitionProps = this._transitionProps; <del> this._transitionProps = buildTransitionProps(nextProps, nextState); <del> <ide> const { <ide> position, <ide> progress, <ide> } = nextState; <ide> <add> progress.setValue(0); <add> <add> this._prevTransitionProps = this._transitionProps; <add> this._transitionProps = buildTransitionProps(nextProps, nextState); <add> <ide> // get the transition spec. <ide> const transitionUserSpec = nextProps.configureTransition ? <ide> nextProps.configureTransition( <ide> class NavigationTransitioner extends React.Component<any, Props, State> { <ide> const {timing} = transitionSpec; <ide> delete transitionSpec.timing; <ide> <del> progress.setValue(0); <del> <ide> const animations = [ <ide> timing( <ide> progress,
1
Java
Java
move some js modules to debug only
bdc47313e8f2020bd3c1b58deccea8418ac4c910
<ide><path>ReactAndroid/src/main/java/com/facebook/react/CoreModulesPackage.java <ide> public List<Class<? extends JavaScriptModule>> createJSModules() { <ide> RCTEventEmitter.class, <ide> RCTNativeAppEventEmitter.class, <ide> AppRegistry.class, <del> com.facebook.react.bridge.Systrace.class, <del> HMRClient.class, <del> JSCSamplingProfiler.SamplingProfiler.class, <del> DebugComponentOwnershipModule.RCTDebugComponentOwnership.class)); <add> com.facebook.react.bridge.Systrace.class)); <ide> <ide> if (ReactBuildConfig.DEBUG) { <add> jsModules.add(DebugComponentOwnershipModule.RCTDebugComponentOwnership.class); <add> jsModules.add(HMRClient.class); <ide> jsModules.add(JSCHeapCapture.HeapCapture.class); <add> jsModules.add(JSCSamplingProfiler.SamplingProfiler.class); <ide> } <ide> <ide> return jsModules;
1
PHP
PHP
fix cs errors
06d71b5d2c7455c525526bcf541164e494bcc027
<ide><path>src/Collection/CollectionTrait.php <ide> public function cartesianProduct(?callable $operation = null, ?callable $filter <ide> }, $collectionArrays, $collectionArraysKeys, $currentIndexes); <ide> <ide> if ($filter === null || $filter($currentCombination)) { <del> $result[] = ($operation === null) ? $currentCombination : $operation($currentCombination); <add> $result[] = $operation === null ? $currentCombination : $operation($currentCombination); <ide> } <ide> <ide> $currentIndexes[$lastIndex]++; <ide><path>src/Console/ConsoleErrorHandler.php <ide> public function handleException(Throwable $exception): void <ide> $this->_displayException($exception); <ide> $this->_logException($exception); <ide> $code = $exception->getCode(); <del> $code = ($code && is_int($code)) ? $code : 1; <add> $code = $code && is_int($code) ? $code : 1; <ide> $this->_stop($code); <ide> } <ide> <ide><path>src/Console/ConsoleInputOption.php <ide> public function help(int $width = 0): string <ide> */ <ide> public function usage(): string <ide> { <del> $name = (strlen($this->_short) > 0) ? ('-' . $this->_short) : ('--' . $this->_name); <add> $name = strlen($this->_short) > 0 ? ('-' . $this->_short) : ('--' . $this->_name); <ide> $default = ''; <ide> if (strlen($this->_default) > 0 && $this->_default !== true) { <ide> $default = ' ' . $this->_default; <ide><path>src/Console/HelpFormatter.php <ide> protected function _getMaxLength(array $collection): int <ide> { <ide> $max = 0; <ide> foreach ($collection as $item) { <del> $max = (strlen($item->name()) > $max) ? strlen($item->name()) : $max; <add> $max = strlen($item->name()) > $max ? strlen($item->name()) : $max; <ide> } <ide> <ide> return $max; <ide><path>src/Core/functions.php <ide> function pr($var) <ide> return $var; <ide> } <ide> <del> $template = (PHP_SAPI !== 'cli' && PHP_SAPI !== 'phpdbg') ? '<pre class="pr">%s</pre>' : "\n%s\n\n"; <add> $template = PHP_SAPI !== 'cli' && PHP_SAPI !== 'phpdbg' ? '<pre class="pr">%s</pre>' : "\n%s\n\n"; <ide> printf($template, trim(print_r($var, true))); <ide> <ide> return $var; <ide> function pj($var) <ide> return $var; <ide> } <ide> <del> $template = (PHP_SAPI !== 'cli' && PHP_SAPI !== 'phpdbg') ? '<pre class="pj">%s</pre>' : "\n%s\n\n"; <add> $template = PHP_SAPI !== 'cli' && PHP_SAPI !== 'phpdbg' ? '<pre class="pj">%s</pre>' : "\n%s\n\n"; <ide> printf($template, trim(json_encode($var, JSON_PRETTY_PRINT))); <ide> <ide> return $var; <ide><path>src/Database/Expression/QueryExpression.php <ide> public function sql(ValueBinder $generator): string <ide> return ''; <ide> } <ide> $conjunction = $this->_conjunction; <del> $template = ($len === 1) ? '%s' : '(%s)'; <add> $template = $len === 1 ? '%s' : '(%s)'; <ide> $parts = []; <ide> foreach ($this->_conditions as $part) { <ide> if ($part instanceof Query) { <ide><path>src/Database/Expression/TupleComparison.php <ide> protected function _stringifyValues(ValueBinder $generator): string <ide> continue; <ide> } <ide> <del> $valType = ($multiType && isset($type[$i])) ? $type[$i] : $type; <add> $valType = $multiType && isset($type[$i]) ? $type[$i] : $type; <ide> $values[] = $this->_bindValue($value, $generator, $valType); <ide> } <ide> <ide><path>src/Datasource/Paginator.php <ide> public function validateSort(RepositoryInterface $object, array $options): array <ide> $direction = 'asc'; <ide> } <ide> <del> $order = (isset($options['order']) && is_array($options['order'])) ? $options['order'] : []; <add> $order = isset($options['order']) && is_array($options['order']) ? $options['order'] : []; <ide> if ($order && $options['sort'] && strpos($options['sort'], '.') === false) { <ide> $order = $this->_removeAliases($order, $object->getAlias()); <ide> } <ide><path>src/Filesystem/File.php <ide> protected static function _basename(string $path, ?string $ext = null): string <ide> { <ide> // check for multibyte string and use basename() if not found <ide> if (mb_strlen($path) === strlen($path)) { <del> return ($ext === null) ? basename($path) : basename($path, $ext); <add> return $ext === null ? basename($path) : basename($path, $ext); <ide> } <ide> <ide> $splInfo = new SplFileInfo($path); <ide> protected static function _basename(string $path, ?string $ext = null): string <ide> $new = preg_replace("/({$ext})$/u", "", $name); <ide> <ide> // basename of '/etc/.d' is '.d' not '' <del> return ($new === '') ? $name : $new; <add> return $new === '' ? $name : $new; <ide> } <ide> <ide> /** <ide><path>src/Http/Client.php <ide> public function buildUrl(string $url, $query = [], array $options = []): string <ide> return $url; <ide> } <ide> if ($query) { <del> $q = (strpos($url, '?') === false) ? '?' : '&'; <add> $q = strpos($url, '?') === false ? '?' : '&'; <ide> $url .= $q; <ide> $url .= is_string($query) ? $query : http_build_query($query); <ide> } <ide><path>src/Http/Cookie/Cookie.php <ide> protected function _expand(string $string) <ide> if ($first === '{' || $first === '[') { <ide> $ret = json_decode($string, true); <ide> <del> return ($ret !== null) ? $ret : $string; <add> return $ret ?? $string; <ide> } <ide> <ide> $array = []; <ide><path>src/I18n/PluralRules.php <ide> public static function calculate(string $locale, $n): int <ide> ($n === 2 ? 1 : <ide> ($n !== 8 && $n !== 11 ? 2 : 3)); <ide> case 15: <del> return ($n % 10 !== 1 || $n % 100 === 11) ? 1 : 0; <add> return $n % 10 !== 1 || $n % 100 === 11 ? 1 : 0; <ide> } <ide> } <ide> } <ide><path>src/I18n/RelativeTimeFormatter.php <ide> public function diffForHumans( <ide> $diffInterval = $date->diff($other); <ide> <ide> switch (true) { <del> case ($diffInterval->y > 0): <add> case $diffInterval->y > 0: <ide> $count = $diffInterval->y; <ide> $message = __dn('cake', '{0} year', '{0} years', $count, $count); <ide> break; <del> case ($diffInterval->m > 0): <add> case $diffInterval->m > 0: <ide> $count = $diffInterval->m; <ide> $message = __dn('cake', '{0} month', '{0} months', $count, $count); <ide> break; <del> case ($diffInterval->d > 0): <add> case $diffInterval->d > 0: <ide> $count = $diffInterval->d; <ide> if ($count >= I18nDateTimeInterface::DAYS_PER_WEEK) { <ide> $count = (int)($count / I18nDateTimeInterface::DAYS_PER_WEEK); <ide> public function diffForHumans( <ide> $message = __dn('cake', '{0} day', '{0} days', $count, $count); <ide> } <ide> break; <del> case ($diffInterval->h > 0): <add> case $diffInterval->h > 0: <ide> $count = $diffInterval->h; <ide> $message = __dn('cake', '{0} hour', '{0} hours', $count, $count); <ide> break; <del> case ($diffInterval->i > 0): <add> case $diffInterval->i > 0: <ide> $count = $diffInterval->i; <ide> $message = __dn('cake', '{0} minute', '{0} minutes', $count, $count); <ide> break; <ide><path>src/Routing/Router.php <ide> public static function url($url = null, $full = false): string <ide> } <ide> if (is_array($url)) { <ide> if (isset($url['_ssl'])) { <del> $url['_scheme'] = ($url['_ssl'] === true) ? 'https' : 'http'; <add> $url['_scheme'] = $url['_ssl'] === true ? 'https' : 'http'; <ide> } <ide> <ide> if (isset($url['_full']) && $url['_full'] === true) { <ide><path>src/Utility/CookieCryptTrait.php <ide> protected function _explode($string) <ide> if ($first === '{' || $first === '[') { <ide> $ret = json_decode($string, true); <ide> <del> return ($ret !== null) ? $ret : $string; <add> return $ret ?? $string; <ide> } <ide> $array = []; <ide> foreach (explode(',', $string) as $pair) { <ide><path>src/Utility/Text.php <ide> public static function utf8(string $string): array <ide> $map[] = $value; <ide> } else { <ide> if (empty($values)) { <del> $find = ($value < 224) ? 2 : 3; <add> $find = $value < 224 ? 2 : 3; <ide> } <ide> $values[] = $value; <ide> <ide><path>src/Validation/Validation.php <ide> public static function luhn($check): bool <ide> <ide> for ($position = ($length % 2); $position < $length; $position += 2) { <ide> $number = (int)$check[$position] * 2; <del> $sum += ($number < 10) ? $number : $number - 9; <add> $sum += $number < 10 ? $number : $number - 9; <ide> } <ide> <ide> return $sum % 10 === 0; <ide><path>src/Validation/Validator.php <ide> protected function _canBeEmpty(ValidationSet $field, array $context): bool <ide> <ide> $newRecord = $context['newRecord']; <ide> if (in_array($allowed, [static::WHEN_CREATE, static::WHEN_UPDATE], true)) { <del> $allowed = ( <del> ($allowed === static::WHEN_CREATE && $newRecord) || <del> ($allowed === static::WHEN_UPDATE && !$newRecord) <del> ); <add> $allowed = ($allowed === static::WHEN_CREATE && $newRecord) || <add> ($allowed === static::WHEN_UPDATE && !$newRecord); <ide> } <ide> <ide> return $allowed; <ide><path>src/View/Helper/PaginatorHelper.php <ide> protected function _firstNumber(string $ellipsis, array $params, int $start, arr <ide> $out = ''; <ide> $first = is_int($options['first']) ? $options['first'] : 0; <ide> if ($options['first'] && $start > 1) { <del> $offset = ($start <= $first) ? $start - 1 : $options['first']; <add> $offset = $start <= $first ? $start - 1 : $options['first']; <ide> $out .= $this->first($offset, $options); <ide> if ($first < $start - 1) { <ide> $out .= $ellipsis; <ide> protected function _lastNumber(string $ellipsis, array $params, int $end, array <ide> $out = ''; <ide> $last = is_int($options['last']) ? $options['last'] : 0; <ide> if ($options['last'] && $end < $params['pageCount']) { <del> $offset = ($params['pageCount'] < $end + $last) ? $params['pageCount'] - $end : $options['last']; <add> $offset = $params['pageCount'] < $end + $last ? $params['pageCount'] - $end : $options['last']; <ide> if ($offset <= $options['last'] && $params['pageCount'] - $end > $last) { <ide> $out .= $ellipsis; <ide> }
19
Mixed
Ruby
fix find_in_batches with customized primary_key
761bc751d31c22e2c2fdae2b4cdd435b68b6d783
<ide><path>activerecord/CHANGELOG.md <ide> ## Rails 4.0.0 (unreleased) ## <ide> <add>* Fix `find_in_batches` when primary_key is set other than id. <add> You can now use this method with the primary key which is not integer-based. <add> <add> Example: <add> <add> class Post < ActiveRecord::Base <add> self.primary_key = :title <add> end <add> <add> Post.find_in_batches(:start => 'My First Post') do |batch| <add> batch.each { |post| post.author.greeting } <add> end <add> <add> *Toshiyuki Kawanishi* <add> <ide> * You can now override the generated accessor methods for stored attributes <ide> and reuse the original behavior with `read_store_attribute` and `write_store_attribute`, <ide> which are counterparts to `read_attribute` and `write_attribute`. <ide><path>activerecord/lib/active_record/relation/batches.rb <ide> def find_each(options = {}) <ide> # want multiple workers dealing with the same processing queue. You can <ide> # make worker 1 handle all the records between id 0 and 10,000 and <ide> # worker 2 handle from 10,000 and beyond (by setting the +:start+ <del> # option on that worker). <add> # option on that worker). You can also use non-integer-based primary keys <add> # if start point is set. <ide> # <ide> # It's not possible to set the order. That is automatically set to <del> # ascending on the primary key ("id ASC") to make the batch ordering <del> # work. This also mean that this method only works with integer-based <del> # primary keys. You can't set the limit either, that's used to control <add> # ascending on the primary key (e.g. "id ASC") to make the batch ordering <add> # work. You can't set the limit either, that's used to control <ide> # the batch sizes. <ide> # <ide> # Person.where("age > 21").find_in_batches do |group| <ide> def find_in_batches(options = {}) <ide> ActiveRecord::Base.logger.warn("Scoped order and limit are ignored, it's forced to be batch order and batch size") <ide> end <ide> <del> start = options.delete(:start).to_i <add> start = options.delete(:start) <add> start ||= 0 <ide> batch_size = options.delete(:batch_size) || 1000 <ide> <ide> relation = relation.reorder(batch_order).limit(batch_size) <ide> records = relation.where(table[primary_key].gteq(start)).to_a <ide> <ide> while records.any? <ide> records_size = records.size <del> primary_key_offset = records.last.id <add> primary_key_offset = records.last.send(primary_key) <ide> <ide> yield records <ide> <ide><path>activerecord/test/cases/batches_test.rb <ide> def test_find_in_batches_should_not_ignore_the_default_scope_if_it_is_other_then <ide> assert_equal special_posts_ids, posts.map(&:id) <ide> end <ide> <add> def test_find_in_batches_should_use_any_column_as_primary_key <add> title_order_posts = Post.order('title asc') <add> start_title = title_order_posts.first.title <add> <add> posts = [] <add> PostWithTitlePrimaryKey.find_in_batches(:batch_size => 1, :start => start_title) do |batch| <add> posts.concat(batch) <add> end <add> <add> assert_equal title_order_posts.map(&:id), posts.map(&:id) <add> end <ide> end <ide><path>activerecord/test/models/post.rb <ide> class SpecialPostWithDefaultScope < ActiveRecord::Base <ide> self.table_name = 'posts' <ide> default_scope { where(:id => [1, 5,6]) } <ide> end <add> <add>class PostWithTitlePrimaryKey < ActiveRecord::Base <add> self.table_name = 'posts' <add> self.primary_key = :title <add>end
4
PHP
PHP
add methods for sending cookies with test requests
4542387f4b0ac77726ec970b49c1102509df79e9
<ide><path>src/Illuminate/Foundation/Testing/Concerns/MakesHttpRequests.php <ide> <ide> trait MakesHttpRequests <ide> { <add> /** <add> * Additional cookies for the request. <add> * <add> * @var array <add> */ <add> protected $defaultCookies = []; <add> <ide> /** <ide> * Additional headers for the request. <ide> * <ide> trait MakesHttpRequests <ide> */ <ide> protected $followRedirects = false; <ide> <add> /** <add> * Indicates whether cookies should be encrypted. <add> * <add> * @var bool <add> */ <add> protected $encryptCookies = true; <add> <ide> /** <ide> * Define additional headers to be sent with the request. <ide> * <ide> public function withMiddleware($middleware = null) <ide> return $this; <ide> } <ide> <add> /** <add> * Define additional cookies to be sent with the request. <add> * <add> * @param array $cookies <add> * @return $this <add> */ <add> public function withCookies(array $cookies) <add> { <add> $this->defaultCookies = array_merge($this->defaultCookies, $cookies); <add> <add> return $this; <add> } <add> <add> /** <add> * Add a cookie to be sent with the request. <add> * <add> * @param string $name <add> * @param string $value <add> * @return $this <add> */ <add> public function withCookie(string $name, string $value) <add> { <add> $this->defaultCookies[$name] = $value; <add> <add> return $this; <add> } <add> <ide> /** <ide> * Automatically follow any redirects returned from the response. <ide> * <ide> public function followingRedirects() <ide> return $this; <ide> } <ide> <add> /** <add> * Disable automatic encryption of cookie values. <add> * <add> * @return $this <add> */ <add> public function disableCookieEncryption() <add> { <add> $this->encryptCookies = false; <add> <add> return $this; <add> } <add> <ide> /** <ide> * Set the referer header and previous URL session value in order to simulate a previous request. <ide> * <ide> public function from(string $url) <ide> public function get($uri, array $headers = []) <ide> { <ide> $server = $this->transformHeadersToServerVars($headers); <add> $cookies = $this->prepareCookiesForRequest(); <ide> <del> return $this->call('GET', $uri, [], [], [], $server); <add> return $this->call('GET', $uri, [], $cookies, [], $server); <ide> } <ide> <ide> /** <ide> public function getJson($uri, array $headers = []) <ide> public function post($uri, array $data = [], array $headers = []) <ide> { <ide> $server = $this->transformHeadersToServerVars($headers); <add> $cookies = $this->prepareCookiesForRequest(); <ide> <del> return $this->call('POST', $uri, $data, [], [], $server); <add> return $this->call('POST', $uri, $data, $cookies, [], $server); <ide> } <ide> <ide> /** <ide> public function postJson($uri, array $data = [], array $headers = []) <ide> public function put($uri, array $data = [], array $headers = []) <ide> { <ide> $server = $this->transformHeadersToServerVars($headers); <add> $cookies = $this->prepareCookiesForRequest(); <ide> <del> return $this->call('PUT', $uri, $data, [], [], $server); <add> return $this->call('PUT', $uri, $data, $cookies, [], $server); <ide> } <ide> <ide> /** <ide> public function putJson($uri, array $data = [], array $headers = []) <ide> public function patch($uri, array $data = [], array $headers = []) <ide> { <ide> $server = $this->transformHeadersToServerVars($headers); <add> $cookies = $this->prepareCookiesForRequest(); <ide> <del> return $this->call('PATCH', $uri, $data, [], [], $server); <add> return $this->call('PATCH', $uri, $data, $cookies, [], $server); <ide> } <ide> <ide> /** <ide> public function patchJson($uri, array $data = [], array $headers = []) <ide> public function delete($uri, array $data = [], array $headers = []) <ide> { <ide> $server = $this->transformHeadersToServerVars($headers); <add> $cookies = $this->prepareCookiesForRequest(); <ide> <del> return $this->call('DELETE', $uri, $data, [], [], $server); <add> return $this->call('DELETE', $uri, $data, $cookies, [], $server); <ide> } <ide> <ide> /** <ide> public function deleteJson($uri, array $data = [], array $headers = []) <ide> public function options($uri, array $data = [], array $headers = []) <ide> { <ide> $server = $this->transformHeadersToServerVars($headers); <add> $cookies = $this->prepareCookiesForRequest(); <ide> <del> return $this->call('OPTIONS', $uri, $data, [], [], $server); <add> return $this->call('OPTIONS', $uri, $data, $cookies, [], $server); <ide> } <ide> <ide> /** <ide> protected function extractFilesFromDataArray(&$data) <ide> return $files; <ide> } <ide> <add> /** <add> * If enabled, encrypt cookie values for request. <add> * <add> * @return array <add> */ <add> protected function prepareCookiesForRequest() <add> { <add> if (! $this->encryptCookies) { <add> return $this->defaultCookies; <add> } <add> <add> return collect($this->defaultCookies)->map(function ($value) { <add> return encrypt($value, false); <add> })->all(); <add> } <add> <ide> /** <ide> * Follow a redirect chain until a non-redirect is received. <ide> * <ide><path>tests/Foundation/Testing/Concerns/MakesHttpRequestsTest.php <ide> public function testWithoutAndWithMiddlewareWithParameter() <ide> $this->app->make(MyMiddleware::class)->handle('foo', $next) <ide> ); <ide> } <add> <add> public function testWithCookieSetCookie() <add> { <add> $this->withCookie('foo', 'bar'); <add> <add> $this->assertCount(1, $this->defaultCookies); <add> $this->assertSame('bar', $this->defaultCookies['foo']); <add> } <add> <add> public function testWithCookiesSetsCookiesAndOverwritesPreviousValues() <add> { <add> $this->withCookie('foo', 'bar'); <add> $this->withCookies([ <add> 'foo' => 'baz', <add> 'new-cookie' => 'new-value', <add> ]); <add> <add> $this->assertCount(2, $this->defaultCookies); <add> $this->assertSame('baz', $this->defaultCookies['foo']); <add> $this->assertSame('new-value', $this->defaultCookies['new-cookie']); <add> } <ide> } <ide> <ide> class MyMiddleware
2
Python
Python
introduce notification_sent to slamiss view
1e2d1a2fe89e290b94c58acde85e94a4900f4073
<ide><path>airflow/www/views.py <ide> class SlaMissModelView(AirflowModelView): <ide> permissions.ACTION_CAN_ACCESS_MENU, <ide> ] <ide> <del> list_columns = ['dag_id', 'task_id', 'execution_date', 'email_sent', 'timestamp'] <add> list_columns = ['dag_id', 'task_id', 'execution_date', 'email_sent', 'notification_sent', 'timestamp'] <ide> <ide> label_columns = { <ide> 'execution_date': 'Logical Date', <ide> } <ide> <del> add_columns = ['dag_id', 'task_id', 'execution_date', 'email_sent', 'timestamp'] <del> edit_columns = ['dag_id', 'task_id', 'execution_date', 'email_sent', 'timestamp'] <del> search_columns = ['dag_id', 'task_id', 'email_sent', 'timestamp', 'execution_date'] <add> add_columns = ['dag_id', 'task_id', 'execution_date', 'email_sent', 'notification_sent', 'timestamp'] <add> edit_columns = ['dag_id', 'task_id', 'execution_date', 'email_sent', 'notification_sent', 'timestamp'] <add> search_columns = ['dag_id', 'task_id', 'email_sent', 'notification_sent', 'timestamp', 'execution_date'] <ide> base_order = ('execution_date', 'desc') <ide> base_filters = [['dag_id', DagFilter, lambda: []]] <ide>
1
Ruby
Ruby
fix variable name
cac6f2f07079c28450240800ba2ffd3b4104ea35
<ide><path>Library/Homebrew/cmd/test.rb <ide> def test <ide> Utils.safe_fork do <ide> if Sandbox.available? && ARGV.sandbox? <ide> sandbox = Sandbox.new <del> formula.logs.mkpath <add> f.logs.mkpath <ide> sandbox.record_log(f.logs/"sandbox.test.log") <ide> sandbox.allow_write_temp_and_cache <ide> sandbox.allow_write_log(f)
1
Javascript
Javascript
add reactutils and array polyfills
328274bbba44aa6d75dfa21242ac9f0609c5948f
<ide><path>npm-react-codemod/transforms/utils/ReactUtils.js <add>/*eslint-disable no-comma-dangle*/ <add> <add>'use strict'; <add> <add>module.exports = function(j) { <add> const REACT_CREATE_CLASS_MEMBER_EXPRESSION = { <add> type: 'MemberExpression', <add> object: { <add> name: 'React', <add> }, <add> property: { <add> name: 'createClass', <add> }, <add> }; <add> <add> // --------------------------------------------------------------------------- <add> // Checks if the file requires a certain module <add> const hasModule = (path, module) => <add> path <add> .findVariableDeclarators() <add> .filter(j.filters.VariableDeclarator.requiresModule(module)) <add> .size() === 1; <add> <add> const hasReact = path => ( <add> hasModule(path, 'React') || <add> hasModule(path, 'react') || <add> hasModule(path, 'react/addons') <add> ); <add> <add> // --------------------------------------------------------------------------- <add> // Finds all variable declarations that call React.createClass <add> const findReactCreateClassCallExpression = path => <add> j(path).find(j.CallExpression, { <add> callee: REACT_CREATE_CLASS_MEMBER_EXPRESSION, <add> }); <add> <add> const findReactCreateClass = path => <add> path <add> .findVariableDeclarators() <add> .filter(path => findReactCreateClassCallExpression(path).size() > 0); <add> <add> const findReactCreateClassModuleExports = path => <add> path <add> .find(j.AssignmentExpression, { <add> left: { <add> type: 'MemberExpression', <add> object: { <add> type: 'Identifier', <add> name: 'module', <add> }, <add> property: { <add> type: 'Identifier', <add> name: 'exports', <add> }, <add> }, <add> right: { <add> type: 'CallExpression', <add> callee: REACT_CREATE_CLASS_MEMBER_EXPRESSION, <add> }, <add> }); <add> <add> // --------------------------------------------------------------------------- <add> // Finds all classes that extend React.Component <add> const findReactES6ClassDeclaration = path => <add> path <add> .find(j.ClassDeclaration, { <add> superClass: { <add> type: 'MemberExpression', <add> object: { <add> type: 'Identifier', <add> name: 'React', <add> }, <add> property: { <add> type: 'Identifier', <add> name: 'Component', <add> }, <add> }, <add> }); <add> <add> // --------------------------------------------------------------------------- <add> // Checks if the React class has mixins <add> const isMixinProperty = property => { <add> const key = property.key; <add> const value = property.value; <add> return ( <add> key.name === 'mixins' && <add> value.type === 'ArrayExpression' && <add> Array.isArray(value.elements) && <add> value.elements.length <add> ); <add> }; <add> <add> const hasMixins = classPath => { <add> const spec = getReactCreateClassSpec(classPath); <add> return spec && spec.properties.some(isMixinProperty); <add> }; <add> <add> // --------------------------------------------------------------------------- <add> // Others <add> const getReactCreateClassSpec = classPath => { <add> const spec = (classPath.value.init || classPath.value.right).arguments[0]; <add> if (spec.type === 'ObjectExpression' && Array.isArray(spec.properties)) { <add> return spec; <add> } <add> }; <add> <add> const createCreateReactClassCallExpression = properties => <add> j.callExpression( <add> j.memberExpression( <add> j.identifier('React'), <add> j.identifier('createClass'), <add> false <add> ), <add> [j.objectExpression(properties)] <add> ); <add> <add> const getComponentName = <add> classPath => classPath.node.id && classPath.node.id.name; <add> <add> return { <add> createCreateReactClassCallExpression, <add> findReactES6ClassDeclaration, <add> findReactCreateClass, <add> findReactCreateClassCallExpression, <add> findReactCreateClassModuleExports, <add> getComponentName, <add> getReactCreateClassSpec, <add> hasMixins, <add> hasModule, <add> hasReact, <add> isMixinProperty, <add> }; <add>}; <ide><path>npm-react-codemod/transforms/utils/array-polyfills.js <add>/*eslint-disable no-extend-native*/ <add> <add>'use strict'; <add> <add>function findIndex(predicate, context) { <add> if (this == null) { <add> throw new TypeError( <add> 'Array.prototype.findIndex called on null or undefined' <add> ); <add> } <add> if (typeof predicate !== 'function') { <add> throw new TypeError('predicate must be a function'); <add> } <add> var list = Object(this); <add> var length = list.length >>> 0; <add> for (var i = 0; i < length; i++) { <add> if (predicate.call(context, list[i], i, list)) { <add> return i; <add> } <add> } <add> return -1; <add>} <add> <add>if (!Array.prototype.findIndex) { <add> Array.prototype.findIndex = findIndex; <add>} <add> <add>if (!Array.prototype.find) { <add> Array.prototype.find = function(predicate, context) { <add> if (this == null) { <add> throw new TypeError('Array.prototype.find called on null or undefined'); <add> } <add> var index = findIndex.call(this, predicate, context); <add> return index === -1 ? undefined : this[index]; <add> }; <add>}
2
PHP
PHP
improve collection extensibility
39bcf2b439aa2966d4d5be1f53447a2347f7f4c9
<ide><path>src/Illuminate/Support/Collection.php <ide> public function __toString() <ide> * @param \Illuminate\Support\Collection|\Illuminate\Support\Contracts\ArrayableInterface|array $items <ide> * @return array <ide> */ <del> private function getArrayableItems($items) <add> protected function getArrayableItems($items) <ide> { <ide> if ($items instanceof Collection) <ide> {
1
Javascript
Javascript
add tests for amp style tags
ee18967dfcf9f65a4b2c05620c253deb92b4f360
<ide><path>test/integration/amphtml/components/Bar.js <add>export default function Bar () { <add> return ( <add> <div> <add> <span>Bar!</span> <add> <style jsx>{` <add> span { <add> color: blue; <add> } <add> `}</style> <add> </div> <add> ) <add>} <ide><path>test/integration/amphtml/components/Foo.js <add>export default function Foo () { <add> return ( <add> <div> <add> <div>Foo!</div> <add> <style jsx>{` <add> div { <add> color: red; <add> } <add> `}</style> <add> </div> <add> ) <add>} <ide><path>test/integration/amphtml/pages/styled.js <add>import Foo from '../components/Foo' <add>import Bar from '../components/Bar' <add> <add>export default () => ( <add> <div> <add> <Foo /> <add> <Bar /> <add> <style jsx global>{` <add> body { <add> background-color: green; <add> } <add> `}</style> <add> </div> <add>) <ide><path>test/integration/amphtml/test/index.test.js <ide> describe('AMP Usage', () => { <ide> ).toBe('/use-amp-hook') <ide> }) <ide> }) <add> <add> describe('combined styles', () => { <add> it('should combine style tags', async () => { <add> const html = await renderViaHTTP(appPort, '/styled?amp=1') <add> const $ = cheerio.load(html) <add> expect( <add> $('style[amp-custom]') <add> .first() <add> .text() <add> ).toMatch( <add> /div.jsx-\d+{color:red;}span.jsx-\d+{color:blue;}body{background-color:green;}/ <add> ) <add> }) <add> }) <ide> })
4
Text
Text
fix wrong command in changelog
1fe0270e728dd587c724c5f0de211ab739918e4b
<ide><path>CHANGELOG.md <ide> To manually remove all plugins and resolve this problem, take the following step <ide> * Remove `--name` from `docker volume create` [#23830](https://github.com/docker/docker/pull/23830) <ide> + Add `docker stack ls` [#23886](https://github.com/docker/docker/pull/23886) <ide> + Add a new `is-task` ps filter [#24411](https://github.com/docker/docker/pull/24411) <del>+ Add `--env-file` flag to `docker create service` [#24844](https://github.com/docker/docker/pull/24844) <add>+ Add `--env-file` flag to `docker service create` [#24844](https://github.com/docker/docker/pull/24844) <ide> + Add `--format` on `docker stats` [#24987](https://github.com/docker/docker/pull/24987) <ide> + Make `docker node ps` default to `self` in swarm node [#25214](https://github.com/docker/docker/pull/25214) <ide> + Add `--group` in `docker service create` [#25317](https://github.com/docker/docker/pull/25317)
1
Javascript
Javascript
add macos read and write find pasteboard methods
7db65ca8997906749207b91b723b3996583e77f1
<ide><path>src/clipboard.js <ide> module.exports = class Clipboard { <ide> return clipboard.readText(); <ide> } <ide> <add> // Public: Write the given text to the macOS find pasteboard <add> writeFindText(text) { <add> clipboard.writeFindText(text); <add> } <add> <add> // Public: Read the text from the macOS find pasteboard. <add> // <add> // Returns a {String}. <add> readFindText() { <add> return clipboard.readFindText(); <add> } <add> <ide> // Public: Read the text from the clipboard and return both the text and the <ide> // associated metadata. <ide> //
1
Python
Python
update unittests for allclose, isclose
e2812eddd839ad45f252087ed23a01029e9ecc61
<ide><path>numpy/core/tests/test_numeric.py <ide> def test_min_int(self): <ide> assert_(allclose(a, a)) <ide> <ide> <add> def test_equalnan(self): <add> x = np.array([1.0, np.nan]) <add> assert_(allclose(x, x, equal_nan=True)) <add> <add> <ide> class TestIsclose(object): <ide> rtol = 1e-5 <ide> atol = 1e-8 <ide> def test_equal_nan(self): <ide> assert_array_equal(isclose(arr, arr, equal_nan=True), [True, True]) <ide> <ide> def test_masked_arrays(self): <add> # Make sure to test the output type when arguments are interchanged. <add> <ide> x = np.ma.masked_where([True, True, False], np.arange(3)) <ide> assert_(type(x) is type(isclose(2, x))) <add> assert_(type(x) is type(isclose(x, 2))) <ide> <ide> x = np.ma.masked_where([True, True, False], [nan, inf, nan]) <ide> assert_(type(x) is type(isclose(inf, x))) <add> assert_(type(x) is type(isclose(x, inf))) <ide> <ide> x = np.ma.masked_where([True, True, False], [nan, nan, nan]) <ide> y = isclose(nan, x, equal_nan=True) <ide> assert_(type(x) is type(y)) <ide> # Ensure that the mask isn't modified... <ide> assert_array_equal([True, True, False], y.mask) <add> y = isclose(x, nan, equal_nan=True) <add> assert_(type(x) is type(y)) <add> # Ensure that the mask isn't modified... <add> assert_array_equal([True, True, False], y.mask) <ide> <ide> x = np.ma.masked_where([True, True, False], [nan, nan, nan]) <ide> y = isclose(x, x, equal_nan=True)
1
Javascript
Javascript
use ternary operator instead of if-else
efb8211bcf06ef12f45fa54e5654ab3beb8d8ca0
<ide><path>lib/RuntimeTemplate.js <ide> class RuntimeTemplate { <ide> : Template.toNormalComment(propertyAccess(exportName)) + " "; <ide> const access = `${importVar}${comment}${propertyAccess(used)}`; <ide> if (isCall && callContext === false) { <del> if (asiSafe) { <del> return `(0,${access})`; <del> } else { <del> return asiSafe === false ? `;(0,${access})` : `Object(${access})`; <del> } <add> return asiSafe <add> ? `(0,${access})` <add> : asiSafe === false <add> ? `;(0,${access})` <add> : `Object(${access})`; <ide> } <ide> return access; <ide> } else {
1
Text
Text
alphabetize auth docs providers.
4f5b0621c122107e808a7270bd89d3fa0d4a7290
<ide><path>docs/authentication.md <ide> To see examples with other authentication providers, check out the [examples fol <ide> <details open> <ide> <summary><b>Examples</b></summary> <ide> <ul> <del> <li><a href="https://github.com/vercel/next.js/tree/canary/examples/with-firebase-authentication">with-firebase-authentication</a></li> <del> <li><a href="https://github.com/vercel/examples/tree/main/solutions/auth-with-ory">auth-with-ory</a></li> <del> <li><a href="https://github.com/vercel/next.js/tree/canary/examples/with-magic">with-magic</a></li> <del> <li><a href="https://github.com/vercel/next.js/tree/canary/examples/auth0">auth0</a></li> <del> <li><a href="https://github.com/vercel/next.js/tree/canary/examples/with-supabase-auth-realtime-db">with-supabase-auth-realtime-db</a></li> <del> <li><a href="https://github.com/vercel/next.js/tree/canary/examples/with-userbase">with-userbase</a></li> <del> <li><a href="https://github.com/vercel/next.js/tree/canary/examples/with-supertokens">with-supertokens</a></li> <del> <li><a href="https://github.com/vercel/next.js/tree/canary/examples/with-nhost-auth-realtime-graphql">with-nhost-auth-realtime-graphql</a></li> <del> <li><a href="https://github.com/vercel/next.js/tree/canary/examples/with-clerk">with-clerk</a></li> <add> <li><a href="https://github.com/vercel/next.js/tree/canary/examples/auth0">Auth0</a></li> <add> <li><a href="https://github.com/vercel/next.js/tree/canary/examples/with-clerk">Clerk</a></li> <add> <li><a href="https://github.com/vercel/next.js/tree/canary/examples/with-firebase-authentication">Firebase</a></li> <add> <li><a href="https://github.com/vercel/next.js/tree/canary/examples/with-magic">Magic</a></li> <add> <li><a href="https://github.com/vercel/next.js/tree/canary/examples/with-nhost-auth-realtime-graphql">Nhost</a></li> <add> <li><a href="https://github.com/vercel/examples/tree/main/solutions/auth-with-ory">Ory</a></li> <add> <li><a href="https://github.com/vercel/next.js/tree/canary/examples/with-supabase-auth-realtime-db">Supabase</a></li> <add> <li><a href="https://github.com/vercel/next.js/tree/canary/examples/with-supertokens">Supertokens</a></li> <add> <li><a href="https://github.com/vercel/next.js/tree/canary/examples/with-userbase">Userbase</a></li> <ide> </ul> <ide> </details> <ide>
1