
from __future__ import annotations
from dataclasses import dataclass
from email.utils import formataddr

from ....typing import BrandID


@dataclass(frozen=True)
class Sender:
    address: str
    name: str

    def format(self):
        """Format the sender as a string value suitable for an e-mail header."""
        realname = self.name if self.name else False
        return formataddr((realname, self.address))


@dataclass(frozen=True)
class EmailConfig:
    brand_id: BrandID
    sender: Sender
    contact_address: str


@dataclass(frozen=True)
class Message:
    sender: Sender
    recipients: list[str]
    subject: str
    body: str


from __future__ import annotations
from dataclasses import dataclass
from email.utils import formataddr
from typing import Optional

from ....typing import BrandID


@dataclass(frozen=True)
class Sender:
    address: str
    name: Optional[str]

    def format(self):
        """Format the sender as a string value suitable for an e-mail header."""
        return formataddr((self.name, self.address))


@dataclass(frozen=True)
class EmailConfig:
    brand_id: BrandID
    sender: Sender
    contact_address: str


@dataclass(frozen=True)
class Message:
    sender: Sender
    recipients: list[str]
    subject: str
    body: str

Make sender address name field optional
Make sender address name field optional

  
  from __future__ import annotations
  from dataclasses import dataclass
  from email.utils import formataddr
+ from typing import Optional
  
  from ....typing import BrandID
  
  
  @dataclass(frozen=True)
  class Sender:
      address: str
-     name: str
+     name: Optional[str]
  
      def format(self):
          """Format the sender as a string value suitable for an e-mail header."""
-         realname = self.name if self.name else False
-         return formataddr((realname, self.address))
+         return formataddr((self.name, self.address))
  
  
  @dataclass(frozen=True)
  class EmailConfig:
      brand_id: BrandID
      sender: Sender
      contact_address: str
  
  
  @dataclass(frozen=True)
  class Message:
      sender: Sender
      recipients: list[str]
      subject: str
      body: str
  
Make sender address name field optional
## Code Before:

from __future__ import annotations
from dataclasses import dataclass
from email.utils import formataddr

from ....typing import BrandID


@dataclass(frozen=True)
class Sender:
    address: str
    name: str

    def format(self):
        """Format the sender as a string value suitable for an e-mail header."""
        realname = self.name if self.name else False
        return formataddr((realname, self.address))


@dataclass(frozen=True)
class EmailConfig:
    brand_id: BrandID
    sender: Sender
    contact_address: str


@dataclass(frozen=True)
class Message:
    sender: Sender
    recipients: list[str]
    subject: str
    body: str

## Instruction:
Make sender address name field optional
## Code After:

from __future__ import annotations
from dataclasses import dataclass
from email.utils import formataddr
from typing import Optional

from ....typing import BrandID


@dataclass(frozen=True)
class Sender:
    address: str
    name: Optional[str]

    def format(self):
        """Format the sender as a string value suitable for an e-mail header."""
        return formataddr((self.name, self.address))


@dataclass(frozen=True)
class EmailConfig:
    brand_id: BrandID
    sender: Sender
    contact_address: str


@dataclass(frozen=True)
class Message:
    sender: Sender
    recipients: list[str]
    subject: str
    body: str
