Skip to content

Commit c4ce135

Browse files
nayaknishantcopybara-github
authored andcommitted
Copybara import of the project:
-- b2e2204 by nayaknishant <nishantnayak@google.com>: feat: adding Python 3.11 support -- f7a5c45 by nayaknishant <nishantnayak@google.com>: feat: adding Python 3.11 support -- 6f822cd by nayaknishant <nishantnayak@google.com>: feat: Adding Python 3.11 support -- c0b9185 by nayaknishant <nishantnayak@google.com>: commenting out post processor check to see Owlbot changes -- a34b02f by nayaknishant <nishantnayak@google.com>: removing generator condition -- 826fa68 by Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>: 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md -- 7c86f2c by nayaknishant <nishantnayak@google.com>: owlbot edits to fix project id -- 3abd67b by Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>: 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md -- 1d4f0b9 by nayaknishant <nishantnayak@google.com>: bumping up vizier version -- b6843c4 by nayaknishant <nishantnayak@google.com>: bumping up vizier version -- 92e91ba by Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>: 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md -- 8c4f1b4 by nayaknishant <nishantnayak@google.com>: manually edits to revert noxfile.py -- 913831e by nayaknishant <nishantnayak@google.com>: manually edits to revert noxfile.py -- 9ed9ef9 by nayaknishant <nishantnayak@google.com>: adding pyarrow dependency restriction for datasets_extra -- ca4ad77 by nayaknishant <nishantnayak@google.com>: adding pyarrow dependency restriction for datasets_extra -- eb0987f by nayaknishant <nishantnayak@google.com>: grpcio version issue -- 1b61c1d by nayaknishant <nishantnayak@google.com>: increasing vizier version -- 814f3a6 by nayaknishant <nishantnayak@google.com>: removing Python 3.7 support -- 04ab968 by Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>: 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md -- 8f43c7e by nayaknishant <nishantnayak@google.com>: removing file -- cc0d0a7 by nayaknishant <nishantnayak@google.com>: reverting setup and constraints -- 9fcea19 by nayaknishant <nishantnayak@google.com>: pinning pyyaml to 5.3.1 -- 9f8cfbd by nayaknishant <nishantnayak@google.com>: skipping XAI unit test -- 41d9dcf by nayaknishant <nishantnayak@google.com>: reverting removing 'if_has_generator_updates' -- f22aa87 by nayaknishant <nishantnayak@google.com>: removing space COPYBARA_INTEGRATE_REVIEW=#2028 from nayaknishant:add-python-311 f22aa87 PiperOrigin-RevId: 551940509
1 parent 26d4d26 commit c4ce135

25 files changed

Lines changed: 75 additions & 755 deletions

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ repos:
2626
hooks:
2727
- id: black
2828
- repo: https://github.com/pycqa/flake8
29-
rev: 6.1.0
29+
rev: 3.9.2
3030
hooks:
3131
- id: flake8

google/cloud/aiplatform/jobs.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,7 @@ def create(
685685
else:
686686
input_config.instances_format = instances_format
687687
input_config.gcs_source = gca_io_compat.GcsSource(
688-
uris=gcs_source if isinstance(gcs_source, list) else [gcs_source]
688+
uris=gcs_source if type(gcs_source) == list else [gcs_source]
689689
)
690690

691691
if bigquery_destination_prefix:
@@ -1154,7 +1154,7 @@ class DataLabelingJob(_Job):
11541154
pass
11551155

11561156

1157-
class CustomJob(_RunnableJob, base.PreviewMixin):
1157+
class CustomJob(_RunnableJob):
11581158
"""Vertex AI Custom Job."""
11591159

11601160
_resource_noun = "customJobs"
@@ -1165,7 +1165,6 @@ class CustomJob(_RunnableJob, base.PreviewMixin):
11651165
_parse_resource_name_method = "parse_custom_job_path"
11661166
_format_resource_name_method = "custom_job_path"
11671167
_job_type = "training"
1168-
_preview_class = "google.cloud.aiplatform.aiplatform.preview.jobs.CustomJob"
11691168

11701169
def __init__(
11711170
self,

google/cloud/aiplatform/preview/jobs.py

Lines changed: 0 additions & 440 deletions
This file was deleted.

noxfile.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525

2626
import nox
2727

28-
FLAKE8_VERSION = "flake8==6.1.0"
2928
BLACK_VERSION = "black==22.3.0"
3029
ISORT_VERSION = "isort==5.10.1"
3130
LINT_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"]
@@ -86,7 +85,7 @@ def lint(session):
8685
Returns a failure if the linters find linting errors or sufficiently
8786
serious code quality issues.
8887
"""
89-
session.install(FLAKE8_VERSION, BLACK_VERSION)
88+
session.install("flake8", BLACK_VERSION)
9089
session.run(
9190
"black",
9291
"--check",

samples/snippets/conftest.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -282,9 +282,7 @@ def teardown_batch_read_feature_values(shared_state, bigquery_client):
282282
def create_endpoint(shared_state, endpoint_client):
283283
def create(project, location, test_name="temp_deploy_model_test"):
284284
parent = f"projects/{project}/locations/{location}"
285-
endpoint = aiplatform.gapic.Endpoint(
286-
display_name=f"{test_name}_{uuid4()}",
287-
)
285+
endpoint = aiplatform.gapic.Endpoint(display_name=f"{test_name}_{uuid4()}",)
288286
create_endpoint_response = endpoint_client.create_endpoint(
289287
parent=parent, endpoint=endpoint
290288
)

samples/snippets/helpers.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525

2626
def get_name(out, key="name"):
27-
pattern = re.compile(rf'{key}:\s*"([\-a-zA-Z0-9/]+)"')
27+
pattern = re.compile(fr'{key}:\s*"([\-a-zA-Z0-9/]+)"')
2828
name = re.search(pattern, out).group(1)
2929

3030
return name
@@ -38,7 +38,7 @@ def get_state(out):
3838

3939

4040
def get_featurestore_resource_name(out, key="name"):
41-
pattern = re.compile(rf'{key}:\s*"([\_\-a-zA-Z0-9/]+)"')
41+
pattern = re.compile(fr'{key}:\s*"([\_\-a-zA-Z0-9/]+)"')
4242
name = re.search(pattern, out).group(1)
4343

4444
return name
@@ -51,7 +51,7 @@ def wait_for_job_state(
5151
timeout: int = 90,
5252
freq: float = 1.5,
5353
) -> None:
54-
"""Waits until the Job state of provided resource name is a particular state.
54+
""" Waits until the Job state of provided resource name is a particular state.
5555
5656
Args:
5757
get_job_method: Callable[[str], "proto.Message"]
@@ -91,12 +91,12 @@ def flaky_test_diagnostic(file_name, test_name, N=20):
9191
timing_dict = collections.defaultdict(list)
9292
for ri in range(N):
9393
start = timer()
94-
result = pytest.main(["-s", f"{file_name}::{test_name}"])
94+
result = pytest.main(['-s', f'{file_name}::{test_name}'])
9595
end = timer()
96-
delta = end - start
96+
delta = end-start
9797
if result == pytest.ExitCode.OK:
98-
timing_dict["SUCCESS"].append(delta)
98+
timing_dict['SUCCESS'].append(delta)
9999
else:
100-
timing_dict["FAILURE"].append(delta)
100+
timing_dict['FAILURE'].append(delta)
101101

102102
return timing_dict

samples/snippets/noxfile.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,6 @@ def blacken(session: nox.sessions.Session) -> None:
160160
# format = isort + black
161161
#
162162

163-
164163
@nox.session
165164
def format(session: nox.sessions.Session) -> None:
166165
"""
@@ -188,9 +187,7 @@ def _session_tests(
188187
session: nox.sessions.Session, post_install: Callable = None
189188
) -> None:
190189
# check for presence of tests
191-
test_list = glob.glob("**/*_test.py", recursive=True) + glob.glob(
192-
"**/test_*.py", recursive=True
193-
)
190+
test_list = glob.glob("**/*_test.py", recursive=True) + glob.glob("**/test_*.py", recursive=True)
194191
test_list.extend(glob.glob("**/tests", recursive=True))
195192

196193
if len(test_list) == 0:
@@ -212,7 +209,9 @@ def _session_tests(
212209

213210
if os.path.exists("requirements-test.txt"):
214211
if os.path.exists("constraints-test.txt"):
215-
session.install("-r", "requirements-test.txt", "-c", "constraints-test.txt")
212+
session.install(
213+
"-r", "requirements-test.txt", "-c", "constraints-test.txt"
214+
)
216215
else:
217216
session.install("-r", "requirements-test.txt")
218217
with open("requirements-test.txt") as rtfile:
@@ -225,9 +224,9 @@ def _session_tests(
225224
post_install(session)
226225

227226
if "pytest-parallel" in packages:
228-
concurrent_args.extend(["--workers", "auto", "--tests-per-worker", "auto"])
227+
concurrent_args.extend(['--workers', 'auto', '--tests-per-worker', 'auto'])
229228
elif "pytest-xdist" in packages:
230-
concurrent_args.extend(["-n", "auto"])
229+
concurrent_args.extend(['-n', 'auto'])
231230

232231
session.run(
233232
"pytest",
@@ -257,7 +256,7 @@ def py(session: nox.sessions.Session) -> None:
257256

258257

259258
def _get_repo_root() -> Optional[str]:
260-
"""Returns the root folder of the project."""
259+
""" Returns the root folder of the project. """
261260
# Get root of this repository. Assume we don't have directories nested deeper than 10 items.
262261
p = Path(os.getcwd())
263262
for i in range(10):

samples/snippets/noxfile_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@
3030
# secrets here. These values will override predefined values.
3131
"envs": {
3232
"DATA_LABELING_API_ENDPOINT": "us-central1-autopush-aiplatform.sandbox.googleapis.com",
33-
"PYTEST_ADDOPTS": "-n=auto", # Run tests parallel using all available CPUs
33+
"PYTEST_ADDOPTS": "-n=auto" # Run tests parallel using all available CPUs
3434
},
3535
}

samples/snippets/prediction_service/explain_tabular_sample_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@ def test_ucaip_generated_explain_tabular_sample(capsys):
3434
)
3535

3636
out, _ = capsys.readouterr()
37-
assert "attribution" in out
37+
assert 'attribution' in out

samples/snippets/prediction_service/predict_custom_trained_model_sample.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def predict_custom_trained_model_sample(
3737
# This client only needs to be created once, and can be reused for multiple requests.
3838
client = aiplatform.gapic.PredictionServiceClient(client_options=client_options)
3939
# The format of each instance should conform to the deployed model's prediction input schema.
40-
instances = instances if isinstance(instances, list) else [instances]
40+
instances = instances if type(instances) == list else [instances]
4141
instances = [
4242
json_format.ParseDict(instance_dict, Value()) for instance_dict in instances
4343
]

0 commit comments

Comments
 (0)