From 247777ef9897dd7b8b33566cdca488bf7517d0bc Mon Sep 17 00:00:00 2001 From: Ryuichi Arafune Date: Sat, 14 Oct 2023 08:16:33 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20=20update=20pyproject.toml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit no PERF error. --- arpes/bootstrap.py | 7 ++++--- arpes/config.py | 15 ++++++++------- arpes/endstations/__init__.py | 9 +++++---- arpes/endstations/prodigy_itx.py | 4 ++-- arpes/utilities/conversion/core.py | 2 +- pyproject.toml | 2 +- 6 files changed, 21 insertions(+), 18 deletions(-) diff --git a/arpes/bootstrap.py b/arpes/bootstrap.py index 3934075c..9c04498e 100644 --- a/arpes/bootstrap.py +++ b/arpes/bootstrap.py @@ -194,9 +194,10 @@ def bootstrap_counts( assert isinstance(name, str) desc_fragment = f" {name}" - resampled_sets = [] - for _ in tqdm(range(n_samples), desc=f"Resampling{desc_fragment}..."): - resampled_sets.append(resample_true_counts(data)) + resampled_sets = [ + resample_true_counts(data) + for _ in tqdm(range(n_samples), desc=f"Resampling{desc_fragment}...") + ] resampled_arr = np.stack([s.values for s in resampled_sets], axis=0) std = np.std(resampled_arr, axis=0) diff --git a/arpes/config.py b/arpes/config.py index 87aa1f35..b8706d2f 100644 --- a/arpes/config.py +++ b/arpes/config.py @@ -18,7 +18,7 @@ import os.path import warnings from dataclasses import dataclass, field -from logging import INFO, Formatter, StreamHandler, getLogger +from logging import DEBUG, INFO, Formatter, StreamHandler, getLogger from pathlib import Path from typing import TYPE_CHECKING, Any @@ -30,7 +30,8 @@ # pylint: disable=global-statement -LOGLEVEL = INFO +LOGLEVELS = (DEBUG, INFO) +LOGLEVEL = LOGLEVELS[1] logger = getLogger(__name__) fmt = "%(asctime)s %(levelname)s %(name)s :%(message)s" formatter = Formatter(fmt) @@ -181,7 +182,7 @@ def attempt_determine_workspace(current_path: str | Path = "") -> None: has been simplified: see `workspace_matches` for more details. Args: - current_path: Override for "os.getcwd". Defaults to None. + current_path: Override for "Path.cwd()". Defaults to None. """ pdataset = Path.cwd() if DATASET_PATH is None else DATASET_PATH @@ -223,7 +224,7 @@ def load_json_configuration(filename: str) -> None: ) -def override_settings(new_settings): +def override_settings(new_settings) -> None: """Deep updates/overrides PyARPES settings.""" from arpes.utilities.collections import deep_update @@ -245,10 +246,10 @@ def load_plugins() -> None: from arpes.endstations import add_endstation, plugin skip_modules = {"__pycache__", "__init__"} - plugins_dir = str(Path(plugin.__file__).parent) - modules = os.listdir(plugins_dir) + plugins_dir = Path(plugin.__file__).parent + modules = os.listdir(str(plugins_dir)) modules = [ - m if os.path.isdir(os.path.join(plugins_dir, m)) else os.path.splitext(m)[0] + str(m) if Path(plugins_dir / m).is_dir() else str(Path(m).stem) for m in modules if m not in skip_modules ] diff --git a/arpes/endstations/__init__.py b/arpes/endstations/__init__.py index 06a07aa4..f2f8564a 100644 --- a/arpes/endstations/__init__.py +++ b/arpes/endstations/__init__.py @@ -306,10 +306,11 @@ def postprocess(self, frame: xr.Dataset) -> xr.Dataset: attrs=rename_keys(frame.attrs, self.RENAME_KEYS), ) - sum_dims = [] - for dim in frame.dims: - if len(frame.coords[dim]) == 1 and dim in self.SUMMABLE_NULL_DIMS: - sum_dims.append(dim) + sum_dims = [ + dim + for dim in frame.dims + if len(frame.coords[dim]) == 1 and dim in self.SUMMABLE_NULL_DIMS + ] if sum_dims: frame = frame.sum(sum_dims, keep_attrs=True) diff --git a/arpes/endstations/prodigy_itx.py b/arpes/endstations/prodigy_itx.py index 68c63388..b011198a 100644 --- a/arpes/endstations/prodigy_itx.py +++ b/arpes/endstations/prodigy_itx.py @@ -514,7 +514,7 @@ def _parse_type( for k, v in common_params.items(): try: common_params[k] = int(v) - except ValueError: # noqa: PERF203 + except ValueError: try: common_params[k] = float(v) except ValueError: @@ -549,7 +549,7 @@ def _parse_user_comment( try: key, value = item.split(":") common_params[key] = value - except ValueError: # noqa: PERF203 + except ValueError: pass return common_params diff --git a/arpes/utilities/conversion/core.py b/arpes/utilities/conversion/core.py index 777f65af..3c613094 100644 --- a/arpes/utilities/conversion/core.py +++ b/arpes/utilities/conversion/core.py @@ -26,9 +26,9 @@ import warnings from collections.abc import Callable, Iterable, Mapping from itertools import pairwise +from logging import DEBUG, INFO, Formatter, StreamHandler, getLogger from typing import TYPE_CHECKING, Literal -from logging import DEBUG, INFO, Formatter, StreamHandler, getLogger import numpy as np import xarray as xr from scipy.interpolate import RegularGridInterpolator diff --git a/pyproject.toml b/pyproject.toml index bb86f5dc..07901edc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -72,7 +72,6 @@ pythonVersion = "3.11" pythonPlatform = "All" [tool.ruff] -target-version = "py310" ignore = [ "PD", "ANN101", @@ -87,6 +86,7 @@ ignore = [ "FIX002", # line-contains-todo (FIX002)# "G004", # logging-f-string ] +target-version = "py311" select = ["ALL"] line-length = 100