From d125148e2e1188a7df5093ffd164bb9707bcca9b Mon Sep 17 00:00:00 2001 From: Vikash Singh <3116482+vi3k6i5@users.noreply.github.com> Date: Wed, 7 Apr 2021 08:48:09 +0530 Subject: [PATCH] fix: lint_setup_py was failing in Kokoro is now fixed (#607) --- README.rst | 3 +- code-of-conduct.md | 63 --------------------------------- django_spanner/functions.py | 1 + django_spanner/introspection.py | 1 + django_spanner/operations.py | 5 ++- django_spanner/schema.py | 1 + docs/conf.py | 3 -- noxfile.py | 20 ++++++----- 8 files changed, 20 insertions(+), 77 deletions(-) delete mode 100644 code-of-conduct.md diff --git a/README.rst b/README.rst index 91be439d9e..8f1ef0440d 100644 --- a/README.rst +++ b/README.rst @@ -134,8 +134,7 @@ Contributing Contributions to this library are always welcome and highly encouraged. -See `CONTRIBUTING `_ for more information on how to get -started. +See [CONTRIBUTING][contributing] for more information on how to get started. Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms. See the `Code diff --git a/code-of-conduct.md b/code-of-conduct.md deleted file mode 100644 index b24eed38ad..0000000000 --- a/code-of-conduct.md +++ /dev/null @@ -1,63 +0,0 @@ -# Google Open Source Community Guidelines - -At Google, we recognize and celebrate the creativity and collaboration of open -source contributors and the diversity of skills, experiences, cultures, and -opinions they bring to the projects and communities they participate in. - -Every one of Google's open source projects and communities are inclusive -environments, based on treating all individuals respectfully, regardless of -gender identity and expression, sexual orientation, disabilities, -neurodiversity, physical appearance, body size, ethnicity, nationality, race, -age, religion, or similar personal characteristic. - -We value diverse opinions, but we value respectful behavior more. - -Respectful behavior includes: - -* Being considerate, kind, constructive, and helpful. -* Not engaging in demeaning, discriminatory, harassing, hateful, sexualized, or - physically threatening behavior, speech, and imagery. -* Not engaging in unwanted physical contact. - -Some Google open source projects [may adopt][] an explicit project code of -conduct, which may have additional detailed expectations for participants. Most -of those projects will use our [modified Contributor Covenant][]. - -[may adopt]: https://opensource.google/docs/releasing/preparing/#conduct -[modified Contributor Covenant]: https://opensource.google/docs/releasing/template/CODE_OF_CONDUCT/ - -## Resolve peacefully - -We do not believe that all conflict is necessarily bad; healthy debate and -disagreement often yields positive results. However, it is never okay to be -disrespectful. - -If you see someone behaving disrespectfully, you are encouraged to address the -behavior directly with those involved. Many issues can be resolved quickly and -easily, and this gives people more control over the outcome of their dispute. -If you are unable to resolve the matter for any reason, or if the behavior is -threatening or harassing, report it. We are dedicated to providing an -environment where participants feel welcome and safe. - -## Reporting problems - -Some Google open source projects may adopt a project-specific code of conduct. -In those cases, a Google employee will be identified as the Project Steward, -who will receive and handle reports of code of conduct violations. In the event -that a project hasn’t identified a Project Steward, you can report problems by -emailing opensource@google.com. - -We will investigate every complaint, but you may not receive a direct response. -We will use our discretion in determining when and how to follow up on reported -incidents, which may range from not taking action to permanent expulsion from -the project and project-sponsored spaces. We will notify the accused of the -report and provide them an opportunity to discuss it before any action is -taken. The identity of the reporter will be omitted from the details of the -report supplied to the accused. In potentially harmful situations, such as -ongoing harassment or threats to anyone's safety, we may take action without -notice. - -*This document was adapted from the [IndieWeb Code of Conduct][] and can also -be found at .* - -[IndieWeb Code of Conduct]: https://indieweb.org/code-of-conduct \ No newline at end of file diff --git a/django_spanner/functions.py b/django_spanner/functions.py index bc02d0b5d8..3cf3ec73b9 100644 --- a/django_spanner/functions.py +++ b/django_spanner/functions.py @@ -28,6 +28,7 @@ class IfNull(Func): """Represent SQL `IFNULL` function.""" + function = "IFNULL" arity = 2 diff --git a/django_spanner/introspection.py b/django_spanner/introspection.py index 2dd7341972..9cefd0687f 100644 --- a/django_spanner/introspection.py +++ b/django_spanner/introspection.py @@ -15,6 +15,7 @@ class DatabaseIntrospection(BaseDatabaseIntrospection): """A Spanner-specific version of Django introspection utilities.""" + data_types_reverse = { TypeCode.BOOL: "BooleanField", TypeCode.BYTES: "BinaryField", diff --git a/django_spanner/operations.py b/django_spanner/operations.py index 6ce0260c81..e3ff7471ec 100644 --- a/django_spanner/operations.py +++ b/django_spanner/operations.py @@ -25,6 +25,7 @@ class DatabaseOperations(BaseDatabaseOperations): """A Spanner-specific version of Django database operations.""" + cast_data_types = {"CharField": "STRING", "TextField": "STRING"} cast_char_field_without_max_length = "STRING" compiler_module = "django_spanner.compiler" @@ -108,7 +109,9 @@ def bulk_insert_sql(self, fields, placeholder_rows): values_sql = ", ".join("(%s)" % sql for sql in placeholder_rows_sql) return "VALUES " + values_sql - def sql_flush(self, style, tables, reset_sequences=False, allow_cascade=False): + def sql_flush( + self, style, tables, reset_sequences=False, allow_cascade=False + ): """ Override the base class method. Returns a list of SQL statements required to remove all data from the given database tables (without diff --git a/django_spanner/schema.py b/django_spanner/schema.py index b6c859c466..6d71f31673 100644 --- a/django_spanner/schema.py +++ b/django_spanner/schema.py @@ -13,6 +13,7 @@ class DatabaseSchemaEditor(BaseDatabaseSchemaEditor): The database abstraction layer that turns things like “create a model” or “delete a field” into SQL. """ + sql_create_table = ( "CREATE TABLE %(table)s (%(definition)s) PRIMARY KEY(%(primary_key)s)" ) diff --git a/docs/conf.py b/docs/conf.py index d26c0698e6..1cffc0625d 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -100,9 +100,6 @@ # directories to ignore when looking for source files. exclude_patterns = [ "_build", - "samples/AUTHORING_GUIDE.md", - "samples/CONTRIBUTING.md", - "samples/snippets/README.rst", ] # The reST default role (used for this markup: `text`) to use for all diff --git a/noxfile.py b/noxfile.py index 2c1edbe573..7bea0b8dda 100644 --- a/noxfile.py +++ b/noxfile.py @@ -17,13 +17,18 @@ BLACK_VERSION = "black==19.10b0" BLACK_PATHS = [ "docs", + "django_spanner", "tests", "noxfile.py", "setup.py", ] +DEFAULT_PYTHON_VERSION = "3.8" +SYSTEM_TEST_PYTHON_VERSIONS = ["3.8"] +UNIT_TEST_PYTHON_VERSIONS = ["3.6", "3.7", "3.8"] -@nox.session(python="3.8") + +@nox.session(python=DEFAULT_PYTHON_VERSION) def lint(session): """Run linters. @@ -35,7 +40,7 @@ def lint(session): session.run("flake8", "django_spanner", "tests") -@nox.session(python="3.8") +@nox.session(python="3.6") def blacken(session): """Run black. @@ -49,7 +54,7 @@ def blacken(session): session.run("black", *BLACK_PATHS) -@nox.session(python="3.8") +@nox.session(python=DEFAULT_PYTHON_VERSION) def lint_setup_py(session): """Verify that setup.py is valid (including RST check).""" session.install("docutils", "pygments") @@ -70,23 +75,22 @@ def default(session): "py.test", "--quiet", "--cov=django_spanner", - "--cov=google.cloud", "--cov=tests.unit", "--cov-append", "--cov-config=.coveragerc", "--cov-report=", - "--cov-fail-under=60", + "--cov-fail-under=20", os.path.join("tests", "unit"), *session.posargs ) -@nox.session(python="3.8") +@nox.session(python=DEFAULT_PYTHON_VERSION) def docs(session): """Build the docs for this library.""" - session.install("-e", ".") - session.install("sphinx<3.0.0", "alabaster", "recommonmark") + session.install("-e", ".[tracing]") + session.install("sphinx", "alabaster", "recommonmark") shutil.rmtree(os.path.join("docs", "_build"), ignore_errors=True) session.run(