Skip to content

Commit a9f9df6

Browse files
feat!: add common resource paths; expose client transport; rename type attributes to type_ to avoid name collisions (#64)
Renamed attributes: * TagTemplateField.type -> TagTemplatedField.type_ * ColumnSchema.type -> ColumnSchema.type_ * Entry.type -> Entry.type_
1 parent e2afbda commit a9f9df6

File tree

2 files changed

+42
-6
lines changed

2 files changed

+42
-6
lines changed

datacatalog/snippets/README.rst

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
.. This file is automatically generated. Do not edit this file directly.
23
34
Google Cloud Data Catalog Python Samples
@@ -15,13 +16,11 @@ This directory contains samples for Google Cloud Data Catalog. `Google Cloud Dat
1516
.. _Google Cloud Data Catalog: https://cloud.google.com/data-catalog/docs
1617

1718

18-
19-
20-
2119
Setup
2220
-------------------------------------------------------------------------------
2321

2422

23+
2524
Authentication
2625
++++++++++++++
2726

@@ -32,6 +31,9 @@ credentials for applications.
3231
.. _Authentication Getting Started Guide:
3332
https://cloud.google.com/docs/authentication/getting-started
3433

34+
35+
36+
3537
Install Dependencies
3638
++++++++++++++++++++
3739

@@ -46,7 +48,7 @@ Install Dependencies
4648
.. _Python Development Environment Setup Guide:
4749
https://cloud.google.com/python/setup
4850

49-
#. Create a virtualenv. Samples are compatible with Python 2.7 and 3.4+.
51+
#. Create a virtualenv. Samples are compatible with Python 3.6+.
5052

5153
.. code-block:: bash
5254
@@ -62,9 +64,15 @@ Install Dependencies
6264
.. _pip: https://pip.pypa.io/
6365
.. _virtualenv: https://virtualenv.pypa.io/
6466

67+
68+
69+
70+
71+
6572
Samples
6673
-------------------------------------------------------------------------------
6774

75+
6876
Lookup entry
6977
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
7078

@@ -80,6 +88,7 @@ To run this sample:
8088
8189
$ python lookup_entry.py
8290
91+
8392
usage: lookup_entry.py [-h]
8493
project_id
8594
{bigquery-dataset,bigquery-table,pubsub-topic} ...
@@ -107,6 +116,10 @@ To run this sample:
107116
108117
109118
119+
120+
121+
122+
110123
The client library
111124
-------------------------------------------------------------------------------
112125

@@ -122,4 +135,5 @@ to `browse the source`_ and `report issues`_.
122135
https://github.com/GoogleCloudPlatform/google-cloud-python/issues
123136

124137

125-
.. _Google Cloud SDK: https://cloud.google.com/sdk/
138+
139+
.. _Google Cloud SDK: https://cloud.google.com/sdk/

datacatalog/snippets/noxfile.py

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@
3939
# You can opt out from the test for specific Python versions.
4040
'ignored_versions': ["2.7"],
4141

42+
# Old samples are opted out of enforcing Python type hints
43+
# All new samples should feature them
44+
'enforce_type_hints': False,
45+
4246
# An envvar key for determining the project id to use. Change it
4347
# to 'BUILD_SPECIFIC_GCLOUD_PROJECT' if you want to opt in using a
4448
# build specific Cloud project. You can also use your own string
@@ -132,7 +136,10 @@ def _determine_local_import_names(start_dir):
132136

133137
@nox.session
134138
def lint(session):
135-
session.install("flake8", "flake8-import-order")
139+
if not TEST_CONFIG['enforce_type_hints']:
140+
session.install("flake8", "flake8-import-order")
141+
else:
142+
session.install("flake8", "flake8-import-order", "flake8-annotations")
136143

137144
local_names = _determine_local_import_names(".")
138145
args = FLAKE8_COMMON_ARGS + [
@@ -141,8 +148,18 @@ def lint(session):
141148
"."
142149
]
143150
session.run("flake8", *args)
151+
#
152+
# Black
153+
#
144154

145155

156+
@nox.session
157+
def blacken(session):
158+
session.install("black")
159+
python_files = [path for path in os.listdir(".") if path.endswith(".py")]
160+
161+
session.run("black", *python_files)
162+
146163
#
147164
# Sample Tests
148165
#
@@ -201,6 +218,11 @@ def _get_repo_root():
201218
break
202219
if Path(p / ".git").exists():
203220
return str(p)
221+
# .git is not available in repos cloned via Cloud Build
222+
# setup.py is always in the library's root, so use that instead
223+
# https://github.com/googleapis/synthtool/issues/792
224+
if Path(p / "setup.py").exists():
225+
return str(p)
204226
p = p.parent
205227
raise Exception("Unable to detect repository root.")
206228

0 commit comments

Comments
 (0)