content_type
stringclasses
8 values
main_lang
stringclasses
7 values
message
stringlengths
1
50
sha
stringlengths
40
40
patch
stringlengths
52
962k
file_count
int64
1
300
Javascript
Javascript
remove fixdefaultchecked helper
a10dd521df44032065b95c482f8aee1f5d505375
<ide><path>src/manipulation.js <ide> function getAll( context, tag ) { <ide> <ide> if ( !ret ) { <ide> for ( ret = [], elems = context.childNodes || context; (elem = elems[ i ]) != null; i++ ) { <del> core_push.apply( ret, <del> !tag || jQuery.nodeName( elem, tag ) ? <add> core_push.apply( ret, !tag || jQuery.nodeName( elem, tag ) ? <ide> getAll( elem, tag ) : <ide> elems ); <ide> } <ide> function getAll( context, tag ) { <ide> ret; <ide> } <ide> <del>// Used in clean, fixes the defaultChecked property <del>function fixDefaultChecked( elem ) { <del> if ( manipulation_rcheckableType.test( elem.type ) ) { <del> elem.defaultChecked = elem.checked; <del> } <del>} <del> <ide> jQuery.extend({ <ide> clone: function( elem, dataAndEvents, deepDataAndEvents ) { <ide> var destElements, srcElements, node, i, <ide> jQuery.extend({ <ide> container.removeChild( tmp ); <ide> } <ide> <del> // Reset defaultChecked for any radios and checkboxes <del> // about to be appended to the DOM in IE 6/7 (#8060) <del> if ( !jQuery.support.appendChecked ) { <del> jQuery.grep( getAll( ret, "input" ), fixDefaultChecked ); <del> } <del> <ide> if ( fragment ) { <ide> for ( i = 0; (elem = ret[ i ]) != null; i++ ) { <ide> container = jQuery.contains( elem.ownerDocument, elem );
1
Ruby
Ruby
remove deprecated scope stuff
e1a83690da3dc8e72638a71cf6751986338b4596
<ide><path>activerecord/test/cases/named_scope_test.rb <ide> def test_procedural_scopes_returning_nil <ide> assert_equal all_topics, Topic.written_before(nil) <ide> end <ide> <del> def test_scopes_with_joins <del> address = author_addresses(:david_address) <del> posts_with_authors_at_address = Post.find( <del> :all, :joins => 'JOIN authors ON authors.id = posts.author_id', <del> :conditions => [ 'authors.author_address_id = ?', address.id ] <del> ) <del> assert_equal posts_with_authors_at_address, Post.with_authors_at_address(address) <del> end <del> <del> def test_scopes_with_joins_respects_custom_select <del> address = author_addresses(:david_address) <del> posts_with_authors_at_address_titles = Post.find(:all, <del> :select => 'title', <del> :joins => 'JOIN authors ON authors.id = posts.author_id', <del> :conditions => [ 'authors.author_address_id = ?', address.id ] <del> ) <del> assert_equal posts_with_authors_at_address_titles.map(&:title), Post.with_authors_at_address(address).find(:all, :select => 'title').map(&:title) <del> end <del> <ide> def test_scope_with_object <ide> objects = Topic.with_object <ide> assert_operator objects.length, :>, 0 <ide><path>activerecord/test/cases/relations_test.rb <ide> def test_except <ide> assert_equal Post.all, all_posts.all <ide> end <ide> <del> def test_extensions_with_except <del> assert_equal 2, Topic.named_extension.order(:author_name).except(:order).two <del> end <del> <ide> def test_only <ide> relation = Post.where(:author_id => 1).order('id ASC').limit(1) <ide> assert_equal [posts(:welcome)], relation.all <ide> def test_only <ide> assert_equal Post.limit(1).all.first, all_posts.first <ide> end <ide> <del> def test_extensions_with_only <del> assert_equal 2, Topic.named_extension.order(:author_name).only(:order).two <del> end <del> <ide> def test_anonymous_extension <ide> relation = Post.where(:author_id => 1).order('id ASC').extending do <ide> def author <ide> def test_order_with_find_with_order <ide> <ide> def test_default_scope_order_with_scope_order <ide> assert_equal 'zyke', CoolCar.order_using_new_style.limit(1).first.name <del> assert_equal 'zyke', CoolCar.order_using_old_style.limit(1).first.name <ide> assert_equal 'zyke', FastCar.order_using_new_style.limit(1).first.name <del> assert_equal 'zyke', FastCar.order_using_old_style.limit(1).first.name <ide> end <ide> <ide> def test_order_using_scoping <ide> def test_order_using_scoping <ide> <ide> def test_unscoped_block_style <ide> assert_equal 'honda', CoolCar.unscoped { CoolCar.order_using_new_style.limit(1).first.name} <del> assert_equal 'honda', CoolCar.unscoped { CoolCar.order_using_old_style.limit(1).first.name} <del> <ide> assert_equal 'honda', FastCar.unscoped { FastCar.order_using_new_style.limit(1).first.name} <del> assert_equal 'honda', FastCar.unscoped { FastCar.order_using_old_style.limit(1).first.name} <ide> end <ide> <ide> def test_intersection_with_array <ide><path>activerecord/test/models/car.rb <ide> class Car < ActiveRecord::Base <ide> scope :incl_engines, -> { includes(:engines) } <ide> <ide> scope :order_using_new_style, -> { order('name asc') } <del> scope :order_using_old_style, -> { { :order => 'name asc' } } <ide> <ide> end <ide> <ide><path>activerecord/test/models/post.rb <ide> def author <ide> scope :ranked_by_comments, -> { order("comments_count DESC") } <ide> <ide> scope :limit_by, lambda {|l| limit(l) } <del> scope :with_authors_at_address, lambda { |address| { <del> :conditions => [ 'authors.author_address_id = ?', address.id ], <del> :joins => 'JOIN authors ON authors.id = posts.author_id' <del> } <del> } <ide> <ide> belongs_to :author do <ide> def greeting <ide> def first_comment <ide> <ide> scope :with_special_comments, -> { joins(:comments).where(:comments => {:type => 'SpecialComment'}) } <ide> scope :with_very_special_comments, -> { joins(:comments).where(:comments => {:type => 'VerySpecialComment'}) } <del> scope :with_post, lambda {|post_id| <del> { :joins => :comments, :conditions => {:comments => {:post_id => post_id} } } <del> } <add> scope :with_post, ->(post_id) { joins(:comments).where(:comments => { :post_id => post_id }) } <ide> <ide> has_many :comments do <ide> def find_most_recent <ide><path>activerecord/test/models/topic.rb <ide> class Topic < ActiveRecord::Base <ide> scope :base, -> { scoped } <ide> scope :written_before, lambda { |time| <ide> if time <del> { :conditions => ['written_on < ?', time] } <add> where 'written_on < ?', time <ide> end <ide> } <ide> scope :approved, -> { where(:approved => true) } <ide> def two <ide> 2 <ide> end <ide> end <del> module MultipleExtensionOne <del> def extension_one <del> 1 <del> end <del> end <del> module MultipleExtensionTwo <del> def extension_two <del> 2 <del> end <del> end <del> scope :named_extension, :extend => NamedExtension <del> scope :multiple_extensions, :extend => [MultipleExtensionTwo, MultipleExtensionOne] <ide> <ide> has_many :replies, :dependent => :destroy, :foreign_key => "parent_id" <ide> has_many :replies_with_primary_key, :class_name => "Reply", :dependent => :destroy, :primary_key => "title", :foreign_key => "parent_title"
5
Ruby
Ruby
add regression test to
50454559f8739ef70ac8b7ab6e885d033519c10d
<ide><path>railties/test/application/middleware/static_test.rb <add># encoding: utf-8 <add>require 'isolation/abstract_unit' <add>require 'rack/test' <add> <add>module ApplicationTests <add> class MiddlewareStaticTest < ActiveSupport::TestCase <add> include ActiveSupport::Testing::Isolation <add> include Rack::Test::Methods <add> <add> def setup <add> build_app <add> FileUtils.rm_rf "#{app_path}/config/environments" <add> end <add> <add> def teardown <add> teardown_app <add> end <add> <add> # Regression test to #8907 <add> # See https://github.com/rails/rails/commit/9cc82b77196d21a5c7021f6dca59ab9b2b158a45#commitcomment-2416514 <add> test "doesn't set Cache-Control header when it is nil" do <add> app_file "public/foo.html", 'static' <add> <add> require "#{app_path}/config/environment" <add> <add> get 'foo' <add> <add> assert_not last_response.headers.has_key?('Cache-Control'), "Cache-Control should not be set" <add> end <add> end <add>end
1
Javascript
Javascript
avoid binding expectopenevent into the closure
b591f83447acd5e06a41e2eba6883bf9c886e9a9
<ide><path>spec/main-process/atom-application.new.test.js <ide> class LaunchScenario { <ide> const app = this.addApplication() <ide> const windowPromises = [] <ide> for (const windowSpec of this.parseWindowSpecs(source)) { <del> const expectOpenEvent = windowSpec.roots.length > 0 || windowSpec.editors.length > 0 <del> <ide> if (windowSpec.editors.length === 0) { <ide> windowSpec.editors.push(null) <ide> } <ide> <ide> windowPromises.push((async (theApp, foldersToOpen, pathsToOpen) => { <ide> const window = await theApp.openPaths({ newWindow: true, foldersToOpen, pathsToOpen }) <del> if (expectOpenEvent) { <del> await emitterEventPromise(window, 'window:locations-opened') <add> if (foldersToOpen.length > 0 || pathsToOpen.filter(Boolean).length > 0) { <add> await emitterEventPromise(window, 'window:locations-opened', 15000, `preconditions('${source}')`) <ide> } <ide> return window <ide> })(app, windowSpec.roots, windowSpec.editors))
1
Python
Python
fix some uninitialized memory in the tests
abf593e91023aca8f1efbd74581a754cdeaf3593
<ide><path>numpy/core/tests/test_regression.py <ide> def test_searchsorted_wrong_dtype(self): <ide> assert_raises(TypeError, np.searchsorted, a, 1.2) <ide> # Ticket #2066, similar problem: <ide> dtype = np.format_parser(['i4', 'i4'], [], []) <del> a = np.recarray((2, ), dtype) <add> a = np.recarray((2,), dtype) <add> a[...] = [(1, 2), (3, 4)] <ide> assert_raises(TypeError, np.searchsorted, a, 1) <ide> <ide> def test_complex64_alignment(self): <ide><path>numpy/core/tests/test_umath.py <ide> class StoreArrayPrepareWrap(np.ndarray): <ide> _wrap_args = None <ide> _prepare_args = None <ide> def __new__(cls): <del> return np.empty(()).view(cls) <add> return np.zeros(()).view(cls) <ide> def __array_wrap__(self, obj, context): <ide> self._wrap_args = context[1] <ide> return obj
2
Ruby
Ruby
add os x-specific sharedenvextension
74d4479246778ff73756fce2208ef04f2c45aafb
<ide><path>Library/Homebrew/extend/ENV/shared.rb <ide> def gcc_with_cxx11_support?(cc) <ide> version && Version.create(version) >= Version.create("4.8") <ide> end <ide> end <add> <add>require "extend/os/extend/ENV/shared" <ide><path>Library/Homebrew/extend/os/extend/ENV/shared.rb <add>require "extend/ENV/shared" <add> <add>if OS.mac? <add> require "extend/os/mac/extend/ENV/shared" <add>end <ide><path>Library/Homebrew/extend/os/mac/extend/ENV/shared.rb <add>module SharedEnvExtension <add>end
3
PHP
PHP
use the widget objects for textarea
1037b103f58a31b608e15044fc849326c2bc1f3e
<ide><path>src/View/Helper/FormHelper.php <ide> public function __call($method, $params) { <ide> */ <ide> public function textarea($fieldName, $options = array()) { <ide> $options = $this->_initInputField($fieldName, $options); <del> $value = null; <del> <del> if (array_key_exists('val', $options)) { <del> $value = $options['val']; <del> if (!array_key_exists('escape', $options) || $options['escape'] !== false) { <del> $value = h($value); <del> } <del> } <del> unset($options['val']); <del> return $this->formatTemplate('textarea', [ <del> 'name' => $options['name'], <del> 'value' => $value, <del> 'attrs' => $this->_templater->formatAttributes($options, ['name']), <del> ]); <add> return $this->widget('textarea', $options); <ide> } <ide> <ide> /**
1
Javascript
Javascript
add annotations to reactnativeprivateinterface
08daad44273f16ef513c3b9ab17da0efce334ee5
<ide><path>Libraries/ReactPrivate/ReactNativePrivateInterface.js <ide> * @flow strict-local <ide> */ <ide> <add>import typeof BatchedBridge from '../BatchedBridge/BatchedBridge.js'; <add>import typeof ExceptionsManager from '../Core/ExceptionsManager'; <add>import typeof Platform from '../Utilities/Platform'; <add>import typeof RCTEventEmitter from '../EventEmitter/RCTEventEmitter'; <add>import typeof ReactNativeViewConfigRegistry from '../Renderer/shims/ReactNativeViewConfigRegistry'; <add>import typeof TextInputState from '../Components/TextInput/TextInputState'; <add>import typeof UIManager from '../ReactNative/UIManager'; <add>import typeof deepDiffer from '../Utilities/differ/deepDiffer'; <add>import typeof deepFreezeAndThrowOnMutationInDev from '../Utilities/deepFreezeAndThrowOnMutationInDev'; <add>import typeof flattenStyle from '../StyleSheet/flattenStyle'; <add>import typeof ReactFiberErrorDialog from '../Core/ReactFiberErrorDialog'; <add> <ide> // flowlint unsafe-getters-setters:off <ide> module.exports = { <del> get BatchedBridge() { <add> get BatchedBridge(): BatchedBridge { <ide> return require('../BatchedBridge/BatchedBridge.js'); <ide> }, <del> get ExceptionsManager() { <add> get ExceptionsManager(): ExceptionsManager { <ide> return require('../Core/ExceptionsManager'); <ide> }, <del> get Platform() { <add> get Platform(): Platform { <ide> return require('../Utilities/Platform'); <ide> }, <del> get RCTEventEmitter() { <add> get RCTEventEmitter(): RCTEventEmitter { <ide> return require('../EventEmitter/RCTEventEmitter'); <ide> }, <del> get ReactNativeViewConfigRegistry() { <add> get ReactNativeViewConfigRegistry(): ReactNativeViewConfigRegistry { <ide> return require('../Renderer/shims/ReactNativeViewConfigRegistry'); <ide> }, <del> get TextInputState() { <add> get TextInputState(): TextInputState { <ide> return require('../Components/TextInput/TextInputState'); <ide> }, <del> get UIManager() { <add> get UIManager(): UIManager { <ide> return require('../ReactNative/UIManager'); <ide> }, <del> get deepDiffer() { <add> get deepDiffer(): deepDiffer { <ide> return require('../Utilities/differ/deepDiffer'); <ide> }, <del> get deepFreezeAndThrowOnMutationInDev() { <add> get deepFreezeAndThrowOnMutationInDev(): deepFreezeAndThrowOnMutationInDev< <add> // $FlowFixMe - can't properly parameterize the getter's type <add> *, <add> > { <ide> return require('../Utilities/deepFreezeAndThrowOnMutationInDev'); <ide> }, <del> get flattenStyle() { <add> get flattenStyle(): flattenStyle { <ide> return require('../StyleSheet/flattenStyle'); <ide> }, <del> get ReactFiberErrorDialog() { <add> get ReactFiberErrorDialog(): ReactFiberErrorDialog { <ide> return require('../Core/ReactFiberErrorDialog'); <ide> }, <ide> };
1
Ruby
Ruby
fix a file leak
c25e11563c839f2d4c49cb28d3bcbff177cc3fb3
<ide><path>Library/Homebrew/test/test_integration_cmds.rb <ide> def test_uninstall <ide> def test_cleanup <ide> (HOMEBREW_CACHE/"test").write "test" <ide> assert_match "#{HOMEBREW_CACHE}/test", cmd("cleanup", "--prune=all") <add> ensure <add> (HOMEBREW_CACHE/"test").rmtree <ide> end <ide> <ide> def test_readall
1
Text
Text
fix typo in stream docs
87da53c812c4ee398431d70770c03d2b5ab71651
<ide><path>doc/api/stream.md <ide> added: REPLACEME <ide> * `options` {Object} <ide> * `encoding` {string} <ide> * `highWaterMark` {number} <del> * `objectModel` {boolean} <add> * `objectMode` {boolean} <ide> * `signal` {AbortSignal} <ide> * Returns: {stream.Readable} <ide>
1
Python
Python
add glossary for annotation scheme (closes )
a04b5be1b2b4cc01c1c962294077a842ab1d0e59
<ide><path>spacy/__init__.py <ide> from . import util <ide> from .deprecated import resolve_model_name <ide> from .cli.info import info <add>from .glossary import explain <ide> <ide> from . import en, de, zh, es, it, hu, fr, pt, nl, sv, fi, bn, he, nb, ja <ide> <ide><path>spacy/glossary.py <add># coding: utf8 <add>from __future__ import unicode_literals <add> <add> <add>def explain(term): <add> if term in GLOSSARY: <add> return GLOSSARY[term] <add> <add> <add>GLOSSARY = { <add> # POS tags <add> # Universal POS Tags <add> # http://universaldependencies.org/u/pos/ <add> <add> 'ADJ': 'adjective', <add> 'ADP': 'adposition', <add> 'ADV': 'adverb', <add> 'AUX': 'auxiliary', <add> 'CONJ': 'conjunction', <add> 'CCONJ': 'coordinating conjunction', <add> 'DET': 'determiner', <add> 'INTJ': 'interjection', <add> 'NOUN': 'noun', <add> 'NUM': 'numeral', <add> 'PART': 'particle', <add> 'PRON': 'pronoun', <add> 'PROPN': 'proper noun', <add> 'PUNCT': 'punctuation', <add> 'SCONJ': 'subordinating conjunction', <add> 'SYM': 'symbol', <add> 'VERB': 'verb', <add> 'X': 'other', <add> 'EOL': 'end of line', <add> 'SPACE': 'space', <add> <add> <add> # POS tags (English) <add> # OntoNotes 5 / Penn Treebank <add> # https://www.ling.upenn.edu/courses/Fall_2003/ling001/penn_treebank_pos.html <add> <add> '.': 'punctuation mark, sentence closer', <add> ',': 'punctuation mark, comma', <add> '-LRB-': 'left round bracket', <add> '-RRB-': 'right round bracket', <add> '``': 'opening quotation mark', <add> '""': 'closing quotation mark', <add> "''": 'closing quotation mark', <add> ':': 'punctuation mark, colon or ellipsis', <add> '$': 'symbol, currency', <add> '#': 'symbol, number sign', <add> 'AFX': 'affix', <add> 'CC': 'conjunction, coordinating', <add> 'CD': 'cardinal number', <add> 'DT': 'determiner', <add> 'EX': 'existential there', <add> 'FW': 'foreign word', <add> 'HYPH': 'punctuation mark, hyphen', <add> 'IN': 'conjunction, subordinating or preposition', <add> 'JJ': 'adjective', <add> 'JJR': 'adjective, comparative', <add> 'JJS': 'adjective, superlative', <add> 'LS': 'list item marker', <add> 'MD': 'verb, modal auxillary', <add> 'NIL': 'missing tag', <add> 'NN': 'noun, singular or mass', <add> 'NNP': 'noun, proper singular', <add> 'NNPS': 'noun, proper plural', <add> 'NNS': 'noun, plural', <add> 'PDT': 'predeterminer', <add> 'POS': 'possessive ending', <add> 'PRP': 'pronoun, personal', <add> 'PRP$': 'pronoun, possessive', <add> 'RB': 'adverb', <add> 'RBR': 'adverb, comparative', <add> 'RBS': 'adverb, superlative', <add> 'RP': 'adverb, particle', <add> 'TO': 'infinitival to', <add> 'UH': 'interjection', <add> 'VB': 'verb, base form', <add> 'VBD': 'verb, past tense', <add> 'VBG': 'verb, gerund or present participle', <add> 'VBN': 'verb, past participle', <add> 'VBP': 'verb, non-3rd person singular present', <add> 'VBZ': 'verb, 3rd person singular present', <add> 'WDT': 'wh-determiner', <add> 'WP': 'wh-pronoun, personal', <add> 'WP$': 'wh-pronoun, possessive', <add> 'WRB': 'wh-adverb', <add> 'SP': 'space', <add> 'ADD': 'email', <add> 'NFP': 'superfluous punctuation', <add> 'GW': 'additional word in multi-word expression', <add> 'XX': 'unknown', <add> 'BES': 'auxillary "be"', <add> 'HVS': 'forms of "have"', <add> <add> <add> # POS Tags (German) <add> # TIGER Treebank <add> # http://www.ims.uni-stuttgart.de/forschung/ressourcen/korpora/TIGERCorpus/annotation/tiger_introduction.pdf <add> <add> '$(': 'other sentence-internal punctuation mark', <add> '$,': 'comma', <add> '$.': 'sentence-final punctuation mark', <add> 'ADJA': 'adjective, attributive', <add> 'ADJD': 'adjective, adverbial or predicative', <add> 'APPO': 'postposition', <add> 'APRP': 'preposition; circumposition left', <add> 'APPRART': 'preposition with article', <add> 'APZR': 'circumposition right', <add> 'ART': 'definite or indefinite article', <add> 'CARD': 'cardinal number', <add> 'FM': 'foreign language material', <add> 'ITJ': 'interjection', <add> 'KOKOM': 'comparative conjunction ', <add> 'KON': 'coordinate conjunction', <add> 'KOUI': 'subordinate conjunction with "zu" and infinitive', <add> 'KOUS': 'subordinate conjunction with sentence', <add> 'NE': 'proper noun', <add> 'NNE': 'proper noun', <add> 'PAV': 'pronominal adverb', <add> 'PROAV': 'pronominal adverb', <add> 'PDAT': 'attributive demonstrative pronoun', <add> 'PDS': 'substituting demonstrative pronoun', <add> 'PIAT': 'attributive indefinite pronoun without determiner', <add> 'PIDAT': 'attributive indefinite pronoun with determiner', <add> 'PIS': 'substituting indefinite pronoun', <add> 'PPER': 'non-reflexive personal pronoun', <add> 'PPOSAT': 'attributive possessive pronoun', <add> 'PPOSS': 'substituting possessive pronoun', <add> 'PRELAT': 'attributive relative pronoun', <add> 'PRELS': 'substituting relative pronoun', <add> 'PRF': 'reflexive personal pronoun', <add> 'PTKA': 'particle with adjective or adverb', <add> 'PTKANT': 'answer particle', <add> 'PTKNEG': 'negative particle', <add> 'PTKVZ': 'separable verbal particle', <add> 'PTKZU': '"zu" before infinitive', <add> 'PWAT': 'attributive interrogative pronoun', <add> 'PWAV': 'adverbial interrogative or relative pronoun', <add> 'PWS': 'substituting interrogative pronoun', <add> 'TRUNC': 'word remnant', <add> 'VAFIN': 'finite verb, auxiliary', <add> 'VAIMP': 'imperative, auxiliary', <add> 'VAINF': 'infinitive, auxiliary', <add> 'VAPP': 'perfect participle, auxiliary', <add> 'VMFIN': 'finite verb, modal', <add> 'VMINF': 'infinitive, modal ', <add> 'VMPP': 'perfect participle, modal ', <add> 'VVFIN': 'finite verb, full', <add> 'VVIMP': 'imperative, full', <add> 'VVINF': 'infinitive, full', <add> 'VVIZU': 'infinitive with "zu", full', <add> 'VVPP': 'perfect participle, full', <add> 'XY': 'non-word containing non-letter', <add> <add> <add> # Noun chunks <add> <add> 'NP': 'noun phrase', <add> 'PP': 'prepositional phrase', <add> 'VP': 'verb phrase', <add> 'ADVP': 'adverb phrase', <add> 'ADJP': 'adjective phrase', <add> 'SBAR': 'subordinating conjunction', <add> 'PRT': 'particle', <add> 'PNP': 'prepositional noun phrase', <add> <add> <add> # Dependency Labels (English) <add> # ClearNLP / Universal Dependencies <add> # https://github.com/clir/clearnlp-guidelines/blob/master/md/specifications/dependency_labels.md <add> <add> 'acomp': 'adjectival complement', <add> 'advcl': 'adverbial clause modifier', <add> 'advmod': 'adverbial modifier', <add> 'agent': 'agent', <add> 'amod': 'adjectival modifier', <add> 'appos': 'appositional modifier', <add> 'attr': 'attribute', <add> 'aux': 'auxiliary', <add> 'auxpass': 'auxiliary (passive)', <add> 'cc': 'coordinating conjunction', <add> 'ccomp': 'clausal complement', <add> 'complm': 'complementizer', <add> 'conj': 'conjunct', <add> 'cop': 'copula', <add> 'csubj': 'clausal subject', <add> 'csubjpass': 'clausal subject (passive)', <add> 'dep': 'unclassified dependent', <add> 'det': 'determiner', <add> 'dobj': 'direct object', <add> 'expl': 'expletive', <add> 'hmod': 'modifier in hyphenation', <add> 'hyph': 'hyphen', <add> 'infmod': 'infinitival modifier', <add> 'intj': 'interjection', <add> 'iobj': 'indirect object', <add> 'mark': 'marker', <add> 'meta': 'meta modifier', <add> 'neg': 'negation modifier', <add> 'nmod': 'modifier of nominal', <add> 'nn': 'noun compound modifier', <add> 'npadvmod': 'noun phrase as adverbial modifier', <add> 'nsubj': 'nominal subject', <add> 'nsubjpass': 'nominal subject (passive)', <add> 'num': 'number modifier', <add> 'number': 'number compound modifier', <add> 'oprd': 'object predicate', <add> 'obj': 'object', <add> 'obl': 'oblique nominal', <add> 'parataxis': 'parataxis', <add> 'partmod': 'participal modifier', <add> 'pcomp': 'complement of preposition', <add> 'pobj': 'object of preposition', <add> 'poss': 'possession modifier', <add> 'possessive': 'possessive modifier', <add> 'preconj': 'pre-correlative conjunction', <add> 'prep': 'prepositional modifier', <add> 'prt': 'particle', <add> 'punct': 'punctuation', <add> 'quantmod': 'modifier of quantifier', <add> 'rcmod': 'relative clause modifier', <add> 'root': 'root', <add> 'xcomp': 'open clausal complement', <add> <add> <add> # Dependency labels (German) <add> # TIGER Treebank <add> # http://www.ims.uni-stuttgart.de/forschung/ressourcen/korpora/TIGERCorpus/annotation/tiger_introduction.pdf <add> # currently missing: 'cc' (comparative complement) because of conflict <add> # with English labels <add> <add> 'ac': 'adpositional case marker', <add> 'adc': 'adjective component', <add> 'ag': 'genitive attribute', <add> 'ams': 'measure argument of adjective', <add> 'app': 'apposition', <add> 'avc': 'adverbial phrase component', <add> 'cd': 'coordinating conjunction', <add> 'cj': 'conjunct', <add> 'cm': 'comparative conjunction', <add> 'cp': 'complementizer', <add> 'cvc': 'collocational verb construction', <add> 'da': 'dative', <add> 'dh': 'discourse-level head', <add> 'dm': 'discourse marker', <add> 'ep': 'expletive es', <add> 'hd': 'head', <add> 'ju': 'junctor', <add> 'mnr': 'postnominal modifier', <add> 'mo': 'modifier', <add> 'ng': 'negation', <add> 'nk': 'noun kernel element', <add> 'nmc': 'numerical component', <add> 'oa': 'accusative object', <add> 'oa': 'second accusative object', <add> 'oc': 'clausal object', <add> 'og': 'genitive object', <add> 'op': 'prepositional object', <add> 'par': 'parenthetical element', <add> 'pd': 'predicate', <add> 'pg': 'phrasal genitive', <add> 'ph': 'placeholder', <add> 'pm': 'morphological particle', <add> 'pnc': 'proper noun component', <add> 'rc': 'relative clause', <add> 're': 'repeated element', <add> 'rs': 'reported speech', <add> 'sb': 'subject', <add> <add> <add> # Named Entity Recognition <add> # OntoNotes 5 <add> # https://catalog.ldc.upenn.edu/docs/LDC2013T19/OntoNotes-Release-5.0.pdf <add> <add> 'PERSON': 'People, including fictional', <add> 'NORP': 'Nationalities or religious or political groups', <add> 'FACILITY': 'Buildings, airports, highways, bridges, etc.', <add> 'ORG': 'Companies, agencies, institutions, etc.', <add> 'GPE': 'Countries, cities, states', <add> 'LOC': 'Non-GPE locations, mountain ranges, bodies of water', <add> 'PRODUCT': 'Objects, vehicles, foods, etc. (not services)', <add> 'EVENT': 'Named hurricanes, battles, wars, sports events, etc.', <add> 'WORK_OF_ART': 'Titles of books, songs, etc.', <add> 'LANGUAGE': 'Any named language', <add> 'DATE': 'Absolute or relative dates or periods', <add> 'TIME': 'Times smaller than a day', <add> 'PERCENT': 'Percentage, including "%"', <add> 'MONEY': 'Monetary values, including unit', <add> 'QUANTITY': 'Measurements, as of weight or distance', <add> 'ORDINAL': '"first", "second", etc.', <add> 'CARDINAL': 'Numerals that do not fall under another type' <add>}
2
PHP
PHP
fix code in docblocks for apigen
427f54461a82a7aa2553be58e2b19fa1f4ecfd75
<ide><path>src/Cache/Cache.php <ide> public static function remember($key, $callable, $config = 'default') <ide> * <ide> * ``` <ide> * Cache::add('cached_data', $data); <del> * ```` <add> * ``` <ide> * <ide> * Writing to a specific cache config: <ide> * <ide><path>src/Database/Expression/FunctionExpression.php <ide> class FunctionExpression extends QueryExpression <ide> * <ide> * ### Examples: <ide> * <del> * ``$f = new FunctionExpression('CONCAT', ['CakePHP', ' rules']);`` <add> * `$f = new FunctionExpression('CONCAT', ['CakePHP', ' rules']);` <ide> * <del> * Previous line will generate ``CONCAT('CakePHP', ' rules')`` <add> * Previous line will generate `CONCAT('CakePHP', ' rules')` <ide> * <del> * ``$f = new FunctionExpression('CONCAT', ['name' => 'literal', ' rules']);`` <add> * `$f = new FunctionExpression('CONCAT', ['name' => 'literal', ' rules']);` <ide> * <del> * Will produce ``CONCAT(name, ' rules')`` <add> * Will produce `CONCAT(name, ' rules')` <ide> * <ide> * @param string $name the name of the function to be constructed <ide> * @param array $params list of arguments to be passed to the function <ide><path>src/Database/Query.php <ide> public function from($tables = [], $overwrite = false) <ide> * to be joined, unless the third argument is set to true. <ide> * <ide> * When no join type is specified an INNER JOIN is used by default: <del> * ``$query->join(['authors'])`` Will produce ``INNER JOIN authors ON 1 = 1`` <add> * `$query->join(['authors'])` will produce `INNER JOIN authors ON 1 = 1` <ide> * <ide> * It is also possible to alias joins using the array key: <del> * ``$query->join(['a' => 'authors'])`` Will produce ``INNER JOIN authors a ON 1 = 1`` <add> * `$query->join(['a' => 'authors'])`` will produce `INNER JOIN authors a ON 1 = 1` <ide> * <ide> * A join can be fully described and aliased using the array notation: <ide> * <ide> protected function _makeJoin($table, $conditions, $type) <ide> * <ide> * The previous example produces: <ide> * <del> * ``WHERE posted >= 2012-01-27 AND title LIKE 'Hello W%' AND author_id = 1`` <add> * `WHERE posted >= 2012-01-27 AND title LIKE 'Hello W%' AND author_id = 1` <ide> * <ide> * Second parameter is used to specify what type is expected for each passed <ide> * key. Valid types can be used from the mapped with Database\Type class. <ide> protected function _makeJoin($table, $conditions, $type) <ide> * <ide> * The previous example produces: <ide> * <del> * ``WHERE author_id = 1 AND (published = 1 OR posted < '2012-02-01') AND NOT (title = 'Hello')`` <add> * `WHERE author_id = 1 AND (published = 1 OR posted < '2012-02-01') AND NOT (title = 'Hello')` <ide> * <ide> * You can nest conditions using conjunctions as much as you like. Sometimes, you <ide> * may want to define 2 different options for the same key, in that case, you can <ide> * wrap each condition inside a new array: <ide> * <del> * ``$query->where(['OR' => [['published' => false], ['published' => true]])`` <add> * `$query->where(['OR' => [['published' => false], ['published' => true]])` <ide> * <ide> * Keep in mind that every time you call where() with the third param set to false <ide> * (default), it will join the passed conditions to the previous stored list using <ide> protected function _makeJoin($table, $conditions, $type) <ide> * <ide> * The previous example produces: <ide> * <del> * ``WHERE (id != 100 OR author_id != 1) AND published = 1`` <add> * `WHERE (id != 100 OR author_id != 1) AND published = 1` <ide> * <ide> * Other Query objects that be used as conditions for any field. <ide> * <ide> protected function _makeJoin($table, $conditions, $type) <ide> * <ide> * * The previous example produces: <ide> * <del> * ``WHERE title != 'Hello World' AND (id = 1 OR (id > 2 AND id < 10))`` <add> * `WHERE title != 'Hello World' AND (id = 1 OR (id > 2 AND id < 10))` <ide> * <ide> * ### Conditions as strings: <ide> * <ide> protected function _makeJoin($table, $conditions, $type) <ide> * <ide> * The previous example produces: <ide> * <del> * ``WHERE articles.author_id = authors.id AND modified IS NULL`` <add> * `WHERE articles.author_id = authors.id AND modified IS NULL` <ide> * <ide> * Please note that when using the array notation or the expression objects, all <ide> * values will be correctly quoted and transformed to the correspondent database <ide> public function where($conditions = null, $types = [], $overwrite = false) <ide> * <ide> * Produces: <ide> * <del> * ``WHERE (published = 0 OR published IS NULL) AND author_id = 1 AND comments_count > 10`` <add> * `WHERE (published = 0 OR published IS NULL) AND author_id = 1 AND comments_count > 10` <ide> * <ide> * ``` <ide> * $query <ide> public function where($conditions = null, $types = [], $overwrite = false) <ide> * <ide> * Generates the following conditions: <ide> * <del> * ``WHERE (title = 'Foo') AND (author_id = 1 OR author_id = 2)`` <add> * `WHERE (title = 'Foo') AND (author_id = 1 OR author_id = 2)` <ide> * <ide> * @param string|array|ExpressionInterface|callback $conditions The conditions to add with AND. <ide> * @param array $types associative array of type names used to bind values to query <ide> public function andWhere($conditions, $types = []) <ide> * <ide> * Will produce: <ide> * <del> * ``WHERE title = 'Hello World' OR title = 'Foo'`` <add> * `WHERE title = 'Hello World' OR title = 'Foo'` <ide> * <ide> * ``` <ide> * $query <ide> public function andWhere($conditions, $types = []) <ide> * <ide> * Produces: <ide> * <del> * ``WHERE (published = 0 OR published IS NULL) OR (author_id = 1 AND comments_count > 10)`` <add> * `WHERE (published = 0 OR published IS NULL) OR (author_id = 1 AND comments_count > 10)` <ide> * <ide> * ``` <ide> * $query <ide> public function andWhere($conditions, $types = []) <ide> * <ide> * Generates the following conditions: <ide> * <del> * ``WHERE (title = 'Foo') OR (author_id = 1 OR author_id = 2)`` <add> * `WHERE (title = 'Foo') OR (author_id = 1 OR author_id = 2)` <ide> * <ide> * @param string|array|ExpressionInterface|callback $conditions The conditions to add with OR. <ide> * @param array $types associative array of type names used to bind values to query <ide> public function orWhere($conditions, $types = []) <ide> * <ide> * Produces: <ide> * <del> * ``ORDER BY title DESC, author_id ASC`` <add> * `ORDER BY title DESC, author_id ASC` <ide> * <ide> * ``` <ide> * $query->order(['title' => 'DESC NULLS FIRST'])->order('author_id'); <ide> * ``` <ide> * <ide> * Will generate: <ide> * <del> * ``ORDER BY title DESC NULLS FIRST, author_id`` <add> * `ORDER BY title DESC NULLS FIRST, author_id` <ide> * <ide> * ``` <ide> * $expression = $query->newExpr()->add(['id % 2 = 0']); <ide> public function orWhere($conditions, $types = []) <ide> * <ide> * Will become: <ide> * <del> * ``ORDER BY (id %2 = 0), title ASC`` <add> * `ORDER BY (id %2 = 0), title ASC` <ide> * <ide> * If you need to set complex expressions as order conditions, you <ide> * should use `orderAsc()` or `orderDesc()`. <ide> public function having($conditions = null, $types = [], $overwrite = false) <ide> /** <ide> * Connects any previously defined set of conditions to the provided list <ide> * using the AND operator in the HAVING clause. This method operates in exactly <del> * the same way as the method ``andWhere()`` does. Please refer to its <add> * the same way as the method `andWhere()` does. Please refer to its <ide> * documentation for an insight on how to using each parameter. <ide> * <ide> * @param string|array|ExpressionInterface|callback $conditions The AND conditions for HAVING. <ide> public function andHaving($conditions, $types = []) <ide> /** <ide> * Connects any previously defined set of conditions to the provided list <ide> * using the OR operator in the HAVING clause. This method operates in exactly <del> * the same way as the method ``orWhere()`` does. Please refer to its <add> * the same way as the method `orWhere()` does. Please refer to its <ide> * documentation for an insight on how to using each parameter. <ide> * <ide> * @param string|array|ExpressionInterface|callback $conditions The OR conditions for HAVING. <ide> public function offset($num) <ide> * <ide> * Will produce: <ide> * <del> * ``SELECT id, name FROM things d UNION SELECT id, title FROM articles a`` <add> * `SELECT id, name FROM things d UNION SELECT id, title FROM articles a` <ide> * <ide> * @param string|Query $query full SQL query to be used in UNION operator <ide> * @param bool $overwrite whether to reset the list of queries to be operated or not <ide> public function union($query, $overwrite = false) <ide> * <ide> * Will produce: <ide> * <del> * ``SELECT id, name FROM things d UNION ALL SELECT id, title FROM articles a`` <add> * `SELECT id, name FROM things d UNION ALL SELECT id, title FROM articles a` <ide> * <ide> * @param string|Query $query full SQL query to be used in UNION operator <ide> * @param bool $overwrite whether to reset the list of queries to be operated or not <ide> public function type() <ide> * any format accepted by \Cake\Database\Expression\QueryExpression: <ide> * <ide> * ``` <del> * <ide> * $expression = $query->newExpr(); // Returns an empty expression object <ide> * $expression = $query->newExpr('Table.column = Table2.column'); // Return a raw SQL expression <ide> * ``` <ide><path>src/Datasource/QueryInterface.php <ide> public function offset($num); <ide> * <ide> * Produces: <ide> * <del> * ``ORDER BY title DESC, author_id ASC`` <add> * `ORDER BY title DESC, author_id ASC` <ide> * <ide> * ``` <ide> * $query->order(['title' => 'DESC NULLS FIRST'])->order('author_id'); <ide> * ``` <ide> * <ide> * Will generate: <ide> * <del> * ``ORDER BY title DESC NULLS FIRST, author_id`` <add> * `ORDER BY title DESC NULLS FIRST, author_id` <ide> * <ide> * ``` <ide> * $expression = $query->newExpr()->add(['id % 2 = 0']); <ide> public function offset($num); <ide> * <ide> * Will become: <ide> * <del> * ``ORDER BY (id %2 = 0), title ASC`` <add> * `ORDER BY (id %2 = 0), title ASC` <ide> * <ide> * If you need to set complex expressions as order conditions, you <ide> * should use `orderAsc()` or `orderDesc()`. <ide> public function repository(RepositoryInterface $repository = null); <ide> * <ide> * The previous example produces: <ide> * <del> * ``WHERE posted >= 2012-01-27 AND title LIKE 'Hello W%' AND author_id = 1`` <add> * `WHERE posted >= 2012-01-27 AND title LIKE 'Hello W%' AND author_id = 1` <ide> * <ide> * Second parameter is used to specify what type is expected for each passed <ide> * key. Valid types can be used from the mapped with Database\Type class. <ide> public function repository(RepositoryInterface $repository = null); <ide> * <ide> * The previous example produces: <ide> * <del> * ``WHERE author_id = 1 AND (published = 1 OR posted < '2012-02-01') AND NOT (title = 'Hello')`` <add> * `WHERE author_id = 1 AND (published = 1 OR posted < '2012-02-01') AND NOT (title = 'Hello')` <ide> * <ide> * You can nest conditions using conjunctions as much as you like. Sometimes, you <ide> * may want to define 2 different options for the same key, in that case, you can <ide> * wrap each condition inside a new array: <ide> * <del> * ``$query->where(['OR' => [['published' => false], ['published' => true]])`` <add> * `$query->where(['OR' => [['published' => false], ['published' => true]])` <ide> * <ide> * Keep in mind that every time you call where() with the third param set to false <ide> * (default), it will join the passed conditions to the previous stored list using <ide> public function repository(RepositoryInterface $repository = null); <ide> * <ide> * The previous example produces: <ide> * <del> * ``WHERE (id != 100 OR author_id != 1) AND published = 1`` <add> * `WHERE (id != 100 OR author_id != 1) AND published = 1` <ide> * <ide> * Other Query objects that be used as conditions for any field. <ide> * <ide> public function repository(RepositoryInterface $repository = null); <ide> * <ide> * * The previous example produces: <ide> * <del> * ``WHERE title != 'Hello World' AND (id = 1 OR (id > 2 AND id < 10))`` <add> * `WHERE title != 'Hello World' AND (id = 1 OR (id > 2 AND id < 10))` <ide> * <ide> * ### Conditions as strings: <ide> * <ide> public function repository(RepositoryInterface $repository = null); <ide> * <ide> * The previous example produces: <ide> * <del> * ``WHERE articles.author_id = authors.id AND modified IS NULL`` <add> * `WHERE articles.author_id = authors.id AND modified IS NULL` <ide> * <ide> * Please note that when using the array notation or the expression objects, all <ide> * values will be correctly quoted and transformed to the correspondent database
4
Text
Text
add #destroy! as a method that triggers callbacks
2cdf6bda4a34c9e20eb0af41ccb18a4bcb192aed
<ide><path>guides/source/active_record_callbacks.md <ide> The following methods trigger callbacks: <ide> * `create!` <ide> * `decrement!` <ide> * `destroy` <add>* `destroy!` <ide> * `destroy_all` <ide> * `increment!` <ide> * `save`
1
Text
Text
add link to full stack react article
e9067e6f5d16d756debcc782ec178b7086752d69
<ide><path>docs/faq/General.md <ide> In the end, Redux is just a tool. It's a great tool, and there's some great rea <ide> - [React How-To](https://github.com/petehunt/react-howto) <ide> - [You Might Not Need Redux](https://medium.com/@dan_abramov/you-might-not-need-redux-be46360cf367) <ide> - [The Case for Flux](https://medium.com/swlh/the-case-for-flux-379b7d1982c6) <add>- [Some Reasons Why Redux is Useful in a React App](https://www.fullstackreact.com/articles/redux-with-mark-erikson/) <ide> <ide> **Discussions** <ide>
1
Ruby
Ruby
remove commentary from error message
d4b6d8ec962f80b9bb121b808162c094b289ec9e
<ide><path>Library/Homebrew/extend/ARGV.rb <ide> def kegs <ide> Multiple kegs installed to #{rack} <ide> However we don't know which one you refer to. <ide> Please delete (with rm -rf!) all but one and then try again. <del> Sorry, we know this is lame. <ide> EOS <ide> end <ide> end
1
Java
Java
remove duplicate classpathresourcetests class
084d7d1bdc8ef24b7c045efcfb67ea09b0aedd85
<ide><path>spring-core/src/test/java/org/springframework/core/io/ClassPathResourceTests.java <ide> import java.io.IOException; <ide> import java.net.URL; <ide> import java.net.URLClassLoader; <add>import java.util.HashSet; <ide> import java.util.zip.ZipEntry; <ide> import java.util.zip.ZipOutputStream; <ide> <ide> class ClassPathResourceTests { <ide> private static final String ABSOLUTE_PATH_TO_NONEXISTENT_RESOURCE_WITH_LEADING_SLASH = '/' + ABSOLUTE_PATH_TO_NONEXISTENT_RESOURCE; <ide> <ide> <add> @Nested <add> class EqualsAndHashCode { <add> <add> @Test <add> void equalsAndHashCode() { <add> Resource resource1 = new ClassPathResource("org/springframework/core/io/Resource.class"); <add> Resource resource2 = new ClassPathResource("org/springframework/core/../core/io/./Resource.class"); <add> Resource resource3 = new ClassPathResource("org/springframework/core/").createRelative("../core/io/./Resource.class"); <add> <add> assertThat(resource2).isEqualTo(resource1); <add> assertThat(resource3).isEqualTo(resource1); <add> assertThat(resource2).hasSameHashCodeAs(resource1); <add> assertThat(resource3).hasSameHashCodeAs(resource1); <add> <add> // Check whether equal/hashCode works in a HashSet. <add> HashSet<Resource> resources = new HashSet<>(); <add> resources.add(resource1); <add> resources.add(resource2); <add> assertThat(resources).hasSize(1); <add> } <add> <add> @Test <add> void resourcesWithDifferentInputPathsAreEqual() { <add> Resource resource1 = new ClassPathResource("org/springframework/core/io/Resource.class", getClass().getClassLoader()); <add> ClassPathResource resource2 = new ClassPathResource("org/springframework/core/../core/io/./Resource.class", getClass().getClassLoader()); <add> assertThat(resource2).isEqualTo(resource1); <add> } <add> <add> @Test <add> void relativeResourcesAreEqual() throws Exception { <add> Resource resource = new ClassPathResource("dir/"); <add> Resource relative = resource.createRelative("subdir"); <add> assertThat(relative).isEqualTo(new ClassPathResource("dir/subdir")); <add> } <add> <add> } <add> <ide> @Nested <ide> class GetInputStream { <ide> <ide><path>spring-core/src/test/java/org/springframework/core/io/ResourceTests.java <ide> import java.nio.channels.ReadableByteChannel; <ide> import java.nio.file.Path; <ide> import java.nio.file.Paths; <del>import java.util.HashSet; <ide> import java.util.stream.Stream; <ide> <ide> import okhttp3.mockwebserver.Dispatcher; <ide> void hasDescription() { <ide> } <ide> } <ide> <del> <del> @Nested <del> class ClassPathResourceTests { <del> <del> @Test <del> void equalsAndHashCode() { <del> Resource resource = new ClassPathResource("org/springframework/core/io/Resource.class"); <del> Resource resource2 = new ClassPathResource("org/springframework/core/../core/io/./Resource.class"); <del> Resource resource3 = new ClassPathResource("org/springframework/core/").createRelative("../core/io/./Resource.class"); <del> assertThat(resource2).isEqualTo(resource); <del> assertThat(resource3).isEqualTo(resource); <del> // Check whether equal/hashCode works in a HashSet. <del> HashSet<Resource> resources = new HashSet<>(); <del> resources.add(resource); <del> resources.add(resource2); <del> assertThat(resources.size()).isEqualTo(1); <del> } <del> <del> @Test <del> void resourcesWithDifferentPathsAreEqual() { <del> Resource resource = new ClassPathResource("org/springframework/core/io/Resource.class", getClass().getClassLoader()); <del> ClassPathResource sameResource = new ClassPathResource("org/springframework/core/../core/io/./Resource.class", getClass().getClassLoader()); <del> assertThat(sameResource).isEqualTo(resource); <del> } <del> <del> @Test <del> void relativeResourcesAreEqual() throws Exception { <del> Resource resource = new ClassPathResource("dir/"); <del> Resource relative = resource.createRelative("subdir"); <del> assertThat(relative).isEqualTo(new ClassPathResource("dir/subdir")); <del> } <del> <del> } <del> <ide> @Nested <ide> class FileSystemResourceTests { <ide>
2
Python
Python
fix a refactor leftover bug
ce47eaa84b02ca41ec87d75cb5d70eab56de43b3
<ide><path>numpy/f2py/f2py2e.py <ide> def run_main(comline_list): <ide> errmess( <ide> 'Tip: If your original code is Fortran source then you must use -m option.\n') <ide> raise TypeError('All blocks must be python module blocks but got %s' % ( <del> repr(postlist[i]['block']))) <add> repr(plist['block']))) <ide> auxfuncs.debugoptions = options['debug'] <ide> f90mod_rules.options = options <ide> auxfuncs.wrapfuncs = options['wrapfuncs']
1
Java
Java
allow focusing textinput when already focused
d4a498aba2d2843e7a741a31b0c91c6a79a7386c
<ide><path>ReactAndroid/src/androidTest/java/com/facebook/react/tests/TextInputTestCase.java <ide> import android.util.TypedValue; <ide> import android.view.View; <ide> import android.view.ViewGroup; <add>import android.view.accessibility.AccessibilityNodeInfo; <ide> import android.view.inputmethod.EditorInfo; <ide> import android.widget.EditText; <ide> import com.facebook.react.bridge.JavaScriptModule; <ide> public void testOnSubmitEditing() throws Throwable { <ide> fireEditorActionAndCheckRecording(reactEditText, EditorInfo.IME_ACTION_NONE); <ide> } <ide> <add> public void testRequestFocusDoesNothing() throws Throwable { <add> String testId = "textInput1"; <add> <add> final ReactEditText reactEditText = getViewByTestId(testId); <add> runTestOnUiThread( <add> new Runnable() { <add> @Override <add> public void run() { <add> reactEditText.clearFocus(); <add> } <add> }); <add> waitForBridgeAndUIIdle(); <add> assertFalse(reactEditText.isFocused()); <add> <add> runTestOnUiThread( <add> new Runnable() { <add> @Override <add> public void run() { <add> reactEditText.requestFocus(); <add> } <add> }); <add> waitForBridgeAndUIIdle(); <add> <add> // Calling requestFocus() directly should no-op <add> assertFalse(reactEditText.isFocused()); <add> } <add> <add> public void testRequestFocusFromJS() throws Throwable { <add> String testId = "textInput1"; <add> <add> final ReactEditText reactEditText = getViewByTestId(testId); <add> <add> runTestOnUiThread( <add> new Runnable() { <add> @Override <add> public void run() { <add> reactEditText.clearFocus(); <add> } <add> }); <add> waitForBridgeAndUIIdle(); <add> assertFalse(reactEditText.isFocused()); <add> <add> runTestOnUiThread( <add> new Runnable() { <add> @Override <add> public void run() { <add> reactEditText.requestFocusFromJS(); <add> } <add> }); <add> waitForBridgeAndUIIdle(); <add> assertTrue(reactEditText.isFocused()); <add> } <add> <add> public void testAccessibilityFocus() throws Throwable { <add> String testId = "textInput1"; <add> <add> final ReactEditText reactEditText = getViewByTestId(testId); <add> runTestOnUiThread( <add> new Runnable() { <add> @Override <add> public void run() { <add> reactEditText.clearFocus(); <add> } <add> }); <add> waitForBridgeAndUIIdle(); <add> assertFalse(reactEditText.isFocused()); <add> <add> runTestOnUiThread( <add> new Runnable() { <add> @Override <add> public void run() { <add> reactEditText.performAccessibilityAction( <add> AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS, null); <add> reactEditText.performAccessibilityAction(AccessibilityNodeInfo.ACTION_CLICK, null); <add> } <add> }); <add> waitForBridgeAndUIIdle(); <add> assertTrue(reactEditText.isFocused()); <add> <add> runTestOnUiThread( <add> new Runnable() { <add> @Override <add> public void run() { <add> reactEditText.performAccessibilityAction( <add> AccessibilityNodeInfo.ACTION_CLEAR_FOCUS, null); <add> } <add> }); <add> waitForBridgeAndUIIdle(); <add> assertFalse(reactEditText.isFocused()); <add> } <add> <ide> private void fireEditorActionAndCheckRecording( <ide> final ReactEditText reactEditText, final int actionId) throws Throwable { <ide> fireEditorActionAndCheckRecording(reactEditText, actionId, true); <ide><path>ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.java <ide> public class ReactEditText extends AppCompatEditText { <ide> // *TextChanged events should be triggered. This is less expensive than removing the text <ide> // listeners and adding them back again after the text change is completed. <ide> protected boolean mIsSettingTextFromJS; <del> // This component is controlled, so we want it to get focused only when JS ask it to do so. <del> // Whenever android requests focus, except for accessibility click, it will be ignored. <del> private boolean mShouldAllowFocus; <ide> private int mDefaultGravityHorizontal; <ide> private int mDefaultGravityVertical; <ide> <ide> public ReactEditText(Context context) { <ide> mNativeEventCount = 0; <ide> mMostRecentEventCount = 0; <ide> mIsSettingTextFromJS = false; <del> mShouldAllowFocus = false; <ide> mBlurOnSubmit = null; <ide> mDisableFullscreen = false; <ide> mListeners = null; <ide> public ReactEditText(Context context) { <ide> @Override <ide> public boolean performAccessibilityAction(View host, int action, Bundle args) { <ide> if (action == AccessibilityNodeInfo.ACTION_CLICK) { <del> mShouldAllowFocus = true; <del> requestFocus(); <del> mShouldAllowFocus = false; <del> return true; <add> return requestFocusInternal(); <ide> } <ide> return super.performAccessibilityAction(host, action, args); <ide> } <ide> public void clearFocus() { <ide> <ide> @Override <ide> public boolean requestFocus(int direction, Rect previouslyFocusedRect) { <del> // Always return true if we are already focused. This is used by android in certain places, <del> // such as text selection. <del> if (isFocused()) { <del> return true; <del> } <del> <del> if (!mShouldAllowFocus) { <del> return false; <del> } <add> // This is a no-op so that when the OS calls requestFocus(), nothing will happen. ReactEditText <add> // is a controlled component, which means its focus is controlled by JS, with two exceptions: <add> // autofocus when it's attached to the window, and responding to accessibility events. In both <add> // of these cases, we call requestFocusInternal() directly. <add> return isFocused(); <add> } <ide> <add> private boolean requestFocusInternal() { <ide> setFocusableInTouchMode(true); <del> boolean focused = super.requestFocus(direction, previouslyFocusedRect); <add> // We must explicitly call this method on the super class; if we call requestFocus() without <add> // any arguments, it will call into the overridden requestFocus(int, Rect) above, which no-ops. <add> boolean focused = super.requestFocus(View.FOCUS_DOWN, null); <ide> if (getShowSoftInputOnFocus()) { <ide> showSoftKeyboard(); <ide> } <ide> public void maybeUpdateTypeface() { <ide> <ide> // VisibleForTesting from {@link TextInputEventsTestCase}. <ide> public void requestFocusFromJS() { <del> mShouldAllowFocus = true; <del> requestFocus(); <del> mShouldAllowFocus = false; <add> requestFocusInternal(); <ide> } <ide> <ide> /* package */ void clearFocusFromJS() { <ide> public void onAttachedToWindow() { <ide> } <ide> <ide> if (mAutoFocus && !mDidAttachToWindow) { <del> mShouldAllowFocus = true; <del> requestFocus(); <del> mShouldAllowFocus = false; <add> requestFocusInternal(); <ide> } <ide> <ide> mDidAttachToWindow = true;
2
Python
Python
remove werkzeug bug workaround from flask/app.py
b6116c1de3f3556f6ae18d87348355d2545ce314
<ide><path>flask/app.py <ide> def index(): <ide> # Add the required methods now. <ide> methods |= required_methods <ide> <del> # due to a werkzeug bug we need to make sure that the defaults are <del> # None if they are an empty dictionary. This should not be necessary <del> # with Werkzeug 0.7 <del> options['defaults'] = options.get('defaults') or None <del> <ide> rule = self.url_rule_class(rule, methods=methods, **options) <ide> rule.provide_automatic_options = provide_automatic_options <ide>
1
Text
Text
drop the parens
131d2ab3ada2a079ec615b054b69400b998d6685
<ide><path>docs/creating-a-theme.md <ide> # Creating a Theme <ide> <del>Atom's interface is rendered using HTML, and it's styled via [LESS] \(a superset <del>of CSS). Don't worry if you haven't heard of LESS before; it's just like CSS, <del>but with a few handy extensions. <add>Atom's interface is rendered using HTML, and it's styled via [LESS] which is a <add>superset of CSS. Don't worry if you haven't heard of LESS before; it's just like <add>CSS, but with a few handy extensions. <ide> <ide> Atom supports two types of themes: _UI_ and _syntax_. UI themes style <ide> elements such as the tree view, the tabs, drop-down lists, and the status bar.
1
Javascript
Javascript
harden the tests and fix flow
3cf67ab859b10f7d1f4b5d939ed980ba98a49775
<ide><path>src/__tests__/store-test.js <ide> describe('Store', () => { <ide> let React; <ide> let ReactDOM; <ide> let TestUtils; <del> // let bridge; <add> let bridge; <ide> let store; <ide> let print; <ide> <ide> describe('Store', () => { <ide> }; <ide> <ide> beforeEach(() => { <del> // bridge = global.bridge; <add> bridge = global.bridge; <ide> store = global.store; <ide> <ide> React = require('react'); <ide> describe('Store', () => { <ide> ); <ide> // Verify the successful transition to steps[j]. <ide> expect(print(store)).toEqual(snapshots[j]); <add> // Check that we can transition back again. <add> act(() => <add> ReactDOM.render( <add> <Root> <add> <X /> <add> <React.Suspense fallback={z}>{steps[i]}</React.Suspense> <add> <Y /> <add> </Root>, <add> container <add> ) <add> ); <add> expect(print(store)).toEqual(snapshots[i]); <ide> // Clean up after every iteration. <ide> act(() => ReactDOM.unmountComponentAtNode(container)); <ide> expect(print(store)).toBe(''); <ide> describe('Store', () => { <ide> ); <ide> // Verify the successful transition to steps[j]. <ide> expect(print(store)).toEqual(snapshots[j]); <add> // Check that we can transition back again. <add> act(() => <add> ReactDOM.render( <add> <Root> <add> <X /> <add> <React.Suspense fallback={steps[i]}> <add> <Z /> <add> <Never /> <add> <Z /> <add> </React.Suspense> <add> <Y /> <add> </Root>, <add> container <add> ) <add> ); <add> expect(print(store)).toEqual(snapshots[i]); <ide> // Clean up after every iteration. <ide> act(() => ReactDOM.unmountComponentAtNode(container)); <ide> expect(print(store)).toBe(''); <ide> describe('Store', () => { <ide> ); <ide> // Verify the successful transition to steps[j]. <ide> expect(print(store)).toEqual(snapshots[j]); <add> // Check that we can transition back again. <add> act(() => <add> ReactDOM.render( <add> <Root> <add> <X /> <add> <React.Suspense fallback={z}>{steps[i]}</React.Suspense> <add> <Y /> <add> </Root>, <add> container <add> ) <add> ); <add> expect(print(store)).toEqual(snapshots[i]); <ide> // Clean up after every iteration. <ide> act(() => ReactDOM.unmountComponentAtNode(container)); <ide> expect(print(store)).toBe(''); <ide> describe('Store', () => { <ide> ); <ide> // Verify the successful transition to steps[j]. <ide> expect(print(store)).toEqual(snapshots[j]); <add> // Check that we can transition back again. <add> act(() => <add> ReactDOM.render( <add> <Root> <add> <X /> <add> <React.Suspense fallback={steps[i]}> <add> <Z /> <add> <Never /> <add> <Z /> <add> </React.Suspense> <add> <Y /> <add> </Root>, <add> container <add> ) <add> ); <add> expect(print(store)).toEqual(snapshots[i]); <ide> // Clean up after every iteration. <ide> act(() => ReactDOM.unmountComponentAtNode(container)); <ide> expect(print(store)).toBe(''); <ide> describe('Store', () => { <ide> expect(print(store)).toBe(''); <ide> } <ide> } <del> <del> // TODO: <del> // Test Concurrent Mode <add> // TODO: Test Concurrent Mode <ide> }); <ide> });
1
Python
Python
fix chain methods for xcomarg
eaa49b2257913c34b15408a14e445f6106e691ee
<ide><path>airflow/example_dags/example_xcomargs.py <ide> import logging <ide> <ide> from airflow import DAG <add>from airflow.operators.bash import BashOperator <ide> from airflow.operators.python import PythonOperator, get_current_context, task <ide> from airflow.utils.dates import days_ago <ide> <ide> def print_value(value): <ide> default_args={'owner': 'airflow'}, <ide> start_date=days_ago(2), <ide> schedule_interval=None, <del> tags=['example'] <add> tags=['example'], <ide> ) as dag: <ide> task1 = PythonOperator( <ide> task_id='generate_value', <ide> python_callable=generate_value, <ide> ) <ide> <ide> print_value(task1.output) <add> <add> <add>with DAG( <add> "example_xcom_args_with_operators", <add> default_args={'owner': 'airflow'}, <add> start_date=days_ago(2), <add> schedule_interval=None, <add> tags=['example'], <add>) as dag2: <add> bash_op1 = BashOperator(task_id="c", bash_command="echo c") <add> bash_op2 = BashOperator(task_id="d", bash_command="echo c") <add> xcom_args_a = print_value("first!") # type: ignore <add> xcom_args_b = print_value("second!") # type: ignore <add> <add> bash_op1 >> xcom_args_a >> xcom_args_b >> bash_op2 <ide><path>airflow/models/xcom_arg.py <ide> def __lshift__(self, other): <ide> Implements XComArg << op <ide> """ <ide> self.set_upstream(other) <del> return self <add> return other <ide> <ide> def __rshift__(self, other): <ide> """ <ide> Implements XComArg >> op <ide> """ <ide> self.set_downstream(other) <add> return other <add> <add> def __rrshift__(self, other): <add> """ <add> Called for XComArg >> [XComArg] because list don't have <add> __rshift__ operators. <add> """ <add> self.__lshift__(other) <add> return self <add> <add> def __rlshift__(self, other): <add> """ <add> Called for XComArg >> [XComArg] because list don't have <add> __lshift__ operators. <add> """ <add> self.__rshift__(other) <ide> return self <ide> <ide> def __getitem__(self, item): <ide><path>tests/models/test_xcom_arg.py <ide> def test_set_downstream(self): <ide> with DAG("test_set_downstream", default_args=DEFAULT_ARGS): <ide> op_a = BashOperator(task_id="a", bash_command="echo a") <ide> op_b = BashOperator(task_id="b", bash_command="echo b") <del> bash_op = BashOperator(task_id="c", bash_command="echo c") <add> bash_op1 = BashOperator(task_id="c", bash_command="echo c") <add> bash_op2 = BashOperator(task_id="d", bash_command="echo c") <ide> xcom_args_a = XComArg(op_a) <ide> xcom_args_b = XComArg(op_b) <ide> <del> xcom_args_a >> xcom_args_b >> bash_op <add> bash_op1 >> xcom_args_a >> xcom_args_b >> bash_op2 <ide> <del> assert len(op_a.downstream_list) == 2 <add> assert op_a in bash_op1.downstream_list <ide> assert op_b in op_a.downstream_list <del> assert bash_op in op_a.downstream_list <add> assert bash_op2 in op_b.downstream_list <ide> <ide> def test_set_upstream(self): <ide> with DAG("test_set_upstream", default_args=DEFAULT_ARGS): <ide> op_a = BashOperator(task_id="a", bash_command="echo a") <ide> op_b = BashOperator(task_id="b", bash_command="echo b") <del> bash_op = BashOperator(task_id="c", bash_command="echo c") <add> bash_op1 = BashOperator(task_id="c", bash_command="echo c") <add> bash_op2 = BashOperator(task_id="d", bash_command="echo c") <ide> xcom_args_a = XComArg(op_a) <ide> xcom_args_b = XComArg(op_b) <ide> <del> xcom_args_a << xcom_args_b << bash_op <add> bash_op1 << xcom_args_a << xcom_args_b << bash_op2 <ide> <del> assert len(op_a.upstream_list) == 2 <add> assert op_a in bash_op1.upstream_list <ide> assert op_b in op_a.upstream_list <del> assert bash_op in op_a.upstream_list <add> assert bash_op2 in op_b.upstream_list <ide> <ide> def test_xcom_arg_property_of_base_operator(self): <ide> with DAG("test_xcom_arg_property_of_base_operator", default_args=DEFAULT_ARGS):
3
Python
Python
add use_lang_emb to config
f1b018740c9355f0bcf0093fc993724eaa737445
<ide><path>pytorch_transformers/modeling_xlm.py <ide> def __init__(self, <ide> causal=False, <ide> asm=False, <ide> n_langs=1, <add> use_lang_emb=True, <ide> max_position_embeddings=512, <ide> embed_init_std=2048 ** -0.5, <ide> layer_norm_eps=1e-12, <ide> def __init__(self, <ide> self.causal = causal <ide> self.asm = asm <ide> self.n_langs = n_langs <add> self.use_lang_emb = use_lang_emb <ide> self.layer_norm_eps = layer_norm_eps <ide> self.bos_index = bos_index <ide> self.eos_index = eos_index <ide> class XLMModel(XLMPreTrainedModel): <ide> <ide> """ <ide> ATTRIBUTES = ['encoder', 'eos_index', 'pad_index', # 'with_output', <del> 'n_langs', 'n_words', 'dim', 'n_layers', 'n_heads', <add> 'n_langs', 'use_lang_emb', 'n_words', 'dim', 'n_layers', 'n_heads', <ide> 'hidden_dim', 'dropout', 'attention_dropout', 'asm', <ide> 'asm_cutoffs', 'asm_div_value'] <ide> <ide> def __init__(self, config): #, dico, is_encoder, with_output): <ide> <ide> # dictionary / languages <ide> self.n_langs = config.n_langs <add> self.use_lang_emb = config.use_lang_emb <ide> self.n_words = config.n_words <ide> self.eos_index = config.eos_index <ide> self.pad_index = config.pad_index <ide> def __init__(self, config): #, dico, is_encoder, with_output): <ide> self.position_embeddings = nn.Embedding(config.max_position_embeddings, self.dim) <ide> if config.sinusoidal_embeddings: <ide> create_sinusoidal_embeddings(config.max_position_embeddings, self.dim, out=self.position_embeddings.weight) <del> if config.n_langs > 1: <add> if config.n_langs > 1 and config.use_lang_emb: <ide> self.lang_embeddings = nn.Embedding(self.n_langs, self.dim) <ide> self.embeddings = nn.Embedding(self.n_words, self.dim, padding_idx=self.pad_index) <ide> self.layer_norm_emb = nn.LayerNorm(self.dim, eps=config.layer_norm_eps) <ide> def forward(self, input_ids, lengths=None, position_ids=None, langs=None, <ide> # embeddings <ide> tensor = self.embeddings(input_ids) <ide> tensor = tensor + self.position_embeddings(position_ids).expand_as(tensor) <del> if langs is not None: <add> if langs is not None and self.use_lang_emb: <ide> tensor = tensor + self.lang_embeddings(langs) <ide> if token_type_ids is not None: <ide> tensor = tensor + self.embeddings(token_type_ids)
1
Javascript
Javascript
fix the import path to serialize.js from ajax.js
075320149ae30a5c593c06b2fb015bdf033e0acf
<ide><path>src/ajax.js <ide> import "./core/init.js"; <ide> import "./ajax/parseXML.js"; <ide> import "./event/trigger.js"; <ide> import "./deferred.js"; <del>import "./serialize"; // jQuery.param <add>import "./serialize.js"; // jQuery.param <ide> <ide> var <ide> r20 = /%20/g,
1
Javascript
Javascript
fix error message of url.format
78182458e6055515ac342f743aacb79bd3af2edc
<ide><path>lib/url.js <ide> function urlFormat(obj, options) { <ide> obj = urlParse(obj); <ide> } else if (typeof obj !== 'object' || obj === null) { <ide> throw new TypeError('Parameter "urlObj" must be an object, not ' + <del> obj === null ? 'null' : typeof obj); <add> (obj === null ? 'null' : typeof obj)); <ide> } else if (!(obj instanceof Url)) { <ide> var format = obj[internalUrl.formatSymbol]; <ide> return format ? <ide><path>test/parallel/test-url-format-invalid-input.js <ide> require('../common'); <ide> const assert = require('assert'); <ide> const url = require('url'); <ide> <del>// https://github.com/nodejs/node/pull/1036 <del>const throws = [ <del> undefined, <del> null, <del> true, <del> false, <del> 0, <del> function() {} <del>]; <del>for (let i = 0; i < throws.length; i++) { <del> assert.throws(function() { url.format(throws[i]); }, TypeError); <add>const throwsObjsAndReportTypes = new Map([ <add> [undefined, 'undefined'], <add> [null, 'null'], <add> [true, 'boolean'], <add> [false, 'boolean'], <add> [0, 'number'], <add> [function() {}, 'function'], <add> [Symbol('foo'), 'symbol'] <add>]); <add> <add>for (const [obj, type] of throwsObjsAndReportTypes) { <add> const error = new RegExp('^TypeError: Parameter "urlObj" must be an object' + <add> `, not ${type}$`); <add> assert.throws(function() { url.format(obj); }, error); <ide> } <ide> assert.strictEqual(url.format(''), ''); <ide> assert.strictEqual(url.format({}), '');
2
Text
Text
fix multiple material blurb
b92cd9e8166c1ce2761b43094f99fcb4cd0c9597
<ide><path>threejs/lessons/threejs-textures.md <ide> It works! <ide> <ide> {{{example url="../threejs-textured-cube-6-textures.html" }}} <ide> <del>It should be noted though that by default the only geometry that supports multiple <del>materials is the `BoxGeometry` and `BoxBufferGeometry`. For other cases you will <del>need to build or load custom geometry and/or modify texture coordinates. It's far <del>more common to use a [Texture Atlas](https://en.wikipedia.org/wiki/Texture_atlas) <del>if you want to allow multiple images on a single <del>geometry. <add>It should be noted though that not all geometry types supports multiple <add>materials. `BoxGeometry` and `BoxBufferGeometry` can use 6 materials one for each face. <add>`ConeGeometry` and `ConeBufferGeometry` can use 2 materials, one for the bottom and one for the cone. <add>`CylinderGeometry` and `CylinderBufferGeometry` can use 3 materials, bottom, top, and side. <add>For other cases you will need to build or load custom geometry and/or modify texture coordinates. <add> <add>It's far more common in other 3D engines and far more performant to use a <add>[Texture Atlas](https://en.wikipedia.org/wiki/Texture_atlas) <add>if you want to allow multiple images on a single geometry. A Texture atlas <add>is where you put multiple images in a single texture and then use texture coordinates <add>on the vertices of your geometry to select which parts of a texture are used on <add>each triangle in your geometry. <ide> <ide> What are texture coordinates? They are data added to each vertex of a piece of geometry <ide> that specify what part of the texture corresponds to that specific vertex. <del>We'll go over them when we start building custom geometry. <add>We'll go over them when we start [building custom geometry](threejs-custom-geometry.html). <ide> <ide> ## <a name="loading"></a> Loading Textures <ide>
1
Go
Go
fix empty-lines (revive)
786e6d80baa3d79966d5df80f36010cc690f2871
<ide><path>integration/config/config_test.go <ide> func TestConfigList(t *testing.T) { <ide> }) <ide> assert.NilError(t, err) <ide> assert.Check(t, is.DeepEqual(configNamesFromList(entries), tc.expected)) <del> <ide> } <ide> } <ide> <ide><path>integration/container/daemon_linux_test.go <ide> func TestDaemonHostGatewayIP(t *testing.T) { <ide> assert.Check(t, is.Contains(res.Stdout(), "6.7.8.9")) <ide> c.ContainerRemove(ctx, cID, types.ContainerRemoveOptions{Force: true}) <ide> d.Stop(t) <del> <ide> } <ide> <ide> // TestRestartDaemonWithRestartingContainer simulates a case where a container is in "restarting" state when <ide><path>integration/container/logs_test.go <ide> func testLogs(t *testing.T, logDriver string) { <ide> } <ide> return <ide> } <del> <ide> } <ide> <ide> assert.DeepEqual(t, stdoutStr, tC.expectedOut) <ide><path>integration/container/restart_test.go <ide> func TestDaemonRestartKillContainers(t *testing.T) { <ide> break <ide> } <ide> time.Sleep(2 * time.Second) <del> <ide> } <ide> assert.Equal(t, expected, running, "got unexpected running state, expected %v, got: %v", expected, running) <ide> <ide> func TestContainerWithAutoRemoveCanBeRestarted(t *testing.T) { <ide> poll.WaitOn(t, testContainer.IsRemoved(ctx, cli, cID)) <ide> }) <ide> } <del> <ide> } <ide><path>integration/container/wait_test.go <ide> func TestWaitRestartedContainer(t *testing.T) { <ide> } <ide> }) <ide> } <del> <ide> } <ide><path>integration/internal/requirement/requirement_linux.go <ide> func Overlay2Supported(kernelVersion string) bool { <ide> } <ide> requiredV := kernel.VersionInfo{Kernel: 4} <ide> return kernel.CompareKernelVersion(*daemonV, requiredV) > -1 <del> <ide> } <ide><path>integration/network/service_test.go <ide> func TestDaemonDefaultNetworkPools(t *testing.T) { <ide> assert.NilError(t, err) <ide> assert.Equal(t, out.IPAM.Config[0].Subnet, "175.33.1.0/24") <ide> delInterface(t, defaultNetworkBridge) <del> <ide> } <ide> <ide> func TestDaemonRestartWithExistingNetwork(t *testing.T) { <ide> func TestServiceWithDefaultAddressPoolInit(t *testing.T) { <ide> assert.NilError(t, err) <ide> err = d.SwarmLeave(t, true) <ide> assert.NilError(t, err) <del> <ide> } <ide><path>integration/plugin/logging/read_test.go <ide> func TestReadPluginNoRead(t *testing.T) { <ide> assert.Assert(t, strings.TrimSpace(buf.String()) == "hello world", buf.Bytes()) <ide> }) <ide> } <del> <ide> } <ide><path>integration/secret/secret_test.go <ide> func TestSecretList(t *testing.T) { <ide> }) <ide> assert.NilError(t, err) <ide> assert.Check(t, is.DeepEqual(secretNamesFromList(entries), tc.expected)) <del> <ide> } <ide> } <ide> <ide><path>integration/service/create_test.go <ide> func TestCreateServiceSysctls(t *testing.T) { <ide> // net.ipv4.ip_nonlocal_bind is, we can verify that setting the sysctl <ide> // options works <ide> for _, expected := range []string{"0", "1"} { <del> <ide> // store the map we're going to be using everywhere. <ide> expectedSysctls := map[string]string{"net.ipv4.ip_nonlocal_bind": expected} <ide> <ide><path>integration/service/list_test.go <ide> func TestServiceListWithStatuses(t *testing.T) { <ide> assert.Check(t, is.Equal(service.ServiceStatus.DesiredTasks, replicas)) <ide> assert.Check(t, is.Equal(service.ServiceStatus.RunningTasks, replicas)) <ide> } <del> <ide> } <ide><path>integration/system/event_test.go <ide> func TestEventsExecDie(t *testing.T) { <ide> case <-time.After(time.Second * 3): <ide> t.Fatal("timeout hit") <ide> } <del> <ide> } <ide> <ide> // Test case for #18888: Events messages have been switched from generic
12
Javascript
Javascript
fix e2e runner tests
8e6ecd98ae5ef24a7398aee19c006b9dda5385ff
<ide><path>test/scenario/dslSpec.js <ide> describe("angular.scenario.dsl", function() { <ide> }; <ide> $window.angular.scope = function() { <ide> return { <del> $location: { <del> hashSearch: {x: 2}, <del> hashPath: '/bar', <del> search: {foo: 10} <add> $service: function(serviceId) { <add> if (serviceId == '$location') { <add> return { <add> hashSearch: {x: 2}, <add> hashPath: '/bar', <add> search: {foo: 10} <add> } <add> } else { <add> throw new Error('unknown service id ' + serviceId); <add> } <ide> } <ide> }; <ide> };
1
Mixed
Text
replace travis ci mentions with github actions
37bc6bdebf159d395b559dd7094934a337d59c8a
<ide><path>CONTRIBUTING.md <ide> __Improving comments__ and __writing proper tests__ are also highly welcome. <ide> <ide> We appreciate any contribution, from fixing a grammar mistake in a comment to implementing complex algorithms. Please read this section if you are contributing your work. <ide> <del>Your contribution will be tested by our [automated testing on Travis CI](https://travis-ci.org/TheAlgorithms/Python/pull_requests) to save time and mental energy. After you have submitted your pull request, you should see the Travis tests start to run at the bottom of your submission page. If those tests fail, then click on the ___details___ button try to read through the Travis output to understand the failure. If you do not understand, please leave a comment on your submission page and a community member will try to help. <add>Your contribution will be tested by our [automated testing on GitHub Actions](https://github.com/TheAlgorithms/Python/actions) to save time and mental energy. After you have submitted your pull request, you should see the GitHub Actions tests start to run at the bottom of your submission page. If those tests fail, then click on the ___details___ button try to read through the GitHub Actions output to understand the failure. If you do not understand, please leave a comment on your submission page and a community member will try to help. <ide> <ide> Please help us keep our issue list small by adding fixes: #{$ISSUE_NO} to the commit message of pull requests that resolve open issues. GitHub will use this tag to auto-close the issue when the PR is merged. <ide> <ide> We want your work to be readable by others; therefore, we encourage you to note <ide> - If possible, follow the standard *within* the folder you are submitting to. <ide> - If you have modified/added code work, make sure the code compiles before submitting. <ide> - If you have modified/added documentation work, ensure your language is concise and contains no grammar errors. <del>- Do not update the README.md or DIRECTORY.md file which will be periodically autogenerated by our Travis CI processes. <add>- Do not update the README.md or DIRECTORY.md file which will be periodically autogenerated by our GitHub Actions processes. <ide> - Add a corresponding explanation to [Algorithms-Explanation](https://github.com/TheAlgorithms/Algorithms-Explanation) (Optional but recommended). <ide> - All submissions will be tested with [__mypy__](http://www.mypy-lang.org) so we encourage you to add [__Python type hints__](https://docs.python.org/3/library/typing.html) where it makes sense to do so. <ide> <ide><path>project_euler/README.md <ide> Problems are taken from https://projecteuler.net/, the Project Euler. [Problems <ide> Project Euler is a series of challenging mathematical/computer programming problems that require more than just mathematical <ide> insights to solve. Project Euler is ideal for mathematicians who are learning to code. <ide> <del>The solutions will be checked by our [automated testing on Travis CI](https://travis-ci.com/github/TheAlgorithms/Python/pull_requests) with the help of [this script](https://github.com/TheAlgorithms/Python/blob/master/scripts/validate_solutions.py). The efficiency of your code is also checked. You can view the top 10 slowest solutions on Travis CI logs (under `slowest 10 durations`) and open a pull request to improve those solutions. <add>The solutions will be checked by our [automated testing on GitHub Actions](https://github.com/TheAlgorithms/Python/actions) with the help of [this script](https://github.com/TheAlgorithms/Python/blob/master/scripts/validate_solutions.py). The efficiency of your code is also checked. You can view the top 10 slowest solutions on GitHub Actions logs (under `slowest 10 durations`) and open a pull request to improve those solutions. <ide> <ide> <ide> ## Solution Guidelines <ide> Welcome to [TheAlgorithms/Python](https://github.com/TheAlgorithms/Python)! Befo <ide> * When the `solution` function is called without any arguments like so: `solution()`, it should return the answer to the problem. <ide> <ide> * Every function, which includes all the helper functions, if any, and the main solution function, should have `doctest` in the function docstring along with a brief statement mentioning what the function is about. <del> * There should not be a `doctest` for testing the answer as that is done by our Travis CI build using this [script](https://github.com/TheAlgorithms/Python/blob/master/scripts/validate_solutions.py). Keeping in mind the above example of [Problem 1](https://projecteuler.net/problem=1): <add> * There should not be a `doctest` for testing the answer as that is done by our GitHub Actions build using this [script](https://github.com/TheAlgorithms/Python/blob/master/scripts/validate_solutions.py). Keeping in mind the above example of [Problem 1](https://projecteuler.net/problem=1): <ide> <ide> ```python <ide> def solution(limit: int = 1000): <ide><path>project_euler/problem_012/sol2.py <ide> def solution(): <ide> """Returns the value of the first triangle number to have over five hundred <ide> divisors. <ide> <del> # The code below has been commented due to slow execution affecting Travis. <del> # >>> solution() <del> # 76576500 <add> >>> solution() <add> 76576500 <ide> """ <ide> return next(i for i in triangle_number_generator() if count_divisors(i) > 500) <ide>
3
Javascript
Javascript
fix lint warning in logger
68f085a2b6177dc4c698015887613e6a9b55eca7
<ide><path>packager/react-packager/src/Logger/index.js <ide> */ <ide> 'use strict'; <ide> <add>const chalk = require('chalk'); <add>const os = require('os'); <add> <add>const {EventEmitter} = require('events'); <add> <ide> import type { <ide> ActionLogEntryData, <ide> ActionStartLogEntry, <ide> LogEntry, <ide> } from './Types'; <ide> <del>const {EventEmitter} = require('events'); <del> <del>const chalk = require('chalk'); <del>const os = require('os'); <del> <ide> let PRINT_LOG_ENTRIES = true; <ide> const log_session = `${os.hostname()}-${Date.now()}`; <ide> const eventEmitter = new EventEmitter();
1
Ruby
Ruby
float comparison adjustment
387036609268c4cf68401a1333715f2ee4aecffc
<ide><path>activesupport/test/notifications_test.rb <ide> def test_events_are_initialized_with_details <ide> <ide> assert_equal :foo, event.name <ide> assert_equal time, event.time <del> assert_in_delta 10.0, event.duration, 0.00000000000001 <add> assert_in_delta 10.0, event.duration, 0.00001 <ide> end <ide> <ide> def test_events_consumes_information_given_as_payload
1
Python
Python
add regression test for binary_repr
6ede27f974dc49705dfca697a9e9542537f14a2d
<ide><path>numpy/core/tests/test_regression.py <ide> def check_mem_scalar_indexing(self, level=rlevel): <ide> index = N.array(0,dtype=N.int32) <ide> x[index] <ide> <add> def check_binary_repr_0_width(self, level=rlevel): <add> assert_equal(N.binary_repr(0,width=3),'000') <ide> <ide> if __name__ == "__main__": <ide> NumpyTest().run()
1
Javascript
Javascript
set host of development server for setupdevtools
fa574c60920588e29d7b642e547e240ac8655e66
<ide><path>Libraries/Core/Devtools/setupDevtools.js <ide> let register = function () { <ide> if (__DEV__) { <ide> const AppState = require('AppState'); <ide> const WebSocket = require('WebSocket'); <del> const {PlatformConstants} = require('NativeModules'); <ide> /* $FlowFixMe(>=0.54.0 site=react_native_oss) This comment suppresses an <ide> * error found when Flow v0.54 was deployed. To see the error delete this <ide> * comment and run Flow. */ <ide> const reactDevTools = require('react-devtools-core'); <add> const getDevServer = require('getDevServer'); <ide> <ide> // Initialize dev tools only if the native module for WebSocket is available <ide> if (WebSocket.isAvailable) { <ide> if (__DEV__) { <ide> // or the code will throw for bundles that don't have it. <ide> const isAppActive = () => AppState.currentState !== 'background'; <ide> <del> // Special case: Genymotion is running on a different host. <del> const host = PlatformConstants && PlatformConstants.ServerHost ? <del> PlatformConstants.ServerHost.split(':')[0] : <del> 'localhost'; <add> // Get hostname from development server (packager) <add> const devServer = getDevServer(); <add> const host = devServer.bundleLoadedFromServer <add> ? devServer.url.replace(/https?:\/\//, '').split(':')[0] <add> : 'localhost'; <ide> <ide> reactDevTools.connectToDevTools({ <ide> isAppActive,
1
Ruby
Ruby
fix some formatting
1b276d53fb15a42025d5eeaca1bcd1b837a5dc53
<ide><path>activerecord/lib/active_record/schema_dumper.rb <ide> def table(table, stream) <ide> end.compact <ide> <ide> # find all migration keys used in this table <del> keys = [:name, :limit, :precision, :scale, :default, :null] & column_specs.map{ |k| k.keys }.flatten <add> keys = [:name, :limit, :precision, :scale, :default, :null] & column_specs.map(&:keys).flatten <ide> <ide> # figure out the lengths for each column based on above keys <del> lengths = keys.map{ |key| column_specs.map{ |spec| spec[key] ? spec[key].length + 2 : 0 }.max } <add> lengths = keys.map { |key| <add> column_specs.map { |spec| <add> spec[key] ? spec[key].length + 2 : 0 <add> }.max <add> } <ide> <ide> # the string we're going to sprintf our values against, with standardized column widths <ide> format_string = lengths.map{ |len| "%-#{len}s" }
1
Javascript
Javascript
add trello and blogger apis back in
a1ffc88b58b677b416725bc59ebfd7a572af71ff
<ide><path>app.js <ide> app.get('/account/api', userController.getAccountAngular); <ide> */ <ide> <ide> app.get('/api/github', resourcesController.githubCalls); <add>app.get('/api/blogger', resourcesController.bloggerCalls); <add>app.get('/api/trello', resourcesController.trelloCalls); <ide> <ide> /** <ide> * Bonfire related routes <ide><path>controllers/resources.js <ide> module.exports = { <ide> }); <ide> }, <ide> <add> trelloCalls: function(req, res, next) { <add> request('https://trello.com/1/boards/BA3xVpz9/cards?key=' + secrets.trello.key, function(err, status, trello) { <add> if (err) { return next(err); } <add> trello = (status && status.statusCode == 200) ? (JSON.parse(trello)) : "Can't connect to to Trello"; <add> res.end(JSON.stringify(trello)); <add> }); <add> }, <add> bloggerCalls: function(req, res, next) { <add> request('https://www.googleapis.com/blogger/v3/blogs/2421288658305323950/posts?key=' + secrets.blogger.key, function (err, status, blog) { <add> if (err) { return next(err); } <add> blog = (status && status.statusCode == 200) ? JSON.parse(blog) : "Can't connect to Blogger"; <add> res.end(JSON.stringify(blog)); <add> }); <add> }, <add> <ide> about: function(req, res, next) { <ide> if (req.user) { <ide> if (!req.user.profile.picture || req.user.profile.picture === "https://s3.amazonaws.com/freecodecamp/favicons/apple-touch-icon-180x180.png") {
2
Python
Python
use isinstance() for type check
758edc60b3f284a997bf04904338532d81a5785a
<ide><path>glances/exports/glances_csv.py <ide> def update(self, stats): <ide> i = 0 <ide> for plugin in plugins: <ide> if plugin in self.plugins_to_export(): <del> if type(all_stats[i]) is list: <add> if isinstance(all_stats[i], list): <ide> for item in all_stats[i]: <ide> # First line: header <ide> if self.first_line: <ide> csv_header += map(lambda x: plugin + '_' + item[item['key']] + '_' + x, item) <ide> # Others lines: stats <ide> fieldvalues = item.values() <ide> csv_data += fieldvalues <del> elif type(all_stats[i]) is dict: <add> elif isinstance(all_stats[i], dict): <ide> # First line: header <ide> if self.first_line: <ide> fieldnames = all_stats[i].keys() <ide><path>glances/exports/glances_export.py <ide> def update(self, stats): <ide> # Loop over available plugins <ide> for i, plugin in enumerate(plugins): <ide> if plugin in self.plugins_to_export(): <del> if type(all_stats[i]) is list: <add> if isinstance(all_stats[i], list): <ide> for item in all_stats[i]: <ide> item.update(all_limits[i]) <ide> export_names = list(map(lambda x: item[item['key']] + '.' + x, item.keys())) <ide> export_values = list(item.values()) <ide> self.export(plugin, export_names, export_values) <del> elif type(all_stats[i]) is dict: <add> elif isinstance(all_stats[i], dict): <ide> export_names = list(all_stats[i].keys()) + list(all_limits[i].keys()) <ide> export_values = list(all_stats[i].values()) + list(all_limits[i].values()) <ide> self.export(plugin, export_names, export_values) <ide><path>glances/plugins/glances_plugin.py <ide> def update_stats_history(self, item_name=''): <ide> self.get_items_history_list() is not None): <ide> self.add_item_history('date', datetime.now()) <ide> for i in self.get_items_history_list(): <del> if type(self.stats) is list: <add> if isinstance(self.stats, list): <ide> # Stats is a list of data <ide> # Iter throught it (for exemple, iter throught network <ide> # interface) <ide> def get_stats_item(self, item): <ide> <ide> Stats should be a list of dict (processlist, network...) <ide> """ <del> if type(self.stats) is not list: <del> if type(self.stats) is dict: <del> try: <del> return json.dumps({item: self.stats[item]}) <del> except KeyError as e: <del> logger.error("Cannot get item {0} ({1})".format(item, e)) <del> else: <add> if isinstance(self.stats, dict): <add> try: <add> return json.dumps({item: self.stats[item]}) <add> except KeyError as e: <add> logger.error("Cannot get item {0} ({1})".format(item, e)) <ide> return None <del> else: <add> elif isinstance(self.stats, list): <ide> try: <ide> # Source: <ide> # http://stackoverflow.com/questions/4573875/python-get-index-of-dictionary-item-in-list <ide> return json.dumps({item: map(itemgetter(item), self.stats)}) <ide> except (KeyError, ValueError) as e: <ide> logger.error("Cannot get item {0} ({1})".format(item, e)) <ide> return None <add> else: <add> return None <ide> <ide> def get_stats_value(self, item, value): <ide> """Return the stats object for a specific item=value in JSON format. <ide> <ide> Stats should be a list of dict (processlist, network...) <ide> """ <del> if type(self.stats) is not list: <add> if not isinstance(self.stats, list): <ide> return None <ide> else: <ide> if value.isdigit(): <ide> def update_views(self): <ide> """ <ide> ret = {} <ide> <del> if type(self.get_raw()) is list and self.get_raw() is not None and self.get_key() is not None: <add> if (isinstance(self.get_raw(), list) and <add> self.get_raw() is not None and <add> self.get_key() is not None): <ide> # Stats are stored in a list of dict (ex: NETWORK, FS...) <ide> for i in self.get_raw(): <ide> ret[i[self.get_key()]] = {} <ide> def update_views(self): <ide> 'additional': False, <ide> 'splittable': False} <ide> ret[i[self.get_key()]][key] = value <del> elif type(self.get_raw()) is dict and self.get_raw() is not None: <add> elif isinstance(self.get_raw(), dict) and self.get_raw() is not None: <ide> # Stats are stored in a dict (ex: CPU, LOAD...) <ide> for key in self.get_raw().keys(): <ide> value = {'decoration': 'DEFAULT', <ide> def get_alert(self, current=0, minimum=0, maximum=100, header="", log=False): <ide> else: <ide> # A command line is available for the current alert, run it <ide> # Build the {{mustache}} dictionnary <del> if type(self.stats) is list: <add> if isinstance(self.stats, list): <ide> # If the stats are stored in a list of dict (fs plugin for exemple) <ide> # Return the dict for the current header <ide> mustache_dict = {}
3
Text
Text
add section od querying data
fcfbb61f27fbbf65e84be9b53290de34bc4ea8b8
<ide><path>guide/english/gatsbyjs/index.md <ide> Gatsby deploys the site on a static web host such as Amazon S3, Netlify, Github <ide> * To generate the static HTML pages use `gatsby build` <ide> * `gatsby serve` will start a local server that will present your built site. <ide> <del>### More Information: <add>### Querying data <add> <add>You are accessing all data by writing GraphQL queries. GraphQL allows you to pull only the data you need into your components, unlike when fetching data from REST API. A detailed walktrough is available at https://www.gatsbyjs.org/tutorial/part-four/?no-cache=1#how-gatsbys-data-layer-uses-graphql-to-pull-data-into-components. <add> <add>#### More Information: <add> <ide> For tutorials and more information check out the Gatsby.js official site: [Gatsby.js official site](https://www.gatsbyjs.org/tutorial/)
1
Ruby
Ruby
add nodoc to relation methods
c47a698d5d497340d4e349257522212173865838
<ide><path>activerecord/lib/active_record/relation/query_methods.rb <ide> def #{name}_value=(value) # def readonly_value=(value) <ide> CODE <ide> end <ide> <del> def create_with_value <add> def create_with_value #:nodoc: <ide> @values[:create_with] || {} <ide> end <ide> <ide> def includes(*args) <ide> args.empty? ? self : spawn.includes!(*args) <ide> end <ide> <del> def includes!(*args) <add> def includes!(*args) #:nodoc: <ide> args.reject! {|a| a.blank? } <ide> <ide> self.includes_values = (includes_values + args).flatten.uniq <ide> def eager_load(*args) <ide> args.blank? ? self : spawn.eager_load!(*args) <ide> end <ide> <del> def eager_load!(*args) <add> def eager_load!(*args) #:nodoc: <ide> self.eager_load_values += args <ide> self <ide> end <ide> def preload(*args) <ide> args.blank? ? self : spawn.preload!(*args) <ide> end <ide> <del> def preload!(*args) <add> def preload!(*args) #:nodoc: <ide> self.preload_values += args <ide> self <ide> end <ide> def references(*args) <ide> args.blank? ? self : spawn.references!(*args) <ide> end <ide> <del> def references!(*args) <add> def references!(*args) #:nodoc: <ide> args.flatten! <ide> <ide> self.references_values = (references_values + args.map!(&:to_s)).uniq <ide> def select(value = Proc.new) <ide> end <ide> end <ide> <del> def select!(value) <add> def select!(value) #:nodoc: <ide> self.select_values += Array.wrap(value) <ide> self <ide> end <ide> def group(*args) <ide> args.blank? ? self : spawn.group!(*args) <ide> end <ide> <del> def group!(*args) <add> def group!(*args) #:nodoc: <ide> args.flatten! <ide> <ide> self.group_values += args <ide> def order(*args) <ide> args.blank? ? self : spawn.order!(*args) <ide> end <ide> <del> def order!(*args) <add> def order!(*args) #:nodoc: <ide> args.flatten! <ide> <ide> references = args.reject { |arg| Arel::Node === arg } <ide> def reorder(*args) <ide> args.blank? ? self : spawn.reorder!(*args) <ide> end <ide> <del> def reorder!(*args) <add> def reorder!(*args) #:nodoc: <ide> args.flatten! <ide> <ide> self.reordering_value = true <ide> def joins(*args) <ide> args.compact.blank? ? self : spawn.joins!(*args) <ide> end <ide> <del> def joins!(*args) <add> def joins!(*args) #:nodoc: <ide> args.flatten! <ide> <ide> self.joins_values += args <ide> def bind(value) <ide> spawn.bind!(value) <ide> end <ide> <del> def bind!(value) <add> def bind!(value) #:nodoc: <ide> self.bind_values += [value] <ide> self <ide> end <ide> def where(opts, *rest) <ide> opts.blank? ? self : spawn.where!(opts, *rest) <ide> end <ide> <del> # #where! is identical to #where, except that instead of returning a new relation, it adds <del> # the condition to the existing relation. <del> def where!(opts, *rest) <add> def where!(opts, *rest) #:nodoc: <ide> references!(PredicateBuilder.references(opts)) if Hash === opts <ide> <ide> self.where_values += build_where(opts, rest) <ide> def having(opts, *rest) <ide> opts.blank? ? self : spawn.having!(opts, *rest) <ide> end <ide> <del> def having!(opts, *rest) <add> def having!(opts, *rest) #:nodoc: <ide> references!(PredicateBuilder.references(opts)) if Hash === opts <ide> <ide> self.having_values += build_where(opts, rest) <ide> def limit(value) <ide> spawn.limit!(value) <ide> end <ide> <del> def limit!(value) <add> def limit!(value) #:nodoc: <ide> self.limit_value = value <ide> self <ide> end <ide> def offset(value) <ide> spawn.offset!(value) <ide> end <ide> <del> def offset!(value) <add> def offset!(value) #:nodoc: <ide> self.offset_value = value <ide> self <ide> end <ide> def lock(locks = true) <ide> spawn.lock!(locks) <ide> end <ide> <del> def lock!(locks = true) <add> def lock!(locks = true) #:nodoc: <ide> case locks <ide> when String, TrueClass, NilClass <ide> self.lock_value = locks || true <ide> def readonly(value = true) <ide> spawn.readonly!(value) <ide> end <ide> <del> def readonly!(value = true) <add> def readonly!(value = true) #:nodoc: <ide> self.readonly_value = value <ide> self <ide> end <ide> def create_with(value) <ide> spawn.create_with!(value) <ide> end <ide> <del> def create_with!(value) <add> def create_with!(value) #:nodoc: <ide> self.create_with_value = value ? create_with_value.merge(value) : {} <ide> self <ide> end <ide> def from(value, subquery_name = nil) <ide> spawn.from!(value, subquery_name) <ide> end <ide> <del> def from!(value, subquery_name = nil) <add> def from!(value, subquery_name = nil) #:nodoc: <ide> self.from_value = [value, subquery_name] <ide> self <ide> end <ide> def uniq(value = true) <ide> spawn.uniq!(value) <ide> end <ide> <del> def uniq!(value = true) <add> def uniq!(value = true) #:nodoc: <ide> self.uniq_value = value <ide> self <ide> end <ide> def extending(*modules, &block) <ide> end <ide> end <ide> <del> def extending!(*modules, &block) <add> def extending!(*modules, &block) #:nodoc: <ide> modules << Module.new(&block) if block_given? <ide> <ide> self.extending_values = modules.flatten <ide> def reverse_order <ide> spawn.reverse_order! <ide> end <ide> <del> def reverse_order! <add> def reverse_order! #:nodoc: <ide> self.reverse_order_value = !reverse_order_value <ide> self <ide> end
1
PHP
PHP
render exception with symfony console
99ed94ecc82c9424825f697513aaf4dd12288577
<ide><path>src/Illuminate/Foundation/Exceptions/Handler.php <ide> use Exception; <ide> use Psr\Log\LoggerInterface; <ide> use Symfony\Component\HttpKernel\Exception\HttpException; <add>use Symfony\Component\Console\Application as ConsoleApplication; <ide> use Symfony\Component\Debug\ExceptionHandler as SymfonyDisplayer; <ide> use Illuminate\Contracts\Debug\ExceptionHandler as ExceptionHandlerContract; <ide> <ide> public function render($request, Exception $e) <ide> */ <ide> public function renderForConsole($output, Exception $e) <ide> { <del> $output->writeln((string) $e); <add> (new ConsoleApplication)->renderException($e, $output); <ide> } <ide> <ide> /**
1
Text
Text
use links to ms guide in style guide
b93325cb267e4bb55387b2158140542438a3c371
<ide><path>doc/guides/doc-style-guide.md <ide> this guide. <ide> * `.editorconfig` describes the preferred formatting. <ide> * A [plugin][] is available for some editors to apply these rules. <ide> * Check changes to documentation with `make lint-md`. <del>* Use American English spelling. <del> * OK: _capitalize_, _color_ <del> * NOT OK: _capitalise_, _colour_ <del>* Use [serial commas][]. <add>* [Use US spelling][]. <add>* [Use serial commas][]. <ide> * Avoid personal pronouns (_I_, _you_, _we_) in reference documentation. <ide> * Personal pronouns are acceptable in colloquial documentation such as guides. <ide> * Use gender-neutral pronouns and gender-neutral plural nouns. <ide> this guide. <ide> * Use _Node.js_ and not _Node_, _NodeJS_, or similar variants. <ide> <!-- lint enable prohibited-strings remark-lint--> <ide> * When referring to the executable, _`node`_ is acceptable. <del>* Be direct. <del> * OK: The return value is a string. <del> <!-- lint disable prohibited-strings remark-lint--> <del> * NOT OK: It is important to note that, in all cases, the return value will be <del> a string regardless. <add>* [Be direct][]. <add><!-- lint disable prohibited-strings remark-lint--> <ide> * When referring to a version of Node.js in prose, use _Node.js_ and the version <ide> number. Do not prefix the version number with _v_ in prose. This is to avoid <ide> confusion about whether _v8_ refers to Node.js 8.x or the V8 JavaScript <ide> engine. <ide> <!-- lint enable prohibited-strings remark-lint--> <ide> * OK: _Node.js 14.x_, _Node.js 14.3.1_ <ide> * NOT OK: _Node.js v14_ <del>* For headings, use sentence case, not title case. <del> * OK: _## Everybody to the limit_ <del> * NOT OK: _## Everybody To The Limit_ <add>* [Use sentence-style capitalization for headings][]. <ide> <ide> See also API documentation structure overview in [doctools README][]. <ide> <ide> For topics not covered here, refer to the [Microsoft Writing Style Guide][]. <ide> <add>[Be direct]: https://docs.microsoft.com/en-us/style-guide/word-choice/use-simple-words-concise-sentences <ide> [Javascript type]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Grammar_and_types#Data_structures_and_types <ide> [Microsoft Writing Style Guide]: https://docs.microsoft.com/en-us/style-guide/welcome/ <add>[Use US spelling]: https://docs.microsoft.com/en-us/style-guide/word-choice/use-us-spelling-avoid-non-english-words <add>[Use sentence-style capitalization for headings]: https://docs.microsoft.com/en-us/style-guide/scannable-content/headings#formatting-headings <add>[Use serial commas]: https://docs.microsoft.com/en-us/style-guide/punctuation/commas <ide> [`remark-preset-lint-node`]: https://github.com/nodejs/remark-preset-lint-node <ide> [doctools README]: ../../tools/doc/README.md <ide> [info string]: https://github.github.com/gfm/#info-string <ide> [language]: https://github.com/highlightjs/highlight.js/blob/master/SUPPORTED_LANGUAGES.md <ide> [plugin]: https://editorconfig.org/#download <del>[serial commas]: https://en.wikipedia.org/wiki/Serial_comma
1
Javascript
Javascript
add namedchunksplugin as a exposed plugin
9bfae7e1c8e9d457c27d8f519460c8f0abc6cb6b
<ide><path>lib/webpack.js <ide> exportPlugins(exports, ".", [ <ide> "DllReferencePlugin", <ide> "LoaderOptionsPlugin", <ide> "NamedModulesPlugin", <add> "NamedChunksPlugin", <ide> "HashedModuleIdsPlugin", <ide> "ModuleFilenameHelpers" <ide> ]);
1
PHP
PHP
add toggle() method to belongstomany relation
5c170ad2b9560344cf7b7ab76e800c1c31dfc8b9
<ide><path>src/Illuminate/Database/Eloquent/Relations/BelongsToMany.php <ide> public function sync($ids, $detaching = true) <ide> // if they exist in the array of current ones, and if not we will insert. <ide> $current = $this->newPivotQuery()->pluck($this->otherKey)->all(); <ide> <del> $records = $this->formatSyncList($ids); <add> $records = $this->formatRecordsList($ids); <ide> <ide> $detach = array_diff($current, array_keys($records)); <ide> <ide> public function sync($ids, $detaching = true) <ide> } <ide> <ide> /** <del> * Format the sync list so that it is keyed by ID. <add> * Format the sync/toggle list so that it is keyed by ID. <ide> * <ide> * @param array $records <ide> * @return array <ide> */ <del> protected function formatSyncList(array $records) <add> protected function formatRecordsList(array $records) <ide> { <ide> $results = []; <ide> <ide> protected function touchingParent() <ide> return $this->getRelated()->touches($this->guessInverseRelation()); <ide> } <ide> <add> /** <add> * Toggles a model (or models) from the parent. <add> * <add> * Each existing model is detached, and non existing ones are attached. <add> * <add> * @param mixed $ids <add> * @return array <add> */ <add> public function toggle($ids) <add> { <add> $changes = [ <add> 'attached' => [], 'detached' => [], <add> ]; <add> <add> if ($ids instanceof Model) { <add> $ids = $ids->getKey(); <add> } <add> <add> if ($ids instanceof Collection) { <add> $ids = $ids->modelKeys(); <add> } <add> <add> // First, we need to know which are the currently associated models. <add> $current = $this->newPivotQuery()->pluck($this->otherKey)->all(); <add> <add> $records = $this->formatRecordsList((array) $ids); <add> <add> // Next, we will take the intersection of the currents and given records, <add> // and detach all of the entities that are in the common in "current" <add> // array and in the array of the new records. <add> $detach = array_values(array_intersect($current, array_keys($records))); <add> <add> if (count($detach) > 0) { <add> $this->detach($detach, false); <add> <add> $changes['detached'] = (array) array_map(function ($v) { <add> return is_numeric($v) ? (int) $v : (string) $v; <add> }, $detach); <add> } <add> <add> // Finally, we attach the remaining records (those have not been detached <add> // and not are in the "current" array) <add> $attach = array_diff_key($records, array_flip($detach)); <add> <add> if (count($attach) > 0) { <add> $this->attach($attach, [], false); <add> <add> $changes['attached'] = array_keys($attach); <add> } <add> <add> if (count($changes['attached']) || count($changes['detached'])) { <add> $this->touchIfTouching(); <add> } <add> <add> return $changes; <add> } <add> <ide> /** <ide> * Attempt to guess the name of the inverse of the relation. <ide> * <ide><path>tests/Database/DatabaseEloquentBelongsToManyTest.php <ide> public function testTouchMethodSyncsTimestamps() <ide> $relation->touch(); <ide> } <ide> <add> /** <add> * @dataProvider toggleMethodListProvider <add> */ <add> public function testToggleMethodTogglesIntermediateTableWithGivenArray($list) <add> { <add> $relation = $this->getMockBuilder('Illuminate\Database\Eloquent\Relations\BelongsToMany')->setMethods(['attach', 'detach'])->setConstructorArgs($this->getRelationArguments())->getMock(); <add> $query = m::mock('stdClass'); <add> $query->shouldReceive('from')->once()->with('user_role')->andReturn($query); <add> $query->shouldReceive('where')->once()->with('user_id', 1)->andReturn($query); <add> $relation->getQuery()->shouldReceive('getQuery')->andReturn($mockQueryBuilder = m::mock('StdClass')); <add> $mockQueryBuilder->shouldReceive('newQuery')->once()->andReturn($query); <add> $query->shouldReceive('pluck')->once()->with('role_id')->andReturn(new BaseCollection([1, 2, 3])); <add> $relation->expects($this->once())->method('attach')->with($this->equalTo(['x' => []]), $this->equalTo([]), $this->equalTo(false)); <add> $relation->expects($this->once())->method('detach')->with($this->equalTo([2, 3])); <add> $relation->getRelated()->shouldReceive('touches')->andReturn(false); <add> $relation->getParent()->shouldReceive('touches')->andReturn(false); <add> <add> $this->assertEquals(['attached' => ['x'], 'detached' => [2, 3]], $relation->toggle($list)); <add> } <add> <add> public function toggleMethodListProvider() <add> { <add> return [ <add> [[2, 3, 'x']], <add> [['2', '3', 'x']], <add> ]; <add> } <add> <add> public function testToggleMethodTogglesIntermediateTableWithGivenArrayAndAttributes() <add> { <add> $relation = $this->getMockBuilder('Illuminate\Database\Eloquent\Relations\BelongsToMany')->setMethods(['attach', 'detach', 'touchIfTouching', 'updateExistingPivot'])->setConstructorArgs($this->getRelationArguments())->getMock(); <add> $query = m::mock('stdClass'); <add> $query->shouldReceive('from')->once()->with('user_role')->andReturn($query); <add> $query->shouldReceive('where')->once()->with('user_id', 1)->andReturn($query); <add> $relation->getQuery()->shouldReceive('getQuery')->andReturn($mockQueryBuilder = m::mock('StdClass')); <add> $mockQueryBuilder->shouldReceive('newQuery')->once()->andReturn($query); <add> $query->shouldReceive('pluck')->once()->with('role_id')->andReturn(new BaseCollection([1, 2, 3])); <add> $relation->expects($this->once())->method('attach')->with($this->equalTo([4 => ['foo' => 'bar']]), [], $this->equalTo(false)); <add> $relation->expects($this->once())->method('detach')->with($this->equalTo([2, 3])); <add> $relation->expects($this->once())->method('touchIfTouching'); <add> <add> $this->assertEquals(['attached' => [4], 'detached' => [2, 3]], $relation->toggle([2, 3, 4 => ['foo' => 'bar']])); <add> } <add> <ide> public function testTouchIfTouching() <ide> { <ide> $relation = $this->getMockBuilder('Illuminate\Database\Eloquent\Relations\BelongsToMany')->setMethods(['touch', 'touchingParent'])->setConstructorArgs($this->getRelationArguments())->getMock(); <ide> public function testTouchIfTouching() <ide> <ide> public function testSyncMethodConvertsCollectionToArrayOfKeys() <ide> { <del> $relation = $this->getMockBuilder('Illuminate\Database\Eloquent\Relations\BelongsToMany')->setMethods(['attach', 'detach', 'touchIfTouching', 'formatSyncList'])->setConstructorArgs($this->getRelationArguments())->getMock(); <add> $relation = $this->getMockBuilder('Illuminate\Database\Eloquent\Relations\BelongsToMany')->setMethods(['attach', 'detach', 'touchIfTouching', 'formatRecordsList'])->setConstructorArgs($this->getRelationArguments())->getMock(); <ide> $query = m::mock('stdClass'); <ide> $query->shouldReceive('from')->once()->with('user_role')->andReturn($query); <ide> $query->shouldReceive('where')->once()->with('user_id', 1)->andReturn($query); <ide> public function testSyncMethodConvertsCollectionToArrayOfKeys() <ide> m::mock(['getKey' => 2]), <ide> m::mock(['getKey' => 3]), <ide> ]); <del> $relation->expects($this->once())->method('formatSyncList')->with([1, 2, 3])->will($this->returnValue([1 => [], 2 => [], 3 => []])); <add> $relation->expects($this->once())->method('formatRecordsList')->with([1, 2, 3])->will($this->returnValue([1 => [], 2 => [], 3 => []])); <ide> $relation->sync($collection); <ide> } <ide> <ide> public function testWherePivotParamsUsedForNewQueries() <ide> { <del> $relation = $this->getMockBuilder('Illuminate\Database\Eloquent\Relations\BelongsToMany')->setMethods(['attach', 'detach', 'touchIfTouching', 'formatSyncList'])->setConstructorArgs($this->getRelationArguments())->getMock(); <add> $relation = $this->getMockBuilder('Illuminate\Database\Eloquent\Relations\BelongsToMany')->setMethods(['attach', 'detach', 'touchIfTouching', 'formatRecordsList'])->setConstructorArgs($this->getRelationArguments())->getMock(); <ide> <ide> // we expect to call $relation->wherePivot() <ide> $relation->getQuery()->shouldReceive('where')->once()->andReturn($relation); <ide> public function testWherePivotParamsUsedForNewQueries() <ide> <ide> // This is so $relation->sync() works <ide> $query->shouldReceive('pluck')->once()->with('role_id')->andReturn(new BaseCollection([1, 2, 3])); <del> $relation->expects($this->once())->method('formatSyncList')->with([1, 2, 3])->will($this->returnValue([1 => [], 2 => [], 3 => []])); <add> $relation->expects($this->once())->method('formatRecordsList')->with([1, 2, 3])->will($this->returnValue([1 => [], 2 => [], 3 => []])); <ide> <ide> $relation = $relation->wherePivot('foo', '=', 'bar'); // these params are to be stored <ide> $relation->sync([1, 2, 3]); // triggers the whole process above
2
Mixed
Javascript
requirestack property for module_not_found
05cd1a0929441943ba2d90c210c2d8bd8560293f
<ide><path>doc/api/errors.md <ide> an `Error` with this code will be emitted. <ide> <ide> <a id="MODULE_NOT_FOUND"></a> <ide> ### MODULE_NOT_FOUND <del> <add><!-- YAML <add>changes: <add> - version: REPLACEME <add> pr-url: https://github.com/nodejs/node/pull/25690 <add> description: Added `requireStack` property. <add>--> <ide> A module file could not be resolved while attempting a [`require()`][] or <ide> `import` operation. <ide> <ide><path>lib/internal/modules/cjs/loader.js <ide> Module._resolveFilename = function(request, parent, isMain, options) { <ide> // Look up the filename first, since that's the cache key. <ide> var filename = Module._findPath(request, paths, isMain); <ide> if (!filename) { <add> const requireStack = []; <add> for (var cursor = parent; <add> cursor; <add> cursor = cursor.parent) { <add> requireStack.push(cursor.filename || cursor.id); <add> } <ide> // eslint-disable-next-line no-restricted-syntax <ide> var err = new Error(`Cannot find module '${request}'`); <ide> err.code = 'MODULE_NOT_FOUND'; <add> err.requireStack = requireStack; <ide> throw err; <ide> } <ide> return filename; <ide><path>lib/internal/modules/esm/default_resolve.js <ide> function resolve(specifier, parentURL) { <ide> parentURL || pathToFileURL(`${process.cwd()}/`).href); <ide> } catch (e) { <ide> if (typeof e.message === 'string' && <del> StringStartsWith(e.message, 'Cannot find module')) <add> StringStartsWith(e.message, 'Cannot find module')) { <ide> e.code = 'MODULE_NOT_FOUND'; <add> // TODO: also add e.requireStack to match behavior with CJS <add> // MODULE_NOT_FOUND. <add> } <ide> throw e; <ide> } <ide>
3
Text
Text
fix typos and links in engines guide [ci skip]
271d1e7d8ce81355854cbbdc4386aea65ca79195
<ide><path>guides/source/engines.md <del>etting Started with Engines <add>Getting Started with Engines <ide> ============================ <ide> <ide> In this guide you will learn about engines and how they can be used to provide additional functionality to their host applications through a clean and very easy-to-use interface. You will learn the following things in this guide: <ide> class Post < ActiveRecord::Base <ide> end <ide> ``` <ide> <del> <ide> #### Implementing Decorator Pattern Using ActiveSupport::Concern <ide> <del>Using `Class#class_eval` is great for simple adjustments, but for more complex class modifications, you might want to consider using `ActiveSupport::Concern`. [[**ActiveSupport::Concern**](http://edgeapi.rubyonrails.org/classes/ActiveSupport/Concern.html]) helps manage load order of interlinked dependencies at run time allowing you to significantly modularize your code. <add>Using `Class#class_eval` is great for simple adjustments, but for more complex class modifications, you might want to consider using [`ActiveSupport::Concern`](http://edgeapi.rubyonrails.org/classes/ActiveSupport/Concern.html) helps manage load order of interlinked dependencies at run time allowing you to significantly modularize your code. <ide> <ide> **Adding** `Post#time_since_created`<br/> <ide> **Overriding** `Post#summary`
1
Text
Text
update instructions for openssl updates
cc64c93e156556dffdf2775295a77b97809cfaa2
<ide><path>doc/contributing/maintaining-openssl.md <ide> This document describes how to update `deps/openssl/`. <ide> <ide> If you need to provide updates across all active release lines you will <del>currently need to generate three PRs as follows: <add>currently need to generate four PRs as follows: <ide> <ide> * a PR for master which is generated following the instructions <del> below. <add> below for OpenSSL 3.x.x. <add>* a PR for 16.x following the instructions in the v16.x-staging version <add> of this guide. <ide> * a PR for 14.x following the instructions in the v14.x-staging version <ide> of this guide. <del>* a PR which uses the same commit from the second PR to apply the <add>* a PR which uses the same commit from the third PR to apply the <ide> updates to the openssl source code, with a new commit generated <ide> by following steps 2 onwards on the 12.x line. This is <ide> necessary because the configuration files have embedded timestamps <ide> This updates all sources in deps/openssl/openssl by: <ide> $ git commit openssl <ide> ``` <ide> <del>### OpenSSL 3.0.0 <add>### OpenSSL 3.x.x <ide> <ide> ```console <ide> % git clone https://github.com/quictls/openssl <ide> This updates all sources in deps/openssl/openssl by: <ide> ``` <ide> <ide> ```text <del>deps: upgrade openssl sources to quictls/openssl-3.0.0-alpha-16 <add>deps: upgrade openssl sources to quictls/openssl-3.0.2 <ide> <ide> This updates all sources in deps/openssl/openssl by: <ide> $ git clone [email protected]:quictls/openssl.git <ide> $ cd openssl <add> $ git checkout openssl-3.0.2+quic <ide> $ cd ../node/deps/openssl <ide> $ rm -rf openssl <del> $ cp -R ../openssl openssl <add> $ cp -R ../../../openssl openssl <ide> $ rm -rf openssl/.git* openssl/.travis* <ide> $ git add --all openssl <ide> $ git commit openssl <ide> to the relevant value): <ide> $ git commit <ide> ``` <ide> <del>### OpenSSL 3.0.0 <add>### OpenSSL 3.0.x <ide> <ide> ```text <ide> deps: update archs files for quictls/openssl-3.0.0-alpha-16
1
Ruby
Ruby
install specific rubocop version
0a2dd832b932d492c23d2a2b6d06baa3d5879e79
<ide><path>Library/Homebrew/cmd/style.rb <ide> def style <ide> ARGV.formulae.map(&:path) <ide> end <ide> <del> Homebrew.install_gem_setup_path! "rubocop" <add> Homebrew.install_gem_setup_path! "rubocop", "0.31.0" <ide> <ide> args = [ <ide> "--format", "simple", "--config", <ide><path>Library/Homebrew/utils.rb <ide> def self.git_last_commit <ide> HOMEBREW_REPOSITORY.cd { `git show -s --format="%cr" HEAD 2>/dev/null`.chuzzle } <ide> end <ide> <del> def self.install_gem_setup_path! gem, executable=gem <add> def self.install_gem_setup_path! gem, version=nil, executable=gem <ide> require "rubygems" <ide> ENV["PATH"] = "#{Gem.user_dir}/bin:#{ENV["PATH"]}" <ide> <del> unless quiet_system "gem", "list", "--installed", gem <add> args = [gem] <add> args << "-v" << version if version <add> <add> unless quiet_system "gem", "list", "--installed", *args <ide> safe_system "gem", "install", "--no-ri", "--no-rdoc", <del> "--user-install", gem <add> "--user-install", *args <ide> end <ide> <ide> unless which executable
2
Ruby
Ruby
remove call to build_request
4b1a0adf5449bfee6e4d350b36a62d9bacdf8654
<ide><path>actionpack/test/controller/url_rewriter_test.rb <ide> def rewrite(routes, options) <ide> end <ide> <ide> def setup <del> @request = build_request <ide> @params = {} <ide> @rewriter = Rewriter.new(@request) #.new(@request, @params) <ide> @routes = ActionDispatch::Routing::RouteSet.new.tap do |r|
1
PHP
PHP
apply fixes from styleci
805ec49e2d1072fdc4a687743d94ba5ba49bae9e
<ide><path>src/Illuminate/Mail/Events/MessageSent.php <ide> <ide> class MessageSent <ide> { <del> <ide> /** <ide> * The Swift message instance. <ide> *
1
Javascript
Javascript
facebook strategy refactoring
62a87a854275c0df9644c4617072f128069a0a28
<ide><path>config/passport.js <ide> passport.use(new FacebookStrategy({ <ide> }, <ide> function (accessToken, refreshToken, profile, done) { <ide> User.findOne({ facebook: profile.id }, function(err, existingUser) { <del> if (err) done(err); <add> if (err) return done(err); <ide> <del> if (existingUser) return done(null, existingUser); <add> if (existingUser) { <add> return done(null, existingUser); <add> } <ide> <ide> var user = new User({ <del> firstName: profile.name.givenName, <del> lastName: profile.name.familyName, <del> provider: profile.provider, <del> email: profile._json.email <add> facebook: profile.id <ide> }); <del> <del> user[profile.provider] = profile.id; <add> user.profile.name = profile.displayName; <add> user.profile.email = profile._json.email; <add> user.profile.gender = profile._json.gender; <add> user.profile.picture = 'https://graph.facebook.com/' + profile.id + '/picture?type=normal'; <ide> <ide> user.save(function(err) { <del> if (err) console.log(err); <del> done(null, user); <add> done(err, user); <ide> }); <ide> }); <ide> }
1
Javascript
Javascript
fix merge issue
70c28f929b457a1fb8c4f37c7c329d3268dd64f1
<ide><path>test/Stats.test.js <ide> Object { <ide> ], <ide> "emitted": true, <ide> "name": "entryB.js", <del> "size": 2000, <add> "size": 2013, <ide> }, <ide> ], <ide> "assetsByChunkName": Object {
1
Javascript
Javascript
fix inconsistency between load and _findpath"
b6dcf8c0125cc589c34bfc3180ab49e6e606a74f
<ide><path>lib/internal/modules/cjs/loader.js <ide> function tryExtensions(p, exts, isMain) { <ide> return false; <ide> } <ide> <del>function readExtensions() { <del> const exts = Object.keys(Module._extensions); <del> for (var i = 0, j = 0; i < exts.length; ++i) { <del> if (path.extname(exts[i]) === '') <del> exts[j++] = exts[i]; <del> } <del> exts.length = j; <del> return exts; <del>} <del> <ide> var warned = false; <ide> Module._findPath = function(request, paths, isMain) { <ide> if (path.isAbsolute(request)) { <ide> Module._findPath = function(request, paths, isMain) { <ide> if (!filename) { <ide> // try it with each of the extensions <ide> if (exts === undefined) <del> exts = readExtensions(); <add> exts = Object.keys(Module._extensions); <ide> filename = tryExtensions(basePath, exts, isMain); <ide> } <ide> } <ide> <ide> if (!filename && rc === 1) { // Directory. <ide> // try it with each of the extensions at "index" <ide> if (exts === undefined) <del> exts = readExtensions(); <add> exts = Object.keys(Module._extensions); <ide> filename = tryPackage(basePath, exts, isMain); <ide> if (!filename) { <ide> filename = tryExtensions(path.resolve(basePath, 'index'), exts, isMain); <ide><path>test/known_issues/test-module-deleted-extensions.js <add>'use strict'; <add>// Refs: https://github.com/nodejs/node/issues/4778 <add>const common = require('../common'); <add>const assert = require('assert'); <add>const fs = require('fs'); <add>const path = require('path'); <add>const tmpdir = require('../common/tmpdir'); <add>const file = path.join(tmpdir.path, 'test-extensions.foo.bar'); <add> <add>tmpdir.refresh(); <add>fs.writeFileSync(file, '', 'utf8'); <add>require.extensions['.foo.bar'] = (module, path) => {}; <add>delete require.extensions['.foo.bar']; <add>require.extensions['.bar'] = common.mustCall((module, path) => { <add> assert.strictEqual(module.id, file); <add> assert.strictEqual(path, file); <add>}); <add>require(path.join(tmpdir.path, 'test-extensions')); <ide><path>test/parallel/test-module-deleted-extensions.js <del>'use strict'; <del> <del>// Refs: https://github.com/nodejs/node/issues/4778 <del> <del>const common = require('../common'); <del>const assert = require('assert'); <del>const fs = require('fs'); <del>const path = require('path'); <del>const tmpdir = require('../common/tmpdir'); <del>const file = path.join(tmpdir.path, 'test-extensions.foo.bar'); <del> <del>tmpdir.refresh(); <del>fs.writeFileSync(file, '', 'utf8'); <del> <del>{ <del> require.extensions['.bar'] = common.mustNotCall(); <del> require.extensions['.foo.bar'] = common.mustNotCall(); <del> const modulePath = path.join(tmpdir.path, 'test-extensions'); <del> assert.throws( <del> () => require(modulePath), <del> new Error(`Cannot find module '${modulePath}'`) <del> ); <del>} <del> <del>{ <del> delete require.extensions['.bar']; <del> require.extensions['.foo.bar'] = common.mustNotCall(); <del> const modulePath = path.join(tmpdir.path, 'test-extensions'); <del> assert.throws( <del> () => require(modulePath), <del> new Error(`Cannot find module '${modulePath}'`) <del> ); <del> assert.throws( <del> () => require(modulePath + '.foo'), <del> new Error(`Cannot find module '${modulePath}.foo'`) <del> ); <del>} <del> <del>{ <del> delete require.extensions['.bar']; <del> delete require.extensions['.foo.bar']; <del> const modulePath = path.join(tmpdir.path, 'test-extensions'); <del> assert.throws( <del> () => require(modulePath), <del> new Error(`Cannot find module '${modulePath}'`) <del> ); <del>} <del> <del>{ <del> delete require.extensions['.foo.bar']; <del> require.extensions['.bar'] = common.mustCall((module, path) => { <del> assert.strictEqual(module.id, file); <del> assert.strictEqual(path, file); <del> }); <del> <del> const modulePath = path.join(tmpdir.path, 'test-extensions.foo'); <del> require(modulePath); <del>}
3
Ruby
Ruby
use logger.warn for warnings
da4fef815592f674252b72cb86cb436a4aae8e28
<ide><path>activemodel/lib/active_model/mass_assignment_security/sanitizer.rb <ide> def logger? <ide> end <ide> <ide> def process_removed_attributes(attrs) <del> logger.debug "WARNING: Can't mass-assign protected attributes: #{attrs.join(', ')}" if logger? <add> logger.warn "Can't mass-assign protected attributes: #{attrs.join(', ')}" if logger? <ide> end <ide> end <ide>
1
Ruby
Ruby
fix bad merge
84908bbde97ef70b09aca4937793052422bc06ed
<ide><path>actionview/test/activerecord/polymorphic_routes_test.rb <ide> def test_new_record_arguments <ide> end <ide> end <ide> <del> def test_new_record_arguments <del> params = nil <del> extend Module.new { <del> define_method("projects_url") { |*args| <del> params = args <del> super(*args) <del> } <del> } <del> <del> with_test_routes do <del> assert_equal "http://example.com/projects", polymorphic_url(@project) <del> assert_equal [], params <del> end <del> end <del> <ide> def test_with_destroyed_record <ide> with_test_routes do <ide> @project.destroy
1
Javascript
Javascript
update the completed all challenges message
07f66b61f4cc8ca3b8c6b8bbda05f9d6c5998b22
<ide><path>server/boot/challenge.js <ide> module.exports = function(app) { <ide> debug('next challengeName', nextChallengeName); <ide> if (!nextChallengeName || nextChallengeName === firstChallenge) { <ide> req.flash('errors', { <del> msg: 'It looks like you have finished all of our challenges.' + <del> ' Great job! Now on to helping nonprofits!' <add> msg: 'Once you have completed all of our challenges, you should '+ <add> 'join our <a href=\"//gitter.im/freecodecamp/HalfWayClub\"'+ <add> 'target=\"_blank\">Half Way Club</a> and start getting '+ <add> 'ready for our nonprofit projects.' <ide> }); <del> return res.redirect('/challenges/' + firstChallenge); <add> return res.redirect('/map'); <ide> } <ide> res.redirect('/challenges/' + nextChallengeName); <ide> }
1
Text
Text
fix typo in react-md example readme (#959)
61bdae5a086dff51ceb168fab3bd353d31e89cc3
<ide><path>examples/with-react-md/README.md <ide> now <ide> <ide> ## The idea behind the example <ide> <del>This example features how yo use [react-md](https://react-md.mlaursen.com/) (React Material Design) with Next.js. <add>This example features how you use [react-md](https://react-md.mlaursen.com/) (React Material Design) with Next.js. <ide> <ide> I recommend reading [layout-component](../layout-component) example next to learn how to reuse the layout across the pages.
1
Python
Python
update the description of byteswap
d9ad118061c41e9ffa02d89926b0e2d6250b98f4
<ide><path>numpy/core/_add_newdocs.py <ide> <ide> Toggle between low-endian and big-endian data representation by <ide> returning a byteswapped array, optionally swapped in-place. <add> Arrays of byte-strings are not swapped. The real and imaginary <add> parts of a complex number are swapped individually. <ide> <ide> Parameters <ide> ---------- <ide> >>> list(map(hex, A)) <ide> ['0x100', '0x1', '0x3322'] <ide> <del> Arrays of strings are not swapped <add> Arrays of byte-strings are not swapped <ide> <del> >>> A = np.array(['ceg', 'fac']) <add> >>> A = np.array([b'ceg', b'fac']) <ide> >>> A.byteswap() <del> Traceback (most recent call last): <del> ... <del> UnicodeDecodeError: ... <add> array([b'ceg', b'fac'], dtype='|S3') <add> <add> ``A.newbyteorder().byteswap()`` produces an array with the same values <add> but different representation in memory <add> <add> >>> A = np.array([1, 2, 3]) <add> >>> A.view(np.uint8) <add> array([1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, <add> 0, 0], dtype=uint8) <add> >>> A.newbyteorder().byteswap(inplace=True) <add> array([1, 2, 3]) <add> >>> A.view(np.uint8) <add> array([0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, <add> 0, 3], dtype=uint8) <ide> <ide> """)) <ide>
1
Javascript
Javascript
extract runinjections from application#initialize
41e2f8042f483f06ecd3bdc44ffbf1a140c52419
<ide><path>packages/ember-application/lib/system/application.js <ide> Ember.Application = Ember.Namespace.extend( <ide> @param router {Ember.Router} <ide> */ <ide> initialize: function(router) { <del> var injections = get(this.constructor, 'injections'), <del> namespace = this; <del> <ide> if (!router && Ember.Router.detect(this.Router)) { <ide> router = this.Router.create(); <ide> this._createdRouter = router; <ide> Ember.Application = Ember.Namespace.extend( <ide> set(router, 'namespace', this); <ide> } <ide> <del> var graph = new Ember.DAG(), i, injection; <add> this.runInjections(router); <add> <add> Ember.runLoadHooks('application', this); <add> <add> // At this point, any injections or load hooks that would have wanted <add> // to defer readiness have fired. <add> this.advanceReadiness(); <add> <add> return this; <add> }, <add> <add> /** @private */ <add> runInjections: function(router) { <add> var injections = get(this.constructor, 'injections'), <add> graph = new Ember.DAG(), <add> namespace = this, <add> properties, i, injection; <add> <ide> for (i=0; i<injections.length; i++) { <ide> injection = injections[i]; <ide> graph.addEdges(injection.name, injection.injection, injection.before, injection.after); <ide> Ember.Application = Ember.Namespace.extend( <ide> injection(namespace, router, property); <ide> }); <ide> }); <del> <del> Ember.runLoadHooks('application', this); <del> <del> // At this point, any injections or load hooks that would have wanted <del> // to defer readiness have fired. <del> this.advanceReadiness(); <del> <del> return this; <ide> }, <ide> <ide> didBecomeReady: function() {
1
Java
Java
add test for writablenativemap
17ced5701f100d4400283c079c95a7ebda18afb1
<ide><path>ReactAndroid/src/androidTest/java/com/facebook/react/tests/core/WritableNativeMapTest.java <add>package com.facebook.react.tests.core; <add> <add>import static org.fest.assertions.api.Assertions.assertThat; <add> <add>import android.support.test.runner.AndroidJUnit4; <add>import com.facebook.react.bridge.UnexpectedNativeTypeException; <add>import com.facebook.react.bridge.WritableNativeArray; <add>import com.facebook.react.bridge.WritableNativeMap; <add>import org.junit.Assert; <add>import org.junit.Before; <add>import org.junit.Ignore; <add>import org.junit.Test; <add>import org.junit.runner.RunWith; <add> <add>@RunWith(AndroidJUnit4.class) <add>public class WritableNativeMapTest { <add> <add> private WritableNativeMap mMap; <add> <add> @Before <add> public void setup() { <add> mMap = new WritableNativeMap(); <add> mMap.putBoolean("boolean", true); <add> mMap.putDouble("double", 1.2); <add> mMap.putInt("int", 1); <add> mMap.putString("string", "abc"); <add> mMap.putMap("map", new WritableNativeMap()); <add> mMap.putArray("array", new WritableNativeArray()); <add> mMap.putBoolean("dvacca", true); <add> mMap.setUseNativeAccessor(true); <add> } <add> <add> @Test <add> public void testBoolean() { <add> assertThat(mMap.getBoolean("boolean")).isEqualTo(true); <add> } <add> <add> @Test(expected = UnexpectedNativeTypeException.class) <add> public void testBooleanInvalidType() { <add> mMap.getBoolean("string"); <add> } <add> <add> @Test <add> public void testDouble() { <add> assertThat(mMap.getDouble("double")).isEqualTo(1.2); <add> } <add> <add> @Test(expected = UnexpectedNativeTypeException.class) <add> public void testDoubleInvalidType() { <add> mMap.getDouble("string"); <add> } <add> <add> @Test <add> public void testInt() { <add> assertThat(mMap.getInt("int")).isEqualTo(1); <add> } <add> <add> @Test(expected = UnexpectedNativeTypeException.class) <add> public void testIntInvalidType() { <add> mMap.getInt("string"); <add> } <add> <add> @Test <add> public void testString() { <add> assertThat(mMap.getString("string")).isEqualTo("abc"); <add> } <add> <add> @Test(expected = UnexpectedNativeTypeException.class) <add> public void testStringInvalidType() { <add> mMap.getString("int"); <add> } <add> <add> @Test <add> public void testMap() { <add> assertThat(mMap.getMap("map")).isNotNull(); <add> } <add> <add> @Test(expected = UnexpectedNativeTypeException.class) <add> public void testMapInvalidType() { <add> mMap.getMap("string"); <add> } <add> <add> @Test <add> public void testArray() { <add> assertThat(mMap.getArray("array")).isNotNull(); <add> } <add> <add> @Test(expected = UnexpectedNativeTypeException.class) <add> public void testArrayInvalidType() { <add> mMap.getArray("string"); <add> } <add> <add> @Ignore("Needs to be implemented") <add> @Test <add> public void testErrorMessageContainsKey() { <add> String key = "fkg"; <add> try { <add> mMap.getString(key); <add> Assert.fail("Expected an UnexpectedNativeTypeException to be thrown"); <add> } catch (UnexpectedNativeTypeException e) { <add> assertThat(e.getMessage()).contains(key); <add> } <add> } <add>}
1
PHP
PHP
fix phpdoc return type on routeregistrar
c46eee10b3faf980e96e1d1647c7b7b8d81f304b
<ide><path>src/Illuminate/Routing/RouteRegistrar.php <ide> public function resource($name, $controller, array $options = []) <ide> /** <ide> * Create a route group with shared attributes. <ide> * <del> * @param \Closure $callback <add> * @param \Closure|string $callback <ide> * @return void <ide> */ <ide> public function group($callback)
1
Text
Text
add member function "at"
fe0373797b622204d65a9a6cfc98c1522c7e7f88
<ide><path>guide/english/cplusplus/vector/index.md <ide> std::vector.front(); // returns the first element of the vector. <ide> std::vector.back(); // returns the last element of the vector. <ide> std::vector.push_back(n); // inserts the element "n" to the end of the vector. <ide> std::vector.pop_back(n); // removes the last element of the vector <add>std::vector.at(i); // returns a reference to the element at position i in the vector. <ide> std::vector.resize(n); // resizes a vector so that it contains the specified number of elements. <ide> std::vector.assign(i,n); // assigns new contents to the vector and replaces its current contents. <ide> ```
1
Go
Go
add build test for absolute symlink
7496cbbccc278c084620661812ed5f6390c1d2f1
<ide><path>integration-cli/docker_cli_build_test.go <ide> COPY https://index.docker.io/robots.txt /`, <ide> logDone("build - copy - disallow copy from remote") <ide> } <ide> <add>func TestBuildAddBadLinks(t *testing.T) { <add> const ( <add> dockerfile = ` <add> FROM scratch <add> ADD links.tar / <add> ADD foo.txt /symlink/ <add> ` <add> targetFile = "foo.txt" <add> ) <add> var ( <add> name = "test-link-absolute" <add> ) <add> defer deleteImages(name) <add> ctx, err := fakeContext(dockerfile, nil) <add> if err != nil { <add> t.Fatal(err) <add> } <add> defer ctx.Close() <add> <add> tempDir, err := ioutil.TempDir("", "test-link-absolute-temp-") <add> if err != nil { <add> t.Fatalf("failed to create temporary directory: %s", tempDir) <add> } <add> defer os.RemoveAll(tempDir) <add> <add> symlinkTarget := fmt.Sprintf("/../../../../../../../../../../../..%s", tempDir) <add> tarPath := filepath.Join(ctx.Dir, "links.tar") <add> nonExistingFile := filepath.Join(tempDir, targetFile) <add> fooPath := filepath.Join(ctx.Dir, targetFile) <add> <add> tarOut, err := os.Create(tarPath) <add> if err != nil { <add> t.Fatal(err) <add> } <add> <add> tarWriter := tar.NewWriter(tarOut) <add> <add> header := &tar.Header{ <add> Name: "symlink", <add> Typeflag: tar.TypeSymlink, <add> Linkname: symlinkTarget, <add> Mode: 0755, <add> Uid: 0, <add> Gid: 0, <add> } <add> <add> err = tarWriter.WriteHeader(header) <add> if err != nil { <add> t.Fatal(err) <add> } <add> <add> tarWriter.Close() <add> tarOut.Close() <add> <add> foo, err := os.Create(fooPath) <add> if err != nil { <add> t.Fatal(err) <add> } <add> defer foo.Close() <add> <add> if _, err := foo.WriteString("test"); err != nil { <add> t.Fatal(err) <add> } <add> <add> if _, err := buildImageFromContext(name, ctx, true); err != nil { <add> t.Fatal(err) <add> } <add> <add> if _, err := os.Stat(nonExistingFile); err == nil || err != nil && !os.IsNotExist(err) { <add> t.Fatalf("%s shouldn't have been written and it shouldn't exist", nonExistingFile) <add> } <add> <add> logDone("build - ADD must add files in container") <add>} <add> <ide> // Issue #5270 - ensure we throw a better error than "unexpected EOF" <ide> // when we can't access files in the context. <ide> func TestBuildWithInaccessibleFilesInContext(t *testing.T) {
1
Javascript
Javascript
fix lint error
978c994f28ea411a75d40a76a51ceb41915b9fb2
<ide><path>test/helpers/supportsRequireInModule.js <ide> module.exports = function supportsRequireInModule() { <add> // eslint-disable-next-line node/no-unsupported-features/node-builtins <ide> return !!require("module").createRequire; <ide> };
1
Python
Python
fix kpo to have hyphen instead of period
70eede5dd6924a4eb74b7600cce2c627e51a3b7e
<ide><path>airflow/providers/cncf/kubernetes/operators/kubernetes_pod.py <ide> def _set_name(self, name): <ide> raise AirflowException("`name` is required unless `pod_template_file` or `full_pod_spec` is set") <ide> <ide> validate_key(name, max_length=220) <del> return re.sub(r'[^a-z0-9.-]+', '-', name.lower()) <add> return re.sub(r'[^a-z0-9-]+', '-', name.lower()) <ide> <ide> def patch_already_checked(self, pod: k8s.V1Pod): <ide> """Add an "already checked" annotation to ensure we don't reattach on retries"""
1
Javascript
Javascript
fix umd builds (reactsharedinternals)
aae83a4b9a0cfd75f5d5e7ee776c5e92e55cc2c3
<ide><path>packages/react/src/forks/ReactSharedInternals.umd.js <ide> import ReactCurrentDispatcher from '../ReactCurrentDispatcher'; <ide> import ReactCurrentOwner from '../ReactCurrentOwner'; <ide> import ReactDebugCurrentFrame from '../ReactDebugCurrentFrame'; <ide> import IsSomeRendererActing from '../IsSomeRendererActing'; <add>import ReactCurrentBatchConfig from '../ReactCurrentBatchConfig'; <ide> <ide> const ReactSharedInternals = { <ide> ReactCurrentDispatcher, <ide> ReactCurrentOwner, <ide> IsSomeRendererActing, <add> ReactCurrentBatchConfig, <ide> // Used by renderers to avoid bundling object-assign twice in UMD bundles: <ide> assign, <ide> };
1
Ruby
Ruby
rewrite tex requirement message
be66d746add559161b609106d06317fd25522b58
<ide><path>Library/Homebrew/requirements.rb <ide> class TeXDependency < Requirement <ide> <ide> satisfy { which('tex') || which('latex') } <ide> <del> def message; <<-EOS.undent <add> def message; <add> if File.exist?("/usr/texbin") <add> texbin_path = "/usr/texbin" <add> else <add> texbin_path = "its bin directory" <add> end <add> <add> <<-EOS.undent <ide> A LaTeX distribution is required to install. <ide> <ide> You can install MacTeX distribution from: <ide> http://www.tug.org/mactex/ <ide> <del> Make sure that its bin directory is in your PATH before proceeding. <del> <del> You may also need to restore the ownership of Homebrew install: <del> sudo chown -R $USER `brew --prefix` <add> Make sure that "/usr/texbin", or the location you installed it to, is in <add> your PATH before proceeding. <ide> EOS <ide> end <ide> end
1
PHP
PHP
write a simple publisher
b31c47de7c9321388548f765f5d1a044060c8ed4
<ide><path>src/Illuminate/Foundation/Console/VendorPublishCommand.php <add><?php namespace Illuminate\Foundation\Console; <add> <add>use Illuminate\Console\Command; <add>use Illuminate\Filesystem\Filesystem; <add>use Illuminate\Support\ServiceProvider; <add> <add>class VendorPublishCommand extends Command { <add> <add> /** <add> * The filesystem instance. <add> * <add> * @var \Illuminate\Filesystem\Filesystem <add> */ <add> protected $files; <add> <add> /** <add> * The console command name. <add> * <add> * @var string <add> */ <add> protected $name = 'vendor:publish'; <add> <add> /** <add> * The console command description. <add> * <add> * @var string <add> */ <add> protected $description = "Publish any publishable assets from vendor packages"; <add> <add> /** <add> * Create a new command instance. <add> * <add> * @param \Illuminate\Filesystem\Filesystem <add> * @return void <add> */ <add> public function __construct(Filesystem $files) <add> { <add> parent::__construct(); <add> <add> $this->files = $files; <add> } <add> <add> /** <add> * Execute the console command. <add> * <add> * @return void <add> */ <add> public function fire() <add> { <add> foreach (ServiceProvider::pathsToPublish() as $from => $to) <add> { <add> if ($this->files->isFile($from)) <add> { <add> $this->publishFile($from, $to); <add> } <add> elseif ($this->files->isDirectory($from)) <add> { <add> $this->publishDirectory($from, $to); <add> } <add> } <add> } <add> <add> /** <add> * Publish the file to the given path. <add> * <add> * @param string $from <add> * @param string $to <add> * @return void <add> */ <add> protected function publishFile($from, $to) <add> { <add> $this->createParentDirectory(dirname($to)); <add> <add> $this->files->copy($from, $to); <add> <add> $this->status($from, $to, 'File'); <add> } <add> <add> /** <add> * Publish the directory to the given directory. <add> * <add> * @param string $from <add> * @param string $to <add> * @return void <add> */ <add> protected function publishDirectory($from, $to) <add> { <add> $this->createParentDirectory($to); <add> <add> $this->files->copyDirectory($from, $to); <add> <add> $this->status($from, $to, 'Directory'); <add> } <add> <add> /** <add> * Create the directory to house the published files if needed. <add> * <add> * @param string $directory <add> * @return void <add> */ <add> protected function createParentDirectory($directory) <add> { <add> if ( ! $this->files->isDirectory($directory)) <add> { <add> $this->files->makeDirectory($directory, 0755, true); <add> } <add> } <add> <add> /** <add> * Write a status message to the console. <add> * <add> * @param string $from <add> * @param string $to <add> * @param string $type <add> * @return void <add> */ <add> protected function status($from, $to, $type) <add> { <add> $from = str_replace(base_path(), '', realpath($from)); <add> <add> $to = str_replace(base_path(), '', realpath($to)); <add> <add> $this->line('<info>Copied '.$type.'</info> <comment>['.$from.']</comment> <info>To</info> <comment>['.$to.']</comment>'); <add> } <add> <add>} <ide><path>src/Illuminate/Foundation/Providers/ArtisanServiceProvider.php <ide> use Illuminate\Foundation\Console\ProviderMakeCommand; <ide> use Illuminate\Foundation\Console\HandlerEventCommand; <ide> use Illuminate\Foundation\Console\ClearCompiledCommand; <add>use Illuminate\Foundation\Console\VendorPublishCommand; <ide> use Illuminate\Foundation\Console\HandlerCommandCommand; <ide> <ide> class ArtisanServiceProvider extends ServiceProvider { <ide> class ArtisanServiceProvider extends ServiceProvider { <ide> 'Serve' => 'command.serve', <ide> 'Tinker' => 'command.tinker', <ide> 'Up' => 'command.up', <add> 'VendorPublish' => 'command.vendor.publish', <ide> ]; <ide> <ide> /** <ide> protected function registerUpCommand() <ide> }); <ide> } <ide> <add> /** <add> * Register the command. <add> * <add> * @return void <add> */ <add> protected function registerVendorPublishCommand() <add> { <add> $this->app->singleton('command.vendor.publish', function($app) <add> { <add> return new VendorPublishCommand($app['files']); <add> }); <add> } <add> <ide> /** <ide> * Get the services provided by the provider. <ide> * <ide><path>src/Illuminate/Foundation/helpers.php <ide> function bcrypt($value, $options = array()) <ide> } <ide> } <ide> <add>if ( ! function_exists('collect')) <add>{ <add> /** <add> * Create a collection from the given value. <add> * <add> * @param mixed $value <add> * @return \Illuminate\Support\Collection <add> */ <add> function collect($value) <add> { <add> return Illuminate\Support\Collection::make($value); <add> } <add>} <add> <ide> if ( ! function_exists('config')) <ide> { <ide> /** <ide><path>src/Illuminate/Support/ServiceProvider.php <ide> abstract class ServiceProvider { <ide> */ <ide> protected $defer = false; <ide> <add> /** <add> * The paths that should be published. <add> * <add> * @var array <add> */ <add> protected static $publishes = []; <add> <ide> /** <ide> * Create a new service provider instance. <ide> * <ide> abstract public function register(); <ide> */ <ide> protected function loadViewsFrom($namespace, $path) <ide> { <del> if (is_dir($appPath = $this->app->basePath().'/resources/views/packages/'.$namespace)) <add> if (is_dir($appPath = $this->app->basePath().'/resources/views/vendor/'.$namespace)) <ide> { <ide> $this->app['view']->addNamespace($namespace, $appPath); <ide> } <ide> protected function loadTranslationsFrom($namespace, $path) <ide> $this->app['translator']->addNamespace($namespace, $path); <ide> } <ide> <add> /** <add> * Register paths to be published by the publish command. <add> * <add> * @param array $paths <add> * @return void <add> */ <add> protected function publishes(array $paths) <add> { <add> static::$publishes = array_merge(static::$publishes, $paths); <add> } <add> <add> /** <add> * Get the paths to publish. <add> * <add> * @return array <add> */ <add> public static function pathsToPublish() <add> { <add> return static::$publishes; <add> } <add> <ide> /** <ide> * Register the package's custom Artisan commands. <ide> *
4
Go
Go
use spf13/cobra for docker port
d5971c230dc91fa8764dd5e9bc4124346ad06e02
<ide><path>api/client/commands.go <ide> func (cli *DockerCli) Command(name string) func(...string) error { <ide> "login": cli.CmdLogin, <ide> "logout": cli.CmdLogout, <ide> "pause": cli.CmdPause, <del> "port": cli.CmdPort, <ide> "ps": cli.CmdPs, <ide> "pull": cli.CmdPull, <ide> "push": cli.CmdPush, <ide><path>api/client/container/port.go <add>package container <add> <add>import ( <add> "fmt" <add> "strings" <add> <add> "golang.org/x/net/context" <add> <add> "github.com/docker/docker/api/client" <add> "github.com/docker/docker/cli" <add> "github.com/docker/go-connections/nat" <add> "github.com/spf13/cobra" <add>) <add> <add>type portOptions struct { <add> container string <add> <add> port string <add>} <add> <add>// NewPortCommand creats a new cobra.Command for `docker port` <add>func NewPortCommand(dockerCli *client.DockerCli) *cobra.Command { <add> var opts portOptions <add> <add> cmd := &cobra.Command{ <add> Use: "port CONTAINER [PRIVATE_PORT[/PROTO]]", <add> Short: "List port mappings or a specific mapping for the container", <add> Args: cli.RequiresMinMaxArgs(1, 2), <add> RunE: func(cmd *cobra.Command, args []string) error { <add> opts.container = args[0] <add> if len(args) > 1 { <add> opts.port = args[1] <add> } <add> return runPort(dockerCli, &opts) <add> }, <add> } <add> cmd.SetFlagErrorFunc(flagErrorFunc) <add> <add> return cmd <add>} <add> <add>func runPort(dockerCli *client.DockerCli, opts *portOptions) error { <add> ctx := context.Background() <add> <add> c, err := dockerCli.Client().ContainerInspect(ctx, opts.container) <add> if err != nil { <add> return err <add> } <add> <add> if opts.port != "" { <add> port := opts.port <add> proto := "tcp" <add> parts := strings.SplitN(port, "/", 2) <add> <add> if len(parts) == 2 && len(parts[1]) != 0 { <add> port = parts[0] <add> proto = parts[1] <add> } <add> natPort := port + "/" + proto <add> newP, err := nat.NewPort(proto, port) <add> if err != nil { <add> return err <add> } <add> if frontends, exists := c.NetworkSettings.Ports[newP]; exists && frontends != nil { <add> for _, frontend := range frontends { <add> fmt.Fprintf(dockerCli.Out(), "%s:%s\n", frontend.HostIP, frontend.HostPort) <add> } <add> return nil <add> } <add> return fmt.Errorf("Error: No public port '%s' published for %s", natPort, opts.container) <add> } <add> <add> for from, frontends := range c.NetworkSettings.Ports { <add> for _, frontend := range frontends { <add> fmt.Fprintf(dockerCli.Out(), "%s -> %s:%s\n", from, frontend.HostIP, frontend.HostPort) <add> } <add> } <add> <add> return nil <add>} <ide><path>api/client/port.go <del>package client <del> <del>import ( <del> "fmt" <del> "strings" <del> <del> "golang.org/x/net/context" <del> <del> Cli "github.com/docker/docker/cli" <del> flag "github.com/docker/docker/pkg/mflag" <del> "github.com/docker/go-connections/nat" <del>) <del> <del>// CmdPort lists port mappings for a container. <del>// If a private port is specified, it also shows the public-facing port that is NATed to the private port. <del>// <del>// Usage: docker port CONTAINER [PRIVATE_PORT[/PROTO]] <del>func (cli *DockerCli) CmdPort(args ...string) error { <del> cmd := Cli.Subcmd("port", []string{"CONTAINER [PRIVATE_PORT[/PROTO]]"}, Cli.DockerCommands["port"].Description, true) <del> cmd.Require(flag.Min, 1) <del> <del> cmd.ParseFlags(args, true) <del> <del> c, err := cli.client.ContainerInspect(context.Background(), cmd.Arg(0)) <del> if err != nil { <del> return err <del> } <del> <del> if cmd.NArg() == 2 { <del> var ( <del> port = cmd.Arg(1) <del> proto = "tcp" <del> parts = strings.SplitN(port, "/", 2) <del> ) <del> <del> if len(parts) == 2 && len(parts[1]) != 0 { <del> port = parts[0] <del> proto = parts[1] <del> } <del> natPort := port + "/" + proto <del> newP, err := nat.NewPort(proto, port) <del> if err != nil { <del> return err <del> } <del> if frontends, exists := c.NetworkSettings.Ports[newP]; exists && frontends != nil { <del> for _, frontend := range frontends { <del> fmt.Fprintf(cli.out, "%s:%s\n", frontend.HostIP, frontend.HostPort) <del> } <del> return nil <del> } <del> return fmt.Errorf("Error: No public port '%s' published for %s", natPort, cmd.Arg(0)) <del> } <del> <del> for from, frontends := range c.NetworkSettings.Ports { <del> for _, frontend := range frontends { <del> fmt.Fprintf(cli.out, "%s -> %s:%s\n", from, frontend.HostIP, frontend.HostPort) <del> } <del> } <del> <del> return nil <del>} <ide><path>cli/cobraadaptor/adaptor.go <ide> func NewCobraAdaptor(clientFlags *cliflags.ClientFlags) CobraAdaptor { <ide> container.NewDiffCommand(dockerCli), <ide> container.NewExportCommand(dockerCli), <ide> container.NewLogsCommand(dockerCli), <add> container.NewPortCommand(dockerCli), <ide> container.NewRunCommand(dockerCli), <ide> container.NewStartCommand(dockerCli), <ide> container.NewStopCommand(dockerCli), <ide><path>cli/required.go <ide> func RequiresMinArgs(min int) cobra.PositionalArgs { <ide> } <ide> } <ide> <add>// RequiresMinMaxArgs returns an error if there is not at least min args and at most max args <add>func RequiresMinMaxArgs(min int, max int) cobra.PositionalArgs { <add> return func(cmd *cobra.Command, args []string) error { <add> if len(args) >= min && len(args) <= max { <add> return nil <add> } <add> return fmt.Errorf( <add> "\"%s\" requires at least %d and at most %d argument(s).\nSee '%s --help'.\n\nUsage: %s\n\n%s", <add> cmd.CommandPath(), <add> min, <add> max, <add> cmd.CommandPath(), <add> cmd.UseLine(), <add> cmd.Short, <add> ) <add> } <add>} <add> <ide> // ExactArgs returns an error if there is not the exact number of args <ide> func ExactArgs(number int) cobra.PositionalArgs { <ide> return func(cmd *cobra.Command, args []string) error { <ide><path>cli/usage.go <ide> var DockerCommandUsage = []Command{ <ide> {"login", "Log in to a Docker registry"}, <ide> {"logout", "Log out from a Docker registry"}, <ide> {"pause", "Pause all processes within a container"}, <del> {"port", "List port mappings or a specific mapping for the CONTAINER"}, <ide> {"ps", "List containers"}, <ide> {"pull", "Pull an image or a repository from a registry"}, <ide> {"push", "Push an image or a repository to a registry"},
6
Javascript
Javascript
add annotations to xplat to prepare for lti
17f221c85282c2aa00cd1d0303930a76182513a1
<ide><path>Libraries/Animated/components/AnimatedFlatList.js <ide> import * as React from 'react'; <ide> /** <ide> * @see https://github.com/facebook/react-native/commit/b8c8562 <ide> */ <del>const FlatListWithEventThrottle = React.forwardRef((props, ref) => ( <del> <FlatList scrollEventThrottle={0.0001} {...props} ref={ref} /> <del>)); <add>const FlatListWithEventThrottle = React.forwardRef( <add> ( <add> props: React.ElementConfig<typeof FlatList>, <add> ref: <add> | ((null | FlatList<mixed>) => mixed) <add> | {current: null | FlatList<mixed>, ...}, <add> ) => <FlatList scrollEventThrottle={0.0001} {...props} ref={ref} />, <add>); <ide> <ide> export default (createAnimatedComponent( <ide> FlatListWithEventThrottle, <ide><path>Libraries/Animated/components/AnimatedSectionList.js <ide> * @format <ide> */ <ide> <add>import type {SectionBase} from '../../Lists/SectionList'; <ide> import type {AnimatedComponentType} from '../createAnimatedComponent'; <ide> <ide> import SectionList from '../../Lists/SectionList'; <ide> import * as React from 'react'; <ide> /** <ide> * @see https://github.com/facebook/react-native/commit/b8c8562 <ide> */ <del>const SectionListWithEventThrottle = React.forwardRef((props, ref) => ( <del> <SectionList scrollEventThrottle={0.0001} {...props} ref={ref} /> <del>)); <add>const SectionListWithEventThrottle = React.forwardRef( <add> ( <add> props: React.ElementConfig<typeof SectionList>, <add> ref: <add> | ((null | SectionList<SectionBase<$FlowFixMe>>) => mixed) <add> | { <add> current: null | SectionList<SectionBase<$FlowFixMe>>, <add> ... <add> }, <add> ) => <SectionList scrollEventThrottle={0.0001} {...props} ref={ref} />, <add>); <ide> <ide> export default (createAnimatedComponent( <ide> SectionListWithEventThrottle, <ide><path>Libraries/Inspector/DevtoolsOverlay.js <ide> * @flow <ide> */ <ide> <add>import type {PointerEvent} from '../Types/CoreEventTypes'; <ide> import type {PressEvent} from '../Types/CoreEventTypes'; <ide> import type {HostRef} from './getInspectorDataForViewAtPoint'; <ide> <ide> export default function DevtoolsOverlay({ <ide> }, []); <ide> <ide> const onPointerMove = useCallback( <del> e => { <add> (e: PointerEvent) => { <ide> findViewForLocation(e.nativeEvent.x, e.nativeEvent.y); <ide> }, <ide> [findViewForLocation], <ide> ); <ide> <ide> const onResponderMove = useCallback( <del> e => { <add> (e: PressEvent) => { <ide> findViewForLocation( <ide> e.nativeEvent.touches[0].locationX, <ide> e.nativeEvent.touches[0].locationY, <ide><path>Libraries/Lists/VirtualizedList.js <ide> export default class VirtualizedList extends StateSafePureComponent< <ide> cells.push( <ide> React.cloneElement(element, { <ide> key: '$empty', <del> onLayout: event => { <add> onLayout: (event: LayoutEvent) => { <ide> this._onLayoutEmpty(event); <ide> if (element.props.onLayout) { <ide> element.props.onLayout(event); <ide><path>Libraries/Utilities/__tests__/useMergeRefs-test.js <ide> function mockRefRegistry<T>(): { <ide> }, <ide> mockObjectRef: (name: string): {current: T, ...} => ({ <ide> // $FlowIgnore[unsafe-getters-setters] - Intentional. <del> set current(current) { <add> set current(current: $FlowFixMe) { <ide> registry.push({[name]: TestViewInstance.fromValue(current)}); <ide> }, <ide> }), <ide><path>packages/react-native-codegen/src/generators/components/GenerateTests.js <ide> */ <ide> <ide> 'use strict'; <del>import type {PropTypeAnnotation, ComponentShape} from '../../CodegenSchema'; <del> <add>import type {ComponentShape, PropTypeAnnotation} from '../../CodegenSchema'; <ide> import type {SchemaType} from '../../CodegenSchema'; <add> <ide> const {getImports, toSafeCppString} = require('./CppHelpers'); <ide> <ide> type FilesOutput = Map<string, string>; <ide> function generateTestsString(name: string, component: ComponentShape) { <ide> }); <ide> } <ide> <del> const testCases = component.props.reduce((cases, prop) => { <add> const testCases = component.props.reduce((cases: Array<TestCase>, prop) => { <ide> return cases.concat(getTestCasesForProp(prop.name, prop.typeAnnotation)); <ide> }, []); <ide> <ide><path>packages/react-native-codegen/src/generators/components/GenerateViewConfigJs.js <ide> <ide> 'use strict'; <ide> import type { <del> PropTypeAnnotation, <del> EventTypeShape, <ide> ComponentShape, <add> EventTypeShape, <add> PropTypeAnnotation, <ide> } from '../../CodegenSchema'; <add>import type {SchemaType} from '../../CodegenSchema'; <ide> <ide> const j = require('jscodeshift'); <ide> <del>import type {SchemaType} from '../../CodegenSchema'; <del> <ide> // File path -> contents <ide> type FilesOutput = Map<string, string>; <ide> <ide> function buildViewConfig( <ide> <ide> const bubblingEventNames = component.events <ide> .filter(event => event.bubblingType === 'bubble') <del> .reduce((bubblingEvents, event) => { <add> .reduce((bubblingEvents: Array<any>, event) => { <ide> // We add in the deprecated paper name so that it is in the view config. <ide> // This means either the old event name or the new event name can fire <ide> // and be sent to the listener until the old top level name is removed. <ide> function buildViewConfig( <ide> <ide> const directEventNames = component.events <ide> .filter(event => event.bubblingType === 'direct') <del> .reduce((directEvents, event) => { <add> .reduce((directEvents: Array<any>, event) => { <ide> // We add in the deprecated paper name so that it is in the view config. <ide> // This means either the old event name or the new event name can fire <ide> // and be sent to the listener until the old top level name is removed. <ide><path>packages/rn-tester/js/examples/FlatList/BaseFlatListExample.js <ide> */ <ide> <ide> import type {RenderItemProps} from 'react-native/Libraries/Lists/VirtualizedList'; <add> <add>import * as React from 'react'; <ide> import { <del> Pressable, <ide> Button, <ide> FlatList, <add> Pressable, <ide> StyleSheet, <ide> Text, <ide> View, <ide> } from 'react-native'; <ide> <del>import * as React from 'react'; <del> <ide> const DATA = [ <ide> 'Pizza', <ide> 'Burger', <ide> type Props = { <ide> children?: ?React.Node, <ide> }; <ide> <del>const BaseFlatListExample = React.forwardRef((props: Props, ref) => { <del> return ( <del> <View style={styles.container}> <del> {props.testOutput != null ? ( <del> <View testID="test_container" style={styles.testContainer}> <del> <Text style={styles.output} numberOfLines={1} testID="output"> <del> {props.testOutput} <del> </Text> <del> {props.onTest != null ? ( <del> <Button <del> testID="start_test" <del> onPress={props.onTest} <del> title={props.testLabel ?? 'Test'} <del> /> <del> ) : null} <del> </View> <del> ) : null} <del> {props.children} <del> <FlatList <del> {...props.exampleProps} <del> ref={ref} <del> testID="flat_list" <del> data={DATA} <del> keyExtractor={(item, index) => item + index} <del> style={styles.list} <del> renderItem={Item} <del> /> <del> </View> <del> ); <del>}); <add>const BaseFlatListExample = React.forwardRef( <add> ( <add> props: Props, <add> ref: <add> | ((null | FlatList<string>) => mixed) <add> | {current: null | FlatList<string>, ...}, <add> ) => { <add> return ( <add> <View style={styles.container}> <add> {props.testOutput != null ? ( <add> <View testID="test_container" style={styles.testContainer}> <add> <Text style={styles.output} numberOfLines={1} testID="output"> <add> {props.testOutput} <add> </Text> <add> {props.onTest != null ? ( <add> <Button <add> testID="start_test" <add> onPress={props.onTest} <add> title={props.testLabel ?? 'Test'} <add> /> <add> ) : null} <add> </View> <add> ) : null} <add> {props.children} <add> <FlatList <add> {...props.exampleProps} <add> ref={ref} <add> testID="flat_list" <add> data={DATA} <add> keyExtractor={(item, index) => item + index} <add> style={styles.list} <add> renderItem={Item} <add> /> <add> </View> <add> ); <add> }, <add>); <ide> <ide> export default (BaseFlatListExample: React.AbstractComponent< <ide> Props, <ide><path>packages/rn-tester/js/examples/FlatList/FlatList-nested.js <ide> */ <ide> <ide> 'use strict'; <add>import type {ViewToken} from '../../../../../Libraries/Lists/ViewabilityHelper'; <add>import type {RenderItemProps} from '../../../../../Libraries/Lists/VirtualizedListProps'; <add>import type {RNTesterModuleExample} from '../../types/RNTesterTypes'; <ide> <add>import RNTesterPage from '../../components/RNTesterPage'; <ide> import * as React from 'react'; <ide> import {useCallback, useEffect, useReducer} from 'react'; <ide> import {FlatList, StyleSheet, Text, View} from 'react-native'; <ide> <del>import RNTesterPage from '../../components/RNTesterPage'; <del>import type {RNTesterModuleExample} from '../../types/RNTesterTypes'; <del>import type {ViewToken} from '../../../../../Libraries/Lists/ViewabilityHelper'; <del> <ide> type OuterItem = 'head' | 'vertical' | 'horizontal' | 'filler'; <ide> <ide> const outerItems: OuterItem[] = [ <ide> function OuterItemRenderer({ <ide> <View style={styles.col}> <ide> <FlatList <ide> data={items.map(i => index * items.length * 3 + i)} <del> renderItem={p => ( <add> renderItem={(p: RenderItemProps<number>) => ( <ide> <InnerItemRenderer <ide> item={p.item} <ide> dispatchInner={dispatchInner} <ide> function OuterItemRenderer({ <ide> <View style={styles.col}> <ide> <FlatList <ide> data={items.map(i => index * items.length * 3 + i + items.length)} <del> renderItem={p => ( <add> renderItem={(p: RenderItemProps<number>) => ( <ide> <InnerItemRenderer <ide> item={p.item} <ide> dispatchInner={dispatchInner} <ide> function OuterItemRenderer({ <ide> data={items.map( <ide> i => index * items.length * 3 + i + 2 * items.length, <ide> )} <del> renderItem={p => ( <add> renderItem={(p: RenderItemProps<number>) => ( <ide> <InnerItemRenderer item={p.item} dispatchInner={dispatchInner} /> <ide> )} <ide> style={styles.childList}
9
Javascript
Javascript
fix arguments order in assert.strictequal
63aef2d193ddbb4fcbe8c95fe2158fbe0bc89230
<ide><path>test/parallel/test-crypto-fips.js <ide> function testHelper(stream, args, expectedOutput, cmd, env) { <ide> assert.ok(response.includes(expectedOutput)); <ide> } else { <ide> // Normal path where we expect either FIPS enabled or disabled. <del> assert.strictEqual(expectedOutput, Number(response)); <add> assert.strictEqual(Number(response), expectedOutput); <ide> } <ide> childOk(child); <ide> }
1
Javascript
Javascript
use actual timeout instances
93eb68e6d23c66b85e8f79540500d5d9f0bbc396
<ide><path>lib/internal/http2/core.js <ide> const { <ide> } = require('internal/http2/util'); <ide> <ide> const { <del> _unrefActive, <del> enroll, <del> unenroll <del>} = require('timers'); <add> kTimeout, <add> setUnrefTimeout, <add> validateTimerDuration <add>} = require('internal/timers'); <add> <add>const { _unrefActive } = require('timers'); <ide> <ide> const { ShutdownWrap, WriteWrap } = process.binding('stream_wrap'); <ide> const { constants } = binding; <ide> function onStreamClose(code, hasData) { <ide> ` [has data? ${hasData}]`); <ide> <ide> if (!stream.closed) { <del> // Unenroll from timeouts <del> unenroll(stream); <add> // Clear timeout and remove timeout listeners <add> stream.setTimeout(0); <ide> stream.removeAllListeners('timeout'); <ide> <ide> // Set the state flags <ide> class Http2Session extends EventEmitter { <ide> this[kType] = type; <ide> this[kProxySocket] = null; <ide> this[kSocket] = socket; <add> this[kTimeout] = null; <ide> <ide> // Do not use nagle's algorithm <ide> if (typeof socket.setNoDelay === 'function') <ide> class Http2Session extends EventEmitter { <ide> [kUpdateTimer]() { <ide> if (this.destroyed) <ide> return; <del> _unrefActive(this); <add> if (this[kTimeout]) _unrefActive(this[kTimeout]); <ide> } <ide> <ide> // Sets the id of the next stream to be created by this Http2Session. <ide> class Http2Session extends EventEmitter { <ide> state.flags |= SESSION_FLAGS_DESTROYED; <ide> <ide> // Clear timeout and remove timeout listeners <del> unenroll(this); <add> this.setTimeout(0); <ide> this.removeAllListeners('timeout'); <ide> <ide> // Destroy any pending and open streams <ide> class Http2Stream extends Duplex { <ide> this[kSession] = session; <ide> session[kState].pendingStreams.add(this); <ide> <add> this[kTimeout] = null; <add> <ide> this[kState] = { <ide> flags: STREAM_FLAGS_PENDING, <ide> rstCode: NGHTTP2_NO_ERROR, <ide> class Http2Stream extends Duplex { <ide> [kUpdateTimer]() { <ide> if (this.destroyed) <ide> return; <del> _unrefActive(this); <del> if (this[kSession]) <del> _unrefActive(this[kSession]); <add> if (this[kTimeout]) <add> _unrefActive([kTimeout]); <add> if (this[kSession] && this[kSession][kTimeout]) <add> _unrefActive(this[kSession][kTimeout]); <ide> } <ide> <ide> [kInit](id, handle) { <ide> class Http2Stream extends Duplex { <ide> <ide> // Close initiates closing the Http2Stream instance by sending an RST_STREAM <ide> // frame to the connected peer. The readable and writable sides of the <del> // Http2Stream duplex are closed and the timeout timer is unenrolled. If <add> // Http2Stream duplex are closed and the timeout timer is cleared. If <ide> // a callback is passed, it is registered to listen for the 'close' event. <ide> // <ide> // If the handle and stream ID have not been assigned yet, the close <ide> class Http2Stream extends Duplex { <ide> if (code < 0 || code > kMaxInt) <ide> throw new errors.RangeError('ERR_OUT_OF_RANGE', 'code'); <ide> <del> // Unenroll the timeout. <del> unenroll(this); <add> // Clear timeout and remove timeout listeners <add> this.setTimeout(0); <ide> this.removeAllListeners('timeout'); <ide> <ide> // Close the writable <ide> class Http2Stream extends Duplex { <ide> handle.destroy(); <ide> session[kState].streams.delete(id); <ide> } else { <del> unenroll(this); <add> // Clear timeout and remove timeout listeners <add> this.setTimeout(0); <ide> this.removeAllListeners('timeout'); <add> <ide> state.flags |= STREAM_FLAGS_CLOSED; <ide> abort(this); <ide> this.end(); <ide> const setTimeout = { <ide> value: function(msecs, callback) { <ide> if (this.destroyed) <ide> return; <del> if (typeof msecs !== 'number') { <del> throw new errors.TypeError('ERR_INVALID_ARG_TYPE', <del> 'msecs', <del> 'number'); <del> } <add> <add> // Type checking identical to timers.enroll() <add> msecs = validateTimerDuration(msecs); <add> <add> // Attempt to clear an existing timer lear in both cases - <add> // even if it will be rescheduled we don't want to leak an existing timer. <add> clearTimeout(this[kTimeout]); <add> <ide> if (msecs === 0) { <del> unenroll(this); <ide> if (callback !== undefined) { <ide> if (typeof callback !== 'function') <ide> throw new errors.TypeError('ERR_INVALID_CALLBACK'); <ide> this.removeListener('timeout', callback); <ide> } <ide> } else { <del> enroll(this, msecs); <del> this[kUpdateTimer](); <add> this[kTimeout] = setUnrefTimeout(this._onTimeout.bind(this), msecs); <add> if (this[kSession]) this[kSession][kUpdateTimer](); <add> <ide> if (callback !== undefined) { <ide> if (typeof callback !== 'function') <ide> throw new errors.TypeError('ERR_INVALID_CALLBACK'); <ide><path>test/parallel/test-http2-compat-socket.js <add>// Flags: --expose_internals <add> <ide> 'use strict'; <ide> <ide> const common = require('../common'); <ide> const assert = require('assert'); <ide> const h2 = require('http2'); <ide> const net = require('net'); <ide> <add>const { kTimeout } = require('internal/timers'); <add> <ide> // Tests behavior of the proxied socket in Http2ServerRequest <ide> // & Http2ServerResponse - this proxy socket should mimic the <ide> // behavior of http1 but against the http2 api & model <ide> server.on('request', common.mustCall(function(request, response) { <ide> assert.strictEqual(request.socket.destroyed, false); <ide> <ide> request.socket.setTimeout(987); <del> assert.strictEqual(request.stream.session._idleTimeout, 987); <add> assert.strictEqual(request.stream.session[kTimeout]._idleTimeout, 987); <ide> request.socket.setTimeout(0); <ide> <ide> common.expectsError(() => request.socket.read(), errMsg); <ide><path>test/parallel/test-http2-socket-proxy.js <add>// Flags: --expose_internals <add> <ide> 'use strict'; <ide> <ide> const common = require('../common'); <ide> const assert = require('assert'); <ide> const h2 = require('http2'); <ide> const net = require('net'); <ide> <add>const { kTimeout } = require('internal/timers'); <add> <ide> // Tests behavior of the proxied socket on Http2Session <ide> <ide> const errMsg = { <ide> server.on('stream', common.mustCall(function(stream, headers) { <ide> assert.strictEqual(typeof socket.address(), 'object'); <ide> <ide> socket.setTimeout(987); <del> assert.strictEqual(session._idleTimeout, 987); <add> assert.strictEqual(session[kTimeout]._idleTimeout, 987); <ide> <ide> common.expectsError(() => socket.destroy, errMsg); <ide> common.expectsError(() => socket.emit, errMsg); <ide> server.on('stream', common.mustCall(function(stream, headers) { <ide> <ide> stream.end(); <ide> <del> socket.setTimeout = undefined; <del> assert.strictEqual(session.setTimeout, undefined); <del> <ide> stream.session.on('close', common.mustCall(() => { <ide> assert.strictEqual(session.socket, undefined); <ide> })); <ide><path>test/parallel/test-http2-timeouts.js <ide> server.on('stream', common.mustCall((stream) => { <ide> { <ide> code: 'ERR_INVALID_ARG_TYPE', <ide> type: TypeError, <del> message: 'The "msecs" argument must be of type number' <add> message: <add> 'The "msecs" argument must be of type number. Received type string' <ide> } <ide> ); <ide> common.expectsError(
4
Ruby
Ruby
avoid deep_dup when intantiating
1b2c907727e4a698d9c2979958aa78a1b4bfdaa1
<ide><path>activerecord/lib/active_record/core.rb <ide> require 'active_support/core_ext/hash/indifferent_access' <del>require 'active_support/core_ext/object/deep_dup' <add>require 'active_support/core_ext/object/duplicable' <ide> require 'thread' <ide> <ide> module ActiveRecord <ide> def relation #:nodoc: <ide> # # Instantiates a single new object bypassing mass-assignment security <ide> # User.new({ :first_name => 'Jamie', :is_admin => true }, :without_protection => true) <ide> def initialize(attributes = nil, options = {}) <del> @attributes = self.class.initialize_attributes(self.class.column_defaults.deep_dup) <add> defaults = self.class.column_defaults.dup <add> defaults.each { |k, v| defaults[k] = v.dup if v.duplicable? } <add> <add> @attributes = self.class.initialize_attributes(defaults) <ide> @columns_hash = self.class.column_types.dup <ide> <ide> init_internals
1
Javascript
Javascript
fix overridden methods
dca4e44f398bcd189845d1a07201433110f8f842
<ide><path>dist/Immutable.js <ide> var $Range = Range; <ide> take: function(amount) { <ide> return this.slice(0, amount); <ide> }, <del> skip: function(amount, maintainIndices) { <del> return maintainIndices ? $traceurRuntime.superCall(this, $Range.prototype, "skip", [amount]) : this.slice(amount); <add> skip: function(amount) { <add> return this.slice(amount); <ide> }, <ide> __iterate: function(fn, reverse, flipIndices) { <ide> var maxIndex = this.length - 1; <ide> var $Repeat = Repeat; <ide> end = end == null ? length : end > 0 ? Math.min(length, end) : Math.max(0, length + end); <ide> return end > begin ? new $Repeat(this._value, end - begin) : EMPTY_REPEAT; <ide> }, <del> reverse: function(maintainIndices) { <del> return maintainIndices ? $traceurRuntime.superCall(this, $Repeat.prototype, "reverse", [maintainIndices]) : this; <add> reverse: function() { <add> return this; <ide> }, <ide> indexOf: function(searchValue) { <ide> if (is(this._value, searchValue)) { <ide><path>dist/Immutable.min.js <ide> * LICENSE file in the root directory of this source tree. An additional grant <ide> * of patent rights can be found in the PATENTS file in the same directory. <ide> */ <del>function t(){function t(t,e,n,r){var i;if(r){var u=r.prototype;i=me.create(u)}else i=t.prototype;return me.keys(e).forEach(function(t){i[t]=e[t]}),me.keys(n).forEach(function(e){t[e]=n[e]}),i.constructor=t,t.prototype=i,t}function e(t,e,n,r){return me.getPrototypeOf(e)[n].apply(t,r)}function n(t,n,r){e(t,n,"constructor",r)}function r(t){return t.value=!1,t}function i(t){t&&(t.value=!0)}function u(){}function s(t,e){e=e||0;for(var n=Math.max(0,t.length-e),r=Array(n),i=0;n>i;i++)r[i]=t[i+e];return r}function a(t){return qe.value=t,qe.done=!1,qe}function h(){return qe.value=void 0,qe.done=!0,qe}function o(t,e){if(!t)throw Error(e)}function c(t){if(!t)return 0;if(t===!0)return 1;var e=typeof t;if("number"===e){if((0|t)===t)return t&Oe;t=""+t,e="string"}return"string"===e?t.length>Ee?f(t):l(t):t.hashCode?c("function"==typeof t.hashCode?t.hashCode():t.hashCode):_(t)}function f(t){var e=Ue[t];return null==e&&(e=l(t),Re===je&&(Re=0,Ue={}),Re++,Ue[t]=e),e}function l(t){for(var e=0,n=0;t.length>n;n++)e=31*e+t.charCodeAt(n)&Oe;return e}function _(t){if(t[xe])return t[xe];var e=++Ae&Oe;if(!Ce)try{return Object.defineProperty(t,xe,{enumerable:!1,configurable:!1,writable:!1,value:e}),e}catch(n){Ce=!0}return t[xe]=e,e}function v(){return Object.create(Je)}function g(t){var e=Object.create(Be);return e.__reversedIndices=t?t.__reversedIndices:!1,e}function p(t,e,n,r){var i=t.get?t.get(e[r],Ie):Ie;return i===Ie?n:++r===e.length?i:p(i,e,n,r)}function m(t,e,n){return(0===t||null!=n&&-n>=t)&&(null==e||null!=n&&e>=n)}function d(t,e){return w(t,e,0)}function y(t,e){return w(t,e,e)}function w(t,e,n){return null==t?n:0>t?Math.max(0,e+t):e?Math.min(e,t):t}function S(t){return t}function I(t,e){return[e,t]}function k(){return!0}function M(){return this}function q(t){return(t||0)+1}function b(t,e,n,r){var i=t.__makeSequence();return i.__iterateUncached=function(i,u,s){var a=this,h=0;return t.__iterate(function(t,u,s){if(e.call(n,t,u,s)){if(i(t,r?u:h,a)===!1)return!1;h++}},u,s),h},i}function D(t){return function(){return!t.apply(this,arguments) <add>function t(){function t(t,e,n,r){var i;if(r){var u=r.prototype;i=me.create(u)}else i=t.prototype;return me.keys(e).forEach(function(t){i[t]=e[t]}),me.keys(n).forEach(function(e){t[e]=n[e]}),i.constructor=t,t.prototype=i,t}function e(t,e,n,r){return me.getPrototypeOf(e)[n].apply(t,r)}function n(t,n,r){e(t,n,"constructor",r)}function r(t){return t.value=!1,t}function i(t){t&&(t.value=!0)}function u(){}function s(t,e){e=e||0;for(var n=Math.max(0,t.length-e),r=Array(n),i=0;n>i;i++)r[i]=t[i+e];return r}function a(t){return qe.value=t,qe.done=!1,qe}function h(){return qe.value=void 0,qe.done=!0,qe}function o(t,e){if(!t)throw Error(e)}function c(t){if(!t)return 0;if(t===!0)return 1;var e=typeof t;if("number"===e){if((0|t)===t)return t&Oe;t=""+t,e="string"}return"string"===e?t.length>Ee?f(t):_(t):t.hashCode?c("function"==typeof t.hashCode?t.hashCode():t.hashCode):l(t)}function f(t){var e=Ue[t];return null==e&&(e=_(t),Re===je&&(Re=0,Ue={}),Re++,Ue[t]=e),e}function _(t){for(var e=0,n=0;t.length>n;n++)e=31*e+t.charCodeAt(n)&Oe;return e}function l(t){if(t[xe])return t[xe];var e=++Ae&Oe;if(!Ce)try{return Object.defineProperty(t,xe,{enumerable:!1,configurable:!1,writable:!1,value:e}),e}catch(n){Ce=!0}return t[xe]=e,e}function v(){return Object.create(Je)}function g(t){var e=Object.create(Be);return e.__reversedIndices=t?t.__reversedIndices:!1,e}function p(t,e,n,r){var i=t.get?t.get(e[r],Ie):Ie;return i===Ie?n:++r===e.length?i:p(i,e,n,r)}function m(t,e,n){return(0===t||null!=n&&-n>=t)&&(null==e||null!=n&&e>=n)}function d(t,e){return w(t,e,0)}function y(t,e){return w(t,e,e)}function w(t,e,n){return null==t?n:0>t?Math.max(0,e+t):e?Math.min(e,t):t}function S(t){return t}function I(t,e){return[e,t]}function k(){return!0}function M(){return this}function q(t){return(t||0)+1}function b(t,e,n,r){var i=t.__makeSequence();return i.__iterateUncached=function(i,u,s){var a=this,h=0;return t.__iterate(function(t,u,s){if(e.call(n,t,u,s)){if(i(t,r?u:h,a)===!1)return!1;h++}},u,s),h},i}function D(t){return function(){return!t.apply(this,arguments) <ide> }}function O(t){return"string"==typeof t?JSON.stringify(t):t}function A(t,e){return t>e?1:e>t?-1:0}function x(t,e){return 0>e?(null==t.length&&t.cacheResult(),t.length+e):e}function C(t){o(1/0!==t,"Cannot perform this action with an infinite sequence.")}function E(t,e){var n=new Fe;return n.next=function(){var n=t.next();return n.done?n:(n.value=e(n.value),n)},n}function j(t,e,n){return n instanceof We?R(t,e,n):n}function R(t,e,n){return new He(t._rootData,t._keyPath.concat(e),t._onChange,n)}function U(t,e,n){var r=t._rootData.updateIn(t._keyPath,n?Qe.empty():void 0,e),i=t._keyPath||[];return t._onChange&&t._onChange.call(void 0,r,t._rootData,n?i.concat(n):i),new He(r,t._keyPath,t._onChange)}function W(t,e){return t instanceof He&&(t=t.deref()),e instanceof He&&(e=e.deref()),t===e?0!==t||0!==e||1/t===1/e:t!==t?e!==e:t instanceof We?t.equals(e):!1}function P(t,e){return a(0===t||1===t?e[t]:[e[0],e[1]])}function J(t,e){return{node:t,index:0,__prev:e}}function z(t,e,n,r){var i=Object.create(Xe);return i.length=t,i._root=e,i.__ownerID=n,i.__hash=r,i.__altered=!1,i}function K(t,e,n){var i=r(ke),u=r(Me),s=B(t._root,t.__ownerID,0,c(e),e,n,i,u);if(!u.value)return t;var a=t.length+(i.value?n===Ie?-1:1:0);return t.__ownerID?(t.length=a,t._root=s,t.__hash=void 0,t.__altered=!0,t):s?z(a,s):Qe.empty()}function B(t,e,n,r,u,s,a,h){return t?t.update(e,n,r,u,s,a,h):s===Ie?t:(i(h),i(a),new rn(e,r,[u,s]))}function L(t){return t.constructor===rn||t.constructor===en}function V(t,e,n,r,i){if(t.hash===r)return new en(e,r,[t.entry,i]);var u,s=(0===n?t.hash:t.hash>>>n)&Se,a=(0===n?r:r>>>n)&Se,h=s===a?[V(t,e,n+ye,r,i)]:(u=new rn(e,r,i),a>s?[t,u]:[u,t]);return new Ye(e,1<<s|1<<a,h)}function N(t,e,n,r){for(var i=0,u=0,s=Array(n),a=0,h=1,o=e.length;o>a;a++,h<<=1){var c=e[a];null!=c&&a!==r&&(i|=h,s[u++]=c)}return new Ye(t,i,s)}function F(t,e,n,r,i){for(var u=0,s=Array(we),a=0;0!==n;a++,n>>>=1)s[a]=1&n?e[u++]:null;return s[r]=i,new $e(t,u+1,s)}function G(t,e,n){for(var r=[],i=0;n.length>i;i++){var u=n[i];u&&r.push(Array.isArray(u)?We(u).fromEntrySeq():We(u)) <del>}return Q(t,e,r)}function H(t){return function(e,n){return e&&e.mergeDeepWith?e.mergeDeepWith(t,n):t?t(e,n):n}}function Q(t,e,n){return 0===n.length?t:t.withMutations(function(t){for(var r=e?function(n,r){var i=t.get(r,Ie);t.set(r,i===Ie?n:e(i,n))}:function(e,n){t.set(n,e)},i=0;n.length>i;i++)n[i].forEach(r)})}function T(t,e,n,r,i){var u=e.length;if(i===u)return r(t);o(t.set,"updateIn with invalid keyPath");var s=i===u-1?n:Qe.empty(),a=e[i],h=t.get(a,s),c=T(h,e,n,r,i+1);return c===h?t:t.set(a,c)}function X(t){return t-=t>>1&1431655765,t=(858993459&t)+(t>>2&858993459),t=t+(t>>4)&252645135,t+=t>>8,t+=t>>16,127&t}function Y(t,e,n,r){var i=r?t:s(t);return i[e]=n,i}function Z(t,e,n,r){var i=t.length+1;if(r&&e+1===i)return t[e]=n,t;for(var u=Array(i),s=0,a=0;i>a;a++)a===e?(u[a]=n,s=-1):u[a]=t[a+s];return u}function $(t,e,n){var r=t.length-1;if(n&&e===r)return t.pop(),t;for(var i=Array(r),u=0,s=0;r>s;s++)s===e&&(u=1),i[s]=t[s+u];return i}function te(t,e,n,r,i,u){var s,a=t&&t.array;if(0===e){var h=0>n?0:n,o=n+we;for(o>r&&(o=r),s=h;o>s;s++){var c=u?h+o-1-s:s;if(i(a&&a[c-n],c)===!1)return!1}}else{var f=1<<e,l=e-ye;for(s=0;Se>=s;s++){var _=u?Se-s:s,v=n+(_<<e);if(r>v&&v+f>0){var g=a&&a[_];if(!te(g,l,v,r,i,u))return!1}}}return!0}function ee(t,e,n,r,i){return{array:t,level:e,offset:n,max:r,rawMax:r-n>>e,index:0,__prev:i}}function ne(t,e,n,r,i,u,s){var a=Object.create(ln);return a.length=e-t,a._origin=t,a._size=e,a._level=n,a._root=r,a._tail=i,a.__ownerID=u,a.__hash=s,a.__altered=!1,a}function re(t,e,n){if(e=x(t,e),e>=t.length||0>e)return n===Ie?t:t.withMutations(function(t){0>e?ae(t,e).set(0,n):ae(t,0,e+1).set(e,n)});e+=t._origin;var i=t._tail,u=t._root,s=r(Me);return e>=oe(t._size)?i=ie(i,t.__ownerID,0,e,n,s):u=ie(u,t.__ownerID,t._level,e,n,s),s.value?t.__ownerID?(t._root=u,t._tail=i,t.__hash=void 0,t.__altered=!0,t):ne(t._origin,t._size,t._level,u,i):t}function ie(t,e,n,r,u,s){var a,h=u===Ie,o=r>>>n&Se,c=t&&t.array.length>o;if(h&&!c)return t;if(n>0){var f=t&&t.array[o],l=ie(f,e,n-ye,r,u,s);return l===f?t:(a=ue(t,e),a.array[o]=l,a) <del>}return!h&&c&&t.array[o]===u?t:(i(s),a=ue(t,e),h&&o===a.array.length-1?a.array.pop():a.array[o]=h?void 0:u,a)}function ue(t,e){return e&&t&&e===t.ownerID?t:new _n(t?t.array.slice():[],e)}function se(t,e){if(e>=oe(t._size))return t._tail;if(1<<t._level+ye>e){for(var n=t._root,r=t._level;n&&r>0;)n=n.array[e>>>r&Se],r-=ye;return n}}function ae(t,e,n){var r=t.__ownerID||new u,i=t._origin,s=t._size,a=i+e,h=null==n?s:0>n?s+n:i+n;if(a===i&&h===s)return t;if(a>=h)return t.clear();for(var o=t._level,c=t._root,f=0;0>a+f;)c=new _n(c&&c.array.length?[null,c]:[],r),o+=ye,f+=1<<o;f&&(a+=f,i+=f,h+=f,s+=f);for(var l=oe(s),_=oe(h);_>=1<<o+ye;)c=new _n(c&&c.array.length?[c]:[],r),o+=ye;var v=t._tail,g=l>_?se(t,h-1):_>l?new _n([],r):v;if(v&&_>l&&s>a&&v.array.length){c=ue(c,r);for(var p=c,m=o;m>ye;m-=ye){var d=l>>>m&Se;p=p.array[d]=ue(p.array[d],r)}p.array[l>>>ye&Se]=v}if(s>h&&(g=g&&g.removeAfter(r,0,h)),a>=_)a-=_,h-=_,o=ye,c=null,g=g&&g.removeBefore(r,0,a);else if(a>i||l>_){var y,w;f=0;do y=a>>>o&Se,w=_-1>>>o&Se,y===w&&(y&&(f+=(1<<o)*y),o-=ye,c=c&&c.array[y]);while(c&&y===w);c&&a>i&&(c=c&&c.removeBefore(r,o,a-f)),c&&l>_&&(c=c&&c.removeAfter(r,o,_-f)),f&&(a-=f,h-=f)}return t.__ownerID?(t.length=h-a,t._origin=a,t._size=h,t._level=o,t._root=c,t._tail=g,t.__hash=void 0,t.__altered=!0,t):ne(a,h,o,c,g)}function he(t,e,n){for(var r=[],i=0;n.length>i;i++){var u=n[i];u&&r.push(We(u))}var s=Math.max.apply(null,r.map(function(t){return t.length||0}));return s>t.length&&(t=t.setLength(s)),Q(t,e,r)}function oe(t){return we>t?0:t-1>>>ye<<ye}function ce(t,e){var n=Object.create(yn);return n.length=t?t.length:0,n._map=t,n.__ownerID=e,n}function fe(t,e,n,r){var i=Object.create(Sn.prototype);return i.length=t?t.length:0,i._map=t,i._vector=e,i.__ownerID=n,i.__hash=r,i}function le(t,e,n){var r=t._map,i=t._vector,u=r.get(e),s=void 0!==u,a=n===Ie;if(!s&&a||s&&n===i.get(u)[1])return t;s||(u=i.length);var h=a?r.remove(e):s?r:r.set(e,u),o=a?i.remove(u):i.set(u,[e,n]);return t.__ownerID?(t.length=h.length,t._map=h,t._vector=o,t.__hash=void 0,t):fe(h,o)}function _e(t,e,n){var r=Object.create(Object.getPrototypeOf(t)); <add>}return Q(t,e,r)}function H(t){return function(e,n){return e&&e.mergeDeepWith?e.mergeDeepWith(t,n):t?t(e,n):n}}function Q(t,e,n){return 0===n.length?t:t.withMutations(function(t){for(var r=e?function(n,r){var i=t.get(r,Ie);t.set(r,i===Ie?n:e(i,n))}:function(e,n){t.set(n,e)},i=0;n.length>i;i++)n[i].forEach(r)})}function T(t,e,n,r,i){var u=e.length;if(i===u)return r(t);o(t.set,"updateIn with invalid keyPath");var s=i===u-1?n:Qe.empty(),a=e[i],h=t.get(a,s),c=T(h,e,n,r,i+1);return c===h?t:t.set(a,c)}function X(t){return t-=t>>1&1431655765,t=(858993459&t)+(t>>2&858993459),t=t+(t>>4)&252645135,t+=t>>8,t+=t>>16,127&t}function Y(t,e,n,r){var i=r?t:s(t);return i[e]=n,i}function Z(t,e,n,r){var i=t.length+1;if(r&&e+1===i)return t[e]=n,t;for(var u=Array(i),s=0,a=0;i>a;a++)a===e?(u[a]=n,s=-1):u[a]=t[a+s];return u}function $(t,e,n){var r=t.length-1;if(n&&e===r)return t.pop(),t;for(var i=Array(r),u=0,s=0;r>s;s++)s===e&&(u=1),i[s]=t[s+u];return i}function te(t,e,n,r,i,u){var s,a=t&&t.array;if(0===e){var h=0>n?0:n,o=n+we;for(o>r&&(o=r),s=h;o>s;s++){var c=u?h+o-1-s:s;if(i(a&&a[c-n],c)===!1)return!1}}else{var f=1<<e,_=e-ye;for(s=0;Se>=s;s++){var l=u?Se-s:s,v=n+(l<<e);if(r>v&&v+f>0){var g=a&&a[l];if(!te(g,_,v,r,i,u))return!1}}}return!0}function ee(t,e,n,r,i){return{array:t,level:e,offset:n,max:r,rawMax:r-n>>e,index:0,__prev:i}}function ne(t,e,n,r,i,u,s){var a=Object.create(_n);return a.length=e-t,a._origin=t,a._size=e,a._level=n,a._root=r,a._tail=i,a.__ownerID=u,a.__hash=s,a.__altered=!1,a}function re(t,e,n){if(e=x(t,e),e>=t.length||0>e)return n===Ie?t:t.withMutations(function(t){0>e?ae(t,e).set(0,n):ae(t,0,e+1).set(e,n)});e+=t._origin;var i=t._tail,u=t._root,s=r(Me);return e>=oe(t._size)?i=ie(i,t.__ownerID,0,e,n,s):u=ie(u,t.__ownerID,t._level,e,n,s),s.value?t.__ownerID?(t._root=u,t._tail=i,t.__hash=void 0,t.__altered=!0,t):ne(t._origin,t._size,t._level,u,i):t}function ie(t,e,n,r,u,s){var a,h=u===Ie,o=r>>>n&Se,c=t&&t.array.length>o;if(h&&!c)return t;if(n>0){var f=t&&t.array[o],_=ie(f,e,n-ye,r,u,s);return _===f?t:(a=ue(t,e),a.array[o]=_,a) <add>}return!h&&c&&t.array[o]===u?t:(i(s),a=ue(t,e),h&&o===a.array.length-1?a.array.pop():a.array[o]=h?void 0:u,a)}function ue(t,e){return e&&t&&e===t.ownerID?t:new ln(t?t.array.slice():[],e)}function se(t,e){if(e>=oe(t._size))return t._tail;if(1<<t._level+ye>e){for(var n=t._root,r=t._level;n&&r>0;)n=n.array[e>>>r&Se],r-=ye;return n}}function ae(t,e,n){var r=t.__ownerID||new u,i=t._origin,s=t._size,a=i+e,h=null==n?s:0>n?s+n:i+n;if(a===i&&h===s)return t;if(a>=h)return t.clear();for(var o=t._level,c=t._root,f=0;0>a+f;)c=new ln(c&&c.array.length?[null,c]:[],r),o+=ye,f+=1<<o;f&&(a+=f,i+=f,h+=f,s+=f);for(var _=oe(s),l=oe(h);l>=1<<o+ye;)c=new ln(c&&c.array.length?[c]:[],r),o+=ye;var v=t._tail,g=_>l?se(t,h-1):l>_?new ln([],r):v;if(v&&l>_&&s>a&&v.array.length){c=ue(c,r);for(var p=c,m=o;m>ye;m-=ye){var d=_>>>m&Se;p=p.array[d]=ue(p.array[d],r)}p.array[_>>>ye&Se]=v}if(s>h&&(g=g&&g.removeAfter(r,0,h)),a>=l)a-=l,h-=l,o=ye,c=null,g=g&&g.removeBefore(r,0,a);else if(a>i||_>l){var y,w;f=0;do y=a>>>o&Se,w=l-1>>>o&Se,y===w&&(y&&(f+=(1<<o)*y),o-=ye,c=c&&c.array[y]);while(c&&y===w);c&&a>i&&(c=c&&c.removeBefore(r,o,a-f)),c&&_>l&&(c=c&&c.removeAfter(r,o,l-f)),f&&(a-=f,h-=f)}return t.__ownerID?(t.length=h-a,t._origin=a,t._size=h,t._level=o,t._root=c,t._tail=g,t.__hash=void 0,t.__altered=!0,t):ne(a,h,o,c,g)}function he(t,e,n){for(var r=[],i=0;n.length>i;i++){var u=n[i];u&&r.push(We(u))}var s=Math.max.apply(null,r.map(function(t){return t.length||0}));return s>t.length&&(t=t.setLength(s)),Q(t,e,r)}function oe(t){return we>t?0:t-1>>>ye<<ye}function ce(t,e){var n=Object.create(yn);return n.length=t?t.length:0,n._map=t,n.__ownerID=e,n}function fe(t,e,n,r){var i=Object.create(Sn.prototype);return i.length=t?t.length:0,i._map=t,i._vector=e,i.__ownerID=n,i.__hash=r,i}function _e(t,e,n){var r=t._map,i=t._vector,u=r.get(e),s=void 0!==u,a=n===Ie;if(!s&&a||s&&n===i.get(u)[1])return t;s||(u=i.length);var h=a?r.remove(e):s?r:r.set(e,u),o=a?i.remove(u):i.set(u,[e,n]);return t.__ownerID?(t.length=h.length,t._map=h,t._vector=o,t.__hash=void 0,t):fe(h,o)}function le(t,e,n){var r=Object.create(Object.getPrototypeOf(t)); <ide> return r._map=e,r.__ownerID=n,r}function ve(t,e){return e?ge(e,t,"",{"":t}):pe(t)}function ge(t,e,n,r){return e&&(Array.isArray(e)||e.constructor===Object)?t.call(r,n,We(e).map(function(n,r){return ge(t,n,r,e)})):e}function pe(t){if(t){if(Array.isArray(t))return We(t).map(pe).toVector();if(t.constructor===Object)return We(t).map(pe).toMap()}return t}var me=Object,de={};de.createClass=t,de.superCall=e,de.defaultSuperCall=n;var ye=5,we=1<<ye,Se=we-1,Ie={},ke={value:!1},Me={value:!1},qe={value:void 0,done:!1},be="delete",De="undefined"!=typeof Symbol?Symbol.iterator:"@@iterator",Oe=2147483647,Ae=0,xe="__immutablehash__";"undefined"!=typeof Symbol&&(xe=Symbol(xe));var Ce=!1,Ee=16,je=255,Re=0,Ue={},We=function(t){return Pe.from(1===arguments.length?t:Array.prototype.slice.call(arguments))},Pe=We;de.createClass(We,{toString:function(){return this.__toString("Seq {","}")},__toString:function(t,e){return 0===this.length?t+e:t+" "+this.map(this.__toStringMapper).join(", ")+" "+e},__toStringMapper:function(t,e){return e+": "+O(t)},toJS:function(){return this.map(function(t){return t instanceof Pe?t.toJS():t}).__toJS()},toArray:function(){C(this.length);var t=Array(this.length||0);return this.valueSeq().forEach(function(e,n){t[n]=e}),t},toObject:function(){C(this.length);var t={};return this.forEach(function(e,n){t[n]=e}),t},toVector:function(){return C(this.length),cn.from(this)},toMap:function(){return C(this.length),Qe.from(this)},toOrderedMap:function(){return C(this.length),Sn.from(this)},toSet:function(){return C(this.length),mn.from(this)},toKeyedSeq:function(){return this},hashCode:function(){return this.__hash||(this.__hash=1/0===this.length?0:this.reduce(function(t,e,n){return t+(c(e)^(e===n?0:c(n)))&Oe},0))},equals:function(t){if(this===t)return!0;if(!(t instanceof Pe))return!1;if(null!=this.length&&null!=t.length){if(this.length!==t.length)return!1;if(0===this.length&&0===t.length)return!0}return null!=this.__hash&&null!=t.__hash&&this.__hash!==t.__hash?!1:this.__deepEquals(t)},__deepEquals:function(t){var e=this.cacheResult().entrySeq().toArray(),n=0; <ide> return t.every(function(t,r){var i=e[n++];return W(r,i[0])&&W(t,i[1])})},join:function(t){t=void 0!==t?""+t:",";var e="",n=!0;return this.forEach(function(r){n?(n=!1,e+=null!=r?r:""):e+=t+(null!=r?r:"")}),e},count:function(t,e){return t?this.filter(t,e).count():(null==this.length&&(this.length=this.forEach(k)),this.length)},countBy:function(t){var e=this;return Sn.empty().withMutations(function(n){e.forEach(function(e,r,i){n.update(t(e,r,i),q)})})},concat:function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];var n=[this].concat(t.map(function(t){return Pe(t)})),r=this.__makeSequence();return r.length=n.reduce(function(t,e){return null!=t&&null!=e.length?t+e.length:void 0},0),r.__iterateUncached=function(t,e){for(var r,i=0,u=n.length-1,s=0;u>=s&&!r;s++){var a=n[e?u-s:s];i+=a.__iterate(function(e,n,i){return t(e,n,i)===!1?(r=!0,!1):void 0},e)}return i},r},reverse:function(){var t=this,e=t.__makeSequence();return e.length=t.length,e.__iterateUncached=function(e,n){return t.__iterate(e,!n)},e.reverse=function(){return t},e},keySeq:function(){return this.flip().valueSeq()},valueSeq:function(){var t=this,e=g(t);return e.length=t.length,e.valueSeq=M,e.__iterateUncached=function(e,n,r){if(r&&null==this.length)return this.cacheResult().__iterate(e,n,r);var i,u=0;return r?(u=this.length-1,i=function(t,n,r){return e(t,u--,r)!==!1}):i=function(t,n,r){return e(t,u++,r)!==!1},t.__iterate(i,n),r?this.length:u},e},entrySeq:function(){var t=this;if(t._cache)return Pe(t._cache);var e=t.map(I).valueSeq();return e.fromEntries=function(){return t},e},forEach:function(t,e){return this.__iterate(e?t.bind(e):t)},reduce:function(t,e,n){var r,i;return 2>arguments.length?i=!0:r=e,this.forEach(function(e,u,s){i?(i=!1,r=e):r=t.call(n,r,e,u,s)}),r},reduceRight:function(){var t=this.toKeyedSeq().reverse();return t.reduce.apply(t,arguments)},every:function(t,e){var n=!0;return this.forEach(function(r,i,u){return t.call(e,r,i,u)?void 0:(n=!1,!1)}),n},some:function(t,e){return!this.every(D(t),e)},first:function(){return this.find(k) <ide> },last:function(){return this.findLast(k)},rest:function(){return this.slice(1)},butLast:function(){return this.slice(0,-1)},has:function(t){return this.get(t,Ie)!==Ie},get:function(t,e){return this.find(function(e,n){return W(n,t)},null,e)},getIn:function(t,e){return t&&0!==t.length?p(this,t,e,0):this},contains:function(t){return this.find(function(e){return W(e,t)},null,Ie)!==Ie},find:function(t,e,n){var r=n;return this.forEach(function(n,i,u){return t.call(e,n,i,u)?(r=n,!1):void 0}),r},findKey:function(t,e){var n;return this.forEach(function(r,i,u){return t.call(e,r,i,u)?(n=i,!1):void 0}),n},findLast:function(t,e,n){return this.toKeyedSeq().reverse().find(t,e,n)},findLastKey:function(t,e){return this.toKeyedSeq().reverse().findKey(t,e)},flip:function(){var t=this,e=v();return e.length=t.length,e.flip=function(){return t},e.__iterateUncached=function(e,n){var r=this;return t.__iterate(function(t,n){return e(n,t,r)!==!1},n)},e},map:function(t,e){var n=this,r=n.__makeSequence();return r.length=n.length,r.__iterateUncached=function(r,i){var u=this;return n.__iterate(function(n,i,s){return r(t.call(e,n,i,s),i,u)!==!1},i)},r},mapKeys:function(t,e){var n=this,r=n.__makeSequence();return r.length=n.length,r.__iterateUncached=function(r,i){var u=this;return n.__iterate(function(n,i,s){return r(n,t.call(e,i,n,s),u)!==!1},i)},r},filter:function(t,e){return b(this,t,e,!0)},slice:function(t,e){if(m(t,e,this.length))return this;var n=d(t,this.length),r=y(e,this.length);if(n!==n||r!==r)return this.entrySeq().slice(t,e).fromEntrySeq();var i=0===n?this:this.skip(n);return null==r||r===this.length?i:i.take(r-n)},take:function(t){var e=this;if(t>e.length)return e;var n=e.__makeSequence();return n.__iterateUncached=function(n,r,i){var u=this;if(r)return this.cacheResult().__iterate(n,r,i);var s=0;return e.__iterate(function(e,r){return t>s&&n(e,r,u)!==!1?void s++:!1},r,i),s},n.length=this.length&&Math.min(this.length,t),n},takeLast:function(t){return this.reverse().take(t).reverse()},takeWhile:function(t,e){var n=this,r=n.__makeSequence(); <ide> return r.__iterateUncached=function(r,i,u){var s=this;if(i)return this.cacheResult().__iterate(r,i,u);var a=0;return n.__iterate(function(n,i,u){return t.call(e,n,i,u)&&r(n,i,s)!==!1?void a++:!1},i,u),a},r},takeUntil:function(t,e){return this.takeWhile(D(t),e)},skip:function(t){var e=this;if(0===t)return e;var n=e.__makeSequence();return n.__iterateUncached=function(n,r,i){var u=this;if(r)return this.cacheResult().__iterate(n,r,i);var s=!0,a=0,h=0;return e.__iterate(function(e,r){if(!s||!(s=h++<t)){if(n(e,r,u)===!1)return!1;a++}},r,i),a},n.length=this.length&&Math.max(0,this.length-t),n},skipLast:function(t){return this.reverse().skip(t).reverse()},skipWhile:function(t,e){var n=this,r=n.__makeSequence();return r.__iterateUncached=function(r,i,u){var s=this;if(i)return this.cacheResult().__iterate(r,i,u);var a=!0,h=0;return n.__iterate(function(n,i,u){if(!a||!(a=t.call(e,n,i,u))){if(r(n,i,s)===!1)return!1;h++}},i,u),h},r},skipUntil:function(t,e){return this.skipWhile(D(t),e)},groupBy:function(t){var e=this,n=Sn.empty().withMutations(function(n){e.forEach(function(e,r,i){var u=t(e,r,i),s=n.get(u,Ie);s===Ie&&(s=[],n.set(u,s)),s.push([r,e])})});return n.map(function(t){return Pe(t).fromEntrySeq()})},sort:function(t,e){return this.sortBy(S,t,e)},sortBy:function(t,e){e=e||A;var n=this;return Pe(this.entrySeq().entrySeq().toArray().sort(function(r,i){return e(t(r[1][1],r[1][0],n),t(i[1][1],i[1][0],n))||r[0]-i[0]})).fromEntrySeq().valueSeq().fromEntrySeq()},cacheResult:function(){return!this._cache&&this.__iterateUncached&&(C(this.length),this._cache=this.entrySeq().toArray(),null==this.length&&(this.length=this._cache.length)),this},__iterate:function(t,e,n){if(!this._cache)return this.__iterateUncached(t,e,n);var r=this.length-1,i=this._cache,u=this;if(e)for(var s=i.length-1;s>=0;s--){var a=i[s];if(t(a[1],n?a[0]:r-a[0],u)===!1)break}else i.every(n?function(e){return t(e[1],r-e[0],u)!==!1}:function(e){return t(e[1],e[0],u)!==!1});return this.length},__makeSequence:function(){return v()}},{from:function(t){if(t instanceof Pe)return t; <ide> if(!Array.isArray(t)){if(t&&t.constructor===Object)return new Ve(t);t=[t]}return new Ne(t)}});var Je=We.prototype;Je.toJSON=Je.toJS,Je.__toJS=Je.toObject,Je.inspect=Je.toSource=function(){return""+this};var ze=function(){de.defaultSuperCall(this,Ke.prototype,arguments)},Ke=ze;de.createClass(ze,{toString:function(){return this.__toString("Seq [","]")},toArray:function(){C(this.length);var t=Array(this.length||0);return t.length=this.forEach(function(e,n){t[n]=e}),t},toKeyedSeq:function(){return new Le(this)},fromEntrySeq:function(){var t=this,e=v();return e.length=t.length,e.entrySeq=function(){return t},e.__iterateUncached=function(e,n,r){var i=this;return t.__iterate(function(t){return t&&e(t[1],t[0],i)},n,r)},e},join:function(t){t=void 0!==t?""+t:",";var e="";return this.forEach(function(n,r){e+=(r?t:"")+(null!=n?n:"")}),e},concat:function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];var n=[this].concat(t).map(function(t){return We(t)}),r=this.__makeSequence();return r.length=n.reduce(function(t,e){return null!=t&&null!=e.length?t+e.length:void 0},0),r.__iterateUncached=function(t,e,r){var i=this;if(r&&!this.length)return this.cacheResult().__iterate(t,e,r);for(var u,s=0,a=r&&this.length-1,h=n.length-1,o=0;h>=o&&!u;o++){var c=n[e?h-o:o];c instanceof Ke||(c=c.valueSeq()),s+=c.__iterate(function(e,n){return n+=s,t(e,r?a-n:n,i)===!1?(u=!0,!1):void 0},e)}return s},r},reverse:function(){var t=this,e=t.__makeSequence();return e.length=t.length,e.__reversedIndices=t.__reversedIndices,e.__iterateUncached=function(e,n,r){var i=this,u=0;return t.__iterate(function(t){return e(t,u++,i)!==!1},!n,r)},e.reverse=function(){return t},e},filter:function(t,e){return b(this,t,e,!1)},get:function(t,e){return t=x(this,t),this.find(function(e,n){return n===t},null,e)},indexOf:function(t){return this.findIndex(function(e){return W(e,t)})},lastIndexOf:function(t){return this.toKeyedSeq().reverse().indexOf(t)},findIndex:function(t,e){var n=this.findKey(t,e);return null==n?-1:n},findLastIndex:function(t,e){return this.toKeyedSeq().reverse().findIndex(t,e) <del>},slice:function(t,e,n){var r=this;if(m(t,e,r.length))return r;var i=r.__makeSequence(),u=d(t,r.length),s=y(e,r.length);return i.length=r.length&&(n?r.length:s-u),i.__reversedIndices=r.__reversedIndices,i.__iterateUncached=function(i,a,h){var o=this;if(a)return this.cacheResult().__iterate(i,a,h);var c=this.__reversedIndices^h;if(u!==u||s!==s||c&&null==r.length){var f=r.count();u=d(t,f),s=y(e,f)}var l=c?r.length-s:u,_=c?r.length-u:s,v=r.__iterate(function(t,e){return c?null!=_&&e>=_||e>=l&&i(t,n?e:e-l,o)!==!1:l>e||(null==_||_>e)&&i(t,n?e:e-l,o)!==!1},a,h);return null!=this.length?this.length:n?v:Math.max(0,v-l)},i},splice:function(t,e){var n=arguments.length;if(e=Math.max(0|e,0),0===n||2===n&&!e)return this;t=d(t,this.length);var r=this.slice(0,t);return 1===n?r:r.concat(s(arguments,2),this.slice(t+e))},flatten:function(){var t=this,e=t.__makeSequence();return e.__iterateUncached=function(e,n,r){var i=this;if(r)return this.cacheResult().__iterate(e,n,r);var u=0;return t.__iterate(function(t){u+=We(t).__iterate(function(t,n){return e(t,u+n,i)!==!1},n,r)},n,r),u},e},flatMap:function(t,e){return this.map(t,e).flatten()},skip:function(t){var e=this;if(0===t)return e;var n=e.__makeSequence();return n.__iterateUncached=function(n,r,i){var u=this;if(r)return this.cacheResult().__iterate(n,r,i);var s=e.__reversedIndices^i,a=!0,h=0,o=0,c=e.__iterate(function(e,r){return a&&(a=o++<t,a||(h=r)),a||n(e,s?r:r-h,u)!==!1},r,i);return s?h+1:c-h},n.length=this.length&&Math.max(0,this.length-t),n},skipWhile:function(t,e){var n=this,r=n.__makeSequence();return r.__iterateUncached=function(r,i,u){var s=this;if(i)return this.cacheResult().__iterate(r,i,u);var a=n.__reversedIndices^u,h=!0,o=0,c=n.__iterate(function(n,i,u){return h&&(h=t.call(e,n,i,u),h||(o=i)),h||r(n,a?i:i-o,s)!==!1},i,u);return a?o+1:c-o},r},groupBy:function(t,e,n){var r=this,i=Sn.empty().withMutations(function(e){r.forEach(function(i,u,s){var a=t(i,u,s),h=e.get(a,Ie);h===Ie&&(h=Array(n?r.length:0),e.set(a,h)),n?h[u]=i:h.push(i)})});return i.map(function(t){return We(t) <add>},slice:function(t,e,n){var r=this;if(m(t,e,r.length))return r;var i=r.__makeSequence(),u=d(t,r.length),s=y(e,r.length);return i.length=r.length&&(n?r.length:s-u),i.__reversedIndices=r.__reversedIndices,i.__iterateUncached=function(i,a,h){var o=this;if(a)return this.cacheResult().__iterate(i,a,h);var c=this.__reversedIndices^h;if(u!==u||s!==s||c&&null==r.length){var f=r.count();u=d(t,f),s=y(e,f)}var _=c?r.length-s:u,l=c?r.length-u:s,v=r.__iterate(function(t,e){return c?null!=l&&e>=l||e>=_&&i(t,n?e:e-_,o)!==!1:_>e||(null==l||l>e)&&i(t,n?e:e-_,o)!==!1},a,h);return null!=this.length?this.length:n?v:Math.max(0,v-_)},i},splice:function(t,e){var n=arguments.length;if(e=Math.max(0|e,0),0===n||2===n&&!e)return this;t=d(t,this.length);var r=this.slice(0,t);return 1===n?r:r.concat(s(arguments,2),this.slice(t+e))},flatten:function(){var t=this,e=t.__makeSequence();return e.__iterateUncached=function(e,n,r){var i=this;if(r)return this.cacheResult().__iterate(e,n,r);var u=0;return t.__iterate(function(t){u+=We(t).__iterate(function(t,n){return e(t,u+n,i)!==!1},n,r)},n,r),u},e},flatMap:function(t,e){return this.map(t,e).flatten()},skip:function(t){var e=this;if(0===t)return e;var n=e.__makeSequence();return n.__iterateUncached=function(n,r,i){var u=this;if(r)return this.cacheResult().__iterate(n,r,i);var s=e.__reversedIndices^i,a=!0,h=0,o=0,c=e.__iterate(function(e,r){return a&&(a=o++<t,a||(h=r)),a||n(e,s?r:r-h,u)!==!1},r,i);return s?h+1:c-h},n.length=this.length&&Math.max(0,this.length-t),n},skipWhile:function(t,e){var n=this,r=n.__makeSequence();return r.__iterateUncached=function(r,i,u){var s=this;if(i)return this.cacheResult().__iterate(r,i,u);var a=n.__reversedIndices^u,h=!0,o=0,c=n.__iterate(function(n,i,u){return h&&(h=t.call(e,n,i,u),h||(o=i)),h||r(n,a?i:i-o,s)!==!1},i,u);return a?o+1:c-o},r},groupBy:function(t,e,n){var r=this,i=Sn.empty().withMutations(function(e){r.forEach(function(i,u,s){var a=t(i,u,s),h=e.get(a,Ie);h===Ie&&(h=Array(n?r.length:0),e.set(a,h)),n?h[u]=i:h.push(i)})});return i.map(function(t){return We(t) <ide> })},sortBy:function(t,e,n){var r=de.superCall(this,Ke.prototype,"sortBy",[t,e]);return n||(r=r.valueSeq()),r.length=this.length,r},__makeSequence:function(){return g(this)}},{},We);var Be=ze.prototype;Be.__toJS=Be.toArray,Be.__toStringMapper=O,Be.chain=Be.flatMap;var Le=function(t){this._seq=t,this.length=t.length};de.createClass(Le,{get:function(t,e){return this._seq.get(t,e)},has:function(t){return this._seq.has(t)},__iterate:function(t,e){return this._seq.__iterate(t,e,e)}},{},We);var Ve=function(t){var e=Object.keys(t);this._object=t,this._keys=e,this.length=e.length};de.createClass(Ve,{toObject:function(){return this._object},get:function(t,e){return void 0===e||this.has(t)?this._object[t]:e},has:function(t){return this._object.hasOwnProperty(t)},__iterate:function(t,e){for(var n=this._object,r=this._keys,i=r.length-1,u=0;i>=u;u++){var s=e?i-u:u;if(t(n[r[s]],r[s],n)===!1)break}return u}},{},We);var Ne=function(t){this._array=t,this.length=t.length};de.createClass(Ne,{toArray:function(){return this._array},get:function(t,e){return this.has(t)?this._array[x(this,t)]:e},has:function(t){return t=x(this,t),t>=0&&this.length>t},__iterate:function(t,e,n){var r,i,u=this._array,s=u.length-1,a=e^n;for(r=0;s>=r;r++)if(i=s-r,t(u[e?i:r],n?i:r,u)===!1)return a?e?i:r:u.length;return u.length}},{},ze);var Fe=function(){};de.createClass(Fe,{toString:function(){return"[Iterator]"}},{});var Ge=Fe.prototype;Ge[De]=M,Ge.inspect=Ge.toSource=function(){return""+this};var He=function(t,e,n,r){r=r?r:t.getIn(e),this.length=r instanceof We?r.length:null,this._rootData=t,this._keyPath=e,this._onChange=n};de.createClass(He,{deref:function(t){return this._rootData.getIn(this._keyPath,t)},get:function(t,e){if(Array.isArray(t)&&0===t.length)return this;var n=this._rootData.getIn(this._keyPath.concat(t),Ie);return n===Ie?e:j(this,t,n)},set:function(t,e){return U(this,function(n){return n.set(t,e)},t)},remove:function(t){return U(this,function(e){return e.remove(t)},t)},clear:function(){return U(this,function(t){return t.clear()})},update:function(t,e,n){return 1===arguments.length?U(this,t):U(this,function(r){return r.update(t,e,n) <ide> },t)},withMutations:function(t){return U(this,function(e){return(e||Qe.empty()).withMutations(t)})},cursor:function(t){return Array.isArray(t)&&0===t.length?this:R(this,t)},__iterate:function(t,e,n){var r=this,i=r.deref();return i&&i.__iterate?i.__iterate(function(e,n,i){return t(j(r,n,e),n,i)},e,n):0}},{},We),He.prototype[be]=He.prototype.remove,He.prototype.getIn=He.prototype.get;var Qe=function(t){var e=Te.empty();return t?t.constructor===Te?t:e.merge(t):e},Te=Qe;de.createClass(Qe,{toString:function(){return this.__toString("Map {","}")},get:function(t,e){return this._root?this._root.get(0,c(t),t,e):e},set:function(t,e){return K(this,t,e)},remove:function(t){return K(this,t,Ie)},update:function(t,e,n){return 1===arguments.length?this.updateIn([],null,t):this.updateIn([t],e,n)},updateIn:function(t,e,n){var r;return n||(r=[e,n],n=r[0],e=r[1],r),T(this,t,e,n,0)},clear:function(){return 0===this.length?this:this.__ownerID?(this.length=0,this._root=null,this.__hash=void 0,this.__altered=!0,this):Te.empty()},merge:function(){return G(this,null,arguments)},mergeWith:function(t){for(var e=[],n=1;arguments.length>n;n++)e[n-1]=arguments[n];return G(this,t,e)},mergeDeep:function(){return G(this,H(null),arguments)},mergeDeepWith:function(t){for(var e=[],n=1;arguments.length>n;n++)e[n-1]=arguments[n];return G(this,H(t),e)},cursor:function(t,e){return e||"function"!=typeof t?0===arguments.length?t=[]:Array.isArray(t)||(t=[t]):(e=t,t=[]),new He(this,t,e)},withMutations:function(t){var e=this.asMutable();return t(e),e.wasAltered()?e.__ensureOwner(this.__ownerID):this},asMutable:function(){return this.__ownerID?this:this.__ensureOwner(new u)},asImmutable:function(){return this.__ensureOwner()},wasAltered:function(){return this.__altered},keys:function(){return new sn(this,0)},values:function(){return new sn(this,1)},entries:function(){return new sn(this,2)},__iterator:function(t){return new sn(this,2,t)},__iterate:function(t,e){var n=this;if(!n._root)return 0;var r=0;return this._root.iterate(function(e){return t(e[1],e[0],n)===!1?!1:void r++ <del>},e),r},__deepEquals:function(t){var e=this;return t.every(function(t,n){return W(e.get(n,Ie),t)})},__ensureOwner:function(t){return t===this.__ownerID?this:t?z(this.length,this._root,t,this.__hash):(this.__ownerID=t,this.__altered=!1,this)}},{empty:function(){return an||(an=z(0))}},We);var Xe=Qe.prototype;Xe[be]=Xe.remove,Xe[De]=function(){return this.entries()},Qe.from=Qe;var Ye=function(t,e,n){this.ownerID=t,this.bitmap=e,this.nodes=n},Ze=Ye;de.createClass(Ye,{get:function(t,e,n,r){var i=1<<((0===t?e:e>>>t)&Se),u=this.bitmap;return 0===(u&i)?r:this.nodes[X(u&i-1)].get(t+ye,e,n,r)},update:function(t,e,n,r,i,u,s){var a=(0===e?n:n>>>e)&Se,h=1<<a,o=this.bitmap,c=0!==(o&h);if(!c&&i===Ie)return this;var f=X(o&h-1),l=this.nodes,_=c?l[f]:null,v=B(_,t,e+ye,n,r,i,u,s);if(v===_)return this;if(!c&&v&&l.length>=hn)return F(t,l,o,a,v);if(c&&!v&&2===l.length&&L(l[1^f]))return l[1^f];if(c&&v&&1===l.length&&L(v))return v;var g=t&&t===this.ownerID,p=c?v?o:o^h:o|h,m=c?v?Y(l,f,v,g):$(l,f,g):Z(l,f,v,g);return g?(this.bitmap=p,this.nodes=m,this):new Ze(t,p,m)},iterate:function(t,e){for(var n=this.nodes,r=0,i=n.length-1;i>=r;r++)if(n[e?i-r:r].iterate(t,e)===!1)return!1}},{});var $e=function(t,e,n){this.ownerID=t,this.count=e,this.nodes=n},tn=$e;de.createClass($e,{get:function(t,e,n,r){var i=(0===t?e:e>>>t)&Se,u=this.nodes[i];return u?u.get(t+ye,e,n,r):r},update:function(t,e,n,r,i,u,s){var a=(0===e?n:n>>>e)&Se,h=i===Ie,o=this.nodes,c=o[a];if(h&&!c)return this;var f=B(c,t,e+ye,n,r,i,u,s);if(f===c)return this;var l=this.count;if(c){if(!f&&(l--,on>l))return N(t,o,l,a)}else l++;var _=t&&t===this.ownerID,v=Y(o,a,f,_);return _?(this.count=l,this.nodes=v,this):new tn(t,l,v)},iterate:function(t,e){for(var n=this.nodes,r=0,i=n.length-1;i>=r;r++){var u=n[e?i-r:r];if(u&&u.iterate(t,e)===!1)return!1}}},{});var en=function(t,e,n){this.ownerID=t,this.hash=e,this.entries=n},nn=en;de.createClass(en,{get:function(t,e,n,r){for(var i=this.entries,u=0,s=i.length;s>u;u++)if(W(n,i[u][0]))return i[u][1];return r},update:function(t,e,n,r,u,a,h){var o=u===Ie; <del>if(n!==this.hash)return o?this:(i(h),i(a),V(this,t,e,n,[r,u]));for(var c=this.entries,f=0,l=c.length;l>f&&!W(r,c[f][0]);f++);var _=l>f;if(o&&!_)return this;if(i(h),(o||!_)&&i(a),o&&2===l)return new rn(t,this.hash,c[1^f]);var v=t&&t===this.ownerID,g=v?c:s(c);return _?o?f===l-1?g.pop():g[f]=g.pop():g[f]=[r,u]:g.push([r,u]),v?(this.entries=g,this):new nn(t,this.hash,g)},iterate:function(t,e){for(var n=this.entries,r=0,i=n.length-1;i>=r;r++)if(t(n[e?i-r:r])===!1)return!1}},{});var rn=function(t,e,n){this.ownerID=t,this.hash=e,this.entry=n},un=rn;de.createClass(rn,{get:function(t,e,n,r){return W(n,this.entry[0])?this.entry[1]:r},update:function(t,e,n,r,u,s,a){var h=u===Ie,o=W(r,this.entry[0]);return(o?u===this.entry[1]:h)?this:(i(a),h?(i(s),null):o?t&&t===this.ownerID?(this.entry[1]=u,this):new un(t,n,[r,u]):(i(s),V(this,t,e,n,[r,u])))},iterate:function(t){return t(this.entry)}},{});var sn=function(t,e,n){this._type=e,this._reverse=n,this._stack=t._root&&J(t._root)};de.createClass(sn,{next:function(){for(var t=this._type,e=this._stack;e;){var n,r=e.node,i=e.index++;if(r.entry){if(0===i)return P(t,r.entry)}else if(r.entries){if(n=r.entries.length-1,n>=i)return P(t,r.entries[this._reverse?n-i:i])}else if(n=r.nodes.length-1,n>=i){var u=r.nodes[this._reverse?n-i:i];if(u){if(u.entry)return P(t,u.entry);e=this._stack=J(u,e)}continue}e=this._stack=this._stack.__prev}return h()}},{},Fe);var an,hn=we/2,on=we/4,cn=function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];return fn.from(t)},fn=cn;de.createClass(cn,{toString:function(){return this.__toString("Vector [","]")},has:function(t){return t=x(this,t),t>=0&&this.length>t},get:function(t,e){if(t=x(this,t),0>t||t>=this.length)return e;t+=this._origin;var n=se(this,t);return n&&n.array[t&Se]},first:function(){return this.get(0)},last:function(){return this.get(this.length?this.length-1:0)},set:function(t,e){return re(this,t,e)},remove:function(t){return re(this,t,Ie)},clear:function(){return 0===this.length?this:this.__ownerID?(this.length=this._origin=this._size=0,this._level=ye,this._root=this._tail=null,this.__hash=void 0,this.__altered=!0,this):fn.empty() <del>},push:function(){var t=arguments,e=this.length;return this.withMutations(function(n){ae(n,0,e+t.length);for(var r=0;t.length>r;r++)n.set(e+r,t[r])})},pop:function(){return ae(this,0,-1)},unshift:function(){var t=arguments;return this.withMutations(function(e){ae(e,-t.length);for(var n=0;t.length>n;n++)e.set(n,t[n])})},shift:function(){return ae(this,1)},merge:function(){return he(this,null,arguments)},mergeWith:function(t){for(var e=[],n=1;arguments.length>n;n++)e[n-1]=arguments[n];return he(this,t,e)},mergeDeep:function(){return he(this,H(null),arguments)},mergeDeepWith:function(t){for(var e=[],n=1;arguments.length>n;n++)e[n-1]=arguments[n];return he(this,H(t),e)},setLength:function(t){return ae(this,0,t)},slice:function(t,e,n){var r=de.superCall(this,fn.prototype,"slice",[t,e,n]);if(!n&&r!==this){var i=this,u=i.length;r.toVector=function(){return ae(i,0>t?Math.max(0,u+t):u?Math.min(u,t):t,null==e?u:0>e?Math.max(0,u+e):u?Math.min(u,e):e)}}return r},keys:function(){return new gn(this,0)},values:function(){return new gn(this,1)},entries:function(){return new gn(this,2)},__iterator:function(t,e){return new gn(this,2,t,e)},__iterate:function(t,e,n){var r=this,i=0,u=r.length-1;n^=e;var s,a=function(e,s){return t(e,n?u-s:s,r)===!1?!1:(i=s,!0)},h=oe(this._size);return s=e?te(this._tail,0,h-this._origin,this._size-this._origin,a,e)&&te(this._root,this._level,-this._origin,h-this._origin,a,e):te(this._root,this._level,-this._origin,h-this._origin,a,e)&&te(this._tail,0,h-this._origin,this._size-this._origin,a,e),(s?u:e?u-i:i)+1},__deepEquals:function(t){var e=this.entries(!0);return t.every(function(t,n){var r=e.next().value;return r&&r[0]===n&&W(r[1],t)})},__ensureOwner:function(t){return t===this.__ownerID?this:t?ne(this._origin,this._size,this._level,this._root,this._tail,t,this.__hash):(this.__ownerID=t,this)}},{empty:function(){return pn||(pn=ne(0,0,ye))},from:function(t){if(!t||0===t.length)return fn.empty();if(t.constructor===fn)return t;var e=Array.isArray(t);return t.length>0&&we>t.length?ne(0,t.length,ye,null,new _n(e?s(t):We(t).toArray())):(e||(t=We(t),t instanceof ze||(t=t.valueSeq())),fn.empty().merge(t)) <del>}},ze);var ln=cn.prototype;ln[be]=ln.remove,ln[De]=ln.values,ln.update=Xe.update,ln.updateIn=Xe.updateIn,ln.cursor=Xe.cursor,ln.withMutations=Xe.withMutations,ln.asMutable=Xe.asMutable,ln.asImmutable=Xe.asImmutable,ln.wasAltered=Xe.wasAltered;var _n=function(t,e){this.array=t,this.ownerID=e},vn=_n;de.createClass(_n,{removeBefore:function(t,e,n){if(n===e?1<<e:0||0===this.array.length)return this;var r=n>>>e&Se;if(r>=this.array.length)return new vn([],t);var i,u=0===r;if(e>0){var s=this.array[r];if(i=s&&s.removeBefore(t,e-ye,n),i===s&&u)return this}if(u&&!i)return this;var a=ue(this,t);if(!u)for(var h=0;r>h;h++)a.array[h]=void 0;return i&&(a.array[r]=i),a},removeAfter:function(t,e,n){if(n===e?1<<e:0||0===this.array.length)return this;var r=n-1>>>e&Se;if(r>=this.array.length)return this;var i,u=r===this.array.length-1;if(e>0){var s=this.array[r];if(i=s&&s.removeAfter(t,e-ye,n),i===s&&u)return this}if(u&&!i)return this;var a=ue(this,t);return u||a.array.pop(),i&&(a.array[r]=i),a}},{});var gn=function(t,e,n,r){this._type=e,this._reverse=!!n,this._flipIndices=!!(r^n),this._maxIndex=t.length-1;var i=oe(t._size),u=ee(t._root&&t._root.array,t._level,-t._origin,i-t._origin-1),s=ee(t._tail&&t._tail.array,0,i-t._origin,t._size-t._origin-1);this._stack=n?s:u,this._stack.__prev=n?u:s};de.createClass(gn,{next:function(){for(var t=this._stack;t;){var e=t.array,n=t.index++;if(this._reverse&&(n=Se-n,n>t.rawMax&&(n=t.rawMax,t.index=we-n)),n>=0&&we>n&&t.rawMax>=n){var r=e&&e[n];if(0===t.level){var i,u=this._type;return 1!==u&&(i=t.offset+(n<<t.level),this._flipIndices&&(i=this._maxIndex-i)),a(0===u?i:1===u?r:[i,r])}this._stack=t=ee(r&&r.array,t.level-ye,t.offset+(n<<t.level),t.max,t)}else t=this._stack=this._stack.__prev}return h()}},{},Fe);var pn,mn=function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];return dn.from(t)},dn=mn;de.createClass(mn,{toString:function(){return this.__toString("Set {","}")},has:function(t){return this._map.has(t)},get:function(t,e){return this.has(t)?t:e},add:function(t){var e=this._map.set(t,null); <add>},e),r},__deepEquals:function(t){var e=this;return t.every(function(t,n){return W(e.get(n,Ie),t)})},__ensureOwner:function(t){return t===this.__ownerID?this:t?z(this.length,this._root,t,this.__hash):(this.__ownerID=t,this.__altered=!1,this)}},{empty:function(){return an||(an=z(0))}},We);var Xe=Qe.prototype;Xe[be]=Xe.remove,Xe[De]=function(){return this.entries()},Qe.from=Qe;var Ye=function(t,e,n){this.ownerID=t,this.bitmap=e,this.nodes=n},Ze=Ye;de.createClass(Ye,{get:function(t,e,n,r){var i=1<<((0===t?e:e>>>t)&Se),u=this.bitmap;return 0===(u&i)?r:this.nodes[X(u&i-1)].get(t+ye,e,n,r)},update:function(t,e,n,r,i,u,s){var a=(0===e?n:n>>>e)&Se,h=1<<a,o=this.bitmap,c=0!==(o&h);if(!c&&i===Ie)return this;var f=X(o&h-1),_=this.nodes,l=c?_[f]:null,v=B(l,t,e+ye,n,r,i,u,s);if(v===l)return this;if(!c&&v&&_.length>=hn)return F(t,_,o,a,v);if(c&&!v&&2===_.length&&L(_[1^f]))return _[1^f];if(c&&v&&1===_.length&&L(v))return v;var g=t&&t===this.ownerID,p=c?v?o:o^h:o|h,m=c?v?Y(_,f,v,g):$(_,f,g):Z(_,f,v,g);return g?(this.bitmap=p,this.nodes=m,this):new Ze(t,p,m)},iterate:function(t,e){for(var n=this.nodes,r=0,i=n.length-1;i>=r;r++)if(n[e?i-r:r].iterate(t,e)===!1)return!1}},{});var $e=function(t,e,n){this.ownerID=t,this.count=e,this.nodes=n},tn=$e;de.createClass($e,{get:function(t,e,n,r){var i=(0===t?e:e>>>t)&Se,u=this.nodes[i];return u?u.get(t+ye,e,n,r):r},update:function(t,e,n,r,i,u,s){var a=(0===e?n:n>>>e)&Se,h=i===Ie,o=this.nodes,c=o[a];if(h&&!c)return this;var f=B(c,t,e+ye,n,r,i,u,s);if(f===c)return this;var _=this.count;if(c){if(!f&&(_--,on>_))return N(t,o,_,a)}else _++;var l=t&&t===this.ownerID,v=Y(o,a,f,l);return l?(this.count=_,this.nodes=v,this):new tn(t,_,v)},iterate:function(t,e){for(var n=this.nodes,r=0,i=n.length-1;i>=r;r++){var u=n[e?i-r:r];if(u&&u.iterate(t,e)===!1)return!1}}},{});var en=function(t,e,n){this.ownerID=t,this.hash=e,this.entries=n},nn=en;de.createClass(en,{get:function(t,e,n,r){for(var i=this.entries,u=0,s=i.length;s>u;u++)if(W(n,i[u][0]))return i[u][1];return r},update:function(t,e,n,r,u,a,h){var o=u===Ie; <add>if(n!==this.hash)return o?this:(i(h),i(a),V(this,t,e,n,[r,u]));for(var c=this.entries,f=0,_=c.length;_>f&&!W(r,c[f][0]);f++);var l=_>f;if(o&&!l)return this;if(i(h),(o||!l)&&i(a),o&&2===_)return new rn(t,this.hash,c[1^f]);var v=t&&t===this.ownerID,g=v?c:s(c);return l?o?f===_-1?g.pop():g[f]=g.pop():g[f]=[r,u]:g.push([r,u]),v?(this.entries=g,this):new nn(t,this.hash,g)},iterate:function(t,e){for(var n=this.entries,r=0,i=n.length-1;i>=r;r++)if(t(n[e?i-r:r])===!1)return!1}},{});var rn=function(t,e,n){this.ownerID=t,this.hash=e,this.entry=n},un=rn;de.createClass(rn,{get:function(t,e,n,r){return W(n,this.entry[0])?this.entry[1]:r},update:function(t,e,n,r,u,s,a){var h=u===Ie,o=W(r,this.entry[0]);return(o?u===this.entry[1]:h)?this:(i(a),h?(i(s),null):o?t&&t===this.ownerID?(this.entry[1]=u,this):new un(t,n,[r,u]):(i(s),V(this,t,e,n,[r,u])))},iterate:function(t){return t(this.entry)}},{});var sn=function(t,e,n){this._type=e,this._reverse=n,this._stack=t._root&&J(t._root)};de.createClass(sn,{next:function(){for(var t=this._type,e=this._stack;e;){var n,r=e.node,i=e.index++;if(r.entry){if(0===i)return P(t,r.entry)}else if(r.entries){if(n=r.entries.length-1,n>=i)return P(t,r.entries[this._reverse?n-i:i])}else if(n=r.nodes.length-1,n>=i){var u=r.nodes[this._reverse?n-i:i];if(u){if(u.entry)return P(t,u.entry);e=this._stack=J(u,e)}continue}e=this._stack=this._stack.__prev}return h()}},{},Fe);var an,hn=we/2,on=we/4,cn=function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];return fn.from(t)},fn=cn;de.createClass(cn,{toString:function(){return this.__toString("Vector [","]")},has:function(t){return t=x(this,t),t>=0&&this.length>t},get:function(t,e){if(t=x(this,t),0>t||t>=this.length)return e;t+=this._origin;var n=se(this,t);return n&&n.array[t&Se]},first:function(){return this.get(0)},last:function(){return this.get(this.length?this.length-1:0)},set:function(t,e){return re(this,t,e)},remove:function(t){return re(this,t,Ie)},clear:function(){return 0===this.length?this:this.__ownerID?(this.length=this._origin=this._size=0,this._level=ye,this._root=this._tail=null,this.__hash=void 0,this.__altered=!0,this):fn.empty() <add>},push:function(){var t=arguments,e=this.length;return this.withMutations(function(n){ae(n,0,e+t.length);for(var r=0;t.length>r;r++)n.set(e+r,t[r])})},pop:function(){return ae(this,0,-1)},unshift:function(){var t=arguments;return this.withMutations(function(e){ae(e,-t.length);for(var n=0;t.length>n;n++)e.set(n,t[n])})},shift:function(){return ae(this,1)},merge:function(){return he(this,null,arguments)},mergeWith:function(t){for(var e=[],n=1;arguments.length>n;n++)e[n-1]=arguments[n];return he(this,t,e)},mergeDeep:function(){return he(this,H(null),arguments)},mergeDeepWith:function(t){for(var e=[],n=1;arguments.length>n;n++)e[n-1]=arguments[n];return he(this,H(t),e)},setLength:function(t){return ae(this,0,t)},slice:function(t,e,n){var r=de.superCall(this,fn.prototype,"slice",[t,e,n]);if(!n&&r!==this){var i=this,u=i.length;r.toVector=function(){return ae(i,0>t?Math.max(0,u+t):u?Math.min(u,t):t,null==e?u:0>e?Math.max(0,u+e):u?Math.min(u,e):e)}}return r},keys:function(){return new gn(this,0)},values:function(){return new gn(this,1)},entries:function(){return new gn(this,2)},__iterator:function(t,e){return new gn(this,2,t,e)},__iterate:function(t,e,n){var r=this,i=0,u=r.length-1;n^=e;var s,a=function(e,s){return t(e,n?u-s:s,r)===!1?!1:(i=s,!0)},h=oe(this._size);return s=e?te(this._tail,0,h-this._origin,this._size-this._origin,a,e)&&te(this._root,this._level,-this._origin,h-this._origin,a,e):te(this._root,this._level,-this._origin,h-this._origin,a,e)&&te(this._tail,0,h-this._origin,this._size-this._origin,a,e),(s?u:e?u-i:i)+1},__deepEquals:function(t){var e=this.entries(!0);return t.every(function(t,n){var r=e.next().value;return r&&r[0]===n&&W(r[1],t)})},__ensureOwner:function(t){return t===this.__ownerID?this:t?ne(this._origin,this._size,this._level,this._root,this._tail,t,this.__hash):(this.__ownerID=t,this)}},{empty:function(){return pn||(pn=ne(0,0,ye))},from:function(t){if(!t||0===t.length)return fn.empty();if(t.constructor===fn)return t;var e=Array.isArray(t);return t.length>0&&we>t.length?ne(0,t.length,ye,null,new ln(e?s(t):We(t).toArray())):(e||(t=We(t),t instanceof ze||(t=t.valueSeq())),fn.empty().merge(t)) <add>}},ze);var _n=cn.prototype;_n[be]=_n.remove,_n[De]=_n.values,_n.update=Xe.update,_n.updateIn=Xe.updateIn,_n.cursor=Xe.cursor,_n.withMutations=Xe.withMutations,_n.asMutable=Xe.asMutable,_n.asImmutable=Xe.asImmutable,_n.wasAltered=Xe.wasAltered;var ln=function(t,e){this.array=t,this.ownerID=e},vn=ln;de.createClass(ln,{removeBefore:function(t,e,n){if(n===e?1<<e:0||0===this.array.length)return this;var r=n>>>e&Se;if(r>=this.array.length)return new vn([],t);var i,u=0===r;if(e>0){var s=this.array[r];if(i=s&&s.removeBefore(t,e-ye,n),i===s&&u)return this}if(u&&!i)return this;var a=ue(this,t);if(!u)for(var h=0;r>h;h++)a.array[h]=void 0;return i&&(a.array[r]=i),a},removeAfter:function(t,e,n){if(n===e?1<<e:0||0===this.array.length)return this;var r=n-1>>>e&Se;if(r>=this.array.length)return this;var i,u=r===this.array.length-1;if(e>0){var s=this.array[r];if(i=s&&s.removeAfter(t,e-ye,n),i===s&&u)return this}if(u&&!i)return this;var a=ue(this,t);return u||a.array.pop(),i&&(a.array[r]=i),a}},{});var gn=function(t,e,n,r){this._type=e,this._reverse=!!n,this._flipIndices=!!(r^n),this._maxIndex=t.length-1;var i=oe(t._size),u=ee(t._root&&t._root.array,t._level,-t._origin,i-t._origin-1),s=ee(t._tail&&t._tail.array,0,i-t._origin,t._size-t._origin-1);this._stack=n?s:u,this._stack.__prev=n?u:s};de.createClass(gn,{next:function(){for(var t=this._stack;t;){var e=t.array,n=t.index++;if(this._reverse&&(n=Se-n,n>t.rawMax&&(n=t.rawMax,t.index=we-n)),n>=0&&we>n&&t.rawMax>=n){var r=e&&e[n];if(0===t.level){var i,u=this._type;return 1!==u&&(i=t.offset+(n<<t.level),this._flipIndices&&(i=this._maxIndex-i)),a(0===u?i:1===u?r:[i,r])}this._stack=t=ee(r&&r.array,t.level-ye,t.offset+(n<<t.level),t.max,t)}else t=this._stack=this._stack.__prev}return h()}},{},Fe);var pn,mn=function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];return dn.from(t)},dn=mn;de.createClass(mn,{toString:function(){return this.__toString("Set {","}")},has:function(t){return this._map.has(t)},get:function(t,e){return this.has(t)?t:e},add:function(t){var e=this._map.set(t,null); <ide> return this.__ownerID?(this.length=e.length,this._map=e,this):e===this._map?this:ce(e)},remove:function(t){var e=this._map.remove(t);return this.__ownerID?(this.length=e.length,this._map=e,this):e===this._map?this:0===e.length?dn.empty():ce(e)},clear:function(){return 0===this.length?this:this.__ownerID?(this.length=0,this._map.clear(),this):dn.empty()},union:function(){var t=arguments;return 0===t.length?this:this.withMutations(function(e){for(var n=0;t.length>n;n++)We(t[n]).forEach(function(t){return e.add(t)})})},intersect:function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];if(0===t.length)return this;t=t.map(function(t){return We(t)});var n=this;return this.withMutations(function(e){n.forEach(function(n){t.every(function(t){return t.contains(n)})||e.remove(n)})})},subtract:function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];if(0===t.length)return this;t=t.map(function(t){return We(t)});var n=this;return this.withMutations(function(e){n.forEach(function(n){t.some(function(t){return t.contains(n)})&&e.remove(n)})})},isSubset:function(t){return t=We(t),this.every(function(e){return t.contains(e)})},isSuperset:function(t){var e=this;return t=We(t),t.every(function(t){return e.contains(t)})},wasAltered:function(){return this._map.wasAltered()},values:function(){return this._map.keys()},entries:function(){return E(this.values(),function(t){return[t,t]})},hashCode:function(){return this._map.hashCode()},__iterate:function(t,e){var n=this;return this._map.__iterate(function(e,r){return t(r,r,n)},e)},__deepEquals:function(t){return this.isSuperset(t)},__ensureOwner:function(t){if(t===this.__ownerID)return this;var e=this._map.__ensureOwner(t);return t?ce(e,t):(this.__ownerID=t,this._map=e,this)}},{empty:function(){return wn||(wn=ce(Qe.empty()))},from:function(t){var e=dn.empty();return t?t.constructor===dn?t:e.union(t):e},fromKeys:function(t){return dn.from(We(t).flip())}},We);var yn=mn.prototype;yn[be]=yn.remove,yn[De]=yn.keys=yn.values,yn.contains=yn.has,yn.mergeDeep=yn.merge=yn.union,yn.mergeDeepWith=yn.mergeWith=function(){for(var t=[],e=1;arguments.length>e;e++)t[e-1]=arguments[e]; <del>return this.merge.apply(this,t)},yn.withMutations=Xe.withMutations,yn.asMutable=Xe.asMutable,yn.asImmutable=Xe.asImmutable,yn.__toJS=Be.__toJS,yn.__toStringMapper=Be.__toStringMapper;var wn,Sn=function(t){var e=In.empty();return t?t.constructor===In?t:e.merge(t):e},In=Sn;de.createClass(Sn,{toString:function(){return this.__toString("OrderedMap {","}")},get:function(t,e){var n=this._map.get(t);return null!=n?this._vector.get(n)[1]:e},clear:function(){return 0===this.length?this:this.__ownerID?(this.length=0,this._map.clear(),this._vector.clear(),this):In.empty()},set:function(t,e){return le(this,t,e)},remove:function(t){return le(this,t,Ie)},wasAltered:function(){return this._map.wasAltered()||this._vector.wasAltered()},keys:function(){return E(this.entries(),function(t){return t[0]})},values:function(){return E(this.entries(),function(t){return t[1]})},entries:function(){return this._vector.values(!0)},__iterate:function(t,e){return this._vector.fromEntrySeq().__iterate(t,e)},__deepEquals:function(t){var e=this.entries();return t.every(function(t,n){var r=e.next().value;return r&&W(r[0],n)&&W(r[1],t)})},__ensureOwner:function(t){if(t===this.__ownerID)return this;var e=this._map.__ensureOwner(t),n=this._vector.__ensureOwner(t);return t?fe(e,n,t,this.__hash):(this.__ownerID=t,this._map=e,this._vector=n,this)}},{empty:function(){return kn||(kn=fe(Qe.empty(),cn.empty()))}},Qe),Sn.from=Sn,Sn.prototype[be]=Sn.prototype.remove;var kn,Mn=function(t,e){var n=function(t){return this instanceof n?void(this._map=Qe(t)):new n(t)};t=We(t);var r=n.prototype=Object.create(bn);r.constructor=n,r._name=e,r._defaultValues=t;var i=Object.keys(t);return n.prototype.length=i.length,Object.defineProperty&&t.forEach(function(t,e){Object.defineProperty(n.prototype,e,{get:function(){return this.get(e)},set:function(t){o(this.__ownerID,"Cannot set on an immutable record."),this.set(e,t)}})}),n},qn=Mn;de.createClass(Mn,{toString:function(){return this.__toString((this._name||"Record")+" {","}")},has:function(t){return this._defaultValues.has(t) <del>},get:function(t,e){return void 0===e||this.has(t)?this._map.get(t,this._defaultValues.get(t)):e},clear:function(){if(this.__ownerID)return this._map.clear(),this;Object.getPrototypeOf(this).constructor;return qn._empty||(qn._empty=_e(this,Qe.empty()))},set:function(t,e){if(null==t||!this.has(t))return this;var n=this._map.set(t,e);return this.__ownerID||n===this._map?this:_e(this,n)},remove:function(t){if(null==t||!this.has(t))return this;var e=this._map.remove(t);return this.__ownerID||e===this._map?this:_e(this,e)},keys:function(){return this._map.keys()},values:function(){return this._map.values()},entries:function(){return this._map.entries()},wasAltered:function(){return this._map.wasAltered()},__iterate:function(t,e){var n=this;return this._defaultValues.map(function(t,e){return n.get(e)}).__iterate(t,e)},__ensureOwner:function(t){if(t===this.__ownerID)return this;var e=this._map&&this._map.__ensureOwner(t);return t?_e(this,e,t):(this.__ownerID=t,this._map=e,this)}},{},We);var bn=Mn.prototype;bn[be]=bn.remove,bn[De]=Xe[De],bn.merge=Xe.merge,bn.mergeWith=Xe.mergeWith,bn.mergeDeep=Xe.mergeDeep,bn.mergeDeepWith=Xe.mergeDeepWith,bn.update=Xe.update,bn.updateIn=Xe.updateIn,bn.cursor=Xe.cursor,bn.withMutations=Xe.withMutations,bn.asMutable=Xe.asMutable,bn.asImmutable=Xe.asImmutable,bn.__deepEquals=Xe.__deepEquals;var Dn=function(t,e,n){return this instanceof On?(o(0!==n,"Cannot step a Range by 0"),t=t||0,null==e&&(e=1/0),t===e&&xn?xn:(n=null==n?1:Math.abs(n),t>e&&(n=-n),this._start=t,this._end=e,this._step=n,void(this.length=Math.max(0,Math.ceil((e-t)/n-1)+1)))):new On(t,e,n)},On=Dn;de.createClass(Dn,{toString:function(){return 0===this.length?"Range []":"Range [ "+this._start+"..."+this._end+(this._step>1?" by "+this._step:"")+" ]"},has:function(t){return t=x(this,t),t>=0&&(1/0===this.length||this.length>t)},get:function(t,e){return t=x(this,t),this.has(t)?this._start+t*this._step:e},contains:function(t){var e=(t-this._start)/this._step;return e>=0&&this.length>e&&e===Math.floor(e)},slice:function(t,e,n){return m(t,e,this.length)?this:n?de.superCall(this,On.prototype,"slice",[t,e,n]):(t=d(t,this.length),e=y(e,this.length),t>=e?xn:new On(this.get(t,this._end),this.get(e,this._end),this._step)) <del>},indexOf:function(t){var e=t-this._start;if(e%this._step===0){var n=e/this._step;if(n>=0&&this.length>n)return n}return-1},lastIndexOf:function(t){return this.indexOf(t)},take:function(t){return this.slice(0,t)},skip:function(t,e){return e?de.superCall(this,On.prototype,"skip",[t]):this.slice(t)},__iterate:function(t,e,n){for(var r=this.length-1,i=this._step,u=e?this._start+r*i:this._start,s=0;r>=s&&t(u,n?r-s:s,this)!==!1;s++)u+=e?-i:i;return n?this.length:s},__deepEquals:function(t){return this._start===t._start&&this._end===t._end&&this._step===t._step}},{},ze);var An=Dn.prototype;An.__toJS=An.toArray,An.first=ln.first,An.last=ln.last;var xn=Dn(0,0),Cn=function(t,e){return 0===e&&Rn?Rn:this instanceof En?(this._value=t,void(this.length=null==e?1/0:Math.max(0,e))):new En(t,e)},En=Cn;de.createClass(Cn,{toString:function(){return 0===this.length?"Repeat []":"Repeat [ "+this._value+" "+this.length+" times ]"},get:function(t,e){return this.has(t)?this._value:e},first:function(){return this._value},contains:function(t){return W(this._value,t)},slice:function(t,e,n){if(n)return de.superCall(this,En.prototype,"slice",[t,e,n]);var r=this.length;return t=0>t?Math.max(0,r+t):Math.min(r,t),e=null==e?r:e>0?Math.min(r,e):Math.max(0,r+e),e>t?new En(this._value,e-t):Rn},reverse:function(t){return t?de.superCall(this,En.prototype,"reverse",[t]):this},indexOf:function(t){return W(this._value,t)?0:-1},lastIndexOf:function(t){return W(this._value,t)?this.length:-1},__iterate:function(t,e,n){var r=e^n;o(!r||1/0>this.length,"Cannot access end of infinite range.");for(var i=this.length-1,u=0;i>=u&&t(this._value,r?i-u:u,this)!==!1;u++);return r?this.length:u},__deepEquals:function(t){return W(this._value,t._value)}},{},ze);var jn=Cn.prototype;jn.last=jn.first,jn.has=An.has,jn.take=An.take,jn.skip=An.skip,jn.__toJS=An.__toJS;var Rn=new Cn(void 0,0),Un={Sequence:We,Map:Qe,Vector:cn,Set:mn,OrderedMap:Sn,Record:Mn,Range:Dn,Repeat:Cn,is:W,fromJS:ve};return Un}"object"==typeof exports?module.exports=t():"function"==typeof define&&define.amd?define(t):Immutable=t(); <add>return this.merge.apply(this,t)},yn.withMutations=Xe.withMutations,yn.asMutable=Xe.asMutable,yn.asImmutable=Xe.asImmutable,yn.__toJS=Be.__toJS,yn.__toStringMapper=Be.__toStringMapper;var wn,Sn=function(t){var e=In.empty();return t?t.constructor===In?t:e.merge(t):e},In=Sn;de.createClass(Sn,{toString:function(){return this.__toString("OrderedMap {","}")},get:function(t,e){var n=this._map.get(t);return null!=n?this._vector.get(n)[1]:e},clear:function(){return 0===this.length?this:this.__ownerID?(this.length=0,this._map.clear(),this._vector.clear(),this):In.empty()},set:function(t,e){return _e(this,t,e)},remove:function(t){return _e(this,t,Ie)},wasAltered:function(){return this._map.wasAltered()||this._vector.wasAltered()},keys:function(){return E(this.entries(),function(t){return t[0]})},values:function(){return E(this.entries(),function(t){return t[1]})},entries:function(){return this._vector.values(!0)},__iterate:function(t,e){return this._vector.fromEntrySeq().__iterate(t,e)},__deepEquals:function(t){var e=this.entries();return t.every(function(t,n){var r=e.next().value;return r&&W(r[0],n)&&W(r[1],t)})},__ensureOwner:function(t){if(t===this.__ownerID)return this;var e=this._map.__ensureOwner(t),n=this._vector.__ensureOwner(t);return t?fe(e,n,t,this.__hash):(this.__ownerID=t,this._map=e,this._vector=n,this)}},{empty:function(){return kn||(kn=fe(Qe.empty(),cn.empty()))}},Qe),Sn.from=Sn,Sn.prototype[be]=Sn.prototype.remove;var kn,Mn=function(t,e){var n=function(t){return this instanceof n?void(this._map=Qe(t)):new n(t)};t=We(t);var r=n.prototype=Object.create(bn);r.constructor=n,r._name=e,r._defaultValues=t;var i=Object.keys(t);return n.prototype.length=i.length,Object.defineProperty&&t.forEach(function(t,e){Object.defineProperty(n.prototype,e,{get:function(){return this.get(e)},set:function(t){o(this.__ownerID,"Cannot set on an immutable record."),this.set(e,t)}})}),n},qn=Mn;de.createClass(Mn,{toString:function(){return this.__toString((this._name||"Record")+" {","}")},has:function(t){return this._defaultValues.has(t) <add>},get:function(t,e){return void 0===e||this.has(t)?this._map.get(t,this._defaultValues.get(t)):e},clear:function(){if(this.__ownerID)return this._map.clear(),this;Object.getPrototypeOf(this).constructor;return qn._empty||(qn._empty=le(this,Qe.empty()))},set:function(t,e){if(null==t||!this.has(t))return this;var n=this._map.set(t,e);return this.__ownerID||n===this._map?this:le(this,n)},remove:function(t){if(null==t||!this.has(t))return this;var e=this._map.remove(t);return this.__ownerID||e===this._map?this:le(this,e)},keys:function(){return this._map.keys()},values:function(){return this._map.values()},entries:function(){return this._map.entries()},wasAltered:function(){return this._map.wasAltered()},__iterate:function(t,e){var n=this;return this._defaultValues.map(function(t,e){return n.get(e)}).__iterate(t,e)},__ensureOwner:function(t){if(t===this.__ownerID)return this;var e=this._map&&this._map.__ensureOwner(t);return t?le(this,e,t):(this.__ownerID=t,this._map=e,this)}},{},We);var bn=Mn.prototype;bn[be]=bn.remove,bn[De]=Xe[De],bn.merge=Xe.merge,bn.mergeWith=Xe.mergeWith,bn.mergeDeep=Xe.mergeDeep,bn.mergeDeepWith=Xe.mergeDeepWith,bn.update=Xe.update,bn.updateIn=Xe.updateIn,bn.cursor=Xe.cursor,bn.withMutations=Xe.withMutations,bn.asMutable=Xe.asMutable,bn.asImmutable=Xe.asImmutable,bn.__deepEquals=Xe.__deepEquals;var Dn=function(t,e,n){return this instanceof On?(o(0!==n,"Cannot step a Range by 0"),t=t||0,null==e&&(e=1/0),t===e&&xn?xn:(n=null==n?1:Math.abs(n),t>e&&(n=-n),this._start=t,this._end=e,this._step=n,void(this.length=Math.max(0,Math.ceil((e-t)/n-1)+1)))):new On(t,e,n)},On=Dn;de.createClass(Dn,{toString:function(){return 0===this.length?"Range []":"Range [ "+this._start+"..."+this._end+(this._step>1?" by "+this._step:"")+" ]"},has:function(t){return t=x(this,t),t>=0&&(1/0===this.length||this.length>t)},get:function(t,e){return t=x(this,t),this.has(t)?this._start+t*this._step:e},contains:function(t){var e=(t-this._start)/this._step;return e>=0&&this.length>e&&e===Math.floor(e)},slice:function(t,e,n){return m(t,e,this.length)?this:n?de.superCall(this,On.prototype,"slice",[t,e,n]):(t=d(t,this.length),e=y(e,this.length),t>=e?xn:new On(this.get(t,this._end),this.get(e,this._end),this._step)) <add>},indexOf:function(t){var e=t-this._start;if(e%this._step===0){var n=e/this._step;if(n>=0&&this.length>n)return n}return-1},lastIndexOf:function(t){return this.indexOf(t)},take:function(t){return this.slice(0,t)},skip:function(t){return this.slice(t)},__iterate:function(t,e,n){for(var r=this.length-1,i=this._step,u=e?this._start+r*i:this._start,s=0;r>=s&&t(u,n?r-s:s,this)!==!1;s++)u+=e?-i:i;return n?this.length:s},__deepEquals:function(t){return this._start===t._start&&this._end===t._end&&this._step===t._step}},{},ze);var An=Dn.prototype;An.__toJS=An.toArray,An.first=_n.first,An.last=_n.last;var xn=Dn(0,0),Cn=function(t,e){return 0===e&&Rn?Rn:this instanceof En?(this._value=t,void(this.length=null==e?1/0:Math.max(0,e))):new En(t,e)},En=Cn;de.createClass(Cn,{toString:function(){return 0===this.length?"Repeat []":"Repeat [ "+this._value+" "+this.length+" times ]"},get:function(t,e){return this.has(t)?this._value:e},first:function(){return this._value},contains:function(t){return W(this._value,t)},slice:function(t,e,n){if(n)return de.superCall(this,En.prototype,"slice",[t,e,n]);var r=this.length;return t=0>t?Math.max(0,r+t):Math.min(r,t),e=null==e?r:e>0?Math.min(r,e):Math.max(0,r+e),e>t?new En(this._value,e-t):Rn},reverse:function(){return this},indexOf:function(t){return W(this._value,t)?0:-1},lastIndexOf:function(t){return W(this._value,t)?this.length:-1},__iterate:function(t,e,n){var r=e^n;o(!r||1/0>this.length,"Cannot access end of infinite range.");for(var i=this.length-1,u=0;i>=u&&t(this._value,r?i-u:u,this)!==!1;u++);return r?this.length:u},__deepEquals:function(t){return W(this._value,t._value)}},{},ze);var jn=Cn.prototype;jn.last=jn.first,jn.has=An.has,jn.take=An.take,jn.skip=An.skip,jn.__toJS=An.__toJS;var Rn=new Cn(void 0,0),Un={Sequence:We,Map:Qe,Vector:cn,Set:mn,OrderedMap:Sn,Record:Mn,Range:Dn,Repeat:Cn,is:W,fromJS:ve};return Un}"object"==typeof exports?module.exports=t():"function"==typeof define&&define.amd?define(t):Immutable=t(); <ide>\ No newline at end of file <ide><path>src/Range.js <ide> class Range extends IndexedSequence { <ide> return this.slice(0, amount); <ide> } <ide> <del> skip(amount, maintainIndices) { <del> return maintainIndices ? super.skip(amount) : this.slice(amount); <add> skip(amount) { <add> return this.slice(amount); <ide> } <ide> <ide> __iterate(fn, reverse, flipIndices) { <ide><path>src/Repeat.js <ide> class Repeat extends IndexedSequence { <ide> return end > begin ? new Repeat(this._value, end - begin) : EMPTY_REPEAT; <ide> } <ide> <del> reverse(maintainIndices) { <del> return maintainIndices ? super.reverse(maintainIndices) : this; <add> reverse() { <add> return this; <ide> } <ide> <ide> indexOf(searchValue) {
4
Go
Go
store the actual archive when commit
aaaf3f072601923594754e46c1f0152847d9c2d9
<ide><path>graph.go <ide> func (graph *Graph) Create(layerData Archive, container *Container, comment, aut <ide> img.Container = container.Id <ide> img.ContainerConfig = *container.Config <ide> } <del> if err := graph.Register(layerData, img); err != nil { <add> if err := graph.Register(layerData, true, img); err != nil { <ide> return nil, err <ide> } <ide> go img.Checksum() <ide> func (graph *Graph) Create(layerData Archive, container *Container, comment, aut <ide> <ide> // Register imports a pre-existing image into the graph. <ide> // FIXME: pass img as first argument <del>func (graph *Graph) Register(layerData Archive, img *Image) error { <add>func (graph *Graph) Register(layerData Archive, store bool, img *Image) error { <ide> if err := ValidateId(img.Id); err != nil { <ide> return err <ide> } <ide> func (graph *Graph) Register(layerData Archive, img *Image) error { <ide> if err != nil { <ide> return fmt.Errorf("Mktemp failed: %s", err) <ide> } <del> if err := StoreImage(img, layerData, tmp); err != nil { <add> if err := StoreImage(img, layerData, tmp, store); err != nil { <ide> return err <ide> } <ide> // Commit <ide><path>image.go <ide> func LoadImage(root string) (*Image, error) { <ide> return img, nil <ide> } <ide> <del>func StoreImage(img *Image, layerData Archive, root string) error { <add>func StoreImage(img *Image, layerData Archive, root string, store bool) error { <ide> // Check that root doesn't already exist <ide> if _, err := os.Stat(root); err == nil { <ide> return fmt.Errorf("Image %s already exists", img.Id) <ide> func StoreImage(img *Image, layerData Archive, root string) error { <ide> if err := os.MkdirAll(layer, 0700); err != nil { <ide> return err <ide> } <add> <add> if store { <add> layerArchive := layerArchivePath(root) <add> file, err := os.OpenFile(layerArchive, os.O_WRONLY|os.O_CREATE, 0600) <add> if err != nil { <add> return err <add> } <add> // FIXME: Retrieve the image layer size from here? <add> if _, err := io.Copy(file, layerData); err != nil { <add> return err <add> } <add> // FIXME: Don't close/open, read/write instead of Copy <add> file.Close() <add> <add> file, err = os.Open(layerArchive) <add> if err != nil { <add> return err <add> } <add> defer file.Close() <add> layerData = file <add> } <add> <ide> if err := Untar(layerData, layer); err != nil { <ide> return err <ide> } <ide> func layerPath(root string) string { <ide> return path.Join(root, "layer") <ide> } <ide> <add>func layerArchivePath(root string) string { <add> return path.Join(root, "layer.tar.xz") <add>} <add> <ide> func jsonPath(root string) string { <ide> return path.Join(root, "json") <ide> } <ide> func (img *Image) Checksum() (string, error) { <ide> return "", err <ide> } <ide> <del> layerData, err := Tar(layer, Xz) <del> if err != nil { <del> return "", err <add> var layerData io.Reader <add> <add> if file, err := os.Open(layerArchivePath(root)); err != nil { <add> if os.IsNotExist(err) { <add> layerData, err = Tar(layer, Xz) <add> if err != nil { <add> return "", err <add> } <add> } else { <add> return "", err <add> } <add> } else { <add> defer file.Close() <add> layerData = file <ide> } <ide> <ide> h := sha256.New() <ide><path>registry.go <ide> func (graph *Graph) PullImage(stdout io.Writer, imgId, registry string, token [] <ide> // FIXME: Keep goging in case of error? <ide> return err <ide> } <del> if err = graph.Register(layer, img); err != nil { <add> if err = graph.Register(layer, false, img); err != nil { <ide> return err <ide> } <ide> }
3
Javascript
Javascript
remove createreactclass from timerexample.js
c96c93ef4a43cb9f4d4eee30b72e230ead0f7109
<ide><path>RNTester/js/TimerExample.js <ide> 'use strict'; <ide> <ide> var React = require('react'); <del>var createReactClass = require('create-react-class'); <ide> var ReactNative = require('react-native'); <ide> var {AlertIOS, Platform, ToastAndroid, Text, View} = ReactNative; <ide> var RNTesterButton = require('./RNTesterButton'); <ide> class RequestIdleCallbackTester extends React.Component<{}, $FlowFixMeState> { <ide> }; <ide> } <ide> <del>var TimerTester = createReactClass({ <del> displayName: 'TimerTester', <add>type TimerTesterProps = $ReadOnly<{| <add> dt?: number, <add> type: string, <add>|}>; <ide> <del> _ii: 0, <del> _iters: 0, <del> _start: 0, <del> _timerId: (null: ?TimeoutID), <del> _rafId: (null: ?AnimationFrameID), <del> _intervalId: (null: ?IntervalID), <del> _immediateId: (null: ?Object), <del> _timerFn: (null: ?() => any), <add>class TimerTester extends React.Component<TimerTesterProps> { <add> _ii = 0; <add> _iters = 0; <add> _start = 0; <add> _timerId: ?TimeoutID = null; <add> _rafId: ?AnimationFrameID = null; <add> _intervalId: ?IntervalID = null; <add> _immediateId: ?Object = null; <add> _timerFn: ?() => any = null; <ide> <del> render: function() { <add> render() { <ide> var args = 'fn' + (this.props.dt !== undefined ? ', ' + this.props.dt : ''); <ide> return ( <ide> <RNTesterButton onPress={this._run}> <ide> Measure: {this.props.type}({args}) - {this._ii || 0} <ide> </RNTesterButton> <ide> ); <del> }, <add> } <ide> <ide> componentWillUnmount() { <ide> if (this._timerId != null) { <ide> var TimerTester = createReactClass({ <ide> if (this._intervalId != null) { <ide> clearInterval(this._intervalId); <ide> } <del> }, <add> } <ide> <del> _run: function() { <add> _run = () => { <ide> if (!this._start) { <ide> var d = new Date(); <ide> this._start = d.getTime(); <ide> this._iters = 100; <ide> this._ii = 0; <ide> if (this.props.type === 'setTimeout') { <del> if (this.props.dt < 1) { <add> if (this.props.dt !== undefined && this.props.dt < 1) { <ide> this._iters = 5000; <del> } else if (this.props.dt > 20) { <add> } else if (this.props.dt !== undefined && this.props.dt > 20) { <ide> this._iters = 10; <ide> } <ide> this._timerFn = () => { <ide> var TimerTester = createReactClass({ <ide> if (this._timerFn) { <ide> this._timerId = this._timerFn(); <ide> } <del> }, <add> }; <ide> <del> clear: function() { <add> clear = () => { <ide> if (this._intervalId != null) { <ide> clearInterval(this._intervalId); <ide> // Configure things so we can do a final run to update UI and reset state. <ide> this._intervalId = null; <ide> this._iters = this._ii; <ide> this._run(); <ide> } <del> }, <del>}); <add> }; <add>} <ide> <ide> exports.framework = 'React'; <ide> exports.title = 'Timers, TimerMixin';
1
Javascript
Javascript
fix error in test-process-simple
c5b5815ae7ff3767ec2d25bd3d02dae81b11e0e8
<ide><path>test/test-process-simple.js <ide> var response = ""; <ide> var exit_status = -1; <ide> <ide> cat.onOutput = function (chunk) { <del> if (chunk) response += chunk; <del> if (response === "hello world") cat.close(); <add> if (chunk) { <add> response += chunk; <add> if (response === "hello world") cat.close(); <add> } <ide> }; <ide> cat.onError = function (chunk) { <ide> assertEquals(null, chunk);
1
Javascript
Javascript
restore press in delay
fc45530dedf997a3955c3720d4e7bd3704f8bdb3
<ide><path>Libraries/Pressability/Pressability.js <ide> const isPressInSignal = signal => <ide> const isTerminalSignal = signal => <ide> signal === 'RESPONDER_TERMINATED' || signal === 'RESPONDER_RELEASE'; <ide> <del>const DEFAULT_LONG_PRESS_DELAY_MS = 500; <del>const DEFAULT_PRESS_DELAY_MS = 0; <add>const DEFAULT_LONG_PRESS_DELAY_MS = 370; // 500 - 130 <add>const DEFAULT_PRESS_DELAY_MS = 130; <ide> const DEFAULT_PRESS_RECT_OFFSETS = { <ide> bottom: 30, <ide> left: 20, <ide><path>Libraries/Pressability/__tests__/Pressability-test.js <ide> describe('Pressability', () => { <ide> expect(config.onLongPress).toBeCalled(); <ide> }); <ide> <del> it('is called if pressed for 500ms after the press delay', () => { <add> it('is called if pressed for 370ms after the press delay', () => { <ide> const {config, handlers} = createMockPressability({ <ide> delayPressIn: 100, <ide> }); <ide> describe('Pressability', () => { <ide> handlers.onResponderGrant(createMockPressEvent('onResponderGrant')); <ide> handlers.onResponderMove(createMockPressEvent('onResponderMove')); <ide> <del> jest.advanceTimersByTime(599); <add> jest.advanceTimersByTime(469); <ide> expect(config.onLongPress).not.toBeCalled(); <ide> jest.advanceTimersByTime(1); <ide> expect(config.onLongPress).toBeCalled(); <ide> describe('Pressability', () => { <ide> handlers.onResponderGrant(createMockPressEvent('onResponderGrant')); <ide> handlers.onResponderMove(createMockPressEvent('onResponderMove')); <ide> <del> jest.advanceTimersByTime(9); <add> jest.advanceTimersByTime(139); <ide> expect(config.onLongPress).not.toBeCalled(); <ide> jest.advanceTimersByTime(1); <ide> expect(config.onLongPress).toBeCalled(); <ide> describe('Pressability', () => { <ide> expect(config.onPressIn).toBeCalled(); <ide> }); <ide> <del> it('is called after no delay by default', () => { <add> it('is called after the default delay by default', () => { <ide> const {config, handlers} = createMockPressability({ <ide> delayPressIn: null, <ide> }); <ide> describe('Pressability', () => { <ide> handlers.onResponderGrant(createMockPressEvent('onResponderGrant')); <ide> handlers.onResponderMove(createMockPressEvent('onResponderMove')); <ide> <add> jest.advanceTimersByTime(129); <add> expect(config.onPressIn).not.toBeCalled(); <add> jest.advanceTimersByTime(1); <ide> expect(config.onPressIn).toBeCalled(); <ide> }); <ide> <del> it('falls back to no delay if `delayPressIn` is omitted', () => { <add> it('falls back to the default delay if `delayPressIn` is omitted', () => { <ide> const {config, handlers} = createMockPressability({ <ide> delayPressIn: null, <ide> }); <ide> describe('Pressability', () => { <ide> handlers.onResponderGrant(createMockPressEvent('onResponderGrant')); <ide> handlers.onResponderMove(createMockPressEvent('onResponderMove')); <ide> <add> jest.advanceTimersByTime(129); <add> expect(config.onPressIn).not.toBeCalled(); <add> jest.advanceTimersByTime(1); <ide> expect(config.onPressIn).toBeCalled(); <ide> }); <ide> <ide> describe('Pressability', () => { <ide> describe('beyond bounds of hit rect', () => { <ide> it('`onPress` only is not called when no delay', () => { <ide> mockUIManagerMeasure(); <del> const {config, handlers} = createMockPressability(); <add> const {config, handlers} = createMockPressability({ <add> delayPressIn: 0, <add> }); <ide> <ide> handlers.onStartShouldSetResponder(); <ide> handlers.onResponderGrant(createMockPressEvent('onResponderGrant'));
2
Ruby
Ruby
tighten post-install checks
e909b54c9697e44d984cd642c866edbf240105da
<ide><path>Library/Homebrew/formula_installer.rb <ide> def pour <ide> <ide> ## checks <ide> <del> def paths <del> @paths ||= ENV['PATH'].split(':').map{ |p| File.expand_path p } <del> end <del> <ide> def check_PATH <ide> # warn the user if stuff was installed outside of their PATH <ide> [f.bin, f.sbin].each do |bin| <ide> if bin.directory? and bin.children.length > 0 <del> bin = (HOMEBREW_PREFIX/bin.basename).realpath.to_s <del> unless paths.include? bin <add> bin = (HOMEBREW_PREFIX/bin.basename).realpath <add> unless ORIGINAL_PATHS.include? bin <ide> opoo "#{bin} is not in your PATH" <ide> puts "You can amend this by altering your ~/.bashrc file" <ide> @show_summary_heading = true <ide> def check_PATH <ide> <ide> def check_manpages <ide> # Check for man pages that aren't in share/man <del> if (f.prefix+'man').exist? <add> if (f.prefix+'man').directory? <ide> opoo 'A top-level "man" directory was found.' <ide> puts "Homebrew requires that man pages live under share." <ide> puts 'This can often be fixed by passing "--mandir=#{man}" to configure.' <ide> def check_manpages <ide> <ide> def check_infopages <ide> # Check for info pages that aren't in share/info <del> if (f.prefix+'info').exist? <add> if (f.prefix+'info').directory? <ide> opoo 'A top-level "info" directory was found.' <ide> puts "Homebrew suggests that info pages live under share." <ide> puts 'This can often be fixed by passing "--infodir=#{info}" to configure.' <ide> def check_infopages <ide> end <ide> <ide> def check_jars <del> return unless File.exist? f.lib <add> return unless f.lib.directory? <ide> <ide> jars = f.lib.children.select{|g| g.to_s =~ /\.jar$/} <ide> unless jars.empty? <ide> def check_jars <ide> end <ide> <ide> def check_non_libraries <del> return unless File.exist? f.lib <add> return unless f.lib.directory? <ide> <ide> valid_extensions = %w(.a .dylib .framework .jnilib .la .o .so <ide> .jar .prl .pm) <ide> def check_non_libraries <ide> end <ide> <ide> def audit_bin <del> return unless File.exist? f.bin <add> return unless f.bin.directory? <ide> <del> non_exes = f.bin.children.select {|g| File.directory? g or not File.executable? g} <add> non_exes = f.bin.children.select { |g| g.directory? or not g.executable? } <ide> <ide> unless non_exes.empty? <ide> opoo 'Non-executables were installed to "bin".' <ide> def audit_bin <ide> end <ide> <ide> def audit_sbin <del> return unless File.exist? f.sbin <add> return unless f.sbin.directory? <ide> <del> non_exes = f.sbin.children.select {|g| File.directory? g or not File.executable? g} <add> non_exes = f.sbin.children.select { |g| g.directory? or not g.executable? } <ide> <ide> unless non_exes.empty? <ide> opoo 'Non-executables were installed to "sbin".' <ide> def audit_lib <ide> <ide> def check_m4 <ide> # Newer versions of Xcode don't come with autotools <del> return if MacOS::Xcode.version.to_f >= 4.3 <add> return unless MacOS::Xcode.provides_autotools? <ide> <ide> # If the user has added our path to dirlist, don't complain <ide> return if File.open("/usr/share/aclocal/dirlist") do |dirlist| <ide><path>Library/Homebrew/global.rb <ide> module Homebrew extend self <ide> require 'compatibility' <ide> end <ide> <del>ORIGINAL_PATHS = ENV['PATH'].split(':').map{ |p| Pathname.new(File.expand_path(p)) rescue nil }.compact.freeze <add>ORIGINAL_PATHS = ENV['PATH'].split(':').map{ |p| Pathname.new(p).expand_path rescue nil }.compact.freeze
2
Javascript
Javascript
remove pii from title
083161e2470df00e2cad51e1e79aa616c8b38f5e
<ide><path>client/src/components/profile/Profile.js <ide> function renderIsLocked(username) { <ide> return ( <ide> <Fragment> <ide> <Helmet> <del> <title>{username} | freeCodeCamp.org</title> <add> <title>Profile | freeCodeCamp.org</title> <ide> </Helmet> <ide> <Spacer size={2} /> <ide> <Grid> <ide> function Profile({ user, isSessionUser }) { <ide> return ( <ide> <Fragment> <ide> <Helmet> <del> <title>{username} | freeCodeCamp.org</title> <add> <title>Profile | freeCodeCamp.org</title> <ide> </Helmet> <ide> <Spacer size={2} /> <ide> <Grid> <ide><path>client/src/pages/welcome.js <ide> function Welcome({ <ide> return ( <ide> <Fragment> <ide> <Helmet> <del> <title>Welcome {name ? name : 'Camper'} | freeCodeCamp.org</title> <add> <title>Welcome | freeCodeCamp.org</title> <ide> </Helmet> <ide> <main> <ide> <Grid className='text-center'>
2
Javascript
Javascript
support hex values in outputrange
463b072dac1beda0ae89dbda268728b9035296e7
<ide><path>Libraries/Animated/src/Interpolation.js <ide> */ <ide> 'use strict'; <ide> <add>var tinycolor = require('tinycolor2'); <add> <ide> // TODO(#7644673): fix this hack once github jest actually checks invariants <ide> var invariant = function(condition, message) { <ide> if (!condition) { <ide> function interpolate( <ide> return result; <ide> } <ide> <add>function colorToRgba( <add> input: string <add>): string { <add> var color = tinycolor(input); <add> if (color.isValid()) { <add> var {r, g, b, a} = color.toRgb(); <add> return `rgba(${r}, ${g}, ${b}, ${a === undefined ? 1 : a})`; <add> } else { <add> return input; <add> } <add>} <add> <ide> var stringShapeRegex = /[0-9\.-]+/g; <ide> <ide> /** <ide> function createInterpolationFromStringOutputRange( <ide> ): (input: number) => string { <ide> var outputRange: Array<string> = (config.outputRange: any); <ide> invariant(outputRange.length >= 2, 'Bad output range'); <add> outputRange = outputRange.map(colorToRgba); <ide> checkPattern(outputRange); <ide> <ide> // ['rgba(0, 100, 200, 0)', 'rgba(50, 150, 250, 0.5)'] <ide><path>Libraries/Animated/src/__tests__/Interpolation-test.js <ide> <ide> jest <ide> .dontMock('Interpolation') <del> .dontMock('Easing'); <add> .dontMock('Easing') <add> .dontMock('tinycolor2'); <ide> <ide> var Interpolation = require('Interpolation'); <ide> var Easing = require('Easing'); <ide> describe('Interpolation', () => { <ide> expect(interpolation(1)).toBe('rgba(50, 150, 250, 0.5)'); <ide> }); <ide> <add> it('should work with output ranges as short hex string', () => { <add> var interpolation = Interpolation.create({ <add> inputRange: [0, 1], <add> outputRange: ['#024', '#9BF'], <add> }); <add> <add> expect(interpolation(0)).toBe('rgba(0, 34, 68, 1)'); <add> expect(interpolation(0.5)).toBe('rgba(76.5, 110.5, 161.5, 1)'); <add> expect(interpolation(1)).toBe('rgba(153, 187, 255, 1)'); <add> }); <add> <add> it('should work with output ranges as long hex string', () => { <add> var interpolation = Interpolation.create({ <add> inputRange: [0, 1], <add> outputRange: ['#FF9500', '#87FC70'], <add> }); <add> <add> expect(interpolation(0)).toBe('rgba(255, 149, 0, 1)'); <add> expect(interpolation(0.5)).toBe('rgba(195, 200.5, 56, 1)'); <add> expect(interpolation(1)).toBe('rgba(135, 252, 112, 1)'); <add> }); <add> <add> it('should work with output ranges with mixed hex and rgba strings', () => { <add> var interpolation = Interpolation.create({ <add> inputRange: [0, 1], <add> outputRange: ['rgba(100, 120, 140, .5)', '#87FC70'], <add> }); <add> <add> expect(interpolation(0)).toBe('rgba(100, 120, 140, 0.5)'); <add> expect(interpolation(0.5)).toBe('rgba(117.5, 186, 126, 0.75)'); <add> expect(interpolation(1)).toBe('rgba(135, 252, 112, 1)'); <add> }); <add> <ide> it('should work with negative and decimal values in string ranges', () => { <ide> var interpolation = Interpolation.create({ <ide> inputRange: [0, 1], <ide> describe('Interpolation', () => { <ide> expect(() => { interpolation('45rad'); }).toThrow(); <ide> }); <ide> <del> it('should crash when defining output range with different pattern', () => { <del> expect(() => Interpolation.create({ <del> inputRange: [0, 1], <del> outputRange: ['rgba(0, 100, 200, 0)', 'rgb(50, 150, 250)'], <del> })).toThrow(); <add> it('should support a mix of color patterns', () => { <add> var interpolation = Interpolation.create({ <add> inputRange: [0, 1, 2], <add> outputRange: ['rgba(0, 100, 200, 0)', 'rgb(50, 150, 250)', 'red'], <add> }); <ide> <add> expect(interpolation(0)).toBe('rgba(0, 100, 200, 0)'); <add> expect(interpolation(0.5)).toBe('rgba(25, 125, 225, 0.5)'); <add> expect(interpolation(1.5)).toBe('rgba(152.5, 75, 125, 1)'); <add> expect(interpolation(2)).toBe('rgba(255, 0, 0, 1)'); <add> }); <add> <add> it('should crash when defining output range with different pattern', () => { <ide> expect(() => Interpolation.create({ <ide> inputRange: [0, 1], <ide> outputRange: ['20deg', '30rad'],
2
Python
Python
remove unused import
1f1bab9264dbff98781ce6c896b358e005c28d4b
<ide><path>spacy/lang/ru/__init__.py <ide> from ..norm_exceptions import BASE_NORMS <ide> from ...util import update_exc, add_lookups <ide> from ...language import Language <del>from ...attrs import LANG, LIKE_NUM, NORM <add>from ...attrs import LANG, NORM <ide> <ide> <ide> class RussianDefaults(Language.Defaults):
1
Ruby
Ruby
reduce method calls
9e16254b4661f0ec55f035f62e70148827dcdf56
<ide><path>activerecord/lib/active_record/reflection.rb <ide> def source_reflection <ide> end <ide> <ide> def has_inverse? <del> !@options[:inverse_of].nil? <add> @options[:inverse_of] <ide> end <ide> <ide> def inverse_of
1
Text
Text
update docs with supported tags and attributes
451176665cb35ef7c1346fa462aca863c0ac5a39
<ide><path>docs/docs/ref-04-tags-and-attributes.md <ide> The following elements are supported: <ide> a abbr address area article aside audio b base bdi bdo big blockquote body br <ide> button canvas caption cite code col colgroup data datalist dd del details dfn <ide> div dl dt em embed fieldset figcaption figure footer form h1 h2 h3 h4 h5 h6 <del>head header hr html i iframe img input ins kbd keygen label legend li link <del>main map mark menu menuitem meta meter nav noscript object ol optgroup option <del>output p param pre progress q rp rt ruby s samp script section select small <del>source span strong style sub summary sup table tbody td textarea tfoot th <del>thead time title tr track u ul var video wbr <add>head header hr html i iframe img input ins kbd keygen label legend li link main <add>map mark menu menuitem meta meter nav noscript object ol optgroup option output <add>p param pre progress q rp rt ruby s samp script section select small source <add>span strong style sub summary sup table tbody td textarea tfoot th thead time <add>title tr track u ul var video wbr <ide> ``` <ide> <ide> ### SVG elements <ide> For a list of events, see [Supported Events](events.html). <ide> ### HTML Attributes <ide> <ide> ``` <del>accessKey accept action ajaxify allowFullScreen allowTransparency alt <add>accept accessKey action allowFullScreen allowTransparency alt autoCapitalize <ide> autoComplete autoFocus autoPlay cellPadding cellSpacing charSet checked <ide> className colSpan content contentEditable contextMenu controls data dateTime <ide> dir disabled draggable encType form frameBorder height hidden href htmlFor <ide> httpEquiv icon id label lang list max maxLength method min multiple name <del>pattern poster preload placeholder radioGroup rel readOnly required role <add>pattern placeholder poster preload radioGroup readOnly rel required role <ide> rowSpan scrollLeft scrollTop selected size spellCheck src step style tabIndex <ide> target title type value width wmode <ide> ``` <ide> In addition, the non-standard `autoCapitalize` attribute is supported for Mobile <ide> ### SVG Attributes <ide> <ide> ``` <del>cx cy d fill fx fy points r stroke strokeLinecap strokeWidth transform x x1 x2 <del>version viewBox y y1 y2 spreadMethod offset stopColor stopOpacity <del>gradientUnits gradientTransform <add>cx cy d fill fx fy gradientTransform gradientUnits offset points r rx ry <add>spreadMethod stopColor stopOpacity stroke strokeLinecap strokeWidth transform <add>version viewBox x1 x2 x y1 y2 y <ide> ```
1
PHP
PHP
is
2a5604bdcdbcd8b533d49fe743c2efbe04ceabc1
<ide><path>src/Illuminate/Routing/Router.php <ide> public function currentRouteName() <ide> /** <ide> * Alias for the "currentRouteNamed" method. <ide> * <del> * @param string $name <add> * @param dynamic string <ide> * @return bool <ide> */ <del> public function is($name) <add> public function is() <ide> { <del> return $this->currentRouteNamed($name); <add> foreach (func_get_args() as $pattern) <add> { <add> if (str_is($pattern, $this->currentRouteName())) <add> { <add> return true; <add> } <add> } <add> <add> return false; <ide> } <ide> <ide> /** <ide> public function currentRouteAction() <ide> /** <ide> * Alias for the "currentRouteUses" method. <ide> * <del> * @param string $action <add> * @param dynamic string <ide> * @return bool <ide> */ <del> public function isAction($action) <add> public function isAction() <ide> { <del> return $this->currentRouteUses($action); <add> foreach (func_get_args() as $pattern) <add> { <add> if (str_is($pattern, $this->currentRouteAction())) <add> { <add> return true; <add> } <add> } <add> <add> return false; <ide> } <ide> <ide> /**
1
Python
Python
fix most of the file-handle resource leaks.
4cde148de0c37981c50f3a8e4a59fa4e5f653e17
<ide><path>docs/autogen.py <ide> def process_docstring(docstring): <ide> new_fpath = fpath.replace('templates', 'sources') <ide> shutil.copy(fpath, new_fpath) <ide> <add> <ide> # Take care of index page. <del>readme = open('../README.md').read() <del>index = open('templates/index.md').read() <add>def read_file(path): <add> with open(path) as f: <add> return f.read() <add> <add> <add>readme = read_file('../README.md') <add>index = read_file('templates/index.md') <ide> index = index.replace('{{autogenerated}}', readme[readme.find('##'):]) <del>f = open('sources/index.md', 'w') <del>f.write(index) <del>f.close() <add>with open('sources/index.md', 'w') as f: <add> f.write(index) <ide> <ide> print('Starting autogeneration.') <ide> for page_data in PAGES: <ide> def process_docstring(docstring): <ide> page_name = page_data['page'] <ide> path = os.path.join('sources', page_name) <ide> if os.path.exists(path): <del> template = open(path).read() <add> template = read_file(path) <ide> assert '{{autogenerated}}' in template, ('Template found for ' + path + <ide> ' but missing {{autogenerated}} tag.') <ide> mkdown = template.replace('{{autogenerated}}', mkdown) <ide> def process_docstring(docstring): <ide> subdir = os.path.dirname(path) <ide> if not os.path.exists(subdir): <ide> os.makedirs(subdir) <del> open(path, 'w').write(mkdown) <add> with open(path, 'w') as f: <add> f.write(mkdown) <ide> <ide> shutil.copyfile('../CONTRIBUTING.md', 'sources/contributing.md') <ide><path>examples/babi_memnn.py <ide> def vectorize_stories(data): <ide> '$ wget http://www.thespermwhale.com/jaseweston/babi/tasks_1-20_v1-2.tar.gz\n' <ide> '$ mv tasks_1-20_v1-2.tar.gz ~/.keras/datasets/babi-tasks-v1-2.tar.gz') <ide> raise <del>tar = tarfile.open(path) <add> <ide> <ide> challenges = { <ide> # QA1 with 10,000 samples <ide> def vectorize_stories(data): <ide> challenge = challenges[challenge_type] <ide> <ide> print('Extracting stories for the challenge:', challenge_type) <del>train_stories = get_stories(tar.extractfile(challenge.format('train'))) <del>test_stories = get_stories(tar.extractfile(challenge.format('test'))) <add>with tarfile.open(path) as tar: <add> train_stories = get_stories(tar.extractfile(challenge.format('train'))) <add> test_stories = get_stories(tar.extractfile(challenge.format('test'))) <ide> <ide> vocab = set() <ide> for story, q, answer in train_stories + test_stories: <ide><path>examples/babi_rnn.py <ide> def vectorize_stories(data, word_idx, story_maxlen, query_maxlen): <ide> '$ wget http://www.thespermwhale.com/jaseweston/babi/tasks_1-20_v1-2.tar.gz\n' <ide> '$ mv tasks_1-20_v1-2.tar.gz ~/.keras/datasets/babi-tasks-v1-2.tar.gz') <ide> raise <del>tar = tarfile.open(path) <add> <ide> # Default QA1 with 1000 samples <ide> # challenge = 'tasks_1-20_v1-2/en/qa1_single-supporting-fact_{}.txt' <ide> # QA1 with 10,000 samples <ide> def vectorize_stories(data, word_idx, story_maxlen, query_maxlen): <ide> challenge = 'tasks_1-20_v1-2/en/qa2_two-supporting-facts_{}.txt' <ide> # QA2 with 10,000 samples <ide> # challenge = 'tasks_1-20_v1-2/en-10k/qa2_two-supporting-facts_{}.txt' <del>train = get_stories(tar.extractfile(challenge.format('train'))) <del>test = get_stories(tar.extractfile(challenge.format('test'))) <add>with tarfile.open(path) as tar: <add> train = get_stories(tar.extractfile(challenge.format('train'))) <add> test = get_stories(tar.extractfile(challenge.format('test'))) <ide> <ide> vocab = set() <ide> for story, q, answer in train + test: <ide><path>examples/lstm_seq2seq.py <ide> target_texts = [] <ide> input_characters = set() <ide> target_characters = set() <del>lines = open(data_path, 'r', encoding='utf-8').read().split('\n') <add>with open(data_path, 'r', encoding='utf-8') as f: <add> lines = f.read().split('\n') <ide> for line in lines[: min(num_samples, len(lines) - 1)]: <ide> input_text, target_text = line.split('\t') <ide> # We use "tab" as the "start sequence" character <ide><path>examples/lstm_seq2seq_restore.py <ide> target_texts = [] <ide> input_characters = set() <ide> target_characters = set() <del>lines = open(data_path, 'r', encoding='utf-8').read().split('\n') <add>with open(data_path, 'r', encoding='utf-8') as f: <add> lines = f.read().split('\n') <ide> for line in lines[: min(num_samples, len(lines) - 1)]: <ide> input_text, target_text = line.split('\t') <ide> # We use "tab" as the "start sequence" character <ide><path>examples/lstm_text_generation.py <ide> import io <ide> <ide> path = get_file('nietzsche.txt', origin='https://s3.amazonaws.com/text-datasets/nietzsche.txt') <del>text = io.open(path, encoding='utf-8').read().lower() <add>with io.open(path, encoding='utf-8') as f: <add> text = f.read().lower() <ide> print('corpus length:', len(text)) <ide> <ide> chars = sorted(list(set(text))) <ide><path>examples/mnist_acgan.py <ide> def build_discriminator(): <ide> Image.fromarray(img).save( <ide> 'plot_epoch_{0:03d}_generated.png'.format(epoch)) <ide> <del> pickle.dump({'train': train_history, 'test': test_history}, <del> open('acgan-history.pkl', 'wb')) <add> with open('acgan-history.pkl', 'wb') as f: <add> pickle.dump({'train': train_history, 'test': test_history}, f) <ide><path>examples/pretrained_word_embeddings.py <ide> print('Indexing word vectors.') <ide> <ide> embeddings_index = {} <del>f = open(os.path.join(GLOVE_DIR, 'glove.6B.100d.txt')) <del>for line in f: <del> values = line.split() <del> word = values[0] <del> coefs = np.asarray(values[1:], dtype='float32') <del> embeddings_index[word] = coefs <del>f.close() <add>with open(os.path.join(GLOVE_DIR, 'glove.6B.100d.txt')) as f: <add> for line in f: <add> values = line.split() <add> word = values[0] <add> coefs = np.asarray(values[1:], dtype='float32') <add> embeddings_index[word] = coefs <ide> <ide> print('Found %s word vectors.' % len(embeddings_index)) <ide> <ide> for fname in sorted(os.listdir(path)): <ide> if fname.isdigit(): <ide> fpath = os.path.join(path, fname) <del> if sys.version_info < (3,): <del> f = open(fpath) <del> else: <del> f = open(fpath, encoding='latin-1') <del> t = f.read() <del> i = t.find('\n\n') # skip header <del> if 0 < i: <del> t = t[i:] <del> texts.append(t) <del> f.close() <add> args = {} if sys.version_info < (3,) else {'encoding': 'latin-1'} <add> with open(fpath, **args) as f: <add> t = f.read() <add> i = t.find('\n\n') # skip header <add> if 0 < i: <add> t = t[i:] <add> texts.append(t) <ide> labels.append(label_id) <ide> <ide> print('Found %s texts.' % len(texts)) <ide><path>keras/applications/imagenet_utils.py <ide> def decode_predictions(preds, top=5): <ide> CLASS_INDEX_PATH, <ide> cache_subdir='models', <ide> file_hash='c2c37ea517e94d9795004a39431a14cb') <del> CLASS_INDEX = json.load(open(fpath)) <add> with open(fpath) as f: <add> CLASS_INDEX = json.load(f) <ide> results = [] <ide> for pred in preds: <ide> top_indices = pred.argsort()[-top:][::-1] <ide><path>keras/backend/__init__.py <ide> _config_path = os.path.expanduser(os.path.join(_keras_dir, 'keras.json')) <ide> if os.path.exists(_config_path): <ide> try: <del> _config = json.load(open(_config_path)) <add> with open(_config_path) as f: <add> _config = json.load(f) <ide> except ValueError: <ide> _config = {} <ide> _floatx = _config.get('floatx', floatx()) <ide><path>keras/datasets/cifar.py <ide> def load_batch(fpath, label_key='labels'): <ide> # Returns <ide> A tuple `(data, labels)`. <ide> """ <del> f = open(fpath, 'rb') <del> if sys.version_info < (3,): <del> d = cPickle.load(f) <del> else: <del> d = cPickle.load(f, encoding='bytes') <del> # decode utf8 <del> d_decoded = {} <del> for k, v in d.items(): <del> d_decoded[k.decode('utf8')] = v <del> d = d_decoded <del> f.close() <add> with open(fpath, 'rb') as f: <add> if sys.version_info < (3,): <add> d = cPickle.load(f) <add> else: <add> d = cPickle.load(f, encoding='bytes') <add> # decode utf8 <add> d_decoded = {} <add> for k, v in d.items(): <add> d_decoded[k.decode('utf8')] = v <add> d = d_decoded <ide> data = d['data'] <ide> labels = d[label_key] <ide> <ide><path>keras/datasets/imdb.py <ide> def get_word_index(path='imdb_word_index.json'): <ide> path = get_file(path, <ide> origin='https://s3.amazonaws.com/text-datasets/imdb_word_index.json', <ide> file_hash='bfafd718b763782e994055a2d397834f') <del> f = open(path) <del> data = json.load(f) <del> f.close() <del> return data <add> with open(path) as f: <add> return json.load(f) <ide><path>keras/engine/topology.py <ide> def save_weights(self, filepath, overwrite=True): <ide> proceed = ask_to_proceed_with_overwrite(filepath) <ide> if not proceed: <ide> return <del> f = h5py.File(filepath, 'w') <del> save_weights_to_hdf5_group(f, self.layers) <del> f.flush() <del> f.close() <add> with h5py.File(filepath, 'w') as f: <add> save_weights_to_hdf5_group(f, self.layers) <add> f.flush() <ide> <ide> def load_weights(self, filepath, by_name=False, <ide> skip_mismatch=False, reshape=False): <ide> def load_weights(self, filepath, by_name=False, <ide> """ <ide> if h5py is None: <ide> raise ImportError('`load_weights` requires h5py.') <del> f = h5py.File(filepath, mode='r') <del> if 'layer_names' not in f.attrs and 'model_weights' in f: <del> f = f['model_weights'] <del> if by_name: <del> load_weights_from_hdf5_group_by_name( <del> f, self.layers, skip_mismatch=skip_mismatch, <del> reshape=reshape) <del> else: <del> load_weights_from_hdf5_group( <del> f, self.layers, reshape=reshape) <del> <del> if hasattr(f, 'close'): <del> f.close() <add> with h5py.File(filepath, mode='r') as f: <add> if 'layer_names' not in f.attrs and 'model_weights' in f: <add> f = f['model_weights'] <add> if by_name: <add> load_weights_from_hdf5_group_by_name( <add> f, self.layers, skip_mismatch=skip_mismatch, <add> reshape=reshape) <add> else: <add> load_weights_from_hdf5_group( <add> f, self.layers, reshape=reshape) <ide> <ide> def _updated_config(self): <ide> """Util hared between different serialization methods. <ide><path>keras/engine/training.py <ide> def fit_generator(self, <ide> ```python <ide> def generate_arrays_from_file(path): <ide> while 1: <del> f = open(path) <del> for line in f: <del> # create numpy arrays of input data <del> # and labels, from each line in the file <del> x1, x2, y = process_line(line) <del> yield ({'input_1': x1, 'input_2': x2}, {'output': y}) <del> f.close() <add> with open(path) as f: <add> for line in f: <add> # create numpy arrays of input data <add> # and labels, from each line in the file <add> x1, x2, y = process_line(line) <add> yield ({'input_1': x1, 'input_2': x2}, {'output': y}) <ide> <ide> model.fit_generator(generate_arrays_from_file('/my_file.txt'), <ide> steps_per_epoch=10000, epochs=10) <ide><path>keras/models.py <ide> def set_weights(self, weights): <ide> def load_weights(self, filepath, by_name=False, skip_mismatch=False, reshape=False): <ide> if h5py is None: <ide> raise ImportError('`load_weights` requires h5py.') <del> f = h5py.File(filepath, mode='r') <del> if 'layer_names' not in f.attrs and 'model_weights' in f: <del> f = f['model_weights'] <add> with h5py.File(filepath, mode='r') as f: <add> if 'layer_names' not in f.attrs and 'model_weights' in f: <add> f = f['model_weights'] <ide> <del> # Legacy support <del> if legacy_models.needs_legacy_support(self): <del> layers = legacy_models.legacy_sequential_layers(self) <del> else: <del> layers = self.layers <del> if by_name: <del> topology.load_weights_from_hdf5_group_by_name(f, layers, <del> skip_mismatch=skip_mismatch, <del> reshape=reshape) <del> else: <del> topology.load_weights_from_hdf5_group(f, layers, reshape=reshape) <del> if hasattr(f, 'close'): <del> f.close() <add> # Legacy support <add> if legacy_models.needs_legacy_support(self): <add> layers = legacy_models.legacy_sequential_layers(self) <add> else: <add> layers = self.layers <add> if by_name: <add> topology.load_weights_from_hdf5_group_by_name(f, layers, <add> skip_mismatch=skip_mismatch, <add> reshape=reshape) <add> else: <add> topology.load_weights_from_hdf5_group(f, layers, reshape=reshape) <ide> <ide> def save_weights(self, filepath, overwrite=True): <ide> if h5py is None: <ide> def save_weights(self, filepath, overwrite=True): <ide> else: <ide> layers = self.layers <ide> <del> f = h5py.File(filepath, 'w') <del> topology.save_weights_to_hdf5_group(f, layers) <del> f.flush() <del> f.close() <add> with h5py.File(filepath, 'w') as f: <add> topology.save_weights_to_hdf5_group(f, layers) <add> f.flush() <ide> <ide> def compile(self, optimizer, loss, <ide> metrics=None, <ide> def fit_generator(self, generator, <ide> ```python <ide> def generate_arrays_from_file(path): <ide> while 1: <del> f = open(path) <del> for line in f: <del> # create Numpy arrays of input data <del> # and labels, from each line in the file <del> x, y = process_line(line) <del> yield (x, y) <del> f.close() <add> with open(path) as f: <add> for line in f: <add> # create Numpy arrays of input data <add> # and labels, from each line in the file <add> x, y = process_line(line) <add> yield (x, y) <ide> <ide> model.fit_generator(generate_arrays_from_file('/my_file.txt'), <ide> steps_per_epoch=1000, epochs=10) <ide><path>keras/utils/data_utils.py <ide> def chunk_read(response, chunk_size=8192, reporthook=None): <ide> else: <ide> break <ide> <del> response = urlopen(url, data) <del> with open(filename, 'wb') as fd: <del> for chunk in chunk_read(response, reporthook=reporthook): <del> fd.write(chunk) <add> with closing(urlopen(url, data)) as response, open(filename, 'wb') as fd: <add> for chunk in chunk_read(response, reporthook=reporthook): <add> fd.write(chunk) <ide> else: <ide> from six.moves.urllib.request import urlretrieve <ide> <ide><path>tests/keras/utils/io_utils_test.py <ide> def in_tmpdir(tmpdir): <ide> def create_dataset(h5_path='test.h5'): <ide> X = np.random.randn(200, 10).astype('float32') <ide> y = np.random.randint(0, 2, size=(200, 1)) <del> f = h5py.File(h5_path, 'w') <del> # Creating dataset to store features <del> X_dset = f.create_dataset('my_data', (200, 10), dtype='f') <del> X_dset[:] = X <del> # Creating dataset to store labels <del> y_dset = f.create_dataset('my_labels', (200, 1), dtype='i') <del> y_dset[:] = y <del> f.close() <add> with h5py.File(h5_path, 'w') as f: <add> # Creating dataset to store features <add> X_dset = f.create_dataset('my_data', (200, 10), dtype='f') <add> X_dset[:] = X <add> # Creating dataset to store labels <add> y_dset = f.create_dataset('my_labels', (200, 1), dtype='i') <add> y_dset[:] = y <ide> <ide> <ide> def test_io_utils(in_tmpdir):
17
Python
Python
fix typo in error message in generation_utils
3cfdefaa4dc62a78163c01bad9d42bc1c5100b3e
<ide><path>src/transformers/generation_utils.py <ide> def generate( <ide> raise ValueError("`max_length` needs to be a stopping_criteria for now.") <ide> <ide> if num_beams <= 1: <del> raise ValueError("`num_beams` needs to be greater than 1 for constrained genertation.") <add> raise ValueError("`num_beams` needs to be greater than 1 for constrained generation.") <ide> <ide> if do_sample: <ide> raise ValueError("`do_sample` needs to be false for constrained generation.")
1
Python
Python
generate wrappers for scalars with value
f6f0ad0643848faa39d62a6a44bbe72aa6f0ad3b
<ide><path>numpy/f2py/auxfuncs.py <ide> 'isunsigned_chararray', 'isunsigned_long_long', <ide> 'isunsigned_long_longarray', 'isunsigned_short', <ide> 'isunsigned_shortarray', 'l_and', 'l_not', 'l_or', 'outmess', <del> 'replace', 'show', 'stripcomma', 'throw_error', <add> 'replace', 'show', 'stripcomma', 'throw_error', 'isattr_value' <ide> ] <ide> <ide> <ide> def issubroutine_wrap(rout): <ide> return 0 <ide> return issubroutine(rout) and hasassumedshape(rout) <ide> <add>def isattr_value(var): <add> return 'value' in var.get('attrspec', []) <add> <ide> <ide> def hasassumedshape(rout): <ide> if rout.get('hasassumedshape'): <ide> def getcallprotoargument(rout, cb_map={}): <ide> elif isstring(var): <ide> pass <ide> else: <del> ctype = ctype + '*' <add> if not isattr_value(var): <add> ctype = ctype + '*' <ide> if ((isstring(var) <ide> or isarrayofstrings(var) # obsolete? <ide> or isstringarray(var))): <ide><path>numpy/f2py/rules.py <ide> islong_double, islong_doublefunction, islong_long, <ide> islong_longfunction, ismoduleroutine, isoptional, isrequired, <ide> isscalar, issigned_long_longarray, isstring, isstringarray, <del> isstringfunction, issubroutine, <add> isstringfunction, issubroutine, isattr_value, <ide> issubroutine_wrap, isthreadsafe, isunsigned, isunsigned_char, <ide> isunsigned_chararray, isunsigned_long_long, <ide> isunsigned_long_longarray, isunsigned_short, isunsigned_shortarray, <ide> { # Common <ide> 'decl': ' #ctype# #varname# = 0;', <ide> 'pyobjfrom': {debugcapi: ' fprintf(stderr,"#vardebugshowvalue#\\n",#varname#);'}, <del> 'callfortran': {isintent_c: '#varname#,', l_not(isintent_c): '&#varname#,'}, <add> 'callfortran': {l_or(isintent_c, isattr_value): '#varname#,', l_not(l_or(isintent_c, isattr_value)): '&#varname#,'}, <ide> 'return': {isintent_out: ',#varname#'}, <ide> '_check': l_and(isscalar, l_not(iscomplex)) <ide> }, {
2
Java
Java
add tests for binding to a part field
caaf83b8e6534b8c9a3806661022ac8185985876
<ide><path>spring-test/src/test/java/org/springframework/test/web/servlet/samples/standalone/MultipartControllerTests.java <ide> import org.springframework.stereotype.Controller; <ide> import org.springframework.test.web.servlet.MockMvc; <ide> import org.springframework.ui.Model; <add>import org.springframework.util.StreamUtils; <add>import org.springframework.validation.BindException; <add>import org.springframework.validation.BindingResult; <ide> import org.springframework.web.bind.annotation.RequestMapping; <ide> import org.springframework.web.bind.annotation.RequestMethod; <ide> import org.springframework.web.bind.annotation.RequestParam; <ide> /** <ide> * @author Rossen Stoyanchev <ide> * @author Juergen Hoeller <add> * @author Jaebin Joo <ide> */ <ide> public class MultipartControllerTests { <ide> <ide> public void multipartRequestWithOptionalFileListNotPresent() throws Exception { <ide> } <ide> <ide> @Test <del> public void multipartRequestWithServletParts() throws Exception { <add> public void multipartRequestWithParts_resolvesMultipartFileArguments() throws Exception { <ide> byte[] fileContent = "bar".getBytes(StandardCharsets.UTF_8); <ide> MockPart filePart = new MockPart("file", "orig", fileContent); <ide> <ide> public void multipartRequestWithServletParts() throws Exception { <ide> .andExpect(model().attribute("jsonContent", Collections.singletonMap("name", "yeeeah"))); <ide> } <ide> <add> @Test <add> public void multipartRequestWithParts_resolvesPartArguments() throws Exception { <add> byte[] fileContent = "bar".getBytes(StandardCharsets.UTF_8); <add> MockPart filePart = new MockPart("file", "orig", fileContent); <add> <add> byte[] json = "{\"name\":\"yeeeah\"}".getBytes(StandardCharsets.UTF_8); <add> MockPart jsonPart = new MockPart("json", json); <add> jsonPart.getHeaders().setContentType(MediaType.APPLICATION_JSON); <add> <add> standaloneSetup(new MultipartController()).build() <add> .perform(multipart("/part").part(filePart).part(jsonPart)) <add> .andExpect(status().isFound()) <add> .andExpect(model().attribute("fileContent", fileContent)) <add> .andExpect(model().attribute("jsonContent", Collections.singletonMap("name", "yeeeah"))); <add> } <add> <add> @Test <add> public void multipartRequestWithParts_resolvesMultipartFileProperties() throws Exception { <add> byte[] fileContent = "bar".getBytes(StandardCharsets.UTF_8); <add> MockPart filePart = new MockPart("file", "orig", fileContent); <add> <add> standaloneSetup(new MultipartController()).build() <add> .perform(multipart("/multipartfileproperty").part(filePart)) <add> .andExpect(status().isFound()) <add> .andExpect(model().attribute("fileContent", fileContent)); <add> } <add> <add> @Test <add> public void multipartRequestWithParts_cannotResolvePartProperties() throws Exception { <add> byte[] fileContent = "bar".getBytes(StandardCharsets.UTF_8); <add> MockPart filePart = new MockPart("file", "orig", fileContent); <add> <add> Exception exception = standaloneSetup(new MultipartController()).build() <add> .perform(multipart("/partproperty").part(filePart)) <add> .andExpect(status().is4xxClientError()) <add> .andReturn() <add> .getResolvedException(); <add> <add> assertThat(exception).isNotNull(); <add> assertThat(exception).isInstanceOf(BindException.class); <add> assertThat(((BindException) exception).getFieldError("file")) <add> .as("MultipartRequest would not bind Part properties.").isNotNull(); <add> } <add> <ide> @Test // SPR-13317 <ide> public void multipartRequestWrapped() throws Exception { <ide> byte[] json = "{\"name\":\"yeeeah\"}".getBytes(StandardCharsets.UTF_8); <ide> public String processOptionalFileList(@RequestParam Optional<List<MultipartFile> <ide> } <ide> <ide> @RequestMapping(value = "/part", method = RequestMethod.POST) <del> public String processPart(@RequestParam Part part, <add> public String processPart(@RequestPart Part file, <ide> @RequestPart Map<String, String> json, Model model) throws IOException { <ide> <del> model.addAttribute("fileContent", part.getInputStream()); <add> if (file != null) { <add> byte[] content = StreamUtils.copyToByteArray(file.getInputStream()); <add> model.addAttribute("fileContent", content); <add> } <ide> model.addAttribute("jsonContent", json); <ide> <ide> return "redirect:/index"; <ide> public String processMultipart(@RequestPart Map<String, String> json, Model mode <ide> model.addAttribute("json", json); <ide> return "redirect:/index"; <ide> } <add> <add> @RequestMapping(value = "/multipartfileproperty", method = RequestMethod.POST) <add> public String processMultipartFileBean(MultipartFileBean multipartFileBean, Model model, BindingResult bindingResult) <add> throws IOException { <add> <add> if (!bindingResult.hasErrors()) { <add> MultipartFile file = multipartFileBean.getFile(); <add> if (file != null) { <add> model.addAttribute("fileContent", file.getBytes()); <add> } <add> } <add> return "redirect:/index"; <add> } <add> <add> @RequestMapping(value = "/partproperty", method = RequestMethod.POST) <add> public String processPartBean(PartBean partBean, Model model, BindingResult bindingResult) <add> throws IOException { <add> <add> if (!bindingResult.hasErrors()) { <add> Part file = partBean.getFile(); <add> if (file != null) { <add> byte[] content = StreamUtils.copyToByteArray(file.getInputStream()); <add> model.addAttribute("fileContent", content); <add> } <add> } <add> return "redirect:/index"; <add> } <ide> } <ide> <add> private static class MultipartFileBean { <add> <add> private MultipartFile file; <add> <add> public MultipartFile getFile() { <add> return file; <add> } <add> <add> public void setFile(MultipartFile file) { <add> this.file = file; <add> } <add> } <add> <add> private static class PartBean { <add> <add> private Part file; <add> <add> public Part getFile() { <add> return file; <add> } <add> <add> public void setFile(Part file) { <add> this.file = file; <add> } <add> } <ide> <ide> private static class RequestWrappingFilter extends OncePerRequestFilter { <ide> <ide><path>spring-web/src/main/java/org/springframework/web/bind/ServletRequestDataBinder.java <ide> public ServletRequestDataBinder(@Nullable Object target, String objectName) { <ide> * HTTP parameters: i.e. "uploadedFile" to an "uploadedFile" bean property, <ide> * invoking a "setUploadedFile" setter method. <ide> * <p>The type of the target property for a multipart file can be MultipartFile, <del> * byte[], or String. The latter two receive the contents of the uploaded file; <add> * Part, byte[], or String. The Part binding is only supported when the request <add> * is not a MultipartRequest. The latter two receive the contents of the uploaded file; <ide> * all metadata like original file name, content type, etc are lost in those cases. <ide> * @param request the request with parameters to bind (can be multipart) <ide> * @see org.springframework.web.multipart.MultipartHttpServletRequest <add> * @see org.springframework.web.multipart.MultipartRequest <ide> * @see org.springframework.web.multipart.MultipartFile <add> * @see jakarta.servlet.http.Part <ide> * @see #bind(org.springframework.beans.PropertyValues) <ide> */ <ide> public void bind(ServletRequest request) { <ide><path>spring-web/src/main/java/org/springframework/web/bind/support/WebRequestDataBinder.java <ide> public WebRequestDataBinder(@Nullable Object target, String objectName) { <ide> * HTTP parameters: i.e. "uploadedFile" to an "uploadedFile" bean property, <ide> * invoking a "setUploadedFile" setter method. <ide> * <p>The type of the target property for a multipart file can be Part, MultipartFile, <del> * byte[], or String. The latter two receive the contents of the uploaded file; <add> * byte[], or String. The Part binding is only supported when the request <add> * is not a MultipartRequest. The latter two receive the contents of the uploaded file; <ide> * all metadata like original file name, content type, etc are lost in those cases. <ide> * @param request the request with parameters to bind (can be multipart) <ide> * @see org.springframework.web.multipart.MultipartRequest
3
Javascript
Javascript
attach platform to asset url
ce47e56b7b56b81c549e348b8e71b7ad335aaf74
<ide><path>Libraries/Image/__tests__/resolveAssetSource-test.js <ide> function expectResolvesAsset(input, expectedSource) { <ide> describe('resolveAssetSource', () => { <ide> beforeEach(() => { <ide> jest.resetModuleRegistry(); <add> __DEV__ = true; <ide> AssetRegistry = require('AssetRegistry'); <ide> Platform = require('Platform'); <ide> SourceCode = require('NativeModules').SourceCode; <ide> describe('resolveAssetSource', () => { <ide> describe('bundle was loaded from network (DEV)', () => { <ide> beforeEach(() => { <ide> SourceCode.scriptURL = 'http://10.0.0.1:8081/main.bundle'; <add> Platform.OS = 'ios'; <ide> }); <ide> <ide> it('uses network image', () => { <ide> describe('resolveAssetSource', () => { <ide> isStatic: false, <ide> width: 100, <ide> height: 200, <del> uri: 'http://10.0.0.1:8081/assets/module/a/logo.png?hash=5b6f00f', <add> uri: 'http://10.0.0.1:8081/assets/module/a/logo.png?platform=ios&hash=5b6f00f', <ide> }); <ide> }); <ide> <ide> describe('resolveAssetSource', () => { <ide> isStatic: false, <ide> width: 100, <ide> height: 200, <del> uri: 'http://10.0.0.1:8081/assets/module/a/[email protected]?hash=5b6f00f', <add> uri: 'http://10.0.0.1:8081/assets/module/a/[email protected]?platform=ios&hash=5b6f00f', <ide> }); <ide> }); <ide> <ide> }); <ide> <ide> describe('bundle was loaded from file (PROD) on iOS', () => { <del> var originalDevMode; <del> var originalPlatform; <del> <ide> beforeEach(() => { <ide> SourceCode.scriptURL = 'file:///Path/To/Simulator/main.bundle'; <del> originalDevMode = __DEV__; <del> originalPlatform = Platform.OS; <ide> __DEV__ = false; <ide> Platform.OS = 'ios'; <ide> }); <ide> <del> afterEach(() => { <del> __DEV__ = originalDevMode; <del> Platform.OS = originalPlatform; <del> }); <del> <ide> it('uses pre-packed image', () => { <ide> expectResolvesAsset({ <ide> __packager_asset: true, <ide> describe('resolveAssetSource', () => { <ide> }); <ide> <ide> describe('bundle was loaded from file (PROD) on Android', () => { <del> var originalDevMode; <del> var originalPlatform; <del> <ide> beforeEach(() => { <ide> SourceCode.scriptURL = 'file:///Path/To/Simulator/main.bundle'; <del> originalDevMode = __DEV__; <del> originalPlatform = Platform.OS; <ide> __DEV__ = false; <ide> Platform.OS = 'android'; <ide> }); <ide> <del> afterEach(() => { <del> __DEV__ = originalDevMode; <del> Platform.OS = originalPlatform; <del> }); <del> <ide> it('uses pre-packed image', () => { <ide> expectResolvesAsset({ <ide> __packager_asset: true, <ide><path>Libraries/Image/resolveAssetSource.js <ide> function getPathInArchive(asset) { <ide> * from the devserver <ide> */ <ide> function getPathOnDevserver(devServerUrl, asset) { <del> return devServerUrl + getScaledAssetPath(asset) + '?hash=' + asset.hash; <add> return devServerUrl + getScaledAssetPath(asset) + '?platform=' + Platform.OS + <add> '&hash=' + asset.hash; <ide> } <ide> <ide> /**
2
Python
Python
fix small typo
75a35032e194a2d065b0071a9e786adf6cee83ea
<ide><path>keras/backend/tensorflow_backend.py <ide> def batch_dot(x, y, axes=None): <ide> # Arguments <ide> x: Keras tensor or variable with `ndim >= 2`. <ide> y: Keras tensor or variable with `ndim >= 2`. <del> axes: int or tupe(int, int). Target dimensions to be reduced. <add> axes: int or tuple(int, int). Target dimensions to be reduced. <ide> <ide> # Returns <ide> A tensor with shape equal to the concatenation of `x`'s shape <ide> def batch_dot(x, y, axes=None): <ide> inner_products = [] <ide> for xi, yi in zip(x, y): <ide> inner_products.append(xi.dot(yi)) <del> result = stack(inner_prodcuts) <add> result = stack(inner_products) <ide> ``` <ide> <ide> Shape inference:
1
Text
Text
update readme too
86016594db99450bd1d1278a67a002f7d748423f
<ide><path>examples/dll-app-and-vendor/0-vendor/README.md <ide> This is the vendor build part. <ide> <del>It's built separately from the app part. The vendors dll is only built when vendors has changed and not while the normal development cycle. <add>It's built separately from the app part. The vendors dll is only built when the array of vendors has changed and not during the normal development cycle. <ide> <ide> The DllPlugin in combination with the `output.library` option exposes the internal require function as global variable in the target environment. <ide>
1
Mixed
Javascript
remove unused element methods
7a2160461df1541993f1ba2936d87d5292dd14be
<ide><path>docs/getting-started/v3-migration.md <ide> Chart.js is no longer providing the `Chart.bundle.js` and `Chart.bundle.min.js`. <ide> * `helpers.numberOfLabelLines` <ide> * `helpers.removeEvent` <ide> * `helpers.scaleMerge` <del>* `scale.getRightValue` <del>* `scale.mergeTicksOptions` <del>* `scale.ticksAsNumbers` <add>* `Scale.getRightValue` <add>* `Scale.mergeTicksOptions` <add>* `Scale.ticksAsNumbers` <ide> * `Chart.Controller` <ide> * `Chart.chart.chart` <ide> * `Chart.types` <ide> * `Line.calculatePointY` <add>* `Element.getArea` <add>* `Element.height` <add>* `Element.inLabelRange` <ide> * Made `scale.handleDirectionalChanges` private <ide> * Made `scale.tickValues` private <ide> <ide><path>src/elements/element.arc.js <ide> function drawBorder(ctx, vm, arc) { <ide> module.exports = Element.extend({ <ide> _type: 'arc', <ide> <del> inLabelRange: function(mouseX) { <del> var vm = this._view; <del> <del> if (vm) { <del> return (Math.pow(mouseX - vm.x, 2) < Math.pow(vm.radius + vm.hoverRadius, 2)); <del> } <del> return false; <del> }, <del> <ide> inRange: function(chartX, chartY) { <ide> var vm = this._view; <ide> <ide> module.exports = Element.extend({ <ide> }; <ide> }, <ide> <del> getArea: function() { <del> var vm = this._view; <del> return Math.PI * ((vm.endAngle - vm.startAngle) / (2 * Math.PI)) * (Math.pow(vm.outerRadius, 2) - Math.pow(vm.innerRadius, 2)); <del> }, <del> <ide> tooltipPosition: function() { <ide> var vm = this._view; <ide> var centreAngle = vm.startAngle + ((vm.endAngle - vm.startAngle) / 2); <ide><path>src/elements/element.point.js <ide> module.exports = Element.extend({ <ide> return vm ? ((Math.pow(mouseX - vm.x, 2) + Math.pow(mouseY - vm.y, 2)) < Math.pow(vm.hitRadius + vm.radius, 2)) : false; <ide> }, <ide> <del> inLabelRange: xRange, <ide> inXRange: xRange, <ide> inYRange: yRange, <ide> <ide> module.exports = Element.extend({ <ide> }; <ide> }, <ide> <del> getArea: function() { <del> return Math.PI * Math.pow(this._view.radius, 2); <del> }, <del> <ide> tooltipPosition: function() { <ide> var vm = this._view; <ide> return { <ide><path>src/elements/element.rectangle.js <ide> module.exports = Element.extend({ <ide> ctx.restore(); <ide> }, <ide> <del> height: function() { <del> var vm = this._view; <del> return vm.base - vm.y; <del> }, <del> <ide> inRange: function(mouseX, mouseY) { <ide> return inRange(this._view, mouseX, mouseY); <ide> }, <ide> <del> inLabelRange: function(mouseX, mouseY) { <del> var vm = this._view; <del> return isVertical(vm) <del> ? inRange(vm, mouseX, null) <del> : inRange(vm, null, mouseY); <del> }, <del> <ide> inXRange: function(mouseX) { <ide> return inRange(this._view, mouseX, null); <ide> }, <ide> module.exports = Element.extend({ <ide> return {x: x, y: y}; <ide> }, <ide> <del> getArea: function() { <del> var vm = this._view; <del> <del> return isVertical(vm) <del> ? vm.width * Math.abs(vm.y - vm.base) <del> : vm.height * Math.abs(vm.x - vm.base); <del> }, <del> <ide> tooltipPosition: function() { <ide> var vm = this._view; <ide> return { <ide><path>test/specs/element.arc.tests.js <ide> describe('Arc element tests', function() { <ide> _index: 1 <ide> }); <ide> <del> // Make sure we can run these before the view is added <del> expect(arc.inRange(2, 2)).toBe(false); <del> expect(arc.inLabelRange(2)).toBe(false); <del> <ide> // Mock out the view as if the controller put it there <ide> arc._view = { <ide> startAngle: 0, <ide> describe('Arc element tests', function() { <ide> expect(pos.y).toBeCloseTo(0.5); <ide> }); <ide> <del> it ('should get the area', function() { <del> var arc = new Chart.elements.Arc({ <del> _datasetIndex: 2, <del> _index: 1 <del> }); <del> <del> // Mock out the view as if the controller put it there <del> arc._view = { <del> startAngle: 0, <del> endAngle: Math.PI / 2, <del> x: 0, <del> y: 0, <del> innerRadius: 0, <del> outerRadius: Math.sqrt(2), <del> }; <del> <del> expect(arc.getArea()).toBeCloseTo(0.5 * Math.PI, 6); <del> }); <del> <ide> it ('should get the center', function() { <ide> var arc = new Chart.elements.Arc({ <ide> _datasetIndex: 2, <ide><path>test/specs/element.point.tests.js <ide> describe('Chart.elements.Point', function() { <ide> <ide> // Safely handles if these are called before the viewmodel is instantiated <ide> expect(point.inRange(5)).toBe(false); <del> expect(point.inLabelRange(5)).toBe(false); <ide> <ide> // Attach a view object as if we were the controller <ide> point._view = { <ide> describe('Chart.elements.Point', function() { <ide> expect(point.inRange(10, 10)).toBe(false); <ide> expect(point.inRange(10, 5)).toBe(false); <ide> expect(point.inRange(5, 5)).toBe(false); <del> <del> expect(point.inLabelRange(5)).toBe(false); <del> expect(point.inLabelRange(7)).toBe(true); <del> expect(point.inLabelRange(10)).toBe(true); <del> expect(point.inLabelRange(12)).toBe(true); <del> expect(point.inLabelRange(15)).toBe(false); <del> expect(point.inLabelRange(20)).toBe(false); <ide> }); <ide> <ide> it ('should get the correct tooltip position', function() { <ide> describe('Chart.elements.Point', function() { <ide> }); <ide> }); <ide> <del> it('should get the correct area', function() { <del> var point = new Chart.elements.Point({ <del> _datasetIndex: 2, <del> _index: 1 <del> }); <del> <del> // Attach a view object as if we were the controller <del> point._view = { <del> radius: 2, <del> }; <del> <del> expect(point.getArea()).toEqual(Math.PI * 4); <del> }); <del> <ide> it('should get the correct center point', function() { <ide> var point = new Chart.elements.Point({ <ide> _datasetIndex: 2, <ide><path>test/specs/element.rectangle.tests.js <ide> describe('Rectangle element tests', function() { <ide> <ide> // Safely handles if these are called before the viewmodel is instantiated <ide> expect(rectangle.inRange(5)).toBe(false); <del> expect(rectangle.inLabelRange(5)).toBe(false); <ide> <ide> // Attach a view object as if we were the controller <ide> rectangle._view = { <ide> describe('Rectangle element tests', function() { <ide> expect(rectangle.inRange(10, 16)).toBe(false); <ide> expect(rectangle.inRange(5, 5)).toBe(false); <ide> <del> expect(rectangle.inLabelRange(5)).toBe(false); <del> expect(rectangle.inLabelRange(7)).toBe(false); <del> expect(rectangle.inLabelRange(10)).toBe(true); <del> expect(rectangle.inLabelRange(12)).toBe(true); <del> expect(rectangle.inLabelRange(15)).toBe(false); <del> expect(rectangle.inLabelRange(20)).toBe(false); <del> <ide> // Test when the y is below the base (negative bar) <ide> var negativeRectangle = new Chart.elements.Rectangle({ <ide> _datasetIndex: 2, <ide> describe('Rectangle element tests', function() { <ide> expect(negativeRectangle.inRange(10, -5)).toBe(true); <ide> }); <ide> <del> it('should get the correct height', function() { <del> var rectangle = new Chart.elements.Rectangle({ <del> _datasetIndex: 2, <del> _index: 1 <del> }); <del> <del> // Attach a view object as if we were the controller <del> rectangle._view = { <del> base: 0, <del> width: 4, <del> x: 10, <del> y: 15 <del> }; <del> <del> expect(rectangle.height()).toBe(-15); <del> <del> // Test when the y is below the base (negative bar) <del> var negativeRectangle = new Chart.elements.Rectangle({ <del> _datasetIndex: 2, <del> _index: 1 <del> }); <del> <del> // Attach a view object as if we were the controller <del> negativeRectangle._view = { <del> base: -10, <del> width: 4, <del> x: 10, <del> y: -15 <del> }; <del> expect(negativeRectangle.height()).toBe(5); <del> }); <del> <ide> it('should get the correct tooltip position', function() { <ide> var rectangle = new Chart.elements.Rectangle({ <ide> _datasetIndex: 2, <ide> describe('Rectangle element tests', function() { <ide> }); <ide> }); <ide> <del> it('should get the correct vertical area', function() { <del> var rectangle = new Chart.elements.Rectangle({ <del> _datasetIndex: 2, <del> _index: 1 <del> }); <del> <del> // Attach a view object as if we were the controller <del> rectangle._view = { <del> base: 0, <del> width: 4, <del> x: 10, <del> y: 15 <del> }; <del> <del> expect(rectangle.getArea()).toEqual(60); <del> }); <del> <del> it('should get the correct horizontal area', function() { <del> var rectangle = new Chart.elements.Rectangle({ <del> _datasetIndex: 2, <del> _index: 1 <del> }); <del> <del> // Attach a view object as if we were the controller <del> rectangle._view = { <del> base: 0, <del> height: 4, <del> x: 10, <del> y: 15 <del> }; <del> <del> expect(rectangle.getArea()).toEqual(40); <del> }); <del> <ide> it('should get the center', function() { <ide> var rectangle = new Chart.elements.Rectangle({ <ide> _datasetIndex: 2,
7
Python
Python
add commit to tagger example
a405660068f9f1c17a71a54866f475b2b13eef6c
<ide><path>examples/training/train_new_entity_type.py <ide> * Training the Named Entity Recognizer: https://spacy.io/docs/usage/train-ner <ide> * Saving and loading models: https://spacy.io/docs/usage/saving-loading <ide> <del>Developed for: spaCy 1.7.6 <del>Last tested for: spaCy 1.7.6 <add>Developed for: spaCy 1.9.0 <add>Last tested for: spaCy 1.9.0 <ide> """ <ide> from __future__ import unicode_literals, print_function <ide> <ide><path>examples/training/train_tagger_standalone_ud.py <add>''' <add>This example shows training of the POS tagger without the Language class, <add>showing the APIs of the atomic components. <add> <add>This example was adapted from the gist here: <add> <add>https://gist.github.com/kamac/a7bc139f62488839a8118214a4d932f2 <add> <add>Issue discussing the gist: <add> <add>https://github.com/explosion/spaCy/issues/1179 <add> <add>The example was written for spaCy 1.8.2. <add>''' <ide> from __future__ import unicode_literals <ide> from __future__ import print_function <ide>
2
Python
Python
skip faulty test
5b6bd4e7880cd51375c2d6c33bbd8173acfd920b
<ide><path>examples/pytorch/test_examples.py <ide> import logging <ide> import os <ide> import sys <add>import unittest <ide> from unittest.mock import patch <ide> <ide> import torch <ide> def test_run_ner(self): <ide> self.assertGreaterEqual(result["eval_accuracy"], 0.75) <ide> self.assertLess(result["eval_loss"], 0.5) <ide> <add> @unittest.skip("squad_v2 metric is broken on Datasets apparently, skipping until it's fixed.") <ide> def test_run_squad(self): <ide> stream_handler = logging.StreamHandler(sys.stdout) <ide> logger.addHandler(stream_handler)
1
Text
Text
fix typo in why use keras docs
4a28dc5debcd0bd790ef29d202342184fde5a1f4
<ide><path>docs/templates/why-use-keras.md <ide> There are countless deep learning frameworks available today. Why use Keras rath <ide> <ide> ## Keras has broad adoption in the industry and the research community <ide> <del>With over 200,000 individual users as of November 2017, Keras has stronger adoption in both the industry and the research community than any other deep learning framework except TensorFlow itself (and Keras is commonly used in conjonction with TensorFlow). <add>With over 200,000 individual users as of November 2017, Keras has stronger adoption in both the industry and the research community than any other deep learning framework except TensorFlow itself (and Keras is commonly used in conjunction with TensorFlow). <ide> <ide> You are already constantly interacting with features built with Keras -- it is in use at Netflix, Uber, Yelp, Instacart, Zocdoc, Square, and many others. It is especially popular among startups that place deep learning at the core of their products. <ide>
1
Javascript
Javascript
unbind handlers with data + test (#935)
2897b1bd2383031b6764192dc1ccb1d1205139a3
<ide><path>src/event/event.js <ide> jQuery.event = { <ide> } <ide> <ide> // Make sure that the function being executed has a unique ID <del> if ( !handler.guid ) <add> if ( !handler.guid ) { <ide> handler.guid = this.guid++; <add> // Don't forget to set guid for the original handler function <add> if (fn) fn.guid = handler.guid; <add> } <ide> <ide> // Init the element's event structure <ide> if (!element.$events) <ide><path>src/event/eventTest.js <ide> module("event"); <ide> <ide> test("bind()", function() { <del> expect(11); <add> expect(12); <ide> <ide> var handler = function(event) { <ide> ok( event.data, "bind() with data, check passed data exists" ); <ide> ok( event.data.foo == "bar", "bind() with data, Check value of passed data" ); <ide> }; <del> $("#firstp").bind("click", {foo: "bar"}, handler).click(); <add> $("#firstp").bind("click", {foo: "bar"}, handler).click().unbind("click", handler); <add> <add> ok( !$("#firstp").get(0).$events, "Event handler unbound when using data." ); <ide> <ide> reset(); <ide> var handler = function(event, data) { <ide> test("bind()", function() { <ide> ok( data, "Check trigger data" ); <ide> ok( data.bar == "foo", "Check value of trigger data" ); <ide> }; <del> $("#firstp").bind("click", {foo: "bar"}, handler).trigger("click", [{bar: "foo"}]); <add> $("#firstp").bind("click", {foo: "bar"}, handler).trigger("click", [{bar: "foo"}]).unbind(handler); <ide> <add> reset(); <ide> var handler = function(event) { <ide> ok ( !event.data, "Check that no data is added to the event object" ); <ide> }; <del> $("#firstp").unbind().bind("click", handler).trigger("click"); <add> $("#firstp").bind("click", handler).trigger("click"); <add> <ide> <ide> // events don't work with iframes, see #939 <ide> var tmp = document.createElement('iframe');
2
Go
Go
move cli.configdir away (in `flags`)
71d60ec0eb7eeddc73d2cf63748ab7debe3f06af
<ide><path>cli/flags/common.go <ide> import ( <ide> "path/filepath" <ide> <ide> "github.com/Sirupsen/logrus" <del> "github.com/docker/docker/cli" <ide> "github.com/docker/docker/opts" <ide> "github.com/docker/go-connections/tlsconfig" <ide> "github.com/spf13/pflag" <ide> func NewCommonOptions() *CommonOptions { <ide> // InstallFlags adds flags for the common options on the FlagSet <ide> func (commonOpts *CommonOptions) InstallFlags(flags *pflag.FlagSet) { <ide> if dockerCertPath == "" { <del> dockerCertPath = cli.ConfigurationDir() <add> dockerCertPath = ConfigurationDir() <ide> } <ide> <ide> flags.BoolVarP(&commonOpts.Debug, "debug", "D", false, "Enable debug mode") <ide><path>cli/flags/common_test.go <ide> import ( <ide> "path/filepath" <ide> "testing" <ide> <del> "github.com/docker/docker/cli" <ide> "github.com/spf13/pflag" <ide> "github.com/stretchr/testify/assert" <ide> ) <ide> func TestCommonOptionsInstallFlags(t *testing.T) { <ide> } <ide> <ide> func defaultPath(filename string) string { <del> return filepath.Join(cli.ConfigurationDir(), filename) <add> return filepath.Join(ConfigurationDir(), filename) <ide> } <ide> <ide> func TestCommonOptionsInstallFlagsWithDefaults(t *testing.T) { <add><path>cli/flags/configdir.go <del><path>cli/cli.go <del>package cli <add>package flags <ide> <ide> import ( <ide> "os" <ide><path>integration-cli/check_test.go <ide> import ( <ide> "testing" <ide> <ide> "github.com/docker/docker/api/types/swarm" <del> dcli "github.com/docker/docker/cli" <add> "github.com/docker/docker/cli/flags" <ide> "github.com/docker/docker/integration-cli/cli" <ide> "github.com/docker/docker/integration-cli/cli/build/fakestorage" <ide> "github.com/docker/docker/integration-cli/daemon" <ide> func (s *DockerTrustSuite) TearDownTest(c *check.C) { <ide> } <ide> <ide> // Remove trusted keys and metadata after test <del> os.RemoveAll(filepath.Join(dcli.ConfigurationDir(), "trust")) <add> os.RemoveAll(filepath.Join(flags.ConfigurationDir(), "trust")) <ide> s.ds.TearDownTest(c) <ide> } <ide> <ide><path>integration-cli/docker_cli_push_test.go <ide> import ( <ide> "sync" <ide> <ide> "github.com/docker/distribution/reference" <del> dcli "github.com/docker/docker/cli" <add> "github.com/docker/docker/cli/flags" <ide> "github.com/docker/docker/integration-cli/checker" <ide> "github.com/docker/docker/integration-cli/cli" <ide> "github.com/docker/docker/integration-cli/cli/build" <ide> func (s *DockerTrustSuite) TestTrustedPush(c *check.C) { <ide> }) <ide> <ide> // Assert that we rotated the snapshot key to the server by checking our local keystore <del> contents, err := ioutil.ReadDir(filepath.Join(dcli.ConfigurationDir(), "trust/private/tuf_keys", privateRegistryURL, "dockerclitrusted/pushtest")) <add> contents, err := ioutil.ReadDir(filepath.Join(flags.ConfigurationDir(), "trust/private/tuf_keys", privateRegistryURL, "dockerclitrusted/pushtest")) <ide> c.Assert(err, check.IsNil, check.Commentf("Unable to read local tuf key files")) <ide> // Check that we only have 1 key (targets key) <ide> c.Assert(contents, checker.HasLen, 1) <ide> func (s *DockerTrustSuite) TestTrustedPushWithReleasesDelegationOnly(c *check.C) <ide> s.assertTargetNotInRoles(c, repoName, "latest", "targets") <ide> <ide> // Try pull after push <del> os.RemoveAll(filepath.Join(dcli.ConfigurationDir(), "trust")) <add> os.RemoveAll(filepath.Join(flags.ConfigurationDir(), "trust")) <ide> <ide> cli.Docker(cli.Args("pull", targetName), trustedCmd).Assert(c, icmd.Expected{ <ide> Out: "Status: Image is up to date", <ide> func (s *DockerTrustSuite) TestTrustedPushSignsAllFirstLevelRolesWeHaveKeysFor(c <ide> s.assertTargetNotInRoles(c, repoName, "latest", "targets") <ide> <ide> // Try pull after push <del> os.RemoveAll(filepath.Join(dcli.ConfigurationDir(), "trust")) <add> os.RemoveAll(filepath.Join(flags.ConfigurationDir(), "trust")) <ide> <ide> // pull should fail because none of these are the releases role <ide> cli.Docker(cli.Args("pull", targetName), trustedCmd).Assert(c, icmd.Expected{ <ide> func (s *DockerTrustSuite) TestTrustedPushSignsForRolesWithKeysAndValidPaths(c * <ide> s.assertTargetNotInRoles(c, repoName, "latest", "targets") <ide> <ide> // Try pull after push <del> os.RemoveAll(filepath.Join(dcli.ConfigurationDir(), "trust")) <add> os.RemoveAll(filepath.Join(flags.ConfigurationDir(), "trust")) <ide> <ide> // pull should fail because none of these are the releases role <ide> cli.Docker(cli.Args("pull", targetName), trustedCmd).Assert(c, icmd.Expected{ <ide><path>integration-cli/trust_server_test.go <ide> import ( <ide> "strings" <ide> "time" <ide> <del> dcli "github.com/docker/docker/cli" <add> "github.com/docker/docker/cli/flags" <ide> "github.com/docker/docker/integration-cli/checker" <ide> "github.com/docker/docker/integration-cli/cli" <ide> icmd "github.com/docker/docker/pkg/testutil/cmd" <ide> func newTestNotary(c *check.C) (*testNotary, error) { <ide> "skipTLSVerify": true <ide> } <ide> }` <del> if _, err = fmt.Fprintf(clientConfig, template, filepath.Join(dcli.ConfigurationDir(), "trust"), notaryURL); err != nil { <add> if _, err = fmt.Fprintf(clientConfig, template, filepath.Join(flags.ConfigurationDir(), "trust"), notaryURL); err != nil { <ide> os.RemoveAll(tmp) <ide> return nil, err <ide> }
6
Javascript
Javascript
update http test to use countdown
07549c6a91f8901b69bfc430b1a552deca9763b8
<ide><path>test/parallel/test-http-status-code.js <ide> require('../common'); <ide> const assert = require('assert'); <ide> const http = require('http'); <add>const Countdown = require('../common/countdown'); <ide> <ide> // Simple test of Node's HTTP ServerResponse.statusCode <ide> // ServerResponse.prototype.statusCode <ide> <del>let testsComplete = 0; <ide> const tests = [200, 202, 300, 404, 451, 500]; <del>let testIdx = 0; <add>let test; <add>const countdown = new Countdown(tests.length, () => s.close()); <ide> <ide> const s = http.createServer(function(req, res) { <del> const t = tests[testIdx]; <del> res.writeHead(t, { 'Content-Type': 'text/plain' }); <add> res.writeHead(test, { 'Content-Type': 'text/plain' }); <ide> console.log(`--\nserver: statusCode after writeHead: ${res.statusCode}`); <del> assert.strictEqual(res.statusCode, t); <add> assert.strictEqual(res.statusCode, test); <ide> res.end('hello world\n'); <ide> }); <ide> <ide> s.listen(0, nextTest); <ide> <ide> <ide> function nextTest() { <del> if (testIdx + 1 === tests.length) { <del> return s.close(); <del> } <del> const test = tests[testIdx]; <add> test = tests.shift(); <ide> <ide> http.get({ port: s.address().port }, function(response) { <ide> console.log(`client: expected status: ${test}`); <ide> console.log(`client: statusCode: ${response.statusCode}`); <ide> assert.strictEqual(response.statusCode, test); <ide> response.on('end', function() { <del> testsComplete++; <del> testIdx += 1; <del> nextTest(); <add> if (countdown.dec()) <add> nextTest(); <ide> }); <ide> response.resume(); <ide> }); <ide> } <del> <del> <del>process.on('exit', function() { <del> assert.strictEqual(5, testsComplete); <del>});
1
PHP
PHP
move method. formatting
f3d8d99f585c2e9470974938afdbf47f9153d882
<ide><path>src/Illuminate/Support/Collection.php <ide> public function merge($items) <ide> return new static(array_merge($this->items, $this->getArrayableItems($items))); <ide> } <ide> <add> /** <add> * Create a collection by using this collection for keys and another for its values. <add> * <add> * @param mixed $values <add> * @return static <add> */ <add> public function combine($values) <add> { <add> return new static(array_combine($this->all(), $this->getArrayableItems($values))); <add> } <add> <ide> /** <ide> * Get the min value of a given key. <ide> * <ide> public function offsetUnset($key) <ide> unset($this->items[$key]); <ide> } <ide> <del> /** <del> * Combines the collection as keys together with items as values. <del> * <del> * e.g. new Collection([1, 2, 3])->combine([4, 5, 6]); <del> * => [1=>4, 2=>5, 3=>6] <del> * <del> * @param mixed $items <del> * @return static <del> */ <del> public function combine($items) <del> { <del> return new static(array_combine($this->all(), $this->getArrayableItems($items))); <del> } <del> <ide> /** <ide> * Convert the collection to its string representation. <ide> *
1
Python
Python
use set litterals
09992482c93f1b9e28b7958a792e6b3b709834fa
<ide><path>numpy/core/_type_aliases.py <ide> def get(self, key, default=None): <ide> else: <ide> _concrete_typeinfo[k] = v <ide> <del>_concrete_types = set(v.type for k, v in _concrete_typeinfo.items()) <add>_concrete_types = {v.type for k, v in _concrete_typeinfo.items()} <ide> <ide> <ide> def _bits_of(obj): <ide><path>numpy/core/einsumfunc.py <ide> def _optimal_path(input_sets, output_set, idx_dict, memory_limit): <ide> Examples <ide> -------- <ide> >>> isets = [set('abd'), set('ac'), set('bdc')] <del> >>> oset = set('') <add> >>> oset = {''} <ide> >>> idx_sizes = {'a': 1, 'b':2, 'c':3, 'd':4} <ide> >>> _path__optimal_path(isets, oset, idx_sizes, 5000) <ide> [(0, 2), (0, 1)] <ide> def _greedy_path(input_sets, output_set, idx_dict, memory_limit): <ide> Examples <ide> -------- <ide> >>> isets = [set('abd'), set('ac'), set('bdc')] <del> >>> oset = set('') <add> >>> oset = {''} <ide> >>> idx_sizes = {'a': 1, 'b':2, 'c':3, 'd':4} <ide> >>> _path__greedy_path(isets, oset, idx_sizes, 5000) <ide> [(0, 2), (0, 1)] <ide> def _can_dot(inputs, result, idx_removed): <ide> -------- <ide> <ide> # Standard GEMM operation <del> >>> _can_dot(['ij', 'jk'], 'ik', set('j')) <add> >>> _can_dot(['ij', 'jk'], 'ik', {'j'}) <ide> True <ide> <ide> # Can use the standard BLAS, but requires odd data movement <del> >>> _can_dot(['ijj', 'jk'], 'ik', set('j')) <add> >>> _can_dot(['ijj', 'jk'], 'ik', {'j'}) <ide> False <ide> <ide> # DDOT where the memory is not aligned <ide><path>numpy/core/numeric.py <ide> def require(a, dtype=None, requirements=None): <ide> if not requirements: <ide> return asanyarray(a, dtype=dtype) <ide> else: <del> requirements = set(possible_flags[x.upper()] for x in requirements) <add> requirements = {possible_flags[x.upper()] for x in requirements} <ide> <ide> if 'E' in requirements: <ide> requirements.remove('E') <ide> def require(a, dtype=None, requirements=None): <ide> subok = True <ide> <ide> order = 'A' <del> if requirements >= set(['C', 'F']): <add> if requirements >= {'C', 'F'}: <ide> raise ValueError('Cannot specify both "C" and "F" order') <ide> elif 'F' in requirements: <ide> order = 'F' <ide><path>numpy/core/shape_base.py <ide> def stack(arrays, axis=0, out=None): <ide> if not arrays: <ide> raise ValueError('need at least one array to stack') <ide> <del> shapes = set(arr.shape for arr in arrays) <add> shapes = {arr.shape for arr in arrays} <ide> if len(shapes) != 1: <ide> raise ValueError('all input arrays must have the same shape') <ide> <ide><path>numpy/core/tests/test_dtype.py <ide> def test_not_lists(self): <ide> the dtype constructor. <ide> """ <ide> assert_raises(TypeError, np.dtype, <del> dict(names=set(['A', 'B']), formats=['f8', 'i4'])) <add> dict(names={'A', 'B'}, formats=['f8', 'i4'])) <ide> assert_raises(TypeError, np.dtype, <del> dict(names=['A', 'B'], formats=set(['f8', 'i4']))) <add> dict(names=['A', 'B'], formats={'f8', 'i4'})) <ide> <ide> def test_aligned_size(self): <ide> # Check that structured dtypes get padded to an aligned size <ide><path>numpy/core/tests/test_scalarmath.py <ide> def test_seq_repeat(self): <ide> # Some of this behaviour may be controversial and could be open for <ide> # change. <ide> accepted_types = set(np.typecodes["AllInteger"]) <del> deprecated_types = set('?') <add> deprecated_types = {'?'} <ide> forbidden_types = ( <ide> set(np.typecodes["All"]) - accepted_types - deprecated_types) <del> forbidden_types -= set('V') # can't default-construct void scalars <add> forbidden_types -= {'V'} # can't default-construct void scalars <ide> <ide> for seq_type in (list, tuple): <ide> seq = seq_type([1, 2, 3]) <ide><path>numpy/distutils/command/build_ext.py <ide> def run(self): <ide> # we blindly assume that both packages need all of the libraries, <ide> # resulting in a larger wheel than is required. This should be fixed, <ide> # but it's so rare that I won't bother to handle it. <del> pkg_roots = set( <add> pkg_roots = { <ide> self.get_ext_fullname(ext.name).split('.')[0] <ide> for ext in self.extensions <del> ) <add> } <ide> for pkg_root in pkg_roots: <ide> shared_lib_dir = os.path.join(pkg_root, '.libs') <ide> if not self.inplace: <ide><path>numpy/lib/_iotools.py <ide> def __init__(self, dtype_or_func=None, default=None, missing_values=None, <ide> self.func = lambda x: int(float(x)) <ide> # Store the list of strings corresponding to missing values. <ide> if missing_values is None: <del> self.missing_values = set(['']) <add> self.missing_values = {''} <ide> else: <ide> if isinstance(missing_values, basestring): <ide> missing_values = missing_values.split(",") <ide><path>numpy/lib/npyio.py <ide> def encode_unicode_cols(row_tup): <ide> <ide> if names is None: <ide> # If the dtype is uniform (before sizing strings) <del> base = set([ <add> base = { <ide> c_type <ide> for c, c_type in zip(converters, column_types) <del> if c._checked]) <add> if c._checked} <ide> if len(base) == 1: <ide> uniform_type, = base <ide> (ddtype, mdtype) = (uniform_type, bool) <ide><path>numpy/lib/tests/test__iotools.py <ide> def test_keep_missing_values(self): <ide> converter = StringConverter(int, default=0, <ide> missing_values="N/A") <ide> assert_equal( <del> converter.missing_values, set(['', 'N/A'])) <add> converter.missing_values, {'', 'N/A'}) <ide> <ide> def test_int64_dtype(self): <ide> "Check that int64 integer types can be specified" <ide><path>numpy/lib/tests/test_shape_base.py <ide> def empty_to_1(x): <ide> def test_with_iterable_object(self): <ide> # from issue 5248 <ide> d = np.array([ <del> [set([1, 11]), set([2, 22]), set([3, 33])], <del> [set([4, 44]), set([5, 55]), set([6, 66])] <add> [{1, 11}, {2, 22}, {3, 33}], <add> [{4, 44}, {5, 55}, {6, 66}] <ide> ]) <ide> actual = np.apply_along_axis(lambda a: set.union(*a), 0, d) <ide> expected = np.array([{1, 11, 4, 44}, {2, 22, 5, 55}, {3, 33, 6, 66}]) <ide><path>numpy/testing/_private/parameterized.py <ide> def parameterized_argument_value_pairs(func, p): <ide> in zip(named_args, argspec.defaults or []) <ide> ]) <ide> <del> seen_arg_names = set([ n for (n, _) in result ]) <add> seen_arg_names = {n for (n, _) in result} <ide> keywords = QuietOrderedDict(sorted([ <ide> (name, p.kwargs[name]) <ide> for name in p.kwargs
12
Text
Text
improve translation index.md
be5d014be5e90a438ce042b64284b36fd5846e87
<ide><path>guide/russian/miscellaneous/design-resources-for-front-end-developers/index.md <ide> --- <ide> title: Design Resources for Front End Developers <del>localeTitle: Ресурсы разработки для разработчиков Front End <add>localeTitle: Дизайн-ресурсы для разработчиков Front End <ide> --- <del>Вы внештатный веб-разработчик или вы думаете об этом? Возможно, вы были в кодировке bootcamp или закончили онлайн-курс для начинающих разработчиков. Что будет дальше? <add>Вы - внештатный веб-разработчик или вы думаете стать таковым? Возможно, вы участвовали в учебных лагерях по программной разработке или закончили онлайн-курс для начинающих разработчиков? Что будет дальше? <ide> <ide> Вы получаете своего первого клиента. Это может быть просто друг, которому нужен персональный сайт. Это не имеет значения. Вы не хотите, чтобы он выглядел дилетантским. Вы хотите, чтобы он выглядел хорошо. Вы хотите, чтобы он выглядел профессионально. <ide> <ide> Вот что ... <ide> <del>Хороший дизайн может означать разницу между сайтом, который выглядит «самодельным», и тем, что выглядит профессионально. Если вы собираетесь зарабатывать на внешнем веб-разработке, вы не можете позволить себе создавать сайты, которые не демонстрируют хороших принципов дизайна. Большинство людей (т.е. потенциальные клиенты) знают, какой хороший дизайн выглядит, даже если они не могут сказать вам, почему это хороший дизайн. Поэтому он имеет понимание базовых концепций дизайна. Фактически, я бы зашел так далеко, что сказал, что это абсолютно необходимо, если у вас будет успешная карьера внештатного разработчика-фрилансера. <add>Хороший дизайн может означать разницу между сайтом, который выглядит «самодельным», и тем, что выглядит профессионально. Если вы собираетесь зарабатывать на front-end-разработке, вы не можете позволить себе создавать сайты, которые не следуют хорошим принципам дизайна. Большинство людей (т.е. потенциальные клиенты) знают, как выглядит хороший дизайн, даже если они не могут сказать вам, почему это - хороший дизайн. Поэтому важно понимать базовые концепции дизайна. Фактически, я бы сказал, что это абсолютно необходимо, если Вы желаете иметь успешную карьеру в качестве внештатного разработчика-фрилансера. <ide> <del>Так с чего же начать? Куда вы идете, чтобы узнать о дизайне? К счастью, вам не нужно платить деньги, чтобы изучить основополагающие основы дизайна. Там много ресурсов, которые на 100% бесплатны. Вот 10 ресурсов (большинство из них бесплатно), которые помогут вам стать внештатным разработчиком, поскольку они помогут вам стать лучшим дизайнером. Повеселись! <add>Так с чего же начать? Куда идти, чтобы узнать о дизайне? К счастью, вам не нужно платить деньги, чтобы изучить основополагающие принципы дизайна. Существует много ресурсов, которые совершенно бесплатны. Вот 10 ресурсов (большинство из них бесплатны), которые помогут вам стать внештатным разработчиком, поскольку они помогут вам стать лучшим дизайнером. Удачи! <ide> <ide> ## 1\. [Hackdesign.org](https://hackdesign.org) <ide> <ide> localeTitle: Ресурсы разработки для разработчико <ide> <ide> ## 10\. [_Творческий вызов_ Тэннера Кристенсена](http://www.amazon.com/Creativity-Challenge-Experiment-Innovate-Inspire/dp/1440588333) <ide> <del>Наконец, если вы являетесь независимым веб-разработчиком, обладающим множеством шляп, вам нужно будет сохранить свое творчество в отличной форме, а это значит использовать его. В этих книгах содержится 150 интересных задач, направленных на то, чтобы заставить вас думать нестандартно и видеть вещи под другим углом. Введение в книгу подводит итог: «Всякий раз, когда вы чувствуете себя застрявшим или невдохновленным, просто перейдите на случайную страницу и следуйте инструкциям, чтобы завершить творческий вызов, который вы там найдете». <ide>\ No newline at end of file <add>Наконец, если вы являетесь независимым веб-разработчиком, обладающим множеством шляп, вам нужно будет сохранить свое творчество в отличной форме, а это значит использовать его. В этих книгах содержится 150 интересных задач, направленных на то, чтобы заставить вас думать нестандартно и видеть вещи под другим углом. Введение в книгу подводит итог: «Всякий раз, когда вы чувствуете себя застрявшим или невдохновленным, просто перейдите на случайную страницу и следуйте инструкциям, чтобы завершить творческий вызов, который вы там найдете».
1