Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2023-06-01 v01.00.004-001-Alpha: Edit Mode Feature Testing (Sourcery refactored) #42

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sourcery-ai[bot]
Copy link

@sourcery-ai sourcery-ai bot commented Jun 1, 2023

Pull Request #41 refactored by Sourcery.

If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.

NOTE: As code is pushed to the original Pull Request, Sourcery will
re-run and update (force-push) this Pull Request with new refactorings as
necessary. If Sourcery finds no refactorings at any point, this Pull Request
will be closed automatically.

See our documentation here.

Run Sourcery locally

Reduce the feedback loop during development by using the Sourcery editor plugin:

Review changes via command line

To manually merge these changes, make sure you're on the main branch, then run:

git fetch origin sourcery/main
git merge --ff-only FETCH_HEAD
git reset HEAD^

Help us improve this pull request!

@sourcery-ai sourcery-ai bot requested a review from iPoetDev June 1, 2023 17:35
app.py Outdated
def mode(ctx, param, value) \
-> str | None: # noqa Contexts, Parameters uses in callbacks
def mode(ctx, param, value) -> str | None: # noqa Contexts, Parameters uses in callbacks
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Valid.mode refactored with the following changes:

This removes the following comments ( why? ):

# Exit Edit Mode: Automatically exit Editing Mode.
# Enter Delete Edit Mode: To clear, remove existing record's value.
# Enter Update Edit Mode: To append, update, new inputs to existing.

app.py Outdated
Comment on lines 399 to 412
def checkcommand(mode: str) \
-> str | None:
def checkcommand(mode: str) -> str | None:
"""Check the mode, translate to edit comand tyoe."""
allowed = {App.values.Edit.ADD,
App.values.Edit.UPDATE, App.values.Edit.DELETE}
if mode in allowed:
if mode == App.values.Edit.ADD:
return App.values.Edit.INSERT
elif mode == App.values.Edit.UPDATE:
return App.values.Edit.APPEND
elif mode == App.values.Edit.DELETE:
return App.values.Edit.CLEAR
else:
if mode not in allowed:
return None
if mode == App.values.Edit.ADD:
return App.values.Edit.INSERT
elif mode == App.values.Edit.UPDATE:
return App.values.Edit.APPEND
elif mode == App.values.Edit.DELETE:
return App.values.Edit.CLEAR
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Valid.checkcommand refactored with the following changes:

app.py Outdated
Comment on lines 462 to 303
if debug is True:

if debug:
rprint("Debug Mode: Show Record")
inspector(individual)

if displayon:
if individual.card(consolecard=Webconsole.console) is not None:
window.printpanels(record=individual)
else:
click.echo("Displaying Simple Card")
individual.card(consolecard=Webconsole.console)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Window.showrecord refactored with the following changes:

app.py Outdated
Comment on lines 967 to 971
@click.option(f'-selects', 'selects',
type=click.Choice(choices=App.views.Todo,
case_sensitive=App.values.case),
default=App.values.Todo.Selects.default,
show_default=App.values.shown,
prompt=App.values.Todo.Selects.prompt,
help=App.values.Todo.Selects.help)
@click.option('-selects', 'selects', type=click.Choice(choices=App.views.Todo,
case_sensitive=App.values.case), default=App.values.Todo.Selects.default, show_default=App.values.shown, prompt=App.values.Todo.Selects.prompt, help=App.values.Todo.Selects.help)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function todo refactored with the following changes:

controller.py Outdated
debug: bool = True) \
-> pd.Series | pd.DataFrame | None:
debug: bool = True) -> pd.Series | pd.DataFrame | None:
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Results.getrowdata refactored with the following changes:

controller.py Outdated
Comment on lines 1137 to 1119
if switch is True:
if switch:
return renderable

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Record.switch refactored with the following changes:

controller.py Outdated
Comment on lines 1485 to 1582
location: int | None = None, debug=False) -> None: # noqa
location: int | None = None, debug=False) -> None: # noqa
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Editor.modifynotes refactored with the following changes:

This removes the following comments ( why? ):

# EditMode is Append: then append the notes the Notes column
# EditMode is Clear: then clear the notes the Notes column

controller.py Outdated
Comment on lines 1609 to 1730

if series[column] == 'Add a note'.strip():
series[column] = cleared
return series[column]

def _haslabel() -> bool:
"""Checks if the notes have a label"""
return True if series[column].startswith('Add a note') else False
return bool(series[column].startswith('Add a note'))

def _emptydelete(clear: str = '') -> bool:
"""Checks if the notes are empty"""
if nodestroy is False and _haslabel() is False:
return True if series[column] == clear else False
elif nodestroy is True and _haslabel() is True:
if not nodestroy and _haslabel() is False:
return series[column] == clear
elif nodestroy and _haslabel() is True:
series[column] = _removelabel(clear)
return True if series[column] == clear else False
elif nodestroy is True and _haslabel() is False:
return True if series[column] == clear else False
elif nodestroy is True and _haslabel() is True:
return series[column] == clear
elif nodestroy and _haslabel() is False:
return series[column] == clear
elif nodestroy and _haslabel() is True:
series[column] = _removelabel(clear)
return True if series[column] == clear else False
return series[column] == clear

_cleared = ''
if _emptydelete(_cleared):
click.echo(message="No notes to delete")
return series[column]
elif nodestroy is False:
elif not nodestroy:
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Editor.deletenotes refactored with the following changes:

controller.py Outdated
Comment on lines 1660 to 1712

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Editor.togglestatus refactored with the following changes:

controller.py Outdated
Comment on lines 1923 to 2142
vlue: str,
ix: int,
col: str) -> pd.DataFrame | None:
vlue: str,
ix: int,
col: str) -> pd.DataFrame | None:
"""Update the data at the index and column"""

def _atindexcolumn(data, debg: bool, isz: bool):
"""Update the data at the index and column"""
data.at[ix, col] = vlue
if isz and debug is True:
if isz and debug:
click.secho(
message=f"_IXxCol: Note Updated at row: {ix} "
"by zero index for "
f"{record.series.name}",
err=True)
rich.inspect(data.at[ix, col])
elif not isz and debug is True:
elif not isz and debug:
click.secho(
message="_IXxCol: Note Updated at nonzero'd"
f" row: {ix} "
f"by {record.series.name} only",
err=True)
rich.inspect(data.at[ix, col])

# Use the internal DF pointer if the index is not given
if ix is None and col is not None:
framedata.at[record.series.name, col] = vlue
# Use the index of the row if the column is given
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Editor.insert refactored with the following changes:

This removes the following comments ( why? ):

# Use the index of the row if the column is given
# For If neither, return the original DataFrame, with no changes
# For subsequent column updates and reuse of the same updated DataFrame

@sourcery-ai sourcery-ai bot force-pushed the sourcery/main branch 5 times, most recently from 87c5917 to adba1a0 Compare June 3, 2023 10:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants