Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(webrisk): add 2.7 deprecation warning; bump copyright year to 2020; use templated noxfile (via synth) #10053

Merged
merged 5 commits into from
Jan 30, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions webrisk/docs/conf.py
Original file line number Diff line number Diff line change
@@ -264,7 +264,7 @@
u"google-cloud-webrisk Documentation",
author,
"manual",
),
)
]

# The name of an image file (relative to this directory) to place at the top of
@@ -320,7 +320,7 @@
"google-cloud-webrisk",
"GAPIC library for the {metadata.shortName} v1beta1 service",
"APIs",
),
)
]

# Documents to append as an appendix to all manuals.
2 changes: 1 addition & 1 deletion webrisk/google/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
# Copyright 2019 Google LLC
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
2 changes: 1 addition & 1 deletion webrisk/google/cloud/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
# Copyright 2019 Google LLC
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
8 changes: 2 additions & 6 deletions webrisk/google/cloud/webrisk.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
# Copyright 2019 Google LLC
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -22,8 +22,4 @@
from google.cloud.webrisk_v1beta1 import types


__all__ = (
"enums",
"types",
"WebRiskServiceV1Beta1Client",
)
__all__ = ("enums", "types", "WebRiskServiceV1Beta1Client")
19 changes: 13 additions & 6 deletions webrisk/google/cloud/webrisk_v1beta1/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
# Copyright 2019 Google LLC
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -16,21 +16,28 @@


from __future__ import absolute_import
import sys
import warnings

from google.cloud.webrisk_v1beta1 import types
from google.cloud.webrisk_v1beta1.gapic import enums
from google.cloud.webrisk_v1beta1.gapic import web_risk_service_v1_beta1_client


if sys.version_info[:2] == (2, 7):
message = (
"A future version of this library will drop support for Python 2.7."
"More details about Python 2 support for Google Cloud Client Libraries"
"can be found at https://cloud.google.com/python/docs/python2-sunset/"
)
warnings.warn(message, DeprecationWarning)


class WebRiskServiceV1Beta1Client(
web_risk_service_v1_beta1_client.WebRiskServiceV1Beta1Client
):
__doc__ = web_risk_service_v1_beta1_client.WebRiskServiceV1Beta1Client.__doc__
enums = enums


__all__ = (
"enums",
"types",
"WebRiskServiceV1Beta1Client",
)
__all__ = ("enums", "types", "WebRiskServiceV1Beta1Client")
2 changes: 1 addition & 1 deletion webrisk/google/cloud/webrisk_v1beta1/gapic/enums.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
# Copyright 2019 Google LLC
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
# Copyright 2019 Google LLC
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -53,7 +53,7 @@ def __init__(
# exception (channels come with credentials baked in already).
if channel is not None and credentials is not None:
raise ValueError(
"The `channel` and `credentials` arguments are mutually " "exclusive.",
"The `channel` and `credentials` arguments are mutually " "exclusive."
)

# Create the channel.
@@ -74,7 +74,7 @@ def __init__(
self._stubs = {
"web_risk_service_v1_beta1_stub": webrisk_pb2_grpc.WebRiskServiceV1Beta1Stub(
channel
),
)
}

@classmethod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
# Copyright 2019 Google LLC
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -36,7 +36,7 @@
from google.cloud.webrisk_v1beta1.proto import webrisk_pb2_grpc


_GAPIC_LIBRARY_VERSION = pkg_resources.get_distribution("google-cloud-webrisk",).version
_GAPIC_LIBRARY_VERSION = pkg_resources.get_distribution("google-cloud-webrisk").version


class WebRiskServiceV1Beta1Client(object):
@@ -159,12 +159,12 @@ def __init__(
self.transport = transport
else:
self.transport = web_risk_service_v1_beta1_grpc_transport.WebRiskServiceV1Beta1GrpcTransport(
address=api_endpoint, channel=channel, credentials=credentials,
address=api_endpoint, channel=channel, credentials=credentials
)

if client_info is None:
client_info = google.api_core.gapic_v1.client_info.ClientInfo(
gapic_version=_GAPIC_LIBRARY_VERSION,
gapic_version=_GAPIC_LIBRARY_VERSION
)
else:
client_info.gapic_version = _GAPIC_LIBRARY_VERSION
@@ -175,7 +175,7 @@ def __init__(
# (Ordinarily, these are the defaults specified in the `*_config.py`
# file next to this one.)
self._method_configs = google.api_core.gapic_v1.config.parse_method_configs(
client_config["interfaces"][self._INTERFACE_NAME],
client_config["interfaces"][self._INTERFACE_NAME]
)

# Save a dictionary of cached API call functions.
@@ -316,7 +316,7 @@ def search_uris(
client_info=self._client_info,
)

request = webrisk_pb2.SearchUrisRequest(uri=uri, threat_types=threat_types,)
request = webrisk_pb2.SearchUrisRequest(uri=uri, threat_types=threat_types)
return self._inner_api_calls["search_uris"](
request, retry=retry, timeout=timeout, metadata=metadata
)
@@ -382,7 +382,7 @@ def search_hashes(
)

request = webrisk_pb2.SearchHashesRequest(
threat_types=threat_types, hash_prefix=hash_prefix,
threat_types=threat_types, hash_prefix=hash_prefix
)
return self._inner_api_calls["search_hashes"](
request, retry=retry, timeout=timeout, metadata=metadata
38 changes: 21 additions & 17 deletions webrisk/google/cloud/webrisk_v1beta1/proto/webrisk_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 3 additions & 7 deletions webrisk/google/cloud/webrisk_v1beta1/types.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
# Copyright 2019 Google LLC
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -24,13 +24,9 @@
from google.protobuf import timestamp_pb2


_shared_modules = [
timestamp_pb2,
]
_shared_modules = [timestamp_pb2]

_local_modules = [
webrisk_pb2,
]
_local_modules = [webrisk_pb2]

names = []

62 changes: 31 additions & 31 deletions webrisk/noxfile.py
Original file line number Diff line number Diff line change
@@ -14,6 +14,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# Generated by synthtool. DO NOT EDIT!

from __future__ import absolute_import
import os
import shutil
@@ -22,6 +24,12 @@


LOCAL_DEPS = (os.path.join("..", "api_core"), os.path.join("..", "core"))
BLACK_VERSION = "black==19.3b0"
BLACK_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"]

if os.path.exists("samples"):
BLACK_PATHS.append("samples")


@nox.session(python="3.7")
def lint(session):
@@ -30,14 +38,8 @@ def lint(session):
Returns a failure if the linters find linting errors or sufficiently
serious code quality issues.
"""
session.install("flake8", "black", *LOCAL_DEPS)
session.run(
"black",
"--check",
"google",
"tests",
"docs",
)
session.install("flake8", BLACK_VERSION, *LOCAL_DEPS)
session.run("black", "--check", *BLACK_PATHS)
session.run("flake8", "google", "tests")


@@ -46,18 +48,13 @@ def blacken(session):
"""Run black.
Format code to uniform standard.
This currently uses Python 3.6 due to the automated Kokoro run of synthtool.
That run uses an image that doesn't have 3.6 installed. Before updating this
check the state of the `gcp_ubuntu_config` we use for that Kokoro run.
"""
session.install("black")
session.run(
"black",
"google",
"tests",
"docs",
)
session.install(BLACK_VERSION)
session.run("black", *BLACK_PATHS)


@nox.session(python="3.7")
@@ -83,13 +80,13 @@ def default(session):
"--cov-append",
"--cov-config=.coveragerc",
"--cov-report=",
"--cov-fail-under=97",
"--cov-fail-under=0",
os.path.join("tests", "unit"),
*session.posargs,
)


@nox.session(python=["2.7", "3.5", "3.6", "3.7"])
@nox.session(python=["2.7", "3.5", "3.6", "3.7", "3.8"])
def unit(session):
"""Run the unit test suite."""
default(session)
@@ -140,21 +137,24 @@ def cover(session):

session.run("coverage", "erase")

@nox.session(python='3.6')

@nox.session(python="3.7")
def docs(session):
"""Build the docs."""
"""Build the docs for this library."""

session.install('sphinx', 'alabaster', 'recommonmark')
session.install('-e', '.')
session.install("-e", ".")
session.install("sphinx", "alabaster", "recommonmark")

shutil.rmtree(os.path.join('docs', '_build'), ignore_errors=True)
shutil.rmtree(os.path.join("docs", "_build"), ignore_errors=True)
session.run(
'sphinx-build',
'-W', # warnings as errors
'-T', # show full traceback on exception
'-N', # no colors
'-b', 'html',
'-d', os.path.join('docs', '_build', 'doctrees', ''),
os.path.join('docs', ''),
os.path.join('docs', '_build', 'html', ''),
"sphinx-build",
"-W", # warnings as errors
"-T", # show full traceback on exception
"-N", # no colors
"-b",
"html",
"-d",
os.path.join("docs", "_build", "doctrees", ""),
os.path.join("docs", ""),
os.path.join("docs", "_build", "html", ""),
)
63 changes: 30 additions & 33 deletions webrisk/setup.py
Original file line number Diff line number Diff line change
@@ -20,70 +20,67 @@

# Package metadata.

name = 'google-cloud-webrisk'
description = 'Google Cloud Web Risk API client library'
version = '0.2.0'
name = "google-cloud-webrisk"
description = "Google Cloud Web Risk API client library"
version = "0.2.0"
# Should be one of:
# 'Development Status :: 3 - Alpha'
# 'Development Status :: 4 - Beta'
# 'Development Status :: 5 - Production/Stable'
release_status = 'Development Status :: 3 - Alpha'
dependencies = [
'google-api-core[grpc] >= 1.14.0, < 2.0.0dev',
]
extras = {
}
release_status = "Development Status :: 3 - Alpha"
dependencies = ["google-api-core[grpc] >= 1.14.0, < 2.0.0dev"]
extras = {}


# Setup boilerplate below this line.

package_root = os.path.abspath(os.path.dirname(__file__))

readme_filename = os.path.join(package_root, 'README.rst')
with io.open(readme_filename, encoding='utf-8') as readme_file:
readme_filename = os.path.join(package_root, "README.rst")
with io.open(readme_filename, encoding="utf-8") as readme_file:
readme = readme_file.read()

# Only include packages under the 'google' namespace. Do not include tests,
# benchmarks, etc.
packages = [
package for package in setuptools.find_packages()
if package.startswith('google')]
package for package in setuptools.find_packages() if package.startswith("google")
]

# Determine which namespaces are needed.
namespaces = ['google']
if 'google.cloud' in packages:
namespaces.append('google.cloud')
namespaces = ["google"]
if "google.cloud" in packages:
namespaces.append("google.cloud")


setuptools.setup(
name=name,
version=version,
description=description,
long_description=readme,
author='Google LLC',
author_email='googleapis-packages@google.com',
license='Apache 2.0',
url='https://github.com/GoogleCloudPlatform/google-cloud-python',
author="Google LLC",
author_email="googleapis-packages@google.com",
license="Apache 2.0",
url="https://github.com/GoogleCloudPlatform/google-cloud-python",
classifiers=[
release_status,
'Intended Audience :: Developers',
'License :: OSI Approved :: Apache Software License',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Operating System :: OS Independent',
'Topic :: Internet',
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Operating System :: OS Independent",
"Topic :: Internet",
],
platforms='Posix; MacOS X; Windows',
platforms="Posix; MacOS X; Windows",
packages=packages,
namespace_packages=namespaces,
install_requires=dependencies,
extras_require=extras,
python_requires='>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*',
python_requires=">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*",
include_package_data=True,
zip_safe=False,
)
98 changes: 92 additions & 6 deletions webrisk/synth.metadata
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
{
"updateTime": "2019-11-19T13:39:25.720125Z",
"updateTime": "2020-01-30T01:51:00.132441Z",
"sources": [
{
"generator": {
"name": "artman",
"version": "0.42.1",
"dockerImage": "googleapis/artman@sha256:c773192618c608a7a0415dd95282f841f8e6bcdef7dd760a988c93b77a64bd57"
"version": "0.44.4",
"dockerImage": "googleapis/artman@sha256:19e945954fc960a4bdfee6cb34695898ab21a8cf0bac063ee39b91f00a1faec8"
}
},
{
"git": {
"name": "googleapis",
"remote": "https://github.com/googleapis/googleapis.git",
"sha": "d8dd7fe8d5304f7bd1c52207703d7f27d5328c5a",
"internalRef": "281088257"
"remote": "git@github.com:googleapis/googleapis.git",
"sha": "b491d07cadaae7cde5608321f913e5ca1459b32d",
"internalRef": "292245373"
}
},
{
@@ -35,5 +35,91 @@
"config": "google/cloud/webrisk/artman_webrisk_v1beta1.yaml"
}
}
],
"newFiles": [
{
"path": "MANIFEST.in"
},
{
"path": ".flake8"
},
{
"path": "noxfile.py"
},
{
"path": "setup.py"
},
{
"path": ".coveragerc"
},
{
"path": "setup.cfg"
},
{
"path": "LICENSE"
},
{
"path": "docs/conf.py"
},
{
"path": "docs/_static/custom.css"
},
{
"path": "docs/gapic/v1beta1/api.rst"
},
{
"path": "docs/gapic/v1beta1/types.rst"
},
{
"path": "docs/_templates/layout.html"
},
{
"path": "google/__init__.py"
},
{
"path": "google/cloud/__init__.py"
},
{
"path": "google/cloud/webrisk.py"
},
{
"path": "google/cloud/webrisk_v1beta1/types.py"
},
{
"path": "google/cloud/webrisk_v1beta1/__init__.py"
},
{
"path": "google/cloud/webrisk_v1beta1/gapic/__init__.py"
},
{
"path": "google/cloud/webrisk_v1beta1/gapic/enums.py"
},
{
"path": "google/cloud/webrisk_v1beta1/gapic/web_risk_service_v1_beta1_client.py"
},
{
"path": "google/cloud/webrisk_v1beta1/gapic/web_risk_service_v1_beta1_client_config.py"
},
{
"path": "google/cloud/webrisk_v1beta1/gapic/transports/web_risk_service_v1_beta1_grpc_transport.py"
},
{
"path": "google/cloud/webrisk_v1beta1/gapic/transports/__init__.py"
},
{
"path": "google/cloud/webrisk_v1beta1/proto/__init__.py"
},
{
"path": "google/cloud/webrisk_v1beta1/proto/webrisk_pb2.py"
},
{
"path": "google/cloud/webrisk_v1beta1/proto/webrisk.proto"
},
{
"path": "google/cloud/webrisk_v1beta1/proto/webrisk_pb2_grpc.py"
},
{
"path": "tests/unit/gapic/v1beta1/test_web_risk_service_v1_beta1_client_v1beta1.py"
}
]
}
4 changes: 2 additions & 2 deletions webrisk/synth.py
Original file line number Diff line number Diff line change
@@ -43,7 +43,7 @@
# ----------------------------------------------------------------------------
# Add templated files
# ----------------------------------------------------------------------------
templated_files = common.py_library(unit_cov_level=97, cov_level=100)
s.move(templated_files, excludes=["noxfile.py"])
templated_files = common.py_library(cov_level=100)
s.move(templated_files)

s.shell.run(["nox", "-s", "blacken"], hide_output=False)
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
# Copyright 2019 Google LLC
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.