Skip to content

Commit

Permalink
fix: jans-cli DocString (ref: #2572)
Browse files Browse the repository at this point in the history
  • Loading branch information
AbdelwahabAdam committed Nov 29, 2022
1 parent 54cb7d5 commit b381ee5
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 86 deletions.
4 changes: 2 additions & 2 deletions jans-cli-tui/cli_tui/plugins/010_oxauth/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ def init_plugin(self) -> None:
self.schema = self.app.cli_object.get_schema_from_reference('', '#/components/schemas/AppConfiguration')

async def get_appconfiguration(self) -> None:
"""Coroutine for getting application configuration.
"""
'Coroutine for getting application configuration.'

cli_args = {'operation_id': 'get-properties'}
response = await self.app.loop.run_in_executor(self.app.executor, self.app.cli_requests, cli_args)

Expand Down
28 changes: 10 additions & 18 deletions jans-cli-tui/cli_tui/plugins/020_fido/main.py
Original file line number Diff line number Diff line change
@@ -1,29 +1,18 @@
import os
import sys
import asyncio
import time

from collections import OrderedDict
from functools import partial
from typing import Any

from prompt_toolkit.application.current import get_app
from prompt_toolkit.layout.containers import HSplit, DynamicContainer, VSplit, Window
from prompt_toolkit.layout.dimension import D
from prompt_toolkit.widgets import Button, Label, Frame, Box, Dialog
from prompt_toolkit.widgets import Button, Label, Box, Dialog
from prompt_toolkit.application import Application

from wui_components.jans_nav_bar import JansNavBar
from wui_components.jans_drop_down import DropDownWidget
from wui_components.jans_vetrical_nav import JansVerticalNav
from wui_components.jans_cli_dialog import JansGDialog


from utils.multi_lang import _
from utils.utils import DialogUtils

import cli_style

class Plugin(DialogUtils):
"""This is a general class for plugins
"""
Expand All @@ -34,7 +23,7 @@ def __init__(
"""init for Plugin class "fido"
Args:
app (_type_): _description_
app (Generic): The main Application class
"""
self.app = app
self.pid = 'fido'
Expand All @@ -48,11 +37,14 @@ def process(self) -> None:
pass

def init_plugin(self) -> None:
"""The initialization for this plugin
"""

self.app.create_background_task(self.get_fido_configuration())


def edit_requested_party(self, **kwargs: Any) -> None:
"""This method for editing the requested party
"""
title = _("Enter Request Party Properties")
schema = self.app.cli_object.get_schema_from_reference('Fido2', '#/components/schemas/RequestedParty')
cur_data = kwargs.get('passed', ['', ''])
Expand All @@ -74,8 +66,9 @@ def add_request_party(dialog: Dialog) -> None:
dialog = JansGDialog(self.app, title=title, body=body, buttons=buttons, width=self.app.dialog_width-20)
self.app.show_jans_dialog(dialog)


def delete_requested_party(self, **kwargs: Any) -> None:
"""This method for deleting the requested party
"""
self.requested_parties_container.remove_item(kwargs['selected'])

def create_widgets(self):
Expand Down Expand Up @@ -188,7 +181,6 @@ def create_widgets(self):

self.nav_selection_changed(list(self.tabs)[0])


async def get_fido_configuration(self) -> None:
'Coroutine for getting fido2 configuration.'
try:
Expand Down Expand Up @@ -253,8 +245,9 @@ def nav_selection_changed(
else:
self.main_area = self.app.not_implemented


def save_config(self) -> None:
"""This method for saving the configuration
"""

fido2_config = self.make_data_from_dialog(tabs={'configuration': self.tabs['configuration']})
fido2_static = self.make_data_from_dialog(tabs={'static': self.tabs['static']})
Expand All @@ -276,7 +269,6 @@ async def coroutine():

asyncio.ensure_future(coroutine())


def set_center_frame(self) -> None:
"""center frame content
"""
Expand Down
17 changes: 2 additions & 15 deletions jans-cli-tui/cli_tui/plugins/030_scim/main.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,12 @@
import os
import sys
import asyncio

from typing import Sequence


from prompt_toolkit.application import Application
from prompt_toolkit.layout.containers import HSplit, VSplit, Window
from prompt_toolkit.layout.dimension import D
from prompt_toolkit.widgets import Button, Label, Frame
from prompt_toolkit.formatted_text import HTML
from prompt_toolkit.widgets import Button, Frame
from wui_components.jans_drop_down import DropDownWidget

from utils.utils import DialogUtils
from utils.multi_lang import _


class Plugin(DialogUtils):
"""This is a general class for plugins
"""
Expand All @@ -26,7 +17,7 @@ def __init__(
"""init for Plugin class "scim"
Args:
app (_type_): _description_
app (Generic): The main Application class
"""
self.app = app
self.pid = 'scim'
Expand All @@ -37,7 +28,6 @@ def __init__(
body=HSplit([Button(text=_("Get Scim Configuration"), handler=self.get_app_config)], width=D()),
height=D())


def process(self) -> None:
pass

Expand All @@ -46,7 +36,6 @@ def set_center_frame(self) -> None:
"""
self.app.center_container = self.container


def create_widgets(self) -> None:
"""SCIM Application configuration widgets are created in this fonction
"""
Expand Down Expand Up @@ -87,7 +76,6 @@ def create_widgets(self) -> None:

self.app.center_container = self.container


def get_app_config(self) -> None:
"""Gets SCIM application configurations from server.
"""
Expand All @@ -104,7 +92,6 @@ async def coroutine():

asyncio.ensure_future(coroutine())


def save_app_config(self) -> None:
"""Save button handler for saving SCIM application configurations.
Once configuration data was obtained from form, patch operations are prepared and saved to server.
Expand Down
Loading

0 comments on commit b381ee5

Please sign in to comment.