New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

hyperscript

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hyperscript - pypi Package Compare versions

Comparing version
0.0.4
to
0.0.5
+1
-1
hyperscript.egg-info/PKG-INFO
Metadata-Version: 2.1
Name: hyperscript
Version: 0.0.4
Version: 0.0.5
Summary: HyperText with Python

@@ -5,0 +5,0 @@ Author-email: Vincent Chan <vincent@qualdata.io>

from typing import Any, Optional
from hyperscript.element import Element, Unescaped
from hyperscript.element import Element, SafeStr
__version__ = "0.0.3"
AUTOESCAPE = False

@@ -16,5 +14,5 @@

def unescape(value: str) -> Unescaped:
def safe(value: str) -> SafeStr:
if not isinstance(value, str):
raise TypeError(f"expected a str, got {type(value)}")
return Unescaped(value)
return SafeStr(value)

@@ -15,3 +15,3 @@ # file generated by setuptools_scm

__version__ = version = '0.0.4'
__version_tuple__ = version_tuple = (0, 0, 4)
__version__ = version = '0.0.5'
__version_tuple__ = version_tuple = (0, 0, 5)

@@ -25,3 +25,3 @@ from __future__ import annotations

class Unescaped(str):
class SafeStr(str):
pass

@@ -85,3 +85,3 @@

return str(value)
elif self.autoescape and not isinstance(value, Unescaped):
elif self.autoescape and not isinstance(value, SafeStr):
return escape(value)

@@ -103,3 +103,3 @@ return value

else:
attrs.append(f'{attr}="{value}"')
attrs.append(f'{attr}="{self._stringify(value)}"')
opening_tags.extend(attrs)

@@ -106,0 +106,0 @@ opening_tag = " ".join(opening_tags)

Metadata-Version: 2.1
Name: hyperscript
Version: 0.0.4
Version: 0.0.5
Summary: HyperText with Python

@@ -5,0 +5,0 @@ Author-email: Vincent Chan <vincent@qualdata.io>

import unittest
from hyperscript import h, unescape
from hyperscript import h, safe

@@ -90,8 +90,16 @@

def test_unescape(self) -> None:
self.assertEqual(
str(h("div", unescape("<&>"), autoescape=True)), "<div><&></div>"
str(h("div", {"prop": "<&>"}, autoescape=True)),
'<div prop="&lt;&amp;&gt;"></div>',
)
def test_safe(self) -> None:
self.assertEqual(str(h("div", safe("<&>"), autoescape=True)), "<div><&></div>")
self.assertEqual(
str(h("div", {"prop": safe("<&>")}, autoescape=True)),
'<div prop="<&>"></div>',
)
with self.assertRaises(TypeError):
unescape(h("div")) # type: ignore
safe(h("div")) # type: ignore