
Security News
NVD Quietly Sweeps 100K+ CVEs Into a “Deferred” Black Hole
NVD now marks all pre-2018 CVEs as "Deferred," signaling it will no longer enrich older vulnerabilities, further eroding trust in its data.
WebComPy is Python frontend framework for PyScript, which has following features.
mkdir webcompy-project
cd webcompy-project
pip install webcompy
python -m webcompy init
python -m webcompy start --dev
python -m webcompy generate # for generating static site
then access http://127.0.0.1:8080/WebComPy/
from webcompy.reactive import Reactive, computed_property, computed
from webcompy.elements import html, repeat, switch, DOMEvent
from webcompy.router import RouterContext
from webcompy.components import (
define_component,
ComponentContext,
TypedComponentBase,
component_class,
on_before_rendering,
component_template,
)
@define_component
def FizzbuzzList(context: ComponentContext[Reactive[int]]):
@computed
def fizzbuzz():
li: list[str] = []
for n in range(1, context.props.value + 1):
if n % 15 == 0:
li.append("FizzBuzz")
elif n % 5 == 0:
li.append("Fizz")
elif n % 3 == 0:
li.append("Buzz")
else:
li.append(str(n))
return li
return html.DIV(
{},
html.UL(
{},
repeat(fizzbuzz, lambda s: html.LI({}, s)),
),
)
FizzbuzzList.scoped_style = {
"ul": {
"border": "dashed 2px #668ad8",
"background": "#f1f8ff",
"padding": "0.5em 0.5em 0.5em 2em",
},
"ul > li:nth-child(3n)": {
"color": "red",
},
"ul > li:nth-child(5n)": {
"color": "blue",
},
"ul > li:nth-child(15n)": {
"color": "purple",
},
}
@component_class
class Fizzbuzz(TypedComponentBase(props_type=RouterContext)):
def __init__(self) -> None:
self.opened = Reactive(True)
self.count = Reactive(10)
@computed_property
def toggle_button_text(self):
return "Hide" if self.opened.value else "Open"
@on_before_rendering
def on_before_rendering(self):
self.count.value = 10
def add(self, ev: DOMEvent):
self.count.value += 1
def pop(self, ev: DOMEvent):
if self.count.value > 0:
self.count.value -= 1
def toggle(self, ev: DOMEvent):
self.opened.value = not self.opened.value
@component_template
def template(self):
return html.DIV(
{},
html.H3(
{},
"FizzBuzz",
),
html.P(
{},
html.BUTTON(
{"@click": self.toggle},
self.toggle_button_text,
),
html.BUTTON(
{"@click": self.add},
"Add",
),
html.BUTTON(
{"@click": self.pop},
"Pop",
),
),
html.P(
{},
"Count: ",
self.count,
),
switch(
{
"case": self.opened,
"generator": lambda: FizzbuzzList(props=self.count),
},
default=lambda: html.H5(
{},
"FizzBuzz Hidden",
),
),
)
This project is licensed under the MIT License, see the LICENSE.txt file for details.
FAQs
Python frontend framework which works on Browser
We found that webcompy demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
NVD now marks all pre-2018 CVEs as "Deferred," signaling it will no longer enrich older vulnerabilities, further eroding trust in its data.
Research
Security News
Lazarus-linked threat actors expand their npm malware campaign with new RAT loaders, hex obfuscation, and over 5,600 downloads across 11 packages.
Security News
Safari 18.4 adds support for Iterator Helpers and two other TC39 JavaScript features, bringing full cross-browser coverage to key parts of the ECMAScript spec.