Skip to content

Commit

Permalink
⚙️ FEATURE: Removal of the sqllite feature
Browse files Browse the repository at this point in the history
  • Loading branch information
FernandoCelmer committed May 1, 2024
1 parent ac6eca4 commit 5ee7c7c
Show file tree
Hide file tree
Showing 19 changed files with 60 additions and 161 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -142,4 +142,7 @@ dmypy.json

# Database
*.sqlite3
*.db
*.db

# Others
html
4 changes: 3 additions & 1 deletion email_profile/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,6 @@

from email_profile.core import Email

__all__ = ['Email']
__all__ = [
'Email'
]
7 changes: 7 additions & 0 deletions email_profile/abstract/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from email_profile.abstract.model import AbstractModel
from email_profile.abstract.controller import AbstractController

__all__ = [
"AbstractModel",
"AbstractController"
]
28 changes: 28 additions & 0 deletions email_profile/abstract/controller.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
"""
Controller Module
"""

from abc import abstractmethod, ABC


class AbstractController(ABC):

def __init__(self, model=None, data=None) -> None:
self.model = model
self.data = data

@abstractmethod
def create(self) -> None:
pass

@abstractmethod
def read(self) -> None:
pass

@abstractmethod
def update(self) -> None:
pass

@abstractmethod
def delete(self) -> None:
pass
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
from abc import abstractclassmethod, ABC
"""
Model Module
"""

from dataclasses import dataclass
from abc import abstractclassmethod, ABC


@dataclass
class BaseModel(ABC):
class AbstractModel(ABC):

@abstractclassmethod
class Meta:
Expand Down
43 changes: 0 additions & 43 deletions email_profile/config/controller.py

This file was deleted.

10 changes: 0 additions & 10 deletions email_profile/config/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,8 @@
Database Module
"""

import logging
import sqlite3

from peewee import SqliteDatabase


def engine_sqlite3():
return sqlite3.connect("sql_app.db")


def engine_sqlite_database():
try:
return SqliteDatabase('sql_app.db')
except Exception as error:
logging.error(error)
30 changes: 3 additions & 27 deletions email_profile/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,9 @@
Data Module
"""

import logging

from typing import List, Dict
from abc import abstractmethod, ABC

from email_profile.config.controller import Controller

try:
from email_profile.models.peewee import (
AttachmentModel,
EmailModel
)
except Exception as error:
logging.error(error)

AttachmentModel = None
EmailModel = None


class DataAbstract(ABC):

Expand All @@ -41,7 +26,7 @@ def json(self) -> Dict:
}

@abstractmethod
def sqllite(self) -> None:
def hmtl(self) -> None:
pass


Expand All @@ -57,14 +42,5 @@ def json(self) -> Dict:
"attachments": attachments_temp
}

def sqllite(self) -> None:
Controller(
model=EmailModel,
data=self.email
).create()

for attachment in self.attachments:
Controller(
model=AttachmentModel,
data=attachment
).create()
def hmtl(self) -> None:
pass
6 changes: 3 additions & 3 deletions email_profile/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from email_profile.models.dataclass.attachment import AttachmentModel
from email_profile.models.dataclass.email import EmailModel
from email_profile.models.dataclass.mailbox import MailBoxModel
from email_profile.models.attachment import AttachmentModel
from email_profile.models.email import EmailModel
from email_profile.models.mailbox import MailBoxModel

__all__ = [
"AttachmentModel",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from dataclasses import dataclass, field

from email_profile.models.dataclass.base import BaseModel
from email_profile.abstract import AbstractModel


@dataclass
class AttachmentModel(BaseModel):
class AttachmentModel(AbstractModel):

class Meta:
table_name = 'attachment'
Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from datetime import datetime
from dataclasses import dataclass, field

from email_profile.models.dataclass.base import BaseModel
from email_profile.abstract import AbstractModel


@dataclass
class EmailModel(BaseModel):
class EmailModel(AbstractModel):

class Meta:
table_name = 'email'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from dataclasses import dataclass, field

from email_profile.models.dataclass.base import BaseModel
from email_profile.abstract import AbstractModel


@dataclass
class MailBoxModel(BaseModel):
class MailBoxModel(AbstractModel):

class Meta:
table_name = 'mailbox'
Expand Down
7 changes: 0 additions & 7 deletions email_profile/models/peewee/__init__.py

This file was deleted.

14 changes: 0 additions & 14 deletions email_profile/models/peewee/attachment.py

This file was deleted.

11 changes: 0 additions & 11 deletions email_profile/models/peewee/base.py

This file was deleted.

30 changes: 0 additions & 30 deletions email_profile/models/peewee/email.py

This file was deleted.

3 changes: 0 additions & 3 deletions example.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@ def main():
# Dump Json
print(content.json())

# Dump SQLlite
content.sqllite()


if __name__ == '__main__':
main()
3 changes: 0 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ classifiers = [
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]
dependencies = [
'peewee'
]

[project.urls]
Homepage = "https://github.com/linux-profile/email-profile"
Expand Down

0 comments on commit 5ee7c7c

Please sign in to comment.