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 |
|---|---|---|---|---|---|
Text | Text | expand instructions for chai assertion challenges | 9899035f340a1881b39a1267839873b7f745ed4c | <ide><path>curriculum/challenges/english/06-information-security-and-quality-assurance/quality-assurance-and-testing-with-chai/assert-deep-equality-with-.deepequal-and-.notdeepequal.english.md
<ide> challengeType: 2
<ide> ## Description
<ide> <section id='description'>
<ide> As a reminder, this project is being built upon the following starter project on <a href='https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-mochachai/'>Glitch</a>, or cloned from <a href='https://github.com/freeCodeCamp/boilerplate-mochachai/'>GitHub</a>.
<del><code>.deepEqual()</code>, <code>.notDeepEqual()</code>.
<del><code>.deepEqual()</code> asserts that two object are deep equal.
<add><code>deepEqual()</code> asserts that two object are deep equal.
<ide> </section>
<ide>
<ide> ## Instructions
<ide> <section id='instructions'>
<add>Use <code>assert.deepEqual()</code> or <code>assert.notDeepEqual()</code> to make the tests pass.
<ide>
<ide> </section>
<ide>
<ide><path>curriculum/challenges/english/06-information-security-and-quality-assurance/quality-assurance-and-testing-with-chai/compare-the-properties-of-two-elements.english.md
<ide> challengeType: 2
<ide> ## Description
<ide> <section id='description'>
<ide> As a reminder, this project is being built upon the following starter project on <a href='https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-mochachai/'>Glitch</a>, or cloned from <a href='https://github.com/freeCodeCamp/boilerplate-mochachai/'>GitHub</a>.
<del><code>.isAbove() => a > b</code> , <code>.isAtMost() => a <= b</code>.
<ide> </section>
<ide>
<ide> ## Instructions
<ide> <section id='instructions'>
<ide>
<add>Use <code>assert.isAbove()</code>(i.e. greater) or <code>assert.isAtMost()</code> (i.e. less than or equal) to make the tests pass.
<ide> </section>
<ide>
<ide> ## Tests
<ide><path>curriculum/challenges/english/06-information-security-and-quality-assurance/quality-assurance-and-testing-with-chai/test-for-truthiness.english.md
<ide> challengeType: 2
<ide> <section id='description'>
<ide> As a reminder, this project is being built upon the following starter project on <a href='https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-mochachai/'>Glitch</a>, or cloned from <a href='https://github.com/freeCodeCamp/boilerplate-mochachai/'>GitHub</a>.
<ide>
<add><code>isTrue()</code> will test for the boolean value true and <code>isNotTrue()</code> will pass when given anything but the boolean value of true.
<add><blockquote>
<add>assert.isTrue(true, 'this will pass with the boolean value true');
<add>assert.isTrue('true', 'this will NOT pass with the string value 'true');
<add>assert.isTrue(1, 'this will NOT pass with the number value 1');
<add></blockquote>
<add>
<add><code>isFalse()</code> and <code>isNotFalse()</code> also exist and behave similary to their true counterparts except they look for the boolean value of false.
<ide> </section>
<ide>
<ide> ## Instructions
<ide> <section id='instructions'>
<ide> Use <code>assert.isTrue()</code> or <code>assert.isNotTrue()</code> to make the tests pass.
<del><code>.isTrue(true)</code> and <code>.isNotTrue(everything else)</code> will pass.
<del><code>.isFalse()</code> and <code>.isNotFalse()</code> also exist.
<ide> </section>
<ide>
<ide> ## Tests
<ide><path>curriculum/challenges/english/06-information-security-and-quality-assurance/quality-assurance-and-testing-with-chai/test-if-a-string-contains-a-substring.english.md
<ide> challengeType: 2
<ide> ## Description
<ide> <section id='description'>
<ide> As a reminder, this project is being built upon the following starter project on <a href='https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-mochachai/'>Glitch</a>, or cloned from <a href='https://github.com/freeCodeCamp/boilerplate-mochachai/'>GitHub</a>.
<del><code>#include (or #notInclude)</code> works for strings too!!
<del>It asserts that the actual string contains the expected substring.
<add>
<add><code>include()</code> and <code>notInclude()</code> work for strings too!
<add><code>include()</code> asserts that the actual string contains the expected substring.
<ide> </section>
<ide>
<ide> ## Instructions
<ide> <section id='instructions'>
<add>Use <code>assert.include()</code> or <code>assert.notInclude()</code> to make the tests pass.
<add>
<ide>
<ide> </section>
<ide>
<ide><path>curriculum/challenges/english/06-information-security-and-quality-assurance/quality-assurance-and-testing-with-chai/test-if-a-value-falls-within-a-specific-range.english.md
<ide> challengeType: 2
<ide> <section id='description'>
<ide> As a reminder, this project is being built upon the following starter project on <a href='https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-mochachai/'>Glitch</a>, or cloned from <a href='https://github.com/freeCodeCamp/boilerplate-mochachai/'>GitHub</a>.
<ide>
<add><code>.approximately(actual, expected, delta, [message])</code>
<add>Asserts that the actual is equal <code>expected</code>, to within a +/- <code>delta</code> range.
<ide> </section>
<ide>
<ide> ## Instructions
<ide> <section id='instructions'>
<del><code>.approximately</code>
<del><code>.approximately(actual, expected, range, [message])</code>
<del><code>actual = expected +/- range</code>
<add>Use <code>assert.approximately()</code> to make the tests pass.
<ide> Choose the minimum range (3rd parameter) to make the test always pass. It should be less than 1.
<ide> </section>
<ide>
<ide><path>curriculum/challenges/english/06-information-security-and-quality-assurance/quality-assurance-and-testing-with-chai/test-if-a-value-is-a-string.english.md
<ide> challengeType: 2
<ide> ## Description
<ide> <section id='description'>
<ide> As a reminder, this project is being built upon the following starter project on <a href='https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-mochachai/'>Glitch</a>, or cloned from <a href='https://github.com/freeCodeCamp/boilerplate-mochachai/'>GitHub</a>.
<del><code>#isString</code> or <code>#isNotString</code> asserts that the actual value is a string.
<add><code>isString</code> or <code>isNotString</code> asserts that the actual value is a string.
<ide> </section>
<ide>
<ide> ## Instructions
<ide> <section id='instructions'>
<del>
<add>Use <code>assert.isString()</code> or <code>assert.isNotString()</code> to make the tests pass.
<ide> </section>
<ide>
<ide> ## Tests
<ide><path>curriculum/challenges/english/06-information-security-and-quality-assurance/quality-assurance-and-testing-with-chai/test-if-a-value-is-an-array.english.md
<ide> As a reminder, this project is being built upon the following starter project on
<ide>
<ide> ## Instructions
<ide> <section id='instructions'>
<del>
<add>Use <code>assert.isArray()</code> or <code>assert.isNotArray()</code> to make the tests pass.
<ide> </section>
<ide>
<ide> ## Tests
<ide><path>curriculum/challenges/english/06-information-security-and-quality-assurance/quality-assurance-and-testing-with-chai/test-if-a-value-is-of-a-specific-data-structure-type.english.md
<ide> As a reminder, this project is being built upon the following starter project on
<ide>
<ide> ## Instructions
<ide> <section id='instructions'>
<del>Use <code>#typeOf</code> or <code>#notTypeOf</code> where it is appropriate.
<add>Use <code>assert.typeOf()</code> or <code>assert.notTypeOf()</code> to make the tests pass.
<ide> </section>
<ide>
<ide> ## Tests
<ide><path>curriculum/challenges/english/06-information-security-and-quality-assurance/quality-assurance-and-testing-with-chai/test-if-an-array-contains-an-item.english.md
<ide> As a reminder, this project is being built upon the following starter project on
<ide>
<ide> ## Instructions
<ide> <section id='instructions'>
<del>
<add>Use <code>assert.include()</code> or <code>assert.notInclude()</code> to make the tests pass.
<ide> </section>
<ide>
<ide> ## Tests
<ide><path>curriculum/challenges/english/06-information-security-and-quality-assurance/quality-assurance-and-testing-with-chai/test-if-an-object-has-a-property.english.md
<ide> As a reminder, this project is being built upon the following starter project on
<ide>
<ide> ## Instructions
<ide> <section id='instructions'>
<del>Use <code>#property</code> or <code>#notProperty</code> where it is appropriate.
<add>Use <code>assert.property()</code> or <code>assert.notProperty()</code> to make the tests pass.
<ide> </section>
<ide>
<ide> ## Tests
<ide><path>curriculum/challenges/english/06-information-security-and-quality-assurance/quality-assurance-and-testing-with-chai/test-if-an-object-is-an-instance-of-a-constructor.english.md
<ide> As a reminder, this project is being built upon the following starter project on
<ide>
<ide> ## Instructions
<ide> <section id='instructions'>
<del>Use <code>#instanceOf</code> or <code>#notInstanceOf</code> where it is appropriate.
<add>Use <code>assert.instanceOf()</code> or <code>assert.notInstanceOf()</code> to make the tests pass.
<ide> </section>
<ide>
<ide> ## Tests
<ide><path>curriculum/challenges/english/06-information-security-and-quality-assurance/quality-assurance-and-testing-with-chai/test-if-one-value-is-below-or-at-least-as-large-as-another.english.md
<ide> challengeType: 2
<ide> ## Description
<ide> <section id='description'>
<ide> As a reminder, this project is being built upon the following starter project on <a href='https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-mochachai/'>Glitch</a>, or cloned from <a href='https://github.com/freeCodeCamp/boilerplate-mochachai/'>GitHub</a>.
<del><code>.isBelow() => a < b</code> , <code>.isAtLeast => a >= b</code>.
<ide> </section>
<ide>
<ide> ## Instructions
<ide> <section id='instructions'>
<add>Use <code>assert.isBelow()</code> (i.e. less than) or <code>assert.isAtLeast()</code> (i.e. greater than or equal) to make the tests pass.
<ide>
<ide> </section>
<ide>
<ide><path>curriculum/challenges/english/06-information-security-and-quality-assurance/quality-assurance-and-testing-with-chai/use-assert.isok-and-assert.isnotok.english.md
<ide> challengeType: 2
<ide> <section id='description'>
<ide> As a reminder, this project is being built upon the following starter project on <a href='https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-mochachai/'>Glitch</a>, or cloned from <a href='https://github.com/freeCodeCamp/boilerplate-mochachai/'>GitHub</a>.
<ide>
<add><code>isOk()</code> will test for a truthy value and <code>isNotOk()</code> will test for a falsy value.
<add>Truthy reference: https://developer.mozilla.org/en-US/docs/Glossary/Truthy
<add>Falsy reference: https://developer.mozilla.org/en-US/docs/Glossary/Falsy
<ide> </section>
<ide>
<ide> ## Instructions
<ide> <section id='instructions'>
<ide> Use <code>assert.isOk()</code> or <code>assert.isNotOk()</code> to make the tests pass.
<del><code>.isOk(truthy)</code> and <code>.isNotOk(falsey)</code> will pass.
<ide> </section>
<ide>
<ide> ## Tests
<ide><path>curriculum/challenges/english/06-information-security-and-quality-assurance/quality-assurance-and-testing-with-chai/use-regular-expressions-to-test-a-string.english.md
<ide> challengeType: 2
<ide> ## Description
<ide> <section id='description'>
<ide> As a reminder, this project is being built upon the following starter project on <a href='https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-mochachai/'>Glitch</a>, or cloned from <a href='https://github.com/freeCodeCamp/boilerplate-mochachai/'>GitHub</a>.
<del><code>#match</code> asserts that the actual value matches the second argument regular expression.
<add><code>match()</code> asserts that the actual value matches the second argument regular expression.
<ide> </section>
<ide>
<ide> ## Instructions
<ide> <section id='instructions'>
<add>Use <code>assert.match()</code> to make the tests pass.
<ide>
<ide> </section>
<ide>
<ide><path>curriculum/challenges/english/06-information-security-and-quality-assurance/quality-assurance-and-testing-with-chai/use-the-double-equals-to-assert-equality.english.md
<ide> challengeType: 2
<ide> ## Description
<ide> <section id='description'>
<ide> As a reminder, this project is being built upon the following starter project on <a href='https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-mochachai/'>Glitch</a>, or cloned from <a href='https://github.com/freeCodeCamp/boilerplate-mochachai/'>GitHub</a>.
<del><code>.equal()</code>, <code>.notEqual()</code>.
<del><code>.equal()</code> compares objects using <code>'=='</code>.
<add><code>equal()</code> compares objects using <code>==</code>.
<ide> </section>
<ide>
<ide> ## Instructions
<ide> <section id='instructions'>
<add>Use <code>assert.equal()</code> or <code>assert.notEqual()</code> to make the tests pass.
<ide>
<ide> </section>
<ide>
<ide><path>curriculum/challenges/english/06-information-security-and-quality-assurance/quality-assurance-and-testing-with-chai/use-the-triple-equals-to-assert-strict-equality.english.md
<ide> challengeType: 2
<ide> ## Description
<ide> <section id='description'>
<ide> As a reminder, this project is being built upon the following starter project on <a href='https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-mochachai/'>Glitch</a>, or cloned from <a href='https://github.com/freeCodeCamp/boilerplate-mochachai/'>GitHub</a>.
<del><code>.strictEqual()</code>, <code>.notStrictEqual()</code>.
<del><code>.strictEqual()</code> compares objects using <code>'==='</code>.
<add><code>strictEqual()</code> compares objects using <code>===</code>.
<ide> </section>
<ide>
<ide> ## Instructions
<ide> <section id='instructions'>
<add>Use <code>assert.strictEqual()</code> or <code>assert.notStrictEqual()</code> to make the tests pass.
<ide>
<ide> </section>
<ide> | 16 |
Mixed | Python | update default projects repo [ci skip] | 908f3a449411cd1cedab93ed0e9e7ee0f0f9248d | <ide><path>spacy/about.py
<ide> __release__ = True
<ide> __download_url__ = "https://github.com/explosion/spacy-models/releases/download"
<ide> __compatibility__ = "https://raw.githubusercontent.com/explosion/spacy-models/master/compatibility.json"
<del>__projects__ = "https://github.com/explosion/spacy-boilerplates"
<add>__projects__ = "https://github.com/explosion/projects"
<add>__projects_branch__ = "v3"
<ide><path>spacy/cli/project/clone.py
<ide> def project_clone_cli(
<ide> name: str = Arg(..., help="The name of the template to clone"),
<ide> dest: Optional[Path] = Arg(None, help="Where to clone the project. Defaults to current working directory", exists=False),
<ide> repo: str = Opt(about.__projects__, "--repo", "-r", help="The repository to clone from"),
<del> branch: str = Opt("master", "--branch", "-b", help="The branch to clone from")
<add> branch: str = Opt(about.__projects_branch__, "--branch", "-b", help="The branch to clone from")
<ide> # fmt: on
<ide> ):
<ide> """Clone a project template from a repository. Calls into "git" and will
<ide> def project_clone_cli(
<ide>
<ide>
<ide> def project_clone(
<del> name: str, dest: Path, *, repo: str = about.__projects__, branch: str = "master"
<add> name: str,
<add> dest: Path,
<add> *,
<add> repo: str = about.__projects__,
<add> branch: str = about.__projects_branch__,
<ide> ) -> None:
<ide> """Clone a project template from a repository.
<ide>
<ide><path>website/docs/usage/projects.md
<ide> project template and copies the files to a local directory. You can then run the
<ide> project, e.g. to train a pipeline and edit the commands and scripts to build
<ide> fully custom workflows.
<ide>
<add><!-- TODO: update with real example project -->
<add>
<ide> ```cli
<ide> python -m spacy project clone some_example_project
<ide> ``` | 3 |
Javascript | Javascript | add `getarray` method to `dict` | 75557d27d156bac9c03417a79d12c349be478593 | <ide><path>src/core/obj.js
<ide> var Dict = (function DictClosure() {
<ide> return Promise.resolve(value);
<ide> },
<ide>
<add> // Same as get(), but dereferences all elements if the result is an Array.
<add> getArray: function Dict_getArray(key1, key2, key3) {
<add> var value = this.get(key1, key2, key3);
<add> if (!isArray(value)) {
<add> return value;
<add> }
<add> value = value.slice(); // Ensure that we don't modify the Dict data.
<add> for (var i = 0, ii = value.length; i < ii; i++) {
<add> if (!isRef(value[i])) {
<add> continue;
<add> }
<add> value[i] = this.xref.fetch(value[i]);
<add> }
<add> return value;
<add> },
<add>
<ide> // no dereferencing
<ide> getRaw: function Dict_getRaw(key) {
<ide> return this.map[key]; | 1 |
Python | Python | fix string concats left over by black | 53c893b646252d610e877eb9385e9e250a1ae5e1 | <ide><path>examples/tutorial/flaskr/blog.py
<ide> def create():
<ide> else:
<ide> db = get_db()
<ide> db.execute(
<del> "INSERT INTO post (title, body, author_id)" " VALUES (?, ?, ?)",
<add> "INSERT INTO post (title, body, author_id) VALUES (?, ?, ?)",
<ide> (title, body, g.user["id"]),
<ide> )
<ide> db.commit()
<ide><path>src/flask/app.py
<ide> def finalize_request(self, rv, from_error_handler=False):
<ide> if not from_error_handler:
<ide> raise
<ide> self.logger.exception(
<del> "Request finalizing failed with an " "error while handling an error"
<add> "Request finalizing failed with an error while handling an error"
<ide> )
<ide> return response
<ide>
<ide><path>src/flask/cli.py
<ide> def get_version(ctx, param, value):
<ide> import werkzeug
<ide> from . import __version__
<ide>
<del> message = "Python %(python)s\n" "Flask %(flask)s\n" "Werkzeug %(werkzeug)s"
<add> message = "Python %(python)s\nFlask %(flask)s\nWerkzeug %(werkzeug)s"
<ide> click.echo(
<ide> message
<ide> % {
<ide><path>src/flask/ctx.py
<ide> def pop(self, exc=_sentinel):
<ide> if app_ctx is not None:
<ide> app_ctx.pop(exc)
<ide>
<del> assert (
<del> rv is self
<del> ), "Popped wrong request context. " "(%r instead of %r)" % (rv, self)
<add> assert rv is self, "Popped wrong request context. (%r instead of %r)" % (
<add> rv,
<add> self,
<add> )
<ide>
<ide> def auto_pop(self, exc):
<ide> if self.request.environ.get("flask._preserve_context") or (
<ide><path>src/flask/helpers.py
<ide> def _endpoint_from_view_func(view_func):
<ide> """Internal helper that returns the default endpoint for a given
<ide> function. This always is the function name.
<ide> """
<del> assert view_func is not None, "expected view func if endpoint " "is not provided."
<add> assert view_func is not None, "expected view func if endpoint is not provided."
<ide> return view_func.__name__
<ide>
<ide>
<ide> def send_file(
<ide> headers = Headers()
<ide> if as_attachment:
<ide> if attachment_filename is None:
<del> raise TypeError(
<del> "filename unavailable, required for " "sending as attachment"
<del> )
<add> raise TypeError("filename unavailable, required for sending as attachment")
<ide>
<ide> if not isinstance(attachment_filename, text_type):
<ide> attachment_filename = attachment_filename.decode("utf-8")
<ide><path>src/flask/testing.py
<ide> def session_transaction(self, *args, **kwargs):
<ide> """
<ide> if self.cookie_jar is None:
<ide> raise RuntimeError(
<del> "Session transactions only make sense " "with cookies enabled."
<add> "Session transactions only make sense with cookies enabled."
<ide> )
<ide> app = self.application
<ide> environ_overrides = kwargs.setdefault("environ_overrides", {})
<ide> def session_transaction(self, *args, **kwargs):
<ide> sess = session_interface.open_session(app, c.request)
<ide> if sess is None:
<ide> raise RuntimeError(
<del> "Session backend did not open a session. " "Check the configuration"
<add> "Session backend did not open a session. Check the configuration"
<ide> )
<ide>
<ide> # Since we have to open a new request context for the session
<ide><path>tests/test_basic.py
<ide> def foo():
<ide> with pytest.raises(AssertionError) as e:
<ide> client.post("/foo", data={})
<ide> assert "http://localhost/foo/" in str(e)
<del> assert ("Make sure to directly send " "your POST-request to this URL") in str(e)
<add> assert ("Make sure to directly send your POST-request to this URL") in str(e)
<ide>
<ide> rv = client.get("/foo", data={}, follow_redirects=True)
<ide> assert rv.data == b"success"
<ide><path>tests/test_config.py
<ide> def test_config_from_envvar_missing(monkeypatch):
<ide> app.config.from_envvar("FOO_SETTINGS")
<ide> msg = str(e.value)
<ide> assert msg.startswith(
<del> "[Errno 2] Unable to load configuration " "file (No such file or directory):"
<add> "[Errno 2] Unable to load configuration file (No such file or directory):"
<ide> )
<ide> assert msg.endswith("missing.cfg'")
<ide> assert not app.config.from_envvar("FOO_SETTINGS", silent=True)
<ide> def test_config_missing():
<ide> app.config.from_pyfile("missing.cfg")
<ide> msg = str(e.value)
<ide> assert msg.startswith(
<del> "[Errno 2] Unable to load configuration " "file (No such file or directory):"
<add> "[Errno 2] Unable to load configuration file (No such file or directory):"
<ide> )
<ide> assert msg.endswith("missing.cfg'")
<ide> assert not app.config.from_pyfile("missing.cfg", silent=True)
<ide> def test_config_missing_json():
<ide> app.config.from_json("missing.json")
<ide> msg = str(e.value)
<ide> assert msg.startswith(
<del> "[Errno 2] Unable to load configuration " "file (No such file or directory):"
<add> "[Errno 2] Unable to load configuration file (No such file or directory):"
<ide> )
<ide> assert msg.endswith("missing.json'")
<ide> assert not app.config.from_json("missing.json", silent=True)
<ide><path>tests/test_instance_config.py
<ide> def test_installed_module_paths(
<ide> modules_tmpdir, modules_tmpdir_prefix, purge_module, site_packages, limit_loader
<ide> ):
<ide> site_packages.join("site_app.py").write(
<del> "import flask\n" "app = flask.Flask(__name__)\n"
<add> "import flask\napp = flask.Flask(__name__)\n"
<ide> )
<ide> purge_module("site_app")
<ide>
<ide><path>tests/test_templating.py
<ide> def test_request_less_rendering(app, app_ctx):
<ide> def context_processor():
<ide> return dict(foo=42)
<ide>
<del> rv = flask.render_template_string("Hello {{ config.WORLD_NAME }} " "{{ foo }}")
<add> rv = flask.render_template_string("Hello {{ config.WORLD_NAME }} {{ foo }}")
<ide> assert rv == "Hello Special World 42"
<ide>
<ide> | 10 |
Javascript | Javascript | check that modulestoload isarray | 5abf593e6b3535cc836c99db4018a4e2fc2dbc3b | <ide><path>src/auto/injector.js
<ide> function createInjector(modulesToLoad, strictDi) {
<ide> // Module Loading
<ide> ////////////////////////////////////
<ide> function loadModules(modulesToLoad) {
<add> assertArg(isUndefined(modulesToLoad) || isArray(modulesToLoad), 'modulesToLoad', 'not an array');
<ide> var runBlocks = [], moduleFn;
<ide> forEach(modulesToLoad, function(module) {
<ide> if (loadedModules.get(module)) return;
<ide><path>test/auto/injectorSpec.js
<ide> describe('injector', function() {
<ide> });
<ide>
<ide>
<add> it('should check its modulesToLoad argument', function() {
<add> expect(function() { angular.injector('test'); })
<add> .toThrowMinErr('ng', 'areq');
<add> });
<add>
<add>
<ide> it('should resolve dependency graph and instantiate all services just once', function() {
<ide> var log = [];
<ide> | 2 |
Javascript | Javascript | add missing semicolon in editorcontrols | b9d8e2168c47b5b665d85e65b392eb2ac227bd0a | <ide><path>examples/js/controls/EditorControls.js
<ide> THREE.EditorControls = function ( object, domElement ) {
<ide>
<ide> this.enabled = true;
<ide> this.center = new THREE.Vector3();
<del> this.panSpeed = 0.001
<del> this.zoomSpeed = 0.001
<del> this.rotationSpeed = 0.005
<add> this.panSpeed = 0.001;
<add> this.zoomSpeed = 0.001;
<add> this.rotationSpeed = 0.005;
<ide>
<ide> // internals
<ide> | 1 |
Text | Text | move bnoordhuis to emeritus | c0f6ff23d5e265ec3b7f9af79a23ad668b963918 | <ide><path>README.md
<ide> For information about the governance of the Node.js project, see
<ide> **Bradley Farias** <bradley.meck@gmail.com>
<ide> * [bmeurer](https://github.com/bmeurer) -
<ide> **Benedikt Meurer** <benedikt.meurer@gmail.com>
<del>* [bnoordhuis](https://github.com/bnoordhuis) -
<del>**Ben Noordhuis** <info@bnoordhuis.nl>
<ide> * [boneskull](https://github.com/boneskull) -
<ide> **Christopher Hiller** <boneskull@boneskull.com> (he/him)
<ide> * [BridgeAR](https://github.com/BridgeAR) -
<ide> For information about the governance of the Node.js project, see
<ide> **Anna M. Kedzierska** <anna.m.kedzierska@gmail.com>
<ide> * [aqrln](https://github.com/aqrln) -
<ide> **Alexey Orlenko** <eaglexrlnk@gmail.com> (he/him)
<add>* [bnoordhuis](https://github.com/bnoordhuis) -
<add>**Ben Noordhuis** <info@bnoordhuis.nl>
<ide> * [brendanashworth](https://github.com/brendanashworth) -
<ide> **Brendan Ashworth** <brendan.ashworth@me.com>
<ide> * [calvinmetcalf](https://github.com/calvinmetcalf) - | 1 |
Text | Text | add note about doc generation | cd4e07a85e6161111016ca6d811d97e59368971a | <ide><path>docs/README.md
<ide> you can install them with the following command, at the root of the code reposit
<ide> pip install -e ".[docs]"
<ide> ```
<ide>
<add>---
<add>**NOTE**
<add>
<add>You only need to generate the documentation to inspect it locally (if you're planning changes and want to
<add>check how they look like before committing for instance). You don't have to commit the built documentation.
<add>
<add>---
<add>
<ide> ## Packages installed
<ide>
<ide> Here's an overview of all the packages installed. If you ran the previous command installing all packages from | 1 |
Ruby | Ruby | create .zshrc when necessary | 70025458f36c12768c603a3c9cc0f0faf32ccd98 | <ide><path>Library/Homebrew/utils.rb
<ide> def interactive_shell f=nil
<ide> ENV['HOMEBREW_DEBUG_INSTALL'] = f.full_name
<ide> end
<ide>
<add> if ENV["SHELL"].include?("zsh") && ENV["HOME"].start_with?(HOMEBREW_TEMP.resolved_path.to_s)
<add> FileUtils.touch "#{ENV["HOME"]}/.zshrc"
<add> end
<add>
<ide> Process.wait fork { exec ENV['SHELL'] }
<ide>
<ide> if $?.success? | 1 |
Javascript | Javascript | fix a space | 74cc4b17bb52a3238cca4dba8cafab656027a879 | <ide><path>examples/js/loaders/AssimpLoader.js
<ide> mesh.mIndexArray.push( f.mIndices[ 0 ] );
<ide>
<ide> } else {
<add>
<ide> throw ( new Error( "Sorry, can't currently triangulate polys. Use the triangulate preprocessor in Assimp." ))
<add>
<ide> }
<ide>
<ide> | 1 |
Python | Python | clarify intent of integer-naming code | 4153c7371f6da5d4b575d8d7f9a486a83ed6f1e4 | <ide><path>numpy/core/numerictypes.py
<ide> def _add_aliases():
<ide> # is long, longlong, int, short, char.
<ide> def _add_integer_aliases():
<ide> _ctypes = ['LONG', 'LONGLONG', 'INT', 'SHORT', 'BYTE']
<add> seen_bits = set()
<ide> for ctype in _ctypes:
<ide> i_info = typeinfo[ctype]
<ide> u_info = typeinfo['U'+ctype]
<ide> def _add_integer_aliases():
<ide> for info, charname, intname, Intname in [
<ide> (i_info,'i%d' % (bits//8,), 'int%d' % bits, 'Int%d' % bits),
<ide> (u_info,'u%d' % (bits//8,), 'uint%d' % bits, 'UInt%d' % bits)]:
<del> if intname not in allTypes.keys():
<add> if bits not in seen_bits:
<add> # sometimes two different types have the same number of bits
<add> # if so, the one iterated over first takes precedence
<ide> allTypes[intname] = info.type
<ide> sctypeDict[intname] = info.type
<ide> sctypeDict[Intname] = info.type
<ide> def _add_integer_aliases():
<ide> sctypeNA[charname] = info.type
<ide> sctypeNA[info.type] = Intname
<ide> sctypeNA[info.char] = Intname
<add>
<add> seen_bits.add(bits)
<add>
<ide> _add_integer_aliases()
<ide>
<ide> # We use these later | 1 |
Ruby | Ruby | use forwardable to methods delegated to #path | 245944d359f366aaf511f133e11c98ec14cd50b1 | <ide><path>Library/Homebrew/keg.rb
<ide> def self.all
<ide> attr_reader :path, :name, :linked_keg_record, :opt_record
<ide> protected :path
<ide>
<add> extend Forwardable
<add>
<add> def_delegators :path,
<add> :to_s, :hash, :abv, :disk_usage, :file_count, :directory?, :exist?, :/,
<add> :join, :rename, :find
<add>
<ide> def initialize(path)
<ide> path = path.resolved_path if path.to_s.start_with?("#{HOMEBREW_PREFIX}/opt/")
<ide> raise "#{path} is not a valid keg" unless path.parent.parent.realpath == HOMEBREW_CELLAR.realpath
<ide> def initialize(path)
<ide> @opt_record = HOMEBREW_PREFIX/"opt/#{name}"
<ide> end
<ide>
<del> def to_s
<del> path.to_s
<del> end
<del>
<ide> def rack
<ide> path.parent
<ide> end
<ide> def ==(other)
<ide> end
<ide> alias eql? ==
<ide>
<del> def hash
<del> path.hash
<del> end
<del>
<del> def abv
<del> path.abv
<del> end
<del>
<del> def disk_usage
<del> path.disk_usage
<del> end
<del>
<del> def file_count
<del> path.file_count
<del> end
<del>
<del> def directory?
<del> path.directory?
<del> end
<del>
<del> def exist?
<del> path.exist?
<del> end
<del>
<ide> def empty_installation?
<ide> Pathname.glob("#{path}/**/*") do |file|
<ide> next if file.directory?
<ide> def empty_installation?
<ide> true
<ide> end
<ide>
<del> def /(other)
<del> path / other
<del> end
<del>
<del> def join(*args)
<del> path.join(*args)
<del> end
<del>
<del> def rename(*args)
<del> path.rename(*args)
<del> end
<del>
<ide> def linked?
<ide> linked_keg_record.symlink? &&
<ide> linked_keg_record.directory? &&
<ide> def installed_dependents
<ide> end
<ide> end
<ide>
<del> def find(*args, &block)
<del> path.find(*args, &block)
<del> end
<del>
<ide> def oldname_opt_record
<ide> @oldname_opt_record ||= if (opt_dir = HOMEBREW_PREFIX/"opt").directory?
<ide> opt_dir.subdirs.detect do |dir| | 1 |
Go | Go | fix npe due to null value returned by ep.iface() | c7f0b0152e13c95d53c9ce49a318effa50053239 | <ide><path>libnetwork/agent.go
<ide> func (ep *endpoint) deleteDriverInfoFromCluster() error {
<ide> }
<ide>
<ide> func (ep *endpoint) addServiceInfoToCluster(sb *sandbox) error {
<del> if ep.isAnonymous() && len(ep.myAliases) == 0 || ep.Iface().Address() == nil {
<add> if ep.isAnonymous() && len(ep.myAliases) == 0 || ep.Iface() == nil || ep.Iface().Address() == nil {
<ide> return nil
<ide> }
<ide>
<ide> func (ep *endpoint) deleteServiceInfoFromCluster(sb *sandbox, fullRemove bool, m
<ide> }
<ide> }
<ide>
<del> if ep.Iface().Address() != nil {
<add> if ep.Iface() != nil && ep.Iface().Address() != nil {
<ide> if ep.svcID != "" {
<ide> // This is a task part of a service
<ide> var ingressPorts []*PortConfig
<ide><path>libnetwork/controller.go
<ide> func (c *controller) reservePools() {
<ide> continue
<ide> }
<ide> for _, ep := range epl {
<add> if ep.Iface() == nil {
<add> logrus.Warnf("endpoint interface is empty for %q (%s)", ep.Name(), ep.ID())
<add> continue
<add> }
<ide> if err := ep.assignAddress(ipam, true, ep.Iface().AddressIPv6() != nil); err != nil {
<ide> logrus.Warnf("Failed to reserve current address for endpoint %q (%s) on network %q (%s)",
<ide> ep.Name(), ep.ID(), n.Name(), n.ID())
<ide><path>libnetwork/network.go
<ide> func (n *network) EndpointByID(id string) (Endpoint, error) {
<ide> func (n *network) updateSvcRecord(ep *endpoint, localEps []*endpoint, isAdd bool) {
<ide> var ipv6 net.IP
<ide> epName := ep.Name()
<del> if iface := ep.Iface(); iface.Address() != nil {
<add> if iface := ep.Iface(); iface != nil && iface.Address() != nil {
<ide> myAliases := ep.MyAliases()
<ide> if iface.AddressIPv6() != nil {
<ide> ipv6 = iface.AddressIPv6().IP | 3 |
Javascript | Javascript | fix exception when rotate page without a document | a059f9fcbbdbe1f0e08b9fbd658685ecd1fc0edc | <ide><path>web/pdf_viewer.js
<ide> var PDFViewer = (function pdfViewer() {
<ide> */
<ide> scrollPageIntoView: function PDFViewer_scrollPageIntoView(pageNumber,
<ide> dest) {
<add> if (!this.pdfDocument) {
<add> return;
<add> }
<add>
<ide> var pageView = this._pages[pageNumber - 1];
<ide>
<ide> if (this.isInPresentationMode) { | 1 |
Text | Text | add clarum to companies using apache airflow | 6a79c29493887ee596608de11f1fc8b893b5086f | <ide><path>INTHEWILD.md
<ide> Currently, **officially** using Airflow:
<ide> 1. [Civey](https://civey.com/) [[@WesleyBatista](https://github.com/WesleyBatista)]
<ide> 1. [Clairvoyant](https://clairvoyantsoft.com) [[@shekharv](https://github.com/shekharv)]
<ide> 1. [Clarity AI](https://clarity.ai/) [[@clarityai-eng/data-eng](https://github.com/orgs/clarityai-eng/teams/data-eng)]
<add>1. [Clarum](https://clarum.it/) [[@avanelli](https://github.com/avanelli)]
<ide> 1. [Classmethod, Inc.](https://classmethod.jp/) [[@shoito](https://github.com/shoito)]
<ide> 1. [Cleartax](https://cleartax.in/) [[@anks](https://github.com/anks) & [@codebuff](https://github.com/codebuff)]
<ide> 1. [Clicksign](https://clicksign.com/) [[@mbbernstein](https://github.com/mbbernstein) & [@jorgeac12](https://github.com/jorgeac12) & [@franklin390](https://github.com/franklin390)] | 1 |
PHP | PHP | allow plain text emails only | bcb60d1538df19c31825d19df2d5717e329ec8b0 | <ide><path>src/Illuminate/Mail/Mailer.php
<ide> public function alwaysFrom($address, $name = null)
<ide> $this->from = compact('address', 'name');
<ide> }
<ide>
<add> /**
<add> * Send a new message when only a plain part.
<add> *
<add> * @param string $view
<add> * @param array $data
<add> * @param mixed $callback
<add> * @return void
<add> */
<add> public function plain($view, array $data, $callback)
<add> {
<add> return $this->send(array('text' => $view), $data, $callback);
<add> }
<add>
<ide> /**
<ide> * Send a new message using a view.
<ide> *
<ide> public function alwaysFrom($address, $name = null)
<ide> */
<ide> public function send($view, array $data, $callback)
<ide> {
<del> if (is_array($view)) list($view, $plain) = $view;
<add> // First we need to parse the view, which could either be a string or an array
<add> // containing both an HTML and plain text versions of the view which should
<add> // be used when sending an e-mail. We will extract both of them out here.
<add> list($view, $plain) = $this->parseView($view);
<ide>
<ide> $data['message'] = $message = $this->createMessage();
<ide>
<ide> public function send($view, array $data, $callback)
<ide> // Once we have retrieved the view content for the e-mail we will set the body
<ide> // of this message using the HTML type, which will provide a simple wrapper
<ide> // to creating view based emails that are able to receive arrays of data.
<del> $content = $this->getView($view, $data);
<add> $this->addContent($message, $view, $plain, $data);
<ide>
<del> $message->setBody($content, 'text/html');
<add> $message = $message->getSwiftMessage();
<add>
<add> return $this->sendSwiftMessage($message);
<add> }
<add>
<add> /**
<add> * Add the content to a given message.
<add> *
<add> * @param Illuminate\Mail\Message $message
<add> * @param string $view
<add> * @param string $plain
<add> * @param array $data
<add> * @return void
<add> */
<add> protected function addContent($message, $view, $plain, $data)
<add> {
<add> if (isset($view))
<add> {
<add> $message->setBody($this->getView($view, $data), 'text/html');
<add> }
<ide>
<ide> if (isset($plain))
<ide> {
<ide> $message->addPart($this->getView($plain, $data), 'text/plain');
<ide> }
<add> }
<add>
<add> /**
<add> * Parse the given view name or array.
<add> *
<add> * @param string|array $view
<add> * @return array
<add> */
<add> protected function parseView($view)
<add> {
<add> if (is_string($view)) return array($view, null);
<add>
<add> // If the given view is an array with numeric keys, we will just assume that
<add> // both a "pretty" and "plain" view were provided, so we will return this
<add> // array as is, since must should contain both views with numeric keys.
<add> if (is_array($view) and isset($view[0]))
<add> {
<add> return $view;
<add> }
<ide>
<del> return $this->sendSwiftMessage($message->getSwiftMessage());
<add> // If the view is an array, but doesn't contain numeric keys, we will assume
<add> // the the views are being explicitly specified and will extract them via
<add> // named keys instead, allowing the developers to use one or the other.
<add> elseif (is_array($view))
<add> {
<add> return array(
<add> array_get($view, 'html'), array_get($view, 'text')
<add> );
<add> }
<add>
<add> throw new \InvalidArgumentException("Invalid view.");
<ide> }
<ide>
<ide> /**
<ide><path>tests/Mail/MailMailerTest.php
<ide> public function testMailerSendSendsMessageWithProperPlainViewContent()
<ide> }
<ide>
<ide>
<add> public function testMailerSendSendsMessageWithProperPlainViewContentWhenExplicit()
<add> {
<add> unset($_SERVER['__mailer.test']);
<add> $mailer = $this->getMock('Illuminate\Mail\Mailer', array('createMessage'), $this->getMocks());
<add> $message = m::mock('StdClass');
<add> $mailer->expects($this->once())->method('createMessage')->will($this->returnValue($message));
<add> $view = m::mock('StdClass');
<add> $mailer->getViewEnvironment()->shouldReceive('make')->once()->with('foo', array('data', 'message' => $message))->andReturn($view);
<add> $mailer->getViewEnvironment()->shouldReceive('make')->once()->with('bar', array('data', 'message' => $message))->andReturn($view);
<add> $view->shouldReceive('render')->twice()->andReturn('rendered.view');
<add> $message->shouldReceive('setBody')->once()->with('rendered.view', 'text/html');
<add> $message->shouldReceive('addPart')->once()->with('rendered.view', 'text/plain');
<add> $message->shouldReceive('setFrom')->never();
<add> $mailer->setSwiftMailer(m::mock('StdClass'));
<add> $message->shouldReceive('getSwiftMessage')->once()->andReturn($message);
<add> $mailer->getSwiftMailer()->shouldReceive('send')->once()->with($message);
<add> $mailer->send(array('html' => 'foo', 'text' => 'bar'), array('data'), function($m) { $_SERVER['__mailer.test'] = $m; });
<add> unset($_SERVER['__mailer.test']);
<add> }
<add>
<add>
<ide> public function testMessagesCanBeLoggedInsteadOfSent()
<ide> {
<ide> $mailer = $this->getMock('Illuminate\Mail\Mailer', array('createMessage'), $this->getMocks()); | 2 |
Text | Text | remove links to docrails | 6cb1b6724c313c608cf4063fc22886faa19df9be | <ide><path>guides/source/contributing_to_ruby_on_rails.md
<ide> Contributing to the Rails Documentation
<ide> Ruby on Rails has two main sets of documentation: the guides, which help you
<ide> learn about Ruby on Rails, and the API, which serves as a reference.
<ide>
<del>You can help improve the Rails guides by making them more coherent, consistent or readable, adding missing information, correcting factual errors, fixing typos, or bringing them up to date with the latest edge Rails. To get involved in the translation of Rails guides, please see [Translating Rails Guides](https://wiki.github.com/rails/docrails/translating-rails-guides).
<add>You can help improve the Rails guides by making them more coherent, consistent or readable, adding missing information, correcting factual errors, fixing typos, or bringing them up to date with the latest edge Rails.
<ide>
<ide> You can either open a pull request to [Rails](http://github.com/rails/rails) or
<ide> ask the [Rails core team](http://rubyonrails.org/core) for commit access on
<del>[docrails](http://github.com/rails/docrails) if you contribute regularly.
<add>docrails if you contribute regularly.
<ide> Please do not open pull requests in docrails, if you'd like to get feedback on your
<ide> change, ask for it in [Rails](http://github.com/rails/rails) instead.
<ide> | 1 |
Ruby | Ruby | remove some integration tests | f6bf9893780e17c0ae853a45944229286fbd5f88 | <ide><path>Library/Homebrew/test/cmd/analytics_spec.rb
<ide> end
<ide> end
<ide>
<del> it "fails when running `brew analytics on off`" do
<del> expect { brew "analytics", "on", "off" }
<del> .to output(/Invalid usage/).to_stderr
<del> .and not_to_output.to_stdout
<del> .and be_a_failure
<del> end
<del>
<del> it "fails when running `brew analytics testball`" do
<del> expect { brew "analytics", "testball" }
<del> .to output(/Invalid usage/).to_stderr
<del> .and not_to_output.to_stdout
<del> .and be_a_failure
<del> end
<del>
<ide> it "can generate a new UUID" do
<ide> expect { brew "analytics", "regenerate-uuid" }.to be_a_success
<ide> end
<ide><path>Library/Homebrew/test/cmd/command_spec.rb
<ide> .to output(%r{#{Regexp.escape(HOMEBREW_LIBRARY_PATH)}/cmd/info.rb}).to_stdout
<ide> .and be_a_success
<ide> end
<del>
<del> it "fails when the given command is unknown" do
<del> expect { brew "command", "does-not-exist" }
<del> .to output(/Unknown command/).to_stderr
<del> .and be_a_failure
<del> end
<ide> end
<ide><path>Library/Homebrew/test/cmd/desc_spec.rb
<ide> .and be_a_success
<ide> end
<ide>
<del> it "fails when both --search and --name are specified" do
<del> expect { brew "desc", "--search", "--name" }
<del> .to output(/Pick one, and only one/).to_stderr
<del> .and not_to_output.to_stdout
<del> .and be_a_failure
<del> end
<del>
<del> describe "--search" do
<del> it "fails when no search term is given" do
<del> expect { brew "desc", "--search" }
<del> .to output(/You must provide a search term/).to_stderr
<del> .and not_to_output.to_stdout
<del> .and be_a_failure
<del> end
<del> end
<del>
<ide> describe "--description" do
<ide> it "creates a description cache" do
<ide> expect(desc_cache).not_to exist
<ide><path>Library/Homebrew/test/cmd/install_spec.rb
<ide> it "installs Formulae" do
<ide> setup_test_formula "testball1"
<ide>
<del> expect { brew "install", "testball1", "--head" }
<del> .to output(/Specify `\-\-HEAD`/).to_stderr
<del> .and not_to_output.to_stdout
<del> .and be_a_failure
<del>
<del> expect { brew "install", "testball1", "--HEAD" }
<del> .to output(/No head is defined/).to_stderr
<del> .and not_to_output.to_stdout
<del> .and be_a_failure
<del>
<del> expect { brew "install", "testball1", "--devel" }
<del> .to output(/No devel block/).to_stderr
<del> .and not_to_output.to_stdout
<del> .and be_a_failure
<del>
<ide> expect { brew "install", "testball1" }
<ide> .to output(%r{#{HOMEBREW_CELLAR}/testball1/0\.1}).to_stdout
<ide> .and not_to_output.to_stderr
<ide> .and not_to_output.to_stdout
<ide> .and be_a_success
<ide>
<del> expect { brew "install", "macruby" }
<del> .to output(/MacRuby is not packaged/).to_stderr
<del> .and not_to_output.to_stdout
<del> .and be_a_failure
<del>
<ide> expect { brew "install", "formula" }
<ide> .to output(/No available formula/).to_stderr
<ide> .and output(/Searching for similarly named formulae/).to_stdout
<ide> .and be_a_failure
<ide>
<del> expect { brew "install", "testball" }
<del> .to output(/This similarly named formula was found/).to_stdout
<del> .and output(/No available formula/).to_stderr
<del> .and be_a_failure
<del>
<ide> setup_test_formula "testball2"
<del> expect { brew "install", "testball" }
<del> .to output(/These similarly named formulae were found/).to_stdout
<del> .and output(/No available formula/).to_stderr
<del> .and be_a_failure
<del>
<ide> install_and_rename_coretap_formula "testball1", "testball2"
<ide> expect { brew "install", "testball2" }
<ide> .to output(/testball1 already installed, it's just not migrated/).to_stderr
<ide><path>Library/Homebrew/test/cmd/link_spec.rb
<ide> describe "brew link", :integration_test do
<del> it "fails when no argument is given" do
<del> expect { brew "link" }
<del> .to output(/This command requires a keg argument/).to_stderr
<del> .and not_to_output.to_stdout
<del> .and be_a_failure
<del> end
<del>
<ide> it "does not fail if the given Formula is already linked" do
<ide> setup_test_formula "testball1"
<ide>
<ide><path>Library/Homebrew/test/cmd/migrate_spec.rb
<ide> setup_test_formula "testball2"
<ide> end
<ide>
<del> it "fails when no argument is given" do
<del> expect { brew "migrate" }
<del> .to output(/Invalid usage/).to_stderr
<del> .and not_to_output.to_stdout
<del> .and be_a_failure
<del> end
<del>
<del> it "fails when a given Formula doesn't exist" do
<del> expect { brew "migrate", "testball" }
<del> .to output(/No available formula with the name "testball"/).to_stderr
<del> .and not_to_output.to_stdout
<del> .and be_a_failure
<del> end
<del>
<del> it "fails if a given Formula doesn't replace another one" do
<del> expect { brew "migrate", "testball1" }
<del> .to output(/testball1 doesn't replace any formula/).to_stderr
<del> .and not_to_output.to_stdout
<del> .and be_a_failure
<del> end
<del>
<ide> it "migrates a renamed Formula" do
<ide> install_and_rename_coretap_formula "testball1", "testball2"
<ide>
<ide> .and not_to_output.to_stderr
<ide> .and be_a_success
<ide> end
<del>
<del> it "fails if a given Formula is not installed" do
<del> install_and_rename_coretap_formula "testball1", "testball2"
<del> (HOMEBREW_CELLAR/"testball1").rmtree
<del>
<del> expect { brew "migrate", "testball1" }
<del> .to output(/Error: No such keg/).to_stderr
<del> .and not_to_output.to_stdout
<del> .and be_a_failure
<del> end
<ide> end
<ide><path>Library/Homebrew/test/cmd/switch_spec.rb
<ide> describe "brew switch", :integration_test do
<ide> it "allows switching between Formula versions" do
<del> expect { brew "switch" }
<del> .to output(/Usage: brew switch <formula> <version>/).to_stderr
<del> .and not_to_output.to_stdout
<del> .and be_a_failure
<del>
<del> expect { brew "switch", "testball", "0.1" }
<del> .to output(/testball not found/).to_stderr
<del> .and not_to_output.to_stdout
<del> .and be_a_failure
<del>
<ide> setup_test_formula "testball", <<~EOS
<ide> keg_only "just because"
<ide> EOS
<ide> .to output(/link created/).to_stdout
<ide> .and not_to_output.to_stderr
<ide> .and be_a_success
<del>
<del> expect { brew "switch", "testball", "0.3" }
<del> .to output("testball installed versions: 0.1, 0.2\n").to_stdout
<del> .and output(/testball does not have a version "0.3"/).to_stderr
<del> .and be_a_failure
<ide> end
<ide> end
<ide><path>Library/Homebrew/test/deps_spec.rb
<ide> .and not_to_output.to_stderr
<ide> end
<ide>
<del> it "outputs a dependency for a Formula that has one dependency" do
<del> expect { brew "deps", "bar" }
<del> .to be_a_success
<del> .and output("foo\n").to_stdout
<del> .and not_to_output.to_stderr
<del> end
<del>
<ide> it "outputs all of a Formula's dependencies and their dependencies on separate lines" do
<ide> expect { brew "deps", "baz" }
<ide> .to be_a_success
<ide><path>Library/Homebrew/test/dev-cmd/pull_spec.rb
<ide> describe "brew pull", :integration_test do
<del> it "fails when no argument is given" do
<del> expect { brew "pull" }
<del> .to output(/This command requires at least one argument/).to_stderr
<del> .and not_to_output.to_stdout
<del> .and be_a_failure
<del> end
<del>
<ide> it "fetches a patch from a GitHub commit or pull request and applies it", :needs_network, retry: 3 do
<ide> CoreTap.instance.path.cd do
<ide> system "git", "init"
<ide> .and output(/Current branch is new\-branch/).to_stderr
<ide> .and be_a_failure
<ide>
<del> expect { brew "pull", "--bump", "https://github.com/Homebrew/homebrew-core/pull/8" }
<del> .to output(/Fetching patch/).to_stdout
<del> .and output(/No changed formulae found to bump/).to_stderr
<del> .and be_a_failure
<del>
<ide> expect { brew "pull", "--bump", "https://api.github.com/repos/Homebrew/homebrew-core/pulls/122" }
<ide> .to output(/Fetching patch/).to_stdout
<ide> .and output(/Can only bump one changed formula/).to_stderr
<ide> .and output(/Patch failed to apply/).to_stderr
<ide> .and be_a_failure
<ide> end
<del>
<del> describe "--rebase" do
<del> it "fails" do
<del> expect { brew "pull", "--rebase" }
<del> .to output(/You meant `git pull --rebase`./).to_stderr
<del> .and not_to_output.to_stdout
<del> .and be_a_failure
<del> end
<del> end
<del>
<del> it "fails when given 0" do
<del> expect { brew "pull", "0" }
<del> .to output(/Not a GitHub pull request or commit/).to_stderr
<del> .and not_to_output.to_stdout
<del> .and be_a_failure
<del> end
<ide> end
<ide><path>Library/Homebrew/test/dev-cmd/ruby_spec.rb
<ide> .to be_a_success
<ide> .and not_to_output.to_stdout
<ide> .and not_to_output.to_stderr
<del>
<del> expect { brew "ruby", "-e", "exit 1" }
<del> .to be_a_failure
<del> .and not_to_output.to_stdout
<del> .and not_to_output.to_stderr
<ide> end
<ide> end
<ide><path>Library/Homebrew/test/dev-cmd/tap_spec.rb
<ide> .to be_a_success
<ide> .and not_to_output.to_stdout
<ide> .and not_to_output.to_stderr
<del>
<del> expect { brew "tap", "--force-auto-update", "homebrew/bar" }
<del> .to be_a_success
<del> .and not_to_output.to_stdout
<del> .and not_to_output.to_stderr
<del>
<del> expect { brew "untap", "homebrew/bar" }
<del> .to output(/Untapped/).to_stdout
<del> .and not_to_output.to_stderr
<del> .and be_a_success
<ide> end
<ide> end
<ide><path>Library/Homebrew/test/dev-cmd/test_spec.rb
<ide> describe "brew test", :integration_test do
<del> it "fails when no argument is given" do
<del> expect { brew "test" }
<del> .to output(/This command requires a formula argument/).to_stderr
<del> .and not_to_output.to_stdout
<del> .and be_a_failure
<del> end
<del>
<del> it "fails when a Formula is not installed" do
<del> expect { brew "test", testball }
<del> .to output(/Testing requires the latest version of testball/).to_stderr
<del> .and not_to_output.to_stdout
<del> .and be_a_failure
<del> end
<del>
<del> it "fails when a Formula has no test" do
<del> expect { brew "install", testball }.to be_a_success
<del>
<del> expect { brew "test", testball }
<del> .to output(/testball defines no test/).to_stderr
<del> .and not_to_output.to_stdout
<del> .and be_a_failure
<del> end
<del>
<ide> it "tests a given Formula" do
<ide> setup_test_formula "testball", <<~EOS
<ide> head "https://github.com/example/testball2.git" | 12 |
Java | Java | update stale javadoc reference | 5b83dbe25af151d183009006b1fe323b2658d025 | <ide><path>ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManagerBuilder.java
<ide> public ReactInstanceManagerBuilder setMinTimeLeftInFrameForNonBatchedOperationMs
<ide> * <li> {@link #setApplication}
<ide> * <li> {@link #setCurrentActivity} if the activity has already resumed
<ide> * <li> {@link #setDefaultHardwareBackBtnHandler} if the activity has already resumed
<del> * <li> {@link #setJSBundleFile} or {@link #setJSMainModuleName}
<add> * <li> {@link #setJSBundleFile} or {@link #setJSMainModulePath}
<ide> * </ul>
<ide> */
<ide> public ReactInstanceManager build() { | 1 |
Go | Go | rename some vars that collided with imports | 288cf20f98e1c86c7604032e3a52105618f577b7 | <ide><path>daemon/inspect.go
<ide> func (daemon *Daemon) ContainerInspectCurrent(name string, size bool) (*types.Co
<ide> }
<ide>
<ide> apiNetworks := make(map[string]*networktypes.EndpointSettings)
<del> for name, epConf := range ctr.NetworkSettings.Networks {
<add> for nwName, epConf := range ctr.NetworkSettings.Networks {
<ide> if epConf.EndpointSettings != nil {
<ide> // We must make a copy of this pointer object otherwise it can race with other operations
<del> apiNetworks[name] = epConf.EndpointSettings.Copy()
<add> apiNetworks[nwName] = epConf.EndpointSettings.Copy()
<ide> }
<ide> }
<ide>
<ide> func (daemon *Daemon) ContainerInspectCurrent(name string, size bool) (*types.Co
<ide>
<ide> // containerInspect120 serializes the master version of a container into a json type.
<ide> func (daemon *Daemon) containerInspect120(name string) (*v1p20.ContainerJSON, error) {
<del> container, err := daemon.GetContainer(name)
<add> ctr, err := daemon.GetContainer(name)
<ide> if err != nil {
<ide> return nil, err
<ide> }
<ide>
<del> container.Lock()
<del> defer container.Unlock()
<add> ctr.Lock()
<add> defer ctr.Unlock()
<ide>
<del> base, err := daemon.getInspectData(container)
<add> base, err := daemon.getInspectData(ctr)
<ide> if err != nil {
<ide> return nil, err
<ide> }
<ide>
<del> mountPoints := container.GetMountPoints()
<add> mountPoints := ctr.GetMountPoints()
<ide> config := &v1p20.ContainerConfig{
<del> Config: container.Config,
<del> MacAddress: container.Config.MacAddress,
<del> NetworkDisabled: container.Config.NetworkDisabled,
<del> ExposedPorts: container.Config.ExposedPorts,
<del> VolumeDriver: container.HostConfig.VolumeDriver,
<add> Config: ctr.Config,
<add> MacAddress: ctr.Config.MacAddress,
<add> NetworkDisabled: ctr.Config.NetworkDisabled,
<add> ExposedPorts: ctr.Config.ExposedPorts,
<add> VolumeDriver: ctr.HostConfig.VolumeDriver,
<ide> }
<del> networkSettings := daemon.getBackwardsCompatibleNetworkSettings(container.NetworkSettings)
<add> networkSettings := daemon.getBackwardsCompatibleNetworkSettings(ctr.NetworkSettings)
<ide>
<ide> return &v1p20.ContainerJSON{
<ide> ContainerJSONBase: base, | 1 |
Python | Python | remove sqlcommand from sparkcmd documentation | 5cc513263e96d2b780ae78eec23310979879268c | <ide><path>airflow/contrib/operators/qubole_operator.py
<ide> class QuboleOperator(BaseOperator):
<ide> :parameters: any extra args which need to be passed to script (only when
<ide> script_location is supplied
<ide> sparkcmd:
<del> :program: the complete Spark Program in Scala, SQL, Command, R, or Python
<add> :program: the complete Spark Program in Scala, R, or Python
<ide> :cmdline: spark-submit command line, all required information must be specify
<ide> in cmdline itself.
<ide> :sql: inline sql query
<ide> :script_location: s3 location containing query statement
<del> :language: language of the program, Scala, SQL, Command, R, or Python
<add> :language: language of the program, Scala, R, or Python
<ide> :app_id: ID of an Spark job server app
<ide> :arguments: spark-submit command line arguments
<ide> :user_program_arguments: arguments that the user program takes in | 1 |
Ruby | Ruby | remove dead code | 92ab4d6a8af7654d5d00f3d9047f17106e310118 | <ide><path>activerecord/lib/active_record/associations/builder/collection_association.rb
<ide> def define_callbacks(model, reflection)
<ide> CALLBACKS.each { |callback_name| define_callback(model, callback_name) }
<ide> end
<ide>
<del> def writable?
<del> true
<del> end
<del>
<ide> def wrap_block_extension
<ide> if block_extension
<ide> @extension_module = mod = Module.new(&block_extension) | 1 |
Text | Text | add void pointer to index.md | e73ffaf2fe100b483335347680fff1d511c86277 | <ide><path>guide/english/c/pointers/index.md
<ide> This starts by taking a string (something you'll learn about when you get into a
<ide> ### Const Qualifer
<ide> The qualifier const can be applied to the declaration of any variable to specify that its value will not be changed ( Which depends upon where const variables are stored, we may change value of const variable by using pointer ).
<ide>
<del># Pointer to variable
<add>### Pointer to variable
<ide> We can change the value of ptr and we can also change the value of object ptr pointing to.
<ide> Following code fragment explains pointer to variable
<ide> ```c
<ide> int main(void)
<ide> return 0;
<ide> }
<ide> ```
<del># Pointer to constant
<add>### Pointer to constant
<ide> We can change pointer to point to any other integer variable, but cannot change value of object (entity) pointed using pointer ptr.
<ide> ```c
<ide> #include <stdio.h>
<ide> int main(void)
<ide> return 0;
<ide> }
<ide> ```
<del># Constant pointer to variable
<add>### Constant pointer to variable
<ide> In this we can change the value of the variable the pointer is pointing to. But we can't change the pointer to point to
<ide> another variable.
<ide> ```c
<ide> int main(void)
<ide> return 0;
<ide> }
<ide> ```
<del># constant pointer to constant
<add>### Constant pointer to constant
<ide> Above declaration is constant pointer to constant variable which means we cannot change value pointed by pointer as well as we cannot point the pointer to other variable.
<ide> ```c
<ide> #include <stdio.h>
<ide> int main(void)
<ide> }
<ide> ```
<ide>
<add>### Void Pointer
<add>A void pointer is a pointer variable declared using the reserved word in C ‘void’.
<add>Lets illustrate this with a void pointer declaration below:
<add>```C
<add>void *ptr;
<add>```
<add>A pointer variable with the keyword `void`is a general purpose pointer variable.
<add>The pointer can hold an address of any variable of any data type (`int`, `char`...etc).
<add>
<add>As illustrated earlier on, the * operator serves its own purpose.
<add>But in the case of a void pointer we need to typecast the pointer variable to dereference it mainly because a void pointer has no specific data type associated with it.
<add>There is no other way the compiler can tell what type of data is pointed to by the void pointer.
<add>So to take the data pointed to by a void pointer we typecast it with the correct type of the data that is held inside the void pointer's location.
<add>
<add>Below is an example to illustrate how a void pointer coild be used in a program:
<add>
<add>```C
<add>#include<stdio.h>
<add>
<add>void main() {
<add> int a = 10;
<add> float b = 35.75;
<add> void *ptr; // Declaration of a void pointer
<add> ptr = &a; // Assigning address of integer to void pointer.
<add> printf("The value of integer variable is = %d",*( (int*) ptr) );// (int*)ptr - is ype typecasting, to point to an int type. Where as *((int*)ptr) dereferences the typecasted void pointer variable.
<add>}
<add>```
<add>The output becomes
<add>```output
<add>The value of integer variable is = 10
<add>```
<add>
<add>A void pointer can be useful if the programmer is not sure about the data type of data inputted by the end user.
<add>In such a case the programmer can use a void pointer to point to the location of the unknown data type.
<add>The program can be set in such a way to ask the user to inform the type of data and type casting can be performed according to the information inputted by the user.
<add>
<add>Another important point you should keep in mind about void pointers is that pointer arithmetic can not be performed in a void pointer.
<add>
<add>Example:
<add>```C
<add> void *ptr;
<add> int a;
<add> ptr=&a;
<add> ptr++; // This statement is invalid and will result in an error because 'ptr' is a void pointer variable.
<add>```
<add>Credits: <http://www.circuitstoday.com/void-pointers-in-c>
<add>
<add>
<ide> # Before you go on...
<ide> ## A review
<ide> * Pointers are variables, but instead of storing a value, they store a memory location.
<ide> Most of the time, pointer and array accesses can be treated as acting the same,
<ide> p++; /*Legal*/
<ide> a++; /*illegal*/
<ide> ```
<del> | 1 |
Javascript | Javascript | add notes about support and lodash compatibility | 65f800e19ec669ab7d5abbd2f6b82bf60110651a | <ide><path>src/Angular.js
<ide> function extend(dst) {
<ide> * sinceVersion="1.6.5"
<ide> * This function is deprecated, but will not be removed in the 1.x lifecycle.
<ide> * There are edge cases (see {@link angular.merge#known-issues known issues}) that are not
<del>* supported by this function. We suggest
<del>* using [lodash's merge()](https://lodash.com/docs/4.17.4#merge) instead.
<add>* supported by this function. We suggest using another, similar library for all-purpose merging,
<add>* such as [lodash's merge()](https://lodash.com/docs/4.17.4#merge).
<ide> *
<ide> * @knownIssue
<ide> * This is a list of (known) object types that are not handled correctly by this function:
<ide> function extend(dst) {
<ide> * - [`CanvasGradient`](https://developer.mozilla.org/docs/Web/API/CanvasGradient)
<ide> * - AngularJS {@link $rootScope.Scope scopes};
<ide> *
<add>* `angular.merge` also does not support merging objects with circular references.
<add>*
<ide> * @param {Object} dst Destination object.
<ide> * @param {...Object} src Source object(s).
<ide> * @returns {Object} Reference to `dst`. | 1 |
Text | Text | use serial comma in http docs | ec1c61662eb0483dee256f0fd492c3ce955f1335 | <ide><path>doc/api/http.md
<ide> changes:
<ide> An `IncomingMessage` object is created by [`http.Server`][] or
<ide> [`http.ClientRequest`][] and passed as the first argument to the [`'request'`][]
<ide> and [`'response'`][] event respectively. It may be used to access response
<del>status, headers and data.
<add>status, headers, and data.
<ide>
<ide> Different from its `socket` value which is a subclass of {stream.Duplex}, the
<ide> `IncomingMessage` itself extends {stream.Readable} and is created separately to
<ide> added: v0.1.13
<ide> changes:
<ide> - version: v18.0.0
<ide> pr-url: https://github.com/nodejs/node/pull/41263
<del> description: The `requestTimeout`, `headersTimeout`, `keepAliveTimeout` and
<del> `connectionsCheckingInterval` are supported now.
<add> description: The `requestTimeout`, `headersTimeout`, `keepAliveTimeout`, and
<add> `connectionsCheckingInterval` options are supported now.
<ide> - version: v18.0.0
<ide> pr-url: https://github.com/nodejs/node/pull/42163
<ide> description: The `noDelay` option now defaults to `true`. | 1 |
Javascript | Javascript | fix regression from duplex ctor assignment | e82d06bef9c2de480f8c21ea195c876811b275e1 | <ide><path>lib/_stream_writable.js
<ide> module.exports = Writable
<ide>
<ide> var util = require('util');
<ide> var Stream = require('stream');
<del>var Duplex = require('_stream_duplex');
<ide>
<ide> util.inherits(Writable, Stream);
<ide>
<ide> function WritableState(options) {
<ide> function Writable(options) {
<ide> // Writable ctor is applied to Duplexes, though they're not
<ide> // instanceof Writable, they're instanceof Readable.
<del> if (!(this instanceof Writable) && !(this instanceof Duplex))
<add> if (!(this instanceof Writable) && !(this instanceof Stream.Duplex))
<ide> return new Writable(options);
<ide>
<ide> this._writableState = new WritableState(options); | 1 |
Mixed | Java | implement textalign justify for android o+ | d2153fc58d825006076a3fce12e0f7eb84479132 | <ide><path>RNTester/js/TextExample.android.js
<ide> class TextExample extends React.Component<{}> {
<ide> right right right right right right right right right right right
<ide> right right
<ide> </Text>
<add> <Text style={{textAlign: 'justify'}}>
<add> justify (works when api level >= 26 otherwise fallbacks to "left"):
<add> this text component{"'"}s contents are laid out with "textAlign:
<add> justify" and as you can see all of the lines except the last one
<add> span the available width of the parent container.
<add> </Text>
<ide> </RNTesterBlock>
<ide> <RNTesterBlock title="Unicode">
<ide> <View>
<ide><path>ReactAndroid/src/main/java/com/facebook/react/views/text/ReactBaseTextShadowNode.java
<ide> private static int parseNumericFontWeight(String fontWeightString) {
<ide> protected int mTextAlign = Gravity.NO_GRAVITY;
<ide> protected int mTextBreakStrategy =
<ide> (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) ? 0 : Layout.BREAK_STRATEGY_HIGH_QUALITY;
<add> protected int mJustificationMode =
<add> (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) ? 0 : Layout.JUSTIFICATION_MODE_NONE;
<add> protected TextTransform mTextTransform = TextTransform.UNSET;
<ide>
<ide> protected float mTextShadowOffsetDx = 0;
<ide> protected float mTextShadowOffsetDy = 0;
<ide> public void setMaxFontSizeMultiplier(float maxFontSizeMultiplier) {
<ide>
<ide> @ReactProp(name = ViewProps.TEXT_ALIGN)
<ide> public void setTextAlign(@Nullable String textAlign) {
<del> if (textAlign == null || "auto".equals(textAlign)) {
<del> mTextAlign = Gravity.NO_GRAVITY;
<del> } else if ("left".equals(textAlign)) {
<del> mTextAlign = Gravity.LEFT;
<del> } else if ("right".equals(textAlign)) {
<del> mTextAlign = Gravity.RIGHT;
<del> } else if ("center".equals(textAlign)) {
<del> mTextAlign = Gravity.CENTER_HORIZONTAL;
<del> } else if ("justify".equals(textAlign)) {
<del> // Fallback gracefully for cross-platform compat instead of error
<add> if ("justify".equals(textAlign)) {
<add> if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
<add> mJustificationMode = Layout.JUSTIFICATION_MODE_INTER_WORD;
<add> }
<ide> mTextAlign = Gravity.LEFT;
<ide> } else {
<del> throw new JSApplicationIllegalArgumentException("Invalid textAlign: " + textAlign);
<add> if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
<add> mJustificationMode = Layout.JUSTIFICATION_MODE_NONE;
<add> }
<add>
<add> if (textAlign == null || "auto".equals(textAlign)) {
<add> mTextAlign = Gravity.NO_GRAVITY;
<add> } else if ("left".equals(textAlign)) {
<add> mTextAlign = Gravity.LEFT;
<add> } else if ("right".equals(textAlign)) {
<add> mTextAlign = Gravity.RIGHT;
<add> } else if ("center".equals(textAlign)) {
<add> mTextAlign = Gravity.CENTER_HORIZONTAL;
<add> } else {
<add> throw new JSApplicationIllegalArgumentException("Invalid textAlign: " + textAlign);
<add> }
<add>
<ide> }
<ide> markUpdated();
<ide> }
<ide><path>ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextShadowNode.java
<ide> public long measure(
<ide> new StaticLayout(
<ide> text, textPaint, hintWidth, alignment, 1.f, 0.f, mIncludeFontPadding);
<ide> } else {
<del> layout =
<add> StaticLayout.Builder builder =
<ide> StaticLayout.Builder.obtain(text, 0, text.length(), textPaint, hintWidth)
<del> .setAlignment(alignment)
<del> .setLineSpacing(0.f, 1.f)
<del> .setIncludePad(mIncludeFontPadding)
<del> .setBreakStrategy(mTextBreakStrategy)
<del> .setHyphenationFrequency(Layout.HYPHENATION_FREQUENCY_NORMAL)
<del> .build();
<add> .setAlignment(alignment)
<add> .setLineSpacing(0.f, 1.f)
<add> .setIncludePad(mIncludeFontPadding)
<add> .setBreakStrategy(mTextBreakStrategy)
<add> .setHyphenationFrequency(Layout.HYPHENATION_FREQUENCY_NORMAL);
<add>
<add> if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
<add> builder.setJustificationMode(mJustificationMode);
<add> }
<add> layout = builder.build();
<ide> }
<ide>
<ide> } else if (boring != null && (unconstrainedWidth || boring.width <= width)) {
<ide> public void onCollectExtraUpdates(UIViewOperationQueue uiViewOperationQueue) {
<ide> getPadding(Spacing.END),
<ide> getPadding(Spacing.BOTTOM),
<ide> getTextAlign(),
<del> mTextBreakStrategy);
<add> mTextBreakStrategy,
<add> mJustificationMode);
<ide> uiViewOperationQueue.enqueueUpdateExtraData(getReactTag(), reactTextUpdate);
<ide> }
<ide> }
<ide><path>ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextUpdate.java
<ide> public class ReactTextUpdate {
<ide> private final float mPaddingBottom;
<ide> private final int mTextAlign;
<ide> private final int mTextBreakStrategy;
<add> private final int mJustificationMode;
<ide>
<ide> /**
<ide> * @deprecated Use a non-deprecated constructor for ReactTextUpdate instead. This one remains
<ide> public ReactTextUpdate(
<ide> paddingEnd,
<ide> paddingBottom,
<ide> textAlign,
<del> Layout.BREAK_STRATEGY_HIGH_QUALITY);
<add> Layout.BREAK_STRATEGY_HIGH_QUALITY,
<add> Layout.JUSTIFICATION_MODE_NONE);
<ide> }
<ide>
<ide> public ReactTextUpdate(
<ide> public ReactTextUpdate(
<ide> float paddingEnd,
<ide> float paddingBottom,
<ide> int textAlign,
<del> int textBreakStrategy) {
<add> int textBreakStrategy,
<add> int justificationMode) {
<ide> mText = text;
<ide> mJsEventCounter = jsEventCounter;
<ide> mContainsImages = containsImages;
<ide> public ReactTextUpdate(
<ide> mPaddingBottom = paddingBottom;
<ide> mTextAlign = textAlign;
<ide> mTextBreakStrategy = textBreakStrategy;
<add> mJustificationMode = justificationMode;
<ide> }
<ide>
<ide> public Spannable getText() {
<ide> public int getTextAlign() {
<ide> public int getTextBreakStrategy() {
<ide> return mTextBreakStrategy;
<ide> }
<add>
<add> public int getJustificationMode() {
<add> return mJustificationMode;
<add> }
<ide> }
<ide><path>ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextView.java
<ide> public void setText(ReactTextUpdate update) {
<ide> setBreakStrategy(update.getTextBreakStrategy());
<ide> }
<ide> }
<add> if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
<add> if (getJustificationMode() != update.getJustificationMode()) {
<add> setJustificationMode(update.getJustificationMode());
<add> }
<add> }
<ide> }
<ide>
<ide> @Override
<ide><path>ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextViewManager.java
<ide> public Object updateLocalData(
<ide> // TODO add textBreakStrategy prop into local Data
<ide> int textBreakStrategy = Layout.BREAK_STRATEGY_HIGH_QUALITY;
<ide>
<add> // TODO add justificationMode prop into local Data
<add> int justificationMode = Layout.JUSTIFICATION_MODE_NONE;
<add>
<ide> return new ReactTextUpdate(
<ide> spanned,
<ide> -1, // TODO add this into local Data?
<ide> public Object updateLocalData(
<ide> textViewProps.getEndPadding(),
<ide> textViewProps.getBottomPadding(),
<ide> textViewProps.getTextAlign(),
<del> textBreakStrategy);
<add> textBreakStrategy,
<add> justificationMode
<add> );
<ide> }
<ide>
<ide> @Override
<ide><path>ReactAndroid/src/main/java/com/facebook/react/views/text/TextAttributeProps.java
<ide> public class TextAttributeProps {
<ide> protected int mTextAlign = Gravity.NO_GRAVITY;
<ide> protected int mTextBreakStrategy =
<ide> (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) ? 0 : Layout.BREAK_STRATEGY_HIGH_QUALITY;
<add> protected int mJustificationMode =
<add> (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) ? 0 : Layout.JUSTIFICATION_MODE_NONE;
<ide> protected TextTransform mTextTransform = TextTransform.UNSET;
<ide>
<ide> protected float mTextShadowOffsetDx = 0;
<ide> public void setAllowFontScaling(boolean allowFontScaling) {
<ide> }
<ide>
<ide> public void setTextAlign(@Nullable String textAlign) {
<del> if (textAlign == null || "auto".equals(textAlign)) {
<del> mTextAlign = Gravity.NO_GRAVITY;
<del> } else if ("left".equals(textAlign)) {
<del> mTextAlign = Gravity.LEFT;
<del> } else if ("right".equals(textAlign)) {
<del> mTextAlign = Gravity.RIGHT;
<del> } else if ("center".equals(textAlign)) {
<del> mTextAlign = Gravity.CENTER_HORIZONTAL;
<del> } else if ("justify".equals(textAlign)) {
<del> // Fallback gracefully for cross-platform compat instead of error
<add> if ("justify".equals(textAlign)) {
<add> if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
<add> mJustificationMode = Layout.JUSTIFICATION_MODE_INTER_WORD;
<add> }
<ide> mTextAlign = Gravity.LEFT;
<ide> } else {
<del> throw new JSApplicationIllegalArgumentException("Invalid textAlign: " + textAlign);
<add> if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
<add> mJustificationMode = Layout.JUSTIFICATION_MODE_NONE;
<add> }
<add>
<add> if (textAlign == null || "auto".equals(textAlign)) {
<add> mTextAlign = Gravity.NO_GRAVITY;
<add> } else if ("left".equals(textAlign)) {
<add> mTextAlign = Gravity.LEFT;
<add> } else if ("right".equals(textAlign)) {
<add> mTextAlign = Gravity.RIGHT;
<add> } else if ("center".equals(textAlign)) {
<add> mTextAlign = Gravity.CENTER_HORIZONTAL;
<add> } else {
<add> throw new JSApplicationIllegalArgumentException("Invalid textAlign: " + textAlign);
<add> }
<add>
<ide> }
<ide> }
<ide>
<ide><path>ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java
<ide> import android.text.Editable;
<ide> import android.text.InputFilter;
<ide> import android.text.InputType;
<add>import android.text.Layout;
<ide> import android.text.Spannable;
<ide> import android.text.TextWatcher;
<ide> import android.util.TypedValue;
<ide> public void setUnderlineColor(ReactEditText view, @Nullable Integer underlineCol
<ide>
<ide> @ReactProp(name = ViewProps.TEXT_ALIGN)
<ide> public void setTextAlign(ReactEditText view, @Nullable String textAlign) {
<del> if (textAlign == null || "auto".equals(textAlign)) {
<del> view.setGravityHorizontal(Gravity.NO_GRAVITY);
<del> } else if ("left".equals(textAlign)) {
<del> view.setGravityHorizontal(Gravity.LEFT);
<del> } else if ("right".equals(textAlign)) {
<del> view.setGravityHorizontal(Gravity.RIGHT);
<del> } else if ("center".equals(textAlign)) {
<del> view.setGravityHorizontal(Gravity.CENTER_HORIZONTAL);
<del> } else if ("justify".equals(textAlign)) {
<del> // Fallback gracefully for cross-platform compat instead of error
<add> if ("justify".equals(textAlign)) {
<add> if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
<add> view.setJustificationMode(Layout.JUSTIFICATION_MODE_INTER_WORD);
<add> }
<ide> view.setGravityHorizontal(Gravity.LEFT);
<ide> } else {
<del> throw new JSApplicationIllegalArgumentException("Invalid textAlign: " + textAlign);
<add> if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
<add> view.setJustificationMode(Layout.JUSTIFICATION_MODE_NONE);
<add> }
<add>
<add> if (textAlign == null || "auto".equals(textAlign)) {
<add> view.setGravityHorizontal(Gravity.NO_GRAVITY);
<add> } else if ("left".equals(textAlign)) {
<add> view.setGravityHorizontal(Gravity.LEFT);
<add> } else if ("right".equals(textAlign)) {
<add> view.setGravityHorizontal(Gravity.RIGHT);
<add> } else if ("center".equals(textAlign)) {
<add> view.setGravityHorizontal(Gravity.CENTER_HORIZONTAL);
<add> } else {
<add> throw new JSApplicationIllegalArgumentException("Invalid textAlign: " + textAlign);
<add> }
<add>
<ide> }
<ide> }
<ide>
<ide><path>ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputShadowNode.java
<ide> public void onCollectExtraUpdates(UIViewOperationQueue uiViewOperationQueue) {
<ide> getPadding(Spacing.RIGHT),
<ide> getPadding(Spacing.BOTTOM),
<ide> mTextAlign,
<del> mTextBreakStrategy);
<add> mTextBreakStrategy,
<add> mJustificationMode);
<ide> uiViewOperationQueue.enqueueUpdateExtraData(getReactTag(), reactTextUpdate);
<ide> }
<ide> }
<ide><path>ReactAndroid/src/test/java/com/facebook/react/views/text/ReactTextTest.java
<ide> import android.graphics.Color;
<ide> import android.graphics.Typeface;
<ide> import android.graphics.drawable.Drawable;
<add>import android.text.Layout;
<ide> import android.text.Spanned;
<ide> import android.text.TextUtils;
<ide> import android.text.style.AbsoluteSizeSpan;
<ide> public void testMaxLinesApplied() {
<ide> assertThat(textView.getEllipsize()).isEqualTo(TextUtils.TruncateAt.END);
<ide> }
<ide>
<add> @TargetApi(Build.VERSION_CODES.O)
<add> @Test
<add> public void testTextAlignJustifyApplied() {
<add> UIManagerModule uiManager = getUIManagerModule();
<add>
<add> ReactRootView rootView = createText(
<add> uiManager,
<add> JavaOnlyMap.of("textAlign", "justify"),
<add> JavaOnlyMap.of(ReactRawTextShadowNode.PROP_TEXT, "test text"));
<add>
<add> TextView textView = (TextView) rootView.getChildAt(0);
<add> assertThat(textView.getText().toString()).isEqualTo("test text");
<add> assertThat(textView.getJustificationMode()).isEqualTo(Layout.JUSTIFICATION_MODE_INTER_WORD);
<add> }
<add>
<ide> /**
<ide> * Make sure TextView has exactly one span and that span has given type.
<ide> */
<ide><path>ReactAndroid/src/test/java/com/facebook/react/views/textinput/ReactTextInputPropertyTest.java
<ide>
<ide> import android.content.res.ColorStateList;
<ide> import android.graphics.Color;
<add>import android.os.Build;
<ide> import android.text.InputType;
<ide> import android.text.InputFilter;
<add>import android.text.Layout;
<ide> import android.util.DisplayMetrics;
<ide> import android.view.Gravity;
<ide> import android.view.inputmethod.EditorInfo;
<ide> public void testTextAlign() {
<ide> assertThat(view.getGravity() & Gravity.HORIZONTAL_GRAVITY_MASK).isEqualTo(Gravity.CENTER_HORIZONTAL);
<ide> mManager.updateProperties(view, buildStyles("textAlign", null));
<ide> assertThat(view.getGravity() & Gravity.HORIZONTAL_GRAVITY_MASK).isEqualTo(defaultHorizontalGravity);
<add> if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
<add> mManager.updateProperties(view, buildStyles("textAlign", "justify"));
<add> assertThat(view.getJustificationMode()).isEqualTo(Layout.JUSTIFICATION_MODE_INTER_WORD);
<add> }
<ide>
<ide> // TextAlignVertical
<ide> mManager.updateProperties(view, buildStyles("textAlignVertical", "top")); | 11 |
Ruby | Ruby | use yaml.load_file in database tasks example | b335def167f1141995810d32d700ef3f4d036cd4 | <ide><path>activerecord/lib/active_record/tasks/database_tasks.rb
<ide> class DatabaseNotSupported < StandardError; end # :nodoc:
<ide> # Example usage of +DatabaseTasks+ outside Rails could look as such:
<ide> #
<ide> # include ActiveRecord::Tasks
<del> # DatabaseTasks.database_configuration = YAML.load(File.read('my_database_config.yml'))
<add> # DatabaseTasks.database_configuration = YAML.load_file('my_database_config.yml')
<ide> # DatabaseTasks.db_dir = 'db'
<ide> # # other settings...
<ide> # | 1 |
Java | Java | update operationscan to operatorscan | 13d293fb4a3298b4084008a4e920d2a8c31c6283 | <ide><path>rxjava-core/src/main/java/rx/Observable.java
<ide> import rx.operators.OperationReplay;
<ide> import rx.operators.OperationRetry;
<ide> import rx.operators.OperationSample;
<del>import rx.operators.OperationScan;
<add>import rx.operators.OperatorScan;
<ide> import rx.operators.OperationSequenceEqual;
<ide> import rx.operators.OperationSingle;
<ide> import rx.operators.OperationSkip;
<ide> public final <U> Observable<T> sample(Observable<U> sampler) {
<ide> * @see <a href="http://msdn.microsoft.com/en-us/library/hh211665.aspx">MSDN: Observable.Scan</a>
<ide> */
<ide> public final Observable<T> scan(Func2<T, T, T> accumulator) {
<del> return lift(OperationScan.scan(accumulator));
<add> return lift(new OperatorScan<T, T>(accumulator));
<ide> }
<ide>
<ide> /**
<ide> public final Observable<T> scan(Func2<T, T, T> accumulator) {
<ide> * @see <a href="http://msdn.microsoft.com/en-us/library/hh211665.aspx">MSDN: Observable.Scan</a>
<ide> */
<ide> public final <R> Observable<R> scan(R initialValue, Func2<R, ? super T, R> accumulator) {
<del> return lift(OperationScan.scan(initialValue, accumulator));
<add> return lift(new OperatorScan<R, T>(initialValue, accumulator));
<ide> }
<ide>
<ide> /**
<ide><path>rxjava-core/src/main/java/rx/operators/OperationScan.java
<del>/**
<del> * Copyright 2014 Netflix, Inc.
<del> *
<del> * Licensed under the Apache License, Version 2.0 (the "License");
<del> * you may not use this file except in compliance with the License.
<del> * You may obtain a copy of the License at
<del> *
<del> * http://www.apache.org/licenses/LICENSE-2.0
<del> *
<del> * Unless required by applicable law or agreed to in writing, software
<del> * distributed under the License is distributed on an "AS IS" BASIS,
<del> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<del> * See the License for the specific language governing permissions and
<del> * limitations under the License.
<del> */
<del>package rx.operators;
<del>
<del>import rx.Observable.Operator;
<del>import rx.Subscriber;
<del>import rx.util.functions.Func2;
<del>
<del>/**
<del> * Returns an Observable that applies a function to the first item emitted by a source Observable,
<del> * then feeds the result of that function along with the second item emitted by an Observable into
<del> * the same function, and so on until all items have been emitted by the source Observable,
<del> * emitting the result of each of these iterations.
<del> * <p>
<del> * <img width="640" src="https://github.com/Netflix/RxJava/wiki/images/rx-operators/scan.png">
<del> * <p>
<del> * This sort of function is sometimes called an accumulator.
<del> * <p>
<del> * Note that when you pass a seed to <code>scan()</code> the resulting Observable will emit that
<del> * seed as its first emitted item.
<del> */
<del>public final class OperationScan {
<del> /**
<del> * Applies an accumulator function over an observable sequence and returns each intermediate
<del> * result with the specified source and accumulator.
<del> *
<del> * @param sequence
<del> * An observable sequence of elements to project.
<del> * @param initialValue
<del> * The initial (seed) accumulator value.
<del> * @param accumulator
<del> * An accumulator function to be invoked on each element from the sequence.
<del> *
<del> * @return An observable sequence whose elements are the result of accumulating the output from
<del> * the list of Observables.
<del> * @see <a
<del> * href="http://msdn.microsoft.com/en-us/library/hh212007%28v=vs.103%29.aspx">Observable.Scan(TSource,
<del> * TAccumulate) Method (IObservable(TSource), TAccumulate, Func(TAccumulate, TSource,
<del> * TAccumulate))</a>
<del> */
<del> public static <T, R> Operator<R, T> scan(final R initialValue, final Func2<R, ? super T, R> accumulator) {
<del> return new Operator<R, T>() {
<del> @Override
<del> public Subscriber<T> call(final Subscriber<? super R> observer) {
<del> observer.onNext(initialValue);
<del> return new Subscriber<T>(observer) {
<del> private R value = initialValue;
<del>
<del> @Override
<del> public void onNext(T value) {
<del> try {
<del> this.value = accumulator.call(this.value, value);
<del> } catch (Throwable e) {
<del> observer.onError(e);
<del> observer.unsubscribe();
<del> }
<del> observer.onNext(this.value);
<del> }
<del>
<del> @Override
<del> public void onError(Throwable e) {
<del> observer.onError(e);
<del> }
<del>
<del> @Override
<del> public void onCompleted() {
<del> observer.onCompleted();
<del> }
<del> };
<del> }
<del> };
<del> }
<del>
<del> /**
<del> * Applies an accumulator function over an observable sequence and returns each intermediate
<del> * result with the specified source and accumulator.
<del> *
<del> * @param sequence
<del> * An observable sequence of elements to project.
<del> * @param accumulator
<del> * An accumulator function to be invoked on each element from the sequence.
<del> *
<del> * @return An observable sequence whose elements are the result of accumulating the output from
<del> * the list of Observables.
<del> * @see <a
<del> * href="http://msdn.microsoft.com/en-us/library/hh211665(v=vs.103).aspx">Observable.Scan(TSource)
<del> * Method (IObservable(TSource), Func(TSource, TSource, TSource))</a>
<del> */
<del> public static <T> Operator<T, T> scan(final Func2<T, T, T> accumulator) {
<del> return new Operator<T, T>() {
<del> @Override
<del> public Subscriber<T> call(final Subscriber<? super T> observer) {
<del> return new Subscriber<T>(observer) {
<del> private boolean first = true;
<del> private T value;
<del>
<del> @Override
<del> public void onNext(T value) {
<del> if (first) {
<del> this.value = value;
<del> first = false;
<del> }
<del> else {
<del> try {
<del> this.value = accumulator.call(this.value, value);
<del> } catch (Throwable e) {
<del> observer.onError(e);
<del> observer.unsubscribe();
<del> }
<del> }
<del> observer.onNext(this.value);
<del> }
<del>
<del> @Override
<del> public void onError(Throwable e) {
<del> observer.onError(e);
<del> }
<del>
<del> @Override
<del> public void onCompleted() {
<del> observer.onCompleted();
<del> }
<del> };
<del> }
<del> };
<del> }
<del>}
<ide><path>rxjava-core/src/main/java/rx/operators/OperatorScan.java
<add>/**
<add> * Copyright 2014 Netflix, Inc.
<add> *
<add> * Licensed under the Apache License, Version 2.0 (the "License");
<add> * you may not use this file except in compliance with the License.
<add> * You may obtain a copy of the License at
<add> *
<add> * http://www.apache.org/licenses/LICENSE-2.0
<add> *
<add> * Unless required by applicable law or agreed to in writing, software
<add> * distributed under the License is distributed on an "AS IS" BASIS,
<add> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<add> * See the License for the specific language governing permissions and
<add> * limitations under the License.
<add> */
<add>package rx.operators;
<add>
<add>import rx.Observable.Operator;
<add>import rx.Subscriber;
<add>import rx.util.functions.Func2;
<add>
<add>/**
<add> * Returns an Observable that applies a function to the first item emitted by a source Observable,
<add> * then feeds the result of that function along with the second item emitted by an Observable into
<add> * the same function, and so on until all items have been emitted by the source Observable,
<add> * emitting the result of each of these iterations.
<add> * <p>
<add> * <img width="640" src="https://github.com/Netflix/RxJava/wiki/images/rx-operators/scan.png">
<add> * <p>
<add> * This sort of function is sometimes called an accumulator.
<add> * <p>
<add> * Note that when you pass a seed to <code>scan()</code> the resulting Observable will emit that
<add> * seed as its first emitted item.
<add> */
<add>public final class OperatorScan<R, T> implements Operator<R, T> {
<add>
<add> private final R initialValue;
<add> private final Func2<R, ? super T, R> accumulator;
<add> // sentinel if we don't receive an initial value
<add> private static final Object NO_INITIAL_VALUE = new Object();
<add>
<add> /**
<add> * Applies an accumulator function over an observable sequence and returns each intermediate
<add> * result with the specified source and accumulator.
<add> *
<add> * @param sequence
<add> * An observable sequence of elements to project.
<add> * @param initialValue
<add> * The initial (seed) accumulator value.
<add> * @param accumulator
<add> * An accumulator function to be invoked on each element from the sequence.
<add> *
<add> * @return An observable sequence whose elements are the result of accumulating the output from
<add> * the list of Observables.
<add> * @see <a href="http://msdn.microsoft.com/en-us/library/hh212007%28v=vs.103%29.aspx">Observable.Scan(TSource, TAccumulate) Method (IObservable(TSource), TAccumulate, Func(TAccumulate, TSource,
<add> * TAccumulate))</a>
<add> */
<add> public OperatorScan(R initialValue, Func2<R, ? super T, R> accumulator) {
<add> this.initialValue = initialValue;
<add> this.accumulator = accumulator;
<add> }
<add>
<add> /**
<add> * Applies an accumulator function over an observable sequence and returns each intermediate
<add> * result with the specified source and accumulator.
<add> *
<add> * @param sequence
<add> * An observable sequence of elements to project.
<add> * @param accumulator
<add> * An accumulator function to be invoked on each element from the sequence.
<add> *
<add> * @return An observable sequence whose elements are the result of accumulating the output from
<add> * the list of Observables.
<add> * @see <a href="http://msdn.microsoft.com/en-us/library/hh211665(v=vs.103).aspx">Observable.Scan(TSource) Method (IObservable(TSource), Func(TSource, TSource, TSource))</a>
<add> */
<add> @SuppressWarnings("unchecked")
<add> public OperatorScan(final Func2<R, ? super T, R> accumulator) {
<add> this((R) NO_INITIAL_VALUE, accumulator);
<add> }
<add>
<add> @Override
<add> public Subscriber<? super T> call(final Subscriber<? super R> observer) {
<add> if (initialValue != NO_INITIAL_VALUE) {
<add> observer.onNext(initialValue);
<add> }
<add> return new Subscriber<T>(observer) {
<add> private R value = initialValue;
<add>
<add> @SuppressWarnings("unchecked")
<add> @Override
<add> public void onNext(T value) {
<add> if (this.value == NO_INITIAL_VALUE) {
<add> // if there is NO_INITIAL_VALUE then we know it is type T for both so cast T to R
<add> this.value = (R) value;
<add> } else {
<add> try {
<add> this.value = accumulator.call(this.value, value);
<add> } catch (Throwable e) {
<add> observer.onError(e);
<add> observer.unsubscribe();
<add> }
<add> }
<add> observer.onNext(this.value);
<add> }
<add>
<add> @Override
<add> public void onError(Throwable e) {
<add> observer.onError(e);
<add> }
<add>
<add> @Override
<add> public void onCompleted() {
<add> observer.onCompleted();
<add> }
<add> };
<add> }
<add>}
<ide><path>rxjava-core/src/test/java/rx/ReduceTests.java
<ide>
<ide> import rx.CovarianceTest.HorrorMovie;
<ide> import rx.CovarianceTest.Movie;
<del>import rx.operators.OperationScan;
<add>import rx.operators.OperatorScan;
<ide> import rx.util.functions.Func2;
<ide>
<ide> public class ReduceTests {
<ide> public Movie call(Movie t1, Movie t2) {
<ide> }
<ide> };
<ide>
<del> Observable<Movie> reduceResult = horrorMovies.lift(OperationScan.scan(chooseSecondMovie)).takeLast(1);
<add> Observable<Movie> reduceResult = horrorMovies.scan(chooseSecondMovie).takeLast(1);
<ide>
<ide> Observable<Movie> reduceResult2 = horrorMovies.reduce(chooseSecondMovie);
<ide> }
<add><path>rxjava-core/src/test/java/rx/operators/OperatorScanTest.java
<del><path>rxjava-core/src/test/java/rx/operators/OperationScanTest.java
<ide>
<ide> import static org.mockito.Matchers.*;
<ide> import static org.mockito.Mockito.*;
<del>import static rx.operators.OperationScan.*;
<add>import static rx.operators.OperatorScan.*;
<ide>
<ide> import org.junit.Before;
<ide> import org.junit.Test;
<ide> import rx.Observer;
<ide> import rx.util.functions.Func2;
<ide>
<del>public class OperationScanTest {
<add>public class OperatorScanTest {
<ide>
<ide> @Before
<ide> public void before() {
<ide> public void testScanIntegersWithInitialValue() {
<ide>
<ide> Observable<Integer> observable = Observable.from(1, 2, 3);
<ide>
<del> Observable<String> m = observable.lift(scan("", new Func2<String, Integer, String>() {
<add> Observable<String> m = observable.scan("", new Func2<String, Integer, String>() {
<ide>
<ide> @Override
<ide> public String call(String s, Integer n) {
<ide> return s + n.toString();
<ide> }
<ide>
<del> }));
<add> });
<ide> m.subscribe(observer);
<ide>
<ide> verify(observer, never()).onError(any(Throwable.class));
<ide> public void testScanIntegersWithoutInitialValue() {
<ide>
<ide> Observable<Integer> observable = Observable.from(1, 2, 3);
<ide>
<del> Observable<Integer> m = observable.lift(scan(new Func2<Integer, Integer, Integer>() {
<add> Observable<Integer> m = observable.scan(new Func2<Integer, Integer, Integer>() {
<ide>
<ide> @Override
<ide> public Integer call(Integer t1, Integer t2) {
<ide> return t1 + t2;
<ide> }
<ide>
<del> }));
<add> });
<ide> m.subscribe(observer);
<ide>
<ide> verify(observer, never()).onError(any(Throwable.class));
<ide> public void testScanIntegersWithoutInitialValueAndOnlyOneValue() {
<ide>
<ide> Observable<Integer> observable = Observable.from(1);
<ide>
<del> Observable<Integer> m = observable.lift(scan(new Func2<Integer, Integer, Integer>() {
<add> Observable<Integer> m = observable.scan(new Func2<Integer, Integer, Integer>() {
<ide>
<ide> @Override
<ide> public Integer call(Integer t1, Integer t2) {
<ide> return t1 + t2;
<ide> }
<ide>
<del> }));
<add> });
<ide> m.subscribe(observer);
<ide>
<ide> verify(observer, never()).onError(any(Throwable.class)); | 5 |
Javascript | Javascript | add strict equalities in src/core/ps_parser.js | c9fb3e1b6d1c2ea9efe00a0b1ce893d51944be53 | <ide><path>src/core/ps_parser.js
<ide> var PostScriptParser = (function PostScriptParserClosure() {
<ide> this.token = this.lexer.getToken();
<ide> },
<ide> accept: function PostScriptParser_accept(type) {
<del> if (this.token.type == type) {
<add> if (this.token.type === type) {
<ide> this.nextToken();
<ide> return true;
<ide> }
<ide> var PostScriptLexer = (function PostScriptLexerClosure() {
<ide> if (ch === 0x0A || ch === 0x0D) {
<ide> comment = false;
<ide> }
<del> } else if (ch == 0x25) { // '%'
<add> } else if (ch === 0x25) { // '%'
<ide> comment = true;
<ide> } else if (!Lexer.isSpace(ch)) {
<ide> break; | 1 |
Javascript | Javascript | read wheelevent.deltamode before deltas | 2f8a0638a6af82aec09c942b40bfd66997b133ef | <ide><path>web/app.js
<ide> function webViewerWheel(evt) {
<ide> return;
<ide> }
<ide>
<add> // It is important that we query deltaMode before delta{X,Y}, so that
<add> // Firefox doesn't switch to DOM_DELTA_PIXEL mode for compat with other
<add> // browsers, see https://bugzilla.mozilla.org/show_bug.cgi?id=1392460.
<add> const deltaMode = evt.deltaMode;
<add> const delta = normalizeWheelEventDirection(evt);
<ide> const previousScale = pdfViewer.currentScale;
<ide>
<del> const delta = normalizeWheelEventDirection(evt);
<ide> let ticks = 0;
<ide> if (
<del> evt.deltaMode === WheelEvent.DOM_DELTA_LINE ||
<del> evt.deltaMode === WheelEvent.DOM_DELTA_PAGE
<add> deltaMode === WheelEvent.DOM_DELTA_LINE ||
<add> deltaMode === WheelEvent.DOM_DELTA_PAGE
<ide> ) {
<ide> // For line-based devices, use one tick per event, because different
<ide> // OSs have different defaults for the number lines. But we generally | 1 |
Text | Text | add missing word | 6a9b9c302b44594b59bf6129349ec2552a4b6fd3 | <ide><path>docs/rfcs/001-updateable-bundled-packages.md
<ide> Any package that opts into this behavior must adhere to two rules:
<ide>
<ide> 1. **Each release must ensure that its `engines` field in `package.json` reflects the necessary Atom version for the Atom, Electron, and Node.js APIs used in the package**. This field defines the range of Atom versions in which the package is expected to work. The field should always be set to the lowest possible Atom version that the package supports.
<ide>
<del>2. **Any new update to a bundled package *must* support current Stable *and* Beta releases**. This enables user to upgrade the package and continue to use it in side-by-side Stable and Beta installs on their machine. If a package wants to use API features of a newer version of Atom while still supporting older Atom versions, it must do so in a way that is aware of the user's version and adjust itself accordingly.
<add>2. **Any new update to a bundled package *must* support current Stable *and* Beta releases**. This enables the user to upgrade the package and continue to use it in side-by-side Stable and Beta installs on their machine. If a package wants to use API features of a newer version of Atom while still supporting older Atom versions, it must do so in a way that is aware of the user's version and adjust itself accordingly.
<ide>
<ide> ## Drawbacks
<ide> | 1 |
Java | Java | suppress unused warning in test code | 0b21c16fa8610950ec0eb0127c7312a6679f0c9e | <ide><path>spring-context/src/testFixtures/java/org/springframework/context/testfixture/context/annotation/AutowiredGenericTemplate.java
<ide>
<ide> public class AutowiredGenericTemplate {
<ide>
<add> @SuppressWarnings("unused")
<ide> private GenericTemplate<Integer> genericTemplate;
<ide>
<ide> @Autowired | 1 |
Javascript | Javascript | use int32 instead of int16 for checksums | 8738b72f30f157392bcaf5c947f887fa22a8d6f8 | <ide><path>fonts.js
<ide> var Font = (function Font() {
<ide> // checksum
<ide> var checksum = 0;
<ide> for (var i = 0; i < length; i+=4)
<del> checksum += int16([data[i], data[i+1], data[i+2], data[i+3]]);
<add> checksum += int32([data[i], data[i+1], data[i+2], data[i+3]]);
<ide>
<ide> var tableEntry = tag +
<ide> string32(checksum) + | 1 |
Ruby | Ruby | use file.directory? as dir.exists? is only 1.9.2+ | 3a4dc9d34c1cde8bf34dfa4b4600fb8bcef9eb45 | <ide><path>railties/lib/rails/paths.rb
<ide> def expanded
<ide> def existent
<ide> expanded.select { |f| File.exists?(f) }
<ide> end
<del>
<add>
<ide> def existent_directories
<del> expanded.select {|d| Dir.exists?(d) }
<add> expanded.select { |d| File.directory?(d) }
<ide> end
<ide>
<ide> alias to_a expanded | 1 |
Text | Text | add dnsimple as a sponsor | 716c0716021fb61f089ce5ee9864f0535ef213cc | <ide><path>README.md
<ide> Flaky test detection and tracking is provided by [BuildPulse](https://buildpulse
<ide>
<ide> [](https://buildpulse.io)
<ide>
<add><https://brew.sh>'s DNS is [resolving with DNSimple](https://dnsimple.com/resolving/homebrew).
<add>
<add>[](https://dnsimple.com/resolving/homebrew)
<add>
<ide> Homebrew is generously supported by [Substack](https://github.com/substackinc), [Randy Reddig](https://github.com/ydnar), [embark-studios](https://github.com/embark-studios), [CodeCrafters](https://github.com/codecrafters-io) and many other users and organisations via [GitHub Sponsors](https://github.com/sponsors/Homebrew).
<ide>
<ide> [](https://github.com/substackinc) | 1 |
Go | Go | prevent any kind of operation simultaneously | 2db99441c85fdf1e7d468bc02b085d9e1b95704c | <ide><path>server.go
<ide> func (srv *Server) poolAdd(kind, key string) error {
<ide> if _, exists := srv.pullingPool[key]; exists {
<ide> return fmt.Errorf("pull %s is already in progress", key)
<ide> }
<add> if _, exists := srv.pushingPool[key]; exists {
<add> return fmt.Errorf("push %s is already in progress", key)
<add> }
<ide>
<ide> switch kind {
<ide> case "pull": | 1 |
Javascript | Javascript | break more browser deps in core | b79a3cbd21a82a44ac0c8863995a5f12b10a67d6 | <add><path>src/browser/ReactBrowserComponentMixin.js
<del><path>src/core/ReactComponentEnvironment.js
<ide> * See the License for the specific language governing permissions and
<ide> * limitations under the License.
<ide> *
<del> * @providesModule ReactComponentEnvironment
<add> * @providesModule ReactBrowserComponentMixin
<ide> */
<ide>
<ide> "use strict";
<ide>
<del>var ReactComponentBrowserEnvironment =
<del> require('ReactComponentBrowserEnvironment');
<add>var ReactMount = require('ReactMount');
<ide>
<del>var ReactComponentEnvironment = ReactComponentBrowserEnvironment;
<add>var invariant = require('invariant');
<ide>
<del>module.exports = ReactComponentEnvironment;
<add>var ReactBrowserComponentMixin = {
<add> /**
<add> * Returns the DOM node rendered by this component.
<add> *
<add> * @return {DOMElement} The root node of this component.
<add> * @final
<add> * @protected
<add> */
<add> getDOMNode: function() {
<add> invariant(
<add> this.isMounted(),
<add> 'getDOMNode(): A component must be mounted to have a DOM node.'
<add> );
<add> return ReactMount.getNode(this._rootNodeID);
<add> }
<add>};
<add>
<add>module.exports = ReactBrowserComponentMixin;
<ide><path>src/browser/ReactComponentBrowserEnvironment.js
<ide> var DOC_NODE_TYPE = 9;
<ide> * the browser context.
<ide> */
<ide> var ReactComponentBrowserEnvironment = {
<del> /**
<del> * Mixed into every component instance.
<del> */
<del> Mixin: {
<del> /**
<del> * Returns the DOM node rendered by this component.
<del> *
<del> * @return {DOMElement} The root node of this component.
<del> * @final
<del> * @protected
<del> */
<del> getDOMNode: function() {
<del> invariant(
<del> this.isMounted(),
<del> 'getDOMNode(): A component must be mounted to have a DOM node.'
<del> );
<del> return ReactMount.getNode(this._rootNodeID);
<del> }
<del> },
<del>
<ide> ReactReconcileTransaction: ReactReconcileTransaction,
<ide>
<ide> BackendIDOperations: ReactDOMIDOperations,
<ide><path>src/browser/ReactDOMComponent.js
<ide> var CSSPropertyOperations = require('CSSPropertyOperations');
<ide> var DOMProperty = require('DOMProperty');
<ide> var DOMPropertyOperations = require('DOMPropertyOperations');
<add>var ReactBrowserComponentMixin = require('ReactBrowserComponentMixin');
<ide> var ReactComponent = require('ReactComponent');
<ide> var ReactEventEmitter = require('ReactEventEmitter');
<ide> var ReactMount = require('ReactMount');
<ide> ReactDOMComponent.Mixin = {
<ide> mixInto(ReactDOMComponent, ReactComponent.Mixin);
<ide> mixInto(ReactDOMComponent, ReactDOMComponent.Mixin);
<ide> mixInto(ReactDOMComponent, ReactMultiChild.Mixin);
<add>mixInto(ReactDOMComponent, ReactBrowserComponentMixin);
<ide>
<ide> module.exports = ReactDOMComponent;
<ide><path>src/browser/ReactDefaultInjection.js
<ide> var CompositionEventPlugin = require('CompositionEventPlugin');
<ide> var DefaultEventPluginOrder = require('DefaultEventPluginOrder');
<ide> var EnterLeaveEventPlugin = require('EnterLeaveEventPlugin');
<ide> var MobileSafariClickEventPlugin = require('MobileSafariClickEventPlugin');
<add>var ReactBrowserComponentMixin = require('ReactBrowserComponentMixin');
<add>var ReactComponentBrowserEnvironment =
<add> require('ReactComponentBrowserEnvironment');
<ide> var ReactEventTopLevelCallback = require('ReactEventTopLevelCallback');
<ide> var ReactDOM = require('ReactDOM');
<ide> var ReactDOMButton = require('ReactDOMButton');
<ide> function inject() {
<ide> body: createFullPageComponent(ReactDOM.body)
<ide> });
<ide>
<add>
<add> // This needs to happen after createFullPageComponent() otherwise the mixin
<add> // gets double injected.
<add> ReactInjection.CompositeComponent.injectMixin(ReactBrowserComponentMixin);
<add>
<ide> ReactInjection.DOMProperty.injectDOMPropertyConfig(DefaultDOMPropertyConfig);
<ide>
<ide> ReactInjection.Updates.injectBatchingStrategy(
<ide> function inject() {
<ide> ServerReactRootIndex.createReactRootIndex
<ide> );
<ide>
<add> ReactInjection.Component.injectEnvironment(ReactComponentBrowserEnvironment);
<add>
<ide> if (__DEV__) {
<ide> var url = (ExecutionEnvironment.canUseDOM && window.location.href) || '';
<ide> if ((/[?&]react_perf\b/).test(url)) {
<ide><path>src/browser/ReactTextComponent.js
<ide> "use strict";
<ide>
<ide> var DOMPropertyOperations = require('DOMPropertyOperations');
<add>var ReactBrowserComponentMixin = require('ReactBrowserComponentMixin');
<ide> var ReactComponent = require('ReactComponent');
<ide>
<ide> var escapeTextForBrowser = require('escapeTextForBrowser');
<ide> var ReactTextComponent = function(initialText) {
<ide> };
<ide>
<ide> mixInto(ReactTextComponent, ReactComponent.Mixin);
<add>mixInto(ReactTextComponent, ReactBrowserComponentMixin);
<ide> mixInto(ReactTextComponent, {
<ide>
<ide> /**
<ide><path>src/browser/dom/components/ReactDOMButton.js
<ide> "use strict";
<ide>
<ide> var AutoFocusMixin = require('AutoFocusMixin');
<add>var ReactBrowserComponentMixin = require('ReactBrowserComponentMixin');
<ide> var ReactCompositeComponent = require('ReactCompositeComponent');
<ide> var ReactDOM = require('ReactDOM');
<ide>
<ide> var mouseListenerNames = keyMirror({
<ide> var ReactDOMButton = ReactCompositeComponent.createClass({
<ide> displayName: 'ReactDOMButton',
<ide>
<del> mixins: [AutoFocusMixin],
<add> mixins: [AutoFocusMixin, ReactBrowserComponentMixin],
<ide>
<ide> render: function() {
<ide> var props = {};
<ide><path>src/browser/dom/components/ReactDOMForm.js
<ide>
<ide> "use strict";
<ide>
<add>var ReactBrowserComponentMixin = require('ReactBrowserComponentMixin');
<ide> var ReactCompositeComponent = require('ReactCompositeComponent');
<ide> var ReactDOM = require('ReactDOM');
<ide> var ReactEventEmitter = require('ReactEventEmitter');
<ide> var form = ReactDOM.form;
<ide> var ReactDOMForm = ReactCompositeComponent.createClass({
<ide> displayName: 'ReactDOMForm',
<ide>
<add> mixins: [ReactBrowserComponentMixin],
<add>
<ide> render: function() {
<ide> // TODO: Instead of using `ReactDOM` directly, we should use JSX. However,
<ide> // `jshint` fails to parse JSX so in order for linting to work in the open
<ide><path>src/browser/dom/components/ReactDOMImg.js
<ide>
<ide> "use strict";
<ide>
<add>var ReactBrowserComponentMixin = require('ReactBrowserComponentMixin');
<ide> var ReactCompositeComponent = require('ReactCompositeComponent');
<ide> var ReactDOM = require('ReactDOM');
<ide> var ReactEventEmitter = require('ReactEventEmitter');
<ide> var ReactDOMImg = ReactCompositeComponent.createClass({
<ide> displayName: 'ReactDOMImg',
<ide> tagName: 'IMG',
<ide>
<add> mixins: [ReactBrowserComponentMixin],
<add>
<ide> render: function() {
<ide> return img(this.props);
<ide> },
<ide><path>src/browser/dom/components/ReactDOMInput.js
<ide> var AutoFocusMixin = require('AutoFocusMixin');
<ide> var DOMPropertyOperations = require('DOMPropertyOperations');
<ide> var LinkedValueUtils = require('LinkedValueUtils');
<add>var ReactBrowserComponentMixin = require('ReactBrowserComponentMixin');
<ide> var ReactCompositeComponent = require('ReactCompositeComponent');
<ide> var ReactDOM = require('ReactDOM');
<ide> var ReactMount = require('ReactMount');
<ide> var instancesByReactID = {};
<ide> var ReactDOMInput = ReactCompositeComponent.createClass({
<ide> displayName: 'ReactDOMInput',
<ide>
<del> mixins: [AutoFocusMixin, LinkedValueUtils.Mixin],
<add> mixins: [AutoFocusMixin, LinkedValueUtils.Mixin, ReactBrowserComponentMixin],
<ide>
<ide> getInitialState: function() {
<ide> var defaultValue = this.props.defaultValue;
<ide><path>src/browser/dom/components/ReactDOMOption.js
<ide>
<ide> "use strict";
<ide>
<add>var ReactBrowserComponentMixin = require('ReactBrowserComponentMixin');
<ide> var ReactCompositeComponent = require('ReactCompositeComponent');
<ide> var ReactDOM = require('ReactDOM');
<ide>
<ide> var option = ReactDOM.option;
<ide> var ReactDOMOption = ReactCompositeComponent.createClass({
<ide> displayName: 'ReactDOMOption',
<ide>
<add> mixins: [ReactBrowserComponentMixin],
<add>
<ide> componentWillMount: function() {
<ide> // TODO (yungsters): Remove support for `selected` in <option>.
<ide> if (this.props.selected != null) {
<ide><path>src/browser/dom/components/ReactDOMSelect.js
<ide>
<ide> var AutoFocusMixin = require('AutoFocusMixin');
<ide> var LinkedValueUtils = require('LinkedValueUtils');
<add>var ReactBrowserComponentMixin = require('ReactBrowserComponentMixin');
<ide> var ReactCompositeComponent = require('ReactCompositeComponent');
<ide> var ReactDOM = require('ReactDOM');
<ide>
<ide> function updateOptions(component, propValue) {
<ide> var ReactDOMSelect = ReactCompositeComponent.createClass({
<ide> displayName: 'ReactDOMSelect',
<ide>
<del> mixins: [AutoFocusMixin, LinkedValueUtils.Mixin],
<add> mixins: [AutoFocusMixin, LinkedValueUtils.Mixin, ReactBrowserComponentMixin],
<ide>
<ide> propTypes: {
<ide> defaultValue: selectValueType,
<ide><path>src/browser/dom/components/ReactDOMTextarea.js
<ide> var AutoFocusMixin = require('AutoFocusMixin');
<ide> var DOMPropertyOperations = require('DOMPropertyOperations');
<ide> var LinkedValueUtils = require('LinkedValueUtils');
<add>var ReactBrowserComponentMixin = require('ReactBrowserComponentMixin');
<ide> var ReactCompositeComponent = require('ReactCompositeComponent');
<ide> var ReactDOM = require('ReactDOM');
<ide>
<ide> var textarea = ReactDOM.textarea;
<ide> var ReactDOMTextarea = ReactCompositeComponent.createClass({
<ide> displayName: 'ReactDOMTextarea',
<ide>
<del> mixins: [AutoFocusMixin, LinkedValueUtils.Mixin],
<add> mixins: [AutoFocusMixin, LinkedValueUtils.Mixin, ReactBrowserComponentMixin],
<ide>
<ide> getInitialState: function() {
<ide> var defaultValue = this.props.defaultValue;
<ide><path>src/core/ReactComponent.js
<ide>
<ide> "use strict";
<ide>
<del>var ReactComponentEnvironment = require('ReactComponentEnvironment');
<ide> var ReactCurrentOwner = require('ReactCurrentOwner');
<ide> var ReactOwner = require('ReactOwner');
<ide> var ReactUpdates = require('ReactUpdates');
<ide> var ownerHasPropertyWarning = {};
<ide>
<ide> var NUMERIC_PROPERTY_REGEX = /^\d+$/;
<ide>
<add>var injected = false;
<add>
<add>/**
<add> * Optionally injectable environment dependent cleanup hook. (server vs.
<add> * browser etc). Example: A browser system caches DOM nodes based on component
<add> * ID and must remove that cache entry when this instance is unmounted.
<add> *
<add> * @private
<add> */
<add>var unmountIDFromEnvironment = null;
<add>
<add>/**
<add> * The "image" of a component tree, is the platform specific (typically
<add> * serialized) data that represents a tree of lower level UI building blocks.
<add> * On the web, this "image" is HTML markup which describes a construction of
<add> * low level `div` and `span` nodes. Other platforms may have different
<add> * encoding of this "image". This must be injected.
<add> *
<add> * @private
<add> */
<add>var mountImageIntoNode = null;
<add>
<ide> /**
<ide> * Warn if the component doesn't have an explicit key assigned to it.
<ide> * This component is in an array. The array could grow and shrink or be
<ide> function validateChildKeys(component) {
<ide> */
<ide> var ReactComponent = {
<ide>
<add> injection: {
<add> injectEnvironment: function(ReactComponentEnvironment) {
<add> invariant(
<add> !injected,
<add> 'ReactComponent: injectEnvironment() can only be called once.'
<add> );
<add> mountImageIntoNode = ReactComponentEnvironment.mountImageIntoNode;
<add> unmountIDFromEnvironment =
<add> ReactComponentEnvironment.unmountIDFromEnvironment;
<add> ReactComponent.BackendIDOperations =
<add> ReactComponentEnvironment.BackendIDOperations;
<add> ReactComponent.ReactReconcileTransaction =
<add> ReactComponentEnvironment.ReactReconcileTransaction;
<add> injected = true;
<add> }
<add> },
<add>
<ide> /**
<ide> * @param {?object} object
<ide> * @return {boolean} True if `object` is a valid component.
<ide> var ReactComponent = {
<ide> *
<ide> * @internal
<ide> */
<del> BackendIDOperations: ReactComponentEnvironment.BackendIDOperations,
<del>
<del> /**
<del> * Optionally injectable environment dependent cleanup hook. (server vs.
<del> * browser etc). Example: A browser system caches DOM nodes based on component
<del> * ID and must remove that cache entry when this instance is unmounted.
<del> *
<del> * @private
<del> */
<del> unmountIDFromEnvironment: ReactComponentEnvironment.unmountIDFromEnvironment,
<del>
<del> /**
<del> * The "image" of a component tree, is the platform specific (typically
<del> * serialized) data that represents a tree of lower level UI building blocks.
<del> * On the web, this "image" is HTML markup which describes a construction of
<del> * low level `div` and `span` nodes. Other platforms may have different
<del> * encoding of this "image". This must be injected.
<del> *
<del> * @private
<del> */
<del> mountImageIntoNode: ReactComponentEnvironment.mountImageIntoNode,
<add> BackendIDOperations: null,
<ide>
<ide> /**
<ide> * React references `ReactReconcileTransaction` using this property in order
<ide> * to allow dependency injection.
<ide> *
<ide> * @internal
<ide> */
<del> ReactReconcileTransaction:
<del> ReactComponentEnvironment.ReactReconcileTransaction,
<add> ReactReconcileTransaction: null,
<ide>
<ide> /**
<ide> * Base functionality for every ReactComponent constructor. Mixed into the
<ide> * `ReactComponent` prototype, but exposed statically for easy access.
<ide> *
<ide> * @lends {ReactComponent.prototype}
<ide> */
<del> Mixin: merge(ReactComponentEnvironment.Mixin, {
<add> Mixin: {
<ide>
<ide> /**
<ide> * Checks whether or not this component is mounted.
<ide> var ReactComponent = {
<ide> if (props.ref != null) {
<ide> ReactOwner.removeComponentAsRefFrom(this, props.ref, this._owner);
<ide> }
<del> ReactComponent.unmountIDFromEnvironment(this._rootNodeID);
<add> unmountIDFromEnvironment(this._rootNodeID);
<ide> this._rootNodeID = null;
<ide> this._lifeCycleState = ComponentLifeCycle.UNMOUNTED;
<ide> },
<ide> var ReactComponent = {
<ide> transaction,
<ide> shouldReuseMarkup) {
<ide> var markup = this.mountComponent(rootID, transaction, 0);
<del> ReactComponent.mountImageIntoNode(markup, container, shouldReuseMarkup);
<add> mountImageIntoNode(markup, container, shouldReuseMarkup);
<ide> },
<ide>
<ide> /**
<ide> var ReactComponent = {
<ide> }
<ide> return owner.refs[ref];
<ide> }
<del> })
<add> }
<ide> };
<ide>
<ide> module.exports = ReactComponent;
<ide><path>src/core/ReactCompositeComponent.js
<ide> var SpecPolicy = keyMirror({
<ide> DEFINE_MANY_MERGED: null
<ide> });
<ide>
<add>
<add>var injectedMixins = [];
<add>
<ide> /**
<ide> * Composite components are higher-level components that compose other composite
<ide> * or native components.
<ide> var ReactCompositeComponent = {
<ide> Constructor.ConvenienceConstructor = ConvenienceConstructor;
<ide> ConvenienceConstructor.originalSpec = spec;
<ide>
<add> injectedMixins.forEach(
<add> mixSpecIntoComponent.bind(null, ConvenienceConstructor)
<add> );
<add>
<ide> mixSpecIntoComponent(ConvenienceConstructor, spec);
<ide>
<ide> invariant(
<ide> var ReactCompositeComponent = {
<ide> return ConvenienceConstructor;
<ide> },
<ide>
<del> isValidClass: isValidClass
<add> isValidClass: isValidClass,
<add>
<add> injection: {
<add> injectMixin: function(mixin) {
<add> injectedMixins.push(mixin);
<add> }
<add> }
<ide> };
<ide>
<ide> module.exports = ReactCompositeComponent;
<ide><path>src/core/ReactInjection.js
<ide>
<ide> var DOMProperty = require('DOMProperty');
<ide> var EventPluginHub = require('EventPluginHub');
<add>var ReactComponent = require('ReactComponent');
<add>var ReactCompositeComponent = require('ReactCompositeComponent');
<ide> var ReactDOM = require('ReactDOM');
<ide> var ReactEventEmitter = require('ReactEventEmitter');
<ide> var ReactPerf = require('ReactPerf');
<ide> var ReactRootIndex = require('ReactRootIndex');
<ide> var ReactUpdates = require('ReactUpdates');
<ide>
<ide> var ReactInjection = {
<add> Component: ReactComponent.injection,
<add> CompositeComponent: ReactCompositeComponent.injection,
<ide> DOMProperty: DOMProperty.injection,
<ide> EventPluginHub: EventPluginHub.injection,
<ide> DOM: ReactDOM.injection, | 15 |
Python | Python | add regression test for #891 | 5712da6095594360be9010b0fe6b85606ec1e2d0 | <ide><path>spacy/tests/regression/test_issue891.py
<add># coding: utf8
<add>from __future__ import unicode_literals
<add>
<add>import pytest
<add>
<add>@pytest.mark.xfail
<add>@pytest.mark.parametrize('text', ["want/need"])
<add>def test_issue891(en_tokenizer, text):
<add> """Test that / infixes are split correctly."""
<add> tokens = en_tokenizer(text)
<add> assert len(tokens) == 3
<add> assert tokens[1].text == "/" | 1 |
PHP | PHP | update email.blade.php | afb46417b352e6b6693af591497fe2752f3d83af | <ide><path>src/Illuminate/Notifications/resources/views/email.blade.php
<ide> {{-- Action Button --}}
<ide> @isset($actionText)
<ide> <?php
<del> switch ($level) {
<del> case 'success':
<del> case 'error':
<del> $color = $level;
<del> break;
<del> default:
<del> $color = 'primary';
<del> }
<add> $color = match ($level) {
<add> 'success', 'error' => $level,
<add> default => 'primary',
<add> };
<ide> ?>
<ide> @component('mail::button', ['url' => $actionUrl, 'color' => $color])
<ide> {{ $actionText }} | 1 |
Javascript | Javascript | improve nexttick performance | 34961c7b5fe8b2cf1722668666a7adcce3ab419c | <ide><path>benchmark/process/next-tick-breadth-args.js
<ide>
<ide> const common = require('../common.js');
<ide> const bench = common.createBenchmark(main, {
<del> n: [4e6]
<add> n: [1e7]
<ide> });
<ide>
<ide> function main({ n }) {
<ide><path>benchmark/process/next-tick-breadth.js
<ide>
<ide> const common = require('../common.js');
<ide> const bench = common.createBenchmark(main, {
<del> n: [4e6]
<add> n: [1e7]
<ide> });
<ide>
<ide> function main({ n }) {
<ide><path>benchmark/process/next-tick-depth-args.js
<ide>
<ide> const common = require('../common.js');
<ide> const bench = common.createBenchmark(main, {
<del> n: [12e6]
<add> n: [7e6]
<ide> });
<ide>
<ide> function main({ n }) {
<ide><path>benchmark/process/next-tick-depth.js
<ide> 'use strict';
<ide> const common = require('../common.js');
<ide> const bench = common.createBenchmark(main, {
<del> n: [12e6]
<add> n: [7e6]
<ide> });
<ide>
<ide> function main({ n }) {
<ide><path>benchmark/process/next-tick-exec-args.js
<ide> 'use strict';
<ide> const common = require('../common.js');
<ide> const bench = common.createBenchmark(main, {
<del> n: [5e6]
<add> n: [4e6]
<ide> });
<ide>
<ide> function main({ n }) {
<ide><path>benchmark/process/next-tick-exec.js
<ide> 'use strict';
<ide> const common = require('../common.js');
<ide> const bench = common.createBenchmark(main, {
<del> n: [5e6]
<add> n: [4e6]
<ide> });
<ide>
<ide> function main({ n }) {
<ide><path>lib/internal/fixed_queue.js
<ide> module.exports = class FixedQueue {
<ide> }
<ide>
<ide> shift() {
<del> const { tail } = this;
<add> const tail = this.tail;
<ide> const next = tail.shift();
<ide> if (tail.isEmpty() && tail.next !== null) {
<ide> // If there is another queue, it forms the new tail.
<ide><path>lib/internal/process/task_queues.js
<ide> function processTicksAndRejections() {
<ide>
<ide> try {
<ide> const callback = tock.callback;
<del> if (tock.args === undefined)
<add> if (tock.args === undefined) {
<ide> callback();
<del> else
<del> callback(...tock.args);
<add> } else {
<add> const args = tock.args;
<add> switch (args.length) {
<add> case 1: callback(args[0]); break;
<add> case 2: callback(args[0], args[1]); break;
<add> case 3: callback(args[0], args[1], args[2]); break;
<add> case 4: callback(args[0], args[1], args[2], args[3]); break;
<add> default: callback(...args);
<add> }
<add> }
<ide> } finally {
<ide> if (destroyHooksExist())
<ide> emitDestroy(asyncId);
<ide> function processTicksAndRejections() {
<ide> setHasRejectionToWarn(false);
<ide> }
<ide>
<del>class TickObject {
<del> constructor(callback, args) {
<del> this.callback = callback;
<del> this.args = args;
<del>
<del> const asyncId = newAsyncId();
<del> const triggerAsyncId = getDefaultTriggerAsyncId();
<del> this[async_id_symbol] = asyncId;
<del> this[trigger_async_id_symbol] = triggerAsyncId;
<del>
<del> if (initHooksExist()) {
<del> emitInit(asyncId, 'TickObject', triggerAsyncId, this);
<del> }
<del> }
<del>}
<del>
<ide> // `nextTick()` will not enqueue any callback when the process is about to
<ide> // exit since the callback would not have a chance to be executed.
<ide> function nextTick(callback) {
<ide> function nextTick(callback) {
<ide>
<ide> if (queue.isEmpty())
<ide> setHasTickScheduled(true);
<del> queue.push(new TickObject(callback, args));
<add> const asyncId = newAsyncId();
<add> const triggerAsyncId = getDefaultTriggerAsyncId();
<add> const tickObject = {
<add> [async_id_symbol]: asyncId,
<add> [trigger_async_id_symbol]: triggerAsyncId,
<add> callback,
<add> args
<add> };
<add> if (initHooksExist())
<add> emitInit(asyncId, 'TickObject', triggerAsyncId, tickObject);
<add> queue.push(tickObject);
<ide> }
<ide>
<ide> let AsyncResource; | 8 |
Python | Python | add underscore class | 1289129fd92da28a0d3f55acf65ec6287eea7086 | <ide><path>spacy/tokens/underscore.py
<add>class Undercore(object):
<add> doc_extensions = {}
<add> span_extensions = {}
<add> token_extensions = {}
<add>
<add> def __init__(self, obj, start=None, end=None):
<add> object.__setattr__(self, '_obj', obj)
<add> # Assumption is that for doc values, _start and _end will both be None
<add> # Span will set non-None values for _start and _end
<add> # Token will have _start be non-None, _end be None
<add> # This lets us key everything into the doc.user_data dictionary,
<add> # (see _get_key), and lets us use a single Underscore class.
<add> object.__setattr__(self, '_doc', obj.doc)
<add> object.__setattr__(self, '_start', start)
<add> object.__setattr__(self, '_end', start)
<add>
<add> def __getattr__(self, name):
<add> if name not in self.__class__.extensions:
<add> raise AttributeError(name)
<add> default, method, getter, setter = self.__class__.extensions[name]
<add> if getter is not None:
<add> return getter(self._obj)
<add> elif method is not None:
<add> return method)
<add> else:
<add> return self._doc.user_data.get(self._get_key(name), default)
<add>
<add> def __setattr__(self, name, value):
<add> if name not in self.__class__.extensions:
<add> raise AttributeError(name)
<add> default, method, getter, setter = self.__class__.extensions[name]
<add> if setter is not None:
<add> return setter(self._obj, value)
<add> else:
<add> self._doc.user_data[self._get_key(name)] = value
<add>
<add> def _get_key(self, name):
<add> return ('._.', name, self._start, self._end) | 1 |
Ruby | Ruby | add rubocop test | c1b00297e0556197a21155a44876e3422e8f4b1e | <ide><path>Library/Homebrew/test/cask/cmd/style_spec.rb
<ide>
<ide> it_behaves_like "a command that handles invalid options"
<ide>
<add> describe ".rubocop" do
<add> subject { described_class.rubocop(cask_path) }
<add>
<add> around do |example|
<add> FileUtils.ln_s HOMEBREW_LIBRARY_PATH, HOMEBREW_LIBRARY/"Homebrew"
<add> FileUtils.ln_s HOMEBREW_LIBRARY_PATH.parent/".rubocop_cask.yml", HOMEBREW_LIBRARY/".rubocop_cask.yml"
<add> FileUtils.ln_s HOMEBREW_LIBRARY_PATH.parent/".rubocop_shared.yml", HOMEBREW_LIBRARY/".rubocop_shared.yml"
<add>
<add> example.run
<add> ensure
<add> FileUtils.rm_f HOMEBREW_LIBRARY/"Homebrew"
<add> FileUtils.rm_f HOMEBREW_LIBRARY/".rubocop_cask.yml"
<add> FileUtils.rm_f HOMEBREW_LIBRARY/".rubocop_shared.yml"
<add> end
<add>
<add> before do
<add> allow(Homebrew).to receive(:install_bundler_gems!)
<add> end
<add>
<add> context "with a valid Cask" do
<add> let(:cask_path) do
<add> Pathname.new("#{HOMEBREW_LIBRARY}/Homebrew/test/support/fixtures/cask/Casks/version-latest.rb")
<add> end
<add>
<add> it "returns true" do
<add> expect(subject.success?).to be true
<add> end
<add> end
<add> end
<add>
<ide> describe "#cask_paths" do
<ide> subject { cli.cask_paths }
<ide> | 1 |
PHP | PHP | add tests for skip() overflow | 2e8b39159833381d0491207d76d44f899f170ce7 | <ide><path>tests/TestCase/Collection/CollectionTest.php
<ide> public function testSkip()
<ide> $collection = new Collection([1, 2, 3, 4, 5]);
<ide> $this->assertEquals([3, 4, 5], $collection->skip(2)->toList());
<ide>
<add> $this->assertEquals([1, 2, 3, 4, 5], $collection->skip(0)->toList());
<add> $this->assertEquals([4, 5], $collection->skip(3)->toList());
<ide> $this->assertEquals([5], $collection->skip(4)->toList());
<ide> }
<ide>
<add> /**
<add> * Test skip() with an overflow
<add> *
<add> * @return void
<add> */
<add> public function testSkipOverflow()
<add> {
<add> $collection = new Collection([1, 2, 3]);
<add> $this->assertEquals([], $collection->skip(3)->toArray());
<add> $this->assertEquals([], $collection->skip(4)->toArray());
<add> }
<add>
<ide> /**
<ide> * Tests the skip() method with a traversable non-iterator
<ide> * | 1 |
Text | Text | replace old static path by public | typo | 7b22bb559b2d91375bf44b2b3964c9b833c16c5e | <ide><path>examples/with-firebase-cloud-messaging/README.md
<ide> yarn create next-app --example with-firebase-cloud-messaging with-firebase-cloud
<ide>
<ide> ## Set your send id
<ide>
<del>set your `messagingSenderId` in `static/firebase-messaging-sw.js` and `utils/webPush.js`
<add>set your `messagingSenderId` in `public/firebase-messaging-sw.js` and `utils/webPush.js`
<ide>
<ide> Deploy it to the cloud with [Vercel](https://vercel.com/new?utm_source=github&utm_medium=readme&utm_campaign=next-example) ([Documentation](https://nextjs.org/docs/deployment)).
<ide> | 1 |
Javascript | Javascript | add bitt wallet to showcase | 0f62dcecf5941d415e2e8afa542b10a607a3416c | <ide><path>website/src/react-native/showcase.js
<ide> var apps = [
<ide> icon: 'http://a5.mzstatic.com/us/r30/Purple7/v4/c1/9a/3f/c19a3f82-ecc3-d60b-f983-04acc203705f/icon175x175.jpeg',
<ide> link: 'https://itunes.apple.com/us/app/bionic-estore/id994537615?mt=8',
<ide> author: 'Digidemon',
<add> },
<add> {
<add> name: 'Bitt Wallet',
<add> icon: 'http://a4.mzstatic.com/us/r30/Purple69/v4/5b/00/34/5b003497-cc85-a0d0-0d3e-4fb3bc6f95cd/icon175x175.jpeg',
<add> link: 'https://itunes.apple.com/us/app/bitt-wallet/id1081954916?mt=8',
<add> author: 'Bitt',
<ide> },
<ide> {
<ide> name: 'breathe Meditation Timer', | 1 |
Ruby | Ruby | eliminate formula_meta_files constant | fcacb25cd5ca92b12a19a92b5e1a562d82392aec | <ide><path>Library/Homebrew/cmd/list.rb
<add>require "metafiles"
<add>
<ide> module Homebrew extend self
<ide> def list
<ide>
<ide> def initialize path
<ide> else
<ide> print_dir pn
<ide> end
<del> elsif FORMULA_META_FILES.should_list? pn.basename.to_s
<add> elsif Metafiles.list?(pn.basename.to_s)
<ide> puts pn
<ide> end
<ide> end
<ide><path>Library/Homebrew/extend/pathname.rb
<ide> require 'pathname'
<ide> require 'mach'
<ide> require 'resource'
<add>require 'metafiles'
<ide>
<ide> # we enhance pathname to make our code more readable
<ide> class Pathname
<ide> def install_metafiles from=nil
<ide>
<ide> from.children.each do |p|
<ide> next if p.directory?
<del> next unless FORMULA_META_FILES.should_copy? p
<add> next unless Metafiles.copy?(p)
<ide> # Some software symlinks these files (see help2man.rb)
<ide> filename = p.resolved_path
<ide> # Some software links metafiles together, so by the time we iterate to one of them
<ide><path>Library/Homebrew/global.rb
<ide> module Homebrew extend self
<ide> alias_method :failed?, :failed
<ide> end
<ide>
<del>require 'metafiles'
<del>FORMULA_META_FILES = Metafiles.new
<ide> ISSUES_URL = "https://github.com/Homebrew/homebrew/wiki/troubleshooting"
<ide> HOMEBREW_PULL_OR_COMMIT_URL_REGEX = 'https:\/\/github.com\/(\w+)\/homebrew(-\w+)?\/(pull\/(\d+)|commit\/\w{4,40})'
<ide>
<ide><path>Library/Homebrew/metafiles.rb
<ide> class Metafiles
<ide> news notes notice readme todo
<ide> ]
<ide>
<del> def should_list? file
<del> return false if %w[.DS_Store INSTALL_RECEIPT.json].include? file
<add> def self.list?(file)
<add> return false if %w[.DS_Store INSTALL_RECEIPT.json].include?(file)
<ide> !copy?(file)
<ide> end
<ide>
<del> def should_copy?(path)
<add> def self.copy?(path)
<ide> path = path.to_s.downcase
<ide> ext = File.extname(path)
<ide> | 4 |
Java | Java | escape quotes in filename | 41f40c6c229d3b4f768718f1ec229d8f0ad76d76 | <ide><path>spring-web/src/main/java/org/springframework/http/ContentDisposition.java
<ide> public interface Builder {
<ide> Builder name(String name);
<ide>
<ide> /**
<del> * Set the value of the {@literal filename} parameter.
<add> * Set the value of the {@literal filename} parameter. The given
<add> * filename will be formatted as quoted-string, as defined in RFC 2616,
<add> * section 2.2, and any quote characters within the filename value will
<add> * be escaped with a backslash, e.g. {@code "foo\"bar.txt"} becomes
<add> * {@code "foo\\\"bar.txt"}.
<ide> */
<ide> Builder filename(String filename);
<ide>
<ide> public Builder name(String name) {
<ide>
<ide> @Override
<ide> public Builder filename(String filename) {
<del> this.filename = filename;
<add> Assert.hasText(filename, "No filename");
<add> this.filename = escapeQuotationMarks(filename);
<ide> return this;
<ide> }
<ide>
<add> private static String escapeQuotationMarks(String filename) {
<add> if (filename.indexOf('"') == -1) {
<add> return filename;
<add> }
<add> boolean escaped = false;
<add> StringBuilder sb = new StringBuilder();
<add> for (char c : filename.toCharArray()) {
<add> sb.append((c == '"' && !escaped) ? "\\\"" : c);
<add> escaped = (!escaped && c == '\\');
<add> }
<add> return sb.toString();
<add> }
<add>
<ide> @Override
<ide> public Builder filename(String filename, Charset charset) {
<ide> this.filename = filename;
<ide><path>spring-web/src/test/java/org/springframework/http/ContentDispositionTests.java
<ide> import java.nio.charset.StandardCharsets;
<ide> import java.time.ZonedDateTime;
<ide> import java.time.format.DateTimeFormatter;
<add>import java.util.function.BiConsumer;
<ide>
<ide> import org.junit.jupiter.api.Test;
<ide>
<ide> import static org.assertj.core.api.Assertions.assertThat;
<ide> import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
<add>import static org.springframework.http.ContentDisposition.builder;
<ide>
<ide> /**
<ide> * Unit tests for {@link ContentDisposition}
<ide> public class ContentDispositionTests {
<ide> @Test
<ide> public void parse() {
<ide> assertThat(parse("form-data; name=\"foo\"; filename=\"foo.txt\"; size=123"))
<del> .isEqualTo(ContentDisposition.builder("form-data")
<add> .isEqualTo(builder("form-data")
<ide> .name("foo")
<ide> .filename("foo.txt")
<ide> .size(123L)
<ide> public void parse() {
<ide> @Test
<ide> public void parseFilenameUnquoted() {
<ide> assertThat(parse("form-data; filename=unquoted"))
<del> .isEqualTo(ContentDisposition.builder("form-data")
<add> .isEqualTo(builder("form-data")
<ide> .filename("unquoted")
<ide> .build());
<ide> }
<ide>
<ide> @Test // SPR-16091
<ide> public void parseFilenameWithSemicolon() {
<ide> assertThat(parse("attachment; filename=\"filename with ; semicolon.txt\""))
<del> .isEqualTo(ContentDisposition.builder("attachment")
<add> .isEqualTo(builder("attachment")
<ide> .filename("filename with ; semicolon.txt")
<ide> .build());
<ide> }
<ide>
<ide> @Test
<ide> public void parseEncodedFilename() {
<ide> assertThat(parse("form-data; name=\"name\"; filename*=UTF-8''%E4%B8%AD%E6%96%87.txt"))
<del> .isEqualTo(ContentDisposition.builder("form-data")
<add> .isEqualTo(builder("form-data")
<ide> .name("name")
<ide> .filename("中文.txt", StandardCharsets.UTF_8)
<ide> .build());
<ide> public void parseEncodedFilename() {
<ide> @Test // gh-24112
<ide> public void parseEncodedFilenameWithPaddedCharset() {
<ide> assertThat(parse("attachment; filename*= UTF-8''some-file.zip"))
<del> .isEqualTo(ContentDisposition.builder("attachment")
<add> .isEqualTo(builder("attachment")
<ide> .filename("some-file.zip", StandardCharsets.UTF_8)
<ide> .build());
<ide> }
<ide>
<ide> @Test
<ide> public void parseEncodedFilenameWithoutCharset() {
<ide> assertThat(parse("form-data; name=\"name\"; filename*=test.txt"))
<del> .isEqualTo(ContentDisposition.builder("form-data")
<add> .isEqualTo(builder("form-data")
<ide> .name("name")
<ide> .filename("test.txt")
<ide> .build());
<ide> public void parseEncodedFilenameWithInvalidName() {
<ide>
<ide> @Test // gh-23077
<ide> public void parseWithEscapedQuote() {
<del> assertThat(parse("form-data; name=\"file\"; filename=\"\\\"The Twilight Zone\\\".txt\"; size=123"))
<del> .isEqualTo(ContentDisposition.builder("form-data")
<del> .name("file")
<del> .filename("\\\"The Twilight Zone\\\".txt")
<del> .size(123L)
<del> .build());
<add>
<add> BiConsumer<String, String> tester = (description, filename) -> {
<add> assertThat(parse("form-data; name=\"file\"; filename=\"" + filename + "\"; size=123"))
<add> .as(description)
<add> .isEqualTo(builder("form-data").name("file").filename(filename).size(123L).build());
<add> };
<add>
<add> tester.accept("Escaped quotes should be ignored",
<add> "\\\"The Twilight Zone\\\".txt");
<add>
<add> tester.accept("Escaped quotes preceded by escaped backslashes should be ignored",
<add> "\\\\\\\"The Twilight Zone\\\\\\\".txt");
<add>
<add> tester.accept("Escaped backslashes should not suppress quote",
<add> "The Twilight Zone \\\\");
<add>
<add> tester.accept("Escaped backslashes should not suppress quote",
<add> "The Twilight Zone \\\\\\\\");
<ide> }
<ide>
<ide> @Test
<ide> public void parseWithExtraSemicolons() {
<ide> assertThat(parse("form-data; name=\"foo\";; ; filename=\"foo.txt\"; size=123"))
<del> .isEqualTo(ContentDisposition.builder("form-data")
<add> .isEqualTo(builder("form-data")
<ide> .name("foo")
<ide> .filename("foo.txt")
<ide> .size(123L)
<ide> public void parseDates() {
<ide> "creation-date=\"" + creationTime.format(formatter) + "\"; " +
<ide> "modification-date=\"" + modificationTime.format(formatter) + "\"; " +
<ide> "read-date=\"" + readTime.format(formatter) + "\"")).isEqualTo(
<del> ContentDisposition.builder("attachment")
<add> builder("attachment")
<ide> .creationDate(creationTime)
<ide> .modificationDate(modificationTime)
<ide> .readDate(readTime)
<ide> public void parseIgnoresInvalidDates() {
<ide> "creation-date=\"-1\"; " +
<ide> "modification-date=\"-1\"; " +
<ide> "read-date=\"" + readTime.format(formatter) + "\"")).isEqualTo(
<del> ContentDisposition.builder("attachment")
<add> builder("attachment")
<ide> .readDate(readTime)
<ide> .build());
<ide> }
<ide> private static ContentDisposition parse(String input) {
<ide> @Test
<ide> public void format() {
<ide> assertThat(
<del> ContentDisposition.builder("form-data")
<add> builder("form-data")
<ide> .name("foo")
<ide> .filename("foo.txt")
<ide> .size(123L)
<ide> public void format() {
<ide> @Test
<ide> public void formatWithEncodedFilename() {
<ide> assertThat(
<del> ContentDisposition.builder("form-data")
<add> builder("form-data")
<ide> .name("name")
<ide> .filename("中文.txt", StandardCharsets.UTF_8)
<ide> .build().toString())
<ide> public void formatWithEncodedFilename() {
<ide> @Test
<ide> public void formatWithEncodedFilenameUsingUsAscii() {
<ide> assertThat(
<del> ContentDisposition.builder("form-data")
<add> builder("form-data")
<ide> .name("name")
<ide> .filename("test.txt", StandardCharsets.US_ASCII)
<ide> .build()
<ide> .toString())
<ide> .isEqualTo("form-data; name=\"name\"; filename=\"test.txt\"");
<ide> }
<ide>
<add> @Test // gh-24220
<add> public void formatWithFilenameWithQuotes() {
<add>
<add> BiConsumer<String, String> tester = (input, output) -> {
<add> assertThat(builder("form-data").filename(input).build().toString())
<add> .isEqualTo("form-data; filename=\"" + output + "\"");
<add> };
<add>
<add> String filename = "\"foo.txt";
<add> tester.accept(filename, "\\" + filename);
<add>
<add> filename = "\\\"foo.txt";
<add> tester.accept(filename, filename);
<add>
<add> filename = "\\\\\"foo.txt";
<add> tester.accept(filename, "\\" + filename);
<add>
<add> filename = "\\\\\\\"foo.txt";
<add> tester.accept(filename, filename);
<add>
<add> filename = "\\\\\\\\\"foo.txt";
<add> tester.accept(filename, "\\" + filename);
<add>
<add> tester.accept("\"\"foo.txt", "\\\"\\\"foo.txt");
<add> tester.accept("\"\"\"foo.txt", "\\\"\\\"\\\"foo.txt");
<add> }
<add>
<ide> @Test
<ide> public void formatWithEncodedFilenameUsingInvalidCharset() {
<ide> assertThatIllegalArgumentException().isThrownBy(() ->
<del> ContentDisposition.builder("form-data")
<add> builder("form-data")
<ide> .name("name")
<ide> .filename("test.txt", StandardCharsets.UTF_16)
<ide> .build() | 2 |
Java | Java | make two separate yoga targets for qe | af9d6479e541bd163e2189fabbcde78613c7a751 | <ide><path>ReactAndroid/src/main/java/com/facebook/yoga/YogaConfig.java
<ide> public class YogaConfig {
<ide> public static int SPACING_TYPE = 1;
<ide>
<ide> static {
<del> SoLoader.loadLibrary("yoga");
<add> if (YogaConstants.shouldUseFastMath) {
<add> SoLoader.loadLibrary("yogafastmath");
<add> } else {
<add> SoLoader.loadLibrary("yoga");
<add> }
<ide> }
<ide>
<ide> long mNativePointer;
<ide><path>ReactAndroid/src/main/java/com/facebook/yoga/YogaConstants.java
<ide> public class YogaConstants {
<ide>
<ide> public static final float UNDEFINED = Float.NaN;
<ide>
<add> public static boolean shouldUseFastMath = false;
<add>
<ide> public static boolean isUndefined(float value) {
<ide> return Float.compare(value, UNDEFINED) == 0;
<ide> }
<ide><path>ReactAndroid/src/main/java/com/facebook/yoga/YogaNode.java
<ide> public class YogaNode implements Cloneable {
<ide>
<ide> static {
<del> SoLoader.loadLibrary("yoga");
<add> if (YogaConstants.shouldUseFastMath) {
<add> SoLoader.loadLibrary("yogafastmath");
<add> } else {
<add> SoLoader.loadLibrary("yoga");
<add> }
<ide> }
<ide>
<ide> /** | 3 |
Text | Text | expand guide for power supply unit | 78c83743577a862b351d121fcbfa7fe518b3a2da | <ide><path>guide/english/computer-hardware/power-supply/index.md
<ide> title: Power Supply
<ide> ---
<ide> ## Power Supply
<ide>
<del>A Power Supply Unit (PSU) supplies power to a computer. It converts AC power into steady low-voltage DC power for the internal components. A power supply is required in order for a computer to operate properly and it's wattage must be matched appropriately to all the components inside the computer.
<add>A Power Supply Unit (PSU) supplies power to a computer. It converts AC power into steady low-voltage DC power for the internal components. A power supply is required in order for a computer to operate properly and it's wattage must be matched appropriately to all the components inside the computer. It also regulates overheating by controlling the voltage. Depending on the model of power supply, voltage control can either be manual or automatic.
<ide>
<add>Like the CPU, or RAM, the PSU is a necessary component to the PC because without it nothing within the machine would function. Arguably may be one of the more crucial parts to research when assembling custom computers because of this fact.
<add>
<add>## Description
<add>
<add>Is typically seen as a metal box either in the top or bottom, most posterior portion of a PC case. It has a bunch of cables streaming out of it to various parts of the computer. These cables can be detachable or integrated depending on the model of PSU. Typically it's wattage (e.g 600w) is relative to the size of the PSU, and is an important factor to keep in mind when considering the demand of your machine vs how much space is inside the case.
<add>
<add>## Standard types of Cables
<add>
<add>With every modern power supply you should have:
<add>- 1x Large cable for motherboard
<add>- 1x Small cable for motherboard, typically powers the CPU
<add>- 1x Small cable to power the GPU
<add>- 2x or more small cables to power hard drives, optical drives, and accessory parts.
<add>
<add>## MISC Information
<add>
<add>Because the power supply unit is the first component between the electric outlet and your other PC parts, they are at the highest risk of damage from power surges or spikes. If your machine is situated in an area where these things are common, it would be wise to invest in a surge protector or similar piece of hardware to prevent that kind of damage.
<add>Additionally, the internal parts of a PSU are usually not user serviceable. For your safety, it is wise to never open a power supply unit without proper equipment and/or certifications.
<ide>
<del>A PSU is usually not user serviceable. For your safety, it is wise to never open a power supply unit.
<ide> #### More Information:
<ide> <!-- Please add any articles you think might be helpful to read before writing the article -->
<ide> * <a href='https://en.wikipedia.org/wiki/Power_supply_unit_(computer)' target='_blank' rel='nofollow'>Power Supply</a> | 1 |
PHP | PHP | fix more coding standards | 82d8df9c3ef35da127f8c4655041f4a495660eb2 | <ide><path>lib/Cake/Test/Case/Configure/IniReaderTest.php
<ide> class IniReaderTest extends CakeTestCase {
<ide> */
<ide> public function setUp() {
<ide> parent::setUp();
<del> $this->path = CAKE . 'Test' . DS . 'test_app' . DS . 'Config'. DS;
<add> $this->path = CAKE . 'Test' . DS . 'test_app' . DS . 'Config' . DS;
<ide> }
<ide>
<ide> /**
<ide><path>lib/Cake/Test/Case/Configure/PhpReaderTest.php
<ide> App::uses('PhpReader', 'Configure');
<ide>
<ide> class PhpReaderTest extends CakeTestCase {
<add>
<ide> /**
<ide> * setup
<ide> *
<ide> * @return void
<ide> */
<ide> public function setUp() {
<ide> parent::setUp();
<del> $this->path = CAKE . 'Test' . DS . 'test_app' . DS . 'Config'. DS;
<add> $this->path = CAKE . 'Test' . DS . 'test_app' . DS . 'Config' . DS;
<ide> }
<ide>
<ide> /**
<ide><path>lib/Cake/basics.php
<ide> function sortByKey(&$array, $sortby, $order = 'asc', $type = SORT_NUMERIC) {
<ide> }
<ide> return $out;
<ide> }
<add>
<ide> }
<ide>
<ide> /**
<ide> function convertSlash($string) {
<ide> $string = str_replace('/', '_', $string);
<ide> return $string;
<ide> }
<del> | 3 |
PHP | PHP | add test for insertmulti with id in the last spot | 5210f831c88a54e90195dfe570bf7f92a7ec25b6 | <ide><path>lib/Cake/Test/Case/Model/Datasource/DboSourceTest.php
<ide> public function testLimit() {
<ide> $this->assertNotContains($scientificNotation, $result);
<ide> }
<ide>
<add>/**
<add> * Test insertMulti with id position.
<add> *
<add> * @return void
<add> */
<add> public function testInsertMultiId() {
<add> $this->loadFixtures('Article');
<add> $Article = ClassRegistry::init('Article');
<add> $db = $Article->getDatasource();
<add> $datetime = date('Y-m-d H:i:s');
<add> $data = array(
<add> array(
<add> 'user_id' => 1,
<add> 'title' => 'test',
<add> 'body' => 'test',
<add> 'published' => 'N',
<add> 'created' => $datetime,
<add> 'updated' => $datetime,
<add> 'id' => 100,
<add> ),
<add> array(
<add> 'user_id' => 1,
<add> 'title' => 'test 101',
<add> 'body' => 'test 101',
<add> 'published' => 'N',
<add> 'created' => $datetime,
<add> 'updated' => $datetime,
<add> 'id' => 101,
<add> )
<add> );
<add> $result = $db->insertMulti('articles', array_keys($data[0]), $data);
<add> $this->assertTrue($result, 'Data was saved');
<add>
<add> $data = array(
<add> array(
<add> 'id' => 102,
<add> 'user_id' => 1,
<add> 'title' => 'test',
<add> 'body' => 'test',
<add> 'published' => 'N',
<add> 'created' => $datetime,
<add> 'updated' => $datetime,
<add> ),
<add> array(
<add> 'id' => 103,
<add> 'user_id' => 1,
<add> 'title' => 'test 101',
<add> 'body' => 'test 101',
<add> 'published' => 'N',
<add> 'created' => $datetime,
<add> 'updated' => $datetime,
<add> )
<add> );
<add>
<add> $result = $db->insertMulti('articles', array_keys($data[0]), $data);
<add> $this->assertTrue($result, 'Data was saved');
<add> }
<ide> } | 1 |
Text | Text | add the rfc template for future rfcs | 48584e9f9fb737ec992b7f01386ef4eb85c98e7b | <ide><path>docs/rfcs/000-template.md
<add># Feature title
<add>
<add>## Status
<add>
<add>Proposed
<add>
<add>## Summary
<add>
<add>One paragraph explanation of the feature.
<add>
<add>## Motivation
<add>
<add>Why are we doing this? What use cases does it support? What is the expected outcome?
<add>
<add>## Explanation
<add>
<add>Explain the proposal as if it was already implemented and you were describing it to an Atom user. That generally means:
<add>
<add>- Introducing new named concepts.
<add>- Explaining the feature largely in terms of examples.
<add>- Explaining any changes to existing workflows.
<add>
<add>## Drawbacks
<add>
<add>Why should we *not* do this?
<add>
<add>## Rationale and alternatives
<add>
<add>- Why is this approach the best in the space of possible approaches?
<add>- What other approaches have been considered and what is the rationale for not choosing them?
<add>- What is the impact of not doing this?
<add>
<add>## Unresolved questions
<add>
<add>- What unresolved questions do you expect to resolve through the RFC process before this gets merged?
<add>- What unresolved questions do you expect to resolve through the implementation of this feature before it is released in a new version of Atom?
<add>- What related issues do you consider out of scope for this RFC that could be addressed in the future independently of the solution that comes out of this RFC? | 1 |
PHP | PHP | remove unused fixture files | 3defea233df79351e56345f88dab326a09957bac | <ide><path>tests/Fixture/BinaryTestsFixture.php
<del><?php
<del>/**
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since 1.2.0
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Short description for class.
<del> *
<del> */
<del>class BinaryTestsFixture extends TestFixture {
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'id' => ['type' => 'integer'],
<del> 'data' => ['type' => 'binary', 'length' => 300],
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]]
<del> );
<del>
<del>/**
<del> * records property
<del> *
<del> * @var array
<del> */
<del> public $records = array();
<del>}
<ide><path>tests/Fixture/CategoryThreadsFixture.php
<del><?php
<del>/**
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since 1.2.0
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Short description for class.
<del> *
<del> */
<del>class CategoryThreadsFixture extends TestFixture {
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'id' => ['type' => 'integer'],
<del> 'parent_id' => ['type' => 'integer', 'null' => false],
<del> 'name' => ['type' => 'string', 'null' => false],
<del> 'created' => 'datetime',
<del> 'updated' => 'datetime',
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]]
<del> );
<del>
<del>/**
<del> * records property
<del> *
<del> * @var array
<del> */
<del> public $records = array(
<del> array('parent_id' => 0, 'name' => 'Category 1', 'created' => '2007-03-18 15:30:23', 'updated' => '2007-03-18 15:32:31'),
<del> array('parent_id' => 1, 'name' => 'Category 1.1', 'created' => '2007-03-18 15:30:23', 'updated' => '2007-03-18 15:32:31'),
<del> array('parent_id' => 2, 'name' => 'Category 1.1.1', 'created' => '2007-03-18 15:30:23', 'updated' => '2007-03-18 15:32:31'),
<del> array('parent_id' => 3, 'name' => 'Category 1.1.2', 'created' => '2007-03-18 15:30:23', 'updated' => '2007-03-18 15:32:31'),
<del> array('parent_id' => 4, 'name' => 'Category 1.1.1.1', 'created' => '2007-03-18 15:30:23', 'updated' => '2007-03-18 15:32:31'),
<del> array('parent_id' => 5, 'name' => 'Category 2', 'created' => '2007-03-18 15:30:23', 'updated' => '2007-03-18 15:32:31'),
<del> array('parent_id' => 6, 'name' => 'Category 2.1', 'created' => '2007-03-18 15:30:23', 'updated' => '2007-03-18 15:32:31')
<del> );
<del>}
<ide><path>tests/Fixture/DataTestsFixture.php
<del><?php
<del>/**
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since 1.2.0
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Short description for class.
<del> *
<del> */
<del>class DataTestsFixture extends TestFixture {
<del>
<del>/**
<del> * Fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'id' => ['type' => 'integer'],
<del> 'count' => ['type' => 'integer', 'default' => 0],
<del> 'float' => ['type' => 'float', 'default' => 0],
<del> 'created' => ['type' => 'datetime', 'default' => null],
<del> 'updated' => ['type' => 'datetime', 'default' => null],
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]]
<del> );
<del>
<del>/**
<del> * Records property
<del> *
<del> * @var array
<del> */
<del> public $records = array(
<del> array(
<del> 'count' => 2,
<del> 'float' => 2.4,
<del> 'created' => '2010-09-06 12:28:00',
<del> 'updated' => '2010-09-06 12:28:00'
<del> )
<del> );
<del>}
<ide><path>tests/Fixture/DatatypesFixture.php
<del><?php
<del>/**
<del> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice.
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://cakephp.org CakePHP(tm) Project
<del> * @since 1.2.0
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Short description for class.
<del> *
<del> */
<del>class DatatypesFixture extends TestFixture {
<del>
<del>/**
<del> * Fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'id' => ['type' => 'integer', 'null' => false],
<del> 'decimal_field' => ['type' => 'decimal', 'length' => '6', 'precision' => 3, 'default' => '0.000'],
<del> 'float_field' => ['type' => 'float', 'length' => '5,2', 'null' => false, 'default' => null],
<del> 'huge_int' => ['type' => 'biginteger'],
<del> 'bool' => ['type' => 'boolean', 'null' => false, 'default' => false],
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]]
<del> );
<del>
<del>/**
<del> * Records property
<del> *
<del> * @var array
<del> */
<del> public $records = [
<del> ['float_field' => 42.23, 'huge_int' => '1234567891234567891', 'bool' => 0],
<del> ];
<del>
<del>} | 4 |
Text | Text | fix spelling error | d976ac56b0b108a65eeb67eb812e700df4addc72 | <ide><path>docs/api-guide/requests.md
<ide> You won't typically need to access this property.
<ide>
<ide> ---
<ide>
<del>**Note:** You may see a `WrappedAttributeError` raised when calling the `.user` or `.auth` properties. These errors originate from an authenticator as a standard `AttributeError`, however it's necessary that they be re-raised as a different exception type in order to prevent them from being suppressed by the outer property access. Python will not recognize that the `AttributeError` orginates from the authenticator and will instaed assume that the request object does not have a `.user` or `.auth` property. The authenticator will need to be fixed.
<add>**Note:** You may see a `WrappedAttributeError` raised when calling the `.user` or `.auth` properties. These errors originate from an authenticator as a standard `AttributeError`, however it's necessary that they be re-raised as a different exception type in order to prevent them from being suppressed by the outer property access. Python will not recognize that the `AttributeError` orginates from the authenticator and will instead assume that the request object does not have a `.user` or `.auth` property. The authenticator will need to be fixed.
<ide>
<ide> ---
<ide> | 1 |
Javascript | Javascript | use .getrepo everywhere | 3752f6616021a5c2caf7a42950719af5ab74d406 | <ide><path>src/git-repository-async.js
<ide> export default class GitRepositoryAsync {
<ide> // Public: Returns a {Promise} which resolves to the {String} path of the
<ide> // repository.
<ide> getPath () {
<del> return this.repoPromise.then(repo => repo.path().replace(/\/$/, ''))
<add> return this.getRepo().then(repo => repo.path().replace(/\/$/, ''))
<ide> }
<ide>
<ide> // Public: Returns a {Promise} which resolves to the {String} working
<ide> // directory path of the repository.
<ide> getWorkingDirectory () {
<del> return this.repoPromise.then(repo => repo.workdir())
<add> return this.getRepo().then(repo => repo.workdir())
<ide> }
<ide>
<ide> // Public: Returns a {Promise} that resolves to true if at the root, false if
<ide> export default class GitRepositoryAsync {
<ide> if (!this.project) return Promise.resolve(false)
<ide>
<ide> if (!this.projectAtRoot) {
<del> this.projectAtRoot = this.repoPromise
<add> this.projectAtRoot = this.getRepo()
<ide> .then(repo => this.project.relativize(repo.workdir()))
<ide> .then(relativePath => relativePath === '')
<ide> }
<ide> export default class GitRepositoryAsync {
<ide> //
<ide> // Returns a {Promise} which resolves to the relative {String} path.
<ide> relativizeToWorkingDirectory (_path) {
<del> return this.repoPromise
<add> return this.getRepo()
<ide> .then(repo => this.relativize(_path, repo.workdir()))
<ide> }
<ide>
<ide> export default class GitRepositoryAsync {
<ide> // Public: Returns a {Promise} which resolves to whether the given branch
<ide> // exists.
<ide> hasBranch (branch) {
<del> return this.repoPromise
<add> return this.getRepo()
<ide> .then(repo => repo.getBranch(branch))
<ide> .then(branch => branch != null)
<ide> .catch(_ => false)
<ide> export default class GitRepositoryAsync {
<ide> // Returns a {Promise} that resolves true if the given path is a submodule in
<ide> // the repository.
<ide> isSubmodule (_path) {
<del> return this.repoPromise
<add> return this.getRepo()
<ide> .then(repo => repo.openIndex())
<ide> .then(index => Promise.all([index, this.relativizeToWorkingDirectory(_path)]))
<ide> .then(([index, relativePath]) => {
<ide> export default class GitRepositoryAsync {
<ide> // Returns a {Promise} which resolves to a {Boolean} that's true if the `path`
<ide> // is ignored.
<ide> isPathIgnored (_path) {
<del> return this.repoPromise
<add> return this.getRepo()
<ide> .then(repo => {
<ide> const relativePath = this.relativize(_path, repo.workdir())
<ide> return Git.Ignore.pathIsIgnored(repo, relativePath)
<ide> export default class GitRepositoryAsync {
<ide> // value can be passed to {::isStatusModified} or {::isStatusNew} to get more
<ide> // information.
<ide> getDirectoryStatus (directoryPath) {
<del> return this.repoPromise
<add> return this.getRepo()
<ide> .then(repo => {
<ide> const relativePath = this.relativize(directoryPath, repo.workdir())
<ide> return this._getStatus([relativePath])
<ide> export default class GitRepositoryAsync {
<ide> this._refreshingCount++
<ide>
<ide> let relativePath
<del> return this.repoPromise
<add> return this.getRepo()
<ide> .then(repo => {
<ide> relativePath = this.relativize(_path, repo.workdir())
<ide> return this._getStatus([relativePath])
<ide> export default class GitRepositoryAsync {
<ide> // * `added` The {Number} of added lines.
<ide> // * `deleted` The {Number} of deleted lines.
<ide> getDiffStats (_path) {
<del> return this.repoPromise
<add> return this.getRepo()
<ide> .then(repo => Promise.all([repo, repo.getHeadCommit()]))
<ide> .then(([repo, headCommit]) => Promise.all([repo, headCommit.getTree()]))
<ide> .then(([repo, tree]) => {
<ide> export default class GitRepositoryAsync {
<ide> // * `newLines` The {Number} of lines in the new hunk
<ide> getLineDiffs (_path, text) {
<ide> let relativePath = null
<del> return this.repoPromise
<add> return this.getRepo()
<ide> .then(repo => {
<ide> relativePath = this.relativize(_path, repo.workdir())
<ide> return repo.getHeadCommit()
<ide> export default class GitRepositoryAsync {
<ide> // Returns a {Promise} that resolves or rejects depending on whether the
<ide> // method was successful.
<ide> checkoutHead (_path) {
<del> return this.repoPromise
<add> return this.getRepo()
<ide> .then(repo => {
<ide> const checkoutOptions = new Git.CheckoutOptions()
<ide> checkoutOptions.paths = [this.relativize(_path, repo.workdir())]
<ide> export default class GitRepositoryAsync {
<ide> //
<ide> // Returns a {Promise} that resolves if the method was successful.
<ide> checkoutReference (reference, create) {
<del> return this.repoPromise
<add> return this.getRepo()
<ide> .then(repo => repo.checkoutBranch(reference))
<ide> .catch(error => {
<ide> if (create) {
<ide> export default class GitRepositoryAsync {
<ide> // Returns a {Promise} which resolves to a {NodeGit.Ref} reference to the
<ide> // created branch.
<ide> _createBranch (name) {
<del> return this.repoPromise
<add> return this.getRepo()
<ide> .then(repo => Promise.all([repo, repo.getHeadCommit()]))
<ide> .then(([repo, commit]) => repo.createBranch(name, commit))
<ide> }
<ide> export default class GitRepositoryAsync {
<ide> //
<ide> // Returns a {Promise} which resolves to the {String} branch name.
<ide> _refreshBranch () {
<del> return this.repoPromise
<add> return this.getRepo()
<ide> .then(repo => repo.getCurrentBranch())
<ide> .then(ref => ref.name())
<ide> .then(branchName => this.branch = branchName)
<ide> export default class GitRepositoryAsync {
<ide> // Returns a {Promise} which resolves to an {Array} of {NodeGit.StatusFile}
<ide> // statuses for the paths.
<ide> _getStatus (paths) {
<del> return this.repoPromise
<add> return this.getRepo()
<ide> .then(repo => {
<ide> const opts = {
<ide> flags: Git.Status.OPT.INCLUDE_UNTRACKED | Git.Status.OPT.RECURSE_UNTRACKED_DIRS | Git.Status.OPT.DISABLE_PATHSPEC_MATCH | 1 |
Java | Java | add tests for transactionawarecachedecorator | 45406aa19b5445bd923809b9f782a0dd6490526a | <ide><path>spring-context-support/src/test/java/org/springframework/cache/transaction/TransactionAwareCacheDecoratorTests.java
<add>/*
<add> * Copyright 2002-2014 the original author or authors.
<add> *
<add> * Licensed under the Apache License, Version 2.0 (the "License");
<add> * you may not use this file except in compliance with the License.
<add> * You may obtain a copy of the License at
<add> *
<add> * http://www.apache.org/licenses/LICENSE-2.0
<add> *
<add> * Unless required by applicable law or agreed to in writing, software
<add> * distributed under the License is distributed on an "AS IS" BASIS,
<add> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<add> * See the License for the specific language governing permissions and
<add> * limitations under the License.
<add> */
<add>
<add>package org.springframework.cache.transaction;
<add>
<add>import static org.junit.Assert.*;
<add>
<add>import org.junit.Rule;
<add>import org.junit.Test;
<add>import org.junit.rules.ExpectedException;
<add>import org.springframework.cache.Cache;
<add>import org.springframework.cache.concurrent.ConcurrentMapCache;
<add>import org.springframework.tests.transaction.CallCountingTransactionManager;
<add>import org.springframework.transaction.PlatformTransactionManager;
<add>import org.springframework.transaction.TransactionDefinition;
<add>import org.springframework.transaction.TransactionException;
<add>import org.springframework.transaction.TransactionStatus;
<add>import org.springframework.transaction.interceptor.DefaultTransactionAttribute;
<add>import org.springframework.transaction.support.AbstractPlatformTransactionManager;
<add>import org.springframework.transaction.support.DefaultTransactionStatus;
<add>
<add>/**
<add> * @author Stephane Nicoll
<add> */
<add>public class TransactionAwareCacheDecoratorTests {
<add>
<add> @Rule
<add> public final ExpectedException thrown = ExpectedException.none();
<add>
<add> private final PlatformTransactionManager txManager = new CallCountingTransactionManager();
<add>
<add> @Test
<add> public void createWithNullTarget() {
<add> thrown.expect(IllegalArgumentException.class);
<add> new TransactionAwareCacheDecorator(null);
<add> }
<add>
<add> @Test
<add> public void regularOperationsOnTarget() {
<add> Cache target = new ConcurrentMapCache("testCache");
<add> Cache cache = new TransactionAwareCacheDecorator(target);
<add> assertEquals(target.getName(), cache.getName());
<add> assertEquals(target.getNativeCache(), cache.getNativeCache());
<add>
<add> Object key = new Object();
<add> target.put(key, "123");
<add> assertEquals("123", cache.get(key).get());
<add> assertEquals("123", cache.get(key, String.class));
<add>
<add> cache.clear();
<add> assertNull(target.get(key));
<add> }
<add>
<add> @Test
<add> public void putNonTransactional() {
<add> Cache target = new ConcurrentMapCache("testCache");
<add> Cache cache = new TransactionAwareCacheDecorator(target);
<add>
<add> Object key = new Object();
<add> cache.put(key, "123");
<add> assertEquals("123", target.get(key, String.class));
<add> }
<add>
<add> @Test
<add> public void putTransactional() {
<add> Cache target = new ConcurrentMapCache("testCache");
<add> Cache cache = new TransactionAwareCacheDecorator(target);
<add>
<add> TransactionStatus status = txManager.getTransaction(new DefaultTransactionAttribute(
<add> TransactionDefinition.PROPAGATION_REQUIRED));
<add>
<add> Object key = new Object();
<add> cache.put(key, "123");
<add> assertNull(target.get(key));
<add> txManager.commit(status);
<add>
<add> assertEquals("123", target.get(key, String.class));
<add> }
<add>
<add> @Test
<add> public void evictNonTransactional() {
<add> Cache target = new ConcurrentMapCache("testCache");
<add> Cache cache = new TransactionAwareCacheDecorator(target);
<add> Object key = new Object();
<add> cache.put(key, "123");
<add>
<add> cache.evict(key);
<add> assertNull(target.get(key));
<add> }
<add>
<add> @Test
<add> public void evictTransactional() {
<add> Cache target = new ConcurrentMapCache("testCache");
<add> Cache cache = new TransactionAwareCacheDecorator(target);
<add> Object key = new Object();
<add> cache.put(key, "123");
<add>
<add>
<add> TransactionStatus status = txManager.getTransaction(new DefaultTransactionAttribute(
<add> TransactionDefinition.PROPAGATION_REQUIRED));
<add> cache.evict(key);
<add> assertEquals("123", target.get(key, String.class));
<add> txManager.commit(status);
<add>
<add> assertNull(target.get(key));
<add> }
<add>
<add>} | 1 |
Text | Text | add new youtube channel for create clone app | 4bba3f779f5adae5cf632927e3a763271b941383 | <ide><path>guide/english/mobile-app-development/swift-development/index.md
<ide> This is my curated list of awesome Swift and iOS Resources for becoming a self-t
<ide>
<ide> #### Youtube Playlists
<ide>
<add>* [Swift Clone Applications - Lets Build That App](https://www.youtube.com/channel/UCuP2vJ6kRutQBfRmdcI92mA)
<ide> * [Swift Skills Updates](https://www.youtube.com/channel/UCuP2vJ6kRutQBfRmdcI92mA/videos) | 1 |
Javascript | Javascript | add regression test for v8.getheapsnapshot() crash | 62659511536f172946566347626a68e2b3b1c9d1 | <ide><path>test/parallel/test-v8-getheapsnapshot-twice.js
<add>'use strict';
<add>require('../common');
<add>const v8 = require('v8');
<add>
<add>// Regression test for https://github.com/nodejs/node/issues/35559
<add>// It is important that the return value of the first call is not used, i.e.
<add>// that the first snapshot is GC-able while the second one is being created.
<add>v8.getHeapSnapshot();
<add>v8.getHeapSnapshot(); | 1 |
Python | Python | call django.setup always if available | 740d4d17bca099afdc6e6251b4f4a78c99f8005c | <ide><path>celery/fixups/django.py
<ide> def __init__(self, app):
<ide> )
<ide>
<ide> def validate_models(self):
<add> import django
<add> try:
<add> django.setup()
<add> except AttributeError:
<add> pass
<ide> s = io.StringIO()
<ide> try:
<ide> from django.core.management.validation import get_validation_errors
<ide> except ImportError:
<del> import django
<ide> from django.core.management.base import BaseCommand
<del> django.setup()
<ide> cmd = BaseCommand()
<ide> cmd.stdout, cmd.stderr = sys.stdout, sys.stderr
<ide> cmd.check() | 1 |
Javascript | Javascript | fix unfinished function declaration in comments | 3ef7d18fc0723901f80b9053f513c8051200240f | <ide><path>client/commonFramework/detect-unsafe-code-stream.js
<ide> window.common = (function(global) {
<ide> } = global;
<ide>
<ide> const detectFunctionCall = /function\s*?\(|function\s+\w+\s*?\(/gi;
<add> const detectInComment = new RegExp(['\\/\\/[\\W\\w\\s]*?function.|',
<add> '\\/\\*[\\s\\w\\W]*?function',
<add> '[\\s\\W\\w]*?\\*\\/'].join(''), 'gi');
<ide> const detectUnsafeJQ = /\$\s*?\(\s*?\$\s*?\)/gi;
<ide> const detectUnsafeConsoleCall = /if\s\(null\)\sconsole\.log\(1\);/gi;
<ide>
<ide> window.common = (function(global) {
<ide>
<ide> if (
<ide> code.match(/function/g) &&
<del> !code.match(detectFunctionCall)
<add> !code.match(detectFunctionCall) &&
<add> !code.match(detectInComment)
<ide> ) {
<ide> return Observable.throw(
<ide> new Error('SyntaxError: Unsafe or unfinished function declaration') | 1 |
Javascript | Javascript | enforce one element limit | f46a9472b54fdafacda6f780a197b0fce5ee46d8 | <ide><path>src/core/core.controller.js
<ide> module.exports = function(Chart) {
<ide> }
<ide> });
<ide>
<del> return elementsArray;
<add> return elementsArray.slice(0, 1);
<ide> },
<ide>
<ide> getElementsAtEvent: function(e) { | 1 |
Python | Python | fix dtype consistency issue in random_binomial | 1ea3f44f06694aad184644f9b73135abc3eb5e29 | <ide><path>keras/backend/tensorflow_backend.py
<ide> def random_binomial(shape, p=0.0, dtype=_FLOATX, seed=None):
<ide> if seed is None:
<ide> seed = np.random.randint(10e6)
<ide> return tf.select(tf.random_uniform(shape, dtype=dtype, seed=seed) <= p,
<del> tf.ones(shape), tf.zeros(shape))
<add> tf.ones(shape, dtype=dtype),
<add> tf.zeros(shape, dtype=dtype)) | 1 |
Text | Text | add changelog for 3.27.5 | c47d6287c335b07d5425f3cab0b95bdde9811af8 | <ide><path>CHANGELOG.md
<ide>
<ide> - [#19472](https://github.com/emberjs/ember.js/pull/19472) [BUGFIX] Prevent transformation of block params called `attrs`
<ide>
<add>## v3.27.5 (June 10, 2021)
<add>
<add>- [#19597](https://github.com/emberjs/ember.js/pull/19597) [BIGFIX] Fix `<LinkTo>` with nested children
<add>
<ide> ## v3.27.4 (June 9, 2021)
<ide>
<ide> - [#19594](https://github.com/emberjs/ember.js/pull/19594) [BUGFIX] Revert lazy hash changes | 1 |
Ruby | Ruby | drop extra variable | 4c101ccd82375f14d5de73e740a900444fe0a3d3 | <ide><path>activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb
<ide> def select_value(arel, name = nil, binds = [])
<ide> # Returns an array of the values of the first column in a select:
<ide> # select_values("SELECT id FROM companies LIMIT 3") => [1,2,3]
<ide> def select_values(arel, name = nil)
<del> result = select_rows(to_sql(arel, []), name)
<del> result.map { |v| v[0] }
<add> select_rows(to_sql(arel, []), name)
<add> .map { |v| v[0] }
<ide> end
<ide>
<ide> # Returns an array of arrays containing the field values. | 1 |
Ruby | Ruby | use keg#uninstall to uninstall kegs | de24d731725a0a6be1339fbdd879f12a136c037d | <ide><path>Library/Homebrew/cmd/uninstall.rb
<ide> def uninstall
<ide>
<ide> if rack.directory?
<ide> puts "Uninstalling #{name}..."
<del> rack.subdirs.each { |d| Keg.new(d).unlink }
<del> rack.rmtree
<add> rack.subdirs.each do |d|
<add> keg = Keg.new(d)
<add> keg.unlink
<add> keg.uninstall
<add> end
<ide> end
<ide>
<ide> rm_opt_link name
<ide><path>Library/Homebrew/test/test_keg.rb
<ide> def setup
<ide> mkpath HOMEBREW_PREFIX/"lib"
<ide> end
<ide>
<add> def teardown
<add> @keg.unlink
<add> @keg.uninstall
<add>
<add> $stdout = @old_stdout
<add>
<add> rmtree HOMEBREW_PREFIX/"bin"
<add> rmtree HOMEBREW_PREFIX/"lib"
<add> end
<add>
<ide> def test_linking_keg
<ide> assert_equal 3, @keg.link
<ide> (HOMEBREW_PREFIX/"bin").children.each { |c| assert_predicate c.readlink, :relative? }
<ide> def test_unlink_ignores_DS_Store_when_pruning_empty_dirs
<ide> refute_predicate HOMEBREW_PREFIX/"lib/foo", :directory?
<ide> refute_predicate HOMEBREW_PREFIX/"lib/foo/.DS_Store", :exist?
<ide> end
<del>
<del> def teardown
<del> @keg.unlink
<del> @keg.rmtree
<del>
<del> $stdout = @old_stdout
<del>
<del> rmtree HOMEBREW_PREFIX/"bin"
<del> rmtree HOMEBREW_PREFIX/"lib"
<del> end
<ide> end | 2 |
Ruby | Ruby | remove extra advisory lock connection | 07d8b99ebeddf110df8fba8e18985ca176d60046 | <ide><path>activerecord/lib/active_record/migration.rb
<ide> def use_advisory_lock?
<ide>
<ide> def with_advisory_lock
<ide> lock_id = generate_migrator_advisory_lock_id
<add> connection = ActiveRecord::Base.connection
<ide>
<del> with_advisory_lock_connection do |connection|
<del> got_lock = connection.get_advisory_lock(lock_id)
<del> raise ConcurrentMigrationError unless got_lock
<del> load_migrated # reload schema_migrations to be sure it wasn't changed by another process before we got the lock
<del> yield
<del> ensure
<del> if got_lock && !connection.release_advisory_lock(lock_id)
<del> raise ConcurrentMigrationError.new(
<del> ConcurrentMigrationError::RELEASE_LOCK_FAILED_MESSAGE
<del> )
<del> end
<del> end
<del> end
<del>
<del> def with_advisory_lock_connection(&block)
<del> pool = ActiveRecord::ConnectionAdapters::ConnectionHandler.new.establish_connection(
<del> ActiveRecord::Base.connection_db_config
<del> )
<del>
<del> pool.with_connection(&block)
<add> got_lock = connection.get_advisory_lock(lock_id)
<add> raise ConcurrentMigrationError unless got_lock
<add> load_migrated # reload schema_migrations to be sure it wasn't changed by another process before we got the lock
<add> yield
<ide> ensure
<del> pool&.disconnect!
<add> if got_lock && !connection.release_advisory_lock(lock_id)
<add> raise ConcurrentMigrationError.new(
<add> ConcurrentMigrationError::RELEASE_LOCK_FAILED_MESSAGE
<add> )
<add> end
<ide> end
<ide>
<ide> MIGRATOR_SALT = 2053462845
<ide><path>activerecord/test/cases/migration_test.rb
<ide> def migrate(x)
<ide> end
<ide>
<ide> def test_with_advisory_lock_doesnt_release_closed_connections
<add> # make sure we have a connection
<add> ActiveRecord::Base.establish_connection :arunit
<add>
<ide> migration = Class.new(ActiveRecord::Migration::Current).new
<ide> migrator = ActiveRecord::Migrator.new(:up, [migration], @schema_migration, @internal_metadata, 100)
<ide>
<ide> def test_with_advisory_lock_raises_the_right_error_when_it_fails_to_release_lock
<ide>
<ide> e = assert_raises(ActiveRecord::ConcurrentMigrationError) do
<ide> silence_stream($stderr) do
<del> migrator.stub(:with_advisory_lock_connection, ->(&block) { block.call(ActiveRecord::Base.connection) }) do
<del> migrator.send(:with_advisory_lock) do
<del> ActiveRecord::Base.connection.release_advisory_lock(lock_id)
<del> end
<add> migrator.send(:with_advisory_lock) do
<add> ActiveRecord::Base.connection.release_advisory_lock(lock_id)
<ide> end
<ide> end
<ide> end | 2 |
Ruby | Ruby | fix unused variable warning | dfcef831b5cc612495323114dd1bbb9366f05128 | <ide><path>activesupport/test/core_ext/time_with_zone_test.rb
<ide> def test_time_in_time_zone_doesnt_affect_receiver
<ide> with_env_tz 'Europe/London' do
<ide> time = Time.local(2000, 7, 1)
<ide> time_with_zone = time.in_time_zone('Eastern Time (US & Canada)')
<add> assert_equal Time.utc(2000, 6, 30, 23, 0, 0), time_with_zone
<ide> assert_not time.utc?, 'time expected to be local, but is UTC'
<ide> end
<ide> end | 1 |
Mixed | Text | add support for --storage-opt size | 05bac4591a4519fbac9d3724f3b708e882bbad80 | <ide><path>daemon/graphdriver/overlay2/overlay.go
<ide> import (
<ide> "github.com/docker/docker/pkg/mount"
<ide> "github.com/docker/docker/pkg/parsers"
<ide> "github.com/docker/docker/pkg/parsers/kernel"
<add> "github.com/docker/go-units"
<ide>
<ide> "github.com/opencontainers/runc/libcontainer/label"
<ide> )
<ide> const (
<ide> idLength = 26
<ide> )
<ide>
<add>type overlayOptions struct {
<add> overrideKernelCheck bool
<add> quota graphdriver.Quota
<add>}
<add>
<ide> // Driver contains information about the home directory and the list of active mounts that are created using this driver.
<ide> type Driver struct {
<del> home string
<del> uidMaps []idtools.IDMap
<del> gidMaps []idtools.IDMap
<del> ctr *graphdriver.RefCounter
<add> home string
<add> uidMaps []idtools.IDMap
<add> gidMaps []idtools.IDMap
<add> ctr *graphdriver.RefCounter
<add> quotaCtl *graphdriver.QuotaCtl
<add> options overlayOptions
<ide> }
<ide>
<del>var backingFs = "<unknown>"
<add>var (
<add> backingFs = "<unknown>"
<add> projectQuotaSupported = false
<add>)
<ide>
<ide> func init() {
<ide> graphdriver.Register(driverName, Init)
<ide> func Init(home string, options []string, uidMaps, gidMaps []idtools.IDMap) (grap
<ide> ctr: graphdriver.NewRefCounter(graphdriver.NewFsChecker(graphdriver.FsMagicOverlay)),
<ide> }
<ide>
<del> return d, nil
<del>}
<add> if backingFs == "xfs" {
<add> // Try to enable project quota support over xfs.
<add> if d.quotaCtl, err = graphdriver.NewQuotaCtl(home); err == nil {
<add> projectQuotaSupported = true
<add> }
<add> }
<ide>
<del>type overlayOptions struct {
<del> overrideKernelCheck bool
<add> logrus.Debugf("backingFs=%s, projectQuotaSupported=%v", backingFs, projectQuotaSupported)
<add>
<add> return d, nil
<ide> }
<ide>
<ide> func parseOptions(options []string) (*overlayOptions, error) {
<ide> func parseOptions(options []string) (*overlayOptions, error) {
<ide> if err != nil {
<ide> return nil, err
<ide> }
<add>
<ide> default:
<ide> return nil, fmt.Errorf("overlay2: Unknown option %s\n", key)
<ide> }
<ide> func (d *Driver) CreateReadWrite(id, parent, mountLabel string, storageOpt map[s
<ide> // The parent filesystem is used to configure these directories for the overlay.
<ide> func (d *Driver) Create(id, parent, mountLabel string, storageOpt map[string]string) (retErr error) {
<ide>
<del> if len(storageOpt) != 0 {
<del> return fmt.Errorf("--storage-opt is not supported for overlay")
<add> if len(storageOpt) != 0 && !projectQuotaSupported {
<add> return fmt.Errorf("--storage-opt is supported only for overlay over xfs with 'pquota' mount option")
<ide> }
<ide>
<ide> dir := d.dir(id)
<ide> func (d *Driver) Create(id, parent, mountLabel string, storageOpt map[string]str
<ide> }
<ide> }()
<ide>
<add> if len(storageOpt) > 0 {
<add> driver := &Driver{}
<add> if err := d.parseStorageOpt(storageOpt, driver); err != nil {
<add> return err
<add> }
<add>
<add> if driver.options.quota.Size > 0 {
<add> // Set container disk quota limit
<add> if err := d.quotaCtl.SetQuota(dir, driver.options.quota); err != nil {
<add> return err
<add> }
<add> }
<add> }
<add>
<ide> if err := idtools.MkdirAs(path.Join(dir, "diff"), 0755, rootUID, rootGID); err != nil {
<ide> return err
<ide> }
<ide> func (d *Driver) Create(id, parent, mountLabel string, storageOpt map[string]str
<ide> return nil
<ide> }
<ide>
<add>// Parse overlay storage options
<add>func (d *Driver) parseStorageOpt(storageOpt map[string]string, driver *Driver) error {
<add> // Read size to set the disk project quota per container
<add> for key, val := range storageOpt {
<add> key := strings.ToLower(key)
<add> switch key {
<add> case "size":
<add> size, err := units.RAMInBytes(val)
<add> if err != nil {
<add> return err
<add> }
<add> driver.options.quota.Size = uint64(size)
<add> default:
<add> return fmt.Errorf("Unknown option %s", key)
<add> }
<add> }
<add>
<add> return nil
<add>}
<add>
<ide> func (d *Driver) getLower(parent string) (string, error) {
<ide> parentDir := d.dir(parent)
<ide>
<ide><path>docs/reference/commandline/create.md
<ide> Set storage driver options per container.
<ide> $ docker create -it --storage-opt size=120G fedora /bin/bash
<ide>
<ide> This (size) will allow to set the container rootfs size to 120G at creation time.
<del>User cannot pass a size less than the Default BaseFS Size. This option is only
<del>available for the `devicemapper`, `btrfs`, `windowsfilter`, and `zfs` graph drivers.
<add>This option is only available for the `devicemapper`, `btrfs`, `overlay2`,
<add>`windowsfilter` and `zfs` graph drivers.
<add>For the `devicemapper`, `btrfs`, `windowsfilter` and `zfs` graph drivers,
<add>user cannot pass a size less than the Default BaseFS Size.
<add>For the `overlay2` storage driver, the size option is only available if the
<add>backing fs is `xfs` and mounted with the `pquota` mount option.
<add>Under these conditions, user can pass any size less then the backing fs size.
<ide>
<ide> ### Specify isolation technology for container (--isolation)
<ide>
<ide><path>docs/reference/commandline/run.md
<ide> The `-w` lets the command being executed inside directory given, here
<ide> $ docker run -it --storage-opt size=120G fedora /bin/bash
<ide>
<ide> This (size) will allow to set the container rootfs size to 120G at creation time.
<del>User cannot pass a size less than the Default BaseFS Size. This option is only
<del>available for the `devicemapper`, `btrfs`, `windowsfilter`, and `zfs` graph drivers.
<add>This option is only available for the `devicemapper`, `btrfs`, `overlay2`,
<add>`windowsfilter` and `zfs` graph drivers.
<add>For the `devicemapper`, `btrfs`, `windowsfilter` and `zfs` graph drivers,
<add>user cannot pass a size less than the Default BaseFS Size.
<add>For the `overlay2` storage driver, the size option is only available if the
<add>backing fs is `xfs` and mounted with the `pquota` mount option.
<add>Under these conditions, user can pass any size less then the backing fs size.
<ide>
<ide> ### Mount tmpfs (--tmpfs)
<ide>
<ide><path>man/docker-create.1.md
<ide> unit, `b` is used. Set LIMIT to `-1` to enable unlimited swap.
<ide>
<ide> $ docker create -it --storage-opt size=120G fedora /bin/bash
<ide>
<del> This (size) will allow to set the container rootfs size to 120G at creation time. User cannot pass a size less than the Default BaseFS Size.
<del> This option is only available for the `devicemapper`, `btrfs`, and `zfs` graph drivers.
<add> This (size) will allow to set the container rootfs size to 120G at creation time.
<add> This option is only available for the `devicemapper`, `btrfs`, `overlay2` and `zfs` graph drivers.
<add> For the `devicemapper`, `btrfs` and `zfs` storage drivers, user cannot pass a size less than the Default BaseFS Size.
<add> For the `overlay2` storage driver, the size option is only available if the backing fs is `xfs` and mounted with the `pquota` mount option.
<add> Under these conditions, user can pass any size less then the backing fs size.
<ide>
<ide> **--stop-signal**=*SIGTERM*
<ide> Signal to stop a container. Default is SIGTERM.
<ide><path>man/docker-run.1.md
<ide> incompatible with any restart policy other than `none`.
<ide>
<ide> $ docker run -it --storage-opt size=120G fedora /bin/bash
<ide>
<del> This (size) will allow to set the container rootfs size to 120G at creation time. User cannot pass a size less than the Default BaseFS Size.
<del> This option is only available for the `devicemapper`, `btrfs`, and `zfs` graph drivers.
<add> This (size) will allow to set the container rootfs size to 120G at creation time.
<add> This option is only available for the `devicemapper`, `btrfs`, `overlay2` and `zfs` graph drivers.
<add> For the `devicemapper`, `btrfs` and `zfs` storage drivers, user cannot pass a size less than the Default BaseFS Size.
<add> For the `overlay2` storage driver, the size option is only available if the backing fs is `xfs` and mounted with the `pquota` mount option.
<add> Under these conditions, user can pass any size less then the backing fs size.
<ide>
<ide> **--stop-signal**=*SIGTERM*
<ide> Signal to stop a container. Default is SIGTERM. | 5 |
Python | Python | add documentation of trainer.create_model_card | 801ebd045d4310fef2e837713fa630cb183f0104 | <ide><path>src/transformers/modeling_tf_utils.py
<ide> def create_model_card(
<ide> dataset: Optional[Union[str, List[str]]] = None,
<ide> dataset_args: Optional[Union[str, List[str]]] = None,
<ide> ):
<add> """
<add> Creates a draft of a model card using the information available to the `Trainer`.
<add>
<add> Args:
<add> output_dir (`str` or `os.PathLike`):
<add> The folder in which to create the model card.
<add> model_name (`str`, *optional*):
<add> The name of the model.
<add> language (`str`, *optional*):
<add> The language of the model (if applicable)
<add> license (`str`, *optional*):
<add> The license of the model. Will default to the license of the pretrained model used, if the original
<add> model given to the `Trainer` comes from a repo on the Hub.
<add> tags (`str` or `List[str]`, *optional*):
<add> Some tags to be included in the metadata of the model card.
<add> finetuned_from (`str`, *optional*):
<add> The name of the model used to fine-tune this one (if applicable). Will default to the name of the repo
<add> of the original model given to the `Trainer` (if it comes from the Hub).
<add> tasks (`str` or `List[str]`, *optional*):
<add> One or several task identifiers, to be included in the metadata of the model card.
<add> dataset_tags (`str` or `List[str]`, *optional*):
<add> One or several dataset tags, to be included in the metadata of the model card.
<add> dataset (`str` or `List[str]`, *optional*):
<add> One or several dataset identifiers, to be included in the metadata of the model card.
<add> dataset_args (`str` or `List[str]`, *optional*):
<add> One or several dataset arguments, to be included in the metadata of the model card.
<add> """
<ide> # Avoids a circular import by doing this when necessary.
<ide> from .modelcard import TrainingSummary # tests_ignore
<ide>
<ide><path>src/transformers/trainer.py
<ide> def create_model_card(
<ide> self,
<ide> language: Optional[str] = None,
<ide> license: Optional[str] = None,
<del> tags: Optional[str] = None,
<add> tags: Union[str, List[str], None] = None,
<ide> model_name: Optional[str] = None,
<ide> finetuned_from: Optional[str] = None,
<del> tasks: Optional[str] = None,
<del> dataset_tags: Optional[Union[str, List[str]]] = None,
<del> dataset: Optional[Union[str, List[str]]] = None,
<del> dataset_args: Optional[Union[str, List[str]]] = None,
<add> tasks: Union[str, List[str], None] = None,
<add> dataset_tags: Union[str, List[str], None] = None,
<add> dataset: Union[str, List[str], None] = None,
<add> dataset_args: Union[str, List[str], None] = None,
<ide> ):
<add> """
<add> Creates a draft of a model card using the information available to the `Trainer`.
<add>
<add> Args:
<add> language (`str`, *optional*):
<add> The language of the model (if applicable)
<add> license (`str`, *optional*):
<add> The license of the model. Will default to the license of the pretrained model used, if the original
<add> model given to the `Trainer` comes from a repo on the Hub.
<add> tags (`str` or `List[str]`, *optional*):
<add> Some tags to be included in the metadata of the model card.
<add> model_name (`str`, *optional*):
<add> The name of the model.
<add> finetuned_from (`str`, *optional*):
<add> The name of the model used to fine-tune this one (if applicable). Will default to the name of the repo
<add> of the original model given to the `Trainer` (if it comes from the Hub).
<add> tasks (`str` or `List[str]`, *optional*):
<add> One or several task identifiers, to be included in the metadata of the model card.
<add> dataset_tags (`str` or `List[str]`, *optional*):
<add> One or several dataset tags, to be included in the metadata of the model card.
<add> dataset (`str` or `List[str]`, *optional*):
<add> One or several dataset identifiers, to be included in the metadata of the model card.
<add> dataset_args (`str` or `List[str]`, *optional*):
<add> One or several dataset arguments, to be included in the metadata of the model card.
<add> """
<ide> if not self.is_world_process_zero():
<ide> return
<ide> | 2 |
Ruby | Ruby | fix invalid regex | 6d05597d0f03030a429d8154daf99a1226e6cbbd | <ide><path>railties/test/application/assets_test.rb
<ide> class ::PostsController < ActionController::Base ; end
<ide> test "precompile should handle utf8 filenames" do
<ide> filename = "レイルズ.png"
<ide> app_file "app/assets/images/#{filename}", "not a image really"
<del> add_to_config "config.assets.precompile = [ /\.png$$/, /application.(css|js)$/ ]"
<add> add_to_config "config.assets.precompile = [ /\.png$/, /application.(css|js)$/ ]"
<ide>
<ide> precompile!
<ide> require "#{app_path}/config/environment" | 1 |
Javascript | Javascript | improve hmr error handling #410 | 76f1c2fa0e4a5c254d401afade203f36a0d261f4 | <ide><path>lib/JsonpMainTemplatePlugin.js
<ide> JsonpMainTemplatePlugin.prototype.apply = function(mainTemplate) {
<ide> return callback(new Error("No browser support"));
<ide> try {
<ide> var request = new XMLHttpRequest();
<del> request.open("GET", $require$.p + $hotMainFilename$, true);
<add> var requestPath = $require$.p + $hotMainFilename$;
<add> request.open("GET", requestPath, true);
<add> request.timeout = 10000;
<ide> request.send(null);
<ide> } catch(err) {
<ide> return callback(err);
<ide> }
<ide> request.onreadystatechange = function() {
<ide> if(request.readyState !== 4) return;
<del> if(request.status !== 200 && request.status !== 304) {
<add> if(request.status === 0) {
<add> // timeout
<add> callback(new Error("Manifest request to " + requestPath + " timed out."));
<add> } else if(request.status === 404) {
<add> // no update available
<ide> callback();
<add> } else if(request.status !== 200 && request.status !== 304) {
<add> // other failure
<add> callback(new Error("Manifest request to " + requestPath + " failed."));
<ide> } else {
<add> // success
<ide> try {
<ide> var update = JSON.parse(request.responseText);
<ide> } catch(e) {
<del> callback();
<add> callback(e);
<ide> return;
<ide> }
<ide> callback(null, update); | 1 |
Go | Go | add logs, and potential naming conflict | 496a4bd15e57890ae0c2320a7d4c25e3b9d2838f | <ide><path>integration-cli/docker_cli_run_test.go
<ide> func (s *DockerSuite) TestRunEmptyEnv(c *testing.T) {
<ide>
<ide> // #28658
<ide> func (s *DockerSuite) TestSlowStdinClosing(c *testing.T) {
<del> name := "testslowstdinclosing"
<del> repeat := 3 // regression happened 50% of the time
<add> const repeat = 3 // regression happened 50% of the time
<ide> for i := 0; i < repeat; i++ {
<ide> cmd := icmd.Cmd{
<del> Command: []string{dockerBinary, "run", "--rm", "--name", name, "-i", "busybox", "cat"},
<add> Command: []string{dockerBinary, "run", "--rm", "-i", "busybox", "cat"},
<ide> Stdin: &delayedReader{},
<ide> }
<ide> done := make(chan error, 1)
<ide> go func() {
<del> err := icmd.RunCmd(cmd).Error
<del> done <- err
<add> result := icmd.RunCmd(cmd)
<add> if out := result.Combined(); out != "" {
<add> c.Log(out)
<add> }
<add> done <- result.Error
<ide> }()
<ide>
<ide> select { | 1 |
Javascript | Javascript | add a documentation example | 4d4da556eb2a401ad92323e04c803ff2e77924b0 | <ide><path>src/ng/document.js
<ide> *
<ide> * @description
<ide> * A {@link angular.element jQuery or jqLite} wrapper for the browser's `window.document` object.
<add> *
<add> * @example
<add> <example>
<add> <file name="index.html">
<add> <div ng-controller="MainCtrl">
<add> <p>$document title: <b ng-bind="title"></b></p>
<add> <p>window.document title: <b ng-bind="windowTitle"></b></p>
<add> </div>
<add> </file>
<add> <file name="script.js">
<add> function MainCtrl($scope, $document) {
<add> $scope.title = $document[0].title;
<add> $scope.windowTitle = angular.element(window.document)[0].title;
<add> }
<add> </file>
<add> </example>
<ide> */
<ide> function $DocumentProvider(){
<ide> this.$get = ['$window', function(window){ | 1 |
Javascript | Javascript | remove common.port from assorted pummel tests | 97c8abe2c0df261aacadd5abd9cabfbeef2d5d61 | <ide><path>test/pummel/test-http-many-keep-alive-connections.js
<ide> // USE OR OTHER DEALINGS IN THE SOFTWARE.
<ide>
<ide> 'use strict';
<del>const common = require('../common');
<add>require('../common');
<ide> const assert = require('assert');
<ide> const http = require('http');
<ide>
<ide> server.once('connection', function(c) {
<ide> connection = c;
<ide> });
<ide>
<del>server.listen(common.PORT, function connect() {
<add>server.listen(0, function connect() {
<ide> const request = http.get({
<del> port: common.PORT,
<add> port: server.address().port,
<ide> path: '/',
<ide> headers: {
<ide> 'Connection': 'Keep-alive'
<ide><path>test/pummel/test-http-upload-timeout.js
<ide> // This tests setTimeout() by having multiple clients connecting and sending
<ide> // data in random intervals. Clients are also randomly disconnecting until there
<ide> // are no more clients left. If no false timeout occurs, this test has passed.
<del>const common = require('../common');
<add>require('../common');
<ide> const http = require('http');
<ide> const server = http.createServer();
<ide> let connections = 0;
<ide> server.on('request', function(req, res) {
<ide> req.resume();
<ide> });
<ide>
<del>server.listen(common.PORT, '127.0.0.1', function() {
<add>server.listen(0, '127.0.0.1', function() {
<ide> for (let i = 0; i < 10; i++) {
<ide> connections++;
<ide>
<ide> setTimeout(function() {
<ide> const request = http.request({
<del> port: common.PORT,
<add> port: server.address().port,
<ide> method: 'POST',
<ide> path: '/'
<ide> });
<ide><path>test/pummel/test-https-large-response.js
<ide> const server = https.createServer(options, common.mustCall(function(req, res) {
<ide> res.end(body);
<ide> }));
<ide>
<del>server.listen(common.PORT, common.mustCall(function() {
<add>server.listen(0, common.mustCall(function() {
<ide> https.get({
<del> port: common.PORT,
<add> port: server.address().port,
<ide> rejectUnauthorized: false
<ide> }, common.mustCall(function(res) {
<ide> console.log('response!');
<ide><path>test/pummel/test-https-no-reader.js
<ide> const server = https.createServer(options, function(req, res) {
<ide> res.end();
<ide> });
<ide>
<del>server.listen(common.PORT, function() {
<add>server.listen(0, function() {
<ide> const req = https.request({
<ide> method: 'POST',
<del> port: common.PORT,
<add> port: server.address().port,
<ide> rejectUnauthorized: false
<ide> }, function(res) {
<ide> res.read(0);
<ide><path>test/pummel/test-net-pingpong-delay.js
<ide> const common = require('../common');
<ide> const assert = require('assert');
<ide> const net = require('net');
<ide>
<del>function pingPongTest(port, host, on_complete) {
<add>function pingPongTest(host, on_complete) {
<ide> const N = 100;
<ide> const DELAY = 1;
<ide> let count = 0;
<ide> function pingPongTest(port, host, on_complete) {
<ide> });
<ide> });
<ide>
<del> server.listen(port, host, common.mustCall(function() {
<del> const client = net.createConnection(port, host);
<add> server.listen(0, host, common.mustCall(function() {
<add> const client = net.createConnection(server.address().port, host);
<ide>
<ide> client.setEncoding('utf8');
<ide>
<ide> function pingPongTest(port, host, on_complete) {
<ide> }));
<ide> }
<ide>
<del>pingPongTest(common.PORT);
<add>pingPongTest();
<ide><path>test/pummel/test-net-timeout2.js
<ide> const server = net.createServer(function(socket) {
<ide> });
<ide>
<ide>
<del>server.listen(common.PORT, function() {
<del> const s = net.connect(common.PORT);
<add>server.listen(0, function() {
<add> const s = net.connect(server.address().port);
<ide> s.pipe(process.stdout);
<ide> });
<ide><path>test/pummel/test-regress-GH-892.js
<ide> function makeRequest() {
<ide> // more easily. Also, this is handy when using this test to
<ide> // view V8 opt/deopt behavior.
<ide> const args = process.execArgv.concat([ childScript,
<del> common.PORT,
<add> server.address().port,
<ide> bytesExpected ]);
<ide>
<ide> const child = spawn(process.execPath, args);
<ide> const server = https.Server(serverOptions, function(req, res) {
<ide> });
<ide> });
<ide>
<del>server.listen(common.PORT, function() {
<add>server.listen(0, function() {
<ide> console.log(`expecting ${bytesExpected} bytes`);
<ide> makeRequest();
<ide> });
<ide><path>test/pummel/test-tls-throttle.js
<ide> const server = tls.Server(options, common.mustCall(function(socket) {
<ide>
<ide> let recvCount = 0;
<ide>
<del>server.listen(common.PORT, function() {
<add>server.listen(0, function() {
<ide> const client = tls.connect({
<del> port: common.PORT,
<add> port: server.address().port,
<ide> rejectUnauthorized: false
<ide> });
<ide> | 8 |
Python | Python | kill classes in test_testing | f8a778deaeb9fd63d3aaa004fce27d07751a9d59 | <ide><path>tests/test_testing.py
<ide> from flask._compat import text_type
<ide>
<ide>
<del>class TestTestTools(object):
<del>
<del> def test_environ_defaults_from_config(self):
<del> app = flask.Flask(__name__)
<del> app.testing = True
<del> app.config['SERVER_NAME'] = 'example.com:1234'
<del> app.config['APPLICATION_ROOT'] = '/foo'
<del> @app.route('/')
<del> def index():
<del> return flask.request.url
<del>
<del> ctx = app.test_request_context()
<del> assert ctx.request.url == 'http://example.com:1234/foo/'
<del> with app.test_client() as c:
<del> rv = c.get('/')
<del> assert rv.data == b'http://example.com:1234/foo/'
<del>
<del> def test_environ_defaults(self):
<del> app = flask.Flask(__name__)
<del> app.testing = True
<del> @app.route('/')
<del> def index():
<del> return flask.request.url
<del>
<del> ctx = app.test_request_context()
<del> assert ctx.request.url == 'http://localhost/'
<del> with app.test_client() as c:
<del> rv = c.get('/')
<del> assert rv.data == b'http://localhost/'
<del>
<del> def test_redirect_keep_session(self):
<del> app = flask.Flask(__name__)
<del> app.secret_key = 'testing'
<del>
<del> @app.route('/', methods=['GET', 'POST'])
<del> def index():
<del> if flask.request.method == 'POST':
<del> return flask.redirect('/getsession')
<del> flask.session['data'] = 'foo'
<del> return 'index'
<del>
<del> @app.route('/getsession')
<del> def get_session():
<del> return flask.session.get('data', '<missing>')
<del>
<del> with app.test_client() as c:
<del> rv = c.get('/getsession')
<del> assert rv.data == b'<missing>'
<del>
<del> rv = c.get('/')
<del> assert rv.data == b'index'
<add>def test_environ_defaults_from_config():
<add> app = flask.Flask(__name__)
<add> app.testing = True
<add> app.config['SERVER_NAME'] = 'example.com:1234'
<add> app.config['APPLICATION_ROOT'] = '/foo'
<add> @app.route('/')
<add> def index():
<add> return flask.request.url
<add>
<add> ctx = app.test_request_context()
<add> assert ctx.request.url == 'http://example.com:1234/foo/'
<add> with app.test_client() as c:
<add> rv = c.get('/')
<add> assert rv.data == b'http://example.com:1234/foo/'
<add>
<add>def test_environ_defaults():
<add> app = flask.Flask(__name__)
<add> app.testing = True
<add> @app.route('/')
<add> def index():
<add> return flask.request.url
<add>
<add> ctx = app.test_request_context()
<add> assert ctx.request.url == 'http://localhost/'
<add> with app.test_client() as c:
<add> rv = c.get('/')
<add> assert rv.data == b'http://localhost/'
<add>
<add>def test_redirect_keep_session():
<add> app = flask.Flask(__name__)
<add> app.secret_key = 'testing'
<add>
<add> @app.route('/', methods=['GET', 'POST'])
<add> def index():
<add> if flask.request.method == 'POST':
<add> return flask.redirect('/getsession')
<add> flask.session['data'] = 'foo'
<add> return 'index'
<add>
<add> @app.route('/getsession')
<add> def get_session():
<add> return flask.session.get('data', '<missing>')
<add>
<add> with app.test_client() as c:
<add> rv = c.get('/getsession')
<add> assert rv.data == b'<missing>'
<add>
<add> rv = c.get('/')
<add> assert rv.data == b'index'
<add> assert flask.session.get('data') == 'foo'
<add> rv = c.post('/', data={}, follow_redirects=True)
<add> assert rv.data == b'foo'
<add>
<add> # This support requires a new Werkzeug version
<add> if not hasattr(c, 'redirect_client'):
<ide> assert flask.session.get('data') == 'foo'
<del> rv = c.post('/', data={}, follow_redirects=True)
<del> assert rv.data == b'foo'
<ide>
<del> # This support requires a new Werkzeug version
<del> if not hasattr(c, 'redirect_client'):
<del> assert flask.session.get('data') == 'foo'
<del>
<del> rv = c.get('/getsession')
<del> assert rv.data == b'foo'
<del>
<del> def test_session_transactions(self):
<del> app = flask.Flask(__name__)
<del> app.testing = True
<del> app.secret_key = 'testing'
<del>
<del> @app.route('/')
<del> def index():
<del> return text_type(flask.session['foo'])
<del>
<del> with app.test_client() as c:
<del> with c.session_transaction() as sess:
<del> assert len(sess) == 0
<del> sess['foo'] = [42]
<del> assert len(sess) == 1
<del> rv = c.get('/')
<del> assert rv.data == b'[42]'
<del> with c.session_transaction() as sess:
<del> assert len(sess) == 1
<del> assert sess['foo'] == [42]
<del>
<del> def test_session_transactions_no_null_sessions(self):
<del> app = flask.Flask(__name__)
<del> app.testing = True
<del>
<del> with app.test_client() as c:
<del> try:
<del> with c.session_transaction() as sess:
<del> pass
<del> except RuntimeError as e:
<del> assert 'Session backend did not open a session' in str(e)
<del> else:
<del> assert False, 'Expected runtime error'
<del>
<del> def test_session_transactions_keep_context(self):
<del> app = flask.Flask(__name__)
<del> app.testing = True
<del> app.secret_key = 'testing'
<del>
<del> with app.test_client() as c:
<del> rv = c.get('/')
<del> req = flask.request._get_current_object()
<del> assert req is not None
<del> with c.session_transaction():
<del> assert req is flask.request._get_current_object()
<del>
<del> def test_session_transaction_needs_cookies(self):
<del> app = flask.Flask(__name__)
<del> app.testing = True
<del> c = app.test_client(use_cookies=False)
<add> rv = c.get('/getsession')
<add> assert rv.data == b'foo'
<add>
<add>def test_session_transactions():
<add> app = flask.Flask(__name__)
<add> app.testing = True
<add> app.secret_key = 'testing'
<add>
<add> @app.route('/')
<add> def index():
<add> return text_type(flask.session['foo'])
<add>
<add> with app.test_client() as c:
<add> with c.session_transaction() as sess:
<add> assert len(sess) == 0
<add> sess['foo'] = [42]
<add> assert len(sess) == 1
<add> rv = c.get('/')
<add> assert rv.data == b'[42]'
<add> with c.session_transaction() as sess:
<add> assert len(sess) == 1
<add> assert sess['foo'] == [42]
<add>
<add>def test_session_transactions_no_null_sessions():
<add> app = flask.Flask(__name__)
<add> app.testing = True
<add>
<add> with app.test_client() as c:
<ide> try:
<del> with c.session_transaction() as s:
<add> with c.session_transaction() as sess:
<ide> pass
<ide> except RuntimeError as e:
<del> assert 'cookies' in str(e)
<add> assert 'Session backend did not open a session' in str(e)
<ide> else:
<ide> assert False, 'Expected runtime error'
<ide>
<del> def test_test_client_context_binding(self):
<del> app = flask.Flask(__name__)
<del> app.config['LOGGER_HANDLER_POLICY'] = 'never'
<del> @app.route('/')
<del> def index():
<del> flask.g.value = 42
<del> return 'Hello World!'
<del>
<del> @app.route('/other')
<del> def other():
<del> 1 // 0
<del>
<del> with app.test_client() as c:
<del> resp = c.get('/')
<del> assert flask.g.value == 42
<del> assert resp.data == b'Hello World!'
<del> assert resp.status_code == 200
<del>
<del> resp = c.get('/other')
<del> assert not hasattr(flask.g, 'value')
<del> assert b'Internal Server Error' in resp.data
<del> assert resp.status_code == 500
<del> flask.g.value = 23
<del>
<del> try:
<del> flask.g.value
<del> except (AttributeError, RuntimeError):
<add>def test_session_transactions_keep_context():
<add> app = flask.Flask(__name__)
<add> app.testing = True
<add> app.secret_key = 'testing'
<add>
<add> with app.test_client() as c:
<add> rv = c.get('/')
<add> req = flask.request._get_current_object()
<add> assert req is not None
<add> with c.session_transaction():
<add> assert req is flask.request._get_current_object()
<add>
<add>def test_session_transaction_needs_cookies():
<add> app = flask.Flask(__name__)
<add> app.testing = True
<add> c = app.test_client(use_cookies=False)
<add> try:
<add> with c.session_transaction() as s:
<ide> pass
<del> else:
<del> raise AssertionError('some kind of exception expected')
<del>
<del> def test_reuse_client(self):
<del> app = flask.Flask(__name__)
<del> c = app.test_client()
<del>
<del> with c:
<del> assert c.get('/').status_code == 404
<del>
<del> with c:
<del> assert c.get('/').status_code == 404
<del>
<del> def test_test_client_calls_teardown_handlers(self):
<del> app = flask.Flask(__name__)
<del> called = []
<del> @app.teardown_request
<del> def remember(error):
<del> called.append(error)
<del>
<del> with app.test_client() as c:
<del> assert called == []
<del> c.get('/')
<del> assert called == []
<add> except RuntimeError as e:
<add> assert 'cookies' in str(e)
<add> else:
<add> assert False, 'Expected runtime error'
<add>
<add>def test_test_client_context_binding():
<add> app = flask.Flask(__name__)
<add> app.config['LOGGER_HANDLER_POLICY'] = 'never'
<add> @app.route('/')
<add> def index():
<add> flask.g.value = 42
<add> return 'Hello World!'
<add>
<add> @app.route('/other')
<add> def other():
<add> 1 // 0
<add>
<add> with app.test_client() as c:
<add> resp = c.get('/')
<add> assert flask.g.value == 42
<add> assert resp.data == b'Hello World!'
<add> assert resp.status_code == 200
<add>
<add> resp = c.get('/other')
<add> assert not hasattr(flask.g, 'value')
<add> assert b'Internal Server Error' in resp.data
<add> assert resp.status_code == 500
<add> flask.g.value = 23
<add>
<add> try:
<add> flask.g.value
<add> except (AttributeError, RuntimeError):
<add> pass
<add> else:
<add> raise AssertionError('some kind of exception expected')
<add>
<add>def test_reuse_client():
<add> app = flask.Flask(__name__)
<add> c = app.test_client()
<add>
<add> with c:
<add> assert c.get('/').status_code == 404
<add>
<add> with c:
<add> assert c.get('/').status_code == 404
<add>
<add>def test_test_client_calls_teardown_handlers():
<add> app = flask.Flask(__name__)
<add> called = []
<add> @app.teardown_request
<add> def remember(error):
<add> called.append(error)
<add>
<add> with app.test_client() as c:
<add> assert called == []
<add> c.get('/')
<add> assert called == []
<add> assert called == [None]
<add>
<add> del called[:]
<add> with app.test_client() as c:
<add> assert called == []
<add> c.get('/')
<add> assert called == []
<add> c.get('/')
<ide> assert called == [None]
<del>
<del> del called[:]
<del> with app.test_client() as c:
<del> assert called == []
<del> c.get('/')
<del> assert called == []
<del> c.get('/')
<del> assert called == [None]
<del> assert called == [None, None]
<del>
<del> def test_full_url_request(self):
<del> app = flask.Flask(__name__)
<del> app.testing = True
<del>
<del> @app.route('/action', methods=['POST'])
<del> def action():
<del> return 'x'
<del>
<del> with app.test_client() as c:
<del> rv = c.post('http://domain.com/action?vodka=42', data={'gin': 43})
<del> assert rv.status_code == 200
<del> assert 'gin' in flask.request.form
<del> assert 'vodka' in flask.request.args
<del>
<del>
<del>class TestSubdomain(object):
<del>
<del> @pytest.fixture
<del> def app(self, request):
<del> app = flask.Flask(__name__)
<del> app.config['SERVER_NAME'] = 'example.com'
<del>
<del> ctx = app.test_request_context()
<del> ctx.push()
<del>
<del> def teardown():
<del> if ctx is not None:
<del> ctx.pop()
<del> request.addfinalizer(teardown)
<del> return app
<del>
<del> @pytest.fixture
<del> def client(self, app):
<del> return app.test_client()
<del>
<del> def test_subdomain(self, app, client):
<del> @app.route('/', subdomain='<company_id>')
<del> def view(company_id):
<del> return company_id
<del>
<add> assert called == [None, None]
<add>
<add>def test_full_url_request():
<add> app = flask.Flask(__name__)
<add> app.testing = True
<add>
<add> @app.route('/action', methods=['POST'])
<add> def action():
<add> return 'x'
<add>
<add> with app.test_client() as c:
<add> rv = c.post('http://domain.com/action?vodka=42', data={'gin': 43})
<add> assert rv.status_code == 200
<add> assert 'gin' in flask.request.form
<add> assert 'vodka' in flask.request.args
<add>
<add>def test_subdomain():
<add> app = flask.Flask(__name__)
<add> app.config['SERVER_NAME'] = 'example.com'
<add> @app.route('/', subdomain='<company_id>')
<add> def view(company_id):
<add> return company_id
<add>
<add> with app.test_request_context():
<ide> url = flask.url_for('view', company_id='xxx')
<del> response = client.get(url)
<ide>
<del> assert 200 == response.status_code
<del> assert b'xxx' == response.data
<add> with app.test_client() as c:
<add> response = c.get(url)
<ide>
<add> assert 200 == response.status_code
<add> assert b'xxx' == response.data
<ide>
<del> def test_nosubdomain(self, app, client):
<del> @app.route('/<company_id>')
<del> def view(company_id):
<del> return company_id
<add>def test_nosubdomain():
<add> app = flask.Flask(__name__)
<add> app.config['SERVER_NAME'] = 'example.com'
<add> @app.route('/<company_id>')
<add> def view(company_id):
<add> return company_id
<ide>
<add> with app.test_request_context():
<ide> url = flask.url_for('view', company_id='xxx')
<del> response = client.get(url)
<ide>
<del> assert 200 == response.status_code
<del> assert b'xxx' == response.data
<add> with app.test_client() as c:
<add> response = c.get(url)
<add>
<add> assert 200 == response.status_code
<add> assert b'xxx' == response.data | 1 |
Ruby | Ruby | replace base#safe_to_array with array.wrap | 3b8853eda45dfcae2a1e71b890668730e63bed02 | <ide><path>activerecord/lib/active_record/base.rb
<ide> def construct_conditions(conditions, scope)
<ide>
<ide> # Merges includes so that the result is a valid +include+
<ide> def merge_includes(first, second)
<del> (safe_to_array(first) + safe_to_array(second)).uniq
<add> (Array.wrap(first) + Array.wrap(second)).uniq
<ide> end
<ide>
<ide> def merge_joins(*joins)
<ide> def merge_joins(*joins)
<ide> end
<ide> joins.flatten.map{|j| j.strip}.uniq
<ide> else
<del> joins.collect{|j| safe_to_array(j)}.flatten.uniq
<add> joins.collect{|j| Array.wrap(j)}.flatten.uniq
<ide> end
<ide> end
<ide>
<ide> def build_association_joins(joins)
<ide> }.join(" ")
<ide> end
<ide>
<del> # Object#to_a is deprecated, though it does have the desired behavior
<del> def safe_to_array(o)
<del> case o
<del> when NilClass
<del> []
<del> when Array
<del> o
<del> else
<del> [o]
<del> end
<del> end
<del>
<ide> def array_of_strings?(o)
<ide> o.is_a?(Array) && o.all?{|obj| obj.is_a?(String)}
<ide> end | 1 |
PHP | PHP | add deprecation warnings for testsuite package | 2d2189fa08eeb368d51f44f08d854018973fff43 | <ide><path>src/TestSuite/Fixture/FixtureManager.php
<ide> protected function _setupTable($fixture, $db, array $sources, $drop = true)
<ide> $table = $fixture->sourceName();
<ide> $exists = in_array($table, $sources);
<ide>
<del> $hasSchema = $fixture instanceof TableSchemaInterface && $fixture->schema() instanceof TableSchema
<del> || $fixture instanceof TableSchemaAwareInterface && $fixture->getTableSchema() instanceof TableSchema;
<add> $hasSchema = $fixture instanceof TableSchemaInterface && $fixture->getTableSchema() instanceof TableSchema;
<ide>
<ide> if (($drop && $exists) || ($exists && !$isFixtureSetup && $hasSchema)) {
<ide> $fixture->drop($db);
<ide><path>src/TestSuite/Fixture/TestFixture.php
<ide> protected function _schemaFromReflection()
<ide> */
<ide> public function schema(TableSchema $schema = null)
<ide> {
<add> deprecationWarning(
<add> 'TestFixture::schema() is deprecated. ' .
<add> 'Use TestFixture::setTableSchema()/getTableSchema() instead.'
<add> );
<ide> if ($schema) {
<ide> $this->setTableSchema($schema);
<ide> }
<ide><path>src/TestSuite/TestCase.php
<ide> public function assertTextNotContains($needle, $haystack, $message = '', $ignore
<ide> */
<ide> public function assertTags($string, $expected, $fullDebug = false)
<ide> {
<del> trigger_error(
<del> 'assertTags() is deprecated, use assertHtml() instead.',
<del> E_USER_DEPRECATED
<del> );
<add> deprecationWarning('TestCase::assertTags() is deprecated. Use TestCase::assertHtml() instead.');
<ide> $this->assertHtml($expected, $string, $fullDebug);
<ide> }
<ide>
<ide><path>tests/TestCase/TestSuite/FixtureManagerTest.php
<ide> public function testFixturizeCoreConstraint()
<ide> $this->manager->load($test);
<ide>
<ide> $table = TableRegistry::get('ArticlesTags');
<del> $schema = $table->schema();
<add> $schema = $table->getSchema();
<ide> $expectedConstraint = [
<ide> 'type' => 'foreign',
<ide> 'columns' => [
<ide> public function testFixturizeCoreConstraint()
<ide>
<ide> $this->manager->load($test);
<ide> $table = TableRegistry::get('ArticlesTags');
<del> $schema = $table->schema();
<add> $schema = $table->getSchema();
<ide> $expectedConstraint = [
<ide> 'type' => 'foreign',
<ide> 'columns' => [
<ide> public function testLoadSingle()
<ide>
<ide> $table = TableRegistry::get('ArticlesTags');
<ide> $results = $table->find('all')->toArray();
<del> $schema = $table->schema();
<add> $schema = $table->getSchema();
<ide> $expectedConstraint = [
<ide> 'type' => 'foreign',
<ide> 'columns' => [
<ide> public function testLoadSingle()
<ide>
<ide> $table = TableRegistry::get('ArticlesTags');
<ide> $results = $table->find('all')->toArray();
<del> $schema = $table->schema();
<add> $schema = $table->getSchema();
<ide> $expectedConstraint = [
<ide> 'type' => 'foreign',
<ide> 'columns' => [
<ide><path>tests/TestCase/TestSuite/TestFixtureTest.php
<ide> public function testInitStaticFixture()
<ide> $Fixture->init();
<ide> $this->assertEquals('articles', $Fixture->table);
<ide>
<del> $schema = $Fixture->schema();
<add> $schema = $Fixture->getTableSchema();
<ide> $this->assertInstanceOf('Cake\Database\Schema\Table', $schema);
<ide>
<ide> $fields = $Fixture->fields;
<ide> public function testInitImport()
<ide> 'body',
<ide> 'published',
<ide> ];
<del> $this->assertEquals($expected, $fixture->schema()->columns());
<add> $this->assertEquals($expected, $fixture->getTableSchema()->columns());
<ide> }
<ide>
<ide> /**
<ide> public function testInitImportModel()
<ide> 'body',
<ide> 'published',
<ide> ];
<del> $this->assertEquals($expected, $fixture->schema()->columns());
<add> $this->assertEquals($expected, $fixture->getTableSchema()->columns());
<ide> }
<ide>
<ide> /**
<ide> public function testInitNoImportNoFields()
<ide>
<ide> $fixture = new LettersFixture();
<ide> $fixture->init();
<del> $this->assertEquals(['id', 'letter'], $fixture->schema()->columns());
<add> $this->assertEquals(['id', 'letter'], $fixture->getTableSchema()->columns());
<ide>
<ide> $db = $this->getMockBuilder('Cake\Database\Connection')
<ide> ->setMethods(['prepare', 'execute'])
<ide> public function testCreate()
<ide> ->method('createSql')
<ide> ->with($db)
<ide> ->will($this->returnValue(['sql', 'sql']));
<del> $fixture->schema($table);
<add> $fixture->setTableSchema($table);
<ide>
<ide> $statement = $this->getMockBuilder('\PDOStatement')
<ide> ->setMethods(['execute', 'closeCursor'])
<ide> public function testCreateError()
<ide> ->method('createSql')
<ide> ->with($db)
<ide> ->will($this->throwException(new Exception('oh noes')));
<del> $fixture->schema($table);
<add> $fixture->setTableSchema($table);
<ide>
<ide> $fixture->create($db);
<ide> }
<ide> public function testDrop()
<ide> ->method('dropSql')
<ide> ->with($db)
<ide> ->will($this->returnValue(['sql']));
<del> $fixture->schema($table);
<add> $fixture->setTableSchema($table);
<ide>
<ide> $this->assertTrue($fixture->drop($db));
<ide> }
<ide> public function testTruncate()
<ide> ->method('truncateSql')
<ide> ->with($db)
<ide> ->will($this->returnValue(['sql']));
<del> $fixture->schema($table);
<add> $fixture->setTableSchema($table);
<ide>
<ide> $this->assertTrue($fixture->truncate($db));
<ide> } | 5 |
Javascript | Javascript | update user model | 4809f8b13877648853e43b0e6cf8657309f6c356 | <ide><path>get-emails.js
<ide> MongoClient.connect(secrets.db, function(err, database) {
<ide> {$match: { 'email': { $exists: true } } },
<ide> {$match: { 'email': { $ne: '' } } },
<ide> {$match: { 'email': { $ne: null } } },
<del> {$match: { 'sendMonthlyEmail': true } },
<add> {$match: { 'sendQuincyEmail': true } },
<ide> {$match: { 'email': { $not: /(test|fake)/i } } },
<ide> {$group: { '_id': 1, 'emails': {$addToSet: '$email' } } }
<ide> ], function(err, results) {
<ide><path>loopbackMigration.js
<del>/* eslint-disable no-process-exit */
<del>require('dotenv').load();
<del>var Rx = require('rx'),
<del> uuid = require('uuid'),
<del> assign = require('lodash/object/assign'),
<del> mongodb = require('mongodb'),
<del> secrets = require('../config/secrets');
<del>
<del>const batchSize = 20;
<del>var MongoClient = mongodb.MongoClient;
<del>Rx.config.longStackSupport = true;
<del>
<del>var providers = [
<del> 'facebook',
<del> 'twitter',
<del> 'google',
<del> 'github',
<del> 'linkedin'
<del>];
<del>
<del>// create async console.logs
<del>function debug() {
<del> var args = [].slice.call(arguments);
<del> process.nextTick(function() {
<del> console.log.apply(console, args);
<del> });
<del>}
<del>
<del>function createConnection(URI) {
<del> return Rx.Observable.create(function(observer) {
<del> debug('connecting to db');
<del> MongoClient.connect(URI, function(err, database) {
<del> if (err) {
<del> return observer.onError(err);
<del> }
<del> debug('db connected');
<del> observer.onNext(database);
<del> observer.onCompleted();
<del> });
<del> });
<del>}
<del>
<del>function createQuery(db, collection, options, batchSize) {
<del> return Rx.Observable.create(function(observer) {
<del> var cursor = db.collection(collection).find({}, options);
<del> cursor.batchSize(batchSize || 20);
<del> // Cursor.each will yield all doc from a batch in the same tick,
<del> // or schedule getting next batch on nextTick
<del> debug('opening cursor for %s', collection);
<del> cursor.each(function(err, doc) {
<del> if (err) {
<del> return observer.onError(err);
<del> }
<del> if (!doc) {
<del> console.log('onCompleted');
<del> return observer.onCompleted();
<del> }
<del> observer.onNext(doc);
<del> });
<del>
<del> return Rx.Disposable.create(function() {
<del> debug('closing cursor for %s', collection);
<del> cursor.close();
<del> });
<del> });
<del>}
<del>
<del>function getUserCount(db) {
<del> return Rx.Observable.create(function(observer) {
<del> var cursor = db.collection('users').count(function(err, count) {
<del> if (err) {
<del> return observer.onError(err);
<del> }
<del> observer.onNext(count);
<del> observer.onCompleted();
<del>
<del> return Rx.Disposable.create(function() {
<del> debug('closing user count');
<del> cursor.close();
<del> });
<del> });
<del> });
<del>}
<del>
<del>function insertMany(db, collection, users, options) {
<del> return Rx.Observable.create(function(observer) {
<del> db.collection(collection).insertMany(users, options, function(err) {
<del> if (err) {
<del> return observer.onError(err);
<del> }
<del> observer.onNext();
<del> observer.onCompleted();
<del> });
<del> });
<del>}
<del>
<del>var count = 0;
<del>// will supply our db object
<del>var dbObservable = createConnection(secrets.db).replay();
<del>
<del>var totalUser = dbObservable
<del> .flatMap(function(db) {
<del> return getUserCount(db);
<del> })
<del> .shareReplay();
<del>
<del>var users = dbObservable
<del> .flatMap(function(db) {
<del> // returns user document, n users per loop where n is the batchsize.
<del> return createQuery(db, 'users', {}, batchSize);
<del> })
<del> .map(function(user) {
<del> // flatten user
<del> assign(user, user.portfolio, user.profile);
<del> if (!user.username) {
<del> user.username = 'fcc' + uuid.v4().slice(0, 8);
<del> }
<del> if (user.github) {
<del> user.isGithubCool = true;
<del> } else {
<del> user.isMigrationGrandfathered = true;
<del> }
<del> providers.forEach(function(provider) {
<del> user[provider + 'id'] = user[provider];
<del> user[provider] = null;
<del> });
<del> user.rand = Math.random();
<del>
<del> return user;
<del> })
<del> .shareReplay();
<del>
<del>// batch them into arrays of twenty documents
<del>var userSavesCount = users
<del> .bufferWithCount(batchSize)
<del> // get bd object ready for insert
<del> .withLatestFrom(dbObservable, function(users, db) {
<del> return {
<del> users: users,
<del> db: db
<del> };
<del> })
<del> .flatMap(function(dats) {
<del> // bulk insert into new collection for loopback
<del> return insertMany(dats.db, 'user', dats.users, { w: 1 });
<del> })
<del> .flatMap(function() {
<del> return totalUser;
<del> })
<del> .doOnNext(function(totalUsers) {
<del> count = count + batchSize;
<del> debug('user progress %s', count / totalUsers * 100);
<del> })
<del> // count how many times insert completes
<del> .count();
<del>
<del>// create User Identities
<del>var userIdentityCount = users
<del> .flatMap(function(user) {
<del> var ids = providers
<del> .map(function(provider) {
<del> return {
<del> provider: provider,
<del> externalId: user[provider + 'id'],
<del> userId: user._id || user.id
<del> };
<del> })
<del> .filter(function(ident) {
<del> return !!ident.externalId;
<del> });
<del>
<del> return Rx.Observable.from(ids);
<del> })
<del> .bufferWithCount(batchSize)
<del> .withLatestFrom(dbObservable, function(identities, db) {
<del> return {
<del> identities: identities,
<del> db: db
<del> };
<del> })
<del> .flatMap(function(dats) {
<del> // bulk insert into new collection for loopback
<del> return insertMany(dats.db, 'userIdentity', dats.identities, { w: 1 });
<del> })
<del> // count how many times insert completes
<del> .count();
<del>
<del>/*
<del>var storyCount = dbObservable
<del> .flatMap(function(db) {
<del> return createQuery(db, 'stories', {}, batchSize);
<del> })
<del> .bufferWithCount(batchSize)
<del> .withLatestFrom(dbObservable, function(stories, db) {
<del> return {
<del> stories: stories,
<del> db: db
<del> };
<del> })
<del> .flatMap(function(dats) {
<del> return insertMany(dats.db, 'story', dats.stories, { w: 1 });
<del> })
<del> .count();
<del> */
<del>
<del>Rx.Observable.combineLatest(
<del> userIdentityCount,
<del> userSavesCount,
<del> // storyCount,
<del> function(userIdentCount, userCount) {
<del> return {
<del> userIdentCount: userIdentCount * batchSize,
<del> userCount: userCount * batchSize
<del> // storyCount: storyCount * batchSize
<del> };
<del> })
<del> .subscribe(
<del> function(countObj) {
<del> console.log('next');
<del> count = countObj;
<del> },
<del> function(err) {
<del> console.error('an error occured', err, err.stack);
<del> },
<del> function() {
<del> console.log('finished with ', count);
<del> process.exit(0);
<del> }
<del> );
<del>
<del>dbObservable.connect(); | 2 |
Ruby | Ruby | fix audit --online | 6a15cea0b447d8cdf5e8e9f5d99f5bdbcec405a6 | <ide><path>Library/Homebrew/cmd/style.rb
<ide> def check_style_impl(files, output_type, options = {})
<ide> args << "--auto-correct" if fix
<ide>
<ide> if options[:except_cops]
<del> options[:except_cops].map! { |cop| RuboCop::Cop::Cop.registry.qualified_cop_name(cop, "") }
<add> options[:except_cops].map! { |cop| RuboCop::Cop::Cop.registry.qualified_cop_name(cop.to_s, "") }
<ide> cops_to_exclude = options[:except_cops].select do |cop|
<ide> RuboCop::Cop::Cop.registry.names.include?(cop) ||
<ide> RuboCop::Cop::Cop.registry.departments.include?(cop.to_sym)
<ide> end
<ide>
<ide> args << "--except" << cops_to_exclude.join(",") unless cops_to_exclude.empty?
<ide> elsif options[:only_cops]
<del> options[:only_cops].map! { |cop| RuboCop::Cop::Cop.registry.qualified_cop_name(cop, "") }
<add> options[:only_cops].map! { |cop| RuboCop::Cop::Cop.registry.qualified_cop_name(cop.to_s, "") }
<ide> cops_to_include = options[:only_cops].select do |cop|
<ide> RuboCop::Cop::Cop.registry.names.include?(cop) ||
<ide> RuboCop::Cop::Cop.registry.departments.include?(cop.to_sym) | 1 |
Go | Go | remove job from `docker images` | d045b9776b5dc16e12b3d7c7558a24cdc5d1aba7 | <ide><path>api/server/server.go
<ide> import (
<ide> "github.com/docker/docker/daemon"
<ide> "github.com/docker/docker/daemon/networkdriver/bridge"
<ide> "github.com/docker/docker/engine"
<add> "github.com/docker/docker/graph"
<ide> "github.com/docker/docker/pkg/jsonmessage"
<ide> "github.com/docker/docker/pkg/parsers"
<ide> "github.com/docker/docker/pkg/parsers/filters"
<ide> func getImagesJSON(eng *engine.Engine, version version.Version, w http.ResponseW
<ide> return err
<ide> }
<ide>
<del> var (
<del> err error
<del> outs *engine.Table
<del> job = eng.Job("images")
<del> )
<del>
<del> job.Setenv("filters", r.Form.Get("filters"))
<del> // FIXME this parameter could just be a match filter
<del> job.Setenv("filter", r.Form.Get("filter"))
<del> job.Setenv("all", r.Form.Get("all"))
<add> imagesConfig := graph.ImagesConfig{
<add> Filters: r.Form.Get("filters"),
<add> // FIXME this parameter could just be a match filter
<add> Filter: r.Form.Get("filter"),
<add> All: toBool(r.Form.Get("all")),
<add> }
<ide>
<del> if version.GreaterThanOrEqualTo("1.7") {
<del> streamJSON(job, w, false)
<del> } else if outs, err = job.Stdout.AddListTable(); err != nil {
<add> images, err := getDaemon(eng).Repositories().Images(&imagesConfig)
<add> if err != nil {
<ide> return err
<ide> }
<ide>
<del> if err := job.Run(); err != nil {
<del> return err
<add> if version.GreaterThanOrEqualTo("1.7") {
<add> return writeJSON(w, http.StatusOK, images)
<ide> }
<ide>
<del> if version.LessThan("1.7") && outs != nil { // Convert to legacy format
<del> outsLegacy := engine.NewTable("Created", 0)
<del> for _, out := range outs.Data {
<del> for _, repoTag := range out.GetList("RepoTags") {
<del> repo, tag := parsers.ParseRepositoryTag(repoTag)
<del> outLegacy := &engine.Env{}
<del> outLegacy.Set("Repository", repo)
<del> outLegacy.SetJson("Tag", tag)
<del> outLegacy.Set("Id", out.Get("Id"))
<del> outLegacy.SetInt64("Created", out.GetInt64("Created"))
<del> outLegacy.SetInt64("Size", out.GetInt64("Size"))
<del> outLegacy.SetInt64("VirtualSize", out.GetInt64("VirtualSize"))
<del> outsLegacy.Add(outLegacy)
<add> legacyImages := []types.LegacyImage{}
<add>
<add> for _, image := range images {
<add> for _, repoTag := range image.RepoTags {
<add> repo, tag := parsers.ParseRepositoryTag(repoTag)
<add> legacyImage := types.LegacyImage{
<add> Repository: repo,
<add> Tag: tag,
<add> ID: image.ID,
<add> Created: image.Created,
<add> Size: image.Size,
<add> VirtualSize: image.VirtualSize,
<ide> }
<del> }
<del> w.Header().Set("Content-Type", "application/json")
<del> if _, err := outsLegacy.WriteListTo(w); err != nil {
<del> return err
<add> legacyImages = append(legacyImages, legacyImage)
<ide> }
<ide> }
<del> return nil
<add>
<add> return writeJSON(w, http.StatusOK, legacyImages)
<ide> }
<ide>
<ide> func getImagesViz(eng *engine.Engine, version version.Version, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
<ide> func getContainersJSON(eng *engine.Engine, version version.Version, w http.Respo
<ide> }
<ide>
<ide> config := &daemon.ContainersConfig{
<del> All: r.Form.Get("all") == "1",
<del> Size: r.Form.Get("size") == "1",
<add> All: toBool(r.Form.Get("all")),
<add> Size: toBool(r.Form.Get("size")),
<ide> Since: r.Form.Get("since"),
<ide> Before: r.Form.Get("before"),
<ide> Filters: r.Form.Get("filters"),
<ide> func postBuild(eng *engine.Engine, version version.Version, w http.ResponseWrite
<ide> job.Stdout.Add(utils.NewWriteFlusher(w))
<ide> }
<ide>
<del> if r.FormValue("forcerm") == "1" && version.GreaterThanOrEqualTo("1.12") {
<add> if toBool(r.FormValue("forcerm")) && version.GreaterThanOrEqualTo("1.12") {
<ide> job.Setenv("rm", "1")
<ide> } else if r.FormValue("rm") == "" && version.GreaterThanOrEqualTo("1.12") {
<ide> job.Setenv("rm", "1")
<ide> } else {
<ide> job.Setenv("rm", r.FormValue("rm"))
<ide> }
<del> if r.FormValue("pull") == "1" && version.GreaterThanOrEqualTo("1.16") {
<add> if toBool(r.FormValue("pull")) && version.GreaterThanOrEqualTo("1.16") {
<ide> job.Setenv("pull", "1")
<ide> }
<ide> job.Stdin.Add(r.Body)
<ide> func ServeApi(job *engine.Job) error {
<ide>
<ide> return nil
<ide> }
<add>
<add>func toBool(s string) bool {
<add> s = strings.ToLower(strings.TrimSpace(s))
<add> return !(s == "" || s == "0" || s == "no" || s == "false" || s == "none")
<add>}
<ide><path>api/server/server_unit_test.go
<ide> import (
<ide> "io"
<ide> "net/http"
<ide> "net/http/httptest"
<del> "reflect"
<ide> "strings"
<ide> "testing"
<ide>
<ide> func TestGetInfo(t *testing.T) {
<ide> assertContentType(r, "application/json", t)
<ide> }
<ide>
<del>func TestGetImagesJSON(t *testing.T) {
<del> eng := engine.New()
<del> var called bool
<del> eng.Register("images", func(job *engine.Job) error {
<del> called = true
<del> v := createEnvFromGetImagesJSONStruct(sampleImage)
<del> if err := json.NewEncoder(job.Stdout).Encode(v); err != nil {
<del> return err
<del> }
<del> return nil
<del> })
<del> r := serveRequest("GET", "/images/json", nil, eng, t)
<del> if !called {
<del> t.Fatal("handler was not called")
<del> }
<del> assertHttpNotError(r, t)
<del> assertContentType(r, "application/json", t)
<del> var observed getImagesJSONStruct
<del> if err := json.Unmarshal(r.Body.Bytes(), &observed); err != nil {
<del> t.Fatal(err)
<del> }
<del> if !reflect.DeepEqual(observed, sampleImage) {
<del> t.Errorf("Expected %#v but got %#v", sampleImage, observed)
<del> }
<del>}
<del>
<del>func TestGetImagesJSONFilter(t *testing.T) {
<del> eng := engine.New()
<del> filter := "nothing"
<del> eng.Register("images", func(job *engine.Job) error {
<del> filter = job.Getenv("filter")
<del> return nil
<del> })
<del> serveRequest("GET", "/images/json?filter=aaaa", nil, eng, t)
<del> if filter != "aaaa" {
<del> t.Errorf("%#v", filter)
<del> }
<del>}
<del>
<del>func TestGetImagesJSONFilters(t *testing.T) {
<del> eng := engine.New()
<del> filter := "nothing"
<del> eng.Register("images", func(job *engine.Job) error {
<del> filter = job.Getenv("filters")
<del> return nil
<del> })
<del> serveRequest("GET", "/images/json?filters=nnnn", nil, eng, t)
<del> if filter != "nnnn" {
<del> t.Errorf("%#v", filter)
<del> }
<del>}
<del>
<del>func TestGetImagesJSONAll(t *testing.T) {
<del> eng := engine.New()
<del> allFilter := "-1"
<del> eng.Register("images", func(job *engine.Job) error {
<del> allFilter = job.Getenv("all")
<del> return nil
<del> })
<del> serveRequest("GET", "/images/json?all=1", nil, eng, t)
<del> if allFilter != "1" {
<del> t.Errorf("%#v", allFilter)
<del> }
<del>}
<del>
<del>func TestGetImagesJSONLegacyFormat(t *testing.T) {
<del> eng := engine.New()
<del> var called bool
<del> eng.Register("images", func(job *engine.Job) error {
<del> called = true
<del> images := []types.Image{
<del> createEnvFromGetImagesJSONStruct(sampleImage),
<del> }
<del> if err := json.NewEncoder(job.Stdout).Encode(images); err != nil {
<del> return err
<del> }
<del> return nil
<del> })
<del> r := serveRequestUsingVersion("GET", "/images/json", "1.6", nil, eng, t)
<del> if !called {
<del> t.Fatal("handler was not called")
<del> }
<del> assertHttpNotError(r, t)
<del> assertContentType(r, "application/json", t)
<del> images := engine.NewTable("Created", 0)
<del> if _, err := images.ReadListFrom(r.Body.Bytes()); err != nil {
<del> t.Fatal(err)
<del> }
<del> if images.Len() != 1 {
<del> t.Fatalf("Expected 1 image, %d found", images.Len())
<del> }
<del> image := images.Data[0]
<del> if image.Get("Tag") != "test-tag" {
<del> t.Errorf("Expected tag 'test-tag', found '%s'", image.Get("Tag"))
<del> }
<del> if image.Get("Repository") != "test-name" {
<del> t.Errorf("Expected repository 'test-name', found '%s'", image.Get("Repository"))
<del> }
<del>}
<del>
<ide> func TestGetContainersByName(t *testing.T) {
<ide> eng := engine.New()
<ide> name := "container_name"
<ide><path>api/types/types.go
<ide> type Image struct {
<ide> Labels map[string]string
<ide> }
<ide>
<add>type LegacyImage struct {
<add> ID string `json:"Id"`
<add> Repository string
<add> Tag string
<add> Created int
<add> Size int
<add> VirtualSize int
<add>}
<add>
<ide> // GET "/containers/json"
<ide> type Port struct {
<ide> IP string
<ide><path>engine/streams.go
<ide> import (
<ide> "bytes"
<ide> "fmt"
<ide> "io"
<del> "io/ioutil"
<ide> "strings"
<ide> "sync"
<ide> "unicode"
<ide> func (o *Output) AddEnv() (dst *Env, err error) {
<ide> }()
<ide> return dst, nil
<ide> }
<del>
<del>func (o *Output) AddListTable() (dst *Table, err error) {
<del> src, err := o.AddPipe()
<del> if err != nil {
<del> return nil, err
<del> }
<del> dst = NewTable("", 0)
<del> o.tasks.Add(1)
<del> go func() {
<del> defer o.tasks.Done()
<del> content, err := ioutil.ReadAll(src)
<del> if err != nil {
<del> return
<del> }
<del> if _, err := dst.ReadListFrom(content); err != nil {
<del> return
<del> }
<del> }()
<del> return dst, nil
<del>}
<del>
<del>func (o *Output) AddTable() (dst *Table, err error) {
<del> src, err := o.AddPipe()
<del> if err != nil {
<del> return nil, err
<del> }
<del> dst = NewTable("", 0)
<del> o.tasks.Add(1)
<del> go func() {
<del> defer o.tasks.Done()
<del> if _, err := dst.ReadFrom(src); err != nil {
<del> return
<del> }
<del> }()
<del> return dst, nil
<del>}
<ide><path>engine/table.go
<del>package engine
<del>
<del>import (
<del> "bytes"
<del> "encoding/json"
<del> "io"
<del> "sort"
<del> "strconv"
<del>)
<del>
<del>type Table struct {
<del> Data []*Env
<del> sortKey string
<del> Chan chan *Env
<del>}
<del>
<del>func NewTable(sortKey string, sizeHint int) *Table {
<del> return &Table{
<del> make([]*Env, 0, sizeHint),
<del> sortKey,
<del> make(chan *Env),
<del> }
<del>}
<del>
<del>func (t *Table) SetKey(sortKey string) {
<del> t.sortKey = sortKey
<del>}
<del>
<del>func (t *Table) Add(env *Env) {
<del> t.Data = append(t.Data, env)
<del>}
<del>
<del>func (t *Table) Len() int {
<del> return len(t.Data)
<del>}
<del>
<del>func (t *Table) Less(a, b int) bool {
<del> return t.lessBy(a, b, t.sortKey)
<del>}
<del>
<del>func (t *Table) lessBy(a, b int, by string) bool {
<del> keyA := t.Data[a].Get(by)
<del> keyB := t.Data[b].Get(by)
<del> intA, errA := strconv.ParseInt(keyA, 10, 64)
<del> intB, errB := strconv.ParseInt(keyB, 10, 64)
<del> if errA == nil && errB == nil {
<del> return intA < intB
<del> }
<del> return keyA < keyB
<del>}
<del>
<del>func (t *Table) Swap(a, b int) {
<del> tmp := t.Data[a]
<del> t.Data[a] = t.Data[b]
<del> t.Data[b] = tmp
<del>}
<del>
<del>func (t *Table) Sort() {
<del> sort.Sort(t)
<del>}
<del>
<del>func (t *Table) ReverseSort() {
<del> sort.Sort(sort.Reverse(t))
<del>}
<del>
<del>func (t *Table) WriteListTo(dst io.Writer) (n int64, err error) {
<del> if _, err := dst.Write([]byte{'['}); err != nil {
<del> return -1, err
<del> }
<del> n = 1
<del> for i, env := range t.Data {
<del> bytes, err := env.WriteTo(dst)
<del> if err != nil {
<del> return -1, err
<del> }
<del> n += bytes
<del> if i != len(t.Data)-1 {
<del> if _, err := dst.Write([]byte{','}); err != nil {
<del> return -1, err
<del> }
<del> n++
<del> }
<del> }
<del> if _, err := dst.Write([]byte{']'}); err != nil {
<del> return -1, err
<del> }
<del> return n + 1, nil
<del>}
<del>
<del>func (t *Table) ToListString() (string, error) {
<del> buffer := bytes.NewBuffer(nil)
<del> if _, err := t.WriteListTo(buffer); err != nil {
<del> return "", err
<del> }
<del> return buffer.String(), nil
<del>}
<del>
<del>func (t *Table) WriteTo(dst io.Writer) (n int64, err error) {
<del> for _, env := range t.Data {
<del> bytes, err := env.WriteTo(dst)
<del> if err != nil {
<del> return -1, err
<del> }
<del> n += bytes
<del> }
<del> return n, nil
<del>}
<del>
<del>func (t *Table) ReadListFrom(src []byte) (n int64, err error) {
<del> var array []interface{}
<del>
<del> if err := json.Unmarshal(src, &array); err != nil {
<del> return -1, err
<del> }
<del>
<del> for _, item := range array {
<del> if m, ok := item.(map[string]interface{}); ok {
<del> env := &Env{}
<del> for key, value := range m {
<del> env.SetAuto(key, value)
<del> }
<del> t.Add(env)
<del> }
<del> }
<del>
<del> return int64(len(src)), nil
<del>}
<del>
<del>func (t *Table) ReadFrom(src io.Reader) (n int64, err error) {
<del> decoder := NewDecoder(src)
<del> for {
<del> env, err := decoder.Decode()
<del> if err == io.EOF {
<del> return 0, nil
<del> } else if err != nil {
<del> return -1, err
<del> }
<del> t.Add(env)
<del> }
<del>}
<ide><path>engine/table_test.go
<del>package engine
<del>
<del>import (
<del> "bytes"
<del> "encoding/json"
<del> "testing"
<del>)
<del>
<del>func TestTableWriteTo(t *testing.T) {
<del> table := NewTable("", 0)
<del> e := &Env{}
<del> e.Set("foo", "bar")
<del> table.Add(e)
<del> var buf bytes.Buffer
<del> if _, err := table.WriteTo(&buf); err != nil {
<del> t.Fatal(err)
<del> }
<del> output := make(map[string]string)
<del> if err := json.Unmarshal(buf.Bytes(), &output); err != nil {
<del> t.Fatal(err)
<del> }
<del> if len(output) != 1 {
<del> t.Fatalf("Incorrect output: %v", output)
<del> }
<del> if val, exists := output["foo"]; !exists || val != "bar" {
<del> t.Fatalf("Inccorect output: %v", output)
<del> }
<del>}
<del>
<del>func TestTableSortStringValue(t *testing.T) {
<del> table := NewTable("Key", 0)
<del>
<del> e := &Env{}
<del> e.Set("Key", "A")
<del> table.Add(e)
<del>
<del> e = &Env{}
<del> e.Set("Key", "D")
<del> table.Add(e)
<del>
<del> e = &Env{}
<del> e.Set("Key", "B")
<del> table.Add(e)
<del>
<del> e = &Env{}
<del> e.Set("Key", "C")
<del> table.Add(e)
<del>
<del> table.Sort()
<del>
<del> if len := table.Len(); len != 4 {
<del> t.Fatalf("Expected 4, got %d", len)
<del> }
<del>
<del> if value := table.Data[0].Get("Key"); value != "A" {
<del> t.Fatalf("Expected A, got %s", value)
<del> }
<del>
<del> if value := table.Data[1].Get("Key"); value != "B" {
<del> t.Fatalf("Expected B, got %s", value)
<del> }
<del>
<del> if value := table.Data[2].Get("Key"); value != "C" {
<del> t.Fatalf("Expected C, got %s", value)
<del> }
<del>
<del> if value := table.Data[3].Get("Key"); value != "D" {
<del> t.Fatalf("Expected D, got %s", value)
<del> }
<del>}
<del>
<del>func TestTableReverseSortStringValue(t *testing.T) {
<del> table := NewTable("Key", 0)
<del>
<del> e := &Env{}
<del> e.Set("Key", "A")
<del> table.Add(e)
<del>
<del> e = &Env{}
<del> e.Set("Key", "D")
<del> table.Add(e)
<del>
<del> e = &Env{}
<del> e.Set("Key", "B")
<del> table.Add(e)
<del>
<del> e = &Env{}
<del> e.Set("Key", "C")
<del> table.Add(e)
<del>
<del> table.ReverseSort()
<del>
<del> if len := table.Len(); len != 4 {
<del> t.Fatalf("Expected 4, got %d", len)
<del> }
<del>
<del> if value := table.Data[0].Get("Key"); value != "D" {
<del> t.Fatalf("Expected D, got %s", value)
<del> }
<del>
<del> if value := table.Data[1].Get("Key"); value != "C" {
<del> t.Fatalf("Expected B, got %s", value)
<del> }
<del>
<del> if value := table.Data[2].Get("Key"); value != "B" {
<del> t.Fatalf("Expected C, got %s", value)
<del> }
<del>
<del> if value := table.Data[3].Get("Key"); value != "A" {
<del> t.Fatalf("Expected A, got %s", value)
<del> }
<del>}
<ide><path>graph/list.go
<ide> package graph
<ide>
<ide> import (
<del> "encoding/json"
<ide> "fmt"
<ide> "log"
<ide> "path"
<ide> "sort"
<ide> "strings"
<ide>
<ide> "github.com/docker/docker/api/types"
<del> "github.com/docker/docker/engine"
<ide> "github.com/docker/docker/image"
<ide> "github.com/docker/docker/pkg/parsers/filters"
<ide> "github.com/docker/docker/utils"
<ide> var acceptedImageFilterTags = map[string]struct{}{
<ide> "label": {},
<ide> }
<ide>
<add>type ImagesConfig struct {
<add> Filters string
<add> Filter string
<add> All bool
<add>}
<add>
<ide> type ByCreated []*types.Image
<ide>
<ide> func (r ByCreated) Len() int { return len(r) }
<ide> func (r ByCreated) Swap(i, j int) { r[i], r[j] = r[j], r[i] }
<ide> func (r ByCreated) Less(i, j int) bool { return r[i].Created < r[j].Created }
<ide>
<del>func (s *TagStore) CmdImages(job *engine.Job) error {
<add>func (s *TagStore) Images(config *ImagesConfig) ([]*types.Image, error) {
<ide> var (
<ide> allImages map[string]*image.Image
<ide> err error
<ide> filtTagged = true
<ide> filtLabel = false
<ide> )
<ide>
<del> imageFilters, err := filters.FromParam(job.Getenv("filters"))
<add> imageFilters, err := filters.FromParam(config.Filters)
<ide> if err != nil {
<del> return err
<add> return nil, err
<ide> }
<ide> for name := range imageFilters {
<ide> if _, ok := acceptedImageFilterTags[name]; !ok {
<del> return fmt.Errorf("Invalid filter '%s'", name)
<add> return nil, fmt.Errorf("Invalid filter '%s'", name)
<ide> }
<ide> }
<ide>
<ide> func (s *TagStore) CmdImages(job *engine.Job) error {
<ide>
<ide> _, filtLabel = imageFilters["label"]
<ide>
<del> if job.GetenvBool("all") && filtTagged {
<add> if config.All && filtTagged {
<ide> allImages, err = s.graph.Map()
<ide> } else {
<ide> allImages, err = s.graph.Heads()
<ide> }
<ide> if err != nil {
<del> return err
<add> return nil, err
<ide> }
<ide>
<ide> lookup := make(map[string]*types.Image)
<ide> s.Lock()
<ide> for repoName, repository := range s.Repositories {
<del> if job.Getenv("filter") != "" {
<del> if match, _ := path.Match(job.Getenv("filter"), repoName); !match {
<add> if config.Filter != "" {
<add> if match, _ := path.Match(config.Filter, repoName); !match {
<ide> continue
<ide> }
<ide> }
<ide> func (s *TagStore) CmdImages(job *engine.Job) error {
<ide> }
<ide>
<ide> // Display images which aren't part of a repository/tag
<del> if job.Getenv("filter") == "" || filtLabel {
<add> if config.Filter == "" || filtLabel {
<ide> for _, image := range allImages {
<ide> if !imageFilters.MatchKVList("label", image.ContainerConfig.Labels) {
<ide> continue
<ide> func (s *TagStore) CmdImages(job *engine.Job) error {
<ide>
<ide> sort.Sort(sort.Reverse(ByCreated(images)))
<ide>
<del> if err = json.NewEncoder(job.Stdout).Encode(images); err != nil {
<del> return err
<del> }
<del> return nil
<add> return images, nil
<ide> }
<ide><path>graph/service.go
<ide> func (s *TagStore) Install(eng *engine.Engine) error {
<ide> "image_tarlayer": s.CmdTarLayer,
<ide> "image_export": s.CmdImageExport,
<ide> "history": s.CmdHistory,
<del> "images": s.CmdImages,
<ide> "viz": s.CmdViz,
<ide> "load": s.CmdLoad,
<ide> "import": s.CmdImport,
<ide><path>integration-cli/docker_api_images_test.go
<add>package main
<add>
<add>import (
<add> "encoding/json"
<add> "testing"
<add>
<add> "github.com/docker/docker/api/types"
<add>)
<add>
<add>func TestLegacyImages(t *testing.T) {
<add> body, err := sockRequest("GET", "/v1.6/images/json", nil)
<add> if err != nil {
<add> t.Fatalf("Error on GET: %s", err)
<add> }
<add>
<add> images := []types.LegacyImage{}
<add> if err = json.Unmarshal(body, &images); err != nil {
<add> t.Fatalf("Error on unmarshal: %s", err)
<add> }
<add>
<add> if len(images) == 0 || images[0].Tag == "" || images[0].Repository == "" {
<add> t.Fatalf("Bad data: %q", images)
<add> }
<add>
<add> logDone("images - checking legacy json")
<add>}
<ide><path>integration/api_test.go
<ide> func TestDeleteImages(t *testing.T) {
<ide>
<ide> images := getImages(eng, t, true, "")
<ide>
<del> if len(images.Data[0].GetList("RepoTags")) != len(initialImages.Data[0].GetList("RepoTags"))+1 {
<del> t.Errorf("Expected %d images, %d found", len(initialImages.Data[0].GetList("RepoTags"))+1, len(images.Data[0].GetList("RepoTags")))
<add> if len(images[0].RepoTags) != len(initialImages[0].RepoTags)+1 {
<add> t.Errorf("Expected %d images, %d found", len(initialImages[0].RepoTags)+1, len(images[0].RepoTags))
<ide> }
<ide>
<ide> req, err := http.NewRequest("DELETE", "/images/"+unitTestImageID, nil)
<ide> func TestDeleteImages(t *testing.T) {
<ide> }
<ide> images = getImages(eng, t, false, "")
<ide>
<del> if images.Len() != initialImages.Len() {
<del> t.Errorf("Expected %d image, %d found", initialImages.Len(), images.Len())
<add> if len(images) != len(initialImages) {
<add> t.Errorf("Expected %d image, %d found", len(initialImages), len(images))
<ide> }
<ide> }
<ide>
<ide><path>integration/runtime_test.go
<ide> import (
<ide> "github.com/docker/docker/daemon"
<ide> "github.com/docker/docker/daemon/execdriver"
<ide> "github.com/docker/docker/engine"
<add> "github.com/docker/docker/graph"
<ide> "github.com/docker/docker/image"
<ide> "github.com/docker/docker/nat"
<ide> "github.com/docker/docker/pkg/ioutils"
<ide> func cleanup(eng *engine.Engine, t *testing.T) error {
<ide> container.Kill()
<ide> daemon.Rm(container)
<ide> }
<del> job := eng.Job("images")
<del> images, err := job.Stdout.AddTable()
<add> images, err := daemon.Repositories().Images(&graph.ImagesConfig{})
<ide> if err != nil {
<ide> t.Fatal(err)
<ide> }
<del> if err := job.Run(); err != nil {
<del> t.Fatal(err)
<del> }
<del> for _, image := range images.Data {
<del> if image.Get("Id") != unitTestImageID {
<del> eng.Job("image_delete", image.Get("Id")).Run()
<add> for _, image := range images {
<add> if image.ID != unitTestImageID {
<add> eng.Job("image_delete", image.ID).Run()
<ide> }
<ide> }
<ide> return nil
<ide><path>integration/server_test.go
<ide> func TestImagesFilter(t *testing.T) {
<ide>
<ide> images := getImages(eng, t, false, "utest*/*")
<ide>
<del> if len(images.Data[0].GetList("RepoTags")) != 2 {
<add> if len(images[0].RepoTags) != 2 {
<ide> t.Fatal("incorrect number of matches returned")
<ide> }
<ide>
<ide> images = getImages(eng, t, false, "utest")
<ide>
<del> if len(images.Data[0].GetList("RepoTags")) != 1 {
<add> if len(images[0].RepoTags) != 1 {
<ide> t.Fatal("incorrect number of matches returned")
<ide> }
<ide>
<ide> images = getImages(eng, t, false, "utest*")
<ide>
<del> if len(images.Data[0].GetList("RepoTags")) != 1 {
<add> if len(images[0].RepoTags) != 1 {
<ide> t.Fatal("incorrect number of matches returned")
<ide> }
<ide>
<ide> images = getImages(eng, t, false, "*5000*/*")
<ide>
<del> if len(images.Data[0].GetList("RepoTags")) != 1 {
<add> if len(images[0].RepoTags) != 1 {
<ide> t.Fatal("incorrect number of matches returned")
<ide> }
<ide> }
<ide><path>integration/utils_test.go
<ide> import (
<ide>
<ide> "github.com/docker/docker/vendor/src/code.google.com/p/go/src/pkg/archive/tar"
<ide>
<add> "github.com/docker/docker/api/types"
<ide> "github.com/docker/docker/builtins"
<ide> "github.com/docker/docker/daemon"
<ide> "github.com/docker/docker/engine"
<add> "github.com/docker/docker/graph"
<ide> flag "github.com/docker/docker/pkg/mflag"
<ide> "github.com/docker/docker/registry"
<ide> "github.com/docker/docker/runconfig"
<ide> func fakeTar() (io.ReadCloser, error) {
<ide> return ioutil.NopCloser(buf), nil
<ide> }
<ide>
<del>func getImages(eng *engine.Engine, t *testing.T, all bool, filter string) *engine.Table {
<del> job := eng.Job("images")
<del> job.SetenvBool("all", all)
<del> job.Setenv("filter", filter)
<del> images, err := job.Stdout.AddListTable()
<del> if err != nil {
<del> t.Fatal(err)
<add>func getImages(eng *engine.Engine, t *testing.T, all bool, filter string) []*types.Image {
<add> config := graph.ImagesConfig{
<add> Filter: filter,
<add> All: all,
<ide> }
<del> if err := job.Run(); err != nil {
<add> images, err := getDaemon(eng).Repositories().Images(&config)
<add> if err != nil {
<ide> t.Fatal(err)
<ide> }
<del> return images
<ide>
<add> return images
<ide> }
<ide>
<ide> func parseRun(args []string) (*runconfig.Config, *runconfig.HostConfig, *flag.FlagSet, error) {
<ide> func parseRun(args []string) (*runconfig.Config, *runconfig.HostConfig, *flag.Fl
<ide> cmd.Usage = nil
<ide> return runconfig.Parse(cmd, args)
<ide> }
<add>
<add>func getDaemon(eng *engine.Engine) *daemon.Daemon {
<add> return eng.HackGetGlobalVar("httpapi.daemon").(*daemon.Daemon)
<add>} | 13 |
Ruby | Ruby | use inspect instead of escaping quotes | 90768d03d28f5c88a0049532f914ad867e1b7241 | <ide><path>Library/Homebrew/cmd/search.rb
<ide> def search
<ide> if not query.to_s.empty? and $stdout.tty? and msg = blacklisted?(query)
<ide> unless search_results.empty?
<ide> puts
<del> puts "If you meant `#{query}' precisely:"
<add> puts "If you meant #{query.inspect} precisely:"
<ide> puts
<ide> end
<ide> puts msg
<ide> def search
<ide> results.each { |r| puts_columns r }
<ide>
<ide> if $found == 0 and not blacklisted? query
<del> puts "No formula found for \"#{query}\". Searching open pull requests..."
<add> puts "No formula found for #{query.inspect}. Searching open pull requests..."
<ide> GitHub.find_pull_requests(rx) { |pull| puts pull }
<ide> end
<ide> end | 1 |
Text | Text | fix the link for custom server documentation | e28ce34ccb3b656eb24c9e8d555f6b18d386b71c | <ide><path>examples/custom-server-koa/README.md
<ide> # Custom Koa Server example
<ide>
<del>Most of the times the default Next server will be enough but sometimes you want to run your own server to customize routes or other kind of the app behavior. Next provides a [Custom server and routing](https://github.com/zeit/next.js#custom-server-and-routing) so you can customize as much as you want.
<add>Most of the times the default Next server will be enough but sometimes you want to run your own server to customize routes or other kind of the app behavior. Next provides a [Custom server and routing](https://nextjs.org/docs/advanced-features/custom-server) so you can customize as much as you want.
<ide>
<ide> Because the Next.js server is just a node.js module you can combine it with any other part of the node.js ecosystem. in this case we are using [Koa](http://koajs.com/) to build a custom router on top of Next.
<ide> | 1 |
Python | Python | add is_in_jupyter() helper for displacy (see ) | 489d2fb4baf5946672602290b809a3508a1e9a21 | <ide><path>spacy/displacy/__init__.py
<ide>
<ide> from .render import DependencyRenderer, EntityRenderer
<ide> from ..tokens import Doc
<del>from ..util import prints
<add>from ..util import prints, is_in_jupyter
<ide>
<ide>
<ide> _html = {}
<add>IS_JUPYTER = is_in_jupyter()
<ide>
<ide>
<del>def render(docs, style='dep', page=False, minify=False, jupyter=False, options={}):
<add>def render(docs, style='dep', page=False, minify=False, jupyter=IS_JUPYTER, options={}):
<ide> """Render displaCy visualisation.
<ide>
<ide> docs (list or Doc): Document(s) to visualise.
<ide><path>spacy/util.py
<ide> def parse_package_meta(package_path, require=True):
<ide> return None
<ide>
<ide>
<add>def is_in_jupyter():
<add> """Check if user is in a Jupyter notebook. Mainly used for displaCy.
<add>
<add> RETURNS (bool): True if in Jupyter, False if not.
<add> """
<add> try:
<add> cfg = get_ipython().config
<add> if cfg['IPKernelApp']['parent_appname'] == 'ipython-notebook':
<add> return True
<add> except NameError:
<add> return False
<add> return False
<add>
<add>
<ide> def get_cuda_stream(require=False):
<ide> # TODO: Error and tell to install chainer if not found
<ide> # Requires GPU | 2 |
Go | Go | remove unused errors | 13ea23723478345549f8e765894843687c05f375 | <ide><path>pkg/devicemapper/devmapper.go
<ide> var (
<ide> ErrUdevWait = errors.New("wait on udev cookie failed")
<ide> ErrSetDevDir = errors.New("dm_set_dev_dir failed")
<ide> ErrGetLibraryVersion = errors.New("dm_get_library_version failed")
<del> ErrCreateRemoveTask = errors.New("Can't create task of type deviceRemove")
<del> ErrRunRemoveDevice = errors.New("running RemoveDevice failed")
<ide> ErrInvalidAddNode = errors.New("Invalid AddNode type")
<ide> ErrBusy = errors.New("Device is Busy")
<ide> ErrDeviceIDExists = errors.New("Device Id Exists")
<ide> ErrEnxio = errors.New("No such device or address")
<del> ErrEnoData = errors.New("No data available")
<ide> )
<ide>
<ide> var ( | 1 |
Ruby | Ruby | move stdlib tracking postinstall | 3657393017cc4a17f72107a7b144060fa7dc7b8b | <ide><path>Library/Homebrew/build.rb
<ide> def install
<ide> end
<ide> end
<ide>
<del> # TODO Track user-selected stdlibs, such as boost in C++11 mode
<del> stdlib = ENV.compiler == :clang ? MacOS.default_cxx_stdlib : :libstdcxx
<del> stdlib_in_use = CxxStdlib.new(stdlib, ENV.compiler)
<del>
<del> # This is a bad place for this check, but we don't have access to
<del> # compiler selection within the formula installer, only inside the
<del> # build instance.
<del> # This is also awkward because we don't actually know yet if this package
<del> # will link against a C++ stdlib, but we don't want to test after the build.
<del> stdlib_in_use.check_dependencies(f, deps)
<del>
<ide> f.brew do
<ide> if ARGV.flag? '--git'
<ide> system "git init"
<ide> def install
<ide>
<ide> begin
<ide> f.install
<del> Tab.create(f, ENV.compiler,
<add>
<add> stdlibs = Keg.new(f.prefix).detect_cxx_stdlibs
<add> # It's technically possible for the same lib to link to multiple
<add> # C++ stdlibs, but very bad news. Right now we don't track this
<add> # woeful scenario.
<add> stdlib_in_use = CxxStdlib.new(stdlibs.first, ENV.compiler)
<add> # This will raise and fail the build if there's an
<add> # incompatibility.
<add> stdlib_in_use.check_dependencies(f, deps)
<add>
<add> Tab.create(f, ENV.compiler, stdlibs.first,
<ide> Options.coerce(ARGV.options_only)).write
<ide> rescue Exception => e
<ide> if ARGV.debug?
<ide><path>Library/Homebrew/formula_installer.rb
<ide> def finish
<ide>
<ide> fix_install_names if OS.mac?
<ide>
<del> record_cxx_stdlib
<del>
<ide> ohai "Summary" if ARGV.verbose? or show_summary_heading
<ide> unless ENV['HOMEBREW_NO_EMOJI']
<ide> print "\xf0\x9f\x8d\xba " if MacOS.version >= :lion
<ide> def fix_install_names
<ide> @show_summary_heading = true
<ide> end
<ide>
<del> def record_cxx_stdlib
<del> stdlibs = Keg.new(f.prefix).detect_cxx_stdlibs
<del> return if stdlibs.empty?
<del>
<del> tab = Tab.for_keg f.prefix
<del> tab.tabfile.delete if tab.tabfile
<del> # It's technically possible for the same lib to link to multiple C++ stdlibs,
<del> # but very bad news. Right now we don't track this woeful scenario.
<del> tab.stdlib = stdlibs.first
<del> tab.write
<del> end
<del>
<ide> def clean
<ide> ohai "Cleaning" if ARGV.verbose?
<ide> if f.class.skip_clean_all?
<ide><path>Library/Homebrew/tab.rb
<ide> class Tab < OpenStruct
<ide> FILENAME = 'INSTALL_RECEIPT.json'
<ide>
<del> def self.create f, compiler, args
<add> def self.create f, compiler, stdlib, args
<ide> f.build.args = args
<ide>
<ide> sha = HOMEBREW_REPOSITORY.cd do
<ide> def self.create f, compiler, args
<ide> :tapped_from => f.tap,
<ide> :time => Time.now.to_i, # to_s would be better but Ruby has no from_s function :P
<ide> :HEAD => sha,
<del> :compiler => compiler
<add> :compiler => compiler,
<add> :stdlib => stdlib
<ide> end
<ide>
<ide> def self.from_file path | 3 |
Python | Python | fix fnet tokenizer tests | 7604557e4470822754c5658a19d81aa2ae7de934 | <ide><path>tests/test_tokenization_fnet.py
<ide> import unittest
<ide>
<ide> from transformers import FNetTokenizer, FNetTokenizerFast
<del>from transformers.testing_utils import require_sentencepiece, require_tokenizers, slow
<add>from transformers.testing_utils import require_sentencepiece, require_tokenizers, slow, tooslow
<ide> from transformers.tokenization_utils import AddedToken
<ide>
<ide> from .test_tokenization_common import TokenizerTesterMixin
<ide> def test_special_tokens_initialization(self):
<ide> self.assertTrue(special_token_id in p_output)
<ide> self.assertTrue(special_token_id in cr_output)
<ide>
<del> @slow
<add> @tooslow
<ide> def test_special_tokens_initialization_from_slow(self):
<ide> for tokenizer, pretrained_name, kwargs in self.tokenizers_list:
<ide> with self.subTest(f"{tokenizer.__class__.__name__} ({pretrained_name})"):
<ide> def test_tokenizer_integration(self):
<ide> self.tokenizer_integration_test_util(
<ide> expected_encoding=expected_encoding,
<ide> model_name="google/fnet-base",
<del> revision="58e0d1f96af163dc8d0a84a2fddf4bd403e4e802",
<add> revision="34219a71ca20e280cc6000b89673a169c65d605c",
<ide> ) | 1 |
Python | Python | resolve merge conflicts | 7b0fc64d48fc938a44e691a792c4ac5d02438f94 | <ide><path>libcloud/dns/providers.py
<ide> ('libcloud.dns.drivers.nsone', 'NsOneDNSDriver'),
<ide> Provider.LUADNS:
<ide> ('libcloud.dns.drivers.luadns', 'LuadnsDNSDriver'),
<del>
<add> Provider.BUDDYNS:
<add> ('libcloud.dns.drivers.buddyns', 'BuddyNSDNSDriver'),
<ide>
<ide> # Deprecated
<ide> Provider.RACKSPACE_US: | 1 |
Ruby | Ruby | remove trailing slash from opengl header path | 6d7cda77e9a0724b9098b21b630fd0ada4561ae8 | <ide><path>Library/Homebrew/extend/ENV/super.rb
<ide> def determine_cmake_include_path
<ide> paths << "#{MacOS::X11.include}/freetype2" if x11?
<ide> paths << "#{sdk}/usr/include/libxml2" unless deps.include? 'libxml2'
<ide> paths << "#{sdk}/usr/include/apache2" if MacOS::Xcode.without_clt?
<del> paths << "#{sdk}/System/Library/Frameworks/OpenGL.framework/Versions/Current/Headers/" unless x11?
<add> paths << "#{sdk}/System/Library/Frameworks/OpenGL.framework/Versions/Current/Headers" unless x11?
<ide> paths << MacOS::X11.include if x11?
<ide> paths.to_path_s
<ide> end | 1 |
Javascript | Javascript | add newline between methods | 2f60ea8b01380a91fd81dcae7043625d4e668f7f | <ide><path>src/text-editor.js
<ide> module.exports = class TextEditor {
<ide> get languageMode() {
<ide> return this.buffer.getLanguageMode();
<ide> }
<add>
<ide> get tokenizedBuffer() {
<ide> return this.buffer.getLanguageMode();
<ide> } | 1 |
Javascript | Javascript | fix d3.geo.stream tests for [x, y, z] coordinates | 1e0faba5c4dd3c8f1937bd6ba833a143dd9081bf | <ide><path>test/geo/stream-test.js
<ide> suite.addBatch({
<ide> var calls = 0;
<ide> stream({type: "Sphere"}, {
<ide> sphere: function() {
<del> ++calls;
<ide> assert.equal(arguments.length, 0);
<add> assert.equal(++calls, 1);
<ide> }
<ide> });
<ide> assert.equal(calls, 1);
<ide> },
<ide> "Point ↦ point": function(stream) {
<del> var calls = 0;
<del> stream({type: "Point", coordinates: [1, 2]}, {
<del> point: function(x, y) {
<del> ++calls;
<del> assert.equal(arguments.length, 2);
<del> assert.equal(x, 1);
<del> assert.equal(y, 2);
<add> var calls = 0, coordinates = 0;
<add> stream({type: "Point", coordinates: [1, 2, 3]}, {
<add> point: function(x, y, z) {
<add> assert.equal(arguments.length, 3);
<add> assert.equal(x, ++coordinates);
<add> assert.equal(y, ++coordinates);
<add> assert.equal(z, ++coordinates);
<add> assert.equal(++calls, 1);
<ide> }
<ide> });
<ide> assert.equal(calls, 1);
<ide> },
<ide> "MultiPoint ↦ point*": function(stream) {
<del> var calls = 0;
<del> stream({type: "MultiPoint", coordinates: [[1, 2], [3, 4]]}, {
<del> point: function(x, y) {
<del> assert.equal(arguments.length, 2);
<del> if (++calls === 1) {
<del> assert.equal(x, 1);
<del> assert.equal(y, 2);
<del> } else {
<del> assert.equal(x, 3);
<del> assert.equal(y, 4);
<del> }
<add> var calls = 0, coordinates = 0;
<add> stream({type: "MultiPoint", coordinates: [[1, 2, 3], [4, 5, 6]]}, {
<add> point: function(x, y, z) {
<add> assert.equal(arguments.length, 3);
<add> assert.equal(x, ++coordinates);
<add> assert.equal(y, ++coordinates);
<add> assert.equal(z, ++coordinates);
<add> assert.isTrue(1 <= ++calls && calls <= 2);
<ide> }
<ide> });
<ide> assert.equal(calls, 2);
<ide> },
<ide> "LineString ↦ lineStart, point{2,}, lineEnd": function(stream) {
<del> var calls = 0;
<del> stream({type: "LineString", coordinates: [[1, 2], [3, 4]]}, {
<add> var calls = 0, coordinates = 0;
<add> stream({type: "LineString", coordinates: [[1, 2, 3], [4, 5, 6]]}, {
<ide> lineStart: function() {
<del> assert.equal(++calls, 1);
<ide> assert.equal(arguments.length, 0);
<add> assert.equal(++calls, 1);
<ide> },
<del> point: function(x, y) {
<del> assert.equal(arguments.length, 2);
<del> if (++calls === 2) {
<del> assert.equal(x, 1);
<del> assert.equal(y, 2);
<del> } else if (calls === 3) {
<del> assert.equal(x, 3);
<del> assert.equal(y, 4);
<del> } else {
<del> assert.fail("too many points");
<del> }
<add> point: function(x, y, z) {
<add> assert.equal(arguments.length, 3);
<add> assert.equal(x, ++coordinates);
<add> assert.equal(y, ++coordinates);
<add> assert.equal(z, ++coordinates);
<add> assert.isTrue(2 <= ++calls && calls <= 3);
<ide> },
<ide> lineEnd: function() {
<del> assert.equal(++calls, 4);
<ide> assert.equal(arguments.length, 0);
<add> assert.equal(++calls, 4);
<ide> }
<ide> });
<ide> assert.equal(calls, 4);
<ide> },
<ide> "MultiLineString ↦ (lineStart, point{2,}, lineEnd)*": function(stream) {
<del> var calls = 0;
<del> stream({type: "MultiLineString", coordinates: [[[1, 2], [3, 4]], [[5, 6], [7, 8]]]}, {
<add> var calls = 0, coordinates = 0;
<add> stream({type: "MultiLineString", coordinates: [[[1, 2, 3], [4, 5, 6]], [[7, 8, 9], [10, 11, 12]]]}, {
<ide> lineStart: function() {
<del> ++calls;
<del> assert.isTrue(calls === 1 || calls === 5);
<ide> assert.equal(arguments.length, 0);
<add> assert.isTrue(++calls === 1 || calls === 5);
<ide> },
<del> point: function(x, y) {
<del> ++calls;
<del> assert.equal(arguments.length, 2);
<del> if (calls === 2) {
<del> assert.equal(x, 1);
<del> assert.equal(y, 2);
<del> } else if (calls === 3) {
<del> assert.equal(x, 3);
<del> assert.equal(y, 4);
<del> } else if (calls === 6) {
<del> assert.equal(x, 5);
<del> assert.equal(y, 6);
<del> } else if (calls === 7) {
<del> assert.equal(x, 7);
<del> assert.equal(y, 8);
<del> } else {
<del> assert.fail("too many points");
<del> }
<add> point: function(x, y, z) {
<add> assert.equal(arguments.length, 3);
<add> assert.equal(x, ++coordinates);
<add> assert.equal(y, ++coordinates);
<add> assert.equal(z, ++coordinates);
<add> assert.isTrue(2 <= ++calls && calls <= 3 || 6 <= calls && calls <= 7);
<ide> },
<ide> lineEnd: function() {
<del> ++calls;
<del> assert.isTrue(calls === 4 || calls === 8);
<ide> assert.equal(arguments.length, 0);
<add> assert.isTrue(++calls === 4 || calls === 8);
<ide> }
<ide> });
<ide> assert.equal(calls, 8);
<ide> },
<ide> "Polygon ↦ polygonStart, lineStart, point{2,}, lineEnd, polygonEnd": function(stream) {
<del> var calls = 0;
<del> stream({type: "Polygon", coordinates: [[[1, 2], [3, 4], [1, 2]], [[5, 6], [7, 8], [5, 6]]]}, {
<add> var calls = 0, coordinates = 0;
<add> stream({type: "Polygon", coordinates: [[[1, 2, 3], [4, 5, 6], [1, 2, 3]], [[7, 8, 9], [10, 11, 12], [7, 8, 9]]]}, {
<ide> polygonStart: function() {
<del> ++calls;
<del> assert.isTrue(calls === 1);
<ide> assert.equal(arguments.length, 0);
<add> assert.isTrue(++calls === 1);
<ide> },
<ide> lineStart: function() {
<del> ++calls;
<del> assert.isTrue(calls === 2 || calls === 6);
<ide> assert.equal(arguments.length, 0);
<add> assert.isTrue(++calls === 2 || calls === 6);
<ide> },
<del> point: function(x, y) {
<del> ++calls;
<del> assert.equal(arguments.length, 2);
<del> if (calls === 3) {
<del> assert.equal(x, 1);
<del> assert.equal(y, 2);
<del> } else if (calls === 4) {
<del> assert.equal(x, 3);
<del> assert.equal(y, 4);
<del> } else if (calls === 7) {
<del> assert.equal(x, 5);
<del> assert.equal(y, 6);
<del> } else if (calls === 8) {
<del> assert.equal(x, 7);
<del> assert.equal(y, 8);
<del> } else {
<del> assert.fail("too many points");
<del> }
<add> point: function(x, y, z) {
<add> assert.equal(arguments.length, 3);
<add> assert.equal(x, ++coordinates);
<add> assert.equal(y, ++coordinates);
<add> assert.equal(z, ++coordinates);
<add> assert.isTrue(3 <= ++calls && calls <= 4 || 7 <= calls && calls <= 8);
<ide> },
<ide> lineEnd: function() {
<del> ++calls;
<del> assert.isTrue(calls === 5 || calls === 9);
<ide> assert.equal(arguments.length, 0);
<add> assert.isTrue(++calls === 5 || calls === 9);
<ide> },
<ide> polygonEnd: function() {
<del> ++calls;
<del> assert.isTrue(calls === 10);
<ide> assert.equal(arguments.length, 0);
<add> assert.isTrue(++calls === 10);
<ide> }
<ide> });
<ide> assert.equal(calls, 10);
<ide> },
<ide> "MultiPolygon ↦ (polygonStart, lineStart, point{2,}, lineEnd, polygonEnd)*": function(stream) {
<del> var calls = 0;
<del> stream({type: "MultiPolygon", coordinates: [[[[1, 2], [3, 4], [1, 2]]], [[[5, 6], [7, 8], [5, 6]]]]}, {
<add> var calls = 0, coordinates = 0;
<add> stream({type: "MultiPolygon", coordinates: [[[[1, 2, 3], [4, 5, 6], [1, 2, 3]]], [[[7, 8, 9], [10, 11, 12], [7, 8, 9]]]]}, {
<ide> polygonStart: function() {
<del> ++calls;
<del> assert.isTrue(calls === 1 || calls === 7);
<ide> assert.equal(arguments.length, 0);
<add> assert.isTrue(++calls === 1 || calls === 7);
<ide> },
<ide> lineStart: function() {
<del> ++calls;
<del> assert.isTrue(calls === 2 || calls === 8);
<ide> assert.equal(arguments.length, 0);
<add> assert.isTrue(++calls === 2 || calls === 8);
<ide> },
<del> point: function(x, y) {
<del> ++calls;
<del> assert.equal(arguments.length, 2);
<del> if (calls === 3) {
<del> assert.equal(x, 1);
<del> assert.equal(y, 2);
<del> } else if (calls === 4) {
<del> assert.equal(x, 3);
<del> assert.equal(y, 4);
<del> } else if (calls === 9) {
<del> assert.equal(x, 5);
<del> assert.equal(y, 6);
<del> } else if (calls === 10) {
<del> assert.equal(x, 7);
<del> assert.equal(y, 8);
<del> } else {
<del> assert.fail("too many points");
<del> }
<add> point: function(x, y, z) {
<add> assert.equal(arguments.length, 3);
<add> assert.equal(x, ++coordinates);
<add> assert.equal(y, ++coordinates);
<add> assert.equal(z, ++coordinates);
<add> assert.isTrue(3 <= ++calls && calls <= 4 || 9 <= calls && calls <= 10);
<ide> },
<ide> lineEnd: function() {
<del> ++calls;
<del> assert.isTrue(calls === 5 || calls === 11);
<ide> assert.equal(arguments.length, 0);
<add> assert.isTrue(++calls === 5 || calls === 11);
<ide> },
<ide> polygonEnd: function() {
<del> ++calls;
<del> assert.isTrue(calls === 6 || calls === 12);
<ide> assert.equal(arguments.length, 0);
<add> assert.isTrue(++calls === 6 || calls === 12);
<ide> }
<ide> });
<ide> assert.equal(calls, 12);
<ide> },
<ide> "Feature ↦ .*": function(stream) {
<del> var calls = 0;
<del> stream({type: "Feature", geometry: {type: "Point", coordinates: [1, 2]}}, {
<del> point: function(x, y) {
<del> ++calls;
<del> assert.equal(arguments.length, 2);
<del> assert.equal(x, 1);
<del> assert.equal(y, 2);
<add> var calls = 0, coordinates = 0;
<add> stream({type: "Feature", geometry: {type: "Point", coordinates: [1, 2, 3]}}, {
<add> point: function(x, y, z) {
<add> assert.equal(arguments.length, 3);
<add> assert.equal(x, ++coordinates);
<add> assert.equal(y, ++coordinates);
<add> assert.equal(z, ++coordinates);
<add> assert.equal(++calls, 1);
<ide> }
<ide> });
<ide> assert.equal(calls, 1);
<ide> },
<ide> "FeatureCollection ↦ .*": function(stream) {
<del> var calls = 0;
<del> stream({type: "FeatureCollection", features: [{type: "Feature", geometry: {type: "Point", coordinates: [1, 2]}}]}, {
<del> point: function(x, y) {
<del> ++calls;
<del> assert.equal(arguments.length, 2);
<del> assert.equal(x, 1);
<del> assert.equal(y, 2);
<add> var calls = 0, coordinates = 0;
<add> stream({type: "FeatureCollection", features: [{type: "Feature", geometry: {type: "Point", coordinates: [1, 2, 3]}}]}, {
<add> point: function(x, y, z) {
<add> assert.equal(arguments.length, 3);
<add> assert.equal(x, ++coordinates);
<add> assert.equal(y, ++coordinates);
<add> assert.equal(z, ++coordinates);
<add> assert.equal(++calls, 1);
<ide> }
<ide> });
<ide> assert.equal(calls, 1);
<ide> },
<ide> "GeometryCollection ↦ .*": function(stream) {
<del> var calls = 0;
<del> stream({type: "GeometryCollection", geometries: [{type: "Point", coordinates: [1, 2]}]}, {
<del> point: function(x, y) {
<del> ++calls;
<del> assert.equal(arguments.length, 2);
<del> assert.equal(x, 1);
<del> assert.equal(y, 2);
<add> var calls = 0, coordinates = 0;
<add> stream({type: "GeometryCollection", geometries: [{type: "Point", coordinates: [1, 2, 3]}]}, {
<add> point: function(x, y, z) {
<add> assert.equal(arguments.length, 3);
<add> assert.equal(x, ++coordinates);
<add> assert.equal(y, ++coordinates);
<add> assert.equal(z, ++coordinates);
<add> assert.equal(++calls, 1);
<ide> }
<ide> });
<ide> assert.equal(calls, 1); | 1 |
Go | Go | ignore blank lines in getcgrouppaths | 301bd57b1d5ce78fe3e26f68c8f8f797abfbb5ca | <ide><path>integration-cli/docker_cli_run_unix_test.go
<ide> func TestRunWithUlimits(t *testing.T) {
<ide> func getCgroupPaths(test string) map[string]string {
<ide> cgroupPaths := map[string]string{}
<ide> for _, line := range strings.Split(test, "\n") {
<add> line = strings.TrimSpace(line)
<add> if line == "" {
<add> continue
<add> }
<ide> parts := strings.Split(line, ":")
<ide> if len(parts) != 3 {
<ide> fmt.Printf("unexpected file format for /proc/self/cgroup - %q\n", line) | 1 |
PHP | PHP | add missing throws in docblock | 30c032849e083e01cd8042091ddded72bf7cf8d4 | <ide><path>src/Illuminate/Foundation/helpers.php
<ide> function event($event, $payload = [], $halt = false)
<ide> *
<ide> * @param string $file
<ide> * @return string
<add> *
<add> * @throws \InvalidArgumentException
<ide> */
<ide> function elixir($file)
<ide> { | 1 |
Ruby | Ruby | fix odisabled return | 9b8c30e0c8d04b66c4415c27041423b372c14066 | <ide><path>Library/Homebrew/compat/extend/string.rb
<ide> class String
<ide> def undent
<ide> odisabled "<<-EOS.undent", "<<~EOS"
<add> self
<ide> end
<ide> alias unindent undent
<ide> | 1 |
Go | Go | update doc for copyfromcontainer | e330e7a5ce77736c76c36ba77983accfae01c405 | <ide><path>client/container_copy.go
<ide> func (cli *Client) ContainerStatPath(ctx context.Context, containerID, path stri
<ide> }
<ide>
<ide> // CopyToContainer copies content into the container filesystem.
<del>// Note that `content` must be a Reader for a TAR
<add>// Note that `content` must be a Reader for a TAR archive
<ide> func (cli *Client) CopyToContainer(ctx context.Context, container, path string, content io.Reader, options types.CopyToContainerOptions) error {
<ide> query := url.Values{}
<ide> query.Set("path", filepath.ToSlash(path)) // Normalize the paths used in the API.
<ide> func (cli *Client) CopyToContainer(ctx context.Context, container, path string,
<ide> }
<ide>
<ide> // CopyFromContainer gets the content from the container and returns it as a Reader
<del>// to manipulate it in the host. It's up to the caller to close the reader.
<add>// for a TAR archive to manipulate it in the host. It's up to the caller to close the reader.
<ide> func (cli *Client) CopyFromContainer(ctx context.Context, container, srcPath string) (io.ReadCloser, types.ContainerPathStat, error) {
<ide> query := make(url.Values, 1)
<ide> query.Set("path", filepath.ToSlash(srcPath)) // Normalize the paths used in the API. | 1 |
PHP | PHP | remove config references from viewserviceprovider | 6bac1991a30edcc8782553ab860046306a259d46 | <ide><path>src/Illuminate/View/ViewServiceProvider.php
<ide> public function registerBladeEngine($resolver)
<ide> // instance to pass into the engine so it can compile the views properly.
<ide> $compiler = new BladeCompiler($app['files'], $cache);
<ide>
<del> $compiler->setContentTags($app['config']['view.content_tags']);
<del> $compiler->setRawContentTags($app['config']['view.raw_content_tags']);
<del>
<ide> return new CompilerEngine($compiler, $app['files']);
<ide> });
<ide> } | 1 |
Ruby | Ruby | apply table aliases after the ast has been built | c746b5339087825b1fe79abc426170baf1b51e5c | <ide><path>activerecord/lib/active_record/associations/join_dependency.rb
<ide> def initialize(base, associations, joins)
<ide> @alias_tracker.aliased_name_for(base.table_name) # Updates the count for base.table_name to 1
<ide> tree = self.class.make_tree associations
<ide> build tree, @join_root, Arel::InnerJoin
<add> @join_root.children.each do |child|
<add> apply_tables! @join_root, child
<add> end
<ide> end
<ide>
<ide> def reflections
<ide> def merge_outer_joins!(other)
<ide> deep_copy left, node
<ide> }
<ide> end
<add> @join_root.children.each do |child|
<add> apply_tables! @join_root, child
<add> end
<ide> end
<ide>
<ide> def join_constraints
<ide> def make_joins(node)
<ide> end
<ide>
<ide> def construct_tables!(parent, node)
<add> return if node.tables
<add>
<ide> node.tables = node.reflection.chain.map { |reflection|
<ide> alias_tracker.aliased_table_for(
<ide> reflection.table_name,
<ide> def build_join_association(reflection, parent, join_type)
<ide> end
<ide>
<ide> node = JoinAssociation.new(reflection, join_type)
<del> construct_tables!(parent, node)
<ide> node
<ide> end
<ide>
<add> def apply_tables!(parent, node)
<add> construct_tables!(parent, node)
<add> node.children.each { |child| apply_tables! node, child }
<add> end
<add>
<ide> def construct(ar_parent, parent, row, rs, seen, model_cache, aliases)
<ide> primary_id = ar_parent.id
<ide> | 1 |
Ruby | Ruby | add installed gems to $load_path | 30ce9b92e8664474b5c3527c482aad08eafbfdce | <ide><path>Library/Homebrew/utils/gems.rb
<ide> def setup_gem_environment!(gem_home: nil, gem_bindir: nil, setup_path: true)
<ide> paths.unshift(gem_bindir) unless paths.include?(gem_bindir)
<ide> paths.unshift(ruby_bindir) unless paths.include?(ruby_bindir)
<ide> ENV["PATH"] = paths.compact.join(":")
<add>
<add> # Set envs so the above binaries can be invoked.
<add> # We don't do this unless requested as some formulae may invoke system Ruby instead of ours.
<add> ENV["GEM_HOME"] = gem_home
<add> ENV["GEM_PATH"] = gem_home
<ide> end
<ide>
<ide> def install_gem!(name, version: nil, setup_gem_environment: true)
<ide> setup_gem_environment! if setup_gem_environment
<del> return unless Gem::Specification.find_all_by_name(name, version).empty?
<ide>
<del> ohai_if_defined "Installing '#{name}' gem"
<del> # document: [] , is equivalent to --no-document
<del> Gem.install name, version, document: []
<add> specs = Gem::Specification.find_all_by_name(name, version)
<add>
<add> if specs.empty?
<add> ohai_if_defined "Installing '#{name}' gem"
<add> # document: [] , is equivalent to --no-document
<add> specs = Gem.install name, version, document: []
<add> end
<add>
<add> # Add the new specs to the $LOAD_PATH.
<add> specs.each do |spec|
<add> spec.require_paths.each do |path|
<add> full_path = File.join(spec.full_gem_path, path)
<add> $LOAD_PATH.unshift full_path unless $LOAD_PATH.include?(full_path)
<add> end
<add> end
<ide> rescue Gem::UnsatisfiableDependencyError
<ide> odie_if_defined "failed to install the '#{name}' gem."
<ide> end | 1 |
Mixed | Python | add catalan number to maths | 5894554d41116af83152b1ea59fbf78303d87966 | <ide><path>DIRECTORY.md
<ide> * [Binomial Coefficient](maths/binomial_coefficient.py)
<ide> * [Binomial Distribution](maths/binomial_distribution.py)
<ide> * [Bisection](maths/bisection.py)
<add> * [Catalan Number](maths/catalan_number.py)
<ide> * [Ceil](maths/ceil.py)
<ide> * [Check Polygon](maths/check_polygon.py)
<ide> * [Chudnovsky Algorithm](maths/chudnovsky_algorithm.py)
<ide>
<ide> ## Physics
<ide> * [Horizontal Projectile Motion](physics/horizontal_projectile_motion.py)
<del> * [Lorenz Transformation Four Vector](physics/lorenz_transformation_four_vector.py)
<add> * [Lorentz Transformation Four Vector](physics/lorentz_transformation_four_vector.py)
<ide> * [N Body Simulation](physics/n_body_simulation.py)
<add> * [Newtons Law Of Gravitation](physics/newtons_law_of_gravitation.py)
<ide> * [Newtons Second Law Of Motion](physics/newtons_second_law_of_motion.py)
<ide>
<ide> ## Project Euler
<ide><path>maths/catalan_number.py
<add>"""
<add>
<add>Calculate the nth Catalan number
<add>
<add>Source:
<add> https://en.wikipedia.org/wiki/Catalan_number
<add>
<add>"""
<add>
<add>
<add>def catalan(number: int) -> int:
<add> """
<add> :param number: nth catalan number to calculate
<add> :return: the nth catalan number
<add> Note: A catalan number is only defined for positive integers
<add>
<add> >>> catalan(5)
<add> 14
<add> >>> catalan(0)
<add> Traceback (most recent call last):
<add> ...
<add> ValueError: Input value of [number=0] must be > 0
<add> >>> catalan(-1)
<add> Traceback (most recent call last):
<add> ...
<add> ValueError: Input value of [number=-1] must be > 0
<add> >>> catalan(5.0)
<add> Traceback (most recent call last):
<add> ...
<add> TypeError: Input value of [number=5.0] must be an integer
<add> """
<add>
<add> if not isinstance(number, int):
<add> raise TypeError(f"Input value of [number={number}] must be an integer")
<add>
<add> if number < 1:
<add> raise ValueError(f"Input value of [number={number}] must be > 0")
<add>
<add> current_number = 1
<add>
<add> for i in range(1, number):
<add> current_number *= 4 * i - 2
<add> current_number //= i + 1
<add>
<add> return current_number
<add>
<add>
<add>if __name__ == "__main__":
<add> import doctest
<add>
<add> doctest.testmod() | 2 |
Text | Text | add v3.1.1 to changelog | 2cd2605db2643506f1a3bb5d9ad3447eaeb9a893 | <ide><path>CHANGELOG.md
<ide> - [#16462](https://github.com/emberjs/ember.js/pull/16462) [CLEANUP] Remove deprecated `MODEL_FACTORY_INJECTIONS`
<ide> - [emberjs/rfcs#286](https://github.com/emberjs/rfcs/blob/master/text/0286-block-let-template-helper.md) [FEATURE] Enabled block `let` handlebars helper by default.
<ide>
<add>### v3.1.1 (April 23, 2018)
<add>- [#16559](https://github.com/emberjs/ember.js/pull/16559) [BUGFIX] Fix property normalization, Update glimmer-vm to 0.34.0
<add>- [#16493](https://github.com/emberjs/ember.js/pull/16493) [BUGFIX] Ensure proxies have access to `getOwner(this)`.
<add>- [#16496](https://github.com/emberjs/ember.js/pull/16496) [BUGFIX] Add exception for `didRemoveListener` so evented proxy objects can function
<add>- [#16494](https://github.com/emberjs/ember.js/pull/16494) [BUGFIX] Adjust assertion to allow for either undefined or null
<add>- [#16558](https://github.com/emberjs/ember.js/pull/16558) [BUGFIX] Ensure ComponentDefinitions do not leak heap space.
<add>- [#16560](https://github.com/emberjs/ember.js/pull/16560) [BUGFIX] Avoid strict assertion when object proxy calls thru for function
<add>- [#16563](https://github.com/emberjs/ember.js/pull/16563) [BUGFIX] Ensure `ariaRole` can be initially false.
<add>- [#16564](https://github.com/emberjs/ember.js/pull/16564) [BUGFIX] Ensure Ember.isArray does not trigger proxy assertion.
<add>- [#16572](https://github.com/emberjs/ember.js/pull/16572) [BUGFIX] Fix curly component class reference setup
<add>
<ide> ### v3.1.0 (April 10, 2018)
<ide> - [#16293](https://github.com/emberjs/ember.js/pull/16293) [BUGFIX] Ignore --pod for -addon blueprints: helper, initializer, and instance-initializer
<ide> - [#16312](https://github.com/emberjs/ember.js/pull/16312) [DEPRECATION] Deprecate `Route.prototype.router` in favor of `Route.prototype._router` | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.