4
4
# --- BEGIN_HEADER ---
5
5
#
6
6
# base - shared base helper functions
7
- # Copyright (C) 2003-2024 The MiG Project by the Science HPC Center at UCPH
7
+ # Copyright (C) 2003-2025 The MiG Project by the Science HPC Center at UCPH
8
8
#
9
9
# This file is part of MiG.
10
10
#
29
29
30
30
from __future__ import print_function
31
31
from __future__ import absolute_import
32
- from past .builtins import basestring
33
32
34
33
from builtins import range
35
34
from past .builtins import basestring
@@ -654,12 +653,14 @@ def _force_default_coding_rec(input_obj, kind, highlight='', stringify=False):
654
653
raise ValueError ('Unsupported default coding kind: %s' % kind )
655
654
656
655
657
- def force_native_str_rec (input_obj , highlight = '' ):
658
- """A helper to force input_obj to the default string coding.
656
+ def force_native_str_rec (input_obj , highlight = '' , stringify = False ):
657
+ """A helper to force input_obj to the default string coding recursively .
659
658
Use the active interpreter and the shared.defaults helpers to force the
660
659
current default.
660
+ Please note that the default here is to NOT stringify non-string values
661
+ like numbers.
661
662
"""
662
- return _force_default_coding_rec (input_obj , STR_KIND , highlight )
663
+ return _force_default_coding_rec (input_obj , STR_KIND , highlight , stringify )
663
664
664
665
665
666
def force_default_str_coding_rec (input_obj , highlight = '' , stringify = False ):
@@ -682,16 +683,6 @@ def force_default_fs_coding_rec(input_obj, highlight='', stringify=False):
682
683
return _force_default_coding_rec (input_obj , FS_KIND , highlight , stringify )
683
684
684
685
685
- def force_native_str_rec (input_obj , highlight = '' , stringify = False ):
686
- """A helper to force input_obj to the default string coding recursively.
687
- Use the active interpreter and the shared.defaults helpers to force the
688
- current default.
689
- Please note that the default here is to NOT stringify non-string values
690
- like numbers.
691
- """
692
- return _force_default_coding_rec (input_obj , STR_KIND , highlight , stringify )
693
-
694
-
695
686
def native_str_escape (val ):
696
687
"""applies either the .encode('string_escape') or .encode('unicode_escape')
697
688
depending on the native string format, to escape existing backslashes like
0 commit comments