fastkml icon indicating copy to clipboard operation
fastkml copied to clipboard

Refactor times.py

Open cleder opened this issue 1 year ago • 6 comments

Refactor times to use the registry.

  • Add new classes When, Begin and End
  • Remove the etree_element and _get_kwargs methods from TimeStamp and TimeSpan
  • Add new function following the GetKWArgs Protocol to parse the KmlDateTime from XML
  • Add new function following the SetElement Protocol to create the etree representation
  • Register the functions for the new classes
  • TimeStamp to optionally take the above when
  • TimeSpan to optionally take begin and end

cleder avatar Oct 05 '24 10:10 cleder

Hi @cleder, I'm interested in working on this issue. Can you please assign it to me?

Thanks

rishitc avatar Oct 05 '24 11:10 rishitc

Thanks @rishitc

cleder avatar Oct 05 '24 11:10 cleder

Hi @cleder, I want to update you that I'm working on this. Progress is a bit slow, but I hope to have an initial patch soon.

Thanks

rishitc avatar Oct 11 '24 22:10 rishitc

Can you document how to do it? For me, it is obvious, so I need an outsider's view on it to improve the documentation :wink:

cleder avatar Oct 15 '24 09:10 cleder

BTW, make a draft pull request, ask questions, I am happy to provide some guidance

cleder avatar Oct 15 '24 09:10 cleder

Hi @cleder,

Can you document how to do it? For me, it is obvious, so I need an outsider's view on it to improve the documentation 😉

Sure, I can work more on that as part of the #343

BTW, make a draft pull request, ask questions, I am happy to provide some guidance

Thank you so much 😄 I'll put up my draft PR by Saturday 👍

rishitc avatar Oct 16 '24 05:10 rishitc

Hi @cleder, In the file fastkml/times.py, TimeSpan already optionally accepts a begin and end of type Optional[KmlDateTime], so I think that sub-task is already taken care of, correct?

rishitc avatar Oct 19 '24 07:10 rishitc

@cleder, also the new classes When, Begin, and End must derive from _TimePrimitive so that they can access the super()._get_kwargs and super().etree_element methods, correct?

rishitc avatar Oct 19 '24 07:10 rishitc

I am not sure what you are trying to say, can you make a draft PR?

cleder avatar Oct 19 '24 14:10 cleder

Sounds good, I'll put up my draft PR in the next hour 👍

rishitc avatar Oct 19 '24 16:10 rishitc

Hi @cleder, My draft PR is up 🎉


Also, here's the current checklist status of my PR:

  • [x] Add new classes When, Begin and End
  • [x] Remove the etree_element and _get_kwargs methods from TimeStamp and TimeSpan
  • [ ] Add new function following the GetKWArgs Protocol to parse the KmlDateTime from XML
    • The new classes will need to import from _TimePrimitive to support this, right?
  • [ ] Add new function following the SetElement Protocol to create the etree representation
    • The new classes will need to import from _TimePrimitive to support this, right?
  • [ ] Register the functions for the new classes
  • [x] TimeStamp to optionally take the above when
  • [x] TimeSpan to optionally take begin and end
    • I think this has already been completed in an older commit.

rishitc avatar Oct 19 '24 16:10 rishitc

Hi @cleder,

I took a look at the changes in https://github.com/cleder/fastkml/commit/6e4dba115107b403af88afe0fc073cfe6f52afdc and the changes look good 👍

I'll learn more about the codebase to work on issues faster next time.

Thanks for your patience and guidance as I worked through the issue.

Thanks

rishitc avatar Nov 05 '24 13:11 rishitc