Skip to content

Commit

Permalink
chore: add license headers (#129)
Browse files Browse the repository at this point in the history
* changes without context

        autosynth cannot find the source of changes triggered by earlier changes in this
        repository, or by version upgrades to tools such as linters.

* chore: Add license headers for python config files

Source-Author: Anthonios Partheniou <[email protected]>
Source-Date: Tue Apr 6 11:32:03 2021 -0400
Source-Repo: googleapis/synthtool
Source-Sha: 5b5bf6d519b2d658d9f2e483d9f6f3d0ba8ee6bc
Source-Link: googleapis/synthtool@5b5bf6d
  • Loading branch information
yoshi-automation authored Apr 7, 2021
1 parent 96069df commit e2e3c79
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 25 deletions.
14 changes: 14 additions & 0 deletions packages/google-cloud-videointelligence/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
Expand Down
13 changes: 13 additions & 0 deletions packages/google-cloud-videointelligence/docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
# -*- coding: utf-8 -*-
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# google-cloud-videointelligence documentation build configuration file
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@
"StreamingStorageConfig",
"StreamingVideoAnnotationResults",
"StreamingVideoConfig",
"StreamingVideoIntelligenceServiceClient",
"TextAnnotation",
"TextDetectionConfig",
"TextFrame",
Expand All @@ -138,8 +139,7 @@
"VideoAnnotationProgress",
"VideoAnnotationResults",
"VideoContext",
"VideoIntelligenceServiceClient",
"VideoSegment",
"WordInfo",
"StreamingVideoIntelligenceServiceClient",
"VideoIntelligenceServiceClient",
)
38 changes: 18 additions & 20 deletions packages/google-cloud-videointelligence/samples/analyze/noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,25 +38,28 @@

TEST_CONFIG = {
# You can opt out from the test for specific Python versions.
"ignored_versions": ["2.7"],
'ignored_versions': ["2.7"],

# Old samples are opted out of enforcing Python type hints
# All new samples should feature them
"enforce_type_hints": False,
'enforce_type_hints': False,

# An envvar key for determining the project id to use. Change it
# to 'BUILD_SPECIFIC_GCLOUD_PROJECT' if you want to opt in using a
# build specific Cloud project. You can also use your own string
# to use your own Cloud project.
"gcloud_project_env": "GOOGLE_CLOUD_PROJECT",
'gcloud_project_env': 'GOOGLE_CLOUD_PROJECT',
# 'gcloud_project_env': 'BUILD_SPECIFIC_GCLOUD_PROJECT',

# A dictionary you want to inject into your test. Don't put any
# secrets here. These values will override predefined values.
"envs": {},
'envs': {},
}


try:
# Ensure we can import noxfile_config in the project's directory.
sys.path.append(".")
sys.path.append('.')
from noxfile_config import TEST_CONFIG_OVERRIDE
except ImportError as e:
print("No user noxfile_config found: detail: {}".format(e))
Expand All @@ -71,12 +74,12 @@ def get_pytest_env_vars() -> Dict[str, str]:
ret = {}

# Override the GCLOUD_PROJECT and the alias.
env_key = TEST_CONFIG["gcloud_project_env"]
env_key = TEST_CONFIG['gcloud_project_env']
# This should error out if not set.
ret["GOOGLE_CLOUD_PROJECT"] = os.environ[env_key]
ret['GOOGLE_CLOUD_PROJECT'] = os.environ[env_key]

# Apply user supplied envs.
ret.update(TEST_CONFIG["envs"])
ret.update(TEST_CONFIG['envs'])
return ret


Expand All @@ -85,7 +88,7 @@ def get_pytest_env_vars() -> Dict[str, str]:
ALL_VERSIONS = ["2.7", "3.6", "3.7", "3.8", "3.9"]

# Any default versions that should be ignored.
IGNORED_VERSIONS = TEST_CONFIG["ignored_versions"]
IGNORED_VERSIONS = TEST_CONFIG['ignored_versions']

TESTED_VERSIONS = sorted([v for v in ALL_VERSIONS if v not in IGNORED_VERSIONS])

Expand Down Expand Up @@ -134,7 +137,7 @@ def _determine_local_import_names(start_dir: str) -> List[str]:

@nox.session
def lint(session: nox.sessions.Session) -> None:
if not TEST_CONFIG["enforce_type_hints"]:
if not TEST_CONFIG['enforce_type_hints']:
session.install("flake8", "flake8-import-order")
else:
session.install("flake8", "flake8-import-order", "flake8-annotations")
Expand All @@ -143,11 +146,9 @@ def lint(session: nox.sessions.Session) -> None:
args = FLAKE8_COMMON_ARGS + [
"--application-import-names",
",".join(local_names),
".",
"."
]
session.run("flake8", *args)


#
# Black
#
Expand All @@ -160,7 +161,6 @@ def blacken(session: nox.sessions.Session) -> None:

session.run("black", *python_files)


#
# Sample Tests
#
Expand All @@ -169,9 +169,7 @@ def blacken(session: nox.sessions.Session) -> None:
PYTEST_COMMON_ARGS = ["--junitxml=sponge_log.xml"]


def _session_tests(
session: nox.sessions.Session, post_install: Callable = None
) -> None:
def _session_tests(session: nox.sessions.Session, post_install: Callable = None) -> None:
"""Runs py.test for a particular project."""
if os.path.exists("requirements.txt"):
session.install("-r", "requirements.txt")
Expand Down Expand Up @@ -202,9 +200,9 @@ def py(session: nox.sessions.Session) -> None:
if session.python in TESTED_VERSIONS:
_session_tests(session)
else:
session.skip(
"SKIPPED: {} tests are disabled for this sample.".format(session.python)
)
session.skip("SKIPPED: {} tests are disabled for this sample.".format(
session.python
))


#
Expand Down
6 changes: 3 additions & 3 deletions packages/google-cloud-videointelligence/synth.metadata
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"git": {
"name": ".",
"remote": "https://github.com/googleapis/python-videointelligence.git",
"sha": "b615ceb8904874b1fe17efe1aaf3f165686fb326"
"sha": "82f99fcb03583c44a651c8161a637c7c82153940"
}
},
{
Expand All @@ -19,14 +19,14 @@
"git": {
"name": "synthtool",
"remote": "https://github.com/googleapis/synthtool.git",
"sha": "4501974ad08b5d693311457e2ea4ce845676e329"
"sha": "5b5bf6d519b2d658d9f2e483d9f6f3d0ba8ee6bc"
}
},
{
"git": {
"name": "synthtool",
"remote": "https://github.com/googleapis/synthtool.git",
"sha": "4501974ad08b5d693311457e2ea4ce845676e329"
"sha": "5b5bf6d519b2d658d9f2e483d9f6f3d0ba8ee6bc"
}
}
],
Expand Down

0 comments on commit e2e3c79

Please sign in to comment.