Skip to content

Commit 85cb99a

Browse files
committed
refactor(commands): move return codes to top level
make more easily accessible elsewhere
1 parent 0330774 commit 85cb99a

20 files changed

+21
-22
lines changed

compiler_admin/__init__.py

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
from importlib.metadata import version, PackageNotFoundError
22

3+
RESULT_SUCCESS = 0
4+
RESULT_FAILURE = 1
5+
36
try:
47
__version__ = version("compiler_admin")
58
except PackageNotFoundError:

compiler_admin/commands/__init__.py

-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +0,0 @@
1-
RESULT_SUCCESS = 0
2-
RESULT_FAILURE = 1

compiler_admin/commands/convert.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from argparse import Namespace
22

3-
from compiler_admin.commands import RESULT_SUCCESS, RESULT_FAILURE
3+
from compiler_admin import RESULT_SUCCESS, RESULT_FAILURE
44
from compiler_admin.services.google import (
55
GROUP_PARTNERS,
66
GROUP_STAFF,

compiler_admin/commands/create.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from argparse import Namespace
22
from typing import Sequence
33

4-
from compiler_admin.commands import RESULT_SUCCESS, RESULT_FAILURE
4+
from compiler_admin import RESULT_SUCCESS, RESULT_FAILURE
55
from compiler_admin.services.google import GROUP_TEAM, add_user_to_group, CallGAMCommand, user_account_name, user_exists
66

77

compiler_admin/commands/delete.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from argparse import Namespace
22

3-
from compiler_admin.commands import RESULT_SUCCESS, RESULT_FAILURE
3+
from compiler_admin import RESULT_SUCCESS, RESULT_FAILURE
44
from compiler_admin.services.google import CallGAMCommand, user_account_name, user_exists
55

66

compiler_admin/commands/info.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
from compiler_admin import __version__ as version
2-
from compiler_admin.commands import RESULT_SUCCESS, RESULT_FAILURE
1+
from compiler_admin import __version__ as version, RESULT_SUCCESS, RESULT_FAILURE
32
from compiler_admin.services.google import CallGAMCommand, CallGYBCommand
43

54

compiler_admin/commands/init.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from shutil import rmtree
55
import subprocess
66

7-
from compiler_admin.commands import RESULT_FAILURE, RESULT_SUCCESS
7+
from compiler_admin import RESULT_FAILURE, RESULT_SUCCESS
88
from compiler_admin.services.google import USER_ARCHIVE, CallGAMCommand
99

1010

compiler_admin/commands/offboard.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from argparse import Namespace
22
from tempfile import NamedTemporaryFile
33

4-
from compiler_admin.commands import RESULT_SUCCESS, RESULT_FAILURE
4+
from compiler_admin import RESULT_SUCCESS, RESULT_FAILURE
55
from compiler_admin.commands.delete import delete
66
from compiler_admin.commands.signout import signout
77
from compiler_admin.services.google import (

compiler_admin/commands/reset_password.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from argparse import Namespace
22

3-
from compiler_admin.commands import RESULT_SUCCESS, RESULT_FAILURE
3+
from compiler_admin import RESULT_SUCCESS, RESULT_FAILURE
44
from compiler_admin.commands.signout import signout
55
from compiler_admin.services.google import USER_HELLO, CallGAMCommand, user_account_name, user_exists
66

compiler_admin/commands/restore.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from argparse import Namespace
22
import pathlib
33

4-
from compiler_admin.commands import RESULT_SUCCESS, RESULT_FAILURE
4+
from compiler_admin import RESULT_SUCCESS, RESULT_FAILURE
55
from compiler_admin.services.google import USER_ARCHIVE, CallGYBCommand, user_account_name
66

77

compiler_admin/commands/signout.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from argparse import Namespace
22

3-
from compiler_admin.commands import RESULT_SUCCESS, RESULT_FAILURE
3+
from compiler_admin import RESULT_SUCCESS, RESULT_FAILURE
44
from compiler_admin.services.google import CallGAMCommand, user_account_name, user_exists
55

66

tests/commands/test_convert.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from argparse import Namespace
22
import pytest
33

4-
from compiler_admin.commands import RESULT_FAILURE, RESULT_SUCCESS
4+
from compiler_admin import RESULT_FAILURE, RESULT_SUCCESS
55
from compiler_admin.commands.convert import convert, __name__ as MODULE
66

77

tests/commands/test_create.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from argparse import Namespace
22
import pytest
33

4-
from compiler_admin.commands import RESULT_FAILURE, RESULT_SUCCESS
4+
from compiler_admin import RESULT_FAILURE, RESULT_SUCCESS
55
from compiler_admin.commands.create import create, __name__ as MODULE
66
from compiler_admin.services.google import USER_HELLO
77

tests/commands/test_delete.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from argparse import Namespace
22
import pytest
33

4-
from compiler_admin.commands import RESULT_FAILURE, RESULT_SUCCESS
4+
from compiler_admin import RESULT_FAILURE, RESULT_SUCCESS
55
from compiler_admin.commands.delete import delete, __name__ as MODULE
66

77

tests/commands/test_info.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import pytest
22

3-
from compiler_admin import __version__ as version
4-
from compiler_admin.commands import RESULT_SUCCESS
3+
from compiler_admin import __version__ as version, RESULT_SUCCESS
54
from compiler_admin.commands.info import info, __name__ as MODULE
65
from compiler_admin.services.google import DOMAIN
76

tests/commands/test_offboard.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from argparse import Namespace
22
import pytest
33

4-
from compiler_admin.commands import RESULT_FAILURE, RESULT_SUCCESS
4+
from compiler_admin import RESULT_FAILURE, RESULT_SUCCESS
55
from compiler_admin.commands.offboard import offboard, __name__ as MODULE
66

77

tests/commands/test_reset_password.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from argparse import Namespace
22
import pytest
33

4-
from compiler_admin.commands import RESULT_FAILURE, RESULT_SUCCESS
4+
from compiler_admin import RESULT_FAILURE, RESULT_SUCCESS
55
from compiler_admin.commands.reset_password import reset_password, __name__ as MODULE
66
from compiler_admin.services.google import USER_HELLO
77

tests/commands/test_restore.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from argparse import Namespace
22
import pytest
3-
from compiler_admin.commands import RESULT_FAILURE, RESULT_SUCCESS
43

4+
from compiler_admin import RESULT_FAILURE, RESULT_SUCCESS
55
from compiler_admin.commands.restore import restore, __name__ as MODULE
66

77

tests/commands/test_signout.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from argparse import Namespace
22
import pytest
33

4-
from compiler_admin.commands import RESULT_FAILURE, RESULT_SUCCESS
4+
from compiler_admin import RESULT_FAILURE, RESULT_SUCCESS
55
from compiler_admin.commands.signout import signout, __name__ as MODULE
66

77

tests/conftest.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import pytest
22

3-
from compiler_admin.commands import RESULT_SUCCESS
3+
from compiler_admin import RESULT_SUCCESS
44

55

66
@pytest.fixture

0 commit comments

Comments
 (0)