Skip to content

Commit

Permalink
update for linting
Browse files Browse the repository at this point in the history
  • Loading branch information
JakeWags committed Oct 7, 2024
1 parent fe6b30d commit 737040f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 14 deletions.
2 changes: 0 additions & 2 deletions shapeworks_cloud/core/rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ def get_queryset(self):
return models.Dataset.objects.filter(Q(private=False) | Q(creator=user)).order_by('name')

def perform_create(self, serializer):
print("PERFORM CREATE")
user = None
if self.request and hasattr(self.request, 'user'):
user = self.request.user
Expand All @@ -99,7 +98,6 @@ def perform_create(self, serializer):
'Create Dataset',
str(serializer),
)
print("PERFORM CREATE 2")
serializer.save(creator=user)

@action(
Expand Down
11 changes: 4 additions & 7 deletions swcc/swcc/models/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@ class Config:
arbitrary_types_allowed = True

def load_data(self, create=True):
if (
not hasattr(self.dataset.file, 'path')
or not self.dataset.file.path
):
if (not hasattr(self.dataset.file, 'path') or not self.dataset.file.path):
file = Path(str(self.dataset.file))
else:
file = self.dataset.file.path
Expand All @@ -41,8 +38,8 @@ def load_data_from_json(self, file, create):
if self.dataset.has_data():
if len(data) != len(list(self.dataset.subjects)):
raise Exception(
f'''Number of subjects in uploaded project ({len(list(self.dataset.subjects))})
does not match number of subjects in the dataset ({len(data)}).'''
f"""Number of subjects in uploaded project ({len(list(self.dataset.subjects))})
does not match number of subjects in the dataset ({len(data)})."""
)
if create:
print(f'Uploading files for {len(data)} subjects...')
Expand All @@ -61,7 +58,7 @@ def create_objects_for_subject(
subject,
objects_by_domain,
):
from .other_models import (
from .other_models import ( # noqa: I001
Contour,
Image,
Mesh,
Expand Down
10 changes: 5 additions & 5 deletions swcc/swcc/models/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,15 @@ def load_data_from_json(self, file, create_subjects):
if self.project.dataset.has_data():
if len(data) != len(list(self.project.dataset.subjects)):
raise Exception(
f'''Number of subjects in uploaded project
f"""Number of subjects in uploaded project
({len(list(self.project.dataset.subjects))})
does not match number of subjects in the dataset ({len(data)}).'''
does not match number of subjects in the dataset ({len(data)})."""
)

if create_subjects:
print("Creating subjects using data in project file...")
print('Creating subjects using data in project file...')
else:
print("Creating project-specific objects for subjects...")
print('Creating project-specific objects for subjects...')
i = 0
total_progress_steps = len(data)
print_progress_bar(i, total_progress_steps)
Expand Down Expand Up @@ -237,7 +237,7 @@ def relative_path(filepath):
).create()

def load_analysis_from_json(self, file_path):
print("Loading cached analysis...")
print('Loading cached analysis...')
project_root = Path(str(self.project.file.path)).parent
analysis_file_location = project_root / Path(file_path)
contents = json.load(open(analysis_file_location))
Expand Down

0 comments on commit 737040f

Please sign in to comment.