Skip to content

Commit d6b9454

Browse files
committed
rename ellipsis > truncate
1 parent 85c6c7a commit d6b9454

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

arq/jobs.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import msgpack
1010

11-
from .utils import DEFAULT_CURTAIL, ellipsis, from_unix_ms, timestamp, to_unix_ms_tz
11+
from .utils import DEFAULT_CURTAIL, from_unix_ms, timestamp, to_unix_ms_tz, truncate
1212

1313
__all__ = ['JobSerialisationError', 'Job', 'DatetimeJob']
1414

@@ -100,7 +100,7 @@ def to_string(self, args_curtail=DEFAULT_CURTAIL):
100100
arguments += ', '
101101
arguments += ', '.join(f'{k}={v!r}' for k, v in sorted(self.kwargs.items()))
102102

103-
return '{s.class_name}.{s.func_name}({args})'.format(s=self, args=ellipsis(arguments, args_curtail))
103+
return '{s.class_name}.{s.func_name}({args})'.format(s=self, args=truncate(arguments, args_curtail))
104104

105105
def __str__(self):
106106
return self.to_string()

arq/utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ def gen_random(length: int=20) -> bytes:
185185
DEFAULT_CURTAIL = 80
186186

187187

188-
def ellipsis(s: str, length: int=DEFAULT_CURTAIL) -> str:
188+
def truncate(s: str, length: int=DEFAULT_CURTAIL) -> str:
189189
"""
190190
Truncate a string and add an ellipsis (three dots) to the end if it was too long
191191

arq/worker.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
from .jobs import ArqError, Job
2323
from .logs import default_log_config
2424
from .main import Actor # noqa
25-
from .utils import RedisMixin, ellipsis, timestamp
25+
from .utils import RedisMixin, timestamp, truncate
2626

2727
__all__ = ['BaseWorker', 'RunWorkerProcess', 'StopJob', 'import_string']
2828

@@ -327,7 +327,7 @@ def log_job_result(self, started_at: float, result, j: Job):
327327
if not jobs_logger.isEnabledFor(logging.INFO):
328328
return
329329
job_time = timestamp() - started_at
330-
sr = '' if result is None else ellipsis(repr(result), self.log_curtail)
330+
sr = '' if result is None else truncate(repr(result), self.log_curtail)
331331
jobs_logger.info('%-4s ran in%7.3fs ← %s.%s ● %s', j.queue, job_time, j.class_name, j.func_name, sr)
332332

333333
def handle_prepare_exc(self, msg: str):

docs/index.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ API Reference
106106
:members:
107107

108108
.. automodule:: arq.utils
109-
:members: RedisSettings, RedisMixin, create_tz, timestamp, timestamp, to_unix_ms_tz, to_unix_ms, from_unix_ms, gen_random, ellipsis
109+
:members: RedisSettings, RedisMixin, create_tz, timestamp, timestamp, to_unix_ms_tz, to_unix_ms, from_unix_ms, gen_random, truncate
110110

111111
.. automodule:: arq.testing
112112
:members:

0 commit comments

Comments
 (0)