![Maven Central Adds Sigstore Signature Validation](https://cdn.sanity.io/images/cgdhsj6q/production/7da3bc8a946cfb5df15d7fcf49767faedc72b483-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
litereval
is wrapper around ast.literal_eval
with new additional {foo='bar', key=None}
dict
syntax.
Plus some helper tools to deep merge dictionaries, parse ast.literal_eval
python data to *args
and **kwargs
.
Can be used to create wrapper command line interfaces. See pyppdf.
Needs python 3.6+
conda install -c defaults -c conda-forge litereval
or
pip install litereval
def litereval(string: str):
"""
Small extension of ``ast.literal_eval`` that also
accepts dict in a form of ``{key=100, foo='bar'}``
Returns
-------
ret :
ast.literal_eval(preprocess(string))
"""
def merge(source: dict, destination: dict,
copy: bool = False) -> dict:
"""
Deep merge two dictionaries.
Overwrites in case of conflicts.
From https://stackoverflow.com/a/20666342
"""
def args_kwargs(args: Any) -> Tuple[
Union[tuple, None], Union[dict, None]
]:
"""
Parses ``args`` object to ``(*args, **kwargs)`` tuple.
Special case when ``args`` is ``None``: returns ``(None, None)``.
Otherwise tries to put not iterable object to tuple:
``args`` to ``(args,)``. Examples:
* ``(1, 2)`` to ``(1, 2), {}``
* ``"foo"`` to ``("foo",), {}``
* ``{(): ('a', 0), 'foo': None} to
``('a', 0), {'foo': None}``
Returns
-------
ret :
tuple: *args, **kwargs
"""
def get_args(name: str, args, default=None) -> Args:
"""
Gets ``*args`` and ``**kwargs`` for a ``name`` function
from an ``args`` dict. Wrapper around ``args_kwargs`` function.
Returns ``NamedTuple`` ``Args``: ``(args: tuple, kwargs: dict)``
"""
def get(key: str, dic, default=None):
"""Gets key even from not a dictionary."""
def tuple_(obj: Any) -> tuple:
"""Converts any object to tuple. ``string`` to ``(string,)``."""
def validated(args: tuple, kwargs: dict) -> Tuple[tuple, dict]:
"""Validates inputs and returns ``*args, **kwargs``."""
FAQs
Wrapper around ast.literal_eval with new {foo='bar', key=None} dict syntax.
We found that litereval 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
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.