Skip to content

Commit

Permalink
Turn TagWeight into a dataclass
Browse files Browse the repository at this point in the history
  • Loading branch information
Louis committed Feb 11, 2022
1 parent 8637745 commit 8d010e9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lektor_tags.py
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
import collections
import posixpath
from dataclasses import dataclass
from math import log

import pkg_resources
Expand Down Expand Up @@ -67,11 +68,12 @@ def build_artifact(self, artifact):
artifact.render_template_into(self.source.template_name, this=self.source)


@dataclass
class TagWeight:
def __init__(self, count, mincount, maxcount):
self.count = count
self.mincount = mincount
self.maxcount = maxcount

count: int
mincount: int
maxcount: int

def __lt__(self, other):
return self.count < other.count
Expand Down
2 changes: 2 additions & 0 deletions setup.cfg
Expand Up @@ -21,6 +21,8 @@ include_package_data = True
setup_requires =
setuptools >= 45
setuptools_scm >= 6
install_requires =
dataclasses;python_version<"3.7"

[options.entry_points]
lektor.plugins =
Expand Down

0 comments on commit 8d010e9

Please sign in to comment.