Skip to content

Commit

Permalink
updated requirements and reformatted files
Browse files Browse the repository at this point in the history
  • Loading branch information
toluaina committed Mar 27, 2024
1 parent 8ea3f6b commit 56e9c13
Show file tree
Hide file tree
Showing 31 changed files with 71 additions and 37 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
repos:

- repo: https://github.com/psf/black
rev: 24.2.0
rev: 24.3.0
hooks:
- id: black

Expand Down
1 change: 1 addition & 0 deletions demo/server.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""PGSync Demo server."""

from aiohttp import web
from app.main import create_app

Expand Down
1 change: 1 addition & 0 deletions pgsync/base.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""PGSync Base."""

import logging
import os
import typing as t
Expand Down
1 change: 1 addition & 0 deletions pgsync/helper.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""PGSync helpers."""

import logging
import os
import typing as t
Expand Down
1 change: 1 addition & 0 deletions pgsync/node.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""PGSync Node class representation."""

from __future__ import annotations

import re
Expand Down
1 change: 1 addition & 0 deletions pgsync/plugin.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""PGSync Plugin."""

import logging
import os
import typing as t
Expand Down
1 change: 1 addition & 0 deletions pgsync/querybuilder.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""PGSync QueryBuilder."""

import threading
import typing as t
from collections import defaultdict
Expand Down
1 change: 1 addition & 0 deletions pgsync/redisqueue.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""PGSync RedisQueue."""

import json
import logging
import typing as t
Expand Down
19 changes: 10 additions & 9 deletions pgsync/search_client.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""PGSync SearchClient helper."""

import logging
import typing as t
from collections import defaultdict
Expand Down Expand Up @@ -404,9 +405,9 @@ def get_search_client(
# API
cloud_id: t.Optional[str] = settings.ELASTICSEARCH_CLOUD_ID
api_key: t.Optional[t.Union[str, t.Tuple[str, str]]] = None
http_auth: t.Optional[
t.Union[str, t.Tuple[str, str]]
] = settings.ELASTICSEARCH_HTTP_AUTH
http_auth: t.Optional[t.Union[str, t.Tuple[str, str]]] = (
settings.ELASTICSEARCH_HTTP_AUTH
)
if (
settings.ELASTICSEARCH_API_KEY_ID
and settings.ELASTICSEARCH_API_KEY
Expand All @@ -424,12 +425,12 @@ def get_search_client(
ca_certs: t.Optional[str] = settings.ELASTICSEARCH_CA_CERTS
client_cert: t.Optional[str] = settings.ELASTICSEARCH_CLIENT_CERT
client_key: t.Optional[str] = settings.ELASTICSEARCH_CLIENT_KEY
ssl_assert_hostname: t.Optional[
str
] = settings.ELASTICSEARCH_SSL_ASSERT_HOSTNAME
ssl_assert_fingerprint: t.Optional[
str
] = settings.ELASTICSEARCH_SSL_ASSERT_FINGERPRINT
ssl_assert_hostname: t.Optional[str] = (
settings.ELASTICSEARCH_SSL_ASSERT_HOSTNAME
)
ssl_assert_fingerprint: t.Optional[str] = (
settings.ELASTICSEARCH_SSL_ASSERT_FINGERPRINT
)
ssl_version: t.Optional[int] = settings.ELASTICSEARCH_SSL_VERSION
ssl_context: t.Optional[t.Any] = settings.ELASTICSEARCH_SSL_CONTEXT
ssl_show_warn: bool = settings.ELASTICSEARCH_SSL_SHOW_WARN
Expand Down
1 change: 1 addition & 0 deletions pgsync/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
It reads environment variables from a .env file and sets default values for each variable.
The variables are used to configure various parameters such as block size, checkpoint path, polling interval, etc.
"""

import logging
import logging.config
import os
Expand Down
1 change: 1 addition & 0 deletions pgsync/sync.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Sync module."""

import asyncio
import json
import logging
Expand Down
1 change: 1 addition & 0 deletions pgsync/transform.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""PGSync Transform."""

import logging
import typing as t

Expand Down
1 change: 1 addition & 0 deletions pgsync/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""PGSync utils."""

import json
import logging
import os
Expand Down
25 changes: 16 additions & 9 deletions pgsync/view.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""PGSync views."""

import logging
import typing as t
import warnings
Expand Down Expand Up @@ -457,15 +458,21 @@ def create_view(
[
(
table_name,
array(fields["primary_keys"])
if fields.get("primary_keys")
else None,
array(fields.get("foreign_keys"))
if fields.get("foreign_keys")
else None,
array(fields.get("indices"))
if fields.get("indices")
else None,
(
array(fields["primary_keys"])
if fields.get("primary_keys")
else None
),
(
array(fields.get("foreign_keys"))
if fields.get("foreign_keys")
else None
),
(
array(fields.get("indices"))
if fields.get("indices")
else None
),
)
for table_name, fields in rows.items()
]
Expand Down
12 changes: 6 additions & 6 deletions requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
#
async-timeout==4.0.3
# via redis
boto3==1.34.61
boto3==1.34.71
# via -r requirements/base.in
botocore==1.34.61
botocore==1.34.71
# via
# boto3
# s3transfer
Expand All @@ -21,7 +21,7 @@ charset-normalizer==3.3.2
# via requests
click==8.1.7
# via -r requirements/base.in
elastic-transport==8.12.0
elastic-transport==8.13.0
# via elasticsearch
elasticsearch==8.12.1
# via
Expand All @@ -43,7 +43,7 @@ marshmallow==3.21.1
# via environs
opensearch-dsl==2.1.0
# via -r requirements/base.in
opensearch-py==2.4.2
opensearch-py==2.5.0
# via opensearch-dsl
packaging==24.0
# via marshmallow
Expand All @@ -67,15 +67,15 @@ requests==2.31.0
# requests-aws4auth
requests-aws4auth==1.2.3
# via -r requirements/base.in
s3transfer==0.10.0
s3transfer==0.10.1
# via boto3
six==1.16.0
# via
# opensearch-dsl
# opensearch-py
# python-dateutil
# requests-aws4auth
sqlalchemy==2.0.28
sqlalchemy==2.0.29
# via -r requirements/base.in
sqlparse==0.4.4
# via -r requirements/base.in
Expand Down
24 changes: 12 additions & 12 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
#
async-timeout==4.0.3
# via redis
black==24.2.0
black==24.3.0
# via -r requirements/dev.in
boto3==1.34.61
boto3==1.34.71
# via -r requirements/base.in
botocore==1.34.61
botocore==1.34.71
# via
# boto3
# s3transfer
Expand All @@ -27,13 +27,13 @@ click==8.1.7
# via
# -r requirements/base.in
# black
coverage[toml]==7.4.3
coverage[toml]==7.4.4
# via
# -r requirements/dev.in
# pytest-cov
distlib==0.3.8
# via virtualenv
elastic-transport==8.12.0
elastic-transport==8.13.0
# via elasticsearch
elasticsearch==8.12.1
# via
Expand All @@ -45,9 +45,9 @@ environs==11.0.0
# via -r requirements/base.in
exceptiongroup==1.2.0
# via pytest
faker==24.1.1
faker==24.4.0
# via -r requirements/dev.in
filelock==3.13.1
filelock==3.13.3
# via virtualenv
flake8==7.0.0
# via -r requirements/dev.in
Expand Down Expand Up @@ -79,7 +79,7 @@ nodeenv==1.8.0
# via pre-commit
opensearch-dsl==2.1.0
# via -r requirements/base.in
opensearch-py==2.4.2
opensearch-py==2.5.0
# via opensearch-dsl
packaging==24.0
# via
Expand Down Expand Up @@ -107,9 +107,9 @@ pytest==8.1.1
# -r requirements/dev.in
# pytest-cov
# pytest-mock
pytest-cov==4.1.0
pytest-cov==5.0.0
# via -r requirements/dev.in
pytest-mock==3.12.0
pytest-mock==3.14.0
# via -r requirements/dev.in
python-dateutil==2.9.0.post0
# via
Expand All @@ -133,15 +133,15 @@ requests==2.31.0
# requests-aws4auth
requests-aws4auth==1.2.3
# via -r requirements/base.in
s3transfer==0.10.0
s3transfer==0.10.1
# via boto3
six==1.16.0
# via
# opensearch-dsl
# opensearch-py
# python-dateutil
# requests-aws4auth
sqlalchemy==2.0.28
sqlalchemy==2.0.29
# via -r requirements/base.in
sqlparse==0.4.4
# via -r requirements/base.in
Expand Down
1 change: 1 addition & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Generic fixtures for PGSync tests."""

import logging
import os

Expand Down
1 change: 1 addition & 0 deletions tests/test_constants.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Constants tests."""

from pgsync.constants import (
ELASTICSEARCH_MAPPING_PARAMETERS,
ELASTICSEARCH_TYPES,
Expand Down
1 change: 1 addition & 0 deletions tests/test_env_vars.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Env vars tests."""

import pytest


Expand Down
1 change: 1 addition & 0 deletions tests/test_helper.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Helper tests."""

import pytest
import sqlalchemy as sa
from mock import ANY, call, patch
Expand Down
1 change: 1 addition & 0 deletions tests/test_log_handlers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Loghandler tests."""

import pytest


Expand Down
1 change: 1 addition & 0 deletions tests/test_node.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Node tests."""

import pytest

from pgsync.base import Base
Expand Down
1 change: 1 addition & 0 deletions tests/test_query_builder.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""QueryBuilder tests."""

import pytest

from pgsync.base import Base
Expand Down
1 change: 1 addition & 0 deletions tests/test_search_client.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""SearchClient tests."""

import importlib

import elastic_transport
Expand Down
1 change: 1 addition & 0 deletions tests/test_settings.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for the settings module."""

import importlib

from pgsync import settings
Expand Down
1 change: 1 addition & 0 deletions tests/test_sync.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Sync tests."""

import importlib
import os
import typing as t
Expand Down
1 change: 1 addition & 0 deletions tests/test_sync_root.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for `pgsync` package."""

import mock
import pytest

Expand Down
1 change: 1 addition & 0 deletions tests/test_transform.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Transform tests."""

import pytest

from pgsync.constants import CONCAT_TRANSFORM, RENAME_TRANSFORM
Expand Down
1 change: 1 addition & 0 deletions tests/test_trigger.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Trigger tests."""

import pytest
import sqlalchemy as sa

Expand Down
1 change: 1 addition & 0 deletions tests/test_urls.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""URLS tests."""

import pytest
from mock import MagicMock, patch

Expand Down
1 change: 1 addition & 0 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Utils tests."""

import os
from urllib.parse import ParseResult, urlparse

Expand Down

0 comments on commit 56e9c13

Please sign in to comment.