Skip to content

Commit

Permalink
rename imports
Browse files Browse the repository at this point in the history
  • Loading branch information
pc-m committed Jul 18, 2024
1 parent bc65a9d commit abac82e
Show file tree
Hide file tree
Showing 36 changed files with 150 additions and 139 deletions.
2 changes: 1 addition & 1 deletion debian/rules
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/make -f
# -*- makefile -*-

export PYBUILD_NAME=xivo
export PYBUILD_NAME=wazo
export PYBUILD_DESTDIR_python3=debian/xivo-lib-python-python3/
export PYBUILD_DISABLE=test

Expand Down
4 changes: 2 additions & 2 deletions integration_tests/assets/bin/myservice.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
# Copyright 2016-2023 The Wazo Authors (see the AUTHORS file)
# Copyright 2016-2024 The Wazo Authors (see the AUTHORS file)
# SPDX-License-Identifier: GPL-3.0-or-later
from __future__ import annotations

Expand All @@ -13,7 +13,7 @@
import requests
from flask import Flask, Response, jsonify

from xivo.consul_helpers import ServiceCatalogRegistration
from wazo.consul_helpers import ServiceCatalogRegistration

UUID = 'foobar'

Expand Down
4 changes: 2 additions & 2 deletions integration_tests/assets/bin/thread-exception.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#!/usr/bin/env python3
# Copyright 2018-2023 The Wazo Authors (see the AUTHORS file)
# Copyright 2018-2024 The Wazo Authors (see the AUTHORS file)
# SPDX-License-Identifier: GPL-3.0-or-later
from __future__ import annotations

import threading
import time
from typing import NoReturn

from xivo import xivo_logging
from wazo import xivo_logging

xivo_logging.setup_logging('/dev/null')

Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[tool:pytest]
testpaths=xivo
testpaths=wazo
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#!/usr/bin/env python3
# Copyright 2007-2023 The Wazo Authors (see the AUTHORS file)
# Copyright 2007-2024 The Wazo Authors (see the AUTHORS file)
# SPDX-License-Identifier: GPL-3.0-or-later

from setuptools import find_packages, setup

setup(
name='xivo',
name='wazo',
version='1.0',
description='These are useful python libraries to be used with XIVO code',
description='These are useful python libraries to be used with Wazo code',
author='Wazo Authors',
author_email='[email protected]',
url='http://wazo.community',
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ envlist = py39, linters

[testenv]
commands =
pytest --junitxml=unit-tests.xml --cov=xivo --cov-report term --cov-report xml:coverage.xml xivo {posargs}
pytest --junitxml=unit-tests.xml --cov=wazo --cov-report term --cov-report xml:coverage.xml wazo {posargs}
deps =
-rrequirements.txt
-rtest-requirements.txt
Expand Down
4 changes: 2 additions & 2 deletions wazo/agitb.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2013-2023 The Wazo Authors (see the AUTHORS file)
# Copyright 2013-2024 The Wazo Authors (see the AUTHORS file)
# SPDX-License-Identifier: GPL-3.0-or-later

"""More comprehensive traceback formatting for AGI in Python.
Expand Down Expand Up @@ -53,7 +53,7 @@
from typing import TYPE_CHECKING, Any, Callable, NamedTuple, NewType, TextIO

if TYPE_CHECKING:
from xivo.agi import AGI
from wazo.agi import AGI

Undefined = NewType('Undefined', list[str])

Expand Down
4 changes: 2 additions & 2 deletions wazo/cli/command/exit.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Copyright 2013-2023 The Wazo Authors (see the AUTHORS file)
# Copyright 2013-2024 The Wazo Authors (see the AUTHORS file)
# SPDX-License-Identifier: GPL-3.0-or-later
from __future__ import annotations

from typing import NoReturn

from xivo.cli.command.base import BaseCommand
from wazo.cli.command.base import BaseCommand


class ExitCommand(BaseCommand):
Expand Down
6 changes: 3 additions & 3 deletions wazo/cli/command/help.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Copyright 2013-2023 The Wazo Authors (see the AUTHORS file)
# Copyright 2013-2024 The Wazo Authors (see the AUTHORS file)
# SPDX-License-Identifier: GPL-3.0-or-later
from __future__ import annotations

from operator import attrgetter
from typing import TYPE_CHECKING

from xivo.cli.command.base import BaseCommand
from xivo.cli.exception import NoMatchingCommandError
from wazo.cli.command.base import BaseCommand
from wazo.cli.exception import NoMatchingCommandError

if TYPE_CHECKING:
from ..registry import CommandRegistry
Expand Down
4 changes: 2 additions & 2 deletions wazo/cli/command/unknown.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Copyright 2017-2023 The Wazo Authors (see the AUTHORS file)
# Copyright 2017-2024 The Wazo Authors (see the AUTHORS file)
# SPDX-License-Identifier: GPL-3.0-or-later
from __future__ import annotations

from typing import NoReturn

from xivo.cli.command.base import BaseCommand
from wazo.cli.command.base import BaseCommand


class _BaseUnknownCommand(BaseCommand):
Expand Down
7 changes: 4 additions & 3 deletions wazo/cli/completion/tests/test_completer.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# Copyright 2013-2023 The Wazo Authors (see the AUTHORS file)
# Copyright 2013-2024 The Wazo Authors (see the AUTHORS file)
# SPDX-License-Identifier: GPL-3.0-or-later
from __future__ import annotations

import unittest
from unittest.mock import Mock

from hamcrest import assert_that, equal_to
from xivo.cli.completion.completer import CommandLineCompleter
from xivo.cli.registry import CommandRegistry

from wazo.cli.completion.completer import CommandLineCompleter
from wazo.cli.registry import CommandRegistry


class TestCompleter(unittest.TestCase):
Expand Down
4 changes: 2 additions & 2 deletions wazo/cli/executor.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Copyright 2013-2023 The Wazo Authors (see the AUTHORS file)
# Copyright 2013-2024 The Wazo Authors (see the AUTHORS file)
# SPDX-License-Identifier: GPL-3.0-or-later
from __future__ import annotations

from collections.abc import Iterable
from typing import TYPE_CHECKING

from xivo.cli.exception import UsageError
from wazo.cli.exception import UsageError

if TYPE_CHECKING:
from .command.base import BaseCommand
Expand Down
24 changes: 12 additions & 12 deletions wazo/cli/facade.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
# Copyright 2013-2023 The Wazo Authors (see the AUTHORS file)
# Copyright 2013-2024 The Wazo Authors (see the AUTHORS file)
# SPDX-License-Identifier: GPL-3.0-or-later
from __future__ import annotations

import os.path
import sys
from typing import TYPE_CHECKING

from xivo.cli import history
from xivo.cli.command.exit import ExitCommand
from xivo.cli.command.help import HelpCommand
from xivo.cli.command.unknown import PrintingUnknownCommand, _BaseUnknownCommand
from xivo.cli.completion.completer import CommandLineCompleter
from xivo.cli.completion.readline import ReadlineCompletionHelper
from xivo.cli.errorhandler import PrintTracebackErrorHandler, ReRaiseErrorHandler
from xivo.cli.executor import Executor
from xivo.cli.parser import RawCommandLineParser
from xivo.cli.registry import CommandRegistry
from xivo.cli.source.input import InputRawCommandLineSource
from wazo.cli import history
from wazo.cli.command.exit import ExitCommand
from wazo.cli.command.help import HelpCommand
from wazo.cli.command.unknown import PrintingUnknownCommand, _BaseUnknownCommand
from wazo.cli.completion.completer import CommandLineCompleter
from wazo.cli.completion.readline import ReadlineCompletionHelper
from wazo.cli.errorhandler import PrintTracebackErrorHandler, ReRaiseErrorHandler
from wazo.cli.executor import Executor
from wazo.cli.parser import RawCommandLineParser
from wazo.cli.registry import CommandRegistry
from wazo.cli.source.input import InputRawCommandLineSource

if TYPE_CHECKING:
from .command.base import BaseCommand
Expand Down
6 changes: 3 additions & 3 deletions wazo/cli/parser.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Copyright 2013-2023 The Wazo Authors (see the AUTHORS file)
# Copyright 2013-2024 The Wazo Authors (see the AUTHORS file)
# SPDX-License-Identifier: GPL-3.0-or-later
from __future__ import annotations

from typing import TYPE_CHECKING

from xivo.cli.commandline import CommandLine
from xivo.cli.exception import NoMatchingCommandError
from wazo.cli.commandline import CommandLine
from wazo.cli.exception import NoMatchingCommandError

if TYPE_CHECKING:
from .registry import CommandRegistry
Expand Down
4 changes: 2 additions & 2 deletions wazo/cli/registry.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Copyright 2013-2023 The Wazo Authors (see the AUTHORS file)
# Copyright 2013-2024 The Wazo Authors (see the AUTHORS file)
# SPDX-License-Identifier: GPL-3.0-or-later
from __future__ import annotations

from collections.abc import Sequence
from typing import TYPE_CHECKING, Any

from xivo.cli.exception import CommandAlreadyRegisteredError, NoMatchingCommandError
from wazo.cli.exception import CommandAlreadyRegisteredError, NoMatchingCommandError

if TYPE_CHECKING:
from .command.base import BaseCommand
Expand Down
9 changes: 5 additions & 4 deletions wazo/cli/tests/test_parser.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
# Copyright 2013-2023 The Wazo Authors (see the AUTHORS file)
# Copyright 2013-2024 The Wazo Authors (see the AUTHORS file)
# SPDX-License-Identifier: GPL-3.0-or-later


import unittest
from unittest.mock import Mock

from hamcrest import assert_that, equal_to, none
from xivo.cli.exception import NoMatchingCommandError
from xivo.cli.parser import RawCommandLineParser
from xivo.cli.registry import CommandRegistry

from wazo.cli.exception import NoMatchingCommandError
from wazo.cli.parser import RawCommandLineParser
from wazo.cli.registry import CommandRegistry


class TestRawCommandLineParser(unittest.TestCase):
Expand Down
7 changes: 4 additions & 3 deletions wazo/cli/tests/test_registry.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# Copyright 2013-2023 The Wazo Authors (see the AUTHORS file)
# Copyright 2013-2024 The Wazo Authors (see the AUTHORS file)
# SPDX-License-Identifier: GPL-3.0-or-later


import unittest
from unittest.mock import Mock

from hamcrest import assert_that, contains_inanyorder, equal_to
from xivo.cli.exception import CommandAlreadyRegisteredError, NoMatchingCommandError
from xivo.cli.registry import CommandRegistry

from wazo.cli.exception import CommandAlreadyRegisteredError, NoMatchingCommandError
from wazo.cli.registry import CommandRegistry


class TestCommandRegistry(unittest.TestCase):
Expand Down
4 changes: 2 additions & 2 deletions wazo/cli/tests/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Copyright 2013-2023 The Wazo Authors (see the AUTHORS file)
# Copyright 2013-2024 The Wazo Authors (see the AUTHORS file)
# SPDX-License-Identifier: GPL-3.0-or-later


import unittest

from xivo.cli.utils import compute_ids
from wazo.cli.utils import compute_ids


class TestComputeIDs(unittest.TestCase):
Expand Down
4 changes: 2 additions & 2 deletions wazo/cli/utils.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Copyright 2013-2023 The Wazo Authors (see the AUTHORS file)
# Copyright 2013-2024 The Wazo Authors (see the AUTHORS file)
# SPDX-License-Identifier: GPL-3.0-or-later
from __future__ import annotations

import functools
from typing import Any, Callable, TypeVar

from xivo.cli.exception import UsageError
from wazo.cli.exception import UsageError

R = TypeVar('R')

Expand Down
19 changes: 10 additions & 9 deletions wazo/flask/tests/test_auth_verifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
from unittest.mock import sentinel as s

import pytest
from xivo.auth_verifier import Unauthorized, no_auth, required_acl, required_tenant
from xivo.http_exceptions import InvalidTokenAPIException

from wazo.auth_verifier import Unauthorized, no_auth, required_acl, required_tenant
from wazo.http_exceptions import InvalidTokenAPIException

from ..auth_verifier import AuthVerifierFlask

Expand All @@ -32,11 +33,11 @@ def decorated():
return s.result

with patch(
'xivo.flask.auth_verifier.extract_tenant_id_from_header',
'wazo.flask.auth_verifier.extract_tenant_id_from_header',
tenant_extractor,
):
with patch('xivo.flask.auth_verifier.g', mock_g):
with patch('xivo.tenant_flask_helpers.g', mock_g):
with patch('wazo.flask.auth_verifier.g', mock_g):
with patch('wazo.tenant_flask_helpers.g', mock_g):
result = decorated()

assert result == s.result
Expand Down Expand Up @@ -70,8 +71,8 @@ def test_verify_tenant_decorator(self):
def decorated():
return s.result

with patch('xivo.flask.auth_verifier.g', mock_g):
with patch('xivo.tenant_flask_helpers.g', mock_g):
with patch('wazo.flask.auth_verifier.g', mock_g):
with patch('wazo.tenant_flask_helpers.g', mock_g):
result = decorated()

assert result == s.result
Expand Down Expand Up @@ -107,8 +108,8 @@ def test_verify_tenant_when_invalid_token(self):
def decorated():
return s.result

with patch('xivo.flask.auth_verifier.g', mock_g):
with patch('xivo.tenant_flask_helpers.g', mock_g):
with patch('wazo.flask.auth_verifier.g', mock_g):
with patch('wazo.tenant_flask_helpers.g', mock_g):
with pytest.raises(Unauthorized) as exc_info:
decorated()

Expand Down
3 changes: 2 additions & 1 deletion wazo/http_exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
from __future__ import annotations

import requests
from xivo import rest_api_helpers

from wazo import rest_api_helpers


class Unauthorized(rest_api_helpers.APIException):
Expand Down
3 changes: 2 additions & 1 deletion wazo/tenant_flask_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
from flask import current_app, g
from wazo_auth_client import Client as AuthClient
from werkzeug.local import LocalProxy
from xivo.tenant_helpers import Token, User

from wazo.tenant_helpers import Token, User

from . import tenant_helpers

Expand Down
5 changes: 3 additions & 2 deletions wazo/tenant_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
from typing import TYPE_CHECKING, Any, TypeVar

import requests
from xivo import rest_api_helpers
from xivo.http_exceptions import AuthServerUnreachable, InvalidTokenAPIException

from wazo import rest_api_helpers
from wazo.http_exceptions import AuthServerUnreachable, InvalidTokenAPIException

# Necessary to avoid a dependency in provd
try:
Expand Down
7 changes: 4 additions & 3 deletions wazo/tests/test_caller_id.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# Copyright 2013-2023 The Wazo Authors (see the AUTHORS file)
# Copyright 2013-2024 The Wazo Authors (see the AUTHORS file)
# SPDX-License-Identifier: GPL-3.0-or-later

import unittest

from hamcrest import assert_that, equal_to
from xivo import caller_id
from xivo.caller_id import extract_displayname, extract_number, is_complete_caller_id

from wazo import caller_id
from wazo.caller_id import extract_displayname, extract_number, is_complete_caller_id


class TestCallerID(unittest.TestCase):
Expand Down
Loading

0 comments on commit abac82e

Please sign in to comment.