nbsync 0.3.2__py3-none-any.whl → 0.3.4__py3-none-any.whl

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.
nbsync/cell.py CHANGED
@@ -1,5 +1,6 @@
1
1
  from __future__ import annotations
2
2
 
3
+ import html
3
4
  import textwrap
4
5
  import uuid
5
6
  from dataclasses import dataclass
@@ -26,7 +27,7 @@ class Cell:
26
27
  content: bytes | str
27
28
  """The content of the image."""
28
29
 
29
- def convert(self) -> str:
30
+ def convert(self, *, escape: bool = False) -> str:
30
31
  kind = self.image.attributes.pop("source", "")
31
32
  tabs = self.image.attributes.pop("tabs", "")
32
33
  identifier = self.image.attributes.pop("identifier", "")
@@ -51,6 +52,8 @@ class Cell:
51
52
  )
52
53
  result, self.image.url = self.content, ""
53
54
  result = result.rstrip()
55
+ if escape and self.mime == "text/plain":
56
+ result = html.escape(result)
54
57
 
55
58
  else:
56
59
  source = get_source(
nbsync/sync.py CHANGED
@@ -47,9 +47,9 @@ class Synchronizer:
47
47
  continue
48
48
 
49
49
  path = ".md" if url == ".md" else self.store.find_path(url)
50
- logger.info(f"Executing notebook: {path}...")
50
+ logger.info(f"Executing notebook: {path}")
51
51
  if elapsed := notebook.execute():
52
- logger.info(f"{Path(path).name!r} executed in {elapsed} seconds")
52
+ logger.info(f"{Path(path).name!r} executed in {elapsed:.2f} seconds")
53
53
 
54
54
  def convert(self, text: str) -> Iterator[str | Cell]:
55
55
  elems = list(self.parse(text))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nbsync
3
- Version: 0.3.2
3
+ Version: 0.3.4
4
4
  Summary: A core library to synchronize Jupyter notebooks and Markdown documents, enabling seamless integration and dynamic content execution
5
5
  Project-URL: Documentation, https://daizutabi.github.io/nbsync/
6
6
  Project-URL: Source, https://github.com/daizutabi/nbsync
@@ -1,11 +1,11 @@
1
1
  nbsync/__init__.py,sha256=3NuWx9D0LcBnXjEKrC-uypNDOz8rLWXI7mIjdN9xSeE,126
2
- nbsync/cell.py,sha256=C7VqQO3mxZ7Nj4ufywTnaqZAegT7zqA6iN2WV6X5X5c,3786
2
+ nbsync/cell.py,sha256=bXzchf46DP0pxhgL1W98f9jfOGVJi4-EoK2b1RX0N1c,3921
3
3
  nbsync/logger.py,sha256=snNRqi9xESj4B-Z9GQffCBlgqeVujvuXuBveWAebIWM,736
4
4
  nbsync/markdown.py,sha256=xcPhQKWpFDyVQ_xtZCpFrnR0QED_hYs4PAyaT7dF3t4,3830
5
5
  nbsync/notebook.py,sha256=4F3V1KDHfJnIR5ZSb1xWdN9JGiC6mWUVimXXK1BFsbc,1450
6
6
  nbsync/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
- nbsync/sync.py,sha256=jI32mYA3hr_69-cejqH9B0JxYLFAMpuDDNYbpjJFazE,3989
8
- nbsync-0.3.2.dist-info/METADATA,sha256=eeNhOG9xc0vS-69AtPEq13C2dCVBVDdWtSMl85qiJd8,6552
9
- nbsync-0.3.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
10
- nbsync-0.3.2.dist-info/licenses/LICENSE,sha256=wy1pqn52upuo_qYwY-epWmspwE-3UWJso0xodciGXYc,1062
11
- nbsync-0.3.2.dist-info/RECORD,,
7
+ nbsync/sync.py,sha256=vISzn8D_Dae-jdJABRnvvD02aL35bYIWx52OinAORVo,3990
8
+ nbsync-0.3.4.dist-info/METADATA,sha256=9TEbtLM655UYB7rQ7YoxFuSkrBodGzf4ox41Nz8tsEo,6552
9
+ nbsync-0.3.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
10
+ nbsync-0.3.4.dist-info/licenses/LICENSE,sha256=wy1pqn52upuo_qYwY-epWmspwE-3UWJso0xodciGXYc,1062
11
+ nbsync-0.3.4.dist-info/RECORD,,
File without changes