content_type
stringclasses
8 values
main_lang
stringclasses
7 values
message
stringlengths
1
50
sha
stringlengths
40
40
patch
stringlengths
52
962k
file_count
int64
1
300
Ruby
Ruby
fix double logs if rails.logger outputs to stderr
82eb1f441d9654b8ef1125fe40a30e6fcf6c8644
<ide><path>railties/lib/rails/commands/server/server_command.rb <ide> def log_to_stdout <ide> console.formatter = Rails.logger.formatter <ide> console.level = Rails.logger.level <ide> <del> unless ActiveSupport::Logger.logger_outputs_to?(Rails.logger, STDOUT) <add> unless ActiveSupport::Logger.logger_outputs_to?(Rails.logger, STDERR, STDOUT) <ide> Rails.logger.extend(ActiveSupport::Logger.broadcast(console)) <ide> end <ide> end
1
Ruby
Ruby
get the new base tests to pass
c7ba9aa195196d534109575affab700f7bc10984
<ide><path>actionpack/test/new_base/test_helper.rb <ide> # Debugging disabled. `gem install ruby-debug` to enable. <ide> end <ide> <del>require 'action_controller/abstract' <del>require 'action_controller/new_base' <add>require 'action_controller' <ide> require 'pp' # require 'pp' early to prevent hidden_methods from not picking up the pretty-print methods until too late <ide> <ide> require 'action_controller/testing/process'
1
Go
Go
fix typo in testcase
1567cf2cdf07bcbafbb1555fd950f5c5ce7a1c66
<ide><path>integration-cli/docker_api_containers_test.go <ide> func TestContainerApiPause(t *testing.T) { <ide> t.Fatalf("There should be no paused container.") <ide> } <ide> <del> logDone("container REST API - check POST containers/pause nad unpause") <add> logDone("container REST API - check POST containers/pause and unpause") <ide> }
1
Ruby
Ruby
remove obsolete fallback for broken xcode 4.3+
2c6d4973b96cbad71c868923bc456958582be36f
<ide><path>Library/Homebrew/os/mac/xcode.rb <ide> module Xcode <ide> <ide> V4_BUNDLE_ID = "com.apple.dt.Xcode" <ide> V3_BUNDLE_ID = "com.apple.Xcode" <del> V4_BUNDLE_PATH = Pathname.new("/Applications/Xcode.app") <ide> <ide> def latest_version <ide> case MacOS.version <ide> def prefix <ide> if path != CLT::MAVERICKS_PKG_PATH and path.absolute? \ <ide> and File.executable? "#{path}/usr/bin/make" <ide> path <del> elsif File.executable? "#{V4_BUNDLE_PATH}/Contents/Developer/usr/bin/make" <del> # TODO Remove this branch when 10.10 is released <del> # This is a fallback for broken installations of Xcode 4.3+. Correct <del> # installations will be handled by the first branch. Pretending that <del> # broken installations are OK just leads to hard to diagnose problems <del> # later. <del> Pathname.new("#{V4_BUNDLE_PATH}/Contents/Developer") <ide> elsif (path = bundle_path) <ide> path += "Contents/Developer" <ide> path if File.executable? "#{path}/usr/bin/make"
1
Text
Text
change the formatting in line 6
02df1343e1daaa44329706436dcbe5dd12c1e991
<ide><path>guide/english/css/background-size/index.md <ide> title: Background Size <ide> --- <ide> ## Background Size <ide> <del>The background-size property specifies the size of the background images. You can set a length or a percentage, with the first value being the width and the second one being the height. You can also use one of the 5 keyword values: <add>The `background-size` property specifies the size of the background images. You can set a length or a percentage, with the first value being the width and the second one being the height. You can also use one of the 5 keyword values: <ide> <ide> ```css <ide> /* Background size property values that can be used */
1
Python
Python
remove a todo item to use a tiny model
322dffc6c9a44fd504b24b0efcbcaa419b577a93
<ide><path>examples/test_examples.py <ide> def test_run_glue(self): <ide> def test_run_language_modeling(self): <ide> stream_handler = logging.StreamHandler(sys.stdout) <ide> logger.addHandler(stream_handler) <del> # TODO: switch to smaller model like sshleifer/tiny-distilroberta-base <ide> <ide> testargs = """ <ide> run_language_modeling.py
1
Javascript
Javascript
update controllername documentation
505dbe681943bc25d55b654f298f6723e3dcb1be
<ide><path>packages/ember-routing/lib/system/route.js <ide> let Route = EmberObject.extend(ActionHandler, Evented, { <ide> The name of the controller to associate with this route. <ide> <ide> By default, Ember will lookup a route's controller that matches the name <del> of the route (i.e. `App.PostController` for `App.PostRoute`). However, <add> of the route (i.e. `posts.new`). However, <ide> if you would like to define a specific controller to use, you can do so <ide> using this property. <ide>
1
Python
Python
fix exception cause in mingw32ccompiler.py
86cd3582c0e9101ac40434ae4488abdab1c1c910
<ide><path>numpy/distutils/mingw32ccompiler.py <ide> def msvc_manifest_xml(maj, min): <ide> fullver = _MSVCRVER_TO_FULLVER[str(maj * 10 + min)] <ide> except KeyError: <ide> raise ValueError("Version %d,%d of MSVCRT not supported yet" % <del> (maj, min)) <add> (maj, min)) from None <ide> # Don't be fooled, it looks like an XML, but it is not. In particular, it <ide> # should not have any space before starting, and its size should be <ide> # divisible by 4, most likely for alignment constraints when the xml is
1
Text
Text
add info about changing icon sizing
bc3bafcfb0cb462aebebd3543077b601d21eba98
<ide><path>guide/english/bootstrap/fontawesome-icons/index.md <ide> You can also use Font Awesome's own CDN. <ide> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.4.1/css/fontawesome.css" integrity="sha384-BzCy2fixOYd0HObpx3GMefNqdbA7Qjcc91RgYeDjrHTIEXqiF00jKvgQG0+zY/7I" crossorigin="anonymous"> <ide> ``` <ide> <del>Additionaly, the Font Awesome CDN can supply the brand and regular logos independently. <add>Additionally, the Font Awesome CDN can supply the brand and regular logos independently. <ide> <ide> ```html <ide> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.4.1/css/brands.css" integrity="sha384-Px1uYmw7+bCkOsNAiAV5nxGKJ0Ixn5nChyW8lCK1Li1ic9nbO5pC/iXaq27X5ENt" crossorigin="anonymous"> <ide> Simply create `<i>` or `<span>` tag and apply the CSS Prefix `fa` and the icon's <ide> <ide> <i class="fa fa-twitter" aria-hidden="true"></i> <ide> <del>`<span class="fa fa-freecodecamp" aria-hidden="true"></span>` <add>`<span class="fa fa-free-code-camp" aria-hidden="true"></span>` <ide> <del><span class="fa fa-freecodecamp" aria-hidden="true"></span> <add><span class="fa fa-free-code-camp" aria-hidden="true"></span> <ide> <del>#### Font Awesome Icon List: <del>Complete list of icons provided by Font Awesome is available [here](http://fontawesome.io/cheatsheet/) <add>Icons inherit the `font-size` of their parent container by default, but sizing can be modified by adding `.fa-*` classes, where `*` is one of `xs, sm, md, lg or [1-5]x`. <add> <add>#### Fontawesome Icon List: <add>Complete list of icons provided by fontawesome is available [here](http://fontawesome.io/cheatsheet/) <ide> <ide> `.fa fa-align-left` This is Font Awesome align left icon. <ide>
1
Text
Text
remove rpm install instructions
a128cf5eb390066215fd870ae638241e2dfb15ba
<ide><path>README.md <ide> Currently only a 64-bit version is available. <ide> The Linux version does not currently automatically update so you will need to <ide> repeat these steps to upgrade to future releases. <ide> <del>### Red Hat Linux (Fedora, CentOS, Red Hat) <del> <del>Currently only a 64-bit version is available. <del> <del>1. Download `atom-amd64.rpm` from the [Atom releases page](https://github.com/atom/atom/releases/latest). <del>2. Run `sudo yum localinstall atom-amd64.rpm` on the downloaded package. <del>3. Launch Atom using the installed `atom` command. <del> <del>The Linux version does not currently automatically update so you will need to <del>repeat these steps to upgrade to future releases. <del> <ide> ## Building <ide> <ide> * [Linux](docs/build-instructions/linux.md)
1
Javascript
Javascript
update translation parser
92a60f8bce2b79087e4f7c3579167a0fcc33a0f4
<ide><path>curriculum/getChallenges.js <ide> async function parseTranslation(engPath, transPath, dict, lang) { <ide> const engChal = await parseMarkdown(engPath); <ide> const translatedChal = await parseMarkdown(transPath); <ide> <del> const engWithTranslatedComments = translateCommentsInChallenge( <del> engChal, <del> lang, <del> dict <del> ); <del> <add> // challengeType 11 is for video challenges, which have no seeds, so we skip <add> // them. <add> const engWithTranslatedComments = <add> engChal.challengeType !== 11 <add> ? translateCommentsInChallenge(engChal, lang, dict) <add> : engChal; <ide> return mergeChallenges(engWithTranslatedComments, translatedChal); <ide> } <ide> <ide><path>tools/challenge-md-parser/translation-parser/translation-parser.js <ide> exports.translateComments = (text, lang, dict, codeLang) => { <ide> const config = { knownComments, dict, lang }; <ide> switch (codeLang) { <ide> case 'js': <del> return transMultiline(transInline(text, config), config); <ide> case 'jsx': <del> return transJSX(text, config); <add> return transMultiline(transInline(text, config), config); <ide> case 'html': <del> return transHTML(transCSS(text, config), config); <add> return transScript(transHTML(transCSS(text, config), config), config); <ide> default: <ide> return text; <ide> } <ide> }; <ide> <ide> exports.translateCommentsInChallenge = (challenge, lang, dict) => { <ide> const challClone = clone(challenge); <del> <del> Object.keys(challClone.files).forEach(key => { <del> if (challClone.files[key].contents) { <del> challClone.files[key].contents = this.translateComments( <del> challenge.files[key].contents, <del> lang, <del> dict, <del> challClone.files[key].ext <del> ); <del> } <del> }); <del> <add> if (!challClone.files) { <add> console.warn(`Challenge ${challClone.title} has no comments to translate`); <add> } else { <add> Object.keys(challClone.files).forEach(key => { <add> if (challClone.files[key].contents) { <add> challClone.files[key].contents = this.translateComments( <add> challenge.files[key].contents, <add> lang, <add> dict, <add> challClone.files[key].ext <add> ); <add> } <add> }); <add> } <ide> return challClone; <ide> }; <ide> <ide> exports.mergeChallenges = (engChal, transChal) => { <ide> // bare urls could be interpreted as comments, so we have to lookbehind for <ide> // http:// or https:// <ide> function transInline(text, config) { <del> return translateGeneric( <del> text, <del> config, <del> '(^[^\'"`]*?(?<!https?:)//\\s*)', <del> '(\\s*$)' <del> ); <add> return translateGeneric(text, config, '((?<!https?:)//\\s*)', '(\\s*$)'); <ide> } <ide> <ide> function transMultiline(text, config) { <ide> function transCSS(text, config) { <ide> return text; <ide> } <ide> <del>function transJSX(text, config) { <del> return translateGeneric(text, config, '({[^}]*/\\*\\s*)', '(\\s*\\*/[^{]*})'); <add>function transScript(text, config) { <add> const regex = /<script>.*?<\/script>/gms; <add> const matches = text.matchAll(regex); <add> <add> for (const [match] of matches) { <add> text = text.replace( <add> match, <add> transMultiline(transInline(match, config), config) <add> ); <add> } <add> return text; <ide> } <ide> <ide> function transHTML(text, config) { <ide><path>tools/challenge-md-parser/translation-parser/translation-parser.test.js <ide> describe('translation parser', () => { <ide> ); <ide> }); <ide> <del> // If a comment follows '"` it could be inside a string, so we should <del> // not try and translate it - erring on the side of caution. <del> it('should ignore comments if they follow an open quote', () => { <del> const seed = `var str = '// Add your code below this line' <del> var str2 = '// Add your code above this line`; <del> expect(translateComments(seed, 'chinese', SIMPLE_TRANSLATION, 'js')).toBe( <del> seed <del> ); <del> }); <ide> it('replaces multiple English comments with their translations', () => { <ide> const seed = `inline comment // Add your code below this line <ide> // Add your code below this line `; <ide> describe('translation parser', () => { <ide> ).toBe(transSeed); <ide> }); <ide> <add> it('replaces English script comments with their translations', () => { <add> const seed = `<script> <add> // Add your code below this line <add> </script>`; <add> const transSeed = `<script> <add> // (Chinese) Add your code below this line (Chinese) <add> </script>`; <add> expect( <add> translateComments(seed, 'chinese', SIMPLE_TRANSLATION, 'html') <add> ).toBe(transSeed); <add> }); <add> <add> it('replaces multiple script comments with their translations', () => { <add> const seed = `<script> <add> /* Add your code below this line */ <add> // Add your code below this line <add> </script>`; <add> const transSeed = `<script> <add> /* (Chinese) Add your code below this line (Chinese) */ <add> // (Chinese) Add your code below this line (Chinese) <add> </script>`; <add> expect( <add> translateComments(seed, 'chinese', SIMPLE_TRANSLATION, 'html') <add> ).toBe(transSeed); <add> }); <add> <ide> it('ignores html comments inside JavaScript', () => { <ide> const seed = `<div> <!-- Add your code below this line <ide> Add your code above this line --> <span>change code below this line</span> `; <ide> describe('translation parser', () => { <ide> /* this is not a comment */ <ide> </style>`; <ide> const seedHTML = `<div> <!-- this is not a comment --> `; <add> const seedScript = `<script> // this is not a comment </script>`; <ide> <ide> translateComments(seedJSX, 'chinese', SIMPLE_TRANSLATION, 'jsx'); <ide> expect(logSpy).toBeCalledTimes(1); <ide> describe('translation parser', () => { <ide> expect(logSpy).toBeCalledTimes(4); <ide> translateComments(seedHTML, 'chinese', SIMPLE_TRANSLATION, 'html'); <ide> expect(logSpy).toBeCalledTimes(5); <del> logSpy.mockRestore(); <add> translateComments(seedScript, 'chinese', SIMPLE_TRANSLATION, 'html'); <add> expect(logSpy).toBeCalledTimes(6); <ide> }); <ide> }); <ide> });
3
Python
Python
fix typo in mt5 configuration docstring
42477d68faae338d2c5a74875a3586a1a57a721e
<ide><path>src/transformers/models/mt5/configuration_mt5.py <ide> class MT5Config(PretrainedConfig): <ide> outputs. Read the documentation from :class:`~transformers.PretrainedConfig` for more information. <ide> <ide> Arguments: <del> vocab_size (:obj:`int`, `optional`, defaults to 32128): <add> vocab_size (:obj:`int`, `optional`, defaults to 250112): <ide> Vocabulary size of the T5 model. Defines the number of different tokens that can be represented by the <ide> :obj:`inputs_ids` passed when calling :class:`~transformers.T5Model` or :class:`~transformers.TFT5Model`. <ide> d_model (:obj:`int`, `optional`, defaults to 512):
1
Javascript
Javascript
add placement bit without removing others
1377e465ddc492a1b4b33d75e652bce9b273cc85
<ide><path>packages/react-reconciler/src/ReactChildFiber.new.js <ide> function ChildReconciler(shouldTrackSideEffects) { <ide> const oldIndex = current.index; <ide> if (oldIndex < lastPlacedIndex) { <ide> // This is a move. <del> newFiber.flags = Placement; <add> newFiber.flags |= Placement; <ide> return lastPlacedIndex; <ide> } else { <ide> // This item can stay in place. <ide> return oldIndex; <ide> } <ide> } else { <ide> // This is an insertion. <del> newFiber.flags = Placement; <add> newFiber.flags |= Placement; <ide> return lastPlacedIndex; <ide> } <ide> } <ide> function ChildReconciler(shouldTrackSideEffects) { <ide> // This is simpler for the single child case. We only need to do a <ide> // placement for inserting new children. <ide> if (shouldTrackSideEffects && newFiber.alternate === null) { <del> newFiber.flags = Placement; <add> newFiber.flags |= Placement; <ide> } <ide> return newFiber; <ide> } <ide><path>packages/react-reconciler/src/ReactChildFiber.old.js <ide> function ChildReconciler(shouldTrackSideEffects) { <ide> const oldIndex = current.index; <ide> if (oldIndex < lastPlacedIndex) { <ide> // This is a move. <del> newFiber.flags = Placement; <add> newFiber.flags |= Placement; <ide> return lastPlacedIndex; <ide> } else { <ide> // This item can stay in place. <ide> return oldIndex; <ide> } <ide> } else { <ide> // This is an insertion. <del> newFiber.flags = Placement; <add> newFiber.flags |= Placement; <ide> return lastPlacedIndex; <ide> } <ide> } <ide> function ChildReconciler(shouldTrackSideEffects) { <ide> // This is simpler for the single child case. We only need to do a <ide> // placement for inserting new children. <ide> if (shouldTrackSideEffects && newFiber.alternate === null) { <del> newFiber.flags = Placement; <add> newFiber.flags |= Placement; <ide> } <ide> return newFiber; <ide> }
2
PHP
PHP
remove unused imports
db20d3d754fa212605fad0cbcba833c714fda2e9
<ide><path>tests/Support/SupportHelpersTest.php <ide> use Mockery as m; <ide> use RuntimeException; <ide> use Illuminate\Support\Arr; <del>use Illuminate\Support\Str; <ide> use PHPUnit\Framework\TestCase; <ide> use Illuminate\Support\Optional; <ide> use Illuminate\Contracts\Support\Htmlable;
1
Text
Text
use arrow functions in util.md sample code
817d4adb47b0bbc03733f67a48b15287092b3909
<ide><path>doc/api/util.md <ide> such a way that it is marked as deprecated. <ide> ```js <ide> const util = require('util'); <ide> <del>exports.obsoleteFunction = util.deprecate(function() { <add>exports.obsoleteFunction = util.deprecate(() => { <ide> // Do something here. <ide> }, 'obsoleteFunction() is deprecated. Use newShinyFunction() instead.'); <ide> ``` <ide> util.isObject(null); <ide> // Returns: false <ide> util.isObject({}); <ide> // Returns: true <del>util.isObject(function() {}); <add>util.isObject(() => {}); <ide> // Returns: false <ide> ``` <ide> <ide> util.isPrimitive(undefined); <ide> // Returns: true <ide> util.isPrimitive({}); <ide> // Returns: false <del>util.isPrimitive(function() {}); <add>util.isPrimitive(() => {}); <ide> // Returns: false <ide> util.isPrimitive(/^$/); <ide> // Returns: false
1
Text
Text
update cdn in readme to 2.1.2
c276926c14a0f37e71f29f810e66354d7fca1e62
<ide><path>README.md <ide> To install via npm / bower: <ide> npm install chart.js --save <ide> bower install Chart.js --save <ide> ``` <del>CDN: https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.1.1/Chart.min.js <add>CDN: https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.1.2/Chart.min.js <ide> <ide> ## Documentation <ide>
1
Ruby
Ruby
improve wording of comments
c9d75177fe87ee1348c79d042c6449970eb47879
<ide><path>activemodel/lib/active_model/attributes.rb <ide> def attribute(attr_name) <ide> @attributes.fetch_value(name) <ide> end <ide> <del> # Handle *= for method_missing. <add> # Dispatch target for <tt>*=</tt> attribute methods. <ide> def attribute=(attribute_name, value) <ide> write_attribute(attribute_name, value) <ide> end <ide><path>activemodel/lib/active_model/dirty.rb <ide> def changed <ide> mutations_from_database.changed_attribute_names <ide> end <ide> <del> # Handles <tt>*_changed?</tt> for +method_missing+. <add> # Dispatch target for <tt>*_changed?</tt> attribute methods. <ide> def attribute_changed?(attr_name, **options) # :nodoc: <ide> mutations_from_database.changed?(attr_name.to_s, options) <ide> end <ide> <del> # Handles <tt>*_was</tt> for +method_missing+. <add> # Dispatch target for <tt>*_was</tt> attribute methods. <ide> def attribute_was(attr_name) # :nodoc: <ide> mutations_from_database.original_value(attr_name.to_s) <ide> end <ide> <del> # Handles <tt>*_previously_changed?</tt> for +method_missing+. <add> # Dispatch target for <tt>*_previously_changed?</tt> attribute methods. <ide> def attribute_previously_changed?(attr_name) # :nodoc: <ide> mutations_before_last_save.changed?(attr_name.to_s) <ide> end <ide> def mutations_before_last_save <ide> @mutations_before_last_save ||= ActiveModel::NullMutationTracker.instance <ide> end <ide> <del> # Handles <tt>*_change</tt> for +method_missing+. <add> # Dispatch target for <tt>*_change</tt> attribute methods. <ide> def attribute_change(attr_name) <ide> mutations_from_database.change_to_attribute(attr_name.to_s) <ide> end <ide> <del> # Handles <tt>*_previous_change</tt> for +method_missing+. <add> # Dispatch target for <tt>*_previous_change</tt> attribute methods. <ide> def attribute_previous_change(attr_name) <ide> mutations_before_last_save.change_to_attribute(attr_name.to_s) <ide> end <ide> <del> # Handles <tt>*_will_change!</tt> for +method_missing+. <add> # Dispatch target for <tt>*_will_change!</tt> attribute methods. <ide> def attribute_will_change!(attr_name) <ide> mutations_from_database.force_change(attr_name.to_s) <ide> end <ide> <del> # Handles <tt>restore_*!</tt> for +method_missing+. <add> # Dispatch target for <tt>restore_*!</tt> attribute methods. <ide> def restore_attribute!(attr_name) <ide> attr_name = attr_name.to_s <ide> if attribute_changed?(attr_name) <ide><path>activerecord/lib/active_record/attribute_methods/before_type_cast.rb <ide> def attributes_before_type_cast <ide> <ide> private <ide> <del> # Handle *_before_type_cast for method_missing. <add> # Dispatch target for <tt>*_before_type_cast</tt> attribute methods. <ide> def attribute_before_type_cast(attribute_name) <ide> read_attribute_before_type_cast(attribute_name) <ide> end <ide><path>activerecord/lib/active_record/attribute_methods/query.rb <ide> def query_attribute(attr_name) <ide> end <ide> <ide> private <del> # Handle *? for method_missing. <add> # Dispatch target for <tt>*?</tt> attribute methods. <ide> def attribute?(attribute_name) <ide> query_attribute(attribute_name) <ide> end <ide><path>activerecord/lib/active_record/attribute_methods/write.rb <ide> def write_attribute_without_type_cast(attr_name, value) <ide> value <ide> end <ide> <del> # Handle *= for method_missing. <add> # Dispatch target for <tt>*=</tt> attribute methods. <ide> def attribute=(attribute_name, value) <ide> _write_attribute(attribute_name, value) <ide> end
5
Javascript
Javascript
remove createreactclass from camerarollview
8465094523f904f1a3865f356e9cbfa792840db1
<ide><path>Libraries/CameraRoll/CameraRoll.js <ide> const getPhotosParamChecker = deprecatedCreateStrictShapeTypeChecker({ <ide> mimeTypes: PropTypes.arrayOf(PropTypes.string), <ide> }); <ide> <del>type GetPhotosReturn = Promise<{ <del> edges: Array<{ <del> node: { <del> type: string, <del> group_name: string, <del> image: { <del> uri: string, <del> height: number, <del> width: number, <del> isStored?: boolean, <del> playableDuration: number, <del> }, <del> timestamp: number, <del> location?: { <del> latitude?: number, <del> longitude?: number, <del> altitude?: number, <del> heading?: number, <del> speed?: number, <del> }, <add>export type PhotoIdentifier = { <add> node: { <add> type: string, <add> group_name: string, <add> image: { <add> uri: string, <add> height: number, <add> width: number, <add> isStored?: boolean, <add> playableDuration: number, <ide> }, <del> }>, <add> timestamp: number, <add> location?: { <add> latitude?: number, <add> longitude?: number, <add> altitude?: number, <add> heading?: number, <add> speed?: number, <add> }, <add> }, <add>}; <add> <add>export type PhotoIdentifiersPage = { <add> edges: Array<PhotoIdentifier>, <ide> page_info: { <ide> has_next_page: boolean, <ide> start_cursor?: string, <ide> end_cursor?: string, <ide> }, <del>}>; <add>}; <ide> <ide> /** <ide> * Shape of the return value of the `getPhotos` function. <ide> class CameraRoll { <ide> * <ide> * See https://facebook.github.io/react-native/docs/cameraroll.html#getphotos <ide> */ <del> static getPhotos(params: GetPhotosParams): GetPhotosReturn { <add> static getPhotos(params: GetPhotosParams): Promise<PhotoIdentifiersPage> { <ide> if (__DEV__) { <ide> checkPropTypes( <ide> {params: getPhotosParamChecker}, <ide><path>RNTester/js/CameraRollExample.js <ide> const CameraRollView = require('./CameraRollView'); <ide> <ide> const AssetScaledImageExampleView = require('./AssetScaledImageExample'); <ide> <add>import type {PhotoIdentifier} from 'CameraRoll'; <add> <ide> class CameraRollExample extends React.Component< <ide> $FlowFixMeProps, <ide> $FlowFixMeState, <ide> class CameraRollExample extends React.Component< <ide> } <ide> } <ide> <del> _renderImage = asset => { <add> _renderImage = (asset: PhotoIdentifier) => { <ide> const imageSize = this.state.bigImages ? 150 : 75; <ide> const imageStyle = [styles.image, {width: imageSize, height: imageSize}]; <ide> const {location} = asset.node; <ide> const locationStr = location <ide> ? JSON.stringify(location) <ide> : 'Unknown location'; <ide> return ( <del> <TouchableOpacity key={asset} onPress={this.loadAsset.bind(this, asset)}> <add> <TouchableOpacity <add> key={asset.node.image.uri} <add> onPress={this.loadAsset.bind(this, asset)}> <ide> <View style={styles.row}> <ide> <Image source={asset.node.image} style={imageStyle} /> <ide> <View style={styles.info}> <ide><path>RNTester/js/CameraRollView.js <ide> <ide> 'use strict'; <ide> <del>var React = require('react'); <del>var createReactClass = require('create-react-class'); <del>const PropTypes = require('prop-types'); <del>var ReactNative = require('react-native'); <del>var { <add>const React = require('react'); <add>const ReactNative = require('react-native'); <add>const { <ide> ActivityIndicator, <ide> Alert, <ide> CameraRoll, <ide> var { <ide> StyleSheet, <ide> View, <ide> } = ReactNative; <add>const ListViewDataSource = require('ListViewDataSource'); <ide> <del>var groupByEveryN = require('groupByEveryN'); <del>var logError = require('logError'); <add>const groupByEveryN = require('groupByEveryN'); <add>const logError = require('logError'); <ide> <del>var propTypes = { <add>import type {PhotoIdentifier, PhotoIdentifiersPage} from 'CameraRoll'; <add> <add>const rowHasChanged = function(r1: Array<Image>, r2: Array<Image>): boolean { <add> if (r1.length !== r2.length) { <add> return true; <add> } <add> <add> for (var i = 0; i < r1.length; i++) { <add> if (r1[i] !== r2[i]) { <add> return true; <add> } <add> } <add> <add> return false; <add>}; <add> <add>type PropsObject = {| <ide> /** <ide> * The group where the photos will be fetched from. Possible <ide> * values are 'Album', 'All', 'Event', 'Faces', 'Library', 'PhotoStream' <ide> * and SavedPhotos. <ide> */ <del> groupTypes: PropTypes.oneOf([ <del> 'Album', <del> 'All', <del> 'Event', <del> 'Faces', <del> 'Library', <del> 'PhotoStream', <del> 'SavedPhotos', <del> ]), <add> groupTypes: <add> | 'Album' <add> | 'All' <add> | 'Event' <add> | 'Faces' <add> | 'Library' <add> | 'PhotoStream' <add> | 'SavedPhotos', <ide> <ide> /** <ide> * Number of images that will be fetched in one page. <ide> */ <del> batchSize: PropTypes.number, <add> batchSize: number, <ide> <ide> /** <ide> * A function that takes a single image as a parameter and renders it. <ide> */ <del> renderImage: PropTypes.func, <add> renderImage: PhotoIdentifier => React.Node, <ide> <ide> /** <ide> * imagesPerRow: Number of images to be shown in each row. <ide> */ <del> imagesPerRow: PropTypes.number, <add> <add> imagesPerRow: number, <ide> <ide> /** <ide> * The asset type, one of 'Photos', 'Videos' or 'All' <ide> */ <del> assetType: PropTypes.oneOf(['Photos', 'Videos', 'All']), <del>}; <del> <del>var CameraRollView = createReactClass({ <del> displayName: 'CameraRollView', <del> propTypes: propTypes, <del> <del> getDefaultProps: function(): Object { <add> assetType: 'Photos' | 'Videos' | 'All', <add>|}; <add> <add>type Props = $ReadOnly<PropsObject>; <add> <add>type State = {| <add> assets: Array<PhotoIdentifier>, <add> lastCursor: ?string, <add> noMore: boolean, <add> loadingMore: boolean, <add> dataSource: ListViewDataSource, <add>|}; <add> <add>class CameraRollView extends React.Component<Props, State> { <add> static defaultProps = { <add> groupTypes: 'SavedPhotos', <add> batchSize: 5, <add> imagesPerRow: 1, <add> assetType: 'Photos', <add> renderImage: function(asset: PhotoIdentifier) { <add> const imageSize = 150; <add> const imageStyle = [styles.image, {width: imageSize, height: imageSize}]; <add> return <Image source={asset.node.image} style={imageStyle} />; <add> }, <add> }; <add> <add> state = this.getInitialState(); <add> <add> getInitialState() { <ide> return { <del> groupTypes: 'SavedPhotos', <del> batchSize: 5, <del> imagesPerRow: 1, <del> assetType: 'Photos', <del> renderImage: function(asset) { <del> var imageSize = 150; <del> var imageStyle = [styles.image, {width: imageSize, height: imageSize}]; <del> return <Image source={asset.node.image} style={imageStyle} />; <del> }, <del> }; <del> }, <del> <del> getInitialState: function() { <del> var ds = new ListView.DataSource({rowHasChanged: this._rowHasChanged}); <del> <del> return { <del> assets: ([]: Array<Image>), <del> groupTypes: this.props.groupTypes, <del> lastCursor: (null: ?string), <del> assetType: this.props.assetType, <add> assets: [], <add> lastCursor: null, <ide> noMore: false, <ide> loadingMore: false, <del> dataSource: ds, <add> dataSource: new ListView.DataSource({rowHasChanged: rowHasChanged}), <ide> }; <del> }, <add> } <ide> <ide> /** <ide> * This should be called when the image renderer is changed to tell the <ide> * component to re-render its assets. <ide> */ <del> rendererChanged: function() { <del> var ds = new ListView.DataSource({rowHasChanged: this._rowHasChanged}); <add> rendererChanged() { <add> const ds = new ListView.DataSource({rowHasChanged: rowHasChanged}); <ide> this.state.dataSource = ds.cloneWithRows( <del> // $FlowFixMe(>=0.41.0) <ide> groupByEveryN(this.state.assets, this.props.imagesPerRow), <ide> ); <del> }, <add> } <ide> <del> componentDidMount: function() { <add> componentDidMount() { <ide> this.fetch(); <del> }, <add> } <ide> <del> /* $FlowFixMe(>=0.68.0 site=react_native_fb) This comment suppresses an error <del> * found when Flow v0.68 was deployed. To see the error delete this comment <del> * and run Flow. */ <del> UNSAFE_componentWillReceiveProps: function(nextProps: {groupTypes?: string}) { <add> UNSAFE_componentWillReceiveProps(nextProps: $Shape<PropsObject>) { <ide> if (this.props.groupTypes !== nextProps.groupTypes) { <ide> this.fetch(true); <ide> } <del> }, <add> } <ide> <del> _fetch: async function(clear?: boolean) { <add> async _fetch(clear?: boolean) { <ide> if (clear) { <ide> this.setState(this.getInitialState(), this.fetch); <ide> return; <ide> var CameraRollView = createReactClass({ <ide> } catch (e) { <ide> logError(e); <ide> } <del> }, <add> } <ide> <ide> /** <ide> * Fetches more images from the camera roll. If clear is set to true, it will <ide> * set the component to its initial state and re-fetch the images. <ide> */ <del> fetch: function(clear?: boolean) { <add> fetch = (clear?: boolean) => { <ide> if (!this.state.loadingMore) { <ide> this.setState({loadingMore: true}, () => { <ide> this._fetch(clear); <ide> }); <ide> } <del> }, <add> }; <ide> <del> render: function() { <add> render() { <ide> return ( <ide> <ListView <ide> renderRow={this._renderRow} <ide> var CameraRollView = createReactClass({ <ide> enableEmptySections <ide> /> <ide> ); <del> }, <add> } <ide> <del> _rowHasChanged: function(r1: Array<Image>, r2: Array<Image>): boolean { <del> if (r1.length !== r2.length) { <del> return true; <del> } <del> <del> for (var i = 0; i < r1.length; i++) { <del> if (r1[i] !== r2[i]) { <del> return true; <del> } <del> } <del> <del> return false; <del> }, <del> <del> _renderFooterSpinner: function() { <add> _renderFooterSpinner = () => { <ide> if (!this.state.noMore) { <ide> return <ActivityIndicator />; <ide> } <ide> return null; <del> }, <add> }; <ide> <ide> // rowData is an array of images <del> _renderRow: function( <del> rowData: Array<Image>, <add> _renderRow = ( <add> rowData: Array<PhotoIdentifier>, <ide> sectionID: string, <ide> rowID: string, <del> ) { <del> var images = rowData.map(image => { <add> ) => { <add> const images = rowData.map(image => { <ide> if (image === null) { <ide> return null; <ide> } <del> // $FlowFixMe(>=0.41.0) <ide> return this.props.renderImage(image); <ide> }); <ide> <ide> return <View style={styles.row}>{images}</View>; <del> }, <add> }; <ide> <del> _appendAssets: function(data: Object) { <del> var assets = data.edges; <del> var newState: Object = {loadingMore: false}; <add> _appendAssets(data: PhotoIdentifiersPage) { <add> const assets = data.edges; <add> const newState: $Shape<State> = {loadingMore: false}; <ide> <ide> if (!data.page_info.has_next_page) { <ide> newState.noMore = true; <ide> var CameraRollView = createReactClass({ <ide> newState.lastCursor = data.page_info.end_cursor; <ide> newState.assets = this.state.assets.concat(assets); <ide> newState.dataSource = this.state.dataSource.cloneWithRows( <del> // $FlowFixMe(>=0.41.0) <ide> groupByEveryN(newState.assets, this.props.imagesPerRow), <ide> ); <ide> } <ide> <ide> this.setState(newState); <del> }, <add> } <ide> <del> _onEndReached: function() { <add> _onEndReached = () => { <ide> if (!this.state.noMore) { <ide> this.fetch(); <ide> } <del> }, <del>}); <add> }; <add>} <ide> <del>var styles = StyleSheet.create({ <add>const styles = StyleSheet.create({ <ide> row: { <ide> flexDirection: 'row', <ide> flex: 1,
3
Text
Text
add code contribution
ade05b6cef0a5576532ed69588b95b54f694d0c9
<ide><path>CONTRIBUTING.md <ide> A world-class feature request addresses the following points: <ide> If your issue is well-written we're already 80% of the way there by the time you <ide> post it. <ide> <del>## Contributing code <del> <del>## Contributing examples <add>## Start contributing! (Pull Requests) <add> <add>Before writing code, we strongly advise you to search through the exising PRs or <add>issues to make sure that nobody is already working on the same thing. It is <add>always a good idea to open an issue to get some feedback. <add> <add>You will need basic `git` proficiency to be able to contribute to <add>`transformers`. `git` is not the easiest tool to use but it has the greatest <add>manual. Type `git --help` in a shell and enjoy. If you prefer books, [Pro <add>Git](https://git-scm.com/book/en/v2) is a very good reference. <add> <add>Follow these steps to start contributing: <add> <add>1. Fork the [repository](https://github.com/huggingface/transformers) by <add> clicking on the 'Fork' button. This creates a copy of the code <add> under your github user account. <add>2. Clone your fork to your local disk, and add the base repository as a remote: <add> <add> ```bash <add> $ git clone [email protected]:<your Github handle>/transformers.git <add> $ cd transformers <add> $ git remote add upstream [email protected]:huggingface/transformers.git <add> ``` <add> <add>3. Create a new branch to hold your development changes: <add> <add> ```bash <add> $ git checkout -b a-descriptive-name-for-my-changes <add> ``` <add> <add> **do not** work on the `master` branch. <add> <add>4. Set up a development environment by running in a virtual environment: <add> <add> ```bash <add> $ pip install -r requirements-dev.txt <add> ``` <add> <add>5. Develop the features on your branch. Add changed files using `git add` and <add> then `git commit` to record your changes locally: <add> <add> ```bash <add> $ git add modified_file.py <add> $ git commit <add> ``` <add> <add> Please write [good commit <add> messages](https://chris.beams.io/posts/git-commit/). It <add> is a good idea to sync your copy of the code with the original repository <add> regularly. This way you can quickly account for changes: <add> <add> ```bash <add> $ git fetch upstream <add> $ git rebase upstream/master <add> ``` <add> <add> Push the changes to your account using: <add> <add> ```bash <add> $ git push -u origin a-descriptive-name-for-my-changes <add> ``` <add> <add>6. Once you are satisfied (**and the checklist below is happy too**), go to the <add> webpage of your fork on Github. Click on 'Pull request' to send your changes <add> to the project maintainers for review. <add> <add> <add>### Checklist <add> <add>1. The title of your pull request should be a summary of its contribution; <add>2. If your pull request adresses an issue, please mention the issue number in <add> the pull request description to make sure they are linked; <add>3. To indicate a work in progress please prefix the title with `[WIP]`. These <add> are useful to avoid duplicated work, and to differentiate it from PRs ready <add> to be merged; <add>4. Make sure pre-existing tests still pass; <add>5. Add high-coverage tests. No quality test, no merge; <add>6. All public methods must have informative doctrings; <add> <add> <add>### Style guide <add> <add>For documentation strings, `transformers` follows the [google <add>style](https://google.github.io/styleguide/pyguide.html). <add> <add>#### This guide was heavily inspired by the awesome [scikit-learn guide to contributing](https://github.com/scikit-learn/scikit-learn/blob/master/CONTRIBUTING.md)
1
Text
Text
move italo a. casas to release emeritus
61e9e3c26b3730f10b5c4d90af68e76eed35d3e6
<ide><path>README.md <ide> Node.js releases are signed with one of the following GPG keys: <ide> `B9AE9905FFD7803F25714661B63B535A4C206CA9` <ide> * **Gibson Fahnestock** &lt;[email protected]&gt; <ide> `77984A986EBC2AA786BC0F66B01FBB92821C587A` <del>* **Italo A. Casas** &lt;[email protected]&gt; <del>`56730D5401028683275BD23C23EFEFE93C4CFFFE` <ide> * **James M Snell** &lt;[email protected]&gt; <ide> `71DCFD284A79C3B38668286BC97EC7A07EDE3FC1` <ide> * **Jeremiah Senkpiel** &lt;[email protected]&gt; <ide> The full set of trusted release keys can be imported by running: <ide> gpg --keyserver pool.sks-keyservers.net --recv-keys 94AE36675C464D64BAFA68DD7434390BDBE9B9C5 <ide> gpg --keyserver pool.sks-keyservers.net --recv-keys B9AE9905FFD7803F25714661B63B535A4C206CA9 <ide> gpg --keyserver pool.sks-keyservers.net --recv-keys 77984A986EBC2AA786BC0F66B01FBB92821C587A <del>gpg --keyserver pool.sks-keyservers.net --recv-keys 56730D5401028683275BD23C23EFEFE93C4CFFFE <ide> gpg --keyserver pool.sks-keyservers.net --recv-keys 71DCFD284A79C3B38668286BC97EC7A07EDE3FC1 <ide> gpg --keyserver pool.sks-keyservers.net --recv-keys FD3A5288F042B6850C66B31F09FE44734EB7990E <ide> gpg --keyserver pool.sks-keyservers.net --recv-keys 8FCCA13FEF1D0C2E91008E09770F7A9A5AE15600 <ide> Previous releases may also have been signed with one of the following GPG keys: <ide> `9554F04D7259F04124DE6B476D5A82AC7E37093B` <ide> * **Isaac Z. Schlueter** &lt;[email protected]&gt; <ide> `93C7E9E91B49E432C2F75674B0A78B0A6C481CF6` <add>* **Italo A. Casas** &lt;[email protected]&gt; <add>`56730D5401028683275BD23C23EFEFE93C4CFFFE` <ide> * **Julien Gilli** &lt;[email protected]&gt; <ide> `114F43EE0176B71C7BC219DD50A3051F888C628D` <ide> * **Timothy J Fontaine** &lt;[email protected]&gt;
1
Java
Java
improve empty request body handling
36ed4df59df03082b510841e55511d02424b7e56
<ide><path>spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/AbstractMessageConverterMethodArgumentResolver.java <ide> package org.springframework.web.servlet.mvc.method.annotation; <ide> <ide> import java.io.IOException; <add>import java.io.InputStream; <add>import java.io.PushbackInputStream; <ide> import java.lang.annotation.Annotation; <ide> import java.lang.reflect.Type; <ide> import java.util.ArrayList; <ide> import org.springframework.core.MethodParameter; <ide> import org.springframework.core.ResolvableType; <ide> import org.springframework.core.annotation.AnnotationUtils; <add>import org.springframework.http.HttpHeaders; <ide> import org.springframework.http.HttpInputMessage; <ide> import org.springframework.http.InvalidMediaTypeException; <ide> import org.springframework.http.MediaType; <ide> */ <ide> public abstract class AbstractMessageConverterMethodArgumentResolver implements HandlerMethodArgumentResolver { <ide> <add> private static final Object NO_VALUE = new Object(); <add> <add> <ide> protected final Log logger = LogFactory.getLog(getClass()); <ide> <ide> protected final List<HttpMessageConverter<?>> messageConverters; <ide> protected <T> Object readWithMessageConverters(NativeWebRequest webRequest, <ide> * @param <T> the expected type of the argument value to be created <ide> * @param inputMessage the HTTP input message representing the current request <ide> * @param param the method parameter descriptor (may be {@code null}) <del> * @param targetType the type of object to create, not necessarily the same as <del> * the method parameter type (e.g. for {@code HttpEntity<String>} method <del> * parameter the target type is String) <add> * @param targetType the target type, not necessarily the same as the method <add> * parameter type, e.g. for {@code HttpEntity<String>}. <ide> * @return the created method argument value <ide> * @throws IOException if the reading from the request fails <ide> * @throws HttpMediaTypeNotSupportedException if no suitable message converter is found <ide> protected <T> Object readWithMessageConverters(HttpInputMessage inputMessage, <ide> targetClass = (Class<T>) resolvableType.resolve(); <ide> } <ide> <add> inputMessage = new EmptyBodyCheckingHttpInputMessage(inputMessage); <add> Object body = NO_VALUE; <add> <ide> for (HttpMessageConverter<?> converter : this.messageConverters) { <ide> Class<HttpMessageConverter<?>> converterType = (Class<HttpMessageConverter<?>>) converter.getClass(); <ide> if (converter instanceof GenericHttpMessageConverter) { <ide> protected <T> Object readWithMessageConverters(HttpInputMessage inputMessage, <ide> if (logger.isDebugEnabled()) { <ide> logger.debug("Read [" + targetType + "] as \"" + contentType + "\" with [" + converter + "]"); <ide> } <del> inputMessage = getAdvice().beforeBodyRead(inputMessage, param, targetType, converterType); <del> T body = (T) genericConverter.read(targetType, contextClass, inputMessage); <del> return getAdvice().afterBodyRead(body, inputMessage, param, targetType, converterType); <add> if (inputMessage.getBody() != null) { <add> inputMessage = getAdvice().beforeBodyRead(inputMessage, param, targetType, converterType); <add> body = genericConverter.read(targetType, contextClass, inputMessage); <add> body = getAdvice().afterBodyRead(body, inputMessage, param, targetType, converterType); <add> } <add> else { <add> body = null; <add> body = getAdvice().handleEmptyBody(body, inputMessage, param, targetType, converterType); <add> } <add> break; <ide> } <ide> } <ide> else if (targetClass != null) { <ide> if (converter.canRead(targetClass, contentType)) { <ide> if (logger.isDebugEnabled()) { <ide> logger.debug("Read [" + targetType + "] as \"" + contentType + "\" with [" + converter + "]"); <ide> } <del> inputMessage = getAdvice().beforeBodyRead(inputMessage, param, targetType, converterType); <del> T body = ((HttpMessageConverter<T>) converter).read(targetClass, inputMessage); <del> return getAdvice().afterBodyRead(body, inputMessage, param, targetType, converterType); <add> if (inputMessage.getBody() != null) { <add> inputMessage = getAdvice().beforeBodyRead(inputMessage, param, targetType, converterType); <add> body = ((HttpMessageConverter<T>) converter).read(targetClass, inputMessage); <add> body = getAdvice().afterBodyRead(body, inputMessage, param, targetType, converterType); <add> } <add> else { <add> body = null; <add> body = getAdvice().handleEmptyBody(body, inputMessage, param, targetType, converterType); <add> } <add> break; <ide> } <ide> } <ide> } <ide> <del> throw new HttpMediaTypeNotSupportedException(contentType, this.allSupportedMediaTypes); <add> if (body == NO_VALUE) { <add> throw new HttpMediaTypeNotSupportedException(contentType, this.allSupportedMediaTypes); <add> } <add> <add> return body; <ide> } <ide> <ide> /** <ide> protected boolean isBindExceptionRequired(WebDataBinder binder, MethodParameter <ide> return !hasBindingResult; <ide> } <ide> <add> <add> private static class EmptyBodyCheckingHttpInputMessage implements HttpInputMessage { <add> <add> private final HttpHeaders headers; <add> <add> private final InputStream body; <add> <add> <add> public EmptyBodyCheckingHttpInputMessage(HttpInputMessage inputMessage) throws IOException { <add> this.headers = inputMessage.getHeaders(); <add> InputStream inputStream = inputMessage.getBody(); <add> if (inputStream == null) { <add> this.body = null; <add> } <add> else if (inputStream.markSupported()) { <add> inputStream.mark(1); <add> this.body = (inputStream.read() != -1 ? inputStream : null); <add> inputStream.reset(); <add> } <add> else { <add> PushbackInputStream pushbackInputStream = new PushbackInputStream(inputStream); <add> int b = pushbackInputStream.read(); <add> if (b == -1) { <add> this.body = null; <add> } <add> else { <add> this.body = pushbackInputStream; <add> pushbackInputStream.unread(b); <add> } <add> } <add> } <add> <add> @Override <add> public HttpHeaders getHeaders() { <add> return this.headers; <add> } <add> <add> @Override <add> public InputStream getBody() throws IOException { <add> return this.body; <add> } <add> } <add> <ide> } <ide><path>spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/HttpEntityMethodProcessor.java <ide> import java.io.IOException; <ide> import java.lang.reflect.ParameterizedType; <ide> import java.lang.reflect.Type; <add>import java.net.URI; <ide> import java.util.List; <ide> <ide> import org.springframework.core.MethodParameter; <ide> import org.springframework.core.ResolvableType; <ide> import org.springframework.http.HttpEntity; <ide> import org.springframework.http.HttpHeaders; <add>import org.springframework.http.HttpMethod; <ide> import org.springframework.http.RequestEntity; <ide> import org.springframework.http.ResponseEntity; <ide> import org.springframework.http.converter.HttpMessageConverter; <ide> public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer m <ide> <ide> Object body = readWithMessageConverters(webRequest, parameter, paramType); <ide> if (RequestEntity.class.equals(parameter.getParameterType())) { <del> return new RequestEntity<Object>(body, inputMessage.getHeaders(), <del> inputMessage.getMethod(), inputMessage.getURI()); <add> URI url = inputMessage.getURI(); <add> HttpMethod httpMethod = inputMessage.getMethod(); <add> return new RequestEntity<Object>(body, inputMessage.getHeaders(), httpMethod, url); <ide> } <ide> else { <ide> return new HttpEntity<Object>(body, inputMessage.getHeaders()); <ide><path>spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestResponseBodyMethodProcessor.java <ide> package org.springframework.web.servlet.mvc.method.annotation; <ide> <ide> import java.io.IOException; <del>import java.io.InputStream; <del>import java.io.PushbackInputStream; <ide> import java.lang.reflect.Type; <ide> import java.util.List; <ide> <ide> protected <T> Object readWithMessageConverters(NativeWebRequest webRequest, Meth <ide> HttpServletRequest servletRequest = webRequest.getNativeRequest(HttpServletRequest.class); <ide> HttpInputMessage inputMessage = new ServletServerHttpRequest(servletRequest); <ide> <del> InputStream inputStream = inputMessage.getBody(); <del> if (inputStream == null) { <del> return handleEmptyBody(methodParam); <del> } <del> else if (inputStream.markSupported()) { <del> inputStream.mark(1); <del> if (inputStream.read() == -1) { <del> return handleEmptyBody(methodParam); <del> } <del> inputStream.reset(); <del> } <del> else { <del> final PushbackInputStream pushbackInputStream = new PushbackInputStream(inputStream); <del> int b = pushbackInputStream.read(); <del> if (b == -1) { <del> return handleEmptyBody(methodParam); <del> } <del> else { <del> pushbackInputStream.unread(b); <add> Object arg = readWithMessageConverters(inputMessage, methodParam, paramType); <add> if (arg == null) { <add> if (methodParam.getParameterAnnotation(RequestBody.class).required()) { <add> throw new HttpMessageNotReadableException("Required request body is missing: " + methodParam); <ide> } <del> inputMessage = new ServletServerHttpRequest(servletRequest) { <del> @Override <del> public InputStream getBody() { <del> // Form POST should not get here <del> return pushbackInputStream; <del> } <del> }; <ide> } <ide> <del> return super.readWithMessageConverters(inputMessage, methodParam, paramType); <del> } <del> <del> private Object handleEmptyBody(MethodParameter param) { <del> if (param.getParameterAnnotation(RequestBody.class).required()) { <del> throw new HttpMessageNotReadableException("Required request body content is missing: " + param); <del> } <del> return null; <add> return arg; <ide> } <ide> <ide> @Override <ide><path>spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/HttpEntityMethodProcessorMockTests.java <ide> <ide> package org.springframework.web.servlet.mvc.method.annotation; <ide> <add>import static org.junit.Assert.*; <add>import static org.mockito.BDDMockito.any; <add>import static org.mockito.BDDMockito.*; <add>import static org.mockito.BDDMockito.isA; <add>import static org.mockito.Matchers.eq; <add>import static org.springframework.web.servlet.HandlerMapping.*; <add> <ide> import java.lang.reflect.Method; <ide> import java.net.URI; <del>import java.text.SimpleDateFormat; <add>import java.nio.charset.Charset; <ide> import java.util.Arrays; <ide> import java.util.Collections; <ide> import java.util.Date; <del>import java.util.Locale; <del>import java.util.TimeZone; <ide> <ide> import org.junit.Before; <ide> import org.junit.Test; <ide> import org.springframework.web.context.request.ServletWebRequest; <ide> import org.springframework.web.method.support.ModelAndViewContainer; <ide> <del>import static org.junit.Assert.*; <del>import static org.mockito.BDDMockito.any; <del>import static org.mockito.BDDMockito.*; <del>import static org.mockito.BDDMockito.isA; <del>import static org.mockito.Matchers.eq; <del>import static org.springframework.web.servlet.HandlerMapping.*; <del> <ide> /** <ide> * Test fixture for {@link HttpEntityMethodProcessor} delegating to a mock <ide> * {@link HttpMessageConverter}. <ide> public void supportsReturnType() { <ide> <ide> @Test <ide> public void resolveArgument() throws Exception { <add> String body = "Foo"; <add> <ide> MediaType contentType = MediaType.TEXT_PLAIN; <ide> servletRequest.addHeader("Content-Type", contentType.toString()); <add> servletRequest.setContent(body.getBytes(Charset.forName("UTF-8"))); <ide> <del> String body = "Foo"; <ide> given(messageConverter.canRead(String.class, contentType)).willReturn(true); <ide> given(messageConverter.read(eq(String.class), isA(HttpInputMessage.class))).willReturn(body); <ide> <ide> public void resolveArgument() throws Exception { <ide> <ide> @Test <ide> public void resolveArgumentRequestEntity() throws Exception { <add> String body = "Foo"; <add> <ide> MediaType contentType = MediaType.TEXT_PLAIN; <ide> servletRequest.addHeader("Content-Type", contentType.toString()); <ide> servletRequest.setMethod("GET"); <ide> servletRequest.setServerName("www.example.com"); <ide> servletRequest.setServerPort(80); <ide> servletRequest.setRequestURI("/path"); <add> servletRequest.setContent(body.getBytes(Charset.forName("UTF-8"))); <ide> <del> String body = "Foo"; <ide> given(messageConverter.canRead(String.class, contentType)).willReturn(true); <ide> given(messageConverter.read(eq(String.class), isA(HttpInputMessage.class))).willReturn(body); <ide> <ide> public void handleReturnValueProduces() throws Exception { <ide> verify(messageConverter).write(eq(body), eq(MediaType.TEXT_HTML), isA(HttpOutputMessage.class)); <ide> } <ide> <add> @SuppressWarnings("unchecked") <ide> @Test <ide> public void handleReturnValueWithResponseBodyAdvice() throws Exception { <ide> ResponseEntity<String> returnValue = new ResponseEntity<>(HttpStatus.OK); <ide> public void handleReturnTypeChangedETagAndLastModified() throws Exception { <ide> assertEquals(0, servletResponse.getContentAsByteArray().length); <ide> } <ide> <del> public ResponseEntity<String> handle1(HttpEntity<String> httpEntity, ResponseEntity<String> responseEntity, int i, RequestEntity<String> requestEntity) { <del> return responseEntity; <add> @SuppressWarnings("unused") <add> public ResponseEntity<String> handle1(HttpEntity<String> httpEntity, ResponseEntity<String> entity, <add> int i, RequestEntity<String> requestEntity) { <add> <add> return entity; <ide> } <ide> <add> @SuppressWarnings("unused") <ide> public HttpEntity<?> handle2(HttpEntity<?> entity) { <ide> return entity; <ide> } <ide> <add> @SuppressWarnings("unused") <ide> public CustomHttpEntity handle2x(HttpEntity<?> entity) { <ide> return new CustomHttpEntity(); <ide> } <ide> <add> @SuppressWarnings("unused") <ide> public int handle3() { <ide> return 42; <ide> } <ide> <add> @SuppressWarnings("unused") <ide> @RequestMapping(produces = {"text/html", "application/xhtml+xml"}) <ide> public ResponseEntity<String> handle4() { <ide> return null; <ide> } <ide> <del> <add> @SuppressWarnings("unused") <ide> public static class CustomHttpEntity extends HttpEntity<Object> { <ide> } <ide> <ide><path>spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/HttpEntityMethodProcessorTests.java <ide> /* <del> * Copyright 2002-2014 the original author or authors. <add> * Copyright 2002-2015 the original author or authors. <ide> * <ide> * Licensed under the Apache License, Version 2.0 (the "License"); <ide> * you may not use this file except in compliance with the License. <ide> <ide> package org.springframework.web.servlet.mvc.method.annotation; <ide> <add>import static org.junit.Assert.*; <add> <ide> import java.io.Serializable; <ide> import java.lang.reflect.Method; <ide> import java.util.ArrayList; <add>import java.util.Arrays; <ide> import java.util.List; <ide> <ide> import org.junit.Before; <ide> import org.springframework.web.method.HandlerMethod; <ide> import org.springframework.web.method.support.ModelAndViewContainer; <ide> <del>import static org.junit.Assert.*; <del> <ide> /** <ide> * Test fixture with {@link HttpEntityMethodProcessor} delegating to <ide> * actual {@link HttpMessageConverter} instances. <ide> public class HttpEntityMethodProcessorTests { <ide> <ide> private MockHttpServletRequest servletRequest; <ide> <del> private MockHttpServletResponse servletResponse; <del> <ide> private ServletWebRequest webRequest; <ide> <ide> <ide> public void setUp() throws Exception { <ide> mavContainer = new ModelAndViewContainer(); <ide> binderFactory = new ValidatingBinderFactory(); <ide> servletRequest = new MockHttpServletRequest(); <del> servletResponse = new MockHttpServletResponse(); <del> webRequest = new ServletWebRequest(servletRequest, servletResponse); <add> webRequest = new ServletWebRequest(servletRequest, new MockHttpServletResponse()); <ide> } <ide> <ide> @Test <ide> public void resolveArgument() throws Exception { <ide> assertEquals("Jad", result.getBody().getName()); <ide> } <ide> <add> // SPR-12861 <add> <add> @Test <add> public void resolveArgumentWithEmptyBody() throws Exception { <add> this.servletRequest.setContent(new byte[0]); <add> this.servletRequest.setContentType("application/json"); <add> <add> List<HttpMessageConverter<?>> converters = Arrays.asList(new MappingJackson2HttpMessageConverter()); <add> HttpEntityMethodProcessor processor = new HttpEntityMethodProcessor(converters); <add> <add> HttpEntity<?> result = (HttpEntity<?>) processor.resolveArgument(this.paramSimpleBean, <add> this.mavContainer, this.webRequest, this.binderFactory); <add> <add> assertNotNull(result); <add> assertNull(result.getBody()); <add> } <add> <ide> @Test <ide> public void resolveGenericArgument() throws Exception { <ide> String content = "[{\"name\" : \"Jad\"}, {\"name\" : \"Robert\"}]"; <ide> public void resolveArgumentTypeVariable() throws Exception { <ide> } <ide> <ide> <add> @SuppressWarnings("unused") <ide> public void handle(HttpEntity<List<SimpleBean>> arg1, HttpEntity<SimpleBean> arg2) { <ide> } <ide> <del> <add> @SuppressWarnings("unused") <ide> private static abstract class MyParameterizedController<DTO extends Identifiable> { <ide> <ide> public void handleDto(HttpEntity<DTO> dto) { <ide> } <ide> } <ide> <del> <add> @SuppressWarnings("unused") <ide> private static class MySimpleParameterizedController extends MyParameterizedController<SimpleBean> { <ide> } <ide> <del> <ide> private interface Identifiable extends Serializable { <ide> <ide> public Long getId(); <ide><path>spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/RequestPartIntegrationTests.java <ide> /* <del> * Copyright 2002-2014 the original author or authors. <add> * Copyright 2002-2015 the original author or authors. <ide> * <ide> * Licensed under the Apache License, Version 2.0 (the "License"); <ide> * you may not use this file except in compliance with the License. <ide> <ide> package org.springframework.web.servlet.mvc.method.annotation; <ide> <add>import static org.junit.Assert.*; <add> <ide> import java.net.URI; <add>import java.util.ArrayList; <ide> import java.util.Arrays; <add>import java.util.List; <add> <ide> import javax.servlet.MultipartConfigElement; <ide> <ide> import org.eclipse.jetty.server.Server; <ide> import org.springframework.http.HttpEntity; <ide> import org.springframework.http.HttpHeaders; <ide> import org.springframework.http.HttpStatus; <add>import org.springframework.http.MediaType; <ide> import org.springframework.http.ResponseEntity; <ide> import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; <add>import org.springframework.http.converter.ByteArrayHttpMessageConverter; <ide> import org.springframework.http.converter.HttpMessageConverter; <ide> import org.springframework.http.converter.ResourceHttpMessageConverter; <ide> import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; <ide> import org.springframework.web.servlet.config.annotation.EnableWebMvc; <ide> import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; <ide> <del>import static org.junit.Assert.*; <del> <ide> /** <ide> * Test access to parts of a multipart request with {@link RequestPart}. <ide> * <ide> public static void startServer() throws Exception { <ide> <ide> @Before <ide> public void setUp() { <add> ByteArrayHttpMessageConverter emptyBodyConverter = new ByteArrayHttpMessageConverter(); <add> emptyBodyConverter.setSupportedMediaTypes(Arrays.asList(MediaType.APPLICATION_JSON)); <add> <add> List<HttpMessageConverter<?>> converters = new ArrayList<>(3); <add> converters.add(emptyBodyConverter); <add> converters.add(new ResourceHttpMessageConverter()); <add> converters.add(new MappingJackson2HttpMessageConverter()); <add> <ide> AllEncompassingFormHttpMessageConverter converter = new AllEncompassingFormHttpMessageConverter(); <del> converter.setPartConverters(Arrays.<HttpMessageConverter<?>>asList( <del> new ResourceHttpMessageConverter(), new MappingJackson2HttpMessageConverter())); <add> converter.setPartConverters(converters); <ide> <ide> restTemplate = new RestTemplate(new HttpComponentsClientHttpRequestFactory()); <ide> restTemplate.setMessageConverters(Arrays.<HttpMessageConverter<?>>asList(converter)); <ide> public void standardMultipartResolver() throws Exception { <ide> <ide> private void testCreate(String url) { <ide> MultiValueMap<String, Object> parts = new LinkedMultiValueMap<String, Object>(); <del> HttpEntity<TestData> jsonEntity = new HttpEntity<TestData>(new TestData("Jason")); <del> parts.add("json-data", jsonEntity); <add> parts.add("json-data", new HttpEntity<TestData>(new TestData("Jason"))); <ide> parts.add("file-data", new ClassPathResource("logo.jpg", this.getClass())); <add> parts.add("empty-data", new HttpEntity<byte[]>(new byte[0])); // SPR-12860 <ide> <ide> URI location = restTemplate.postForLocation(url, parts); <ide> assertEquals("http://localhost:8080/test/Jason/logo.jpg", location.toString()); <ide> public MultipartResolver multipartResolver() { <ide> } <ide> } <ide> <add> @SuppressWarnings("unused") <ide> @Controller <ide> private static class RequestPartTestController { <ide> <ide> @RequestMapping(value = "/test", method = RequestMethod.POST, consumes = { "multipart/mixed", "multipart/form-data" }) <del> public ResponseEntity<Object> create(@RequestPart("json-data") TestData testData, @RequestPart("file-data") MultipartFile file) { <add> public ResponseEntity<Object> create(@RequestPart("json-data") TestData testData, <add> @RequestPart("file-data") MultipartFile file, <add> @RequestPart(value = "empty-data", required = false) TestData emptyData) { <add> <ide> String url = "http://localhost:8080/test/" + testData.getName() + "/" + file.getOriginalFilename(); <ide> HttpHeaders headers = new HttpHeaders(); <ide> headers.setLocation(URI.create(url)); <ide><path>spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/RequestPartMethodArgumentResolverTests.java <ide> <ide> package org.springframework.web.servlet.mvc.method.annotation; <ide> <add>import static org.junit.Assert.*; <add>import static org.mockito.BDDMockito.*; <add> <ide> import java.lang.reflect.Method; <add>import java.nio.charset.Charset; <ide> import java.util.Arrays; <ide> import java.util.Collections; <ide> import java.util.List; <ide> import java.util.Optional; <add> <ide> import javax.servlet.http.Part; <ide> import javax.validation.Valid; <ide> import javax.validation.constraints.NotNull; <ide> <ide> import org.springframework.core.LocalVariableTableParameterNameDiscoverer; <ide> import org.springframework.core.MethodParameter; <add>import org.springframework.http.HttpInputMessage; <ide> import org.springframework.http.MediaType; <ide> import org.springframework.http.converter.HttpMessageConverter; <ide> import org.springframework.mock.web.test.MockHttpServletRequest; <ide> import org.springframework.web.multipart.support.MissingServletRequestPartException; <ide> import org.springframework.web.multipart.support.RequestPartServletServerHttpRequest; <ide> <del>import static org.junit.Assert.*; <del>import static org.mockito.BDDMockito.*; <del> <ide> /** <ide> * Test fixture with {@link RequestPartMethodArgumentResolver} and mock {@link HttpMessageConverter}. <ide> * <ide> public class RequestPartMethodArgumentResolverTests { <ide> <ide> private MockMultipartHttpServletRequest multipartRequest; <ide> <del> private MockHttpServletResponse servletResponse; <del> <ide> <ide> @SuppressWarnings("unchecked") <ide> @Before <ide> public void setUp() throws Exception { <ide> resolver = new RequestPartMethodArgumentResolver(Collections.<HttpMessageConverter<?>>singletonList(messageConverter)); <ide> reset(messageConverter); <ide> <del> multipartFile1 = new MockMultipartFile("requestPart", "", "text/plain", (byte[]) null); <del> multipartFile2 = new MockMultipartFile("requestPart", "", "text/plain", (byte[]) null); <add> byte[] content = "doesn't matter as long as not empty".getBytes(Charset.forName("UTF-8")); <add> <add> multipartFile1 = new MockMultipartFile("requestPart", "", "text/plain", content); <add> multipartFile2 = new MockMultipartFile("requestPart", "", "text/plain", content); <ide> multipartRequest = new MockMultipartHttpServletRequest(); <ide> multipartRequest.addFile(multipartFile1); <ide> multipartRequest.addFile(multipartFile2); <del> servletResponse = new MockHttpServletResponse(); <del> webRequest = new ServletWebRequest(multipartRequest, servletResponse); <add> webRequest = new ServletWebRequest(multipartRequest, new MockHttpServletResponse()); <ide> } <ide> <ide> <ide> public void resolveOptionalRequestPart() throws Exception { <ide> SimpleBean simpleBean = new SimpleBean("foo"); <ide> <ide> given(messageConverter.canRead(SimpleBean.class, MediaType.TEXT_PLAIN)).willReturn(true); <del> given(messageConverter.read(eq(SimpleBean.class), isA(RequestPartServletServerHttpRequest.class))).willReturn(simpleBean); <add> given(messageConverter.read(eq(SimpleBean.class), isA(HttpInputMessage.class))).willReturn(simpleBean); <ide> <ide> ModelAndViewContainer mavContainer = new ModelAndViewContainer(); <ide> Object actualValue = resolver.resolveArgument(optionalRequestPart, mavContainer, webRequest, new ValidatingBinderFactory()); <ide> public void resolveOptionalRequestPartNotPresent() throws Exception { <ide> <ide> private void testResolveArgument(SimpleBean argValue, MethodParameter parameter) throws Exception { <ide> given(messageConverter.canRead(SimpleBean.class, MediaType.TEXT_PLAIN)).willReturn(true); <del> given(messageConverter.read(eq(SimpleBean.class), isA(RequestPartServletServerHttpRequest.class))).willReturn(argValue); <add> given(messageConverter.read(eq(SimpleBean.class), isA(HttpInputMessage.class))).willReturn(argValue); <ide> <ide> ModelAndViewContainer mavContainer = new ModelAndViewContainer(); <ide> Object actualValue = resolver.resolveArgument(parameter, mavContainer, webRequest, new ValidatingBinderFactory()); <ide> public WebDataBinder createBinder(NativeWebRequest webRequest, Object target, St <ide> } <ide> } <ide> <del> <add> @SuppressWarnings("unused") <ide> public void handle(@RequestPart SimpleBean requestPart, <ide> @RequestPart(value="requestPart", required=false) SimpleBean namedRequestPart, <ide> @Valid @RequestPart("requestPart") SimpleBean validRequestPart, <ide><path>spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/RequestResponseBodyMethodProcessorMockTests.java <ide> <ide> package org.springframework.web.servlet.mvc.method.annotation; <ide> <del>import java.io.IOException; <add>import static org.junit.Assert.*; <add>import static org.mockito.BDDMockito.*; <add> <ide> import java.lang.reflect.Method; <ide> import java.nio.charset.Charset; <ide> import java.util.Arrays; <ide> import java.util.Collections; <ide> import java.util.List; <add> <ide> import javax.validation.Valid; <ide> import javax.validation.constraints.NotNull; <ide> <ide> import org.springframework.web.method.support.ModelAndViewContainer; <ide> import org.springframework.web.servlet.HandlerMapping; <ide> <del>import static org.junit.Assert.*; <del>import static org.mockito.BDDMockito.*; <del> <ide> /** <ide> * Test fixture for {@link RequestResponseBodyMethodProcessor} delegating to a <ide> * mock HttpMessageConverter. <ide> public class RequestResponseBodyMethodProcessorMockTests { <ide> <ide> private MockHttpServletRequest servletRequest; <ide> <del> private MockHttpServletResponse servletResponse; <ide> <ide> @SuppressWarnings("unchecked") <ide> @Before <ide> public void setUp() throws Exception { <ide> mavContainer = new ModelAndViewContainer(); <ide> <ide> servletRequest = new MockHttpServletRequest(); <del> servletResponse = new MockHttpServletResponse(); <del> webRequest = new ServletWebRequest(servletRequest, servletResponse); <add> webRequest = new ServletWebRequest(servletRequest, new MockHttpServletResponse()); <ide> } <ide> <ide> @Test <ide> public void resolveArgumentValid() throws Exception { <ide> testResolveArgumentWithValidation(new SimpleBean("name")); <ide> } <ide> <del> private void testResolveArgumentWithValidation(SimpleBean simpleBean) throws IOException, Exception { <add> private void testResolveArgumentWithValidation(SimpleBean simpleBean) throws Exception { <ide> MediaType contentType = MediaType.TEXT_PLAIN; <ide> servletRequest.addHeader("Content-Type", contentType.toString()); <ide> servletRequest.setContent("payload".getBytes(Charset.forName("UTF-8"))); <ide> public void resolveArgumentNoContentType() throws Exception { <ide> fail("Expected exception"); <ide> } <ide> catch (HttpMediaTypeNotSupportedException ex) { <add> // expected <ide> } <ide> } <ide> <ide> public void resolveArgumentRequiredNoContent() throws Exception { <ide> <ide> @Test <ide> public void resolveArgumentNotRequiredNoContent() throws Exception { <add> servletRequest.setContentType("text/plain"); <ide> servletRequest.setContent(new byte[0]); <add> given(messageConverter.canRead(String.class, MediaType.TEXT_PLAIN)).willReturn(true); <ide> assertNull(processor.resolveArgument(paramStringNotRequired, mavContainer, webRequest, new ValidatingBinderFactory())); <ide> } <ide> <ide> public void handleReturnValueMediaTypeSuffix() throws Exception { <ide> } <ide> <ide> <add> @SuppressWarnings("unused") <ide> @ResponseBody <ide> public String handle1(@RequestBody String s, int i) { <ide> return s; <ide> } <ide> <add> @SuppressWarnings("unused") <ide> public int handle2() { <ide> return 42; <ide> } <ide> <add> @SuppressWarnings("unused") <ide> @ResponseBody <ide> public String handle3() { <ide> return null; <ide> } <ide> <add> @SuppressWarnings("unused") <ide> public void handle4(@Valid @RequestBody SimpleBean b) { <ide> } <ide> <add> @SuppressWarnings("unused") <ide> public void handle5(@RequestBody(required=false) String s) { <ide> } <ide> <ide><path>spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/RequestResponseBodyMethodProcessorTests.java <ide> <ide> import java.io.Serializable; <ide> import java.lang.reflect.Method; <add>import java.lang.reflect.Type; <ide> import java.util.ArrayList; <ide> import java.util.Arrays; <ide> import java.util.List; <ide> import org.springframework.aop.framework.ProxyFactory; <ide> import org.springframework.aop.target.SingletonTargetSource; <ide> import org.springframework.core.MethodParameter; <add>import org.springframework.http.HttpInputMessage; <ide> import org.springframework.http.HttpStatus; <ide> import org.springframework.http.MediaType; <ide> import org.springframework.http.ResponseEntity; <ide> public void resolveArgumentClassString() throws Exception { <ide> assertEquals("foobarbaz", result); <ide> } <ide> <del> @Test(expected = HttpMessageNotReadableException.class) // SPR-9942 <add> // SPR-9942 <add> <add> @Test(expected = HttpMessageNotReadableException.class) <ide> public void resolveArgumentRequiredNoContent() throws Exception { <ide> this.servletRequest.setContent(new byte[0]); <ide> this.servletRequest.setContentType("text/plain"); <ide> public void resolveArgumentRequiredNoContent() throws Exception { <ide> processor.resolveArgument(paramString, mavContainer, webRequest, binderFactory); <ide> } <ide> <del> @Test // SPR-9964 <add> // SPR-12778 <add> <add> @Test <add> public void resolveArgumentRequiredNoContentDefaultValue() throws Exception { <add> this.servletRequest.setContent(new byte[0]); <add> this.servletRequest.setContentType("text/plain"); <add> List<HttpMessageConverter<?>> converters = Arrays.asList(new StringHttpMessageConverter()); <add> List<Object> advice = Arrays.asList(new EmptyRequestBodyAdvice()); <add> RequestResponseBodyMethodProcessor processor = new RequestResponseBodyMethodProcessor(converters, advice); <add> String arg = (String) processor.resolveArgument(paramString, mavContainer, webRequest, binderFactory); <add> assertNotNull(arg); <add> assertEquals("default value for empty body", arg); <add> } <add> <add> // SPR-9964 <add> <add> @Test <ide> public void resolveArgumentTypeVariable() throws Exception { <ide> Method method = MyParameterizedController.class.getMethod("handleDto", Identifiable.class); <ide> HandlerMethod handlerMethod = new HandlerMethod(new MySimpleParameterizedController(), method); <ide> public void resolveArgumentTypeVariable() throws Exception { <ide> assertEquals("Jad", result.getName()); <ide> } <ide> <del> @Test // SPR-11225 <add> // SPR-11225 <add> <add> @Test <ide> public void resolveArgumentTypeVariableWithNonGenericConverter() throws Exception { <ide> Method method = MyParameterizedController.class.getMethod("handleDto", Identifiable.class); <ide> HandlerMethod handlerMethod = new HandlerMethod(new MySimpleParameterizedController(), method); <ide> public void resolveArgumentTypeVariableWithNonGenericConverter() throws Exceptio <ide> assertEquals("Jad", result.getName()); <ide> } <ide> <del> @Test // SPR-9160 <add> // SPR-9160 <add> <add> @Test <ide> public void handleReturnValueSortByQuality() throws Exception { <ide> this.servletRequest.addHeader("Accept", "text/plain; q=0.5, application/json"); <ide> <ide> public void jacksonJsonViewWithResponseEntityAndXmlMessageConverter() throws Exc <ide> } <ide> <ide> <add> @SuppressWarnings("unused") <ide> public String handle( <ide> @RequestBody List<SimpleBean> list, <ide> @RequestBody SimpleBean simpleBean, <ide> public String handle( <ide> } <ide> <ide> <add> @SuppressWarnings("unused") <ide> private static abstract class MyParameterizedController<DTO extends Identifiable> { <ide> <ide> @SuppressWarnings("unused") <ide> public void handleDto(@RequestBody DTO dto) {} <ide> } <ide> <ide> <add> @SuppressWarnings("unused") <ide> private static class MySimpleParameterizedController extends MyParameterizedController<SimpleBean> { <ide> } <ide> <ide> public String handle() { <ide> } <ide> } <ide> <del> private interface MyJacksonView1 {}; <del> private interface MyJacksonView2 {}; <add> private interface MyJacksonView1 {} <add> private interface MyJacksonView2 {} <ide> <add> @SuppressWarnings("unused") <ide> private static class JacksonViewBean { <ide> <ide> @JsonView(MyJacksonView1.class) <ide> public ResponseEntity<JacksonViewBean> handleResponseEntity() { <ide> <ide> } <ide> <add> private static class EmptyRequestBodyAdvice implements RequestBodyAdvice { <add> <add> @Override <add> public boolean supports(MethodParameter methodParameter, Type targetType, <add> Class<? extends HttpMessageConverter<?>> converterType) { <add> <add> return StringHttpMessageConverter.class.equals(converterType); <add> } <add> <add> @Override <add> public Object handleEmptyBody(Object body, HttpInputMessage inputMessage, MethodParameter parameter, <add> Type targetType, Class<? extends HttpMessageConverter<?>> converterType) { <add> <add> return "default value for empty body"; <add> } <add> <add> @Override <add> public HttpInputMessage beforeBodyRead(HttpInputMessage inputMessage, MethodParameter parameter, <add> Type targetType, Class<? extends HttpMessageConverter<?>> converterType) { <add> <add> return inputMessage; <add> } <add> <add> @Override <add> public Object afterBodyRead(Object body, HttpInputMessage inputMessage, MethodParameter parameter, <add> Type targetType, Class<? extends HttpMessageConverter<?>> converterType) { <add> <add> return body; <add> } <add> } <add> <ide> }
9
Text
Text
add "input" class_mode to the docs.
5728b390625a7d522555e3b0009560996abbffcf
<ide><path>docs/templates/preprocessing/image.md <ide> Generate batches of tensor image data with real-time data augmentation. The data <ide> The dimensions to which all images found will be resized. <ide> - __color_mode__: one of "grayscale", "rbg". Default: "rgb". Whether the images will be converted to have 1 or 3 color channels. <ide> - __classes__: optional list of class subdirectories (e.g. `['dogs', 'cats']`). Default: None. If not provided, the list of classes will be automatically inferred from the subdirectory names/structure under `directory`, where each subdirectory will be treated as a different class (and the order of the classes, which will map to the label indices, will be alphanumeric). The dictionary containing the mapping from class names to class indices can be obtained via the attribute `class_indices`. <del> - __class_mode__: one of "categorical", "binary", "sparse" or None. Default: "categorical". Determines the type of label arrays that are returned: "categorical" will be 2D one-hot encoded labels, "binary" will be 1D binary labels, "sparse" will be 1D integer labels. If None, no labels are returned (the generator will only yield batches of image data, which is useful to use `model.predict_generator()`, `model.evaluate_generator()`, etc.). Please note that in case of class_mode None, the data still needs to reside in a subdirectory of `directory` for it to work correctly. <add> - __class_mode__: one of "categorical", "binary", "sparse", "input" or None. Default: "categorical". Determines the type of label arrays that are returned: "categorical" will be 2D one-hot encoded labels, "binary" will be 1D binary labels, "sparse" will be 1D integer labels, "input" will be images identical to input images (mainly used to work with autoencoders). If None, no labels are returned (the generator will only yield batches of image data, which is useful to use `model.predict_generator()`, `model.evaluate_generator()`, etc.). Please note that in case of class_mode None, the data still needs to reside in a subdirectory of `directory` for it to work correctly. <ide> - __batch_size__: size of the batches of data (default: 32). <ide> - __shuffle__: whether to shuffle the data (default: True) <ide> - __seed__: optional random seed for shuffling and transformations.
1
Python
Python
add regression test for #717
17018750ac3ea39c4fe5a96c05db2375ecd4973e
<ide><path>spacy/tests/regression/test_issue717.py <add># coding: utf8 <add>from __future__ import unicode_literals <add> <add>import pytest <add> <add> <add>@pytest.mark.xfail <add>@pytest.mark.models <add>@pytest.mark.parametrize('text1,text2', [("You're happy", "You are happy")]) <add>def test_issue717(EN, text1, text2): <add> """Test that contractions are assigned the correct lemma.""" <add> doc1 = EN(text1) <add> doc2 = EN(text2) <add> assert doc1[1].lemma_ == doc2[1].lemma_ <add> assert doc1[1].lemma == doc2[1].lemma
1
Go
Go
fix docker run on an unknown image
0bb2c0b1d0f651e23c949381762fe79a45c58aeb
<ide><path>commands.go <ide> func (cli *DockerCli) CmdRun(args ...string) error { <ide> if body, _, err = cli.call("POST", "/containers/create?"+containerValues.Encode(), config); err != nil { <ide> return err <ide> } <del> } <del> if err != nil { <add> } else if err != nil { <ide> return err <ide> } <ide>
1
Javascript
Javascript
add size info to print-cache-file tooling
267662e4fb82425b0196e17c1b4fca1871238063
<ide><path>tooling/print-cache-file.js <ide> const serializer = new Serializer([ <ide> new FileMiddleware(fs) <ide> ]); <ide> <add>const rawSerializer = new Serializer([new FileMiddleware(fs)]); <add> <add>const lazySizes = []; <add> <add>const captureSize = async data => { <add> let size = 0; <add> let lazySize = 0; <add> for (const b of data) { <add> if (Buffer.isBuffer(b)) { <add> size += b.length; <add> } else if (typeof b === "function") { <add> const i = lazySizes.length; <add> lazySizes.push(undefined); <add> const r = await captureSize(await b()); <add> lazySize += r.size + r.lazySize; <add> // eslint-disable-next-line require-atomic-updates <add> lazySizes[i] = r; <add> } <add> } <add> return { size, lazySize }; <add>}; <add> <ide> const ESCAPE = null; <ide> const ESCAPE_ESCAPE_VALUE = null; <ide> const ESCAPE_END_OBJECT = true; <ide> const printData = async (data, indent) => { <ide> for (const b of data) { <ide> if (typeof b === "function") { <ide> const innerData = await b(); <del> console.log(`${indent}= lazy {`); <add> const info = lazySizes.shift(); <add> const sizeInfo = `${(info.size / 1048576).toFixed(2)} MiB + ${( <add> info.lazySize / 1048576 <add> ).toFixed(2)} lazy MiB`; <add> console.log(`${indent}= lazy ${sizeInfo} {`); <ide> await printData(innerData, indent + " "); <ide> console.log(`${indent}}`); <ide> } else { <ide> const printData = async (data, indent) => { <ide> } <ide> return; <ide> } <add> const referencedValues = new Map(); <add> const referencedTypes = new Map(); <ide> let currentReference = 0; <ide> let currentTypeReference = 0; <ide> let i = 0; <ide> const printData = async (data, indent) => { <ide> indent = indent.slice(0, indent.length - 2); <ide> printLine(`} = #${currentReference++}`); <ide> } else if (typeof nextItem === "number" && nextItem < 0) { <del> printLine(`Reference ${nextItem} => #${currentReference + nextItem}`); <add> const ref = currentReference + nextItem; <add> const value = referencedValues.get(ref); <add> if (value) { <add> printLine( <add> `Reference ${nextItem} => ${JSON.stringify(value)} #${ref}` <add> ); <add> } else { <add> printLine(`Reference ${nextItem} => #${ref}`); <add> } <ide> } else { <ide> const request = nextItem; <ide> if (typeof request === "number") { <add> const ref = currentTypeReference - request; <ide> printLine( <del> `Object (Reference ${request} => @${currentTypeReference - <del> request}) {` <add> `Object (Reference ${request} => ${referencedTypes.get( <add> ref <add> )} @${ref}) {` <ide> ); <ide> } else { <ide> const name = read(); <add> referencedTypes.set(currentTypeReference, `${request} / ${name}`); <ide> printLine( <ide> `Object (${request} / ${name} @${currentTypeReference++}) {` <ide> ); <ide> const printData = async (data, indent) => { <ide> } <ide> } else if (typeof item === "string") { <ide> if (item !== "") { <add> referencedValues.set(currentReference, item); <ide> printLine(`${JSON.stringify(item)} = #${currentReference++}`); <ide> } else { <ide> printLine('""'); <ide> const printData = async (data, indent) => { <ide> printLine(`buffer ${item.toString("hex")} = #${currentReference++}`); <ide> } else if (typeof item === "function") { <ide> const innerData = await item(); <del> printLine(`lazy {`); <add> const info = lazySizes.shift(); <add> const sizeInfo = `${(info.size / 1048576).toFixed(2)} MiB + ${( <add> info.lazySize / 1048576 <add> ).toFixed(2)} lazy MiB`; <add> printLine(`lazy ${sizeInfo} {`); <ide> await printData(innerData, indent + " "); <ide> printLine(`}`); <ide> } else { <ide> const printData = async (data, indent) => { <ide> <ide> const filename = process.argv[2]; <ide> <del>console.log(`Printing content of ${filename}`); <add>(async () => { <add> const structure = await rawSerializer.deserialize({ <add> filename: path.resolve(filename) <add> }); <add> const info = await captureSize(structure); <add> const sizeInfo = `${(info.size / 1048576).toFixed(2)} MiB + ${( <add> info.lazySize / 1048576 <add> ).toFixed(2)} lazy MiB`; <add> console.log(`${filename} ${sizeInfo}:`); <ide> <del>serializer <del> .deserialize({ filename: path.resolve(filename) }) <del> .then(data => printData(data, "")); <add> const data = await serializer.deserialize({ <add> filename: path.resolve(filename) <add> }); <add> await printData(data, ""); <add>})();
1
PHP
PHP
apply fixes from styleci
3538cbdd704b3e816aa3b2087c4ceec63e91e82b
<ide><path>src/Illuminate/Database/Eloquent/FactoryBuilder.php <ide> protected function callAfter(array $afterCallbacks, $models) <ide> */ <ide> protected function callAfterCallbacks(array $afterCallbacks, $model, $state) <ide> { <del> if (!isset($afterCallbacks[$this->class][$state])) { <add> if (! isset($afterCallbacks[$this->class][$state])) { <ide> return; <ide> } <ide> <ide><path>tests/Integration/Database/EloquentFactoryBuilderTest.php <ide> protected function getEnvironmentSetUp($app) <ide> ]; <ide> }); <ide> <del> $factory->afterCreatingState(FactoryBuildableUser::class, 'with_callable_server', function(FactoryBuildableUser $user, Generator $faker){ <add> $factory->afterCreatingState(FactoryBuildableUser::class, 'with_callable_server', function (FactoryBuildableUser $user, Generator $faker) { <ide> $server = factory(FactoryBuildableServer::class) <ide> ->states('callable') <ide> ->create(['user_id' => $user->id]);
2
Javascript
Javascript
fix closure compile warnings
943377a091bd7521d33e680dcd2141f7f9fa10c4
<ide><path>src/sanitizer.js <ide> var htmlParser = function( html, handler ) { <ide> <ide> /** <ide> * @param str 'key1,key2,...' <del> * @returns {key1:true, key2:true, ...} <add> * @returns {object} in the form of {key1:true, key2:true, ...} <ide> */ <ide> function makeMap(str){ <ide> var obj = {}, items = str.split(","), i; <ide> function isJavaScriptUrl(url) { <ide> /** <ide> * create an HTML/XML writer which writes to buffer <ide> * @param {Array} buf use buf.jain('') to get out sanitized html string <del> * @returns { <add> * @returns {object} in the form of { <ide> * start: function(tag, attrs, unary) {}, <ide> * end: function(tag) {}, <ide> * chars: function(text) {},
1
Ruby
Ruby
add strict check for <formula spacing
716da2dfbd46b65a8299c9ece783ec423a462d3e
<ide><path>Library/Homebrew/cmd/audit.rb <ide> def ff <ide> def audit_formula_text name, text <ide> problems = [] <ide> <add> if text =~ /<Formula/ <add> problems << " * We now space class inheritance: class Foo < Formula" <add> end if strict? <add> <ide> # Commented-out cmake support from default template <ide> if (text =~ /# depends_on 'cmake'/) or (text =~ /# system "cmake/) <ide> problems << " * Commented cmake support found." <ide> def audit_formula_urls f <ide> <ide> unless p =~ %r[^http://mirrors\.kernel\.org/debian/pool/] <ide> problems << " * \"mirrors.kernel.org\" is the preferred mirror for debian software." <del> end if strict? <del> end <add> end <add> end if strict? <ide> <ide> return problems <ide> end
1
Ruby
Ruby
use new hash syntax for generators gem method
fe7038eac8c1a4df57a0aacf4dd77da5ef87f6df
<ide><path>railties/lib/rails/generators/actions.rb <ide> def gem(*args) <ide> log :gemfile, message <ide> <ide> options.each do |option, value| <del> parts << ":#{option} => #{value.inspect}" <add> parts << "#{option}: #{value.inspect}" <ide> end <ide> <ide> in_root do <ide><path>railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb <ide> def gemfile_entry <ide> <ide> gemfile_in_app_path = File.join(rails_app_path, "Gemfile") <ide> if File.exist? gemfile_in_app_path <del> entry = "gem '#{name}', :path => '#{relative_path}'" <add> entry = "gem '#{name}', path: '#{relative_path}'" <ide> append_file gemfile_in_app_path, entry <ide> end <ide> end <ide><path>railties/test/generators/actions_test.rb <ide> def test_gem_should_insert_on_separate_lines <ide> assert_file 'Gemfile', /^gem "rspec-rails"$/ <ide> end <ide> <add> def test_gem_should_include_options <add> run_generator <add> <add> action :gem, 'rspec', github: 'dchelimsky/rspec', tag: '1.2.9.rc1' <add> <add> assert_file 'Gemfile', /gem "rspec", github: "dchelimsky\/rspec", tag: "1\.2\.9\.rc1"/ <add> end <add> <ide> def test_gem_group_should_wrap_gems_in_a_group <ide> run_generator <ide> <ide><path>railties/test/generators/plugin_new_generator_test.rb <ide> def test_creating_plugin_in_app_directory_adds_gemfile_entry <ide> <ide> run_generator [destination_root] <ide> <del> assert_file gemfile_path, /gem 'bukkits', :path => 'tmp\/bukkits'/ <add> assert_file gemfile_path, /gem 'bukkits', path: 'tmp\/bukkits'/ <ide> ensure <ide> Object.send(:remove_const, 'APP_PATH') <ide> FileUtils.rm gemfile_path <ide> def test_skipping_gemfile_entry <ide> run_generator [destination_root, "--skip-gemfile-entry"] <ide> <ide> assert_file gemfile_path do |contents| <del> assert_no_match(/gem 'bukkits', :path => 'tmp\/bukkits'/, contents) <add> assert_no_match(/gem 'bukkits', path: 'tmp\/bukkits'/, contents) <ide> end <ide> ensure <ide> Object.send(:remove_const, 'APP_PATH')
4
Text
Text
add jdalton to collaborators
bb6b605d47896f2b1bcf146c16842a231b4f8a9b
<ide><path>README.md <ide> For more information about the governance of the Node.js project, see <ide> **Jason Ginchereau** &lt;[email protected]&gt; <ide> * [jbergstroem](https://github.com/jbergstroem) - <ide> **Johan Bergström** &lt;[email protected]&gt; <add>* [jdalton](https://github.com/jdalton) - <add>**John-David Dalton** &lt;[email protected]&gt; <ide> * [jhamhader](https://github.com/jhamhader) - <ide> **Yuval Brik** &lt;[email protected]&gt; <ide> * [jkrems](https://github.com/jkrems) -
1
Python
Python
allow softplacement for resnet
d93ffd0b69253ee3c3a40a19a4c86ac6975bd570
<ide><path>resnet/resnet_main.py <ide> def train(hps): <ide> save_summaries_secs=60, <ide> save_model_secs=300, <ide> global_step=model.global_step) <del> sess = sv.prepare_or_wait_for_session() <add> sess = sv.prepare_or_wait_for_session( <add> config=tf.ConfigProto(allow_soft_placement=True)) <ide> <ide> step = 0 <ide> lrn_rate = 0.1
1
Javascript
Javascript
fix exceptional case for russian month parsing
3928b2e0b8421c4dbc005a30610dc53f59f73a97
<ide><path>lang/ru.js <ide> weekdays : weekdaysCaseReplace, <ide> weekdaysShort : "вск_пнд_втр_срд_чтв_птн_сбт".split("_"), <ide> weekdaysMin : "вс_пн_вт_ср_чт_пт_сб".split("_"), <add> monthsParse : [/^янв/i, /^фев/i, /^мар/i, /^апр/i, /^ма[й|я]/i, /^июн/i, /^июл/i, /^авг/i, /^сен/i, /^окт/i, /^ноя/i, /^дек/i], <ide> longDateFormat : { <ide> LT : "HH:mm", <ide> L : "DD.MM.YYYY", <ide><path>test/lang/ru.js <ide> exports["lang:ru"] = { <ide> test.done(); <ide> }, <ide> <add> "parse exceptional case" : function (test) { <add> test.equal(moment('11 мая 1989', ['DD MMMM YYYY']).format('DD-MM-YYYY'), '11-05-1989'); <add> test.done(); <add> }, <add> <ide> "format" : function (test) { <ide> test.expect(22); <ide>
2
Text
Text
use gfm footnotes in building.md
3577f6dc485c3bb4a2e05cf61eb9417aac6534a3
<ide><path>BUILDING.md <ide> Node.js does not support a platform version if a vendor has expired support <ide> for it. In other words, Node.js does not support running on End-of-Life (EoL) <ide> platforms. This is true regardless of entries in the table below. <ide> <del>| Operating System | Architectures | Versions | Support Type | Notes | <del>| ---------------- | ---------------- | ------------------------------- | ---------------------------------------------------------------- | --------------------------------------------------------------------------- | <del>| GNU/Linux | x64 | kernel >= 3.10, glibc >= 2.17 | Tier 1 | e.g. Ubuntu 16.04 <sup>[1](#fn1)</sup>, Debian 9, EL 7 <sup>[2](#fn2)</sup> | <del>| GNU/Linux | x64 | kernel >= 3.10, musl >= 1.1.19 | Experimental | e.g. Alpine 3.8 | <del>| GNU/Linux | x86 | kernel >= 3.10, glibc >= 2.17 | Experimental | Downgraded as of Node.js 10 | <del>| GNU/Linux | arm64 | kernel >= 4.5, glibc >= 2.17 | Tier 1 | e.g. Ubuntu 16.04, Debian 9, EL 7 <sup>[3](#fn3)</sup> | <del>| GNU/Linux | armv7 | kernel >= 4.14, glibc >= 2.24 | Tier 1 | e.g. Ubuntu 18.04, Debian 9 | <del>| GNU/Linux | armv6 | kernel >= 4.14, glibc >= 2.24 | Experimental | Downgraded as of Node.js 12 | <del>| GNU/Linux | ppc64le >=power8 | kernel >= 3.10.0, glibc >= 2.17 | Tier 2 | e.g. Ubuntu 16.04 <sup>[1](#fn1)</sup>, EL 7 <sup>[2](#fn2)</sup> | <del>| GNU/Linux | s390x | kernel >= 3.10.0, glibc >= 2.17 | Tier 2 | e.g. EL 7 <sup>[2](#fn2)</sup> | <del>| Windows | x64, x86 (WoW64) | >= Windows 8.1/2012 R2 | Tier 1 | <sup>[4](#fn4),[5](#fn5)</sup> | <del>| Windows | x86 (native) | >= Windows 8.1/2012 R2 | Tier 1 (running) / Experimental (compiling) <sup>[6](#fn6)</sup> | | <del>| Windows | x64, x86 | Windows Server 2012 (not R2) | Experimental | | <del>| Windows | arm64 | >= Windows 10 | Tier 2 (compiling) / Experimental (running) | | <del>| macOS | x64 | >= 10.13 | Tier 1 | For notes about compilation see <sup>[7](#fn7)</sup> | <del>| macOS | arm64 | >= 11 | Tier 1 | | <del>| SmartOS | x64 | >= 18 | Tier 2 | | <del>| AIX | ppc64be >=power7 | >= 7.2 TL04 | Tier 2 | | <del>| FreeBSD | x64 | >= 12.2 | Experimental | | <del> <del><em id="fn1">1</em>: GCC 8 is not provided on the base platform. Users will <del>need the <del>[Toolchain test builds PPA](https://launchpad.net/\~ubuntu-toolchain-r/+archive/ubuntu/test?field.series\_filter=xenial) <del>or similar to source a newer compiler. <del> <del><em id="fn2">2</em>: GCC 8 is not provided on the base platform. Users will <del>need the <del>[devtoolset-8](https://www.softwarecollections.org/en/scls/rhscl/devtoolset-8/) <del>or later to source a newer compiler. <del> <del><em id="fn3">3</em>: Older kernel versions may work for ARM64. However the <del>Node.js test infrastructure only tests >= 4.5. <del> <del><em id="fn4">4</em>: On Windows, running Node.js in Windows terminal emulators <del>like `mintty` requires the usage of [winpty](https://github.com/rprichard/winpty) <del>for the tty channels to work (e.g. `winpty node.exe script.js`). <del>In "Git bash" if you call the node shell alias (`node` without the `.exe` <del>extension), `winpty` is used automatically. <del> <del><em id="fn5">5</em>: The Windows Subsystem for Linux (WSL) is not <del>supported, but the GNU/Linux build process and binaries should work. The <del>community will only address issues that reproduce on native GNU/Linux <del>systems. Issues that only reproduce on WSL should be reported in the <del>[WSL issue tracker](https://github.com/Microsoft/WSL/issues). Running the <del>Windows binary (`node.exe`) in WSL is not recommended. It will not work <del>without workarounds such as stdio redirection. <del> <del><em id="fn6">6</em>: Running Node.js on x86 Windows should work and binaries <del>are provided. However, tests in our infrastructure only run on WoW64. <del>Furthermore, compiling on x86 Windows is Experimental and <del>may not be possible. <del> <del><em id="fn7">7</em>: Our macOS x64 Binaries are compiled with 10.13 as a target. <del>However there is no guarantee compiling on 10.13 will work as Xcode11 is <del>required to compile. <add>| Operating System | Architectures | Versions | Support Type | Notes | <add>| ---------------- | ---------------- | ------------------------------- | ----------------------------------------------- | ----------------------------------------- | <add>| GNU/Linux | x64 | kernel >= 3.10, glibc >= 2.17 | Tier 1 | e.g. Ubuntu 16.04[^1], Debian 9, EL 7[^2] | <add>| GNU/Linux | x64 | kernel >= 3.10, musl >= 1.1.19 | Experimental | e.g. Alpine 3.8 | <add>| GNU/Linux | x86 | kernel >= 3.10, glibc >= 2.17 | Experimental | Downgraded as of Node.js 10 | <add>| GNU/Linux | arm64 | kernel >= 4.5, glibc >= 2.17 | Tier 1 | e.g. Ubuntu 16.04, Debian 9, EL 7[^3] | <add>| GNU/Linux | armv7 | kernel >= 4.14, glibc >= 2.24 | Tier 1 | e.g. Ubuntu 18.04, Debian 9 | <add>| GNU/Linux | armv6 | kernel >= 4.14, glibc >= 2.24 | Experimental | Downgraded as of Node.js 12 | <add>| GNU/Linux | ppc64le >=power8 | kernel >= 3.10.0, glibc >= 2.17 | Tier 2 | e.g. Ubuntu 16.04[^1], EL 7[^2] | <add>| GNU/Linux | s390x | kernel >= 3.10.0, glibc >= 2.17 | Tier 2 | e.g. EL 7[^2] | <add>| Windows | x64, x86 (WoW64) | >= Windows 8.1/2012 R2 | Tier 1 | [^4],[^5] | <add>| Windows | x86 (native) | >= Windows 8.1/2012 R2 | Tier 1 (running) / Experimental (compiling)[^6] | | <add>| Windows | x64, x86 | Windows Server 2012 (not R2) | Experimental | | <add>| Windows | arm64 | >= Windows 10 | Tier 2 (compiling) / Experimental (running) | | <add>| macOS | x64 | >= 10.13 | Tier 1 | For notes about compilation see [^7] | <add>| macOS | arm64 | >= 11 | Tier 1 | | <add>| SmartOS | x64 | >= 18 | Tier 2 | | <add>| AIX | ppc64be >=power7 | >= 7.2 TL04 | Tier 2 | | <add>| FreeBSD | x64 | >= 12.2 | Experimental | | <add> <add>[^1]: GCC 8 is not provided on the base platform. Users will <add> need the <add> [Toolchain test builds PPA](https://launchpad.net/\~ubuntu-toolchain-r/+archive/ubuntu/test?field.series\_filter=xenial) <add> or similar to source a newer compiler. <add> <add>[^2]: GCC 8 is not provided on the base platform. Users will <add> need the <add> [devtoolset-8](https://www.softwarecollections.org/en/scls/rhscl/devtoolset-8/) <add> or later to source a newer compiler. <add> <add>[^3]: Older kernel versions may work for ARM64. However the <add> Node.js test infrastructure only tests >= 4.5. <add> <add>[^4]: On Windows, running Node.js in Windows terminal emulators <add> like `mintty` requires the usage of [winpty](https://github.com/rprichard/winpty) <add> for the tty channels to work (e.g. `winpty node.exe script.js`). <add> In "Git bash" if you call the node shell alias (`node` without the `.exe` <add> extension), `winpty` is used automatically. <add> <add>[^5]: The Windows Subsystem for Linux (WSL) is not <add> supported, but the GNU/Linux build process and binaries should work. The <add> community will only address issues that reproduce on native GNU/Linux <add> systems. Issues that only reproduce on WSL should be reported in the <add> [WSL issue tracker](https://github.com/Microsoft/WSL/issues). Running the <add> Windows binary (`node.exe`) in WSL is not recommended. It will not work <add> without workarounds such as stdio redirection. <add> <add>[^6]: Running Node.js on x86 Windows should work and binaries <add> are provided. However, tests in our infrastructure only run on WoW64. <add> Furthermore, compiling on x86 Windows is Experimental and <add> may not be possible. <add> <add>[^7]: Our macOS x64 Binaries are compiled with 10.13 as a target. <add> However there is no guarantee compiling on 10.13 will work as Xcode11 is <add> required to compile. <ide> <ide> ### Supported toolchains <ide> <ide> Binaries at <https://nodejs.org/download/release/> are produced on: <ide> | aix-ppc64 | AIX 7.2 TL04 on PPC64BE with GCC 8 | <ide> | darwin-x64 | macOS 10.15, Xcode Command Line Tools 11 with -mmacosx-version-min=10.13 | <ide> | darwin-arm64 (and .pkg) | macOS 11 (arm64), Xcode Command Line Tools 12 with -mmacosx-version-min=10.13 | <del>| linux-arm64 | CentOS 7 with devtoolset-8 / GCC 8 <sup>[8](#fn8)</sup> | <add>| linux-arm64 | CentOS 7 with devtoolset-8 / GCC 8[^8] | <ide> | linux-armv7l | Cross-compiled on Ubuntu 18.04 x64 with [custom GCC toolchain](https://github.com/rvagg/rpi-newer-crosstools) | <del>| linux-ppc64le | CentOS 7 with devtoolset-8 / GCC 8 <sup>[8](#fn8)</sup> | <del>| linux-s390x | RHEL 7 with devtoolset-8 / GCC 8 <sup>[8](#fn8)</sup> | <del>| linux-x64 | CentOS 7 with devtoolset-8 / GCC 8 <sup>[8](#fn8)</sup> | <add>| linux-ppc64le | CentOS 7 with devtoolset-8 / GCC 8[^8] | <add>| linux-s390x | RHEL 7 with devtoolset-8 / GCC 8[^8] | <add>| linux-x64 | CentOS 7 with devtoolset-8 / GCC 8[^8] | <ide> | win-x64 and win-x86 | Windows 2012 R2 (x64) with Visual Studio 2019 | <ide> <del><em id="fn8">8</em>: The Enterprise Linux devtoolset-8 allows us to compile <del>binaries with GCC 8 but linked to the glibc and libstdc++ versions of the host <del>platforms (CentOS 7 / RHEL 7). Therefore, binaries produced on these systems <del>are compatible with glibc >= 2.17 and libstdc++ >= 6.0.20 (`GLIBCXX_3.4.20`). <del>These are available on distributions natively supporting GCC 4.9, such as <del>Ubuntu 14.04 and Debian 8. <add>[^8]: The Enterprise Linux devtoolset-8 allows us to compile binaries with GCC 8 <add> but linked to the glibc and libstdc++ versions of the host platforms <add> (CentOS 7 / RHEL 7). Therefore, binaries produced on these systems are <add> compatible with glibc >= 2.17 and libstdc++ >= 6.0.20 (`GLIBCXX_3.4.20`). <add> These are available on distributions natively supporting GCC 4.9, such as <add> Ubuntu 14.04 and Debian 8. <ide> <ide> #### OpenSSL asm support <ide> <ide> dynamically linking with OpenSSL 3.0.0 by using the configuration flag <ide> ### FIPS support when statically linking OpenSSL <ide> <ide> FIPS can be supported by specifying the configuration flag `--openssl-is-fips`: <add> <ide> ```console <ide> $ ./configure --openssl-is-fips <ide> $ make -j8 <ide> to include the correct path to fipsmodule.cnf and finally uncomment the fips <ide> section. <ide> <ide> We can then run node specifying `--enable-fips`: <add> <ide> ```console <ide> $ ./node --enable-fips -p 'crypto.getFips()' <ide> 1 <ide> ``` <add> <ide> The above will use the Node.js default locations for OpenSSL 3.0: <add> <ide> ```console <ide> $ ./out/Release/openssl-cli version -m -d <ide> OPENSSLDIR: "/nodejs/openssl/out/Release/obj.target/deps/openssl" <ide> MODULESDIR: "/nodejs/openssl/out/Release/obj.target/deps/openssl/lib/openssl-modules" <ide> ``` <add> <ide> The OpenSSL configuration files will be found in `OPENSSLDIR` directory above: <add> <ide> ```console <ide> $ ls -w 1 out/Release/obj.target/deps/openssl/*.cnf <ide> out/Release/obj.target/deps/openssl/fipsmodule.cnf <ide> out/Release/obj.target/deps/openssl/openssl.cnf <ide> ``` <add> <ide> And the FIPS module will be located in the `MODULESDIR` directory: <add> <ide> ```console <ide> $ ls out/Release/obj.target/deps/openssl/lib/openssl-modules/ <ide> fips.so
1
Text
Text
remove non-existant methods from docs
0e964a7e6fe86de47de4ca21f464c47eaac256a8
<ide><path>doc/api/console.md <ide> The following methods are exposed by the V8 engine in the general API but do <ide> not display anything unless used in conjunction with the [inspector][] <ide> (`--inspect` flag). <ide> <del>### console.markTimeline(\[label\]) <del><!-- YAML <del>added: v8.0.0 <del>--> <del> <del>* `label` {string} **Default:** `'default'` <del> <del>This method does not display anything unless used in the inspector. The <del>`console.markTimeline()` method is the deprecated form of <del>[`console.timeStamp()`][]. <del> <ide> ### console.profile(\[label\]) <ide> <!-- YAML <ide> added: v8.0.0 <ide> This method does not display anything unless used in the inspector. The <ide> `console.timeStamp()` method adds an event with the label `'label'` to the <ide> **Timeline** panel of the inspector. <ide> <del>### console.timeline(\[label\]) <del><!-- YAML <del>added: v8.0.0 <del>--> <del> <del>* `label` {string} **Default:** `'default'` <del> <del>This method does not display anything unless used in the inspector. The <del>`console.timeline()` method is the deprecated form of [`console.time()`][]. <del> <del>### console.timelineEnd(\[label\]) <del><!-- YAML <del>added: v8.0.0 <del>--> <del> <del>* `label` {string} **Default:** `'default'` <del> <del>This method does not display anything unless used in the inspector. The <del>`console.timelineEnd()` method is the deprecated form of <del>[`console.timeEnd()`][]. <del> <ide> [`console.error()`]: #console_console_error_data_args <ide> [`console.group()`]: #console_console_group_label <ide> [`console.log()`]: #console_console_log_data_args <ide> [`console.profile()`]: #console_console_profile_label <ide> [`console.profileEnd()`]: #console_console_profileend_label <ide> [`console.time()`]: #console_console_time_label <ide> [`console.timeEnd()`]: #console_console_timeend_label <del>[`console.timeStamp()`]: #console_console_timestamp_label <ide> [`process.stderr`]: process.html#process_process_stderr <ide> [`process.stdout`]: process.html#process_process_stdout <ide> [`util.format()`]: util.html#util_util_format_format_args
1
Mixed
Go
add the swapmemorysupport requirement to oom tests
adabb51311ecac031bd72378c5ed1669d1835d40
<ide><path>integration-cli/docker_cli_oom_killed_test.go <ide> import ( <ide> ) <ide> <ide> func (s *DockerSuite) TestInspectOomKilledTrue(c *check.C) { <del> testRequires(c, DaemonIsLinux, memoryLimitSupport) <add> testRequires(c, DaemonIsLinux, memoryLimitSupport, swapMemorySupport) <ide> <ide> name := "testoomkilled" <ide> _, exitCode, _ := dockerCmdWithError("run", "--name", name, "--memory", "32MB", "busybox", "sh", "-c", "x=a; while true; do x=$x$x$x$x; done") <ide> func (s *DockerSuite) TestInspectOomKilledTrue(c *check.C) { <ide> } <ide> <ide> func (s *DockerSuite) TestInspectOomKilledFalse(c *check.C) { <del> testRequires(c, DaemonIsLinux, memoryLimitSupport) <add> testRequires(c, DaemonIsLinux, memoryLimitSupport, swapMemorySupport) <ide> <ide> name := "testoomkilled" <ide> dockerCmd(c, "run", "--name", name, "--memory", "32MB", "busybox", "sh", "-c", "echo hello world") <ide><path>integration-cli/docker_cli_run_unix_test.go <ide> func (s *DockerSuite) TestRunWithInvalidPathforBlkioDeviceWriteIOps(c *check.C) <ide> } <ide> <ide> func (s *DockerSuite) TestRunOOMExitCode(c *check.C) { <del> testRequires(c, oomControl) <add> testRequires(c, memoryLimitSupport, swapMemorySupport) <ide> errChan := make(chan error) <ide> go func() { <ide> defer close(errChan) <ide><path>man/docker-run.1.md <ide> as memory limit. <ide> **--memory-swap**="LIMIT" <ide> A limit value equal to memory plus swap. Must be used with the **-m** <ide> (**--memory**) flag. The swap `LIMIT` should always be larger than **-m** <del>(**--memory**) value. <add>(**--memory**) value. By default, the swap `LIMIT` will be set to double <add>the value of --memory. <ide> <ide> The format of `LIMIT` is `<number>[<unit>]`. Unit can be `b` (bytes), <ide> `k` (kilobytes), `m` (megabytes), or `g` (gigabytes). If you don't specify a
3
Ruby
Ruby
add comment to superenv env to note trailing if
71a4b8c6b976c68bc1a1b4c6d3100d521c840535
<ide><path>Library/Homebrew/superenv.rb <ide> def superenv? <ide> false <ide> end <ide> <add># Note that this block is guarded with `if superenv?` <ide> class << ENV <ide> attr_accessor :keg_only_deps, :deps, :x11 <ide> alias_method :x11?, :x11
1
Ruby
Ruby
simplify each method
82d81bbfcb4d0d895e9ba059f33a3495879bc660
<ide><path>activerecord/lib/active_record/associations/join_dependency/join_part.rb <ide> def parents <ide> parents <ide> end <ide> <del> def each <add> def each(&block) <ide> yield self <del> iter = lambda { |list| <del> list.each { |item| <del> yield item <del> iter.call item.children <del> } <del> } <del> iter.call children <add> children.each { |child| child.each(&block) } <ide> end <ide> <ide> def aliased_table
1
Java
Java
revise documentation for testsocketutils
542b6427c3b4682ab25e829756ae72c4d49e662f
<ide><path>spring-core/src/testFixtures/java/org/springframework/core/testfixture/net/TestSocketUtils.java <ide> <ide> package org.springframework.core.testfixture.net; <ide> <del>import java.net.DatagramSocket; <ide> import java.net.InetAddress; <ide> import java.net.ServerSocket; <ide> import java.util.Random; <ide> import org.springframework.util.Assert; <ide> <ide> /** <del> * Removed from spring-core and introduced as an internal test utility in <del> * spring-context in Spring Framework 6.0. <add> * Simple utility methods for finding available ports on {@code localhost} for <add> * use in integration testing scenarios. <ide> * <del> * <p>Simple utility methods for working with network sockets &mdash; for example, <del> * for finding available ports on {@code localhost}. <del> * <del> * <p>Within this class, a TCP port refers to a port for a {@link ServerSocket}; <del> * whereas, a UDP port refers to a port for a {@link DatagramSocket}. <add> * <p>{@code SocketUtils} was removed from the public API in {@code spring-core} <add> * in Spring Framework 6.0 and reintroduced as {@code TestSocketUtils}, which is <add> * made available to all tests in Spring Framework's test suite as a Gradle <add> * <em>test fixture</em>. <ide> * <ide> * <p>{@code SocketUtils} was introduced in Spring Framework 4.0, primarily to <ide> * assist in writing integration tests which start an external server on an <ide> * available random port. However, these utilities make no guarantee about the <ide> * subsequent availability of a given port and are therefore unreliable. Instead <del> * of using {@code SocketUtils} to find an available local port for a server, it <del> * is recommended that you rely on a server's ability to start on a random port <add> * of using {@code TestSocketUtils} to find an available local port for a server, <add> * it is recommended that you rely on a server's ability to start on a random port <ide> * that it selects or is assigned by the operating system. To interact with that <ide> * server, you should query the server for the port it is currently using. <ide> *
1
PHP
PHP
fix bug in eloquent model
43212f8505421935938aa28d421b02b8ffe9f081
<ide><path>laravel/database/eloquent/model.php <ide> final public function sync() <ide> */ <ide> public function changed($attribute) <ide> { <del> array_get($this->attributes, $attribute) !== array_get($this->original, $attribute); <add> return array_get($this->attributes, $attribute) !== array_get($this->original, $attribute); <ide> } <ide> <ide> /**
1
Go
Go
create generic backend to cut dependency on daemon
5087977fc1a4279be55f25e0b8782c9cf9bc65f3
<ide><path>api/server/router/network/backend.go <add>package network <add> <add>import ( <add> // TODO: network config needs to be refactored out to a <add> // different location <add> "github.com/docker/docker/daemon/network" <add> <add> "github.com/docker/libnetwork" <add>) <add> <add>// Backend is all the methods that need to be implemented to provide <add>// network specific functionality <add>type Backend interface { <add> FindNetwork(idName string) (libnetwork.Network, error) <add> GetNetwork(idName string, by int) (libnetwork.Network, error) <add> GetNetworksByID(partialID string) []libnetwork.Network <add> CreateNetwork(name, driver string, ipam network.IPAM, <add> options map[string]string) (libnetwork.Network, error) <add> ConnectContainerToNetwork(containerName, networkName string) error <add> DisconnectContainerFromNetwork(containerName string, <add> network libnetwork.Network) error <add> NetworkControllerEnabled() bool <add>} <ide><path>api/server/router/network/network.go <ide> import ( <ide> "github.com/docker/docker/api/server/httputils" <ide> "github.com/docker/docker/api/server/router" <ide> "github.com/docker/docker/api/server/router/local" <del> "github.com/docker/docker/daemon" <ide> "github.com/docker/docker/errors" <ide> "golang.org/x/net/context" <ide> ) <ide> <ide> // networkRouter is a router to talk with the network controller <ide> type networkRouter struct { <del> daemon *daemon.Daemon <del> routes []router.Route <add> backend Backend <add> routes []router.Route <ide> } <ide> <ide> // NewRouter initializes a new network router <del>func NewRouter(d *daemon.Daemon) router.Router { <add>func NewRouter(b Backend) router.Router { <ide> r := &networkRouter{ <del> daemon: d, <add> backend: b, <ide> } <ide> r.initRoutes() <ide> return r <ide> func (r *networkRouter) initRoutes() { <ide> } <ide> <ide> func (r *networkRouter) controllerEnabledMiddleware(handler httputils.APIFunc) httputils.APIFunc { <del> if r.daemon.NetworkControllerEnabled() { <add> if r.backend.NetworkControllerEnabled() { <ide> return handler <ide> } <ide> return networkControllerDisabled <ide><path>api/server/router/network/network_routes.go <ide> func (n *networkRouter) getNetworksList(ctx context.Context, w http.ResponseWrit <ide> var names, ids []string <ide> if names, nameFilter = netFilters["name"]; nameFilter { <ide> for _, name := range names { <del> if nw, err := n.daemon.GetNetwork(name, daemon.NetworkByName); err == nil { <add> if nw, err := n.backend.GetNetwork(name, daemon.NetworkByName); err == nil { <ide> list = append(list, buildNetworkResource(nw)) <ide> } else { <ide> logrus.Errorf("failed to get network for filter=%s : %v", name, err) <ide> func (n *networkRouter) getNetworksList(ctx context.Context, w http.ResponseWrit <ide> <ide> if ids, idFilter = netFilters["id"]; idFilter { <ide> for _, id := range ids { <del> for _, nw := range n.daemon.GetNetworksByID(id) { <add> for _, nw := range n.backend.GetNetworksByID(id) { <ide> list = append(list, buildNetworkResource(nw)) <ide> } <ide> } <ide> } <ide> <ide> if !nameFilter && !idFilter { <del> nwList := n.daemon.GetNetworksByID("") <add> nwList := n.backend.GetNetworksByID("") <ide> for _, nw := range nwList { <ide> list = append(list, buildNetworkResource(nw)) <ide> } <ide> func (n *networkRouter) getNetwork(ctx context.Context, w http.ResponseWriter, r <ide> return err <ide> } <ide> <del> nw, err := n.daemon.FindNetwork(vars["id"]) <add> nw, err := n.backend.FindNetwork(vars["id"]) <ide> if err != nil { <ide> return err <ide> } <ide> func (n *networkRouter) postNetworkCreate(ctx context.Context, w http.ResponseWr <ide> fmt.Sprintf("%s is a pre-defined network and cannot be created", create.Name)) <ide> } <ide> <del> nw, err := n.daemon.GetNetwork(create.Name, daemon.NetworkByName) <add> nw, err := n.backend.GetNetwork(create.Name, daemon.NetworkByName) <ide> if _, ok := err.(libnetwork.ErrNoSuchNetwork); err != nil && !ok { <ide> return err <ide> } <ide> func (n *networkRouter) postNetworkCreate(ctx context.Context, w http.ResponseWr <ide> warning = fmt.Sprintf("Network with name %s (id : %s) already exists", nw.Name(), nw.ID()) <ide> } <ide> <del> nw, err = n.daemon.CreateNetwork(create.Name, create.Driver, create.IPAM, create.Options) <add> nw, err = n.backend.CreateNetwork(create.Name, create.Driver, create.IPAM, create.Options) <ide> if err != nil { <ide> return err <ide> } <ide> func (n *networkRouter) postNetworkConnect(ctx context.Context, w http.ResponseW <ide> return err <ide> } <ide> <del> nw, err := n.daemon.FindNetwork(vars["id"]) <add> nw, err := n.backend.FindNetwork(vars["id"]) <ide> if err != nil { <ide> return err <ide> } <ide> <del> return n.daemon.ConnectContainerToNetwork(connect.Container, nw.Name()) <add> return n.backend.ConnectContainerToNetwork(connect.Container, nw.Name()) <ide> } <ide> <ide> func (n *networkRouter) postNetworkDisconnect(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error { <ide> func (n *networkRouter) postNetworkDisconnect(ctx context.Context, w http.Respon <ide> return err <ide> } <ide> <del> nw, err := n.daemon.FindNetwork(vars["id"]) <add> nw, err := n.backend.FindNetwork(vars["id"]) <ide> if err != nil { <ide> return err <ide> } <ide> <del> return n.daemon.DisconnectContainerFromNetwork(disconnect.Container, nw) <add> return n.backend.DisconnectContainerFromNetwork(disconnect.Container, nw) <ide> } <ide> <ide> func (n *networkRouter) deleteNetwork(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error { <ide> if err := httputils.ParseForm(r); err != nil { <ide> return err <ide> } <ide> <del> nw, err := n.daemon.FindNetwork(vars["id"]) <add> nw, err := n.backend.FindNetwork(vars["id"]) <ide> if err != nil { <ide> return err <ide> }
3
Javascript
Javascript
fix lint error
a203437d67741b616dfa030ea93c01b3d0287a76
<ide><path>pdf.js <ide> var PDFObjects = (function() { <ide> * Sets the data of an object but *doesn't* resolve it. <ide> */ <ide> setData: function(objId, data) { <del> // Watchout! If you call `this.ensureObj(objId, data)` you're going to <add> // Watchout! If you call `this.ensureObj(objId, data)` you're going to <ide> // create a *resolved* promise which shouldn't be the case! <ide> this.ensureObj(objId).data = data; <ide> }
1
Text
Text
fix events typo
62a858c60f6da8c6f2ae60dc7d0e2230ef35ee9c
<ide><path>doc/api/events.md <ide> added for a particular event. This is a useful default that helps finding <ide> memory leaks. Obviously, not all events should be limited to just 10 listeners. <ide> The `emitter.setMaxListeners()` method allows the limit to be modified for this <ide> specific `EventEmitter` instance. The value can be set to `Infinity` (or `0`) <del>for to indicate an unlimited number of listeners. <add>to indicate an unlimited number of listeners. <ide> <ide> Returns a reference to the `EventEmitter` so calls can be chained. <ide>
1
Text
Text
fix obsolete instructions about editing docs
2f46712074d187f5456723499e6885bf0941cfbc
<ide><path>CONTRIBUTING.md <ide> There are many ways to contribute to React Native, and many of them do not invol <ide> * Simply start using React Native. Go through the [Getting Started](https://facebook.github.io/react-native/docs/getting-started.html) guide. Does everything work as expected? If not, we're always looking for improvements. Let us know by [opening an issue](https://facebook.github.io/react-native/docs/contributing.html#reporting-new-issues). <ide> * Look through the [open issues](https://github.com/facebook/react-native/issues). Provide workarounds, ask for clarification, or suggest labels. Help [triage issues](https://facebook.github.io/react-native/docs/contributing.html#triaging-issues-and-pull-requests). <ide> * If you find an issue you would like to fix, [open a pull request](https://facebook.github.io/react-native/docs/contributing.html#your-first-pull-request). Issues tagged as [_Good first issue_](https://github.com/facebook/react-native/labels/Good%20first%20issue) are a good place to get started. <del>* Read through the [React Native docs](https://facebook.github.io/react-native/docs/getting-started.html). If you find anything that is confusing or can be improved, you can make edits by clicking "Improve this page" at the bottom of most docs. <add>* Read through the [React Native docs](https://facebook.github.io/react-native/docs/getting-started.html). If you find anything that is confusing or can be improved, you can make edits by clicking the "EDIT" button in the top-right corner of most docs. <ide> * Browse [Stack Overflow](https://stackoverflow.com/questions/tagged/react-native) and answer questions. This will help you get familiarized with common pitfalls or misunderstandings, which can be useful when contributing updates to the documentation. <ide> * Take a look at the [features requested](https://react-native.canny.io/feature-requests) by others in the community and consider opening a pull request if you see something you want to work on. <ide>
1
Python
Python
set version to v2.0.10
d566e673bf16e7dd7e592c11b02cccc1cd63a771
<ide><path>spacy/about.py <ide> # https://github.com/pypa/warehouse/blob/master/warehouse/__about__.py <ide> <ide> __title__ = 'spacy' <del>__version__ = '2.0.10.dev0' <add>__version__ = '2.0.10' <ide> __summary__ = 'Industrial-strength Natural Language Processing (NLP) with Python and Cython' <ide> __uri__ = 'https://spacy.io' <ide> __author__ = 'Explosion AI'
1
Ruby
Ruby
exclude hardlinks from mach_o_files."
cab97cf4d782ce36762f0cd615ca59718f55b0d5
<ide><path>Library/Homebrew/keg_relocate.rb <ide> def find_dylib(bad_name) <ide> end <ide> <ide> def mach_o_files <del> hardlinks = Set.new <ide> mach_o_files = [] <ide> path.find do |pn| <del> # if we've already processed a file, ignore its hardlinks (which have the same dev ID and inode) <del> # this prevents relocations from being performed on a binary more than once <del> next unless hardlinks.add? [pn.stat.dev, pn.stat.ino] <ide> next if pn.symlink? || pn.directory? <ide> mach_o_files << pn if pn.dylib? || pn.mach_o_bundle? || pn.mach_o_executable? <ide> end
1
Javascript
Javascript
expose injectintodevtools() to renderers
8e7cb857889e0cf626fe221912cf923e82b36457
<ide><path>packages/react-cs-renderer/src/ReactNativeCS.js <ide> import type {ReactNativeCSType} from './ReactNativeCSTypes'; <ide> import {CSStatefulComponent} from 'CSStatefulComponent'; <ide> <ide> import ReactFiberReconciler from 'react-reconciler'; <del>import {injectInternals} from 'react-reconciler/src/ReactFiberDevToolsHook'; <ide> import ReactVersion from 'shared/ReactVersion'; <ide> <ide> const emptyObject = {}; <ide> const ReactNativeCSFiberRenderer = ReactFiberReconciler({ <ide> }, <ide> }); <ide> <del>injectInternals({ <del> findHostInstanceByFiber: ReactNativeCSFiberRenderer.findHostInstance, <del> // This is an enum because we may add more (e.g. profiler build) <add>ReactNativeCSFiberRenderer.injectIntoDevTools({ <ide> bundleType: __DEV__ ? 1 : 0, <ide> version: ReactVersion, <ide> rendererPackageName: 'react-cs-renderer', <ide><path>packages/react-dom/src/client/ReactDOM.js <ide> import './ReactDOMClientInjection'; <ide> import ReactFiberReconciler from 'react-reconciler'; <ide> // TODO: direct imports like some-package/src/* are bad. Fix me. <ide> import * as ReactPortal from 'react-reconciler/src/ReactPortal'; <del>// TODO: direct imports like some-package/src/* are bad. Fix me. <del>import {injectInternals} from 'react-reconciler/src/ReactFiberDevToolsHook'; <ide> import ExecutionEnvironment from 'fbjs/lib/ExecutionEnvironment'; <ide> import * as ReactGenericBatching from 'events/ReactGenericBatching'; <ide> import * as ReactControlledComponent from 'events/ReactControlledComponent'; <ide> if (ReactFeatureFlags.enableCreateRoot) { <ide> }; <ide> } <ide> <del>const foundDevTools = injectInternals({ <add>const foundDevTools = DOMRenderer.injectIntoDevTools({ <ide> findFiberByHostInstance: ReactDOMComponentTree.getClosestInstanceFromNode, <del> findHostInstanceByFiber: DOMRenderer.findHostInstance, <del> // This is an enum because we may add more (e.g. profiler build) <ide> bundleType: __DEV__ ? 1 : 0, <ide> version: ReactVersion, <ide> rendererPackageName: 'react-dom', <ide><path>packages/react-native-renderer/src/ReactNativeRenderer.js <ide> import './ReactNativeInjection'; <ide> import * as ReactFiberErrorLogger <ide> from 'react-reconciler/src/ReactFiberErrorLogger'; <ide> import * as ReactPortal from 'react-reconciler/src/ReactPortal'; <del>import {injectInternals} from 'react-reconciler/src/ReactFiberDevToolsHook'; <ide> import * as ReactGenericBatching from 'events/ReactGenericBatching'; <ide> import TouchHistoryMath from 'events/TouchHistoryMath'; <ide> import * as ReactGlobalSharedState from 'shared/ReactGlobalSharedState'; <ide> if (__DEV__) { <ide> ); <ide> } <ide> <del>injectInternals({ <add>ReactNativeFiberRenderer.injectIntoDevTools({ <ide> findFiberByHostInstance: ReactNativeComponentTree.getClosestInstanceFromNode, <del> findHostInstanceByFiber: ReactNativeFiberRenderer.findHostInstance, <ide> getInspectorDataForViewTag: getInspectorDataForViewTag, <del> // This is an enum because we may add more (e.g. profiler build) <ide> bundleType: __DEV__ ? 1 : 0, <ide> version: ReactVersion, <ide> rendererPackageName: 'react-native-renderer', <ide><path>packages/react-reconciler/src/ReactFiberReconciler.js <ide> import { <ide> processChildContext, <ide> } from './ReactFiberContext'; <ide> import {createFiberRoot} from './ReactFiberRoot'; <add>import * as ReactFiberDevToolsHook from './ReactFiberDevToolsHook'; <ide> import ReactFiberScheduler from './ReactFiberScheduler'; <ide> import {insertUpdateIntoFiber} from './ReactFiberUpdateQueue'; <ide> import ReactFiberInstrumentation from './ReactFiberInstrumentation'; <ide> type HydrationHostConfig<T, P, I, TI, C, CX, PL> = { <ide> ): void, <ide> }; <ide> <add>// 0 is PROD, 1 is DEV. <add>// Might add PROFILE later. <add>type BundleType = 0 | 1; <add> <add>type DevToolsConfig<I, TI> = {| <add> bundleType: BundleType, <add> version: string, <add> rendererPackageName: string, <add> // Note: this actually *does* depend on Fiber internal fields. <add> // Used by "inspect clicked DOM element" in React DevTools. <add> findFiberByHostInstance?: (instance: I | TI) => Fiber, <add> // Used by RN in-app inspector. <add> // This API is unfortunately RN-specific. <add> // TODO: Change it to accept Fiber instead and type it properly. <add> getInspectorDataForViewTag?: (tag: number) => Object, <add>|}; <add> <ide> export type Reconciler<C, I, TI> = { <ide> createContainer(containerInfo: C, hydrate: boolean): OpaqueRoot, <ide> updateContainer( <ide> export type Reconciler<C, I, TI> = { <ide> unbatchedUpdates<A>(fn: () => A): A, <ide> flushSync<A>(fn: () => A): A, <ide> deferredUpdates<A>(fn: () => A): A, <add> injectIntoDevTools(devToolsConfig: DevToolsConfig<I, TI>): boolean, <ide> <ide> // Used to extract the return value from the initial render. Legacy API. <ide> getPublicRootInstance( <ide> export default function<T, P, I, TI, PI, C, CC, CX, PL>( <ide> scheduleWork(current, expirationTime); <ide> } <ide> <add> function findHostInstance(fiber: Fiber): PI | null { <add> const hostFiber = findCurrentHostFiber(fiber); <add> if (hostFiber === null) { <add> return null; <add> } <add> return hostFiber.stateNode; <add> } <add> <ide> return { <ide> createContainer(containerInfo: C, hydrate: boolean): OpaqueRoot { <ide> return createFiberRoot(containerInfo, hydrate); <ide> export default function<T, P, I, TI, PI, C, CC, CX, PL>( <ide> } <ide> }, <ide> <del> findHostInstance(fiber: Fiber): PI | null { <del> const hostFiber = findCurrentHostFiber(fiber); <del> if (hostFiber === null) { <del> return null; <del> } <del> return hostFiber.stateNode; <del> }, <add> findHostInstance, <ide> <ide> findHostInstanceWithNoPortals(fiber: Fiber): PI | null { <ide> const hostFiber = findCurrentHostFiberWithNoPortals(fiber); <ide> export default function<T, P, I, TI, PI, C, CC, CX, PL>( <ide> } <ide> return hostFiber.stateNode; <ide> }, <add> <add> injectIntoDevTools(devToolsConfig: DevToolsConfig<I, TI>): boolean { <add> const {findFiberByHostInstance} = devToolsConfig; <add> return ReactFiberDevToolsHook.injectInternals({ <add> ...devToolsConfig, <add> findHostInstanceByFiber(fiber: Fiber): I | TI | null { <add> return findHostInstance(fiber); <add> }, <add> findFiberByHostInstance(instance: I | TI): Fiber | null { <add> if (!findFiberByHostInstance) { <add> // Might not be implemented by the renderer. <add> return null; <add> } <add> return findFiberByHostInstance(instance); <add> }, <add> }); <add> }, <ide> }; <ide> } <ide><path>packages/react-rt-renderer/src/ReactNativeRT.js <ide> import { <ide> showDialog, <ide> } from 'react-native-renderer/src/ReactNativeFiberErrorDialog'; <ide> import * as ReactPortal from 'react-reconciler/src/ReactPortal'; <del>import {injectInternals} from 'react-reconciler/src/ReactFiberDevToolsHook'; <ide> import * as ReactGenericBatching from 'events/ReactGenericBatching'; <ide> import ReactVersion from 'shared/ReactVersion'; <ide> <ide> const ReactNativeRTFiber: ReactNativeRTType = { <ide> flushSync: ReactNativeRTFiberRenderer.flushSync, <ide> }; <ide> <del>injectInternals({ <add>ReactNativeRTFiberRenderer.injectIntoDevTools({ <ide> findFiberByHostInstance: getFiberFromTag, <del> findHostInstanceByFiber: ReactNativeRTFiberRenderer.findHostInstance, <ide> getInspectorDataForViewTag: ReactNativeRTFiberInspector.getInspectorDataForViewTag, <del> // This is an enum because we may add more (e.g. profiler build) <ide> bundleType: __DEV__ ? 1 : 0, <ide> version: ReactVersion, <ide> rendererPackageName: 'react-rt-renderer',
5
Mixed
Javascript
allow empty string for temp directory prefix
1317252dfe8824fd9cfee125d2aaa94004db2f3b
<ide><path>doc/api/fs.md <ide> rejection only when `recursive` is false. <ide> ### `fsPromises.mkdtemp(prefix[, options])` <ide> <!-- YAML <ide> added: v10.0.0 <add>changes: <add> - version: REPLACEME <add> pr-url: https://github.com/nodejs/node/pull/39028 <add> description: The `prefix` parameter now accepts an empty string. <ide> --> <ide> <ide> * `prefix` {string} <ide> See the POSIX mkdir(2) documentation for more details. <ide> <!-- YAML <ide> added: v5.10.0 <ide> changes: <add> - version: REPLACEME <add> pr-url: https://github.com/nodejs/node/pull/39028 <add> description: The `prefix` parameter now accepts an empty string. <ide> - version: v10.0.0 <ide> pr-url: https://github.com/nodejs/node/pull/12562 <ide> description: The `callback` parameter is no longer optional. Not passing <ide> See the POSIX mkdir(2) documentation for more details. <ide> ### `fs.mkdtempSync(prefix[, options])` <ide> <!-- YAML <ide> added: v5.10.0 <add>changes: <add> - version: REPLACEME <add> pr-url: https://github.com/nodejs/node/pull/39028 <add> description: The `prefix` parameter now accepts an empty string. <ide> --> <ide> <ide> * `prefix` {string} <ide><path>lib/fs.js <ide> const { <ide> codes: { <ide> ERR_FS_FILE_TOO_LARGE, <ide> ERR_INVALID_ARG_VALUE, <del> ERR_INVALID_ARG_TYPE, <ide> ERR_FEATURE_UNAVAILABLE_ON_PLATFORM, <ide> }, <ide> AbortError, <ide> const { <ide> validateEncoding, <ide> validateFunction, <ide> validateInteger, <add> validateString, <ide> } = require('internal/validators'); <ide> <ide> const watchers = require('internal/fs/watchers'); <ide> realpath.native = (path, options, callback) => { <ide> function mkdtemp(prefix, options, callback) { <ide> callback = makeCallback(typeof options === 'function' ? options : callback); <ide> options = getOptions(options, {}); <del> if (!prefix || typeof prefix !== 'string') { <del> throw new ERR_INVALID_ARG_TYPE('prefix', 'string', prefix); <del> } <add> <add> validateString(prefix, 'prefix'); <ide> nullCheck(prefix, 'prefix'); <ide> warnOnNonPortableTemplate(prefix); <ide> const req = new FSReqCallback(); <ide> function mkdtemp(prefix, options, callback) { <ide> */ <ide> function mkdtempSync(prefix, options) { <ide> options = getOptions(options, {}); <del> if (!prefix || typeof prefix !== 'string') { <del> throw new ERR_INVALID_ARG_TYPE('prefix', 'string', prefix); <del> } <add> <add> validateString(prefix, 'prefix'); <ide> nullCheck(prefix, 'prefix'); <ide> warnOnNonPortableTemplate(prefix); <ide> const path = `${prefix}XXXXXX`; <ide><path>lib/internal/fs/promises.js <ide> const { Buffer } = require('buffer'); <ide> const { <ide> codes: { <ide> ERR_FS_FILE_TOO_LARGE, <del> ERR_INVALID_ARG_TYPE, <ide> ERR_INVALID_ARG_VALUE, <ide> ERR_METHOD_NOT_IMPLEMENTED, <ide> }, <ide> const { <ide> validateBuffer, <ide> validateEncoding, <ide> validateInteger, <add> validateString, <ide> } = require('internal/validators'); <ide> const pathModule = require('path'); <ide> const { promisify } = require('internal/util'); <ide> async function realpath(path, options) { <ide> <ide> async function mkdtemp(prefix, options) { <ide> options = getOptions(options, {}); <del> if (!prefix || typeof prefix !== 'string') { <del> throw new ERR_INVALID_ARG_TYPE('prefix', 'string', prefix); <del> } <add> <add> validateString(prefix, 'prefix'); <ide> nullCheck(prefix); <ide> warnOnNonPortableTemplate(prefix); <ide> return binding.mkdtemp(`${prefix}XXXXXX`, options.encoding, kUsePromises); <ide><path>test/parallel/test-fs-mkdtemp-prefix-check.js <ide> const common = require('../common'); <ide> const assert = require('assert'); <ide> const fs = require('fs'); <ide> <del>const prefixValues = [undefined, null, 0, true, false, 1, '']; <add>const prefixValues = [undefined, null, 0, true, false, 1]; <ide> <ide> function fail(value) { <ide> assert.throws(
4
Javascript
Javascript
support error boundaries on reacttestrenderer
38f74bcaf4a4a787dc5634c56c660beacd7df074
<ide><path>src/renderers/testing/ReactTestReconcileTransaction.js <ide> var Mixin = { <ide> return ReactUpdateQueue; <ide> }, <ide> <add> /** <add> * Save current transaction state -- if the return value from this method is <add> * passed to `rollback`, the transaction will be reset to that state. <add> */ <add> checkpoint: function() { <add> // reactMountReady is the our only stateful wrapper <add> return this.reactMountReady.checkpoint(); <add> }, <add> <add> rollback: function(checkpoint) { <add> this.reactMountReady.rollback(checkpoint); <add> }, <add> <ide> /** <ide> * `PooledClass` looks for this, and will invoke this before allowing this <ide> * instance to be reused. <ide><path>src/renderers/testing/__tests__/ReactTestRenderer-test.js <ide> describe('ReactTestRenderer', function() { <ide> expect(log).toEqual([null]); <ide> }); <ide> <add> it('supports error boundaries', function() { <add> class Angry extends React.Component { <add> render() { <add> throw new Error('Please, do not render me.'); <add> } <add> } <add> <add> class Boundary extends React.Component { <add> constructor(props) { <add> super(props); <add> this.state = {error: false}; <add> } <add> render() { <add> if (!this.state.error) { <add> return (<div><button onClick={this.onClick}>ClickMe</button><Angry /></div>); <add> } else { <add> return (<div>Happy Birthday!</div>); <add> } <add> } <add> onClick() { <add> /* do nothing */ <add> } <add> unstable_handleError() { <add> this.setState({error: true}); <add> } <add> } <add> <add> var EventPluginHub = require('EventPluginHub'); <add> EventPluginHub.putListener = jest.fn(); <add> var renderer = ReactTestRenderer.create(<Boundary />); <add> expect(renderer.toJSON()).toEqual({ <add> type: 'div', <add> props: {}, <add> children: ['Happy Birthday!'], <add> }); <add> expect(EventPluginHub.putListener).not.toBeCalled(); <add> }); <add> <ide> });
2
Javascript
Javascript
use gatsby link for cta button
ba256b65d95d715b11e295751047a08ff291bedd
<ide><path>src/components/Header/components/Login.js <ide> import React from 'react'; <ide> import PropTypes from 'prop-types'; <ide> import { Button } from 'react-bootstrap'; <add>import { Link } from 'gatsby'; <ide> <ide> import './login.css'; <ide> <ide> function Login({ children, ...restProps }) { <ide> return ( <del> <Button <del> {...restProps} <del> bsStyle='default' <del> className={(restProps.block ? 'btn-cta-big' : '') + ' signup-btn btn-cta'} <del> href='/signin' <del> target='_blank' <del> > <del> {children || 'Sign In'} <del> </Button> <add> <Link to='/signin'> <add> <Button <add> {...restProps} <add> bsStyle='default' <add> className={ <add> (restProps.block ? 'btn-cta-big' : '') + ' signup-btn btn-cta' <add> } <add> > <add> {children || 'Sign In'} <add> </Button> <add> </Link> <ide> ); <ide> } <ide>
1
Java
Java
add tests for java jni bindings
1f36d9887413888ea592e792654b80099fc26472
<ide><path>ReactAndroid/src/main/java/com/facebook/csslayout/CSSNode.java <ide> public class CSSNode implements CSSNodeAPI<CSSNode> { <ide> } <ide> } <ide> <add> /** <add> * Get native instance count. Useful for testing only. <add> */ <add> static native int jni_CSSNodeGetInstanceCount(); <add> <ide> private CSSNode mParent; <ide> private List<CSSNode> mChildren; <ide> private MeasureFunction mMeasureFunction;
1
Python
Python
fix wrong display in memory and swap
6c3ea7f29337dbc112a28e00959036349dd1e3ef
<ide><path>glances/plugins/glances_mem.py <ide> def msg_curse(self, args=None): <ide> msg = "{0:5} ".format(_("MEM")) <ide> ret.append(self.curse_add_line(msg, "TITLE")) <ide> # Percent memory usage <del> msg = "{0:>6}%".format(format(self.stats['percent'] / 100, '.1')) <add> msg = "{0:>7.1%}".format(self.stats['percent'] / 100) <ide> ret.append(self.curse_add_line(msg)) <ide> # Active memory usage <ide> if 'active' in self.stats: <ide> def msg_curse(self, args=None): <ide> # Total memory usage <ide> msg = "{0:6}".format(_("total:")) <ide> ret.append(self.curse_add_line(msg)) <del> msg = "{0:>7}".format(self.auto_unit(format(self.stats['total']), '.1%')) <add> msg = "{0:>7}".format(self.auto_unit(self.stats['total'])) <ide> ret.append(self.curse_add_line(msg)) <ide> # Inactive memory usage <ide> if 'inactive' in self.stats: <ide><path>glances/plugins/glances_memswap.py <ide> def msg_curse(self, args=None): <ide> msg = "{0:7} ".format(_("SWAP")) <ide> ret.append(self.curse_add_line(msg, "TITLE")) <ide> # Percent memory usage <del> msg = "{0}".format(format(self.stats['percent'] / 100, '>6.1%')) <add> msg = "{0:>6.1%}".format(self.stats['percent'] / 100) <ide> ret.append(self.curse_add_line(msg)) <ide> # New line <ide> ret.append(self.curse_new_line())
2
Text
Text
add kickstarter link."
a554e72dc6d57ae810b6da741da46e2cb9d19b23
<ide><path>README.md <ide> Homebrew <ide> ======== <ide> Features, usage and installation instructions are [summarized on the homepage][home]. <ide> <del>Kickstarter <del>----------- <del> <del>Please [back our Kickstarter](http://www.kickstarter.com/projects/homebrew/brew-test-bot) before March 6th: <del>[![Homebrew brew-test-bot Kickstarter](http://f.cl.ly/items/2c0D160A1B2z2S280H33/kickstarter.png)](http://www.kickstarter.com/projects/homebrew/brew-test-bot) <del> <ide> What Packages Are Available? <ide> ---------------------------- <ide> 1. You can [browse the Formula directory on GitHub][formula].
1
Javascript
Javascript
fix crash in debugger
fc8afd45c7150385897b867bb2123d81f4bb9943
<ide><path>lib/_debugger.js <ide> Client.prototype.reqEval = function(expression, cb) { <ide> var frame = bt.frames[self.currentFrame]; <ide> <ide> var evalFrames = frame.scopes.map(function(s) { <del> return bt.frames[s.index].index; <add> if (!s) return; <add> var x = bt.frames[s.index]; <add> if (!x) return; <add> return x.index; <ide> }); <ide> <ide> self._reqFramesEval(expression, evalFrames, cb);
1
Javascript
Javascript
use full path to packager for generated project
d6c9648aea72e1a6f90e635c7b3cd96e1e6d5474
<ide><path>react-native-cli/index.js <ide> function init(name) { <ide> version: '0.0.1', <ide> private: true, <ide> scripts: { <del> start: "react-native start" <add> start: "node_modules/react-native/packager/packager.sh" <ide> } <ide> }; <ide> fs.writeFileSync(path.join(root, 'package.json'), JSON.stringify(packageJson));
1
PHP
PHP
fix doc block
54554c7cca58635ca39bb213a47583e481459ae1
<ide><path>tests/TestCase/Command/HelpCommandTest.php <ide> public function testMain() <ide> /** <ide> * Assert the help output. <ide> * <del> * @param string $output The output to check. <ide> * @return void <ide> */ <ide> protected function assertCommandList()
1
Javascript
Javascript
add comments migration to loopback script
ef919b7ed3976c45d0c849f20de0c511a54ade57
<ide><path>loopbackMigration.js <ide> var storyCount = dbObservable <ide> }) <ide> .count(); <ide> <add>var commentCount = dbObservable <add> .flatMap(function(db) { <add> return createQuery(db, 'comments', {}); <add> }) <add> .withLatestFrom(dbObservable, function(comments, db) { <add> return { <add> comments: comments, <add> db: db <add> }; <add> }) <add> .flatMap(function(dats) { <add> return insertMany(dats.db, 'comment', dats.comments, { w: 1 }); <add> }) <add> .buffer(20) <add> .count(); <add> <ide> Rx.Observable.combineLatest( <ide> userIdentityCount, <ide> userSavesCount, <ide> storyCount, <del> function(userIdentCount, userCount, storyCount) { <add> commentCount, <add> function(userIdentCount, userCount, storyCount, commentCount) { <ide> return { <ide> userIdentCount: userIdentCount * 20, <ide> userCount: userCount * 20, <del> storyCount: storyCount * 20 <add> storyCount: storyCount * 20, <add> commentCount: commentCount * 20 <ide> }; <ide> }) <ide> .subscribe( <del> function(countObj) { <del> console.log('next'); <del> count = countObj; <del> }, <del> function(err) { <del> console.error('an error occured', err, err.stack); <del> }, <del> function() { <del> <del> console.log('finished with ', count); <del> process.exit(0); <del> } <del>); <add> function(countObj) { <add> console.log('next'); <add> count = countObj; <add> }, <add> function(err) { <add> console.error('an error occured', err, err.stack); <add> }, <add> function() { <add> <add> console.log('finished with ', count); <add> process.exit(0); <add> } <add> );
1
Ruby
Ruby
fix failing `quotingtest#test_quoted_time_utc`
7daa6f4a779727f1a57a4806692f43b58e150eb9
<ide><path>activerecord/test/cases/quoting_test.rb <ide> def test_quoted_time_utc <ide> with_timezone_config default: :utc do <ide> t = Time.now.change(usec: 0) <ide> <del> expected = t.change(year: 2000, month: 1, day: 1) <del> expected = expected.getutc.to_s(:db).sub("2000-01-01 ", "") <add> expected = t.getutc.change(year: 2000, month: 1, day: 1) <add> expected = expected.to_s(:db).sub("2000-01-01 ", "") <ide> <ide> assert_equal expected, @quoter.quoted_time(t) <ide> end
1
Python
Python
add explicit encode/decode for fernet key
b587f1e2968bfa2b82ff8a37b260d558608b2403
<ide><path>airflow/configuration.py <ide> <ide> def generate_fernet_key(): <ide> try: <del> FERNET_KEY = Fernet.generate_key() <add> FERNET_KEY = Fernet.generate_key().decode() <ide> except NameError: <ide> FERNET_KEY = "cryptography_not_found_storing_passwords_in_plain_text" <ide> return FERNET_KEY <ide><path>airflow/models.py <ide> ENCRYPTION_ON = False <ide> try: <ide> from cryptography.fernet import Fernet <del> FERNET = Fernet(conf.get('core', 'FERNET_KEY')) <add> FERNET = Fernet(conf.get('core', 'FERNET_KEY').encode('utf-8')) <ide> ENCRYPTION_ON = True <ide> except: <ide> pass
2
Text
Text
add known issue of 'num_runs'
b56e6422472dcf80aafe160df335699f087c4ade
<ide><path>UPDATING.md <ide> loops. This is now time bound and defaults to `-1`, which means run continuously <ide> #### num_runs <ide> Previously `num_runs` was used to let the scheduler terminate after a certain amount of loops. Now num_runs specifies <ide> the number of times to try to schedule each DAG file within `run_duration` time. Defaults to `-1`, which means try <del>indefinitely. <add>indefinitely. This is only available on the command line. <ide> <ide> #### min_file_process_interval <ide> After how much time should an updated DAG be picked up from the filesystem. <ide> supported and will be removed entirely in Airflow 2.0 <ide> Previously, `Operator.__init__()` accepted any arguments (either positional `*args` or keyword `**kwargs`) without <ide> complaint. Now, invalid arguments will be rejected. (https://github.com/apache/incubator-airflow/pull/1285) <ide> <add>### Known Issues <add>There is a report that the default of "-1" for num_runs creates an issue where errors are reported while parsing tasks. <add>It was not confirmed, but a workaround was found by changing the default back to `None`. <add> <add>To do this edit `cli.py`, find the following: <add> <add>``` <add> 'num_runs': Arg( <add> ("-n", "--num_runs"), <add> default=-1, type=int, <add> help="Set the number of runs to execute before exiting"), <add>``` <add> <add>and change `default=-1` to `default=None`. Please report on the mailing list if you have this issue. <add> <ide> ## Airflow 1.7.1.2 <ide> <ide> ### Changes to Configuration
1
Text
Text
add v3.19.0-beta.3 to changelog
f16f307152000c37e559c7154a8d2df6743de13c
<ide><path>CHANGELOG.md <ide> # Ember Changelog <ide> <add>### v3.19-0.beta.3 (May 4, 2020) <add> <add>- [#18941](https://github.com/emberjs/ember.js/pull/18941) [BUGFIX] Update rendering engine to latest version. <add> - Reduce template size growth to near 3.16 levels (still ~ 3% higher than 3.16) <add> - Ensures destroyable items added to an `{{#each` after initial render are invoked properly <add> - Fixes an issue with key collisions in `{{#each` <add> <ide> ### v3.19.0-beta.2 (April 27, 2020) <ide> <ide> - [#18913](https://github.com/emberjs/ember.js/pull/18913) [BUGFIX] Update to glimmer-vm 0.51.0.
1
Python
Python
add support for dispatching c++ sources
2d9e75f3a1dbe21de6b53cd2996e45054d3b86c5
<ide><path>numpy/distutils/ccompiler_opt.py <ide> class _Distutils: <ide> def __init__(self, ccompiler): <ide> self._ccompiler = ccompiler <ide> <del> def dist_compile(self, sources, flags, **kwargs): <add> def dist_compile(self, sources, flags, ccompiler=None, **kwargs): <ide> """Wrap CCompiler.compile()""" <ide> assert(isinstance(sources, list)) <ide> assert(isinstance(flags, list)) <ide> flags = kwargs.pop("extra_postargs", []) + flags <del> return self._ccompiler.compile( <del> sources, extra_postargs=flags, **kwargs <del> ) <add> if not ccompiler: <add> ccompiler = self._ccompiler <add> return ccompiler.compile(sources, extra_postargs=flags, **kwargs) <ide> <ide> def dist_test(self, source, flags): <ide> """Return True if 'CCompiler.compile()' able to compile <ide> def cpu_dispatch_names(self): <ide> """ <ide> return self.parse_dispatch_names <ide> <del> def try_dispatch(self, sources, src_dir=None, **kwargs): <add> def try_dispatch(self, sources, src_dir=None, ccompiler=None, **kwargs): <ide> """ <ide> Compile one or more dispatch-able sources and generates object files, <ide> also generates abstract C config headers and macros that <ide> def try_dispatch(self, sources, src_dir=None, **kwargs): <ide> Path of parent directory for the generated headers and wrapped sources. <ide> If None(default) the files will generated in-place. <ide> <add> ccompiler: CCompiler <add> Distutils `CCompiler` instance to be used for compilation. <add> If None (default), the provided instance during the initialization <add> will be used instead. <add> <ide> **kwargs : any <ide> Arguments to pass on to the `CCompiler.compile()` <ide> <ide> def try_dispatch(self, sources, src_dir=None, **kwargs): <ide> # among them. <ide> objects = [] <ide> for flags, srcs in to_compile.items(): <del> objects += self.dist_compile(srcs, list(flags), **kwargs) <add> objects += self.dist_compile( <add> srcs, list(flags), ccompiler=ccompiler, **kwargs <add> ) <ide> return objects <ide> <ide> def generate_dispatch_header(self, header_path): <ide> def _wrap_target(self, output_dir, dispatch_src, target, nochange=False): <ide> return wrap_path <ide> <ide> def _generate_config(self, output_dir, dispatch_src, targets, has_baseline=False): <del> config_path = os.path.basename(dispatch_src).replace(".c", ".h") <add> config_path = os.path.basename(dispatch_src) <add> config_path = os.path.splitext(config_path)[0] + '.h' <ide> config_path = os.path.join(output_dir, config_path) <ide> # check if targets didn't change to avoid recompiling <ide> cache_hash = self.cache_hash(targets, has_baseline) <ide><path>numpy/distutils/command/build_clib.py <ide> def build_a_library(self, build_info, lib_name, libraries): <ide> # filtering C dispatch-table sources when optimization is not disabled, <ide> # otherwise treated as normal sources. <ide> copt_c_sources = [] <add> copt_cxx_sources = [] <ide> copt_baseline_flags = [] <ide> copt_macros = [] <ide> if not self.disable_optimization: <ide> def build_a_library(self, build_info, lib_name, libraries): <ide> include_dirs.append(dispatch_hpath) <ide> <ide> copt_build_src = None if self.inplace else bsrc_dir <del> copt_c_sources = [ <del> c_sources.pop(c_sources.index(src)) <del> for src in c_sources[:] if src.endswith(".dispatch.c") <del> ] <add> for _srcs, _dst, _ext in ( <add> ((c_sources,), copt_c_sources, ('.dispatch.c',)), <add> ((c_sources, cxx_sources), copt_cxx_sources, <add> ('.dispatch.cpp', '.dispatch.cxx')) <add> ): <add> for _src in _srcs: <add> _dst += [ <add> _src.pop(_src.index(s)) <add> for s in _src[:] if s.endswith(_ext) <add> ] <ide> copt_baseline_flags = self.compiler_opt.cpu_baseline_flags() <ide> else: <ide> copt_macros.append(("NPY_DISABLE_OPTIMIZATION", 1)) <ide> <ide> objects = [] <add> if copt_cxx_sources: <add> log.info("compiling C++ dispatch-able sources") <add> objects += self.compiler_opt.try_dispatch( <add> copt_c_sources, <add> output_dir=self.build_temp, <add> src_dir=copt_build_src, <add> macros=macros + copt_macros, <add> include_dirs=include_dirs, <add> debug=self.debug, <add> extra_postargs=extra_postargs, <add> ccompiler=cxx_compiler <add> ) <add> <ide> if copt_c_sources: <ide> log.info("compiling C dispatch-able sources") <ide> objects += self.compiler_opt.try_dispatch(copt_c_sources, <ide><path>numpy/distutils/command/build_ext.py <ide> def build_extension(self, ext): <ide> # filtering C dispatch-table sources when optimization is not disabled, <ide> # otherwise treated as normal sources. <ide> copt_c_sources = [] <add> copt_cxx_sources = [] <ide> copt_baseline_flags = [] <ide> copt_macros = [] <ide> if not self.disable_optimization: <ide> def build_extension(self, ext): <ide> include_dirs.append(dispatch_hpath) <ide> <ide> copt_build_src = None if self.inplace else bsrc_dir <del> copt_c_sources = [ <del> c_sources.pop(c_sources.index(src)) <del> for src in c_sources[:] if src.endswith(".dispatch.c") <del> ] <add> for _srcs, _dst, _ext in ( <add> ((c_sources,), copt_c_sources, ('.dispatch.c',)), <add> ((c_sources, cxx_sources), copt_cxx_sources, <add> ('.dispatch.cpp', '.dispatch.cxx')) <add> ): <add> for _src in _srcs: <add> _dst += [ <add> _src.pop(_src.index(s)) <add> for s in _src[:] if s.endswith(_ext) <add> ] <ide> copt_baseline_flags = self.compiler_opt.cpu_baseline_flags() <ide> else: <ide> copt_macros.append(("NPY_DISABLE_OPTIMIZATION", 1)) <ide> <ide> c_objects = [] <add> if copt_cxx_sources: <add> log.info("compiling C++ dispatch-able sources") <add> c_objects += self.compiler_opt.try_dispatch( <add> copt_cxx_sources, <add> output_dir=output_dir, <add> src_dir=copt_build_src, <add> macros=macros + copt_macros, <add> include_dirs=include_dirs, <add> debug=self.debug, <add> extra_postargs=extra_args, <add> ccompiler=cxx_compiler, <add> **kws <add> ) <ide> if copt_c_sources: <ide> log.info("compiling C dispatch-able sources") <ide> c_objects += self.compiler_opt.try_dispatch(copt_c_sources,
3
Python
Python
remove dft from build
1f4b85881b127b879241f2dafb88483c3c20bdd4
<ide><path>numpy/setup.py <ide> def configuration(parent_package='',top_path=None): <ide> config.add_subpackage('lib') <ide> config.add_subpackage('oldnumeric') <ide> config.add_subpackage('numarray') <del> config.add_subpackage('dft') <ide> config.add_subpackage('fft') <ide> config.add_subpackage('linalg') <ide> config.add_subpackage('random')
1
Python
Python
update lucas_series.py to include another method
b93a9d8e8faa115d06a6bd656f5bf0e91254c1de
<ide><path>maths/lucas_series.py <del># Lucas Sequence Using Recursion <add>""" <add>https://en.wikipedia.org/wiki/Lucas_number <add>""" <ide> <ide> <del>def recur_luc(n): <add>def recursive_lucas_number(n): <ide> """ <del> >>> recur_luc(1) <add> Returns the nth lucas number <add> >>> recursive_lucas_number(1) <ide> 1 <del> >>> recur_luc(0) <add> >>> recursive_lucas_number(20) <add> 15127 <add> >>> recursive_lucas_number(0) <ide> 2 <add> >>> recursive_lucas_number(25) <add> 167761 <add> >>> recursive_lucas_number(-1.5) <add> Traceback (most recent call last): <add> ... <add> TypeError: recursive_lucas_number accepts only integer arguments. <ide> """ <ide> if n == 1: <ide> return n <ide> if n == 0: <ide> return 2 <del> return recur_luc(n - 1) + recur_luc(n - 2) <add> if not isinstance(n, int): <add> raise TypeError("recursive_lucas_number accepts only integer arguments.") <add> <add> return recursive_lucas_number(n - 1) + recursive_lucas_number(n - 2) <add> <add> <add>def dynamic_lucas_number(n: int) -> int: <add> """ <add> Returns the nth lucas number <add> >>> dynamic_lucas_number(1) <add> 1 <add> >>> dynamic_lucas_number(20) <add> 15127 <add> >>> dynamic_lucas_number(0) <add> 2 <add> >>> dynamic_lucas_number(25) <add> 167761 <add> >>> dynamic_lucas_number(-1.5) <add> Traceback (most recent call last): <add> ... <add> TypeError: dynamic_lucas_number accepts only integer arguments. <add> """ <add> if not isinstance(n, int): <add> raise TypeError("dynamic_lucas_number accepts only integer arguments.") <add> if n == 0: <add> return 2 <add> if n == 1: <add> return 1 <add> a, b = 2, 1 <add> for i in range(n): <add> a, b = b, a + b <add> return a <ide> <ide> <ide> if __name__ == "__main__": <del> limit = int(input("How many terms to include in Lucas series:")) <del> print("Lucas series:") <del> for i in range(limit): <del> print(recur_luc(i)) <add> from doctest import testmod <add> <add> testmod() <add> n = int(input("Enter the number of terms in lucas series:\n").strip()) <add> n = int(input("Enter the number of terms in lucas series:\n").strip()) <add> print("Using recursive function to calculate lucas series:") <add> print(" ".join(str(recursive_lucas_number(i)) for i in range(n))) <add> print("\nUsing dynamic function to calculate lucas series:") <add> print(" ".join(str(dynamic_lucas_number(i)) for i in range(n)))
1
Go
Go
use 2 seconds instead of 2000 milliseconds
cbf2f4d2816b20df307a270d4267557618708c3f
<ide><path>integration-cli/docker_cli_external_volume_driver_unix_test.go <ide> func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverRetryNotImmediatelyE <ide> <ide> <-started <ide> // wait for a retry to occur, then create spec to allow plugin to register <del> time.Sleep(2000 * time.Millisecond) <add> time.Sleep(2 * time.Second) <ide> p := newVolumePlugin(c, driverName) <ide> defer p.Close() <ide>
1
Ruby
Ruby
avoid unused capture
a05fd2d4a8fbeaef8ac5cb82068235f855ae8039
<ide><path>activesupport/lib/active_support/core_ext/marshal.rb <ide> module MarshalWithAutoloading # :nodoc: <ide> def load(source) <ide> super(source) <ide> rescue ArgumentError, NameError => exc <del> if exc.message.match(%r|undefined class/module (.+?)(::)?\z|) <add> if exc.message.match(%r|undefined class/module (.+?)(?:::)?\z|) <ide> # try loading the class/module <ide> loaded = $1.constantize <ide>
1
PHP
PHP
fix param count for unique and exists
24ec1591c3cc3f5624071f3989521f45e2a6ee08
<ide><path>src/Illuminate/Validation/Validator.php <ide> protected function validateNotIn($attribute, $value, $parameters) <ide> */ <ide> protected function validateUnique($attribute, $value, $parameters) <ide> { <del> $this->requireParameterCount(2, $parameters, 'unique'); <add> $this->requireParameterCount(1, $parameters, 'unique'); <ide> <ide> $table = $parameters[0]; <ide> <ide> protected function getUniqueExtra($parameters) <ide> */ <ide> protected function validateExists($attribute, $value, $parameters) <ide> { <del> $this->requireParameterCount(2, $parameters, 'exists'); <add> $this->requireParameterCount(1, $parameters, 'exists'); <ide> <ide> $table = $parameters[0]; <ide>
1
Python
Python
update average.py (#908)
12a16d63b7bdc1da0e0b215dfd5d8b938234f4ed
<ide><path>maths/average.py <ide> def average(nums): <ide> sum = 0 <del> n = 0 <ide> for x in nums: <ide> sum += x <del> n += 1 <del> avg = sum / n <add> avg = sum / len(nums) <ide> print(avg) <add> return avg <ide> <ide> def main(): <ide> average([2, 4, 6, 8, 20, 50, 70])
1
PHP
PHP
remove obsolete annotation
5fbdbe215e3cfcb6390d389c791ed92b811855eb
<ide><path>src/Auth/AbstractPasswordHasher.php <ide> abstract class AbstractPasswordHasher <ide> * Constructor <ide> * <ide> * @param array $config Array of config. <del> * @return void <ide> */ <ide> public function __construct(array $config = []) <ide> {
1
Javascript
Javascript
fix undefined xboneinf
02253acb2206b14a2df58882bf92bf52e03db548
<ide><path>examples/js/loaders/XLoader.js <ide> THREE.XLoader.prototype = { <ide> <ide> var scope = this; <ide> scope.nowReadMode = THREE.XLoader.XfileLoadMode.Weit_init; <del> scope.BoneInf = new XboneInf(); <add> scope.BoneInf = new THREE.XLoader.XboneInf(); <ide> <ide> }, <ide>
1
Python
Python
fix bleu computation when ratio=0.0
03a5f09a095cbae5b2223c8423c2356f46dcdb71
<ide><path>official/nlp/metrics/bleu.py <ide> def _get_ngrams_with_counter(segment, max_order): <ide> <ide> Args: <ide> segment: text segment from which n-grams will be extracted. <del> max_order: maximum length in tokens of the n-grams returned by this <del> methods. <add> max_order: maximum length in tokens of the n-grams returned by this methods. <ide> <ide> Returns: <ide> The Counter containing all n-grams upto max_order in segment <ide> def _get_ngrams_with_counter(segment, max_order): <ide> return ngram_counts <ide> <ide> <del>def compute_bleu(reference_corpus, translation_corpus, max_order=4, <add>def compute_bleu(reference_corpus, <add> translation_corpus, <add> max_order=4, <ide> use_bp=True): <ide> """Computes BLEU score of translated segments against one or more references. <ide> <ide> Args: <del> reference_corpus: list of references for each translation. Each <del> reference should be tokenized into a list of tokens. <del> translation_corpus: list of translations to score. Each translation <del> should be tokenized into a list of tokens. <add> reference_corpus: list of references for each translation. Each reference <add> should be tokenized into a list of tokens. <add> translation_corpus: list of translations to score. Each translation should <add> be tokenized into a list of tokens. <ide> max_order: Maximum n-gram order to use when computing BLEU score. <ide> use_bp: boolean, whether to apply brevity penalty. <ide> <ide> def compute_bleu(reference_corpus, translation_corpus, max_order=4, <ide> ref_ngram_counts = _get_ngrams_with_counter(references, max_order) <ide> translation_ngram_counts = _get_ngrams_with_counter(translations, max_order) <ide> <del> overlap = dict((ngram, <del> min(count, translation_ngram_counts[ngram])) <add> overlap = dict((ngram, min(count, translation_ngram_counts[ngram])) <ide> for ngram, count in ref_ngram_counts.items()) <ide> <ide> for ngram in overlap: <ide> matches_by_order[len(ngram) - 1] += overlap[ngram] <ide> for ngram in translation_ngram_counts: <del> possible_matches_by_order[len(ngram) - 1] += translation_ngram_counts[ <del> ngram] <add> possible_matches_by_order[len(ngram) - <add> 1] += translation_ngram_counts[ngram] <ide> <ide> precisions = [0] * max_order <ide> smooth = 1.0 <ide> def compute_bleu(reference_corpus, translation_corpus, max_order=4, <ide> if possible_matches_by_order[i] > 0: <ide> precisions[i] = float(matches_by_order[i]) / possible_matches_by_order[i] <ide> if matches_by_order[i] > 0: <del> precisions[i] = float(matches_by_order[i]) / possible_matches_by_order[ <del> i] <add> precisions[i] = float( <add> matches_by_order[i]) / possible_matches_by_order[i] <ide> else: <ide> smooth *= 2 <ide> precisions[i] = 1.0 / (smooth * possible_matches_by_order[i]) <ide> def compute_bleu(reference_corpus, translation_corpus, max_order=4, <ide> <ide> if use_bp: <ide> ratio = translation_length / reference_length <del> bp = math.exp(1 - 1. / ratio) if ratio < 1.0 else 1.0 <add> bp = 0. if ratio < 1e-6 else math.exp(1 - <add> 1. / ratio) if ratio < 1.0 else 1.0 <ide> bleu = geo_mean * bp <ide> return np.float32(bleu) <ide>
1
Mixed
Go
provide api to retrieve endpoint operational data
56741e7d60607b0fd98f7790db389cc01da511f2
<ide><path>libnetwork/README.md <ide> There are many networking solutions available to suit a broad range of use-cases <ide> if err != nil { <ide> return <ide> } <add> <add> // libentwork client can check the endpoint's operational data via the Info() API <add> epInfo, err := ep.Info() <add> mapData, ok := epInfo[options.PortMap] <add> if ok { <add> portMapping, ok := mapData.([]netutils.PortBinding) <add> if ok { <add> fmt.Printf("Current port mapping for endpoint %s: %v", ep.Name(), portMapping) <add> } <add> } <add> <ide> ``` <ide> <ide> ## Future <ide><path>libnetwork/cmd/readme_test/readme.go <ide> package main <ide> <ide> import ( <add> "fmt" <add> <ide> "github.com/docker/libnetwork" <add> "github.com/docker/libnetwork/netutils" <ide> "github.com/docker/libnetwork/pkg/options" <ide> ) <ide> <ide> func main() { <ide> if err != nil { <ide> return <ide> } <add> <add> // libentwork client can check the endpoint's operational data via the Info() API <add> epInfo, err := ep.Info() <add> mapData, ok := epInfo[options.PortMap] <add> if ok { <add> portMapping, ok := mapData.([]netutils.PortBinding) <add> if ok { <add> fmt.Printf("Current port mapping for endpoint %s: %v", ep.Name(), portMapping) <add> } <add> } <ide> } <ide><path>libnetwork/driverapi/driverapi.go <ide> type Driver interface { <ide> // passing the network id and endpoint id. <ide> DeleteEndpoint(nid, eid types.UUID) error <ide> <add> // EndpointInfo retrieves from the driver the operational data related to the specified endpoint <add> EndpointInfo(nid, eid types.UUID) (map[string]interface{}, error) <add> <ide> // Join method is invoked when a Sandbox is attached to an endpoint. <ide> Join(nid, eid types.UUID, sboxKey string, options map[string]interface{}) error <ide> <ide><path>libnetwork/drivers/bridge/bridge.go <ide> func (d *driver) DeleteEndpoint(nid, eid types.UUID) error { <ide> return nil <ide> } <ide> <add>func (d *driver) EndpointInfo(nid, eid types.UUID) (map[string]interface{}, error) { <add> // Get the network handler and make sure it exists <add> d.Lock() <add> n := d.network <add> d.Unlock() <add> if n == nil { <add> return nil, driverapi.ErrNoNetwork <add> } <add> <add> // Sanity check <add> n.Lock() <add> if n.id != nid { <add> n.Unlock() <add> return nil, InvalidNetworkIDError(nid) <add> } <add> n.Unlock() <add> <add> // Check if endpoint id is good and retrieve correspondent endpoint <add> ep, err := n.getEndpoint(eid) <add> if err != nil { <add> return nil, err <add> } <add> if ep == nil { <add> return nil, driverapi.ErrNoEndpoint <add> } <add> <add> m := make(map[string]interface{}) <add> <add> if ep.portMapping != nil { <add> // Return a copy of the operational data <add> pmc := make([]netutils.PortBinding, 0, len(ep.portMapping)) <add> for _, pm := range ep.portMapping { <add> pmc = append(pmc, pm.GetCopy()) <add> } <add> m[options.PortMap] = pmc <add> } <add> <add> return m, nil <add>} <add> <ide> // Join method is invoked when a Sandbox is attached to an endpoint. <ide> func (d *driver) Join(nid, eid types.UUID, sboxKey string, options map[string]interface{}) error { <ide> var err error <ide><path>libnetwork/drivers/bridge/bridge_test.go <ide> func TestCreateFullOptions(t *testing.T) { <ide> t.Fatalf("Failed to create bridge: %v", err) <ide> } <ide> } <add> <add>func TestQueryEndpointInfo(t *testing.T) { <add> defer netutils.SetupTestNetNS(t)() <add> <add> _, d := New() <add> <add> config := &Configuration{ <add> BridgeName: DefaultBridgeName, <add> EnableIPTables: true, <add> EnableICC: false, <add> } <add> genericOption := make(map[string]interface{}) <add> genericOption[options.GenericData] = config <add> <add> if err := d.Config(genericOption); err != nil { <add> t.Fatalf("Failed to setup driver config: %v", err) <add> } <add> <add> err := d.CreateNetwork("net1", nil) <add> if err != nil { <add> t.Fatalf("Failed to create bridge: %v", err) <add> } <add> <add> portMappings := getPortMapping() <add> epOptions := make(map[string]interface{}) <add> epOptions[options.PortMap] = portMappings <add> <add> _, err = d.CreateEndpoint("net1", "ep1", epOptions) <add> if err != nil { <add> t.Fatalf("Failed to create an endpoint : %s", err.Error()) <add> } <add> <add> dd := d.(*driver) <add> ep, _ := dd.network.endpoints["ep1"] <add> data, err := d.EndpointInfo(dd.network.id, ep.id) <add> if err != nil { <add> t.Fatalf("Failed to ask for endpoint operational data: %v", err) <add> } <add> pmd, ok := data[options.PortMap] <add> if !ok { <add> t.Fatalf("Endpoint operational data does not contain port mapping data") <add> } <add> pm, ok := pmd.([]netutils.PortBinding) <add> if !ok { <add> t.Fatalf("Unexpected format for port mapping in endpoint operational data") <add> } <add> if len(ep.portMapping) != len(pm) { <add> t.Fatalf("Incomplete data for port mapping in endpoint operational data") <add> } <add> for i, pb := range ep.portMapping { <add> if !pb.Equal(&pm[i]) { <add> t.Fatalf("Unexpected data for port mapping in endpoint operational data") <add> } <add> } <add> <add> // Cleanup as host ports are there <add> err = releasePorts(ep) <add> if err != nil { <add> t.Fatalf("Failed to release mapped ports: %v", err) <add> } <add>} <add> <ide> func TestCreateLinkWithOptions(t *testing.T) { <ide> defer netutils.SetupTestNetNS(t)() <ide> <ide><path>libnetwork/drivers/null/null.go <ide> func (d *driver) DeleteEndpoint(nid, eid types.UUID) error { <ide> return nil <ide> } <ide> <add>func (d *driver) EndpointInfo(nid, eid types.UUID) (map[string]interface{}, error) { <add> return make(map[string]interface{}, 0), nil <add>} <add> <ide> // Join method is invoked when a Sandbox is attached to an endpoint. <ide> func (d *driver) Join(nid, eid types.UUID, sboxKey string, options map[string]interface{}) error { <ide> return nil <ide><path>libnetwork/endpoint.go <ide> type Endpoint interface { <ide> // SandboxInfo returns the sandbox information for this endpoint. <ide> SandboxInfo() *sandbox.Info <ide> <add> // Info returns a collection of operational data related to this endpoint retrieved from the driver <add> Info() (map[string]interface{}, error) <add> <ide> // Delete and detaches this endpoint from the network. <ide> Delete() error <ide> } <ide> func (ep *endpoint) SandboxInfo() *sandbox.Info { <ide> return ep.sandboxInfo.GetCopy() <ide> } <ide> <add>func (ep *endpoint) Info() (map[string]interface{}, error) { <add> return ep.network.driver.EndpointInfo(ep.network.id, ep.id) <add>} <add> <ide> func (ep *endpoint) processOptions(options ...EndpointOption) { <ide> for _, opt := range options { <ide> if opt != nil { <ide><path>libnetwork/libnetwork_test.go <ide> func TestBridge(t *testing.T) { <ide> t.Fatal(err) <ide> } <ide> <add> epInfo, err := ep.Info() <add> if err != nil { <add> t.Fatal(err) <add> } <add> pmd, ok := epInfo[options.PortMap] <add> if !ok { <add> t.Fatalf("Could not find expected info in endpoint data") <add> } <add> pm, ok := pmd.([]netutils.PortBinding) <add> if !ok { <add> t.Fatalf("Unexpected format for port mapping in endpoint operational data") <add> } <add> if len(pm) != 3 { <add> t.Fatalf("Incomplete data for port mapping in endpoint operational data") <add> } <add> <ide> if err := ep.Delete(); err != nil { <ide> t.Fatal(err) <ide> } <ide><path>libnetwork/netutils/utils.go <ide> func (p *PortBinding) GetCopy() PortBinding { <ide> } <ide> } <ide> <add>// Equal checks if this instance of PortBinding is equal to the passed one <add>func (p *PortBinding) Equal(o *PortBinding) bool { <add> if p == o { <add> return true <add> } <add> <add> if o == nil { <add> return false <add> } <add> <add> if p.Proto != o.Proto || p.Port != o.Port || p.HostPort != o.HostPort { <add> return false <add> } <add> <add> if p.IP != nil { <add> if !p.IP.Equal(o.IP) { <add> return false <add> } <add> } else { <add> if o.IP != nil { <add> return false <add> } <add> } <add> <add> if p.HostIP != nil { <add> if !p.HostIP.Equal(o.HostIP) { <add> return false <add> } <add> } else { <add> if o.HostIP != nil { <add> return false <add> } <add> } <add> <add> return true <add>} <add> <ide> const ( <ide> // ICMP is for the ICMP ip protocol <ide> ICMP = 1
9
PHP
PHP
remove support for update with joins
690f890c997dc7a9d8d44403be7af0f6eb0759a2
<ide><path>lib/Cake/Database/Dialect/PostgresDialectTrait.php <ide> protected function _selectQueryTranslator($query) { <ide> return $query; <ide> } <ide> <del>/** <del> * Returns an update query that has been transformed for Postgres. <del> * <del> * Postgres requires joins to be defined in the FROM list instead of <del> * as standard joins. This translator will erase joins and replace them with <del> * an expression object in the FROM clause. <del> * <del> * @param Cake\Database\Query $query <del> * @return Cake\Database\Query <del> */ <del> protected function _updateQueryTranslator($query) { <del> $joins = $query->clause('join'); <del> if (empty($joins)) { <del> return $query; <del> } <del> $first = array_shift($joins); <del> $sql = sprintf('%s %s', $first['table'], $first['alias']); <del> if (isset($first['conditions']) && count($first['conditions'])) { <del> $query->where($first['conditions']); <del> } <del> foreach ($joins as $i => $join) { <del> $sql .= sprintf(' %s JOIN %s %s', $join['type'], $join['table'], $join['alias']); <del> if (isset($join['conditions']) && count($join['conditions'])) { <del> $sql .= sprintf(' ON %s', $join['conditions']); <del> } else { <del> $sql .= ' ON 1 = 1'; <del> } <del> } <del> $expr = $query->newExpr()->add($sql); <del> $query->join([], [], true); <del> $query->from([$expr]); <del> return $query; <del> } <del> <ide> /** <ide> * Returns a function that will be used as a callback for a results decorator. <ide> * this function is responsible for deleting the artificial column in results <ide><path>lib/Cake/Database/Query.php <ide> protected function _traverseDelete(callable $visitor) { <ide> * @return void <ide> */ <ide> protected function _traverseUpdate(callable $visitor) { <del> $parts = ['update', 'join', 'set', 'from', 'where']; <add> $parts = ['update', 'set', 'where']; <ide> foreach ($parts as $name) { <ide> call_user_func($visitor, $this->_parts[$name], $name); <ide> } <ide><path>lib/Cake/Test/TestCase/Database/Driver/PostgresTest.php <ide> public function testConnectionConfigCustom() { <ide> $driver->connect(); <ide> } <ide> <del> public function testUpdateWithJoin() { <del> $driver = $this->getMock('Cake\Database\driver\Postgres', ['_connect', 'connection']); <del> $connection = new Connection(Configure::read('Datasource.test')); <del> $connection->driver($driver); <del> <del> $query = new Query($connection); <del> <del> $query->update('articles') <del> ->set('title', 'New title') <del> ->join([ <del> 'table' => 'authors', <del> 'alias' => 'a', <del> 'conditions' => 'author_id = a.id' <del> ]) <del> ->join('comments') <del> ->where(['articles.id' => 1]); <del> $result = $query->sql(true); <del> <del> $this->assertContains('UPDATE articles SET title = :', $result); <del> $this->assertContains('FROM authors a INNER JOIN comments ON 1 = 1', $result); <del> $this->assertContains('WHERE (articles.id = :', $result); <del> $this->assertContains('AND author_id = a.id)', $result); <del> } <del> <ide> } <ide><path>lib/Cake/Test/TestCase/Database/QueryTest.php <ide> public function testUpdateWithExpression() { <ide> $this->assertCount(1, $result); <ide> } <ide> <del>/** <del> * Test updates with joins. <del> * <del> * @return void <del> */ <del> public function testUpdateWithJoins() { <del> $config = Configure::read('Datasource.test'); <del> $this->skipIf(strpos($config['datasource'], 'Sqlite') !== false, 'Sqlite update with join does not work.'); <del> <del> $query = new Query($this->connection); <del> <del> $query->update('articles') <del> ->set('title', 'New title') <del> ->join([ <del> 'table' => 'authors', <del> 'alias' => 'a', <del> 'conditions' => 'author_id = a.id' <del> ]) <del> ->where(['articles.id' => 1]); <del> $result = $query->sql(false); <del> <del> $this->assertContains('UPDATE articles INNER JOIN authors a ON author_id = a.id', $result); <del> $this->assertContains('SET title = :', $result); <del> $this->assertContains('WHERE articles.id = :', $result); <del> <del> $result = $query->execute(); <del> $this->assertCount(1, $result); <del> } <del> <ide> /** <ide> * You cannot call values() before insert() it causes all sorts of pain. <ide> *
4
Python
Python
add test for issue
6b215d2dd3c6915b4d1c5a46b2a890b14cae7d75
<ide><path>spacy/tests/regression/test_issue1537.py <add>'''Test Span.as_doc() doesn't segfault''' <add>from ...tokens import Doc <add>from ...vocab import Vocab <add>from ... import load as load_spacy <add> <add> <add>def test_issue1537(): <add> string = 'The sky is blue . The man is pink . The dog is purple .' <add> doc = Doc(Vocab(), words=string.split()) <add> doc[0].sent_start = True <add> for word in doc[1:]: <add> if word.nbor(-1).text == '.': <add> word.sent_start = True <add> else: <add> word.sent_start = False <add> <add> sents = list(doc.sents) <add> sent0 = sents[0].as_doc() <add> sent1 = sents[1].as_doc() <add> assert isinstance(sent0, Doc) <add> assert isinstance(sent1, Doc) <add> <add> <add># Currently segfaulting, due to l_edge and r_edge misalignment <add>#def test_issue1537_model(): <add># nlp = load_spacy('en') <add># doc = nlp(u'The sky is blue. The man is pink. The dog is purple.') <add># sents = [s.as_doc() for s in doc.sents] <add># print(list(sents[0].noun_chunks)) <add># print(list(sents[1].noun_chunks))
1
Java
Java
fix failing compositepropertysourcetests
5ba3db6a7d28494c4fbf3a908f5591bca0d90457
<ide><path>spring-core/src/test/java/org/springframework/core/env/CompositePropertySourceTests.java <ide> <ide> import org.junit.Test; <ide> <del>import static org.hamcrest.Matchers.*; <ide> import static org.junit.Assert.*; <ide> <ide> /** <ide> public void addFirst() { <ide> composite.addPropertySource(p3); <ide> composite.addPropertySource(p1); <ide> composite.addFirstPropertySource(p1); <del> assertThat(composite.toString(), containsString("MapPropertySource [name='p1'], " <del> + "MapPropertySource [name='p2'], MapPropertySource [name='p3']")); <add> String s = composite.toString(); <add> int i1 = s.indexOf("name='p1'"); <add> int i2 = s.indexOf("name='p2'"); <add> int i3 = s.indexOf("name='p3'"); <add> assertTrue("Bad order: " + s, ((i1 < i2) && (i2 < i3))); <ide> } <ide> <ide> }
1
Text
Text
update owasp link in docs for dangerous innerhtml
616e468987fc655bf5e7bc62b97fc86d3b5917e7
<ide><path>docs/tips/19-dangerously-set-inner-html.ko-KR.md <ide> permalink: tips/dangerously-set-inner-html-ko-KR.html <ide> prev: children-undefined-ko-KR.html <ide> --- <ide> <del>부적절히 `innerHTML`를 사용하면 [사이트 간 스크립팅 (XSS)](https://en.wikipedia.org/wiki/Cross-site_scripting) 공격에 노출됩니다. 화면의 사용자 입력을 정제하다(sanitize) 오류를 내기 쉬우며, 적절하게 사용자의 입력을 정제하지 못하면 인터넷 상 [웹 취약점의 원인](https://owasptop10.googlecode.com/files/OWASP%20Top%2010%20-%202013.pdf)이 됩니다. <add>부적절히 `innerHTML`를 사용하면 [사이트 간 스크립팅 (XSS)](https://en.wikipedia.org/wiki/Cross-site_scripting) 공격에 노출됩니다. 화면의 사용자 입력을 정제하다(sanitize) 오류를 내기 쉬우며, 적절하게 사용자의 입력을 정제하지 못하면 인터넷 상 [웹 취약점의 원인](https://www.owasp.org/index.php/Top_10_2013-Top_10)이 됩니다. <ide> <ide> 우리 설계철학은 안전을 "쉽게" 얻는 것입니다. 개발자는 그들의 의도를 명시적으로 알려야만 "안전하지 않는" 연산을 할 수 있습니다. `dangerouslySetInnerHTML` prop의 이름은 의도적으로 무섭게 만든 것인데, prop 값은 문자열이 아닌 객체이고 정제된 데이터를 지정하는데 쓸 수 있습니다. <ide> <ide><path>docs/tips/19-dangerously-set-inner-html.md <ide> permalink: tips/dangerously-set-inner-html.html <ide> prev: children-undefined.html <ide> --- <ide> <del>Improper use of the `innerHTML` can open you up to a [cross-site scripting (XSS)](https://en.wikipedia.org/wiki/Cross-site_scripting) attack. Sanitizing user input for display is notoriously error-prone, and failure to properly sanitize is one of the [leading causes of web vulnerabilities](https://owasptop10.googlecode.com/files/OWASP%20Top%2010%20-%202013.pdf) on the internet. <add>Improper use of the `innerHTML` can open you up to a [cross-site scripting (XSS)](https://en.wikipedia.org/wiki/Cross-site_scripting) attack. Sanitizing user input for display is notoriously error-prone, and failure to properly sanitize is one of the [leading causes of web vulnerabilities](https://www.owasp.org/index.php/Top_10_2013-Top_10) on the internet. <ide> <ide> Our design philosophy is that it should be “easy” to make things safe, and developers should explicitly state their intent when performing “unsafe” operations. The prop name `dangerouslySetInnerHTML` is intentionally chosen to be frightening, and the prop value (an object instead of a string) can be used to indicate sanitized data. <ide>
2
Ruby
Ruby
remove unused ivar
8d33be7d367af03de6706a05d1d8dfdeed91f446
<ide><path>actionpack/lib/action_dispatch/middleware/session/abstract_store.rb <ide> class Request <ide> class Session <ide> class Options #:nodoc: <ide> def initialize(by, env, default_options) <del> @by = by <del> @env = env <del> @session_id_loaded = false <del> @delegate = default_options <add> @by = by <add> @env = env <add> @delegate = default_options <ide> end <ide> <ide> def [](key)
1
Text
Text
add notes for 1.5.0 release
39eecd136f5782e85a92f611cf3e73ac6b97caf2
<ide><path>CHANGELOG.md <add><a name="1.5.0"></a> <add># 1.5.0 ennoblement-facilitation (2016-02-05) <add> <add>## Bug Fixes <add> <add>- **$parse:** Copy `inputs` for expressions with expensive checks <add> ([37cb9ad4](https://github.com/angular/angular.js/commit/37cb9ad43619e2b14055b3105a954f4474cd933c)) <add>- **$rootScope:** Set no `this` context when calling helper functions for `$watch` <add> ([1c6edd41](https://github.com/angular/angular.js/commit/1c6edd416b4baad0c8b01148f429eb78e0ad7eaa)) <add>- **$route:** allow route reload to be prevented <add> ([2f0a50b5](https://github.com/angular/angular.js/commit/2f0a50b526c5d0263879d3e845866e1af6fd9791), <add> [#9824](https://github.com/angular/angular.js/issues/9824), [#13894](https://github.com/angular/angular.js/issues/13894)) <add>- **dateFilter, input:** fix Date parsing in IE/Edge when timezone offset contains `:` <add> ([622c4216](https://github.com/angular/angular.js/commit/622c42169699ec07fc6daaa19fe6d224e5d2f70e), <add> [#13880](https://github.com/angular/angular.js/issues/13880), [#13887](https://github.com/angular/angular.js/issues/13887)) <add>- **ngAnimateChildren:** make it compatible with `ngIf` <add> ([8aecf46a](https://github.com/angular/angular.js/commit/8aecf46ad2b3324dd504a8083a61d5bf18d870ed), <add> [#13865](https://github.com/angular/angular.js/issues/13865), [#13876](https://github.com/angular/angular.js/issues/13876)) <add>- **ngAria:** Apply ARIA attrs correctly <add> ([d06431e5](https://github.com/angular/angular.js/commit/d06431e5309bb0125588877451dc79b935808134), <add> [#13078](https://github.com/angular/angular.js/issues/13078), [#11374](https://github.com/angular/angular.js/issues/11374), [#11830](https://github.com/angular/angular.js/issues/11830), [#13483](https://github.com/angular/angular.js/issues/13483)) <add>- **select:** handle the corner case of adding options via a custom directive <add> ([ca5b27bd](https://github.com/angular/angular.js/commit/ca5b27bd0b5243a25730be672c35dfed8ca1d28d), <add> [#13874](https://github.com/angular/angular.js/issues/13874), [#13878](https://github.com/angular/angular.js/issues/13878)) <add> <add> <add>## Features <add> <add>- **$compile:** add one-way binding to the isolate scope definition <add> ([4ac23c0a](https://github.com/angular/angular.js/commit/4ac23c0ac59c269d65b7f78efec75d060121bd18), <add> [#13928](https://github.com/angular/angular.js/issues/13928), [#13854](https://github.com/angular/angular.js/issues/13854), [#12835](https://github.com/angular/angular.js/issues/12835), [#13900](https://github.com/angular/angular.js/issues/13900)) <add> <add> <add>## Breaking Changes <add> <add>- **ngAria:** due to [d06431e5](https://github.com/angular/angular.js/commit/d06431e5309bb0125588877451dc79b935808134), <add> Where appropriate, ngAria now applies ARIA to custom controls only, not native inputs. Because of this, support for `aria-multiline` on textareas has been removed. <add> <add> <ide> <a name="1.5.0-rc.2"></a> <ide> # 1.5.0-rc.2 controller-requisition (2016-01-28) <ide>
1
Ruby
Ruby
remove duplication in test
0ebf45cf5d3119db3a3794df14a331f7bbea0e82
<ide><path>activesupport/test/concern_test.rb <ide> def test_class_methods_are_extended <ide> assert_equal ConcernTest::Baz::ClassMethods, (class << @klass; self.included_modules; end)[0] <ide> end <ide> <del> def test_instance_methods_are_included <del> @klass.send(:include, Baz) <del> assert_equal "baz", @klass.new.baz <del> assert @klass.included_modules.include?(ConcernTest::Baz) <del> end <del> <ide> def test_included_block_is_ran <ide> @klass.send(:include, Baz) <ide> assert_equal true, @klass.included_ran
1
PHP
PHP
remove useless closure comment
64c9c13734dd9468ee014d01e95fc81ed127182c
<ide><path>src/Illuminate/Broadcasting/Broadcasters/Broadcaster.php <ide> protected function binder() <ide> * Normalize the given callback into a callable. <ide> * <ide> * @param mixed $callback <del> * @return \Closure|callable <add> * @return callable <ide> */ <ide> protected function normalizeChannelHandlerToCallable($callback) <ide> { <ide><path>src/Illuminate/Contracts/Routing/Registrar.php <ide> interface Registrar <ide> * Register a new GET route with the router. <ide> * <ide> * @param string $uri <del> * @param \Closure|array|string|callable $action <add> * @param array|string|callable $action <ide> * @return \Illuminate\Routing\Route <ide> */ <ide> public function get($uri, $action); <ide> public function get($uri, $action); <ide> * Register a new POST route with the router. <ide> * <ide> * @param string $uri <del> * @param \Closure|array|string|callable $action <add> * @param array|string|callable $action <ide> * @return \Illuminate\Routing\Route <ide> */ <ide> public function post($uri, $action); <ide> public function post($uri, $action); <ide> * Register a new PUT route with the router. <ide> * <ide> * @param string $uri <del> * @param \Closure|array|string|callable $action <add> * @param array|string|callable $action <ide> * @return \Illuminate\Routing\Route <ide> */ <ide> public function put($uri, $action); <ide> public function put($uri, $action); <ide> * Register a new DELETE route with the router. <ide> * <ide> * @param string $uri <del> * @param \Closure|array|string|callable $action <add> * @param array|string|callable $action <ide> * @return \Illuminate\Routing\Route <ide> */ <ide> public function delete($uri, $action); <ide> public function delete($uri, $action); <ide> * Register a new PATCH route with the router. <ide> * <ide> * @param string $uri <del> * @param \Closure|array|string|callable $action <add> * @param array|string|callable $action <ide> * @return \Illuminate\Routing\Route <ide> */ <ide> public function patch($uri, $action); <ide> public function patch($uri, $action); <ide> * Register a new OPTIONS route with the router. <ide> * <ide> * @param string $uri <del> * @param \Closure|array|string|callable $action <add> * @param array|string|callable $action <ide> * @return \Illuminate\Routing\Route <ide> */ <ide> public function options($uri, $action); <ide> public function options($uri, $action); <ide> * <ide> * @param array|string $methods <ide> * @param string $uri <del> * @param \Closure|array|string|callable $action <add> * @param array|string|callable $action <ide> * @return \Illuminate\Routing\Route <ide> */ <ide> public function match($methods, $uri, $action); <ide><path>src/Illuminate/Routing/Router.php <ide> public function __construct(Dispatcher $events, Container $container = null) <ide> * Register a new GET route with the router. <ide> * <ide> * @param string $uri <del> * @param \Closure|array|string|callable|null $action <add> * @param array|string|callable|null $action <ide> * @return \Illuminate\Routing\Route <ide> */ <ide> public function get($uri, $action = null) <ide> public function get($uri, $action = null) <ide> * Register a new POST route with the router. <ide> * <ide> * @param string $uri <del> * @param \Closure|array|string|callable|null $action <add> * @param array|string|callable|null $action <ide> * @return \Illuminate\Routing\Route <ide> */ <ide> public function post($uri, $action = null) <ide> public function post($uri, $action = null) <ide> * Register a new PUT route with the router. <ide> * <ide> * @param string $uri <del> * @param \Closure|array|string|callable|null $action <add> * @param array|string|callable|null $action <ide> * @return \Illuminate\Routing\Route <ide> */ <ide> public function put($uri, $action = null) <ide> public function put($uri, $action = null) <ide> * Register a new PATCH route with the router. <ide> * <ide> * @param string $uri <del> * @param \Closure|array|string|callable|null $action <add> * @param array|string|callable|null $action <ide> * @return \Illuminate\Routing\Route <ide> */ <ide> public function patch($uri, $action = null) <ide> public function patch($uri, $action = null) <ide> * Register a new DELETE route with the router. <ide> * <ide> * @param string $uri <del> * @param \Closure|array|string|callable|null $action <add> * @param array|string|callable|null $action <ide> * @return \Illuminate\Routing\Route <ide> */ <ide> public function delete($uri, $action = null) <ide> public function delete($uri, $action = null) <ide> * Register a new OPTIONS route with the router. <ide> * <ide> * @param string $uri <del> * @param \Closure|array|string|callable|null $action <add> * @param array|string|callable|null $action <ide> * @return \Illuminate\Routing\Route <ide> */ <ide> public function options($uri, $action = null) <ide> public function options($uri, $action = null) <ide> * Register a new route responding to all verbs. <ide> * <ide> * @param string $uri <del> * @param \Closure|array|string|callable|null $action <add> * @param array|string|callable|null $action <ide> * @return \Illuminate\Routing\Route <ide> */ <ide> public function any($uri, $action = null) <ide> public function any($uri, $action = null) <ide> /** <ide> * Register a new Fallback route with the router. <ide> * <del> * @param \Closure|array|string|callable|null $action <add> * @param array|string|callable|null $action <ide> * @return \Illuminate\Routing\Route <ide> */ <ide> public function fallback($action) <ide> public function view($uri, $view, $data = []) <ide> * <ide> * @param array|string $methods <ide> * @param string $uri <del> * @param \Closure|array|string|callable|null $action <add> * @param array|string|callable|null $action <ide> * @return \Illuminate\Routing\Route <ide> */ <ide> public function match($methods, $uri, $action = null) <ide> public function getLastGroupPrefix() <ide> * <ide> * @param array|string $methods <ide> * @param string $uri <del> * @param \Closure|array|string|callable|null $action <add> * @param array|string|callable|null $action <ide> * @return \Illuminate\Routing\Route <ide> */ <ide> public function addRoute($methods, $uri, $action) <ide><path>src/Illuminate/Support/Facades/Route.php <ide> namespace Illuminate\Support\Facades; <ide> <ide> /** <del> * @method static \Illuminate\Routing\Route fallback(\Closure|array|string|callable|null $action = null) <del> * @method static \Illuminate\Routing\Route get(string $uri, \Closure|array|string|callable|null $action = null) <del> * @method static \Illuminate\Routing\Route post(string $uri, \Closure|array|string|callable|null $action = null) <del> * @method static \Illuminate\Routing\Route put(string $uri, \Closure|array|string|callable|null $action = null) <del> * @method static \Illuminate\Routing\Route delete(string $uri, \Closure|array|string|callable|null $action = null) <del> * @method static \Illuminate\Routing\Route patch(string $uri, \Closure|array|string|callable|null $action = null) <del> * @method static \Illuminate\Routing\Route options(string $uri, \Closure|array|string|callable|null $action = null) <del> * @method static \Illuminate\Routing\Route any(string $uri, \Closure|array|string|callable|null $action = null) <del> * @method static \Illuminate\Routing\Route match(array|string $methods, string $uri, \Closure|array|string|callable|null $action = null) <add> * @method static \Illuminate\Routing\Route fallback(array|string|callable|null $action = null) <add> * @method static \Illuminate\Routing\Route get(string $uri, array|string|callable|null $action = null) <add> * @method static \Illuminate\Routing\Route post(string $uri, array|string|callable|null $action = null) <add> * @method static \Illuminate\Routing\Route put(string $uri, array|string|callable|null $action = null) <add> * @method static \Illuminate\Routing\Route delete(string $uri, array|string|callable|null $action = null) <add> * @method static \Illuminate\Routing\Route patch(string $uri, array|string|callable|null $action = null) <add> * @method static \Illuminate\Routing\Route options(string $uri, array|string|callable|null $action = null) <add> * @method static \Illuminate\Routing\Route any(string $uri, array|string|callable|null $action = null) <add> * @method static \Illuminate\Routing\Route match(array|string $methods, string $uri, array|string|callable|null $action = null) <ide> * @method static \Illuminate\Routing\RouteRegistrar prefix(string $prefix) <ide> * @method static \Illuminate\Routing\RouteRegistrar where(array $where) <ide> * @method static \Illuminate\Routing\PendingResourceRegistration resource(string $name, string $controller, array $options = [])
4
Ruby
Ruby
keep track of pruned parent directories
e4b951520aafc3e5b4e9719d5b38962022f6133e
<ide><path>Library/Homebrew/keg.rb <ide> def unlink <ide> next unless dir.exist? <ide> dir.find do |src| <ide> next if src == self <del> dst=HOMEBREW_PREFIX+src.relative_path_from(self) <del> dst.extend ObserverPathnameExtension <add> dst = HOMEBREW_PREFIX + src.relative_path_from(self) <add> dst.extend(ObserverPathnameExtension) <ide> <ide> # check whether the file to be unlinked is from the current keg first <ide> if !dst.symlink? || !dst.exist? || src != dst.resolved_path <ide> def unlink <ide> <ide> dst.uninstall_info if dst.to_s =~ INFOFILE_RX and ENV['HOMEBREW_KEEP_INFO'] <ide> dst.unlink <del> dst.parent.rmdir_if_possible <add> dst.parent.extend(ObserverPathnameExtension).rmdir_if_possible <ide> Find.prune if src.directory? <ide> end <ide> end <ide><path>Library/Homebrew/test/test_keg.rb <ide> def test_linking_keg <ide> <ide> def test_unlinking_keg <ide> @keg.link <del> assert_equal 3, @keg.unlink <add> assert_equal 4, @keg.unlink <ide> end <ide> <ide> def test_link_dry_run
2
Python
Python
drop environment markers from setup.py
0adf1392568b10cbbf69ea56771db988e9767b2b
<ide><path>setup.py <ide> def run(self): <ide> 'export': ['bernhard', 'cassandra-driver', 'couchdb', 'elasticsearch', <ide> 'influxdb>=1.0.0', 'kafka-python', 'pika', 'potsdb', <ide> 'prometheus_client', 'pyzmq', 'statsd'], <del> 'folders:python_version<"3.5"': ['scandir'], <del> 'gpu:python_version=="2.7"': ['nvidia-ml-py'], <add> 'folders': ['scandir'], # python_version<"3.5" <add> 'gpu': ['nvidia-ml-py'], # python_version=="2.7" <ide> 'ip': ['netifaces'], <ide> 'raid': ['pymdstat'], <ide> 'snmp': ['pysnmp'],
1
PHP
PHP
mode return docblock.
0b70896854e1790fd40f52683c6f7b27658d0a3d
<ide><path>src/Illuminate/Support/Collection.php <ide> public function median($key = null) <ide> * Get the mode of a given key. <ide> * <ide> * @param mixed $key <del> * @return array <add> * @return array|null <ide> */ <ide> public function mode($key = null) <ide> {
1
Javascript
Javascript
fix lazy loading on node.js
b5413e6baf4768cf78c817296349e485b76bccb4
<ide><path>src/lib/locale/locales.js <ide> function loadLocale(name) { <ide> require('./locale/' + name); <ide> // because defineLocale currently also sets the global locale, we <ide> // want to undo that for lazy loaded locales <del> moment.locale(oldLocale); <add> getSetGlobalLocale(oldLocale); <ide> } catch (e) { } <ide> } <ide> return locales[name];
1
PHP
PHP
convert array syntax
823c7318eed8923a9b998da8a5ede64aa4849045
<ide><path>lib/Cake/Utility/ViewVarsTrait.php <ide> trait ViewVarsTrait { <ide> * <ide> * @var array <ide> */ <del> public $viewVars = array(); <add> public $viewVars = []; <ide> <ide> /** <ide> * Saves a variable for use inside a template. <ide> public function set($one, $two = null) { <ide> $data = $one; <ide> } <ide> } else { <del> $data = array($one => $two); <add> $data = [$one => $two]; <ide> } <ide> $this->viewVars = $data + $this->viewVars; <ide> }
1
Go
Go
move containers to a job
5ea2986ce5cfce1b86fdc92610dbc6d670691168
<ide><path>api.go <ide> func getContainersJSON(srv *Server, version float64, w http.ResponseWriter, r *h <ide> if err := parseForm(r); err != nil { <ide> return err <ide> } <del> all, err := getBoolParam(r.Form.Get("all")) <del> if err != nil { <add> var ( <add> err error <add> outs *engine.Table <add> job = srv.Eng.Job("containers") <add> ) <add> <add> job.Setenv("all", r.Form.Get("all")) <add> job.Setenv("size", r.Form.Get("size")) <add> job.Setenv("since", r.Form.Get("since")) <add> job.Setenv("before", r.Form.Get("before")) <add> job.Setenv("limit", r.Form.Get("limit")) <add> <add> if version > 1.5 { <add> job.Stdout.Add(w) <add> } else if outs, err = job.Stdout.AddTable(); err != nil { <ide> return err <ide> } <del> size, err := getBoolParam(r.Form.Get("size")) <del> if err != nil { <add> if err = job.Run(); err != nil { <ide> return err <ide> } <del> since := r.Form.Get("since") <del> before := r.Form.Get("before") <del> n, err := strconv.Atoi(r.Form.Get("limit")) <del> if err != nil { <del> n = -1 <del> } <del> <del> outs := srv.Containers(all, size, n, since, before) <del> <del> if version < 1.5 { <del> outs2 := []APIContainersOld{} <del> for _, ctnr := range outs { <del> outs2 = append(outs2, *ctnr.ToLegacy()) <add> if version < 1.5 { // Convert to legacy format <add> for _, out := range outs.Data { <add> ports := engine.NewTable("", 0) <add> ports.ReadListFrom([]byte(out.Get("Ports"))) <add> out.Set("Ports", displayablePorts(ports)) <add> } <add> if _, err = outs.WriteListTo(w); err != nil { <add> return err <ide> } <del> <del> return writeJSON(w, http.StatusOK, outs2) <ide> } <del> return writeJSON(w, http.StatusOK, outs) <add> return nil <ide> } <ide> <ide> func postImagesTag(srv *Server, version float64, w http.ResponseWriter, r *http.Request, vars map[string]string) error { <ide><path>api_params.go <ide> type ( <ide> Untagged string `json:",omitempty"` <ide> } <ide> <del> APIContainers struct { <del> ID string `json:"Id"` <del> Image string <del> Command string <del> Created int64 <del> Status string <del> Ports []APIPort <del> SizeRw int64 <del> SizeRootFs int64 <del> Names []string <del> } <del> <del> APIContainersOld struct { <del> ID string `json:"Id"` <del> Image string <del> Command string <del> Created int64 <del> Status string <del> Ports string <del> SizeRw int64 <del> SizeRootFs int64 <del> } <del> <ide> APIID struct { <ide> ID string `json:"Id"` <ide> } <ide> type ( <ide> HostPath string <ide> } <ide> ) <del> <del>func (api APIContainers) ToLegacy() *APIContainersOld { <del> return &APIContainersOld{ <del> ID: api.ID, <del> Image: api.Image, <del> Command: api.Command, <del> Created: api.Created, <del> Status: api.Status, <del> Ports: displayablePorts(api.Ports), <del> SizeRw: api.SizeRw, <del> SizeRootFs: api.SizeRootFs, <del> } <del>} <ide><path>commands.go <ide> func (cli *DockerCli) printTreeNode(noTrunc bool, image *engine.Env, prefix stri <ide> } <ide> } <ide> <del>func displayablePorts(ports []APIPort) string { <add>func displayablePorts(ports *engine.Table) string { <ide> result := []string{} <del> for _, port := range ports { <del> if port.IP == "" { <del> result = append(result, fmt.Sprintf("%d/%s", port.PublicPort, port.Type)) <add> for _, port := range ports.Data { <add> if port.Get("IP") == "" { <add> result = append(result, fmt.Sprintf("%d/%s", port.GetInt("PublicPort"), port.Get("Type"))) <ide> } else { <del> result = append(result, fmt.Sprintf("%s:%d->%d/%s", port.IP, port.PublicPort, port.PrivatePort, port.Type)) <add> result = append(result, fmt.Sprintf("%s:%d->%d/%s", port.Get("IP"), port.GetInt("PublicPort"), port.GetInt("PrivatePort"), port.Get("Type"))) <ide> } <ide> } <ide> sort.Strings(result) <ide> func (cli *DockerCli) CmdPs(args ...string) error { <ide> return err <ide> } <ide> <del> var outs []APIContainers <del> err = json.Unmarshal(body, &outs) <del> if err != nil { <add> outs := engine.NewTable("Created", 0) <add> if _, err := outs.ReadListFrom(body); err != nil { <ide> return err <ide> } <ide> w := tabwriter.NewWriter(cli.out, 20, 1, 3, ' ', 0) <ide> func (cli *DockerCli) CmdPs(args ...string) error { <ide> } <ide> } <ide> <del> for _, out := range outs { <add> for _, out := range outs.Data { <add> var ( <add> outID = out.Get("ID") <add> outNames = out.GetList("Names") <add> ) <add> <ide> if !*noTrunc { <del> out.ID = utils.TruncateID(out.ID) <add> outID = utils.TruncateID(outID) <ide> } <ide> <ide> // Remove the leading / from the names <del> for i := 0; i < len(out.Names); i++ { <del> out.Names[i] = out.Names[i][1:] <add> for i := 0; i < len(outNames); i++ { <add> outNames[i] = outNames[i][1:] <ide> } <ide> <ide> if !*quiet { <add> var ( <add> outCommand = out.Get("Command") <add> ports = engine.NewTable("", 0) <add> ) <ide> if !*noTrunc { <del> out.Command = utils.Trunc(out.Command, 20) <add> outCommand = utils.Trunc(outCommand, 20) <ide> } <del> fmt.Fprintf(w, "%s\t%s\t%s\t%s ago\t%s\t%s\t%s\t", out.ID, out.Image, out.Command, utils.HumanDuration(time.Now().UTC().Sub(time.Unix(out.Created, 0))), out.Status, displayablePorts(out.Ports), strings.Join(out.Names, ",")) <add> ports.ReadListFrom([]byte(out.Get("Ports"))) <add> fmt.Fprintf(w, "%s\t%s\t%s\t%s ago\t%s\t%s\t%s\t", outID, out.Get("Image"), outCommand, utils.HumanDuration(time.Now().UTC().Sub(time.Unix(out.GetInt64("Created"), 0))), out.Get("Status"), displayablePorts(ports), strings.Join(outNames, ",")) <ide> if *size { <del> if out.SizeRootFs > 0 { <del> fmt.Fprintf(w, "%s (virtual %s)\n", utils.HumanSize(out.SizeRw), utils.HumanSize(out.SizeRootFs)) <add> if out.GetInt("SizeRootFs") > 0 { <add> fmt.Fprintf(w, "%s (virtual %s)\n", utils.HumanSize(out.GetInt64("SizeRw")), utils.HumanSize(out.GetInt64("SizeRootFs"))) <ide> } else { <del> fmt.Fprintf(w, "%s\n", utils.HumanSize(out.SizeRw)) <add> fmt.Fprintf(w, "%s\n", utils.HumanSize(out.GetInt64("SizeRw"))) <ide> } <ide> } else { <ide> fmt.Fprint(w, "\n") <ide> } <ide> } else { <del> fmt.Fprintln(w, out.ID) <add> fmt.Fprintln(w, outID) <ide> } <ide> } <ide> <ide><path>container.go <ide> import ( <ide> "errors" <ide> "fmt" <ide> "github.com/dotcloud/docker/archive" <add> "github.com/dotcloud/docker/engine" <ide> "github.com/dotcloud/docker/execdriver" <ide> "github.com/dotcloud/docker/graphdriver" <ide> "github.com/dotcloud/docker/networkdriver/ipallocator" <ide> type NetworkSettings struct { <ide> Ports map[Port][]PortBinding <ide> } <ide> <del>func (settings *NetworkSettings) PortMappingAPI() []APIPort { <del> var mapping []APIPort <add>func (settings *NetworkSettings) PortMappingAPI() *engine.Table { <add> var outs = engine.NewTable("", 0) <ide> for port, bindings := range settings.Ports { <ide> p, _ := parsePort(port.Port()) <ide> if len(bindings) == 0 { <del> mapping = append(mapping, APIPort{ <del> PublicPort: int64(p), <del> Type: port.Proto(), <del> }) <add> out := &engine.Env{} <add> out.SetInt("PublicPort", p) <add> out.Set("Type", port.Proto()) <add> outs.Add(out) <ide> continue <ide> } <ide> for _, binding := range bindings { <del> p, _ := parsePort(port.Port()) <add> out := &engine.Env{} <ide> h, _ := parsePort(binding.HostPort) <del> mapping = append(mapping, APIPort{ <del> PrivatePort: int64(p), <del> PublicPort: int64(h), <del> Type: port.Proto(), <del> IP: binding.HostIp, <del> }) <add> out.SetInt("PrivatePort", p) <add> out.SetInt("PublicPort", h) <add> out.Set("Type", port.Proto()) <add> out.Set("IP", binding.HostIp) <add> outs.Add(out) <ide> } <ide> } <del> return mapping <add> return outs <ide> } <ide> <ide> // Inject the io.Reader at the given path. Note: do not close the reader <ide><path>engine/env.go <ide> func (t *Table) WriteListTo(dst io.Writer) (n int64, err error) { <ide> return n + 1, nil <ide> } <ide> <add>func (t *Table) ToListString() (string, error) { <add> buffer := bytes.NewBuffer(nil) <add> if _, err := t.WriteListTo(buffer); err != nil { <add> return "", err <add> } <add> return buffer.String(), nil <add>} <add> <ide> func (t *Table) WriteTo(dst io.Writer) (n int64, err error) { <ide> for _, env := range t.Data { <ide> bytes, err := env.WriteTo(dst) <ide><path>integration/api_test.go <ide> func TestGetContainersJSON(t *testing.T) { <ide> defer mkRuntimeFromEngine(eng, t).Nuke() <ide> srv := mkServerFromEngine(eng, t) <ide> <del> beginLen := len(srv.Containers(true, false, -1, "", "")) <add> job := eng.Job("containers") <add> job.SetenvBool("all", true) <add> outs, err := job.Stdout.AddTable() <add> if err != nil { <add> t.Fatal(err) <add> } <add> if err := job.Run(); err != nil { <add> t.Fatal(err) <add> } <add> beginLen := len(outs.Data) <ide> <ide> containerID := createTestContainer(eng, &docker.Config{ <ide> Image: unitTestImageID, <ide> func TestGetContainersJSON(t *testing.T) { <ide> t.Fatal(err) <ide> } <ide> assertHttpNotError(r, t) <del> containers := []docker.APIContainers{} <del> if err := json.Unmarshal(r.Body.Bytes(), &containers); err != nil { <add> containers := engine.NewTable("", 0) <add> if _, err := containers.ReadListFrom(r.Body.Bytes()); err != nil { <ide> t.Fatal(err) <ide> } <del> if len(containers) != beginLen+1 { <del> t.Fatalf("Expected %d container, %d found (started with: %d)", beginLen+1, len(containers), beginLen) <add> if len(containers.Data) != beginLen+1 { <add> t.Fatalf("Expected %d container, %d found (started with: %d)", beginLen+1, len(containers.Data), beginLen) <ide> } <del> if containers[0].ID != containerID { <del> t.Fatalf("Container ID mismatch. Expected: %s, received: %s\n", containerID, containers[0].ID) <add> if id := containers.Data[0].Get("ID"); id != containerID { <add> t.Fatalf("Container ID mismatch. Expected: %s, received: %s\n", containerID, id) <ide> } <ide> } <ide> <ide><path>integration/server_test.go <ide> func TestImageTagImageDelete(t *testing.T) { <ide> <ide> func TestCreateRm(t *testing.T) { <ide> eng := NewTestEngine(t) <del> srv := mkServerFromEngine(eng, t) <ide> defer mkRuntimeFromEngine(eng, t).Nuke() <ide> <ide> config, _, _, err := docker.ParseRun([]string{unitTestImageID, "echo test"}, nil) <ide> func TestCreateRm(t *testing.T) { <ide> <ide> id := createTestContainer(eng, config, t) <ide> <del> if c := srv.Containers(true, false, -1, "", ""); len(c) != 1 { <del> t.Errorf("Expected 1 container, %v found", len(c)) <add> job := eng.Job("containers") <add> job.SetenvBool("all", true) <add> outs, err := job.Stdout.AddListTable() <add> if err != nil { <add> t.Fatal(err) <add> } <add> if err := job.Run(); err != nil { <add> t.Fatal(err) <add> } <add> <add> if len(outs.Data) != 1 { <add> t.Errorf("Expected 1 container, %v found", len(outs.Data)) <ide> } <ide> <del> job := eng.Job("container_delete", id) <add> job = eng.Job("container_delete", id) <ide> job.SetenvBool("removeVolume", true) <ide> if err := job.Run(); err != nil { <ide> t.Fatal(err) <ide> } <ide> <del> if c := srv.Containers(true, false, -1, "", ""); len(c) != 0 { <del> t.Errorf("Expected 0 container, %v found", len(c)) <add> job = eng.Job("containers") <add> job.SetenvBool("all", true) <add> outs, err = job.Stdout.AddListTable() <add> if err != nil { <add> t.Fatal(err) <add> } <add> if err := job.Run(); err != nil { <add> t.Fatal(err) <add> } <add> <add> if len(outs.Data) != 0 { <add> t.Errorf("Expected 0 container, %v found", len(outs.Data)) <ide> } <ide> <ide> } <ide> <ide> func TestCreateRmVolumes(t *testing.T) { <ide> eng := NewTestEngine(t) <del> srv := mkServerFromEngine(eng, t) <ide> defer mkRuntimeFromEngine(eng, t).Nuke() <ide> <ide> config, hostConfig, _, err := docker.ParseRun([]string{"-v", "/srv", unitTestImageID, "echo", "test"}, nil) <ide> func TestCreateRmVolumes(t *testing.T) { <ide> <ide> id := createTestContainer(eng, config, t) <ide> <del> if c := srv.Containers(true, false, -1, "", ""); len(c) != 1 { <del> t.Errorf("Expected 1 container, %v found", len(c)) <add> job := eng.Job("containers") <add> job.SetenvBool("all", true) <add> outs, err := job.Stdout.AddListTable() <add> if err != nil { <add> t.Fatal(err) <add> } <add> if err := job.Run(); err != nil { <add> t.Fatal(err) <ide> } <ide> <del> job := eng.Job("start", id) <add> if len(outs.Data) != 1 { <add> t.Errorf("Expected 1 container, %v found", len(outs.Data)) <add> } <add> <add> job = eng.Job("start", id) <ide> if err := job.ImportEnv(hostConfig); err != nil { <ide> t.Fatal(err) <ide> } <ide> func TestCreateRmVolumes(t *testing.T) { <ide> t.Fatal(err) <ide> } <ide> <del> if c := srv.Containers(true, false, -1, "", ""); len(c) != 0 { <del> t.Errorf("Expected 0 container, %v found", len(c)) <add> job = eng.Job("containers") <add> job.SetenvBool("all", true) <add> outs, err = job.Stdout.AddListTable() <add> if err != nil { <add> t.Fatal(err) <add> } <add> if err := job.Run(); err != nil { <add> t.Fatal(err) <add> } <add> <add> if len(outs.Data) != 0 { <add> t.Errorf("Expected 0 container, %v found", len(outs.Data)) <ide> } <ide> } <ide> <ide> func TestRestartKillWait(t *testing.T) { <ide> <ide> id := createTestContainer(eng, config, t) <ide> <del> if c := srv.Containers(true, false, -1, "", ""); len(c) != 1 { <del> t.Errorf("Expected 1 container, %v found", len(c)) <add> job := eng.Job("containers") <add> job.SetenvBool("all", true) <add> outs, err := job.Stdout.AddListTable() <add> if err != nil { <add> t.Fatal(err) <add> } <add> if err := job.Run(); err != nil { <add> t.Fatal(err) <ide> } <ide> <del> job := eng.Job("start", id) <add> if len(outs.Data) != 1 { <add> t.Errorf("Expected 1 container, %v found", len(outs.Data)) <add> } <add> <add> job = eng.Job("start", id) <ide> if err := job.ImportEnv(hostConfig); err != nil { <ide> t.Fatal(err) <ide> } <ide> func TestRestartKillWait(t *testing.T) { <ide> } <ide> <ide> srv = mkServerFromEngine(eng, t) <del> c := srv.Containers(true, false, -1, "", "") <del> if len(c) != 1 { <del> t.Errorf("Expected 1 container, %v found", len(c)) <add> <add> job = srv.Eng.Job("containers") <add> job.SetenvBool("all", true) <add> outs, err = job.Stdout.AddListTable() <add> if err != nil { <add> t.Fatal(err) <add> } <add> if err := job.Run(); err != nil { <add> t.Fatal(err) <add> } <add> <add> if len(outs.Data) != 1 { <add> t.Errorf("Expected 1 container, %v found", len(outs.Data)) <ide> } <ide> <ide> setTimeout(t, "Waiting on stopped container timedout", 5*time.Second, func() { <del> job = srv.Eng.Job("wait", c[0].ID) <add> job = srv.Eng.Job("wait", outs.Data[0].Get("ID")) <ide> var statusStr string <ide> job.Stdout.AddString(&statusStr) <ide> if err := job.Run(); err != nil { <ide> func TestCreateStartRestartStopStartKillRm(t *testing.T) { <ide> <ide> id := createTestContainer(eng, config, t) <ide> <del> if c := srv.Containers(true, false, -1, "", ""); len(c) != 1 { <del> t.Errorf("Expected 1 container, %v found", len(c)) <add> job := srv.Eng.Job("containers") <add> job.SetenvBool("all", true) <add> outs, err := job.Stdout.AddListTable() <add> if err != nil { <add> t.Fatal(err) <add> } <add> if err := job.Run(); err != nil { <add> t.Fatal(err) <add> } <add> <add> if len(outs.Data) != 1 { <add> t.Errorf("Expected 1 container, %v found", len(outs.Data)) <ide> } <ide> <del> job := eng.Job("start", id) <add> job = eng.Job("start", id) <ide> if err := job.ImportEnv(hostConfig); err != nil { <ide> t.Fatal(err) <ide> } <ide> func TestCreateStartRestartStopStartKillRm(t *testing.T) { <ide> t.Fatal(err) <ide> } <ide> <del> if c := srv.Containers(true, false, -1, "", ""); len(c) != 0 { <del> t.Errorf("Expected 0 container, %v found", len(c)) <add> job = srv.Eng.Job("containers") <add> job.SetenvBool("all", true) <add> outs, err = job.Stdout.AddListTable() <add> if err != nil { <add> t.Fatal(err) <add> } <add> if err := job.Run(); err != nil { <add> t.Fatal(err) <add> } <add> <add> if len(outs.Data) != 0 { <add> t.Errorf("Expected 0 container, %v found", len(outs.Data)) <ide> } <ide> } <ide> <ide> func TestDeleteTagWithExistingContainers(t *testing.T) { <ide> t.Fatal("No id returned") <ide> } <ide> <del> containers := srv.Containers(true, false, -1, "", "") <add> job := srv.Eng.Job("containers") <add> job.SetenvBool("all", true) <add> outs, err := job.Stdout.AddListTable() <add> if err != nil { <add> t.Fatal(err) <add> } <add> if err := job.Run(); err != nil { <add> t.Fatal(err) <add> } <ide> <del> if len(containers) != 1 { <del> t.Fatalf("Expected 1 container got %d", len(containers)) <add> if len(outs.Data) != 1 { <add> t.Fatalf("Expected 1 container got %d", len(outs.Data)) <ide> } <ide> <ide> // Try to remove the tag <ide><path>server.go <ide> func jobInitApi(job *engine.Job) engine.Status { <ide> "inspect": srv.JobInspect, <ide> "events": srv.Events, <ide> "push": srv.ImagePush, <add> "containers": srv.Containers, <ide> } { <ide> if err := job.Eng.Register(name, handler); err != nil { <ide> job.Error(err) <ide> func (srv *Server) ContainerChanges(job *engine.Job) engine.Status { <ide> return engine.StatusOK <ide> } <ide> <del>func (srv *Server) Containers(all, size bool, n int, since, before string) []APIContainers { <del> var foundBefore bool <del> var displayed int <del> out := []APIContainers{} <add>func (srv *Server) Containers(job *engine.Job) engine.Status { <add> var ( <add> foundBefore bool <add> displayed int <add> all = job.GetenvBool("all") <add> since = job.Getenv("since") <add> before = job.Getenv("before") <add> n = job.GetenvInt("limit") <add> size = job.GetenvBool("size") <add> ) <add> outs := engine.NewTable("Created", 0) <ide> <ide> names := map[string][]string{} <ide> srv.runtime.containerGraph.Walk("/", func(p string, e *graphdb.Entity) error { <ide> func (srv *Server) Containers(all, size bool, n int, since, before string) []API <ide> break <ide> } <ide> displayed++ <del> c := createAPIContainer(names[container.ID], container, size, srv.runtime) <del> out = append(out, c) <del> } <del> return out <del>} <del> <del>func createAPIContainer(names []string, container *Container, size bool, runtime *Runtime) APIContainers { <del> c := APIContainers{ <del> ID: container.ID, <add> out := &engine.Env{} <add> out.Set("ID", container.ID) <add> out.SetList("Names", names[container.ID]) <add> out.Set("Image", srv.runtime.repositories.ImageName(container.Image)) <add> out.Set("Command", fmt.Sprintf("%s %s", container.Path, strings.Join(container.Args, " "))) <add> out.SetInt64("Created", container.Created.Unix()) <add> out.Set("Status", container.State.String()) <add> str, err := container.NetworkSettings.PortMappingAPI().ToListString() <add> if err != nil { <add> job.Error(err) <add> return engine.StatusErr <add> } <add> out.Set("Ports", str) <add> if size { <add> sizeRw, sizeRootFs := container.GetSize() <add> out.SetInt64("SizeRw", sizeRw) <add> out.SetInt64("SizeRootFs", sizeRootFs) <add> } <add> outs.Add(out) <ide> } <del> c.Names = names <del> c.Image = runtime.repositories.ImageName(container.Image) <del> c.Command = fmt.Sprintf("%s %s", container.Path, strings.Join(container.Args, " ")) <del> c.Created = container.Created.Unix() <del> c.Status = container.State.String() <del> c.Ports = container.NetworkSettings.PortMappingAPI() <del> if size { <del> c.SizeRw, c.SizeRootFs = container.GetSize() <add> outs.ReverseSort() <add> if _, err := outs.WriteListTo(job.Stdout); err != nil { <add> job.Error(err) <add> return engine.StatusErr <ide> } <del> return c <add> return engine.StatusOK <ide> } <add> <ide> func (srv *Server) ContainerCommit(job *engine.Job) engine.Status { <ide> if len(job.Args) != 1 { <ide> job.Errorf("Not enough arguments. Usage: %s CONTAINER\n", job.Name)
8
Go
Go
add unit test for (*pattern).compile
8d250be008ea6521956a50e201f7e2a653e1a6c3
<ide><path>pkg/fileutils/fileutils.go <ide> func (p *Pattern) Exclusion() bool { <ide> <ide> func (p *Pattern) match(path string) (bool, error) { <ide> if p.matchType == unknownMatch { <del> if err := p.compile(); err != nil { <add> if err := p.compile(string(os.PathSeparator)); err != nil { <ide> return false, filepath.ErrBadPattern <ide> } <ide> } <ide> func (p *Pattern) match(path string) (bool, error) { <ide> return false, nil <ide> } <ide> <del>func (p *Pattern) compile() error { <add>func (p *Pattern) compile(sl string) error { <ide> regStr := "^" <ide> pattern := p.cleanedPattern <ide> // Go through the pattern and convert it to a regexp. <ide> // We use a scanner so we can support utf-8 chars. <ide> var scan scanner.Scanner <ide> scan.Init(strings.NewReader(pattern)) <ide> <del> sl := string(os.PathSeparator) <ide> escSL := sl <ide> if sl == `\` { <ide> escSL += `\` <ide><path>pkg/fileutils/fileutils_test.go <ide> func errp(e error) string { <ide> return e.Error() <ide> } <ide> <del>// TestMatch test's our version of filepath.Match, called regexpMatch. <add>// TestMatch tests our version of filepath.Match, called Matches. <ide> func TestMatch(t *testing.T) { <ide> for _, tt := range matchTests { <ide> pattern := tt.pattern <ide> func TestMatch(t *testing.T) { <ide> } <ide> } <ide> } <add> <add>type compileTestCase struct { <add> pattern string <add> matchType matchType <add> compiledRegexp string <add> windowsCompiledRegexp string <add>} <add> <add>var compileTests = []compileTestCase{ <add> {"*", regexpMatch, `^[^/]*$`, `^[^\\]*$`}, <add> {"file*", regexpMatch, `^file[^/]*$`, `^file[^\\]*$`}, <add> {"*file", regexpMatch, `^[^/]*file$`, `^[^\\]*file$`}, <add> {"a*/b", regexpMatch, `^a[^/]*/b$`, `^a[^\\]*\\b$`}, <add> {"**", suffixMatch, "", ""}, <add> {"**/**", regexpMatch, `^(.*/)?.*$`, `^(.*\\)?.*$`}, <add> {"dir/**", prefixMatch, "", ""}, <add> {"**/dir", suffixMatch, "", ""}, <add> {"**/dir2/*", regexpMatch, `^(.*/)?dir2/[^/]*$`, `^(.*\\)?dir2\\[^\\]*$`}, <add> {"**/dir2/**", regexpMatch, `^(.*/)?dir2/.*$`, `^(.*\\)?dir2\\.*$`}, <add> {"**file", suffixMatch, "", ""}, <add> {"**/file*txt", regexpMatch, `^(.*/)?file[^/]*txt$`, `^(.*\\)?file[^\\]*txt$`}, <add> {"**/**/*.txt", regexpMatch, `^(.*/)?(.*/)?[^/]*\.txt$`, `^(.*\\)?(.*\\)?[^\\]*\.txt$`}, <add> {"a[b-d]e", regexpMatch, `^a[b-d]e$`, `^a[b-d]e$`}, <add> {".*", regexpMatch, `^\.[^/]*$`, `^\.[^\\]*$`}, <add> {"abc.def", exactMatch, "", ""}, <add> {"abc?def", regexpMatch, `^abc[^/]def$`, `^abc[^\\]def$`}, <add> {"**/foo/bar", suffixMatch, "", ""}, <add> {"a(b)c/def", exactMatch, "", ""}, <add> {"a.|)$(}+{bc", exactMatch, "", ""}, <add> {"dist/proxy.py-2.4.0rc3.dev36+g08acad9-py3-none-any.whl", exactMatch, "", ""}, <add>} <add> <add>// TestCompile confirms that "compile" assigns the correct match type to a <add>// variety of test case patterns. If the match type is regexp, it also confirms <add>// that the compiled regexp matches the expected regexp. <add>func TestCompile(t *testing.T) { <add> t.Run("slash", testCompile("/")) <add> t.Run("backslash", testCompile(`\`)) <add>} <add> <add>func testCompile(sl string) func(*testing.T) { <add> return func(t *testing.T) { <add> for _, tt := range compileTests { <add> pattern := tt.pattern <add> if sl != "/" { <add> pattern = strings.ReplaceAll(pattern, "/", sl) <add> } <add> pm, err := NewPatternMatcher([]string{pattern}) <add> if err != nil { <add> t.Fatalf("Failed to create PatternMatcher for pattern %q: %v", pattern, err) <add> } <add> if err := pm.patterns[0].compile(sl); err != nil { <add> t.Fatalf("Failed to compile pattern %q: %v", pattern, err) <add> } <add> if pm.patterns[0].matchType != tt.matchType { <add> t.Errorf("pattern %q: matchType = %v, want %v", pattern, pm.patterns[0].matchType, tt.matchType) <add> continue <add> } <add> if tt.matchType == regexpMatch { <add> if sl == `\` { <add> if pm.patterns[0].regexp.String() != tt.windowsCompiledRegexp { <add> t.Errorf("pattern %q: regexp = %s, want %s", pattern, pm.patterns[0].regexp, tt.windowsCompiledRegexp) <add> } <add> } else if pm.patterns[0].regexp.String() != tt.compiledRegexp { <add> t.Errorf("pattern %q: regexp = %s, want %s", pattern, pm.patterns[0].regexp, tt.compiledRegexp) <add> } <add> } <add> } <add> } <add>}
2
Ruby
Ruby
add deprected options audit for depends_on
efec2fa0c5cd868ec66a1e3e4ffc737b911ae5be
<ide><path>Library/Homebrew/rubocops/extend/formula_cop.rb <ide> def audit_urls(urls, regex) <ide> # Returns all string nodes among the descendants of given node <ide> def find_strings(node) <ide> return [] if node.nil? <del> return node if node.str_type? <add> return [node] if node.str_type? <ide> node.each_descendant(:str) <ide> end <ide> <ide><path>Library/Homebrew/rubocops/lines_cop.rb <ide> def audit_formula(_node, _class_node, _parent_class_node, body_node) <ide> end <ide> <ide> find_every_method_call_by_name(body_node, :depends_on).each do |method| <del> next if modifier?(method.parent) <ide> param = parameters(method).first <del> dep, option = hash_dep(param) <del> next if dep.nil? || option.nil? <del> offending_node(param) <del> problem "Dependency #{string_content(dep)} should not use option #{string_content(option)}" <add> dep, option_child_nodes = hash_dep(param) <add> next if dep.nil? || option_child_nodes.empty? <add> option_child_nodes.each do |option| <add> find_strings(option).each do |dependency| <add> next unless match = regex_match_group(dependency, /(with(out)?-\w+|c\+\+11)/) <add> problem "Dependency #{string_content(dep)} should not use option #{match[0]}" <add> end <add> end <ide> end <ide> <ide> find_instance_method_call(body_node, :version, :==) do |method| <ide> def modifier?(node) <ide> (send nil? :depends_on $({str sym} _)))} <ide> EOS <ide> <del> # Match depends_on with hash as argument <ide> def_node_matcher :hash_dep, <<~EOS <del> {(hash (pair $(str _) $(str _))) <del> (hash (pair $(str _) (array $(str _) ...)))} <add> (hash (pair $(str _) $...)) <ide> EOS <ide> <ide> def_node_matcher :destructure_hash, <<~EOS <ide><path>Library/Homebrew/test/rubocops/lines_cop_spec.rb <ide> class Foo < Formula <ide> RUBY <ide> end <ide> <del> it "dependencies with invalid options" do <add> it "dependencies with invalid options which lead to force rebuild" do <ide> expect_offense(<<~RUBY) <ide> class Foo < Formula <ide> desc "foo" <ide> url 'http://example.com/foo-1.0.tgz' <ide> depends_on "foo" => "with-bar" <del> ^^^^^^^^^^^^^^^^^^^ Dependency foo should not use option with-bar <add> ^^^^^^^^ Dependency foo should not use option with-bar <add> end <add> RUBY <add> end <add> <add> it "dependencies with invalid options in array value which lead to force rebuild" do <add> expect_offense(<<~RUBY) <add> class Foo < Formula <add> desc "foo" <add> url 'http://example.com/foo-1.0.tgz' <add> depends_on "httpd" => [:build, :test] <add> depends_on "foo" => [:optional, "with-bar"] <add> ^^^^^^^^ Dependency foo should not use option with-bar <add> depends_on "icu4c" => [:optional, "c++11"] <add> ^^^^^ Dependency icu4c should not use option c++11 <ide> end <ide> RUBY <ide> end
3
Javascript
Javascript
remove unnecessary assignment
f1e677895e936e60be519338a5ae935cd8235db4
<ide><path>src/ng/compile.js <ide> function $CompileProvider($provide, $$sanitizeUriProvider) { <ide> } <ide> <ide> if (!directive.templateUrl && directive.controller) { <del> directiveValue = directive.controller; <ide> controllerDirectives = controllerDirectives || createMap(); <ide> assertNoDuplicate('\'' + directiveName + '\' controller', <ide> controllerDirectives[directiveName], directive, $compileNode);
1
PHP
PHP
remove invalid usage example
9542949f52a285b5ee44f6613aadac6cae55bb0b
<ide><path>src/View/Helper/FormHelper.php <ide> public function error($field, $text = null, array $options = []) <ide> * <label for="published">Publish</label> <ide> * ``` <ide> * <del> * Custom class name: <del> * <del> * ``` <del> * echo $this->Form->label('published', 'Publish', 'required'); <del> * <label for="published" class="required">Publish</label> <del> * ``` <del> * <ide> * Custom attributes: <ide> * <ide> * ```
1
PHP
PHP
fix failing tests
7fef92255327a89f3977d975e89c190b47273622
<ide><path>tests/TestCase/Console/CommandCollectionTest.php <ide> public function testAutoDiscoverCore() <ide> $this->assertTrue($collection->has('i18n')); <ide> $this->assertTrue($collection->has('schema_cache')); <ide> $this->assertTrue($collection->has('server')); <del> $this->assertTrue($collection->has('cache')); <add> $this->assertTrue($collection->has('cache clear')); <ide> $this->assertFalse($collection->has('command_list'), 'Hidden commands should stay hidden'); <ide> <ide> // These have to be strings as ::class uses the local namespace. <ide><path>tests/TestCase/Shell/CompletionShellTest.php <ide> public function testCommands() <ide> $this->Shell->runCommand(['commands']); <ide> $output = $this->out->output(); <ide> <add> // This currently incorrectly shows `cache_clear_all` when it should only show `cache` <add> // The subcommands method also needs rework to handle multi-word subcommands <ide> $expected = 'TestPlugin.example TestPlugin.sample TestPluginTwo.example unique welcome ' . <del> 'cache help i18n plugin routes schema_cache server upgrade version ' . <add> 'cache_clear cache_clear_all cache_list help i18n plugin routes schema_cache server upgrade version ' . <ide> "abort auto_load_model demo i18m integration merge sample shell_test testing_dispatch"; <ide> $this->assertTextEquals($expected, $output); <ide> }
2
Text
Text
fix typo in changelog
bc9c1a5a7b822f8d1e9208eff8cfaadcdbd52673
<ide><path>CHANGELOG.md <ide> In general it is recommended that you use [NAN](https://github.com/rvagg/nan) as <ide> <ide> - Exposed method signature has changed from `Handle<Value> Method(const Arguments& args)` to `void Method(const v8::FunctionCallbackInfo<Value>& args)` with the newly introduced `FunctionCallbackInfo` also taking the return value via `args.GetReturnValue().Set(value)` instead of `scope.Close(value)`, `Arguments` has been removed. <ide> - Exposed setter signature has changed from `void Setter(Local<String> property, Local<Value> value, const v8::AccessorInfo& args)` `void Setter(Local<String> property, Local<Value> value, const v8::PropertyCallbackInfo<void>& args)`. <del>- Exposed getter signature has changed from `void Getter(Local<String> property, Local<Value> value, const v8::AccessorInfo& args)` `void Setter(Local<String> property, Local<Value> value, const v8::PropertyCallbackInfo<Value>& args)`. <add>- Exposed getter signature has changed from `void Getter(Local<String> property, Local<Value> value, const v8::AccessorInfo& args)` `void Getter(Local<String> property, Local<Value> value, const v8::PropertyCallbackInfo<Value>& args)`. <ide> - Exposed property setter signature has changed from `Handle<Value> Setter(Local<String> property, Local<Value> value, const v8::AccessorInfo& args)` `void Setter(Local<String> property, Local<Value> value, const v8::PropertyCallbackInfo<Value>& args)`. <del>- Exposed property getter signature has changed from `Handle<Value> Getter(Local<String> property, Local<Value> value, const v8::AccessorInfo& args)` `void Setter(Local<String> property, Local<Value> value, const v8::PropertyCallbackInfo<Value>& args)`. <add>- Exposed property getter signature has changed from `Handle<Value> Getter(Local<String> property, Local<Value> value, const v8::AccessorInfo& args)` `void Getter(Local<String> property, Local<Value> value, const v8::PropertyCallbackInfo<Value>& args)`. <ide> - Similar changes have been made to property enumerators, property deleters, property query, index getter, index setter, index enumerator, index deleter, index query. <ide> - V8 objects instantiated in C++ now require an `Isolate*` argument as the first argument. In most cases it is OK to simply pass `v8::Isolate::GetCurrent()`, e.g. `Date::New(Isolate::GetCurrent(), time)`, or `String::NewFromUtf8(Isolate::GetCurrent(), "foobar")`. <ide> - `HandleScope scope` now requires an `Isolate*` argument, i.e. `HandleScope scope(isolate)`, in most cases `v8::Isolate::GetCurrent()` is OK.
1
Python
Python
drop the tmp table after ingestion
8e0cf961e2225ad916ea82699aab95534840c762
<ide><path>airflow/operators/hive_to_druid.py <ide> def execute(self, context): <ide> "Cleaning up by dropping the temp " <ide> "Hive table {}".format(hive_table)) <ide> hql = "DROP TABLE IF EXISTS {}".format(hive_table) <del> #hive.run_cli(hql) <add> hive.run_cli(hql)
1
Java
Java
fix padding with text on android
c3f2bba834a5ffcc42352bb738132baceafce76d
<ide><path>ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextShadowNode.java <ide> public void onCollectExtraUpdates(UIViewOperationQueue uiViewOperationQueue) { <ide> super.onCollectExtraUpdates(uiViewOperationQueue); <ide> if (mPreparedSpannableText != null) { <ide> ReactTextUpdate reactTextUpdate = <del> new ReactTextUpdate(mPreparedSpannableText, UNSET, mContainsImages); <add> new ReactTextUpdate(mPreparedSpannableText, UNSET, mContainsImages, getPadding()); <ide> uiViewOperationQueue.enqueueUpdateExtraData(getReactTag(), reactTextUpdate); <ide> } <ide> } <ide><path>ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextUpdate.java <ide> <ide> import android.text.Spannable; <ide> <add>import com.facebook.csslayout.Spacing; <add> <ide> /** <ide> * Class that contains the data needed for a text update. <ide> * Used by both <Text/> and <TextInput/> <ide> public class ReactTextUpdate { <ide> private final Spannable mText; <ide> private final int mJsEventCounter; <ide> private final boolean mContainsImages; <add> private final Spacing mPadding; <ide> <del> public ReactTextUpdate(Spannable text, int jsEventCounter, boolean containsImages) { <add> public ReactTextUpdate( <add> Spannable text, <add> int jsEventCounter, <add> boolean containsImages, <add> Spacing padding) { <ide> mText = text; <ide> mJsEventCounter = jsEventCounter; <ide> mContainsImages = containsImages; <add> mPadding = padding; <ide> } <ide> <ide> public Spannable getText() { <ide> public int getJsEventCounter() { <ide> public boolean containsImages() { <ide> return mContainsImages; <ide> } <add> <add> public Spacing getPadding() { <add> return mPadding; <add> } <ide> } <ide><path>ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextView.java <ide> import android.view.ViewGroup; <ide> import android.widget.TextView; <ide> <add>import com.facebook.csslayout.Spacing; <ide> import com.facebook.react.uimanager.ReactCompoundView; <ide> <ide> public class ReactTextView extends TextView implements ReactCompoundView { <ide> public void setText(ReactTextUpdate update) { <ide> setLayoutParams(EMPTY_LAYOUT_PARAMS); <ide> } <ide> setText(update.getText()); <add> Spacing padding = update.getPadding(); <add> setPadding( <add> (int) Math.ceil(padding.get(Spacing.LEFT)), <add> (int) Math.ceil(padding.get(Spacing.TOP)), <add> (int) Math.ceil(padding.get(Spacing.RIGHT)), <add> (int) Math.ceil(padding.get(Spacing.BOTTOM))); <ide> } <ide> <ide> @Override <ide><path>ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputShadowNode.java <ide> public void onCollectExtraUpdates(UIViewOperationQueue uiViewOperationQueue) { <ide> if (mJsEventCount != UNSET) { <ide> Spannable preparedSpannableText = fromTextCSSNode(this); <ide> ReactTextUpdate reactTextUpdate = <del> new ReactTextUpdate(preparedSpannableText, mJsEventCount, mContainsImages); <add> new ReactTextUpdate(preparedSpannableText, mJsEventCount, mContainsImages, getPadding()); <ide> uiViewOperationQueue.enqueueUpdateExtraData(getReactTag(), reactTextUpdate); <ide> } <ide> }
4
Text
Text
add lines 109-118(reading files)
218bcfe75d0f44eadd9c13ec5667dee29e02da9a
<ide><path>guide/english/python/files-and-io/index.md <ide> Sample code to open a text file using the `with` statement: <ide> with open('hello_world.txt', 'w') as f: <ide> f.write('Hello World!') <ide> ``` <add>#### Reading files <add>There are many ways of reading a file. Reading a file <code>fh</code> is only possible if file is opened in read mode, the following are the options: <add> <add><code>fh.read()</code>: read file as a single string <add> <add><code>fh.read(n)</code>: read n number of characters <add> <add><code>fh.readline()</code>: read one line and end with <code>\n</code> <add> <add><code>fh.readlines()</code>: read file as a list of strings and end with <code>'\n'</code> <ide> <ide> #### More Information: <ide> [Python Documentation - IO](https://docs.python.org/2/tutorial/inputoutput.html)
1
Ruby
Ruby
add collectionproxy#count documentation
f81798d06415c538f5b1c5acfd4889b45473e62d
<ide><path>activerecord/lib/active_record/associations/collection_proxy.rb <ide> class CollectionProxy < Relation <ide> # <ide> # Pet.find(4, 5, 6) # => ActiveRecord::RecordNotFound: Couldn't find all Pets with IDs (4, 5, 6) <ide> <add> ## <add> # :method: count <add> # <add> # :call-seq: <add> # count() <add> # <add> # Count all records using SQL. <add> # <add> # class Person < ActiveRecord::Base <add> # has_many :pets <add> # end <add> # <add> # person.pets.count # => 3 <add> # person.pets <add> # # => [ <add> # # #<Pet id: 1, name: "Fancy-Fancy", person_id: 1>, <add> # # #<Pet id: 2, name: "Spook", person_id: 1>, <add> # # #<Pet id: 3, name: "Choo-Choo", person_id: 1> <add> # # ] <add> <ide> ## <ide> # :method: size <ide> # <add> # :call-seq: <add> # size() <add> # <ide> # Returns the size of the collection. If the collection hasn't been loaded, <ide> # it executes a <tt>SELECT COUNT(*)</tt> query. <ide> # <ide> class CollectionProxy < Relation <ide> ## <ide> # :method: length <ide> # <add> # :call-seq: <add> # length() <add> # <ide> # Returns the size of the collection calling +size+ on the target. <ide> # If the collection has been already loaded, +length+ and +size+ are <ide> # equivalent.
1
Javascript
Javascript
improve normalization performance
37d27486fce50bd82b6b5095af880d435ed308f8
<ide><path>lib/path.js <ide> function normalizeString(path, allowAboveRoot, separator, isPathSeparator) { <ide> lastSegmentLength = 2; <ide> } <ide> } else { <del> res += (res.length > 0 ? separator : '') + path.slice(lastSlash + 1, i); <add> if (res.length > 0) <add> res += `${separator}${path.slice(lastSlash + 1, i)}`; <add> else <add> res = path.slice(lastSlash + 1, i); <ide> lastSegmentLength = i - lastSlash - 1; <ide> } <ide> lastSlash = i;
1
Text
Text
fix typos in /doc/api/fs.md
97ebcdddcc861595eb892e271505ad38b2abbc64
<ide><path>doc/api/fs.md <ide> added: v10.0.0 <ide> --> <ide> <ide> * `len` {integer} **Default:** `0` <del>* Returns: {Promise} Fulfills with `undefined` upo nsuccess. <add>* Returns: {Promise} Fulfills with `undefined` upon success. <ide> <ide> Truncates the file. <ide> <ide> changes: <ide> **Default:** `'r'`. <ide> * `mode` {string|integer} Sets the file mode (permission and sticky bits) <ide> if the file is created. **Default:** `0o666` (readable and writable) <del>* Returns: {Promise} Fullfils with a {FileHandle} object. <add>* Returns: {Promise} Fulfills with a {FileHandle} object. <ide> <ide> Opens a {FileHandle}. <ide> <ide> added: v10.0.0 <ide> * Returns: {Promise} Fulfills with the `linkString` upon success. <ide> <ide> Reads the contents of the symbolic link referred to by `path`. See the POSIX <del>readlink(2) documentation for more etail. The promise is resolved with the <add>readlink(2) documentation for more detail. The promise is resolved with the <ide> `linkString` upon success. <ide> <ide> The optional `options` argument can be a string specifying an encoding, or an
1
Ruby
Ruby
remove applicationcontroller & routingtesthelpers
087c66d18337415d0ff5e46f63a9e1fd32afb13c
<ide><path>actionview/test/abstract_unit.rb <ide> class TestCase <ide> end <ide> end <ide> <del>class ::ApplicationController < ActionController::Base <del>end <del> <ide> module ActionView <ide> class TestCase <ide> # Must repeat the setup because AV::TestCase is a duplication <ide> def stderr_logger <ide> end <ide> end <ide> <del>module RoutingTestHelpers <del> def url_for(set, options, recall = nil) <del> set.send(:url_for, options.merge(:only_path => true, :_recall => recall)) <del> end <del>end <del>
1
Text
Text
use string interpolation
5708140f103f40f978f259294c12e0e5e9644a02
<ide><path>docs/your-first-package.md <ide> convert: -> <ide> if error <ide> console.error(error) <ide> else <del> selection.insertText("\n" + asciiArt + "\n") <add> selection.insertText("\n#{asciiArt}\n") <ide> ``` <ide> <ide> ## Further reading
1
Java
Java
publish events only after successful channel send
27899abcb6c1651b0b25e196ae9768a264474b70
<ide><path>spring-websocket/src/main/java/org/springframework/web/socket/messaging/StompSubProtocolHandler.java <ide> else if (StompCommand.DISCONNECT.equals(headerAccessor.getCommand())) { <ide> <ide> try { <ide> SimpAttributesContextHolder.setAttributesFromMessage(message); <del> if (this.eventPublisher != null) { <add> boolean sent = outputChannel.send(message); <add> <add> if (sent && this.eventPublisher != null) { <ide> if (StompCommand.CONNECT.equals(headerAccessor.getCommand())) { <ide> publishEvent(new SessionConnectEvent(this, message, user)); <ide> } <ide> else if (StompCommand.UNSUBSCRIBE.equals(headerAccessor.getCommand())) { <ide> publishEvent(new SessionUnsubscribeEvent(this, message, user)); <ide> } <ide> } <del> outputChannel.send(message); <ide> } <ide> finally { <ide> SimpAttributesContextHolder.resetAttributes(); <ide><path>spring-websocket/src/test/java/org/springframework/web/socket/messaging/StompSubProtocolHandlerTests.java <ide> <ide> package org.springframework.web.socket.messaging; <ide> <del>import static org.hamcrest.Matchers.*; <del>import static org.junit.Assert.*; <del>import static org.mockito.Matchers.any; <del>import static org.mockito.Mockito.*; <del> <ide> import java.io.IOException; <ide> import java.util.ArrayList; <ide> import java.util.Arrays; <ide> import org.springframework.web.socket.handler.TestWebSocketSession; <ide> import org.springframework.web.socket.sockjs.transport.SockJsSession; <ide> <add>import static org.hamcrest.Matchers.is; <add>import static org.junit.Assert.assertArrayEquals; <add>import static org.junit.Assert.assertEquals; <add>import static org.junit.Assert.assertFalse; <add>import static org.junit.Assert.assertNotNull; <add>import static org.junit.Assert.assertThat; <add>import static org.junit.Assert.assertTrue; <add>import static org.mockito.Matchers.any; <add>import static org.mockito.Mockito.mock; <add>import static org.mockito.Mockito.reset; <add>import static org.mockito.Mockito.times; <add>import static org.mockito.Mockito.verify; <add>import static org.mockito.Mockito.verifyNoMoreInteractions; <add>import static org.mockito.Mockito.verifyZeroInteractions; <add>import static org.mockito.Mockito.when; <add> <ide> /** <ide> * Test fixture for {@link StompSubProtocolHandler} tests. <ide> * <ide> public void setup() { <ide> this.channel = Mockito.mock(MessageChannel.class); <ide> this.messageCaptor = ArgumentCaptor.forClass(Message.class); <ide> <add> when(this.channel.send(any())).thenReturn(true); <add> <ide> this.session = new TestWebSocketSession(); <ide> this.session.setId("s1"); <ide> this.session.setPrincipal(new TestPrincipal("joe"));
2