Skip to content

Commit

Permalink
🔧 update pyproject.toml
Browse files Browse the repository at this point in the history
no PERF error.
  • Loading branch information
arafune committed Oct 13, 2023
1 parent c6705e5 commit 247777e
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 18 deletions.
7 changes: 4 additions & 3 deletions arpes/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
15 changes: 8 additions & 7 deletions arpes/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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)
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand All @@ -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
]
Expand Down
9 changes: 5 additions & 4 deletions arpes/endstations/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions arpes/endstations/prodigy_itx.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion arpes/utilities/conversion/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ pythonVersion = "3.11"
pythonPlatform = "All"

[tool.ruff]
target-version = "py310"
ignore = [
"PD",
"ANN101",
Expand All @@ -87,6 +86,7 @@ ignore = [
"FIX002", # line-contains-todo (FIX002)#
"G004", # logging-f-string
]
target-version = "py311"
select = ["ALL"]
line-length = 100

Expand Down

0 comments on commit 247777e

Please sign in to comment.