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
PHP
PHP
add dsn parsing to staticconfigtrait
2ee6448a32f31e3c47b8044c50d7d8af151d6069
<ide><path>src/Core/StaticConfigTrait.php <ide> public static function config($key, $config = null) { <ide> if (isset(static::$_config[$key])) { <ide> throw new BadMethodCallException(sprintf('Cannot reconfigure existing key "%s"', $key)); <ide> } <del> if (is_object($config)) { <add> if (is_array($config)) { <add> $config = static::parseDsn($config); <add> } elseif ($config === null && is_array($key)) { <add> foreach ($key as $name => $settings) { <add> $key[$name] = static::parseDsn($settings); <add> } <add> } elseif (is_object($config)) { <ide> $config = ['className' => $config]; <ide> } <ide> if (isset($config['engine']) && empty($config['className'])) { <ide> public static function configured() { <ide> return array_keys(static::$_config); <ide> } <ide> <add>/** <add> * Parses a dsn into a valid connection configuration <add> * <add> * This method allows setting a dsn using PEAR::DB formatting, with added support for drivers <add> * in the SQLAlchemy format. The following is an example of it's usage: <add> * <add> * {{{ <add> * $dsn = 'mysql+Cake\Database\Driver\Mysql://user:password@localhost:3306/database_name'; <add> * $config = ConnectionManager::parseDsn($dsn); <add> * }} <add> * <add> * If an array is given, the parsed dsn will be merged into this array. Note that querystring <add> * arguments are also parsed and set as values in the returned configuration. <add> * <add> * @param array $key An array with a `dsn` key mapping to a string dsn <add> * @return mixed null when adding configuration and an array of configuration data when reading. <add> */ <add> public static function parseDsn($config) { <add> if (!is_array($config) || !isset($config['dsn'])) { <add> return $config; <add> } <add> <add> $driver = null; <add> $dsn = $config['dsn']; <add> unset($config['dsn']); <add> <add> if (preg_match("/^([\w]+)\+([\w\\\]+)/", $dsn, $matches)) { <add> $scheme = $matches[1]; <add> $driver = $matches[2]; <add> $dsn = preg_replace("/^([\w]+)\+([\w\\\]+)/", $scheme, $dsn); <add> } <add> <add> $parsed = parse_url($dsn); <add> $query = ''; <add> <add> if (isset($parsed['query'])) { <add> $query = $parsed['query']; <add> unset($parsed['query']); <add> } <add> <add> parse_str($query, $queryArgs); <add> <add> if ($driver !== null) { <add> $queryArgs['driver'] = $driver; <add> } <add> <add> $config = array_merge($queryArgs, $parsed, $config); <add> <add> foreach ($config as $key => $value) { <add> if ($value === 'true') { <add> $config[$key] = true; <add> } elseif ($value === 'false') { <add> $config[$key] = false; <add> } <add> } <add> <add> return $config; <add> } <add> <ide> }
1
Go
Go
remove unused imports
276d2bbf1d400415bec8d4652ac61e570b9206e3
<ide><path>term/term.go <ide> package term <ide> <ide> import ( <del> "fmt" <del> "io" <ide> "os" <ide> "os/signal" <ide> "syscall"
1
Go
Go
log stderr on failures
63f9c7784b7c6a726c8c668d68f9c8cb13e19ffb
<ide><path>builder/dockerfile/evaluator_test.go <ide> package dockerfile // import "github.com/docker/docker/builder/dockerfile" <ide> <ide> import ( <ide> "os" <add> "runtime" <ide> "testing" <ide> <ide> "github.com/docker/docker/builder/remotecontext" <ide> func initDispatchTestCases() []dispatchTestCase { <ide> } <ide> <ide> func TestDispatch(t *testing.T) { <del> skip.If(t, os.Getuid() != 0, "skipping test that requires root") <add> if runtime.GOOS != "windows" { <add> skip.If(t, os.Getuid() != 0, "skipping test that requires root") <add> } <ide> testCases := initDispatchTestCases() <ide> <ide> for _, testCase := range testCases { <ide><path>builder/dockerfile/internals_test.go <ide> func TestDockerfileOutsideTheBuildContext(t *testing.T) { <ide> defer cleanup() <ide> <ide> expectedError := "Forbidden path outside the build context: ../../Dockerfile ()" <add> if runtime.GOOS == "windows" { <add> expectedError = "failed to resolve scoped path ../../Dockerfile ()" <add> } <ide> <ide> readAndCheckDockerfile(t, "DockerfileOutsideTheBuildContext", contextDir, "../../Dockerfile", expectedError) <ide> } <ide> func TestNonExistingDockerfile(t *testing.T) { <ide> } <ide> <ide> func readAndCheckDockerfile(t *testing.T, testName, contextDir, dockerfilePath, expectedError string) { <del> skip.If(t, os.Getuid() != 0, "skipping test that requires root") <add> if runtime.GOOS != "windows" { <add> skip.If(t, os.Getuid() != 0, "skipping test that requires root") <add> } <ide> tarStream, err := archive.Tar(contextDir, archive.Uncompressed) <ide> assert.NilError(t, err) <ide> <ide> func readAndCheckDockerfile(t *testing.T, testName, contextDir, dockerfilePath, <ide> Source: tarStream, <ide> } <ide> _, _, err = remotecontext.Detect(config) <del> assert.Check(t, is.Error(err, expectedError)) <add> assert.Check(t, is.ErrorContains(err, expectedError)) <ide> } <ide> <ide> func TestCopyRunConfig(t *testing.T) { <ide><path>daemon/graphdriver/lcow/lcow_svm.go <ide> package lcow // import "github.com/docker/docker/daemon/graphdriver/lcow" <ide> <ide> import ( <ide> "bytes" <del> "errors" <ide> "fmt" <ide> "io" <ide> "strings" <ide> import ( <ide> <ide> "github.com/Microsoft/hcsshim" <ide> "github.com/Microsoft/opengcs/client" <add> "github.com/pkg/errors" <ide> "github.com/sirupsen/logrus" <ide> ) <ide> <ide> func (svm *serviceVM) createUnionMount(mountName string, mvds ...hcsshim.MappedV <ide> } <ide> <ide> logrus.Debugf("Doing the overlay mount with union directory=%s", mountName) <del> if err = svm.runProcess(fmt.Sprintf("mkdir -p %s", mountName), nil, nil, nil); err != nil { <del> return err <add> errOut := &bytes.Buffer{} <add> if err = svm.runProcess(fmt.Sprintf("mkdir -p %s", mountName), nil, nil, errOut); err != nil { <add> return errors.Wrapf(err, "mkdir -p %s failed (%s)", mountName, errOut.String()) <ide> } <ide> <ide> var cmd string <ide> func (svm *serviceVM) createUnionMount(mountName string, mvds ...hcsshim.MappedV <ide> upper := fmt.Sprintf("%s/upper", svm.getShortContainerPath(&mvds[0])) <ide> work := fmt.Sprintf("%s/work", svm.getShortContainerPath(&mvds[0])) <ide> <del> if err = svm.runProcess(fmt.Sprintf("mkdir -p %s %s", upper, work), nil, nil, nil); err != nil { <del> return err <add> errOut := &bytes.Buffer{} <add> if err = svm.runProcess(fmt.Sprintf("mkdir -p %s %s", upper, work), nil, nil, errOut); err != nil { <add> return errors.Wrapf(err, "mkdir -p %s failed (%s)", mountName, errOut.String()) <ide> } <ide> <ide> cmd = fmt.Sprintf("mount -t overlay overlay -olowerdir=%s,upperdir=%s,workdir=%s %s", <ide> func (svm *serviceVM) createUnionMount(mountName string, mvds ...hcsshim.MappedV <ide> } <ide> <ide> logrus.Debugf("createUnionMount: Executing mount=%s", cmd) <del> if err = svm.runProcess(cmd, nil, nil, nil); err != nil { <del> return err <add> errOut = &bytes.Buffer{} <add> if err = svm.runProcess(cmd, nil, nil, errOut); err != nil { <add> return errors.Wrapf(err, "%s failed (%s)", cmd, errOut.String()) <ide> } <ide> <ide> svm.unionMounts[mountName] = 1
3
Ruby
Ruby
use test dsl
b1241bb3a1971bb0cdba2e0f1fef6ad046b5f109
<ide><path>Library/Homebrew/cmd/create.rb <ide> def install <ide> system "make install" # if this fails, try separate make/make install steps <ide> end <ide> <del> def test <add> test do <add> # `test do` will create, run in and delete a temporary directory. <add> # <ide> # This test will fail and we won't accept that! It's enough to just replace <ide> # "false" with the main program this formula installs, but it'd be nice if you <ide> # were more thorough. Run the test with `brew test #{name}`.
1
Javascript
Javascript
remove some redundant imports
993b78de0bab6024a8ac48ff6502e7e409b10710
<ide><path>examples/with-three-js/pages/_app.js <del>import React from 'react' <ide> import './index.css' <ide> <ide> function MyApp({ Component, pageProps }) { <ide><path>examples/with-three-js/pages/birds.js <del>import React, { useRef, useState, useEffect, Suspense } from 'react' <add>import { useRef, useState, useEffect, Suspense } from 'react' <ide> import * as THREE from 'three' <ide> import { Canvas, useFrame, useLoader } from 'react-three-fiber' <ide> <ide><path>examples/with-three-js/pages/boxes.js <del>import React, { useRef, useState, Suspense } from 'react' <add>import { useRef, useState, Suspense } from 'react' <ide> import { Canvas, useFrame } from 'react-three-fiber' <ide> <ide> const Box = (props) => { <ide><path>examples/with-three-js/pages/index.js <del>import React from 'react' <ide> import Link from 'next/link' <ide> <ide> const Index = () => { <ide><path>examples/with-typestyle/pages/index.js <del>import React from 'react' <ide> import { style } from 'typestyle' <ide> <ide> const className = style({ color: 'red' }) <ide><path>examples/with-universal-configuration-runtime/pages/index.js <del>import React from 'react' <ide> import getConfig from 'next/config' <ide> <ide> const { publicRuntimeConfig } = getConfig() <ide><path>examples/with-videojs/components/Player.js <del>import React, { Component } from 'react' <add>import { Component } from 'react' <ide> import videojs from 'video.js' <ide> import 'videojs-youtube' <ide> <ide><path>examples/with-videojs/pages/index.js <del>import React from 'react' <add>import { Component } from 'react' <ide> import Player from '../components/Player' <ide> <del>export default class Index extends React.Component { <add>export default class Index extends Component { <ide> render() { <ide> const videoJsOptions = { <ide> techOrder: ['youtube'], <ide><path>examples/with-why-did-you-render/components/header.js <del>import React, { useState, useEffect } from 'react' <add>import { useState, useEffect } from 'react' <ide> <ide> const Header = () => { <ide> const [objState, setObjState] = useState({ name: 'World' }) <ide><path>examples/with-yarn-workspaces/packages/bar/index.js <del>import React from 'react' <del> <ide> const Bar = () => <strong>bar</strong> <ide> <ide> export default Bar <ide><path>examples/with-zeit-fetch/pages/preact.js <del>import React from 'react' <ide> import Link from 'next/link' <ide> import fetch from '../fetch' <ide>
11
Javascript
Javascript
add test for setloop (looponce,looprepeat)
cc8d54c1a81e350f89d094a42e342508ec476fd0
<ide><path>test/unit/src/animation/AnimationAction.tests.js <ide> import { AnimationMixer } from '../../../../src/animation/AnimationMixer'; <ide> import { AnimationClip } from '../../../../src/animation/AnimationClip'; <ide> import { NumberKeyframeTrack } from '../../../../src/animation/tracks/NumberKeyframeTrack'; <ide> import { Object3D } from '../../../../src/core/Object3D'; <add>import { LoopOnce, LoopRepeat, LoopPingPong } from '../../../../src/constants'; <ide> <ide> <ide> function createAnimation(){ <ide> export default QUnit.module( 'Animation', () => { <ide> <ide> } ); <ide> <del> QUnit.todo( "setLoop", ( assert ) => { <del> <del> assert.ok( false, "everything's gonna be alright" ); <add> QUnit.test( "setLoop LoopOnce", ( assert ) => { <ide> <add> var {mixer,animationAction} = createAnimation(); <add> animationAction.setLoop(LoopOnce); <add> animationAction.play(); <add> assert.ok( animationAction.isRunning(), "When an animation is started, it is running." ); <add> mixer.update(500); <add> assert.ok( animationAction.isRunning(), "When an animation is in the first loop, it is running." ); <add> mixer.update(500); <add> assert.notOk( animationAction.isRunning(), "When an animation is ended, it is not running." ); <add> mixer.update(500); <add> assert.notOk( animationAction.isRunning(), "When an animation is ended, it is not running." ); <add> <add> } ); <add> <add> QUnit.test( "setLoop LoopRepeat", ( assert ) => { <add> <add> var {mixer,animationAction} = createAnimation(); <add> animationAction.setLoop(LoopRepeat,3); <add> animationAction.play(); <add> assert.ok( animationAction.isRunning(), "When an animation is started, it is running." ); <add> mixer.update(500); <add> assert.ok( animationAction.isRunning(), "When an animation is in the first loop, it is running." ); <add> mixer.update(1000); <add> assert.ok( animationAction.isRunning(), "When an animation is in second loop when in looprepeat 3 times, it is running." ); <add> mixer.update(1000); <add> assert.ok( animationAction.isRunning(), "When an animation is in third loop when in looprepeat 3 times, it is running." ); <add> mixer.update(1000); <add> assert.notOk( animationAction.isRunning(), "When an animation ended his third loop when in looprepeat 3 times, it is not running anymore." ); <add> mixer.update(1000); <add> assert.notOk( animationAction.isRunning(), "When an animation ended his third loop when in looprepeat 3 times, it stays not running anymore." ); <add> <ide> } ); <ide> <ide> QUnit.todo( "setEffectiveWeight", ( assert ) => {
1
Python
Python
add unit tests for oracleoperator
3235670b058681c896ac107e13b5218e9ca930c7
<ide><path>tests/providers/oracle/operators/__init__.py <add># Licensed to the Apache Software Foundation (ASF) under one <add># or more contributor license agreements. See the NOTICE file <add># distributed with this work for additional information <add># regarding copyright ownership. The ASF licenses this file <add># to you under the Apache License, Version 2.0 (the <add># "License"); you may not use this file except in compliance <add># with the License. You may obtain a copy of the License at <add># <add># http://www.apache.org/licenses/LICENSE-2.0 <add># <add># Unless required by applicable law or agreed to in writing, <add># software distributed under the License is distributed on an <add># "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY <add># KIND, either express or implied. See the License for the <add># specific language governing permissions and limitations <add># under the License. <ide><path>tests/providers/oracle/operators/test_oracle.py <add># Licensed to the Apache Software Foundation (ASF) under one <add># or more contributor license agreements. See the NOTICE file <add># distributed with this work for additional information <add># regarding copyright ownership. The ASF licenses this file <add># to you under the Apache License, Version 2.0 (the <add># "License"); you may not use this file except in compliance <add># with the License. You may obtain a copy of the License at <add># <add># http://www.apache.org/licenses/LICENSE-2.0 <add># <add># Unless required by applicable law or agreed to in writing, <add># software distributed under the License is distributed on an <add># "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY <add># KIND, either express or implied. See the License for the <add># specific language governing permissions and limitations <add># under the License. <add> <add>import unittest <add> <add>import mock <add> <add>from airflow.providers.oracle.hooks.oracle import OracleHook <add>from airflow.providers.oracle.operators.oracle import OracleOperator <add> <add> <add>class TestOracleOperator(unittest.TestCase): <add> @mock.patch.object(OracleHook, 'run') <add> def test_execute(self, mock_run): <add> sql = 'SELECT * FROM test_table' <add> oracle_conn_id = 'oracle_default' <add> parameters = {'parameter': 'value'} <add> autocommit = False <add> context = "test_context" <add> task_id = "test_task_id" <add> <add> operator = OracleOperator(sql=sql, oracle_conn_id=oracle_conn_id, parameters=parameters, <add> autocommit=autocommit, task_id=task_id) <add> operator.execute(context=context) <add> <add> mock_run.assert_called_once_with(sql, autocommit=autocommit, parameters=parameters) <ide><path>tests/test_project_structure.py <ide> 'tests/providers/jenkins/hooks/test_jenkins.py', <ide> 'tests/providers/microsoft/azure/sensors/test_azure_cosmos.py', <ide> 'tests/providers/microsoft/mssql/hooks/test_mssql.py', <del> 'tests/providers/oracle/operators/test_oracle.py', <ide> 'tests/providers/qubole/hooks/test_qubole.py', <ide> 'tests/providers/samba/hooks/test_samba.py', <ide> 'tests/providers/yandex/hooks/test_yandex.py'
3
Javascript
Javascript
fix |cleanup| regression in the viewer
5f8373919037321aee05ce0fbaf1aa3fa30358a3
<ide><path>web/pdf_viewer.js <ide> var PDFViewer = (function pdfViewer() { <ide> this.scroll.down); <ide> if (pageView) { <ide> this.renderingQueue.renderView(pageView); <del> return; <add> return true; <ide> } <add> return false; <ide> }, <ide> <ide> getPageTextContent: function (pageIndex) {
1
Text
Text
add http working group
2b1ecfe78c75cbd0818a21d7cf7570f7c1044498
<ide><path>WORKING_GROUPS.md <ide> back in to the TSC. <ide> * [Addon API](#addon-api) <ide> * [Benchmarking](#benchmarking) <ide> * [Post-mortem](#post-mortem) <add>* [Intl](#intl) <add>* [HTTP](#http) <add> <add>#### Process: <add> <ide> * [Starting a Working Group](#starting-a-wg) <ide> * [Bootstrap Governance](#bootstrap-governance) <del>* [Intl](#Intl) <ide> <ide> ### [Website](https://github.com/nodejs/website) <ide> <ide> Their responsibilities are: <ide> * Publishing regular update summaries and other promotional <ide> content. <ide> <add>### [HTTP](https://github.com/nodejs/http) <add> <add>The HTTP working group is chartered for the support and improvement of the <add>HTTP implementation in Node. It's responsibilities are: <add> <add>* Addressing HTTP issues on the Node.js issue tracker. <add>* Authoring and editing HTTP documentation within the Node.js project. <add>* Reviewing changes to HTTP functionality within the Node.js project. <add>* Working with the ecosystem of HTTP related module developers to evolve the <add> HTTP implementation and APIs in core. <add>* Advising the CTC on all HTTP related issues and discussions. <add>* Messaging about the future of HTTP to give the community advance notice of <add> changes. <ide> <ide> ### [Roadmap](https://github.com/nodejs/roadmap) <ide>
1
Text
Text
add mscdex as collaborator
01296923db7715fac43c5a8fbad6aeafa74c1a4a
<ide><path>README.md <ide> information about the governance of the io.js project, see <ide> * **Shigeki Ohtsu** ([@shigeki](https://github.com/shigeki)) &lt;ohtsu@iij.ad.jp&gt; <ide> * **Sam Roberts** ([@sam-github](https://github.com/sam-github)) &lt;vieuxtech@gmail.com&gt; <ide> * **Wyatt Preul** ([@geek](https://github.com/geek)) &lt;wpreul@gmail.com&gt; <add>* **Brian White** ([@mscdex](https://github.com/mscdex)) &lt;mscdex@mscdex.net&gt; <ide> <ide> Collaborators follow the [COLLABORATOR_GUIDE.md](./COLLABORATOR_GUIDE.md) in <ide> maintaining the io.js project.
1
PHP
PHP
add test for auth.redirect session var clearing
7becd58237ecea627c0cfe97cb36cea4b94ad319
<ide><path>lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php <ide> public function setUp() { <ide> $this->Auth = new TestAuthComponent($collection); <ide> $this->Auth->request = $request; <ide> $this->Auth->response = $this->getMock('CakeResponse'); <add> AuthComponent::$sessionKey = 'Auth.User'; <ide> <ide> $this->Controller->Components->init($this->Controller); <ide> <ide> public function testLoginActionNotSettingAuthRedirect() { <ide> $this->assertNull($redirect); <ide> } <ide> <add>/** <add> * testRedirectVarClearing method <add> * <add> * @return void <add> */ <add> public function testRedirectVarClearing() { <add> $this->Controller->request['controller'] = 'auth_test'; <add> $this->Controller->request['action'] = 'admin_add'; <add> $this->Controller->here = '/auth_test/admin_add'; <add> $this->assertNull($this->Auth->Session->read('Auth.redirect')); <add> <add> $this->Auth->authenticate = array('Form'); <add> $this->Auth->startup($this->Controller); <add> $this->assertEquals('/auth_test/admin_add', $this->Auth->Session->read('Auth.redirect')); <add> <add> $this->Auth->Session->write('Auth.User', array('username' => 'admad')); <add> $this->Auth->startup($this->Controller); <add> $this->assertNull($this->Auth->Session->read('Auth.redirect')); <add> } <add> <ide> /** <ide> * testAuthorizeFalse method <ide> *
1
Go
Go
fix typo in deprecation message
bf14bacac3f1cae15ce7b32b5341122c305e630e
<ide><path>api/client/commands.go <ide> func (cli *DockerCli) CmdImport(args ...string) error { <ide> v.Set("repo", repository) <ide> <ide> if cmd.NArg() == 3 { <del> fmt.Fprintf(cli.err, "[DEPRECATED] The format 'URL|- [REPOSITORY [TAG]]' as been deprecated. Please use URL|- [REPOSITORY[:TAG]]\n") <add> fmt.Fprintf(cli.err, "[DEPRECATED] The format 'URL|- [REPOSITORY [TAG]]' has been deprecated. Please use URL|- [REPOSITORY[:TAG]]\n") <ide> v.Set("tag", cmd.Arg(2)) <ide> } <ide>
1
Java
Java
improve constantfieldfeature compatibility
b64edebadc6e26abaaf670ef6eec18cf38aea1d3
<ide><path>spring-core/graalvm/src/main/java/org/springframework/aot/graalvm/ConstantFieldFeature.java <ide> private void duringSetup(DuringSetupAccessImpl access) { <ide> DebugContext debug = access.getDebugContext(); <ide> try (DebugContext.Scope scope = debug.scope("ConstantFieldFeature.duringSetup")) { <ide> debug.log("Installing constant field substitution processor : " + scope); <del> ClassLoader applicationClassLoader = access.getApplicationClassLoader(); <add> ClassLoader classLoader = ConstantFieldFeature.class.getClassLoader(); <ide> ConstantFieldSubstitutionProcessor substitutionProcessor = <del> new ConstantFieldSubstitutionProcessor(debug, applicationClassLoader); <add> new ConstantFieldSubstitutionProcessor(debug, classLoader); <ide> access.registerSubstitutionProcessor(substitutionProcessor); <ide> } <ide> } <ide><path>spring-core/graalvm/src/main/java/org/springframework/aot/graalvm/ConstantReadableJavaField.java <ide> <ide> import java.lang.annotation.Annotation; <ide> <add>import com.oracle.graal.pointsto.infrastructure.WrappedElement; <ide> import com.oracle.svm.core.meta.ReadableJavaField; <ide> import jdk.vm.ci.meta.JavaConstant; <ide> import jdk.vm.ci.meta.JavaType; <ide> * @author Phillip Webb <ide> * @since 6.0 <ide> */ <del>class ConstantReadableJavaField implements ReadableJavaField { <add>class ConstantReadableJavaField implements ReadableJavaField, WrappedElement { <ide> <ide> private final ResolvedJavaField original; <ide> <ide> public boolean injectFinalForRuntimeCompilation() { <ide> return true; <ide> } <ide> <add> @Override <add> public Object getWrapped() { <add> return this.original; <add> } <ide> }
2
Java
Java
add support for extra messageproducer method
c2da8467320660a98897e5f3a2b7cf1c637146b3
<ide><path>spring-jms/src/main/java/org/springframework/jms/connection/CachedMessageProducer.java <ide> public Object invoke(Object proxy, Method method, Object[] args) throws Throwabl <ide> else if (args.length == 3) { <ide> return sendWithDestinationAndCompletionListenerMethod.invoke( <ide> target, args[0], args[1], deliveryMode, priority, timeToLive, args[2]); <add> } else if (args.length == 5) { <add> return sendWithCompletionListenerMethod.invoke( <add> target, args[0], args[1], args[2], args[3], args[4]); <add> } else if (args.length == 6) { <add> return sendWithDestinationAndCompletionListenerMethod.invoke( <add> target, args[0], args[1], args[2], args[3], args[4], args[5]); <ide> } <ide> } <ide> return method.invoke(CachedMessageProducer.this, args);
1
Javascript
Javascript
improve ci stability
87846747df5de34f1a49abfe587d7a2daf9ecfea
<ide><path>test/Compiler.test.js <ide> describe("Compiler", () => { <ide> throw stats.errors[0]; <ide> } <ide> stats.logs = logs; <del> callback(stats, files, compilation); <add> c.close(err => { <add> if (err) return callback(err); <add> callback(stats, files, compilation); <add> }); <ide> }); <ide> } <ide> <add> let compiler; <add> afterEach(callback => { <add> if (compiler) { <add> compiler.close(callback); <add> compiler = undefined; <add> } else { <add> callback(); <add> } <add> }); <add> <ide> it("should compile a single file to deep output", done => { <ide> compile( <ide> "./c", <ide> describe("Compiler", () => { <ide> } <ide> }); <ide> }); <add> afterEach(callback => { <add> if (compiler) { <add> compiler.close(callback); <add> compiler = undefined; <add> } else { <add> callback(); <add> } <add> }); <ide> describe("purgeInputFileSystem", () => { <ide> it("invokes purge() if inputFileSystem.purge", done => { <ide> const mockPurge = jest.fn(); <ide> describe("Compiler", () => { <ide> }); <ide> }); <ide> it("should not emit on errors", done => { <del> const compiler = webpack({ <add> compiler = webpack({ <ide> context: __dirname, <ide> mode: "production", <ide> entry: "./missing", <ide> describe("Compiler", () => { <ide> resolve(stats); <ide> } <ide> }); <add> return c; <ide> }); <ide> }; <del> const compiler = await createCompiler({ <add> compiler = await createCompiler({ <ide> context: __dirname, <ide> mode: "production", <ide> entry: "./missing-file", <ide> describe("Compiler", () => { <ide> bail: true <ide> }); <ide> done(); <del> return compiler; <ide> } catch (err) { <ide> expect(err.toString()).toMatch( <ide> "ModuleNotFoundError: Module not found: Error: Can't resolve './missing-file'" <ide> describe("Compiler", () => { <ide> }); <ide> it("should not emit compilation errors in async (watch)", async done => { <ide> try { <del> const createCompiler = options => { <add> const createStats = options => { <ide> return new Promise((resolve, reject) => { <ide> const c = webpack(options); <ide> c.outputFileSystem = createFsFromVolume(new Volume()); <ide> describe("Compiler", () => { <ide> }); <ide> }); <ide> }; <del> const compiler = await createCompiler({ <add> const stats = await createStats({ <ide> context: __dirname, <ide> mode: "production", <ide> entry: "./missing-file", <ide> describe("Compiler", () => { <ide> filename: "bundle.js" <ide> } <ide> }); <del> expect(compiler).toBeInstanceOf(Stats); <add> expect(stats).toBeInstanceOf(Stats); <ide> done(); <ide> } catch (err) { <ide> done(err); <ide> } <ide> }); <ide> <ide> it("should not emit on errors (watch)", done => { <del> const compiler = webpack({ <add> compiler = webpack({ <ide> context: __dirname, <ide> mode: "production", <ide> entry: "./missing", <ide> describe("Compiler", () => { <ide> }); <ide> }); <ide> it("should not be running twice at a time (run)", done => { <del> const compiler = webpack({ <add> compiler = webpack({ <ide> context: __dirname, <ide> mode: "production", <ide> entry: "./c", <ide> describe("Compiler", () => { <ide> }); <ide> }); <ide> it("should not be running twice at a time (watch)", done => { <del> const compiler = webpack({ <add> compiler = webpack({ <ide> context: __dirname, <ide> mode: "production", <ide> entry: "./c", <ide> describe("Compiler", () => { <ide> }); <ide> }); <ide> it("should not be running twice at a time (run - watch)", done => { <del> const compiler = webpack({ <add> compiler = webpack({ <ide> context: __dirname, <ide> mode: "production", <ide> entry: "./c", <ide> describe("Compiler", () => { <ide> }); <ide> }); <ide> it("should not be running twice at a time (watch - run)", done => { <del> const compiler = webpack({ <add> compiler = webpack({ <ide> context: __dirname, <ide> mode: "production", <ide> entry: "./c", <ide> describe("Compiler", () => { <ide> }); <ide> }); <ide> it("should not be running twice at a time (instance cb)", done => { <del> const compiler = webpack( <add> compiler = webpack( <ide> { <ide> context: __dirname, <ide> mode: "production", <ide> describe("Compiler", () => { <ide> }); <ide> }); <ide> it("should run again correctly after first compilation", done => { <del> const compiler = webpack({ <add> compiler = webpack({ <ide> context: __dirname, <ide> mode: "production", <ide> entry: "./c", <ide> describe("Compiler", () => { <ide> }); <ide> }); <ide> it("should watch again correctly after first compilation", done => { <del> const compiler = webpack({ <add> compiler = webpack({ <ide> context: __dirname, <ide> mode: "production", <ide> entry: "./c", <ide> describe("Compiler", () => { <ide> compiler.run((err, stats) => { <ide> if (err) return done(err); <ide> <del> compiler.watch({}, (err, stats) => { <add> const watching = compiler.watch({}, (err, stats) => { <ide> if (err) return done(err); <del> done(); <add> watching.close(done); <ide> }); <ide> }); <ide> }); <ide> it("should run again correctly after first closed watch", done => { <del> const compiler = webpack({ <add> compiler = webpack({ <ide> context: __dirname, <ide> mode: "production", <ide> entry: "./c", <ide> describe("Compiler", () => { <ide> }); <ide> }); <ide> it("should set compiler.watching correctly", function (done) { <del> const compiler = webpack({ <add> compiler = webpack({ <ide> context: __dirname, <ide> mode: "production", <ide> entry: "./c", <ide> describe("Compiler", () => { <ide> compiler.outputFileSystem = createFsFromVolume(new Volume()); <ide> const watching = compiler.watch({}, (err, stats) => { <ide> if (err) return done(err); <del> done(); <add> watching.close(done); <ide> }); <ide> expect(compiler.watching).toBe(watching); <ide> }); <ide> it("should watch again correctly after first closed watch", done => { <del> const compiler = webpack({ <add> compiler = webpack({ <ide> context: __dirname, <ide> mode: "production", <ide> entry: "./c", <ide> describe("Compiler", () => { <ide> }); <ide> }); <ide> it("should run again correctly inside afterDone hook", done => { <del> const compiler = webpack({ <add> compiler = webpack({ <ide> context: __dirname, <ide> mode: "production", <ide> entry: "./c", <ide> describe("Compiler", () => { <ide> }); <ide> }); <ide> it("should call afterDone hook after other callbacks (run)", done => { <del> const compiler = webpack({ <add> compiler = webpack({ <ide> context: __dirname, <ide> mode: "production", <ide> entry: "./c", <ide> describe("Compiler", () => { <ide> }); <ide> it("should call afterDone hook after other callbacks (instance cb)", done => { <ide> const instanceCb = jest.fn(); <del> const compiler = webpack( <add> compiler = webpack( <ide> { <ide> context: __dirname, <ide> mode: "production", <ide> describe("Compiler", () => { <ide> }); <ide> }); <ide> it("should call afterDone hook after other callbacks (watch)", done => { <del> const compiler = webpack({ <add> compiler = webpack({ <ide> context: __dirname, <ide> mode: "production", <ide> entry: "./c", <ide> describe("Compiler", () => { <ide> expect(doneHookCb).toHaveBeenCalled(); <ide> expect(watchCb).toHaveBeenCalled(); <ide> expect(invalidateCb).toHaveBeenCalled(); <del> done(); <add> watching.close(done); <ide> }); <del> const watch = compiler.watch({}, (err, stats) => { <add> const watching = compiler.watch({}, (err, stats) => { <ide> if (err) return done(err); <ide> watchCb(); <ide> }); <ide> process.nextTick(() => { <del> watch.invalidate(invalidateCb); <add> watching.invalidate(invalidateCb); <ide> }); <ide> }); <ide> it("should call afterDone hook after other callbacks (watch close)", done => { <del> const compiler = webpack({ <add> compiler = webpack({ <ide> context: __dirname, <ide> mode: "production", <ide> entry: "./c", <ide> describe("Compiler", () => { <ide> }); <ide> }); <ide> it("should flag watchMode as true in watch", done => { <del> const compiler = webpack({ <add> compiler = webpack({ <ide> context: __dirname, <ide> mode: "production", <ide> entry: "./c", <ide> describe("Compiler", () => { <ide> }); <ide> }); <ide> it("should use cache on second run call", done => { <del> const compiler = webpack({ <add> compiler = webpack({ <ide> context: __dirname, <ide> mode: "development", <ide> devtool: false, <ide> describe("Compiler", () => { <ide> }); <ide> it("should call the failed-hook on error", done => { <ide> const failedSpy = jest.fn(); <del> const compiler = webpack({ <add> compiler = webpack({ <ide> bail: true, <ide> context: __dirname, <ide> mode: "production", <ide> describe("Compiler", () => { <ide> } <ide> } <ide> it("should log to the console (verbose)", done => { <del> const compiler = webpack({ <add> compiler = webpack({ <ide> context: path.join(__dirname, "fixtures"), <ide> entry: "./a", <ide> output: { <ide> describe("Compiler", () => { <ide> }); <ide> }); <ide> it("should log to the console (debug mode)", done => { <del> const compiler = webpack({ <add> compiler = webpack({ <ide> context: path.join(__dirname, "fixtures"), <ide> entry: "./a", <ide> output: { <ide> describe("Compiler", () => { <ide> }); <ide> }); <ide> it("should log to the console (none)", done => { <del> const compiler = webpack({ <add> compiler = webpack({ <ide> context: path.join(__dirname, "fixtures"), <ide> entry: "./a", <ide> output: { <ide> describe("Compiler", () => { <ide> }); <ide> }); <ide> it("should log to the console with colors (verbose)", done => { <del> const compiler = webpack({ <add> compiler = webpack({ <ide> context: path.join(__dirname, "fixtures"), <ide> entry: "./a", <ide> output: { <ide> describe("Compiler", () => { <ide> }); <ide> }); <ide> it("should log to the console with colors (debug mode)", done => { <del> const compiler = webpack({ <add> compiler = webpack({ <ide> context: path.join(__dirname, "fixtures"), <ide> entry: "./a", <ide> output: {
1
PHP
PHP
fix two typos in cacheengine.php
f3262f768bba13fadc1b9dbe867a0c25da61c9ee
<ide><path>lib/Cake/Cache/CacheEngine.php <ide> abstract public function clear($check); <ide> <ide> /** <ide> * Clears all values belonging to a group. Is upt to the implementing engine <del> * to decide whether actually deete the keys or just simulate it to acheive <add> * to decide whether actually delete the keys or just simulate it to achieve <ide> * the same result. <ide> * <ide> * @param string $groups name of the group to be cleared
1
Python
Python
pass kwargs to configuration
b623ddc0002aebe32e2b7a1203a6acbed61bf9a8
<ide><path>src/transformers/configuration_utils.py <ide> def __init__(self, **kwargs): <ide> logger.error("Can't set {} with value {} for {}".format(key, value, self)) <ide> raise err <ide> <add> @property <add> def num_labels(self): <add> return self._num_labels <add> <add> @num_labels.setter <add> def num_labels(self, num_labels): <add> self._num_labels = num_labels <add> self.id2label = {i: "LABEL_{}".format(i) for i in range(self.num_labels)} <add> self.id2label = dict((int(key), value) for key, value in self.id2label.items()) <add> self.label2id = dict(zip(self.id2label.values(), self.id2label.keys())) <add> self.label2id = dict((key, int(value)) for key, value in self.label2id.items()) <add> <ide> def save_pretrained(self, save_directory): <ide> """ <ide> Save a configuration object to the directory `save_directory`, so that it <ide><path>tests/test_configuration_common.py <ide> def create_and_test_config_from_and_save_pretrained(self): <ide> <ide> self.parent.assertEqual(config_second.to_dict(), config_first.to_dict()) <ide> <add> def create_and_test_config_with_num_labels(self): <add> config = self.config_class(**self.inputs_dict, num_labels=5) <add> self.parent.assertEqual(len(config.id2label), 5) <add> self.parent.assertEqual(len(config.label2id), 5) <add> <add> config.num_labels = 3 <add> self.parent.assertEqual(len(config.id2label), 3) <add> self.parent.assertEqual(len(config.label2id), 3) <add> <ide> def run_common_tests(self): <ide> self.create_and_test_config_common_properties() <ide> self.create_and_test_config_to_json_string() <ide> self.create_and_test_config_to_json_file() <ide> self.create_and_test_config_from_and_save_pretrained() <add> self.create_and_test_config_with_num_labels()
2
Text
Text
fix markdown escape in updating.md
a28c9c64f6623bdea0089aeb404bad98f9dd8a7d
<ide><path>UPDATING.md <ide> Some commands have been grouped to improve UX of CLI. New commands are available <ide> <ide> For Airflow short option, use exactly one single character, New commands are available according to the following table: <ide> <del>| Old command | New command | <del>| :------------------------------------------------- | :------------------------------------------------ | <del>| ``airflow (dags|tasks|scheduler) [-sd, --subdir]`` | ``airflow (dags|tasks|scheduler) [-S, --subdir]`` | <del>| ``airflow tasks test [-dr, --dry_run]`` | ``airflow tasks test [-n, --dry-run]`` | <del>| ``airflow dags backfill [-dr, --dry_run]`` | ``airflow dags backfill [-n, --dry-run]`` | <del>| ``airflow tasks clear [-dx, --dag_regex]`` | ``airflow tasks clear [-R, --dag-regex]`` | <del>| ``airflow kerberos [-kt, --keytab]`` | ``airflow kerberos [-k, --keytab]`` | <del>| ``airflow tasks run [-int, --interactive]`` | ``airflow tasks run [-N, --interactive]`` | <del>| ``airflow webserver [-hn, --hostname]`` | ``airflow webserver [-H, --hostname]`` | <del>| ``airflow celery worker [-cn, --celery_hostname]`` | ``airflow celery worker [-H, --celery-hostname]`` | <del>| ``airflow celery flower [-hn, --hostname]`` | ``airflow celery flower [-H, --hostname]`` | <del>| ``airflow celery flower [-fc, --flower_conf]`` | ``airflow celery flower [-c, --flower-conf]`` | <del>| ``airflow celery flower [-ba, --basic_auth]`` | ``airflow celery flower [-A, --basic-auth]`` | <del>| ``airflow celery flower [-tp, --task_params]`` | ``airflow celery flower [-t, --task-params]`` | <del>| ``airflow celery flower [-pm, --post_mortem]`` | ``airflow celery flower [-m, --post-mortem]`` | <add>| Old command | New command | <add>| :----------------------------------------------------| :---------------------------------------------------| <add>| ``airflow (dags\|tasks\|scheduler) [-sd, --subdir]`` | ``airflow (dags\|tasks\|scheduler) [-S, --subdir]`` | <add>| ``airflow tasks test [-dr, --dry_run]`` | ``airflow tasks test [-n, --dry-run]`` | <add>| ``airflow dags backfill [-dr, --dry_run]`` | ``airflow dags backfill [-n, --dry-run]`` | <add>| ``airflow tasks clear [-dx, --dag_regex]`` | ``airflow tasks clear [-R, --dag-regex]`` | <add>| ``airflow kerberos [-kt, --keytab]`` | ``airflow kerberos [-k, --keytab]`` | <add>| ``airflow tasks run [-int, --interactive]`` | ``airflow tasks run [-N, --interactive]`` | <add>| ``airflow webserver [-hn, --hostname]`` | ``airflow webserver [-H, --hostname]`` | <add>| ``airflow celery worker [-cn, --celery_hostname]`` | ``airflow celery worker [-H, --celery-hostname]`` | <add>| ``airflow celery flower [-hn, --hostname]`` | ``airflow celery flower [-H, --hostname]`` | <add>| ``airflow celery flower [-fc, --flower_conf]`` | ``airflow celery flower [-c, --flower-conf]`` | <add>| ``airflow celery flower [-ba, --basic_auth]`` | ``airflow celery flower [-A, --basic-auth]`` | <add>| ``airflow celery flower [-tp, --task_params]`` | ``airflow celery flower [-t, --task-params]`` | <add>| ``airflow celery flower [-pm, --post_mortem]`` | ``airflow celery flower [-m, --post-mortem]`` | <ide> <ide> For Airflow long option, use [kebab-case](https://en.wikipedia.org/wiki/Letter_case) instead of [snake_case](https://en.wikipedia.org/wiki/Snake_case) <ide>
1
Text
Text
fix bullet spacing for website
8efe148f0731189aed10e2828dc6cffee94c6397
<ide><path>docs/NativeComponentsIOS.md <ide> Let's say we want to add an interactive Map to our app - might as well use [`MKM <ide> Native views are created and manipulated by subclasses of `RCTViewManager`. These subclasses are similar in function to view controllers, but are essentially singletons - only one instance of each is created by the bridge. They vend native views to the `RCTUIManager`, which delegates back to them to set and update the properties of the views as necessary. The `RCTViewManager`s are also typically the delegates for the views, sending events back to JavaScript via the bridge. <ide> <ide> Vending a view is simple: <add> <ide> - Create the basic subclass. <ide> - Add the `RCT_EXPORT_MODULE()` marker macro. <ide> - Implement the `-(UIView *)view` method
1
Javascript
Javascript
lint the tests
81a1cd8caad06f4c637dcbde7fa9d60609d8295c
<ide><path>test/Compiler.test.js <ide> describe("Compiler", () => { <ide> }); <ide> }); <ide> }); <del> it("should not emit on errors", function(done) { <add> it("should not emit on errors", function(done) { <ide> const compiler = webpack({ <ide> context: __dirname, <ide> mode: "production", <ide> describe("Compiler", () => { <ide> return done(new Error("Bundle should not be created on error")); <ide> done(); <ide> }); <del> }); <del> it("should not be run twice at a time (run)", function(done) { <add> }); <add> it("should not be run twice at a time (run)", function(done) { <ide> const compiler = webpack({ <ide> context: __dirname, <ide> mode: "production", <ide> describe("Compiler", () => { <ide> if (err) return done(); <ide> }); <ide> }); <del> it("should not be run twice at a time (watch)", function(done) { <add> it("should not be run twice at a time (watch)", function(done) { <ide> const compiler = webpack({ <ide> context: __dirname, <ide> mode: "production", <ide> describe("Compiler", () => { <ide> compiler.watch({}, (err, stats) => { <ide> if (err) return done(); <ide> }); <del> }); <del> it("should not be run twice at a time (run - watch)", function(done) { <add> }); <add> it("should not be run twice at a time (run - watch)", function(done) { <ide> const compiler = webpack({ <ide> context: __dirname, <ide> mode: "production", <ide> describe("Compiler", () => { <ide> compiler.run((err, stats) => { <ide> if (err) return done(err); <ide> }); <del> compiler.watch({}, (err, stats) => { <add> compiler.watch({}, (err, stats) => { <ide> if (err) return done(); <ide> }); <ide> }); <del> it("should not be run twice at a time (watch - run)", function(done) { <add> it("should not be run twice at a time (watch - run)", function(done) { <ide> const compiler = webpack({ <ide> context: __dirname, <ide> mode: "production", <ide> describe("Compiler", () => { <ide> } <ide> }); <ide> compiler.outputFileSystem = new MemoryFs(); <del> compiler.watch({}, (err, stats) => { <add> compiler.watch({}, (err, stats) => { <ide> if (err) return done(err); <ide> }); <del> compiler.run((err, stats) => { <add> compiler.run((err, stats) => { <ide> if (err) return done(); <ide> }); <ide> }); <del> it("should not be run twice at a time (instance cb)", function(done) { <del> const compiler = webpack({ <del> context: __dirname, <del> mode: "production", <del> entry: "./c", <del> output: { <del> path: "/", <del> filename: "bundle.js" <del> } <del> }, () => {}); <add> it("should not be run twice at a time (instance cb)", function(done) { <add> const compiler = webpack( <add> { <add> context: __dirname, <add> mode: "production", <add> entry: "./c", <add> output: { <add> path: "/", <add> filename: "bundle.js" <add> } <add> }, <add> () => {} <add> ); <ide> compiler.outputFileSystem = new MemoryFs(); <del> compiler.run((err, stats) => { <add> compiler.run((err, stats) => { <ide> if (err) return done(); <ide> }); <ide> }); <del> it("should run again correctly after first compilation", function(done) { <add> it("should run again correctly after first compilation", function(done) { <ide> const compiler = webpack({ <ide> context: __dirname, <ide> mode: "production", <ide> describe("Compiler", () => { <ide> } <ide> }); <ide> compiler.outputFileSystem = new MemoryFs(); <del> compiler.run((err, stats) => { <del> if (err) return done(err); <add> compiler.run((err, stats) => { <add> if (err) return done(err); <ide> <del> compiler.run((err, stats) => { <del> if (err) return done(err); <del> done() <del> }); <add> compiler.run((err, stats) => { <add> if (err) return done(err); <add> done(); <add> }); <ide> }); <ide> }); <del> it("should watch again correctly after first compilation", function(done) { <add> it("should watch again correctly after first compilation", function(done) { <ide> const compiler = webpack({ <ide> context: __dirname, <ide> mode: "production", <ide> describe("Compiler", () => { <ide> } <ide> }); <ide> compiler.outputFileSystem = new MemoryFs(); <del> compiler.run((err, stats) => { <del> if (err) return done(err); <add> compiler.run((err, stats) => { <add> if (err) return done(err); <ide> <del> compiler.watch({}, (err, stats) => { <del> if (err) return done(err); <del> done() <del> }); <add> compiler.watch({}, (err, stats) => { <add> if (err) return done(err); <add> done(); <add> }); <ide> }); <ide> }); <del> it("should run again correctly after first closed watch", function(done) { <add> it("should run again correctly after first closed watch", function(done) { <ide> const compiler = webpack({ <ide> context: __dirname, <ide> mode: "production", <ide> describe("Compiler", () => { <ide> } <ide> }); <ide> compiler.outputFileSystem = new MemoryFs(); <del> const watching = compiler.watch({}, (err, stats) => { <del> if (err) return done(err); <del> done() <del> }); <del> watching.close(() => { <del> compiler.run((err, stats) => { <del> if (err) return done(err); <del> done() <del> }); <del> }) <add> const watching = compiler.watch({}, (err, stats) => { <add> if (err) return done(err); <add> done(); <add> }); <add> watching.close(() => { <add> compiler.run((err, stats) => { <add> if (err) return done(err); <add> done(); <add> }); <add> }); <ide> }); <ide> });
1
PHP
PHP
catch more things
ed3154d8af8f1b9dbb034e2dc92100a0f8f5d4b2
<ide><path>src/Illuminate/View/View.php <ide> public function render(callable $callback = null) <ide> } catch (Exception $e) { <ide> $this->factory->flushSections(); <ide> <add> throw $e; <add> } catch (Throwable $e) { <add> $this->factory->flushSections(); <add> <ide> throw $e; <ide> } <ide> }
1
Go
Go
enable resource limitation
409bbdc3212a37e7a21a70eeae0b44e96509f54d
<ide><path>pkg/sysinfo/sysinfo_linux.go <ide> func New(quiet bool) *SysInfo { <ide> w := o(sysInfo, cgMounts) <ide> warnings = append(warnings, w...) <ide> } <add> if cgroups.IsCgroup2UnifiedMode() { <add> warnings = append(warnings, "Your system is running cgroup v2 (unsupported)") <add> } <ide> if !quiet { <ide> for _, w := range warnings { <ide> logrus.Warn(w) <ide> func New(quiet bool) *SysInfo { <ide> <ide> // applyMemoryCgroupInfo reads the memory information from the memory cgroup mount point. <ide> func applyMemoryCgroupInfo(info *SysInfo, cgMounts map[string]string) []string { <add> if cgroups.IsCgroup2UnifiedMode() { <add> // TODO: check cgroup2 info correctly <add> info.MemoryLimit = true <add> info.SwapLimit = true <add> info.MemoryReservation = true <add> info.OomKillDisable = true <add> info.MemorySwappiness = true <add> return nil <add> } <ide> var warnings []string <ide> mountPoint, ok := cgMounts["memory"] <ide> if !ok { <ide> func applyMemoryCgroupInfo(info *SysInfo, cgMounts map[string]string) []string { <ide> <ide> // applyCPUCgroupInfo reads the cpu information from the cpu cgroup mount point. <ide> func applyCPUCgroupInfo(info *SysInfo, cgMounts map[string]string) []string { <add> if cgroups.IsCgroup2UnifiedMode() { <add> // TODO: check cgroup2 info correctly <add> info.CPUShares = true <add> info.CPUCfsPeriod = true <add> info.CPUCfsQuota = true <add> info.CPURealtimePeriod = true <add> info.CPURealtimeRuntime = true <add> return nil <add> } <ide> var warnings []string <ide> mountPoint, ok := cgMounts["cpu"] <ide> if !ok { <ide> func applyCPUCgroupInfo(info *SysInfo, cgMounts map[string]string) []string { <ide> <ide> // applyBlkioCgroupInfo reads the blkio information from the blkio cgroup mount point. <ide> func applyBlkioCgroupInfo(info *SysInfo, cgMounts map[string]string) []string { <add> if cgroups.IsCgroup2UnifiedMode() { <add> // TODO: check cgroup2 info correctly <add> info.BlkioWeight = true <add> info.BlkioReadBpsDevice = true <add> info.BlkioWriteBpsDevice = true <add> info.BlkioReadIOpsDevice = true <add> info.BlkioWriteIOpsDevice = true <add> return nil <add> } <ide> var warnings []string <ide> mountPoint, ok := cgMounts["blkio"] <ide> if !ok { <ide> func applyBlkioCgroupInfo(info *SysInfo, cgMounts map[string]string) []string { <ide> <ide> // applyCPUSetCgroupInfo reads the cpuset information from the cpuset cgroup mount point. <ide> func applyCPUSetCgroupInfo(info *SysInfo, cgMounts map[string]string) []string { <add> if cgroups.IsCgroup2UnifiedMode() { <add> // TODO: check cgroup2 info correctly <add> info.Cpuset = true <add> return nil <add> } <ide> var warnings []string <ide> mountPoint, ok := cgMounts["cpuset"] <ide> if !ok { <ide> func applyCPUSetCgroupInfo(info *SysInfo, cgMounts map[string]string) []string { <ide> <ide> // applyPIDSCgroupInfo reads the pids information from the pids cgroup mount point. <ide> func applyPIDSCgroupInfo(info *SysInfo, _ map[string]string) []string { <add> if cgroups.IsCgroup2UnifiedMode() { <add> // TODO: check cgroup2 info correctly <add> info.PidsLimit = true <add> return nil <add> } <ide> var warnings []string <ide> _, err := cgroups.FindCgroupMountpoint("", "pids") <ide> if err != nil { <ide> func applyPIDSCgroupInfo(info *SysInfo, _ map[string]string) []string { <ide> <ide> // applyDevicesCgroupInfo reads the pids information from the devices cgroup mount point. <ide> func applyDevicesCgroupInfo(info *SysInfo, cgMounts map[string]string) []string { <add> if cgroups.IsCgroup2UnifiedMode() { <add> // TODO: check cgroup2 info correctly <add> info.CgroupDevicesEnabled = true <add> return nil <add> } <ide> var warnings []string <ide> _, ok := cgMounts["devices"] <ide> info.CgroupDevicesEnabled = ok
1
Ruby
Ruby
move reloader middleware in actiondispatch
d7396b5ca9c066cb16158c02b976dab01f522344
<ide><path>actionpack/lib/action_controller.rb <ide> def self.load_all! <ide> autoload :PolymorphicRoutes, 'action_controller/routing/generation/polymorphic_routes' <ide> autoload :RecordIdentifier, 'action_controller/record_identifier' <ide> autoload :Redirector, 'action_controller/base/redirect' <del> autoload :Reloader, 'action_controller/reloader' <ide> autoload :Renderer, 'action_controller/base/render' <ide> autoload :RequestForgeryProtection, 'action_controller/base/request_forgery_protection' <ide> autoload :Rescue, 'action_controller/dispatch/rescue' <ide><path>actionpack/lib/action_controller/dispatch/dispatcher.rb <ide> class Dispatcher <ide> class << self <ide> def define_dispatcher_callbacks(cache_classes) <ide> unless cache_classes <del> unless self.middleware.include?(Reloader) <del> self.middleware.insert_after(ActionDispatch::Failsafe, Reloader) <add> unless self.middleware.include?(ActionDispatch::Reloader) <add> self.middleware.insert_after(ActionDispatch::Failsafe, ActionDispatch::Reloader) <ide> end <ide> <ide> ActionView::Helpers::AssetTagHelper.cache_asset_timestamps = false <ide><path>actionpack/lib/action_dispatch.rb <ide> module ActionDispatch <ide> <ide> autoload :Failsafe, 'action_dispatch/middleware/failsafe' <ide> autoload :ParamsParser, 'action_dispatch/middleware/params_parser' <add> autoload :Reloader, 'action_dispatch/middleware/reloader' <ide> autoload :RewindableInput, 'action_dispatch/middleware/rewindable_input' <ide> autoload :MiddlewareStack, 'action_dispatch/middleware/stack' <ide> <add><path>actionpack/lib/action_dispatch/middleware/reloader.rb <del><path>actionpack/lib/action_controller/reloader.rb <del>module ActionController <add>module ActionDispatch <ide> class Reloader <ide> def initialize(app) <ide> @app = app <ide> end <ide> <ide> def call(env) <del> Dispatcher.reload_application <add> ActionController::Dispatcher.reload_application <ide> @app.call(env) <ide> ensure <del> Dispatcher.cleanup_application <add> ActionController::Dispatcher.cleanup_application <ide> end <ide> end <ide> end
4
Ruby
Ruby
fix undefined method crash
ac7a59373087e9d49097ab7f0ddb691e64159959
<ide><path>Library/Homebrew/utils/inreplace.rb <ide> module Utils <ide> class InreplaceError < RuntimeError <ide> def initialize(errors) <del> super errors.inject("inreplace failed\n") do |s, (path, errs)| <add> formatted_errors = errors.inject("inreplace failed\n") do |s, (path, errs)| <ide> s << "#{path}:\n" << errs.map { |e| " #{e}\n" }.join <ide> end <add> super formatted_errors <ide> end <ide> end <ide>
1
Text
Text
fix typo in error.capturestacktrace
409418a209558263aebf0ba60c3ebd390b015508
<ide><path>doc/api/errors.md <ide> function MyError() { <ide> } <ide> <ide> // Without passing MyError to captureStackTrace, the MyError <del>// frame would should up in the .stack property. by passing <add>// frame would show up in the .stack property. By passing <ide> // the constructor, we omit that frame and all frames above it. <ide> new MyError().stack <ide> ```
1
PHP
PHP
use static instead of event
2ca07e8ac7c3b5af8a75c4bb19f49b60988d7e22
<ide><path>src/Illuminate/Support/Facades/Event.php <ide> public static function fake($eventsToFake = []) <ide> */ <ide> public static function fakeFor(callable $callable, array $eventsToFake = []) <ide> { <del> $initialDispatcher = Event::getFacadeRoot(); <add> $initialDispatcher = static::getFacadeRoot(); <ide> <del> Event::fake($eventsToFake); <add> static::fake($eventsToFake); <ide> <ide> return tap($callable(), function () use ($initialDispatcher) { <ide> Model::setEventDispatcher($initialDispatcher); <ide> <del> Event::swap($initialDispatcher); <add> static::swap($initialDispatcher); <ide> }); <ide> } <ide>
1
PHP
PHP
fix doc blocks
c369d6745e07cda661cf8f5ffcef40d0cb7b0132
<ide><path>src/Illuminate/Database/Eloquent/Model.php <ide> abstract class Model implements ArrayAccess, ArrayableInterface, JsonableInterfa <ide> protected $fillable = array(); <ide> <ide> /** <del> * The attribute that aren't mass assignable. <add> * The attributes that aren't mass assignable. <ide> * <ide> * @var array <ide> */ <ide><path>src/Illuminate/Database/Eloquent/Relations/Pivot.php <ide> class Pivot extends Model { <ide> protected $otherKey; <ide> <ide> /** <del> * The attribute that aren't mass assignable. <add> * The attributes that aren't mass assignable. <ide> * <ide> * @var array <ide> */
2
Javascript
Javascript
update the css rule with data-ng-cloak
90ba9aadc6693e01487e6e14e7d1065658572e0f
<ide><path>src/ng/directive/ngCloak.js <ide> * `angular.min.js` files. Following is the css rule: <ide> * <ide> * <pre> <del> * [ng\:cloak], [ng-cloak], .ng-cloak { <add> * [ng\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak], .ng-cloak, .x-ng-cloak { <ide> * display: none; <ide> * } <ide> * </pre>
1
Ruby
Ruby
extract macos module to separate file
0bb95960e642782c85eb7e227eba844607fc2d00
<ide><path>Library/Homebrew/macos.rb <add>module MacOS extend self <add> def version <add> MACOS_VERSION <add> end <add> <add> def cat <add> if mountain_lion? <add> :mountainlion <add> elsif lion? <add> :lion <add> elsif snow_leopard? <add> :snowleopard <add> elsif leopard? <add> :leopard <add> else <add> nil <add> end <add> end <add> <add> def clt_installed? <add> # If the command line tools are installed, most unix standard <add> # tools, libs and headers are in /usr. <add> # Returns true, also for older Xcode/OSX versions that had everything in /usr <add> # Beginning with Xcode 4.3, the dev tools are no longer installed <add> # in /usr and SDKs no longer in /Developer by default. <add> # But Apple provides an optional "Command Line Tools for Xcode" package. <add> not clt_version.empty? or dev_tools_path == Pathname.new("/usr/bin") <add> end <add> <add> def clt_version <add> # Version string (a pretty damn long one) of the CLT package. <add> # Note, that different ways to install the CLTs lead to different <add> # version numbers. <add> @clt_version ||= begin <add> # CLT installed via stand-alone website download <add> clt_pkginfo_stand_alone = `pkgutil --pkg-info com.apple.pkg.DeveloperToolsCLILeo 2>/dev/null`.strip <add> # CLT installed via preferences from within Xcode <add> clt_pkginfo_from_xcode = `pkgutil --pkg-info com.apple.pkg.DeveloperToolsCLI 2>/dev/null`.strip <add> if not clt_pkginfo_stand_alone.empty? <add> clt_pkginfo_stand_alone =~ /version: (.*)$/ <add> $1 <add> elsif not clt_pkginfo_from_xcode.empty? <add> clt_pkginfo_from_xcode =~ /version: (.*)$/ <add> $1 <add> else <add> # We return "" instead of nil because we want clt_installed? to be true on older Macs. <add> # So clt_version.empty? does not mean there are no unix tools in /usr, it just means <add> # that the "Command Line Tools for Xcode" package is not installed <add> "" # No CLT or recipe available to pkgutil. <add> end <add> end <add> end <add> <add> # Locate the "current Xcode folder" via xcode-select. See: <add> # man xcode-select <add> def xcode_folder <add> @xcode_folder ||= `xcode-select -print-path 2>/dev/null`.strip <add> end <add> <add> # Xcode 4.3 tools hang if "/" is set <add> def xctools_fucked? <add> xcode_folder == "/" <add> end <add> <add> def locate tool <add> # Don't call tools (cc, make, strip, etc.) directly! <add> # Give the name of the binary you look for as a string to this method <add> # in order to get the full path back as a Pathname. <add> tool = tool.to_s <add> <add> @locate_cache ||= {} <add> return @locate_cache[tool] if @locate_cache.has_key? tool <add> <add> if File.executable? "/usr/bin/#{tool}" <add> path = Pathname.new "/usr/bin/#{tool}" <add> else <add> # Xcrun was provided first with Xcode 4.3 and allows us to proxy <add> # tool usage thus avoiding various bugs. <add> p = `/usr/bin/xcrun -find #{tool} 2>/dev/null`.chomp unless MacOS.xctools_fucked? <add> if !p.nil? and !p.empty? and File.executable? p <add> path = Pathname.new p <add> else <add> # This is for the use-case where xcode-select is not set up correctly <add> # with Xcode 4.3+. The tools in Xcode 4.3+ are split over two locations, <add> # usually xcrun would figure that out for us, but it won't work if <add> # xcode-select is not configured properly. <add> p = "#{MacOS.dev_tools_path}/#{tool}" <add> if File.executable? p <add> path = Pathname.new p <add> else <add> # Otherwise lets look in the second location. <add> p = "#{MacOS.xctoolchain_path}/usr/bin/#{tool}" <add> if File.executable? p <add> path = Pathname.new p <add> else <add> # We digged so deep but all is lost now. <add> path = nil <add> end <add> end <add> end <add> end <add> @locate_cache[tool] = path <add> return path <add> end <add> <add> def dev_tools_path <add> @dev_tools_path ||= if File.exist? "/usr/bin/cc" and File.exist? "/usr/bin/make" <add> # probably a safe enough assumption (the unix way) <add> Pathname.new "/usr/bin" <add> elsif not xctools_fucked? and system "/usr/bin/xcrun -find make 1>/dev/null 2>&1" <add> # Wherever "make" is there are the dev tools. <add> Pathname.new(`/usr/bin/xcrun -find make`.chomp).dirname <add> elsif File.exist? "#{xcode_prefix}/usr/bin/make" <add> # cc stopped existing with Xcode 4.3, there are c89 and c99 options though <add> Pathname.new "#{xcode_prefix}/usr/bin" <add> else <add> # Since we are pretty unrelenting in finding Xcode no matter where <add> # it hides, we can now throw in the towel. <add> opoo "You really should consult the `brew doctor`!" <add> "" <add> end <add> end <add> <add> def xctoolchain_path <add> # Beginning with Xcode 4.3, clang and some other tools are located in a xctoolchain dir. <add> @xctoolchain_path ||= begin <add> path = Pathname.new("#{MacOS.xcode_prefix}/Toolchains/XcodeDefault.xctoolchain") <add> if path.exist? <add> path <add> else <add> # ok, there are no Toolchains in xcode_prefix <add> # and that's ok as long as everything is in dev_tools_path="/usr/bin" (i.e. clt_installed?) <add> nil <add> end <add> end <add> end <add> <add> def sdk_path(v=MacOS.version) <add> # The path of the MacOSX SDK. <add> if !MacOS.xctools_fucked? and File.executable? "#{xcode_folder}/usr/bin/make" <add> path = `#{locate('xcodebuild')} -version -sdk macosx#{v} Path 2>/dev/null`.strip <add> elsif File.directory? '/Developer/SDKs/MacOS#{v}.sdk' <add> # the old default (or wild wild west style) <add> path = "/Developer/SDKs/MacOS#{v}.sdk" <add> elsif File.directory? "#{xcode_prefix}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX#{v}.sdk" <add> # xcode_prefix is pretty smart, so lets look inside to find the sdk <add> path = "#{xcode_prefix}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX#{v}.sdk" <add> end <add> if path.nil? or path.empty? or not File.directory? path <add> nil <add> else <add> Pathname.new path <add> end <add> end <add> <add> def default_cc <add> cc = locate 'cc' <add> Pathname.new(cc).realpath.basename.to_s rescue nil <add> end <add> <add> def default_compiler <add> case default_cc <add> when /^gcc/ then :gcc <add> when /^llvm/ then :llvm <add> when "clang" then :clang <add> else <add> # guess :( <add> if xcode_version >= "4.3" <add> :clang <add> elsif xcode_version >= "4.2" <add> :llvm <add> else <add> :gcc <add> end <add> end <add> end <add> <add> def gcc_42_build_version <add> @gcc_42_build_version ||= if File.exist? "#{dev_tools_path}/gcc-4.2" \ <add> and not Pathname.new("#{dev_tools_path}/gcc-4.2").realpath.basename.to_s =~ /^llvm/ <add> `#{dev_tools_path}/gcc-4.2 --version` =~ /build (\d{4,})/ <add> $1.to_i <add> end <add> end <add> <add> def gcc_40_build_version <add> @gcc_40_build_version ||= if File.exist? "#{dev_tools_path}/gcc-4.0" <add> `#{dev_tools_path}/gcc-4.0 --version` =~ /build (\d{4,})/ <add> $1.to_i <add> end <add> end <add> <add> def xcode_prefix <add> @xcode_prefix ||= begin <add> path = Pathname.new xcode_folder <add> if $?.success? and path.absolute? and File.executable? "#{path}/usr/bin/make" <add> path <add> elsif File.executable? '/Developer/usr/bin/make' <add> # we do this to support cowboys who insist on installing <add> # only a subset of Xcode <add> Pathname.new '/Developer' <add> elsif File.executable? '/Applications/Xcode.app/Contents/Developer/usr/bin/make' <add> # fallback for broken Xcode 4.3 installs <add> Pathname.new '/Applications/Xcode.app/Contents/Developer' <add> else <add> # Ask Spotlight where Xcode is. If the user didn't install the <add> # helper tools and installed Xcode in a non-conventional place, this <add> # is our only option. See: http://superuser.com/questions/390757 <add> path = `mdfind "kMDItemCFBundleIdentifier == 'com.apple.dt.Xcode'"`.strip <add> if path.empty? <add> # Xcode 3 had a different identifier <add> path = `mdfind "kMDItemCFBundleIdentifier == 'com.apple.Xcode'"`.strip <add> end <add> path = "#{path}/Contents/Developer" <add> if !path.empty? and File.executable? "#{path}/usr/bin/make" <add> Pathname.new path <add> else <add> nil <add> end <add> end <add> end <add> end <add> <add> def xcode_installed? <add> # Telling us whether the Xcode.app is installed or not. <add> @xcode_installed ||= begin <add> if File.directory? '/Applications/Xcode.app' <add> true <add> elsif File.directory? '/Developer/Applications/Xcode.app' # old style <add> true <add> elsif not `mdfind "kMDItemCFBundleIdentifier == 'com.apple.dt.Xcode'"`.strip.empty? <add> # Xcode 4 <add> true <add> elsif not `mdfind "kMDItemCFBundleIdentifier == 'com.apple.Xcode'"`.strip.empty? <add> # Xcode 3 <add> true <add> else <add> false <add> end <add> end <add> end <add> <add> def xcode_version <add> # may return a version string <add> # that is guessed based on the compiler, so do not <add> # use it in order to check if Xcode is installed. <add> @xcode_version ||= begin <add> return "0" unless MACOS <add> <add> # this shortcut makes xcode_version work for people who don't realise you <add> # need to install the CLI tools <add> xcode43build = "/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild" <add> if File.file? xcode43build <add> `#{xcode43build} -version 2>/dev/null` =~ /Xcode (\d(\.\d)*)/ <add> return $1 if $1 <add> end <add> <add> # Xcode 4.3 xc* tools hang indefinately if xcode-select path is set thus <add> raise if xctools_fucked? <add> <add> raise unless which "xcodebuild" <add> `xcodebuild -version 2>/dev/null` =~ /Xcode (\d(\.\d)*)/ <add> raise if $1.nil? or not $?.success? <add> $1 <add> rescue <add> # For people who's xcode-select is unset, or who have installed <add> # xcode-gcc-installer or whatever other combinations we can try and <add> # supprt. See https://github.com/mxcl/homebrew/wiki/Xcode <add> case llvm_build_version.to_i <add> when 1..2063 then "3.1.0" <add> when 2064..2065 then "3.1.4" <add> when 2366..2325 <add> # we have no data for this range so we are guessing <add> "3.2.0" <add> when 2326 <add> # also applies to "3.2.3" <add> "3.2.4" <add> when 2327..2333 then "3.2.5" <add> when 2335 <add> # this build number applies to 3.2.6, 4.0 and 4.1 <add> # https://github.com/mxcl/homebrew/wiki/Xcode <add> "4.0" <add> else <add> case (clang_version.to_f * 10).to_i <add> when 0 <add> "dunno" <add> when 1..14 <add> "3.2.2" <add> when 15 <add> "3.2.4" <add> when 16 <add> "3.2.5" <add> when 17..20 <add> "4.0" <add> when 21 <add> "4.1" <add> when 22..30 <add> "4.2" <add> when 31 <add> "4.3" <add> else <add> "4.3" <add> end <add> end <add> end <add> end <add> <add> def llvm_build_version <add> # for Xcode 3 on OS X 10.5 this will not exist <add> # NOTE may not be true anymore but we can't test <add> @llvm_build_version ||= if locate("llvm-gcc") <add> `#{locate("llvm-gcc")} --version` =~ /LLVM build (\d{4,})/ <add> $1.to_i <add> end <add> end <add> <add> def clang_version <add> @clang_version ||= if locate("clang") <add> `#{locate("clang")} --version` =~ /clang version (\d\.\d)/ <add> $1 <add> end <add> end <add> <add> def clang_build_version <add> @clang_build_version ||= if locate("clang") <add> `#{locate("clang")} --version` =~ %r[tags/Apple/clang-(\d{2,})] <add> $1.to_i <add> end <add> end <add> <add> def x11_installed? <add> # Even if only Xcode (without CLT) is installed, this dylib is there. <add> Pathname.new('/usr/X11/lib/libpng.dylib').exist? <add> end <add> <add> def macports_or_fink_installed? <add> # See these issues for some history: <add> # http://github.com/mxcl/homebrew/issues/#issue/13 <add> # http://github.com/mxcl/homebrew/issues/#issue/41 <add> # http://github.com/mxcl/homebrew/issues/#issue/48 <add> return false unless MACOS <add> <add> %w[port fink].each do |ponk| <add> path = which(ponk) <add> return ponk unless path.nil? <add> end <add> <add> # we do the above check because macports can be relocated and fink may be <add> # able to be relocated in the future. This following check is because if <add> # fink and macports are not in the PATH but are still installed it can <add> # *still* break the build -- because some build scripts hardcode these paths: <add> %w[/sw/bin/fink /opt/local/bin/port].each do |ponk| <add> return ponk if File.exist? ponk <add> end <add> <add> # finally, sometimes people make their MacPorts or Fink read-only so they <add> # can quickly test Homebrew out, but still in theory obey the README's <add> # advise to rename the root directory. This doesn't work, many build scripts <add> # error out when they try to read from these now unreadable directories. <add> %w[/sw /opt/local].each do |path| <add> path = Pathname.new(path) <add> return path if path.exist? and not path.readable? <add> end <add> <add> false <add> end <add> <add> def leopard? <add> 10.5 == MACOS_VERSION <add> end <add> <add> def snow_leopard? <add> 10.6 <= MACOS_VERSION # Actually Snow Leopard or newer <add> end <add> <add> def lion? <add> 10.7 <= MACOS_VERSION # Actually Lion or newer <add> end <add> <add> def mountain_lion? <add> 10.8 <= MACOS_VERSION # Actually Mountain Lion or newer <add> end <add> <add> def prefer_64_bit? <add> Hardware.is_64_bit? and not leopard? <add> end <add> <add> StandardCompilers = { <add> "3.1.4" => {:gcc_40_build_version=>5493, :gcc_42_build_version=>5577}, <add> "3.2.6" => {:gcc_40_build_version=>5494, :gcc_42_build_version=>5666, :llvm_build_version=>2335, :clang_version=>"1.7", :clang_build_version=>77}, <add> "4.0" => {:gcc_40_build_version=>5494, :gcc_42_build_version=>5666, :llvm_build_version=>2335, :clang_version=>"2.0", :clang_build_version=>137}, <add> "4.0.1" => {:gcc_40_build_version=>5494, :gcc_42_build_version=>5666, :llvm_build_version=>2335, :clang_version=>"2.0", :clang_build_version=>137}, <add> "4.0.2" => {:gcc_40_build_version=>5494, :gcc_42_build_version=>5666, :llvm_build_version=>2335, :clang_version=>"2.0", :clang_build_version=>137}, <add> "4.2" => {:llvm_build_version=>2336, :clang_version=>"3.0", :clang_build_version=>211}, <add> "4.3" => {:llvm_build_version=>2336, :clang_version=>"3.1", :clang_build_version=>318}, <add> "4.3.1" => {:llvm_build_version=>2336, :clang_version=>"3.1", :clang_build_version=>318}, <add> "4.3.2" => {:llvm_build_version=>2336, :clang_version=>"3.1", :clang_build_version=>318}, <add> "4.3.3" => {:llvm_build_version=>2336, :clang_version=>"3.1", :clang_build_version=>318} <add> } <add> <add> def compilers_standard? <add> xcode = MacOS.xcode_version <add> # Assume compilers are okay if Xcode version not in hash <add> return true unless StandardCompilers.keys.include? xcode <add> <add> StandardCompilers[xcode].all? {|k,v| MacOS.send(k) == v} <add> end <add>end <ide><path>Library/Homebrew/utils.rb <ide> require 'pathname' <ide> require 'exceptions' <add>require 'macos' <ide> <ide> class Tty <ide> class <<self <ide> def nostdout <ide> end <ide> end <ide> <del>module MacOS extend self <del> def version <del> MACOS_VERSION <del> end <del> <del> def cat <del> if mountain_lion? <del> :mountainlion <del> elsif lion? <del> :lion <del> elsif snow_leopard? <del> :snowleopard <del> elsif leopard? <del> :leopard <del> else <del> nil <del> end <del> end <del> <del> def clt_installed? <del> # If the command line tools are installed, most unix standard <del> # tools, libs and headers are in /usr. <del> # Returns true, also for older Xcode/OSX versions that had everything in /usr <del> # Beginning with Xcode 4.3, the dev tools are no longer installed <del> # in /usr and SDKs no longer in /Developer by default. <del> # But Apple provides an optional "Command Line Tools for Xcode" package. <del> not clt_version.empty? or dev_tools_path == Pathname.new("/usr/bin") <del> end <del> <del> def clt_version <del> # Version string (a pretty damn long one) of the CLT package. <del> # Note, that different ways to install the CLTs lead to different <del> # version numbers. <del> @clt_version ||= begin <del> # CLT installed via stand-alone website download <del> clt_pkginfo_stand_alone = `pkgutil --pkg-info com.apple.pkg.DeveloperToolsCLILeo 2>/dev/null`.strip <del> # CLT installed via preferences from within Xcode <del> clt_pkginfo_from_xcode = `pkgutil --pkg-info com.apple.pkg.DeveloperToolsCLI 2>/dev/null`.strip <del> if not clt_pkginfo_stand_alone.empty? <del> clt_pkginfo_stand_alone =~ /version: (.*)$/ <del> $1 <del> elsif not clt_pkginfo_from_xcode.empty? <del> clt_pkginfo_from_xcode =~ /version: (.*)$/ <del> $1 <del> else <del> # We return "" instead of nil because we want clt_installed? to be true on older Macs. <del> # So clt_version.empty? does not mean there are no unix tools in /usr, it just means <del> # that the "Command Line Tools for Xcode" package is not installed <del> "" # No CLT or recipe available to pkgutil. <del> end <del> end <del> end <del> <del> # Locate the "current Xcode folder" via xcode-select. See: <del> # man xcode-select <del> def xcode_folder <del> @xcode_folder ||= `xcode-select -print-path 2>/dev/null`.strip <del> end <del> <del> # Xcode 4.3 tools hang if "/" is set <del> def xctools_fucked? <del> xcode_folder == "/" <del> end <del> <del> def locate tool <del> # Don't call tools (cc, make, strip, etc.) directly! <del> # Give the name of the binary you look for as a string to this method <del> # in order to get the full path back as a Pathname. <del> tool = tool.to_s <del> <del> @locate_cache ||= {} <del> return @locate_cache[tool] if @locate_cache.has_key? tool <del> <del> if File.executable? "/usr/bin/#{tool}" <del> path = Pathname.new "/usr/bin/#{tool}" <del> else <del> # Xcrun was provided first with Xcode 4.3 and allows us to proxy <del> # tool usage thus avoiding various bugs. <del> p = `/usr/bin/xcrun -find #{tool} 2>/dev/null`.chomp unless MacOS.xctools_fucked? <del> if !p.nil? and !p.empty? and File.executable? p <del> path = Pathname.new p <del> else <del> # This is for the use-case where xcode-select is not set up correctly <del> # with Xcode 4.3+. The tools in Xcode 4.3+ are split over two locations, <del> # usually xcrun would figure that out for us, but it won't work if <del> # xcode-select is not configured properly. <del> p = "#{MacOS.dev_tools_path}/#{tool}" <del> if File.executable? p <del> path = Pathname.new p <del> else <del> # Otherwise lets look in the second location. <del> p = "#{MacOS.xctoolchain_path}/usr/bin/#{tool}" <del> if File.executable? p <del> path = Pathname.new p <del> else <del> # We digged so deep but all is lost now. <del> path = nil <del> end <del> end <del> end <del> end <del> @locate_cache[tool] = path <del> return path <del> end <del> <del> def dev_tools_path <del> @dev_tools_path ||= if File.exist? "/usr/bin/cc" and File.exist? "/usr/bin/make" <del> # probably a safe enough assumption (the unix way) <del> Pathname.new "/usr/bin" <del> elsif not xctools_fucked? and system "/usr/bin/xcrun -find make 1>/dev/null 2>&1" <del> # Wherever "make" is there are the dev tools. <del> Pathname.new(`/usr/bin/xcrun -find make`.chomp).dirname <del> elsif File.exist? "#{xcode_prefix}/usr/bin/make" <del> # cc stopped existing with Xcode 4.3, there are c89 and c99 options though <del> Pathname.new "#{xcode_prefix}/usr/bin" <del> else <del> # Since we are pretty unrelenting in finding Xcode no matter where <del> # it hides, we can now throw in the towel. <del> opoo "You really should consult the `brew doctor`!" <del> "" <del> end <del> end <del> <del> def xctoolchain_path <del> # Beginning with Xcode 4.3, clang and some other tools are located in a xctoolchain dir. <del> @xctoolchain_path ||= begin <del> path = Pathname.new("#{MacOS.xcode_prefix}/Toolchains/XcodeDefault.xctoolchain") <del> if path.exist? <del> path <del> else <del> # ok, there are no Toolchains in xcode_prefix <del> # and that's ok as long as everything is in dev_tools_path="/usr/bin" (i.e. clt_installed?) <del> nil <del> end <del> end <del> end <del> <del> def sdk_path(v=MacOS.version) <del> # The path of the MacOSX SDK. <del> if !MacOS.xctools_fucked? and File.executable? "#{xcode_folder}/usr/bin/make" <del> path = `#{locate('xcodebuild')} -version -sdk macosx#{v} Path 2>/dev/null`.strip <del> elsif File.directory? '/Developer/SDKs/MacOS#{v}.sdk' <del> # the old default (or wild wild west style) <del> path = "/Developer/SDKs/MacOS#{v}.sdk" <del> elsif File.directory? "#{xcode_prefix}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX#{v}.sdk" <del> # xcode_prefix is pretty smart, so lets look inside to find the sdk <del> path = "#{xcode_prefix}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX#{v}.sdk" <del> end <del> if path.nil? or path.empty? or not File.directory? path <del> nil <del> else <del> Pathname.new path <del> end <del> end <del> <del> def default_cc <del> cc = locate 'cc' <del> Pathname.new(cc).realpath.basename.to_s rescue nil <del> end <del> <del> def default_compiler <del> case default_cc <del> when /^gcc/ then :gcc <del> when /^llvm/ then :llvm <del> when "clang" then :clang <del> else <del> # guess :( <del> if xcode_version >= "4.3" <del> :clang <del> elsif xcode_version >= "4.2" <del> :llvm <del> else <del> :gcc <del> end <del> end <del> end <del> <del> def gcc_42_build_version <del> @gcc_42_build_version ||= if File.exist? "#{dev_tools_path}/gcc-4.2" \ <del> and not Pathname.new("#{dev_tools_path}/gcc-4.2").realpath.basename.to_s =~ /^llvm/ <del> `#{dev_tools_path}/gcc-4.2 --version` =~ /build (\d{4,})/ <del> $1.to_i <del> end <del> end <del> <del> def gcc_40_build_version <del> @gcc_40_build_version ||= if File.exist? "#{dev_tools_path}/gcc-4.0" <del> `#{dev_tools_path}/gcc-4.0 --version` =~ /build (\d{4,})/ <del> $1.to_i <del> end <del> end <del> <del> def xcode_prefix <del> @xcode_prefix ||= begin <del> path = Pathname.new xcode_folder <del> if $?.success? and path.absolute? and File.executable? "#{path}/usr/bin/make" <del> path <del> elsif File.executable? '/Developer/usr/bin/make' <del> # we do this to support cowboys who insist on installing <del> # only a subset of Xcode <del> Pathname.new '/Developer' <del> elsif File.executable? '/Applications/Xcode.app/Contents/Developer/usr/bin/make' <del> # fallback for broken Xcode 4.3 installs <del> Pathname.new '/Applications/Xcode.app/Contents/Developer' <del> else <del> # Ask Spotlight where Xcode is. If the user didn't install the <del> # helper tools and installed Xcode in a non-conventional place, this <del> # is our only option. See: http://superuser.com/questions/390757 <del> path = `mdfind "kMDItemCFBundleIdentifier == 'com.apple.dt.Xcode'"`.strip <del> if path.empty? <del> # Xcode 3 had a different identifier <del> path = `mdfind "kMDItemCFBundleIdentifier == 'com.apple.Xcode'"`.strip <del> end <del> path = "#{path}/Contents/Developer" <del> if !path.empty? and File.executable? "#{path}/usr/bin/make" <del> Pathname.new path <del> else <del> nil <del> end <del> end <del> end <del> end <del> <del> def xcode_installed? <del> # Telling us whether the Xcode.app is installed or not. <del> @xcode_installed ||= begin <del> if File.directory? '/Applications/Xcode.app' <del> true <del> elsif File.directory? '/Developer/Applications/Xcode.app' # old style <del> true <del> elsif not `mdfind "kMDItemCFBundleIdentifier == 'com.apple.dt.Xcode'"`.strip.empty? <del> # Xcode 4 <del> true <del> elsif not `mdfind "kMDItemCFBundleIdentifier == 'com.apple.Xcode'"`.strip.empty? <del> # Xcode 3 <del> true <del> else <del> false <del> end <del> end <del> end <del> <del> def xcode_version <del> # may return a version string <del> # that is guessed based on the compiler, so do not <del> # use it in order to check if Xcode is installed. <del> @xcode_version ||= begin <del> return "0" unless MACOS <del> <del> # this shortcut makes xcode_version work for people who don't realise you <del> # need to install the CLI tools <del> xcode43build = "/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild" <del> if File.file? xcode43build <del> `#{xcode43build} -version 2>/dev/null` =~ /Xcode (\d(\.\d)*)/ <del> return $1 if $1 <del> end <del> <del> # Xcode 4.3 xc* tools hang indefinately if xcode-select path is set thus <del> raise if xctools_fucked? <del> <del> raise unless which "xcodebuild" <del> `xcodebuild -version 2>/dev/null` =~ /Xcode (\d(\.\d)*)/ <del> raise if $1.nil? or not $?.success? <del> $1 <del> rescue <del> # For people who's xcode-select is unset, or who have installed <del> # xcode-gcc-installer or whatever other combinations we can try and <del> # supprt. See https://github.com/mxcl/homebrew/wiki/Xcode <del> case llvm_build_version.to_i <del> when 1..2063 then "3.1.0" <del> when 2064..2065 then "3.1.4" <del> when 2366..2325 <del> # we have no data for this range so we are guessing <del> "3.2.0" <del> when 2326 <del> # also applies to "3.2.3" <del> "3.2.4" <del> when 2327..2333 then "3.2.5" <del> when 2335 <del> # this build number applies to 3.2.6, 4.0 and 4.1 <del> # https://github.com/mxcl/homebrew/wiki/Xcode <del> "4.0" <del> else <del> case (clang_version.to_f * 10).to_i <del> when 0 <del> "dunno" <del> when 1..14 <del> "3.2.2" <del> when 15 <del> "3.2.4" <del> when 16 <del> "3.2.5" <del> when 17..20 <del> "4.0" <del> when 21 <del> "4.1" <del> when 22..30 <del> "4.2" <del> when 31 <del> "4.3" <del> else <del> "4.3" <del> end <del> end <del> end <del> end <del> <del> def llvm_build_version <del> # for Xcode 3 on OS X 10.5 this will not exist <del> # NOTE may not be true anymore but we can't test <del> @llvm_build_version ||= if locate("llvm-gcc") <del> `#{locate("llvm-gcc")} --version` =~ /LLVM build (\d{4,})/ <del> $1.to_i <del> end <del> end <del> <del> def clang_version <del> @clang_version ||= if locate("clang") <del> `#{locate("clang")} --version` =~ /clang version (\d\.\d)/ <del> $1 <del> end <del> end <del> <del> def clang_build_version <del> @clang_build_version ||= if locate("clang") <del> `#{locate("clang")} --version` =~ %r[tags/Apple/clang-(\d{2,})] <del> $1.to_i <del> end <del> end <del> <del> def x11_installed? <del> # Even if only Xcode (without CLT) is installed, this dylib is there. <del> Pathname.new('/usr/X11/lib/libpng.dylib').exist? <del> end <del> <del> def macports_or_fink_installed? <del> # See these issues for some history: <del> # http://github.com/mxcl/homebrew/issues/#issue/13 <del> # http://github.com/mxcl/homebrew/issues/#issue/41 <del> # http://github.com/mxcl/homebrew/issues/#issue/48 <del> return false unless MACOS <del> <del> %w[port fink].each do |ponk| <del> path = which(ponk) <del> return ponk unless path.nil? <del> end <del> <del> # we do the above check because macports can be relocated and fink may be <del> # able to be relocated in the future. This following check is because if <del> # fink and macports are not in the PATH but are still installed it can <del> # *still* break the build -- because some build scripts hardcode these paths: <del> %w[/sw/bin/fink /opt/local/bin/port].each do |ponk| <del> return ponk if File.exist? ponk <del> end <del> <del> # finally, sometimes people make their MacPorts or Fink read-only so they <del> # can quickly test Homebrew out, but still in theory obey the README's <del> # advise to rename the root directory. This doesn't work, many build scripts <del> # error out when they try to read from these now unreadable directories. <del> %w[/sw /opt/local].each do |path| <del> path = Pathname.new(path) <del> return path if path.exist? and not path.readable? <del> end <del> <del> false <del> end <del> <del> def leopard? <del> 10.5 == MACOS_VERSION <del> end <del> <del> def snow_leopard? <del> 10.6 <= MACOS_VERSION # Actually Snow Leopard or newer <del> end <del> <del> def lion? <del> 10.7 <= MACOS_VERSION # Actually Lion or newer <del> end <del> <del> def mountain_lion? <del> 10.8 <= MACOS_VERSION # Actually Mountain Lion or newer <del> end <del> <del> def prefer_64_bit? <del> Hardware.is_64_bit? and not leopard? <del> end <del> <del> StandardCompilers = { <del> "3.1.4" => {:gcc_40_build_version=>5493, :gcc_42_build_version=>5577}, <del> "3.2.6" => {:gcc_40_build_version=>5494, :gcc_42_build_version=>5666, :llvm_build_version=>2335, :clang_version=>"1.7", :clang_build_version=>77}, <del> "4.0" => {:gcc_40_build_version=>5494, :gcc_42_build_version=>5666, :llvm_build_version=>2335, :clang_version=>"2.0", :clang_build_version=>137}, <del> "4.0.1" => {:gcc_40_build_version=>5494, :gcc_42_build_version=>5666, :llvm_build_version=>2335, :clang_version=>"2.0", :clang_build_version=>137}, <del> "4.0.2" => {:gcc_40_build_version=>5494, :gcc_42_build_version=>5666, :llvm_build_version=>2335, :clang_version=>"2.0", :clang_build_version=>137}, <del> "4.2" => {:llvm_build_version=>2336, :clang_version=>"3.0", :clang_build_version=>211}, <del> "4.3" => {:llvm_build_version=>2336, :clang_version=>"3.1", :clang_build_version=>318}, <del> "4.3.1" => {:llvm_build_version=>2336, :clang_version=>"3.1", :clang_build_version=>318}, <del> "4.3.2" => {:llvm_build_version=>2336, :clang_version=>"3.1", :clang_build_version=>318}, <del> "4.3.3" => {:llvm_build_version=>2336, :clang_version=>"3.1", :clang_build_version=>318} <del> } <del> <del> def compilers_standard? <del> xcode = MacOS.xcode_version <del> # Assume compilers are okay if Xcode version not in hash <del> return true unless StandardCompilers.keys.include? xcode <del> <del> StandardCompilers[xcode].all? {|k,v| MacOS.send(k) == v} <del> end <del>end <del> <ide> module GitHub extend self <ide> def issues_for_formula name <ide> # bit basic as depends on the issue at github having the exact name of the
2
Python
Python
create dataparallel model if several gpus
5f432480c0f9f89e56fec9bf428108637b600f98
<ide><path>extract_features_pytorch.py <ide> def main(): <ide> if args.init_checkpoint is not None: <ide> model.load_state_dict(torch.load(args.init_checkpoint, map_location='cpu')) <ide> model.to(device) <add> <add> if n_gpu > 1: <add> model = nn.DataParallel(model) <ide> <ide> all_input_ids = torch.tensor([f.input_ids for f in features], dtype=torch.long) <ide> all_input_mask = torch.tensor([f.input_mask for f in features], dtype=torch.long) <ide><path>run_classifier_pytorch.py <ide> def main(): <ide> if args.init_checkpoint is not None: <ide> model.bert.load_state_dict(torch.load(args.init_checkpoint, map_location='cpu')) <ide> model.to(device) <add> <add> if n_gpu > 1: <add> model = torch.nn.DataParallel(model) <ide> <ide> optimizer = BERTAdam([{'params': [p for n, p in model.named_parameters() if n != 'bias'], 'l2': 0.01}, <ide> {'params': [p for n, p in model.named_parameters() if n == 'bias'], 'l2': 0.} <ide><path>run_squad_pytorch.py <ide> def main(): <ide> if args.init_checkpoint is not None: <ide> model.bert.load_state_dict(torch.load(args.init_checkpoint, map_location='cpu')) <ide> model.to(device) <add> <add> if n_gpu > 1: <add> model = torch.nn.DataParallel(model) <ide> <ide> optimizer = BERTAdam([{'params': [p for n, p in model.named_parameters() if n != 'bias'], 'l2': 0.01}, <ide> {'params': [p for n, p in model.named_parameters() if n == 'bias'], 'l2': 0.}
3
Javascript
Javascript
use strict assertions in module loader test
443e218544b82c02643a97666b505ffb0f18751f
<ide><path>test/sequential/test-module-loading.js <ide> var fs = require('fs'); <ide> console.error('load test-module-loading.js'); <ide> <ide> // assert that this is the main module. <del>assert.equal(require.main.id, '.', 'main module should have id of \'.\''); <del>assert.equal(require.main, module, 'require.main should === module'); <del>assert.equal(process.mainModule, module, <del> 'process.mainModule should === module'); <add>assert.strictEqual(require.main.id, '.', 'main module should have id of \'.\''); <add>assert.strictEqual(require.main, module, 'require.main should === module'); <add>assert.strictEqual(process.mainModule, module, <add> 'process.mainModule should === module'); <ide> // assert that it's *not* the main module in the required module. <ide> require('../fixtures/not-main-module.js'); <ide> <ide> // require a file with a request that includes the extension <ide> var a_js = require('../fixtures/a.js'); <del>assert.equal(42, a_js.number); <add>assert.strictEqual(42, a_js.number); <ide> <ide> // require a file without any extensions <ide> var foo_no_ext = require('../fixtures/foo'); <del>assert.equal('ok', foo_no_ext.foo); <add>assert.strictEqual('ok', foo_no_ext.foo); <ide> <ide> var a = require('../fixtures/a'); <ide> var c = require('../fixtures/b/c'); <ide> var d3 = require(path.join(__dirname, '../fixtures/b/d')); <ide> // Relative <ide> var d4 = require('../fixtures/b/d'); <ide> <del>assert.equal(false, false, 'testing the test program.'); <add>assert.strictEqual(false, false, 'testing the test program.'); <ide> <ide> assert.ok(a.A instanceof Function); <del>assert.equal('A', a.A()); <add>assert.strictEqual('A', a.A()); <ide> <ide> assert.ok(a.C instanceof Function); <del>assert.equal('C', a.C()); <add>assert.strictEqual('C', a.C()); <ide> <ide> assert.ok(a.D instanceof Function); <del>assert.equal('D', a.D()); <add>assert.strictEqual('D', a.D()); <ide> <ide> assert.ok(d.D instanceof Function); <del>assert.equal('D', d.D()); <add>assert.strictEqual('D', d.D()); <ide> <ide> assert.ok(d2.D instanceof Function); <del>assert.equal('D', d2.D()); <add>assert.strictEqual('D', d2.D()); <ide> <ide> assert.ok(d3.D instanceof Function); <del>assert.equal('D', d3.D()); <add>assert.strictEqual('D', d3.D()); <ide> <ide> assert.ok(d4.D instanceof Function); <del>assert.equal('D', d4.D()); <add>assert.strictEqual('D', d4.D()); <ide> <ide> assert.ok((new a.SomeClass()) instanceof c.SomeClass); <ide> <ide> console.error('test index.js modules ids and relative loading'); <ide> const one = require('../fixtures/nested-index/one'); <ide> const two = require('../fixtures/nested-index/two'); <del>assert.notEqual(one.hello, two.hello); <add>assert.notStrictEqual(one.hello, two.hello); <ide> <ide> console.error('test index.js in a folder with a trailing slash'); <ide> const three = require('../fixtures/nested-index/three'); <ide> const threeFolder = require('../fixtures/nested-index/three/'); <ide> const threeIndex = require('../fixtures/nested-index/three/index.js'); <del>assert.equal(threeFolder, threeIndex); <del>assert.notEqual(threeFolder, three); <add>assert.strictEqual(threeFolder, threeIndex); <add>assert.notStrictEqual(threeFolder, three); <ide> <ide> console.error('test package.json require() loading'); <del>assert.equal(require('../fixtures/packages/index').ok, 'ok', <del> 'Failed loading package'); <del>assert.equal(require('../fixtures/packages/main').ok, 'ok', <del> 'Failed loading package'); <del>assert.equal(require('../fixtures/packages/main-index').ok, 'ok', <del> 'Failed loading package with index.js in main subdir'); <add>assert.strictEqual(require('../fixtures/packages/index').ok, 'ok', <add> 'Failed loading package'); <add>assert.strictEqual(require('../fixtures/packages/main').ok, 'ok', <add> 'Failed loading package'); <add>assert.strictEqual(require('../fixtures/packages/main-index').ok, 'ok', <add> 'Failed loading package with index.js in main subdir'); <ide> <ide> console.error('test cycles containing a .. path'); <ide> const root = require('../fixtures/cycles/root'); <ide> const foo = require('../fixtures/cycles/folder/foo'); <del>assert.equal(root.foo, foo); <del>assert.equal(root.sayHello(), root.hello); <add>assert.strictEqual(root.foo, foo); <add>assert.strictEqual(root.sayHello(), root.hello); <ide> <ide> console.error('test node_modules folders'); <ide> // asserts are in the fixtures files themselves, <ide> try { <ide> require('../fixtures/throws_error'); <ide> } catch (e) { <ide> errorThrown = true; <del> assert.equal('blah', e.message); <add> assert.strictEqual('blah', e.message); <ide> } <ide> <del>assert.equal(require('path').dirname(__filename), __dirname); <add>assert.strictEqual(require('path').dirname(__filename), __dirname); <ide> <ide> console.error('load custom file types with extensions'); <ide> require.extensions['.test'] = function(module, filename) { <ide> var content = fs.readFileSync(filename).toString(); <del> assert.equal('this is custom source\n', content); <add> assert.strictEqual('this is custom source\n', content); <ide> content = content.replace('this is custom source', <ide> 'exports.test = \'passed\''); <ide> module._compile(content, filename); <ide> }; <ide> <del>assert.equal(require('../fixtures/registerExt').test, 'passed'); <add>assert.strictEqual(require('../fixtures/registerExt').test, 'passed'); <ide> // unknown extension, load as .js <del>assert.equal(require('../fixtures/registerExt.hello.world').test, 'passed'); <add>assert.strictEqual(require('../fixtures/registerExt.hello.world').test, <add> 'passed'); <ide> <ide> console.error('load custom file types that return non-strings'); <ide> require.extensions['.test'] = function(module, filename) { <ide> require.extensions['.test'] = function(module, filename) { <ide> }; <ide> }; <ide> <del>assert.equal(require('../fixtures/registerExt2').custom, 'passed'); <add>assert.strictEqual(require('../fixtures/registerExt2').custom, 'passed'); <ide> <del>assert.equal(require('../fixtures/foo').foo, 'ok', <del> 'require module with no extension'); <add>assert.strictEqual(require('../fixtures/foo').foo, 'ok', <add> 'require module with no extension'); <ide> <ide> // Should not attempt to load a directory <ide> try { <ide> require('../fixtures/empty'); <ide> } catch (err) { <del> assert.equal(err.message, 'Cannot find module \'../fixtures/empty\''); <add> assert.strictEqual(err.message, 'Cannot find module \'../fixtures/empty\''); <ide> } <ide> <ide> // Check load order is as expected <ide> const msg = 'Load order incorrect.'; <ide> require.extensions['.reg'] = require.extensions['.js']; <ide> require.extensions['.reg2'] = require.extensions['.js']; <ide> <del>assert.equal(require(loadOrder + 'file1').file1, 'file1', msg); <del>assert.equal(require(loadOrder + 'file2').file2, 'file2.js', msg); <add>assert.strictEqual(require(loadOrder + 'file1').file1, 'file1', msg); <add>assert.strictEqual(require(loadOrder + 'file2').file2, 'file2.js', msg); <ide> try { <ide> require(loadOrder + 'file3'); <ide> } catch (e) { <ide> // Not a real .node module, but we know we require'd the right thing. <ide> assert.ok(e.message.replace(/\\/g, '/').match(/file3\.node/)); <ide> } <del>assert.equal(require(loadOrder + 'file4').file4, 'file4.reg', msg); <del>assert.equal(require(loadOrder + 'file5').file5, 'file5.reg2', msg); <del>assert.equal(require(loadOrder + 'file6').file6, 'file6/index.js', msg); <add>assert.strictEqual(require(loadOrder + 'file4').file4, 'file4.reg', msg); <add>assert.strictEqual(require(loadOrder + 'file5').file5, 'file5.reg2', msg); <add>assert.strictEqual(require(loadOrder + 'file6').file6, 'file6/index.js', msg); <ide> try { <ide> require(loadOrder + 'file7'); <ide> } catch (e) { <ide> assert.ok(e.message.replace(/\\/g, '/').match(/file7\/index\.node/)); <ide> } <del>assert.equal(require(loadOrder + 'file8').file8, 'file8/index.reg', msg); <del>assert.equal(require(loadOrder + 'file9').file9, 'file9/index.reg2', msg); <add>assert.strictEqual(require(loadOrder + 'file8').file8, 'file8/index.reg', msg); <add>assert.strictEqual(require(loadOrder + 'file9').file9, 'file9/index.reg2', msg); <ide> <ide> <ide> // make sure that module.require() is the same as <ide> // doing require() inside of that module. <ide> var parent = require('../fixtures/module-require/parent/'); <ide> var child = require('../fixtures/module-require/child/'); <del>assert.equal(child.loaded, parent.loaded); <add>assert.strictEqual(child.loaded, parent.loaded); <ide> <ide> <ide> // #1357 Loading JSON files with require() <ide> assert.throws(function() { <ide> <ide> process.on('exit', function() { <ide> assert.ok(a.A instanceof Function); <del> assert.equal('A done', a.A()); <add> assert.strictEqual('A done', a.A()); <ide> <ide> assert.ok(a.C instanceof Function); <del> assert.equal('C done', a.C()); <add> assert.strictEqual('C done', a.C()); <ide> <ide> assert.ok(a.D instanceof Function); <del> assert.equal('D done', a.D()); <add> assert.strictEqual('D done', a.D()); <ide> <ide> assert.ok(d.D instanceof Function); <del> assert.equal('D done', d.D()); <add> assert.strictEqual('D done', d.D()); <ide> <ide> assert.ok(d2.D instanceof Function); <del> assert.equal('D done', d2.D()); <add> assert.strictEqual('D done', d2.D()); <ide> <del> assert.equal(true, errorThrown); <add> assert.strictEqual(true, errorThrown); <ide> <ide> console.log('exit'); <ide> }); <ide> <ide> <ide> // #1440 Loading files with a byte order marker. <del>assert.equal(42, require('../fixtures/utf8-bom.js')); <del>assert.equal(42, require('../fixtures/utf8-bom.json')); <add>assert.strictEqual(42, require('../fixtures/utf8-bom.js')); <add>assert.strictEqual(42, require('../fixtures/utf8-bom.json')); <ide> <ide> // Error on the first line of a module should <ide> // have the correct line number
1
Javascript
Javascript
raise error when null bytes detected in paths
33fa7405778444ca66470ab0729e6fa9fe43d2a6
<ide><path>lib/fs.js <ide> function assertEncoding(encoding) { <ide> } <ide> } <ide> <add>function nullCheck(path, callback) { <add> if (('' + path).indexOf('\u0000') !== -1) { <add> var er = new Error('Path must be a string without null bytes.'); <add> if (!callback) <add> throw er; <add> process.nextTick(function() { <add> callback(er); <add> }); <add> return false; <add> } <add> return true; <add>} <ide> <ide> fs.Stats = binding.Stats; <ide> <ide> fs.Stats.prototype.isSocket = function() { <ide> }; <ide> <ide> fs.exists = function(path, callback) { <del> binding.stat(pathModule._makeLong(path), function(err, stats) { <add> if (!nullCheck(path, cb)) return; <add> binding.stat(pathModule._makeLong(path), cb); <add> function cb(err, stats) { <ide> if (callback) callback(err ? false : true); <del> }); <add> } <ide> }; <ide> <ide> fs.existsSync = function(path) { <ide> try { <add> nullCheck(path); <ide> binding.stat(pathModule._makeLong(path)); <ide> return true; <ide> } catch (e) { <ide> fs.open = function(path, flags, mode, callback) { <ide> callback = makeCallback(arguments[arguments.length - 1]); <ide> mode = modeNum(mode, 438 /*=0666*/); <ide> <add> if (!nullCheck(path, callback)) return; <ide> binding.open(pathModule._makeLong(path), <ide> stringToFlags(flags), <ide> mode, <ide> fs.open = function(path, flags, mode, callback) { <ide> <ide> fs.openSync = function(path, flags, mode) { <ide> mode = modeNum(mode, 438 /*=0666*/); <add> nullCheck(path); <ide> return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode); <ide> }; <ide> <ide> fs.writeSync = function(fd, buffer, offset, length, position) { <ide> }; <ide> <ide> fs.rename = function(oldPath, newPath, callback) { <add> callback = makeCallback(callback); <add> if (!nullCheck(oldPath, callback)) return; <add> if (!nullCheck(newPath, callback)) return; <ide> binding.rename(pathModule._makeLong(oldPath), <ide> pathModule._makeLong(newPath), <del> makeCallback(callback)); <add> callback); <ide> }; <ide> <ide> fs.renameSync = function(oldPath, newPath) { <add> nullCheck(oldPath); <add> nullCheck(newPath); <ide> return binding.rename(pathModule._makeLong(oldPath), <ide> pathModule._makeLong(newPath)); <ide> }; <ide> fs.ftruncateSync = function(fd, len) { <ide> }; <ide> <ide> fs.rmdir = function(path, callback) { <del> binding.rmdir(pathModule._makeLong(path), makeCallback(callback)); <add> callback = makeCallback(callback); <add> if (!nullCheck(path, callback)) return; <add> binding.rmdir(pathModule._makeLong(path), callback); <ide> }; <ide> <ide> fs.rmdirSync = function(path) { <add> nullCheck(path); <ide> return binding.rmdir(pathModule._makeLong(path)); <ide> }; <ide> <ide> fs.fsyncSync = function(fd) { <ide> <ide> fs.mkdir = function(path, mode, callback) { <ide> if (typeof mode === 'function') callback = mode; <add> callback = makeCallback(callback); <add> if (!nullCheck(path, callback)) return; <ide> binding.mkdir(pathModule._makeLong(path), <ide> modeNum(mode, 511 /*=0777*/), <del> makeCallback(callback)); <add> callback); <ide> }; <ide> <ide> fs.mkdirSync = function(path, mode) { <add> nullCheck(path); <ide> return binding.mkdir(pathModule._makeLong(path), <ide> modeNum(mode, 511 /*=0777*/)); <ide> }; <ide> fs.sendfileSync = function(outFd, inFd, inOffset, length) { <ide> }; <ide> <ide> fs.readdir = function(path, callback) { <del> binding.readdir(pathModule._makeLong(path), makeCallback(callback)); <add> callback = makeCallback(callback); <add> if (!nullCheck(path, callback)) return; <add> binding.readdir(pathModule._makeLong(path), callback); <ide> }; <ide> <ide> fs.readdirSync = function(path) { <add> nullCheck(path); <ide> return binding.readdir(pathModule._makeLong(path)); <ide> }; <ide> <ide> fs.fstat = function(fd, callback) { <ide> }; <ide> <ide> fs.lstat = function(path, callback) { <del> binding.lstat(pathModule._makeLong(path), makeCallback(callback)); <add> callback = makeCallback(callback); <add> if (!nullCheck(path, callback)) return; <add> binding.lstat(pathModule._makeLong(path), callback); <ide> }; <ide> <ide> fs.stat = function(path, callback) { <del> binding.stat(pathModule._makeLong(path), makeCallback(callback)); <add> callback = makeCallback(callback); <add> if (!nullCheck(path, callback)) return; <add> binding.stat(pathModule._makeLong(path), callback); <ide> }; <ide> <ide> fs.fstatSync = function(fd) { <ide> return binding.fstat(fd); <ide> }; <ide> <ide> fs.lstatSync = function(path) { <add> nullCheck(path); <ide> return binding.lstat(pathModule._makeLong(path)); <ide> }; <ide> <ide> fs.statSync = function(path) { <add> nullCheck(path); <ide> return binding.stat(pathModule._makeLong(path)); <ide> }; <ide> <ide> fs.readlink = function(path, callback) { <del> binding.readlink(pathModule._makeLong(path), makeCallback(callback)); <add> callback = makeCallback(callback); <add> if (!nullCheck(path, callback)) return; <add> binding.readlink(pathModule._makeLong(path), callback); <ide> }; <ide> <ide> fs.readlinkSync = function(path) { <add> nullCheck(path); <ide> return binding.readlink(pathModule._makeLong(path)); <ide> }; <ide> <ide> fs.symlink = function(destination, path, type_, callback) { <ide> var type = (typeof type_ === 'string' ? type_ : null); <ide> var callback = makeCallback(arguments[arguments.length - 1]); <ide> <add> if (!nullCheck(destination, callback)) return; <add> if (!nullCheck(path, callback)) return; <add> <ide> binding.symlink(preprocessSymlinkDestination(destination, type), <ide> pathModule._makeLong(path), <ide> type, <ide> fs.symlink = function(destination, path, type_, callback) { <ide> fs.symlinkSync = function(destination, path, type) { <ide> type = (typeof type === 'string' ? type : null); <ide> <add> nullCheck(destination); <add> nullCheck(path); <add> <ide> return binding.symlink(preprocessSymlinkDestination(destination, type), <ide> pathModule._makeLong(path), <ide> type); <ide> }; <ide> <ide> fs.link = function(srcpath, dstpath, callback) { <add> callback = makeCallback(callback); <add> if (!nullCheck(srcpath, callback)) return; <add> if (!nullCheck(dstpath, callback)) return; <add> <ide> binding.link(pathModule._makeLong(srcpath), <ide> pathModule._makeLong(dstpath), <del> makeCallback(callback)); <add> callback); <ide> }; <ide> <ide> fs.linkSync = function(srcpath, dstpath) { <add> nullCheck(srcpath); <add> nullCheck(dstpath); <ide> return binding.link(pathModule._makeLong(srcpath), <ide> pathModule._makeLong(dstpath)); <ide> }; <ide> <ide> fs.unlink = function(path, callback) { <del> binding.unlink(pathModule._makeLong(path), makeCallback(callback)); <add> callback = makeCallback(callback); <add> if (!nullCheck(path, callback)) return; <add> binding.unlink(pathModule._makeLong(path), callback); <ide> }; <ide> <ide> fs.unlinkSync = function(path) { <add> nullCheck(path); <ide> return binding.unlink(pathModule._makeLong(path)); <ide> }; <ide> <ide> if (constants.hasOwnProperty('O_SYMLINK')) { <ide> <ide> <ide> fs.chmod = function(path, mode, callback) { <add> callback = makeCallback(callback); <add> if (!nullCheck(path, callback)) return; <ide> binding.chmod(pathModule._makeLong(path), <ide> modeNum(mode), <del> makeCallback(callback)); <add> callback); <ide> }; <ide> <ide> fs.chmodSync = function(path, mode) { <add> nullCheck(path); <ide> return binding.chmod(pathModule._makeLong(path), modeNum(mode)); <ide> }; <ide> <ide> fs.fchownSync = function(fd, uid, gid) { <ide> }; <ide> <ide> fs.chown = function(path, uid, gid, callback) { <del> binding.chown(pathModule._makeLong(path), uid, gid, makeCallback(callback)); <add> callback = makeCallback(callback); <add> if (!nullCheck(path, callback)) return; <add> binding.chown(pathModule._makeLong(path), uid, gid, callback); <ide> }; <ide> <ide> fs.chownSync = function(path, uid, gid) { <add> nullCheck(path); <ide> return binding.chown(pathModule._makeLong(path), uid, gid); <ide> }; <ide> <ide> function toUnixTimestamp(time) { <ide> fs._toUnixTimestamp = toUnixTimestamp; <ide> <ide> fs.utimes = function(path, atime, mtime, callback) { <add> callback = makeCallback(callback); <add> if (!nullCheck(path, callback)) return; <ide> binding.utimes(pathModule._makeLong(path), <ide> toUnixTimestamp(atime), <ide> toUnixTimestamp(mtime), <del> makeCallback(callback)); <add> callback); <ide> }; <ide> <ide> fs.utimesSync = function(path, atime, mtime) { <add> nullCheck(path); <ide> atime = toUnixTimestamp(atime); <ide> mtime = toUnixTimestamp(mtime); <ide> binding.utimes(pathModule._makeLong(path), atime, mtime); <ide> function FSWatcher() { <ide> util.inherits(FSWatcher, EventEmitter); <ide> <ide> FSWatcher.prototype.start = function(filename, persistent) { <add> nullCheck(filename); <ide> var r = this._handle.start(pathModule._makeLong(filename), persistent); <ide> <ide> if (r) { <ide> FSWatcher.prototype.close = function() { <ide> }; <ide> <ide> fs.watch = function(filename) { <add> nullCheck(filename); <ide> var watcher; <ide> var options; <ide> var listener; <ide> util.inherits(StatWatcher, EventEmitter); <ide> <ide> <ide> StatWatcher.prototype.start = function(filename, persistent, interval) { <add> nullCheck(filename); <ide> this._handle.start(pathModule._makeLong(filename), persistent, interval); <ide> }; <ide> <ide> function inStatWatchers(filename) { <ide> <ide> <ide> fs.watchFile = function(filename) { <add> nullCheck(filename); <ide> var stat; <ide> var listener; <ide> <ide> fs.watchFile = function(filename) { <ide> }; <ide> <ide> fs.unwatchFile = function(filename, listener) { <add> nullCheck(filename); <ide> if (!inStatWatchers(filename)) return; <ide> <ide> var stat = statWatchers[filename]; <ide><path>test/simple/test-fs-null-bytes.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 common = require('../common'); <add>var assert = require('assert'); <add>var fs = require('fs'); <add> <add>function check(async, sync) { <add> var expected = /Path must be a string without null bytes./; <add> var argsSync = Array.prototype.slice.call(arguments, 2); <add> var argsAsync = argsSync.concat(function(er) { <add> assert(er && er.message.match(expected)); <add> }); <add> <add> if (sync) <add> assert.throws(function() { <add> console.error(sync.name, argsSync); <add> sync.apply(null, argsSync); <add> }, expected); <add> <add> if (async) <add> async.apply(null, argsAsync); <add>} <add> <add>check(fs.appendFile, fs.appendFileSync, 'foo\u0000bar'); <add>check(fs.chmod, fs.chmodSync, 'foo\u0000bar', '0644'); <add>check(fs.chown, fs.chownSync, 'foo\u0000bar', 12, 34); <add>check(fs.link, fs.linkSync, 'foo\u0000bar', 'foobar'); <add>check(fs.link, fs.linkSync, 'foobar', 'foo\u0000bar'); <add>check(fs.lstat, fs.lstatSync, 'foo\u0000bar'); <add>check(fs.mkdir, fs.mkdirSync, 'foo\u0000bar', '0755'); <add>check(fs.open, fs.openSync, 'foo\u0000bar', 'r'); <add>check(fs.readFile, fs.readFileSync, 'foo\u0000bar'); <add>check(fs.readdir, fs.readdirSync, 'foo\u0000bar'); <add>check(fs.readlink, fs.readlinkSync, 'foo\u0000bar'); <add>check(fs.realpath, fs.realpathSync, 'foo\u0000bar'); <add>check(fs.rename, fs.renameSync, 'foo\u0000bar', 'foobar'); <add>check(fs.rename, fs.renameSync, 'foobar', 'foo\u0000bar'); <add>check(fs.rmdir, fs.rmdirSync, 'foo\u0000bar'); <add>check(fs.stat, fs.statSync, 'foo\u0000bar'); <add>check(fs.symlink, fs.symlinkSync, 'foo\u0000bar', 'foobar'); <add>check(fs.symlink, fs.symlinkSync, 'foobar', 'foo\u0000bar'); <add>check(fs.truncate, fs.truncateSync, 'foo\u0000bar'); <add>check(fs.unlink, fs.unlinkSync, 'foo\u0000bar'); <add>check(null, fs.unwatchFile, 'foo\u0000bar', assert.fail); <add>check(fs.utimes, fs.utimesSync, 'foo\u0000bar', 0, 0); <add>check(null, fs.watch, 'foo\u0000bar', assert.fail); <add>check(null, fs.watchFile, 'foo\u0000bar', assert.fail); <add>check(fs.writeFile, fs.writeFileSync, 'foo\u0000bar'); <add> <add>// an 'error' for exists means that it doesn't exist. <add>// one of many reasons why this file is the absolute worst. <add>fs.exists('foo\u0000bar', function(exists) { <add> assert(!exists); <add>}); <add>assert(!fs.existsSync('foo\u0000bar')); <add>
2
Mixed
Javascript
fix docs and add missed breaking change
15efbbdc1fe42f914e6442b32ffc032a4cc8e792
<ide><path>CHANGELOG.md <ide> Angular with <ide> [Unicode Technical Standard #35](http://unicode.org/reports/tr35/#Date_Format_Patterns) used by <ide> Closure, as well as, future DOM apis currently being proposed to w3c. <add>- `$xhr.error`'s `request` argument has no `callback` property anymore, use `success` instead <ide> <ide> <ide> <ide><path>src/service/xhr.error.js <ide> * - `method` – `{string}` – The http request method. <ide> * - `url` – `{string}` – The request destination. <ide> * - `data` – `{(string|Object)=} – An optional request body. <del> * - `callback` – `{function()}` – The callback function <add> * - `success` – `{function()}` – The success callback function <ide> * <ide> * @param {Object} response Response object. <ide> *
2
Javascript
Javascript
fix issue with metamorph replace
14d3f7920141600030c60d921c84f5385a28148b
<ide><path>packages/ember-handlebars/lib/views/metamorph_view.js <ide> var DOMManager = { <ide> view.transitionTo('preRender'); <ide> <ide> Ember.run.schedule('render', this, function() { <del> if (get(view, 'isDestroyed')) { return; } <add> if (view.isDestroying) { return; } <ide> <ide> view.clearRenderedChildren(); <ide> var buffer = view.renderToBuffer(); <ide><path>packages/ember-handlebars/tests/handlebars_test.js <ide> test("should update the block when object passed to #if helper changes and an in <ide> }); <ide> }); <ide> <add>test("edge case: child conditional should not render children if parent conditional becomes false", function() { <add> var childCreated = false; <add> <add> view = Ember.View.create({ <add> cond1: true, <add> cond2: false, <add> viewClass: Ember.View.extend({ <add> init: function() { <add> this._super(); <add> childCreated = true; <add> } <add> }), <add> template: Ember.Handlebars.compile('{{#if view.cond1}}{{#if view.cond2}}{{#view view.viewClass}}test{{/view}}{{/if}}{{/if}}') <add> }); <add> <add> appendView(); <add> <add> Ember.run(function() { <add> // The order of these sets is important for the test <add> view.set('cond2', true); <add> view.set('cond1', false); <add> }); <add> <add> ok(!childCreated, 'child should not be created'); <add>}); <add> <ide> // test("Should insert a localized string if the {{loc}} helper is used", function() { <ide> // Ember.stringsFor('en', { <ide> // 'Brazil': 'Brasilia'
2
Text
Text
fix typo in script component docs
ced204066198a695cc633d71358676fdc24c14b3
<ide><path>docs/basic-features/script.md <ide> npm run dev <ide> # ... <ide> ``` <ide> <del>Once setup is complete, defining `strategy="worker` will automatically instantiate Partytown in your application and off-load the script to a web worker. <add>Once setup is complete, defining `strategy="worker"` will automatically instantiate Partytown in your application and off-load the script to a web worker. <ide> <ide> ```jsx <ide> <Script src="https://example.com/analytics.js" strategy="worker" />
1
Ruby
Ruby
add xcode 4.5.1 to compiler map
736717cf24247df492dc6939f8279982c5ebcb4b
<ide><path>Library/Homebrew/macos.rb <ide> def prefer_64_bit? <ide> "4.3.3" => {:llvm_build_version=>2336, :clang_version=>"3.1", :clang_build_version=>318}, <ide> "4.4" => {:llvm_build_version=>2336, :clang_version=>"4.0", :clang_build_version=>421}, <ide> "4.4.1" => {:llvm_build_version=>2336, :clang_version=>"4.0", :clang_build_version=>421}, <del> "4.5" => {:llvm_build_version=>2336, :clang_version=>"4.1", :clang_build_version=>421} <add> "4.5" => {:llvm_build_version=>2336, :clang_version=>"4.1", :clang_build_version=>421}, <add> "4.5.1" => {:llvm_build_version=>2336, :clang_version=>"4.1", :clang_build_version=>421} <ide> } <ide> <ide> def compilers_standard?
1
PHP
PHP
ignore standards for php defined constants
e5ad204265055ca8170315201969ea19f9d8eea8
<ide><path>lib/Cake/Network/CakeSocket.php <ide> class CakeSocket { <ide> * @var array <ide> */ <ide> protected $_encryptMethods = array( <add> // @codingStandardsIgnoreStart <ide> 'sslv2_client' => STREAM_CRYPTO_METHOD_SSLv2_CLIENT, <ide> 'sslv3_client' => STREAM_CRYPTO_METHOD_SSLv3_CLIENT, <ide> 'sslv23_client' => STREAM_CRYPTO_METHOD_SSLv23_CLIENT, <ide> class CakeSocket { <ide> 'sslv3_server' => STREAM_CRYPTO_METHOD_SSLv3_SERVER, <ide> 'sslv23_server' => STREAM_CRYPTO_METHOD_SSLv23_SERVER, <ide> 'tls_server' => STREAM_CRYPTO_METHOD_TLS_SERVER <add> // @codingStandardsIgnoreEnd <ide> ); <ide> <ide> /**
1
Ruby
Ruby
avoid empty api pages
b653c29bbec572eb82c4b82ae89d26acfa15b519
<ide><path>actionpack/lib/abstract_controller/asset_paths.rb <ide> module AbstractController <del> module AssetPaths <add> module AssetPaths #:nodoc: <ide> extend ActiveSupport::Concern <ide> <ide> included do <ide><path>actionpack/lib/abstract_controller/base.rb <ide> require 'active_support/core_ext/module/anonymous' <ide> <ide> module AbstractController <del> class Error < StandardError; end <del> class ActionNotFound < StandardError; end <add> class Error < StandardError #:nodoc: <add> end <add> <add> class ActionNotFound < StandardError #:nodoc: <add> end <ide> <ide> # <tt>AbstractController::Base</tt> is a low-level API. Nobody should be <ide> # using it directly, and subclasses (like ActionController::Base) are <ide><path>actionpack/lib/abstract_controller/logger.rb <ide> require "active_support/benchmarkable" <ide> <ide> module AbstractController <del> module Logger <add> module Logger #:nodoc: <ide> extend ActiveSupport::Concern <ide> <ide> included do
3
PHP
PHP
update deprecation suggestions
41ee62533d61f1727b8b95c0a7528b867410c509
<ide><path>src/Http/ServerRequest.php <ide> public function __get($name) <ide> * @param string $name The property being accessed. <ide> * @return bool Existence <ide> * @deprecated 3.4.0 Accessing routing parameters through __isset will removed in 4.0.0. <del> * Use param() instead. <add> * Use getParam() instead. <ide> */ <ide> public function __isset($name) <ide> { <ide> public static function addDetector($name, $callable) <ide> <ide> /** <ide> * Add parameters to the request's parsed parameter set. This will overwrite any existing parameters. <del> * This modifies the parameters available through `$request->params`. <add> * This modifies the parameters available through `$request->getParam()`. <ide> * <ide> * @param array $params Array of parameters to merge in <ide> * @return $this The current object, you can chain this method. <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 withParam() or param() instead. <add> * @deprecated 3.4.0 The ArrayAccess methods will be removed in 4.0.0. Use withParam() instead. <ide> */ <ide> public function offsetSet($name, $value) <ide> { <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() or param() instead. <add> * @deprecated 3.4.0 The ArrayAccess methods will be removed in 4.0.0. Use getParam() 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 withParam() or param() instead. <add> * @deprecated 3.4.0 The ArrayAccess methods will be removed in 4.0.0. Use withParam() instead. <ide> */ <ide> public function offsetUnset($name) <ide> {
1
PHP
PHP
flush the application after each test
7602d93ce35e8f0baf9915ebc8be4d885ee0259e
<ide><path>src/Illuminate/Container/Container.php <ide> public function forgetInstances() <ide> $this->instances = array(); <ide> } <ide> <add> /** <add> * Flush the container of all bindings and resolved instances. <add> * <add> * @return void <add> */ <add> public function flush() <add> { <add> $this->aliases = []; <add> $this->resolved = []; <add> $this->bindings = []; <add> $this->instances = []; <add> } <add> <ide> /** <ide> * Determine if a given offset exists. <ide> * <ide><path>src/Illuminate/Foundation/Application.php <ide> public function registerCoreContainerAliases() <ide> } <ide> } <ide> <add> /** <add> * Flush the container of all bindings and resolved instances. <add> * <add> * @return void <add> */ <add> public function flush() <add> { <add> parent::flush(); <add> <add> $this->loadedProviders = []; <add> } <add> <ide> /** <ide> * Dynamically access application services. <ide> * <ide><path>src/Illuminate/Foundation/Testing/TestCase.php <ide> abstract class TestCase extends \PHPUnit_Framework_TestCase { <ide> <ide> use ApplicationTrait, AssertionsTrait; <ide> <add> /** <add> * Creates the application. <add> * <add> * Needs to be implemented by subclasses. <add> * <add> * @return \Symfony\Component\HttpKernel\HttpKernelInterface <add> */ <add> abstract public function createApplication(); <add> <ide> /** <ide> * Setup the test environment. <ide> * <ide> public function setUp() <ide> } <ide> <ide> /** <del> * Creates the application. <del> * <del> * Needs to be implemented by subclasses. <add> * Clean up the testing environment before the next test. <ide> * <del> * @return \Symfony\Component\HttpKernel\HttpKernelInterface <add> * @return void <ide> */ <del> abstract public function createApplication(); <add> public function tearDown() <add> { <add> $this->app->flush(); <add> } <ide> <ide> }
3
Python
Python
add profile command to cli
cec76801dc870ae3e1f8682e84126ee69a2a25a2
<ide><path>spacy/__main__.py <ide> import plac <ide> import sys <ide> from spacy.cli import download, link, info, package, train, convert, model <add> from spacy.cli import profile <ide> from spacy.util import prints <ide> <ide> commands = { <ide> 'train': train, <ide> 'convert': convert, <ide> 'package': package, <del> 'model': model <add> 'model': model, <add> 'profile': profile, <ide> } <ide> if len(sys.argv) == 1: <ide> prints(', '.join(commands), title="Available commands", exits=1)
1
Java
Java
add marble diagrams for single.repeat operators
c8bcb3c92bebde39616597bd46ddb93d6f0f6e18
<ide><path>src/main/java/io/reactivex/Single.java <ide> public final Single<T> onTerminateDetach() { <ide> <ide> /** <ide> * Repeatedly re-subscribes to the current Single and emits each success value. <add> * <p> <add> * <img width="640" height="457" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/Single.repeat.png" alt=""> <ide> * <dl> <ide> * <dt><b>Backpressure:</b></dt> <ide> * <dd>The returned {@code Flowable} honors the backpressure of the downstream consumer.</dd> <ide> public final Flowable<T> repeat() { <ide> <ide> /** <ide> * Re-subscribes to the current Single at most the given number of times and emits each success value. <add> * <p> <add> * <img width="640" height="457" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/Single.repeat.n.png" alt=""> <ide> * <dl> <ide> * <dt><b>Backpressure:</b></dt> <ide> * <dd>The returned {@code Flowable} honors the backpressure of the downstream consumer.</dd> <ide> public final Flowable<T> repeat(long times) { <ide> * Re-subscribes to the current Single if <ide> * the Publisher returned by the handler function signals a value in response to a <ide> * value signalled through the Flowable the handle receives. <add> * <p> <add> * <img width="640" height="1478" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/Single.repeatWhen.png" alt=""> <ide> * <dl> <ide> * <dt><b>Backpressure:</b></dt> <ide> * <dd>The returned {@code Flowable} honors the backpressure of the downstream consumer.
1
Ruby
Ruby
fix version detection and bottles
d9a18d4c1e679d95ff9828f00d246d9b03ccb984
<ide><path>Library/Homebrew/test/test_versions.rb <ide> def test_erlang_version_style <ide> assert_version_detected 'R13B', 'http://erlang.org/download/otp_src_R13B.tar.gz' <ide> end <ide> <add> def test_another_erlang_version_style <add> assert_version_detected 'R15B01', 'https://github.com/erlang/otp/tarball/OTP_R15B01' <add> end <add> <ide> def test_p7zip_version_style <ide> assert_version_detected '9.04', <ide> 'http://kent.dl.sourceforge.net/sourceforge/p7zip/p7zip_9.04_src_all.tar.bz2' <ide> def test_erlang_bottle_style <ide> assert_version_detected 'R15B', 'https://downloads.sf.net/project/machomebrew/Bottles/erlang-R15B.lion.bottle.tar.gz' <ide> end <ide> <add> def test_another_erlang_bottle_style <add> assert_version_detected 'R15B01', 'https://downloads.sf.net/project/machomebrew/Bottles/erlang-R15B01.mountainlion.bottle.tar.gz' <add> end <add> <ide> def test_old_bottle_style <ide> assert_version_detected '4.7.3', 'https://downloads.sf.net/project/machomebrew/Bottles/qt-4.7.3-bottle.tar.gz' <ide> end <ide><path>Library/Homebrew/version.rb <ide> def self._parse spec <ide> m = %r[github.com/.+/(?:zip|tar)ball/v?((\d+\.)+\d+_(\d+))$].match(spec.to_s) <ide> return m.captures.first unless m.nil? <ide> <add> # e.g. https://github.com/erlang/otp/tarball/OTP_R15B01 (erlang style) <add> m = /[-_](R\d+[AB]\d*)/.match(spec.to_s) <add> return m.captures.first unless m.nil? <add> <ide> # e.g. boost_1_39_0 <ide> m = /((\d+_)+\d+)$/.match(stem) <ide> return m.captures.first.gsub('_', '.') unless m.nil? <ide> def self._parse spec <ide> m = /_((\d+\.)+\d+[abc]?)[.]orig$/.match(stem) <ide> return m.captures.first unless m.nil? <ide> <del> # e.g. erlang-R14B03-bottle.tar.gz (old erlang bottle style) <add> # e.g. http://www.openssl.org/source/openssl-0.9.8s.tar.gz <ide> m = /-([^-]+)/.match(stem) <ide> return m.captures.first unless m.nil? <ide> <del> # e.g. opt_src_R13B (erlang) <del> m = /otp_src_(.+)/.match(stem) <del> return m.captures.first unless m.nil? <del> <ide> # e.g. astyle_1.23_macosx.tar.gz <ide> m = /_([^_]+)/.match(stem) <ide> return m.captures.first unless m.nil?
2
Python
Python
fix val_step in fit_generator with sequence
6746bda3dcda273580fef2d911c6cc333c8a626c
<ide><path>keras/engine/training_generator.py <ide> def fit_generator(model, <ide> if isinstance(val_data, Sequence): <ide> val_enqueuer = OrderedEnqueuer(val_data, <ide> use_multiprocessing=use_multiprocessing) <del> validation_steps = len(val_data) <add> validation_steps = validation_steps or len(val_data) <ide> else: <ide> val_enqueuer = GeneratorEnqueuer(val_data, <ide> use_multiprocessing=use_multiprocessing) <ide><path>tests/keras/engine/test_training.py <ide> class RandomSequence(Sequence): <ide> def __init__(self, batch_size, sequence_length=12): <ide> self.batch_size = batch_size <ide> self.sequence_length = sequence_length <add> self.logs = [] # It will work for use_multiprocessing=False <ide> <ide> def __len__(self): <ide> return self.sequence_length <ide> <ide> def __getitem__(self, idx): <add> self.logs.append(idx) <ide> return ([np.random.random((self.batch_size, 3)), <ide> np.random.random((self.batch_size, 3))], <ide> [np.random.random((self.batch_size, 4)), <ide> def gen_data(): <ide> sample_weight_mode=None) <ide> trained_epochs = [] <ide> trained_batches = [] <add> val_seq = RandomSequence(4) <ide> out = model.fit_generator(generator=RandomSequence(3), <ide> steps_per_epoch=3, <ide> epochs=5, <ide> initial_epoch=0, <del> validation_data=RandomSequence(4), <add> validation_data=val_seq, <ide> validation_steps=3, <add> max_queue_size=1, <ide> callbacks=[tracker_cb]) <ide> assert trained_epochs == [0, 1, 2, 3, 4] <ide> assert trained_batches == list(range(3)) * 5 <add> assert len(val_seq.logs) <= 4 * 5 <ide> <ide> # steps_per_epoch will be equal to len of sequence if it's unspecified <ide> trained_epochs = [] <ide> trained_batches = [] <add> val_seq = RandomSequence(4) <ide> out = model.fit_generator(generator=RandomSequence(3), <ide> epochs=5, <ide> initial_epoch=0, <del> validation_data=RandomSequence(4), <add> validation_data=val_seq, <ide> callbacks=[tracker_cb]) <ide> assert trained_epochs == [0, 1, 2, 3, 4] <ide> assert trained_batches == list(range(12)) * 5 <add> assert len(val_seq.logs) == 12 * 5 <ide> <ide> # fit_generator will throw an exception <ide> # if steps is unspecified for regular generator
2
Ruby
Ruby
escape globbed parameters in routes correctly
6776edccf6fb553eb0ac6db55e1d30df1b5b6589
<ide><path>actionpack/lib/action_controller/routing/segments.rb <ide> def match_extraction(next_capture) <ide> end <ide> <ide> class PathSegment < DynamicSegment #:nodoc: <del> RESERVED_PCHAR = "#{Segment::RESERVED_PCHAR}/" <del> UNSAFE_PCHAR = Regexp.new("[^#{URI::REGEXP::PATTERN::UNRESERVED}#{RESERVED_PCHAR}]", false, 'N').freeze <del> <ide> def interpolation_chunk(value_code = "#{local_name}") <del> "\#{URI.escape(#{value_code}.to_s, ActionController::Routing::PathSegment::UNSAFE_PCHAR)}" <add> "\#{#{value_code}}" <add> end <add> <add> def extract_value <add> "#{local_name} = hash[:#{key}] && hash[:#{key}].collect { |path_component| URI.escape(path_component, ActionController::Routing::Segment::UNSAFE_PCHAR) }.to_param #{"|| #{default.inspect}" if default}" <ide> end <ide> <ide> def default <ide><path>actionpack/test/controller/routing_test.rb <ide> def setup <ide> ActionController::Routing.use_controllers! ['controller'] <ide> @set = ActionController::Routing::RouteSet.new <ide> @set.draw do |map| <del> map.connect ':controller/:action/:variable' <add> map.connect ':controller/:action/:variable/*additional' <ide> end <ide> <ide> safe, unsafe = %w(: @ & = + $ , ;), %w(^ / ? # [ ]) <ide> def setup <ide> end <ide> <ide> def test_route_generation_escapes_unsafe_path_characters <del> assert_equal "/contr#{@segment}oller/act#{@escaped}ion/var#{@escaped}iable", <add> assert_equal "/contr#{@segment}oller/act#{@escaped}ion/var#{@escaped}iable/add#{@escaped}itional-1/add#{@escaped}itional-2", <ide> @set.generate(:controller => "contr#{@segment}oller", <ide> :action => "act#{@segment}ion", <del> :variable => "var#{@segment}iable") <add> :variable => "var#{@segment}iable", <add> :additional => ["add#{@segment}itional-1", "add#{@segment}itional-2"]) <ide> end <ide> <ide> def test_route_recognition_unescapes_path_components <ide> options = { :controller => "controller", <ide> :action => "act#{@segment}ion", <del> :variable => "var#{@segment}iable" } <del> assert_equal options, @set.recognize_path("/controller/act#{@escaped}ion/var#{@escaped}iable") <add> :variable => "var#{@segment}iable", <add> :additional => ["add#{@segment}itional-1", "add#{@segment}itional-2"] } <add> assert_equal options, @set.recognize_path("/controller/act#{@escaped}ion/var#{@escaped}iable/add#{@escaped}itional-1/add#{@escaped}itional-2") <ide> end <ide> end <ide>
2
Ruby
Ruby
fix error message when adapter is not specified
83b995206a569d8d08b697ee9f86a64ca1854bcc
<ide><path>activerecord/lib/active_record/connection_adapters/connection_specification.rb <ide> def resolve_symbol_connection(env_name, pool_name) <ide> if db_config <ide> resolve_connection(db_config.config).merge("name" => pool_name.to_s) <ide> else <del> raise(AdapterNotSpecified, "'#{env_name}' database is not configured. Available: #{configurations.configurations.map(&:env_name).join(", ")}") <add> raise AdapterNotSpecified, <<~MSG <add> The `#{env_name}` database is not configured for the `#{ActiveRecord::ConnectionHandling::DEFAULT_ENV.call}` environment. <add> <add> Available databases configurations are: <add> <add> #{build_configuration_sentence} <add> MSG <ide> end <ide> end <ide> <add> def build_configuration_sentence # :nodoc: <add> configs = configurations.configs_for(include_replicas: true) <add> <add> configs.group_by(&:env_name).map do |env, config| <add> namespaces = config.map(&:spec_name) <add> if namespaces.size > 1 <add> "#{env}: #{namespaces.join(", ")}" <add> else <add> env <add> end <add> end.join("\n") <add> end <add> <ide> # Accepts a hash. Expands the "url" key that contains a <ide> # URL database connection to a full connection <ide> # hash and merges with the rest of the hash.
1
Python
Python
fix keyerror on missing exitcode
206cce971da6941e8c1b0d3c4dbf4fa8afe0fba4
<ide><path>airflow/providers/amazon/aws/operators/ecs.py <ide> def _check_success_task(self) -> None: <ide> ) <ide> containers = task['containers'] <ide> for container in containers: <del> if container.get('lastStatus') == 'STOPPED' and container['exitCode'] != 0: <add> if container.get('lastStatus') == 'STOPPED' and container.get('exitCode', 1) != 0: <ide> if self.task_log_fetcher: <ide> last_logs = "\n".join( <ide> self.task_log_fetcher.get_last_log_messages(self.number_logs_exception) <ide><path>tests/providers/amazon/aws/operators/test_ecs.py <ide> def test_check_success_tasks_raises_logs_disabled(self): <ide> assert "'exitCode': 1" in str(ctx.value) <ide> client_mock.describe_tasks.assert_called_once_with(cluster='c', tasks=['arn']) <ide> <add> def test_check_success_tasks_handles_initialization_failure(self): <add> client_mock = mock.Mock() <add> self.ecs.arn = 'arn' <add> self.ecs.client = client_mock <add> <add> # exitCode is missing during some container initialization failures <add> client_mock.describe_tasks.return_value = { <add> 'tasks': [{'containers': [{'name': 'foo', 'lastStatus': 'STOPPED'}]}] <add> } <add> <add> with pytest.raises(Exception) as ctx: <add> self.ecs._check_success_task() <add> <add> print(str(ctx.value)) <add> assert "This task is not in success state " in str(ctx.value) <add> assert "'name': 'foo'" in str(ctx.value) <add> assert "'lastStatus': 'STOPPED'" in str(ctx.value) <add> assert "exitCode" not in str(ctx.value) <add> client_mock.describe_tasks.assert_called_once_with(cluster='c', tasks=['arn']) <add> <ide> def test_check_success_tasks_raises_pending(self): <ide> client_mock = mock.Mock() <ide> self.ecs.client = client_mock
2

List of repositories included in the dataset

Project Language Fetched Count Url
Moby Go 5 943 https://github.com/moby/moby
Rxjava Java 516 https://github.com/RxJava/ReactiveX
Spring-framework Java 2 529 https://github.com/spring-framework/spring-project
Chart.js Javascript 641 https://github.com/Chart.js/chartjs
Three.js Javascript 1 512 https://github.com/three.js/mrdoob
Redux Javascript 592 https://github.com/redux/reduxjs
React-native Javascript 2 901 https://github.com/react-native/facebook
React Javascript 2 335 https://github.com/react/facebook
Pdf.js Javascript 966 https://github.com/pdf.js/mozilla
Node Javascript 7 779 https://github.com/node/nodejs
Next.js Javascript 1 183 https://github.com/next.js/vercel
Moment Javascript 422 https://github.com/moment/moment
Video.js Javascript 254 https://github.com/video.js/videojs
Immutable-js Javascript 112 https://github.com/immutable-js/immutable-js
Jquery Javascript 527 https://github.com/jquery/jquery
Webpack Javascript 1 715 https://github.com/webpack/webpack
Angular.js Javascript 1 938 https://github.com/angular.js/angular
Atom Javascript 1 090 https://github.com/atom/atom
Ember.js Javascript 2 094 https://github.com/ember.js/emberjs
Axios Javascript 110 https://github.com/axios/axios
D3 Javascript 371 https://github.com/d3/d3
Framework PHP 4 668 https://github.com/framework/laravel
Cakephp PHP 5 827 https://github.com/cakephp/cakephp
Laravel PHP 769 https://github.com/laravel/laravel
Transformers Python 1 735 https://github.com/transformers/huggingface
Python Python 330 https://github.com/Python/TheAlgorithms
Airflow Python 1 592 https://github.com/airflow/apache
Spacy Python 2 033 https://github.com/spaCy/explosion
Freecodecamp Python 2 773 https://github.com/freeCodeCamp/freeCodeCamp
Glances Python 494 https://github.com/glances/nicolargo
Django-rest-framework Python 1 084 https://github.com/django-rest-framework/encode
Libcloud Python 1 104 https://github.com/libcloud/apache
Numpy Python 2 512 https://github.com/numpy/numpy
Flask Python 277 https://github.com/flask/pallets
Celery Python 565 https://github.com/celery/celery
Keras Python 1 466 https://github.com/keras/keras-team
Models Python 930 https://github.com/models/tensorflow
Django Python 170 https://github.com/django/django
Brew Ruby 5 560 https://github.com/brew/Homebrew
Rails Ruby 8 421 https://github.com/rails/rails
Downloads last month
2
Edit dataset card