Skip to content

Commit

Permalink
Conditionalize kw_only dataclass arg by python version
Browse files Browse the repository at this point in the history
  • Loading branch information
analog-cbarber committed Apr 22, 2024
1 parent 022db41 commit b7417bf
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/whl2conda/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import dataclasses
import datetime as dt
import json
import sys
from pathlib import Path
from typing import Any, Callable, ClassVar, NamedTuple, Union

Expand Down Expand Up @@ -121,7 +122,14 @@ def _fromidentifier(name: str) -> str:
return name.replace("_", "-")


@dataclasses.dataclass(kw_only=True)
if sys.version_info >= (3, 10):
# kw_only is not available until 3.10
dataclass_args = dict(kw_only=True)
else:
dataclass_args = {}


@dataclasses.dataclass(**dataclass_args)
class Whl2CondaSettings:
"""
User settings for whl2conda.
Expand Down

0 comments on commit b7417bf

Please sign in to comment.