Skip to content

fix: type the example.py camera node as Device - #97

Open
forest-savage1234 wants to merge 2 commits into
casework:mainfrom
forest-savage1234:forest/mappy-43-example-device
Open

fix: type the example.py camera node as Device#97
forest-savage1234 wants to merge 2 commits into
casework:mainfrom
forest-savage1234:forest/mappy-43-example-device

Conversation

@forest-savage1234

Copy link
Copy Markdown

Use Device for the camera node in example.py

Cites #43 for the named camera line. Does not close it. The rest of the generic-ObservableObject work stays open.

Repo rules (casework/CASE-Mapping-Python): no CONTRIBUTING, no PR template. Open against main. CI is .github/workflows/ci.yml. Boxes match commands actually run on this box after PATCH.diff.

  • pre-commit run --all-files
  • poetry run mypy case_mapping example.py tests
  • poetry run pytest --doctest-modules
  • poetry run python example.py

Do not drop Bundle. Do not reopen UCO #363.

Summary

example.py still types the Nikon camera as a bare ObservableObject. Alex's comment on #43 says that line should be uco.observable.Device().

Device did not exist on main (only DeviceFacet). This adds class Device(ObservableObject) next to File — same four lines, @type uco-observable:Device — and changes that one constructor.

Validation

Shallow clone of casework/CASE-Mapping-Python main @ ea0ee6645ba10135e3c4232e79fb8bbb5e34f50c (2026-07-20 5:36am AKDT). Separate apply on a clean worktree /workspace/checkouts/CASE-Mapping-Python-43 (branch forest/mappy-43-example-device, not pushed). PATCH.diff applied (patch -p1). poetry install from the lock file, then the four CI commands. Identity for any later commit: Forest Savage forestsavage03@gmail.com. Nothing posted. Ran on Python 3.13.5 / Poetry 2.4.1 (CI matrix is 3.10 and 3.14; those were not on this box).

$ pre-commit run --all-files
check json...............................................................Passed
pretty format json.......................................................Passed
black....................................................................Passed
flake8...................................................................Passed
isort (python)...........................................................Passed

Exit 0.

$ poetry run mypy case_mapping example.py tests
Success: no issues found in 20 source files

Exit 0.

$ poetry run pytest --doctest-modules
============================= test session starts ==============================
platform linux -- Python 3.13.5, pytest-9.0.3, pluggy-1.6.0
rootdir: /workspace/checkouts/CASE-Mapping-Python-43
configfile: pyproject.toml
collected 4 items

case_mapping/base.py .                                                   [ 25%]
tests/test_duplicate.py ..                                               [ 75%]
tests/test_version.py .                                                  [100%]

============================== 4 passed in 0.08s ===============================

Exit 0.

$ poetry run python example.py

Exit 0. Wrote 80834 bytes to stdout.

Device()["@type"] is uco-observable:Device. example.py L57 is device_camera = uco.observable.Device(). L590 device_phone_object = uco.observable.ObservableObject() is unchanged. class Bundle remains at case_mapping/uco/core.py:65.

Files

  1. case_mapping/uco/observable.py (Device, same shape as File)
  2. example.py (device_camera = uco.observable.Device())

Out of scope

How to review

Device()["@type"] is uco-observable:Device. git grep -n device_camera example.py shows one constructor change. The other ObservableObject() calls are unchanged.

Volunteer stand-down

I am a volunteer. If you wanted the generator instead of this one node, or if Device should wait until more of example.py is retyped, I will stand down.

I am a volunteer. Thank you for the time. I am trying to become more useful on this work, so I welcome a critical look. If this is the wrong cut, or you want me to stand down, say so and I will recut from notes.

This does not close #43. If Device on that camera line is wrong, I will stand down.

Cites casework#43. Does not close it. The rest of the generic-ObservableObject
work stays open.

Adds class Device(ObservableObject) next to File (same four lines,
@type uco-observable:Device) and changes the named camera constructor
only. device_phone_object and the other ObservableObject() calls stay.

Out of scope: Mapping-Python casework#50 / casework#18, rewriting every other
ObservableObject() in example.py, a class generator, UCO #363, dropping
or rewriting Bundle.

Identity if committed: Forest Savage <forestsavage03@gmail.com>
Do not push from this packet.
Cites casework#43. Does not close it. The rest of the generic-ObservableObject
work stays open.

Adds class Device(ObservableObject) next to File (same four lines,
@type uco-observable:Device) and changes the named camera constructor
only. device_phone_object and the other ObservableObject() calls stay.

Out of scope: Mapping-Python casework#50 / casework#18, rewriting every other
ObservableObject() in example.py, a class generator, UCO #363, dropping
or rewriting Bundle.

Identity if committed: Forest Savage <forestsavage03@gmail.com>
Do not push from this packet.
@forest-savage1234

Copy link
Copy Markdown
Author

Thank you for the time on this review. This adds Device and types the example.py camera node as that class. If that is the wrong cut, say so and I will recut from notes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Generic ObservableObjects should be avoided when other classes exist

1 participant