Skip to content

Commit

Permalink
Refactor: export 'record_type' and 'orgin_file' in snake-case
Browse files Browse the repository at this point in the history
  • Loading branch information
KarelZe committed Jan 8, 2024
1 parent 6cde29e commit 8ca3587
Showing 1 changed file with 20 additions and 11 deletions.
31 changes: 20 additions & 11 deletions utils/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
from bs4 import BeautifulSoup
import click
from dataclasses import dataclass, field
from dataclasses_json import LetterCase, dataclass_json, Undefined

from dataclasses_json import config, LetterCase, dataclass_json, Undefined
from shared import parse_db, write_results_to_json
from consts import XTRACT_HEADER

Expand All @@ -24,13 +23,15 @@ class Meeting:
type: Optional[str] = None
version: Optional[float] = None

record_type: Optional[str] = "meeting"
record_type: Optional[str] = field(
default="meeting", metadata=config(field_name="record_type")
)

def __eq__(self, other):
return self.cached_deduplication_key == other.cachedDeduplicationKey

def __hash__(self):
return hash(("cachedDeduplicationKey", self.cached_deduplication_key))
return hash((self.cached_deduplication_key))

def __lt__(self, other):
return self.cached_deduplication_key < other.cached_deduplication_key
Expand All @@ -56,8 +57,12 @@ class Message:
properties: dict[str, Any] = field(default_factory=dict)
version: Optional[str] = None

origin_file: Optional[str] = None
record_type: Optional[str] = "message"
origin_file: Optional[str] = field(
default=None, metadata=config(field_name="origin_file")
)
record_type: str = field(
default="message", metadata=config(field_name="record_type")
)

def __post_init__(self):
if self.cached_deduplication_key is None:
Expand All @@ -70,7 +75,7 @@ def __eq__(self, other):
)

def __hash__(self):
return hash(("cachedDeduplicationKey", self.cached_deduplication_key))
return hash((self.cached_deduplication_key))

def __lt__(self, other):
return self.cached_deduplication_key < other.cached_deduplication_key
Expand All @@ -81,17 +86,21 @@ def __lt__(self, other):
class Contact:
display_name: Optional[str] = None
email: Optional[str] = None
mri: Optional[str] = None
mri: Optional[str] = field(default=None, compare=True)
user_principal_name: Optional[str] = None

origin_file: Optional[str] = None
record_type: str = "contact"
origin_file: Optional[str] = field(
default=None, metadata=config(field_name="origin_file")
)
record_type: Optional[str] = field(
default="contact", metadata=config(field_name="record_type")
)

def __eq__(self, other):
return self.mri == other.mri

def __hash__(self):
return hash(("mri", self.mri))
return hash((self.mri))

def __lt__(self, other):
return self.mri < other.mri
Expand Down

0 comments on commit 8ca3587

Please sign in to comment.