Skip to content

Commit

Permalink
Code Refactor ruff check --fix --extend-select I (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
glenn-jocher authored Jun 16, 2024
1 parent 6a5052d commit 82cb8a4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 15 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ name: Ultralytics Actions

on:
push:
branches: [main,master]
branches: [main]
pull_request_target:
branches: [main,master]
branches: [main]

jobs:
format:
Expand Down
17 changes: 4 additions & 13 deletions bing_scraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ def similar_images(self, similar_images):

newurl = f"https://www.google.com/search?tbs=sbi:{urll}&site=search&sa=X"
req2 = urllib.request.Request(newurl, headers=headers)
resp2 = urllib.request.urlopen(req2)
urllib.request.urlopen(req2)
l3 = content.find("/search?sa=X&q=")
l4 = content.find(";", l3 + 19)
return content[l3 + 19 : l4]
Expand Down Expand Up @@ -889,13 +889,13 @@ def download_image(
if no_numbering:
path = f"{main_directory}/{dir_name}/{prefix}{image_name}"
else:
path = f"{main_directory}/" + dir_name + "/" + prefix + str(count) + "." + image_name
path = f"{main_directory}/{dir_name}/{prefix}{str(count)}.{image_name}"

try:
with open(path, "wb") as output_file:
output_file.write(data)
if save_source:
list_path = main_directory + "/" + save_source + ".txt"
list_path = f"{main_directory}/{save_source}.txt"
with open(list_path, "a") as list_file:
list_file.write(path + "\t" + img_src + "\n")
absolute_path = os.path.abspath(path)
Expand Down Expand Up @@ -1171,16 +1171,7 @@ def download_executor(self, arguments):
for sky in suffix_keywords: # 2.for every suffix keywords
i = 0
while i < len(search_keyword): # 3.for every main keyword
iteration = (
"\n"
+ "Item no.: "
+ str(i + 1)
+ " -->"
+ " Item name = "
+ (pky)
+ (search_keyword[i])
+ (sky)
)
("\n" + "Item no.: " + str(i + 1) + " -->" + " Item name = " + (pky) + (search_keyword[i]) + (sky))
# if not arguments["silent_mode"]:
# print(iteration.encode('raw_unicode_escape').decode('utf-8'))
# print("Evaluating...")
Expand Down

0 comments on commit 82cb8a4

Please sign in to comment.