Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove pendulum dependency #450

Merged
merged 26 commits into from
Jan 17, 2025
Merged
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
9139758
Remove pendulum dependency
svrooij Jan 14, 2025
41d8efd
Feedback processed and removed python-dateutil
svrooij Jan 15, 2025
f2ad78e
Merge branch 'main' into remove-pendulum-dependency
svrooij Jan 15, 2025
fc6c719
Some linting
svrooij Jan 15, 2025
431b036
parse_timedelta acts exacty the same as previous library
svrooij Jan 15, 2025
3812082
Merge branch 'main' into remove-pendulum-dependency
baywet Jan 15, 2025
74fbeeb
Fix issues caused by auto format
svrooij Jan 15, 2025
e6eb346
More pendulem removed
svrooij Jan 15, 2025
e61eabb
Reduce complexity and raise error instead of return none
svrooij Jan 15, 2025
5a2205a
ci: disables fail fast to get all feedback at once
baywet Jan 15, 2025
d7af3e3
chore: minor formatting fixes
baywet Jan 15, 2025
4540b25
chore: additional formatting issue
baywet Jan 15, 2025
58a8121
chore: additional formatting issues
baywet Jan 15, 2025
f9d9e84
fix: replace calls to parser by iso format
baywet Jan 15, 2025
f4a5692
chore: additional formatting
baywet Jan 15, 2025
fedf34c
fix: multiple text failing tests
baywet Jan 15, 2025
42f1b5b
chore: additional fixture data corrections
baywet Jan 15, 2025
e9021c9
fix: additional fixes for unit test setup
baywet Jan 15, 2025
f0ed780
Support additional timedeltas
svrooij Jan 16, 2025
293ea59
Make P mandatory
svrooij Jan 16, 2025
3bea953
chore: fixes formatting
baywet Jan 16, 2025
8aaeff1
fromisoformat compatibility
svrooij Jan 17, 2025
190f9dd
chore: linting
baywet Jan 17, 2025
15b5a31
Hopefully try 50 fixes it 💣
svrooij Jan 17, 2025
1373232
More 🕑 compatibility
svrooij Jan 17, 2025
f1b515f
Fixing datetime parsing in test 🧪
svrooij Jan 17, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore: additional formatting
Signed-off-by: Vincent Biret <[email protected]>
baywet committed Jan 15, 2025
commit f4a5692965cfcf28549d66d6b94303ee55f9c3db
Original file line number Diff line number Diff line change
@@ -12,8 +12,7 @@
from kiota_abstractions.utils import parse_timedelta_from_iso_format
from kiota_abstractions.serialization import Parsable, ParsableFactory, ParseNode

T = TypeVar("T", bool, str, int, float, UUID,
datetime, timedelta, date, time, bytes)
T = TypeVar("T", bool, str, int, float, UUID, datetime, timedelta, date, time, bytes)

U = TypeVar("U", bound=Parsable)

@@ -27,10 +26,8 @@ def __init__(self, raw_value: str) -> None:
self._raw_value = raw_value
self._node = unquote_plus(raw_value)
self._fields = self._get_fields(raw_value)
self._on_before_assign_field_values: Optional[Callable[[
Parsable], None]] = None
self._on_after_assign_field_values: Optional[Callable[[
Parsable], None]] = None
self._on_before_assign_field_values: Optional[Callable[[Parsable], None]] = None
self._on_after_assign_field_values: Optional[Callable[[Parsable], None]] = None

def get_str_value(self) -> Optional[str]:
"""Gets the string value from the node
@@ -167,11 +164,9 @@ def get_collection_of_primitive_values(self, primitive_type: type[T]) -> Optiona
list[T]: The collection of primitive values
"""
if not primitive_type:
raise Exception(
"Primitive type for deserialization cannot be null")
raise Exception("Primitive type for deserialization cannot be null")

primitive_types = {bool, str, int, float, UUID,
datetime, timedelta, date, time, bytes}
primitive_types = {bool, str, int, float, UUID, datetime, timedelta, date, time, bytes}
if primitive_type in primitive_types:
items = self._node.split(',')
result: list[T] = []
@@ -184,8 +179,7 @@ def get_collection_of_primitive_values(self, primitive_type: type[T]) -> Optiona
raise Exception(f"Encountered an unknown type during deserialization {primitive_type}")

def get_collection_of_object_values(self, factory: ParsableFactory[U]) -> Optional[list[U]]:
raise Exception(
"Collection of object values is not supported with uri form encoding.")
raise Exception("Collection of object values is not supported with uri form encoding.")

def get_collection_of_enum_values(self, enum_class: K) -> Optional[list[K]]:
"""Gets the collection of enum values of the node
@@ -196,8 +190,7 @@ def get_collection_of_enum_values(self, enum_class: K) -> Optional[list[K]]:
if values:
return list(
map(
lambda x: self._create_new_node(
x).get_enum_value(enum_class), # type: ignore
lambda x: self._create_new_node(x).get_enum_value(enum_class), # type: ignore
values
)
)
@@ -294,8 +287,7 @@ def _assign_field_values(self, item: Parsable) -> None:
field_deserializer = field_deserializers[field_name]
field_deserializer(FormParseNode(field_value))
elif item_additional_data is not None:
item_additional_data[field_name] = self.try_get_anything(
field_value)
item_additional_data[field_name] = self.try_get_anything(field_value)
else:
warnings.warn(
f"Found additional property {field_name} to \