Skip to content

Commit

Permalink
chore: ruff rewrite dicts (#2183)
Browse files Browse the repository at this point in the history
Co-authored-by: Jim Pivarski <[email protected]>
  • Loading branch information
henryiii and jpivarski authored Jan 31, 2023
1 parent cda7688 commit ac5c958
Show file tree
Hide file tree
Showing 97 changed files with 586 additions and 570 deletions.
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,7 @@ exclude = [
"src/awkward/_typeparser/generated_parser.py",
]
ignore = [
"E501",
"C408",
"E501", # line too long
"UP030", # {0} -> {}
]
select = [
Expand Down
8 changes: 4 additions & 4 deletions src/awkward/highlevel.py
Original file line number Diff line number Diff line change
Expand Up @@ -1016,7 +1016,7 @@ def __setitem__(self, where, what):
"""
with ak._errors.OperationErrorContext(
"ak.Array.__setitem__",
dict(self=self, field_name=where, field_value=what),
{"self": self, "field_name": where, "field_value": what},
):
if not (
isinstance(where, str)
Expand Down Expand Up @@ -1049,7 +1049,7 @@ def __delitem__(self, where):
"""
with ak._errors.OperationErrorContext(
"ak.Array.__delitem__",
dict(self=self, field_name=where),
{"self": self, "field_name": where},
):
if not (
isinstance(where, str)
Expand Down Expand Up @@ -1765,7 +1765,7 @@ def __setitem__(self, where, what):
"""
with ak._errors.OperationErrorContext(
"ak.Record.__setitem__",
dict(self=self, field_name=where, field_value=what),
{"self": self, "field_name": where, "field_value": what},
):
if not (
isinstance(where, str)
Expand Down Expand Up @@ -1799,7 +1799,7 @@ def __delitem__(self, where):
"""
with ak._errors.OperationErrorContext(
"ak.Record.__delitem__",
dict(self=self, field_name=where),
{"self": self, "field_name": where},
):
if not (
isinstance(where, str)
Expand Down
16 changes: 8 additions & 8 deletions src/awkward/operations/ak_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ def all(
"""
with ak._errors.OperationErrorContext(
"ak.all",
dict(
array=array,
axis=axis,
keepdims=keepdims,
mask_identity=mask_identity,
highlevel=highlevel,
behavior=behavior,
),
{
"array": array,
"axis": axis,
"keepdims": keepdims,
"mask_identity": mask_identity,
"highlevel": highlevel,
"behavior": behavior,
},
):
if flatten_records is not unset:
message = (
Expand Down
16 changes: 8 additions & 8 deletions src/awkward/operations/ak_any.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ def any(
"""
with ak._errors.OperationErrorContext(
"ak.any",
dict(
array=array,
axis=axis,
keepdims=keepdims,
mask_identity=mask_identity,
highlevel=highlevel,
behavior=behavior,
),
{
"array": array,
"axis": axis,
"keepdims": keepdims,
"mask_identity": mask_identity,
"highlevel": highlevel,
"behavior": behavior,
},
):
if flatten_records is not unset:
message = (
Expand Down
18 changes: 9 additions & 9 deletions src/awkward/operations/ak_argcartesian.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,15 @@ def argcartesian(
"""
with ak._errors.OperationErrorContext(
"ak.argcartesian",
dict(
arrays=arrays,
axis=axis,
nested=nested,
parameters=parameters,
with_name=with_name,
highlevel=highlevel,
behavior=behavior,
),
{
"arrays": arrays,
"axis": axis,
"nested": nested,
"parameters": parameters,
"with_name": with_name,
"highlevel": highlevel,
"behavior": behavior,
},
):
return _impl(arrays, axis, nested, parameters, with_name, highlevel, behavior)

Expand Down
22 changes: 11 additions & 11 deletions src/awkward/operations/ak_argcombinations.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,17 @@ def argcombinations(
"""
with ak._errors.OperationErrorContext(
"ak.argcombinations",
dict(
array=array,
n=n,
replacement=replacement,
axis=axis,
fields=fields,
parameters=parameters,
with_name=with_name,
highlevel=highlevel,
behavior=behavior,
),
{
"array": array,
"n": n,
"replacement": replacement,
"axis": axis,
"fields": fields,
"parameters": parameters,
"with_name": with_name,
"highlevel": highlevel,
"behavior": behavior,
},
):
return _impl(
array,
Expand Down
32 changes: 16 additions & 16 deletions src/awkward/operations/ak_argmax.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,14 @@ def argmax(
"""
with ak._errors.OperationErrorContext(
"ak.argmax",
dict(
array=array,
axis=axis,
keepdims=keepdims,
mask_identity=mask_identity,
highlevel=highlevel,
behavior=behavior,
),
{
"array": array,
"axis": axis,
"keepdims": keepdims,
"mask_identity": mask_identity,
"highlevel": highlevel,
"behavior": behavior,
},
):
if flatten_records is not unset:
message = (
Expand Down Expand Up @@ -123,14 +123,14 @@ def nanargmax(
"""
with ak._errors.OperationErrorContext(
"ak.nanargmax",
dict(
array=array,
axis=axis,
keepdims=keepdims,
mask_identity=mask_identity,
highlevel=highlevel,
behavior=behavior,
),
{
"array": array,
"axis": axis,
"keepdims": keepdims,
"mask_identity": mask_identity,
"highlevel": highlevel,
"behavior": behavior,
},
):
if flatten_records is not unset:
message = (
Expand Down
32 changes: 16 additions & 16 deletions src/awkward/operations/ak_argmin.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,14 @@ def argmin(
"""
with ak._errors.OperationErrorContext(
"ak.argmin",
dict(
array=array,
axis=axis,
keepdims=keepdims,
mask_identity=mask_identity,
highlevel=highlevel,
behavior=behavior,
),
{
"array": array,
"axis": axis,
"keepdims": keepdims,
"mask_identity": mask_identity,
"highlevel": highlevel,
"behavior": behavior,
},
):
if flatten_records is not unset:
message = (
Expand Down Expand Up @@ -122,14 +122,14 @@ def nanargmin(
"""
with ak._errors.OperationErrorContext(
"ak.nanargmin",
dict(
array=array,
axis=axis,
keepdims=keepdims,
mask_identity=mask_identity,
highlevel=highlevel,
behavior=behavior,
),
{
"array": array,
"axis": axis,
"keepdims": keepdims,
"mask_identity": mask_identity,
"highlevel": highlevel,
"behavior": behavior,
},
):
if flatten_records is not unset:
message = (
Expand Down
16 changes: 8 additions & 8 deletions src/awkward/operations/ak_argsort.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ def argsort(
"""
with ak._errors.OperationErrorContext(
"ak.argsort",
dict(
array=array,
axis=axis,
ascending=ascending,
stable=stable,
highlevel=highlevel,
behavior=behavior,
),
{
"array": array,
"axis": axis,
"ascending": ascending,
"stable": stable,
"highlevel": highlevel,
"behavior": behavior,
},
):
return _impl(array, axis, ascending, stable, highlevel, behavior)

Expand Down
18 changes: 9 additions & 9 deletions src/awkward/operations/ak_broadcast_arrays.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,15 +174,15 @@ def broadcast_arrays(
"""
with ak._errors.OperationErrorContext(
"ak.broadcast_arrays",
dict(
arrays=arrays,
depth_limit=depth_limit,
broadcast_parameters_rule=broadcast_parameters_rule,
left_broadcast=left_broadcast,
right_broadcast=right_broadcast,
highlevel=highlevel,
behavior=behavior,
),
{
"arrays": arrays,
"depth_limit": depth_limit,
"broadcast_parameters_rule": broadcast_parameters_rule,
"left_broadcast": left_broadcast,
"right_broadcast": right_broadcast,
"highlevel": highlevel,
"behavior": behavior,
},
):
return _impl(
arrays,
Expand Down
18 changes: 9 additions & 9 deletions src/awkward/operations/ak_cartesian.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,15 +191,15 @@ def cartesian(
"""
with ak._errors.OperationErrorContext(
"ak.cartesian",
dict(
arrays=arrays,
axis=axis,
nested=nested,
parameters=parameters,
with_name=with_name,
highlevel=highlevel,
behavior=behavior,
),
{
"arrays": arrays,
"axis": axis,
"nested": nested,
"parameters": parameters,
"with_name": with_name,
"highlevel": highlevel,
"behavior": behavior,
},
):
return _impl(arrays, axis, nested, parameters, with_name, highlevel, behavior)

Expand Down
2 changes: 1 addition & 1 deletion src/awkward/operations/ak_categories.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def categories(array, highlevel=True):
"""
with ak._errors.OperationErrorContext(
"ak.categories",
dict(array=array, highlevel=highlevel),
{"array": array, "highlevel": highlevel},
):
return _impl(array, highlevel)

Expand Down
22 changes: 11 additions & 11 deletions src/awkward/operations/ak_combinations.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,17 +175,17 @@ def combinations(
"""
with ak._errors.OperationErrorContext(
"ak.combinations",
dict(
array=array,
n=n,
replacement=replacement,
axis=axis,
fields=fields,
parameters=parameters,
with_name=with_name,
highlevel=highlevel,
behavior=behavior,
),
{
"array": array,
"n": n,
"replacement": replacement,
"axis": axis,
"fields": fields,
"parameters": parameters,
"with_name": with_name,
"highlevel": highlevel,
"behavior": behavior,
},
):
return _impl(
array,
Expand Down
14 changes: 7 additions & 7 deletions src/awkward/operations/ak_concatenate.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ def concatenate(arrays, axis=0, *, mergebool=True, highlevel=True, behavior=None
"""
with ak._errors.OperationErrorContext(
"ak.concatenate",
dict(
arrays=arrays,
axis=axis,
mergebool=mergebool,
highlevel=highlevel,
behavior=behavior,
),
{
"arrays": arrays,
"axis": axis,
"mergebool": mergebool,
"highlevel": highlevel,
"behavior": behavior,
},
):
return _impl(arrays, axis, mergebool, highlevel, behavior)

Expand Down
2 changes: 1 addition & 1 deletion src/awkward/operations/ak_copy.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def copy(array):
"""
with ak._errors.OperationErrorContext(
"ak.fill_none",
dict(array=array),
{"array": array},
):
return _impl(array)

Expand Down
Loading

0 comments on commit ac5c958

Please sign in to comment.