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

Add EndpointPayload ABC and Specific Payload Dataclasses for API Requests #208

Open
wants to merge 24 commits into
base: master
Choose a base branch
from

import formatting

d7d9a36
Select commit
Loading
Failed to load commit list.
Open

Add EndpointPayload ABC and Specific Payload Dataclasses for API Requests #208

import formatting
d7d9a36
Select commit
Loading
Failed to load commit list.
Google Cloud Build / api-python-pull-request (datcom-ci) succeeded Dec 9, 2024 in 52s

Summary

Build Information

Trigger api-python-pull-request
Build 45b640f0-c788-44d2-8087-6a46a60d5be9
Start 2024-12-09T01:35:38-08:00
Duration 51.003s
Status SUCCESS

Steps

Step Status Duration
api_python SUCCESS 41.979s

Details

starting build "45b640f0-c788-44d2-8087-6a46a60d5be9"

FETCHSOURCE
hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint:
hint: 	git config --global init.defaultBranch <name>
hint:
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint:
hint: 	git branch -m <name>
Initialized empty Git repository in /workspace/.git/
From https://github.com/datacommonsorg/api-python
 * branch            d7d9a36d502e63e43f7852d9f238bed7566a135d -> FETCH_HEAD
HEAD is now at d7d9a36 import formatting
BUILD
Pulling image: python:3.7-slim
3.7-slim: Pulling from library/python
a803e7c4b030: Pulling fs layer
bf3336e84c8e: Pulling fs layer
8973eb85275f: Pulling fs layer
f9afc3cc0135: Pulling fs layer
39312d8b4ab7: Pulling fs layer
f9afc3cc0135: Waiting
39312d8b4ab7: Waiting
bf3336e84c8e: Verifying Checksum
bf3336e84c8e: Download complete
8973eb85275f: Verifying Checksum
8973eb85275f: Download complete
a803e7c4b030: Verifying Checksum
a803e7c4b030: Download complete
f9afc3cc0135: Verifying Checksum
f9afc3cc0135: Download complete
39312d8b4ab7: Verifying Checksum
39312d8b4ab7: Download complete
a803e7c4b030: Pull complete
bf3336e84c8e: Pull complete
8973eb85275f: Pull complete
f9afc3cc0135: Pull complete
39312d8b4ab7: Pull complete
Digest: sha256:b53f496ca43e5af6994f8e316cf03af31050bf7944e0e4a308ad86c001cf028b
Status: Downloaded newer image for python:3.7-slim
docker.io/library/python:3.7-slim
### Running python tests
Requirement already satisfied: pip in ./.env/lib/python3.7/site-packages (23.0.1)
Collecting pip
  Downloading pip-24.0-py3-none-any.whl (2.1 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.1/2.1 MB 13.4 MB/s eta 0:00:00
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 23.0.1
    Uninstalling pip-23.0.1:
      Successfully uninstalled pip-23.0.1
Successfully installed pip-24.0
============================= test session starts ==============================
platform linux -- Python 3.7.17, pytest-7.4.4, pluggy-1.2.0 -- /workspace/.env/bin/python3
cachedir: .pytest_cache
rootdir: /workspace
collecting ... collected 54 items / 6 errors

==================================== ERRORS ====================================
_____ ERROR collecting datacommons_client/tests/endpoints/test_payloads.py _____
datacommons_client/tests/endpoints/test_payloads.py:3: in <module>
    from datacommons_client.endpoints.payloads import NodePayload
datacommons_client/endpoints/payloads.py:34: in <module>
    class NodePayload(EndpointPayload):
datacommons_client/endpoints/payloads.py:43: in NodePayload
    nodes: str | list[str]
E   TypeError: 'type' object is not subscriptable
_____ ERROR collecting datacommons_client/tests/models/test_node_models.py _____
ImportError while importing test module '/workspace/datacommons_client/tests/models/test_node_models.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
.env/lib/python3.7/site-packages/_pytest/python.py:617: in _importtestmodule
    mod = import_path(self.path, mode=importmode, root=self.config.rootpath)
.env/lib/python3.7/site-packages/_pytest/pathlib.py:567: in import_path
    importlib.import_module(module_name)
/usr/local/lib/python3.7/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1006: in _gcd_import
    ???
<frozen importlib._bootstrap>:983: in _find_and_load
    ???
<frozen importlib._bootstrap>:967: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:677: in _load_unlocked
    ???
.env/lib/python3.7/site-packages/_pytest/assertion/rewrite.py:186: in exec_module
    exec(co, module.__dict__)
datacommons_client/tests/models/test_node_models.py:1: in <module>
    from datacommons_client.models.node import Arcs
datacommons_client/models/node.py:3: in <module>
    from typing import Any, Dict, List, Optional, TypeAlias
E   ImportError: cannot import name 'TypeAlias' from 'typing' (/usr/local/lib/python3.7/typing.py)
_ ERROR collecting datacommons_client/tests/models/test_observation_models.py __
ImportError while importing test module '/workspace/datacommons_client/tests/models/test_observation_models.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
.env/lib/python3.7/site-packages/_pytest/python.py:617: in _importtestmodule
    mod = import_path(self.path, mode=importmode, root=self.config.rootpath)
.env/lib/python3.7/site-packages/_pytest/pathlib.py:567: in import_path
    importlib.import_module(module_name)
/usr/local/lib/python3.7/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1006: in _gcd_import
    ???
<frozen importlib._bootstrap>:983: in _find_and_load
    ???
<frozen importlib._bootstrap>:967: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:677: in _load_unlocked
    ???
.env/lib/python3.7/site-packages/_pytest/assertion/rewrite.py:186: in exec_module
    exec(co, module.__dict__)
datacommons_client/tests/models/test_observation_models.py:1: in <module>
    from datacommons_client.models.observation import Facet
datacommons_client/models/observation.py:3: in <module>
    from typing import Any, Dict, TypeAlias
E   ImportError: cannot import name 'TypeAlias' from 'typing' (/usr/local/lib/python3.7/typing.py)
___ ERROR collecting datacommons_client/tests/models/test_resolve_models.py ____
ImportError while importing test module '/workspace/datacommons_client/tests/models/test_resolve_models.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
.env/lib/python3.7/site-packages/_pytest/python.py:617: in _importtestmodule
    mod = import_path(self.path, mode=importmode, root=self.config.rootpath)
.env/lib/python3.7/site-packages/_pytest/pathlib.py:567: in import_path
    importlib.import_module(module_name)
/usr/local/lib/python3.7/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1006: in _gcd_import
    ???
<frozen importlib._bootstrap>:983: in _find_and_load
    ???
<frozen importlib._bootstrap>:967: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:677: in _load_unlocked
    ???
.env/lib/python3.7/site-packages/_pytest/assertion/rewrite.py:186: in exec_module
    exec(co, module.__dict__)
datacommons_client/tests/models/test_resolve_models.py:1: in <module>
    from datacommons_client.models.resolve import Candidate
datacommons_client/models/resolve.py:3: in <module>
    from typing import Any, Dict, List, Optional, TypeAlias
E   ImportError: cannot import name 'TypeAlias' from 'typing' (/usr/local/lib/python3.7/typing.py)
___ ERROR collecting datacommons_client/tests/utils/test_request_handling.py ___
.env/lib/python3.7/site-packages/_pytest/python.py:617: in _importtestmodule
    mod = import_path(self.path, mode=importmode, root=self.config.rootpath)
.env/lib/python3.7/site-packages/_pytest/pathlib.py:567: in import_path
    importlib.import_module(module_name)
/usr/local/lib/python3.7/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1006: in _gcd_import
    ???
<frozen importlib._bootstrap>:983: in _find_and_load
    ???
<frozen importlib._bootstrap>:967: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:677: in _load_unlocked
    ???
.env/lib/python3.7/site-packages/_pytest/assertion/rewrite.py:186: in exec_module
    exec(co, module.__dict__)
datacommons_client/tests/utils/test_request_handling.py:12: in <module>
    from datacommons_client.utils.request_handling import _check_instance_is_valid
E     File "/workspace/datacommons_client/utils/request_handling.py", line 187
E       match base, new:
E                ^
E   SyntaxError: invalid syntax
_______ ERROR collecting datacommons_client/tests/utils/test_response.py _______
ImportError while importing test module '/workspace/datacommons_client/tests/utils/test_response.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
.env/lib/python3.7/site-packages/_pytest/python.py:617: in _importtestmodule
    mod = import_path(self.path, mode=importmode, root=self.config.rootpath)
.env/lib/python3.7/site-packages/_pytest/pathlib.py:567: in import_path
    importlib.import_module(module_name)
/usr/local/lib/python3.7/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1006: in _gcd_import
    ???
<frozen importlib._bootstrap>:983: in _find_and_load
    ???
<frozen importlib._bootstrap>:967: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:677: in _load_unlocked
    ???
.env/lib/python3.7/site-packages/_pytest/assertion/rewrite.py:186: in exec_module
    exec(co, module.__dict__)
datacommons_client/tests/utils/test_response.py:1: in <module>
    from datacommons_client.models.observation import Facet
datacommons_client/models/observation.py:3: in <module>
    from typing import Any, Dict, TypeAlias
E   ImportError: cannot import name 'TypeAlias' from 'typing' (/usr/local/lib/python3.7/typing.py)
=========================== short test summary info ============================
ERROR datacommons_client/tests/endpoints/test_payloads.py - TypeError: 'type'...
ERROR datacommons_client/tests/models/test_node_models.py
ERROR datacommons_client/tests/models/test_observation_models.py
ERROR datacommons_client/tests/models/test_resolve_models.py
ERROR datacommons_client/tests/utils/test_request_handling.py
ERROR datacommons_client/tests/utils/test_response.py
!!!!!!!!!!!!!!!!!!! Interrupted: 6 errors during collection !!!!!!!!!!!!!!!!!!!!
============================== 6 errors in 1.48s ===============================
#### Checking Python style
PUSH
DONE

Build Log: https://console.cloud.google.com/cloud-build/builds/45b640f0-c788-44d2-8087-6a46a60d5be9?project=879489846695