Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 79404a4

Browse files
bearomorphismLee-W
authored andcommitted
build: add PGH003 and PGH004, add types-colorama
1 parent b2d1e92 commit 79404a4

File tree

15 files changed

+45
-35
lines changed

15 files changed

+45
-35
lines changed

‎commitizen/__init__.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import logging
22
import logging.config
33

4-
from colorama import init# type: ignore
4+
from colorama import init
55

66
from commitizen.cz.base import BaseCommitizen
77

‎commitizen/commands/bump.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,14 +331,14 @@ def __call__(self) -> None:
331331
"dry_run": dry_run,
332332
}
333333
if self.changelog_to_stdout:
334-
changelog_cmd = Changelog(self.config, {**args, "dry_run": True}) # type: ignore
334+
changelog_cmd = Changelog(self.config, {**args, "dry_run": True}) # type: ignore[typeddict-item]
335335
try:
336336
changelog_cmd()
337337
except DryRunExit:
338338
pass
339339

340340
args["file_name"] = self.file_name
341-
changelog_cmd = Changelog(self.config, args) # type: ignore
341+
changelog_cmd = Changelog(self.config, args) # type: ignore[arg-type]
342342
changelog_cmd()
343343
files.append(changelog_cmd.file_name)
344344

‎commitizen/commands/changelog.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,8 @@ def _write_changelog(
177177
def _export_template(self) -> None:
178178
tpl = changelog.get_changelog_template(self.cz.template_loader, self.template)
179179
# TODO: fix the following type ignores
180-
src = Path(tpl.filename) # type: ignore
181-
Path(self.export_template_to).write_text(src.read_text()) # type: ignore
180+
src = Path(tpl.filename) # type: ignore[arg-type]
181+
Path(self.export_template_to).write_text(src.read_text()) # type: ignore[arg-type]
182182

183183
def __call__(self) -> None:
184184
commit_parser = self.cz.commit_parser

‎commitizen/config/base_config.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def settings(self) -> Settings:
2727

2828
@property
2929
def path(self) -> Path:
30-
return self._path # type: ignore
30+
return self._path # type: ignore[return-value]
3131

3232
@path.setter
3333
def path(self, path: str | Path) -> None:

‎commitizen/config/toml_config.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def init_empty_config_content(self) -> None:
3737
with open(self.path, "wb") as output_toml_file:
3838
if parser.get("tool") is None:
3939
parser["tool"] = table()
40-
parser["tool"]["commitizen"] = table() # type: ignore
40+
parser["tool"]["commitizen"] = table() # type: ignore[index]
4141
output_toml_file.write(parser.as_string().encode(self.encoding))
4242

4343
def set_key(self, key: str, value: Any) -> Self:
@@ -49,7 +49,7 @@ def set_key(self, key: str, value: Any) -> Self:
4949
with open(self.path, "rb") as f:
5050
parser = parse(f.read())
5151

52-
parser["tool"]["commitizen"][key] = value # type: ignore
52+
parser["tool"]["commitizen"][key] = value # type: ignore[index]
5353
with open(self.path, "wb") as f:
5454
f.write(parser.as_string().encode(self.encoding))
5555
return self
@@ -68,6 +68,6 @@ def _parse_setting(self, data: bytes | str) -> None:
6868
raise InvalidConfigurationError(f"Failed to parse {self.path}: {e}")
6969

7070
try:
71-
self.settings.update(doc["tool"]["commitizen"]) # type: ignore
71+
self.settings.update(doc["tool"]["commitizen"]) # type: ignore[index,typeddict-item] # TODO: fix this
7272
except exceptions.NonExistentKey:
7373
self.is_empty_config = True

‎commitizen/cz/customize/__init__.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
from .customize import CustomizeCommitsCz # noqa
1+
from .customize import CustomizeCommitsCz # noqa: F401

‎commitizen/cz/customize/customize.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,12 @@ def __init__(self, config: BaseConfig) -> None:
4848
setattr(self, attr_name, value)
4949

5050
def questions(self) -> list[CzQuestion]:
51-
return self.custom_settings.get("questions", [{}]) # type: ignore
51+
return self.custom_settings.get("questions", [{}]) # type: ignore[return-value]
5252

5353
def message(self, answers: Mapping[str, Any]) -> str:
5454
message_template = Template(self.custom_settings.get("message_template", ""))
5555
if getattr(Template, "substitute", None):
56-
return message_template.substitute(**answers) # type: ignore
56+
return message_template.substitute(**answers) # type: ignore[attr-defined,no-any-return] # pragma: no cover # TODO: check if we can fix this
5757
return message_template.render(**answers)
5858

5959
def example(self) -> str:

‎commitizen/providers/base_provider.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def set_version(self, version: str) -> None:
8686
self.file.write_text(tomlkit.dumps(document))
8787

8888
def get(self, document: tomlkit.TOMLDocument) -> str:
89-
return document["project"]["version"] # type: ignore
89+
return document["project"]["version"] # type: ignore[index,return-value]
9090

9191
def set(self, document: tomlkit.TOMLDocument, version: str) -> None:
92-
document["project"]["version"] = version # type: ignore
92+
document["project"]["version"] = version # type: ignore[index]

‎commitizen/providers/cargo_provider.py‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,18 @@ def lock_file(self) -> Path:
2323

2424
def get(self, document: tomlkit.TOMLDocument) -> str:
2525
try:
26-
return document["package"]["version"] # type: ignore
26+
return document["package"]["version"] # type: ignore[index,return-value]
2727
except tomlkit.exceptions.NonExistentKey:
2828
...
29-
return document["workspace"]["package"]["version"] # type: ignore
29+
return document["workspace"]["package"]["version"] # type: ignore[index,return-value]
3030

3131
def set(self, document: tomlkit.TOMLDocument, version: str) -> None:
3232
try:
33-
document["workspace"]["package"]["version"] = version # type: ignore
33+
document["workspace"]["package"]["version"] = version # type: ignore[index]
3434
return
3535
except tomlkit.exceptions.NonExistentKey:
3636
...
37-
document["package"]["version"] = version # type: ignore
37+
document["package"]["version"] = version # type: ignore[index]
3838

3939
def set_version(self, version: str) -> None:
4040
super().set_version(version)
@@ -44,9 +44,9 @@ def set_version(self, version: str) -> None:
4444
def set_lock_version(self, version: str) -> None:
4545
cargo_toml_content = tomlkit.parse(self.file.read_text())
4646
try:
47-
package_name = cargo_toml_content["package"]["name"] # type: ignore
47+
package_name = cargo_toml_content["package"]["name"] # type: ignore[index]
4848
except tomlkit.exceptions.NonExistentKey:
49-
package_name = cargo_toml_content["workspace"]["package"]["name"] # type: ignore
49+
package_name = cargo_toml_content["workspace"]["package"]["name"] # type: ignore[index]
5050

5151
cargo_lock_content = tomlkit.parse(self.lock_file.read_text())
5252
packages: tomlkit.items.AoT = cargo_lock_content["package"] # type: ignore[assignment]

‎commitizen/providers/commitizen_provider.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class CommitizenProvider(VersionProvider):
99
"""
1010

1111
def get_version(self) -> str:
12-
return self.config.settings["version"] # type: ignore
12+
return self.config.settings["version"] # type: ignore[return-value] # TODO: check if we can fix this by tweaking the `Settings` type
1313

1414
def set_version(self, version: str) -> None:
1515
self.config.set_key("version", version)

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /