mercurial/pycompat.py
changeset 46178 e3d595b7fbaa
parent 45727 d4c4391aa7f2
child 46570 7a29d9002250
equal deleted inserted replaced
46177:0c320e6032f1 46178:e3d595b7fbaa
   333         return opts, args
   333         return opts, args
   334 
   334 
   335     def strkwargs(dic):
   335     def strkwargs(dic):
   336         """
   336         """
   337         Converts the keys of a python dictonary to str i.e. unicodes so that
   337         Converts the keys of a python dictonary to str i.e. unicodes so that
   338         they can be passed as keyword arguments as dictonaries with bytes keys
   338         they can be passed as keyword arguments as dictionaries with bytes keys
   339         can't be passed as keyword arguments to functions on Python 3.
   339         can't be passed as keyword arguments to functions on Python 3.
   340         """
   340         """
   341         dic = {k.decode('latin-1'): v for k, v in dic.items()}
   341         dic = {k.decode('latin-1'): v for k, v in dic.items()}
   342         return dic
   342         return dic
   343 
   343 
   344     def byteskwargs(dic):
   344     def byteskwargs(dic):
   345         """
   345         """
   346         Converts keys of python dictonaries to bytes as they were converted to
   346         Converts keys of python dictionaries to bytes as they were converted to
   347         str to pass that dictonary as a keyword argument on Python 3.
   347         str to pass that dictonary as a keyword argument on Python 3.
   348         """
   348         """
   349         dic = {k.encode('latin-1'): v for k, v in dic.items()}
   349         dic = {k.encode('latin-1'): v for k, v in dic.items()}
   350         return dic
   350         return dic
   351 
   351