MCPcopy
hub / github.com/dbcli/pgcli / intcomma

Method intcomma

pgcli/pyev.py:222–233  ·  view source on GitHub ↗
(self, value)

Source from the content-addressed store, hash-verified

220 return textwrap.wrap(line, width)
221
222 def intcomma(self, value):
223 sep = ","
224 if not isinstance(value, str):
225 value = int(value)
226
227 orig = str(value)
228
229 new = re.sub(r"^(-?\d+)(\d{3})", rf"\g<1>{sep}\g<2>", orig)
230 if orig == new:
231 return new
232 else:
233 return self.intcomma(new)
234
235 def output_fn(self, current_prefix, string):
236 return "%s%s" % (self.prefix_format(current_prefix), string)

Callers 2

create_linesMethod · 0.95
generate_linesMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected