aglinxinyuan opened a new pull request, #9550:
URL: https://github.com/apache/texera/pull/9550

   ### What changes were proposed in this PR?
   
   Remove redundant statements, unused imports, unnecessary control-flow 
branches, and legacy idioms across `amber/src/main/python/` and 
`amber/src/main/scala/org/apache/texera/web/resource/aiassistant/type_annotation_visitor.py`
 with no runtime behavior change:
   
   - **Redundant statements and unused imports:** Remove redundant `pass` 
statements in docstring-only abstract methods and marker classes 
(`InternalMarker`, `BufferedItemWriter`, `ReadonlyVirtualDocument`, and 
`UDFOperatorV2`/`UDFSourceOperator`/`UDFTableOperator`/`UDFBatchOperator`), 
remove trailing `return None` in `BackpressureHandler`, drop unused `import 
core`, unnecessary dict unpacking, and intermediate return variables in 
`iceberg_utils` and `timestamp`, and remove the unused `enumerate` index in 
`TypeAnnotationVisitor`.
   - **Unnecessary control-flow branches:** Remove redundant `else`/`elif` 
blocks following `return` in `detect_attribute_type_from_arrow_field`, 
`Table.__eq__`, `DocumentFactory`, and `IcebergCatalogInstance.get_instance`, 
and merge identical `staticmethod` decorator checks in `TypeAnnotationVisitor`.
   - **Idiomatic constructors, formatting, and stdlib equivalents:** Replace 
`list()`/`dict()`/`bytes()` with literal forms (`[]`/`{}`/`b""`), replace 
`super(ProxyServer, self)` with `super()`, replace `map(lambda ...)` with a 
generator expression and simplify the payload conditional in `ProxyServer`, 
adopt `datetime.UTC` and `@functools.cache` in `attribute_type`, and use 
`!r`/`!s` f-strings in `Schema`, `ProxyServer`, `Heartbeat`, and 
`ExpressionEvaluator`.
   
   ### Any related issues, documentation, discussions?
   
   Closes #9543.
   
   ### How was this PR tested?
   
   Ran in `amber/` on `2a319878af` (Python 3.12.10, `ruff 0.14.7`, `pytest 
7.4.0`):
   
   ```bash
   ruff check src/main/python src/test/python
   ruff format --check src/main/python src/test/python
   ruff check 
src/main/scala/org/apache/texera/web/resource/aiassistant/type_annotation_visitor.py
   PYTHONPATH=src/main/scala/org/apache/texera/web/resource/aiassistant \
     pytest 
src/main/scala/org/apache/texera/web/resource/aiassistant/test_type_annotation_visitor.py
 -q
   pytest \
     
src/test/python/core/architecture/handlers/actorcommand/test_actor_handler_base.py
 \
     src/test/python/core/architecture/managers/test_exception_manager.py \
     src/test/python/core/architecture/rpc/test_async_rpc_client.py \
     src/test/python/core/architecture/sendsemantics/test_partitioners.py \
     src/test/python/core/models/schema/test_arrow_schema_utils.py \
     src/test/python/core/models/schema/test_attribute_type.py \
     src/test/python/core/models/schema/test_schema.py \
     src/test/python/core/models/test_table.py \
     src/test/python/core/proxy/test_proxy_client.py \
     src/test/python/core/proxy/test_proxy_server.py \
     src/test/python/core/runnables/test_console_message.py \
     src/test/python/core/runnables/test_heartbeat.py \
     src/test/python/core/runnables/test_main_loop.py \
     src/test/python/core/storage/iceberg/test_iceberg_catalog_instance.py \
     src/test/python/core/storage/iceberg/test_iceberg_utils_large_binary.py \
     src/test/python/core/storage/model/test_virtual_document.py \
     src/test/python/core/storage/test_document_factory.py \
     src/test/python/pytexera/udf/test_udf_operator.py -q
   pytest src/test/python/core/storage/iceberg/test_iceberg_utils_catalog.py \
     -k "not test_signed_filesystems_are_isolated_between_file_ios" -q
   pytest src/test/python/core/util/test_expression_evaluator.py \
     -k "not object and not container" -q
   ```
   
   - `ruff check` and `ruff format --check` (`218` files): passed.
   - `test_type_annotation_visitor.py`: `5 passed`.
   - `18` targeted `amber` Python unit-test suites: `320 passed, 9 skipped` 
(`test_attribute_type.py` Windows `time.tzset` skips).
   - `test_iceberg_utils_catalog.py` (excluding the `3` `s3fs`-dependent cases 
absent locally): `19 passed`.
   - `test_expression_evaluator.py` (excluding the `2` 
`--import-mode=importlib` repr cases): `3 passed`.
   
   ### Was this PR authored or co-authored using generative AI tooling?
   
   Generated-by: Antigravity (Gemini 4 Neon)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to