/
debug_utils.py
69 lines (51 loc) · 1.8 KB
/
debug_utils.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# The number of elements to print for dataset ids/tasks
_print_threshold = 10
def get_print_threshold() -> int:
"""Return the printing threshold for datasets.
The print threshold is the number of elements from ids/tasks to
print when printing representations of `Dataset` objects.
Returns
----------
threshold: int
Number of elements that will be printed
"""
return _print_threshold
def set_print_threshold(threshold: int):
"""Set print threshold
The print threshold is the number of elements from ids/tasks to
print when printing representations of `Dataset` objects.
Parameters
----------
threshold: int
Number of elements to print.
"""
global _print_threshold
_print_threshold = threshold
# If a dataset contains more than this number of elements, it won't
# print any dataset ids
_max_print_size = 1000
def get_max_print_size() -> int:
"""Return the max print size for a dataset.
If a dataset is large, printing `self.ids` as part of a string
representation can be very slow. This field controls the maximum
size for a dataset before ids are no longer printed.
Returns
-------
max_print_size: int
Maximum length of a dataset for ids to be printed in string
representation.
"""
return _max_print_size
def set_max_print_size(max_print_size: int):
"""Set max_print_size
If a dataset is large, printing `self.ids` as part of a string
representation can be very slow. This field controls the maximum
size for a dataset before ids are no longer printed.
Parameters
----------
max_print_size: int
Maximum length of a dataset for ids to be printed in string
representation.
"""
global _max_print_size
_max_print_size = max_print_size