Browse Source

cleanup,fix,refactor

shut-new-model
Niklas Rosenstein 9 months ago
parent
commit
8f8cb68f00
No known key found for this signature in database GPG Key ID: 6D269B33D25F6C6
6 changed files with 14 additions and 8 deletions
  1. + 8
    - 1
      src/shut/checks/__init__.py
  2. + 2
    - 2
      src/shut/checks/basic.py
  3. + 1
    - 1
      src/shut/checks/core.py
  4. + 1
    - 1
      src/shut/checks/monorepo.py
  5. + 1
    - 2
      src/shut/checks/package.py
  6. + 1
    - 1
      src/shut/utils/external/classifiers.py

+ 8
- 1
src/shut/checks/__init__.py

@ -19,5 +19,12 @@
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
from .core import *
from .core import (
CheckStatus,
CheckResult,
Check,
register_checker,
get_checks,
)
from . import basic, monorepo, package

+ 2
- 2
src/shut/checks/basic.py

@ -37,5 +37,5 @@ class BasicChecker(Checker):
', '.join(map(str, obj.unknown_keys)) if obj.unknown_keys else None)
register_checker(BasicChecker, MonorepoModel)
register_checker(BasicChecker, PackageModel)
register_checker(MonorepoModel, BasicChecker)
register_checker(PackageModel, BasicChecker)

+ 1
- 1
src/shut/checks/core.py

@ -78,7 +78,7 @@ class Checker(Generic[T]):
registry = {}
def register_checker(checker: Type[Checker[T]], t: Type[T]) -> Type[Checker]:
def register_checker(t: Type[T], checker: Type[Checker[T]]) -> Type[Checker]:
"""
Decorator to register a #Checker subclass.
"""

+ 1
- 1
src/shut/checks/monorepo.py

@ -40,4 +40,4 @@ class MonorepoChecker(Checker[MonorepoModel]):
yield SkipCheck()
register_checker(MonorepoChecker, MonorepoModel)
register_checker(MonorepoModel, MonorepoChecker)

+ 1
- 2
src/shut/checks/package.py

@ -27,7 +27,6 @@ from shut.utils.external.classifiers import get_classifiers
from .core import CheckResult, CheckStatus, Checker, check, register_checker
class PackageChecker(Checker[PackageModel]):
@check('readme')
@ -107,4 +106,4 @@ class PackageChecker(Checker[PackageModel]):
'file "py.typed" exists but $.typed is not set')
register_checker(PackageChecker, PackageModel)
register_checker(PackageModel, PackageChecker)

+ 1
- 1
src/shut/utils/external/classifiers.py

@ -51,7 +51,7 @@ def get_classifiers(force_refresh: bool = False) -> List[str]:
_runtime_cache = [x.rstrip('\n') for x in fp]
return list(_runtime_cache)
has_cachefile = not force_frefresh and os.path.isfile(CACHE_FILENAME)
has_cachefile = not force_refresh and os.path.isfile(CACHE_FILENAME)
if has_cachefile and (time.time() - os.path.getmtime(CACHE_FILENAME)) < CACHE_TTL:
return _load_cachefile()
try:

Loading…
Cancel
Save