You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fory.apache.org by ch...@apache.org on 2025/09/03 04:02:42 UTC
(fory) 06/06: fix lint
This is an automated email from the ASF dual-hosted git repository.
chaokunyang pushed a commit to branch releases-0.12
in repository https://gitbox.apache.org/repos/asf/fory.git
commit e60f0fac4f49b7fa76409b63fb10d7c40e08fe32
Author: chaokunyang <sh...@gmail.com>
AuthorDate: Wed Sep 3 11:16:38 2025 +0800
fix lint
---
ci/build_linux_wheels.py | 52 ++++++++++++++++------
.../format/encoder/ImplementInterfaceTest.java | 9 ++--
2 files changed, 45 insertions(+), 16 deletions(-)
diff --git a/ci/build_linux_wheels.py b/ci/build_linux_wheels.py
index 4f4d6010a..d1ba2cb5d 100755
--- a/ci/build_linux_wheels.py
+++ b/ci/build_linux_wheels.py
@@ -24,6 +24,7 @@ Images are defined as regular Python lists (no env vars).
Environment:
- GITHUB_WORKSPACE (optional; defaults to cwd)
"""
+
from __future__ import annotations
import argparse
import os
@@ -33,7 +34,9 @@ import sys
from typing import List
# Define Python version sets directly in the Python script
-RELEASE_PYTHON_VERSIONS = "cp38-cp38 cp39-cp39 cp310-cp310 cp311-cp311 cp312-cp312 cp313-cp313"
+RELEASE_PYTHON_VERSIONS = (
+ "cp38-cp38 cp39-cp39 cp310-cp310 cp311-cp311 cp312-cp312 cp313-cp313"
+)
DEFAULT_PYTHON_VERSIONS = "cp38-cp38 cp313-cp313"
# Path to the container build script
@@ -42,7 +45,6 @@ CONTAINER_SCRIPT_PATH = "ci/tasks/python_container_build_script.sh"
DEFAULT_X86_IMAGES = [
"quay.io/pypa/manylinux2014_x86_64:latest",
# "quay.io/pypa/manylinux_2_28_x86_64:latest",
-
# bazel binaries do not work with musl
# "quay.io/pypa/musllinux_1_2_x86_64:latest",
]
@@ -50,7 +52,6 @@ DEFAULT_X86_IMAGES = [
DEFAULT_AARCH64_IMAGES = [
"quay.io/pypa/manylinux2014_aarch64:latest",
# "quay.io/pypa/manylinux_2_28_aarch64:latest",
-
# bazel binaries do not work with musl
# "quay.io/pypa/musllinux_1_2_aarch64:latest",
]
@@ -65,17 +66,26 @@ ARCH_ALIASES = {
"AARCH64": "arm64",
}
+
def parse_args():
p = argparse.ArgumentParser()
- p.add_argument("--arch", required=True, help="Architecture (e.g. X86, X64, AARCH64)")
- p.add_argument("--release", action="store_true", help="Run full test suite for release")
- p.add_argument("--dry-run", action="store_true", help="Print docker commands without running")
+ p.add_argument(
+ "--arch", required=True, help="Architecture (e.g. X86, X64, AARCH64)"
+ )
+ p.add_argument(
+ "--release", action="store_true", help="Run full test suite for release"
+ )
+ p.add_argument(
+ "--dry-run", action="store_true", help="Print docker commands without running"
+ )
return p.parse_args()
+
def normalize_arch(raw: str) -> str:
key = raw.strip().upper()
return ARCH_ALIASES.get(key, raw.strip().lower())
+
def collect_images_for_arch(arch_normalized: str) -> List[str]:
if arch_normalized == "x86":
imgs = DEFAULT_X86_IMAGES # dedupe preserving order
@@ -85,6 +95,7 @@ def collect_images_for_arch(arch_normalized: str) -> List[str]:
raise SystemExit(f"Unsupported arch: {arch_normalized!r}")
return imgs
+
def build_docker_cmd(workspace: str, image: str, release: bool = False) -> List[str]:
workspace = os.path.abspath(workspace)
python_versions = RELEASE_PYTHON_VERSIONS if release else DEFAULT_PYTHON_VERSIONS
@@ -93,11 +104,18 @@ def build_docker_cmd(workspace: str, image: str, release: bool = False) -> List[
github_ref_name = os.environ.get("GITHUB_REF_NAME", "")
cmd = [
- "docker", "run", "-i", "--rm",
- "-v", f"{workspace}:/work", # (v)olume
- "-w", "/work", # (w)orking directory
- "-e", f"PYTHON_VERSIONS={python_versions}", # (e)nvironment variables
- "-e", f"RELEASE_BUILD={'1' if release else '0'}"
+ "docker",
+ "run",
+ "-i",
+ "--rm",
+ "-v",
+ f"{workspace}:/work", # (v)olume
+ "-w",
+ "/work", # (w)orking directory
+ "-e",
+ f"PYTHON_VERSIONS={python_versions}", # (e)nvironment variables
+ "-e",
+ f"RELEASE_BUILD={'1' if release else '0'}",
]
# Pass GitHub reference name if available
@@ -107,7 +125,10 @@ def build_docker_cmd(workspace: str, image: str, release: bool = False) -> List[
cmd.extend([image, "bash", CONTAINER_SCRIPT_PATH])
return cmd
-def run_for_images(images: List[str], workspace: str, dry_run: bool, release: bool = False) -> int:
+
+def run_for_images(
+ images: List[str], workspace: str, dry_run: bool, release: bool = False
+) -> int:
rc_overall = 0
for image in images:
docker_cmd = build_docker_cmd(workspace, image, release=release)
@@ -118,7 +139,10 @@ def run_for_images(images: List[str], workspace: str, dry_run: bool, release: bo
try:
completed = subprocess.run(docker_cmd)
if completed.returncode != 0:
- print(f"Container {image} exited with {completed.returncode}", file=sys.stderr)
+ print(
+ f"Container {image} exited with {completed.returncode}",
+ file=sys.stderr,
+ )
rc_overall = completed.returncode if rc_overall == 0 else rc_overall
else:
print(f"Container {image} completed successfully.")
@@ -130,6 +154,7 @@ def run_for_images(images: List[str], workspace: str, dry_run: bool, release: bo
return 2
return rc_overall
+
def main() -> int:
args = parse_args()
arch = normalize_arch(args.arch)
@@ -148,5 +173,6 @@ def main() -> int:
print(f"Selected images for arch {args.arch}: {images}")
return run_for_images(images, workspace, args.dry_run, release=args.release)
+
if __name__ == "__main__":
sys.exit(main())
diff --git a/java/fory-format/src/test/java/org/apache/fory/format/encoder/ImplementInterfaceTest.java b/java/fory-format/src/test/java/org/apache/fory/format/encoder/ImplementInterfaceTest.java
index a31b11799..c054edeab 100644
--- a/java/fory-format/src/test/java/org/apache/fory/format/encoder/ImplementInterfaceTest.java
+++ b/java/fory-format/src/test/java/org/apache/fory/format/encoder/ImplementInterfaceTest.java
@@ -144,8 +144,11 @@ public class ImplementInterfaceTest {
public interface OptionalType {
Optional<String> f1();
+
OptionalInt f2();
+
OptionalLong f3();
+
OptionalDouble f4();
}
@@ -162,17 +165,17 @@ public class ImplementInterfaceTest {
@Override
public OptionalInt f2() {
- return f2;
+ return f2;
}
@Override
public OptionalLong f3() {
- return f3;
+ return f3;
}
@Override
public OptionalDouble f4() {
- return f4;
+ return f4;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fory.apache.org
For additional commands, e-mail: commits-help@fory.apache.org