1
0
This commit is contained in:
Jon Michael Aanes 2024-10-01 16:15:03 +02:00
parent af65179f2d
commit 4a9f0fba8f
3 changed files with 14 additions and 7 deletions

View File

@ -12,14 +12,14 @@ import requests
from .favro_data_model import (
Card,
CardId,
CustomFieldId,
CustomFieldInfo,
OrganizationId,
SeqId,
TagId,
TagInfo,
UserId,
UserInfo,
CustomFieldId,
CustomFieldInfo,
)
from .favro_markdown import CardContents
@ -112,7 +112,10 @@ class FavroClient:
while page < num_pages:
# Determine params for get_cards
request = self._get_cards_request(
seq_id, todo_list, page=page, request_id=request_id
seq_id,
todo_list,
page=page,
request_id=request_id,
)
# Run query
@ -171,7 +174,7 @@ class FavroClient:
def get_custom_field(self, tag_id: CustomFieldId) -> CustomFieldInfo:
response = self.session.get(
URL_GET_CUSTOM_FIELD.format(custom_field_id=custom_field_id.raw_id)
URL_GET_CUSTOM_FIELD.format(custom_field_id=custom_field_id.raw_id),
)
return CustomFieldInfo.from_json(response.json())

View File

@ -210,7 +210,8 @@ class Card:
tags=[TagId(tag) for tag in json['tags']],
creator_user_id=UserId(json['createdByUserId']),
creation_date=map_opt(
datetime.datetime.fromisoformat, json.get('createdAt')
datetime.datetime.fromisoformat,
json.get('createdAt'),
),
start_date=map_opt(datetime.datetime.fromisoformat, json.get('startDate')),
due_date=map_opt(datetime.datetime.fromisoformat, json.get('dueDate')),

View File

@ -1,6 +1,6 @@
import dataclasses
import re
import datetime
import re
import frontmatter
import marko
@ -113,7 +113,10 @@ class CardFileFormatter:
if description := card.description:
if self.obsidian_mode:
description = re.sub(
r'\-\s*\[\s*\]', '- [ ]', description, flags=re.MULTILINE
r'\-\s*\[\s*\]',
'- [ ]',
description,
flags=re.MULTILINE,
)
ls.append(description)
del description