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
Mixed
Javascript
remove references to unsupported aix versions
cda60c56723e97ae88eceeec6974ddc6ab619d31
<ide><path>doc/api/fs.md <ide> added: v10.0.0 <ide> Change the file system timestamps of the object referenced by the {FileHandle} <ide> then resolves the promise with no arguments upon success. <ide> <del>This function does not work on AIX versions before 7.1, it will reject the <del>promise with an error using code `UV_ENOSYS`. <del> <ide> #### `filehandle.write(buffer[, offset[, length[, position]]])` <ide> <!-- YAML <ide> added: v10.0.0 <ide> changes: <ide> Change the file system timestamps of the object referenced by the supplied file <ide> descriptor. See [`fs.utimes()`][]. <ide> <del>This function does not work on AIX versions before 7.1, it will return the <del>error `UV_ENOSYS`. <del> <ide> ### `fs.lchmod(path, mode, callback)` <ide> <!-- YAML <ide> deprecated: v0.4.7 <ide><path>test/parallel/test-trace-events-fs-sync.js <ide> for (const tr in tests) { <ide> '--trace-event-categories', 'node.fs.sync', <ide> '-e', tests[tr] ], <ide> { cwd: tmpdir.path, encoding: 'utf8' }); <del> // Some AIX versions don't support futimes or utimes, so skip. <del> if (common.isAIX && proc.status !== 0 && tr === 'fs.sync.futimes') { <del> continue; <del> } <del> if (common.isAIX && proc.status !== 0 && tr === 'fs.sync.utimes') { <del> continue; <del> } <ide> <ide> // Make sure the operation is successful. <ide> // Don't use assert with a custom message here. Otherwise the
2
Ruby
Ruby
add version token examples
e9b6a6df4bd6d04ecef771102c7ab257b0ac3079
<ide><path>Library/Homebrew/test/pkg_version_spec.rb <ide> expect(p1.hash).not_to eq(p4.hash) <ide> end <ide> end <add> <add> describe "#version" do <add> it "returns package version" do <add> expect(described_class.parse("1.2.3_4").version).to be == Version.create("1.2.3") <add> end <add> end <add> <add> describe "#revision" do <add> it "returns package revision" do <add> expect(described_class.parse("1.2.3_4").revision).to be == 4 <add> end <add> end <add> <add> describe "#major" do <add> it "returns major version token" do <add> expect(described_class.parse("1.2.3_4").major).to be == Version::Token.create("1") <add> end <add> end <add> <add> describe "#minor" do <add> it "returns minor version token" do <add> expect(described_class.parse("1.2.3_4").minor).to be == Version::Token.create("2") <add> end <add> end <add> <add> describe "#patch" do <add> it "returns patch version token" do <add> expect(described_class.parse("1.2.3_4").patch).to be == Version::Token.create("3") <add> end <add> end <add> <add> describe "#major_minor" do <add> it "returns major.minor version" do <add> expect(described_class.parse("1.2.3_4").major_minor).to be == Version.create("1.2") <add> end <add> end <add> <add> describe "#major_minor_patch" do <add> it "returns major.minor.patch version" do <add> expect(described_class.parse("1.2.3_4").major_minor_patch).to be == Version.create("1.2.3") <add> end <add> end <ide> end
1
Go
Go
bind a new data volume to a container
1df5f4094bf31edba6f2a2f07bfdada54340c1e4
<ide><path>commands.go <ide> import ( <ide> "log" <ide> "net/http" <ide> "net/url" <add> "path/filepath" <ide> "runtime" <ide> "strconv" <ide> "strings" <ide> func (opts AttachOpts) Get(val string) bool { <ide> return false <ide> } <ide> <add>// PathOpts stores a unique set of absolute paths <add>type PathOpts map[string]struct{} <add> <add>func NewPathOpts() PathOpts { <add> return make(PathOpts) <add>} <add> <add>func (opts PathOpts) String() string { <add> return fmt.Sprintf("%v", map[string]struct{}(opts)) <add>} <add> <add>func (opts PathOpts) Set(val string) error { <add> if !filepath.IsAbs(val) { <add> return fmt.Errorf("%s is not an absolute path", val) <add> } <add> opts[filepath.Clean(val)] = struct{}{} <add> return nil <add>} <add> <ide> func (srv *Server) CmdTag(stdin io.ReadCloser, stdout io.Writer, args ...string) error { <ide> cmd := rcli.Subcmd(stdout, "tag", "[OPTIONS] IMAGE REPOSITORY [TAG]", "Tag an image into a repository") <ide> force := cmd.Bool("f", false, "Force") <ide><path>container.go <ide> type Config struct { <ide> Cmd []string <ide> Dns []string <ide> Image string // Name of the image as it was passed by the operator (eg. could be symbolic) <add> Volumes map[string]struct{} <ide> } <ide> <ide> func ParseRun(args []string, stdout io.Writer, capabilities *Capabilities) (*Config, error) { <ide> func ParseRun(args []string, stdout io.Writer, capabilities *Capabilities) (*Con <ide> var flDns ListOpts <ide> cmd.Var(&flDns, "dns", "Set custom dns servers") <ide> <add> flVolumes := NewPathOpts() <add> cmd.Var(flVolumes, "v", "Attach a data volume") <add> <ide> if err := cmd.Parse(args); err != nil { <ide> return nil, err <ide> } <ide> func ParseRun(args []string, stdout io.Writer, capabilities *Capabilities) (*Con <ide> Cmd: runCmd, <ide> Dns: flDns, <ide> Image: image, <add> Volumes: flVolumes, <ide> } <ide> <ide> if *flMemory > 0 && !capabilities.SwapLimit { <ide><path>runtime.go <ide> type Runtime struct { <ide> capabilities *Capabilities <ide> kernelVersion *KernelVersionInfo <ide> autoRestart bool <add> volumes *Graph <ide> } <ide> <ide> var sysInitPath string <ide> func NewRuntimeFromDirectory(root string, autoRestart bool) (*Runtime, error) { <ide> if err != nil { <ide> return nil, err <ide> } <add> volumes, err := NewGraph(path.Join(root, "volumes")) <add> if err != nil { <add> return nil, err <add> } <ide> repositories, err := NewTagStore(path.Join(root, "repositories"), g) <ide> if err != nil { <ide> return nil, fmt.Errorf("Couldn't create Tag store: %s", err) <ide> func NewRuntimeFromDirectory(root string, autoRestart bool) (*Runtime, error) { <ide> idIndex: NewTruncIndex(), <ide> capabilities: &Capabilities{}, <ide> autoRestart: autoRestart, <add> volumes: volumes, <ide> } <ide> <ide> if err := runtime.restore(); err != nil {
3
Python
Python
fix bug in example of np.spacing. closes
12e936a7f793df5b76b639382c7b302c3153c2b3
<ide><path>numpy/core/code_generators/ufunc_docstrings.py <ide> def add_newdoc(place, name, doc): <ide> <ide> Examples <ide> -------- <del> >>> np.spacing(1, 2) == np.finfo(np.float64).eps <add> >>> np.spacing(1) == np.finfo(np.float64).eps <ide> True <ide> <ide> """)
1
Go
Go
fix typo in lxc_template.go
cb979edec0c8a8ba5a874abcbf74eae3a48fe52c
<ide><path>daemon/execdriver/lxc/lxc_template.go <ide> lxc.cgroup.devices.allow = {{$allowedDevice.CgroupString}} <ide> # Use mnt.putold as per https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/986385 <ide> lxc.pivotdir = lxc_putold <ide> <del># lxc.autodev is not compativle with lxc --device switch <add># lxc.autodev is not compatible with lxc --device switch <ide> lxc.autodev = 0 <ide> <ide> # NOTICE: These mounts must be applied within the namespace
1
Ruby
Ruby
remove block from super
96f0aad6ec8c3ae94485679ac8092c4089310481
<ide><path>actionview/lib/action_view/helpers/tags/search_field.rb <ide> module Helpers <ide> module Tags # :nodoc: <ide> class SearchField < TextField # :nodoc: <ide> def render <del> super do |options| <del> if options["autosave"] <del> if options["autosave"] == true <del> options["autosave"] = request.host.split(".").reverse.join(".") <del> end <del> options["results"] ||= 10 <del> end <add> options = @options.stringify_keys <ide> <del> if options["onsearch"] <del> options["incremental"] = true unless options.has_key?("incremental") <add> if options["autosave"] <add> if options["autosave"] == true <add> options["autosave"] = request.host.split(".").reverse.join(".") <ide> end <add> options["results"] ||= 10 <add> end <add> <add> if options["onsearch"] <add> options["incremental"] = true unless options.has_key?("incremental") <ide> end <add> <add> @options = options <add> super <ide> end <ide> end <ide> end <ide><path>actionview/lib/action_view/helpers/tags/text_field.rb <ide> def render <ide> options["size"] = options["maxlength"] unless options.key?("size") <ide> options["type"] ||= field_type <ide> options["value"] = options.fetch("value") { value_before_type_cast(object) } unless field_type == "file" <del> yield options if block_given? <ide> add_default_name_and_id(options) <ide> tag("input", options) <ide> end
2
Ruby
Ruby
fix broken ipv6 addresses handling
c4a83b5454a3516b630b38cd8e8472f2166fc986
<ide><path>actionpack/lib/action_dispatch/http/url.rb <ide> module ActionDispatch <ide> module Http <ide> module URL <ide> IP_HOST_REGEXP = /\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/ <del> HOST_REGEXP = /(^[^:]+:\/\/)?([^:]+)(?::(\d+$))?/ <add> HOST_REGEXP = /(^[^:]+:\/\/)?(\[[^\]]+\]|[^:]+)(?::(\d+$))?/ <ide> PROTOCOL_REGEXP = /^([^:]+)(:)?(\/\/)?$/ <ide> <ide> mattr_accessor :tld_length <ide><path>actionpack/test/dispatch/routing/ipv6_redirect_test.rb <add>require 'abstract_unit' <add> <add>class IPv6IntegrationTest < ActionDispatch::IntegrationTest <add> Routes = ActionDispatch::Routing::RouteSet.new <add> include Routes.url_helpers <add> <add> class ::BadRouteRequestController < ActionController::Base <add> include Routes.url_helpers <add> def index <add> render :text => foo_path <add> end <add> <add> def foo <add> redirect_to :action => :index <add> end <add> end <add> <add> Routes.draw do <add> get "/", :to => 'bad_route_request#index', :as => :index <add> get "/foo", :to => "bad_route_request#foo", :as => :foo <add> end <add> <add> def _routes <add> Routes <add> end <add> <add> APP = build_app Routes <add> def app <add> APP <add> end <add> <add> test "bad IPv6 redirection" do <add> # def test_simple_redirect <add> request_env = { <add> 'REMOTE_ADDR' => 'fd07:2fa:6cff:2112:225:90ff:fec7:22aa', <add> 'HTTP_HOST' => '[fd07:2fa:6cff:2112:225:90ff:fec7:22aa]:3000', <add> 'SERVER_NAME' => '[fd07:2fa:6cff:2112:225:90ff:fec7:22aa]', <add> 'SERVER_PORT' => 3000 } <add> <add> get '/foo', env: request_env <add> assert_response :redirect <add> assert_equal 'http://[fd07:2fa:6cff:2112:225:90ff:fec7:22aa]:3000/', redirect_to_url <add> end <add> <add>end
2
Javascript
Javascript
fix server.listen argument parsing
be1b55289fdd0e654c660eca9bd1eb8a517f804c
<ide><path>lib/net_uv.js <ide> function toPort(x) { return (x = Number(x)) >= 0 ? x : false; } <ide> <ide> <ide> function listenip(self, ip, port) { <del> var r = self._handle.bind(ip, port); <add> var r = 0; <add> <add> if (ip && port) { <add> debug("bind to " + ip); <add> r = self._handle.bind(ip, port); <add> } <add> <ide> if (r) { <ide> self.emit('error', errnoException(errno, 'listen')); <ide> } else { <ide> Server.prototype.listen = function() { <ide> if (arguments.length == 0 || typeof arguments[0] == 'function') { <ide> // Don't bind(). OS will assign a port with INADDR_ANY. <ide> // The port can be found with server.address() <del> this._handle.listen(self._backlog || 128); <del> process.nextTick(function() { <del> self.emit('listening'); <del> }); <add> listenip(self, null, null); <ide> <del> } else if (typeof arguments[1] == 'undefined') { <add> } else if (typeof arguments[1] == 'undefined' || <add> typeof arguments[1] == 'function') { <ide> // The first argument is the port, no IP given. <ide> listenip(self, '0.0.0.0', port); <ide>
1
Go
Go
add ability to work with individual namespaces
70f3b9f4ce67ee54ec226814cdd26db01f69378d
<ide><path>pkg/libcontainer/nsinit/command.go <ide> func (c *DefaultCommandFactory) Create(container *libcontainer.Container, consol <ide> // flags on clone, unshare, and setns <ide> func GetNamespaceFlags(namespaces libcontainer.Namespaces) (flag int) { <ide> for _, ns := range namespaces { <del> flag |= ns.Value <add> if ns.Enabled { <add> flag |= ns.Value <add> } <ide> } <ide> return flag <ide> } <ide><path>pkg/libcontainer/types.go <ide> func (ns *Namespace) String() string { <ide> func GetNamespace(key string) *Namespace { <ide> for _, ns := range namespaceList { <ide> if ns.Key == key { <del> return ns <add> cpy := *ns <add> return &cpy <ide> } <ide> } <ide> return nil <ide> func GetNamespace(key string) *Namespace { <ide> // Contains returns true if the specified Namespace is <ide> // in the slice <ide> func (n Namespaces) Contains(ns string) bool { <add> return n.Get(ns) != nil <add>} <add> <add>func (n Namespaces) Get(ns string) *Namespace { <ide> for _, nsp := range n { <ide> if nsp.Key == ns { <del> return true <add> return nsp <ide> } <ide> } <del> return false <add> return nil <ide> } <ide> <ide> type ( <ide><path>runtime/execdriver/native/default_template.go <ide> func createContainer(c *execdriver.Command) *libcontainer.Container { <ide> // i.e: cgroup devices.allow *:* <ide> func configureCustomOptions(container *libcontainer.Container, opts []string) { <ide> for _, opt := range opts { <del> parts := strings.Split(strings.TrimSpace(opt), " ") <add> var ( <add> parts = strings.Split(strings.TrimSpace(opt), " ") <add> value = strings.TrimSpace(parts[1]) <add> ) <ide> switch parts[0] { <ide> case "cap": <del> value := strings.TrimSpace(parts[1]) <ide> c := container.CapabilitiesMask.Get(value[1:]) <ide> if c == nil { <ide> continue <ide> func configureCustomOptions(container *libcontainer.Container, opts []string) { <ide> default: <ide> // do error here <ide> } <add> case "ns": <add> ns := container.Namespaces.Get(value[1:]) <add> switch value[0] { <add> case '-': <add> ns.Enabled = false <add> case '+': <add> ns.Enabled = true <add> default: <add> // error <add> } <ide> } <ide> } <ide> }
3
PHP
PHP
update deprecation suggestions
82b9edd8512c857a75597a5d6c7f07d53c9edf5c
<ide><path>src/Http/ServerRequest.php <ide> public function offsetGet($name) <ide> * @param string $name Name of the key being written <ide> * @param mixed $value The value being written. <ide> * @return void <del> * @deprecated 3.4.0 The ArrayAccess methods will be removed in 4.0.0. Use setParam(), setData() and setQuery() instead. <add> * @deprecated 3.4.0 The ArrayAccess methods will be removed in 4.0.0. Use withParam() or param() instead. <ide> */ <add> <ide> public function offsetSet($name, $value) <ide> { <ide> $this->params[$name] = $value; <ide> public function offsetSet($name, $value) <ide> * <ide> * @param string $name thing to check. <ide> * @return bool <del> * @deprecated 3.4.0 The ArrayAccess methods will be removed in 4.0.0. Use getParam(), getData() and getQuery() instead. <add> * @deprecated 3.4.0 The ArrayAccess methods will be removed in 4.0.0. Use getParam() or param() instead. <ide> */ <ide> public function offsetExists($name) <ide> { <ide> public function offsetExists($name) <ide> * <ide> * @param string $name Name to unset. <ide> * @return void <del> * @deprecated 3.4.0 The ArrayAccess methods will be removed in 4.0.0. Use setParam(), setData() and setQuery() instead. <add> * @deprecated 3.4.0 The ArrayAccess methods will be removed in 4.0.0. Use withParam() or param() instead. <ide> */ <ide> public function offsetUnset($name) <ide> {
1
Mixed
Text
drop mysql 5.1 support
a338314d31b2a6d0f3cefcfc8c897369094098e4
<ide><path>activerecord/CHANGELOG.md <add>* Bump minimum MySQL version to 5.5.8. <add> <add> *Yasuo Honda* <add> <ide> * Use MySQL utf8mb4 character set by default. <ide> <ide> `utf8mb4` character set with 4-Byte encoding supports supplementary characters including emoji. <ide><path>activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb <ide> def initialize(connection, logger, connection_options, config) <ide> <ide> @statements = StatementPool.new(self.class.type_cast_config_to_integer(config[:statement_limit])) <ide> <del> if version < "5.1.10" <del> raise "Your version of MySQL (#{version_string}) is too old. Active Record supports MySQL >= 5.1.10." <add> if version < "5.5.8" <add> raise "Your version of MySQL (#{version_string}) is too old. Active Record supports MySQL >= 5.5.8." <ide> end <ide> end <ide>
2
PHP
PHP
add missing use
2f9fd50688da18b69affb7a9679abc94f61c5d90
<ide><path>lib/Cake/TestSuite/Reporter/HtmlReporter.php <ide> use Cake\Core\Configure; <ide> use Cake\TestSuite\Coverage\HtmlCoverageReport; <ide> use Cake\Utility\Inflector; <add>use PHPUnit_Util_Diff; <ide> <ide> /** <ide> * HtmlReporter Reports Results of TestSuites and Test Cases
1
Python
Python
implement no batch to text and image and add test
854c819228e799f7568032bb9bcde5849b421f69
<ide><path>keras/preprocessing/image_dataset.py <ide> def image_dataset_from_directory(directory, <ide> Whether the images will be converted to <ide> have 1, 3, or 4 channels. <ide> batch_size: Size of the batches of data. Default: 32. <add> If `None`, the data will not be batched <add> (the dataset will yield individual samples). <ide> image_size: Size to resize images to after they are read from disk. <ide> Defaults to `(256, 256)`. <ide> Since the pipeline processes batches of images that must all have <ide> def image_dataset_from_directory(directory, <ide> num_classes=len(class_names), <ide> interpolation=interpolation, <ide> crop_to_aspect_ratio=crop_to_aspect_ratio) <del> if shuffle: <del> # Shuffle locally at each iteration <del> dataset = dataset.shuffle(buffer_size=batch_size * 8, seed=seed) <del> dataset = dataset.prefetch(tf.data.AUTOTUNE).batch(batch_size) <add> dataset = dataset.prefetch(tf.data.AUTOTUNE) <add> if batch_size is not None: <add> if shuffle: <add> # Shuffle locally at each iteration <add> dataset = dataset.shuffle(buffer_size=batch_size * 8, seed=seed) <add> dataset = dataset.batch(batch_size) <add> else: <add> if shuffle: <add> dataset = dataset.shuffle(buffer_size=len(dataset), seed=seed) <add> <ide> # Users may need to reference `class_names`. <ide> dataset.class_names = class_names <ide> # Include file paths for images as attribute. <ide><path>keras/preprocessing/image_dataset_test.py <ide> def test_image_dataset_from_directory_errors(self): <ide> _ = image_dataset.image_dataset_from_directory( <ide> directory, validation_split=0.2, subset='training') <ide> <add> def test_image_dataset_from_directory_not_batched(self): <add> if PIL is None: <add> return # Skip test if PIL is not available. <add> <add> directory = self._prepare_directory(num_classes=2, count=2) <add> dataset = image_dataset.image_dataset_from_directory( <add> directory, batch_size=None, image_size=(18, 18), <add> label_mode=None, shuffle=False) <add> sample = next(iter(dataset)) <add> self.assertEqual(len(sample.shape), 3) <ide> <ide> if __name__ == '__main__': <ide> tf.compat.v1.enable_v2_behavior() <ide><path>keras/preprocessing/text_dataset.py <ide> def text_dataset_from_directory(directory, <ide> to control the order of the classes <ide> (otherwise alphanumerical order is used). <ide> batch_size: Size of the batches of data. Default: 32. <add> If `None`, the data will not be batched <add> (the dataset will yield individual samples). <ide> max_length: Maximum size of a text string. Texts longer than this will <ide> be truncated to `max_length`. <ide> shuffle: Whether to shuffle the data. Default: True. <ide> def text_dataset_from_directory(directory, <ide> label_mode=label_mode, <ide> num_classes=len(class_names), <ide> max_length=max_length) <del> if shuffle: <del> # Shuffle locally at each iteration <del> dataset = dataset.shuffle(buffer_size=batch_size * 8, seed=seed) <del> dataset = dataset.prefetch(tf.data.AUTOTUNE).batch(batch_size) <add> dataset = dataset.prefetch(tf.data.AUTOTUNE) <add> if batch_size is not None: <add> if shuffle: <add> # Shuffle locally at each iteration <add> dataset = dataset.shuffle(buffer_size=batch_size * 8, seed=seed) <add> dataset = dataset.batch(batch_size) <add> else: <add> if shuffle: <add> dataset = dataset.shuffle(buffer_size=len(dataset), seed=seed) <add> <ide> # Users may need to reference `class_names`. <ide> dataset.class_names = class_names <ide> return dataset <ide><path>keras/preprocessing/text_dataset_test.py <ide> def test_text_dataset_from_directory_errors(self): <ide> _ = text_dataset.text_dataset_from_directory( <ide> directory, validation_split=0.2, subset='training') <ide> <add> def test_text_dataset_from_directory_not_batched(self): <add> directory = self._prepare_directory() <add> dataset = text_dataset.text_dataset_from_directory( <add> directory, batch_size=None, label_mode=None, follow_links=True) <add> <add> sample = next(iter(dataset)) <add> self.assertEqual(len(sample.shape), 0) <add> <ide> <ide> if __name__ == '__main__': <ide> tf.compat.v1.enable_v2_behavior() <ide><path>keras/preprocessing/timeseries.py <ide> def timeseries_dataset_from_array( <ide> `data[i], data[i + r], ... data[i + sequence_length]` <ide> are used for create a sample sequence. <ide> batch_size: Number of timeseries samples in each batch <del> (except maybe the last one). If `None`, it doesn't make batches. <add> (except maybe the last one). If `None`, the data will not be batched <add> (the dataset will yield individual samples). <ide> shuffle: Whether to shuffle output samples, <ide> or instead draw them in chronological order. <ide> seed: Optional int; random seed for shuffling. <ide> def timeseries_dataset_from_array( <ide> target_ds = sequences_from_indices( <ide> targets, indices, start_index, end_index) <ide> dataset = tf.data.Dataset.zip((dataset, target_ds)) <del> if shuffle: <del> # Shuffle locally at each iteration <del> dataset = dataset.shuffle(buffer_size=batch_size * 8, seed=seed) <ide> dataset = dataset.prefetch(tf.data.AUTOTUNE) <ide> if batch_size is not None: <add> if shuffle: <add> # Shuffle locally at each iteration <add> dataset = dataset.shuffle(buffer_size=batch_size * 8, seed=seed) <ide> dataset = dataset.batch(batch_size) <add> else: <add> if shuffle: <add> dataset = dataset.shuffle(buffer_size=len(dataset), seed=seed) <ide> return dataset <ide> <ide> <ide><path>keras/preprocessing/timeseries_test.py <ide> def test_errors(self): <ide> _ = timeseries.timeseries_dataset_from_array( <ide> np.arange(10), None, 3, sequence_stride=0) <ide> <del> <add> def test_not_batched(self): <add> data = np.arange(100) <add> <add> dataset = timeseries.timeseries_dataset_from_array( <add> data, None, <add> sequence_length=9, batch_size=None, shuffle=True) <add> sample = next(iter(dataset)) <add> self.assertEqual(len(sample.shape), 1) <add> <ide> if __name__ == '__main__': <ide> tf.compat.v1.enable_v2_behavior() <ide> tf.test.main()
6
Ruby
Ruby
fix error in deprecation
13e28f5f55cf8fbefc4a81c4ee1c1497a219de22
<ide><path>activerecord/lib/active_record/database_configurations/database_config.rb <ide> class DatabaseConfigurations <ide> # UrlConfig respectively. It will never return a DatabaseConfig object, <ide> # as this is the parent class for the types of database configuration objects. <ide> class DatabaseConfig # :nodoc: <del> attr_reader :env_name, :name, :spec_name <del> deprecate spec_name: "please use name instead" <add> attr_reader :env_name, :name <ide> <ide> attr_accessor :owner_name <ide> <ide> def initialize(env_name, name) <ide> @env_name = env_name <ide> @name = name <del> @spec_name = name <ide> end <ide> <add> def spec_name <add> @name <add> end <add> deprecate spec_name: "please use name instead" <add> <ide> def config <ide> raise NotImplementedError <ide> end
1
Ruby
Ruby
ignore apps found in time machine backups
4f8af059dfd0e73f23571747cc703bda29de9b8f
<ide><path>Library/Homebrew/os/mac.rb <ide> def compilers_standard? <ide> end <ide> <ide> def app_with_bundle_id(*ids) <del> path = mdfind(*ids).first <add> path = mdfind(*ids) <add> .reject { |p| p.include?("/Backups.backupdb/") } <add> .first <ide> Pathname.new(path) unless path.nil? || path.empty? <ide> end <ide>
1
Javascript
Javascript
remove references to `window`
2cec8f99f4a993d5a128ee682b061be9a3cfd496
<ide><path>packages/loader/lib/main.js <ide> var define, requireModule, require, requirejs, Ember; <ide> <ide> (function() { <del> Ember = window.Ember = window.Ember || {}; <add> Ember = this.Ember = this.Ember || {}; <ide> if (typeof Ember === 'undefined') { Ember = {} }; <ide> <ide> if (typeof Ember.__loader === 'undefined') { <ide><path>packages_es6/ember-metal/lib/core.js <ide> @version VERSION_STRING_PLACEHOLDER <ide> */ <ide> <del>// We need to make sure to operate on the same object if window.Ember already <del>// existed. <del>Ember = window.Ember; <ide> if ('undefined' === typeof Ember) { <ide> // Create core object. Make it act like an instance of Ember.Namespace so that <ide> // objects assigned to it are given a sane string representation. <ide> if ('undefined' === typeof Ember.deprecateFunc) { <ide> */ <ide> Ember.uuid = 0; <ide> <del>window.Em = window.Ember = Ember; <del> <ide> export default Ember;
2
Python
Python
fix comparison when version is none
90e79bd64d139f7938660635cbce558c39d98053
<ide><path>numpy/distutils/fcompiler/gnu.py <ide> from numpy.distutils.fcompiler import FCompiler <ide> from numpy.distutils.exec_command import exec_command <ide> from numpy.distutils.misc_util import msvc_runtime_library <add>from numpy.distutils.compat import get_exception <ide> <ide> compilers = ['GnuFCompiler', 'Gnu95FCompiler'] <ide> <ide> def get_flags_debug(self): <ide> return ['-g'] <ide> <ide> def get_flags_opt(self): <del> if self.get_version()<='3.3.3': <add> v = self.get_version() <add> if v and v<='3.3.3': <ide> # With this compiler version building Fortran BLAS/LAPACK <ide> # with -O3 caused failures in lib.lapack heevr,syevr tests. <ide> opt = ['-O2'] <ide> def _can_target(cmd, arch): <ide> compiler = Gnu95FCompiler() <ide> compiler.customize() <ide> print(compiler.get_version()) <del> except Exception, msg: <add> except Exception: <add> msg = get_exception() <ide> print(msg) <ide> raw_input('Press ENTER to continue...')
1
Go
Go
add test for successful ulimit parse
a97ca674f06cc7e70cc6defd617afa7775a8480a
<ide><path>pkg/ulimit/ulimit_test.go <ide> package ulimit <ide> <ide> import "testing" <ide> <add>func TestParseValid(t *testing.T) { <add> u1 := &Ulimit{"nofile", 1024, 512} <add> if u2, _ := Parse("nofile=512:1024"); u1 == u2 { <add> t.Fatalf("expected %s, but got %s", u1.String(), u2.String()) <add> } <add>} <add> <ide> func TestParseInvalidLimitType(t *testing.T) { <ide> if _, err := Parse("notarealtype=1024:1024"); err == nil { <ide> t.Fatalf("expected error on invalid ulimit type")
1
Ruby
Ruby
add a disconnect callback
55c956b346dfb26a0ac5a5686f4be7f96b28cff6
<ide><path>lib/action_cable/channel/base.rb <ide> class Base <ide> include Callbacks <ide> include Redis <ide> <del> on_subscribe :start_periodic_timers <add> on_subscribe :start_periodic_timers <ide> on_unsubscribe :stop_periodic_timers <ide> <add> on_unsubscribe :disconnect <add> <ide> attr_reader :params <ide> <ide> class_attribute :channel_name <ide> def connect <ide> # Override in subclasses <ide> end <ide> <add> def disconnect <add> # Override in subclasses <add> end <add> <ide> def broadcast(data) <ide> @connection.broadcast({ identifier: @channel_identifier, message: data }.to_json) <ide> end
1
PHP
PHP
pass config name to database extensions
f66c859f8bdf47d2b58922759d0e2854fcfb084b
<ide><path>src/Illuminate/Database/DatabaseManager.php <ide> protected function makeConnection($name) <ide> // Closure and pass it the config allowing it to resolve the connection. <ide> if (isset($this->extensions[$name])) <ide> { <del> return call_user_func($this->extensions[$name], $config); <add> return call_user_func($this->extensions[$name], $config, $name); <ide> } <ide> <ide> $driver = $config['driver']; <ide> protected function makeConnection($name) <ide> // resolver for the drivers themselves which applies to all connections. <ide> if (isset($this->extensions[$driver])) <ide> { <del> return call_user_func($this->extensions[$driver], $config); <add> return call_user_func($this->extensions[$driver], $config, $name); <ide> } <ide> <ide> return $this->factory->make($config, $name);
1
PHP
PHP
use strict typing for date/time classes
98c5776251d342f04fa2042bc4b6b34bc7eda9af
<ide><path>src/I18n/Date.php <ide> <?php <add>declare(strict_types=1); <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <ide> class Date extends MutableDate implements JsonSerializable <ide> * @param array $options Array of options. <ide> * @return string Relative time string. <ide> */ <del> public function timeAgoInWords(array $options = []) <add> public function timeAgoInWords(array $options = []): string <ide> { <ide> return static::diffFormatter()->dateAgoInWords($this, $options); <ide> } <ide><path>src/I18n/DateFormatTrait.php <ide> <?php <add>declare(strict_types=1); <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <ide> trait DateFormatTrait <ide> * <ide> * @return string|null The default locale string to be used or null. <ide> */ <del> public static function getDefaultLocale() <add> public static function getDefaultLocale(): ?string <ide> { <ide> return static::$defaultLocale; <ide> } <ide> public static function getDefaultLocale() <ide> * @param string|null $locale The default locale string to be used or null. <ide> * @return void <ide> */ <del> public static function setDefaultLocale($locale = null) <add> public static function setDefaultLocale(?string $locale = null): void <ide> { <ide> static::$defaultLocale = $locale; <ide> } <ide> public static function setDefaultLocale($locale = null) <ide> * @param string|null $locale The locale name in which the date should be displayed (e.g. pt-BR) <ide> * @return string Formatted date string <ide> */ <del> public function nice($timezone = null, $locale = null) <add> public function nice($timezone = null, $locale = null): string <ide> { <ide> return $this->i18nFormat(static::$niceFormat, $timezone, $locale); <ide> } <ide> public function nice($timezone = null, $locale = null) <ide> * in which the date will be displayed. The timezone stored for this object will not <ide> * be changed. <ide> * @param string|null $locale The locale name in which the date should be displayed (e.g. pt-BR) <del> * @return string Formatted and translated date string <add> * @return string|int Formatted and translated date string <ide> */ <ide> public function i18nFormat($format = null, $timezone = null, $locale = null) <ide> { <ide> public function i18nFormat($format = null, $timezone = null, $locale = null) <ide> * Returns a translated and localized date string. <ide> * Implements what IntlDateFormatter::formatObject() is in PHP 5.5+ <ide> * <del> * @param \DateTime $date Date. <add> * @param \DateTime|\DateTimeImmutable $date Date. <ide> * @param string|int|array $format Format. <ide> * @param string $locale The locale name in which the date should be displayed. <ide> * @return string <ide> */ <del> protected function _formatObject($date, $format, $locale) <add> protected function _formatObject($date, $format, ?string $locale): string <ide> { <ide> $pattern = $dateFormat = $timeFormat = $calendar = null; <add> $locale = (string)$locale; <ide> <ide> if (is_array($format)) { <ide> list($dateFormat, $timeFormat) = $format; <ide> protected function _formatObject($date, $format, $locale) <ide> } <ide> $formatter = datefmt_create( <ide> $locale, <del> $dateFormat, <del> $timeFormat, <add> (int)$dateFormat, <add> (int)$timeFormat, <ide> $timezone, <ide> $calendar, <del> $pattern <add> (string)$pattern <ide> ); <ide> if (!$formatter) { <ide> throw new RuntimeException( <ide> public function __toString() <ide> * <ide> * @return void <ide> */ <del> public static function resetToStringFormat() <add> public static function resetToStringFormat(): void <ide> { <ide> static::setToStringFormat([IntlDateFormatter::SHORT, IntlDateFormatter::SHORT]); <ide> } <ide> public static function resetToStringFormat() <ide> * @param string|array|int $format Format. <ide> * @return void <ide> */ <del> public static function setToStringFormat($format) <add> public static function setToStringFormat($format): void <ide> { <ide> static::$_toStringFormat = $format; <ide> } <ide> public static function setToStringFormat($format) <ide> * @param string|array|int $format Format. <ide> * @return void <ide> */ <del> public static function setJsonEncodeFormat($format) <add> public static function setJsonEncodeFormat($format): void <ide> { <ide> static::$_jsonEncodeFormat = $format; <ide> } <ide> public static function setJsonEncodeFormat($format) <ide> * @param string|array|null $format Any format accepted by IntlDateFormatter. <ide> * @return static|null <ide> */ <del> public static function parseDateTime($time, $format = null) <add> public static function parseDateTime(string $time, $format = null) <ide> { <ide> $dateFormat = $format ?: static::$_toStringFormat; <ide> $timeFormat = $pattern = null; <ide> public static function parseDateTime($time, $format = null) <ide> <ide> $defaultTimezone = static::$_isDateInstance ? 'UTC' : date_default_timezone_get(); <ide> $formatter = datefmt_create( <del> static::$defaultLocale, <del> $dateFormat, <del> $timeFormat, <add> (string)static::$defaultLocale, <add> (int)$dateFormat, <add> (int)$timeFormat, <ide> $defaultTimezone, <ide> null, <del> $pattern <add> (string)$pattern <ide> ); <ide> $time = $formatter->parse($time); <ide> if ($time !== false) { <ide> public static function parseDateTime($time, $format = null) <ide> * @param string|int|null $format Any format accepted by IntlDateFormatter. <ide> * @return static|null <ide> */ <del> public static function parseDate($date, $format = null) <add> public static function parseDate(string $date, $format = null) <ide> { <ide> if (is_int($format)) { <ide> $format = [$format, -1]; <ide> public static function parseDate($date, $format = null) <ide> * @param string|int|null $format Any format accepted by IntlDateFormatter. <ide> * @return static|null <ide> */ <del> public static function parseTime($time, $format = null) <add> public static function parseTime(string $time, $format = null) <ide> { <ide> if (is_int($format)) { <ide> $format = [-1, $format]; <ide> public static function parseTime($time, $format = null) <ide> /** <ide> * Returns a string that should be serialized when converting this object to json <ide> * <del> * @return string <add> * @return string|int <ide> */ <ide> public function jsonSerialize() <ide> { <ide><path>src/I18n/FrozenDate.php <ide> <?php <add>declare(strict_types=1); <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <ide> class FrozenDate extends ChronosDate implements JsonSerializable <ide> * @param array $options Array of options. <ide> * @return string Relative time string. <ide> */ <del> public function timeAgoInWords(array $options = []) <add> public function timeAgoInWords(array $options = []): string <ide> { <ide> return static::diffFormatter()->dateAgoInWords($this, $options); <ide> } <ide><path>src/I18n/FrozenTime.php <ide> <?php <add>declare(strict_types=1); <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <ide> public function __construct($time = null, $tz = null) <ide> * @param array $options Array of options. <ide> * @return string Relative time string. <ide> */ <del> public function timeAgoInWords(array $options = []) <add> public function timeAgoInWords(array $options = []): string <ide> { <ide> return static::diffFormatter()->timeAgoInWords($this, $options); <ide> } <ide> public function timeAgoInWords(array $options = []) <ide> * @return array List of timezone identifiers <ide> * @since 2.2 <ide> */ <del> public static function listTimezones($filter = null, $country = null, $options = []) <add> public static function listTimezones($filter = null, $country = null, $options = []): array <ide> { <ide> if (is_bool($options)) { <ide> $options = [ <ide><path>src/I18n/RelativeTimeFormatter.php <ide> <?php <add>declare(strict_types=1); <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <ide> class RelativeTimeFormatter <ide> * @return string The difference between the two days in a human readable format <ide> * @see \Cake\Chronos\ChronosInterface::diffForHumans <ide> */ <del> public function diffForHumans(ChronosInterface $date, ?ChronosInterface $other = null, $absolute = false) <add> public function diffForHumans(ChronosInterface $date, ?ChronosInterface $other = null, bool $absolute = false): string <ide> { <ide> $isNow = $other === null; <ide> if ($isNow) { <ide> public function diffForHumans(ChronosInterface $date, ?ChronosInterface $other = <ide> * @return string Relative time string. <ide> * @see \Cake\I18n\Time::timeAgoInWords() <ide> */ <del> public function timeAgoInWords(DateTimeInterface $time, array $options = []) <add> public function timeAgoInWords(DateTimeInterface $time, array $options = []): string <ide> { <ide> $options = $this->_options($options, FrozenTime::class); <ide> if ($options['timezone'] && $time instanceof ChronosInterface) { <ide> public function timeAgoInWords(DateTimeInterface $time, array $options = []) <ide> * @param array $options An array of options. <ide> * @return array An array of values. <ide> */ <del> protected function _diffData($futureTime, $pastTime, $backwards, $options) <add> protected function _diffData($futureTime, $pastTime, $backwards, $options): array <ide> { <del> $diff = (int)$futureTime - (int)$pastTime; <add> $futureTime = (int)$futureTime; <add> $pastTime = (int)$pastTime; <add> $diff = $futureTime - $pastTime; <ide> <ide> // If more than a week, then take into account the length of months <ide> if ($diff >= 604800) { <ide> protected function _diffData($futureTime, $pastTime, $backwards, $options) <ide> $days = $future['d'] - $past['d']; <ide> } else { <ide> $daysInPastMonth = date('t', $pastTime); <del> $daysInFutureMonth = date('t', mktime(0, 0, 0, $future['m'] - 1, 1, $future['Y'])); <add> $daysInFutureMonth = date('t', mktime(0, 0, 0, $future['m'] - 1, 1, (int)$future['Y'])); <ide> <ide> if (!$backwards) { <ide> $days = ($daysInPastMonth - $past['d']) + $future['d']; <ide> protected function _diffData($futureTime, $pastTime, $backwards, $options) <ide> * @return string Relative date string. <ide> * @see \Cake\I18n\Date::timeAgoInWords() <ide> */ <del> public function dateAgoInWords(DateTimeInterface $date, array $options = []) <add> public function dateAgoInWords(DateTimeInterface $date, array $options = []): string <ide> { <ide> $options = $this->_options($options, FrozenDate::class); <ide> if ($options['timezone'] && $date instanceof ChronosInterface) { <ide> public function dateAgoInWords(DateTimeInterface $date, array $options = []) <ide> * @param string $class The class name to use for defaults. <ide> * @return array Options with defaults applied. <ide> */ <del> protected function _options($options, $class) <add> protected function _options(array $options, string $class): array <ide> { <ide> $options += [ <ide> 'from' => $class::now(), <ide><path>src/I18n/Time.php <ide> <?php <add>declare(strict_types=1); <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <ide> public function __construct($time = null, $tz = null) <ide> * @param string|null $locale The locale name in which the date should be displayed (e.g. pt-BR) <ide> * @return string Formatted date string <ide> */ <del> public function nice($timezone = null, $locale = null) <add> public function nice($timezone = null, $locale = null): string <ide> { <ide> return $this->i18nFormat(static::$niceFormat, $timezone, $locale); <ide> } <ide> public function nice($timezone = null, $locale = null) <ide> * <ide> * @return bool <ide> */ <del> public function isThisWeek() <add> public function isThisWeek(): bool <ide> { <ide> return static::now($this->getTimezone())->format('W o') === $this->format('W o'); <ide> } <ide> public function isThisWeek() <ide> * <ide> * @return bool <ide> */ <del> public function isThisMonth() <add> public function isThisMonth(): bool <ide> { <ide> return static::now($this->getTimezone())->format('m Y') === $this->format('m Y'); <ide> } <ide> public function isThisMonth() <ide> * <ide> * @return bool <ide> */ <del> public function isThisYear() <add> public function isThisYear(): bool <ide> { <ide> return static::now($this->getTimezone())->format('Y') === $this->format('Y'); <ide> } <ide> public function toQuarter($range = false) <ide> * <ide> * @return string UNIX timestamp <ide> */ <del> public function toUnixString() <add> public function toUnixString(): string <ide> { <ide> return $this->format('U'); <ide> } <ide> public function toUnixString() <ide> * @param array $options Array of options. <ide> * @return string Relative time string. <ide> */ <del> public function timeAgoInWords(array $options = []) <add> public function timeAgoInWords(array $options = []): string <ide> { <ide> return static::diffFormatter()->timeAgoInWords($this, $options); <ide> } <ide> public function timeAgoInWords(array $options = []) <ide> * @return array List of timezone identifiers <ide> * @since 2.2 <ide> */ <del> public static function listTimezones($filter = null, $country = null, $options = []) <add> public static function listTimezones($filter = null, $country = null, $options = []): array <ide> { <ide> if (is_bool($options)) { <ide> $options = [ <ide><path>tests/TestCase/I18n/DateTest.php <ide> <?php <add>declare(strict_types=1); <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <ide> public static function classNameProvider() <ide> public function testConstructFromAnotherInstance($class) <ide> { <ide> $time = '2015-01-22'; <del> $frozen = new FrozenDate($time, 'America/Chicago'); <add> $frozen = new FrozenDate($time); <ide> $subject = new $class($frozen); <ide> $this->assertEquals($time, $subject->format('Y-m-d'), 'frozen date construction'); <ide> <del> $mut = new Date($time, 'America/Chicago'); <add> $mut = new Date($time); <ide> $subject = new $class($mut); <ide> $this->assertEquals($time, $subject->format('Y-m-d'), 'mutable date construction'); <ide> } <ide><path>tests/TestCase/I18n/TimeTest.php <ide> <?php <add>declare(strict_types=1); <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <ide> public function testDiffForHumansAbsolute($class) <ide> { <ide> Time::setTestNow(new $class('2015-12-12 10:10:10')); <ide> $time = new $class('2014-04-20 10:10:10'); <del> $this->assertEquals('1 year', $time->diffForHumans(null, ['absolute' => true])); <add> $this->assertEquals('1 year', $time->diffForHumans(null, true)); <ide> <ide> $other = new $class('2014-04-27 10:10:10'); <del> $this->assertEquals('1 week', $time->diffForHumans($other, ['absolute' => true])); <add> $this->assertEquals('1 week', $time->diffForHumans($other, true)); <ide> <ide> $time = new $class('2016-04-20 10:10:10'); <del> $this->assertEquals('4 months', $time->diffForHumans(null, ['absolute' => true])); <add> $this->assertEquals('4 months', $time->diffForHumans(null, true)); <ide> } <ide> <ide> /**
8
Mixed
Python
sync dag specific permissions when parsing
d52ad87520e4bfe978794aed550d627e8a14a02a
<ide><path>UPDATING.md <ide> The `default_queue` configuration option has been moved from `[celery]` section <ide> <ide> This allows Airflow to work more reliably with some environments (like Azure) by default. <ide> <add>### `sync-perm` CLI no longer syncs DAG specific permissions by default <add> <add>The `sync-perm` CLI command will no longer sync DAG specific permissions by default as they are now being handled during <add>DAG parsing. If you need or want the old behavior, you can pass `--include-dags` to have `sync-perm` also sync DAG <add>specific permissions. <add> <ide> ## Airflow 2.0.1 <ide> <ide> ### Permission to view Airflow Configurations has been removed from `User` and `Viewer` role <ide><path>airflow/cli/cli_parser.py <ide> def _check(value): <ide> help="If passed, this command will be successful even if multiple matching alive jobs are found.", <ide> ) <ide> <add># sync-perm <add>ARG_INCLUDE_DAGS = Arg( <add> ("--include-dags",), help="If passed, DAG specific permissions will also be synced.", action="store_true" <add>) <add> <ide> ALTERNATIVE_CONN_SPECS_ARGS = [ <ide> ARG_CONN_TYPE, <ide> ARG_CONN_DESCRIPTION, <ide> class GroupCommand(NamedTuple): <ide> ), <ide> ActionCommand( <ide> name='sync-perm', <del> help="Update permissions for existing roles and DAGs", <add> help="Update permissions for existing roles and optionally DAGs", <ide> func=lazy_load_command('airflow.cli.commands.sync_perm_command.sync_perm'), <del> args=(), <add> args=(ARG_INCLUDE_DAGS,), <ide> ), <ide> ActionCommand( <ide> name='rotate-fernet-key', <ide><path>airflow/cli/commands/sync_perm_command.py <ide> # specific language governing permissions and limitations <ide> # under the License. <ide> """Sync permission command""" <del>from airflow.models import DagBag <ide> from airflow.utils import cli as cli_utils <ide> from airflow.www.app import cached_app <ide> <ide> def sync_perm(args): <ide> # Add missing permissions for all the Base Views _before_ syncing/creating roles <ide> appbuilder.add_permissions(update_perms=True) <ide> appbuilder.sm.sync_roles() <del> print('Updating permission on all DAG views') <del> dagbag = DagBag(read_dags_from_db=True) <del> dagbag.collect_dags_from_db() <del> dags = dagbag.dags.values() <del> for dag in dags: <del> appbuilder.sm.sync_perm_for_dag(dag.dag_id, dag.access_control) <add> if args.include_dags: <add> print('Updating permission on all DAG views') <add> appbuilder.sm.create_dag_specific_permissions() <ide><path>airflow/models/dagbag.py <ide> def _serialize_dag_capturing_errors(dag, session): <ide> return [] <ide> try: <ide> # We cant use bulk_write_to_db as we want to capture each error individually <del> SerializedDagModel.write_dag( <add> dag_was_updated = SerializedDagModel.write_dag( <ide> dag, <ide> min_update_interval=settings.MIN_SERIALIZED_DAG_UPDATE_INTERVAL, <ide> session=session, <ide> ) <add> if dag_was_updated: <add> self.log.debug("Syncing DAG permissions: %s to the DB", dag.dag_id) <add> from airflow.www.security import ApplessAirflowSecurityManager <add> <add> security_manager = ApplessAirflowSecurityManager(session=session) <add> security_manager.sync_perm_for_dag(dag.dag_id, dag.access_control) <ide> return [] <ide> except OperationalError: <ide> raise <ide><path>airflow/models/serialized_dag.py <ide> def __repr__(self): <ide> <ide> @classmethod <ide> @provide_session <del> def write_dag(cls, dag: DAG, min_update_interval: Optional[int] = None, session: Session = None): <add> def write_dag(cls, dag: DAG, min_update_interval: Optional[int] = None, session: Session = None) -> bool: <ide> """Serializes a DAG and writes it into database. <ide> If the record already exists, it checks if the Serialized DAG changed or not. If it is <ide> changed, it updates the record, ignores otherwise. <ide> <ide> :param dag: a DAG to be written into database <ide> :param min_update_interval: minimal interval in seconds to update serialized DAG <ide> :param session: ORM Session <add> <add> :returns: Boolean indicating if the DAG was written to the DB <ide> """ <ide> # Checks if (Current Time - Time when the DAG was written to DB) < min_update_interval <ide> # If Yes, does nothing <ide> def write_dag(cls, dag: DAG, min_update_interval: Optional[int] = None, session: <ide> ) <ide> ) <ide> ).scalar(): <del> return <add> return False <ide> <ide> log.debug("Checking if DAG (%s) changed", dag.dag_id) <ide> new_serialized_dag = cls(dag) <ide> serialized_dag_hash_from_db = session.query(cls.dag_hash).filter(cls.dag_id == dag.dag_id).scalar() <ide> <ide> if serialized_dag_hash_from_db == new_serialized_dag.dag_hash: <ide> log.debug("Serialized DAG (%s) is unchanged. Skipping writing to DB", dag.dag_id) <del> return <add> return False <ide> <ide> log.debug("Writing Serialized DAG: %s to the DB", dag.dag_id) <ide> session.merge(new_serialized_dag) <ide> log.debug("DAG: %s written to the DB", dag.dag_id) <add> return True <ide> <ide> @classmethod <ide> @provide_session <ide><path>airflow/www/security.py <ide> from sqlalchemy import or_ <ide> from sqlalchemy.orm import joinedload <ide> <del>from airflow import models <ide> from airflow.exceptions import AirflowException <del>from airflow.models import DagModel <add>from airflow.models import DagBag, DagModel <ide> from airflow.security import permissions <ide> from airflow.utils.log.logging_mixin import LoggingMixin <ide> from airflow.utils.session import provide_session <ide> def _get_all_roles_with_permissions(self) -> Dict[str, Role]: <ide> <ide> def create_dag_specific_permissions(self) -> None: <ide> """ <del> Creates 'can_read' and 'can_edit' permissions for all active and paused DAGs. <add> Creates 'can_read' and 'can_edit' permissions for all DAGs, <add> along with any `access_control` permissions provided in them. <add> <add> This does iterate through ALL the DAGs, which can be slow. See `sync_perm_for_dag` <add> if you only need to sync a single DAG. <ide> <ide> :return: None. <ide> """ <ide> perms = self.get_all_permissions() <del> rows = ( <del> self.get_session.query(models.DagModel.dag_id) <del> .filter(or_(models.DagModel.is_active, models.DagModel.is_paused)) <del> .all() <del> ) <add> dagbag = DagBag(read_dags_from_db=True) <add> dagbag.collect_dags_from_db() <add> dags = dagbag.dags.values() <ide> <del> for row in rows: <del> dag_id = row[0] <add> for dag in dags: <add> dag_resource_name = self.prefixed_dag_id(dag.dag_id) <ide> for perm_name in self.DAG_PERMS: <del> dag_resource_name = self.prefixed_dag_id(dag_id) <ide> if (perm_name, dag_resource_name) not in perms: <ide> self._merge_perm(perm_name, dag_resource_name) <ide> <add> if dag.access_control: <add> self._sync_dag_view_permissions(dag_resource_name, dag.access_control) <add> <ide> def update_admin_perm_view(self): <ide> """ <ide> Admin should have all the permission-views, except the dag views. <ide> def sync_roles(self): <ide> """ <ide> # Create global all-dag VM <ide> self.create_perm_vm_for_all_dag() <del> self.create_dag_specific_permissions() <ide> <ide> # Sync the default roles (Admin, Viewer, User, Op, public) with related permissions <ide> self.bulk_sync_roles(self.ROLE_CONFIGS) <ide> def sync_resource_permissions(self, perms=None): <ide> def sync_perm_for_dag(self, dag_id, access_control=None): <ide> """ <ide> Sync permissions for given dag id. The dag id surely exists in our dag bag <del> as only / refresh button or cli.sync_perm will call this function <add> as only / refresh button or DagBag will call this function <ide> <ide> :param dag_id: the ID of the DAG whose permissions should be updated <ide> :type dag_id: str <ide> def sync_perm_for_dag(self, dag_id, access_control=None): <ide> """ <ide> prefixed_dag_id = self.prefixed_dag_id(dag_id) <ide> for dag_perm in self.DAG_PERMS: <del> perm_on_dag = self.find_permission_view_menu(dag_perm, prefixed_dag_id) <del> if perm_on_dag is None: <del> self.add_permission_view_menu(dag_perm, prefixed_dag_id) <add> self.add_permission_view_menu(dag_perm, prefixed_dag_id) <ide> <ide> if access_control: <ide> self._sync_dag_view_permissions(prefixed_dag_id, access_control) <ide> def check_authorization( <ide> return False <ide> <ide> return True <add> <add> <add>class ApplessAirflowSecurityManager(AirflowSecurityManager): <add> """Security Manager that doesn't need the whole flask app""" <add> <add> def __init__(self, session=None): # pylint: disable=super-init-not-called <add> self.session = session <add> <add> @property <add> def get_session(self): <add> return self.session <ide><path>tests/cli/commands/test_sync_perm_command.py <ide> <ide> from airflow.cli import cli_parser <ide> from airflow.cli.commands import sync_perm_command <del>from airflow.models.dag import DAG <del>from airflow.models.dagbag import DagBag <del>from airflow.security import permissions <ide> <ide> <ide> class TestCliSyncPerm(unittest.TestCase): <ide> @classmethod <ide> def setUpClass(cls): <del> cls.dagbag = DagBag(include_examples=True) <ide> cls.parser = cli_parser.get_parser() <ide> <ide> @mock.patch("airflow.cli.commands.sync_perm_command.cached_app") <del> @mock.patch("airflow.cli.commands.sync_perm_command.DagBag") <del> def test_cli_sync_perm(self, dagbag_mock, mock_cached_app): <del> dags = [ <del> DAG('has_access_control', access_control={'Public': {permissions.ACTION_CAN_READ}}), <del> DAG('no_access_control'), <del> ] <add> def test_cli_sync_perm(self, mock_cached_app): <add> appbuilder = mock_cached_app.return_value.appbuilder <add> appbuilder.sm = mock.Mock() <ide> <del> collect_dags_from_db_mock = mock.Mock() <del> dagbag = mock.Mock() <add> args = self.parser.parse_args(['sync-perm']) <add> sync_perm_command.sync_perm(args) <ide> <del> dagbag.dags = {dag.dag_id: dag for dag in dags} <del> dagbag.collect_dags_from_db = collect_dags_from_db_mock <del> dagbag_mock.return_value = dagbag <add> appbuilder.add_permissions.assert_called_once_with(update_perms=True) <add> appbuilder.sm.sync_roles.assert_called_once_with() <add> appbuilder.sm.create_dag_specific_permissions.assert_not_called() <ide> <add> @mock.patch("airflow.cli.commands.sync_perm_command.cached_app") <add> def test_cli_sync_perm_include_dags(self, mock_cached_app): <ide> appbuilder = mock_cached_app.return_value.appbuilder <ide> appbuilder.sm = mock.Mock() <ide> <del> args = self.parser.parse_args(['sync-perm']) <add> args = self.parser.parse_args(['sync-perm', '--include-dags']) <ide> sync_perm_command.sync_perm(args) <ide> <del> assert appbuilder.sm.sync_roles.call_count == 1 <del> <del> dagbag_mock.assert_called_once_with(read_dags_from_db=True) <del> collect_dags_from_db_mock.assert_called_once_with() <del> assert 2 == len(appbuilder.sm.sync_perm_for_dag.mock_calls) <del> appbuilder.sm.sync_perm_for_dag.assert_any_call( <del> 'has_access_control', {'Public': {permissions.ACTION_CAN_READ}} <del> ) <del> appbuilder.sm.sync_perm_for_dag.assert_any_call( <del> 'no_access_control', <del> None, <del> ) <ide> appbuilder.add_permissions.assert_called_once_with(update_perms=True) <add> appbuilder.sm.sync_roles.assert_called_once_with() <add> appbuilder.sm.create_dag_specific_permissions.assert_called_once_with() <ide><path>tests/models/test_dagbag.py <ide> def test_sync_to_db_is_retried(self, mock_bulk_write_to_db, mock_s10n_write_dag, <ide> ] <ide> ) <ide> <add> @patch("airflow.models.dagbag.settings.MIN_SERIALIZED_DAG_UPDATE_INTERVAL", 5) <add> @patch("airflow.www.security.ApplessAirflowSecurityManager") <add> def test_sync_to_db_handles_dag_specific_permissions(self, mock_security_manager): <add> """ <add> Test that when dagbag.sync_to_db is called new DAGs and updates DAGs have their <add> DAG specific permissions synced <add> """ <add> with create_session() as session: <add> # New DAG <add> dagbag = DagBag( <add> dag_folder=os.path.join(TEST_DAGS_FOLDER, "test_example_bash_operator.py"), <add> include_examples=False, <add> ) <add> with freeze_time(tz.datetime(2020, 1, 5, 0, 0, 0)): <add> dagbag.sync_to_db(session=session) <add> <add> mock_security_manager.return_value.sync_perm_for_dag.assert_called_once_with( <add> "test_example_bash_operator", None <add> ) <add> <add> # DAG is updated <add> mock_security_manager.reset_mock() <add> dagbag.dags["test_example_bash_operator"].tags = ["new_tag"] <add> with freeze_time(tz.datetime(2020, 1, 5, 0, 0, 20)): <add> dagbag.sync_to_db(session=session) <add> <add> mock_security_manager.return_value.sync_perm_for_dag.assert_called_once_with( <add> "test_example_bash_operator", None <add> ) <add> <add> # DAG isn't updated <add> mock_security_manager.reset_mock() <add> with freeze_time(tz.datetime(2020, 1, 5, 0, 0, 40)): <add> dagbag.sync_to_db(session=session) <add> <add> mock_security_manager.return_value.sync_perm_for_dag.assert_not_called() <add> <ide> @patch("airflow.models.dagbag.settings.MIN_SERIALIZED_DAG_UPDATE_INTERVAL", 5) <ide> @patch("airflow.models.dagbag.settings.MIN_SERIALIZED_DAG_FETCH_INTERVAL", 5) <ide> def test_get_dag_with_dag_serialization(self): <ide><path>tests/models/test_serialized_dag.py <ide> def test_serialized_dag_is_updated_only_if_dag_is_changed(self): <ide> <ide> example_dags = make_example_dags(example_dags_module) <ide> example_bash_op_dag = example_dags.get("example_bash_operator") <del> SDM.write_dag(dag=example_bash_op_dag) <add> dag_updated = SDM.write_dag(dag=example_bash_op_dag) <add> assert dag_updated is True <ide> <ide> with create_session() as session: <ide> s_dag = session.query(SDM).get(example_bash_op_dag.dag_id) <ide> <ide> # Test that if DAG is not changed, Serialized DAG is not re-written and last_updated <ide> # column is not updated <del> SDM.write_dag(dag=example_bash_op_dag) <add> dag_updated = SDM.write_dag(dag=example_bash_op_dag) <ide> s_dag_1 = session.query(SDM).get(example_bash_op_dag.dag_id) <ide> <ide> assert s_dag_1.dag_hash == s_dag.dag_hash <ide> assert s_dag.last_updated == s_dag_1.last_updated <add> assert dag_updated is False <ide> <ide> # Update DAG <ide> example_bash_op_dag.tags += ["new_tag"] <ide> assert set(example_bash_op_dag.tags) == {"example", "example2", "new_tag"} <ide> <del> SDM.write_dag(dag=example_bash_op_dag) <add> dag_updated = SDM.write_dag(dag=example_bash_op_dag) <ide> s_dag_2 = session.query(SDM).get(example_bash_op_dag.dag_id) <ide> <ide> assert s_dag.last_updated != s_dag_2.last_updated <ide> assert s_dag.dag_hash != s_dag_2.dag_hash <ide> assert s_dag_2.data["dag"]["tags"] == ["example", "example2", "new_tag"] <add> assert dag_updated is True <ide> <ide> def test_read_dags(self): <ide> """DAGs can be read from database.""" <ide><path>tests/www/test_security.py <ide> from airflow import settings <ide> from airflow.exceptions import AirflowException <ide> from airflow.models import DagModel <add>from airflow.models.dag import DAG <ide> from airflow.security import permissions <ide> from airflow.www import app as application <ide> from airflow.www.utils import CustomSQLAInterface <ide> def test_has_all_dag_access(self, mock_has_role, mock_has_perm): <ide> <ide> def test_access_control_with_non_existent_role(self): <ide> with pytest.raises(AirflowException) as ctx: <del> self.security_manager.sync_perm_for_dag( <add> self.security_manager._sync_dag_view_permissions( <ide> dag_id='access-control-test', <ide> access_control={ <ide> 'this-role-does-not-exist': [permissions.ACTION_CAN_EDIT, permissions.ACTION_CAN_READ] <ide> def test_access_control_with_invalid_permission(self): <ide> for permission in invalid_permissions: <ide> self.expect_user_is_in_role(user, rolename='team-a') <ide> with pytest.raises(AirflowException) as ctx: <del> self.security_manager.sync_perm_for_dag( <add> self.security_manager._sync_dag_view_permissions( <ide> 'access_control_test', access_control={'team-a': {permission}} <ide> ) <ide> assert "invalid permissions" in str(ctx.value) <ide> def test_access_control_is_set_on_init(self): <ide> permissions=[], <ide> ) <ide> self.expect_user_is_in_role(user, rolename='team-a') <del> self.security_manager.sync_perm_for_dag( <add> self.security_manager._sync_dag_view_permissions( <ide> 'access_control_test', <ide> access_control={'team-a': [permissions.ACTION_CAN_EDIT, permissions.ACTION_CAN_READ]}, <ide> ) <ide> def test_access_control_stale_perms_are_revoked(self): <ide> permissions=[], <ide> ) <ide> self.expect_user_is_in_role(user, rolename='team-a') <del> self.security_manager.sync_perm_for_dag( <add> self.security_manager._sync_dag_view_permissions( <ide> 'access_control_test', access_control={'team-a': READ_WRITE} <ide> ) <ide> self.assert_user_has_dag_perms(perms=READ_WRITE, dag_id='access_control_test', user=user) <ide> <del> self.security_manager.sync_perm_for_dag( <add> self.security_manager._sync_dag_view_permissions( <ide> 'access_control_test', access_control={'team-a': READ_ONLY} <ide> ) <ide> self.assert_user_has_dag_perms( <ide> def test_correct_roles_have_perms_to_read_config(self): <ide> f"on {permissions.RESOURCE_CONFIG}" <ide> ) <ide> <del> def test_create_dag_specific_permissions(self): <del> dag_id = 'some_dag_id' <del> dag_permission_name = self.security_manager.prefixed_dag_id(dag_id) <del> assert ('can_read', dag_permission_name) not in self.security_manager.get_all_permissions() <add> @mock.patch("airflow.www.security.DagBag") <add> def test_create_dag_specific_permissions(self, dagbag_mock): <add> access_control = {'Public': {permissions.ACTION_CAN_READ}} <add> dags = [ <add> DAG('has_access_control', access_control=access_control), <add> DAG('no_access_control'), <add> ] <ide> <del> dag_model = DagModel( <del> dag_id=dag_id, fileloc='/tmp/dag_.py', schedule_interval='2 2 * * *', is_paused=True <del> ) <del> self.session.add(dag_model) <del> self.session.commit() <add> collect_dags_from_db_mock = mock.Mock() <add> dagbag = mock.Mock() <add> <add> dagbag.dags = {dag.dag_id: dag for dag in dags} <add> dagbag.collect_dags_from_db = collect_dags_from_db_mock <add> dagbag_mock.return_value = dagbag <add> <add> self.security_manager._sync_dag_view_permissions = mock.Mock() <add> <add> for dag in dags: <add> prefixed_dag_id = self.security_manager.prefixed_dag_id(dag.dag_id) <add> all_perms = self.security_manager.get_all_permissions() <add> assert ('can_read', prefixed_dag_id) not in all_perms <add> assert ('can_edit', prefixed_dag_id) not in all_perms <ide> <ide> self.security_manager.create_dag_specific_permissions() <del> self.session.commit() <ide> <del> assert ('can_read', dag_permission_name) in self.security_manager.get_all_permissions() <add> dagbag_mock.assert_called_once_with(read_dags_from_db=True) <add> collect_dags_from_db_mock.assert_called_once_with() <add> <add> for dag in dags: <add> prefixed_dag_id = self.security_manager.prefixed_dag_id(dag.dag_id) <add> all_perms = self.security_manager.get_all_permissions() <add> assert ('can_read', prefixed_dag_id) in all_perms <add> assert ('can_edit', prefixed_dag_id) in all_perms <add> <add> self.security_manager._sync_dag_view_permissions.assert_called_once_with( <add> self.security_manager.prefixed_dag_id('has_access_control'), access_control <add> ) <ide> <del> # Make sure we short circuit when the perms already exist <del> with assert_queries_count(2): # One query to get DagModels, one query to get all perms <add> del dagbag.dags["has_access_control"] <add> with assert_queries_count(1): # one query to get all perms; dagbag is mocked <ide> self.security_manager.create_dag_specific_permissions() <ide> <ide> def test_get_all_permissions(self):
10
Ruby
Ruby
remove hermesc build dir for non-hermes build
c05e6c47df95f36f0afa94a7aa6725a34bee4095
<ide><path>scripts/cocoapods/jsengine.rb <ide> def remove_copy_hermes_framework_script_phase(installer, react_native_path) <ide> end <ide> project.save() <ide> end <add> <add>def remove_hermesc_build_dir(react_native_path) <add> %x(rm -rf #{react_native_path}/sdks/hermes-engine/build_host_hermesc) <add>end <ide><path>scripts/react_native_pods.rb <ide> def react_native_post_install(installer, react_native_path = "../node_modules/re <ide> add_copy_hermes_framework_script_phase(installer, react_native_path) <ide> else <ide> remove_copy_hermes_framework_script_phase(installer, react_native_path) <add> remove_hermesc_build_dir(react_native_path) <ide> end <ide> <ide> ReactNativePodsUtils.exclude_i386_architecture_while_using_hermes(installer)
2
PHP
PHP
add fire to fake
7f36ae486df02fb5f56ac64ddf8488a3a441f308
<ide><path>src/Illuminate/Support/Testing/Fakes/EventFake.php <ide> public function flush($event) <ide> // <ide> } <ide> <add> /** <add> * Fire an event and call the listeners. <add> * <add> * @param string|object $event <add> * @param mixed $payload <add> * @param bool $halt <add> * @return array|null <add> */ <add> public function fire($event, $payload = [], $halt = false) <add> { <add> return $this->dispatch($event, $payload, $halt); <add> } <add> <ide> /** <ide> * Fire an event and call the listeners. <ide> *
1
PHP
PHP
apply fixes from styleci
6cc389c9dbd5bf7337826a25f6f09cabfdbf58e8
<ide><path>src/Illuminate/Database/Eloquent/Concerns/GuardsAttributes.php <ide> namespace Illuminate\Database\Eloquent\Concerns; <ide> <ide> use Illuminate\Support\Str; <del>use LogicException; <ide> <ide> trait GuardsAttributes <ide> {
1
Java
Java
remove webworker support from timers
a20882f62ecc62de89938c5587c937da7dfca74e
<ide><path>ReactAndroid/src/main/java/com/facebook/react/modules/core/JSTimersExecution.java <ide> package com.facebook.react.modules.core; <ide> <ide> import com.facebook.react.bridge.JavaScriptModule; <del>import com.facebook.react.bridge.SupportsWebWorkers; <ide> import com.facebook.react.bridge.WritableArray; <ide> <del>@SupportsWebWorkers <ide> public interface JSTimersExecution extends JavaScriptModule { <ide> void callTimers(WritableArray timerIDs); <ide> void callIdleCallbacks(double frameTime); <ide><path>ReactAndroid/src/main/java/com/facebook/react/modules/core/Timing.java <ide> <ide> import javax.annotation.Nullable; <ide> <del>import java.util.ArrayList; <ide> import java.util.Comparator; <del>import java.util.HashMap; <del>import java.util.HashSet; <del>import java.util.List; <del>import java.util.Map; <ide> import java.util.PriorityQueue; <del>import java.util.Set; <ide> import java.util.concurrent.atomic.AtomicBoolean; <ide> <ide> import android.util.SparseArray; <ide> <ide> import com.facebook.react.bridge.Arguments; <del>import com.facebook.react.bridge.ExecutorToken; <ide> import com.facebook.react.bridge.LifecycleEventListener; <del>import com.facebook.react.bridge.OnExecutorUnregisteredListener; <ide> import com.facebook.react.bridge.ReactApplicationContext; <ide> import com.facebook.react.bridge.ReactContextBaseJavaModule; <ide> import com.facebook.react.bridge.ReactMethod; <ide> /** <ide> * Native module for JS timer execution. Timers fire on frame boundaries. <ide> */ <del>@ReactModule(name = Timing.NAME, supportsWebWorkers = true) <add>@ReactModule(name = Timing.NAME) <ide> public final class Timing extends ReactContextBaseJavaModule implements LifecycleEventListener, <del> OnExecutorUnregisteredListener, HeadlessJsTaskEventListener { <add> HeadlessJsTaskEventListener { <ide> <ide> protected static final String NAME = "Timing"; <ide> <ide> public final class Timing extends ReactContextBaseJavaModule implements Lifecycl <ide> private final DevSupportManager mDevSupportManager; <ide> <ide> private static class Timer { <del> <del> private final ExecutorToken mExecutorToken; <ide> private final int mCallbackID; <ide> private final boolean mRepeat; <ide> private final int mInterval; <ide> private long mTargetTime; <ide> <ide> private Timer( <del> ExecutorToken executorToken, <ide> int callbackID, <ide> long initialTargetTime, <ide> int duration, <ide> boolean repeat) { <del> mExecutorToken = executorToken; <ide> mCallbackID = callbackID; <ide> mTargetTime = initialTargetTime; <ide> mInterval = duration; <ide> private Timer( <ide> <ide> private class TimerFrameCallback extends ChoreographerCompat.FrameCallback { <ide> <del> // Temporary map for constructing the individual arrays of timers per ExecutorToken <del> private final HashMap<ExecutorToken, WritableArray> mTimersToCall = new HashMap<>(); <add> // Temporary map for constructing the individual arrays of timers to call <add> private @Nullable WritableArray mTimersToCall = null; <ide> <ide> /** <ide> * Calls all timers that have expired since the last time this frame callback was called. <ide> public void doFrame(long frameTimeNanos) { <ide> synchronized (mTimerGuard) { <ide> while (!mTimers.isEmpty() && mTimers.peek().mTargetTime < frameTimeMillis) { <ide> Timer timer = mTimers.poll(); <del> WritableArray timersForContext = mTimersToCall.get(timer.mExecutorToken); <del> if (timersForContext == null) { <del> timersForContext = Arguments.createArray(); <del> mTimersToCall.put(timer.mExecutorToken, timersForContext); <add> if (mTimersToCall == null) { <add> mTimersToCall = Arguments.createArray(); <ide> } <del> timersForContext.pushInt(timer.mCallbackID); <add> mTimersToCall.pushInt(timer.mCallbackID); <ide> if (timer.mRepeat) { <ide> timer.mTargetTime = frameTimeMillis + timer.mInterval; <ide> mTimers.add(timer); <ide> } else { <del> SparseArray<Timer> timers = mTimerIdsToTimers.get(timer.mExecutorToken); <del> if (timers != null) { <del> timers.remove(timer.mCallbackID); <del> if (timers.size() == 0) { <del> mTimerIdsToTimers.remove(timer.mExecutorToken); <del> } <del> } <add> mTimerIdsToTimers.remove(timer.mCallbackID); <ide> } <ide> } <ide> } <ide> <del> for (Map.Entry<ExecutorToken, WritableArray> entry : mTimersToCall.entrySet()) { <del> getReactApplicationContext().getJSModule(entry.getKey(), JSTimersExecution.class) <del> .callTimers(entry.getValue()); <add> if (mTimersToCall != null) { <add> getReactApplicationContext().getJSModule(JSTimersExecution.class).callTimers(mTimersToCall); <add> mTimersToCall = null; <ide> } <del> mTimersToCall.clear(); <ide> <ide> mReactChoreographer.postFrameCallback(ReactChoreographer.CallbackType.TIMERS_EVENTS, this); <ide> } <ide> public void run() { <ide> return; <ide> } <ide> <del> mIdleCallbackContextsToCall.clear(); <add> boolean sendIdleEvents; <ide> synchronized (mIdleCallbackGuard) { <del> mIdleCallbackContextsToCall.addAll(mSendIdleEventsExecutorTokens); <add> sendIdleEvents = mSendIdleEvents; <ide> } <ide> <del> for (ExecutorToken context : mIdleCallbackContextsToCall) { <del> getReactApplicationContext().getJSModule(context, JSTimersExecution.class) <add> if (sendIdleEvents) { <add> getReactApplicationContext().getJSModule(JSTimersExecution.class) <ide> .callIdleCallbacks(absoluteFrameStartTime); <ide> } <ide> <ide> public void cancel() { <ide> private final Object mTimerGuard = new Object(); <ide> private final Object mIdleCallbackGuard = new Object(); <ide> private final PriorityQueue<Timer> mTimers; <del> private final Map<ExecutorToken, SparseArray<Timer>> mTimerIdsToTimers; <add> private final SparseArray<Timer> mTimerIdsToTimers; <ide> private final AtomicBoolean isPaused = new AtomicBoolean(true); <ide> private final AtomicBoolean isRunningTasks = new AtomicBoolean(false); <ide> private final TimerFrameCallback mTimerFrameCallback = new TimerFrameCallback(); <ide> public void cancel() { <ide> private @Nullable IdleCallbackRunnable mCurrentIdleCallbackRunnable; <ide> private boolean mFrameCallbackPosted = false; <ide> private boolean mFrameIdleCallbackPosted = false; <del> private final Set<ExecutorToken> mSendIdleEventsExecutorTokens; <del> // Temporary array used to dipatch idle callbacks on the JS thread. <del> private final List<ExecutorToken> mIdleCallbackContextsToCall; <add> private boolean mSendIdleEvents = false; <ide> <ide> public Timing(ReactApplicationContext reactContext, DevSupportManager devSupportManager) { <ide> super(reactContext); <ide> public int compare(Timer lhs, Timer rhs) { <ide> } <ide> } <ide> }); <del> mTimerIdsToTimers = new HashMap<>(); <del> mSendIdleEventsExecutorTokens = new HashSet<>(); <del> mIdleCallbackContextsToCall = new ArrayList<>(); <add> mTimerIdsToTimers = new SparseArray<>(); <ide> mReactChoreographer = ReactChoreographer.getInstance(); <ide> } <ide> <ide> public void onCatalystInstanceDestroy() { <ide> <ide> private void maybeSetChoreographerIdleCallback() { <ide> synchronized (mIdleCallbackGuard) { <del> if (mSendIdleEventsExecutorTokens.size() > 0) { <add> if (mSendIdleEvents) { <ide> setChoreographerIdleCallback(); <ide> } <ide> } <ide> public String getName() { <ide> return NAME; <ide> } <ide> <del> @Override <del> public boolean supportsWebWorkers() { <del> return true; <del> } <del> <del> @Override <del> public void onExecutorDestroyed(ExecutorToken executorToken) { <del> synchronized (mTimerGuard) { <del> SparseArray<Timer> timersForContext = mTimerIdsToTimers.remove(executorToken); <del> if (timersForContext == null) { <del> return; <del> } <del> for (int i = 0; i < timersForContext.size(); i++) { <del> Timer timer = timersForContext.get(timersForContext.keyAt(i)); <del> mTimers.remove(timer); <del> } <del> } <del> <del> synchronized (mIdleCallbackGuard) { <del> mSendIdleEventsExecutorTokens.remove(executorToken); <del> } <del> } <del> <ide> @ReactMethod <ide> public void createTimer( <del> ExecutorToken executorToken, <ide> final int callbackID, <ide> final int duration, <ide> final double jsSchedulingTime, <ide> public void createTimer( <ide> if (mDevSupportManager.getDevSupportEnabled()) { <ide> long driftTime = Math.abs(remoteTime - deviceTime); <ide> if (driftTime > 60000) { <del> getReactApplicationContext().getJSModule(executorToken, JSTimersExecution.class) <add> getReactApplicationContext().getJSModule(JSTimersExecution.class) <ide> .emitTimeDriftWarning( <ide> "Debugger and device times have drifted by more than 60s. Please correct this by " + <ide> "running adb shell \"date `date +%m%d%H%M%Y.%S`\" on your debugger machine."); <ide> public void createTimer( <ide> if (duration == 0 && !repeat) { <ide> WritableArray timerToCall = Arguments.createArray(); <ide> timerToCall.pushInt(callbackID); <del> getReactApplicationContext().getJSModule(executorToken, JSTimersExecution.class) <add> getReactApplicationContext().getJSModule(JSTimersExecution.class) <ide> .callTimers(timerToCall); <ide> return; <ide> } <ide> <ide> long initialTargetTime = SystemClock.nanoTime() / 1000000 + adjustedDuration; <del> Timer timer = new Timer(executorToken, callbackID, initialTargetTime, duration, repeat); <add> Timer timer = new Timer(callbackID, initialTargetTime, duration, repeat); <ide> synchronized (mTimerGuard) { <ide> mTimers.add(timer); <del> SparseArray<Timer> timersForContext = mTimerIdsToTimers.get(executorToken); <del> if (timersForContext == null) { <del> timersForContext = new SparseArray<>(); <del> mTimerIdsToTimers.put(executorToken, timersForContext); <del> } <del> timersForContext.put(callbackID, timer); <add> mTimerIdsToTimers.put(callbackID, timer); <ide> } <ide> } <ide> <ide> @ReactMethod <del> public void deleteTimer(ExecutorToken executorToken, int timerId) { <add> public void deleteTimer(int timerId) { <ide> synchronized (mTimerGuard) { <del> SparseArray<Timer> timersForContext = mTimerIdsToTimers.get(executorToken); <del> if (timersForContext == null) { <del> return; <del> } <del> Timer timer = timersForContext.get(timerId); <add> Timer timer = mTimerIdsToTimers.get(timerId); <ide> if (timer == null) { <ide> return; <ide> } <del> // We may have already called/removed it <del> timersForContext.remove(timerId); <del> if (timersForContext.size() == 0) { <del> mTimerIdsToTimers.remove(executorToken); <del> } <add> mTimerIdsToTimers.remove(timerId); <ide> mTimers.remove(timer); <ide> } <ide> } <ide> <ide> @ReactMethod <del> public void setSendIdleEvents(ExecutorToken executorToken, boolean sendIdleEvents) { <add> public void setSendIdleEvents(final boolean sendIdleEvents) { <ide> synchronized (mIdleCallbackGuard) { <del> if (sendIdleEvents) { <del> mSendIdleEventsExecutorTokens.add(executorToken); <del> } else { <del> mSendIdleEventsExecutorTokens.remove(executorToken); <del> } <add> mSendIdleEvents = sendIdleEvents; <ide> } <ide> <ide> UiThreadUtil.runOnUiThread(new Runnable() { <ide> @Override <ide> public void run() { <ide> synchronized (mIdleCallbackGuard) { <del> if (mSendIdleEventsExecutorTokens.size() > 0) { <add> if (sendIdleEvents) { <ide> setChoreographerIdleCallback(); <ide> } else { <ide> clearChoreographerIdleCallback(); <ide><path>ReactAndroid/src/test/java/com/facebook/react/modules/timing/TimingModuleTest.java <ide> package com.facebook.react.modules.timing; <ide> <ide> import com.facebook.react.bridge.Arguments; <del>import com.facebook.react.bridge.ExecutorToken; <ide> import com.facebook.react.bridge.ReactApplicationContext; <ide> import com.facebook.react.bridge.CatalystInstance; <ide> import com.facebook.react.bridge.JavaOnlyArray; <ide> public class TimingModuleTest { <ide> private PostFrameIdleCallbackHandler mIdlePostFrameCallbackHandler; <ide> private long mCurrentTimeNs; <ide> private JSTimersExecution mJSTimersMock; <del> private ExecutorToken mExecutorTokenMock; <ide> <ide> @Rule <ide> public PowerMockRule rule = new PowerMockRule(); <ide> public Object answer(InvocationOnMock invocation) throws Throwable { <ide> <ide> mTiming = new Timing(reactContext, mock(DevSupportManager.class)); <ide> mJSTimersMock = mock(JSTimersExecution.class); <del> mExecutorTokenMock = mock(ExecutorToken.class); <del> when(reactContext.getJSModule(mExecutorTokenMock, JSTimersExecution.class)).thenReturn(mJSTimersMock); <add> when(reactContext.getJSModule(JSTimersExecution.class)).thenReturn(mJSTimersMock); <ide> <ide> doAnswer(new Answer() { <ide> @Override <ide> private void stepChoreographerFrame() { <ide> @Test <ide> public void testSimpleTimer() { <ide> mTiming.onHostResume(); <del> mTiming.createTimer(mExecutorTokenMock, 1, 1, 0, false); <add> mTiming.createTimer(1, 1, 0, false); <ide> stepChoreographerFrame(); <ide> verify(mJSTimersMock).callTimers(JavaOnlyArray.of(1)); <ide> reset(mJSTimersMock); <ide> public void testSimpleTimer() { <ide> <ide> @Test <ide> public void testSimpleRecurringTimer() { <del> mTiming.createTimer(mExecutorTokenMock, 100, 1, 0, true); <add> mTiming.createTimer(100, 1, 0, true); <ide> mTiming.onHostResume(); <ide> stepChoreographerFrame(); <ide> verify(mJSTimersMock).callTimers(JavaOnlyArray.of(100)); <ide> public void testSimpleRecurringTimer() { <ide> @Test <ide> public void testCancelRecurringTimer() { <ide> mTiming.onHostResume(); <del> mTiming.createTimer(mExecutorTokenMock, 105, 1, 0, true); <add> mTiming.createTimer(105, 1, 0, true); <ide> <ide> stepChoreographerFrame(); <ide> verify(mJSTimersMock).callTimers(JavaOnlyArray.of(105)); <ide> <ide> reset(mJSTimersMock); <del> mTiming.deleteTimer(mExecutorTokenMock, 105); <add> mTiming.deleteTimer(105); <ide> stepChoreographerFrame(); <ide> verifyNoMoreInteractions(mJSTimersMock); <ide> } <ide> <ide> @Test <ide> public void testPausingAndResuming() { <ide> mTiming.onHostResume(); <del> mTiming.createTimer(mExecutorTokenMock, 41, 1, 0, true); <add> mTiming.createTimer(41, 1, 0, true); <ide> <ide> stepChoreographerFrame(); <ide> verify(mJSTimersMock).callTimers(JavaOnlyArray.of(41)); <ide> public void testPausingAndResuming() { <ide> public void testHeadlessJsTaskInBackground() { <ide> mTiming.onHostPause(); <ide> mTiming.onHeadlessJsTaskStart(42); <del> mTiming.createTimer(mExecutorTokenMock, 41, 1, 0, true); <add> mTiming.createTimer(41, 1, 0, true); <ide> <ide> stepChoreographerFrame(); <ide> verify(mJSTimersMock).callTimers(JavaOnlyArray.of(41)); <ide> public void testHeadlessJsTaskInBackground() { <ide> public void testHeadlessJsTaskInForeground() { <ide> mTiming.onHostResume(); <ide> mTiming.onHeadlessJsTaskStart(42); <del> mTiming.createTimer(mExecutorTokenMock, 41, 1, 0, true); <add> mTiming.createTimer(41, 1, 0, true); <ide> <ide> stepChoreographerFrame(); <ide> verify(mJSTimersMock).callTimers(JavaOnlyArray.of(41)); <ide> public void testHeadlessJsTaskInForeground() { <ide> public void testHeadlessJsTaskIntertwine() { <ide> mTiming.onHostResume(); <ide> mTiming.onHeadlessJsTaskStart(42); <del> mTiming.createTimer(mExecutorTokenMock, 41, 1, 0, true); <add> mTiming.createTimer(41, 1, 0, true); <ide> mTiming.onHostPause(); <ide> <ide> stepChoreographerFrame(); <ide> public void testHeadlessJsTaskIntertwine() { <ide> <ide> @Test <ide> public void testSetTimeoutZero() { <del> mTiming.createTimer(mExecutorTokenMock, 100, 0, 0, false); <add> mTiming.createTimer(100, 0, 0, false); <ide> verify(mJSTimersMock).callTimers(JavaOnlyArray.of(100)); <ide> } <ide> <ide> @Test <ide> public void testIdleCallback() { <ide> mTiming.onHostResume(); <del> mTiming.setSendIdleEvents(mExecutorTokenMock, true); <add> mTiming.setSendIdleEvents(true); <ide> <ide> stepChoreographerFrame(); <ide> verify(mJSTimersMock).callIdleCallbacks(SystemClock.currentTimeMillis());
3
Javascript
Javascript
remove exception for node.js 8 and earlier
0332d31b9424d25c8924ccdfaea92423a3267ec0
<ide><path>.eslintrc.js <ide> Module._findPath = (request, paths, isMain) => { <ide> if (!r && hacks.includes(request)) { <ide> try { <ide> return require.resolve(`./tools/node_modules/${request}`); <del> // Keep the variable in place to ensure that ESLint started by older Node.js <del> // versions work as expected. <del> // eslint-disable-next-line no-unused-vars <del> } catch (e) { <add> } catch { <ide> return require.resolve( <ide> `./tools/node_modules/eslint/node_modules/${request}`); <ide> }
1
Javascript
Javascript
add crypto dependant modules cannotusecache
350bef6a103593f824e6a43ff52a86f1a48267db
<ide><path>lib/internal/bootstrap/cache.js <ide> if (process.config.variables.v8_enable_inspector !== 1) { <ide> if (!hasTracing) { <ide> cannotUseCache.push('trace_events'); <ide> } <add>if (!process.versions.openssl) { <add> cannotUseCache.push('crypto'); <add> cannotUseCache.push('https'); <add> cannotUseCache.push('http2'); <add> cannotUseCache.push('tls'); <add> cannotUseCache.push('_tls_common'); <add> cannotUseCache.push('_tls_wrap'); <add> cannotUseCache.push('internal/crypto/certificate'); <add> cannotUseCache.push('internal/crypto/cipher'); <add> cannotUseCache.push('internal/crypto/diffiehellman'); <add> cannotUseCache.push('internal/crypto/hash'); <add> cannotUseCache.push('internal/crypto/keygen'); <add> cannotUseCache.push('internal/crypto/pbkdf2'); <add> cannotUseCache.push('internal/crypto/random'); <add> cannotUseCache.push('internal/crypto/scrypt'); <add> cannotUseCache.push('internal/crypto/sig'); <add> cannotUseCache.push('internal/crypto/util'); <add> cannotUseCache.push('internal/http2/core'); <add> cannotUseCache.push('internal/http2/compat'); <add> cannotUseCache.push('internal/streams/lazy_transform'); <add>} <ide> <ide> module.exports = { <ide> cachableBuiltins: Object.keys(NativeModule._source).filter(
1
Mixed
Ruby
add support for horizontal sharding
384e7d139eb3c2da1ff857033605284d6e70aba7
<ide><path>activerecord/CHANGELOG.md <add>* Add support for horizontal sharding to `connects_to` and `connected_to`. <add> <add> Applications can now connect to multiple shards and switch between their shards in an application. Note that the shard swapping is still a manual process as this change does not include an API for automatic shard swapping. <add> <add> Usage: <add> <add> Given the following configuration: <add> <add> ```yaml <add> # config/database.yml <add> production: <add> primary: <add> database: my_database <add> primary_shard_one: <add> database: my_database_shard_one <add> ``` <add> <add> Connect to multiple shards: <add> <add> ```ruby <add> class ApplicationRecord < ActiveRecord::Base <add> self.abstract_class = true <add> <add> connects_to shards: { <add> default: { writing: :primary }, <add> shard_one: { writing: :primary_shard_one } <add> } <add> ``` <add> <add> Swap between shards in your controller / model code: <add> <add> ```ruby <add> ActiveRecord::Base.connected_to(shard: :shard_one) do <add> # Read from shard one <add> end <add> ``` <add> <add> The horizontal sharding API also supports read replicas. See guides for more details. <add> <add> *Eileen M. Uchitelle*, *John Crepezzi* <ide> * Deprecate `spec_name` in favor of `name` on database configurations <ide> <ide> The accessors for `spec_name` on `configs_for` and `DatabaseConfig` are deprecated. Please use `name` instead. <ide><path>activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb <ide> def connection_pool_list <ide> end <ide> alias :connection_pools :connection_pool_list <ide> <del> def establish_connection(config, pool_key = :default) <add> def establish_connection(config, pool_key = ActiveRecord::Base.default_pool_key) <ide> pool_config = resolve_pool_config(config) <ide> db_config = pool_config.db_config <ide> <ide> def flush_idle_connections! <ide> # active or defined connection: if it is the latter, it will be <ide> # opened and set as the active connection for the class it was defined <ide> # for (not necessarily the current class). <del> def retrieve_connection(spec_name) # :nodoc: <del> pool = retrieve_connection_pool(spec_name) <add> def retrieve_connection(spec_name, pool_key = ActiveRecord::Base.default_pool_key) # :nodoc: <add> pool = retrieve_connection_pool(spec_name, pool_key) <ide> <ide> unless pool <del> # multiple database application <del> if ActiveRecord::Base.connection_handler != ActiveRecord::Base.default_connection_handler <del> raise ConnectionNotEstablished, "No connection pool for '#{spec_name}' found for the '#{ActiveRecord::Base.current_role}' role." <add> if pool_key != ActiveRecord::Base.default_pool_key <add> message = "No connection pool for '#{spec_name}' found for the '#{pool_key}' shard." <add> elsif ActiveRecord::Base.connection_handler != ActiveRecord::Base.default_connection_handler <add> message = "No connection pool for '#{spec_name}' found for the '#{ActiveRecord::Base.current_role}' role." <ide> else <del> raise ConnectionNotEstablished, "No connection pool for '#{spec_name}' found." <add> message = "No connection pool for '#{spec_name}' found." <ide> end <add> <add> raise ConnectionNotEstablished, message <ide> end <ide> <ide> pool.connection <ide> end <ide> <ide> # Returns true if a connection that's accessible to this class has <ide> # already been opened. <del> def connected?(spec_name, pool_key = :default) <add> def connected?(spec_name, pool_key = ActiveRecord::Base.default_pool_key) <ide> pool = retrieve_connection_pool(spec_name, pool_key) <ide> pool && pool.connected? <ide> end <ide> def connected?(spec_name, pool_key = :default) <ide> # connection and the defined connection (if they exist). The result <ide> # can be used as an argument for #establish_connection, for easily <ide> # re-establishing the connection. <del> def remove_connection(owner, pool_key = :default) <add> def remove_connection(owner, pool_key = ActiveRecord::Base.default_pool_key) <ide> remove_connection_pool(owner, pool_key)&.configuration_hash <ide> end <ide> deprecate remove_connection: "Use #remove_connection_pool, which now returns a DatabaseConfig object instead of a Hash" <ide> <del> def remove_connection_pool(owner, pool_key = :default) <add> def remove_connection_pool(owner, pool_key = ActiveRecord::Base.default_pool_key) <ide> if pool_manager = get_pool_manager(owner) <ide> pool_config = pool_manager.remove_pool_config(pool_key) <ide> <ide> def remove_connection_pool(owner, pool_key = :default) <ide> # Retrieving the connection pool happens a lot, so we cache it in @owner_to_pool_manager. <ide> # This makes retrieving the connection pool O(1) once the process is warm. <ide> # When a connection is established or removed, we invalidate the cache. <del> def retrieve_connection_pool(owner, pool_key = :default) <add> def retrieve_connection_pool(owner, pool_key = ActiveRecord::Base.default_pool_key) <ide> pool_config = get_pool_manager(owner)&.get_pool_config(pool_key) <ide> pool_config&.pool <ide> end <ide><path>activerecord/lib/active_record/connection_handling.rb <ide> module ConnectionHandling <ide> # may be returned on an error. <ide> def establish_connection(config_or_env = nil) <ide> db_config = resolve_config_for_connection(config_or_env) <del> connection_handler.establish_connection(db_config) <add> connection_handler.establish_connection(db_config, current_pool_key) <ide> end <ide> <ide> # Connects a model to the databases specified. The +database+ keyword <ide> def establish_connection(config_or_env = nil) <ide> # connects_to database: { writing: :primary, reading: :primary_replica } <ide> # end <ide> # <del> # Returns an array of established connections. <del> def connects_to(database: {}) <add> # +connects_to+ also supports horizontal sharding. The horizontal sharding API <add> # also supports read replicas. Connect a model to a list of shards like this: <add> # <add> # class AnimalsModel < ApplicationRecord <add> # self.abstract_class = true <add> # <add> # connects_to shards: { <add> # default: { writing: :primary, reading: :primary_replica }, <add> # shard_two: { writing: :primary_shard_two, reading: :primary_shard_replica_two } <add> # } <add> # end <add> # <add> # Returns an array of database connections. <add> def connects_to(database: {}, shards: {}) <add> if database.present? && shards.present? <add> raise ArgumentError, "connects_to can only accept a `database` or `shards` argument, but not both arguments." <add> end <add> <ide> connections = [] <ide> <ide> database.each do |role, database_key| <ide> def connects_to(database: {}) <ide> connections << handler.establish_connection(db_config) <ide> end <ide> <add> shards.each do |pool_key, database_keys| <add> database_keys.each do |role, database_key| <add> db_config = resolve_config_for_connection(database_key) <add> handler = lookup_connection_handler(role.to_sym) <add> <add> connections << handler.establish_connection(db_config, pool_key.to_sym) <add> end <add> end <add> <ide> connections <ide> end <ide> <del> # Connects to a database or role (ex writing, reading, or another <del> # custom role) for the duration of the block. <add> # Connects to a role (ex writing, reading or a custom role) and/or <add> # shard for the duration of the block. At the end of the block the <add> # connection will be returned to the original role / shard. <ide> # <del> # If a role is passed, Active Record will look up the connection <del> # based on the requested role: <add> # If only a role is passed, Active Record will look up the connection <add> # based on the requested role. If a non-established role is requested <add> # an `ActiveRecord::ConnectionNotEstablished` error will be raised: <ide> # <ide> # ActiveRecord::Base.connected_to(role: :writing) do <ide> # Dog.create! # creates dog using dog writing connection <ide> def connects_to(database: {}) <ide> # Dog.create! # throws exception because we're on a replica <ide> # end <ide> # <del> # ActiveRecord::Base.connected_to(role: :unknown_role) do <del> # # raises exception due to non-existent role <add> # If only a shard is passed, Active Record will look up the shard on the <add> # current role. If a non-existent shard is passed, an <add> # `ActiveRecord::ConnectionNotEstablished` error will be raised. <add> # <add> # ActiveRecord::Base.connected_to(shard: :default) do <add> # # Dog.create! # creates dog in shard with the default key <ide> # end <del> def connected_to(database: nil, role: nil, prevent_writes: false, &blk) <add> # <add> # If a shard and role is passed, Active Record will first lookup the role, <add> # and then look up the connection by shard key. <add> # <add> # ActiveRecord::Base.connected_to(role: :reading, shard: :shard_one_replica) do <add> # # Dog.create! # would raise as we're on a readonly connection <add> # end <add> # <add> # The database kwarg is deprecated and will be removed in 6.2.0 without replacement. <add> def connected_to(database: nil, role: nil, shard: nil, prevent_writes: false, &blk) <ide> if database <ide> ActiveSupport::Deprecation.warn("The database key in `connected_to` is deprecated. It will be removed in Rails 6.2.0 without replacement.") <ide> end <ide> <del> if database && role <del> raise ArgumentError, "connected_to can only accept a `database` or a `role` argument, but not both arguments." <add> if database && (role || shard) <add> raise ArgumentError, "`connected_to` cannot accept a `database` argument with any other arguments." <ide> elsif database <ide> if database.is_a?(Hash) <ide> role, database = database.first <ide> def connected_to(database: nil, role: nil, prevent_writes: false, &blk) <ide> handler.establish_connection(db_config) <ide> <ide> with_handler(role, &blk) <add> elsif shard <add> with_shard(connection_specification_name, shard, role || current_role, prevent_writes, &blk) <ide> elsif role <del> prevent_writes = true if role == reading_role <del> <del> with_handler(role.to_sym) do <del> connection_handler.while_preventing_writes(prevent_writes, &blk) <del> end <add> with_role(role, prevent_writes, &blk) <ide> else <del> raise ArgumentError, "must provide a `database` or a `role`." <add> raise ArgumentError, "must provide a `shard` and/or `role`." <ide> end <ide> end <ide> <ide> def connected_to(database: nil, role: nil, prevent_writes: false, &blk) <ide> # ActiveRecord::Base.connected_to?(role: :writing) #=> true <ide> # ActiveRecord::Base.connected_to?(role: :reading) #=> false <ide> # end <del> def connected_to?(role:) <del> current_role == role.to_sym <add> def connected_to?(role:, shard: ActiveRecord::Base.default_pool_key) <add> current_role == role.to_sym && current_pool_key == shard.to_sym <ide> end <ide> <ide> # Returns the symbol representing the current connected role. <ide> def lookup_connection_handler(handler_key) # :nodoc: <ide> connection_handlers[handler_key] ||= ActiveRecord::ConnectionAdapters::ConnectionHandler.new <ide> end <ide> <del> def with_handler(handler_key, &blk) # :nodoc: <del> handler = lookup_connection_handler(handler_key) <del> swap_connection_handler(handler, &blk) <del> end <del> <ide> # Clears the query cache for all connections associated with the current thread. <ide> def clear_query_caches_for_current_thread <ide> ActiveRecord::Base.connection_handlers.each_value do |handler| <ide> def connection_db_config <ide> end <ide> <ide> def connection_pool <del> connection_handler.retrieve_connection_pool(connection_specification_name) || raise(ConnectionNotEstablished) <add> connection_handler.retrieve_connection_pool(connection_specification_name, current_pool_key) || raise(ConnectionNotEstablished) <ide> end <ide> <ide> def retrieve_connection <del> connection_handler.retrieve_connection(connection_specification_name) <add> connection_handler.retrieve_connection(connection_specification_name, current_pool_key) <ide> end <ide> <ide> # Returns +true+ if Active Record is connected. <ide> def connected? <del> connection_handler.connected?(connection_specification_name) <add> connection_handler.connected?(connection_specification_name, current_pool_key) <ide> end <ide> <ide> def remove_connection(name = nil) <ide> name ||= @connection_specification_name if defined?(@connection_specification_name) <ide> # if removing a connection that has a pool, we reset the <ide> # connection_specification_name so it will use the parent <ide> # pool. <del> if connection_handler.retrieve_connection_pool(name) <add> if connection_handler.retrieve_connection_pool(name, current_pool_key) <ide> self.connection_specification_name = nil <ide> end <ide> <del> connection_handler.remove_connection_pool(name) <add> connection_handler.remove_connection_pool(name, current_pool_key) <ide> end <ide> <ide> def clear_cache! # :nodoc: <ide> def resolve_config_for_connection(config_or_env) <ide> db_config <ide> end <ide> <add> def with_handler(handler_key, &blk) <add> handler = lookup_connection_handler(handler_key) <add> swap_connection_handler(handler, &blk) <add> end <add> <add> def with_role(role, prevent_writes, &blk) <add> prevent_writes = true if role == reading_role <add> <add> with_handler(role.to_sym) do <add> connection_handler.while_preventing_writes(prevent_writes, &blk) <add> end <add> end <add> <add> def with_shard(connection_specification_name, pool_key, role, prevent_writes) <add> old_pool_key = current_pool_key <add> <add> with_role(role, prevent_writes) do <add> self.current_pool_key = pool_key <add> yield <add> end <add> ensure <add> self.current_pool_key = old_pool_key <add> end <add> <ide> def swap_connection_handler(handler, &blk) # :nodoc: <ide> old_handler, ActiveRecord::Base.connection_handler = ActiveRecord::Base.connection_handler, handler <ide> return_value = yield <ide><path>activerecord/lib/active_record/core.rb <ide> def self.configurations <ide> <ide> class_attribute :default_connection_handler, instance_writer: false <ide> <add> class_attribute :default_pool_key, instance_writer: false <add> <ide> self.filter_attributes = [] <ide> <ide> def self.connection_handler <ide> def self.connection_handler=(handler) <ide> Thread.current.thread_variable_set(:ar_connection_handler, handler) <ide> end <ide> <add> def self.current_pool_key <add> Thread.current.thread_variable_get(:ar_pool_key) || default_pool_key <add> end <add> <add> def self.current_pool_key=(pool_key) <add> Thread.current.thread_variable_set(:ar_pool_key, pool_key) <add> end <add> <ide> self.default_connection_handler = ConnectionAdapters::ConnectionHandler.new <add> self.default_pool_key = :default <ide> end <ide> <ide> module ClassMethods <ide><path>activerecord/test/cases/connection_adapters/connection_handlers_multi_db_test.rb <ide> def test_switching_connections_with_database_and_role_raises <ide> ActiveRecord::Base.connected_to(database: :readonly, role: :writing) { } <ide> end <ide> end <del> assert_equal "connected_to can only accept a `database` or a `role` argument, but not both arguments.", error.message <add> assert_equal "`connected_to` cannot accept a `database` argument with any other arguments.", error.message <ide> end <ide> <ide> def test_switching_connections_without_database_and_role_raises <ide> error = assert_raises(ArgumentError) do <ide> ActiveRecord::Base.connected_to { } <ide> end <del> assert_equal "must provide a `database` or a `role`.", error.message <add> assert_equal "must provide a `shard` and/or `role`.", error.message <ide> end <ide> <ide> def test_switching_connections_with_database_symbol_uses_default_role <ide> def test_connection_handlers_are_per_thread_and_not_per_fiber <ide> <ide> reading_handler = ActiveRecord::Base.connection_handlers[:reading] <ide> <del> reading = ActiveRecord::Base.with_handler(:reading) do <add> reading = ActiveRecord::Base.connected_to(role: :reading) do <ide> Person.connection_handler <ide> end <ide> <ide> def test_connection_handlers_swapping_connections_in_fiber <ide> r << ActiveRecord::Base.connection_handler <ide> end <ide> <del> reading = ActiveRecord::Base.with_handler(:reading) do <add> reading = ActiveRecord::Base.connected_to(role: :reading) do <ide> enum.next <ide> end <ide> <ide><path>activerecord/test/cases/connection_adapters/connection_handlers_sharding_db_test.rb <add># frozen_string_literal: true <add> <add>require "cases/helper" <add>require "models/person" <add> <add>module ActiveRecord <add> module ConnectionAdapters <add> class ConnectionHandlersShardingDbTest < ActiveRecord::TestCase <add> self.use_transactional_tests = false <add> <add> fixtures :people <add> <add> def setup <add> @handlers = { writing: ConnectionHandler.new, reading: ConnectionHandler.new } <add> @rw_handler = @handlers[:writing] <add> @ro_handler = @handlers[:reading] <add> @owner_name = "ActiveRecord::Base" <add> db_config = ActiveRecord::Base.configurations.configs_for(env_name: "arunit", spec_name: "primary") <add> @rw_pool = @handlers[:writing].establish_connection(db_config) <add> @ro_pool = @handlers[:reading].establish_connection(db_config) <add> end <add> <add> def teardown <add> ActiveRecord::Base.connection_handlers = { writing: ActiveRecord::Base.default_connection_handler } <add> end <add> <add> unless in_memory_db? <add> def test_establish_connection_using_3_levels_config <add> previous_env, ENV["RAILS_ENV"] = ENV["RAILS_ENV"], "default_env" <add> <add> config = { <add> "default_env" => { <add> "primary" => { "adapter" => "sqlite3", "database" => "db/primary.sqlite3" }, <add> "primary_shard_one" => { "adapter" => "sqlite3", "database" => "db/primary_shard_one.sqlite3" }, <add> } <add> } <add> <add> @prev_configs, ActiveRecord::Base.configurations = ActiveRecord::Base.configurations, config <add> <add> ActiveRecord::Base.connects_to(shards: { <add> default: { writing: :primary }, <add> shard_one: { writing: :primary_shard_one } <add> }) <add> <add> base_pool = ActiveRecord::Base.connection_handlers[:writing].retrieve_connection_pool("ActiveRecord::Base") <add> default_pool = ActiveRecord::Base.connection_handlers[:writing].retrieve_connection_pool("ActiveRecord::Base", :default) <add> <add> assert_equal base_pool, default_pool <add> assert_equal "db/primary.sqlite3", default_pool.db_config.database <add> assert_equal "primary", default_pool.db_config.spec_name <add> <add> assert_not_nil pool = ActiveRecord::Base.connection_handlers[:writing].retrieve_connection_pool("ActiveRecord::Base", :shard_one) <add> assert_equal "db/primary_shard_one.sqlite3", pool.db_config.database <add> assert_equal "primary_shard_one", pool.db_config.spec_name <add> ensure <add> ActiveRecord::Base.configurations = @prev_configs <add> ActiveRecord::Base.establish_connection(:arunit) <add> ENV["RAILS_ENV"] = previous_env <add> end <add> <add> def test_establish_connection_using_3_levels_config_with_shards_and_replica <add> previous_env, ENV["RAILS_ENV"] = ENV["RAILS_ENV"], "default_env" <add> <add> config = { <add> "default_env" => { <add> "primary" => { "adapter" => "sqlite3", "database" => "db/primary.sqlite3" }, <add> "primary_replica" => { "adapter" => "sqlite3", "database" => "db/primary.sqlite3", "replica" => true }, <add> "primary_shard_one" => { "adapter" => "sqlite3", "database" => "db/primary_shard_one.sqlite3" }, <add> "primary_shard_one_replica" => { "adapter" => "sqlite3", "database" => "db/primary_shard_one.sqlite3", "replica" => true } <add> } <add> } <add> <add> @prev_configs, ActiveRecord::Base.configurations = ActiveRecord::Base.configurations, config <add> <add> ActiveRecord::Base.connects_to(shards: { <add> default: { writing: :primary, reading: :primary_replica }, <add> shard_one: { writing: :primary_shard_one, reading: :primary_shard_one_replica } <add> }) <add> <add> default_writing_pool = ActiveRecord::Base.connection_handlers[:writing].retrieve_connection_pool("ActiveRecord::Base", :default) <add> base_writing_pool = ActiveRecord::Base.connection_handlers[:writing].retrieve_connection_pool("ActiveRecord::Base") <add> assert_equal base_writing_pool, default_writing_pool <add> assert_equal "db/primary.sqlite3", default_writing_pool.db_config.database <add> assert_equal "primary", default_writing_pool.db_config.spec_name <add> <add> default_reading_pool = ActiveRecord::Base.connection_handlers[:reading].retrieve_connection_pool("ActiveRecord::Base", :default) <add> base_reading_pool = ActiveRecord::Base.connection_handlers[:reading].retrieve_connection_pool("ActiveRecord::Base") <add> assert_equal base_reading_pool, default_reading_pool <add> assert_equal "db/primary.sqlite3", default_reading_pool.db_config.database <add> assert_equal "primary_replica", default_reading_pool.db_config.spec_name <add> <add> assert_not_nil pool = ActiveRecord::Base.connection_handlers[:writing].retrieve_connection_pool("ActiveRecord::Base", :shard_one) <add> assert_equal "db/primary_shard_one.sqlite3", pool.db_config.database <add> assert_equal "primary_shard_one", pool.db_config.spec_name <add> <add> assert_not_nil pool = ActiveRecord::Base.connection_handlers[:reading].retrieve_connection_pool("ActiveRecord::Base", :shard_one) <add> assert_equal "db/primary_shard_one.sqlite3", pool.db_config.database <add> assert_equal "primary_shard_one_replica", pool.db_config.spec_name <add> ensure <add> ActiveRecord::Base.configurations = @prev_configs <add> ActiveRecord::Base.establish_connection(:arunit) <add> ENV["RAILS_ENV"] = previous_env <add> end <add> <add> def test_switching_connections_via_handler <add> previous_env, ENV["RAILS_ENV"] = ENV["RAILS_ENV"], "default_env" <add> <add> config = { <add> "default_env" => { <add> "primary" => { "adapter" => "sqlite3", "database" => "db/primary.sqlite3" }, <add> "primary_replica" => { "adapter" => "sqlite3", "database" => "db/primary.sqlite3", "replica" => true }, <add> "primary_shard_one" => { "adapter" => "sqlite3", "database" => "db/primary_shard_one.sqlite3" }, <add> "primary_shard_one_replica" => { "adapter" => "sqlite3", "database" => "db/primary_shard_one.sqlite3", "replica" => true } <add> } <add> } <add> <add> @prev_configs, ActiveRecord::Base.configurations = ActiveRecord::Base.configurations, config <add> <add> ActiveRecord::Base.connects_to(shards: { <add> default: { writing: :primary, reading: :primary_replica }, <add> shard_one: { writing: :primary_shard_one, reading: :primary_shard_one_replica } <add> }) <add> <add> ActiveRecord::Base.connected_to(role: :reading, shard: :default) do <add> @ro_handler = ActiveRecord::Base.connection_handler <add> assert_equal ActiveRecord::Base.connection_handler, ActiveRecord::Base.connection_handlers[:reading] <add> assert_equal :reading, ActiveRecord::Base.current_role <add> assert ActiveRecord::Base.connected_to?(role: :reading, shard: :default) <add> assert_not ActiveRecord::Base.connected_to?(role: :writing, shard: :default) <add> assert_not ActiveRecord::Base.connected_to?(role: :writing, shard: :shard_one) <add> assert_not ActiveRecord::Base.connected_to?(role: :reading, shard: :shard_one) <add> assert_predicate ActiveRecord::Base.connection, :preventing_writes? <add> end <add> <add> ActiveRecord::Base.connected_to(role: :writing, shard: :default) do <add> assert_equal ActiveRecord::Base.connection_handler, ActiveRecord::Base.connection_handlers[:writing] <add> assert_not_equal @ro_handler, ActiveRecord::Base.connection_handler <add> assert_equal :writing, ActiveRecord::Base.current_role <add> assert ActiveRecord::Base.connected_to?(role: :writing, shard: :default) <add> assert_not ActiveRecord::Base.connected_to?(role: :reading, shard: :default) <add> assert_not ActiveRecord::Base.connected_to?(role: :reading, shard: :shard_one) <add> assert_not ActiveRecord::Base.connected_to?(role: :writing, shard: :shard_one) <add> assert_not_predicate ActiveRecord::Base.connection, :preventing_writes? <add> end <add> <add> ActiveRecord::Base.connected_to(role: :reading, shard: :shard_one) do <add> @ro_handler = ActiveRecord::Base.connection_handler <add> assert_equal ActiveRecord::Base.connection_handler, ActiveRecord::Base.connection_handlers[:reading] <add> assert_equal :reading, ActiveRecord::Base.current_role <add> assert ActiveRecord::Base.connected_to?(role: :reading, shard: :shard_one) <add> assert_not ActiveRecord::Base.connected_to?(role: :writing, shard: :shard_one) <add> assert_not ActiveRecord::Base.connected_to?(role: :writing, shard: :default) <add> assert_not ActiveRecord::Base.connected_to?(role: :reading, shard: :default) <add> assert_predicate ActiveRecord::Base.connection, :preventing_writes? <add> end <add> <add> ActiveRecord::Base.connected_to(role: :writing, shard: :shard_one) do <add> assert_equal ActiveRecord::Base.connection_handler, ActiveRecord::Base.connection_handlers[:writing] <add> assert_not_equal @ro_handler, ActiveRecord::Base.connection_handler <add> assert_equal :writing, ActiveRecord::Base.current_role <add> assert ActiveRecord::Base.connected_to?(role: :writing, shard: :shard_one) <add> assert_not ActiveRecord::Base.connected_to?(role: :reading, shard: :shard_one) <add> assert_not ActiveRecord::Base.connected_to?(role: :reading, shard: :default) <add> assert_not ActiveRecord::Base.connected_to?(role: :writing, shard: :default) <add> assert_not_predicate ActiveRecord::Base.connection, :preventing_writes? <add> end <add> ensure <add> ActiveRecord::Base.configurations = @prev_configs <add> ActiveRecord::Base.establish_connection(:arunit) <add> ENV["RAILS_ENV"] = previous_env <add> FileUtils.rm_rf("db") <add> end <add> <add> def test_retrieves_proper_connection_with_nested_connected_to <add> previous_env, ENV["RAILS_ENV"] = ENV["RAILS_ENV"], "default_env" <add> <add> config = { <add> "default_env" => { <add> "primary" => { "adapter" => "sqlite3", "database" => "db/primary.sqlite3" }, <add> "primary_replica" => { "adapter" => "sqlite3", "database" => "db/primary.sqlite3", "replica" => true }, <add> "primary_shard_one" => { "adapter" => "sqlite3", "database" => "db/primary_shard_one.sqlite3" }, <add> "primary_shard_one_replica" => { "adapter" => "sqlite3", "database" => "db/primary_shard_one.sqlite3", "replica" => true } <add> } <add> } <add> <add> @prev_configs, ActiveRecord::Base.configurations = ActiveRecord::Base.configurations, config <add> <add> ActiveRecord::Base.connects_to(shards: { <add> default: { writing: :primary, reading: :primary_replica }, <add> shard_one: { writing: :primary_shard_one, reading: :primary_shard_one_replica } <add> }) <add> <add> ActiveRecord::Base.connected_to(role: :reading, shard: :shard_one) do <add> # Uses the correct connection <add> assert_equal "primary_shard_one_replica", ActiveRecord::Base.connection_pool.db_config.spec_name <add> <add> # Uses the shard currently in use <add> ActiveRecord::Base.connected_to(role: :writing) do <add> assert_equal "primary_shard_one", ActiveRecord::Base.connection_pool.db_config.spec_name <add> end <add> <add> # Allows overriding the shard as well <add> ActiveRecord::Base.connected_to(role: :reading, shard: :default) do <add> assert_equal "primary_replica", ActiveRecord::Base.connection_pool.db_config.spec_name <add> end <add> <add> # Uses the current role <add> ActiveRecord::Base.connected_to(shard: :default) do <add> assert_equal "primary_replica", ActiveRecord::Base.connection_pool.db_config.spec_name <add> end <add> <add> # Resets correctly <add> assert_equal "primary_shard_one_replica", ActiveRecord::Base.connection_pool.db_config.spec_name <add> end <add> ensure <add> ActiveRecord::Base.configurations = @prev_configs <add> ActiveRecord::Base.establish_connection(:arunit) <add> ENV["RAILS_ENV"] = previous_env <add> FileUtils.rm_rf("db") <add> end <add> <add> def test_connected_to_raises_without_a_shard_or_role <add> error = assert_raises(ArgumentError) do <add> ActiveRecord::Base.connected_to { } <add> end <add> assert_equal "must provide a `shard` and/or `role`.", error.message <add> end <add> <add> def test_connects_to_raises_with_a_shard_and_database_key <add> error = assert_raises(ArgumentError) do <add> ActiveRecord::Base.connects_to(database: { writing: :arunit }, shards: { shard_one: { writing: :arunit } }) <add> end <add> assert_equal "connects_to can only accept a `database` or `shards` argument, but not both arguments.", error.message <add> end <add> <add> def test_retrieve_connection_pool_with_invalid_shard <add> assert_not_nil @rw_handler.retrieve_connection_pool("ActiveRecord::Base") <add> assert_nil @rw_handler.retrieve_connection_pool("ActiveRecord::Base", :foo) <add> <add> assert_not_nil @ro_handler.retrieve_connection_pool("ActiveRecord::Base") <add> assert_nil @ro_handler.retrieve_connection_pool("ActiveRecord::Base", :foo) <add> end <add> <add> def test_calling_connected_to_on_a_non_existent_shard_raises <add> ActiveRecord::Base.connects_to(shards: { <add> default: { writing: :arunit, reading: :arunit } <add> }) <add> <add> error = assert_raises ActiveRecord::ConnectionNotEstablished do <add> ActiveRecord::Base.connected_to(role: :reading, shard: :foo) do <add> Person.first <add> end <add> end <add> <add> assert_equal "No connection pool for 'ActiveRecord::Base' found for the 'foo' shard.", error.message <add> end <add> end <add> <add> class ShardConnectionTestModel < ActiveRecord::Base <add> end <add> <add> class ShardConnectionTestModelB < ActiveRecord::Base <add> end <add> <add> def test_same_shards_across_clusters <add> ShardConnectionTestModel.connects_to shards: { one: { writing: { database: ":memory:", adapter: "sqlite3" } } } <add> ShardConnectionTestModelB.connects_to shards: { one: { writing: { database: ":memory:", adapter: "sqlite3" } } } <add> <add> ActiveRecord::Base.connected_to(shard: :one) do <add> ShardConnectionTestModel.connection.execute("CREATE TABLE `shard_connection_test_models` (shard_key VARCHAR (255))") <add> ShardConnectionTestModel.create!(shard_key: "test_model_default") <add> <add> ShardConnectionTestModelB.connection.execute("CREATE TABLE `shard_connection_test_model_bs` (shard_key VARCHAR (255))") <add> ShardConnectionTestModelB.create!(shard_key: "test_model_b_default") <add> <add> assert_equal "test_model_default", ShardConnectionTestModel.where(shard_key: "test_model_default").first.shard_key <add> assert_equal "test_model_b_default", ShardConnectionTestModelB.where(shard_key: "test_model_b_default").first.shard_key <add> end <add> end <add> <add> def test_sharding_separation <add> ShardConnectionTestModel.connects_to shards: { <add> default: { writing: { database: ":memory:", adapter: "sqlite3" } }, <add> one: { writing: { database: ":memory:", adapter: "sqlite3" } } <add> } <add> <add> [:default, :one].each do |shard_name| <add> ActiveRecord::Base.connected_to(shard: shard_name) do <add> ShardConnectionTestModel.connection.execute("CREATE TABLE `shard_connection_test_models` (shard_key VARCHAR (255))") <add> end <add> end <add> <add> # Create a record on :default <add> ShardConnectionTestModel.create!(shard_key: "foo") <add> <add> # Make sure we can read it when explicitly connecting to :default <add> ActiveRecord::Base.connected_to(shard: :default) do <add> assert ShardConnectionTestModel.find_by_shard_key("foo") <add> end <add> <add> # Switch to shard and make sure we can't read the record from :default <add> # Also add a new record on :one <add> ActiveRecord::Base.connected_to(shard: :one) do <add> assert_not ShardConnectionTestModel.find_by_shard_key("foo") <add> ShardConnectionTestModel.create!(shard_key: "bar") <add> end <add> <add> # Make sure we can't read the record from :one but can read the record <add> # from :default <add> assert_not ShardConnectionTestModel.find_by_shard_key("bar") <add> assert ShardConnectionTestModel.find_by_shard_key("foo") <add> end <add> <add> def test_swapping_shards_in_a_multi_threaded_environment <add> tf_default = Tempfile.open "shard_key_default" <add> tf_shard_one = Tempfile.open "shard_key_one" <add> <add> ShardConnectionTestModel.connects_to shards: { <add> default: { writing: { database: tf_default.path, adapter: "sqlite3" } }, <add> one: { writing: { database: tf_shard_one.path, adapter: "sqlite3" } } <add> } <add> <add> [:default, :one].each do |shard_name| <add> ActiveRecord::Base.connected_to(shard: shard_name) do <add> ShardConnectionTestModel.connection.execute("CREATE TABLE `shard_connection_test_models` (shard_key VARCHAR (255))") <add> ShardConnectionTestModel.connection.execute("INSERT INTO `shard_connection_test_models` VALUES ('shard_key_#{shard_name}')") <add> end <add> end <add> <add> shard_one_latch = Concurrent::CountDownLatch.new <add> shard_default_latch = Concurrent::CountDownLatch.new <add> <add> ShardConnectionTestModel.connection <add> <add> thread = Thread.new do <add> ShardConnectionTestModel.connection <add> <add> shard_default_latch.wait <add> assert_equal "shard_key_default", ShardConnectionTestModel.connection.select_value("SELECT shard_key from shard_connection_test_models") <add> shard_one_latch.count_down <add> end <add> <add> ActiveRecord::Base.connected_to(shard: :one) do <add> shard_default_latch.count_down <add> assert_equal "shard_key_one", ShardConnectionTestModel.connection.select_value("SELECT shard_key from shard_connection_test_models") <add> shard_one_latch.wait <add> end <add> <add> thread.join <add> ensure <add> tf_shard_one.close <add> tf_shard_one.unlink <add> tf_default.close <add> tf_default.unlink <add> end <add> <add> def test_swapping_shards_and_roles_in_a_multi_threaded_environment <add> tf_default = Tempfile.open "shard_key_default" <add> tf_shard_one = Tempfile.open "shard_key_one" <add> tf_default_reading = Tempfile.open "shard_key_default_reading" <add> tf_shard_one_reading = Tempfile.open "shard_key_one_reading" <add> <add> ShardConnectionTestModel.connects_to shards: { <add> default: { writing: { database: tf_default.path, adapter: "sqlite3" }, secondary: { database: tf_default_reading.path, adapter: "sqlite3" } }, <add> one: { writing: { database: tf_shard_one.path, adapter: "sqlite3" }, secondary: { database: tf_shard_one_reading.path, adapter: "sqlite3" } } <add> } <add> <add> [:default, :one].each do |shard_name| <add> ActiveRecord::Base.connected_to(shard: shard_name) do <add> ShardConnectionTestModel.connection.execute("CREATE TABLE `shard_connection_test_models` (shard_key VARCHAR (255))") <add> ShardConnectionTestModel.connection.execute("INSERT INTO `shard_connection_test_models` VALUES ('shard_key_#{shard_name}')") <add> end <add> <add> ActiveRecord::Base.connected_to(shard: shard_name, role: :secondary) do <add> ShardConnectionTestModel.connection.execute("CREATE TABLE `shard_connection_test_models` (shard_key VARCHAR (255))") <add> ShardConnectionTestModel.connection.execute("INSERT INTO `shard_connection_test_models` VALUES ('shard_key_#{shard_name}_secondary')") <add> end <add> end <add> <add> shard_one_latch = Concurrent::CountDownLatch.new <add> shard_default_latch = Concurrent::CountDownLatch.new <add> <add> ShardConnectionTestModel.connection <add> <add> thread = Thread.new do <add> ShardConnectionTestModel.connection <add> <add> shard_default_latch.wait <add> assert_equal "shard_key_default", ShardConnectionTestModel.connection.select_value("SELECT shard_key from shard_connection_test_models") <add> shard_one_latch.count_down <add> end <add> <add> ActiveRecord::Base.connected_to(shard: :one, role: :secondary) do <add> shard_default_latch.count_down <add> assert_equal "shard_key_one_secondary", ShardConnectionTestModel.connection.select_value("SELECT shard_key from shard_connection_test_models") <add> shard_one_latch.wait <add> end <add> <add> thread.join <add> ensure <add> tf_shard_one.close <add> tf_shard_one.unlink <add> tf_default.close <add> tf_default.unlink <add> tf_shard_one_reading.close <add> tf_shard_one_reading.unlink <add> tf_default_reading.close <add> tf_default_reading.unlink <add> end <add> end <add> end <add>end <ide><path>guides/source/active_record_multiple_databases.md <ide> After reading this guide you will know: <ide> <ide> * How to set up your application for multiple databases. <ide> * How automatic connection switching works. <add>* How to use horizontal sharding for multiple databases. <ide> * What features are supported and what's still a work in progress. <ide> <ide> -------------------------------------------------------------------------------- <ide> databases <ide> <ide> The following features are not (yet) supported: <ide> <del>* Sharding <add>* Automatic swapping for horizontal sharding <ide> * Joining across clusters <ide> * Load balancing replicas <ide> * Dumping schema caches for multiple databases <ide> like `connected_to(role: :nonexistent)` you will get an error that says <ide> `ActiveRecord::ConnectionNotEstablished (No connection pool with 'AnimalsBase' found <ide> for the 'nonexistent' role.)` <ide> <add>## Horizontal sharding <add> <add>Horizontal sharding is when you split up your database to reduce the number of rows on each <add>database server, but maintain the same schema across "shards". This is commonly called "multi-tenant" <add>sharding. <add> <add>The API for supporting horizontal sharding in Rails is similar to the multiple database / vertical <add>sharding API that's existed since Rails 6.0. <add> <add>Shards are declared in the three-tier config like this: <add> <add>```yaml <add>production: <add> primary: <add> database: my_primary_database <add> adapter: mysql <add> primary_replica: <add> database: my_primary_database <add> adapter: mysql <add> replica: true <add> primary_shard_one: <add> database: my_primary_shard_one <add> adapter: mysql <add> primary_shard_one_replica: <add> database: my_primary_shard_one <add> adapter: mysql <add> replica: true <add>``` <add> <add>Models are then connected with the `connects_to` API via the `shards` key: <add> <add>```ruby <add>class ApplicationRecord < ActiveRecord::Base <add> self.abstract_class = true <add> <add> connects_to shards: { <add> default: { writing: :primary, reading: :primary_replica }, <add> shard_one: { writing: :primary_shard_one, reading: :primary_shard_one_replica } <add> } <add>end <add> <add>Then models can swap connections manually via the `connected_to` API: <add> <add>```ruby <add>ActiveRecord::Base.connected_to(shard: :default) do <add> @id = Record.create! # creates a record in shard one <add>end <add> <add>ActiveRecord::Base.connected_to(shard: :shard_one) do <add> Record.find(@id) # can't find record, doesn't exist <add>end <add>``` <add> <add>The horizontal sharding API also supports read replicas. You can swap the <add>role and the shard with the `connected_to` API. <add> <add>```ruby <add>ActiveRecord::Base.connected_to(role: :reading, shard: :shard_one) do <add> Record.first # lookup record from read replica of shard one <add>end <add>``` <add> <ide> ## Caveats <ide> <del>### Sharding <add>### Automatic swapping for horizontal sharding <ide> <del>As noted at the top, Rails doesn't (yet) support sharding. We had to do a lot of work <del>to support multiple databases for Rails 6.0. The lack of support for sharding isn't <del>an oversight, but does require additional work that didn't make it in for 6.0. For now <del>if you need sharding it may be advisable to continue using one of the many gems <del>that supports this. <add>While Rails now supports an API for connecting to and swapping connections of shards, it does <add>not yet support an automatic swapping strategy. Any shard swapping will need to be done manually <add>in your app via a middleware or `around_action`. <ide> <ide> ### Load Balancing Replicas <ide>
7
Go
Go
use a test table in the daemon delete unit tests
8f51746997e4ea26fdc80703d3e9c881b87816f2
<ide><path>daemon/delete_test.go <ide> func newDaemonWithTmpRoot(t *testing.T) (*Daemon, func()) { <ide> return d, func() { os.RemoveAll(tmp) } <ide> } <ide> <del>// TestContainerDeletePaused tests that a useful error message and instructions is given when attempting <del>// to remove a paused container (#30842) <del>func TestContainerDeletePaused(t *testing.T) { <del> c := &container.Container{ <add>func newContainerWithState(state *container.State) *container.Container { <add> return &container.Container{ <ide> CommonContainer: container.CommonContainer{ <ide> ID: "test", <del> State: &container.State{Paused: true, Running: true}, <add> State: state, <ide> Config: &containertypes.Config{}, <ide> }, <ide> } <ide> <del> d, cleanup := newDaemonWithTmpRoot(t) <del> defer cleanup() <del> d.containers.Add(c.ID, c) <del> <del> err := d.ContainerRm(c.ID, &types.ContainerRmConfig{ForceRemove: false}) <del> <del> testutil.ErrorContains(t, err, "cannot remove a paused container") <del> testutil.ErrorContains(t, err, "Unpause and then stop the container before attempting removal or force remove") <ide> } <ide> <del>// TestContainerDeleteRestarting tests that a useful error message and instructions is given when attempting <del>// to remove a container that is restarting (#30842) <del>func TestContainerDeleteRestarting(t *testing.T) { <del> c := &container.Container{ <del> CommonContainer: container.CommonContainer{ <del> ID: "test", <del> State: container.NewState(), <del> Config: &containertypes.Config{}, <del> }, <add>// TestContainerDelete tests that a useful error message and instructions is <add>// given when attempting to remove a container (#30842) <add>func TestContainerDelete(t *testing.T) { <add> tt := []struct { <add> errMsg string <add> fixMsg string <add> initContainer func() *container.Container <add> }{ <add> // a paused container <add> { <add> errMsg: "cannot remove a paused container", <add> fixMsg: "Unpause and then stop the container before attempting removal or force remove", <add> initContainer: func() *container.Container { <add> return newContainerWithState(&container.State{Paused: true, Running: true}) <add> }}, <add> // a restarting container <add> { <add> errMsg: "cannot remove a restarting container", <add> fixMsg: "Stop the container before attempting removal or force remove", <add> initContainer: func() *container.Container { <add> c := newContainerWithState(container.NewState()) <add> c.SetRunning(0, true) <add> c.SetRestarting(&container.ExitStatus{}) <add> return c <add> }}, <add> // a running container <add> { <add> errMsg: "cannot remove a running container", <add> fixMsg: "Stop the container before attempting removal or force remove", <add> initContainer: func() *container.Container { <add> return newContainerWithState(&container.State{Running: true}) <add> }}, <ide> } <ide> <del> c.SetRunning(0, true) <del> c.SetRestarting(&container.ExitStatus{}) <del> <del> d, cleanup := newDaemonWithTmpRoot(t) <del> defer cleanup() <del> d.containers.Add(c.ID, c) <del> <del> err := d.ContainerRm(c.ID, &types.ContainerRmConfig{ForceRemove: false}) <del> testutil.ErrorContains(t, err, "cannot remove a restarting container") <del> testutil.ErrorContains(t, err, "Stop the container before attempting removal or force remove") <del>} <add> for _, te := range tt { <add> c := te.initContainer() <add> d, cleanup := newDaemonWithTmpRoot(t) <add> defer cleanup() <add> d.containers.Add(c.ID, c) <ide> <del>// TestContainerDeleteRunning tests that a useful error message and instructions is given when attempting <del>// to remove a running container (#30842) <del>func TestContainerDeleteRunning(t *testing.T) { <del> c := &container.Container{ <del> CommonContainer: container.CommonContainer{ <del> ID: "test", <del> State: &container.State{Running: true}, <del> Config: &containertypes.Config{}, <del> }, <add> err := d.ContainerRm(c.ID, &types.ContainerRmConfig{ForceRemove: false}) <add> testutil.ErrorContains(t, err, te.errMsg) <add> testutil.ErrorContains(t, err, te.fixMsg) <ide> } <del> <del> d, cleanup := newDaemonWithTmpRoot(t) <del> defer cleanup() <del> d.containers.Add(c.ID, c) <del> <del> err := d.ContainerRm(c.ID, &types.ContainerRmConfig{ForceRemove: false}) <del> testutil.ErrorContains(t, err, "cannot remove a running container") <ide> } <ide> <ide> func TestContainerDoubleDelete(t *testing.T) { <del> c := &container.Container{ <del> CommonContainer: container.CommonContainer{ <del> ID: "test", <del> State: container.NewState(), <del> Config: &containertypes.Config{}, <del> }, <del> } <add> c := newContainerWithState(container.NewState()) <ide> <ide> // Mark the container as having a delete in progress <ide> c.SetRemovalInProgress()
1
Python
Python
fix additional datatrainingarguments documentation
0094eba36381da08bf4d199386e25db32f37753b
<ide><path>examples/pytorch/speech-recognition/run_speech_recognition_ctc.py <ide> class DataTrainingArguments: <ide> train_split_name: str = field( <ide> default="train+validation", <ide> metadata={ <del> "help": "The name of the training data set split to use (via the datasets library). Defaults to 'train'" <add> "help": "The name of the training data set split to use (via the datasets library). Defaults to 'train+validation'" <ide> }, <ide> ) <ide> eval_split_name: str = field( <ide> default="test", <ide> metadata={ <del> "help": "The name of the training data set split to use (via the datasets library). Defaults to 'test'" <add> "help": "The name of the evaluation data set split to use (via the datasets library). Defaults to 'test'" <ide> }, <ide> ) <ide> audio_column_name: str = field(
1
Javascript
Javascript
fix constructor/instanceof checks
82b8355e12435d47339dd9e2a1ca0b7f3d73fa80
<ide><path>lib/util.js <ide> function ensureDebugIsInitialized() { <ide> <ide> function inspectPromise(p) { <ide> ensureDebugIsInitialized(); <add> // Only create a mirror if the object is a Promise. <ide> if (!binding.isPromise(p)) <ide> return null; <ide> const mirror = Debug.MakeMirror(p, true); <ide> function formatValue(ctx, value, recurseTimes) { <ide> var base = '', empty = false, braces; <ide> var formatter = formatObject; <ide> <add> // We can't compare constructors for various objects using a comparison like <add> // `constructor === Array` because the object could have come from a different <add> // context and thus the constructor won't match. Instead we check the <add> // constructor names (including those up the prototype chain where needed) to <add> // determine object types. <ide> if (Array.isArray(value)) { <del> // We can't use `constructor === Array` because this could <del> // have come from a Debug context. <del> // Otherwise, an Array will print "Array [...]". <add> // Unset the constructor to prevent "Array [...]" for ordinary arrays. <ide> if (constructor && constructor.name === 'Array') <ide> constructor = null; <ide> braces = ['[', ']']; <ide> empty = value.length === 0; <ide> formatter = formatArray; <del> } else if (value instanceof Set) { <add> } else if (objectToString(value) === '[object Set]') { <ide> braces = ['{', '}']; <ide> // With `showHidden`, `length` will display as a hidden property for <ide> // arrays. For consistency's sake, do the same for `size`, even though this <ide> function formatValue(ctx, value, recurseTimes) { <ide> keys.unshift('size'); <ide> empty = value.size === 0; <ide> formatter = formatSet; <del> } else if (value instanceof Map) { <add> } else if (objectToString(value) === '[object Map]') { <ide> braces = ['{', '}']; <ide> // Ditto. <ide> if (ctx.showHidden) <ide> function formatValue(ctx, value, recurseTimes) { <ide> 'buffer'); <ide> } <ide> } else { <del> // Only create a mirror if the object superficially looks like a Promise. <del> var promiseInternals = value instanceof Promise && inspectPromise(value); <add> var promiseInternals = inspectPromise(value); <ide> if (promiseInternals) { <ide> braces = ['{', '}']; <ide> formatter = formatPromise; <ide> function formatValue(ctx, value, recurseTimes) { <ide> empty = false; <ide> formatter = formatCollectionIterator; <ide> } else { <del> if (constructor === Object) <add> // Unset the constructor to prevent "Object {...}" for ordinary objects. <add> if (constructor && constructor.name === 'Object') <ide> constructor = null; <ide> braces = ['{', '}']; <ide> empty = true; // No other data than keys. <ide><path>test/parallel/test-util-inspect.js <ide> for (const o of vals) { <ide> <ide> assert.strictEqual(util.inspect(valsOutput), '[ [ 1, 2 ] ]'); <ide> <add>// test for other constructors in different context <add>var obj = require('vm').runInNewContext('(function(){return {}})()', {}); <add>assert.strictEqual(util.inspect(obj), '{}'); <add>obj = require('vm').runInNewContext('var m=new Map();m.set(1,2);m', {}); <add>assert.strictEqual(util.inspect(obj), 'Map { 1 => 2 }'); <add>obj = require('vm').runInNewContext('var s=new Set();s.add(1);s.add(2);s', {}); <add>assert.strictEqual(util.inspect(obj), 'Set { 1, 2 }'); <add>obj = require('vm').runInNewContext('fn=function(){};new Promise(fn,fn)', {}); <add>assert.strictEqual(util.inspect(obj), 'Promise { <pending> }'); <add> <ide> // test for property descriptors <ide> var getter = Object.create(null, { <ide> a: {
2
Ruby
Ruby
use xcode_path for gcc as well as llvm
ec0ae5ee99e4b9e2de2917cced0741c51e2719ac
<ide><path>Library/Homebrew/extend/ENV.rb <ide> def setup_build_environment <ide> self['CMAKE_PREFIX_PATH'] = "#{HOMEBREW_PREFIX}" <ide> end <ide> <add> xcode_path = `/usr/bin/xcode-select -print-path`.chomp <add> xcode_path = "/Developer" if xcode_path.to_s.empty? <ide> if MACOS_VERSION >= 10.6 and (self['HOMEBREW_USE_LLVM'] or ARGV.include? '--use-llvm') <del> xcode_path = `/usr/bin/xcode-select -print-path`.chomp <del> xcode_path = "/Developer" if xcode_path.to_s.empty? <ide> self['CC'] = "#{xcode_path}/usr/bin/llvm-gcc" <ide> self['CXX'] = "#{xcode_path}/usr/bin/llvm-g++" <ide> cflags = ['-O4'] # link time optimisation baby! <ide> elsif MACOS_VERSION >= 10.6 and (self['HOMEBREW_USE_GCC'] or ARGV.include? '--use-gcc') <del> self['CC'] = '/usr/bin/gcc' <del> self['CXX'] = '/usr/bin/g++' <add> self['CC'] = "#{xcode_path}/usr/bin/gcc" <add> self['CXX'] = "#{xcode_path}/usr/bin/g++" <ide> cflags = ['-O3'] <ide> else <ide> # If these aren't set, many formulae fail to build
1
Javascript
Javascript
remove unused property _maxlabellines
1b1c7fc302f77ee4c1504d5a1202a167620d6ce1
<ide><path>src/core/core.scale.js <ide> class Scale extends Element { <ide> /** @type {object} */ <ide> this._longestTextCache = {}; <ide> /** @type {number} */ <del> this._maxLabelLines = undefined; <del> /** @type {number} */ <ide> this._startPixel = undefined; <ide> /** @type {number} */ <ide> this._endPixel = undefined; <ide> class Scale extends Element { <ide> <ide> me.ticks = null; <ide> me._labelSizes = null; <del> me._maxLabelLines = 0; <ide> me._gridLineItems = null; <ide> me._labelItems = null; <ide>
1
Python
Python
add missing cast to gpt-j
ec6cd7633f8c1aaf41d21d919c63fc8c170cd5df
<ide><path>src/transformers/models/gptj/modeling_tf_gptj.py <ide> def call( <ide> key = self._split_heads(key, True) <ide> value = self._split_heads(value, False) <ide> <del> sincos = tf.gather(self.embed_positions, position_ids, axis=0) <add> sincos = tf.cast(tf.gather(self.embed_positions, position_ids, axis=0), hidden_states.dtype) <ide> sincos = tf.split(sincos, 2, axis=-1) <ide> if self.rotary_dim is not None: <ide> k_rot = key[:, :, :, : self.rotary_dim] <ide><path>tests/utils/test_modeling_tf_core.py <ide> def test_saved_model_creation_extended(self): <ide> def test_mixed_precision(self): <ide> tf.keras.mixed_precision.set_global_policy("mixed_float16") <ide> <del> config, inputs_dict = self.model_tester.prepare_config_and_inputs_for_common() <del> <del> for model_class in self.all_model_classes: <del> class_inputs_dict = self._prepare_for_class(inputs_dict, model_class) <del> model = model_class(config) <del> outputs = model(class_inputs_dict) <del> <del> self.assertIsNotNone(outputs) <add> # try/finally block to ensure subsequent tests run in float32 <add> try: <add> config, inputs_dict = self.model_tester.prepare_config_and_inputs_for_common() <add> for model_class in self.all_model_classes: <add> class_inputs_dict = self._prepare_for_class(inputs_dict, model_class) <add> model = model_class(config) <add> outputs = model(class_inputs_dict) <ide> <del> tf.keras.mixed_precision.set_global_policy("float32") <add> self.assertIsNotNone(outputs) <add> finally: <add> tf.keras.mixed_precision.set_global_policy("float32") <ide> <ide> @slow <ide> def test_train_pipeline_custom_model(self):
2
PHP
PHP
add an `exists` method to the arr class
caa75f37309e7fc32c3d9e6e0de60b466780abe3
<ide><path>src/Illuminate/Support/Arr.php <ide> public static function except($array, $keys) <ide> return $array; <ide> } <ide> <add> /** <add> * Determine if the given key exists in the provided array. <add> * <add> * @param array|\ArrayAccess $array <add> * @param string|int $key <add> * @return bool <add> */ <add> public static function exists($array, $key) <add> { <add> if (is_array($array)) { <add> return array_key_exists($key, $array); <add> } <add> <add> return $array->offsetExists($key); <add> } <add> <ide> /** <ide> * Return the first element in an array passing a given truth test. <ide> * <ide><path>tests/Support/SupportArrayTest.php <ide> public function testExcept() <ide> $this->assertEquals(['name' => 'Desk'], $array); <ide> } <ide> <add> public function testExists() <add> { <add> $this->assertTrue(Arr::exists([1], 0)); <add> $this->assertTrue(Arr::exists([null], 0)); <add> $this->assertTrue(Arr::exists(['a' => 1], 'a')); <add> $this->assertTrue(Arr::exists(['a' => null], 'a')); <add> $this->assertTrue(Arr::exists(new Collection(['a' => null]), 'a')); <add> <add> $this->assertFalse(Arr::exists([1], 1)); <add> $this->assertFalse(Arr::exists([null], 1)); <add> $this->assertFalse(Arr::exists(['a' => 1], 0)); <add> $this->assertFalse(Arr::exists(new Collection(['a' => null]), 'b')); <add> } <add> <ide> public function testFirst() <ide> { <ide> $array = [100, 200, 300];
2
Text
Text
fix the link to the old doc
a02098b855aad0847cddacc4bed2d280017b46c5
<ide><path>docs/topics/release-notes.md <ide> For older release notes, [please see the version 2.x documentation](old-release- <ide> [2.1.0-notes]: https://groups.google.com/d/topic/django-rest-framework/Vv2M0CMY9bg/discussion <ide> [ticket-582]: https://github.com/tomchristie/django-rest-framework/issues/582 <ide> [rfc-6266]: http://tools.ietf.org/html/rfc6266#section-4.3 <del>[old-release-notes]: http://tomchristie.github.io/rest-framework-2-docs/topics/release-notes#24x-series <add>[old-release-notes]: https://github.com/tomchristie/django-rest-framework/blob/version-2.4.x/docs/topics/release-notes.md <ide> <ide> [3.0.1-milestone]: https://github.com/tomchristie/django-rest-framework/issues?q=milestone%3A%223.0.1+Release%22 <ide> [3.0.2-milestone]: https://github.com/tomchristie/django-rest-framework/issues?q=milestone%3A%223.0.2+Release%22
1
Python
Python
add more tests for generic views
0853316545ad39c314f56ee559ce56596e578d2b
<ide><path>rest_framework/tests/generics.py <ide> def setUp(self): <ide> {'id': obj.id, 'text': obj.text} <ide> for obj in self.objects.all() <ide> ] <add> self.view = RootView.as_view() <ide> <ide> def test_get_root_view(self): <ide> """ <ide> GET requests to RootAPIView should return list of objects. <ide> """ <del> view = RootView.as_view() <ide> request = factory.get('/') <del> response = view(request).render() <add> response = self.view(request).render() <ide> self.assertEquals(response.status_code, status.HTTP_200_OK) <ide> self.assertEquals(response.data, self.data) <ide> <ide> def test_post_root_view(self): <ide> """ <ide> POST requests to RootAPIView should create a new object. <ide> """ <del> view = RootView.as_view() <ide> content = {'text': 'foobar'} <ide> request = factory.post('/', json.dumps(content), content_type='application/json') <del> response = view(request).render() <add> response = self.view(request).render() <ide> self.assertEquals(response.status_code, status.HTTP_201_CREATED) <ide> self.assertEquals(response.data, {'id': 4, 'text': u'foobar'}) <ide> created = self.objects.get(id=4) <ide> self.assertEquals(created.text, 'foobar') <ide> <add> def test_put_root_view(self): <add> """ <add> PUT requests to RootAPIView should not be allowed <add> """ <add> content = {'text': 'foobar'} <add> request = factory.put('/', json.dumps(content), content_type='application/json') <add> response = self.view(request).render() <add> self.assertEquals(response.status_code, status.HTTP_405_METHOD_NOT_ALLOWED) <add> self.assertEquals(response.content, '{"detail": "Method \'PUT\' not allowed."}') <add> <add> def test_delete_root_view(self): <add> """ <add> DELETE requests to RootAPIView should not be allowed <add> """ <add> request = factory.delete('/') <add> response = self.view(request).render() <add> self.assertEquals(response.status_code, status.HTTP_405_METHOD_NOT_ALLOWED) <add> self.assertEquals(response.content, '{"detail": "Method \'DELETE\' not allowed."}') <add> <ide> <ide> class TestInstanceView(TestCase): <ide> def setUp(self): <ide> def setUp(self): <ide> {'id': obj.id, 'text': obj.text} <ide> for obj in self.objects.all() <ide> ] <add> self.view = InstanceView.as_view() <ide> <ide> def test_get_instance_view(self): <ide> """ <ide> GET requests to InstanceAPIView should return a single object. <ide> """ <del> view = InstanceView.as_view() <ide> request = factory.get('/1') <del> response = view(request, pk=1).render() <add> response = self.view(request, pk=1).render() <ide> self.assertEquals(response.status_code, status.HTTP_200_OK) <ide> self.assertEquals(response.data, self.data[0]) <ide> <add> def test_post_instance_view(self): <add> """ <add> POST requests to InstanceAPIView should not be allowed <add> """ <add> content = {'text': 'foobar'} <add> request = factory.post('/', json.dumps(content), content_type='application/json') <add> response = self.view(request).render() <add> self.assertEquals(response.status_code, status.HTTP_405_METHOD_NOT_ALLOWED) <add> self.assertEquals(response.content, '{"detail": "Method \'POST\' not allowed."}') <add> <ide> def test_put_instance_view(self): <ide> """ <ide> PUT requests to InstanceAPIView should update an object. <ide> """ <del> view = InstanceView.as_view() <ide> content = {'text': 'foobar'} <ide> request = factory.put('/1', json.dumps(content), content_type='application/json') <del> response = view(request, pk=1).render() <add> response = self.view(request, pk=1).render() <ide> self.assertEquals(response.status_code, status.HTTP_200_OK) <ide> self.assertEquals(response.data, {'id': 1, 'text': 'foobar'}) <ide> updated = self.objects.get(id=1) <ide> def test_delete_instance_view(self): <ide> """ <ide> DELETE requests to InstanceAPIView should delete an object. <ide> """ <del> view = InstanceView.as_view() <ide> request = factory.delete('/1') <del> response = view(request, pk=1).render() <add> response = self.view(request, pk=1).render() <ide> self.assertEquals(response.status_code, status.HTTP_204_NO_CONTENT) <ide> self.assertEquals(response.content, '') <ide> ids = [obj.id for obj in self.objects.all()]
1
Python
Python
add test_connection method to azurefilesharehook
b27fc0367cd1125f4d312497ba5337115476315e
<ide><path>airflow/providers/microsoft/azure/hooks/fileshare.py <ide> def load_stream( <ide> self.get_conn().create_file_from_stream( <ide> share_name, directory_name, file_name, stream, count, **kwargs <ide> ) <add> <add> def test_connection(self): <add> """Test Azure FileShare connection.""" <add> success = (True, "Successfully connected to Azure File Share.") <add> <add> try: <add> # Attempt to retrieve file share information <add> next(iter(self.get_conn().list_shares())) <add> return success <add> except StopIteration: <add> # If the iterator returned is empty it should still be considered a successful connection since <add> # it's possible to create a storage account without any file share and none could <add> # legitimately exist yet. <add> return success <add> except Exception as e: <add> return False, str(e) <ide><path>tests/providers/microsoft/azure/hooks/test_azure_fileshare.py <ide> def test_delete_share(self, mock_service): <ide> hook = AzureFileShareHook(azure_fileshare_conn_id='azure_fileshare_extras') <ide> hook.delete_share('my_share') <ide> mock_instance.delete_share.assert_called_once_with('my_share') <add> <add> @mock.patch('airflow.providers.microsoft.azure.hooks.fileshare.FileService', autospec=True) <add> def test_connection_success(self, mock_service): <add> hook = AzureFileShareHook(azure_fileshare_conn_id='azure_fileshare_extras') <add> hook.get_conn().list_shares.return_value = ["test_container"] <add> status, msg = hook.test_connection() <add> assert status is True <add> assert msg == "Successfully connected to Azure File Share." <add> <add> @mock.patch('airflow.providers.microsoft.azure.hooks.fileshare.FileService', autospec=True) <add> def test_connection_failure(self, mock_service): <add> hook = AzureFileShareHook(azure_fileshare_conn_id='azure_fileshare_extras') <add> hook.get_conn().list_shares.side_effect = Exception("Test Connection Failure") <add> status, msg = hook.test_connection() <add> assert status is False <add> assert msg == "Test Connection Failure"
2
Python
Python
add tests for ``deprecate``
944524fa0ba6a9a174e1e3af99be61f35c8b4503
<ide><path>numpy/lib/tests/test_utils.py <ide> from numpy.testing import * <ide> import numpy.lib.utils as utils <add>from numpy.lib import deprecate <add> <ide> from StringIO import StringIO <ide> <ide> def test_lookfor(): <ide> def test_lookfor(): <ide> import_modules=False) <ide> out = out.getvalue() <ide> assert 'numpy.linalg.eig' in out <add> <add> <add>@deprecate <add>def old_func(self, x): <add> return x <add> <add>@deprecate(message="Rather use new_func2") <add>def old_func2(self, x): <add> return x <add> <add>def old_func3(self, x): <add> return x <add>new_func3 = deprecate(old_func3, old_name="old_func3", new_name="new_func3") <add> <add>def test_deprecate_decorator(): <add> assert 'deprecated' in old_func.__doc__ <add> <add>def test_deprecate_decorator_message(): <add> assert 'Rather use new_func2' in old_func2.__doc__ <add> <add>def test_deprecate_fn(): <add> assert 'old_func3' in new_func3.__doc__ <add> assert 'new_func3' in new_func3.__doc__ <add> <add>if __name__ == "__main__": <add> run_module_suite()
1
Python
Python
add test and fix for
d6e30c75ff1de968c15cba1516dedb226eea97b3
<ide><path>rest_framework/serializers.py <ide> from __future__ import unicode_literals <ide> from django.db import models <ide> from django.db.models.fields import FieldDoesNotExist, Field as DjangoModelField <del>from django.db.models import query <ide> from django.utils.functional import cached_property <ide> from django.utils.translation import ugettext_lazy as _ <ide> from rest_framework.compat import ( <ide> def to_representation(self, data): <ide> """ <ide> # Dealing with nested relationships, data can be a Manager, <ide> # so, first get a queryset from the Manager if needed <del> iterable = data.all() if isinstance(data, (models.Manager, query.QuerySet)) else data <add> iterable = data.all() if isinstance(data, models.Manager) else data <add> <ide> return [ <ide> self.child.to_representation(item) for item in iterable <ide> ] <ide><path>tests/test_model_serializer.py <ide> class Meta: <ide> str(exception), <ide> "Cannot set both 'fields' and 'exclude' options on serializer ExampleSerializer." <ide> ) <add> <add> <add>class Issue2704TestCase(TestCase): <add> def test_queryset_all(self): <add> class TestSerializer(serializers.ModelSerializer): <add> additional_attr = serializers.CharField() <add> <add> class Meta: <add> model = OneFieldModel <add> fields = ('char_field', 'additional_attr') <add> <add> OneFieldModel.objects.create(char_field='abc') <add> qs = OneFieldModel.objects.all() <add> <add> for o in qs: <add> o.additional_attr = '123' <add> <add> serializer = TestSerializer(instance=qs, many=True) <add> <add> expected = [{ <add> 'char_field': 'abc', <add> 'additional_attr': '123', <add> }] <add> <add> assert serializer.data == expected
2
Python
Python
add a test for mixed precision
2c891c156dab5403178ec864239313533d0223b8
<ide><path>tests/test_modeling_tf_albert.py <ide> def test_model_common_attributes(self): <ide> name = model.get_bias() <ide> assert name is None <ide> <add> def test_mixed_precision(self): <add> # TODO JP: Make ALBERT float16 compliant <add> pass <add> <ide> @slow <ide> def test_model_from_pretrained(self): <ide> for model_name in TF_ALBERT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]: <ide><path>tests/test_modeling_tf_bart.py <ide> def test_saved_model_creation(self): <ide> # This test is too long (>30sec) and makes fail the CI <ide> pass <ide> <add> def test_mixed_precision(self): <add> # TODO JP: Make BART float16 compliant <add> pass <add> <ide> <ide> def _assert_tensors_equal(a, b, atol=1e-12, prefix=""): <ide> """If tensors not close, or a and b arent both tensors, raise a nice Assertion error.""" <ide><path>tests/test_modeling_tf_blenderbot.py <ide> def test_saved_model_creation(self): <ide> # This test is too long (>30sec) and makes fail the CI <ide> pass <ide> <add> def test_mixed_precision(self): <add> # TODO JP: Make Blenderbot float16 compliant <add> pass <add> <ide> def test_resize_token_embeddings(self): <ide> config, inputs_dict = self.model_tester.prepare_config_and_inputs_for_common() <ide> <ide><path>tests/test_modeling_tf_blenderbot_small.py <ide> def test_saved_model_creation(self): <ide> # This test is too long (>30sec) and makes fail the CI <ide> pass <ide> <add> def test_mixed_precision(self): <add> # TODO JP: Make Blenderbot Small float16 compliant <add> pass <add> <ide> <ide> def _assert_tensors_equal(a, b, atol=1e-12, prefix=""): <ide> """If tensors not close, or a and b arent both tensors, raise a nice Assertion error.""" <ide><path>tests/test_modeling_tf_common.py <ide> def test_saved_model_with_attentions_output(self): <ide> [self.model_tester.num_attention_heads, encoder_seq_length, encoder_key_length], <ide> ) <ide> <add> def test_mixed_precision(self): <add> tf.keras.mixed_precision.experimental.set_policy("mixed_float16") <add> <add> config, inputs_dict = self.model_tester.prepare_config_and_inputs_for_common() <add> <add> for model_class in self.all_model_classes: <add> class_inputs_dict = self._prepare_for_class(inputs_dict, model_class) <add> model = model_class(config) <add> outputs = model(class_inputs_dict) <add> <add> self.assertIsNotNone(outputs) <add> <add> tf.keras.mixed_precision.experimental.set_policy("float32") <add> <ide> def test_keras_save_load(self): <ide> config, inputs_dict = self.model_tester.prepare_config_and_inputs_for_common() <ide> <ide><path>tests/test_modeling_tf_ctrl.py <ide> def test_model_common_attributes(self): <ide> name = model.get_bias() <ide> assert name is None <ide> <add> def test_mixed_precision(self): <add> # TODO JP: Make CTRL float16 compliant <add> pass <add> <ide> @slow <ide> def test_model_from_pretrained(self): <ide> for model_name in TF_CTRL_PRETRAINED_MODEL_ARCHIVE_LIST[:1]: <ide><path>tests/test_modeling_tf_flaubert.py <ide> def test_model_from_pretrained(self): <ide> model = TFFlaubertModel.from_pretrained(model_name) <ide> self.assertIsNotNone(model) <ide> <del> def test_saved_model_with_hidden_states_output(self): <del> # Should be uncommented during patrick TF refactor <del> pass <del> <del> def test_saved_model_with_attentions_output(self): <del> # Should be uncommented during patrick TF refactor <add> def test_mixed_precision(self): <add> # TODO JP: Make Flaubert float16 compliant <ide> pass <ide> <ide> <ide><path>tests/test_modeling_tf_funnel.py <ide> def test_saved_model_creation(self): <ide> # This test is too long (>30sec) and makes fail the CI <ide> pass <ide> <add> def test_mixed_precision(self): <add> # TODO JP: Make Funnel float16 compliant <add> pass <add> <ide> <ide> @require_tf <ide> class TFFunnelBaseModelTest(TFModelTesterMixin, unittest.TestCase): <ide> def test_for_multiple_choice(self): <ide> def test_saved_model_creation(self): <ide> # This test is too long (>30sec) and makes fail the CI <ide> pass <add> <add> def test_mixed_precision(self): <add> # TODO JP: Make Funnel float16 compliant <add> pass <ide><path>tests/test_modeling_tf_gpt2.py <ide> def test_gpt2_sequence_classification_model(self): <ide> config_and_inputs = self.model_tester.prepare_config_and_inputs() <ide> self.model_tester.create_and_check_gpt2_for_sequence_classification(*config_and_inputs) <ide> <add> def test_mixed_precision(self): <add> # TODO JP: Make GPT2 float16 compliant <add> pass <add> <ide> @slow <ide> def test_model_from_pretrained(self): <ide> for model_name in TF_GPT2_PRETRAINED_MODEL_ARCHIVE_LIST[:1]: <ide><path>tests/test_modeling_tf_led.py <ide> def test_saved_model_creation(self): <ide> # This test is too long (>30sec) and makes fail the CI <ide> pass <ide> <add> def test_mixed_precision(self): <add> # TODO JP: Make LED float16 compliant <add> pass <add> <ide> def test_saved_model_with_attentions_output(self): <ide> # This test don't pass because of the error: <ide> # condition [13,8,4,5], then [13,8,4,5], and else [13,8,4,6] must be broadcastable <ide><path>tests/test_modeling_tf_longformer.py <ide> def test_for_multiple_choice(self): <ide> <ide> @slow <ide> def test_saved_model_with_attentions_output(self): <del> # longformer has special attentions which are not <del> # compatible in graph mode <add> # This test don't pass because of the error: <add> # condition [13,8,4,5], then [13,8,4,5], and else [13,8,4,6] must be broadcastable <add> # This occurs line 323 in modeling_tf_led.py because the condition line 255 <add> # returns a tensor of shape <add> # [batch_size, seq_len, self.num_heads, self.one_sided_attn_window_size * 2 + 2] <add> # if is_global_attn is True and a tensor of shape <add> # [batch_size, seq_len, self.num_heads, self.one_sided_attn_window_size * 2 + 1] <add> # This is due to the tf.concat call line 703 that adds one dimension <add> # Need to check with PVP how to properly fix this <ide> pass <ide> <ide> def test_saved_model_creation(self): <ide> # This test is too long (>30sec) and makes fail the CI <ide> pass <ide> <add> def test_mixed_precision(self): <add> # TODO JP: Make Longformer float16 compliant <add> pass <add> <ide> <ide> @require_tf <ide> @require_sentencepiece <ide><path>tests/test_modeling_tf_lxmert.py <ide> def test_saved_model_creation(self): <ide> # This test is too long (>30sec) and makes fail the CI <ide> pass <ide> <add> def test_mixed_precision(self): <add> # TODO JP: Make Lxmert float16 compliant <add> pass <add> <ide> @slow <ide> def test_saved_model_with_hidden_states_output(self): <ide> config, inputs_dict = self.model_tester.prepare_config_and_inputs_for_common() <ide><path>tests/test_modeling_tf_marian.py <ide> def test_saved_model_creation(self): <ide> # This test is too long (>30sec) and makes fail the CI <ide> pass <ide> <add> def test_mixed_precision(self): <add> # TODO JP: Make Marian float16 compliant <add> pass <add> <ide> def test_resize_token_embeddings(self): <ide> config, inputs_dict = self.model_tester.prepare_config_and_inputs_for_common() <ide> <ide><path>tests/test_modeling_tf_mbart.py <ide> def test_saved_model_creation(self): <ide> # This test is too long (>30sec) and makes fail the CI <ide> pass <ide> <add> def test_mixed_precision(self): <add> # TODO JP: Make MBart float16 compliant <add> pass <add> <ide> def test_resize_token_embeddings(self): <ide> config, inputs_dict = self.model_tester.prepare_config_and_inputs_for_common() <ide> <ide><path>tests/test_modeling_tf_mobilebert.py <ide> def test_saved_model_creation(self): <ide> # This test is too long (>30sec) and makes fail the CI <ide> pass <ide> <add> def test_mixed_precision(self): <add> # TODO JP: Make MobileBert float16 compliant <add> pass <add> <ide> @slow <ide> def test_model_from_pretrained(self): <ide> # for model_name in TF_MOBILEBERT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]: <ide><path>tests/test_modeling_tf_openai.py <ide> def test_openai_gpt_sequence_classification_model(self): <ide> config_and_inputs = self.model_tester.prepare_config_and_inputs() <ide> self.model_tester.create_and_check_openai_gpt_for_sequence_classification(*config_and_inputs) <ide> <add> def test_mixed_precision(self): <add> # TODO JP: Make OpenAIGPT float16 compliant <add> pass <add> <ide> @slow <ide> def test_model_from_pretrained(self): <ide> for model_name in TF_OPENAI_GPT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]: <ide><path>tests/test_modeling_tf_pegasus.py <ide> def test_saved_model_creation(self): <ide> # This test is too long (>30sec) and makes fail the CI <ide> pass <ide> <add> def test_mixed_precision(self): <add> # TODO JP: Make Pegasus float16 compliant <add> pass <add> <ide> def test_resize_token_embeddings(self): <ide> config, inputs_dict = self.model_tester.prepare_config_and_inputs_for_common() <ide> <ide><path>tests/test_modeling_tf_t5.py <ide> def test_saved_model_creation(self): <ide> # This test is too long (>30sec) and makes fail the CI <ide> pass <ide> <add> def test_mixed_precision(self): <add> # TODO JP: Make T5 float16 compliant <add> pass <add> <ide> @slow <ide> def test_model_from_pretrained(self): <ide> model = TFT5Model.from_pretrained("t5-small") <ide> def test_model(self): <ide> def test_train_pipeline_custom_model(self): <ide> pass <ide> <add> def test_mixed_precision(self): <add> # TODO JP: Make T5 float16 compliant <add> pass <add> <ide> <ide> @require_tf <ide> @require_sentencepiece <ide><path>tests/test_modeling_tf_transfo_xl.py <ide> def test_model_common_attributes(self): <ide> name = model.get_bias() <ide> assert name is None <ide> <add> def test_mixed_precision(self): <add> # TODO JP: Make TransfoXL float16 compliant <add> pass <add> <ide> @slow <ide> def test_model_from_pretrained(self): <ide> for model_name in TF_TRANSFO_XL_PRETRAINED_MODEL_ARCHIVE_LIST[:1]: <ide><path>tests/test_modeling_tf_xlm.py <ide> def test_for_multiple_choice(self): <ide> config_and_inputs = self.model_tester.prepare_config_and_inputs() <ide> self.model_tester.create_and_check_xlm_for_multiple_choice(*config_and_inputs) <ide> <add> def test_mixed_precision(self): <add> # TODO JP: Make XLM float16 compliant <add> pass <add> <ide> @slow <ide> def test_model_from_pretrained(self): <ide> for model_name in TF_XLM_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
20
Ruby
Ruby
convert app test to spec
20e85cc96feaa4cb4a9ddac64758297aa2bff728
<add><path>Library/Homebrew/cask/spec/cask/artifact/app_spec.rb <del><path>Library/Homebrew/cask/test/cask/artifact/app_test.rb <del>require "test_helper" <add>require "spec_helper" <ide> <ide> describe Hbc::Artifact::App do <ide> let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-caffeine.rb") } <ide> let(:install_phase) { -> { app.install_phase } } <ide> let(:uninstall_phase) { -> { app.uninstall_phase } } <ide> <del> before do <del> TestHelper.install_without_artifacts(cask) <add> before(:each) do <add> InstallHelper.install_without_artifacts(cask) <ide> end <ide> <ide> describe "install_phase" do <ide> install_phase.call <ide> end <ide> <del> target_path.must_be :directory? <del> source_path.wont_be :exist? <add> expect(target_path).to be_a_directory <add> expect(source_path).not_to exist <ide> end <ide> <ide> describe "when app is in a subdirectory" do <ide> install_phase.call <ide> end <ide> <del> target_path.must_be :directory? <del> appsubdir.join("Caffeine.app").wont_be :exist? <add> expect(target_path).to be_a_directory <add> expect(appsubdir.join("Caffeine.app")).not_to exist <ide> end <ide> end <ide> <ide> install_phase.call <ide> end <ide> <del> target_path.must_be :directory? <del> source_path.wont_be :exist? <add> expect(target_path).to be_a_directory <add> expect(source_path).not_to exist <ide> <del> Hbc.appdir.join("Caffeine Deluxe.app").wont_be :exist? <del> cask.staged_path.join("Caffeine Deluxe.app").must_be :exist? <add> expect(Hbc.appdir.join("Caffeine Deluxe.app")).not_to exist <add> expect(cask.staged_path.join("Caffeine Deluxe.app")).to exist <ide> end <ide> <ide> describe "when the target already exists" do <del> before do <add> before(:each) do <ide> target_path.mkpath <ide> end <ide> <ide> it "avoids clobbering an existing app" do <del> err = install_phase.must_raise(Hbc::CaskError) <add> expect(install_phase).to raise_error(Hbc::CaskError, "It seems there is already an App at '#{target_path}'.") <ide> <del> err.message.must_equal("It seems there is already an App at '#{target_path}'.") <del> <del> source_path.must_be :directory? <del> target_path.must_be :directory? <del> File.identical?(source_path, target_path).must_equal false <add> expect(source_path).to be_a_directory <add> expect(target_path).to be_a_directory <add> expect(File.identical?(source_path, target_path)).to be false <ide> <ide> contents_path = target_path.join("Contents/Info.plist") <del> contents_path.wont_be :exist? <add> expect(contents_path).not_to exist <ide> end <ide> <ide> describe "given the force option" do <ide> let(:force) { true } <ide> <del> before do <del> Hbc::Utils.stubs(current_user: "fake_user") <add> before(:each) do <add> allow(Hbc::Utils).to receive(:current_user).and_return("fake_user") <ide> end <ide> <ide> describe "target is both writable and user-owned" do <ide> Warning: It seems there is already an App at '#{target_path}'; overwriting. <ide> EOS <ide> <del> install_phase.must_output(stdout, stderr) <add> expect { <add> expect(install_phase).to output(stdout).to_stdout <add> }.to output(stderr).to_stderr <ide> <del> source_path.wont_be :exist? <del> target_path.must_be :directory? <add> expect(source_path).not_to exist <add> expect(target_path).to be_a_directory <ide> <ide> contents_path = target_path.join("Contents/Info.plist") <del> contents_path.must_be :exist? <add> expect(contents_path).to exist <ide> end <ide> end <ide> <ide> describe "target is user-owned but contains read-only files" do <del> let(:command) { Hbc::FakeSystemCommand } <del> <del> let(:chmod_cmd) { <del> ["/bin/chmod", "-R", "--", "u+rwx", target_path] <del> } <del> <del> let(:chmod_n_cmd) { <del> ["/bin/chmod", "-R", "-N", target_path] <del> } <del> <del> let(:chflags_cmd) { <del> ["/usr/bin/chflags", "-R", "--", "000", target_path] <del> } <del> <del> before do <add> before(:each) do <ide> system "/usr/bin/touch", "--", "#{target_path}/foo" <ide> system "/bin/chmod", "--", "0555", target_path <ide> end <ide> <ide> it "overwrites the existing app" do <del> command.expect_and_pass_through(chflags_cmd) <del> command.expect_and_pass_through(chmod_cmd) <del> command.expect_and_pass_through(chmod_n_cmd) <add> expect(command).to receive(:run).with("/bin/chmod", args: ["-R", "--", "u+rwx", target_path], must_succeed: false) <add> .and_call_original <add> expect(command).to receive(:run).with("/bin/chmod", args: ["-R", "-N", target_path], must_succeed: false) <add> .and_call_original <add> expect(command).to receive(:run).with("/usr/bin/chflags", args: ["-R", "--", "000", target_path], must_succeed: false) <add> .and_call_original <ide> <ide> stdout = <<-EOS.undent <ide> ==> Removing App: '#{target_path}' <ide> Warning: It seems there is already an App at '#{target_path}'; overwriting. <ide> EOS <ide> <del> install_phase.must_output(stdout, stderr) <add> expect { <add> expect(install_phase).to output(stdout).to_stdout <add> }.to output(stderr).to_stderr <ide> <del> source_path.wont_be :exist? <del> target_path.must_be :directory? <add> expect(source_path).not_to exist <add> expect(target_path).to be_a_directory <ide> <ide> contents_path = target_path.join("Contents/Info.plist") <del> contents_path.must_be :exist? <add> expect(contents_path).to exist <ide> end <ide> <del> after do <add> after(:each) do <ide> system "/bin/chmod", "--", "0755", target_path <ide> end <ide> end <ide> describe "when the target is a broken symlink" do <ide> let(:deleted_path) { cask.staged_path.join("Deleted.app") } <ide> <del> before do <add> before(:each) do <ide> deleted_path.mkdir <ide> File.symlink(deleted_path, target_path) <ide> deleted_path.rmdir <ide> end <ide> <ide> it "leaves the target alone" do <del> err = install_phase.must_raise(Hbc::CaskError) <del> <del> err.message.must_equal("It seems there is already an App at '#{target_path}'.") <del> <del> File.symlink?(target_path).must_equal true <add> expect(install_phase).to raise_error(Hbc::CaskError, "It seems there is already an App at '#{target_path}'.") <add> expect(target_path).to be_a_symlink <ide> end <ide> <ide> describe "given the force option" do <ide> Warning: It seems there is already an App at '#{target_path}'; overwriting. <ide> EOS <ide> <del> install_phase.must_output(stdout, stderr) <add> expect { <add> expect(install_phase).to output(stdout).to_stdout <add> }.to output(stderr).to_stderr <ide> <del> source_path.wont_be :exist? <del> target_path.must_be :directory? <add> expect(source_path).not_to exist <add> expect(target_path).to be_a_directory <ide> <ide> contents_path = target_path.join("Contents/Info.plist") <del> contents_path.must_be :exist? <add> expect(contents_path).to exist <ide> end <ide> end <ide> end <ide> <ide> message = "It seems the App source is not there: '#{source_path}'" <ide> <del> error = install_phase.must_raise(Hbc::CaskError) <del> error.message.must_equal message <add> expect(install_phase).to raise_error(Hbc::CaskError, message) <ide> end <ide> end <ide> <ide> describe "uninstall_phase" do <del> before do <add> it "deletes managed apps" do <ide> shutup do <ide> install_phase.call <ide> end <del> end <ide> <del> it "deletes managed apps" do <del> target_path.must_be :exist? <add> expect(target_path).to exist <ide> <ide> shutup do <ide> uninstall_phase.call <ide> end <ide> <del> target_path.wont_be :exist? <add> expect(target_path).not_to exist <ide> end <ide> end <ide> <ide> let(:contents) { app.summary[:contents] } <ide> <ide> it "returns the correct english_description" do <del> description.must_equal "Apps" <add> expect(description).to eq("Apps") <ide> end <ide> <ide> describe "app is correctly installed" do <del> before do <add> it "returns the path to the app" do <ide> shutup do <ide> install_phase.call <ide> end <del> end <ide> <del> it "returns the path to the app" do <del> contents.must_equal ["#{target_path} (#{target_path.abv})"] <add> expect(contents).to eq(["#{target_path} (#{target_path.abv})"]) <ide> end <ide> end <ide> <ide> describe "app is missing" do <ide> it "returns a warning and the supposed path to the app" do <del> contents.size.must_equal 1 <del> contents[0].must_match(/.*Missing App.*: #{target_path}/) <add> expect(contents.size).to eq(1) <add> expect(contents[0]).to match(/.*Missing App.*: #{target_path}/) <ide> end <ide> end <ide> end
1
Javascript
Javascript
add permission introduced in android 13
0a854c7c8b7ffc382c43fa460651a4b4de34c3c7
<ide><path>Libraries/PermissionsAndroid/NativePermissionsAndroid.js <ide> export type PermissionType = <ide> | 'android.permission.USE_SIP' <ide> | 'android.permission.PROCESS_OUTGOING_CALLS' <ide> | 'android.permission.BODY_SENSORS' <add> | 'android.permission.BODY_SENSORS_BACKGROUND' <ide> | 'android.permission.SEND_SMS' <ide> | 'android.permission.RECEIVE_SMS' <ide> | 'android.permission.READ_SMS' <ide> | 'android.permission.RECEIVE_WAP_PUSH' <ide> | 'android.permission.RECEIVE_MMS' <ide> | 'android.permission.READ_EXTERNAL_STORAGE' <add> | 'android.permission.READ_MEDIA_IMAGES', <add> | 'android.permission.READ_MEDIA_VIDEO', <add> | 'android.permission.READ_MEDIA_AUDIO', <ide> | 'android.permission.WRITE_EXTERNAL_STORAGE' <ide> | 'android.permission.BLUETOOTH_CONNECT' <ide> | 'android.permission.BLUETOOTH_SCAN' <ide> export type PermissionType = <ide> | 'android.permission.ACTIVITY_RECOGNITION' <ide> | 'android.permission.ANSWER_PHONE_CALLS' <ide> | 'android.permission.READ_PHONE_NUMBERS' <del> | 'android.permission.UWB_RANGING'; <add> | 'android.permission.UWB_RANGING' <add> | 'android.permission.POST_NOTIFICATIONS' <add> | 'android.permission.NEARBY_WIFI_DEVICES'; <ide> */ <ide> <ide> export interface Spec extends TurboModule { <ide><path>Libraries/PermissionsAndroid/PermissionsAndroid.js <ide> const PERMISSIONS = Object.freeze({ <ide> USE_SIP: 'android.permission.USE_SIP', <ide> PROCESS_OUTGOING_CALLS: 'android.permission.PROCESS_OUTGOING_CALLS', <ide> BODY_SENSORS: 'android.permission.BODY_SENSORS', <add> BODY_SENSORS_BACKGROUND: 'android.permission.BODY_SENSORS_BACKGROUND', <ide> SEND_SMS: 'android.permission.SEND_SMS', <ide> RECEIVE_SMS: 'android.permission.RECEIVE_SMS', <ide> READ_SMS: 'android.permission.READ_SMS', <ide> RECEIVE_WAP_PUSH: 'android.permission.RECEIVE_WAP_PUSH', <ide> RECEIVE_MMS: 'android.permission.RECEIVE_MMS', <ide> READ_EXTERNAL_STORAGE: 'android.permission.READ_EXTERNAL_STORAGE', <add> READ_MEDIA_IMAGES: 'android.permission.READ_MEDIA_IMAGES', <add> READ_MEDIA_VIDEO: 'android.permission.READ_MEDIA_VIDEO', <add> READ_MEDIA_AUDIO: 'android.permission.READ_MEDIA_AUDIO', <ide> WRITE_EXTERNAL_STORAGE: 'android.permission.WRITE_EXTERNAL_STORAGE', <ide> BLUETOOTH_CONNECT: 'android.permission.BLUETOOTH_CONNECT', <ide> BLUETOOTH_SCAN: 'android.permission.BLUETOOTH_SCAN', <ide> const PERMISSIONS = Object.freeze({ <ide> ANSWER_PHONE_CALLS: 'android.permission.ANSWER_PHONE_CALLS', <ide> READ_PHONE_NUMBERS: 'android.permission.READ_PHONE_NUMBERS', <ide> UWB_RANGING: 'android.permission.UWB_RANGING', <add> POST_NOTIFICATION: 'android.permission.POST_NOTIFICATIONS', <add> NEARBY_WIFI_DEVICES: 'android.permission.NEARBY_WIFI_DEVICES', <ide> }); <ide> <ide> /** <ide> class PermissionsAndroid { <ide> BLUETOOTH_CONNECT: string, <ide> BLUETOOTH_SCAN: string, <ide> BODY_SENSORS: string, <add> BODY_SENSORS_BACKGROUND: string, <ide> CALL_PHONE: string, <ide> CAMERA: string, <ide> GET_ACCOUNTS: string, <add> NEARBY_WIFI_DEVICES: string, <add> POST_NOTIFICATION: string, <ide> PROCESS_OUTGOING_CALLS: string, <ide> READ_CALENDAR: string, <ide> READ_CALL_LOG: string, <ide> READ_CONTACTS: string, <ide> READ_EXTERNAL_STORAGE: string, <add> READ_MEDIA_IMAGES: string, <add> READ_MEDIA_VIDEO: string, <add> READ_MEDIA_AUDIO: string, <ide> READ_PHONE_NUMBERS: string, <ide> READ_PHONE_STATE: string, <ide> READ_SMS: string,
2
Python
Python
add inception v3 example
0ed00e38f095ec7fe14e55c8e3fd7ce242a79df4
<ide><path>examples/inception_v3.py <add>'''This script demonstrates how to build the Inception v3 architecture <add>using the Keras functional API. <add>We are not actually training it here, for lack of appropriate data. <add> <add>For more information about this architecture, see: <add> <add>"Rethinking the Inception Architecture for Computer Vision" <add>Christian Szegedy, Vincent Vanhoucke, Sergey Ioffe, Jonathon Shlens, Zbigniew Wojna <add>http://arxiv.org/abs/1512.00567 <add>''' <add>from keras.layers import Convolution2D, MaxPooling2D, AveragePooling2D <add>from keras.layers import BatchNormalization, Flatten, Dense, Dropout <add>from keras.layers import Input, merge <add>from keras.models import Model <add>from keras import regularizers <add> <add> <add># global constants <add>NB_CLASS = 1000 # number of classes <add>DIM_ORDERING = 'th' # 'th' (channels, width, height) or 'tf' (width, height, channels) <add>WEIGHT_DECAY = 0. # L2 regularization factor <add>USE_BN = False # whether to use batch normalization <add> <add> <add>def conv2D_bn(x, nb_filter, nb_row, nb_col, <add> border_mode='same', subsample=(1, 1), <add> activation='relu', batch_norm=USE_BN, <add> weight_decay=WEIGHT_DECAY, dim_ordering=DIM_ORDERING): <add> '''Utility function to apply to a tensor a module conv + BN <add> with optional weight decay (L2 weight regularization). <add> ''' <add> if weight_decay: <add> W_regularizer = regularizers.l2(weight_decay) <add> b_regularizer = regularizers.l2(weight_decay) <add> else: <add> W_regularizer = None <add> b_regularizer = None <add> x = Convolution2D(nb_filter, nb_row, nb_col, <add> subsample=subsample, <add> activation=activation, <add> border_mode=border_mode, <add> W_regularizer=W_regularizer, <add> b_regularizer=b_regularizer, <add> dim_ordering=dim_ordering)(x) <add> if batch_norm: <add> x = BatchNormalization()(x) <add> return x <add> <add># Define image input layer <add> <add>if DIM_ORDERING == 'th': <add> img_input = Input(shape=(3, 299, 299)) <add> CONCAT_AXIS = 1 <add>elif DIM_ORDERING == 'tf': <add> img_input = Input(shape=(299, 299, 3)) <add> CONCAT_AXIS = 3 <add>else: <add> raise Exception('Invalid dim ordering: ' + str(DIM_ORDERING)) <add> <add># Entry module <add> <add>x = conv2D_bn(img_input, 32, 3, 3, subsample=(2, 2), border_mode='valid') <add>x = conv2D_bn(x, 32, 3, 3, border_mode='valid') <add>x = conv2D_bn(x, 64, 3, 3) <add>x = MaxPooling2D((3, 3), strides=(2, 2), dim_ordering=DIM_ORDERING)(x) <add> <add>x = conv2D_bn(x, 80, 1, 1, border_mode='valid') <add>x = conv2D_bn(x, 192, 3, 3, border_mode='valid') <add>x = MaxPooling2D((3, 3), strides=(2, 2), dim_ordering=DIM_ORDERING)(x) <add> <add># mixed: 35 x 35 x 256 <add> <add>branch1x1 = conv2D_bn(x, 64, 1, 1) <add> <add>branch5x5 = conv2D_bn(x, 48, 1, 1) <add>branch5x5 = conv2D_bn(branch5x5, 64, 5, 5) <add> <add>branch3x3dbl = conv2D_bn(x, 64, 1, 1) <add>branch3x3dbl = conv2D_bn(branch3x3dbl, 96, 3, 3) <add>branch3x3dbl = conv2D_bn(branch3x3dbl, 96, 3, 3) <add> <add>branch_pool = AveragePooling2D((3, 3), strides=(1, 1), border_mode='same', dim_ordering=DIM_ORDERING)(x) <add>branch_pool = conv2D_bn(branch_pool, 32, 1, 1) <add>x = merge([branch1x1, branch5x5, branch3x3dbl, branch_pool], mode='concat', concat_axis=CONCAT_AXIS) <add> <add># mixed_1: 35 x 35 x 288 <add> <add>branch1x1 = conv2D_bn(x, 64, 1, 1) <add> <add>branch5x5 = conv2D_bn(x, 48, 1, 1) <add>branch5x5 = conv2D_bn(branch5x5, 64, 5, 5) <add> <add>branch3x3dbl = conv2D_bn(x, 64, 1, 1) <add>branch3x3dbl = conv2D_bn(branch3x3dbl, 96, 3, 3) <add>branch3x3dbl = conv2D_bn(branch3x3dbl, 96, 3, 3) <add> <add>branch_pool = AveragePooling2D((3, 3), strides=(1, 1), border_mode='same', dim_ordering=DIM_ORDERING)(x) <add>branch_pool = conv2D_bn(branch_pool, 32, 1, 1) <add>x = merge([branch1x1, branch5x5, branch3x3dbl, branch_pool], mode='concat', concat_axis=CONCAT_AXIS) <add> <add># mixed2: 35 x 35 x 288 <add> <add>branch1x1 = conv2D_bn(x, 64, 1, 1) <add> <add>branch5x5 = conv2D_bn(x, 48, 1, 1) <add>branch5x5 = conv2D_bn(branch5x5, 64, 5, 5) <add> <add>branch3x3dbl = conv2D_bn(x, 64, 1, 1) <add>branch3x3dbl = conv2D_bn(branch3x3dbl, 96, 3, 3) <add>branch3x3dbl = conv2D_bn(branch3x3dbl, 96, 3, 3) <add> <add>branch_pool = AveragePooling2D((3, 3), strides=(1, 1), border_mode='same', dim_ordering=DIM_ORDERING)(x) <add>branch_pool = conv2D_bn(branch_pool, 64, 1, 1) <add>x = merge([branch1x1, branch5x5, branch3x3dbl, branch_pool], mode='concat', concat_axis=CONCAT_AXIS) <add> <add># mixed3: 17 x 17 x 768 <add> <add>branch3x3 = conv2D_bn(x, 384, 3, 3, subsample=(2, 2), border_mode='valid') <add> <add>branch3x3dbl = conv2D_bn(x, 64, 1, 1) <add>branch3x3dbl = conv2D_bn(branch3x3dbl, 96, 3, 3) <add>branch3x3dbl = conv2D_bn(branch3x3dbl, 96, 3, 3, subsample=(2, 2), border_mode='valid') <add> <add>branch_pool = MaxPooling2D((3, 3), strides=(2, 2), dim_ordering=DIM_ORDERING)(x) <add>x = merge([branch3x3, branch3x3dbl, branch_pool], mode='concat', concat_axis=CONCAT_AXIS) <add> <add># mixed4: 17 x 17 x 768 <add> <add>branch1x1 = conv2D_bn(x, 192, 1, 1) <add> <add>branch7x7 = conv2D_bn(x, 128, 1, 1) <add>branch7x7 = conv2D_bn(branch7x7, 128, 1, 7) <add>branch7x7 = conv2D_bn(branch7x7, 192, 7, 1) <add> <add>branch7x7dbl = conv2D_bn(x, 128, 1, 1) <add>branch7x7dbl = conv2D_bn(branch7x7dbl, 128, 7, 1) <add>branch7x7dbl = conv2D_bn(branch7x7dbl, 128, 1, 7) <add>branch7x7dbl = conv2D_bn(branch7x7dbl, 128, 7, 1) <add>branch7x7dbl = conv2D_bn(branch7x7dbl, 128, 1, 7) <add> <add>branch_pool = AveragePooling2D((3, 3), strides=(1, 1), border_mode='same', dim_ordering=DIM_ORDERING)(x) <add>branch_pool = conv2D_bn(branch_pool, 192, 1, 1) <add>x = merge([branch1x1, branch7x7, branch7x7dbl, branch_pool], mode='concat', concat_axis=CONCAT_AXIS) <add> <add># mixed5: 17 x 17 x 768 <add> <add>branch1x1 = conv2D_bn(x, 192, 1, 1) <add> <add>branch7x7 = conv2D_bn(x, 160, 1, 1) <add>branch7x7 = conv2D_bn(branch7x7, 160, 1, 7) <add>branch7x7 = conv2D_bn(branch7x7, 192, 7, 1) <add> <add>branch7x7dbl = conv2D_bn(x, 160, 1, 1) <add>branch7x7dbl = conv2D_bn(branch7x7dbl, 160, 7, 1) <add>branch7x7dbl = conv2D_bn(branch7x7dbl, 192, 1, 7) <add>branch7x7dbl = conv2D_bn(branch7x7dbl, 160, 7, 1) <add>branch7x7dbl = conv2D_bn(branch7x7dbl, 192, 1, 7) <add> <add>branch_pool = AveragePooling2D((3, 3), strides=(1, 1), border_mode='same', dim_ordering=DIM_ORDERING)(x) <add>branch_pool = conv2D_bn(branch_pool, 192, 1, 1) <add>x = merge([branch1x1, branch7x7, branch7x7dbl, branch_pool], mode='concat', concat_axis=CONCAT_AXIS) <add> <add># mixed5: 17 x 17 x 768 <add> <add>branch1x1 = conv2D_bn(x, 192, 1, 1) <add> <add>branch7x7 = conv2D_bn(x, 160, 1, 1) <add>branch7x7 = conv2D_bn(branch7x7, 160, 1, 7) <add>branch7x7 = conv2D_bn(branch7x7, 192, 7, 1) <add> <add>branch7x7dbl = conv2D_bn(x, 160, 1, 1) <add>branch7x7dbl = conv2D_bn(branch7x7dbl, 160, 7, 1) <add>branch7x7dbl = conv2D_bn(branch7x7dbl, 192, 1, 7) <add>branch7x7dbl = conv2D_bn(branch7x7dbl, 160, 7, 1) <add>branch7x7dbl = conv2D_bn(branch7x7dbl, 192, 1, 7) <add> <add>branch_pool = AveragePooling2D((3, 3), strides=(1, 1), border_mode='same', dim_ordering=DIM_ORDERING)(x) <add>branch_pool = conv2D_bn(branch_pool, 192, 1, 1) <add>x = merge([branch1x1, branch7x7, branch7x7dbl, branch_pool], mode='concat', concat_axis=CONCAT_AXIS) <add> <add># mixed6: 17 x 17 x 768 <add> <add>branch1x1 = conv2D_bn(x, 192, 1, 1) <add> <add>branch7x7 = conv2D_bn(x, 160, 1, 1) <add>branch7x7 = conv2D_bn(branch7x7, 160, 1, 7) <add>branch7x7 = conv2D_bn(branch7x7, 192, 7, 1) <add> <add>branch7x7dbl = conv2D_bn(x, 160, 1, 1) <add>branch7x7dbl = conv2D_bn(branch7x7dbl, 160, 7, 1) <add>branch7x7dbl = conv2D_bn(branch7x7dbl, 192, 1, 7) <add>branch7x7dbl = conv2D_bn(branch7x7dbl, 160, 7, 1) <add>branch7x7dbl = conv2D_bn(branch7x7dbl, 192, 1, 7) <add> <add>branch_pool = AveragePooling2D((3, 3), strides=(1, 1), border_mode='same', dim_ordering=DIM_ORDERING)(x) <add>branch_pool = conv2D_bn(branch_pool, 192, 1, 1) <add>x = merge([branch1x1, branch7x7, branch7x7dbl, branch_pool], mode='concat', concat_axis=CONCAT_AXIS) <add> <add># mixed7: 17 x 17 x 768 <add> <add>branch1x1 = conv2D_bn(x, 192, 1, 1) <add> <add>branch7x7 = conv2D_bn(x, 192, 1, 1) <add>branch7x7 = conv2D_bn(branch7x7, 192, 1, 7) <add>branch7x7 = conv2D_bn(branch7x7, 192, 7, 1) <add> <add>branch7x7dbl = conv2D_bn(x, 160, 1, 1) <add>branch7x7dbl = conv2D_bn(branch7x7dbl, 192, 7, 1) <add>branch7x7dbl = conv2D_bn(branch7x7dbl, 192, 1, 7) <add>branch7x7dbl = conv2D_bn(branch7x7dbl, 192, 7, 1) <add>branch7x7dbl = conv2D_bn(branch7x7dbl, 192, 1, 7) <add> <add>branch_pool = AveragePooling2D((3, 3), strides=(1, 1), border_mode='same', dim_ordering=DIM_ORDERING)(x) <add>branch_pool = conv2D_bn(branch_pool, 192, 1, 1) <add>x = merge([branch1x1, branch7x7, branch7x7dbl, branch_pool], mode='concat', concat_axis=CONCAT_AXIS) <add> <add># Auxiliary head <add> <add>aux_logits = AveragePooling2D((5, 5), strides=(3, 3), dim_ordering=DIM_ORDERING)(x) <add>aux_logits = conv2D_bn(aux_logits, 128, 1, 1) <add>aux_logits = conv2D_bn(aux_logits, 728, 5, 5, border_mode='valid') <add>aux_logits = Flatten()(aux_logits) <add>aux_preds = Dense(NB_CLASS, activation='softmax')(aux_logits) <add> <add># mixed8: 8 x 8 x 1280 <add> <add>branch3x3 = conv2D_bn(x, 192, 1, 1) <add>branch3x3 = conv2D_bn(branch3x3, 192, 3, 3, subsample=(2, 2), border_mode='valid') <add> <add>branch7x7x3 = conv2D_bn(x, 192, 1, 1) <add>branch7x7x3 = conv2D_bn(branch7x7x3, 192, 1, 7) <add>branch7x7x3 = conv2D_bn(branch7x7x3, 192, 7, 1) <add>branch7x7x3 = conv2D_bn(branch7x7x3, 192, 3, 3, subsample=(2, 2), border_mode='valid') <add> <add>branch_pool = AveragePooling2D((3, 3), strides=(2, 2), dim_ordering=DIM_ORDERING)(x) <add>x = merge([branch3x3, branch7x7x3, branch_pool], mode='concat', concat_axis=CONCAT_AXIS) <add> <add># mixed9: 8 x 8 x 2048 <add> <add>branch1x1 = conv2D_bn(x, 320, 1, 1) <add> <add>branch3x3 = conv2D_bn(x, 384, 1, 1) <add>branch3x3_1 = conv2D_bn(branch3x3, 384, 1, 3) <add>branch3x3_2 = conv2D_bn(branch3x3, 384, 3, 1) <add>branch3x3 = merge([branch3x3_1, branch3x3_2], mode='concat', concat_axis=CONCAT_AXIS) <add> <add>branch3x3dbl = conv2D_bn(x, 448, 1, 1) <add>branch3x3dbl = conv2D_bn(branch3x3dbl, 384, 3, 3) <add>branch3x3dbl_1 = conv2D_bn(branch3x3dbl, 384, 1, 3) <add>branch3x3dbl_2 = conv2D_bn(branch3x3dbl, 384, 3, 1) <add>branch3x3dbl = merge([branch3x3dbl_1, branch3x3dbl_2], mode='concat', concat_axis=CONCAT_AXIS) <add> <add>branch_pool = AveragePooling2D((3, 3), strides=(1, 1), border_mode='same', dim_ordering=DIM_ORDERING)(x) <add>branch_pool = conv2D_bn(branch_pool, 192, 1, 1) <add>x = merge([branch1x1, branch3x3, branch3x3dbl, branch_pool], mode='concat', concat_axis=CONCAT_AXIS) <add> <add># mixed10: 8 x 8 x 2048 <add> <add>branch1x1 = conv2D_bn(x, 320, 1, 1) <add> <add>branch3x3 = conv2D_bn(x, 384, 1, 1) <add>branch3x3_1 = conv2D_bn(branch3x3, 384, 1, 3) <add>branch3x3_2 = conv2D_bn(branch3x3, 384, 3, 1) <add>branch3x3 = merge([branch3x3_1, branch3x3_2], mode='concat', concat_axis=CONCAT_AXIS) <add> <add>branch3x3dbl = conv2D_bn(x, 448, 1, 1) <add>branch3x3dbl = conv2D_bn(branch3x3dbl, 384, 3, 3) <add>branch3x3dbl_1 = conv2D_bn(branch3x3dbl, 384, 1, 3) <add>branch3x3dbl_2 = conv2D_bn(branch3x3dbl, 384, 3, 1) <add>branch3x3dbl = merge([branch3x3dbl_1, branch3x3dbl_2], mode='concat', concat_axis=CONCAT_AXIS) <add> <add>branch_pool = AveragePooling2D((3, 3), strides=(1, 1), border_mode='same', dim_ordering=DIM_ORDERING)(x) <add>branch_pool = conv2D_bn(branch_pool, 192, 1, 1) <add>x = merge([branch1x1, branch3x3, branch3x3dbl, branch_pool], mode='concat', concat_axis=CONCAT_AXIS) <add> <add># Final pooling and prediction <add> <add>x = AveragePooling2D((8, 8), strides=(1, 1), dim_ordering=DIM_ORDERING)(x) <add>x = Dropout(0.5)(x) <add>x = Flatten()(x) <add>preds = Dense(NB_CLASS, activation='softmax')(x) <add> <add># Define model <add> <add>model = Model(input=img_input, output=[preds, aux_preds]) <add>model.compile('rmsprop', 'categorical_crossentropy') <add> <add># train via e.g. `model.fit(x_train, [y_train] * 2, batch_size=32, nb_epoch=100)` <add># Note that for a large dataset it would be preferable <add># to train using `fit_generator` (see Keras docs).
1
Python
Python
fix fan_in renaming
102c8c7e2f482b67d8fea8e4b9b341365da38565
<ide><path>spacy/ml/_precomputable_affine.py <ide> def init(model, X=None, Y=None): <ide> pad = model.ops.alloc4f(1, nF, nO, nP) <ide> <ide> ops = model.ops <del> W = normal_init(ops, W.shape, fan_in=nF * nI) <add> scale = float(ops.xp.sqrt(1.0 / (nF * nI))) <add> W = normal_init(ops, W.shape, mean=scale) <ide> model.set_param("W", W) <ide> model.set_param("b", b) <ide> model.set_param("pad", pad)
1
Ruby
Ruby
move url munging to initialize
867a87b50afda7fa6d8c81a37eb8ff1f898e5cf6
<ide><path>Library/Homebrew/download_strategy.rb <ide> def checkout_submodules(dst) <ide> end <ide> <ide> class CVSDownloadStrategy < VCSDownloadStrategy <add> def initialize(name, resource) <add> super <add> @url = @url.sub(%r[^cvs://], "") <add> end <add> <ide> def stage <ide> cp_r Dir[cached_location+"{.}"], Dir.pwd <ide> end <ide> def update <ide> end <ide> <ide> def split_url(in_url) <del> parts=in_url.sub(%r[^cvs://], '').split(/:/) <add> parts = in_url.split(/:/) <ide> mod=parts.pop <ide> url=parts.join(':') <ide> [ mod, url ] <ide> end <ide> end <ide> <ide> class MercurialDownloadStrategy < VCSDownloadStrategy <add> def initialize(name, resource) <add> super <add> @url = @url.sub(%r[^hg://], "") <add> end <add> <ide> def stage <ide> super <ide> <ide> def repo_valid? <ide> end <ide> <ide> def clone_repo <del> url = @url.sub(%r[^hg://], "") <ide> safe_system hgpath, "clone", url, cached_location <ide> end <ide> <ide> def update <ide> end <ide> <ide> class BazaarDownloadStrategy < VCSDownloadStrategy <add> def initialize(name, resource) <add> super <add> @url = @url.sub(%r[^bzr://], "") <add> end <add> <ide> def stage <ide> # The export command doesn't work on checkouts <ide> # See https://bugs.launchpad.net/bzr/+bug/897511 <ide> def repo_valid? <ide> end <ide> <ide> def clone_repo <del> url = @url.sub(%r[^bzr://], "") <ide> # "lightweight" means history-less <ide> safe_system bzrpath, "checkout", "--lightweight", url, cached_location <ide> end <ide> def update <ide> end <ide> <ide> class FossilDownloadStrategy < VCSDownloadStrategy <add> def initialize(name, resource) <add> super <add> @url = @url.sub(%r[^fossil://], "") <add> end <add> <ide> def stage <ide> super <ide> args = [fossilpath, "open", cached_location] <ide> def cache_tag <ide> end <ide> <ide> def clone_repo <del> url = @url.sub(%r[^fossil://], "") <ide> safe_system fossilpath, "clone", url, cached_location <ide> end <ide>
1
Ruby
Ruby
add an accessor to make the intent more clear here
95af184a0c678d075841b956f776f6bc7c648ee7
<ide><path>Library/Homebrew/options.rb <ide> def split_name(name) <ide> class Options <ide> include Enumerable <ide> <add> attr_reader :options <add> protected :options <add> <ide> def initialize(*args) <ide> @options = Set.new(*args) <ide> end <ide> <ide> def initialize_copy(other) <ide> super <del> @options = @options.dup <add> @options = other.options.dup <ide> end <ide> <ide> def each(*args, &block)
1
Javascript
Javascript
use charat instead of regexp
6c59e770084912d2345e7f83f983092a2d305ae3
<ide><path>src/Angular.js <ide> function bind(self, fn) { <ide> function toJsonReplacer(key, value) { <ide> var val = value; <ide> <del> if (/^\$+/.test(key)) { <add> if (typeof key === 'string' && key.charAt(0) === '$') { <ide> val = undefined; <ide> } else if (isWindow(value)) { <ide> val = '$WINDOW';
1
Java
Java
improve coverage, remove unused code
421c5bbb2312b9364e11a0f02cf84126e94961fb
<ide><path>src/main/java/io/reactivex/Flowable.java <ide> import io.reactivex.internal.functions.*; <ide> import io.reactivex.internal.fuseable.*; <ide> import io.reactivex.internal.operators.flowable.*; <del>import io.reactivex.internal.operators.flowable.FlowableStrict.StrictSubscriber; <ide> import io.reactivex.internal.operators.observable.ObservableFromPublisher; <ide> import io.reactivex.internal.schedulers.ImmediateThinScheduler; <ide> import io.reactivex.internal.subscribers.*; <ide><path>src/main/java/io/reactivex/internal/observers/QueueDrainObserver.java <ide> <ide> import io.reactivex.Observer; <ide> import io.reactivex.disposables.Disposable; <del>import io.reactivex.internal.fuseable.SimpleQueue; <add>import io.reactivex.internal.fuseable.*; <ide> import io.reactivex.internal.util.*; <ide> <ide> /** <ide> */ <ide> public abstract class QueueDrainObserver<T, U, V> extends QueueDrainSubscriberPad2 implements Observer<T>, ObservableQueueDrain<U, V> { <ide> protected final Observer<? super V> actual; <del> protected final SimpleQueue<U> queue; <add> protected final SimplePlainQueue<U> queue; <ide> <ide> protected volatile boolean cancelled; <ide> <ide> protected volatile boolean done; <ide> protected Throwable error; <ide> <del> public QueueDrainObserver(Observer<? super V> actual, SimpleQueue<U> queue) { <add> public QueueDrainObserver(Observer<? super V> actual, SimplePlainQueue<U> queue) { <ide> this.actual = actual; <ide> this.queue = queue; <ide> } <ide> public final boolean fastEnter() { <ide> <ide> protected final void fastPathEmit(U value, boolean delayError, Disposable dispose) { <ide> final Observer<? super V> s = actual; <del> final SimpleQueue<U> q = queue; <add> final SimplePlainQueue<U> q = queue; <ide> <ide> if (wip.get() == 0 && wip.compareAndSet(0, 1)) { <ide> accept(s, value); <ide> protected final void fastPathEmit(U value, boolean delayError, Disposable dispos <ide> */ <ide> protected final void fastPathOrderedEmit(U value, boolean delayError, Disposable disposable) { <ide> final Observer<? super V> s = actual; <del> final SimpleQueue<U> q = queue; <add> final SimplePlainQueue<U> q = queue; <ide> <ide> if (wip.get() == 0 && wip.compareAndSet(0, 1)) { <ide> if (q.isEmpty()) { <ide> public final int leave(int m) { <ide> return wip.addAndGet(m); <ide> } <ide> <del> public void drain(boolean delayError, Disposable dispose) { <del> if (enter()) { <del> QueueDrainHelper.drainLoop(queue, actual, delayError, dispose, this); <del> } <del> } <del> <ide> @Override <ide> public void accept(Observer<? super V> a, U v) { <ide> // ignored by default <ide><path>src/main/java/io/reactivex/internal/operators/flowable/FlowableBufferBoundary.java <ide> import io.reactivex.exceptions.Exceptions; <ide> import io.reactivex.functions.Function; <ide> import io.reactivex.internal.functions.ObjectHelper; <del>import io.reactivex.internal.fuseable.SimpleQueue; <add>import io.reactivex.internal.fuseable.SimplePlainQueue; <ide> import io.reactivex.internal.queue.MpscLinkedQueue; <ide> import io.reactivex.internal.subscribers.QueueDrainSubscriber; <ide> import io.reactivex.internal.subscriptions.SubscriptionHelper; <ide> void complete() { <ide> buffers.clear(); <ide> } <ide> <del> SimpleQueue<U> q = queue; <add> SimplePlainQueue<U> q = queue; <ide> for (U u : list) { <ide> q.offer(u); <ide> } <ide><path>src/main/java/io/reactivex/internal/operators/flowable/FlowableConcatMapPublisher.java <ide> */ <ide> package io.reactivex.internal.operators.flowable; <ide> <del>import java.util.concurrent.Callable; <del>import java.util.concurrent.atomic.AtomicInteger; <del> <ide> import org.reactivestreams.*; <ide> <del>import io.reactivex.*; <del>import io.reactivex.exceptions.Exceptions; <add>import io.reactivex.Flowable; <ide> import io.reactivex.functions.Function; <del>import io.reactivex.internal.functions.ObjectHelper; <del>import io.reactivex.internal.fuseable.*; <del>import io.reactivex.internal.queue.SpscArrayQueue; <del>import io.reactivex.internal.subscriptions.*; <del>import io.reactivex.internal.util.*; <del>import io.reactivex.plugins.RxJavaPlugins; <add>import io.reactivex.internal.util.ErrorMode; <ide> <ide> public final class FlowableConcatMapPublisher<T, R> extends Flowable<R> { <ide> <ide> public FlowableConcatMapPublisher(Publisher<T> source, <ide> this.errorMode = errorMode; <ide> } <ide> <del> public static <T, R> Subscriber<T> subscribe(Subscriber<? super R> s, Function<? super T, ? extends Publisher<? extends R>> mapper, <del> int prefetch, ErrorMode errorMode) { <del> switch (errorMode) { <del> case BOUNDARY: <del> return new ConcatMapDelayed<T, R>(s, mapper, prefetch, false); <del> case END: <del> return new ConcatMapDelayed<T, R>(s, mapper, prefetch, true); <del> default: <del> return new ConcatMapImmediate<T, R>(s, mapper, prefetch); <del> } <del> } <del> <ide> @Override <ide> protected void subscribeActual(Subscriber<? super R> s) { <ide> <ide> if (FlowableScalarXMap.tryScalarXMapSubscribe(source, s, mapper)) { <ide> return; <ide> } <ide> <del> source.subscribe(subscribe(s, mapper, prefetch, errorMode)); <del> } <del> <del> abstract static class BaseConcatMapSubscriber<T, R> <del> extends AtomicInteger <del> implements FlowableSubscriber<T>, ConcatMapSupport<R>, Subscription { <del> <del> private static final long serialVersionUID = -3511336836796789179L; <del> <del> final ConcatMapInner<R> inner; <del> <del> final Function<? super T, ? extends Publisher<? extends R>> mapper; <del> <del> final int prefetch; <del> <del> final int limit; <del> <del> Subscription s; <del> <del> int consumed; <del> <del> SimpleQueue<T> queue; <del> <del> volatile boolean done; <del> <del> volatile boolean cancelled; <del> <del> final AtomicThrowable errors; <del> <del> volatile boolean active; <del> <del> int sourceMode; <del> <del> BaseConcatMapSubscriber( <del> Function<? super T, ? extends Publisher<? extends R>> mapper, <del> int prefetch) { <del> this.mapper = mapper; <del> this.prefetch = prefetch; <del> this.limit = prefetch - (prefetch >> 2); <del> this.inner = new ConcatMapInner<R>(this); <del> this.errors = new AtomicThrowable(); <del> } <del> <del> @Override <del> public final void onSubscribe(Subscription s) { <del> if (SubscriptionHelper.validate(this.s, s)) { <del> this.s = s; <del> <del> if (s instanceof QueueSubscription) { <del> @SuppressWarnings("unchecked") QueueSubscription<T> f = (QueueSubscription<T>)s; <del> int m = f.requestFusion(QueueSubscription.ANY); <del> if (m == QueueSubscription.SYNC) { <del> sourceMode = m; <del> queue = f; <del> done = true; <del> <del> subscribeActual(); <del> <del> drain(); <del> return; <del> } <del> if (m == QueueSubscription.ASYNC) { <del> sourceMode = m; <del> queue = f; <del> <del> subscribeActual(); <del> <del> s.request(prefetch); <del> return; <del> } <del> } <del> <del> queue = new SpscArrayQueue<T>(prefetch); <del> <del> subscribeActual(); <del> <del> s.request(prefetch); <del> } <del> } <del> <del> abstract void drain(); <del> <del> abstract void subscribeActual(); <del> <del> @Override <del> public final void onNext(T t) { <del> if (sourceMode != QueueSubscription.ASYNC) { <del> if (!queue.offer(t)) { <del> s.cancel(); <del> onError(new IllegalStateException("Queue full?!")); <del> return; <del> } <del> } <del> drain(); <del> } <del> <del> @Override <del> public final void onComplete() { <del> done = true; <del> drain(); <del> } <del> <del> @Override <del> public final void innerComplete() { <del> active = false; <del> drain(); <del> } <del> <del> } <del> <del> <del> static final class ConcatMapImmediate<T, R> <del> extends BaseConcatMapSubscriber<T, R> { <del> <del> <del> private static final long serialVersionUID = 7898995095634264146L; <del> <del> final Subscriber<? super R> actual; <del> <del> final AtomicInteger wip; <del> <del> ConcatMapImmediate(Subscriber<? super R> actual, <del> Function<? super T, ? extends Publisher<? extends R>> mapper, <del> int prefetch) { <del> super(mapper, prefetch); <del> this.actual = actual; <del> this.wip = new AtomicInteger(); <del> } <del> <del> @Override <del> void subscribeActual() { <del> actual.onSubscribe(this); <del> } <del> <del> @Override <del> public void onError(Throwable t) { <del> if (errors.addThrowable(t)) { <del> inner.cancel(); <del> <del> if (getAndIncrement() == 0) { <del> actual.onError(errors.terminate()); <del> } <del> } else { <del> RxJavaPlugins.onError(t); <del> } <del> } <del> <del> @Override <del> public void innerNext(R value) { <del> if (get() == 0 && compareAndSet(0, 1)) { <del> actual.onNext(value); <del> if (compareAndSet(1, 0)) { <del> return; <del> } <del> actual.onError(errors.terminate()); <del> } <del> } <del> <del> @Override <del> public void innerError(Throwable e) { <del> if (errors.addThrowable(e)) { <del> s.cancel(); <del> <del> if (getAndIncrement() == 0) { <del> actual.onError(errors.terminate()); <del> } <del> } else { <del> RxJavaPlugins.onError(e); <del> } <del> } <del> <del> @Override <del> public void request(long n) { <del> inner.request(n); <del> } <del> <del> @Override <del> public void cancel() { <del> if (!cancelled) { <del> cancelled = true; <del> <del> inner.cancel(); <del> s.cancel(); <del> } <del> } <del> <del> @Override <del> void drain() { <del> if (wip.getAndIncrement() == 0) { <del> for (;;) { <del> if (cancelled) { <del> return; <del> } <del> <del> if (!active) { <del> boolean d = done; <del> <del> T v; <del> <del> try { <del> v = queue.poll(); <del> } catch (Throwable e) { <del> Exceptions.throwIfFatal(e); <del> s.cancel(); <del> errors.addThrowable(e); <del> actual.onError(errors.terminate()); <del> return; <del> } <del> <del> boolean empty = v == null; <del> <del> if (d && empty) { <del> actual.onComplete(); <del> return; <del> } <del> <del> if (!empty) { <del> Publisher<? extends R> p; <del> <del> try { <del> p = ObjectHelper.requireNonNull(mapper.apply(v), "The mapper returned a null Publisher"); <del> } catch (Throwable e) { <del> Exceptions.throwIfFatal(e); <del> <del> s.cancel(); <del> errors.addThrowable(e); <del> actual.onError(errors.terminate()); <del> return; <del> } <del> <del> if (sourceMode != QueueSubscription.SYNC) { <del> int c = consumed + 1; <del> if (c == limit) { <del> consumed = 0; <del> s.request(c); <del> } else { <del> consumed = c; <del> } <del> } <del> <del> <del> if (p instanceof Callable) { <del> @SuppressWarnings("unchecked") <del> Callable<R> callable = (Callable<R>) p; <del> <del> R vr; <del> <del> try { <del> vr = callable.call(); <del> } catch (Throwable e) { <del> Exceptions.throwIfFatal(e); <del> s.cancel(); <del> errors.addThrowable(e); <del> actual.onError(errors.terminate()); <del> return; <del> } <del> <del> <del> if (vr == null) { <del> continue; <del> } <del> <del> if (inner.isUnbounded()) { <del> if (get() == 0 && compareAndSet(0, 1)) { <del> actual.onNext(vr); <del> if (!compareAndSet(1, 0)) { <del> actual.onError(errors.terminate()); <del> return; <del> } <del> } <del> continue; <del> } else { <del> active = true; <del> inner.setSubscription(new WeakScalarSubscription<R>(vr, inner)); <del> } <del> <del> } else { <del> active = true; <del> p.subscribe(inner); <del> } <del> } <del> } <del> if (wip.decrementAndGet() == 0) { <del> break; <del> } <del> } <del> } <del> } <del> } <del> <del> static final class WeakScalarSubscription<T> implements Subscription { <del> final Subscriber<? super T> actual; <del> final T value; <del> boolean once; <del> <del> WeakScalarSubscription(T value, Subscriber<? super T> actual) { <del> this.value = value; <del> this.actual = actual; <del> } <del> <del> @Override <del> public void request(long n) { <del> if (n > 0 && !once) { <del> once = true; <del> Subscriber<? super T> a = actual; <del> a.onNext(value); <del> a.onComplete(); <del> } <del> } <del> <del> @Override <del> public void cancel() { <del> <del> } <del> } <del> <del> static final class ConcatMapDelayed<T, R> <del> extends BaseConcatMapSubscriber<T, R> { <del> <del> <del> private static final long serialVersionUID = -2945777694260521066L; <del> <del> final Subscriber<? super R> actual; <del> <del> final boolean veryEnd; <del> <del> ConcatMapDelayed(Subscriber<? super R> actual, <del> Function<? super T, ? extends Publisher<? extends R>> mapper, <del> int prefetch, boolean veryEnd) { <del> super(mapper, prefetch); <del> this.actual = actual; <del> this.veryEnd = veryEnd; <del> } <del> <del> @Override <del> void subscribeActual() { <del> actual.onSubscribe(this); <del> } <del> <del> @Override <del> public void onError(Throwable t) { <del> if (errors.addThrowable(t)) { <del> done = true; <del> drain(); <del> } else { <del> RxJavaPlugins.onError(t); <del> } <del> } <del> <del> @Override <del> public void innerNext(R value) { <del> actual.onNext(value); <del> } <del> <del> <del> @Override <del> public void innerError(Throwable e) { <del> if (errors.addThrowable(e)) { <del> if (!veryEnd) { <del> s.cancel(); <del> done = true; <del> } <del> active = false; <del> drain(); <del> } else { <del> RxJavaPlugins.onError(e); <del> } <del> } <del> <del> @Override <del> public void request(long n) { <del> inner.request(n); <del> } <del> <del> @Override <del> public void cancel() { <del> if (!cancelled) { <del> cancelled = true; <del> <del> inner.cancel(); <del> s.cancel(); <del> } <del> } <del> <del> @Override <del> void drain() { <del> if (getAndIncrement() == 0) { <del> <del> for (;;) { <del> if (cancelled) { <del> return; <del> } <del> <del> if (!active) { <del> <del> boolean d = done; <del> <del> if (d && !veryEnd) { <del> Throwable ex = errors.get(); <del> if (ex != null) { <del> actual.onError(errors.terminate()); <del> return; <del> } <del> } <del> <del> T v; <del> <del> try { <del> v = queue.poll(); <del> } catch (Throwable e) { <del> Exceptions.throwIfFatal(e); <del> s.cancel(); <del> errors.addThrowable(e); <del> actual.onError(errors.terminate()); <del> return; <del> } <del> <del> boolean empty = v == null; <del> <del> if (d && empty) { <del> Throwable ex = errors.terminate(); <del> if (ex != null) { <del> actual.onError(ex); <del> } else { <del> actual.onComplete(); <del> } <del> return; <del> } <del> <del> if (!empty) { <del> Publisher<? extends R> p; <del> <del> try { <del> p = ObjectHelper.requireNonNull(mapper.apply(v), "The mapper returned a null Publisher"); <del> } catch (Throwable e) { <del> Exceptions.throwIfFatal(e); <del> <del> s.cancel(); <del> errors.addThrowable(e); <del> actual.onError(errors.terminate()); <del> return; <del> } <del> <del> if (sourceMode != QueueSubscription.SYNC) { <del> int c = consumed + 1; <del> if (c == limit) { <del> consumed = 0; <del> s.request(c); <del> } else { <del> consumed = c; <del> } <del> } <del> <del> if (p instanceof Callable) { <del> @SuppressWarnings("unchecked") <del> Callable<R> supplier = (Callable<R>) p; <del> <del> R vr; <del> <del> try { <del> vr = supplier.call(); <del> } catch (Throwable e) { <del> Exceptions.throwIfFatal(e); <del> s.cancel(); <del> errors.addThrowable(e); <del> actual.onError(errors.terminate()); <del> return; <del> } <del> <del> if (vr == null) { <del> continue; <del> } <del> <del> if (inner.isUnbounded()) { <del> actual.onNext(vr); <del> continue; <del> } else { <del> active = true; <del> inner.setSubscription(new WeakScalarSubscription<R>(vr, inner)); <del> } <del> } else { <del> active = true; <del> p.subscribe(inner); <del> } <del> } <del> } <del> if (decrementAndGet() == 0) { <del> break; <del> } <del> } <del> } <del> } <del> } <del> <del> interface ConcatMapSupport<T> { <del> <del> void innerNext(T value); <del> <del> void innerComplete(); <del> <del> void innerError(Throwable e); <del> } <del> <del> static final class ConcatMapInner<R> <del> extends SubscriptionArbiter <del> implements FlowableSubscriber<R> { <del> <del> <del> private static final long serialVersionUID = 897683679971470653L; <del> <del> final ConcatMapSupport<R> parent; <del> <del> long produced; <del> <del> ConcatMapInner(ConcatMapSupport<R> parent) { <del> this.parent = parent; <del> } <del> <del> @Override <del> public void onSubscribe(Subscription s) { <del> setSubscription(s); <del> } <del> <del> @Override <del> public void onNext(R t) { <del> produced++; <del> <del> parent.innerNext(t); <del> } <del> <del> @Override <del> public void onError(Throwable t) { <del> long p = produced; <del> <del> if (p != 0L) { <del> produced = 0L; <del> produced(p); <del> } <del> <del> parent.innerError(t); <del> } <del> <del> @Override <del> public void onComplete() { <del> long p = produced; <del> <del> if (p != 0L) { <del> produced = 0L; <del> produced(p); <del> } <del> <del> parent.innerComplete(); <del> } <add> source.subscribe(FlowableConcatMap.subscribe(s, mapper, prefetch, errorMode)); <ide> } <ide> } <ide><path>src/main/java/io/reactivex/internal/operators/flowable/FlowableMapPublisher.java <ide> <ide> import io.reactivex.Flowable; <ide> import io.reactivex.functions.Function; <del>import io.reactivex.internal.fuseable.ConditionalSubscriber; <del>import io.reactivex.internal.operators.flowable.FlowableMap.*; <add>import io.reactivex.internal.operators.flowable.FlowableMap.MapSubscriber; <ide> <ide> /** <ide> * Map working with an arbitrary Publisher source. <ide> public FlowableMapPublisher(Publisher<T> source, Function<? super T, ? extends U <ide> <ide> @Override <ide> protected void subscribeActual(Subscriber<? super U> s) { <del> if (s instanceof ConditionalSubscriber) { <del> source.subscribe(new MapConditionalSubscriber<T, U>((ConditionalSubscriber<? super U>)s, mapper)); <del> } else { <del> source.subscribe(new MapSubscriber<T, U>(s, mapper)); <del> } <add> source.subscribe(new MapSubscriber<T, U>(s, mapper)); <ide> } <ide> } <ide><path>src/main/java/io/reactivex/internal/operators/flowable/FlowableReduceSeedSingle.java <ide> import io.reactivex.functions.BiFunction; <ide> import io.reactivex.internal.functions.ObjectHelper; <ide> import io.reactivex.internal.subscriptions.SubscriptionHelper; <del>import io.reactivex.plugins.RxJavaPlugins; <ide> <ide> /** <ide> * Reduce a sequence of values, starting from a seed value and by using <ide> public void onSubscribe(Subscription s) { <ide> @Override <ide> public void onNext(T value) { <ide> R v = this.value; <del> if (v != null) { <del> try { <del> this.value = ObjectHelper.requireNonNull(reducer.apply(v, value), "The reducer returned a null value"); <del> } catch (Throwable ex) { <del> Exceptions.throwIfFatal(ex); <del> s.cancel(); <del> onError(ex); <del> } <add> try { <add> this.value = ObjectHelper.requireNonNull(reducer.apply(v, value), "The reducer returned a null value"); <add> } catch (Throwable ex) { <add> Exceptions.throwIfFatal(ex); <add> s.cancel(); <add> onError(ex); <ide> } <ide> } <ide> <ide> @Override <ide> public void onError(Throwable e) { <del> R v = value; <ide> value = null; <del> if (v != null) { <del> s = SubscriptionHelper.CANCELLED; <del> actual.onError(e); <del> } else { <del> RxJavaPlugins.onError(e); <del> } <add> s = SubscriptionHelper.CANCELLED; <add> actual.onError(e); <ide> } <ide> <ide> @Override <ide> public void onComplete() { <ide> R v = value; <ide> value = null; <del> if (v != null) { <del> s = SubscriptionHelper.CANCELLED; <del> actual.onSuccess(v); <del> } <add> s = SubscriptionHelper.CANCELLED; <add> actual.onSuccess(v); <ide> } <ide> <ide> @Override <ide><path>src/main/java/io/reactivex/internal/operators/flowable/FlowableStrict.java <del>/** <del> * Copyright (c) 2016-present, RxJava Contributors. <del> * <del> * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in <del> * compliance with the License. You may obtain a copy of the License at <del> * <del> * http://www.apache.org/licenses/LICENSE-2.0 <del> * <del> * Unless required by applicable law or agreed to in writing, software distributed under the License is <del> * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See <del> * the License for the specific language governing permissions and limitations under the License. <del> */ <del> <del>package io.reactivex.internal.operators.flowable; <del> <del>import java.util.concurrent.atomic.*; <del> <del>import org.reactivestreams.*; <del> <del>import io.reactivex.*; <del>import io.reactivex.internal.subscriptions.SubscriptionHelper; <del>import io.reactivex.internal.util.*; <del> <del>/** <del> * Ensures that the event flow between the upstream and downstream follow <del> * the Reactive-Streams 1.0 specification by honoring the 3 additional rules <del> * (which are omitted in standard operators due to performance reasons). <del> * <ul> <del> * <li>§1.3: onNext should not be called concurrently until onSubscribe returns</li> <del> * <li>§2.3: onError or onComplete must not call cancel</li> <del> * <li>§3.9: negative requests should emit an onError(IllegalArgumentException)</li> <del> * </ul> <del> * In addition, if rule §2.12 (onSubscribe must be called at most once) is violated, <del> * the sequence is cancelled an onError(IllegalStateException) is emitted. <del> * @param <T> the value type <del> */ <del>public final class FlowableStrict<T> extends AbstractFlowableWithUpstream<T, T> { <del> <del> public FlowableStrict(Flowable<T> source) { <del> super(source); <del> } <del> <del> @Override <del> protected void subscribeActual(Subscriber<? super T> s) { <del> source.subscribe(new StrictSubscriber<T>(s)); <del> } <del> <del> public static final class StrictSubscriber<T> <del> extends AtomicInteger <del> implements FlowableSubscriber<T>, Subscription { <del> <del> private static final long serialVersionUID = -4945028590049415624L; <del> <del> final Subscriber<? super T> actual; <del> <del> final AtomicThrowable error; <del> <del> final AtomicLong requested; <del> <del> final AtomicReference<Subscription> s; <del> <del> final AtomicBoolean once; <del> <del> volatile boolean done; <del> <del> public StrictSubscriber(Subscriber<? super T> actual) { <del> this.actual = actual; <del> this.error = new AtomicThrowable(); <del> this.requested = new AtomicLong(); <del> this.s = new AtomicReference<Subscription>(); <del> this.once = new AtomicBoolean(); <del> } <del> <del> @Override <del> public void request(long n) { <del> if (n <= 0) { <del> cancel(); <del> onError(new IllegalArgumentException("§3.9 violated: positive request amount required but it was " + n)); <del> } else { <del> SubscriptionHelper.deferredRequest(s, requested, n); <del> } <del> } <del> <del> @Override <del> public void cancel() { <del> if (!done) { <del> SubscriptionHelper.cancel(s); <del> } <del> } <del> <del> @Override <del> public void onSubscribe(Subscription s) { <del> if (once.compareAndSet(false, true)) { <del> <del> actual.onSubscribe(this); <del> <del> SubscriptionHelper.deferredSetOnce(this.s, requested, s); <del> } else { <del> s.cancel(); <del> cancel(); <del> onError(new IllegalStateException("§2.12 violated: onSubscribe must be called at most once")); <del> } <del> } <del> <del> @Override <del> public void onNext(T t) { <del> HalfSerializer.onNext(actual, t, this, error); <del> } <del> <del> @Override <del> public void onError(Throwable t) { <del> done = true; <del> HalfSerializer.onError(actual, t, this, error); <del> } <del> <del> @Override <del> public void onComplete() { <del> done = true; <del> HalfSerializer.onComplete(actual, this, error); <del> } <del> } <del> <del>} <ide><path>src/main/java/io/reactivex/internal/operators/observable/ObservableBufferBoundary.java <ide> <ide> package io.reactivex.internal.operators.observable; <ide> <del>import io.reactivex.internal.functions.ObjectHelper; <ide> import java.util.*; <ide> import java.util.concurrent.Callable; <ide> import java.util.concurrent.atomic.AtomicInteger; <ide> import io.reactivex.exceptions.Exceptions; <ide> import io.reactivex.functions.Function; <ide> import io.reactivex.internal.disposables.DisposableHelper; <del>import io.reactivex.internal.fuseable.SimpleQueue; <add>import io.reactivex.internal.functions.ObjectHelper; <add>import io.reactivex.internal.fuseable.SimplePlainQueue; <ide> import io.reactivex.internal.observers.QueueDrainObserver; <ide> import io.reactivex.internal.queue.MpscLinkedQueue; <ide> import io.reactivex.internal.util.QueueDrainHelper; <ide> void complete() { <ide> buffers.clear(); <ide> } <ide> <del> SimpleQueue<U> q = queue; <add> SimplePlainQueue<U> q = queue; <ide> for (U u : list) { <ide> q.offer(u); <ide> } <ide><path>src/main/java/io/reactivex/internal/subscribers/QueueDrainSubscriber.java <ide> protected final void fastPathEmitMax(U value, boolean delayError, Disposable dis <ide> <ide> protected final void fastPathOrderedEmitMax(U value, boolean delayError, Disposable dispose) { <ide> final Subscriber<? super V> s = actual; <del> final SimpleQueue<U> q = queue; <add> final SimplePlainQueue<U> q = queue; <ide> <ide> if (wip.get() == 0 && wip.compareAndSet(0, 1)) { <ide> long r = requested.get(); <ide> public final void requested(long n) { <ide> } <ide> } <ide> <del> public void drain(boolean delayError) { <del> if (enter()) { <del> QueueDrainHelper.drainLoop(queue, actual, delayError, this); <del> } <del> } <ide> } <ide> <ide> // ------------------------------------------------------------------- <ide><path>src/main/java/io/reactivex/internal/subscribers/StrictSubscriber.java <add>/** <add> * Copyright (c) 2016-present, RxJava Contributors. <add> * <add> * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in <add> * compliance with the License. You may obtain a copy of the License at <add> * <add> * http://www.apache.org/licenses/LICENSE-2.0 <add> * <add> * Unless required by applicable law or agreed to in writing, software distributed under the License is <add> * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See <add> * the License for the specific language governing permissions and limitations under the License. <add> */ <add> <add>package io.reactivex.internal.subscribers; <add> <add>import java.util.concurrent.atomic.*; <add> <add>import org.reactivestreams.*; <add> <add>import io.reactivex.FlowableSubscriber; <add>import io.reactivex.internal.subscriptions.SubscriptionHelper; <add>import io.reactivex.internal.util.*; <add> <add>/** <add> * Ensures that the event flow between the upstream and downstream follow <add> * the Reactive-Streams 1.0 specification by honoring the 3 additional rules <add> * (which are omitted in standard operators due to performance reasons). <add> * <ul> <add> * <li>§1.3: onNext should not be called concurrently until onSubscribe returns</li> <add> * <li>§2.3: onError or onComplete must not call cancel</li> <add> * <li>§3.9: negative requests should emit an onError(IllegalArgumentException)</li> <add> * </ul> <add> * In addition, if rule §2.12 (onSubscribe must be called at most once) is violated, <add> * the sequence is cancelled an onError(IllegalStateException) is emitted. <add> * @param <T> the value type <add> * @since 2.0.7 <add> */ <add>public class StrictSubscriber<T> <add>extends AtomicInteger <add>implements FlowableSubscriber<T>, Subscription { <add> <add> private static final long serialVersionUID = -4945028590049415624L; <add> <add> final Subscriber<? super T> actual; <add> <add> final AtomicThrowable error; <add> <add> final AtomicLong requested; <add> <add> final AtomicReference<Subscription> s; <add> <add> final AtomicBoolean once; <add> <add> volatile boolean done; <add> <add> public StrictSubscriber(Subscriber<? super T> actual) { <add> this.actual = actual; <add> this.error = new AtomicThrowable(); <add> this.requested = new AtomicLong(); <add> this.s = new AtomicReference<Subscription>(); <add> this.once = new AtomicBoolean(); <add> } <add> <add> @Override <add> public void request(long n) { <add> if (n <= 0) { <add> cancel(); <add> onError(new IllegalArgumentException("§3.9 violated: positive request amount required but it was " + n)); <add> } else { <add> SubscriptionHelper.deferredRequest(s, requested, n); <add> } <add> } <add> <add> @Override <add> public void cancel() { <add> if (!done) { <add> SubscriptionHelper.cancel(s); <add> } <add> } <add> <add> @Override <add> public void onSubscribe(Subscription s) { <add> if (once.compareAndSet(false, true)) { <add> <add> actual.onSubscribe(this); <add> <add> SubscriptionHelper.deferredSetOnce(this.s, requested, s); <add> } else { <add> s.cancel(); <add> cancel(); <add> onError(new IllegalStateException("§2.12 violated: onSubscribe must be called at most once")); <add> } <add> } <add> <add> @Override <add> public void onNext(T t) { <add> HalfSerializer.onNext(actual, t, this, error); <add> } <add> <add> @Override <add> public void onError(Throwable t) { <add> done = true; <add> HalfSerializer.onError(actual, t, this, error); <add> } <add> <add> @Override <add> public void onComplete() { <add> done = true; <add> HalfSerializer.onComplete(actual, this, error); <add> } <add>} <ide><path>src/main/java/io/reactivex/internal/subscribers/SubscriberResourceWrapper.java <ide> public SubscriberResourceWrapper(Subscriber<? super T> actual) { <ide> <ide> @Override <ide> public void onSubscribe(Subscription s) { <del> for (;;) { <del> Subscription current = subscription.get(); <del> if (current == SubscriptionHelper.CANCELLED) { <del> s.cancel(); <del> return; <del> } <del> if (current != null) { <del> s.cancel(); <del> SubscriptionHelper.reportSubscriptionSet(); <del> return; <del> } <del> if (subscription.compareAndSet(null, s)) { <del> actual.onSubscribe(this); <del> return; <del> } <add> if (SubscriptionHelper.setOnce(subscription, s)) { <add> actual.onSubscribe(this); <ide> } <ide> } <ide> <ide> public void onNext(T t) { <ide> <ide> @Override <ide> public void onError(Throwable t) { <del> dispose(); <add> DisposableHelper.dispose(this); <ide> actual.onError(t); <ide> } <ide> <ide> @Override <ide> public void onComplete() { <del> dispose(); <add> DisposableHelper.dispose(this); <ide> actual.onComplete(); <ide> } <ide> <ide><path>src/main/java/io/reactivex/internal/util/QueueDrainHelper.java <ide> import io.reactivex.disposables.Disposable; <ide> import io.reactivex.exceptions.*; <ide> import io.reactivex.functions.BooleanSupplier; <del>import io.reactivex.internal.fuseable.SimpleQueue; <add>import io.reactivex.internal.fuseable.*; <ide> import io.reactivex.internal.queue.*; <ide> <ide> /** <ide> private QueueDrainHelper() { <ide> throw new IllegalStateException("No instances!"); <ide> } <ide> <del> public static <T, U> void drainLoop(SimpleQueue<T> q, Subscriber<? super U> a, boolean delayError, QueueDrain<T, U> qd) { <del> <del> int missed = 1; <del> <del> for (;;) { <del> if (checkTerminated(qd.done(), q.isEmpty(), a, delayError, q, qd)) { <del> return; <del> } <del> <del> long r = qd.requested(); <del> long e = 0L; <del> <del> while (e != r) { <del> boolean d = qd.done(); <del> T v; <del> <del> try { <del> v = q.poll(); <del> } catch (Throwable ex) { <del> Exceptions.throwIfFatal(ex); <del> a.onError(ex); <del> return; <del> } <del> <del> boolean empty = v == null; <del> <del> if (checkTerminated(d, empty, a, delayError, q, qd)) { <del> return; <del> } <del> <del> if (empty) { <del> break; <del> } <del> <del> if (qd.accept(a, v)) { <del> e++; <del> } <del> } <del> <del> if (e != 0L && r != Long.MAX_VALUE) { <del> qd.produced(e); <del> } <del> <del> missed = qd.leave(-missed); <del> if (missed == 0) { <del> break; <del> } <del> } <del> } <del> <ide> /** <ide> * Drain the queue but give up with an error if there aren't enough requests. <ide> * @param <T> the queue value type <ide> public static <T, U> void drainLoop(SimpleQueue<T> q, Subscriber<? super U> a, b <ide> * @param dispose the disposable to call when termination happens and cleanup is necessary <ide> * @param qd the QueueDrain instance that gives status information to the drain logic <ide> */ <del> public static <T, U> void drainMaxLoop(SimpleQueue<T> q, Subscriber<? super U> a, boolean delayError, <add> public static <T, U> void drainMaxLoop(SimplePlainQueue<T> q, Subscriber<? super U> a, boolean delayError, <ide> Disposable dispose, QueueDrain<T, U> qd) { <ide> int missed = 1; <ide> <ide> for (;;) { <ide> for (;;) { <ide> boolean d = qd.done(); <ide> <del> T v; <del> <del> try { <del> v = q.poll(); <del> } catch (Throwable ex) { <del> Exceptions.throwIfFatal(ex); <del> a.onError(ex); <del> return; <del> } <add> T v = q.poll(); <ide> <ide> boolean empty = v == null; <ide> <ide> public static <T, U> boolean checkTerminated(boolean d, boolean empty, <ide> return false; <ide> } <ide> <del> public static <T, U> void drainLoop(SimpleQueue<T> q, Observer<? super U> a, boolean delayError, Disposable dispose, ObservableQueueDrain<T, U> qd) { <add> public static <T, U> void drainLoop(SimplePlainQueue<T> q, Observer<? super U> a, boolean delayError, Disposable dispose, ObservableQueueDrain<T, U> qd) { <ide> <ide> int missed = 1; <ide> <ide> public static <T, U> void drainLoop(SimpleQueue<T> q, Observer<? super U> a, boo <ide> <ide> for (;;) { <ide> boolean d = qd.done(); <del> T v; <del> <del> try { <del> v = q.poll(); <del> } catch (Throwable ex) { <del> Exceptions.throwIfFatal(ex); <del> a.onError(ex); <del> return; <del> } <del> <add> T v = q.poll(); <ide> boolean empty = v == null; <ide> <ide> if (checkTerminated(d, empty, a, delayError, q, dispose, qd)) { <ide><path>src/test/java/io/reactivex/Retry.java <add>/** <add> * Copyright (c) 2016-present, RxJava Contributors. <add> * <add> * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in <add> * compliance with the License. You may obtain a copy of the License at <add> * <add> * http://www.apache.org/licenses/LICENSE-2.0 <add> * <add> * Unless required by applicable law or agreed to in writing, software distributed under the License is <add> * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See <add> * the License for the specific language governing permissions and limitations under the License. <add> */ <add> <add>package io.reactivex; <add> <add>import org.junit.rules.TestRule; <add>import org.junit.runner.Description; <add>import org.junit.runners.model.Statement; <add> <add>/** <add> * Test rule to retry flaky tests. <add> * <a href="http://stackoverflow.com/a/8301639/61158">From Stackoverflow</a>. <add> */ <add>public class Retry implements TestRule { <add> <add> final int retryCount; <add> <add> final int sleep; <add> <add> final boolean backoff; <add> <add> public Retry(int retryCount, int sleep, boolean backoff) { <add> this.retryCount = retryCount; <add> this.sleep = sleep; <add> this.backoff = backoff; <add> } <add> <add> @Override <add> public Statement apply(Statement base, Description description) { <add> return statement(base, description); <add> } <add> <add> private Statement statement(final Statement base, final Description description) { <add> return new Statement() { <add> @Override <add> public void evaluate() throws Throwable { <add> Throwable caughtThrowable = null; <add> <add> for (int i = 0; i < retryCount; i++) { <add> try { <add> base.evaluate(); <add> return; <add> } catch (Throwable t) { <add> caughtThrowable = t; <add> System.err.println(description.getDisplayName() + ": run " + (i + 1) + " failed"); <add> int n = sleep; <add> if (backoff && i != 0) { <add> n = n * (2 << i); <add> } <add> Thread.sleep(n); <add> } <add> } <add> System.err.println(description.getDisplayName() + ": giving up after " + retryCount + " failures"); <add> throw caughtThrowable; <add> } <add> }; <add> } <add>} <ide>\ No newline at end of file <ide><path>src/test/java/io/reactivex/XFlatMapTest.java <ide> import java.util.List; <ide> import java.util.concurrent.CyclicBarrier; <ide> <del>import org.junit.Test; <add>import org.junit.*; <ide> import org.reactivestreams.Publisher; <ide> <ide> import io.reactivex.exceptions.TestException; <ide> <ide> public class XFlatMapTest { <ide> <add> @Rule <add> public Retry retry = new Retry(3, 1000, true); <add> <ide> static final int SLEEP_AFTER_CANCEL = 500; <ide> <ide> final CyclicBarrier cb = new CyclicBarrier(2); <ide><path>src/test/java/io/reactivex/internal/observers/FutureObserverTest.java <add>/** <add> * Copyright (c) 2016-present, RxJava Contributors. <add> * <add> * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in <add> * compliance with the License. You may obtain a copy of the License at <add> * <add> * http://www.apache.org/licenses/LICENSE-2.0 <add> * <add> * Unless required by applicable law or agreed to in writing, software distributed under the License is <add> * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See <add> * the License for the specific language governing permissions and limitations under the License. <add> */ <add> <add>package io.reactivex.internal.observers; <add> <add>import static org.junit.Assert.*; <add> <add>import java.util.*; <add>import java.util.concurrent.*; <add> <add>import org.junit.*; <add> <add>import io.reactivex.TestHelper; <add>import io.reactivex.disposables.*; <add>import io.reactivex.exceptions.TestException; <add>import io.reactivex.internal.functions.Functions; <add>import io.reactivex.internal.subscribers.FutureSubscriber; <add>import io.reactivex.internal.subscriptions.BooleanSubscription; <add>import io.reactivex.plugins.RxJavaPlugins; <add>import io.reactivex.schedulers.Schedulers; <add> <add>public class FutureObserverTest { <add> FutureObserver<Integer> fo; <add> <add> @Before <add> public void before() { <add> fo = new FutureObserver<Integer>(); <add> } <add> <add> @Test <add> public void cancel2() { <add> <add> fo.dispose(); <add> <add> assertFalse(fo.isCancelled()); <add> assertFalse(fo.isDisposed()); <add> assertFalse(fo.isDone()); <add> <add> for (int i = 0; i < 2; i++) { <add> fo.cancel(i == 0); <add> <add> assertTrue(fo.isCancelled()); <add> assertTrue(fo.isDisposed()); <add> assertTrue(fo.isDone()); <add> } <add> <add> List<Throwable> errors = TestHelper.trackPluginErrors(); <add> try { <add> fo.onNext(1); <add> fo.onError(new TestException("First")); <add> fo.onError(new TestException("Second")); <add> fo.onComplete(); <add> <add> assertTrue(fo.isCancelled()); <add> assertTrue(fo.isDisposed()); <add> assertTrue(fo.isDone()); <add> <add> TestHelper.assertUndeliverable(errors, 0, TestException.class); <add> TestHelper.assertUndeliverable(errors, 1, TestException.class); <add> } finally { <add> RxJavaPlugins.reset(); <add> } <add> } <add> <add> @Test <add> public void cancel() throws Exception { <add> assertFalse(fo.isDone()); <add> <add> assertFalse(fo.isCancelled()); <add> <add> fo.cancel(false); <add> <add> assertTrue(fo.isDone()); <add> <add> assertTrue(fo.isCancelled()); <add> <add> try { <add> fo.get(); <add> fail("Should have thrown"); <add> } catch (CancellationException ex) { <add> // expected <add> } <add> <add> try { <add> fo.get(1, TimeUnit.MILLISECONDS); <add> fail("Should have thrown"); <add> } catch (CancellationException ex) { <add> // expected <add> } <add> } <add> <add> @Test <add> public void onError() throws Exception { <add> List<Throwable> errors = TestHelper.trackPluginErrors(); <add> <add> try { <add> fo.onError(new TestException("One")); <add> <add> fo.onError(new TestException("Two")); <add> <add> try { <add> fo.get(5, TimeUnit.MILLISECONDS); <add> } catch (ExecutionException ex) { <add> assertTrue(ex.toString(), ex.getCause() instanceof TestException); <add> assertEquals("One", ex.getCause().getMessage()); <add> } <add> <add> TestHelper.assertUndeliverable(errors, 0, TestException.class, "Two"); <add> } finally { <add> RxJavaPlugins.reset(); <add> } <add> } <add> <add> @Test <add> public void onNext() throws Exception { <add> fo.onNext(1); <add> fo.onComplete(); <add> <add> assertEquals(1, fo.get(5, TimeUnit.MILLISECONDS).intValue()); <add> } <add> <add> @Test <add> public void onSubscribe() throws Exception { <add> List<Throwable> errors = TestHelper.trackPluginErrors(); <add> <add> try { <add> <add> Disposable s = Disposables.empty(); <add> <add> fo.onSubscribe(s); <add> <add> Disposable s2 = Disposables.empty(); <add> <add> fo.onSubscribe(s2); <add> <add> assertFalse(s.isDisposed()); <add> assertTrue(s2.isDisposed()); <add> <add> TestHelper.assertError(errors, 0, IllegalStateException.class, "Disposable already set!"); <add> } finally { <add> RxJavaPlugins.reset(); <add> } <add> } <add> <add> @Test <add> public void cancelRace() { <add> for (int i = 0; i < 500; i++) { <add> final FutureSubscriber<Integer> fo = new FutureSubscriber<Integer>(); <add> <add> Runnable r = new Runnable() { <add> @Override <add> public void run() { <add> fo.cancel(false); <add> } <add> }; <add> <add> TestHelper.race(r, r, Schedulers.single()); <add> } <add> } <add> <add> @Test <add> public void await() throws Exception { <add> Schedulers.single().scheduleDirect(new Runnable() { <add> @Override <add> public void run() { <add> fo.onNext(1); <add> fo.onComplete(); <add> } <add> }, 100, TimeUnit.MILLISECONDS); <add> <add> assertEquals(1, fo.get(5, TimeUnit.SECONDS).intValue()); <add> } <add> <add> @Test <add> public void onErrorCancelRace() { <add> RxJavaPlugins.setErrorHandler(Functions.emptyConsumer()); <add> try { <add> for (int i = 0; i < 500; i++) { <add> final FutureSubscriber<Integer> fo = new FutureSubscriber<Integer>(); <add> <add> final TestException ex = new TestException(); <add> <add> Runnable r1 = new Runnable() { <add> @Override <add> public void run() { <add> fo.cancel(false); <add> } <add> }; <add> <add> Runnable r2 = new Runnable() { <add> @Override <add> public void run() { <add> fo.onError(ex); <add> } <add> }; <add> <add> TestHelper.race(r1, r2, Schedulers.single()); <add> } <add> } finally { <add> RxJavaPlugins.reset(); <add> } <add> } <add> <add> @Test <add> public void onCompleteCancelRace() { <add> for (int i = 0; i < 500; i++) { <add> final FutureSubscriber<Integer> fo = new FutureSubscriber<Integer>(); <add> <add> if (i % 3 == 0) { <add> fo.onSubscribe(new BooleanSubscription()); <add> } <add> <add> if (i % 2 == 0) { <add> fo.onNext(1); <add> } <add> <add> Runnable r1 = new Runnable() { <add> @Override <add> public void run() { <add> fo.cancel(false); <add> } <add> }; <add> <add> Runnable r2 = new Runnable() { <add> @Override <add> public void run() { <add> fo.onComplete(); <add> } <add> }; <add> <add> TestHelper.race(r1, r2, Schedulers.single()); <add> } <add> } <add> <add> @Test <add> public void onErrorOnComplete() throws Exception { <add> fo.onError(new TestException("One")); <add> fo.onComplete(); <add> <add> try { <add> fo.get(5, TimeUnit.MILLISECONDS); <add> } catch (ExecutionException ex) { <add> assertTrue(ex.toString(), ex.getCause() instanceof TestException); <add> assertEquals("One", ex.getCause().getMessage()); <add> } <add> } <add> <add> @Test <add> public void onCompleteOnError() throws Exception { <add> fo.onComplete(); <add> fo.onError(new TestException("One")); <add> <add> try { <add> assertNull(fo.get(5, TimeUnit.MILLISECONDS)); <add> } catch (ExecutionException ex) { <add> assertTrue(ex.toString(), ex.getCause() instanceof NoSuchElementException); <add> } <add> } <add> <add> @Test <add> public void cancelOnError() throws Exception { <add> fo.cancel(true); <add> fo.onError(new TestException("One")); <add> <add> try { <add> fo.get(5, TimeUnit.MILLISECONDS); <add> fail("Should have thrown"); <add> } catch (CancellationException ex) { <add> // expected <add> } <add> } <add> <add> @Test <add> public void cancelOnComplete() throws Exception { <add> fo.cancel(true); <add> fo.onComplete(); <add> <add> try { <add> fo.get(5, TimeUnit.MILLISECONDS); <add> fail("Should have thrown"); <add> } catch (CancellationException ex) { <add> // expected <add> } <add> } <add> <add> @Test <add> public void onNextThenOnCompleteTwice() throws Exception { <add> fo.onNext(1); <add> fo.onComplete(); <add> fo.onComplete(); <add> <add> assertEquals(1, fo.get(5, TimeUnit.MILLISECONDS).intValue()); <add> } <add> <add> @Test(expected = InterruptedException.class) <add> public void getInterrupted() throws Exception { <add> Thread.currentThread().interrupt(); <add> fo.get(); <add> } <add> <add> @Test <add> public void completeAsync() throws Exception { <add> Schedulers.single().scheduleDirect(new Runnable() { <add> @Override <add> public void run() { <add> fo.onNext(1); <add> fo.onComplete(); <add> } <add> }, 500, TimeUnit.MILLISECONDS); <add> <add> assertEquals(1, fo.get().intValue()); <add> } <add>} <ide><path>src/test/java/io/reactivex/internal/operators/flowable/FlowableReduceWithSingleTest.java <add>/** <add> * Copyright (c) 2016-present, RxJava Contributors. <add> * <add> * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in <add> * compliance with the License. You may obtain a copy of the License at <add> * <add> * http://www.apache.org/licenses/LICENSE-2.0 <add> * <add> * Unless required by applicable law or agreed to in writing, software distributed under the License is <add> * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See <add> * the License for the specific language governing permissions and limitations under the License. <add> */ <add> <add>package io.reactivex.internal.operators.flowable; <add> <add>import org.junit.Test; <add> <add>import io.reactivex.*; <add>import io.reactivex.functions.BiFunction; <add>import io.reactivex.internal.functions.Functions; <add> <add>public class FlowableReduceWithSingleTest { <add> <add> @Test <add> public void normal() { <add> Flowable.range(1, 5) <add> .reduceWith(Functions.justCallable(1), new BiFunction<Integer, Integer, Integer>() { <add> @Override <add> public Integer apply(Integer a, Integer b) throws Exception { <add> return a + b; <add> } <add> }) <add> .test() <add> .assertResult(16); <add> } <add> <add> @Test <add> public void disposed() { <add> TestHelper.checkDisposed(Flowable.range(1, 5) <add> .reduceWith(Functions.justCallable(1), new BiFunction<Integer, Integer, Integer>() { <add> @Override <add> public Integer apply(Integer a, Integer b) throws Exception { <add> return a + b; <add> } <add> })); <add> } <add>} <ide><path>src/test/java/io/reactivex/internal/operators/flowable/FlowableStrictTest.java <ide> <ide> import io.reactivex.*; <ide> import io.reactivex.exceptions.TestException; <add>import io.reactivex.internal.subscribers.StrictSubscriber; <ide> import io.reactivex.internal.subscriptions.BooleanSubscription; <add>import io.reactivex.processors.PublishProcessor; <ide> import io.reactivex.schedulers.Schedulers; <ide> import io.reactivex.subscribers.TestSubscriber; <ide> <ide> public void onComplete() { <ide> <ide> assertFalse(bs.isCancelled()); <ide> } <add> <add> @Test <add> public void normal() { <add> TestSubscriber<Integer> ts = new TestSubscriber<Integer>(); <add> <add> Flowable.range(1, 5) <add> .subscribe(new StrictSubscriber<Integer>(ts)); <add> <add> ts.assertResult(1, 2, 3, 4, 5); <add> } <add> <add> @Test <add> public void badRequestOnNextRace() { <add> for (int i = 0; i < 500; i++) { <add> TestSubscriber<Integer> ts = new TestSubscriber<Integer>(); <add> <add> final PublishProcessor<Integer> pp = PublishProcessor.create(); <add> <add> final StrictSubscriber<Integer> s = new StrictSubscriber<Integer>(ts); <add> <add> s.onSubscribe(new BooleanSubscription()); <add> <add> Runnable r1 = new Runnable() { <add> @Override <add> public void run() { <add> pp.onNext(1); <add> } <add> }; <add> <add> Runnable r2 = new Runnable() { <add> @Override <add> public void run() { <add> s.request(0); <add> } <add> }; <add> <add> TestHelper.race(r1, r2); <add> <add> if (ts.valueCount() == 0) { <add> ts.assertFailure(IllegalArgumentException.class); <add> } else { <add> ts.assertValue(1).assertNoErrors().assertNotComplete(); <add> } <add> } <add> } <ide> } <ide><path>src/test/java/io/reactivex/internal/operators/flowable/FlowableTakeLastOneTest.java <ide> import org.junit.Test; <ide> <ide> import io.reactivex.*; <del>import io.reactivex.Flowable; <add>import io.reactivex.exceptions.TestException; <ide> import io.reactivex.functions.*; <ide> import io.reactivex.subscribers.*; <ide> <ide> public Flowable<Object> apply(Flowable<Object> f) throws Exception { <ide> }); <ide> } <ide> <add> @Test <add> public void error() { <add> Flowable.error(new TestException()) <add> .takeLast(1) <add> .test() <add> .assertFailure(TestException.class); <add> } <ide> } <ide><path>src/test/java/io/reactivex/internal/operators/flowable/FlowableZipTest.java <ide> package io.reactivex.internal.operators.flowable; <ide> <ide> import static org.junit.Assert.*; <add>import static org.mockito.ArgumentMatchers.*; <ide> import static org.mockito.Mockito.*; <ide> <ide> import java.lang.reflect.*; <ide> import org.reactivestreams.*; <ide> <ide> import io.reactivex.*; <del>import io.reactivex.Flowable; <ide> import io.reactivex.exceptions.*; <ide> import io.reactivex.functions.*; <ide> import io.reactivex.internal.functions.Functions; <add>import io.reactivex.internal.fuseable.QueueSubscription; <ide> import io.reactivex.internal.subscriptions.BooleanSubscription; <ide> import io.reactivex.plugins.RxJavaPlugins; <ide> import io.reactivex.processors.PublishProcessor; <ide> public List<Object> apply(Object t1, Object t2) throws Exception { <ide> assertTrue(list.toString(), list.contains("RxCo")); <ide> } <ide> } <add> <add> static final class ThrowingQueueSubscription implements QueueSubscription<Integer>, Publisher<Integer> { <add> <add> @Override <add> public int requestFusion(int mode) { <add> return mode & SYNC; <add> } <add> <add> @Override <add> public boolean offer(Integer value) { <add> throw new UnsupportedOperationException(); <add> } <add> <add> @Override <add> public boolean offer(Integer v1, Integer v2) { <add> throw new UnsupportedOperationException(); <add> } <add> <add> @Override <add> public Integer poll() throws Exception { <add> throw new TestException(); <add> } <add> <add> @Override <add> public boolean isEmpty() { <add> return false; <add> } <add> <add> @Override <add> public void clear() { <add> } <add> <add> @Override <add> public void request(long n) { <add> } <add> <add> @Override <add> public void cancel() { <add> } <add> <add> @Override <add> public void subscribe(Subscriber<? super Integer> s) { <add> s.onSubscribe(this); <add> } <add> } <add> <add> @Test <add> public void fusedInputThrows2() { <add> Flowable.zip(new ThrowingQueueSubscription(), Flowable.just(1), new BiFunction<Integer, Integer, Integer>() { <add> @Override <add> public Integer apply(Integer a, Integer b) throws Exception { <add> return a + b; <add> } <add> }) <add> .test() <add> .assertFailure(TestException.class); <add> } <add> <add> @Test <add> public void fusedInputThrows2Backpressured() { <add> Flowable.zip(new ThrowingQueueSubscription(), Flowable.just(1), new BiFunction<Integer, Integer, Integer>() { <add> @Override <add> public Integer apply(Integer a, Integer b) throws Exception { <add> return a + b; <add> } <add> }) <add> .test(0) <add> .assertFailure(TestException.class); <add> } <add> <add> @Test <add> public void cancelOnBackpressureBoundary() { <add> TestSubscriber<Integer> ts = new TestSubscriber<Integer>(1L) { <add> @Override <add> public void onNext(Integer t) { <add> super.onNext(t); <add> cancel(); <add> onComplete(); <add> } <add> }; <add> <add> Flowable.zip(Flowable.range(1, 2), Flowable.range(3, 2), new BiFunction<Integer, Integer, Integer>() { <add> @Override <add> public Integer apply(Integer a, Integer b) throws Exception { <add> return a + b; <add> } <add> }) <add> .subscribe(ts); <add> <add> ts.assertResult(4); <add> } <ide> } <ide><path>src/test/java/io/reactivex/internal/operators/maybe/MaybeConcatPublisherTest.java <add>/** <add> * Copyright (c) 2016-present, RxJava Contributors. <add> * <add> * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in <add> * compliance with the License. You may obtain a copy of the License at <add> * <add> * http://www.apache.org/licenses/LICENSE-2.0 <add> * <add> * Unless required by applicable law or agreed to in writing, software distributed under the License is <add> * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See <add> * the License for the specific language governing permissions and limitations under the License. <add> */ <add>package io.reactivex.internal.operators.maybe; <add> <add>import java.util.concurrent.Callable; <add> <add>import org.junit.Test; <add> <add>import io.reactivex.*; <add> <add>public class MaybeConcatPublisherTest { <add> <add> @Test <add> public void scalar() { <add> Maybe.concat(Flowable.just(Maybe.just(1))) <add> .test() <add> .assertResult(1); <add> } <add> <add> @Test <add> public void callable() { <add> Maybe.concat(Flowable.fromCallable(new Callable<Maybe<Integer>>() { <add> @Override <add> public Maybe<Integer> call() throws Exception { <add> return Maybe.just(1); <add> } <add> })) <add> .test() <add> .assertResult(1); <add> } <add>} <ide><path>src/test/java/io/reactivex/internal/operators/single/SingleConcatPublisherTest.java <add>/** <add> * Copyright (c) 2016-present, RxJava Contributors. <add> * <add> * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in <add> * compliance with the License. You may obtain a copy of the License at <add> * <add> * http://www.apache.org/licenses/LICENSE-2.0 <add> * <add> * Unless required by applicable law or agreed to in writing, software distributed under the License is <add> * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See <add> * the License for the specific language governing permissions and limitations under the License. <add> */ <add>package io.reactivex.internal.operators.single; <add> <add>import java.util.concurrent.Callable; <add> <add>import org.junit.Test; <add> <add>import io.reactivex.*; <add> <add>public class SingleConcatPublisherTest { <add> <add> @Test <add> public void scalar() { <add> Single.concat(Flowable.just(Single.just(1))) <add> .test() <add> .assertResult(1); <add> } <add> <add> @Test <add> public void callable() { <add> Single.concat(Flowable.fromCallable(new Callable<Single<Integer>>() { <add> @Override <add> public Single<Integer> call() throws Exception { <add> return Single.just(1); <add> } <add> })) <add> .test() <add> .assertResult(1); <add> } <add>} <ide><path>src/test/java/io/reactivex/internal/subscribers/FutureSubscriberTest.java <ide> public void onNextThenOnCompleteTwice() throws Exception { <ide> <ide> assertEquals(1, fs.get(5, TimeUnit.MILLISECONDS).intValue()); <ide> } <add> <add> @Test <add> public void completeAsync() throws Exception { <add> Schedulers.single().scheduleDirect(new Runnable() { <add> @Override <add> public void run() { <add> fs.onNext(1); <add> fs.onComplete(); <add> } <add> }, 500, TimeUnit.MILLISECONDS); <add> <add> assertEquals(1, fs.get().intValue()); <add> } <ide> } <ide><path>src/test/java/io/reactivex/internal/subscribers/SubscriberResourceWrapperTest.java <add>/** <add> * Copyright (c) 2016-present, RxJava Contributors. <add> * <add> * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in <add> * compliance with the License. You may obtain a copy of the License at <add> * <add> * http://www.apache.org/licenses/LICENSE-2.0 <add> * <add> * Unless required by applicable law or agreed to in writing, software distributed under the License is <add> * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See <add> * the License for the specific language governing permissions and limitations under the License. <add> */ <add> <add>package io.reactivex.internal.subscribers; <add> <add>import static org.junit.Assert.*; <add> <add>import org.junit.Test; <add> <add>import io.reactivex.disposables.*; <add>import io.reactivex.exceptions.TestException; <add>import io.reactivex.internal.subscriptions.BooleanSubscription; <add>import io.reactivex.subscribers.TestSubscriber; <add> <add>public class SubscriberResourceWrapperTest { <add> <add> TestSubscriber<Integer> ts = new TestSubscriber<Integer>(); <add> <add> SubscriberResourceWrapper<Integer> s = new SubscriberResourceWrapper<Integer>(ts); <add> <add> @Test <add> public void cancel() { <add> BooleanSubscription bs = new BooleanSubscription(); <add> Disposable d = Disposables.empty(); <add> <add> s.setResource(d); <add> <add> s.onSubscribe(bs); <add> <add> assertFalse(d.isDisposed()); <add> assertFalse(s.isDisposed()); <add> <add> ts.cancel(); <add> <add> assertTrue(bs.isCancelled()); <add> assertTrue(d.isDisposed()); <add> assertTrue(s.isDisposed()); <add> } <add> <add> @Test <add> public void error() { <add> BooleanSubscription bs = new BooleanSubscription(); <add> Disposable d = Disposables.empty(); <add> <add> s.setResource(d); <add> <add> s.onSubscribe(bs); <add> <add> s.onError(new TestException()); <add> <add> assertTrue(d.isDisposed()); <add> assertFalse(bs.isCancelled()); <add> <add> ts.assertFailure(TestException.class); <add> } <add> <add> @Test <add> public void complete() { <add> BooleanSubscription bs = new BooleanSubscription(); <add> Disposable d = Disposables.empty(); <add> <add> s.setResource(d); <add> <add> s.onSubscribe(bs); <add> <add> s.onComplete(); <add> <add> assertTrue(d.isDisposed()); <add> assertFalse(bs.isCancelled()); <add> <add> ts.assertResult(); <add> } <add>} <ide><path>src/test/java/io/reactivex/internal/util/QueueDrainHelperTest.java <add>/** <add> * Copyright (c) 2016-present, RxJava Contributors. <add> * <add> * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in <add> * compliance with the License. You may obtain a copy of the License at <add> * <add> * http://www.apache.org/licenses/LICENSE-2.0 <add> * <add> * Unless required by applicable law or agreed to in writing, software distributed under the License is <add> * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See <add> * the License for the specific language governing permissions and limitations under the License. <add> */ <add> <add>package io.reactivex.internal.util; <add> <add>import static org.junit.Assert.*; <add> <add>import java.io.IOException; <add>import java.util.ArrayDeque; <add>import java.util.concurrent.atomic.AtomicLong; <add> <add>import org.junit.Test; <add>import org.reactivestreams.Subscription; <add> <add>import io.reactivex.TestHelper; <add>import io.reactivex.functions.BooleanSupplier; <add>import io.reactivex.internal.subscriptions.BooleanSubscription; <add>import io.reactivex.subscribers.TestSubscriber; <add> <add>public class QueueDrainHelperTest { <add> <add> @Test <add> public void isCancelled() { <add> assertTrue(QueueDrainHelper.isCancelled(new BooleanSupplier() { <add> @Override <add> public boolean getAsBoolean() throws Exception { <add> throw new IOException(); <add> } <add> })); <add> } <add> <add> @Test <add> public void requestMaxInt() { <add> QueueDrainHelper.request(new Subscription() { <add> @Override <add> public void request(long n) { <add> assertEquals(Integer.MAX_VALUE, n); <add> } <add> <add> @Override <add> public void cancel() { <add> } <add> }, Integer.MAX_VALUE); <add> } <add> <add> @Test <add> public void requestMinInt() { <add> QueueDrainHelper.request(new Subscription() { <add> @Override <add> public void request(long n) { <add> assertEquals(Long.MAX_VALUE, n); <add> } <add> <add> @Override <add> public void cancel() { <add> } <add> }, Integer.MIN_VALUE); <add> } <add> <add> @Test <add> public void requestAlmostMaxInt() { <add> QueueDrainHelper.request(new Subscription() { <add> @Override <add> public void request(long n) { <add> assertEquals(Integer.MAX_VALUE - 1, n); <add> } <add> <add> @Override <add> public void cancel() { <add> } <add> }, Integer.MAX_VALUE - 1); <add> } <add> <add> @Test <add> public void postCompleteEmpty() { <add> TestSubscriber<Integer> ts = new TestSubscriber<Integer>(); <add> ArrayDeque<Integer> queue = new ArrayDeque<Integer>(); <add> AtomicLong state = new AtomicLong(); <add> BooleanSupplier isCancelled = new BooleanSupplier() { <add> @Override <add> public boolean getAsBoolean() throws Exception { <add> return false; <add> } <add> }; <add> <add> ts.onSubscribe(new BooleanSubscription()); <add> <add> QueueDrainHelper.postComplete(ts, queue, state, isCancelled); <add> <add> ts.assertResult(); <add> } <add> <add> @Test <add> public void postCompleteWithRequest() { <add> TestSubscriber<Integer> ts = new TestSubscriber<Integer>(); <add> ArrayDeque<Integer> queue = new ArrayDeque<Integer>(); <add> AtomicLong state = new AtomicLong(); <add> BooleanSupplier isCancelled = new BooleanSupplier() { <add> @Override <add> public boolean getAsBoolean() throws Exception { <add> return false; <add> } <add> }; <add> <add> ts.onSubscribe(new BooleanSubscription()); <add> queue.offer(1); <add> state.getAndIncrement(); <add> <add> QueueDrainHelper.postComplete(ts, queue, state, isCancelled); <add> <add> ts.assertResult(1); <add> } <add> <add> @Test <add> public void completeRequestRace() { <add> for (int i = 0; i < 500; i++) { <add> final TestSubscriber<Integer> ts = new TestSubscriber<Integer>(); <add> final ArrayDeque<Integer> queue = new ArrayDeque<Integer>(); <add> final AtomicLong state = new AtomicLong(); <add> final BooleanSupplier isCancelled = new BooleanSupplier() { <add> @Override <add> public boolean getAsBoolean() throws Exception { <add> return false; <add> } <add> }; <add> <add> ts.onSubscribe(new BooleanSubscription()); <add> queue.offer(1); <add> <add> Runnable r1 = new Runnable() { <add> @Override <add> public void run() { <add> QueueDrainHelper.postCompleteRequest(1, ts, queue, state, isCancelled); <add> } <add> }; <add> <add> Runnable r2 = new Runnable() { <add> @Override <add> public void run() { <add> QueueDrainHelper.postComplete(ts, queue, state, isCancelled); <add> } <add> }; <add> <add> TestHelper.race(r1, r2); <add> <add> ts.assertResult(1); <add> } <add> } <add> <add> @Test <add> public void postCompleteCancelled() { <add> final TestSubscriber<Integer> ts = new TestSubscriber<Integer>(); <add> ArrayDeque<Integer> queue = new ArrayDeque<Integer>(); <add> AtomicLong state = new AtomicLong(); <add> BooleanSupplier isCancelled = new BooleanSupplier() { <add> @Override <add> public boolean getAsBoolean() throws Exception { <add> return ts.isCancelled(); <add> } <add> }; <add> <add> ts.onSubscribe(new BooleanSubscription()); <add> queue.offer(1); <add> state.getAndIncrement(); <add> ts.cancel(); <add> <add> QueueDrainHelper.postComplete(ts, queue, state, isCancelled); <add> <add> ts.assertEmpty(); <add> } <add> <add> @Test <add> public void postCompleteCancelledAfterOne() { <add> final TestSubscriber<Integer> ts = new TestSubscriber<Integer>() { <add> @Override <add> public void onNext(Integer t) { <add> super.onNext(t); <add> cancel(); <add> } <add> }; <add> ArrayDeque<Integer> queue = new ArrayDeque<Integer>(); <add> AtomicLong state = new AtomicLong(); <add> BooleanSupplier isCancelled = new BooleanSupplier() { <add> @Override <add> public boolean getAsBoolean() throws Exception { <add> return ts.isCancelled(); <add> } <add> }; <add> <add> ts.onSubscribe(new BooleanSubscription()); <add> queue.offer(1); <add> state.getAndIncrement(); <add> <add> QueueDrainHelper.postComplete(ts, queue, state, isCancelled); <add> <add> ts.assertValue(1).assertNoErrors().assertNotComplete(); <add> } <add>}
24
Text
Text
fix casing for github in the contributing guide
64c86623ee7c0d175b3344178fc222d67318ac81
<ide><path>CONTRIBUTING.md <ide> If you have a question, check StackOverflow using <ide> Find an existing discussion or start a new one if necessary. <ide> <ide> If you suspect an issue, perform a search in the <del>[Github issue tracker](https://github.com/spring-projects/spring-framework/issues), using a few different keywords. <add>[GitHub issue tracker](https://github.com/spring-projects/spring-framework/issues), using a few different keywords. <ide> When you find related issues and discussions, prior or current, it helps you to learn and <ide> it helps us to make a decision. <ide> <ide> Before you create a ticket, please take the time to [research first](#discuss). <ide> <ide> If creating a ticket after a discussion on StackOverflow, please provide a self-sufficient description in the ticket, independent of the details on StackOverview. We understand this is extra work but the issue tracker is an important place of record for design discussions and decisions that can often be referenced long after the fix version, for example to revisit decisions, to understand the origin of a feature, and so on. <ide> <del>When ready create a ticket in the [Github issue tracker](https://github.com/spring-projects/spring-framework/issues). <add>When ready create a ticket in the [GitHub issue tracker](https://github.com/spring-projects/spring-framework/issues). <ide> <ide> #### Ticket Lifecycle <ide>
1
Text
Text
update directions in for html/css quiz
25af8f9ee9f478d7193cf28fcb2b6c7f761c6096
<ide><path>curriculum/challenges/english/14-responsive-web-design-22/learn-accessibility-by-building-a-quiz/6140827cff96e906bd38fc2b.md <ide> dashedName: step-9 <ide> <ide> # --description-- <ide> <del>As described in the [freeCodeCamp Style Guide](https://design-style-guide.freecodecamp.org/), the logo should retain an aspect ratio of `35:4`, and have padding around the text. <add>As described in the [freeCodeCamp Style Guide](https://design-style-guide.freecodecamp.org/), the logo should retain an aspect ratio of `35 / 4`, and have padding around the text. <ide> <del>First, change the `background-color` to `#0a0a23` so you can see the logo. Then, use the `aspect-ratio` property to set the desired aspect ratio. Finally, add a `padding` of `0.4rem` all around. <add>First, change the `background-color` to `#0a0a23` so you can see the logo. Then, use the `aspect-ratio` property to set the desired aspect ratio to `35 / 4`. Finally, add a `padding` of `0.4rem` all around. <ide> <ide> # --hints-- <ide>
1
Ruby
Ruby
add assertion helpers for active job integration
b6b2001f51e46c63e992d819a7f0492b789373fc
<ide><path>activejob/test/integration/queuing_test.rb <ide> class QueuingTest < ActiveSupport::TestCase <ide> test "should run jobs enqueued on a listening queue" do <ide> TestJob.perform_later @id <ide> wait_for_jobs_to_finish_for(5.seconds) <del> assert job_executed <add> assert_job_executed <ide> end <ide> <ide> test "should not run jobs queued on a non-listening queue" do <ide> class QueuingTest < ActiveSupport::TestCase <ide> TestJob.queue_as :some_other_queue <ide> TestJob.perform_later @id <ide> wait_for_jobs_to_finish_for(2.seconds) <del> assert_not job_executed <add> assert_job_not_executed <ide> ensure <ide> TestJob.queue_name = old_queue <ide> end <ide> class QueuingTest < ActiveSupport::TestCase <ide> test "should not run job enqueued in the future" do <ide> TestJob.set(wait: 10.minutes).perform_later @id <ide> wait_for_jobs_to_finish_for(5.seconds) <del> assert_not job_executed <add> assert_job_not_executed <ide> rescue NotImplementedError <ide> skip <ide> end <ide> <ide> test "should run job enqueued in the future at the specified time" do <ide> TestJob.set(wait: 5.seconds).perform_later @id <ide> wait_for_jobs_to_finish_for(2.seconds) <del> assert_not job_executed <add> assert_job_not_executed <ide> wait_for_jobs_to_finish_for(10.seconds) <del> assert job_executed <add> assert_job_executed <ide> rescue NotImplementedError <ide> skip <ide> end <ide> class QueuingTest < ActiveSupport::TestCase <ide> <ide> TestJob.perform_later @id <ide> wait_for_jobs_to_finish_for(5.seconds) <del> assert job_executed <add> assert_job_executed <ide> assert_equal "de", job_executed_in_locale <ide> ensure <ide> I18n.available_locales = [:en] <ide> class QueuingTest < ActiveSupport::TestCase <ide> <ide> TestJob.perform_later @id <ide> wait_for_jobs_to_finish_for(5.seconds) <del> assert job_executed <add> assert_job_executed <ide> assert_equal "Hawaii", job_executed_in_timezone <ide> ensure <ide> Time.zone = current_zone <ide> class QueuingTest < ActiveSupport::TestCase <ide> TestJob.set(wait_until: wait_until, priority: 20).perform_later "#{@id}.1" <ide> TestJob.set(wait_until: wait_until, priority: 10).perform_later "#{@id}.2" <ide> wait_for_jobs_to_finish_for(10.seconds) <del> assert job_executed "#{@id}.1" <del> assert job_executed "#{@id}.2" <del> assert job_executed_at("#{@id}.2") < job_executed_at("#{@id}.1") <add> assert_job_executed "#{@id}.1" <add> assert_job_executed "#{@id}.2" <add> assert_job_executed_before("#{@id}.2", "#{@id}.1") <ide> end <ide> <ide> test "should run job with higher priority first in Backburner" do <ide> class QueuingTest < ActiveSupport::TestCase <ide> TestJob.set(priority: 20).perform_later "#{@id}.1" <ide> TestJob.set(priority: 10).perform_later "#{@id}.2" <ide> wait_for_jobs_to_finish_for(10.seconds) <del> assert job_executed "#{@id}.1" <del> assert job_executed "#{@id}.2" <del> assert job_executed_at("#{@id}.2") < job_executed_at("#{@id}.1") <add> assert_job_executed "#{@id}.1" <add> assert_job_executed "#{@id}.2" <add> assert_job_executed_before("#{@id}.2", "#{@id}.1") <ide> end <add> <add> private <add> def assert_job_executed(id = @id) <add> assert job_executed(id), "Job #{id} was not executed" <add> end <add> <add> def assert_job_not_executed(id = @id) <add> assert_not job_executed(id), "Job #{id} was executed" <add> end <add> <add> def assert_job_executed_before(first_id, second_id) <add> assert job_executed_at(first_id) < job_executed_at(second_id), "Job #{first_id} was not executed before Job #{second_id}" <add> end <ide> end
1
Javascript
Javascript
add another nexttick benchmark
c6347dcfb43273214dc872e60c8cd94a93fee027
<ide><path>benchmark/next-tick-2.js <add>// Copyright Joyent, Inc. and other Node contributors. <add>// <add>// Permission is hereby granted, free of charge, to any person obtaining a <add>// copy of this software and associated documentation files (the <add>// "Software"), to deal in the Software without restriction, including <add>// without limitation the rights to use, copy, modify, merge, publish, <add>// distribute, sublicense, and/or sell copies of the Software, and to permit <add>// persons to whom the Software is furnished to do so, subject to the <add>// following conditions: <add>// <add>// The above copyright notice and this permission notice shall be included <add>// in all copies or substantial portions of the Software. <add>// <add>// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS <add>// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF <add>// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN <add>// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, <add>// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR <add>// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE <add>// USE OR OTHER DEALINGS IN THE SOFTWARE. <add> <add>var count = 2e6, <add> left = count, <add> start; <add> <add>function onNextTick() { <add> if (--left) { <add> process.nextTick(onNextTick); <add> } else { <add> finalize(); <add> } <add>} <add> <add>function finalize() { <add> var duration = (new Date()).getTime() - start, <add> ticksPerSec = count / duration * 1000; <add> console.log("nextTick callbacks per second: " + Math.round(ticksPerSec)); <add>} <add> <add>start = (new Date()).getTime(); <add>process.nextTick(onNextTick);
1
Javascript
Javascript
fix priority value mentioned in the docs
f3884df0a90c35945e9137562e39506b290f5be2
<ide><path>src/ng/directive/ngController.js <ide> * <ide> * @element ANY <ide> * @scope <add> * @priority 500 <ide> * @param {expression} ngController Name of a constructor function registered with the current <ide> * {@link ng.$controllerProvider $controllerProvider} or an {@link guide/expression expression} <ide> * that on the current scope evaluates to a constructor function.
1
PHP
PHP
fix scheduling\event tests on windows
f3a216471239bc112b91f3d5ae2ccce7b3e9b706
<ide><path>tests/Console/Scheduling/EventTest.php <ide> class EventTest extends PHPUnit_Framework_TestCase <ide> { <ide> public function testBuildCommand() <ide> { <add> $quote = (DIRECTORY_SEPARATOR == '\\') ? '"' : "'"; <add> <ide> $event = new Event('php -i'); <ide> <ide> $defaultOutput = (DIRECTORY_SEPARATOR == '\\') ? 'NUL' : '/dev/null'; <del> $this->assertSame("php -i > '{$defaultOutput}' 2>&1 &", $event->buildCommand()); <add> $this->assertSame("php -i > {$quote}{$defaultOutput}{$quote} 2>&1 &", $event->buildCommand()); <ide> } <ide> <ide> public function testBuildCommandSendOutputTo() <ide> { <add> $quote = (DIRECTORY_SEPARATOR == '\\') ? '"' : "'"; <add> <ide> $event = new Event('php -i'); <ide> <ide> $event->sendOutputTo('/dev/null'); <del> $this->assertSame("php -i > '/dev/null' 2>&1 &", $event->buildCommand()); <add> $this->assertSame("php -i > {$quote}/dev/null{$quote} 2>&1 &", $event->buildCommand()); <ide> <ide> $event = new Event('php -i'); <ide> <ide> $event->sendOutputTo('/my folder/foo.log'); <del> $this->assertSame("php -i > '/my folder/foo.log' 2>&1 &", $event->buildCommand()); <add> $this->assertSame("php -i > {$quote}/my folder/foo.log{$quote} 2>&1 &", $event->buildCommand()); <ide> } <ide> <ide> public function testBuildCommandAppendOutput() <ide> { <add> $quote = (DIRECTORY_SEPARATOR == '\\') ? '"' : "'"; <add> <ide> $event = new Event('php -i'); <ide> <ide> $event->appendOutputTo('/dev/null'); <del> $this->assertSame("php -i >> '/dev/null' 2>&1 &", $event->buildCommand()); <add> $this->assertSame("php -i >> {$quote}/dev/null{$quote} 2>&1 &", $event->buildCommand()); <ide> } <ide> <ide> /**
1
Javascript
Javascript
simplify unique titles test
5e53ebded96b3a3668303f1373ae0b58d54cf5d8
<ide><path>challengeTitles.js <ide> class ChallengeTitles { <ide> } <ide> check(title) { <ide> if (typeof title !== 'string') { <del> throw new Error(`Expected a valid string for ${title}, got ${typeof title}`); <add> throw new Error(`Expected a valid string for ${title}, but got a(n) ${typeof title}`); <ide> } else if (title.length === 0) { <ide> throw new Error(`Expected a title length greater than 0`); <ide> } <ide> const titleToCheck = title.toLowerCase().replace(/\s+/g, ''); <del> const titleIndex = _.findIndex(this.knownTitles, existing => titleToCheck === existing); <del> if (titleIndex !== -1) { <add> const isKnown = this.knownTitles.includes(titleToCheck); <add> if (isKnown) { <ide> throw new Error(` <ide> All challenges must have a unique title. <ide>
1
Ruby
Ruby
mark some methods as nodoc
0abd0b54f06c8dc448846e0dc1b287ee4f957868
<ide><path>activerecord/lib/active_record/core.rb <ide> def allocate <ide> super <ide> end <ide> <del> def initialize_find_by_cache <add> def initialize_find_by_cache # :nodoc: <ide> self.find_by_statement_cache = {}.extend(Mutex_m) <ide> end <ide> <del> def inherited(child_class) <add> def inherited(child_class) # :nodoc: <ide> child_class.initialize_find_by_cache <ide> super <ide> end <ide> <del> def find(*ids) <add> def find(*ids) # :nodoc: <ide> # We don't have cache keys for this stuff yet <ide> return super unless ids.length == 1 <ide> return super if block_given? || <ide> def find(*ids) <ide> raise RecordNotFound, "Couldn't find #{name} with an out of range value for '#{primary_key}'" <ide> end <ide> <del> def find_by(*args) <add> def find_by(*args) # :nodoc: <ide> return super if current_scope || !(Hash === args.first) || reflect_on_all_aggregations.any? <ide> return super if default_scopes.any? <ide> <ide> def find_by(*args) <ide> end <ide> end <ide> <del> def find_by!(*args) <add> def find_by!(*args) # :nodoc: <ide> find_by(*args) or raise RecordNotFound.new("Couldn't find #{name}") <ide> end <ide> <del> def initialize_generated_modules <add> def initialize_generated_modules # :nodoc: <ide> generated_association_methods <ide> end <ide>
1
Javascript
Javascript
keep commons chunk in mind when optimizing
153be562db11e3bff9a2bdfa3456efdccf50ac3b
<ide><path>lib/Chunk.js <ide> Chunk.prototype.size = function(options) { <ide> }).reduce(function(a, b) { <ide> return a + b; <ide> }, 0); <del> return modulesSize * (this.entry ? ENTRY_CHUNK_MULTIPLICATOR : 1) + CHUNK_OVERHEAD; <add> return modulesSize * (this.id === 0 ? ENTRY_CHUNK_MULTIPLICATOR : 1) + CHUNK_OVERHEAD; <ide> }; <ide> <ide> Chunk.prototype.integratedSize = function(other, options) { <ide> Chunk.prototype.integratedSize = function(other, options) { <ide> }).reduce(function(a, b) { <ide> return a + b; <ide> }, 0); <del> return modulesSize * (this.entry || other.entry ? ENTRY_CHUNK_MULTIPLICATOR : 1) + CHUNK_OVERHEAD; <add> return modulesSize * (this.id === 0 || other.id === 0 ? ENTRY_CHUNK_MULTIPLICATOR : 1) + CHUNK_OVERHEAD; <ide> }; <ide> <ide> Chunk.prototype.toString = function() { <ide><path>lib/optimize/OccurenceOrderPlugin.js <ide> OccurenceOrderPlugin.prototype.apply = function(compiler) { <ide> compilation.plugin("optimize-module-order", function(modules) { <ide> function entryChunks(m) { <ide> return m.chunks.filter(function(c) { <del> return c.entry; <add> return c.id === 0; <ide> }).length; <ide> } <ide> function occursInEntry(m) { <ide> OccurenceOrderPlugin.prototype.apply = function(compiler) { <ide> compilation.plugin("optimize-chunk-order", function(chunks) { <ide> function occursInEntry(c) { <ide> return c.parents.filter(function(p) { <del> return p.entry; <add> return p.id === 0; <ide> }).length; <ide> } <ide> function occurs(c) {
2
Python
Python
update exception style, easy ones
cfd766456368777bcb0d5edabd360b3aeb02d3f8
<ide><path>numpy/core/defchararray.py <ide> def multiply(a, i): <ide> a_arr = numpy.asarray(a) <ide> i_arr = numpy.asarray(i) <ide> if not issubclass(i_arr.dtype.type, integer): <del> raise ValueError, "Can only multiply by integers" <add> raise ValueError("Can only multiply by integers") <ide> out_size = _get_num_chars(a_arr) * max(long(i_arr.max()), 0) <ide> return _vec_string( <ide> a_arr, (a_arr.dtype.type, out_size), '__mul__', (i_arr,)) <ide> def isnumeric(a): <ide> unicode.isnumeric <ide> """ <ide> if _use_unicode(a) != unicode_: <del> raise TypeError, "isnumeric is only available for Unicode strings and arrays" <add> raise TypeError("isnumeric is only available for Unicode strings and arrays") <ide> return _vec_string(a, bool_, 'isnumeric') <ide> <ide> def isdecimal(a): <ide> def isdecimal(a): <ide> unicode.isdecimal <ide> """ <ide> if _use_unicode(a) != unicode_: <del> raise TypeError, "isnumeric is only available for Unicode strings and arrays" <add> raise TypeError("isnumeric is only available for Unicode strings and arrays") <ide> return _vec_string(a, bool_, 'isdecimal') <ide> <ide> <ide> def __new__(subtype, shape, itemsize=1, unicode=False, buffer=None, <ide> def __array_finalize__(self, obj): <ide> # The b is a special case because it is used for reconstructing. <ide> if not _globalvar and self.dtype.char not in 'SUbc': <del> raise ValueError, "Can only create a chararray from string data." <add> raise ValueError("Can only create a chararray from string data.") <ide> <ide> def __getitem__(self, obj): <ide> val = ndarray.__getitem__(self, obj) <ide><path>numpy/core/memmap.py <ide> def __new__(subtype, filename, dtype=uint8, mode='r+', offset=0, <ide> fid = open(filename, (mode == 'c' and 'r' or mode)+'b') <ide> <ide> if (mode == 'w+') and shape is None: <del> raise ValueError, "shape must be given" <add> raise ValueError("shape must be given") <ide> <ide> fid.seek(0, 2) <ide> flen = fid.tell() <ide><path>numpy/core/numeric.py <ide> def tensordot(a, b, axes=2): <ide> if axes_b[k] < 0: <ide> axes_b[k] += ndb <ide> if not equal: <del> raise ValueError, "shape-mismatch for sum" <add> raise ValueError("shape-mismatch for sum") <ide> <ide> # Move the axes to sum over to the end of "a" <ide> # and to the front of "b" <ide> def seterrcall(func): <ide> """ <ide> if func is not None and not callable(func): <ide> if not hasattr(func, 'write') or not callable(func.write): <del> raise ValueError, "Only callable can be used as callback" <add> raise ValueError("Only callable can be used as callback") <ide> pyvals = umath.geterrobj() <ide> old = geterrcall() <ide> pyvals[2] = func <ide><path>numpy/core/numerictypes.py <ide> def sctype2char(sctype): <ide> """ <ide> sctype = obj2sctype(sctype) <ide> if sctype is None: <del> raise ValueError, "unrecognized type" <add> raise ValueError("unrecognized type") <ide> return _sctype2char_dict[sctype] <ide> <ide> # Create dictionary of casting functions that wrap sequences <ide><path>numpy/core/records.py <ide> def _parseFormats(self, formats, aligned=0): <ide> """ Parse the field formats """ <ide> <ide> if formats is None: <del> raise ValueError, "Need formats argument" <add> raise ValueError("Need formats argument") <ide> if isinstance(formats, list): <ide> if len(formats) < 2: <ide> formats.append('') <ide> def fromarrays(arrayList, dtype=None, shape=None, formats=None, <ide> formats = '' <ide> for obj in arrayList: <ide> if not isinstance(obj, ndarray): <del> raise ValueError, "item in the array list must be an ndarray." <add> raise ValueError("item in the array list must be an ndarray.") <ide> formats += _typestr[obj.dtype.type] <ide> if issubclass(obj.dtype.type, nt.flexible): <ide> formats += `obj.itemsize` <ide> def fromrecords(recList, dtype=None, shape=None, formats=None, names=None, <ide> if isinstance(shape, (int, long)): <ide> shape = (shape,) <ide> if len(shape) > 1: <del> raise ValueError, "Can only deal with 1-d array." <add> raise ValueError("Can only deal with 1-d array.") <ide> _array = recarray(shape, descr) <ide> for k in xrange(_array.size): <ide> _array[k] = tuple(recList[k]) <ide> def fromstring(datastring, dtype=None, shape=None, offset=0, formats=None, <ide> <ide> <ide> if dtype is None and formats is None: <del> raise ValueError, "Must have dtype= or formats=" <add> raise ValueError("Must have dtype= or formats=") <ide> <ide> if dtype is not None: <ide> descr = sb.dtype(dtype) <ide><path>numpy/ctypeslib.py <ide> def _dummy(*args, **kwds): <ide> If ctypes is not available. <ide> <ide> """ <del> raise ImportError, "ctypes is not available." <add> raise ImportError("ctypes is not available.") <ide> ctypes_load_library = _dummy <ide> load_library = _dummy <ide> as_ctypes = _dummy <ide> def __array_interface__(self): <ide> @classmethod <ide> def from_param(cls, obj): <ide> if not isinstance(obj, ndarray): <del> raise TypeError, "argument must be an ndarray" <add> raise TypeError("argument must be an ndarray") <ide> if cls._dtype_ is not None \ <ide> and obj.dtype != cls._dtype_: <ide> raise TypeError, "array must have data type %s" % cls._dtype_ <ide> def ndpointer(dtype=None, ndim=None, shape=None, flags=None): <ide> try: <ide> flags = [x.strip().upper() for x in flags] <ide> except: <del> raise TypeError, "invalid flags specification" <add> raise TypeError("invalid flags specification") <ide> num = _num_fromflags(flags) <ide> try: <ide> return _pointer_type_cache[(dtype, ndim, shape, num)] <ide><path>numpy/f2py/tests/test_array_from_pyobj.py <ide> def test_inout_2seq(self): <ide> if not str(msg).startswith('failed to initialize intent(inout|inplace|cache) array'): <ide> raise <ide> else: <del> raise SystemError,'intent(inout) should have failed on sequence' <add> raise SystemError('intent(inout) should have failed on sequence') <ide> <ide> def test_f_inout_23seq(self): <ide> obj = array(self.num23seq,dtype=self.type.dtype,order='F') <ide> def test_f_inout_23seq(self): <ide> if not str(msg).startswith('failed to initialize intent(inout) array'): <ide> raise <ide> else: <del> raise SystemError,'intent(inout) should have failed on improper array' <add> raise SystemError('intent(inout) should have failed on improper array') <ide> <ide> def test_c_inout_23seq(self): <ide> obj = array(self.num23seq,dtype=self.type.dtype) <ide> def test_in_cache_from_2casttype(self): <ide> if not str(msg).startswith('failed to initialize intent(cache) array'): <ide> raise <ide> else: <del> raise SystemError,'intent(cache) should have failed on multisegmented array' <add> raise SystemError('intent(cache) should have failed on multisegmented array') <ide> def test_in_cache_from_2casttype_failure(self): <ide> for t in self.type.all_types(): <ide> if t.elsize >= self.type.elsize: <ide> def test_in_cache_from_2casttype_failure(self): <ide> if not str(msg).startswith('failed to initialize intent(cache) array'): <ide> raise <ide> else: <del> raise SystemError,'intent(cache) should have failed on smaller array' <add> raise SystemError('intent(cache) should have failed on smaller array') <ide> <ide> def test_cache_hidden(self): <ide> shape = (2,) <ide> def test_cache_hidden(self): <ide> if not str(msg).startswith('failed to create intent(cache|hide)|optional array'): <ide> raise <ide> else: <del> raise SystemError,'intent(cache) should have failed on undefined dimensions' <add> raise SystemError('intent(cache) should have failed on undefined dimensions') <ide> <ide> def test_hidden(self): <ide> shape = (2,) <ide> def test_hidden(self): <ide> if not str(msg).startswith('failed to create intent(cache|hide)|optional array'): <ide> raise <ide> else: <del> raise SystemError,'intent(hide) should have failed on undefined dimensions' <add> raise SystemError('intent(hide) should have failed on undefined dimensions') <ide> <ide> def test_optional_none(self): <ide> shape = (2,) <ide><path>numpy/fft/fftpack.py <ide> def _cook_nd_args(a, s=None, axes=None, invreal=0): <ide> if axes is None: <ide> axes = range(-len(s), 0) <ide> if len(s) != len(axes): <del> raise ValueError, "Shape and axes have different lengths." <add> raise ValueError("Shape and axes have different lengths.") <ide> if invreal and shapeless: <ide> s[axes[-1]] = (s[axes[-1]] - 1) * 2 <ide> return s, axes <ide><path>numpy/lib/function_base.py <ide> def _compute_qth_percentile(sorted, q, axis, out): <ide> <ide> q = q / 100.0 <ide> if (q < 0) or (q > 1): <del> raise ValueError, "percentile must be either in the range [0,100]" <add> raise ValueError("percentile must be either in the range [0,100]") <ide> <ide> indexer = [slice(None)] * sorted.ndim <ide> Nx = sorted.shape[axis] <ide><path>numpy/lib/index_tricks.py <ide> def ix_(*args): <ide> for k in range(nd): <ide> new = _nx.asarray(args[k]) <ide> if (new.ndim != 1): <del> raise ValueError, "Cross index must be 1 dimensional" <add> raise ValueError("Cross index must be 1 dimensional") <ide> if issubclass(new.dtype.type, _nx.bool_): <ide> new = new.nonzero()[0] <ide> baseshape[k] = len(new) <ide> def __getitem__(self,key): <ide> trans1d = int(vec[2]) <ide> continue <ide> except: <del> raise ValueError, "unknown special directive" <add> raise ValueError("unknown special directive") <ide> try: <ide> self.axis = int(key[k]) <ide> continue <ide> except (ValueError, TypeError): <del> raise ValueError, "unknown special directive" <add> raise ValueError("unknown special directive") <ide> elif type(key[k]) in ScalarType: <ide> newobj = array(key[k],ndmin=ndmin) <ide> scalars.append(k) <ide><path>numpy/lib/npyio.py <ide> def seek(self, offset, whence=0): <ide> offset = self.offset + offset <ide> <ide> if whence not in [0, 1]: <del> raise IOError, "Illegal argument" <add> raise IOError("Illegal argument") <ide> <ide> if offset < self.offset: <ide> # for negative seek, rewind and do positive seek <ide><path>numpy/lib/polynomial.py <ide> def poly(seq_of_zeros): <ide> elif len(sh) == 1: <ide> pass <ide> else: <del> raise ValueError, "input must be 1d or square 2d array." <add> raise ValueError("input must be 1d or square 2d array.") <ide> <ide> if len(seq_of_zeros) == 0: <ide> return 1.0 <ide> def roots(p): <ide> # If input is scalar, this makes it an array <ide> p = atleast_1d(p) <ide> if len(p.shape) != 1: <del> raise ValueError,"Input must be a rank-1 array." <add> raise ValueError("Input must be a rank-1 array.") <ide> <ide> # find non-zero array entries <ide> non_zero = NX.nonzero(NX.ravel(p))[0] <ide> def polyint(p, m=1, k=None): <ide> """ <ide> m = int(m) <ide> if m < 0: <del> raise ValueError, "Order of integral must be positive (see polyder)" <add> raise ValueError("Order of integral must be positive (see polyder)") <ide> if k is None: <ide> k = NX.zeros(m, float) <ide> k = atleast_1d(k) <ide> def polyder(p, m=1): <ide> """ <ide> m = int(m) <ide> if m < 0: <del> raise ValueError, "Order of derivative must be positive (see polyint)" <add> raise ValueError("Order of derivative must be positive (see polyint)") <ide> <ide> truepoly = isinstance(p, poly1d) <ide> p = NX.asarray(p) <ide> def polyfit(x, y, deg, rcond=None, full=False): <ide> <ide> # check arguments. <ide> if deg < 0 : <del> raise ValueError, "expected deg >= 0" <add> raise ValueError("expected deg >= 0") <ide> if x.ndim != 1: <del> raise TypeError, "expected 1D vector for x" <add> raise TypeError("expected 1D vector for x") <ide> if x.size == 0: <del> raise TypeError, "expected non-empty vector for x" <add> raise TypeError("expected non-empty vector for x") <ide> if y.ndim < 1 or y.ndim > 2 : <del> raise TypeError, "expected 1D or 2D array for y" <add> raise TypeError("expected 1D or 2D array for y") <ide> if x.shape[0] != y.shape[0] : <del> raise TypeError, "expected x and y to have same length" <add> raise TypeError("expected x and y to have same length") <ide> <ide> # set rcond <ide> if rcond is None : <ide> def __init__(self, c_or_r, r=0, variable=None): <ide> c_or_r = poly(c_or_r) <ide> c_or_r = atleast_1d(c_or_r) <ide> if len(c_or_r.shape) > 1: <del> raise ValueError, "Polynomial must be 1d only." <add> raise ValueError("Polynomial must be 1d only.") <ide> c_or_r = trim_zeros(c_or_r, trim='f') <ide> if len(c_or_r) == 0: <ide> c_or_r = NX.array([0.]) <ide> def __radd__(self, other): <ide> <ide> def __pow__(self, val): <ide> if not isscalar(val) or int(val) != val or val < 0: <del> raise ValueError, "Power to non-negative integers only." <add> raise ValueError("Power to non-negative integers only.") <ide> res = [1] <ide> for _ in range(val): <ide> res = polymul(self.coeffs, res) <ide> def __ne__(self, other): <ide> return NX.any(self.coeffs != other.coeffs) <ide> <ide> def __setattr__(self, key, val): <del> raise ValueError, "Attributes cannot be changed this way." <add> raise ValueError("Attributes cannot be changed this way.") <ide> <ide> def __getattr__(self, key): <ide> if key in ['r', 'roots']: <ide> def __getitem__(self, val): <ide> def __setitem__(self, key, val): <ide> ind = self.order - key <ide> if key < 0: <del> raise ValueError, "Does not support negative powers." <add> raise ValueError("Does not support negative powers.") <ide> if key > self.order: <ide> zr = NX.zeros(key-self.order, self.coeffs.dtype) <ide> self.__dict__['coeffs'] = NX.concatenate((zr, self.coeffs)) <ide><path>numpy/lib/shape_base.py <ide> def array_split(ary,indices_or_sections,axis = 0): <ide> except TypeError: #indices_or_sections is a scalar, not an array. <ide> Nsections = int(indices_or_sections) <ide> if Nsections <= 0: <del> raise ValueError, 'number sections must be larger than 0.' <add> raise ValueError('number sections must be larger than 0.') <ide> Neach_section,extras = divmod(Ntotal,Nsections) <ide> section_sizes = [0] + \ <ide> extras * [Neach_section+1] + \ <ide> def split(ary,indices_or_sections,axis=0): <ide> sections = indices_or_sections <ide> N = ary.shape[axis] <ide> if N % sections: <del> raise ValueError, 'array split does not result in an equal division' <add> raise ValueError('array split does not result in an equal division') <ide> res = array_split(ary,indices_or_sections,axis) <ide> return res <ide> <ide> def hsplit(ary,indices_or_sections): <ide> <ide> """ <ide> if len(_nx.shape(ary)) == 0: <del> raise ValueError, 'hsplit only works on arrays of 1 or more dimensions' <add> raise ValueError('hsplit only works on arrays of 1 or more dimensions') <ide> if len(ary.shape) > 1: <ide> return split(ary,indices_or_sections,1) <ide> else: <ide> def vsplit(ary,indices_or_sections): <ide> <ide> """ <ide> if len(_nx.shape(ary)) < 2: <del> raise ValueError, 'vsplit only works on arrays of 2 or more dimensions' <add> raise ValueError('vsplit only works on arrays of 2 or more dimensions') <ide> return split(ary,indices_or_sections,0) <ide> <ide> def dsplit(ary,indices_or_sections): <ide> def dsplit(ary,indices_or_sections): <ide> <ide> """ <ide> if len(_nx.shape(ary)) < 3: <del> raise ValueError, 'vsplit only works on arrays of 3 or more dimensions' <add> raise ValueError('vsplit only works on arrays of 3 or more dimensions') <ide> return split(ary,indices_or_sections,2) <ide> <ide> def get_array_prepare(*args): <ide><path>numpy/lib/type_check.py <ide> def datetime_data(dtype): <ide> try: <ide> import ctypes <ide> except ImportError: <del> raise RuntimeError, "Cannot access date-time internals without ctypes installed" <add> raise RuntimeError("Cannot access date-time internals without ctypes installed") <ide> <ide> if dtype.kind not in ['m','M']: <del> raise ValueError, "Not a date-time dtype" <add> raise ValueError("Not a date-time dtype") <ide> <ide> obj = dtype.metadata[METADATA_DTSTR] <ide> class DATETIMEMETA(ctypes.Structure): <ide><path>numpy/lib/user_array.py <ide> def _scalarfunc(self, func): <ide> if len(self.shape) == 0: <ide> return func(self[0]) <ide> else: <del> raise TypeError, "only rank-0 arrays can be converted to Python scalars." <add> raise TypeError("only rank-0 arrays can be converted to Python scalars.") <ide> <ide> def __complex__(self): return self._scalarfunc(complex) <ide> def __float__(self): return self._scalarfunc(float) <ide><path>numpy/linalg/linalg.py <ide> class LinAlgError(Exception): <ide> in inv return wrap(solve(a, identity(a.shape[0], dtype=a.dtype))) <ide> File "...linalg.py", line 249, <ide> in solve <del> raise LinAlgError, 'Singular matrix' <add> raise LinAlgError('Singular matrix') <ide> numpy.linalg.linalg.LinAlgError: Singular matrix <ide> <ide> """ <ide> def _assertRank2(*arrays): <ide> def _assertSquareness(*arrays): <ide> for a in arrays: <ide> if max(a.shape) != min(a.shape): <del> raise LinAlgError, 'Array must be square' <add> raise LinAlgError('Array must be square') <ide> <ide> def _assertFinite(*arrays): <ide> for a in arrays: <ide> if not (isfinite(a).all()): <del> raise LinAlgError, "Array must not contain infs or NaNs" <add> raise LinAlgError("Array must not contain infs or NaNs") <ide> <ide> def _assertNonEmpty(*arrays): <ide> for a in arrays: <ide> def solve(a, b): <ide> n_eq = a.shape[0] <ide> n_rhs = b.shape[1] <ide> if n_eq != b.shape[0]: <del> raise LinAlgError, 'Incompatible dimensions' <add> raise LinAlgError('Incompatible dimensions') <ide> t, result_t = _commonType(a, b) <ide> # lapack_routine = _findLapackRoutine('gesv', t) <ide> if isComplexType(t): <ide> def solve(a, b): <ide> pivots = zeros(n_eq, fortran_int) <ide> results = lapack_routine(n_eq, n_rhs, a, n_eq, pivots, b, n_eq, 0) <ide> if results['info'] > 0: <del> raise LinAlgError, 'Singular matrix' <add> raise LinAlgError('Singular matrix') <ide> if one_eq: <ide> return wrap(b.ravel().astype(result_t)) <ide> else: <ide> def tensorinv(a, ind=2): <ide> for k in oldshape[ind:]: <ide> prod *= k <ide> else: <del> raise ValueError, "Invalid ind argument." <add> raise ValueError("Invalid ind argument.") <ide> a = a.reshape(prod, -1) <ide> ia = inv(a) <ide> return ia.reshape(*invshape) <ide> def eigvals(a): <ide> w = wr+1j*wi <ide> result_t = _complexType(result_t) <ide> if results['info'] > 0: <del> raise LinAlgError, 'Eigenvalues did not converge' <add> raise LinAlgError('Eigenvalues did not converge') <ide> return w.astype(result_t) <ide> <ide> <ide> def eigvalsh(a, UPLO='L'): <ide> results = lapack_routine(_N, UPLO, n, a, n, w, work, lwork, <ide> iwork, liwork, 0) <ide> if results['info'] > 0: <del> raise LinAlgError, 'Eigenvalues did not converge' <add> raise LinAlgError('Eigenvalues did not converge') <ide> return w.astype(result_t) <ide> <ide> def _convertarray(a): <ide> def eig(a): <ide> result_t = _complexType(result_t) <ide> <ide> if results['info'] > 0: <del> raise LinAlgError, 'Eigenvalues did not converge' <add> raise LinAlgError('Eigenvalues did not converge') <ide> vt = v.transpose().astype(result_t) <ide> return w.astype(result_t), wrap(vt) <ide> <ide> def eigh(a, UPLO='L'): <ide> results = lapack_routine(_V, UPLO, n, a, n, w, work, lwork, <ide> iwork, liwork, 0) <ide> if results['info'] > 0: <del> raise LinAlgError, 'Eigenvalues did not converge' <add> raise LinAlgError('Eigenvalues did not converge') <ide> at = a.transpose().astype(result_t) <ide> return w.astype(_realType(result_t)), wrap(at) <ide> <ide> def svd(a, full_matrices=1, compute_uv=1): <ide> results = lapack_routine(option, m, n, a, m, s, u, m, vt, nvt, <ide> work, lwork, iwork, 0) <ide> if results['info'] > 0: <del> raise LinAlgError, 'SVD did not converge' <add> raise LinAlgError('SVD did not converge') <ide> s = s.astype(_realType(result_t)) <ide> if compute_uv: <ide> u = u.transpose().astype(result_t) <ide> def slogdet(a): <ide> results = lapack_routine(n, n, a, n, pivots, 0) <ide> info = results['info'] <ide> if (info < 0): <del> raise TypeError, "Illegal input to Fortran routine" <add> raise TypeError("Illegal input to Fortran routine") <ide> elif (info > 0): <ide> return (t(0.0), _realType(t)(-Inf)) <ide> sign = 1. - 2. * (add.reduce(pivots != arange(1, n + 1)) % 2) <ide> def lstsq(a, b, rcond=-1): <ide> n_rhs = b.shape[1] <ide> ldb = max(n, m) <ide> if m != b.shape[0]: <del> raise LinAlgError, 'Incompatible dimensions' <add> raise LinAlgError('Incompatible dimensions') <ide> t, result_t = _commonType(a, b) <ide> result_real_t = _realType(result_t) <ide> real_t = _linalgRealType(t) <ide> def lstsq(a, b, rcond=-1): <ide> results = lapack_routine(m, n, n_rhs, a, m, bstar, ldb, s, rcond, <ide> 0, work, lwork, iwork, 0) <ide> if results['info'] > 0: <del> raise LinAlgError, 'SVD did not converge in Linear Least Squares' <add> raise LinAlgError('SVD did not converge in Linear Least Squares') <ide> resids = array([], result_real_t) <ide> if is_1d: <ide> x = array(ravel(bstar)[:n], dtype=result_t, copy=True) <ide> def norm(x, ord=None): <ide> try: <ide> ord + 1 <ide> except TypeError: <del> raise ValueError, "Invalid norm order for vectors." <add> raise ValueError("Invalid norm order for vectors.") <ide> return ((abs(x)**ord).sum())**(1.0/ord) <ide> elif nd == 2: <ide> if ord == 2: <ide> def norm(x, ord=None): <ide> elif ord in ['fro','f']: <ide> return sqrt(add.reduce((x.conj() * x).real.ravel())) <ide> else: <del> raise ValueError, "Invalid norm order for matrices." <add> raise ValueError("Invalid norm order for matrices.") <ide> else: <del> raise ValueError, "Improper number of dimensions to norm." <add> raise ValueError("Improper number of dimensions to norm.") <ide><path>numpy/ma/core.py <ide> def __setitem__(self, indx, value): <ide> <ide> """ <ide> if self is masked: <del> raise MaskError, 'Cannot alter the masked element.' <add> raise MaskError('Cannot alter the masked element.') <ide> # This test is useful, but we should keep things light... <ide> # if getmask(indx) is not nomask: <ide> # msg = "Masked arrays must be filled before they can be used as indices!" <ide> def __int__(self): <ide> raise TypeError("Only length-1 arrays can be converted "\ <ide> "to Python scalars") <ide> elif self._mask: <del> raise MaskError, 'Cannot convert masked element to a Python int.' <add> raise MaskError('Cannot convert masked element to a Python int.') <ide> return int(self.item()) <ide> <ide> <ide> def power(a, b, third=None): <ide> <ide> """ <ide> if third is not None: <del> raise MaskError, "3-argument power not supported." <add> raise MaskError("3-argument power not supported.") <ide> # Get the masks <ide> ma = getmask(a) <ide> mb = getmask(b) <ide> def where (condition, x=None, y=None): <ide> if x is None and y is None: <ide> return filled(condition, 0).nonzero() <ide> elif x is None or y is None: <del> raise ValueError, "Either both or neither x and y should be given." <add> raise ValueError("Either both or neither x and y should be given.") <ide> # Get the condition ............... <ide> fc = filled(condition, 0).astype(MaskType) <ide> notfc = np.logical_not(fc) <ide><path>numpy/ma/extras.py <ide> def average(a, axis=None, weights=None, returned=False): <ide> d = add.reduce(w, axis, dtype=float) <ide> del w, r <ide> else: <del> raise ValueError, 'average: weights wrong shape.' <add> raise ValueError('average: weights wrong shape.') <ide> else: <ide> if weights is None: <ide> n = add.reduce(a, axis, dtype=float) <ide> def average(a, axis=None, weights=None, returned=False): <ide> n = add.reduce(a * w, axis, dtype=float) <ide> d = add.reduce(w, axis, dtype=float) <ide> else: <del> raise ValueError, 'average: weights wrong shape.' <add> raise ValueError('average: weights wrong shape.') <ide> del w <ide> if n is masked or d is masked: <ide> return masked <ide> def compress_rowcols(x, axis=None): <ide> """ <ide> x = asarray(x) <ide> if x.ndim != 2: <del> raise NotImplementedError, "compress2d works for 2D arrays only." <add> raise NotImplementedError("compress2d works for 2D arrays only.") <ide> m = getmask(x) <ide> # Nothing is masked: return x <ide> if m is nomask or not m.any(): <ide> def mask_rowcols(a, axis=None): <ide> """ <ide> a = asarray(a) <ide> if a.ndim != 2: <del> raise NotImplementedError, "compress2d works for 2D arrays only." <add> raise NotImplementedError("compress2d works for 2D arrays only.") <ide> m = getmask(a) <ide> # Nothing is masked: return a <ide> if m is nomask or not m.any(): <ide> def __init__(self, axis=0): <ide> <ide> def __getitem__(self, key): <ide> if isinstance(key, str): <del> raise MAError, "Unavailable for masked array." <add> raise MAError("Unavailable for masked array.") <ide> if type(key) is not tuple: <ide> key = (key,) <ide> objs = [] <ide> def __getitem__(self, key): <ide> self.axis = int(key[k]) <ide> continue <ide> except (ValueError, TypeError): <del> raise ValueError, "Unknown special directive" <add> raise ValueError("Unknown special directive") <ide> elif type(key[k]) in np.ScalarType: <ide> newobj = asarray([key[k]]) <ide> scalars.append(k) <ide> def notmasked_contiguous(a, axis=None): <ide> a = asarray(a) <ide> nd = a.ndim <ide> if nd > 2: <del> raise NotImplementedError, "Currently limited to atmost 2D array." <add> raise NotImplementedError("Currently limited to atmost 2D array.") <ide> if axis is None or nd == 1: <ide> return flatnotmasked_contiguous(a) <ide> # <ide> def polyfit(x, y, deg, rcond=None, full=False): <ide> else: <ide> m = mx <ide> else: <del> raise TypeError, "Expected a 1D or 2D array for y!" <add> raise TypeError("Expected a 1D or 2D array for y!") <ide> if m is not nomask: <ide> x[m] = y[m] = masked <ide> # Set rcond <ide><path>numpy/ma/mrecords.py <ide> def _guessvartypes(arr): <ide> if len(arr.shape) == 2 : <ide> arr = arr[0] <ide> elif len(arr.shape) > 2: <del> raise ValueError, "The array should be 2D at most!" <add> raise ValueError("The array should be 2D at most!") <ide> # Start the conversion loop ....... <ide> for f in arr: <ide> try: <ide> def openfile(fname): <ide> if f.readline()[:2] != "\\x": <ide> f.seek(0, 0) <ide> return f <del> raise NotImplementedError, "Wow, binary file" <add> raise NotImplementedError("Wow, binary file") <ide> <ide> <ide> def fromtextfile(fname, delimitor=None, commentchar='#', missingchar='', <ide><path>numpy/matrixlib/defmatrix.py <ide> def _convert_from_string(data): <ide> if count == 0: <ide> Ncols = len(newrow) <ide> elif len(newrow) != Ncols: <del> raise ValueError, "Rows not the same size." <add> raise ValueError("Rows not the same size.") <ide> count += 1 <ide> newdata.append(newrow) <ide> return newdata <ide> def __new__(subtype, data, dtype=None, copy=True): <ide> ndim = arr.ndim <ide> shape = arr.shape <ide> if (ndim > 2): <del> raise ValueError, "matrix must be 2-dimensional" <add> raise ValueError("matrix must be 2-dimensional") <ide> elif ndim == 0: <ide> shape = (1,1) <ide> elif ndim == 1: <ide> def __array_finalize__(self, obj): <ide> self.shape = newshape <ide> return <ide> elif (ndim > 2): <del> raise ValueError, "shape too large to be a matrix." <add> raise ValueError("shape too large to be a matrix.") <ide> else: <ide> newshape = self.shape <ide> if ndim == 0: <ide> def _align(self, axis): <ide> elif axis==1: <ide> return self.transpose() <ide> else: <del> raise ValueError, "unsupported axis" <add> raise ValueError("unsupported axis") <ide> <ide> # Necessary because base-class tolist expects dimension <ide> # reduction by x[0] <ide><path>numpy/oldnumeric/arrayfns.py <ide> class error(Exception): <ide> def array_set(vals1, indices, vals2): <ide> indices = asarray(indices) <ide> if indices.ndim != 1: <del> raise ValueError, "index array must be 1-d" <add> raise ValueError("index array must be 1-d") <ide> if not isinstance(vals1, np.ndarray): <del> raise TypeError, "vals1 must be an ndarray" <add> raise TypeError("vals1 must be an ndarray") <ide> vals1 = asarray(vals1) <ide> vals2 = asarray(vals2) <ide> if vals1.ndim != vals2.ndim or vals1.ndim < 1: <ide> def interp(y, x, z, typ=None): <ide> def nz(x): <ide> x = asarray(x,dtype=np.ubyte) <ide> if x.ndim != 1: <del> raise TypeError, "intput must have 1 dimension." <add> raise TypeError("intput must have 1 dimension.") <ide> indxs = np.flatnonzero(x != 0) <ide> return indxs[-1].item()+1 <ide> <ide> def reverse(x, n): <ide> x = asarray(x,dtype='d') <ide> if x.ndim != 2: <del> raise ValueError, "input must be 2-d" <add> raise ValueError("input must be 2-d") <ide> y = np.empty_like(x) <ide> if n == 0: <ide> y[...] = x[::-1,:] <ide> def zmin_zmax(z, ireg): <ide> z = asarray(z, dtype=float) <ide> ireg = asarray(ireg, dtype=int) <ide> if z.shape != ireg.shape or z.ndim != 2: <del> raise ValueError, "z and ireg must be the same shape and 2-d" <add> raise ValueError("z and ireg must be the same shape and 2-d") <ide> ix, iy = np.nonzero(ireg) <ide> # Now, add more indices <ide> x1m = ix - 1 <ide><path>numpy/oldnumeric/compat.py <ide> def load_array(self): <ide> <ide> class Pickler(pickle.Pickler): <ide> def __init__(self, *args, **kwds): <del> raise NotImplementedError, "Don't pickle new arrays with this" <add> raise NotImplementedError("Don't pickle new arrays with this") <ide> def save_array(self, object): <del> raise NotImplementedError, "Don't pickle new arrays with this" <add> raise NotImplementedError("Don't pickle new arrays with this") <ide><path>numpy/oldnumeric/functions.py <ide> def nonzero(a): <ide> if len(res) == 1: <ide> return res[0] <ide> else: <del> raise ValueError, "Input argument must be 1d" <add> raise ValueError("Input argument must be 1d") <ide> <ide> def reshape(a, shape): <ide> return np.reshape(a, shape) <ide><path>numpy/oldnumeric/ma.py <ide> def minimum_fill_value (obj): <ide> if x in typecodes['UnsignedInteger']: <ide> return sys.maxint <ide> else: <del> raise TypeError, 'Unsuitable type for calculating minimum.' <add> raise TypeError('Unsuitable type for calculating minimum.') <ide> <ide> def maximum_fill_value (obj): <ide> "Function to calculate default fill value suitable for taking maxima." <ide> def maximum_fill_value (obj): <ide> if x in typecodes['UnsignedInteger']: <ide> return 0 <ide> else: <del> raise TypeError, 'Unsuitable type for calculating maximum.' <add> raise TypeError('Unsuitable type for calculating maximum.') <ide> <ide> def set_fill_value (a, fill_value): <ide> "Set fill value of a if it is a masked array." <ide> def __init__(self, data, dtype=None, copy=True, order=False, <ide> self._data = fromnumeric.resize(self._data, self._mask.shape) <ide> self._data.shape = self._mask.shape <ide> else: <del> raise MAError, "Mask and data not compatible." <add> raise MAError("Mask and data not compatible.") <ide> elif nm == 1 and shape(self._mask) != shape(self._data): <ide> self.unshare_mask() <ide> self._mask.shape = self._data.shape <ide> def __float__(self): <ide> "Convert self to float." <ide> self.unmask() <ide> if self._mask is not nomask: <del> raise MAError, 'Cannot convert masked element to a Python float.' <add> raise MAError('Cannot convert masked element to a Python float.') <ide> return float(self.data.item()) <ide> <ide> def __int__(self): <ide> "Convert self to int." <ide> self.unmask() <ide> if self._mask is not nomask: <del> raise MAError, 'Cannot convert masked element to a Python int.' <add> raise MAError('Cannot convert masked element to a Python int.') <ide> return int(self.data.item()) <ide> <ide> def __getitem__(self, i): <ide> def __setitem__(self, index, value): <ide> "Set item described by index. If value is masked, mask those locations." <ide> d = self._data <ide> if self is masked: <del> raise MAError, 'Cannot alter masked elements.' <add> raise MAError('Cannot alter masked elements.') <ide> if value is masked: <ide> if self._mask is nomask: <ide> self._mask = make_mask_none(d.shape) <ide> def __iadd__(self, other): <ide> if t1 in typecodes['Integer']: <ide> f = f.astype(t) <ide> else: <del> raise TypeError, 'Incorrect type for in-place operation.' <add> raise TypeError('Incorrect type for in-place operation.') <ide> elif t in typecodes['Float']: <ide> if t1 in typecodes['Integer']: <ide> f = f.astype(t) <ide> elif t1 in typecodes['Float']: <ide> f = f.astype(t) <ide> else: <del> raise TypeError, 'Incorrect type for in-place operation.' <add> raise TypeError('Incorrect type for in-place operation.') <ide> elif t in typecodes['Complex']: <ide> if t1 in typecodes['Integer']: <ide> f = f.astype(t) <ide> def __iadd__(self, other): <ide> elif t1 in typecodes['Complex']: <ide> f = f.astype(t) <ide> else: <del> raise TypeError, 'Incorrect type for in-place operation.' <add> raise TypeError('Incorrect type for in-place operation.') <ide> else: <del> raise TypeError, 'Incorrect type for in-place operation.' <add> raise TypeError('Incorrect type for in-place operation.') <ide> <ide> if self._mask is nomask: <ide> self._data += f <ide> def __imul__(self, other): <ide> if t1 in typecodes['Integer']: <ide> f = f.astype(t) <ide> else: <del> raise TypeError, 'Incorrect type for in-place operation.' <add> raise TypeError('Incorrect type for in-place operation.') <ide> elif t in typecodes['Float']: <ide> if t1 in typecodes['Integer']: <ide> f = f.astype(t) <ide> elif t1 in typecodes['Float']: <ide> f = f.astype(t) <ide> else: <del> raise TypeError, 'Incorrect type for in-place operation.' <add> raise TypeError('Incorrect type for in-place operation.') <ide> elif t in typecodes['Complex']: <ide> if t1 in typecodes['Integer']: <ide> f = f.astype(t) <ide> def __imul__(self, other): <ide> elif t1 in typecodes['Complex']: <ide> f = f.astype(t) <ide> else: <del> raise TypeError, 'Incorrect type for in-place operation.' <add> raise TypeError('Incorrect type for in-place operation.') <ide> else: <del> raise TypeError, 'Incorrect type for in-place operation.' <add> raise TypeError('Incorrect type for in-place operation.') <ide> <ide> if self._mask is nomask: <ide> self._data *= f <ide> def __isub__(self, other): <ide> if t1 in typecodes['Integer']: <ide> f = f.astype(t) <ide> else: <del> raise TypeError, 'Incorrect type for in-place operation.' <add> raise TypeError('Incorrect type for in-place operation.') <ide> elif t in typecodes['Float']: <ide> if t1 in typecodes['Integer']: <ide> f = f.astype(t) <ide> elif t1 in typecodes['Float']: <ide> f = f.astype(t) <ide> else: <del> raise TypeError, 'Incorrect type for in-place operation.' <add> raise TypeError('Incorrect type for in-place operation.') <ide> elif t in typecodes['Complex']: <ide> if t1 in typecodes['Integer']: <ide> f = f.astype(t) <ide> def __isub__(self, other): <ide> elif t1 in typecodes['Complex']: <ide> f = f.astype(t) <ide> else: <del> raise TypeError, 'Incorrect type for in-place operation.' <add> raise TypeError('Incorrect type for in-place operation.') <ide> else: <del> raise TypeError, 'Incorrect type for in-place operation.' <add> raise TypeError('Incorrect type for in-place operation.') <ide> <ide> if self._mask is nomask: <ide> self._data -= f <ide> def __idiv__(self, other): <ide> if t1 in typecodes['Integer']: <ide> f = f.astype(t) <ide> else: <del> raise TypeError, 'Incorrect type for in-place operation.' <add> raise TypeError('Incorrect type for in-place operation.') <ide> elif t in typecodes['Float']: <ide> if t1 in typecodes['Integer']: <ide> f = f.astype(t) <ide> elif t1 in typecodes['Float']: <ide> f = f.astype(t) <ide> else: <del> raise TypeError, 'Incorrect type for in-place operation.' <add> raise TypeError('Incorrect type for in-place operation.') <ide> elif t in typecodes['Complex']: <ide> if t1 in typecodes['Integer']: <ide> f = f.astype(t) <ide> def __idiv__(self, other): <ide> elif t1 in typecodes['Complex']: <ide> f = f.astype(t) <ide> else: <del> raise TypeError, 'Incorrect type for in-place operation.' <add> raise TypeError('Incorrect type for in-place operation.') <ide> else: <del> raise TypeError, 'Incorrect type for in-place operation.' <add> raise TypeError('Incorrect type for in-place operation.') <ide> mo = getmask(other) <ide> result = divide(self, masked_array(f, mask=mo)) <ide> self._data = result.data <ide> def count (a, axis = None): <ide> def power (a, b, third=None): <ide> "a**b" <ide> if third is not None: <del> raise MAError, "3-argument power not supported." <add> raise MAError("3-argument power not supported.") <ide> ma = getmask(a) <ide> mb = getmask(b) <ide> m = mask_or(ma, mb) <ide> def new_average (a, axis=None, weights=None, returned = 0): <ide> d = add.reduce(w, axis) <ide> del w, r <ide> else: <del> raise ValueError, 'average: weights wrong shape.' <add> raise ValueError('average: weights wrong shape.') <ide> else: <ide> if weights is None: <ide> n = add.reduce(a, axis) <ide> def new_average (a, axis=None, weights=None, returned = 0): <ide> n = add.reduce(a*w, axis) <ide> d = add.reduce(w, axis) <ide> else: <del> raise ValueError, 'average: weights wrong shape.' <add> raise ValueError('average: weights wrong shape.') <ide> del w <ide> #print n, d, repr(mask), repr(weights) <ide> if n is masked or d is masked: return masked <ide> def asarray(data, dtype=None): <ide> def _m(f): <ide> return MethodType(f, None, array) <ide> def not_implemented(*args, **kwds): <del> raise NotImplementedError, "not yet implemented for numpy.ma arrays" <add> raise NotImplementedError("not yet implemented for numpy.ma arrays") <ide> array.all = _m(alltrue) <ide> array.any = _m(sometrue) <ide> array.argmax = _m(argmax) <ide><path>numpy/oldnumeric/matrix.py <ide> def _convert_from_string(data): <ide> if count == 0: <ide> Ncols = len(newrow) <ide> elif len(newrow) != Ncols: <del> raise ValueError, "Rows not the same size." <add> raise ValueError("Rows not the same size.") <ide> count += 1 <ide> newdata.append(newrow) <ide> return newdata <ide><path>numpy/oldnumeric/random_array.py <ide> def randint(minimum, maximum=None, shape=[]): <ide> """randint(min, max, shape=[]) = random integers >=min, < max <ide> If max not given, random integers >= 0, <min""" <ide> if not isinstance(minimum, int): <del> raise ArgumentError, "randint requires first argument integer" <add> raise ArgumentError("randint requires first argument integer") <ide> if maximum is None: <ide> maximum = minimum <ide> minimum = 0 <ide> if not isinstance(maximum, int): <del> raise ArgumentError, "randint requires second argument integer" <add> raise ArgumentError("randint requires second argument integer") <ide> a = ((maximum-minimum)* random(shape)) <ide> if isinstance(a, np.ndarray): <ide> return minimum + a.astype(np.int) <ide><path>numpy/polynomial/chebyshev.py <ide> def chebder(cs, m=1, scl=1) : <ide> cnt = int(m) <ide> <ide> if cnt != m: <del> raise ValueError, "The order of derivation must be integer" <add> raise ValueError("The order of derivation must be integer") <ide> if cnt < 0 : <del> raise ValueError, "The order of derivation must be non-negative" <add> raise ValueError("The order of derivation must be non-negative") <ide> <ide> # cs is a trimmed copy <ide> [cs] = pu.as_series([cs]) <ide> def chebint(cs, m=1, k=[], lbnd=0, scl=1): <ide> k = [k] <ide> <ide> if cnt != m: <del> raise ValueError, "The order of integration must be integer" <add> raise ValueError("The order of integration must be integer") <ide> if cnt < 0 : <del> raise ValueError, "The order of integration must be non-negative" <add> raise ValueError("The order of integration must be non-negative") <ide> if len(k) > cnt : <del> raise ValueError, "Too many integration constants" <add> raise ValueError("Too many integration constants") <ide> <ide> # cs is a trimmed copy <ide> [cs] = pu.as_series([cs]) <ide> def chebfit(x, y, deg, rcond=None, full=False, w=None): <ide> <ide> # check arguments. <ide> if deg < 0 : <del> raise ValueError, "expected deg >= 0" <add> raise ValueError("expected deg >= 0") <ide> if x.ndim != 1: <del> raise TypeError, "expected 1D vector for x" <add> raise TypeError("expected 1D vector for x") <ide> if x.size == 0: <del> raise TypeError, "expected non-empty vector for x" <add> raise TypeError("expected non-empty vector for x") <ide> if y.ndim < 1 or y.ndim > 2 : <del> raise TypeError, "expected 1D or 2D array for y" <add> raise TypeError("expected 1D or 2D array for y") <ide> if len(x) != len(y): <del> raise TypeError, "expected x and y to have same length" <add> raise TypeError("expected x and y to have same length") <ide> <ide> # set up the least squares matrices <ide> lhs = chebvander(x, deg) <ide> rhs = y <ide> if w is not None: <ide> w = np.asarray(w) + 0.0 <ide> if w.ndim != 1: <del> raise TypeError, "expected 1D vector for w" <add> raise TypeError("expected 1D vector for w") <ide> if len(x) != len(w): <del> raise TypeError, "expected x and w to have same length" <add> raise TypeError("expected x and w to have same length") <ide> # apply weights <ide> if rhs.ndim == 2: <ide> lhs *= w[:, np.newaxis] <ide><path>numpy/polynomial/hermite.py <ide> def hermder(cs, m=1, scl=1) : <ide> cnt = int(m) <ide> <ide> if cnt != m: <del> raise ValueError, "The order of derivation must be integer" <add> raise ValueError("The order of derivation must be integer") <ide> if cnt < 0 : <del> raise ValueError, "The order of derivation must be non-negative" <add> raise ValueError("The order of derivation must be non-negative") <ide> <ide> # cs is a trimmed copy <ide> [cs] = pu.as_series([cs]) <ide> def hermint(cs, m=1, k=[], lbnd=0, scl=1): <ide> k = [k] <ide> <ide> if cnt != m: <del> raise ValueError, "The order of integration must be integer" <add> raise ValueError("The order of integration must be integer") <ide> if cnt < 0 : <del> raise ValueError, "The order of integration must be non-negative" <add> raise ValueError("The order of integration must be non-negative") <ide> if len(k) > cnt : <del> raise ValueError, "Too many integration constants" <add> raise ValueError("Too many integration constants") <ide> <ide> # cs is a trimmed copy <ide> [cs] = pu.as_series([cs]) <ide> def hermfit(x, y, deg, rcond=None, full=False, w=None): <ide> <ide> # check arguments. <ide> if deg < 0 : <del> raise ValueError, "expected deg >= 0" <add> raise ValueError("expected deg >= 0") <ide> if x.ndim != 1: <del> raise TypeError, "expected 1D vector for x" <add> raise TypeError("expected 1D vector for x") <ide> if x.size == 0: <del> raise TypeError, "expected non-empty vector for x" <add> raise TypeError("expected non-empty vector for x") <ide> if y.ndim < 1 or y.ndim > 2 : <del> raise TypeError, "expected 1D or 2D array for y" <add> raise TypeError("expected 1D or 2D array for y") <ide> if len(x) != len(y): <del> raise TypeError, "expected x and y to have same length" <add> raise TypeError("expected x and y to have same length") <ide> <ide> # set up the least squares matrices <ide> lhs = hermvander(x, deg) <ide> rhs = y <ide> if w is not None: <ide> w = np.asarray(w) + 0.0 <ide> if w.ndim != 1: <del> raise TypeError, "expected 1D vector for w" <add> raise TypeError("expected 1D vector for w") <ide> if len(x) != len(w): <del> raise TypeError, "expected x and w to have same length" <add> raise TypeError("expected x and w to have same length") <ide> # apply weights <ide> if rhs.ndim == 2: <ide> lhs *= w[:, np.newaxis] <ide><path>numpy/polynomial/hermite_e.py <ide> def hermeder(cs, m=1, scl=1) : <ide> cnt = int(m) <ide> <ide> if cnt != m: <del> raise ValueError, "The order of derivation must be integer" <add> raise ValueError("The order of derivation must be integer") <ide> if cnt < 0 : <del> raise ValueError, "The order of derivation must be non-negative" <add> raise ValueError("The order of derivation must be non-negative") <ide> <ide> # cs is a trimmed copy <ide> [cs] = pu.as_series([cs]) <ide> def hermeint(cs, m=1, k=[], lbnd=0, scl=1): <ide> k = [k] <ide> <ide> if cnt != m: <del> raise ValueError, "The order of integration must be integer" <add> raise ValueError("The order of integration must be integer") <ide> if cnt < 0 : <del> raise ValueError, "The order of integration must be non-negative" <add> raise ValueError("The order of integration must be non-negative") <ide> if len(k) > cnt : <del> raise ValueError, "Too many integration constants" <add> raise ValueError("Too many integration constants") <ide> <ide> # cs is a trimmed copy <ide> [cs] = pu.as_series([cs]) <ide> def hermefit(x, y, deg, rcond=None, full=False, w=None): <ide> <ide> # check arguments. <ide> if deg < 0 : <del> raise ValueError, "expected deg >= 0" <add> raise ValueError("expected deg >= 0") <ide> if x.ndim != 1: <del> raise TypeError, "expected 1D vector for x" <add> raise TypeError("expected 1D vector for x") <ide> if x.size == 0: <del> raise TypeError, "expected non-empty vector for x" <add> raise TypeError("expected non-empty vector for x") <ide> if y.ndim < 1 or y.ndim > 2 : <del> raise TypeError, "expected 1D or 2D array for y" <add> raise TypeError("expected 1D or 2D array for y") <ide> if len(x) != len(y): <del> raise TypeError, "expected x and y to have same length" <add> raise TypeError("expected x and y to have same length") <ide> <ide> # set up the least squares matrices <ide> lhs = hermevander(x, deg) <ide> rhs = y <ide> if w is not None: <ide> w = np.asarray(w) + 0.0 <ide> if w.ndim != 1: <del> raise TypeError, "expected 1D vector for w" <add> raise TypeError("expected 1D vector for w") <ide> if len(x) != len(w): <del> raise TypeError, "expected x and w to have same length" <add> raise TypeError("expected x and w to have same length") <ide> # apply weights <ide> if rhs.ndim == 2: <ide> lhs *= w[:, np.newaxis] <ide><path>numpy/polynomial/laguerre.py <ide> def lagder(cs, m=1, scl=1) : <ide> cnt = int(m) <ide> <ide> if cnt != m: <del> raise ValueError, "The order of derivation must be integer" <add> raise ValueError("The order of derivation must be integer") <ide> if cnt < 0 : <del> raise ValueError, "The order of derivation must be non-negative" <add> raise ValueError("The order of derivation must be non-negative") <ide> <ide> # cs is a trimmed copy <ide> [cs] = pu.as_series([cs]) <ide> def lagint(cs, m=1, k=[], lbnd=0, scl=1): <ide> k = [k] <ide> <ide> if cnt != m: <del> raise ValueError, "The order of integration must be integer" <add> raise ValueError("The order of integration must be integer") <ide> if cnt < 0 : <del> raise ValueError, "The order of integration must be non-negative" <add> raise ValueError("The order of integration must be non-negative") <ide> if len(k) > cnt : <del> raise ValueError, "Too many integration constants" <add> raise ValueError("Too many integration constants") <ide> <ide> # cs is a trimmed copy <ide> [cs] = pu.as_series([cs]) <ide> def lagfit(x, y, deg, rcond=None, full=False, w=None): <ide> <ide> # check arguments. <ide> if deg < 0 : <del> raise ValueError, "expected deg >= 0" <add> raise ValueError("expected deg >= 0") <ide> if x.ndim != 1: <del> raise TypeError, "expected 1D vector for x" <add> raise TypeError("expected 1D vector for x") <ide> if x.size == 0: <del> raise TypeError, "expected non-empty vector for x" <add> raise TypeError("expected non-empty vector for x") <ide> if y.ndim < 1 or y.ndim > 2 : <del> raise TypeError, "expected 1D or 2D array for y" <add> raise TypeError("expected 1D or 2D array for y") <ide> if len(x) != len(y): <del> raise TypeError, "expected x and y to have same length" <add> raise TypeError("expected x and y to have same length") <ide> <ide> # set up the least squares matrices <ide> lhs = lagvander(x, deg) <ide> rhs = y <ide> if w is not None: <ide> w = np.asarray(w) + 0.0 <ide> if w.ndim != 1: <del> raise TypeError, "expected 1D vector for w" <add> raise TypeError("expected 1D vector for w") <ide> if len(x) != len(w): <del> raise TypeError, "expected x and w to have same length" <add> raise TypeError("expected x and w to have same length") <ide> # apply weights <ide> if rhs.ndim == 2: <ide> lhs *= w[:, np.newaxis] <ide><path>numpy/polynomial/legendre.py <ide> def legder(cs, m=1, scl=1) : <ide> cnt = int(m) <ide> <ide> if cnt != m: <del> raise ValueError, "The order of derivation must be integer" <add> raise ValueError("The order of derivation must be integer") <ide> if cnt < 0 : <del> raise ValueError, "The order of derivation must be non-negative" <add> raise ValueError("The order of derivation must be non-negative") <ide> <ide> # cs is a trimmed copy <ide> [cs] = pu.as_series([cs]) <ide> def legint(cs, m=1, k=[], lbnd=0, scl=1): <ide> k = [k] <ide> <ide> if cnt != m: <del> raise ValueError, "The order of integration must be integer" <add> raise ValueError("The order of integration must be integer") <ide> if cnt < 0 : <del> raise ValueError, "The order of integration must be non-negative" <add> raise ValueError("The order of integration must be non-negative") <ide> if len(k) > cnt : <del> raise ValueError, "Too many integration constants" <add> raise ValueError("Too many integration constants") <ide> <ide> # cs is a trimmed copy <ide> [cs] = pu.as_series([cs]) <ide> def legfit(x, y, deg, rcond=None, full=False, w=None): <ide> <ide> # check arguments. <ide> if deg < 0 : <del> raise ValueError, "expected deg >= 0" <add> raise ValueError("expected deg >= 0") <ide> if x.ndim != 1: <del> raise TypeError, "expected 1D vector for x" <add> raise TypeError("expected 1D vector for x") <ide> if x.size == 0: <del> raise TypeError, "expected non-empty vector for x" <add> raise TypeError("expected non-empty vector for x") <ide> if y.ndim < 1 or y.ndim > 2 : <del> raise TypeError, "expected 1D or 2D array for y" <add> raise TypeError("expected 1D or 2D array for y") <ide> if len(x) != len(y): <del> raise TypeError, "expected x and y to have same length" <add> raise TypeError("expected x and y to have same length") <ide> <ide> # set up the least squares matrices <ide> lhs = legvander(x, deg) <ide> rhs = y <ide> if w is not None: <ide> w = np.asarray(w) + 0.0 <ide> if w.ndim != 1: <del> raise TypeError, "expected 1D vector for w" <add> raise TypeError("expected 1D vector for w") <ide> if len(x) != len(w): <del> raise TypeError, "expected x and w to have same length" <add> raise TypeError("expected x and w to have same length") <ide> # apply weights <ide> if rhs.ndim == 2: <ide> lhs *= w[:, np.newaxis] <ide><path>numpy/polynomial/polynomial.py <ide> def polyder(cs, m=1, scl=1): <ide> cnt = int(m) <ide> <ide> if cnt != m: <del> raise ValueError, "The order of derivation must be integer" <add> raise ValueError("The order of derivation must be integer") <ide> if cnt < 0: <del> raise ValueError, "The order of derivation must be non-negative" <add> raise ValueError("The order of derivation must be non-negative") <ide> <ide> # cs is a trimmed copy <ide> [cs] = pu.as_series([cs]) <ide> def polyint(cs, m=1, k=[], lbnd=0, scl=1): <ide> k = [k] <ide> <ide> if cnt != m: <del> raise ValueError, "The order of integration must be integer" <add> raise ValueError("The order of integration must be integer") <ide> if cnt < 0 : <del> raise ValueError, "The order of integration must be non-negative" <add> raise ValueError("The order of integration must be non-negative") <ide> if len(k) > cnt : <del> raise ValueError, "Too many integration constants" <add> raise ValueError("Too many integration constants") <ide> <ide> # cs is a trimmed copy <ide> [cs] = pu.as_series([cs]) <ide> def polyfit(x, y, deg, rcond=None, full=False, w=None): <ide> <ide> # check arguments. <ide> if deg < 0 : <del> raise ValueError, "expected deg >= 0" <add> raise ValueError("expected deg >= 0") <ide> if x.ndim != 1: <del> raise TypeError, "expected 1D vector for x" <add> raise TypeError("expected 1D vector for x") <ide> if x.size == 0: <del> raise TypeError, "expected non-empty vector for x" <add> raise TypeError("expected non-empty vector for x") <ide> if y.ndim < 1 or y.ndim > 2 : <del> raise TypeError, "expected 1D or 2D array for y" <add> raise TypeError("expected 1D or 2D array for y") <ide> if len(x) != len(y): <del> raise TypeError, "expected x and y to have same length" <add> raise TypeError("expected x and y to have same length") <ide> <ide> # set up the least squares matrices <ide> lhs = polyvander(x, deg) <ide> rhs = y <ide> if w is not None: <ide> w = np.asarray(w) + 0.0 <ide> if w.ndim != 1: <del> raise TypeError, "expected 1D vector for w" <add> raise TypeError("expected 1D vector for w") <ide> if len(x) != len(w): <del> raise TypeError, "expected x and w to have same length" <add> raise TypeError("expected x and w to have same length") <ide> # apply weights <ide> if rhs.ndim == 2: <ide> lhs *= w[:, np.newaxis] <ide><path>numpy/testing/nosetester.py <ide> def _test_argv(self, label, verbose, extra_argv): <ide> argv = [__file__, self.package_path, '-s'] <ide> if label and label != 'full': <ide> if not isinstance(label, basestring): <del> raise TypeError, 'Selection label should be a string' <add> raise TypeError('Selection label should be a string') <ide> if label == 'fast': <ide> label = 'not slow' <ide> argv += ['-A', label]
33
Python
Python
correct a minor bug. nice cpu label displayed
483c01d9fddc45792def9ace89080f817dbdb903
<ide><path>glances/plugins/glances_cpu.py <ide> def msg_curse(self, args=None): <ide> # Nice CPU <ide> if 'nice' in self.stats: <ide> msg = ' {0:8}'.format(_("nice:")) <del> ret.append(self.curse_add_line(msg)) <add> ret.append(self.curse_add_line(msg, optional=True)) <ide> msg = '{0:>6.1%}'.format(self.stats['nice'] / 100) <ide> ret.append(self.curse_add_line(msg, optional=True)) <ide> # New line
1
Ruby
Ruby
link new tapped formula during brew update
7280590e881635f4e47bb619043f5bfd1af05780
<ide><path>Library/Homebrew/cmd/tap.rb <ide> def install_tap user, repo <ide> raise "Already tapped!" if tapd.directory? <ide> abort unless system "git clone https://github.com/#{user}/homebrew-#{repo} #{tapd}" <ide> <del> gitignores = (HOMEBREW_LIBRARY/"Formula/.gitignore").read.split rescue [] <del> <del> cd HOMEBREW_LIBRARY/"Formula" <del> tapd.find_formula do |relative_pathname| <del> # using the system ln is the only way to get relative symlinks <del> system "ln -s ../Taps/#{user}-#{repo}/#{relative_pathname} 2>/dev/null" <del> if $?.success? <del> gitignores << relative_pathname.basename.to_s <del> else <del> opoo "#{relative_pathname.basename('.rb')} conflicts" <add> files = [] <add> tapd.find_formula{ |file| files << Pathname.new("#{user}-#{repo}").join(file) } <add> link_tap_formula(files) <add> end <add> <add> def link_tap_formula formulae <add> ignores = (HOMEBREW_LIBRARY/"Formula/.gitignore").read.split rescue [] <add> <add> cd HOMEBREW_LIBRARY/"Formula" do <add> formulae.each do |formula| <add> # using the system ln is the only way to get relative symlinks <add> system "ln -s ../Taps/#{formula} 2>/dev/null" <add> if $?.success? <add> ignores << formula.basename.to_s <add> else <add> opoo "#{formula.basename('.rb')} conflicts" <add> end <ide> end <ide> end <ide> <ide> tf = Tempfile.new("brew-tap") <del> tf.write(gitignores.uniq.join("\n")) <add> tf.write(ignores.uniq.join("\n")) <ide> tf.close <ide> mv tf.path, "#{HOMEBREW_LIBRARY}/Formula/.gitignore" <ide> end <ide><path>Library/Homebrew/cmd/update.rb <add>require 'cmd/tap' <add> <ide> module Homebrew extend self <ide> <ide> def update <ide> def update <ide> master_updater.pull! <ide> report.merge!(master_updater.report) <ide> <add> new_files = [] <ide> Dir["Library/Taps/*"].each do |tapd| <ide> cd tapd do <ide> updater = Updater.new <ide> def update <ide> end <ide> end <ide> end <add> Homebrew.link_tap_formula(report.new_tapped_formula) <ide> <ide> if report.empty? <ide> puts "Already up-to-date." <ide> def dump <ide> # dump_deleted_commands <ide> end <ide> <add> def new_tapped_formula <add> fetch(:A, []).map do |path| <add> case path when %r{^Library/Taps(/\w+-\w+/.*)} <add> Pathname.new($1) <add> end <add> end.compact <add> end <add> <ide> def select_formula key <ide> fetch(key, []).map do |path| <ide> case path when %r{^Library/Formula}
2
Javascript
Javascript
ignore invalid format specifiers
00aac57df934b4727a3e6fc8cf70db40216f29ee
<ide><path>lib/util.js <ide> exports.format = function(f) { <ide> str += f.slice(lastPos, i); <ide> str += '%'; <ide> break; <add> default: // any other character is not a correct placeholder <add> if (lastPos < i) <add> str += f.slice(lastPos, i); <add> str += '%'; <add> lastPos = i = i + 1; <add> continue; <ide> } <ide> lastPos = i = i + 2; <ide> continue; <ide><path>test/parallel/test-util-format.js <ide> assert.strictEqual(util.format('o: %j, a: %j', {}, []), 'o: {}, a: []'); <ide> assert.strictEqual(util.format('o: %j, a: %j', {}), 'o: {}, a: %j'); <ide> assert.strictEqual(util.format('o: %j, a: %j'), 'o: %j, a: %j'); <ide> <add>// Invalid format specifiers <add>assert.strictEqual(util.format('a% b', 'x'), 'a% b x'); <add>assert.strictEqual(util.format('percent: %d%, fraction: %d', 10, 0.1), <add> 'percent: 10%, fraction: 0.1'); <add>assert.strictEqual(util.format('abc%', 1), 'abc% 1'); <add> <ide> { <ide> const o = {}; <ide> o.o = o;
2
Python
Python
drop unused patterns
7560e8381f90c646bdfeaf1ee491482f39766f53
<ide><path>tests/test_atomic_requests.py <ide> from __future__ import unicode_literals <ide> <del>from django.conf.urls import patterns, url <add>from django.conf.urls import url <ide> from django.db import connection, connections, transaction <ide> from django.http import Http404 <ide> from django.test import TestCase, TransactionTestCase
1
Text
Text
update video.md with forward js 2014 talk
34b4ed7316e204e971c94c14db9fceec39ad5750
<ide><path>docs/docs/videos.md <ide> by [Stoyan Stefanov](http://www.phpied.com/) <ide> ### "Rethinking Web App Development at Facebook" - Facebook F8 Conference 2014 <ide> <ide> <iframe width="650" height="315" src="//www.youtube.com/embed/nYkdrAPrdcw" frameborder="0" allowfullscreen></iframe> <add> <add>### React and Flux: Building Applications with a Unidirectional Data Flow - Forward JS 2014 <add> <add><iframe width="650" height="315" src="//www.youtube.com/embed/i__969noyAM" frameborder="0" allowfullscreen></iframe> <add> <add>Facebook engineers [Bill Fisher](http://twitter.com/fisherwebdev) and [Jing Chen](http://twitter.com/jingc) talk about Flux and React, and how using an application architecture with a unidirectional data flow cleans up a lot of their code.
1
Python
Python
fix type annotations for integer_partition.py
3acca3d1d188f89c6aa0fb4c0139ac62426ea296
<ide><path>dynamic_programming/integer_partition.py <ide> """ <ide> <ide> <del>def partition(m): <del> memo = [[0 for _ in range(m)] for _ in range(m + 1)] <add>def partition(m: int) -> int: <add> memo: list[list[int]] = [[0 for _ in range(m)] for _ in range(m + 1)] <ide> for i in range(m + 1): <ide> memo[i][0] = 1 <ide>
1
Mixed
Javascript
add e2e test for object props
70fc54a20bd86876b02c7da26fb57e3a419d8d79
<ide><path>packages/react-native-codegen/buck_tests/java/ObjectPropsNativeComponentManager.java <add>package com.facebook.react.uimanager; <add> <add>import android.view.ViewGroup; <add>import com.facebook.react.bridge.ReadableMap; <add>import com.facebook.react.viewmanagers.ObjectPropsNativeComponentManagerDelegate; <add>import com.facebook.react.viewmanagers.ObjectPropsNativeComponentManagerInterface; <add> <add>public class ObjectPropsNativeComponentManager extends SimpleViewManager<ViewGroup> <add> implements ObjectPropsNativeComponentManagerInterface<ViewGroup> { <add> <add> public static final String REACT_CLASS = "ObjectPropsNativeComponent"; <add> <add> @Override <add> public String getName() { <add> return REACT_CLASS; <add> } <add> <add> private void test() { <add> ObjectPropsNativeComponentManagerDelegate<ViewGroup, ObjectPropsNativeComponentManager> <add> delegate = new ObjectPropsNativeComponentManagerDelegate<>(this); <add> } <add> <add> @Override <add> public ViewGroup createViewInstance(ThemedReactContext context) { <add> throw new IllegalStateException(); <add> } <add> <add> @Override <add> public void setObjectProp(ViewGroup view, ReadableMap value) {} <add> <add> @Override <add> public void setObjectArrayProp(ViewGroup view, ReadableMap value) {} <add> <add> @Override <add> public void setObjectPrimitiveRequiredProp(ViewGroup view, ReadableMap value) {} <add>} <ide><path>packages/react-native-codegen/e2e/__test_fixtures__/components/ObjectPropsNativeComponent.js <add>/** <add> * Copyright (c) Facebook, Inc. and its affiliates. <add> * <add> * This source code is licensed under the MIT license found in the <add> * LICENSE file in the root directory of this source tree. <add> * <add> * @format <add> * @flow <add> */ <add> <add>'use strict'; <add> <add>import type { <add> PointValue, <add> ColorValue, <add>} from '../../../../../Libraries/StyleSheet/StyleSheetTypes'; <add>import type {ImageSource} from '../../../../../Libraries/Image/ImageSource'; <add>import type { <add> Int32, <add> Float, <add> WithDefault, <add>} from '../../../../../Libraries/Types/CodegenTypes'; <add>import type {ViewProps} from '../../../../../Libraries/Components/View/ViewPropTypes'; <add>import codegenNativeComponent from '../../../../../Libraries/Utilities/codegenNativeComponent'; <add> <add>type ObjectArrayPropType = $ReadOnly<{| <add> array: $ReadOnlyArray<string>, <add>|}>; <add> <add>type NativeProps = $ReadOnly<{| <add> ...ViewProps, <add> <add> // Props <add> objectProp?: $ReadOnly<{| <add> stringProp?: WithDefault<string, ''>, <add> booleanProp: boolean, <add> floatProp: Float, <add> intProp: Int32, <add> stringEnumProp?: WithDefault<'small' | 'large', 'small'>, <add> |}>, <add> objectArrayProp: ObjectArrayPropType, <add> objectPrimitiveRequiredProp: $ReadOnly<{| <add> image: ImageSource, <add> color?: ColorValue, <add> point: ?PointValue, <add> |}>, <add>|}>; <add> <add>export default codegenNativeComponent<NativeProps>( <add> 'ObjectPropsNativeComponent', <add>);
2
Python
Python
add authoring api for taskgroup mapping
84d915c249617aedaf0c451e9f9d19a4e7ff767b
<ide><path>airflow/decorators/base.py <ide> ValidationSource, <ide> ensure_xcomarg_return_value, <ide> get_mappable_types, <del> prevent_duplicates, <ide> ) <ide> from airflow.models.pool import Pool <ide> from airflow.models.xcom_arg import XComArg <ide> from airflow.typing_compat import ParamSpec, Protocol <ide> from airflow.utils import timezone <ide> from airflow.utils.context import KNOWN_CONTEXT_KEYS, Context <add>from airflow.utils.helpers import prevent_duplicates <ide> from airflow.utils.task_group import TaskGroup, TaskGroupContext <ide> from airflow.utils.types import NOTSET <ide> <ide> <del>def validate_python_callable(python_callable: Any) -> None: <del> """ <del> Validate that python callable can be wrapped by operator. <del> Raises exception if invalid. <add>class ExpandableFactory(Protocol): <add> """Protocol providing inspection against wrapped function. <add> <add> This is used in ``validate_expand_kwargs`` and implemented by function <add> decorators like ``@task`` and ``@task_group``. <ide> <del> :param python_callable: Python object to be validated <del> :raises: TypeError, AirflowException <add> :meta private: <ide> """ <del> if not callable(python_callable): <del> raise TypeError('`python_callable` param must be callable') <del> if 'self' in inspect.signature(python_callable).parameters.keys(): <del> raise AirflowException('@task does not support methods') <add> <add> function: Callable <add> <add> @cached_property <add> def function_signature(self) -> inspect.Signature: <add> return inspect.signature(self.function) <add> <add> @cached_property <add> def _mappable_function_argument_names(self) -> set[str]: <add> """Arguments that can be mapped against.""" <add> return set(self.function_signature.parameters) <add> <add> def _validate_arg_names(self, func: ValidationSource, kwargs: dict[str, Any]) -> None: <add> """Ensure that all arguments passed to operator-mapping functions are accounted for.""" <add> parameters = self.function_signature.parameters <add> if any(v.kind == inspect.Parameter.VAR_KEYWORD for v in parameters.values()): <add> return <add> kwargs_left = kwargs.copy() <add> for arg_name in self._mappable_function_argument_names: <add> value = kwargs_left.pop(arg_name, NOTSET) <add> if func != "expand" or value is NOTSET or isinstance(value, get_mappable_types()): <add> continue <add> tname = type(value).__name__ <add> raise ValueError(f"expand() got an unexpected type {tname!r} for keyword argument {arg_name!r}") <add> if len(kwargs_left) == 1: <add> raise TypeError(f"{func}() got an unexpected keyword argument {next(iter(kwargs_left))!r}") <add> elif kwargs_left: <add> names = ", ".join(repr(n) for n in kwargs_left) <add> raise TypeError(f"{func}() got unexpected keyword arguments {names}") <ide> <ide> <ide> def get_unique_task_id( <ide> def _hook_apply_defaults(self, *args, **kwargs): <ide> <ide> <ide> @attr.define(slots=False) <del>class _TaskDecorator(Generic[FParams, FReturn, OperatorSubclass]): <add>class _TaskDecorator(ExpandableFactory, Generic[FParams, FReturn, OperatorSubclass]): <ide> """ <ide> Helper class for providing dynamic task mapping to decorated functions. <ide> <ide> class _TaskDecorator(Generic[FParams, FReturn, OperatorSubclass]): <ide> :meta private: <ide> """ <ide> <del> function: Callable[FParams, FReturn] = attr.ib() <add> function: Callable[FParams, FReturn] = attr.ib(validator=attr.validators.is_callable()) <ide> operator_class: type[OperatorSubclass] <ide> multiple_outputs: bool = attr.ib() <ide> kwargs: dict[str, Any] = attr.ib(factory=dict) <ide> def __call__(self, *args: FParams.args, **kwargs: FParams.kwargs) -> XComArg: <ide> def __wrapped__(self) -> Callable[FParams, FReturn]: <ide> return self.function <ide> <del> @cached_property <del> def function_signature(self): <del> return inspect.signature(self.function) <del> <del> @cached_property <del> def _function_is_vararg(self): <del> parameters = self.function_signature.parameters <del> return any(v.kind == inspect.Parameter.VAR_KEYWORD for v in parameters.values()) <del> <del> @cached_property <del> def _mappable_function_argument_names(self) -> set[str]: <del> """Arguments that can be mapped against.""" <del> return set(self.function_signature.parameters) <del> <ide> def _validate_arg_names(self, func: ValidationSource, kwargs: dict[str, Any]): <ide> # Ensure that context variables are not shadowed. <ide> context_keys_being_mapped = KNOWN_CONTEXT_KEYS.intersection(kwargs) <ide> def _validate_arg_names(self, func: ValidationSource, kwargs: dict[str, Any]): <ide> names = ", ".join(repr(n) for n in context_keys_being_mapped) <ide> raise ValueError(f"cannot call {func}() on task context variables {names}") <ide> <del> # Ensure that all arguments passed in are accounted for. <del> if self._function_is_vararg: <del> return <del> kwargs_left = kwargs.copy() <del> for arg_name in self._mappable_function_argument_names: <del> value = kwargs_left.pop(arg_name, NOTSET) <del> if func != "expand" or value is NOTSET or isinstance(value, get_mappable_types()): <del> continue <del> tname = type(value).__name__ <del> raise ValueError(f"expand() got an unexpected type {tname!r} for keyword argument {arg_name!r}") <del> if len(kwargs_left) == 1: <del> raise TypeError(f"{func}() got an unexpected keyword argument {next(iter(kwargs_left))!r}") <del> elif kwargs_left: <del> names = ", ".join(repr(n) for n in kwargs_left) <del> raise TypeError(f"{func}() got unexpected keyword arguments {names}") <add> super()._validate_arg_names(func, kwargs) <ide> <ide> def expand(self, **map_kwargs: OperatorExpandArgument) -> XComArg: <ide> if not map_kwargs: <ide><path>airflow/decorators/task_group.py <ide> from __future__ import annotations <ide> <ide> import functools <del>from inspect import signature <del>from typing import TYPE_CHECKING, Any, Callable, Generic, TypeVar, overload <add>import inspect <add>import warnings <add>from typing import TYPE_CHECKING, Any, Callable, ClassVar, Generic, Mapping, Sequence, TypeVar, overload <ide> <ide> import attr <del> <add>from sqlalchemy.orm import Session <add> <add>from airflow.decorators.base import ExpandableFactory <add>from airflow.models.expandinput import ( <add> DictOfListsExpandInput, <add> ExpandInput, <add> ListOfDictsExpandInput, <add> OperatorExpandArgument, <add> OperatorExpandKwargsArgument, <add>) <ide> from airflow.models.taskmixin import DAGNode <add>from airflow.models.xcom_arg import XComArg <ide> from airflow.typing_compat import ParamSpec <del>from airflow.utils.task_group import TaskGroup <add>from airflow.utils.context import Context <add>from airflow.utils.helpers import prevent_duplicates <add>from airflow.utils.mixins import ResolveMixin <add>from airflow.utils.session import NEW_SESSION, provide_session <add>from airflow.utils.task_group import MappedTaskGroup, TaskGroup <ide> <ide> if TYPE_CHECKING: <ide> from airflow.models.dag import DAG <del> from airflow.models.expandinput import OperatorExpandArgument, OperatorExpandKwargsArgument <ide> <ide> FParams = ParamSpec("FParams") <ide> FReturn = TypeVar("FReturn", None, DAGNode) <ide> <del>task_group_sig = signature(TaskGroup.__init__) <add>task_group_sig = inspect.signature(TaskGroup.__init__) <add> <add> <add>@attr.define(kw_only=True) <add>class _MappedArgument(ResolveMixin): <add> _input: ExpandInput <add> _key: str <ide> <add> @provide_session <add> def resolve(self, context: Context, *, session: Session = NEW_SESSION) -> Any: <add> data, _ = self._input.resolve(context, session=session) <add> return data[self._key] <ide> <del>@attr.define <del>class _TaskGroupFactory(Generic[FParams, FReturn]): <add> <add>@attr.define() <add>class _TaskGroupFactory(ExpandableFactory, Generic[FParams, FReturn]): <ide> function: Callable[FParams, FReturn] = attr.ib(validator=attr.validators.is_callable()) <del> kwargs: dict[str, Any] = attr.ib(factory=dict) <add> tg_kwargs: dict[str, Any] = attr.ib(factory=dict) # Parameters forwarded to TaskGroup. <add> partial_kwargs: dict[str, Any] = attr.ib(factory=dict) # Parameters forwarded to 'function'. <add> <add> _task_group_created: bool = attr.ib(False, init=False) <ide> <del> @function.validator <del> def _validate_function(self, _, f: Callable[FParams, FReturn]): <del> if 'self' in signature(f).parameters: <del> raise TypeError('@task_group does not support methods') <add> tg_class: ClassVar[type[TaskGroup]] = TaskGroup <ide> <del> @kwargs.validator <add> @tg_kwargs.validator <ide> def _validate(self, _, kwargs): <ide> task_group_sig.bind_partial(**kwargs) <ide> <ide> def __attrs_post_init__(self): <del> if not self.kwargs.get("group_id"): <del> self.kwargs["group_id"] = self.function.__name__ <add> self.tg_kwargs.setdefault("group_id", self.function.__name__) <add> <add> def __del__(self): <add> if self.partial_kwargs and not self._task_group_created: <add> try: <add> group_id = repr(self.tg_kwargs["group_id"]) <add> except KeyError: <add> group_id = f"at {hex(id(self))}" <add> warnings.warn(f"Partial task group {group_id} was never mapped!") <ide> <ide> def __call__(self, *args: FParams.args, **kwargs: FParams.kwargs) -> DAGNode: <ide> """Instantiate the task group. <ide> <del> with self._make_task_group(add_suffix_on_collision=True, **self.kwargs) as task_group: <ide> This uses the wrapped function to create a task group. Depending on the <ide> return type of the wrapped function, this either returns the last task <ide> in the group, or the group itself, to support task chaining. <ide> """ <del> with TaskGroup(add_suffix_on_collision=True, **self.kwargs) as task_group: <add> return self._create_task_group(TaskGroup, *args, **kwargs) <add> <add> def _create_task_group(self, tg_factory: Callable[..., TaskGroup], *args: Any, **kwargs: Any) -> DAGNode: <add> with tg_factory(add_suffix_on_collision=True, **self.tg_kwargs) as task_group: <ide> if self.function.__doc__ and not task_group.tooltip: <ide> task_group.tooltip = self.function.__doc__ <ide> <ide> # Invoke function to run Tasks inside the TaskGroup <ide> retval = self.function(*args, **kwargs) <ide> <add> self._task_group_created = True <add> <ide> # If the task-creating function returns a task, forward the return value <ide> # so dependencies bind to it. This is equivalent to <ide> # with TaskGroup(...) as tg: <ide> def __call__(self, *args: FParams.args, **kwargs: FParams.kwargs) -> DAGNode: <ide> return task_group <ide> <ide> def override(self, **kwargs: Any) -> _TaskGroupFactory[FParams, FReturn]: <del> return attr.evolve(self, kwargs={**self.kwargs, **kwargs}) <add> return attr.evolve(self, tg_kwargs={**self.tg_kwargs, **kwargs}) <ide> <ide> def partial(self, **kwargs: Any) -> _TaskGroupFactory[FParams, FReturn]: <del> raise NotImplementedError("TODO: Implement me") <del> <del> def expand(self, **kwargs: OperatorExpandArgument) -> TaskGroup: <del> raise NotImplementedError("TODO: Implement me") <del> <del> def expand_kwargs(self, kwargs: OperatorExpandKwargsArgument, *, strict: bool = True) -> TaskGroup: <del> raise NotImplementedError("TODO: Implement me") <add> self._validate_arg_names("partial", kwargs) <add> prevent_duplicates(self.partial_kwargs, kwargs, fail_reason="duplicate partial") <add> kwargs.update(self.partial_kwargs) <add> return attr.evolve(self, partial_kwargs=kwargs) <add> <add> def expand(self, **kwargs: OperatorExpandArgument) -> DAGNode: <add> if not kwargs: <add> raise TypeError("no arguments to expand against") <add> self._validate_arg_names("expand", kwargs) <add> prevent_duplicates(self.partial_kwargs, kwargs, fail_reason="mapping already partial") <add> expand_input = DictOfListsExpandInput(kwargs) <add> return self._create_task_group( <add> functools.partial(MappedTaskGroup, expand_input=expand_input), <add> **self.partial_kwargs, <add> **{k: _MappedArgument(input=expand_input, key=k) for k in kwargs}, <add> ) <add> <add> def expand_kwargs(self, kwargs: OperatorExpandKwargsArgument) -> DAGNode: <add> if isinstance(kwargs, Sequence): <add> for item in kwargs: <add> if not isinstance(item, (XComArg, Mapping)): <add> raise TypeError(f"expected XComArg or list[dict], not {type(kwargs).__name__}") <add> elif not isinstance(kwargs, XComArg): <add> raise TypeError(f"expected XComArg or list[dict], not {type(kwargs).__name__}") <add> <add> # It's impossible to build a dict of stubs as keyword arguments if the <add> # function uses * or ** wildcard arguments. <add> function_has_vararg = any( <add> v.kind == inspect.Parameter.VAR_POSITIONAL or v.kind == inspect.Parameter.VAR_KEYWORD <add> for v in self.function_signature.parameters.values() <add> ) <add> if function_has_vararg: <add> raise TypeError("calling expand_kwargs() on task group function with * or ** is not supported") <add> <add> # We can't be sure how each argument is used in the function (well <add> # technically we can with AST but let's not), so we have to create stubs <add> # for every argument, including those with default values. <add> map_kwargs = (k for k in self.function_signature.parameters if k not in self.partial_kwargs) <add> <add> expand_input = ListOfDictsExpandInput(kwargs) <add> return self._create_task_group( <add> functools.partial(MappedTaskGroup, expand_input=expand_input), <add> **self.partial_kwargs, <add> **{k: _MappedArgument(input=expand_input, key=k) for k in map_kwargs}, <add> ) <ide> <ide> <ide> # This covers the @task_group() case. Annotations are copied from the TaskGroup <ide> def task_group( <ide> ui_color: str = "CornflowerBlue", <ide> ui_fgcolor: str = "#000", <ide> add_suffix_on_collision: bool = False, <del>) -> Callable[FParams, _TaskGroupFactory[FParams, FReturn]]: <add>) -> Callable[[Callable[FParams, FReturn]], _TaskGroupFactory[FParams, FReturn]]: <ide> ... <ide> <ide> <ide> def task_group(python_callable=None, **tg_kwargs): <ide> :param tg_kwargs: Keyword arguments for the TaskGroup object. <ide> """ <ide> if callable(python_callable) and not tg_kwargs: <del> return _TaskGroupFactory(function=python_callable, kwargs=tg_kwargs) <del> return functools.partial(_TaskGroupFactory, kwargs=tg_kwargs) <add> return _TaskGroupFactory(function=python_callable, tg_kwargs=tg_kwargs) <add> return functools.partial(_TaskGroupFactory, tg_kwargs=tg_kwargs) <ide><path>airflow/models/abstractoperator.py <ide> from airflow.utils.context import Context <ide> from airflow.utils.helpers import render_template_as_native, render_template_to_string <ide> from airflow.utils.log.logging_mixin import LoggingMixin <add>from airflow.utils.mixins import ResolveMixin <ide> from airflow.utils.session import NEW_SESSION, provide_session <ide> from airflow.utils.trigger_rule import TriggerRule <ide> from airflow.utils.weight_rule import WeightRule <ide> def render_template( <ide> if not jinja_env: <ide> jinja_env = self.get_template_env() <ide> <del> from airflow.models.param import DagParam <del> from airflow.models.xcom_arg import XComArg <del> <ide> if isinstance(value, str): <ide> if any(value.endswith(ext) for ext in self.template_ext): # A filepath. <ide> template = jinja_env.get_template(value) <ide> def render_template( <ide> return render_template_as_native(template, context) <ide> return render_template_to_string(template, context) <ide> <del> if isinstance(value, (DagParam, XComArg)): <add> if isinstance(value, ResolveMixin): <ide> return value.resolve(context) <ide> <ide> # Fast path for common built-in collections. <ide><path>airflow/models/mappedoperator.py <ide> from airflow.ti_deps.deps.mapped_task_expanded import MappedTaskIsExpanded <ide> from airflow.typing_compat import Literal <ide> from airflow.utils.context import Context, context_update_for_unmapped <del>from airflow.utils.helpers import is_container <add>from airflow.utils.helpers import is_container, prevent_duplicates <ide> from airflow.utils.operator_resources import Resources <ide> from airflow.utils.state import State, TaskInstanceState <ide> from airflow.utils.trigger_rule import TriggerRule <ide> def validate_mapping_kwargs(op: type[BaseOperator], func: ValidationSource, valu <ide> raise TypeError(f"{op.__name__}.{func}() got {error}") <ide> <ide> <del>def prevent_duplicates(kwargs1: dict[str, Any], kwargs2: Mapping[str, Any], *, fail_reason: str) -> None: <del> duplicated_keys = set(kwargs1).intersection(kwargs2) <del> if not duplicated_keys: <del> return <del> if len(duplicated_keys) == 1: <del> raise TypeError(f"{fail_reason} argument: {duplicated_keys.pop()}") <del> duplicated_keys_display = ", ".join(sorted(duplicated_keys)) <del> raise TypeError(f"{fail_reason} arguments: {duplicated_keys_display}") <del> <del> <ide> def ensure_xcomarg_return_value(arg: Any) -> None: <ide> from airflow.models.xcom_arg import XCOM_RETURN_KEY, XComArg <ide> <ide><path>airflow/models/param.py <ide> <ide> from airflow.exceptions import AirflowException, ParamValidationError, RemovedInAirflow3Warning <ide> from airflow.utils.context import Context <add>from airflow.utils.mixins import ResolveMixin <ide> from airflow.utils.types import NOTSET, ArgNotSet <ide> <ide> if TYPE_CHECKING: <ide> def validate(self) -> dict[str, Any]: <ide> return resolved_dict <ide> <ide> <del>class DagParam: <add>class DagParam(ResolveMixin): <ide> """ <ide> Class that represents a DAG run parameter & binds a simple Param object to a name within a DAG instance, <ide> so that it can be resolved during the run time via ``{{ context }}`` dictionary. The ideal use case of <ide><path>airflow/models/xcom_arg.py <ide> from airflow.models.xcom import XCOM_RETURN_KEY <ide> from airflow.utils.context import Context <ide> from airflow.utils.edgemodifier import EdgeModifier <add>from airflow.utils.mixins import ResolveMixin <ide> from airflow.utils.session import NEW_SESSION, provide_session <ide> from airflow.utils.types import NOTSET, ArgNotSet <ide> <ide> MapCallables = Sequence[Union[Callable[[Any], Any], str]] <ide> <ide> <del>class XComArg(DependencyMixin): <add>class XComArg(ResolveMixin, DependencyMixin): <ide> """Reference to an XCom value pushed from another operator. <ide> <ide> The implementation supports:: <ide><path>airflow/utils/helpers.py <ide> from datetime import datetime <ide> from functools import reduce <ide> from itertools import filterfalse, tee <del>from typing import TYPE_CHECKING, Any, Callable, Generator, Iterable, MutableMapping, TypeVar, cast <add>from typing import TYPE_CHECKING, Any, Callable, Generator, Iterable, Mapping, MutableMapping, TypeVar, cast <ide> <ide> from airflow.configuration import conf <ide> from airflow.exceptions import AirflowException, RemovedInAirflow3Warning <ide> def is_empty(x): <ide> return new_list <ide> else: <ide> return val <add> <add> <add>def prevent_duplicates(kwargs1: dict[str, Any], kwargs2: Mapping[str, Any], *, fail_reason: str) -> None: <add> """Ensure *kwargs1* and *kwargs2* do not contain common keys. <add> <add> :raises TypeError: If common keys are found. <add> """ <add> duplicated_keys = set(kwargs1).intersection(kwargs2) <add> if not duplicated_keys: <add> return <add> if len(duplicated_keys) == 1: <add> raise TypeError(f"{fail_reason} argument: {duplicated_keys.pop()}") <add> duplicated_keys_display = ", ".join(sorted(duplicated_keys)) <add> raise TypeError(f"{fail_reason} arguments: {duplicated_keys_display}") <ide><path>airflow/utils/mixins.py <ide> # KIND, either express or implied. See the License for the <ide> # specific language governing permissions and limitations <ide> # under the License. <add> <ide> from __future__ import annotations <ide> <ide> import multiprocessing <add>import typing <ide> <ide> from airflow.configuration import conf <add>from airflow.utils.context import Context <ide> <ide> <ide> class MultiprocessingStartMethodMixin: <ide> def _get_multiprocessing_start_method(self) -> str: <ide> if not method: <ide> raise ValueError("Failed to determine start method") <ide> return method <add> <add> <add>class ResolveMixin: <add> """A runtime-resolved value.""" <add> <add> def resolve(self, context: Context) -> typing.Any: <add> raise NotImplementedError <ide><path>airflow/utils/task_group.py <ide> if TYPE_CHECKING: <ide> from airflow.models.baseoperator import BaseOperator <ide> from airflow.models.dag import DAG <add> from airflow.models.expandinput import ExpandInput <ide> from airflow.utils.edgemodifier import EdgeModifier <ide> <ide> <ide> def topological_sort(self, _include_subdag_tasks: bool = False): <ide> return graph_sorted <ide> <ide> <add>class MappedTaskGroup(TaskGroup): <add> """A mapped task group. <add> <add> This doesn't really do anything special, just holds some additional metadata <add> for expansion later. <add> <add> Don't instantiate this class directly; call *expand* or *expand_kwargs* on <add> a ``@task_group`` function instead. <add> """ <add> <add> def __init__(self, *, expand_input: ExpandInput, **kwargs: Any) -> None: <add> super().__init__(**kwargs) <add> self._expand_input = expand_input <add> <add> <ide> class TaskGroupContext: <ide> """TaskGroup context is used to keep the current TaskGroup when TaskGroup is used as ContextManager.""" <ide> <ide><path>tests/decorators/test_task_group.py <ide> from __future__ import annotations <ide> <ide> import pendulum <add>import pytest <ide> <ide> from airflow.decorators import dag, task_group <add>from airflow.decorators.task_group import _MappedArgument <add>from airflow.models.expandinput import DictOfListsExpandInput, ListOfDictsExpandInput <add>from airflow.utils.task_group import MappedTaskGroup <ide> <ide> <ide> def test_task_group_with_overridden_kwargs(): <ide> def simple_tg(): <ide> }, <ide> ) <ide> <del> assert tg_with_overridden_kwargs.kwargs == { <add> assert tg_with_overridden_kwargs.tg_kwargs == { <ide> 'group_id': 'custom_group_id', <ide> 'default_args': { <ide> 'params': { <ide> def tg(): <ide> _ = pipeline() <ide> <ide> assert _.task_group_dict["tg"].tooltip == "tooltip for the TaskGroup" <add> <add> <add>def test_partial_evolves_factory(): <add> tgp = None <add> <add> @task_group() <add> def tg(a, b): <add> pass <add> <add> @dag(start_date=pendulum.datetime(2022, 1, 1)) <add> def pipeline(): <add> nonlocal tgp <add> tgp = tg.partial(a=1) <add> <add> d = pipeline() <add> <add> assert d.task_group_dict == {} # Calling partial() without expanding does not create a task group. <add> <add> assert type(tgp) == type(tg) <add> assert tgp.partial_kwargs == {"a": 1} # Partial kwargs are saved. <add> <add> # Warn if the partial object goes out of scope without being mapped. <add> with pytest.warns(UserWarning, match=r"Partial task group 'tg' was never mapped!"): <add> del tgp <add> <add> <add>def test_expand_fail_empty(): <add> @dag(start_date=pendulum.datetime(2022, 1, 1)) <add> def pipeline(): <add> @task_group() <add> def tg(): <add> pass <add> <add> tg.expand() <add> <add> with pytest.raises(TypeError) as ctx: <add> pipeline() <add> assert str(ctx.value) == "no arguments to expand against" <add> <add> <add>def test_expand_create_mapped(): <add> saved = {} <add> <add> @dag(start_date=pendulum.datetime(2022, 1, 1)) <add> def pipeline(): <add> @task_group() <add> def tg(a, b): <add> saved["a"] = a <add> saved["b"] = b <add> <add> tg.partial(a=1).expand(b=["x", "y"]) <add> <add> d = pipeline() <add> <add> tg = d.task_group_dict["tg"] <add> assert isinstance(tg, MappedTaskGroup) <add> assert tg._expand_input == DictOfListsExpandInput({"b": ["x", "y"]}) <add> <add> assert saved == {"a": 1, "b": _MappedArgument(input=tg._expand_input, key="b")} <add> <add> <add>def test_expand_kwargs_no_wildcard(): <add> @dag(start_date=pendulum.datetime(2022, 1, 1)) <add> def pipeline(): <add> @task_group() <add> def tg(**kwargs): <add> pass <add> <add> tg.expand_kwargs([]) <add> <add> with pytest.raises(TypeError) as ctx: <add> pipeline() <add> <add> assert str(ctx.value) == "calling expand_kwargs() on task group function with * or ** is not supported" <add> <add> <add>def test_expand_kwargs_create_mapped(): <add> saved = {} <add> <add> @dag(start_date=pendulum.datetime(2022, 1, 1)) <add> def pipeline(): <add> @task_group() <add> def tg(a, b): <add> saved["a"] = a <add> saved["b"] = b <add> <add> tg.partial(a=1).expand_kwargs([{"b": "x"}, {"b": None}]) <add> <add> d = pipeline() <add> <add> tg = d.task_group_dict["tg"] <add> assert isinstance(tg, MappedTaskGroup) <add> assert tg._expand_input == ListOfDictsExpandInput([{"b": "x"}, {"b": None}]) <add> <add> assert saved == {"a": 1, "b": _MappedArgument(input=tg._expand_input, key="b")}
10
Javascript
Javascript
use different socket for win32 test
8b0f373df0574b7cb3c6b531b4092cd670dac6e3
<ide><path>test/unit/adapters/http.js <ide> describe('supports http with nodejs', function () { <ide> }); <ide> <ide> it('should support sockets', function (done) { <add> // Different sockets for win32 vs darwin/linux <add> var socketName = './test.sock'; <add> <add> if (process.platform === 'win32') { <add> socketName = '\\\\.\\pipe\\libuv-test'; <add> } <add> <ide> server = net.createServer(function (socket) { <ide> socket.on('data', function () { <ide> socket.end('HTTP/1.1 200 OK\r\n\r\n'); <ide> }); <del> }).listen('./test.sock', function () { <add> }).listen(socketName, function () { <ide> axios({ <del> socketPath: './test.sock', <add> socketPath: socketName, <ide> url: '/' <ide> }) <ide> .then(function (resp) {
1
Python
Python
remove unused isscalar import
d22a71bab7b787527035d5eb87ca3bc5acb0f88e
<ide><path>numpy/lib/shape_base.py <ide> <ide> import numpy.core.numeric as _nx <ide> from numpy.core.numeric import ( <del> asarray, zeros, outer, concatenate, isscalar, array, asanyarray <add> asarray, zeros, outer, concatenate, array, asanyarray <ide> ) <ide> from numpy.core.fromnumeric import product, reshape, transpose <ide> from numpy.core.multiarray import normalize_axis_index <ide><path>numpy/linalg/linalg.py <ide> csingle, cdouble, inexact, complexfloating, newaxis, ravel, all, Inf, dot, <ide> add, multiply, sqrt, maximum, fastCopyAndTranspose, sum, isfinite, size, <ide> finfo, errstate, geterrobj, longdouble, moveaxis, amin, amax, product, abs, <del> broadcast, atleast_2d, intp, asanyarray, isscalar, object_, ones, matmul, <add> broadcast, atleast_2d, intp, asanyarray, object_, ones, matmul, <ide> swapaxes, divide, count_nonzero <ide> ) <ide> from numpy.core.multiarray import normalize_axis_index
2
Python
Python
remove preservena reference from docstrings
3b579f7046a0751a1b1976390ece5ba8603b8585
<ide><path>numpy/add_newdocs.py <ide> def luf(lamdaexpr, *args, **kwargs): <ide> <ide> add_newdoc('numpy.core.multiarray', 'copyto', <ide> """ <del> copyto(dst, src, casting='same_kind', where=None, preservena=False) <add> copyto(dst, src, casting='same_kind', where=None) <ide> <ide> Copies values from one array to another, broadcasting as necessary. <ide> <ide> def luf(lamdaexpr, *args, **kwargs): <ide> A boolean array which is broadcasted to match the dimensions <ide> of `dst`, and selects elements to copy from `src` to `dst` <ide> wherever it contains the value True. <del> preservena : bool, optional <del> If set to True, leaves any NA values in `dst` untouched. This <del> is similar to the "hard mask" feature in numpy.ma. <ide> <ide> """) <ide> <ide> def luf(lamdaexpr, *args, **kwargs): <ide> If `values` is not the same size as `a` and `mask` then it will repeat. <ide> This gives behavior different from ``a[mask] = values``. <ide> <del> .. note:: The `putmask` functionality is also provided by `copyto`, which <del> can be significantly faster and in addition is NA-aware <del> (`preservena` keyword). Replacing `putmask` with <del> ``np.copyto(a, values, where=mask)`` is recommended. <del> <ide> Parameters <ide> ---------- <ide> a : array_like
1
Go
Go
finish implementation and begin working on tests
6bc05899aa5023fdda0441b76a829d0e9a6f6dea
<ide><path>networkdriver/portallocator/allocator.go <ide> import ( <ide> "errors" <ide> "github.com/dotcloud/docker/pkg/netlink" <ide> "net" <del> "sort" <ide> "sync" <ide> ) <ide> <ide> var ( <ide> ErrNetworkAlreadyAllocated = errors.New("requested network overlaps with existing network") <ide> ErrNetworkAlreadyRegisterd = errors.New("requested network is already registered") <ide> ErrNoAvailableIps = errors.New("no available ips on network") <del> lock = sync.Mutex{} <del> allocatedIPs = networkSet{} <del> availableIPS = networkSet{} <add> ErrIPAlreadyAllocated = errors.New("ip already allocated") <add> <add> lock = sync.Mutex{} <add> allocatedIPs = networkSet{} <add> availableIPS = networkSet{} <ide> ) <ide> <ide> func RegisterNetwork(network *net.IPNet) error { <ide> func RegisterNetwork(network *net.IPNet) error { <ide> if err := checkExistingNetworkOverlaps(network); err != nil { <ide> return err <ide> } <del> allocatedIPs[newIPNet(network)] = iPSet{} <add> n := newIPNet(network) <add> <add> allocatedIPs[n] = iPSet{} <add> availableIPS[n] = iPSet{} <ide> <ide> return nil <ide> } <ide> <del>func RequestIP(network *net.IPNet, ip *net.IPAddr) (*net.IPAddr, error) { <add>func RequestIP(network *net.IPNet, ip *net.IP) (*net.IP, error) { <ide> lock.Lock() <ide> defer lock.Unlock() <ide> <ide> func RequestIP(network *net.IPNet, ip *net.IPAddr) (*net.IPAddr, error) { <ide> return next, nil <ide> } <ide> <del> if err := validateIP(network, ip); err != nil { <add> if err := registerIP(network, ip); err != nil { <ide> return nil, err <ide> } <ide> return ip, nil <ide> } <ide> <del>func ReleaseIP(network *net.IPNet, ip *net.IPAddr) error { <add>func ReleaseIP(network *net.IPNet, ip *net.IP) error { <ide> lock.Lock() <ide> defer lock.Unlock() <ide> <ide> n := newIPNet(network) <ide> existing := allocatedIPs[n] <ide> <del> delete(existing, ip.String()) <del> availableIPS[n][ip.String()] = struct{}{} <add> i := ipToInt(ip) <add> existing.Remove(int(i)) <add> available := availableIPS[n] <add> available.Push(int(i)) <ide> <ide> return nil <ide> } <ide> <del>func getNextIp(network *net.IPNet) (net.IPAddr, error) { <del> if available, exists := availableIPS[network]; exists { <del> return nil, nil <del> } <del> <add>func getNextIp(network *net.IPNet) (*net.IP, error) { <ide> var ( <del> firstIP, _ = networkRange(network) <del> ipNum = ipToInt(firstIP) <del> ownIP = ipToInt(network.IP) <del> size = networkSize(network.Mask) <del> n = newIPNet(network) <del> allocated = allocatedIPs[n] <del> <del> pos = int32(1) <del> max = size - 2 // -1 for the broadcast address, -1 for the gateway address <del> ip *net.IP <del> newNum int32 <del> inUse bool <add> n = newIPNet(network) <add> available = availableIPS[n] <add> next = available.Pop() <add> allocated = allocatedIPs[n] <add> ownIP = int(ipToInt(&network.IP)) <ide> ) <ide> <del> // Find first unused IP, give up after one whole round <del> for attempt := int32(0); attempt < max; attempt++ { <del> newNum = ipNum + pos <del> pos = pos%max + 1 <del> // The network's IP is never okay to use <del> if newNum == ownIP { <add> if next != 0 { <add> ip := intToIP(int32(next)) <add> allocated.Push(int(next)) <add> return ip, nil <add> } <add> size := int(networkSize(network.Mask)) <add> next = allocated.PullBack() + 1 <add> <add> // size -1 for the broadcast address, -1 for the gateway address <add> for i := 0; i < size-2; i++ { <add> if next == ownIP { <add> next++ <ide> continue <ide> } <ide> <del> ip = intToIP(newNum) <del> if _, inUse = allocated[ip.String()]; !inUse { <del> // We found an unused IP <del> break <del> } <del> } <add> ip := intToIP(int32(next)) <add> allocated.Push(next) <ide> <del> if ip == nil { <del> return nil, ErrNoAvailableIps <add> return ip, nil <ide> } <del> allocated[ip.String()] = struct{}{} <del> <del> return ip, nil <add> return nil, ErrNoAvailableIps <ide> } <ide> <del>func validateIP(network *net.IPNet, ip *net.IPAddr) error { <del> <add>func registerIP(network *net.IPNet, ip *net.IP) error { <add> existing := allocatedIPs[newIPNet(network)] <add> if existing.Exists(int(ipToInt(ip))) { <add> return ErrIPAlreadyAllocated <add> } <add> return nil <ide> } <ide> <ide> func checkRouteOverlaps(networks []netlink.Route, toCheck *net.IPNet) error { <ide> func checkExistingNetworkOverlaps(network *net.IPNet) error { <ide> if newIPNet(network) == existing { <ide> return ErrNetworkAlreadyRegisterd <ide> } <del> if networkOverlaps(network, existing) { <add> <add> ex := newNetIPNet(existing) <add> if networkOverlaps(network, ex) { <ide> return ErrNetworkAlreadyAllocated <ide> } <ide> } <ide> func newNetIPNet(network iPNet) *net.IPNet { <ide> } <ide> <ide> // Converts a 4 bytes IP into a 32 bit integer <del>func ipToInt(ip net.IP) int32 { <add>func ipToInt(ip *net.IP) int32 { <ide> return int32(binary.BigEndian.Uint32(ip.To4())) <ide> } <ide> <ide> // Converts 32 bit integer into a 4 bytes IP address <del>func intToIP(n int32) net.IP { <add>func intToIP(n int32) *net.IP { <ide> b := make([]byte, 4) <ide> binary.BigEndian.PutUint32(b, uint32(n)) <del> return net.IP(b) <add> ip := net.IP(b) <add> return &ip <ide> } <ide> <ide> // Given a netmask, calculates the number of available hosts <ide><path>networkdriver/portallocator/allocator_test.go <add>package ipallocator <add> <add>import ( <add> "net" <add> "testing" <add>) <add> <add>func TestRegisterNetwork(t *testing.T) { <add> network := &net.IPNet{ <add> IP: []byte{192, 168, 0, 1}, <add> Mask: []byte{255, 255, 255, 0}, <add> } <add> <add> if err := RegisterNetwork(network); err != nil { <add> t.Fatal(err) <add> } <add> <add> n := newIPNet(network) <add> if _, exists := allocatedIPs[n]; !exists { <add> t.Fatal("IPNet should exist in allocated IPs") <add> } <add> <add> if _, exists := availableIPS[n]; !exists { <add> t.Fatal("IPNet should exist in available IPs") <add> } <add>} <ide><path>networkdriver/portallocator/ipset.go <ide> import ( <ide> // iPSet is a thread-safe sorted set and a stack. <ide> type iPSet struct { <ide> sync.RWMutex <del> set []int32 <add> set []int <ide> } <ide> <ide> // Push takes a string and adds it to the set. If the elem aready exists, it has no effect. <del>func (s *iPSet) Push(elem int32) { <add>func (s *iPSet) Push(elem int) { <ide> s.RLock() <del> for i, e := range s.set { <add> for _, e := range s.set { <ide> if e == elem { <ide> s.RUnlock() <ide> return <ide> func (s *iPSet) Push(elem int32) { <ide> } <ide> <ide> // Pop is an alias to PopFront() <del>func (s *iPSet) Pop() int32 { <add>func (s *iPSet) Pop() int { <ide> return s.PopFront() <ide> } <ide> <ide> // Pop returns the first elemen from the list and removes it. <ide> // If the list is empty, it returns 0 <del>func (s *iPSet) PopFront() int32 { <add>func (s *iPSet) PopFront() int { <ide> s.RLock() <ide> <ide> for i, e := range s.set { <ide> func (s *iPSet) PopFront() int32 { <ide> s.Lock() <ide> s.set = append(s.set[:i], s.set[i+1:]...) <ide> s.Unlock() <del> return e <add> return ret <ide> } <ide> s.RUnlock() <del> return "" <add> <add> return 0 <ide> } <ide> <ide> // PullBack retrieve the last element of the list. <ide> // The element is not removed. <ide> // If the list is empty, an empty element is returned. <del>func (s *iPSet) PullBack() int32 { <add>func (s *iPSet) PullBack() int { <ide> if len(s.set) == 0 { <del> return "" <add> return 0 <ide> } <ide> return s.set[len(s.set)-1] <ide> } <ide> <ide> // Exists checks if the given element present in the list. <del>func (s *iPSet) Exists(elem int32) bool { <add>func (s *iPSet) Exists(elem int) bool { <ide> for _, e := range s.set { <ide> if e == elem { <ide> return true <ide> func (s *iPSet) Exists(elem int32) bool { <ide> <ide> // Remove removes an element from the list. <ide> // If the element is not found, it has no effect. <del>func (s *iPSet) Remove(elem int32) { <add>func (s *iPSet) Remove(elem int) { <ide> for i, e := range s.set { <ide> if e == elem { <ide> s.set = append(s.set[:i], s.set[i+1:]...)
3
PHP
PHP
implement hasmethod() and call()
6fa2d9decda2643a91203d9777180e6af4d82730
<ide><path>Cake/Cache/CacheRegistry.php <ide> protected function _throwMissingClassError($class, $plugin) { <ide> * <ide> * Part of the template method for Cake\Utility\ObjectRegistry::load() <ide> * @param string|CacheEngine $class The classname or object to make. <add> * @param string $alias The alias of the object. <ide> * @param array $settings An array of settings to use for the cache engine. <ide> * @return CacheEngine The constructed CacheEngine class. <ide> * @throws Cake\Error\Exception when an object doesn't implement <ide> * the correct interface. <ide> */ <del> protected function _create($class, $settings) { <add> protected function _create($class, $alias, $settings) { <ide> if (is_object($class)) { <ide> $instance = $class; <ide> } <ide><path>Cake/Console/TaskRegistry.php <ide> protected function _throwMissingClassError($class, $plugin) { <ide> * <ide> * Part of the template method for Cake\Utility\ObjectRegistry::load() <ide> * <del> * @param string $class The classname that is missing. <add> * @param string $class The classname to create. <add> * @param string $alias The alias of the task. <ide> * @param array $settings An array of settings to use for the task. <ide> * @return Component The constructed task class. <ide> */ <del> protected function _create($class, $settings) { <add> protected function _create($class, $alias, $settings) { <ide> return new $class( <ide> $this->_Shell->stdout, <ide> $this->_Shell->stderr, <ide><path>Cake/Controller/ComponentRegistry.php <ide> protected function _throwMissingClassError($class, $plugin) { <ide> * Part of the template method for Cake\Utility\ObjectRegistry::load() <ide> * Enabled components will be registered with the event manager. <ide> * <del> * @param string $class The classname that is missing. <add> * @param string $class The classname to create. <add> * @param string $alias The alias of the component. <ide> * @param array $settings An array of settings to use for the component. <ide> * @return Component The constructed component class. <ide> */ <del> protected function _create($class, $settings) { <add> protected function _create($class, $alias, $settings) { <ide> $instance = new $class($this, $settings); <ide> $enable = isset($settings['enabled']) ? $settings['enabled'] : true; <ide> if ($enable) { <ide><path>Cake/Database/ConnectionRegistry.php <ide> protected function _throwMissingClassError($class, $plugin) { <ide> * Part of the template method for Cake\Utility\ObjectRegistry::load() <ide> * <ide> * @param string|Driver $class The classname or object to make. <add> * @param string $alias The alias of the object. <ide> * @param array $settings An array of settings to use for the driver. <ide> * @return Connection A connection with the correct driver. <ide> */ <del> protected function _create($class, $settings) { <add> protected function _create($class, $alias, $settings) { <ide> if (is_object($class)) { <ide> $instance = $class; <ide> } <ide><path>Cake/Log/LogEngineRegistry.php <ide> protected function _throwMissingClassError($class, $plugin) { <ide> * <ide> * Part of the template method for Cake\Utility\ObjectRegistry::load() <ide> * @param string|LogInterface $class The classname or object to make. <add> * @param string $alias The alias of the object. <ide> * @param array $settings An array of settings to use for the logger. <ide> * @return LogEngine The constructed logger class. <ide> * @throws Cake\Error\Exception when an object doesn't implement <ide> * the correct interface. <ide> */ <del> protected function _create($class, $settings) { <add> protected function _create($class, $alias, $settings) { <ide> if (is_object($class)) { <ide> $instance = $class; <ide> } <ide><path>Cake/ORM/BehaviorRegistry.php <ide> <ide> use Cake\Core\App; <ide> use Cake\Error; <add>use Cake\ORM\Behavior; <ide> use Cake\ORM\Table; <ide> use Cake\Utility\ObjectRegistry; <ide> <ide> class BehaviorRegistry extends ObjectRegistry { <ide> */ <ide> protected $_eventManager; <ide> <add>/** <add> * Method mappings. <add> * <add> * @var array <add> */ <add> protected $_methodMap = []; <add> <ide> /** <ide> * Constructor <ide> * <ide> protected function _throwMissingClassError($class, $plugin) { <ide> * Enabled behaviors will be registered with the event manager. <ide> * <ide> * @param string $class The classname that is missing. <add> * @param string $alias The alias of the object. <ide> * @param array $settings An array of settings to use for the behavior. <ide> * @return Component The constructed behavior class. <ide> */ <del> protected function _create($class, $settings) { <add> protected function _create($class, $alias, $settings) { <ide> $instance = new $class($this->_table, $settings); <ide> $enable = isset($settings['enabled']) ? $settings['enabled'] : true; <ide> if ($enable) { <ide> $this->_eventManager->attach($instance); <ide> } <add> $this->_mapMethods($instance, $class, $alias); <add> return $instance; <add> } <add> <add>/** <add> * Store the map of behavior methods and ensure there are no duplicates. <add> * <add> * Use the implementedEvents() method to exclude callback methods. <add> * <add> * @param Cake\ORM\Behavior $instance <add> * @return void <add> */ <add> protected function _mapMethods(Behavior $instance, $class, $alias) { <add> $events = $instance->implementedEvents(); <add> $methods = get_class_methods($instance); <add> foreach ($events as $e => $binding) { <add> if (is_array($binding) && isset($binding['callable']) && isset($binding['callable'])) { <add> $binding = $binding['callable']; <add> } <add> $index = array_search($binding, $methods); <add> unset($methods[$index]); <add> } <add> <add> foreach ($methods as $method) { <add> if (isset($this->_methodMap[$method])) { <add> $message = '%s contains duplicate method "%s" which is already provided by %s'; <add> $error = __d('cake_dev', $message, $class, $method, $this->_methodMap[$method]); <add> throw new Error\Exception($error); <add> } <add> $this->_methodMap[$method] = $alias; <add> } <ide> return $instance; <ide> } <ide> <ide> protected function _create($class, $settings) { <ide> * @return boolean <ide> */ <ide> public function hasMethod($method) { <add> return isset($this->_methodMap[$method]); <ide> } <ide> <ide> /** <ide> * Invoke a method on a behavior. <ide> * <ide> * @param string $method The method to invoke. <del> * @param mixed $args The arguments you want to invoke the method with should <del> * be provided as the remaining arguments to call() <add> * @param array $args The arguments you want to invoke the method with. <ide> * @return mixed The return value depends on the underlying behavior method. <ide> */ <del> public function call($method) { <add> public function call($method, array $args = []) { <add> if (!$this->hasMethod($method)) { <add> return false; <add> } <add> $alias = $this->_methodMap[$method]; <add> return call_user_func_array([$this->_loaded[$alias], $method], $args); <ide> } <ide> <ide> } <ide><path>Cake/Test/TestApp/Model/Behavior/SluggableBehavior.php <ide> public function findNoSlug(Query $query, $options = []) { <ide> return $query; <ide> } <ide> <del> public function slugify(Table $table, $value) { <add> public function slugify($value) { <ide> return Inflector::slug($value); <ide> } <ide> <ide><path>Cake/Test/TestCase/ORM/BehaviorRegistryTest.php <ide> public function tearDown() { <ide> * @return void <ide> */ <ide> public function testLoad() { <del> $settings = ['replacement' => '-']; <add> $settings = ['alias' => 'Sluggable', 'replacement' => '-']; <ide> $result = $this->Behaviors->load('Sluggable', $settings); <ide> $this->assertInstanceOf('TestApp\Model\Behavior\SluggableBehavior', $result); <ide> $this->assertEquals($settings, $result->settings); <ide> public function testLoadMissingClass() { <ide> * Test load() duplicate method error <ide> * <ide> * @expectedException Cake\Error\Exception <del> * @expectedExceptionMessage TestApp\Model\Behavior\DuplicateBehavior contains duplicate method "dupe" <add> * @expectedExceptionMessage TestApp\Model\Behavior\DuplicateBehavior contains duplicate method "slugify" <ide> * @return void <ide> */ <ide> public function testLoadDuplicateMethodError() { <ide> public function testHasMethod() { <ide> */ <ide> public function testCall() { <ide> $this->Behaviors->load('Sluggable'); <del> $result = $this->Behaviors->call('slugify', 'some value'); <add> $result = $this->Behaviors->call('nope'); <add> $this->assertFalse($result); <add> <add> $result = $this->Behaviors->call('slugify', ['some value']); <ide> $this->assertEquals('some_value', $result); <ide> } <ide> <ide><path>Cake/Utility/ObjectRegistry.php <ide> public function load($objectName, $settings = []) { <ide> if (!$className) { <ide> $this->_throwMissingClassError($objectName, substr($plugin, 0, -1)); <ide> } <del> $instance = $this->_create($className, $settings); <add> $instance = $this->_create($className, $name, $settings); <ide> $this->_loaded[$name] = $instance; <ide> return $instance; <ide> } <ide> abstract protected function _throwMissingClassError($class, $plugin); <ide> * required. <ide> * <ide> * @param string $class The class to build. <add> * @param string $alias The alias of the object. <ide> * @param array $settings The settings for construction <ide> * @return mixed <ide> */ <del> abstract protected function _create($class, $settings); <add> abstract protected function _create($class, $alias, $settings); <ide> <ide> /** <ide> * Get the loaded object list, or get the object instance at a given name. <ide><path>Cake/View/HelperRegistry.php <ide> protected function _throwMissingClassError($class, $plugin) { <ide> * Part of the template method for Cake\Utility\ObjectRegistry::load() <ide> * Enabled helpers will be registered with the event manager. <ide> * <del> * @param string $class The classname that is missing. <add> * @param string $class The class to create. <add> * @param string $alias The alias of the loaded helper. <ide> * @param array $settings An array of settings to use for the helper. <ide> * @return Component The constructed helper class. <ide> */ <del> protected function _create($class, $settings) { <add> protected function _create($class, $alias, $settings) { <ide> $instance = new $class($this->_View, $settings); <ide> $vars = array('request', 'theme', 'plugin'); <ide> foreach ($vars as $var) {
10
Go
Go
remove unuset setuptest()
4b13f69882a4b5583175b4f55e8976413db9d3a7
<ide><path>integration/network/ipvlan/main_test.go <ide> func TestMain(m *testing.M) { <ide> testEnv.Print() <ide> os.Exit(m.Run()) <ide> } <del> <del>func setupTest(t *testing.T) func() { <del> environment.ProtectAll(t, testEnv) <del> return func() { testEnv.Clean(t) } <del>} <ide><path>integration/network/macvlan/main_test.go <ide> func TestMain(m *testing.M) { <ide> testEnv.Print() <ide> os.Exit(m.Run()) <ide> } <del> <del>func setupTest(t *testing.T) func() { <del> environment.ProtectAll(t, testEnv) <del> return func() { testEnv.Clean(t) } <del>}
2
Python
Python
remove unused code `app.run()`
928c88995cd250c4f23dc269c957feb9a2f2e827
<ide><path>rebar/utils.py <ide> def logSumExp(t, axis=0, keep_dims = False): <ide> return tf.expand_dims(res, axis) <ide> else: <ide> return res <del> <del>if __name__ == '__main__': <del> app.run()
1
PHP
PHP
use safe container getter on pipeline carry
97b2899ed23cb2ddd679702c349108c375525c99
<ide><path>src/Illuminate/Pipeline/Pipeline.php <ide> protected function carry() <ide> : $pipe(...$parameters); <ide> <ide> return $response instanceof Responsable <del> ? $response->toResponse($this->container->make(Request::class)) <add> ? $response->toResponse($this->getContainer()->make(Request::class)) <ide> : $response; <ide> }; <ide> };
1
PHP
PHP
add typehint for factory
93e078a79dd3e6d5a74d767da30ea1483919161a
<ide><path>database/factories/ModelFactory.php <ide> | database. Just tell the factory how a default model should look. <ide> | <ide> */ <del> <add>/** @var $factory \Illuminate\Database\Eloquent\Factory */ <ide> $factory->define(App\User::class, function (Faker\Generator $faker) { <ide> static $password; <ide>
1
Javascript
Javascript
move mkdtemp* functions near static functions
79a5eb1a65199bdaa359d3b4d1ac102d1e284078
<ide><path>lib/fs.js <ide> fs.realpath = function realpath(path, options, callback) { <ide> }; <ide> <ide> <add>fs.mkdtemp = function(prefix, options, callback_) { <add> var callback = maybeCallback(callback_); <add> if (!prefix || typeof prefix !== 'string') <add> throw new TypeError('filename prefix is required'); <add> <add> options = options || {}; <add> if (typeof options === 'function') { <add> callback = options; <add> options = {}; <add> } else if (typeof options === 'string') { <add> options = {encoding: options}; <add> } <add> if (typeof options !== 'object') <add> throw new TypeError('"options" must be a string or an object'); <add> <add> if (!nullCheck(prefix, callback)) { <add> return; <add> } <add> <add> var req = new FSReqWrap(); <add> req.oncomplete = callback; <add> <add> binding.mkdtemp(prefix + 'XXXXXX', options.encoding, req); <add>}; <add> <add> <add>fs.mkdtempSync = function(prefix, options) { <add> if (!prefix || typeof prefix !== 'string') <add> throw new TypeError('filename prefix is required'); <add> <add> options = options || {}; <add> if (typeof options === 'string') <add> options = {encoding: options}; <add> if (typeof options !== 'object') <add> throw new TypeError('"options" must be a string or an object'); <add> nullCheck(prefix); <add> <add> return binding.mkdtemp(prefix + 'XXXXXX', options.encoding); <add>}; <add> <add> <ide> var pool; <ide> <ide> function allocNewPool(poolSize) { <ide> SyncWriteStream.prototype.destroy = function() { <ide> }; <ide> <ide> SyncWriteStream.prototype.destroySoon = SyncWriteStream.prototype.destroy; <del> <del>fs.mkdtemp = function(prefix, options, callback_) { <del> var callback = maybeCallback(callback_); <del> if (!prefix || typeof prefix !== 'string') <del> throw new TypeError('filename prefix is required'); <del> <del> options = options || {}; <del> if (typeof options === 'function') { <del> callback = options; <del> options = {}; <del> } else if (typeof options === 'string') { <del> options = {encoding: options}; <del> } <del> if (typeof options !== 'object') <del> throw new TypeError('"options" must be a string or an object'); <del> <del> if (!nullCheck(prefix, callback)) { <del> return; <del> } <del> <del> var req = new FSReqWrap(); <del> req.oncomplete = callback; <del> <del> binding.mkdtemp(prefix + 'XXXXXX', options.encoding, req); <del>}; <del> <del>fs.mkdtempSync = function(prefix, options) { <del> if (!prefix || typeof prefix !== 'string') <del> throw new TypeError('filename prefix is required'); <del> <del> options = options || {}; <del> if (typeof options === 'string') <del> options = {encoding: options}; <del> if (typeof options !== 'object') <del> throw new TypeError('"options" must be a string or an object'); <del> nullCheck(prefix); <del> <del> return binding.mkdtemp(prefix + 'XXXXXX', options.encoding); <del>};
1
PHP
PHP
add gate authorize tests
367e456bcbf73b16f60fababd366a21db802b14d
<ide><path>tests/Auth/AuthAccessGateTest.php <ide> <ide> use Illuminate\Auth\Access\Gate; <ide> use Illuminate\Container\Container; <add>use Illuminate\Auth\Access\Response; <add>use Illuminate\Auth\Access\HandlesAuthorization; <ide> <ide> class GateTest extends PHPUnit_Framework_TestCase <ide> { <ide> public function test_policy_default_to_false_if_method_does_not_exist() <ide> <ide> public function test_policy_classes_can_be_defined_to_handle_checks_for_given_class_name() <ide> { <del> $gate = $this->getBasicGate(); <add> $gate = $this->getBasicGate(true); <ide> <ide> $gate->policy(AccessGateTestDummy::class, AccessGateTestPolicy::class); <ide> <ide> public function test_for_user_method_attaches_a_new_user_to_a_new_gate_instance( <ide> $this->assertTrue($gate->forUser((object) ['id' => 2])->check('foo')); <ide> } <ide> <del> protected function getBasicGate() <add> /** <add> * @expectedException \Illuminate\Auth\Access\UnauthorizedException <add> */ <add> public function test_authorize_throws_unauthorized_exception() <add> { <add> $gate = $this->getBasicGate(); <add> <add> $gate->policy(AccessGateTestDummy::class, AccessGateTestPolicy::class); <add> <add> $gate->authorize('create', new AccessGateTestDummy); <add> } <add> <add> public function test_authorize_returns_allowed_response() <add> { <add> $gate = $this->getBasicGate(true); <add> <add> $gate->policy(AccessGateTestDummy::class, AccessGateTestPolicy::class); <add> <add> $check = $gate->check('create', new AccessGateTestDummy); <add> $response = $gate->authorize('create', new AccessGateTestDummy); <add> <add> $this->assertInstanceOf(Response::class, $response); <add> $this->assertNull($response->message()); <add> $this->assertTrue($check); <add> } <add> <add> public function test_authorize_returns_an_allowed_response_for_a_truthy_return() <add> { <add> $gate = $this->getBasicGate(); <add> <add> $gate->policy(AccessGateTestDummy::class, AccessGateTestPolicy::class); <add> <add> $response = $gate->authorize('update', new AccessGateTestDummy); <add> <add> $this->assertInstanceOf(Response::class, $response); <add> $this->assertNull($response->message()); <add> } <add> <add> protected function getBasicGate($isAdmin = false) <ide> { <del> return new Gate(new Container, function () { return (object) ['id' => 1]; }); <add> return new Gate(new Container, function () use ($isAdmin) { <add> return (object) ['id' => 1, 'isAdmin' => $isAdmin]; <add> }); <ide> } <ide> } <ide> <ide> class AccessGateTestDummy <ide> <ide> class AccessGateTestPolicy <ide> { <add> use HandlesAuthorization; <add> <ide> public function create($user) <ide> { <del> return true; <add> return $user->isAdmin ? $this->allow() : $this->deny('You are not an admin.'); <ide> } <ide> <ide> public function update($user, AccessGateTestDummy $dummy) <ide> { <del> return $user instanceof StdClass; <add> return ! $user->isAdmin; <ide> } <ide> } <ide>
1
Text
Text
use sentence-case for headers in security.md
360bf9b289e371a2723a7a045ae9389e41294717
<ide><path>SECURITY.md <ide> # Security <ide> <del>## Reporting a Bug in Node.js <add>## Reporting a bug in Node.js <ide> <ide> Report security bugs in Node.js via [HackerOne](https://hackerone.com/nodejs). <ide> <ide> you informed of the progress being made towards a fix and full announcement, <ide> and may ask for additional information or guidance surrounding the reported <ide> issue. <ide> <del>### Node.js Bug Bounty Program <add>### Node.js bug bounty program <ide> <ide> The Node.js project engages in an official bug bounty program for security <ide> researchers and responsible public disclosures. The program is managed through <ide> the HackerOne platform. See <https://hackerone.com/nodejs> for further details. <ide> <del>## Reporting a Bug in a third party module <add>## Reporting a bug in a third party module <ide> <ide> Security bugs in third party modules should be reported to their respective <ide> maintainers and should also be coordinated through the Node.js Ecosystem <ide> Details regarding this process can be found in the <ide> Thank you for improving the security of Node.js and its ecosystem. Your efforts <ide> and responsible disclosure are greatly appreciated and will be acknowledged. <ide> <del>## Disclosure Policy <add>## Disclosure policy <ide> <ide> Here is the security disclosure policy for Node.js <ide> <ide> Here is the security disclosure policy for Node.js <ide> the release process above to ensure that the disclosure is handled in a <ide> consistent manner. <ide> <del>## Receiving Security Updates <add>## Receiving security updates <ide> <ide> Security notifications will be distributed via the following methods. <ide> <ide> * <https://groups.google.com/group/nodejs-sec> <ide> * <https://nodejs.org/en/blog/> <ide> <del>## Comments on this Policy <add>## Comments on this policy <ide> <ide> If you have suggestions on how this process could be improved please submit a <ide> [pull request](https://github.com/nodejs/nodejs.org) or
1
Python
Python
fix ticket #390
ff52d4cebbc04639123e1ace44c26413ca050e49
<ide><path>numpy/core/records.py <ide> def __getitem__(self, indx): <ide> return obj.view(ndarray) <ide> return obj <ide> <add> def __repr__(self) : <add> ret = ndarray.__repr__(self) <add> return ret.replace("recarray", "rec.array", 1) <add> <ide> def field(self, attr, val=None): <ide> if isinstance(attr, int): <ide> names = ndarray.__getattribute__(self,'dtype').names
1
Javascript
Javascript
fix base64 padding regression
4231dab39f8d3769196fefede15e048f3ca09300
<ide><path>lib/crypto.js <ide> Cipher.prototype.final = function(outputEncoding) { <ide> <ide> if (outputEncoding && outputEncoding !== 'buffer') { <ide> this._decoder = getDecoder(this._decoder, outputEncoding); <del> ret = this._decoder.write(ret); <add> ret = this._decoder.end(ret); <ide> } <ide> <ide> return ret; <ide><path>test/simple/test-crypto.js <ide> assertSorted(crypto.getHashes()); <ide> var c = crypto.createDecipher('aes-128-ecb', ''); <ide> assert.throws(function() { c.final('utf8') }, /invalid public key/); <ide> })(); <add> <add>// Base64 padding regression test, see #4837. <add>(function() { <add> var c = crypto.createCipher('aes-256-cbc', 'secret'); <add> var s = c.update('test', 'utf8', 'base64') + c.final('base64'); <add> assert.equal(s, '375oxUQCIocvxmC5At+rvA=='); <add>})();
2
Python
Python
add test_connection method for sshhook
b5338b5825859355b017bed3586d5a42208f1391
<ide><path>airflow/providers/ssh/hooks/ssh.py <ide> def exec_ssh_client_command( <ide> exit_status = stdout.channel.recv_exit_status() <ide> <ide> return exit_status, agg_stdout, agg_stderr <add> <add> def test_connection(self) -> tuple[bool, str]: <add> """Test the ssh connection by execute remote bash commands""" <add> try: <add> with self.get_conn() as conn: <add> conn.exec_command("pwd") <add> return True, "Connection successfully tested" <add> except Exception as e: <add> return False, str(e) <ide><path>tests/providers/ssh/hooks/test_ssh.py <ide> def test_ssh_connection_with_no_host_key_check_true_and_allow_host_key_changes_f <ide> ssh_mock.return_value.set_missing_host_key_policy.call_args[0][0], paramiko.AutoAddPolicy <ide> ) <ide> assert ssh_mock.return_value.load_host_keys.called is False <add> <add> def test_connection_success(self): <add> hook = SSHHook(ssh_conn_id="ssh_default") <add> status, msg = hook.test_connection() <add> assert status is True <add> assert msg == "Connection successfully tested" <add> <add> def test_connection_failure(self): <add> hook = SSHHook(ssh_conn_id="ssh_default") <add> hook.get_conn = mock.MagicMock(name="mock_conn", side_effect=Exception("Test failure case")) <add> status, msg = hook.test_connection() <add> assert status is False <add> assert msg == "Test failure case"
2
Go
Go
add test for swarm error handling
d377b074fdcbf735d9fbafdb9bcab6878e5c0ae9
<ide><path>integration-cli/docker_api_swarm_test.go <ide> package main <ide> <ide> import ( <ide> "fmt" <add> "net" <ide> "net/http" <ide> "os" <ide> "path/filepath" <ide> func (s *DockerSwarmSuite) TestAPISwarmUnlockNotLocked(c *check.C) { <ide> c.Assert(err, checker.NotNil) <ide> c.Assert(err.Error(), checker.Contains, "swarm is not locked") <ide> } <add> <add>// #29885 <add>func (s *DockerSwarmSuite) TestAPISwarmErrorHandling(c *check.C) { <add> ln, err := net.Listen("tcp", fmt.Sprintf(":%d", defaultSwarmPort)) <add> c.Assert(err, checker.IsNil) <add> defer ln.Close() <add> d := s.AddDaemon(c, false, false) <add> err = d.Init(swarm.InitRequest{}) <add> c.Assert(err, checker.NotNil) <add> c.Assert(err.Error(), checker.Contains, "address already in use") <add>}
1
Python
Python
update cifar10 example
dab55518bacc70c2f44ca11787c346b821343316
<ide><path>examples/cifar10_cnn.py <ide> X_test = X_test.astype("float32") <ide> X_train /= 255 <ide> X_test /= 255 <del> model.fit(X_train, Y_train, batch_size=batch_size, nb_epoch=10) <add> model.fit(X_train, Y_train, batch_size=batch_size, nb_epoch=nb_epoch) <ide> score = model.evaluate(X_test, Y_test, batch_size=batch_size) <ide> print('Test score:', score) <ide> <ide> # batch train with realtime data augmentation <ide> progbar = generic_utils.Progbar(X_train.shape[0]) <ide> for X_batch, Y_batch in datagen.flow(X_train, Y_train): <del> loss = model.train(X_batch, Y_batch) <add> loss = model.train_on_batch(X_batch, Y_batch) <ide> progbar.add(X_batch.shape[0], values=[("train loss", loss)]) <ide> <ide> print("Testing...") <ide> # test time! <ide> progbar = generic_utils.Progbar(X_test.shape[0]) <ide> for X_batch, Y_batch in datagen.flow(X_test, Y_test): <del> score = model.test(X_batch, Y_batch) <add> score = model.test_on_batch(X_batch, Y_batch) <ide> progbar.add(X_batch.shape[0], values=[("test loss", score)]) <ide> <ide>
1
Python
Python
set version to v2.0.18.dev1
e1a4b0d7f7d9e860dce794e07aadedea193d470e
<ide><path>spacy/about.py <ide> # https://github.com/pypa/warehouse/blob/master/warehouse/__about__.py <ide> <ide> __title__ = 'spacy' <del>__version__ = '2.0.18' <add>__version__ = '2.0.18.dev1' <ide> __summary__ = 'Industrial-strength Natural Language Processing (NLP) with Python and Cython' <ide> __uri__ = 'https://spacy.io' <ide> __author__ = 'Explosion AI' <ide> __email__ = 'contact@explosion.ai' <ide> __license__ = 'MIT' <del>__release__ = True <add>__release__ = False <ide> <ide> __download_url__ = 'https://github.com/explosion/spacy-models/releases/download' <ide> __compatibility__ = 'https://raw.githubusercontent.com/explosion/spacy-models/master/compatibility.json'
1
PHP
PHP
remove more deprecations, cleaner typehinting
6956d782ca7896717988664b50fd9ea6b01b37fe
<ide><path>src/View/Helper/PaginatorHelper.php <ide> public function total($model = null) <ide> * Gets the current key by which the recordset is sorted <ide> * <ide> * @param string|null $model Optional model name. Uses the default if none is specified. <del> * @param array $options Options for pagination links. See #options for list of keys. <add> * @param array $options Options for pagination links. <ide> * @return string|null The name of the key by which the recordset is being sorted, or <ide> * null if the results are not currently sorted. <ide> * @link https://book.cakephp.org/3.0/en/views/helpers/paginator.html#creating-sort-links <ide> public function sortKey($model = null, array $options = []) <ide> * Gets the current direction the recordset is sorted <ide> * <ide> * @param string|null $model Optional model name. Uses the default if none is specified. <del> * @param array $options Options for pagination links. See #options for list of keys. <add> * @param array $options Options for pagination links. <ide> * @return string The direction by which the recordset is being sorted, or <ide> * null if the results are not currently sorted. <ide> * @link https://book.cakephp.org/3.0/en/views/helpers/paginator.html#creating-sort-links <ide> public function hasNext($model = null) <ide> */ <ide> public function hasPage($model = null, $page = 1) <ide> { <del> if (is_numeric($model)) { <del> $page = $model; <del> $model = null; <del> } <ide> $paging = $this->params($model); <ide> if ($paging === []) { <ide> return false; <ide> public function defaultModel($model = null) <ide> * the following placeholders `{{page}}`, `{{pages}}`, `{{current}}`, `{{count}}`, `{{model}}`, `{{start}}`, `{{end}}` and any <ide> * custom content you would like. <ide> * <del> * @param string|array $options Options for the counter string. See #options for list of keys. <add> * @param array $options Options for the counter string. See #options for list of keys. <ide> * If string it will be used as format. <ide> * @return string Counter string. <ide> * @link https://book.cakephp.org/3.0/en/views/helpers/paginator.html#creating-a-page-counter <ide> */ <del> public function counter($options = []) <add> public function counter(array $options = []) <ide> { <del> if (is_string($options)) { <del> $options = ['format' => $options]; <del> } <del> <ide> $options += [ <ide> 'model' => $this->defaultModel(), <ide> 'format' => 'pages', <ide> public function limitControl(array $limits = [], $default = null, array $options <ide> { <ide> $out = $this->Form->create(null, ['type' => 'get']); <ide> <del> if (empty($default) || !is_numeric($default)) { <add> if (empty($default)) { <ide> $default = $this->param('perPage'); <ide> } <ide> <ide><path>tests/TestCase/View/Helper/PaginatorHelperTest.php <ide> public function testCounter() <ide> <ide> $expected = 'Page 1 of 5, showing 3 records out of 13 total, starting on record 1, '; <ide> $expected .= 'ending on 3'; <del> $result = $this->Paginator->counter($input); <add> $result = $this->Paginator->counter(['format' => $input]); <ide> $this->assertEquals($expected, $result); <ide> <ide> $result = $this->Paginator->counter(['format' => 'pages']); <ide> public function testCounter() <ide> $expected = '1 - 3 of 13'; <ide> $this->assertEquals($expected, $result); <ide> <del> $result = $this->Paginator->counter('Showing {{page}} of {{pages}} {{model}}'); <add> $result = $this->Paginator->counter(['format' => 'Showing {{page}} of {{pages}} {{model}}']); <ide> $this->assertEquals('Showing 1 of 5 clients', $result); <ide> } <ide> <ide> public function testCounterBigNumbers() <ide> <ide> $expected = 'Page 1,523 of 1,600, showing 3,000 records out of 4,800,001 total, '; <ide> $expected .= 'starting on record 4,566,001, ending on 4,569,001'; <del> $result = $this->Paginator->counter($input); <add> $result = $this->Paginator->counter(['format' => $input]); <ide> $this->assertEquals($expected, $result); <ide> <ide> I18n::setLocale('de-DE'); <ide> $expected = 'Page 1.523 of 1.600, showing 3.000 records out of 4.800.001 total, '; <ide> $expected .= 'starting on record 4.566.001, ending on 4.569.001'; <del> $result = $this->Paginator->counter($input); <add> $result = $this->Paginator->counter(['format' => $input]); <ide> $this->assertEquals($expected, $result); <ide> } <ide> <ide> public function testHasPage() <ide> $result = $this->Paginator->hasPage('Article', 2); <ide> $this->assertTrue($result); <ide> <del> $result = $this->Paginator->hasPage(2); <add> $result = $this->Paginator->hasPage(null, 2); <ide> $this->assertTrue($result); <ide> } <ide>
2
Python
Python
fix flaubert gpu test
ec0267475c16a1913e64cb4f81fd54d153e3d815
<ide><path>src/transformers/modeling_flaubert.py <ide> def forward( <ide> else: <ide> bs, slen = inputs_embeds.size()[:-1] <ide> <add> device = input_ids.device if input_ids is not None else inputs_embeds.device <add> <ide> if lengths is None: <ide> if input_ids is not None: <ide> lengths = (input_ids != self.pad_index).sum(dim=1).long() <ide> else: <del> lengths = torch.LongTensor([slen] * bs) <add> lengths = torch.tensor([slen] * bs, device=device) <ide> # mask = input_ids != self.pad_index <ide> <ide> # check inputs <ide> def forward( <ide> # if self.is_decoder and src_enc is not None: <ide> # src_mask = torch.arange(src_len.max(), dtype=torch.long, device=lengths.device) < src_len[:, None] <ide> <del> device = input_ids.device if input_ids is not None else inputs_embeds.device <del> <ide> # position_ids <ide> if position_ids is None: <ide> position_ids = torch.arange(slen, dtype=torch.long, device=device)
1
PHP
PHP
fix viewtask not correctly handling plugin models
96a1f36516257ffea22af2948fc32cddeac70c57
<ide><path>src/Console/Command/Task/ViewTask.php <ide> class ViewTask extends BakeTask { <ide> public $controllerClass = null; <ide> <ide> /** <del> * Name of the table views are being baked against. <add> * Name with plugin of the model being used <ide> * <ide> * @var string <ide> */ <del> public $tableName = null; <add> public $modelName = null; <ide> <ide> /** <ide> * The template file to use <ide> public function main($name = null, $template = null, $action = null) { <ide> $controller = $this->params['controller']; <ide> } <ide> $this->controller($name, $controller); <add> $this->model($name); <ide> <ide> if (isset($template)) { <ide> $this->template = $template; <ide> public function main($name = null, $template = null, $action = null) { <ide> } <ide> } <ide> <add>/** <add> * Set the model class for the table. <add> * <add> * @param string $table The table/model that is being baked. <add> * @return void <add> */ <add> public function model($table) { <add> $tableName = $this->_controllerName($table); <add> $plugin = null; <add> if (!empty($this->params['plugin'])) { <add> $plugin = $this->params['plugin'] . '.'; <add> } <add> $this->modelName = $plugin . $tableName; <add> } <add> <ide> /** <ide> * Set the controller related properties. <ide> * <ide> public function main($name = null, $template = null, $action = null) { <ide> * @return void <ide> */ <ide> public function controller($table, $controller = null) { <del> $this->tableName = $this->_controllerName($table); <add> $tableName = $this->_controllerName($table); <ide> if (empty($controller)) { <del> $controller = $this->tableName; <add> $controller = $tableName; <ide> } <ide> $this->controllerName = $controller; <ide> <ide> public function all() { <ide> * @return array Returns an variables to be made available to a view template <ide> */ <ide> protected function _loadController() { <del> $modelObj = TableRegistry::get($this->tableName); <add> $modelObj = TableRegistry::get($this->modelName); <ide> <ide> $primaryKey = (array)$modelObj->primaryKey(); <ide> $displayField = $modelObj->displayField(); <ide><path>tests/TestCase/Console/Command/Task/ViewTaskTest.php <ide> class ViewTaskTest extends TestCase { <ide> * <ide> * @var array <ide> */ <del> public $fixtures = array('core.article', 'core.post', 'core.comment', 'core.articles_tag', 'core.tag'); <add> public $fixtures = array( <add> 'core.article', 'core.post', 'core.comment', <add> 'core.articles_tag', 'core.tag', 'core.test_plugin_comment'); <ide> <ide> /** <ide> * setUp method <ide> public function testController() { <ide> public function testControllerVariations($name) { <ide> $this->Task->controller($name); <ide> $this->assertEquals('ViewTaskComments', $this->Task->controllerName); <del> $this->assertEquals('ViewTaskComments', $this->Task->tableName); <ide> } <ide> <ide> /** <ide> public function testControllerPlugin() { <ide> $this->Task->params['plugin'] = 'TestPlugin'; <ide> $this->Task->controller('Tests'); <ide> $this->assertEquals('Tests', $this->Task->controllerName); <del> $this->assertEquals('Tests', $this->Task->tableName); <ide> $this->assertEquals( <ide> 'TestPlugin\Controller\TestsController', <ide> $this->Task->controllerClass <ide> public function testControllerPrefix() { <ide> $this->Task->params['prefix'] = 'Admin'; <ide> $this->Task->controller('Posts'); <ide> $this->assertEquals('Posts', $this->Task->controllerName); <del> $this->assertEquals('Posts', $this->Task->tableName); <ide> $this->assertEquals( <ide> 'TestApp\Controller\Admin\PostsController', <ide> $this->Task->controllerClass <ide> public function testControllerPrefix() { <ide> $this->Task->params['plugin'] = 'TestPlugin'; <ide> $this->Task->controller('Comments'); <ide> $this->assertEquals('Comments', $this->Task->controllerName); <del> $this->assertEquals('Comments', $this->Task->tableName); <ide> $this->assertEquals( <ide> 'TestPlugin\Controller\Admin\CommentsController', <ide> $this->Task->controllerClass <ide> public function testControllerPrefix() { <ide> public function testControllerWithOverride() { <ide> $this->Task->controller('Comments', 'Posts'); <ide> $this->assertEquals('Posts', $this->Task->controllerName); <del> $this->assertEquals('Comments', $this->Task->tableName); <ide> $this->assertEquals( <ide> 'TestApp\Controller\PostsController', <ide> $this->Task->controllerClass <ide> ); <ide> } <ide> <add>/** <add> * Test the model() method. <add> * <add> * @return void <add> */ <add> public function testModel() { <add> $this->Task->model('Articles'); <add> $this->assertEquals('Articles', $this->Task->modelName); <add> <add> $this->Task->model('NotThere'); <add> $this->assertEquals('NotTheres', $this->Task->modelName); <add> } <add> <add>/** <add> * Test model() method with plugins. <add> * <add> * @return void <add> */ <add> public function testModelPlugin() { <add> $this->Task->params['plugin'] = 'TestPlugin'; <add> $this->Task->model('TestPluginComments'); <add> $this->assertEquals( <add> 'TestPlugin.TestPluginComments', <add> $this->Task->modelName <add> ); <add> } <add> <ide> /** <ide> * Test getPath() <ide> * <ide> public function testGetContentWithRoutingPrefix() { <ide> */ <ide> public function testBakeView() { <ide> $this->Task->controllerName = 'ViewTaskComments'; <del> $this->Task->tableName = 'ViewTaskComments'; <add> $this->Task->modelName = 'ViewTaskComments'; <ide> $this->Task->controllerClass = __NAMESPACE__ . '\ViewTaskCommentsController'; <ide> <ide> $this->Task->expects($this->at(0)) <ide> public function testBakeView() { <ide> */ <ide> public function testBakeEdit() { <ide> $this->Task->controllerName = 'ViewTaskComments'; <del> $this->Task->tableName = 'ViewTaskComments'; <add> $this->Task->modelName = 'ViewTaskComments'; <ide> $this->Task->controllerClass = __NAMESPACE__ . '\ViewTaskCommentsController'; <ide> <ide> $this->Task->expects($this->at(0))->method('createFile') <ide> public function testBakeEdit() { <ide> */ <ide> public function testBakeIndex() { <ide> $this->Task->controllerName = 'ViewTaskComments'; <del> $this->Task->tableName = 'ViewTaskComments'; <add> $this->Task->modelName = 'ViewTaskComments'; <ide> $this->Task->controllerClass = __NAMESPACE__ . '\ViewTaskCommentsController'; <ide> <ide> $this->Task->expects($this->at(0))->method('createFile') <ide> public function testBakeIndex() { <ide> $this->Task->bake('index', true); <ide> } <ide> <add>/** <add> * test Bake with plugins <add> * <add> * @return void <add> */ <add> public function testBakeIndexPlugin() { <add> $this->Task->controllerName = 'ViewTaskComments'; <add> $this->Task->modelName = 'TestPlugin.TestPluginComments'; <add> $this->Task->controllerClass = __NAMESPACE__ . '\ViewTaskCommentsController'; <add> $table = TableRegistry::get('TestPlugin.TestPluginComments'); <add> $table->belongsTo('Articles'); <add> <add> $this->Task->expects($this->at(0)) <add> ->method('createFile') <add> ->with( <add> $this->_normalizePath(APP . 'Template/ViewTaskComments/index.ctp'), <add> $this->stringContains('$viewTaskComment->article->id') <add> ); <add> <add> $this->Task->bake('index', true); <add> } <add> <ide> /** <ide> * test that baking a view with no template doesn't make a file. <ide> * <ide> * @return void <ide> */ <ide> public function testBakeWithNoTemplate() { <ide> $this->Task->controllerName = 'ViewTaskComments'; <del> $this->Task->tableName = 'ViewTaskComments'; <add> $this->Task->modelName = 'ViewTaskComments'; <ide> $this->Task->controllerClass = __NAMESPACE__ . '\ViewTaskCommentsController'; <ide> <ide> $this->Task->expects($this->never())->method('createFile'); <ide> public function testBakeWithNoTemplate() { <ide> */ <ide> public function testBakeActions() { <ide> $this->Task->controllerName = 'ViewTaskComments'; <del> $this->Task->tableName = 'ViewTaskComments'; <add> $this->Task->modelName = 'ViewTaskComments'; <ide> $this->Task->controllerClass = __NAMESPACE__ . '\ViewTaskCommentsController'; <ide> <ide> $this->Task->expects($this->at(0)) <ide> public function testBakeActions() { <ide> */ <ide> public function testCustomAction() { <ide> $this->Task->controllerName = 'ViewTaskComments'; <del> $this->Task->tableName = 'ViewTaskComments'; <add> $this->Task->modelName = 'ViewTaskComments'; <ide> $this->Task->controllerClass = __NAMESPACE__ . '\ViewTaskCommentsController'; <ide> <ide> $this->Task->expects($this->any())->method('in')
2
Python
Python
add seed in initialization
a1af5247e171354e8f39e577d861e63d7fa67a1e
<ide><path>run_classifier_pytorch.py <ide> def main(): <ide> type=int, <ide> default=-1, <ide> help="local_rank for distributed training on gpus") <del> <add> parser.add_argument('--seed', <add> type=int, <add> default=42, <add> help="random seed for initialization") <ide> args = parser.parse_args() <ide> <ide> processors = { <ide> def main(): <ide> n_gpu = 1 <ide> # print("Initializing the distributed backend: NCCL") <ide> print("device", device, "n_gpu", n_gpu) <del> <add> <add> random.seed(args.seed) <add> np.random.seed(args.seed) <add> torch.manual_seed(args.seed) <add> if n_gpu>0: torch.cuda.manual_seed_all(args.seed) <add> <ide> if not args.do_train and not args.do_eval: <ide> raise ValueError("At least one of `do_train` or `do_eval` must be True.") <ide> <ide><path>run_squad_pytorch.py <ide> def main(): <ide> type=int, <ide> default=-1, <ide> help="local_rank for distributed training on gpus") <add> parser.add_argument('--seed', <add> type=int, <add> default=42, <add> help="random seed for initialization") <ide> <ide> args = parser.parse_args() <ide> <ide> def main(): <ide> # print("Initializing the distributed backend: NCCL") <ide> print("device", device, "n_gpu", n_gpu) <ide> <add> random.seed(args.seed) <add> np.random.seed(args.seed) <add> torch.manual_seed(args.seed) <add> if n_gpu>0: torch.cuda.manual_seed_all(args.seed) <add> <ide> if not args.do_train and not args.do_predict: <ide> raise ValueError("At least one of `do_train` or `do_predict` must be True.") <ide>
2
Text
Text
add changes for 1.4.3
1622182737a41cf4619a514fd71529e07e82d594
<ide><path>CHANGELOG.md <add><a name="1.4.3"></a> <add># 1.4.3 foam-acceleration (2015-07-06) <add> <add> <add>## Bug Fixes <add> <add>- **$animateCss:** ensure animations execute if only a keyframeStyle is provided <add> ([97d79eec](https://github.com/angular/angular.js/commit/97d79eec80092f5fae3336c23aa881a72436de55), <add> [#12124](https://github.com/angular/angular.js/issues/12124), [#12340](https://github.com/angular/angular.js/issues/12340)) <add>- **$browser:** prevent infinite digest if changing hash when there is no hashPrefix <add> ([f81ff3be](https://github.com/angular/angular.js/commit/f81ff3beb0c9d19d494c5878086fb57476442b8b), <add> [#10423](https://github.com/angular/angular.js/issues/10423), [#12145](https://github.com/angular/angular.js/issues/12145)) <add>- **$compile:** <add> - throw error when requestng new and isolate scopes (async) <add> ([6333d65b](https://github.com/angular/angular.js/commit/6333d65b76e0796cfbab8a2953af0c8014dba2e1), <add> [#12215](https://github.com/angular/angular.js/issues/12215), [#12217](https://github.com/angular/angular.js/issues/12217)) <add> - do not write @-bound properties if attribute is not present <add> ([8a1eb162](https://github.com/angular/angular.js/commit/8a1eb1625c080445ce1e519762e1f2d4fd842b72), <add> [#12151](https://github.com/angular/angular.js/issues/12151), [#12144](https://github.com/angular/angular.js/issues/12144)) <add> - workaround for IE11 MutationObserver <add> ([f3b1d0b7](https://github.com/angular/angular.js/commit/f3b1d0b723298a5f8ea21d0704405649cce1b5fc), <add> [#11781](https://github.com/angular/angular.js/issues/11781)) <add> - exception when using "watch" as isolated scope binding variable in Firefox <add> ([a6339d30](https://github.com/angular/angular.js/commit/a6339d30d1379689da5eec9647a953f64821f8b0), <add> [#11627](https://github.com/angular/angular.js/issues/11627)) <add>- **$location:** <add> - allow navigating outside the original base URL <add> ([6903b5ec](https://github.com/angular/angular.js/commit/6903b5ec4c04ed6b7c80ef7d638c48639ccdc4bb), <add> [#11302](https://github.com/angular/angular.js/issues/11302), [#4776](https://github.com/angular/angular.js/issues/4776)) <add> - do not get caught in infinite digest in IE9 <add> ([91b60226](https://github.com/angular/angular.js/commit/91b602263b96b6fce1331208462e18eb647f4d60), <add> [#11439](https://github.com/angular/angular.js/issues/11439), [#11675](https://github.com/angular/angular.js/issues/11675), [#11935](https://github.com/angular/angular.js/issues/11935), [#12083](https://github.com/angular/angular.js/issues/12083)) <add>- **$parse:** <add> - set null reference properties to `undefined` <add> ([71fc3f4f](https://github.com/angular/angular.js/commit/71fc3f4fa0cd12eff335d57efed7c033554749f4), <add> [#12099](https://github.com/angular/angular.js/issues/12099)) <add> - set null reference properties to `undefined` <add> ([d19504a1](https://github.com/angular/angular.js/commit/d19504a179355d7801d59a8db0285a1322e04601), <add> [#11959](https://github.com/angular/angular.js/issues/11959)) <add>- **$sanitize:** dont not remove tab index property <add> ([799353c7](https://github.com/angular/angular.js/commit/799353c75de28e6fbf52dac6e0721e85b578575a), <add> [#8371](https://github.com/angular/angular.js/issues/8371), [#5853](https://github.com/angular/angular.js/issues/5853)) <add>- **compile:** assign ctrl return values correctly for multiple directives <add> ([8caf1802](https://github.com/angular/angular.js/commit/8caf1802e0e93389dec626ef35e04a302aa6c39d), <add> [#12029](https://github.com/angular/angular.js/issues/12029), [#12036](https://github.com/angular/angular.js/issues/12036)) <add>- **copy:** do not copy the same object twice <add> ([0e622f7b](https://github.com/angular/angular.js/commit/0e622f7b5bc3d5d0ab0fbc1a1bc69404bd7216d5)) <add>- **forms:** parse exponential notation in numberInputType parser <add> ([ebd0fbba](https://github.com/angular/angular.js/commit/ebd0fbba8ff90bee0cd016d574643d56a7f81ed0), <add> [#12121](https://github.com/angular/angular.js/issues/12121), [#12122](https://github.com/angular/angular.js/issues/12122)) <add>- **linky:** allow case insensitive scheme detection <add> ([8dc09e6d](https://github.com/angular/angular.js/commit/8dc09e6dabb84c2c611cdc9e40adfac989648200), <add> [#12073](https://github.com/angular/angular.js/issues/12073), [#12073](https://github.com/angular/angular.js/issues/12073)) <add>- **loader:** define isFunction <add> ([9ea52d81](https://github.com/angular/angular.js/commit/9ea52d818bcd2fb3ea8ccc85bf47f9fd5af68843)) <add>- **merge:** treat dates as atomic values instead of objects. <add> ([6cbbd966](https://github.com/angular/angular.js/commit/6cbbd966479448591f819cbf904e0a3b757613dc), <add> [#11720](https://github.com/angular/angular.js/issues/11720), [#11720](https://github.com/angular/angular.js/issues/11720)) <add>- **ngAnimate:** ensure that orphaned elements do not throw errors when animated <add> ([e4aeae0c](https://github.com/angular/angular.js/commit/e4aeae0c7303b94135e6df20e6c5e25f2aa0f586), <add> [#11975](https://github.com/angular/angular.js/issues/11975), [#12338](https://github.com/angular/angular.js/issues/12338)) <add>- **ngAria:** <add> - update `aria-valuemin/max` when `min/max` change <add> ([ebaa0f59](https://github.com/angular/angular.js/commit/ebaa0f598501702ae64d59ada0ae492eaf0e2db6), <add> [#11770](https://github.com/angular/angular.js/issues/11770), [#11774](https://github.com/angular/angular.js/issues/11774)) <add> - ensure boolean values for aria-hidden and aria-disabled <add> ([59273354](https://github.com/angular/angular.js/commit/59273354b57dd8d1ad2cd2f4740ffa8923e480f9), <add> [#11365](https://github.com/angular/angular.js/issues/11365)) <add>- **ngModel:** form validation when there is an Object.prototype enumerable value <add> ([0934b76b](https://github.com/angular/angular.js/commit/0934b76b72cec86093414834ac4cb7f0946b651d), <add> [#12066](https://github.com/angular/angular.js/issues/12066)) <add>- **ngOptions:** <add> - only watch numeric properties of an array <add> ([14638f4a](https://github.com/angular/angular.js/commit/14638f4a60053b085565e597fc74bd31cf0d372b)) <add> - do not watch properties starting with $ <add> ([34a6da24](https://github.com/angular/angular.js/commit/34a6da24c17356d4ffc70aec3f621a140a9a61ab), <add> [#11930](https://github.com/angular/angular.js/issues/11930), [#12010](https://github.com/angular/angular.js/issues/12010)) <add> - use reference check only when not using trackBy <add> ([d7dc14dc](https://github.com/angular/angular.js/commit/d7dc14dc0cdeb9c187d227e19acc8aca7df9d740), <add> [#11936](https://github.com/angular/angular.js/issues/11936), [#11996](https://github.com/angular/angular.js/issues/11996)) <add>- **orderBy:** ensure correct ordering with arrays of objects and no predicate <add> ([48e1f560](https://github.com/angular/angular.js/commit/48e1f5605edd32a63318fd78f5165c7d1f1a20f9), <add> [#11866](https://github.com/angular/angular.js/issues/11866), [#11312](https://github.com/angular/angular.js/issues/11312), [#4282](https://github.com/angular/angular.js/issues/4282)) <add> <add> <add>## Features <add> <add>- **$compile:** show module name during multidir error <add> ([351fe4b7](https://github.com/angular/angular.js/commit/351fe4b79c50a45a11af2fcd2aa7b6fd3b70058d), <add> [#11775](https://github.com/angular/angular.js/issues/11775)) <add>- **$q:** $q.resolve as an alias for $q.when <add> ([3ef52980](https://github.com/angular/angular.js/commit/3ef529806fef28b41ca4af86a330f39a95699cf6), <add> [#11944](https://github.com/angular/angular.js/issues/11944), [#11987](https://github.com/angular/angular.js/issues/11987)) <add>- **ngAria:** add option to disable role=button <add> ([1f5e42e8](https://github.com/angular/angular.js/commit/1f5e42e8821217026ef36a46d36f84d7cd32830a), <add> [#11580](https://github.com/angular/angular.js/issues/11580), [#12234](https://github.com/angular/angular.js/issues/12234)) <add> <add> <add>## Performance Improvements <add> <add>- **$compile:** avoid jquery data calls when there is no data <add> ([9efb0d5e](https://github.com/angular/angular.js/commit/9efb0d5ee961b57c8fc144a3138a15955e4010e2)) <add> <add> <add> <ide> <a name="1.4.2"></a> <ide> # 1.4.2 nebular-readjustment (2015-07-06) <ide>
1
Python
Python
remove usage of dummy_inputs
099358675899f759110ad8ccecc22c2fab9b1888
<ide><path>transformers/modeling_tf_pytorch_utils.py <ide> def load_tf2_checkpoint_in_pytorch_model(pt_model, tf_checkpoint_path, tf_inputs <ide> tf_model = tf_model_class(pt_model.config) <ide> <ide> if tf_inputs is None: <del> tf_inputs = tf.constant(DUMMY_INPUTS) <add> tf_inputs = tf_model.dummy_inputs <ide> <ide> if tf_inputs is not None: <ide> tfo = tf_model(tf_inputs, training=False) # Make sure model is built
1
PHP
PHP
fix insert queries failing with expression objects
bbbe6a9abe574113572727d5814e7c318cebabdc
<ide><path>src/Database/Expression/ValuesExpression.php <ide> public function sql(ValueBinder $generator) { <ide> foreach ($this->_values as $row) { <ide> $row = array_merge($defaults, $row); <ide> foreach ($row as $column => $value) { <add> if ($value instanceof ExpressionInterface) { <add> $value = $value->sql($generator); <add> } <ide> $type = $this->typeMap()->type($column); <ide> $generator->bind($i++, $value, $type); <ide> } <ide><path>tests/TestCase/Database/QueryTest.php <ide> public function testInsertFailureMixingTypesQueryFirst() { <ide> ->values(['name' => 'mark']); <ide> } <ide> <add>/** <add> * Test that insert can use expression objects as values. <add> * <add> * @return void <add> */ <add> public function testInsertExpressionValues() { <add> $query = new Query($this->connection); <add> $query->insert(['title']) <add> ->into('articles') <add> ->values(['title' => $query->newExpr("SELECT 'jose'")]); <add> <add> $result = $query->sql(); <add> $this->assertQuotedQuery( <add> "INSERT INTO <articles> \(<title>\) VALUES (?)", <add> $result, <add> true <add> ); <add> $result = $query->execute(); <add> $this->assertCount(1, $result); <add> } <add> <ide> /** <ide> * Tests that functions are correctly transformed and their parameters are bound <ide> * <ide><path>tests/TestCase/ORM/QueryRegressionTest.php <ide> public function testSaveWithCallbacks() { <ide> $this->assertSame($article, $articles->save($article)); <ide> } <ide> <add>/** <add> * Test that save() works with entities containing expressions <add> * as properties. <add> * <add> * @return void <add> */ <add> public function testSaveWithExpressionProperty() { <add> $articles = TableRegistry::get('Articles'); <add> $article = $articles->newEntity(); <add> $article->title = new \Cake\Database\Expression\QueryExpression("SELECT 'jose'"); <add> $this->assertSame($article, $articles->save($article)); <add> } <add> <ide> /** <ide> * Tests that whe saving deep associations for a belongsToMany property, <ide> * data is not removed becuase of excesive associations filtering.
3
Python
Python
remove unnecessary try / except blocks
ccf8f4bcd24f6b8cc3ef0d8098ce069e2da94189
<ide><path>libcloud/test/compute/test_openstack.py <ide> def test_detach_volume(self): <ide> self.assertEqual(self.driver.detach_volume(volume), True) <ide> <ide> def test_ex_set_password(self): <del> try: <del> self.driver.ex_set_password(self.node, 'New1&53jPass') <del> except Exception: <del> e = sys.exc_info()[1] <del> self.fail('An error was raised: ' + repr(e)) <add> self.assertTrue(self.driver.ex_set_password(self.node, 'New1&53jPass')) <ide> <ide> def test_ex_rebuild(self): <ide> image = NodeImage(id=11, name='Ubuntu 8.10 (intrepid)', <ide> driver=self.driver) <del> try: <del> success = self.driver.ex_rebuild(self.node, image=image) <del> self.assertTrue(success) <del> except Exception: <del> e = sys.exc_info()[1] <del> self.fail('An error was raised: ' + repr(e)) <add> success = self.driver.ex_rebuild(self.node, image=image) <add> self.assertTrue(success) <ide> <ide> def test_ex_rebuild_with_ex_disk_config(self): <ide> image = NodeImage(id=58, name='Ubuntu 10.10 (intrepid)', <ide> driver=self.driver) <ide> node = Node(id=12066, name=None, state=None, public_ips=None, <ide> private_ips=None, driver=self.driver) <del> try: <del> success = self.driver.ex_rebuild(node, image=image, <del> ex_disk_config='MANUAL') <del> self.assertTrue(success) <del> except Exception: <del> e = sys.exc_info()[1] <del> self.fail('An error was raised: ' + repr(e)) <add> success = self.driver.ex_rebuild(node, image=image, <add> ex_disk_config='MANUAL') <add> self.assertTrue(success) <ide> <ide> def test_ex_resize(self): <ide> size = NodeSize(1, '256 slice', None, None, None, None,
1
Java
Java
fix minor logic error in socketutils
767ea9db8370945a364b94d770b81d05d0209aef
<ide><path>spring-core/src/main/java/org/springframework/util/SocketUtils.java <ide> int findAvailablePort(int minPort, int maxPort) { <ide> int candidatePort; <ide> int searchCounter = 0; <ide> do { <del> if (searchCounter++ > portRange) { <add> if (searchCounter > portRange) { <ide> throw new IllegalStateException(String.format( <ide> "Could not find an available %s port in the range [%d, %d] after %d attempts", <ide> name(), minPort, maxPort, searchCounter)); <ide> } <ide> candidatePort = findRandomPort(minPort, maxPort); <add> searchCounter++; <ide> } <ide> while (!isPortAvailable(candidatePort)); <ide> <ide><path>spring-core/src/test/java/org/springframework/util/SocketUtilsTests.java <ide> /* <del> * Copyright 2002-2016 the original author or authors. <add> * Copyright 2002-2017 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> import java.util.SortedSet; <ide> import javax.net.ServerSocketFactory; <ide> <add>import org.junit.Rule; <ide> import org.junit.Test; <add>import org.junit.rules.ExpectedException; <ide> <add>import static org.hamcrest.CoreMatchers.*; <ide> import static org.junit.Assert.*; <del>import static org.springframework.util.SocketUtils.*; <add>import static org.springframework.util.SocketUtils.PORT_RANGE_MIN; <add>import static org.springframework.util.SocketUtils.PORT_RANGE_MAX; <ide> <ide> /** <ide> * Unit tests for {@link SocketUtils}. <ide> */ <ide> public class SocketUtilsTests { <ide> <add> @Rule <add> public final ExpectedException exception = ExpectedException.none(); <add> <ide> // TCP <ide> <del> @Test(expected = IllegalArgumentException.class) <add> @Test <ide> public void findAvailableTcpPortWithZeroMinPort() { <add> exception.expect(IllegalArgumentException.class); <ide> SocketUtils.findAvailableTcpPort(0); <ide> } <ide> <del> @Test(expected = IllegalArgumentException.class) <add> @Test <ide> public void findAvailableTcpPortWithNegativeMinPort() { <add> exception.expect(IllegalArgumentException.class); <ide> SocketUtils.findAvailableTcpPort(-500); <ide> } <ide> <ide> public void findAvailableTcpPortWithMinPortEqualToMaxPort() { <ide> assertEquals(minMaxPort, port); <ide> } <ide> <del> @Test(expected = IllegalStateException.class) <add> @Test <ide> public void findAvailableTcpPortWhenPortOnLoopbackInterfaceIsNotAvailable() throws Exception { <ide> int port = SocketUtils.findAvailableTcpPort(); <ide> ServerSocket socket = ServerSocketFactory.getDefault().createServerSocket(port, 1, InetAddress.getByName("localhost")); <ide> try { <add> exception.expect(IllegalStateException.class); <add> exception.expectMessage(startsWith("Could not find an available TCP port")); <add> exception.expectMessage(endsWith("after 1 attempts")); <add> // will only look for the exact port <ide> SocketUtils.findAvailableTcpPort(port, port); <ide> } <ide> finally { <ide> public void find50AvailableTcpPortsInRange() { <ide> findAvailableTcpPorts(50, 40000, 45000); <ide> } <ide> <del> @Test(expected = IllegalArgumentException.class) <add> @Test <ide> public void findAvailableTcpPortsWithRequestedNumberGreaterThanSizeOfRange() { <add> exception.expect(IllegalArgumentException.class); <ide> findAvailableTcpPorts(50, 45000, 45010); <ide> } <ide> <ide> <ide> // UDP <ide> <del> @Test(expected = IllegalArgumentException.class) <add> @Test <ide> public void findAvailableUdpPortWithZeroMinPort() { <add> exception.expect(IllegalArgumentException.class); <ide> SocketUtils.findAvailableUdpPort(0); <ide> } <ide> <del> @Test(expected = IllegalArgumentException.class) <add> @Test <ide> public void findAvailableUdpPortWithNegativeMinPort() { <add> exception.expect(IllegalArgumentException.class); <ide> SocketUtils.findAvailableUdpPort(-500); <ide> } <ide> <ide> public void findAvailableUdpPort() { <ide> assertPortInRange(port, PORT_RANGE_MIN, PORT_RANGE_MAX); <ide> } <ide> <del> @Test(expected = IllegalStateException.class) <add> @Test <ide> public void findAvailableUdpPortWhenPortOnLoopbackInterfaceIsNotAvailable() throws Exception { <ide> int port = SocketUtils.findAvailableUdpPort(); <ide> DatagramSocket socket = new DatagramSocket(port, InetAddress.getByName("localhost")); <ide> try { <add> exception.expect(IllegalStateException.class); <add> exception.expectMessage(startsWith("Could not find an available UDP port")); <add> exception.expectMessage(endsWith("after 1 attempts")); <ide> // will only look for the exact port <ide> SocketUtils.findAvailableUdpPort(port, port); <ide> } <ide> public void find50AvailableUdpPortsInRange() { <ide> findAvailableUdpPorts(50, 40000, 45000); <ide> } <ide> <del> @Test(expected = IllegalArgumentException.class) <add> @Test <ide> public void findAvailableUdpPortsWithRequestedNumberGreaterThanSizeOfRange() { <add> exception.expect(IllegalArgumentException.class); <ide> findAvailableUdpPorts(50, 45000, 45010); <ide> } <ide>
2
Javascript
Javascript
update closure library to latest
c88b119ef50fdb56c7a79703717efde8b48d6ae3
<ide><path>i18n/closure/datetimeSymbols.js <ide> goog.i18n.DateTimeSymbols_my = { <ide> 'ဇွန်', 'ဇူလိုင်', 'ဩဂုတ်', <ide> 'စက်တင်ဘာ', 'အောက်တိုဘာ', <ide> 'နိုဝင်ဘာ', 'ဒီဇင်ဘာ'], <del> SHORTMONTHS: ['ဇန်နဝါရီ', 'ဖေဖော်ဝါရီ', <del> 'မတ်', 'ဧပြီ', 'မေ', 'ဇွန်', <del> 'ဇူလိုင်', 'ဩဂုတ်', 'စက်တင်ဘာ', <del> 'အောက်တိုဘာ', 'နိုဝင်ဘာ', <del> 'ဒီဇင်ဘာ'], <del> STANDALONESHORTMONTHS: ['ဇန်နဝါရီ', <del> 'ဖေဖော်ဝါရီ', 'မတ်', 'ဧပြီ', 'မေ', <del> 'ဇွန်', 'ဇူလိုင်', 'ဩဂုတ်', <del> 'စက်တင်ဘာ', 'အောက်တိုဘာ', <del> 'နိုဝင်ဘာ', 'ဒီဇင်ဘာ'], <add> SHORTMONTHS: ['ဇန်', 'ဖေ', 'မတ်', 'ဧပြီ', 'မေ', <add> 'ဇွန်', 'ဇူ', 'ဩ', 'စက်', 'အောက်', <add> 'နို', 'ဒီ'], <add> STANDALONESHORTMONTHS: ['ဇန်', 'ဖေ', 'မတ်', 'ဧပြီ', <add> 'မေ', 'ဇွန်', 'ဇူ', 'ဩ', 'စက်', 'အောက်', <add> 'နို', 'ဒီ'], <ide> WEEKDAYS: ['တနင်္ဂနွေ', 'တနင်္လာ', <ide> 'အင်္ဂါ', 'ဗုဒ္ဓဟူး', <ide> 'ကြာသပတေး', 'သောကြာ', 'စနေ'], <ide> goog.i18n.DateTimeSymbols_my = { <ide> 'တတိယ သုံးလပတ်', <ide> 'စတုတ္ထ သုံးလပတ်'], <ide> AMPMS: ['နံနက်', 'ညနေ'], <del> DATEFORMATS: ['EEEE, y MMMM dd', 'y MMMM d', 'y MMM d', 'yy/MM/dd'], <add> DATEFORMATS: ['EEEE, dd MMMM y', 'd MMMM y', 'd MMM y', 'dd-MM-yy'], <ide> TIMEFORMATS: ['HH:mm:ss zzzz', 'HH:mm:ss z', 'HH:mm:ss', 'HH:mm'], <ide> DATETIMEFORMATS: ['{1}မှာ {0}', '{1} {0}', '{1} {0}', '{1} {0}'], <ide> FIRSTDAYOFWEEK: 6, <ide><path>i18n/closure/datetimeSymbolsExt.js <ide> goog.i18n.DateTimeSymbols_my_MM = { <ide> 'ဇွန်', 'ဇူလိုင်', 'ဩဂုတ်', <ide> 'စက်တင်ဘာ', 'အောက်တိုဘာ', <ide> 'နိုဝင်ဘာ', 'ဒီဇင်ဘာ'], <del> SHORTMONTHS: ['ဇန်နဝါရီ', 'ဖေဖော်ဝါရီ', <del> 'မတ်', 'ဧပြီ', 'မေ', 'ဇွန်', <del> 'ဇူလိုင်', 'ဩဂုတ်', 'စက်တင်ဘာ', <del> 'အောက်တိုဘာ', 'နိုဝင်ဘာ', <del> 'ဒီဇင်ဘာ'], <del> STANDALONESHORTMONTHS: ['ဇန်နဝါရီ', <del> 'ဖေဖော်ဝါရီ', 'မတ်', 'ဧပြီ', 'မေ', <del> 'ဇွန်', 'ဇူလိုင်', 'ဩဂုတ်', <del> 'စက်တင်ဘာ', 'အောက်တိုဘာ', <del> 'နိုဝင်ဘာ', 'ဒီဇင်ဘာ'], <add> SHORTMONTHS: ['ဇန်', 'ဖေ', 'မတ်', 'ဧပြီ', 'မေ', <add> 'ဇွန်', 'ဇူ', 'ဩ', 'စက်', 'အောက်', <add> 'နို', 'ဒီ'], <add> STANDALONESHORTMONTHS: ['ဇန်', 'ဖေ', 'မတ်', 'ဧပြီ', <add> 'မေ', 'ဇွန်', 'ဇူ', 'ဩ', 'စက်', 'အောက်', <add> 'နို', 'ဒီ'], <ide> WEEKDAYS: ['တနင်္ဂနွေ', 'တနင်္လာ', <ide> 'အင်္ဂါ', 'ဗုဒ္ဓဟူး', <ide> 'ကြာသပတေး', 'သောကြာ', 'စနေ'], <ide> goog.i18n.DateTimeSymbols_my_MM = { <ide> 'တတိယ သုံးလပတ်', <ide> 'စတုတ္ထ သုံးလပတ်'], <ide> AMPMS: ['နံနက်', 'ညနေ'], <del> DATEFORMATS: ['EEEE, y MMMM dd', 'y MMMM d', 'y MMM d', 'yy/MM/dd'], <add> DATEFORMATS: ['EEEE, dd MMMM y', 'd MMMM y', 'd MMM y', 'dd-MM-yy'], <ide> TIMEFORMATS: ['HH:mm:ss zzzz', 'HH:mm:ss z', 'HH:mm:ss', 'HH:mm'], <ide> DATETIMEFORMATS: ['{1}မှာ {0}', '{1} {0}', '{1} {0}', '{1} {0}'], <ide> FIRSTDAYOFWEEK: 6, <ide><path>i18n/closure/numberSymbols.js <ide> goog.i18n.NumberFormatSymbols_lt = { <ide> SCIENTIFIC_PATTERN: '#E0', <ide> PERCENT_PATTERN: '#,##0\u00A0%', <ide> CURRENCY_PATTERN: '#,##0.00\u00A0\u00A4', <del> DEF_CURRENCY_CODE: 'LTL' <add> DEF_CURRENCY_CODE: 'EUR' <ide> }; <ide> <ide>
3
Javascript
Javascript
add nextcontext to componentwillreceiveprops
04c3e2e4077aa70fdb45a35957005a06498a42a9
<ide><path>src/core/ReactCompositeComponent.js <ide> var ReactCompositeComponentInterface = { <ide> * Use this as an opportunity to react to a prop transition by updating the <ide> * state using `this.setState`. Current props are accessed via `this.props`. <ide> * <del> * componentWillReceiveProps: function(nextProps) { <add> * componentWillReceiveProps: function(nextProps, nextContext) { <ide> * this.setState({ <ide> * likesIncreasing: nextProps.likeCount > this.props.likeCount <ide> * }); <ide> var ReactCompositeComponentMixin = { <ide> return; <ide> } <ide> <add> var nextFullContext = this._pendingContext || this._currentContext; <add> var nextContext = this._processContext(nextFullContext); <add> this._pendingContext = null; <add> <ide> var nextProps = this.props; <ide> if (this._pendingProps != null) { <ide> nextProps = this._pendingProps; <ide> var ReactCompositeComponentMixin = { <ide> <ide> this._compositeLifeCycleState = CompositeLifeCycle.RECEIVING_PROPS; <ide> if (this.componentWillReceiveProps) { <del> this.componentWillReceiveProps(nextProps); <add> this.componentWillReceiveProps(nextProps, nextContext); <ide> } <ide> } <ide> <ide> var ReactCompositeComponentMixin = { <ide> var nextState = this._pendingState || this.state; <ide> this._pendingState = null; <ide> <del> var nextFullContext = this._pendingContext || this._currentContext; <del> var nextContext = this._processContext(nextFullContext); <del> this._pendingContext = null; <del> <ide> if (this._pendingForceUpdate || <ide> !this.shouldComponentUpdate || <ide> this.shouldComponentUpdate(nextProps, nextState, nextContext)) { <ide><path>src/core/__tests__/ReactCompositeComponent-test.js <ide> describe('ReactCompositeComponent', function() { <ide> }); <ide> <ide> it('should filter context properly in callbacks', function() { <add> var actualComponentWillReceiveProps; <ide> var actualShouldComponentUpdate; <ide> var actualComponentWillUpdate; <ide> var actualComponentDidUpdate; <ide> describe('ReactCompositeComponent', function() { <ide> foo: ReactPropTypes.string <ide> }, <ide> <add> componentWillReceiveProps: function(nextProps, nextContext) { <add> actualComponentWillReceiveProps = nextContext; <add> return true; <add> }, <add> <ide> shouldComponentUpdate: function(nextProps, nextState, nextContext) { <ide> actualShouldComponentUpdate = nextContext; <ide> return true; <ide> describe('ReactCompositeComponent', function() { <ide> var instance = <Parent foo="abc" />; <ide> ReactTestUtils.renderIntoDocument(instance); <ide> instance.replaceProps({foo: "def"}); <add> expect(actualComponentWillReceiveProps).toEqual({foo: 'def'}); <ide> expect(actualShouldComponentUpdate).toEqual({foo: 'def'}); <ide> expect(actualComponentWillUpdate).toEqual({foo: 'def'}); <ide> expect(actualComponentDidUpdate).toEqual({foo: 'abc'});
2
Text
Text
remove old changelogs
fca53f2a895c33c2884d8c5e6ad70a76de297e9d
<ide><path>CHANGELOG-5.2.md <del># Release Notes <del> <del>## [Unreleased] <del> <del>### Fixed <del>- Fixed deferring write connection ([#16673](https://github.com/laravel/framework/pull/16673)) <del> <del> <del>## v5.2.45 (2016-08-26) <del> <del>### Fixed <del>- Revert changes to Eloquent `Builder` that breaks `firstOr*` methods ([#15018](https://github.com/laravel/framework/pull/15018)) <del>- Revert aggregate changes in [#14793](https://github.com/laravel/framework/pull/14793) ([#14994](https://github.com/laravel/framework/pull/14994)) <del> <del> <del>## v5.2.44 (2016-08-23) <del> <del>### Added <del>- Added `BelongsToMany::syncWithoutDetaching()` method ([33aee31](https://github.com/laravel/framework/commit/33aee31523b9fc280aced35a5eb5f6b627263b45)) <del>- Added `withoutTrashed()` method to `SoftDeletingScope` ([#14805](https://github.com/laravel/framework/pull/14805)) <del>- Support Flysystem's `disable_asserts` config value ([#14864](https://github.com/laravel/framework/pull/14864)) <del> <del>### Changed <del>- Support multi-dimensional `$data` arrays in `invalid()` and `valid()` methods ([#14651](https://github.com/laravel/framework/pull/14651)) <del>- Support column aliases in `chunkById()` ([#14711](https://github.com/laravel/framework/pull/14711)) <del>- Re-attempt transaction when encountering a deadlock ([#14930](https://github.com/laravel/framework/pull/14930)) <del> <del>### Fixed <del>- Only return floats or integers in `aggregate()` ([#14781](https://github.com/laravel/framework/pull/14781)) <del>- Fixed numeric aggregate queries ([#14793](https://github.com/laravel/framework/pull/14793)) <del>- Create new row in `firstOrCreate()` when a model has a mutator ([#14656](https://github.com/laravel/framework/pull/14656)) <del>- Protect against empty paths in the `view:clear` command ([#14812](https://github.com/laravel/framework/pull/14812)) <del>- Convert `$attributes` in `makeHidden()` to array ([#14852](https://github.com/laravel/framework/pull/14852), [#14857](https://github.com/laravel/framework/pull/14857)) <del>- Prevent conflicting class name import to namespace in `ValidatesWhenResolvedTrait` ([#14878](https://github.com/laravel/framework/pull/14878)) <del> <del> <del>## v5.2.43 (2016-08-10) <del> <del>### Changed <del>- Throw exception if `$amount` is not numeric in `increment()` and `decrement()` ([915cb84](https://github.com/laravel/framework/commit/915cb843981ad434b10709425d968bf2db37cb1a)) <del> <del> <del>## v5.2.42 (2016-08-08) <del> <del>### Added <del>- Allow `BelongsToMany::detach()` to accept a collection ([#14412](https://github.com/laravel/framework/pull/14412)) <del>- Added `whereTime()` and `orWhereTime()` to query builder ([#14528](https://github.com/laravel/framework/pull/14528)) <del>- Added PHP 7.1 support ([#14549](https://github.com/laravel/framework/pull/14549)) <del>- Allow collections to be created from objects that implement `Traversable` ([#14628](https://github.com/laravel/framework/pull/14628)) <del>- Support dot notation in `Request::exists()` ([#14660](https://github.com/laravel/framework/pull/14660)) <del>- Added missing `Model::makeHidden()` method ([#14641](https://github.com/laravel/framework/pull/14641)) <del> <del>### Changed <del>- Return `true` when `$key` is empty in `MessageBag::has()` ([#14409](https://github.com/laravel/framework/pull/14409)) <del>- Optimized `Filesystem::moveDirectory` ([#14362](https://github.com/laravel/framework/pull/14362)) <del>- Convert `$count` to integer in `Str::plural()` ([#14502](https://github.com/laravel/framework/pull/14502)) <del>- Handle arrays in `validateIn()` method ([#14607](https://github.com/laravel/framework/pull/14607)) <del> <del>### Fixed <del>- Fixed an issue with `wherePivotIn()` ([#14397](https://github.com/laravel/framework/issues/14397)) <del>- Fixed PDO connection on HHVM ([#14429](https://github.com/laravel/framework/pull/14429)) <del>- Prevent `make:migration` from creating duplicate classes ([#14432](https://github.com/laravel/framework/pull/14432)) <del>- Fixed lazy eager loading issue in `LengthAwarePaginator` collection ([#14476](https://github.com/laravel/framework/pull/14476)) <del>- Fixed plural form of Pokémon ([#14525](https://github.com/laravel/framework/pull/14525)) <del>- Fixed authentication bug in `TokenGuard::validate()` ([#14568](https://github.com/laravel/framework/pull/14568)) <del>- Fix missing middleware parameters when using `authorizeResource()` ([#14592](https://github.com/laravel/framework/pull/14592)) <del> <del>### Removed <del>- Removed duplicate interface implementation in `Dispatcher` ([#14515](https://github.com/laravel/framework/pull/14515)) <del> <del> <del>## v5.2.41 (2016-07-20) <del> <del>### Changed <del>- Run session garbage collection before response is returned ([#14386](https://github.com/laravel/framework/pull/14386)) <del> <del>### Fixed <del>- Fixed pagination bug introduced in [#14188](https://github.com/laravel/framework/pull/14188) ([#14389](https://github.com/laravel/framework/pull/14389)) <del>- Fixed `median()` issue when collection is out of order ([#14381](https://github.com/laravel/framework/pull/14381)) <del> <del> <del>## v5.2.40 (2016-07-19) <del> <del>### Added <del>- Added `--tags` option to `cache:clear` command ([#13927](https://github.com/laravel/framework/pull/13927)) <del>- Added `scopes()` method to Eloquent query builder ([#14049](https://github.com/laravel/framework/pull/14049)) <del>- Added `hasAny()` method to `MessageBag` ([#14151](https://github.com/laravel/framework/pull/14151)) <del>- Allowing passing along transmission options to SparkPost ([#14166](https://github.com/laravel/framework/pull/14166)) <del>- Added `Filesystem::moveDirectory()` ([#14198](https://github.com/laravel/framework/pull/14198)) <del>- Added `increment()` and `decrement()` methods to session store ([#14196](https://github.com/laravel/framework/pull/14196)) <del>- Added `pipe()` method to `Collection` ([#13899](https://github.com/laravel/framework/pull/13899)) <del>- Added additional PostgreSQL operators ([#14224](https://github.com/laravel/framework/pull/14224)) <del>- Support `::` expressions in Blade directive names ([#14265](https://github.com/laravel/framework/pull/14265)) <del>- Added `median()` and `mode()` methods to collections ([#14305](https://github.com/laravel/framework/pull/14305)) <del>- Add `tightenco/collect` to Composer `replace` list ([#14118](https://github.com/laravel/framework/pull/14118), [#14127](https://github.com/laravel/framework/pull/14127)) <del> <del>### Changed <del>- Don't release jobs that have been reserved too long ([#13833](https://github.com/laravel/framework/pull/13833)) <del>- Throw `Exception` if `Queue` has no encrypter ([#14038](https://github.com/laravel/framework/pull/14038)) <del>- Cast `unique` validation rule `id` to integer ([#14076](https://github.com/laravel/framework/pull/14076)) <del>- Ensure database transaction count is not negative ([#14085](https://github.com/laravel/framework/pull/14085)) <del>- Use `session.lifetime` for CSRF cookie ([#14080](https://github.com/laravel/framework/pull/14080)) <del>- Allow the `shuffle()` method to be seeded ([#14099](https://github.com/laravel/framework/pull/14099)) <del>- Allow passing of multiple keys to `MessageBag::has()` ([a0cd0ae](https://github.com/laravel/framework/commit/a0cd0aea9a475f76baf968ef2f53aeb71fcda4c0)) <del>- Allow model connection in `newFromBuilder()` to be overridden ([#14194](https://github.com/laravel/framework/pull/14194)) <del>- Only load pagination results if `$total` is greater than zero ([#14188](https://github.com/laravel/framework/pull/14188)) <del>- Accept fallback parameter in `UrlGenerator::previous` ([#14207](https://github.com/laravel/framework/pull/14207)) <del>- Only do `use` call if `database` is not empty ([#14225](https://github.com/laravel/framework/pull/14225)) <del>- Removed unnecessary nesting in the `Macroable` trait ([#14222](https://github.com/laravel/framework/pull/14222)) <del>- Refactored `DatabaseQueue::getNextAvailableJob()` ([cffcd34](https://github.com/laravel/framework/commit/cffcd347901617b19e8eca05be55cda280e0d262)) <del>- Look for `getUrl()` method on Filesystem adapter before throwing exception ([#14246](https://github.com/laravel/framework/pull/14246)) <del>- Make `seeIsSelected()` work with `<option>` elements without `value` attributes ([#14279](https://github.com/laravel/framework/pull/14279)) <del>- Improved performance of `Filesystem::sharedGet()` ([#14319](https://github.com/laravel/framework/pull/14319)) <del>- Throw exception if view cache path is empty ([#14291](https://github.com/laravel/framework/pull/14291)) <del>- Changes several validation methods return type from integers to booleans ([#14373](https://github.com/laravel/framework/pull/14373)) <del>- Remove files from input in `withInput()` method ([85249be](https://github.com/laravel/framework/commit/85249beed1e4512d71f7ae52474b9a59a80381d2)) <del> <del>### Fixed <del>- Require file instance for `dimensions` validation rule ([#14025](https://github.com/laravel/framework/pull/14025)) <del>- Fixes for SQL Server `processInsertGetId()` with ODBC ([#14121](https://github.com/laravel/framework/pull/14121)) <del>- Fixed PostgreSQL `processInsertGetId()` with `PDO::FETCH_CLASS` ([#14115](https://github.com/laravel/framework/pull/14115)) <del>- Fixed `PDO::FETCH_CLASS` support in `Connection::cursor()` ([#14052](https://github.com/laravel/framework/pull/14052)) <del>- Fixed eager loading of multi-level `morphTo` relationships ([#14190](https://github.com/laravel/framework/pull/14190)) <del>- Fixed MySQL multiple-table DELETE ([#14179](https://github.com/laravel/framework/pull/14179)) <del>- Always cast `vendor:publish` tags to array ([#14228](https://github.com/laravel/framework/pull/14228)) <del>- Fixed translation capitalization when replacements are a numerical array ([#14249](https://github.com/laravel/framework/pull/14249)) <del>- Fixed double `urldecode()` on route parameters ([#14370](https://github.com/laravel/framework/pull/14370)) <del> <del>### Removed <del>- Remove method overwrites in `PostgresGrammar` ([#14372](https://github.com/laravel/framework/pull/14372)) <del> <del> <del>## v5.2.39 (2016-06-17) <del> <del>### Added <del>- Added `without()` method to Eloquent query builder ([#14031](https://github.com/laravel/framework/pull/14031)) <del>- Added `keyType` property Eloquent models to set key type cast ([#13985](https://github.com/laravel/framework/pull/13985)) <del>- Added support for mail transport `StreamOptions` ([#13925](https://github.com/laravel/framework/pull/13925)) <del>- Added `validationData()` method to `FormRequest` ([#13914](https://github.com/laravel/framework/pull/13914)) <del> <del>### Changed <del>- Only `set names` for MySQL connections if `charset` is set in config ([#13930](https://github.com/laravel/framework/pull/13930)) <del>- Support recursive container alias resolution ([#13976](https://github.com/laravel/framework/pull/13976)) <del>- Use late static binding in `PasswordBroker` ([#13975](https://github.com/laravel/framework/pull/13975)) <del>- Make sure Ajax requests are not Pjax requests in `FormRequest` ([#14024](https://github.com/laravel/framework/pull/14024)) <del>- Set existence state of expired database sessions, instead of deleting them ([53c0440](https://github.com/laravel/framework/commit/53c04406baa5f63bbb41127f40afee0a0facadd1)) <del>- Release Beanstalkd jobs before burying them ([#13963](https://github.com/laravel/framework/pull/13963)) <del> <del>### Fixed <del>- Use `getIncrementing()` method instead of the `$incrementing` attribute ([#14005](https://github.com/laravel/framework/pull/14005)) <del>- Fixed fatal error when `services.json` is empty ([#14030](https://github.com/laravel/framework/pull/14030)) <del> <del> <del>## v5.2.38 (2016-06-13) <del> <del>### Changed <del>- Convert multiple `Model::fresh()` arguments to array before passing to `with()` ([#13950](https://github.com/laravel/framework/pull/13950)) <del>- Iterate only through files that contain a namespace in `app:name` command. ([#13961](https://github.com/laravel/framework/pull/13961)) <del> <del>### Fixed <del>- Close swift mailer connection after sending mail ([#13583](https://github.com/laravel/framework/pull/13583)) <del>- Prevent possible key overlap in `Str::snake` cache ([#13943](https://github.com/laravel/framework/pull/13943)) <del>- Fixed issue when eager loading chained `MorphTo` relationships ([#13967](https://github.com/laravel/framework/pull/13967)) <del>- Delete database session record if it's expired ([09b09eb](https://github.com/laravel/framework/commit/09b09ebad480940f2b49f96bbfbea0647783025e)) <del> <del> <del>## v5.2.37 (2016-06-10) <del> <del>### Added <del>- Added `hasArgument()` and `hasOption()` methods to `Command` class ([#13919](https://github.com/laravel/framework/pull/13919)) <del>- Added `$failedId` property to `JobFailed` event ([#13920](https://github.com/laravel/framework/pull/13920)) <del> <del>### Fixed <del>- Fixed session expiration on several drivers ([0831312](https://github.com/laravel/framework/commit/0831312aec47d904a65039e07574f41ab7492418)) <del> <del> <del>## v5.2.36 (2016-06-06) <del> <del>### Added <del>- Allow passing along options to the S3 client ([#13791](https://github.com/laravel/framework/pull/13791)) <del>- Allow nested `WHERE` clauses in `whereHas()` queries ([#13794](https://github.com/laravel/framework/pull/13794)) <del>- Support `DateTime` instances in `Before`/`After` date validation ([#13844](https://github.com/laravel/framework/pull/13844)) <del>- Support queueing collections ([d159f02](https://github.com/laravel/framework/commit/d159f02fe8cb5310b90c73d416a684e4bf51785a)) <del> <del>### Changed <del>- Reverted SparkPost driver back to `email_rfc822` parameter for simplicity ([#13780](https://github.com/laravel/framework/pull/13780)) <del>- Simplified `Model::__isset()` ([8fb89c6](https://github.com/laravel/framework/commit/8fb89c61c24af905b0b9db4d645d68a2c4a133b9)) <del>- Set exception handler even on non-daemon `queue:work` calls ([d5bbda9](https://github.com/laravel/framework/commit/d5bbda95a6435fa8cb38b8b640440b38de6b7f83)) <del>- Show handler class names in `queue:work` console output ([4d7eb59](https://github.com/laravel/framework/commit/4d7eb59f9813723bab00b4e42ce9885b54e65778)) <del>- Use queue events to update the console output of `queue:work` ([ace7f04](https://github.com/laravel/framework/commit/ace7f04ae579146ca3adf1c5992256c50ddc05a8)) <del>- Made `ResetsPasswords` trait easier to customize ([#13818](https://github.com/laravel/framework/pull/13818)) <del>- Refactored Eloquent relations and scopes ([#13824](https://github.com/laravel/framework/pull/13824), [#13884](https://github.com/laravel/framework/pull/13884), [#13894](https://github.com/laravel/framework/pull/13894)) <del>- Respected `session.http_only` option in `StartSession` middleware ([#13825](https://github.com/laravel/framework/pull/13825)) <del>- Don't return in `ApcStore::forever()` ([#13871](https://github.com/laravel/framework/pull/13871)) <del>- Allow Redis key expiration to be lower than one minute ([#13810](https://github.com/laravel/framework/pull/13810)) <del> <del>### Fixed <del>- Fixed `morphTo` relations across database connections ([#13784](https://github.com/laravel/framework/pull/13784)) <del>- Fixed `morphTo` relations without soft deletes ([13806](https://github.com/laravel/framework/pull/13806)) <del>- Fixed edge case on `morphTo` relations macro call that only exists on the related model ([#13828](https://github.com/laravel/framework/pull/13828)) <del>- Fixed formatting of `updatedAt` timestamp when calling `touch()` on `BelongsToMany` relation ([#13799](https://github.com/laravel/framework/pull/13799)) <del>- Don't get `$id` from Recaller in `Auth::id()` ([#13769](https://github.com/laravel/framework/pull/13769)) <del>- Fixed `AuthorizesResources` trait ([25443e3](https://github.com/laravel/framework/commit/25443e3e218cce1121f546b596dd70b5fd2fb619)) <del> <del>### Removed <del>- Removed unused `ArrayStore::putMultiple()` method ([#13840](https://github.com/laravel/framework/pull/13840)) <del> <del> <del>## v5.2.35 (2016-05-30) <del> <del>### Added <del>- Added failed login event ([#13761](https://github.com/laravel/framework/pull/13761)) <del> <del>### Changed <del>- Always cast `FileStore::expiration()` return value to integer ([#13708](https://github.com/laravel/framework/pull/13708)) <del>- Simplified `Container::isCallableWithAtSign()` ([#13757](https://github.com/laravel/framework/pull/13757)) <del>- Pass key to the `Collection::keyBy()` callback ([#13766](https://github.com/laravel/framework/pull/13766)) <del>- Support unlimited log files by setting `app.log_max_files` to `0` ([#13776](https://github.com/laravel/framework/pull/13776)) <del>- Wathan-ize `MorphTo::getEagerLoadsForInstance()` ([#13741](https://github.com/laravel/framework/pull/13741), [#13777](https://github.com/laravel/framework/pull/13777)) <del> <del>### Fixed <del>- Fixed MySQL JSON boolean binding update grammar ([38acdd8](https://github.com/laravel/framework/commit/38acdd807faec4b85fd47051341ccaf666499551)) <del>- Fixed loading of nested polymorphic relationships ([#13737](https://github.com/laravel/framework/pull/13737)) <del>- Fixed early return in `AuthManager::shouldUse()` ([5b88244](https://github.com/laravel/framework/commit/5b88244c0afd5febe9f54e8544b0870b55ef6cfd)) <del>- Fixed the remaining attempts calculation in `ThrottleRequests` ([#13756](https://github.com/laravel/framework/pull/13756), [#13759](https://github.com/laravel/framework/pull/13759)) <del>- Fixed strict `TypeError` in `AbstractPaginator::url()` ([#13758](https://github.com/laravel/framework/pull/13758)) <del> <del>## v5.2.34 (2016-05-26) <del> <del>### Added <del>- Added correct MySQL JSON boolean handling and updating grammar ([#13242](https://github.com/laravel/framework/pull/13242)) <del>- Added `stream` option to mail `TransportManager` ([#13715](https://github.com/laravel/framework/pull/13715)) <del>- Added `when()` method to eloquent query builder ([#13726](https://github.com/laravel/framework/pull/13726)) <del> <del>### Changed <del>- Catch exceptions in `Worker::pop()` to prevent log spam ([#13688](https://github.com/laravel/framework/pull/13688)) <del>- Use write connection when validating uniqueness ([#13718](https://github.com/laravel/framework/pull/13718)) <del>- Use `withException()` method in `Handler::toIlluminateResponse()` ([#13712](https://github.com/laravel/framework/pull/13712)) <del>- Apply constraints to `morphTo` relationships when using eager loading ([#13724](https://github.com/laravel/framework/pull/13724)) <del>- Use SETs rather than LISTs for storing Redis cache key references ([#13731](https://github.com/laravel/framework/pull/13731)) <del> <del>### Fixed <del>- Map `destroy` instead of `delete` in `AuthorizesResources` ([#13716](https://github.com/laravel/framework/pull/13716)) <del>- Reverted [#13519](https://github.com/laravel/framework/pull/13519) ([#13733](https://github.com/laravel/framework/pull/13733)) <del> <del> <del>## v5.2.33 (2016-05-25) <del> <del>### Added <del>- Allow query results to be traversed using a cursor ([#13030](https://github.com/laravel/framework/pull/13030)) <del>- Added support for log levels ([#13513](https://github.com/laravel/framework/pull/13513)) <del>- Added `inRandomOrder()` method to query builder ([#13642](https://github.com/laravel/framework/pull/13642)) <del>- Added support for custom connection in `PasswordBrokerManager` ([#13646](https://github.com/laravel/framework/pull/13646)) <del>- Allow connection timeouts in `TransportManager` ([#13621](https://github.com/laravel/framework/pull/13621)) <del>- Added missing `$test` argument to `UploadedFile` ([#13656](https://github.com/laravel/framework/pull/13656)) <del>- Added `authenticate()` method to guards ([#13651](https://github.com/laravel/framework/pull/13651)) <del> <del>### Changed <del>- Use locking to migrate stale jobs ([26a24d6](https://github.com/laravel/framework/commit/26a24d61ced4c5833eba6572d585af90b22fcdb7)) <del>- Avoid `chunkById` duplicating `orders` clause with the same column ([#13604](https://github.com/laravel/framework/pull/13604)) <del>- Fire `RouteMatched` event on `route:list` command ([#13474](https://github.com/laravel/framework/pull/13474)) <del>- Set user resolver for request in `AuthManager::shouldUse()` ([bf5303f](https://github.com/laravel/framework/commit/bf5303fdc919d9d560df128b92a1891dc64ea488)) <del>- Always execute `use` call, unless database is empty ([#13701](https://github.com/laravel/framework/pull/13701), [ef770ed](https://github.com/laravel/framework/commit/ef770edb08f3540aefffd916ae6ef5c8db58f0af)) <del>- Allow `elixir()` `$buildDirectory` to be `null`. ([#13661](https://github.com/laravel/framework/pull/13661)) <del>- Simplified calling `Model::replicate()` with `$except` argument ([#13676](https://github.com/laravel/framework/pull/13676)) <del>- Allow auth events to be serialized ([#13704](https://github.com/laravel/framework/pull/13704)) <del>- Added `for` and `id` attributes to auth scaffold ([#13689](https://github.com/laravel/framework/pull/13689)) <del>- Acquire lock before deleting reserved job ([4b502dc](https://github.com/laravel/framework/commit/4b502dc6eecd80efad01e845469b9a2bac26dae0#diff-b05083dc38b4e45d38d28c676abbad83)) <del> <del>### Fixed <del>- Prefix timestamps when updating many-to-many relationships ([#13519](https://github.com/laravel/framework/pull/13519)) <del>- Fixed missing wheres defined on the relation when creating the subquery for a relation count ([#13612](https://github.com/laravel/framework/pull/13612)) <del>- Fixed `Model::makeVisible()` when `$visible` property is not empty ([#13625](https://github.com/laravel/framework/pull/13625)) <del>- Fixed PostgreSQL's `Schema::hasTable()` ([#13008](https://github.com/laravel/framework/pull/13008)) <del>- Fixed `url` validation rule when missing trailing slash ([#13700](https://github.com/laravel/framework/pull/13700)) <del> <del> <del>## v5.2.32 (2016-05-17) <del> <del>### Added <del>- Allow user to enable/disable foreign key checks dynamically ([#13333](https://github.com/laravel/framework/pull/13333)) <del>- Added `file` validation rule ([#13371](https://github.com/laravel/framework/pull/13371)) <del>- Added `guestMiddleware()` method to get guest middleware with guard parameter ([#13384](https://github.com/laravel/framework/pull/13384)) <del>- Added `Pivot::fromRawAttributes()` to create a new pivot model from raw values returned from a query ([f356419](https://github.com/laravel/framework/commit/f356419fa6f6b6fbc3322ca587b0bc1e075ba8d2)) <del>- Added `Builder::withCount()` to add a relationship subquery count ([#13414](https://github.com/laravel/framework/pull/13414)) <del>- Support `reply_to` field when using SparkPost ([#13410](https://github.com/laravel/framework/pull/13410)) <del>- Added validation rule for image dimensions ([#13428](https://github.com/laravel/framework/pull/13428)) <del>- Added "Generated Columns" support to MySQL grammar ([#13430](https://github.com/laravel/framework/pull/13430)) <del>- Added `Response::throwResponse()` ([#13473](https://github.com/laravel/framework/pull/13473)) <del>- Added `page` parameter to the `simplePaginate()` method ([#13502](https://github.com/laravel/framework/pull/13502)) <del>- Added `whereColumn()` method to Query Builder ([#13549](https://github.com/laravel/framework/pull/13549)) <del>- Allow `File::allFiles()` to show hidden dot files ([#13555](https://github.com/laravel/framework/pull/13555)) <del> <del>### Changed <del>- Return `null` instead of `0` for a default `BelongsTo` key ([#13378](https://github.com/laravel/framework/pull/13378)) <del>- Avoid useless logical operation ([#13397](https://github.com/laravel/framework/pull/13397)) <del>- Stop using `{!! !!}` for `csrf_field()` ([#13398](https://github.com/laravel/framework/pull/13398)) <del>- Improvements for `SessionGuard` methods `loginUsingId()` and `onceUsingId()` ([#13393](https://github.com/laravel/framework/pull/13393)) <del>- Added Work-around due to lack of `lastInsertId()` for ODBC for MSSQL ([#13423](https://github.com/laravel/framework/pull/13423)) <del>- Ensure `MigrationCreator::create()` receives `$create` as boolean ([#13439](https://github.com/laravel/framework/pull/13439)) <del>- Allow custom validators to be called with out function name ([#13444](https://github.com/laravel/framework/pull/13444)) <del>- Moved the `payload` column of jobs table to the end ([#13469](https://github.com/laravel/framework/pull/13469)) <del>- Stabilized table aliases for self joins by adding count ([#13401](https://github.com/laravel/framework/pull/13401)) <del>- Account for `__isset` changes in PHP 7 ([#13509](https://github.com/laravel/framework/pull/13509)) <del>- Bring back support for `Carbon` instances to `before` and `after` validators ([#13494](https://github.com/laravel/framework/pull/13494)) <del>- Allow method chaining for `MakesHttpRequest` trait ([#13529](https://github.com/laravel/framework/pull/13529)) <del>- Allow `Request::intersect()` to accept argument list ([#13515](https://github.com/laravel/framework/pull/13515)) <del> <del>### Fixed <del>- Accept `!=` and `<>` as operators while value is `null` ([#13370](https://github.com/laravel/framework/pull/13370)) <del>- Fixed SparkPost BCC issue ([#13361](https://github.com/laravel/framework/pull/13361)) <del>- Fixed fatal error with optional `morphTo` relationship ([#13360](https://github.com/laravel/framework/pull/13360)) <del>- Fixed using `onlyTrashed()` and `withTrashed()` with `whereHas()` ([#13396](https://github.com/laravel/framework/pull/13396)) <del>- Fixed automatic scope nesting ([#13413](https://github.com/laravel/framework/pull/13413)) <del>- Fixed scheduler issue when using `user()` and `withoutOverlapping()` combined ([#13412](https://github.com/laravel/framework/pull/13412)) <del>- Fixed SqlServer grammar issue when table name is equal to a reserved keyword ([#13458](https://github.com/laravel/framework/pull/13458)) <del>- Fixed replacing route default parameters ([#13514](https://github.com/laravel/framework/pull/13514)) <del>- Fixed missing model attribute on `ModelNotFoundException` ([#13537](https://github.com/laravel/framework/pull/13537)) <del>- Decrement transaction count when `beginTransaction()` errors ([#13551](https://github.com/laravel/framework/pull/13551)) <del>- Fixed `seeJson()` issue when comparing two equal arrays ([#13531](https://github.com/laravel/framework/pull/13531)) <del>- Fixed a Scheduler issue where would no longer run in background ([#12628](https://github.com/laravel/framework/issues/12628)) <del>- Fixed sending attachments with SparkPost ([#13577](https://github.com/laravel/framework/pull/13577)) <del> <del> <del>## v5.2.31 (2016-04-27) <del> <del>### Added <del>- Added missing suggested dependency `SuperClosure` ([09a793f](https://git.io/vwZx4)) <del>- Added ODBC connection support for SQL Server ([#13298](https://github.com/laravel/framework/pull/13298)) <del>- Added `Request::hasHeader()` method ([#13271](https://github.com/laravel/framework/pull/13271)) <del>- Added `@elsecan` and `@elsecannot` Blade directives ([#13256](https://github.com/laravel/framework/pull/13256)) <del>- Support booleans in `required_if` Validator rule ([#13327](https://github.com/laravel/framework/pull/13327)) <del> <del>### Changed <del>- Simplified `Translator::parseLocale()` method ([#13244](https://github.com/laravel/framework/pull/13244)) <del>- Simplified `Builder::shouldRunExistsQuery()` method ([#13321](https://github.com/laravel/framework/pull/13321)) <del>- Use `Gate` contract instead of Facade ([#13260](https://github.com/laravel/framework/pull/13260)) <del>- Return result in `SoftDeletes::forceDelete()` ([#13272](https://github.com/laravel/framework/pull/13272)) <del> <del>### Fixed <del>- Fixed BCC for SparkPost ([#13237](https://github.com/laravel/framework/pull/13237)) <del>- Use Carbon for everything time related in `DatabaseTokenRepository` ([#13234](https://github.com/laravel/framework/pull/13234)) <del>- Fixed an issue with `data_set()` affecting the Validator ([#13224](https://github.com/laravel/framework/pull/13224)) <del>- Fixed setting nested namespaces with `app:name` command ([#13208](https://github.com/laravel/framework/pull/13208)) <del>- Decode base64 encoded keys before using it in `PasswordBrokerManager` ([#13270](https://github.com/laravel/framework/pull/13270)) <del>- Prevented race condition in `RateLimiter` ([#13283](https://github.com/laravel/framework/pull/13283)) <del>- Use `DIRECTORY_SEPARATOR` to create path for migrations ([#13254](https://github.com/laravel/framework/pull/13254)) <del>- Fixed adding implicit rules via `sometimes()` method ([#12976](https://github.com/laravel/framework/pull/12976)) <del>- Fixed `Schema::hasTable()` when using PostgreSQL ([#13008](https://github.com/laravel/framework/pull/13008)) <del>- Allow `seeAuthenticatedAs()` to be called with any user object ([#13308](https://github.com/laravel/framework/pull/13308)) <del> <del>### Removed <del>- Removed unused base64 decoding from `Encrypter` ([#13291](https://github.com/laravel/framework/pull/13291)) <del> <del> <del>## v5.2.30 (2016-04-19) <del> <del>### Added <del>- Added messages and custom attributes to the password reset validation ([#12997](https://github.com/laravel/framework/pull/12997)) <del>- Added `Before` and `After` dependent rules array ([#13025](https://github.com/laravel/framework/pull/13025)) <del>- Exposed token methods to user in password broker ([#13054](https://github.com/laravel/framework/pull/13054)) <del>- Added array support on `Cache::has()` ([#13028](https://github.com/laravel/framework/pull/13028)) <del>- Allow objects to be passed as pipes ([#13024](https://github.com/laravel/framework/pull/13024)) <del>- Adding alias for `FailedJobProviderInterface` ([#13088](https://github.com/laravel/framework/pull/13088)) <del>- Allow console commands registering from `Kernel` class ([#13097](https://github.com/laravel/framework/pull/13097)) <del>- Added the ability to get routes keyed by method ([#13146](https://github.com/laravel/framework/pull/13146)) <del>- Added PostgreSQL specific operators for `jsonb` type ([#13161](https://github.com/laravel/framework/pull/13161)) <del>- Added `makeHidden()` method to the Eloquent collection ([#13152](https://github.com/laravel/framework/pull/13152)) <del>- Added `intersect()` method to `Request` ([#13167](https://github.com/laravel/framework/pull/13167)) <del>- Allow disabling of model observers in tests ([#13178](https://github.com/laravel/framework/pull/13178)) <del>- Allow `ON` clauses on cross joins ([#13159](https://github.com/laravel/framework/pull/13159)) <del> <del>### Changed <del>- Use relation setter when setting relations ([#13001](https://github.com/laravel/framework/pull/13001)) <del>- Use `isEmpty()` to check for empty message bag in `Validator::passes()` ([#13014](https://github.com/laravel/framework/pull/13014)) <del>- Refresh `remember_token` when resetting password ([#13016](https://github.com/laravel/framework/pull/13016)) <del>- Use multibyte string functions in `Str` class ([#12953](https://github.com/laravel/framework/pull/12953)) <del>- Use CloudFlare CDN and use SRI checking for assets ([#13044](https://github.com/laravel/framework/pull/13044)) <del>- Enabling array on method has() ([#13028](https://github.com/laravel/framework/pull/13028)) <del>- Allow unix timestamps to be numeric in `Validator` ([da62677](https://git.io/vVi3M)) <del>- Reverted forcing middleware uniqueness ([#13075](https://github.com/laravel/framework/pull/13075)) <del>- Forget keys that contain periods ([#13121](https://github.com/laravel/framework/pull/13121)) <del>- Don't limit column selection while chunking by id ([#13137](https://github.com/laravel/framework/pull/13137)) <del>- Prefix table name on `getColumnType()` call ([#13136](https://github.com/laravel/framework/pull/13136)) <del>- Moved ability map in `AuthorizesResources` trait to a method ([#13214](https://github.com/laravel/framework/pull/13214)) <del>- Make sure `unguarded()` does not change state on exception ([#13186](https://github.com/laravel/framework/pull/13186)) <del>- Return `$this` in `InteractWithPages::within()` to allow method chaining ([13200](https://github.com/laravel/framework/pull/13200)) <del> <del>### Fixed <del>- Fixed a empty value case with `Arr:dot()` ([#13009](https://github.com/laravel/framework/pull/13009)) <del>- Fixed a Scheduler issues on Windows ([#13004](https://github.com/laravel/framework/issues/13004)) <del>- Prevent crashes with bad `Accept` headers ([#13039](https://github.com/laravel/framework/pull/13039), [#13059](https://github.com/laravel/framework/pull/13059)) <del>- Fixed explicit depending rules when the explicit keys are non-numeric ([#13058](https://github.com/laravel/framework/pull/13058)) <del>- Fixed an issue with fluent routes with `uses()` ([#13076](https://github.com/laravel/framework/pull/13076)) <del>- Prevent generating listeners for listeners ([3079175](https://git.io/vVNdg)) <del> <del>### Removed <del>- Removed unused parameter call in `Filesystem::exists()` ([#13102](https://github.com/laravel/framework/pull/13102)) <del>- Removed duplicate "[y/N]" from confirmable console commands ([#13203](https://github.com/laravel/framework/pull/13203)) <del>- Removed unused parameter in `route()` helper ([#13206](https://github.com/laravel/framework/pull/13206)) <del> <del> <del>## v5.2.29 (2016-04-02) <del> <del>### Fixed <del>- Fixed `Arr::get()` when given array is empty ([#12975](https://github.com/laravel/framework/pull/12975)) <del>- Add backticks around JSON selector field names in PostgreSQL query builder ([#12978](https://github.com/laravel/framework/pull/12978)) <del>- Reverted #12899 ([#12991](https://github.com/laravel/framework/pull/12991)) <del> <del> <del>## v5.2.28 (2016-04-01) <del> <del>### Added <del>- Added `Authorize` middleware ([#12913](https://git.io/vVLel), [0c48ba4](https://git.io/vVlib), [183f8e1](https://git.io/vVliF)) <del>- Added `UploadedFile::clientExtension()` ([75a7c01](https://git.io/vVO7I)) <del>- Added cross join support for query builder ([#12950](https://git.io/vVZqP)) <del>- Added `ThrottlesLogins::secondsRemainingOnLockout()` ([#12963](https://git.io/vVc1Z), [7c2c098](https://git.io/vVli9)) <del> <del>### Changed <del>- Optimized validation performance of large arrays ([#12651](https://git.io/v2xhi)) <del>- Never retry database query, if failed within transaction ([#12929](https://git.io/vVYUB)) <del>- Allow customization of email sent by `ResetsPasswords::sendResetLinkEmail()` ([#12935](https://git.io/vVYKE), [aae873e](https://git.io/vVliD)) <del>- Improved file system tests ([#12940](https://git.io/vVsTV), [#12949](https://git.io/vVGjP), [#12970](https://git.io/vVCBq)) <del>- Allowing merging an array of rules ([a5ea1aa](https://git.io/vVli1)) <del>- Consider implicit attributes while guessing column names in validator ([#12961](https://git.io/vVcgA), [a3827cf](https://git.io/vVliX)) <del>- Reverted [#12307](https://git.io/vgQeJ) ([#12928](https://git.io/vVqni)) <del> <del>### Fixed <del>- Fixed elixir manifest caching to detect different build paths ([#12920](https://git.io/vVtJR)) <del>- Fixed `Str::snake()` to work with UTF-8 strings ([#12923](https://git.io/vVtVp)) <del>- Trim the input name in the generator commands ([#12933](https://git.io/vVY4a)) <del>- Check for non-string values in validation rules ([#12973](https://git.io/vVWew)) <del>- Add backticks around JSON selector field names in MySQL query builder ([#12964](https://git.io/vVc9n)) <del>- Fixed terminable middleware assigned to controller ([#12899](https://git.io/vVTnt), [74b0636](https://git.io/vVliP)) <del> <del> <del>## v5.2.27 (2016-03-29) <del>### Added <del>- Allow ignoring an id using an array key in the `unique` validation rule ([#12612](https://git.io/v29rH)) <del>- Added `InteractsWithSession::assertSessionMissing()` ([#12860](https://git.io/vajXr)) <del>- Added `chunkById()` method to query builder for faster chunking of large sets of data ([#12861](https://git.io/vajSd)) <del>- Added Blade `@hasSection` directive to determine whether something can be yielded ([#12866](https://git.io/vVem5)) <del>- Allow optional query builder calls via `when()` method ([#12878](https://git.io/vVflh)) <del>- Added IP and MAC address column types ([#12884](https://git.io/vVJsj)) <del>- Added Collections `union` method for true unions of two collections ([#12910](https://git.io/vVIzh)) <del> <del>### Changed <del>- Allow array size validation of implicit attributes ([#12640](https://git.io/v2Nzl)) <del>- Separated logic of Blade `@push` and `@section` directives ([#12808](https://git.io/vaD8n)) <del>- Ensured that middleware is applied only once ([#12911](https://git.io/vVIr2)) <del> <del>### Fixed <del>- Reverted improvements to Redis cache tagging ([#12897](https://git.io/vVUD5)) <del>- Removed route group from `make:auth` stub ([#12903](https://git.io/vVkHI)) <del> <del> <del>## v5.2.26 (2016-03-25) <del>### Added <del>- Added support for Base64 encoded `Encrypter` keys ([370ae34](https://git.io/vapFX)) <del>- Added `EncryptionServiceProvider::getEncrypterForKeyAndCipher()` ([17ce4ed](https://git.io/vahbo)) <del>- Added `Application::environmentFilePath()` ([370ae34](https://git.io/vapFX)) <del> <del>### Fixed <del>- Fixed mock in `ValidationValidatorTest::testValidateMimetypes()` ([7f35988](https://git.io/vaxfB)) <del> <del> <del>## v5.2.25 (2016-03-24) <del>### Added <del>- Added bootstrap Composer scripts to avoid loading of config/compiled files ([#12827](https://git.io/va5ja)) <del> <del>### Changed <del>- Use `File::guessExtension()` instead of `UploadedFile::guessClientExtension()` ([87e6175](https://git.io/vaAxC)) <del> <del>### Fixed <del>- Fix an issue with explicit custom validation attributes ([#12822](https://git.io/vaQbD)) <del>- Fix an issue where a view would run the `BladeEngine` instead of the `PhpEngine` ([#12830](https://git.io/vad1X)) <del>- Prevent wrong auth driver from causing unexpected end of execution ([#12821](https://git.io/vajFq)) <ide><path>CHANGELOG-5.3.md <del># Release Notes for 5.3.x <del> <del>## v5.3.30 (2017-01-26) <del> <del>### Added <del>- Added `read()` and `unread()` methods to `DatabaseNotification` ([#17243](https://github.com/laravel/framework/pull/17243)) <del> <del>### Changed <del>- Show seed output prior to running, instead of after ([#17318](https://github.com/laravel/framework/pull/17318)) <del>- Support starting slash in `elixir()` helper ([#17359](https://github.com/laravel/framework/pull/17359)) <del> <del>### Fixed <del>- Use regex in `KeyGenerateCommand` to match `APP_KEY` ([#17151](https://github.com/laravel/framework/pull/17151)) <del>- Fixed integrity constraints for database session driver ([#17301](https://github.com/laravel/framework/pull/17301)) <del> <del> <del>## v5.3.29 (2017-01-06) <del> <del>### Added <del>- Added `Blueprint::nullableMorphs()` ([#16879](https://github.com/laravel/framework/pull/16879)) <del>- Support `BaseCollection` in `BelongsToMany::sync()` ([#16882](https://github.com/laravel/framework/pull/16882)) <del>- Added `--model` flag to `make:controller` command ([#16787](https://github.com/laravel/framework/pull/16787)) <del>- Allow notifications to be broadcasted now instead of using the queue ([#16867](https://github.com/laravel/framework/pull/16867), [40f30f1](https://github.com/laravel/framework/commit/40f30f1a2131904eb4f6e6c456823e7b2cb726eb)) <del>- Support `redirectTo()` in `RedirectsUsers` ([#16896](https://github.com/laravel/framework/pull/16896)) <del>- Added `ArrayTransport` to mail component to store Swift messages in memory ([#16906](https://github.com/laravel/framework/pull/16906), [69d3d04](https://github.com/laravel/framework/commit/69d3d0463cf6bd114d2beecd8480556efb168678)) <del>- Added fallback to `SlackAttachment` notification ([#16912](https://github.com/laravel/framework/pull/16912)) <del>- Added `Macroable` trait to `RedirectResponse` ([#16929](https://github.com/laravel/framework/pull/16929)) <del>- Support namespaces when using `make:policy --model` ([#16981](https://github.com/laravel/framework/pull/16981)) <del>- Added `HourlyAt()` option for scheduled events ([#17168](https://github.com/laravel/framework/pull/17168)) <del> <del>### Changed <del>- Allow SparkPost transport transmission metadata to be set at runtime ([#16838](https://github.com/laravel/framework/pull/16838)) <del>- Pass keys to `Collection::unique()` callback ([#16883](https://github.com/laravel/framework/pull/16883)) <del>- Support calling `MailFake::send()` when `build()` has dependencies ([#16918](https://github.com/laravel/framework/pull/16918)) <del>- Changed `Mailable` properties visibility to public ([#16916](https://github.com/laravel/framework/pull/16916)) <del>- Bind `serve` command to `127.0.0.1` instead of `localhost` ([#16937](https://github.com/laravel/framework/pull/16937)) <del>- Added `old('remember')` call to `login.stub` ([#16944](https://github.com/laravel/framework/pull/16944)) <del>- Check for `db` before setting presence verifier in `ValidationServiceProvider` ([038840d](https://github.com/laravel/framework/commit/038840d477e606735f9179d97eeb20639450e8ae)) <del>- Make Eloquent's `getTimeZone()` method call adhere to `DateTimeInterface` ([#16955](https://github.com/laravel/framework/pull/16955)) <del>- Support customizable response in `SendsPasswordResetEmails` ([#16982](https://github.com/laravel/framework/pull/16982)) <del>- Stricter comparison when replacing URL for `LocalAdapter` ([#17097](https://github.com/laravel/framework/pull/17097)) <del>- Use `notification()` relationship in `HasDatabaseNotifications` ([#17093](https://github.com/laravel/framework/pull/17093)) <del>- Allow float value as expiration in Memcached cache store ([#17106](https://github.com/laravel/framework/pull/17106)) <del> <del>### Fixed <del>- Fixed a wildcard issue with `sometimes` validation rule ([#16826](https://github.com/laravel/framework/pull/16826)) <del>- Prevent error when SqlServer port is empty ([#16824](https://github.com/laravel/framework/pull/16824)) <del>- Reverted false-positive fix for `date_format` validation [#16692](https://github.com/laravel/framework/pull/16692) ([#16845](https://github.com/laravel/framework/pull/16845)) <del>- Fixed `withCount()` aliasing using multiple tables ([#16853](https://github.com/laravel/framework/pull/16853)) <del>- Fixed broken event interface listening ([#16877](https://github.com/laravel/framework/pull/16877)) <del>- Fixed empty model creation ([#16864](https://github.com/laravel/framework/pull/16864)) <del>- Fixed column overlapping on using `withCount()` on `BelongsToMany` ([#16895](https://github.com/laravel/framework/pull/16895)) <del>- Fixed `Unique::ignore()` issue ([#16948](https://github.com/laravel/framework/pull/16948)) <del>- Fixed logic in `ChannelManager::sendNow()` if `$channels` is `null` ([#17068](https://github.com/laravel/framework/pull/17068)) <del>- Fixed validating distinct for nested keys ([#17102](https://github.com/laravel/framework/pull/17102)) <del>- Fixed `HasManyThrough::updateOrCreate()` ([#17105](https://github.com/laravel/framework/pull/17105)) <del> <del>### Security <del>- Changed SwiftMailer version to `~5.4` ([#17131](https://github.com/laravel/framework/pull/17131)) <del> <del> <del>## v5.3.28 (2016-12-15) <del> <del>### Changed <del>- Refactored `ControllerMakeCommand` class ([59a1ce2](https://github.com/laravel/framework/commit/59a1ce21413221131aaf0086cd1eb7c887c701c0)) <del> <del>### Fixed <del>- Fixed implicit Router binding through IoC ([#16802](https://github.com/laravel/framework/pull/16802)) <del>- `Collection::min()` incorrectly excludes `0` when calculating minimum ([#16821](https://github.com/laravel/framework/pull/16821)) <del> <del> <del>## v5.3.27 (2016-12-15) <del> <del>### Added <del>- Added `Authenticatable::$rememberTokenName` ([#16617](https://github.com/laravel/framework/pull/16617), [38612c0](https://github.com/laravel/framework/commit/38612c0e88a48cca5744cc464a764b976f79a46d)) <del>- Added `Collection::partition()` method ([#16627](https://github.com/laravel/framework/pull/16627), [#16644](https://github.com/laravel/framework/pull/16644)) <del>- Added resource routes translations ([#16429](https://github.com/laravel/framework/pull/16429), [e91f04b](https://github.com/laravel/framework/commit/e91f04b52603194dbc90dbbaee730e171bee1449)) <del>- Allow `TokenGuard` API token to be sent through as input ([#16766](https://github.com/laravel/framework/pull/16766)) <del>- Added `Collection::isNotEmpty()` ([#16797](https://github.com/laravel/framework/pull/16797)) <del>- Added "evidence" to the list of uncountable words ([#16788](https://github.com/laravel/framework/pull/16788)) <del>- Added `reply_to` to mailer config ([#16810](https://github.com/laravel/framework/pull/16810), [dc2ce4f](https://github.com/laravel/framework/commit/dc2ce4f9efb831a304e1c2674aae1dfd819b9c56)) <del> <del>### Changed <del>- Added missing `$useReadPdo` argument to `Connection::selectOne()` ([#16625](https://github.com/laravel/framework/pull/16625)) <del>- Preload some files required by already listed files ([#16648](https://github.com/laravel/framework/pull/16648)) <del>- Clone query for chunking ([53f97a0](https://github.com/laravel/framework/commit/53f97a014da380dc85fb4b0d826475e562d78dcc), [32d0f16](https://github.com/laravel/framework/commit/32d0f164424ab5b4a2bff2ed927812ae49bd8051)) <del>- Return a regular `PDO` object if a persistent connection is requested ([#16702](https://github.com/laravel/framework/pull/16702), [6b413d5](https://github.com/laravel/framework/commit/6b413d5b416c1e0b629a3036e6c3ad84b3b76a6e)) <del>- Global `to` address now also applied for the `cc` and `bcc` options of an email ([#16705](https://github.com/laravel/framework/pull/16705)) <del>- Don't report exceptions inside queue worker signal handler ([#16738](https://github.com/laravel/framework/pull/16738)) <del>- Kill timed out queue worker process ([#16746](https://github.com/laravel/framework/pull/16746)) <del>- Removed unnecessary check in `ScheduleRunCommand::fire()` ([#16752](https://github.com/laravel/framework/pull/16752)) <del>- Only guess the ability's name if no fully qualified class name was given ([#16807](https://github.com/laravel/framework/pull/16807), [f79839e](https://github.com/laravel/framework/commit/f79839e4b72999a67d5503bbb8437547cab87236)) <del>- Remove falsy values from array in `min()` and `max()` on `Collection` ([e2d317e](https://github.com/laravel/framework/commit/e2d317efcebbdf6651d89100c0b5d80a925bb2f1)) <del> <del>### Fixed <del>- Added file existence check to `AppNameCommand::replaceIn()` to fix [#16575](https://github.com/laravel/framework/pull/16575) ([#16592](https://github.com/laravel/framework/pull/16592)) <del>- Check for `null` in `seeJsonStructure()` ([#16642](https://github.com/laravel/framework/pull/16642)) <del>- Reverted [#15264](https://github.com/laravel/framework/pull/15264) ([#16660](https://github.com/laravel/framework/pull/16660)) <del>- Fixed misleading credentials exception when `ExceptionHandler` is not bound in container ([#16666](https://github.com/laravel/framework/pull/16666)) <del>- Use `sync` as queue name for Sync Queues ([#16681](https://github.com/laravel/framework/pull/16681)) <del>- Fixed `storedAs()` and `virtualAs()` issue ([#16683](https://github.com/laravel/framework/pull/16683)) <del>- Fixed false-positive `date_format` validation ([#16692](https://github.com/laravel/framework/pull/16692)) <del>- Use translator `trans()` method in `Validator` ([#16778](https://github.com/laravel/framework/pull/16778)) <del>- Fixed runtime error in `RouteServiceProvider` when `Route` facade is not available ([#16775](https://github.com/laravel/framework/pull/16775)) <del> <del>### Removed <del>- Removed hard coded prose from scheduled task email subject ([#16790](https://github.com/laravel/framework/pull/16790)) <del> <del> <del>## v5.3.26 (2016-11-30) <del> <del>### Changed <del>- Replaced deprecated `DefaultFinder` class ([#16602](https://github.com/laravel/framework/pull/16602)) <del> <del>### Fixed <del>- Reverted [#16506](https://github.com/laravel/framework/pull/16506) ([#16607](https://github.com/laravel/framework/pull/16607)) <del> <del> <del>## v5.3.25 (2016-11-29) <del> <del>### Added <del>- Added `before_or_equal` and `after_or_equal` validation rules ([#16490](https://github.com/laravel/framework/pull/16490)) <del>- Added fluent builder for `SlackMessageAttachmentField` ([#16535](https://github.com/laravel/framework/pull/16535), [db4879a](https://github.com/laravel/framework/commit/db4879ae84a3a1959729ac2732ae42cfe377314c)) <del>- Added the possibility to set and get file permissions in `Filesystem` ([#16560](https://github.com/laravel/framework/pull/16560)) <del> <del>### Changed <del>- Added additional `keyType` check to avoid using an invalid type for eager load constraints ([#16452](https://github.com/laravel/framework/pull/16452)) <del>- Always debug Pusher in `PusherBroadcaster::broadcast()` ([#16493](https://github.com/laravel/framework/pull/16493)) <del>- Don't pluralize "metadata" ([#16518](https://github.com/laravel/framework/pull/16518)) <del>- Always pass a collection to `LengthAwarePaginator` from `paginate()` methods ([#16547](https://github.com/laravel/framework/pull/16547)) <del>- Avoid unexpected connection timeouts when flushing tagged caches on Redis ([#16568](https://github.com/laravel/framework/pull/16568)) <del>- Enabled unicode support to `NexmoSmsChannel` ([#16577](https://github.com/laravel/framework/pull/16577), [3001640](https://github.com/laravel/framework/commit/30016408a6911afba4aa7739d69948d13612ea06)) <del> <del>### Fixed <del>- Fixed view compilation bug when using " or " in strings ([#16506](https://github.com/laravel/framework/pull/16506)) <del> <del> <del>## v5.3.24 (2016-11-21) <del> <del>### Added <del>- Added `AuthenticateSession` middleware ([fc302a6](https://github.com/laravel/framework/commit/fc302a6667f9dcce53395d01d8e6ba752ea62955)) <del>- Support arrays in `HasOne::withDefault()` ([#16382](https://github.com/laravel/framework/pull/16382)) <del>- Define route basename for resources ([#16352](https://github.com/laravel/framework/pull/16352)) <del>- Added `$fallback` parameter to `Redirector::back()` ([#16426](https://github.com/laravel/framework/pull/16426)) <del>- Added support for footer and markdown in `SlackAttachment` ([#16451](https://github.com/laravel/framework/pull/16451)) <del>- Added password change feedback auth stubs ([#16461](https://github.com/laravel/framework/pull/16461)) <del>- Added `name` to default register route ([#16480](https://github.com/laravel/framework/pull/16480)) <del>- Added `ServiceProvider::loadRoutesFrom()` method ([#16483](https://github.com/laravel/framework/pull/16483)) <del> <del>### Changed <del>- Use `getKey()` instead of `$id` in `PusherBroadcaster` ([#16438](https://github.com/laravel/framework/pull/16438)) <del> <del>### Fixed <del>- Pass `PheanstalkJob` to Pheanstalk's `delete()` method ([#16415](https://github.com/laravel/framework/pull/16415)) <del>- Don't call PDO callback in `reconnectIfMissingConnection()` until it is needed ([#16422](https://github.com/laravel/framework/pull/16422)) <del>- Don't timeout queue if `--timeout` is set to `0` ([#16465](https://github.com/laravel/framework/pull/16465)) <del>- Respect `--force` option of `queue:work` in maintenance mode ([#16468](https://github.com/laravel/framework/pull/16468)) <del> <del> <del>## v5.3.23 (2016-11-14) <del> <del>### Added <del>- Added database slave failover ([#15553](https://github.com/laravel/framework/pull/15553), [ed28c7f](https://github.com/laravel/framework/commit/ed28c7fa11d3754d618606bf8fc2f00690cfff66)) <del>- Added `Arr::shuffle($array)` ([ed28c7f](https://github.com/laravel/framework/commit/ed28c7fa11d3754d618606bf8fc2f00690cfff66)) <del>- Added `prepareForValidation()` method to `FormRequests` ([#16238](https://github.com/laravel/framework/pull/16238)) <del>- Support SparkPost transports options to be set at runtime ([#16254](https://github.com/laravel/framework/pull/16254)) <del>- Support setting `$replyTo` for email notifications ([#16277](https://github.com/laravel/framework/pull/16277)) <del>- Support `url` configuration parameter to generate filesystem disk URL ([#16281](https://github.com/laravel/framework/pull/16281), [dcff158](https://github.com/laravel/framework/commit/dcff158c63093523eadffc34a9ba8c1f8d4e53c0)) <del>- Allow `SerializesModels` to restore models excluded by global scope ([#16301](https://github.com/laravel/framework/pull/16301)) <del>- Allow loading specific columns while eager-loading Eloquent relationships ([#16327](https://github.com/laravel/framework/pull/16327)) <del>- Allow Eloquent `HasOne` relationships to return a "default model" ([#16198](https://github.com/laravel/framework/pull/16198), [9b59f67](https://github.com/laravel/framework/commit/9b59f67daeb63bad11af9b70b4a35c6435240ff7)) <del>- Allow `SlackAttachment` color override ([#16360](https://github.com/laravel/framework/pull/16360)) <del>- Allow chaining factory calls to `define()` and `state()` ([#16389](https://github.com/laravel/framework/pull/16389)) <del> <del>### Changed <del>- Dried-up console parser and extract token parsing ([#16197](https://github.com/laravel/framework/pull/16197)) <del>- Support empty array for query builder `orders` property ([#16225](https://github.com/laravel/framework/pull/16225)) <del>- Properly handle filling JSON attributes on Eloquent models ([#16228](https://github.com/laravel/framework/pull/16228)) <del>- Use `forceReconnection()` method in `Mailer` ([#16298](https://github.com/laravel/framework/pull/16298)) <del>- Double-quote MySQL JSON expressions ([#16308](https://github.com/laravel/framework/pull/16308)) <del>- Moved login attempt code to separate method ([#16317](https://github.com/laravel/framework/pull/16317)) <del>- Escape the RegExp delimiter in `Validator::getExplicitKeys()` ([#16309](https://github.com/laravel/framework/pull/16309)) <del>- Use default Slack colors in `SlackMessage` ([#16345](https://github.com/laravel/framework/pull/16345)) <del>- Support presence channels names containing the words `private-` or `presence-` ([#16353](https://github.com/laravel/framework/pull/16353)) <del>- Fail test, instead of throwing an exception when `seeJson()` fails ([#16350](https://github.com/laravel/framework/pull/16350)) <del>- Call `sendPerformed()` for all mail transports ([#16366](https://github.com/laravel/framework/pull/16366)) <del>- Add `X-SES-Message-ID` header in `SesTransport::send()` ([#16366](https://github.com/laravel/framework/pull/16366)) <del>- Throw `BroadcastException` when `PusherBroadcaster::broadcast()` fails ([#16398](https://github.com/laravel/framework/pull/16398)) <del> <del>### Fixed <del>- Catch errors when handling a failed job ([#16212](https://github.com/laravel/framework/pull/16212)) <del>- Return array from `Translator::sortReplacements()` ([#16221](https://github.com/laravel/framework/pull/16221)) <del>- Don't use multi-byte functions in `UrlGenerator::to()` ([#16081](https://github.com/laravel/framework/pull/16081)) <del>- Support configuration files as symbolic links ([#16080](https://github.com/laravel/framework/pull/16080)) <del>- Fixed wrapping and escaping in SQL Server `dropIfExists()` ([#16279](https://github.com/laravel/framework/pull/16279)) <del>- Throw `ManuallyFailedException` if `InteractsWithQueue::fail()` is called manually ([#16318](https://github.com/laravel/framework/pull/16318), [a20fa97](https://github.com/laravel/framework/commit/a20fa97445be786f9f5f09e2e9b905a00064b2da)) <del>- Catch `Throwable` in timezone validation ([#16344](https://github.com/laravel/framework/pull/16344)) <del>- Fixed `Auth::onceUsingId()` by reversing the order of retrieving the id in `SessionGuard` ([#16373](https://github.com/laravel/framework/pull/16373)) <del>- Fixed bindings on update statements with advanced joins ([#16368](https://github.com/laravel/framework/pull/16368)) <del> <del> <del>## v5.3.22 (2016-11-01) <del> <del>### Added <del>- Added support for carbon-copy in mail notifications ([#16152](https://github.com/laravel/framework/pull/16152)) <del>- Added `-r` shortcut to `make:controller` command ([#16141](https://github.com/laravel/framework/pull/16141)) <del>- Added `HasDatabaseNotifications::readNotifications()` method ([#16164](https://github.com/laravel/framework/pull/16164)) <del>- Added `broadcastOn()` method to allow notifications to be broadcasted to custom channels ([#16170](https://github.com/laravel/framework/pull/16170)) <del> <del>### Changed <del>- Avoid extraneous database query when last `chunk()` is partial ([#16180](https://github.com/laravel/framework/pull/16180)) <del>- Return unique middleware stack from `Route::gatherMiddleware()` ([#16185](https://github.com/laravel/framework/pull/16185)) <del>- Return early when `Collection::chunk()` size zero or less ([#16206](https://github.com/laravel/framework/pull/16206), [46ebd7f](https://github.com/laravel/framework/commit/46ebd7fa1f35eeb37af891abfc611f7262c91c29)) <del> <del>### Fixed <del>- Bind `double` as `PDO::PARAM_INT` on MySQL connections ([#16069](https://github.com/laravel/framework/pull/16069)) <del> <del> <del>## v5.3.21 (2016-10-26) <del> <del>### Added <del>- Added `ResetsPasswords::validationErrorMessages()` method ([#16111](https://github.com/laravel/framework/pull/16111)) <del> <del>### Changed <del>- Use `toString()` instead of `(string)` on UUIDs for notification ids ([#16109](https://github.com/laravel/framework/pull/16109)) <del> <del>### Fixed <del>- Don't hydrate files in `Validator` ([#16105](https://github.com/laravel/framework/pull/16105)) <del> <del>### Removed <del>- Removed `-q` shortcut from `make:listener` command ([#16110](https://github.com/laravel/framework/pull/16110)) <del> <del> <del>## v5.3.20 (2016-10-25) <del> <del>### Added <del>- Added `--resource` (or `-r`) option to `make:model` command ([#15993](https://github.com/laravel/framework/pull/15993)) <del>- Support overwriting channel name for broadcast notifications ([#16018](https://github.com/laravel/framework/pull/16018), [4e30db5](https://github.com/laravel/framework/commit/4e30db5fbc556f7925130f9805f2dec47592719e)) <del>- Added `Macroable` trait to `Rule` ([#16028](https://github.com/laravel/framework/pull/16028)) <del>- Added `Session::remember()` helper ([#16041](https://github.com/laravel/framework/pull/16041)) <del>- Added option shorthands to `make:listener` command ([#16038](https://github.com/laravel/framework/pull/16038)) <del>- Added `RegistersUsers::registered()` method ([#16036](https://github.com/laravel/framework/pull/16036)) <del>- Added `ResetsPasswords::rules()` method ([#16060](https://github.com/laravel/framework/pull/16060)) <del>- Added `$page` parameter to `simplePaginate()` in `BelongsToMany` and `HasManyThrough` ([#16075](https://github.com/laravel/framework/pull/16075)) <del> <del>### Changed <del>- Catch `dns_get_record()` exceptions in `validateActiveUrl()` ([#15979](https://github.com/laravel/framework/pull/15979)) <del>- Allow reconnect during database transactions ([#15931](https://github.com/laravel/framework/pull/15931)) <del>- Use studly case for controller names generated by `make:model` command ([#15988](https://github.com/laravel/framework/pull/15988)) <del>- Support objects that are castable to strings in `Collection::keyBy()` ([#16001](https://github.com/laravel/framework/pull/16001)) <del>- Switched to using a static object to collect console application bootstrappers that need to run on Artisan starting ([#16012](https://github.com/laravel/framework/pull/16012)) <del>- Return unique middleware stack in `SortedMiddleware::sortMiddleware()` ([#16034](https://github.com/laravel/framework/pull/16034)) <del>- Allow methods inside `@foreach` and `@forelse` expressions ([#16087](https://github.com/laravel/framework/pull/16087)) <del>- Improved Scheduler parameter escaping ([#16088](https://github.com/laravel/framework/pull/16088)) <del> <del>### Fixed <del>- Fixed `session_write_close()` on PHP7 ([#15968](https://github.com/laravel/framework/pull/15968)) <del>- Fixed ambiguous id issues when restoring models with eager loaded / joined query ([#15983](https://github.com/laravel/framework/pull/15983)) <del>- Fixed integer and double support in `JsonExpression` ([#16068](https://github.com/laravel/framework/pull/16068)) <del>- Fixed UUIDs when queueing notifications ([18d26df](https://github.com/laravel/framework/commit/18d26df24f1f3b17bd20c7244d9b85d273138d79)) <del>- Fixed empty session issue when the session file is being accessed simultaneously ([#15998](https://github.com/laravel/framework/pull/15998)) <del> <del>### Removed <del>- Removed `Requests` import from controller stubs ([#16011](https://github.com/laravel/framework/pull/16011)) <del>- Removed unnecessary validation feedback for password confirmation field ([#16100](https://github.com/laravel/framework/pull/16100)) <del> <del> <del>## v5.3.19 (2016-10-17) <del> <del>### Added <del>- Added `--controller` (or `-c`) option to `make:model` command ([#15795](https://github.com/laravel/framework/pull/15795)) <del>- Added object based `dimensions` validation rule ([#15852](https://github.com/laravel/framework/pull/15852)) <del>- Added object based `in` and `not_in` validation rule ([#15923](https://github.com/laravel/framework/pull/15923), [#15951](https://github.com/laravel/framework/pull/15951), [336a807](https://github.com/laravel/framework/commit/336a807ee56de27adcb3f9d34b337300520568ac)) <del>- Added `clear-compiled` command success message ([#15868](https://github.com/laravel/framework/pull/15868)) <del>- Added `SlackMessage::http()` to specify additional `headers` or `proxy` options ([#15882](https://github.com/laravel/framework/pull/15882)) <del>- Added a name to the logout route ([#15889](https://github.com/laravel/framework/pull/15889)) <del>- Added "feedback" to `Pluralizer::uncountable()` ([#15895](https://github.com/laravel/framework/pull/15895)) <del>- Added `FormRequest::withValidator($validator)` hook ([#15918](https://github.com/laravel/framework/pull/15918), [bf8a36a](https://github.com/laravel/framework/commit/bf8a36ac3df03a2c889cbc9aa535e5cf9ff48777)) <del>- Add missing `ClosureCommand::$callback` property ([#15956](https://github.com/laravel/framework/pull/15956)) <del> <del>### Changed <del>- Total rewrite of middleware sorting logic ([6b69fb8](https://github.com/laravel/framework/commit/6b69fb81fc7c36e9e129a0ce2e56a824cc907859), [9cc5334](https://github.com/laravel/framework/commit/9cc5334d00824441ccce5e9d2979723e41b2fc05)) <del>- Wrap PostgreSQL database schema changes in a transaction ([#15780](https://github.com/laravel/framework/pull/15780), [#15962](https://github.com/laravel/framework/pull/15962)) <del>- Expect `array` on `Validator::explodeRules()` ([#15838](https://github.com/laravel/framework/pull/15838)) <del>- Return `null` if an empty key was passed to `Model::getAttribute()` ([#15874](https://github.com/laravel/framework/pull/15874)) <del>- Support multiple `LengthAwarePaginator` on a single page with different `$pageName` properties ([#15870](https://github.com/laravel/framework/pull/15870)) <del>- Pass ids to `ModelNotFoundException` ([#15896](https://github.com/laravel/framework/pull/15896)) <del>- Improved database transaction logic ([7a0832b](https://github.com/laravel/framework/commit/7a0832bb44057f1060c96c2e01652aae7c583323)) <del>- Use `name()` method instead of `getName()` ([#15955](https://github.com/laravel/framework/pull/15955)) <del>- Minor syntax improvements ([#15953](https://github.com/laravel/framework/pull/15953), [#15954](https://github.com/laravel/framework/pull/15954), [4e9c9fd](https://github.com/laravel/framework/commit/4e9c9fd98b4dff71f449764e87c52577e2634587)) <del> <del>### Fixed <del>- Fixed `migrate:status` using another connection ([#15824](https://github.com/laravel/framework/pull/15824)) <del>- Fixed calling closure based commands ([#15873](https://github.com/laravel/framework/pull/15873)) <del>- Split `SimpleMessage` by all possible EOLs ([#15921](https://github.com/laravel/framework/pull/15921)) <del>- Ensure that the search and the creation/update of Eloquent instances happens on the same connection ([#15958](https://github.com/laravel/framework/pull/15958)) <del> <del> <del>## v5.3.18 (2016-10-07) <del> <del>### Added <del>- Added object based `unique` and `exists` validation rules ([#15809](https://github.com/laravel/framework/pull/15809)) <del> <del>### Changed <del>- Added primary key to `migrations` table ([#15770](https://github.com/laravel/framework/pull/15770)) <del>- Simplified `route:list` command code ([#15802](https://github.com/laravel/framework/pull/15802), [cb2eb79](https://github.com/laravel/framework/commit/cb2eb7963b29aafe63c87e1d2b1e633ecd0c25b0)) <del> <del>### Fixed <del>- Use eloquent collection for proper serialization of [#15789](https://github.com/laravel/framework/pull/15789) ([1c78e00](https://github.com/laravel/framework/commit/1c78e00ef3815e7b0bf710037b52faefb464e97d)) <del>- Reverted [#15722](https://github.com/laravel/framework/pull/15722) ([#15813](https://github.com/laravel/framework/pull/15813)) <del> <del> <del>## v5.3.17 (2016-10-06) <del> <del>### Added <del>- Added model factory "states" ([#14241](https://github.com/laravel/framework/pull/14241)) <del> <del>### Changed <del>- `Collection::only()` now returns all items if `$keys` is `null` ([#15695](https://github.com/laravel/framework/pull/15695)) <del> <del>### Fixed <del>- Added workaround for Memcached 3 on PHP7 when using `many()` ([#15739](https://github.com/laravel/framework/pull/15739)) <del>- Fixed bug in `Validator::hydrateFiles()` when removing the files array ([#15663](https://github.com/laravel/framework/pull/15663)) <del>- Fixed model factory bug when `$amount` is zero ([#15764](https://github.com/laravel/framework/pull/15764), [#15779](https://github.com/laravel/framework/pull/15779)) <del>- Prevent multiple notifications getting sent out when using the `Notification` facade ([#15789](https://github.com/laravel/framework/pull/15789)) <del> <del> <del>## v5.3.16 (2016-10-04) <del> <del>### Added <del>- Added "furniture" and "wheat" to `Pluralizer::uncountable()` ([#15703](https://github.com/laravel/framework/pull/15703)) <del>- Allow passing `$keys` to `Model::getAttributes()` ([#15722](https://github.com/laravel/framework/pull/15722)) <del>- Added database blueprint for soft deletes with timezone ([#15737](https://github.com/laravel/framework/pull/15737)) <del>- Added given guards to `AuthenticationException` ([#15745](https://github.com/laravel/framework/pull/15745)) <del>- Added [Seneca](https://en.wikipedia.org/wiki/Seneca_the_Younger) quote to `Inspire` command ([#15747](https://github.com/laravel/framework/pull/15747)) <del>- Added `div#app` to auth layout stub ([08bcbdb](https://github.com/laravel/framework/commit/08bcbdbe70b69330943cc45625b160877b37341a)) <del>- Added PHP 7.1 timeout handler to queue worker ([cc9e1f0](https://github.com/laravel/framework/commit/cc9e1f09683fd23cf8e973e84bf310f7ce1304a2)) <del> <del>### Changed <del>- Changed visibility of `Route::getController()` to public ([#15678](https://github.com/laravel/framework/pull/15678)) <del>- Changed notifications `id` column type to `uuid` ([#15719](https://github.com/laravel/framework/pull/15719)) <del> <del>### Fixed <del>- Fixed PDO bindings when using `whereHas()` ([#15740](https://github.com/laravel/framework/pull/15740)) <del> <del> <del>## v5.3.15 (2016-09-29) <del> <del>### Changed <del>- Use granular notification queue jobs ([#15681](https://github.com/laravel/framework/pull/15681), [3a5e510](https://github.com/laravel/framework/commit/3a5e510af5e92ab2eaa25d728b8c74d9cf8833c2)) <del>- Reverted recent changes to the queue ([d8dc8dc](https://github.com/laravel/framework/commit/d8dc8dc4bde56f63d8b1eacec3f3d4d68cc51894)) <del> <del> <del>## v5.3.14 (2016-09-29) <del> <del>### Fixed <del>- Fixed `DaemonCommand` command name ([b681bff](https://github.com/laravel/framework/commit/b681bffc247ebac1fbb4afcec03e2ce12627e0cc)) <del> <del> <del>## v5.3.13 (2016-09-29) <del> <del>### Added <del>- Added `serialize()` and `unserialize()` on `RedisStore` ([#15657](https://github.com/laravel/framework/pull/15657)) <del> <del>### Changed <del>- Use `$signature` command style on `DaemonCommand` and `WorkCommand` ([#15677](https://github.com/laravel/framework/pull/15677)) <del> <del> <del>## v5.3.12 (2016-09-29) <del> <del>### Added <del>- Added support for priority level in mail notifications ([#15651](https://github.com/laravel/framework/pull/15651)) <del>- Added missing `$minutes` property on `CookieSessionHandler` ([#15664](https://github.com/laravel/framework/pull/15664)) <del> <del>### Changed <del>- Removed forking and PCNTL requirements while still supporting timeouts ([#15650](https://github.com/laravel/framework/pull/15650)) <del>- Set exception handler first thing in `WorkCommand::runWorker()` ([99994fe](https://github.com/laravel/framework/commit/99994fe23c1215d5a8e798da03947e6a5502b8f9)) <del> <del> <del>## v5.3.11 (2016-09-27) <del> <del>### Added <del>- Added `Kernel::setArtisan()` method ([#15531](https://github.com/laravel/framework/pull/15531)) <del>- Added a default method for validation message variable replacing ([#15527](https://github.com/laravel/framework/pull/15527)) <del>- Added support for a schema array in Postgres config ([#15535](https://github.com/laravel/framework/pull/15535)) <del>- Added `SoftDeletes::isForceDeleting()` method ([#15580](https://github.com/laravel/framework/pull/15580)) <del>- Added support for tasks scheduling using command classes instead of signatures ([#15591](https://github.com/laravel/framework/pull/15591)) <del>- Added support for passing array of emails/user-objects to `Mailable::to()` ([#15603](https://github.com/laravel/framework/pull/15603)) <del>- Add missing interface methods in `Registrar` contract ([#15616](https://github.com/laravel/framework/pull/15616)) <del> <del>### Changed <del>- Let the queue worker sleep for 1s when app is down for maintenance ([#15520](https://github.com/laravel/framework/pull/15520)) <del>- Improved validator messages for implicit attributes errors ([#15538](https://github.com/laravel/framework/pull/15538)) <del>- Use `Carbon::now()->getTimestamp()` instead of `time()` in various places ([#15544](https://github.com/laravel/framework/pull/15544), [#15545](https://github.com/laravel/framework/pull/15545), [c5984af](https://github.com/laravel/framework/commit/c5984af3757e492c6e79cef161169ea09b5b9c7a), [#15549](https://github.com/laravel/framework/pull/15549)) <del>- Removed redundant condition from `updateOrInsert()` ([#15540](https://github.com/laravel/framework/pull/15540)) <del>- Throw `LogicException` on container alias loop ([#15548](https://github.com/laravel/framework/pull/15548)) <del>- Handle empty `$files` in `Request::duplicate()` ([#15558](https://github.com/laravel/framework/pull/15558)) <del>- Support exact matching of custom validation messages ([#15557](https://github.com/laravel/framework/pull/15557)) <del> <del>### Fixed <del>- Decode URL in `Request::segments()` and `Request::is()` ([#15524](https://github.com/laravel/framework/pull/15524)) <del>- Replace only the first instance of the app namespace in Generators ([#15575](https://github.com/laravel/framework/pull/15575)) <del>- Fixed artisan `--env` issue where environment file wasn't loaded ([#15629](https://github.com/laravel/framework/pull/15629)) <del>- Fixed migration with comments using `ANSI_QUOTE` SQL mode ([#15620](https://github.com/laravel/framework/pull/15620)) <del>- Disabled queue worker process forking until it works with AWS SQS ([23c1276](https://github.com/laravel/framework/commit/23c12765557ebc5e3c35ad024d645620f7b907d6)) <del> <del> <del>## v5.3.10 (2016-09-20) <del> <del>### Added <del>- Fire `Registered` event when a user registers ([#15401](https://github.com/laravel/framework/pull/15401)) <del>- Added `Container::factory()` method ([#15415](https://github.com/laravel/framework/pull/15415)) <del>- Added `$default` parameter to query/eloquent builder `when()` method ([#15428](https://github.com/laravel/framework/pull/15428), [#15442](https://github.com/laravel/framework/pull/15442)) <del>- Added missing `$notifiable` parameter to `ResetPassword::toMail()` ([#15448](https://github.com/laravel/framework/pull/15448)) <del> <del>### Changed <del>- Updated `ServiceProvider` to use `resourcePath()` over `basePath()` ([#15400](https://github.com/laravel/framework/pull/15400)) <del>- Throw `RuntimeException` if `pcntl_fork()` doesn't exists ([#15393](https://github.com/laravel/framework/pull/15393)) <del>- Changed visibility of `Container::getAlias()` to public ([#15444](https://github.com/laravel/framework/pull/15444)) <del>- Changed visibility of `VendorPublishCommand::publishTag()` to protected ([#15461](https://github.com/laravel/framework/pull/15461)) <del>- Changed visibility of `TestCase::afterApplicationCreated()` to public ([#15493](https://github.com/laravel/framework/pull/15493)) <del>- Prevent calling `Model` methods when calling them as attributes ([#15438](https://github.com/laravel/framework/pull/15438)) <del>- Default `$callback` to `null` in eloquent builder `whereHas()` ([#15475](https://github.com/laravel/framework/pull/15475)) <del>- Support newlines in Blade's `@foreach` ([#15485](https://github.com/laravel/framework/pull/15485)) <del>- Try to reconnect if connection is lost during database transaction ([#15511](https://github.com/laravel/framework/pull/15511)) <del>- Renamed `InteractsWithQueue::failed()` to `fail()` ([e1d60e0](https://github.com/laravel/framework/commit/e1d60e0fe120a7898527fb997aa2fb9de263190c)) <del> <del>### Fixed <del>- Reverted "Allow passing a `Closure` to `View::share()` [#15312](https://github.com/laravel/framework/pull/15312)" ([#15312](https://github.com/laravel/framework/pull/15312)) <del>- Resolve issues with multi-value select elements ([#15436](https://github.com/laravel/framework/pull/15436)) <del>- Fixed issue with `X-HTTP-METHOD-OVERRIDE` spoofing in `Request` ([#15410](https://github.com/laravel/framework/pull/15410)) <del> <del>### Removed <del>- Removed unused `SendsPasswordResetEmails::resetNotifier()` method ([#15446](https://github.com/laravel/framework/pull/15446)) <del>- Removed uninstantiable `Seeder` class ([#15450](https://github.com/laravel/framework/pull/15450)) <del>- Removed unnecessary variable in `AuthenticatesUsers::login()` ([#15507](https://github.com/laravel/framework/pull/15507)) <del> <del> <del>## v5.3.9 (2016-09-12) <del> <del>### Changed <del>- Optimized performance of `Str::startsWith()` and `Str::endsWith()` ([#15380](https://github.com/laravel/framework/pull/15380), [#15397](https://github.com/laravel/framework/pull/15397)) <del> <del>### Fixed <del>- Fixed queue job without `--tries` option marks jobs failed ([#15370](https://github.com/laravel/framework/pull/15370), [#15390](https://github.com/laravel/framework/pull/15390)) <del> <del> <del>## v5.3.8 (2016-09-09) <del> <del>### Added <del>- Added missing `MailableMailer::later()` method ([#15364](https://github.com/laravel/framework/pull/15364)) <del>- Added missing `$queue` parameter on `SyncJob` ([#15368](https://github.com/laravel/framework/pull/15368)) <del>- Added SSL options for PostgreSQL DSN ([#15371](https://github.com/laravel/framework/pull/15371)) <del>- Added ability to disable touching of parent when toggling relation ([#15263](https://github.com/laravel/framework/pull/15263)) <del>- Added username, icon and channel options for Slack Notifications ([#14910](https://github.com/laravel/framework/pull/14910)) <del> <del>### Changed <del>- Renamed methods in `NotificationFake` ([69b08f6](https://github.com/laravel/framework/commit/69b08f66fbe70b4df8332a8f2a7557a49fd8c693)) <del>- Minor code improvements ([#15369](https://github.com/laravel/framework/pull/15369)) <del> <del>### Fixed <del>- Fixed catchable fatal error introduced [#15250](https://github.com/laravel/framework/pull/15250) ([#15350](https://github.com/laravel/framework/pull/15350)) <del> <del> <del>## v5.3.7 (2016-09-08) <del> <del>### Added <del>- Added missing translation for `mimetypes` validation ([#15209](https://github.com/laravel/framework/pull/15209), [#3921](https://github.com/laravel/laravel/pull/3921)) <del>- Added ability to check if between two times when using scheduler ([#15216](https://github.com/laravel/framework/pull/15216), [#15306](https://github.com/laravel/framework/pull/15306)) <del>- Added `X-RateLimit-Reset` header to throttled responses ([#15275](https://github.com/laravel/framework/pull/15275)) <del>- Support aliases on `withCount()` ([#15279](https://github.com/laravel/framework/pull/15279)) <del>- Added `Filesystem::isReadable()` ([#15289](https://github.com/laravel/framework/pull/15289)) <del>- Added `Collection::split()` method ([#15302](https://github.com/laravel/framework/pull/15302)) <del>- Allow passing a `Closure` to `View::share()` ([#15312](https://github.com/laravel/framework/pull/15312)) <del>- Added support for `Mailable` messages in `MailChannel` ([#15318](https://github.com/laravel/framework/pull/15318)) <del>- Added `with*()` syntax to `Mailable` class ([#15316](https://github.com/laravel/framework/pull/15316)) <del>- Added `--path` option for `migrate:rollback/refresh/reset` ([#15251](https://github.com/laravel/framework/pull/15251)) <del>- Allow numeric keys on `morphMap()` ([#15332](https://github.com/laravel/framework/pull/15332)) <del>- Added fakes for bus, events, mail, queue and notifications ([5deab59](https://github.com/laravel/framework/commit/5deab59e89b85e09b2bd1642e4efe55e933805ca)) <del> <del>### Changed <del>- Update `Model::save()` to return `true` when no error occurs ([#15236](https://github.com/laravel/framework/pull/15236)) <del>- Optimized performance of `Arr::first()` ([#15213](https://github.com/laravel/framework/pull/15213)) <del>- Swapped `drop()` for `dropIfExists()` in all stubs ([#15230](https://github.com/laravel/framework/pull/15230)) <del>- Allow passing object instance to `class_uses_recursive()` ([#15223](https://github.com/laravel/framework/pull/15223)) <del>- Improved handling of failed file uploads during validation ([#15166](https://github.com/laravel/framework/pull/15166)) <del>- Hide pagination if it does not have multiple pages ([#15246](https://github.com/laravel/framework/pull/15246)) <del>- Cast Pusher message to JSON in `validAuthentiactoinResponse()` ([#15262](https://github.com/laravel/framework/pull/15262)) <del>- Throw exception if queue failed to create payload ([#15284](https://github.com/laravel/framework/pull/15284)) <del>- Call `getUrl()` first in `FilesystemAdapter::url()` ([#15291](https://github.com/laravel/framework/pull/15291)) <del>- Consider local key in `HasManyThrough` relationships ([#15303](https://github.com/laravel/framework/pull/15303)) <del>- Fail faster by checking Route Validators in likely fail order ([#15287](https://github.com/laravel/framework/pull/15287)) <del>- Make the `FilesystemAdapter::delete()` behave like `FileSystem::delete()` ([#15308](https://github.com/laravel/framework/pull/15308)) <del>- Don't call `floor()` in `Collection::median()` ([#15343](https://github.com/laravel/framework/pull/15343)) <del>- Always return number from aggregate method `sum()` ([#15345](https://github.com/laravel/framework/pull/15345)) <del> <del>### Fixed <del>- Reverted "Hide empty paginators" [#15125](https://github.com/laravel/framework/pull/15125) ([#15241](https://github.com/laravel/framework/pull/15241)) <del>- Fixed empty `multifile` uploads ([#15250](https://github.com/laravel/framework/pull/15250)) <del>- Fixed regression in `save(touch)` option ([#15264](https://github.com/laravel/framework/pull/15264)) <del>- Fixed lower case model names in policy classes ([15270](https://github.com/laravel/framework/pull/15270)) <del>- Allow models with global scopes to be refreshed ([#15282](https://github.com/laravel/framework/pull/15282)) <del>- Fix `ChannelManager::getDefaultDriver()` implementation ([#15288](https://github.com/laravel/framework/pull/15288)) <del>- Fire `illuminate.queue.looping` event before running daemon ([#15290](https://github.com/laravel/framework/pull/15290)) <del>- Check attempts before firing queue job ([#15319](https://github.com/laravel/framework/pull/15319)) <del>- Fixed `morphTo()` naming inconsistency ([#15334](https://github.com/laravel/framework/pull/15334)) <del> <del> <del>## v5.3.6 (2016-09-01) <del> <del>### Added <del>- Added `required` attributes to auth scaffold ([#15087](https://github.com/laravel/framework/pull/15087)) <del>- Support custom recipient(s) in `MailMessage` notifications ([#15100](https://github.com/laravel/framework/pull/15100)) <del>- Support custom greeting in `SimpleMessage` notifications ([#15108](https://github.com/laravel/framework/pull/15108)) <del>- Added `prependLocation()` method to `FileViewFinder` ([#15103](https://github.com/laravel/framework/pull/15103)) <del>- Added fluent email priority setter ([#15178](https://github.com/laravel/framework/pull/15178)) <del>- Added `send()` and `sendNow()` to notification factory contract ([0066b5d](https://github.com/laravel/framework/commit/0066b5da6f009275348ab71904da2376c6c47281)) <del> <del>### Changed <del>- Defer resolving of PDO connection until needed ([#15031](https://github.com/laravel/framework/pull/15031)) <del>- Send plain text email along with HTML email notifications ([#15016](https://github.com/laravel/framework/pull/15016), [#15092](https://github.com/laravel/framework/pull/15092), [#15115](https://github.com/laravel/framework/pull/15115)) <del>- Stop further validation if a `required` rule fails ([#15089](https://github.com/laravel/framework/pull/15089)) <del>- Swaps `drop()` for `dropIfExists()` in migration stub ([#15113](https://github.com/laravel/framework/pull/15113)) <del>- The `resource_path()` helper now relies on `Application::resourcePath()` ([#15095](https://github.com/laravel/framework/pull/15095)) <del>- Optimized performance of `Str::random()` ([#15112](https://github.com/laravel/framework/pull/15112)) <del>- Show `app.name` in auth stub ([#15138](https://github.com/laravel/framework/pull/15138)) <del>- Switched from `htmlentities()` to `htmlspecialchars()` in `e()` helper ([#15159](https://github.com/laravel/framework/pull/15159)) <del>- Hide empty paginators ([#15125](https://github.com/laravel/framework/pull/15125)) <del> <del>### Fixed <del>- Fixed `migrate:rollback` with `FETCH_ASSOC` enabled ([#15088](https://github.com/laravel/framework/pull/15088)) <del>- Fixes query builder not considering raw expressions in `whereIn()` ([#15078](https://github.com/laravel/framework/pull/15078)) <del>- Fixed notifications serialization mistake in `ChannelManager` ([#15106](https://github.com/laravel/framework/pull/15106)) <del>- Fixed session id collisions ([#15206](https://github.com/laravel/framework/pull/15206)) <del>- Fixed extending cache expiration time issue in `file` cache ([#15164](https://github.com/laravel/framework/pull/15164)) <del> <del>### Removed <del>- Removed data transformation in `Response::json()` ([#15137](https://github.com/laravel/framework/pull/15137)) <del> <del> <del>## v5.3.4 (2016-08-26) <del> <del>### Added <del>- Added ability to set from address for email notifications ([#15055](https://github.com/laravel/framework/pull/15055)) <del> <del>### Changed <del>- Support implicit keys in `MessageBag::get()` ([#15063](https://github.com/laravel/framework/pull/15063)) <del>- Allow passing of closures to `assertViewHas()` ([#15074](https://github.com/laravel/framework/pull/15074)) <del>- Strip protocol from Route group domains parameters ([#15070](https://github.com/laravel/framework/pull/15070)) <del>- Support dot notation as callback in `Arr::sort()` ([#15050](https://github.com/laravel/framework/pull/15050)) <del>- Use Redis database interface instead of implementation ([#15041](https://github.com/laravel/framework/pull/15041)) <del>- Allow closure middleware to be registered from the controller constructor ([#15080](https://github.com/laravel/framework/pull/15080), [abd85c9](https://github.com/laravel/framework/commit/abd85c916df0cc0a6dc55de943a39db8b7eb4e0d)) <del> <del>### Fixed <del>- Fixed plural form of Emoji ([#15068](https://github.com/laravel/framework/pull/15068)) <del> <del> <del>## v5.3.3 (2016-08-26) <del> <del>### Fixed <del>- Fixed testing of Eloquent model events ([#15052](https://github.com/laravel/framework/pull/15052)) <del> <del> <del>## v5.3.2 (2016-08-24) <del> <del>### Fixed <del>- Revert changes to Eloquent `Builder` that breaks `firstOr*` methods ([#15018](https://github.com/laravel/framework/pull/15018)) <del> <del> <del>## v5.3.1 (2016-08-24) <del> <del>### Changed <del>- Support unversioned assets in `elixir()` function ([#14987](https://github.com/laravel/framework/pull/14987)) <del>- Changed visibility of `BladeCompiler::stripParentheses()` to `public` ([#14986](https://github.com/laravel/framework/pull/14986)) <del>- Use getter instead of accessing the properties directly in `JoinClause::__construct()` ([#14984](https://github.com/laravel/framework/pull/14984)) <del>- Replaced manual comparator with `asort` in `Collection::sort()` ([#14980](https://github.com/laravel/framework/pull/14980)) <del>- Use `query()` instead of `input()` for key lookup in `TokenGuard::getTokenForRequest()` ([#14985](https://github.com/laravel/framework/pull/14985)) <del> <del>### Fixed <del>- Check if exact key exists before assuming the dot notation represents segments in `Arr::has()` ([#14976](https://github.com/laravel/framework/pull/14976)) <del>- Revert aggregate changes in [#14793](https://github.com/laravel/framework/pull/14793) ([#14994](https://github.com/laravel/framework/pull/14994)) <del>- Prevent infinite recursion with closure based console commands ([26eaa35](https://github.com/laravel/framework/commit/26eaa35c0dbd988084e748410a31c8b01fc1993a)) <del>- Fixed `transaction()` method for SqlServer ([f4588f8](https://github.com/laravel/framework/commit/f4588f8851aab1129f77d87b7dc1097c842390db)) <ide><path>CHANGELOG-5.4.md <del># Release Notes for 5.4.x <del> <del>## v5.4.36 (2017-08-30) <del> <del>### Added <del>- Added MP3 to `Testing/MimeType::$mimes` ([#20745](https://github.com/laravel/framework/pull/20745)) <del> <del>### Changed <del>- Mailables that defined a `$delay` property will honor it ([#20717](https://github.com/laravel/framework/pull/20717)) <del> <del>### Fixed <del>- Fixed route URLs building from artisan commands ([#20788](https://github.com/laravel/framework/pull/20788)) <del> <del> <del>## v5.4.35 (2017-08-24) <del> <del>### Fixed <del>- Fixed breaking change in `FactoryBuilder` ([#20727](https://github.com/laravel/framework/pull/20727)) <del> <del> <del>## v5.4.34 (2017-08-23) <del> <del>### Added <del>- Added `Str::start()` and `str_start()` helper ([#20569](https://github.com/laravel/framework/pull/20569)) <del>- Added `orDoesntHave()` and `orWhereDoesntHave()` to `QueriesRelationships` ([#20685](https://github.com/laravel/framework/pull/20685)) <del>- Added support for callables in model factory attributes ([#20692](https://github.com/laravel/framework/pull/20692)) <del> <del>### Changed <del>- Return the model instance from `Model::refresh()` ([#20657](https://github.com/laravel/framework/pull/20657)) <del>- Use `self::$verbs` in `Router::any()` ([#20698](https://github.com/laravel/framework/pull/20698)) <del> <del>### Fixed <del>- Fixed duplicate user model import in `make:policy` ([#20645](https://github.com/laravel/framework/pull/20645), [48f5f23](https://github.com/laravel/framework/commit/48f5f23fd8615f48f2aee27a301c1f2f1505bdfb)) <del>- Fixed PHP 7.2 incompatibility in `Builder::mergeWheres()` ([#20635](https://github.com/laravel/framework/pull/20635)) <del>- Fixed issue in `RateLimiter` ([#20684](https://github.com/laravel/framework/pull/20684)) <del>- Fixed success message after password reset ([#20707](https://github.com/laravel/framework/pull/20707)) <del>- Fail job only if it didn't fail already ([#20654](https://github.com/laravel/framework/pull/20654)) <del> <del> <del>## v5.4.33 (2017-08-14) <del> <del>### Added <del>- Show error message if a reverted migration is not found ([#20499](https://github.com/laravel/framework/pull/20499), [a895b1e](https://github.com/laravel/framework/commit/a895b1eb0e50683c4583c24bb17b3f8d9e8127ab)) <del> <del>### Changed <del>- Moved `tap()` method from `Builder` to `BuildsQueries` ([#20384](https://github.com/laravel/framework/pull/20384)) <del>- Made Blade `or` operator case-insensitive ([#20425](https://github.com/laravel/framework/pull/20425)) <del>- Support `$amount = 0` in `Arr::random()` ([#20439](https://github.com/laravel/framework/pull/20439)) <del>- Reverted `doctrine/inflector` version change made in v5.4.31 ([#20227](https://github.com/laravel/framework/pull/20227)) <del> <del>### Fixed <del>- Fixed bug when using empty values in `SQLiteGrammar::compileInsert()` ([#20424](https://github.com/laravel/framework/pull/20424)) <del>- Fixed `$boolean` parameter being ignored in `Builder::addArrayOfWheres()` ([#20553](https://github.com/laravel/framework/pull/20553)) <del>- Fixed `JoinClause::whereIn()` when using a subquery ([#20453](https://github.com/laravel/framework/pull/20453)) <del>- Reset day parameter when using `Y-m` with `date_format` rule ([#20566](https://github.com/laravel/framework/pull/20566)) <del> <del> <del>## v5.4.32 (2017-08-03) <del> <del>### Added <del>- Added `FilesystemAdapter::path()` method ([#20395](https://github.com/laravel/framework/pull/20395)) <del> <del>### Changed <del>- Allow `Collection::random()` to return `0` items ([#20396](https://github.com/laravel/framework/pull/20396), [#20402](https://github.com/laravel/framework/pull/20402)) <del>- Accept options on `FilesystemAdapter::temporaryUrl()` ([#20394](https://github.com/laravel/framework/pull/20394)) <del>- Sync `withoutOverlapping` method on `Event` and `CallbackEvent` ([#20389](https://github.com/laravel/framework/pull/20389)) <del>- Prevent PHP file uploads by default unless explicitly allowed ([#20392](https://github.com/laravel/framework/pull/20392), [#20400](https://github.com/laravel/framework/pull/20400)) <del>- Allow other filesystem adapter to implement `temporaryUrl()` ([#20398](https://github.com/laravel/framework/pull/20398)) <del> <del>### Fixed <del>- Reverted breaking change on `BelongsToMany::create()` ([#20407](https://github.com/laravel/framework/pull/20407)) <del> <del> <del>## v5.4.31 (2017-08-02) <del> <del>### Added <del>- Added `Blueprint::unsignedDecimal()` method ([#20243](https://github.com/laravel/framework/pull/20243), [3b4483d](https://github.com/laravel/framework/commit/3b4483d1ad885ca0943558b896c6f27f937c193a), [06dcaaa](https://github.com/laravel/framework/commit/06dcaaafe3add4a1bd2a41610278fc7f3d8c43df)) <del>- Added `Relation::getMorphedModel()` method ([#20244](https://github.com/laravel/framework/pull/20244)) <del>- Added `Model::isNot()` method ([#20354](https://github.com/laravel/framework/pull/20354)) <del>- Added `FilesystemAdapter::temporaryUrl()` method ([#20375](https://github.com/laravel/framework/pull/20375), [09cfd7f](https://github.com/laravel/framework/commit/09cfd7f5d2982f4faca915125d88eb4552ca3db4)) <del>- Added `Request::userAgent()` method ([#20367](https://github.com/laravel/framework/pull/20367)) <del> <del>### Changed <del>- Renamed `MakeAuthCommand` to `AuthMakeCommand` ([#20216](https://github.com/laravel/framework/pull/20216)) <del>- Don't use `asset()` helper inside `mix()` ([#20197](https://github.com/laravel/framework/pull/20197)) <del>- Removed `array` type-hint in `Builder::orWhereRaw()` signature ([#20234](https://github.com/laravel/framework/pull/20234)) <del>- Added empty array default to `$attributes` on `BelongsToMany::create()` ([#20321](https://github.com/laravel/framework/pull/20321)) <del>- Prepare for PHP 7.2 ([#20258](https://github.com/laravel/framework/pull/20258), [#20330](https://github.com/laravel/framework/pull/20330), [#20336](https://github.com/laravel/framework/pull/20336), [#20378](https://github.com/laravel/framework/pull/20378)) <del>- Use `unsignedTinyInteger()` in `jobs.stub` ([#20382](https://github.com/laravel/framework/pull/20382)) <del> <del>### Fixed <del>- Make sure `Model::getDates()` returns unique columns ([#20193](https://github.com/laravel/framework/pull/20193)) <del>- Fixed pulled `doctrine/inflector` version ([#20227](https://github.com/laravel/framework/pull/20227)) <del>- Fixed issue with `chunkById()` when `orderByRaw()` is used ([#20236](https://github.com/laravel/framework/pull/20236)) <del>- Terminate user defined database connections after rollback during testing ([#20340](https://github.com/laravel/framework/pull/20340)) <del> <del> <del>## v5.4.30 (2017-07-19) <del> <del>### Fixed <del>- Handle a non-existing key in `ArrayStore` ([#20156](https://github.com/laravel/framework/pull/20156)) <del>- Fixed bug `@guest` and `@auth` directives ([#20166](https://github.com/laravel/framework/pull/20166), [b164e45](https://github.com/laravel/framework/commit/b164e4552517b6126eac4dc77e276131b835b784)) <del> <del> <del>## v5.4.29 (2017-07-19) <del> <del>### Added <del>- Added `ManagesFrequencies::twiceMonthly()` method ([#19874](https://github.com/laravel/framework/pull/19874)) <del>- Added `RouteCollection::getRoutesByName()` method ([#19901](https://github.com/laravel/framework/pull/19901)) <del>- Added `$expiresAt` parameter to `CallbackEvent::withoutOverlapping()` ([#19861](https://github.com/laravel/framework/pull/19861)) <del>- Support keeping old files when testing uploads ([#19859](https://github.com/laravel/framework/pull/19859)) <del>- Added `--force` option to `make:mail`, `make:model` and `make:notification` ([#19932](https://github.com/laravel/framework/pull/19932)) <del>- Added support for PostgreSQL deletes with `USES` clauses ([#20062](https://github.com/laravel/framework/pull/20062), [f94fc02](https://github.com/laravel/framework/commit/f94fc026c64471ca5a5b42919c9b5795021d783c)) <del>- Added support for CC and BBC on mail notifications ([#20093](https://github.com/laravel/framework/pull/20093)) <del>- Added Blade `@auth` and `@guest` directive ([#20087](https://github.com/laravel/framework/pull/20087), [#20114](https://github.com/laravel/framework/pull/20114)) <del>- Added option to configure MARS on SqlServer connections ([#20113](https://github.com/laravel/framework/pull/20113), [c2c917c](https://github.com/laravel/framework/commit/c2c917c5f773d3df7f59242768f921af95309bcc)) <del> <del>### Changed <del>- Support object items in `Arr::pluck()` ([#19838](https://github.com/laravel/framework/pull/19838), [#19845](https://github.com/laravel/framework/pull/19845)) <del>- `MessageBag` interface now extends `Arrayable` ([#19849](https://github.com/laravel/framework/pull/19849)) <del>- Made `Blueprint` macroable ([#19862](https://github.com/laravel/framework/pull/19862)) <del>- Improved performance for `Arr::crossJoin()` ([#19864](https://github.com/laravel/framework/pull/19864)) <del>- Use the correct `User` model namespace for new policies ([#19965](https://github.com/laravel/framework/pull/19965), [a7094c2](https://github.com/laravel/framework/commit/a7094c2e68a6eb9768462ce9b8d26fec00e9ba65)) <del>- Consider scheduled event timezone in `inTimeInterval()` ([#19959](https://github.com/laravel/framework/pull/19959)) <del>- Render exception if handler can't report it ([#19977](https://github.com/laravel/framework/pull/19977)) <del>- Made `MakesHttpRequests::withServerVariables()` public ([#20086](https://github.com/laravel/framework/pull/20086)) <del>- Invalidate session instead of regenerating it when logging out ([#20107](https://github.com/laravel/framework/pull/20107)) <del>- Improved `InvalidPayloadException` error message ([#20143](https://github.com/laravel/framework/pull/20143)) <del> <del>### Fixed <del>- Don't re-escape a `View` instance passed as the default value to `@yield` or `@section` directives ([#19884](https://github.com/laravel/framework/pull/19884)) <del>- Make sure migration file is loaded before trying to rollback ([#19922](https://github.com/laravel/framework/pull/19922)) <del>- Fixed caching issue in `mix()` ([#19968](https://github.com/laravel/framework/pull/19968)) <del>- Signal alarm after timeout passes ([#19978](https://github.com/laravel/framework/pull/19978)) <del> <del> <del>## v5.4.28 (2017-06-30) <del> <del>### Added <del>- Added `avg()` and `average()` as higher order proxies ([#19628](https://github.com/laravel/framework/pull/19628)) <del>- Added `fresh()` method to Eloquent collection ([#19616](https://github.com/laravel/framework/pull/19616), [#19671](https://github.com/laravel/framework/pull/19671)) <del>- Added ability to remove a global scope with another global scope ([#19657](https://github.com/laravel/framework/pull/19657)) <del>- Added `Collection::intersectKey()` method ([#19683](https://github.com/laravel/framework/pull/19683)) <del>- Support setting queue name via `broadcastQueue()` method ([#19703](https://github.com/laravel/framework/pull/19703), [#19708](https://github.com/laravel/framework/pull/19708)) <del>- Support default return on `BelongsTo` relations ([#19733](https://github.com/laravel/framework/pull/19733), [#19788](https://github.com/laravel/framework/pull/19788), [1137d86](https://github.com/laravel/framework/commit/1137d860d8ef009630ae4951ea6323f552571268), [ed0182b](https://github.com/laravel/framework/commit/ed0182bb49008032b02649f2fa9ff644b086deac)) <del>- Added `unless()` method to query builder and collection ([#19738](https://github.com/laravel/framework/pull/19738), [#19740](https://github.com/laravel/framework/pull/19740)) <del>- Added `array_random()` helper ([#19741](https://github.com/laravel/framework/pull/19741), [#19818](https://github.com/laravel/framework/pull/19818), [#19826](https://github.com/laravel/framework/pull/19826)) <del>- Support multiple manifest files on `mix()` ([#19764](https://github.com/laravel/framework/pull/19764)) <del> <del>### Changed <del>- Escape default value passed to `@yield` directive ([#19643](https://github.com/laravel/framework/pull/19643)) <del>- Support passing multiple fields to `different` validation rule ([#19637](https://github.com/laravel/framework/pull/19637)) <del>- Only dispatch the `MessageSent` event if mails should be sent ([#19690](https://github.com/laravel/framework/pull/19690)) <del>- Removed duplicate `/` from `public_path()` ([#19731](https://github.com/laravel/framework/pull/19731)) <del>- Made `ThrottlesLogins` more customizable ([#19787](https://github.com/laravel/framework/pull/19787)) <del>- Support PostgreSQL insert statements with `DEFAULT VALUES` ([#19804](https://github.com/laravel/framework/pull/19804)) <del> <del>### Fixed <del>- Fixed `BelongsTo` bug with incrementing keys ([#19631](https://github.com/laravel/framework/pull/19631)) <del>- Fixed PDO return value bug in `unprepared()` ([#19667](https://github.com/laravel/framework/pull/19667)) <del>- Don't use `event()` helper in `Http\Kernel` ([#19688](https://github.com/laravel/framework/pull/19688)) <del>- Detect lock wait timeout as deadlock ([#19749](https://github.com/laravel/framework/pull/19749)) <del>- Improved escaping special characters in MySQL comments ([#19798](https://github.com/laravel/framework/pull/19798)) <del>- Fixed passing email as string to `Event::emailOutputTo()` ([#19802](https://github.com/laravel/framework/pull/19802)) <del>- Fixed `withoutOverlapping()` not creating mutex ([#19834](https://github.com/laravel/framework/pull/19834)) <del> <del>### Removed <del>- Removed `role` attribute from forms in stubs ([#19792](https://github.com/laravel/framework/pull/19792)) <del> <del> <del>## v5.4.27 (2017-06-15) <del> <del>### Added <del>- Added `Collection::diffAssoc()` method ([#19604](https://github.com/laravel/framework/pull/19604)) <del> <del>### Changed <del>- Updated PHPUnit whitelist ([#19609](https://github.com/laravel/framework/pull/19609)) <del> <del>### Fixed <del>- Update timestamps on soft delete only when they are used ([#19627](https://github.com/laravel/framework/pull/19627)) <del> <del> <del>## v5.4.26 (2017-06-13) <del> <del>### Added <del>- Added `Event::nextRunDate()` method ([#19537](https://github.com/laravel/framework/pull/19537), [09dd336](https://github.com/laravel/framework/commit/09dd336b5146afa9278064c2f7cd901f55e10fc0)) <del>- Added null safe operator `<=>` to query builder operators list ([#19539](https://github.com/laravel/framework/pull/19539)) <del>- Added `Macroable` trait to `RequestGuard` ([#19569](https://github.com/laravel/framework/pull/19569)) <del> <del>### Changed <del>- Touch `updated_at` timestamp when soft deleting ([#19538](https://github.com/laravel/framework/pull/19538)) <del>- Accept argument list in `Rule::in()` and `Rule::notIn()` ([#19555](https://github.com/laravel/framework/pull/19555)) <del>- Support checking for strings job names using `QueueFake` ([#19575](https://github.com/laravel/framework/pull/19575)) <del>- Improved image ratio validation precision ([#19542](https://github.com/laravel/framework/pull/19542)) <del> <del>### Fixed <del>- Resume scheduled task if an error occurs ([#19419](https://github.com/laravel/framework/pull/19419)) <del>- Decode HTML entities in plain text emails ([#19518](https://github.com/laravel/framework/pull/19518)) <del>- Added missing locales to `MessageSelector::getPluralIndex()` ([#19562](https://github.com/laravel/framework/pull/19562)) <del>- Use strict check when object is passed to `Collection::contains()` ([#19568](https://github.com/laravel/framework/pull/19568)) <del>- Fixed jobs with a timeout of `0` ([#19586](https://github.com/laravel/framework/pull/19586)) <del>- Never pass `Throwable` to `stopWorkerIfLostConnection()` ([#19591](https://github.com/laravel/framework/pull/19591)) <del> <del> <del>## v5.4.25 (2017-06-07) <del> <del>### Added <del>- Added `Macroable` trait to `FactoryBuilder` ([#19425](https://github.com/laravel/framework/pull/19425)) <del>- Allow a plain text alternative view when using markdown within Mailables ([#19436](https://github.com/laravel/framework/pull/19436), [ad2eaf7](https://github.com/laravel/framework/commit/ad2eaf72d7fc003a98215d4a373ea603658c646a)) <del>- Added nested transactions support for SqlServer ([#19439](https://github.com/laravel/framework/pull/19439)) <del> <del>### Changed <del>- Moved `env()` helper to Support component ([#19409](https://github.com/laravel/framework/pull/19409)) <del>- Prevent `BadMethodCallException` in `RedirectResponse::withErrors()` ([#19426](https://github.com/laravel/framework/pull/19426)) <del>- Suppress error if calling `Str::replaceFirst()` with an empty search ([#19427](https://github.com/laravel/framework/pull/19427)) <del>- Removed the `callable` type hint for `array_sort()` ([#19483](https://github.com/laravel/framework/pull/19483)) <del>- Return the used traits from `TestCase::setUpTraits()` ([#19486](https://github.com/laravel/framework/pull/19486)) <del> <del>### Fixed <del>- Fixes and optimizations for `Str::after()` ([#19428](https://github.com/laravel/framework/pull/19428)) <del>- Fixed queue size when using Beanstalkd driver ([#19465](https://github.com/laravel/framework/pull/19465)) <del>- Check if a mutex can be created before running the callback task in `CallbackEvent::run()` ([#19466](https://github.com/laravel/framework/pull/19466)) <del>- Flip expected and actual value on `TestResponse::assertCookie()` ([#19495](https://github.com/laravel/framework/pull/19495)) <del>- Fixed undefined variable error in `Mailable` class ([#19504](https://github.com/laravel/framework/pull/19504)) <del>- Prevent error notice when `database.collation` is not set ([#19507](https://github.com/laravel/framework/pull/19507)) <del> <del> <del>## v5.4.24 (2017-05-30) <del> <del>### Added <del>- Support magic controller methods ([#19168](https://github.com/laravel/framework/pull/19168)) <del>- Added `Gate` resources ([#19124](https://github.com/laravel/framework/pull/19124)) <del>- Added `Request::routeIs()` method ([#19202](https://github.com/laravel/framework/pull/19202), [26681eb](https://github.com/laravel/framework/commit/26681eb1c8ba35a0129ad47d4f0f03af9c2baa45)) <del>- Route `Route::isName()` shorthand method ([#19227](https://github.com/laravel/framework/pull/19227)) <del>- Added support for custom columns in `softDeletes()` method ([#19203](https://github.com/laravel/framework/pull/19203)) <del>- Added `ManagesLayouts::getSection()` method ([#19213](https://github.com/laravel/framework/pull/19213)) <del>- Added `Model::refresh()` shorthand ([#19174](https://github.com/laravel/framework/pull/19174)) <del>- Added `Container::forgetExtenders()` method ([#19269](https://github.com/laravel/framework/pull/19269), [7c17bf5](https://github.com/laravel/framework/commit/7c17bf540f37f8b4667be5332c94d7423780ca83)) <del>- Added `Filesystem::hash()` method ([#19256](https://github.com/laravel/framework/pull/19256)) <del>- Added `TestResponse::assertViewIs()` method ([#19291](https://github.com/laravel/framework/pull/19291)) <del>- Added `path` to `Paginator` ([#19314](https://github.com/laravel/framework/pull/19314)) <del>- Added `Collection::concat()` method ([#19318](https://github.com/laravel/framework/pull/19318), [0f5337f](https://github.com/laravel/framework/commit/0f5337f854ecdd722e7e289ff58cc252337e7a9d)) <del>- Added `make()` method to `HasOneOrMany` and `MorphOneOrMany` relations ([#19307](https://github.com/laravel/framework/pull/19307)) <del>- Added `str_after()` helper function ([#19357](https://github.com/laravel/framework/pull/19357)) <del>- Added `Router::apiResource()` method ([#19347](https://github.com/laravel/framework/pull/19347)) <del> <del>### Changed <del>- Move `$sizeRules` and `$numericRules` properties from `FormatsMessages` to `Validator` ([dc7e7cb](https://github.com/laravel/framework/commit/dc7e7cb26500fcba91e7e32762e367d59b12913b)) <del>- Allows calls to `Collection::times()` without the `$callback` parameter ([#19278](https://github.com/laravel/framework/pull/19278)) <del>- Don't ignore jobs with a timeout of `0` ([#19266](https://github.com/laravel/framework/pull/19266)) <del>- Resolve database paginators from the container ([#19328](https://github.com/laravel/framework/pull/19328)) <del>- Added `news` to `Pluralizer::$uncountable()` ([#19353](https://github.com/laravel/framework/pull/19353)) <del>- Switched to using `app()->getLocale()` in `app.stub` ([#19405](https://github.com/laravel/framework/pull/19405)) <del> <del>### Fixed <del>- Fixed `Container::makeWith()` not using parameters when resolving interfaces ([#19178](https://github.com/laravel/framework/pull/19178)) <del>- Stop validating Memcached connection ([#19192](https://github.com/laravel/framework/pull/19192)) <del>- Fixed the position of `bound()` in `Container::instance()` ([#19207](https://github.com/laravel/framework/pull/19207)) <del>- Prevent applying global scopes on the factory while setting the connection ([#19258](https://github.com/laravel/framework/pull/19258)) <del>- Fixed database connection issue in queue worker ([#19263](https://github.com/laravel/framework/pull/19263)) <del>- Don't use HTML comments in notification email template ([#19289](https://github.com/laravel/framework/pull/19289)) <del>- Fire rebinding callback when using `bind()` method to bind abstract ([#19288](https://github.com/laravel/framework/pull/19288)) <del>- Return `0` from `callScope()` if `$query->wheres` is `null` ([#19381](https://github.com/laravel/framework/pull/19381)) <del> <del> <del>## v5.4.23 (2017-05-11) <del> <del>### Added <del>- Added `Gate::abilities()` accessor ([#19143](https://github.com/laravel/framework/pull/19143), [e9e34b5](https://github.com/laravel/framework/commit/e9e34b5acd3feccec5ffe3ff6d84ff9009ff2a7a)) <del>- Added ability to eager load counts via `$withCount` property ([#19154](https://github.com/laravel/framework/pull/19154)) <del> <del>### Fixed <del>- Fixed inversion of expected and actual on assertHeader ([#19110](https://github.com/laravel/framework/pull/19110)) <del>- Fixed filesystem bug in `Filesystem::files()` method on Windows ([#19157](https://github.com/laravel/framework/pull/19157)) <del>- Fixed bug in `Container::build()` ([#19161](https://github.com/laravel/framework/pull/19161), [bf669e1](https://github.com/laravel/framework/commit/bf669e16d61ef0225b86adc781ddcc752aafd62b)) <del> <del>### Removed <del>- Removed `window.Laravel` object ([#19135](https://github.com/laravel/framework/pull/19135)) <del> <del> <del>## v5.4.22 (2017-05-08) <del> <del>### Added <del>- Support dynamic number of keys in `MessageBag::hasAny()` ([#19002](https://github.com/laravel/framework/pull/19002)) <del>- Added `Seeder::callSilent()` method ([#19007](https://github.com/laravel/framework/pull/19007)) <del>- Add `make()` method to Eloquent query builder ([#19015](https://github.com/laravel/framework/pull/19015)) <del>- Support `Arrayable` on Eloquent's `find()` method ([#19019](https://github.com/laravel/framework/pull/19019)) <del>- Added `SendsPasswordResetEmails::validateEmail()` method ([#19042](https://github.com/laravel/framework/pull/19042)) <del>- Allow factory attributes to be factory instances themselves ([#19055](https://github.com/laravel/framework/pull/19055)) <del>- Implemented `until()` method on `EventFake` ([#19062](https://github.com/laravel/framework/pull/19062)) <del>- Added `$encoding` parameter to `Str::length()` ([#19047](https://github.com/laravel/framework/pull/19047), [#19079](https://github.com/laravel/framework/pull/19079)) <del> <del>### Changed <del>- Throw exception when invalid first argument is passed to `cache()` helper ([d9459b2](https://github.com/laravel/framework/commit/d9459b2f8bec4a807e7ba2b3301de4c5248aa933)) <del>- Use `getAuthIdentifierName()` in `Authenticatable::getAuthIdentifier()` ([#19038](https://github.com/laravel/framework/pull/19038)) <del>- Clone queries without order by for aggregates ([#19064](https://github.com/laravel/framework/pull/19064)) <del>- Force host on password reset notification ([cef1055](https://github.com/laravel/framework/commit/cef10551820530632a86fa6f1306fee95c5cac43)) <del> <del>### Fixed <del>- Set data key when testing file uploads in nested array ([#18954](https://github.com/laravel/framework/pull/18954)) <del>- Fixed a bug related to sub select queries and extra select statements ([#19013](https://github.com/laravel/framework/pull/19013)) <del>- Resolve aliases from container when using parameters ([#19071](https://github.com/laravel/framework/pull/19071)) <del>- Stop worker if database disconnect occurred ([#19080](https://github.com/laravel/framework/pull/19080), [583b1b8](https://github.com/laravel/framework/commit/583b1b885bbc6883073baa1a0417fffcdbe5ebed)) <del>- Fixed internal call to `assertJson()` in `assertJsonStructure()` ([#19090](https://github.com/laravel/framework/pull/19090)) <del> <del> <del>## v5.4.21 (2017-04-28) <del> <del>### Added <del>- Support conditional broadcasting ([#18970](https://github.com/laravel/framework/pull/18970), [2665d9b](https://github.com/laravel/framework/commit/2665d9b9a49633d73c71db735c2597c8b960c985)) <del> <del>### Fixed <del>- Reverted queue prefix option [#18860](https://github.com/laravel/framework/pull/18860) ([#18987](https://github.com/laravel/framework/pull/18987)) <del>- Return `null` if key is not found from `RedisStore:many()` ([#18984](https://github.com/laravel/framework/pull/18984)) <del> <del> <del>## v5.4.20 (2017-04-27) <del> <del>### Added <del>- Added higher order tap ([3abc4fb](https://github.com/laravel/framework/commit/3abc4fb90fe59a90c2d8cccd27e310b20e5e2631)) <del>- Added `Collection::mapToGroups()` ([#18949](https://github.com/laravel/framework/pull/18949)) <del>- Added `FactoryBuilder::lazy()` method ([#18823](https://github.com/laravel/framework/pull/18823)) <del>- Support Redis Sentinel configuration ([#18850](https://github.com/laravel/framework/pull/18850)) <del>- Added `queue.prefix` option ([#18860](https://github.com/laravel/framework/pull/18860), [8510bf9](https://github.com/laravel/framework/commit/8510bf9986fffd8af58d288a297de573e78d97a5)) <del>- Allow `getDisplayableAttribute()` to be used in custom replacers ([#18895](https://github.com/laravel/framework/pull/18895)) <del>- Added `resourceMethodsWithoutModels()` method to `AuthorizesRequests` ([#18916](https://github.com/laravel/framework/pull/18916), [#18964](https://github.com/laravel/framework/pull/18964)) <del>- Added name to `home` route ([#18942](https://github.com/laravel/framework/pull/18942)) <del> <del>### Changed <del>- Return `PendingDispatch` for `Kernel::queue()` ([51647eb](https://github.com/laravel/framework/commit/51647eb701307e7682f7489b605a146e750abf0f)) <del>- Made `RedisManager::resolve()` public ([#18830](https://github.com/laravel/framework/pull/18830), [eb9b99d](https://github.com/laravel/framework/commit/eb9b99dfe80ca266bf675e8aaa3fdfdf6c4a69f3)) <del>- Changed email body color to match wrapper color ([#18824](https://github.com/laravel/framework/pull/18824)) <del>- Break and hyphenate long words in emails ([#18827](https://github.com/laravel/framework/pull/18827)) <del>- Force database migration to use the write PDO ([#18898](https://github.com/laravel/framework/pull/18898)) <del>- Support `JSON_PARTIAL_OUTPUT_ON_ERROR` on `JsonResponse` ([#18917](https://github.com/laravel/framework/pull/18917), [db5f011](https://github.com/laravel/framework/commit/db5f011d8ba9d0bcb5d768bea9d94688739f5b4c)) <del> <del>### Fixed <del>- Set connection on model factory ([#18846](https://github.com/laravel/framework/pull/18846), [95a0663](https://github.com/laravel/framework/commit/95a06638633359965961a11ab05967d32351cfdf)) <del>- Fixed route parameter binding for routes with leading slashes ([#18855](https://github.com/laravel/framework/pull/18855)) <del>- Don't call `cleanParameterBag()` twice during JSON request ([#18840](https://github.com/laravel/framework/pull/18840)) <del>- Prevent exception in `getActualClassNameForMorph()` when morph map is `null` ([#18921](https://github.com/laravel/framework/pull/18921)) <del>- Use protocol-relative URL in `mix()` helper ([#18943](https://github.com/laravel/framework/pull/18943)) <del>- Cast `$viaChannels` to array ([#18960](https://github.com/laravel/framework/pull/18960)) <del> <del> <del>## v5.4.19 (2017-04-16) <del> <del>### Added <del>- Added ability to send `link_names` parameter in Slack notification ([#18765](https://github.com/laravel/framework/pull/18765)) <del>- Added `Mailable::hasFrom()` method ([#18790](https://github.com/laravel/framework/pull/18790)) <del> <del>### Changed <del>- Made `Mailer` macroable ([#18763](https://github.com/laravel/framework/pull/18763)) <del>- Made `SessionGuard` macroable ([#18796](https://github.com/laravel/framework/pull/18796)) <del>- Improved queue worker output ([#18773](https://github.com/laravel/framework/pull/18773)) <del>- Added `newModelInstance()` method to Eloquent Builder ([#18775](https://github.com/laravel/framework/pull/18775)) <del>- Use assertions instead of exceptions in `MocksApplicationServices` ([#18774](https://github.com/laravel/framework/pull/18774)) <del> <del>### Fixed <del>- Fixed memory issue in `Container` ([#18812](https://github.com/laravel/framework/pull/18812)) <del>- Set database connection while retrieving models ([#18769](https://github.com/laravel/framework/pull/18769)) <del> <del> <del>## v5.4.18 (2017-04-10) <del> <del>### Added <del>- Added `assertSuccessful()` and `assertRedirect()` to `TestResponse` ([#18629](https://github.com/laravel/framework/pull/18629)) <del>- Added `assertSeeText()` and `assertDontSeeText()` to `TestResponse` ([#18690](https://github.com/laravel/framework/pull/18690)) <del>- Added `assertJsonMissing()` to `TestResponse` ([#18721](https://github.com/laravel/framework/pull/18721), [786b782](https://github.com/laravel/framework/commit/786b7821e0009a4288bff032443f2b1a273ee459)) <del>- Added support for attaching an image to Slack attachments `$attachment->image($url)`([#18664](https://github.com/laravel/framework/pull/18664)) <del>- Added `Validator::extendDependent()` to allow adding custom rules that depend on other fields ([#18654](https://github.com/laravel/framework/pull/18654)) <del>- Added support for `--parent` option on `make:controller` ([#18606](https://github.com/laravel/framework/pull/18606)) <del>- Added `MessageSent` event to `Mailer` ([#18744](https://github.com/laravel/framework/pull/18744), [6c5f3a4](https://github.com/laravel/framework/commit/6c5f3a47c6308d1d4f2f5912c34cb85f57f0aeed)) <del> <del>### Changed <del>- Don't trim leading slashes on local filesystem base URLs ([acd66fe](https://github.com/laravel/framework/commit/acd66fef646fd5f7ca54380d55bc8e2e2cbe64b6)) <del>- Accept variable on `@empty()` directive ([#18738](https://github.com/laravel/framework/pull/18738)) <del>- Added `string` validation rules to `AuthenticatesUsers` ([#18746](https://github.com/laravel/framework/pull/18746)) <del> <del>### Fixed <del>- Fixed an issue with `Collection::groupBy()` when the provided value is a boolean ([#18674](https://github.com/laravel/framework/pull/18674)) <del>- Bring back an old behaviour in resolving controller method dependencies ([#18646](https://github.com/laravel/framework/pull/18646)) <del>- Fixed job release when exception occurs ([#18737](https://github.com/laravel/framework/pull/18737)) <del>- Fixed eloquent `increment()` and `decrement()` update attributes ([#18739](https://github.com/laravel/framework/pull/18739), [1728a88](https://github.com/laravel/framework/commit/1728a887e450f997a0dcde2ef84be2947b05af42)) <del> <del> <del>## v5.4.17 (2017-04-03) <del> <del>### Added <del>- Added `getManager()` and `setManager()` to queue worker ([#18452](https://github.com/laravel/framework/pull/18452)) <del>- Added support for Pheanstalk's `$timeout` and `$persistent` options ([#18448](https://github.com/laravel/framework/pull/18448)) <del>- Added `Collection::times()` method ([#18457](https://github.com/laravel/framework/pull/18457)) <del>- Added PostgreSQL's `REAL` data type ([#18513](https://github.com/laravel/framework/pull/18513)) <del>- Added `flatMap` to collection higher order proxies ([#18529](https://github.com/laravel/framework/pull/18529)) <del>- Support multiple `--path` parameters with `migrate:reset` ([#18540](https://github.com/laravel/framework/pull/18540)) <del>- Store SparkPost `Transmission-ID` in the header after sending message ([#18594](https://github.com/laravel/framework/pull/18594)) <del> <del>### Changed <del>- Check for `Htmlable` instead of `HtmlString` in `Mailer::renderView()` ([#18459](https://github.com/laravel/framework/pull/18459), [da7b006](https://github.com/laravel/framework/commit/da7b006d8b236d8b29adb5f5f2696f1c2ec3e999)) <del>- Added mutex for schedule events ([#18295](https://github.com/laravel/framework/pull/18295), [ae2eb1f](https://github.com/laravel/framework/commit/ae2eb1f498aa6c2e6c45040d26fb9502eabab535)) <del>- Don't use helper functions in service providers ([#18506](https://github.com/laravel/framework/pull/18506), [#18521](https://github.com/laravel/framework/pull/18521)) <del>- Change `user_id` to unsigned integer in database session stub ([#18557](https://github.com/laravel/framework/pull/18557)) <del>- Improved performance of `UrlGenerator::isValidUrl()` ([#18566](https://github.com/laravel/framework/pull/18566)) <del> <del>### Fixed <del>- Handle missing or malformed `config/app.php` file ([#18466](https://github.com/laravel/framework/pull/18466), [92931cf](https://github.com/laravel/framework/commit/92931cffe48503dfe7095c23856da07de304fef2)) <del>- Only call `up` and `down` on migration if the method exists ([d27d94e](https://github.com/laravel/framework/commit/d27d94ed5220da3f6462c57eef122d8f40419ab1)) <del>- Fixed overwriting of routes with identical path and method ([#18475](https://github.com/laravel/framework/pull/18475), [5aee967](https://github.com/laravel/framework/commit/5aee9675038f0ec30ba4ed2c1eb9b544ac370c06)) <del>- Fixing model/route binding with identical name ([#18476](https://github.com/laravel/framework/pull/18476)) <del>- Allow `rollbackMigrations()` path to be with string ([#18535](https://github.com/laravel/framework/pull/18535)) <del>- Use `getStatusCode()` in `TestResponse::assertRedirect()` ([#18559](https://github.com/laravel/framework/pull/18559)) <del>- Case `parseIds()` to array in `InteractsWithPivotTable::sync()` ([#18547](https://github.com/laravel/framework/pull/18547)) <del>- Preserve route parameter names ([#18604](https://github.com/laravel/framework/pull/18604)) <del> <del> <del>## v5.4.16 (2017-03-21) <del> <del>### Added <del>- Added PHPDBG detection to `runningInConsole()` ([#18198](https://github.com/laravel/framework/pull/18198)) <del>- Added `Arr:wrap()` method ([#18216](https://github.com/laravel/framework/pull/18216)) <del>- Allow scheduling of queued jobs ([#18235](https://github.com/laravel/framework/pull/18235), [7bb67e2](https://github.com/laravel/framework/commit/7bb67e225646fb578c039cc0af130f7aa6858120)) <del>- Allow skipping mail sending if a listener to `MessageSending` returns `false` ([#18245](https://github.com/laravel/framework/pull/18245)) <del>- Added `BcryptHasher::cost()` method ([#18266](https://github.com/laravel/framework/pull/18266)) <del>- Added `Command::alert()` method ([#18272](https://github.com/laravel/framework/pull/18272)) <del>- Added `tap()` method to query builder ([#18284](https://github.com/laravel/framework/pull/18284)) <del>- Added `orderByDesc()` methods to query builder ([#18292](https://github.com/laravel/framework/pull/18292)) <del>- Added `Container::makeWith()` method ([#18271](https://github.com/laravel/framework/pull/18271), [#18320](https://github.com/laravel/framework/pull/18320)) <del>- Added `InteractsWithDatabase::assertSoftDeleted()` ([#18328](https://github.com/laravel/framework/pull/18328), [2d4e1f0](https://github.com/laravel/framework/commit/2d4e1f0fe0bae3c7e3304317a69d619e71e476cc), [f89f917](https://github.com/laravel/framework/commit/f89f917b256ad79df786c688b11247ce1e48299a)) <del>- Added ability to set queue parameters inside queued listeners ([#18375](https://github.com/laravel/framework/pull/18375), [cf461e2](https://github.com/laravel/framework/commit/cf461e23b6123ba6ed084d2fb8e8306482973b88)) <del>- Added `Model::setKeyType()` ([#18354](https://github.com/laravel/framework/pull/18354)) <del>- Output migration name before starting a migration or rollback ([#18379](https://github.com/laravel/framework/pull/18379), [e47e8b1](https://github.com/laravel/framework/commit/e47e8b16c1e65d752943faaa65db14ca323f5feb)) <del>- Added `pipeline()`, `transaction()`, and `executeRaw()` to `PhpRedisConnection` ([#18421](https://github.com/laravel/framework/pull/18421)) <del>- Added `@isset()` directive ([#18425](https://github.com/laravel/framework/pull/18425)) <del>- Added `tinyIncrements()` database schema method ([#18424](https://github.com/laravel/framework/pull/18424)) <del> <del>### Changed <del>- Throw exception when `bootstrap/cache` directory is not writable ([#18188](https://github.com/laravel/framework/pull/18188), [b4f0005](https://github.com/laravel/framework/commit/b4f000516166b0694e842d64f5b2fde1167d4690)) <del>- Use `resource_path()` helper in `MakeAuthCommand` ([#18215](https://github.com/laravel/framework/pull/18215)) <del>- Added `file_exists()` check to `Event::emailOutput()` ([c8eafa8](https://github.com/laravel/framework/commit/c8eafa8e6741dc5add4c5030aa7362744dcdab29)) <del>- Allow wildcards in MIME type validations ([#18243](https://github.com/laravel/framework/pull/18243)) <del>- Only push existing jobs back into the queue using `queue:retry` ([#18279](https://github.com/laravel/framework/pull/18279), [e874a56](https://github.com/laravel/framework/commit/e874a56e5b75663861aab13ff8e13b82050de54e)) <del>- Support file uploads in nested array ([#18276](https://github.com/laravel/framework/pull/18276)) <del>- Don't use `config()` helper in Mail component ([#18290](https://github.com/laravel/framework/pull/18290)) <del>- Return the insert ID from `DatabaseJob::release()` ([#18288](https://github.com/laravel/framework/pull/18288), [#18291](https://github.com/laravel/framework/pull/18291)) <del>- Changed `id` in failed jobs migration stub to `bigIncrements()` ([#18300](https://github.com/laravel/framework/pull/18300)) <del>- Prevent `make:auth` from overwriting existing views ([#18319](https://github.com/laravel/framework/pull/18319), [bef8f35](https://github.com/laravel/framework/commit/bef8f35694b7c22516a27929dbfc4c49032f78c6)) <del>- Ensure Mailable view data is not overridden by order of operations ([#18322](https://github.com/laravel/framework/pull/18322)) <del>- Use `getAuthIdentifier()` method in broadcasters ([#18351](https://github.com/laravel/framework/pull/18351)) <del>- Use atomic cache operation when checking for event overlaps ([8ebb5b8](https://github.com/laravel/framework/commit/8ebb5b859ae8f2382a1836a83a47542de234d63a)) <del>- Return pretty JSON response from `HasInDatabase::failureDescription()` ([#18377](https://github.com/laravel/framework/pull/18377)) <del>- Allow Validator extension to use array-style callable ([#18399](https://github.com/laravel/framework/pull/18399)) <del>- Pass the condition value to query builder's `when()` method ([#18419](https://github.com/laravel/framework/pull/18419)) <del>- Don't require returning the query from `when()` method ([#18422](https://github.com/laravel/framework/pull/18422)) <del> <del>### Fixed <del>- Fixed an issue with slots when passed content equals `null` ([#18246](https://github.com/laravel/framework/pull/18246)) <del>- Do require `Closure` in `orWhereHas()` ([#18277](https://github.com/laravel/framework/pull/18277)) <del>- Let PHP parse `@includeWhen` directive ([#18285](https://github.com/laravel/framework/pull/18285)) <del>- Only include `.php` files when loading database factories ([#18336](https://github.com/laravel/framework/pull/18336)) <del>- Fixed PHP 5.6 issue in `FileFactory::generateImage()` ([#18345](https://github.com/laravel/framework/pull/18345)) <del>- Allow `ImplicitRouteBinding` to match camelcase method parameter names ([#18307](https://github.com/laravel/framework/pull/18307), [4ae31a1](https://github.com/laravel/framework/commit/4ae31a154f81c2d76c7397dbdebfcac0e74e4ccd)) <del>- Fixing weird behaviour of `Connection::getConfig()` when `null` was passed ([#18356](https://github.com/laravel/framework/pull/18356)) <del>- Attempt to solve an issue with using `required_*` rules while the `ConvertEmptyStringToNull` middleware is applied ([#18376](https://github.com/laravel/framework/pull/18376)) <del>- Fixed faking of model events ([d6cb75c](https://github.com/laravel/framework/commit/d6cb75c057009c6316d4efd865dccb3c4a5c7b36)) <del>- Prevent model event result from firing observable events ([#18401](https://github.com/laravel/framework/pull/18401), [0607db0](https://github.com/laravel/framework/commit/0607db02ba9eeab0a22abe1dabb19536f4aa1ff2)) <del>- Fix issue in `authorizeResource()` with compound names ([#18435](https://github.com/laravel/framework/pull/18435)) <del> <del> <del>## v5.4.15 (2017-03-02) <del> <del>### Added <del>- Added `any()` method to `ViewErrorBag` ([#18176](https://github.com/laravel/framework/pull/18176)) <del>- Added `Storage` and `File` fakes ([#18178](https://github.com/laravel/framework/pull/18178), [#18180](https://github.com/laravel/framework/pull/18180)) <del> <del>### Changed <del>- Made queue worker properties `$shouldQuit` and `$paused` public ([e40c0e7](https://github.com/laravel/framework/commit/e40c0e7cd885156caa402d6d016cc686479736f4)) <del> <del>### Fixed <del>- Proxy `isset()` checks on `TestResponse` ([#18182](https://github.com/laravel/framework/pull/18182)) <del> <del> <del>## v5.4.14 (2017-03-01) <del> <del>### Added <del>- Added `Str::kebab()` and `kebab_case()` helper ([#18084](https://github.com/laravel/framework/pull/18084)) <del>- Added `Route::getActionMethod()` ([#18105](https://github.com/laravel/framework/pull/18105)) <del>- Support granular `$tries` and `$timeout` on `Mailable` ([#18103](https://github.com/laravel/framework/pull/18103)) <del>- Added context to the `assertJson()` response ([#18166](https://github.com/laravel/framework/pull/18166), [da2c892](https://github.com/laravel/framework/commit/da2c8923328a3f852331fca5778214e05d8e6fde)) <del>- Add `whereNotIn()` and `whereNotInStrict()` to `Collection` ([#18157](https://github.com/laravel/framework/pull/18157)) <del> <del>### Changed <del>- Create `TestResponse` using composition instead of inheritance ([#18089](https://github.com/laravel/framework/pull/18089)) <del>- Changed visibility of `Pivot::$parent` from `protected` to `public` ([#18096](https://github.com/laravel/framework/pull/18096)) <del>- Catch Sqlite3 deadlocks in `DetectsDeadlocks` ([#18107](https://github.com/laravel/framework/pull/18107)) <del>- Use `fromRawAttributes()` when in `Model::newPivot()` ([#18127](https://github.com/laravel/framework/pull/18127), [063e5ae](https://github.com/laravel/framework/commit/063e5ae341c32220d4679d0215ab9b263d0c8a33)) <del>- Use default connection in `DatabaseManager::purge()` when no connection name is provided ([#18128](https://github.com/laravel/framework/pull/18128)) <del>- Convert rule objects only once to string ([#18141](https://github.com/laravel/framework/pull/18141)) <del>- Respect `ShouldQueue` contract in `Mailer::send()` ([#18144](https://github.com/laravel/framework/pull/18144), [717f1f6](https://github.com/laravel/framework/commit/717f1f67eb7bb2fac7c57311f0afaa637375407d), [#18160](https://github.com/laravel/framework/pull/18160)) <del> <del>### Fixed <del>- Don't use `value()` helper in `BoundMethod` class ([#18075](https://github.com/laravel/framework/pull/18075)) <del>- Don't require manifest file when running `npm run hot` ([#18088](https://github.com/laravel/framework/pull/18088)) <del>- Fixed injection placement of dependencies for routing method parameters ([#17973](https://github.com/laravel/framework/pull/17973)) <del>- Return `false` from `Model::fireModelEvent()` if custom model event returns `false` ([c5a6290](https://github.com/laravel/framework/commit/c5a62901589e313474376e241549ac31d9d3c695)) <del>- Fixed `firstOrFail()` on relation setting the wrong model on `ModelNotFoundException` ([#18138](https://github.com/laravel/framework/pull/18138)) <del>- Fixed `RateLimiter` setting initial attempts count to `2` ([#18139](https://github.com/laravel/framework/pull/18139)) <del>- Fixed compiled `DELETE` query when using `JOIN` with aliases ([#18156](https://github.com/laravel/framework/pull/18156), [e09b9eb](https://github.com/laravel/framework/commit/e09b9eb62715706a0368acf0af7911340e0a3298)) <del>- Fixed validating `present` in combination with `nullable` ([#18173](https://github.com/laravel/framework/pull/18173)) <del> <del> <del>## v5.4.13 (2017-02-22) <del> <del>### Added <del>- Add `$default` parameter to `Collection::when()` method ([#17941](https://github.com/laravel/framework/pull/17941)) <del>- Support `--resource` argument on `make:model` command ([#17955](https://github.com/laravel/framework/pull/17955)) <del>- Added `replaceDimensions()` for validator messages ([#17946](https://github.com/laravel/framework/pull/17946), [b219058](https://github.com/laravel/framework/commit/b219058063336dd9cc851349e287052d76bcc18e)) <del>- Allow Slack notifications to use image urls ([#18011](https://github.com/laravel/framework/pull/18011)) <del>- Added `@includeWhen($condition, $view, $data)` directive ([#18047](https://github.com/laravel/framework/pull/18047)) <del> <del>### Changed <del>- Prevent Blade from compiling statements inside comments ([#17952](https://github.com/laravel/framework/pull/17952)) <del>- Don't flash empty array to session, if `withInput()` is given empty array ([#17979](https://github.com/laravel/framework/pull/17979)) <del>- Use the pagination translation strings in paginator templates ([#18009](https://github.com/laravel/framework/pull/18009)) <del>- Use `getAuthPassword()` method in `AuthenticateSession` middleware ([#17965](https://github.com/laravel/framework/pull/17965)) <del>- Return `null` from `Gate::getPolicyFor()` if given class is not a string ([#17972](https://github.com/laravel/framework/pull/17972)) <del>- Add missing methods to the `Job` interface ([#18034](https://github.com/laravel/framework/pull/18034)) <del>- Improved PostgreSQL table existence check ([#18041](https://github.com/laravel/framework/pull/18041)) <del>- Allow `getActualClassNameForMorph()` used by `morphInstanceTo()` to be overridden ([#18058](https://github.com/laravel/framework/pull/18058)) <del> <del>### Fixed <del>- Fixed `@lang` directive when used with JSON file ([#17919](https://github.com/laravel/framework/pull/17919), [2bd35c1](https://github.com/laravel/framework/commit/2bd35c13678faae68ee0bbe95d46b12f77357c98)) <del>- Improved image `dimensions` validation rule ([#17943](https://github.com/laravel/framework/pull/17943), [#17944](https://github.com/laravel/framework/pull/17944), [#17963](https://github.com/laravel/framework/pull/17963), [#17980](https://github.com/laravel/framework/pull/17980)) <del>- Fixed `$willBeAvailableAt` having the wrong time if using `$retryAfter` in `MaintenanceModeException` ([#17991](https://github.com/laravel/framework/pull/17991)) <del>- Trim spaces while collecting section name ([#18012](https://github.com/laravel/framework/pull/18012)) <del>- Fixed implementation of `SqsQueue::size()` ([#18037](https://github.com/laravel/framework/pull/18037)) <del>- Fixed bug in `PasswordBroker::deleteToken()` ([#18045](https://github.com/laravel/framework/pull/18045)) <del>- Fixed route parameters binding ([#17973](https://github.com/laravel/framework/pull/17973)) <del> <del> <del>## v5.4.12 (2017-02-15) <del> <del>### Added <del>- Allow configuration of Faker locale through `app.faker_locale` config ([#17895](https://github.com/laravel/framework/pull/17895)) <del>- Added `when()` method to `Collection` class ([#17917](https://github.com/laravel/framework/pull/17917)) <del>- Check for files in `request()` helper ([e08714d](https://github.com/laravel/framework/commit/e08714d65a2f3ab503fd59061aa8ab2fc37e19a4), [18d1648](https://github.com/laravel/framework/commit/18d16486103292c681c29f503b27bf3affb5a2d3)) <del>- Added `TestResponse::assertSessionHasErrors()` method ([dbaf3b1](https://github.com/laravel/framework/commit/dbaf3b10f1daa483a1db840c60ec95337c9a1f6e)) <del> <del>### Changed <del>- Prevent duplication of embedded files in `Mail\Message` ([#17877](https://github.com/laravel/framework/pull/17877)) <del>- Only unserialize data if needed in `CallQueuedListener` ([964fb7f](https://github.com/laravel/framework/commit/964fb7fc1c80948beb521f1672d0b250eedea94d)) <del>- Made a couple of properties public ([614b94a](https://github.com/laravel/framework/commit/614b94a15564352f3775d3bc81097f89ba79e586)) <del>- Handle `Model` instances in `Authorize` middleware ([#17898](https://github.com/laravel/framework/pull/17898)) <del>- Use `asset()` helper in `app.stub` ([#17896](https://github.com/laravel/framework/pull/17896)) <del>- Test PhpRedis connection if extension is loaded ([#17882](https://github.com/laravel/framework/pull/17882), [#17910](https://github.com/laravel/framework/pull/17910)) <del>- Use `Carbon::setTestNow()` in all tests ([#17937](https://github.com/laravel/framework/pull/17937)) <del> <del>### Fixed <del>- Make sub select union queries work with SQLite ([#17890](https://github.com/laravel/framework/pull/17890)) <del>- Fix `zRangeByScore()` options syntax for PhpRedis ([#17912](https://github.com/laravel/framework/pull/17912)) <del> <del> <del>## v5.4.11 (2017-02-10) <del> <del>### Added <del>- Support `Encrypt` and `TrustServerCertificate` options on SqlServer connections ([#17841](https://github.com/laravel/framework/pull/17841)) <del>- Support custom pivot models in `MorphToMany::newPivot()` ([#17862](https://github.com/laravel/framework/pull/17862)) <del>- Support `Arrayable` objects in Eloquent's `whereKey()` method ([#17812](https://github.com/laravel/framework/pull/17812)) <del> <del>### Changed <del>- Use `app.locale` lang attribute in `app.stub` ([#17827](https://github.com/laravel/framework/pull/17827)) <del>- Throw `JsonEncodingException` when JSON encoder fails to encode eloquent attribute ([#17804](https://github.com/laravel/framework/pull/17804), [11e89f3](https://github.com/laravel/framework/commit/11e89f35b0f1fc1654d51bc31c865ab796da9f46)) <del>- Ensure file `hashName()` is unique ([#17879](https://github.com/laravel/framework/pull/17879), [830f194](https://github.com/laravel/framework/commit/830f194f9f72cd3de31151990c7aad6db52f1e86)) <del> <del>### Fixed <del>- Added missing `Str` class import to `TestResponse` ([#17835](https://github.com/laravel/framework/pull/17835)) <del>- Fixed PhpRedis’ `zadd()` method signature ([#17832](https://github.com/laravel/framework/pull/17832)) <del> <del> <del>## v5.4.10 (2017-02-08) <del> <del>### Added <del>- Added Blade `@prepend` directive ([#17696](https://github.com/laravel/framework/pull/17696)) <del>- Added `Collection::tap()` method ([#17756](https://github.com/laravel/framework/pull/17756)) <del>- Allow multiple manifest files for `mix()` helper ([#17759](https://github.com/laravel/framework/pull/17759)) <del>- Adding facility to `Log:useSyslog()` ([#17789](https://github.com/laravel/framework/pull/17789)) <del>- Added macros to Eloquent builder ([#17719](https://github.com/laravel/framework/pull/17719)) <del>- Added `TestResponse::assertJsonFragment()` method ([#17809](https://github.com/laravel/framework/pull/17809)) <del> <del>### Changed <del>- Use `route()` helper instead of `url()` in authentication component ([#17718](https://github.com/laravel/framework/pull/17718)) <del>- Ensure that the `map()` method exists before calling in `RouteServiceProvider::loadRoutes()` ([#17784](https://github.com/laravel/framework/pull/17784)) <del>- Clean up how events are dispatched ([8c90e7f](https://github.com/laravel/framework/commit/8c90e7fe31bee11bd496050a807c790da12cc519), [c9e8854](https://github.com/laravel/framework/commit/c9e8854f9a9954e29ee5cdb0ca757736a65cbe15)) <del>- Changed job `name` to `displayName` ([4e85a9a](https://github.com/laravel/framework/commit/4e85a9aaeb97a56a203a152ee7b114daaf07c6d8), [d033626](https://github.com/laravel/framework/commit/d0336261cdb63df6fff666490a6e9987cba5c0f0)) <del>- Made plain string job payloads more similar to object based payloads ([bd49288](https://github.com/laravel/framework/commit/bd49288c551c47f4d15cb371fabfd2b0670b903d)) <del>- Bring back pluralization rules for translations ([#17826](https://github.com/laravel/framework/pull/17826)) <del> <del>### Fixed <del>- Apply overrides in `factory()->raw()` method ([#17763](https://github.com/laravel/framework/pull/17763)) <del> <del> <del>## v5.4.9 (2017-02-03) <del> <del>### Added <del>- Added `Macroable` trait to `TestResponse` ([#17726](https://github.com/laravel/framework/pull/17726)) <del>- Added container alias for the Redis connection instance ([#17722](https://github.com/laravel/framework/pull/17722)) <del>- Added `raw()` method to `FactoryBuilder` ([#17734](https://github.com/laravel/framework/pull/17734)) <del>- Added `json()` as alias for `decodeResponseJson` method on `TestResponse` ([#17735](https://github.com/laravel/framework/pull/17735)) <del> <del>### Changed <del>- Use `route()` helper instead of `url()` in authentication component ([#17718](https://github.com/laravel/framework/pull/17718)) <del>- Added `Jedi` to uncountable list for pluralization ([#17729](https://github.com/laravel/framework/pull/17729)) <del>- Return relative URL from `mix()` helper ([#17727](https://github.com/laravel/framework/pull/17727)) <del>- Sort foreign keys on eloquent relations ([#17730](https://github.com/laravel/framework/pull/17730)) <del>- Properly set the JSON payload of `FormRequests` instead of re-building it ([#17760](https://github.com/laravel/framework/pull/17760), [2d725c2](https://github.com/laravel/framework/commit/2d725c205a7f700f0143670def471e0b5082a420)) <del>- Use `isset()` instead of `array_key_exists()` in `HasAttributes::getAttributeFromArray()` ([#17739](https://github.com/laravel/framework/pull/17739)) <del> <del>### Fixed <del>- Added missing `sleep` option to `queue:listen` ([59ef5bf](https://github.com/laravel/framework/commit/59ef5bff290195445925dc89a160782485bfc425)) <del>- Switched to strict comparison `TrimStrings` middleware ([#17741](https://github.com/laravel/framework/pull/17741)) <del> <del> <del>## v5.4.8 (2017-02-01) <del> <del>### Added <del>- Added `TestResponse::assertJsonStructure()` ([#17700](https://github.com/laravel/framework/pull/17700)) <del>- Added `Macroable` trait to Eloquent `Relation` class ([#17707](https://github.com/laravel/framework/pull/17707)) <del> <del>### Changed <del>- Move `shouldKill()` check from `daemon()` to `stopIfNecessary()` ([8403b34](https://github.com/laravel/framework/commit/8403b34a6de212e5cd98d40333fd84d112fbb9f7)) <del>- Removed `isset()` check from `validateSame()` ([#17708](https://github.com/laravel/framework/pull/17708)) <del> <del>### Fixed <del>- Added `force` option to `queue:listen` signature ([#17716](https://github.com/laravel/framework/pull/17716)) <del>- Fixed missing `return` in `HasManyThrough::find()` and `HasManyThrough::findMany()` ([#17717](https://github.com/laravel/framework/pull/17717)) <del> <del> <del>## v5.4.7 (2017-01-31) <del> <del>### Added <del>- Added `Illuminate\Support\Facades\Schema` to `notifications.stub` ([#17664](https://github.com/laravel/framework/pull/17664)) <del>- Added support for numeric arguments to `@break` and `@continue` ([#17603](https://github.com/laravel/framework/pull/17603)) <del> <del>### Changed <del>- Use `usesTimestamps()` in Eloquent traits ([#17612](https://github.com/laravel/framework/pull/17612)) <del>- Default to `null` if amount isn't set in `factory()` helper ([#17614](https://github.com/laravel/framework/pull/17614)) <del>- Normalize PhpRedis GET/MGET results ([#17196](https://github.com/laravel/framework/pull/17196)) <del>- Changed visibility of `Validator::addRules()` from `protected` to `public` ([#17654](https://github.com/laravel/framework/pull/17654)) <del>- Gracefully handle `SIGTERM` signal in queue worker ([b38ba01](https://github.com/laravel/framework/commit/b38ba016283c6491d6e525caeb6206b2b04321fc), [819888c](https://github.com/laravel/framework/commit/819888ca1776581225d57e00fdc4ba709cbcc5d0)) <del>- Support inspecting multiple events of same type using `Event` fake ([55be2ea](https://github.com/laravel/framework/commit/55be2ea35ccd2e450f9ffad23fd7ac446c035013)) <del>- Replaced hard-coded year in plain-text markdown emails ([#17684](https://github.com/laravel/framework/pull/17684)) <del>- Made button component in plain-text markdown emails easier to read ([#17683](https://github.com/laravel/framework/pull/17683)) <del> <del>### Fixed <del>- Set `Command::$name` in `Command::configureUsingFluentDefinition()` ([#17610](https://github.com/laravel/framework/pull/17610)) <del>- Support post size `0` (unlimited) in `ValidatePostSize` ([#17607](https://github.com/laravel/framework/pull/17607)) <del>- Fixed method signature issues in `PhpRedisConnection` ([#17627](https://github.com/laravel/framework/pull/17627)) <del>- Fixed `BelongsTo` not accepting id of `0` in foreign relations ([#17668](https://github.com/laravel/framework/pull/17668)) <del>- Support double quotes with `@section()` ([#17677](https://github.com/laravel/framework/pull/17677)) <del>- Fixed parsing explicit validator rules ([#17681](https://github.com/laravel/framework/pull/17681)) <del>- Fixed `SessionGuard::recaller()` when request is `null` ([#17688](https://github.com/laravel/framework/pull/17688), [565456d](https://github.com/laravel/framework/commit/565456d89e8d6378c213edb7e9d0724fa8a5f473)) <del>- Added missing `force` and `tries` options for `queue:listen` ([#17687](https://github.com/laravel/framework/pull/17687)) <del>- Fixed how reservation works when queue is paused ([9d348c5](https://github.com/laravel/framework/commit/9d348c5d57873bfcca86cff1987e22472d1f0e5b)) <del> <del> <del>## v5.4.6 (2017-01-27) <del> <del>### Added <del>- Generate non-existent models with `make:controller` ([#17587](https://github.com/laravel/framework/pull/17587), [382b78c](https://github.com/laravel/framework/commit/382b78ca12282c580ff801a00b2e52faf50c6d38)) <del>- Added `TestResponse::dump()` method ([#17600](https://github.com/laravel/framework/pull/17600)) <del> <del>### Changed <del>- Switch to `ViewFactory` contract in `Mail/Markdown` ([#17591](https://github.com/laravel/framework/pull/17591)) <del>- Use implicit binding when generating controllers with `make:model` ([#17588](https://github.com/laravel/framework/pull/17588)) <del>- Made PhpRedis method signatures compatibility with Predis ([#17488](https://github.com/laravel/framework/pull/17488)) <del>- Use `config('app.name')` in `markdown/message.blade.php` ([#17604](https://github.com/laravel/framework/pull/17604)) <del>- Use `getStatusCode()` instead of `status()` in `TestResponse::fromBaseResponse()` ([#17590](https://github.com/laravel/framework/pull/17590)) <del> <del>### Fixed <del>- Fixed loading of `.env.testing` when running PHPUnit ([#17596](https://github.com/laravel/framework/pull/17596)) <del> <del> <del>## v5.4.5 (2017-01-26) <del> <del>### Fixed <del>- Fixed database session data not persisting ([#17584](https://github.com/laravel/framework/pull/17584)) <del> <del> <del>## v5.4.4 (2017-01-26) <del> <del>### Added <del>- Add `hasMiddlewareGroup()` and `getMiddlewareGroups()` method to `Router` ([#17576](https://github.com/laravel/framework/pull/17576)) <del> <del>### Fixed <del>- Fixed `--database` option on `migrate` commands ([#17574](https://github.com/laravel/framework/pull/17574)) <del>- Fixed `$sequence` being always overwritten in `PostgresGrammar::compileInsertGetId()` ([#17570](https://github.com/laravel/framework/pull/17570)) <del> <del>### Removed <del>- Removed various unused parameters from view compilers ([#17554](https://github.com/laravel/framework/pull/17554)) <del>- Removed superfluous `ForceDelete` extension from `SoftDeletingScope` ([#17552](https://github.com/laravel/framework/pull/17552)) <del> <del> <del>## v5.4.3 (2017-01-25) <del> <del>### Added <del>- Mock `dispatch()` method in `MocksApplicationServices` ([#17543](https://github.com/laravel/framework/pull/17543), [d974a88](https://github.com/laravel/framework/commit/d974a8828221ba8673cc4f6d9124d1d33f3de447)) <del> <del>### Changed <del>- Moved `$forElseCounter` property from `BladeCompiler` to `CompilesLoops` ([#17538](https://github.com/laravel/framework/pull/17538)) <del> <del>### Fixed <del>- Fixed bug in `Router::pushMiddlewareToGroup()` ([1054fd2](https://github.com/laravel/framework/commit/1054fd2523913e59e980553b5411a22f16ecf817)) <del>- Fixed indentation in `Notifications/resources/views/email.blade.php` ([0435cfc](https://github.com/laravel/framework/commit/0435cfcf171908432d88e447fe4021998e515b9f)) <del> <del> <del>## v5.4.2 (2017-01-25) <del> <del>### Fixed <del>- Fixed removal of reset tokens after password reset ([#17524](https://github.com/laravel/framework/pull/17524)) <del> <del> <del>## v5.4.1 (2017-01-24) <del> <del>### Fixed <del>- Fixed view parent placeholding ([64f7e9c](https://github.com/laravel/framework/commit/64f7e9c4e37637df7b0820b11d5fcee1c1cca58d)) <del> <del>## v5.4.0 (2017-01-24) <del> <del>### General <del>- Added real-time facades 😈 ([feb52bf](https://github.com/laravel/framework/commit/feb52bf966c0ea517ec0cf688b5a2534b50a8268)) <del>- Added `retry()` helper ([e3bd359](https://github.com/laravel/framework/commit/e3bd359d52cee0ba8db9673e45a8221c1c1d95d6), [52e9381](https://github.com/laravel/framework/commit/52e9381d3d64631f2842c1d86fee2aa64a6c73ac)) <del>- Added `array_wrap()` helper function ([0f76617](https://github.com/laravel/framework/commit/0f766177e4ac42eceb00aa691634b00a77b18b59)) <del>- Added default 503 error page into framework ([855a8aa](https://github.com/laravel/framework/commit/855a8aaca2903015e3fe26f756e73af9f1b98374), [#16848](https://github.com/laravel/framework/pull/16848)) <del>- Added `Encrypter::encryptString()` to bypass serialization ([9725a8e](https://github.com/laravel/framework/commit/9725a8e7d0555474114f5cad9249fe8fe556836c)) <del>- Removed compiled class file generation and deprecated `ServiceProvider::compiles()` ([#17003](https://github.com/laravel/framework/pull/17003), [733d829](https://github.com/laravel/framework/commit/733d829d6551dde2f290b6c26543dd08956e82e7)) <del>- Renamed `DetectEnvironment` to `LoadEnvironmentVariables` ([c36874d](https://github.com/laravel/framework/commit/c36874dda29d8eb9f9364c4bd308c7ee10060c25)) <del>- Switched to `::class` notation across the codebase ([#17357](https://github.com/laravel/framework/pull/17357)) <del> <del>### Authentication <del>- Secured password reset tokens against timing attacks and compromised databases ([#16850](https://github.com/laravel/framework/pull/16850), [9d674b0](https://github.com/laravel/framework/commit/9d674b053145968ff9060b930a644ddd7851d66f)) <del>- Refactored authentication component ([7b48bfc](https://github.com/laravel/framework/commit/7b48bfccf9ed12c71461651bbf52a3214b58d82e), [5c4541b](https://github.com/laravel/framework/commit/5c4541bc43f22b0d99c5cc6db38781060bff836f)) <del>- Added names to password reset routes ([#16988](https://github.com/laravel/framework/pull/16988)) <del>- Stopped touching the user timestamp when updating the `remember_token` ([#17135](https://github.com/laravel/framework/pull/17135)) <del> <del>### Authorization <del>- Consider interfaces and extended classes in `Gate::resolvePolicyCallback()` ([#15757](https://github.com/laravel/framework/pull/15757)) <del> <del>### Blade <del>- Added Blade components and slots ([e8d2a45](https://github.com/laravel/framework/commit/e8d2a45479abd2ba6b524293ce5cfb599c8bf910), [a00a201](https://github.com/laravel/framework/commit/a00a2016a4ff6518b60845745fc0533058f6adc6)) <del>- Refactored Blade component ([7cdb6a6](https://github.com/laravel/framework/commit/7cdb6a6f6b77c91906c4ad0c6110b30042a43277), [5e394bb](https://github.com/laravel/framework/commit/5e394bb2c4b20833ea07b052823fe744491bdbd5)) <del>- Refactored View component ([#17018](https://github.com/laravel/framework/pull/17018), [bb998dc](https://github.com/laravel/framework/commit/bb998dc23e7f4da5820b61fb5eb606fe4a654a2a)) <del>- Refactored Blade `@parent` compilation ([#16033](https://github.com/laravel/framework/pull/16033), [16f72a5](https://github.com/laravel/framework/commit/16f72a5a580b593ac804bc0b2fdcc6eb278e55b2)) <del>- Added support for translation blocks in Blade templates ([7179935](https://github.com/laravel/framework/commit/71799359b7e74995be862e498d1b21841ff55fbc)) <del>- Don't reverse the order of `@push`ed data ([#16325](https://github.com/laravel/framework/pull/16325)) <del>- Allow view data to be passed Paginator methods ([#17331](https://github.com/laravel/framework/pull/17331)) <del>- Add `mix()` helper method ([6ea4997](https://github.com/laravel/framework/commit/6ea4997fcf7cf0ae4c18bce9418817ff00e4727f)) <del>- Escape inline sections content ([#17453](https://github.com/laravel/framework/pull/17453)) <del> <del>### Broadcasting <del>- Added model binding in broadcasting channel definitions ([#16120](https://github.com/laravel/framework/pull/16120), [515d97c](https://github.com/laravel/framework/commit/515d97c1f3ad4797876979d450304684012142d6)) <del>- Added `Dispatchable::broadcast()` [0fd8f8d](https://github.com/laravel/framework/commit/0fd8f8de75545b5701e59f51c88d02c12528800a) <del>- Switched to broadcasting events using new style jobs ([#17433](https://github.com/laravel/framework/pull/17433)) <del> <del>### Cache <del>- Added `RedisStore::add()` to store an item in the cache if the key doesn't exist ([#15877](https://github.com/laravel/framework/pull/15877)) <del>- Added `cache:forget` command ([#16201](https://github.com/laravel/framework/pull/16201), [7644977](https://github.com/laravel/framework/commit/76449777741fa1d7669028973958a7e4a5e64f71)) <del>- Refactored cache events ([b7454f0](https://github.com/laravel/framework/commit/b7454f0e67720c702d8f201fd6ca81db6837d461), [#17120](https://github.com/laravel/framework/pull/17120)) <del>- `Cache::flush()` now returns boolean ([#15831](https://github.com/laravel/framework/pull/15831), [057492d](https://github.com/laravel/framework/commit/057492d31c569e96a3ba2f99722112a9762c6071)) <del> <del>### Collections <del>- Added higher-order messages for the collections ([#16267](https://github.com/laravel/framework/pull/16267), [e276b3d](https://github.com/laravel/framework/commit/e276b3d4bf2a124c4eb5975a8a2724b8c806139a), [2b7ab30](https://github.com/laravel/framework/commit/2b7ab30e0ec56ac4e4093d7f2775da98086c8000), [#16274](https://github.com/laravel/framework/pull/16274), [724950a](https://github.com/laravel/framework/commit/724950a42c225c7b53c56283c01576b050fea37a), [#17000](https://github.com/laravel/framework/pull/17000)) <del>- Allow collection macros to be proxied ([#16749](https://github.com/laravel/framework/pull/16749)) <del>- Added operator support to `Collection::contains()` method ([#16791](https://github.com/laravel/framework/pull/16791)) <del>- Renamed `every()` method to `nth()` and added new `every()` to determine if all items pass the given test ([#16777](https://github.com/laravel/framework/pull/16777)) <del>- Allow passing an array to `Collection::find()` ([#16849](https://github.com/laravel/framework/pull/16849)) <del>- Always return a collection when calling `Collection::random()` with a parameter ([#16865](https://github.com/laravel/framework/pull/16865)) <del>- Don't renumber the keys and keep the input array order in `mapWithKeys()` ([#16564](https://github.com/laravel/framework/pull/16564)) <del> <del>### Console <del>- Added `--model` to `make:controller` command to generate resource controller with type-hinted model ([#16787](https://github.com/laravel/framework/pull/16787)) <del>- Require confirmation for `key:generate` command in production ([#16804](https://github.com/laravel/framework/pull/16804)) <del>- Added `ManagesFrequencies` trait ([e238299](https://github.com/laravel/framework/commit/e238299f12ee91a65ac021feca29b870b05f5dd7)) <del>- Added `Queueable` to queued listener stub ([dcd64b6](https://github.com/laravel/framework/commit/dcd64b6c36d1e545c1c2612764ec280c47fdea97)) <del>- Switched from file to cache based Schedule overlap locking ([#16196](https://github.com/laravel/framework/pull/16196), [5973f6c](https://github.com/laravel/framework/commit/5973f6c54ccd0d99e15f055c5a16b19b8c45db91)) <del>- Changed namespace generation in `GeneratorCommand` ([de9e03d](https://github.com/laravel/framework/commit/de9e03d5bd80d32a936d30ab133d2df0a3fa1d8d)) <del>- Added `Command::$hidden` and `ScheduleFinishCommand` ([#16806](https://github.com/laravel/framework/pull/16806)) <del>- Moved all framework command registrations into `ArtisanServiceProvider` ([954a333](https://github.com/laravel/framework/commit/954a33371bd7f7597eae6fce2ed1d391a2268099), [baa6054](https://github.com/laravel/framework/commit/baa605424a4448ab4f1c6068d8755ecf83bde665), [87bd2a9](https://github.com/laravel/framework/commit/87bd2a9e6c79715a9c73ca6134074919ede1a0e7)) <del>- Support passing output buffer to `Artisan::call()` ([#16930](https://github.com/laravel/framework/pull/16930)) <del>- Moved `tinker` into an external package ([#17002](https://github.com/laravel/framework/pull/17002)) <del>- Refactored queue commands ([07a9402](https://github.com/laravel/framework/commit/07a9402f5d1b2fb5dedc22751a59914ebcf41562), [a82a25f](https://github.com/laravel/framework/commit/a82a25f58252eab6831a0efde35a17403710abdc), [f2beb2b](https://github.com/laravel/framework/commit/f2beb2bbce11433283ba52744dbe7134aa55cbfa)) <del>- Allow tasks to be scheduled on weekends ([#17085](https://github.com/laravel/framework/pull/17085)) <del>- Allow console events to be macroable ([#17107](https://github.com/laravel/framework/pull/17107)) <del> <del>### Container <del>- Added `Container::factory()` method to the Container contract ([#15430](https://github.com/laravel/framework/pull/15430)) <del>- Added support for binding methods to the container ([#16800](https://github.com/laravel/framework/pull/16800), [1fa8ea0](https://github.com/laravel/framework/commit/1fa8ea02c096d09bea909b7bffa24b861dc76240)) <del>- Trigger callback when binding an extension or resolving callback to an alias ([c99098f](https://github.com/laravel/framework/commit/c99098fc85c9633db578f70fba454184609c515d)) <del>- Support contextual binding with aliases ([c99098f](https://github.com/laravel/framework/commit/c99098fc85c9633db578f70fba454184609c515d)) <del>- Removed `$parameters` from `Application::make()` and `app()`/`resolve()` helpers ([#17071](https://github.com/laravel/framework/pull/17071), [#17060](https://github.com/laravel/framework/pull/17060)) <del>- Removed `Container::share()` ([1a1969b](https://github.com/laravel/framework/commit/1a1969b6e6f793c3b2a479362641487ee9cbf736)) <del>- Removed `Container::normalize()` ([ff993b8](https://github.com/laravel/framework/commit/ff993b806dcb21ba8a5367594e87d113338c1670)) <del> <del>### DB <del>- Refactored all database components (_too many commits, sorry_) <del>- Allow rolling back to a given transaction save-point ([#15876](https://github.com/laravel/framework/pull/15876)) <del>- Added `$values` parameter to `Builder::firstOrNew()` ([#15567](https://github.com/laravel/framework/pull/15567)) <del>- Allow dependency injection on database seeders `run()` method ([#15959](https://github.com/laravel/framework/pull/15959)) <del>- Added support for joins when deleting deleting records using SqlServer ([#16618](https://github.com/laravel/framework/pull/16618)) <del>- Added collation support to `SQLServerGrammar` ([#16227](https://github.com/laravel/framework/pull/16227)) <del>- Don't rollback to save-points on deadlock (nested transaction) ([#15932](https://github.com/laravel/framework/pull/15932)) <del>- Improve `Connection::selectOne()` performance by switching to `array_shift()` ([#16188](https://github.com/laravel/framework/pull/16188)) <del>- Added `having()` shortcut ([#17160](https://github.com/laravel/framework/pull/17160)) <del>- Added customer connection resolver ([#17248](https://github.com/laravel/framework/pull/17248)) <del>- Support aliasing database names with spaces ([#17312](https://github.com/laravel/framework/pull/17312)) <del>- Support column aliases using `chunkById()` ([#17034](https://github.com/laravel/framework/pull/17034)) <del>- Execute queries with locks only on write connection ([#17386](https://github.com/laravel/framework/pull/17386)) <del>- Added `compileLock()` method to `SqlServerGrammar` ([#17424](https://github.com/laravel/framework/pull/17424)) <del> <del>### Eloquent <del>- Refactored Eloquent (_too many commits, sorry_) <del>- Added support for object-based events for native Eloquent events ([e7a724d](https://github.com/laravel/framework/commit/e7a724d3895f2b24b98c0cafb1650f2193351d83), [9770d1a](https://github.com/laravel/framework/commit/9770d1a64c1010daf845fcebfcc4695a30d8df2d)) <del>- Added custom class support for pivot models ([#14293](https://github.com/laravel/framework/pull/14293), [5459777](https://github.com/laravel/framework/commit/5459777c90ff6d0888bd821027c417d57cc89981)) <del>- Use the model's primary key instead of `id` in `Model::getForeignKey()` ([#16396](https://github.com/laravel/framework/pull/16396)) <del>- Made `date` and `datetime` cast difference more explicit ([#16799](https://github.com/laravel/framework/pull/16799)) <del>- Use `getKeyType()` instead of `$keyType` in `Model` ([#16608](https://github.com/laravel/framework/pull/16608)) <del>- Only detach all associations if no parameter is passed to `BelongsToMany::detach()` ([#16144](https://github.com/laravel/framework/pull/16144)) <del>- Return a database collection from `HasOneOrMany::createMany()` ([#15944](https://github.com/laravel/framework/pull/15944)) <del>- Throw `JsonEncodingException` when `Model::toJson()` fails ([#16159](https://github.com/laravel/framework/pull/16159), [0bda866](https://github.com/laravel/framework/commit/0bda866a475de524eeff3e7f7471031dd64cf2d3)) <del>- Default foreign key for `belongsTo()` relationship is now dynamic ([#16847](https://github.com/laravel/framework/pull/16847)) <del>- Added `whereKey()` method ([#16558](https://github.com/laravel/framework/pull/16558)) <del>- Use parent connection if related model doesn't specify one ([#16103](https://github.com/laravel/framework/pull/16103)) <del>- Enforce an `orderBy` clause for `chunk()` ([#16283](https://github.com/laravel/framework/pull/16283), [#16513](https://github.com/laravel/framework/pull/16513)) <del>- Added `$connection` parameter to `create()` and `forceCreate()` ([#17392](https://github.com/laravel/framework/pull/17392)) <del> <del>### Events <del>- Removed event priorities ([dbbfc62](https://github.com/laravel/framework/commit/dbbfc62beff1625b0d45bbf39650d047555cf4fa), [#17245](https://github.com/laravel/framework/pull/17245), [f83edc1](https://github.com/laravel/framework/commit/f83edc1cb820523fd933c3d3c0430a1f63a073ec)) <del>- Allow queued handlers to specify their queue and connection ([fedd4cd](https://github.com/laravel/framework/commit/fedd4cd4d900656071d44fc1ee9c83e6de986fa8)) <del>- Converted `locale.changed` event into `LocaleUpdated` class ([3385fdc](https://github.com/laravel/framework/commit/3385fdc0f8e4890ab57261755bcbbf79f9ec828d)) <del>- Unified wording ([2dcde69](https://github.com/laravel/framework/commit/2dcde6983ffbb4faf1c238544b51831b33c3a857)) <del>- Allow chaining queueable methods onto trait dispatch ([9fde549](https://github.com/laravel/framework/commit/9fde54954c326b9021476aa87c96bf43a7885bcc)) <del>- Removed `Queueable` trait from event listeners subs ([2a90ef4](https://github.com/laravel/framework/commit/2a90ef46a2121783f8c5c8f20274634cde115612)) <del> <del>### Filesystem <del>- Use UUID instead of `md5()` for generating file names in `FileHelpers` ([#16193](https://github.com/laravel/framework/pull/16193)) <del>- Allow array of options on `Filesystem` operations ([481f760](https://github.com/laravel/framework/commit/481f76000c861e3e2540dcdda986fb44622ccbbe)) <del> <del>### HTTP <del>- Refactored session component ([66976ba](https://github.com/laravel/framework/commit/66976ba3f559ee6ede4cc865ea995996cd42ee1b), [d9e0a6a](https://github.com/laravel/framework/commit/d9e0a6a03891d16ed6a71151354445fbdc9e6f50)) <del>- Added `Illuminate\Http\Request\Concerns` traits ([4810e9d](https://github.com/laravel/framework/commit/4810e9d1bc118367f3d70cd6f64f1d4c4acf85ca)) <del>- Use variable-length method signature for `CookieJar::queue()` ([#16290](https://github.com/laravel/framework/pull/16290), [ddabaaa](https://github.com/laravel/framework/commit/ddabaaa6a8ce16876ddec36be1391eae14649aea)) <del>- Added `FormRequestServiceProvider` ([b892805](https://github.com/laravel/framework/commit/b892805124ecdf4821c2dac7aea4f829ce2248bc)) <del>- Renamed `Http/Exception` namespace to `Http/Exceptions` ([#17398](https://github.com/laravel/framework/pull/17398)) <del>- Renamed `getJsonOptions()` to `getEncodingOptions()` on `JsonResponse` ([e689b2a](https://github.com/laravel/framework/commit/e689b2aa06d1d35d2593ffa77f8a56df314f7e49)) <del>- Renamed `VerifyPostSize` middleware to `ValidatePostSize` ([893a044](https://github.com/laravel/framework/commit/893a044fb10c87095e99081de4d1668bc1e19997)) <del>- Converted `kernel.handled` event into `RequestHandled` class ([43a5e5f](https://github.com/laravel/framework/commit/43a5e5f341cc8affd52e77019f50e2d96feb94a5)) <del>- Throw `AuthorizationException` in `FormRequest` ([1a75409](https://github.com/laravel/framework/commit/1a7540967ca36f875a262a22b76c2a094b9ba3b4)) <del>- Use `Str::random` instead of UUID in `FileHelpers` ([#17046](https://github.com/laravel/framework/pull/17046)) <del>- Moved `getOriginalContent()` to `ResponseTrait` ([#17137](https://github.com/laravel/framework/pull/17137)) <del>- Added JSON responses to the `AuthenticatesUsers` and `ThrottlesLogins` ([#17369](https://github.com/laravel/framework/pull/17369)) <del>- Added middleware to trim strings and convert empty strings to null ([f578bbc](https://github.com/laravel/framework/commit/f578bbce25843492fc996ac96797e0395e16cf2e)) <del> <del>### Logging <del>- Added `LogServiceProvider` to defer loading of logging code ([#15451](https://github.com/laravel/framework/pull/15451), [6550153](https://github.com/laravel/framework/commit/6550153162b4d54d03d37dd9adfd0c95ca0383a9), [#15794](https://github.com/laravel/framework/pull/15794)) <del>- The `Log` facade now uses `LoggerInterface` instead of the log writer ([#15855](https://github.com/laravel/framework/pull/15855)) <del>- Converted `illuminate.log` event into `MessageLogged` class ([57c82d0](https://github.com/laravel/framework/commit/57c82d095c356a0fe0f9381536afec768cdcc072)) <del> <del>### Mail <del>- Added support for Markdown emails and notifications ([#16768](https://github.com/laravel/framework/pull/16768), [b876759](https://github.com/laravel/framework/commit/b8767595e762d241a52607123da5922899bf65e1), [cd569f0](https://github.com/laravel/framework/commit/cd569f074fd566f30d3eb760c3c9027203da3850), [5325385](https://github.com/laravel/framework/commit/5325385f32331c44c5050cdd790dfbdfe943357b)) <del>- Refactored Mail component and removed `SuperClosure` dependency ([50ab994](https://github.com/laravel/framework/commit/50ab994b5b9c2675eb6cc24412672df5aefd248c), [5dace8f](https://github.com/laravel/framework/commit/5dace8f0d6f6e67b4862abbbae376dcd8a641f00)) <del>- Allow `Mailer` to email `HtmlString` objects ([882ea28](https://github.com/laravel/framework/commit/882ea283045a7a231ca86c75058ebdea1d160fda)) <del>- Added `hasTo()`, `hasCc()` and `hasBcc()` to `Mailable` ([fb29b38](https://github.com/laravel/framework/commit/fb29b38d7c04c59e1f442b0d89fc6108c8671a08)) <del> <del>### Notifications <del>- Added `NotificationSender` class ([5f93133](https://github.com/laravel/framework/commit/5f93133170c40b203f0922fd29eb22e1ee20be21)) <del>- Removed `to` and `cc` from mail `MailMessage` ([ff68549](https://github.com/laravel/framework/commit/ff685491f4739b899dbe91e5fb1683c28e2dc5e1)) <del>- Add salutation option to `SimpleMessage` notification ([#17429](https://github.com/laravel/framework/pull/17429)) <del> <del>### Queue <del>- Support job-based queue options ([#16257](https://github.com/laravel/framework/pull/16257), [2382dc3](https://github.com/laravel/framework/commit/2382dc3f374bee7ad966d11ecb35a1429d9a09e8), [ee385fa](https://github.com/laravel/framework/commit/ee385fa5eab0c4642f47636f0e033e982d402bb9)) <del>- Fixed manually failing jobs and added `FailingJob` class ([707a3bc](https://github.com/laravel/framework/commit/707a3bc84ce82bbe44e2c722ede24b5edb194b6b), [55afe12](https://github.com/laravel/framework/commit/55afe12977b55dbafda940e18102bb52276ca569)) <del>- Converted `illuminate.queue.looping` event into `Looping` class ([57c82d0](https://github.com/laravel/framework/commit/57c82d095c356a0fe0f9381536afec768cdcc072)) <del>- Refactored Queue component ([9bc8ca5](https://github.com/laravel/framework/commit/9bc8ca502687f29761b9eb78f70db6e3c3f0a09e), [e030231](https://github.com/laravel/framework/commit/e030231604479d0326ad9bfb56a2a36229d78ff4), [a041fb5](https://github.com/laravel/framework/commit/a041fb5ec9fc775d1a3efb6b647604da2b02b866), [7bb15cf](https://github.com/laravel/framework/commit/7bb15cf40a182bed3d00bc55de55798e58bf1ed0), [5505728](https://github.com/laravel/framework/commit/55057285b321b4b668d12fade330b0d196f9514a), [fed36bd](https://github.com/laravel/framework/commit/fed36bd7e09658009d36d9dd568f19ddcb75172e)) <del>- Refactored how queue connection names are set ([4c600fb](https://github.com/laravel/framework/commit/4c600fb7af855747b6b44a194a5d0061d6294488)) <del>- Let queue worker exit ungracefully on `memoryExceeded()` ([#17302](https://github.com/laravel/framework/pull/17302)) <del>- Support pause and continue signals in queue worker ([827d075](https://github.com/laravel/framework/commit/827d075fb06b516eea992393279fc5ec2adabcf8)) <del> <del>### Redis <del>- Added support for [PhpRedis](https://github.com/phpredis/phpredis) ([#15160](https://github.com/laravel/framework/pull/15160), [01ed1c8](https://github.com/laravel/framework/commit/01ed1c8348a8e69ad213c95dd8d24e652154e6f0), [1ef8b9c](https://github.com/laravel/framework/commit/1ef8b9c3f156c7d4debc6c6f67b73b032d8337d5)) <del>- Added support for multiple Redis clusters ([#16696](https://github.com/laravel/framework/pull/16696), [464075d](https://github.com/laravel/framework/commit/464075d3c5f152dfc4fc9287595d62dbdc3c6347)) <del>- Added `RedisQueue::laterRaw()` method ([7fbac1c](https://github.com/laravel/framework/commit/7fbac1c6c09080da698f4c3256356cb896465692)) <del>- Return migrated jobs from `RedisQueue::migrateExpiredJobs()` ([f21e942](https://github.com/laravel/framework/commit/f21e942ae8a4104ffdf42c231601efe8759c4c10)) <del>- Send full job back into `RedisQueue` ([16e862c](https://github.com/laravel/framework/commit/16e862c1e22795acab869fa01ec5f8bcd7d400b3)) <del> <del>### Routing <del>- Added support for fluent routes ([#16647](https://github.com/laravel/framework/pull/16647), [#16748](https://github.com/laravel/framework/pull/16748)) <del>- Removed `RouteServiceProvider::loadRoutesFrom()` ([0f2b3be](https://github.com/laravel/framework/commit/0f2b3be9b8753ba2813595f9191aa8d8c31886b1)) <del>- Allow route groups to be loaded directly from a file ([#16707](https://github.com/laravel/framework/pull/16707), [#16792](https://github.com/laravel/framework/pull/16792)) <del>- Added named parameters to `UrlGenerator` ([#16736](https://github.com/laravel/framework/pull/16736), [ce4d86b](https://github.com/laravel/framework/commit/ce4d86b48732a707e3909dbc553a2c349c8ecae7)) <del>- Refactored Route component ([b75aca6](https://github.com/laravel/framework/commit/b75aca6a203590068161835945213fd1a39c7080), [9d3ff16](https://github.com/laravel/framework/commit/9d3ff161fd3929f9a106f007ce63fffdd118d490), [c906ed9](https://github.com/laravel/framework/commit/c906ed933713df22e4356cf4ea274f19b15d1ab7), [0f7985c](https://github.com/laravel/framework/commit/0f7985c888abb0a1824e87b32ab3d8feaca5fecf), [0f7985c](https://github.com/laravel/framework/commit/0f7985c888abb0a1824e87b32ab3d8feaca5fecf), [3f4221f](https://github.com/laravel/framework/commit/3f4221fe07c3e9d12eb814c144c1ffca09b577da)) <del>- Refactored Router component ([eecf6ec](https://github.com/laravel/framework/commit/eecf6eca8b4a0cfdf8ec2b0148ee726b8b67c6bb), [b208a4f](https://github.com/laravel/framework/commit/b208a4fc3b35da167a2dcb9b581d9e072d20ec92), [21de409](https://github.com/laravel/framework/commit/21de40971cd81712b398ef3895357843fd34250d), [e75730e](https://github.com/laravel/framework/commit/e75730ec192bb2927a46f37ef854ba8c7372cac6)) <del>- Refactored Router URL generator component ([39e8c83](https://github.com/laravel/framework/commit/39e8c83af778d8086b0b5e8f4f2e21331b015b39), [098da0d](https://github.com/laravel/framework/commit/098da0d6b4c20104c60b969b9a7f10ac5ff50c8e)) <del>- Removed `RouteDependencyResolverTrait::callWithDependencies()` ([f7f13fa](https://github.com/laravel/framework/commit/f7f13fab9a451bc2249fc0709b6cf1fa6b7c795a)) <del>- `UrlGenerator` improvements ([f0b9858](https://github.com/laravel/framework/commit/f0b985831f72a896735d02bf14b1c6680e3d7092), [4f96f42](https://github.com/laravel/framework/commit/4f96f429b22b1b09de6a263bd7d50eda18075b52)) <del>- Compile routes only once ([c8ed0c3](https://github.com/laravel/framework/commit/c8ed0c3a11bf7d8180982a3d32a60364594bbfe1), [b11fbcc](https://github.com/laravel/framework/commit/b11fbcc209b8a57501bac6221728e7ed6c7a82a2)) <del> <del>### Testing <del>- Simplified built-in testing for Dusk ([#16667](https://github.com/laravel/framework/pull/16667), [126adb7](https://github.com/laravel/framework/commit/126adb781c204129600363f243b9d73e202d229e), [b6dec26](https://github.com/laravel/framework/commit/b6dec2602d4a7aa1e61667c02c301c8011267a19), [939264f](https://github.com/laravel/framework/commit/939264f91edc5d33da5ce6cf95a271a6f4a2e1f2)) <del>- Improve database testing methods ([#16679](https://github.com/laravel/framework/pull/16679), [14e9dad](https://github.com/laravel/framework/commit/14e9dad05d09429fab244e2d8f6c49e679a3a975), [f23ac64](https://github.com/laravel/framework/commit/f23ac640fa403ca8d4131c36367b53e123b6b852)) <del>- Refactored `MailFake` ([b1d8f81](https://github.com/laravel/framework/commit/b1d8f813d13960096493f3adc3bc32ace66ba2e6)) <del>- Namespaced all tests ([#17058](https://github.com/laravel/framework/pull/17058), [#17148](https://github.com/laravel/framework/pull/17148)) <del>- Allow chaining of response assertions ([#17330](https://github.com/laravel/framework/pull/17330)) <del>- Return `TestResponse` from `MakesHttpRequests::json()` ([#17341](https://github.com/laravel/framework/pull/17341)) <del>- Always return collection from factory when `$amount` is set ([#17493](https://github.com/laravel/framework/pull/17493)) <del> <del>### Translations <del>- Added JSON loader for translations and `__()` helper ([#16424](https://github.com/laravel/framework/pull/16424), [#16470](https://github.com/laravel/framework/pull/16470), [9437244](https://github.com/laravel/framework/commit/94372447b9de48f5c174db2cf7c81dffb3c0c692)) <del>- Replaced Symfony's translator ([#15563](https://github.com/laravel/framework/pull/15563)) <del>- Added `namespaces()` method to translation loaders ([#16664](https://github.com/laravel/framework/pull/16664), [fe7bbf7](https://github.com/laravel/framework/commit/fe7bbf727834a748b04fcf5145b1137dd45ac4b7)) <del>- Switched to `trans()` helper in `AuthenticatesUsers` ([#17202](https://github.com/laravel/framework/pull/17202)) <del> <del>### Validation <del>- Refactored Validation component ([#17005](https://github.com/laravel/framework/pull/17005), [9e98e7a](https://github.com/laravel/framework/commit/9e98e7a5120f14e942bd00a1439e1a049440eea8), [9b817f1](https://github.com/laravel/framework/commit/9b817f1d03b3a7b3379723a32ab818aa3860060a)) <del>- Removed files hydration in `Validator` ([#16017](https://github.com/laravel/framework/pull/16017)) <del>- Added IPv4 and IPv6 validators ([#16545](https://github.com/laravel/framework/pull/16545)) <del>- Made `date_format` validation more precise ([#16858](https://github.com/laravel/framework/pull/16858)) <del>- Add place-holder replacers for `*_or_equal` rules ([#17030](https://github.com/laravel/framework/pull/17030)) <del>- Made `sometimes()` chainable ([#17241](https://github.com/laravel/framework/pull/17241)) <del>- Support wildcards in `MessageBag::first()` ([#15217](https://github.com/laravel/framework/pull/15217)) <del>- Support implicit keys in `MessageBag::first()` and `MessageBag::first()` ([#17001](https://github.com/laravel/framework/pull/17001)) <del>- Support arrays with empty string as key ([#17427](https://github.com/laravel/framework/pull/17427)) <del>- Add type check to `validateUrl()` ([#17504](https://github.com/laravel/framework/pull/17504))
3
PHP
PHP
send charset in content-type when content is json
ac0b9b285d33b1ebc86567894d813443c00f5f0c
<ide><path>lib/Cake/Network/CakeResponse.php <ide> protected function _setContentType() { <ide> if (in_array($this->_status, array(304, 204))) { <ide> return; <ide> } <del> if (strpos($this->_contentType, 'text/') === 0) { <add> if (strpos($this->_contentType, 'text/') === 0 || $this->_contentType === 'application/json') { <ide> $this->header('Content-Type', "{$this->_contentType}; charset={$this->_charset}"); <ide> } else { <ide> $this->header('Content-Type', "{$this->_contentType}");
1
Go
Go
forbid users to push "root" repositories
b370acd679622239849b1dfbe05d61804aeb7162
<ide><path>commands.go <ide> func (srv *Server) CmdPush(stdin io.ReadCloser, stdout io.Writer, args ...string <ide> <ide> tmp := strings.SplitN(local, "/", 2) <ide> if len(tmp) == 1 { <del> remote = srv.runtime.authConfig.Username + "/" + local <add> return fmt.Errorf( <add> "Impossible to push a \"root\" repository. Please rename your repository in <user>/<repo> (ex: %s/%s)", <add> srv.runtime.authConfig.Username, local) <ide> } else { <ide> remote = local <ide> }
1