Skip to content

Commit

Permalink
Add type annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
cserf committed Mar 2, 2023
1 parent ce42d25 commit e1923ec
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions lib/rucio/client/didclient.py
Expand Up @@ -14,6 +14,7 @@
# limitations under the License.

from datetime import datetime
from typing import TYPE_CHECKING
from json import dumps, loads

from requests.status_codes import codes
Expand All @@ -23,6 +24,11 @@
from rucio.client.baseclient import choice
from rucio.common.utils import build_url, render_json, render_json_list, date_to_str

if TYPE_CHECKING:
from typing import List, Iterator, Dict
DIDType = Dict
DIDListType = List[DIDType]


class DIDClient(BaseClient):

Expand Down Expand Up @@ -376,7 +382,7 @@ def list_content_history(self, scope, name):
exc_cls, exc_msg = self._get_exception(headers=r.headers, status_code=r.status_code, data=r.content)
raise exc_cls(exc_msg)

def list_files(self, scope, name, long=None):
def list_files(self, scope: str, name: str, long: bool = False) -> "Iterator[DIDType]":
"""
List data identifier file contents.
Expand All @@ -398,7 +404,7 @@ def list_files(self, scope, name, long=None):
exc_cls, exc_msg = self._get_exception(headers=r.headers, status_code=r.status_code, data=r.content)
raise exc_cls(exc_msg)

def bulk_list_files(self, dids):
def bulk_list_files(self, dids: "DIDListType") -> "Iterator[DIDType]":
"""
List data identifier file contents.
Expand Down
2 changes: 1 addition & 1 deletion lib/rucio/core/did.py
Expand Up @@ -2293,7 +2293,7 @@ def bulk_list_files(dids: "DIDListType", long: bool = False, *, session: "Option


@stream_session
def list_files(scope, name, long=False, *, session: "Session"):
def list_files(scope: "InternalScope", name: str, long: bool = False, *, session: "Optional[Session]" = None) -> "Iterator[DIDType]":
"""
List data identifier file contents.
Expand Down

0 comments on commit e1923ec

Please sign in to comment.