content_type
stringclasses
8 values
main_lang
stringclasses
7 values
message
stringlengths
1
50
sha
stringlengths
40
40
patch
stringlengths
52
962k
file_count
int64
1
300
Ruby
Ruby
add initial support for embed api
2abb2e617af8e3353d4411a8bd51d03256e0274a
<ide><path>activemodel/lib/active_model/serializer.rb <ide> def serialize(collection, scope) <ide> <ide> def serialize_ids(collection, scope) <ide> # use named scopes if they are present <del> return collection.ids if collection.respond_to?(:ids) <add> #return collection.ids if collection.respond_to?(:ids) <ide> <ide> collection.map do |item| <ide> item.read_attribute_for_serialization(:id) <ide> def serialize_ids(object, scope) <ide> self._associations = [] <ide> <ide> class_attribute :_root <add> class_attribute :_embed <add> self._embed = :objects <add> class_attribute :_root_embed <ide> <ide> class << self <ide> def attributes(*attrs) <ide> def has_one(*attrs) <ide> associate(Associations::HasOne, attrs) <ide> end <ide> <add> def embed(type, options={}) <add> self._embed = type <add> self._root_embed = true if options[:include] <add> end <add> <ide> def root(name) <ide> self._root = name <ide> end <ide> def initialize(object, scope) <ide> <ide> def as_json(*) <ide> if _root <del> { _root => serializable_hash } <add> hash = { _root => serializable_hash } <add> hash.merge!(associations) if _root_embed <add> hash <ide> else <ide> serializable_hash <ide> end <ide> end <ide> <ide> def serializable_hash <del> attributes.merge(associations) <add> if _embed == :ids <add> attributes.merge(association_ids) <add> elsif _embed == :objects <add> attributes.merge(associations) <add> else <add> attributes <add> end <ide> end <ide> <ide> def associations <ide><path>activemodel/test/cases/serializer_test.rb <ide> def post_serializer(type) <ide> attributes :title, :body <ide> has_many :comments, :serializer => CommentSerializer <ide> <del> define_method :serializable_hash do <del> post_hash = attributes <del> post_hash.merge!(send(type)) <del> post_hash <add> if type != :super <add> define_method :serializable_hash do <add> post_hash = attributes <add> post_hash.merge!(send(type)) <add> post_hash <add> end <ide> end <ide> end <ide> end <ide> def test_false_root <ide> serializer = Class.new(serializer) <ide> assert_equal({ :author => nil }, serializer.new(blog, user).as_json) <ide> end <add> <add> def test_embed_ids <add> serializer = post_serializer(:super) <add> <add> serializer.class_eval do <add> root :post <add> embed :ids <add> end <add> <add> post = Post.new(:title => "New Post", :body => "Body of new post", :email => "tenderlove@tenderlove.com") <add> comments = [Comment.new(:title => "Comment1", :id => 1), Comment.new(:title => "Comment2", :id => 2)] <add> post.comments = comments <add> <add> serializer = serializer.new(post, nil) <add> <add> assert_equal({ <add> :post => { <add> :title => "New Post", <add> :body => "Body of new post", <add> :comments => [1, 2] <add> } <add> }, serializer.as_json) <add> end <add> <add> def test_embed_ids_include_true <add> serializer = post_serializer(:super) <add> <add> serializer.class_eval do <add> root :post <add> embed :ids, :include => true <add> end <add> <add> post = Post.new(:title => "New Post", :body => "Body of new post", :email => "tenderlove@tenderlove.com") <add> comments = [Comment.new(:title => "Comment1", :id => 1), Comment.new(:title => "Comment2", :id => 2)] <add> post.comments = comments <add> <add> serializer = serializer.new(post, nil) <add> <add> assert_equal({ <add> :post => { <add> :title => "New Post", <add> :body => "Body of new post", <add> :comments => [1, 2] <add> }, <add> :comments => [ <add> { :title => "Comment1" }, <add> { :title => "Comment2" } <add> ] <add> }, serializer.as_json) <add> end <add> <add> def test_embed_objects <add> serializer = post_serializer(:super) <add> <add> serializer.class_eval do <add> root :post <add> embed :objects <add> end <add> <add> post = Post.new(:title => "New Post", :body => "Body of new post", :email => "tenderlove@tenderlove.com") <add> comments = [Comment.new(:title => "Comment1", :id => 1), Comment.new(:title => "Comment2", :id => 2)] <add> post.comments = comments <add> <add> serializer = serializer.new(post, nil) <add> <add> assert_equal({ <add> :post => { <add> :title => "New Post", <add> :body => "Body of new post", <add> :comments => [ <add> { :title => "Comment1" }, <add> { :title => "Comment2" } <add> ] <add> } <add> }, serializer.as_json) <add> end <ide> end
2
Ruby
Ruby
use openstruct to capture the mode
a02d5f33b42502503dafb28b3796693b1a57ebab
<ide><path>Library/Homebrew/cmd/deps.rb <ide> require 'formula' <add>require 'ostruct' <ide> <ide> module Homebrew extend self <ide> def deps <del> if ARGV.include? '--installed' <add> mode = OpenStruct.new( <add> :installed? => ARGV.include?('--installed'), <add> :tree? => ARGV.include?('--tree'), <add> :all? => ARGV.include?('--all'), <add> :topo_order? => ARGV.include?('-n') <add> ) <add> <add> if mode.installed? <ide> puts_deps Formula.installed <del> elsif ARGV.include? '--all' <add> elsif mode.all? <ide> puts_deps Formula <del> elsif ARGV.include? '--tree' <add> elsif mode.tree? <ide> raise FormulaUnspecifiedError if ARGV.named.empty? <ide> puts_deps_tree ARGV.formulae <ide> else <ide> raise FormulaUnspecifiedError if ARGV.named.empty? <ide> all_deps = deps_for_formulae ARGV.formulae <del> all_deps.sort! unless ARGV.include? "-n" <add> all_deps.sort! unless mode.topo_order? <ide> puts all_deps <ide> end <ide> end
1
Python
Python
add keras version in model save files
05abe814acd329d426645ecb4ca8c1e39defdac0
<ide><path>keras/models.py <ide> def get_json_type(obj): <ide> raise TypeError('Not JSON Serializable:', obj) <ide> <ide> import h5py <add> from keras import __version__ as keras_version <add> <ide> # if file exists and should not be overwritten <ide> if not overwrite and os.path.isfile(filepath): <ide> proceed = ask_to_proceed_with_overwrite(filepath) <ide> if not proceed: <ide> return <ide> <ide> f = h5py.File(filepath, 'w') <del> <add> f.attrs['keras_version'] = str(keras_version).encode('utf8') <ide> f.attrs['model_config'] = json.dumps({ <ide> 'class_name': model.__class__.__name__, <ide> 'config': model.get_config()
1
Javascript
Javascript
add coverage for repl .clear+useglobal
338d09d25b380366b0263ac4d90bcc2b8a1d4ac8
<ide><path>lib/repl.js <ide> REPLServer.prototype.createContext = function() { <ide> <ide> Object.defineProperty(context, '_', { <ide> configurable: true, <del> get: () => { <del> return this.last; <del> }, <add> get: () => this.last, <ide> set: (value) => { <ide> this.last = value; <ide> if (!this.underscoreAssigned) { <ide> function defineDefaultCommands(repl) { <ide> help: 'Print this help message', <ide> action: function() { <ide> const names = Object.keys(this.commands).sort(); <del> const longestNameLength = names.reduce((max, name) => { <del> return Math.max(max, name.length); <del> }, 0); <add> const longestNameLength = names.reduce( <add> (max, name) => Math.max(max, name.length), <add> 0 <add> ); <ide> names.forEach((name) => { <ide> const cmd = this.commands[name]; <ide> const spaces = ' '.repeat(longestNameLength - name.length + 3); <ide><path>test/parallel/test-repl-underscore.js <ide> const stream = require('stream'); <ide> testSloppyMode(); <ide> testStrictMode(); <ide> testResetContext(); <add>testResetContextGlobal(); <ide> testMagicMode(); <ide> <ide> function testSloppyMode() { <ide> function testResetContext() { <ide> ]); <ide> } <ide> <del>function initRepl(mode) { <add>function testResetContextGlobal() { <add> const r = initRepl(repl.REPL_MODE_STRICT, true); <add> <add> r.write(`_ = 10; // explicitly set to 10 <add> _; // 10 from user input <add> .clear // No output because useGlobal is true <add> _; // remains 10 <add> `); <add> <add> assertOutput(r.output, [ <add> 'Expression assignment to _ now disabled.', <add> '10', <add> '10', <add> '10', <add> ]); <add> <add> // delete globals leaked by REPL when `useGlobal` is `true` <add> delete global.module; <add> delete global.require; <add>} <add> <add>function initRepl(mode, useGlobal) { <ide> const inputStream = new stream.PassThrough(); <ide> const outputStream = new stream.PassThrough(); <ide> outputStream.accum = ''; <ide> function initRepl(mode) { <ide> useColors: false, <ide> terminal: false, <ide> prompt: '', <del> replMode: mode <add> replMode: mode, <add> useGlobal: useGlobal <ide> }); <ide> } <ide>
2
Python
Python
update ud bin scripts
d844030fd880165f08bf88f4fd386ef878e63360
<ide><path>bin/ud/run_eval.py <ide> from pathlib import Path <ide> import xml.etree.ElementTree as ET <ide> <del>from spacy.cli.ud import conll17_ud_eval <del>from spacy.cli.ud.ud_train import write_conllu <add>import conll17_ud_eval <add>from ud_train import write_conllu <ide> from spacy.lang.lex_attrs import word_shape <ide> from spacy.util import get_lang_class <ide> <ide> # All languages in spaCy - in UD format (note that Norwegian is 'no' instead of 'nb') <del>ALL_LANGUAGES = "ar, ca, da, de, el, en, es, fa, fi, fr, ga, he, hi, hr, hu, id, " \ <del> "it, ja, no, nl, pl, pt, ro, ru, sv, tr, ur, vi, zh" <add>ALL_LANGUAGES = ("af, ar, bg, bn, ca, cs, da, de, el, en, es, et, fa, fi, fr," <add> "ga, he, hi, hr, hu, id, is, it, ja, kn, ko, lt, lv, mr, no," <add> "nl, pl, pt, ro, ru, si, sk, sl, sq, sr, sv, ta, te, th, tl," <add> "tr, tt, uk, ur, vi, zh") <ide> <ide> # Non-parsing tasks that will be evaluated (works for default models) <ide> EVAL_NO_PARSE = ['Tokens', 'Words', 'Lemmas', 'Sentences', 'Feats'] <ide> def _contains_blinded_text(stats_xml): <ide> tree = ET.parse(stats_xml) <ide> root = tree.getroot() <ide> total_tokens = int(root.find('size/total/tokens').text) <del> unique_lemmas = int(root.find('lemmas').get('unique')) <add> unique_forms = int(root.find('forms').get('unique')) <ide> <ide> # assume the corpus is largely blinded when there are less than 1% unique tokens <del> return (unique_lemmas / total_tokens) < 0.01 <add> return (unique_forms / total_tokens) < 0.01 <ide> <ide> <ide> def fetch_all_treebanks(ud_dir, languages, corpus, best_per_language): <ide> def main(out_path, ud_dir, check_parse=False, langs=ALL_LANGUAGES, exclude_train <ide> if not exclude_trained_models: <ide> if 'de' in models: <ide> models['de'].append(load_model('de_core_news_sm')) <del> if 'es' in models: <del> models['es'].append(load_model('es_core_news_sm')) <del> models['es'].append(load_model('es_core_news_md')) <del> if 'pt' in models: <del> models['pt'].append(load_model('pt_core_news_sm')) <del> if 'it' in models: <del> models['it'].append(load_model('it_core_news_sm')) <del> if 'nl' in models: <del> models['nl'].append(load_model('nl_core_news_sm')) <add> models['de'].append(load_model('de_core_news_md')) <add> if 'el' in models: <add> models['el'].append(load_model('el_core_news_sm')) <add> models['el'].append(load_model('el_core_news_md')) <ide> if 'en' in models: <ide> models['en'].append(load_model('en_core_web_sm')) <ide> models['en'].append(load_model('en_core_web_md')) <ide> models['en'].append(load_model('en_core_web_lg')) <add> if 'es' in models: <add> models['es'].append(load_model('es_core_news_sm')) <add> models['es'].append(load_model('es_core_news_md')) <ide> if 'fr' in models: <ide> models['fr'].append(load_model('fr_core_news_sm')) <ide> models['fr'].append(load_model('fr_core_news_md')) <add> if 'it' in models: <add> models['it'].append(load_model('it_core_news_sm')) <add> if 'nl' in models: <add> models['nl'].append(load_model('nl_core_news_sm')) <add> if 'pt' in models: <add> models['pt'].append(load_model('pt_core_news_sm')) <ide> <ide> with out_path.open(mode='w', encoding='utf-8') as out_file: <ide> run_all_evals(models, treebanks, out_file, check_parse, print_freq_tasks) <ide><path>bin/ud/ud_run_test.py <ide> def write_conllu(docs, file_): <ide> merger = Matcher(docs[0].vocab) <ide> merger.add("SUBTOK", None, [{"DEP": "subtok", "op": "+"}]) <ide> for i, doc in enumerate(docs): <del> matches = merger(doc) <add> matches = [] <add> if doc.is_parsed: <add> matches = merger(doc) <ide> spans = [doc[start : end + 1] for _, start, end in matches] <ide> with doc.retokenize() as retokenizer: <ide> for span in spans: <ide> retokenizer.merge(span) <del> # TODO: This shouldn't be necessary? Should be handled in merge <del> for word in doc: <del> if word.i == word.head.i: <del> word.dep_ = "ROOT" <ide> file_.write("# newdoc id = {i}\n".format(i=i)) <ide> for j, sent in enumerate(doc.sents): <ide> file_.write("# sent_id = {i}.{j}\n".format(i=i, j=j)) <ide><path>bin/ud/ud_train.py <ide> import random <ide> import numpy.random <ide> <del>from . import conll17_ud_eval <add>import conll17_ud_eval <ide> <ide> from spacy import lang <ide> from spacy.lang import zh <ide> def write_conllu(docs, file_): <ide> merger = Matcher(docs[0].vocab) <ide> merger.add("SUBTOK", None, [{"DEP": "subtok", "op": "+"}]) <ide> for i, doc in enumerate(docs): <del> matches = merger(doc) <add> matches = [] <add> if doc.is_parsed: <add> matches = merger(doc) <ide> spans = [doc[start : end + 1] for _, start, end in matches] <ide> seen_tokens = set() <ide> with doc.retokenize() as retokenizer: <ide> def get_token_conllu(token, i): <ide> lines.append("\t".join(fields)) <ide> return "\n".join(lines) <ide> <del>Token.set_extension("get_conllu_lines", method=get_token_conllu) <del>Token.set_extension("begins_fused", default=False) <del>Token.set_extension("inside_fused", default=False) <add> <add>Token.set_extension("get_conllu_lines", method=get_token_conllu, force=True) <add>Token.set_extension("begins_fused", default=False, force=True) <add>Token.set_extension("inside_fused", default=False, force=True) <ide> <ide> <ide> ##################
3
Ruby
Ruby
use string arg to io.popen
ec2a3f979ee81e5ed5d5368a6addbe9b31eb3ece
<ide><path>Library/Homebrew/utils.rb <ide> def api_credentials <ide> if ENV["HOMEBREW_GITHUB_API_TOKEN"] <ide> ENV["HOMEBREW_GITHUB_API_TOKEN"] <ide> else <del> github_credentials = IO.popen(["git", "credential-osxkeychain", "get"], "w+") do |io| <add> github_credentials = IO.popen("git credential-osxkeychain get", "w+") do |io| <ide> io.puts "protocol=https\nhost=github.com" <ide> io.close_write <ide> io.read
1
Text
Text
remove un-needed categories
fd0c00def8dbb57efdceb91b87f95988d0d5af85
<ide><path>threejs/lessons/ru/threejs-cameras.md <ide> Title: Three.js - Камера <ide> Description: Как использовать камеру в Three.js <del>Category: fundamentals <ide> TOC: Камера <ide> <ide> Эта статья является частью серии статей о three.js. <ide><path>threejs/lessons/ru/threejs-fundamentals.md <ide> Title: Основы Three.js <ide> Description: Твой первый урок по Three.js начинаетсся с основ <del>Category: basics <ide> TOC: Базовые принципы <ide> <ide> Это первая статья в серии статей о three.js. <ide><path>threejs/lessons/ru/threejs-lights.md <ide> Title: Three.js - Освещение <ide> Description: Настройка освещения <del>Category: fundamentals <ide> TOC: Освещение <ide> <ide> Эта статья является частью серии статей о three.js. <ide><path>threejs/lessons/ru/threejs-material-table.md <ide> Title: Таблица характеристик материалов <ide> Description: Таблица, показывающая, какие функции поддерживают каждый из материалов <del>Category: reference <ide> TOC: Таблица материалов <ide> <ide> Наиболее распространенными материалами в three.js являются материалы <ide><path>threejs/lessons/ru/threejs-materials.md <ide> Title: Материалы Three.js <ide> Description: Материалы в Three.js <del>Category: fundamentals <ide> TOC: Материалы <ide> <ide> Эта статья является частью серии статей о three.js. <ide><path>threejs/lessons/ru/threejs-multiple-scenes.md <ide> Title: Three.js - Несколько холстов и Несколько сцен <ide> Description: Kак рисовать на всей web-странице с THREE.js <del>Category: solutions <ide> TOC: Несколько холстов, несколько сцен <ide> <ide> Допустим, вы хотите создать сайт электронной коммерции или сделать <ide><path>threejs/lessons/ru/threejs-primitives.md <ide> Title: Примитивы Three.js <ide> Description: Обзор примитивов three.js. <del>Category: fundamentals <ide> TOC: Примитивы <ide> <ide> Эта статья является частью серии статей о three.js. <ide><path>threejs/lessons/ru/threejs-responsive.md <ide> Title: Three.js Oтзывчивый Дизайн <ide> Description: Как приспособить three.js под дисплеи разного размера. <del>Category: basics <ide> TOC: Адаптивный дизайн <ide> <ide> Это вторая статья в серии статей о three.js. <ide><path>threejs/lessons/ru/threejs-scenegraph.md <ide> Title: Граф сцены Three.js <ide> Description: Что такое граф сцены? <del>Category: fundamentals <ide> TOC: Граф сцены <ide> <ide> Эта статья является частью серии статей о three.js. <ide><path>threejs/lessons/ru/threejs-setup.md <ide> Title: Настройка окружения Three.js <ide> Description: Как настроить разрабочее окружение для Three.js <del>Category: basics <ide> TOC: Настройка <ide> <ide> Эта статья является частью серии статей о three.js. <ide><path>threejs/lessons/ru/threejs-textures.md <ide> Title: Three.js Текстуры <ide> Description: Использование текстур в three.js <del>Category: fundamentals <ide> TOC: Текстуры <ide> <ide> Эта статья является частью серии статей о three.js. <ide><path>threejs/lessons/threejs-align-html-elements-to-3d.md <ide> Title: Three.js Aligning HTML Elements to 3D <ide> Description: How to line up an HTML Element to match a point in 3D space <del>Category: solutions <ide> TOC: Aligning HTML Elements to 3D <ide> <ide> This article is part of a series of articles about three.js. The first article <ide><path>threejs/lessons/threejs-backgrounds.md <ide> Title: Three.js Backgrounds and Skyboxes <ide> Description: How to add a background in THREE.js <del>Category: solutions <ide> TOC: Add a Background or Skybox <ide> <ide> Most of the articles here use a solid color for a background. <ide><path>threejs/lessons/threejs-billboards.md <ide> Title: Three.js Billboards <ide> Description: How to make things always face the camera. <del>Category: solutions <ide> TOC: Billboards and Facades <ide> <ide> In [a previous article](threejs-canvas-textures.html) we used a `CanvasTexture` <ide><path>threejs/lessons/threejs-cameras.md <ide> Title: Three.js Cameras <ide> Description: How to use Cameras in Three.js <del>Category: fundamentals <ide> TOC: Cameras <ide> <ide> This article is one in a series of articles about three.js. <ide><path>threejs/lessons/threejs-canvas-textures.md <ide> Title: Three.js Canvas Textures <ide> Description: How to use a canvas as a texture in Three.js <del>Category: solutions <ide> TOC: Using A Canvas for Dynamic Textures <ide> <ide> This article continues from [the article on textures](threejs-textures.html). <ide><path>threejs/lessons/threejs-cleanup.md <ide> Title: Three.js Cleanup <ide> Description: How to use free memory used by Three.js <del>Category: solutions <ide> TOC: Freeing Resources <ide> <ide> Three.js apps often use lots of memory. A 3D model <ide><path>threejs/lessons/threejs-custom-buffergeometry.md <ide> Title: Three.js Custom BufferGeometry <ide> Description: How to make your own BufferGeometry. <del>Category: fundamentals <ide> TOC: Custom BufferGeometry <ide> <ide> A [previous article](threejs-custom-geometry.html) covered <ide><path>threejs/lessons/threejs-custom-geometry.md <ide> Title: Three.js Custom Geometry <ide> Description: How to make your own geometry. <del>Category: fundamentals <ide> TOC: Custom Geometry <ide> <ide> A [previous article](threejs-primitives.html) gave a tour of <ide><path>threejs/lessons/threejs-debugging-glsl.md <ide> Title: Debugging Three.js - GLSL <ide> Description: How to debug GLSL Shaders <del>Category: tips <ide> TOC: Debugging GLSL <ide> <ide> This site so far does not teach GLSL just like it does not teach JavaScript. <ide><path>threejs/lessons/threejs-debugging-javascript.md <ide> Title: Three.js Debugging JavaScript <ide> Description: How to debug JavaScript with THREE.js <del>Category: tips <ide> TOC: Debugging JavaScript <ide> <ide> Most of this article is not directly about THREE.js but is <ide><path>threejs/lessons/threejs-fog.md <ide> Title: Three.js Fog <ide> Description: Fog in Three.js <del>Category: fundamentals <ide> TOC: Fog <ide> <ide> This article is part of a series of articles about three.js. The <ide><path>threejs/lessons/threejs-fundamentals.md <ide> Title: Three.js Fundamentals <ide> Description: Your first Three.js lesson starting with the fundamentals <del>Category: basics <ide> TOC: Fundamentals <ide> <ide> This is the first article in a series of articles about three.js. <ide><path>threejs/lessons/threejs-indexed-textures.md <ide> Title: Three.js Indexed Textures for Picking and Color <ide> Description: Using Indexed Textures for Picking and Color <del>Category: solutions <ide> TOC: Using Indexed Textures for Picking and Color <ide> <ide> This article is a continuation of [an article about aligning html elements to 3d](threejs-align-html-elements-to-3d.html). <ide><path>threejs/lessons/threejs-lights.md <ide> Title: Three.js Lights <ide> Description: Setting up Lights <del>Category: fundamentals <ide> TOC: Lights <ide> <ide> This article is part of a series of articles about three.js. The <ide><path>threejs/lessons/threejs-load-gltf.md <ide> Title: Three.js Loading a .GLTF File <ide> Description: Loading a .GLTF File <del>Category: solutions <ide> TOC: Load a .GLTF file <ide> <ide> In a previous lesson we [loaded an .OBJ file](threejs-load-obj.html). If <ide><path>threejs/lessons/threejs-load-obj.md <ide> Title: Three.js Loading a .OBJ File <ide> Description: Loading a .OBJ File <del>Category: solutions <ide> TOC: Load an .OBJ file <ide> <ide> One of the most common things people want to do with three.js <ide><path>threejs/lessons/threejs-material-table.md <ide> Title: Material Feature Table <ide> Description: A Table showing which matierals have which features <del>Category: reference <ide> TOC: Material Table <ide> <ide> The most common materials in three.js are the Mesh materials. Here <ide><path>threejs/lessons/threejs-materials.md <ide> Title: Three.js Materials <ide> Description: Materials in Three.js <del>Category: fundamentals <ide> TOC: Materials <ide> <ide> This article is part of a series of articles about three.js. The <ide><path>threejs/lessons/threejs-multiple-scenes.md <ide> Title: Three.js Multiple Canvases Multiple Scenes <ide> Description: How to draw stuff all over the page with THREE.js <del>Category: solutions <ide> TOC: Multiple Canvases, Multiple Scenes <ide> <ide> A common question is how to use THREE.js with multiple canvases. <ide><path>threejs/lessons/threejs-offscreencanvas.md <ide> Title: Three.js OffscreenCanvas <ide> Description: How to use three.js in a web worker <del>Category: optimization <ide> TOC: Using OffscreenCanvas in a Web Worker <ide> <ide> [`OffscreenCanvas`](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvas) <ide><path>threejs/lessons/threejs-optimize-lots-of-objects-animated.md <ide> Title: Three.js Optimize Lots of Objects Animated <ide> Description: Animated merged objects with Morphtargets <del>Category: optimization <ide> TOC: Optimizing Lots of Objects Animated <ide> <ide> This article is a continuation of [an article about optimizing lots of objects <ide><path>threejs/lessons/threejs-optimize-lots-of-objects.md <ide> Title: Three.js Optimize Lots of Objects <ide> Description: Optimize by merging Objects <del>Category: optimization <ide> TOC: Optimizing Lots of Objects <ide> <ide> This article is part of a series of articles about three.js. The first article <ide><path>threejs/lessons/threejs-picking.md <ide> Title: Three.js Picking <ide> Description: Selecting Objects with the Mouse in Three.js <del>Category: solutions <ide> TOC: Picking Objects with the mouse <ide> <ide> *Picking* refers to the process of figuring out which object a user clicked on or touched. There are tons of ways to implement picking each with their tradeoffs. Let's go over the 2 most common. <ide><path>threejs/lessons/threejs-post-processing-3dlut.md <ide> Title: Three.js Post Processing 3DLUT <ide> Description: How to implement a 3DLUT Post Process in THREE.js <del>Category: solutions <ide> TOC: Applying a LUT File for effects <ide> <ide> In the last article we went over [post processing](threejs-post-processing.html). <ide><path>threejs/lessons/threejs-post-processing.md <ide> Title: Three.js Post Processing <ide> Description: How to Post Process in THREE.js <del>Category: solutions <ide> TOC: Post Processing <ide> <ide> *Post processing* generally refers to applying some kind of effect or filter to <ide><path>threejs/lessons/threejs-prerequisites.md <ide> Title: Three.js Prerequisites <ide> Description: What you need to know to use this site. <del>Category: basics <ide> TOC: Prerequisites <ide> <ide> These articles are meant to help you learn how to use three.js. <ide><path>threejs/lessons/threejs-primitives.md <ide> Title: Three.js Primitives <ide> Description: A tour of three.js primitives. <del>Category: fundamentals <ide> TOC: Primitives <ide> <ide> This article is one in a series of articles about three.js. <ide><path>threejs/lessons/threejs-rendering-on-demand.md <ide> Title: Three.js Rendering on Demand <ide> Description: How to use less energy. <del>Category: tips <ide> TOC: Rendering On Demand <ide> <ide> The topic might be obvious to many people but just in case ... most Three.js <ide><path>threejs/lessons/threejs-rendertargets.md <ide> Title: Three.js Render Targets <ide> Description: How to render to a texture. <del>Category: fundamentals <ide> TOC: Render Targets <ide> <ide> A render target in three.js is basicaly a texture you can render to. <ide><path>threejs/lessons/threejs-responsive.md <ide> Title: Three.js Responsive Design <ide> Description: How to make your three.js fit different sized displays. <del>Category: basics <ide> TOC: Responsive Design <ide> <ide> This is the second article in a series of articles about three.js. <ide><path>threejs/lessons/threejs-scenegraph.md <ide> Title: Three.js Scene Graph <ide> Description: What's a scene graph? <del>Category: fundamentals <ide> TOC: Scenegraph <ide> <ide> This article is part of a series of articles about three.js. The <ide><path>threejs/lessons/threejs-setup.md <ide> Title: Three.js Setup <ide> Description: How to setup your development environment for three.js <del>Category: basics <ide> TOC: Setup <ide> <ide> This article is one in a series of articles about three.js. <ide><path>threejs/lessons/threejs-shadertoy.md <ide> Title: Three.js and Shadertoy <ide> Description: How to use Shadertoy shaders in THREE.js <del>Category: solutions <ide> TOC: Using Shadertoy shaders <ide> <ide> [Shadertoy](https://shadertoy.com) is a famous website hosting amazing shader experiments. People often ask how they can use those shaders with Three.js. <ide><path>threejs/lessons/threejs-shadows.md <ide> Title: Three.js Shadows <ide> Description: Shadows in Three.js <del>Category: fundamentals <ide> TOC: Shadows <ide> <ide> This article is part of a series of articles about three.js. The <ide><path>threejs/lessons/threejs-textures.md <ide> Title: Three.js Textures <ide> Description: Using textures in three.js <del>Category: fundamentals <ide> TOC: Textures <ide> <ide> This article is one in a series of articles about three.js. <ide><path>threejs/lessons/threejs-tips.md <ide> Title: Three.js Tips <ide> Description: Small issues that might trip you up using three.js <del>Category: tips <ide> TOC: # <ide> <ide> This article is a collection of small issues you might run into <ide><path>threejs/lessons/threejs-transparency.md <ide> Title: Three.js Transparency <ide> Description: How to deal with transparency issues in THREE.js <del>Category: solutions <ide> TOC: How to Draw Transparent Objects <ide> <ide> Transparency in three.js is both easy and hard. <ide><path>threejs/lessons/threejs-voxel-geometry.md <ide> Title: Three.js Voxel(Minecraft Like) Geometry <ide> Description: How to make voxel geometry like Minecraft <del>Category: solutions <ide> TOC: Making Voxel Geometry (Minecraft) <ide> <ide> I've seen this topic come up more than once in various places. <ide><path>threejs/lessons/threejs-webvr-look-to-select.md <ide> Title: Three.js WebVR - Look to Select <ide> Description: How to implement Look to Select. <del>Category: webvr <ide> TOC: WebVR - Look To Select <ide> <ide> **NOTE: The examples on this page require a VR capable <ide><path>threejs/lessons/threejs-webvr-point-to-select.md <ide> Title: Three.js WebVR - 3DOF Point to Select <ide> Description: How to implement 3DOF Point to Select. <del>Category: webvr <ide> TOC: WebVR - Point To Select <ide> <ide> **NOTE: The examples on this page require a VR capable <ide><path>threejs/lessons/threejs-webvr.md <ide> Title: Three.js WebVR <ide> Description: How to use Virtual Reality in Three.js. <del>Category: webvr <ide> TOC: WebVR - Basics <ide> <ide> Making WebVR apps in three.js is pretty simple. You basically just have to tell <ide><path>threejs/lessons/zh_cn/threejs-fundamentals.md <ide> Title: Three.js基础 <ide> Description: 学习Three.js的第一篇文章 <del>Category: basics <ide> TOC: 基础 <ide> <ide> 这是Three.js系列文章的第一篇。 <ide><path>threejs/lessons/zh_cn/threejs-prerequisites.md <ide> Title: Three.js先决条件 <ide> Description: 使用此网站你需要了解的。 <del>Category: basics <ide> TOC: 先决条件 <ide> <ide> 这些文章意在帮助你学习如何使用three.js。 <ide><path>threejs/lessons/zh_cn/threejs-responsive.md <ide> Title: Three.js响应式设计 <ide> Description: 如何让你的three.js适应不同尺寸的显示器。 <del>Category: basics <ide> TOC: 响应式设计 <ide> <ide> 这是three.js系列文章的第二篇。 <ide><path>threejs/lessons/zh_cn/threejs-setup.md <ide> Title: Three.js设置 <ide> Description: 如何为你的three.js设置开发环境 <del>Category: basics <ide> TOC: 设置 <ide> <ide> 这是three.js系列文章的其中之一。
56
Java
Java
fix ofresponseprocessor signature
d17b99fe37a945436254e99d90c45b413ba73323
<ide><path>spring-webflux/src/main/java/org/springframework/web/reactive/function/server/HandlerFilterFunction.java <ide> default HandlerFunction<R> apply(HandlerFunction<T> handler) { <ide> * @return the filter adaptation of the request processor <ide> */ <ide> static <T extends ServerResponse, R extends ServerResponse> HandlerFilterFunction<T, R> ofResponseProcessor( <del> Function<T, R> responseProcessor) { <add> Function<T, Mono<R>> responseProcessor) { <ide> <ide> Assert.notNull(responseProcessor, "'responseProcessor' must not be null"); <del> return (request, next) -> next.handle(request).map(responseProcessor); <add> return (request, next) -> next.handle(request).then(responseProcessor); <ide> } <ide> <ide>
1
Text
Text
fix slight markdown typo in code blocks (#55)
8332400d96bd4defd944c612fe99a8abf7a0d38f
<ide><path>inception/inception/slim/README.md <ide> the code necessary for defining the entire [VGG] <ide> the lengthy and verbose nature of defining just the first three layers (out of <ide> 16) using native tensorflow: <ide> <del>```python {.good} <add>```python{.good} <ide> # VGG16 in TF-Slim. <ide> def vgg16(inputs): <ide> with slim.arg_scope([slim.ops.conv2d, slim.ops.fc], stddev=0.01, weight_decay=0.0005): <ide> def vgg16(inputs): <ide> return net <ide> ``` <ide> <del>```python {.bad} <add>```python{.bad} <ide> # Layers 1-3 (out of 16) of VGG16 in native tensorflow. <ide> def vgg16(inputs): <ide> with tf.name_scope('conv1_1') as scope:
1
Javascript
Javascript
add display name in more cases
f0fdabae7bbeadde9245d00893b194e0310c8d9b
<ide><path>vendor/fbtransform/transforms/reactDisplayName.js <ide> var Syntax = require('esprima-fb').Syntax; <ide> var utils = require('jstransform/src/utils'); <ide> <add>function addDisplayName(displayName, object, state) { <add> if (object && <add> object.type === Syntax.CallExpression && <add> object.callee.type === Syntax.MemberExpression && <add> object.callee.object.type === Syntax.Identifier && <add> object.callee.object.name === 'React' && <add> object.callee.property.type === Syntax.Identifier && <add> object.callee.property.name === 'createClass' && <add> object['arguments'].length === 1 && <add> object['arguments'][0].type === Syntax.ObjectExpression) { <add> // Verify that the displayName property isn't already set <add> var properties = object['arguments'][0].properties; <add> var safe = properties.every(function(property) { <add> var value = property.key.type === Syntax.Identifier ? <add> property.key.name : <add> property.key.value; <add> return value !== 'displayName'; <add> }); <add> <add> if (safe) { <add> utils.catchup(object['arguments'][0].range[0] + 1, state); <add> utils.append("displayName: '" + displayName + "',", state); <add> } <add> } <add>} <add> <ide> /** <ide> * Transforms the following: <ide> * <ide> var utils = require('jstransform/src/utils'); <ide> * displayName: 'MyComponent', <ide> * render: ... <ide> * }); <add> * <add> * Also catches: <add> * <add> * MyComponent = React.createClass(...); <add> * exports.MyComponent = React.createClass(...); <add> * module.exports = {MyComponent: React.createClass(...)}; <ide> */ <ide> function visitReactDisplayName(traverse, object, path, state) { <del> var displayName = object.id.name; <del> utils.catchup(object.init['arguments'][0].range[0] + 1, state); <del> utils.append("displayName: '" + displayName + "',", state); <add> var left, right; <add> <add> if (object.type === Syntax.AssignmentExpression) { <add> left = object.left; <add> right = object.right; <add> } else if (object.type === Syntax.Property) { <add> left = object.key; <add> right = object.value; <add> } else if (object.type === Syntax.VariableDeclarator) { <add> left = object.id; <add> right = object.init; <add> } <add> <add> if (left && left.type === Syntax.MemberExpression) { <add> left = left.property; <add> } <add> if (left && left.type === Syntax.Identifier) { <add> addDisplayName(left.name, right, state); <add> } <ide> } <ide> <ide> /** <ide> * Will only run on @jsx files for now. <ide> */ <ide> visitReactDisplayName.test = function(object, path, state) { <del> if (!!utils.getDocblock(state).jsx && <del> object.type === Syntax.VariableDeclarator && <del> object.id.type === Syntax.Identifier && <del> object.init && <del> object.init.type === Syntax.CallExpression && <del> object.init.callee.type === Syntax.MemberExpression && <del> object.init.callee.object.type === Syntax.Identifier && <del> object.init.callee.object.name === 'React' && <del> object.init.callee.property.type === Syntax.Identifier && <del> object.init.callee.property.name === 'createClass' && <del> object.init['arguments'].length === 1 && <del> object.init['arguments'][0].type === Syntax.ObjectExpression) { <del> <del> // Verify that the displayName property isn't already set <del> var properties = object.init['arguments'][0].properties; <del> return properties.reduce(function (safe, property) { <del> var value = property.key.type === 'Identifier' <del> ? property.key.name <del> : property.key.value; <del> return safe && value !== 'displayName'; <del> }, true); <add> if (utils.getDocblock(state).jsx) { <add> return ( <add> object.type === Syntax.AssignmentExpression || <add> object.type === Syntax.Property || <add> object.type === Syntax.VariableDeclarator <add> ); <add> } else { <add> return false; <ide> } <del> return false; <ide> }; <ide> <ide> exports.visitReactDisplayName = visitReactDisplayName;
1
Go
Go
use lazy unmount to unmount volumes
b9e701b203ff49966aac00e058feb5d46bbb97f0
<ide><path>daemon/container_unix.go <ide> func (container *Container) unmountVolumes(forceSyscall bool) error { <ide> <ide> for _, volumeMount := range volumeMounts { <ide> if forceSyscall { <del> if err := system.Unmount(volumeMount.Destination); err != nil { <del> logrus.Warnf("%s unmountVolumes: Failed to force umount %v", container.ID, err) <add> if err := detachMounted(volumeMount.Destination); err != nil { <add> logrus.Warnf("%s unmountVolumes: Failed to do lazy umount %v", container.ID, err) <ide> } <ide> } <ide>
1
Python
Python
convert encoders tests to pytest style
99d57df990736b882ecafd033bb158a2d2cec0a8
<ide><path>tests/test_encoders.py <ide> from decimal import Decimal <ide> from uuid import uuid4 <ide> <add>import pytest <ide> from django.test import TestCase <ide> <ide> from rest_framework.compat import coreapi <ide> def dst(self, dt): <ide> <ide> current_time = datetime.now().time() <ide> current_time = current_time.replace(tzinfo=UTC()) <del> with self.assertRaises(ValueError): <add> with pytest.raises(ValueError): <ide> self.encoder.default(current_time) <ide> <ide> def test_encode_date(self): <ide> def test_encode_coreapi_raises_error(self): <ide> """ <ide> Tests encoding a coreapi objects raises proper error <ide> """ <del> with self.assertRaises(RuntimeError): <add> with pytest.raises(RuntimeError): <ide> self.encoder.default(coreapi.Document()) <ide> <del> with self.assertRaises(RuntimeError): <add> with pytest.raises(RuntimeError): <ide> self.encoder.default(coreapi.Error())
1
Javascript
Javascript
throw typeerror if callback is missing
9a2654601e58cb738463ea4a195400dd0cdd37ad
<ide><path>lib/zlib.js <ide> for (var ck = 0; ck < ckeys.length; ck++) { <ide> } <ide> <ide> function zlibBuffer(engine, buffer, callback) { <add> if (typeof callback !== 'function') <add> throw new ERR_INVALID_ARG_TYPE('callback', 'function', callback); <ide> // Streams do not support non-Buffer ArrayBufferViews yet. Convert it to a <ide> // Buffer without copying. <ide> if (isArrayBufferView(buffer) && <ide><path>test/parallel/test-zlib-convenience-methods.js <ide> for (const [type, expect] of [ <ide> } <ide> } <ide> } <add> <add>common.expectsError( <add> () => zlib.gzip('abc'), <add> { <add> code: 'ERR_INVALID_ARG_TYPE', <add> type: TypeError, <add> message: 'The "callback" argument must be of type function. ' + <add> 'Received type undefined' <add> } <add>);
2
Go
Go
use check in params so we don't ignore errors
bcad3d5212641237fe97c9ea2668869805e3bce8
<ide><path>integration-cli/check_test.go <ide> func (s *DockerSuite) OnTimeout(c *check.C) { <ide> } <ide> <ide> func (s *DockerSuite) TearDownTest(c *check.C) { <del> unpauseAllContainers() <del> deleteAllContainers() <del> deleteAllImages() <del> deleteAllVolumes() <del> deleteAllNetworks() <del> deleteAllPlugins() <add> unpauseAllContainers(c) <add> deleteAllContainers(c) <add> deleteAllImages(c) <add> deleteAllVolumes(c) <add> deleteAllNetworks(c) <add> if daemonPlatform == "linux" { <add> deleteAllPlugins(c) <add> } <ide> } <ide> <ide> func init() { <ide><path>integration-cli/docker_api_containers_test.go <ide> func (s *DockerSuite) TestGetStoppedContainerStats(c *check.C) { <ide> func (s *DockerSuite) TestContainerAPIPause(c *check.C) { <ide> // Problematic on Windows as Windows does not support pause <ide> testRequires(c, DaemonIsLinux) <del> defer unpauseAllContainers() <add> defer unpauseAllContainers(c) <ide> out, _ := dockerCmd(c, "run", "-d", "busybox", "sleep", "30") <ide> ContainerID := strings.TrimSpace(out) <ide> <ide><path>integration-cli/docker_cli_attach_test.go <ide> func (s *DockerSuite) TestAttachDisconnect(c *check.C) { <ide> <ide> func (s *DockerSuite) TestAttachPausedContainer(c *check.C) { <ide> testRequires(c, IsPausable) <del> defer unpauseAllContainers() <add> defer unpauseAllContainers(c) <ide> runSleepingContainer(c, "-d", "--name=test") <ide> dockerCmd(c, "pause", "test") <ide> <ide><path>integration-cli/docker_cli_commit_test.go <ide> func (s *DockerSuite) TestCommitWithoutPause(c *check.C) { <ide> //test commit a paused container should not unpause it after commit <ide> func (s *DockerSuite) TestCommitPausedContainer(c *check.C) { <ide> testRequires(c, DaemonIsLinux) <del> defer unpauseAllContainers() <add> defer unpauseAllContainers(c) <ide> out, _ := dockerCmd(c, "run", "-i", "-d", "busybox") <ide> <ide> cleanedContainerID := strings.TrimSpace(out) <ide><path>integration-cli/docker_cli_exec_test.go <ide> func (s *DockerSuite) TestExecExitStatus(c *check.C) { <ide> <ide> func (s *DockerSuite) TestExecPausedContainer(c *check.C) { <ide> testRequires(c, IsPausable) <del> defer unpauseAllContainers() <add> defer unpauseAllContainers(c) <ide> <ide> out, _ := runSleepingContainer(c, "-d", "--name", "testing") <ide> ContainerID := strings.TrimSpace(out) <ide> func (s *DockerSuite) TestRunMutableNetworkFiles(c *check.C) { <ide> // Not applicable on Windows to Windows CI. <ide> testRequires(c, SameHostDaemon, DaemonIsLinux) <ide> for _, fn := range []string{"resolv.conf", "hosts"} { <del> deleteAllContainers() <add> deleteAllContainers(c) <ide> <ide> content, err := runCommandAndReadContainerFile(fn, exec.Command(dockerBinary, "run", "-d", "--name", "c1", "busybox", "sh", "-c", fmt.Sprintf("echo success >/etc/%s && top", fn))) <ide> c.Assert(err, checker.IsNil) <ide><path>integration-cli/docker_cli_inspect_test.go <ide> func (s *DockerSuite) TestInspectDefault(c *check.C) { <ide> <ide> func (s *DockerSuite) TestInspectStatus(c *check.C) { <ide> if daemonPlatform != "windows" { <del> defer unpauseAllContainers() <add> defer unpauseAllContainers(c) <ide> } <ide> out, _ := runSleepingContainer(c, "-d") <ide> out = strings.TrimSpace(out) <ide><path>integration-cli/docker_cli_pause_test.go <ide> import ( <ide> <ide> func (s *DockerSuite) TestPause(c *check.C) { <ide> testRequires(c, IsPausable) <del> defer unpauseAllContainers() <add> defer unpauseAllContainers(c) <ide> <ide> name := "testeventpause" <ide> runSleepingContainer(c, "-d", "--name", name) <ide> func (s *DockerSuite) TestPause(c *check.C) { <ide> <ide> func (s *DockerSuite) TestPauseMultipleContainers(c *check.C) { <ide> testRequires(c, IsPausable) <del> defer unpauseAllContainers() <add> defer unpauseAllContainers(c) <ide> <ide> containers := []string{ <ide> "testpausewithmorecontainers1", <ide><path>integration-cli/docker_cli_start_test.go <ide> func (s *DockerSuite) TestStartRecordError(c *check.C) { <ide> func (s *DockerSuite) TestStartPausedContainer(c *check.C) { <ide> // Windows does not support pausing containers <ide> testRequires(c, IsPausable) <del> defer unpauseAllContainers() <add> defer unpauseAllContainers(c) <ide> <ide> runSleepingContainer(c, "-d", "--name", "testing") <ide> <ide><path>integration-cli/docker_utils.go <ide> import ( <ide> volumetypes "github.com/docker/docker/api/types/volume" <ide> "github.com/docker/docker/opts" <ide> "github.com/docker/docker/pkg/httputils" <add> "github.com/docker/docker/pkg/integration/checker" <ide> icmd "github.com/docker/docker/pkg/integration/cmd" <ide> "github.com/docker/docker/pkg/ioutils" <ide> "github.com/docker/docker/pkg/stringutils" <ide> func getAllContainers() (string, error) { <ide> return out, err <ide> } <ide> <del>func deleteAllContainers() error { <add>func deleteAllContainers(c *check.C) { <ide> containers, err := getAllContainers() <del> if err != nil { <del> fmt.Println(containers) <del> return err <del> } <del> if containers == "" { <del> return nil <del> } <add> c.Assert(err, checker.IsNil, check.Commentf("containers: %v", containers)) <ide> <del> err = deleteContainer(strings.Split(strings.TrimSpace(containers), "\n")...) <del> if err != nil { <del> fmt.Println(err.Error()) <add> if containers != "" { <add> err = deleteContainer(strings.Split(strings.TrimSpace(containers), "\n")...) <add> c.Assert(err, checker.IsNil) <ide> } <del> return err <ide> } <ide> <del>func deleteAllNetworks() error { <add>func deleteAllNetworks(c *check.C) { <ide> networks, err := getAllNetworks() <del> if err != nil { <del> return err <del> } <del> var errors []string <add> c.Assert(err, check.IsNil) <add> var errs []string <ide> for _, n := range networks { <ide> if n.Name == "bridge" || n.Name == "none" || n.Name == "host" { <ide> continue <ide> func deleteAllNetworks() error { <ide> } <ide> status, b, err := sockRequest("DELETE", "/networks/"+n.Name, nil) <ide> if err != nil { <del> errors = append(errors, err.Error()) <add> errs = append(errs, err.Error()) <ide> continue <ide> } <ide> if status != http.StatusNoContent { <del> errors = append(errors, fmt.Sprintf("error deleting network %s: %s", n.Name, string(b))) <add> errs = append(errs, fmt.Sprintf("error deleting network %s: %s", n.Name, string(b))) <ide> } <ide> } <del> if len(errors) > 0 { <del> return fmt.Errorf(strings.Join(errors, "\n")) <del> } <del> return nil <add> c.Assert(errs, checker.HasLen, 0, check.Commentf(strings.Join(errs, "\n"))) <ide> } <ide> <ide> func getAllNetworks() ([]types.NetworkResource, error) { <ide> func getAllNetworks() ([]types.NetworkResource, error) { <ide> return networks, nil <ide> } <ide> <del>func deleteAllPlugins() error { <add>func deleteAllPlugins(c *check.C) { <ide> plugins, err := getAllPlugins() <del> if err != nil { <del> return err <del> } <del> var errors []string <add> c.Assert(err, checker.IsNil) <add> var errs []string <ide> for _, p := range plugins { <del> status, b, err := sockRequest("DELETE", "/plugins/"+p.Name+":"+p.Tag+"?force=1", nil) <add> pluginName := p.Name <add> tag := p.Tag <add> if tag == "" { <add> tag = "latest" <add> } <add> status, b, err := sockRequest("DELETE", "/plugins/"+pluginName+":"+tag+"?force=1", nil) <ide> if err != nil { <del> errors = append(errors, err.Error()) <add> errs = append(errs, err.Error()) <ide> continue <ide> } <del> if status != http.StatusNoContent { <del> errors = append(errors, fmt.Sprintf("error deleting plugin %s: %s", p.Name, string(b))) <add> if status != http.StatusOK { <add> errs = append(errs, fmt.Sprintf("error deleting plugin %s: %s", p.Name, string(b))) <ide> } <ide> } <del> if len(errors) > 0 { <del> return fmt.Errorf(strings.Join(errors, "\n")) <del> } <del> return nil <add> c.Assert(errs, checker.HasLen, 0, check.Commentf(strings.Join(errs, "\n"))) <ide> } <ide> <ide> func getAllPlugins() (types.PluginsListResponse, error) { <ide> func getAllPlugins() (types.PluginsListResponse, error) { <ide> return plugins, nil <ide> } <ide> <del>func deleteAllVolumes() error { <add>func deleteAllVolumes(c *check.C) { <ide> volumes, err := getAllVolumes() <del> if err != nil { <del> return err <del> } <del> var errors []string <add> c.Assert(err, checker.IsNil) <add> var errs []string <ide> for _, v := range volumes { <ide> status, b, err := sockRequest("DELETE", "/volumes/"+v.Name, nil) <ide> if err != nil { <del> errors = append(errors, err.Error()) <add> errs = append(errs, err.Error()) <ide> continue <ide> } <ide> if status != http.StatusNoContent { <del> errors = append(errors, fmt.Sprintf("error deleting volume %s: %s", v.Name, string(b))) <add> errs = append(errs, fmt.Sprintf("error deleting volume %s: %s", v.Name, string(b))) <ide> } <ide> } <del> if len(errors) > 0 { <del> return fmt.Errorf(strings.Join(errors, "\n")) <del> } <del> return nil <add> c.Assert(errs, checker.HasLen, 0, check.Commentf(strings.Join(errs, "\n"))) <ide> } <ide> <ide> func getAllVolumes() ([]*types.Volume, error) { <ide> func getAllVolumes() ([]*types.Volume, error) { <ide> <ide> var protectedImages = map[string]struct{}{} <ide> <del>func deleteAllImages() error { <add>func deleteAllImages(c *check.C) { <ide> cmd := exec.Command(dockerBinary, "images") <ide> cmd.Env = appendBaseEnv(true) <ide> out, err := cmd.CombinedOutput() <del> if err != nil { <del> return err <del> } <add> c.Assert(err, checker.IsNil) <ide> lines := strings.Split(string(out), "\n")[1:] <ide> var imgs []string <ide> for _, l := range lines { <ide> func deleteAllImages() error { <ide> fields := strings.Fields(l) <ide> imgTag := fields[0] + ":" + fields[1] <ide> if _, ok := protectedImages[imgTag]; !ok { <del> if fields[0] == "<none>" { <add> if fields[0] == "<none>" || fields[1] == "<none>" { <ide> imgs = append(imgs, fields[2]) <ide> continue <ide> } <ide> imgs = append(imgs, imgTag) <ide> } <ide> } <del> if len(imgs) == 0 { <del> return nil <add> if len(imgs) != 0 { <add> dockerCmd(c, append([]string{"rmi", "-f"}, imgs...)...) <ide> } <del> args := append([]string{"rmi", "-f"}, imgs...) <del> if err := exec.Command(dockerBinary, args...).Run(); err != nil { <del> return err <del> } <del> return nil <ide> } <ide> <ide> func getPausedContainers() (string, error) { <ide> func getSliceOfPausedContainers() ([]string, error) { <ide> return []string{out}, err <ide> } <ide> <del>func unpauseContainer(container string) error { <del> return icmd.RunCommand(dockerBinary, "unpause", container).Error <add>func unpauseContainer(c *check.C, container string) { <add> dockerCmd(c, "unpause", container) <ide> } <ide> <del>func unpauseAllContainers() error { <add>func unpauseAllContainers(c *check.C) { <ide> containers, err := getPausedContainers() <del> if err != nil { <del> fmt.Println(containers) <del> return err <del> } <add> c.Assert(err, checker.IsNil, check.Commentf("containers: %v", containers)) <ide> <ide> containers = strings.Replace(containers, "\n", " ", -1) <ide> containers = strings.Trim(containers, " ") <ide> containerList := strings.Split(containers, " ") <ide> <ide> for _, value := range containerList { <del> if err = unpauseContainer(value); err != nil { <del> return err <del> } <add> unpauseContainer(c, value) <ide> } <del> <del> return nil <ide> } <ide> <ide> func deleteImages(images ...string) error { <ide> func dockerCmdWithStdoutStderr(c *check.C, args ...string) (string, string, int) <ide> } <ide> <ide> result := icmd.RunCommand(dockerBinary, args...) <del> // TODO: why is c ever nil? <del> if c != nil { <del> c.Assert(result, icmd.Matches, icmd.Success) <del> } <add> c.Assert(result, icmd.Matches, icmd.Success) <ide> return result.Stdout(), result.Stderr(), result.ExitCode <ide> } <ide>
9
Mixed
Ruby
use proper output format [ci skip]
415e17d0b54681545d36a0f43d4cd8761de77bee
<ide><path>actionpack/lib/action_dispatch/http/request.rb <ide> def controller_class <ide> <ide> # Returns true if the request has a header matching the given key parameter. <ide> # <del> # request.key? :ip_spoofing_check #=> true <add> # request.key? :ip_spoofing_check # => true <ide> def key?(key) <ide> has_header? key <ide> end <ide><path>guides/source/active_record_postgresql.md <ide> profile.settings = {"color" => "yellow", "resolution" => "1280x1024"} <ide> profile.save! <ide> <ide> Profile.where("settings->'color' = ?", "yellow") <del>#=> #<ActiveRecord::Relation [#<Profile id: 1, settings: {"color"=>"yellow", "resolution"=>"1280x1024"}>]> <add># => #<ActiveRecord::Relation [#<Profile id: 1, settings: {"color"=>"yellow", "resolution"=>"1280x1024"}>]> <ide> ``` <ide> <ide> ### JSON
2
Javascript
Javascript
rewrite code to no longer use __guard__
99aaafed1b8d39713b7e033d68b248f710778fa2
<ide><path>src/project.js <ide> /* <ide> * decaffeinate suggestions: <del> * DS103: Rewrite code to no longer use __guard__ <ide> * DS104: Avoid inline assignments <ide> * DS204: Change includes calls to have a more natural evaluation order <ide> * DS205: Consider reworking code to avoid use of IIFEs <ide> class Project extends Model { <ide> // @repositoryPromisesByPath in case some other RepositoryProvider is <ide> // registered in the future that could supply a Repository for the <ide> // directory. <del> if (repo == null) { this.repositoryPromisesByPath.delete(pathForDirectory) } <del> __guardMethod__(repo, 'onDidDestroy', o => o.onDidDestroy(() => this.repositoryPromisesByPath.delete(pathForDirectory))) <add> if (repo == null) this.repositoryPromisesByPath.delete(pathForDirectory) <add> <add> if (repo && repo.onDidDestroy) { <add> repo.onDidDestroy(() => this.repositoryPromisesByPath.delete(pathForDirectory)) <add> } <add> <ide> return repo <ide> }) <ide> this.repositoryPromisesByPath.set(pathForDirectory, promise) <ide> class Project extends Model { <ide> <ide> // Is the buffer for the given path modified? <ide> isPathModified (filePath) { <del> return __guard__(this.findBufferForPath(this.resolvePath(filePath)), x => x.isModified()) <add> const bufferForPath = this.findBufferForPath(this.resolvePath(filePath)) <add> return bufferForPath && bufferForPath.isModified() <ide> } <ide> <ide> findBufferForPath (filePath) { <ide> class Project extends Model { <ide> }) <ide> } <ide> } <del> <del>function __guardMethod__ (obj, methodName, transform) { <del> if (typeof obj !== 'undefined' && obj !== null && typeof obj[methodName] === 'function') { <del> return transform(obj, methodName) <del> } else { <del> return undefined <del> } <del>} <del>function __guard__ (value, transform) { <del> return (typeof value !== 'undefined' && value !== null) ? transform(value) : undefined <del>}
1
Text
Text
clarify err_invalid_repl_input usage
06d74956ae960c066c054a0bd84795025a587e77
<ide><path>doc/api/errors.md <ide> which is not supported. <ide> <a id="ERR_INVALID_REPL_INPUT"></a> <ide> ### `ERR_INVALID_REPL_INPUT` <ide> <del>The input may not be used in the [`REPL`][]. All prohibited inputs are <del>documented in the [`REPL`][]'s documentation. <add>The input may not be used in the [`REPL`][]. The conditions under which this <add>error is used are described in the [`REPL`][] documentation. <ide> <ide> <a id="ERR_INVALID_RETURN_PROPERTY"></a> <ide> ### `ERR_INVALID_RETURN_PROPERTY`
1
Go
Go
return an empty config if nil
c85a58b6df38c692275d592049d1b2db1d1b4da3
<ide><path>libnetwork/controller.go <ide> func (c *controller) hostLeaveCallback(hosts []net.IP) { <ide> func (c *controller) Config() config.Config { <ide> c.Lock() <ide> defer c.Unlock() <add> if c.cfg == nil { <add> return config.Config{} <add> } <ide> return *c.cfg <ide> } <ide>
1
Javascript
Javascript
fix lint errors
adbfbdde0a561f25bd810b20bac03dd2be9a693c
<ide><path>src/utils/combineReducers.js <ide> import { ActionTypes } from '../createStore'; <ide> function getErrorMessage(key: String, action: Action): string { <ide> var actionType = action && action.type; <ide> var actionName = actionType && `"${actionType.toString()}"` || 'an action'; <del> <add> <ide> return ( <ide> `Reducer "${key}" returned undefined handling ${actionName}. ` + <ide> `To ignore an action, you must explicitly return the previous state.` <ide><path>test/utils/combineReducers.spec.js <ide> describe('Utils', () => { <ide> }); <ide> <ide> it('should allow a symbol to be used as an action type', () => { <del> const increment = Symbol('INCREMENT') <add> const increment = Symbol('INCREMENT'); <ide> <ide> const reducer = combineReducers({ <ide> counter(state = 0, action) { <ide> describe('Utils', () => { <ide> } <ide> }); <ide> <del> expect(reducer(0, {type: increment}).counter).toEqual(1) <add> expect(reducer(0, {type: increment}).counter).toEqual(1); <ide> }); <ide> <ide> it('should throw an error if a reducer attempts to handle a private action', () => {
2
PHP
PHP
fix cs errors
297da498b5aef5ec2809b3368dd9807b7ff6a220
<ide><path>src/Database/Driver/Sqlite.php <ide> protected function _transformFunctionExpression(FunctionExpression $expression): <ide> case 'RAND': <ide> $expression <ide> ->setName('ABS') <del> ->add(["RANDOM() % 1" => 'literal'], [], true); <add> ->add(['RANDOM() % 1' => 'literal'], [], true); <ide> break; <ide> case 'CURRENT_DATE': <ide> $expression->setName('DATE')->add(["'now'" => 'literal']); <ide><path>src/Error/Debug/ConsoleFormatter.php <ide> protected function export(NodeInterface $var, int $indent): string <ide> protected function exportArray(ArrayNode $var, int $indent): string <ide> { <ide> $out = $this->style('punct', '['); <del> $break = "\n" . str_repeat(" ", $indent); <del> $end = "\n" . str_repeat(" ", $indent - 1); <add> $break = "\n" . str_repeat(' ', $indent); <add> $end = "\n" . str_repeat(' ', $indent - 1); <ide> $vars = []; <ide> <ide> $arrow = $this->style('punct', ' => '); <ide> protected function exportObject($var, int $indent): string <ide> $this->style('number', (string)$var->getId()) . <ide> $this->style('punct', ' {'); <ide> <del> $break = "\n" . str_repeat(" ", $indent); <del> $end = "\n" . str_repeat(" ", $indent - 1) . $this->style('punct', '}'); <add> $break = "\n" . str_repeat(' ', $indent); <add> $end = "\n" . str_repeat(' ', $indent - 1) . $this->style('punct', '}'); <ide> <ide> $arrow = $this->style('punct', ' => '); <ide> foreach ($var->getChildren() as $property) { <ide><path>src/Error/Debug/HtmlFormatter.php <ide> protected function exportObject($var): string <ide> '</span>'; <ide> <ide> if (count($props)) { <del> return $out . implode("", $props) . $end; <add> return $out . implode('', $props) . $end; <ide> } <ide> <ide> return $out . $end; <ide><path>src/Error/Debug/TextFormatter.php <ide> protected function export(NodeInterface $var, int $indent): string <ide> protected function exportArray(ArrayNode $var, int $indent): string <ide> { <ide> $out = '['; <del> $break = "\n" . str_repeat(" ", $indent); <del> $end = "\n" . str_repeat(" ", $indent - 1); <add> $break = "\n" . str_repeat(' ', $indent); <add> $end = "\n" . str_repeat(' ', $indent - 1); <ide> $vars = []; <ide> <ide> foreach ($var->getChildren() as $item) { <ide> protected function exportObject($var, int $indent): string <ide> } <ide> <ide> $out .= "object({$var->getValue()}) id:{$var->getId()} {"; <del> $break = "\n" . str_repeat(" ", $indent); <del> $end = "\n" . str_repeat(" ", $indent - 1) . '}'; <add> $break = "\n" . str_repeat(' ', $indent); <add> $end = "\n" . str_repeat(' ', $indent - 1) . '}'; <ide> <ide> foreach ($var->getChildren() as $property) { <ide> $visibility = $property->getVisibility(); <ide><path>src/TestSuite/Constraint/Session/SessionHasKey.php <ide> public function matches($other): bool <ide> */ <ide> public function toString(): string <ide> { <del> return "is a path present in the session"; <add> return 'is a path present in the session'; <ide> } <ide> } <ide><path>tests/TestCase/Database/QueryTests/CommonTableExpressionQueryTests.php <ide> public function testWithRecursiveCte() <ide> <ide> if ($this->connection->getDriver() instanceof Sqlserver) { <ide> $expectedSql = <del> "WITH cte(col) AS " . <add> 'WITH cte(col) AS ' . <ide> "(SELECT 1\nUNION ALL SELECT (col + 1) FROM cte WHERE col != :c0) " . <del> "SELECT col FROM cte"; <add> 'SELECT col FROM cte'; <ide> } elseif ($this->connection->getDriver() instanceof Sqlite) { <ide> $expectedSql = <del> "WITH RECURSIVE cte(col) AS " . <add> 'WITH RECURSIVE cte(col) AS ' . <ide> "(SELECT 1\nUNION ALL SELECT (col + 1) FROM cte WHERE col != :c0) " . <del> "SELECT col FROM cte"; <add> 'SELECT col FROM cte'; <ide> } else { <ide> $expectedSql = <del> "WITH RECURSIVE cte(col) AS " . <add> 'WITH RECURSIVE cte(col) AS ' . <ide> "((SELECT 1)\nUNION ALL (SELECT (col + 1) FROM cte WHERE col != :c0)) " . <del> "SELECT col FROM cte"; <add> 'SELECT col FROM cte'; <ide> } <ide> $this->assertEqualsSql( <ide> $expectedSql, <ide> public function testWithInsertQuery() <ide> <ide> $this->assertStartsWithSql( <ide> "WITH cte(title, body) AS (SELECT 'Fourth Article', 'Fourth Article Body') " . <del> "INSERT INTO articles (title, body)", <add> 'INSERT INTO articles (title, body)', <ide> $query->sql(new ValueBinder()) <ide> ); <ide> <ide> public function testWithInInsertWithValuesQuery() <ide> ); <ide> <ide> $this->assertStartsWithSql( <del> "INSERT INTO articles (title, body) " . <add> 'INSERT INTO articles (title, body) ' . <ide> "WITH cte(title, body) AS (SELECT 'Fourth Article', 'Fourth Article Body') SELECT * FROM cte", <ide> $query->sql(new ValueBinder()) <ide> ); <ide> public function testWithInUpdateQuery() <ide> }); <ide> <ide> $this->assertEqualsSql( <del> "WITH cte AS (SELECT articles.id FROM articles WHERE articles.id != :c0) " . <del> "UPDATE articles SET published = :c1 WHERE id IN (SELECT cte.id FROM cte)", <add> 'WITH cte AS (SELECT articles.id FROM articles WHERE articles.id != :c0) ' . <add> 'UPDATE articles SET published = :c1 WHERE id IN (SELECT cte.id FROM cte)', <ide> $query->sql(new ValueBinder()) <ide> ); <ide> <ide> public function testWithInDeleteQuery() <ide> }); <ide> <ide> $this->assertEqualsSql( <del> "WITH cte AS (SELECT articles.id FROM articles WHERE articles.id != :c0) " . <del> "DELETE FROM articles WHERE id IN (SELECT cte.id FROM cte)", <add> 'WITH cte AS (SELECT articles.id FROM articles WHERE articles.id != :c0) ' . <add> 'DELETE FROM articles WHERE id IN (SELECT cte.id FROM cte)', <ide> $query->sql(new ValueBinder()) <ide> ); <ide> <ide><path>tests/TestCase/ORM/TableTest.php <ide> public function testGetAssociationWithIncorrectCasing() <ide> $this->expectException(InvalidArgumentException::class); <ide> $this->expectExceptionMessage( <ide> "The `authors` association is not defined on `Articles`.\n" <del> . "Valid associations are: Authors, Tags, ArticlesTags" <add> . 'Valid associations are: Authors, Tags, ArticlesTags' <ide> ); <ide> <ide> $articles = $this->getTableLocator()->get('Articles', ['className' => ArticlesTable::class]);
7
Python
Python
fix phrasematcher example
01858e9b5972a8c1dec86f88eef3f17fea63cdc6
<ide><path>examples/multi_word_matches.py <ide> matching over the tag patterns. So no matter how many phrases we're looking for, <ide> our pattern set stays very small (exact size depends on the maximum length we're <ide> looking for, as the query language currently has no quantifiers) <add> <add>The example expects a .bz2 file from the Reddit corpus, and a patterns file, <add>formatted in jsonl as a sequence of entries like this: <add> <add>{"text":"Anchorage"} <add>{"text":"Angola"} <add>{"text":"Ann Arbor"} <add>{"text":"Annapolis"} <add>{"text":"Appalachia"} <add>{"text":"Argentina"} <ide> """ <ide> from __future__ import print_function, unicode_literals, division <del>from ast import literal_eval <ide> from bz2 import BZ2File <ide> import time <ide> import math <ide> import codecs <ide> <ide> import plac <add>import ujson <ide> <del>from preshed.maps import PreshMap <del>from preshed.counter import PreshCounter <del>from spacy.strings import hash_string <del>from spacy.en import English <ide> from spacy.matcher import PhraseMatcher <add>import spacy <ide> <ide> <ide> def read_gazetteer(tokenizer, loc, n=-1): <ide> for i, line in enumerate(open(loc)): <del> phrase = literal_eval('u' + line.strip()) <del> if ' (' in phrase and phrase.endswith(')'): <del> phrase = phrase.split(' (', 1)[0] <del> if i >= n: <del> break <del> phrase = tokenizer(phrase) <del> if all((t.is_lower and t.prob >= -10) for t in phrase): <del> continue <add> data = ujson.loads(line.strip()) <add> phrase = tokenizer(data['text']) <add> for w in phrase: <add> _ = tokenizer.vocab[w.text] <ide> if len(phrase) >= 2: <ide> yield phrase <ide> <ide> <del>def read_text(bz2_loc): <add>def read_text(bz2_loc, n=10000): <ide> with BZ2File(bz2_loc) as file_: <del> for line in file_: <del> yield line.decode('utf8') <add> for i, line in enumerate(file_): <add> data = ujson.loads(line) <add> yield data['body'] <add> if i >= n: <add> break <ide> <ide> <ide> def get_matches(tokenizer, phrases, texts, max_length=6): <del> matcher = PhraseMatcher(tokenizer.vocab, phrases, max_length=max_length) <del> print("Match") <add> matcher = PhraseMatcher(tokenizer.vocab, max_length=max_length) <add> matcher.add('Phrase', None, *phrases) <ide> for text in texts: <ide> doc = tokenizer(text) <add> for w in doc: <add> _ = doc.vocab[w.text] <ide> matches = matcher(doc) <del> for mwe in doc.ents: <del> yield mwe <add> for ent_id, start, end in matches: <add> yield (ent_id, doc[start:end].text) <ide> <ide> <del>def main(patterns_loc, text_loc, counts_loc, n=10000000): <del> nlp = English(parser=False, tagger=False, entity=False) <del> print("Make matcher") <del> phrases = read_gazetteer(nlp.tokenizer, patterns_loc, n=n) <del> counts = PreshCounter() <add>def main(patterns_loc, text_loc, n=10000): <add> nlp = spacy.blank('en') <add> nlp.vocab.lex_attr_getters = {} <add> phrases = read_gazetteer(nlp.tokenizer, patterns_loc) <add> count = 0 <ide> t1 = time.time() <del> for mwe in get_matches(nlp.tokenizer, phrases, read_text(text_loc)): <del> counts.inc(hash_string(mwe.text), 1) <add> for ent_id, text in get_matches(nlp.tokenizer, phrases, read_text(text_loc, n=n)): <add> count += 1 <ide> t2 = time.time() <del> print("10m tokens in %d s" % (t2 - t1)) <del> <del> with codecs.open(counts_loc, 'w', 'utf8') as file_: <del> for phrase in read_gazetteer(nlp.tokenizer, patterns_loc, n=n): <del> text = phrase.string <del> key = hash_string(text) <del> count = counts[key] <del> if count != 0: <del> file_.write('%d\t%s\n' % (count, text)) <del> <add> print("%d docs in %.3f s. %d matches" % (n, (t2 - t1), count)) <add> <ide> <ide> if __name__ == '__main__': <ide> if False:
1
Java
Java
fix reacthorizontalscrollview contentoffset
9f6f97151c44a0f727c9dd938222be1860ecf3f9
<ide><path>ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollView.java <ide> private int getSnapInterval() { <ide> } <ide> <ide> private View getContentView() { <del> View contentView = getChildAt(0); <del> return contentView; <add> return getChildAt(0); <ide> } <ide> <ide> public void setEndFillColor(int color) { <ide> public void scrollTo(int x, int y) { <ide> } <ide> <ide> super.scrollTo(x, y); <del> // The final scroll position might be different from (x, y). For example, we may need to scroll <del> // to the last item in the list, but that item cannot be move to the start position of the view. <del> final int actualX = getScrollX(); <del> final int actualY = getScrollY(); <del> ReactScrollViewHelper.updateFabricScrollState(this, actualX, actualY); <del> setPendingContentOffsets(actualX, actualY); <add> ReactScrollViewHelper.updateFabricScrollState(this); <add> setPendingContentOffsets(x, y); <add> } <add> <add> private boolean isContentReady() { <add> View child = getContentView(); <add> return child != null && child.getWidth() != 0 && child.getHeight() != 0; <ide> } <ide> <ide> /** <ide> private void setPendingContentOffsets(int x, int y) { <ide> if (DEBUG_MODE) { <ide> FLog.i(TAG, "setPendingContentOffsets[%d] x %d y %d", getId(), x, y); <ide> } <del> View child = getContentView(); <del> if (child != null && child.getWidth() != 0 && child.getHeight() != 0) { <add> <add> if (isContentReady()) { <ide> pendingContentOffsetX = UNSET_CONTENT_OFFSET; <ide> pendingContentOffsetY = UNSET_CONTENT_OFFSET; <ide> } else { <ide><path>ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollView.java <ide> public void reactSmoothScrollTo(int x, int y) { <ide> } <ide> <ide> /** <del> * Calls `updateFabricScrollState` and updates state. <add> * Calls `super.scrollTo` and updates state. <ide> * <del> * <p>`scrollTo` changes `contentOffset` and we need to keep `contentOffset` in sync between <del> * scroll view and state. Calling ScrollView's `scrollTo` doesn't update state. <add> * <p>`super.scrollTo` changes `contentOffset` and we need to keep `contentOffset` in sync between <add> * scroll view and state. <add> * <add> * <p>Note that while we can override scrollTo, we *cannot* override `smoothScrollTo` because it <add> * is final. See `reactSmoothScrollTo`. <ide> */ <ide> @Override <ide> public void scrollTo(int x, int y) { <ide> public void scrollTo(int x, int y) { <ide> } <ide> <ide> private boolean isContentReady() { <del> View child = getChildAt(0); <add> View child = getContentView(); <ide> return child != null && child.getWidth() != 0 && child.getHeight() != 0; <ide> } <ide>
2
Ruby
Ruby
fix the next version of rails from 5.3 to 6.0
43c8877c293d00ccfb3849359a07fa59ee5ac95d
<ide><path>activesupport/lib/active_support/deprecation.rb <ide> class Deprecation <ide> # and the second is a library name. <ide> # <ide> # ActiveSupport::Deprecation.new('2.0', 'MyLibrary') <del> def initialize(deprecation_horizon = "5.3", gem_name = "Rails") <add> def initialize(deprecation_horizon = "6.0", gem_name = "Rails") <ide> self.gem_name = gem_name <ide> self.deprecation_horizon = deprecation_horizon <ide> # By default, warnings are not silenced and debugging is off.
1
Python
Python
update the timestamp to default to utc.
31f7f41b4331978b6767d9b0957cda380bc28c48
<ide><path>official/utils/logs/logger.py <ide> def log_metric(self, name, value, unit=None, global_step=None, extras=None): <ide> "value": float(value), <ide> "unit": unit, <ide> "global_step": global_step, <del> "timestamp": datetime.datetime.now().strftime( <add> "timestamp": datetime.datetime.utcnow().strftime( <ide> _DATE_TIME_FORMAT_PATTERN), <ide> "extras": extras} <ide> try: <ide> def _gather_run_info(model_name): <ide> run_info = { <ide> "model_name": model_name, <ide> "machine_config": {}, <del> "run_date": datetime.datetime.now().strftime(_DATE_TIME_FORMAT_PATTERN)} <add> "run_date": datetime.datetime.utcnow().strftime( <add> _DATE_TIME_FORMAT_PATTERN)} <ide> _collect_tensorflow_info(run_info) <ide> _collect_tensorflow_environment_variables(run_info) <ide> _collect_cpu_info(run_info)
1
Java
Java
add mergedannotations.of method
9d6cf57cb740660661c1804a41fe699f5d3b9faa
<ide><path>spring-core/src/main/java/org/springframework/core/annotation/MergedAnnotations.java <ide> import java.lang.annotation.Inherited; <ide> import java.lang.reflect.AnnotatedElement; <ide> import java.lang.reflect.Method; <add>import java.util.Collection; <ide> import java.util.function.Predicate; <ide> import java.util.stream.Stream; <ide> <ide> static MergedAnnotations from(@Nullable Object source, Annotation[] annotations, <ide> return TypeMappedAnnotations.from(source, annotations, repeatableContainers, annotationFilter); <ide> } <ide> <add> /** <add> * Create a new {@link MergedAnnotations} instance from the specified <add> * collection of directly present annotations. This method allows a <add> * {@link MergedAnnotations} instance to be created from annotations that <add> * are not necessarily loaded using reflection. The provided annotations <add> * must all be {@link MergedAnnotation#isDirectlyPresent() directly present} <add> * and must have a {@link MergedAnnotation#getAggregateIndex() aggregate <add> * index} of {@code 0}. <add> * <p> <add> * The resulting {@link MergedAnnotations} instance will contain both the <add> * specified annotations, and any meta-annotations that can be read using <add> * reflection. <add> * @param annotations the annotations to include <add> * @return a {@link MergedAnnotations} instance containing the annotations <add> * @see MergedAnnotation#of(ClassLoader, Object, Class, java.util.Map) <add> */ <add> static MergedAnnotations of(Collection<MergedAnnotation<?>> annotations) { <add> return MergedAnnotationsCollection.of(annotations); <add> } <add> <ide> <ide> /** <ide> * Search strategies supported by <ide><path>spring-core/src/main/java/org/springframework/core/annotation/MergedAnnotationsCollection.java <add>/* <add> * Copyright 2002-2019 the original author or authors. <add> * <add> * Licensed under the Apache License, Version 2.0 (the "License"); <add> * you may not use this file except in compliance with the License. <add> * You may obtain a copy of the License at <add> * <add> * https://www.apache.org/licenses/LICENSE-2.0 <add> * <add> * Unless required by applicable law or agreed to in writing, software <add> * distributed under the License is distributed on an "AS IS" BASIS, <add> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <add> * See the License for the specific language governing permissions and <add> * limitations under the License. <add> */ <add> <add>package org.springframework.core.annotation; <add> <add>import java.lang.annotation.Annotation; <add>import java.util.Collection; <add>import java.util.Iterator; <add>import java.util.Spliterator; <add>import java.util.Spliterators; <add>import java.util.function.Consumer; <add>import java.util.function.Predicate; <add>import java.util.stream.Stream; <add>import java.util.stream.StreamSupport; <add> <add>import org.springframework.lang.Nullable; <add>import org.springframework.util.Assert; <add> <add>/** <add> * {@link MergedAnnotations} implementation backed by a {@link Collection} <add> * {@link MergedAnnotation} instances that represent direct annotations. <add> * <add> * @author Phillip Webb <add> * @since 5.2 <add> * @see MergedAnnotations#of(Collection) <add> */ <add>final class MergedAnnotationsCollection implements MergedAnnotations { <add> <add> private final MergedAnnotation<?>[] annotations; <add> <add> private final AnnotationTypeMappings[] mappings; <add> <add> private MergedAnnotationsCollection(Collection<MergedAnnotation<?>> annotations) { <add> Assert.notNull(annotations, "Annotations must not be null"); <add> this.annotations = annotations.toArray(new MergedAnnotation<?>[0]); <add> this.mappings = new AnnotationTypeMappings[this.annotations.length]; <add> for (int i = 0; i < this.annotations.length; i++) { <add> MergedAnnotation<?> annotation = this.annotations[i]; <add> Assert.notNull(annotation, "Annotation must not be null"); <add> Assert.isTrue(annotation.isDirectlyPresent(), "Annotation must be directly present"); <add> Assert.isTrue(annotation.getAggregateIndex() == 0, "Annotation must have aggregate index of zero"); <add> this.mappings[i] = AnnotationTypeMappings.forAnnotationType( <add> annotation.getType()); <add> } <add> } <add> <add> @Override <add> public Iterator<MergedAnnotation<Annotation>> iterator() { <add> return Spliterators.iterator(spliterator()); <add> } <add> <add> @Override <add> public Spliterator<MergedAnnotation<Annotation>> spliterator() { <add> return spliterator(null); <add> } <add> <add> private <A extends Annotation> Spliterator<MergedAnnotation<A>> spliterator( <add> @Nullable Object annotationType) { <add> return new AnnotationsSpliterator<>(annotationType); <add> } <add> <add> @Override <add> public <A extends Annotation> boolean isPresent(Class<A> annotationType) { <add> return isPresent(annotationType, false); <add> } <add> <add> @Override <add> public boolean isPresent(String annotationType) { <add> return isPresent(annotationType, false); <add> } <add> <add> @Override <add> public <A extends Annotation> boolean isDirectlyPresent(Class<A> annotationType) { <add> return isPresent(annotationType, true); <add> } <add> <add> @Override <add> public boolean isDirectlyPresent(String annotationType) { <add> return isPresent(annotationType, true); <add> } <add> <add> private boolean isPresent(Object requiredType, boolean directOnly) { <add> for (MergedAnnotation<?> annotation : this.annotations) { <add> Class<? extends Annotation> type = annotation.getType(); <add> if (type == requiredType || type.getName().equals(requiredType)) { <add> return true; <add> } <add> } <add> if (!directOnly) { <add> for (AnnotationTypeMappings mappings : this.mappings) { <add> for (int i = 1; i < mappings.size(); i++) { <add> AnnotationTypeMapping mapping = mappings.get(i); <add> if (isMappingForType(mapping, requiredType)) { <add> return true; <add> } <add> } <add> } <add> } <add> return false; <add> } <add> <add> @Override <add> public <A extends Annotation> MergedAnnotation<A> get(Class<A> annotationType) { <add> return get(annotationType, null, null); <add> } <add> <add> @Override <add> public <A extends Annotation> MergedAnnotation<A> get(Class<A> annotationType, <add> @Nullable Predicate<? super MergedAnnotation<A>> predicate) { <add> <add> return get(annotationType, predicate, null); <add> } <add> <add> @Override <add> public <A extends Annotation> MergedAnnotation<A> get(Class<A> annotationType, <add> @Nullable Predicate<? super MergedAnnotation<A>> predicate, <add> @Nullable MergedAnnotationSelector<A> selector) { <add> MergedAnnotation<A> result = find(annotationType, predicate, selector); <add> return (result != null ? result : MergedAnnotation.missing()); <add> } <add> <add> @Override <add> public <A extends Annotation> MergedAnnotation<A> get(String annotationType) { <add> return get(annotationType, null, null); <add> } <add> <add> @Override <add> public <A extends Annotation> MergedAnnotation<A> get(String annotationType, <add> @Nullable Predicate<? super MergedAnnotation<A>> predicate) { <add> <add> return get(annotationType, predicate, null); <add> } <add> <add> @Override <add> public <A extends Annotation> MergedAnnotation<A> get(String annotationType, <add> @Nullable Predicate<? super MergedAnnotation<A>> predicate, <add> @Nullable MergedAnnotationSelector<A> selector) { <add> <add> MergedAnnotation<A> result = find(annotationType, predicate, selector); <add> return (result != null ? result : MergedAnnotation.missing()); <add> } <add> <add> @SuppressWarnings("unchecked") <add> private <A extends Annotation> MergedAnnotation<A> find(Object requiredType, <add> Predicate<? super MergedAnnotation<A>> predicate, <add> MergedAnnotationSelector<A> selector) { <add> if (selector == null) { <add> selector = MergedAnnotationSelectors.nearest(); <add> } <add> MergedAnnotation<A> result = null; <add> for (int i = 0; i < this.annotations.length; i++) { <add> MergedAnnotation<?> root = this.annotations[i]; <add> AnnotationTypeMappings mappings = this.mappings[i]; <add> for (int mappingIndex = 0; mappingIndex < mappings.size(); mappingIndex++) { <add> AnnotationTypeMapping mapping = mappings.get(mappingIndex); <add> if (!isMappingForType(mapping, requiredType)) { <add> continue; <add> } <add> MergedAnnotation<A> candidate = (mappingIndex == 0 <add> ? (MergedAnnotation<A>) root <add> : TypeMappedAnnotation.createIfPossible(mapping, root, IntrospectionFailureLogger.INFO)); <add> if (candidate != null && (predicate == null || predicate.test(candidate))) { <add> if (selector.isBestCandidate(candidate)) { <add> return candidate; <add> } <add> result = (result != null ? selector.select(result, candidate) : candidate); <add> } <add> } <add> } <add> return result; <add> } <add> <add> @Override <add> public <A extends Annotation> Stream<MergedAnnotation<A>> stream(Class<A> annotationType) { <add> return StreamSupport.stream(spliterator(annotationType), false); <add> } <add> <add> @Override <add> public <A extends Annotation> Stream<MergedAnnotation<A>> stream(String annotationType) { <add> return StreamSupport.stream(spliterator(annotationType), false); <add> } <add> <add> @Override <add> public Stream<MergedAnnotation<Annotation>> stream() { <add> return StreamSupport.stream(spliterator(), false); <add> } <add> <add> private static boolean isMappingForType(AnnotationTypeMapping mapping, @Nullable Object requiredType) { <add> if (requiredType == null) { <add> return true; <add> } <add> Class<? extends Annotation> actualType = mapping.getAnnotationType(); <add> return (actualType == requiredType || actualType.getName().equals(requiredType)); <add> } <add> <add> static MergedAnnotations of(Collection<MergedAnnotation<?>> annotations) { <add> Assert.notNull(annotations, "Annotations must not be null"); <add> if(annotations.isEmpty()) { <add> return TypeMappedAnnotations.NONE; <add> } <add> return new MergedAnnotationsCollection(annotations); <add> } <add> <add> <add> private class AnnotationsSpliterator<A extends Annotation> implements Spliterator<MergedAnnotation<A>> { <add> <add> @Nullable <add> private Object requiredType; <add> <add> private final int[] mappingCursors; <add> <add> public AnnotationsSpliterator(@Nullable Object requiredType) { <add> this.mappingCursors = new int[annotations.length]; <add> this.requiredType = requiredType; <add> } <add> <add> @Override <add> public boolean tryAdvance(Consumer<? super MergedAnnotation<A>> action) { <add> int lowestDepth = Integer.MAX_VALUE; <add> int annotationResult = -1; <add> for (int annotationIndex = 0; annotationIndex < annotations.length; annotationIndex++) { <add> AnnotationTypeMapping mapping = getNextSuitableMapping(annotationIndex); <add> if (mapping != null && mapping.getDepth() < lowestDepth) { <add> annotationResult = annotationIndex; <add> lowestDepth = mapping.getDepth(); <add> } <add> if (lowestDepth == 0) { <add> break; <add> } <add> } <add> if (annotationResult != -1) { <add> MergedAnnotation<A> mergedAnnotation = createMergedAnnotationIfPossible(annotationResult, this.mappingCursors[annotationResult]); <add> this.mappingCursors[annotationResult]++; <add> if (mergedAnnotation == null) { <add> return tryAdvance(action); <add> } <add> action.accept(mergedAnnotation); <add> return true; <add> } <add> return false; <add> } <add> <add> @Nullable <add> private AnnotationTypeMapping getNextSuitableMapping(int annotationIndex) { <add> AnnotationTypeMapping mapping; <add> do { <add> mapping = getMapping(annotationIndex, this.mappingCursors[annotationIndex]); <add> if (mapping != null && isMappingForType(mapping, this.requiredType)) { <add> return mapping; <add> } <add> this.mappingCursors[annotationIndex]++; <add> } <add> while (mapping != null); <add> return null; <add> } <add> <add> @Nullable <add> private AnnotationTypeMapping getMapping(int annotationIndex, int mappingIndex) { <add> AnnotationTypeMappings mappings = MergedAnnotationsCollection.this.mappings[annotationIndex]; <add> return (mappingIndex < mappings.size() ? mappings.get(mappingIndex) : null); <add> } <add> <add> @Nullable <add> @SuppressWarnings("unchecked") <add> private MergedAnnotation<A> createMergedAnnotationIfPossible( <add> int annotationIndex, int mappingIndex) { <add> MergedAnnotation<?> root = annotations[annotationIndex]; <add> if(mappingIndex == 0) { <add> return (MergedAnnotation<A>) root; <add> } <add> IntrospectionFailureLogger logger = (this.requiredType != null <add> ? IntrospectionFailureLogger.INFO <add> : IntrospectionFailureLogger.DEBUG); <add> return TypeMappedAnnotation.createIfPossible( <add> mappings[annotationIndex].get(mappingIndex), root, logger); <add> } <add> <add> @Override <add> public Spliterator<MergedAnnotation<A>> trySplit() { <add> return null; <add> } <add> <add> @Override <add> public long estimateSize() { <add> int size = 0; <add> for (int i = 0; i < annotations.length; i++) { <add> AnnotationTypeMappings mappings = MergedAnnotationsCollection.this.mappings[i]; <add> int numberOfMappings = mappings.size(); <add> numberOfMappings -= Math.min(this.mappingCursors[i], mappings.size()); <add> size += numberOfMappings; <add> } <add> return size; <add> } <add> <add> @Override <add> public int characteristics() { <add> return NONNULL | IMMUTABLE; <add> } <add> <add> } <add> <add>} <ide><path>spring-core/src/main/java/org/springframework/core/annotation/TypeMappedAnnotations.java <ide> final class TypeMappedAnnotations implements MergedAnnotations { <ide> <ide> private static final AnnotationFilter FILTER_ALL = (annotationType -> true); <ide> <del> private static final MergedAnnotations NONE = new TypeMappedAnnotations( <add> /** <add> * Shared instance that can be used when there are no annotations. <add> */ <add> static final MergedAnnotations NONE = new TypeMappedAnnotations( <ide> null, new Annotation[0], RepeatableContainers.none(), FILTER_ALL); <ide> <ide> <ide><path>spring-core/src/test/java/org/springframework/core/annotation/MergedAnnotationsCollectionTests.java <add>/* <add> * Copyright 2002-2019 the original author or authors. <add> * <add> * Licensed under the Apache License, Version 2.0 (the "License"); <add> * you may not use this file except in compliance with the License. <add> * You may obtain a copy of the License at <add> * <add> * http://www.apache.org/licenses/LICENSE-2.0 <add> * <add> * Unless required by applicable law or agreed to in writing, software <add> * distributed under the License is distributed on an "AS IS" BASIS, <add> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <add> * See the License for the specific language governing permissions and <add> * limitations under the License. <add> */ <add> <add>package org.springframework.core.annotation; <add> <add>import java.lang.annotation.Annotation; <add>import java.lang.annotation.Retention; <add>import java.lang.annotation.RetentionPolicy; <add>import java.util.ArrayList; <add>import java.util.Collections; <add>import java.util.List; <add>import java.util.Spliterator; <add> <add>import org.junit.Test; <add> <add>import static org.assertj.core.api.Assertions.*; <add>import static org.mockito.BDDMockito.*; <add> <add>/** <add> * Tests for {@link MergedAnnotationsCollection}. <add> * <add> * @author Phillip Webb <add> */ <add>public class MergedAnnotationsCollectionTests { <add> <add> @Test <add> public void ofWhenDirectAnnotationsIsNullThrowsException() { <add> assertThatIllegalArgumentException().isThrownBy( <add> () -> MergedAnnotationsCollection.of(null)).withMessage( <add> "Annotations must not be null"); <add> } <add> <add> @Test <add> public void ofWhenEmptyReturnsSharedNoneInstance() { <add> MergedAnnotations annotations = MergedAnnotationsCollection.of(new ArrayList<>()); <add> assertThat(annotations).isSameAs(TypeMappedAnnotations.NONE); <add> } <add> <add> @Test <add> public void createWhenAnnotationIsNotDirectlyPresentThrowsException() { <add> MergedAnnotation<?> annotation = mock(MergedAnnotation.class); <add> given(annotation.isDirectlyPresent()).willReturn(false); <add> assertThatIllegalArgumentException().isThrownBy(() -> { <add> MergedAnnotationsCollection.of(Collections.singleton(annotation)); <add> }).withMessage("Annotation must be directly present"); <add> } <add> <add> @Test <add> public void createWhenAnnotationAggregateIndexIsNotZeroThrowsException() { <add> MergedAnnotation<?> annotation = mock(MergedAnnotation.class); <add> given(annotation.isDirectlyPresent()).willReturn(true); <add> given(annotation.getAggregateIndex()).willReturn(1); <add> assertThatIllegalArgumentException().isThrownBy(() -> { <add> MergedAnnotationsCollection.of(Collections.singleton(annotation)); <add> }).withMessage("Annotation must have aggregate index of zero"); <add> } <add> <add> @Test <add> public void interateIteratesInCorrectOrder() { <add> MergedAnnotations annotations = getDirectAndSimple(); <add> List<Class<?>> types = new ArrayList<>(); <add> for (MergedAnnotation<?> annotation : annotations) { <add> types.add(annotation.getType()); <add> } <add> assertThat(types).containsExactly(Direct.class, Simple.class, Meta1.class, <add> Meta2.class, Meta11.class); <add> } <add> <add> @Test <add> public void spliteratorIteratesInCorrectOrder() { <add> MergedAnnotations annotations = getDirectAndSimple(); <add> Spliterator<MergedAnnotation<Annotation>> spliterator = annotations.spliterator(); <add> List<Class<?>> types = new ArrayList<>(); <add> spliterator.forEachRemaining(annotation -> types.add(annotation.getType())); <add> assertThat(types).containsExactly(Direct.class, Simple.class, Meta1.class, <add> Meta2.class, Meta11.class); <add> } <add> <add> @Test <add> public void spliteratorEstimatesSize() { <add> MergedAnnotations annotations = getDirectAndSimple(); <add> Spliterator<MergedAnnotation<Annotation>> spliterator = annotations.spliterator(); <add> assertThat(spliterator.estimateSize()).isEqualTo(5); <add> spliterator.tryAdvance( <add> annotation -> assertThat(annotation.getType()).isEqualTo(Direct.class)); <add> assertThat(spliterator.estimateSize()).isEqualTo(4); <add> } <add> <add> @Test <add> public void isPresentWhenDirectlyPresentReturnsTrue() { <add> MergedAnnotations annotations = getDirectAndSimple(); <add> assertThat(annotations.isPresent(Direct.class)).isTrue(); <add> assertThat(annotations.isPresent(Direct.class.getName())).isTrue(); <add> } <add> <add> @Test <add> public void isPresentWhenMetaPresentReturnsTrue() { <add> MergedAnnotations annotations = getDirectAndSimple(); <add> assertThat(annotations.isPresent(Meta11.class)).isTrue(); <add> assertThat(annotations.isPresent(Meta11.class.getName())).isTrue(); <add> } <add> <add> @Test <add> public void isPresentWhenNotPresentReturnsFalse() { <add> MergedAnnotations annotations = getDirectAndSimple(); <add> assertThat(annotations.isPresent(Missing.class)).isFalse(); <add> assertThat(annotations.isPresent(Missing.class.getName())).isFalse(); <add> <add> } <add> <add> @Test <add> public void isDirectlyPresentWhenDirectlyPresentReturnsTrue() { <add> MergedAnnotations annotations = getDirectAndSimple(); <add> assertThat(annotations.isDirectlyPresent(Direct.class)).isTrue(); <add> assertThat(annotations.isDirectlyPresent(Direct.class.getName())).isTrue(); <add> } <add> <add> @Test <add> public void isDirectlyPresentWhenMetaPresentReturnsFalse() { <add> MergedAnnotations annotations = getDirectAndSimple(); <add> assertThat(annotations.isDirectlyPresent(Meta11.class)).isFalse(); <add> assertThat(annotations.isDirectlyPresent(Meta11.class.getName())).isFalse(); <add> } <add> <add> @Test <add> public void isDirectlyPresentWhenNotPresentReturnsFalse() { <add> MergedAnnotations annotations = getDirectAndSimple(); <add> assertThat(annotations.isDirectlyPresent(Missing.class)).isFalse(); <add> assertThat(annotations.isDirectlyPresent(Missing.class.getName())).isFalse(); <add> } <add> <add> @Test <add> public void getReturnsAppropriateAnnotation() { <add> MergedAnnotations annotations = getMutiRoute1(); <add> assertThat(annotations.get(MutiRouteTarget.class).getString( <add> MergedAnnotation.VALUE)).isEqualTo("12"); <add> assertThat(annotations.get(MutiRouteTarget.class.getName()).getString( <add> MergedAnnotation.VALUE)).isEqualTo("12"); <add> } <add> <add> @Test <add> public void getWhenNotPresentReturnsMissing() { <add> MergedAnnotations annotations = getDirectAndSimple(); <add> assertThat(annotations.get(Missing.class)).isEqualTo(MergedAnnotation.missing()); <add> } <add> <add> @Test <add> public void getWithPredicateReturnsOnlyMatching() { <add> MergedAnnotations annotations = getMutiRoute1(); <add> assertThat(annotations.get(MutiRouteTarget.class, <add> annotation -> annotation.getDepth() >= 3).getString( <add> MergedAnnotation.VALUE)).isEqualTo("111"); <add> } <add> <add> @Test <add> public void getWithSelectorReturnsSelected() { <add> MergedAnnotations annotations = getMutiRoute1(); <add> MergedAnnotationSelector<MutiRouteTarget> deepest = (existing, <add> candidate) -> candidate.getDepth() > existing.getDepth() ? candidate <add> : existing; <add> assertThat(annotations.get(MutiRouteTarget.class, null, deepest).getString( <add> MergedAnnotation.VALUE)).isEqualTo("111"); <add> } <add> <add> @Test <add> public void streamStreamsInCorrectOrder() { <add> MergedAnnotations annotations = getDirectAndSimple(); <add> List<Class<?>> types = new ArrayList<>(); <add> annotations.stream().forEach(annotation -> types.add(annotation.getType())); <add> assertThat(types).containsExactly(Direct.class, Simple.class, Meta1.class, <add> Meta2.class, Meta11.class); <add> } <add> <add> @Test <add> public void streamWithTypeStreamsInCorrectOrder() { <add> MergedAnnotations annotations = getMutiRoute1(); <add> List<String> values = new ArrayList<>(); <add> annotations.stream(MutiRouteTarget.class).forEach( <add> annotation -> values.add(annotation.getString(MergedAnnotation.VALUE))); <add> assertThat(values).containsExactly("12", "111"); <add> } <add> <add> @Test <add> public void getMetaWhenRootHasAttributeValuesShouldAlaisAttributes() { <add> MergedAnnotation<Alaised> root = MergedAnnotation.of(null, null, Alaised.class, <add> Collections.singletonMap("testAlias", "test")); <add> MergedAnnotations annotations = MergedAnnotationsCollection.of( <add> Collections.singleton(root)); <add> MergedAnnotation<AlaisTarget> metaAnnotation = annotations.get(AlaisTarget.class); <add> assertThat(metaAnnotation.getString("test")).isEqualTo("test"); <add> } <add> <add> @Test <add> public void getMetaWhenRootHasNoAttributeValuesShouldAlaisAttributes() { <add> MergedAnnotation<Alaised> root = MergedAnnotation.of(null, null, Alaised.class, <add> Collections.emptyMap()); <add> MergedAnnotations annotations = MergedAnnotationsCollection.of( <add> Collections.singleton(root)); <add> MergedAnnotation<AlaisTarget> metaAnnotation = annotations.get(AlaisTarget.class); <add> assertThat(root.getString("testAlias")).isEqualTo("newdefault"); <add> assertThat(metaAnnotation.getString("test")).isEqualTo("newdefault"); <add> } <add> <add> private MergedAnnotations getDirectAndSimple() { <add> List<MergedAnnotation<?>> list = new ArrayList<>(); <add> list.add(MergedAnnotation.of(null, null, Direct.class, Collections.emptyMap())); <add> list.add(MergedAnnotation.of(null, null, Simple.class, Collections.emptyMap())); <add> return MergedAnnotationsCollection.of(list); <add> } <add> <add> private MergedAnnotations getMutiRoute1() { <add> List<MergedAnnotation<?>> list = new ArrayList<>(); <add> list.add(MergedAnnotation.of(null, null, MutiRoute1.class, <add> Collections.emptyMap())); <add> return MergedAnnotationsCollection.of(list); <add> } <add> <add> @Meta1 <add> @Meta2 <add> @Retention(RetentionPolicy.RUNTIME) <add> @interface Direct { <add> <add> } <add> <add> @Meta11 <add> @Retention(RetentionPolicy.RUNTIME) <add> @interface Meta1 { <add> <add> } <add> <add> @Retention(RetentionPolicy.RUNTIME) <add> @interface Meta2 { <add> <add> } <add> <add> @Retention(RetentionPolicy.RUNTIME) <add> @interface Meta11 { <add> <add> } <add> <add> @Retention(RetentionPolicy.RUNTIME) <add> @interface Simple { <add> <add> } <add> <add> @Retention(RetentionPolicy.RUNTIME) <add> @interface Missing { <add> <add> } <add> <add> @Retention(RetentionPolicy.RUNTIME) <add> @interface MutiRouteTarget { <add> <add> String value(); <add> <add> } <add> <add> @MutiRoute11 <add> @MutiRoute12 <add> @Retention(RetentionPolicy.RUNTIME) <add> @interface MutiRoute1 { <add> <add> } <add> <add> @MutiRoute111 <add> @Retention(RetentionPolicy.RUNTIME) <add> @interface MutiRoute11 { <add> <add> } <add> <add> @MutiRouteTarget("12") <add> @Retention(RetentionPolicy.RUNTIME) <add> @interface MutiRoute12 { <add> <add> } <add> <add> @MutiRouteTarget("111") <add> @Retention(RetentionPolicy.RUNTIME) <add> @interface MutiRoute111 { <add> <add> } <add> <add> @Retention(RetentionPolicy.RUNTIME) <add> @interface AlaisTarget { <add> <add> String test() default "default"; <add> <add> } <add> <add> @Retention(RetentionPolicy.RUNTIME) <add> @AlaisTarget <add> @interface Alaised { <add> <add> @AliasFor(annotation = AlaisTarget.class, attribute = "test") <add> String testAlias() default "newdefault"; <add> <add> } <add> <add>}
4
PHP
PHP
leave db->cachesources unaltered
99fd6e40fe994e836e035fc49ca151d7a04ce657
<ide><path>lib/Cake/Model/Model.php <ide> protected function _generateAssociation($type, $assocKey) { <ide> public function setSource($tableName) { <ide> $this->setDataSource($this->useDbConfig); <ide> $db = ConnectionManager::getDataSource($this->useDbConfig); <del> $db->cacheSources = ($this->cacheSources && $db->cacheSources); <ide> <ide> if (method_exists($db, 'listSources')) { <add> $restore = $db->cacheSources; <add> $db->cacheSources = $this->cacheSources; <ide> $sources = $db->listSources(); <add> $db->cacheSources = $restore; <add> <ide> if (is_array($sources) && !in_array(strtolower($this->tablePrefix . $tableName), array_map('strtolower', $sources))) { <ide> throw new MissingTableException(array( <ide> 'table' => $this->tablePrefix . $tableName,
1
Ruby
Ruby
fix typos in activejob queuing test
8e12371da6729cb11be442b686443fa0f0fdc944
<ide><path>activejob/test/integration/queuing_test.rb <ide> require 'active_support/core_ext/numeric/time' <ide> <ide> class QueuingTest < ActiveSupport::TestCase <del> test 'should run jobs enqueued on a listenting queue' do <add> test 'should run jobs enqueued on a listening queue' do <ide> TestJob.perform_later @id <ide> wait_for_jobs_to_finish_for(5.seconds) <ide> assert job_executed <ide> end <ide> <del> test 'should not run jobs queued on a non-listenting queue' do <add> test 'should not run jobs queued on a non-listening queue' do <ide> skip if adapter_is?(:inline) || adapter_is?(:sucker_punch) <ide> old_queue = TestJob.queue_name <ide>
1
Text
Text
clarify the callback arguments of dns.resolve
d33b3d10860d31cbb8d63fd8f6e93555d8cd1c88
<ide><path>doc/api/dns.md <ide> dns.lookupService('127.0.0.1', 22, (err, hostname, service) => { <ide> <!-- YAML <ide> added: v0.1.27 <ide> --> <del>- `hostname` {string} <del>- `rrtype` {string} <add>- `hostname` {string} Hostname to resolve. <add>- `rrtype` {string} Resource record type. Default: `'A'`. <ide> - `callback` {Function} <ide> - `err` {Error} <del> - `addresses` {string[] | Object[] | string[][] | Object} <del> <del>Uses the DNS protocol to resolve a hostname (e.g. `'nodejs.org'`) into an <del>array of the record types specified by `rrtype`. <del> <del>Valid values for `rrtype` are: <del> <del> * `'A'` - IPV4 addresses, default <del> * `'AAAA'` - IPV6 addresses <del> * `'MX'` - mail exchange records <del> * `'TXT'` - text records <del> * `'SRV'` - SRV records <del> * `'PTR'` - PTR records <del> * `'NS'` - name server records <del> * `'CNAME'` - canonical name records <del> * `'SOA'` - start of authority record <del> * `'NAPTR'` - name authority pointer record <del> <del>The `callback` function has arguments `(err, addresses)`. When successful, <del>`addresses` will be an array, except when resolving an SOA record which returns <del>an object structured in the same manner as one returned by the <del>[`dns.resolveSoa()`][] method. The type of each item in `addresses` is <del>determined by the record type, and described in the documentation for the <del>corresponding lookup methods. <del> <del>On error, `err` is an [`Error`][] object, where `err.code` is <del>one of the error codes listed [here](#dns_error_codes). <add> - `records` {string[] | Object[] | string[][] | Object} <add> <add>Uses the DNS protocol to resolve a hostname (e.g. `'nodejs.org'`) into an array <add>of the resource records. The `callback` function has arguments <add>`(err, records)`. When successful, `records` will be an array of resource <add>records. The type and structure of individual results varies based on `rrtype`: <add> <add>| `rrtype` | `records` contains | Result type | Shorthand method | <add>|-----------|--------------------------------|-------------|--------------------------| <add>| `'A'` | IPv4 addresses (default) | {string} | [`dns.resolve4()`][] | <add>| `'AAAA'` | IPv6 addresses | {string} | [`dns.resolve6()`][] | <add>| `'CNAME'` | canonical name records | {string} | [`dns.resolveCname()`][] | <add>| `'MX'` | mail exchange records | {Object} | [`dns.resolveMx()`][] | <add>| `'NAPTR'` | name authority pointer records | {Object} | [`dns.resolveNaptr()`][] | <add>| `'NS'` | name server records | {string} | [`dns.resolveNs()`][] | <add>| `'PTR'` | pointer records | {string} | [`dns.resolvePtr()`][] | <add>| `'SOA'` | start of authority records | {Object} | [`dns.resolveSoa()`][] | <add>| `'SRV'` | service records | {Object} | [`dns.resolveSrv()`][] | <add>| `'TXT'` | text records | {string} | [`dns.resolveTxt()`][] | <add> <add>On error, `err` is an [`Error`][] object, where `err.code` is one of the <add>[DNS error codes](#dns_error_codes). <ide> <ide> ## dns.resolve4(hostname[, options], callback) <ide> <!-- YAML <ide> uses. For instance, _they do not use the configuration from `/etc/hosts`_. <ide> <ide> [DNS error codes]: #dns_error_codes <ide> [`dns.lookup()`]: #dns_dns_lookup_hostname_options_callback <add>[`dns.resolve4()`]: #dns_dns_resolve4_hostname_options_callback <add>[`dns.resolve6()`]: #dns_dns_resolve6_hostname_options_callback <add>[`dns.resolveCname()`]: #dns_dns_resolvecname_hostname_callback <add>[`dns.resolveMx()`]: #dns_dns_resolvemx_hostname_callback <add>[`dns.resolveNaptr()`]: #dns_dns_resolvenaptr_hostname_callback <add>[`dns.resolveNs()`]: #dns_dns_resolvens_hostname_callback <add>[`dns.resolvePtr()`]: #dns_dns_resolveptr_hostname_callback <ide> [`dns.resolveSoa()`]: #dns_dns_resolvesoa_hostname_callback <add>[`dns.resolveSrv()`]: #dns_dns_resolvesrv_hostname_callback <add>[`dns.resolveTxt()`]: #dns_dns_resolvetxt_hostname_callback <ide> [`Error`]: errors.html#errors_class_error <ide> [Implementation considerations section]: #dns_implementation_considerations <ide> [supported `getaddrinfo` flags]: #dns_supported_getaddrinfo_flags
1
Javascript
Javascript
remove usage of public util module
a34cb28e60db7132dfb2cd020bb9f039c333cccf
<ide><path>lib/vm.js <ide> const { <ide> ERR_INVALID_ARG_TYPE, <ide> ERR_VM_MODULE_NOT_MODULE, <ide> } = require('internal/errors').codes; <del>const { isModuleNamespaceObject, isArrayBufferView } = require('util').types; <add>const { <add> isModuleNamespaceObject, <add> isArrayBufferView, <add>} = require('internal/util/types'); <ide> const { <ide> validateInt32, <ide> validateUint32, <ide><path>test/parallel/test-bootstrap-modules.js <ide> const expectedModules = new Set([ <ide> 'NativeModule path', <ide> 'NativeModule timers', <ide> 'NativeModule url', <del> 'NativeModule util', <ide> 'NativeModule vm', <ide> ]); <ide>
2
Python
Python
add regression test for
86cd7f0efdabadb172894c39183f9645dbd632aa
<ide><path>spacy/tests/regression/test_issue4120.py <add># coding: utf8 <add>from __future__ import unicode_literals <add> <add>import pytest <add>from spacy.matcher import Matcher <add>from spacy.tokens import Doc <add> <add> <add>@pytest.mark.xfail <add>def test_issue4120(en_vocab): <add> """Test that matches without a final {OP: ?} token are returned.""" <add> matcher = Matcher(en_vocab) <add> matcher.add("TEST", None, [{"ORTH": "a"}, {"OP": "?"}]) <add> doc1 = Doc(en_vocab, words=["a"]) <add> assert len(matcher(doc1)) == 1 # works <add> doc2 = Doc(en_vocab, words=["a", "b", "c"]) <add> assert len(matcher(doc2)) == 2 # doesn't work <add> <add> matcher = Matcher(en_vocab) <add> matcher.add("TEST", None, [{"ORTH": "a"}, {"OP": "?"}, {"ORTH": "b"}]) <add> doc3 = Doc(en_vocab, words=["a", "b", "b", "c"]) <add> assert len(matcher(doc3)) == 2 # works <add> <add> matcher = Matcher(en_vocab) <add> matcher.add("TEST", None, [{"ORTH": "a"}, {"OP": "?"}, {"ORTH": "b", "OP": "?"}]) <add> doc4 = Doc(en_vocab, words=["a", "b", "b", "c"]) <add> assert len(matcher(doc4)) == 3 # doesn't work
1
Go
Go
fix race in cleanup
381d593d04fc46dac5b202d047981e15183c5ed1
<ide><path>container.go <ide> func (container *Container) Attach(stdin io.ReadCloser, stdinCloser io.Closer, s <ide> if container.Config.StdinOnce && !container.Config.Tty { <ide> defer cStdin.Close() <ide> } else { <del> if cStdout != nil { <del> defer cStdout.Close() <del> } <del> if cStderr != nil { <del> defer cStderr.Close() <del> } <add> defer func() { <add> if cStdout != nil { <add> cStdout.Close() <add> } <add> if cStderr != nil { <add> cStderr.Close() <add> } <add> }() <ide> } <ide> if container.Config.Tty { <ide> _, err = utils.CopyEscapable(cStdin, stdin) <ide> func (container *Container) Attach(stdin io.ReadCloser, stdinCloser io.Closer, s <ide> } <ide> <ide> return utils.Go(func() error { <del> if cStdout != nil { <del> defer cStdout.Close() <del> } <del> if cStderr != nil { <del> defer cStderr.Close() <del> } <add> defer func() { <add> if cStdout != nil { <add> cStdout.Close() <add> } <add> if cStderr != nil { <add> cStderr.Close() <add> } <add> }() <add> <ide> // FIXME: how to clean up the stdin goroutine without the unwanted side effect <ide> // of closing the passed stdin? Add an intermediary io.Pipe? <ide> for i := 0; i < nJobs; i += 1 {
1
PHP
PHP
fix cs error
6de2ba16116a8d132a7d0ad73c44c17c8fa09934
<ide><path>src/Core/functions.php <ide> use Cake\Core\Configure; <ide> <ide> if (!defined('DS')) { <del> /** <del> * Define DS as short form of DIRECTORY_SEPARATOR. <del> */ <add> <add>/** <add> * Define DS as short form of DIRECTORY_SEPARATOR. <add> */ <ide> define('DS', DIRECTORY_SEPARATOR); <add> <ide> } <ide> <ide> if (!function_exists('h')) {
1
Javascript
Javascript
fix transformcontrol zoom for orthographiccamera
a0535a3e1b4eeaacbf22f8bc7c9673efc885c785
<ide><path>examples/js/controls/TransformControls.js <ide> THREE.TransformControlsGizmo = function () { <ide> handle.position.copy( this.worldPosition ); <ide> <ide> var eyeDistance = this.worldPosition.distanceTo( this.cameraPosition ); <add> // Orthographic camera zoom doesn't depend on eyeDistance, but on camera zoom factor. <add> if (this.camera.type == "OrthographicCamera") { <add> eyeDistance = 1000 / this.camera.zoom; <add> } <ide> handle.scale.set( 1, 1, 1 ).multiplyScalar( eyeDistance * this.size / 7 ); <ide> <ide> // TODO: simplify helpers and consider decoupling from gizmo <ide><path>examples/jsm/controls/TransformControls.js <ide> var TransformControlsGizmo = function () { <ide> handle.position.copy( this.worldPosition ); <ide> <ide> var eyeDistance = this.worldPosition.distanceTo( this.cameraPosition ); <add> // Orthographic camera zoom doesn't depend on eyeDistance, but on camera zoom factor. <add> if (this.camera.type == "OrthographicCamera") { <add> eyeDistance = 1000 / this.camera.zoom; <add> } <ide> handle.scale.set( 1, 1, 1 ).multiplyScalar( eyeDistance * this.size / 7 ); <ide> <ide> // TODO: simplify helpers and consider decoupling from gizmo
2
Text
Text
add missing word to release docs.
6309fb79783b601f878ccc44650c153d93d57167
<ide><path>dev/README_RELEASE_AIRFLOW.md <ide> You can find the prerequisites to release Apache Airflow in [README.md](README.m <ide> <ide> ## Build RC artifacts <ide> <del>The Release Candidate artifacts we vote upon should be the exact ones we vote against, without any modification than renaming – i.e. the contents of the files must be the same between voted release candidate and final release. Because of this the version in the built artifacts that will become the official Apache releases must not include the rcN suffix. <add>The Release Candidate artifacts we vote upon should be the exact ones we vote against, without any modification other than renaming – i.e. the contents of the files must be the same between voted release candidate and final release. Because of this the version in the built artifacts that will become the official Apache releases must not include the rcN suffix. <ide> <ide> - Set environment variables <ide>
1
Python
Python
parametrize tests using different methods
9d9a89445bdf0edaaba4a4a3260493bc3f043a15
<ide><path>numpy/random/tests/test_generator_mt19937.py <ide> def test_multinomial(self): <ide> [5, 5, 3, 1, 2, 4]]]) <ide> assert_array_equal(actual, desired) <ide> <del> def test_multivariate_normal(self): <add> @pytest.mark.parametrize("method", ["svd", "eigh", "cholesky"]) <add> def test_multivariate_normal(self, method): <ide> random = Generator(MT19937(self.seed)) <ide> mean = (.123456789, 10) <ide> cov = [[1, 0], [0, 1]] <ide> size = (3, 2) <del> actual_svd = random.multivariate_normal(mean, cov, size) <del> # the seed needs to be reset for each method <del> random = Generator(MT19937(self.seed)) <del> actual_eigh = random.multivariate_normal(mean, cov, size, <del> method='eigh') <del> random = Generator(MT19937(self.seed)) <del> actual_chol = random.multivariate_normal(mean, cov, size, <del> method='cholesky') <add> actual = random.multivariate_normal(mean, cov, size, method=method) <ide> desired = np.array([[[-1.747478062846581, 11.25613495182354 ], <ide> [-0.9967333370066214, 10.342002097029821 ]], <ide> [[ 0.7850019631242964, 11.181113712443013 ], <ide> [ 0.8901349653255224, 8.873825399642492 ]], <ide> [[ 0.7130260107430003, 9.551628690083056 ], <ide> [ 0.7127098726541128, 11.991709234143173 ]]]) <ide> <del> assert_array_almost_equal(actual_svd, desired, decimal=15) <del> assert_array_almost_equal(actual_eigh, desired, decimal=15) <del> assert_array_almost_equal(actual_chol, desired, decimal=15) <add> assert_array_almost_equal(actual, desired, decimal=15) <ide> <ide> # Check for default size, was raising deprecation warning <del> random = Generator(MT19937(self.seed)) <del> actual_svd = random.multivariate_normal(mean, cov) <del> random = Generator(MT19937(self.seed)) <del> actual_eigh = random.multivariate_normal(mean, cov, method='eigh') <del> random = Generator(MT19937(self.seed)) <del> actual_chol = random.multivariate_normal(mean, cov, method='cholesky') <add> #random = Generator(MT19937(self.seed)) <add> actual = random.multivariate_normal(mean, cov, method=method) <ide> # the factor matrix is the same for all methods <del> random = Generator(MT19937(self.seed)) <del> desired = np.array([-1.747478062846581, 11.25613495182354]) <del> assert_array_almost_equal(actual_svd, desired, decimal=15) <del> assert_array_almost_equal(actual_eigh, desired, decimal=15) <del> assert_array_almost_equal(actual_chol, desired, decimal=15) <add> #random = Generator(MT19937(self.seed)) <add> #desired = np.array([-1.747478062846581, 11.25613495182354]) <add> desired = np.array([0.233278563284287, 9.424140804347195]) <add> assert_array_almost_equal(actual, desired, decimal=15) <ide> # Check that non symmetric covariance input raises exception when <ide> # check_valid='raises' if using default svd method. <ide> mean = [0, 0] <ide> def test_multivariate_normal(self): <ide> <ide> cov = np.array([[1, 0.1], [0.1, 1]], dtype=np.float32) <ide> with suppress_warnings() as sup: <del> random.multivariate_normal(mean, cov) <del> random.multivariate_normal(mean, cov, method='eigh') <del> random.multivariate_normal(mean, cov, method='cholesky') <add> random.multivariate_normal(mean, cov, method=method) <ide> w = sup.record(RuntimeWarning) <ide> assert len(w) == 0 <ide>
1
Python
Python
take limit_choices_to into account with fk
e3bd4b90488bab756694ce271a9615460783f987
<ide><path>rest_framework/utils/field_mapping.py <ide> def get_relation_kwargs(field_name, relation_info): <ide> if to_field: <ide> kwargs['to_field'] = to_field <ide> <add> limit_choices_to = model_field and model_field.get_limit_choices_to() <add> if limit_choices_to: <add> kwargs['queryset'] = kwargs['queryset'].filter(**limit_choices_to) <add> <ide> if has_through_model: <ide> kwargs['read_only'] = True <ide> kwargs.pop('queryset', None) <ide><path>tests/models.py <ide> class ForeignKeySource(RESTFrameworkModel): <ide> on_delete=models.CASCADE) <ide> <ide> <add>class ForeignKeySourceWithLimitedChoices(RESTFrameworkModel): <add> target = models.ForeignKey(ForeignKeyTarget, help_text='Target', <add> verbose_name='Target', <add> limit_choices_to={"name__startswith": "limited-"}, <add> on_delete=models.CASCADE) <add> <add> <ide> # Nullable ForeignKey <ide> class NullableForeignKeySource(RESTFrameworkModel): <ide> name = models.CharField(max_length=100) <ide><path>tests/test_relations_pk.py <ide> <ide> from rest_framework import serializers <ide> from tests.models import ( <del> ForeignKeySource, ForeignKeyTarget, ManyToManySource, ManyToManyTarget, <del> NullableForeignKeySource, NullableOneToOneSource, <del> NullableUUIDForeignKeySource, OneToOnePKSource, OneToOneTarget, <del> UUIDForeignKeyTarget <add> ForeignKeySource, ForeignKeySourceWithLimitedChoices, ForeignKeyTarget, <add> ManyToManySource, ManyToManyTarget, NullableForeignKeySource, <add> NullableOneToOneSource, NullableUUIDForeignKeySource, OneToOnePKSource, <add> OneToOneTarget, UUIDForeignKeyTarget <ide> ) <ide> <ide> <ide> class Meta: <ide> fields = ('id', 'name', 'target') <ide> <ide> <add>class ForeignKeySourceWithLimitedChoicesSerializer(serializers.ModelSerializer): <add> class Meta: <add> model = ForeignKeySourceWithLimitedChoices <add> fields = ("id", "target") <add> <add> <ide> # Nullable ForeignKey <ide> class NullableForeignKeySourceSerializer(serializers.ModelSerializer): <ide> class Meta: <ide> class Meta(ForeignKeySourceSerializer.Meta): <ide> serializer.is_valid(raise_exception=True) <ide> assert 'target' not in serializer.validated_data <ide> <add> def test_queryset_size_without_limited_choices(self): <add> limited_target = ForeignKeyTarget(name="limited-target") <add> limited_target.save() <add> queryset = ForeignKeySourceSerializer().fields["target"].get_queryset() <add> assert len(queryset) == 3 <add> <add> def test_queryset_size_with_limited_choices(self): <add> limited_target = ForeignKeyTarget(name="limited-target") <add> limited_target.save() <add> queryset = ForeignKeySourceWithLimitedChoicesSerializer().fields["target"].get_queryset() <add> assert len(queryset) == 1 <add> <ide> <ide> class PKNullableForeignKeyTests(TestCase): <ide> def setUp(self):
3
Python
Python
prepare tools/testp.py for python 3
59065308349b7cb8d93439324afc00b7c51fecdf
<ide><path>tools/test.py <ide> import multiprocessing <ide> import errno <ide> import copy <del>import ast <ide> <ide> from os.path import join, dirname, abspath, basename, isdir, exists <ide> from datetime import datetime <ide> from Queue import Queue, Empty <ide> <ide> try: <del> reduce # Python 2 <add> cmp # Python 2 <add>except NameError: <add> def cmp(x, y): # Python 3 <add> return (x > y) - (x < y) <add> <add>try: <add> reduce # Python 2 <ide> except NameError: # Python 3 <ide> from functools import reduce <ide> <ide> try: <del> xrange # Python 2 <add> xrange # Python 2 <ide> except NameError: <del> xrange = range # Python 3 <add> xrange = range # Python 3 <ide> <ide> logger = logging.getLogger('testrunner') <ide> skip_regex = re.compile(r'# SKIP\S*\s+(.*)', re.IGNORECASE)
1
Javascript
Javascript
support more attributes for early hint link
2649aab6036447b15ea313fbf61d64b4c19934f6
<ide><path>lib/internal/validators.js <ide> function validateUnion(value, name, union) { <ide> } <ide> } <ide> <del>const linkValueRegExp = /^(?:<[^>]*>;)\s*(?:rel=(")?[^;"]*\1;?)\s*(?:(?:as|anchor|title)=(")?[^;"]*\2)?$/; <add>const linkValueRegExp = /^(?:<[^>]*>;)\s*(?:rel=(")?[^;"]*\1;?)\s*(?:(?:as|anchor|title|crossorigin|disabled|fetchpriority|rel|referrerpolicy)=(")?[^;"]*\2)?$/; <ide> <ide> /** <ide> * @param {any} value <ide><path>test/parallel/test-validators.js <ide> const { <ide> validateString, <ide> validateInt32, <ide> validateUint32, <add> validateLinkHeaderValue, <ide> } = require('internal/validators'); <ide> const { MAX_SAFE_INTEGER, MIN_SAFE_INTEGER } = Number; <ide> const outOfRangeError = { <ide> const invalidArgValueError = { <ide> code: 'ERR_INVALID_ARG_TYPE' <ide> })); <ide> } <add> <add>{ <add> // validateLinkHeaderValue type validation. <add> [ <add> ['</styles.css>; rel=preload; as=style', '</styles.css>; rel=preload; as=style'], <add> ['</styles.css>; rel=preload; title=hello', '</styles.css>; rel=preload; title=hello'], <add> ['</styles.css>; rel=preload; crossorigin=hello', '</styles.css>; rel=preload; crossorigin=hello'], <add> ['</styles.css>; rel=preload; disabled=true', '</styles.css>; rel=preload; disabled=true'], <add> ['</styles.css>; rel=preload; fetchpriority=high', '</styles.css>; rel=preload; fetchpriority=high'], <add> ['</styles.css>; rel=preload; referrerpolicy=origin', '</styles.css>; rel=preload; referrerpolicy=origin'], <add> ].forEach(([value, expected]) => assert.strictEqual(validateLinkHeaderValue(value), expected)); <add>}
2
Javascript
Javascript
minimize abuse of .alternate
c83a0428f126e9f41d199b56fe8bf457dce5dad2
<ide><path>src/renderers/shared/fiber/ReactChildFiber.js <ide> var { <ide> var ReactFiber = require('ReactFiber'); <ide> var ReactReifiedYield = require('ReactReifiedYield'); <ide> <del>function createSubsequentChild(parent : Fiber, nextReusable : ?Fiber, previousSibling : Fiber, newChildren) : Fiber { <add>function createSubsequentChild(parent : Fiber, existingChild : ?Fiber, previousSibling : Fiber, newChildren) : Fiber { <ide> if (typeof newChildren !== 'object' || newChildren === null) { <ide> return previousSibling; <ide> } <ide> <ide> switch (newChildren.$$typeof) { <ide> case REACT_ELEMENT_TYPE: { <ide> const element = (newChildren : ReactElement<any>); <del> if (nextReusable && <del> element.type === nextReusable.type && <del> element.key === nextReusable.key) { <add> if (existingChild && <add> element.type === existingChild.type && <add> element.key === existingChild.key) { <ide> // TODO: This is not sufficient since previous siblings could be new. <ide> // Will fix reconciliation properly later. <del> const clone = ReactFiber.cloneFiber(nextReusable); <add> const clone = ReactFiber.cloneFiber(existingChild); <ide> clone.input = element.props; <del> clone.child = nextReusable.child; <add> clone.child = existingChild.child; <ide> clone.sibling = null; <ide> previousSibling.sibling = clone; <ide> return clone; <ide> function createSubsequentChild(parent : Fiber, nextReusable : ?Fiber, previousSi <ide> <ide> if (Array.isArray(newChildren)) { <ide> let prev : Fiber = previousSibling; <add> let existing : ?Fiber = existingChild; <ide> for (var i = 0; i < newChildren.length; i++) { <del> let reusable = null; <del> if (prev.alternate) { <del> reusable = prev.alternate.sibling; <add> prev = createSubsequentChild(parent, existing, prev, newChildren[i]); <add> if (prev && existing) { <add> // TODO: This is not correct because there could've been more <add> // than one sibling consumed but I don't want to return a tuple. <add> existing = existing.sibling; <ide> } <del> prev = createSubsequentChild(parent, reusable, prev, newChildren[i]); <ide> } <ide> return prev; <ide> } else { <ide> function createSubsequentChild(parent : Fiber, nextReusable : ?Fiber, previousSi <ide> } <ide> } <ide> <del>function createFirstChild(parent, newChildren) { <add>function createFirstChild(parent, existingChild, newChildren) { <ide> if (typeof newChildren !== 'object' || newChildren === null) { <ide> return null; <ide> } <ide> <ide> switch (newChildren.$$typeof) { <ide> case REACT_ELEMENT_TYPE: { <ide> const element = (newChildren : ReactElement<any>); <del> const existingChild : ?Fiber = parent.child; <ide> if (existingChild && <ide> element.type === existingChild.type && <ide> element.key === existingChild.key) { <ide> function createFirstChild(parent, newChildren) { <ide> if (Array.isArray(newChildren)) { <ide> var first : ?Fiber = null; <ide> var prev : ?Fiber = null; <add> var existing : ?Fiber = existingChild; <ide> for (var i = 0; i < newChildren.length; i++) { <ide> if (prev == null) { <del> prev = createFirstChild(parent, newChildren[i]); <add> prev = createFirstChild(parent, existing, newChildren[i]); <ide> first = prev; <ide> } else { <del> let reusable = null; <del> if (prev.alternate) { <del> reusable = prev.alternate.sibling; <del> } <del> prev = createSubsequentChild(parent, reusable, prev, newChildren[i]); <add> prev = createSubsequentChild(parent, existing, prev, newChildren[i]); <add> } <add> if (prev && existing) { <add> // TODO: This is not correct because there could've been more <add> // than one sibling consumed but I don't want to return a tuple. <add> existing = existing.sibling; <ide> } <ide> } <ide> return first; <ide> function createFirstChild(parent, newChildren) { <ide> } <ide> } <ide> <del>exports.reconcileChildFibers = function(parent : Fiber, firstChild : ?Fiber, newChildren : ReactNodeList) : ?Fiber { <del> return createFirstChild(parent, newChildren); <add>exports.reconcileChildFibers = function(parent : Fiber, currentFirstChild : ?Fiber, newChildren : ReactNodeList) : ?Fiber { <add> return createFirstChild(parent, currentFirstChild, newChildren); <ide> }; <ide><path>src/renderers/shared/fiber/ReactFiberBeginWork.js <ide> var { <ide> YieldComponent, <ide> } = ReactTypesOfWork; <ide> <del>function updateFunctionalComponent(workInProgress) { <del> var fn = workInProgress.type; <del> var props = workInProgress.input; <del> console.log('update fn:', fn.name); <del> var nextChildren = fn(props); <del> <add>function reconcileChildren(current, workInProgress, nextChildren) { <ide> workInProgress.child = ReactChildFiber.reconcileChildFibers( <ide> workInProgress, <del> workInProgress.child, <add> current ? current.child : null, <ide> nextChildren <ide> ); <ide> } <ide> <del>function updateHostComponent(workInProgress) { <add>function updateFunctionalComponent(current, workInProgress) { <add> var fn = workInProgress.type; <add> var props = workInProgress.input; <add> console.log('update fn:', fn.name); <add> var nextChildren = fn(props); <add> reconcileChildren(current, workInProgress, nextChildren); <add>} <add> <add>function updateHostComponent(current, workInProgress) { <ide> console.log('host component', workInProgress.type, typeof workInProgress.input.children === 'string' ? workInProgress.input.children : ''); <ide> <ide> var nextChildren = workInProgress.input.children; <del> workInProgress.child = ReactChildFiber.reconcileChildFibers( <del> workInProgress, <del> workInProgress.child, <del> nextChildren <del> ); <add> reconcileChildren(current, workInProgress, nextChildren); <ide> } <ide> <del>function mountIndeterminateComponent(workInProgress) { <add>function mountIndeterminateComponent(current, workInProgress) { <ide> var fn = workInProgress.type; <ide> var props = workInProgress.input; <ide> var value = fn(props); <ide> function mountIndeterminateComponent(workInProgress) { <ide> // Proceed under the assumption that this is a functional component <ide> workInProgress.tag = FunctionalComponent; <ide> } <del> workInProgress.child = ReactChildFiber.reconcileChildFibers( <del> workInProgress, <del> workInProgress.child, <del> value <del> ); <add> reconcileChildren(current, workInProgress, value); <ide> } <ide> <del>function updateCoroutineComponent(workInProgress) { <add>function updateCoroutineComponent(current, workInProgress) { <ide> var coroutine = (workInProgress.input : ?ReactCoroutine); <ide> if (!coroutine) { <ide> throw new Error('Should be resolved by now'); <ide> } <ide> console.log('begin coroutine', workInProgress.type.name); <del> workInProgress.child = ReactChildFiber.reconcileChildFibers( <del> workInProgress, <del> workInProgress.child, <del> coroutine.children <del> ); <add> reconcileChildren(current, workInProgress, coroutine.children); <ide> } <ide> <del>function beginWork(workInProgress : Fiber) : ?Fiber { <del> const alt = workInProgress.alternate; <del> if (alt && workInProgress.input === alt.memoizedInput) { <add>function beginWork(current : ?Fiber, workInProgress : Fiber) : ?Fiber { <add> // The current, flushed, state of this fiber is the alternate. <add> // Ideally nothing should rely on this, but relying on it here <add> // means that we don't need an additional field on the work in <add> // progress. <add> if (current && workInProgress.input === current.memoizedInput) { <ide> // The most likely scenario is that the previous copy of the tree contains <ide> // the same input as the new one. In that case, we can just copy the output <ide> // and children from that node. <del> workInProgress.output = alt.output; <del> workInProgress.child = alt.child; <add> workInProgress.output = current.output; <add> workInProgress.child = current.child; <add> workInProgress.stateNode = current.stateNode; <ide> return null; <ide> } <ide> if (workInProgress.input === workInProgress.memoizedInput) { <ide> function beginWork(workInProgress : Fiber) : ?Fiber { <ide> } <ide> switch (workInProgress.tag) { <ide> case IndeterminateComponent: <del> mountIndeterminateComponent(workInProgress); <add> mountIndeterminateComponent(current, workInProgress); <ide> break; <ide> case FunctionalComponent: <del> updateFunctionalComponent(workInProgress); <add> updateFunctionalComponent(current, workInProgress); <ide> break; <ide> case ClassComponent: <ide> console.log('class component', workInProgress.input.type.name); <ide> break; <ide> case HostComponent: <del> updateHostComponent(workInProgress); <add> updateHostComponent(current, workInProgress); <ide> break; <ide> case CoroutineHandlerPhase: <ide> // This is a restart. Reset the tag to the initial phase. <ide> workInProgress.tag = CoroutineComponent; <ide> // Intentionally fall through since this is now the same. <ide> case CoroutineComponent: <del> updateCoroutineComponent(workInProgress); <add> updateCoroutineComponent(current, workInProgress); <ide> // This doesn't take arbitrary time so we could synchronously just begin <ide> // eagerly do the work of workInProgress.child as an optimization. <ide> if (workInProgress.child) { <del> return beginWork(workInProgress.child); <add> return beginWork( <add> workInProgress.child.alternate, <add> workInProgress.child <add> ); <ide> } <ide> break; <ide> case YieldComponent: <ide> // A yield component is just a placeholder, we can just run through the <ide> // next one immediately. <ide> if (workInProgress.sibling) { <del> return beginWork(workInProgress.sibling); <add> return beginWork( <add> workInProgress.sibling.alternate, <add> workInProgress.sibling <add> ); <ide> } <ide> return null; <ide> default: <ide><path>src/renderers/shared/fiber/ReactFiberCompleteWork.js <ide> function recursivelyFillYields(yields, output : ?Fiber | ?ReifiedYield) { <ide> } <ide> } <ide> <del>function moveCoroutineToHandlerPhase(workInProgress : Fiber) { <add>function moveCoroutineToHandlerPhase(current : ?Fiber, workInProgress : Fiber) { <ide> var coroutine = (workInProgress.input : ?ReactCoroutine); <ide> if (!coroutine) { <ide> throw new Error('Should be resolved by now'); <ide> function moveCoroutineToHandlerPhase(workInProgress : Fiber) { <ide> var props = coroutine.props; <ide> var nextChildren = fn(props, yields); <ide> <add> var currentFirstChild = current ? current.stateNode : null; <ide> workInProgress.stateNode = ReactChildFiber.reconcileChildFibers( <ide> workInProgress, <del> workInProgress.stateNode, <add> currentFirstChild, <ide> nextChildren <ide> ); <ide> return workInProgress.stateNode; <ide> } <ide> <del>exports.completeWork = function(workInProgress : Fiber) : ?Fiber { <add>exports.completeWork = function(current : ?Fiber, workInProgress : Fiber) : ?Fiber { <ide> switch (workInProgress.tag) { <ide> case FunctionalComponent: <ide> console.log('/functional component', workInProgress.type.name); <ide> exports.completeWork = function(workInProgress : Fiber) : ?Fiber { <ide> break; <ide> case CoroutineComponent: <ide> console.log('/coroutine component', workInProgress.input.handler.name); <del> return moveCoroutineToHandlerPhase(workInProgress); <add> return moveCoroutineToHandlerPhase(current, workInProgress); <ide> case CoroutineHandlerPhase: <ide> transferOutput(workInProgress.stateNode, workInProgress); <ide> // Reset the tag to now be a first phase coroutine. <ide><path>src/renderers/shared/fiber/ReactFiberReconciler.js <ide> module.exports = function<T, P, I>(config : HostConfig<T, P, I>) : Reconciler { <ide> <ide> function completeUnitOfWork(workInProgress : Fiber) : ?Fiber { <ide> while (true) { <del> var next = completeWork(workInProgress); <add> // The current, flushed, state of this fiber is the alternate. <add> // Ideally nothing should rely on this, but relying on it here <add> // means that we don't need an additional field on the work in <add> // progress. <add> const current = workInProgress.alternate; <add> const next = completeWork(current, workInProgress); <ide> if (next) { <ide> // If completing this work spawned new work, do that next. <ide> return next; <ide> module.exports = function<T, P, I>(config : HostConfig<T, P, I>) : Reconciler { <ide> } <ide> <ide> function performUnitOfWork(workInProgress : Fiber) : ?Fiber { <del> var next = beginWork(workInProgress); <add> // The current, flushed, state of this fiber is the alternate. <add> // Ideally nothing should rely on this, but relying on it here <add> // means that we don't need an additional field on the work in <add> // progress. <add> const current = workInProgress.alternate; <add> const next = beginWork(current, workInProgress); <ide> if (next) { <ide> // If this spawns new work, do that next. <ide> return next; <ide> module.exports = function<T, P, I>(config : HostConfig<T, P, I>) : Reconciler { <ide> // TODO: Unify this with ReactChildFiber. We can't now because the parent <ide> // is passed. Should be doable though. Might require a wrapper don't know. <ide> if (rootFiber && rootFiber.type === element.type && rootFiber.key === element.key) { <del> nextUnitOfWork = rootFiber; <del> rootFiber.input = element.props; <add> nextUnitOfWork = ReactFiber.cloneFiber(rootFiber); <add> nextUnitOfWork.input = element.props; <ide> return {}; <ide> } <ide>
4
Text
Text
clarify fast-track of reversions
41c45fd6d2fbd6c2bf6fcfe8fd8894031503e169
<ide><path>COLLABORATOR_GUIDE.md <ide> can be fast-tracked and may be landed after a shorter delay: <ide> * Focused changes that affect only documentation and/or the test suite. <ide> `code-and-learn` and `good-first-issue` pull requests typically fall <ide> into this category. <del>* Changes that revert commit(s) and/or fix regressions. <add>* Changes that fix regressions. <ide> <ide> When a pull request is deemed suitable to be fast-tracked, label it with <ide> `fast-track`. The pull request can be landed once 2 or more collaborators
1
Python
Python
remove unused fixture method
2b1978c8349bb08ca70109041d0fc0058352bc7b
<ide><path>libcloud/test/dns/test_gandi_live.py <ide> def test_list_records(self): <ide> self.assertEqual(record.id, 'A:@') <ide> self.assertEqual(record.name, '@') <ide> self.assertEqual(record.type, RecordType.A) <del> self.assertEqual(record.data, ['127.0.0.1']) <add> self.assertEqual(record.data, '127.0.0.1') <ide> record = records[1] <ide> self.assertEqual(record.id, 'CNAME:www') <ide> self.assertEqual(record.name, 'www') <ide> self.assertEqual(record.type, RecordType.CNAME) <del> self.assertEqual(record.data, ['bob.example.com.']) <add> self.assertEqual(record.data, 'bob.example.com.') <ide> record = records[2] <ide> self.assertEqual(record.id, 'A:bob') <ide> self.assertEqual(record.name, 'bob') <ide> self.assertEqual(record.type, RecordType.A) <del> self.assertEqual(record.data, ['127.0.1.1']) <add> self.assertEqual(record.data, '127.0.1.1') <ide> <ide> def test_get_record(self): <ide> record = self.driver.get_record(self.test_zone.id, 'A:bob') <ide> self.assertEqual(record.id, 'A:bob') <ide> self.assertEqual(record.name, 'bob') <ide> self.assertEqual(record.type, RecordType.A) <del> self.assertEqual(record.data, ['127.0.1.1']) <add> self.assertEqual(record.data, '127.0.1.1') <ide> <ide> def test_create_record(self): <ide> record = self.driver.create_record('alice', self.test_zone, 'AAAA', <ide> def test_create_record(self): <ide> self.assertEqual(record.id, 'AAAA:alice') <ide> self.assertEqual(record.name, 'alice') <ide> self.assertEqual(record.type, RecordType.AAAA) <del> self.assertEqual(record.data, ['::1']) <del> <del> def test_create_record_with_list(self): <del> record = self.driver.create_record('alice', self.test_zone, 'AAAA', <del> ['::1'], <del> extra={'ttl': 400}) <del> self.assertEqual(record.id, 'AAAA:alice') <del> self.assertEqual(record.name, 'alice') <del> self.assertEqual(record.type, RecordType.AAAA) <del> self.assertEqual(record.data, ['::1']) <add> self.assertEqual(record.data, '::1') <ide> <ide> def test_bad_record_validation(self): <ide> with self.assertRaises(RecordError) as ctx: <ide> def test_update_record(self): <ide> self.assertEqual(record.id, 'A:bob') <ide> self.assertEqual(record.name, 'bob') <ide> self.assertEqual(record.type, RecordType.A) <del> self.assertEqual(record.data, ['192.168.0.2']) <add> self.assertEqual(record.data, '192.168.0.2') <ide> <ide> def test_delete_record(self): <ide> success = self.driver.delete_record(self.test_record) <ide> def _json_api_v5_domains_example_org_patch(self, method, url, body, headers): <ide> body = self.fixtures.load('create_domain.json') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <del> def _json_api_v5_domains_badexample_com_patch(self, method, url, body, headers): <del> body = self.fixtures.load('create_domain.json') <del> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <del> <ide> def _json_api_v5_domains_example_com_records_get(self, method, url, body, <ide> headers): <ide> body = self.fixtures.load('list_records.json')
1
Javascript
Javascript
add test for getvisiblepanecontainers()
5c5fb28da136fce8535874701179ff495ed30893
<ide><path>spec/workspace-spec.js <ide> i = /test/; #FIXME\ <ide> }) <ide> }) <ide> <add> describe('::getVisiblePaneContainers', () => { <add> it('returns all visible pane containers', () => { <add> const center = workspace.getCenter() <add> const leftDock = workspace.getLeftDock() <add> const rightDock = workspace.getRightDock() <add> const bottomDock = workspace.getBottomDock() <add> <add> leftDock.hide() <add> rightDock.hide() <add> bottomDock.hide() <add> expect(workspace.getVisiblePaneContainers()).toEqual([center]) <add> <add> leftDock.show() <add> expect(workspace.getVisiblePaneContainers().sort()).toEqual([center, leftDock]) <add> <add> rightDock.show() <add> expect(workspace.getVisiblePaneContainers().sort()).toEqual([center, leftDock, rightDock]) <add> <add> bottomDock.show() <add> expect(workspace.getVisiblePaneContainers().sort()).toEqual([center, leftDock, rightDock, bottomDock]) <add> }) <add> }) <add> <ide> describe('when the core.allowPendingPaneItems option is falsey', () => { <ide> it('does not open item with `pending: true` option as pending', () => { <ide> let pane = null
1
Python
Python
add test for ticket
49728cd9286b10cbba3dce776fd83aea3e469e4b
<ide><path>numpy/core/tests/test_regression.py <ide> def test_fromiter_bytes(self): <ide> <ide> def test_array_too_big(self): <ide> """Ticket #1080.""" <del> assert_raises(ValueError,np.zeros,[2**10]*10) <add> assert_raises(ValueError, np.zeros, [2**10]*10) <add> <add> def test_dtype_keyerrors_(self): <add> """Ticket #1106.""" <add> dt = np.dtype([('f1', np.uint)]) <add> assert_raises(KeyError, dt.__getitem__, "f2") <add> assert_raises(IndexError, dt.__getitem__, 1) <add> assert_raises(ValueError, dt.__getitem__, 0.0) <ide> <ide> if __name__ == "__main__": <ide> run_module_suite()
1
PHP
PHP
implement cookie expiration
a17e51077264bd51dd5cb7a0544ef201898ffc78
<ide><path>lib/Cake/Network/Http/Cookies.php <ide> public function store(Response $response, $url) { <ide> <ide> $cookies = $response->cookies(); <ide> foreach ($cookies as $name => $cookie) { <add> if (empty($cookie['domain'])) { <add> $cookie['domain'] = $host; <add> } <add> if (empty($cookie['path'])) { <add> $cookie['path'] = $path; <add> } <add> $key = implode(';', [$cookie['name'], $cookie['domain'], $cookie['path']]); <add> <ide> $expires = isset($cookie['expires']) ? $cookie['expires'] : false; <ide> if ($expires) { <ide> $expires = \DateTime::createFromFormat('D, j-M-Y H:i:s e', $expires); <ide> } <ide> if ($expires && $expires->getTimestamp() <= time()) { <add> unset($this->_cookies[$key]); <ide> continue; <ide> } <del> if (empty($cookie['domain'])) { <del> $cookie['domain'] = $host; <del> } <del> if (empty($cookie['path'])) { <del> $cookie['path'] = $path; <del> } <del> $this->_cookies[] = $cookie; <add> $this->_cookies[$key] = $cookie; <ide> } <ide> } <ide> <ide> public function get($url) { <ide> * @return array <ide> */ <ide> public function getAll() { <del> return $this->_cookies; <add> return array_values($this->_cookies); <ide> } <ide> <ide> } <ide><path>lib/Cake/Test/TestCase/Network/Http/CookiesTest.php <ide> public function testStoreSecure() { <ide> $this->assertEquals($expected, $result); <ide> } <ide> <add>/** <add> * test storing an expired cookie clears existing ones too. <add> * <add> * @return void <add> */ <add> public function testStoreExpiring() { <add> $headers = [ <add> 'HTTP/1.0 200 Ok', <add> 'Set-Cookie: first=1', <add> 'Set-Cookie: second=2; Path=/', <add> ]; <add> $response = new Response($headers, ''); <add> $this->cookies->store($response, 'http://example.com/some/path'); <add> <add> $result = $this->cookies->getAll(); <add> $this->assertCount(2, $result); <add> <add> $headers = [ <add> 'HTTP/1.0 200 Ok', <add> 'Set-Cookie: first=1; Expires=Wed, 09-Jun-1999 10:18:14 GMT', <add> ]; <add> $response = new Response($headers, ''); <add> $this->cookies->store($response, 'http://example.com/'); <add> $result = $this->cookies->getAll(); <add> $this->assertCount(2, $result, 'Path does not match, no expiration'); <add> <add> $headers = [ <add> 'HTTP/1.0 200 Ok', <add> 'Set-Cookie: first=1; Domain=.foo.example.com; Expires=Wed, 09-Jun-1999 10:18:14 GMT', <add> ]; <add> $response = new Response($headers, ''); <add> $this->cookies->store($response, 'http://example.com/some/path'); <add> $result = $this->cookies->getAll(); <add> $this->assertCount(2, $result, 'Domain does not match, no expiration'); <add> <add> $headers = [ <add> 'HTTP/1.0 200 Ok', <add> 'Set-Cookie: first=1; Expires=Wed, 09-Jun-1999 10:18:14 GMT', <add> ]; <add> $response = new Response($headers, ''); <add> $this->cookies->store($response, 'http://example.com/some/path'); <add> $result = $this->cookies->getAll(); <add> $this->assertCount(1, $result, 'Domain does not match, no expiration'); <add> <add> $expected = [ <add> [ <add> 'name' => 'second', <add> 'value' => '2', <add> 'path' => '/', <add> 'domain' => 'example.com' <add> ], <add> ]; <add> $this->assertEquals($expected, $result); <add> } <add> <ide> /** <ide> * test getting cookies with secure flags <ide> * <ide> public function testGetMatchingPath() { <ide> <ide> /** <ide> * Test getting cookies matching on paths exactly <add> * <add> * @return void <ide> */ <del> public function testGetMatchingDomainExact() { <add> public function testGetMatchingDomain() { <ide> $headers = [ <ide> 'HTTP/1.0 200 Ok', <ide> 'Set-Cookie: first=1; Domain=.example.com', <ide> public function testGetMatchingDomainExact() { <ide> $this->assertEquals($expected, $result); <ide> } <ide> <del>/** <del> * Test getting cookies matching on paths <del> */ <del> public function testGetMatchingDomain() { <del> } <del> <del> <ide> }
2
PHP
PHP
remove unneeded casting
a224205c10b9b5bdb096ec696e55187eb7d03143
<ide><path>src/Database/Query.php <ide> public function setValueBinder(?ValueBinder $binder) <ide> public function enableBufferedResults(bool $enable = true) <ide> { <ide> $this->_dirty(); <del> $this->_useBufferedResults = (bool)$enable; <add> $this->_useBufferedResults = $enable; <ide> <ide> return $this; <ide> }
1
Text
Text
add hints for "install and set up mongoose"
7f3769f8e04421a55e8ecefab17cfec7be3805d8
<ide><path>guide/english/certifications/apis-and-microservices/mongodb-and-mongoose/install-and-set-up-mongoose/index.md <ide> --- <ide> title: Install and Set Up Mongoose <ide> --- <del>## Install and Set Up Mongoose <add># Install and Set Up Mongoose <ide> <ide> You might want to check both the [MongoDB](https://www.npmjs.com/package/mongodb) and the [Mongoose](https://www.npmjs.com/package/mongoose) NPM Repositories for the manual configuration if you are not using Giltch. <ide> <ide> OR <ide> 2. Once done add the MONGO_URL in .env file and save your path as <ide> ```` mongodb://<dbuser>:<dbpassword>@ds<PORT>.mlab.com:<PORT>/<DATABASE-NAME> ```` which you copy from mLab. Remember to remove the angle brackets ````< >```` when you replace your username and password of your database. <ide> <add>## Hints <ide> <add>### Hint #1 <add>**Timeout error** <ide> <del><!-- The article goes here, in GitHub-flavored Markdown. Feel free to add YouTube videos, images, and CodePen/JSBin embeds --> <add>If the tests are timing out, check the `package.json` file. Ensure the final dependency does not end in a `,`. <add> <add>For example, this will result in a timeout error: <add>``` <add>"dependencies": { <add> "express": "^4.12.4", <add> "body-parser": "^1.15.2", <add>}, <add>``` <add> <add>### Hint #2 <add>**add MONGO_URI to .env** <add>* Insert a line that looks similar to: `MONGO_URI=mongodb+srv://<username>:<password>@<clustername>-vlas9.mongodb.net/test?retryWrites=true`. `<username>` and `<clustername>` will be automatically generated by MongoDB. <add> <add>* Replace `<password>` with your password. There should be no `<>` characters (unless those are in your password). <add> <add>Still having issues? Check the below hints: <add> <add>* Remove spaces before and after `=`. This is correct: `MONGO_URI=mongodb...`. This is incorrect: `MONGO_URI = mongodb...` <add> <add>* Do you have symbols or special characters in your password, e.g. `$&(@`? If so, you will need to translate these into unicode. MongoDB has instructions on how to do this. I would suggest changing your password to be lettes and numbers only for simplicity. <add> <add> <add>## Solutions <add> <add><details><summary>Solution #1 (Click to Show/Hide)</summary> <add> <add>**.env** <add> <add>``` <add>GLITCH_DEBUGGER=true <add># Environment Config <add> <add># store your secrets and config variables in here <add># only invited collaborators will be able to see your .env values <add> <add># reference these in your code with process.env.SECRET <add>SECRET= <add>MADE_WITH= <add>MONGO_URI=mongodb+srv://<username>:<ENTERYOURPASSWORDHERE>@<clustername>-vlas9.mongodb.net/test?retryWrites=true <add># note: .env is a shell file so there can't be spaces around = <add>``` <add> <add>**package.json** <add> <add>```json <add>{ <add> "name": "fcc-mongo-mongoose-challenges", <add> "version": "0.0.1", <add> "description": "A boilerplate project", <add> "main": "server.js", <add> "scripts": { <add> "start": "node server.js" <add> }, <add> "dependencies": { <add> "express": "^4.12.4", <add> "body-parser": "^1.15.2", <add> "mongodb": "^3.0.0", <add> "mongoose": "^5.6.5" <add> }, <add> "engines": { <add> "node": "4.4.5" <add> }, <add> "repository": { <add> "type": "git", <add> "url": "https://hyperdev.com/#!/project/welcome-project" <add> }, <add> "keywords": [ <add> "node", <add> "hyperdev", <add> "express" <add> ], <add> "license": "MIT" <add>} <add>``` <add> <add>**myApp.js** <add> <add>```javascript <add>/** # MONGOOSE SETUP # <add>/* ================== */ <add> <add>/** 1) Install & Set up mongoose */ <add>const mongoose = require('mongoose'); <add>mongoose.connect(process.env.MONGO_URI); <add>``` <add></details> <add>
1
Java
Java
add pointerevents prop to rn android scroll views
48f6967ae88100110160e1faf03e6c0d37e404bd
<ide><path>ReactAndroid/src/main/java/com/facebook/react/uimanager/PointerEvents.java <ide> <ide> package com.facebook.react.uimanager; <ide> <add>import java.util.Locale; <add> <ide> /** <ide> * Possible values for pointer events that a view and its descendants should receive. See <ide> * https://developer.mozilla.org/en-US/docs/Web/CSS/pointer-events for more info. <ide> public enum PointerEvents { <ide> /** Container and all of its children receive touch events (like pointerEvents is unspecified). */ <ide> AUTO, <ide> ; <add> <add> public static PointerEvents parsePointerEvents(String pointerEventsStr) { <add> return PointerEvents.valueOf(pointerEventsStr.toUpperCase(Locale.US).replace("-", "_")); <add> } <add> <add> public static boolean canBeTouchTarget(PointerEvents pointerEvents) { <add> return pointerEvents == AUTO || pointerEvents == PointerEvents.BOX_ONLY; <add> } <add> <add> public static boolean canChildrenBeTouchTarget(PointerEvents pointerEvents) { <add> return pointerEvents == PointerEvents.AUTO || pointerEvents == PointerEvents.BOX_NONE; <add> } <ide> } <ide><path>ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollView.java <ide> import com.facebook.react.modules.i18nmanager.I18nUtil; <ide> import com.facebook.react.uimanager.FabricViewStateManager; <ide> import com.facebook.react.uimanager.MeasureSpecAssertions; <add>import com.facebook.react.uimanager.PointerEvents; <ide> import com.facebook.react.uimanager.ReactClippingViewGroup; <ide> import com.facebook.react.uimanager.ReactClippingViewGroupHelper; <ide> import com.facebook.react.uimanager.ReactOverflowViewWithInset; <ide> public class ReactHorizontalScrollView extends HorizontalScrollView <ide> private final FabricViewStateManager mFabricViewStateManager = new FabricViewStateManager(); <ide> private final ReactScrollViewScrollState mReactScrollViewScrollState; <ide> private final ValueAnimator DEFAULT_FLING_ANIMATOR = ObjectAnimator.ofInt(this, "scrollX", 0, 0); <add> private PointerEvents mPointerEvents = PointerEvents.AUTO; <ide> <ide> private final Rect mTempRect = new Rect(); <ide> <ide> public boolean onInterceptTouchEvent(MotionEvent ev) { <ide> return false; <ide> } <ide> <add> // We intercept the touch event if the children are not supposed to receive it. <add> if (!PointerEvents.canChildrenBeTouchTarget(mPointerEvents)) { <add> return true; <add> } <add> <ide> try { <ide> if (super.onInterceptTouchEvent(ev)) { <ide> NativeGestureUtil.notifyNativeGestureStarted(this, ev); <ide> public boolean onTouchEvent(MotionEvent ev) { <ide> return false; <ide> } <ide> <add> // We do not accept the touch event if this view is not supposed to receive it. <add> if (!PointerEvents.canBeTouchTarget(mPointerEvents)) { <add> return false; <add> } <add> <ide> mVelocityHelper.calculateVelocity(ev); <ide> int action = ev.getAction() & MotionEvent.ACTION_MASK; <ide> if (action == MotionEvent.ACTION_UP && mDragging) { <ide> public int getFlingExtrapolatedDistance(int velocityX) { <ide> this, velocityX, 0, Math.max(0, computeHorizontalScrollRange() - getWidth()), 0) <ide> .x; <ide> } <add> <add> public void setPointerEvents(PointerEvents pointerEvents) { <add> mPointerEvents = pointerEvents; <add> } <add> <add> public PointerEvents getPointerEvents() { <add> return mPointerEvents; <add> } <ide> } <ide><path>ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollViewManager.java <ide> import com.facebook.react.module.annotations.ReactModule; <ide> import com.facebook.react.uimanager.DisplayMetricsHolder; <ide> import com.facebook.react.uimanager.PixelUtil; <add>import com.facebook.react.uimanager.PointerEvents; <ide> import com.facebook.react.uimanager.ReactClippingViewGroupHelper; <ide> import com.facebook.react.uimanager.ReactStylesDiffMap; <ide> import com.facebook.react.uimanager.Spacing; <ide> public void setContentOffset(ReactHorizontalScrollView view, ReadableMap value) <ide> view.scrollTo(0, 0); <ide> } <ide> } <add> <add> @ReactProp(name = ViewProps.POINTER_EVENTS) <add> public void setPointerEvents(ReactHorizontalScrollView view, @Nullable String pointerEventsStr) { <add> if (pointerEventsStr == null) { <add> view.setPointerEvents(PointerEvents.AUTO); <add> } else { <add> view.setPointerEvents(PointerEvents.parsePointerEvents(pointerEventsStr)); <add> } <add> } <ide> } <ide><path>ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollView.java <ide> import com.facebook.react.common.ReactConstants; <ide> import com.facebook.react.uimanager.FabricViewStateManager; <ide> import com.facebook.react.uimanager.MeasureSpecAssertions; <add>import com.facebook.react.uimanager.PointerEvents; <ide> import com.facebook.react.uimanager.ReactClippingViewGroup; <ide> import com.facebook.react.uimanager.ReactClippingViewGroupHelper; <ide> import com.facebook.react.uimanager.ReactOverflowViewWithInset; <ide> public class ReactScrollView extends ScrollView <ide> private final ReactScrollViewScrollState mReactScrollViewScrollState = <ide> new ReactScrollViewScrollState(ViewCompat.LAYOUT_DIRECTION_LTR); <ide> private final ValueAnimator DEFAULT_FLING_ANIMATOR = ObjectAnimator.ofInt(this, "scrollY", 0, 0); <add> private PointerEvents mPointerEvents = PointerEvents.AUTO; <ide> <ide> public ReactScrollView(Context context) { <ide> this(context, null); <ide> public boolean onInterceptTouchEvent(MotionEvent ev) { <ide> return false; <ide> } <ide> <add> // We intercept the touch event if the children are not supposed to receive it. <add> if (!PointerEvents.canChildrenBeTouchTarget(mPointerEvents)) { <add> return true; <add> } <add> <ide> try { <ide> if (super.onInterceptTouchEvent(ev)) { <ide> NativeGestureUtil.notifyNativeGestureStarted(this, ev); <ide> public boolean onTouchEvent(MotionEvent ev) { <ide> return false; <ide> } <ide> <add> // We do not accept the touch event if this view is not supposed to receive it. <add> if (!PointerEvents.canBeTouchTarget(mPointerEvents)) { <add> return false; <add> } <add> <ide> mVelocityHelper.calculateVelocity(ev); <ide> int action = ev.getAction() & MotionEvent.ACTION_MASK; <ide> if (action == MotionEvent.ACTION_UP && mDragging) { <ide> public int getFlingExtrapolatedDistance(int velocityY) { <ide> return ReactScrollViewHelper.predictFinalScrollPosition(this, 0, velocityY, 0, getMaxScrollY()) <ide> .y; <ide> } <add> <add> public void setPointerEvents(PointerEvents pointerEvents) { <add> mPointerEvents = pointerEvents; <add> } <add> <add> public PointerEvents getPointerEvents() { <add> return mPointerEvents; <add> } <ide> } <ide><path>ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollViewManager.java <ide> import com.facebook.react.module.annotations.ReactModule; <ide> import com.facebook.react.uimanager.DisplayMetricsHolder; <ide> import com.facebook.react.uimanager.PixelUtil; <add>import com.facebook.react.uimanager.PointerEvents; <ide> import com.facebook.react.uimanager.ReactClippingViewGroupHelper; <ide> import com.facebook.react.uimanager.ReactStylesDiffMap; <ide> import com.facebook.react.uimanager.Spacing; <ide> public static Map<String, Object> createExportedCustomDirectEventTypeConstants() <ide> MapBuilder.of("registrationName", "onMomentumScrollEnd")) <ide> .build(); <ide> } <add> <add> @ReactProp(name = ViewProps.POINTER_EVENTS) <add> public void setPointerEvents(ReactScrollView view, @Nullable String pointerEventsStr) { <add> if (pointerEventsStr == null) { <add> view.setPointerEvents(PointerEvents.AUTO); <add> } else { <add> view.setPointerEvents(PointerEvents.parsePointerEvents(pointerEventsStr)); <add> } <add> } <ide> }
5
Javascript
Javascript
improve url parser benchmark
10ba95c11a9a3857f5e378e343b3febd107dae70
<ide><path>benchmark/url.js <del>var url = require('url'), <del> urls = [ <del> 'http://nodejs.org/docs/latest/api/url.html#url_url_format_urlobj', <del> 'http://blog.nodejs.org/', <del> 'https://encrypted.google.com/search?q=url&q=site:npmjs.org&hl=en', <del> 'javascript:alert("node is awesome");', <del> 'some.ran/dom/url.thing?oh=yes#whoo' <del> ], <del> paths = [ <del> '../foo/bar?baz=boom', <del> 'foo/bar', <del> 'http://nodejs.org', <del> './foo/bar?baz' <del> ]; <del> <del>urls.forEach(url.parse); <del>urls.forEach(url.format); <del>urls.forEach(function(u){ <del> paths.forEach(function(p){ <del> url.resolve(u, p); <del> }); <del>}); <ide>\ No newline at end of file <add>var util = require('util'); <add>var url = require('url') <add> <add>var urls = [ <add> 'http://nodejs.org/docs/latest/api/url.html#url_url_format_urlobj', <add> 'http://blog.nodejs.org/', <add> 'https://encrypted.google.com/search?q=url&q=site:npmjs.org&hl=en', <add> 'javascript:alert("node is awesome");', <add> 'some.ran/dom/url.thing?oh=yes#whoo' <add>]; <add> <add>var paths = [ <add> '../foo/bar?baz=boom', <add> 'foo/bar', <add> 'http://nodejs.org', <add> './foo/bar?baz' <add>]; <add> <add>benchmark('parse()', url.parse); <add>benchmark('format()', url.format); <add> <add>paths.forEach(function(p) { <add> benchmark('resolve("' + p + '")', function(u) { url.resolve(u, p) }); <add>}); <add> <add>function benchmark(name, fun) { <add> process.stdout.write('benchmarking ' + name + ' ... '); <add> <add> var timestamp = process.hrtime(); <add> for (var i = 0; i < 25 * 1000; ++i) { <add> for (var j = 0, k = urls.length; j < k; ++j) fun(urls[j]); <add> } <add> timestamp = process.hrtime(timestamp); <add> <add> var seconds = timestamp[0]; <add> var millis = timestamp[1]; // actually nanoseconds <add> while (millis > 1000) millis /= 10; <add> var time = (seconds * 1000 + millis) / 1000; <add> <add> process.stdout.write(util.format('%s sec\n', time.toFixed(3))); <add>}
1
Javascript
Javascript
remove some stray globals in d3.behavior.*
8223554e50a862ef5366b4461683b43578766799
<ide><path>d3.js <ide> d3.behavior.drag = function() { <ide> <ide> var d3_behavior_dragEvent, <ide> d3_behavior_dragTarget, <add> d3_behavior_dragArguments, <ide> d3_behavior_dragOffset, <ide> d3_behavior_dragMoved, <ide> d3_behavior_dragStopClick; <ide> function d3_behavior_dragMove() { <ide> function d3_behavior_dragUp() { <ide> if (!d3_behavior_dragTarget) return; <ide> d3_behavior_dragDispatch("dragend"); <del> d3_behavior_dragForce = d3_behavior_dragTarget = null; <add> d3_behavior_dragTarget = null; <ide> <ide> // If the node was moved, prevent the mouseup from propagating. <ide> // Also prevent the subsequent click from propagating (e.g., for anchors). <ide> var d3_behavior_zoomDiv, <ide> d3_behavior_zoomDispatch, <ide> d3_behavior_zoomTarget, <ide> d3_behavior_zoomArguments, <add> d3_behavior_zoomMoved, <ide> d3_behavior_zoomStopClick; <ide> <ide> function d3_behavior_zoomLocation(point) { <ide><path>d3.min.js <del>(function(){function dm(a,b,c){function i(a,b){var c=a.__domain||(a.__domain=a.domain()),d=a.range().map(function(a){return(a-b)/h});a.domain(c).domain(d.map(a.invert))}var d=Math.pow(2,(da[2]=a)-c[2]),e=da[0]=b[0]-d*c[0],f=da[1]=b[1]-d*c[1],g=d3.event,h=Math.pow(2,a);d3.event={scale:h,translate:[e,f],transform:function(a,b){a&&i(a,e),b&&i(b,f)}};try{db.apply(dc,dd)}finally{d3.event=g}g.preventDefault()}function dl(){de&&(d3.event.stopPropagation(),d3.event.preventDefault(),de=!1)}function dk(){cY&&(d3_behavior_zoomMoved&&(de=!0),dj(),cY=null)}function dj(){cZ=null,cY&&(d3_behavior_zoomMoved=!0,dm(da[2],d3.svg.mouse(dc),cY))}function di(){var a=d3.svg.touches(dc);switch(a.length){case 1:var b=a[0];dm(da[2],b,c$[b.identifier]);break;case 2:var c=a[0],d=a[1],e=[(c[0]+d[0])/2,(c[1]+d[1])/2],f=c$[c.identifier],g=c$[d.identifier],h=[(f[0]+g[0])/2,(f[1]+g[1])/2,f[2]];dm(Math.log(d3.event.scale)/Math.LN2+f[2],e,h)}}function dh(){var a=d3.svg.touches(dc),b=-1,c=a.length,d;while(++b<c)c$[(d=a[b]).identifier]=df(d);return a}function dg(){cX||(cX=d3.select("body").append("div").style("visibility","hidden").style("top",0).style("height",0).style("width",0).style("overflow-y","scroll").append("div").style("height","2000px").node().parentNode);var a=d3.event,b;try{cX.scrollTop=1e3,cX.dispatchEvent(a),b=1e3-cX.scrollTop}catch(c){b=a.wheelDelta||-a.detail}return b*.005}function df(a){return[a[0]-da[0],a[1]-da[1],da[2]]}function cW(){d3.event.stopPropagation(),d3.event.preventDefault()}function cV(){cQ&&(cW(),cQ=!1)}function cU(){!cN||(cR("dragend"),d3_behavior_dragForce=cN=null,cP&&(cQ=!0,cW()))}function cT(){if(!!cN){var a=cN.parentNode;if(!a)return cU();cR("drag"),cW()}}function cS(a){return d3.event.touches?d3.svg.touches(a)[0]:d3.svg.mouse(a)}function cR(a){var b=d3.event,c=cN.parentNode,d=0,e=0;c&&(c=cS(c),d=c[0]-cO[0],e=c[1]-cO[1],cO=c,cP|=d|e);try{d3.event={dx:d,dy:e},cM[a].dispatch.apply(cN,d3_behavior_dragArguments)}finally{d3.event=b}b.preventDefault()}function cL(a,b,c){e=[];if(c&&b.length>1){var d=bp(a.domain()),e,f=-1,g=b.length,h=(b[1]-b[0])/++c,i,j;while(++f<g)for(i=c;--i>0;)(j=+b[f]-i*h)>=d[0]&&e.push(j);for(--f,i=0;++i<c&&(j=+b[f]+i*h)<d[1];)e.push(j)}return e}function cK(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function cJ(a,b){a.attr("transform",function(a){return"translate("+b(a)+",0)"})}function cF(){return"circle"}function cE(){return 64}function cD(a,b){var c=(a.ownerSVGElement||a).createSVGPoint();if(cC<0&&(window.scrollX||window.scrollY)){var d=d3.select(document.body).append("svg:svg").style("position","absolute").style("top",0).style("left",0),e=d[0][0].getScreenCTM();cC=!e.f&&!e.e,d.remove()}cC?(c.x=b.pageX,c.y=b.pageY):(c.x=b.clientX,c.y=b.clientY),c=c.matrixTransform(a.getScreenCTM().inverse());return[c.x,c.y]}function cB(a){return function(){var b=a.apply(this,arguments),c=b[0],d=b[1]+bN;return[c*Math.cos(d),c*Math.sin(d)]}}function cA(a){return[a.x,a.y]}function cz(a){return a.endAngle}function cy(a){return a.startAngle}function cx(a){return a.radius}function cw(a){return a.target}function cv(a){return a.source}function cu(a){return function(b,c){return a[c][1]}}function ct(a){return function(b,c){return a[c][0]}}function cs(a){function i(f){if(f.length<1)return null;var i=bU(this,f,b,d),j=bU(this,f,b===c?ct(i):c,d===e?cu(i):e);return"M"+g(a(j),h)+"L"+g(a(i.reverse()),h)+"Z"}var b=bV,c=bV,d=0,e=bW,f="linear",g=bX[f],h=.7;i.x=function(a){if(!arguments.length)return c;b=c=a;return i},i.x0=function(a){if(!arguments.length)return b;b=a;return i},i.x1=function(a){if(!arguments.length)return c;c=a;return i},i.y=function(a){if(!arguments.length)return e;d=e=a;return i},i.y0=function(a){if(!arguments.length)return d;d=a;return i},i.y1=function(a){if(!arguments.length)return e;e=a;return i},i.interpolate=function(a){if(!arguments.length)return f;g=bX[f=a];return i},i.tension=function(a){if(!arguments.length)return h;h=a;return i};return i}function cr(a){var b,c=-1,d=a.length,e,f;while(++c<d)b=a[c],e=b[0],f=b[1]+bN,b[0]=e*Math.cos(f),b[1]=e*Math.sin(f);return a}function cq(a){return a.length<3?bY(a):a[0]+cc(a,cp(a))}function cp(a){var b=[],c,d,e,f,g=co(a),h=-1,i=a.length-1;while(++h<i)c=cn(a[h],a[h+1]),Math.abs(c)<1e-6?g[h]=g[h+1]=0:(d=g[h]/c,e=g[h+1]/c,f=d*d+e*e,f>9&&(f=c*3/Math.sqrt(f),g[h]=f*d,g[h+1]=f*e));h=-1;while(++h<=i)f=(a[Math.min(i,h+1)][0]-a[Math.max(0,h-1)][0])/(6*(1+g[h]*g[h])),b.push([f||0,g[h]*f||0]);return b}function co(a){var b=0,c=a.length-1,d=[],e=a[0],f=a[1],g=d[0]=cn(e,f);while(++b<c)d[b]=g+(g=cn(e=f,f=a[b+1]));d[b]=g;return d}function cn(a,b){return(b[1]-a[1])/(b[0]-a[0])}function cm(a,b,c){a.push("C",ci(cj,b),",",ci(cj,c),",",ci(ck,b),",",ci(ck,c),",",ci(cl,b),",",ci(cl,c))}function ci(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3]}function ch(a,b){var c=a.length-1,d=a[0][0],e=a[0][1],f=a[c][0]-d,g=a[c][1]-e,h=-1,i,j;while(++h<=c)i=a[h],j=h/c,i[0]=b*i[0]+(1-b)*(d+j*f),i[1]=b*i[1]+(1-b)*(e+j*g);return ce(a)}function cg(a){var b,c=-1,d=a.length,e=d+4,f,g=[],h=[];while(++c<4)f=a[c%d],g.push(f[0]),h.push(f[1]);b=[ci(cl,g),",",ci(cl,h)],--c;while(++c<e)f=a[c%d],g.shift(),g.push(f[0]),h.shift(),h.push(f[1]),cm(b,g,h);return b.join("")}function cf(a){if(a.length<4)return bY(a);var b=[],c=-1,d=a.length,e,f=[0],g=[0];while(++c<3)e=a[c],f.push(e[0]),g.push(e[1]);b.push(ci(cl,f)+","+ci(cl,g)),--c;while(++c<d)e=a[c],f.shift(),f.push(e[0]),g.shift(),g.push(e[1]),cm(b,f,g);return b.join("")}function ce(a){if(a.length<3)return bY(a);var b=[],c=1,d=a.length,e=a[0],f=e[0],g=e[1],h=[f,f,f,(e=a[1])[0]],i=[g,g,g,e[1]];b.push(f,",",g),cm(b,h,i);while(++c<d)e=a[c],h.shift(),h.push(e[0]),i.shift(),i.push(e[1]),cm(b,h,i);c=-1;while(++c<2)h.shift(),h.push(e[0]),i.shift(),i.push(e[1]),cm(b,h,i);return b.join("")}function cd(a,b){var c=[],d=(1-b)/2,e,f=a[0],g=a[1],h=1,i=a.length;while(++h<i)e=f,f=g,g=a[h],c.push([d*(g[0]-e[0]),d*(g[1]-e[1])]);return c}function cc(a,b){if(b.length<1||a.length!=b.length&&a.length!=b.length+2)return bY(a);var c=a.length!=b.length,d="",e=a[0],f=a[1],g=b[0],h=g,i=1;c&&(d+="Q"+(f[0]-g[0]*2/3)+","+(f[1]-g[1]*2/3)+","+f[0]+","+f[1],e=a[1],i=2);if(b.length>1){h=b[1],f=a[i],i++,d+="C"+(e[0]+g[0])+","+(e[1]+g[1])+","+(f[0]-h[0])+","+(f[1]-h[1])+","+f[0]+","+f[1];for(var j=2;j<b.length;j++,i++)f=a[i],h=b[j],d+="S"+(f[0]-h[0])+","+(f[1]-h[1])+","+f[0]+","+f[1]}if(c){var k=a[i];d+="Q"+(f[0]+h[0]*2/3)+","+(f[1]+h[1]*2/3)+","+k[0]+","+k[1]}return d}function cb(a,b,c){return a.length<3?bY(a):a[0]+cc(a,cd(a,b))}function ca(a,b){return a.length<3?bY(a):a[0]+cc((a.push(a[0]),a),cd([a[a.length-2]].concat(a,[a[1]]),b))}function b_(a,b){return a.length<4?bY(a):a[1]+cc(a.slice(1,a.length-1),cd(a,b))}function b$(a){var b=[],c=0,d=a.length,e=a[0];b.push(e[0],",",e[1]);while(++c<d)b.push("H",(e=a[c])[0],"V",e[1]);return b.join("")}function bZ(a){var b=[],c=0,d=a.length,e=a[0];b.push(e[0],",",e[1]);while(++c<d)b.push("V",(e=a[c])[1],"H",e[0]);return b.join("")}function bY(a){var b=[],c=0,d=a.length,e=a[0];b.push(e[0],",",e[1]);while(++c<d)b.push("L",(e=a[c])[0],",",e[1]);return b.join("")}function bW(a){return a[1]}function bV(a){return a[0]}function bU(a,b,c,d){var e=[],f=-1,g=b.length,h=typeof c=="function",i=typeof d=="function",j;if(h&&i)while(++f<g)e.push([c.call(a,j=b[f],f),d.call(a,j,f)]);else if(h)while(++f<g)e.push([c.call(a,b[f],f),d]);else if(i)while(++f<g)e.push([c,d.call(a,b[f],f)]);else while(++f<g)e.push([c,d]);return e}function bT(a){function g(d){return d.length<1?null:"M"+e(a(bU(this,d,b,c)),f)}var b=bV,c=bW,d="linear",e=bX[d],f=.7;g.x=function(a){if(!arguments.length)return b;b=a;return g},g.y=function(a){if(!arguments.length)return c;c=a;return g},g.interpolate=function(a){if(!arguments.length)return d;e=bX[d=a];return g},g.tension=function(a){if(!arguments.length)return f;f=a;return g};return g}function bS(a){return a.endAngle}function bR(a){return a.startAngle}function bQ(a){return a.outerRadius}function bP(a){return a.innerRadius}function bM(a,b,c){function g(){d=c.length/(b-a),e=c.length-1;return f}function f(b){return c[Math.max(0,Math.min(e,Math.floor(d*(b-a))))]}var d,e;f.domain=function(c){if(!arguments.length)return[a,b];a=+c[0],b=+c[c.length-1];return g()},f.range=function(a){if(!arguments.length)return c;c=a;return g()},f.copy=function(){return bM(a,b,c)};return g()}function bL(a,b){function e(a){return isNaN(a=+a)?NaN:b[d3.bisect(c,a)]}function d(){var d=0,f=a.length,g=b.length;c=[];while(++d<g)c[d-1]=d3.quantile(a,d/g);return e}var c;e.domain=function(b){if(!arguments.length)return a;a=b.filter(function(a){return!isNaN(a)}).sort(d3.ascending);return d()},e.range=function(a){if(!arguments.length)return b;b=a;return d()},e.quantiles=function(){return c},e.copy=function(){return bL(a,b)};return d()}function bG(a,b,c){function f(c){return d[((a[c]||(a[c]=++b))-1)%d.length]}var d,e;f.domain=function(d){if(!arguments.length)return d3.keys(a);a={},b=0;var e=-1,g=d.length,h;while(++e<g)a[h=d[e]]||(a[h]=++b);return f[c.t](c.x,c.p)},f.range=function(a){if(!arguments.length)return d;d=a,e=0,c={t:"range",x:a};return f},f.rangePoints=function(a,g){arguments.length<2&&(g=0);var h=a[0],i=a[1],j=(i-h)/(b-1+g);d=b<2?[(h+i)/2]:d3.range(h+j*g/2,i+j/2,j),e=0,c={t:"rangePoints",x:a,p:g};return f},f.rangeBands=function(a,g){arguments.length<2&&(g=0);var h=a[0],i=a[1],j=(i-h)/(b+g);d=d3.range(h+j*g,i,j),e=j*(1-g),c={t:"rangeBands",x:a,p:g};return f},f.rangeRoundBands=function(a,g){arguments.length<2&&(g=0);var h=a[0],i=a[1],j=Math.floor((i-h)/(b+g)),k=i-h-(b-g)*j;d=d3.range(h+Math.round(k/2),i,j),e=Math.round(j*(1-g)),c={t:"rangeRoundBands",x:a,p:g};return f},f.rangeBand=function(){return e},f.copy=function(){var d={},e;for(e in a)d[e]=a[e];return bG(d,b,c)};return f[c.t](c.x,c.p)}function bF(a){return function(b){return b<0?-Math.pow(-b,a):Math.pow(b,a)}}function bE(a,b){function e(b){return a(c(b))}var c=bF(b),d=bF(1/b);e.invert=function(b){return d(a.invert(b))},e.domain=function(b){if(!arguments.length)return a.domain().map(d);a.domain(b.map(c));return e},e.ticks=function(a){return bw(e.domain(),a)},e.tickFormat=function(a){return bx(e.domain(),a)},e.nice=function(){return e.domain(bq(e.domain(),bu))},e.exponent=function(a){if(!arguments.length)return b;var f=e.domain();c=bF(b=a),d=bF(1/b);return e.domain(f)},e.copy=function(){return bE(a.copy(),b)};return bt(e,a)}function bD(a){return a.toPrecision(1)}function bC(a){return-Math.log(-a)/Math.LN10}function bB(a){return Math.log(a)/Math.LN10}function bA(a,b){function d(c){return a(b(c))}var c=b.pow;d.invert=function(b){return c(a.invert(b))},d.domain=function(e){if(!arguments.length)return a.domain().map(c);b=e[0]<0?bC:bB,c=b.pow,a.domain(e.map(b));return d},d.nice=function(){a.domain(bq(a.domain(),br));return d},d.ticks=function(){var d=bp(a.domain()),e=[];if(d.every(isFinite)){var f=Math.floor(d[0]),g=Math.ceil(d[1]),h=c(d[0]),i=c(d[1]);if(b===bC){e.push(c(f));for(;f++<g;)for(var j=9;j>0;j--)e.push(c(f)*j)}else{for(;f<g;f++)for(var j=1;j<10;j++)e.push(c(f)*j);e.push(c(f))}for(f=0;e[f]<h;f++);for(g=e.length;e[g-1]>i;g--);e=e.slice(f,g)}return e},d.tickFormat=function(){return bD},d.copy=function(){return bA(a.copy(),b)};return bt(d,a)}function bz(a,b,c,d){var e=[],f=[],g=0,h=a.length;while(++g<h)e.push(c(a[g-1],a[g])),f.push(d(b[g-1],b[g]));return function(b){var c=d3.bisect(a,b,1,a.length-1)-1;return f[c](e[c](b))}}function by(a,b,c,d){var e=c(a[0],a[1]),f=d(b[0],b[1]);return function(a){return f(e(a))}}function bx(a,b){return d3.format(",."+Math.max(0,-Math.floor(Math.log(bv(a,b)[2])/Math.LN10+.01))+"f")}function bw(a,b){return d3.range.apply(d3,bv(a,b))}function bv(a,b){var c=bp(a),d=c[1]-c[0],e=Math.pow(10,Math.floor(Math.log(d/b)/Math.LN10)),f=b/d*e;f<=.15?e*=10:f<=.35?e*=5:f<=.75&&(e*=2),c[0]=Math.ceil(c[0]/e)*e,c[1]=Math.floor(c[1]/e)*e+e*.5,c[2]=e;return c}function bu(a){a=Math.pow(10,Math.round(Math.log(a)/Math.LN10)-1);return{floor:function(b){return Math.floor(b/a)*a},ceil:function(b){return Math.ceil(b/a)*a}}}function bt(a,b){a.range=d3.rebind(a,b.range),a.rangeRound=d3.rebind(a,b.rangeRound),a.interpolate=d3.rebind(a,b.interpolate),a.clamp=d3.rebind(a,b.clamp);return a}function bs(a,b,c,d){function h(a){return e(a)}function g(){var g=a.length==2?by:bz,i=d?G:F;e=g(a,b,i,c),f=g(b,a,i,d3.interpolate);return h}var e,f;h.invert=function(a){return f(a)},h.domain=function(b){if(!arguments.length)return a;a=b.map(Number);return g()},h.range=function(a){if(!arguments.length)return b;b=a;return g()},h.rangeRound=function(a){return h.range(a).interpolate(d3.interpolateRound)},h.clamp=function(a){if(!arguments.length)return d;d=a;return g()},h.interpolate=function(a){if(!arguments.length)return c;c=a;return g()},h.ticks=function(b){return bw(a,b)},h.tickFormat=function(b){return bx(a,b)},h.nice=function(){bq(a,bu);return g()},h.copy=function(){return bs(a,b,c,d)};return g()}function br(){return Math}function bq(a,b){var c=0,d=a.length-1,e=a[c],f=a[d],g;f<e&&(g=c,c=d,d=g,g=e,e=f,f=g),b=b(f-e),a[c]=b.floor(e),a[d]=b.ceil(f);return a}function bp(a){var b=a[0],c=a[a.length-1];return b<c?[b,c]:[c,b]}function bo(){}function bm(){var a=null,b=bi,c=Infinity;while(b)b.flush?b=a?a.next=b.next:bi=b.next:(c=Math.min(c,b.then+b.delay),b=(a=b).next);return c}function bl(){var a,b=Date.now(),c=bi;while(c)a=b-c.then,a>=c.delay&&(c.flush=c.callback(a)),c=c.next;var d=bm()-b;d>24?(isFinite(d)&&(clearTimeout(bk),bk=setTimeout(bl,d)),bj=0):(bj=1,bn(bl))}function bh(a){for(var b=0,c=this.length;b<c;b++)for(var d=this[b],e=0,f=d.length;e<f;e++){var g=d[e];g&&a.call(g=g.node,g.__data__,e,b)}return this}function bc(a){return typeof a=="function"?function(b,c,d){var e=a.call(this,b,c)+"";return d!=e&&d3.interpolate(d,e)}:(a=a+"",function(b,c,d){return d!=a&&d3.interpolate(d,a)})}function bb(a,b){e(a,bd);var c={},d=d3.dispatch("start","end"),f=bg;a.id=b,a.tween=function(b,d){if(arguments.length<2)return c[b];d==null?delete c[b]:c[b]=d;return a},a.ease=function(b){if(!arguments.length)return f;f=typeof b=="function"?b:d3.ease.apply(d3,arguments);return a},a.each=function(b,c){if(arguments.length<2)return bh.call(a,b);d[b].add(c);return a},d3.timer(function(e){a.each(function(g,h,i){function p(a){if(n.active!==b)return!0;var c=Math.min(1,(a-l)/m),e=f(c),i=j.length;while(--i>=0)j[i].call(k,e);if(c===1){n.active=0,n.owner===b&&delete k.__transition__,bf=b,d.end.dispatch.call(k,g,h),bf=0;return!0}}function o(a){if(n.active<=b){n.active=b,d.start.dispatch.call(k,g,h);for(var e in c)(e=c[e].call(k,g,h))&&j.push(e);l-=a,d3.timer(p)}return!0}var j=[],k=this,l=a[i][h].delay-e,m=a[i][h].duration,n=k.__transition__;n?n.owner<b&&(n.owner=b):n=k.__transition__={active:0,owner:b},l<=0?o(0):d3.timer(o,l)});return!0});return a}function ba(a){arguments.length||(a=d3.ascending);return function(b,c){return a(b&&b.__data__,c&&c.__data__)}}function $(a){e(a,_);return a}function Z(a){return{__data__:a}}function Y(a){return function(b){return U(a,b)}}function X(a){return function(b){return T(a,b)}}function S(a){e(a,V);return a}function R(a,b,c){function g(a){return Math.round(f(a)*255)}function f(a){a>360?a-=360:a<0&&(a+=360);return a<60?d+(e-d)*a/60:a<180?e:a<240?d+(e-d)*(240-a)/60:d}var d,e;a=a%360,a<0&&(a+=360),b=b<0?0:b>1?1:b,c=c<0?0:c>1?1:c,e=c<=.5?c*(1+b):c+b-c*b,d=2*c-e;return H(g(a+120),g(a),g(a-120))}function Q(a,b,c){this.h=a,this.s=b,this.l=c}function P(a,b,c){return new Q(a,b,c)}function M(a){var b=parseFloat(a);return a.charAt(a.length-1)==="%"?Math.round(b*2.55):b}function L(a,b,c){var d=Math.min(a/=255,b/=255,c/=255),e=Math.max(a,b,c),f=e-d,g,h,i=(e+d)/2;f?(h=i<.5?f/(e+d):f/(2-e-d),a==e?g=(b-c)/f+(b<c?6:0):b==e?g=(c-a)/f+2:g=(a-b)/f+4,g*=60):h=g=0;return P(g,h,i)}function K(a,b,c){var d=0,e=0,f=0,g,h,i;g=/([a-z]+)\((.*)\)/i.exec(a);if(g){h=g[2].split(",");switch(g[1]){case"hsl":return c(parseFloat(h[0]),parseFloat(h[1])/100,parseFloat(h[2])/100);case"rgb":return b(M(h[0]),M(h[1]),M(h[2]))}}if(i=N[a])return b(i.r,i.g,i.b);a!=null&&a.charAt(0)==="#"&&(a.length===4?(d=a.charAt(1),d+=d,e=a.charAt(2),e+=e,f=a.charAt(3),f+=f):a.length===7&&(d=a.substring(1,3),e=a.substring(3,5),f=a.substring(5,7)),d=parseInt(d,16),e=parseInt(e,16),f=parseInt(f,16));return b(d,e,f)}function J(a){return a<16?"0"+a.toString(16):a.toString(16)}function I(a,b,c){this.r=a,this.g=b,this.b=c}function H(a,b,c){return new I(a,b,c)}function G(a,b){b=b-(a=+a)?1/(b-a):0;return function(c){return Math.max(0,Math.min(1,(c-a)*b))}}function F(a,b){b=b-(a=+a)?1/(b-a):0;return function(c){return(c-a)*b}}function E(a){return a in D||/\bcolor\b/.test(a)?d3.interpolateRgb:d3.interpolate}function B(a){return a<1/2.75?7.5625*a*a:a<2/2.75?7.5625*(a-=1.5/2.75)*a+.75:a<2.5/2.75?7.5625*(a-=2.25/2.75)*a+.9375:7.5625*(a-=2.625/2.75)*a+.984375}function A(a){a||(a=1.70158);return function(b){return b*b*((a+1)*b-a)}}function z(a,b){var c;arguments.length<2&&(b=.45),arguments.length<1?(a=1,c=b/4):c=b/(2*Math.PI)*Math.asin(1/a);return function(d){return 1+a*Math.pow(2,10*-d)*Math.sin((d-c)*2*Math.PI/b)}}function y(a){return 1-Math.sqrt(1-a*a)}function x(a){return Math.pow(2,10*(a-1))}function w(a){return 1-Math.cos(a*Math.PI/2)}function v(a){return function(b){return Math.pow(b,a)}}function u(a){return a}function t(a){return function(b){return.5*(b<.5?a(2*b):2-a(2-2*b))}}function s(a){return function(b){return 1-a(1-b)}}function n(a){var b=a.lastIndexOf("."),c=b>=0?a.substring(b):(b=a.length,""),d=[];while(b>0)d.push(a.substring(b-=3,b+3));return d.reverse().join(",")+c}function m(a){return a+""}function j(a){var b={},c=[];b.add=function(a){for(var d=0;d<c.length;d++)if(c[d].listener==a)return b;c.push({listener:a,on:!0});return b},b.remove=function(a){for(var d=0;d<c.length;d++){var e=c[d];if(e.listener==a){e.on=!1,c=c.slice(0,d).concat(c.slice(d+1));break}}return b},b.dispatch=function(){var a=c;for(var b=0,d=a.length;b<d;b++){var e=a[b];e.on&&e.listener.apply(this,arguments)}};return b}function h(a){return a.replace(/(^\s+)|(\s+$)/g,"").replace(/\s+/g," ")}function g(a){return a==null}function f(a){return a.length}function c(a){return Array.prototype.slice.call(a)}function b(a){var b=-1,c=a.length,d=[];while(++b<c)d.push(a[b]);return d}d3={version:"2.0.0"},Date.now||(Date.now=function(){return+(new Date)}),Object.create||(Object.create=function(a){function b(){}b.prototype=a;return new b});var a=c;try{a(document.documentElement.childNodes)[0].nodeType}catch(d){a=b}var e=[].__proto__?function(a,b){a.__proto__=b}:function(a,b){for(var c in b)a[c]=b[c]};d3.functor=function(a){return typeof a=="function"?a:function(){return a}},d3.rebind=function(a,b){return function(){var c=b.apply(a,arguments);return arguments.length?a:c}},d3.ascending=function(a,b){return a<b?-1:a>b?1:a>=b?0:NaN},d3.descending=function(a,b){return b<a?-1:b>a?1:b>=a?0:NaN},d3.min=function(a,b){var c=-1,d=a.length,e,f;if(arguments.length===1){while(++c<d&&((e=a[c])==null||e!=e))e=undefined;while(++c<d)(f=a[c])!=null&&e>f&&(e=f)}else{while(++c<d&&((e=b.call(a,a[c],c))==null||e!=e))e=undefined;while(++c<d)(f=b.call(a,a[c],c))!=null&&e>f&&(e=f)}return e},d3.max=function(a,b){var c=-1,d=a.length,e,f;if(arguments.length===1){while(++c<d&&((e=a[c])==null||e!=e))e=undefined;while(++c<d)(f=a[c])!=null&&f>e&&(e=f)}else{while(++c<d&&((e=b.call(a,a[c],c))==null||e!=e))e=undefined;while(++c<d)(f=b.call(a,a[c],c))!=null&&f>e&&(e=f)}return e},d3.sum=function(a,b){var c=0,d=a.length,e,f=-1;if(arguments.length===1)while(++f<d)isNaN(e=+a[f])||(c+=e);else while(++f<d)isNaN(e=+b.call(a,a[f],f))||(c+=e);return c},d3.quantile=function(a,b){var c=(a.length-1)*b+1,d=Math.floor(c),e=a[d-1],f=c-d;return f?e+f*(a[d]-e):e},d3.zip=function(){if(!(e=arguments.length))return[];for(var a=-1,b=d3.min(arguments,f),c=Array(b);++a<b;)for(var d=-1,e,g=c[a]=Array(e);++d<e;)g[d]=arguments[d][a];return c},d3.bisectLeft=function(a,b,c,d){arguments.length<3&&(c=0),arguments.length<4&&(d=a.length);while(c<d){var e=c+d>>1;a[e]<b?c=e+1:d=e}return c},d3.bisect=d3.bisectRight=function(a,b,c,d){arguments.length<3&&(c=0),arguments.length<4&&(d=a.length);while(c<d){var e=c+d>>1;b<a[e]?d=e:c=e+1}return c},d3.first=function(a,b){var c=0,d=a.length,e=a[0],f;arguments.length===1&&(b=d3.ascending);while(++c<d)b.call(a,e,f=a[c])>0&&(e=f);return e},d3.last=function(a,b){var c=0,d=a.length,e=a[0],f;arguments.length===1&&(b=d3.ascending);while(++c<d)b.call(a,e,f=a[c])<=0&&(e=f);return e},d3.nest=function(){function g(a,d){if(d>=b.length)return a;var e=[],f=c[d++],h;for(h in a)e.push({key:h,values:g(a[h],d)});f&&e.sort(function(a,b){return f(a.key,b.key)});return e}function f(c,g){if(g>=b.length)return e?e.call(a,c):d?c.sort(d):c;var h=-1,i=c.length,j=b[g++],k,l,m={};while(++h<i)(k=j(l=c[h]))in m?m[k].push(l):m[k]=[l];for(k in m)m[k]=f(m[k],g);return m}var a={},b=[],c=[],d,e;a.map=function(a){return f(a,0)},a.entries=function(a){return g(f(a,0),0)},a.key=function(c){b.push(c);return a},a.sortKeys=function(d){c[b.length-1]=d;return a},a.sortValues=function(b){d=b;return a},a.rollup=function(b){e=b;return a};return a},d3.keys=function(a){var b=[];for(var c in a)b.push(c);return b},d3.values=function(a){var b=[];for(var c in a)b.push(a[c]);return b},d3.entries=function(a){var b=[];for(var c in a)b.push({key:c,value:a[c]});return b},d3.permute=function(a,b){var c=[],d=-1,e=b.length;while(++d<e)c[d]=a[b[d]];return c},d3.merge=function(a){return Array.prototype.concat.apply([],a)},d3.split=function(a,b){var c=[],d=[],e,f=-1,h=a.length;arguments.length<2&&(b=g);while(++f<h)b.call(d,e=a[f],f)?d=[]:(d.length||c.push(d),d.push(e));return c},d3.range=function(a,b,c){arguments.length<3&&(c=1,arguments.length<2&&(b=a,a=0));if((b-a)/c==Infinity)throw new Error("infinite range");var d=[],e=-1,f;if(c<0)while((f=a+c*++e)>b)d.push(f);else while((f=a+c*++e)<b)d.push(f);return d},d3.requote=function(a){return a.replace(i,"\\$&")};var i=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;d3.round=function(a,b){return b?Math.round(a*Math.pow(10,b))*Math.pow(10,-b):Math.round(a)},d3.xhr=function(a,b,c){var d=new XMLHttpRequest;arguments.length<3?c=b:b&&d.overrideMimeType&&d.overrideMimeType(b),d.open("GET",a,!0),d.onreadystatechange=function(){d.readyState===4&&c(d.status<300?d:null)},d.send(null)},d3.text=function(a,b,c){function d(a){c(a&&a.responseText)}arguments.length<3&&(c=b,b=null),d3.xhr(a,b,d)},d3.json=function(a,b){d3.text(a,"application/json",function(a){b(a?JSON.parse(a):null)})},d3.html=function(a,b){d3.text(a,"text/html",function(a){if(a!=null){var c=document.createRange();c.selectNode(document.body),a=c.createContextualFragment(a)}b(a)})},d3.xml=function(a,b,c){function d(a){c(a&&a.responseXML)}arguments.length<3&&(c=b,b=null),d3.xhr(a,b,d)},d3.ns={prefix:{svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},qualify:function(a){var b=a.indexOf(":");return b<0?a:{space:d3.ns.prefix[a.substring(0,b)],local:a.substring(b+1)}}},d3.dispatch=function(a){var b={},c;for(var d=0,e=arguments.length;d<e;d++)c=arguments[d],b[c]=j(c);return b},d3.format=function(a){var b=k.exec(a),c=b[1]||" ",d=b[3]||"",e=b[5],f=+b[6],g=b[7],h=b[8],i=b[9],j=!1,o=!1;h&&(h=h.substring(1)),e&&(c="0",g&&(f-=Math.floor((f-1)/4)));switch(i){case"n":g=!0,i="g";break;case"%":j=!0,i="f";break;case"p":j=!0,i="r";break;case"d":o=!0,h="0"}i=l[i]||m;return function(a){var b=j?a*100:+a,k=b<0&&(b=-b)?"−":d;if(o&&b%1)return"";a=i(b,h);if(e){var l=a.length+k.length;l<f&&(a=Array(f-l+1).join(c)+a),g&&(a=n(a)),a=k+a}else{g&&(a=n(a)),a=k+a;var l=a.length;l<f&&(a=Array(f-l+1).join(c)+a)}j&&(a+="%");return a}};var k=/(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/,l={g:function(a,b){return a.toPrecision(b)},e:function(a,b){return a.toExponential(b)},f:function(a,b){return a.toFixed(b)},r:function(a,b){var c=1+Math.floor(1e-15+Math.log(a)/Math.LN10);return d3.round(a,b-c).toFixed(Math.max(0,Math.min(20,b-c)))}},o=v(2),p=v(3),q={linear:function(){return u},poly:v,quad:function(){return o},cubic:function(){return p},sin:function(){return w},exp:function(){return x},circle:function(){return y},elastic:z,back:A,bounce:function(){return B}},r={"in":function(a){return a},out:s,"in-out":t,"out-in":function(a){return t(s(a))}};d3.ease=function(a){var b=a.indexOf("-"),c=b>=0?a.substring(0,b):a,d=b>=0?a.substring(b+1):"in";return r[d](q[c].apply(null,Array.prototype.slice.call(arguments,1)))},d3.event=null,d3.interpolate=function(a,b){var c=d3.interpolators.length,d;while(--c>=0&&!(d=d3.interpolators[c](a,b)));return d},d3.interpolateNumber=function(a,b){b-=a;return function(c){return a+b*c}},d3.interpolateRound=function(a,b){b-=a;return function(c){return Math.round(a+b*c)}},d3.interpolateString=function(a,b){var c,d,e,f=0,g=0,h=[],i=[],j,k;C.lastIndex=0;for(d=0;c=C.exec(b);++d)c.index&&h.push(b.substring(f,g=c.index)),i.push({i:h.length,x:c[0]}),h.push(null),f=C.lastIndex;f<b.length&&h.push(b.substring(f));for(d=0,j=i.length;(c=C.exec(a))&&d<j;++d){k=i[d];if(k.x==c[0]){if(k.i)if(h[k.i+1]==null){h[k.i-1]+=k.x,h.splice(k.i,1);for(e=d+1;e<j;++e)i[e].i--}else{h[k.i-1]+=k.x+h[k.i+1],h.splice(k.i,2);for(e=d+1;e<j;++e)i[e].i-=2}else if(h[k.i+1]==null)h[k.i]=k.x;else{h[k.i]=k.x+h[k.i+1],h.splice(k.i+1,1);for(e=d+1;e<j;++e)i[e].i--}i.splice(d,1),j--,d--}else k.x=d3.interpolateNumber(parseFloat(c[0]),parseFloat(k.x))}while(d<j)k=i.pop(),h[k.i+1]==null?h[k.i]=k.x:(h[k.i]=k.x+h[k.i+1],h.splice(k.i+1,1)),j--;return h.length===1?h[0]==null?i[0].x:function(){return b}:function(a){for(d=0;d<j;++d)h[(k=i[d]).i]=k.x(a);return h.join("")}},d3.interpolateRgb=function(a,b){a=d3.rgb(a),b=d3.rgb(b);var c=a.r,d=a.g,e=a.b,f=b.r-c,g=b.g-d,h=b.b-e;return function(a){return"rgb("+Math.round(c+f*a)+","+Math.round(d+g*a)+","+Math.round(e+h*a)+")"}},d3.interpolateHsl=function(a,b){a=d3.hsl(a),b=d3.hsl(b);var c=a.h,d=a.s,e=a.l,f=b.h-c,g=b.s-d,h=b.l-e;return function(a){return R(c+f*a,d+g*a,e+h*a).toString()}},d3.interpolateArray=function(a,b){var c=[],d=[],e=a.length,f=b.length,g=Math.min(a.length,b.length),h;for(h=0;h<g;++h)c.push(d3.interpolate(a[h],b[h]));for(;h<e;++h)d[h]=a[h];for(;h<f;++h)d[h]=b[h];return function(a){for(h=0;h<g;++h)d[h]=c[h](a);return d}},d3.interpolateObject=function(a,b){var c={},d={},e;for(e in a)e in b?c[e]=E(e)(a[e],b[e]):d[e]=a[e];for(e in b)e in a||(d[e]=b[e]);return function(a){for(e in c)d[e]=c[e](a);return d}};var C=/[-+]?(?:\d+\.\d+|\d+\.|\.\d+|\d+)(?:[eE][-]?\d+)?/g,D={background:1,fill:1,stroke:1};d3.interpolators=[d3.interpolateObject,function(a,b){return b instanceof Array&&d3.interpolateArray(a,b)},function(a,b){return typeof b=="string"&&d3.interpolateString(String(a),b)},function(a,b){return(typeof b=="string"?b in N||/^(#|rgb\(|hsl\()/.test(b):b instanceof I||b instanceof Q)&&d3.interpolateRgb(String(a),b)},function(a,b){return typeof b=="number"&&d3.interpolateNumber(+a,b)}],d3.rgb=function(a,b,c){return arguments.length===1?K(""+a,H,R):H(~~a,~~b,~~c)},I.prototype.brighter=function(a){a=Math.pow(.7,arguments.length?a:1);var b=this.r,c=this.g,d=this.b,e=30;if(!b&&!c&&!d)return H(e,e,e);b&&b<e&&(b=e),c&&c<e&&(c=e),d&&d<e&&(d=e);return H(Math.min(255,Math.floor(b/a)),Math.min(255,Math.floor(c/a)),Math.min(255,Math.floor(d/a)))},I.prototype.darker=function(a){a=Math.pow(.7,arguments.length?a:1);return H(Math.max(0,Math.floor(a*this.r)),Math.max(0,Math.floor(a*this.g)),Math.max(0,Math.floor(a*this.b)))},I.prototype.hsl=function(){return L(this.r,this.g,this.b)},I.prototype.toString=function(){return"#"+J(this.r)+J(this.g)+J(this.b)};var N={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};for(var O in N)N[O]=K(N[O],H,R);d3.hsl=function(a,b,c){return arguments.length===1?K(""+a,L,P):P(+a,+b,+c)},Q.prototype.brighter=function(a){a=Math.pow(.7,arguments.length?a:1);return P(this.h,this.s,this.l/a)},Q.prototype.darker=function(a){a=Math.pow(.7,arguments.length?a:1);return P(this.h,this.s,a*this.l)},Q.prototype.rgb=function(){return R(this.h,this.s,this.l)},Q.prototype.toString=function(){return"hsl("+this.h+","+this.s*100+"%,"+this.l*100+"%)"},d3.select=function(a){return typeof a=="string"?W.select(a):S([[a]])},d3.selectAll=function(b){return typeof b=="string"?W.selectAll(b):S([a(b)])};var T=function(a,b){return b.querySelector(a)},U=function(b,c){return a(c.querySelectorAll(b))};typeof Sizzle=="function"&&(T=function(a,b){return Sizzle(a,b)[0]},U=function(a,b){return Sizzle.uniqueSort(Sizzle(a,b))});var V=[],W=S([[document]]);W[0].parentNode=document.documentElement,d3.selection=function(){return W},d3.selection.prototype=V,V.select=function(a){var b=[],c,d,e,f;typeof a!="function"&&(a=X(a));for(var g=-1,h=this.length;++g<h;){b.push(c=[]),c.parentNode=(e=this[g]).parentNode;for(var i=-1,j=e.length;++i<j;)(f=e[i])?(c.push(d=a(f)),d&&"__data__"in f&&(d.__data__=f.__data__)):c.push(null)}return S(b)},V.selectAll=function(a){var b=[],c,d;typeof a!="function"&&(a=Y(a));for(var e=-1,f=this.length;++e<f;)for(var g=this[e],h=-1,i=g.length;++h<i;)if(d=g[h])b.push(c=a(d)),c.parentNode=d;return S(b)},V.attr=function(a,b){function i(){var c=b.apply(this,arguments);c==null?this.removeAttributeNS(a.space,a.local):this.setAttributeNS(a.space,a.local,c)}function h(){var c=b.apply(this,arguments);c==null?this.removeAttribute(a):this.setAttribute(a,c)}function g(){this.setAttributeNS(a.space,a.local,b)}function f(){this.setAttribute(a,b)}function e(){this.removeAttributeNS(a.space,a.local)}function d(){this.removeAttribute(a)}a=d3.ns.qualify(a);if(arguments.length<2){var c=this.node();return a.local?c.getAttributeNS(a.space,a.local):c.getAttribute(a)}return this.each(b==null?a.local?e:d:typeof b=="function"?a.local?i:h:a.local?g:f)},V.classed=function(a,b){function i(){(b.apply(this,arguments)?f:g).call(this)}function g(){if(b=this.classList)return b.remove(a);var b=this.className,d=b.baseVal!=null,e=d?b.baseVal:b;e=h(e.replace(c," ")),d?b.baseVal=e:this.className=e}function f(){if(b=this.classList)return b.add(a);var b=this.className <del>,d=b.baseVal!=null,e=d?b.baseVal:b;c.lastIndex=0,c.test(e)||(e=h(e+" "+a),d?b.baseVal=e:this.className=e)}var c=new RegExp("(^|\\s+)"+d3.requote(a)+"(\\s+|$)","g");if(arguments.length<2){var d=this.node();if(e=d.classList)return e.contains(a);var e=d.className;c.lastIndex=0;return c.test(e.baseVal!=null?e.baseVal:e)}return this.each(typeof b=="function"?i:b?f:g)},V.style=function(a,b,c){function f(){var d=b.apply(this,arguments);d==null?this.style.removeProperty(a):this.style.setProperty(a,d,c)}function e(){this.style.setProperty(a,b,c)}function d(){this.style.removeProperty(a)}arguments.length<3&&(c="");return arguments.length<2?window.getComputedStyle(this.node(),null).getPropertyValue(a):this.each(b==null?d:typeof b=="function"?f:e)},V.property=function(a,b){function e(){var c=b.apply(this,arguments);c==null?delete this[a]:this[a]=c}function d(){this[a]=b}function c(){delete this[a]}return arguments.length<2?this.node()[a]:this.each(b==null?c:typeof b=="function"?e:d)},V.text=function(a){return arguments.length<1?this.node().textContent:this.each(typeof a=="function"?function(){this.textContent=a.apply(this,arguments)}:function(){this.textContent=a})},V.html=function(a){return arguments.length<1?this.node().innerHTML:this.each(typeof a=="function"?function(){this.innerHTML=a.apply(this,arguments)}:function(){this.innerHTML=a})},V.append=function(a){function c(b){return b.appendChild(document.createElementNS(a.space,a.local))}function b(b){return b.appendChild(document.createElement(a))}a=d3.ns.qualify(a);return this.select(a.local?c:b)},V.insert=function(a,b){function d(c){return c.insertBefore(document.createElementNS(a.space,a.local),T(b,c))}function c(c){return c.insertBefore(document.createElement(a),T(b,c))}a=d3.ns.qualify(a);return this.select(a.local?d:c)},V.remove=function(){return this.each(function(){var a=this.parentNode;a&&a.removeChild(this)})},V.data=function(a,b){function f(a,f){var g,h=a.length,i=f.length,j=Math.min(h,i),k=Math.max(h,i),l=[],m=[],n=[],o,p;if(b){var q={},r=[],s,t=f.length;for(g=-1;++g<h;)s=b.call(o=a[g],o.__data__,g),s in q?n[t++]=o:q[s]=o,r.push(s);for(g=-1;++g<i;)o=q[s=b.call(f,p=f[g],g)],o?(o.__data__=p,l[g]=o,m[g]=n[g]=null):(m[g]=Z(p),l[g]=n[g]=null),delete q[s];for(g=-1;++g<h;)r[g]in q&&(n[g]=a[g])}else{for(g=-1;++g<j;)o=a[g],p=f[g],o?(o.__data__=p,l[g]=o,m[g]=n[g]=null):(m[g]=Z(p),l[g]=n[g]=null);for(;g<i;++g)m[g]=Z(f[g]),l[g]=n[g]=null;for(;g<k;++g)n[g]=a[g],m[g]=l[g]=null}m.update=l,m.parentNode=l.parentNode=n.parentNode=a.parentNode,c.push(m),d.push(l),e.push(n)}var c=[],d=[],e=[],g=-1,h=this.length,i;if(typeof a=="function")while(++g<h)f(i=this[g],a.call(i,i.parentNode.__data__,g));else while(++g<h)f(i=this[g],a);var j=S(d);j.enter=function(){return $(c)},j.exit=function(){return S(e)};return j};var _=[];_.append=V.append,_.insert=V.insert,_.empty=V.empty,_.select=function(a){var b=[],c,d,e,f,g;for(var h=-1,i=this.length;++h<i;){e=(f=this[h]).update,b.push(c=[]),c.parentNode=f.parentNode;for(var j=-1,k=f.length;++j<k;)(g=f[j])?(c.push(e[j]=d=a(f.parentNode)),d.__data__=g.__data__):c.push(null)}return S(b)},V.filter=function(a){var b=[],c,d,e;for(var f=0,g=this.length;f<g;f++){b.push(c=[]),c.parentNode=(d=this[f]).parentNode;for(var h=0,i=d.length;h<i;h++)(e=d[h])&&a.call(e,e.__data__,h)&&c.push(e)}return S(b)},V.map=function(a){return this.each(function(){this.__data__=a.apply(this,arguments)})},V.sort=function(a){a=ba.apply(this,arguments);for(var b=0,c=this.length;b<c;b++)for(var d=this[b].sort(a),e=1,f=d.length,g=d[0];e<f;e++){var h=d[e];h&&(g&&g.parentNode.insertBefore(h,g.nextSibling),g=h)}return this},V.on=function(a,b,c){arguments.length<3&&(c=!1);var d="__on"+a,e=a.indexOf(".");e>0&&(a=a.substring(0,e));return arguments.length<2?(e=this.node()[d])&&e._:this.each(function(e,f){function h(a){var c=d3.event;d3.event=a;try{b.call(g,g.__data__,f)}finally{d3.event=c}}var g=this;g[d]&&g.removeEventListener(a,g[d],c),b&&g.addEventListener(a,g[d]=h,c),h._=b})},V.each=function(a){for(var b=-1,c=this.length;++b<c;)for(var d=this[b],e=-1,f=d.length;++e<f;){var g=d[e];g&&a.call(g,g.__data__,e,b)}return this},V.call=function(a){a.apply(this,(arguments[0]=this,arguments));return this},V.empty=function(){return!this.node()},V.node=function(a){for(var b=0,c=this.length;b<c;b++)for(var d=this[b],e=0,f=d.length;e<f;e++){var g=d[e];if(g)return g}return null},V.transition=function(){var a=[],b,c;for(var d=-1,e=this.length;++d<e;){a.push(b=[]);for(var f=this[d],g=-1,h=f.length;++g<h;)b.push((c=f[g])?{node:c,delay:0,duration:250}:null)}return bb(a,bf||++be)};var bd=[],be=0,bf=0,bg=d3.ease("cubic-in-out");bd.call=V.call,d3.transition=function(){return W.transition()},d3.transition.prototype=bd,bd.select=function(a){var b=[],c,d,e;typeof a!="function"&&(a=X(a));for(var f=-1,g=this.length;++f<g;){b.push(c=[]);for(var h=this[f],i=-1,j=h.length;++i<j;)(e=h[i])&&(d=a(e.node))?("__data__"in e.node&&(d.__data__=e.node.__data__),c.push({node:d,delay:e.delay,duration:e.duration})):c.push(null)}return bb(b,this.id).ease(this.ease())},bd.selectAll=function(a){var b=[],c,d;typeof a!="function"&&(a=Y(a));for(var e=-1,f=this.length;++e<f;)for(var g=this[e],h=-1,i=g.length;++h<i;)if(d=g[h]){b.push(c=a(d.node));for(var j=-1,k=c.length;++j<k;)c[j]={node:c[j],delay:d.delay,duration:d.duration}}return bb(b,this.id).ease(this.ease())},bd.attr=function(a,b){return this.attrTween(a,bc(b))},bd.attrTween=function(a,b){function d(c,d){var e=b.call(this,c,d,this.getAttributeNS(a.space,a.local));return e&&function(b){this.setAttributeNS(a.space,a.local,e(b))}}function c(c,d){var e=b.call(this,c,d,this.getAttribute(a));return e&&function(b){this.setAttribute(a,e(b))}}a=d3.ns.qualify(a);return this.tween("attr."+a,a.local?d:c)},bd.style=function(a,b,c){arguments.length<3&&(c=null);return this.styleTween(a,bc(b),c)},bd.styleTween=function(a,b,c){arguments.length<3&&(c=null);return this.tween("style."+a,function(d,e){var f=b.call(this,d,e,window.getComputedStyle(this,null).getPropertyValue(a));return f&&function(b){this.style.setProperty(a,f(b),c)}})},bd.text=function(a){return this.tween("text",function(b,c){this.textContent=typeof a=="function"?a.call(this,b,c):a})},bd.remove=function(){return this.each("end",function(){var a;!this.__transition__&&(a=this.parentNode)&&a.removeChild(this)})},bd.delay=function(a){var b=this;return b.each(typeof a=="function"?function(c,d,e){b[e][d].delay=+a.apply(this,arguments)}:(a=+a,function(c,d,e){b[e][d].delay=a}))},bd.duration=function(a){var b=this;return b.each(typeof a=="function"?function(c,d,e){b[e][d].duration=+a.apply(this,arguments)}:(a=+a,function(c,d,e){b[e][d].duration=a}))};var bi=null,bj,bk;d3.timer=function(a,b){var c=Date.now(),d=!1,e,f=bi;if(arguments.length<2)b=0;else if(!isFinite(b))return;while(f){if(f.callback===a){f.then=c,f.delay=b,d=!0;break}e=f,f=f.next}d||(bi={callback:a,then:c,delay:b,next:bi}),bj||(bk=clearTimeout(bk),bj=1,bn(bl))},d3.timer.flush=function(){var a,b=Date.now(),c=bi;while(c)a=b-c.then,c.delay||(c.flush=c.callback(a)),c=c.next;bm()};var bn=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){setTimeout(a,17)};d3.scale={},d3.scale.linear=function(){return bs([0,1],[0,1],d3.interpolate,!1)},d3.scale.log=function(){return bA(d3.scale.linear(),bB)},bB.pow=function(a){return Math.pow(10,a)},bC.pow=function(a){return-Math.pow(10,-a)},d3.scale.pow=function(){return bE(d3.scale.linear(),1)},d3.scale.sqrt=function(){return d3.scale.pow().exponent(.5)},d3.scale.ordinal=function(){return bG({},0,{t:"range",x:[]})},d3.scale.category10=function(){return d3.scale.ordinal().range(bH)},d3.scale.category20=function(){return d3.scale.ordinal().range(bI)},d3.scale.category20b=function(){return d3.scale.ordinal().range(bJ)},d3.scale.category20c=function(){return d3.scale.ordinal().range(bK)};var bH=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],bI=["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"],bJ=["#393b79","#5254a3","#6b6ecf","#9c9ede","#637939","#8ca252","#b5cf6b","#cedb9c","#8c6d31","#bd9e39","#e7ba52","#e7cb94","#843c39","#ad494a","#d6616b","#e7969c","#7b4173","#a55194","#ce6dbd","#de9ed6"],bK=["#3182bd","#6baed6","#9ecae1","#c6dbef","#e6550d","#fd8d3c","#fdae6b","#fdd0a2","#31a354","#74c476","#a1d99b","#c7e9c0","#756bb1","#9e9ac8","#bcbddc","#dadaeb","#636363","#969696","#bdbdbd","#d9d9d9"];d3.scale.quantile=function(){return bL([],[])},d3.scale.quantize=function(){return bM(0,1,[0,1])},d3.svg={},d3.svg.arc=function(){function e(){var e=a.apply(this,arguments),f=b.apply(this,arguments),g=c.apply(this,arguments)+bN,h=d.apply(this,arguments)+bN,i=(h<g&&(i=g,g=h,h=i),h-g),j=i<Math.PI?"0":"1",k=Math.cos(g),l=Math.sin(g),m=Math.cos(h),n=Math.sin(h);return i>=bO?e?"M0,"+f+"A"+f+","+f+" 0 1,1 0,"+ -f+"A"+f+","+f+" 0 1,1 0,"+f+"M0,"+e+"A"+e+","+e+" 0 1,1 0,"+ -e+"A"+e+","+e+" 0 1,1 0,"+e+"Z":"M0,"+f+"A"+f+","+f+" 0 1,1 0,"+ -f+"A"+f+","+f+" 0 1,1 0,"+f+"Z":e?"M"+f*k+","+f*l+"A"+f+","+f+" 0 "+j+",1 "+f*m+","+f*n+"L"+e*m+","+e*n+"A"+e+","+e+" 0 "+j+",0 "+e*k+","+e*l+"Z":"M"+f*k+","+f*l+"A"+f+","+f+" 0 "+j+",1 "+f*m+","+f*n+"L0,0"+"Z"}var a=bP,b=bQ,c=bR,d=bS;e.innerRadius=function(b){if(!arguments.length)return a;a=d3.functor(b);return e},e.outerRadius=function(a){if(!arguments.length)return b;b=d3.functor(a);return e},e.startAngle=function(a){if(!arguments.length)return c;c=d3.functor(a);return e},e.endAngle=function(a){if(!arguments.length)return d;d=d3.functor(a);return e},e.centroid=function(){var e=(a.apply(this,arguments)+b.apply(this,arguments))/2,f=(c.apply(this,arguments)+d.apply(this,arguments))/2+bN;return[Math.cos(f)*e,Math.sin(f)*e]};return e};var bN=-Math.PI/2,bO=2*Math.PI-1e-6;d3.svg.line=function(){return bT(Object)};var bX={linear:bY,"step-before":bZ,"step-after":b$,basis:ce,"basis-open":cf,"basis-closed":cg,bundle:ch,cardinal:cb,"cardinal-open":b_,"cardinal-closed":ca,monotone:cq},cj=[0,2/3,1/3,0],ck=[0,1/3,2/3,0],cl=[0,1/6,2/3,1/6];d3.svg.line.radial=function(){var a=bT(cr);a.radius=a.x,delete a.x,a.angle=a.y,delete a.y;return a},d3.svg.area=function(){return cs(Object)},d3.svg.area.radial=function(){var a=cs(cr);a.radius=a.x,delete a.x,a.innerRadius=a.x0,delete a.x0,a.outerRadius=a.x1,delete a.x1,a.angle=a.y,delete a.y,a.startAngle=a.y0,delete a.y0,a.endAngle=a.y1,delete a.y1;return a},d3.svg.chord=function(){function j(a,b,c,d){return"Q 0,0 "+d}function i(a,b){return"A"+a+","+a+" 0 0,1 "+b}function h(a,b){return a.a0==b.a0&&a.a1==b.a1}function g(a,b,f,g){var h=b.call(a,f,g),i=c.call(a,h,g),j=d.call(a,h,g)+bN,k=e.call(a,h,g)+bN;return{r:i,a0:j,a1:k,p0:[i*Math.cos(j),i*Math.sin(j)],p1:[i*Math.cos(k),i*Math.sin(k)]}}function f(c,d){var e=g(this,a,c,d),f=g(this,b,c,d);return"M"+e.p0+i(e.r,e.p1)+(h(e,f)?j(e.r,e.p1,e.r,e.p0):j(e.r,e.p1,f.r,f.p0)+i(f.r,f.p1)+j(f.r,f.p1,e.r,e.p0))+"Z"}var a=cv,b=cw,c=cx,d=bR,e=bS;f.radius=function(a){if(!arguments.length)return c;c=d3.functor(a);return f},f.source=function(b){if(!arguments.length)return a;a=d3.functor(b);return f},f.target=function(a){if(!arguments.length)return b;b=d3.functor(a);return f},f.startAngle=function(a){if(!arguments.length)return d;d=d3.functor(a);return f},f.endAngle=function(a){if(!arguments.length)return e;e=d3.functor(a);return f};return f},d3.svg.diagonal=function(){function d(d,e){var f=a.call(this,d,e),g=b.call(this,d,e),h=(f.y+g.y)/2,i=[f,{x:f.x,y:h},{x:g.x,y:h},g];i=i.map(c);return"M"+i[0]+"C"+i[1]+" "+i[2]+" "+i[3]}var a=cv,b=cw,c=cA;d.source=function(b){if(!arguments.length)return a;a=d3.functor(b);return d},d.target=function(a){if(!arguments.length)return b;b=d3.functor(a);return d},d.projection=function(a){if(!arguments.length)return c;c=a;return d};return d},d3.svg.diagonal.radial=function(){var a=d3.svg.diagonal(),b=cA,c=a.projection;a.projection=function(a){return arguments.length?c(cB(b=a)):b};return a},d3.svg.mouse=function(a){return cD(a,d3.event)};var cC=/WebKit/.test(navigator.userAgent)?-1:0;d3.svg.touches=function(b){var c=d3.event.touches;return c?a(c).map(function(a){var c=cD(b,a);c.identifier=a.identifier;return c}):[]},d3.svg.symbol=function(){function c(c,d){return(cG[a.call(this,c,d)]||cG.circle)(b.call(this,c,d))}var a=cF,b=cE;c.type=function(b){if(!arguments.length)return a;a=d3.functor(b);return c},c.size=function(a){if(!arguments.length)return b;b=d3.functor(a);return c};return c};var cG={circle:function(a){var b=Math.sqrt(a/Math.PI);return"M0,"+b+"A"+b+","+b+" 0 1,1 0,"+ -b+"A"+b+","+b+" 0 1,1 0,"+b+"Z"},cross:function(a){var b=Math.sqrt(a/5)/2;return"M"+ -3*b+","+ -b+"H"+ -b+"V"+ -3*b+"H"+b+"V"+ -b+"H"+3*b+"V"+b+"H"+b+"V"+3*b+"H"+ -b+"V"+b+"H"+ -3*b+"Z"},diamond:function(a){var b=Math.sqrt(a/(2*cI)),c=b*cI;return"M0,"+ -b+"L"+c+",0"+" 0,"+b+" "+ -c+",0"+"Z"},square:function(a){var b=Math.sqrt(a)/2;return"M"+ -b+","+ -b+"L"+b+","+ -b+" "+b+","+b+" "+ -b+","+b+"Z"},"triangle-down":function(a){var b=Math.sqrt(a/cH),c=b*cH/2;return"M0,"+c+"L"+b+","+ -c+" "+ -b+","+ -c+"Z"},"triangle-up":function(a){var b=Math.sqrt(a/cH),c=b*cH/2;return"M0,"+ -c+"L"+b+","+c+" "+ -b+","+c+"Z"}};d3.svg.symbolTypes=d3.keys(cG);var cH=Math.sqrt(3),cI=Math.tan(30*Math.PI/180);d3.svg.axis=function(){function j(j){j.each(function(k,l,m){function F(a){return j.delay?a.transition().delay(j[m][l].delay).duration(j[m][l].duration).ease(j.ease()):a}var n=d3.select(this),o=a.ticks.apply(a,g),p=h||a.tickFormat.apply(a,g),q=cL(a,o,i),r=n.selectAll(".minor").data(q,String),s=r.enter().insert("svg:line","g").attr("class","tick minor").style("opacity",1e-6),t=F(r.exit()).style("opacity",1e-6).remove(),u=F(r).style("opacity",1),v=n.selectAll("g").data(o,String),w=v.enter().insert("svg:g","path").style("opacity",1e-6),x=F(v.exit()).style("opacity",1e-6).remove(),y=F(v).style("opacity",1),z,A=a.range(),B=n.selectAll(".domain").data([]),C=B.enter().append("svg:path").attr("class","domain"),D=F(B),E=this.__chart__||a;this.__chart__=a.copy(),w.append("svg:line").attr("class","tick"),w.append("svg:text"),y.select("text").text(p);switch(b){case"bottom":z=cJ,u.attr("y2",d),w.select("text").attr("dy",".71em").attr("text-anchor","middle"),y.select("line").attr("y2",c),y.select("text").attr("y",Math.max(c,0)+f),D.attr("d","M"+A[0]+","+e+"V0H"+A[1]+"V"+e);break;case"top":z=cJ,u.attr("y2",-d),w.select("text").attr("text-anchor","middle"),y.select("line").attr("y2",-c),y.select("text").attr("y",-(Math.max(c,0)+f)),D.attr("d","M"+A[0]+","+ -e+"V0H"+A[1]+"V"+ -e);break;case"left":z=cK,u.attr("x2",-d),w.select("text").attr("dy",".32em").attr("text-anchor","end"),y.select("line").attr("x2",-c),y.select("text").attr("x",-(Math.max(c,0)+f)),D.attr("d","M"+ -e+","+A[0]+"H0V"+A[1]+"H"+ -e);break;case"right":z=cK,u.attr("x2",d),w.select("text").attr("dy",".32em"),y.select("line").attr("x2",c),y.select("text").attr("x",Math.max(c,0)+f),D.attr("d","M"+e+","+A[0]+"H0V"+A[1]+"H"+e)}w.call(z,E),y.call(z,a),x.call(z,a),s.call(z,E),u.call(z,a),t.call(z,a)})}var a=d3.scale.linear(),b="bottom",c=6,d=6,e=6,f=3,g=[10],h,i=0;j.scale=function(b){if(!arguments.length)return a;a=b;return j},j.orient=function(a){if(!arguments.length)return b;b=a;return j},j.ticks=function(){if(!arguments.length)return g;g=arguments;return j},j.tickFormat=function(a){if(!arguments.length)return h;h=a;return j},j.tickSize=function(a,b,f){if(!arguments.length)return c;var g=arguments.length-1;c=+a,d=g>1?+b:c,e=g>0?+arguments[g]:c;return j},j.tickPadding=function(a){if(!arguments.length)return f;f=+a;return j},j.tickSubdivide=function(a){if(!arguments.length)return i;i=+a;return j};return j},d3.behavior={},d3.behavior.drag=function(){function d(){c.apply(this,arguments),cR("dragstart")}function c(){cM=a,cO=cS((cN=this).parentNode),cP=0,d3_behavior_dragArguments=arguments}function b(){this.on("mousedown.drag",d).on("touchstart.drag",d),d3.select(window).on("mousemove.drag",cT).on("touchmove.drag",cT).on("mouseup.drag",cU,!0).on("touchend.drag",cU,!0).on("click.drag",cV,!0)}var a=d3.dispatch("drag","dragstart","dragend");b.on=function(c,d){a[c].add(d);return b};return b};var cM,cN,cO,cP,cQ;d3.behavior.zoom=function(){function h(){d.apply(this,arguments);var b=dh(),c,e=Date.now();b.length===1&&e-c_<300&&dm(1+Math.floor(a[2]),c=b[0],c$[c.identifier]),c_=e}function g(){d.apply(this,arguments);var b=d3.svg.mouse(dc);dm(d3.event.shiftKey?Math.ceil(a[2]-1):Math.floor(a[2]+1),b,df(b))}function f(){d.apply(this,arguments),cZ||(cZ=df(d3.svg.mouse(dc))),dm(dg()+a[2],d3.svg.mouse(dc),cZ)}function e(){d.apply(this,arguments),cY=df(d3.svg.mouse(dc)),d3_behavior_zoomMoved=!1,d3.event.preventDefault(),window.focus()}function d(){da=a,db=b.zoom.dispatch,dc=this,dd=arguments}function c(){this.on("mousedown.zoom",e).on("mousewheel.zoom",f).on("DOMMouseScroll.zoom",g).on("dblclick.zoom",g).on("touchstart.zoom",h),d3.select(window).on("mousemove.zoom",dj).on("mouseup.zoom",dk).on("touchmove.zoom",di).on("touchend.zoom",dh).on("click.zoom",dl,!0)}var a=[0,0,0],b=d3.dispatch("zoom");c.on=function(a,d){b[a].add(d);return c};return c};var cX,cY,cZ,c$={},c_=0,da,db,dc,dd,de})() <ide>\ No newline at end of file <add>(function(){function dp(a,b,c){function i(a,b){var c=a.__domain||(a.__domain=a.domain()),d=a.range().map(function(a){return(a-b)/h});a.domain(c).domain(d.map(a.invert))}var d=Math.pow(2,(db[2]=a)-c[2]),e=db[0]=b[0]-d*c[0],f=db[1]=b[1]-d*c[1],g=d3.event,h=Math.pow(2,a);d3.event={scale:h,translate:[e,f],transform:function(a,b){a&&i(a,e),b&&i(b,f)}};try{dc.apply(dd,de)}finally{d3.event=g}g.preventDefault()}function dn(){dg&&(d3.event.stopPropagation(),d3.event.preventDefault(),dg=!1)}function dm(){cZ&&(df&&(dg=!0),dl(),cZ=null)}function dl(){c$=null,cZ&&(df=!0,dp(db[2],d3.svg.mouse(dd),cZ))}function dk(){var a=d3.svg.touches(dd);switch(a.length){case 1:var b=a[0];dp(db[2],b,c_[b.identifier]);break;case 2:var c=a[0],d=a[1],e=[(c[0]+d[0])/2,(c[1]+d[1])/2],f=c_[c.identifier],g=c_[d.identifier],h=[(f[0]+g[0])/2,(f[1]+g[1])/2,f[2]];dp(Math.log(d3.event.scale)/Math.LN2+f[2],e,h)}}function dj(){var a=d3.svg.touches(dd),b=-1,c=a.length,d;while(++b<c)c_[(d=a[b]).identifier]=dh(d);return a}function di(){cY||(cY=d3.select("body").append("div").style("visibility","hidden").style("top",0).style("height",0).style("width",0).style("overflow-y","scroll").append("div").style("height","2000px").node().parentNode);var a=d3.event,b;try{cY.scrollTop=1e3,cY.dispatchEvent(a),b=1e3-cY.scrollTop}catch(c){b=a.wheelDelta||-a.detail}return b*.005}function dh(a){return[a[0]-db[0],a[1]-db[1],db[2]]}function cX(){d3.event.stopPropagation(),d3.event.preventDefault()}function cW(){cR&&(cX(),cR=!1)}function cV(){!cN||(cS("dragend"),cN=null,cQ&&(cR=!0,cX()))}function cU(){if(!!cN){var a=cN.parentNode;if(!a)return cV();cS("drag"),cX()}}function cT(a){return d3.event.touches?d3.svg.touches(a)[0]:d3.svg.mouse(a)}function cS(a){var b=d3.event,c=cN.parentNode,d=0,e=0;c&&(c=cT(c),d=c[0]-cP[0],e=c[1]-cP[1],cP=c,cQ|=d|e);try{d3.event={dx:d,dy:e},cM[a].dispatch.apply(cN,cO)}finally{d3.event=b}b.preventDefault()}function cL(a,b,c){e=[];if(c&&b.length>1){var d=bp(a.domain()),e,f=-1,g=b.length,h=(b[1]-b[0])/++c,i,j;while(++f<g)for(i=c;--i>0;)(j=+b[f]-i*h)>=d[0]&&e.push(j);for(--f,i=0;++i<c&&(j=+b[f]+i*h)<d[1];)e.push(j)}return e}function cK(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function cJ(a,b){a.attr("transform",function(a){return"translate("+b(a)+",0)"})}function cF(){return"circle"}function cE(){return 64}function cD(a,b){var c=(a.ownerSVGElement||a).createSVGPoint();if(cC<0&&(window.scrollX||window.scrollY)){var d=d3.select(document.body).append("svg:svg").style("position","absolute").style("top",0).style("left",0),e=d[0][0].getScreenCTM();cC=!e.f&&!e.e,d.remove()}cC?(c.x=b.pageX,c.y=b.pageY):(c.x=b.clientX,c.y=b.clientY),c=c.matrixTransform(a.getScreenCTM().inverse());return[c.x,c.y]}function cB(a){return function(){var b=a.apply(this,arguments),c=b[0],d=b[1]+bN;return[c*Math.cos(d),c*Math.sin(d)]}}function cA(a){return[a.x,a.y]}function cz(a){return a.endAngle}function cy(a){return a.startAngle}function cx(a){return a.radius}function cw(a){return a.target}function cv(a){return a.source}function cu(a){return function(b,c){return a[c][1]}}function ct(a){return function(b,c){return a[c][0]}}function cs(a){function i(f){if(f.length<1)return null;var i=bU(this,f,b,d),j=bU(this,f,b===c?ct(i):c,d===e?cu(i):e);return"M"+g(a(j),h)+"L"+g(a(i.reverse()),h)+"Z"}var b=bV,c=bV,d=0,e=bW,f="linear",g=bX[f],h=.7;i.x=function(a){if(!arguments.length)return c;b=c=a;return i},i.x0=function(a){if(!arguments.length)return b;b=a;return i},i.x1=function(a){if(!arguments.length)return c;c=a;return i},i.y=function(a){if(!arguments.length)return e;d=e=a;return i},i.y0=function(a){if(!arguments.length)return d;d=a;return i},i.y1=function(a){if(!arguments.length)return e;e=a;return i},i.interpolate=function(a){if(!arguments.length)return f;g=bX[f=a];return i},i.tension=function(a){if(!arguments.length)return h;h=a;return i};return i}function cr(a){var b,c=-1,d=a.length,e,f;while(++c<d)b=a[c],e=b[0],f=b[1]+bN,b[0]=e*Math.cos(f),b[1]=e*Math.sin(f);return a}function cq(a){return a.length<3?bY(a):a[0]+cc(a,cp(a))}function cp(a){var b=[],c,d,e,f,g=co(a),h=-1,i=a.length-1;while(++h<i)c=cn(a[h],a[h+1]),Math.abs(c)<1e-6?g[h]=g[h+1]=0:(d=g[h]/c,e=g[h+1]/c,f=d*d+e*e,f>9&&(f=c*3/Math.sqrt(f),g[h]=f*d,g[h+1]=f*e));h=-1;while(++h<=i)f=(a[Math.min(i,h+1)][0]-a[Math.max(0,h-1)][0])/(6*(1+g[h]*g[h])),b.push([f||0,g[h]*f||0]);return b}function co(a){var b=0,c=a.length-1,d=[],e=a[0],f=a[1],g=d[0]=cn(e,f);while(++b<c)d[b]=g+(g=cn(e=f,f=a[b+1]));d[b]=g;return d}function cn(a,b){return(b[1]-a[1])/(b[0]-a[0])}function cm(a,b,c){a.push("C",ci(cj,b),",",ci(cj,c),",",ci(ck,b),",",ci(ck,c),",",ci(cl,b),",",ci(cl,c))}function ci(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3]}function ch(a,b){var c=a.length-1,d=a[0][0],e=a[0][1],f=a[c][0]-d,g=a[c][1]-e,h=-1,i,j;while(++h<=c)i=a[h],j=h/c,i[0]=b*i[0]+(1-b)*(d+j*f),i[1]=b*i[1]+(1-b)*(e+j*g);return ce(a)}function cg(a){var b,c=-1,d=a.length,e=d+4,f,g=[],h=[];while(++c<4)f=a[c%d],g.push(f[0]),h.push(f[1]);b=[ci(cl,g),",",ci(cl,h)],--c;while(++c<e)f=a[c%d],g.shift(),g.push(f[0]),h.shift(),h.push(f[1]),cm(b,g,h);return b.join("")}function cf(a){if(a.length<4)return bY(a);var b=[],c=-1,d=a.length,e,f=[0],g=[0];while(++c<3)e=a[c],f.push(e[0]),g.push(e[1]);b.push(ci(cl,f)+","+ci(cl,g)),--c;while(++c<d)e=a[c],f.shift(),f.push(e[0]),g.shift(),g.push(e[1]),cm(b,f,g);return b.join("")}function ce(a){if(a.length<3)return bY(a);var b=[],c=1,d=a.length,e=a[0],f=e[0],g=e[1],h=[f,f,f,(e=a[1])[0]],i=[g,g,g,e[1]];b.push(f,",",g),cm(b,h,i);while(++c<d)e=a[c],h.shift(),h.push(e[0]),i.shift(),i.push(e[1]),cm(b,h,i);c=-1;while(++c<2)h.shift(),h.push(e[0]),i.shift(),i.push(e[1]),cm(b,h,i);return b.join("")}function cd(a,b){var c=[],d=(1-b)/2,e,f=a[0],g=a[1],h=1,i=a.length;while(++h<i)e=f,f=g,g=a[h],c.push([d*(g[0]-e[0]),d*(g[1]-e[1])]);return c}function cc(a,b){if(b.length<1||a.length!=b.length&&a.length!=b.length+2)return bY(a);var c=a.length!=b.length,d="",e=a[0],f=a[1],g=b[0],h=g,i=1;c&&(d+="Q"+(f[0]-g[0]*2/3)+","+(f[1]-g[1]*2/3)+","+f[0]+","+f[1],e=a[1],i=2);if(b.length>1){h=b[1],f=a[i],i++,d+="C"+(e[0]+g[0])+","+(e[1]+g[1])+","+(f[0]-h[0])+","+(f[1]-h[1])+","+f[0]+","+f[1];for(var j=2;j<b.length;j++,i++)f=a[i],h=b[j],d+="S"+(f[0]-h[0])+","+(f[1]-h[1])+","+f[0]+","+f[1]}if(c){var k=a[i];d+="Q"+(f[0]+h[0]*2/3)+","+(f[1]+h[1]*2/3)+","+k[0]+","+k[1]}return d}function cb(a,b,c){return a.length<3?bY(a):a[0]+cc(a,cd(a,b))}function ca(a,b){return a.length<3?bY(a):a[0]+cc((a.push(a[0]),a),cd([a[a.length-2]].concat(a,[a[1]]),b))}function b_(a,b){return a.length<4?bY(a):a[1]+cc(a.slice(1,a.length-1),cd(a,b))}function b$(a){var b=[],c=0,d=a.length,e=a[0];b.push(e[0],",",e[1]);while(++c<d)b.push("H",(e=a[c])[0],"V",e[1]);return b.join("")}function bZ(a){var b=[],c=0,d=a.length,e=a[0];b.push(e[0],",",e[1]);while(++c<d)b.push("V",(e=a[c])[1],"H",e[0]);return b.join("")}function bY(a){var b=[],c=0,d=a.length,e=a[0];b.push(e[0],",",e[1]);while(++c<d)b.push("L",(e=a[c])[0],",",e[1]);return b.join("")}function bW(a){return a[1]}function bV(a){return a[0]}function bU(a,b,c,d){var e=[],f=-1,g=b.length,h=typeof c=="function",i=typeof d=="function",j;if(h&&i)while(++f<g)e.push([c.call(a,j=b[f],f),d.call(a,j,f)]);else if(h)while(++f<g)e.push([c.call(a,b[f],f),d]);else if(i)while(++f<g)e.push([c,d.call(a,b[f],f)]);else while(++f<g)e.push([c,d]);return e}function bT(a){function g(d){return d.length<1?null:"M"+e(a(bU(this,d,b,c)),f)}var b=bV,c=bW,d="linear",e=bX[d],f=.7;g.x=function(a){if(!arguments.length)return b;b=a;return g},g.y=function(a){if(!arguments.length)return c;c=a;return g},g.interpolate=function(a){if(!arguments.length)return d;e=bX[d=a];return g},g.tension=function(a){if(!arguments.length)return f;f=a;return g};return g}function bS(a){return a.endAngle}function bR(a){return a.startAngle}function bQ(a){return a.outerRadius}function bP(a){return a.innerRadius}function bM(a,b,c){function g(){d=c.length/(b-a),e=c.length-1;return f}function f(b){return c[Math.max(0,Math.min(e,Math.floor(d*(b-a))))]}var d,e;f.domain=function(c){if(!arguments.length)return[a,b];a=+c[0],b=+c[c.length-1];return g()},f.range=function(a){if(!arguments.length)return c;c=a;return g()},f.copy=function(){return bM(a,b,c)};return g()}function bL(a,b){function e(a){return isNaN(a=+a)?NaN:b[d3.bisect(c,a)]}function d(){var d=0,f=a.length,g=b.length;c=[];while(++d<g)c[d-1]=d3.quantile(a,d/g);return e}var c;e.domain=function(b){if(!arguments.length)return a;a=b.filter(function(a){return!isNaN(a)}).sort(d3.ascending);return d()},e.range=function(a){if(!arguments.length)return b;b=a;return d()},e.quantiles=function(){return c},e.copy=function(){return bL(a,b)};return d()}function bG(a,b,c){function f(c){return d[((a[c]||(a[c]=++b))-1)%d.length]}var d,e;f.domain=function(d){if(!arguments.length)return d3.keys(a);a={},b=0;var e=-1,g=d.length,h;while(++e<g)a[h=d[e]]||(a[h]=++b);return f[c.t](c.x,c.p)},f.range=function(a){if(!arguments.length)return d;d=a,e=0,c={t:"range",x:a};return f},f.rangePoints=function(a,g){arguments.length<2&&(g=0);var h=a[0],i=a[1],j=(i-h)/(b-1+g);d=b<2?[(h+i)/2]:d3.range(h+j*g/2,i+j/2,j),e=0,c={t:"rangePoints",x:a,p:g};return f},f.rangeBands=function(a,g){arguments.length<2&&(g=0);var h=a[0],i=a[1],j=(i-h)/(b+g);d=d3.range(h+j*g,i,j),e=j*(1-g),c={t:"rangeBands",x:a,p:g};return f},f.rangeRoundBands=function(a,g){arguments.length<2&&(g=0);var h=a[0],i=a[1],j=Math.floor((i-h)/(b+g)),k=i-h-(b-g)*j;d=d3.range(h+Math.round(k/2),i,j),e=Math.round(j*(1-g)),c={t:"rangeRoundBands",x:a,p:g};return f},f.rangeBand=function(){return e},f.copy=function(){var d={},e;for(e in a)d[e]=a[e];return bG(d,b,c)};return f[c.t](c.x,c.p)}function bF(a){return function(b){return b<0?-Math.pow(-b,a):Math.pow(b,a)}}function bE(a,b){function e(b){return a(c(b))}var c=bF(b),d=bF(1/b);e.invert=function(b){return d(a.invert(b))},e.domain=function(b){if(!arguments.length)return a.domain().map(d);a.domain(b.map(c));return e},e.ticks=function(a){return bw(e.domain(),a)},e.tickFormat=function(a){return bx(e.domain(),a)},e.nice=function(){return e.domain(bq(e.domain(),bu))},e.exponent=function(a){if(!arguments.length)return b;var f=e.domain();c=bF(b=a),d=bF(1/b);return e.domain(f)},e.copy=function(){return bE(a.copy(),b)};return bt(e,a)}function bD(a){return a.toPrecision(1)}function bC(a){return-Math.log(-a)/Math.LN10}function bB(a){return Math.log(a)/Math.LN10}function bA(a,b){function d(c){return a(b(c))}var c=b.pow;d.invert=function(b){return c(a.invert(b))},d.domain=function(e){if(!arguments.length)return a.domain().map(c);b=e[0]<0?bC:bB,c=b.pow,a.domain(e.map(b));return d},d.nice=function(){a.domain(bq(a.domain(),br));return d},d.ticks=function(){var d=bp(a.domain()),e=[];if(d.every(isFinite)){var f=Math.floor(d[0]),g=Math.ceil(d[1]),h=c(d[0]),i=c(d[1]);if(b===bC){e.push(c(f));for(;f++<g;)for(var j=9;j>0;j--)e.push(c(f)*j)}else{for(;f<g;f++)for(var j=1;j<10;j++)e.push(c(f)*j);e.push(c(f))}for(f=0;e[f]<h;f++);for(g=e.length;e[g-1]>i;g--);e=e.slice(f,g)}return e},d.tickFormat=function(){return bD},d.copy=function(){return bA(a.copy(),b)};return bt(d,a)}function bz(a,b,c,d){var e=[],f=[],g=0,h=a.length;while(++g<h)e.push(c(a[g-1],a[g])),f.push(d(b[g-1],b[g]));return function(b){var c=d3.bisect(a,b,1,a.length-1)-1;return f[c](e[c](b))}}function by(a,b,c,d){var e=c(a[0],a[1]),f=d(b[0],b[1]);return function(a){return f(e(a))}}function bx(a,b){return d3.format(",."+Math.max(0,-Math.floor(Math.log(bv(a,b)[2])/Math.LN10+.01))+"f")}function bw(a,b){return d3.range.apply(d3,bv(a,b))}function bv(a,b){var c=bp(a),d=c[1]-c[0],e=Math.pow(10,Math.floor(Math.log(d/b)/Math.LN10)),f=b/d*e;f<=.15?e*=10:f<=.35?e*=5:f<=.75&&(e*=2),c[0]=Math.ceil(c[0]/e)*e,c[1]=Math.floor(c[1]/e)*e+e*.5,c[2]=e;return c}function bu(a){a=Math.pow(10,Math.round(Math.log(a)/Math.LN10)-1);return{floor:function(b){return Math.floor(b/a)*a},ceil:function(b){return Math.ceil(b/a)*a}}}function bt(a,b){a.range=d3.rebind(a,b.range),a.rangeRound=d3.rebind(a,b.rangeRound),a.interpolate=d3.rebind(a,b.interpolate),a.clamp=d3.rebind(a,b.clamp);return a}function bs(a,b,c,d){function h(a){return e(a)}function g(){var g=a.length==2?by:bz,i=d?G:F;e=g(a,b,i,c),f=g(b,a,i,d3.interpolate);return h}var e,f;h.invert=function(a){return f(a)},h.domain=function(b){if(!arguments.length)return a;a=b.map(Number);return g()},h.range=function(a){if(!arguments.length)return b;b=a;return g()},h.rangeRound=function(a){return h.range(a).interpolate(d3.interpolateRound)},h.clamp=function(a){if(!arguments.length)return d;d=a;return g()},h.interpolate=function(a){if(!arguments.length)return c;c=a;return g()},h.ticks=function(b){return bw(a,b)},h.tickFormat=function(b){return bx(a,b)},h.nice=function(){bq(a,bu);return g()},h.copy=function(){return bs(a,b,c,d)};return g()}function br(){return Math}function bq(a,b){var c=0,d=a.length-1,e=a[c],f=a[d],g;f<e&&(g=c,c=d,d=g,g=e,e=f,f=g),b=b(f-e),a[c]=b.floor(e),a[d]=b.ceil(f);return a}function bp(a){var b=a[0],c=a[a.length-1];return b<c?[b,c]:[c,b]}function bo(){}function bm(){var a=null,b=bi,c=Infinity;while(b)b.flush?b=a?a.next=b.next:bi=b.next:(c=Math.min(c,b.then+b.delay),b=(a=b).next);return c}function bl(){var a,b=Date.now(),c=bi;while(c)a=b-c.then,a>=c.delay&&(c.flush=c.callback(a)),c=c.next;var d=bm()-b;d>24?(isFinite(d)&&(clearTimeout(bk),bk=setTimeout(bl,d)),bj=0):(bj=1,bn(bl))}function bh(a){for(var b=0,c=this.length;b<c;b++)for(var d=this[b],e=0,f=d.length;e<f;e++){var g=d[e];g&&a.call(g=g.node,g.__data__,e,b)}return this}function bc(a){return typeof a=="function"?function(b,c,d){var e=a.call(this,b,c)+"";return d!=e&&d3.interpolate(d,e)}:(a=a+"",function(b,c,d){return d!=a&&d3.interpolate(d,a)})}function bb(a,b){e(a,bd);var c={},d=d3.dispatch("start","end"),f=bg;a.id=b,a.tween=function(b,d){if(arguments.length<2)return c[b];d==null?delete c[b]:c[b]=d;return a},a.ease=function(b){if(!arguments.length)return f;f=typeof b=="function"?b:d3.ease.apply(d3,arguments);return a},a.each=function(b,c){if(arguments.length<2)return bh.call(a,b);d[b].add(c);return a},d3.timer(function(e){a.each(function(g,h,i){function p(a){if(n.active!==b)return!0;var c=Math.min(1,(a-l)/m),e=f(c),i=j.length;while(--i>=0)j[i].call(k,e);if(c===1){n.active=0,n.owner===b&&delete k.__transition__,bf=b,d.end.dispatch.call(k,g,h),bf=0;return!0}}function o(a){if(n.active<=b){n.active=b,d.start.dispatch.call(k,g,h);for(var e in c)(e=c[e].call(k,g,h))&&j.push(e);l-=a,d3.timer(p)}return!0}var j=[],k=this,l=a[i][h].delay-e,m=a[i][h].duration,n=k.__transition__;n?n.owner<b&&(n.owner=b):n=k.__transition__={active:0,owner:b},l<=0?o(0):d3.timer(o,l)});return!0});return a}function ba(a){arguments.length||(a=d3.ascending);return function(b,c){return a(b&&b.__data__,c&&c.__data__)}}function $(a){e(a,_);return a}function Z(a){return{__data__:a}}function Y(a){return function(b){return U(a,b)}}function X(a){return function(b){return T(a,b)}}function S(a){e(a,V);return a}function R(a,b,c){function g(a){return Math.round(f(a)*255)}function f(a){a>360?a-=360:a<0&&(a+=360);return a<60?d+(e-d)*a/60:a<180?e:a<240?d+(e-d)*(240-a)/60:d}var d,e;a=a%360,a<0&&(a+=360),b=b<0?0:b>1?1:b,c=c<0?0:c>1?1:c,e=c<=.5?c*(1+b):c+b-c*b,d=2*c-e;return H(g(a+120),g(a),g(a-120))}function Q(a,b,c){this.h=a,this.s=b,this.l=c}function P(a,b,c){return new Q(a,b,c)}function M(a){var b=parseFloat(a);return a.charAt(a.length-1)==="%"?Math.round(b*2.55):b}function L(a,b,c){var d=Math.min(a/=255,b/=255,c/=255),e=Math.max(a,b,c),f=e-d,g,h,i=(e+d)/2;f?(h=i<.5?f/(e+d):f/(2-e-d),a==e?g=(b-c)/f+(b<c?6:0):b==e?g=(c-a)/f+2:g=(a-b)/f+4,g*=60):h=g=0;return P(g,h,i)}function K(a,b,c){var d=0,e=0,f=0,g,h,i;g=/([a-z]+)\((.*)\)/i.exec(a);if(g){h=g[2].split(",");switch(g[1]){case"hsl":return c(parseFloat(h[0]),parseFloat(h[1])/100,parseFloat(h[2])/100);case"rgb":return b(M(h[0]),M(h[1]),M(h[2]))}}if(i=N[a])return b(i.r,i.g,i.b);a!=null&&a.charAt(0)==="#"&&(a.length===4?(d=a.charAt(1),d+=d,e=a.charAt(2),e+=e,f=a.charAt(3),f+=f):a.length===7&&(d=a.substring(1,3),e=a.substring(3,5),f=a.substring(5,7)),d=parseInt(d,16),e=parseInt(e,16),f=parseInt(f,16));return b(d,e,f)}function J(a){return a<16?"0"+a.toString(16):a.toString(16)}function I(a,b,c){this.r=a,this.g=b,this.b=c}function H(a,b,c){return new I(a,b,c)}function G(a,b){b=b-(a=+a)?1/(b-a):0;return function(c){return Math.max(0,Math.min(1,(c-a)*b))}}function F(a,b){b=b-(a=+a)?1/(b-a):0;return function(c){return(c-a)*b}}function E(a){return a in D||/\bcolor\b/.test(a)?d3.interpolateRgb:d3.interpolate}function B(a){return a<1/2.75?7.5625*a*a:a<2/2.75?7.5625*(a-=1.5/2.75)*a+.75:a<2.5/2.75?7.5625*(a-=2.25/2.75)*a+.9375:7.5625*(a-=2.625/2.75)*a+.984375}function A(a){a||(a=1.70158);return function(b){return b*b*((a+1)*b-a)}}function z(a,b){var c;arguments.length<2&&(b=.45),arguments.length<1?(a=1,c=b/4):c=b/(2*Math.PI)*Math.asin(1/a);return function(d){return 1+a*Math.pow(2,10*-d)*Math.sin((d-c)*2*Math.PI/b)}}function y(a){return 1-Math.sqrt(1-a*a)}function x(a){return Math.pow(2,10*(a-1))}function w(a){return 1-Math.cos(a*Math.PI/2)}function v(a){return function(b){return Math.pow(b,a)}}function u(a){return a}function t(a){return function(b){return.5*(b<.5?a(2*b):2-a(2-2*b))}}function s(a){return function(b){return 1-a(1-b)}}function n(a){var b=a.lastIndexOf("."),c=b>=0?a.substring(b):(b=a.length,""),d=[];while(b>0)d.push(a.substring(b-=3,b+3));return d.reverse().join(",")+c}function m(a){return a+""}function j(a){var b={},c=[];b.add=function(a){for(var d=0;d<c.length;d++)if(c[d].listener==a)return b;c.push({listener:a,on:!0});return b},b.remove=function(a){for(var d=0;d<c.length;d++){var e=c[d];if(e.listener==a){e.on=!1,c=c.slice(0,d).concat(c.slice(d+1));break}}return b},b.dispatch=function(){var a=c;for(var b=0,d=a.length;b<d;b++){var e=a[b];e.on&&e.listener.apply(this,arguments)}};return b}function h(a){return a.replace(/(^\s+)|(\s+$)/g,"").replace(/\s+/g," ")}function g(a){return a==null}function f(a){return a.length}function c(a){return Array.prototype.slice.call(a)}function b(a){var b=-1,c=a.length,d=[];while(++b<c)d.push(a[b]);return d}d3={version:"2.0.0"},Date.now||(Date.now=function(){return+(new Date)}),Object.create||(Object.create=function(a){function b(){}b.prototype=a;return new b});var a=c;try{a(document.documentElement.childNodes)[0].nodeType}catch(d){a=b}var e=[].__proto__?function(a,b){a.__proto__=b}:function(a,b){for(var c in b)a[c]=b[c]};d3.functor=function(a){return typeof a=="function"?a:function(){return a}},d3.rebind=function(a,b){return function(){var c=b.apply(a,arguments);return arguments.length?a:c}},d3.ascending=function(a,b){return a<b?-1:a>b?1:a>=b?0:NaN},d3.descending=function(a,b){return b<a?-1:b>a?1:b>=a?0:NaN},d3.min=function(a,b){var c=-1,d=a.length,e,f;if(arguments.length===1){while(++c<d&&((e=a[c])==null||e!=e))e=undefined;while(++c<d)(f=a[c])!=null&&e>f&&(e=f)}else{while(++c<d&&((e=b.call(a,a[c],c))==null||e!=e))e=undefined;while(++c<d)(f=b.call(a,a[c],c))!=null&&e>f&&(e=f)}return e},d3.max=function(a,b){var c=-1,d=a.length,e,f;if(arguments.length===1){while(++c<d&&((e=a[c])==null||e!=e))e=undefined;while(++c<d)(f=a[c])!=null&&f>e&&(e=f)}else{while(++c<d&&((e=b.call(a,a[c],c))==null||e!=e))e=undefined;while(++c<d)(f=b.call(a,a[c],c))!=null&&f>e&&(e=f)}return e},d3.sum=function(a,b){var c=0,d=a.length,e,f=-1;if(arguments.length===1)while(++f<d)isNaN(e=+a[f])||(c+=e);else while(++f<d)isNaN(e=+b.call(a,a[f],f))||(c+=e);return c},d3.quantile=function(a,b){var c=(a.length-1)*b+1,d=Math.floor(c),e=a[d-1],f=c-d;return f?e+f*(a[d]-e):e},d3.zip=function(){if(!(e=arguments.length))return[];for(var a=-1,b=d3.min(arguments,f),c=Array(b);++a<b;)for(var d=-1,e,g=c[a]=Array(e);++d<e;)g[d]=arguments[d][a];return c},d3.bisectLeft=function(a,b,c,d){arguments.length<3&&(c=0),arguments.length<4&&(d=a.length);while(c<d){var e=c+d>>1;a[e]<b?c=e+1:d=e}return c},d3.bisect=d3.bisectRight=function(a,b,c,d){arguments.length<3&&(c=0),arguments.length<4&&(d=a.length);while(c<d){var e=c+d>>1;b<a[e]?d=e:c=e+1}return c},d3.first=function(a,b){var c=0,d=a.length,e=a[0],f;arguments.length===1&&(b=d3.ascending);while(++c<d)b.call(a,e,f=a[c])>0&&(e=f);return e},d3.last=function(a,b){var c=0,d=a.length,e=a[0],f;arguments.length===1&&(b=d3.ascending);while(++c<d)b.call(a,e,f=a[c])<=0&&(e=f);return e},d3.nest=function(){function g(a,d){if(d>=b.length)return a;var e=[],f=c[d++],h;for(h in a)e.push({key:h,values:g(a[h],d)});f&&e.sort(function(a,b){return f(a.key,b.key)});return e}function f(c,g){if(g>=b.length)return e?e.call(a,c):d?c.sort(d):c;var h=-1,i=c.length,j=b[g++],k,l,m={};while(++h<i)(k=j(l=c[h]))in m?m[k].push(l):m[k]=[l];for(k in m)m[k]=f(m[k],g);return m}var a={},b=[],c=[],d,e;a.map=function(a){return f(a,0)},a.entries=function(a){return g(f(a,0),0)},a.key=function(c){b.push(c);return a},a.sortKeys=function(d){c[b.length-1]=d;return a},a.sortValues=function(b){d=b;return a},a.rollup=function(b){e=b;return a};return a},d3.keys=function(a){var b=[];for(var c in a)b.push(c);return b},d3.values=function(a){var b=[];for(var c in a)b.push(a[c]);return b},d3.entries=function(a){var b=[];for(var c in a)b.push({key:c,value:a[c]});return b},d3.permute=function(a,b){var c=[],d=-1,e=b.length;while(++d<e)c[d]=a[b[d]];return c},d3.merge=function(a){return Array.prototype.concat.apply([],a)},d3.split=function(a,b){var c=[],d=[],e,f=-1,h=a.length;arguments.length<2&&(b=g);while(++f<h)b.call(d,e=a[f],f)?d=[]:(d.length||c.push(d),d.push(e));return c},d3.range=function(a,b,c){arguments.length<3&&(c=1,arguments.length<2&&(b=a,a=0));if((b-a)/c==Infinity)throw new Error("infinite range");var d=[],e=-1,f;if(c<0)while((f=a+c*++e)>b)d.push(f);else while((f=a+c*++e)<b)d.push(f);return d},d3.requote=function(a){return a.replace(i,"\\$&")};var i=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;d3.round=function(a,b){return b?Math.round(a*Math.pow(10,b))*Math.pow(10,-b):Math.round(a)},d3.xhr=function(a,b,c){var d=new XMLHttpRequest;arguments.length<3?c=b:b&&d.overrideMimeType&&d.overrideMimeType(b),d.open("GET",a,!0),d.onreadystatechange=function(){d.readyState===4&&c(d.status<300?d:null)},d.send(null)},d3.text=function(a,b,c){function d(a){c(a&&a.responseText)}arguments.length<3&&(c=b,b=null),d3.xhr(a,b,d)},d3.json=function(a,b){d3.text(a,"application/json",function(a){b(a?JSON.parse(a):null)})},d3.html=function(a,b){d3.text(a,"text/html",function(a){if(a!=null){var c=document.createRange();c.selectNode(document.body),a=c.createContextualFragment(a)}b(a)})},d3.xml=function(a,b,c){function d(a){c(a&&a.responseXML)}arguments.length<3&&(c=b,b=null),d3.xhr(a,b,d)},d3.ns={prefix:{svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},qualify:function(a){var b=a.indexOf(":");return b<0?a:{space:d3.ns.prefix[a.substring(0,b)],local:a.substring(b+1)}}},d3.dispatch=function(a){var b={},c;for(var d=0,e=arguments.length;d<e;d++)c=arguments[d],b[c]=j(c);return b},d3.format=function(a){var b=k.exec(a),c=b[1]||" ",d=b[3]||"",e=b[5],f=+b[6],g=b[7],h=b[8],i=b[9],j=!1,o=!1;h&&(h=h.substring(1)),e&&(c="0",g&&(f-=Math.floor((f-1)/4)));switch(i){case"n":g=!0,i="g";break;case"%":j=!0,i="f";break;case"p":j=!0,i="r";break;case"d":o=!0,h="0"}i=l[i]||m;return function(a){var b=j?a*100:+a,k=b<0&&(b=-b)?"−":d;if(o&&b%1)return"";a=i(b,h);if(e){var l=a.length+k.length;l<f&&(a=Array(f-l+1).join(c)+a),g&&(a=n(a)),a=k+a}else{g&&(a=n(a)),a=k+a;var l=a.length;l<f&&(a=Array(f-l+1).join(c)+a)}j&&(a+="%");return a}};var k=/(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/,l={g:function(a,b){return a.toPrecision(b)},e:function(a,b){return a.toExponential(b)},f:function(a,b){return a.toFixed(b)},r:function(a,b){var c=1+Math.floor(1e-15+Math.log(a)/Math.LN10);return d3.round(a,b-c).toFixed(Math.max(0,Math.min(20,b-c)))}},o=v(2),p=v(3),q={linear:function(){return u},poly:v,quad:function(){return o},cubic:function(){return p},sin:function(){return w},exp:function(){return x},circle:function(){return y},elastic:z,back:A,bounce:function(){return B}},r={"in":function(a){return a},out:s,"in-out":t,"out-in":function(a){return t(s(a))}};d3.ease=function(a){var b=a.indexOf("-"),c=b>=0?a.substring(0,b):a,d=b>=0?a.substring(b+1):"in";return r[d](q[c].apply(null,Array.prototype.slice.call(arguments,1)))},d3.event=null,d3.interpolate=function(a,b){var c=d3.interpolators.length,d;while(--c>=0&&!(d=d3.interpolators[c](a,b)));return d},d3.interpolateNumber=function(a,b){b-=a;return function(c){return a+b*c}},d3.interpolateRound=function(a,b){b-=a;return function(c){return Math.round(a+b*c)}},d3.interpolateString=function(a,b){var c,d,e,f=0,g=0,h=[],i=[],j,k;C.lastIndex=0;for(d=0;c=C.exec(b);++d)c.index&&h.push(b.substring(f,g=c.index)),i.push({i:h.length,x:c[0]}),h.push(null),f=C.lastIndex;f<b.length&&h.push(b.substring(f));for(d=0,j=i.length;(c=C.exec(a))&&d<j;++d){k=i[d];if(k.x==c[0]){if(k.i)if(h[k.i+1]==null){h[k.i-1]+=k.x,h.splice(k.i,1);for(e=d+1;e<j;++e)i[e].i--}else{h[k.i-1]+=k.x+h[k.i+1],h.splice(k.i,2);for(e=d+1;e<j;++e)i[e].i-=2}else if(h[k.i+1]==null)h[k.i]=k.x;else{h[k.i]=k.x+h[k.i+1],h.splice(k.i+1,1);for(e=d+1;e<j;++e)i[e].i--}i.splice(d,1),j--,d--}else k.x=d3.interpolateNumber(parseFloat(c[0]),parseFloat(k.x))}while(d<j)k=i.pop(),h[k.i+1]==null?h[k.i]=k.x:(h[k.i]=k.x+h[k.i+1],h.splice(k.i+1,1)),j--;return h.length===1?h[0]==null?i[0].x:function(){return b}:function(a){for(d=0;d<j;++d)h[(k=i[d]).i]=k.x(a);return h.join("")}},d3.interpolateRgb=function(a,b){a=d3.rgb(a),b=d3.rgb(b);var c=a.r,d=a.g,e=a.b,f=b.r-c,g=b.g-d,h=b.b-e;return function(a){return"rgb("+Math.round(c+f*a)+","+Math.round(d+g*a)+","+Math.round(e+h*a)+")"}},d3.interpolateHsl=function(a,b){a=d3.hsl(a),b=d3.hsl(b);var c=a.h,d=a.s,e=a.l,f=b.h-c,g=b.s-d,h=b.l-e;return function(a){return R(c+f*a,d+g*a,e+h*a).toString()}},d3.interpolateArray=function(a,b){var c=[],d=[],e=a.length,f=b.length,g=Math.min(a.length,b.length),h;for(h=0;h<g;++h)c.push(d3.interpolate(a[h],b[h]));for(;h<e;++h)d[h]=a[h];for(;h<f;++h)d[h]=b[h];return function(a){for(h=0;h<g;++h)d[h]=c[h](a);return d}},d3.interpolateObject=function(a,b){var c={},d={},e;for(e in a)e in b?c[e]=E(e)(a[e],b[e]):d[e]=a[e];for(e in b)e in a||(d[e]=b[e]);return function(a){for(e in c)d[e]=c[e](a);return d}};var C=/[-+]?(?:\d+\.\d+|\d+\.|\.\d+|\d+)(?:[eE][-]?\d+)?/g,D={background:1,fill:1,stroke:1};d3.interpolators=[d3.interpolateObject,function(a,b){return b instanceof Array&&d3.interpolateArray(a,b)},function(a,b){return typeof b=="string"&&d3.interpolateString(String(a),b)},function(a,b){return(typeof b=="string"?b in N||/^(#|rgb\(|hsl\()/.test(b):b instanceof I||b instanceof Q)&&d3.interpolateRgb(String(a),b)},function(a,b){return typeof b=="number"&&d3.interpolateNumber(+a,b)}],d3.rgb=function(a,b,c){return arguments.length===1?K(""+a,H,R):H(~~a,~~b,~~c)},I.prototype.brighter=function(a){a=Math.pow(.7,arguments.length?a:1);var b=this.r,c=this.g,d=this.b,e=30;if(!b&&!c&&!d)return H(e,e,e);b&&b<e&&(b=e),c&&c<e&&(c=e),d&&d<e&&(d=e);return H(Math.min(255,Math.floor(b/a)),Math.min(255,Math.floor(c/a)),Math.min(255,Math.floor(d/a)))},I.prototype.darker=function(a){a=Math.pow(.7,arguments.length?a:1);return H(Math.max(0,Math.floor(a*this.r)),Math.max(0,Math.floor(a*this.g)),Math.max(0,Math.floor(a*this.b)))},I.prototype.hsl=function(){return L(this.r,this.g,this.b)},I.prototype.toString=function(){return"#"+J(this.r)+J(this.g)+J(this.b)};var N={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};for(var O in N)N[O]=K(N[O],H,R);d3.hsl=function(a,b,c){return arguments.length===1?K(""+a,L,P):P(+a,+b,+c)},Q.prototype.brighter=function(a){a=Math.pow(.7,arguments.length?a:1);return P(this.h,this.s,this.l/a)},Q.prototype.darker=function(a){a=Math.pow(.7,arguments.length?a:1);return P(this.h,this.s,a*this.l)},Q.prototype.rgb=function(){return R(this.h,this.s,this.l)},Q.prototype.toString=function(){return"hsl("+this.h+","+this.s*100+"%,"+this.l*100+"%)"},d3.select=function(a){return typeof a=="string"?W.select(a):S([[a]])},d3.selectAll=function(b){return typeof b=="string"?W.selectAll(b):S([a(b)])};var T=function(a,b){return b.querySelector(a)},U=function(b,c){return a(c.querySelectorAll(b))};typeof Sizzle=="function"&&(T=function(a,b){return Sizzle(a,b)[0]},U=function(a,b){return Sizzle.uniqueSort(Sizzle(a,b))});var V=[],W=S([[document]]);W[0].parentNode=document.documentElement,d3.selection=function(){return W},d3.selection.prototype=V,V.select=function(a){var b=[],c,d,e,f;typeof a!="function"&&(a=X(a));for(var g=-1,h=this.length;++g<h;){b.push(c=[]),c.parentNode=(e=this[g]).parentNode;for(var i=-1,j=e.length;++i<j;)(f=e[i])?(c.push(d=a(f)),d&&"__data__"in f&&(d.__data__=f.__data__)):c.push(null)}return S(b)},V.selectAll=function(a){var b=[],c,d;typeof a!="function"&&(a=Y(a));for(var e=-1,f=this.length;++e<f;)for(var g=this[e],h=-1,i=g.length;++h<i;)if(d=g[h])b.push(c=a(d)),c.parentNode=d;return S(b)},V.attr=function(a,b){function i(){var c=b.apply(this,arguments);c==null?this.removeAttributeNS(a.space,a.local):this.setAttributeNS(a.space,a.local,c)}function h(){var c=b.apply(this,arguments);c==null?this.removeAttribute(a):this.setAttribute(a,c)}function g(){this.setAttributeNS(a.space,a.local,b)}function f(){this.setAttribute(a,b)}function e(){this.removeAttributeNS(a.space,a.local)}function d(){this.removeAttribute(a)}a=d3.ns.qualify(a);if(arguments.length<2){var c=this.node();return a.local?c.getAttributeNS(a.space,a.local):c.getAttribute(a)}return this.each(b==null?a.local?e:d:typeof b=="function"?a.local?i:h:a.local?g:f)},V.classed=function(a,b){function i(){(b.apply(this,arguments)?f:g).call(this)}function g(){if(b=this.classList)return b.remove(a);var b=this.className,d=b.baseVal!=null,e=d?b.baseVal:b;e=h(e.replace(c," ")),d?b.baseVal=e:this.className=e}function f(){if(b=this.classList)return b.add(a);var b=this.className,d=b.baseVal!=null,e=d?b.baseVal:b;c.lastIndex=0,c.test(e)||(e=h(e+" "+a),d? <add>b.baseVal=e:this.className=e)}var c=new RegExp("(^|\\s+)"+d3.requote(a)+"(\\s+|$)","g");if(arguments.length<2){var d=this.node();if(e=d.classList)return e.contains(a);var e=d.className;c.lastIndex=0;return c.test(e.baseVal!=null?e.baseVal:e)}return this.each(typeof b=="function"?i:b?f:g)},V.style=function(a,b,c){function f(){var d=b.apply(this,arguments);d==null?this.style.removeProperty(a):this.style.setProperty(a,d,c)}function e(){this.style.setProperty(a,b,c)}function d(){this.style.removeProperty(a)}arguments.length<3&&(c="");return arguments.length<2?window.getComputedStyle(this.node(),null).getPropertyValue(a):this.each(b==null?d:typeof b=="function"?f:e)},V.property=function(a,b){function e(){var c=b.apply(this,arguments);c==null?delete this[a]:this[a]=c}function d(){this[a]=b}function c(){delete this[a]}return arguments.length<2?this.node()[a]:this.each(b==null?c:typeof b=="function"?e:d)},V.text=function(a){return arguments.length<1?this.node().textContent:this.each(typeof a=="function"?function(){this.textContent=a.apply(this,arguments)}:function(){this.textContent=a})},V.html=function(a){return arguments.length<1?this.node().innerHTML:this.each(typeof a=="function"?function(){this.innerHTML=a.apply(this,arguments)}:function(){this.innerHTML=a})},V.append=function(a){function c(b){return b.appendChild(document.createElementNS(a.space,a.local))}function b(b){return b.appendChild(document.createElement(a))}a=d3.ns.qualify(a);return this.select(a.local?c:b)},V.insert=function(a,b){function d(c){return c.insertBefore(document.createElementNS(a.space,a.local),T(b,c))}function c(c){return c.insertBefore(document.createElement(a),T(b,c))}a=d3.ns.qualify(a);return this.select(a.local?d:c)},V.remove=function(){return this.each(function(){var a=this.parentNode;a&&a.removeChild(this)})},V.data=function(a,b){function f(a,f){var g,h=a.length,i=f.length,j=Math.min(h,i),k=Math.max(h,i),l=[],m=[],n=[],o,p;if(b){var q={},r=[],s,t=f.length;for(g=-1;++g<h;)s=b.call(o=a[g],o.__data__,g),s in q?n[t++]=o:q[s]=o,r.push(s);for(g=-1;++g<i;)o=q[s=b.call(f,p=f[g],g)],o?(o.__data__=p,l[g]=o,m[g]=n[g]=null):(m[g]=Z(p),l[g]=n[g]=null),delete q[s];for(g=-1;++g<h;)r[g]in q&&(n[g]=a[g])}else{for(g=-1;++g<j;)o=a[g],p=f[g],o?(o.__data__=p,l[g]=o,m[g]=n[g]=null):(m[g]=Z(p),l[g]=n[g]=null);for(;g<i;++g)m[g]=Z(f[g]),l[g]=n[g]=null;for(;g<k;++g)n[g]=a[g],m[g]=l[g]=null}m.update=l,m.parentNode=l.parentNode=n.parentNode=a.parentNode,c.push(m),d.push(l),e.push(n)}var c=[],d=[],e=[],g=-1,h=this.length,i;if(typeof a=="function")while(++g<h)f(i=this[g],a.call(i,i.parentNode.__data__,g));else while(++g<h)f(i=this[g],a);var j=S(d);j.enter=function(){return $(c)},j.exit=function(){return S(e)};return j};var _=[];_.append=V.append,_.insert=V.insert,_.empty=V.empty,_.select=function(a){var b=[],c,d,e,f,g;for(var h=-1,i=this.length;++h<i;){e=(f=this[h]).update,b.push(c=[]),c.parentNode=f.parentNode;for(var j=-1,k=f.length;++j<k;)(g=f[j])?(c.push(e[j]=d=a(f.parentNode)),d.__data__=g.__data__):c.push(null)}return S(b)},V.filter=function(a){var b=[],c,d,e;for(var f=0,g=this.length;f<g;f++){b.push(c=[]),c.parentNode=(d=this[f]).parentNode;for(var h=0,i=d.length;h<i;h++)(e=d[h])&&a.call(e,e.__data__,h)&&c.push(e)}return S(b)},V.map=function(a){return this.each(function(){this.__data__=a.apply(this,arguments)})},V.sort=function(a){a=ba.apply(this,arguments);for(var b=0,c=this.length;b<c;b++)for(var d=this[b].sort(a),e=1,f=d.length,g=d[0];e<f;e++){var h=d[e];h&&(g&&g.parentNode.insertBefore(h,g.nextSibling),g=h)}return this},V.on=function(a,b,c){arguments.length<3&&(c=!1);var d="__on"+a,e=a.indexOf(".");e>0&&(a=a.substring(0,e));return arguments.length<2?(e=this.node()[d])&&e._:this.each(function(e,f){function h(a){var c=d3.event;d3.event=a;try{b.call(g,g.__data__,f)}finally{d3.event=c}}var g=this;g[d]&&g.removeEventListener(a,g[d],c),b&&g.addEventListener(a,g[d]=h,c),h._=b})},V.each=function(a){for(var b=-1,c=this.length;++b<c;)for(var d=this[b],e=-1,f=d.length;++e<f;){var g=d[e];g&&a.call(g,g.__data__,e,b)}return this},V.call=function(a){a.apply(this,(arguments[0]=this,arguments));return this},V.empty=function(){return!this.node()},V.node=function(a){for(var b=0,c=this.length;b<c;b++)for(var d=this[b],e=0,f=d.length;e<f;e++){var g=d[e];if(g)return g}return null},V.transition=function(){var a=[],b,c;for(var d=-1,e=this.length;++d<e;){a.push(b=[]);for(var f=this[d],g=-1,h=f.length;++g<h;)b.push((c=f[g])?{node:c,delay:0,duration:250}:null)}return bb(a,bf||++be)};var bd=[],be=0,bf=0,bg=d3.ease("cubic-in-out");bd.call=V.call,d3.transition=function(){return W.transition()},d3.transition.prototype=bd,bd.select=function(a){var b=[],c,d,e;typeof a!="function"&&(a=X(a));for(var f=-1,g=this.length;++f<g;){b.push(c=[]);for(var h=this[f],i=-1,j=h.length;++i<j;)(e=h[i])&&(d=a(e.node))?("__data__"in e.node&&(d.__data__=e.node.__data__),c.push({node:d,delay:e.delay,duration:e.duration})):c.push(null)}return bb(b,this.id).ease(this.ease())},bd.selectAll=function(a){var b=[],c,d;typeof a!="function"&&(a=Y(a));for(var e=-1,f=this.length;++e<f;)for(var g=this[e],h=-1,i=g.length;++h<i;)if(d=g[h]){b.push(c=a(d.node));for(var j=-1,k=c.length;++j<k;)c[j]={node:c[j],delay:d.delay,duration:d.duration}}return bb(b,this.id).ease(this.ease())},bd.attr=function(a,b){return this.attrTween(a,bc(b))},bd.attrTween=function(a,b){function d(c,d){var e=b.call(this,c,d,this.getAttributeNS(a.space,a.local));return e&&function(b){this.setAttributeNS(a.space,a.local,e(b))}}function c(c,d){var e=b.call(this,c,d,this.getAttribute(a));return e&&function(b){this.setAttribute(a,e(b))}}a=d3.ns.qualify(a);return this.tween("attr."+a,a.local?d:c)},bd.style=function(a,b,c){arguments.length<3&&(c=null);return this.styleTween(a,bc(b),c)},bd.styleTween=function(a,b,c){arguments.length<3&&(c=null);return this.tween("style."+a,function(d,e){var f=b.call(this,d,e,window.getComputedStyle(this,null).getPropertyValue(a));return f&&function(b){this.style.setProperty(a,f(b),c)}})},bd.text=function(a){return this.tween("text",function(b,c){this.textContent=typeof a=="function"?a.call(this,b,c):a})},bd.remove=function(){return this.each("end",function(){var a;!this.__transition__&&(a=this.parentNode)&&a.removeChild(this)})},bd.delay=function(a){var b=this;return b.each(typeof a=="function"?function(c,d,e){b[e][d].delay=+a.apply(this,arguments)}:(a=+a,function(c,d,e){b[e][d].delay=a}))},bd.duration=function(a){var b=this;return b.each(typeof a=="function"?function(c,d,e){b[e][d].duration=+a.apply(this,arguments)}:(a=+a,function(c,d,e){b[e][d].duration=a}))};var bi=null,bj,bk;d3.timer=function(a,b){var c=Date.now(),d=!1,e,f=bi;if(arguments.length<2)b=0;else if(!isFinite(b))return;while(f){if(f.callback===a){f.then=c,f.delay=b,d=!0;break}e=f,f=f.next}d||(bi={callback:a,then:c,delay:b,next:bi}),bj||(bk=clearTimeout(bk),bj=1,bn(bl))},d3.timer.flush=function(){var a,b=Date.now(),c=bi;while(c)a=b-c.then,c.delay||(c.flush=c.callback(a)),c=c.next;bm()};var bn=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){setTimeout(a,17)};d3.scale={},d3.scale.linear=function(){return bs([0,1],[0,1],d3.interpolate,!1)},d3.scale.log=function(){return bA(d3.scale.linear(),bB)},bB.pow=function(a){return Math.pow(10,a)},bC.pow=function(a){return-Math.pow(10,-a)},d3.scale.pow=function(){return bE(d3.scale.linear(),1)},d3.scale.sqrt=function(){return d3.scale.pow().exponent(.5)},d3.scale.ordinal=function(){return bG({},0,{t:"range",x:[]})},d3.scale.category10=function(){return d3.scale.ordinal().range(bH)},d3.scale.category20=function(){return d3.scale.ordinal().range(bI)},d3.scale.category20b=function(){return d3.scale.ordinal().range(bJ)},d3.scale.category20c=function(){return d3.scale.ordinal().range(bK)};var bH=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],bI=["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"],bJ=["#393b79","#5254a3","#6b6ecf","#9c9ede","#637939","#8ca252","#b5cf6b","#cedb9c","#8c6d31","#bd9e39","#e7ba52","#e7cb94","#843c39","#ad494a","#d6616b","#e7969c","#7b4173","#a55194","#ce6dbd","#de9ed6"],bK=["#3182bd","#6baed6","#9ecae1","#c6dbef","#e6550d","#fd8d3c","#fdae6b","#fdd0a2","#31a354","#74c476","#a1d99b","#c7e9c0","#756bb1","#9e9ac8","#bcbddc","#dadaeb","#636363","#969696","#bdbdbd","#d9d9d9"];d3.scale.quantile=function(){return bL([],[])},d3.scale.quantize=function(){return bM(0,1,[0,1])},d3.svg={},d3.svg.arc=function(){function e(){var e=a.apply(this,arguments),f=b.apply(this,arguments),g=c.apply(this,arguments)+bN,h=d.apply(this,arguments)+bN,i=(h<g&&(i=g,g=h,h=i),h-g),j=i<Math.PI?"0":"1",k=Math.cos(g),l=Math.sin(g),m=Math.cos(h),n=Math.sin(h);return i>=bO?e?"M0,"+f+"A"+f+","+f+" 0 1,1 0,"+ -f+"A"+f+","+f+" 0 1,1 0,"+f+"M0,"+e+"A"+e+","+e+" 0 1,1 0,"+ -e+"A"+e+","+e+" 0 1,1 0,"+e+"Z":"M0,"+f+"A"+f+","+f+" 0 1,1 0,"+ -f+"A"+f+","+f+" 0 1,1 0,"+f+"Z":e?"M"+f*k+","+f*l+"A"+f+","+f+" 0 "+j+",1 "+f*m+","+f*n+"L"+e*m+","+e*n+"A"+e+","+e+" 0 "+j+",0 "+e*k+","+e*l+"Z":"M"+f*k+","+f*l+"A"+f+","+f+" 0 "+j+",1 "+f*m+","+f*n+"L0,0"+"Z"}var a=bP,b=bQ,c=bR,d=bS;e.innerRadius=function(b){if(!arguments.length)return a;a=d3.functor(b);return e},e.outerRadius=function(a){if(!arguments.length)return b;b=d3.functor(a);return e},e.startAngle=function(a){if(!arguments.length)return c;c=d3.functor(a);return e},e.endAngle=function(a){if(!arguments.length)return d;d=d3.functor(a);return e},e.centroid=function(){var e=(a.apply(this,arguments)+b.apply(this,arguments))/2,f=(c.apply(this,arguments)+d.apply(this,arguments))/2+bN;return[Math.cos(f)*e,Math.sin(f)*e]};return e};var bN=-Math.PI/2,bO=2*Math.PI-1e-6;d3.svg.line=function(){return bT(Object)};var bX={linear:bY,"step-before":bZ,"step-after":b$,basis:ce,"basis-open":cf,"basis-closed":cg,bundle:ch,cardinal:cb,"cardinal-open":b_,"cardinal-closed":ca,monotone:cq},cj=[0,2/3,1/3,0],ck=[0,1/3,2/3,0],cl=[0,1/6,2/3,1/6];d3.svg.line.radial=function(){var a=bT(cr);a.radius=a.x,delete a.x,a.angle=a.y,delete a.y;return a},d3.svg.area=function(){return cs(Object)},d3.svg.area.radial=function(){var a=cs(cr);a.radius=a.x,delete a.x,a.innerRadius=a.x0,delete a.x0,a.outerRadius=a.x1,delete a.x1,a.angle=a.y,delete a.y,a.startAngle=a.y0,delete a.y0,a.endAngle=a.y1,delete a.y1;return a},d3.svg.chord=function(){function j(a,b,c,d){return"Q 0,0 "+d}function i(a,b){return"A"+a+","+a+" 0 0,1 "+b}function h(a,b){return a.a0==b.a0&&a.a1==b.a1}function g(a,b,f,g){var h=b.call(a,f,g),i=c.call(a,h,g),j=d.call(a,h,g)+bN,k=e.call(a,h,g)+bN;return{r:i,a0:j,a1:k,p0:[i*Math.cos(j),i*Math.sin(j)],p1:[i*Math.cos(k),i*Math.sin(k)]}}function f(c,d){var e=g(this,a,c,d),f=g(this,b,c,d);return"M"+e.p0+i(e.r,e.p1)+(h(e,f)?j(e.r,e.p1,e.r,e.p0):j(e.r,e.p1,f.r,f.p0)+i(f.r,f.p1)+j(f.r,f.p1,e.r,e.p0))+"Z"}var a=cv,b=cw,c=cx,d=bR,e=bS;f.radius=function(a){if(!arguments.length)return c;c=d3.functor(a);return f},f.source=function(b){if(!arguments.length)return a;a=d3.functor(b);return f},f.target=function(a){if(!arguments.length)return b;b=d3.functor(a);return f},f.startAngle=function(a){if(!arguments.length)return d;d=d3.functor(a);return f},f.endAngle=function(a){if(!arguments.length)return e;e=d3.functor(a);return f};return f},d3.svg.diagonal=function(){function d(d,e){var f=a.call(this,d,e),g=b.call(this,d,e),h=(f.y+g.y)/2,i=[f,{x:f.x,y:h},{x:g.x,y:h},g];i=i.map(c);return"M"+i[0]+"C"+i[1]+" "+i[2]+" "+i[3]}var a=cv,b=cw,c=cA;d.source=function(b){if(!arguments.length)return a;a=d3.functor(b);return d},d.target=function(a){if(!arguments.length)return b;b=d3.functor(a);return d},d.projection=function(a){if(!arguments.length)return c;c=a;return d};return d},d3.svg.diagonal.radial=function(){var a=d3.svg.diagonal(),b=cA,c=a.projection;a.projection=function(a){return arguments.length?c(cB(b=a)):b};return a},d3.svg.mouse=function(a){return cD(a,d3.event)};var cC=/WebKit/.test(navigator.userAgent)?-1:0;d3.svg.touches=function(b){var c=d3.event.touches;return c?a(c).map(function(a){var c=cD(b,a);c.identifier=a.identifier;return c}):[]},d3.svg.symbol=function(){function c(c,d){return(cG[a.call(this,c,d)]||cG.circle)(b.call(this,c,d))}var a=cF,b=cE;c.type=function(b){if(!arguments.length)return a;a=d3.functor(b);return c},c.size=function(a){if(!arguments.length)return b;b=d3.functor(a);return c};return c};var cG={circle:function(a){var b=Math.sqrt(a/Math.PI);return"M0,"+b+"A"+b+","+b+" 0 1,1 0,"+ -b+"A"+b+","+b+" 0 1,1 0,"+b+"Z"},cross:function(a){var b=Math.sqrt(a/5)/2;return"M"+ -3*b+","+ -b+"H"+ -b+"V"+ -3*b+"H"+b+"V"+ -b+"H"+3*b+"V"+b+"H"+b+"V"+3*b+"H"+ -b+"V"+b+"H"+ -3*b+"Z"},diamond:function(a){var b=Math.sqrt(a/(2*cI)),c=b*cI;return"M0,"+ -b+"L"+c+",0"+" 0,"+b+" "+ -c+",0"+"Z"},square:function(a){var b=Math.sqrt(a)/2;return"M"+ -b+","+ -b+"L"+b+","+ -b+" "+b+","+b+" "+ -b+","+b+"Z"},"triangle-down":function(a){var b=Math.sqrt(a/cH),c=b*cH/2;return"M0,"+c+"L"+b+","+ -c+" "+ -b+","+ -c+"Z"},"triangle-up":function(a){var b=Math.sqrt(a/cH),c=b*cH/2;return"M0,"+ -c+"L"+b+","+c+" "+ -b+","+c+"Z"}};d3.svg.symbolTypes=d3.keys(cG);var cH=Math.sqrt(3),cI=Math.tan(30*Math.PI/180);d3.svg.axis=function(){function j(j){j.each(function(k,l,m){function F(a){return j.delay?a.transition().delay(j[m][l].delay).duration(j[m][l].duration).ease(j.ease()):a}var n=d3.select(this),o=a.ticks.apply(a,g),p=h||a.tickFormat.apply(a,g),q=cL(a,o,i),r=n.selectAll(".minor").data(q,String),s=r.enter().insert("svg:line","g").attr("class","tick minor").style("opacity",1e-6),t=F(r.exit()).style("opacity",1e-6).remove(),u=F(r).style("opacity",1),v=n.selectAll("g").data(o,String),w=v.enter().insert("svg:g","path").style("opacity",1e-6),x=F(v.exit()).style("opacity",1e-6).remove(),y=F(v).style("opacity",1),z,A=a.range(),B=n.selectAll(".domain").data([]),C=B.enter().append("svg:path").attr("class","domain"),D=F(B),E=this.__chart__||a;this.__chart__=a.copy(),w.append("svg:line").attr("class","tick"),w.append("svg:text"),y.select("text").text(p);switch(b){case"bottom":z=cJ,u.attr("y2",d),w.select("text").attr("dy",".71em").attr("text-anchor","middle"),y.select("line").attr("y2",c),y.select("text").attr("y",Math.max(c,0)+f),D.attr("d","M"+A[0]+","+e+"V0H"+A[1]+"V"+e);break;case"top":z=cJ,u.attr("y2",-d),w.select("text").attr("text-anchor","middle"),y.select("line").attr("y2",-c),y.select("text").attr("y",-(Math.max(c,0)+f)),D.attr("d","M"+A[0]+","+ -e+"V0H"+A[1]+"V"+ -e);break;case"left":z=cK,u.attr("x2",-d),w.select("text").attr("dy",".32em").attr("text-anchor","end"),y.select("line").attr("x2",-c),y.select("text").attr("x",-(Math.max(c,0)+f)),D.attr("d","M"+ -e+","+A[0]+"H0V"+A[1]+"H"+ -e);break;case"right":z=cK,u.attr("x2",d),w.select("text").attr("dy",".32em"),y.select("line").attr("x2",c),y.select("text").attr("x",Math.max(c,0)+f),D.attr("d","M"+e+","+A[0]+"H0V"+A[1]+"H"+e)}w.call(z,E),y.call(z,a),x.call(z,a),s.call(z,E),u.call(z,a),t.call(z,a)})}var a=d3.scale.linear(),b="bottom",c=6,d=6,e=6,f=3,g=[10],h,i=0;j.scale=function(b){if(!arguments.length)return a;a=b;return j},j.orient=function(a){if(!arguments.length)return b;b=a;return j},j.ticks=function(){if(!arguments.length)return g;g=arguments;return j},j.tickFormat=function(a){if(!arguments.length)return h;h=a;return j},j.tickSize=function(a,b,f){if(!arguments.length)return c;var g=arguments.length-1;c=+a,d=g>1?+b:c,e=g>0?+arguments[g]:c;return j},j.tickPadding=function(a){if(!arguments.length)return f;f=+a;return j},j.tickSubdivide=function(a){if(!arguments.length)return i;i=+a;return j};return j},d3.behavior={},d3.behavior.drag=function(){function d(){c.apply(this,arguments),cS("dragstart")}function c(){cM=a,cP=cT((cN=this).parentNode),cQ=0,cO=arguments}function b(){this.on("mousedown.drag",d).on("touchstart.drag",d),d3.select(window).on("mousemove.drag",cU).on("touchmove.drag",cU).on("mouseup.drag",cV,!0).on("touchend.drag",cV,!0).on("click.drag",cW,!0)}var a=d3.dispatch("drag","dragstart","dragend");b.on=function(c,d){a[c].add(d);return b};return b};var cM,cN,cO,cP,cQ,cR;d3.behavior.zoom=function(){function h(){d.apply(this,arguments);var b=dj(),c,e=Date.now();b.length===1&&e-da<300&&dp(1+Math.floor(a[2]),c=b[0],c_[c.identifier]),da=e}function g(){d.apply(this,arguments);var b=d3.svg.mouse(dd);dp(d3.event.shiftKey?Math.ceil(a[2]-1):Math.floor(a[2]+1),b,dh(b))}function f(){d.apply(this,arguments),c$||(c$=dh(d3.svg.mouse(dd))),dp(di()+a[2],d3.svg.mouse(dd),c$)}function e(){d.apply(this,arguments),cZ=dh(d3.svg.mouse(dd)),df=!1,d3.event.preventDefault(),window.focus()}function d(){db=a,dc=b.zoom.dispatch,dd=this,de=arguments}function c(){this.on("mousedown.zoom",e).on("mousewheel.zoom",f).on("DOMMouseScroll.zoom",g).on("dblclick.zoom",g).on("touchstart.zoom",h),d3.select(window).on("mousemove.zoom",dl).on("mouseup.zoom",dm).on("touchmove.zoom",dk).on("touchend.zoom",dj).on("click.zoom",dn,!0)}var a=[0,0,0],b=d3.dispatch("zoom");c.on=function(a,d){b[a].add(d);return c};return c};var cY,cZ,c$,c_={},da=0,db,dc,dd,de,df,dg})() <ide>\ No newline at end of file <ide><path>src/behavior/drag.js <ide> d3.behavior.drag = function() { <ide> <ide> var d3_behavior_dragEvent, <ide> d3_behavior_dragTarget, <add> d3_behavior_dragArguments, <ide> d3_behavior_dragOffset, <ide> d3_behavior_dragMoved, <ide> d3_behavior_dragStopClick; <ide> function d3_behavior_dragMove() { <ide> function d3_behavior_dragUp() { <ide> if (!d3_behavior_dragTarget) return; <ide> d3_behavior_dragDispatch("dragend"); <del> d3_behavior_dragForce = d3_behavior_dragTarget = null; <add> d3_behavior_dragTarget = null; <ide> <ide> // If the node was moved, prevent the mouseup from propagating. <ide> // Also prevent the subsequent click from propagating (e.g., for anchors). <ide><path>src/behavior/zoom.js <ide> var d3_behavior_zoomDiv, <ide> d3_behavior_zoomDispatch, <ide> d3_behavior_zoomTarget, <ide> d3_behavior_zoomArguments, <add> d3_behavior_zoomMoved, <ide> d3_behavior_zoomStopClick; <ide> <ide> function d3_behavior_zoomLocation(point) {
4
Ruby
Ruby
add outdated_release? method
7076ed890a1eee10c94791e7557ab16769ab80ef
<ide><path>Library/Homebrew/os/mac.rb <ide> def prerelease? <ide> version >= "10.12" <ide> end <ide> <add> def outdated_release? <add> # TODO: bump version when new OS is released <add> version < "10.9" <add> end <add> <ide> def cat <ide> version.to_sym <ide> end
1
Text
Text
update readme with my pronouns
c7707a1ccaf4cb17e18f4bf11fb04a242d34bdff
<ide><path>README.md <ide> For more information about the governance of the Node.js project, see <ide> * [kunalspathak](https://github.com/kunalspathak) - <ide> **Kunal Pathak** &lt;kunal.pathak@microsoft.com&gt; <ide> * [lance](https://github.com/lance) - <del>**Lance Ball** &lt;lball@redhat.com&gt; <add>**Lance Ball** &lt;lball@redhat.com&gt; (he/him) <ide> * [Leko](https://github.com/Leko) - <ide> **Shingo Inoue** &lt;leko.noor@gmail.com&gt; (he/him) <ide> * [lpinca](https://github.com/lpinca) -
1
Text
Text
remove unused link reference
c892f6f97db35a1833bfa22d91a0768a57cdec2b
<ide><path>doc/api/child_process.md <ide> unavailable. <ide> <ide> [`'error'`]: #child_process_event_error <ide> [`'exit'`]: #child_process_event_exit <del>[`'message'`]: #child_process_event_message <ide> [`ChildProcess`]: #child_process_child_process <ide> [`Error`]: errors.html#errors_class_error <ide> [`EventEmitter`]: events.html#events_class_eventemitter
1
Go
Go
improve the crashtest script
c4cd224d901ece4d9a2f15d10a80998f2b970c07
<ide><path>contrib/crashTest.go <ide> import ( <ide> const DOCKER_PATH = "/home/creack/dotcloud/docker/docker/docker" <ide> <ide> func runDaemon() (*exec.Cmd, error) { <add> os.Remove("/var/run/docker.pid") <ide> cmd := exec.Command(DOCKER_PATH, "-d") <ide> outPipe, err := cmd.StdoutPipe() <ide> if err != nil { <ide> func crashTest() error { <ide> if err != nil { <ide> return err <ide> } <del> time.Sleep(5000 * time.Millisecond) <add> // time.Sleep(5000 * time.Millisecond) <add> var stop bool <ide> go func() error { <del> for i := 0; i < 100; i++ { <del> go func() error { <add> stop = false <add> for i := 0; i < 100 && !stop; i++ { <add> func() error { <ide> cmd := exec.Command(DOCKER_PATH, "run", "base", "echo", "hello", "world") <ide> log.Printf("%d", i) <ide> outPipe, err := cmd.StdoutPipe() <ide> func crashTest() error { <ide> outPipe.Close() <ide> return nil <ide> }() <del> time.Sleep(250 * time.Millisecond) <ide> } <ide> return nil <ide> }() <del> <ide> time.Sleep(20 * time.Second) <add> stop = true <ide> if err := daemon.Process.Kill(); err != nil { <ide> return err <ide> }
1
Javascript
Javascript
remove unused variables
df81b832bb728cfcc11bd1aff9cb6e38c25e3a1c
<ide><path>external/builder/test.js <ide> require('shelljs/make'); <ide> <ide> var builder = require('./builder'); <ide> var fs = require('fs'); <del>var path = require('path'); <ide> <ide> var errors = 0; <ide> <ide><path>external/umdutils/verifier.js <ide> function validateDependencies(context) { <ide> if (!(i in nonRoots)) { <ide> context.infoCallback('Root module: ' + i); <ide> } <del> }} <add> } <add>} <ide> <ide> /** <ide> * Validates all modules/files in the specified path. The modules must be <ide><path>make.js <ide> target.locale = function() { <ide> // Compresses cmap files. Ensure that Adobe cmap download and uncompressed at <ide> // ./external/cmaps location. <ide> // <del>target.cmaps = function (args) { <add>target.cmaps = function () { <ide> var CMAP_INPUT = 'external/cmaps'; <ide> var VIEWER_CMAP_OUTPUT = 'external/bcmaps'; <ide> <ide> target.singlefile = function() { <ide> <ide> }; <ide> <del>function stripCommentHeaders(content, filename) { <add>function stripCommentHeaders(content) { <ide> var notEndOfComment = '(?:[^*]|\\*(?!/))+'; <ide> var reg = new RegExp( <ide> '\n/\\* Copyright' + notEndOfComment + '\\*/\\s*' + <ide> function stripCommentHeaders(content, filename) { <ide> function cleanupJSSource(file) { <ide> var content = cat(file); <ide> <del> content = stripCommentHeaders(content, file); <add> content = stripCommentHeaders(content); <ide> <ide> content.to(file); <ide> } <ide> target.botmakeref = function() { <ide> echo(); <ide> echo('### Creating reference images'); <ide> <del> var PDF_TEST = env['PDF_TEST'] || 'test_manifest.json', <del> PDF_BROWSERS = env['PDF_BROWSERS'] || <add> var PDF_BROWSERS = env['PDF_BROWSERS'] || <ide> 'resources/browser_manifests/browser_manifest.json'; <ide> <ide> if (!test('-f', 'test/' + PDF_BROWSERS)) { <ide><path>src/core/annotation.js <ide> * See the License for the specific language governing permissions and <ide> * limitations under the License. <ide> */ <del>/* globals PDFJS */ <ide> <ide> 'use strict'; <ide> <ide> var stringToPDFString = sharedUtil.stringToPDFString; <ide> var stringToUTF8String = sharedUtil.stringToUTF8String; <ide> var warn = sharedUtil.warn; <ide> var Dict = corePrimitives.Dict; <del>var Name = corePrimitives.Name; <ide> var isDict = corePrimitives.isDict; <ide> var isName = corePrimitives.isName; <ide> var Stream = coreStream.Stream; <ide><path>src/core/function.js <ide> var PostScriptCompiler = (function PostScriptCompilerClosure() { <ide> var instructions = []; <ide> var inputSize = domain.length >> 1, outputSize = range.length >> 1; <ide> var lastRegister = 0; <del> var n, j, min, max; <add> var n, j; <ide> var num1, num2, ast1, ast2, tmpVar, item; <ide> for (i = 0; i < inputSize; i++) { <ide> stack.push(new AstArgument(i, domain[i * 2], domain[i * 2 + 1])); <ide><path>src/core/jbig2.js <ide> var Jbig2Image = (function Jbig2ImageClosure() { <ide> delete pageInfo.height; <ide> } <ide> var pageSegmentFlags = data[position + 16]; <del> var pageStripingInformatiom = readUint16(data, position + 17); <add> var pageStripingInformation = readUint16(data, position + 17); <ide> pageInfo.lossless = !!(pageSegmentFlags & 1); <ide> pageInfo.refinement = !!(pageSegmentFlags & 2); <ide> pageInfo.defaultPixelValue = (pageSegmentFlags >> 2) & 1; <ide><path>src/core/jpg.js <ide> var JpegImage = (function jpegImage() { <ide> <ide> function decodeScan(data, offset, frame, components, resetInterval, <ide> spectralStart, spectralEnd, successivePrev, successive) { <del> var precision = frame.precision; <del> var samplesPerLine = frame.samplesPerLine; <del> var scanLines = frame.scanLines; <ide> var mcusPerLine = frame.mcusPerLine; <ide> var progressive = frame.progressive; <del> var maxH = frame.maxH, maxV = frame.maxV; <ide> <ide> var startOffset = offset, bitsData = 0, bitsCount = 0; <ide> <ide> var JpegImage = (function jpegImage() { <ide> frame.mcusPerColumn = mcusPerColumn; <ide> } <ide> <del> var offset = 0, length = data.length; <add> var offset = 0; <ide> var jfif = null; <ide> var adobe = null; <del> var pixels = null; <ide> var frame, resetInterval; <ide> var quantizationTables = []; <ide> var huffmanTablesAC = [], huffmanTablesDC = []; <ide><path>src/core/jpx.js <ide> var JpxImage = (function JpxImageClosure() { <ide> case 0x636F6C72: // 'colr' <ide> // Colorspaces are not used, the CS from the PDF is used. <ide> var method = data[position]; <del> var precedence = data[position + 1]; <del> var approximation = data[position + 2]; <ide> if (method === 1) { <ide> // enumerated colorspace <ide> var colorspace = readUint32(data, position + 3); <ide><path>src/display/canvas.js <ide> var CanvasGraphics = (function CanvasGraphicsClosure() { <ide> return this.cachedGetSinglePixelWidth; <ide> }, <ide> getCanvasPosition: function CanvasGraphics_getCanvasPosition(x, y) { <del> var transform = this.ctx.mozCurrentTransform; <del> return [ <del> transform[0] * x + transform[2] * y + transform[4], <del> transform[1] * x + transform[3] * y + transform[5] <del> ]; <add> var transform = this.ctx.mozCurrentTransform; <add> return [ <add> transform[0] * x + transform[2] * y + transform[4], <add> transform[1] * x + transform[3] * y + transform[5] <add> ]; <ide> } <ide> }; <ide> <ide><path>src/shared/global.js <ide> * See the License for the specific language governing permissions and <ide> * limitations under the License. <ide> */ <del>/* globals PDFJS, global */ <add>/* globals global */ <ide> <ide> 'use strict'; <ide> <ide><path>web/overlay_manager.js <ide> * See the License for the specific language governing permissions and <ide> * limitations under the License. <ide> */ <del>/* globals Promise */ <ide> <ide> 'use strict'; <ide> <ide><path>web/pdf_document_properties.js <ide> * See the License for the specific language governing permissions and <ide> * limitations under the License. <ide> */ <del>/* globals Promise, mozL10n, getPDFFileNameFromURL, OverlayManager */ <add>/* globals mozL10n, getPDFFileNameFromURL, OverlayManager */ <ide> <ide> 'use strict'; <ide> <ide><path>web/view_history.js <ide> * See the License for the specific language governing permissions and <ide> * limitations under the License. <ide> */ <del>/* globals PDFJS, Promise */ <ide> <ide> 'use strict'; <ide> <ide><path>web/viewer.js <ide> * See the License for the specific language governing permissions and <ide> * limitations under the License. <ide> */ <del>/* globals PDFJS, PDFBug, FirefoxCom, Stats, Cache, ProgressBar, <add>/* globals PDFJS, PDFBug, FirefoxCom, Stats, ProgressBar, <ide> DownloadManager, getFileName, getPDFFileNameFromURL, <ide> PDFHistory, Preferences, SidebarView, ViewHistory, Stats, <ide> PDFThumbnailViewer, URL, noContextMenuHandler, SecondaryToolbar,
14
Javascript
Javascript
remove return statement from .update()
10c8fcaa50c1c620d0deb4800490fb29742777a1
<ide><path>src/helpers/VertexNormalsHelper.js <ide> VertexNormalsHelper.prototype.update = ( function () { <ide> <ide> position.needsUpdate = true; <ide> <del> return this; <del> <ide> }; <ide> <ide> }() );
1
Ruby
Ruby
add test for `language` stanza
87299af22547093a4efb9c4a5e06b55bb51f9ff7
<ide><path>Library/Homebrew/cask/test/cask/dsl_test.rb <ide> end <ide> end <ide> <add> describe "language stanza" do <add> after(:each) do <add> ENV["HOMEBREW_LANGUAGES"] = nil <add> end <add> <add> it "allows multilingual casks" do <add> cask = lambda { <add> Hbc::Cask.new("cask-with-apps") do <add> language "FIRST_LANGUAGE" do <add> :first <add> end <add> <add> language %r{SECOND_LANGUAGE} do <add> :second <add> end <add> <add> language :default do <add> :default <add> end <add> end <add> } <add> <add> ENV["HOMEBREW_LANGUAGES"] = "FIRST_LANGUAGE" <add> cask.call.language.must_equal :first <add> <add> ENV["HOMEBREW_LANGUAGES"] = "SECOND_LANGUAGE" <add> cask.call.language.must_equal :second <add> <add> ENV["HOMEBREW_LANGUAGES"] = "THIRD_LANGUAGE" <add> cask.call.language.must_equal :default <add> end <add> end <add> <ide> describe "app stanza" do <ide> it "allows you to specify app stanzas" do <ide> cask = Hbc::Cask.new("cask-with-apps") do <ide><path>Library/Homebrew/os/mac.rb <ide> def cat <ide> end <ide> <ide> def languages <del> @languages ||= Utils.popen_read("defaults", "read", ".GlobalPreferences", "AppleLanguages").scan(/[^ \n"(),]+/) <add> if ENV["HOMEBREW_LANGUAGES"] <add> ENV["HOMEBREW_LANGUAGES"].split(",") <add> else <add> @languages ||= Utils.popen_read("defaults", "read", ".GlobalPreferences", "AppleLanguages").scan(/[^ \n"(),]+/) <add> end <ide> end <ide> <ide> def language
2
Javascript
Javascript
fix debugstream method
bb7650bb45de60c87455655a306573d5adaba9fa
<ide><path>lib/internal/http2/core.js <ide> const { _connectionListener: httpConnectionListener } = http; <ide> let debug = require('internal/util/debuglog').debuglog('http2', (fn) => { <ide> debug = fn; <ide> }); <add>const debugEnabled = debug.enabled; <ide> <ide> function debugStream(id, sessionType, message, ...args) { <del> if (!debug.enabled) { <add> if (!debugEnabled) { <ide> return; <ide> } <ide> debug('Http2Stream %s [Http2Session %s]: ' + message,
1
Python
Python
improve handling of job_id in bigquery operators
47b05a87f004dc273a4757ba49f03808a86f77e7
<ide><path>airflow/providers/google/cloud/hooks/bigquery.py <ide> This module contains a BigQuery Hook, as well as a very basic PEP 249 <ide> implementation for BigQuery. <ide> """ <add>import hashlib <add>import json <ide> import logging <ide> import time <ide> import warnings <ide> from copy import deepcopy <add>from datetime import timedelta, datetime <ide> from typing import Any, Dict, Iterable, List, Mapping, NoReturn, Optional, Sequence, Tuple, Type, Union <ide> <ide> from google.api_core.retry import Retry <ide> def get_job( <ide> job = client.get_job(job_id=job_id, project=project_id, location=location) <ide> return job <ide> <add> @staticmethod <add> def _custom_job_id(configuration: Dict[str, Any]) -> str: <add> hash_base = json.dumps(configuration, sort_keys=True) <add> uniqueness_suffix = hashlib.md5(hash_base.encode()).hexdigest() <add> microseconds_from_epoch = int( <add> (datetime.now() - datetime.fromtimestamp(0)) / timedelta(microseconds=1) <add> ) <add> return f"airflow_{microseconds_from_epoch}_{uniqueness_suffix}" <add> <ide> @GoogleBaseHook.fallback_to_default_project_id <ide> def insert_job( <ide> self, <ide> def insert_job( <ide> :type location: str <ide> """ <ide> location = location or self.location <del> job_id = job_id or f"airflow_{int(time.time())}" <add> job_id = job_id or self._custom_job_id(configuration) <ide> <ide> client = self.get_client(project_id=project_id, location=location) <ide> job_data = { <ide><path>airflow/providers/google/cloud/operators/bigquery.py <ide> def _job_id(self, context): <ide> if self.job_id: <ide> return f"{self.job_id}_{uniqueness_suffix}" <ide> <del> exec_date = re.sub(r"\:|-|\+", "_", context['execution_date'].isoformat()) <del> return f"airflow_{self.dag_id}_{self.task_id}_{exec_date}_{uniqueness_suffix}" <add> exec_date = context['execution_date'].isoformat() <add> job_id = f"airflow_{self.dag_id}_{self.task_id}_{exec_date}_{uniqueness_suffix}" <add> return re.sub(r"\:|-|\+\.", "_", job_id) <ide> <ide> def execute(self, context: Any): <ide> hook = BigQueryHook(
2
Javascript
Javascript
update stub usage
809303b422fa5c44470c80dc6464cce141058200
<ide><path>packages/dalek/test/dalek.test.js <ide> describe('dalek', function() { <ide> atom.devMode = false; <ide> bundledPackages = ['duplicated-package', 'unduplicated-package']; <ide> packageDirPaths = [path.join('Users', 'username', '.atom', 'packages')]; <del> sandbox = sinon.sandbox.create(); <add> sandbox = sinon.createSandbox(); <ide> sandbox <ide> .stub(dalek, 'realpath') <ide> .callsFake(filePath => <ide><path>spec/main-process/atom-application.test.js <ide> const { EventEmitter } = require('events'); <ide> const temp = require('temp').track(); <ide> const fs = require('fs-plus'); <ide> const electron = require('electron'); <del>const { sandbox } = require('sinon'); <add>const sandbox = require('sinon').createSandbox(); <ide> <ide> const AtomApplication = require('../../src/main-process/atom-application'); <ide> const parseCommandLine = require('../../src/main-process/parse-command-line'); <ide> describe('AtomApplication', function() { <ide> } <ide> <ide> beforeEach(async function() { <del> sinon = sandbox.create(); <add> sinon = sandbox; <ide> scenario = await LaunchScenario.create(sinon); <ide> }); <ide> <ide> describe('AtomApplication', function() { <ide> <ide> app = scenario.getApplication(0); <ide> sinon.spy(app, 'openPaths'); <del> sinon.stub(app, 'promptForPath', (_type, callback, defaultPath) => <del> callback([defaultPath]) <del> ); <add> sinon <add> .stub(app, 'promptForPath') <add> .callsFake((_type, callback, defaultPath) => callback([defaultPath])); <ide> }); <ide> <ide> // This is the IPC message used to handle: <ide> describe('AtomApplication', function() { <ide> // * deprecated call links in deprecation-cop <ide> // * other direct callers of `atom.open()` <ide> it('"open" opens a fixed path by the standard opening rules', async function() { <del> sinon.stub(app, 'atomWindowForEvent', () => w1); <add> sinon.stub(app, 'atomWindowForEvent').callsFake(() => w1); <ide> <ide> electron.ipcMain.emit( <ide> 'open', <ide> describe('AtomApplication', function() { <ide> }); <ide> <ide> it('"open" without any option open the prompt for selecting a path', async function() { <del> sinon.stub(app, 'atomWindowForEvent', () => w1); <add> sinon.stub(app, 'atomWindowForEvent').callsFake(() => w1); <ide> <ide> electron.ipcMain.emit('open', {}); <ide> assert.strictEqual(app.promptForPath.lastCall.args[0], 'all'); <ide> }); <ide> <ide> it('"open-chosen-any" opens a file in the sending window', async function() { <del> sinon.stub(app, 'atomWindowForEvent', () => w2); <add> sinon.stub(app, 'atomWindowForEvent').callsFake(() => w2); <ide> <ide> electron.ipcMain.emit( <ide> 'open-chosen-any', <ide> describe('AtomApplication', function() { <ide> }); <ide> <ide> it('"open-chosen-any" opens a directory by the standard opening rules', async function() { <del> sinon.stub(app, 'atomWindowForEvent', () => w1); <add> sinon.stub(app, 'atomWindowForEvent').callsFake(() => w1); <ide> <ide> // Open unrecognized directory in empty window <ide> electron.ipcMain.emit( <ide> describe('AtomApplication', function() { <ide> }); <ide> <ide> it('"open-chosen-file" opens a file chooser and opens the chosen file in the sending window', async function() { <del> sinon.stub(app, 'atomWindowForEvent', () => w0); <add> sinon.stub(app, 'atomWindowForEvent').callsFake(() => w0); <ide> <ide> electron.ipcMain.emit( <ide> 'open-chosen-file', <ide> describe('AtomApplication', function() { <ide> }); <ide> <ide> it('"open-chosen-folder" opens a directory chooser and opens the chosen directory', async function() { <del> sinon.stub(app, 'atomWindowForEvent', () => w0); <add> sinon.stub(app, 'atomWindowForEvent').callsFake(() => w0); <ide> <ide> electron.ipcMain.emit( <ide> 'open-chosen-folder', <ide> class LaunchScenario { <ide> }, <ide> ...options <ide> }); <del> this.sinon.stub(app, 'createWindow', loadSettings => { <add> this.sinon.stub(app, 'createWindow').callsFake(loadSettings => { <ide> const newWindow = new StubWindow(this.sinon, loadSettings, options); <ide> this.windows.add(newWindow); <ide> return newWindow; <ide> }); <del> this.sinon.stub(app.storageFolder, 'load', () => <del> Promise.resolve(options.applicationJson || { version: '1', windows: [] }) <del> ); <del> this.sinon.stub(app.storageFolder, 'store', () => Promise.resolve()); <add> this.sinon <add> .stub(app.storageFolder, 'load') <add> .callsFake(() => <add> Promise.resolve( <add> options.applicationJson || { version: '1', windows: [] } <add> ) <add> ); <add> this.sinon <add> .stub(app.storageFolder, 'store') <add> .callsFake(() => Promise.resolve()); <ide> this.applications.add(app); <ide> return app; <ide> } <ide><path>spec/main-process/atom-window.test.js <ide> const fs = require('fs-plus'); <ide> const url = require('url'); <ide> const { EventEmitter } = require('events'); <ide> const temp = require('temp').track(); <del>const { sandbox } = require('sinon'); <add>const sandbox = require('sinon').createSandbox(); <ide> const dedent = require('dedent'); <ide> <ide> const AtomWindow = require('../../src/main-process/atom-window'); <ide> describe('AtomWindow', function() { <ide> let sinon, app, service; <ide> <ide> beforeEach(function() { <del> sinon = sandbox.create(); <add> sinon = sandbox; <ide> app = new StubApplication(sinon); <ide> service = new StubRecoveryService(sinon); <ide> }); <ide><path>spec/main-process/file-recovery-service.test.js <ide> describe('FileRecoveryService', function() { <ide> beforeEach(() => { <ide> recoveryDirectory = temp.mkdirSync('atom-spec-file-recovery'); <ide> recoveryService = new FileRecoveryService(recoveryDirectory); <del> spies = sinon.sandbox.create(); <add> spies = sinon.createSandbox(); <ide> }); <ide> <ide> afterEach(() => { <ide> describe('FileRecoveryService', function() { <ide> fs.writeFileSync(filePath, 'content'); <ide> <ide> let logs = []; <del> spies.stub(console, 'log', message => logs.push(message)); <add> spies.stub(console, 'log').callsFake(message => logs.push(message)); <ide> spies.stub(dialog, 'showMessageBox'); <ide> <ide> // Copy files to be recovered before mocking fs.createWriteStream
4
Ruby
Ruby
remove redundant variable
ba9537c275d5434aff505cdc5d435009715dcc0e
<ide><path>activesupport/lib/active_support/core_ext/hash/deep_dup.rb <ide> class Hash <ide> def deep_dup <ide> duplicate = self.dup <ide> duplicate.each_pair do |k,v| <del> tv = duplicate[k] <del> duplicate[k] = tv.is_a?(Hash) && v.is_a?(Hash) ? tv.deep_dup : v <add> duplicate[k] = v.is_a?(Hash) ? v.deep_dup : v <ide> end <ide> duplicate <ide> end
1
Go
Go
add id to jsonmessage in pull
0e71e368a8a781f593b25fdd1318d3882e6d28e5
<ide><path>commands.go <ide> func (cli *DockerCli) CmdBuild(args ...string) error { <ide> // FIXME: ProgressReader shouldn't be this annoyning to use <ide> if context != nil { <ide> sf := utils.NewStreamFormatter(false) <del> body = utils.ProgressReader(ioutil.NopCloser(context), 0, cli.err, sf.FormatProgress("Uploading context", "%v bytes%0.0s%0.0s"), sf) <add> body = utils.ProgressReader(ioutil.NopCloser(context), 0, cli.err, sf.FormatProgress("Uploading context", "%v bytes%0.0s%0.0s", ""), sf) <ide> } <ide> // Upload the build context <ide> v := &url.Values{} <ide><path>graph.go <ide> func (graph *Graph) TempLayerArchive(id string, compression Compression, sf *uti <ide> if err != nil { <ide> return nil, err <ide> } <del> return NewTempArchive(utils.ProgressReader(ioutil.NopCloser(archive), 0, output, sf.FormatProgress("Buffering to disk", "%v/%v (%v)"), sf), tmp.Root) <add> return NewTempArchive(utils.ProgressReader(ioutil.NopCloser(archive), 0, output, sf.FormatProgress("Buffering to disk", "%v/%v (%v)", ""), sf), tmp.Root) <ide> } <ide> <ide> // Mktemp creates a temporary sub-directory inside the graph's filesystem. <ide><path>server.go <ide> func (srv *Server) ImageInsert(name, url, path string, out io.Writer, sf *utils. <ide> return "", err <ide> } <ide> <del> if err := c.Inject(utils.ProgressReader(file.Body, int(file.ContentLength), out, sf.FormatProgress("Downloading", "%8v/%v (%v)"), sf), path); err != nil { <add> if err := c.Inject(utils.ProgressReader(file.Body, int(file.ContentLength), out, sf.FormatProgress("Downloading", "%8v/%v (%v)", ""), sf), path); err != nil { <ide> return "", err <ide> } <ide> // FIXME: Handle custom repo, tag comment, author <ide> func (srv *Server) pullImage(r *registry.Registry, out io.Writer, imgID, endpoin <ide> return err <ide> } <ide> defer layer.Close() <del> if err := srv.runtime.graph.Register(utils.ProgressReader(layer, imgSize, out, sf.FormatProgress("Downloading", "%8v/%v (%v)"), sf), false, img); err != nil { <add> if err := srv.runtime.graph.Register(utils.ProgressReader(layer, imgSize, out, sf.FormatProgress("Downloading", "%8v/%v (%v)", id), sf), false, img); err != nil { <ide> return err <ide> } <ide> } <ide> func (srv *Server) pullRepository(r *registry.Registry, out io.Writer, localName <ide> repoData.ImgList[id].Tag = askedTag <ide> } <ide> <del> for _, img := range repoData.ImgList { <del> if askedTag != "" && img.Tag != askedTag { <del> utils.Debugf("(%s) does not match %s (id: %s), skipping", img.Tag, askedTag, img.ID) <del> continue <del> } <add> errors := make(chan error) <add> for _, image := range repoData.ImgList { <add> go func(img *registry.ImgData) { <add> if askedTag != "" && img.Tag != askedTag { <add> utils.Debugf("(%s) does not match %s (id: %s), skipping", img.Tag, askedTag, img.ID) <add> errors <- nil <add> return <add> } <ide> <del> if img.Tag == "" { <del> utils.Debugf("Image (id: %s) present in this repository but untagged, skipping", img.ID) <del> continue <del> } <del> out.Write(sf.FormatStatus("Pulling image %s (%s) from %s", img.ID, img.Tag, localName)) <del> success := false <del> for _, ep := range repoData.Endpoints { <del> if err := srv.pullImage(r, out, img.ID, ep, repoData.Tokens, sf); err != nil { <del> out.Write(sf.FormatStatus("Error while retrieving image for tag: %s (%s); checking next endpoint", askedTag, err)) <del> continue <add> if img.Tag == "" { <add> utils.Debugf("Image (id: %s) present in this repository but untagged, skipping", img.ID) <add> errors <- nil <add> return <ide> } <del> success = true <del> break <del> } <del> if !success { <del> return fmt.Errorf("Could not find repository on any of the indexed registries.") <add> out.Write(sf.FormatStatus("Pulling image %s (%s) from %s", img.ID, img.Tag, localName)) <add> success := false <add> for _, ep := range repoData.Endpoints { <add> if err := srv.pullImage(r, out, img.ID, ep, repoData.Tokens, sf); err != nil { <add> out.Write(sf.FormatStatus("Error while retrieving image for tag: %s (%s); checking next endpoint", askedTag, err)) <add> continue <add> } <add> success = true <add> break <add> } <add> if !success { <add> errors <- fmt.Errorf("Could not find repository on any of the indexed registries.") <add> } <add> errors <- nil <add> }(image) <add> } <add> <add> for i := 0; i < len(repoData.ImgList); i++ { <add> if err := <-errors; err != nil { <add> return err <ide> } <ide> } <add> <ide> for tag, id := range tagsList { <ide> if askedTag != "" && tag != askedTag { <ide> continue <ide> func (srv *Server) pushImage(r *registry.Registry, out io.Writer, remote, imgID, <ide> } <ide> <ide> // Send the layer <del> if err := r.PushImageLayerRegistry(imgData.ID, utils.ProgressReader(layerData, int(layerData.Size), out, sf.FormatProgress("Pushing", "%8v/%v (%v)"), sf), ep, token); err != nil { <add> if err := r.PushImageLayerRegistry(imgData.ID, utils.ProgressReader(layerData, int(layerData.Size), out, sf.FormatProgress("Pushing", "%8v/%v (%v)", ""), sf), ep, token); err != nil { <ide> return err <ide> } <ide> return nil <ide> func (srv *Server) ImageImport(src, repo, tag string, in io.Reader, out io.Write <ide> if err != nil { <ide> return err <ide> } <del> archive = utils.ProgressReader(resp.Body, int(resp.ContentLength), out, sf.FormatProgress("Importing", "%8v/%v (%v)"), sf) <add> archive = utils.ProgressReader(resp.Body, int(resp.ContentLength), out, sf.FormatProgress("Importing", "%8v/%v (%v)", ""), sf) <ide> } <ide> img, err := srv.runtime.graph.Create(archive, nil, "Imported from "+src, "", nil) <ide> if err != nil { <ide><path>utils/utils.go <ide> func (r *progressReader) Close() error { <ide> func ProgressReader(r io.ReadCloser, size int, output io.Writer, template []byte, sf *StreamFormatter) *progressReader { <ide> tpl := string(template) <ide> if tpl == "" { <del> tpl = string(sf.FormatProgress("", "%8v/%v (%v)")) <add> tpl = string(sf.FormatProgress("", "%8v/%v (%v)", "")) <ide> } <ide> return &progressReader{r, NewWriteFlusher(output), size, 0, 0, tpl, sf} <ide> } <ide> type NopFlusher struct{} <ide> func (f *NopFlusher) Flush() {} <ide> <ide> type WriteFlusher struct { <add> sync.Mutex <ide> w io.Writer <ide> flusher http.Flusher <ide> } <ide> <ide> func (wf *WriteFlusher) Write(b []byte) (n int, err error) { <add> wf.Lock() <add> defer wf.Unlock() <ide> n, err = wf.w.Write(b) <ide> wf.flusher.Flush() <ide> return n, err <ide> func (jm *JSONMessage) Display(out io.Writer) (error) { <ide> if jm.Time != 0 { <ide> fmt.Fprintf(out, "[%s] ", time.Unix(jm.Time, 0)) <ide> } <del> if jm.Progress != "" { <add> if jm.Progress != "" && jm.ID != ""{ <add> fmt.Fprintf(out, "\n%s %s %s\r", jm.Status, jm.ID, jm.Progress) <add> } else if jm.Progress != "" { <ide> fmt.Fprintf(out, "%s %s\r", jm.Status, jm.Progress) <ide> } else if jm.Error != "" { <ide> return fmt.Errorf(jm.Error) <ide> func (sf *StreamFormatter) FormatError(err error) []byte { <ide> return []byte("Error: " + err.Error() + "\r\n") <ide> } <ide> <del>func (sf *StreamFormatter) FormatProgress(action, str string) []byte { <add>func (sf *StreamFormatter) FormatProgress(action, str, id string) []byte { <ide> sf.used = true <ide> if sf.json { <del> b, err := json.Marshal(&JSONMessage{Status: action, Progress: str}) <add> b, err := json.Marshal(&JSONMessage{Status: action, Progress: str, ID:id}) <ide> if err != nil { <ide> return nil <ide> }
4
Javascript
Javascript
add missing semicolon
89a3fa93a031dca3d9f1cef33f796b9194a2db98
<ide><path>test/mjsunit/test-assert.js <ide> function makeBlock(f){ <ide> } <ide> } <ide> <del>assert.ok(a.AssertionError instanceof Error, "a.AssertionError instanceof Error") <add>assert.ok(a.AssertionError instanceof Error, "a.AssertionError instanceof Error"); <ide> <ide> assert.throws(makeBlock(a.ok, false), a.AssertionError, "ok(false)"); <ide> assert.doesNotThrow(makeBlock(a.ok, true), a.AssertionError, "ok(true)");
1
Java
Java
fix javadoc typo
209bb4ee4b93d8b7f0aed794d784cd830701c8c3
<ide><path>spring-websocket/src/main/java/org/springframework/web/socket/client/standard/AnnotatedEndpointConnectionManager.java <ide> import javax.websocket.ContainerProvider; <ide> import javax.websocket.Session; <ide> import javax.websocket.WebSocketContainer; <del>import javax.websocket.server.ServerEndpoint; <ide> <ide> import org.springframework.beans.BeansException; <ide> import org.springframework.beans.factory.BeanFactory; <ide> import org.springframework.web.socket.handler.BeanCreatingHandlerProvider; <ide> <ide> /** <del> * A WebSocket connection manager that is given a URI, a {@link ServerEndpoint}-annotated <del> * endpoint, connects to a WebSocket server through the {@link #start()} and <del> * {@link #stop()} methods. If {@link #setAutoStartup(boolean)} is set to {@code true} <del> * this will be done automatically when the Spring ApplicationContext is refreshed. <add> * A WebSocket connection manager that is given a URI, a <add> * {@link javax.websocket.ClientEndpoint}-annotated endpoint, connects to a <add> * WebSocket server through the {@link #start()} and {@link #stop()} methods. <add> * If {@link #setAutoStartup(boolean)} is set to {@code true} this will be <add> * done automatically when the Spring ApplicationContext is refreshed. <ide> * <ide> * @author Rossen Stoyanchev <ide> * @since 4.0
1
PHP
PHP
fix coding standards in case/error
8b797b2577c5db6e343c1af4db3b297138971d2c
<ide><path>lib/Cake/Test/Case/Error/ErrorHandlerTest.php <ide> */ <ide> class ErrorHandlerTest extends CakeTestCase { <ide> <del> public $_restoreError = false; <add> protected $_restoreError = false; <ide> <ide> /** <ide> * setup create a request object to get out of router later. <ide> public function setUp() { <ide> parent::setUp(); <ide> App::build(array( <ide> 'View' => array( <del> CAKE . 'Test' . DS . 'test_app' . DS . 'View'. DS <add> CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS <ide> ) <ide> ), App::RESET); <ide> Router::reload(); <ide><path>lib/Cake/Test/Case/Error/ExceptionRendererTest.php <ide> class BlueberryComponent extends Component { <ide> public function initialize(Controller $controller) { <ide> $this->testName = 'BlueberryComponent'; <ide> } <add> <ide> } <ide> <ide> /** <ide> public function index() { <ide> $this->autoRender = false; <ide> return 'what up'; <ide> } <add> <ide> } <ide> <ide> /** <ide> class MyCustomExceptionRenderer extends ExceptionRenderer { <ide> public function missingWidgetThing() { <ide> echo 'widget thing is missing'; <ide> } <add> <ide> } <ide> <ide> /** <ide> * Exception class for testing app error handlers and custom errors. <ide> * <ide> * @package Cake.Test.Case.Error <ide> */ <del>class MissingWidgetThingException extends NotFoundException { } <add>class MissingWidgetThingException extends NotFoundException { <add>} <ide> <ide> <ide> /** <ide> class MissingWidgetThingException extends NotFoundException { } <ide> */ <ide> class ExceptionRendererTest extends CakeTestCase { <ide> <del> public $_restoreError = false; <add> protected $_restoreError = false; <ide> <ide> /** <ide> * setup create a request object to get out of router later. <ide> public function setUp() { <ide> parent::setUp(); <ide> App::build(array( <ide> 'View' => array( <del> CAKE . 'Test' . DS . 'test_app' . DS . 'View'. DS <add> CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS <ide> ) <ide> ), App::RESET); <ide> Router::reload();
2
Javascript
Javascript
fix iso parsing with more than 3 subsecond digits
739f9bc0d9af4fd658d393b9b52230a665217561
<ide><path>moment.js <ide> <ide> // iso time formats and regexes <ide> isoTimes = [ <del> ['HH:mm:ss.SSSS', /(T| )\d\d:\d\d:\d\d\.\d{1,3}/], <add> ['HH:mm:ss.SSSS', /(T| )\d\d:\d\d:\d\d\.\d+/], <ide> ['HH:mm:ss', /(T| )\d\d:\d\d:\d\d/], <ide> ['HH:mm', /(T| )\d\d:\d\d/], <ide> ['HH', /(T| )\d\d/] <ide><path>test/moment/create.js <ide> exports.create = { <ide> test.done(); <ide> }, <ide> <add> "parsing iso with more subsecond precision digits" : function (test) { <add> test.equal(moment.utc("2013-07-31T22:00:00.0000000Z").format(), <add> "2013-07-31T22:00:00+00:00", "more than 3 subsecond digits"); <add> test.done(); <add> }, <add> <ide> "null or empty" : function (test) { <ide> test.expect(8); <ide> test.equal(moment('').isValid(), false, "moment('') is not valid");
2
PHP
PHP
use find() in association internals
bdc8c78cb11ec2c31617bd8868bd06b0056f92d7
<ide><path>src/ORM/Association.php <ide> public function find($type = null, array $options = []): Query <ide> */ <ide> public function exists($conditions): bool <ide> { <del> if ($this->_conditions) { <del> $conditions = $this <del> ->find('all', ['conditions' => $conditions]) <del> ->clause('where'); <del> } <add> $conditions = $this->find() <add> ->where($conditions) <add> ->clause('where'); <ide> <ide> return $this->getTarget()->exists($conditions); <ide> } <ide> public function exists($conditions): bool <ide> */ <ide> public function updateAll(array $fields, $conditions): int <ide> { <del> $target = $this->getTarget(); <del> $expression = $target->query() <del> ->where($this->getConditions()) <add> $expression = $this->find() <ide> ->where($conditions) <ide> ->clause('where'); <ide> <del> return $target->updateAll($fields, $expression); <add> return $this->getTarget()->updateAll($fields, $expression); <ide> } <ide> <ide> /** <ide> public function updateAll(array $fields, $conditions): int <ide> */ <ide> public function deleteAll($conditions): int <ide> { <del> $target = $this->getTarget(); <del> $expression = $target->query() <del> ->where($this->getConditions()) <add> $expression = $this->find() <ide> ->where($conditions) <ide> ->clause('where'); <ide> <del> return $target->deleteAll($expression); <add> return $this->getTarget()->deleteAll($expression); <ide> } <ide> <ide> /**
1
Javascript
Javascript
fix usemutablesource tearing bug
fdb641629e82df6588c16e158978ac57d9aff9ba
<ide><path>packages/react-reconciler/src/ReactFiberHooks.new.js <ide> function useMutableSource<Source, Snapshot>( <ide> const suspenseConfig = requestCurrentSuspenseConfig(); <ide> const lane = requestUpdateLane(fiber, suspenseConfig); <ide> markRootMutableRead(root, lane); <del> <del> // If the source mutated between render and now, <del> // there may be state updates already scheduled from the old source. <del> // Entangle the updates so that they render in the same batch. <del> // TODO: I think we need to entangle even if the snapshot matches, <del> // because there could have been an update to a different hook. <del> markRootEntangled(root, root.mutableReadLanes); <ide> } <add> // If the source mutated between render and now, <add> // there may be state updates already scheduled from the old source. <add> // Entangle the updates so that they render in the same batch. <add> markRootEntangled(root, root.mutableReadLanes); <ide> } <ide> }, [getSnapshot, source, subscribe]); <ide> <ide><path>packages/react-reconciler/src/ReactFiberHooks.old.js <ide> function useMutableSource<Source, Snapshot>( <ide> suspenseConfig, <ide> ); <ide> setPendingExpirationTime(root, expirationTime); <del> <del> // If the source mutated between render and now, <del> // there may be state updates already scheduled from the old getSnapshot. <del> // Those updates should not commit without this value. <del> // There is no mechanism currently to associate these updates though, <del> // so for now we fall back to synchronously flushing all pending updates. <del> // TODO: Improve this later. <del> markRootExpiredAtTime(root, getLastPendingExpirationTime(root)); <ide> } <add> // If the source mutated between render and now, <add> // there may be state updates already scheduled from the old getSnapshot. <add> // Those updates should not commit without this value. <add> // There is no mechanism currently to associate these updates though, <add> // so for now we fall back to synchronously flushing all pending updates. <add> // TODO: Improve this later. <add> markRootExpiredAtTime(root, getLastPendingExpirationTime(root)); <ide> } <ide> }, [getSnapshot, source, subscribe]); <ide> <ide><path>packages/react-reconciler/src/__tests__/useMutableSource-test.internal.js <ide> describe('useMutableSource', () => { <ide> expect(root.getChildrenAsJSX()).toEqual('first: a1, second: a1'); <ide> }); <ide> <add> // @gate experimental <add> it( <add> 'if source is mutated after initial read but before subscription is set ' + <add> 'up, should still entangle all pending mutations even if snapshot of ' + <add> 'new subscription happens to match', <add> async () => { <add> const source = createSource({ <add> a: 'a0', <add> b: 'b0', <add> }); <add> const mutableSource = createMutableSource(source); <add> <add> const getSnapshotA = () => source.value.a; <add> const getSnapshotB = () => source.value.b; <add> <add> function mutateA(newA) { <add> source.value = { <add> ...source.value, <add> a: newA, <add> }; <add> } <add> <add> function mutateB(newB) { <add> source.value = { <add> ...source.value, <add> b: newB, <add> }; <add> } <add> <add> function Read({getSnapshot}) { <add> const value = useMutableSource( <add> mutableSource, <add> getSnapshot, <add> defaultSubscribe, <add> ); <add> Scheduler.unstable_yieldValue(value); <add> return value; <add> } <add> <add> function Text({text}) { <add> Scheduler.unstable_yieldValue(text); <add> return text; <add> } <add> <add> const root = ReactNoop.createRoot(); <add> await act(async () => { <add> root.render( <add> <> <add> <Read getSnapshot={getSnapshotA} /> <add> </>, <add> ); <add> }); <add> expect(Scheduler).toHaveYielded(['a0']); <add> expect(root).toMatchRenderedOutput('a0'); <add> <add> await act(async () => { <add> root.render( <add> <> <add> <Read getSnapshot={getSnapshotA} /> <add> <Read getSnapshot={getSnapshotB} /> <add> <Text text="c" /> <add> </>, <add> ); <add> <add> expect(Scheduler).toFlushAndYieldThrough(['a0', 'b0']); <add> // Mutate in an event. This schedules a subscription update on a, which <add> // already mounted, but not b, which hasn't subscribed yet. <add> mutateA('a1'); <add> mutateB('b1'); <add> <add> // Mutate again at lower priority. This will schedule another subscription <add> // update on a, but not b. When b mounts and subscriptions, the value it <add> // read during render will happen to match the latest value. But it should <add> // still entangle the updates to prevent the previous update (a1) from <add> // rendering by itself. <add> Scheduler.unstable_runWithPriority( <add> Scheduler.unstable_IdlePriority, <add> () => { <add> mutateA('a0'); <add> mutateB('b0'); <add> }, <add> ); <add> // Finish the current render <add> expect(Scheduler).toFlushUntilNextPaint(['c']); <add> // a0 will re-render because of the mutation update. But it should show <add> // the latest value, not the intermediate one, to avoid tearing with b. <add> expect(Scheduler).toFlushUntilNextPaint(['a0']); <add> expect(root).toMatchRenderedOutput('a0b0c'); <add> // We should be done. <add> expect(Scheduler).toFlushAndYield([]); <add> expect(root).toMatchRenderedOutput('a0b0c'); <add> }); <add> }, <add> ); <add> <ide> // @gate experimental <ide> it('getSnapshot changes and then source is mutated during interleaved event', async () => { <ide> const {useEffect} = React;
3
PHP
PHP
use fqcn for property annotations
814b51cb4a4a4a6492fd30364407e09f8e51be61
<ide><path>src/View/Helper/FormHelper.php <ide> * <ide> * Automatic generation of HTML FORMs from given data. <ide> * <del> * @property HtmlHelper $Html <del> * @property UrlHelper $Url <add> * @property \Cake\View\Helper\HtmlHelper $Html <add> * @property \Cake\View\Helper\UrlHelper $Url <ide> * @link http://book.cakephp.org/3.0/en/views/helpers/form.html <ide> */ <ide> class FormHelper extends Helper <ide><path>src/View/Helper/HtmlHelper.php <ide> * <ide> * HtmlHelper encloses all methods needed while working with HTML pages. <ide> * <del> * @property UrlHelper $Url <add> * @property \Cake\View\Helper\UrlHelper $Url <ide> * @link http://book.cakephp.org/3.0/en/views/helpers/html.html <ide> */ <ide> class HtmlHelper extends Helper <ide><path>src/View/Helper/PaginatorHelper.php <ide> * <ide> * PaginationHelper encloses all methods needed when working with pagination. <ide> * <del> * @property UrlHelper $Url <del> * @property NumberHelper $Number <del> * @property HtmlHelper $Html <add> * @property \Cake\View\Helper\UrlHelper $Url <add> * @property \Cake\View\Helper\NumberHelper $Number <add> * @property \Cake\View\Helper\HtmlHelper $Html <ide> * @link http://book.cakephp.org/3.0/en/views/helpers/paginator.html <ide> */ <ide> class PaginatorHelper extends Helper <ide><path>src/View/Helper/RssHelper.php <ide> /** <ide> * RSS Helper class for easy output RSS structures. <ide> * <del> * @property UrlHelper $Url <del> * @property TimeHelper $Time <add> * @property \Cake\View\Helper\UrlHelper $Url <add> * @property \Cake\View\Helper\TimeHelper $Time <ide> * @link http://book.cakephp.org/3.0/en/views/helpers/rss.html <ide> */ <ide> class RssHelper extends Helper <ide><path>src/View/Helper/TextHelper.php <ide> * <ide> * Text manipulations: Highlight, excerpt, truncate, strip of links, convert email addresses to mailto: links... <ide> * <del> * @property HtmlHelper $Html <add> * @property \Cake\View\Helper\HtmlHelper $Html <ide> * @link http://book.cakephp.org/3.0/en/views/helpers/text.html <ide> * @see \Cake\Utility\Text <ide> */ <ide><path>src/View/Helper/UrlHelper.php <ide> use Cake\View\Helper; <ide> <ide> /** <del> * UrlHelper class for generating urls. <add> * UrlHelper class for generating URLs. <ide> */ <ide> class UrlHelper extends Helper <ide> { <ide> class UrlHelper extends Helper <ide> * escaped afterwards before being displayed. <ide> * - `fullBase`: If true, the full base URL will be prepended to the result <ide> * <del> * @param string|array|null $url Either a relative string url like `/products/view/23` or <add> * @param string|array|null $url Either a relative string URL like `/products/view/23` or <ide> * an array of URL parameters. Using an array for URLs will allow you to leverage <ide> * the reverse routing features of CakePHP. <ide> * @param array|bool $options Array of options; bool `full` for BC reasons.
6
Javascript
Javascript
run tests without jquery (package by package)
f71bbd07cacd406d3ac12db7d170be791b3a5c50
<ide><path>bin/run-tests.js <ide> function generateEachPackageTests() { <ide> testFunctions.push(function() { <ide> return run('package=' + packageName); <ide> }); <add> if (packages[packageName].requiresJQuery === false) { <add> testFunctions.push(function() { <add> return run('package=' + packageName + '&jquery=none'); <add> }); <add> } <ide> testFunctions.push(function() { <ide> return run('package=' + packageName + '&enableoptionalfeatures=true'); <ide> }); <add> <ide> }); <ide> } <ide> <ide><path>lib/packages.js <ide> module.exports = function() { <ide> var packages = { <del> 'container': { trees: null, requirements: ['ember-utils'], isTypeScript: true, vendorRequirements: ['@glimmer/di'] }, <del> 'ember-environment': { trees: null, requirements: [], skipTests: true }, <del> 'ember-utils': { trees: null, requirements: [] }, <del> 'ember-console': { trees: null, requirements: [], skipTests: true }, <del> 'ember-metal': { trees: null, requirements: ['ember-environment', 'ember-utils'], vendorRequirements: ['backburner'] }, <del> 'ember-debug': { trees: null, requirements: [] }, <del> 'ember-runtime': { trees: null, vendorRequirements: ['rsvp'], requirements: ['container', 'ember-environment', 'ember-console', 'ember-metal'] }, <add> 'container': { trees: null, requirements: ['ember-utils'], isTypeScript: true, vendorRequirements: ['@glimmer/di'], requiresJQuery: false }, <add> 'ember-environment': { trees: null, requirements: [], skipTests: true, requiresJQuery: false }, <add> 'ember-utils': { trees: null, requirements: [], requiresJQuery: false }, <add> 'ember-console': { trees: null, requirements: [], skipTests: true, requiresJQuery: false }, <add> 'ember-metal': { trees: null, requirements: ['ember-environment', 'ember-utils'], vendorRequirements: ['backburner'], requiresJQuery: false }, <add> 'ember-debug': { trees: null, requirements: [], requiresJQuery: false }, <add> 'ember-runtime': { trees: null, vendorRequirements: ['rsvp'], requirements: ['container', 'ember-environment', 'ember-console', 'ember-metal'], requiresJQuery: false }, <ide> 'ember-views': { trees: null, requirements: ['ember-runtime'], skipTests: true }, <del> 'ember-extension-support': { trees: null, requirements: ['ember-application'] }, <add> 'ember-extension-support': { trees: null, requirements: ['ember-application'], requiresJQuery: false }, <ide> 'ember-testing': { trees: null, requirements: ['ember-application', 'ember-routing'], testing: true }, <ide> 'ember-template-compiler': { <ide> trees: null, <ide> module.exports = function() { <ide> ] <ide> }, <ide> 'ember-routing': { trees: null, vendorRequirements: ['router', 'route-recognizer'], <del> requirements: ['ember-runtime', 'ember-views'] }, <del> 'ember-application': { trees: null, vendorRequirements: ['dag-map'], requirements: ['ember-routing'] }, <add> requirements: ['ember-runtime', 'ember-views'], requiresJQuery: false }, <add> 'ember-application': { trees: null, vendorRequirements: ['dag-map'], requirements: ['ember-routing'], requiresJQuery: false }, <ide> 'ember': { trees: null, requirements: ['ember-application'] }, <del> 'internal-test-helpers': { trees: null }, <add> 'internal-test-helpers': { trees: null, requiresJQuery: false }, <ide> <ide> 'ember-glimmer': { <ide> trees: null, <ide> module.exports = function() { <ide> '@glimmer/wire-format', <ide> '@glimmer/node' <ide> ], <del> testingVendorRequirements: [] <add> testingVendorRequirements: [], <ide> } <ide> }; <ide>
2
Python
Python
remove fix for odd msvcrt version on windows 3.7
02f602b0fe4c5a67fe82f0cd7cb9c820392445f9
<ide><path>numpy/distutils/mingw32ccompiler.py <ide> def _build_import_library_x86(): <ide> # Value from msvcrt.CRT_ASSEMBLY_VERSION under Python 3.3.0 <ide> # on Windows XP: <ide> _MSVCRVER_TO_FULLVER['100'] = "10.0.30319.460" <del> # Python 3.7 uses 1415, but get_build_version returns 140 ?? <del> _MSVCRVER_TO_FULLVER['140'] = "14.15.26726.0" <ide> crt_ver = getattr(msvcrt, 'CRT_ASSEMBLY_VERSION', None) <ide> if crt_ver is not None: # Available at least back to Python 3.3 <ide> maj, min = re.match(r'(\d+)\.(\d)', crt_ver).groups()
1
Java
Java
fix dispatch optimization
fa814d4875d924e6835e31339f2012e8b18818ae
<ide><path>ReactAndroid/src/main/java/com/facebook/react/uimanager/JSPointerDispatcher.java <ide> import com.facebook.react.uimanager.events.PointerEventHelper.EVENT; <ide> import com.facebook.react.uimanager.events.TouchEvent; <ide> import com.facebook.react.uimanager.events.TouchEventCoalescingKeyHelper; <add>import java.util.ArrayList; <ide> import java.util.Collections; <ide> import java.util.List; <ide> <ide> public void handleMotionEvent(MotionEvent motionEvent, EventDispatcher eventDisp <ide> mTouchEventCoalescingKeyHelper.addCoalescingKey(mDownStartTime); <ide> <ide> if (!supportsHover) { <del> dispatchNonBubblingEventForPathWhenListened( <del> EVENT.ENTER, <del> EVENT.ENTER_CAPTURE, <del> hitPath, <add> List<ViewTarget> enterViewTargets = <add> filterByShouldDispatch(hitPath, EVENT.ENTER, EVENT.ENTER_CAPTURE, false); <add> <add> // Dispatch root -> target, we need to reverse order of enterViewTargets <add> Collections.reverse(enterViewTargets); <add> dispatchEventForViewTargets( <add> PointerEventHelper.POINTER_ENTER, <add> enterViewTargets, <ide> eventDispatcher, <ide> surfaceId, <del> motionEvent, <del> false); <add> motionEvent); <ide> } <ide> <ide> boolean listeningForDown = <ide> public void handleMotionEvent(MotionEvent motionEvent, EventDispatcher eventDisp <ide> } <ide> <ide> if (!supportsHover) { <del> dispatchNonBubblingEventForPathWhenListened( <del> EVENT.LEAVE, <del> EVENT.LEAVE_CAPTURE, <del> hitPath, <add> List<ViewTarget> leaveViewTargets = <add> filterByShouldDispatch(hitPath, EVENT.LEAVE, EVENT.LEAVE_CAPTURE, false); <add> <add> // target -> root <add> dispatchEventForViewTargets( <add> PointerEventHelper.POINTER_LEAVE, <add> leaveViewTargets, <ide> eventDispatcher, <ide> surfaceId, <del> motionEvent, <del> false); <add> motionEvent); <ide> } <ide> return; <ide> } <ide> private static boolean isAnyoneListeningForBubblingEvent( <ide> } <ide> <ide> /** <del> * Dispatch event only if ancestor is listening to relevant capture event. This should only be <del> * relevant for ENTER/LEAVE events that need to be dispatched along every relevant view in the hit <del> * path. <add> * Returns list of view targets that we should be dispatching events from <ide> * <del> * @param pointerEventType - Should only be ENTER/LEAVE events <del> * @param hitPath - ViewTargets ordered from target -> root <del> * @param dispatcher <del> * @param surfaceId <del> * @param motionEvent <del> * @param forceDispatch - Ignore if ancestor is listening and force the event to be dispatched <add> * @param viewTargets, ordered from target -> root <add> * @param bubble, name of event that bubbles <add> * @param capture, name of event that captures <add> * @param forceDispatch, if true, all viewTargets should dispatch <add> * @return list of viewTargets filtered from target -> root <ide> */ <del> private static void dispatchNonBubblingEventForPathWhenListened( <del> EVENT event, <del> EVENT captureEvent, <del> List<ViewTarget> hitPath, <del> EventDispatcher dispatcher, <del> int surfaceId, <del> MotionEvent motionEvent, <del> boolean forceDispatch) { <del> <del> boolean ancestorListening = forceDispatch; <del> String eventName = PointerEventHelper.getDispatchableEventName(event); <del> if (eventName == null) { <del> return; <add> private static List<ViewTarget> filterByShouldDispatch( <add> List<ViewTarget> viewTargets, EVENT bubble, EVENT capture, boolean forceDispatch) { <add> if (forceDispatch) { <add> return viewTargets; <ide> } <ide> <del> // iterate through hitPath from ancestor -> target <del> for (int i = hitPath.size() - 1; i >= 0; i--) { <del> View view = hitPath.get(i).getView(); <del> int viewId = hitPath.get(i).getViewId(); <del> if (ancestorListening <del> || (i == 0 && PointerEventHelper.isListening(view, event)) <del> || PointerEventHelper.isListening(view, captureEvent)) { <del> dispatcher.dispatchEvent(PointerEvent.obtain(eventName, surfaceId, viewId, motionEvent)); <add> boolean ancestorListening = false; <add> List<ViewTarget> dispatchableViewTargets = new ArrayList<ViewTarget>(viewTargets); <add> for (int i = viewTargets.size() - 1; i >= 0; i--) { <add> ViewTarget viewTarget = viewTargets.get(i); <add> View view = viewTarget.getView(); <add> if (!ancestorListening <add> && (PointerEventHelper.isListening(view, capture) <add> || (i == 0 && PointerEventHelper.isListening(view, bubble)))) { <ide> ancestorListening = true; <add> } else if (!ancestorListening) { <add> dispatchableViewTargets.remove(i); <ide> } <ide> } <add> return dispatchableViewTargets; <add> } <add> <add> private static void dispatchEventForViewTargets( <add> String eventName, <add> List<ViewTarget> viewTargets, <add> EventDispatcher dispatcher, <add> int surfaceId, <add> MotionEvent motionEvent) { <add> <add> for (ViewTarget viewTarget : viewTargets) { <add> int viewId = viewTarget.getViewId(); <add> dispatcher.dispatchEvent(PointerEvent.obtain(eventName, surfaceId, viewId, motionEvent)); <add> } <ide> } <ide> <ide> // called on hover_move motion events only <ide> private void handleHoverEvent( <ide> // If something has changed in either enter/exit, let's start a new coalescing key <ide> mTouchEventCoalescingKeyHelper.incrementCoalescingKey(mHoverInteractionKey); <ide> <add> // target -> root <ide> List<ViewTarget> enterViewTargets = <del> hitPath.subList(0, hitPath.size() - firstDivergentIndexFromBack); <add> filterByShouldDispatch( <add> hitPath.subList(0, hitPath.size() - firstDivergentIndexFromBack), <add> EVENT.ENTER, <add> EVENT.ENTER_CAPTURE, <add> nonDivergentListeningToEnter); <add> <ide> if (enterViewTargets.size() > 0) { <del> dispatchNonBubblingEventForPathWhenListened( <del> EVENT.ENTER, <del> EVENT.ENTER_CAPTURE, <add> // We want to iterate these from root -> target so we need to reverse <add> Collections.reverse(enterViewTargets); <add> dispatchEventForViewTargets( <add> PointerEventHelper.POINTER_ENTER, <ide> enterViewTargets, <ide> eventDispatcher, <ide> surfaceId, <del> motionEvent, <del> nonDivergentListeningToEnter); <add> motionEvent); <ide> } <ide> <del> List<ViewTarget> exitViewTargets = <del> mLastHitPath.subList(0, mLastHitPath.size() - firstDivergentIndexFromBack); <del> if (exitViewTargets.size() > 0) { <del> // child -> root <del> dispatchNonBubblingEventForPathWhenListened( <del> EVENT.LEAVE, <del> EVENT.LEAVE_CAPTURE, <del> enterViewTargets, <add> // target -> root <add> List<ViewTarget> leaveViewTargets = <add> filterByShouldDispatch( <add> mLastHitPath.subList(0, mLastHitPath.size() - firstDivergentIndexFromBack), <add> EVENT.LEAVE, <add> EVENT.LEAVE_CAPTURE, <add> nonDivergentListeningToLeave); <add> if (leaveViewTargets.size() > 0) { <add> // We want to dispatch from target -> root, so no need to reverse <add> dispatchEventForViewTargets( <add> PointerEventHelper.POINTER_LEAVE, <add> leaveViewTargets, <ide> eventDispatcher, <ide> surfaceId, <del> motionEvent, <del> nonDivergentListeningToLeave); <add> motionEvent); <ide> } <ide> } <ide> <ide> private void dispatchCancelEvent( <ide> PointerEventHelper.POINTER_CANCEL, surfaceId, targetTag, motionEvent)); <ide> } <ide> <del> dispatchNonBubblingEventForPathWhenListened( <del> EVENT.LEAVE, <del> EVENT.LEAVE_CAPTURE, <del> hitPath, <add> List<ViewTarget> leaveViewTargets = <add> filterByShouldDispatch(hitPath, EVENT.LEAVE, EVENT.LEAVE_CAPTURE, false); <add> <add> // dispatch from target -> root <add> dispatchEventForViewTargets( <add> PointerEventHelper.POINTER_LEAVE, <add> leaveViewTargets, <ide> eventDispatcher, <ide> surfaceId, <del> motionEvent, <del> false); <add> motionEvent); <ide> <ide> mTouchEventCoalescingKeyHelper.removeCoalescingKey(mDownStartTime); <ide> mDownStartTime = TouchEvent.UNSET;
1
Java
Java
implement new interface method
00018e511d71c3402939cfe22e4b7ab636cee01a
<ide><path>org.springframework.context/src/main/java/org/springframework/context/expression/BeanExpressionContextAccessor.java <ide> package org.springframework.context.expression; <ide> <ide> import org.springframework.beans.factory.config.BeanExpressionContext; <add>import org.springframework.core.convert.TypeDescriptor; <ide> import org.springframework.expression.AccessException; <ide> import org.springframework.expression.EvaluationContext; <ide> import org.springframework.expression.PropertyAccessor; <ide> public Class[] getSpecificTargetClasses() { <ide> return new Class[] {BeanExpressionContext.class}; <ide> } <ide> <add> public TypeDescriptor getTypeDescriptor(EvaluationContext context, <add> Object target, String name) { <add> return null; <add> } <add> <ide> } <ide>\ No newline at end of file <ide><path>org.springframework.context/src/main/java/org/springframework/context/expression/BeanFactoryAccessor.java <ide> package org.springframework.context.expression; <ide> <ide> import org.springframework.beans.factory.BeanFactory; <add>import org.springframework.core.convert.TypeDescriptor; <ide> import org.springframework.expression.AccessException; <ide> import org.springframework.expression.EvaluationContext; <ide> import org.springframework.expression.PropertyAccessor; <ide> public Class[] getSpecificTargetClasses() { <ide> return new Class[] {BeanFactory.class}; <ide> } <ide> <add> public TypeDescriptor getTypeDescriptor(EvaluationContext context, <add> Object target, String name) { <add> return null; <add> } <add> <ide> } <ide><path>org.springframework.context/src/main/java/org/springframework/context/expression/MapAccessor.java <ide> <ide> import java.util.Map; <ide> <add>import org.springframework.core.convert.TypeDescriptor; <ide> import org.springframework.expression.AccessException; <ide> import org.springframework.expression.EvaluationContext; <ide> import org.springframework.expression.PropertyAccessor; <ide> public void write(EvaluationContext context, Object target, String name, Object <ide> public Class[] getSpecificTargetClasses() { <ide> return new Class[] {Map.class}; <ide> } <add> <add> public TypeDescriptor getTypeDescriptor(EvaluationContext context, <add> Object target, String name) { <add> return null; <add> } <ide> <ide> }
3
Javascript
Javascript
reuse warning from postcss-loader
16d6eba1c9c0d89c6bc48392ad8cedb3ebbcf4d7
<ide><path>packages/next/build/webpack/loaders/css-loader/src/Warning.js <del>export default class Warning extends Error { <del> constructor(warning) { <del> super(warning) <del> const { text, line, column } = warning <del> this.name = 'Warning' <del> <del> // Based on https://github.com/postcss/postcss/blob/master/lib/warning.es6#L74 <del> // We don't need `plugin` properties. <del> this.message = `${this.name}\n\n` <del> <del> if (typeof line !== 'undefined') { <del> this.message += `(${line}:${column}) ` <del> } <del> <del> this.message += `${text}` <del> <del> // We don't need stack https://github.com/postcss/postcss/blob/master/docs/guidelines/runner.md#31-dont-show-js-stack-for-csssyntaxerror <del> this.stack = false <del> } <del>} <ide><path>packages/next/build/webpack/loaders/css-loader/src/index.js <ide> import { getOptions, stringifyRequest } from 'next/dist/compiled/loader-utils' <ide> import postcss from 'postcss' <ide> <ide> import CssSyntaxError from './CssSyntaxError' <del>import Warning from './Warning' <add>import Warning from '../../postcss-loader/src/Warning' <ide> import { icssParser, importParser, urlParser } from './plugins' <ide> import { <ide> normalizeOptions,
2
Ruby
Ruby
add does_not_need_relocation field
ab10ab42fa2f85f5b7abce733a02ea7a47e98683
<ide><path>Library/Homebrew/software_spec.rb <ide> def compatible_cellar? <ide> @spec.compatible_cellar? <ide> end <ide> <add> def needs_relocation? <add> @spec.needs_relocation? <add> end <add> <ide> def stage <ide> resource.downloader.stage <ide> end <ide> def initialize <ide> @prefix = DEFAULT_PREFIX <ide> @cellar = DEFAULT_CELLAR <ide> @collector = BottleCollector.new <add> @does_not_need_relocation = false <ide> end <ide> <ide> def root_url(var = nil) <ide> def compatible_cellar? <ide> cellar == :any || cellar == HOMEBREW_CELLAR.to_s <ide> end <ide> <add> def does_not_need_relocation <add> @does_not_need_relocation = true <add> end <add> <add> def needs_relocation? <add> !@does_not_need_relocation <add> end <add> <ide> def tag?(tag) <ide> !!checksum_for(tag) <ide> end
1
PHP
PHP
remove useless loop
c04fa172ab4488f297549aa8618b066835b78d26
<ide><path>src/Illuminate/Support/Str.php <ide> public static function replaceLast($search, $replace, $subject) <ide> */ <ide> public static function remove($search, $subject, $caseSensitive = true) <ide> { <del> foreach (Arr::wrap($search) as $s) { <del> $subject = $caseSensitive <del> ? str_replace($search, '', $subject) <del> : str_ireplace($search, '', $subject); <del> } <add> $subject = $caseSensitive <add> ? str_replace($search, '', $subject) <add> : str_ireplace($search, '', $subject); <ide> <ide> return $subject; <ide> }
1
Ruby
Ruby
clarify example in activerecord base
ad3e4e3af698afda19549505cf82efb5eb6427f2
<ide><path>activerecord/lib/active_record/base.rb <ide> module ActiveRecord #:nodoc: <ide> # Person.find_by_user_name_and_password #with dynamic finder <ide> # <ide> # Person.where(:user_name => user_name, :password => password, :gender => 'male').first <del> # Payment.find_by_user_name_and_password_and_gender <add> # Payment.find_by_user_name_and_password_and_gender(user_name, password, 'male') <ide> # <ide> # It's even possible to call these dynamic finder methods on relations and named scopes. <ide> #
1
Javascript
Javascript
prettify tooltips on non-data calendar dates
31d00a993f23a05b0b3b3dd6eef646f8da36c30c
<ide><path>examples/calendar/dji.js <ide> d3.csv("dji.csv", function(csv) { <ide> rect <ide> .attr("class", function(d) { return "day q" + color(data[format(d)]) + "-9"; }) <ide> .append("svg:title") <del> .text(function(d) { return format(d) + ": " + percent(data[format(d)]); }); <add> .text(function(d) { var D = format(d), v = data[D]; return D + (isNaN(v) ? "" : ": " + percent(v)); }); <ide> }); <ide> <ide> function monthPath(t0) { <ide><path>examples/calendar/vix.js <ide> var m = [19, 20, 20, 19], // top right bottom left margin <ide> <ide> var day = d3.time.format("%w"), <ide> week = d3.time.format("%U"), <del> percent = d3.format(".1%"), <ide> format = d3.time.format("%Y-%m-%d"); <ide> <ide> var color = d3.scale.quantile() <ide> d3.csv("vix.csv", function(csv) { <ide> rect <ide> .attr("class", function(d) { return "day q" + color(data[format(d)]) + "-9"; }) <ide> .append("svg:title") <del> .text(function(d) { return format(d) + ": " + data[format(d)]; }); <add> .text(function(d) { var D = format(d), v = data[D]; return D + (isNaN(v) ? "" : ": " + v); }); <ide> }); <ide> <ide> function monthPath(t0) {
2
Python
Python
prepare 2.2.1 release
eb2c1fdc2d5f841e328993e3bd0e1a3de268fe20
<ide><path>keras/__init__.py <ide> from .models import Model <ide> from .models import Sequential <ide> <del>__version__ = '2.2.0' <add>__version__ = '2.2.1' <ide><path>keras/applications/__init__.py <ide> <ide> keras_applications.set_keras_submodules( <ide> backend=backend, <del> engine=engine, <ide> layers=layers, <ide> models=models, <ide> utils=utils) <ide><path>setup.py <ide> ''' <ide> <ide> setup(name='Keras', <del> version='2.2.0', <add> version='2.2.1', <ide> description='Deep Learning for humans', <ide> long_description=long_description, <ide> author='Francois Chollet', <ide> author_email='francois.chollet@gmail.com', <ide> url='https://github.com/keras-team/keras', <del> download_url='https://github.com/keras-team/keras/tarball/2.2.0', <add> download_url='https://github.com/keras-team/keras/tarball/2.2.1', <ide> license='MIT', <ide> install_requires=['numpy>=1.9.1', <ide> 'scipy>=0.14', <ide> 'six>=1.9.0', <ide> 'pyyaml', <ide> 'h5py', <del> 'keras_applications==1.0.2', <del> 'keras_preprocessing==1.0.1'], <add> 'keras_applications==1.0.4', <add> 'keras_preprocessing==1.0.2'], <ide> extras_require={ <ide> 'visualize': ['pydot>=1.2.4'], <ide> 'tests': ['pytest',
3
Mixed
Python
add decimalfield support
ad436d966fa9ee2f5817aa5c26612c82558c4262
<ide><path>docs/api-guide/fields.md <ide> A floating point representation. <ide> <ide> Corresponds to `django.db.models.fields.FloatField`. <ide> <add>## DecimalField <add> <add>A decimal representation. <add> <add>Corresponds to `django.db.models.fields.DecimalField`. <add> <ide> ## FileField <ide> <ide> A file representation. Performs Django's standard FileField validation. <ide><path>docs/topics/release-notes.md <ide> You can determine your currently installed version using `pip freeze`: <ide> <ide> **Date**: 4th April 2013 <ide> <add>* DecimalField support. <ide> * OAuth2 authentication no longer requires unneccessary URL parameters in addition to the token. <ide> * URL hyperlinking in browseable API now handles more cases correctly. <ide> * Long HTTP headers in browsable API are broken in multiple lines when possible. <ide><path>rest_framework/fields.py <ide> <ide> import copy <ide> import datetime <add>from decimal import Decimal, DecimalException <ide> import inspect <ide> import re <ide> import warnings <ide> def from_native(self, value): <ide> raise ValidationError(msg) <ide> <ide> <add>class DecimalField(WritableField): <add> type_name = 'DecimalField' <add> form_field_class = forms.DecimalField <add> <add> default_error_messages = { <add> 'invalid': _('Enter a number.'), <add> 'max_value': _('Ensure this value is less than or equal to %(limit_value)s.'), <add> 'min_value': _('Ensure this value is greater than or equal to %(limit_value)s.'), <add> 'max_digits': _('Ensure that there are no more than %s digits in total.'), <add> 'max_decimal_places': _('Ensure that there are no more than %s decimal places.'), <add> 'max_whole_digits': _('Ensure that there are no more than %s digits before the decimal point.') <add> } <add> <add> def __init__(self, max_value=None, min_value=None, max_digits=None, decimal_places=None, *args, **kwargs): <add> self.max_value, self.min_value = max_value, min_value <add> self.max_digits, self.decimal_places = max_digits, decimal_places <add> super(DecimalField, self).__init__(self, *args, **kwargs) <add> <add> if max_value is not None: <add> self.validators.append(validators.MaxValueValidator(max_value)) <add> if min_value is not None: <add> self.validators.append(validators.MinValueValidator(min_value)) <add> <add> def from_native(self, value): <add> """ <add> Validates that the input is a decimal number. Returns a Decimal <add> instance. Returns None for empty values. Ensures that there are no more <add> than max_digits in the number, and no more than decimal_places digits <add> after the decimal point. <add> """ <add> if value in validators.EMPTY_VALUES: <add> return None <add> value = smart_text(value).strip() <add> try: <add> value = Decimal(value) <add> except DecimalException: <add> raise ValidationError(self.error_messages['invalid']) <add> return value <add> <add> def to_native(self, value): <add> if value is not None: <add> return str(value) <add> return value <add> <add> def validate(self, value): <add> super(DecimalField, self).validate(value) <add> if value in validators.EMPTY_VALUES: <add> return <add> # Check for NaN, Inf and -Inf values. We can't compare directly for NaN, <add> # since it is never equal to itself. However, NaN is the only value that <add> # isn't equal to itself, so we can use this to identify NaN <add> if value != value or value == Decimal("Inf") or value == Decimal("-Inf"): <add> raise ValidationError(self.error_messages['invalid']) <add> sign, digittuple, exponent = value.as_tuple() <add> decimals = abs(exponent) <add> # digittuple doesn't include any leading zeros. <add> digits = len(digittuple) <add> if decimals > digits: <add> # We have leading zeros up to or past the decimal point. Count <add> # everything past the decimal point as a digit. We do not count <add> # 0 before the decimal point as a digit since that would mean <add> # we would not allow max_digits = decimal_places. <add> digits = decimals <add> whole_digits = digits - decimals <add> <add> if self.max_digits is not None and digits > self.max_digits: <add> raise ValidationError(self.error_messages['max_digits'] % self.max_digits) <add> if self.decimal_places is not None and decimals > self.decimal_places: <add> raise ValidationError(self.error_messages['max_decimal_places'] % self.decimal_places) <add> if self.max_digits is not None and self.decimal_places is not None and whole_digits > (self.max_digits - self.decimal_places): <add> raise ValidationError(self.error_messages['max_whole_digits'] % (self.max_digits - self.decimal_places)) <add> return value <add> <add> <ide> class FileField(WritableField): <ide> use_files = True <ide> type_name = 'FileField' <ide><path>rest_framework/tests/fields.py <ide> """ <ide> from __future__ import unicode_literals <ide> import datetime <add>from decimal import Decimal <ide> <ide> from django.db import models <ide> from django.test import TestCase <ide> from django.core import validators <ide> <ide> from rest_framework import serializers <add>from rest_framework.serializers import Serializer <ide> <ide> <ide> class TimestampedModel(models.Model): <ide> def test_to_native_custom_format(self): <ide> self.assertEqual('04 - 00 [000000]', result_1) <ide> self.assertEqual('04 - 59 [000000]', result_2) <ide> self.assertEqual('04 - 59 [000200]', result_3) <add> <add> <add>class DecimalFieldTest(TestCase): <add> """ <add> Tests for the DecimalField from_native() and to_native() behavior <add> """ <add> <add> def test_from_native_string(self): <add> """ <add> Make sure from_native() accepts string values <add> """ <add> f = serializers.DecimalField() <add> result_1 = f.from_native('9000') <add> result_2 = f.from_native('1.00000001') <add> <add> self.assertEqual(Decimal('9000'), result_1) <add> self.assertEqual(Decimal('1.00000001'), result_2) <add> <add> def test_from_native_invalid_string(self): <add> """ <add> Make sure from_native() raises ValidationError on passing invalid string <add> """ <add> f = serializers.DecimalField() <add> <add> try: <add> f.from_native('123.45.6') <add> except validators.ValidationError as e: <add> self.assertEqual(e.messages, ["Enter a number."]) <add> else: <add> self.fail("ValidationError was not properly raised") <add> <add> def test_from_native_integer(self): <add> """ <add> Make sure from_native() accepts integer values <add> """ <add> f = serializers.DecimalField() <add> result = f.from_native(9000) <add> <add> self.assertEqual(Decimal('9000'), result) <add> <add> def test_from_native_float(self): <add> """ <add> Make sure from_native() accepts float values <add> """ <add> f = serializers.DecimalField() <add> result = f.from_native(1.00000001) <add> <add> self.assertEqual(Decimal('1.00000001'), result) <add> <add> def test_from_native_empty(self): <add> """ <add> Make sure from_native() returns None on empty param. <add> """ <add> f = serializers.DecimalField() <add> result = f.from_native('') <add> <add> self.assertEqual(result, None) <add> <add> def test_from_native_none(self): <add> """ <add> Make sure from_native() returns None on None param. <add> """ <add> f = serializers.DecimalField() <add> result = f.from_native(None) <add> <add> self.assertEqual(result, None) <add> <add> def test_to_native(self): <add> """ <add> Make sure to_native() returns Decimal as string. <add> """ <add> f = serializers.DecimalField() <add> <add> result_1 = f.to_native(Decimal('9000')) <add> result_2 = f.to_native(Decimal('1.00000001')) <add> <add> self.assertEqual('9000', result_1) <add> self.assertEqual('1.00000001', result_2) <add> <add> def test_to_native_none(self): <add> """ <add> Make sure from_native() returns None on None param. <add> """ <add> f = serializers.DecimalField(required=False) <add> self.assertEqual(None, f.to_native(None)) <add> <add> def test_valid_serialization(self): <add> """ <add> Make sure the serializer works correctly <add> """ <add> class DecimalSerializer(Serializer): <add> decimal_field = serializers.DecimalField(max_value=9010, <add> min_value=9000, <add> max_digits=6, <add> decimal_places=2) <add> <add> self.assertTrue(DecimalSerializer(data={'decimal_field': '9001'}).is_valid()) <add> self.assertTrue(DecimalSerializer(data={'decimal_field': '9001.2'}).is_valid()) <add> self.assertTrue(DecimalSerializer(data={'decimal_field': '9001.23'}).is_valid()) <add> <add> self.assertFalse(DecimalSerializer(data={'decimal_field': '8000'}).is_valid()) <add> self.assertFalse(DecimalSerializer(data={'decimal_field': '9900'}).is_valid()) <add> self.assertFalse(DecimalSerializer(data={'decimal_field': '9001.234'}).is_valid()) <add> <add> def test_raise_max_value(self): <add> """ <add> Make sure max_value violations raises ValidationError <add> """ <add> class DecimalSerializer(Serializer): <add> decimal_field = serializers.DecimalField(max_value=100) <add> <add> s = DecimalSerializer(data={'decimal_field': '123'}) <add> <add> self.assertFalse(s.is_valid()) <add> self.assertEqual(s.errors, {'decimal_field': [u'Ensure this value is less than or equal to 100.']}) <add> <add> def test_raise_min_value(self): <add> """ <add> Make sure min_value violations raises ValidationError <add> """ <add> class DecimalSerializer(Serializer): <add> decimal_field = serializers.DecimalField(min_value=100) <add> <add> s = DecimalSerializer(data={'decimal_field': '99'}) <add> <add> self.assertFalse(s.is_valid()) <add> self.assertEqual(s.errors, {'decimal_field': [u'Ensure this value is greater than or equal to 100.']}) <add> <add> def test_raise_max_digits(self): <add> """ <add> Make sure max_digits violations raises ValidationError <add> """ <add> class DecimalSerializer(Serializer): <add> decimal_field = serializers.DecimalField(max_digits=5) <add> <add> s = DecimalSerializer(data={'decimal_field': '123.456'}) <add> <add> self.assertFalse(s.is_valid()) <add> self.assertEqual(s.errors, {'decimal_field': [u'Ensure that there are no more than 5 digits in total.']}) <add> <add> def test_raise_max_decimal_places(self): <add> """ <add> Make sure max_decimal_places violations raises ValidationError <add> """ <add> class DecimalSerializer(Serializer): <add> decimal_field = serializers.DecimalField(decimal_places=3) <add> <add> s = DecimalSerializer(data={'decimal_field': '123.4567'}) <add> <add> self.assertFalse(s.is_valid()) <add> self.assertEqual(s.errors, {'decimal_field': [u'Ensure that there are no more than 3 decimal places.']}) <add> <add> def test_raise_max_whole_digits(self): <add> """ <add> Make sure max_whole_digits violations raises ValidationError <add> """ <add> class DecimalSerializer(Serializer): <add> decimal_field = serializers.DecimalField(max_digits=4, decimal_places=3) <add> <add> s = DecimalSerializer(data={'decimal_field': '12345.6'}) <add> <add> self.assertFalse(s.is_valid()) <add> self.assertEqual(s.errors, {'decimal_field': [u'Ensure that there are no more than 4 digits in total.']}) <ide>\ No newline at end of file
4
Ruby
Ruby
restore original make_jobs return type
757cc24f7ec81acaec97d23dace4f6ceb462b4df
<ide><path>Library/Homebrew/extend/ENV/std.rb <ide> def set_cpu_cflags(map = Hardware::CPU.optimization_flags) # rubocop:disable Nam <ide> end <ide> <ide> def make_jobs <del> Homebrew::EnvConfig.make_jobs <add> Homebrew::EnvConfig.make_jobs.to_i <ide> end <ide> <ide> # This method does nothing in stdenv since there's no arg refurbishment
1
Ruby
Ruby
remove fallback for `bundleversion`
7c6116af992b5fda8bc175277d862ef03624c984
<ide><path>Library/Homebrew/bundle_version.rb <ide> def nice_parts <ide> end <ide> end <ide> <del> fallback = (short_version || version).sub(/\A[^\d]+/, "") <del> <del> [fallback] <add> [short_version, version].compact <ide> end <ide> private :nice_parts <ide> end
1
Go
Go
add agentstopwait method
18098ab1c8614d0d5dd59e6283b1013405c04857
<ide><path>libnetwork/agent.go <ide> func (c *controller) agentSetup() error { <ide> if c.agent != nil && c.agentInitDone != nil { <ide> close(c.agentInitDone) <ide> c.agentInitDone = nil <add> c.agentStopDone = make(chan struct{}) <ide> } <ide> c.Unlock() <ide> <ide><path>libnetwork/controller.go <ide> type NetworkController interface { <ide> // Wait for agent initialization complete in libnetwork controller <ide> AgentInitWait() <ide> <add> // Wait for agent to stop if running <add> AgentStopWait() <add> <ide> // SetKeys configures the encryption key for gossip and overlay data path <ide> SetKeys(keys []*types.EncryptionKey) error <ide> } <ide> type controller struct { <ide> agent *agent <ide> networkLocker *locker.Locker <ide> agentInitDone chan struct{} <add> agentStopDone chan struct{} <ide> keys []*types.EncryptionKey <ide> clusterConfigAvailable bool <ide> sync.Mutex <ide> func (c *controller) clusterAgentInit() { <ide> // service bindings <ide> c.agentClose() <ide> c.cleanupServiceBindings("") <add> <add> c.Lock() <add> if c.agentStopDone != nil { <add> close(c.agentStopDone) <add> c.agentStopDone = nil <add> } <add> c.Unlock() <add> <ide> return <ide> } <ide> } <ide> func (c *controller) AgentInitWait() { <ide> } <ide> } <ide> <add>func (c *controller) AgentStopWait() { <add> c.Lock() <add> agentStopDone := c.agentStopDone <add> c.Unlock() <add> if agentStopDone != nil { <add> <-agentStopDone <add> } <add>} <add> <ide> func (c *controller) makeDriverConfig(ntype string) map[string]interface{} { <ide> if c.cfg == nil { <ide> return nil
2
PHP
PHP
remove redundant test
a8db3e3df3c732b55aa7f8e5ebfb8bbe4abc7243
<ide><path>tests/TestCase/View/Helper/FormHelperTest.php <ide> public function testFormEnd() { <ide> $this->assertEquals('</form>', $this->Form->end()); <ide> } <ide> <del>/** <del> * testMultipleFormWithIdFields method <del> * <del> * @return void <del> */ <del> public function testMultipleFormWithIdFields() { <del> $this->markTestIncomplete('Need to revisit once models work again.'); <del> $this->Form->create('UserForm'); <del> <del> $result = $this->Form->input('id'); <del> $this->assertTags($result, array('input' => array( <del> 'type' => 'hidden', 'name' => 'UserForm[id]', 'id' => 'UserFormId' <del> ))); <del> <del> $result = $this->Form->input('ValidateItem.id'); <del> $this->assertTags($result, array('input' => array( <del> 'type' => 'hidden', 'name' => 'ValidateItem[id]', <del> 'id' => 'ValidateItemId' <del> ))); <del> <del> $result = $this->Form->input('ValidateUser.id'); <del> $this->assertTags($result, array('input' => array( <del> 'type' => 'hidden', 'name' => 'ValidateUser[id]', <del> 'id' => 'ValidateUserId' <del> ))); <del> } <del> <ide> /** <ide> * testDbLessModel method <ide> *
1
Python
Python
add clarity to gcs_download_operator params
ce17c9b1d1cddb9cd008908ec289210c583da0f9
<ide><path>airflow/contrib/operators/gcs_download_operator.py <ide> class GoogleCloudStorageDownloadOperator(BaseOperator): <ide> set the ``store_to_xcom_key`` parameter to True push the file content into xcom. When the file size <ide> exceeds the maximum size for xcom it is recommended to write to a file. <ide> <del> :param bucket: The Google cloud storage bucket where the object is. (templated) <add> :param bucket: The Google cloud storage bucket where the object is. <add> Must not contain 'gs://' prefix. (templated) <ide> :type bucket: str <ide> :param object: The name of the object to download in the Google cloud <ide> storage bucket. (templated) <ide> :type object: str <del> :param filename: The file path on the local file system (where the <add> :param filename: The file path, including filename, on the local file system (where the <ide> operator is being executed) that the file should be downloaded to. (templated) <ide> If no filename passed, the downloaded data will not be stored on the local file <ide> system.
1
Ruby
Ruby
add fetch_dependency method
48918bb5e33440d97c7ce12186b97fb0026e4bbf
<ide><path>Library/Homebrew/formula_installer.rb <ide> def install_dependencies(deps) <ide> @show_header = true unless deps.empty? <ide> end <ide> <add> def fetch_dependency(dep) <add> df = dep.to_formula <add> fi = FormulaInstaller.new(df) <add> <add> fi.build_from_source = Homebrew.args.build_formula_from_source?(df) <add> fi.force_bottle = false <add> fi.verbose = verbose? <add> fi.quiet = quiet? <add> fi.debug = debug? <add> fi.fetch <add> end <add> <ide> def install_dependency(dep, inherited_options) <ide> df = dep.to_formula <ide> tab = Tab.for_formula(df) <ide> def install_dependency(dep, inherited_options) <ide> fi.installed_as_dependency = true <ide> fi.installed_on_request = df.any_version_installed? && tab.installed_on_request <ide> fi.prelude <del> fi.fetch <ide> oh1 "Installing #{formula.full_name} dependency: #{Formatter.identifier(dep.name)}" <ide> fi.install <ide> fi.finish <ide> def fetch_dependencies <ide> <ide> return if deps.empty? || ignore_deps? <ide> <del> deps.each do |dep, _| <del> dep.to_formula.resources.each(&:fetch) <del> end <add> deps.each { |dep, _options| fetch_dependency(dep) } <ide> end <ide> <ide> def fetch
1
Go
Go
fix lint issue
67ecbba4ff24895389b347977be6342b544da8e7
<ide><path>libnetwork/drivers/bridge/bridge.go <ide> func (n *bridgeNetwork) isolateNetwork(others []*bridgeNetwork, enable bool) err <ide> } <ide> <ide> // Install the rules to isolate this network against each of the other networks <del> if err := setINC(thisConfig.BridgeName, enable); err != nil { <del> return err <del> } <del> <del> return nil <add> return setINC(thisConfig.BridgeName, enable) <ide> } <ide> <ide> func (d *driver) configure(option map[string]interface{}) error {
1
Java
Java
implement nativeanimated offsets on android
8e81644f64b96ab4726ce37a6a328acbe4a32783
<ide><path>ReactAndroid/src/main/java/com/facebook/react/animated/AdditionAnimatedNode.java <ide> public void update() { <ide> for (int i = 0; i < mInputNodes.length; i++) { <ide> AnimatedNode animatedNode = mNativeAnimatedNodesManager.getNodeById(mInputNodes[i]); <ide> if (animatedNode != null && animatedNode instanceof ValueAnimatedNode) { <del> mValue += ((ValueAnimatedNode) animatedNode).mValue; <add> mValue += ((ValueAnimatedNode) animatedNode).getValue(); <ide> } else { <ide> throw new JSApplicationCausedNativeException("Illegal node ID set as an input for " + <ide> "Animated.Add node"); <ide><path>ReactAndroid/src/main/java/com/facebook/react/animated/DiffClampAnimatedNode.java <ide> private double getInputNodeValue() { <ide> <ide> } <ide> <del> return ((ValueAnimatedNode) animatedNode).mValue; <add> return ((ValueAnimatedNode) animatedNode).getValue(); <ide> } <ide> } <ide><path>ReactAndroid/src/main/java/com/facebook/react/animated/DivisionAnimatedNode.java <ide> public void update() { <ide> for (int i = 0; i < mInputNodes.length; i++) { <ide> AnimatedNode animatedNode = mNativeAnimatedNodesManager.getNodeById(mInputNodes[i]); <ide> if (animatedNode != null && animatedNode instanceof ValueAnimatedNode) { <del> double value = ((ValueAnimatedNode) animatedNode).mValue; <add> double value = ((ValueAnimatedNode) animatedNode).getValue(); <ide> if (i == 0) { <ide> mValue = value; <ide> continue; <ide><path>ReactAndroid/src/main/java/com/facebook/react/animated/InterpolationAnimatedNode.java <ide> public void update() { <ide> throw new IllegalStateException("Trying to update interpolation node that has not been " + <ide> "attached to the parent"); <ide> } <del> mValue = interpolate(mParent.mValue, mInputRange, mOutputRange, mExtrapolateLeft, mExtrapolateRight); <add> mValue = interpolate(mParent.getValue(), mInputRange, mOutputRange, mExtrapolateLeft, mExtrapolateRight); <ide> } <ide> } <ide><path>ReactAndroid/src/main/java/com/facebook/react/animated/MultiplicationAnimatedNode.java <ide> public void update() { <ide> for (int i = 0; i < mInputNodes.length; i++) { <ide> AnimatedNode animatedNode = mNativeAnimatedNodesManager.getNodeById(mInputNodes[i]); <ide> if (animatedNode != null && animatedNode instanceof ValueAnimatedNode) { <del> mValue *= ((ValueAnimatedNode) animatedNode).mValue; <add> mValue *= ((ValueAnimatedNode) animatedNode).getValue(); <ide> } else { <ide> throw new JSApplicationCausedNativeException("Illegal node ID set as an input for " + <ide> "Animated.multiply node"); <ide><path>ReactAndroid/src/main/java/com/facebook/react/animated/NativeAnimatedModule.java <ide> public void execute(NativeAnimatedNodesManager animatedNodesManager) { <ide> }); <ide> } <ide> <add> @ReactMethod <add> public void setAnimatedNodeOffset(final int tag, final double value) { <add> mOperations.add(new UIThreadOperation() { <add> @Override <add> public void execute(NativeAnimatedNodesManager animatedNodesManager) { <add> animatedNodesManager.setAnimatedNodeOffset(tag, value); <add> } <add> }); <add> } <add> <add> @ReactMethod <add> public void flattenAnimatedNodeOffset(final int tag) { <add> mOperations.add(new UIThreadOperation() { <add> @Override <add> public void execute(NativeAnimatedNodesManager animatedNodesManager) { <add> animatedNodesManager.flattenAnimatedNodeOffset(tag); <add> } <add> }); <add> } <add> <ide> @ReactMethod <ide> public void startAnimatingNode( <ide> final int animationId, <ide><path>ReactAndroid/src/main/java/com/facebook/react/animated/NativeAnimatedNodesManager.java <ide> public void setAnimatedNodeValue(int tag, double value) { <ide> mUpdatedNodes.add(node); <ide> } <ide> <add> public void setAnimatedNodeOffset(int tag, double offset) { <add> AnimatedNode node = mAnimatedNodes.get(tag); <add> if (node == null || !(node instanceof ValueAnimatedNode)) { <add> throw new JSApplicationIllegalArgumentException("Animated node with tag " + tag + <add> " does not exists or is not a 'value' node"); <add> } <add> ((ValueAnimatedNode) node).mOffset = offset; <add> mUpdatedNodes.add(node); <add> } <add> <add> public void flattenAnimatedNodeOffset(int tag) { <add> AnimatedNode node = mAnimatedNodes.get(tag); <add> if (node == null || !(node instanceof ValueAnimatedNode)) { <add> throw new JSApplicationIllegalArgumentException("Animated node with tag " + tag + <add> " does not exists or is not a 'value' node"); <add> } <add> ((ValueAnimatedNode) node).flattenOffset(); <add> } <add> <ide> public void startAnimatingNode( <ide> int animationId, <ide> int animatedNodeTag, <ide><path>ReactAndroid/src/main/java/com/facebook/react/animated/PropsAnimatedNode.java <ide> public final void updateView(UIImplementation uiImplementation) { <ide> } else if (node instanceof StyleAnimatedNode) { <ide> ((StyleAnimatedNode) node).collectViewUpdates(propsMap); <ide> } else if (node instanceof ValueAnimatedNode) { <del> propsMap.putDouble(entry.getKey(), ((ValueAnimatedNode) node).mValue); <add> propsMap.putDouble(entry.getKey(), ((ValueAnimatedNode) node).getValue()); <ide> } else { <ide> throw new IllegalArgumentException("Unsupported type of node used in property node " + <ide> node.getClass()); <ide><path>ReactAndroid/src/main/java/com/facebook/react/animated/StyleAnimatedNode.java <ide> public void collectViewUpdates(JavaOnlyMap propsMap) { <ide> } else if (node instanceof TransformAnimatedNode) { <ide> ((TransformAnimatedNode) node).collectViewUpdates(propsMap); <ide> } else if (node instanceof ValueAnimatedNode) { <del> propsMap.putDouble(entry.getKey(), ((ValueAnimatedNode) node).mValue); <add> propsMap.putDouble(entry.getKey(), ((ValueAnimatedNode) node).getValue()); <ide> } else { <ide> throw new IllegalArgumentException("Unsupported type of node used in property node " + <ide> node.getClass()); <ide><path>ReactAndroid/src/main/java/com/facebook/react/animated/TransformAnimatedNode.java <ide> public void collectViewUpdates(JavaOnlyMap propsMap) { <ide> if (node == null) { <ide> throw new IllegalArgumentException("Mapped style node does not exists"); <ide> } else if (node instanceof ValueAnimatedNode) { <del> value = ((ValueAnimatedNode) node).mValue; <add> value = ((ValueAnimatedNode) node).getValue(); <ide> } else { <ide> throw new IllegalArgumentException("Unsupported type of node used as a transform child " + <ide> "node " + node.getClass()); <ide><path>ReactAndroid/src/main/java/com/facebook/react/animated/ValueAnimatedNode.java <ide> */ <ide> /*package*/ class ValueAnimatedNode extends AnimatedNode { <ide> /*package*/ double mValue = Double.NaN; <add> /*package*/ double mOffset = 0; <ide> private @Nullable AnimatedNodeValueListener mValueListener; <ide> <ide> public ValueAnimatedNode() { <ide> public ValueAnimatedNode() { <ide> <ide> public ValueAnimatedNode(ReadableMap config) { <ide> mValue = config.getDouble("value"); <add> mOffset = config.getDouble("offset"); <add> } <add> <add> public double getValue() { <add> return mOffset + mValue; <add> } <add> <add> public void flattenOffset() { <add> mValue += mOffset; <add> mOffset = 0; <ide> } <ide> <ide> public void onValueUpdate() { <ide><path>ReactAndroid/src/test/java/com/facebook/react/animated/NativeAnimatedNodeTraversalTest.java <ide> public Object answer(InvocationOnMock invocation) throws Throwable { <ide> private void createSimpleAnimatedViewWithOpacity(int viewTag, double opacity) { <ide> mNativeAnimatedNodesManager.createAnimatedNode( <ide> 1, <del> JavaOnlyMap.of("type", "value", "value", opacity)); <add> JavaOnlyMap.of("type", "value", "value", opacity, "offset", 0d)); <ide> mNativeAnimatedNodesManager.createAnimatedNode( <ide> 2, <ide> JavaOnlyMap.of("type", "style", "style", JavaOnlyMap.of("opacity", 1))); <ide> private void createAnimatedGraphWithAdditionNode( <ide> double secondValue) { <ide> mNativeAnimatedNodesManager.createAnimatedNode( <ide> 1, <del> JavaOnlyMap.of("type", "value", "value", 100d)); <add> JavaOnlyMap.of("type", "value", "value", 100d, "offset", 0d)); <ide> mNativeAnimatedNodesManager.createAnimatedNode( <ide> 2, <del> JavaOnlyMap.of("type", "value", "value", 1000d)); <add> JavaOnlyMap.of("type", "value", "value", 1000d, "offset", 0d)); <ide> <ide> mNativeAnimatedNodesManager.createAnimatedNode( <ide> 3, <ide> public void testViewReceiveUpdatesWhenOneOfAnimationHasFinished() { <ide> public void testMultiplicationNode() { <ide> mNativeAnimatedNodesManager.createAnimatedNode( <ide> 1, <del> JavaOnlyMap.of("type", "value", "value", 1d)); <add> JavaOnlyMap.of("type", "value", "value", 1d, "offset", 0d)); <ide> mNativeAnimatedNodesManager.createAnimatedNode( <ide> 2, <del> JavaOnlyMap.of("type", "value", "value", 5d)); <add> JavaOnlyMap.of("type", "value", "value", 5d, "offset", 0d)); <ide> <ide> mNativeAnimatedNodesManager.createAnimatedNode( <ide> 3, <ide> public void testHandleStoppingAnimation() { <ide> public void testInterpolationNode() { <ide> mNativeAnimatedNodesManager.createAnimatedNode( <ide> 1, <del> JavaOnlyMap.of("type", "value", "value", 10d)); <add> JavaOnlyMap.of("type", "value", "value", 10d, "offset", 0d)); <ide> <ide> mNativeAnimatedNodesManager.createAnimatedNode( <ide> 2,
12
Go
Go
remove obnoxious types file
244e59e94f153af82e6c3bd8a6c200a48d3cea60
<ide><path>daemon/stats/collector.go <ide> package stats // import "github.com/docker/docker/daemon/stats" <ide> <ide> import ( <add> "bufio" <add> "sync" <ide> "time" <ide> <ide> "github.com/docker/docker/api/types" <ide> import ( <ide> "github.com/sirupsen/logrus" <ide> ) <ide> <add>// Collector manages and provides container resource stats <add>type Collector struct { <add> m sync.Mutex <add> supervisor supervisor <add> interval time.Duration <add> publishers map[*container.Container]*pubsub.Publisher <add> bufReader *bufio.Reader <add> <add> // The following fields are not set on Windows currently. <add> clockTicksPerSecond uint64 <add>} <add> <add>// NewCollector creates a stats collector that will poll the supervisor with the specified interval <add>func NewCollector(supervisor supervisor, interval time.Duration) *Collector { <add> s := &Collector{ <add> interval: interval, <add> supervisor: supervisor, <add> publishers: make(map[*container.Container]*pubsub.Publisher), <add> bufReader: bufio.NewReaderSize(nil, 128), <add> } <add> <add> platformNewStatsCollector(s) <add> <add> return s <add>} <add> <add>type supervisor interface { <add> // GetContainerStats collects all the stats related to a container <add> GetContainerStats(container *container.Container) (*types.StatsJSON, error) <add>} <add> <ide> // Collect registers the container with the collector and adds it to <ide> // the event loop for collection on the specified interval returning <ide> // a channel for the subscriber to receive on. <ide><path>daemon/stats/types.go <del>package stats // import "github.com/docker/docker/daemon/stats" <del> <del>import ( <del> "bufio" <del> "sync" <del> "time" <del> <del> "github.com/docker/docker/api/types" <del> "github.com/docker/docker/container" <del> "github.com/docker/docker/pkg/pubsub" <del>) <del> <del>type supervisor interface { <del> // GetContainerStats collects all the stats related to a container <del> GetContainerStats(container *container.Container) (*types.StatsJSON, error) <del>} <del> <del>// NewCollector creates a stats collector that will poll the supervisor with the specified interval <del>func NewCollector(supervisor supervisor, interval time.Duration) *Collector { <del> s := &Collector{ <del> interval: interval, <del> supervisor: supervisor, <del> publishers: make(map[*container.Container]*pubsub.Publisher), <del> bufReader: bufio.NewReaderSize(nil, 128), <del> } <del> <del> platformNewStatsCollector(s) <del> <del> return s <del>} <del> <del>// Collector manages and provides container resource stats <del>type Collector struct { <del> m sync.Mutex <del> supervisor supervisor <del> interval time.Duration <del> publishers map[*container.Container]*pubsub.Publisher <del> bufReader *bufio.Reader <del> <del> // The following fields are not set on Windows currently. <del> clockTicksPerSecond uint64 <del>}
2
PHP
PHP
apply fixes from styleci
4902c74f609b31835fcdf729f85d3f3e8254ae51
<ide><path>src/Illuminate/Foundation/Console/ComponentMakeCommand.php <ide> protected function writeView() <ide> <ide> file_put_contents( <ide> $path.'.blade.php', <del> "<div> <del> <!-- ".Inspiring::quote()." --> <del></div>" <add> '<div> <add> <!-- '.Inspiring::quote().' --> <add></div>' <ide> ); <ide> } <ide> <ide><path>src/Illuminate/Foundation/Providers/ArtisanServiceProvider.php <ide> use Illuminate\Queue\Console\FailedTableCommand; <ide> use Illuminate\Queue\Console\FlushFailedCommand as FlushFailedQueueCommand; <ide> use Illuminate\Queue\Console\ForgetFailedCommand as ForgetFailedQueueCommand; <del>use Illuminate\Queue\Console\ListFailedCommand as ListFailedQueueCommand; <ide> use Illuminate\Queue\Console\ListenCommand as QueueListenCommand; <add>use Illuminate\Queue\Console\ListFailedCommand as ListFailedQueueCommand; <ide> use Illuminate\Queue\Console\RestartCommand as QueueRestartCommand; <ide> use Illuminate\Queue\Console\RetryCommand as QueueRetryCommand; <ide> use Illuminate\Queue\Console\TableCommand; <ide><path>src/Illuminate/View/Compilers/ComponentTagCompiler.php <ide> <ide> namespace Illuminate\View\Compilers; <ide> <add>use Illuminate\Support\Str; <ide> use InvalidArgumentException; <ide> use ReflectionClass; <ide> <del>use Illuminate\Support\Str; <del> <ide> /** <ide> * @author Spatie bvba <info@spatie.be> <ide> * @author Taylor Otwell <taylor@laravel.com> <ide> protected function componentString(string $component, array $attributes) <ide> <ide> [$data, $attributes] = $this->partitionDataAndAttributes($class, $attributes); <ide> <del> return " @component('{$class}', [".$this->attributesToString($data->all())."]) <del><?php \$component->withAttributes([".$this->attributesToString($attributes->all())."]); ?>"; <add> return " @component('{$class}', [".$this->attributesToString($data->all()).']) <add><?php $component->withAttributes(['.$this->attributesToString($attributes->all()).']); ?>'; <ide> } <ide> <ide> /** <ide><path>src/Illuminate/View/Compilers/Concerns/CompilesComponents.php <ide> public function compileClassComponentClosing() <ide> '<?php $component = $__componentOriginal'.$hash.'; ?>', <ide> '<?php unset($__componentOriginal'.$hash.'); ?>', <ide> '<?php endif; ?>', <del> '<?php echo $__env->renderComponent(); ?>' <add> '<?php echo $__env->renderComponent(); ?>', <ide> ]); <ide> } <ide> <ide><path>src/Illuminate/View/Component.php <ide> protected function ignoredMethods() <ide> 'withAttributes', <ide> ], $this->except); <ide> } <del> <ide> } <ide><path>tests/View/Blade/BladeComponentTagCompilerTest.php <ide> <ide> use Illuminate\View\Compilers\ComponentTagCompiler; <ide> use Illuminate\View\Component; <del>use InvalidArgumentException; <ide> <ide> class BladeComponentTagCompilerTest extends AbstractBladeTestCase <ide> {
6
PHP
PHP
improve eager loading performance on mysql
a4405e91af27429f9e879d8754769cb68eb208d6
<ide><path>src/Illuminate/Database/Eloquent/Relations/HasOneOrMany.php <ide> public function addConstraints() <ide> */ <ide> public function addEagerConstraints(array $models) <ide> { <del> $this->query->whereIn( <add> $whereIn = in_array($this->parent->getKeyType(), ['int', 'integer']) ? 'whereInRaw' : 'whereIn'; <add> <add> $this->query->$whereIn( <ide> $this->foreignKey, $this->getKeys($models, $this->localKey) <ide> ); <ide> } <ide><path>src/Illuminate/Database/Query/Builder.php <ide> protected function whereInExistingQuery($column, $query, $boolean, $not) <ide> return $this; <ide> } <ide> <add> /** <add> * Add a "where in raw" clause to the query. <add> * <add> * @param string $column <add> * @param array $values <add> * @param string $boolean <add> * @param bool $not <add> * @return $this <add> */ <add> public function whereInRaw($column, array $values, $boolean = 'and', $not = false) <add> { <add> $type = $not ? 'NotInRaw' : 'InRaw'; <add> <add> if ($values instanceof Arrayable) { <add> $values = $values->toArray(); <add> } <add> <add> $values = array_map('intval', $values); <add> <add> $this->wheres[] = compact('type', 'column', 'values', 'boolean'); <add> <add> return $this; <add> } <add> <ide> /** <ide> * Add a "where null" clause to the query. <ide> * <ide><path>src/Illuminate/Database/Query/Grammars/Grammar.php <ide> protected function whereNotInSub(Builder $query, $where) <ide> return $this->wrap($where['column']).' not in ('.$this->compileSelect($where['query']).')'; <ide> } <ide> <add> /** <add> * Compile a "where in raw" clause. <add> * <add> * @param \Illuminate\Database\Query\Builder $query <add> * @param array $where <add> * @return string <add> */ <add> protected function whereInRaw(Builder $query, $where) <add> { <add> if (! empty($where['values'])) { <add> return $this->wrap($where['column']).' in ('.implode(', ', $where['values']).')'; <add> } <add> <add> return '0 = 1'; <add> } <add> <ide> /** <ide> * Compile a "where null" clause. <ide> * <ide><path>tests/Database/DatabaseEloquentHasManyTest.php <ide> public function testRelationIsProperlyInitialized() <ide> public function testEagerConstraintsAreProperlyAdded() <ide> { <ide> $relation = $this->getRelation(); <add> $relation->getParent()->shouldReceive('getKeyType')->once()->andReturn('int'); <add> $relation->getQuery()->shouldReceive('whereInRaw')->once()->with('table.foreign_key', [1, 2]); <add> $model1 = new EloquentHasManyModelStub; <add> $model1->id = 1; <add> $model2 = new EloquentHasManyModelStub; <add> $model2->id = 2; <add> $relation->addEagerConstraints([$model1, $model2]); <add> } <add> <add> public function testEagerConstraintsAreProperlyAddedWithStringKey() <add> { <add> $relation = $this->getRelation(); <add> $relation->getParent()->shouldReceive('getKeyType')->once()->andReturn('string'); <ide> $relation->getQuery()->shouldReceive('whereIn')->once()->with('table.foreign_key', [1, 2]); <ide> $model1 = new EloquentHasManyModelStub; <ide> $model1->id = 1; <ide><path>tests/Database/DatabaseEloquentHasOneTest.php <ide> public function testRelationIsProperlyInitialized() <ide> public function testEagerConstraintsAreProperlyAdded() <ide> { <ide> $relation = $this->getRelation(); <del> $relation->getQuery()->shouldReceive('whereIn')->once()->with('table.foreign_key', [1, 2]); <add> $relation->getParent()->shouldReceive('getKeyType')->once()->andReturn('int'); <add> $relation->getQuery()->shouldReceive('whereInRaw')->once()->with('table.foreign_key', [1, 2]); <ide> $model1 = new EloquentHasOneModelStub; <ide> $model1->id = 1; <ide> $model2 = new EloquentHasOneModelStub; <ide><path>tests/Database/DatabaseEloquentMorphTest.php <ide> public function testMorphOneSetsProperConstraints() <ide> public function testMorphOneEagerConstraintsAreProperlyAdded() <ide> { <ide> $relation = $this->getOneRelation(); <add> $relation->getParent()->shouldReceive('getKeyType')->once()->andReturn('string'); <ide> $relation->getQuery()->shouldReceive('whereIn')->once()->with('table.morph_id', [1, 2]); <ide> $relation->getQuery()->shouldReceive('where')->once()->with('table.morph_type', get_class($relation->getParent())); <ide> <ide> public function testMorphManySetsProperConstraints() <ide> public function testMorphManyEagerConstraintsAreProperlyAdded() <ide> { <ide> $relation = $this->getManyRelation(); <del> $relation->getQuery()->shouldReceive('whereIn')->once()->with('table.morph_id', [1, 2]); <add> $relation->getParent()->shouldReceive('getKeyType')->once()->andReturn('int'); <add> $relation->getQuery()->shouldReceive('whereInRaw')->once()->with('table.morph_id', [1, 2]); <ide> $relation->getQuery()->shouldReceive('where')->once()->with('table.morph_type', get_class($relation->getParent())); <ide> <ide> $model1 = new EloquentMorphResetModelStub; <ide><path>tests/Database/DatabaseQueryBuilderTest.php <ide> public function testEmptyWhereNotIns() <ide> $this->assertEquals([0 => 1], $builder->getBindings()); <ide> } <ide> <add> public function testWhereInRaw() <add> { <add> $builder = $this->getBuilder(); <add> $builder->select('*')->from('users')->whereInRaw('id', ['1a', 2]); <add> $this->assertEquals('select * from "users" where "id" in (1, 2)', $builder->toSql()); <add> $this->assertEquals([], $builder->getBindings()); <add> } <add> <ide> public function testBasicWhereColumn() <ide> { <ide> $builder = $this->getBuilder();
7
Java
Java
detect order on target class as well
1aec6a6cc29c54cd74a7e609a2fa08d39835abe1
<ide><path>spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java <ide> public FactoryAwareOrderSourceProvider(Map<Object, String> instancesToBeanNames) <ide> <ide> @Override <ide> public Object getOrderSource(Object obj) { <del> return getFactoryMethod(this.instancesToBeanNames.get(obj)); <add> RootBeanDefinition beanDefinition = getRootBeanDefinition(this.instancesToBeanNames.get(obj)); <add> if (beanDefinition == null) { <add> return null; <add> } <add> List<Object> sources = new ArrayList<Object>(); <add> Method factoryMethod = beanDefinition.getResolvedFactoryMethod(); <add> if (factoryMethod != null) { <add> sources.add(factoryMethod); <add> } <add> Class<?> targetType = beanDefinition.getTargetType(); <add> if (targetType != null && !targetType.equals(obj.getClass())) { <add> sources.add(targetType); <add> } <add> return sources.toArray(new Object[sources.size()]); <ide> } <ide> <del> private Method getFactoryMethod(String beanName) { <add> private RootBeanDefinition getRootBeanDefinition(String beanName) { <ide> if (beanName != null && containsBeanDefinition(beanName)) { <ide> BeanDefinition bd = getMergedBeanDefinition(beanName); <ide> if (bd instanceof RootBeanDefinition) { <del> return ((RootBeanDefinition) bd).getResolvedFactoryMethod(); <add> return (RootBeanDefinition) bd; <ide> } <ide> } <ide> return null; <ide><path>spring-context/src/test/java/org/springframework/context/annotation/Spr12636Tests.java <add>/* <add> * Copyright 2002-2015 the original author or authors. <add> * <add> * Licensed under the Apache License, Version 2.0 (the "License"); <add> * you may not use this file except in compliance with the License. <add> * You may obtain a copy of the License at <add> * <add> * http://www.apache.org/licenses/LICENSE-2.0 <add> * <add> * Unless required by applicable law or agreed to in writing, software <add> * distributed under the License is distributed on an "AS IS" BASIS, <add> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <add> * See the License for the specific language governing permissions and <add> * limitations under the License. <add> */ <add> <add>package org.springframework.context.annotation; <add> <add>import java.util.List; <add> <add>import org.junit.After; <add>import org.junit.Test; <add> <add>import org.springframework.aop.support.AopUtils; <add>import org.springframework.beans.factory.annotation.Autowired; <add>import org.springframework.context.ConfigurableApplicationContext; <add>import org.springframework.core.annotation.Order; <add>import org.springframework.scheduling.annotation.Async; <add>import org.springframework.scheduling.annotation.EnableAsync; <add>import org.springframework.stereotype.Component; <add> <add>import static org.junit.Assert.*; <add> <add>/** <add> * @author Stephane Nicoll <add> */ <add>public class Spr12636Tests { <add> <add> private ConfigurableApplicationContext context; <add> <add> @After <add> public void closeContext() { <add> if (this.context != null) { <add> this.context.close(); <add> } <add> } <add> <add> @Test <add> public void orderOnImplementation() { <add> this.context = new AnnotationConfigApplicationContext( <add> UserServiceTwo.class, UserServiceOne.class, UserServiceCollector.class); <add> UserServiceCollector bean = this.context.getBean(UserServiceCollector.class); <add> assertSame(context.getBean("serviceOne", UserService.class), bean.userServices.get(0)); <add> assertSame(context.getBean("serviceTwo", UserService.class), bean.userServices.get(1)); <add> <add> } <add> <add> @Test <add> public void orderOnImplementationWithProxy() { <add> this.context = new AnnotationConfigApplicationContext( <add> UserServiceTwo.class, UserServiceOne.class, UserServiceCollector.class, AsyncConfig.class); <add> <add> // Validate those beans are indeed wrapped by a proxy <add> UserService serviceOne = this.context.getBean("serviceOne", UserService.class); <add> UserService serviceTwo = this.context.getBean("serviceTwo", UserService.class); <add> assertTrue(AopUtils.isAopProxy(serviceOne)); <add> assertTrue(AopUtils.isAopProxy(serviceTwo)); <add> <add> UserServiceCollector bean = this.context.getBean(UserServiceCollector.class); <add> assertSame(serviceOne, bean.userServices.get(0)); <add> assertSame(serviceTwo, bean.userServices.get(1)); <add> } <add> <add> @Configuration <add> @EnableAsync <add> static class AsyncConfig { <add> } <add> <add> <add> @Component <add> static class UserServiceCollector { <add> <add> public final List<UserService> userServices; <add> <add> @Autowired <add> UserServiceCollector(List<UserService> userServices) { <add> this.userServices = userServices; <add> } <add> } <add> <add> interface UserService { <add> <add> void doIt(); <add> } <add> <add> @Component("serviceOne") <add> @Order(1) <add> static class UserServiceOne implements UserService { <add> <add> @Async <add> @Override <add> public void doIt() { <add> <add> } <add> } <add> <add> @Component("serviceTwo") <add> @Order(2) <add> static class UserServiceTwo implements UserService { <add> <add> @Async <add> @Override <add> public void doIt() { <add> <add> } <add> } <add>} <ide><path>spring-core/src/main/java/org/springframework/core/OrderComparator.java <ide> import java.util.Comparator; <ide> import java.util.List; <ide> <add>import org.springframework.util.ObjectUtils; <add> <ide> /** <ide> * {@link Comparator} implementation for {@link Ordered} objects, <ide> * sorting by order value ascending (resp. by priority descending). <ide> else if (p2 && !p1) { <ide> private int getOrder(Object obj, OrderSourceProvider sourceProvider) { <ide> Integer order = null; <ide> if (sourceProvider != null) { <del> order = findOrder(sourceProvider.getOrderSource(obj)); <add> Object orderSource = sourceProvider.getOrderSource(obj); <add> if (orderSource != null && orderSource.getClass().isArray()) { <add> Object[] sources = ObjectUtils.toObjectArray(orderSource); <add> for (Object source : sources) { <add> order = findOrder(source); <add> if (order != null) { <add> break; <add> } <add> } <add> } <add> else { <add> order = findOrder(orderSource); <add> } <ide> } <ide> return (order != null ? order : getOrder(obj)); <ide> } <ide> public static interface OrderSourceProvider { <ide> /** <ide> * Return an order source for the specified object, i.e. an object that <ide> * should be checked for an order value as a replacement to the given object. <add> * <p>Can also be an array of order source objects. <ide> * <p>If the returned object does not indicate any order, the comparator <ide> * will fall back to checking the original object. <ide> * @param obj the object to find an order source for <ide><path>spring-core/src/test/java/org/springframework/core/OrderComparatorTests.java <ide> <ide> import java.util.Comparator; <ide> <del>import junit.framework.TestCase; <add>import org.junit.Test; <add> <add>import static org.junit.Assert.assertEquals; <ide> <ide> /** <ide> * Unit tests for the {@link OrderComparator} class. <ide> * <ide> * @author Rick Evans <add> * @author Stephane Nicoll <ide> */ <del>public final class OrderComparatorTests extends TestCase { <del> <del> private Comparator comparator; <del> <del> <del> @Override <del> protected void setUp() throws Exception { <del> this.comparator = new OrderComparator(); <del> } <add>public final class OrderComparatorTests { <ide> <add> private final OrderComparator comparator = new OrderComparator(); <ide> <del> public void testCompareOrderedInstancesBefore() throws Exception { <add> @Test <add> public void compareOrderedInstancesBefore() { <ide> assertEquals(-1, this.comparator.compare( <ide> new StubOrdered(100), new StubOrdered(2000))); <ide> } <ide> <del> public void testCompareOrderedInstancesSame() throws Exception { <add> @Test <add> public void compareOrderedInstancesSame() { <ide> assertEquals(0, this.comparator.compare( <ide> new StubOrdered(100), new StubOrdered(100))); <ide> } <ide> <del> public void testCompareOrderedInstancesAfter() throws Exception { <add> @Test <add> public void compareOrderedInstancesAfter() { <ide> assertEquals(1, this.comparator.compare( <ide> new StubOrdered(982300), new StubOrdered(100))); <ide> } <ide> <del> public void testCompareTwoNonOrderedInstancesEndsUpAsSame() throws Exception { <add> @Test <add> public void compareTwoNonOrderedInstancesEndsUpAsSame() { <ide> assertEquals(0, this.comparator.compare(new Object(), new Object())); <ide> } <ide> <add> @Test <add> public void compareWithSimpleSourceProvider() { <add> Comparator<Object> customComparator = this.comparator.withSourceProvider( <add> new TestSourceProvider(5L, new StubOrdered(25))); <add> assertEquals(-1, customComparator.compare(new StubOrdered(10), 5L)); <add> } <add> <add> @Test <add> public void compareWithSourceProviderArray() { <add> Comparator<Object> customComparator = this.comparator.withSourceProvider( <add> new TestSourceProvider(5L, new Object[] {new StubOrdered(10), new StubOrdered(-25)})); <add> assertEquals(-1, customComparator.compare(5L, new Object())); <add> } <add> <add> @Test <add> public void compareWithSourceProviderArrayNoMatch() { <add> Comparator<Object> customComparator = this.comparator.withSourceProvider( <add> new TestSourceProvider(5L, new Object[]{new Object(), new Object()})); <add> assertEquals(0, customComparator.compare(new Object(), 5L)); <add> } <add> <add> @Test <add> public void compareWithSourceProviderEmpty() { <add> Comparator<Object> customComparator = this.comparator.withSourceProvider( <add> new TestSourceProvider(50L, new Object())); <add> assertEquals(0, customComparator.compare(new Object(), 5L)); <add> } <add> <add> <add> private static final class TestSourceProvider implements OrderComparator.OrderSourceProvider { <add> <add> private final Object target; <add> private final Object orderSource; <add> <add> public TestSourceProvider(Object target, Object orderSource) { <add> this.target = target; <add> this.orderSource = orderSource; <add> } <add> <add> @Override <add> public Object getOrderSource(Object obj) { <add> if (target.equals(obj)) { <add> return orderSource; <add> } <add> return null; <add> } <add> } <ide> <ide> private static final class StubOrdered implements Ordered { <ide>
4
Javascript
Javascript
add a disclaimer to internal invariants
ac76c95fbc70d486e5619fcfa813d742c559a902
<ide><path>src/renderers/shared/fiber/ReactChildFiber.js <ide> if (__DEV__) { <ide> } <ide> invariant( <ide> typeof child._store === 'object', <del> 'React Component in warnForMissingKey should have a _store', <add> 'React Component in warnForMissingKey should have a _store. ' + <add> 'This error is likely caused by a bug in React. Please file an issue.', <ide> ); <ide> child._store.validated = true; <ide> <ide><path>src/renderers/shared/fiber/ReactFiberContext.js <ide> exports.pushTopLevelContextObject = function( <ide> ): void { <ide> invariant( <ide> contextStackCursor.cursor == null, <del> 'Unexpected context found on stack', <add> 'Unexpected context found on stack. ' + <add> 'This error is likely caused by a bug in React. Please file an issue.', <ide> ); <ide> <ide> push(contextStackCursor, context, fiber); <ide> exports.pushContextProvider = function(workInProgress: Fiber): boolean { <ide> <ide> exports.invalidateContextProvider = function(workInProgress: Fiber): void { <ide> const instance = workInProgress.stateNode; <del> invariant(instance, 'Expected to have an instance by this point.'); <add> invariant( <add> instance, <add> 'Expected to have an instance by this point. ' + <add> 'This error is likely caused by a bug in React. Please file an issue.', <add> ); <ide> <ide> // Merge parent and own context. <ide> const mergedContext = processChildContext( <ide> exports.findCurrentUnmaskedContext = function(fiber: Fiber): Object { <ide> // makes sense elsewhere <ide> invariant( <ide> isFiberMounted(fiber) && fiber.tag === ClassComponent, <del> 'Expected subtree parent to be a mounted class component', <add> 'Expected subtree parent to be a mounted class component. ' + <add> 'This error is likely caused by a bug in React. Please file an issue.', <ide> ); <ide> <ide> let node: Fiber = fiber; <ide> exports.findCurrentUnmaskedContext = function(fiber: Fiber): Object { <ide> return node.stateNode.__reactInternalMemoizedMergedChildContext; <ide> } <ide> const parent = node.return; <del> invariant(parent, 'Found unexpected detached subtree parent'); <add> invariant( <add> parent, <add> 'Found unexpected detached subtree parent. ' + <add> 'This error is likely caused by a bug in React. Please file an issue.', <add> ); <ide> node = parent; <ide> } <ide> return node.stateNode.context; <ide><path>src/renderers/shared/fiber/ReactFiberHydrationContext.js <ide> module.exports = function<T, P, I, TI, PI, C, CX, PL>( <ide> resetHydrationState() {}, <ide> tryToClaimNextHydratableInstance() {}, <ide> prepareToHydrateHostInstance() { <del> invariant(false, 'React bug.'); <add> invariant( <add> false, <add> 'Expected prepareToHydrateHostInstance() to never be called. ' + <add> 'This error is likely caused by a bug in React. Please file an issue.', <add> ); <ide> }, <ide> prepareToHydrateHostTextInstance() { <del> invariant(false, 'React bug.'); <add> invariant( <add> false, <add> 'Expected prepareToHydrateHostTextInstance() to never be called. ' + <add> 'This error is likely caused by a bug in React. Please file an issue.', <add> ); <ide> }, <ide> popHydrationState(fiber: Fiber) { <ide> return false; <ide><path>src/renderers/shared/fiber/ReactFiberScheduler.js <ide> module.exports = function<T, P, I, TI, PI, C, CX, PL>( <ide> // No work left. We can exit. <ide> break loop; <ide> default: <del> invariant(false, 'Switch statement should be exhuastive.'); <add> invariant( <add> false, <add> 'Switch statement should be exhuastive. ' + <add> 'This error is likely caused by a bug in React. Please file an issue.', <add> ); <ide> } <ide> } while (true); <ide> } <ide><path>src/renderers/shared/fiber/ReactFiberTreeReflection.js <ide> function findCurrentFiberUsingSlowPath(fiber: Fiber): Fiber | null { <ide> invariant( <ide> didFindChild, <ide> 'Child was not found in either parent set. This indicates a bug ' + <del> 'related to the return pointer.', <add> 'in React related to the return pointer. Please file an issue.', <ide> ); <ide> } <ide> } <ide> <ide> invariant( <ide> a.alternate === b, <del> "Return fibers should always be each others' alternates.", <add> "Return fibers should always be each others' alternates. " + <add> 'This error is likely caused by a bug in React. Please file an issue.', <ide> ); <ide> } <ide> // If the root is not a host container, we're in a disconnected tree. I.e. <ide><path>src/renderers/shared/server/ReactPartialRenderer.js <ide> function createOpenTagMarkup( <ide> <ide> function resolve(child, context) { <ide> // TODO: We'll need to support Arrays (and strings) after Fiber is rolled out <del> invariant(!Array.isArray(child), 'Did not expect to receive an Array child'); <add> invariant( <add> !Array.isArray(child), <add> 'The server renderer does not implement support for array children yet.', <add> ); <ide> while (React.isValidElement(child)) { <ide> if (__DEV__) { <ide> pushElementToDebugStack(child); <ide><path>src/renderers/shared/shared/event/ReactControlledComponent.js <ide> function restoreStateOfTarget(target) { <ide> fiberHostComponent && <ide> typeof fiberHostComponent.restoreControlledState === 'function', <ide> 'Fiber needs to be injected to handle a fiber target for controlled ' + <del> 'events.', <add> 'events. This error is likely caused by a bug in React. Please file an issue.', <ide> ); <ide> const props = EventPluginUtils.getFiberCurrentPropsFromNode( <ide> internalInstance.stateNode, <ide> function restoreStateOfTarget(target) { <ide> } <ide> invariant( <ide> typeof internalInstance.restoreControlledState === 'function', <del> 'The internal instance must be a React host component.', <add> 'The internal instance must be a React host component. ' + <add> 'This error is likely caused by a bug in React. Please file an issue.', <ide> ); <ide> // If it is not a Fiber, we can just use dynamic dispatch. <ide> internalInstance.restoreControlledState();
7
Go
Go
update withinitsignature to be a daemon.option
f60d6ee4bc742ff12ff295507e73d24407b64fba
<ide><path>integration/service/create_test.go <ide> func testServiceCreateInit(daemonEnabled bool) func(t *testing.T) { <ide> var ops = []daemon.Option{} <ide> <ide> if daemonEnabled { <del> ops = append(ops, daemon.WithInit) <add> ops = append(ops, daemon.WithInit()) <ide> } <ide> d := swarm.NewSwarm(t, testEnv, ops...) <ide> defer d.Stop(t) <ide><path>testutil/daemon/ops.go <ide> func WithExperimental() Option { <ide> } <ide> <ide> // WithInit sets the daemon init <del>func WithInit(d *Daemon) { <del> d.init = true <add>func WithInit() Option { <add> return func(d *Daemon) { <add> d.init = true <add> } <ide> } <ide> <ide> // WithDockerdBinary sets the dockerd binary to the specified one
2
Javascript
Javascript
generate header ids for better linking
e8cc85f733a49ca53e8cda5a96bbaacc9a20ac7e
<ide><path>docs/spec/domSpec.js <ide> var DOM = require('../src/dom.js').DOM; <add>var normalizeHeaderToId = require('../src/dom.js').normalizeHeaderToId; <ide> <ide> describe('dom', function() { <ide> var dom; <ide> describe('dom', function() { <ide> dom = new DOM(); <ide> }); <ide> <add> describe('html', function() { <add> it('should add ids to all h tags', function() { <add> dom.html('<h1>Some Header</h1>'); <add> expect(dom.toString()).toContain('<h1 id="some-header">Some Header</h1>'); <add> }); <add> <add> it('should collect <a name> anchors too', function() { <add> dom.html('<h2>Xxx <a name="foo"></a> and bar <a name="bar"></a>'); <add> expect(dom.anchors).toContain('foo'); <add> expect(dom.anchors).toContain('bar'); <add> }) <add> }); <add> <add> it('should collect h tag ids', function() { <add> dom.h('Page Title', function() { <add> dom.html('<h1>Second</h1>xxx <h2>Third</h2>'); <add> dom.h('Another Header', function() {}); <add> }); <add> <add> expect(dom.anchors).toContain('page-title'); <add> expect(dom.anchors).toContain('second'); <add> expect(dom.anchors).toContain('second_third'); <add> expect(dom.anchors).toContain('another-header'); <add> }); <add> <ide> describe('h', function() { <ide> <ide> it('should render using function', function() { <ide> describe('dom', function() { <ide> this.html('<h1>sub-heading</h1>'); <ide> }); <ide> expect(dom.toString()).toContain('<h1 id="heading">heading</h1>'); <del> expect(dom.toString()).toContain('<h2>sub-heading</h2>'); <add> expect(dom.toString()).toContain('<h2 id="sub-heading">sub-heading</h2>'); <ide> }); <ide> <ide> it('should properly number nested headings', function() { <ide> describe('dom', function() { <ide> <ide> expect(dom.toString()).toContain('<h1 id="heading">heading</h1>'); <ide> expect(dom.toString()).toContain('<h2 id="heading2">heading2</h2>'); <del> expect(dom.toString()).toContain('<h3>heading3</h3>'); <add> expect(dom.toString()).toContain('<h3 id="heading2_heading3">heading3</h3>'); <ide> <ide> expect(dom.toString()).toContain('<h1 id="other1">other1</h1>'); <del> expect(dom.toString()).toContain('<h2>other2</h2>'); <add> expect(dom.toString()).toContain('<h2 id="other2">other2</h2>'); <add> }); <add> <add> <add> it('should add nested ids to all h tags', function() { <add> dom.h('Page Title', function() { <add> dom.h('Second', function() { <add> dom.html('some <h1>Third</h1>'); <add> }); <add> }); <add> <add> var resultingHtml = dom.toString(); <add> expect(resultingHtml).toContain('<h1 id="page-title">Page Title</h1>'); <add> expect(resultingHtml).toContain('<h2 id="second">Second</h2>'); <add> expect(resultingHtml).toContain('<h3 id="second_third">Third</h3>'); <add> }); <add> <add> }); <add> <add> <add> describe('normalizeHeaderToId', function() { <add> it('should ignore content in the parenthesis', function() { <add> expect(normalizeHeaderToId('One (more)')).toBe('one'); <add> }); <add> <add> it('should ignore html content', function() { <add> expect(normalizeHeaderToId('Section <a name="section"></a>')).toBe('section'); <ide> }); <ide> <add> it('should ignore special characters', function() { <add> expect(normalizeHeaderToId('Section \'!?')).toBe('section'); <add> }); <add> <add> it('should ignore html entities', function() { <add> expect(normalizeHeaderToId('angular&#39;s-jqlite')).toBe('angulars-jqlite'); <add> }); <ide> }); <ide> <ide> }); <ide><path>docs/spec/ngdocSpec.js <ide> describe('ngdoc', function() { <ide> expect(docs[0].events).toEqual([eventA, eventB]); <ide> expect(docs[0].properties).toEqual([propA, propB]); <ide> }); <add> }); <ide> <ide> <add> describe('checkBrokenLinks', function() { <add> var docs; <ide> <del> describe('links checking', function() { <del> var docs; <del> beforeEach(function() { <del> spyOn(console, 'log'); <del> docs = [new Doc({section: 'api', id: 'fake.id1', links: ['non-existing-link']}), <del> new Doc({section: 'api', id: 'fake.id2'}), <del> new Doc({section: 'api', id: 'fake.id3'})]; <del> }); <del> <del> it('should log warning when any link doesn\'t exist', function() { <del> ngdoc.merge(docs); <del> expect(console.log).toHaveBeenCalled(); <del> expect(console.log.argsForCall[0][0]).toContain('WARNING:'); <del> }); <add> beforeEach(function() { <add> spyOn(console, 'log'); <add> docs = [new Doc({section: 'api', id: 'fake.id1', anchors: ['one']}), <add> new Doc({section: 'api', id: 'fake.id2'}), <add> new Doc({section: 'api', id: 'fake.id3'})]; <add> }); <ide> <del> it('should say which link doesn\'t exist', function() { <del> ngdoc.merge(docs); <del> expect(console.log.argsForCall[0][0]).toContain('non-existing-link'); <del> }); <add> it('should log warning when a linked page does not exist', function() { <add> docs.push(new Doc({section: 'api', id: 'with-broken.link', links: ['non-existing-link']})) <add> ngdoc.checkBrokenLinks(docs); <add> expect(console.log).toHaveBeenCalled(); <add> var warningMsg = console.log.argsForCall[0][0] <add> expect(warningMsg).toContain('WARNING:'); <add> expect(warningMsg).toContain('non-existing-link'); <add> expect(warningMsg).toContain('api/with-broken.link'); <add> }); <ide> <del> it('should say where is the non-existing link', function() { <del> ngdoc.merge(docs); <del> expect(console.log.argsForCall[0][0]).toContain('api/fake.id1'); <del> }); <add> it('should log warning when a linked anchor does not exist', function() { <add> docs.push(new Doc({section: 'api', id: 'with-broken.link', links: ['api/fake.id1#non-existing']})) <add> ngdoc.checkBrokenLinks(docs); <add> expect(console.log).toHaveBeenCalled(); <add> var warningMsg = console.log.argsForCall[0][0] <add> expect(warningMsg).toContain('WARNING:'); <add> expect(warningMsg).toContain('non-existing'); <add> expect(warningMsg).toContain('api/with-broken.link'); <ide> }); <ide> }); <ide> <ide> describe('ngdoc', function() { <ide> doc.ngdoc = 'filter'; <ide> doc.parse(); <ide> expect(doc.html()).toContain( <del> '<h3 id="Animations">Animations</h3>\n' + <add> '<h3 id="usage_animations">Animations</h3>\n' + <ide> '<div class="animations">' + <ide> '<ul>' + <ide> '<li>enter - Add text</li>' + <ide> describe('ngdoc', function() { <ide> var doc = new Doc('@ngdoc overview\n@name angular\n@description\n#heading\ntext'); <ide> doc.parse(); <ide> expect(doc.html()).toContain('text'); <del> expect(doc.html()).toContain('<h2>heading</h2>'); <add> expect(doc.html()).toContain('<h2 id="heading">heading</h2>'); <ide> expect(doc.html()).not.toContain('Description'); <ide> }); <ide> }); <ide><path>docs/src/dom.js <ide> <ide> exports.DOM = DOM; <ide> exports.htmlEscape = htmlEscape; <add>exports.normalizeHeaderToId = normalizeHeaderToId; <ide> <ide> ////////////////////////////////////////////////////////// <ide> <ide> function htmlEscape(text){ <ide> .replace(/\}\}/g, '<span>}}</span>'); <ide> } <ide> <add>function nonEmpty(header) { <add> return !!header; <add>} <add> <add>function idFromCurrentHeaders(headers) { <add> if (headers.length === 1) return headers[0]; <add> // Do not include the first level title, as that's the title of the page. <add> return headers.slice(1).filter(nonEmpty).join('_'); <add>} <add> <add>function normalizeHeaderToId(header) { <add> if (typeof header !== 'string') { <add> return ''; <add> } <add> <add> return header.toLowerCase() <add> .replace(/<.*>/g, '') // html tags <add> .replace(/[\!\?\:\.\']/g, '') // special characters <add> .replace(/&#\d\d;/g, '') // html entities <add> .replace(/\(.*\)/mg, '') // stuff in parenthesis <add> .replace(/\s$/, '') // trailing spaces <add> .replace(/\s+/g, '-'); // replace whitespaces with dashes <add>} <add> <ide> <ide> function DOM() { <ide> this.out = []; <ide> this.headingDepth = 0; <add> this.currentHeaders = []; <add> this.anchors = []; <ide> } <ide> <ide> var INLINE_TAGS = { <ide> DOM.prototype = { <ide> }, <ide> <ide> html: function(html) { <del> if (html) { <del> var headingDepth = this.headingDepth; <del> for ( var i = 10; i > 0; --i) { <del> html = html <del> .replace(new RegExp('<h' + i + '(.*?)>([\\s\\S]+)<\/h' + i +'>', 'gm'), function(_, attrs, content){ <del> var tag = 'h' + (i + headingDepth); <del> return '<' + tag + attrs + '>' + content + '</' + tag + '>'; <del> }); <del> } <del> this.out.push(html); <del> } <add> if (!html) return; <add> <add> var self = this; <add> // rewrite header levels, add ids and collect the ids <add> html = html.replace(/<h(\d)(.*?)>([\s\S]+?)<\/h\1>/gm, function(_, level, attrs, content) { <add> level = parseInt(level, 10) + self.headingDepth; // change header level based on the context <add> <add> self.currentHeaders[level - 1] = normalizeHeaderToId(content); <add> self.currentHeaders.length = level; <add> <add> var id = idFromCurrentHeaders(self.currentHeaders); <add> self.anchors.push(id); <add> return '<h' + level + attrs + ' id="' + id + '">' + content + '</h' + level + '>'; <add> }); <add> <add> // collect anchors <add> html = html.replace(/<a name="(\w*)">/g, function(match, anchor) { <add> self.anchors.push(anchor); <add> return match; <add> }); <add> <add> this.out.push(html); <ide> }, <ide> <ide> tag: function(name, attr, text) { <ide> DOM.prototype = { <ide> <ide> h: function(heading, content, fn){ <ide> if (content==undefined || (content instanceof Array && content.length == 0)) return; <add> <ide> this.headingDepth++; <add> this.currentHeaders[this.headingDepth - 1] = normalizeHeaderToId(heading); <add> this.currentHeaders.length = this.headingDepth; <add> <ide> var className = null, <ide> anchor = null; <ide> if (typeof heading == 'string') { <del> var id = heading. <del> replace(/\(.*\)/mg, ''). <del> replace(/[^\d\w\$]/mg, '.'). <del> replace(/-+/gm, '-'). <del> replace(/-*$/gm, ''); <add> var id = idFromCurrentHeaders(this.currentHeaders); <add> this.anchors.push(id); <ide> anchor = {'id': id}; <del> var classNameValue = id.toLowerCase().replace(/[._]/mg, '-'); <add> var classNameValue = this.currentHeaders[this.headingDepth - 1] <ide> if(classNameValue == 'hide') classNameValue = ''; <ide> className = {'class': classNameValue}; <ide> } <ide><path>docs/src/gen-docs.js <ide> writer.makeDir('build/docs/', true).then(function() { <ide> fileFutures.push(writer.output('partials/' + doc.section + '/' + id + '.html', doc.html())); <ide> }); <ide> <add> ngdoc.checkBrokenLinks(docs); <add> <ide> writeTheRest(fileFutures); <ide> <ide> return Q.deep(fileFutures); <ide><path>docs/src/ngdoc.js <ide> exports.trim = trim; <ide> exports.metadata = metadata; <ide> exports.scenarios = scenarios; <ide> exports.merge = merge; <add>exports.checkBrokenLinks = checkBrokenLinks; <ide> exports.Doc = Doc; <ide> <ide> exports.ngVersions = function() { <ide> function Doc(text, file, line) { <ide> this.methods = this.methods || []; <ide> this.events = this.events || []; <ide> this.links = this.links || []; <add> this.anchors = this.anchors || []; <ide> } <ide> Doc.METADATA_IGNORE = (function() { <ide> var words = fs.readFileSync(__dirname + '/ignore.words', 'utf8'); <ide> Doc.prototype = { <ide> * @returns {string} Absolute url <ide> */ <ide> convertUrlToAbsolute: function(url) { <add> var hashIdx = url.indexOf('#'); <add> <add> // Lowercase hash parts of the links, <add> // so that we can keep correct API names even when the urls are lowercased. <add> if (hashIdx !== -1) { <add> url = url.substr(0, hashIdx) + url.substr(hashIdx).toLowerCase(); <add> } <add> <ide> if (url.substr(-1) == '/') return url + 'index'; <ide> if (url.match(/\//)) return url; <ide> return this.section + '/' + url; <ide> Doc.prototype = { <ide> dom.h('Example', self.example, dom.html); <ide> }); <ide> <add> self.anchors = dom.anchors; <add> <ide> return dom.toString(); <ide> <ide> ////////////////////////// <ide> Doc.prototype = { <ide> dom.html('<a href="api/ngAnimate.$animate">Click here</a> to learn more about the steps involved in the animation.'); <ide> } <ide> if(params.length > 0) { <del> dom.html('<h2 id="parameters">Parameters</h2>'); <add> dom.html('<h2>Parameters</h2>'); <ide> dom.html('<table class="variables-matrix table table-bordered table-striped">'); <ide> dom.html('<thead>'); <ide> dom.html('<tr>'); <ide> Doc.prototype = { <ide> html_usage_returns: function(dom) { <ide> var self = this; <ide> if (self.returns) { <del> dom.html('<h2 id="returns">Returns</h2>'); <add> dom.html('<h2>Returns</h2>'); <ide> dom.html('<table class="variables-matrix">'); <ide> dom.html('<tr>'); <ide> dom.html('<td>'); <ide> function merge(docs){ <ide> }); <ide> <ide> for(var i = 0; i < docs.length;) { <del> var doc = docs[i]; <del> <del> // check links - do they exist ? <del> doc.links.forEach(function(link) { <del> // convert #id to path#id <del> if (link[0] == '#') { <del> link = doc.section + '/' + doc.id.split('#').shift() + link; <del> } <del> link = link.split('#').shift(); <del> if (!byFullId[link]) { <del> console.log('WARNING: In ' + doc.section + '/' + doc.id + ', non existing link: "' + link + '"'); <del> } <del> }); <del> <del> // merge into parents <del> if (findParent(doc, 'method') || findParent(doc, 'property') || findParent(doc, 'event')) { <add> if (findParent(docs[i], 'method') || findParent(docs[i], 'property') || findParent(docs[i], 'event')) { <ide> docs.splice(i, 1); <ide> } else { <ide> i++; <ide> function merge(docs){ <ide> } <ide> ////////////////////////////////////////////////////////// <ide> <add> <add>function checkBrokenLinks(docs) { <add> var byFullId = Object.create(null); <add> <add> docs.forEach(function(doc) { <add> byFullId[doc.section + '/' + doc.id] = doc; <add> }); <add> <add> docs.forEach(function(doc) { <add> doc.links.forEach(function(link) { <add> // convert #id to path#id <add> if (link[0] == '#') { <add> link = doc.section + '/' + doc.id.split('#').shift() + link; <add> } <add> <add> var parts = link.split('#'); <add> var pageLink = parts[0]; <add> var anchorLink = parts[1]; <add> var linkedPage = byFullId[pageLink]; <add> <add> if (!linkedPage) { <add> console.log('WARNING: ' + doc.section + '/' + doc.id + ' (defined in ' + doc.file + ') points to a non existing page "' + link + '"!'); <add> } else if (anchorLink && linkedPage.anchors.indexOf(anchorLink) === -1) { <add> console.log('WARNING: ' + doc.section + '/' + doc.id + ' (defined in ' + doc.file + ') points to a non existing anchor "' + link + '"!'); <add> } <add> }); <add> }); <add>} <add> <add> <ide> function property(name) { <ide> return function(value){ <ide> return value[name];
5
Ruby
Ruby
fix apr formula by aliasing deparallelize to j1
ce3b7c982646ab6859e99e78b18ed69a772f9265
<ide><path>Library/Homebrew/brewkit.rb <ide> module HomebrewEnvExtension <ide> def deparallelize <ide> remove 'MAKEFLAGS', /-j\d+/ <ide> end <add> alias_method :j1, :deparallelize <ide> def gcc_4_0_1 <ide> case MACOS_VERSION <ide> when 10.5
1
Java
Java
update copyright date
91441ba653de8dcced776bdb979a98bd0e223365
<ide><path>spring-test/src/main/java/org/springframework/test/context/ContextConfiguration.java <ide> /* <del> * Copyright 2002-2020 the original author or authors. <add> * Copyright 2002-2022 the original author or authors. <ide> * <ide> * Licensed under the Apache License, Version 2.0 (the "License"); <ide> * you may not use this file except in compliance with the License.
1
Ruby
Ruby
add signatures for `dev-cmd/unbottled`
749199632b2e5824d6c5d09c7bc83b856c13d273
<ide><path>Library/Homebrew/dev-cmd/unbottled.rb <ide> def unbottled <ide> <ide> Formulary.enable_factory_cache! <ide> <del> @bottle_tag = if args.tag.present? <del> args.tag.to_sym <del> else <del> Utils::Bottles.tag <del> end <add> @bottle_tag = args.tag.presence&.to_sym || Utils::Bottles.tag <ide> <ide> if args.named.blank? <ide> ohai "Getting formulae..."
1
Text
Text
update doc writing guide
6292532fd154e0b51b81f9066e86f500ade63c79
<ide><path>docs/README.md <ide> check how they look like before committing for instance). You don't have to comm <ide> ## Building the documentation <ide> <ide> Once you have setup the `doc-builder` and additional packages, you can generate the documentation by typing th <del>folowwing command: <add>following command: <ide> <ide> ```bash <ide> doc-builder build transformers docs/source/ --build_dir ~/tmp/test-build <ide> Markdown editor. <ide> --- <ide> **NOTE** <ide> <del>It's not possible to see locally how the final documentation will look like for now. We are working on solutions to <del>enable this, but any pre-visualiser of Markdown file should already give you a good idea of the result! <add>It's not possible to see locally how the final documentation will look like for now. Once you have opened a PR, you <add>will see a bot add a comment to a link where the documentation with your changes lives. <ide> <ide> --- <ide> <ide> ## Adding a new element to the navigation bar <ide> <del>Accepted files are reStructuredText (.rst) and Markdown (.md or .mdx). We are progressively moving away from rst so you should <del>create any new documentation file in the .mdx format. <add>Accepted files are Markdown (.md or .mdx). <ide> <ide> Create a file with its extension and put it in the source directory. You can then link it to the toc-tree by putting <ide> the filename without the extension in the [`_toctree.yml`](https://github.com/huggingface/transformers/blob/master/docs/source/_toctree.yml) file. <ide> Use the relative style to link to the new file so that the versioned docs contin <ide> For an example of a rich moved sections set please see the very end of [the Trainer doc](https://github.com/huggingface/transformers/blob/master/docs/source/main_classes/trainer.mdx). <ide> <ide> <del>## Preview the documentation in a pull request <del> <del>Coming soon! <del> <ide> ## Writing Documentation - Specification <ide> <ide> The `huggingface/transformers` documentation follows the <ide> [Google documentation](https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html) style for docstrings, <del>although we can write them directly in Markdown. Parts of it are written in ReStructuredText <del>([Sphinx simple documentation](https://www.sphinx-doc.org/en/master/usage/restructuredtext/index.html) but we are <del>updating those. <add>although we can write them directly in Markdown. <ide> <ide> ### Adding a new tutorial <ide> <ide> When adding a new model: <ide> - PyTorch head models <ide> - TensorFlow base model <ide> - TensorFlow head models <add> - Flax base model <add> - Flax head models <ide> <ide> These classes should be added using our Markdown syntax. Usually as follows: <ide> <ide> function to be in the main package. <ide> If you want to create a link to some internal class or function, you need to <ide> provide its path. For instance: \[\`file_utils.ModelOutput\`\]. This will be converted into a link with <ide> `file_utils.ModelOutput` in the description. To get rid of the path and only keep the name of the object you are <del>linking to, add a ~: \[\`~file_utils.ModelOutput\`\] will generate a link with `ModelOutput` in the description. <add>linking to in the description, add a ~: \[\`~file_utils.ModelOutput\`\] will generate a link with `ModelOutput` in the description. <ide> <ide> The same wroks for methods so you can either use \[\`XXXClass.method\`\] or \[~\`XXXClass.method\`\]. <ide> <ide> them by URL. We recommend putting them in the following dataset: [huggingface/do <ide> If an external contribution, feel free to add the images to your PR and ask a Hugging Face member to migrate your images <ide> to this dataset. <ide> <add>## Styling the docstring <add> <add>We have an automatic script running with the `make style` comment that will make sure that: <add>- the docstrings fully take advantage of the line width <add>- all code examples are formatted using black, like the code of the Transformers library <add> <add>This script may have some weird failures if you made a syntax mistake or if you uncover a bug. Therefore, it's <add>recommended to commit your changes before running `make style`, so you can revert the changes done by that script <add>easily.
1
Go
Go
fix flakey test for log file rotate
5ea5c02c887392be1560e559a3c4d53445cf6505
<ide><path>daemon/logger/loggerutils/logfile_test.go <ide> import ( <ide> "io" <ide> "io/ioutil" <ide> "os" <add> "path/filepath" <ide> "strings" <ide> "testing" <ide> "time" <ide> import ( <ide> "github.com/docker/docker/pkg/pubsub" <ide> "github.com/docker/docker/pkg/tailfile" <ide> "gotest.tools/v3/assert" <add> "gotest.tools/v3/poll" <ide> ) <ide> <ide> type testDecoder struct { <ide> func TestCheckCapacityAndRotate(t *testing.T) { <ide> defer l.Close() <ide> <ide> assert.NilError(t, l.WriteLogEntry(&logger.Message{Line: []byte("hello world!")})) <del> <del> dStringer := dirStringer{dir} <del> <ide> _, err = os.Stat(f.Name() + ".1") <del> assert.Assert(t, os.IsNotExist(err), dStringer) <add> assert.Assert(t, os.IsNotExist(err), dirStringer{dir}) <ide> <ide> assert.NilError(t, l.WriteLogEntry(&logger.Message{Line: []byte("hello world!")})) <del> _, err = os.Stat(f.Name() + ".1") <del> assert.NilError(t, err, dStringer) <add> poll.WaitOn(t, checkFileExists(f.Name()+".1"), poll.WithTimeout(30*time.Second)) <ide> <ide> assert.NilError(t, l.WriteLogEntry(&logger.Message{Line: []byte("hello world!")})) <del> _, err = os.Stat(f.Name() + ".1") <del> assert.NilError(t, err, dStringer) <del> _, err = os.Stat(f.Name() + ".2.gz") <del> assert.NilError(t, err, dStringer) <add> poll.WaitOn(t, checkFileExists(f.Name()+".1"), poll.WithTimeout(30*time.Second)) <add> poll.WaitOn(t, checkFileExists(f.Name()+".2.gz"), poll.WithTimeout(30*time.Second)) <ide> <ide> // Now let's simulate a failed rotation where the file was able to be closed but something else happened elsewhere <ide> // down the line. <ide> func (d dirStringer) String() string { <ide> } <ide> return s.String() <ide> } <add> <add>func checkFileExists(name string) poll.Check { <add> return func(t poll.LogT) poll.Result { <add> _, err := os.Stat(name) <add> switch { <add> case err == nil: <add> return poll.Success() <add> case os.IsNotExist(err): <add> return poll.Continue("waiting for %s to exist", name) <add> default: <add> t.Logf("%s", dirStringer{filepath.Dir(name)}) <add> return poll.Error(err) <add> } <add> } <add>}
1
Ruby
Ruby
pluralize formulae in tap/untap
8d44db6b40f649e292292d9e164b7aa769d635c7
<ide><path>Library/Homebrew/cmd/tap.rb <ide> def install_tap user, repo <ide> files = [] <ide> tapd.find_formula { |file| files << file } <ide> link_tap_formula(files) <del> puts "Tapped #{files.length} formula" <add> puts "Tapped #{files.length} formula#{plural(files.length, 'e')}" <ide> <ide> if private_tap?(repouser, repo) then puts <<-EOS.undent <ide> It looks like you tapped a private repository. To avoid entering your <ide> def repair_taps <ide> count += 1 <ide> end <ide> end <del> puts "Pruned #{count} dead formula" <add> puts "Pruned #{count} dead formula#{plural(count, 'e')}" <ide> <ide> return unless HOMEBREW_REPOSITORY.join("Library/Taps").exist? <ide> <ide> def repair_taps <ide> count += link_tap_formula(files) <ide> end <ide> <del> puts "Tapped #{count} formula" <add> puts "Tapped #{count} formula#{plural(count, 'e')}" <ide> end <ide> <ide> private <ide><path>Library/Homebrew/cmd/untap.rb <ide> def untap <ide> unlink_tap_formula(files) <ide> tapd.rmtree <ide> tapd.dirname.rmdir_if_possible <del> puts "Untapped #{files.length} formula" <add> puts "Untapped #{files.length} formula#{plural(files.length, 'e')}" <ide> end <ide> <ide> def unlink_tap_formula paths <ide><path>Library/Homebrew/cmd/upgrade.rb <ide> require 'cmd/install' <ide> require 'cmd/outdated' <ide> <del>class Fixnum <del> def plural_s <del> if self != 1 then "s" else "" end <del> end <del>end <del> <ide> module Homebrew extend self <ide> def upgrade <ide> Homebrew.perform_preinstall_checks <ide> def upgrade <ide> end <ide> <ide> unless outdated.empty? <del> oh1 "Upgrading #{outdated.length} outdated package#{outdated.length.plural_s}, with result:" <add> oh1 "Upgrading #{outdated.length} outdated package#{plural(outdated.length)}, with result:" <ide> puts outdated.map{ |f| "#{f.name} #{f.pkg_version}" } * ", " <ide> else <ide> oh1 "No packages to upgrade" <ide> end <ide> <ide> unless upgrade_pinned? || pinned.empty? <del> oh1 "Not upgrading #{pinned.length} pinned package#{pinned.length.plural_s}:" <add> oh1 "Not upgrading #{pinned.length} pinned package#{plural(pinned.length)}:" <ide> puts pinned.map{ |f| "#{f.name} #{f.pkg_version}" } * ", " <ide> end <ide> <ide><path>Library/Homebrew/utils.rb <ide> def pretty_duration s <ide> return "%.1f minutes" % (s/60) <ide> end <ide> <add>def plural n, s="s" <add> (n == 1) ? "" : s <add>end <add> <ide> def interactive_shell f=nil <ide> unless f.nil? <ide> ENV['HOMEBREW_DEBUG_PREFIX'] = f.prefix
4