Mercurial > hgrepos > Python > libs > ConfigMix
comparison configmix/config.py @ 500:34cd4f111134
"quote()" and "unquote()" are now static methods
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Sat, 18 Dec 2021 01:03:49 +0100 |
| parents | f46932e8a84c |
| children | 4f90e1eb7af8 |
comparison
equal
deleted
inserted
replaced
| 499:f46932e8a84c | 500:34cd4f111134 |
|---|---|
| 735 raise NameError("Filter %r not found" % name) | 735 raise NameError("Filter %r not found" % name) |
| 736 else: | 736 else: |
| 737 value = filterfn(self, value) | 737 value = filterfn(self, value) |
| 738 return value | 738 return value |
| 739 | 739 |
| 740 @classmethod | 740 @staticmethod |
| 741 def quote(klass, s): | 741 def quote(s): |
| 742 """Replace important special characters in string `s` by replacing | 742 """Replace important special characters in string `s` by replacing |
| 743 them with ``%xNN`` where `NN` are the two hexadecimal digits of the | 743 them with ``%xNN`` where `NN` are the two hexadecimal digits of the |
| 744 characters unicode codepoint value. | 744 characters unicode codepoint value. |
| 745 | 745 |
| 746 Handled are the important special chars: ``%``, ``.``, ``:``, | 746 Handled are the important special chars: ``%``, ``.``, ``:``, |
| 764 if re_encode: | 764 if re_encode: |
| 765 return s.encode("latin1") | 765 return s.encode("latin1") |
| 766 else: | 766 else: |
| 767 return s | 767 return s |
| 768 | 768 |
| 769 @classmethod | 769 @staticmethod |
| 770 def unquote(klass, s): | 770 def unquote(s): |
| 771 """Unquote the content of `s`: handle all patterns ``%xNN``, | 771 """Unquote the content of `s`: handle all patterns ``%xNN``, |
| 772 ``%uNNNN`` or ``%UNNNNNNNN``. | 772 ``%uNNNN`` or ``%UNNNNNNNN``. |
| 773 | 773 |
| 774 This is the inverse of :meth:`~.quote`. | 774 This is the inverse of :meth:`~.quote`. |
| 775 | 775 |
