mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-04-13 06:24:16 +00:00
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
72ad6dc953
commit
f4cd1ba0d6
813 changed files with 66015 additions and 58839 deletions
|
|
@ -1,15 +1,21 @@
|
|||
import sys
|
||||
import marshal
|
||||
from __future__ import annotations
|
||||
|
||||
import contextlib
|
||||
import dis
|
||||
import marshal
|
||||
import sys
|
||||
|
||||
from distutils.version import StrictVersion
|
||||
|
||||
from ._imp import find_module, PY_COMPILED, PY_FROZEN, PY_SOURCE
|
||||
from . import _imp
|
||||
from ._imp import find_module
|
||||
from ._imp import PY_COMPILED
|
||||
from ._imp import PY_FROZEN
|
||||
from ._imp import PY_SOURCE
|
||||
|
||||
|
||||
__all__ = [
|
||||
'Require', 'find_module', 'get_module_constant', 'extract_constant'
|
||||
'Require', 'find_module', 'get_module_constant', 'extract_constant',
|
||||
]
|
||||
|
||||
|
||||
|
|
@ -18,7 +24,8 @@ class Require:
|
|||
|
||||
def __init__(
|
||||
self, name, requested_version, module, homepage='',
|
||||
attribute=None, format=None):
|
||||
attribute=None, format=None,
|
||||
):
|
||||
|
||||
if format is None and requested_version is not None:
|
||||
format = StrictVersion
|
||||
|
|
@ -34,15 +41,15 @@ class Require:
|
|||
def full_name(self):
|
||||
"""Return full package/distribution name, w/version"""
|
||||
if self.requested_version is not None:
|
||||
return '%s-%s' % (self.name, self.requested_version)
|
||||
return '{}-{}'.format(self.name, self.requested_version)
|
||||
return self.name
|
||||
|
||||
def version_ok(self, version):
|
||||
"""Is 'version' sufficiently up-to-date?"""
|
||||
return self.attribute is None or self.format is None or \
|
||||
str(version) != "unknown" and version >= self.requested_version
|
||||
str(version) != 'unknown' and version >= self.requested_version
|
||||
|
||||
def get_version(self, paths=None, default="unknown"):
|
||||
def get_version(self, paths=None, default='unknown'):
|
||||
"""Get version number of installed module, 'None', or 'default'
|
||||
|
||||
Search 'paths' for module. If not found, return 'None'. If found,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue