1
0

Ruff
All checks were successful
Test Python / Test (push) Successful in 26s

This commit is contained in:
Jon Michael Aanes 2024-10-01 10:29:12 +02:00
parent b3c2d9408e
commit d24bbff21d
5 changed files with 14 additions and 10 deletions

View File

@ -35,6 +35,7 @@ CARD_FILENAME_REGEX = r'^\/PAR\-(\d+)\.md$'
OFFICIAL_URL = 'https://favro.com/organization/{org_id}?card=par-{seq_id}' OFFICIAL_URL = 'https://favro.com/organization/{org_id}?card=par-{seq_id}'
@dataclasses.dataclass(frozen=True) @dataclasses.dataclass(frozen=True)
class FileSystemItem: class FileSystemItem:
@staticmethod @staticmethod
@ -111,7 +112,6 @@ class FavroFuse(fuse.Fuse):
card = self.favro_client.get_card(thing.seq_id) card = self.favro_client.get_card(thing.seq_id)
contents_str = self._format_card_file(card) contents_str = self._format_card_file(card)
contents = bytes(contents_str, 'utf8') contents = bytes(contents_str, 'utf8')
@ -183,7 +183,7 @@ class FavroFuse(fuse.Fuse):
] ]
dependencies = [ dependencies = [
CARD_FILENAME_FORMAT.format( CARD_FILENAME_FORMAT.format(
seq_id=self.favro_client.get_card_by_card_id(dep.card_id).seq_id.raw_id seq_id=self.favro_client.get_card_by_card_id(dep.card_id).seq_id.raw_id,
) )
for dep in card.dependencies for dep in card.dependencies
if dep.is_before if dep.is_before
@ -194,7 +194,9 @@ class FavroFuse(fuse.Fuse):
tags, tags,
assignments, assignments,
dependencies, dependencies,
url=OFFICIAL_URL.format(org_id=card.organization_id.raw_id, seq_id=card.seq_id.raw_id), url=OFFICIAL_URL.format(
org_id=card.organization_id.raw_id, seq_id=card.seq_id.raw_id,
),
) )
return self.formatter.format_card_contents(card_contents) return self.formatter.format_card_contents(card_contents)

View File

@ -2,6 +2,7 @@ import secret_loader
secrets = secret_loader.SecretLoader() secrets = secret_loader.SecretLoader()
def has_secrets(): def has_secrets():
return secrets.load('FAVRO_ORGANIZATION_ID') is not None return secrets.load('FAVRO_ORGANIZATION_ID') is not None

View File

@ -29,6 +29,7 @@ def test_get_card():
assert len(card.attachments) == 0 assert len(card.attachments) == 0
assert len(card.custom_fields) == 2 assert len(card.custom_fields) == 2
def create_client(): def create_client():
return FavroClient( return FavroClient(
favro_org_id=OrganizationId(secrets.favro_org_id()), favro_org_id=OrganizationId(secrets.favro_org_id()),

View File

@ -4,4 +4,3 @@ def test_import():
import favro_sync.favro_fuse # noqa import favro_sync.favro_fuse # noqa
import favro_sync.favro_markdown # noqa import favro_sync.favro_markdown # noqa
import favro_sync # noqa import favro_sync # noqa

View File

@ -67,6 +67,7 @@ def test_parse_and_render_2():
assert '---' not in card_contents.description assert '---' not in card_contents.description
assert FORMATTER.format_card_contents(card_contents) == EXAMPLE_TEXT_2 assert FORMATTER.format_card_contents(card_contents) == EXAMPLE_TEXT_2
def test_parse_and_render_3(): def test_parse_and_render_3():
card_contents = FORMATTER.parse_card_contents(EXAMPLE_TEXT_3) card_contents = FORMATTER.parse_card_contents(EXAMPLE_TEXT_3)
print(card_contents) print(card_contents)