Skip to content

Commit

Permalink
update poetry files (#7)
Browse files Browse the repository at this point in the history
* update poetry files

* update CI

* fix for CI

* update
  • Loading branch information
shunk031 committed Jun 14, 2024
1 parent 672f30e commit c20d499
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 164 deletions.
10 changes: 3 additions & 7 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,15 @@ jobs:
- name: Format
run: |
poetry run black --check .
poetry run ruff format --check --diff .
- name: Lint
run: |
poetry run ruff .
poetry run ruff check --output-format=github .
- name: Type check
run: |
poetry run mypy . \
--ignore-missing-imports \
--no-strict-optional \
--no-site-packages \
--cache-dir=/dev/null
poetry run mypy .
- name: Run tests
run: |
Expand Down
17 changes: 8 additions & 9 deletions MSCOCO.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ def from_dict(
#
# for InstancesAnnotationData
#
segmentation=segmentation_mask,
segmentation=segmentation_mask, # type: ignore
area=json_dict["area"],
iscrowd=iscrowd,
bbox=json_dict["bbox"],
Expand Down Expand Up @@ -454,7 +454,7 @@ def from_dict(
#
# for InstancesAnnotationData
#
segmentation=segmentation_mask,
segmentation=segmentation_mask, # type: ignore
area=json_dict["area"],
iscrowd=iscrowd,
bbox=json_dict["bbox"],
Expand Down Expand Up @@ -596,9 +596,8 @@ def get_features(self, *args, **kwargs) -> ds.Features:
raise NotImplementedError

@abc.abstractmethod
def load_data(
self, ann_dicts: List[JsonDict], tqdm_desc: Optional[str] = None, **kwargs
):
def load_data(self, ann_dicts: List[JsonDict], tqdm_desc: str = "", **kwargs):
assert tqdm_desc != "", "tqdm_desc must be provided."
raise NotImplementedError

@abc.abstractmethod
Expand Down Expand Up @@ -964,8 +963,8 @@ def task(self) -> str:
return config.task

def _info(self) -> ds.DatasetInfo:
processor: MsCocoProcessor = self.config.processor
features = processor.get_features(decode_rle=self.config.decode_rle)
processor: MsCocoProcessor = self.config.processor # type: ignore
features = processor.get_features(decode_rle=self.config.decode_rle) # type: ignore
return ds.DatasetInfo(
description=_DESCRIPTION,
citation=_CITATION,
Expand Down Expand Up @@ -1015,7 +1014,7 @@ def _generate_train_val_examples(
ann_dir = os.path.join(base_annotation_dir, "annotations")
ann_file_path = os.path.join(ann_dir, f"{self.task}_{split}{self.year}.json")

processor: MsCocoProcessor = self.config.processor
processor: MsCocoProcessor = self.config.processor # type: ignore

ann_json = processor.load_annotation_json(ann_file_path=ann_file_path)

Expand All @@ -1030,7 +1029,7 @@ def _generate_train_val_examples(
else None
)

config: MsCocoConfig = self.config
config: MsCocoConfig = self.config # type: ignore
yield from processor.generate_examples(
annotations=processor.load_data(
ann_dicts=ann_json["annotations"],
Expand Down
Loading

0 comments on commit c20d499

Please sign in to comment.