Skip to content

Commit 89ef623

Browse files
committed
ruff shenanigans
1 parent f02bf30 commit 89ef623

4 files changed

Lines changed: 28 additions & 13 deletions

File tree

irods/access.py

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def items(self):
7575
return list(zip(self.keys(), self.values()))
7676

7777

78-
class _iRODSAccess_base:
78+
class _iRODSAccess_base: # noqa: N801
7979
@classmethod
8080
def to_int(cls, key):
8181
return cls.codes[key]
@@ -204,25 +204,30 @@ def __repr__(self):
204204

205205
class iRODSAccess(_iRODSAccess_base, metaclass=_Access_LookupMeta):
206206
"""
207-
This class represents an ACL in iRODS and functions as a data container
208-
to convey information to the iRODS server (in the `set` call) and back again to the client
209-
again (in the `get` call).
207+
Represents an ACL in iRODS.
208+
209+
An instance of this class functions as a data container to convey information to the iRODS
210+
server (in the `set` call) and back again to the client again (in the `get` call).
210211
"""
211212

212213
def __init__(self, access_name, path, user_name="", user_zone="", user_type=None):
214+
# noqa: D107
213215
self.codes = self.__class__.codes
214216
self.strings = self.__class__.strings
215217
super().__init__(access_name, path, user_name, user_zone, user_type)
216218

217219

218220
class ACLOperation(iRODSAccess):
219221
"""
220-
Similar to its base class iRODSAccess, this class represents an ACL to be set on an object.
221-
but this class is the counterpart used for the atomic ACLs api. It differs from its base
222-
class in that it has no field to store a logical object path. (For an atomic API call, i
223-
here is always a single logical path to which all operations apply, meaning that it is
224-
appropriate to conveyed that in a location separate from the operations themselves.)
225-
"""
222+
Represents an operation to be performed in iRODS' atomic ACL api.
223+
224+
Similar to its base class, iRODSAccess, this class names an ACL to be set on an object.
225+
It differs, however, in that it forgoes option to store a logical object path. (In the atomic
226+
API call, there is always a single logical path to which all such operations apply, thus
227+
it is appropriate that the path parameter is in a location separate from the operations.)
228+
""" # noqa: D400 RUF100
229+
230+
# ruff: noqa: D105 on
226231

227232
def __init__(self, access_name: str, user_name: str = "", user_zone: str = ""):
228233
super().__init__(
@@ -244,6 +249,7 @@ def __eq__(self, other):
244249
)
245250

246251
def __hash__(self):
252+
247253
# Hash in a way consistent with an iRODSAccess having path "".
248254
return hash((
249255
self.access_name,
@@ -266,6 +272,8 @@ def __lt__(self, other):
266272
def __repr__(self):
267273
return f"<ACLOperation {self.access_name} {self.user_name} {self.user_zone}>"
268274

275+
# ruff: noqa: D105 off
276+
269277

270278
(
271279
_synonym_mapping := {
@@ -283,6 +291,7 @@ def __repr__(self):
283291
canonical_permissions = {k: v for k, v in all_permissions.items() if ' ' not in k and k not in ('read', 'write')}
284292

285293

294+
# ruff: noqa: RUF012 N801 on
286295
class _deprecated:
287296
class _iRODSAccess_pre_4_3_0(_iRODSAccess_base):
288297
codes = collections.OrderedDict(
@@ -294,13 +303,16 @@ class _iRODSAccess_pre_4_3_0(_iRODSAccess_base):
294303

295304
def __init__(self, *args, **kwargs):
296305
warnings.warn(
297-
"_iRODSAccess_pre_4_3_0 is deprecated and will be removed in a future version. Use iRODSAccess instead.",
306+
"_iRODSAccess_pre_4_3_0 is deprecated and will be removed in "
307+
"a future version. Use iRODSAccess instead.",
298308
DeprecationWarning,
299309
stacklevel=2,
300310
)
301311
super().__init__(*args, **kwargs)
302312

303313

314+
# ruff: noqa: RUF012 N801 SLF001 off
315+
304316
_deprecated_names = {'_iRODSAccess_pre_4_3_0': _deprecated._iRODSAccess_pre_4_3_0}
305317

306318

irods/exception.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -650,7 +650,8 @@ class SYS_INVALID_INPUT_PARAM(SystemException):
650650
code = -130000
651651

652652

653-
class SYS_INTERNAL_ERR(SystemException):
653+
class SYS_INTERNAL_ERR(SystemException): # noqa: N801
654+
# noqa: D101
654655
code = -154000
655656

656657

irods/manager/access_manager.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
""" The access manager is a collection of methods useful for managing iRODS ACLs. """
2+
13
import logging
24
from os.path import basename, dirname
35

irods/test/access_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
import sys
55
import unittest
66

7-
from irods.test import helpers
87
from irods.access import ACLOperation, iRODSAccess
98
from irods.collection import iRODSCollection
109
from irods.column import In, Like
1110
from irods.exception import UserDoesNotExist
1211
from irods.models import Collection, DataObject, User
1312
from irods.path import iRODSPath
1413
from irods.session import iRODSSession
14+
from irods.test import helpers
1515
from irods.user import iRODSUser
1616

1717

0 commit comments

Comments
 (0)