Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# AnyPyTools Change Log

## v1.20.5

* Fix issue with pytest plugin assuming `.any` files to be encode with default
system encoding instead of UTF8.

## v1.20.4

* Fix crash with pytest plugin when saving output to h5 files.
Expand Down
5 changes: 3 additions & 2 deletions anypytools/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
"""AnyPyTools library."""

import logging
import os
import platform
Expand Down Expand Up @@ -36,7 +37,7 @@
"NORMAL_PRIORITY_CLASS",
]

__version__ = "1.20.4"
__version__ = "1.20.5"


def print_versions():
Expand All @@ -49,7 +50,7 @@ def print_versions():
print(f"NumPy version: {np.__version__}")
print(f"SciPy version: {sp.__version__}")
print(f"Python version: {sys.version}")
(sysname, _, release, version, machine, processor) = platform.uname()
sysname, _, release, version, machine, processor = platform.uname()
print(f"Platform: {sysname}-{release}-{machine} ({version})")
if not processor:
processor = "not recognized"
Expand Down
3 changes: 2 additions & 1 deletion anypytools/datautils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

@author: mel
"""

import os
import re
import logging
Expand Down Expand Up @@ -184,7 +185,7 @@ def _parse_anyoutputfile_constants(strvar):
value = None
varname = None
if strvar.count("=") == 1 and strvar.startswith("Main"):
(first, last) = strvar.split("=")
first, last = strvar.split("=")
varname = first.strip()
last = last.strip()
value = None
Expand Down
1 change: 1 addition & 0 deletions anypytools/h5py_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

@author: mel
"""

import logging

import h5py
Expand Down
6 changes: 2 additions & 4 deletions anypytools/macroutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,10 +292,8 @@ def __init__(self, var, frozen_distribution, default_lower_tail_probability=0.5)

self.var = var
if not isinstance(frozen_distribution, rv_frozen):
raise TypeError(
"frozen_distribution must be frozen distribtuion from \
scipy.stats.distributions"
)
raise TypeError("frozen_distribution must be frozen distribtuion from \
scipy.stats.distributions")

self.rv = frozen_distribution

Expand Down
5 changes: 3 additions & 2 deletions anypytools/pytest_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

@author: Morten
"""

import os
import re
import ast
Expand Down Expand Up @@ -108,7 +109,7 @@ def _read_header(fpath):
The function remvoes any leading '//' comments.
"""
code = ""
with open(fpath) as f:
with open(fpath, encoding="utf8") as f:
for line in f.readlines():
if line.startswith("//"):
line = line.strip("//")
Expand Down Expand Up @@ -200,7 +201,7 @@ def _parse_header(header, test_file):

def _write_macro_file(path, name, macro):
filename = os.path.join(path, name + ".anymcr")
with open(filename, "w") as f:
with open(filename, "w", encoding="utf8") as f:
f.writelines([str(mcr) + "\n" for mcr in macro])
return filename

Expand Down
4 changes: 2 additions & 2 deletions anypytools/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ def _anybodycon_version(anybodyconpath):


def _ammr_any_version(fpath):
with open(fpath) as f:
with open(fpath, encoding="utf8") as f:
out = f.read()
match = AMMR_VERSION_RE.search(out)
if match:
Expand Down Expand Up @@ -1168,7 +1168,7 @@ def get_bm_constants(ammr_path=None, ammr_version=2):
ammr_path, "Body/AAUHuman/Documentation/bm_constants.py"
)
with suppress(IOError):
with open(filename) as fh:
with open(filename, encoding="utf8") as fh:
bm_constants = literal_eval(fh.read())
if not isinstance(bm_constants, dict):
bm_constants = _BM_CONSTANTS if ammr_version >= 2 else _BM_CONSTANTS_AMMR1
Expand Down
2 changes: 1 addition & 1 deletion pixi.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pixi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ anypytools = {path= "."}

[package]
name = "anypytools"
version="1.20.4"
version="1.20.5"

[package.build]
backend = { name = "pixi-build-python", version = "*" }
Expand Down