
Research
/Security News
Malicious npm Packages Target WhatsApp Developers with Remote Kill Switch
Two npm packages masquerading as WhatsApp developer libraries include a kill switch that deletes all files if the phone number isn’t whitelisted.
Python package that allows to parse typed configs defined by python dataclasses
truly fully-typed python configs - not more, not less.
from dataclasses import dataclass
from typing import List
@dataclass
class DummyConfigElement:
name: str
list: List[int]
another_list: List[float]
parser = ConfigParser(datastructure_module_name="mysrc.datastructures.configs")
my_config = parser.parse_from_file("myconfig.json")
my_config_dict = {"type_name" : "mysrc.datastructures.configs.a", "value" : 1}
my_config = parser.parse(my_config_dict)
There are two ways to define the configs type:
from mysrc.datastructures.configs import a
my_config_dict = {"some_key" : "some_value"}
# config has no key "type_name" but type is specified when parsing
my_config = ConfigParser().parse_typed(my_config_dict,a)
By default every field can be explicitly set to None. If you don't what this behavior you can set the flag "allow_none" to False.
from cfgparser import settings
settings.allow_none = False
Whenever a Union type is encountered the parser tries to parse the config with the first type in the union. If this fails it tries the next type and so on. If all types fail the parser raises an exception. For instance, in the example below the parser tries to parse the config as a Bird. If this fails it tries to parse it as a Cat. If this fails too the parser raises an exception.
from dataclasses import dataclass
from typing import Union
@dataclass
class Bird:
name: str
wingspan: float
@dataclass
class Cat:
name: str
paws: int
@dataclass
class AnimalOwnership:
owner: str
animal : Union[Bird, Cat]
pip install cfgparser
FAQs
Python package that allows to parse typed configs defined by python dataclasses
We found that cfgparser 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
Two npm packages masquerading as WhatsApp developer libraries include a kill switch that deletes all files if the phone number isn’t whitelisted.
Research
/Security News
Socket uncovered 11 malicious Go packages using obfuscated loaders to fetch and execute second-stage payloads via C2 domains.
Security News
TC39 advances 11 JavaScript proposals, with two moving to Stage 4, bringing better math, binary APIs, and more features one step closer to the ECMAScript spec.