Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
toastedmarshmallow-enum
Advanced tools
The Toasted Marshmallow Enum package makes it possible to dump and load Enum values based on the ultra fast serialization that Toasted Marshmallow provides.
:fire:toastedmarshmallow-enum:fire:: Dumps and Loads Enums
Inspired by Marshmallow Enum <https://github.com/justanr/marshmallow_enum>
_ and by ORM libraries.
The Toasted Marshmallow Enum package makes it possible to dump and load Enum values based on the ultra fast
serialization that Toasted Marshmallow <https://github.com/lyft/toasted-marshmallow>
_ provides.
.. code-block:: bash
pip install toastedmarshmallow-enum
Using Toasted Marshmallow Enum in an existing Marshmallow Schema
is as easy as defining the enum class attribute
as an EnumField
. For example:
.. code-block:: python
from enum import Enum
import toastedmarshmallow
from marshmallow import fields, Schema
from toastedmarshmallow_enum import EnumField
class Level(Enum):
LOW = '0'
MEDIUM = '1'
HIGH = '2'
class UserSchema(Schema):
class Meta:
jit = toastedmarshmallow.Jit
name = fields.String()
level = EnumField(Level)
Dump methods:
.. code-block:: python
class User:
def __init(name, level):
self.name = name
self.level = level
schema = DummyUserSchema()
user = User(name='John Doe', level=Level.HIGH)
print(schema.dump(user).data)
# {'name': 'John Doe', 'level': 2}
print(schema.load({'name': 'John Doe', 'level: 2}).data)
# {'name': 'John Doe', 'level': 'HIGH'}
FAQs
The Toasted Marshmallow Enum package makes it possible to dump and load Enum values based on the ultra fast serialization that Toasted Marshmallow provides.
We found that toastedmarshmallow-enum 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.