Skip to content

Commit

Permalink
clean up typos
Browse files Browse the repository at this point in the history
  • Loading branch information
Al Niessner authored and Al Niessner committed Aug 1, 2023
1 parent 083a930 commit 6d6652b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
16 changes: 9 additions & 7 deletions src/pds/registrysweepers/repairkit/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from . import allarrays

from pds.registrysweepers.utils import Host
from pds.registrysweepers.utils import configure_logging
from pds.registrysweepers.utils import query_registry_db

import logging
Expand Down Expand Up @@ -37,17 +38,18 @@ def function_name (document:{}, fieldname:str)->{}
'''

REPAIR_TOOLS = {
re.compile('^ops:Data_File_Info/').match:[allarrays.repair],
re.compile('^ops:Label_File_Info/').match:[allarrays.repair],
re.compile('^ops:Data_File_Info/').match: [allarrays.repair],
re.compile('^ops:Label_File_Info/').match: [allarrays.repair],
}

log = logging.getLogger(__name__)


def run(base_url:str,
username:str,
password:str,
verify_host_certs:bool=True,
log_filepath:Union[str,None]=None,
verify_host_certs:bool = True,
log_filepath:Union[str,None] = None,
log_level:int=logging.INFO):
configure_logging(filepath=log_filepath, log_level=log_level)
log.info("starting CLI processing")
Expand All @@ -56,10 +58,10 @@ def run(base_url:str,
for document in query_registry_db(host, query, {}):
repairs = {}
for fieldname,data in document.items():
for regex,funcs in REPAIR_TOOLS:
for regex,funcs in REPAIR_TOOLS.items():
if regex(filename):
repairs.update(func(document, fieldname) for func in funcs)
if repairs:
log.info (f'Writing repairs to document: {id}')
write_update_docs (host, {id,repairs})
log.info(f'Writing repairs to document: {id}')
write_update_docs(host, {id:repairs})
return
2 changes: 1 addition & 1 deletion src/pds/registrysweepers/repairkit/allarrays.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
def repair (document:{}, fieldname:str)->bool:
if isinstance (document[fieldname], str):
log.info (f'found string for {fieldname} where it should be an array')
return {fieldname:[document[fieldname]}
return {fieldname:[document[fieldname]]}
return {}

0 comments on commit 6d6652b

Please sign in to comment.