Skip to content

Commit

Permalink
🎨 Renamed src to project folder
Browse files Browse the repository at this point in the history
  • Loading branch information
nikhilbadyal committed Sep 23, 2023
1 parent cfc623d commit ec067eb
Show file tree
Hide file tree
Showing 22 changed files with 44 additions and 44 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from click import Context, Parameter, ParamType
from click_params.miscellaneous import JsonParamType

from src.strings import invalid_query_format, invalid_sort_format
from esxport.strings import invalid_query_format, invalid_sort_format

if TYPE_CHECKING:
from typing_extensions import Self
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions src/elastic.py → esxport/elastic.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@

import elasticsearch

from src.constant import CONNECTION_TIMEOUT
from src.exceptions import ScrollExpiredError
from esxport.constant import CONNECTION_TIMEOUT
from esxport.exceptions import ScrollExpiredError

if TYPE_CHECKING:
from typing_extensions import Self

from src.click_opt.cli_options import CliOptions
from esxport.click_opt.cli_options import CliOptions


class ElasticsearchClient:
Expand Down
12 changes: 6 additions & 6 deletions src/esxport.py → esxport/esxport.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@
from tenacity import retry, retry_if_exception_type, stop_after_attempt, wait_exponential
from tqdm import tqdm

from src.constant import FLUSH_BUFFER, TIMES_TO_TRY
from src.exceptions import FieldNotFoundError, IndexNotFoundError, MetaFieldNotFoundError, ScrollExpiredError
from src.strings import index_not_found, meta_field_not_found, output_fields, sorting_by, using_indexes, using_query
from src.writer import Writer
from esxport.constant import FLUSH_BUFFER, TIMES_TO_TRY
from esxport.exceptions import FieldNotFoundError, IndexNotFoundError, MetaFieldNotFoundError, ScrollExpiredError
from esxport.strings import index_not_found, meta_field_not_found, output_fields, sorting_by, using_indexes, using_query
from esxport.writer import Writer

if TYPE_CHECKING:
from typing_extensions import Self

from src.click_opt.cli_options import CliOptions
from src.elastic import ElasticsearchClient
from esxport.click_opt.cli_options import CliOptions
from esxport.elastic import ElasticsearchClient


class EsXport(object):
Expand Down
14 changes: 7 additions & 7 deletions src/esxport_cli.py → esxport/esxport_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
from click import Context, Parameter
from click_params import URL

from src import esxport
from src.__init__ import __version__
from src.click_opt.cli_options import CliOptions
from src.click_opt.click_custom import JSON, sort
from src.constant import META_FIELDS
from src.elastic import ElasticsearchClient
from src.strings import cli_version
from esxport import esxport
from esxport.__init__ import __version__
from esxport.click_opt.cli_options import CliOptions
from esxport.click_opt.click_custom import JSON, sort
from esxport.constant import META_FIELDS
from esxport.elastic import ElasticsearchClient
from esxport.strings import cli_version

if TYPE_CHECKING:
from pathlib import Path
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ dependencies = [
Homepage = "https://github.com/nikhilbadyal/esxport"
Repository = "https://github.com/nikhilbadyal/esxport.git"
[project.scripts]
esxport = "src.esxport_cli:cli"
esxport = "esxport.esxport_cli:cli"


[tool.hatch.version]
path = "src/__init__.py"
path = "esxport/__init__.py"

[tool.ruff]
line-length = 120
Expand Down Expand Up @@ -95,7 +95,7 @@ warn_redundant_casts = true
warn_unused_configs = true

[tools.pytest]
pythonpath = ["src"]
pythonpath = ["esxport"]

[tool.pytest.ini_options]
addopts = "--cov=. --cov-report=xml --cov-report term-missing --ff -x --no-cov-on-fail --emoji -n4"
Expand Down
2 changes: 1 addition & 1 deletion test/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
import sys

sys.path.append(".")
sys.path.append("./src")
sys.path.append("./esxport")
10 changes: 5 additions & 5 deletions test/click/cli_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
from click.testing import CliRunner
from typing_extensions import Self

from src.__init__ import __version__
from src.esxport import EsXport
from src.esxport_cli import cli
from src.strings import cli_version, invalid_query_format, invalid_sort_format
from esxport.__init__ import __version__
from esxport.esxport import EsXport
from esxport.esxport_cli import cli
from esxport.strings import cli_version, invalid_query_format, invalid_sort_format

args = {
"q": '{"query":{"match_all":{}}}',
Expand All @@ -21,7 +21,7 @@
}
usage_error_code = 2
random_pass = "password\n" # noqa: S105
export_module = "src.esxport.EsXport"
export_module = "esxport.esxport.EsXport"


# noinspection PyTypeChecker
Expand Down
2 changes: 1 addition & 1 deletion test/click/click_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from typing_extensions import Self

from src.click_opt.cli_options import CliOptions
from esxport.click_opt.cli_options import CliOptions


class TestClick:
Expand Down
4 changes: 2 additions & 2 deletions test/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

import pytest

from src.click_opt.cli_options import CliOptions
from src.esxport import EsXport
from esxport.click_opt.cli_options import CliOptions
from esxport.esxport import EsXport


@pytest.fixture()
Expand Down
4 changes: 2 additions & 2 deletions test/esxport/_export_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
import pytest
from typing_extensions import Self

from src.esxport import EsXport
from esxport.esxport import EsXport


@patch("src.esxport.EsXport._validate_fields")
@patch("esxport.esxport.EsXport._validate_fields")
class TestExport:
"""Tests that the method exports the data with valid arguments."""

Expand Down
8 changes: 4 additions & 4 deletions test/esxport/_prepare_search_query_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@

import pytest

from src.exceptions import IndexNotFoundError
from src.strings import index_not_found, output_fields, sorting_by, using_indexes
from esxport.exceptions import IndexNotFoundError
from esxport.strings import index_not_found, output_fields, sorting_by, using_indexes

if TYPE_CHECKING:
from typing_extensions import Self

from src.esxport import EsXport
from esxport.esxport import EsXport


@patch("src.esxport.EsXport._validate_fields")
@patch("esxport.esxport.EsXport._validate_fields")
class TestSearchQuery:
"""Tests that a search query with valid input parameters is successful."""

Expand Down
4 changes: 2 additions & 2 deletions test/esxport/_validate_fields_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import pytest
from typing_extensions import Self

from src.esxport import EsXport
from src.exceptions import FieldNotFoundError
from esxport.esxport import EsXport
from esxport.exceptions import FieldNotFoundError


class TestValidateFields:
Expand Down
4 changes: 2 additions & 2 deletions test/esxport/retry_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
import pytest
from elasticsearch.exceptions import ConnectionError

from src.constant import TIMES_TO_TRY
from esxport.constant import TIMES_TO_TRY

if TYPE_CHECKING:
from unittest.mock import Mock

from typing_extensions import Self

from src.esxport import EsXport
from esxport.esxport import EsXport


class TestRetry:
Expand Down
8 changes: 4 additions & 4 deletions test/esxport/search_query_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
import pytest
from typing_extensions import Self

from src.esxport import EsXport
from src.exceptions import MetaFieldNotFoundError, ScrollExpiredError
from esxport.esxport import EsXport
from esxport.exceptions import MetaFieldNotFoundError, ScrollExpiredError


class TestVSearchQuery:
Expand Down Expand Up @@ -96,7 +96,7 @@ def test_data_is_flused_on_buffer_hit(
no_of_records = data["hits"]["total"]["value"]
flush_size = 1
with patch.object(esxport_obj_with_data, "_flush_to_file") as mock_flush_to_file, patch(
"src.esxport.FLUSH_BUFFER",
"esxport.esxport.FLUSH_BUFFER",
flush_size,
):
esxport_obj_with_data.search_query()
Expand All @@ -111,7 +111,7 @@ def test_function_exits_when_scroll_expire(self: Self, mocker: Mock, esxport_obj
"scroll",
side_effect=ScrollExpiredError("abc"),
)
with patch("src.esxport.FLUSH_BUFFER", flush_size), patch.object(esxport_obj_with_data, "num_results", 4):
with patch("esxport.esxport.FLUSH_BUFFER", flush_size), patch.object(esxport_obj_with_data, "num_results", 4):
esxport_obj_with_data.search_query()
assert Path(f"{esxport_obj_with_data.opts.output_file}.tmp").exists() is True
assert Path(esxport_obj_with_data.opts.output_file).exists() is False
Expand Down
2 changes: 1 addition & 1 deletion test/writer/csv_writer_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

from faker import Faker

from src.writer import Writer
from esxport.writer import Writer

if TYPE_CHECKING:
from typing_extensions import Self
Expand Down

0 comments on commit ec067eb

Please sign in to comment.