Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ca3d751

Browse filesBrowse files
chore: Re-generated to pick up changes from synthtool. (#127)
* 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 config / docs for 'pre-commit' support Source-Author: Tres Seaver <tseaver@palladion.com> Source-Date: Tue Dec 1 16:01:20 2020 -0500 Source-Repo: googleapis/synthtool Source-Sha: 32af6da519a6b042e3da62008e2a75e991efb6b4 Source-Link: googleapis/synthtool@32af6da * chore(deps): update precommit hook pre-commit/pre-commit-hooks to v3.3.0 Source-Author: WhiteSource Renovate <bot@renovateapp.com> Source-Date: Wed Dec 2 17:18:24 2020 +0100 Source-Repo: googleapis/synthtool Source-Sha: 69629b64b83c6421d616be2b8e11795738ec8a6c Source-Link: googleapis/synthtool@69629b6 * test(python): give filesystem paths to pytest-cov https://pytest-cov.readthedocs.io/en/latest/config.html The pytest-cov docs seem to suggest a filesystem path is expected. Source-Author: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com> Source-Date: Wed Dec 2 09:28:04 2020 -0700 Source-Repo: googleapis/synthtool Source-Sha: f94318521f63085b9ccb43d42af89f153fb39f15 Source-Link: googleapis/synthtool@f943185 * chore: update noxfile.py.j2 * Update noxfile.py.j2 add changes from @glasnt to the template template to ensure that enforcing type hinting doesn't fail for repos with the sample noxfile (aka all samples repos) See https://github.com/GoogleCloudPlatform/python-docs-samples/pull/4869/files for context * fix typo Source-Author: Leah E. Cole <6719667+leahecole@users.noreply.github.com> Source-Date: Thu Dec 3 13:44:30 2020 -0800 Source-Repo: googleapis/synthtool Source-Sha: 18c5dbdb4ac8cf75d4d8174e7b4558f48e76f8a1 Source-Link: googleapis/synthtool@18c5dbd
1 parent 7eaa585 commit ca3d751
Copy full SHA for ca3d751

File tree

Expand file treeCollapse file tree

6 files changed

+42
-208
lines changed
Filter options
Expand file treeCollapse file tree

6 files changed

+42
-208
lines changed

‎.pre-commit-config.yaml

Copy file name to clipboard
+17Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# See https://pre-commit.com for more information
2+
# See https://pre-commit.com/hooks.html for more hooks
3+
repos:
4+
- repo: https://github.com/pre-commit/pre-commit-hooks
5+
rev: v3.3.0
6+
hooks:
7+
- id: trailing-whitespace
8+
- id: end-of-file-fixer
9+
- id: check-yaml
10+
- repo: https://github.com/psf/black
11+
rev: 19.10b0
12+
hooks:
13+
- id: black
14+
- repo: https://gitlab.com/pycqa/flake8
15+
rev: 3.8.4
16+
hooks:
17+
- id: flake8

‎CONTRIBUTING.rst

Copy file name to clipboardExpand all lines: CONTRIBUTING.rst
+10Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,16 @@ Coding Style
111111
should point to the official ``googleapis`` checkout and the
112112
the branch should be the main branch on that remote (``master``).
113113

114+
- This repository contains configuration for the
115+
`pre-commit <https://pre-commit.com/>`__ tool, which automates checking
116+
our linters during a commit. If you have it installed on your ``$PATH``,
117+
you can enable enforcing those checks via:
118+
119+
.. code-block:: bash
120+
121+
$ pre-commit install
122+
pre-commit installed at .git/hooks/pre-commit
123+
114124
Exceptions to PEP8:
115125

116126
- Many unit tests use a helper method, ``_call_fut`` ("FUT" is short for

‎noxfile.py

Copy file name to clipboardExpand all lines: noxfile.py
+2-3Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,8 @@ def default(session):
7979
session.run(
8080
"py.test",
8181
"--quiet",
82-
"--cov=google.cloud.logging",
83-
"--cov=google.cloud",
84-
"--cov=tests.unit",
82+
"--cov=google/cloud",
83+
"--cov=tests/unit",
8584
"--cov-append",
8685
"--cov-config=.coveragerc",
8786
"--cov-report=",

‎samples/snippets/README.rst

Copy file name to clipboardExpand all lines: samples/snippets/README.rst
-191Lines changed: 0 additions & 191 deletions
This file was deleted.

‎samples/snippets/noxfile.py

Copy file name to clipboardExpand all lines: samples/snippets/noxfile.py
+9-10Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import os
1818
from pathlib import Path
1919
import sys
20+
from typing import Callable, Dict, List, Optional
2021

2122
import nox
2223

@@ -68,7 +69,7 @@
6869
TEST_CONFIG.update(TEST_CONFIG_OVERRIDE)
6970

7071

71-
def get_pytest_env_vars():
72+
def get_pytest_env_vars() -> Dict[str, str]:
7273
"""Returns a dict for pytest invocation."""
7374
ret = {}
7475

@@ -97,7 +98,7 @@ def get_pytest_env_vars():
9798
#
9899

99100

100-
def _determine_local_import_names(start_dir):
101+
def _determine_local_import_names(start_dir: str) -> List[str]:
101102
"""Determines all import names that should be considered "local".
102103
103104
This is used when running the linter to insure that import order is
@@ -135,7 +136,7 @@ def _determine_local_import_names(start_dir):
135136

136137

137138
@nox.session
138-
def lint(session):
139+
def lint(session: nox.sessions.Session) -> None:
139140
if not TEST_CONFIG['enforce_type_hints']:
140141
session.install("flake8", "flake8-import-order")
141142
else:
@@ -148,15 +149,13 @@ def lint(session):
148149
"."
149150
]
150151
session.run("flake8", *args)
151-
152-
153152
#
154153
# Black
155154
#
156155

157156

158157
@nox.session
159-
def blacken(session):
158+
def blacken(session: nox.sessions.Session) -> None:
160159
session.install("black")
161160
python_files = [path for path in os.listdir(".") if path.endswith(".py")]
162161

@@ -170,7 +169,7 @@ def blacken(session):
170169
PYTEST_COMMON_ARGS = ["--junitxml=sponge_log.xml"]
171170

172171

173-
def _session_tests(session, post_install=None):
172+
def _session_tests(session: nox.sessions.Session, post_install: Callable = None) -> None:
174173
"""Runs py.test for a particular project."""
175174
if os.path.exists("requirements.txt"):
176175
session.install("-r", "requirements.txt")
@@ -196,7 +195,7 @@ def _session_tests(session, post_install=None):
196195

197196

198197
@nox.session(python=ALL_VERSIONS)
199-
def py(session):
198+
def py(session: nox.sessions.Session) -> None:
200199
"""Runs py.test for a sample using the specified version of Python."""
201200
if session.python in TESTED_VERSIONS:
202201
_session_tests(session)
@@ -211,7 +210,7 @@ def py(session):
211210
#
212211

213212

214-
def _get_repo_root():
213+
def _get_repo_root() -> Optional[str]:
215214
""" Returns the root folder of the project. """
216215
# Get root of this repository. Assume we don't have directories nested deeper than 10 items.
217216
p = Path(os.getcwd())
@@ -234,7 +233,7 @@ def _get_repo_root():
234233

235234
@nox.session
236235
@nox.parametrize("path", GENERATED_READMES)
237-
def readmegen(session, path):
236+
def readmegen(session: nox.sessions.Session, path: str) -> None:
238237
"""(Re-)generates the readme for a sample."""
239238
session.install("jinja2", "pyyaml")
240239
dir_ = os.path.dirname(path)

‎synth.metadata

Copy file name to clipboardExpand all lines: synth.metadata
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"git": {
55
"name": ".",
66
"remote": "https://github.com/googleapis/python-logging.git",
7-
"sha": "4e24b3c360adef8d7761573d789867857586337d"
7+
"sha": "7eaa5853f3a45e3db015a09841b98aeab461e6f3"
88
}
99
},
1010
{
@@ -19,14 +19,14 @@
1919
"git": {
2020
"name": "synthtool",
2121
"remote": "https://github.com/googleapis/synthtool.git",
22-
"sha": "a073c873f3928c561bdf87fdfbf1d081d1998984"
22+
"sha": "18c5dbdb4ac8cf75d4d8174e7b4558f48e76f8a1"
2323
}
2424
},
2525
{
2626
"git": {
2727
"name": "synthtool",
2828
"remote": "https://github.com/googleapis/synthtool.git",
29-
"sha": "a073c873f3928c561bdf87fdfbf1d081d1998984"
29+
"sha": "18c5dbdb4ac8cf75d4d8174e7b4558f48e76f8a1"
3030
}
3131
}
3232
],
@@ -85,6 +85,7 @@
8585
".kokoro/test-samples.sh",
8686
".kokoro/trampoline.sh",
8787
".kokoro/trampoline_v2.sh",
88+
".pre-commit-config.yaml",
8889
".trampolinerc",
8990
"CODE_OF_CONDUCT.md",
9091
"CONTRIBUTING.rst",
@@ -134,7 +135,6 @@
134135
"renovate.json",
135136
"samples/AUTHORING_GUIDE.md",
136137
"samples/CONTRIBUTING.md",
137-
"samples/snippets/README.rst",
138138
"samples/snippets/noxfile.py",
139139
"scripts/decrypt-secrets.sh",
140140
"scripts/readme-gen/readme_gen.py",

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.