-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* build: enable more ruff rules * refactor: move code * feat: make it possible to infer command * test: move test * feat: use entrydto and generic...
- Loading branch information
1 parent
8e5bfbc
commit cc5ba9f
Showing
16 changed files
with
352 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
"""Alias generators.""" | ||
|
||
|
||
def to_lower_camel(s: str) -> str: | ||
"""Transform snake_case to lowerCamelCase.""" | ||
|
||
return "".join( | ||
word.capitalize() if i > 0 else word for i, word in enumerate(s.split("_")) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
from karp.lex_core.dtos.entry_dto import EntryDto | ||
from karp.lex_core.dtos.entry_dto import EntryDto, GenericEntryDto | ||
|
||
EntryDtoDict = EntryDto[dict] | ||
|
||
__all__ = ["EntryDto", "EntryDtoDict"] | ||
__all__ = ["EntryDto", "GenericEntryDto"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
from karp.lex_core.dtos import EntryDtoDict | ||
from karp.lex_core.dtos import EntryDto | ||
|
||
|
||
def test_can_create_entry_dto(): | ||
entry_dto = EntryDtoDict(entry={"field": "value"}) | ||
entry_dto = EntryDto(entry={"field": "value"}) | ||
|
||
assert entry_dto.last_modified is None | ||
assert entry_dto.last_modified_by is None | ||
|
||
|
||
def test_can_create_entry_dto_with_last_modified_by(): | ||
entry_dto = EntryDtoDict( | ||
entry_dto = EntryDto( | ||
entry={"field": "value"}, lastModifiedBy="[email protected]" | ||
) | ||
|
||
|
@@ -31,7 +31,7 @@ def test_example_snake_case(): | |
"last_modified": 1671443451.340828, | ||
"last_modified_by": "local admin", | ||
} | ||
entry_dto = EntryDtoDict(**data) | ||
entry_dto = EntryDto(**data) | ||
|
||
assert entry_dto.entity_id == data["entity_id"] | ||
assert entry_dto.resource == data["resource"] | ||
|
Oops, something went wrong.