Skip to content

Commit

Permalink
run all
Browse files Browse the repository at this point in the history
  • Loading branch information
rwood-97 committed Oct 27, 2023
1 parent 50c6c03 commit 8443f4a
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 21 deletions.
4 changes: 3 additions & 1 deletion mapreader/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,9 @@ def versions_from_parentdir(parentdir_prefix, root, verbose):

if verbose:
print(
"Tried directories {} but none started with prefix {}".format(str(rootdirs), parentdir_prefix)
"Tried directories {} but none started with prefix {}".format(
str(rootdirs), parentdir_prefix
)
)
raise NotThisMethod("rootdir doesn't start with parentdir_prefix")

Expand Down
4 changes: 1 addition & 3 deletions mapreader/classify/classifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -565,9 +565,7 @@ def unfreeze_layers(self, layers_to_unfreeze: list[str] | None = None):
elif (layer[-1] != "*") and (layer == name):
param.requires_grad = True

def only_keep_layers(
self, only_keep_layers_list: list[str] | None = None
) -> None:
def only_keep_layers(self, only_keep_layers_list: list[str] | None = None) -> None:
"""
Only keep the specified layers (``only_keep_layers_list``) for
gradient computation during the backpropagation.
Expand Down
4 changes: 1 addition & 3 deletions mapreader/classify/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,7 @@ def __len__(self) -> int:
"""
return len(self.patch_df)

def __getitem__(
self, idx: int | torch.Tensor
) -> tuple[torch.Tensor, str, int]:
def __getitem__(self, idx: int | torch.Tensor) -> tuple[torch.Tensor, str, int]:
"""
Return the image, its label and the index of that label at the given index in the dataset.
Expand Down
6 changes: 1 addition & 5 deletions mapreader/download/tile_loading.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,11 +172,7 @@ def _update_progressbar(self, share: float):

print(
"\r",
f"{share * 100:3.0f}%"
+ "|"
+ "■" * visible
+ "□" * invisible
+ "|",
f"{share * 100:3.0f}%" + "|" + "■" * visible + "□" * invisible + "|",
end="",
)

Expand Down
10 changes: 3 additions & 7 deletions mapreader/download/tile_merging.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def _load_tile_size(self, grid_bb: GridBoundingBox):
logger.warning("Image has missing tiles in bottom left corner.")
try:
start_image = self._load_image_to_grid_cell(grid_bb.upper_corner)
except FileNotFoundError as err:
except FileNotFoundError:
logger.warning("Image has missing tiles in upper right corner.")
raise FileNotFoundError(
"[ERROR] Image is missing tiles for both lower left and upper right corners."
Expand All @@ -142,9 +142,7 @@ def _load_tile_size(self, grid_bb: GridBoundingBox):
tile_size = img_size[0]
return tile_size

def merge(
self, grid_bb: GridBoundingBox, file_name: str | None = None
) -> bool:
def merge(self, grid_bb: GridBoundingBox, file_name: str | None = None) -> bool:
"""Merges cells contained within GridBoundingBox.
Parameters
Expand Down Expand Up @@ -196,9 +194,7 @@ def merge(
merged_image.save(out_path, self.img_output_format[1])
success = True if os.path.exists(out_path) else False
if success:
logger.info(
f"Merge successful! The image has been stored at '{out_path}'"
)
logger.info(f"Merge successful! The image has been stored at '{out_path}'")
else:
logger.warning(f"Merge unsuccessful! '{out_path}' not saved.")

Expand Down
8 changes: 6 additions & 2 deletions versioneer.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,9 @@ def get_root():
vsr_dir = os.path.normcase(os.path.splitext(versioneer_py)[0])
if me_dir != vsr_dir and "VERSIONEER_PEP518" not in globals():
print(
"Warning: build in {} is using versioneer.py from {}".format(os.path.dirname(my_path), versioneer_py)
"Warning: build in {} is using versioneer.py from {}".format(
os.path.dirname(my_path), versioneer_py
)
)
except NameError:
pass
Expand Down Expand Up @@ -1444,7 +1446,9 @@ def versions_from_parentdir(parentdir_prefix, root, verbose):

if verbose:
print(
"Tried directories {} but none started with prefix {}".format(str(rootdirs), parentdir_prefix)
"Tried directories {} but none started with prefix {}".format(
str(rootdirs), parentdir_prefix
)
)
raise NotThisMethod("rootdir doesn't start with parentdir_prefix")

Expand Down

0 comments on commit 8443f4a

Please sign in to comment.