Skip to content

Commit

Permalink
Moved class_name argument to definition and made it non-optional
Browse files Browse the repository at this point in the history
  • Loading branch information
botant committed Apr 24, 2021
1 parent 2e500b4 commit a6e7a33
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 2 additions & 4 deletions src/attr/_cmp.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def cmp_using(
gt=None,
ge=None,
require_same_type=True,
class_name=None,
class_name="Comparable",
):
"""
Utility function that creates a class with customized equality and
Expand Down Expand Up @@ -76,9 +76,7 @@ def cmp_using(
num_order_fucntions += 1
body["__ge__"] = _make_operator("ge", ge)

type_ = new_class(
class_name or "Comparable", (object,), {}, lambda ns: ns.update(body)
)
type_ = new_class(class_name, (object,), {}, lambda ns: ns.update(body))

# Add same type requirement.
if require_same_type:
Expand Down
2 changes: 1 addition & 1 deletion src/attr/_cmp.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ def cmp_using(
gt: Optional[_CompareWithType],
ge: Optional[_CompareWithType],
require_same_type: bool,
class_name: Optional[str],
class_name: str,
) -> Type: ...

0 comments on commit a6e7a33

Please sign in to comment.