From 7d8384d44e67236a96d0af8c3d66437279117ace Mon Sep 17 00:00:00 2001 From: pawangeek Date: Thu, 10 Oct 2024 21:21:09 +0530 Subject: [PATCH 1/3] fix: flake8 linter --- .github/workflows/codeql-analysis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index d4f1d39e0..7f23bd1d2 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -5,11 +5,11 @@ jobs: lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: - python-version: '3.8' + python-version: '3.12' - name: Install flake8 run: | python -m pip install --upgrade pip From 7346700bd297403d3ca3a8ec118080401cb0b1c0 Mon Sep 17 00:00:00 2001 From: pawangeek Date: Thu, 10 Oct 2024 21:25:56 +0530 Subject: [PATCH 2/3] fix: linted files --- .../connect_strongest_wifi.py | 2 +- crypto_converter/cryptoconvert.py | 8 +++--- file_search/filesearch.py | 28 +++++++++---------- pdf_watermarkadder/main.py | 3 +- video_cropper/video_cropper.py | 2 +- watermark_maker/main.py | 3 +- 6 files changed, 22 insertions(+), 24 deletions(-) diff --git a/connect_strongest_wifi/connect_strongest_wifi.py b/connect_strongest_wifi/connect_strongest_wifi.py index 2c4a724d1..df8a3d128 100644 --- a/connect_strongest_wifi/connect_strongest_wifi.py +++ b/connect_strongest_wifi/connect_strongest_wifi.py @@ -63,7 +63,7 @@ def main(): print(f"\nYour {len(networks)} Strongest Networks are :") for key, network in enumerate(networks): - print(f"\t[{key+1}] {network[0]}, Signal: {network[1]}%") + print(f"\t[{key + 1}] {network[0]}, Signal: {network[1]}%") choice = input("\nPlease enter your choice : \n\t>> ").strip() if not (choice.isdigit() and 1 <= int(choice) <= len(networks)): diff --git a/crypto_converter/cryptoconvert.py b/crypto_converter/cryptoconvert.py index fe1ddfd77..74a8d3b79 100644 --- a/crypto_converter/cryptoconvert.py +++ b/crypto_converter/cryptoconvert.py @@ -108,9 +108,9 @@ def main(): return elif result == 1: continue - print(f"""\n{'-'*42} + print(f"""\n{'-' * 42} {crypto_value} {crypto_type.upper()} in {fiat_type.upper()} is --> {result} -{'-'*42}""") +{'-' * 42}""") elif user_inp == "2": fiat_type = input("\nEnter the Fiat Money Type : ") @@ -134,9 +134,9 @@ def main(): return elif result == 1: continue - print(f"""\n{'-'*42} + print(f"""\n{'-' * 42} {fiat_value} {fiat_type.upper()} in {crypto_type.upper()} is --> {result} -{'-'*42}""") +{'-' * 42}""") elif user_inp == "Q" or user_inp == "q": return diff --git a/file_search/filesearch.py b/file_search/filesearch.py index bd874d56a..c4b935b2b 100644 --- a/file_search/filesearch.py +++ b/file_search/filesearch.py @@ -24,12 +24,12 @@ def get_file_count(self, path, is_folder): self.file_count += len(files) def __perform_search( - self, - search_term, - start_dir, - is_folder, - disable_case, - show_bar + self, + search_term, + start_dir, + is_folder, + disable_case, + show_bar ): results = [] for root, dirs, files in os.walk(start_dir): @@ -57,12 +57,12 @@ def __perform_search( return results def search( - self, - search_term, - start_dir, - is_folder=False, - disable_case=False, - show_bar=True + self, + search_term, + start_dir, + is_folder=False, + disable_case=False, + show_bar=True ): self.file_count = 0 self.get_file_count(start_dir, is_folder) @@ -83,10 +83,10 @@ def search( if not is_folder: print( - f"\n\n[INFO] Searched {self.file_count:,} files in {(end_time-start_time).total_seconds()} seconds") + f"\n\n[INFO] Searched {self.file_count:,} files in {(end_time - start_time).total_seconds()} seconds") else: print( - f"\n\n[INFO] Searched {self.file_count:,} folders in {(end_time-start_time).total_seconds()} seconds") + f"\n\n[INFO] Searched {self.file_count:,} folders in {(end_time - start_time).total_seconds()} seconds") return result diff --git a/pdf_watermarkadder/main.py b/pdf_watermarkadder/main.py index d6d9b0a28..b5a9d0e10 100644 --- a/pdf_watermarkadder/main.py +++ b/pdf_watermarkadder/main.py @@ -4,7 +4,6 @@ from reportlab.lib.pagesizes import A4 from PyPDF2 import PdfFileReader, PdfFileWriter - print("Enter file names with its extenstion!") @@ -23,7 +22,7 @@ def makepdf(): pdf_file = input("PDF file: ") watermark = 'watermark.pdf' merged = "finalDraft.pdf" - with open(pdf_file, "rb") as input_file,\ + with open(pdf_file, "rb") as input_file, \ open(watermark, "rb") as watermark_file: input_pdf = PdfFileReader(input_file) watermark_pdf = PdfFileReader(watermark_file) diff --git a/video_cropper/video_cropper.py b/video_cropper/video_cropper.py index 462bc1c11..f5eeac196 100644 --- a/video_cropper/video_cropper.py +++ b/video_cropper/video_cropper.py @@ -11,7 +11,7 @@ def to_int(a, rel_to): If string contains "%" it converts it to a float and multiplies by rel_to EG: 50% -> 0.5*rel_to ''' - if type(a) == int: + if isinstance(a, int): return a else: if '%' in a: diff --git a/watermark_maker/main.py b/watermark_maker/main.py index d6d9b0a28..b5a9d0e10 100644 --- a/watermark_maker/main.py +++ b/watermark_maker/main.py @@ -4,7 +4,6 @@ from reportlab.lib.pagesizes import A4 from PyPDF2 import PdfFileReader, PdfFileWriter - print("Enter file names with its extenstion!") @@ -23,7 +22,7 @@ def makepdf(): pdf_file = input("PDF file: ") watermark = 'watermark.pdf' merged = "finalDraft.pdf" - with open(pdf_file, "rb") as input_file,\ + with open(pdf_file, "rb") as input_file, \ open(watermark, "rb") as watermark_file: input_pdf = PdfFileReader(input_file) watermark_pdf = PdfFileReader(watermark_file) From 9d68c902d3a89381d30f4238e5bf0db2d2001615 Mon Sep 17 00:00:00 2001 From: pawangeek Date: Thu, 10 Oct 2024 21:27:36 +0530 Subject: [PATCH 3/3] fix: linted lines --- file_search/filesearch.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/file_search/filesearch.py b/file_search/filesearch.py index c4b935b2b..6fbabc58f 100644 --- a/file_search/filesearch.py +++ b/file_search/filesearch.py @@ -83,10 +83,10 @@ def search( if not is_folder: print( - f"\n\n[INFO] Searched {self.file_count:,} files in {(end_time - start_time).total_seconds()} seconds") + f"\n\n[INFO] Searched {self.file_count:,} files in {(end_time - start_time).total_seconds()} sec") else: print( - f"\n\n[INFO] Searched {self.file_count:,} folders in {(end_time - start_time).total_seconds()} seconds") + f"\n\n[INFO] Searched {self.file_count:,} folders in {(end_time - start_time).total_seconds()} sec") return result