Commit 86bc0ac9 authored by Bas Nijholt's avatar Bas Nijholt
Browse files

use Python >=3.6 syntax

parent 87e23a7c
......@@ -5,7 +5,7 @@ from ._version import __version__
__all__.append("__version__")
for module in ["parameters", "models", "peierls"]:
exec("from . import {0}".format(module))
exec(f"from . import {module}")
__all__.append(module)
......
# -*- coding: utf-8 -*-
# This file is part of 'miniver': https://github.com/jbweston/miniver
#
# This file will be overwritten by setup.py when a source or binary
......
# -*- coding: utf-8 -*-
# This file is part of 'miniver': https://github.com/jbweston/miniver
#
import os
......@@ -53,7 +52,7 @@ def pep440_format(version_info):
if release.endswith("-dev") or release.endswith(".dev"):
version_parts.append(dev)
else: # prefer PEP440 over strict adhesion to semver
version_parts.append(".dev{}".format(dev))
version_parts.append(f".dev{dev}")
if labels:
version_parts.append("+")
......@@ -150,13 +149,13 @@ def get_version_from_git_archive(version_info):
return None
VTAG = "tag: v"
refs = set(r.strip() for r in refnames.split(","))
version_tags = set(r[len(VTAG) :] for r in refs if r.startswith(VTAG))
refs = {r.strip() for r in refnames.split(",")}
version_tags = {r[len(VTAG) :] for r in refs if r.startswith(VTAG)}
if version_tags:
release, *_ = sorted(version_tags) # prefer e.g. "2.0" over "2.0rc1"
return Version(release, dev=None, labels=None)
else:
return Version("unknown", dev=None, labels=["g{}".format(git_hash)])
return Version("unknown", dev=None, labels=[f"g{git_hash}"])
__version__ = get_version()
......
......@@ -66,7 +66,7 @@ class DataBank(UserDict):
def __str__(self):
output = "Databank:\n"
output += " bank name: {}\n".format(self.name)
output += f" bank name: {self.name}\n"
output += " materials: " + ", ".join(list(self))
return output
......
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import json
import os
import sys
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment