File tree Expand file tree Collapse file tree 1 file changed +9
-11
lines changed Expand file tree Collapse file tree 1 file changed +9
-11
lines changed Original file line number Diff line number Diff line change 14
14
__doctest_skip__ = ["timestamp" ]
15
15
16
16
17
- # ruff: noqa: ARG001
18
17
def timestamp (
19
18
self ,
20
19
text : str | None = None ,
@@ -79,6 +78,14 @@ def timestamp(
79
78
"""
80
79
self ._preprocess ()
81
80
81
+ if text is not None and len (text ) > 64 :
82
+ msg = (
83
+ "Argument of 'text' must be no longer than 64 characters. "
84
+ "The given text string will be truncated to 64 characters."
85
+ )
86
+ warnings .warn (message = msg , category = RuntimeWarning , stacklevel = 2 )
87
+ text = text [:64 ]
88
+
82
89
# TODO(GMT>=6.5.0): Remove the patch for upstream bug fixed in GMT 6.5.0.
83
90
if Version (__gmt_version__ ) < Version ("6.5.0" ):
84
91
# Giving a single offset doesn't work.
@@ -89,16 +96,7 @@ def timestamp(
89
96
# See https://github.com/GenericMappingTools/gmt/pull/7127.
90
97
if text is not None :
91
98
# Overriding the 'timefmt' parameter and set 'text' to None
92
- timefmt = text [:64 ]
93
- text = None
94
-
95
- if text is not None and len (text ) > 64 :
96
- msg = (
97
- "Argument of 'text' must be no longer than 64 characters. "
98
- "The given text string will be truncated to 64 characters."
99
- )
100
- warnings .warn (message = msg , category = RuntimeWarning , stacklevel = 2 )
101
- text = text [:64 ]
99
+ timefmt , text = text , None
102
100
103
101
kwdict = AliasSystem (
104
102
U = [
You can’t perform that action at this time.
0 commit comments