peek-python 26.1.1.post0__tar.gz → 26.1.1.post1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: peek-python
3
- Version: 26.1.1.post0
3
+ Version: 26.1.1.post1
4
4
  Summary: peek - like print, but easy
5
5
  Author-email: Ruud van der Ham <rt.van.der.ham@gmail.com>
6
6
  Project-URL: Homepage, https://github.com/salabim/peek
@@ -53,6 +53,8 @@ try:
53
53
  except ModuleNotFoundError:
54
54
  import tomli as tomllib
55
55
 
56
+ lf="\n"
57
+
56
58
 
57
59
  class _Peek:
58
60
  name_alias_default = (
@@ -65,7 +67,7 @@ class _Peek:
65
67
  ("delta", "", 0),
66
68
  ("depth", "", 1000000),
67
69
  ("enabled", "", True),
68
- ("end", "", "\n"),
70
+ ("end", "", lf),
69
71
  ("equals_separator", "", "="),
70
72
  ("filter", "f", ""),
71
73
  ("format", "fmt", ""),
@@ -288,7 +290,7 @@ class _Peek:
288
290
  return result
289
291
 
290
292
  @staticmethod
291
- def print_pythonista_color(s, end="\n", file=sys.stdout):
293
+ def print_pythonista_color(s, end=lf, file=sys.stdout):
292
294
  cached = ""
293
295
  while s:
294
296
  for ansi, rgb in _Peek._ANSI_to_rgb.items():
@@ -367,7 +369,7 @@ class _Peek:
367
369
 
368
370
  def __str__(self):
369
371
  pairs = [f"{name}={getattr(self, 'delta1') if name == 'delta' else getattr(self, name)!r}" for name in _Peek.name_default if name != "serialize"]
370
- return f"peek with attributes:\n {'\n '.join(pairs)}"
372
+ return f"peek with attributes:{lf} {'{lf} '.join(pairs)}"
371
373
 
372
374
  def fix_perf_counter(self, val): # for tests
373
375
  _Peek._fixed_perf_counter = val
@@ -531,7 +533,7 @@ class _Peek:
531
533
  source = executing.Source.for_frame(call_frame)
532
534
  for node, right in zip(call_node.args, args):
533
535
  left = source.asttokens().get_text(node)
534
- if "\n" in left:
536
+ if lf in left:
535
537
  left = " " * node.first_token.start[1] + left
536
538
  left = textwrap.dedent(left)
537
539
  try:
@@ -557,10 +559,10 @@ class _Peek:
557
559
  just_one_line = False
558
560
 
559
561
  if not (len(pairs) > 1 and this.separator == ""):
560
- if not any("\n" in pair.left for pair in pairs):
562
+ if not any(lf in pair.left for pair in pairs):
561
563
  as_one_line = context + this.separator.join(pair.left + this.serialize_kwargs(obj=pair.right, width=10000) for pair in pairs)
562
564
  # as_one_line = context + this.separator.join(pair.left + (this.serialize_kwargs(obj=pair.right, width=10000)) for pair in pairs)
563
- if len(as_one_line) <= this.line_length and "\n" not in as_one_line:
565
+ if len(as_one_line) <= this.line_length and lf not in as_one_line:
564
566
  out += as_one_line
565
567
  just_one_line = True
566
568
 
@@ -586,14 +588,14 @@ class _Peek:
586
588
 
587
589
  for pair in pairs:
588
590
  do_right = False
589
- if "\n" in pair.left:
591
+ if lf in pair.left:
590
592
  for s in pair.left.splitlines():
591
593
  lines.append(indent1 + s)
592
594
  do_right = True
593
595
  else:
594
596
  start = indent1 + pair.left
595
597
  line = start + this.serialize_kwargs(obj=pair.right, width=this.line_length - len(start))
596
- if "\n" in line:
598
+ if lf in line:
597
599
  lines.append(start)
598
600
  do_right = True
599
601
  else:
@@ -606,7 +608,7 @@ class _Peek:
606
608
  lines.append(indent2 + s)
607
609
  if len(lines) > this.max_lines:
608
610
  lines = lines[: this.max_lines] + ["[abbreviated]"]
609
- out += "\n".join(line.rstrip() for line in lines)
611
+ out += lf.join(line.rstrip() for line in lines)
610
612
 
611
613
  else:
612
614
  if not this.show_line_number: # if "n" or "no parent", keep that info
@@ -620,7 +622,7 @@ class _Peek:
620
622
  if as_str:
621
623
  if this.use_color and this.color not in ("", "-"):
622
624
  out = f"{_Peek._color_name_to_ANSI[this.color.lower()]}{out}{_Peek._color_name_to_ANSI['-']}"
623
- if this.end == "\n":
625
+ if this.end == lf:
624
626
  out += this.end
625
627
  else:
626
628
  out += f"{_Peek._color_name_to_ANSI[this.color.lower()]}{this.end}{_Peek._color_name_to_ANSI['-']}"
@@ -677,8 +679,8 @@ class _Peek:
677
679
  def do_output(self, s):
678
680
  if self.use_color and self.color not in ("", "-"):
679
681
  s_end = f"{_Peek._color_name_to_ANSI[self.color.lower()]}{s}{_Peek._color_name_to_ANSI['-']}"
680
- if self.end == "\n":
681
- s_end += "\n"
682
+ if self.end == lf:
683
+ s_end += lf
682
684
  else:
683
685
  s_end += f"{_Peek._color_name_to_ANSI[self.color.lower()]}{self.end}{_Peek._color_name_to_ANSI['-']}"
684
686
  else:
@@ -769,7 +771,7 @@ class _Peek:
769
771
  result.append(f"{wrap_indent} File {filename!r}, line {entry.lineno} in {entry.name}")
770
772
  result.append(f"{wrap_indent} {entry.line}")
771
773
 
772
- return "\n".join(result)
774
+ return lf.join(result)
773
775
  else:
774
776
  return ""
775
777
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: peek-python
3
- Version: 26.1.1.post0
3
+ Version: 26.1.1.post1
4
4
  Summary: peek - like print, but easy
5
5
  Author-email: Ruud van der Ham <rt.van.der.ham@gmail.com>
6
6
  Project-URL: Homepage, https://github.com/salabim/peek
@@ -10,7 +10,7 @@ authors = [
10
10
  { name = "Ruud van der Ham", email = "rt.van.der.ham@gmail.com" },
11
11
  ]
12
12
  description = "peek - like print, but easy"
13
- version = "26.1.1.post0"
13
+ version = "26.1.1.post1"
14
14
  readme = "README.md"
15
15
  requires-python = ">=3.9"
16
16
  dependencies = [