Skip to content

Commit

Permalink
Py 3.8 support (#88)
Browse files Browse the repository at this point in the history
* start

* add removesuffix func (#3)
  • Loading branch information
bipinkrish authored Apr 11, 2024
1 parent b1b4f0d commit 9cb50de
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/python.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9"]
python-version: ["3.8"]

steps:
- uses: actions/checkout@v3
Expand Down
15 changes: 10 additions & 5 deletions src/python/pose_format/bin/directory.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
#!/usr/bin/env python

import argparse
import os

from pose_format.bin.pose_estimation import pose_video
from tqdm import tqdm


def removesuffix(text: str, suffix: str):
if text.endswith(suffix):
return text[:-len(suffix)]
else:
return text


def find_missing_pose_files(directory: str):
all_files = os.listdir(directory)
mp4_files = [f for f in all_files if f.endswith(".mp4")]
pose_files = {f.removesuffix(".pose") for f in all_files if f.endswith(".pose")}
pose_files = {removesuffix(f, ".pose") for f in all_files if f.endswith(".pose")}
missing_pose_files = []

for mp4_file in mp4_files:
base_name = mp4_file.removesuffix(".mp4")
base_name = removesuffix(mp4_file, ".mp4")
if base_name not in pose_files:
missing_pose_files.append(os.path.join(directory, mp4_file))

Expand All @@ -34,5 +39,5 @@ def main():
missing_pose_files = find_missing_pose_files(args.directory)

for mp4_path in tqdm(missing_pose_files):
pose_file_name = mp4_path.removesuffix(".mp4") + ".pose"
pose_file_name = removesuffix(mp4_path, ".mp4") + ".pose"
pose_video(mp4_path, pose_file_name, 'mediapipe')
2 changes: 1 addition & 1 deletion src/python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ dependencies = [
"scipy",
"tqdm"
]
requires-python = ">= 3.9"
requires-python = ">= 3.8"

[project.optional-dependencies]
dev = [
Expand Down

0 comments on commit 9cb50de

Please sign in to comment.