Skip to content

Sourcery refactored master branch#1

Open
sourcery-ai[bot] wants to merge 1 commit intomasterfrom
sourcery/master
Open

Sourcery refactored master branch#1
sourcery-ai[bot] wants to merge 1 commit intomasterfrom
sourcery/master

Conversation

@sourcery-ai
Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot commented Feb 28, 2023

Branch master refactored by Sourcery.

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

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 master branch, then run:

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

Help us improve this pull request!

@sourcery-ai sourcery-ai Bot requested a review from laith43d February 28, 2023 01:29
Comment thread cli/cli.py

pass_context = click.make_pass_decorator(Context, ensure = True)
cmd_folder = os.path.join(BASE_DIR + '/cli', 'commands')
cmd_folder = os.path.join(f'{BASE_DIR}/cli', 'commands')
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Lines 28-28 refactored with the following changes:

Comment thread cli/cli.py
Comment on lines -34 to +38
rv = []
for filename in os.listdir(cmd_folder):
if filename.endswith('.py') and \
filename.startswith('cmd_'):
rv.append(filename[4:-3])
rv = [
filename[4:-3]
for filename in os.listdir(cmd_folder)
if filename.endswith('.py') and filename.startswith('cmd_')
]
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function CLI.list_commands refactored with the following changes:

Comment thread cli/cli.py
Comment on lines -46 to +51
mod = __import__('cli.commands.cmd_' + name, locals = None, globals = None, fromlist = ['cli'])
mod = __import__(
f'cli.commands.cmd_{name}',
locals=None,
globals=None,
fromlist=['cli'],
)
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function CLI.get_command refactored with the following changes:

Comment thread cli/commands/cmd_api.py
f" pass")

with open(f'api/__init__.py', 'a+') as f:
with open('api/__init__.py', 'a+') as f:
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function make_api refactored with the following changes:

Comment thread cli/commands/cmd_db.py
''')

with open(f'models/__init__.py', 'a+') as f:
with open('models/__init__.py', 'a+') as f:
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function make_model refactored with the following changes:

Comment thread config/settings.py
Comment on lines -64 to +66
handler = RotatingFileHandler(LOG_DIR + '/app.log', maxBytes = 1000000, backupCount = 5)
handler = RotatingFileHandler(
f'{LOG_DIR}/app.log', maxBytes=1000000, backupCount=5
)
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Lines 64-64 refactored with the following changes:

Comment thread facilities/mimes.py
if mime_type in _mime_types[ext]:
exts.append(ext)
return exts
return [ext for ext in _mime_types if mime_type in _mime_types[ext]]
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function get_extensions refactored with the following changes:

if equal is NotImplemented:
return NotImplemented
return not equal
return NotImplemented if equal is NotImplemented else not equal
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function UserMixin.__ne__ refactored with the following changes:

Comment thread models/User.py

def __repr__(self):
return '<User {}>'.format(self.username)
return f'<User {self.username}>'
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function User.__repr__ refactored with the following changes:

Comment thread models/User.py
def lookup(cls, username):
result = cls.query().where('username', username).first_or_fail()
if result:
if result := cls.query().where('username', username).first_or_fail():
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function User.lookup refactored with the following changes:

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