glpi-python-client 0.6.1__py3-none-any.whl → 0.6.2__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.
@@ -131,7 +131,7 @@ from glpi_python_client.rsql import (
131
131
  date_window,
132
132
  )
133
133
 
134
- __version__ = "0.6.1"
134
+ __version__ = "0.6.2"
135
135
 
136
136
  __all__ = [
137
137
  "AsyncGlpiClient",
@@ -127,10 +127,10 @@ class TransportRecorder:
127
127
  )
128
128
  return FakeResponse(status_code=self._delete_status, payload={})
129
129
 
130
- client._get_request = _get # type: ignore[method-assign, assignment]
131
- client._post_request = _post # type: ignore[method-assign, assignment]
132
- client._update_request = _patch # type: ignore[method-assign, assignment]
133
- client._delete_request = _delete # type: ignore[method-assign, assignment]
130
+ client._get_request = _get # type: ignore[method-assign, assignment, unused-ignore]
131
+ client._post_request = _post # type: ignore[method-assign, assignment, unused-ignore]
132
+ client._update_request = _patch # type: ignore[method-assign, assignment, unused-ignore]
133
+ client._delete_request = _delete # type: ignore[method-assign, assignment, unused-ignore]
134
134
 
135
135
 
136
136
  class FailingTransportRecorder(TransportRecorder):
@@ -127,10 +127,10 @@ class TransportRecorder:
127
127
  )
128
128
  return FakeResponse(status_code=self._delete_status, payload={})
129
129
 
130
- client._get_request = _get # type: ignore[method-assign, assignment]
131
- client._post_request = _post # type: ignore[method-assign, assignment]
132
- client._update_request = _patch # type: ignore[method-assign, assignment]
133
- client._delete_request = _delete # type: ignore[method-assign, assignment]
130
+ client._get_request = _get # type: ignore[method-assign, assignment, unused-ignore]
131
+ client._post_request = _post # type: ignore[method-assign, assignment, unused-ignore]
132
+ client._update_request = _patch # type: ignore[method-assign, assignment, unused-ignore]
133
+ client._delete_request = _delete # type: ignore[method-assign, assignment, unused-ignore]
134
134
 
135
135
 
136
136
  class FailingTransportRecorder(TransportRecorder):
@@ -715,12 +715,27 @@ def html_to_markdown(html: str) -> str:
715
715
  return str(_FORMATTER.render(_CONVERTER.convert_soup(soup))).strip()
716
716
 
717
717
 
718
+ #: A link as cmark-gfm writes one: an ``href``, an optional ``title``, nothing else.
719
+ _RENDERED_LINK = re.compile(r'<a href="[^"]*"(?: title="[^"]*")?>')
720
+
721
+ #: What GLPI's own editor writes on a link, so that it opens in a new window
722
+ #: rather than in place of the page showing it. ``noreferrer`` too, as
723
+ #: ``easyvista-python-client``'s twin writes, so the two render alike.
724
+ _NEW_WINDOW = ' target="_blank" rel="noopener noreferrer"'
725
+
726
+
718
727
  def markdown_to_html(markdown: str) -> str:
719
- """Render Markdown as HTML: CommonMark with GFM tables, through cmark-gfm."""
728
+ """Render Markdown as HTML: CommonMark with GFM tables, through cmark-gfm.
729
+
730
+ Every link opens in a new window, the way a link written in GLPI's editor
731
+ does: ``target="_blank" rel="noopener noreferrer"`` is added to each link
732
+ cmark-gfm writes. Reading ignores both attributes.
733
+ """
720
734
 
721
735
  html: str = cmarkgfm.markdown_to_html_with_extensions(
722
736
  markdown, options=_RENDER_OPTIONS, extensions=["table"]
723
737
  )
738
+ html = _RENDERED_LINK.sub(lambda link: link.group(0)[:-1] + _NEW_WINDOW + ">", html)
724
739
  return html.strip()
725
740
 
726
741
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: glpi-python-client
3
- Version: 0.6.1
3
+ Version: 0.6.2
4
4
  Summary: A typed Python client for GLPI ITSM APIs.
5
5
  Project-URL: Homepage, https://github.com/baraline/glpi_python_client
6
6
  Project-URL: Documentation, https://glpi-python-client.readthedocs.io/en/latest/
@@ -1,10 +1,10 @@
1
- glpi_python_client/__init__.py,sha256=oUcH95BSPIaFQ2Ycd0HEELJdg_AjLzwEwLU2YzMgv1E,5538
1
+ glpi_python_client/__init__.py,sha256=DGjWsC96c-1sfryxVwHThPASrR5sy0IpNiooeAVx5Wk,5538
2
2
  glpi_python_client/_errors.py,sha256=Bc9UvlxulbdcGvzZIKXnJCTL78sW78R6EFg50P-1dpY,7151
3
3
  glpi_python_client/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  glpi_python_client/rsql.py,sha256=3u3lH3_-F1bvHbVzxALXTDPoHyoMATP1f4QPTar_sEU,8974
5
5
  glpi_python_client/_async/__init__.py,sha256=dsDxBNsx94R_-8IBrGj99JidRAnuTQ-10iLA4gtRJhs,602
6
6
  glpi_python_client/_async/_concurrency.py,sha256=hd0fGFf-lxQNnx6OFRX0pGCfA3jUOw4RzRpWlEfCqII,2688
7
- glpi_python_client/_async/_testing.py,sha256=AJSonZXqRZ1MIqO46HytwjFd33vWhAbagFGcxytv4wA,5286
7
+ glpi_python_client/_async/_testing.py,sha256=xznvwVRgBEPE8QA4ilkWs9Wn0bdn1DdTYX8sOtEYrxs,5346
8
8
  glpi_python_client/_async/auth/__init__.py,sha256=h9xb1RcWtgHiod5a7ZDCiMaXJjS9C8J4KtwkkuxGykQ,455
9
9
  glpi_python_client/_async/auth/_v1_session.py,sha256=3t1OammbfUm9E-ANynrBFryxjx5UbbuZa4QHrH36IkI,18023
10
10
  glpi_python_client/_async/auth/auth.py,sha256=1vGG5uBNG8lMjcm20-mgcsH2e0GWKGujQo4k6vck1lE,14694
@@ -50,7 +50,7 @@ glpi_python_client/_async/clients/custom/_statistics.py,sha256=GFgxHLWWZvQzHxl2b
50
50
  glpi_python_client/_async/clients/custom/_ticket_context.py,sha256=9E01Rz2K1HBuiQz8x90UIDYzJy1t-7fLlz-k__8srT8,3021
51
51
  glpi_python_client/_sync/__init__.py,sha256=dsDxBNsx94R_-8IBrGj99JidRAnuTQ-10iLA4gtRJhs,602
52
52
  glpi_python_client/_sync/_concurrency.py,sha256=453f9hXoEOlWoQWDOzn65THBrP8xsRK4yc8jM-BJb_U,1574
53
- glpi_python_client/_sync/_testing.py,sha256=1lPzYl53HWkSXpGpFKWzf8bhrtervBSHXMVR78b0oGM,5242
53
+ glpi_python_client/_sync/_testing.py,sha256=l_F9uQbY9wByaXBlyNGLy7jfLyN4TYpGicVE59RBudg,5302
54
54
  glpi_python_client/_sync/auth/__init__.py,sha256=wgr3wpYpbLMWvcTyH_Yw0Rg9FpLR68OOkaY92E6Vy7k,453
55
55
  glpi_python_client/_sync/auth/_v1_session.py,sha256=dlnYA2yi_aWI6wTpfnRD3nzRvnw1lbx-0BP-KD4jJYs,17870
56
56
  glpi_python_client/_sync/auth/auth.py,sha256=azWE3bqDswxU-PtO-m_aKb-luSVPRrRXDVuq2aFRz18,14608
@@ -95,7 +95,7 @@ glpi_python_client/_sync/clients/custom/__init__.py,sha256=sxfGlHVulucP7bacWhUMi
95
95
  glpi_python_client/_sync/clients/custom/_statistics.py,sha256=xrD5C99ieROJx60iUomBHacQ_49HpgQL4XjnfREUQvs,38616
96
96
  glpi_python_client/_sync/clients/custom/_ticket_context.py,sha256=LDUvKNr8VpZonF5bDo8QYYwMEsWmayVU28Ra3GonNmE,3004
97
97
  glpi_python_client/content/__init__.py,sha256=3H4IbrNhgFO0BJrc0xLoeXrFHUE1nqOaDlNgi2MtK9k,365
98
- glpi_python_client/content/conversion.py,sha256=T697k7rKI3QzwvDIGA2YjT8sEYfDY-FuFEhCYlrvI_M,32418
98
+ glpi_python_client/content/conversion.py,sha256=0IjZ-36WlGMGwo4sHk92bZ3DDsZxVK0YKGCwrFlnRpo,33158
99
99
  glpi_python_client/models/__init__.py,sha256=b6DPZtH0CxyBUnVB0x9vP9AMBIjgubDFm_1TOQuCiVA,5362
100
100
  glpi_python_client/models/_base.py,sha256=pYg69KHuR5TDED5utr4Knr7HncBnLTxXHJZYf6vEUKA,12183
101
101
  glpi_python_client/models/api_schema/__init__.py,sha256=yTxUYih1Xy7NUogzD7UKp2b8HyE4wdeC_FCKS6ZRVVM,1176
@@ -135,7 +135,7 @@ glpi_python_client/models/custom_schema/_ticket_context.py,sha256=jnlfgho-aDbmA9
135
135
  glpi_python_client/testing/__init__.py,sha256=iLtUyJjyv3fEhy3PN25NxNTbtqDl3SoHLbNium0Z80U,568
136
136
  glpi_python_client/testing/fixtures.py,sha256=HKt6MXHgcmLn4L98pSwp-oGlc9C--_vrABNe5G_iBeg,1286
137
137
  glpi_python_client/testing/utils.py,sha256=JyO3w2d-0kYdtC1hEZ2Tu_YjnCz8nUQ_Ck05-1EhsX4,4404
138
- glpi_python_client-0.6.1.dist-info/METADATA,sha256=_6apOLxxecBjzPVPD__TG59RWDjL99HwRWBSQtru0Ls,8234
139
- glpi_python_client-0.6.1.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
140
- glpi_python_client-0.6.1.dist-info/licenses/LICENSE,sha256=nL8re-TIKkxCoL7OkSBja6EB4NsQR1HoOJgxv_MEhtc,1088
141
- glpi_python_client-0.6.1.dist-info/RECORD,,
138
+ glpi_python_client-0.6.2.dist-info/METADATA,sha256=9wihyUuKVM3_SjCpxgML5kJfV09itUlO6VTUoMwxzgw,8234
139
+ glpi_python_client-0.6.2.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
140
+ glpi_python_client-0.6.2.dist-info/licenses/LICENSE,sha256=nL8re-TIKkxCoL7OkSBja6EB4NsQR1HoOJgxv_MEhtc,1088
141
+ glpi_python_client-0.6.2.dist-info/RECORD,,