![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
TIterator#group_by
TDict[TList[T]]
instead of TDict[TIterator[T]]
OwlMixin
from_XXX
and to_XXX
except for some onesfrom_csvf
-> from_csvf_to_list
TList
head
-> take
partial
-> partition
(switch left and right)transformers.XXX
to_dict
to_dicts
to_json
to_jsonf
to_yaml
to_yamlf
to_csv
to_csvf
Have you ever wanted to write robust code in Python? This library will make such your wishes come true.
Define your data class which is extend OwlMixin, you can use some useful methods which help your codes robust.
See following Example
and API Reference
sections.
pip install owlmixin
https://tadashi-aikawa.github.io/owlmixin/
from owlmixin import OwlMixin, OwlEnum, TOption, TList
class Color(OwlEnum):
RED = "red"
GREEN = "green"
BLUE = "blue"
class Food(OwlMixin):
id: int
name: str
color: TOption[Color]
class Human(OwlMixin):
id: int
name: str
favorite: TList[Food]
jiro = Human.from_dict({
"id": 10,
"name": "jiro",
"favorite": [
{"id": 1, "name": "apple"},
{"id": 2, "name": "orange", "color": "green"}
]
})
Then...
>>> jiro.id
10
>>> jiro.name
'jiro'
>>> print(jiro.to_dict())
{'id': 10, 'name': 'jiro', 'favorite': [{'id': 1, 'name': 'apple'}, {'id': 2, 'name': 'orange', 'color': 'green'}]}
>>> print(jiro.favorite[0].to_pretty_json())
{
"id": 1,
"name": "apple"
}
>>> print(jiro.to_yaml())
favorite:
- id: 1
name: apple
- color: green
id: 2
name: orange
id: 10
name: jiro
>>> print(jiro.favorite.to_csv(['id', 'name', 'color'], with_header=True))
id,name,color
1,apple,
2,orange,green
You can also use methods chains as following.
from owlmixin import OwlMixin, TOption, TIterator
class Repository(OwlMixin):
id: int
name: str
description: TOption[str]
stargazers_count: int
class GithubRepository(OwlMixin):
total_count: int
incomplete_results: bool
items: TIterator[Repository]
Then...
>>> print(
... GithubRepository
... .from_json_url("https://api.github.com/search/repositories?q=git")
... .items
... .filter(lambda x: x.stargazers_count > 100)
... .order_by(lambda x: x.stargazers_count, True)
... .take(5)
... .emap(lambda v, i: {
... 'RANK': i+1,
... 'STAR': v.stargazers_count,
... 'NAME': v.name,
... 'DESCRIPTION': v.description
... })
... .to_csv(fieldnames=["RANK", "STAR", "NAME", "DESCRIPTION"], with_header=True)
... )
RANK,STAR,NAME,DESCRIPTION
1,84643,gitignore,A collection of useful .gitignore templates
2,30456,gogs,Gogs is a painless self-hosted Git service.
3,29908,git-flight-rules,Flight rules for git
4,27704,git,Git Source Code Mirror - This is a publish-only repository and all pull requests are ignored. Please follow Documentation/SubmittingPatches procedure for any of your improvements.
5,15541,tips,Most commonly used git tips and tricks.
Don't you think smart?
# Create env
$ uv run
# Build documentation and run server locally
$ make serve-docs
# Test (Doc test & Unit test)
$ make test
https://github.com/tadashi-aikawa/owlmixin/actions/workflows/release.yaml?query=workflow%3ARelease
If you can't or don't want to use GitHub Actions, you can release locally as following.
make release version=x.y.z
FAQs
Mixin which converts ``data class instance`` and others each other more simple.
We found that owlmixin 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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.