Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Easily create object from any dict/jsonstr/jsonfile and dict/jsonstr/jsonfile from any object
From v0.1.0 it is based on jsonpickle
pip install jsoncodable
# or
pip3 install jsoncodable
from jsoncodable import JSONCodable, CompressionAlgorithm
class BirthDay(JSONCodable):
def __init__(
self,
month: int,
day: int
):
self.month = month
self.day = day
class Person(JSONCodable):
def __init__(
self,
name: str,
birth_month: int,
birth_day: int
):
self.name = name
self.birth_day = BirthDay(birth_month, birth_day)
person = Person(
name='John',
birth_month=7,
birth_day=7
)
person.jsonprint()
# prints
#
# {
# "name": "John",
# "birth_day": {
# "month": 7,
# "day": 7
# }
# }
Person.load(person.json).jsonprint()
# prints
#
# {
# "name": "John",
# "birth_day": {
# "month": 7,
# "day": 7
# }
# }
import os
# Save with compression
json_file_path = 'test.json'
for c in CompressionAlgorithm:
compressed_file_path = person.save(json_file_path, compression=c)
# returns a file path which has the compressed extension if not present at the end of your provided path
# also prints a message to let you know, that the path had been modified
Person.load(compressed_file_path).jsonprint()
# prints
#
# {
# "name": "John",
# "birth_day": {
# "month": 7,
# "day": 7
# }
# }
# Cleaning up
os.remove(compressed_file_path)
FAQs
to_dict
We found that jsoncodable 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
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.