Skip to content
This repository has been archived by the owner on Sep 15, 2023. It is now read-only.

Commit

Permalink
fix: bugs raised by pylint
Browse files Browse the repository at this point in the history
I formated incorrect logging info messages, species values retrieved from widgets, removed unnecessary functions for tut#5, 6 and 7,
and 8
  • Loading branch information
victor-wildlife committed Sep 14, 2023
1 parent be19c27 commit 7cf2d66
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 62 deletions.
8 changes: 3 additions & 5 deletions kso_utils/movie_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,7 @@ def movies_in_movie_folder(project: Project, db_connection, server_connection: d
mov_folder_df = pd.Series(available_movies_list, name="fpath").to_frame()

else:
raise ValueError(
f"Unsupported server type: {project.server}. Supported servers are {server_types}."
)
raise ValueError(f"Unsupported server type: {project.server}")

return mov_folder_df

Expand Down Expand Up @@ -416,7 +414,7 @@ def write_movie_frames(key_movie_df: pd.DataFrame, url: str):
f"No frame was extracted for {url} at frame {row['frame_number']}"
)
else:
logging.info("Missing movie", url)
logging.info(f"Missing movie {url}")


def get_movie_extensions():
Expand Down Expand Up @@ -464,7 +462,7 @@ def convert_video(
conv_fpath = os.path.join(conv_filename)

else:
logging.error("The path to", movie_path, " is invalid")
logging.error(f"The path to {movie_path} is invalid")

if gpu_available and compression:
subprocess.call(
Expand Down
58 changes: 4 additions & 54 deletions kso_utils/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -671,13 +671,13 @@ def upload_zoo_subjects(self, subject_type: str):
project=self.project,
db_connection=self.db_connection,
df=self.generated_frames,
species_list=self.species_of_interest.value,
species_list=self.species_of_interest,
csv_paths=self.csv_paths,
)
zoo_utils.upload_frames_to_zooniverse(
project=self.project,
upload_to_zoo=upload_df,
species_list=self.species_of_interest.value,
species_list=self.species_of_interest,
)

else:
Expand Down Expand Up @@ -759,7 +759,7 @@ def extract_zoo_frames(
if test:
species_list = self.aggregated_zoo_classifications.label.unique().tolist()
else:
species_list = self.species_of_interest.value
species_list = self.species_of_interest

self.generated_frames = zoo_utils.extract_frames_for_zoo(
project=self.project,
Expand Down Expand Up @@ -800,7 +800,7 @@ def on_button_clicked(b):
self.modified_frames = zoo_utils.modify_frames(
project=self.project,
frames_to_upload_df=self.generated_frames.reset_index(drop=True),
species_i=self.species_of_interest.value,
species_i=self.species_of_interest,
modification_details=frame_modification.checks,
)

Expand Down Expand Up @@ -919,51 +919,6 @@ def on_button_clicked(b):
display(frame_modification)
display(button)

#############
# t5, t6, t7
#############

def get_team_name(self):
"""
> If the project name is "Spyfish_Aotearoa", return "wildlife-ai", otherwise return "koster"
:param project_name: The name of the project you want to get the data from
:type project_name: str
:return: The team name is being returned.
"""

if self.project.Project_name == "Spyfish_Aotearoa":
return "wildlife-ai"
else:
return "koster"

def get_ml_data(self):
# get template ml data
pass

def process_image(self):
# code for processing image goes here
pass

def prepare_metadata(self):
# code for preparing metadata goes here
pass

def prepare_movies(self):
# code for preparing movie files (standardising formats)
pass

def check_frames_uploaded(self):
"""
This function checks if the frames in the frames_to_upload_df dataframe have been uploaded to
the database
"""
t_utils.check_frames_uploaded(
self.project,
self.frames_to_upload_df,
self.species_of_interest,
)

#############
# t8
#############
Expand Down Expand Up @@ -1649,11 +1604,6 @@ def fiftyone_annotate(self):
# Save the annotations
dataset.save()

def annotate(self, autolabel_model: str = None):
return t_utils.get_annotator(
self.images_path, self.potential_labels, autolabel_model
)

def load_annotations(self):
images = sorted(
[
Expand Down
4 changes: 1 addition & 3 deletions kso_utils/zooniverse_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1689,9 +1689,7 @@ def check_frames_uploaded(
logging.error("All of the frames you have selected are already uploaded.")
else:
logging.info(
"There are",
len(frames_df),
"frames with the species of interest not uploaded to Zooniverse yet.",
f"There are {len(frames_df)} frames with the species of interest not uploaded to Zooniverse yet.",
)

else:
Expand Down

0 comments on commit 7cf2d66

Please sign in to comment.