gibson-cli 0.1.2__py3-none-any.whl → 0.1.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- gibson/api/BaseApi.py +112 -0
- {api → gibson/api}/Cli.py +21 -59
- {bin → gibson/bin}/gibson.py +2 -2
- {command → gibson/command}/Api.py +5 -6
- {command → gibson/command}/Base.py +4 -5
- {command → gibson/command}/BaseCommand.py +2 -2
- {command → gibson/command}/Build.py +2 -3
- {command → gibson/command}/Code.py +12 -11
- {command → gibson/command}/Conf.py +1 -1
- {command → gibson/command}/Dev.py +2 -3
- {command → gibson/command}/Import.py +4 -5
- {command → gibson/command}/List.py +2 -3
- {command → gibson/command}/Merge.py +2 -3
- {command → gibson/command}/Model.py +4 -5
- {command → gibson/command}/Models.py +4 -5
- {command → gibson/command}/Modify.py +2 -3
- {command → gibson/command}/Module.py +2 -3
- {command → gibson/command}/New.py +2 -3
- {command → gibson/command}/OpenApi.py +2 -3
- {command → gibson/command}/Question.py +2 -3
- {command → gibson/command}/Remove.py +3 -4
- {command → gibson/command}/Rename.py +3 -4
- {command → gibson/command}/Rewrite.py +3 -3
- {command → gibson/command}/Schema.py +4 -5
- {command → gibson/command}/Schemas.py +4 -5
- {command → gibson/command}/Test.py +4 -5
- {command → gibson/command}/Tests.py +4 -5
- {command → gibson/command}/Version.py +2 -2
- {command → gibson/command}/WarGames.py +2 -3
- {command → gibson/command}/auth/Auth.py +3 -3
- gibson/command/auth/Login.py +20 -0
- {command → gibson/command}/auth/Logout.py +1 -1
- {command → gibson/command}/tests/test_command_BaseCommand.py +2 -2
- {command → gibson/command}/tests/test_command_Conf.py +2 -2
- {conf → gibson/conf}/Dev.py +4 -4
- {conf → gibson/conf}/tests/test_conf_Dependencies.py +1 -1
- {conf → gibson/conf}/tests/test_conf_Platform.py +1 -1
- {core → gibson/core}/CommandRouter.py +34 -34
- gibson/core/Completions.py +35 -0
- {core → gibson/core}/Configuration.py +24 -11
- {core → gibson/core}/Conversation.py +8 -5
- {core → gibson/core}/Env.py +2 -2
- {core → gibson/core}/Memory.py +1 -1
- gibson/data/bash-completion.tmpl +96 -0
- {db → gibson/db}/tests/test_db_TableExceptions.py +1 -1
- {dev → gibson/dev}/Dev.py +2 -11
- {display → gibson/display}/tests/test_display_Header.py +1 -1
- {display → gibson/display}/tests/test_display_WorkspaceFooter.py +1 -1
- {display → gibson/display}/tests/test_display_WorkspaceHeader.py +1 -1
- {lang → gibson/lang}/Python.py +1 -1
- {lang → gibson/lang}/tests/test_lang_Python.py +1 -1
- {services → gibson/services}/auth/Server.py +11 -6
- {services → gibson/services}/code/context/schema/EntityKeys.py +3 -3
- {services → gibson/services}/code/context/schema/Manager.py +2 -2
- {services → gibson/services}/code/context/schema/tests/test_code_context_schema_DataDictionary.py +1 -1
- {services → gibson/services}/code/context/schema/tests/test_code_context_schema_EntityKeys.py +4 -4
- {services → gibson/services}/code/context/schema/tests/test_code_context_schema_Manager.py +2 -2
- {services → gibson/services}/code/customization/Authenticator.py +2 -2
- {services → gibson/services}/code/customization/BaseCustomization.py +1 -1
- {services → gibson/services}/code/customization/CustomizationManager.py +2 -2
- {services → gibson/services}/code/customization/tests/test_code_customization_Authenticator.py +2 -2
- {services → gibson/services}/code/customization/tests/test_code_customization_BaseCustomization.py +2 -2
- {structure → gibson/structure}/Entity.py +2 -2
- {structure → gibson/structure}/keys/ForeignKey.py +1 -1
- {structure → gibson/structure}/keys/Index.py +1 -1
- {structure → gibson/structure}/keys/tests/test_ForeignKey.py +2 -2
- {structure → gibson/structure}/keys/tests/test_Index.py +1 -1
- {structure → gibson/structure}/keys/tests/test_IndexAttribute.py +1 -1
- {structure → gibson/structure}/testing.py +1 -1
- {structure → gibson/structure}/tests/test_Entity.py +5 -5
- gibson/tests/test_Env.py +14 -0
- gibson/tests/test_Memory.py +89 -0
- gibson/tests/test_utils.py +20 -0
- {gibson_cli-0.1.2.dist-info → gibson_cli-0.1.4.dist-info}/METADATA +1 -1
- gibson_cli-0.1.4.dist-info/RECORD +108 -0
- {gibson_cli-0.1.2.dist-info → gibson_cli-0.1.4.dist-info}/WHEEL +1 -1
- gibson_cli-0.1.4.dist-info/entry_points.txt +2 -0
- gibson_cli-0.1.4.dist-info/top_level.txt +1 -0
- api/BaseApi.py +0 -45
- command/auth/Login.py +0 -20
- gibson_cli-0.1.2.dist-info/RECORD +0 -103
- gibson_cli-0.1.2.dist-info/entry_points.txt +0 -2
- gibson_cli-0.1.2.dist-info/top_level.txt +0 -12
- {command → gibson/command}/Count.py +0 -0
- {command → gibson/command}/Forget.py +0 -0
- {command → gibson/command}/Show.py +0 -0
- {command → gibson/command}/Tree.py +0 -0
- {conf → gibson/conf}/Api.py +0 -0
- {conf → gibson/conf}/Code.py +0 -0
- {conf → gibson/conf}/Custom.py +0 -0
- {conf → gibson/conf}/Datastore.py +0 -0
- {conf → gibson/conf}/Dependencies.py +0 -0
- {conf → gibson/conf}/Frameworks.py +0 -0
- {conf → gibson/conf}/Modeler.py +0 -0
- {conf → gibson/conf}/Paths.py +0 -0
- {conf → gibson/conf}/Platform.py +0 -0
- {conf → gibson/conf}/Project.py +0 -0
- {conf → gibson/conf}/Version.py +0 -0
- {conf → gibson/conf}/dev/Api.py +0 -0
- {conf → gibson/conf}/dev/Base.py +0 -0
- {conf → gibson/conf}/dev/Model.py +0 -0
- {conf → gibson/conf}/dev/Schema.py +0 -0
- {core → gibson/core}/TimeKeeper.py +0 -0
- {core → gibson/core}/utils.py +0 -0
- {data → gibson/data}/default-ref-table.tmpl +0 -0
- {data → gibson/data}/default-table.tmpl +0 -0
- {db → gibson/db}/TableExceptions.py +0 -0
- {display → gibson/display}/Header.py +0 -0
- {display → gibson/display}/WorkspaceFooter.py +0 -0
- {display → gibson/display}/WorkspaceHeader.py +0 -0
- {services → gibson/services}/code/context/schema/DataDictionary.py +0 -0
- {structure → gibson/structure}/constraints/ReferenceConstraint.py +0 -0
- {structure → gibson/structure}/keys/IndexAttribute.py +0 -0
@@ -1,8 +1,8 @@
|
|
1
1
|
import sys
|
2
2
|
|
3
|
-
from
|
4
|
-
from .
|
5
|
-
from .
|
3
|
+
from gibson.command.auth.Login import Login
|
4
|
+
from gibson.command.auth.Logout import Logout
|
5
|
+
from gibson.command.BaseCommand import BaseCommand
|
6
6
|
|
7
7
|
|
8
8
|
class Auth(BaseCommand):
|
@@ -0,0 +1,20 @@
|
|
1
|
+
from gibson.api.BaseApi import BaseApi
|
2
|
+
from gibson.command.BaseCommand import BaseCommand
|
3
|
+
from gibson.services.auth.Server import Server as AuthServer
|
4
|
+
|
5
|
+
|
6
|
+
class Login(BaseCommand):
|
7
|
+
def execute(self):
|
8
|
+
api = BaseApi(self.configuration)
|
9
|
+
access_token, refresh_token = AuthServer(api.app_domain()).get_tokens()
|
10
|
+
|
11
|
+
if access_token is None or refresh_token is None:
|
12
|
+
self.conversation.newline()
|
13
|
+
self.conversation.type(
|
14
|
+
"Login failed, please try again with `gibson auth login`."
|
15
|
+
)
|
16
|
+
else:
|
17
|
+
self.configuration.set_auth_tokens(access_token, refresh_token)
|
18
|
+
self.conversation.type(f"Welcome! You are now logged in.")
|
19
|
+
|
20
|
+
self.conversation.newline()
|
{conf → gibson/conf}/Dev.py
RENAMED
@@ -1,9 +1,9 @@
|
|
1
1
|
import os
|
2
2
|
|
3
|
-
from conf.dev.Api import Api
|
4
|
-
from conf.dev.Base import Base
|
5
|
-
from conf.dev.Model import Model
|
6
|
-
from conf.dev.Schema import Schema
|
3
|
+
from gibson.conf.dev.Api import Api
|
4
|
+
from gibson.conf.dev.Base import Base
|
5
|
+
from gibson.conf.dev.Model import Model
|
6
|
+
from gibson.conf.dev.Schema import Schema
|
7
7
|
|
8
8
|
|
9
9
|
class Dev:
|
@@ -1,39 +1,39 @@
|
|
1
1
|
import sys
|
2
2
|
|
3
|
-
from command.Api import Api
|
4
|
-
from command.auth.Auth import Auth
|
5
|
-
from command.Base import Base
|
6
|
-
from command.Build import Build
|
7
|
-
from command.Code import Code
|
8
|
-
from command.Conf import Conf
|
9
|
-
from command.Count import Count
|
10
|
-
from command.Dev import Dev
|
11
|
-
from command.Forget import Forget
|
12
|
-
from command.Import import Import
|
13
|
-
from command.List import List
|
14
|
-
from command.Merge import Merge
|
15
|
-
from command.Model import Model
|
16
|
-
from command.Models import Models
|
17
|
-
from command.Modify import Modify
|
18
|
-
from command.Module import Module
|
19
|
-
from command.New import New
|
20
|
-
from command.OpenApi import OpenApi
|
21
|
-
from command.Question import Question
|
22
|
-
from command.Remove import Remove
|
23
|
-
from command.Rename import Rename
|
24
|
-
from command.Rewrite import Rewrite
|
25
|
-
from command.Schema import Schema
|
26
|
-
from command.Schemas import Schemas
|
27
|
-
from command.Show import Show
|
28
|
-
from command.Test import Test
|
29
|
-
from command.Tests import Tests
|
30
|
-
from command.Tree import Tree
|
31
|
-
from command.Version import Version
|
32
|
-
from command.WarGames import WarGames
|
33
|
-
from .Configuration import Configuration
|
34
|
-
from .Conversation import Conversation
|
35
|
-
from .Env import Env
|
36
|
-
from .Memory import Memory
|
3
|
+
from gibson.command.Api import Api
|
4
|
+
from gibson.command.auth.Auth import Auth
|
5
|
+
from gibson.command.Base import Base
|
6
|
+
from gibson.command.Build import Build
|
7
|
+
from gibson.command.Code import Code
|
8
|
+
from gibson.command.Conf import Conf
|
9
|
+
from gibson.command.Count import Count
|
10
|
+
from gibson.command.Dev import Dev
|
11
|
+
from gibson.command.Forget import Forget
|
12
|
+
from gibson.command.Import import Import
|
13
|
+
from gibson.command.List import List
|
14
|
+
from gibson.command.Merge import Merge
|
15
|
+
from gibson.command.Model import Model
|
16
|
+
from gibson.command.Models import Models
|
17
|
+
from gibson.command.Modify import Modify
|
18
|
+
from gibson.command.Module import Module
|
19
|
+
from gibson.command.New import New
|
20
|
+
from gibson.command.OpenApi import OpenApi
|
21
|
+
from gibson.command.Question import Question
|
22
|
+
from gibson.command.Remove import Remove
|
23
|
+
from gibson.command.Rename import Rename
|
24
|
+
from gibson.command.Rewrite import Rewrite
|
25
|
+
from gibson.command.Schema import Schema
|
26
|
+
from gibson.command.Schemas import Schemas
|
27
|
+
from gibson.command.Show import Show
|
28
|
+
from gibson.command.Test import Test
|
29
|
+
from gibson.command.Tests import Tests
|
30
|
+
from gibson.command.Tree import Tree
|
31
|
+
from gibson.command.Version import Version
|
32
|
+
from gibson.command.WarGames import WarGames
|
33
|
+
from gibson.core.Configuration import Configuration
|
34
|
+
from gibson.core.Conversation import Conversation
|
35
|
+
from gibson.core.Env import Env
|
36
|
+
from gibson.core.Memory import Memory
|
37
37
|
|
38
38
|
|
39
39
|
class CommandRouter:
|
@@ -0,0 +1,35 @@
|
|
1
|
+
import os
|
2
|
+
|
3
|
+
|
4
|
+
class Completions:
|
5
|
+
def __init__(self):
|
6
|
+
self.user_home = os.environ.get("HOME")
|
7
|
+
self.gibson_config = ".gibsonai"
|
8
|
+
|
9
|
+
def install(self):
|
10
|
+
completions_location = f"$HOME/{self.gibson_config}/bash_completion"
|
11
|
+
installation = f"""\n[ -s "{completions_location}" ] && \\. "{completions_location}" # Load gibson auto completion\n"""
|
12
|
+
|
13
|
+
with open(f"{self.user_home}/.bashrc", "r+") as f:
|
14
|
+
if completions_location not in f.read():
|
15
|
+
f.write(installation)
|
16
|
+
|
17
|
+
with open(f"{self.user_home}/.zshrc", "r+") as f:
|
18
|
+
if completions_location not in f.read():
|
19
|
+
f.write(installation)
|
20
|
+
|
21
|
+
return self
|
22
|
+
|
23
|
+
def write(self):
|
24
|
+
try:
|
25
|
+
file = os.path.dirname(__file__) + f"/../data/bash-completion.tmpl"
|
26
|
+
with open(file, "r") as f:
|
27
|
+
contents = f.read()
|
28
|
+
except FileNotFoundError:
|
29
|
+
return self
|
30
|
+
|
31
|
+
completions = f"{self.user_home}/{self.gibson_config}/bash_completion"
|
32
|
+
with open(completions, "w") as f:
|
33
|
+
f.write(contents)
|
34
|
+
|
35
|
+
return self
|
@@ -5,15 +5,12 @@ import shutil
|
|
5
5
|
import sys
|
6
6
|
import time
|
7
7
|
|
8
|
-
from conf.Dependencies import Dependencies
|
9
|
-
from conf.
|
10
|
-
from conf.
|
11
|
-
from conf.
|
12
|
-
from
|
13
|
-
from
|
14
|
-
from conf.Project import Project
|
15
|
-
from conf.Paths import ConfigPaths
|
16
|
-
from .Conversation import Conversation
|
8
|
+
from gibson.conf.Dependencies import Dependencies
|
9
|
+
from gibson.conf.Platform import Platform
|
10
|
+
from gibson.conf.Project import Project
|
11
|
+
from gibson.conf.Paths import ConfigPaths
|
12
|
+
from gibson.core.Completions import Completions
|
13
|
+
from gibson.core.Conversation import Conversation
|
17
14
|
|
18
15
|
|
19
16
|
class Configuration:
|
@@ -38,6 +35,8 @@ class Configuration:
|
|
38
35
|
|
39
36
|
self.read_config()
|
40
37
|
|
38
|
+
Completions().write().install()
|
39
|
+
|
41
40
|
def append_project_to_conf(self, project_name, project_description):
|
42
41
|
self.project.api.key = "FIXME"
|
43
42
|
self.project.name = project_name
|
@@ -270,6 +269,16 @@ class Configuration:
|
|
270
269
|
|
271
270
|
def get_my_settings(self):
|
272
271
|
return self.settings[self.project.name]
|
272
|
+
|
273
|
+
def get_refresh_token(self):
|
274
|
+
try:
|
275
|
+
with open(f"{self.paths.auth}/{self.API_ENV}", "r") as f:
|
276
|
+
contents = f.read()
|
277
|
+
except FileNotFoundError:
|
278
|
+
return None
|
279
|
+
|
280
|
+
token = json.loads(contents)
|
281
|
+
return token["refresh_token"]
|
273
282
|
|
274
283
|
def initialize(self):
|
275
284
|
self.conversation.message_welcome()
|
@@ -351,14 +360,18 @@ class Configuration:
|
|
351
360
|
|
352
361
|
return self
|
353
362
|
|
354
|
-
def
|
363
|
+
def set_auth_tokens(self, access_token, refresh_token):
|
355
364
|
try:
|
356
365
|
os.mkdir(self.paths.auth)
|
357
366
|
except FileExistsError:
|
358
367
|
pass
|
359
368
|
|
360
369
|
with open(f"{self.paths.auth}/{self.API_ENV}", "w") as f:
|
361
|
-
f.write(
|
370
|
+
f.write(
|
371
|
+
json.dumps(
|
372
|
+
{"access_token": access_token, "refresh_token": refresh_token}
|
373
|
+
)
|
374
|
+
)
|
362
375
|
|
363
376
|
def set_config_paths(self, ignore_env_vars=False):
|
364
377
|
user_home = os.environ.get("HOME")
|
@@ -5,7 +5,7 @@ import time
|
|
5
5
|
|
6
6
|
import pyfiglet
|
7
7
|
|
8
|
-
from conf.Version import Version
|
8
|
+
from gibson.conf.Version import Version
|
9
9
|
|
10
10
|
|
11
11
|
class Conversation:
|
@@ -234,10 +234,13 @@ class Conversation:
|
|
234
234
|
if self.__delay is not None:
|
235
235
|
delay = self.__delay
|
236
236
|
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
237
|
+
try:
|
238
|
+
for char in message:
|
239
|
+
sys.stdout.write(char)
|
240
|
+
sys.stdout.flush()
|
241
|
+
time.sleep(delay)
|
242
|
+
except KeyboardInterrupt:
|
243
|
+
exit(1)
|
241
244
|
|
242
245
|
def unmute(self):
|
243
246
|
self.__mute = False
|
{core → gibson/core}/Env.py
RENAMED
{core → gibson/core}/Memory.py
RENAMED
@@ -0,0 +1,96 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
|
3
|
+
# bash completion for Gibson CLI
|
4
|
+
|
5
|
+
if ! command -v gibson &>/dev/null; then
|
6
|
+
return
|
7
|
+
fi
|
8
|
+
|
9
|
+
__gibson_generate_completion() {
|
10
|
+
declare current_word
|
11
|
+
current_word="${COMP_WORDS[COMP_CWORD]}"
|
12
|
+
# shellcheck disable=SC2207
|
13
|
+
COMPREPLY=($(compgen -W "$1" -- "${current_word}"))
|
14
|
+
return 0
|
15
|
+
}
|
16
|
+
|
17
|
+
__gibson_commands_and_options() {
|
18
|
+
declare current_word
|
19
|
+
declare command
|
20
|
+
|
21
|
+
current_word="${COMP_WORDS[COMP_CWORD]}"
|
22
|
+
COMMANDS='
|
23
|
+
auth
|
24
|
+
build
|
25
|
+
code
|
26
|
+
conf
|
27
|
+
count
|
28
|
+
create
|
29
|
+
dev
|
30
|
+
forget
|
31
|
+
help
|
32
|
+
import
|
33
|
+
list
|
34
|
+
merge
|
35
|
+
model
|
36
|
+
modify
|
37
|
+
new
|
38
|
+
openapi
|
39
|
+
project
|
40
|
+
question
|
41
|
+
remove
|
42
|
+
rename
|
43
|
+
rewrite
|
44
|
+
schema
|
45
|
+
show
|
46
|
+
test
|
47
|
+
tree
|
48
|
+
q
|
49
|
+
'
|
50
|
+
|
51
|
+
case "${current_word}" in
|
52
|
+
-*) __gibson_options ;;
|
53
|
+
*) __gibson_generate_completion "${COMMANDS}" ;;
|
54
|
+
esac
|
55
|
+
}
|
56
|
+
|
57
|
+
__gibson_options() {
|
58
|
+
OPTIONS='--version -v'
|
59
|
+
__gibson_generate_completion "${OPTIONS}"
|
60
|
+
}
|
61
|
+
|
62
|
+
__gibson_completions() {
|
63
|
+
declare previous_word
|
64
|
+
previous_word="${COMP_WORDS[COMP_CWORD - 1]}"
|
65
|
+
|
66
|
+
case "${previous_word}" in
|
67
|
+
gibson) __gibson_commands_and_options ;;
|
68
|
+
auth) __gibson_generate_completion "login logout" ;;
|
69
|
+
# config) __gibson_generate_completion "set get" ;;
|
70
|
+
# create) __gibson_generate_completion "project module entity" ;;
|
71
|
+
# new) __gibson_generate_completion "project module entity" ;;
|
72
|
+
# project) __gibson_generate_completion "create delete list" ;;
|
73
|
+
# rename) __gibson_generate_completion "entity" ;;
|
74
|
+
# rewrite) __gibson_generate_completion "api base models schemas tests" ;;
|
75
|
+
esac
|
76
|
+
|
77
|
+
return 0
|
78
|
+
}
|
79
|
+
|
80
|
+
# complete is a bash builtin, but recent versions of ZSH come with a function
|
81
|
+
# called bashcompinit that will create a complete in ZSH. If the user is in
|
82
|
+
# ZSH, load and run bashcompinit before calling the complete function.
|
83
|
+
if [[ -n ${ZSH_VERSION-} ]]; then
|
84
|
+
# First calling compinit (only if not called yet!)
|
85
|
+
# and then bashcompinit as mentioned by zsh man page.
|
86
|
+
if ! command -v compinit >/dev/null; then
|
87
|
+
autoload -U +X compinit && if [[ ${ZSH_DISABLE_COMPFIX-} = true ]]; then
|
88
|
+
compinit -u
|
89
|
+
else
|
90
|
+
compinit
|
91
|
+
fi
|
92
|
+
fi
|
93
|
+
autoload -U +X bashcompinit && bashcompinit
|
94
|
+
fi
|
95
|
+
|
96
|
+
complete -o default -F __gibson_completions gibson
|
{dev → gibson/dev}/Dev.py
RENAMED
@@ -1,7 +1,7 @@
|
|
1
1
|
import os
|
2
2
|
|
3
|
-
from core.Configuration import Configuration
|
4
|
-
from core.utils import (
|
3
|
+
from gibson.core.Configuration import Configuration
|
4
|
+
from gibson.core.utils import (
|
5
5
|
utils_entity_name_to_class_name,
|
6
6
|
utils_extract_module_name,
|
7
7
|
utils_is_ref_table,
|
@@ -18,15 +18,6 @@ class Dev:
|
|
18
18
|
f"{self.configuration.project.dev.api.version}/{file_name}",
|
19
19
|
code,
|
20
20
|
)
|
21
|
-
|
22
|
-
if file_name == "authenticators/DenyAll.py":
|
23
|
-
self.link(
|
24
|
-
os.path.expandvars(self.configuration.project.dev.api.path),
|
25
|
-
self.configuration.project.dev.api.version
|
26
|
-
+ "/authenticators/DenyAll.py",
|
27
|
-
self.configuration.project.dev.api.version + "/Authenticator.py",
|
28
|
-
)
|
29
|
-
|
30
21
|
return self
|
31
22
|
|
32
23
|
def base_component(self, file_name, code):
|
{lang → gibson/lang}/Python.py
RENAMED
@@ -27,7 +27,7 @@ class Python:
|
|
27
27
|
|
28
28
|
os_path = os.path.expandvars(os_path)
|
29
29
|
|
30
|
-
pythonpath = os.environ
|
30
|
+
pythonpath = os.environ.get("PYTHONPATH", "").split(":")
|
31
31
|
for entry in pythonpath:
|
32
32
|
path = os_path.replace(entry, "")
|
33
33
|
if path != os_path:
|
@@ -11,10 +11,14 @@ class Handler(BaseHTTPRequestHandler):
|
|
11
11
|
def do_GET(self):
|
12
12
|
url = urlparse(self.path)
|
13
13
|
params = parse_qs(url.query)
|
14
|
-
|
14
|
+
access_token = params.get("access_token", [""])[0]
|
15
|
+
refresh_token = params.get("refresh_token", [""])[0]
|
15
16
|
|
16
|
-
if
|
17
|
-
self.server.
|
17
|
+
if access_token and access_token != "null":
|
18
|
+
self.server.access_token = access_token
|
19
|
+
|
20
|
+
if refresh_token and refresh_token != "null":
|
21
|
+
self.server.refresh_token = refresh_token
|
18
22
|
|
19
23
|
self.send_response(302)
|
20
24
|
self.send_header("Location", f"{self.server.app_domain}/chat")
|
@@ -29,7 +33,8 @@ class Handler(BaseHTTPRequestHandler):
|
|
29
33
|
# Temporary HTTP server to handle the login process
|
30
34
|
class Server(HTTPServer):
|
31
35
|
port = None
|
32
|
-
|
36
|
+
access_token = None
|
37
|
+
refresh_token = None
|
33
38
|
thread = None
|
34
39
|
|
35
40
|
def __init__(self, app_domain: str):
|
@@ -40,7 +45,7 @@ class Server(HTTPServer):
|
|
40
45
|
|
41
46
|
self.app_domain = app_domain
|
42
47
|
|
43
|
-
def
|
48
|
+
def get_tokens(self):
|
44
49
|
self._start()
|
45
50
|
self._open_browser()
|
46
51
|
|
@@ -50,7 +55,7 @@ class Server(HTTPServer):
|
|
50
55
|
except KeyboardInterrupt:
|
51
56
|
self._stop()
|
52
57
|
|
53
|
-
return self.
|
58
|
+
return self.access_token, self.refresh_token
|
54
59
|
|
55
60
|
def _open_browser(self):
|
56
61
|
webbrowser.open(f"{self.app_domain}/signup?cli={self.port}")
|
@@ -1,6 +1,6 @@
|
|
1
|
-
from structure.constraints.ReferenceConstraint import ReferenceConstraint
|
2
|
-
from structure.keys.ForeignKey import ForeignKey
|
3
|
-
from structure.keys.Index import Index
|
1
|
+
from gibson.structure.constraints.ReferenceConstraint import ReferenceConstraint
|
2
|
+
from gibson.structure.keys.ForeignKey import ForeignKey
|
3
|
+
from gibson.structure.keys.Index import Index
|
4
4
|
|
5
5
|
|
6
6
|
class EntityKeys:
|
@@ -1,5 +1,5 @@
|
|
1
|
-
from services.code.context.schema.DataDictionary import DataDictionary
|
2
|
-
from services.code.context.schema.EntityKeys import EntityKeys
|
1
|
+
from gibson.services.code.context.schema.DataDictionary import DataDictionary
|
2
|
+
from gibson.services.code.context.schema.EntityKeys import EntityKeys
|
3
3
|
|
4
4
|
|
5
5
|
class Manager:
|
{services → gibson/services}/code/context/schema/tests/test_code_context_schema_EntityKeys.py
RENAMED
@@ -1,7 +1,7 @@
|
|
1
|
-
from services.code.context.schema.EntityKeys import EntityKeys
|
2
|
-
from structure.constraints.ReferenceConstraint import ReferenceConstraint
|
3
|
-
from structure.keys.ForeignKey import ForeignKey
|
4
|
-
from structure.keys.Index import Index
|
1
|
+
from gibson.services.code.context.schema.EntityKeys import EntityKeys
|
2
|
+
from gibson.structure.constraints.ReferenceConstraint import ReferenceConstraint
|
3
|
+
from gibson.structure.keys.ForeignKey import ForeignKey
|
4
|
+
from gibson.structure.keys.Index import Index
|
5
5
|
|
6
6
|
|
7
7
|
def test_best_sql_foreign_key_no_match():
|
@@ -1,5 +1,5 @@
|
|
1
|
-
from services.code.context.schema.EntityKeys import EntityKeys
|
2
|
-
from services.code.context.schema.Manager import Manager
|
1
|
+
from gibson.services.code.context.schema.EntityKeys import EntityKeys
|
2
|
+
from gibson.services.code.context.schema.Manager import Manager
|
3
3
|
|
4
4
|
|
5
5
|
def test_get_entity_keys_no_such_entity_name():
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import os
|
2
2
|
|
3
|
-
from core.Configuration import Configuration
|
4
|
-
from services.code.customization.BaseCustomization import BaseCustomization
|
3
|
+
from gibson.core.Configuration import Configuration
|
4
|
+
from gibson.services.code.customization.BaseCustomization import BaseCustomization
|
5
5
|
|
6
6
|
|
7
7
|
class Authenticator(BaseCustomization):
|
@@ -1,5 +1,5 @@
|
|
1
|
-
from core.Configuration import Configuration
|
2
|
-
from services.code.customization.Authenticator import Authenticator
|
1
|
+
from gibson.core.Configuration import Configuration
|
2
|
+
from gibson.services.code.customization.Authenticator import Authenticator
|
3
3
|
|
4
4
|
|
5
5
|
class CustomizationManager:
|
{services → gibson/services}/code/customization/tests/test_code_customization_Authenticator.py
RENAMED
@@ -1,8 +1,8 @@
|
|
1
1
|
import os
|
2
2
|
import shutil
|
3
3
|
|
4
|
-
from core.Configuration import Configuration
|
5
|
-
from services.code.customization.Authenticator import Authenticator
|
4
|
+
from gibson.core.Configuration import Configuration
|
5
|
+
from gibson.services.code.customization.Authenticator import Authenticator
|
6
6
|
|
7
7
|
|
8
8
|
def test_link_target():
|
{services → gibson/services}/code/customization/tests/test_code_customization_BaseCustomization.py
RENAMED
@@ -1,7 +1,7 @@
|
|
1
1
|
import pytest
|
2
2
|
|
3
|
-
from core.Configuration import Configuration
|
4
|
-
from services.code.customization.BaseCustomization import BaseCustomization
|
3
|
+
from gibson.core.Configuration import Configuration
|
4
|
+
from gibson.services.code.customization.BaseCustomization import BaseCustomization
|
5
5
|
|
6
6
|
|
7
7
|
def test_preserve_exception():
|