Skip to content

Commit

Permalink
unapplied yapf
Browse files Browse the repository at this point in the history
  • Loading branch information
mabuelhagag committed Aug 5, 2022
1 parent 5d80264 commit f3359ea
Show file tree
Hide file tree
Showing 45 changed files with 2 additions and 143 deletions.
1 change: 0 additions & 1 deletion opwen_email_client/domain/email/attachment.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@


class AttachmentEncoder(metaclass=ABCMeta):

@abstractmethod
def encode(self, content: bytes) -> str:
raise NotImplementedError # pragma: no cover
Expand Down
3 changes: 0 additions & 3 deletions opwen_email_client/domain/email/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@


class EmailServerClient(metaclass=ABCMeta):

@abstractmethod
def upload(self, resource_id: str, container: str):
raise NotImplementedError # pragma: no cover
Expand All @@ -20,7 +19,6 @@ def download(self) -> str:


class HttpEmailServerClient(EmailServerClient):

def __init__(self, compression: str, endpoint: str, client_id: str):
self._compression = compression
self._endpoint = endpoint
Expand Down Expand Up @@ -64,7 +62,6 @@ def download(self):


class LocalEmailServerClient(EmailServerClient):

def download(self) -> str:
root = getenv('OPWEN_REMOTE_ACCOUNT_NAME')
container = getenv('OPWEN_REMOTE_RESOURCE_CONTAINER')
Expand Down
2 changes: 0 additions & 2 deletions opwen_email_client/domain/email/sql_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,6 @@ def is_received_by(cls, email_address):


class _SqlalchemyEmailStore(EmailStore):

def __init__(self, page_size: int, database_uri: str, restricted=None):
super().__init__(restricted)
self._page_size = page_size
Expand Down Expand Up @@ -330,7 +329,6 @@ def sent(self, email_address, page):


class SqliteEmailStore(_SqlalchemyEmailStore):

def __init__(self, page_size: int, database_path: str, restricted=None):
super().__init__(
page_size=page_size,
Expand Down
1 change: 0 additions & 1 deletion opwen_email_client/domain/email/store.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@


class EmailStore(metaclass=ABCMeta):

def __init__(self, restricted: Optional[Dict[str, Set[str]]] = None):
self._restricted = restricted or {}

Expand Down
1 change: 0 additions & 1 deletion opwen_email_client/domain/email/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@


class Sync(metaclass=ABCMeta):

@abstractmethod
def upload(self, items: Iterable[T], users: Iterable[User]) -> Iterable[str]:
raise NotImplementedError # pragma: no cover
Expand Down
2 changes: 0 additions & 2 deletions opwen_email_client/domain/email/user_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@


class User(UserMixin):

@property
@abstractmethod
def id(self) -> Union[str, int]:
Expand Down Expand Up @@ -38,7 +37,6 @@ def active(self) -> bool:


class UserStore(metaclass=ABCMeta):

def __init__(self, read: UserReadStore, write: UserWriteStore) -> None:
self.r = read
self.w = write
Expand Down
1 change: 0 additions & 1 deletion opwen_email_client/util/serialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@


class Serializer(metaclass=ABCMeta):

@abstractmethod
def serialize(self, obj: T, type_: str = '') -> bytes:
raise NotImplementedError # pragma: no cover
Expand Down
3 changes: 0 additions & 3 deletions opwen_email_client/util/wtforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@


class CronSchedule:

def __init__(self, message=None):
self.message = message

Expand All @@ -34,7 +33,6 @@ def __call__(self, form, field, message=None):


class Emails(Regexp):

def __init__(self, email_address_delimiter, message=None):
self.validate_hostname = HostnameValidation(require_tld=True)
self.email_address_delimiter = email_address_delimiter
Expand Down Expand Up @@ -87,7 +85,6 @@ def _to_safe_html(cls, data: Optional[str]) -> str:


class SuffixedStringField(StringField):

def __init__(self, suffix: str = '', *args, **kwargs):
super().__init__(*args, **kwargs)
self._suffix = suffix
Expand Down
5 changes: 0 additions & 5 deletions opwen_email_client/webapp/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@


class SyncEmails(object):

def __init__(self, email_store: EmailStore, email_sync: Sync, user_store: UserStore, log: Logger):
self._email_store = email_store
self._email_sync = email_sync
Expand Down Expand Up @@ -98,7 +97,6 @@ def __call__(self):


class RestartApp(object):

def __init__(self, restart_paths: Mapping[str, str]):
self._restart_paths = restart_paths

Expand All @@ -110,7 +108,6 @@ def __call__(self):


class RestartAppComponent(object):

def __init__(self, restart_path: str):
self._restart_path = restart_path

Expand All @@ -132,7 +129,6 @@ def __call__(self):


class SendWelcomeEmail(object):

def __init__(self, to: str, time, email_store: EmailStore):
self._to = to
self._time = time
Expand Down Expand Up @@ -235,7 +231,6 @@ def __call__(self):


class ClientRegister(object):

def __init__(self, client_name: str, access_token: str, path: str, logger: Logger):
self._client_name = client_name
self._github_access_token = access_token
Expand Down
3 changes: 1 addition & 2 deletions opwen_email_client/webapp/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ class i8n(object):
USER_PROMOTED = _('The user now is an administrator.')
ALREADY_PROMOTED = _('The user already is an administrator.')
ADMIN_CANNOT_BE_SUSPENDED = _("Administrators can't be suspended.")
ADMIN_PASSWORD_CANNOT_BE_RESET = _("Administrator password can't be "
"reset.")
ADMIN_PASSWORD_CANNOT_BE_RESET = _("Administrator password can't be " "reset.")
PASSWORD_CHANGED_BY_ADMIN = _('Password was reset by administrator to: ')
SAME_PASSWORD = _(' Your new password must be different than your previous password.')

Expand Down
1 change: 0 additions & 1 deletion opwen_email_client/webapp/forms/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ def _update_sync_schedule(self) -> bool:

@classmethod
def _update_config(cls, env_key: str, value: str):

def is_env(line):
return line.startswith('{}='.format(env_key))

Expand Down
1 change: 0 additions & 1 deletion opwen_email_client/webapp/jinja.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ def render_body(email: dict) -> str:

@app.context_processor
def _inject_format_last_login():

def format_last_login(user, current_user) -> str:
if not user.last_login_at:
return ''
Expand Down
1 change: 0 additions & 1 deletion opwen_email_client/webapp/login.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ class _Role(_db.Model, RoleMixin):


class FlaskLoginUserStore(UserStore):

def __init__(self):
store = SQLAlchemyUserDatastore(_db, _User, _Role)
super().__init__(read=store, write=store)
Expand Down
1 change: 0 additions & 1 deletion opwen_email_client/webapp/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ def get_current_language(cls) -> str:


def track_history(func):

@wraps(func)
def history_tracker(*args, **kwargs):
Session.store_last_visited_url()
Expand Down
16 changes: 0 additions & 16 deletions opwen_email_server/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@


class _Action(ABC, LogMixin):

def __call__(self, *args, **kwargs) -> Response:
try:
return self._action(*args, **kwargs)
Expand All @@ -54,7 +53,6 @@ def _action(self): # type: ignore


class SendOutboundEmails(_Action):

def __init__(self, email_storage: AzureObjectStorage, send_email: SendSendgridEmail):

self._email_storage = email_storage
Expand All @@ -72,7 +70,6 @@ def _action(self, resource_id): # type: ignore


class StoreInboundEmails(_Action):

def __init__(self,
raw_email_storage: AzureTextStorage,
email_storage: AzureObjectStorage,
Expand Down Expand Up @@ -117,7 +114,6 @@ def _store_inbound_email(self, email: dict) -> str:


class _IndexEmailForMailbox(_Action):

def __init__(self, email_storage: AzureObjectStorage, mailbox_storage: AzureTextStorage):
self._email_storage = email_storage
self._mailbox_storage = mailbox_storage
Expand Down Expand Up @@ -161,7 +157,6 @@ def _get_pivot(self, email: dict) -> Iterable[str]:


class StoreWrittenClientEmails(_Action):

def __init__(self, client_storage: AzureObjectsStorage, email_storage: AzureObjectStorage,
user_storage: AzureObjectStorage, next_task: Callable[[str], None]):

Expand Down Expand Up @@ -220,7 +215,6 @@ def _decode_attachments(cls, email: dict) -> dict:


class ReceiveInboundEmail(_Action):

def __init__(self, auth: Auth, raw_email_storage: AzureTextStorage, next_task: Callable[[str], None]):
self._auth = auth
self._raw_email_storage = raw_email_storage
Expand Down Expand Up @@ -250,7 +244,6 @@ def _new_email_id(cls, email: str) -> str:


class ProcessServiceEmail(_Action):

def __init__(self,
raw_email_storage: AzureTextStorage,
email_storage: AzureObjectStorage,
Expand Down Expand Up @@ -295,7 +288,6 @@ def _action(self, resource_id): # type: ignore


class DownloadClientEmails(_Action):

def __init__(self, auth: Auth, client_storage: AzureObjectsStorage, email_storage: AzureObjectStorage,
pending_storage: AzureTextStorage):

Expand Down Expand Up @@ -354,7 +346,6 @@ def _mark_emails_as_delivered(self, domain: str, email_ids: Iterable[str]) -> No


class UploadClientEmails(_Action):

def __init__(self, auth: Auth, next_task: Callable[[str], None]):
self._auth = auth
self._next_task = next_task
Expand All @@ -374,7 +365,6 @@ def _action(self, client_id, upload_info): # type: ignore


class RegisterClient(_Action):

def __init__(self, auth: Auth, client_storage: AzureObjectsStorage, setup_mailbox: Callable[[str, str], None],
setup_mx_records: Callable[[str], None], client_id_source: Callable[[], str]):
self._auth = auth
Expand All @@ -396,7 +386,6 @@ def _action(self, domain, owner): # type: ignore


class CreateClient(_Action):

def __init__(self, auth: Auth, task: Callable[[str, str], None]):
self._auth = auth
self._task = task
Expand All @@ -415,7 +404,6 @@ def _action(self, client, user, **auth_args): # type: ignore


class ListClients(_Action):

def __init__(self, auth: Auth):
self._auth = auth

Expand All @@ -429,7 +417,6 @@ def _action(self, **auth_args): # type: ignore


class GetClient(_Action):

def __init__(self, auth: Auth, client_storage: AzureObjectsStorage):
self._auth = auth
self._client_storage = client_storage
Expand Down Expand Up @@ -457,7 +444,6 @@ def _action(self, domain, user, **auth_args): # type: ignore


class DeleteClient(_Action):

def __init__(self, auth: Auth, delete_mailbox: Callable[[str, str], None], delete_mx_records: Callable[[str], None],
mailbox_storage: AzureTextStorage, pending_storage: AzureTextStorage,
user_storage: AzureObjectStorage):
Expand Down Expand Up @@ -496,7 +482,6 @@ def _delete_index(cls, storage: Union[AzureTextStorage, AzureObjectStorage], dom


class CalculateNumberOfUsersMetric(_Action):

def __init__(self, auth: Auth, user_storage: AzureObjectStorage):
self._auth = auth
self._user_storage = user_storage
Expand All @@ -513,7 +498,6 @@ def _action(self, domain, user, **auth_args): # type: ignore


class CalculatePendingEmailsMetric(_Action):

def __init__(self, auth: Auth, pending_storage: AzureTextStorage):
self._auth = auth
self._pending_storage = pending_storage
Expand Down
6 changes: 0 additions & 6 deletions opwen_email_server/integration/webapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,11 @@


class AzureRole:

def __init__(self):
raise NotImplementedError


class AzureUser(User):

def __init__(self, **data):
super().__setattr__('_data', data)

Expand Down Expand Up @@ -76,7 +74,6 @@ def is_admin(self) -> bool:


class AzureUserStore(UserStore, UserReadStore, UserWriteStore):

def __init__(self, user_storage: AzureObjectStorage):
UserReadStore.__init__(self, user_model=AzureUser, role_model=AzureRole)
UserWriteStore.__init__(self, db=None)
Expand Down Expand Up @@ -130,7 +127,6 @@ def _path_for(cls, email: str) -> str:


class AzureEmailStore(EmailStore, LogMixin):

def __init__(self, email_storage: AzureObjectStorage, mailbox_storage: AzureTextStorage,
pending_storage: AzureTextStorage, send_email: Callable[[str], None]):
super().__init__(restricted=None)
Expand Down Expand Up @@ -243,7 +239,6 @@ def _mark_read(self, email_address: str, uids: Iterable[str]):


class NoSync(Sync):

def upload(self, items: Iterable, users: Iterable[User]) -> Iterable[str]:
return []

Expand All @@ -252,7 +247,6 @@ def download(self) -> Iterable:


class AzureIoc:

@cached_property
def email_store(self):
return AzureEmailStore(
Expand Down
1 change: 0 additions & 1 deletion opwen_email_server/mailers/echo.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@


class EchoEmailFormatter(LogMixin):

def __init__(self, now: Callable[[], datetime] = datetime.utcnow):
self._now = now

Expand Down
1 change: 0 additions & 1 deletion opwen_email_server/mailers/wikipedia.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@


class WikipediaEmailFormatter(LogMixin):

def __init__(self,
languages_getter: Callable[[], dict] = languages,
language_setter: Callable[[str], None] = set_lang,
Expand Down

0 comments on commit f3359ea

Please sign in to comment.