Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_specifier_explicit_legacy(self):
assert Specifier("==1.0").contains(LegacyVersion("1.0"))
def test_legacy_version_public(self, version):
assert LegacyVersion(version).public == version
def test_compare_other(self, op, expected):
other = pretend.stub(**{"__{0}__".format(op): lambda other: NotImplemented})
assert getattr(operator, op)(LegacyVersion("1"), other) is expected
"you have another use case requiring the tuple, please file a "
"bug with the setuptools project describing that need.",
RuntimeWarning,
stacklevel=1,
)
for part in old_parse_version(str(self)):
yield part
class SetuptoolsVersion(_SetuptoolsVersionMixin, packaging.version.Version):
pass
class SetuptoolsLegacyVersion(_SetuptoolsVersionMixin,
packaging.version.LegacyVersion):
pass
def parse_version(v):
try:
return SetuptoolsVersion(v)
except packaging.version.InvalidVersion:
return SetuptoolsLegacyVersion(v)
_state_vars = {}
def _declare_state(vartype, **kw):
globals().update(kw)
_state_vars.update(dict.fromkeys(kw, vartype))
with open(readme_file) as f:
readme = f.read()
try:
tf_install_dir = imp.find_module('tensorflow')[1]
except ImportError:
site_packages_path = path.join(path.dirname(path.__file__), 'site-packages')
tf_install_dir = imp.find_module('tensorflow', [site_packages_path])[1]
# install_requires = ['xml']
install_requires=['numpy', 'scipy']
setup_requires=['setuptools_scm']
# add cmake as a build requirement if cmake>3.0 is not installed
try:
if LegacyVersion(get_cmake_version()) < LegacyVersion("3.0"):
setup_requires.append('cmake')
except SKBuildError:
setup_requires.append('cmake')
try:
makedirs('deepmd')
except OSError:
pass
setup(
name="deepmd-kit",
setup_requires=setup_requires,
use_scm_version={'write_to': 'source/train/_version.py'},
author="Han Wang",
author_email="wang_han@iapcm.ac.cn",
description="A deep learning package for many-body potential energy representation and molecular dynamics",
def parse_other(self, other):
if other is None:
other = LegacyVersion('')
elif not isinstance(other, (Version, LegacyVersion)):
other = parse_version(other)
return other
agent_version = get_version(agent_image)
plugin_version = get_version(plugin_image)
if agent_version is None:
self.logger.info('Unknown agent version')
return
if plugin_version is None:
self.logger.info('Unknown plugin version')
return
av = version.parse(agent_version)
pv = version.parse(plugin_version)
if type(av) is version.LegacyVersion or type(pv) is version.LegacyVersion:
self.logger.info('Invalid semantic version, can not compare')
return
if av.release[0] < pv.release[0]:
self.logger.critical('Agent version is lower than plugin version. Please, update agent.')
def query_versions(self, version=None):
"""Check specified version and resolve special values."""
if version not in RELEASE_AND_CANDIDATE_LATEST_VERSIONS:
return [version]
url = urljoin(self.base_url, 'releases/')
parser = self._create_directory_parser(url)
if version:
versions = parser.filter(RELEASE_AND_CANDIDATE_LATEST_VERSIONS[version])
from packaging.version import LegacyVersion
versions.sort(key=LegacyVersion)
return [versions[-1]]
else:
return parser.entries
def _coerce_version(self, version):
# type: (Union[ParsedVersion, str]) -> LegacyVersion
if not isinstance(version, LegacyVersion):
version = LegacyVersion(str(version))
return version