Skip to content

Commit

Permalink
typing
Browse files Browse the repository at this point in the history
  • Loading branch information
lowell80 committed Nov 4, 2023
1 parent c5f5125 commit 4d9016b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion ksconf/commands/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import argparse
import json
import os
from typing import Iterable

from ksconf.command import KsconfCmd, add_file_handler, dedent
from ksconf.consts import EXIT_CODE_BAD_ARGS, EXIT_CODE_SUCCESS
Expand Down Expand Up @@ -150,7 +151,7 @@ def f(pattern):
"so the final name may not be known ahead of time.")

@staticmethod
def load_blocklist(path):
def load_blocklist(path: str) -> Iterable[str]:
with open(path) as stream:
for line in stream:
line = line.rstrip()
Expand Down
6 changes: 3 additions & 3 deletions ksconf/commands/restpublish.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import os
import sys
from argparse import ArgumentParser, Namespace
from typing import Optional
from typing import Dict, Optional
from urllib.parse import urlparse

from ksconf.command import (ConfFileProxy, ConfFileType, KsconfCmd,
Expand Down Expand Up @@ -272,7 +272,7 @@ def publish_conf(self,
if not metadata:
res["meta"] = f"No metadata found for [{config_file.name}/{stanza_name}]"
return (action, res)
final_meta = {}
final_meta: Dict[str, str] = {}
if "access.read" in metadata:
final_meta["perms.read"] = ",".join(metadata["access.read"])
if "access.write" in metadata:
Expand Down Expand Up @@ -300,7 +300,7 @@ def publish_conf(self,
access["perms." + x] = ""
# print(f"[{stanza_name}] fm={final_meta} access: {access}")

acl_delta = compare_stanzas(reduce_stanza(access, final_meta), final_meta,
acl_delta = compare_stanzas(reduce_stanza(access, list(final_meta)), final_meta,
stanza_name + "/acl")
if is_equal(acl_delta):
res["acl_delta"] = []
Expand Down
2 changes: 1 addition & 1 deletion ksconf/conf/delta.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ def show_text_diff(stream: TextIO, a: PathLike, b: PathLike):
tc.reset()


def reduce_stanza(stanza: StanzaType, keep_attrs: Sequence) -> dict:
def reduce_stanza(stanza: StanzaType, keep_attrs: Sequence[str]) -> dict:
""" Pre-process a stanzas so that only a common set of keys will be compared.
:param stanza: Stanzas containing attributes and values
Expand Down

0 comments on commit 4d9016b

Please sign in to comment.