# Path: app/note_util.py
# MARKDOWN_EXTRAS = [
#     'code-friendly',
#     'fenced-code-blocks',
#     'smarty-pants',
#     'tables',
# ]
# TIMEZONE = ZoneInfo(os.environ['DISPLAY_TIMEZONE'])
# NOTES_DIRECTORY = 'notes'
# REFERENCE_DIRECTORY = 'reference'
# class Note(object):
#     def __init__(self) -> None:
#     def __eq__(self, other: Any) -> bool:
#     def __repr__(self) -> str:
#     def get_note_file_data(note_file: str) -> Optional["Note"]:
#     def parse_time(timestamp_str: str) -> datetime.datetime:
#     def parse_markdown(markdown: str) -> str:
#     def write_note(self) -> None:
# def prune_note_files(note_files: List[str]) -> List[str]:
#     def is_valid_note(note_file: str) -> bool:
# def get_note_files(directory: str) -> List[str]:
# def get_notes(directory: str) -> List[Note]:
# def get_note_from_slug(directory: str, slug: str) -> Optional[Note]:
# 
# Path: app/serve.py
#     def init_rollbar() -> None:
# def inject_envs() -> Dict[str, Any]:
# def robots() -> Any:
# def health() -> Any:
# def page_not_found(e: Exception) -> Any:


import datetime
import json
import os
import re
import tempfile
import unittest
import requests
from typing import Any, Callable, cast
from titlecase import titlecase
from varsnap import test
from app import note_util, serve
            self.note.note = note_util.Note.parse_markdown(self.note.markdown)
            self.note.write_note()
            note_file.flush()
            with open(note_file.name, 'r') as handle:
                data = handle.read()
            self.assertIn('title', data)
            self.assertIn('slug', data)
            self.assertIn('markdown', data)


class UtilCase(unittest.TestCase):
    def check_prune_note_files(
        self,
        file_name: str,
        assert_contains: bool
    ) -> None:
        note_files = note_util.prune_note_files([file_name])
        contains = file_name in note_files
        self.assertTrue(contains == assert_contains)

    def test_normal_notes(self) -> None:
        self.check_prune_note_files('asdf', True)

    def test_prune_tilde_notes(self) -> None:
        self.check_prune_note_files('asdf~', False)

    def test_prune_dotfile_notes(self) -> None:
        self.check_prune_note_files('.asdf', False)

    def test_get_note_from_unknown_slug(self) -> None:

# Path: app/note_util.py
# MARKDOWN_EXTRAS = [
#     'code-friendly',
#     'fenced-code-blocks',
#     'smarty-pants',
#     'tables',
# ]
# TIMEZONE = ZoneInfo(os.environ['DISPLAY_TIMEZONE'])
# NOTES_DIRECTORY = 'notes'
# REFERENCE_DIRECTORY = 'reference'
# class Note(object):
#     def __init__(self) -> None:
#     def __eq__(self, other: Any) -> bool:
#     def __repr__(self) -> str:
#     def get_note_file_data(note_file: str) -> Optional["Note"]:
#     def parse_time(timestamp_str: str) -> datetime.datetime:
#     def parse_markdown(markdown: str) -> str:
#     def write_note(self) -> None:
# def prune_note_files(note_files: List[str]) -> List[str]:
#     def is_valid_note(note_file: str) -> bool:
# def get_note_files(directory: str) -> List[str]:
# def get_notes(directory: str) -> List[Note]:
# def get_note_from_slug(directory: str, slug: str) -> Optional[Note]:
# 
# Path: app/serve.py
#     def init_rollbar() -> None:
# def inject_envs() -> Dict[str, Any]:
# def robots() -> Any:
# def health() -> Any:
# def page_not_found(e: Exception) -> Any:


# Path: app/tests/test_note.py
import datetime
import json
import os
import re
import tempfile
import unittest
import requests
from typing import Any, Callable, cast
from titlecase import titlecase
from varsnap import test
from app import note_util, serve

            self.note.note = note_util.Note.parse_markdown(self.note.markdown)
            self.note.write_note()
            note_file.flush()
            with open(note_file.name, 'r') as handle:
                data = handle.read()
            self.assertIn('title', data)
            self.assertIn('slug', data)
            self.assertIn('markdown', data)


class UtilCase(unittest.TestCase):
    def check_prune_note_files(
        self,
        file_name: str,
        assert_contains: bool
    ) -> None:
        note_files = note_util.prune_note_files([file_name])
        contains = file_name in note_files
        self.assertTrue(contains == assert_contains)

    def test_normal_notes(self) -> None:
        self.check_prune_note_files('asdf', True)

    def test_prune_tilde_notes(self) -> None:
        self.check_prune_note_files('asdf~', False)

    def test_prune_dotfile_notes(self) -> None:
        self.check_prune_note_files('.asdf', False)

    def test_get_note_from_unknown_slug(self) -> None:

        note = note_util.get_note_from_slug(note_util.NOTES_DIRECTORY, 'asdf')