From cf9ede1dde97962fa720db299ee31ee5dcb37096 Mon Sep 17 00:00:00 2001 From: Siarhei Siniak Date: Tue, 20 May 2025 10:56:48 +0300 Subject: [PATCH] [+] fix ruff issues --- .../fxreader/pr34/commands_typed/cli.py | 2 +- .../online/fxreader/pr34/tasks/mlb_player.py | 30 +++++++++---------- python/pyproject.toml | 8 ++++- 3 files changed, 23 insertions(+), 17 deletions(-) diff --git a/python/online/fxreader/pr34/commands_typed/cli.py b/python/online/fxreader/pr34/commands_typed/cli.py index 0e8c342..638134a 100644 --- a/python/online/fxreader/pr34/commands_typed/cli.py +++ b/python/online/fxreader/pr34/commands_typed/cli.py @@ -263,7 +263,7 @@ class CLI(abc.ABC): subprocess.check_call([ self.dist_settings.python_path, '-m', 'pip', - 'install', + 'install', latest_file['path'], ]) diff --git a/python/online/fxreader/pr34/tasks/mlb_player.py b/python/online/fxreader/pr34/tasks/mlb_player.py index ff28e08..38780c9 100644 --- a/python/online/fxreader/pr34/tasks/mlb_player.py +++ b/python/online/fxreader/pr34/tasks/mlb_player.py @@ -5,12 +5,9 @@ import cv2 import re import json import io -import glob import xarray import numpy -import json import glob -import io import os import pandas import pickle @@ -360,7 +357,7 @@ def kernel_7( import torch.optim as optim import torchvision.transforms as transforms import torchvision.datasets as datasets - import torchvision.models as models + import torchvision.models from torch.autograd import Variable @@ -1731,7 +1728,10 @@ def kernel_28( --outdir %s ''' % (t13, t2) if False: - pprint.pprint([t4, t2, t6]) + pprint.pprint([ + # t4, + t2, t6, + ]) with subprocess.Popen(t6, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) as p: if False: pprint.pprint(p.communicate()) @@ -1794,7 +1794,7 @@ def kernel_29(video_path=None, video_id=None,): o['data'] for o in t1 ], []) - t10 = re.compile('frame-(\d+)\.jpg') + t10 = re.compile(r'frame-(\d+)\.jpg') for i, o in enumerate(t8): o['frame_id'] = int(t10.match(o['image_id'])[1]) @@ -2035,7 +2035,7 @@ def kernel_30( def kernel_31(image_id, image_size, keypoints): def get_angle(a,b): - from math import sqrt, acos, degrees, atan, degrees + from math import sqrt, acos, degrees, atan #print(a) #print(b) del_y = a[1]-b[1] @@ -2054,7 +2054,7 @@ def kernel_31(image_id, image_size, keypoints): def angle_gor(a,b,c,d): import numpy as np - from math import sqrt, acos, degrees, atan, degrees + from math import sqrt, acos, degrees, atan ab=[a[0]-b[0],a[1]-b[1]] ab1=[c[0]-d[0],c[1]-d[1]] cos = \ @@ -2075,14 +2075,14 @@ def kernel_31(image_id, image_size, keypoints): def sit_ang(a,b,c,d): ang=angle_gor(a,b,c,d) s1=0 - if ang != None: + if not ang is None: #print("Angle",ang) if ang < 120 and ang>40: s1=1 return s1 def sit_rec(a,b,c,d): - from math import sqrt, acos, degrees, atan, degrees + from math import sqrt, acos, degrees, atan ab = [a[0] - b[0], a[1] - b[1]] ab1 = [c[0] - d[0], c[1] - d[1]] @@ -2294,7 +2294,7 @@ def kernel_36(): """ - import os + # import os from os.path import exists, join, basename, splitext git_repo_url = 'https://github.com/CMU-Perceptual-Computing-Lab/openpose.git' @@ -2318,8 +2318,8 @@ def kernel_36(): """## From a Google Drive's folder""" - import os - from os.path import exists, join, basename, splitext + # import os + # from os.path import exists, join, basename, splitext folder_path = '/content/drive/My Drive/openpose/' files = os.listdir(folder_path) @@ -2354,8 +2354,8 @@ def kernel_36(): # video_folder = os.path.dirname(colab_video_path) # video_base_name = os.path.basename(colab_video_path) # print(video_base_name) - import os - from os.path import exists, join, basename, splitext + # import os + # from os.path import exists, join, basename, splitext #colab_video_path = '/content/drive/My Drive/bachata.mp4' colab_video_path = '/content/output.mp4' colab_openpose_video_path = colab_video_path.replace('.mp4', '') + '-openpose.mp4' diff --git a/python/pyproject.toml b/python/pyproject.toml index f6e1df0..02f4682 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -88,6 +88,8 @@ ignore = [ 'F841', # fix * imports 'F403', + # don't care about trailing new lines + 'W292', ] select = ['E', 'F', 'I', 'W', 'INT'] @@ -100,7 +102,11 @@ detect-same-package = true # known-third-party = ["odf", "qt", "templite", "tinycss", "css_selectors"] relative-imports-order = "closest-to-furthest" split-on-trailing-comma = true -section-order = ['__python__', "future", "standard-library", "third-party", "first-party", "local-folder"] +section-order = [ + # '__python__', + "future", + "standard-library", "third-party", "first-party", "local-folder" +] force-wrap-aliases = true # [tool.ruff.lint.isort.sections]