content_type
stringclasses
8 values
main_lang
stringclasses
7 values
message
stringlengths
1
50
sha
stringlengths
40
40
patch
stringlengths
52
962k
file_count
int64
1
300
Javascript
Javascript
resolve ref callbacks
3717b71c6444f813d44e10f7f42fe4e2c8f31023
<ide><path>src/renderers/shared/fiber/ReactChildFiber.js <ide> function ChildReconciler(shouldClone, shouldTrackSideEffects) { <ide> if (current == null || current.type !== element.type) { <ide> // Insert <ide> const created = createFiberFromElement(element, priority); <add> created.ref = element.ref; <ide> created.return = returnFiber; <ide> return created; <ide> } else { <ide> // Move based on index <ide> const existing = useFiber(current, priority); <add> existing.ref = element.ref; <ide> existing.pendingProps = element.props; <ide> existing.return = returnFiber; <ide> return existing; <ide> function ChildReconciler(shouldClone, shouldTrackSideEffects) { <ide> switch (newChild.$$typeof) { <ide> case REACT_ELEMENT_TYPE: { <ide> const created = createFiberFromElement(newChild, priority); <add> created.ref = newChild.ref; <ide> created.return = returnFiber; <ide> return created; <ide> } <ide> function ChildReconciler(shouldClone, shouldTrackSideEffects) { <ide> if (child.type === element.type) { <ide> deleteRemainingChildren(returnFiber, child.sibling); <ide> const existing = useFiber(child, priority); <add> existing.ref = element.ref; <ide> existing.pendingProps = element.props; <ide> existing.return = returnFiber; <ide> return existing; <ide> function ChildReconciler(shouldClone, shouldTrackSideEffects) { <ide> } <ide> <ide> const created = createFiberFromElement(element, priority); <add> created.ref = element.ref; <ide> created.return = returnFiber; <ide> return created; <ide> } <ide><path>src/renderers/shared/fiber/ReactFiberCommitWork.js <ide> module.exports = function<T, P, I, TI, C>(config : HostConfig<T, P, I, TI, C>) { <ide> const insertBefore = config.insertBefore; <ide> const removeChild = config.removeChild; <ide> <add> function detachRef(current : Fiber) { <add> const ref = current.ref; <add> if (ref) { <add> ref(null); <add> } <add> } <add> <add> function attachRef(current : ?Fiber, finishedWork : Fiber, instance : any) { <add> const ref = finishedWork.ref; <add> if (current) { <add> const currentRef = current.ref; <add> if (currentRef && currentRef !== ref) { <add> // TODO: This needs to be done in a separate pass before any other refs <add> // gets resolved. Otherwise we might invoke them in the wrong order <add> // when the same ref switches between two components. <add> currentRef(null); <add> } <add> } <add> if (ref) { <add> ref(instance); <add> } <add> } <add> <ide> function getHostParent(fiber : Fiber) : ?I { <ide> let parent = fiber.return; <ide> while (parent) { <ide> module.exports = function<T, P, I, TI, C>(config : HostConfig<T, P, I, TI, C>) { <ide> // Recursively delete all host nodes from the parent. <ide> // TODO: Error handling. <ide> const parent = getHostParent(current); <del> if (!parent) { <del> return; <del> } <ide> // We only have the top Fiber that was inserted but we need recurse down its <ide> // children to find all the terminal nodes. <ide> // TODO: Call componentWillUnmount on all classes as needed. Recurse down <ide> module.exports = function<T, P, I, TI, C>(config : HostConfig<T, P, I, TI, C>) { <ide> commitNestedUnmounts(node); <ide> // After all the children have unmounted, it is now safe to remove the <ide> // node from the tree. <del> removeChild(parent, node.stateNode); <add> if (parent) { <add> removeChild(parent, node.stateNode); <add> } <ide> } else { <ide> commitUnmount(node); <ide> if (node.child) { <ide> module.exports = function<T, P, I, TI, C>(config : HostConfig<T, P, I, TI, C>) { <ide> function commitUnmount(current : Fiber) : void { <ide> switch (current.tag) { <ide> case ClassComponent: { <add> detachRef(current); <ide> const instance = current.stateNode; <ide> if (typeof instance.componentWillUnmount === 'function') { <ide> instance.componentWillUnmount(); <ide> } <add> return; <add> } <add> case HostComponent: { <add> detachRef(current); <add> return; <ide> } <ide> } <ide> } <ide> module.exports = function<T, P, I, TI, C>(config : HostConfig<T, P, I, TI, C>) { <ide> finishedWork.callbackList = null; <ide> callCallbacks(callbackList, instance); <ide> } <del> // TODO: Fire update refs <add> attachRef(current, finishedWork, instance); <ide> return; <ide> } <ide> case HostContainer: { <ide> module.exports = function<T, P, I, TI, C>(config : HostConfig<T, P, I, TI, C>) { <ide> return; <ide> } <ide> case HostComponent: { <del> if (finishedWork.stateNode == null || !current) { <del> throw new Error('This should only be done during updates.'); <del> } <del> // Commit the work prepared earlier. <del> const newProps = finishedWork.memoizedProps; <del> const oldProps = current.memoizedProps; <ide> const instance : I = finishedWork.stateNode; <del> commitUpdate(instance, oldProps, newProps); <add> if (instance != null && current) { <add> // Commit the work prepared earlier. <add> const newProps = finishedWork.memoizedProps; <add> const oldProps = current.memoizedProps; <add> commitUpdate(instance, oldProps, newProps); <add> } <add> attachRef(current, finishedWork, instance); <ide> return; <ide> } <ide> case HostText: { <ide><path>src/renderers/shared/fiber/ReactFiberCompleteWork.js <ide> module.exports = function<T, P, I, TI, C>(config : HostConfig<T, P, I, TI, C>) { <ide> // TODO: This seems like unnecessary duplication. <ide> workInProgress.stateNode = instance; <ide> workInProgress.output = instance; <add> if (workInProgress.ref) { <add> // If there is a ref on a host node we need to schedule a callback <add> markUpdate(workInProgress); <add> } <ide> } <ide> workInProgress.memoizedProps = newProps; <ide> return null; <ide><path>src/renderers/shared/fiber/__tests__/ReactIncrementalSideEffects-test.js <ide> describe('ReactIncrementalSideEffects', () => { <ide> <ide> }); <ide> <add> it('invokes ref callbacks after insertion/update/unmount', () => { <add> <add> var classInstance = null; <add> <add> var ops = []; <add> <add> class ClassComponent extends React.Component { <add> render() { <add> classInstance = this; <add> return <span />; <add> } <add> } <add> <add> function FunctionalComponent(props) { <add> return <span />; <add> } <add> <add> function Foo(props) { <add> return ( <add> props.show ? <add> <div> <add> <ClassComponent ref={n => ops.push(n)} /> <add> <FunctionalComponent ref={n => ops.push(n)} /> <add> <div ref={n => ops.push(n)} /> <add> </div> : <add> null <add> ); <add> } <add> <add> ReactNoop.render(<Foo show={true} />); <add> ReactNoop.flush(); <add> expect(ops).toEqual([ <add> classInstance, <add> // no call for functional components <add> div(), <add> ]); <add> <add> ops = []; <add> <add> // Refs that switch function instances get reinvoked <add> ReactNoop.render(<Foo show={true} />); <add> ReactNoop.flush(); <add> expect(ops).toEqual([ <add> // TODO: All detach should happen first. Currently they're interleaved. <add> // detach <add> null, <add> // reattach <add> classInstance, <add> // detach <add> null, <add> // reattach <add> div(), <add> ]); <add> <add> ops = []; <add> <add> ReactNoop.render(<Foo show={false} />); <add> ReactNoop.flush(); <add> expect(ops).toEqual([ <add> // unmount <add> null, <add> null, <add> ]); <add> <add> }); <add> <ide> // TODO: Test that mounts, updates, refs, unmounts and deletions happen in the <ide> // expected way for aborted and resumed render life-cycles. <ide>
4
PHP
PHP
add a test for overriding raw tags
5b0bc6cc0218c0035466a66be75ab51098fa163c
<ide><path>tests/View/ViewBladeCompilerTest.php <ide> public function testReversedEchosAreCompiled() <ide> } <ide> <ide> <add> public function testShortRawEchosAreCompiled() <add> { <add> $compiler = new BladeCompiler($this->getFiles(), __DIR__); <add> $compiler->setRawTags('{{', '}}'); <add> $this->assertEquals('<?php echo $name; ?>', $compiler->compileString('{{$name}}')); <add> $this->assertEquals('<?php echo $name; ?>', $compiler->compileString('{{ $name }}')); <add> $this->assertEquals('<?php echo e($name); ?>', $compiler->compileString('{{{$name}}}')); <add> $this->assertEquals('<?php echo e($name); ?>', $compiler->compileString('{{{ $name }}}')); <add> } <add> <add> <ide> public function testExtendsAreCompiled() <ide> { <ide> $compiler = new BladeCompiler($this->getFiles(), __DIR__);
1
Javascript
Javascript
add a comment
6538e7141a2e47be1ef6c21bb1dc3f250d9f88e3
<ide><path>src/devtools/views/Components/Element.js <ide> export default function ElementView({ index, style, data }: Props) { <ide> ); <ide> <ide> const rendererID = store.getRendererIDForElement(element.id) || null; <add> // Individual elements don't have a corresponding leave handler. <add> // Instead, it's implemented on the tree level. <ide> const handleMouseEnter = useCallback(() => { <ide> if (rendererID !== null) { <ide> bridge.send('highlightElementInDOM', {
1
Text
Text
add html snippet and codepen link
0164c919fd00045b34afc5f1fa47f35604088c32
<ide><path>guide/english/certifications/responsive-web-design/basic-html-and-html5/add-images-to-your-website/index.md <ide> The main attributes of an img tag are src and alt: <ide> <ide> Attributes are key value pairs inserted into the tag. The syntax is `<tag key1="value1" key2="value2"> </tag>` or, in case of self-closing tags, `<tag key1="value1" key2="value2" />` - notice that the pairs are separated by a space character, not by a comma. <ide> <add>```html <add><img src="insert URL of the image" alt="Cute dog smiling"> <add>``` <add> <add> <ide> ### Resources <ide> - [HTML attributes](https://guide.freecodecamp.org/html/attributes)
1
PHP
PHP
fix doc block issues
53a2867621da18a35e9aa2ea1380ae8744871cdf
<ide><path>src/Routing/RouteBuilder.php <ide> public function options($template, $target, $name = null) <ide> /** <ide> * Helper to create routes that only respond to a single HTTP method. <ide> * <add> * @param string $method The HTTP method name to match. <ide> * @param string $template The URL template to use. <ide> * @param array $target An array describing the target route parameters. These parameters <ide> * should indicate the plugin, prefix, controller, and action that this route points to.
1
Javascript
Javascript
check arg type for dnspromises.resolve
0b85435c01cb1a6932a6b5b6cb6022d9dbf988e5
<ide><path>test/parallel/test-dns.js <ide> assert.deepStrictEqual(dns.getServers(), portsExpected); <ide> dns.setServers([]); <ide> assert.deepStrictEqual(dns.getServers(), []); <ide> <del>common.expectsError(() => { <del> dns.resolve('example.com', [], common.mustNotCall()); <del>}, { <del> code: 'ERR_INVALID_ARG_TYPE', <del> type: TypeError, <del> message: 'The "rrtype" argument must be of type string. ' + <del> 'Received type object' <del>}); <add>{ <add> const errObj = { <add> code: 'ERR_INVALID_ARG_TYPE', <add> type: TypeError, <add> message: 'The "rrtype" argument must be of type string. ' + <add> 'Received type object' <add> }; <add> common.expectsError(() => { <add> dns.resolve('example.com', [], common.mustNotCall()); <add> }, errObj); <add> common.expectsError(() => { <add> dnsPromises.resolve('example.com', []); <add> }, errObj); <add>} <add>{ <add> const errObj = { <add> code: 'ERR_INVALID_ARG_TYPE', <add> type: TypeError, <add> message: 'The "name" argument must be of type string. ' + <add> 'Received type undefined' <add> }; <add> common.expectsError(() => { <add> dnsPromises.resolve(); <add> }, errObj); <add>} <ide> <ide> // dns.lookup should accept only falsey and string values <ide> {
1
Javascript
Javascript
treat it more like a pool
f028c779b16aa9a5986502f35d7e1941ca0abd88
<ide><path>spec/git-work-queue-spec.js <ide> fdescribe('GitWorkQueue', () => { <ide> let queue <ide> <ide> beforeEach(() => { <del> queue = new GitWorkQueue() <add> queue = new GitWorkQueue([{}]) <ide> }) <ide> <ide> describe('.enqueue', () => { <ide><path>src/git-work-queue.js <ide> <ide> // A queue used to manage git work. <ide> export default class GitWorkQueue { <del> constructor () { <add> constructor (pool) { <add> this.pool = pool <add> <ide> this.queue = [] <del> this.working = false <ide> } <ide> <ide> // Enqueue the given function. The function must return a {Promise} when <ide> export default class GitWorkQueue { <ide> <ide> this.queue.push(this.wrapFunction(fn, resolve, reject)) <ide> <del> if (this.shouldStartNext()) { <del> this.startNext() <del> } <add> this.startNextIfAble() <ide> <ide> return wrapperPromise <ide> } <ide> <ide> wrapFunction (fn, resolve, reject) { <ide> return () => { <del> const promise = fn() <add> const repo = this.pool.shift() <add> const promise = fn(repo) <ide> promise <ide> .then(result => { <ide> resolve(result) <del> this.taskDidComplete() <add> this.taskDidComplete(repo) <ide> }, error => { <ide> reject(error) <del> this.taskDidComplete() <add> this.taskDidComplete(repo) <ide> }) <ide> } <ide> } <ide> <del> taskDidComplete () { <del> this.working = false <del> <del> if (this.shouldStartNext()) { <del> this.startNext() <del> } <del> } <add> taskDidComplete (repo) { <add> this.pool.push(repo) <ide> <del> shouldStartNext () { <del> return !this.working && this.queue.length > 0 <add> this.startNextIfAble() <ide> } <ide> <del> startNext () { <del> this.working = true <add> startNextIfAble () { <add> if (!this.pool.length || !this.queue.length) return <ide> <ide> const fn = this.queue.shift() <ide> fn()
2
Text
Text
fix unbalanced emphasis
3e062762e4519dbb6817c2a47f9d28165f66b53f
<ide><path>doc/api/n-api.md <ide> scenario, because with those the async execution still happens on the main <ide> event loop. When using any other async mechanism, the following APIs are <ide> necessary to ensure an async operation is properly tracked by the runtime. <ide> <del>### *napi_async_init** <add>### napi_async_init <ide> <!-- YAML <ide> added: v8.6.0 <ide> --> <ide> napi_status napi_async_init(napi_env env, <ide> <ide> Returns `napi_ok` if the API succeeded. <ide> <del>### *napi_async_destroy** <add>### napi_async_destroy <ide> <!-- YAML <ide> added: v8.6.0 <ide> --> <ide> napi_status napi_async_destroy(napi_env env, <ide> <ide> Returns `napi_ok` if the API succeeded. <ide> <del>### *napi_make_callback* <add>### napi_make_callback <ide> <!-- YAML <ide> added: v8.0.0 <ide> changes:
1
Python
Python
fix typo in error message - systems -> system
f69201d71813e8101a5760d600eba9f995a3235b
<ide><path>tests/conftest.py <ide> def skip_if_not_marked_with_system(selected_systems, item): <ide> def skip_system_test(item): <ide> for marker in item.iter_markers(name="system"): <ide> pytest.skip("The test is skipped because it has system marker. " <del> "System tests are only run when --systems flag " <add> "System tests are only run when --system flag " <ide> "with the right system ({system}) is passed to pytest. {item}". <ide> format(system=marker.args[0], item=item)) <ide>
1
Python
Python
add flask.config_class feature
ec5b182f15d711aa92fe16480011fbe0fb9d3a63
<ide><path>flask/app.py <ide> def _set_request_globals_class(self, value): <ide> _set_request_globals_class) <ide> del _get_request_globals_class, _set_request_globals_class <ide> <add> #: The class that is used for the ``config`` attribute of this app. <add> #: Defaults to :class:`~flask.Config`. <add> #: <add> #: Example use cases for a custom class: <add> #: <add> #: 1. Default values for certain config options. <add> #: 2. Access to config values through attributes in addition to keys. <add> config_class = Config <add> <ide> #: The debug flag. Set this to `True` to enable debugging of the <ide> #: application. In debug mode the debugger will kick in when an unhandled <ide> #: exception occurs and the integrated server will automatically reload <ide> def make_config(self, instance_relative=False): <ide> root_path = self.root_path <ide> if instance_relative: <ide> root_path = self.instance_path <del> return Config(root_path, self.default_config) <add> return self.config_class(root_path, self.default_config) <ide> <ide> def auto_find_instance_path(self): <ide> """Tries to locate the instance path if it was not provided to the <ide><path>flask/testsuite/__init__.py <ide> def assert_in(self, x, y): <ide> def assert_not_in(self, x, y): <ide> self.assertNotIn(x, y) <ide> <add> def assert_isinstance(self, obj, cls): <add> self.assertIsInstance(obj, cls) <add> <ide> if sys.version_info[:2] == (2, 6): <ide> def assertIn(self, x, y): <ide> assert x in y, "%r unexpectedly not in %r" % (x, y) <ide><path>flask/testsuite/config.py <ide> def test_config_missing(self): <ide> self.assert_true(0, 'expected config') <ide> self.assert_false(app.config.from_pyfile('missing.cfg', silent=True)) <ide> <add> def test_custom_config_class(self): <add> class Config(flask.Config): <add> pass <add> class Flask(flask.Flask): <add> config_class = Config <add> app = Flask(__name__) <add> self.assert_isinstance(app.config, Config) <add> app.config.from_object(__name__) <add> self.common_object_test(app) <add> <ide> def test_session_lifetime(self): <ide> app = flask.Flask(__name__) <ide> app.config['PERMANENT_SESSION_LIFETIME'] = 42
3
Python
Python
fix --gid option of celery_multi
990c892426689163d3c4bb84aa24d5f9da78d262
<ide><path>celery/platforms.py <ide> def setegid(gid): <ide> """Set effective group id.""" <ide> gid = parse_gid(gid) <ide> if gid != os.getgid(): <del> os.setegid <add> os.setegid(gid) <ide> <ide> <ide> def seteuid(uid):
1
Javascript
Javascript
remove nonexistant exports.adname
680dda802393ef1513a8a84a353dfc2ecfacacb2
<ide><path>lib/dns.js <ide> exports.NOTFOUND = 'ENOTFOUND'; <ide> exports.NOTIMP = 'ENOTIMP'; <ide> exports.REFUSED = 'EREFUSED'; <ide> exports.BADQUERY = 'EBADQUERY'; <del>exports.ADNAME = 'EADNAME'; <ide> exports.BADNAME = 'EBADNAME'; <ide> exports.BADFAMILY = 'EBADFAMILY'; <ide> exports.BADRESP = 'EBADRESP';
1
Javascript
Javascript
improve test case
f6a86d8c6c771c350bde59525e756f7b420a7c55
<ide><path>test/configCases/optimization/hashed-module-ids/index.js <del>var path = require("path"); <del> <ide> it("should have named modules ids", function() { <ide> for (var i = 1; i <= 5; i++) { <del> var expectedModuleId = "file" + i + ".js"; <ide> var moduleId = require("./files/file" + i + ".js"); <ide> <del> expect(path.basename(moduleId)).not.toBe(expectedModuleId); <add> expect(moduleId).toMatch(/^[/=a-zA-Z0-9]{4,5}$/); <ide> } <ide> });
1
Text
Text
add info on kebab case
5bd6b4f763b1955f2c082f2e6ed6f058028cbce7
<ide><path>guide/english/html/css-classes/index.md <ide> The order of the multiple classes you give to an element is irrelevant. If class <ide> ``` <ide> In this example, border of the element would be green even if the class "voice" comes second in html. <ide> <del>**Note:** Class names are traditionally all lowercase, with each word in a multi-word class name separated by hyphens (e.g. "super-man"). <add>**Note:** Class names are traditionally all lowercase, with each word in a multi-word class name separated by hyphens (e.g. "super-man"). This format is also known as kebab-case. <ide> <ide> You can also combine classes in the same line: <ide> ```css
1
PHP
PHP
update @method in mailer in sync with
fac87fabe1614495446a287e5f94d16580806328
<ide><path>src/Mailer/Mailer.php <ide> * @method \Cake\Mailer\Email from($email = null, $name = null) <ide> * @method \Cake\Mailer\Email setSender($email, $name = null) <ide> * @method array getSender() <del> * @method \Cake\Mailer\Email sender($email = null, $name = null) <ide> * @method \Cake\Mailer\Email setReplyTo($email, $name = null) <ide> * @method array getReplyTo() <ide> * @method \Cake\Mailer\Email replyTo($email = null, $name = null) <ide> * @method \Cake\Mailer\Email setReadReceipt($email, $name = null) <ide> * @method array getReadReceipt() <del> * @method \Cake\Mailer\Email readReceipt($email = null, $name = null) <ide> * @method \Cake\Mailer\Email setReturnPath($email, $name = null) <ide> * @method array getReturnPath() <del> * @method \Cake\Mailer\Email returnPath($email = null, $name = null) <ide> * @method \Cake\Mailer\Email addTo($email, $name = null) <ide> * @method \Cake\Mailer\Email setCc($email, $name = null) <ide> * @method array getCc() <del> * @method \Cake\Mailer\Email cc($email = null, $name = null) <ide> * @method \Cake\Mailer\Email addCc($email, $name = null) <ide> * @method \Cake\Mailer\Email setBcc($email, $name = null) <ide> * @method array getBcc() <del> * @method \Cake\Mailer\Email bcc($email = null, $name = null) <ide> * @method \Cake\Mailer\Email addBcc($email, $name = null) <ide> * @method \Cake\Mailer\Email setCharset($charset) <ide> * @method string getCharset() <del> * @method \Cake\Mailer\Email charset($charset = null) <ide> * @method \Cake\Mailer\Email setHeaderCharset($charset) <ide> * @method string getHeaderCharset() <del> * @method \Cake\Mailer\Email headerCharset($charset = null) <ide> * @method \Cake\Mailer\Email setSubject($subject) <ide> * @method string getSubject() <del> * @method \Cake\Mailer\Email subject($subject = null) <ide> * @method \Cake\Mailer\Email setHeaders(array $headers) <ide> * @method \Cake\Mailer\Email addHeaders(array $headers) <ide> * @method \Cake\Mailer\Email getHeaders(array $include = []) <ide> * @method \Cake\Mailer\Email setTemplate($template) <ide> * @method string getTemplate() <ide> * @method \Cake\Mailer\Email setLayout($layout) <ide> * @method string getLayout() <del> * @method \Cake\Mailer\Email template($template = false, $layout = false) <ide> * @method \Cake\Mailer\Email setViewRenderer($viewClass) <ide> * @method string getViewRenderer() <del> * @method \Cake\Mailer\Email viewRender($viewClass = null) <ide> * @method \Cake\Mailer\Email setViewVars($viewVars) <ide> * @method array getViewVars() <ide> * @method \Cake\Mailer\Email viewVars($viewVars = null) <ide> * @method \Cake\Mailer\Email setTheme($theme) <ide> * @method string getTheme() <del> * @method \Cake\Mailer\Email theme($theme = null) <ide> * @method \Cake\Mailer\Email setHelpers(array $helpers) <ide> * @method array getHelpers() <del> * @method \Cake\Mailer\Email helpers($helpers = null) <ide> * @method \Cake\Mailer\Email setEmailFormat($format) <ide> * @method string getEmailFormat() <del> * @method \Cake\Mailer\Email emailFormat($format = null) <ide> * @method \Cake\Mailer\Email setTransport($name) <ide> * @method \Cake\Mailer\AbstractTransport getTransport() <del> * @method \Cake\Mailer\Email transport($name = null) <ide> * @method \Cake\Mailer\Email setMessageId($message) <ide> * @method bool|string getMessageId() <del> * @method \Cake\Mailer\Email messageId($message = null) <ide> * @method \Cake\Mailer\Email setDomain($domain) <ide> * @method string getDomain() <del> * @method \Cake\Mailer\Email domain($domain = null) <ide> * @method \Cake\Mailer\Email setAttachments($attachments) <ide> * @method array getAttachments() <del> * @method \Cake\Mailer\Email attachments($attachments = null) <ide> * @method \Cake\Mailer\Email addAttachments($attachments) <ide> * @method \Cake\Mailer\Email message($type = null) <ide> * @method \Cake\Mailer\Email setProfile($config) <ide> * @method string|array getProfile() <del> * @method \Cake\Mailer\Email profile($config = null) <ide> */ <ide> abstract class Mailer implements EventListenerInterface <ide> {
1
Ruby
Ruby
remove redundant check
1f7df4881232246409be800783a59fce6d377483
<ide><path>Library/Homebrew/dev-cmd/audit.rb <ide> def audit_license <ide> <ide> github_license = GitHub.get_repo_license(user, repo) <ide> return unless github_license <del> return if github_license && (licenses + ["NOASSERTION"]).include?(github_license) <add> return if (licenses + ["NOASSERTION"]).include?(github_license) <ide> return if PERMITTED_LICENSE_MISMATCHES[github_license]&.any? { |license| licenses.include? license } <ide> return if PERMITTED_FORMULA_LICENSE_MISMATCHES[formula.name] == formula.version <ide>
1
Text
Text
update readme to warn about master being for 5.0
6cc1b5191bf3db67ffd302ba5931d6c1c49461ec
<ide><path>README.md <add>## Please Note! <add>The master branch is now the development branch for 5.0 and should be considered unstable until the first 5.0 release. If you're looking for the most recent stable release, please refer to the [stable branch](https://github.com/videojs/video.js/tree/stable). <add> <add> <ide> ![Video.js logo](https://i.cloudup.com/C3nAUZ-l4c.png) <ide> <ide> # [Video.js - HTML5 Video Player](http://videojs.com) [![Build Status](https://travis-ci.org/videojs/video.js.svg?branch=master)](https://travis-ci.org/videojs/video.js)
1
PHP
PHP
add core namespace
9e2b98076f1e6f99be8ede54b49c0bb56be9ff9c
<ide><path>src/Command/HelpCommand.php <ide> protected function asText($io, $commands) <ide> } <ide> <ide> /** <del> * @param string[] $names <add> * @param string[] $names Names <ide> * <ide> * @return string|null <ide> */ <ide> protected function findPrefixedName(array $names) <ide> } <ide> <ide> /** <del> * @param string[] $names <add> * @param string[] $names Names <ide> * @return string <ide> */ <ide> protected function getShortestName(array $names)
1
Javascript
Javascript
remove code that is not being used
96167d2ce66ff1fca87807fd9615df28003d92c8
<ide><path>src/worker.js <ide> * See the License for the specific language governing permissions and <ide> * limitations under the License. <ide> */ <del>/* globals CanvasGraphics, error, globalScope, InvalidPDFException, log, <add>/* globals error, globalScope, InvalidPDFException, log, <ide> MissingPDFException, PasswordException, PDFDocument, PDFJS, Promise, <ide> Stream, UnknownErrorException, warn */ <ide> <ide> var WorkerMessageHandler = { <ide> handler.on('RenderPageRequest', function wphSetupRenderPage(data) { <ide> var pageNum = data.pageIndex + 1; <ide> <del> // The following code does quite the same as <del> // Page.prototype.startRendering, but stops at one point and sends the <del> // result back to the main thread. <del> var gfx = new CanvasGraphics(null); <del> <ide> var start = Date.now(); <ide> <ide> var dependency = [];
1
Go
Go
remove the concept of a root dir out of engine
672edfe807c597a1c245bce996a150dfdf273a3c
<ide><path>docker/docker.go <ide> import ( <ide> "io/ioutil" <ide> "log" <ide> "os" <add> "runtime" <ide> "strings" <ide> <ide> "github.com/dotcloud/docker/api" <ide> func main() { <ide> } <ide> } <ide> <del> eng, err := engine.New(realRoot) <add> if err := checkKernelAndArch(); err != nil { <add> log.Fatal(err) <add> } <add> eng, err := engine.New() <ide> if err != nil { <ide> log.Fatal(err) <ide> } <ide> func main() { <ide> func showVersion() { <ide> fmt.Printf("Docker version %s, build %s\n", dockerversion.VERSION, dockerversion.GITCOMMIT) <ide> } <add> <add>func checkKernelAndArch() error { <add> // Check for unsupported architectures <add> if runtime.GOARCH != "amd64" { <add> return fmt.Errorf("The docker runtime currently only supports amd64 (not %s). This will change in the future. Aborting.", runtime.GOARCH) <add> } <add> // Check for unsupported kernel versions <add> // FIXME: it would be cleaner to not test for specific versions, but rather <add> // test for specific functionalities. <add> // Unfortunately we can't test for the feature "does not cause a kernel panic" <add> // without actually causing a kernel panic, so we need this workaround until <add> // the circumstances of pre-3.8 crashes are clearer. <add> // For details see http://github.com/dotcloud/docker/issues/407 <add> if k, err := utils.GetKernelVersion(); err != nil { <add> log.Printf("WARNING: %s\n", err) <add> } else { <add> if utils.CompareKernelVersion(k, &utils.KernelVersionInfo{Kernel: 3, Major: 8, Minor: 0}) < 0 { <add> if os.Getenv("DOCKER_NOWARN_KERNEL_VERSION") == "" { <add> log.Printf("WARNING: You are running linux kernel version %s, which might be unstable running docker. Please upgrade your kernel to 3.8.0.", k.String()) <add> } <add> } <add> } <add> return nil <add>} <ide><path>engine/engine.go <ide> import ( <ide> "fmt" <ide> "github.com/dotcloud/docker/utils" <ide> "io" <del> "log" <ide> "os" <del> "runtime" <ide> "sort" <ide> "strings" <ide> ) <ide> func unregister(name string) { <ide> // It acts as a store for *containers*, and allows manipulation of these <ide> // containers by executing *jobs*. <ide> type Engine struct { <del> root string <ide> handlers map[string]Handler <ide> hack Hack // data for temporary hackery (see hack.go) <ide> id string <ide> type Engine struct { <ide> Logging bool <ide> } <ide> <del>func (eng *Engine) Root() string { <del> return eng.root <del>} <del> <ide> func (eng *Engine) Register(name string, handler Handler) error { <ide> _, exists := eng.handlers[name] <ide> if exists { <ide> func (eng *Engine) Register(name string, handler Handler) error { <ide> return nil <ide> } <ide> <del>// New initializes a new engine managing the directory specified at `root`. <del>// `root` is used to store containers and any other state private to the engine. <del>// Changing the contents of the root without executing a job will cause unspecified <del>// behavior. <del>func New(root string) (*Engine, error) { <del> // Check for unsupported architectures <del> if runtime.GOARCH != "amd64" { <del> return nil, fmt.Errorf("The docker runtime currently only supports amd64 (not %s). This will change in the future. Aborting.", runtime.GOARCH) <del> } <del> // Check for unsupported kernel versions <del> // FIXME: it would be cleaner to not test for specific versions, but rather <del> // test for specific functionalities. <del> // Unfortunately we can't test for the feature "does not cause a kernel panic" <del> // without actually causing a kernel panic, so we need this workaround until <del> // the circumstances of pre-3.8 crashes are clearer. <del> // For details see http://github.com/dotcloud/docker/issues/407 <del> if k, err := utils.GetKernelVersion(); err != nil { <del> log.Printf("WARNING: %s\n", err) <del> } else { <del> if utils.CompareKernelVersion(k, &utils.KernelVersionInfo{Kernel: 3, Major: 8, Minor: 0}) < 0 { <del> if os.Getenv("DOCKER_NOWARN_KERNEL_VERSION") == "" { <del> log.Printf("WARNING: You are running linux kernel version %s, which might be unstable running docker. Please upgrade your kernel to 3.8.0.", k.String()) <del> } <del> } <del> } <del> <del> if err := os.MkdirAll(root, 0700); err != nil && !os.IsExist(err) { <del> return nil, err <del> } <del> <add>// New initializes a new engine. <add>func New() (*Engine, error) { <ide> eng := &Engine{ <del> root: root, <ide> handlers: make(map[string]Handler), <ide> id: utils.RandomString(), <ide> Stdout: os.Stdout, <ide> func New(root string) (*Engine, error) { <ide> } <ide> <ide> func (eng *Engine) String() string { <del> return fmt.Sprintf("%s|%s", eng.Root(), eng.id[:8]) <add> return fmt.Sprintf("%s", eng.id[:8]) <ide> } <ide> <ide> // Commands returns a list of all currently registered commands, <ide><path>engine/engine_test.go <ide> package engine <ide> <ide> import ( <ide> "bytes" <del> "io/ioutil" <del> "os" <del> "path" <del> "path/filepath" <ide> "strings" <ide> "testing" <ide> ) <ide> func TestJob(t *testing.T) { <ide> <ide> func TestEngineCommands(t *testing.T) { <ide> eng := newTestEngine(t) <del> defer os.RemoveAll(eng.Root()) <ide> handler := func(job *Job) Status { return StatusOK } <ide> eng.Register("foo", handler) <ide> eng.Register("bar", handler) <ide> func TestEngineCommands(t *testing.T) { <ide> } <ide> } <ide> <del>func TestEngineRoot(t *testing.T) { <del> tmp, err := ioutil.TempDir("", "docker-test-TestEngineCreateDir") <del> if err != nil { <del> t.Fatal(err) <del> } <del> defer os.RemoveAll(tmp) <del> // We expect Root to resolve to an absolute path. <del> // FIXME: this should not be necessary. <del> // Until the above FIXME is implemented, let's check for the <del> // current behavior. <del> tmp, err = filepath.EvalSymlinks(tmp) <del> if err != nil { <del> t.Fatal(err) <del> } <del> tmp, err = filepath.Abs(tmp) <del> if err != nil { <del> t.Fatal(err) <del> } <del> dir := path.Join(tmp, "dir") <del> eng, err := New(dir) <del> if err != nil { <del> t.Fatal(err) <del> } <del> if st, err := os.Stat(dir); err != nil { <del> t.Fatal(err) <del> } else if !st.IsDir() { <del> t.Fatalf("engine.New() created something other than a directory at %s", dir) <del> } <del> if r := eng.Root(); r != dir { <del> t.Fatalf("Expected: %v\nReceived: %v", dir, r) <del> } <del>} <del> <ide> func TestEngineString(t *testing.T) { <ide> eng1 := newTestEngine(t) <del> defer os.RemoveAll(eng1.Root()) <ide> eng2 := newTestEngine(t) <del> defer os.RemoveAll(eng2.Root()) <ide> s1 := eng1.String() <ide> s2 := eng2.String() <ide> if eng1 == eng2 { <ide> func TestEngineString(t *testing.T) { <ide> <ide> func TestEngineLogf(t *testing.T) { <ide> eng := newTestEngine(t) <del> defer os.RemoveAll(eng.Root()) <ide> input := "Test log line" <ide> if n, err := eng.Logf("%s\n", input); err != nil { <ide> t.Fatal(err) <ide> func TestEngineLogf(t *testing.T) { <ide> <ide> func TestParseJob(t *testing.T) { <ide> eng := newTestEngine(t) <del> defer os.RemoveAll(eng.Root()) <ide> // Verify that the resulting job calls to the right place <ide> var called bool <ide> eng.Register("echo", func(job *Job) Status { <ide><path>engine/helpers_test.go <ide> package engine <ide> <ide> import ( <del> "github.com/dotcloud/docker/utils" <ide> "testing" <ide> ) <ide> <ide> var globalTestID string <ide> <ide> func newTestEngine(t *testing.T) *Engine { <del> tmp, err := utils.TestDirectory("") <del> if err != nil { <del> t.Fatal(err) <del> } <del> eng, err := New(tmp) <add> eng, err := New() <ide> if err != nil { <ide> t.Fatal(err) <ide> } <ide><path>engine/job_test.go <ide> package engine <ide> <ide> import ( <del> "os" <ide> "testing" <ide> ) <ide> <ide> func TestJobStatusOK(t *testing.T) { <ide> eng := newTestEngine(t) <del> defer os.RemoveAll(eng.Root()) <ide> eng.Register("return_ok", func(job *Job) Status { return StatusOK }) <ide> err := eng.Job("return_ok").Run() <ide> if err != nil { <ide> func TestJobStatusOK(t *testing.T) { <ide> <ide> func TestJobStatusErr(t *testing.T) { <ide> eng := newTestEngine(t) <del> defer os.RemoveAll(eng.Root()) <ide> eng.Register("return_err", func(job *Job) Status { return StatusErr }) <ide> err := eng.Job("return_err").Run() <ide> if err == nil { <ide> func TestJobStatusErr(t *testing.T) { <ide> <ide> func TestJobStatusNotFound(t *testing.T) { <ide> eng := newTestEngine(t) <del> defer os.RemoveAll(eng.Root()) <ide> eng.Register("return_not_found", func(job *Job) Status { return StatusNotFound }) <ide> err := eng.Job("return_not_found").Run() <ide> if err == nil { <ide> func TestJobStatusNotFound(t *testing.T) { <ide> <ide> func TestJobStdoutString(t *testing.T) { <ide> eng := newTestEngine(t) <del> defer os.RemoveAll(eng.Root()) <ide> // FIXME: test multiple combinations of output and status <ide> eng.Register("say_something_in_stdout", func(job *Job) Status { <ide> job.Printf("Hello world\n") <ide> func TestJobStdoutString(t *testing.T) { <ide> <ide> func TestJobStderrString(t *testing.T) { <ide> eng := newTestEngine(t) <del> defer os.RemoveAll(eng.Root()) <ide> // FIXME: test multiple combinations of output and status <ide> eng.Register("say_something_in_stderr", func(job *Job) Status { <ide> job.Errorf("Warning, something might happen\nHere it comes!\nOh no...\nSomething happened\n") <ide><path>integration/runtime_test.go <ide> func TestRestore(t *testing.T) { <ide> <ide> // Here are are simulating a docker restart - that is, reloading all containers <ide> // from scratch <del> eng = newTestEngine(t, false, eng.Root()) <del> daemon2 := mkDaemonFromEngine(eng, t) <del> if len(daemon2.List()) != 2 { <del> t.Errorf("Expected 2 container, %v found", len(daemon2.List())) <add> eng = newTestEngine(t, false, runtime.Config().Root) <add> if len(runtime2.List()) != 2 { <add> t.Errorf("Expected 2 container, %v found", len(runtime2.List())) <ide> } <ide> runningCount := 0 <ide> for _, c := range daemon2.List() { <ide><path>integration/server_test.go <ide> func TestRestartKillWait(t *testing.T) { <ide> t.Fatal(err) <ide> } <ide> <del> eng = newTestEngine(t, false, eng.Root()) <add> eng = newTestEngine(t, false, runtime.Config().Root) <ide> srv = mkServerFromEngine(eng, t) <ide> <ide> job = srv.Eng.Job("containers") <ide><path>integration/utils_test.go <ide> func newTestEngine(t utils.Fataler, autorestart bool, root string) *engine.Engin <ide> root = dir <ide> } <ide> } <del> eng, err := engine.New(root) <add> eng, err := engine.New() <ide> if err != nil { <ide> t.Fatal(err) <ide> }
8
Javascript
Javascript
convert algorithm to iterative, use less memory
beccf941a98643c57de81007e2ad12f914cfd745
<ide><path>lib/Chunk.js <ide> class Chunk { <ide> } <ide> <ide> getChunkMaps(includeEntries, realHash) { <del> const chunksProcessed = new Set(); <ide> const chunkHashMap = Object.create(null); <ide> const chunkNameMap = Object.create(null); <del> const addChunk = chunk => { <del> if(chunksProcessed.has(chunk)) return; <del> chunksProcessed.add(chunk); <add> <add> const queue = [this]; <add> const chunksEnqueued = new Set([this]); <add> <add> while(queue.length > 0) { <add> const chunk = queue.pop(); <ide> if(!chunk.hasRuntime() || includeEntries) { <ide> chunkHashMap[chunk.id] = realHash ? chunk.hash : chunk.renderedHash; <ide> if(chunk.name) <ide> chunkNameMap[chunk.id] = chunk.name; <ide> } <del> chunk._chunks.forEach(addChunk); <del> }; <del> addChunk(this); <add> for(const child of chunk.chunksIterable) { <add> if(chunksEnqueued.has(child)) continue; <add> chunksEnqueued.add(child); <add> queue.push(child); <add> } <add> } <add> <ide> return { <ide> hash: chunkHashMap, <ide> name: chunkNameMap <ide> }; <ide> } <ide> <ide> getChunkModuleMaps(includeEntries, filterFn) { <del> const chunksProcessed = new Set(); <ide> const chunkModuleIdMap = Object.create(null); <ide> const chunkModuleHashMap = Object.create(null); <del> (function addChunk(chunk) { <del> if(chunksProcessed.has(chunk)) return; <del> chunksProcessed.add(chunk); <add> <add> const chunksEnqueued = new Set([this]); <add> const queue = [this]; <add> <add> while(queue.length > 0) { <add> const chunk = queue.pop(); <ide> if(!chunk.hasRuntime() || includeEntries) { <del> const array = chunk.getModules().filter(filterFn); <del> if(array.length > 0) <del> chunkModuleIdMap[chunk.id] = array.map(m => m.id).sort(); <del> for(const m of array) { <del> chunkModuleHashMap[m.id] = m.renderedHash; <add> let array = undefined; <add> for(const module of chunk.modulesIterable) { <add> if(filterFn(module)) { <add> if(array === undefined) { <add> array = []; <add> chunkModuleIdMap[chunk.id] = array; <add> } <add> array.push(module.id); <add> chunkModuleHashMap[module.id] = module.renderedHash; <add> } <add> } <add> if(array !== undefined) { <add> array.sort(); <ide> } <ide> } <del> chunk._chunks.forEach(addChunk); <del> }(this)); <add> for(const child of chunk.chunksIterable) { <add> if(chunksEnqueued.has(child)) continue; <add> chunksEnqueued.add(child); <add> queue.push(child); <add> } <add> } <add> <ide> return { <ide> id: chunkModuleIdMap, <ide> hash: chunkModuleHashMap <ide> class Chunk { <ide> <ide> while(queue.length > 0) { <ide> const chunk = queue.pop(); <del> if(chunk.getModules().some(filterFn)) <del> return true; <add> for(const module of chunk.modulesIterable) <add> if(filterFn(module)) <add> return true; <ide> for(const next of chunk.chunksIterable) { <ide> if(!chunksProcessed.has(next)) { <ide> chunksProcessed.add(next);
1
Javascript
Javascript
use taskkill to stop the browser on windows
5cce7377afde8e6843199fe647415f1a1c7d3100
<ide><path>test/webbrowser.js <ide> var fs = require('fs'); <ide> var path = require('path'); <ide> var spawn = require('child_process').spawn; <ide> var testUtils = require('./testutils.js'); <add>var shelljs = require('shelljs'); <ide> <ide> var tempDirPrefix = 'pdfjs_'; <ide> <ide> WebBrowser.prototype = { <ide> } <ide> <ide> if (this.process) { <del> this.process.kill('SIGTERM'); <add> if (process.platform === 'win32') { <add> // process.kill is not reliable on Windows (Firefox sticks around). The <add> // work-around was to manually open the task manager and terminate the <add> // process. Instead of doing that manually, use taskkill to kill. <add> // (https://technet.microsoft.com/en-us/library/cc725602.aspx) <add> var result = shelljs.exec('taskkill /f /t /pid ' + this.process.pid); <add> if (result.code) { <add> console.error('taskkill failed with exit code ' + result.code); <add> } <add> } else { <add> this.process.kill('SIGTERM'); <add> } <ide> } <ide> } <ide> }; <ide> WebBrowser.create = function (desc) { <ide> }; <ide> <ide> <del>exports.WebBrowser = WebBrowser; <ide>\ No newline at end of file <add>exports.WebBrowser = WebBrowser;
1
Text
Text
add release notes for 3.0.5
f6033cee87e367ec3a6ffcdd6897656b3e3c0493
<ide><path>docs/topics/release-notes.md <ide> You can determine your currently installed version using `pip freeze`: <ide> ## 3.0.x series <ide> <ide> <add>### 3.0.5 <add> <add>**Date**: [10th February 2015][3.0.5-milestone]. <add> <add>* Fix a bug where `_closable_objects` breaks pickling. ([#1850][gh1850], [#2492][gh2492]) <add>* Allow non-standard `User` models with `Throttling`. ([#2524][gh2524]) <add>* Support custom `User.db_table` in TokenAuthentication migration. ([#2479][gh2479]) <add>* Fix misleading `AttributeError` tracebacks on `Request` objects. ([#2530][gh2530], [#2108][gh2108]) <add>* `ManyRelatedField.get_value` clearing field on partial update. ([#2475][gh2475]) <add>* Removed '.model' shortcut from code. ([#2486][gh2486]) <add>* Fix `detail_route` and `list_route` mutable argument. ([#2518][gh2518]) <add>* Prefetching the user object when getting the token in `TokenAuthentication`. ([#2519][gh2519]) <add> <ide> ### 3.0.4 <ide> <ide> **Date**: [28th January 2015][3.0.4-milestone]. <ide> For older release notes, [please see the GitHub repo](old-release-notes). <ide> [3.0.2-milestone]: https://github.com/tomchristie/django-rest-framework/issues?q=milestone%3A%223.0.2+Release%22 <ide> [3.0.3-milestone]: https://github.com/tomchristie/django-rest-framework/issues?q=milestone%3A%223.0.3+Release%22 <ide> [3.0.4-milestone]: https://github.com/tomchristie/django-rest-framework/issues?q=milestone%3A%223.0.4+Release%22 <add>[3.0.5-milestone]: https://github.com/tomchristie/django-rest-framework/issues?q=milestone%3A%223.0.5+Release%22 <ide> <ide> <!-- 3.0.1 --> <ide> [gh2013]: https://github.com/tomchristie/django-rest-framework/issues/2013 <ide> For older release notes, [please see the GitHub repo](old-release-notes). <ide> [gh2399]: https://github.com/tomchristie/django-rest-framework/issues/2399 <ide> [gh2388]: https://github.com/tomchristie/django-rest-framework/issues/2388 <ide> [gh2360]: https://github.com/tomchristie/django-rest-framework/issues/2360 <add><!-- 3.0.5 --> <add>[gh1850]: https://github.com/tomchristie/django-rest-framework/issues/1850 <add>[gh2108]: https://github.com/tomchristie/django-rest-framework/issues/2108 <add>[gh2475]: https://github.com/tomchristie/django-rest-framework/issues/2475 <add>[gh2479]: https://github.com/tomchristie/django-rest-framework/issues/2479 <add>[gh2486]: https://github.com/tomchristie/django-rest-framework/issues/2486 <add>[gh2492]: https://github.com/tomchristie/django-rest-framework/issues/2492 <add>[gh2518]: https://github.com/tomchristie/django-rest-framework/issues/2518 <add>[gh2519]: https://github.com/tomchristie/django-rest-framework/issues/2519 <add>[gh2524]: https://github.com/tomchristie/django-rest-framework/issues/2524 <add>[gh2530]: https://github.com/tomchristie/django-rest-framework/issues/2530
1
Javascript
Javascript
use rollup legacy mode for www builds
b6a7beefe48d7df9e04cc214b8ef8ea18fe80f39
<ide><path>scripts/rollup/build.js <ide> function createBundle(bundle, bundleType) { <ide> bundle.modulesToStub, <ide> bundle.featureFlags <ide> ), <add> // We can't use getters in www. <add> legacy: bundleType === FB_DEV || bundleType === FB_PROD, <ide> }) <ide> .then(result => <ide> result.write(
1
Text
Text
remove reference to attr_accessible
e8b26258d0365d57f51eb81b7162fe576da5f6da
<ide><path>guides/source/getting_started.md <ide> The model file, `app/models/post.rb` is about as simple as it can get: <ide> <ide> ```ruby <ide> class Post < ActiveRecord::Base <del> attr_accessible :text, :title <ide> end <ide> ``` <ide> <ide> your Rails models for free, including basic database CRUD (Create, Read, Update, <ide> Destroy) operations, data validation, as well as sophisticated search support <ide> and the ability to relate multiple models to one another. <ide> <del>Rails includes methods to help you secure some of your model fields. The Rails <del>model generator added the `attr_accessible` line to your model file. This change <del>will ensure that all changes made through HTML forms can edit the content of <del>the text and title fields. Accessible attributes and the mass assignment problem is covered in <del>details in the [Security guide](security.html#mass-assignment) <del> <ide> ### Adding Some Validation <ide> <ide> Rails includes methods to help you validate the data that you send to models. <ide> Open the `app/models/post.rb` file and edit it: <ide> <ide> ```ruby <ide> class Post < ActiveRecord::Base <del> attr_accessible :text, :title <del> <ide> validates :title, presence: true, <ide> length: { minimum: 5 } <ide> end <ide> First, take a look at `comment.rb`: <ide> ```ruby <ide> class Comment < ActiveRecord::Base <ide> belongs_to :post <del> attr_accessible :body, :commenter <ide> end <ide> ``` <ide> <ide> makes each comment belong to a Post: <ide> ```ruby <ide> class Comment < ActiveRecord::Base <ide> belongs_to :post <del> attr_accessible :body, :commenter <ide> end <ide> ``` <ide>
1
Python
Python
kick travis. meh
31f45907e559b379b662260032fdabaf7517db7f
<ide><path>rest_framework/__init__.py <ide> <ide> VERSION = __version__ # synonym <ide> <add> <ide> # Header encoding (see RFC5987) <ide> HTTP_HEADER_ENCODING = 'iso-8859-1'
1
Python
Python
add test for loadtxt with none as string type
8697b9cc58815efb16045542833ee30f2623325b
<ide><path>numpy/lib/tests/test_io.py <ide> def test_bad_line(self): <ide> # Check for exception and that exception contains line number <ide> assert_raises_regex(ValueError, "3", np.loadtxt, c) <ide> <add> def test_none_as_string(self): <add> # gh-5155, None should work as string when format demands it <add> c = TextIO() <add> c.write('100,foo,200\n300,None,400') <add> c.seek(0) <add> dt = np.dtype([('x', int), ('a', 'S10'), ('y', int)]) <add> data = np.loadtxt(c, delimiter=',', dtype=dt, comments=None) <add> <ide> <ide> class Testfromregex(TestCase): <ide> # np.fromregex expects files opened in binary mode.
1
Javascript
Javascript
move domain handling from events to domain
cf4448cbd48e2da0f9461709f27b6cb41ddd2c87
<ide><path>lib/domain.js <ide> const EventEmitter = require('events'); <ide> const errors = require('internal/errors'); <ide> const { createHook } = require('async_hooks'); <ide> <del>// communicate with events module, but don't require that <del>// module to have to load this one, since this module has <del>// a few side effects. <del>EventEmitter.usingDomains = true; <del> <ide> // overwrite process.domain with a getter/setter that will allow for more <ide> // effective optimizations <ide> var _domain = [null]; <ide> Domain.prototype.bind = function(cb) { <ide> <ide> return runBound; <ide> }; <add> <add>// Override EventEmitter methods to make it domain-aware. <add>EventEmitter.usingDomains = true; <add> <add>const eventInit = EventEmitter.init; <add>EventEmitter.init = function() { <add> this.domain = null; <add> if (exports.active && !(this instanceof exports.Domain)) { <add> this.domain = exports.active; <add> } <add> <add> return eventInit.call(this); <add>}; <add> <add>const eventEmit = EventEmitter.prototype.emit; <add>EventEmitter.prototype.emit = function emit(...args) { <add> const domain = this.domain; <add> if (domain === null || domain === undefined || this === process) { <add> return eventEmit.apply(this, args); <add> } <add> <add> const type = args[0]; <add> // edge case: if there is a domain and an existing non error object is given, <add> // it should not be errorized <add> // see test/parallel/test-event-emitter-no-error-provided-to-error-event.js <add> if (type === 'error' && args.length > 1 && args[1] && <add> !(args[1] instanceof Error)) { <add> domain.emit('error', args[1]); <add> return false; <add> } <add> <add> domain.enter(); <add> try { <add> return eventEmit.apply(this, args); <add> } catch (er) { <add> if (typeof er === 'object' && er !== null) { <add> er.domainEmitter = this; <add> er.domain = domain; <add> er.domainThrown = false; <add> } <add> domain.emit('error', er); <add> return false; <add> } finally { <add> domain.exit(); <add> } <add>}; <ide><path>lib/events.js <ide> <ide> 'use strict'; <ide> <del>var domain; <ide> var spliceOne; <ide> <ide> function EventEmitter() { <ide> module.exports = EventEmitter; <ide> // Backwards-compat with node 0.10.x <ide> EventEmitter.EventEmitter = EventEmitter; <ide> <del>EventEmitter.usingDomains = false; <del> <del>EventEmitter.prototype.domain = undefined; <ide> EventEmitter.prototype._events = undefined; <ide> EventEmitter.prototype._maxListeners = undefined; <ide> <ide> Object.defineProperty(EventEmitter, 'defaultMaxListeners', { <ide> }); <ide> <ide> EventEmitter.init = function() { <del> this.domain = null; <del> if (EventEmitter.usingDomains) { <del> // if there is an active domain, then attach to it. <del> domain = domain || require('domain'); <del> if (domain.active && !(this instanceof domain.Domain)) { <del> this.domain = domain.active; <del> } <del> } <ide> <ide> if (this._events === undefined || <ide> this._events === Object.getPrototypeOf(this)._events) { <ide> EventEmitter.prototype.emit = function emit(type, ...args) { <ide> else if (!doError) <ide> return false; <ide> <del> const domain = this.domain; <del> <ide> // If there is no 'error' event listener then throw. <ide> if (doError) { <ide> let er; <ide> if (args.length > 0) <ide> er = args[0]; <del> if (domain !== null && domain !== undefined) { <del> if (!er) { <del> const errors = lazyErrors(); <del> er = new errors.Error('ERR_UNHANDLED_ERROR'); <del> } <del> if (typeof er === 'object' && er !== null) { <del> er.domainEmitter = this; <del> er.domain = domain; <del> er.domainThrown = false; <del> } <del> domain.emit('error', er); <del> } else if (er instanceof Error) { <add> if (er instanceof Error) { <ide> throw er; // Unhandled 'error' event <del> } else { <del> // At least give some kind of context to the user <del> const errors = lazyErrors(); <del> const err = new errors.Error('ERR_UNHANDLED_ERROR', er); <del> err.context = er; <del> throw err; <ide> } <del> return false; <add> // At least give some kind of context to the user <add> const errors = lazyErrors(); <add> const err = new errors.Error('ERR_UNHANDLED_ERROR', er); <add> err.context = er; <add> throw err; <ide> } <ide> <ide> const handler = events[type]; <ide> <ide> if (handler === undefined) <ide> return false; <ide> <del> let needDomainExit = false; <del> if (domain !== null && domain !== undefined && this !== process) { <del> domain.enter(); <del> needDomainExit = true; <del> } <del> <ide> if (typeof handler === 'function') { <ide> handler.apply(this, args); <ide> } else { <ide> EventEmitter.prototype.emit = function emit(type, ...args) { <ide> listeners[i].apply(this, args); <ide> } <ide> <del> if (needDomainExit) <del> domain.exit(); <del> <ide> return true; <ide> }; <ide>
2
Python
Python
allow zip64 extensions in .npz files; allows > 2gb
68e31fe815e0cb6276970a1c365f21e187d10ca0
<ide><path>numpy/lib/npyio.py <ide> def __getattribute__(self, key): <ide> except KeyError: <ide> raise AttributeError, key <ide> <del> <add>def zipfile_factory(*args, **kwargs): <add> import zipfile <add> if sys.version_info >= (2, 5): <add> kwargs['allowZip64'] = True <add> return zipfile.ZipFile(*args, **kwargs) <ide> <ide> class NpzFile(object): <ide> """ <ide> class NpzFile(object): <ide> def __init__(self, fid, own_fid=False): <ide> # Import is postponed to here since zipfile depends on gzip, an optional <ide> # component of the so-called standard library. <del> import zipfile <del> _zip = zipfile.ZipFile(fid) <add> _zip = zipfile_factory(fid) <ide> self._files = _zip.namelist() <ide> self.files = [] <ide> for x in self._files: <ide> def _savez(file, args, kwds, compress): <ide> else: <ide> compression = zipfile.ZIP_STORED <ide> <del> zip = zipfile.ZipFile(file, mode="w", compression=compression) <add> zip = zipfile_factory(file, mode="w", compression=compression) <ide> <ide> # Stage arrays in a temporary file on disk, before writing to zip. <ide> fd, tmpfile = tempfile.mkstemp(suffix='-numpy.npy')
1
Python
Python
fix error with torch.no_grad and loss computation
2d07f945adfd41389b5dd45d85af37d404a09599
<ide><path>hubconfs/bert_hubconf.py <ide> def bertForSequenceClassification(*args, **kwargs): <ide> seq_classif_logits = model(tokens_tensor, segments_tensors) <ide> # Or get the sequence classification loss <ide> >>> labels = torch.tensor([1]) <del> >>> with torch.no_grad(): <del> seq_classif_loss = model(tokens_tensor, segments_tensors, labels=labels) <add> >>> seq_classif_loss = model(tokens_tensor, segments_tensors, labels=labels) <ide> """ <ide> model = BertForSequenceClassification.from_pretrained(*args, **kwargs) <ide> return model <ide> def bertForMultipleChoice(*args, **kwargs): <ide> multiple_choice_logits = model(tokens_tensor, segments_tensors) <ide> # Or get the multiple choice loss <ide> >>> labels = torch.tensor([1]) <del> >>> with torch.no_grad(): <del> multiple_choice_loss = model(tokens_tensor, segments_tensors, labels=labels) <add> >>> multiple_choice_loss = model(tokens_tensor, segments_tensors, labels=labels) <ide> """ <ide> model = BertForMultipleChoice.from_pretrained(*args, **kwargs) <ide> return model <ide> def bertForQuestionAnswering(*args, **kwargs): <ide> start_logits, end_logits = model(tokens_tensor, segments_tensors) <ide> # Or get the total loss which is the sum of the CrossEntropy loss for the start and end token positions <ide> >>> start_positions, end_positions = torch.tensor([12]), torch.tensor([14]) <del> >>> with torch.no_grad(): <del> multiple_choice_loss = model(tokens_tensor, segments_tensors, start_positions=start_positions, end_positions=end_positions) <add> >>> multiple_choice_loss = model(tokens_tensor, segments_tensors, start_positions=start_positions, end_positions=end_positions) <ide> """ <ide> model = BertForQuestionAnswering.from_pretrained(*args, **kwargs) <ide> return model <ide> def bertForTokenClassification(*args, **kwargs): <ide> classif_logits = model(tokens_tensor, segments_tensors) <ide> # Or get the token classification loss <ide> >>> labels = torch.tensor([[0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 0]]) <del> >>> with torch.no_grad(): <del> classif_loss = model(tokens_tensor, segments_tensors, labels=labels) <add> >>> classif_loss = model(tokens_tensor, segments_tensors, labels=labels) <ide> """ <ide> model = BertForTokenClassification.from_pretrained(*args, **kwargs) <ide> return model
1
Javascript
Javascript
extract listener check as a function
a3d9168293b6646a3f183ad9d27d6f969b88576f
<ide><path>lib/events.js <ide> function lazyErrors() { <ide> return errors; <ide> } <ide> <add>function checkListener(listener) { <add> if (typeof listener !== 'function') { <add> const errors = lazyErrors(); <add> throw new errors.ERR_INVALID_ARG_TYPE('listener', 'Function', listener); <add> } <add>} <add> <ide> Object.defineProperty(EventEmitter, 'defaultMaxListeners', { <ide> enumerable: true, <ide> get: function() { <ide> function _addListener(target, type, listener, prepend) { <ide> var events; <ide> var existing; <ide> <del> if (typeof listener !== 'function') { <del> const errors = lazyErrors(); <del> throw new errors.ERR_INVALID_ARG_TYPE('listener', 'Function', listener); <del> } <add> checkListener(listener); <ide> <ide> events = target._events; <ide> if (events === undefined) { <ide> function _onceWrap(target, type, listener) { <ide> } <ide> <ide> EventEmitter.prototype.once = function once(type, listener) { <del> if (typeof listener !== 'function') { <del> const errors = lazyErrors(); <del> throw new errors.ERR_INVALID_ARG_TYPE('listener', 'Function', listener); <del> } <add> checkListener(listener); <add> <ide> this.on(type, _onceWrap(this, type, listener)); <ide> return this; <ide> }; <ide> <ide> EventEmitter.prototype.prependOnceListener = <ide> function prependOnceListener(type, listener) { <del> if (typeof listener !== 'function') { <del> const errors = lazyErrors(); <del> throw new errors.ERR_INVALID_ARG_TYPE('listener', 'Function', listener); <del> } <add> checkListener(listener); <add> <ide> this.prependListener(type, _onceWrap(this, type, listener)); <ide> return this; <ide> }; <ide> EventEmitter.prototype.removeListener = <ide> function removeListener(type, listener) { <ide> var list, events, position, i, originalListener; <ide> <del> if (typeof listener !== 'function') { <del> const errors = lazyErrors(); <del> throw new errors.ERR_INVALID_ARG_TYPE('listener', 'Function', listener); <del> } <add> checkListener(listener); <ide> <ide> events = this._events; <ide> if (events === undefined)
1
Mixed
Ruby
fix controller test not resetting @_url_options
a351149e805910cd980bee1558e56e61c4a82db2
<ide><path>actionpack/CHANGELOG.md <add>* Fix URL generation in controller tests with request-dependent <add> `default_url_options` methods. <add> <add> *Tony Wooster* <add> <ide> Please check [4-1-stable](https://github.com/rails/rails/blob/4-1-stable/actionpack/CHANGELOG.md) for previous changes. <ide><path>actionpack/lib/action_controller/metal/testing.rb <ide> def set_response!(request) <ide> <ide> def recycle! <ide> @_url_options = nil <del> self.response_body = nil <ide> self.formats = nil <ide> self.params = nil <ide> end <ide><path>actionpack/lib/action_controller/test_case.rb <ide> def process(action, http_method = 'GET', *args) <ide> <ide> name = @request.parameters[:action] <ide> <add> @controller.recycle! <ide> @controller.process(name) <ide> <ide> if cookies = @request.env['action_dispatch.cookies'] <ide><path>actionpack/test/controller/test_case_test.rb <ide> def view_assigns <ide> end <ide> end <ide> <add> class DefaultUrlOptionsCachingController < ActionController::Base <add> before_filter { @dynamic_opt = 'opt' } <add> <add> def test_url_options_reset <add> render text: url_for(params) <add> end <add> <add> def default_url_options <add> if defined?(@dynamic_opt) <add> super.merge dynamic_opt: @dynamic_opt <add> else <add> super <add> end <add> end <add> end <add> <add> def test_url_options_reset <add> @controller = DefaultUrlOptionsCachingController.new <add> get :test_url_options_reset <add> assert_nil @request.params['dynamic_opt'] <add> assert_match(/dynamic_opt=opt/, @response.body) <add> end <add> <ide> def test_raw_post_handling <ide> params = Hash[:page, {:name => 'page name'}, 'some key', 123] <ide> post :render_raw_post, params.dup
4
Javascript
Javascript
add pointerenter/leave priorities
148f8e497c7d37a3c7ab99f01dec2692427272b1
<ide><path>packages/react-dom/src/events/ReactDOMEventListener.js <ide> export function getEventPriority(domEventName: DOMEventName): * { <ide> // eslint-disable-next-line no-fallthrough <ide> case 'mouseenter': <ide> case 'mouseleave': <add> case 'pointerenter': <add> case 'pointerleave': <ide> return ContinuousEventPriority; <ide> case 'message': { <ide> // We might be in the Scheduler callback.
1
Text
Text
fix broken link
060a3b632f6f6ff2f84235d1be5da55020c40ff3
<ide><path>docs/api-guide/pagination.md <ide> The [`drf-proxy-pagination` package][drf-proxy-pagination] includes a `ProxyPagi <ide> <ide> ## link-header-pagination <ide> <del>The [`django-rest-framework-link-header-pagination` package][drf-link-header-pagination] includes a `LinkHeaderPagination` class which provides pagination via an HTTP `Link` header as described in [Github's developer documentation](github-link-pagination). <add>The [`django-rest-framework-link-header-pagination` package][drf-link-header-pagination] includes a `LinkHeaderPagination` class which provides pagination via an HTTP `Link` header as described in [GitHub REST API documentation][github-traversing-with-pagination]. <ide> <ide> [cite]: https://docs.djangoproject.com/en/stable/topics/pagination/ <ide> [link-header]: ../img/link-header-pagination.png <ide> The [`django-rest-framework-link-header-pagination` package][drf-link-header-pag <ide> [drf-link-header-pagination]: https://github.com/tbeadle/django-rest-framework-link-header-pagination <ide> [disqus-cursor-api]: https://cra.mr/2011/03/08/building-cursors-for-the-disqus-api <ide> [float_cursor_pagination_example]: https://gist.github.com/keturn/8bc88525a183fd41c73ffb729b8865be#file-fpcursorpagination-py <add>[github-traversing-with-pagination]: https://docs.github.com/en/rest/guides/traversing-with-pagination
1
Ruby
Ruby
remove duplicate letter 'a'. [ci skip]
33eec08dfd5672ffdd84a9d00e6115144bfa8bc7
<ide><path>actionpack/lib/action_controller/metal/responder.rb <ide> module ActionController #:nodoc: <ide> # <ide> # respond_with(@project, location: root_path) <ide> # <del> # To customize the failure scenario, you can pass a a block to <add> # To customize the failure scenario, you can pass a block to <ide> # <code>respond_with</code>: <ide> # <ide> # def create
1
Javascript
Javascript
register initial route (#508)
af2d78c042e02fe79b52e68a6c313655c359787a
<ide><path>lib/router/router.js <del>import { parse } from 'url' <add>import { parse, format } from 'url' <ide> import evalScript from '../eval-script' <ide> import shallowEquals from '../shallow-equals' <ide> <ide> export default class Router { <ide> this.onPopState = this.onPopState.bind(this) <ide> <ide> if (typeof window !== 'undefined') { <add> // in order for `e.state` to work on the `onpopstate` event <add> // we have to register the initial route upon initialization <add> this.replace(format({ pathname, query }), getURL()) <add> <ide> window.addEventListener('popstate', this.onPopState) <ide> } <ide> } <ide> export default class Router { <ide> console.error(err) <ide> } <ide> <del> if (getURL() !== url) { <add> if (method !== 'pushState' || getURL() !== url) { <ide> window.history[method]({ route }, null, url) <ide> } <ide>
1
PHP
PHP
add tests for multi-row inserts
95155f772912f9b339e9da9fc1a61b9f19fdcc8b
<ide><path>tests/Database/DatabaseEloquentIntegrationTest.php <ide> public function testBasicMorphManyRelationship() <ide> $this->assertEquals('First Post', $photos[3]->imageable->name); <ide> } <ide> <add> <add> public function testMultiInsertsWithDifferentValues() <add> { <add> $date = '1970-01-01'; <add> $result = EloquentTestPost::insert([ <add> ['user_id' => 1, 'name' => 'Post', 'created_at' => $date, 'updated_at' => $date], <add> ['user_id' => 2, 'name' => 'Post', 'created_at' => $date, 'updated_at' => $date], <add> ]); <add> <add> $this->assertTrue($result); <add> $this->assertEquals(2, EloquentTestPost::count()); <add> } <add> <add> <add> public function testMultiInsertsWithSameValues() <add> { <add> $date = '1970-01-01'; <add> $result = EloquentTestPost::insert([ <add> ['user_id' => 1, 'name' => 'Post', 'created_at' => $date, 'updated_at' => $date], <add> ['user_id' => 1, 'name' => 'Post', 'created_at' => $date, 'updated_at' => $date], <add> ]); <add> <add> $this->assertTrue($result); <add> $this->assertEquals(2, EloquentTestPost::count()); <add> } <add> <ide> /** <ide> * Helpers... <ide> */
1
Javascript
Javascript
fix references to undefined `cb`
873297753642e77fb556d13a0e4bc228f34171bd
<ide><path>lib/_tls_wrap.js <ide> function oncertcb(info) { <ide> return self.destroy(err); <ide> <ide> if (!self._handle) <del> return cb(new Error('Socket is closed')); <add> return self.destroy(new Error('Socket is closed')); <ide> <ide> self._handle.certCbDone(); <ide> }); <ide> function onnewsession(key, session) { <ide> once = true; <ide> <ide> if (!self._handle) <del> return cb(new Error('Socket is closed')); <add> return self.destroy(new Error('Socket is closed')); <ide> <ide> self._handle.newSessionDone(); <ide>
1
Javascript
Javascript
add accessor function to isvalid
7a36cb42187f15f08782807e33ee50de9ab24245
<ide><path>src/lib/duration/constructor.js <ide> export function Duration (duration) { <ide> var normalizedInput = normalizeObjectUnits(duration); <ide> <ide> this._isValid = isDurationValid(normalizedInput); <add> this.isValid = () => this._isValid; <ide> <ide> var years = this._isValid && normalizedInput.year || 0, <ide> quarters = this._isValid && normalizedInput.quarter || 0, <ide><path>src/test/moment/duration.js <ide> test('milliseconds instantiation', function (assert) { <ide> <ide> test('undefined instantiation', function (assert) { <ide> assert.equal(moment.duration(undefined).milliseconds(), 0, 'milliseconds'); <del> assert.equal(moment.duration(undefined)._isValid, true, '_isValid'); <add> assert.equal(moment.duration(undefined).isValid(), true, '_isValid'); <ide> }); <ide> <ide> test('null instantiation', function (assert) { <ide> assert.equal(moment.duration(null).milliseconds(), 0, 'milliseconds'); <del> assert.equal(moment.duration(null)._isValid, true, '_isValid'); <add> assert.equal(moment.duration(null).isValid(), true, '_isValid'); <ide> }); <ide> <ide> test('NaN instantiation', function (assert) { <ide> assert.equal(moment.duration(NaN).milliseconds(), 0, 'milliseconds'); <del> assert.equal(moment.duration(NaN)._isValid, false, '_isValid'); <add> assert.equal(moment.duration(NaN).isValid(), false, '_isValid'); <ide> }); <ide> <ide> test('instantiation by type', function (assert) {
2
Text
Text
fix return value of language.update (closes )
7534f7cb44a950232ad427f217c99fbea5ca8b37
<ide><path>website/docs/api/language.md <ide> Update the models in the pipeline. <ide> | `drop` | float | The dropout rate. | <ide> | `sgd` | callable | An optimizer. | <ide> | `component_cfg` <Tag variant="new">2.1</Tag> | dict | Config parameters for specific pipeline components, keyed by component name. | <del>| **RETURNS** | dict | Results from the update. | <ide> <ide> ## Language.begin_training {#begin_training tag="method"} <ide>
1
Ruby
Ruby
fix a merge fail syntax issue
476aca0967730360c31bc9aa5c08cf6aa7c0c9fe
<ide><path>lib/action_cable/channel/base.rb <ide> class Base <ide> SUBSCRIPTION_CONFIRMATION_INTERNAL_MESSAGE = 'confirm_subscription'.freeze <ide> SUBSCRIPTION_REJECTION_INTERNAL_MESSAGE = 'reject_subscription'.freeze <ide> <del> attr_reader :params, :connection, ::identifier <add> attr_reader :params, :connection, :identifier <ide> delegate :logger, to: :connection <ide> <ide> class << self
1
Javascript
Javascript
check undefined tagname for svg event target
74eb17d7c8232f72f134bf2546f10fed7234d276
<ide><path>src/ngTouch/directive/ngClick.js <ide> 'use strict'; <ide> <del>/* global ngTouch: false */ <add>/* global ngTouch: false, <add> nodeName_: false <add>*/ <ide> <ide> /** <ide> * @ngdoc directive <ide> ngTouch.directive('ngClick', ['$parse', '$timeout', '$rootElement', <ide> lastLabelClickCoordinates = null; <ide> } <ide> // remember label click coordinates to prevent click busting of trigger click event on input <del> if (event.target.tagName.toLowerCase() === 'label') { <add> if (nodeName_(event.target) === 'label') { <ide> lastLabelClickCoordinates = [x, y]; <ide> } <ide> <ide> ngTouch.directive('ngClick', ['$parse', '$timeout', '$rootElement', <ide> event.preventDefault(); <ide> <ide> // Blur focused form elements <del> event.target && event.target.blur(); <add> event.target && event.target.blur && event.target.blur(); <ide> } <ide> <ide> <ide><path>src/ngTouch/touch.js <ide> /* global -ngTouch */ <ide> var ngTouch = angular.module('ngTouch', []); <ide> <add>function nodeName_(element) { <add> return angular.lowercase(element.nodeName || (element[0] && element[0].nodeName)); <add>} <ide><path>test/ngTouch/directive/ngClickSpec.js <ide> describe('ngClick (touch)', function() { <ide> expect($rootScope.tapped).toBe(true); <ide> })); <ide> <add> it('should click when target element is an SVG', inject( <add> function($rootScope, $compile, $rootElement) { <add> element = $compile('<svg ng-click="tapped = true"></svg>')($rootScope); <add> $rootElement.append(element); <add> $rootScope.$digest(); <add> <add> browserTrigger(element, 'touchstart'); <add> browserTrigger(element, 'touchend'); <add> browserTrigger(element, 'click', {x:1, y:1}); <add> <add> expect($rootScope.tapped).toEqual(true); <add> })); <ide> <ide> describe('the clickbuster', function() { <ide> var element1, element2;
3
PHP
PHP
remove extra space
8a980746e65ebb90614f680a31d4b139f1eb6ddc
<ide><path>src/View/View.php <ide> public function pluginSplit($name, $fallback = true) <ide> $name = $second; <ide> $plugin = $first; <ide> } <del> <ide> if (isset($this->plugin) && !$plugin && $fallback) { <ide> $plugin = $this->plugin; <ide> }
1
Java
Java
add space separator in jsonpathexpectationshelper
09341b996e17e3c526d77a0de3b3048771a4cbb3
<ide><path>spring-test/src/main/java/org/springframework/test/util/JsonPathExpectationsHelper.java <ide> else if (actualValue != null && expectedValue != null) { <ide> assertEquals("For JSON path " + this.expression + " type of value", <ide> expectedValue.getClass(), actualValue.getClass()); <ide> } <del> assertEquals("JSON path" + this.expression, expectedValue, actualValue); <add> assertEquals("JSON path " + this.expression, expectedValue, actualValue); <ide> } <ide> <ide> /**
1
Javascript
Javascript
replace concatenation with template literals
c24a73d23c098e5cde7e55ce0c97f6daa11facc9
<ide><path>test/inspector/inspector-helper.js <ide> Harness.prototype.addStderrFilter = function(regexp, callback) { <ide> <ide> Harness.prototype.assertStillAlive = function() { <ide> assert.strictEqual(this.running_, true, <del> 'Child died: ' + JSON.stringify(this.result_)); <add> `Child died: ${JSON.stringify(this.result_)}`); <ide> }; <ide> <ide> Harness.prototype.run_ = function() { <ide><path>test/parallel/test-https-server-keep-alive-timeout.js <ide> const fs = require('fs'); <ide> const tests = []; <ide> <ide> const serverOptions = { <del> key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'), <del> cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem') <add> key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`), <add> cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`) <ide> }; <ide> <ide> function test(fn) { <ide><path>test/sequential/test-debugger-debug-brk.js <ide> common.skipIfInspectorDisabled(); <ide> const assert = require('assert'); <ide> const spawn = require('child_process').spawn; <ide> <del>const script = common.fixturesDir + '/empty.js'; <add>const script = `${common.fixturesDir}/empty.js`; <ide> <ide> function test(arg) { <ide> const child = spawn(process.execPath, ['--inspect', arg, script]);
3
Ruby
Ruby
move builderror and exceutionerror to global.h
a4e86bb3264a17e0d5227e058d8bc4ea17f3dfbb
<ide><path>Library/Homebrew/formula.rb <ide> # <ide> require 'download_strategy' <ide> <del>class ExecutionError <RuntimeError <del> def initialize cmd, args=[] <del> super "Failure while executing: #{cmd} #{args*' '}" <del> end <del>end <del>class BuildError <ExecutionError <del>end <ide> class FormulaUnavailableError <RuntimeError <ide> def initialize name <ide> @name = name <ide><path>Library/Homebrew/global.rb <ide> MACOS_VERSION = /(10\.\d+)(\.\d+)?/.match(MACOS_FULL_VERSION).captures.first.to_f <ide> <ide> HOMEBREW_USER_AGENT = "Homebrew #{HOMEBREW_VERSION} (Ruby #{RUBY_VERSION}-#{RUBY_PATCHLEVEL}; Mac OS X #{MACOS_FULL_VERSION})" <add> <add> <add>class ExecutionError <RuntimeError <add> def initialize cmd, args=[] <add> super "Failure while executing: #{cmd} #{args*' '}" <add> end <add>end <add> <add>class BuildError <ExecutionError <add>end
2
Javascript
Javascript
convert doctype and names
e23a6a320ed7dfc229a3adf849513e2cbd293c17
<ide><path>src/ng/animate.js <ide> var $AnimateProvider = ['$provide', function($provide) { <ide> <ide> /** <ide> * <del> * @ngdoc function <del> * @name ng.$animate#setClass <del> * @methodOf ng.$animate <add> * @ngdoc method <add> * @name $animate#setClass <ide> * @function <ide> * @description Adds and/or removes the given CSS classes to and from the element. <ide> * Once complete, the done() callback will be fired (if provided).
1
Python
Python
fix awkward log info in dbapi_hook
06cde6b05acca1620da97481553b120c4ffe35b6
<ide><path>airflow/hooks/dbapi_hook.py <ide> def insert_rows(self, table, rows, target_fields=None, commit_every=1000, <ide> if commit_every and i % commit_every == 0: <ide> conn.commit() <ide> self.log.info( <del> "Loaded %s into %s rows so far", i, table <add> "Loaded %s rows into %s so far", i, table <ide> ) <ide> <ide> conn.commit()
1
Python
Python
remove an assert
98abe4b8aa7580e4a381fd03451741c0db45db53
<ide><path>official/modeling/model_training_utils.py <ide> def run_customized_training_loop( <ide> assert tf.executing_eagerly() <ide> <ide> if run_eagerly: <del> if steps_per_loop > 1: <del> raise ValueError( <del> 'steps_per_loop is used for performance optimization. When you want ' <del> 'to run eagerly, you cannot leverage graph mode loop.') <ide> if isinstance(strategy, tf.distribute.experimental.TPUStrategy): <ide> raise ValueError( <ide> 'TPUStrategy should not run eagerly as it heavily replies on graph'
1
Text
Text
add information about modules cache behavior
6eae41480bb8944684f345e4ce82c8333e884a2f
<ide><path>doc/api/modules.md <ide> NODE_MODULES_PATHS(START) <ide> <ide> <!--type=misc--> <ide> <del>Modules are cached after the first time they are loaded. This means <del>(among other things) that every call to `require('foo')` will get <del>exactly the same object returned, if it would resolve to the same file. <add>Modules are cached after the first time they are loaded. This means (among other <add>things) that every call to `require('foo')` will get exactly the same object <add>returned, if it would resolve to the same file. <ide> <del>Provided `require.cache` is not modified, multiple calls to <del>`require('foo')` will not cause the module code to be executed multiple times. <del>This is an important feature. With it, "partially done" objects can be returned, <del>thus allowing transitive dependencies to be loaded even when they would cause <del>cycles. <add>Provided `require.cache` is not modified, multiple calls to `require('foo')` <add>will not cause the module code to be executed multiple times. This is an <add>important feature. With it, "partially done" objects can be returned, thus <add>allowing transitive dependencies to be loaded even when they would cause cycles. <ide> <del>To have a module execute code multiple times, export a function, and call <del>that function. <add>To have a module execute code multiple times, export a function, and call that <add>function. <ide> <ide> ### Module Caching Caveats <ide> <ide> <!--type=misc--> <ide> <del>Modules are cached based on their resolved filename. Since modules may <del>resolve to a different filename based on the location of the calling <del>module (loading from `node_modules` folders), it is not a *guarantee* <del>that `require('foo')` will always return the exact same object, if it <del>would resolve to different files. <add>Modules are cached based on their resolved filename. Since modules may resolve <add>to a different filename based on the location of the calling module (loading <add>from `node_modules` folders), it is not a *guarantee* that `require('foo')` will <add>always return the exact same object, if it would resolve to different files. <ide> <ide> Additionally, on case-insensitive file systems or operating systems, different <ide> resolved filenames can point to the same file, but the cache will still treat <ide> are not found elsewhere. <ide> On Windows, `NODE_PATH` is delimited by semicolons (`;`) instead of colons. <ide> <ide> `NODE_PATH` was originally created to support loading modules from <del>varying paths before the current [module resolution][] algorithm was frozen. <add>varying paths before the current [module resolution][] algorithm was defined. <ide> <ide> `NODE_PATH` is still supported, but is less necessary now that the Node.js <ide> ecosystem has settled on a convention for locating dependent modules. <ide> value from this object, the next `require` will reload the module. Note that <ide> this does not apply to [native addons][], for which reloading will result in an <ide> error. <ide> <add>Adding or replacing entries is also possible. This cache is checked before <add>native modules and if a name matching a native module is added to the cache, <add>no require call is <add>going to receive the native module anymore. Use with care! <add> <ide> #### require.extensions <ide> <!-- YAML <ide> added: v0.3.0 <ide> Process files with the extension `.sjs` as `.js`: <ide> require.extensions['.sjs'] = require.extensions['.js']; <ide> ``` <ide> <del>**Deprecated.** In the past, this list has been used to load <del>non-JavaScript modules into Node.js by compiling them on-demand. <del>However, in practice, there are much better ways to do this, such as <del>loading modules via some other Node.js program, or compiling them to <del>JavaScript ahead of time. <del> <del>Since the module system is locked, this feature will probably never go <del>away. However, it may have subtle bugs and complexities that are best <del>left untouched. <del> <del>Note that the number of file system operations that the module system <del>has to perform in order to resolve a `require(...)` statement to a <del>filename scales linearly with the number of registered extensions. <add>**Deprecated.** In the past, this list has been used to load non-JavaScript <add>modules into Node.js by compiling them on-demand. However, in practice, there <add>are much better ways to do this, such as loading modules via some other Node.js <add>program, or compiling them to JavaScript ahead of time. <ide> <del>In other words, adding extensions slows down the module loader and <del>should be discouraged. <add>Avoid using `require.extensions`. Use could cause subtle bugs and resolving the <add>extensions gets slower with each registered extension. <ide> <ide> #### require.main <ide> <!-- YAML
1
Javascript
Javascript
add support for additional digest types
205d3a05ee2a1cce4a4b8d7c270beaee784cfe78
<ide><path>lib/util/hash/wasm-hash.js <ide> class WasmHash { <ide> const { exports, buffered, mem, digestSize } = this; <ide> exports.final(buffered); <ide> this.instancesPool.push(this); <del> return mem.toString("latin1", 0, digestSize); <add> const hex = mem.toString("latin1", 0, digestSize); <add> if (type === "hex") return hex; <add> if (type === "binary" || !type) return Buffer.from(hex, "hex"); <add> return Buffer.from(hex, "hex").toString(type); <ide> } <ide> } <ide>
1
Go
Go
fix windows tag in pkg/term
7b3492df0c3c92215c2ed6f3e8b6cd8f7cf11855
<ide><path>pkg/term/term_windows.go <ide> // +build windows <add> <ide> package term <ide> <ide> import (
1
Javascript
Javascript
remove the unnecessary this.buf in ccittfaxstream
33dd1b0c3c58acf677486c20e85d5bd3870e555d
<ide><path>src/core/stream.js <ide> var CCITTFaxStream = (function CCITTFaxStreamClosure() { <ide> this.inputBits = 0; <ide> this.inputBuf = 0; <ide> this.outputBits = 0; <del> this.buf = EOF; <ide> <ide> var code1; <ide> while ((code1 = this.lookBits(12)) === 0) { <ide> var CCITTFaxStream = (function CCITTFaxStreamClosure() { <ide> CCITTFaxStream.prototype.readBlock = function CCITTFaxStream_readBlock() { <ide> while (!this.eof) { <ide> var c = this.lookChar(); <del> this.buf = EOF; <ide> this.ensureBuffer(this.bufferLength + 1); <ide> this.buffer[this.bufferLength++] = c; <ide> } <ide> var CCITTFaxStream = (function CCITTFaxStreamClosure() { <ide> }; <ide> <ide> CCITTFaxStream.prototype.lookChar = function CCITTFaxStream_lookChar() { <del> if (this.buf != EOF) <del> return this.buf; <del> <ide> var refLine = this.refLine; <ide> var codingLine = this.codingLine; <ide> var columns = this.columns; <ide> var CCITTFaxStream = (function CCITTFaxStreamClosure() { <ide> this.row++; <ide> } <ide> <add> var c; <ide> if (this.outputBits >= 8) { <del> this.buf = (this.codingPos & 1) ? 0 : 0xFF; <add> c = (this.codingPos & 1) ? 0 : 0xFF; <ide> this.outputBits -= 8; <ide> if (this.outputBits === 0 && codingLine[this.codingPos] < columns) { <ide> this.codingPos++; <ide> var CCITTFaxStream = (function CCITTFaxStreamClosure() { <ide> } <ide> } else { <ide> var bits = 8; <del> this.buf = 0; <add> c = 0; <ide> do { <ide> if (this.outputBits > bits) { <del> this.buf <<= bits; <add> c <<= bits; <ide> if (!(this.codingPos & 1)) { <del> this.buf |= 0xFF >> (8 - bits); <add> c |= 0xFF >> (8 - bits); <ide> } <ide> this.outputBits -= bits; <ide> bits = 0; <ide> } else { <del> this.buf <<= this.outputBits; <add> c <<= this.outputBits; <ide> if (!(this.codingPos & 1)) { <del> this.buf |= 0xFF >> (8 - this.outputBits); <add> c |= 0xFF >> (8 - this.outputBits); <ide> } <ide> bits -= this.outputBits; <ide> this.outputBits = 0; <ide> var CCITTFaxStream = (function CCITTFaxStreamClosure() { <ide> this.outputBits = (codingLine[this.codingPos] - <ide> codingLine[this.codingPos - 1]); <ide> } else if (bits > 0) { <del> this.buf <<= bits; <add> c <<= bits; <ide> bits = 0; <ide> } <ide> } <ide> } while (bits); <ide> } <ide> if (this.black) { <del> this.buf ^= 0xFF; <add> c ^= 0xFF; <ide> } <del> return this.buf; <add> return c; <ide> }; <ide> <ide> // This functions returns the code found from the table.
1
Ruby
Ruby
extract local cache middleware
cb172db3ff5ba1b08b0a2be4a22abdaca4267903
<ide><path>activesupport/lib/active_support/cache/strategy/local_cache.rb <ide> require 'active_support/core_ext/object/duplicable' <ide> require 'active_support/core_ext/string/inflections' <del>require 'rack/body_proxy' <ide> <ide> module ActiveSupport <ide> module Cache <ide> module Strategy <ide> # duration of a block. Repeated calls to the cache for the same key will hit the <ide> # in-memory cache for faster access. <ide> module LocalCache <add> autoload :Middleware, 'active_support/cache/strategy/local_cache_middleware' <add> <ide> # Class for storing and registering the local caches. <ide> class LocalCacheRegistry # :nodoc: <ide> extend ActiveSupport::PerThreadRegistry <ide> def delete_entry(key, options) <ide> def with_local_cache <ide> use_temporary_local_cache(LocalStore.new) { yield } <ide> end <del> <del> #-- <del> # This class wraps up local storage for middlewares. Only the middleware method should <del> # construct them. <del> class Middleware # :nodoc: <del> attr_reader :name, :local_cache_key <del> <del> def initialize(name, local_cache_key) <del> @name = name <del> @local_cache_key = local_cache_key <del> @app = nil <del> end <del> <del> def new(app) <del> @app = app <del> self <del> end <del> <del> def call(env) <del> LocalCacheRegistry.set_cache_for(local_cache_key, LocalStore.new) <del> response = @app.call(env) <del> response[2] = ::Rack::BodyProxy.new(response[2]) do <del> LocalCacheRegistry.set_cache_for(local_cache_key, nil) <del> end <del> response <del> rescue Exception <del> LocalCacheRegistry.set_cache_for(local_cache_key, nil) <del> raise <del> end <del> end <del> <ide> # Middleware class can be inserted as a Rack handler to be local cache for the <ide> # duration of request. <ide> def middleware <ide><path>activesupport/lib/active_support/cache/strategy/local_cache_middleware.rb <add>require 'rack/body_proxy' <add>module ActiveSupport <add> module Cache <add> module Strategy <add> module LocalCache <add> <add> #-- <add> # This class wraps up local storage for middlewares. Only the middleware method should <add> # construct them. <add> class Middleware # :nodoc: <add> attr_reader :name, :local_cache_key <add> <add> def initialize(name, local_cache_key) <add> @name = name <add> @local_cache_key = local_cache_key <add> @app = nil <add> end <add> <add> def new(app) <add> @app = app <add> self <add> end <add> <add> def call(env) <add> LocalCacheRegistry.set_cache_for(local_cache_key, LocalStore.new) <add> response = @app.call(env) <add> response[2] = ::Rack::BodyProxy.new(response[2]) do <add> LocalCacheRegistry.set_cache_for(local_cache_key, nil) <add> end <add> response <add> rescue Exception <add> LocalCacheRegistry.set_cache_for(local_cache_key, nil) <add> raise <add> end <add> end <add> end <add> end <add> end <add>end
2
Text
Text
improve readability of the russian text
b2925645d753db2ba84ad0103ff5388db9a629a2
<ide><path>guide/russian/javascript/if-else-statement/index.md <ide> localeTitle: If-Else Statement <ide> --- <ide> ## Введение <ide> <del>Оператор `if` выполняет оператор, если указанное условие `true` . Если условие `false` , другой оператор может быть выполнен с использованием инструкции `else` . <add>Оператор `if` выполняет команды, если определенное условие оценивается как истинное или `true` . Если условие оценивается как `false` , возможно выполнить другие команды с помощью инструкции `else` . <ide> <ide> **Примечание.** Оператор `else` является необязательным. <ide> <ide> if (condition) <ide> /* do something else */ <ide> ``` <ide> <del>Несколько команд `if...else` могут быть привязаны для создания предложения `else if` . Это указывает новое условие для проверки и может быть повторено для проверки нескольких условий, проверяя, пока не будет представлен действительный оператор. <add>Несколько условный операторов `if...else` могут быть соединены для создания предложения `else if` . Это указывает новое условие для проверки и может быть повторено для проверки нескольких условий, до тех пор пока одно из условий не примет значение "истина" или `true` . <ide> <ide> ```javascript <ide> if (condition1) <ide> if (condition1) <ide> /* final statement */ <ide> ``` <ide> <del>**Примечание.** Если вы хотите выполнить более одного оператора в части `if` , `else` или `else if` , требуются фигурные скобки вокруг операторов: <add>**Примечание.** Если вы хотите выполнить более одной команды в части `if` , `else` или `else if` , нужно использовать фигурные скобки вокруг операторов: <ide> <ide> ```javascript <ide> if (condition) { <ide> if (x < 10) <ide> return "Invalid number"; <ide> } <ide> <del>``` <ide>\ No newline at end of file <add>```
1
Javascript
Javascript
update example to use a module
84dc989cf029b2a5940a04fb99ad3ff9e0728e19
<ide><path>src/ng/directive/ngEventDirs.js <ide> forEach( <ide> * ({@link guide/expression#-event- Event object is available as `$event`}) <ide> * <ide> * @example <del> <example> <add> <example module="submitExample"> <ide> <file name="index.html"> <ide> <script> <del> function Ctrl($scope) { <del> $scope.list = []; <del> $scope.text = 'hello'; <del> $scope.submit = function() { <del> if ($scope.text) { <del> $scope.list.push(this.text); <del> $scope.text = ''; <del> } <del> }; <del> } <add> angular.module('submitExample', []) <add> .controller('ExampleController', ['$scope', function($scope) { <add> $scope.list = []; <add> $scope.text = 'hello'; <add> $scope.submit = function() { <add> if ($scope.text) { <add> $scope.list.push(this.text); <add> $scope.text = ''; <add> } <add> }; <add> }]); <ide> </script> <del> <form ng-submit="submit()" ng-controller="Ctrl"> <add> <form ng-submit="submit()" ng-controller="ExampleController"> <ide> Enter text and hit enter: <ide> <input type="text" ng-model="text" name="text" /> <ide> <input type="submit" id="submit" value="Submit" />
1
PHP
PHP
improve console testing with interactive input
eca8751c3223df4b19ae4f82c95ec6d11243f273
<ide><path>src/TestSuite/ConsoleIntegrationTestTrait.php <ide> <ide> use Cake\Console\Command; <ide> use Cake\Console\CommandRunner; <del>use Cake\Console\ConsoleInput; <ide> use Cake\Console\ConsoleIo; <ide> use Cake\Console\Exception\StopException; <ide> use Cake\Core\Configure; <ide> use Cake\TestSuite\Constraint\Console\ContentsNotContain; <ide> use Cake\TestSuite\Constraint\Console\ContentsRegExp; <ide> use Cake\TestSuite\Constraint\Console\ExitCode; <add>use Cake\TestSuite\Stub\ConsoleInput; <ide> use Cake\TestSuite\Stub\ConsoleOutput; <ide> <ide> /** <ide> public function exec($command, array $input = []) <ide> <ide> $this->_out = new ConsoleOutput(); <ide> $this->_err = new ConsoleOutput(); <del> $this->_in = $this->getMockBuilder(ConsoleInput::class) <del> ->disableOriginalConstructor() <del> ->setMethods(['read']) <del> ->getMock(); <del> <del> $i = 0; <del> foreach ($input as $in) { <del> $this->_in <del> ->expects($this->at($i++)) <del> ->method('read') <del> ->will($this->returnValue($in)); <del> } <add> $this->_in = new ConsoleInput($input); <ide> <ide> $args = $this->commandStringToArgs("cake $command"); <ide> $io = new ConsoleIo($this->_out, $this->_err, $this->_in); <ide><path>tests/TestCase/TestSuite/ConsoleIntegrationTestTraitTest.php <ide> */ <ide> namespace Cake\Test\TestCase\TestSuite; <ide> <add>use Cake\Console\Exception\ConsoleException; <ide> use Cake\Console\Shell; <ide> use Cake\Core\Configure; <ide> use Cake\TestSuite\ConsoleIntegrationTestCase; <ide> public function testExecWithInput() <ide> $this->assertExitCode(Shell::CODE_ERROR); <ide> } <ide> <add> /** <add> * tests exec with fewer inputs than questions <add> * <add> * @return void <add> */ <add> public function testExecWithMissingInput() <add> { <add> $this->expectException(ConsoleException::class); <add> $this->expectExceptionMessage('no more input'); <add> $this->exec('integration bridge', ['cake']); <add> } <add> <ide> /** <ide> * tests exec with multiple inputs <ide> *
2
PHP
PHP
add an empty error bag for http exceptions
8dce475aac47fea67694bb5739e20746f99a0ac0
<ide><path>src/Illuminate/Foundation/Exceptions/Handler.php <ide> use Illuminate\Routing\Router; <ide> use Illuminate\Http\JsonResponse; <ide> use Illuminate\Support\Facades\Auth; <add>use Illuminate\Support\ViewErrorBag; <ide> use Illuminate\Filesystem\Filesystem; <ide> use Illuminate\Http\RedirectResponse; <ide> use Whoops\Handler\PrettyPageHandler; <ide> protected function renderHttpException(HttpException $e) <ide> })->push(__DIR__.'/views')->all()); <ide> <ide> if (view()->exists($view = "errors::{$status}")) { <del> return response()->view($view, ['exception' => $e], $status, $e->getHeaders()); <add> return response()->view($view, ['exception' => $e, 'errors' => new ViewErrorBag], $status, $e->getHeaders()); <ide> } <ide> <ide> return $this->convertExceptionToResponse($e);
1
Javascript
Javascript
fix typo in test-inspector-cluster-port-clash.js
d6b1b84ca0b6465e1517d5e8380953426ace0f49
<ide><path>test/known_issues/test-inspector-cluster-port-clash.js <ide> if (process.config.variables.v8_enable_inspector === 0) { <ide> const cluster = require('cluster'); <ide> const net = require('net'); <ide> <del>common.crashOnUnhandleRejection(); <add>common.crashOnUnhandledRejection(); <ide> <ide> const ports = [process.debugPort]; <ide> const clashPort = process.debugPort + 2;
1
Javascript
Javascript
revert the anonymous use of define
80045bf006175da840d8542b0c0b46e50595bb29
<ide><path>moment.js <ide> } <ide> /*global define:false */ <ide> if (typeof define === "function" && define.amd) { <del> define(function () { <add> define("moment", [], function () { <ide> return moment; <ide> }); <ide> }
1
Mixed
Javascript
support uint8array input to methods
f2ef850f11736fdd0281da15eec39c0ae0c59c0f
<ide><path>doc/api/fs.md <ide> added: v0.0.2 <ide> --> <ide> <ide> * `fd` {Integer} <del>* `buffer` {String | Buffer} <add>* `buffer` {String | Buffer | Uint8Array} <ide> * `offset` {Integer} <ide> * `length` {Integer} <ide> * `position` {Integer} <ide> added: v0.1.21 <ide> --> <ide> <ide> * `fd` {Integer} <del>* `buffer` {String | Buffer} <add>* `buffer` {String | Buffer | Uint8Array} <ide> * `offset` {Integer} <ide> * `length` {Integer} <ide> * `position` {Integer} <ide> added: v0.0.2 <ide> --> <ide> <ide> * `fd` {Integer} <del>* `buffer` {Buffer} <add>* `buffer` {Buffer | Uint8Array} <ide> * `offset` {Integer} <ide> * `length` {Integer} <ide> * `position` {Integer} <ide> added: v0.1.29 <ide> --> <ide> <ide> * `file` {String | Buffer | Integer} filename or file descriptor <del>* `data` {String | Buffer} <add>* `data` {String | Buffer | Uint8Array} <ide> * `options` {Object | String} <ide> * `encoding` {String | Null} default = `'utf8'` <ide> * `mode` {Integer} default = `0o666` <ide> added: v0.1.29 <ide> --> <ide> <ide> * `file` {String | Buffer | Integer} filename or file descriptor <del>* `data` {String | Buffer} <add>* `data` {String | Buffer | Uint8Array} <ide> * `options` {Object | String} <ide> * `encoding` {String | Null} default = `'utf8'` <ide> * `mode` {Integer} default = `0o666` <ide> added: v0.1.21 <ide> --> <ide> <ide> * `fd` {Integer} <del>* `buffer` {Buffer} <add>* `buffer` {Buffer | Uint8Array} <ide> * `offset` {Integer} <ide> * `length` {Integer} <ide> * `position` {Integer} <ide><path>lib/fs.js <ide> const constants = process.binding('constants').fs; <ide> const util = require('util'); <ide> const pathModule = require('path'); <add>const { isUint8Array } = process.binding('util'); <ide> <ide> const binding = process.binding('fs'); <ide> const fs = exports; <ide> fs.openSync = function(path, flags, mode) { <ide> <ide> var readWarned = false; <ide> fs.read = function(fd, buffer, offset, length, position, callback) { <del> if (!(buffer instanceof Buffer)) { <add> if (!isUint8Array(buffer)) { <ide> // legacy string interface (fd, length, position, encoding, callback) <ide> if (!readWarned) { <ide> readWarned = true; <ide> fs.readSync = function(fd, buffer, offset, length, position) { <ide> var legacy = false; <ide> var encoding; <ide> <del> if (!(buffer instanceof Buffer)) { <add> if (!isUint8Array(buffer)) { <ide> // legacy string interface (fd, length, position, encoding, callback) <ide> if (!readSyncWarned) { <ide> readSyncWarned = true; <ide> fs.write = function(fd, buffer, offset, length, position, callback) { <ide> var req = new FSReqWrap(); <ide> req.oncomplete = wrapper; <ide> <del> if (buffer instanceof Buffer) { <add> if (isUint8Array(buffer)) { <ide> callback = maybeCallback(callback || position || length || offset); <ide> if (typeof offset !== 'number') { <ide> offset = 0; <ide> fs.write = function(fd, buffer, offset, length, position, callback) { <ide> // OR <ide> // fs.writeSync(fd, string[, position[, encoding]]); <ide> fs.writeSync = function(fd, buffer, offset, length, position) { <del> if (buffer instanceof Buffer) { <add> if (isUint8Array(buffer)) { <ide> if (position === undefined) <ide> position = null; <ide> if (typeof offset !== 'number') <ide> fs.writeFile = function(path, data, options, callback) { <ide> }); <ide> <ide> function writeFd(fd, isUserFd) { <del> var buffer = (data instanceof Buffer) ? <add> var buffer = isUint8Array(data) ? <ide> data : Buffer.from('' + data, options.encoding || 'utf8'); <ide> var position = /a/.test(flag) ? null : 0; <ide> <ide> fs.writeFileSync = function(path, data, options) { <ide> var isUserFd = isFd(path); // file descriptor ownership <ide> var fd = isUserFd ? path : fs.openSync(path, flag, options.mode); <ide> <del> if (!(data instanceof Buffer)) { <add> if (!isUint8Array(data)) { <ide> data = Buffer.from('' + data, options.encoding || 'utf8'); <ide> } <ide> var offset = 0; <ide><path>test/parallel/test-fs-read-buffer.js <ide> const Buffer = require('buffer').Buffer; <ide> const fs = require('fs'); <ide> const filepath = path.join(common.fixturesDir, 'x.txt'); <ide> const fd = fs.openSync(filepath, 'r'); <del>const expected = 'xyz\n'; <del>const bufferAsync = Buffer.allocUnsafe(expected.length); <del>const bufferSync = Buffer.allocUnsafe(expected.length); <ide> <del>fs.read(fd, <del> bufferAsync, <del> 0, <del> expected.length, <del> 0, <del> common.mustCall(function(err, bytesRead) { <del> assert.equal(bytesRead, expected.length); <del> assert.deepStrictEqual(bufferAsync, Buffer.from(expected)); <del> })); <add>const expected = Buffer.from('xyz\n'); <ide> <del>var r = fs.readSync(fd, bufferSync, 0, expected.length, 0); <del>assert.deepStrictEqual(bufferSync, Buffer.from(expected)); <del>assert.equal(r, expected.length); <add>function test(bufferAsync, bufferSync, expected) { <add> fs.read(fd, <add> bufferAsync, <add> 0, <add> expected.length, <add> 0, <add> common.mustCall((err, bytesRead) => { <add> assert.strictEqual(bytesRead, expected.length); <add> assert.deepStrictEqual(bufferAsync, Buffer.from(expected)); <add> })); <add> <add> const r = fs.readSync(fd, bufferSync, 0, expected.length, 0); <add> assert.deepStrictEqual(bufferSync, Buffer.from(expected)); <add> assert.strictEqual(r, expected.length); <add>} <add> <add>test(Buffer.allocUnsafe(expected.length), <add> Buffer.allocUnsafe(expected.length), <add> expected); <add> <add>test(new Uint8Array(expected.length), <add> new Uint8Array(expected.length), <add> Uint8Array.from(expected)); <ide><path>test/parallel/test-fs-write-buffer.js <ide> common.refreshTmpDir(); <ide> fs.write(fd, expected, undefined, undefined, cb); <ide> })); <ide> } <add> <add>// fs.write with a Uint8Array, without the offset and length parameters: <add>{ <add> const filename = path.join(common.tmpDir, 'write6.txt'); <add> fs.open(filename, 'w', 0o644, common.mustCall(function(err, fd) { <add> assert.ifError(err); <add> <add> const cb = common.mustCall(function(err, written) { <add> assert.ifError(err); <add> <add> assert.strictEqual(expected.length, written); <add> fs.closeSync(fd); <add> <add> const found = fs.readFileSync(filename, 'utf8'); <add> assert.deepStrictEqual(expected.toString(), found); <add> }); <add> <add> fs.write(fd, Uint8Array.from(expected), cb); <add> })); <add>} <ide><path>test/parallel/test-fs-write-file-uint8array.js <add>'use strict'; <add>const common = require('../common'); <add>const assert = require('assert'); <add>const fs = require('fs'); <add>const join = require('path').join; <add> <add>common.refreshTmpDir(); <add> <add>const filename = join(common.tmpDir, 'test.txt'); <add> <add>const s = '南越国是前203年至前111年存在于岭南地区的一个国家,国都位于番禺,疆域包括今天中国的广东、' + <add> '广西两省区的大部份地区,福建省、湖南、贵州、云南的一小部份地区和越南的北部。' + <add> '南越国是秦朝灭亡后,由南海郡尉赵佗于前203年起兵兼并桂林郡和象郡后建立。' + <add> '前196年和前179年,南越国曾先后两次名义上臣属于西汉,成为西汉的“外臣”。前112年,' + <add> '南越国末代君主赵建德与西汉发生战争,被汉武帝于前111年所灭。南越国共存在93年,' + <add> '历经五代君主。南越国是岭南地区的第一个有记载的政权国家,采用封建制和郡县制并存的制度,' + <add> '它的建立保证了秦末乱世岭南地区社会秩序的稳定,有效的改善了岭南地区落后的政治、##济现状。\n'; <add> <add>const input = Uint8Array.from(Buffer.from(s, 'utf8')); <add> <add>fs.writeFileSync(filename, input); <add>assert.strictEqual(fs.readFileSync(filename, 'utf8'), s); <add> <add>fs.writeFile(filename, input, common.mustCall((e) => { <add> assert.ifError(e); <add> <add> assert.strictEqual(fs.readFileSync(filename, 'utf8'), s); <add>}));
5
Ruby
Ruby
remove strange else block
19c144f1b3d441d2cc7b227c68b3971f12d42c0c
<ide><path>actionpack/lib/action_view/helpers/text_helper.rb <ide> def excerpt(text, phrase, *args) <ide> options.reverse_merge!(:radius => 100, :omission => "...") <ide> <ide> phrase = Regexp.escape(phrase) <del> if found_pos = text.mb_chars =~ /(#{phrase})/i <del> start_pos = [ found_pos - options[:radius], 0 ].max <del> end_pos = [ [ found_pos + phrase.mb_chars.length + options[:radius] - 1, 0].max, text.mb_chars.length ].min <add> return unless found_pos = text.mb_chars =~ /(#{phrase})/i <ide> <del> prefix = start_pos > 0 ? options[:omission] : "" <del> postfix = end_pos < text.mb_chars.length - 1 ? options[:omission] : "" <add> start_pos = [ found_pos - options[:radius], 0 ].max <add> end_pos = [ [ found_pos + phrase.mb_chars.length + options[:radius] - 1, 0].max, text.mb_chars.length ].min <ide> <del> prefix + text.mb_chars[start_pos..end_pos].strip + postfix <del> else <del> nil <del> end <add> prefix = start_pos > 0 ? options[:omission] : "" <add> postfix = end_pos < text.mb_chars.length - 1 ? options[:omission] : "" <add> <add> prefix + text.mb_chars[start_pos..end_pos].strip + postfix <ide> end <ide> <ide> # Attempts to pluralize the +singular+ word unless +count+ is 1. If
1
Javascript
Javascript
move init into local-cli
29325d7cb3e6838b56494affda5d21e84ebebc83
<ide><path>local-cli/cli.js <ide> var spawn = require('child_process').spawn; <ide> var path = require('path'); <ide> <del>var init = require('../init.js'); <add>var init = require('./init.js'); <ide> var install = require('./install.js'); <ide> var bundle = require('./bundle.js'); <ide> <add><path>local-cli/init.js <del><path>init.js <ide> var fs = require('fs'); <ide> <ide> function init(projectDir, appName) { <ide> console.log('Setting up new React Native app in ' + projectDir); <del> var source = path.resolve(__dirname, 'Examples/SampleApp'); <add> var source = path.resolve(__dirname, '..', 'Examples/SampleApp'); <ide> <ide> walk(source).forEach(function(f) { <ide> f = f.replace(source + '/', ''); // Strip off absolute path
2
PHP
PHP
fix 7.3 regression with short closure
416339e57a0b49f7df89b4425c2c07f7baea014b
<ide><path>src/Illuminate/Database/Query/Grammars/SqlServerGrammar.php <ide> protected function compileAnsiOffset(Builder $query, $components) <ide> // move the bindings to the right position: right after "select". <ide> if ($this->queryOrderContainsSubquery($query)) { <ide> $preferredBindingOrder = ['select', 'order', 'from', 'join', 'where', 'groupBy', 'having', 'union', 'unionOrder']; <del> $sortedBindings = Arr::sort($query->bindings, fn ($bindings, $key) => array_search($key, $preferredBindingOrder)); <add> $sortedBindings = Arr::sort($query->bindings, function ($bindings, $key) use ($preferredBindingOrder) { <add> return array_search($key, $preferredBindingOrder); <add> }); <ide> $query->bindings = $sortedBindings; <ide> } <ide>
1
Java
Java
change the textalign setter to support rtl
ba56043715f346eafa41e754af471eb385d4bd01
<ide><path>ReactAndroid/src/main/java/com/facebook/react/flat/RCTTextInput.java <ide> public void onCollectExtraUpdates(UIViewOperationQueue uiViewOperationQueue) { <ide> super.onCollectExtraUpdates(uiViewOperationQueue); <ide> if (mJsEventCount != UNSET) { <ide> ReactTextUpdate reactTextUpdate = <del> new ReactTextUpdate(getText(), mJsEventCount, false, getPadding(), Float.NaN); <add> new ReactTextUpdate(getText(), mJsEventCount, false, getPadding(), Float.NaN, UNSET); <ide> // TODO: the Float.NaN should be replaced with the real line height see D3592781 <ide> uiViewOperationQueue.enqueueUpdateExtraData(getReactTag(), reactTextUpdate); <ide> }
1
Ruby
Ruby
redirect bundler stdout to stderr
07d571bebc5b05a86e5dc8ebf9c51ec9836da81d
<ide><path>Library/Homebrew/dev-cmd/vendor-gems.rb <ide> def vendor_gems <ide> end <ide> <ide> ohai "bundle install --standalone" <del> safe_system "bundle", "install", "--standalone" <add> safe_system_redirect_stdout_to_stderr "bundle", "install", "--standalone" <ide> <ide> ohai "bundle pristine" <ide> safe_system "bundle", "pristine" <ide><path>Library/Homebrew/utils.rb <ide> def quiet_system(cmd, *args) <ide> end <ide> end <ide> <add> # Redirects stdout to stderr, throws exception on command failure. <add> def safe_system_redirect_stdout_to_stderr(cmd, *args) <add> return if Homebrew._system(cmd, *args) do <add> # Redirect stdout stream to stderr stream. This is useful to prevent <add> # subprocesses from writing to stdout and interfering with the intended <add> # output, e.g. when running a brew command with `--json` for programs <add> # automating brew commands. <add> $stdout.reopen($stderr) <add> end <add> <add> raise ErrorDuringExecution.new([cmd, *args], status: $CHILD_STATUS) <add> end <add> <ide> def which(cmd, path = ENV["PATH"]) <ide> PATH.new(path).each do |p| <ide> begin <ide><path>Library/Homebrew/utils/gems.rb <ide> def install_bundler_gems!(only_warn_on_failure: false, setup_path: true) <ide> <ide> # for some reason sometimes the exit code lies so check the output too. <ide> if bundle_check_failed || bundle_check_output.include?("Install missing gems") <del> unless system bundle, "install" <add> begin <add> safe_system_redirect_stdout_to_stderr bundle, "install" <add> rescue ErrorDuringExecution <ide> message = <<~EOS <ide> failed to run `#{bundle} install`! <ide> EOS
3
Text
Text
allow spaces before brackets
4d620dea1a520e2f06cb0eed9a2a6a7ff7466755
<ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-first-character-in-a-string.md <ide> assert(firstLetterOfLastName === 'L'); <ide> You should use bracket notation. <ide> <ide> ```js <del>assert(code.match(/firstLetterOfLastName\s*?=\s*?lastName\[.*?\]/)); <add>assert(code.match(/firstLetterOfLastName\s*=\s*lastName\s*\[\s*\d\s*\]/)); <ide> ``` <ide> <ide> # --seed-- <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-character-in-a-string.md <ide> assert(thirdLetterOfLastName === 'v'); <ide> You should use bracket notation. <ide> <ide> ```js <del>assert(code.match(/thirdLetterOfLastName\s*?=\s*?lastName\[.*?\]/)); <add>assert(code.match(/thirdLetterOfLastName\s*=\s*lastName\s*\[\s*\d\s*\]/)); <ide> ``` <ide> <ide> # --seed--
2
Javascript
Javascript
add @deprecated to rgbformat
920a716c719f79ec0705d777c7e174513dcbd4f6
<ide><path>src/constants.js <ide> export const UnsignedShort4444Type = 1017; <ide> export const UnsignedShort5551Type = 1018; <ide> export const UnsignedInt248Type = 1020; <ide> export const AlphaFormat = 1021; <del>export const RGBFormat = 1022; <add>export const RGBFormat = 1022; // @deprecated since r137 <ide> export const RGBAFormat = 1023; <ide> export const LuminanceFormat = 1024; <ide> export const LuminanceAlphaFormat = 1025;
1
Python
Python
add the tests in setup file for testing package
640018fac45026b3fd70846c62297bfedac5afa3
<ide><path>numpy/testing/setup.py <ide> def configuration(parent_package='',top_path=None): <ide> from numpy.distutils.misc_util import Configuration <ide> config = Configuration('testing',parent_package,top_path) <add> <add> config.add_data_dir('tests') <ide> return config <ide> <ide> if __name__ == '__main__':
1
Python
Python
add '-' to separate git hash in version
a07ac0f4703cbac0e8747ac0e9e08f41cba9b896
<ide><path>setup.py <ide> def write_version_py(filename='numpy/version.py'): <ide> """ <ide> FULL_VERSION = VERSION <ide> if not ISRELEASED: <del> FULL_VERSION += '.dev' <ide> if os.path.exists('.git'): <ide> GIT_REVISION = git_version() <ide> elif os.path.exists(filename): <ide> def write_version_py(filename='numpy/version.py'): <ide> else: <ide> GIT_REVISION = "Unknown" <ide> <del> FULL_VERSION += GIT_REVISION[:7] <add> FULL_VERSION += '.dev-' + GIT_REVISION[:7] <ide> <ide> a = open(filename, 'w') <ide> try:
1
PHP
PHP
add proper charset to web test runner
dec67ef2599e9985cc923b7f5cd81f55685db751
<ide><path>lib/Cake/TestSuite/Reporter/CakeHtmlReporter.php <ide> class CakeHtmlReporter extends CakeBaseReporter { <ide> */ <ide> public function paintHeader() { <ide> $this->_headerSent = true; <add> $this->sendContentType(); <ide> $this->sendNoCacheHeaders(); <ide> $this->paintDocumentStart(); <ide> $this->paintTestMenu(); <ide> echo "<ul class='tests'>\n"; <ide> } <ide> <add>/** <add> * Set the content-type header so it is in the correct encoding. <add> * <add> * @return void <add> */ <add> public function sendContentType() { <add> if (!headers_sent()) { <add> header('Content-Type: text/html; charset=' . Configure::read('App.encoding')); <add> } <add> } <add> <ide> /** <ide> * Paints the document start content contained in header.php <ide> *
1
Javascript
Javascript
improve tests and test infrastructure
e463c432f74d0b0340d33af2157db4ab896d1f72
<ide><path>test/ConfigTestCases.test.js <ide> describe("ConfigTestCases", () => { <ide> let content; <ide> let p; <ide> if (Array.isArray(module)) { <del> p = path.join(currentDirectory, module[0]); <del> content = module <add> p = path.join(currentDirectory, ".array-require.js"); <add> content = `module.exports = (${module <ide> .map(arg => { <del> p = path.join(currentDirectory, arg); <del> return fs.readFileSync(p, "utf-8"); <add> return `require(${JSON.stringify(`./${arg}`)})`; <ide> }) <del> .join("\n"); <add> .join(", ")});`; <ide> } else { <ide> p = path.join(currentDirectory, module); <ide> content = fs.readFileSync(p, "utf-8"); <ide><path>test/configCases/output/inner-dirs-entries/a.js <del>import dummy from 'dummy_module'; <add>import dummy from "dummy_module"; <ide> <ide> it("should load", () => { <del> expect(dummy()).toBe('this is just a dummy function'); <del> return import("./inner-dir/b").then(importedModule => { <del> expect(importedModule.dummy()).toBe('this is just a dummy function'); <del> }) <add> expect(dummy()).toBe("this is just a dummy function"); <add> return import("./inner-dir/b").then(importedModule => { <add> expect(importedModule.dummy()).toBe("this is just a dummy function"); <add> }); <ide> }); <ide><path>test/configCases/output/inner-dirs-entries/inner-dir/b.js <del>import dummy from 'dummy_module'; <add>import dummy from "dummy_module"; <ide> <ide> it("should load", done => { <del> expect(dummy()).toBe('this is just a dummy function'); <del> done(); <add> expect(dummy()).toBe("this is just a dummy function"); <add> done(); <ide> }); <add> <add>export { dummy }; <ide><path>test/configCases/output/inner-dirs-entries/inner-dir/some-module.js <del>export dummy from 'dummy-module'; <ide>\ No newline at end of file <add>export dummy from "dummy-module"; <ide><path>test/configCases/output/inner-dirs-entries/node_modules/dummy_module/index.js <ide> export default function someDummyFunction() { <del> return 'this is just a dummy function'; <add> return "this is just a dummy function"; <ide> } <ide><path>test/configCases/output/inner-dirs-entries/test.config.js <ide> module.exports = { <ide> findBundle: function() { <del> return [ <del> "./inner-dir/b.js" <del> ]; <add> return ["./a.js", "./inner-dir/b.js", "./inner-dir/deep/deep/c.js"]; <ide> } <ide> }; <ide><path>test/configCases/output/inner-dirs-entries/webpack.config.js <ide> module.exports = { <ide> mode: "none", <ide> entry: { <del> a: "./a", <del> "inner-dir/b": "./inner-dir/b" <add> a: "./a?1", <add> "inner-dir/b": "./inner-dir/b", <add> "inner-dir/deep/deep/c": "./a?2" <ide> }, <ide> target: "node", <ide> output: {
7
Javascript
Javascript
drop auth in `url.resolve()` if host changes
eb4201f07a1b1f430ddf4efad4f276f3088def97
<ide><path>lib/url.js <ide> Url.prototype.resolveObject = function(relative) { <ide> if (relative.protocol) { <ide> relative.hostname = null; <ide> relative.port = null; <add> result.auth = null; <ide> if (relative.host) { <ide> if (relPath[0] === '') relPath[0] = relative.host; <ide> else relPath.unshift(relative.host); <ide> Url.prototype.resolveObject = function(relative) { <ide> <ide> if (isRelAbs) { <ide> // it's absolute. <del> result.host = (relative.host || relative.host === '') ? <del> relative.host : result.host; <del> result.hostname = (relative.hostname || relative.hostname === '') ? <del> relative.hostname : result.hostname; <add> if (relative.host || relative.host === '') { <add> result.host = relative.host; <add> result.auth = null; <add> } <add> if (relative.hostname || relative.hostname === '') { <add> result.hostname = relative.hostname; <add> result.auth = null; <add> } <ide> result.search = relative.search; <ide> result.query = relative.query; <ide> srcPath = relPath; <ide><path>test/parallel/test-url.js <ide> var relativeTests2 = [ <ide> //changeing auth <ide> ['http://diff:[email protected]', <ide> 'http://asdf:[email protected]', <del> 'http://diff:[email protected]/'] <add> 'http://diff:[email protected]/'], <add> <add> // https://github.com/nodejs/node/issues/1435 <add> ['https://another.host.com/', <add> 'https://user:[email protected]/', <add> 'https://another.host.com/'], <add> ['//another.host.com/', <add> 'https://user:[email protected]/', <add> 'https://another.host.com/'], <add> ['http://another.host.com/', <add> 'https://user:[email protected]/', <add> 'http://another.host.com/'], <add> ['mailto:another.host.com', <add> 'mailto:[email protected]', <add> 'mailto:another.host.com'], <ide> ]; <ide> relativeTests2.forEach(function(relativeTest) { <ide> const a = url.resolve(relativeTest[1], relativeTest[0]);
2
Javascript
Javascript
fix frontpage example to retain selection
00adabc20dfcffb379b7f0b06fa2729ae1bff2a0
<ide><path>docs/_js/examples/timer.js <ide> var Timer = React.createClass({\n\ <ide> },\n\ <ide> render: function() {\n\ <ide> return React.DOM.div({},\n\ <del> 'Seconds Elapsed: ' + this.state.secondsElapsed\n\ <add> 'Seconds Elapsed: ', this.state.secondsElapsed\n\ <ide> );\n\ <ide> }\n\ <ide> });\n\
1
Ruby
Ruby
handle more exceptions on uninstall
b4b17fa892404a67049f72ea0408ee7998117004
<ide><path>Library/Homebrew/keg.rb <ide> def self.find_some_installed_dependents(kegs) <ide> f = keg.to_formula <ide> keg_formulae << f <ide> [f.name, f.tap] <del> rescue FormulaUnavailableError <add> rescue <ide> # If the formula for the keg can't be found, <ide> # fall back to the information in the tab. <ide> [keg.name, keg.tab.tap] <ide> def remove_old_aliases <ide> <ide> tap = begin <ide> to_formula.tap <del> rescue FormulaUnavailableError, TapFormulaAmbiguityError, <del> TapFormulaWithOldnameAmbiguityError <add> rescue <ide> # If the formula can't be found, just ignore aliases for now. <ide> nil <ide> end
1
Javascript
Javascript
use global `angular` to access helpers in `they`
caa0b9dab3945ed824543781b1ffb65d763581c9
<ide><path>test/helpers/privateMocks.js <ide> /* globals xit */ <ide> <ide> function baseThey(msg, vals, spec, itFn) { <del> var valsIsArray = isArray(vals); <add> var valsIsArray = angular.isArray(vals); <ide> <del> forEach(vals, function(val, key) { <add> angular.forEach(vals, function(val, key) { <ide> var m = msg.replace(/\$prop/g, angular.toJson(valsIsArray ? val : key)); <ide> itFn(m, function() { <ide> /* jshint -W040 : ignore possible strict violation due to use of this */
1
Python
Python
fix typograpical errors
d6a677b14bcfd56b22fafeb212a27c6068886e07
<ide><path>src/transformers/modeling_albert.py <ide> def forward(self, hidden_states, attention_mask=None, head_mask=None): <ide> <ide> class AlbertPreTrainedModel(PreTrainedModel): <ide> """ An abstract class to handle weights initialization and <del> a simple interface for dowloading and loading pretrained models. <add> a simple interface for downloading and loading pretrained models. <ide> """ <ide> <ide> config_class = AlbertConfig <ide><path>src/transformers/modeling_bert.py <ide> def forward(self, sequence_output, pooled_output): <ide> <ide> class BertPreTrainedModel(PreTrainedModel): <ide> """ An abstract class to handle weights initialization and <del> a simple interface for dowloading and loading pretrained models. <add> a simple interface for downloading and loading pretrained models. <ide> """ <ide> <ide> config_class = BertConfig <ide><path>src/transformers/modeling_ctrl.py <ide> def forward(self, x, mask, layer_past=None, attention_mask=None, head_mask=None) <ide> <ide> class CTRLPreTrainedModel(PreTrainedModel): <ide> """ An abstract class to handle weights initialization and <del> a simple interface for dowloading and loading pretrained models. <add> a simple interface for downloading and loading pretrained models. <ide> """ <ide> <ide> config_class = CTRLConfig <ide><path>src/transformers/modeling_gpt2.py <ide> def forward(self, x, layer_past=None, attention_mask=None, head_mask=None): <ide> <ide> class GPT2PreTrainedModel(PreTrainedModel): <ide> """ An abstract class to handle weights initialization and <del> a simple interface for dowloading and loading pretrained models. <add> a simple interface for downloading and loading pretrained models. <ide> """ <ide> <ide> config_class = GPT2Config <ide><path>src/transformers/modeling_openai.py <ide> def forward(self, x, attention_mask=None, head_mask=None): <ide> <ide> class OpenAIGPTPreTrainedModel(PreTrainedModel): <ide> """ An abstract class to handle weights initialization and <del> a simple interface for dowloading and loading pretrained models. <add> a simple interface for downloading and loading pretrained models. <ide> """ <ide> <ide> config_class = OpenAIGPTConfig <ide><path>src/transformers/modeling_t5.py <ide> def forward( <ide> <ide> class T5PreTrainedModel(PreTrainedModel): <ide> """ An abstract class to handle weights initialization and <del> a simple interface for dowloading and loading pretrained models. <add> a simple interface for downloading and loading pretrained models. <ide> """ <ide> <ide> config_class = T5Config <ide><path>src/transformers/modeling_tf_albert.py <ide> def call(self, inputs, training=False): <ide> <ide> class TFAlbertPreTrainedModel(TFPreTrainedModel): <ide> """ An abstract class to handle weights initialization and <del> a simple interface for dowloading and loading pretrained models. <add> a simple interface for downloading and loading pretrained models. <ide> """ <ide> <ide> config_class = AlbertConfig <ide><path>src/transformers/modeling_tf_bert.py <ide> def call( <ide> <ide> class TFBertPreTrainedModel(TFPreTrainedModel): <ide> """ An abstract class to handle weights initialization and <del> a simple interface for dowloading and loading pretrained models. <add> a simple interface for downloading and loading pretrained models. <ide> """ <ide> <ide> config_class = BertConfig <ide><path>src/transformers/modeling_tf_ctrl.py <ide> def call( <ide> <ide> class TFCTRLPreTrainedModel(TFPreTrainedModel): <ide> """ An abstract class to handle weights initialization and <del> a simple interface for dowloading and loading pretrained models. <add> a simple interface for downloading and loading pretrained models. <ide> """ <ide> <ide> config_class = CTRLConfig <ide><path>src/transformers/modeling_tf_gpt2.py <ide> def call( <ide> <ide> class TFGPT2PreTrainedModel(TFPreTrainedModel): <ide> """ An abstract class to handle weights initialization and <del> a simple interface for dowloading and loading pretrained models. <add> a simple interface for downloading and loading pretrained models. <ide> """ <ide> <ide> config_class = GPT2Config <ide><path>src/transformers/modeling_tf_openai.py <ide> def call( <ide> <ide> class TFOpenAIGPTPreTrainedModel(TFPreTrainedModel): <ide> """ An abstract class to handle weights initialization and <del> a simple interface for dowloading and loading pretrained models. <add> a simple interface for downloading and loading pretrained models. <ide> """ <ide> <ide> config_class = OpenAIGPTConfig <ide><path>src/transformers/modeling_tf_roberta.py <ide> def get_input_embeddings(self): <ide> <ide> class TFRobertaPreTrainedModel(TFPreTrainedModel): <ide> """ An abstract class to handle weights initialization and <del> a simple interface for dowloading and loading pretrained models. <add> a simple interface for downloading and loading pretrained models. <ide> """ <ide> <ide> config_class = RobertaConfig <ide><path>src/transformers/modeling_tf_t5.py <ide> def call( <ide> #################################################### <ide> class TFT5PreTrainedModel(TFPreTrainedModel): <ide> """ An abstract class to handle weights initialization and <del> a simple interface for dowloading and loading pretrained models. <add> a simple interface for downloading and loading pretrained models. <ide> """ <ide> <ide> config_class = T5Config <ide><path>src/transformers/modeling_tf_transfo_xl.py <ide> def call(self, inputs, mems=None, head_mask=None, inputs_embeds=None, training=F <ide> <ide> class TFTransfoXLPreTrainedModel(TFPreTrainedModel): <ide> """ An abstract class to handle weights initialization and <del> a simple interface for dowloading and loading pretrained models. <add> a simple interface for downloading and loading pretrained models. <ide> """ <ide> <ide> config_class = TransfoXLConfig <ide><path>src/transformers/modeling_tf_xlm.py <ide> def call( <ide> <ide> class TFXLMPreTrainedModel(TFPreTrainedModel): <ide> """ An abstract class to handle weights initialization and <del> a simple interface for dowloading and loading pretrained models. <add> a simple interface for downloading and loading pretrained models. <ide> """ <ide> <ide> config_class = XLMConfig <ide><path>src/transformers/modeling_tf_xlnet.py <ide> def call( <ide> <ide> class TFXLNetPreTrainedModel(TFPreTrainedModel): <ide> """ An abstract class to handle weights initialization and <del> a simple interface for dowloading and loading pretrained models. <add> a simple interface for downloading and loading pretrained models. <ide> """ <ide> <ide> config_class = XLNetConfig <ide><path>src/transformers/modeling_transfo_xl.py <ide> def forward(self, inp): <ide> <ide> class TransfoXLPreTrainedModel(PreTrainedModel): <ide> """ An abstract class to handle weights initialization and <del> a simple interface for dowloading and loading pretrained models. <add> a simple interface for downloading and loading pretrained models. <ide> """ <ide> <ide> config_class = TransfoXLConfig <ide><path>src/transformers/modeling_xlm.py <ide> def forward(self, input): <ide> <ide> class XLMPreTrainedModel(PreTrainedModel): <ide> """ An abstract class to handle weights initialization and <del> a simple interface for dowloading and loading pretrained models. <add> a simple interface for downloading and loading pretrained models. <ide> """ <ide> <ide> config_class = XLMConfig <ide><path>src/transformers/modeling_xlnet.py <ide> def forward( <ide> <ide> class XLNetPreTrainedModel(PreTrainedModel): <ide> """ An abstract class to handle weights initialization and <del> a simple interface for dowloading and loading pretrained models. <add> a simple interface for downloading and loading pretrained models. <ide> """ <ide> <ide> config_class = XLNetConfig <ide> def _init_weights(self, module): <ide> <ide> The specific attention pattern can be controlled at training and test time using the `perm_mask` input. <ide> <del> Do to the difficulty of training a fully auto-regressive model over various factorization order, <add> Due to the difficulty of training a fully auto-regressive model over various factorization order, <ide> XLNet is pretrained using only a sub-set of the output tokens as target which are selected <ide> with the `target_mapping` input. <ide> <ide><path>src/transformers/tokenization_utils.py <ide> <ide> class PreTrainedTokenizer(object): <ide> """ Base class for all tokenizers. <del> Handle all the shared methods for tokenization and special tokens as well as methods dowloading/caching/loading pretrained tokenizers as well as adding tokens to the vocabulary. <add> Handle all the shared methods for tokenization and special tokens as well as methods downloading/caching/loading pretrained tokenizers as well as adding tokens to the vocabulary. <ide> <ide> This class also contain the added tokens in a unified way on top of all tokenizers so we don't have to handle the specific vocabulary augmentation methods of the various underlying dictionary structures (BPE, sentencepiece...). <ide> <ide><path>templates/adding_a_new_model/modeling_tf_xxx.py <ide> def call( <ide> #################################################### <ide> class TFXxxPreTrainedModel(TFPreTrainedModel): <ide> """ An abstract class to handle weights initialization and <del> a simple interface for dowloading and loading pretrained models. <add> a simple interface for downloading and loading pretrained models. <ide> """ <ide> <ide> config_class = XxxConfig <ide><path>templates/adding_a_new_model/modeling_xxx.py <ide> def forward(self, hidden_states, attention_mask=None, head_mask=None): <ide> <ide> class XxxPreTrainedModel(PreTrainedModel): <ide> """ An abstract class to handle weights initialization and <del> a simple interface for dowloading and loading pretrained models. <add> a simple interface for downloading and loading pretrained models. <ide> """ <ide> <ide> config_class = XxxConfig
22
Java
Java
fix checkstyle violations
15321a31633c7a9d0f838783640e7148472e4d9a
<ide><path>spring-web/src/test/java/org/springframework/http/ContentDispositionTests.java <ide> public void parseEncodedFilenameWithInvalidName() { <ide> @Test // gh-23077 <ide> public void parseWithEscapedQuote() { <ide> <del> BiConsumer<String, String> tester = (description, filename) -> { <add> BiConsumer<String, String> tester = (description, filename) -> <ide> assertThat(parse("form-data; name=\"file\"; filename=\"" + filename + "\"; size=123")) <ide> .as(description) <ide> .isEqualTo(builder("form-data").name("file").filename(filename).size(123L).build()); <del> }; <ide> <ide> tester.accept("Escaped quotes should be ignored", <ide> "\\\"The Twilight Zone\\\".txt"); <ide> public void formatWithEncodedFilenameUsingUsAscii() { <ide> @Test // gh-24220 <ide> public void formatWithFilenameWithQuotes() { <ide> <del> BiConsumer<String, String> tester = (input, output) -> { <add> BiConsumer<String, String> tester = (input, output) -> <ide> assertThat(builder("form-data").filename(input).build().toString()) <ide> .isEqualTo("form-data; filename=\"" + output + "\""); <del> }; <ide> <ide> String filename = "\"foo.txt"; <ide> tester.accept(filename, "\\" + filename);
1
Ruby
Ruby
enforce conflicts_with placement
11a1c495f7aec573e0e5e2f286036f8e6f0aa1ad
<ide><path>Library/Homebrew/cmd/audit.rb <ide> def audit_file <ide> [/^ keg_only/, "keg_only"], <ide> [/^ option/, "option"], <ide> [/^ depends_on/, "depends_on"], <add> [/^ conflicts_with/, "conflicts_with"], <ide> [/^ (go_)?resource/, "resource"], <ide> [/^ def install/, "install method"], <ide> [/^ def caveats/, "caveats method"],
1
Javascript
Javascript
remove private enumerablecontent{will,did}change
bb626b6b15479c477f3c46c86d38d6581b8455d6
<ide><path>packages/ember-runtime/lib/mixins/array.js <ide> export function arrayContentWillChange(array, startIdx, removeAmt, addAmt) { <ide> <ide> sendEvent(array, '@array:before', [array, startIdx, removeAmt, addAmt]); <ide> <del> array.enumerableContentWillChange(removeAmt, addAmt); <add> propertyWillChange(array, '[]'); <add> <add> if (addAmt < 0 || removeAmt < 0 || addAmt - removeAmt !== 0) { <add> propertyWillChange(array, 'length'); <add> } <ide> <ide> return array; <ide> } <ide> export function arrayContentDidChange(array, startIdx, removeAmt, addAmt) { <ide> } <ide> } <ide> <del> array.enumerableContentDidChange(removeAmt, addAmt); <add> if (addAmt < 0 || removeAmt < 0 || addAmt - removeAmt !== 0) { <add> propertyDidChange(array, 'length'); <add> } <add> <add> propertyDidChange(array, '[]'); <ide> <ide> if (array.__each) { <ide> array.__each.arrayDidChange(array, startIdx, removeAmt, addAmt); <ide> const ArrayMixin = Mixin.create(Enumerable, { <ide> return arrayContentDidChange(this, startIdx, removeAmt, addAmt); <ide> }, <ide> <del> /** <del> Invoke this method just before the contents of your enumerable will <del> change. You can either omit the parameters completely or pass the objects <del> to be removed or added if available or just a count. <del> <del> @method enumerableContentWillChange <del> @param {Enumerable|Number} removing An enumerable of the objects to <del> be removed or the number of items to be removed. <del> @param {Enumerable|Number} adding An enumerable of the objects to be <del> added or the number of items to be added. <del> @chainable <del> @private <del> */ <del> enumerableContentWillChange(removing, adding) { <del> let removeCnt, addCnt, hasDelta; <del> <del> if ('number' === typeof removing) { <del> removeCnt = removing; <del> } else if (removing) { <del> removeCnt = get(removing, 'length'); <del> } else { <del> removeCnt = removing = -1; <del> } <del> <del> if ('number' === typeof adding) { <del> addCnt = adding; <del> } else if (adding) { <del> addCnt = get(adding, 'length'); <del> } else { <del> addCnt = adding = -1; <del> } <del> <del> hasDelta = addCnt < 0 || removeCnt < 0 || addCnt - removeCnt !== 0; <del> <del> if (removing === -1) { <del> removing = null; <del> } <del> <del> if (adding === -1) { <del> adding = null; <del> } <del> <del> propertyWillChange(this, '[]'); <del> <del> if (hasDelta) { <del> propertyWillChange(this, 'length'); <del> } <del> <del> return this; <del> }, <del> <del> /** <del> Invoke this method when the contents of your enumerable has changed. <del> This will notify any observers watching for content changes. If you are <del> implementing an ordered enumerable (such as an array), also pass the <del> start and end values where the content changed so that it can be used to <del> notify range observers. <del> <del> @method enumerableContentDidChange <del> @param {Enumerable|Number} removing An enumerable of the objects to <del> be removed or the number of items to be removed. <del> @param {Enumerable|Number} adding An enumerable of the objects to <del> be added or the number of items to be added. <del> @chainable <del> @private <del> */ <del> enumerableContentDidChange(removing, adding) { <del> let removeCnt, addCnt, hasDelta; <del> <del> if ('number' === typeof removing) { <del> removeCnt = removing; <del> } else if (removing) { <del> removeCnt = get(removing, 'length'); <del> } else { <del> removeCnt = removing = -1; <del> } <del> <del> if ('number' === typeof adding) { <del> addCnt = adding; <del> } else if (adding) { <del> addCnt = get(adding, 'length'); <del> } else { <del> addCnt = adding = -1; <del> } <del> <del> hasDelta = addCnt < 0 || removeCnt < 0 || addCnt - removeCnt !== 0; <del> <del> if (removing === -1) { <del> removing = null; <del> } <del> <del> if (adding === -1) { <del> adding = null; <del> } <del> <del> if (hasDelta) { <del> propertyDidChange(this, 'length'); <del> } <del> <del> propertyDidChange(this, '[]'); <del> <del> return this; <del> }, <del> <del> <ide> /** <ide> Iterates through the enumerable, calling the passed function on each <ide> item. This method corresponds to the `forEach()` method defined in
1
PHP
PHP
remove elapsed time from front controller
04f7661292e1cefb11f7510964a83085df884659
<ide><path>public/index.php <ide> * @link http://laravel.com <ide> */ <ide> <add>// -------------------------------------------------------------- <add>// Tick... Tock... Tick... Tock... <add>// -------------------------------------------------------------- <ide> define('LARAVEL_START', microtime(true)); <ide> <ide> // -------------------------------------------------------------- <ide> // -------------------------------------------------------------- <ide> // Launch Laravel. <ide> // -------------------------------------------------------------- <del>require $laravel.'/laravel.php'; <del> <del>echo number_format((microtime(true) - LARAVEL_START) * 1000, 2); <ide>\ No newline at end of file <add>require $laravel.'/laravel.php'; <ide>\ No newline at end of file
1
Python
Python
fix misleading comment in babi_memnn.py
d3227855439b69883bfc5e0ed7d94efd704dec29
<ide><path>examples/babi_memnn.py <ide> def vectorize_stories(data, word_idx, story_maxlen, query_maxlen): <ide> output_dim=64, <ide> input_length=story_maxlen)) <ide> # output: (samples, story_maxlen, embedding_dim) <del># embed the question into a single vector <add># embed the question into a sequence of vectors <ide> question_encoder = Sequential() <ide> question_encoder.add(Embedding(input_dim=vocab_size, <ide> output_dim=64,
1
Javascript
Javascript
add view config for pulltorefresh
9f8305a8375f7354f621c2feb7554ed7cd4b202d
<add><path>Libraries/Components/RefreshControl/PullToRefreshViewNativeComponent.js <del><path>Libraries/Components/RefreshControl/RCTRefreshControlNativeComponent.js <ide> <ide> 'use strict'; <ide> <add>import type { <add> BubblingEvent, <add> WithDefault, <add> CodegenNativeComponent, <add>} from '../../Types/CodegenTypes'; <add> <ide> const requireNativeComponent = require('../../ReactNative/requireNativeComponent'); <ide> <ide> import type {ColorValue} from '../../StyleSheet/StyleSheetTypes'; <ide> import type {ViewProps} from '../View/ViewPropTypes'; <del>import type {NativeComponent} from '../../Renderer/shims/ReactNative'; <ide> <del>export type NativeProps = $ReadOnly<{| <add>type NativeProps = $ReadOnly<{| <ide> ...ViewProps, <ide> <ide> /** <ide> export type NativeProps = $ReadOnly<{| <ide> /** <ide> * The title displayed under the refresh indicator. <ide> */ <del> title?: ?string, <add> title?: ?WithDefault<string, ''>, <ide> <ide> /** <ide> * Called when the view starts refreshing. <ide> */ <del> onRefresh?: ?() => mixed, <add> onRefresh?: ?(event: BubblingEvent<null>) => mixed, <ide> <ide> /** <ide> * Whether the view should be indicating an active refresh. <ide> */ <del> refreshing: boolean, <add> refreshing: WithDefault<boolean, false>, <ide> |}>; <ide> <del>type PullToRefreshView = Class<NativeComponent<NativeProps>>; <add>type PullToRefreshViewType = CodegenNativeComponent< <add> 'PullToRefreshView', <add> NativeProps, <add>>; <ide> <add>// TODO: Switch this over to require('./PullToRefreshNativeViewConfig') <add>// once the native components are renamed in paper and fabric <ide> module.exports = ((requireNativeComponent( <ide> 'RCTRefreshControl', <del>): any): PullToRefreshView); <add>): any): PullToRefreshViewType); <ide><path>Libraries/Components/RefreshControl/PullToRefreshViewNativeViewConfig.js <add> <add>/** <add> * Copyright (c) Facebook, Inc. and its affiliates. <add> * <add> * This source code is licensed under the MIT license found in the <add> * LICENSE file in the root directory of this source tree. <add> * <add> * @flow <add> */ <add> <add>'use strict'; <add> <add>const ReactNativeViewConfigRegistry = require('ReactNativeViewConfigRegistry'); <add>const ReactNativeViewViewConfig = require('ReactNativeViewViewConfig'); <add>const verifyComponentAttributeEquivalence = require('verifyComponentAttributeEquivalence'); <add> <add>const PullToRefreshViewViewConfig = { <add> uiViewClassName: 'PullToRefreshView', <add> Commands: {}, <add> <add> bubblingEventTypes: { <add> ...ReactNativeViewViewConfig.bubblingEventTypes, <add> <add> topRefresh: { <add> phasedRegistrationNames: { <add> captured: 'onRefreshCapture', <add> bubbled: 'onRefresh', <add> }, <add> }, <add> }, <add> <add> directEventTypes: { <add> ...ReactNativeViewViewConfig.directEventTypes, <add> }, <add> <add> validAttributes: { <add> ...ReactNativeViewViewConfig.validAttributes, <add> tintColor: { process: require('processColor') }, <add> titleColor: { process: require('processColor') }, <add> title: true, <add> refreshing: true, <add> onRefresh: true, <add> }, <add>}; <add> <add>verifyComponentAttributeEquivalence('PullToRefreshView', PullToRefreshViewViewConfig); <add> <add>ReactNativeViewConfigRegistry.register( <add> 'PullToRefreshView', <add> () => PullToRefreshViewViewConfig, <add>); <add> <add>module.exports = 'PullToRefreshView'; <ide><path>Libraries/Components/RefreshControl/RefreshControl.js <ide> <ide> const Platform = require('../../Utilities/Platform'); <ide> const React = require('react'); <del>const {NativeComponent} = require('../../Renderer/shims/ReactNative'); <ide> <ide> const AndroidSwipeRefreshLayoutNativeComponent = require('./AndroidSwipeRefreshLayoutNativeComponent'); <del>const RCTRefreshControlNativeComponent = require('./RCTRefreshControlNativeComponent'); <add>const PullToRefreshViewNativeComponent = require('./PullToRefreshViewNativeComponent'); <ide> const nullthrows = require('nullthrows'); <ide> <ide> import type {ColorValue} from '../../StyleSheet/StyleSheetTypes'; <ide> class RefreshControl extends React.Component<RefreshControlProps> { <ide> ...props <ide> } = this.props; <ide> return ( <del> <RCTRefreshControlNativeComponent <add> <PullToRefreshViewNativeComponent <ide> {...props} <ide> ref={setRef} <ide> onRefresh={this._onRefresh} <ide><path>packages/react-native-codegen/src/cli/viewconfigs/generate-view-configs-cli.js <ide> const fileList = argv._[0].split('\n'); <ide> const CURRENT_VIEW_CONFIG_FILES = [ <ide> 'SliderNativeComponent.js', <ide> 'ActivityIndicatorViewNativeComponent.js', <add> 'PullToRefreshViewNativeComponent.js', <ide> ]; <ide> <ide> generate(
4
PHP
PHP
suggest methods that exist in deprecation warnings
424c173ab87db8f30229e02d17047865d9faf82a
<ide><path>src/Controller/Controller.php <ide> public function __get($name) <ide> */ <ide> public function __set($name, $value) <ide> { <del> if (in_array($name, ['layout', 'view', 'theme', 'autoLayout', 'viewPath', 'layoutPath'], true)) { <add> $deprecated = [ <add> 'layout' => 'layout', <add> 'view' => 'template', <add> 'theme' => 'theme', <add> 'autoLayout' => 'autoLayout', <add> 'viewPath' => 'templatePath', <add> 'layoutPath' => 'layoutPath', <add> ]; <add> if (isset($deprecated[$name])) { <add> $method = $deprecated[$name]; <ide> trigger_error( <del> sprintf('Controller::$%s is deprecated. Use $this->viewBuilder()->%s() instead.', $name, $name), <add> sprintf( <add> 'Controller::$%s is deprecated. Use $this->viewBuilder()->%s() instead.', <add> $name, <add> $method <add> ), <ide> E_USER_DEPRECATED <ide> ); <del> $this->viewBuilder()->{$name}($value); <add> $this->viewBuilder()->{$method}($value); <ide> return; <ide> } <ide> <ide><path>tests/TestCase/Controller/ControllerTest.php <ide> public function testIsAction() <ide> <ide> /** <ide> * Test declared deprecated properties like $theme are properly passed to view. <add> * <ide> * @return void <ide> */ <ide> public function testDeclaredDeprecatedProperty()
2
Mixed
Python
parse args from .args file or json
1e616c0af33f128569c7b81a7759acb095b29675
<ide><path>examples/ner/README.md <ide> python3 run_ner.py --data_dir ./ \ <ide> <ide> If your GPU supports half-precision training, just add the `--fp16` flag. After training, the model will be both evaluated on development and test datasets. <ide> <add>### JSON-based configuration file <add> <add>Instead of passing all parameters via commandline arguments, the `run_ner.py` script also supports reading parameters from a json-based configuration file: <add> <add>```json <add>{ <add> "data_dir": ".", <add> "labels": "./labels.txt", <add> "model_name_or_path": "bert-base-multilingual-cased", <add> "output_dir": "germeval-model", <add> "max_seq_length": 128, <add> "num_train_epochs": 3, <add> "per_gpu_train_batch_size": 32, <add> "save_steps": 750, <add> "seed": 1, <add> "do_train": true, <add> "do_eval": true, <add> "do_predict": true <add>} <add>``` <add> <add>It must be saved with a `.json` extension and can be used by running `python3 run_ner.py config.json`. <add> <ide> #### Evaluation <ide> <ide> Evaluation on development dataset outputs the following for our example: <ide><path>examples/ner/run_ner.py <ide> <ide> import logging <ide> import os <add>import sys <ide> from dataclasses import dataclass, field <ide> from typing import Dict, List, Optional, Tuple <ide> <ide> def main(): <ide> # We now keep distinct sets of args, for a cleaner separation of concerns. <ide> <ide> parser = HfArgumentParser((ModelArguments, DataTrainingArguments, TrainingArguments)) <del> model_args, data_args, training_args = parser.parse_args_into_dataclasses() <add> if len(sys.argv) == 2 and sys.argv[1].endswith(".json"): <add> # If we pass only one argument to the script and it's the path to a json file, <add> # let's parse it to get our arguments. <add> model_args, data_args, training_args = parser.parse_json_file(json_file=os.path.abspath(sys.argv[1])) <add> else: <add> model_args, data_args, training_args = parser.parse_args_into_dataclasses() <ide> <ide> if ( <ide> os.path.exists(training_args.output_dir)
2
Javascript
Javascript
add providedinfo test case
6eff5de1df62e1e60d2f6409ce8e81d49ea18d0a
<ide><path>test/cases/parsing/harmony-deep-exports/cjs2.js <add>module.exports = require("./cjs3"); <ide><path>test/cases/parsing/harmony-deep-exports/cjs3.js <add>exports.a = 1; <add>exports.b = 2; <add>exports.cjs3DefaultProvidedInfo = __webpack_exports_info__.default.provideInfo; <ide><path>test/cases/parsing/harmony-deep-exports/esm1.js <add>export default 2; <add>export const esmDefaultProvidedInfo = __webpack_exports_info__.default.provideInfo; <ide><path>test/cases/parsing/harmony-deep-exports/index.js <ide> import * as C from "./reexport-namespace"; <ide> import { counter } from "./reexport-namespace"; <ide> import * as C2 from "./reexport-namespace-again"; <add>import cj2, { cjs3DefaultProvidedInfo } from "./cjs2"; <add>import esm1, { esmDefaultProvidedInfo } from "./esm1"; <add> <add>it("default providedInfo should be correct for cjs", () => { <add> expect(cj2.a).toBe(1); <add> expect(cjs3DefaultProvidedInfo).toBe(false); <add> expect(__webpack_exports_info__.cj2.default.provideInfo).toBe(false); <add>}); <add> <add>it("default providedInfo and usedInfo should be correct for esm", () => { <add> expect(esm1).toBe(2); <add> expect(esmDefaultProvidedInfo).toBe(true); <add>}); <ide> <ide> it("should allow to reexport namespaces 1", () => { <ide> (0, counter.reset)();
4
Python
Python
improve tests for snowflake hook
9ea459a6bd8073f16dc197b1147f220293557dc8
<ide><path>airflow/providers/snowflake/hooks/snowflake.py <ide> def run( <ide> self.log.info("Statement execution info - %s", row) <ide> execution_info.append(row) <ide> <add> query_id = cur.sfqid <ide> self.log.info("Rows affected: %s", cur.rowcount) <del> self.log.info("Snowflake query id: %s", cur.sfqid) <del> self.query_ids.append(cur.sfqid) <add> self.log.info("Snowflake query id: %s", query_id) <add> self.query_ids.append(query_id) <ide> <ide> # If autocommit was set to False for db that supports autocommit, <ide> # or if db does not supports autocommit, we do a manual commit. <ide><path>tests/providers/snowflake/hooks/test_snowflake.py <ide> # specific language governing permissions and limitations <ide> # under the License. <ide> # <del>import re <ide> import unittest <ide> from copy import deepcopy <ide> from pathlib import Path <ide> def test_hook_parameters_should_take_precedence(self): <ide> ) == hook.get_uri() <ide> <ide> @pytest.mark.parametrize( <del> "sql,query_ids", <add> "sql,expected_sql,expected_query_ids", <ide> [ <del> ('select * from table', ['uuid', 'uuid']), <del> ('select * from table;select * from table2', ['uuid', 'uuid', 'uuid2', 'uuid2']), <del> (['select * from table;'], ['uuid', 'uuid']), <del> (['select * from table;', 'select * from table2;'], ['uuid', 'uuid', 'uuid2', 'uuid2']), <add> ("select * from table", ["select * from table"], ["uuid"]), <add> ( <add> "select * from table;select * from table2", <add> ["select * from table;", "select * from table2"], <add> ["uuid1", "uuid2"], <add> ), <add> (["select * from table;"], ["select * from table;"], ["uuid1"]), <add> ( <add> ["select * from table;", "select * from table2;"], <add> ["select * from table;", "select * from table2;"], <add> ["uuid1", "uuid2"], <add> ), <ide> ], <ide> ) <del> def test_run_storing_query_ids_extra(self, sql, query_ids): <del> with unittest.mock.patch.dict( <del> 'os.environ', AIRFLOW_CONN_SNOWFLAKE_DEFAULT=Connection(**BASE_CONNECTION_KWARGS).get_uri() <del> ), unittest.mock.patch('airflow.providers.snowflake.hooks.snowflake.connector') as mock_connector: <del> hook = SnowflakeHook() <del> conn = mock_connector.connect.return_value <del> cur = mock.MagicMock(rowcount=0) <del> conn.cursor.return_value = cur <del> type(cur).sfqid = mock.PropertyMock(side_effect=query_ids) <del> mock_params = {"mock_param": "mock_param"} <del> hook.run(sql, parameters=mock_params) <add> @mock.patch("airflow.providers.snowflake.hooks.snowflake.SnowflakeHook.get_conn") <add> def test_run_storing_query_ids_extra(self, mock_conn, sql, expected_sql, expected_query_ids): <add> hook = SnowflakeHook() <add> conn = mock_conn.return_value <add> cur = mock.MagicMock(rowcount=0) <add> conn.cursor.return_value = cur <add> type(cur).sfqid = mock.PropertyMock(side_effect=expected_query_ids) <add> mock_params = {"mock_param": "mock_param"} <add> hook.run(sql, parameters=mock_params) <ide> <del> sql_list = sql if isinstance(sql, list) else re.findall(".*?[;]", sql) <del> cur.execute.assert_has_calls([mock.call(query, mock_params) for query in sql_list]) <del> assert hook.query_ids == query_ids[::2] <del> cur.close.assert_called() <add> cur.execute.assert_has_calls([mock.call(query, mock_params) for query in expected_sql]) <add> assert hook.query_ids == expected_query_ids <add> cur.close.assert_called() <ide> <ide> @mock.patch('airflow.providers.snowflake.hooks.snowflake.SnowflakeHook.run') <ide> def test_connection_success(self, mock_run):
2
Text
Text
fix bugs in rails_on_rack [ci-skip]
c04abbaa6366771db7434dea32f4f5b747fda1dc
<ide><path>guides/source/rails_on_rack.md <ide> WARNING: This guide assumes a working knowledge of Rack protocol and Rack concep <ide> Introduction to Rack <ide> -------------------- <ide> <del>bq. Rack provides a minimal, modular and adaptable interface for developing web applications in Ruby. By wrapping HTTP requests and responses in the simplest way possible, it unifies and distills the API for web servers, web frameworks, and software in between (the so-called middleware) into a single method call. <add>Rack provides a minimal, modular and adaptable interface for developing web applications in Ruby. By wrapping HTTP requests and responses in the simplest way possible, it unifies and distills the API for web servers, web frameworks, and software in between (the so-called middleware) into a single method call. <ide> <ide> - [Rack API Documentation](http://rack.rubyforge.org/doc/) <ide> <ide> Action Dispatcher Middleware Stack <ide> <ide> Many of Action Dispatchers's internal components are implemented as Rack middlewares. `Rails::Application` uses `ActionDispatch::MiddlewareStack` to combine various internal and external middlewares to form a complete Rails Rack application. <ide> <del>NOTE: `ActionDispatch::MiddlewareStack` is Rails' equivalent of `Rack::Builder`, but built for better flexibility and more features to meet Rails' requirements. <add>NOTE: `ActionDispatch::MiddlewareStack` is Rails equivalent of `Rack::Builder`, but built for better flexibility and more features to meet Rails' requirements. <ide> <ide> ### Inspecting Middleware Stack <ide>
1
PHP
PHP
apply fixes from styleci
04d90b85cd486b217961900ebca5be783367cb88
<ide><path>src/Illuminate/Http/Request.php <ide> protected function getInputSource() <ide> * @param \Illuminate\Http\Request|null $to <ide> * @return static <ide> */ <del> public static function createFrom(Request $from, $to = null) <add> public static function createFrom(self $from, $to = null) <ide> { <ide> $request = $to ?: new static; <ide>
1
Ruby
Ruby
remove extraneous file
c3c70f137bfaa651b9745529cffaac3f4b622840
<ide><path>scripts/helpers/parsed_file.rb <del>require 'fileutils' <del> <del>class ParsedFile <del> <del> def get_latest_file(directory) <del> puts "- retrieving latest file in directory: #{directory}" <del> Dir.glob("#{directory}/*").max_by(1) {|f| File.mtime(f)}[0] <del> end <del> <del> def save_to(directory, data) <del> # Create directory if does not exist <del> FileUtils.mkdir_p directory unless Dir.exists?(directory) <del> <del> puts "- Generating datetime stamp" <del> #Include time to the filename for uniqueness when fetching multiple times a day <del> date_time = Time.new.strftime("%Y-%m-%dT%H_%M_%S") <del> <del> # Writing parsed data to file <del> puts "- Writing data to file" <del> File.write("#{directory}/#{date_time}.txt", data) <del> end <del> <del>end <ide>\ No newline at end of file
1
Ruby
Ruby
run tests for both build environments
38974ed6b52cd65e6ab6e6b150a6b00cd80bbc4f
<ide><path>Library/Homebrew/test/test_ENV.rb <ide> require 'testing_env' <ide> require 'extend/ENV' <ide> <del>class EnvironmentTests < Homebrew::TestCase <add>module SharedEnvTests <ide> def setup <ide> @env = {}.extend(EnvActivation) <del> @env.activate_extensions! <ide> end <ide> <ide> def test_switching_compilers <ide> def test_prepend_path <ide> @env.prepend_path 'FOO', '/bin' <ide> assert_equal "/bin#{File::PATH_SEPARATOR}/usr/bin", @env['FOO'] <ide> end <del>end <ide> <del>module SharedEnvTests <ide> def test_switching_compilers_updates_compiler <ide> [:clang, :llvm, :gcc, :gcc_4_0].each do |compiler| <ide> @env.send(compiler) <ide> class StdenvTests < Homebrew::TestCase <ide> include SharedEnvTests <ide> <ide> def setup <del> @env = {}.extend(Stdenv) <add> super <add> @env.extend(Stdenv) <ide> end <ide> end <ide> <ide> class SuperenvTests < Homebrew::TestCase <ide> include SharedEnvTests <ide> <ide> def setup <del> @env = {}.extend(Superenv) <add> super <add> @env.extend(Superenv) <ide> end <ide> <ide> def test_initializes_deps
1
Javascript
Javascript
add version property to reactdom
9944bf27fb75b330202f51f58a2ce5c0ea778bef
<ide><path>packages/react-dom/src/client/ReactDOM.js <ide> const ReactDOM: Object = { <ide> IsThisRendererActing, <ide> ], <ide> }, <add> <add> version: ReactVersion, <ide> }; <ide> <ide> if (exposeConcurrentModeAPIs) {
1
Javascript
Javascript
prevent unusual commas in iframe
9c386c829f1ee01706e66bf99474ae51aa699031
<ide><path>client/src/templates/Challenges/rechallenge/builders.js <ide> A required file can not have both a src and a link: src = ${src}, link = ${link} <ide> } <ide> return ''; <ide> }) <del> .reduce((head, element) => head.concat(element), []); <add> .join('\n'); <ide> <ide> const indexHtml = findIndexHtml(challengeFiles); <ide>
1
Text
Text
add notes on include and namespacing. closes
8dc95ee22181de6e38c7187426bca9fcee9d7927
<ide><path>docs/api-guide/routers.md <ide> This means you'll need to explicitly set the `base_name` argument when registeri <ide> <ide> --- <ide> <add>### Using `include` with routers <add> <add>The `.urls` attribute on a router instance is simply a standard list of URL patterns. There are a number of different styles for how you can include these URLs. <add> <add>For example, you can append `router.urls` to a list of existing views… <add> <add> router = routers.SimpleRouter() <add> router.register(r'users', UserViewSet) <add> router.register(r'accounts', AccountViewSet) <add> <add> urlpatterns = [ <add> url(r'^forgot-password/$, ForgotPasswordFormView.as_view(), <add> ] <add> <add> urlpatterns += router.urls <add> <add>Alternatively you can use Django's `include` function, like so… <add> <add> urlpatterns = [ <add> url(r'^forgot-password/$, ForgotPasswordFormView.as_view(), <add> url(r'^', include(router.urls)) <add> ] <add> <add>Router URL patterns can also be namespaces. <add> <add> urlpatterns = [ <add> url(r'^forgot-password/$, ForgotPasswordFormView.as_view(), <add> url(r'^api/', include(router.urls, namespace='api')) <add> ] <add> <add>If using namespacing with hyperlinked serializers you'll also need to ensure that any `view_name` parameters on the serializers correctly reflect the namespace. In the example above you'd need to include a parameter such as `view_name='api:user-detail'` for serializer fields hyperlinked to the user detail view. <add> <ide> ### Extra link and actions <ide> <ide> Any methods on the viewset decorated with `@detail_route` or `@list_route` will also be routed.
1
Javascript
Javascript
convert application_test to test resolver
e53c8d247965820b066eb1166f0ea3e055852fc2
<ide><path>packages/ember-application/tests/system/application_test.js <ide> import { <ide> _loaded <ide> } from 'ember-runtime'; <ide> import { compile } from 'ember-template-compiler'; <del>import { setTemplates, setTemplate } from 'ember-glimmer'; <add>import { setTemplates } from 'ember-glimmer'; <ide> import { privatize as P } from 'container'; <ide> import { <ide> verifyInjection, <ide> verifyRegistration <ide> } from '../test-helpers/registry-check'; <add>import { assign } from 'ember-utils'; <add>import { <add> moduleFor, <add> ApplicationTestCase, <add> AbstractTestCase, <add> AutobootApplicationTestCase <add>} from 'internal-test-helpers'; <ide> <ide> let { trim } = jQuery; <add>let secondApp; <add> <add>moduleFor('Ember.Application, autobooting multiple apps', class extends ApplicationTestCase { <add> constructor() { <add> jQuery('#qunit-fixture').html(` <add> <div id="one"> <add> <div id="one-child">HI</div> <add> </div> <add> <div id="two">HI</div> <add> `); <add> super(); <add> } <ide> <del>let app, application, originalLookup, originalDebug, originalWarn; <del> <del>QUnit.module('Ember.Application', { <del> setup() { <del> originalLookup = context.lookup; <del> originalDebug = getDebugFunction('debug'); <del> originalWarn = getDebugFunction('warn'); <add> get applicationOptions() { <add> return assign(super.applicationOptions, { <add> rootElement: '#one', <add> router: null, <add> autoboot: true <add> }); <add> } <ide> <del> jQuery('#qunit-fixture').html('<div id=\'one\'><div id=\'one-child\'>HI</div></div><div id=\'two\'>HI</div>'); <del> application = run(() => Application.create({ rootElement: '#one', router: null })); <del> }, <add> buildSecondApplication(options) { <add> let myOptions = assign(this.applicationOptions, options); <add> return this.secondApp = Application.create(myOptions); <add> } <ide> <ide> teardown() { <del> jQuery('#qunit-fixture').empty(); <del> setDebugFunction('debug', originalDebug); <del> setDebugFunction('warn', originalWarn); <del> <del> context.lookup = originalLookup; <add> super.teardown(); <ide> <del> if (application) { <del> run(application, 'destroy'); <del> } <del> <del> if (app) { <del> run(app, 'destroy'); <add> if (this.secondApp) { <add> run(this.secondApp, 'destroy'); <ide> } <ide> } <del>}); <ide> <del>QUnit.test('you can make a new application in a non-overlapping element', function() { <del> app = run(() => Application.create({ rootElement: '#two', router: null })); <add> [`@test you can make a new application in a non-overlapping element`](assert) { <add> let app = run(() => this.buildSecondApplication({ <add> rootElement: '#two' <add> })); <ide> <del> run(app, 'destroy'); <del> ok(true, 'should not raise'); <del>}); <add> run(app, 'destroy'); <add> assert.ok(true, 'should not raise'); <add> } <ide> <del>QUnit.test('you cannot make a new application that is a parent of an existing application', function() { <del> expectAssertion(() => { <del> run(() => Application.create({ rootElement: '#qunit-fixture' })); <del> }); <del>}); <add> [`@test you cannot make a new application that is a parent of an existing application`]() { <add> expectAssertion(() => { <add> run(() => this.buildSecondApplication({ <add> rootElement: '#qunit-fixture' <add> })); <add> }); <add> } <ide> <del>QUnit.test('you cannot make a new application that is a descendant of an existing application', function() { <del> expectAssertion(() => { <del> run(() => Application.create({ rootElement: '#one-child' })); <del> }); <del>}); <add> [`@test you cannot make a new application that is a descendant of an existing application`]() { <add> expectAssertion(() => { <add> run(() => this.buildSecondApplication({ <add> rootElement: '#one-child' <add> })); <add> }); <add> } <ide> <del>QUnit.test('you cannot make a new application that is a duplicate of an existing application', function() { <del> expectAssertion(() => { <del> run(() => Application.create({ rootElement: '#one' })); <del> }); <del>}); <add> [`@test you cannot make a new application that is a duplicate of an existing application`]() { <add> expectAssertion(() => { <add> run(() => this.buildSecondApplication({ <add> rootElement: '#one' <add> })); <add> }); <add> } <ide> <del>QUnit.test('you cannot make two default applications without a rootElement error', function() { <del> expectAssertion(() => { <del> run(() => Application.create({ router: false })); <del> }); <add> [`@test you cannot make two default applications without a rootElement error`]() { <add> expectAssertion(() => { <add> run(() => this.buildSecondApplication()); <add> }); <add> } <ide> }); <ide> <del>QUnit.test('acts like a namespace', function() { <del> let lookup = context.lookup = {}; <add>moduleFor('Ember.Application', class extends ApplicationTestCase { <ide> <del> app = run(() => { <del> return lookup.TestApp = Application.create({ rootElement: '#two', router: false }); <del> }); <add> ['@test includes deprecated access to `application.registry`'](assert) { <add> assert.expect(3); <ide> <del> setNamespaceSearchDisabled(false); <del> app.Foo = EmberObject.extend(); <del> equal(app.Foo.toString(), 'TestApp.Foo', 'Classes pick up their parent namespace'); <del>}); <add> assert.ok(typeof this.application.registry.register === 'function', '#registry.register is available as a function'); <ide> <del>QUnit.test('includes deprecated access to `application.registry`', function() { <del> expect(3); <add> this.application.__registry__.register = function() { <add> assert.ok(true, '#register alias is called correctly'); <add> }; <ide> <del> ok(typeof application.registry.register === 'function', '#registry.register is available as a function'); <add> expectDeprecation(() => { <add> this.application.registry.register(); <add> }, /Using `Application.registry.register` is deprecated. Please use `Application.register` instead./); <add> } <ide> <del> application.__registry__.register = function() { <del> ok(true, '#register alias is called correctly'); <del> }; <add> [`@test builds a registry`](assert) { <add> let {application} = this; <add> assert.strictEqual(application.resolveRegistration('application:main'), application, `application:main is registered`); <add> assert.deepEqual(application.registeredOptionsForType('component'), { singleton: false }, `optionsForType 'component'`); <add> assert.deepEqual(application.registeredOptionsForType('view'), { singleton: false }, `optionsForType 'view'`); <add> verifyRegistration(application, 'controller:basic'); <add> verifyRegistration(application, '-view-registry:main'); <add> verifyInjection(application, 'view', '_viewRegistry', '-view-registry:main'); <add> verifyInjection(application, 'route', '_topLevelViewTemplate', 'template:-outlet'); <add> verifyRegistration(application, 'route:basic'); <add> verifyRegistration(application, 'event_dispatcher:main'); <add> verifyInjection(application, 'router:main', 'namespace', 'application:main'); <add> verifyInjection(application, 'view:-outlet', 'namespace', 'application:main'); <add> <add> verifyRegistration(application, 'location:auto'); <add> verifyRegistration(application, 'location:hash'); <add> verifyRegistration(application, 'location:history'); <add> verifyRegistration(application, 'location:none'); <add> <add> verifyInjection(application, 'controller', 'target', 'router:main'); <add> verifyInjection(application, 'controller', 'namespace', 'application:main'); <add> <add> verifyRegistration(application, P`-bucket-cache:main`); <add> verifyInjection(application, 'router', '_bucketCache', P`-bucket-cache:main`); <add> verifyInjection(application, 'route', '_bucketCache', P`-bucket-cache:main`); <add> <add> verifyInjection(application, 'route', 'router', 'router:main'); <add> <add> verifyRegistration(application, 'component:-text-field'); <add> verifyRegistration(application, 'component:-text-area'); <add> verifyRegistration(application, 'component:-checkbox'); <add> verifyRegistration(application, 'component:link-to'); <add> <add> verifyRegistration(application, 'service:-routing'); <add> verifyInjection(application, 'service:-routing', 'router', 'router:main'); <add> <add> // DEBUGGING <add> verifyRegistration(application, 'resolver-for-debugging:main'); <add> verifyInjection(application, 'container-debug-adapter:main', 'resolver', 'resolver-for-debugging:main'); <add> verifyInjection(application, 'data-adapter:main', 'containerDebugAdapter', 'container-debug-adapter:main'); <add> verifyRegistration(application, 'container-debug-adapter:main'); <add> verifyRegistration(application, 'component-lookup:main'); <add> <add> verifyRegistration(application, 'service:-glimmer-environment'); <add> verifyRegistration(application, 'service:-dom-changes'); <add> verifyRegistration(application, 'service:-dom-tree-construction'); <add> verifyInjection(application, 'service:-glimmer-environment', 'appendOperations', 'service:-dom-tree-construction'); <add> verifyInjection(application, 'service:-glimmer-environment', 'updateOperations', 'service:-dom-changes'); <add> verifyInjection(application, 'renderer', 'env', 'service:-glimmer-environment'); <add> verifyRegistration(application, 'view:-outlet'); <add> verifyRegistration(application, 'renderer:-dom'); <add> verifyRegistration(application, 'renderer:-inert'); <add> verifyRegistration(application, P`template:components/-default`); <add> verifyRegistration(application, 'template:-outlet'); <add> verifyInjection(application, 'view:-outlet', 'template', 'template:-outlet'); <add> verifyInjection(application, 'template', 'env', 'service:-glimmer-environment'); <add> assert.deepEqual(application.registeredOptionsForType('helper'), { instantiate: false }, `optionsForType 'helper'`); <add> } <ide> <del> expectDeprecation(() => { <del> application.registry.register(); <del> }, /Using `Application.registry.register` is deprecated. Please use `Application.register` instead./); <ide> }); <ide> <del>QUnit.test('builds a registry', function() { <del> strictEqual(application.resolveRegistration('application:main'), application, `application:main is registered`); <del> deepEqual(application.registeredOptionsForType('component'), { singleton: false }, `optionsForType 'component'`); <del> deepEqual(application.registeredOptionsForType('view'), { singleton: false }, `optionsForType 'view'`); <del> verifyRegistration(application, 'controller:basic'); <del> verifyRegistration(application, '-view-registry:main'); <del> verifyInjection(application, 'view', '_viewRegistry', '-view-registry:main'); <del> verifyInjection(application, 'route', '_topLevelViewTemplate', 'template:-outlet'); <del> verifyRegistration(application, 'route:basic'); <del> verifyRegistration(application, 'event_dispatcher:main'); <del> verifyInjection(application, 'router:main', 'namespace', 'application:main'); <del> verifyInjection(application, 'view:-outlet', 'namespace', 'application:main'); <del> <del> verifyRegistration(application, 'location:auto'); <del> verifyRegistration(application, 'location:hash'); <del> verifyRegistration(application, 'location:history'); <del> verifyRegistration(application, 'location:none'); <del> <del> verifyInjection(application, 'controller', 'target', 'router:main'); <del> verifyInjection(application, 'controller', 'namespace', 'application:main'); <del> <del> verifyRegistration(application, P`-bucket-cache:main`); <del> verifyInjection(application, 'router', '_bucketCache', P`-bucket-cache:main`); <del> verifyInjection(application, 'route', '_bucketCache', P`-bucket-cache:main`); <del> <del> verifyInjection(application, 'route', 'router', 'router:main'); <del> <del> verifyRegistration(application, 'component:-text-field'); <del> verifyRegistration(application, 'component:-text-area'); <del> verifyRegistration(application, 'component:-checkbox'); <del> verifyRegistration(application, 'component:link-to'); <del> <del> verifyRegistration(application, 'service:-routing'); <del> verifyInjection(application, 'service:-routing', 'router', 'router:main'); <del> <del> // DEBUGGING <del> verifyRegistration(application, 'resolver-for-debugging:main'); <del> verifyInjection(application, 'container-debug-adapter:main', 'resolver', 'resolver-for-debugging:main'); <del> verifyInjection(application, 'data-adapter:main', 'containerDebugAdapter', 'container-debug-adapter:main'); <del> verifyRegistration(application, 'container-debug-adapter:main'); <del> verifyRegistration(application, 'component-lookup:main'); <del> <del> verifyRegistration(application, 'service:-glimmer-environment'); <del> verifyRegistration(application, 'service:-dom-changes'); <del> verifyRegistration(application, 'service:-dom-tree-construction'); <del> verifyInjection(application, 'service:-glimmer-environment', 'appendOperations', 'service:-dom-tree-construction'); <del> verifyInjection(application, 'service:-glimmer-environment', 'updateOperations', 'service:-dom-changes'); <del> verifyInjection(application, 'renderer', 'env', 'service:-glimmer-environment'); <del> verifyRegistration(application, 'view:-outlet'); <del> verifyRegistration(application, 'renderer:-dom'); <del> verifyRegistration(application, 'renderer:-inert'); <del> verifyRegistration(application, P`template:components/-default`); <del> verifyRegistration(application, 'template:-outlet'); <del> verifyInjection(application, 'view:-outlet', 'template', 'template:-outlet'); <del> verifyInjection(application, 'template', 'env', 'service:-glimmer-environment'); <del> deepEqual(application.registeredOptionsForType('helper'), { instantiate: false }, `optionsForType 'helper'`); <del>}); <add>moduleFor('Ember.Application, default resolver with autoboot', class extends AutobootApplicationTestCase { <ide> <del>const originalLogVersion = ENV.LOG_VERSION; <add> constructor() { <add> super(); <add> this.originalLookup = context.lookup; <add> } <ide> <del>QUnit.module('Ember.Application initialization', { <ide> teardown() { <del> if (app) { <del> run(app, 'destroy'); <del> } <add> context.lookup = this.originalLookup; <add> super.teardown(); <ide> setTemplates({}); <del> ENV.LOG_VERSION = originalLogVersion; <ide> } <del>}); <del> <del>QUnit.test('initialized application goes to initial route', function() { <del> run(() => { <del> app = Application.create({ <del> rootElement: '#qunit-fixture' <del> }); <del> <del> app.Router.reopen({ <del> location: 'none' <del> }); <del> <del> app.register('template:application', <del> compile('{{outlet}}') <del> ); <del> <del> setTemplate('index', compile( <del> '<h1>Hi from index</h1>' <del> )); <del> }); <ide> <del> equal(jQuery('#qunit-fixture h1').text(), 'Hi from index'); <del>}); <add> createApplication(options) { <add> let myOptions = assign({ <add> Resolver: DefaultResolver <add> }, options); <add> return super.createApplication(myOptions); <add> } <ide> <del>QUnit.test('ready hook is called before routing begins', function() { <del> expect(2); <add> [`@test acts like a namespace`](assert) { <add> let lookup = context.lookup = {}; <ide> <del> run(() => { <del> function registerRoute(application, name, callback) { <del> let route = EmberRoute.extend({ <del> activate: callback <del> }); <add> run(() => { <add> lookup.TestApp = this.createApplication(); <add> }); <ide> <del> application.register('route:' + name, route); <del> } <add> setNamespaceSearchDisabled(false); <add> let Foo = this.application.Foo = EmberObject.extend(); <add> assert.equal(Foo.toString(), 'TestApp.Foo', 'Classes pick up their parent namespace'); <add> } <ide> <del> let MyApplication = Application.extend({ <del> ready() { <del> registerRoute(this, 'index', () => { <del> ok(true, 'last-minute route is activated'); <del> }); <del> } <add> [`@test can specify custom router`](assert) { <add> let MyRouter = Router.extend(); <add> run(() => { <add> let app = this.createApplication(); <add> app.Router = MyRouter; <ide> }); <add> assert.ok( <add> this.application.__deprecatedInstance__.lookup('router:main') instanceof MyRouter, <add> 'application resolved the correct router' <add> ); <add> } <ide> <del> app = MyApplication.create({ <del> rootElement: '#qunit-fixture' <add> [`@test Minimal Application initialized with just an application template`](assert) { <add> jQuery('#qunit-fixture').html('<script type="text/x-handlebars">Hello World</script>'); <add> run(() => { <add> this.createApplication(); <ide> }); <ide> <del> app.Router.reopen({ <del> location: 'none' <del> }); <add> equal(trim(jQuery('#qunit-fixture').text()), 'Hello World'); <add> } <ide> <del> registerRoute(app, 'application', () => ok(true, 'normal route is activated')); <del> }); <ide> }); <ide> <del>QUnit.test('initialize application via initialize call', function() { <del> run(() => { <del> app = Application.create({ <del> rootElement: '#qunit-fixture' <del> }); <add>moduleFor('Ember.Application, autobooting', class extends AutobootApplicationTestCase { <ide> <del> app.Router.reopen({ <del> location: 'none' <del> }); <add> constructor() { <add> super(); <add> this.originalLogVersion = ENV.LOG_VERSION; <add> this.originalDebug = getDebugFunction('debug'); <add> this.originalWarn = getDebugFunction('warn'); <add> } <ide> <del> setTemplate('application', compile( <del> '<h1>Hello!</h1>' <del> )); <del> }); <add> teardown() { <add> setDebugFunction('warn', this.originalWarn); <add> setDebugFunction('debug', this.originalDebug); <add> ENV.LOG_VERSION = this.originalLogVersion; <add> super.teardown(); <add> } <ide> <del> // This is not a public way to access the container; we just <del> // need to make some assertions about the created router <del> let router = app.__container__.lookup('router:main'); <del> equal(router instanceof Router, true, 'Router was set from initialize call'); <del> equal(router.location instanceof NoneLocation, true, 'Location was set from location implementation name'); <del>}); <add> createApplication(options, MyApplication) { <add> let application = super.createApplication(options, MyApplication); <add> this.add('router:main', Router.extend({ <add> location: 'none' <add> })); <add> return application; <add> } <ide> <del>QUnit.test('initialize application with stateManager via initialize call from Router class', function() { <del> run(() => { <del> app = Application.create({ <del> rootElement: '#qunit-fixture' <add> [`@test initialized application goes to initial route`](assert) { <add> run(() => { <add> this.createApplication(); <add> this.addTemplate('application', '{{outlet}}'); <add> this.addTemplate('index', '<h1>Hi from index</h1>'); <ide> }); <ide> <del> app.Router.reopen({ <del> location: 'none' <del> }); <add> assert.equal(jQuery('#qunit-fixture h1').text(), 'Hi from index'); <add> } <ide> <del> app.register('template:application', compile('<h1>Hello!</h1>')); <del> }); <add> [`@test ready hook is called before routing begins`](assert) { <add> assert.expect(2); <ide> <del> let router = app.__container__.lookup('router:main'); <del> equal(router instanceof Router, true, 'Router was set from initialize call'); <del> equal(jQuery('#qunit-fixture h1').text(), 'Hello!'); <del>}); <add> run(() => { <add> function registerRoute(application, name, callback) { <add> let route = EmberRoute.extend({ <add> activate: callback <add> }); <ide> <del>QUnit.test('ApplicationView is inserted into the page', function() { <del> run(() => { <del> app = Application.create({ <del> rootElement: '#qunit-fixture' <del> }); <add> application.register('route:' + name, route); <add> } <ide> <del> setTemplate('application', compile('<h1>Hello!</h1>')); <add> let MyApplication = Application.extend({ <add> ready() { <add> registerRoute(this, 'index', () => { <add> assert.ok(true, 'last-minute route is activated'); <add> }); <add> } <add> }); <ide> <del> app.ApplicationController = Controller.extend(); <add> let app = this.createApplication({}, MyApplication); <ide> <del> app.Router.reopen({ <del> location: 'none' <add> registerRoute(app, 'application', () => ok(true, 'normal route is activated')); <ide> }); <del> }); <del> <del> equal(jQuery('#qunit-fixture h1').text(), 'Hello!'); <del>}); <add> } <ide> <del>QUnit.test('Minimal Application initialized with just an application template', function() { <del> jQuery('#qunit-fixture').html('<script type="text/x-handlebars">Hello World</script>'); <del> app = run(() => { <del> return Application.create({ <del> rootElement: '#qunit-fixture' <add> [`@test initialize application via initialize call`](assert) { <add> run(() => { <add> this.createApplication(); <ide> }); <del> }); <add> // This is not a public way to access the container; we just <add> // need to make some assertions about the created router <add> let router = this.application.__deprecatedInstance__.lookup('router:main'); <add> assert.equal(router instanceof Router, true, 'Router was set from initialize call'); <add> assert.equal(router.location instanceof NoneLocation, true, 'Location was set from location implementation name'); <add> } <ide> <del> equal(trim(jQuery('#qunit-fixture').text()), 'Hello World'); <del>}); <add> [`@test initialize application with stateManager via initialize call from Router class`](assert) { <add> run(() => { <add> this.createApplication(); <add> this.addTemplate('application', '<h1>Hello!</h1>'); <add> }); <add> // This is not a public way to access the container; we just <add> // need to make some assertions about the created router <add> let router = this.application.__deprecatedInstance__.lookup('router:main'); <add> assert.equal(router instanceof Router, true, 'Router was set from initialize call'); <add> assert.equal(jQuery('#qunit-fixture h1').text(), 'Hello!'); <add> } <ide> <del>QUnit.test('enable log of libraries with an ENV var', function() { <del> if (EmberDev && EmberDev.runningProdBuild) { <del> ok(true, 'Logging does not occur in production builds'); <del> return; <add> [`@test Application Controller backs the appplication template`](assert) { <add> run(() => { <add> this.createApplication(); <add> this.addTemplate('application', '<h1>{{greeting}}</h1>'); <add> this.add('controller:application', Controller.extend({ <add> greeting: 'Hello!' <add> })); <add> }); <add> assert.equal(jQuery('#qunit-fixture h1').text(), 'Hello!'); <ide> } <ide> <del> let messages = []; <add> [`@test enable log of libraries with an ENV var`](assert) { <add> if (EmberDev && EmberDev.runningProdBuild) { <add> assert.ok(true, 'Logging does not occur in production builds'); <add> return; <add> } <ide> <del> ENV.LOG_VERSION = true; <add> let messages = []; <ide> <del> setDebugFunction('debug', message => messages.push(message)); <add> ENV.LOG_VERSION = true; <ide> <del> libraries.register('my-lib', '2.0.0a'); <add> setDebugFunction('debug', message => messages.push(message)); <ide> <del> app = run(() => { <del> return Application.create({ <del> rootElement: '#qunit-fixture' <del> }); <del> }); <add> libraries.register('my-lib', '2.0.0a'); <ide> <del> equal(messages[1], 'Ember : ' + VERSION); <del> equal(messages[2], 'jQuery : ' + jQuery().jquery); <del> equal(messages[3], 'my-lib : ' + '2.0.0a'); <add> run(() => { <add> this.createApplication(); <add> }); <ide> <del> libraries.deRegister('my-lib'); <del>}); <add> assert.equal(messages[1], 'Ember : ' + VERSION); <add> assert.equal(messages[2], 'jQuery : ' + jQuery().jquery); <add> assert.equal(messages[3], 'my-lib : ' + '2.0.0a'); <ide> <del>QUnit.test('disable log version of libraries with an ENV var', function() { <del> let logged = false; <add> libraries.deRegister('my-lib'); <add> } <ide> <del> ENV.LOG_VERSION = false; <add> [`@test disable log of version of libraries with an ENV var`](assert) { <add> let logged = false; <ide> <del> setDebugFunction('debug', () => logged = true); <add> ENV.LOG_VERSION = false; <ide> <del> jQuery('#qunit-fixture').empty(); <add> setDebugFunction('debug', () => logged = true); <ide> <del> run(() => { <del> app = Application.create({ <del> rootElement: '#qunit-fixture' <add> run(() => { <add> this.createApplication(); <ide> }); <ide> <del> app.Router.reopen({ <del> location: 'none' <del> }); <del> }); <add> assert.ok(!logged, 'library version logging skipped'); <add> } <ide> <del> ok(!logged, 'library version logging skipped'); <del>}); <add> [`@test can resolve custom router`](assert) { <add> let CustomRouter = Router.extend(); <ide> <del>QUnit.test('can resolve custom router', function() { <del> let CustomRouter = Router.extend(); <add> run(() => { <add> this.createApplication(); <add> this.add('router:main', CustomRouter); <add> }); <ide> <del> let Resolver = DefaultResolver.extend({ <del> resolveMain(parsedName) { <del> if (parsedName.type === 'router') { <del> return CustomRouter; <del> } else { <del> return this._super(parsedName); <del> } <del> } <del> }); <add> assert.ok( <add> this.application.__deprecatedInstance__.lookup('router:main') instanceof CustomRouter, <add> 'application resolved the correct router' <add> ); <add> } <ide> <del> app = run(() => { <del> return Application.create({ <del> Resolver <add> [`@test does not leak itself in onLoad._loaded`](assert) { <add> assert.equal(_loaded.application, undefined); <add> run(() => this.createApplication()); <add> assert.equal(_loaded.application, this.application); <add> run(this.application, 'destroy'); <add> assert.equal(_loaded.application, undefined); <add> } <add> <add> [`@test can build a registry via Ember.Application.buildRegistry() --- simulates ember-test-helpers`](assert) { <add> let namespace = EmberObject.create({ <add> Resolver: { create: function() { } } <ide> }); <del> }); <ide> <del> ok(app.__container__.lookup('router:main') instanceof CustomRouter, 'application resolved the correct router'); <del>}); <add> let registry = Application.buildRegistry(namespace); <ide> <del>QUnit.test('can specify custom router', function() { <del> app = run(() => { <del> return Application.create({ <del> Router: Router.extend() <del> }); <del> }); <add> assert.equal(registry.resolve('application:main'), namespace); <add> } <ide> <del> ok(app.__container__.lookup('router:main') instanceof Router, 'application resolved the correct router'); <ide> }); <ide> <del>QUnit.test('does not leak itself in onLoad._loaded', function() { <del> equal(_loaded.application, undefined); <del> let app = run(Application, 'create'); <del> equal(_loaded.application, app); <del> run(app, 'destroy'); <del> equal(_loaded.application, undefined); <del>}); <add>moduleFor('Ember.Application#buildRegistry', class extends AbstractTestCase { <ide> <del>QUnit.test('can build a registry via Ember.Application.buildRegistry() --- simulates ember-test-helpers', function(assert) { <del> let namespace = EmberObject.create({ <del> Resolver: { create: function() { } } <del> }); <add> [`@test can build a registry via Ember.Application.buildRegistry() --- simulates ember-test-helpers`](assert) { <add> let namespace = EmberObject.create({ <add> Resolver: { create() { } } <add> }); <add> <add> let registry = Application.buildRegistry(namespace); <ide> <del> let registry = Application.buildRegistry(namespace); <add> assert.equal(registry.resolve('application:main'), namespace); <add> } <ide> <del> assert.equal(registry.resolve('application:main'), namespace); <ide> }); <ide><path>packages/internal-test-helpers/lib/index.js <ide> export { default as QueryParamTestCase } from './test-cases/query-param'; <ide> export { default as AbstractRenderingTestCase } from './test-cases/abstract-rendering'; <ide> export { default as RenderingTestCase } from './test-cases/rendering'; <ide> export { default as RouterTestCase } from './test-cases/router'; <add>export { default as AutobootApplicationTestCase } from './test-cases/autoboot-application'; <add> <add>export { <add> default as TestResolver, <add> ModuleBasedResolver as ModuleBasedTestResolver <add>} from './test-resolver'; <ide><path>packages/internal-test-helpers/lib/test-cases/autoboot-application.js <add>import AbstractTestCase from './abstract'; <add>import TestResolver from '../test-resolver'; <add>import { Application } from 'ember-application'; <add>import { assign } from 'ember-utils'; <add>import { runDestroy } from '../run'; <add> <add>export default class AutobootApplicationTestCase extends AbstractTestCase { <add> <add> teardown() { <add> runDestroy(this.application); <add> super.teardown(); <add> } <add> <add> createApplication(options, MyApplication=Application) { <add> let myOptions = assign({ <add> rootElement: '#qunit-fixture', <add> Resolver: TestResolver <add> }, options); <add> let application = this.application = MyApplication.create(myOptions); <add> this.resolver = myOptions.Resolver.lastInstance; <add> return application; <add> } <add> <add> add(specifier, factory) { <add> this.resolver.add(specifier, factory); <add> } <add> <add> addTemplate(templateName, templateString) { <add> this.resolver.addTemplate(templateName, templateString); <add> } <add> <add>} <add> <ide><path>packages/internal-test-helpers/lib/test-resolver.js <add>import { compile } from 'ember-template-compiler'; <add> <add>class Resolver { <add> constructor() { <add> this._registered = {}; <add> this.constructor.lastInstance = this; <add> } <add> resolve(specifier) { <add> return this._registered[specifier]; <add> } <add> add(specifier, factory) { <add> return this._registered[specifier] = factory; <add> } <add> addTemplate(templateName, template) { <add> let templateType = typeof template; <add> if (templateType !== 'string') { <add> throw new Error(`You called addTemplate for "${templateName}" with a template argument of type of '${templateType}'. addTemplate expects an argument of an uncompiled template as a string.`); <add> } <add> return this._registered[`template:${templateName}`] = compile(template, { <add> moduleName: templateName <add> }); <add> } <add> static create() { <add> return new this(); <add> } <add>} <add> <add>export default Resolver; <add> <add>/* <add> * A resolver with moduleBasedResolver = true handles error and loading <add> * substates differently than a standard resolver. <add> */ <add>class ModuleBasedResolver extends Resolver { <add> get moduleBasedResolver() { <add> return true; <add> } <add>} <add> <add>export { ModuleBasedResolver }
4
PHP
PHP
use minimal error layout
83ca9a7706a8091de9da17cb687a0852c9ef1960
<ide><path>src/Illuminate/Foundation/Exceptions/views/401.blade.php <del>@extends('errors::illustrated-layout') <add>@extends('errors::minimal') <ide> <del>@section('code', '401') <ide> @section('title', __('Unauthorized')) <del> <del>@section('image') <del><div style="background-image: url({{ asset('/svg/403.svg') }});" class="absolute pin bg-cover bg-no-repeat md:bg-left lg:bg-center"> <del></div> <del>@endsection <del> <del>@section('message', __('Sorry, you are not authorized to access this page.')) <add>@section('code', '401') <add>@section('message', __('Unauthorized')) <ide><path>src/Illuminate/Foundation/Exceptions/views/403.blade.php <del>@extends('errors::illustrated-layout') <add>@extends('errors::minimal') <ide> <del>@section('code', '403') <ide> @section('title', __('Forbidden')) <del> <del>@section('image') <del><div style="background-image: url({{ asset('/svg/403.svg') }});" class="absolute pin bg-cover bg-no-repeat md:bg-left lg:bg-center"> <del></div> <del>@endsection <del> <del>@section('message', __($exception->getMessage() ?: __('Sorry, you are forbidden from accessing this page.'))) <add>@section('code', '403') <add>@section('message', __('Forbidden')) <ide><path>src/Illuminate/Foundation/Exceptions/views/404.blade.php <del>@extends('errors::illustrated-layout') <add>@extends('errors::minimal') <ide> <add>@section('title', __('Not Found')) <ide> @section('code', '404') <del>@section('title', __('Page Not Found')) <del> <del>@section('image') <del><div style="background-image: url({{ asset('/svg/404.svg') }});" class="absolute pin bg-cover bg-no-repeat md:bg-left lg:bg-center"> <del></div> <del>@endsection <del> <del>@section('message', __('Sorry, the page you are looking for could not be found.')) <add>@section('message', __('Not Found')) <ide><path>src/Illuminate/Foundation/Exceptions/views/419.blade.php <del>@extends('errors::illustrated-layout') <add>@extends('errors::minimal') <ide> <del>@section('code', '419') <ide> @section('title', __('Page Expired')) <del> <del>@section('image') <del><div style="background-image: url({{ asset('/svg/403.svg') }});" class="absolute pin bg-cover bg-no-repeat md:bg-left lg:bg-center"> <del></div> <del>@endsection <del> <del>@section('message', __('Sorry, your session has expired. Please refresh and try again.')) <add>@section('code', '419') <add>@section('message', __('Page Expired')) <ide><path>src/Illuminate/Foundation/Exceptions/views/429.blade.php <del>@extends('errors::illustrated-layout') <add>@extends('errors::minimal') <ide> <del>@section('code', '429') <ide> @section('title', __('Too Many Requests')) <del> <del>@section('image') <del><div style="background-image: url({{ asset('/svg/403.svg') }});" class="absolute pin bg-cover bg-no-repeat md:bg-left lg:bg-center"> <del></div> <del>@endsection <del> <del>@section('message', __('Sorry, you are making too many requests to our servers.')) <add>@section('code', '429') <add>@section('message', __('Too Many Requests')) <ide><path>src/Illuminate/Foundation/Exceptions/views/500.blade.php <del>@extends('errors::illustrated-layout') <add>@extends('errors::minimal') <ide> <add>@section('title', __('Server Error')) <ide> @section('code', '500') <del>@section('title', __('Error')) <del> <del>@section('image') <del><div style="background-image: url({{ asset('/svg/500.svg') }});" class="absolute pin bg-cover bg-no-repeat md:bg-left lg:bg-center"> <del></div> <del>@endsection <del> <del>@section('message', __('Whoops, something went wrong on our servers.')) <add>@section('message', __('Server Error')) <ide><path>src/Illuminate/Foundation/Exceptions/views/503.blade.php <del>@extends('errors::illustrated-layout') <add>@extends('errors::minimal') <ide> <del>@section('code', '503') <ide> @section('title', __('Service Unavailable')) <del> <del>@section('image') <del><div style="background-image: url({{ asset('/svg/503.svg') }});" class="absolute pin bg-cover bg-no-repeat md:bg-left lg:bg-center"> <del></div> <del>@endsection <del> <del>@section('message', __($exception->getMessage() ?: __('Sorry, we are doing some maintenance. Please check back soon.'))) <add>@section('code', '503') <add>@section('message', __('Service Unavailable')) <ide><path>src/Illuminate/Foundation/Exceptions/views/minimal.blade.php <add><!DOCTYPE html> <add><html lang="en"> <add> <head> <add> <meta charset="utf-8"> <add> <meta name="viewport" content="width=device-width, initial-scale=1"> <add> <add> <title>@yield('title')</title> <add> <add> <!-- Fonts --> <add> <link rel="dns-prefetch" href="//fonts.gstatic.com"> <add> <link href="https://fonts.googleapis.com/css?family=Nunito" rel="stylesheet" type="text/css"> <add> <add> <!-- Styles --> <add> <style> <add> html, body { <add> background-color: #fff; <add> color: #636b6f; <add> font-family: 'Nunito', sans-serif; <add> font-weight: 100; <add> height: 100vh; <add> margin: 0; <add> } <add> <add> .full-height { <add> height: 100vh; <add> } <add> <add> .flex-center { <add> align-items: center; <add> display: flex; <add> justify-content: center; <add> } <add> <add> .position-ref { <add> position: relative; <add> } <add> <add> .code { <add> border-right: 2px solid; <add> font-size: 26px; <add> padding: 0 15px 0 15px; <add> text-align: center; <add> } <add> <add> .message { <add> font-size: 18px; <add> text-align: center; <add> } <add> </style> <add> </head> <add> <body> <add> <div class="flex-center position-ref full-height"> <add> <div class="code"> <add> @yield('code') <add> </div> <add> <add> <div class="message" style="padding: 10px;"> <add> @yield('message') <add> </div> <add> </div> <add> </body> <add></html>
8
Javascript
Javascript
stop immediate propagation on tap events
a7d624affe53ead68bf70bf0bb6eedee34f728da
<ide><path>src/js/component.js <ide> vjs.Component.prototype.emitTapEvents = function(){ <ide> <ide> // When the touch ends, measure how long it took and trigger the appropriate <ide> // event <del> this.on('touchend', function() { <add> this.on('touchend', function(event) { <add> event.stopImmediatePropagation(); <add> <ide> // Proceed only if the touchmove/leave/cancel event didn't happen <ide> if (couldBeTap === true) { <ide> // Measure how long the touch lasted <ide><path>src/js/media/media.js <ide> vjs.MediaTechController.prototype.onClick = function(event){ <ide> */ <ide> <ide> vjs.MediaTechController.prototype.onTap = function(){ <del> this.player().userActive(!this.player().userActive()); <add> var userActivity = this.player().userActive(); <add> if (userActivity) { <add> this.player().userActive(!userActivity); <add> } <ide> }; <ide> <ide> vjs.MediaTechController.prototype.features = {
2
Ruby
Ruby
remove needless blank lines [ci skip]
11c06d3cbf17bb6133108df4207440a545bdc052
<ide><path>actionview/lib/action_view/helpers/form_options_helper.rb <ide> def collection_select(object, method, collection, value_method, text_method, opt <ide> # array of child objects representing the <tt><option></tt> tags. It can also be any object that responds <ide> # to +call+, such as a +proc+, that will be called for each member of the +collection+ to retrieve the <ide> # value. <del> <ide> # * +group_label_method+ - The name of a method which, when called on a member of +collection+, returns a <ide> # string to be used as the +label+ attribute for its <tt><optgroup></tt> tag. It can also be any object <ide> # that responds to +call+, such as a +proc+, that will be called for each member of the +collection+ to <ide> # retrieve the label. <del> <ide> # * +option_key_method+ - The name of a method which, when called on a child object of a member of <ide> # +collection+, returns a value to be used as the +value+ attribute for its <tt><option></tt> tag. <ide> # * +option_value_method+ - The name of a method which, when called on a child object of a member of
1
Go
Go
enable direct io
d18f5c3808f8df40fb8e3e153887e921bc71103b
<ide><path>daemon/graphdriver/aufs/aufs.go <ide> func (a *Driver) aufsMount(ro []string, rw, target, mountLabel string) (err erro <ide> // Mount options are clipped to page size(4096 bytes). If there are more <ide> // layers then these are remounted individually using append. <ide> <del> b := make([]byte, syscall.Getpagesize()-len(mountLabel)-50) // room for xino & mountLabel <add> b := make([]byte, syscall.Getpagesize()-len(mountLabel)-54) // room for xino & mountLabel <ide> bp := copy(b, fmt.Sprintf("br:%s=rw", rw)) <ide> <ide> firstMount := true <ide> func (a *Driver) aufsMount(ro []string, rw, target, mountLabel string) (err erro <ide> } <ide> <ide> if firstMount { <del> data := label.FormatMountLabel(fmt.Sprintf("%s,xino=/dev/shm/aufs.xino", string(b[:bp])), mountLabel) <add> data := label.FormatMountLabel(fmt.Sprintf("%s,dio,xino=/dev/shm/aufs.xino", string(b[:bp])), mountLabel) <ide> if err = mount("none", target, "aufs", 0, data); err != nil { <ide> return <ide> }
1
Ruby
Ruby
test that a datetime acts_like_date
6343227bb0b3bab1b4e3c9e71ce169b9c462ce0f
<ide><path>activesupport/test/core_ext/date_time_ext_test.rb <ide> def test_current_with_time_zone <ide> end <ide> end <ide> <add> def test_acts_like_date <add> assert DateTime.new.acts_like_date? <add> end <add> <ide> def test_acts_like_time <ide> assert DateTime.new.acts_like_time? <ide> end
1