Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update poetry files #7

Merged
merged 4 commits into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading