Justus Magin

Results 348 comments of Justus Magin

I can't reproduce `black .` moving the `...` in type stubs / override to a separate line, so this is an example where `ruff` diverges from the `black` style (to...

> Maybe an issue can be raised on the ruff repo itself about this topic Based on the discussion at the end of astral-sh/ruff#5822 I am led to believe that...

> but other style changes also come in. You'd also get these other changes with `black`, but I think they pushed those back a year because it wasn't stable enough...

a few months ago, I created [keewis/nested-duck-arrays](https://github.com/keewis/nested-duck-arrays) to tackle the problem in #4231. Do you think the idea there would be applicable here, as well?

Note that on python 3.12 and higher this will actually start to work because it will not use `hasattr` anymore (which, by calling `getattr`, evaluates properties / descriptors). See also...

Is `swap_dims` just a composition of `rename_dims` and the new-ish `set_xindex` and `drop_index`, or does it do something else on top? If not, I agree we should deprecate it, or...

if these two: ```python ds = xr.Dataset(coords={"x": ("x", [0, 1]), "y": ("x", [-1, 1])}) ds.swap_dims({"x": "y"}) ds.rename_dims({"x": "y"}).set_xindex("y").drop_indexes(["x"]) ``` do the same thing, could we just make the former use...

If you're not chaining `set_xindex` and `drop_indexes` then it would be better to do `rename_dims` directly, no? In any case, I'm just saying that if we are to drop `swap_dims`...

interestingly, `rename_dims` → `rename_vars` works, but not the other way around (it suggests to use `swap_dims` instead). This, again, is a relic of how `xarray` used to work in earlier...

another option would be to wrap the value you're looking for in a 0D array with `object` dtype (so instead of `u_x.sel(fluid=f1)` try `u_x.sel(fluid=np.array(f1, dtype=object))`. In general I agree, though,...