Skip to content

Commit e467d7c

Browse files
tobixenclaude
andcommitted
Fix unused imports in async_davobject.py
- Remove unnecessary `import icalendar` since icalendar_component property handles the import internally - Remove unused `old_id` variable assignment - Restructure vobject availability check to match sync version pattern and add noqa comment for intentional import 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 52e0f04 commit e467d7c

1 file changed

Lines changed: 8 additions & 10 deletions

File tree

‎caldav/async_davobject.py‎

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -466,9 +466,7 @@ def __init__(
466466
self.data = data # type: ignore
467467
if id:
468468
try:
469-
import icalendar
470-
471-
old_id = self.icalendar_component.pop("UID", None)
469+
self.icalendar_component.pop("UID", None)
472470
self.icalendar_component.add("UID", id)
473471
except Exception:
474472
pass # If icalendar is not available or data is invalid
@@ -615,14 +613,14 @@ async def _put(self, retry_on_failure: bool = True) -> None:
615613
elif r.status not in (204, 201):
616614
if retry_on_failure:
617615
try:
618-
import vobject
619-
620-
# This looks like a noop, but the object may be "cleaned"
621-
# See https://github.com/python-caldav/caldav/issues/43
622-
self.vobject_instance
623-
return await self._put(False)
616+
import vobject # noqa: F401 - checking availability
624617
except ImportError:
625-
pass
618+
retry_on_failure = False
619+
if retry_on_failure:
620+
# This looks like a noop, but the object may be "cleaned"
621+
# See https://github.com/python-caldav/caldav/issues/43
622+
self.vobject_instance
623+
return await self._put(False)
626624
raise error.PutError(errmsg(r))
627625

628626
async def _create(

0 commit comments

Comments
 (0)