Skip to content

Commit

Permalink
revert add 'flake8-commas (COM) lints
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisjsewell committed Mar 26, 2024
1 parent 698a696 commit 8d99f4e
Show file tree
Hide file tree
Showing 33 changed files with 171 additions and 433 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/docutils_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ def modify_readme(content: str) -> str:
)
content = content.replace("myst-docutils.readthedocs", "myst-parser.readthedocs")
content = content.replace(
"readthedocs.org/projects/myst-docutils",
"readthedocs.org/projects/myst-parser",
"readthedocs.org/projects/myst-docutils", "readthedocs.org/projects/myst-parser"
)
return content

Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
{
"path": "../myst_parser",
"exclude_files": ["_docs.py"],
},
}
]
autodoc2_hidden_objects = ["dunder", "private", "inherited"]
autodoc2_replace_annotations = [
Expand Down
2 changes: 1 addition & 1 deletion docs/live_preview.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def convert(input_config: str, input_myst: str, writer_name: str) -> dict:
"doctitle_xform": False,
"sectsubtitle_xform": False,
"initial_header_level": 1,
},
}
)
try:
output = publish_string(
Expand Down
13 changes: 4 additions & 9 deletions myst_parser/_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def run(self):
continue

if self.options.get("scope") == "local" and field.metadata.get(
"global_only",
"global_only"
):
continue

Expand All @@ -152,7 +152,7 @@ def run(self):
f"* - `{name}`",
f" - `{ctype}`",
f" - {description} (default: `{default}`)",
],
]
)

count += 1
Expand Down Expand Up @@ -202,9 +202,7 @@ def run(self):
name = self.arguments[0]
# load the directive class
klass, _ = directives.directive(
name,
self.state.memo.language,
self.state.document,
name, self.state.memo.language, self.state.document
)
if klass is None:
LOGGER.warning(f"Directive {name} not found.", line=self.lineno)
Expand Down Expand Up @@ -404,10 +402,7 @@ class MystLexer(MarkdownLexer):
(
r"^(\()([^\n]+)(\)=)(\n)",
bygroups(
token.Punctuation,
token.Name.Label,
token.Punctuation,
token.Text,
token.Punctuation, token.Name.Label, token.Punctuation, token.Text
),
),
# :::
Expand Down
6 changes: 1 addition & 5 deletions myst_parser/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,7 @@ def print_anchors(args=None):
help="Output file (default stdout)",
)
arg_parser.add_argument(
"-l",
"--level",
type=int,
default=2,
help="Maximum heading level.",
"-l", "--level", type=int, default=2, help="Maximum heading level."
)
args = arg_parser.parse_args(args)
parser = create_md_parser(MdParserConfig(), RendererHTML)
Expand Down
15 changes: 5 additions & 10 deletions myst_parser/config/dc_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,7 @@ def validate_fields(inst: Any) -> None:

class ValidatorType(Protocol):
def __call__(
self,
inst: Any,
field: dc.Field,
value: Any,
suffix: str = "",
self, inst: Any, field: dc.Field, value: Any, suffix: str = ""
) -> None:
...

Expand All @@ -67,7 +63,7 @@ def _validator(inst, field, value, suffix=""):
if not isinstance(value, type_):
raise TypeError(
f"'{field.name}{suffix}' must be of type {type_!r} "
f"(got {value!r} that is a {value.__class__!r}).",
f"(got {value!r} that is a {value.__class__!r})."
)

return _validator
Expand Down Expand Up @@ -98,7 +94,7 @@ def is_callable(inst, field, value, suffix=""):
if not callable(value):
raise TypeError(
f"'{field.name}{suffix}' must be callable "
f"(got {value!r} that is a {value.__class__!r}).",
f"(got {value!r} that is a {value.__class__!r})."
)


Expand All @@ -119,15 +115,14 @@ def _validator(inst, field, value, suffix=""):

if not in_options:
raise ValueError(
f"'{field.name}{suffix}' must be in {options!r} (got {value!r})",
f"'{field.name}{suffix}' must be in {options!r} (got {value!r})"
)

return _validator


def deep_iterable(
member_validator: ValidatorType,
iterable_validator: ValidatorType | None = None,
member_validator: ValidatorType, iterable_validator: ValidatorType | None = None
) -> ValidatorType:
"""
A validator that performs deep validation of an iterable.
Expand Down
5 changes: 1 addition & 4 deletions myst_parser/inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,10 +401,7 @@ def filter_string(


def fetch_inventory(
uri: str,
*,
timeout: None | float = None,
base_url: None | str = None,
uri: str, *, timeout: None | float = None, base_url: None | str = None
) -> InventoryType:
"""Fetch an inventory from a URL or local path."""
if uri.startswith(("http://", "https://")):
Expand Down
Loading

0 comments on commit 8d99f4e

Please sign in to comment.